code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class StackstoreConfig(AppConfig):
name = 'stackstore'
verbose_name = _("Stack store")
| [
"django.utils.translation.gettext_lazy"
] | [((169, 185), 'django.utils.translation.gettext_lazy', '_', (['"""Stack store"""'], {}), "('Stack store')\n", (170, 185), True, 'from django.utils.translation import gettext_lazy as _\n')] |
import io
import time
from functools import lru_cache
from urllib.error import HTTPError
import numpy as np
import pandas as pd
import requests
import sidekick as sk
import mundi
from mundi import transforms
from ..cache import ttl_cache
from ..logging import log
from ..utils import today
HOURS = 3600
TIMEOUT = 6 * ... | [
"mundi.transforms.sum_children",
"pandas.read_csv",
"numpy.arange",
"io.BytesIO",
"sidekick.retry",
"requests.get",
"sidekick.import_later",
"mundi.region",
"mundi.code",
"pandas.DataFrame",
"functools.lru_cache",
"time.time",
"pandas.to_datetime",
"mundi.regions"
] | [((2205, 2228), 'sidekick.retry', 'sk.retry', (['(10)'], {'sleep': '(0.5)'}), '(10, sleep=0.5)\n', (2213, 2228), True, 'import sidekick as sk\n'), ((4286, 4309), 'sidekick.retry', 'sk.retry', (['(10)'], {'sleep': '(0.5)'}), '(10, sleep=0.5)\n', (4294, 4309), True, 'import sidekick as sk\n'), ((5195, 5218), 'sidekick.re... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from packaging import version
import dask
import dask.array as da
import numpy as np
import pytest
import scipy
import scipy.ndimage
import dask_image.ndinterp
# mode lists for the case with prefilter = False
_supported_modes = ['constant', 'nearest', 'reflect', 'mirror... | [
"numpy.dtype",
"dask.array.from_array",
"numpy.allclose",
"pytest.skip",
"numpy.random.random",
"pytest.mark.parametrize",
"pytest.importorskip",
"pytest.raises",
"numpy.random.seed",
"numpy.empty",
"packaging.version.parse",
"cupy.asarray"
] | [((3241, 3280), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""n"""', '[1, 2, 3]'], {}), "('n', [1, 2, 3])\n", (3264, 3280), False, 'import pytest\n'), ((3282, 3324), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""axis_size"""', '[64]'], {}), "('axis_size', [64])\n", (3305, 3324), False, 'impo... |
# Shoot!
# by KidsCanCode 2014
# A generic space shooter - prototype (no art)
# For educational purposes only
import pygame
import sys
import random
# define some colors
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
RED = (255, 0, 0)
GREEN = (0, 255, 0)
BLUE = (0, 0, 255)
BGCOLOR = BLACK
class Meteor(pygame.sprite.Sprit... | [
"pygame.init",
"pygame.quit",
"sys.exit",
"pygame.font.Font",
"pygame.display.set_mode",
"pygame.display.flip",
"pygame.mixer.Sound",
"pygame.display.update",
"random.randrange",
"pygame.Surface",
"pygame.sprite.Group",
"pygame.time.Clock",
"pygame.sprite.spritecollideany",
"pygame.sprite.... | [((4520, 4533), 'pygame.init', 'pygame.init', ([], {}), '()\n', (4531, 4533), False, 'import pygame\n'), ((4588, 4607), 'pygame.mixer.init', 'pygame.mixer.init', ([], {}), '()\n', (4605, 4607), False, 'import pygame\n'), ((4617, 4657), 'pygame.display.set_mode', 'pygame.display.set_mode', (['(WIDTH, HEIGHT)'], {}), '((... |
"""Git Utility functions."""
from __future__ import absolute_import
from __future__ import print_function
import itertools
import os
import re
import subprocess
from typing import Any, Callable, List, Tuple
from buildscripts import moduleconfig
from buildscripts.resmokelib.utils import globstar
# Path to the modules... | [
"subprocess.check_output",
"os.path.exists",
"os.path.isabs",
"re.compile",
"os.path.join",
"os.path.realpath",
"itertools.chain.from_iterable",
"os.path.abspath",
"buildscripts.resmokelib.utils.globstar.iglob",
"os.path.relpath"
] | [((10902, 10969), 're.compile', 're.compile', (['"""^diff --git a\\\\/([\\\\w\\\\/\\\\.\\\\-]+) b\\\\/[\\\\w\\\\/\\\\.\\\\-]+"""'], {}), "('^diff --git a\\\\/([\\\\w\\\\/\\\\.\\\\-]+) b\\\\/[\\\\w\\\\/\\\\.\\\\-]+')\n", (10912, 10969), False, 'import re\n'), ((1208, 1242), 'os.path.join', 'os.path.join', (['base_dir', ... |
import logging
from typing import Optional, Dict, List
import pysolr
import serpy
from manifest_server.helpers.fields import StaticField
from manifest_server.helpers.identifiers import get_identifier, IIIF_V3_CONTEXT
from manifest_server.helpers.metadata import v3_metadata_block, get_links
from manifest_server.helper... | [
"logging.getLogger",
"manifest_server.helpers.solr_connection.SolrConnection.search",
"manifest_server.helpers.metadata.get_links",
"manifest_server.helpers.metadata.v3_metadata_block",
"manifest_server.helpers.identifiers.get_identifier",
"serpy.MethodField",
"serpy.StrField",
"manifest_server.iiif.v... | [((639, 666), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (656, 666), False, 'import logging\n'), ((833, 876), 'manifest_server.helpers.solr_connection.SolrConnection.search', 'SolrConnection.search', (['"""*:*"""'], {'fq': 'fq', 'rows': '(1)'}), "('*:*', fq=fq, rows=1)\n", (854, 876),... |
import copy
import math
class burrow:
# Map is hardcoded
burrowsPos = (2, 4, 6, 8)
anthropodStr = ("A", "B", "C", "D")
def __init__(self, hallway, burrows):
self.hallway = hallway
self.burrows = burrows
self.energy_usage = 0
def __str__(self):
result ... | [
"copy.copy",
"copy.deepcopy"
] | [((2644, 2659), 'copy.copy', 'copy.copy', (['self'], {}), '(self)\n', (2653, 2659), False, 'import copy\n'), ((1345, 1372), 'copy.deepcopy', 'copy.deepcopy', (['self.burrows'], {}), '(self.burrows)\n', (1358, 1372), False, 'import copy\n'), ((3632, 3647), 'copy.copy', 'copy.copy', (['self'], {}), '(self)\n', (3641, 364... |
"""
Author: <NAME>
Purpose: resave the annotations in desired format
Licensed under The MIT License [see LICENSE for details]
"""
import json, os, pdb, cv2
import argparse
parser = argparse.ArgumentParser(description='prepare VOC dataset')
# anchor_type to be used in the experiment
parser.add_argu... | [
"argparse.ArgumentParser",
"cv2.imshow",
"cv2.waitKey",
"json.load",
"cv2.imread",
"json.dump"
] | [((203, 261), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""prepare VOC dataset"""'}), "(description='prepare VOC dataset')\n", (226, 261), False, 'import argparse\n'), ((1142, 1154), 'json.load', 'json.load', (['f'], {}), '(f)\n', (1151, 1154), False, 'import json, os, pdb, cv2\n'), ((... |
# -*- coding: utf-8 -*-
"""
Sentiment Analysis-Movie Reviews using NLTK
@author: <NAME>(<EMAIL>)
Developed as part of Microsoft's NLP MOOC(https://www.edx.org/course/natural-language-processing-nlp)
"""
# movie reviews / sentiment analysis
import nltk
from nltk.corpus import movie_reviews as reviews
import random... | [
"nltk.corpus.movie_reviews.categories",
"random.shuffle",
"nltk.classify.accuracy",
"nltk.corpus.movie_reviews.words",
"nltk.NaiveBayesClassifier.train",
"nltk.corpus.movie_reviews.fileids"
] | [((465, 485), 'random.shuffle', 'random.shuffle', (['docs'], {}), '(docs)\n', (479, 485), False, 'import random\n'), ((963, 1005), 'nltk.NaiveBayesClassifier.train', 'nltk.NaiveBayesClassifier.train', (['trainData'], {}), '(trainData)\n', (994, 1005), False, 'import nltk\n'), ((1032, 1073), 'nltk.classify.accuracy', 'n... |
from dataclasses import dataclass, field
from enum import Enum
from typing import Optional
__NAMESPACE__ = "NISTSchema-SV-IV-atomic-Name-enumeration-2-NS"
class NistschemaSvIvAtomicNameEnumeration2Type(Enum):
UOF_RETRIEVE_THE_PROVIDED_SPECIFIC_IN_SYSTEMS_ON_A_CHI = "uof.retrieve:the_provided_specific_in_systems-... | [
"dataclasses.field"
] | [((999, 1047), 'dataclasses.field', 'field', ([], {'default': 'None', 'metadata': "{'required': True}"}), "(default=None, metadata={'required': True})\n", (1004, 1047), False, 'from dataclasses import dataclass, field\n')] |
import torch.nn as nn
import torch.nn.functional as F
input_number=100
class Fuel_Cell_Net_16800(nn.Module):
def __init__(self):
super(Fuel_Cell_Net_16800,self).__init__()
self.conv1 = nn.Conv1d(1, 64, 100, 10)
self.pool1 = nn.MaxPool1d(3, 2)
self.conv2 = nn.Conv1d(64, 32, 5, 10)
... | [
"torch.nn.MaxPool1d",
"torch.nn.Conv1d",
"torch.nn.Linear"
] | [((205, 230), 'torch.nn.Conv1d', 'nn.Conv1d', (['(1)', '(64)', '(100)', '(10)'], {}), '(1, 64, 100, 10)\n', (214, 230), True, 'import torch.nn as nn\n'), ((252, 270), 'torch.nn.MaxPool1d', 'nn.MaxPool1d', (['(3)', '(2)'], {}), '(3, 2)\n', (264, 270), True, 'import torch.nn as nn\n'), ((292, 316), 'torch.nn.Conv1d', 'nn... |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2014-2021 <NAME> (The Compiler) <<EMAIL>>
#
# This file is part of qutebrowser.
#
# qutebrowser is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, e... | [
"qutebrowser.utils.objreg.get",
"qutebrowser.utils.log.misc.error",
"fcntl.fcntl",
"threading.main_thread",
"qutebrowser.misc.quitter.shutting_down.connect",
"sys.exit",
"faulthandler.enable",
"PyQt5.QtCore.qInstallMessageHandler",
"os.path.exists",
"os.remove",
"qutebrowser.misc.earlyinit.init_... | [((1706, 1732), 'typing.cast', 'cast', (['"""CrashHandler"""', 'None'], {}), "('CrashHandler', None)\n", (1710, 1732), False, 'from typing import TYPE_CHECKING, Optional, MutableMapping, cast, List\n'), ((5494, 5537), 'qutebrowser.api.cmdutils.register', 'cmdutils.register', ([], {'instance': '"""crash-handler"""'}), "... |
# Generated by Django 3.0.3 on 2020-03-12 00:02
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('api', '0016_auto_20200311_1701'),
]
operations = [
migrations.RenameField(
model_name='crypto',
old_name='names',
... | [
"django.db.migrations.RenameField"
] | [((223, 301), 'django.db.migrations.RenameField', 'migrations.RenameField', ([], {'model_name': '"""crypto"""', 'old_name': '"""names"""', 'new_name': '"""name"""'}), "(model_name='crypto', old_name='names', new_name='name')\n", (245, 301), False, 'from django.db import migrations\n')] |
# Copyright 2020 National Technology & Engineering Solutions of Sandia, LLC
# (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S.
# Government retains certain rights in this software.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complianc... | [
"collections.OrderedDict",
"collections.namedtuple",
"json.loads",
"logging.debug",
"laikaboss.objectmodel.ExternalObject.decode",
"os.urandom",
"laikaboss.objectmodel.ScanResult.encode",
"json.dumps",
"time.sleep",
"zlib.compress",
"future.standard_library.install_aliases",
"builtins.str",
... | [((789, 823), 'future.standard_library.install_aliases', 'standard_library.install_aliases', ([], {}), '()\n', (821, 823), False, 'from future import standard_library\n'), ((1105, 1160), 'collections.namedtuple', 'namedtuple', (['"""QueueMsg"""', "['senderID', 'msg_type', 'val']"], {}), "('QueueMsg', ['senderID', 'msg_... |
#!/usr/bin/env python -O
"""
This is the test class for testing Duane model algorithms.
"""
# -*- coding: utf-8 -*-
#
# tests.statistics.TestDuane.py is part of The RTK Project
#
# All rights reserved.
# Copyright 2007 - 2017 <NAME> andrew.rowland <AT> reliaqual <DOT> com
#
# Redistribution and use in source and... | [
"os.path.dirname",
"nose.plugins.attrib.attr"
] | [((2311, 2336), 'nose.plugins.attrib.attr', 'attr', ([], {'all': '(True)', 'unit': '(True)'}), '(all=True, unit=True)\n', (2315, 2336), False, 'from nose.plugins.attrib import attr\n'), ((3123, 3148), 'nose.plugins.attrib.attr', 'attr', ([], {'all': '(True)', 'unit': '(True)'}), '(all=True, unit=True)\n', (3127, 3148),... |
import unittest
import math
from b2_logic.odometry_helpers import normalize_theta, calc_world_frame_pose, calc_steering_angle
PKG = 'b2'
NAME = 'b2_odom_helpers_unittest'
pi = math.pi
twopi = pi * 2
class TestOdometryHelpers(unittest.TestCase):
def setUp(self):
print()
def test_normalize_theta(se... | [
"b2_logic.odometry_helpers.calc_steering_angle",
"b2_logic.odometry_helpers.calc_world_frame_pose",
"b2_logic.odometry_helpers.normalize_theta",
"rosunit.unitrun"
] | [((4473, 4520), 'rosunit.unitrun', 'rosunit.unitrun', (['PKG', 'NAME', 'TestOdometryHelpers'], {}), '(PKG, NAME, TestOdometryHelpers)\n', (4488, 4520), False, 'import rosunit\n'), ((979, 1007), 'b2_logic.odometry_helpers.normalize_theta', 'normalize_theta', (['input_theta'], {}), '(input_theta)\n', (994, 1007), False, ... |
"""Provides a command line interface to the pyrate library
The command line interface (CLI) expects that a configuration file named
'aistool.conf' is located in the current folder.
If the config file is not present, a runtime error is raised, and the commands
`set_default` can be used to generate a default configurat... | [
"logging.getLogger",
"os.path.exists",
"configparser.ConfigParser",
"argparse.ArgumentParser",
"pyrate.loader.Loader"
] | [((679, 698), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (696, 698), False, 'import logging\n'), ((775, 789), 'configparser.ConfigParser', 'ConfigParser', ([], {}), '()\n', (787, 789), False, 'from configparser import ConfigParser\n'), ((833, 863), 'os.path.exists', 'os.path.exists', (['configfilepath'... |
"""Stereographic projection module."""
import numpy as np
from .__main__ import Projection
from ..angles import DEC, RA
class Sky(Projection):
"""Stereographic projection object.
Parameters
----------
ra: float, optional
Center west longitude.
dec: float, optional
Center latitud... | [
"numpy.prod",
"numpy.reshape",
"numpy.power",
"numpy.arcsin",
"numpy.ndim",
"numpy.array",
"numpy.dot",
"numpy.arctan2",
"numpy.shape",
"numpy.divide"
] | [((2153, 2242), 'numpy.array', 'np.array', (['[[self.__cdec, 0, self.__sdec], [0, 1, 0], [-self.__sdec, 0, self.__cdec]]'], {}), '([[self.__cdec, 0, self.__sdec], [0, 1, 0], [-self.__sdec, 0, self.\n __cdec]])\n', (2161, 2242), True, 'import numpy as np\n'), ((2299, 2384), 'numpy.array', 'np.array', (['[[self.__cra,... |
#!/usr/bin/python3 -tt
# -*- coding: utf-8 -*-
__all__ = ['Manager']
from twisted.internet.threads import deferToThread
from twisted.internet import task, reactor
from twisted.python import log
from adminator.device import Device
from adminator.dhcp_value import DhcpOptionValue
from adminator.dhcp_option import Dhcp... | [
"adminator.network_pool.NetworkPool",
"adminator.user.User",
"adminator.record.Record",
"adminator.lease4.Lease4",
"adminator.domain.Domain",
"adminator.connection.Connection",
"adminator.dhcp_value.DhcpOptionValue",
"adminator.switch_interface.SwitchInterface",
"adminator.interface.Interface",
"a... | [((1066, 1076), 'adminator.user.User', 'User', (['self'], {}), '(self)\n', (1070, 1076), False, 'from adminator.user import User\n'), ((1099, 1111), 'adminator.device.Device', 'Device', (['self'], {}), '(self)\n', (1105, 1111), False, 'from adminator.device import Device\n'), ((1137, 1152), 'adminator.interface.Interfa... |
from random import randint
from sqlalchemy import create_engine
from sqlalchemy import Column, Integer, String
from sqlalchemy.orm import declarative_base
from sqlalchemy.orm import sessionmaker
engine = create_engine("sqlite:///sqlite3.db")
Base = declarative_base()
Session = sessionmaker(bind=engine)
class Photo... | [
"sqlalchemy.orm.sessionmaker",
"sqlalchemy.create_engine",
"sqlalchemy.orm.declarative_base",
"sqlalchemy.Column",
"random.randint"
] | [((206, 243), 'sqlalchemy.create_engine', 'create_engine', (['"""sqlite:///sqlite3.db"""'], {}), "('sqlite:///sqlite3.db')\n", (219, 243), False, 'from sqlalchemy import create_engine\n'), ((252, 270), 'sqlalchemy.orm.declarative_base', 'declarative_base', ([], {}), '()\n', (268, 270), False, 'from sqlalchemy.orm impor... |
# Generated by Django 3.1.4 on 2020-12-13 06:02
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('bucket_list', '0004_auto_20201213_0600'),
]
operations = [
migrations.RemoveField(
model_name='task',
name='owner',
... | [
"django.db.migrations.RemoveField"
] | [((231, 286), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""task"""', 'name': '"""owner"""'}), "(model_name='task', name='owner')\n", (253, 286), False, 'from django.db import migrations\n')] |
"""
Instructions
If you don't already have it, install the SQLite Browser from
http://sqlitebrowser.org/
Then, create a SQLite database or use an existing database and create a
table in the database called "Ages".
+-----------------------+
| CREATE TABLE Ages ( |
| name VARCHAR(128), |
| age I... | [
"sqlite3.connect"
] | [((1537, 1574), 'sqlite3.connect', 'sqlite3.connect', (['"""data/my_friends.db"""'], {}), "('data/my_friends.db')\n", (1552, 1574), False, 'import sqlite3\n')] |
import sqlalchemy
import ckan.plugins.toolkit as toolkit
import ckan.lib.dictization.model_dictize as model_dictize
from ckan.lib.navl.dictization_functions import validate
from ckanext.showcase.logic.schema import package_showcase_list_schema
from ckanext.showcase.model import ShowcasePackageAssociation
from ckan.l... | [
"logging.getLogger",
"ckan.plugins.toolkit.get_action",
"ckanext.showcase.logic.schema.package_showcase_list_schema",
"ckan.lib.dictization.model_dictize.package_dictize",
"ckanext.showcase.model.ShowcasePackageAssociation.get_showcase_ids_for_package",
"ckan.plugins.toolkit.check_access",
"ckan.plugins... | [((367, 394), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (384, 394), False, 'import logging\n'), ((578, 643), 'ckan.plugins.toolkit.check_access', 'toolkit.check_access', (['"""ckanext_showcase_list"""', 'context', 'data_dict'], {}), "('ckanext_showcase_list', context, data_dict)\n", ... |
# -*- coding: utf-8 -*-
'''
@Time : 2020/05/08 11:45
@Author : Tianxiaomo
@File : coco_annotatin.py
@Noice :
@Modificattion :
@Author :
@Time :
@Detail :
'''
import argparse
import json
from collections import defaultdict
from tqdm import tqdm
import os
import sy... | [
"os.listdir",
"argparse.ArgumentParser",
"tqdm.tqdm",
"os.path.join",
"collections.defaultdict",
"json.load"
] | [((383, 400), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (394, 400), False, 'from collections import defaultdict\n'), ((619, 651), 'os.listdir', 'os.listdir', (['args.images_dir_path'], {}), '(args.images_dir_path)\n', (629, 651), False, 'import os\n'), ((878, 895), 'tqdm.tqdm', 'tqdm', (['an... |
# -*- coding: utf-8 -*-
# Copyright (C) 2020. Huawei Technologies Co., Ltd. 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/LICENS... | [
"logging.getLogger",
"vega.trainer.conf.TrainerConfig",
"vega.common.Config",
"vega.common.FileOps.dump_pickle",
"traceback.format_exc",
"os.path.join",
"os.environ.copy",
"vega.common.general.General",
"os.path.isdir",
"glob.glob",
"os.path.abspath",
"vega.common.class_factory.ClassFactory.re... | [((1117, 1144), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1134, 1144), False, 'import logging\n'), ((1148, 1188), 'vega.common.class_factory.ClassFactory.register', 'ClassFactory.register', (['ClassType.TRAINER'], {}), '(ClassType.TRAINER)\n', (1169, 1188), False, 'from vega.common.... |
"""Generate a single discrete time SIR model.
"""
from . import data_model
import numpy as np
from scipy import stats
import xarray as xr
# Generate Betas
# Beta, or the growth rate of the infection, depends on the covariates.
# Here we implement three different functional forms for the dependency.
SPLIT_TIME = 100
... | [
"numpy.ones",
"scipy.stats.binom.rvs",
"numpy.log",
"xarray.concat",
"xarray.zeros_like",
"numpy.random.randint",
"numpy.zeros",
"numpy.exp",
"numpy.array",
"xarray.DataArray",
"numpy.random.uniform",
"numpy.concatenate",
"numpy.matmul",
"numpy.random.binomial"
] | [((1768, 1823), 'xarray.DataArray', 'xr.DataArray', (['beta_np'], {'dims': "{'location': num_locations}"}), "(beta_np, dims={'location': num_locations})\n", (1780, 1823), True, 'import xarray as xr\n'), ((2910, 2927), 'numpy.ones', 'np.ones', (['num_pred'], {}), '(num_pred)\n', (2917, 2927), True, 'import numpy as np\n... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
from unittest import TestCase
from marshmallow import ValidationError
from polyaxon_deploy.schemas.intervals import IntervalsConfig
class TestIntervalsConfig(TestCase):
def test_intervals_config(self):
bad_config_d... | [
"polyaxon_deploy.schemas.intervals.IntervalsConfig.from_dict"
] | [((1308, 1346), 'polyaxon_deploy.schemas.intervals.IntervalsConfig.from_dict', 'IntervalsConfig.from_dict', (['config_dict'], {}), '(config_dict)\n', (1333, 1346), False, 'from polyaxon_deploy.schemas.intervals import IntervalsConfig\n'), ((925, 963), 'polyaxon_deploy.schemas.intervals.IntervalsConfig.from_dict', 'Inte... |
'''
@Author: JosieHong
@Date: 2020-04-26 12:40:11
@LastEditAuthor: JosieHong
LastEditTime: 2021-07-11 12:52:18
'''
import os.path as osp
import warnings
import math
import cv2
import mmcv
import numpy as np
from imagecorruptions import corrupt
from mmcv.parallel import DataContainer as DC
import torch
from .utils imp... | [
"numpy.random.rand",
"numpy.hstack",
"torch.sqrt",
"math.sqrt",
"mmcv.imrescale",
"cv2.contourArea",
"torch.sort",
"torch.Tensor",
"torch.cat",
"imagecorruptions.corrupt",
"torch.stack",
"os.path.join",
"torch.atan2",
"mmcv.parallel.DataContainer",
"torch.tensor",
"mmcv.imcrop",
"cv2... | [((11949, 11990), 'torch.cat', 'torch.cat', (['expanded_regress_ranges'], {'dim': '(0)'}), '(expanded_regress_ranges, dim=0)\n', (11958, 11990), False, 'import torch\n'), ((12015, 12045), 'torch.cat', 'torch.cat', (['all_level_points', '(0)'], {}), '(all_level_points, 0)\n', (12024, 12045), False, 'import torch\n'), ((... |
#!/usr/bin/env python3.3
'''gitolite post-receive hook
Executed after successful push to the repo to notify, jenkins, trac and/or
mirror the repo.
Usse:
Add config keys to ~GIT/.gitolite.rc
GIT_CONFIG_KEYS => 'gitolite\.url jenkins\.url jenkins\.build\.job jenkins\.build\.token trac\.dir trac\.repo git\.mirro... | [
"os.environ.items",
"subprocess.check_output",
"shutil.which",
"os.environ.get"
] | [((1574, 1592), 'os.environ.items', 'os.environ.items', ([], {}), '()\n', (1590, 1592), False, 'import os\n'), ((3807, 3839), 'os.environ.get', 'os.environ.get', (['"""TRAC_ADMIN_APP"""'], {}), "('TRAC_ADMIN_APP')\n", (3821, 3839), False, 'import os\n'), ((3862, 3894), 'os.environ.get', 'os.environ.get', (['"""TRAC_ADM... |
from PIL import Image
import pytesseract
pytesseract.pytesseract.tesseract_cmd = r"C:\Program Files\Tesseract-OCR\tesseract.exe"
image = Image.open(your_image)
image_to_text = pytesseract.image_to_string(image, lang='eng')
print(image_to_text)
| [
"PIL.Image.open",
"pytesseract.image_to_string"
] | [((138, 160), 'PIL.Image.open', 'Image.open', (['your_image'], {}), '(your_image)\n', (148, 160), False, 'from PIL import Image\n'), ((177, 223), 'pytesseract.image_to_string', 'pytesseract.image_to_string', (['image'], {'lang': '"""eng"""'}), "(image, lang='eng')\n", (204, 223), False, 'import pytesseract\n')] |
#!/usr/bin/env python3
"""
migrate_signoffs.py
Copies nova-labs signoffs from spaceman to wild apricot
adapted from spaceman2apricot.py by https://github.com/azagh
"""
import argparse
import datetime
import pandas as pd
import numpy as np
import os
import sys
import traceback
import urllib.parse
import signoffs
fro... | [
"os.getenv",
"time.sleep",
"dotenv.load_dotenv",
"datetime.datetime.now",
"pprint.PrettyPrinter",
"sys.exit",
"sys.stdout.write"
] | [((397, 446), 'pprint.PrettyPrinter', 'pprint.PrettyPrinter', ([], {'stream': 'sys.stdout', 'indent': '(4)'}), '(stream=sys.stdout, indent=4)\n', (417, 446), False, 'import pprint\n'), ((459, 485), 'dotenv.load_dotenv', 'load_dotenv', ([], {'override': '(True)'}), '(override=True)\n', (470, 485), False, 'from dotenv im... |
from rest_framework import serializers
import ast
from pulpo_forms.fields import Validations, Dependencies, Option
class ValidationSerializer(serializers.Serializer):
"""
Serializer for the validations in the versions json
"""
max_len_text = serializers.IntegerField(required=False, allow_null=True)
... | [
"rest_framework.serializers.IntegerField",
"pulpo_forms.fields.Validations",
"rest_framework.serializers.BooleanField",
"pulpo_forms.fields.Option",
"pulpo_forms.fields.Dependencies",
"rest_framework.serializers.CharField"
] | [((261, 318), 'rest_framework.serializers.IntegerField', 'serializers.IntegerField', ([], {'required': '(False)', 'allow_null': '(True)'}), '(required=False, allow_null=True)\n', (285, 318), False, 'from rest_framework import serializers\n'), ((336, 393), 'rest_framework.serializers.IntegerField', 'serializers.IntegerF... |
from xml.etree import ElementTree
class Parser:
def __init__(self, path):
self.entity_mentions = []
self.event_mentions = []
self.relation_mentions = []
self.parse_xml(path + '.apf.xml')
def parse_xml(self, xml_path):
tree = ElementTree.parse(xml_path)
root = t... | [
"xml.etree.ElementTree.parse"
] | [((276, 303), 'xml.etree.ElementTree.parse', 'ElementTree.parse', (['xml_path'], {}), '(xml_path)\n', (293, 303), False, 'from xml.etree import ElementTree\n')] |
from datetime import timedelta
import pytest
from .conf import TlsTestConf
class TestProxy:
@pytest.fixture(autouse=True, scope='class')
def _class_scope(self, env):
conf = TlsTestConf(env=env, extras={
'base': "LogLevel proxy:trace1 proxy_http:trace1 ssl:trace1",
env.domain... | [
"pytest.fixture",
"pytest.mark.parametrize"
] | [((102, 145), 'pytest.fixture', 'pytest.fixture', ([], {'autouse': '(True)', 'scope': '"""class"""'}), "(autouse=True, scope='class')\n", (116, 145), False, 'import pytest\n'), ((902, 1129), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""name, value"""', "[('SERVER_NAME', 'b.mod-tls.test'), ('SSL_SESSION_R... |
from follower_maze.events import handler
from follower_maze.events import parser
def parse(payload: bytes):
"""
Parse given payload bytes into one of `types.Event` subclasses.
"""
return parser.EventParser(payload).parse()
async def handle(payload: bytes):
"""
Parse event and handle ... | [
"follower_maze.events.parser.EventParser",
"follower_maze.events.handler.EventHandler.new"
] | [((390, 421), 'follower_maze.events.handler.EventHandler.new', 'handler.EventHandler.new', (['event'], {}), '(event)\n', (414, 421), False, 'from follower_maze.events import handler\n'), ((209, 236), 'follower_maze.events.parser.EventParser', 'parser.EventParser', (['payload'], {}), '(payload)\n', (227, 236), False, 'f... |
# -*- coding: utf-8 -*-
# Pretty ~ Useful ~ Python
"""
String Methods
"""
def string_score(strang: str) -> int:
"""Sum of letter values where a==1 and z == 26
:param strang: string to be scored
:type strang: str
:returns: -> score of the string
:rtype: int
.. doctest:: python
>>> st... | [
"doctest.testmod"
] | [((961, 970), 'doctest.testmod', 'testmod', ([], {}), '()\n', (968, 970), False, 'from doctest import testmod\n')] |
import box
import prepare
class Button:
def __init__(self, pos, text, centerx=True, centery=False,
size=prepare.BUTTON_SIZE):
self.text = text
if size == prepare.BIG_BUTTON_SIZE:
font = prepare.BIG_FONT
else:
font = prepare.MEDIUM_FONT
self.... | [
"box.Box"
] | [((335, 452), 'box.Box', 'box.Box', (['size', 'pos'], {'text': 'self.text', 'font': 'font', 'tiles': 'prepare.button_idle_tiles', 'centerx': 'centerx', 'centery': 'centery'}), '(size, pos, text=self.text, font=font, tiles=prepare.\n button_idle_tiles, centerx=centerx, centery=centery)\n', (342, 452), False, 'import ... |
from sortedcontainers import sortedset
from sortedcontainers import sortedlist
from datetime import timedelta
class TimingEvent(object):
"""
This class wraps a document and an associated resolved timing event into an object that can be placed
on the timeline.
"""
_element = None
_when = None
... | [
"sortedcontainers.sortedlist.SortedListWithKey"
] | [((1881, 1937), 'sortedcontainers.sortedlist.SortedListWithKey', 'sortedlist.SortedListWithKey', ([], {'key': '(lambda item: item.when)'}), '(key=lambda item: item.when)\n', (1909, 1937), False, 'from sortedcontainers import sortedlist\n')] |
# Generated by Django 2.0 on 2019-01-31 07:28
from django.db import migrations
class Migration(migrations.Migration):
def forwards_func(apps, schema_editor):
ProjectTodoList = apps.get_model('base', 'ProjectTodoList')
PersonalTodoList = apps.get_model('base', 'PersonalTodoList')
for proj... | [
"django.db.migrations.RunPython"
] | [((1217, 1280), 'django.db.migrations.RunPython', 'migrations.RunPython', (['forwards_func', 'reverse_func'], {'atomic': '(False)'}), '(forwards_func, reverse_func, atomic=False)\n', (1237, 1280), False, 'from django.db import migrations\n')] |
import os
from setuptools import setup
here = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(here, 'README.rst')).read()
setup(
name='django-tagify',
version='0.20',
packages=['django_tagify'],
description='django tag input field',
long_description=README,
author='PureCS... | [
"os.path.join",
"os.path.dirname",
"setuptools.setup"
] | [((146, 1014), 'setuptools.setup', 'setup', ([], {'name': '"""django-tagify"""', 'version': '"""0.20"""', 'packages': "['django_tagify']", 'description': '"""django tag input field"""', 'long_description': 'README', 'author': '"""PureCS"""', 'author_email': '"""<EMAIL>"""', 'url': '"""https://github.com/purecs/django-t... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import pytest
from compas.geometry import Frame
from rapid_clay_formations_fab.fab_data import FabricationElement
from rapid_clay_formations_fab.robots import PickStation
@pytest.fixture
def frame_list():
... | [
"rapid_clay_formations_fab.fab_data.FabricationElement",
"rapid_clay_formations_fab.robots.PickStation.from_data",
"compas.geometry.Frame",
"rapid_clay_formations_fab.robots.PickStation"
] | [((632, 698), 'rapid_clay_formations_fab.robots.PickStation', 'PickStation', (['frame_list'], {'elem_height': '(200)', 'elem_egress_distance': '(250)'}), '(frame_list, elem_height=200, elem_egress_distance=250)\n', (643, 698), False, 'from rapid_clay_formations_fab.robots import PickStation\n'), ((1095, 1131), 'rapid_c... |
import numpy as np
import pandas as pd
from nilearn import image, input_data
from nilearn.datasets import load_mni152_brain_mask
def get_masker(mask_img=None, target_affine=None):
if isinstance(mask_img, input_data.NiftiMasker):
return mask_img
if mask_img is None:
mask_img = load_mni152_brai... | [
"nilearn.image.new_img_like",
"numpy.atleast_2d",
"numpy.eye",
"numpy.linalg.pinv",
"nilearn.image.load_img",
"numpy.floor",
"numpy.ndim",
"nilearn.image.smooth_img",
"numpy.diag",
"numpy.zeros",
"nilearn.datasets.load_mni152_brain_mask",
"pandas.DataFrame",
"nilearn.image.resample_img",
"... | [((907, 928), 'numpy.atleast_2d', 'np.atleast_2d', (['coords'], {}), '(coords)\n', (920, 928), True, 'import numpy as np\n'), ((1275, 1299), 'nilearn.image.load_img', 'image.load_img', (['mask_img'], {}), '(mask_img)\n', (1289, 1299), False, 'from nilearn import image, input_data\n'), ((1360, 1384), 'numpy.zeros', 'np.... |
import time
import signal
import logging
log = logging.getLogger(__name__)
name = None
done = False
def request_exit(signum, frame):
global done
log.info('Stopping the %s...', name)
done = True
def run(cmd_name, f_init, f_stop, f_loop, *args, f_loop_delay_ms=3000):
global name
name = cmd_name
... | [
"logging.getLogger",
"signal.signal",
"time.sleep"
] | [((49, 76), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (66, 76), False, 'import logging\n'), ((368, 410), 'signal.signal', 'signal.signal', (['signal.SIGINT', 'request_exit'], {}), '(signal.SIGINT, request_exit)\n', (381, 410), False, 'import signal\n'), ((415, 458), 'signal.signal', ... |
from protocols.forms import verbs as verb_forms
from protocols.forms import forms
import time
import pprint
pp = pprint.PrettyPrinter(indent=4)
def get_verb_list():
verb_list = []
for attr_name in dir(verb_forms):
form_candidate = getattr(verb_forms, attr_name, None)
try:
if issubc... | [
"pprint.PrettyPrinter"
] | [((114, 144), 'pprint.PrettyPrinter', 'pprint.PrettyPrinter', ([], {'indent': '(4)'}), '(indent=4)\n', (134, 144), False, 'import pprint\n')] |
# authors: <NAME>, Manish
# date: 2020-01-23
"""Calculates MSE error for test set
Usage: src/vegas_test_results.py --test=<test> --out_dir=<out_dir>
Options:
--test=<test> Path (including filename) to training data
--out_dir=<out_dir> Path to directory where model results on test set need to be saved
"""
... | [
"pandas.read_csv",
"sklearn.metrics.mean_squared_error",
"warnings.simplefilter",
"numpy.load",
"docopt.docopt"
] | [((995, 1057), 'warnings.simplefilter', 'warnings.simplefilter', ([], {'action': '"""ignore"""', 'category': 'FutureWarning'}), "(action='ignore', category=FutureWarning)\n", (1016, 1057), False, 'import warnings\n'), ((1087, 1102), 'docopt.docopt', 'docopt', (['__doc__'], {}), '(__doc__)\n', (1093, 1102), False, 'from... |
# Copyright 2021 Alibaba Group Holding Limited. 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 ... | [
"tensorflow.ones",
"epl.Graph.get",
"epl.replicate",
"epl.init",
"tensorflow.python.platform.test.main"
] | [((1627, 1638), 'tensorflow.python.platform.test.main', 'test.main', ([], {}), '()\n', (1636, 1638), False, 'from tensorflow.python.platform import test\n'), ((1096, 1106), 'epl.init', 'epl.init', ([], {}), '()\n', (1104, 1106), False, 'import epl\n'), ((1158, 1186), 'tensorflow.ones', 'tf.ones', (['[1, 2]'], {'name': ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2012-2021 <NAME> - kray.me
# The MIT License http://www.opensource.org/licenses/mit-license.php
"""File-level functions to read and write id3 tags.
"""
import copy
import logging
from mutagen import id3, mp3
def get_tags(filepath):
"""Get id3 frames... | [
"mutagen.id3.ID3",
"logging.warning",
"mutagen.mp3.MP3",
"copy.deepcopy",
"logging.error"
] | [((387, 404), 'mutagen.mp3.MP3', 'mp3.MP3', (['filepath'], {}), '(filepath)\n', (394, 404), False, 'from mutagen import id3, mp3\n'), ((707, 724), 'mutagen.id3.ID3', 'id3.ID3', (['filepath'], {}), '(filepath)\n', (714, 724), False, 'from mutagen import id3, mp3\n'), ((744, 763), 'copy.deepcopy', 'copy.deepcopy', (['tag... |
import json
import logging
from openvisualizer.client.plugins.plugin import Plugin
from openvisualizer.client.view import View
from openvisualizer.motehandler.motestate.motestate import MoteState
@Plugin.record_view("macstats")
class MacStats(View):
def __init__(self, proxy, mote_id, refresh_rate):
super... | [
"openvisualizer.client.plugins.plugin.Plugin.record_view",
"json.loads",
"logging.debug"
] | [((200, 230), 'openvisualizer.client.plugins.plugin.Plugin.record_view', 'Plugin.record_view', (['"""macstats"""'], {}), "('macstats')\n", (218, 230), False, 'from openvisualizer.client.plugins.plugin import Plugin\n'), ((678, 722), 'logging.debug', 'logging.debug', (['"""Enabling blessed fullscreen"""'], {}), "('Enabl... |
# -*- coding: utf-8 -*-
from gluon.tools import Auth
from gluon.contrib.appconfig import AppConfig
myconf = AppConfig(reload=True)
DEVELOPMENT = myconf.take('app.development').lower()=='true'
AS_SERVICE = myconf.take('app.as_service').lower()=='true'
DEBUG_MODE = myconf.take('app.debug_mode').lower()=='true... | [
"gluon.contrib.appconfig.AppConfig",
"gluon.tools.Auth"
] | [((115, 137), 'gluon.contrib.appconfig.AppConfig', 'AppConfig', ([], {'reload': '(True)'}), '(reload=True)\n', (124, 137), False, 'from gluon.contrib.appconfig import AppConfig\n'), ((690, 698), 'gluon.tools.Auth', 'Auth', (['db'], {}), '(db)\n', (694, 698), False, 'from gluon.tools import Auth\n')] |
import pytest
from django.test import Client
from api.models import Thread, ThreadMessage
from api.tests import get_aware_time
client: Client = Client()
@pytest.mark.django_db
class TestPatchThread:
"""Tests PATCH /api/v1/thread/{thread_id}"""
pytestmark = pytest.mark.django_db
@staticmethod
def m... | [
"api.tests.get_aware_time",
"django.test.Client"
] | [((146, 154), 'django.test.Client', 'Client', ([], {}), '()\n', (152, 154), False, 'from django.test import Client\n'), ((430, 446), 'api.tests.get_aware_time', 'get_aware_time', ([], {}), '()\n', (444, 446), False, 'from api.tests import get_aware_time\n'), ((637, 653), 'api.tests.get_aware_time', 'get_aware_time', ([... |
from flask import Blueprint
#from example.app import create_celery_app
bptest = Blueprint('bptest', __name__)
from . import views, tasks | [
"flask.Blueprint"
] | [((81, 110), 'flask.Blueprint', 'Blueprint', (['"""bptest"""', '__name__'], {}), "('bptest', __name__)\n", (90, 110), False, 'from flask import Blueprint\n')] |
from app import db
class Book(object):
pass
class User(db.DynamicDocument):
email = db.StringField(required=True, unique=True)
# hash_pw = db.BinaryField(required=True)
password = db.BinaryField()
firstname = db.StringField(default='')
lastname = db.StringField(default='')
meta = {'coll... | [
"app.db.StringField",
"app.db.BinaryField"
] | [((96, 138), 'app.db.StringField', 'db.StringField', ([], {'required': '(True)', 'unique': '(True)'}), '(required=True, unique=True)\n', (110, 138), False, 'from app import db\n'), ((200, 216), 'app.db.BinaryField', 'db.BinaryField', ([], {}), '()\n', (214, 216), False, 'from app import db\n'), ((233, 259), 'app.db.Str... |
from flask import Markup
CHEM_NAMES = {
"PM2.5" : "PM<sub>2.5</sub>",
"SO2" : "SO<sub>2</sub>",
"NO2" : "NO<sub>2</sub>",
"OZONE" : "ozone",
}
HEALTH_RISKS = {
"PM2.5" : "Long-term exposure increases the risk of death from <a href=\"https://www.ncbi.nlm.nih.gov/pubmed/20458016\">heart disease</a> ... | [
"flask.Markup"
] | [((8485, 8497), 'flask.Markup', 'Markup', (['info'], {}), '(info)\n', (8491, 8497), False, 'from flask import Markup\n'), ((8499, 8511), 'flask.Markup', 'Markup', (['dist'], {}), '(dist)\n', (8505, 8511), False, 'from flask import Markup\n'), ((8513, 8525), 'flask.Markup', 'Markup', (['read'], {}), '(read)\n', (8519, 8... |
from flatland import String
from flatland.out.generic import Markup
from tests._util import assert_raises
from tests.markup._util import render_genshi as render, need
TemplateSyntaxError = None
schema = String.named('element').using(default='val')
@need('genshi')
def setup():
global TemplateSyntaxError
fro... | [
"tests.markup._util.render_genshi",
"tests._util.assert_raises",
"tests.markup._util.need",
"flatland.out.generic.Markup",
"flatland.String.named"
] | [((254, 268), 'tests.markup._util.need', 'need', (['"""genshi"""'], {}), "('genshi')\n", (258, 268), False, 'from tests.markup._util import render_genshi as render, need\n'), ((483, 534), 'tests._util.assert_raises', 'assert_raises', (['RuntimeError', 'genshi.setup', 'template'], {}), '(RuntimeError, genshi.setup, temp... |
'''
Created on 26 Aug 2018
@author: si
'''
import glob
from SimplifyRoute.gpx_io import GpxIo
from SimplifyRoute.gis_utils import distance_on_unit_sphere
distance_threshold = 0.2 # km
def simplify_route(input_path, output_path):
"""
super naive way to simplify number of points.
prints some stats to STDO... | [
"SimplifyRoute.gis_utils.distance_on_unit_sphere",
"SimplifyRoute.gpx_io.GpxIo",
"glob.glob"
] | [((1062, 1093), 'glob.glob', 'glob.glob', (["(source_dir + '*.gpx')"], {}), "(source_dir + '*.gpx')\n", (1071, 1093), False, 'import glob\n'), ((341, 358), 'SimplifyRoute.gpx_io.GpxIo', 'GpxIo', (['input_path'], {}), '(input_path)\n', (346, 358), False, 'from SimplifyRoute.gpx_io import GpxIo\n'), ((871, 889), 'Simplif... |
from django import forms
from django.contrib.auth.models import User
from django.contrib.auth.forms import UserChangeForm, UserCreationForm
class RegistrationForm(UserCreationForm):
email = forms.EmailField()
bio = forms.CharField()
class Meta:
model = User
fields=['username','email','bio', '<PASSWORD>... | [
"django.forms.EmailField",
"django.forms.CharField"
] | [((194, 212), 'django.forms.EmailField', 'forms.EmailField', ([], {}), '()\n', (210, 212), False, 'from django import forms\n'), ((221, 238), 'django.forms.CharField', 'forms.CharField', ([], {}), '()\n', (236, 238), False, 'from django import forms\n'), ((755, 773), 'django.forms.EmailField', 'forms.EmailField', ([], ... |
import os
from matplotlib.pyplot import figure
import matplotlib.pyplot as plt
from textwrap import wrap
from src.output_option.output_option import OutputOptionInterface
class GraphOutputOption(OutputOptionInterface):
def __init__(self, **kwargs):
"""
Args:
dir_path: Path to dir.
... | [
"matplotlib.pyplot.ylabel",
"os.path.join",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.bar",
"os.path.isdir",
"textwrap.wrap",
"matplotlib.pyplot.title",
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.suptitle"
] | [((1251, 1323), 'matplotlib.pyplot.figure', 'figure', ([], {'num': 'None', 'figsize': '(11, 11)', 'dpi': '(80)', 'facecolor': '"""w"""', 'edgecolor': '"""k"""'}), "(num=None, figsize=(11, 11), dpi=80, facecolor='w', edgecolor='k')\n", (1257, 1323), False, 'from matplotlib.pyplot import figure\n'), ((1332, 1352), 'matpl... |
import sys
from urllib.request import urlopen
from time import sleep
import Adafruit_DHT as dht
# Enter Your API key here
myAPI = '<KEY>'
# URL where we will send the data, Don't change it
baseURL = 'https://api.thingspeak.com/update?api_key=%s' % myAPI
def DHT22_data():
# Reading from DHT22 and storing the tem... | [
"Adafruit_DHT.read_retry",
"urllib.request.urlopen",
"time.sleep"
] | [((359, 387), 'Adafruit_DHT.read_retry', 'dht.read_retry', (['dht.DHT22', '(4)'], {}), '(dht.DHT22, 4)\n', (373, 387), True, 'import Adafruit_DHT as dht\n'), ((1183, 1192), 'time.sleep', 'sleep', (['(60)'], {}), '(60)\n', (1188, 1192), False, 'from time import sleep\n'), ((882, 938), 'urllib.request.urlopen', 'urlopen'... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from helpers.unit import UnitHelper
from helpers.zmq import ZMQHelper
from mocks.bondster.server import BondsterMock
from mocks.vault.server import VaultMock
from mocks.ledger.server import LedgerMock
from helpers.statsd import StatsdHelper
from helpers.logger import logg... | [
"mocks.vault.server.VaultMock",
"mocks.ledger.server.LedgerMock",
"helpers.logger.logger",
"helpers.zmq.ZMQHelper",
"helpers.unit.UnitHelper",
"mocks.bondster.server.BondsterMock",
"helpers.statsd.StatsdHelper"
] | [((817, 825), 'helpers.logger.logger', 'logger', ([], {}), '()\n', (823, 825), False, 'from helpers.logger import logger\n'), ((843, 862), 'helpers.unit.UnitHelper', 'UnitHelper', (['context'], {}), '(context)\n', (853, 862), False, 'from helpers.unit import UnitHelper\n'), ((879, 897), 'helpers.zmq.ZMQHelper', 'ZMQHel... |
""" Matrix profile anomaly detection.
Reference:
<NAME>., <NAME>., <NAME>., <NAME>., <NAME>., <NAME>., <NAME>. (2016, December).
Matrix profile I: all pairs similarity joins for time series: a unifying view that includes motifs, discords and shapelets.
In Data Mining (ICDM), 2016 IEEE 16th International Co... | [
"pandas.Series",
"numpy.sqrt",
"numpy.ones",
"numpy.arange",
"numpy.divide",
"numpy.round",
"numpy.sort",
"numpy.where",
"scipy.signal.fftconvolve",
"numpy.array",
"numpy.zeros",
"numpy.dot",
"numpy.sum",
"numpy.concatenate",
"numpy.linalg.norm",
"numpy.cumsum",
"numpy.nan_to_num",
... | [((1605, 1621), 'numpy.nan_to_num', 'np.nan_to_num', (['T'], {}), '(T)\n', (1618, 1621), True, 'import numpy as np\n'), ((1685, 1697), 'pandas.Series', 'pd.Series', (['T'], {}), '(T)\n', (1694, 1697), True, 'import pandas as pd\n'), ((3673, 3685), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (3681, 3685), True, '... |
from PIL import Image
import numpy as np
import torch
from torchvision import transforms
def _load_image(filename):
try:
with open(filename, "rb") as f:
image = Image.open(f)
return image.convert("RGB")
except UserWarning as e:
print(filename)
input("Something ... | [
"PIL.Image.new",
"PIL.Image.open"
] | [((188, 201), 'PIL.Image.open', 'Image.open', (['f'], {}), '(f)\n', (198, 201), False, 'from PIL import Image\n'), ((774, 788), 'PIL.Image.open', 'Image.open', (['fn'], {}), '(fn)\n', (784, 788), False, 'from PIL import Image\n'), ((900, 927), 'PIL.Image.new', 'Image.new', (['img.mode', '(W, W)'], {}), '(img.mode, (W, ... |
from ._affiliation import Affiliation as _Affiliation
__all__ = ["Affiliations"]
def _generate_affiliation_uid():
import uuid as _uuid
uid = _uuid.uuid4()
return "A" + str(uid)[:7]
class Affiliations:
"""This holds a registry of individual
Affiliations
"""
def __init__(self, props=N... | [
"uuid.uuid4"
] | [((153, 166), 'uuid.uuid4', '_uuid.uuid4', ([], {}), '()\n', (164, 166), True, 'import uuid as _uuid\n')] |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2016-2021 CERN.
# Copyright (C) 2022 Graz University of Technology.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Celery tasks for fixtures... | [
"elasticsearch_dsl.Q",
"invenio_records_resources.services.uow.RecordIndexOp",
"invenio_records_resources.services.uow.unit_of_work",
"datetime.datetime.utcnow"
] | [((1165, 1179), 'invenio_records_resources.services.uow.unit_of_work', 'unit_of_work', ([], {}), '()\n', (1177, 1179), False, 'from invenio_records_resources.services.uow import RecordIndexOp, unit_of_work\n'), ((1129, 1146), 'datetime.datetime.utcnow', 'datetime.utcnow', ([], {}), '()\n', (1144, 1146), False, 'from da... |
import math
def length(x1,y1,c1,c2,r):
len_ = 0
len_ = math.sqrt((c1-x1)**2 + (c2-y1)**2)
if(len_ >= r):
return 0;
else:
return 1;
count = 0
T = int(input())
for i in range(T):
x1, y1, x2, y2 = map(int, input().split())
N = int(input())
for l in range(N):
c1, c2, r ... | [
"math.sqrt"
] | [((64, 106), 'math.sqrt', 'math.sqrt', (['((c1 - x1) ** 2 + (c2 - y1) ** 2)'], {}), '((c1 - x1) ** 2 + (c2 - y1) ** 2)\n', (73, 106), False, 'import math\n')] |
import numpy as np
import random
def is_valid(pos, board):
try:
board[pos[0]][pos[1]]
except IndexError:
return False
if min(pos) < 0:
return False
return True
def _next_move(pos, board):
moves = {
"RIGHT": np.array((0, 1)),
"UP": np.array((-1, 0)),
... | [
"numpy.array",
"random.randint"
] | [((263, 279), 'numpy.array', 'np.array', (['(0, 1)'], {}), '((0, 1))\n', (271, 279), True, 'import numpy as np\n'), ((295, 312), 'numpy.array', 'np.array', (['(-1, 0)'], {}), '((-1, 0))\n', (303, 312), True, 'import numpy as np\n'), ((330, 347), 'numpy.array', 'np.array', (['(0, -1)'], {}), '((0, -1))\n', (338, 347), T... |
#! /usr/bin/python
from __future__ import print_function
try:
import ConfigParser
except:
import configparser as ConfigParser
import os
import simplejson,sys
from future.standard_library import install_aliases
install_aliases()
from urllib.parse import urlparse, urlencode
from urllib.request import urlopen, Request... | [
"os.path.exists",
"simplejson.dumps",
"urllib.request.Request",
"future.standard_library.install_aliases",
"configparser.RawConfigParser",
"urllib.request.urlopen",
"os.path.expanduser"
] | [((213, 230), 'future.standard_library.install_aliases', 'install_aliases', ([], {}), '()\n', (228, 230), False, 'from future.standard_library import install_aliases\n'), ((480, 510), 'configparser.RawConfigParser', 'ConfigParser.RawConfigParser', ([], {}), '()\n', (508, 510), True, 'import configparser as ConfigParser... |
from prepare_data import *
from sklearn.model_selection import train_test_split as tts
from keras.models import Sequential,Model
from keras.layers import Input,Dense, Dropout
from keras.utils import np_utils
from nets.MLP import mlp
from nets.conv import conv
from nets.cnn_inception import inception_module
from random ... | [
"sklearn.model_selection.train_test_split",
"keras.utils.np_utils.to_categorical"
] | [((1227, 1263), 'sklearn.model_selection.train_test_split', 'tts', (['objects', 'labels'], {'test_size': '(0.05)'}), '(objects, labels, test_size=0.05)\n', (1230, 1263), True, 'from sklearn.model_selection import train_test_split as tts\n'), ((1294, 1337), 'keras.utils.np_utils.to_categorical', 'np_utils.to_categorical... |
# -*- coding: utf-8 -*-
# @Author: gzliuxin
# @Email: <EMAIL>
# @Date: 2017-07-14 19:47:51
from poco.pocofw import Poco
from poco.agent import PocoAgent
from poco.freezeui.hierarchy import FrozenUIHierarchy, FrozenUIDumper
from poco.utils.simplerpc.utils import sync_wrapper
from poco.utils.airtest import AirtestInp... | [
"urlparse.urlparse",
"airtest.core.api.device",
"airtest.core.helper.device_platform",
"poco.utils.airtest.AirtestScreen",
"poco.utils.simplerpc.rpcclient.RpcClient",
"airtest.core.api.connect_device",
"poco.utils.airtest.AirtestInput"
] | [((1018, 1046), 'airtest.core.helper.device_platform', 'device_platform', (['self.device'], {}), '(self.device)\n', (1033, 1046), False, 'from airtest.core.helper import device_platform\n'), ((1707, 1727), 'poco.utils.simplerpc.rpcclient.RpcClient', 'RpcClient', (['self.conn'], {}), '(self.conn)\n', (1716, 1727), False... |
"""
Tests on the ML-20M data set.
"""
import logging
from pathlib import Path
import pandas as pd
import numpy as np
from lenskit.datasets import MovieLens
from lenskit import crossfold as xf
from lenskit.metrics import predict as pm
from lenskit import batch
from lenskit.algorithms import Recommender
from lenskit.a... | [
"logging.getLogger",
"pytest.approx",
"lenskit.algorithms.Recommender.adapt",
"lenskit.algorithms.als.BiasedMF",
"lenskit.datasets.MovieLens",
"pathlib.Path",
"lenskit.crossfold.SampleFrac",
"lenskit.metrics.predict.rmse",
"lenskit.batch.recommend",
"lenskit.metrics.predict.mae",
"pytest.mark.pa... | [((621, 648), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (638, 648), False, 'import logging\n'), ((661, 680), 'pathlib.Path', 'Path', (['"""data/ml-20m"""'], {}), "('data/ml-20m')\n", (665, 680), False, 'from pathlib import Path\n'), ((937, 978), 'pytest.mark.parametrize', 'pytest.mar... |
import math
import numpy as np
import scipy.stats as stats
def calc_cubic(a, b, c, d):
p = -b / (3 * a)
q = math.pow(p, 3) + (b * c - 3 * a * d) / (6 * math.pow(a, 2))
r = c / (3 * a)
x = (
math.pow(
q + (math.pow(math.pow(q, 2) + (math.pow(r - math.pow(p, 2), 3)), 0.5)), 1 / 3, ... | [
"math.pow",
"scipy.stats.truncnorm.rvs"
] | [((768, 860), 'scipy.stats.truncnorm.rvs', 'stats.truncnorm.rvs', ([], {'a': '((clip_a - mean) / sd)', 'b': '((clip_b - mean) / sd)', 'loc': 'mean', 'scale': 'sd'}), '(a=(clip_a - mean) / sd, b=(clip_b - mean) / sd, loc=\n mean, scale=sd)\n', (787, 860), True, 'import scipy.stats as stats\n'), ((118, 132), 'math.pow... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
@Author: <NAME>
@License: Apache Licence
@Time: 2019.10.25 : 下午 8:24
@File Name: videoReid.py
@Software: PyCharm
-----------------
"""
import os
from options import parser_args
from torch.utils.data.sampler import SubsetRandomSampler
from prepareDataset import ReIDDa... | [
"options.parser_args",
"pickle.dump",
"prepareDataset.ReIDDataset",
"test.compute_cmc",
"os.path.join",
"train.train_sequence",
"train.load_weight",
"torchnet.logger.VisdomPlotLogger",
"logging.info"
] | [((638, 651), 'options.parser_args', 'parser_args', ([], {}), '()\n', (649, 651), False, 'from options import parser_args\n'), ((1198, 1251), 'logging.info', 'log.info', (['"""loading Dataset - """', 'seqRootRGB', 'seqRootOF'], {}), "('loading Dataset - ', seqRootRGB, seqRootOF)\n", (1206, 1251), True, 'import logging ... |
from flask import Flask, render_template, request
app = Flask(__name__) # Turns current file into an application
# Specifying URL path/route
@app.route("/") # `@` is a specialy Python declarator
def index():
# Render HTML template
# Use the `request` library to parse URL input "name" and store in variable `n... | [
"flask.render_template",
"flask.request.form.get",
"flask.Flask"
] | [((57, 72), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (62, 72), False, 'from flask import Flask, render_template, request\n'), ((378, 407), 'flask.render_template', 'render_template', (['"""index.html"""'], {}), "('index.html')\n", (393, 407), False, 'from flask import Flask, render_template, request\... |
import numpy as np
import cv2
import collections
import numbers
import random
import math
import copy
from up.data.datasets.transforms import Augmentation
from up.utils.general.registry_factory import AUGMENTATION_REGISTRY
@AUGMENTATION_REGISTRY.register('color_jitter_mmseg')
class RandomColorJitterMMSeg(Augmentatio... | [
"numpy.clip",
"numpy.uint8",
"up.utils.general.registry_factory.AUGMENTATION_REGISTRY.register",
"math.sqrt",
"numpy.asanyarray",
"copy.copy",
"numpy.asarray",
"random.randint",
"random.uniform",
"cv2.warpAffine",
"random.choice",
"numpy.random.choice",
"numpy.around",
"cv2.cvtColor",
"c... | [((227, 279), 'up.utils.general.registry_factory.AUGMENTATION_REGISTRY.register', 'AUGMENTATION_REGISTRY.register', (['"""color_jitter_mmseg"""'], {}), "('color_jitter_mmseg')\n", (257, 279), False, 'from up.utils.general.registry_factory import AUGMENTATION_REGISTRY\n'), ((3806, 3850), 'up.utils.general.registry_facto... |
from django import forms
from django.forms.widgets import RadioSelect
from django.contrib.admin.widgets import AdminDateWidget
from django.forms.fields import DateField
from django.core.exceptions import ValidationError
from django.utils import timezone
from django.utils.translation import gettext_lazy as _
from vote.... | [
"django.forms.Textarea",
"django.utils.timezone.now",
"django.utils.translation.gettext_lazy",
"django.forms.TextInput"
] | [((987, 1005), 'django.utils.translation.gettext_lazy', '_', (['"""Election name"""'], {}), "('Election name')\n", (988, 1005), True, 'from django.utils.translation import gettext_lazy as _\n'), ((1070, 1118), 'django.forms.TextInput', 'forms.TextInput', ([], {'attrs': "{'class': 'form-control'}"}), "(attrs={'class': '... |
import unittest
from runpandarun import Datastore
class Test(unittest.TestCase):
# base fetching logic see `tests.test_datastore`
def setUp(self):
self.store = Datastore('./example/config.yml')
self.dataset = self.store.datasets[0]
def test_dedup_update_by_hash(self):
ds = self... | [
"runpandarun.Datastore"
] | [((181, 214), 'runpandarun.Datastore', 'Datastore', (['"""./example/config.yml"""'], {}), "('./example/config.yml')\n", (190, 214), False, 'from runpandarun import Datastore\n')] |
from ex109 import moeda
valor = float(input('Informe um valor: R$'))
print(f'A metade de {moeda.moeda(valor)}, é {moeda.metade(valor, True)}.')
print(f'O dobro de {moeda.moeda(valor)}, é {moeda.dobro(valor, True)}.')
print(f'Com aumento de 10%, fica {moeda.aumentar(valor, 10, True)}.')
print(f'Com 15% de desconto, fica... | [
"ex109.moeda.moeda",
"ex109.moeda.dobro",
"ex109.moeda.diminuir",
"ex109.moeda.aumentar",
"ex109.moeda.metade"
] | [((90, 108), 'ex109.moeda.moeda', 'moeda.moeda', (['valor'], {}), '(valor)\n', (101, 108), False, 'from ex109 import moeda\n'), ((115, 140), 'ex109.moeda.metade', 'moeda.metade', (['valor', '(True)'], {}), '(valor, True)\n', (127, 140), False, 'from ex109 import moeda\n'), ((164, 182), 'ex109.moeda.moeda', 'moeda.moeda... |
"""Testing DistributionalDataset."""
import unittest
import torch
from pytoda.datasets import DistributionalDataset
from pytoda.datasets.utils.factories import DISTRIBUTION_FUNCTION_FACTORY
distribution_types = ['normal', 'uniform']
distribution_args = [{'loc': 0.0, 'scale': 1.0}, {'low': 0.0, 'high': 1.0}]
dataset_... | [
"unittest.main",
"torch.equal",
"pytoda.datasets.DistributionalDataset"
] | [((2395, 2410), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2408, 2410), False, 'import unittest\n'), ((914, 982), 'pytoda.datasets.DistributionalDataset', 'DistributionalDataset', (['size', 'shape', 'distribution_function'], {'seed': 'seed'}), '(size, shape, distribution_function, seed=seed)\n', (935, 982), F... |
# Crichton, Admirable Source Configuration Management
# Copyright 2012 British Broadcasting Corporation
#
# 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/licens... | [
"httplib2.Http",
"urlparse.urlparse"
] | [((1323, 1336), 'urlparse.urlparse', 'urlparse', (['url'], {}), '(url)\n', (1331, 1336), False, 'from urlparse import urlparse\n'), ((1446, 1486), 'httplib2.Http', 'httplib2.Http', ([], {'cache': 'cache', 'timeout': '(1000)'}), '(cache=cache, timeout=1000)\n', (1459, 1486), False, 'import httplib2\n')] |
import torch
from torch import nn
from .utils import Conv, ConcatBlock
class PathAggregationNetwork(nn.Module):
def __init__(self, in_channels_list, depth):
super().__init__()
self.inner_blocks = nn.ModuleList()
self.layer_blocks = nn.ModuleList()
self.upsample_blocks = nn.ModuleL... | [
"torch.nn.ModuleList",
"torch.nn.Upsample",
"torch.cat"
] | [((219, 234), 'torch.nn.ModuleList', 'nn.ModuleList', ([], {}), '()\n', (232, 234), False, 'from torch import nn\n'), ((263, 278), 'torch.nn.ModuleList', 'nn.ModuleList', ([], {}), '()\n', (276, 278), False, 'from torch import nn\n'), ((310, 325), 'torch.nn.ModuleList', 'nn.ModuleList', ([], {}), '()\n', (323, 325), Fa... |
""" Dummy version of GPIO """
from random import randint
BCM = 1
IN = 2
PUD_DOWN = 3
FALLING = 4
RELEASE = 5
def setmode(mode=None):
""" Docstring """
pass
def setup(pin=None, IO=None, pull_up_down=None):
""" Docstring """
pass
def add_event_detect(pin=None, edge=None, callback=None, bouncetime=N... | [
"random.randint"
] | [((454, 468), 'random.randint', 'randint', (['(0)', '(10)'], {}), '(0, 10)\n', (461, 468), False, 'from random import randint\n'), ((579, 593), 'random.randint', 'randint', (['(0)', '(10)'], {}), '(0, 10)\n', (586, 593), False, 'from random import randint\n')] |
import pygame
from game.globals import GameRunning, Clock, FPS, GameTitle
from game.gameState import GameState
pygame.init()
pygame.display.set_caption(GameTitle)
state = GameState()
while GameRunning:
Clock.tick(FPS)
GameRunning = state.render()
pygame.display.update()
pygame.quit() | [
"pygame.init",
"game.globals.Clock.tick",
"pygame.quit",
"game.gameState.GameState",
"pygame.display.set_caption",
"pygame.display.update"
] | [((112, 125), 'pygame.init', 'pygame.init', ([], {}), '()\n', (123, 125), False, 'import pygame\n'), ((126, 163), 'pygame.display.set_caption', 'pygame.display.set_caption', (['GameTitle'], {}), '(GameTitle)\n', (152, 163), False, 'import pygame\n'), ((173, 184), 'game.gameState.GameState', 'GameState', ([], {}), '()\n... |
import pyhdl.core as core
import pyhdl.parts.clock as clk
from ..common import *
test_component(clk.clock.create(),
[
[], [], [], [], [], [], [], []
],
[
[ True ],
[ False ],
[ True ],
[ False ],
[ True ],
[ False ],
[ True ],
[ False ]
]
)
| [
"pyhdl.parts.clock.clock.create"
] | [((102, 120), 'pyhdl.parts.clock.clock.create', 'clk.clock.create', ([], {}), '()\n', (118, 120), True, 'import pyhdl.parts.clock as clk\n')] |
# Generated by Django 2.2.12 on 2020-05-04 01:55
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bilbyui', '0002_auto_20200403_0346'),
]
operations = [
migrations.AddField(
model_name='bilbyjob',
name='job_id',
... | [
"django.db.models.IntegerField"
] | [((337, 393), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'blank': '(True)', 'default': 'None', 'null': '(True)'}), '(blank=True, default=None, null=True)\n', (356, 393), False, 'from django.db import migrations, models\n')] |
#!/usr/bin/env python
"""
Created by: <NAME> (2018)
Description: A simple unittest for testing the results module.
"""
import unittest
from sqlalchemy import create_engine
from io import StringIO
from pygenprop.assignment_file_parser import parse_interproscan_file_and_fasta_file
from pygenprop.database_file_parser ... | [
"sqlalchemy.create_engine",
"pygenprop.database_file_parser.parse_genome_properties_flat_file",
"pygenprop.results.GenomePropertiesResultsWithMatches",
"pygenprop.assignment_file_parser.parse_interproscan_file_and_fasta_file",
"pygenprop.results.load_results_from_serialization",
"pygenprop.results.load_as... | [((1735, 1761), 'sqlalchemy.create_engine', 'create_engine', (['"""sqlite://"""'], {}), "('sqlite://')\n", (1748, 1761), False, 'from sqlalchemy import create_engine\n'), ((1894, 2000), 'pygenprop.results.GenomePropertiesResultsWithMatches', 'GenomePropertiesResultsWithMatches', (['*self.test_genome_property_results'],... |
# -*- coding: utf-8 -*-
"""
Jinja2 templates for deform.
To use in Pyramid:
In your settings.ini::
# default:
# deform_jinja2.i18n.domain=deform
# One of:
deform_jinja2.template_search_path=deform_jinja2:templates
deform_jinja2.template_search_path=deform_jinja2:uni_templates
deform_jinja2.t... | [
"jinja2.FileSystemLoader",
"deform.Form.set_default_renderer",
"jinja2.Environment",
"translator.PyramidTranslator"
] | [((2229, 2271), 'deform.Form.set_default_renderer', 'deform.Form.set_default_renderer', (['renderer'], {}), '(renderer)\n', (2261, 2271), False, 'import deform\n'), ((1071, 1105), 'jinja2.Environment', 'Environment', ([], {'extensions': 'extensions'}), '(extensions=extensions)\n', (1082, 1105), False, 'from jinja2 impo... |
import datetime
from app import app, db
from flask import flash, render_template, request, redirect
from wtforms import Form, IntegerField, StringField
class Survey:
__tablename__ = "surveys"
id = int()
description = str()
start_date = datetime.date
end_date = datetime.date
def __init__(sel... | [
"flask.render_template",
"wtforms.IntegerField",
"wtforms.StringField",
"app.db.xact",
"flask.redirect",
"app.db.prepare",
"app.app.route"
] | [((580, 631), 'app.app.route', 'app.route', (['"""/addNewSurvey"""'], {'methods': "['GET', 'POST']"}), "('/addNewSurvey', methods=['GET', 'POST'])\n", (589, 631), False, 'from app import app, db\n'), ((1106, 1157), 'app.app.route', 'app.route', (['"""/printSurveys"""'], {'methods': "['GET', 'POST']"}), "('/printSurveys... |
from twitter_ads_v2.utils import CustomDecorators
def test_decorator_deprecated():
import warnings
class TestClass(object):
@classmethod
@CustomDecorators.deprecated('deprecated API')
def test(self):
pass
with warnings.catch_warnings(record=True) as log:
TestC... | [
"warnings.catch_warnings",
"twitter_ads_v2.utils.CustomDecorators.deprecated"
] | [((165, 210), 'twitter_ads_v2.utils.CustomDecorators.deprecated', 'CustomDecorators.deprecated', (['"""deprecated API"""'], {}), "('deprecated API')\n", (192, 210), False, 'from twitter_ads_v2.utils import CustomDecorators\n'), ((262, 298), 'warnings.catch_warnings', 'warnings.catch_warnings', ([], {'record': '(True)'}... |
from numpy.core.numeric import count_nonzero
import pandas as pd
import numpy as np
import re
data = pd.read_csv("data/day13.csv", header = None, dtype=str, delimiter= '\n')[0]
codes = [re.split("\s\S\S\s", word) for word in data.values][1:]
# Challenge 1
word = np.array(data.values)[0]
c_dic = {c[0]:c[1] for c in co... | [
"numpy.array",
"pandas.read_csv",
"re.split"
] | [((102, 171), 'pandas.read_csv', 'pd.read_csv', (['"""data/day13.csv"""'], {'header': 'None', 'dtype': 'str', 'delimiter': '"""\n"""'}), "('data/day13.csv', header=None, dtype=str, delimiter='\\n')\n", (113, 171), True, 'import pandas as pd\n'), ((265, 286), 'numpy.array', 'np.array', (['data.values'], {}), '(data.valu... |
"""
Namespace Manager
-----------------
The namespace manager is the interface between data and the databases. Use the
namespace manager to save data to the database and perform simple queries.
The namespace manager can handle many DBMS. See the db_connections folder to
see the files that connect different types of d... | [
"os.path.join"
] | [((836, 897), 'os.path.join', 'os.path.join', (['aleph_root_folder', '"""local"""', '"""backup"""', '"""msql.db"""'], {}), "(aleph_root_folder, 'local', 'backup', 'msql.db')\n", (848, 897), False, 'import os\n')] |
# -*- coding: utf-8 -*-
import io
import logging
import pandas as pd
import requests
from zvt.api import china_stock_code_to_id
from zvt.recorders.consts import DEFAULT_HEADER
from zvt.utils import now_pd_timestamp
logger = logging.getLogger(__name__)
original_page_url = "http://www.csindex.com.cn/zh-CN/downloads/i... | [
"logging.getLogger",
"io.BytesIO",
"pandas.to_datetime",
"zvt.utils.now_pd_timestamp"
] | [((227, 254), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (244, 254), False, 'import logging\n'), ((1317, 1348), 'pandas.to_datetime', 'pd.to_datetime', (["df['timestamp']"], {}), "(df['timestamp'])\n", (1331, 1348), True, 'import pandas as pd\n'), ((678, 706), 'io.BytesIO', 'io.BytesI... |
from utils.myloader import MyLoader
from utils.imageshow import func_showImage, func_rearrangeRGB
from models import FCNs
from config import *
from torch.utils.data import DataLoader
import torchvision.transforms as T
import torch.optim as optim
import torch.nn as nn
import torch
import matplotlib.pyplot as plt
tra... | [
"matplotlib.pyplot.imshow",
"models.FCNs",
"utils.myloader.MyLoader",
"torch.utils.data.DataLoader",
"torch.nn.BCEWithLogitsLoss",
"torchvision.transforms.ToTensor",
"matplotlib.pyplot.show"
] | [((375, 467), 'utils.myloader.MyLoader', 'MyLoader', ([], {'path_src': '"""../data/camseq01"""', 'path_label': '"""../data/mask"""', 'transforms': 'transforms'}), "(path_src='../data/camseq01', path_label='../data/mask', transforms\n =transforms)\n", (383, 467), False, 'from utils.myloader import MyLoader\n'), ((477... |
import argparse
import pickle
import numpy as np
from numba import njit
@njit
def count_trees(tau, phi, order, traversal):
assert traversal == 'dfs' or traversal == 'bfs'
K = len(tau)
expected_colsum = np.ones(K)
expected_colsum[0] = 0
first_partial = np.copy(tau)
np.fill_diagonal(first_partial, 0)
firs... | [
"numpy.copy",
"numpy.eye",
"numpy.ones",
"argparse.ArgumentParser",
"pickle.load",
"numpy.fill_diagonal",
"numpy.any",
"numpy.argsort",
"numpy.sum",
"numpy.nonzero",
"numpy.all"
] | [((209, 219), 'numpy.ones', 'np.ones', (['K'], {}), '(K)\n', (216, 219), True, 'import numpy as np\n'), ((264, 276), 'numpy.copy', 'np.copy', (['tau'], {}), '(tau)\n', (271, 276), True, 'import numpy as np\n'), ((279, 313), 'numpy.fill_diagonal', 'np.fill_diagonal', (['first_partial', '(0)'], {}), '(first_partial, 0)\n... |
import numpy as np
class OUNoiseGenerator(object):
def __init__(self, action_dim, action_low, action_high,
mu=0.0, theta=0.15, max_sigma=0.3, min_sigma=0.3, decay_period=100000):
self.mu_ = mu
self.theta_ = theta
self.sigma_ = max_sigma
self.max_sigma_ = max_sigma
... | [
"numpy.clip",
"numpy.random.randn",
"numpy.ones"
] | [((1035, 1084), 'numpy.clip', 'np.clip', (['(action + ou_state)', 'self.low_', 'self.high_'], {}), '(action + ou_state, self.low_, self.high_)\n', (1042, 1084), True, 'import numpy as np\n'), ((592, 617), 'numpy.ones', 'np.ones', (['self.action_dim_'], {}), '(self.action_dim_)\n', (599, 617), True, 'import numpy as np\... |
#!/usr/bin/env python
#
# Copyright (c) 2021, Apple Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-3-clause license that can be
# found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
# Construct a valid wheel build tag with ``git describe``.
#
# We do this with p... | [
"subprocess.check_output"
] | [((655, 740), 'subprocess.check_output', 'subprocess.check_output', (["['git', '-C', git_dir, 'describe', '--tags']"], {'text': '(True)'}), "(['git', '-C', git_dir, 'describe', '--tags'], text=True\n )\n", (678, 740), False, 'import subprocess\n')] |
# -*- coding:utf-8 -*-
# Copyright 2015 NEC Corporation. #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); #
# you may not use this file except in compliance with the License... | [
"unittest.main",
"org.o3project.odenos.core.component.network.flow.ofpflow.ofp_flow_action_group_action.OFPFlowActionGroupAction",
"org.o3project.odenos.core.component.network.flow.ofpflow.ofp_flow_action_group_action.OFPFlowActionGroupAction.create_from_packed"
] | [((2528, 2543), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2541, 2543), False, 'import unittest\n'), ((1272, 1330), 'org.o3project.odenos.core.component.network.flow.ofpflow.ofp_flow_action_group_action.OFPFlowActionGroupAction', 'OFPFlowActionGroupAction', (['"""OFPFlowActionGroupAction"""', '(1234)'], {}), ... |
import zlib
import binascii
from base64 import b64decode, b64encode
from Crypto.Cipher import AES
from eventsourcing.exceptions import DataIntegrityError
from eventsourcing.utils.random import random_bytes
class AESCipher(object):
"""
Cipher strategy that uses Crypto library AES cipher in GCM mode.
"""... | [
"eventsourcing.utils.random.random_bytes",
"Crypto.Cipher.AES.new",
"eventsourcing.exceptions.DataIntegrityError"
] | [((1647, 1692), 'Crypto.Cipher.AES.new', 'AES.new', (['self.cipher_key', 'AES.MODE_GCM', 'nonce'], {}), '(self.cipher_key, AES.MODE_GCM, nonce)\n', (1654, 1692), False, 'from Crypto.Cipher import AES\n'), ((1334, 1400), 'eventsourcing.exceptions.DataIntegrityError', 'DataIntegrityError', (['"""Cipher text is damaged: i... |
"""empty message
Revision ID: 826cfe070dc1
Revises: 3364a8eb<PASSWORD>
Create Date: 2018-09-09 12:38:34.795237
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '826cfe070dc1'
down_revision = '3364a<PASSWORD>'
branch_labels = None
depends_on = None
def upgrade(... | [
"sqlalchemy.String",
"alembic.op.drop_column"
] | [((595, 625), 'alembic.op.drop_column', 'op.drop_column', (['"""users"""', '"""dob"""'], {}), "('users', 'dob')\n", (609, 625), False, 'from alembic import op\n'), ((433, 453), 'sqlalchemy.String', 'sa.String', ([], {'length': '(80)'}), '(length=80)\n', (442, 453), True, 'import sqlalchemy as sa\n')] |
# Generated by Django 3.2 on 2022-01-22 10:14
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('archives', '0017_alter_report_type'),
]
operations = [
migrations.CreateModel(
name='AgencyDivision',
fields=[
... | [
"django.db.models.TextField",
"django.db.models.FileField",
"django.db.models.BigAutoField",
"django.db.models.CharField"
] | [((1114, 1168), 'django.db.models.FileField', 'models.FileField', ([], {'null': '(True)', 'upload_to': '"""agency_images"""'}), "(null=True, upload_to='agency_images')\n", (1130, 1168), False, 'from django.db import migrations, models\n'), ((1288, 1320), 'django.db.models.CharField', 'models.CharField', ([], {'max_leng... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2019-01-20 02:45
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('profiles', '0003_auto_20190120_0245'),
('kratos', '000... | [
"django.db.models.ForeignKey"
] | [((483, 621), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'blank': '(True)', 'null': '(True)', 'on_delete': 'django.db.models.deletion.CASCADE', 'related_name': '"""amb_user"""', 'to': '"""profiles.Profile"""'}), "(blank=True, null=True, on_delete=django.db.models.\n deletion.CASCADE, related_name='amb... |
import torch
import torch.nn as nn
import torch.nn.functional as F
class WeightedRegLoss(nn.Module):
def __init__(self):
super().__init__()
def forward(self, pred, gt, mask):
assert pred.size() == gt.size()
mask = mask[:, None, :, :].expand_as(pred)
denom = max(mask.sum(), 1)
... | [
"torch.gt",
"torch.sigmoid",
"torch.logical_not",
"torch.nn.MSELoss",
"torch.tensor",
"torch.flatten"
] | [((678, 710), 'torch.flatten', 'torch.flatten', (['pred'], {'start_dim': '(2)'}), '(pred, start_dim=2)\n', (691, 710), False, 'import torch\n'), ((724, 754), 'torch.flatten', 'torch.flatten', (['gt'], {'start_dim': '(2)'}), '(gt, start_dim=2)\n', (737, 754), False, 'import torch\n'), ((1754, 1773), 'torch.sigmoid', 'to... |