code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import timezone.timezone
class Migration(migrations.Migration):
dependencies = [
('fluent_contents', '0001_initial'),
('fluent_pa... | [
"django.db.models.OneToOneField",
"django.db.models.EmailField",
"django.db.models.ForeignKey",
"django.db.models.FileField",
"django.db.models.BooleanField",
"django.db.models.SlugField",
"django.db.models.AutoField",
"django.db.models.DateTimeField",
"django.db.models.CharField"
] | [((4165, 4259), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'blank': '(True)', 'to': '"""icekit_press_releases.PressReleaseCategory"""', 'null': '(True)'}), "(blank=True, to=\n 'icekit_press_releases.PressReleaseCategory', null=True)\n", (4182, 4259), False, 'from django.db import migrations, models\n'... |
from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, SubmitField
class LoginForm(FlaskForm):
username = StringField("Username")
password = PasswordField("Password")
submit = SubmitField("Sign In")
| [
"wtforms.PasswordField",
"wtforms.SubmitField",
"wtforms.StringField"
] | [((137, 160), 'wtforms.StringField', 'StringField', (['"""Username"""'], {}), "('Username')\n", (148, 160), False, 'from wtforms import StringField, PasswordField, SubmitField\n'), ((176, 201), 'wtforms.PasswordField', 'PasswordField', (['"""Password"""'], {}), "('Password')\n", (189, 201), False, 'from wtforms import ... |
# Licensed under GPL3 (see LICENSE)
# coding=utf-8
"""
Classes and utility functions for communicating with cameras via the INDI protocol, http://www.indilib.org.
"""
import time
import io
import logging
import logging.handlers
from astropy.io import fits
from .indiclient import indiclient
from ciboulette.indiclie... | [
"logging.getLogger"
] | [((352, 373), 'logging.getLogger', 'logging.getLogger', (['""""""'], {}), "('')\n", (369, 373), False, 'import logging\n')] |
# Copyright 2019-2020 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" fil... | [
"pytest.fixture",
"test.test_utils.test_reporting.TestReportGenerator"
] | [((1469, 1499), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (1483, 1499), False, 'import pytest\n'), ((1592, 1622), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (1606, 1622), False, 'import pytest\n'), ((1717, 1747), 'pytest.fi... |
## setup_mnist.py -- mnist data and model loading code
##
## Copyright (C) 2017, <NAME> <<EMAIL>>.
##
## This program is licenced under the BSD 2-Clause licence,
## contained in the LICENCE file in this directory.
import numpy as np
import os
import pickle
import gzip
import argparse
import urllib.request
from tensor... | [
"tensorflow.contrib.keras.api.keras.layers.Dense",
"scipy.io.savemat",
"argparse.ArgumentParser",
"tensorflow.contrib.keras.api.keras.layers.Activation",
"tensorflow.contrib.keras.api.keras.models.Sequential",
"tensorflow.Session",
"tensorflow.contrib.keras.api.keras.backend.function",
"tensorflow.con... | [((1997, 2072), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""save n-layer MNIST and CIFAR weights"""'}), "(description='save n-layer MNIST and CIFAR weights')\n", (2020, 2072), False, 'import argparse\n'), ((936, 948), 'tensorflow.contrib.keras.api.keras.models.Sequential', 'Sequential... |
"""
ARIMA and Auto-ARIMA
--------------------
Models for ARIMA (Autoregressive integrated moving average) and auto-ARIMA [1]_.
The implementations are wrapped around `statsmodels <https://github.com/statsmodels/statsmodels>`_
and `pmdarima <https://github.com/alkaline-ml/pmdarima>`_.
References
----------
.. [1] http... | [
"pmdarima.AutoARIMA"
] | [((3010, 3059), 'pmdarima.AutoARIMA', 'PmdAutoARIMA', (['*autoarima_args'], {}), '(*autoarima_args, **autoarima_kwargs)\n', (3022, 3059), True, 'from pmdarima import AutoARIMA as PmdAutoARIMA\n')] |
"""Simple demo primarily for verifying the development environment."""
from gears import core
from gears import draw
def main():
node = draw.primitives.Triangle((200, 200), (100, 400))
node = draw.transforms.Translation(node, 300, 200)
# also we should try to see if triangle works when we
# put the ve... | [
"gears.draw.primitives.CompositeNode",
"gears.core.Application",
"gears.draw.transforms.Rotation",
"gears.draw.transforms.Translation",
"gears.draw.transforms.Scaling",
"gears.draw.primitives.Triangle"
] | [((142, 190), 'gears.draw.primitives.Triangle', 'draw.primitives.Triangle', (['(200, 200)', '(100, 400)'], {}), '((200, 200), (100, 400))\n', (166, 190), False, 'from gears import draw\n'), ((202, 245), 'gears.draw.transforms.Translation', 'draw.transforms.Translation', (['node', '(300)', '(200)'], {}), '(node, 300, 20... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from transformer import MultiHeadAtt as attention
## Huggin face - Tranformers ##
from transformers import BertModel, BertConfig
import args
arg = args.process_command()
lang = arg.lang
gpu = arg.gpu
if lang == 'en':
weight = 'bert-base-cased'
else:
... | [
"torch.nn.Dropout",
"torch.nn.Conv2d",
"torch.nn.MSELoss",
"torch.nn.functional.relu",
"torch.nn.Linear",
"transformer.MultiHeadAtt",
"args.process_command",
"torch.cat",
"torch.nn.GRU"
] | [((215, 237), 'args.process_command', 'args.process_command', ([], {}), '()\n', (235, 237), False, 'import args\n'), ((585, 597), 'torch.nn.MSELoss', 'nn.MSELoss', ([], {}), '()\n', (595, 597), True, 'import torch.nn as nn\n'), ((613, 625), 'torch.nn.MSELoss', 'nn.MSELoss', ([], {}), '()\n', (623, 625), True, 'import t... |
"""entry level, run app"""
import os
from api.app import create_app
config_name = os.getenv('APP_SETTINGS') # config_name = "development"
app = create_app(config_name)
from api.manage import migrate
migrate()
if __name__ == '__main__':
app.run(debug=True) | [
"api.app.create_app",
"api.manage.migrate",
"os.getenv"
] | [((85, 110), 'os.getenv', 'os.getenv', (['"""APP_SETTINGS"""'], {}), "('APP_SETTINGS')\n", (94, 110), False, 'import os\n'), ((149, 172), 'api.app.create_app', 'create_app', (['config_name'], {}), '(config_name)\n', (159, 172), False, 'from api.app import create_app\n'), ((205, 214), 'api.manage.migrate', 'migrate', ([... |
"""Collection of functions related to data."""
from functools import partial
import torch
def scale_features(X, approach='standard'):
"""Scale feature matrix.
Parameters
----------
X : torch.Tensor
Tensor of shape (n_samples, n_channels, lookback, n_assets). Unscaled
approach : str, {'s... | [
"torch.manual_seed",
"torch.stack",
"torch.utils.data.SubsetRandomSampler",
"torch.from_numpy",
"torch.nn.functional.dropout",
"torch.randn_like",
"functools.partial",
"torch.ones"
] | [((11937, 12004), 'torch.stack', 'torch.stack', (['[b[0][:, -lookback:, asset_ixs] for b in batch]'], {'dim': '(0)'}), '([b[0][:, -lookback:, asset_ixs] for b in batch], dim=0)\n', (11948, 12004), False, 'import torch\n'), ((12106, 12171), 'torch.stack', 'torch.stack', (['[b[1][:, :horizon, asset_ixs] for b in batch]']... |
"""Hookwrapper that merges results from get_configurable_args such that there
are no duplicates in the otuput.
"""
import collections
import itertools
from typing import Iterable, Mapping, List
import repobee_plug as plug
from repobee_plug.cli import args
@plug.repobee_hook(hookwrapper=True)
def get_configurable_ar... | [
"repobee_plug.repobee_hook",
"collections.defaultdict"
] | [((261, 296), 'repobee_plug.repobee_hook', 'plug.repobee_hook', ([], {'hookwrapper': '(True)'}), '(hookwrapper=True)\n', (278, 296), True, 'import repobee_plug as plug\n'), ((1136, 1165), 'collections.defaultdict', 'collections.defaultdict', (['list'], {}), '(list)\n', (1159, 1165), False, 'import collections\n')] |
import os
from datetime import date
from pathlib import Path
from flask import render_template_string, Response
from premailer import transform
class Layout:
@classmethod
def process(
cls,
template=None,
css=None,
body=None,
params=None
):
folder = ... | [
"premailer.transform",
"flask.render_template_string",
"os.path.abspath",
"pathlib.Path"
] | [((1449, 1464), 'premailer.transform', 'transform', (['body'], {}), '(body)\n', (1458, 1464), False, 'from premailer import transform\n'), ((336, 361), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (351, 361), False, 'import os\n'), ((1589, 1632), 'flask.render_template_string', 'render_temp... |
"""Main method to generate new datasets
Example of program call:
* generate 64*64 pixel images from Shapes dataset, 10000 images in the training
set, 100 in the validation set, 1000 in the testing set::
python deeposlandia/datagen.py -D shapes -s 64 -t 10000 -v 100 -T 1000
"""
import argparse
import os
impo... | [
"deeposlandia.utils.prepare_preprocessed_folder",
"os.path.join",
"deeposlandia.utils.prepare_input_folder",
"deeposlandia.config.get",
"os.path.isfile",
"deeposlandia.datasets.mapillary.MapillaryDataset",
"daiquiri.getLogger",
"deeposlandia.datasets.aerial.AerialDataset",
"deeposlandia.datasets.sha... | [((706, 734), 'daiquiri.getLogger', 'daiquiri.getLogger', (['__name__'], {}), '(__name__)\n', (724, 734), False, 'import daiquiri\n'), ((814, 869), 'deeposlandia.utils.prepare_input_folder', 'utils.prepare_input_folder', (['args.datapath', 'args.dataset'], {}), '(args.datapath, args.dataset)\n', (840, 869), False, 'fro... |
import configparser
import io
CONFIG_INI = "config.ini"
def write_configuration_file(conf):
try:
with io.open(CONFIG_INI, 'w', encoding="utf-8") as f:
conf.write(f)
except (IOError, configparser.Error):
print("Failed to write config file!")
def read_configuration_file():
try... | [
"configparser.ConfigParser",
"io.open"
] | [((117, 159), 'io.open', 'io.open', (['CONFIG_INI', '"""w"""'], {'encoding': '"""utf-8"""'}), "(CONFIG_INI, 'w', encoding='utf-8')\n", (124, 159), False, 'import io\n'), ((335, 372), 'io.open', 'io.open', (['CONFIG_INI'], {'encoding': '"""utf-8"""'}), "(CONFIG_INI, encoding='utf-8')\n", (342, 372), False, 'import io\n'... |
# Generated by Django 2.1.4 on 2019-09-26 01:59
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('carnival', '0003_auto_20190925_1802'),
]
operations = [
migrations.AddField(
model_name='carnival',
name='categories... | [
"django.db.models.ManyToManyField"
] | [((341, 384), 'django.db.models.ManyToManyField', 'models.ManyToManyField', ([], {'to': '"""carnival.Grade"""'}), "(to='carnival.Grade')\n", (363, 384), False, 'from django.db import migrations, models\n')] |
import numpy as np
import teaserpp_python
from Config import Config
import gtsam as gt
from gtsam import (Cal3_S2, GenericProjectionFactorCal3_S2,
NonlinearFactorGraph, NonlinearISAM, Pose3,
PriorFactorPoint3, PriorFactorPose3, Rot3,
PinholeCameraCal3_S2, Values,... | [
"numpy.sqrt",
"gtsam.Pose3",
"gtsam.Point3",
"gtsam.Marginals",
"numpy.array",
"gtsam.Values",
"numpy.arange",
"gtsam.symbol_shorthand.X",
"teaserpp_python.RobustRegistrationSolver.Params",
"gtsam.noiseModel_Diagonal.Information",
"teaserpp_python.RobustRegistrationSolver",
"numpy.dot",
"num... | [((3547, 3596), 'teaserpp_python.RobustRegistrationSolver.Params', 'teaserpp_python.RobustRegistrationSolver.Params', ([], {}), '()\n', (3594, 3596), False, 'import teaserpp_python\n'), ((4094, 4154), 'teaserpp_python.RobustRegistrationSolver', 'teaserpp_python.RobustRegistrationSolver', (['self.solver_params'], {}), '... |
# Copyright 2015 Futurewei. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | [
"sqlalchemy.ForeignKeyConstraint",
"alembic.op.f",
"sqlalchemy.PrimaryKeyConstraint",
"sqlalchemy.Integer",
"sqlalchemy.UniqueConstraint",
"sqlalchemy.String"
] | [((1963, 1992), 'sqlalchemy.PrimaryKeyConstraint', 'sa.PrimaryKeyConstraint', (['"""id"""'], {}), "('id')\n", (1986, 1992), True, 'import sqlalchemy as sa\n'), ((2045, 2086), 'alembic.op.f', 'op.f', (['"""ix_sfc_portpair_details_tenant_id"""'], {}), "('ix_sfc_portpair_details_tenant_id')\n", (2049, 2086), False, 'from ... |
# (C) Copyright 2019 Fujitsu Limited
#
# 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 writi... | [
"mock.patch.object",
"monasca_persister.repositories.cassandra.alarm_state_history_repository.AlarmStateHistCassandraRepository",
"mock.Mock"
] | [((1058, 1124), 'monasca_persister.repositories.cassandra.alarm_state_history_repository.AlarmStateHistCassandraRepository', 'alarm_state_history_repository.AlarmStateHistCassandraRepository', ([], {}), '()\n', (1122, 1124), False, 'from monasca_persister.repositories.cassandra import alarm_state_history_repository\n')... |
from dragonfly import (Grammar, AppContext, MappingRule, Dictation,
Key, Text, FocusWindow, IntegerRef, Choice)
from dragonglue import LinuxAppContext
from dragonglue.command import Command
#---------------------------------------------------------------------------
# Create this module's gramm... | [
"dragonfly.Text",
"dragonfly.Dictation",
"dragonglue.LinuxAppContext",
"dragonfly.Grammar",
"dragonfly.Choice",
"dragonfly.Key",
"dragonfly.IntegerRef",
"dragonglue.command.Command"
] | [((379, 421), 'dragonglue.LinuxAppContext', 'LinuxAppContext', ([], {'executable': '"""sublime_text"""'}), "(executable='sublime_text')\n", (394, 421), False, 'from dragonglue import LinuxAppContext\n'), ((432, 472), 'dragonfly.Grammar', 'Grammar', (['"""sublime text"""'], {'context': 'context'}), "('sublime text', con... |
"""An AccountScanner scans a set of accounts using an AccountScanPlan to define scan
parameters"""
from collections import defaultdict
from concurrent.futures import Future, ThreadPoolExecutor, as_completed
from dataclasses import dataclass
import random
import time
import traceback
from typing import Any, DefaultDict,... | [
"traceback.format_exc",
"altimeter.aws.resource.unscanned_account.UnscannedAccountResourceSpec.create_resource",
"random.choice",
"altimeter.core.log.Logger",
"altimeter.core.graph.graph_set.GraphSet",
"concurrent.futures.ThreadPoolExecutor",
"boto3.Session",
"altimeter.core.graph.graph_set.GraphSet.f... | [((1828, 1850), 'dataclasses.dataclass', 'dataclass', ([], {'frozen': '(True)'}), '(frozen=True)\n', (1837, 1850), False, 'from dataclasses import dataclass\n'), ((16225, 16233), 'altimeter.core.log.Logger', 'Logger', ([], {}), '()\n', (16231, 16233), False, 'from altimeter.core.log import Logger\n'), ((3338, 3346), 'a... |
try:
import torch
import torchmetrics
from latte.metrics.torch import interpolatability as T
has_torch_and_tm = True
except:
has_torch_and_tm = False
import pytest
import numpy as np
from latte.metrics.core import interpolatability as C
@pytest.mark.skipif(not has_torch_and_tm, reason="requires... | [
"torch.testing.assert_allclose",
"numpy.arange",
"numpy.testing.assert_allclose",
"torch.from_numpy",
"pytest.mark.skipif",
"latte.metrics.core.interpolatability.Smoothness",
"numpy.random.randn",
"latte.metrics.torch.interpolatability.Smoothness"
] | [((263, 350), 'pytest.mark.skipif', 'pytest.mark.skipif', (['(not has_torch_and_tm)'], {'reason': '"""requires torch and torchmetrics"""'}), "(not has_torch_and_tm, reason=\n 'requires torch and torchmetrics')\n", (281, 350), False, 'import pytest\n'), ((419, 433), 'latte.metrics.core.interpolatability.Smoothness', ... |
"""Manage logs for the application
More info at: https://docs.python.org/3.7/howto/logging.html
Best way to log an exception, with python 2.x retrocompatibility:
self._logger.exception("Error process the request %s", err)
Otherwise, use
self._logger.exception("Error process the request {}".format(err))
This line ... | [
"logging.basicConfig",
"logging.getLogger"
] | [((910, 1045), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO', 'format': '"""%(asctime)s - %(name)s - %(levelname)s - %(message)s"""', 'datefmt': '"""%m-%d %H:%M"""'}), "(level=logging.INFO, format=\n '%(asctime)s - %(name)s - %(levelname)s - %(message)s', datefmt=\n '%m-%d %H:%M')\n"... |
import argparse
import warnings
from ishtos_runner import Tester
warnings.filterwarnings("ignore")
def main(args):
tester = Tester(
config_name=args.config_name, ckpt=args.ckpt, batch_size=args.batch_size
)
tester.run_inference()
def parse_args():
parser = argparse.ArgumentParser()
par... | [
"warnings.filterwarnings",
"argparse.ArgumentParser",
"ishtos_runner.Tester"
] | [((67, 100), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (90, 100), False, 'import warnings\n'), ((132, 217), 'ishtos_runner.Tester', 'Tester', ([], {'config_name': 'args.config_name', 'ckpt': 'args.ckpt', 'batch_size': 'args.batch_size'}), '(config_name=args.config_nam... |
import itertools
import time
import numpy as np
import scipy.ndimage as ndi
import pytest
from mrrt.utils import ImageGeometry, ellipse_im
from mrrt.mri import mri_exp_approx
__all__ = ["test_mri_exp_approx"]
def _test_mri_exp_approx1(
segments=4,
nx=64,
tmax=25e-3,
dt=5e-6,
autocorr=False,
... | [
"pytest.mark.filterwarnings",
"numpy.array",
"scipy.ndimage.zoom",
"numpy.arange",
"matplotlib.pyplot.imshow",
"itertools.product",
"numpy.asarray",
"numpy.dot",
"mrrt.mri.mri_exp_approx",
"numpy.round",
"numpy.abs",
"numpy.ones",
"numpy.floor",
"scipy.ndimage.convolve",
"numpy.any",
"... | [((4468, 4531), 'pytest.mark.filterwarnings', 'pytest.mark.filterwarnings', (['"""ignore:the matrix subclass is not"""'], {}), "('ignore:the matrix subclass is not')\n", (4494, 4531), False, 'import pytest\n'), ((547, 569), 'numpy.arange', 'np.arange', (['(0)', 'tmax', 'dt'], {}), '(0, tmax, dt)\n', (556, 569), True, '... |
"""
Copyright 2017-present, Airbnb Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, sof... | [
"datetime.datetime",
"json.loads",
"stream_alert.shared.LOGGER.error",
"datetime.datetime.utcnow",
"stream_alert.shared.LOGGER.info",
"os.path.splitext",
"boto3.resource",
"stream_alert.shared.LOGGER.debug",
"datetime.timedelta",
"botocore.client.Config",
"time.time",
"zlib.decompress"
] | [((1064, 1099), 'datetime.datetime', 'datetime', ([], {'year': '(1970)', 'month': '(1)', 'day': '(1)'}), '(year=1970, month=1, day=1)\n', (1072, 1099), False, 'from datetime import datetime, timedelta\n'), ((1267, 1352), 'botocore.client.Config', 'client.Config', ([], {'connect_timeout': 'self.BOTO_TIMEOUT', 'read_time... |
# -*- coding: utf-8 -*-
# MegEngine is Licensed under the Apache License, Version 2.0 (the "License")
#
# Copyright (c) 2014-2020 Megvii Inc. All rights reserved.
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT ARRANTI... | [
"megengine.functional.add_axis",
"megengine.functional.arange",
"megengine.functional.sigmoid",
"megengine.functional.abs",
"official.vision.detection.layers.logsigmoid",
"megengine.functional.exp"
] | [((1623, 1655), 'megengine.functional.arange', 'F.arange', (['(1)', '(logits.shape[2] + 1)'], {}), '(1, logits.shape[2] + 1)\n', (1631, 1655), True, 'import megengine.functional as F\n'), ((1670, 1696), 'megengine.functional.add_axis', 'F.add_axis', (['labels'], {'axis': '(2)'}), '(labels, axis=2)\n', (1680, 1696), Tru... |
from __future__ import print_function
import torch
import torch.utils.data as data
import torchvision
from torchvision import transforms
import random
import os
import numpy as np
from PIL import Image
class Base_Dataset(data.Dataset):
def __init__(self, root, partition, target_ratio=0.0):
super(Base_Datas... | [
"torchvision.transforms.CenterCrop",
"random.choice",
"PIL.Image.open",
"random.shuffle",
"torch.LongTensor",
"torch.stack",
"os.path.join",
"torchvision.transforms.RandomHorizontalFlip",
"torchvision.transforms.RandomCrop",
"torch.tensor",
"numpy.array",
"torchvision.transforms.Normalize",
... | [((609, 657), 'torchvision.transforms.Normalize', 'transforms.Normalize', ([], {'mean': 'mean_pix', 'std': 'std_pix'}), '(mean=mean_pix, std=std_pix)\n', (629, 657), False, 'from torchvision import transforms\n'), ((2421, 2455), 'random.shuffle', 'random.shuffle', (['class_index_source'], {}), '(class_index_source)\n',... |
from gevent import monkey # isort:skip # noqa
monkey.patch_all() # isort:skip # noqa
from app.app import app # noqa
| [
"gevent.monkey.patch_all"
] | [((48, 66), 'gevent.monkey.patch_all', 'monkey.patch_all', ([], {}), '()\n', (64, 66), False, 'from gevent import monkey\n')] |
# This file is part of Pynguin.
#
# Pynguin 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) any later version.
#
# Pynguin is distributed in the ho... | [
"inspect.isclass",
"inspect.isfunction",
"inspect.getmembers",
"inspect.ismethod"
] | [((1143, 1185), 'inspect.getmembers', 'inspect.getmembers', (['module', 'filter_members'], {}), '(module, filter_members)\n', (1161, 1185), False, 'import inspect\n'), ((971, 994), 'inspect.isclass', 'inspect.isclass', (['member'], {}), '(member)\n', (986, 994), False, 'import inspect\n'), ((1010, 1036), 'inspect.isfun... |
import numpy as np
import torch
from experience_replay import ExperienceReplay
from network import Q
from config import hyperparameters as h
#----------------------------------------------------------------------------
# Reinforcement learning agent.
class Agent:
def __init__(self, state_shape, nof_actions):
... | [
"torch.from_numpy",
"experience_replay.ExperienceReplay",
"torch.tensor",
"numpy.random.randint",
"numpy.random.sample",
"network.Q"
] | [((466, 495), 'experience_replay.ExperienceReplay', 'ExperienceReplay', (['state_shape'], {}), '(state_shape)\n', (482, 495), False, 'from experience_replay import ExperienceReplay\n'), ((513, 550), 'network.Q', 'Q', (['state_shape', 'nof_actions', '"""online"""'], {}), "(state_shape, nof_actions, 'online')\n", (514, 5... |
#!/usr/bin/env python
##############################################################
# $Id$
# Project: WGS pipeline for Nephele project
# Language: Python 2.7
# Authors: <NAME>, <NAME>, <NAME>
# History: July 2015 Start of development
##############################################################
__author__ = ... | [
"os.getcwd",
"os.path.isfile",
"os.chdir",
"os.popen",
"sys.exit",
"os.system"
] | [((1169, 1200), 'os.system', 'os.system', (["('echo >>' + log_file)"], {}), "('echo >>' + log_file)\n", (1178, 1200), False, 'import sys, os, random, time, glob\n'), ((1939, 1950), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (1948, 1950), False, 'import sys, os, random, time, glob\n'), ((2267, 2295), 'os.path.isfile', ... |
import logging
import time
import pafy
import cv2
import cvlib as cv
from cvlib.object_detection import draw_bbox, populate_class_labels
import numpy as np
from django.http import StreamingHttpResponse
from traffic_monitor.detectors.detector_cvlib import DetectorCVlib
logger = logging.getLogger('video_models')
logg... | [
"logging.getLogger",
"cv2.imencode",
"time.sleep",
"pafy.new",
"cv2.VideoCapture",
"traffic_monitor.detectors.detector_cvlib.DetectorCVlib"
] | [((282, 315), 'logging.getLogger', 'logging.getLogger', (['"""video_models"""'], {}), "('video_models')\n", (299, 315), False, 'import logging\n'), ((2206, 2227), 'cv2.VideoCapture', 'cv2.VideoCapture', (['cam'], {}), '(cam)\n', (2222, 2227), False, 'import cv2\n'), ((2436, 2457), 'cv2.VideoCapture', 'cv2.VideoCapture'... |
# Generated by Django 3.2.3 on 2021-05-17 02:18
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Floor',
fields=[
... | [
"django.db.models.IntegerField",
"django.db.models.ForeignKey",
"django.db.models.BooleanField",
"django.db.models.AutoField",
"django.db.models.CharField"
] | [((2631, 2716), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'on_delete': 'django.db.models.deletion.CASCADE', 'to': '"""hotel.hotel"""'}), "(on_delete=django.db.models.deletion.CASCADE, to='hotel.hotel'\n )\n", (2648, 2716), False, 'from django.db import migrations, models\n'), ((334, 427), 'django.db.... |
from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
def inicio():
return render_template('inicio.html')
app.run() | [
"flask.render_template",
"flask.Flask"
] | [((49, 64), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (54, 64), False, 'from flask import Flask, render_template\n'), ((107, 137), 'flask.render_template', 'render_template', (['"""inicio.html"""'], {}), "('inicio.html')\n", (122, 137), False, 'from flask import Flask, render_template\n')] |
from pathlib import Path
from math import log10
input_path = Path('benchmark.txt')
benchmark_output_path = Path('tex/benchmark-result.tex')
n_output_path = Path('tex/n-samples-benchmark.tex')
benchmark_output_text = ''
benchmark_output_text += '\\begin{tabular}{crrrr}\n'
benchmark_output_text += ' \\toprule\n'
ben... | [
"pathlib.Path"
] | [((62, 83), 'pathlib.Path', 'Path', (['"""benchmark.txt"""'], {}), "('benchmark.txt')\n", (66, 83), False, 'from pathlib import Path\n'), ((108, 140), 'pathlib.Path', 'Path', (['"""tex/benchmark-result.tex"""'], {}), "('tex/benchmark-result.tex')\n", (112, 140), False, 'from pathlib import Path\n'), ((157, 192), 'pathl... |
#!/usr/bin/env python3
import io
import re
from setuptools import setup
# Python's cryptography builds a binary from C using libffi-dev
#sudo apt-get install build-essential libssl-dev libffi-dev python-dev
setup(
name='HSBNEXero',
version='0.1.0',
description='Reporting tool from Xero for HSBNE.org.',
... | [
"setuptools.setup"
] | [((208, 422), 'setuptools.setup', 'setup', ([], {'name': '"""HSBNEXero"""', 'version': '"""0.1.0"""', 'description': '"""Reporting tool from Xero for HSBNE.org."""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'url': '""""""', 'install_requires': "['PyCrypto', 'pyxero>=0.7.0', 'PyJWT']"}), "(name='HSBNEX... |
from django.db import models
from django.utils import timezone
class Books(models.Model):
Name = models.CharField(max_length=100)
Page_Number = models.CharField(max_length=200)
Genre = models.CharField(max_length=50)
pub_date = models.Field(default=timezone.now)
| [
"django.db.models.CharField",
"django.db.models.Field"
] | [((102, 134), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)'}), '(max_length=100)\n', (118, 134), False, 'from django.db import models\n'), ((153, 185), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(200)'}), '(max_length=200)\n', (169, 185), False, 'from django.d... |
import socket
class SocketPool:
def __init__(self, __unused_radio):
pass
@staticmethod
def socket():
return socket.socket(socket.AF_INET, socket.SOCK_STREAM)
| [
"socket.socket"
] | [((139, 188), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (152, 188), False, 'import socket\n')] |
# Database
# https://docs.djangoproject.com/en/1.11/ref/settings/#databases
import os
import dj_database_url
DATABASES = {}
DATABASES['default'] = dj_database_url.config(default=os.environ.get('DATABASE_URL'))
| [
"os.environ.get"
] | [((181, 211), 'os.environ.get', 'os.environ.get', (['"""DATABASE_URL"""'], {}), "('DATABASE_URL')\n", (195, 211), False, 'import os\n')] |
# Copyright 2022 The Brax 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
#
# Unless required by applicable law or agreed to in wri... | [
"logging.getLogger",
"logging.StreamHandler",
"brax.io.file.Exists",
"brax.io.file.MakeDirs",
"numpy.array",
"pyqtgraph.Qt.QtGui.QApplication",
"copy.deepcopy",
"pyqtgraph.GraphicsWindow",
"numpy.genfromtxt",
"numpy.mean",
"collections.deque",
"brax.io.file.File",
"numpy.max",
"multiproces... | [((962, 994), 'pprint.pformat', 'pprint.pformat', (['config'], {'indent': '(2)'}), '(config, indent=2)\n', (976, 994), False, 'import pprint\n'), ((6220, 6245), 'collections.OrderedDict', 'collections.OrderedDict', ([], {}), '()\n', (6243, 6245), False, 'import collections\n'), ((7076, 7087), 'time.time', 'time.time', ... |
from pavilion.unittest import PavTestCase
from pavilion import config
import io
class PavConfigTests(PavTestCase):
def test_blank_cycle(self):
"""Ensure we can both write and read the config template."""
loader = config.PavilionConfigLoader()
file = io.StringIO()
loader.dump(fi... | [
"io.StringIO",
"pavilion.config.PavilionConfigLoader"
] | [((237, 266), 'pavilion.config.PavilionConfigLoader', 'config.PavilionConfigLoader', ([], {}), '()\n', (264, 266), False, 'from pavilion import config\n'), ((283, 296), 'io.StringIO', 'io.StringIO', ([], {}), '()\n', (294, 296), False, 'import io\n'), ((494, 523), 'pavilion.config.PavilionConfigLoader', 'config.Pavilio... |
import pandas as pd
import argparse
def writeOutFile(outputDF, outfile):
outputDF.to_csv(outfile, sep=',', encoding='utf-8', index=False)
def createOutputDF(inputDF, n):
diff = n - 1
outputDF = pd.DataFrame()
for i in range(int(inputDF.shape[0] / n)):
if i == 0:
dfl = pd.DataFram... | [
"pandas.DataFrame",
"argparse.ArgumentParser",
"pandas.read_csv"
] | [((210, 224), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (222, 224), True, 'import pandas as pd\n'), ((883, 931), 'pandas.read_csv', 'pd.read_csv', (['inputfile'], {'delimiter': 'd', 'header': 'None'}), '(inputfile, delimiter=d, header=None)\n', (894, 931), True, 'import pandas as pd\n'), ((978, 1003), 'argp... |
import os
import json
import requests
import networkx as nx
from urllib import parse
from itertools import chain
from multiprocessing import Pool
def link_to_title(link):
return link["title"]
def clean_if_key(page, key):
if key in page.keys():
return map(link_to_title, page[key])
else:
r... | [
"json.loads",
"networkx.readwrite.gexf.write_gexf",
"networkx.DiGraph",
"urllib.parse.quote",
"requests.get",
"itertools.chain.from_iterable",
"os.cpu_count"
] | [((550, 573), 'urllib.parse.quote', 'parse.quote', (['page_title'], {}), '(page_title)\n', (561, 573), False, 'from urllib import parse\n'), ((835, 854), 'json.loads', 'json.loads', (['content'], {}), '(content)\n', (845, 854), False, 'import json\n'), ((2593, 2619), 'itertools.chain.from_iterable', 'chain.from_iterabl... |
#! python3
from __future__ import print_function
import SimpleITK as sitk
import numpy as np
import sys
import os
from DynamicLabelFusionWithSimilarityWeights import DynamicLabelFusionWithLocalSimilarityWeights as DynamicLocalLabelling
from DynamicLabelFusionWithSimilarityWeights import DynamicLabelFusionWithSimilar... | [
"os.path.exists",
"os.listdir",
"SimpleITK.WriteImage",
"os.path.isfile",
"DynamicLabelFusionWithSimilarityWeights.DynamicLabelFusionWithLocalSimilarityWeights",
"os.mkdir",
"SimpleITK.ReadImage",
"DynamicLabelFusionWithSimilarityWeights.DynamicLabelFusionWithSimilarityWeights"
] | [((980, 1031), 'SimpleITK.ReadImage', 'sitk.ReadImage', (["(dataPath + 'input_registration.mhd')"], {}), "(dataPath + 'input_registration.mhd')\n", (994, 1031), True, 'import SimpleITK as sitk\n'), ((1119, 1139), 'os.listdir', 'os.listdir', (['dataPath'], {}), '(dataPath)\n', (1129, 1139), False, 'import os\n'), ((2153... |
"""Files positional argument related stuff for hunspellcheck CLI utilities."""
import argparse
import copy
import glob
class FilesOrGlobsAction(argparse.Action):
"""Prior to Python3.8, the argarse module does not include the
`_ExtendAction`, so here we are replicating their behaviour.
If the library sto... | [
"glob.glob"
] | [((677, 693), 'glob.glob', 'glob.glob', (['value'], {}), '(value)\n', (686, 693), False, 'import glob\n')] |
import logging
import sys
from collections import namedtuple
from queue import Empty
from time import sleep
from types import GeneratorType
from bonobo.config import create_container
from bonobo.config.processors import ContextCurrifier
from bonobo.constants import NOT_MODIFIED, BEGIN, END, TICK_PERIOD, Token, Flag, I... | [
"logging.getLogger",
"bonobo.util.ensure_tuple",
"bonobo.errors.UnrecoverableTypeError",
"collections.namedtuple",
"bonobo.util.bags.BagType",
"bonobo.util.get_name",
"bonobo.util.isconfigurabletype",
"bonobo.util.statistics.WithStatistics.__init__",
"bonobo.execution.contexts.base.BaseContext.__ini... | [((678, 705), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (695, 705), False, 'import logging\n'), ((726, 776), 'collections.namedtuple', 'namedtuple', (['"""UnboundArguments"""', "['args', 'kwargs']"], {}), "('UnboundArguments', ['args', 'kwargs'])\n", (736, 776), False, 'from collecti... |
from __future__ import print_function
from cloudmesh.util.config import read_yaml_config
from cloudmesh.config.cm_config import cm_config_server
from cloudmesh.provisioner.baremetal_status import BaremetalStatus
import requests
import json
from time import sleep
import threading
from cloudmesh_base.logger import LOGGE... | [
"json.dumps",
"cloudmesh_base.logger.LOGGER",
"cloudmesh.config.cm_config.cm_config_server",
"time.sleep",
"cloudmesh.provisioner.baremetal_status.BaremetalStatus",
"threading.Thread"
] | [((355, 371), 'cloudmesh_base.logger.LOGGER', 'LOGGER', (['__file__'], {}), '(__file__)\n', (361, 371), False, 'from cloudmesh_base.logger import LOGGER\n'), ((612, 629), 'cloudmesh.provisioner.baremetal_status.BaremetalStatus', 'BaremetalStatus', ([], {}), '()\n', (627, 629), False, 'from cloudmesh.provisioner.baremet... |
import pygame
from pygame.locals import *
from pygame.display import *
from sys import exit
from tkinter import *
from tkinter.ttk import *
pygame.init()
pygame.font.init()
# fonts
font = pygame.font.Font('../Fontes/the_students_teacher/TheStudentsTeacher-Regular.ttf', 32)
class button:
def __init__(self, texto... | [
"pygame.mouse.get_pressed",
"pygame.init",
"pygame.quit",
"pygame.event.get",
"pygame.mouse.get_pos",
"pygame.font.init",
"sys.exit",
"pygame.image.load",
"pygame.font.Font"
] | [((141, 154), 'pygame.init', 'pygame.init', ([], {}), '()\n', (152, 154), False, 'import pygame\n'), ((155, 173), 'pygame.font.init', 'pygame.font.init', ([], {}), '()\n', (171, 173), False, 'import pygame\n'), ((190, 280), 'pygame.font.Font', 'pygame.font.Font', (['"""../Fontes/the_students_teacher/TheStudentsTeacher-... |
from xml.etree import cElementTree as ET
class XMLProcesser():
def get_xml_root(self, path):
with open(path) as f:
xmlstr = f.read()
return ET.fromstring(xmlstr)
def extract_text_from_path(self, path):
root = self.get_xml_root(path)
doc_dict = {}
for page ... | [
"xml.etree.cElementTree.fromstring"
] | [((175, 196), 'xml.etree.cElementTree.fromstring', 'ET.fromstring', (['xmlstr'], {}), '(xmlstr)\n', (188, 196), True, 'from xml.etree import cElementTree as ET\n')] |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import logging
from gammapy.datasets import Datasets
from gammapy.modeling import Fit
from .core import Estimator
log = logging.getLogger(__name__)
class ParameterEstimator(Estimator):
"""Model parameter estimator.
Estimates a model parameter f... | [
"logging.getLogger",
"gammapy.modeling.Fit",
"gammapy.datasets.Datasets"
] | [((185, 212), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (202, 212), False, 'import logging\n'), ((7101, 7119), 'gammapy.datasets.Datasets', 'Datasets', (['datasets'], {}), '(datasets)\n', (7109, 7119), False, 'from gammapy.datasets import Datasets\n'), ((2604, 2617), 'gammapy.modelin... |
import asyncio
import mqttools
async def subscriber():
client = mqttools.Client('localhost', 1883)
await client.start()
# Subscribe to two topics in parallel.
await asyncio.gather(
client.subscribe('$SYS/#'),
client.subscribe('/test/mqttools/foo')
)
print('Waiting for messa... | [
"mqttools.Client"
] | [((71, 105), 'mqttools.Client', 'mqttools.Client', (['"""localhost"""', '(1883)'], {}), "('localhost', 1883)\n", (86, 105), False, 'import mqttools\n')] |
# -*- coding: utf-8 -*-
# pylint: disable=too-many-function-args,unexpected-keyword-arg
import platform
import sys
import arrow
from sh import gitlint, git # pylint: disable=no-name-in-module
from qa.base import BaseTestCase
class ConfigTests(BaseTestCase):
""" Integration tests for gitlint configuration and c... | [
"sh.gitlint",
"platform.platform",
"sh.git"
] | [((489, 574), 'sh.gitlint', 'gitlint', (['"""--ignore"""', '"""T5,B4"""'], {'_tty_in': '(True)', '_cwd': 'self.tmp_git_repo', '_ok_code': '[1]'}), "('--ignore', 'T5,B4', _tty_in=True, _cwd=self.tmp_git_repo, _ok_code=[1]\n )\n", (496, 574), False, 'from sh import gitlint, git\n'), ((853, 981), 'sh.gitlint', 'gitlint... |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
"""
An example showing how to include context correlation information in logging telemetry.
"""
import os
import logging
from opentelemetry import trace
from opentelemetry.sdk._logs import (
LogEmitterProvider,
OTLPHa... | [
"logging.getLogger",
"opentelemetry.sdk.trace.TracerProvider",
"opentelemetry.sdk._logs.get_log_emitter_provider",
"azure.monitor.opentelemetry.exporter.AzureMonitorLogExporter.from_connection_string",
"opentelemetry.sdk._logs.LogEmitterProvider",
"opentelemetry.sdk._logs.export.BatchLogProcessor",
"ope... | [((629, 655), 'opentelemetry.trace.get_tracer', 'trace.get_tracer', (['__name__'], {}), '(__name__)\n', (645, 655), False, 'from opentelemetry import trace\n'), ((715, 819), 'azure.monitor.opentelemetry.exporter.AzureMonitorLogExporter.from_connection_string', 'AzureMonitorLogExporter.from_connection_string', (["os.env... |
from django import forms
from apps.Testings.models import Phase
from .models import Argument, Source, Command
from django.utils.safestring import mark_safe
class ArgumentForm(forms.ModelForm):
class Meta:
model = Argument
fields = '__all__'
widgets = {
'command' : forms.HiddenI... | [
"django.forms.HiddenInput",
"django.forms.CharField",
"django.forms.PasswordInput",
"django.forms.IntegerField",
"django.forms.Textarea",
"django.utils.safestring.mark_safe",
"django.forms.TextInput",
"django.forms.FileField"
] | [((2084, 2115), 'django.forms.CharField', 'forms.CharField', ([], {'required': '(False)'}), '(required=False)\n', (2099, 2115), False, 'from django import forms\n'), ((2127, 2161), 'django.forms.IntegerField', 'forms.IntegerField', ([], {'required': '(False)'}), '(required=False)\n', (2145, 2161), False, 'from django i... |
import argparse
import torch
from stereo import MinSumStereo, BlockMatchStereo, RefinedMinSumStereo
import data
import imageio
import numpy as np
import matplotlib.pyplot as plt
parser = argparse.ArgumentParser()
parser.add_argument('--im0', action='store', required=True, type=str)
parser.add_argument('--im1', acti... | [
"stereo.BlockMatchStereo",
"argparse.ArgumentParser",
"data.load_sample",
"stereo.MinSumStereo",
"stereo.RefinedMinSumStereo",
"torch.no_grad"
] | [((191, 216), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (214, 216), False, 'import argparse\n'), ((2706, 2742), 'data.load_sample', 'data.load_sample', (['args.im0', 'args.im1'], {}), '(args.im0, args.im1)\n', (2722, 2742), False, 'import data\n'), ((2767, 2782), 'torch.no_grad', 'torch.no... |
from qulacs import QuantumState
from qulacs.gate import CNOT, RY, H
from skqulacs.circuit import show_blochsphere
def test_bloch():
n = 3
state = QuantumState(n)
state.set_computational_basis(0b000)
H(0).update_quantum_state(state)
show_blochsphere(state, 0)
RY(0, 0.1).update_quan... | [
"qulacs.QuantumState",
"qulacs.gate.RY",
"skqulacs.circuit.show_blochsphere",
"qulacs.gate.H",
"qulacs.gate.CNOT"
] | [((165, 180), 'qulacs.QuantumState', 'QuantumState', (['n'], {}), '(n)\n', (177, 180), False, 'from qulacs import QuantumState\n'), ((266, 292), 'skqulacs.circuit.show_blochsphere', 'show_blochsphere', (['state', '(0)'], {}), '(state, 0)\n', (282, 292), False, 'from skqulacs.circuit import show_blochsphere\n'), ((342, ... |
import librosa
import os
import random
from cyolo_score_following.utils.data_utils import SAMPLE_RATE
from multiprocessing import get_context
from pathlib import Path
from scipy.signal import convolve
# filter some impulse responses that produce a weird distorted sound
FILTER_LIST = [
"1a_marble_hall.wav",
"... | [
"scipy.signal.convolve",
"multiprocessing.get_context",
"random.choices",
"os.path.basename",
"random.random",
"os.path.expanduser",
"librosa.load"
] | [((1504, 1538), 'librosa.load', 'librosa.load', (['path'], {'sr': 'SAMPLE_RATE'}), '(path, sr=SAMPLE_RATE)\n', (1516, 1538), False, 'import librosa\n'), ((1942, 1969), 'os.path.basename', 'os.path.basename', (['path._str'], {}), '(path._str)\n', (1958, 1969), False, 'import os\n'), ((2464, 2479), 'random.random', 'rand... |
import re
from ja_timex.extract_filter import DecimalFilter, NumexpFilter, PartialNumFilter
from ja_timex.pattern.place import Pattern
from ja_timex.tag import Extract
def make_extract(target, original, type_name="abstime"):
return Extract(
type_name=type_name,
re_match=re.search(target, original... | [
"ja_timex.pattern.place.Pattern",
"ja_timex.extract_filter.PartialNumFilter",
"ja_timex.extract_filter.DecimalFilter",
"ja_timex.extract_filter.NumexpFilter",
"re.search"
] | [((444, 458), 'ja_timex.extract_filter.NumexpFilter', 'NumexpFilter', ([], {}), '()\n', (456, 458), False, 'from ja_timex.extract_filter import DecimalFilter, NumexpFilter, PartialNumFilter\n'), ((1450, 1468), 'ja_timex.extract_filter.PartialNumFilter', 'PartialNumFilter', ([], {}), '()\n', (1466, 1468), False, 'from j... |
from __future__ import absolute_import
import collections
from huskar_sdk_v2.consts import OVERALL
from huskar_api import settings
from huskar_api.models.const import ROUTE_DEFAULT_INTENT
RouteKey = collections.namedtuple('RouteKey', 'application_name intent')
def make_route_key(application_name, intent=None):
... | [
"collections.namedtuple"
] | [((203, 264), 'collections.namedtuple', 'collections.namedtuple', (['"""RouteKey"""', '"""application_name intent"""'], {}), "('RouteKey', 'application_name intent')\n", (225, 264), False, 'import collections\n')] |
from abc import ABCMeta, abstractmethod
import json
class BaseResultsConnector(object, metaclass=ABCMeta):
@abstractmethod
def create_results_connection(self, search_id, offset, length):
"""
Creates a connection to the specified datasource to retrieve query results
Args:
s... | [
"json.dumps"
] | [((1098, 1114), 'json.dumps', 'json.dumps', (['data'], {}), '(data)\n', (1108, 1114), False, 'import json\n')] |
'''
PointGroup train.py
Written by <NAME>
'''
import torch
import torch.nn.functional as F
import torch.optim as optim
import time, sys, os, random
from tensorboardX import SummaryWriter
import numpy as np
from util.config import cfg
from util.log import logger
import util.utils as utils
device = torch.device("cuda:... | [
"util.utils.is_power2",
"torch.cuda.is_available",
"util.utils.is_multiple",
"model.pointgroup.pointgroup.PointGroup",
"tensorboardX.SummaryWriter",
"util.log.logger.info",
"torch.set_num_threads",
"numpy.random.seed",
"util.config.cfg.config.split",
"time.time",
"torch.cuda.empty_cache",
"tor... | [((431, 473), 'os.path.join', 'os.path.join', (['cfg.exp_path', '"""backup_files"""'], {}), "(cfg.exp_path, 'backup_files')\n", (443, 473), False, 'import time, sys, os, random\n'), ((478, 516), 'os.makedirs', 'os.makedirs', (['backup_dir'], {'exist_ok': '(True)'}), '(backup_dir, exist_ok=True)\n', (489, 516), False, '... |
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Top-level presubmit script for cc.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for
details on the presubmit API built... | [
"re.search"
] | [((864, 899), 're.search', 're.search', (['"""\\\\bASSERT\\\\("""', 'contents'], {}), "('\\\\bASSERT\\\\(', contents)\n", (873, 899), False, 'import re\n'), ((998, 1042), 're.search', 're.search', (['"""ASSERT_NOT_REACHED\\\\("""', 'contents'], {}), "('ASSERT_NOT_REACHED\\\\(', contents)\n", (1007, 1042), False, 'impor... |
# -*- coding: utf-8 -*-
import re
from .affixes import split_prefixes, split_suffixes
# List of compound prefixes adapted from
# http://code.google.com/p/php-name-parser/
_compound_prefixes = ['vere', 'von', 'van', 'de', 'del', 'della', 'di', 'da',
'pietro', 'vanden', 'du', r'st\.', 'st', 'la', ... | [
"doctest.testmod"
] | [((6074, 6091), 'doctest.testmod', 'doctest.testmod', ([], {}), '()\n', (6089, 6091), False, 'import doctest\n')] |
#!/usr/bin/env python
# Copyright (c) 2014 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Make sure safeseh setting is extracted properly.
"""
import TestGyp
import sys
if sys.platform == 'win32':
test = TestGyp.TestGyp()... | [
"TestGyp.TestGyp"
] | [((303, 320), 'TestGyp.TestGyp', 'TestGyp.TestGyp', ([], {}), '()\n', (318, 320), False, 'import TestGyp\n')] |
import pyperclip
import os
def tracklist(data):
"""Given a list of tracks with their duration,
returns the same list, but with cumulative times
so that they be skipped-to in YouTube. The last
item of each line must represent the duration.
Ex:
1 Black Cow 5:07 1 Black Cow 0:00
2 Aja ... | [
"pyperclip.paste"
] | [((1191, 1208), 'pyperclip.paste', 'pyperclip.paste', ([], {}), '()\n', (1206, 1208), False, 'import pyperclip\n')] |
"""
Classes from the 'MIME' framework.
"""
try:
from rubicon.objc import ObjCClass
except ValueError:
def ObjCClass(name):
return None
def _Class(name):
try:
return ObjCClass(name)
except NameError:
return None
MFWeakProxy = _Class("MFWeakProxy")
MFWeakReferenceHolder = _Cl... | [
"rubicon.objc.ObjCClass"
] | [((197, 212), 'rubicon.objc.ObjCClass', 'ObjCClass', (['name'], {}), '(name)\n', (206, 212), False, 'from rubicon.objc import ObjCClass\n')] |
import random
print(random.randrange(20,50,3))
# using print() to print the result | [
"random.randrange"
] | [((21, 48), 'random.randrange', 'random.randrange', (['(20)', '(50)', '(3)'], {}), '(20, 50, 3)\n', (37, 48), False, 'import random\n')] |
import dataclasses
import re
from pathlib import Path
from typing import OrderedDict, Any, List, Union, Dict, Optional, Set
import logging
# noinspection PyPackageRequirements
from lxml import objectify
# noinspection PyPackageRequirements
from lxml.objectify import ObjectifiedElement
@dataclasses.dataclass
class S... | [
"logging.basicConfig",
"logging.getLogger",
"lxml.objectify.fromstring",
"pathlib.Path",
"re.sub"
] | [((2314, 2436), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""[%(filename)s:%(lineno)d] %(message)s"""', 'datefmt': '"""%Y-%m-%d:%H:%M:%S"""', 'level': 'logging.DEBUG'}), "(format='[%(filename)s:%(lineno)d] %(message)s', datefmt\n ='%Y-%m-%d:%H:%M:%S', level=logging.DEBUG)\n", (2333, 2436), False... |
import tensorflow as tf
from .activations import swish, mish
from tensorflow.keras.layers import Dense
from tensorflow.keras import Model as M
from tensorflow.keras import Input as I
from rls.layers import Noisy, mlp
initKernelAndBias = {
'kernel_initializer': tf.random_normal_initializer(0.0, .1),
... | [
"tensorflow.tile",
"tensorflow.transpose",
"tensorflow.random_normal_initializer",
"tensorflow.concat",
"tensorflow.constant_initializer",
"tensorflow.nn.softmax",
"tensorflow.reshape",
"rls.layers.mlp",
"tensorflow.reduce_mean",
"tensorflow.keras.Input"
] | [((276, 314), 'tensorflow.random_normal_initializer', 'tf.random_normal_initializer', (['(0.0)', '(0.1)'], {}), '(0.0, 0.1)\n', (304, 314), True, 'import tensorflow as tf\n'), ((340, 368), 'tensorflow.constant_initializer', 'tf.constant_initializer', (['(0.1)'], {}), '(0.1)\n', (363, 368), True, 'import tensorflow as t... |
import pytest
from spacy import registry
from thinc.api import Linear
from catalogue import RegistryError
@registry.architectures.register("my_test_function")
def create_model(nr_in, nr_out):
return Linear(nr_in, nr_out)
def test_get_architecture():
arch = registry.architectures.get("my_test_function")
... | [
"thinc.api.Linear",
"spacy.registry.architectures.register",
"pytest.raises",
"spacy.registry.architectures.get"
] | [((109, 160), 'spacy.registry.architectures.register', 'registry.architectures.register', (['"""my_test_function"""'], {}), "('my_test_function')\n", (140, 160), False, 'from spacy import registry\n'), ((205, 226), 'thinc.api.Linear', 'Linear', (['nr_in', 'nr_out'], {}), '(nr_in, nr_out)\n', (211, 226), False, 'from th... |
import unittest
from tree import TreeNode
# O(n). Recursive DFS.
class Solution:
def findSecondMinimumValue(self, root):
"""
:type root: TreeNode
:rtype: int
"""
if not root:
return -1
root_val = root.val
def find_min(node):
if not n... | [
"unittest.main",
"tree.TreeNode.from_array"
] | [((934, 949), 'unittest.main', 'unittest.main', ([], {}), '()\n', (947, 949), False, 'import unittest\n'), ((775, 800), 'tree.TreeNode.from_array', 'TreeNode.from_array', (['root'], {}), '(root)\n', (794, 800), False, 'from tree import TreeNode\n')] |
from __future__ import annotations
from babi.screen import VERSION_STR
from testing.runner import and_exit
def test_window_height_2(run, tmpdir):
# 2 tall:
# - header is hidden, otherwise behaviour is normal
f = tmpdir.join("f.txt")
f.write("hello world")
with run(str(f)) as h, and_exit(h):
... | [
"testing.runner.and_exit"
] | [((303, 314), 'testing.runner.and_exit', 'and_exit', (['h'], {}), '(h)\n', (311, 314), False, 'from testing.runner import and_exit\n'), ((846, 857), 'testing.runner.and_exit', 'and_exit', (['h'], {}), '(h)\n', (854, 857), False, 'from testing.runner import and_exit\n'), ((1263, 1274), 'testing.runner.and_exit', 'and_ex... |
#!/usr/bin/python
#
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | [
"tensorflow.contrib.slim.conv2d_transpose",
"tensorflow.contrib.slim.l2_regularizer",
"tensorflow.contrib.slim.flatten",
"tensorflow.contrib.layers.python.layers.utils.convert_collection_to_dict",
"tensorflow.variable_scope",
"tensorflow.contrib.slim.stack",
"tensorflow.split",
"tensorflow.concat",
... | [((1406, 1447), 'tensorflow.variable_scope', 'tf.variable_scope', (['"""encoder"""'], {'reuse': 'reuse'}), "('encoder', reuse=reuse)\n", (1423, 1447), True, 'import tensorflow as tf\n'), ((2963, 3018), 'tensorflow.contrib.layers.python.layers.utils.convert_collection_to_dict', 'utils.convert_collection_to_dict', (['end... |
from calendar import timegm
from datetime import datetime
from django.contrib.auth import authenticate
from django.core.exceptions import PermissionDenied
from django_auth_jwt_tenant import settings
from django_auth_jwt_tenant.compat import User
from django_auth_jwt_tenant.exceptions import AuthenticationFailed
jwt... | [
"django.core.exceptions.PermissionDenied",
"django.contrib.auth.authenticate",
"django_auth_jwt_tenant.exceptions.AuthenticationFailed",
"datetime.datetime.utcnow"
] | [((672, 699), 'django.contrib.auth.authenticate', 'authenticate', ([], {}), '(**credentials)\n', (684, 699), False, 'from django.contrib.auth import authenticate\n'), ((1187, 1209), 'django_auth_jwt_tenant.exceptions.AuthenticationFailed', 'AuthenticationFailed', ([], {}), '()\n', (1207, 1209), False, 'from django_auth... |
import ast
import operator
import pickle
from copy import deepcopy
from typing import List
import cv2
import numpy as np
import albumentations as A
from torch.utils.data import Dataset
from mlcomp.db.providers import ModelProvider
from mlcomp.utils.config import parse_albu_short, Config
from mlcomp.utils.torch impor... | [
"mlcomp.utils.torch.infer",
"numpy.array",
"mlcomp.db.providers.ModelProvider",
"cv2.imdecode",
"mlcomp.contrib.transform.tta.TtaWrap",
"copy.deepcopy",
"ast.parse",
"mlcomp.utils.config.parse_albu_short"
] | [((1599, 1610), 'copy.deepcopy', 'deepcopy', (['x'], {}), '(x)\n', (1607, 1610), False, 'from copy import deepcopy\n'), ((2221, 2242), 'mlcomp.contrib.transform.tta.TtaWrap', 'TtaWrap', (['x', 'tfms_albu'], {}), '(x, tfms_albu)\n', (2228, 2242), False, 'from mlcomp.contrib.transform.tta import TtaWrap\n'), ((3376, 3472... |
#!/usr/bin/env python
import os
import os.path as op
import pandas as pd
import numpy as np
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
import seaborn as sns
# 1. load a dataset from a file
# 2. "organize" that file, so we can access columns *or* rows of it easily
# 3. compute some "summary statisic... | [
"matplotlib.pyplot.hist",
"argparse.ArgumentParser",
"pandas.read_csv",
"os.path.isfile",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.scatter"
] | [((486, 542), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'description': '"""A CSV reader + stats maker"""'}), "(description='A CSV reader + stats maker')\n", (500, 542), False, 'from argparse import ArgumentParser\n'), ((745, 767), 'os.path.isfile', 'op.isfile', (['my_csv_file'], {}), '(my_csv_file)\n', (754, 7... |
import pickle
import select
import socket
import sys
import pygame
from pygame.locals import K_DOWN, K_LEFT, K_RIGHT, K_UP, KEYDOWN, KEYUP, QUIT
from hogpong.constants import (
BOTTOM_SIDE,
LEFT_SIDE,
RIGTH_SIDE,
SIDE_ENUMERATION,
TOP_SIDE,
)
# General Parameters
WHITE = (255, 255, 255)
BLACK = (... | [
"select.select",
"pygame.display.set_caption",
"sys.exit",
"pygame.quit",
"socket.socket",
"pygame.event.get",
"pickle.dumps",
"pygame.display.set_mode",
"pygame.display.flip",
"pygame.draw.rect",
"pygame.time.Clock"
] | [((838, 883), 'pygame.draw.rect', 'pygame.draw.rect', (['screen', 'WHITE', '(x, y, w, h)'], {}), '(screen, WHITE, (x, y, w, h))\n', (854, 883), False, 'import pygame\n'), ((3305, 3345), 'pygame.display.set_mode', 'pygame.display.set_mode', (['(WIDTH, HEIGHT)'], {}), '((WIDTH, HEIGHT))\n', (3328, 3345), False, 'import p... |
from pyramid.events import subscriber
from openprocurement.tender.core.events import TenderInitializeEvent
from openprocurement.tender.core.utils import (
get_now,
calculate_tender_business_date,
calculate_clarifications_business_date,
)
from openprocurement.tender.core.models import EnquiryPeriod
from ope... | [
"openprocurement.tender.core.utils.calculate_tender_business_date",
"pyramid.events.subscriber",
"openprocurement.tender.core.utils.calculate_clarifications_business_date",
"openprocurement.tender.core.utils.get_now"
] | [((413, 488), 'pyramid.events.subscriber', 'subscriber', (['TenderInitializeEvent'], {'procurementMethodType': '"""aboveThresholdUA"""'}), "(TenderInitializeEvent, procurementMethodType='aboveThresholdUA')\n", (423, 488), False, 'from pyramid.events import subscriber\n'), ((615, 709), 'openprocurement.tender.core.utils... |
# -*- coding: utf-8 -*-
import logging
from nlp_tasks.utils import my_corenlp
from nlp_tasks.common import common_path
MODEL_DIR = common_path.original_data_dir_big + 'stanford-corenlp-full-2018-02-27/'
def create_corenlp_server(start_new_server=False, lang='en', port=8081):
path_or_host = MODEL_DIR
if no... | [
"nlp_tasks.utils.my_corenlp.StanfordCoreNLP"
] | [((393, 513), 'nlp_tasks.utils.my_corenlp.StanfordCoreNLP', 'my_corenlp.StanfordCoreNLP', (['path_or_host'], {'lang': 'lang', 'quiet': '(False)', 'logging_level': 'logging.INFO', 'memory': '"""4g"""', 'port': 'port'}), "(path_or_host, lang=lang, quiet=False,\n logging_level=logging.INFO, memory='4g', port=port)\n", ... |
# coding: utf-8
# Create input features for the boosted decision tree model.
import os
import sys
import math
import datetime
import pandas as pd
from sklearn.pipeline import Pipeline
from common.features.lag import LagFeaturizer
from common.features.rolling_window import RollingWindowFeaturizer
from common.features... | [
"utils.df_from_cartesian_product",
"common.features.stats.PopularityFeaturizer",
"pandas.merge",
"common.features.lag.LagFeaturizer",
"pandas.set_option",
"os.getcwd",
"datetime.timedelta",
"common.features.temporal.TemporalFeaturizer",
"pandas.concat",
"sklearn.pipeline.Pipeline",
"math.exp",
... | [((458, 469), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (467, 469), False, 'import os\n'), ((687, 729), 'pandas.set_option', 'pd.set_option', (['"""display.max_columns"""', 'None'], {}), "('display.max_columns', None)\n", (700, 729), True, 'import pandas as pd\n'), ((505, 532), 'sys.path.append', 'sys.path.append', (... |
import bpy
import sys
import pickle
import struct
import numpy
PEANO_PREFIX = "_Peano"
WATER_MATERIAL_NAME = "Meta-water"
WIREFRAME_MATERIAL = "WireframeMaterial"
WIREFRAME_OFFSET = 0.001
class ReferenceArray:
def __init__(self, cellsPerDimension):
numpy.zeros([cellsPerDimension, cellsPerDimension], int)
def d... | [
"bpy.ops.object.editmode_toggle",
"bpy.context.scene.objects.link",
"bpy.data.meshes.remove",
"bpy.ops.mesh.select_all",
"time.clock",
"bpy.ops.object.mode_set",
"bpy.ops.object.material_slot_assign",
"bpy.context.scene.objects.unlink",
"bpy.data.objects.new",
"pickle.load",
"bpy.ops.mesh.faces_... | [((1587, 1625), 'bpy.data.objects.new', 'bpy.data.objects.new', (['objectName', 'mesh'], {}), '(objectName, mesh)\n', (1607, 1625), False, 'import bpy\n'), ((1663, 1706), 'bpy.context.scene.objects.link', 'bpy.context.scene.objects.link', (['peanoObject'], {}), '(peanoObject)\n', (1693, 1706), False, 'import bpy\n'), (... |
from datetime import date
from takler.core import Repeat, RepeatDate, Flow, NodeStatus, Parameter
import pytest
# RepeatDate
@pytest.fixture
def start_date_int():
return 20220601
@pytest.fixture
def end_date_int():
return 20220607
def test_repeat_date_create(start_date_int, end_date_int):
r = Repeat... | [
"takler.core.Flow",
"takler.core.RepeatDate",
"takler.core.Parameter",
"datetime.date",
"pytest.raises"
] | [((314, 369), 'takler.core.RepeatDate', 'RepeatDate', (['"""TAKLER_DATE"""', 'start_date_int', 'end_date_int'], {}), "('TAKLER_DATE', start_date_int, end_date_int)\n", (324, 369), False, 'from takler.core import Repeat, RepeatDate, Flow, NodeStatus, Parameter\n'), ((571, 626), 'takler.core.RepeatDate', 'RepeatDate', ([... |
# -*- coding:utf-8 -*-
from functools import partial
import httplib
from libcloud.storage import providers
from werkzeug.wsgi import wrap_file
from libcloud_rest.api.handlers import ServiceHandler, invoke_method,\
list_providers, get_driver_instance
from libcloud_rest.utils import json, Response
from libcloud_res... | [
"libcloud_rest.api.handlers.get_driver_instance",
"libcloud_rest.api.entries.ContainerEntry._get_object",
"libcloud_rest.api.entries.ObjectEntry.to_json",
"libcloud_rest.utils.json.dumps",
"libcloud_rest.api.handlers.invoke_method",
"functools.partial",
"libcloud_rest.api.handlers.ServiceHandler",
"we... | [((359, 392), 'functools.partial', 'partial', (['invoke_method', 'providers'], {}), '(invoke_method, providers)\n', (366, 392), False, 'from functools import partial\n'), ((413, 440), 'libcloud_rest.api.handlers.ServiceHandler', 'ServiceHandler', (['"""/storage/"""'], {}), "('/storage/')\n", (427, 440), False, 'from li... |
# Copyright (c) 2017 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""
Meteogram
=========
Plots time series data as a meteogram.
"""
import datetime as dt
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
from metpy.ca... | [
"datetime.datetime",
"matplotlib.dates.date2num",
"metpy.plots.add_metpy_logo",
"datetime.datetime.utcnow",
"matplotlib.dates.DateFormatter",
"metpy.cbook.get_test_data",
"numpy.array",
"matplotlib.pyplot.figure",
"metpy.units.units",
"datetime.timedelta",
"numpy.arange",
"matplotlib.pyplot.sh... | [((6981, 7018), 'datetime.datetime', 'dt.datetime', (['(2016)', '(3)', '(31)', '(22)', '(0)', '(0)', '(0)'], {}), '(2016, 3, 31, 22, 0, 0, 0)\n', (6992, 7018), True, 'import datetime as dt\n'), ((8372, 8400), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(20, 16)'}), '(figsize=(20, 16))\n', (8382, 8400), ... |
import torch
import torch.nn.functional as F
from torch import nn
from torch.optim import Adam
from tqdm import tqdm
from .losses import compute_mmd
class VANetTrainer(nn.Module):
def __init__(self, model, device="cpu"):
super().__init__()
self.model = model
self.prepare_optims()
... | [
"torch.no_grad",
"tqdm.tqdm",
"torch.nn.functional.cross_entropy"
] | [((504, 519), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (517, 519), False, 'import torch\n'), ((576, 593), 'tqdm.tqdm', 'tqdm', (['test_loader'], {}), '(test_loader)\n', (580, 593), False, 'from tqdm import tqdm\n'), ((1136, 1154), 'tqdm.tqdm', 'tqdm', (['train_loader'], {}), '(train_loader)\n', (1140, 1154),... |
import pickle
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
import pandas as pd
path = '/Users/tkoc/Code/ShapeOfLearning/Homology/Data/CIFAR-10-Variation2/'
file_name = 'analysis.txt'
folder_prefix = 'CIFAR-10_'
epochs = 100
def generate_dataframes():#layer_size
h0_totals, h1_totals, h2... | [
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.plot",
"pickle.load",
"matplotlib.pyplot.close",
"matplotlib.pyplot.legend"
] | [((1127, 1257), 'matplotlib.pyplot.plot', 'plt.plot', (['"""Epochs"""', '"""Betti 0"""'], {'data': 'total_count', 'marker': '"""o"""', 'markerfacecolor': '"""red"""', 'markersize': '(4)', 'color': '"""orange"""', 'linewidth': '(2)'}), "('Epochs', 'Betti 0', data=total_count, marker='o', markerfacecolor\n ='red', mar... |
import copy
import logging
from datetime import datetime
from http.client import IncompleteRead
from typing import Dict
import pika
from requests.exceptions import (ConnectionError as ReqConnectionError,
ReadTimeout, ChunkedEncodingError,
MissingSchema,... | [
"src.utils.exceptions.InvalidUrlException",
"src.utils.exceptions.NodeIsDownException",
"datetime.datetime.now",
"copy.deepcopy",
"pika.BasicProperties",
"src.utils.exceptions.DataReadingException",
"web3.Web3.HTTPProvider"
] | [((1463, 1548), 'web3.Web3.HTTPProvider', 'Web3.HTTPProvider', (['self.node_config.node_http_url'], {'request_kwargs': "{'timeout': 2}"}), "(self.node_config.node_http_url, request_kwargs={'timeout': 2}\n )\n", (1480, 1548), False, 'from web3 import Web3\n'), ((3548, 3567), 'copy.deepcopy', 'copy.deepcopy', (['data'... |
"""
Base Container Object
"""
# global
import re
import termcolor
import numpy as _np
import json as _json
import h5py as _h5py
import pickle as _pickle
import random as _random
from operator import lt as _lt
from operator import le as _le
from operator import eq as _eq
from operator import ne as _ne
from operator imp... | [
"numpy.prod",
"ivy.einops_rearrange",
"ivy.indices_where",
"ivy.einops_repeat",
"ivy.cast",
"ivy.Container.identical_structure",
"operator.not_",
"re.split",
"numpy.where",
"json.dumps",
"numpy.asarray",
"ivy.copy_array",
"ivy.wrapped_mode",
"random.randint",
"random.shuffle",
"numpy.o... | [((698, 712), 'json.dumps', '_json.dumps', (['x'], {}), '(x)\n', (709, 712), True, 'import json as _json\n'), ((4259, 4284), 'ivy.exists', '_ivy.exists', (['self._queues'], {}), '(self._queues)\n', (4270, 4284), True, 'import ivy as _ivy\n'), ((4827, 4863), 'ivy.default', '_ivy.default', (['keyword_color_dict', '{}'], ... |
import discord
from discord.ext import commands
import psycopg2
import config
import datetime as dt
class DB(commands.Cog):
def __init__(self, bot):
self.bot = bot
def dbConnect(self):
conn = psycopg2.connect(dbname=config.DB_NAME, user=config.DB_USER, password=config.DB_PASS, host=config... | [
"psycopg2.connect",
"datetime.date.today"
] | [((223, 334), 'psycopg2.connect', 'psycopg2.connect', ([], {'dbname': 'config.DB_NAME', 'user': 'config.DB_USER', 'password': 'config.DB_PASS', 'host': 'config.DB_ADDR'}), '(dbname=config.DB_NAME, user=config.DB_USER, password=\n config.DB_PASS, host=config.DB_ADDR)\n', (239, 334), False, 'import psycopg2\n'), ((131... |
import sys
import json
import string
import datetime
import os
output_file = open("mpd_dataset.txt", "w", encoding='raw_unicode_escape')
#uniquePlaylists = open("challenge_playlists_unique.txt", "w", encoding='raw_unicode_escape')
#uniqueTracks = open("challenge_tracks_unique.txt", "w", encoding='raw_unicode_e... | [
"os.sep.join",
"json.loads",
"os.listdir"
] | [((871, 887), 'os.listdir', 'os.listdir', (['path'], {}), '(path)\n', (881, 887), False, 'import os\n'), ((1030, 1059), 'os.sep.join', 'os.sep.join', (['(path, filename)'], {}), '((path, filename))\n', (1041, 1059), False, 'import os\n'), ((1163, 1177), 'json.loads', 'json.loads', (['js'], {}), '(js)\n', (1173, 1177), ... |
import sqlite3
from sqlite3 import Error
import sys
import CreateGamesDB
# ----- #
# ---- Database Interactions ---- #
# Creates connection to DB
def createConnection(db_file):
try:
conn = sqlite3.connect(db_file)
return conn
except Error as e:
print(e)
return None... | [
"CreateGamesDB.main",
"sqlite3.connect"
] | [((216, 240), 'sqlite3.connect', 'sqlite3.connect', (['db_file'], {}), '(db_file)\n', (231, 240), False, 'import sqlite3\n'), ((4870, 4890), 'CreateGamesDB.main', 'CreateGamesDB.main', ([], {}), '()\n', (4888, 4890), False, 'import CreateGamesDB\n')] |
# -*- coding: utf-8 -*-
# snapshottest: v1 - https://goo.gl/zC4yUc
from __future__ import unicode_literals
from snapshottest import Snapshot
snapshots = Snapshot()
snapshots['ErrorReportingTest::test_do_not_report_the_same_error_multiple_times 1'] = '''Missing environment variables:
export ERR_KEY_1=[your value her... | [
"snapshottest.Snapshot"
] | [((156, 166), 'snapshottest.Snapshot', 'Snapshot', ([], {}), '()\n', (164, 166), False, 'from snapshottest import Snapshot\n')] |
"""augpathlib
Do you like pathlib? Have you ever wanted to see just how far you can
push the path abstraction? Do you like using the division operator
in ways that could potentially cause reading from the network or writing to disk?
Then augpathlib is for you!
sparcur makes extensive use of the pathlib Path object (... | [
"itertools.chain",
"sparcur.exceptions.UnhandledTypeError",
"pyontutils.utils.sysidpath",
"psutil.Process",
"time.sleep",
"magic.detect_from_filename",
"sparcur.exceptions.NotInProjectError",
"pathlib.PurePosixPath",
"sparcur.exceptions.SizeError",
"sparcur.pathmeta.PathMeta",
"os.readlink",
"... | [((3172, 3183), 'functools.wraps', 'wraps', (['func'], {}), '(func)\n', (3177, 3183), False, 'from functools import wraps\n'), ((52713, 52724), 'functools.wraps', 'wraps', (['func'], {}), '(func)\n', (52718, 52724), False, 'from functools import wraps\n'), ((12343, 12369), 'pathlib.PurePosixPath', 'PurePosixPath', (['*... |
import os
import subprocess
import fileinput
import sys
from random import shuffle
import math
def transform_ajax(v):
for line in fileinput.input("ajax.obj", inplace=True):
if line.startswith('v '):
newLine = line.split()
x = float(newLine[1])
y = float(newLine[2])
... | [
"subprocess.run",
"fileinput.input",
"sys.stdout.write"
] | [((1047, 1085), 'subprocess.run', 'subprocess.run', (["['nori.exe', xml_file]"], {}), "(['nori.exe', xml_file])\n", (1061, 1085), False, 'import subprocess\n'), ((135, 176), 'fileinput.input', 'fileinput.input', (['"""ajax.obj"""'], {'inplace': '(True)'}), "('ajax.obj', inplace=True)\n", (150, 176), False, 'import file... |
from collections import namedtuple
from dagster import check
from dagster.core.definitions import (
IntermediateStorageDefinition,
ModeDefinition,
PipelineDefinition,
SystemStorageDefinition,
)
from dagster.core.instance import DagsterInstance
from dagster.core.storage.pipeline_run import PipelineRun
f... | [
"dagster.check.inst_param",
"collections.namedtuple",
"dagster.check.not_none_param",
"dagster.check.dict_param"
] | [((494, 687), 'collections.namedtuple', 'namedtuple', (['"""InitSystemStorageContext"""', '"""pipeline_def mode_def system_storage_def pipeline_run instance environment_config type_storage_plugin_registry resources system_storage_config"""'], {}), "('InitSystemStorageContext',\n 'pipeline_def mode_def system_storage... |
from html.parser import HTMLParser
from urllib import request
import os.path
import re
import json
import sys
class ImgListScraper( HTMLParser ):
IMG_URL = "http://i.imgur.com/{hash}{ext}"
def __init__( self, *args, **kwargs ):
super().__init__( *args, **kwargs )
self.in_javascript = False
... | [
"json.loads",
"urllib.request.urlopen"
] | [((1340, 1360), 'urllib.request.urlopen', 'request.urlopen', (['url'], {}), '(url)\n', (1355, 1360), False, 'from urllib import request\n'), ((1563, 1589), 'urllib.request.urlopen', 'request.urlopen', (['album_url'], {}), '(album_url)\n', (1578, 1589), False, 'from urllib import request\n'), ((925, 941), 'json.loads', ... |
import argparse
import dataclasses
from stests.generators.utils.args import get_argparser
@dataclasses.dataclass
class Arguments:
"""Custom generator arguments passed along chain of execution.
"""
# Controls number of accounts to be generated during the run.
accounts: int
# Motes per trans... | [
"stests.generators.utils.args.get_argparser"
] | [((835, 880), 'stests.generators.utils.args.get_argparser', 'get_argparser', (['f"""Native transfers generator."""'], {}), "(f'Native transfers generator.')\n", (848, 880), False, 'from stests.generators.utils.args import get_argparser\n')] |
from datetime import datetime
from urllib.parse import parse_qs
import asyncpg
from aiohttp import ClientSession
from fastapi import (APIRouter, Depends, HTTPException, Query, Request, status,
templating)
from jose import jwt
from config.common import config
from config.oauth import github_oauth_... | [
"config.oauth.stack_oauth_config.dict",
"fastapi.APIRouter",
"fastapi.Query",
"fastapi.Depends",
"config.oauth.github_oauth_config.dict"
] | [((436, 462), 'fastapi.APIRouter', 'APIRouter', ([], {'prefix': '"""/oauth"""'}), "(prefix='/oauth')\n", (445, 462), False, 'from fastapi import APIRouter, Depends, HTTPException, Query, Request, status, templating\n'), ((1156, 1166), 'fastapi.Query', 'Query', (['...'], {}), '(...)\n', (1161, 1166), False, 'from fastap... |
#
# Copyright (C) 2020 Google, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, dist... | [
"mako.template.Template",
"os.path.basename"
] | [((10844, 10867), 'os.path.basename', 'os.path.basename', (['hpath'], {}), '(hpath)\n', (10860, 10867), False, 'import os\n'), ((13339, 13362), 'os.path.basename', 'os.path.basename', (['hpath'], {}), '(hpath)\n', (13355, 13362), False, 'import os\n'), ((10485, 10508), 'os.path.basename', 'os.path.basename', (['cpath']... |
from django.shortcuts import render, get_object_or_404, redirect
from django.urls import reverse
from core.models import *
from datetime import date
from django.contrib.auth.decorators import login_required
from django.contrib import messages
import logging
logger = logging.getLogger(__name__)
from django.forms impo... | [
"logging.getLogger",
"django.shortcuts.render",
"django.forms.modelform_factory",
"django.urls.reverse",
"django.contrib.messages.error",
"django.shortcuts.get_object_or_404",
"django.shortcuts.redirect",
"django.contrib.messages.success",
"datetime.date.today"
] | [((269, 296), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (286, 296), False, 'import logging\n'), ((1816, 1873), 'django.shortcuts.render', 'render', (['request', '"""metabolism_manager/index.html"""', 'context'], {}), "(request, 'metabolism_manager/index.html', context)\n", (1822, 187... |