code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
#!/usr/bin/python
# Copyright (c) 2017, Massachusetts Institute of Technology All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# Redistributions of source code must retain the above copyright notic... | [
"MDSplus.Tree.setCurrent",
"threading.Thread",
"MDSplus.Tree.getCurrent",
"MDSplus.Connection",
"MDSplus.Float32",
"MDSplus.setenv",
"time.sleep",
"MDSplus.Tree",
"MDSplus.GetMany"
] | [((7366, 7391), 'MDSplus.Connection', 'Connection', (['"""local://gub"""'], {}), "('local://gub')\n", (7376, 7391), False, 'from MDSplus import Connection, GetMany, Float32, Range, setenv, Tree, TreeNNF, TreeNodeArray, ADD\n'), ((2631, 2649), 'MDSplus.Connection', 'Connection', (['server'], {}), '(server)\n', (2641, 26... |
# Generated by Django 2.1.5 on 2019-02-08 16:35
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('upload', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='book',
name... | [
"django.db.models.CharField"
] | [((351, 417), 'django.db.models.CharField', 'models.CharField', ([], {'default': 'django.utils.timezone.now', 'max_length': '(50)'}), '(default=django.utils.timezone.now, max_length=50)\n', (367, 417), False, 'from django.db import migrations, models\n')] |
from src.homework.homework11.player import Player
from src.homework.homework11.game_log import GameLog
from src.homework.homework11.die6 import Die6
from src.homework.homework11.die8 import Die8
#write import statements for Die6 and Die8 classes
##src.homework.homework11.
game_log = GameLog()
d6 = Die6()
d8 = Die8()
#... | [
"src.homework.homework11.player.Player",
"src.homework.homework11.die8.Die8",
"src.homework.homework11.game_log.GameLog",
"src.homework.homework11.die6.Die6"
] | [((284, 293), 'src.homework.homework11.game_log.GameLog', 'GameLog', ([], {}), '()\n', (291, 293), False, 'from src.homework.homework11.game_log import GameLog\n'), ((299, 305), 'src.homework.homework11.die6.Die6', 'Die6', ([], {}), '()\n', (303, 305), False, 'from src.homework.homework11.die6 import Die6\n'), ((311, 3... |
'''
预定义组合层,目的为便于使用
尽可能使用jit编译,如果jit有困难,则果断不使用jit
'''
import torch
import torch.jit
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import math
from typing import Iterable as _Iterable
from typing import Callable as _Callable
from . import ops
from . import utils
from .more_layers import *
... | [
"torch.ones",
"math.sqrt",
"torch.cat",
"torch.zeros",
"torch.nn.functional.linear",
"torch.chunk",
"torch.nn.functional.interpolate"
] | [((1086, 1163), 'torch.nn.functional.interpolate', 'F.interpolate', (['x', 'self.size', 'self.scale_factor', 'self.mode', 'self.align_corners'], {}), '(x, self.size, self.scale_factor, self.mode, self.align_corners)\n', (1099, 1163), True, 'import torch.nn.functional as F\n'), ((1536, 1631), 'torch.nn.functional.interp... |
# encoding=utf8
import numpy as np
from datasets import load_metric
# the code below refers to the https://github.com/Yale-LILY/FeTaQA/blob/main/end2end/train.py
def postprocess_text(preds, references_s, metric_name):
preds = [pred.strip() for pred in preds]
references_s = [[reference.strip() for ref... | [
"numpy.mean",
"json.load",
"datasets.load_metric"
] | [((4371, 4383), 'json.load', 'json.load', (['f'], {}), '(f)\n', (4380, 4383), False, 'import json\n'), ((1656, 1680), 'datasets.load_metric', 'load_metric', (['metric_name'], {}), '(metric_name)\n', (1667, 1680), False, 'from datasets import load_metric\n'), ((4013, 4039), 'numpy.mean', 'np.mean', (['avg_bleurt_scores'... |
import numpy as np
import pandas as pd
from datetime import datetime
import pytest
import empyrical
from vectorbt import defaults
from vectorbt.records.drawdowns import Drawdowns
from tests.utils import isclose
day_dt = np.timedelta64(86400000000000)
index = pd.DatetimeIndex([
datetime(2018, 1, 1),
datetime... | [
"empyrical.tail_ratio",
"empyrical.excess_sharpe",
"empyrical.conditional_value_at_risk",
"numpy.isnan",
"pandas.DatetimeIndex",
"pytest.mark.parametrize",
"empyrical.value_at_risk",
"empyrical.beta",
"pandas.DataFrame",
"empyrical.omega_ratio",
"empyrical.downside_risk",
"empyrical.max_drawdo... | [((223, 253), 'numpy.timedelta64', 'np.timedelta64', (['(86400000000000)'], {}), '(86400000000000)\n', (237, 253), True, 'import numpy as np\n'), ((419, 516), 'pandas.DataFrame', 'pd.DataFrame', (["{'a': [1, 2, 3, 4, 5], 'b': [5, 4, 3, 2, 1], 'c': [1, 2, 3, 2, 1]}"], {'index': 'index'}), "({'a': [1, 2, 3, 4, 5], 'b': [... |
"""
Copyright BOOSTRY 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 in writing,
software distr... | [
"web3.Web3.HTTPProvider",
"app.contracts.Contract.get_contract"
] | [((737, 781), 'web3.Web3.HTTPProvider', 'Web3.HTTPProvider', (['config.WEB3_HTTP_PROVIDER'], {}), '(config.WEB3_HTTP_PROVIDER)\n', (754, 781), False, 'from web3 import Web3\n'), ((1057, 1144), 'app.contracts.Contract.get_contract', 'Contract.get_contract', ([], {'contract_name': '"""PersonalInfo"""', 'address': 'person... |
from wtforms import SubmitField, TextAreaField
from lamby.forms.base import BaseForm
class DeleteProjectForm(BaseForm):
submit = SubmitField('Delete Project')
class EditReadmeForm(BaseForm):
markdown = TextAreaField()
submit = SubmitField('Confirm Changes')
class EditMembersForm(BaseForm):
member... | [
"wtforms.SubmitField",
"wtforms.TextAreaField"
] | [((136, 165), 'wtforms.SubmitField', 'SubmitField', (['"""Delete Project"""'], {}), "('Delete Project')\n", (147, 165), False, 'from wtforms import SubmitField, TextAreaField\n'), ((215, 230), 'wtforms.TextAreaField', 'TextAreaField', ([], {}), '()\n', (228, 230), False, 'from wtforms import SubmitField, TextAreaField\... |
from logging import getLogger
from src.configurations import PlatformConfigurations
from src.db import cruds, models, schemas
from src.db.database import get_context_db
logger = getLogger(__name__)
def initialize_database(engine, checkfirst: bool = True):
models.create_tables(engine=engine, checkfirst=checkfirs... | [
"logging.getLogger",
"src.db.schemas.ItemBase",
"src.db.models.create_tables",
"src.db.database.get_context_db",
"src.db.cruds.register_items"
] | [((180, 199), 'logging.getLogger', 'getLogger', (['__name__'], {}), '(__name__)\n', (189, 199), False, 'from logging import getLogger\n'), ((264, 322), 'src.db.models.create_tables', 'models.create_tables', ([], {'engine': 'engine', 'checkfirst': 'checkfirst'}), '(engine=engine, checkfirst=checkfirst)\n', (284, 322), F... |
# Copyright (c) 2020-2021 <NAME> IT-Services GmbH
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from click.testing import CliRunner
from creditor_cli import creditor
from debtor_cli import debtor
from facilitator_cli import fac... | [
"lib.utils.SafeDerivation",
"click.testing.CliRunner"
] | [((538, 549), 'click.testing.CliRunner', 'CliRunner', ([], {}), '()\n', (547, 549), False, 'from click.testing import CliRunner\n'), ((3085, 3096), 'click.testing.CliRunner', 'CliRunner', ([], {}), '()\n', (3094, 3096), False, 'from click.testing import CliRunner\n'), ((1222, 1238), 'lib.utils.SafeDerivation', 'SafeDer... |
from __future__ import annotations
import logging
from typing import Sequence
from meerkat.cells.imagepath import ImagePath
from meerkat.columns.cell_column import CellColumn
logger = logging.getLogger(__name__)
class ImageColumn(CellColumn):
def __init__(self, *args, **kwargs):
super(ImageColumn, self... | [
"meerkat.cells.imagepath.ImagePath",
"logging.getLogger"
] | [((187, 214), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (204, 214), False, 'import logging\n'), ((570, 619), 'meerkat.cells.imagepath.ImagePath', 'ImagePath', (['fp'], {'transform': 'transform', 'loader': 'loader'}), '(fp, transform=transform, loader=loader)\n', (579, 619), False, 'f... |
"""
********************************************
test_generator_moduL_formelfrage.py
@digitalfellowship - Stand 07/2021
Autor: <NAME>
********************************************
Dieses Modul dient der Erstellung der Formelfragen-GUI
sowie den Formelfragen in XML Struktur
"""
from tkinter import ttk
fro... | [
"Test_Generator_Module.test_generator_modul_datenbanken_erstellen.Import_Export_Database.excel_import_to_db",
"os.walk",
"Test_Generator_Module.test_generator_modul_taxonomie_und_textformatierung.Textformatierung.set_position_for_picture_1",
"Test_Generator_Module.test_generator_modul_taxonomie_und_textformat... | [((5633, 5680), 'sqlite3.connect', 'sqlite3.connect', (['self.database_formelfrage_path'], {}), '(self.database_formelfrage_path)\n', (5648, 5680), False, 'import sqlite3\n'), ((19804, 19853), 'sqlite3.connect', 'sqlite3.connect', (['self.test_settings_database_path'], {}), '(self.test_settings_database_path)\n', (1981... |
# 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... | [
"inspect.signature",
"functools.wraps"
] | [((7701, 7724), 'inspect.signature', 'inspect.signature', (['func'], {}), '(func)\n', (7718, 7724), False, 'import inspect\n'), ((7731, 7752), 'functools.wraps', 'functools.wraps', (['func'], {}), '(func)\n', (7746, 7752), False, 'import functools\n')] |
import csv
import re
import lxml.html
from collections import defaultdict
from cStringIO import StringIO
from billy.scrape.legislators import Legislator, LegislatorScraper
from billy.scrape import NoDataForPeriod
from openstates.utils import LXMLMixin, validate_phone_number,\
validate_email_address
class MNLegisl... | [
"openstates.utils.validate_email_address",
"openstates.utils.validate_phone_number",
"billy.scrape.legislators.Legislator",
"re.match",
"collections.defaultdict",
"cStringIO.StringIO",
"re.search"
] | [((3587, 3604), 'collections.defaultdict', 'defaultdict', (['dict'], {}), '(dict)\n', (3598, 3604), False, 'from collections import defaultdict\n'), ((1290, 1320), 're.search', 're.search', (['"""^.+\\\\("""', 'name_text'], {}), "('^.+\\\\(', name_text)\n", (1299, 1320), False, 'import re\n'), ((1439, 1479), 're.search... |
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 12 01:11:07 2020
@author: liorr
"""
import numpy as np
import warnings
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
import pickle
from typing import List
import tensorflow as tf
class nn_Model:
def __init__(self,controller):
self.contro... | [
"tensorflow.keras.layers.sum",
"tensorflow.keras.models.load_model",
"tensorflow.keras.layers.Dropout",
"tensorflow.keras.layers.Dense",
"tensorflow.keras.layers.AveragePooling1D",
"numpy.isinf",
"numpy.isnan",
"tensorflow.keras.models.Model",
"tensorflow.keras.backend.abs",
"tensorflow.keras.laye... | [((1347, 1400), 'tensorflow.keras.Sequential', 'tf.keras.Sequential', (['lstm_layers'], {'name': '"""Siamese-lstm"""'}), "(lstm_layers, name='Siamese-lstm')\n", (1366, 1400), True, 'import tensorflow as tf\n'), ((3629, 3681), 'tensorflow.keras.models.load_model', 'tf.keras.models.load_model', ([], {'filepath': 'self.sc... |
"""
PyJJoin joins two JSON files containing lists of lists data on a common attribute.
:authors: <NAME>
:date: September 2019
"""
import sys
import json
import argparse
from .core import BasePyJUnixFunction, PyJCommandLineArgumentParser
class PyJJoin(BasePyJUnixFunction):
"""
Joins two JSON files on a comm... | [
"sys.exit",
"json.load",
"argparse.FileType",
"json.dumps"
] | [((3508, 3538), 'json.load', 'json.load', (['self.script_args.f1'], {}), '(self.script_args.f1)\n', (3517, 3538), False, 'import json\n'), ((3561, 3591), 'json.load', 'json.load', (['self.script_args.f2'], {}), '(self.script_args.f2)\n', (3570, 3591), False, 'import json\n'), ((6502, 6520), 'json.dumps', 'json.dumps', ... |
# -*- coding: utf-8 -*-
"""Python objects for Tanium's API."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import datetime
import importlib
import six
import warnings
from . import exceptions
from .. import api_mo... | [
"datetime.datetime.strptime",
"warnings.simplefilter",
"importlib.import_module",
"pathlib.Path"
] | [((1283, 1319), 'importlib.import_module', 'importlib.import_module', (['module_path'], {}), '(module_path)\n', (1306, 1319), False, 'import importlib\n'), ((2526, 2599), 'warnings.simplefilter', 'warnings.simplefilter', (['action', 'api_models.exceptions.AttrUndefinedWarning'], {}), '(action, api_models.exceptions.Att... |
import pytest
from pydano.test_utils import (
get_random_address,
add_money,
empty_wallet,
check_lovelace,
MIN_UTXO,
MIN_CHANGE_UTXO,
MAINNET,
FUND_WALLET_SIGNING_KEY,
)
from pydano.features.empty_wallet import EmptyWallet
def test_empty_wallet():
amount = 10000000
fees = 2000... | [
"pydano.test_utils.check_lovelace",
"pydano.test_utils.empty_wallet",
"pydano.test_utils.get_random_address",
"pydano.test_utils.add_money"
] | [((334, 354), 'pydano.test_utils.get_random_address', 'get_random_address', ([], {}), '()\n', (352, 354), False, 'from pydano.test_utils import get_random_address, add_money, empty_wallet, check_lovelace, MIN_UTXO, MIN_CHANGE_UTXO, MAINNET, FUND_WALLET_SIGNING_KEY\n'), ((359, 382), 'pydano.test_utils.add_money', 'add_m... |
import click
import boto3
import threading
from os import path
from jinja2 import Environment, FileSystemLoader
KILT_CFN = path.join(path.dirname(__file__), 'kilt.yaml')
KILT_ZIP = path.join(path.dirname(__file__), 'kilt.zip')
assert path.exists(KILT_CFN), 'Could not find cloudformation jinja template'
assert path.ex... | [
"click.progressbar",
"click.argument",
"boto3.client",
"os.path.getsize",
"os.path.dirname",
"click.option",
"os.path.exists",
"click.echo",
"click.command",
"threading.Lock",
"boto3.resource",
"click.Path",
"boto3.session.Session",
"click.style"
] | [((236, 257), 'os.path.exists', 'path.exists', (['KILT_CFN'], {}), '(KILT_CFN)\n', (247, 257), False, 'from os import path\n'), ((313, 334), 'os.path.exists', 'path.exists', (['KILT_ZIP'], {}), '(KILT_ZIP)\n', (324, 334), False, 'from os import path\n'), ((802, 837), 'click.command', 'click.command', (['"""kilt-cfn-ins... |
# -*- coding: utf-8 -*-
"""
Created on Mon Jan 11 16:12:22 2021
@author: aschauer
"""
import os
import logging
from collections import defaultdict
from matplotlib.transforms import Affine2D
import pandas as pd
import numpy as np
import seaborn as sns
from sklearn.metrics import r2_score, mean_squared_error
import mat... | [
"cv_results_database.get_cv_results_as_df",
"numpy.polyfit",
"sklearn.metrics.r2_score",
"collections.defaultdict",
"numpy.arange",
"matplotlib.legend_handler.HandlerTuple.__init__",
"matplotlib.pyplot.tight_layout",
"matplotlib.legend_handler.HandlerTuple",
"os.path.abspath",
"matplotlib.lines.Li... | [((604, 631), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (621, 631), False, 'import logging\n'), ((663, 698), 'seaborn.set_color_codes', 'sns.set_color_codes', ([], {'palette': '"""deep"""'}), "(palette='deep')\n", (682, 698), True, 'import seaborn as sns\n'), ((705, 727), 'cv_results... |
#!/usr/bin/env python3
"""
Pre-processing pipeline for DCASE 2016 task 2 task (sound event
detection).
The HEAR 2021 variation of DCASE 2016 Task 2 is that we ignore the
monophonic training data and use the dev data for train.
We also allow training data outside this task.
"""
import logging
import os
from pathlib im... | [
"pandas.read_csv",
"os.path.exists",
"heareval.tasks.pipeline.get_download_and_extract_tasks",
"luigi.TaskParameter",
"heareval.tasks.pipeline.run",
"heareval.tasks.pipeline.FinalizeCorpus",
"pandas.concat",
"logging.getLogger"
] | [((442, 478), 'logging.getLogger', 'logging.getLogger', (['"""luigi-interface"""'], {}), "('luigi-interface')\n", (459, 478), False, 'import logging\n'), ((1372, 1393), 'luigi.TaskParameter', 'luigi.TaskParameter', ([], {}), '()\n', (1391, 1393), False, 'import luigi\n'), ((1405, 1426), 'luigi.TaskParameter', 'luigi.Ta... |
"""Configuration module."""
import configparser
import io
import logging
import os
from datetime import datetime
from email.utils import parseaddr
from pathlib import Path
from urllib.parse import urlunsplit
import easimpconf
from salmagundi import strings
from . import const
from .exceptions import ConfigError
from... | [
"io.StringIO",
"easimpconf.convert_predicate",
"os.path.abspath",
"warnings.simplefilter",
"logging.basicConfig",
"urllib.parse.urlunsplit",
"salmagundi.strings.str2tuple",
"email.utils.parseaddr",
"logging.captureWarnings",
"easimpconf.convert_loglevel",
"salmagundi.strings.str2bool",
"pathli... | [((732, 759), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (749, 759), False, 'import logging\n'), ((7211, 7321), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.NOTSET', 'format': "app_cfg['logging', 'msg_format']", 'handlers': '[log_handler]'}), "(level=logging.N... |
from lib.util import random_number, num_qubits, execute
from lib.grover import grover
from lib.oracles.numeric import oracle
predictions = [
'It is certain.',
'It is decidedly so.',
'Without a doubt.',
'Yes definitely.',
'You may rely on it.',
'As I see it, yes.',
'Most likely.',
'Outlo... | [
"lib.util.execute",
"lib.grover.grover"
] | [((1799, 1819), 'lib.grover.grover', 'grover', (['oracle', 'r', 'n'], {}), '(oracle, r, n)\n', (1805, 1819), False, 'from lib.grover import grover\n'), ((1890, 1901), 'lib.util.execute', 'execute', (['qc'], {}), '(qc)\n', (1897, 1901), False, 'from lib.util import random_number, num_qubits, execute\n')] |
#!/usr/bin/env python
import sys
import png
reader = png.Reader(filename="./hugo-8x16.png")
data = reader.read()
in_rows = data[2]
data = list()
for in_row in in_rows:
data_row = list()
element_nr = 0
for byte in in_row:
if element_nr == 0: #not importan which from R,G,B (its 0 or 255 for all of th... | [
"png.Reader"
] | [((54, 92), 'png.Reader', 'png.Reader', ([], {'filename': '"""./hugo-8x16.png"""'}), "(filename='./hugo-8x16.png')\n", (64, 92), False, 'import png\n')] |
import os
from gocd_tools.defaults import (
is_env_set,
ENV_GO_PLUGIN_DIR,
GO_PLUGIN_DIR,
BUNDLED_PLUGIN,
GOCD_SECRET_PLUGIN,
)
def get_plugin_dir():
plugin_path, msg = is_env_set(ENV_GO_PLUGIN_DIR)
if not plugin_path:
if GO_PLUGIN_DIR:
return GO_PLUGIN_DIR, ""
... | [
"gocd_tools.defaults.is_env_set",
"os.path.join"
] | [((195, 224), 'gocd_tools.defaults.is_env_set', 'is_env_set', (['ENV_GO_PLUGIN_DIR'], {}), '(ENV_GO_PLUGIN_DIR)\n', (205, 224), False, 'from gocd_tools.defaults import is_env_set, ENV_GO_PLUGIN_DIR, GO_PLUGIN_DIR, BUNDLED_PLUGIN, GOCD_SECRET_PLUGIN\n'), ((552, 602), 'os.path.join', 'os.path.join', (['plugin_dir_path', ... |
from os import path
# Check if a directory exists and if it's valid
def is_valid_directory(directory):
if not path.exists(directory): # If the directory is not present
print(f'Cannot find directory [{directory}]')
return False
if not path.isdir(directory): # If the 'directory' is not actually a director... | [
"os.path.isdir",
"os.path.exists"
] | [((113, 135), 'os.path.exists', 'path.exists', (['directory'], {}), '(directory)\n', (124, 135), False, 'from os import path\n'), ((250, 271), 'os.path.isdir', 'path.isdir', (['directory'], {}), '(directory)\n', (260, 271), False, 'from os import path\n')] |
"""Main server script for ColorDJ."""
import io
import requests
from flask import Flask, request
from twilio.twiml.messaging_response import MessagingResponse
from colortovision import get_image_attributes, get_playlist_ids
from playlist import make_playlist
app = Flask(__name__)
@app.route("/sms", methods=['GET'... | [
"twilio.twiml.messaging_response.MessagingResponse",
"colortovision.get_playlist_ids",
"flask.Flask",
"playlist.make_playlist",
"colortovision.get_image_attributes",
"requests.get"
] | [((269, 284), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (274, 284), False, 'from flask import Flask, request\n'), ((444, 463), 'twilio.twiml.messaging_response.MessagingResponse', 'MessagingResponse', ([], {}), '()\n', (461, 463), False, 'from twilio.twiml.messaging_response import MessagingResponse\n... |
from argparse import ArgumentParser
from os import path
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
from matplotlib.patches import FancyArrowPatch
from mpl_toolkits.mplot3d import Axes3D, proj3d
import numpy
from plotypus.preprocessing import Fourier
from matplotlib import rc
rc('font', **... | [
"matplotlib.rc",
"mpl_toolkits.mplot3d.proj3d.proj_transform",
"argparse.ArgumentParser",
"numpy.linalg.lstsq",
"matplotlib.patches.FancyArrowPatch.draw",
"matplotlib.pyplot.close",
"plotypus.utils.make_sure_path_exists",
"matplotlib.pyplot.figure",
"matplotlib.use",
"numpy.array",
"numpy.loadtx... | [((74, 95), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (88, 95), False, 'import matplotlib\n'), ((307, 374), 'matplotlib.rc', 'rc', (['"""font"""'], {}), "('font', **{'family': 'sans-serif', 'sans-serif': ['Helvetica']})\n", (309, 374), False, 'from matplotlib import rc\n'), ((372, 395), 'mat... |
import os
import pathlib
from mlrun.api.db.init_db import init_db
from mlrun.api.db.session import create_session, close_session
from mlrun.utils import logger
from .utils.alembic import AlembicUtil
def init_data(from_scratch: bool = False) -> None:
logger.info("Creating initial data")
# run migrations on e... | [
"mlrun.utils.logger.info",
"mlrun.api.db.session.create_session",
"os.path.realpath",
"mlrun.api.db.init_db.init_db",
"mlrun.api.db.session.close_session"
] | [((257, 293), 'mlrun.utils.logger.info', 'logger.info', (['"""Creating initial data"""'], {}), "('Creating initial data')\n", (268, 293), False, 'from mlrun.utils import logger\n'), ((609, 625), 'mlrun.api.db.session.create_session', 'create_session', ([], {}), '()\n', (623, 625), False, 'from mlrun.api.db.session impo... |
# -*- encoding: utf-8 -*-
'''
@Time : 2021-08-01
@Author : EvilRecluse
@Contact : https://github.com/RecluseXU
@Desc : 喝水页
'''
# here put the import lib
from ._base import INIT_COOKIES, BASE_HEADERS
import requests
import json
import re
CONFIG_PATTERN = re.compile(r'(<=window\._config_ = ){[^}]+?}')
... | [
"requests.get",
"re.compile"
] | [((272, 318), 're.compile', 're.compile', (['"""(<=window\\\\._config_ = ){[^}]+?}"""'], {}), "('(<=window\\\\._config_ = ){[^}]+?}')\n", (282, 318), False, 'import re\n'), ((463, 519), 'requests.get', 'requests.get', (['url'], {'headers': 'headers', 'cookies': 'INIT_COOKIES'}), '(url, headers=headers, cookies=INIT_COO... |
import discord
from discord.ext import commands
class Moderation(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command()
@commands.has_permissions(kick_members=True)
@commands.bot_has_permissions(kick_members=True)
@commands.guild_only()
async def kick(self, ctx, use... | [
"discord.utils.get",
"discord.ext.commands.command",
"discord.ext.commands.has_permissions",
"discord.ext.commands.bot_has_permissions",
"discord.ext.commands.guild_only"
] | [((139, 157), 'discord.ext.commands.command', 'commands.command', ([], {}), '()\n', (155, 157), False, 'from discord.ext import commands\n'), ((163, 206), 'discord.ext.commands.has_permissions', 'commands.has_permissions', ([], {'kick_members': '(True)'}), '(kick_members=True)\n', (187, 206), False, 'from discord.ext i... |
from os import *
import traceback
import sys, random
try:
f = open("tmp", O_RDONLY)
while 1:
bN = read(f,1)
if len(bN) == 0:
print ("No more data")
exit(0)
N = int.from_bytes(bN, sys.byteorder)
print ("recu :", chr(N))
except OSError as e:
traceback.... | [
"traceback.print_exc"
] | [((310, 331), 'traceback.print_exc', 'traceback.print_exc', ([], {}), '()\n', (329, 331), False, 'import traceback\n')] |
"""Crie um código em python que teste se o site Pudim está acessível pelo computador usado."""
import urllib
import urllib.request
try:
site = urllib.request.urlopen('http://www.pudim.com.br')
except:
print('deu erro!')
else:
print('tudo ok')
| [
"urllib.request.urlopen"
] | [((147, 196), 'urllib.request.urlopen', 'urllib.request.urlopen', (['"""http://www.pudim.com.br"""'], {}), "('http://www.pudim.com.br')\n", (169, 196), False, 'import urllib\n')] |
import logging
import numpy as np
import itertools
logger = logging.getLogger(__name__)
# #######################################
# ############ set_action ###############
# #######################################
def ctrl_set_action(sim, action):
"""
For torque actuators it copies the action into mujoco ct... | [
"numpy.abs",
"numpy.log",
"numpy.square",
"numpy.zeros",
"logging.getLogger",
"numpy.split",
"itertools.chain.from_iterable",
"numpy.concatenate"
] | [((61, 88), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (78, 88), False, 'import logging\n'), ((2162, 2208), 'numpy.concatenate', 'np.concatenate', (['[sim.data.qpos, sim.data.qvel]'], {}), '([sim.data.qpos, sim.data.qvel])\n', (2176, 2208), True, 'import numpy as np\n'), ((463, 504), ... |
from math import sin, cos, radians
class Ship(object):
def __init__(self, X, Y, Angle, FaceAngle, Speed):
self.X = X
self.Y = Y
self.toX = Speed * -sin(radians(Angle))
self.toY = Speed * cos(radians(Angle))
self.angle = Angle
self.faceAngle = FaceAngle
self.sp... | [
"math.radians"
] | [((227, 241), 'math.radians', 'radians', (['Angle'], {}), '(Angle)\n', (234, 241), False, 'from math import sin, cos, radians\n'), ((180, 194), 'math.radians', 'radians', (['Angle'], {}), '(Angle)\n', (187, 194), False, 'from math import sin, cos, radians\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import getopt
__version__ = "0.2"
def printHelp():
"""
Prints the help message.
"""
help_str = """
NAME
pytex
SYNOPSIS
pytex file [options]
DESCRIPTION
A thin wrapper for pdflatex and bibtex. It will
run pdflatex on the in... | [
"os.remove",
"getopt.getopt",
"os.popen",
"os.path.isfile",
"os.listdir",
"sys.exit"
] | [((2617, 2630), 'os.popen', 'os.popen', (['cmd'], {}), '(cmd)\n', (2625, 2630), False, 'import os\n'), ((3261, 3284), 'os.path.isfile', 'os.path.isfile', (['texFile'], {}), '(texFile)\n', (3275, 3284), False, 'import os\n'), ((3841, 3901), 'getopt.getopt', 'getopt.getopt', (['args', '"""hro:b"""', "['help', 'options=',... |
from pprint import pprint
import requests
import time
from bs4 import BeautifulSoup
class Bot:
headers = {
'authority': 'statsroyale.com',
'cache-control': 'max-age=0',
'sec-ch-ua': '" Not A;Brand";v="99", "Chromium";v="99", "Google Chrome";v="99"',
'sec-ch-ua-mobile': '?0',
'sec-ch-... | [
"bs4.BeautifulSoup",
"requests.get"
] | [((2170, 2217), 'requests.get', 'requests.get', (['product_url'], {'headers': 'self.headers'}), '(product_url, headers=self.headers)\n', (2182, 2217), False, 'import requests\n'), ((2234, 2273), 'bs4.BeautifulSoup', 'BeautifulSoup', (['r.content', '"""html.parser"""'], {}), "(r.content, 'html.parser')\n", (2247, 2273),... |
import unittest
import unittest.mock
import time
import sergeant.worker
import sergeant.executor
import sergeant.config
class SerialTestCase(
unittest.TestCase,
):
def setUp(
self,
):
self.worker = unittest.mock.MagicMock()
self.worker.config = sergeant.config.WorkerConfig(
... | [
"unittest.mock.MagicMock",
"time.sleep"
] | [((229, 254), 'unittest.mock.MagicMock', 'unittest.mock.MagicMock', ([], {}), '()\n', (252, 254), False, 'import unittest\n'), ((499, 541), 'unittest.mock.MagicMock', 'unittest.mock.MagicMock', ([], {'return_value': '(True)'}), '(return_value=True)\n', (522, 541), False, 'import unittest\n'), ((596, 621), 'unittest.moc... |
import json
data = [
{
"model": "route.PlatformType",
"pk": 1,
"fields": {
"name": "platform",
"description": "Остановка"
}
},
{
"model": "route.PlatformType",
"pk": 2,
"fields": {
"name": "platform_exit_only",
... | [
"json.dump"
] | [((629, 648), 'json.dump', 'json.dump', (['data', 'fp'], {}), '(data, fp)\n', (638, 648), False, 'import json\n')] |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-05-23 11:39
from __future__ import unicode_literals
from __future__ import absolute_import
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('data_interfaces', '0009_scheduling_integration'),
... | [
"django.db.models.CharField"
] | [((465, 520), 'django.db.models.CharField', 'models.CharField', ([], {'default': '"""CASE_UPDATE"""', 'max_length': '(126)'}), "(default='CASE_UPDATE', max_length=126)\n", (481, 520), False, 'from django.db import migrations, models\n')] |
import data.shaders.shader_program as sp
import data.tools.maths as m
import numpy
class skybox_shader(sp.ShaderProgram):
VERTEX_FILE = "data\\shaders\\skybox_vertex_shader.txt"
FRAGMENT_FILE = "data\\shaders\\skybox_fragment_shader.txt"
ROTATION_SPEED = 1.0
current_rotation = 0.0
def __init__(self):
... | [
"numpy.radians",
"data.tools.maths.Maths"
] | [((1890, 1926), 'numpy.radians', 'numpy.radians', (['self.current_rotation'], {}), '(self.current_rotation)\n', (1903, 1926), False, 'import numpy\n'), ((1691, 1700), 'data.tools.maths.Maths', 'm.Maths', ([], {}), '()\n', (1698, 1700), True, 'import data.tools.maths as m\n'), ((1873, 1882), 'data.tools.maths.Maths', 'm... |
from selenium import webdriver
import time
driver = webdriver.PhantomJS(executable_path='')
driver.get("http://pythonscraping.com/pages/javascript/ajaxDemo.html")
time.sleep(3)
print(driver.find_element_by_id('content').text)
driver.close()
| [
"selenium.webdriver.PhantomJS",
"time.sleep"
] | [((52, 91), 'selenium.webdriver.PhantomJS', 'webdriver.PhantomJS', ([], {'executable_path': '""""""'}), "(executable_path='')\n", (71, 91), False, 'from selenium import webdriver\n'), ((163, 176), 'time.sleep', 'time.sleep', (['(3)'], {}), '(3)\n', (173, 176), False, 'import time\n')] |
import numpy as np
import matplotlib.pyplot as plt
plt.figure()
data = np.loadtxt("temperaturas.dat")
plt.show(data)
plt.savefig("calor.png") | [
"matplotlib.pyplot.figure",
"matplotlib.pyplot.show",
"numpy.loadtxt",
"matplotlib.pyplot.savefig"
] | [((57, 69), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (67, 69), True, 'import matplotlib.pyplot as plt\n'), ((77, 107), 'numpy.loadtxt', 'np.loadtxt', (['"""temperaturas.dat"""'], {}), "('temperaturas.dat')\n", (87, 107), True, 'import numpy as np\n'), ((108, 122), 'matplotlib.pyplot.show', 'plt.show'... |
# the anscombe dataset can be found in the seaborn library
import seaborn as sns
anscombe = sns.load_dataset("anscombe")
print(anscombe)
import matplotlib.pyplot as plt
# create a subset of the data
# contains only dataset 1 from anscombe
dataset_1 = anscombe[anscombe['dataset'] == 'I']
plt.plot(dataset_1['x'], data... | [
"seaborn.lmplot",
"seaborn.kdeplot",
"matplotlib.pyplot.plot",
"seaborn.factorplot",
"seaborn.load_dataset",
"seaborn.barplot",
"seaborn.regplot",
"matplotlib.pyplot.figure",
"seaborn.boxplot",
"seaborn.countplot",
"seaborn.distplot",
"seaborn.jointplot",
"seaborn.PairGrid",
"seaborn.pairp... | [((92, 120), 'seaborn.load_dataset', 'sns.load_dataset', (['"""anscombe"""'], {}), "('anscombe')\n", (108, 120), True, 'import seaborn as sns\n'), ((291, 331), 'matplotlib.pyplot.plot', 'plt.plot', (["dataset_1['x']", "dataset_1['y']"], {}), "(dataset_1['x'], dataset_1['y'])\n", (299, 331), True, 'import matplotlib.pyp... |
#!/usr/bin/env python
from nltk.corpus import cmudict
from phoneme import phonemes
d = cmudict.dict()
def literalish(word):
lits = []
try:
cands = d[word.lower()]
for cand in cands:
lit = []
for cmu in cand:
cmu = "".join([i for i in cmu if not i.isdigi... | [
"nltk.corpus.cmudict.dict"
] | [((89, 103), 'nltk.corpus.cmudict.dict', 'cmudict.dict', ([], {}), '()\n', (101, 103), False, 'from nltk.corpus import cmudict\n')] |
"""
primitive plotting for ex2
"""
import numpy as np
import matplotlib.pyplot as plt
xs = {}
xs["n,g"] = np.loadtxt("ex2/rp082209.tot")
xs["n,n"] = np.loadtxt("ex2/rp082208.tot")
xs["n,2n"] = np.loadtxt("ex2/rp082207.tot")
exp = {}
exp["n,g"] = np.loadtxt("ng.exp")
fig, ax = plt.subplots()
ax.plot(xs["n,g"][:, 0]... | [
"matplotlib.pyplot.subplots",
"numpy.loadtxt",
"matplotlib.pyplot.show"
] | [((108, 138), 'numpy.loadtxt', 'np.loadtxt', (['"""ex2/rp082209.tot"""'], {}), "('ex2/rp082209.tot')\n", (118, 138), True, 'import numpy as np\n'), ((151, 181), 'numpy.loadtxt', 'np.loadtxt', (['"""ex2/rp082208.tot"""'], {}), "('ex2/rp082208.tot')\n", (161, 181), True, 'import numpy as np\n'), ((195, 225), 'numpy.loadt... |
from setuptools import setup
setup(
name='ooktools',
description='On-off keying tools for your SDR',
author='<NAME>',
author_email='<EMAIL>',
url='https://github.com/leonjza/ooktools',
download_url='https://github.com/leonjza/ooktools/tarball/1.3',
keywords=['sdr', 'on-off', 'keying', 'rfca... | [
"setuptools.setup"
] | [((30, 572), 'setuptools.setup', 'setup', ([], {'name': '"""ooktools"""', 'description': '"""On-off keying tools for your SDR"""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'url': '"""https://github.com/leonjza/ooktools"""', 'download_url': '"""https://github.com/leonjza/ooktools/tarball/1.3"""', 'keyw... |
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import matplotlib.patches as patches
import pylab
import glob
from scipy import interpolate
import math
#Let us begin with the discrete values
epsilon = np.arange(12, dtype= 'f')
epsilon[0] = 3.0
epsilon[1] = 8.0
epsilon[2] = 15.0
epsilon[3]... | [
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.show",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.close",
"matplotlib.pyplot.text",
"matplotlib.pyplot.figure",
"numpy.arange",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.fill_between",
"matplotlib.pyplot.xlabel",
... | [((232, 256), 'numpy.arange', 'np.arange', (['(12)'], {'dtype': '"""f"""'}), "(12, dtype='f')\n", (241, 256), True, 'import numpy as np\n'), ((503, 527), 'numpy.arange', 'np.arange', (['(12)'], {'dtype': '"""f"""'}), "(12, dtype='f')\n", (512, 527), True, 'import numpy as np\n'), ((745, 769), 'numpy.arange', 'np.arange... |
"""Automatic-differentiation-based initialization routines."""
import itertools
import numpy as np
from probnum import problems, randprocs, randvars
from ._interface import InitializationRoutine
# pylint: disable="import-outside-toplevel"
try:
import jax
from jax.config import config
from jax.experimen... | [
"jax.config.config.update",
"jax.jvp",
"jax.numpy.array",
"jax.jacrev",
"numpy.asarray",
"itertools.islice",
"jax.numpy.zeros",
"jax.jacfwd",
"jax.numpy.stack",
"jax.experimental.jet.jet"
] | [((372, 409), 'jax.config.config.update', 'config.update', (['"""jax_enable_x64"""', '(True)'], {}), "('jax_enable_x64', True)\n", (385, 409), False, 'from jax.config import config\n'), ((1434, 1475), 'jax.numpy.zeros', 'jnp.zeros', (['(mean.shape[0], mean.shape[0])'], {}), '((mean.shape[0], mean.shape[0]))\n', (1443, ... |
import logging
from flask import Flask
from nexinfosys import initialize_configuration, cfg_file_env_var
from nexinfosys.model_services import get_case_study_registry_objects
nis_api_base = "/nis_api" # Base for all RESTful calls
nis_client_base = "/nis_client" # Base for the Angular2 client
nis_external_client_ba... | [
"flask.Flask",
"nexinfosys.initialize_configuration",
"nexinfosys.model_services.get_case_study_registry_objects"
] | [((400, 415), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (405, 415), False, 'from flask import Flask\n'), ((529, 555), 'nexinfosys.initialize_configuration', 'initialize_configuration', ([], {}), '()\n', (553, 555), False, 'from nexinfosys import initialize_configuration, cfg_file_env_var\n'), ((1191, ... |
"""Exceptions for Craton Inventory system."""
from oslo_log import log as logging
LOG = logging.getLogger(__name__)
class Base(Exception):
"""Base Exception for Craton Inventory."""
code = 500
message = "An unknown exception occurred"
def __str__(self):
return self.message
def __init__... | [
"oslo_log.log.getLogger"
] | [((90, 117), 'oslo_log.log.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (107, 117), True, 'from oslo_log import log as logging\n')] |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-08-03 06:11
from __future__ import unicode_literals
from django.db import migrations
from django.conf import settings
class Migration(migrations.Migration):
forward = [
"""
CREATE FOREIGN TABLE "campusonline"."organisationen" (
... | [
"django.db.migrations.RunSQL",
"django.conf.settings.MULTICORN.get"
] | [((2333, 2368), 'django.db.migrations.RunSQL', 'migrations.RunSQL', (['forward', 'reverse'], {}), '(forward, reverse)\n', (2350, 2368), False, 'from django.db import migrations\n'), ((655, 693), 'django.conf.settings.MULTICORN.get', 'settings.MULTICORN.get', (['"""campusonline"""'], {}), "('campusonline')\n", (677, 693... |
import json
from pathlib import Path
import nbformat
# Use this script to generate nblink files for all
# notebooks `../../notebooks/**.ipynb
def extract_header(path):
nodes = nbformat.read(path, as_version=nbformat.current_nbformat)
for cell in nodes['cells']:
if cell['cell_type'] == 'markdown':
... | [
"nbformat.read",
"json.dump",
"pathlib.Path"
] | [((488, 511), 'pathlib.Path', 'Path', (['"""../../notebooks"""'], {}), "('../../notebooks')\n", (492, 511), False, 'from pathlib import Path\n'), ((184, 241), 'nbformat.read', 'nbformat.read', (['path'], {'as_version': 'nbformat.current_nbformat'}), '(path, as_version=nbformat.current_nbformat)\n', (197, 241), False, '... |
import torch
import pyro
import pyro.distributions as dist
from torch.distributions import constraints
from pyro import poutine
from pyro.infer import SVI, Trace_ELBO, TraceEnum_ELBO, config_enumerate, infer_discrete
from pyro.infer.autoguide import AutoDiagonalNormal
from pyro.ops.indexing import Vindex
import pyro.p... | [
"pyro.distributions.Categorical",
"torch.ones",
"pyro.infer.NUTS",
"torch.stack",
"pyro.distributions.Delta",
"pyro.infer.MCMC",
"torch.ceil",
"pyro.distributions.Uniform",
"torch.sum",
"torch.eig",
"torch.tensor"
] | [((730, 849), 'torch.tensor', 'torch.tensor', (['[[0.2, 0.3, 0.15, 0.35], [0.5, 0.05, 0.2, 0.25], [0.25, 0.45, 0.05, 0.25],\n [0.45, 0.25, 0.15, 0.15]]'], {}), '([[0.2, 0.3, 0.15, 0.35], [0.5, 0.05, 0.2, 0.25], [0.25, 0.45, \n 0.05, 0.25], [0.45, 0.25, 0.15, 0.15]])\n', (742, 849), False, 'import torch\n'), ((111... |
#!/usr/bin/env python
import argparse
import shlex
import subprocess
import ipaddress
import re
#from multiprocessing import Process
#from threading import Thread
import threading
BASE_IP='10.1.1.2'
NUM_THREADS=32
def get_ip_range(base_ip, num):
try:
base_ip = ipaddress.ip_address(unicode(base_ip))
... | [
"threading.Thread",
"argparse.ArgumentParser",
"subprocess.check_output",
"shlex.split",
"threading.Lock"
] | [((998, 1014), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (1012, 1014), False, 'import threading\n'), ((1852, 1930), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Run N simultaneous ping tests/requrests"""'}), "(description='Run N simultaneous ping tests/requrests')\n", (1875... |
from django.db import models
from datetime import datetime
from teachers.models import Teacher
from DjangoUeditor.models import UEditorField
from mdeditor.fields import MDTextField
# Django-taggit
from taggit.managers import TaggableManager
# from model_utils import FieldTracker
# Create your models here.
# 让上传的文件... | [
"django.db.models.FileField",
"django.db.models.TextField",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.ImageField",
"django.db.models.IntegerField",
"taggit.managers.TaggableManager",
"mdeditor.fields.MDTextField",
"django.db.models.DateTimeField",
"datetime.dat... | [((689, 744), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(20)', 'verbose_name': 'u"""一级分类名称"""'}), "(max_length=20, verbose_name=u'一级分类名称')\n", (705, 744), False, 'from django.db import models\n'), ((760, 824), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'default': 'datet... |
#
# clfsload/reader.py
#
#-------------------------------------------------------------------------
# Copyright (c) Microsoft. 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 Licen... | [
"clfsload.util.exc_info_name",
"os.path.islink",
"os.path.join",
"stat.S_ISBLK",
"stat.S_ISCHR",
"threading.Condition",
"os.path.exists",
"clfsload.stypes.ReaderInfo",
"clfsload.stypes.TargetObj",
"threading.Lock",
"stat.S_ISDIR",
"os.lstat",
"stat.S_ISLNK",
"stat.S_ISREG",
"queue.Queue"... | [((3889, 3900), 'os.getuid', 'os.getuid', ([], {}), '()\n', (3898, 3900), False, 'import os\n'), ((7295, 7316), 'stat.S_ISREG', 'stat.S_ISREG', (['st_mode'], {}), '(st_mode)\n', (7307, 7316), False, 'import stat\n'), ((7358, 7379), 'stat.S_ISDIR', 'stat.S_ISDIR', (['st_mode'], {}), '(st_mode)\n', (7370, 7379), False, '... |
from time import sleep
def inc(x):
sleep(1)
return x + 1
def double(x):
sleep(1)
return 2 * x
def is_even(x):
return not x % 2
data = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
results = []
for x in data:
if is_even(x):
y = double(x)
else:
y = inc(x)
results.append(y)
prin... | [
"time.sleep"
] | [((40, 48), 'time.sleep', 'sleep', (['(1)'], {}), '(1)\n', (45, 48), False, 'from time import sleep\n'), ((86, 94), 'time.sleep', 'sleep', (['(1)'], {}), '(1)\n', (91, 94), False, 'from time import sleep\n')] |
import cv2 as cv
import datetime
import pexpect
from threading import Thread
from PIL import Image
import numpy as np
import base64
def analyze(pathToSave, saveName , imagePath , imageFolder , image):
python27 = '/home/alireza/anaconda2/envs/sentiment/bin/python'
#print(image)
scirptToExe = './server.py'
... | [
"cv2.VideoCapture",
"pexpect.run",
"datetime.datetime.now"
] | [((706, 732), 'cv2.VideoCapture', 'cv.VideoCapture', (['"""abc.mp4"""'], {}), "('abc.mp4')\n", (721, 732), True, 'import cv2 as cv\n'), ((642, 664), 'pexpect.run', 'pexpect.run', (['runScript'], {}), '(runScript)\n', (653, 664), False, 'import pexpect\n'), ((904, 927), 'datetime.datetime.now', 'datetime.datetime.now', ... |
from .util import cos_sim, dot_score
from .faiss_index import FaissBinaryIndex
import logging
import sys
import torch
import faiss
import numpy as np
from typing import Dict, List
logger = logging.getLogger(__name__)
#Parent class for any dense model
class DenseRetrievalBinaryCodeSearch:
def __init__(self, m... | [
"numpy.vstack",
"faiss.IndexBinaryHash",
"logging.getLogger"
] | [((190, 217), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (207, 217), False, 'import logging\n'), ((2196, 2264), 'faiss.IndexBinaryHash', 'faiss.IndexBinaryHash', (['(corpus_embeddings.shape[1] * 8)', 'hash_num_bits'], {}), '(corpus_embeddings.shape[1] * 8, hash_num_bits)\n', (2217, 22... |
#-*- coding: utf-8 -*-
# 구현 대상
# https://github.com/jcjohnson/densecap/tree/master/eval
# 참고
# https://sites.google.com/site/hyunguk1986/personal-study/-ap-map-recall-precision
from metric.meteor import Meteor
import numpy as np
from ..utils.cython_bbox import bbox_overlaps
from ..datasets.visual_genome_l... | [
"numpy.average",
"numpy.ascontiguousarray",
"metric.meteor.Meteor",
"numpy.zeros"
] | [((3240, 3268), 'numpy.zeros', 'np.zeros', (['(pred_num, gt_num)'], {}), '((pred_num, gt_num))\n', (3248, 3268), True, 'import numpy as np\n'), ((846, 854), 'metric.meteor.Meteor', 'Meteor', ([], {}), '()\n', (852, 854), False, 'from metric.meteor import Meteor\n'), ((2178, 2227), 'numpy.ascontiguousarray', 'np.asconti... |
# 2020.06.05
# active learning: query by committee
# modified from Xiou
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score
from scipy.stats import entropy
import time
class QBC():
def __init__(self, learners, init=0.01, n_increment=200, n_iter=40, per... | [
"pickle.dump",
"numpy.sum",
"numpy.argmax",
"scipy.stats.entropy",
"sklearn.metrics.accuracy_score",
"numpy.unique",
"numpy.zeros",
"time.time",
"numpy.argsort",
"pickle.load",
"numpy.mean",
"sklearn.svm.SVC",
"numpy.delete",
"numpy.concatenate"
] | [((3867, 3902), 'sklearn.svm.SVC', 'SVC', ([], {'gamma': '"""auto"""', 'probability': '(True)'}), "(gamma='auto', probability=True)\n", (3870, 3902), False, 'from sklearn.svm import SVC\n'), ((680, 722), 'scipy.stats.entropy', 'entropy', (['prob'], {'base': 'self.num_class', 'axis': '(1)'}), '(prob, base=self.num_class... |
import torch
from argparse import ArgumentParser
parser = ArgumentParser()
parser.add_argument('--checkpoint_backbone', required=True, type=str)
parser.add_argument('--checkpoint_linear', required=True, type=str)
parser.add_argument('--output_file', required=True, type=str)
if __name__ == "__main__":
args = parse... | [
"torch.save",
"torch.load",
"argparse.ArgumentParser"
] | [((59, 75), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (73, 75), False, 'from argparse import ArgumentParser\n'), ((413, 447), 'torch.load', 'torch.load', (['args.checkpoint_linear'], {}), '(args.checkpoint_linear)\n', (423, 447), False, 'import torch\n'), ((846, 881), 'torch.save', 'torch.save', ([... |
from django.contrib import admin
from .models import Type, Item, Image
@admin.register(Type)
class TypeAdmin(admin.ModelAdmin):
list_display = ("name","users")
def users(self, obj):
return ", ".join(u.name for u in obj.user.all())
@admin.register(Item)
class ItemAdmin(admin.ModelAdmin):
list_di... | [
"django.contrib.admin.register"
] | [((75, 95), 'django.contrib.admin.register', 'admin.register', (['Type'], {}), '(Type)\n', (89, 95), False, 'from django.contrib import admin\n'), ((253, 273), 'django.contrib.admin.register', 'admin.register', (['Item'], {}), '(Item)\n', (267, 273), False, 'from django.contrib import admin\n'), ((352, 373), 'django.co... |
# -*- coding: utf-8 -*-
# This code is copyrighted and all rights are reserved
# for full legalities see the LEGAL file
from gi.repository import GLib, Gtk
from widgets.basics import Button
from aptdaemon import enums
from appdata import _
escape = GLib.markup_escape_text
class TransactionFailed(Gtk.VBox):
def _... | [
"gi.repository.Gtk.VBox.__init__",
"aptdaemon.enums.get_error_string_from_enum",
"appdata._",
"widgets.basics.Button",
"gi.repository.Gtk.HBox",
"aptdaemon.enums.get_error_description_from_enum",
"gi.repository.Gtk.ScrolledWindow",
"gi.repository.Gtk.Label"
] | [((350, 373), 'gi.repository.Gtk.VBox.__init__', 'Gtk.VBox.__init__', (['self'], {}), '(self)\n', (367, 373), False, 'from gi.repository import GLib, Gtk\n'), ((451, 462), 'gi.repository.Gtk.Label', 'Gtk.Label', ([], {}), '()\n', (460, 462), False, 'from gi.repository import GLib, Gtk\n'), ((512, 562), 'aptdaemon.enums... |
import warnings
VERSION = '0.1.6'
warnings.filterwarnings(
message='.*Conversion of the second.*',
action='ignore',
category=FutureWarning,
module='h5py'
)
warnings.filterwarnings(
message='.*(numpy.ufunc|numpy.dtype) size changed.*',
action='ignore',
category=RuntimeWarning
)
| [
"warnings.filterwarnings"
] | [((34, 158), 'warnings.filterwarnings', 'warnings.filterwarnings', ([], {'message': '""".*Conversion of the second.*"""', 'action': '"""ignore"""', 'category': 'FutureWarning', 'module': '"""h5py"""'}), "(message='.*Conversion of the second.*', action=\n 'ignore', category=FutureWarning, module='h5py')\n", (57, 158)... |
import streamlit as st
import pandas as pd
st.write("""
# My first app
Hello *world*!
""")
df = pd.read_csv("timeseries.csv")
st.line_chart(df)
| [
"pandas.read_csv",
"streamlit.line_chart",
"streamlit.write"
] | [((44, 91), 'streamlit.write', 'st.write', (['"""\n# My first app\nHello *world*!\n"""'], {}), '("""\n# My first app\nHello *world*!\n""")\n', (52, 91), True, 'import streamlit as st\n'), ((98, 127), 'pandas.read_csv', 'pd.read_csv', (['"""timeseries.csv"""'], {}), "('timeseries.csv')\n", (109, 127), True, 'import pand... |
import cffi
SRCLIST = 'Rect.cpp MaxRectsBinPack.cpp'.split()
def readfile(path):
with open(path, 'r') as f:
return f.read()
ffibuilder = cffi.FFI()
ffibuilder.cdef(readfile('rbp.h'))
ffibuilder.set_source(
'_rbp', readfile('rbp.cpp'), source_extension='.cpp', sources=SRCLIST)
if __name__ == '__m... | [
"cffi.FFI"
] | [((154, 164), 'cffi.FFI', 'cffi.FFI', ([], {}), '()\n', (162, 164), False, 'import cffi\n')] |
"""
This module contains relatively simple functions needed for calculation of mean-squared displacements (MSD) of atoms from series of time snapshots.
The "simple" means that functions do not use sophisticated algorithms for recognition of different diffusion modes,
and can be correctly applied only if the dependence ... | [
"pandas.DataFrame",
"matplotlib.pyplot.title",
"copy.deepcopy",
"numpy.linalg.lstsq",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.clf",
"matplotlib.pyplot.legend",
"numpy.zeros",
"numpy.array",
"matplotlib.pyplot.cla",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"numpy.round",
... | [((5980, 5991), 'md_format_converter_mi.structure', 'structure', ([], {}), '()\n', (5989, 5991), False, 'from md_format_converter_mi import structure\n'), ((6081, 6101), 'numpy.array', 'np.array', (['st.mark_at'], {}), '(st.mark_at)\n', (6089, 6101), True, 'import numpy as np\n'), ((6122, 6139), 'numpy.array', 'np.arra... |
import sys
from string import Template
from collections import namedtuple
from pycparser import c_parser, c_ast, parse_file
Func = namedtuple('Func', ('name', 'type', 'args'))
Arg = namedtuple('Arg', ('name', 'type'))
Type = namedtuple('Type', ('ptr', 'name', 'array'))
class FuncDeclVisitor(c_ast.NodeVisitor):
de... | [
"pycparser.parse_file",
"collections.namedtuple",
"string.Template"
] | [((132, 176), 'collections.namedtuple', 'namedtuple', (['"""Func"""', "('name', 'type', 'args')"], {}), "('Func', ('name', 'type', 'args'))\n", (142, 176), False, 'from collections import namedtuple\n'), ((183, 218), 'collections.namedtuple', 'namedtuple', (['"""Arg"""', "('name', 'type')"], {}), "('Arg', ('name', 'typ... |
"""
Created on 30 Apr 2017
@author: <NAME> (<EMAIL>)
example:
{
"id": "southcoastscience-dev",
"name": "South Coast Science - Dev",
"month": "2016-11",
"gravatar-hash": "07f512e9fe64863039df0c0f1834cc25",
"topics": [
{
"topic": "/orgs/south-coast-science-dev/user/device/alpha-pi-eng-000100/status"... | [
"scs_core.osio.data.user_topic.UserTopic.construct_from_jdict",
"scs_core.osio.data.user.User.__init__",
"scs_core.osio.data.user.User.as_json"
] | [((2198, 2251), 'scs_core.osio.data.user.User.__init__', 'User.__init__', (['self', 'id', 'name', 'email', 'password', 'start'], {}), '(self, id, name, email, password, start)\n', (2211, 2251), False, 'from scs_core.osio.data.user import User\n'), ((2581, 2599), 'scs_core.osio.data.user.User.as_json', 'User.as_json', (... |
import torch
import torch.nn as nn
from offpolicy.utils.util import to_torch
from offpolicy.algorithms.utils.mlp import MLPBase
from offpolicy.algorithms.utils.act import ACTLayer
class AgentQFunction(nn.Module):
"""
Individual agent q network (MLP).
:param args: (namespace) contains information about hyp... | [
"offpolicy.algorithms.utils.mlp.MLPBase",
"offpolicy.algorithms.utils.act.ACTLayer",
"offpolicy.utils.util.to_torch"
] | [((901, 925), 'offpolicy.algorithms.utils.mlp.MLPBase', 'MLPBase', (['args', 'input_dim'], {}), '(args, input_dim)\n', (908, 925), False, 'from offpolicy.algorithms.utils.mlp import MLPBase\n'), ((943, 1017), 'offpolicy.algorithms.utils.act.ACTLayer', 'ACTLayer', (['act_dim', 'self.hidden_size', 'self._use_orthogonal']... |
import keras
from keras.models import load_model
import sys
import cv2
import numpy as np
x_test = np.zeros((0,4608))
model = load_model(r"D:\Code\Hackathons\BookJudger\NeuralNet\hdmodel.h5")
im = cv2.imread(sys.argv[1])
im = cv2.resize(im, (32, 48))
im = np.divide(im, 255)
im = im.flatten()
x_test = np.concatenate([x... | [
"keras.models.load_model",
"numpy.divide",
"numpy.concatenate",
"numpy.zeros",
"cv2.imread",
"cv2.resize"
] | [((100, 119), 'numpy.zeros', 'np.zeros', (['(0, 4608)'], {}), '((0, 4608))\n', (108, 119), True, 'import numpy as np\n'), ((127, 196), 'keras.models.load_model', 'load_model', (['"""D:\\\\Code\\\\Hackathons\\\\BookJudger\\\\NeuralNet\\\\hdmodel.h5"""'], {}), "('D:\\\\Code\\\\Hackathons\\\\BookJudger\\\\NeuralNet\\\\hdm... |
import asyncio
from asyncio import get_event_loop
import pytest
from graphql import subscribe
from graphql.execution.executors.asyncio import AsyncioExecutor
from gql import gql
from tests_py36.schema import StarWarsSchema
class ObservableAsyncIterable:
def __init__(self, observable):
self.disposable = ... | [
"asyncio.Queue",
"graphql.execution.executors.asyncio.AsyncioExecutor",
"gql.gql",
"asyncio.get_event_loop"
] | [((1102, 1305), 'gql.gql', 'gql', (['"""\n subscription ListenEpisodeReviews($ep: Episode!) {\n reviewAdded(episode: $ep) {\n stars,\n commentary,\n episode\n }\n }\n """'], {}), '("""\n subscription ListenEpisodeReviews($ep: Episode!) {\n ... |
from pya2l.parser import A2lParser
a2l_string = open(r'DASY_BASE_01_Copy.a2l', 'r').read()
a2l = A2lParser(a2l_string)
for i, node in enumerate(a2l.tree.project.module[0].get_node("MEASUREMENT")):
print(node.name)
| [
"pya2l.parser.A2lParser"
] | [((100, 121), 'pya2l.parser.A2lParser', 'A2lParser', (['a2l_string'], {}), '(a2l_string)\n', (109, 121), False, 'from pya2l.parser import A2lParser\n')] |
#!/usr/bin/env python3
from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
import os, http.server
def main(args):
os.chdir(args.directory)
addr = ('' ,args.port)
print('Serving', args.directory, 'on', addr)
httpd = http.server.HTTPServer(addr, http.server.SimpleHTTPRequestHandler)
ht... | [
"os.getcwd",
"os.chdir",
"argparse.ArgumentParser"
] | [((134, 158), 'os.chdir', 'os.chdir', (['args.directory'], {}), '(args.directory)\n', (142, 158), False, 'import os, http.server\n'), ((381, 442), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'formatter_class': 'ArgumentDefaultsHelpFormatter'}), '(formatter_class=ArgumentDefaultsHelpFormatter)\n', (395, 442), Fal... |
import os
import pytest
from viridian import racon, utils
this_dir = os.path.dirname(os.path.abspath(__file__))
data_dir = os.path.join(this_dir, "data", "racon")
def test_run_racon():
# This has a SNP and two indels to fix. Also one position where
# about 2/3 of the reads say A and the rest say T. Expect t... | [
"os.path.abspath",
"viridian.racon.run_racon_iterations",
"os.unlink",
"viridian.utils.rm_rf",
"viridian.racon.run_racon",
"os.path.exists",
"viridian.utils.load_single_seq_fasta",
"os.path.join",
"os.listdir"
] | [((125, 164), 'os.path.join', 'os.path.join', (['this_dir', '"""data"""', '"""racon"""'], {}), "(this_dir, 'data', 'racon')\n", (137, 164), False, 'import os\n'), ((87, 112), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (102, 112), False, 'import os\n'), ((372, 420), 'os.path.join', 'os.pat... |
from django.urls import path, re_path, include
from .views import (index, about, products, post_create, post_update, postpreference,
contact, signup, login, logout, posts, post_detail, post_delete,
product_detail, add_to_cart, remove_from_cart, order_summary,
... | [
"django.urls.path",
"django.urls.include"
] | [((352, 381), 'django.urls.path', 'path', (['""""""', 'index'], {'name': '"""index"""'}), "('', index, name='index')\n", (356, 381), False, 'from django.urls import path, re_path, include\n'), ((387, 435), 'django.urls.path', 'path', (['"""product/list/"""', 'products'], {'name': '"""products"""'}), "('product/list/', ... |
"""Solution for Advent of Code day 1."""
import collections
from pathlib import Path
from typing import Iterable, Iterator
import doctest
import click
def count_increases(iterable: Iterable[int]) -> int:
"""Counts the number of increases of a number.
An increase is given if a number is higher than its prede... | [
"doctest.testmod",
"click.option",
"pathlib.Path",
"click.group",
"collections.deque"
] | [((2819, 2832), 'click.group', 'click.group', ([], {}), '()\n', (2830, 2832), False, 'import click\n'), ((3083, 3168), 'click.option', 'click.option', (['"""--window"""'], {'required': '(False)', 'type': 'int', 'help': '"""Apply sliding window."""'}), "('--window', required=False, type=int, help='Apply sliding window.'... |
import dash_mantine_components as dmc
from dash import Input, Output, dcc, html, callback, no_update
from dash_iconify import DashIconify
component = html.Div(
[
dcc.Interval(id="ring-progress-interval", n_intervals=0, interval=500),
dmc.RingProgress(id="ring-progress", sections=[{"value": 0, "colo... | [
"dash.Output",
"dash_mantine_components.Center",
"dash.Input",
"dash_mantine_components.RingProgress",
"dash_iconify.DashIconify",
"dash.dcc.Interval",
"dash_mantine_components.Text"
] | [((642, 682), 'dash_mantine_components.Text', 'dmc.Text', (['f"""{progress}%"""'], {'color': '"""indigo"""'}), "(f'{progress}%', color='indigo')\n", (650, 682), True, 'import dash_mantine_components as dmc\n'), ((359, 394), 'dash.Output', 'Output', (['"""ring-progress"""', '"""sections"""'], {}), "('ring-progress', 'se... |
"""A script to check and report the size of the grammars."""
import inspect
import os
import importlib
from darglint.parse.grammar import (
BaseGrammar,
)
def convert_filename_to_module(filename):
return filename[:-3].replace('/', '.')
def get_python_modules_in_grammars():
basepath = os.path.join(
... | [
"importlib.import_module",
"os.getcwd",
"os.path.join",
"os.listdir",
"inspect.getmembers"
] | [((325, 336), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (334, 336), False, 'import os\n'), ((548, 568), 'os.listdir', 'os.listdir', (['basepath'], {}), '(basepath)\n', (558, 568), False, 'import os\n'), ((684, 727), 'inspect.getmembers', 'inspect.getmembers', (['module', 'inspect.isclass'], {}), '(module, inspect.isc... |
# -*- coding: utf-8 -*-
import os
from typing import Union, Iterable, List, Tuple
# from typing import Callable
import numpy as np
import networkx as nx
# from scipy.integrate import odeint
from scipy.integrate import solve_ivp
import dill
import re
import yaml
import itertools
from scipy.special import softmax
from mu... | [
"sklearn.datasets.load_iris",
"numpy.abs",
"numpy.sum",
"numpy.argmax",
"sklearn.model_selection.train_test_split",
"collections.defaultdict",
"sklearn.metrics.f1_score",
"numpy.mean",
"numpy.linalg.norm",
"numpy.exp",
"numpy.sin",
"yaml.safe_load",
"numpy.zeros_like",
"networkx.erdos_reny... | [((504, 542), 'matplotlib.rcParams.update', 'mpl.rcParams.update', (["{'font.size': 14}"], {}), "({'font.size': 14})\n", (523, 542), True, 'import matplotlib as mpl\n'), ((24404, 24430), 'sklearn.datasets.load_iris', 'load_iris', ([], {'return_X_y': '(True)'}), '(return_X_y=True)\n', (24413, 24430), False, 'from sklear... |
import numpy as np
from lib.deriv.adtools import cstest
def squeeze(A,axis=None):
A = np.squeeze(A,axis=axis)
return A.item() if A.ndim==0 else A
def logsumexp(X, axis=0, keepdims = False, deriv=False):
"""
This is a complex-step friendly version of logsumexp.
"""
maxX = np.real(X).max(axis=a... | [
"lib.deriv.adtools.cstest",
"numpy.random.randn",
"numpy.isscalar",
"numpy.exp",
"numpy.real",
"numpy.squeeze"
] | [((91, 115), 'numpy.squeeze', 'np.squeeze', (['A'], {'axis': 'axis'}), '(A, axis=axis)\n', (101, 115), True, 'import numpy as np\n'), ((519, 532), 'numpy.exp', 'np.exp', (['(X - Y)'], {}), '(X - Y)\n', (525, 532), True, 'import numpy as np\n'), ((950, 961), 'numpy.random.randn', 'randn', (['(2)', '(3)'], {}), '(2, 3)\n... |
import mcmfModule
print(
mcmfModule.mcmf(
"夏期講習B日程t数復習(文型)1①三角関数8月27日(火)①t講習問題】sinθ−cosθ=½{1}{2}が成り立つとき,sinθ,co∞θの値を求めよ。",
"夏期講習B日程t数復習(文型)2①①①①①①①①①①①①①①①①①①①①①①①①①①①①①①①①①①①①①①①①①①①①①①①①①①",
4,
)
)
| [
"mcmfModule.mcmf"
] | [((30, 209), 'mcmfModule.mcmf', 'mcmfModule.mcmf', (['"""夏期講習B日程t数復習(文型)1①三角関数8月27日(火)①t講習問題】sinθ−cosθ=½{1}{2}が成り立つとき,sinθ,co∞θの値を求めよ。"""', '"""夏期講習B日程t数復習(文型)2①①①①①①①①①①①①①①①①①①①①①①①①①①①①①①①①①①①①①①①①①①①①①①①①①①"""', '(4)'], {}), "(\n '夏期講習B日程t数復習(文型)1①三角関数8月27日(火)①t講習問題】sinθ−cosθ=½{1}{2}が成り立つとき,sinθ,co∞θの値を求めよ。'\n ... |
import sys
import re
from collections import defaultdict
from copy import deepcopy
from math import sqrt, pi
import math
import const
from lattice_parser import lattice_parser
nest_dict = lambda: defaultdict(nest_dict) # to define a['key1']['key2'] = value
# class: impactz_parser
#==================... | [
"copy.deepcopy",
"re.split",
"lattice_parser.lattice_parser.__init__",
"math.sqrt",
"math.ceil",
"re.match",
"collections.defaultdict",
"sys.exit",
"re.compile"
] | [((197, 219), 'collections.defaultdict', 'defaultdict', (['nest_dict'], {}), '(nest_dict)\n', (208, 219), False, 'from collections import defaultdict\n'), ((415, 464), 'lattice_parser.lattice_parser.__init__', 'lattice_parser.__init__', (['self', 'fileName', 'lineName'], {}), '(self, fileName, lineName)\n', (438, 464),... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup
with open('README.rst') as readme_file:
readme = readme_file.read()
setup(
name='conda_concourse_ci',
version='0.1.0',
description="Drive Concourse CI for conda recipe repos",
author="<NAME>",
author_email='<EMAIL>',
... | [
"setuptools.setup"
] | [((150, 1185), 'setuptools.setup', 'setup', ([], {'name': '"""conda_concourse_ci"""', 'version': '"""0.1.0"""', 'description': '"""Drive Concourse CI for conda recipe repos"""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'url': '"""https://github.com/conda/conda_concourse_ci"""', 'packages': "['conda_co... |
from .views import AppConfViewSet, AppConfAdminViewSet
from rest_framework import routers
router = routers.SimpleRouter()
router.register(r'admin/application-configuration', AppConfAdminViewSet, base_name='admin_application-configuration')
router.register(r'application-configuration', AppConfViewSet, base_name='appli... | [
"rest_framework.routers.SimpleRouter"
] | [((101, 123), 'rest_framework.routers.SimpleRouter', 'routers.SimpleRouter', ([], {}), '()\n', (121, 123), False, 'from rest_framework import routers\n')] |
import csv
import pickle
import pytest
import unittest.mock as mock
import pyrado.logger.step as uut
@pytest.mark.logger
def test_first_step():
ap = mock.Mock(uut.StepLogPrinter)
logger = uut.StepLogger()
logger.printers.append(ap)
# Test first step
logger.add_value('Dummy', 1)
logger.record... | [
"pyrado.logger.step.CSVPrinter",
"csv.DictReader",
"unittest.mock.Mock",
"pytest.raises",
"pyrado.logger.step.StepLogger",
"pickle.dumps"
] | [((156, 185), 'unittest.mock.Mock', 'mock.Mock', (['uut.StepLogPrinter'], {}), '(uut.StepLogPrinter)\n', (165, 185), True, 'import unittest.mock as mock\n'), ((199, 215), 'pyrado.logger.step.StepLogger', 'uut.StepLogger', ([], {}), '()\n', (213, 215), True, 'import pyrado.logger.step as uut\n'), ((813, 842), 'unittest.... |
# -*- coding: utf-8 -*-
from datetime import date, time, datetime
from decimal import Decimal
from six import text_type
from xltpl.base import BookBase, SheetBase
from xltpl.basex import BookBase as BookBasex, SheetBase as SheetBasex
from xltpl.pos import Pos
class SheetMixin():
types = ['', text_type... | [
"xltpl.basex.SheetBase.__init__",
"xltpl.pos.Pos",
"xltpl.base.SheetBase.__init__",
"six.text_type"
] | [((2078, 2135), 'xltpl.base.SheetBase.__init__', 'SheetBase.__init__', (['self', 'bookwriter', 'rdsheet', 'sheet_name'], {}), '(self, bookwriter, rdsheet, sheet_name)\n', (2096, 2135), False, 'from xltpl.base import BookBase, SheetBase\n'), ((2185, 2222), 'xltpl.pos.Pos', 'Pos', (['self.index_base', 'self.index_base'],... |
from django.contrib import admin
from .models import speciesRecords, biodiversityRecords
class speciesAdmin(admin.ModelAdmin):
list_display = ("speciesName","acceptedSpeciesName")
class recordsAdmin(admin.ModelAdmin):
list_display = ("speciesName","acceptedSpeciesName")
myModels = [speciesRecords, biodiver... | [
"django.contrib.admin.site.register"
] | [((350, 379), 'django.contrib.admin.site.register', 'admin.site.register', (['myModels'], {}), '(myModels)\n', (369, 379), False, 'from django.contrib import admin\n')] |
import logging
import re
import gensim
import numpy as np
import pandas as pd
from bs4 import BeautifulSoup
from nltk.corpus import stopwords
from gensim.models import doc2vec
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_... | [
"sklearn.ensemble.RandomForestClassifier",
"logging.basicConfig",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"sklearn.metrics.accuracy_score",
"numpy.zeros",
"logging.info",
"sklearn.metrics.f1_score",
"gensim.models.doc2vec.Doc2Vec",
"numpy.array",
"nltk.corpus.stopwords.wor... | [((337, 432), '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", (356, 432), False, 'import logging\n'), ((525, 568), 'pandas.read_csv', 'pd.read_cs... |
from django.db import models
import uuid
class AjaxModel(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
name = models.CharField(unique=True,max_length=50)
age = models.IntegerField()
def __str__(self):
return f'{self.name} - {self.id}'
| [
"django.db.models.CharField",
"django.db.models.UUIDField",
"django.db.models.IntegerField"
] | [((82, 152), 'django.db.models.UUIDField', 'models.UUIDField', ([], {'primary_key': '(True)', 'default': 'uuid.uuid4', 'editable': '(False)'}), '(primary_key=True, default=uuid.uuid4, editable=False)\n', (98, 152), False, 'from django.db import models\n'), ((164, 208), 'django.db.models.CharField', 'models.CharField', ... |
import networkx as nx
import requests
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import cm
### requesting data via network
protein_list = ['TPH1','COMT','SLC18A2','HTR1B','HTR2C','HTR2A','MAOA',
'TPH2','HTR1A','HTR7','SLC6A4','GABBR2','POMC','GNAI3',
... | [
"pandas.DataFrame",
"matplotlib.pyplot.show",
"matplotlib.pyplot.axis",
"networkx.draw_networkx",
"matplotlib.pyplot.figure",
"networkx.spring_layout",
"networkx.Graph",
"numpy.array",
"requests.get"
] | [((494, 511), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (506, 511), False, 'import requests\n'), ((808, 849), 'pandas.DataFrame', 'pd.DataFrame', (['data[1:-1]'], {'columns': 'data[0]'}), '(data[1:-1], columns=data[0])\n', (820, 849), True, 'import pandas as pd\n'), ((1156, 1198), 'networkx.Graph', 'nx.... |
# coding: utf-8
# # Lodging Expense Analysis (an attempt to partially address issue #26)
# This analysis tries to find anomalies in lodging expenses by internal comparison.
#
# It is worth noting that this code doesn't take some very important things into consideration:
#
# * There seems to be no way to know the a... | [
"pandas.read_csv",
"pandas.merge"
] | [((737, 854), 'pandas.read_csv', 'pd.read_csv', (['"""../data/2016-11-19-reimbursements.xz"""'], {'dtype': "{'cnpj_cpf': np.str, 'reimbursement_numbers': np.str}"}), "('../data/2016-11-19-reimbursements.xz', dtype={'cnpj_cpf': np.\n str, 'reimbursement_numbers': np.str})\n", (748, 854), True, 'import pandas as pd\n'... |
from collections import OrderedDict
import torch
import torch.nn as nn
from .bn import ABN
class DenseModule(nn.Module):
def __init__(self, in_chns, squeeze_ratio, out_chns, n_layers, dilate_sec=(1, 2, 4, 8, 16), norm_act=ABN):
super(DenseModule, self).__init__()
self.n_layers = n_layers
... | [
"torch.nn.Conv2d",
"torch.cat",
"torch.nn.ModuleList"
] | [((388, 403), 'torch.nn.ModuleList', 'nn.ModuleList', ([], {}), '()\n', (401, 403), True, 'import torch.nn as nn\n'), ((426, 441), 'torch.nn.ModuleList', 'nn.ModuleList', ([], {}), '()\n', (439, 441), True, 'import torch.nn as nn\n'), ((1462, 1486), 'torch.cat', 'torch.cat', (['inputs'], {'dim': '(1)'}), '(inputs, dim=... |
from django.http import HttpResponse
from django.shortcuts import render, redirect
from .models import Post
from django.utils import timezone
from .forms import Pform
# Create your views here.
#function to submit posts to template in order
def posts(request):
plist = Post.objects.filter(post_date__lte=timezone.now(... | [
"django.shortcuts.render",
"django.shortcuts.redirect",
"django.utils.timezone.now"
] | [((357, 411), 'django.shortcuts.render', 'render', (['request', '"""message/post.html"""', "{'posts': plist}"], {}), "(request, 'message/post.html', {'posts': plist})\n", (363, 411), False, 'from django.shortcuts import render, redirect\n'), ((549, 616), 'django.shortcuts.render', 'render', (['request', '"""message/pos... |
from django.contrib.postgres.fields import JSONField
from django.db import models
from django.utils import timezone
from .user import User
class Message(models.Model):
SENDER_USER = 'U'
SENDER_BOT = 'B'
MESSAGE_SENDER_CHOICES = (
(SENDER_USER, "Sender user"),
(SENDER_BOT, "Sender bot")
... | [
"django.db.models.ForeignKey",
"django.db.models.DateTimeField",
"django.contrib.postgres.fields.JSONField",
"django.db.models.CharField"
] | [((336, 385), 'django.db.models.ForeignKey', 'models.ForeignKey', (['User'], {'on_delete': 'models.CASCADE'}), '(User, on_delete=models.CASCADE)\n', (353, 385), False, 'from django.db import models\n'), ((404, 491), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(1)', 'choices': 'MESSAGE_SENDER_... |
# @Author: <NAME>
# @Author-Email: <EMAIL>
# @Project: NDN Storage
# @Source-Code: https://github.com/justincpresley/ndn-python-storage
# @Pip-Library: https://pypi.org/project/ndn-storage
# Basic Libraries
from typing import Optional
# NDN Imports
from ndn.encoding import Name, parse_data, NonStrictNam... | [
"ndn.encoding.Name.normalize",
"ndn.encoding.parse_data"
] | [((555, 573), 'ndn.encoding.parse_data', 'parse_data', (['packet'], {}), '(packet)\n', (565, 573), False, 'from ndn.encoding import Name, parse_data, NonStrictName\n'), ((726, 746), 'ndn.encoding.Name.normalize', 'Name.normalize', (['name'], {}), '(name)\n', (740, 746), False, 'from ndn.encoding import Name, parse_data... |
#! /usr/bin/env python3
import os, sys
from string import Template
def create_input_xml(tmpl_file, xml_file, master_safe_dir, slave_safe_dir,
master_orbit, slave_orbit, master_pol, slave_pol,
dem_file, swathnum, azimuth_looks, range_looks,
filter_strength... | [
"os.path.exists"
] | [((2465, 2489), 'os.path.exists', 'os.path.exists', (['xml_file'], {}), '(xml_file)\n', (2479, 2489), False, 'import os, sys\n')] |
from contextlib import suppress
import ConfigSpace as CS
from .distribution import load_dist_dict
from .exceptions import SKConfigValueError
from .distribution import BaseDistribution
from .condition import AndCondition
from .condition import OrCondition
from .condition import InCondition
from .condition import Equals... | [
"ConfigSpace.ConfigurationSpace",
"contextlib.suppress"
] | [((2414, 2437), 'ConfigSpace.ConfigurationSpace', 'CS.ConfigurationSpace', ([], {}), '()\n', (2435, 2437), True, 'import ConfigSpace as CS\n'), ((1937, 1955), 'contextlib.suppress', 'suppress', (['KeyError'], {}), '(KeyError)\n', (1945, 1955), False, 'from contextlib import suppress\n')] |