code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from sopel.module import commands, NOLIMIT
import datetime
@commands('countdown', 'comptearebours', 'cuentaatras')
def generic_countdown(bot, trigger):
text = trigger.group(2)
if not text:
if bot.config.lang == 'fr':
bot.reply(u"Utilisez le format correct: countdown 2018 12 19")
el... | [
"sopel.module.commands",
"datetime.datetime.today"
] | [((62, 116), 'sopel.module.commands', 'commands', (['"""countdown"""', '"""comptearebours"""', '"""cuentaatras"""'], {}), "('countdown', 'comptearebours', 'cuentaatras')\n", (70, 116), False, 'from sopel.module import commands, NOLIMIT\n'), ((774, 799), 'datetime.datetime.today', 'datetime.datetime.today', ([], {}), '(... |
from enum import IntEnum
import numpy as np
class Cell(IntEnum):
Empty = 0
O = -1 # player 2
X = 1 # player 1
class Result(IntEnum):
X_Wins = 1
O_Wins = -1
Draw = 0
Incomplete = 2
SIZE = 3
class Board(object):
"""docstring for Board"""
def __init__(self, cells=None):
... | [
"numpy.array",
"numpy.count_nonzero"
] | [((777, 805), 'numpy.count_nonzero', 'np.count_nonzero', (['self.cells'], {}), '(self.cells)\n', (793, 805), True, 'import numpy as np\n'), ((404, 438), 'numpy.array', 'np.array', (['([Cell.Empty] * SIZE ** 2)'], {}), '([Cell.Empty] * SIZE ** 2)\n', (412, 438), True, 'import numpy as np\n')] |
import unittest
import lxml.etree
from lxml import etree
from app.common import util
class ConversionToOSMObjectsTests(unittest.TestCase):
def test_creating_node(self):
point = util.InputPoint(tags={}, latitude=0.1, longitude=0.3)
nodes, ways, relations = util.convert_to_osm_style_objects([poin... | [
"unittest.main",
"app.common.util.InputPolygon",
"app.common.util.convert_to_osm_style_objects",
"app.common.util.InputLine",
"app.common.util.InputPoint",
"app.common.util.InputMultiPolygon"
] | [((12789, 12804), 'unittest.main', 'unittest.main', ([], {}), '()\n', (12802, 12804), False, 'import unittest\n'), ((194, 247), 'app.common.util.InputPoint', 'util.InputPoint', ([], {'tags': '{}', 'latitude': '(0.1)', 'longitude': '(0.3)'}), '(tags={}, latitude=0.1, longitude=0.3)\n', (209, 247), False, 'from app.commo... |
# This script will extract the important ride data from a .tcx
# file specified by the user. The code below will then extract
# the speed and power values at each time step. The data recording
# of the Garmin MUST be set to one data point per second, as the
# analysis assumes a time-step of 1 second.
import lxml.etree... | [
"lxml.etree.parse",
"os.path.realpath"
] | [((601, 618), 'lxml.etree.parse', 'ET.parse', (['pathStr'], {}), '(pathStr)\n', (609, 618), True, 'import lxml.etree as ET\n'), ((505, 528), 'os.path.realpath', 'path.realpath', (['fileName'], {}), '(fileName)\n', (518, 528), False, 'from os import path\n')] |
import argparse
def config_setting():
############################
# hyper parameters #
############################
cfg = argparse.ArgumentParser(description='PyTorch MNIST Capsnet Example')
cfg.add_argument('--m_plus', type=float, default=0.9, help='the parameter of m plus')
cfg.add_... | [
"argparse.ArgumentParser"
] | [((148, 216), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""PyTorch MNIST Capsnet Example"""'}), "(description='PyTorch MNIST Capsnet Example')\n", (171, 216), False, 'import argparse\n')] |
import numpy as np
from mayavi import mlab as mayalab
def plot_pc_with_normal(pcs,pcs_n,scale_factor=1.0):
mayalab.quiver3d(pcs[:, 0], pcs[:, 1], pcs[:, 2], pcs_n[:, 0], pcs_n[:, 1], pcs_n[:, 2], mode='arrow',scale_factor=1.0)
def plot_pc(pcs,color=None,scale_factor=.05,mode='point'):
if color == 'r':
mayalab... | [
"mayavi.mlab.quiver3d",
"numpy.copy",
"numpy.zeros",
"numpy.all",
"mayavi.mlab.points3d",
"numpy.hstack",
"numpy.any",
"numpy.ones",
"numpy.array",
"numpy.linalg.norm",
"numpy.eye",
"numpy.vstack"
] | [((110, 234), 'mayavi.mlab.quiver3d', 'mayalab.quiver3d', (['pcs[:, 0]', 'pcs[:, 1]', 'pcs[:, 2]', 'pcs_n[:, 0]', 'pcs_n[:, 1]', 'pcs_n[:, 2]'], {'mode': '"""arrow"""', 'scale_factor': '(1.0)'}), "(pcs[:, 0], pcs[:, 1], pcs[:, 2], pcs_n[:, 0], pcs_n[:, 1],\n pcs_n[:, 2], mode='arrow', scale_factor=1.0)\n", (126, 234... |
#
# Created on Fri Jan 07 2022
#
# The MIT License (MIT)
# Copyright (c) 2022 Maatuq
#
# 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 ri... | [
"functools.lru_cache"
] | [((1258, 1281), 'functools.lru_cache', 'lru_cache', ([], {'maxsize': 'None'}), '(maxsize=None)\n', (1267, 1281), False, 'from functools import lru_cache\n')] |
import os
from contextlib import contextmanager
__author__ = "<NAME>"
__version_info__ = ('0', '0', '8')
__version__ = '.'.join(__version_info__)
__module_name__ = 'hitpicking-utils-' + __version__
def char2num(val):
"""
Convert the given unicode character into an integer.
"""
if isinstance(val, int):... | [
"os.makedirs",
"os.getcwd",
"os.path.exists",
"sqlalchemy.create_engine",
"sqlalchemy.orm.sessionmaker",
"os.path.join",
"os.getenv"
] | [((1613, 1647), 'os.path.join', 'os.path.join', (['output_dir', 'filename'], {}), '(output_dir, filename)\n', (1625, 1647), False, 'import os\n'), ((3124, 3152), 'sqlalchemy.orm.sessionmaker', 'sessionmaker', ([], {'bind': 'db_engine'}), '(bind=db_engine)\n', (3136, 3152), False, 'from sqlalchemy.orm import sessionmake... |
import os
import numpy as np
def generate_synth_unit_sphere_dataset(N_data=20000,
rand_seed=38,
sampling_magnitude=50000.0,
noise_level=0.01,
dataset_save_path='u... | [
"numpy.random.uniform",
"numpy.save",
"numpy.random.seed",
"numpy.linalg.norm",
"numpy.random.normal"
] | [((429, 454), 'numpy.random.seed', 'np.random.seed', (['rand_seed'], {}), '(rand_seed)\n', (443, 454), True, 'import numpy as np\n'), ((524, 614), 'numpy.random.uniform', 'np.random.uniform', ([], {'low': '(-sampling_magnitude)', 'high': 'sampling_magnitude', 'size': '(N_data, 3)'}), '(low=-sampling_magnitude, high=sam... |
# -*- coding:utf-8 -*-
"""
Package for configuration of the reporter app.
:copyright: (c) 2013 by <NAME>
:license: GPLv3, see LICENSE for more details.
"""
import os
import re
# import default
# pylint: disable=W0401
from reporter.config.default import *
# pylint: enable=W0401
try:
user_settings = __import__(
... | [
"re.search"
] | [((566, 594), 're.search', 're.search', (['"""^[a-zA-Z]"""', 'attr'], {}), "('^[a-zA-Z]', attr)\n", (575, 594), False, 'import re\n')] |
import src.extractAllTestWords
import src.calcWordStats
import src.commonWordFilter
import src.accountForMisspell
import src.applyDelWordStatAndCount
import src.extractAllTestWordsSingleQuote
import src.calcWordStatsSingQuite
import src.commonWordFilterSingQuote
import os
import argparse
"""
This script takes the Kag... | [
"os.path.realpath",
"os.system",
"argparse.ArgumentParser"
] | [((3382, 3602), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': "('These are the arguments ' +\n 'for formating Kaggle competition Jigsaw Unintended Bias in ' +\n 'Toxicity Classification data before applying sentament anylysis ' +\n 'to data')"}), "(description='These are the argume... |
import terrascript
import terrascript.provider
import terrascript.resource
import tests.shared
def test_example_001():
config = terrascript.Terrascript()
config += terrascript.provider.aws(region="us-east-1", version="~> 2.0")
config += terrascript.resource.aws_vpc("example", cidr_block="10.0.0.0/16")
... | [
"terrascript.resource.aws_vpc",
"terrascript.provider.aws",
"terrascript.Terrascript"
] | [((135, 160), 'terrascript.Terrascript', 'terrascript.Terrascript', ([], {}), '()\n', (158, 160), False, 'import terrascript\n'), ((176, 238), 'terrascript.provider.aws', 'terrascript.provider.aws', ([], {'region': '"""us-east-1"""', 'version': '"""~> 2.0"""'}), "(region='us-east-1', version='~> 2.0')\n", (200, 238), F... |
# Counting summations
from itertools import count
def solve():
generalized = [1]
for n in count(1):
if generalized[-1] > 100:
break
generalized.append(n * (3 * n - 1) // 2)
generalized.append((-n) * (3 * (-n) - 1) // 2)
partitions = {0: 1}
for x in range(1, 100 + ... | [
"itertools.count"
] | [((101, 109), 'itertools.count', 'count', (['(1)'], {}), '(1)\n', (106, 109), False, 'from itertools import count\n')] |
"""Test suite for the pytest-doctest-custom plugin."""
import re, os, sys, platform, pytest, pytest_doctest_custom
pytest_plugins = "pytester" # Enables the testdir fixture
PYPY = platform.python_implementation() == "PyPy"
JYTHON = platform.python_implementation() == "Jython"
PY2 = sys.version_info[0] == 2
SPLIT_DOC... | [
"platform.python_implementation",
"pytest.mark.skipif",
"pytest.__version__.replace"
] | [((13445, 13511), 'pytest.mark.skipif', 'pytest.mark.skipif', (['JYTHON'], {'reason': '"""IPython doesn\'t run on Jython"""'}), '(JYTHON, reason="IPython doesn\'t run on Jython")\n', (13463, 13511), False, 'import re, os, sys, platform, pytest, pytest_doctest_custom\n'), ((22242, 22319), 'pytest.mark.skipif', 'pytest.m... |
"""Class for different items in the maze."""
import random as rd
import pygame as pg
from data import settings as st
class Item:
"""Each item have kind and position in the maze.\n
Position is random.\n
Each kind has a specific related image."""
def __init__(self, kind, locations):
self.locat... | [
"random.sample",
"pygame.image.load",
"pygame.transform.smoothscale"
] | [((388, 416), 'random.sample', 'rd.sample', (['self.locations', '(1)'], {}), '(self.locations, 1)\n', (397, 416), True, 'import random as rd\n'), ((618, 677), 'pygame.transform.smoothscale', 'pg.transform.smoothscale', (['image', '(st.TILESIZE, st.TILESIZE)'], {}), '(image, (st.TILESIZE, st.TILESIZE))\n', (642, 677), T... |
import os.path
import pytest
@pytest.fixture(scope="session")
def encoding_repo_path():
encoding_repo_dir = 'test_fixtures{}encoding_repo'.format(os.path.sep)
return encoding_repo_dir
@pytest.fixture(scope="session")
def general_repo_path():
general_repo_dir = 'test_fixtures{}general_repo'.format(os.pat... | [
"pytest.fixture"
] | [((32, 63), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (46, 63), False, 'import pytest\n'), ((197, 228), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (211, 228), False, 'import pytest\n'), ((358, 389), 'pytest.fixture', 'p... |
import os
import os.path as osp
import json
from collections import OrderedDict
import numpy as np
from sklearn.metrics import average_precision_score
from sklearn.metrics import confusion_matrix
import functools
import sklearn
__all__ = [
'compute_result_multilabel',
'compute_result',
]
def calibrated_ap(... | [
"numpy.stack",
"json.dump",
"numpy.sum",
"os.makedirs",
"numpy.copy",
"numpy.argmax",
"os.path.isdir",
"numpy.append",
"numpy.where",
"numpy.array",
"collections.OrderedDict",
"sklearn.metrics.confusion_matrix",
"os.path.join",
"numpy.concatenate"
] | [((359, 395), 'numpy.stack', 'np.stack', (['[label, predicted]'], {'axis': '(1)'}), '([label, predicted], axis=1)\n', (367, 395), True, 'import numpy as np\n'), ((1329, 1342), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (1340, 1342), False, 'from collections import OrderedDict\n'), ((1363, 1386), 'numpy... |
from setuptools import setup
# TODO move remaining things
setup(
install_requires=["base58~=2.1.0", "varint~=1.0.2"],
extras_require={"tests": ["pytest==6.2.5", "pytest-xdist==2.3.0"]},
)
| [
"setuptools.setup"
] | [((59, 190), 'setuptools.setup', 'setup', ([], {'install_requires': "['base58~=2.1.0', 'varint~=1.0.2']", 'extras_require': "{'tests': ['pytest==6.2.5', 'pytest-xdist==2.3.0']}"}), "(install_requires=['base58~=2.1.0', 'varint~=1.0.2'], extras_require={\n 'tests': ['pytest==6.2.5', 'pytest-xdist==2.3.0']})\n", (64, 1... |
#------------------------------------------------------------------------------
# Copyright (c) 2005, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# under the conditions describe... | [
"traits.api.Instance",
"traits.api.Int",
"traits.api.Unicode"
] | [((1130, 1136), 'traits.api.Int', 'Int', (['(1)'], {}), '(1)\n', (1133, 1136), False, 'from traits.api import Instance, Int, Interface, Unicode\n'), ((1174, 1192), 'traits.api.Unicode', 'Unicode', (['"""Default"""'], {}), "('Default')\n", (1181, 1192), False, 'from traits.api import Instance, Int, Interface, Unicode\n'... |
# Copyright (c) 2021, <NAME>.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | [
"dataclasses.dataclass",
"re.compile"
] | [((1024, 1046), 'dataclasses.dataclass', 'dataclass', ([], {'frozen': '(True)'}), '(frozen=True)\n', (1033, 1046), False, 'from dataclasses import dataclass\n'), ((1342, 1385), 're.compile', 're.compile', (['"""(?P<num>\\\\d+)(?P<code>[MNDI])"""'], {}), "('(?P<num>\\\\d+)(?P<code>[MNDI])')\n", (1352, 1385), False, 'imp... |
import json
import os
import pytest
here = os.path.abspath(os.path.dirname(__file__))
@pytest.fixture(scope="function")
def example_fragment(fake_session):
with open(os.path.join(here, "example_fragment.json"), "r") as f:
data = json.load(f)
return fake_session.Sample.load(data)
| [
"os.path.dirname",
"json.load",
"pytest.fixture",
"os.path.join"
] | [((91, 123), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""function"""'}), "(scope='function')\n", (105, 123), False, 'import pytest\n'), ((61, 86), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (76, 86), False, 'import os\n'), ((245, 257), 'json.load', 'json.load', (['f'], {}), '(f... |
from __future__ import unicode_literals
from django.contrib.auth.models import User
from django.db import models
class Media(models.Model):
name = models.TextField()
content_type = models.TextField(null=True)
size = models.BigIntegerField(null=True)
class Author(models.Model):
user = models.Foreign... | [
"django.db.models.TextField",
"django.db.models.ManyToManyField",
"django.db.models.BigIntegerField",
"django.db.models.ForeignKey",
"django.db.models.BooleanField",
"django.db.models.IntegerField",
"django.db.models.DecimalField",
"django.db.models.DateTimeField"
] | [((154, 172), 'django.db.models.TextField', 'models.TextField', ([], {}), '()\n', (170, 172), False, 'from django.db import models\n'), ((192, 219), 'django.db.models.TextField', 'models.TextField', ([], {'null': '(True)'}), '(null=True)\n', (208, 219), False, 'from django.db import models\n'), ((231, 264), 'django.db.... |
from subs2cia.sources import AVSFile
from subs2cia.Common import Common, interactive_picker
import subs2cia.subtools as subtools
from subs2cia.ffmpeg_tools import ffmpeg_trim_audio_clip_atrim_encode, ffmpeg_get_frame_fast, ffmpeg_trim_video_clip_directcopy
from typing import List, Union
from pathlib import Path
import... | [
"pandas.DataFrame",
"tqdm.tqdm",
"subs2cia.ffmpeg_tools.ffmpeg_trim_video_clip_directcopy",
"logging.warning",
"subs2cia.subtools.get_audiofile_duration",
"subs2cia.Common.interactive_picker",
"subs2cia.ffmpeg_tools.ffmpeg_trim_audio_clip_atrim_encode",
"subs2cia.ffmpeg_tools.ffmpeg_get_frame_fast",
... | [((3934, 3963), 'pandas.DataFrame', 'pd.DataFrame', ([], {'columns': 'columns'}), '(columns=columns)\n', (3946, 3963), True, 'import pandas as pd\n'), ((3985, 4015), 'tqdm.tqdm', 'tqdm.tqdm', (['self.subdata.groups'], {}), '(self.subdata.groups)\n', (3994, 4015), False, 'import tqdm\n'), ((2006, 2068), 'logging.warning... |
#!/usr/bin/env python3
import os
import sys
import re
import time
import pickle
from difflib import get_close_matches
from pprint import pprint
from typing import Any, Callable, IO, TypeVar
TOP_COUNT = 10
_PICKLE = 'blacklist.pickle'
_RET = TypeVar('_RET')
def timed(f: Callable[..., _RET]) -> Callable[..., _RET]:
... | [
"pickle.dump",
"difflib.get_close_matches",
"os.path.exists",
"time.time",
"re.findall",
"pickle.load",
"pprint.pprint",
"typing.TypeVar",
"sys.exit"
] | [((242, 257), 'typing.TypeVar', 'TypeVar', (['"""_RET"""'], {}), "('_RET')\n", (249, 257), False, 'from typing import Any, Callable, IO, TypeVar\n'), ((1135, 1158), 'os.path.exists', 'os.path.exists', (['_PICKLE'], {}), '(_PICKLE)\n', (1149, 1158), False, 'import os\n'), ((1385, 1423), 're.findall', 're.findall', (['""... |
import torchvision.transforms as transforms
import torch.nn as nn
import random
from .image_transforms import resize_4d_tensor_by_factor, resize_4d_tensor_by_size
imagenet_transform = transforms.Normalize(
mean=[0.485, 0.456, 0.406],
std= [0.229, 0.224, 0.225]
)
class random_resize(nn.Module):
def __ini... | [
"torchvision.transforms.functional.affine",
"torchvision.transforms.Normalize",
"torchvision.transforms.RandomAffine",
"random.uniform"
] | [((185, 260), 'torchvision.transforms.Normalize', 'transforms.Normalize', ([], {'mean': '[0.485, 0.456, 0.406]', 'std': '[0.229, 0.224, 0.225]'}), '(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])\n', (205, 260), True, 'import torchvision.transforms as transforms\n'), ((673, 735), 'random.uniform', 'random.unifo... |
from city_csv_parser.specific.seattle import SeattleCsvParser
from city_csv_parser.utils import write_points_to_geojson
import sys
GEO_JSON_POINT_SELECTION_TYPES = ['all', 'largest']
class SeattleWorkflow:
def __init__(self, csv_file, out_file):
self.out_file = out_file
self.parser = SeattleCsvPa... | [
"city_csv_parser.specific.seattle.SeattleCsvParser",
"sys.exit"
] | [((308, 334), 'city_csv_parser.specific.seattle.SeattleCsvParser', 'SeattleCsvParser', (['csv_file'], {}), '(csv_file)\n', (324, 334), False, 'from city_csv_parser.specific.seattle import SeattleCsvParser\n'), ((1043, 1054), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (1051, 1054), False, 'import sys\n')] |
import sys
import os
import glob
import numpy as np
import torch
import torch.optim as optim
from torch.optim import lr_scheduler
import math
from sklearn.metrics import f1_score, precision_score, recall_score, accuracy_score
from scipy.special import softmax
from Clf import *
from CBLoss import *
from FBeta_Loss impor... | [
"sys.stdout.write",
"os.mkdir",
"os.remove",
"torch.optim.lr_scheduler.StepLR",
"numpy.argmax",
"numpy.empty",
"torch.argmax",
"torch.randn",
"sys.stdout.flush",
"glob.glob",
"torch.no_grad",
"os.path.exists",
"torch.hub.load",
"math.isnan",
"numpy.save",
"efficientnet_pytorch.Efficien... | [((5759, 5796), 'sys.stdout.write', 'sys.stdout.write', (["('%s\\r' % string_out)"], {}), "('%s\\r' % string_out)\n", (5775, 5796), False, 'import sys\n'), ((5801, 5819), 'sys.stdout.flush', 'sys.stdout.flush', ([], {}), '()\n', (5817, 5819), False, 'import sys\n'), ((15583, 15650), 'torch.optim.lr_scheduler.StepLR', '... |
from PyQt5.QtCore import Qt, pyqtSignal
from PyQt5.QtGui import QIcon,QPalette,QFont, QColor
from PyQt5.QtWidgets import *
from scapy.all import *
class InterfaceBox(QWidget):
Signal_InterfSet = pyqtSignal(bool) # Whether Interface is chose
def __init__(self):
super().__init__()
self.Int... | [
"PyQt5.QtCore.pyqtSignal",
"PyQt5.QtGui.QFont"
] | [((202, 218), 'PyQt5.QtCore.pyqtSignal', 'pyqtSignal', (['bool'], {}), '(bool)\n', (212, 218), False, 'from PyQt5.QtCore import Qt, pyqtSignal\n'), ((1001, 1024), 'PyQt5.QtGui.QFont', 'QFont', (['"""Myriad Pro"""', '(12)'], {}), "('Myriad Pro', 12)\n", (1006, 1024), False, 'from PyQt5.QtGui import QIcon, QPalette, QFon... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
import argparse
import json
import os
import catalogue.utils
from config import config
from catalogue.bibtex import decode
def main(args):
entries = []
for entry in catalogue.utils.list_files([".json"]):
with o... | [
"os.mkdir",
"json.load",
"argparse.ArgumentParser",
"os.path.isdir",
"os.path.join",
"catalogue.bibtex.decode"
] | [((396, 444), 'os.path.join', 'os.path.join', (["config['catalogue_path']", '"""output"""'], {}), "(config['catalogue_path'], 'output')\n", (408, 444), False, 'import os\n'), ((659, 713), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'prog': '"""update_bibliography.py"""'}), "(prog='update_bibliography.py... |
from flask_wtf import FlaskForm
from wtforms import PasswordField
from wtforms import StringField
from wtforms import SubmitField
from wtforms.validators import DataRequired
from wtforms.validators import Email
from wtforms.validators import EqualTo
from wtforms.validators import Regexp
class SigninForm(FlaskForm):
... | [
"wtforms.validators.Email",
"wtforms.SubmitField",
"wtforms.validators.EqualTo",
"wtforms.validators.Regexp",
"wtforms.validators.DataRequired"
] | [((585, 607), 'wtforms.SubmitField', 'SubmitField', (['"""Sign In"""'], {}), "('Sign In')\n", (596, 607), False, 'from wtforms import SubmitField\n'), ((1565, 1604), 'wtforms.SubmitField', 'SubmitField', (['"""Create my openf1 account"""'], {}), "('Create my openf1 account')\n", (1576, 1604), False, 'from wtforms impor... |
import numpy as np
import scipy.cluster.vq as vq
import argparse
import matplotlib as mpl
mpl.use("qt4Agg")
import matplotlib.pyplot as plt
import thimbles as tmb
import json
import latbin
parser = argparse.ArgumentParser()
parser.add_argument("linelist")
parser.add_argument("--k-max", default=300, type=int)
parser... | [
"argparse.ArgumentParser",
"numpy.argmax",
"numpy.clip",
"numpy.unique",
"numpy.power",
"numpy.log10",
"thimbles.io.linelist_io.write_linelist",
"json.dump",
"matplotlib.pyplot.show",
"thimbles.io.linelist_io.read_linelist",
"matplotlib.use",
"latbin.ALattice",
"thimbles.transitions.lines_by... | [((92, 109), 'matplotlib.use', 'mpl.use', (['"""qt4Agg"""'], {}), "('qt4Agg')\n", (99, 109), True, 'import matplotlib as mpl\n'), ((202, 227), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (225, 227), False, 'import argparse\n'), ((985, 1032), 'thimbles.io.linelist_io.read_linelist', 'tmb.io.l... |
import unittest
import warnings
import numpy as np
import numpy.testing as npt
from squidward import utils
from squidward.utils import deprecated
# useful for debugging
np.set_printoptions(suppress=True)
class UtilitiesTestCase(unittest.TestCase):
"""Class for utilities tests."""
# ------------------------... | [
"unittest.main",
"squidward.utils.exactly_2d",
"numpy.set_printoptions",
"squidward.utils.is_invertible",
"squidward.utils.onehot",
"squidward.utils.softmax",
"warnings.simplefilter",
"squidward.utils.Invert",
"numpy.testing.assert_almost_equal",
"numpy.ones",
"squidward.utils.sigmoid",
"numpy... | [((171, 205), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'suppress': '(True)'}), '(suppress=True)\n', (190, 205), True, 'import numpy as np\n'), ((12808, 12823), 'unittest.main', 'unittest.main', ([], {}), '()\n', (12821, 12823), False, 'import unittest\n'), ((693, 704), 'numpy.ones', 'np.ones', (['(10)'], ... |
from sklearn.neighbors import KNeighborsClassifier
X = [[0], [1], [2], [3], [4], [5], [6], [7], [8]]
y = [0, 0, 0, 1, 1, 1, 2, 2, 2]
neigh = KNeighborsClassifier(n_neighbors=3)
neigh.fit(X, y)
print(neigh.predict([[1.1]]))
print(neigh.predict([[1.6]]))
print(neigh.predict([[5.2]]))
print(neigh.predict([[5... | [
"sklearn.neighbors.KNeighborsClassifier"
] | [((148, 183), 'sklearn.neighbors.KNeighborsClassifier', 'KNeighborsClassifier', ([], {'n_neighbors': '(3)'}), '(n_neighbors=3)\n', (168, 183), False, 'from sklearn.neighbors import KNeighborsClassifier\n')] |
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from cmsplugins.baseplugin import defaults
GALLERY_CSS_CLASSES = getattr(
settings,
'PICTURES_GALLERY_CSS_CLASSES',
defaults.CSS_CLASSES
)
GALLERY_HEIGHTS = getattr(
settings,
'PICTURES_GALLERY_HEIGHTS',
... | [
"django.utils.translation.ugettext_lazy"
] | [((526, 538), 'django.utils.translation.ugettext_lazy', '_', (['"""content"""'], {}), "('content')\n", (527, 538), True, 'from django.utils.translation import ugettext_lazy as _\n'), ((669, 682), 'django.utils.translation.ugettext_lazy', '_', (['"""settings"""'], {}), "('settings')\n", (670, 682), True, 'from django.ut... |
from django.db import models
from user.models import User
class AbstractNameDescriptionModel(models.Model):
"""
Абстрактная модель Наименования и Описания сущности
"""
name = models.CharField('Наименование', max_length=1000)
description = models.TextField('Описание')
class Meta:
abs... | [
"django.db.models.TextField",
"django.db.models.URLField",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.DateTimeField"
] | [((195, 244), 'django.db.models.CharField', 'models.CharField', (['"""Наименование"""'], {'max_length': '(1000)'}), "('Наименование', max_length=1000)\n", (211, 244), False, 'from django.db import models\n'), ((263, 291), 'django.db.models.TextField', 'models.TextField', (['"""Описание"""'], {}), "('Описание')\n", (279... |
from __future__ import print_function, absolute_import
from reid.eug import *
from reid import datasets
from reid import models
import numpy as np
import torch
import argparse
import os
from reid.utils.logging import Logger
import os.path as osp
import sys
from torch.backends import cudnn
from reid.utils.serialization... | [
"matplotlib.pyplot.title",
"os.path.abspath",
"argparse.ArgumentParser",
"matplotlib.pyplot.plot",
"os.path.join",
"math.floor",
"time.strftime",
"matplotlib.pyplot.ion",
"reid.datasets.names",
"reid.models.names",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.pa... | [((484, 516), 're.compile', 're.compile', (['"""step_(\\\\d+)\\\\.ckpt"""'], {}), "('step_(\\\\d+)\\\\.ckpt')\n", (494, 516), False, 'import re\n'), ((590, 615), 'os.listdir', 'os.listdir', (['args.logs_dir'], {}), '(args.logs_dir)\n', (600, 615), False, 'import os\n'), ((6394, 6462), 'argparse.ArgumentParser', 'argpar... |
import subprocess
import sys
def check_translations(
root_path,
package_name,
locales=frozenset(['es']),
ignored_strings=frozenset(),
):
# extract messages through to catalogs
setup_py = str(root_path / 'setup.py')
subprocess.run(['python', setup_py, 'extract_messages'])
subprocess.run... | [
"subprocess.run",
"babel.messages.pofile.read_po",
"sys.exit"
] | [((245, 301), 'subprocess.run', 'subprocess.run', (["['python', setup_py, 'extract_messages']"], {}), "(['python', setup_py, 'extract_messages'])\n", (259, 301), False, 'import subprocess\n'), ((306, 383), 'subprocess.run', 'subprocess.run', (["['python', setup_py, 'update_catalog', '--no-fuzzy-matching']"], {}), "(['p... |
#!/usr/bin/env python
import sys
import time
from struct import unpack
from Crypto.Cipher import AES
MOD2HEX = dict(
(ord(c1),ord(c2)) for (c1,c2) in
zip('cbdefghijklnrtuv', '0123456789abcdef') )
def modhex(s):
s = s.translate(MOD2HEX)
return bytes.fromhex(s)
def getcrc(data):
v = 0xffff
for b... | [
"struct.unpack",
"Crypto.Cipher.AES.new"
] | [((773, 799), 'Crypto.Cipher.AES.new', 'AES.new', (['key', 'AES.MODE_ECB'], {}), '(key, AES.MODE_ECB)\n', (780, 799), False, 'from Crypto.Cipher import AES\n'), ((933, 960), 'struct.unpack', 'unpack', (['"""<HHBB4x"""', 'code[6:]'], {}), "('<HHBB4x', code[6:])\n", (939, 960), False, 'from struct import unpack\n')] |
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import itertools
from torch.testing._internal.common_utils import TestCase, run_tests, is_iterable_of_tensors
im... | [
"common_utils.get_exhaustive_batched_inputs",
"torch.is_floating_point",
"torch.autograd.grad",
"torch.randn",
"functorch.jacrev",
"torch.full",
"functorch.jacfwd",
"torch.utils._pytree.tree_unflatten",
"torch.testing._internal.common_device_type.tol",
"torch.testing._internal.common_device_type.o... | [((1390, 1410), 'torch.utils._pytree.tree_flatten', 'tree_flatten', (['inputs'], {}), '(inputs)\n', (1402, 1410), False, 'from torch.utils._pytree import tree_flatten, tree_unflatten, tree_map\n'), ((2090, 2223), 'torch.autograd.grad', 'torch.autograd.grad', (['diff_outputs', 'inputs', 'grad_outputs'], {'retain_graph':... |
import torch
def yolo_grid(input_shape: torch.Tensor, cell_map_shape: torch.Tensor) -> torch.Tensor:
"""Constructs a 2D grid with the cell center coordinates.
:param input_shape: 2D size of the image (width, height).
:param cell_map_shape: number of cells in grid in each input dimension.
"""
asse... | [
"torch.stack",
"torch.arange"
] | [((911, 945), 'torch.stack', 'torch.stack', (['cell_top_left'], {'dim': '(-1)'}), '(cell_top_left, dim=-1)\n', (922, 945), False, 'import torch\n'), ((710, 802), 'torch.arange', 'torch.arange', (['(0)'], {'end': '(num_cells[0] - 0.001)', 'step': 'cell_shape[0]', 'device': 'cell_shape.device'}), '(0, end=num_cells[0] - ... |
# -*- coding: utf-8 -*-
"""
Compares two bottom detections.
Copyright (c) 2021, Contributors to the CRIMAC project.
Licensed under the MIT license.
"""
import numpy as np
import pandas as pd
import pyarrow as pa
import pyarrow.parquet as pq
import xarray as xr
def compare(zarr_file: str,
a_bottom_parque... | [
"numpy.isnan",
"pyarrow.Table.from_pandas",
"pandas.read_parquet",
"xarray.open_zarr",
"xarray.apply_ufunc",
"pyarrow.parquet.ParquetWriter"
] | [((783, 874), 'xarray.open_zarr', 'xr.open_zarr', (['zarr_file'], {'chunks': "{'frequency': 'auto', 'ping_time': 'auto', 'range': -1}"}), "(zarr_file, chunks={'frequency': 'auto', 'ping_time': 'auto',\n 'range': -1})\n", (795, 874), True, 'import xarray as xr\n'), ((1904, 2102), 'xarray.apply_ufunc', 'xr.apply_ufunc... |
import argparse
from models.ensemble import Ensemble
from models.pruned_ensemble import PrunedEnsemble
from models.multi_class_ensemble import MultiClassEnsemble
from models.crazy import Crazy
from models.crazy_combined import CrazyCombined
from models.crazy_combined_assisted import CrazyCombinedAssist
from models.fina... | [
"models.crazy_combined_assisted.CrazyCombinedAssist",
"models.final_divided.Full_D",
"models.final.Full",
"argparse.ArgumentParser",
"models.crazy.Crazy",
"models.ensemble.Ensemble",
"models.crazy_combined.CrazyCombined",
"models.pruned_ensemble.PrunedEnsemble",
"models.multi_class_ensemble.MultiCla... | [((383, 408), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (406, 408), False, 'import argparse\n'), ((1450, 1464), 'models.ensemble.Ensemble', 'Ensemble', (['args'], {}), '(args)\n', (1458, 1464), False, 'from models.ensemble import Ensemble\n'), ((1516, 1536), 'models.pruned_ensemble.PrunedE... |
from pathlib import Path
import cv2
import numpy as np
import os
from isegm.data.base import ISDataset
from isegm.data.sample import DSample
class COCOMValDataset(ISDataset):
def __init__(self, dataset_path,
images_dir_name='img', masks_dir_name='gt',
init_mask_mode = None, **kw... | [
"cv2.cvtColor",
"cv2.imread",
"isegm.data.sample.DSample",
"os.listdir"
] | [((576, 597), 'os.listdir', 'os.listdir', (['image_dir'], {}), '(image_dir)\n', (586, 597), False, 'import os\n'), ((1095, 1117), 'cv2.imread', 'cv2.imread', (['image_path'], {}), '(image_path)\n', (1105, 1117), False, 'import cv2\n'), ((1134, 1172), 'cv2.cvtColor', 'cv2.cvtColor', (['image', 'cv2.COLOR_BGR2RGB'], {}),... |
# -*- coding: utf-8 -*-
from contextlib import ContextDecorator
import socket
from mock import patch
class patch_gethostbyname_ex(ContextDecorator):
"""Intercepts the call to socket.gethostbyname_ex to customize the DNS resolution.
Custom DNS resolutions are describe by a dictionnary where the keys are hos... | [
"mock.patch"
] | [((1729, 1761), 'mock.patch', 'patch', (['"""socket.gethostbyname_ex"""'], {}), "('socket.gethostbyname_ex')\n", (1734, 1761), False, 'from mock import patch\n')] |
import asyncio
import aiohttp
from band import expose, response, logger, crontab, blocking
import requests
import time
@expose.handler()
async def test1(**params):
return None
@crontab('*/1 * * * *')
@blocking()
def my_blocking_code():
print('starting background task in custom process')
time.sleep(10)
... | [
"band.blocking",
"band.expose.handler",
"asyncio.sleep",
"band.response.data",
"band.response.pixel",
"time.sleep",
"band.response.redirect",
"aiohttp.ClientSession",
"band.logger.error",
"band.crontab",
"requests.get",
"band.expose",
"band.response.error"
] | [((121, 137), 'band.expose.handler', 'expose.handler', ([], {}), '()\n', (135, 137), False, 'from band import expose, response, logger, crontab, blocking\n'), ((184, 206), 'band.crontab', 'crontab', (['"""*/1 * * * *"""'], {}), "('*/1 * * * *')\n", (191, 206), False, 'from band import expose, response, logger, crontab,... |
import logging
from src.backup.scheduler.task_creator import TaskCreator
from src.commons.big_query.big_query import BigQuery
from src.commons.tasks import Tasks
class ProjectBackupScheduler(object):
def __init__(self):
self.big_query = BigQuery()
def schedule_backup(self, project_id, page_token=No... | [
"src.backup.scheduler.task_creator.TaskCreator.create_dataset_backup_scheduler_task",
"src.commons.tasks.Tasks.schedule",
"logging.info",
"src.commons.big_query.big_query.BigQuery",
"src.backup.scheduler.task_creator.TaskCreator.create_project_backup_scheduler_task"
] | [((253, 263), 'src.commons.big_query.big_query.BigQuery', 'BigQuery', ([], {}), '()\n', (261, 263), False, 'from src.commons.big_query.big_query import BigQuery\n'), ((1558, 1599), 'src.commons.tasks.Tasks.schedule', 'Tasks.schedule', (['"""backup-scheduler"""', 'tasks'], {}), "('backup-scheduler', tasks)\n", (1572, 15... |
# Copyright 2022 Quantapix Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | [
"datasets.load_dataset",
"faiss.IndexHNSWFlat",
"faiss.read_index",
"os.path.isdir",
"numpy.hstack",
"time.time",
"pickle.load",
"datasets.load_from_disk",
"numpy.array",
"os.path.join"
] | [((2300, 2334), 'os.path.join', 'os.path.join', (['index_path', 'filename'], {}), '(index_path, filename)\n', (2312, 2334), False, 'import os\n'), ((3670, 3707), 'faiss.read_index', 'faiss.read_index', (['resolved_index_path'], {}), '(resolved_index_path)\n', (3686, 3707), False, 'import faiss\n'), ((4227, 4273), 'fais... |
from sqlalchemy import Column, Integer, String, Boolean
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship, sessionmaker
from sqlalchemy import create_engine
Base = declarative_base()
class knowledge(Base):
# Create a table with 4 columns
# The first column will be... | [
"sqlalchemy.ext.declarative.declarative_base",
"sqlalchemy.Column"
] | [((211, 229), 'sqlalchemy.ext.declarative.declarative_base', 'declarative_base', ([], {}), '()\n', (227, 229), False, 'from sqlalchemy.ext.declarative import declarative_base\n'), ((723, 756), 'sqlalchemy.Column', 'Column', (['Integer'], {'primary_key': '(True)'}), '(Integer, primary_key=True)\n', (729, 756), False, 'f... |
import pytest
from ingenialink.canopen.network import CanopenNetwork, CAN_DEVICE, CAN_BAUDRATE
@pytest.mark.canopen
def test_scan_slaves(read_config):
net = CanopenNetwork(device=CAN_DEVICE(read_config['canopen']['device']),
channel=read_config['canopen']['channel'],
... | [
"ingenialink.canopen.network.CAN_DEVICE",
"ingenialink.canopen.network.CAN_BAUDRATE"
] | [((186, 230), 'ingenialink.canopen.network.CAN_DEVICE', 'CAN_DEVICE', (["read_config['canopen']['device']"], {}), "(read_config['canopen']['device'])\n", (196, 230), False, 'from ingenialink.canopen.network import CanopenNetwork, CAN_DEVICE, CAN_BAUDRATE\n'), ((334, 382), 'ingenialink.canopen.network.CAN_BAUDRATE', 'CA... |
import sys
import os, os.path
import subprocess
import numpy
if __name__ == "__main__":
formula = sys.argv[1]
kind = sys.argv[2]
program = "bsub"
params = ["-n", "4", "-W", "04:00", "-R", "\"rusage[mem=4096]\""]
run_string = "\"mpirun -n 4 gpaw-python run_doping.py {0} {1} {2:.2f}\""
for fermi_... | [
"numpy.linspace"
] | [((329, 358), 'numpy.linspace', 'numpy.linspace', (['(-1.0)', '(1.0)', '(41)'], {}), '(-1.0, 1.0, 41)\n', (343, 358), False, 'import numpy\n'), ((585, 614), 'numpy.linspace', 'numpy.linspace', (['(-1.0)', '(1.0)', '(41)'], {}), '(-1.0, 1.0, 41)\n', (599, 614), False, 'import numpy\n')] |
from factories.factories import LoveFactory, PostFactory
def create_post_objects(user, num_posts):
"""Creates post objects
Args:
user -- the author of the posts
num_posts -- number of posts to create
Returns:
list of posts
"""
posts = []
for post in xrange(num_posts):
... | [
"factories.factories.PostFactory",
"factories.factories.LoveFactory"
] | [((341, 365), 'factories.factories.PostFactory', 'PostFactory', ([], {'author': 'user'}), '(author=user)\n', (352, 365), False, 'from factories.factories import LoveFactory, PostFactory\n'), ((690, 722), 'factories.factories.LoveFactory', 'LoveFactory', ([], {'fan': 'user', 'post': 'post'}), '(fan=user, post=post)\n', ... |
import numpy as np
import utils
from torch import nn
import torch
import torch.nn.functional as F
from metrics import AllInOneMeter
import time
import torchvision.transforms as transforms
def validation_binary(model: nn.Module, criterion, valid_loader, device, device_id, num_classes=None):
with torch.no_grad():
... | [
"numpy.histogramdd",
"torch.nn.functional.binary_cross_entropy_with_logits",
"time.time",
"torch.cuda.is_available",
"torch.nn.functional.sigmoid",
"metrics.AllInOneMeter",
"torchvision.transforms.Normalize",
"torch.no_grad"
] | [((2637, 2741), 'numpy.histogramdd', 'np.histogramdd', (['replace_indices'], {'bins': '(nr_labels, nr_labels)', 'range': '[(0, nr_labels), (0, nr_labels)]'}), '(replace_indices, bins=(nr_labels, nr_labels), range=[(0,\n nr_labels), (0, nr_labels)])\n', (2651, 2741), True, 'import numpy as np\n'), ((303, 318), 'torch... |
import os
import click
from wipeit import CONFIG
from wipeit.app import AppClient
@click.command()
def logout(*args, **kwargs):
"""Remove Reddit credentials from wipeit, you will be prompted to login the next time the program is run."""
file_loc = AppClient(CONFIG.scopes, skip_login=True).refresh_token_file... | [
"os.remove",
"click.echo",
"click.command",
"os.path.isfile",
"wipeit.app.AppClient"
] | [((87, 102), 'click.command', 'click.command', ([], {}), '()\n', (100, 102), False, 'import click\n'), ((332, 356), 'os.path.isfile', 'os.path.isfile', (['file_loc'], {}), '(file_loc)\n', (346, 356), False, 'import os\n'), ((390, 428), 'click.echo', 'click.echo', (['"""Successfully logged out."""'], {}), "('Successfull... |
from snakeoil import currying
from snakeoil import dependant_methods as dm
def func(self, seq, data, val=True):
seq.append(data)
return val
class TestDependantMethods:
@staticmethod
def generate_instance(methods, dependencies):
class Class(metaclass=dm.ForcedDepends):
stage_depe... | [
"snakeoil.currying.post_curry"
] | [((1981, 2020), 'snakeoil.currying.post_curry', 'currying.post_curry', (['func', 'results', '"""a"""'], {}), "(func, results, 'a')\n", (2000, 2020), False, 'from snakeoil import currying\n'), ((1811, 1848), 'snakeoil.currying.post_curry', 'currying.post_curry', (['func', 'results', 'x'], {}), '(func, results, x)\n', (1... |
import numpy
from .base import Algorithm, Model
from collections import OrderedDict
class LinearRegression(Algorithm):
def __init__(self, features=[], label='label', prediction='prediction', fit_intercept=True):
super().__init__(features=features, label=label, prediction=prediction, fit_intercept=fit_int... | [
"numpy.dot",
"numpy.transpose",
"numpy.insert"
] | [((453, 471), 'numpy.transpose', 'numpy.transpose', (['X'], {}), '(X)\n', (468, 471), False, 'import numpy\n'), ((1061, 1085), 'numpy.dot', 'numpy.dot', (['X', 'self._coef'], {}), '(X, self._coef)\n', (1070, 1085), False, 'import numpy\n'), ((409, 438), 'numpy.insert', 'numpy.insert', (['X', '(0)', '(1)'], {'axis': '(1... |
"""For launch setup function."""
from setuptools import setup # type: ignore
setup()
| [
"setuptools.setup"
] | [((82, 89), 'setuptools.setup', 'setup', ([], {}), '()\n', (87, 89), False, 'from setuptools import setup\n')] |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'C:\Users\Administrator\Documents\DEV\PyQt_To_Maya-2016-2017\ui\SimpleUI.ui'
#
# Created: Tue Sep 06 09:54:58 2016
# by: pyside2-uic running on PySide2 2.0.0~alpha0
#
# WARNING! All changes made in this file will be lost!
from PySide2 ... | [
"PySide2.QtWidgets.QApplication.translate",
"PySide2.QtWidgets.QDialog",
"PySide2.QtCore.QMetaObject.connectSlotsByName",
"PySide2.QtWidgets.QApplication"
] | [((759, 791), 'PySide2.QtWidgets.QApplication', 'QtWidgets.QApplication', (['sys.argv'], {}), '(sys.argv)\n', (781, 791), False, 'from PySide2 import QtCore, QtGui, QtWidgets\n'), ((805, 824), 'PySide2.QtWidgets.QDialog', 'QtWidgets.QDialog', ([], {}), '()\n', (822, 824), False, 'from PySide2 import QtCore, QtGui, QtWi... |
from django.contrib import admin
from group.models import Group, Application
@admin.register(Group)
class GroupAdmin(admin.ModelAdmin):
search_fields = ('name',)
readonly_fields = ('users',)
fieldsets = (
(None, {
'fields': ('name', 'admin', 'users'),
}),
('Rules', {
... | [
"django.contrib.admin.register",
"django.contrib.admin.site.register"
] | [((81, 102), 'django.contrib.admin.register', 'admin.register', (['Group'], {}), '(Group)\n', (95, 102), False, 'from django.contrib import admin\n'), ((729, 761), 'django.contrib.admin.site.register', 'admin.site.register', (['Application'], {}), '(Application)\n', (748, 761), False, 'from django.contrib import admin\... |
# -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2020: TelelBirds
#
#
#########################################################################
from __future__ import unicode_literals
import os
import datetime
from django.core.validators import MaxValu... | [
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.contrib.gis.db.models.PointField",
"django.db.models.FloatField",
"django.db.models.BooleanField",
"django.db.models.EmailField",
"django.db.models.AutoField",
"django.db.models.IntegerField",
"imagekit.processors.ResizeToFit",
"... | [((891, 925), 'django.db.models.AutoField', 'models.AutoField', ([], {'primary_key': '(True)'}), '(primary_key=True)\n', (907, 925), False, 'from django.db import models\n'), ((935, 989), 'django.db.models.CharField', 'models.CharField', ([], {'null': '(True)', 'blank': '(True)', 'max_length': '(50)'}), '(null=True, bl... |
"""
module documentation
"""
import numpy as np
import imageio
import tensorflow as tf
import requests # für http
from . import checkpoint
from . import layer
from . import graph
from .ops import * # das müsste ok sein, weil operations sehr spezielle namen haben und sich da nichts in die quere kommt
from . import m... | [
"skimage.measure.block_reduce",
"matplotlib.pyplot.imshow",
"numpy.transpose",
"tensorflow.cast",
"numpy.reshape",
"requests.get",
"tensorflow.io.read_file",
"matplotlib.pyplot.subplots",
"numpy.dstack",
"numpy.stack",
"matplotlib.image.imread",
"matplotlib.pyplot.show",
"math.sqrt",
"tens... | [((1641, 1705), 'matplotlib.image.imread', 'mpimg.imread', (["('/content/drive/My Drive/colab/images/' + filename)"], {}), "('/content/drive/My Drive/colab/images/' + filename)\n", (1653, 1705), True, 'import matplotlib.image as mpimg\n'), ((1864, 1892), 'tensorflow.io.read_file', 'tf.io.read_file', (['path_to_img'], {... |
""" This script is used by the run-aplus-front container,
which is used for local testing of the A+ course.
This script modifies the course database with some course-specific settings.
It may be mounted into the container in docker-compose.yml.
(If not mounted, this script does not do anything.)
"""
import os
import s... | [
"exercise.exercise_models.BaseExercise.objects.get",
"django.setup",
"course.models.Course.objects.get_or_create",
"random.choices",
"course.models.StudentGroup",
"random.randint",
"django.contrib.auth.models.User.objects.get",
"course.models.Course.objects.get",
"django.utils.timezone.now",
"cour... | [((694, 723), 'course.models.Course.objects.get', 'Course.objects.get', ([], {'url': '"""def"""'}), "(url='def')\n", (712, 723), False, 'from course.models import Course, CourseInstance, Enrollment, StudentGroup\n'), ((755, 811), 'course.models.CourseInstance.objects.get', 'CourseInstance.objects.get', ([], {'course': ... |
# Generated by Django 3.2.9 on 2021-11-18 02:30
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('utils', '0004_objecttype'),
]
operations = [
migrations.AlterModelOptions(
name='objecttype',
options={'ordering': ['name']}... | [
"django.db.migrations.AlterModelOptions"
] | [((217, 296), 'django.db.migrations.AlterModelOptions', 'migrations.AlterModelOptions', ([], {'name': '"""objecttype"""', 'options': "{'ordering': ['name']}"}), "(name='objecttype', options={'ordering': ['name']})\n", (245, 296), False, 'from django.db import migrations\n')] |
import json
from src.exceptions.usi_exceptions import BadConsumerConfigException
SER_DES_OPTIONS = {
'STRING_SER': lambda k: k.encode('utf-8') if k is not None else k,
'JSON_SER': lambda v: json.dumps(v).encode('utf-8') if v is not None else v,
'STRING_DES': lambda k: k.decode('utf-8') if k is not None el... | [
"src.exceptions.usi_exceptions.BadConsumerConfigException",
"json.loads",
"json.dumps"
] | [((510, 595), 'src.exceptions.usi_exceptions.BadConsumerConfigException', 'BadConsumerConfigException', (['f"""No Serializer/Deserializer found with name {name}"""'], {}), "(f'No Serializer/Deserializer found with name {name}'\n )\n", (536, 595), False, 'from src.exceptions.usi_exceptions import BadConsumerConfigExc... |
from selenium import webdriver
from selenium.webdriver.common.by import By
from faker import Faker
import glob
import os
import time
import sys
URL = "http://localhost/timeline-app/"
images = glob.glob("images/*.jpg")
if sys.argv[1].strip() != "":
TEST_FOR = len(images)
else:
TEST_FOR = int(sys.argv[1].str... | [
"faker.Faker",
"os.getcwd",
"time.sleep",
"selenium.webdriver.Chrome",
"glob.glob"
] | [((196, 221), 'glob.glob', 'glob.glob', (['"""images/*.jpg"""'], {}), "('images/*.jpg')\n", (205, 221), False, 'import glob\n'), ((384, 402), 'selenium.webdriver.Chrome', 'webdriver.Chrome', ([], {}), '()\n', (400, 402), False, 'from selenium import webdriver\n'), ((565, 572), 'faker.Faker', 'Faker', ([], {}), '()\n', ... |
import sys
currDir = sys.path[0]
import os
def removeFile(dir,postfix):
if os.path.isdir(dir):
for file in os.listdir(dir):
removeFile(dir+'/'+file,postfix)
else:
if os.path.splitext(dir)[1] == postfix:
os.remove(dir)
removeFile(currDir,'.bin')
removeFile(currDir,'.upd')... | [
"os.path.isdir",
"os.path.splitext",
"os.remove",
"os.listdir"
] | [((80, 98), 'os.path.isdir', 'os.path.isdir', (['dir'], {}), '(dir)\n', (93, 98), False, 'import os\n'), ((120, 135), 'os.listdir', 'os.listdir', (['dir'], {}), '(dir)\n', (130, 135), False, 'import os\n'), ((252, 266), 'os.remove', 'os.remove', (['dir'], {}), '(dir)\n', (261, 266), False, 'import os\n'), ((203, 224), ... |
import numpy as np
import pandas as pd
import mechbayes.util as util
import mechbayes.jhu as jhu
from pathlib import Path
import warnings
'''Submission'''
def create_submission_file(prefix, forecast_date, model, data, places, submit_args):
print(f"Creating submission file in {prefix}")
samples_directory ... | [
"pandas.DataFrame",
"mechbayes.util.resample_to_weekly",
"pandas.read_csv",
"numpy.percentile",
"pathlib.Path",
"pandas.to_datetime",
"mechbayes.util.load_samples",
"pandas.Timedelta",
"warnings.warn",
"mechbayes.util.construct_daily_df",
"mechbayes.jhu.get_county_info"
] | [((638, 652), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (650, 652), True, 'import pandas as pd\n'), ((674, 703), 'pandas.to_datetime', 'pd.to_datetime', (['forecast_date'], {}), '(forecast_date)\n', (688, 703), True, 'import pandas as pd\n'), ((2285, 2329), 'pandas.read_csv', 'pd.read_csv', (['f"""{resource... |
# Flash ALL built in LED random colours
# random interval 0 - 0.5 seconds between each set colours
import time
import board
from random import randint, uniform
import neopixel
np = neopixel.NeoPixel(board.NEOPIXEL, 10, brightness=.02)
while True:
for Loop in range(10):
np[Loop] = (randint(0, 255), randint(0... | [
"neopixel.NeoPixel",
"random.randint",
"random.uniform"
] | [((181, 235), 'neopixel.NeoPixel', 'neopixel.NeoPixel', (['board.NEOPIXEL', '(10)'], {'brightness': '(0.02)'}), '(board.NEOPIXEL, 10, brightness=0.02)\n', (198, 235), False, 'import neopixel\n'), ((374, 389), 'random.uniform', 'uniform', (['(0)', '(0.5)'], {}), '(0, 0.5)\n', (381, 389), False, 'from random import randi... |
from permuta import Perm
from permuta.bisc.bisc_subfunctions import maximal_mesh_pattern_of_occurrence
def test_maximal_mesh_pattern_of_occurrence():
assert maximal_mesh_pattern_of_occurrence(Perm((0,)), (0,)) == set(
[(0, 0), (0, 1), (1, 0), (1, 1)]
)
assert maximal_mesh_pattern_of_occurrence(Per... | [
"permuta.Perm"
] | [((198, 208), 'permuta.Perm', 'Perm', (['(0,)'], {}), '((0,))\n', (202, 208), False, 'from permuta import Perm\n'), ((317, 329), 'permuta.Perm', 'Perm', (['(0, 1)'], {}), '((0, 1))\n', (321, 329), False, 'from permuta import Perm\n'), ((430, 442), 'permuta.Perm', 'Perm', (['(0, 1)'], {}), '((0, 1))\n', (434, 442), Fals... |
import torch
def pad_tensor_to_multiple_number(tensor, multiple_number, pad_value=0):
t_height, t_width = tensor.shape[-2], tensor.shape[-1]
padded_height = (t_height + multiple_number - 1) // \
multiple_number * multiple_number
padded_width = (t_width + multiple_number - 1) // \
... | [
"torch.ones"
] | [((432, 507), 'torch.ones', 'torch.ones', (['[tensor.shape[0], tensor.shape[1], padded_height, padded_width]'], {}), '([tensor.shape[0], tensor.shape[1], padded_height, padded_width])\n', (442, 507), False, 'import torch\n'), ((680, 738), 'torch.ones', 'torch.ones', (['[tensor.shape[0], padded_height, padded_width]'], ... |
from rest_framework.test import APITestCase
from rest_framework import status
from django.contrib.auth import get_user_model
from django.contrib.auth import authenticate
from rest_framework_simplejwt.tokens import RefreshToken
from ..utils import generate6Code
User = get_user_model()
class AuthenticationTests(APITest... | [
"rest_framework_simplejwt.tokens.RefreshToken.for_user",
"django.contrib.auth.get_user_model",
"django.contrib.auth.authenticate"
] | [((269, 285), 'django.contrib.auth.get_user_model', 'get_user_model', ([], {}), '()\n', (283, 285), False, 'from django.contrib.auth import get_user_model\n'), ((1411, 1463), 'django.contrib.auth.authenticate', 'authenticate', ([], {'email': '"""<EMAIL>"""', 'password': '"""<PASSWORD>"""'}), "(email='<EMAIL>', password... |
import shutil
import sys
def which_blender_by_os():
"""Get the expected Blender executable location by operative system."""
if sys.platform == "darwin":
return "Blender"
return "blender.exe" if "win" in sys.platform else shutil.which("blender")
| [
"shutil.which"
] | [((243, 266), 'shutil.which', 'shutil.which', (['"""blender"""'], {}), "('blender')\n", (255, 266), False, 'import shutil\n')] |
import sqlite3
def dict_factory(cursor, row):
"""Causes sqlite to return dictionary instead of tuple"""
"""Easier and more pythonic than using indices"""
d = {}
for idx, col in enumerate(cursor.description):
d[col[0]] = row[idx]
return d
def connect_to_db():
print("connecting to dat... | [
"sqlite3.connect"
] | [((342, 376), 'sqlite3.connect', 'sqlite3.connect', (['"""Syntropy.sqlite"""'], {}), "('Syntropy.sqlite')\n", (357, 376), False, 'import sqlite3\n')] |
# always having to close the file after we're done working with it is a little tedious.
# Because this is something we have to do every single time we open a file,
# Python gives us a handy tool called a context manager, which handles these repetitive actions for us.
import os, sys
# read file
with open(os.path.join... | [
"os.path.join"
] | [((308, 350), 'os.path.join', 'os.path.join', (['sys.path[0]', '"""2-example.txt"""'], {}), "(sys.path[0], '2-example.txt')\n", (320, 350), False, 'import os, sys\n'), ((600, 645), 'os.path.join', 'os.path.join', (['sys.path[0]', '"""2-write-file.txt"""'], {}), "(sys.path[0], '2-write-file.txt')\n", (612, 645), False, ... |
from __future__ import unicode_literals
import logging
from mopidy import backend
from mopidy_radiobrowser import translator
logger = logging.getLogger(__name__)
class RadioBrowserPlayback(backend.PlaybackProvider):
def translate_uri(self, uri):
logger.debug('RadioBrowser: Start backend.RadioBrowserPl... | [
"mopidy_radiobrowser.translator.parse_uri",
"logging.getLogger"
] | [((137, 164), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (154, 164), False, 'import logging\n'), ((365, 390), 'mopidy_radiobrowser.translator.parse_uri', 'translator.parse_uri', (['uri'], {}), '(uri)\n', (385, 390), False, 'from mopidy_radiobrowser import translator\n')] |
#!/usr/bin/env python3
# Copyright 2020 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import unittest
from cros.factory.test.pytests import keyboard
from cros.factory.utils import schema
class KeyboardUnitTest(unit... | [
"unittest.main",
"cros.factory.test.pytests.keyboard._REPLACEMENT_KEYMAP_SCHEMA.Validate"
] | [((1410, 1425), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1423, 1425), False, 'import unittest\n'), ((652, 702), 'cros.factory.test.pytests.keyboard._REPLACEMENT_KEYMAP_SCHEMA.Validate', 'keyboard._REPLACEMENT_KEYMAP_SCHEMA.Validate', (['data'], {}), '(data)\n', (696, 702), False, 'from cros.factory.test.pyt... |
# BUG: Using pd.concat(axis="columns") on differently sized MultiIndexed
# DataFrames with a datetime index level containing exclusively NaT values
# causes the level in the returned DataFrame to be a float instead of a datetime
# #44900
import numpy as np
import pandas as pd
print(pd.__version__)
df_a = pd.DataFram... | [
"pandas.testing.assert_frame_equal",
"pandas.concat"
] | [((533, 572), 'pandas.concat', 'pd.concat', (['[df_a, df_b]'], {'axis': '"""columns"""'}), "([df_a, df_b], axis='columns')\n", (542, 572), True, 'import pandas as pd\n'), ((784, 831), 'pandas.testing.assert_frame_equal', 'pd.testing.assert_frame_equal', (['result', 'expected'], {}), '(result, expected)\n', (813, 831), ... |
import csv, glob
for filename in sorted(glob.glob("metadata/*.csv")):
file_a = filename[:-4]
file = file_a[9:]
csvFile = 'metadata/' + file + '.csv'
xmlFile = file + '.xml'
csvData = csv.reader(open(csvFile, encoding='latin-1'))
xmlData = open(xmlFile, 'w', encoding='l... | [
"glob.glob"
] | [((41, 68), 'glob.glob', 'glob.glob', (['"""metadata/*.csv"""'], {}), "('metadata/*.csv')\n", (50, 68), False, 'import csv, glob\n')] |
#!/usr/bin/env python3
from collections import defaultdict
from heapq import heappush, heappop
import sys
def main(K, N):
P = 10 ** 9 + 7
P25 = [1] * (K + 1)
P26 = [1] * (K + 1)
F = [1] * (N + K)
INV = [1] * (N + K)
INVF = [1] * (N + K)
p25 = 1
p26 = 1
for i in range(1, K + 1):
... | [
"my_module.main",
"numba.pycc.CC"
] | [((1014, 1029), 'numba.pycc.CC', 'CC', (['"""my_module"""'], {}), "('my_module')\n", (1016, 1029), False, 'from numba.pycc import CC\n'), ((1299, 1321), 'my_module.main', 'main', (['(10 ** 6)', '(10 ** 6)'], {}), '(10 ** 6, 10 ** 6)\n', (1303, 1321), False, 'from my_module import main\n')] |
import plotly
def sankey_graph(filename, component_df, node_label_col, url_col,
node_colour_col, source_col,target_col,value_col,
link_colour_col, graph_title, url_not_name=True ):
"""
Uses the plotly library to plot a sankey graph with the colour and width of links
determi... | [
"plotly.offline.plot"
] | [((7067, 7127), 'plotly.offline.plot', 'plotly.offline.plot', (['fig'], {'filename': 'filename', 'auto_open': '(False)'}), '(fig, filename=filename, auto_open=False)\n', (7086, 7127), False, 'import plotly\n')] |
import os
import numpy as np
from keras.layers import Dense
from keras.models import Sequential
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "3"
class Model:
def name(self):
return "Keras MLP"
def train(self, x_train, y_train):
num_classes = y_train.shape[1]
self.model = Sequential()
... | [
"keras.models.Sequential",
"numpy.asarray",
"keras.layers.Dense"
] | [((302, 314), 'keras.models.Sequential', 'Sequential', ([], {}), '()\n', (312, 314), False, 'from keras.models import Sequential\n'), ((780, 802), 'numpy.asarray', 'np.asarray', (['bool_preds'], {}), '(bool_preds)\n', (790, 802), True, 'import numpy as np\n'), ((338, 394), 'keras.layers.Dense', 'Dense', (['(20)'], {'in... |
import pandas as pd
import numpy as np
s = pd.Series(np.tile([3,5],2))
print(s) | [
"numpy.tile"
] | [((55, 73), 'numpy.tile', 'np.tile', (['[3, 5]', '(2)'], {}), '([3, 5], 2)\n', (62, 73), True, 'import numpy as np\n')] |
import os
import sys
import random, string
from sqlalchemy import Column, ForeignKey, Integer, String
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship
from sqlalchemy import create_engine
from passlib.apps import custom_app_context as pwd_context
from itsdangerous import(T... | [
"sqlalchemy.String",
"random.choice",
"sqlalchemy.ForeignKey",
"passlib.apps.custom_app_context.verify",
"sqlalchemy.ext.declarative.declarative_base",
"sqlalchemy.orm.relationship",
"itsdangerous.TimedJSONWebSignatureSerializer",
"sqlalchemy.Column",
"sqlalchemy.create_engine",
"passlib.apps.cust... | [((502, 520), 'sqlalchemy.ext.declarative.declarative_base', 'declarative_base', ([], {}), '()\n', (518, 520), False, 'from sqlalchemy.ext.declarative import declarative_base\n'), ((2888, 2941), 'sqlalchemy.create_engine', 'create_engine', (['"""sqlite:///restaurantmenuwithusers.db"""'], {}), "('sqlite:///restaurantmen... |
"""
Main script to fine-tuning the Wav2Vec model.
author: <NAME>. Adapted from the tutorial: https://colab.research.google.com/github/m3hrdadfi/soxan/blob/main/notebooks/Emotion_recognition_in_Greek_speech_using_Wav2Vec2.ipynb
date: 03/2022
Usage:
e.g.
python3 MMEmotionRecognition/src/Audio/FineTuningWav... | [
"sys.path.append",
"pandas.DataFrame",
"datasets.load_dataset",
"transformers.TrainingArguments",
"numpy.random.seed",
"argparse.ArgumentParser",
"os.makedirs",
"torchaudio.transforms.Resample",
"numpy.argmax",
"datetime.datetime.now",
"time.sleep",
"pathlib.Path",
"random.seed",
"torchaud... | [((996, 1016), 'sys.path.append', 'sys.path.append', (['"""."""'], {}), "('.')\n", (1011, 1016), False, 'import sys\n'), ((1017, 1038), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (1032, 1038), False, 'import sys\n'), ((1039, 1064), 'sys.path.append', 'sys.path.append', (['"""../../"""'], {}),... |
from django.http import HttpResponse
from .spacy.SacParse import SacParse
import json
def parse(request):
txt_to_parse = request.GET.get('txt')
sp = SacParse('en_core_web_sm')
doc = sp.read_document(txt_to_parse)
ents = sp.entity_recognition(doc)
verbs_dobj = sp.generate_verb_dobj(doc)
ents_j... | [
"django.http.HttpResponse",
"json.dumps",
"json.loads"
] | [((485, 547), 'json.dumps', 'json.dumps', (["{'ents': ents_json, 'verbs_dobj': verbs_dobj_json}"], {}), "({'ents': ents_json, 'verbs_dobj': verbs_dobj_json})\n", (495, 547), False, 'import json\n'), ((617, 639), 'django.http.HttpResponse', 'HttpResponse', (['response'], {}), '(response)\n', (629, 639), False, 'from dja... |
import time, unittest
from django.test import LiveServerTestCase
from django.utils.translation import ugettext as _
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.firefox.webdriver import WebDriver
from fixtures.project_factory imp... | [
"time.sleep",
"unittest.skip",
"fixtures.project_factory.ProjectFactory.create_base_project",
"django.utils.translation.ugettext",
"selenium.webdriver.firefox.webdriver.WebDriver"
] | [((794, 894), 'unittest.skip', 'unittest.skip', (['"""Test is unreliable - eventually some timing issue - no solution found yet"""'], {}), "(\n 'Test is unreliable - eventually some timing issue - no solution found yet'\n )\n", (807, 894), False, 'import time, unittest\n'), ((599, 610), 'selenium.webdriver.firefo... |
from django.db import models
# Create your models here.
class Item(models.Model):
Record_ID = models.IntegerField()
Record_Type = models.CharField(max_length=200, blank=False)
Campaign_ID = models.IntegerField()
Campaign = models.CharField(max_length=200, blank=False)
Budget = models.DecimalF... | [
"django.db.models.CharField",
"django.db.models.IntegerField",
"django.db.models.DateTimeField",
"django.db.models.DecimalField"
] | [((105, 126), 'django.db.models.IntegerField', 'models.IntegerField', ([], {}), '()\n', (124, 126), False, 'from django.db import models\n'), ((145, 190), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(200)', 'blank': '(False)'}), '(max_length=200, blank=False)\n', (161, 190), False, 'from djan... |
# :coding: utf-8
# :copyright: Copyright (c) 2015 ftrack
import os
import re
import glob
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
ROOT_PATH = os.path.dirname(
os.path.realpath(__file__)
)
RESOURCE_PATH = os.path.join(
ROOT_PATH, 'resource'
)
SOURC... | [
"os.path.realpath",
"os.walk",
"pytest.main",
"setuptools.command.test.test.finalize_options",
"os.path.join",
"os.listdir",
"setuptools.find_packages"
] | [((272, 307), 'os.path.join', 'os.path.join', (['ROOT_PATH', '"""resource"""'], {}), "(ROOT_PATH, 'resource')\n", (284, 307), False, 'import os\n'), ((329, 362), 'os.path.join', 'os.path.join', (['ROOT_PATH', '"""source"""'], {}), "(ROOT_PATH, 'source')\n", (341, 362), False, 'import os\n'), ((384, 421), 'os.path.join'... |
#%% [markdown]
# # Combine and Clean Data
# This is just a notebook file I can use to merge data generated by seperate
# scripts into fewer data files. I have to do this fairly often so it makes
# sense to keep the code somewhere I think
# %%
import pandas as pd
from glob import glob
#%% [markdown]
# ## $I_{\pm}$ for $... | [
"pandas.read_csv",
"pandas.merge",
"glob.glob",
"re.search",
"pandas.concat",
"re.sub"
] | [((447, 487), 'glob.glob', 'glob', (['"""../data/k5/pid/raw_ipm/*_ipm.csv"""'], {}), "('../data/k5/pid/raw_ipm/*_ipm.csv')\n", (451, 487), False, 'from glob import glob\n'), ((701, 715), 'pandas.concat', 'pd.concat', (['dfs'], {}), '(dfs)\n', (710, 715), True, 'import pandas as pd\n'), ((1688, 1730), 'pandas.read_csv',... |
"""add milestone
Revision ID: 8bc5bac6711b
Revises: <PASSWORD>
Create Date: 2021-10-20 15:28:46.113178
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = '<PASSWORD>'
branch_labels = None
depends_on = None
def upgrade():
op.create_tab... | [
"alembic.op.drop_table",
"sqlalchemy.Index",
"sqlalchemy.DateTime",
"sqlalchemy.PrimaryKeyConstraint",
"alembic.op.get_bind",
"sqlalchemy.String",
"sqlalchemy.Integer"
] | [((894, 907), 'alembic.op.get_bind', 'op.get_bind', ([], {}), '()\n', (905, 907), False, 'from alembic import op\n'), ((1999, 2026), 'alembic.op.drop_table', 'op.drop_table', (['"""milestones"""'], {}), "('milestones')\n", (2012, 2026), False, 'from alembic import op\n'), ((709, 731), 'sqlalchemy.Index', 'sa.Index', ([... |
#!/usr/bin/env python3
import argparse
import os
import sys
import pickle
import time
import json
try:
from selenium import webdriver
except ImportError:
print("Cannot import selenium package. Is it installed?")
print("To run this script you will also need geckodriver.")
print("Download it here: https... | [
"json.load",
"argparse.ArgumentParser",
"selenium.webdriver.Firefox",
"os.path.realpath",
"os.path.exists",
"time.sleep",
"pickle.load",
"os.path.join",
"sys.exit"
] | [((6215, 6287), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Delete images from Google Photos."""'}), "(description='Delete images from Google Photos.')\n", (6238, 6287), False, 'import argparse\n'), ((369, 382), 'sys.exit', 'sys.exit', (['(100)'], {}), '(100)\n', (377, 382), False, 'i... |
import torch
from variables import PROJECT_PATH
from src.models import train_model
from src.data.load_data import load_dataset
def test_model_output(i=5):
model = train_model.TrainModel().model
data = load_dataset(set_type = 'val', dir_path=PROJECT_PATH / "data" / "processed")
with torch.no_grad():
... | [
"src.data.load_data.load_dataset",
"torch.argmax",
"torch.no_grad",
"src.models.train_model.TrainModel"
] | [((210, 284), 'src.data.load_data.load_dataset', 'load_dataset', ([], {'set_type': '"""val"""', 'dir_path': "(PROJECT_PATH / 'data' / 'processed')"}), "(set_type='val', dir_path=PROJECT_PATH / 'data' / 'processed')\n", (222, 284), False, 'from src.data.load_data import load_dataset\n'), ((168, 192), 'src.models.train_m... |
import os
def install_dependecies():
print("install will begin...")
try:
os.system("pip install numpy")
os.system("pip install pip install sklearn")
os.system("pip install matplotlib")
os.system("pip install scikit-image")
os.system("pip install opencv-python")
os.system("pip install pandas")... | [
"os.system"
] | [((85, 115), 'os.system', 'os.system', (['"""pip install numpy"""'], {}), "('pip install numpy')\n", (94, 115), False, 'import os\n'), ((119, 163), 'os.system', 'os.system', (['"""pip install pip install sklearn"""'], {}), "('pip install pip install sklearn')\n", (128, 163), False, 'import os\n'), ((167, 202), 'os.syst... |
'''
(c) Copyright 2013 Telefonica, I+D. Printed in Spain (Europe). All Rights
Reserved.
The copyright to the software program(s) is property of Telefonica I+D.
The program(s) may be used and or copied only with the express written
consent of Telefonica I+D or in accordance with the terms and conditions
stipulated in t... | [
"django.core.exceptions.ValidationError",
"commons.exceptions.GenericServiceError",
"commons.fields.ObjectIdField",
"classes.services.ServiceClassService",
"classes.services.ServiceInstanceService",
"commons.exceptions.BadParameterValueException",
"commons.fields.CharRestrictField",
"logging.getLogger... | [((1018, 1045), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1035, 1045), False, 'import logging\n'), ((1715, 1762), 'commons.fields.CharRestrictField', 'CharRestrictField', ([], {'source': '"""_id"""', 'read_only': '(True)'}), "(source='_id', read_only=True)\n", (1732, 1762), False, '... |
import pyb
class PulseGenerator:
def __init__(self,
channel=1,
pin_name='A0',
duty_cycle=0.5,
timer=None,
freq=500,
tim=2):
""" Generate a pulse width modulated signal on given pin
... | [
"pyb.DAC",
"pyb.Pin",
"pyb.ADC",
"pyb.Timer"
] | [((863, 880), 'pyb.Pin', 'pyb.Pin', (['pin_name'], {}), '(pin_name)\n', (870, 880), False, 'import pyb\n'), ((2319, 2331), 'pyb.Pin', 'pyb.Pin', (['pin'], {}), '(pin)\n', (2326, 2331), False, 'import pyb\n'), ((2355, 2371), 'pyb.Pin', 'pyb.Pin', (['pin_adc'], {}), '(pin_adc)\n', (2362, 2371), False, 'import pyb\n'), ((... |
import time
import uuid
import base64
from base64 import b64encode
import random
import string
import re
from typing import Dict, List, Optional
from Crypto.Cipher import AES
from Crypto.Hash import SHA3_384
from Crypto.Random import get_random_bytes
from Crypto.Util.Padding import pad
def get_pwd_auth(username: str... | [
"uuid.uuid4",
"re.split",
"random.sample",
"time.time",
"Crypto.Util.Padding.pad",
"string.encode",
"base64.b64encode",
"Crypto.Cipher.AES.new",
"Crypto.Random.get_random_bytes",
"Crypto.Hash.SHA3_384.new"
] | [((767, 787), 'Crypto.Random.get_random_bytes', 'get_random_bytes', (['(12)'], {}), '(12)\n', (783, 787), False, 'from Crypto.Random import get_random_bytes\n'), ((797, 828), 'Crypto.Cipher.AES.new', 'AES.new', (['key1', 'AES.MODE_GCM', 'iv'], {}), '(key1, AES.MODE_GCM, iv)\n', (804, 828), False, 'from Crypto.Cipher im... |
from armulator.armv6.opcodes.abstract_opcodes.cmp_immediate import CmpImmediate
from armulator.armv6.opcodes.opcode import Opcode
from armulator.armv6.bits_ops import zero_extend
class CmpImmediateT1(CmpImmediate, Opcode):
def __init__(self, instruction, n, imm32):
Opcode.__init__(self, instruction)
... | [
"armulator.armv6.bits_ops.zero_extend",
"armulator.armv6.opcodes.opcode.Opcode.__init__",
"armulator.armv6.opcodes.abstract_opcodes.cmp_immediate.CmpImmediate.__init__"
] | [((280, 314), 'armulator.armv6.opcodes.opcode.Opcode.__init__', 'Opcode.__init__', (['self', 'instruction'], {}), '(self, instruction)\n', (295, 314), False, 'from armulator.armv6.opcodes.opcode import Opcode\n'), ((323, 360), 'armulator.armv6.opcodes.abstract_opcodes.cmp_immediate.CmpImmediate.__init__', 'CmpImmediate... |
# SISO program yesViaGAGA.py
# Performs a reduction from YesOnString to GAGAOnString.
# progString: a python program P
# inString: An input string I
# returns: if the oracle function GAGAOnString worked correctly, this
# program would return "yes" if P(I) is "yes", and "no" otherwise.
import utils
from utils import... | [
"utils.rf",
"utils.ESS",
"utils.tprint"
] | [((440, 471), 'utils.ESS', 'utils.ESS', (['progString', 'inString'], {}), '(progString, inString)\n', (449, 471), False, 'import utils\n'), ((496, 519), 'utils.rf', 'rf', (['"""alterYesToGAGA.py"""'], {}), "('alterYesToGAGA.py')\n", (498, 519), False, 'from utils import rf\n'), ((859, 892), 'utils.tprint', 'utils.tprin... |
"""Command Line Interface."""
import json
from pathlib import Path
import click
from cookiecutterizer import create_project
@click.command()
@click.option("--substitutions", type=click.File(), required=True)
@click.option("--destination", type=click.Path(), required=True)
@click.argument("project", type=click.Path(... | [
"json.load",
"click.File",
"click.command",
"pathlib.Path",
"click.Path"
] | [((129, 144), 'click.command', 'click.command', ([], {}), '()\n', (142, 144), False, 'import click\n'), ((668, 681), 'pathlib.Path', 'Path', (['project'], {}), '(project)\n', (672, 681), False, 'from pathlib import Path\n'), ((683, 707), 'json.load', 'json.load', (['substitutions'], {}), '(substitutions)\n', (692, 707)... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
"""
Скрипт ищет картинки в инете и помещает на стену пользователя vk.com
"""
import sys
import random
from urllib.request import urlopen
from typing import List
from vk_api.upload import VkUpload
from root_config import DIR
from root_common... | [
"root_common.get_vk_session",
"random.shuffle",
"urllib.request.urlopen",
"yandex_search_img.get_images",
"vk_api.upload.VkUpload"
] | [((696, 712), 'root_common.get_vk_session', 'get_vk_session', ([], {}), '()\n', (710, 712), False, 'from root_common import get_vk_session\n'), ((748, 768), 'vk_api.upload.VkUpload', 'VkUpload', (['vk_session'], {}), '(vk_session)\n', (756, 768), False, 'from vk_api.upload import VkUpload\n'), ((793, 809), 'yandex_sear... |
from django.test import TestCase
from django.core.exceptions import ValidationError
from django.contrib.gis.geos import GEOSGeometry, LineString, Point, Polygon
from django.conf import settings
from georiviere.river.fields import SnappedGeometryField, SnappedLineStringField
from georiviere.river.tests.factories import... | [
"django.contrib.gis.geos.Point",
"georiviere.river.tests.factories.StreamFactory.create",
"django.contrib.gis.geos.Polygon",
"django.contrib.gis.geos.LineString",
"georiviere.river.fields.SnappedGeometryField",
"georiviere.river.fields.SnappedLineStringField",
"django.contrib.gis.geos.GEOSGeometry"
] | [((419, 443), 'georiviere.river.fields.SnappedLineStringField', 'SnappedLineStringField', ([], {}), '()\n', (441, 443), False, 'from georiviere.river.fields import SnappedGeometryField, SnappedLineStringField\n'), ((2488, 2510), 'georiviere.river.tests.factories.StreamFactory.create', 'StreamFactory.create', ([], {}), ... |