code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from MDRSREID.Loss_Meter import Loss
import torch.nn as nn
import torch
from MDRSREID.utils.meter import RecentAverageMeter as Meter
class IDLoss(Loss):
def __init__(self, cfg, tb_writer=None):
super(IDLoss, self).__init__(cfg, tb_writer=tb_writer)
self.criterion = nn.CrossEntropyLoss(reduction='n... | [
"MDRSREID.utils.meter.RecentAverageMeter",
"torch.stack",
"torch.nn.CrossEntropyLoss"
] | [((288, 325), 'torch.nn.CrossEntropyLoss', 'nn.CrossEntropyLoss', ([], {'reduction': '"""none"""'}), "(reduction='none')\n", (307, 325), True, 'import torch.nn as nn\n'), ((1395, 1420), 'MDRSREID.utils.meter.RecentAverageMeter', 'Meter', ([], {'name': 'self.cfg.name'}), '(name=self.cfg.name)\n', (1400, 1420), True, 'fr... |
#!/usr/bin/env python3
"""gashlycrumb module."""
import argparse
from typing import Sequence
DEFAULT_FILE = "gashlycrumb.txt"
def get_args(args: Sequence[str] | None = None) -> argparse.Namespace:
"""Get parsed argparse agruments."""
parser = argparse.ArgumentParser(
description="Gashlycrumb",
... | [
"argparse.FileType",
"argparse.ArgumentParser"
] | [((255, 385), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Gashlycrumb"""', 'allow_abbrev': '(False)', 'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter'}), "(description='Gashlycrumb', allow_abbrev=False,\n formatter_class=argparse.ArgumentDefaultsHelpFormatter)\n", (278, ... |
from pyprophet.data_handling import transform_pi0_lambda, \
transform_threads
from glycoprophet.runner import GlycoPeptideProphetLearner, \
GlycoPeptideProphetWeightApplier
import click
from hyperopt import hp
@click.command()
# File handling
@click.option('--in', 'infile', required=True, type=click.Path(exi... | [
"click.Choice",
"click.option",
"hyperopt.hp.quniform",
"glycoprophet.runner.GlycoPeptideProphetWeightApplier",
"hyperopt.hp.uniform",
"click.Path",
"click.command",
"glycoprophet.runner.GlycoPeptideProphetLearner"
] | [((222, 237), 'click.command', 'click.command', ([], {}), '()\n', (235, 237), False, 'import click\n'), ((653, 782), 'click.option', 'click.option', (['"""--xgb_autotune/--no-xgb_autotune"""'], {'default': '(False)', 'show_default': '(True)', 'help': '"""XGBoost: Autotune hyperparameters."""'}), "('--xgb_autotune/--no-... |
""" Resources related to starting AppServer instances. """
import logging
import os
import psutil
from tornado.options import options
from appscale.admin.constants import UNPACK_ROOT
from appscale.admin.instance_manager.constants import (
PHP_CGI_LOCATION, PIDFILE_TEMPLATE, TRUSTED_APPS)
from appscale.admin.instanc... | [
"logging.getLogger",
"psutil.Process",
"appscale.common.appscale_info.get_num_cpus",
"os.path.join",
"os.path.dirname",
"appscale.admin.instance_manager.utils.find_web_inf",
"appscale.common.constants.VERSION_PATH_SEPARATOR.join",
"appscale.admin.instance_manager.constants.PIDFILE_TEMPLATE.format"
] | [((604, 650), 'logging.getLogger', 'logging.getLogger', (['"""appscale-instance-manager"""'], {}), "('appscale-instance-manager')\n", (621, 650), False, 'import logging\n'), ((2852, 2942), 'os.path.join', 'os.path.join', (['JAVA_APPSERVER', '"""appengine-java-sdk-repacked"""', '"""bin"""', '"""dev_appserver.sh"""'], {}... |
#Description
#This Python3 script combines Afterglow PS3 USB button-press data with 2 motor activation.
#testbed information
#This was developed as a deliberately low powered and lightweight combination. It is also affordable at near $200 USD current pricing for all the parts. The Pi3 is used for it's common use,... | [
"RPi.GPIO.cleanup",
"RPi.GPIO.setup",
"RPi.GPIO.output",
"evdev.InputDevice",
"RPi.GPIO.PWM",
"RPi.GPIO.setmode"
] | [((3422, 3454), 'evdev.InputDevice', 'InputDevice', (['"""/dev/input/event0"""'], {}), "('/dev/input/event0')\n", (3433, 3454), False, 'from evdev import InputDevice, categorize, ecodes\n'), ((4062, 4084), 'RPi.GPIO.setmode', 'GPIO.setmode', (['GPIO.BCM'], {}), '(GPIO.BCM)\n', (4074, 4084), True, 'import RPi.GPIO as GP... |
import warnings
import Arena
from MCTS import MCTS
from connect4.Connect4Game import Connect4Game, display
from connect4.Connect4Players import *
from connect4.tensorflows.NNet import NNetWrapper as NNet
from utils import dotdict
warnings.filterwarnings('ignore', category=FutureWarning)
if __name__ == '__main__':
... | [
"utils.dotdict",
"connect4.Connect4Game.Connect4Game",
"MCTS.MCTS",
"connect4.tensorflows.NNet.NNetWrapper",
"Arena.Arena",
"warnings.filterwarnings"
] | [((232, 289), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'category': 'FutureWarning'}), "('ignore', category=FutureWarning)\n", (255, 289), False, 'import warnings\n'), ((326, 340), 'connect4.Connect4Game.Connect4Game', 'Connect4Game', ([], {}), '()\n', (338, 340), False, 'from connect4.C... |
import aioredis
import time
from ..util import get_dependency
from ..errors import ConfigurationError
from .base import AsyncStorage
class AsyncRedisInteractor(object):
SCRIPT_MOVING_WINDOW = """
local items = redis.call('lrange', KEYS[1], 0, tonumber(ARGV[2]))
local expiry = tonumber(ARGV... | [
"time.time"
] | [((3288, 3299), 'time.time', 'time.time', ([], {}), '()\n', (3297, 3299), False, 'import time\n')] |
# Generated by Django 3.1.3 on 2021-08-20 10:20
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('authenticate', '0005_auto_20210701_2020'),
]
operations = [
migrations.AlterField(
model_name='profile',
name='pictu... | [
"django.db.models.ImageField"
] | [((343, 441), 'django.db.models.ImageField', 'models.ImageField', ([], {'default': '"""Profile pictures/default.png"""', 'upload_to': '"""media/Profile pictures"""'}), "(default='Profile pictures/default.png', upload_to=\n 'media/Profile pictures')\n", (360, 441), False, 'from django.db import migrations, models\n')... |
#
# Copyright 2021. Clumio, Inc.
#
from typing import Any, Dict, Mapping, Optional, Sequence, Type, TypeVar
from clumioapi.models import entity_group_embedded
from clumioapi.models import organizational_unit_links
T = TypeVar('T', bound='CreateOrganizationalUnitResponse')
class CreateOrganizationalUnitResponse:
... | [
"typing.TypeVar"
] | [((221, 275), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {'bound': '"""CreateOrganizationalUnitResponse"""'}), "('T', bound='CreateOrganizationalUnitResponse')\n", (228, 275), False, 'from typing import Any, Dict, Mapping, Optional, Sequence, Type, TypeVar\n')] |
# TorchScript adapation
# https://github.com/scipy/scipy/blob/c1372d8aa90a73d8a52f135529293ff4edb98fc8/scipy/special/spfun_stats.py
import numpy as np
# from scipy.special import gammaln as loggam
import torch
import math
@torch.jit.script
def multigammaln(a, d: int):
# Python builtin <built-in function array> ... | [
"math.log"
] | [((926, 943), 'math.log', 'math.log', (['math.pi'], {}), '(math.pi)\n', (934, 943), False, 'import math\n')] |
"""Utilities to load forcefields based on forcefield names."""
import os
import foyer
def get_ff_path(
name: str = None,
):
"""Based on a forcefield name, it returns a path to that forcefield
Parameters
----------
name : str, default=None, optional
Forcefield file name to load.
"""
... | [
"os.path.abspath",
"os.path.splitext"
] | [((413, 435), 'os.path.splitext', 'os.path.splitext', (['name'], {}), '(name)\n', (429, 435), False, 'import os\n'), ((1381, 1419), 'os.path.splitext', 'os.path.splitext', (['mol2_or_smiles_input'], {}), '(mol2_or_smiles_input)\n', (1397, 1419), False, 'import os\n'), ((1596, 1634), 'os.path.splitext', 'os.path.splitex... |
import torch
import torch.nn as nn
from ever import registry
import ever as er
from ever import module as erm
class Deeplabv3pDecoder(nn.Module):
"""
This module is a reimplemented version in the following paper.
<NAME>, <NAME>, <NAME>, et al. Encoder-decoder with atrous
separable convolution for sema... | [
"ever.module.SeparableConvBlock",
"ever.module.ConvBlock",
"torch.nn.Sequential",
"torch.nn.Conv2d",
"torch.nn.UpsamplingBilinear2d",
"ever.registry.MODEL.register",
"ever.module.AtrousSpatialPyramidPool",
"torch.cat"
] | [((1912, 1937), 'ever.registry.MODEL.register', 'registry.MODEL.register', ([], {}), '()\n', (1935, 1937), False, 'from ever import registry\n'), ((854, 925), 'ever.module.ConvBlock', 'erm.ConvBlock', (['os4_feature_channels', 'reduction_dim', '(3)', '(1)', '(1)'], {'bias': '(False)'}), '(os4_feature_channels, reductio... |
# This file is part of Buildbot. Buildbot 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, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... | [
"buildbot.util.unicode2bytes",
"twisted.python.log.msg",
"twisted.internet.defer.maybeDeferred",
"zope.interface.implementer",
"buildbot.util.service.AsyncMultiService.__init__",
"buildbot.util.service.AsyncService.stopService",
"buildbot.util.bytes2NativeString",
"twisted.spread.pb.PBServerFactory",
... | [((3833, 3889), 'zope.interface.implementer', 'implementer', (['portal.IRealm', 'checkers.ICredentialsChecker'], {}), '(portal.IRealm, checkers.ICredentialsChecker)\n', (3844, 3889), False, 'from zope.interface import implementer\n'), ((1552, 1592), 'buildbot.util.service.AsyncMultiService.__init__', 'service.AsyncMult... |
#!/usr/bin/env python
import unittest
from pycoin.ecdsa import generator_secp256k1, sign, verify, public_pair_for_secret_exponent
class ECDSATestCase(unittest.TestCase):
def test_sign_verify(self):
def do_test(secret_exponent, val_list):
public_point = public_pair_for_secret_exponent(generat... | [
"unittest.main",
"pycoin.ecdsa.public_pair_for_secret_exponent",
"pycoin.ecdsa.sign",
"pycoin.ecdsa.verify"
] | [((1142, 1157), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1155, 1157), False, 'import unittest\n'), ((281, 350), 'pycoin.ecdsa.public_pair_for_secret_exponent', 'public_pair_for_secret_exponent', (['generator_secp256k1', 'secret_exponent'], {}), '(generator_secp256k1, secret_exponent)\n', (312, 350), False, ... |
import inspect, sys, traceback
from types import MethodType
from copy import copy, deepcopy
import numpy as np
from .SilkBase import SilkBase, compile_function
from .validation import (
schema_validator,
Scalar, scalar_conv, _types, infer_type, is_numpy_structure_schema, ValidationError
)
allowed_types = tuple(_ty... | [
"traceback.format_exc",
"types.MethodType",
"copy.deepcopy",
"traceback.print_exc",
"inspect.getsource"
] | [((23261, 23289), 'inspect.getsource', 'inspect.getsource', (['prop.fget'], {}), '(prop.fget)\n', (23278, 23289), False, 'import inspect, sys, traceback\n'), ((24885, 24908), 'inspect.getsource', 'inspect.getsource', (['func'], {}), '(func)\n', (24902, 24908), False, 'import inspect, sys, traceback\n'), ((25527, 25550)... |
# -*- coding: utf-8 -*-
import re
import json
from pprint import pformat
from pynetworking.Feature import Feature
try:
from collections import OrderedDict
except ImportError: # pragma: no cover
from ordereddict import OrderedDict
class ats_interface(Feature):
"""
Interface feature implementation for ... | [
"re.compile",
"pynetworking.Feature.Feature.__init__",
"json.dumps",
"pprint.pformat",
"ordereddict.OrderedDict"
] | [((382, 422), 'pynetworking.Feature.Feature.__init__', 'Feature.__init__', (['self', 'device'], {}), '(self, device, **kvargs)\n', (398, 422), False, 'from pynetworking.Feature import Feature\n'), ((688, 701), 'ordereddict.OrderedDict', 'OrderedDict', ([], {}), '()\n', (699, 701), False, 'from ordereddict import Ordere... |
# coding: utf-8
import datetime
import random
import pytest
from src.domain.exchange_rate import (
CurrencyExchangeAmountEntity, TimeWeightedRateEntity)
from src.interface.serializers.exchange_rate import (
CurrencySerializer, CurrencyExchangeRateConvertSerializer,
CurrencyExchangeRateAmountSerializer, C... | [
"random.uniform",
"src.interface.serializers.exchange_rate.CurrencySerializer",
"datetime.timedelta",
"src.interface.serializers.exchange_rate.CurrencyExchangeRateConvertSerializer",
"src.interface.serializers.exchange_rate.CurrencyExchangeRateSerializer",
"src.interface.serializers.exchange_rate.Currency... | [((2528, 2549), 'datetime.date.today', 'datetime.date.today', ([], {}), '()\n', (2547, 2549), False, 'import datetime\n'), ((3977, 3998), 'datetime.date.today', 'datetime.date.today', ([], {}), '()\n', (3996, 3998), False, 'import datetime\n'), ((2425, 2445), 'random.randint', 'random.randint', (['(1)', '(5)'], {}), '(... |
"""Tests of session module"""
import pytest
from rasterio.session import DummySession, AWSSession, Session
def test_dummy_session():
"""DummySession works"""
sesh = DummySession()
assert sesh._session is None
assert sesh.get_credential_options() == {}
def test_aws_session_class():
"""AWSSessio... | [
"rasterio.session.DummySession",
"pytest.importorskip",
"rasterio.session.Session.from_foreign_session",
"rasterio.session.AWSSession",
"rasterio.session.Session.from_path"
] | [((177, 191), 'rasterio.session.DummySession', 'DummySession', ([], {}), '()\n', (189, 191), False, 'from rasterio.session import DummySession, AWSSession, Session\n'), ((342, 406), 'rasterio.session.AWSSession', 'AWSSession', ([], {'aws_access_key_id': '"""foo"""', 'aws_secret_access_key': '"""bar"""'}), "(aws_access_... |
# Generated by Django 2.1.3 on 2019-04-24 15:26
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('panels', '0070_historicalsnapshot'),
]
operations = [
migrations.AlterField(
model_name='genepa... | [
"django.db.models.ForeignKey"
] | [((383, 481), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'on_delete': 'django.db.models.deletion.CASCADE', 'to': '"""panels.GenePanelSnapshot"""'}), "(on_delete=django.db.models.deletion.CASCADE, to=\n 'panels.GenePanelSnapshot')\n", (400, 481), False, 'from django.db import migrations, models\n'), ((... |
#!/usr/bin/env python
# coding: utf-8
# In[2]:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.utils import shuffle
from sklearn.model_selection import train_test_split
from sklearn.neighbors import KNeighborsClassifier
from sklearn.svm import SVC
from sklearn.linear_model import ... | [
"sklearn.metrics.confusion_matrix",
"matplotlib.pyplot.show",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"sklearn.metrics.balanced_accuracy_score",
"sklearn.tree.DecisionTreeClassifier",
"sklearn.neighbors.KNeighborsClassifier",
"sklearn.ensemble.RandomForestClassifier",
"sklearn... | [((2282, 2336), 'sklearn.model_selection.train_test_split', 'train_test_split', (['X', 'y'], {'test_size': '(0.3)', 'random_state': '(42)'}), '(X, y, test_size=0.3, random_state=42)\n', (2298, 2336), False, 'from sklearn.model_selection import train_test_split\n'), ((2408, 2443), 'sklearn.neighbors.KNeighborsClassifier... |
# Import the DBManager
from DBManager import Database
# Create a new database object
db = Database("database.db", True)
# Execute the create tables sql file
# This should only be run the first time the code is executed
db.fTransaction("create_tables.sql")
# Get a username and password
uname = input("Enter... | [
"DBManager.Database"
] | [((95, 124), 'DBManager.Database', 'Database', (['"""database.db"""', '(True)'], {}), "('database.db', True)\n", (103, 124), False, 'from DBManager import Database\n')] |
# -*- coding: utf-8 -*-
"""
Application collaborations management related tasks for Invoke.
"""
from tasks.utils import app_context_task
@app_context_task
def list_all(context):
"""
Show existing collaborations.
"""
from app.modules.collaborations.models import Collaboration
collabs = Collaborat... | [
"app.modules.users.models.User.find",
"app.modules.collaborations.models.Collaboration.query.all"
] | [((310, 335), 'app.modules.collaborations.models.Collaboration.query.all', 'Collaboration.query.all', ([], {}), '()\n', (333, 335), False, 'from app.modules.collaborations.models import Collaboration\n'), ((697, 719), 'app.modules.users.models.User.find', 'User.find', ([], {'email': 'email'}), '(email=email)\n', (706, ... |
# Generated by Django 3.2.4 on 2021-08-08 13:08
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('property', '0012_alter_property_property_status'),
]
operations = [
migrations.AlterField(
model_name='property',
na... | [
"django.db.models.CharField"
] | [((360, 496), 'django.db.models.CharField', 'models.CharField', ([], {'choices': "[('FS', 'For Sale'), ('FR', 'For Rent'), ('SL', 'Sold Out')]", 'max_length': '(2)', 'verbose_name': '"""Property status"""'}), "(choices=[('FS', 'For Sale'), ('FR', 'For Rent'), ('SL',\n 'Sold Out')], max_length=2, verbose_name='Proper... |
from __future__ import print_function
import os
import argparse
import torch
import torch.backends.cudnn as cudnn
import numpy as np
from data import cfg_mnet, cfg_slim, cfg_rfb
from layers.functions.prior_box import PriorBox
from utils.nms.py_cpu_nms import py_cpu_nms
import cv2
from thop import profile
from thop impo... | [
"models.net_rfb.RFB",
"argparse.ArgumentParser",
"models.net_slim.Slim",
"thop.profile",
"models.retinaface.RetinaFace",
"thop.clever_format",
"torch.set_grad_enabled",
"torch.randn"
] | [((532, 575), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Test"""'}), "(description='Test')\n", (555, 575), False, 'import argparse\n'), ((876, 905), 'torch.set_grad_enabled', 'torch.set_grad_enabled', (['(False)'], {}), '(False)\n', (898, 905), False, 'import torch\n'), ((1403, 1443)... |
import random
import gym
from gym import Env, logger, spaces
import numpy as np
np.random.seed(0)
class MultiArmedBanditEnv(Env):
def __init__(self, n=3, info={}):
"""
n - number of arms in the bandit
"""
self.num_bandits = n
self.action_space = spaces.Discrete(self.num_ba... | [
"numpy.random.random",
"gym.spaces.Discrete",
"numpy.random.seed",
"numpy.random.uniform"
] | [((81, 98), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (95, 98), True, 'import numpy as np\n'), ((293, 326), 'gym.spaces.Discrete', 'spaces.Discrete', (['self.num_bandits'], {}), '(self.num_bandits)\n', (308, 326), False, 'from gym import Env, logger, spaces\n'), ((360, 378), 'gym.spaces.Discrete', ... |
# Generated by Django 3.0.4 on 2020-04-17 15:07
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Car',
fields=[
... | [
"django.db.models.OneToOneField",
"django.db.models.ForeignKey",
"django.db.models.IntegerField",
"django.db.models.AutoField",
"django.db.models.CharField"
] | [((332, 425), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (348, 425), False, 'from django.db import migrations, models\... |
from unittest import mock
from bs4 import BeautifulSoup
from django.test import TestCase
from django.urls import reverse
from shortener.models import random_hash, UrlModel
class HashTests(TestCase):
def test_hash(self):
# The hash is pretty simple. We can use a proper hashing function later
h =... | [
"shortener.models.UrlModel.objects.count",
"bs4.BeautifulSoup",
"django.urls.reverse",
"shortener.models.random_hash",
"unittest.mock.patch",
"shortener.models.UrlModel"
] | [((1213, 1251), 'unittest.mock.patch', 'mock.patch', (['"""shortener.models.urlopen"""'], {}), "('shortener.models.urlopen')\n", (1223, 1251), False, 'from unittest import mock\n'), ((321, 334), 'shortener.models.random_hash', 'random_hash', ([], {}), '()\n', (332, 334), False, 'from shortener.models import random_hash... |
from rest_framework import generics
from rest_framework import mixins
from assortment.models import AssortmentUnitType, AssortmentLabelType
from assortment.serializers import UnitTypeSerializer, LabelTypeSerializer, LabelTypeSerializerWithEdit, \
UnitTypeSerializerWithEdit
from www.models import SwipeLoginRequired... | [
"assortment.models.AssortmentUnitType.objects.all",
"assortment.models.AssortmentLabelType.objects.all"
] | [((501, 533), 'assortment.models.AssortmentUnitType.objects.all', 'AssortmentUnitType.objects.all', ([], {}), '()\n', (531, 533), False, 'from assortment.models import AssortmentUnitType, AssortmentLabelType\n'), ((971, 1003), 'assortment.models.AssortmentUnitType.objects.all', 'AssortmentUnitType.objects.all', ([], {}... |
import os
import unittest
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
import imaging_db.database.db_operations as db_ops
import imaging_db.utils.db_utils as db_utils
class DBBaseTest(unittest.TestCase):
"""
These tests require that you run a postgres Docker container
whic... | [
"sqlalchemy.orm.sessionmaker",
"sqlalchemy.create_engine",
"os.path.join",
"os.path.dirname",
"imaging_db.utils.db_utils.get_connection_str",
"imaging_db.database.db_operations.Base.metadata.create_all"
] | [((775, 825), 'os.path.join', 'os.path.join', (['self.main_dir', '"""db_credentials.json"""'], {}), "(self.main_dir, 'db_credentials.json')\n", (787, 825), False, 'import os\n'), ((892, 937), 'imaging_db.utils.db_utils.get_connection_str', 'db_utils.get_connection_str', (['credentials_path'], {}), '(credentials_path)\n... |
# -*- coding: utf-8 -*-
from autograd.blocks.trigo import sin
from autograd.blocks.trigo import cos
from autograd.blocks.trigo import tan
from autograd.blocks.trigo import arcsin
from autograd.blocks.trigo import arccos
from autograd.blocks.trigo import arctan
from autograd.variable import Variable
import numpy as np
i... | [
"autograd.blocks.trigo.arcsin",
"numpy.tan",
"numpy.arccos",
"numpy.sqrt",
"numpy.random.random",
"autograd.blocks.trigo.cos",
"numpy.arcsin",
"autograd.blocks.trigo.arccos",
"numpy.diag",
"autograd.blocks.trigo.sin",
"autograd.set_mode",
"autograd.blocks.trigo.tan",
"numpy.equal",
"numpy.... | [((370, 392), 'autograd.set_mode', 'ad.set_mode', (['"""forward"""'], {}), "('forward')\n", (381, 392), True, 'import autograd as ad\n'), ((592, 611), 'numpy.random.random', 'np.random.random', (['(5)'], {}), '(5)\n', (608, 611), True, 'import numpy as np\n'), ((618, 632), 'autograd.variable.Variable', 'Variable', (['d... |
# This Python file uses the following encoding: utf-8
"""autogenerated by genpy from interbotix_moveit_interface/MoveItPlanRequest.msg. Do not edit."""
import codecs
import sys
python3 = True if sys.hexversion > 0x03000000 else False
import genpy
import struct
import geometry_msgs.msg
class MoveItPlanRequest(genpy.Me... | [
"codecs.lookup_error",
"struct.Struct",
"genpy.DeserializationError"
] | [((6393, 6414), 'struct.Struct', 'struct.Struct', (['"""<b7d"""'], {}), "('<b7d')\n", (6406, 6414), False, 'import struct\n'), ((11781, 11800), 'struct.Struct', 'struct.Struct', (['"""<B"""'], {}), "('<B')\n", (11794, 11800), False, 'import struct\n'), ((4074, 4103), 'codecs.lookup_error', 'codecs.lookup_error', (['"""... |
import os
import sys
import pathlib
import torch
DEFAULT_MINIDUMP_DIR = "/tmp/pytorch_crashes"
def enable_minidumps(directory=DEFAULT_MINIDUMP_DIR):
if sys.platform != "linux":
raise RuntimeError("Minidump collection is currently only implemented for Linux platforms")
if directory == DEFAULT_MINIDUM... | [
"os.path.exists",
"torch._C._disable_minidumps",
"pathlib.Path",
"torch._C._enable_minidumps",
"torch._C._enable_minidumps_on_exceptions"
] | [((508, 545), 'torch._C._enable_minidumps', 'torch._C._enable_minidumps', (['directory'], {}), '(directory)\n', (534, 545), False, 'import torch\n'), ((590, 632), 'torch._C._enable_minidumps_on_exceptions', 'torch._C._enable_minidumps_on_exceptions', ([], {}), '()\n', (630, 632), False, 'import torch\n'), ((664, 693), ... |
import os
import pandas as pd
from os import listdir, remove
from os.path import isfile, join
path_to_data='C:\\Users\\ido\\Documents\\data\\all_data_07_21_1'
os.chdir(path_to_data) #changes current directory
session_folders=listdir() #list of folders
good_subj=pd.read_csv('C:\\Users\\ido\\Documents\\data\\pyt... | [
"os.listdir",
"pandas.read_csv",
"os.path.join",
"os.getcwd",
"os.chdir",
"os.rmdir",
"pandas.DataFrame",
"os.remove"
] | [((166, 188), 'os.chdir', 'os.chdir', (['path_to_data'], {}), '(path_to_data)\n', (174, 188), False, 'import os\n'), ((233, 242), 'os.listdir', 'listdir', ([], {}), '()\n', (240, 242), False, 'from os import listdir, remove\n'), ((271, 349), 'pandas.read_csv', 'pd.read_csv', (['"""C:\\\\Users\\\\ido\\\\Documents\\\\dat... |
#!/usr/bin/env python3
import sys,rospy
from pimouse_ros.msg import LightSensorValues
rospy.init_node("lightsensors")
| [
"rospy.init_node"
] | [((87, 118), 'rospy.init_node', 'rospy.init_node', (['"""lightsensors"""'], {}), "('lightsensors')\n", (102, 118), False, 'import sys, rospy\n')] |
# main.py
from os.path import isfile
import sys
import os
from tndm.runtime import Runtime
HELP_MSG = """
Usage: python tndm [command] [file]
The file contains the experiment settings.
Commands:
-h, --help print helper
-r, --run runs the file with specifications
"""
ERROR_MSG = """
Comman... | [
"os.path.isfile",
"tndm.runtime.Runtime.train_from_file"
] | [((793, 805), 'os.path.isfile', 'isfile', (['file'], {}), '(file)\n', (799, 805), False, 'from os.path import isfile\n'), ((823, 852), 'tndm.runtime.Runtime.train_from_file', 'Runtime.train_from_file', (['file'], {}), '(file)\n', (846, 852), False, 'from tndm.runtime import Runtime\n')] |
from beetl.task_datasets import BeetlSleepTutorial, BeetlSleepSource
ds = BeetlSleepTutorial()
path = ds.download()
# Load all subject data
X, y, info = ds.get_data()
# Assume source group is subject 0-4, target group is subject 5-7,
# and subject 8,9 are from target group for testing.
X_source_train, y_source_trai... | [
"beetl.task_datasets.BeetlSleepTutorial",
"beetl.task_datasets.BeetlSleepSource"
] | [((76, 96), 'beetl.task_datasets.BeetlSleepTutorial', 'BeetlSleepTutorial', ([], {}), '()\n', (94, 96), False, 'from beetl.task_datasets import BeetlSleepTutorial, BeetlSleepSource\n'), ((562, 580), 'beetl.task_datasets.BeetlSleepSource', 'BeetlSleepSource', ([], {}), '()\n', (578, 580), False, 'from beetl.task_dataset... |
# coding=utf-8
# TODO: process argv
# TODO: delegate to PhotoClassifier
import sys
from glob import iglob
from itertools import chain
from os import W_OK, access
from os.path import exists, getmtime, abspath, dirname, join
__author__ = "<NAME>, <NAME>"
__copyright__ = "Copyright 2017, /dej/uran/dom team"
__credits__... | [
"os.path.exists",
"os.access",
"os.path.join",
"os.path.getmtime",
"os.path.dirname",
"sys.exit",
"PyQt5.pyrcc_main.processResourceFile",
"minicup_photo_classifier.ui.app.App"
] | [((516, 533), 'os.path.dirname', 'dirname', (['__file__'], {}), '(__file__)\n', (523, 533), False, 'from os.path import exists, getmtime, abspath, dirname, join\n'), ((554, 575), 'os.path.join', 'join', (['base_path', '""".."""'], {}), "(base_path, '..')\n", (558, 575), False, 'from os.path import exists, getmtime, abs... |
#!/usr/bin/env python3
import click
from database.db import session, create_database, drop_database
from database.models import Setting
from links import commands as links
from tokens import commands as tokens
VERSION = 'go cli 1.0.0'
@click.group(invoke_without_command=True)
@click.option('--version', is_flag=True... | [
"database.db.drop_database",
"click.argument",
"database.db.create_database",
"database.models.Setting",
"database.db.session.add",
"click.group",
"click.option",
"database.db.session.commit",
"click.echo",
"database.db.session.query",
"click.command"
] | [((240, 280), 'click.group', 'click.group', ([], {'invoke_without_command': '(True)'}), '(invoke_without_command=True)\n', (251, 280), False, 'import click\n'), ((282, 384), 'click.option', 'click.option', (['"""--version"""'], {'is_flag': '(True)', 'default': '(False)', 'help': '"""Show the current version and exit.""... |
#!/usr/bin/env python3
# Filename: sensor_ir_test.py
# Purpose:# Use the IR Receiver and GoPiGo remote
#
# https://github.com/DexterInd/GoPiGo3
# EasyGoPiGo3 documentation: https://gopigo3.readthedocs.io/en/latest
# DI sensor documentation: https://di-sensors.readthedocs.io/en/master/
# Copyright (c) 2017 Dexter Indust... | [
"gopigo3.GoPiGo3",
"time.sleep"
] | [((867, 884), 'gopigo3.GoPiGo3', 'gopigo3.GoPiGo3', ([], {}), '()\n', (882, 884), False, 'import gopigo3\n'), ((1165, 1176), 'time.sleep', 'sleep', (['(0.05)'], {}), '(0.05)\n', (1170, 1176), False, 'from time import sleep\n')] |
# -*- coding: utf-8 -*-
#
# Copyright: (c) 2019, F5 Networks Inc.
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import json
import pytest
import sys
if sys.version_info < (2... | [
"ansible_collections.f5networks.f5_modules.plugins.modules.bigip_device_certificate.ModuleParameters",
"json.loads",
"ansible_collections.f5networks.f5_modules.plugins.modules.bigip_device_certificate.ArgumentSpec",
"ansible.module_utils.basic.AnsibleModule",
"ansible_collections.f5networks.f5_modules.tests... | [((343, 403), 'pytest.mark.skip', 'pytest.mark.skip', (['"""F5 Ansible modules require Python >= 2.7"""'], {}), "('F5 Ansible modules require Python >= 2.7')\n", (359, 403), False, 'import pytest\n'), ((902, 927), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (917, 927), False, 'import os\n'... |
#!/usr/bin/env python
"""
Converts the 3D simulation data from carpet output (for every Node, that for every
variable name creates a list of .h5 files) into a single profile.h5 for a given iteration using `scidata`.
options:
-i : str : path to the simulation dir that contains `output-xxxx` directo... | [
"numpy.log10",
"scidata.units.conv_dens",
"numpy.array",
"scidata.utils.locate",
"scidata.units.conv_press",
"argparse.ArgumentParser",
"scipy.interpolate.RegularGridInterpolator",
"numpy.delete",
"config.get_eos_fname_from_curr_dir",
"os.path.isdir",
"numpy.vstack",
"os.mkdir",
"glob.glob",... | [((24415, 24432), 'numpy.array', 'np.array', (['it_time'], {}), '(it_time)\n', (24423, 24432), True, 'import numpy as np\n'), ((25294, 25314), 'scidata.carpet.hdf5.dataset', 'h5.dataset', (['files[0]'], {}), '(files[0])\n', (25304, 25314), True, 'import scidata.carpet.hdf5 as h5\n'), ((26901, 26922), 'os.path.isdir', '... |
import subprocess
import time
print("Opening")
#extra trees original
subprocess.call('python extratress.py --trial-name "ext" --pca 0 --sf 0 --oor 1',shell=True)
time.sleep(0.2)
subprocess.call('python extratress.py --trial-name "ext+PCA=44" --pca 44 --sf 0 --oor 1',shell=True)
time.sleep(0.2)
subprocess.call('python ... | [
"subprocess.call",
"time.sleep"
] | [((70, 173), 'subprocess.call', 'subprocess.call', (['"""python extratress.py --trial-name "ext" --pca 0 --sf 0 --oor 1"""'], {'shell': '(True)'}), '(\n \'python extratress.py --trial-name "ext" --pca 0 --sf 0 --oor 1\', shell\n =True)\n', (85, 173), False, 'import subprocess\n'), ((163, 178), 'time.sleep', 'time... |
"""BioMASS core functions"""
import multiprocessing
import warnings
from biomass.dynamics import SignalingSystems
from biomass.ga import GeneticAlgorithmInit, GeneticAlgorithmContinue
from biomass.analysis import (ReactionSensitivity,
InitialConditionSensitivity,
... | [
"warnings.filterwarnings",
"biomass.analysis.ReactionSensitivity",
"multiprocessing.cpu_count",
"biomass.analysis.InitialConditionSensitivity",
"biomass.ga.GeneticAlgorithmInit",
"multiprocessing.Pool",
"biomass.dynamics.SignalingSystems",
"biomass.analysis.ParameterSensitivity",
"biomass.ga.Genetic... | [((1712, 1745), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (1735, 1745), False, 'import warnings\n'), ((2699, 2732), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (2722, 2732), False, 'import warnings\n'), ((2747, 2843), ... |
"""Add telephone number
Revision ID: 3243c3538fc
Revises: <PASSWORD>
Create Date: 2015-06-04 18:39:54.895177
"""
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = '<PASSWORD>'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - pleas... | [
"sqlalchemy.String",
"alembic.op.drop_column"
] | [((545, 584), 'alembic.op.drop_column', 'op.drop_column', (['"""location"""', '"""telephone"""'], {}), "('location', 'telephone')\n", (559, 584), False, 'from alembic import op\n'), ((387, 407), 'sqlalchemy.String', 'sa.String', ([], {'length': '(20)'}), '(length=20)\n', (396, 407), True, 'import sqlalchemy as sa\n')] |
#!/usr/bin/python
import os, sys, subprocess, json, time, argparse
# args
parser = argparse.ArgumentParser(description='awscurl polling action')
parser.add_argument('-e','--environment', help='options ["test", "beta", "tni", "stg", "prd"]', required=True)
parser.add_argument('-v','--version', help='deploy version', r... | [
"json.loads",
"argparse.ArgumentParser",
"subprocess.Popen",
"time.sleep",
"sys.exit",
"os.system"
] | [((85, 146), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""awscurl polling action"""'}), "(description='awscurl polling action')\n", (108, 146), False, 'import os, sys, subprocess, json, time, argparse\n'), ((876, 918), 'os.system', 'os.system', (['f"""echo "::warning ::{message}\\""""'... |
from article.models import Article
from article.serializers import ArticleSerializer
from rest_framework import status
from rest_framework.response import Response
from rest_framework import generics
from rest_framework import permissions
from community.permissions import IsOwnerOrReadOnly
from rest_framework.views imp... | [
"article.models.Article.objects.all",
"django.shortcuts.get_object_or_404",
"rest_framework.decorators.api_view",
"article.serializers.ArticleSerializer"
] | [((942, 959), 'rest_framework.decorators.api_view', 'api_view', (["['GET']"], {}), "(['GET'])\n", (950, 959), False, 'from rest_framework.decorators import api_view\n'), ((1133, 1150), 'rest_framework.decorators.api_view', 'api_view', (["['GET']"], {}), "(['GET'])\n", (1141, 1150), False, 'from rest_framework.decorator... |
# ---------------------------------------------------------------------
# AlliedTelesis.AT8100.get_mac_address_table
# ---------------------------------------------------------------------
# Copyright (C) 2007-2018 The NOC Project
# See LICENSE for details
# -------------------------------------------------------------... | [
"re.compile"
] | [((590, 732), 're.compile', 're.compile', (['"""^\\\\s*(?P<vlan_id>\\\\d+)\\\\s+(?P<interfaces>\\\\S+)\\\\s+(?P<mac>[\\\\.0-9a-f]+)\\\\s+\\\\S+\\\\s+(?P<type>\\\\w+)\\\\s*\\\\n"""', 're.MULTILINE'], {}), "(\n '^\\\\s*(?P<vlan_id>\\\\d+)\\\\s+(?P<interfaces>\\\\S+)\\\\s+(?P<mac>[\\\\.0-9a-f]+)\\\\s+\\\\S+\\\\s+(?P<ty... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('medicamentos', '0002_auto_20151014_0011'),
('clientes', '0001_initial'),
]
operations = [
migrations.CreateModel(
... | [
"django.db.models.IntegerField",
"django.db.models.ForeignKey",
"django.db.models.ManyToManyField",
"django.db.models.AutoField",
"django.db.models.DateTimeField",
"django.db.models.CharField"
] | [((1505, 1542), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'to': '"""ventas.Ticket"""'}), "(to='ventas.Ticket')\n", (1522, 1542), False, 'from django.db import models, migrations\n'), ((398, 491), 'django.db.models.AutoField', 'models.AutoField', ([], {'verbose_name': '"""ID"""', 'serialize': '(False)', ... |
# Django modules.
from django import forms
# !Triplinker modules:
# Another app modules.
from accounts.models.TLAccount_frequest import TLAccount
# Current app modules.
from .models import Message, GroupChat, GroupChatMainPhoto
from .helpers.get_query_set_not_participants import get_friends_not_participants
class ... | [
"accounts.models.TLAccount_frequest.TLAccount.objects.get",
"accounts.models.TLAccount_frequest.TLAccount.objects.all",
"django.forms.ValidationError",
"django.forms.Textarea",
"django.forms.TextInput",
"django.forms.MultipleChoiceField"
] | [((1678, 1735), 'django.forms.MultipleChoiceField', 'forms.MultipleChoiceField', ([], {'widget': 'widget', 'choices': 'OPTIONS'}), '(widget=widget, choices=OPTIONS)\n', (1703, 1735), False, 'from django import forms\n'), ((2992, 3049), 'django.forms.MultipleChoiceField', 'forms.MultipleChoiceField', ([], {'widget': 'wi... |
from django.db import models
from accounts.models import Profile
class Department(models.Model):
did = models.IntegerField()
dname = models.CharField(max_length=50)
dimage = models.ImageField(upload_to='images/departments', blank=True)
def __str__(self):
return self.dname
class Events(models.Model):
eid =... | [
"django.db.models.EmailField",
"django.db.models.ForeignKey",
"django.db.models.IntegerField",
"django.db.models.ImageField",
"django.db.models.CharField"
] | [((106, 127), 'django.db.models.IntegerField', 'models.IntegerField', ([], {}), '()\n', (125, 127), False, 'from django.db import models\n'), ((137, 168), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(50)'}), '(max_length=50)\n', (153, 168), False, 'from django.db import models\n'), ((179, 240... |
import sys
import os
# This sample uses a resource iterator to list all the visas for a particular person
##If we add the parent directory to the path we will use the development version of the library
## rather than the insalled version
sys.path.insert(0, os.path.abspath('../'))
import EllucianEthosPythonClient
e... | [
"os.path.abspath",
"EllucianEthosPythonClient.EllucianEthosAPIClient"
] | [((483, 553), 'EllucianEthosPythonClient.EllucianEthosAPIClient', 'EllucianEthosPythonClient.EllucianEthosAPIClient', ([], {'baseURL': 'ethosBaseURL'}), '(baseURL=ethosBaseURL)\n', (531, 553), False, 'import EllucianEthosPythonClient\n'), ((260, 282), 'os.path.abspath', 'os.path.abspath', (['"""../"""'], {}), "('../')\... |
import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
COLORS = {
'1 - New': '#00CD33', # (success green)
'2 - In Progress': '#7995D4', # (royal blue)
'3 - On Hold': '#FF9000', # (warning orange)
'4 - Awaiting Caller': '#FF9000', # (warning orange)
'5 - Await... | [
"demistomock.results",
"demistomock.debug",
"demistomock.incidents"
] | [((803, 822), 'demistomock.incidents', 'demisto.incidents', ([], {}), '()\n', (820, 822), True, 'import demistomock as demisto\n'), ((1259, 1362), 'demistomock.results', 'demisto.results', (["{'ContentsFormat': formats['html'], 'Type': entryTypes['note'], 'Contents':\n html}"], {}), "({'ContentsFormat': formats['htm... |
# -*- coding: utf-8 -*-
"""Simple test for the full schema."""
from graphene.test import Client
from aiida_restapi.graphql.main import SCHEMA
def test_full(create_node, orm_regression):
"""Test loading the full schema."""
node = create_node(label="node 1")
client = Client(SCHEMA)
executed = client.ex... | [
"graphene.test.Client"
] | [((281, 295), 'graphene.test.Client', 'Client', (['SCHEMA'], {}), '(SCHEMA)\n', (287, 295), False, 'from graphene.test import Client\n')] |
"""
This module implements the LocalExecutor class responsible for submitting
jobs to localhost. This class is called in class BuildExecutor
when initializing the executors.
"""
import os
import shlex
from buildtest.defaults import console
from buildtest.exceptions import RuntimeFailure
from buildtest.executors.base ... | [
"buildtest.utils.file.write_file",
"buildtest.utils.shell.is_sh_shell",
"buildtest.utils.shell.is_csh_shell",
"shlex.split",
"os.path.join",
"buildtest.utils.shell.is_zsh_shell",
"buildtest.utils.shell.is_bash_shell",
"os.chdir",
"os.path.basename",
"buildtest.defaults.console.print"
] | [((1962, 1989), 'os.chdir', 'os.chdir', (['builder.stage_dir'], {}), '(builder.stage_dir)\n', (1970, 1989), False, 'import os\n'), ((2940, 3053), 'buildtest.defaults.console.print', 'console.print', (['f"""[blue]{builder}[/]: Test completed in {builder.metadata[\'result\'][\'runtime\']} seconds"""'], {}), '(\n f"[bl... |
'''
Plotting tools relevant for illustrating and comparing clustering results
can be found in this module.
'''
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
def scatter_plot_two_dim_group_data(
two_dim_data,
labels,
markers=None,
colors=None,
figsize=(1... | [
"pandas.Series",
"matplotlib.pyplot.grid",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.figure",
"numpy.linspace",
"pandas.DataFrame",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.... | [((3189, 3216), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': 'figsize'}), '(figsize=figsize)\n', (3199, 3216), True, 'import matplotlib.pyplot as plt\n'), ((3226, 3242), 'matplotlib.pyplot.subplot', 'plt.subplot', (['(111)'], {}), '(111)\n', (3237, 3242), True, 'import matplotlib.pyplot as plt\n'), ((4052... |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the Li... | [
"manila.db.share_group_type_access_add",
"manila.db.share_group_type_get_by_name",
"manila.db.share_group_type_create",
"manila.i18n._",
"manila.context.get_admin_context",
"manila.db.share_group_type_get",
"manila.exception.InvalidShareGroupType",
"manila.db.share_group_type_destroy",
"oslo_utils.u... | [((837, 860), 'oslo_log.log.getLogger', 'log.getLogger', (['__name__'], {}), '(__name__)\n', (850, 860), False, 'from oslo_log import log\n'), ((2034, 2097), 'manila.db.share_group_type_get_all', 'db.share_group_type_get_all', (['context', 'inactive'], {'filters': 'filters'}), '(context, inactive, filters=filters)\n', ... |
#! /usr/bin/env python
import numpy as np
import pandas as pd
from math import log, exp
import matplotlib.pyplot as plt
from sklearn.linear_model import LinearRegression
if __name__ == '__main__':
data = pd.read_csv("laurent_coeffs_2_511.csv", sep=',\s+')
odd_numerators = data['numerator'][1::2]
even_numer... | [
"math.exp",
"numpy.reshape",
"sklearn.linear_model.LinearRegression",
"pandas.read_csv"
] | [((209, 261), 'pandas.read_csv', 'pd.read_csv', (['"""laurent_coeffs_2_511.csv"""'], {'sep': '""",\\\\s+"""'}), "('laurent_coeffs_2_511.csv', sep=',\\\\s+')\n", (220, 261), True, 'import pandas as pd\n'), ((368, 386), 'sklearn.linear_model.LinearRegression', 'LinearRegression', ([], {}), '()\n', (384, 386), False, 'fro... |
import unittest as ut
import numpy as np
from ..util import lat2W
from ..weights import W
try:
import networkx as nx
except ImportError:
nx = None
@ut.skipIf(nx is None, "Missing networkx")
class Test_NetworkXConverter(ut.TestCase):
def setUp(self):
self.known_nx = nx.random_regular_graph(4,10,seed... | [
"unittest.skipIf",
"networkx.random_regular_graph",
"networkx.to_numpy_matrix"
] | [((157, 198), 'unittest.skipIf', 'ut.skipIf', (['(nx is None)', '"""Missing networkx"""'], {}), "(nx is None, 'Missing networkx')\n", (166, 198), True, 'import unittest as ut\n'), ((287, 328), 'networkx.random_regular_graph', 'nx.random_regular_graph', (['(4)', '(10)'], {'seed': '(8879)'}), '(4, 10, seed=8879)\n', (310... |
"""Tests for API endpoints that performs stack analysis."""
import requests
import time
import os
from behave import given, then, when
from urllib.parse import urljoin
import jsonschema
from src.attribute_checks import *
from src.parsing import *
from src.utils import *
from src.json_utils import *
from src.authoriza... | [
"requests.post",
"requests.get",
"time.sleep",
"os.path.dirname",
"behave.when",
"jsonschema.validate",
"urllib.parse.urljoin",
"os.path.abspath",
"behave.then"
] | [((947, 990), 'behave.when', 'when', (['"""I wait for stack analysis to finish"""'], {}), "('I wait for stack analysis to finish')\n", (951, 990), False, 'from behave import given, then, when\n'), ((992, 1063), 'behave.when', 'when', (['"""I wait for stack analysis to finish {token} authorization token"""'], {}), "('I ... |
from django.contrib.auth.models import User
from rest_framework.authtoken.models import Token
from rest_framework.serializers import ModelSerializer
from rest_framework.serializers import SerializerMethodField
class UserSerializer(ModelSerializer):
token = SerializerMethodField()
def get_token(self, instance... | [
"rest_framework.authtoken.models.Token.objects.get",
"rest_framework.serializers.SerializerMethodField",
"django.contrib.auth.models.User"
] | [((263, 286), 'rest_framework.serializers.SerializerMethodField', 'SerializerMethodField', ([], {}), '()\n', (284, 286), False, 'from rest_framework.serializers import SerializerMethodField\n'), ((465, 506), 'django.contrib.auth.models.User', 'User', ([], {'username': "validated_data['username']"}), "(username=validate... |
from canio import Message, RemoteTransmissionRequest
from MCP2515 import MCP2515 as CAN
from time import sleep_ms
NODE_ID = 0x1234ABCD
#NODE_ID = 0xAA
can_bus = CAN(0, 5, baudrate = 25000, debug=True)
#print('Listening...')
i = 0
while True:
with can_bus.listen(timeout=1.0) as listener:
message = Message... | [
"MCP2515.MCP2515",
"time.sleep_ms"
] | [((164, 201), 'MCP2515.MCP2515', 'CAN', (['(0)', '(5)'], {'baudrate': '(25000)', 'debug': '(True)'}), '(0, 5, baudrate=25000, debug=True)\n', (167, 201), True, 'from MCP2515 import MCP2515 as CAN\n'), ((476, 490), 'time.sleep_ms', 'sleep_ms', (['(1000)'], {}), '(1000)\n', (484, 490), False, 'from time import sleep_ms\n... |
#coding: utf8
from django.db import models
class Category(models.Model):
name = models.CharField(max_length=20)
class Meta:
verbose_name_plural = verbose_name = u'分类'
def __str__(self):
return self.name
class Tag(models.Model):
name = models.CharField(max_length=20, verbose_name=u... | [
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.ManyToManyField",
"django.db.models.FileField",
"django.db.models.ImageField",
"django.db.models.PositiveIntegerField",
"django.db.models.DateTimeField",
"django.db.models.CharField"
] | [((87, 118), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(20)'}), '(max_length=20)\n', (103, 118), False, 'from django.db import models\n'), ((274, 325), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(20)', 'verbose_name': 'u"""标签"""'}), "(max_length=20, verbose_name=... |
# -*- coding: utf-8 -*-
# TODO Licence:
#
# TODO: move library intensive functions to vtool
from __future__ import absolute_import, division, print_function, unicode_literals
import operator
import six
from six.moves import zip, range, reduce
from utool import util_type
from utool import util_inject
from utool import ... | [
"numpy.prod",
"six.moves.range",
"pgmpy.factors.TabularCPD",
"pgmpy.inference.VariableElimination",
"networkx.pydot_layout",
"six.moves.zip",
"plottool.gca",
"networkx.DiGraph",
"numpy.random.randint",
"numpy.linspace",
"pgmpy.models.BayesianModel",
"pandas.DataFrame",
"utool.util_inject.inj... | [((593, 622), 'utool.util_inject.inject2', 'util_inject.inject2', (['__name__'], {}), '(__name__)\n', (612, 622), False, 'from utool import util_inject\n'), ((8392, 8418), 'pgmpy.models.BayesianModel', 'BayesianModel', (['input_graph'], {}), '(input_graph)\n', (8405, 8418), False, 'from pgmpy.models import BayesianMode... |
import logging
from unittest import mock
from .common import generate_msg
from pypeman.message import Message
from pypeman.test import TearDownProjectTestCase as TestCase
class MessageTests(TestCase):
def test_message_dict_conversion(self):
m = generate_msg(message_content={'answer': 42}, with_context... | [
"unittest.mock.MagicMock",
"pypeman.message.Message.from_dict",
"pypeman.message.Message.from_json"
] | [((464, 488), 'pypeman.message.Message.from_dict', 'Message.from_dict', (['mdict'], {}), '(mdict)\n', (481, 488), False, 'from pypeman.message import Message\n'), ((1200, 1227), 'pypeman.message.Message.from_json', 'Message.from_json', (['msg_json'], {}), '(msg_json)\n', (1217, 1227), False, 'from pypeman.message impor... |
from projects.fa.transform import Transform
from config import cfg
import numpy as np
import cv2
from xvision.utils.draw import draw_bbox, draw_points
from transform import *
from xvision.datasets.wflw import WFLW
label = '/Users/jimmy/Documents/data/WFLW/WFLW_annotations/list_98pt_rect_attr_train_test/list_98pt_re... | [
"xvision.utils.draw.draw_points",
"numpy.ones",
"projects.fa.transform.Transform",
"cv2.line",
"xvision.utils.draw.draw_bbox",
"cv2.imshow",
"numpy.array",
"cv2.waitKey",
"xvision.datasets.wflw.WFLW"
] | [((402, 420), 'xvision.datasets.wflw.WFLW', 'WFLW', (['label', 'image'], {}), '(label, image)\n', (406, 420), False, 'from xvision.datasets.wflw import WFLW\n'), ((426, 498), 'projects.fa.transform.Transform', 'Transform', (['cfg.dsize', 'cfg.padding', 'cfg.data.meanshape', 'cfg.data.meanbbox'], {}), '(cfg.dsize, cfg.p... |
# Generated by Django 4.0.2 on 2022-03-04 11:06
from django.db import migrations, models
import django.db.models.deletion
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [
('authors', '0003_alter_author_github'),
('posts', '0003_post_comments'),
]
o... | [
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.CharField",
"django.db.models.DateTimeField",
"django.db.models.UUIDField"
] | [((440, 492), 'django.db.models.CharField', 'models.CharField', ([], {'default': '"""comments"""', 'max_length': '(100)'}), "(default='comments', max_length=100)\n", (456, 492), False, 'from django.db import migrations, models\n'), ((523, 541), 'django.db.models.TextField', 'models.TextField', ([], {}), '()\n', (539, 5... |
from django.db import models
from django.contrib.auth.models import User
from django.urls import reverse
from django import forms
# Create your models here.
class Author(models.Model):
name = models.CharField("Nome", max_length=255, blank=False)
surname = models.CharField("Sobrenome", max_length=255, blank... | [
"django.db.models.DateField",
"django.db.models.TextField",
"django.db.models.IntegerField",
"django.db.models.ManyToManyField",
"django.db.models.DateTimeField",
"django.db.models.ImageField",
"django.db.models.CharField"
] | [((201, 254), 'django.db.models.CharField', 'models.CharField', (['"""Nome"""'], {'max_length': '(255)', 'blank': '(False)'}), "('Nome', max_length=255, blank=False)\n", (217, 254), False, 'from django.db import models\n'), ((269, 327), 'django.db.models.CharField', 'models.CharField', (['"""Sobrenome"""'], {'max_lengt... |
#!/usr/bin/env python
from setuptools import setup, find_packages
install_requires = [
'Django >= 1.4',
'content-io >= 1.0',
'simplejson >= 3.2.0'
]
tests_require = [
'unittest2',
'coverage',
'Markdown',
'Pillow'
]
version = __import__('djedi').__version__
setup(
name='djedi-cms',
... | [
"setuptools.find_packages"
] | [((1371, 1386), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (1384, 1386), False, 'from setuptools import setup, find_packages\n')] |
from Node import Node
from Factor import Factor
from FactorGeneric import FactorGeneric
from TraitPrior import TraitPrior
import utils
import numpy as np
import settings
###############
# #
# [F] #
# / \ #
# (A)...(A) #
# #
###############
def pbpdf(probin):
c = FactorPri... | [
"numpy.fft.fft",
"numpy.exp",
"numpy.array",
"numpy.dot",
"numpy.outer",
"numpy.full",
"numpy.log1p",
"numpy.arange"
] | [((339, 362), 'numpy.outer', 'np.outer', (['probin', '(c - 1)'], {}), '(probin, c - 1)\n', (347, 362), True, 'import numpy as np\n'), ((409, 422), 'numpy.exp', 'np.exp', (['p_log'], {}), '(p_log)\n', (415, 422), True, 'import numpy as np\n'), ((380, 391), 'numpy.log1p', 'np.log1p', (['p'], {}), '(p)\n', (388, 391), Tru... |
import pytest
from lightbus import Api, Event
from lightbus.api import ApiRegistry
from lightbus.exceptions import (
MisconfiguredApiOptions,
InvalidApiEventConfiguration,
InvalidApiRegistryEntry,
UnknownApi,
)
pytestmark = pytest.mark.unit
@pytest.fixture()
def SimpleApi():
class SimpleApi(Api)... | [
"pytest.fixture",
"lightbus.Event",
"pytest.raises",
"lightbus.api.ApiRegistry"
] | [((262, 278), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (276, 278), False, 'import pytest\n'), ((399, 415), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (413, 415), False, 'import pytest\n'), ((443, 456), 'lightbus.api.ApiRegistry', 'ApiRegistry', ([], {}), '()\n', (454, 456), False, 'from lightbus... |
from __future__ import print_function
import argparse
import os
import random
import sys
sys.path.append(os.getcwd())
import pdb
import time
import numpy as np
import json
import progressbar
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
import torch.backends.cudnn as cudn... | [
"misc.utils.adjust_learning_rate",
"torch.LongTensor",
"misc.dataLoader.validate",
"numpy.array",
"torch.cuda.is_available",
"misc.dataLoader.train",
"misc.netG._netG",
"argparse.ArgumentParser",
"misc.utils.repackage_hidden",
"misc.model._netW",
"torch.autograd.Variable",
"random.randint",
... | [((773, 798), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (796, 798), False, 'import argparse\n'), ((3622, 3646), 'random.randint', 'random.randint', (['(1)', '(10000)'], {}), '(1, 10000)\n', (3636, 3646), False, 'import random\n'), ((3698, 3725), 'random.seed', 'random.seed', (['opt.manualS... |
# Generated by Django 2.2.12 on 2020-04-26 17:53
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("zerver", "0273_migrate_old_bot_messages"),
]
operations = [
migrations.AlterField(
model_name="stream",
name="invit... | [
"django.db.models.BooleanField"
] | [((347, 392), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(False)', 'null': '(True)'}), '(default=False, null=True)\n', (366, 392), False, 'from django.db import migrations, models\n'), ((535, 579), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': 'None', 'null': '(... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Package: mesxr.calibration
Module: utilities
Author: <NAME>, <NAME>
Affiliation: Department of Physics, University of Wisconsin-Madison
Last Updated: November 2018
Description:
This module contains a number of auxilary functions for the main timscan.py module to
... | [
"os.path.join",
"numpy.array",
"numpy.empty",
"tifffile.imread"
] | [((1970, 2012), 'numpy.empty', 'np.empty', (['[M_SIZE_X, M_SIZE_Y, M_NUM_TRIM]'], {}), '([M_SIZE_X, M_SIZE_Y, M_NUM_TRIM])\n', (1978, 2012), True, 'import numpy as np\n'), ((4560, 4607), 'numpy.array', 'np.array', (['[energies[elem] for elem in elements]'], {}), '([energies[elem] for elem in elements])\n', (4568, 4607)... |
#!/usr/bin/env python
import numpy as np
from tqdm import tqdm
from astropy.constants import G as Ggrav
from .low_level_utils import fast_dist
G = Ggrav.to('kpc Msun**-1 km**2 s**-2').value
def all_profiles(bins, positions, velocities, masses, two_dimensional=False, zcut=None,
ages=None, pbar_msg=... | [
"numpy.sqrt",
"numpy.arccos",
"numpy.linalg.norm",
"numpy.sin",
"numpy.cross",
"numpy.isscalar",
"numpy.sort",
"numpy.empty",
"utilities.particle.parse_species",
"numpy.vstack",
"numpy.logspace",
"numpy.abs",
"astropy.constants.G.to",
"numpy.average",
"utilities.particle.parse_property",... | [((150, 186), 'astropy.constants.G.to', 'Ggrav.to', (['"""kpc Msun**-1 km**2 s**-2"""'], {}), "('kpc Msun**-1 km**2 s**-2')\n", (158, 186), True, 'from astropy.constants import G as Ggrav\n'), ((1697, 1716), 'numpy.empty', 'np.empty', (['bins.size'], {}), '(bins.size)\n', (1705, 1716), True, 'import numpy as np\n'), ((... |
import torch
from torch import nn
import torch.nn.functional as F
from .utils import PI, rfft, irfft
def ramp_filter(size):
image_n = torch.cat([
torch.arange(1, size / 2 + 1, 2, dtype=torch.int),
torch.arange(size / 2 - 1, 0, -2, dtype=torch.int),
])
image_filter = torch.zeros(size, dtyp... | [
"torch.rfft",
"torch.tensor",
"torch.nn.functional.pad",
"torch.zeros",
"torch.arange"
] | [((298, 335), 'torch.zeros', 'torch.zeros', (['size'], {'dtype': 'torch.double'}), '(size, dtype=torch.double)\n', (309, 335), False, 'import torch\n'), ((435, 478), 'torch.rfft', 'torch.rfft', (['image_filter', '(1)'], {'onesided': '(False)'}), '(image_filter, 1, onesided=False)\n', (445, 478), False, 'import torch\n'... |
import matplotlib.pyplot as plt
import matplotlib.tri as mtri
import numpy as np
import seaborn as sns
from msax.msax import paa
from mpl_toolkits.mplot3d import Axes3D
def ts_with_hist(x, fig=None, bins=50):
"""
Visualizes the input x time series with its histogram.
:param x: Input array
:param fi... | [
"numpy.repeat",
"matplotlib.tri.Triangulation",
"seaborn.heatmap",
"msax.msax.paa",
"matplotlib.pyplot.rcParams.update",
"matplotlib.pyplot.figure",
"numpy.nanmin",
"numpy.nanmax",
"numpy.ravel",
"matplotlib.pyplot.subplot2grid"
] | [((511, 576), 'matplotlib.pyplot.subplot2grid', 'plt.subplot2grid', (['gridsize', '(0, 0)'], {'colspan': '(2)', 'rowspan': '(1)', 'fig': 'fig'}), '(gridsize, (0, 0), colspan=2, rowspan=1, fig=fig)\n', (527, 576), True, 'import matplotlib.pyplot as plt\n'), ((587, 630), 'matplotlib.pyplot.subplot2grid', 'plt.subplot2gri... |
#!/usr/bin/env python
import os
import sys
from setuptools import setup
# Prepare and send a new release to PyPI
if "release" in sys.argv[-1]:
os.system("python setup.py sdist")
os.system("twine upload dist/planetpixel*")
os.system("rm -rf dist/planetpixel*")
sys.exit()
# Load the __version__ variable... | [
"os.system",
"sys.exit"
] | [((148, 182), 'os.system', 'os.system', (['"""python setup.py sdist"""'], {}), "('python setup.py sdist')\n", (157, 182), False, 'import os\n'), ((187, 230), 'os.system', 'os.system', (['"""twine upload dist/planetpixel*"""'], {}), "('twine upload dist/planetpixel*')\n", (196, 230), False, 'import os\n'), ((235, 272), ... |
#!/usr/bin/env python
# encoding: utf-8
r"""
One-dimensional advection
=========================
Solve the linear advection equation on a nonuniform grid:
.. math::
q_t + u q_x = 0.
Here q is the density of some conserved quantity and u is the velocity.
Here we have a nonuniform grid, given by the transformatio... | [
"clawpack.petclaw.Dimension",
"clawpack.petclaw.ClawSolver1D",
"clawpack.pyclaw.util.run_app_from_main",
"clawpack.petclaw.State",
"numpy.diff",
"clawpack.petclaw.Domain",
"numpy.exp",
"numpy.zeros",
"clawpack.petclaw.Solution",
"numpy.cos",
"clawpack.petclaw.Controller"
] | [((2094, 2135), 'clawpack.petclaw.Dimension', 'pyclaw.Dimension', (['(-0.5)', '(0.5)', 'nx'], {'name': '"""x"""'}), "(-0.5, 0.5, nx, name='x')\n", (2110, 2135), True, 'import clawpack.petclaw as pyclaw\n'), ((2146, 2162), 'clawpack.petclaw.Domain', 'pyclaw.Domain', (['x'], {}), '(x)\n', (2159, 2162), True, 'import claw... |
from datetime import datetime
from logging import getLogger
from ..databases import Item
from ..databases import Source, get_source
from ..databases import get_group, get_groups_ids_recursive
from ..modules import get_module
from .item import add_item
from .utils import with_db
__all__ = ('list_sources', 'show_sourc... | [
"logging.getLogger",
"datetime.datetime.now"
] | [((397, 435), 'logging.getLogger', 'getLogger', (['"""mediafeed.commands.source"""'], {}), "('mediafeed.commands.source')\n", (406, 435), False, 'from logging import getLogger\n'), ((5490, 5504), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (5502, 5504), False, 'from datetime import datetime\n')] |
import math
import array
import random
import numpy as np
from deap import base
from deap import creator
from deap import tools
from deap.benchmarks.tools import diversity, convergence, hypervolume
class PSO():
def __init__(self, dim, boundary, population=5, gen=1000, minimization=True, func=None):
# POT... | [
"deap.creator.Particle",
"deap.benchmarks.tools.hypervolume",
"deap.creator.create",
"deap.tools.Logbook",
"math.copysign",
"numpy.array",
"numpy.random.uniform",
"random.random",
"deap.tools.Statistics",
"deap.base.Toolbox"
] | [((794, 829), 'numpy.random.uniform', 'np.random.uniform', (['smin', 'smax', 'size'], {}), '(smin, smax, size)\n', (811, 829), True, 'import numpy as np\n'), ((2284, 2298), 'deap.base.Toolbox', 'base.Toolbox', ([], {}), '()\n', (2296, 2298), False, 'from deap import base\n'), ((2729, 2777), 'deap.tools.Statistics', 'to... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
__author__ = 'Justin'
__mtime__ = '2018-06-02'
"""
import numpy as np
from skimage import color, morphology
from skimage.morphology import square
import os
import pandas as pd
def get_seeds(MaskLow, lowScale, highScale, patch_size_high, spacingHigh, margin = -8):
... | [
"os.listdir",
"skimage.morphology.square",
"os.path.splitext",
"os.getcwd",
"numpy.rint",
"pandas.DataFrame",
"os.remove"
] | [((2675, 2697), 'os.listdir', 'os.listdir', (['search_dir'], {}), '(search_dir)\n', (2685, 2697), False, 'import os\n'), ((3113, 3182), 'pandas.DataFrame', 'pd.DataFrame', (['data'], {'columns': "['filename', 'epoch', 'loss', 'accuracy']"}), "(data, columns=['filename', 'epoch', 'loss', 'accuracy'])\n", (3125, 3182), T... |
import json
import glob
files = glob.glob('../_gods/*.json') # array listing paths to all json files in _gods
# array of fields currently expected inside root of json
root_fields = ['name',
'release date',
'pantheon',
'role',
'type',
'basic ... | [
"json.dump",
"glob.glob"
] | [((34, 62), 'glob.glob', 'glob.glob', (['"""../_gods/*.json"""'], {}), "('../_gods/*.json')\n", (43, 62), False, 'import glob\n'), ((877, 907), 'json.dump', 'json.dump', (['result', 'result_file'], {}), '(result, result_file)\n', (886, 907), False, 'import json\n')] |
import os
import gym
from brl_gym.envs.mujoco.model_updater import MujocoUpdater
from gym import error
from gym.utils import seeding
import numpy as np
from os import path
import gym
import six
import time as timer
from gym import spaces
try:
import mujoco_py
from mujoco_py import load_model_from_path, load_... | [
"numpy.clip",
"mujoco_py.MjViewer",
"mujoco_py.MjRenderContextOffscreen",
"gym.utils.seeding.np_random",
"mujoco_py.MjSim",
"os.path.exists",
"mujoco_py.load_model_from_path",
"numpy.asarray",
"brl_gym.envs.mujoco.model_updater.MujocoUpdater.set_params",
"numpy.concatenate",
"mujoco_py.load_mode... | [((1135, 1165), 'mujoco_py.load_model_from_path', 'load_model_from_path', (['fullpath'], {}), '(fullpath)\n', (1155, 1165), False, 'from mujoco_py import load_model_from_path, load_model_from_xml, MjSim, MjViewer\n'), ((1474, 1491), 'mujoco_py.MjSim', 'MjSim', (['self.model'], {}), '(self.model)\n', (1479, 1491), False... |
#!/usr/env/bin python3
import subnet_calculator_v2
ip = '192.168.1.1'
network = '192.168.1.4/30'
cal = subnet_calculator_v2.subnet_calculator('192.168.1.0/29')
print("My network is {0}".format(cal.network))
print("Is ip {0} in my network?".format(ip))
print(cal.ip_in_subnet('192.168.1.1'))
print("Is network {0} a s... | [
"subnet_calculator_v2.subnet_calculator.ip_to_ptr",
"subnet_calculator_v2.subnet_calculator"
] | [((106, 162), 'subnet_calculator_v2.subnet_calculator', 'subnet_calculator_v2.subnet_calculator', (['"""192.168.1.0/29"""'], {}), "('192.168.1.0/29')\n", (144, 162), False, 'import subnet_calculator_v2\n'), ((524, 576), 'subnet_calculator_v2.subnet_calculator.ip_to_ptr', 'subnet_calculator_v2.subnet_calculator.ip_to_pt... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for the partition file entry implementation using pytsk3."""
import unittest
from dfvfs.path import os_path_spec
from dfvfs.path import tsk_partition_path_spec
from dfvfs.resolver import context
from dfvfs.vfs import tsk_partition_file_entry
from dfvfs.vfs import... | [
"dfvfs.path.tsk_partition_path_spec.TSKPartitionPathSpec",
"dfvfs.vfs.tsk_partition_file_entry.TSKPartitionFileEntry",
"dfvfs.path.os_path_spec.OSPathSpec",
"dfvfs.vfs.tsk_partition_file_system.TSKPartitionFileSystem",
"unittest.main",
"dfvfs.vfs.tsk_partition_file_entry.TSKPartitionDirectory",
"dfvfs.r... | [((8982, 8997), 'unittest.main', 'unittest.main', ([], {}), '()\n', (8995, 8997), False, 'import unittest\n'), ((614, 631), 'dfvfs.resolver.context.Context', 'context.Context', ([], {}), '()\n', (629, 631), False, 'from dfvfs.resolver import context\n'), ((750, 793), 'dfvfs.path.os_path_spec.OSPathSpec', 'os_path_spec.... |
import tensorflow as tf
def defmodel():
model = tf.keras.Sequential([tf.keras.layers.Flatten(input_shape=(28, 28)),
tf.keras.layers.Dense(256, activation='relu'),
tf.keras.layers.Dense(10)
])
return model
def ... | [
"tensorflow.keras.layers.Flatten",
"tensorflow.keras.losses.SparseCategoricalCrossentropy",
"tensorflow.keras.layers.Dense"
] | [((75, 120), 'tensorflow.keras.layers.Flatten', 'tf.keras.layers.Flatten', ([], {'input_shape': '(28, 28)'}), '(input_shape=(28, 28))\n', (98, 120), True, 'import tensorflow as tf\n'), ((155, 200), 'tensorflow.keras.layers.Dense', 'tf.keras.layers.Dense', (['(256)'], {'activation': '"""relu"""'}), "(256, activation='re... |
import sys
sys.path.append('yolov5')
import os
import glob
import argparse
from pathlib import Path
import yaml
from yolov5 import test
from models.experimental import attempt_load
from yolo.datasets import create_dataloader
from utils.general import check_img_size, check_file, colorstr
def _vali... | [
"models.experimental.attempt_load",
"argparse.ArgumentParser",
"pathlib.Path",
"utils.general.check_img_size",
"os.path.join",
"yolov5.test.run",
"utils.general.check_file",
"yaml.safe_load",
"os.path.dirname",
"utils.general.colorstr",
"os.path.abspath",
"sys.path.append",
"glob.glob"
] | [((14, 39), 'sys.path.append', 'sys.path.append', (['"""yolov5"""'], {}), "('yolov5')\n", (29, 39), False, 'import sys\n'), ((387, 401), 'pathlib.Path', 'Path', (['save_dir'], {}), '(save_dir)\n', (391, 401), False, 'from pathlib import Path\n'), ((609, 657), 'models.experimental.attempt_load', 'attempt_load', (['weigh... |
#!/usr/bin/env python3
import argparse
import os
import os.path as path
import numpy as np
import tensorflow as tf
from mobilenet.dataset import imagenet
def main(args):
tf.random.set_seed(0)
if not path.isdir(args.examples_dir):
os.makedirs(args.examples_dir)
data, _ = imagenet(args.split, tu... | [
"tensorflow.image.convert_image_dtype",
"tensorflow.random.set_seed",
"os.makedirs",
"argparse.ArgumentParser",
"numpy.argmax",
"os.path.isdir",
"tensorflow.io.encode_jpeg"
] | [((179, 200), 'tensorflow.random.set_seed', 'tf.random.set_seed', (['(0)'], {}), '(0)\n', (197, 200), True, 'import tensorflow as tf\n'), ((754, 854), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter', 'add_help': '(False)'}), '(formatter_class=argpa... |
#! /usr/bin/env python3
'''
Problem 53 - Project Euler
http://projecteuler.net/index.php?section=problems&id=053
'''
from math import factorial
def numcombi(n, r):
ret = 1
for i in range(r):
ret = ret * (n - i)
return int(ret / factorial(r))
if __name__ == '__main__':
N = 10 ** 6
maxn = 10... | [
"math.factorial"
] | [((249, 261), 'math.factorial', 'factorial', (['r'], {}), '(r)\n', (258, 261), False, 'from math import factorial\n')] |
"""
``main.py``
===========
Solução para o problema
"""
from __future__ import annotations
from graph import dijkstra
from waze import Waze
from mean import Mean
from utils import uncurry, run_many
import sys
from heapq import nsmallest
from operator import attrgetter
from copy import deepcopy
from typing import (
... | [
"operator.attrgetter",
"graph.dijkstra",
"waze.Waze",
"copy.deepcopy",
"timeit.timeit",
"utils.run_many"
] | [((531, 546), 'waze.Waze', 'Waze', (['max_speed'], {}), '(max_speed)\n', (535, 546), False, 'from waze import Waze\n'), ((1741, 1755), 'copy.deepcopy', 'deepcopy', (['waze'], {}), '(waze)\n', (1749, 1755), False, 'from copy import deepcopy\n'), ((1768, 1797), 'graph.dijkstra', 'dijkstra', (['graph', 'source', 'dest'], ... |
# 用于users子应用的视图路由
from django.urls import path
from users.views import RegisterView
from users.views import ImageCodeView
urlpatterns = [
# path的第一个参数1:路由
# 参数2:视图函数
# 参数3:路由名,方便通过reverse来获取路由
path('register/',RegisterView.as_view(),name='register'),
# 图片验证码的路由
path('imagecode/',ImageCodeView.a... | [
"users.views.ImageCodeView.as_view",
"users.views.RegisterView.as_view"
] | [((227, 249), 'users.views.RegisterView.as_view', 'RegisterView.as_view', ([], {}), '()\n', (247, 249), False, 'from users.views import RegisterView\n'), ((305, 328), 'users.views.ImageCodeView.as_view', 'ImageCodeView.as_view', ([], {}), '()\n', (326, 328), False, 'from users.views import ImageCodeView\n')] |
# -*- coding: utf-8 -*-
'''
Standard Dynamic Energy Budget model
'''
import numpy as np
import pandas as pd
import scipy.integrate as sid
import lmfit
import matplotlib.pyplot as plt
import seaborn as sns
import corner
from tqdm import tqdm
from collections import namedtuple
from lossfunc import symmetric_loss_functio... | [
"numpy.ones",
"pandas.DataFrame",
"tqdm.tqdm",
"lossfunc.symmetric_loss_function",
"deb_aux.physical_volume",
"numpy.exp",
"numpy.array",
"numpy.zeros",
"numpy.finfo",
"numpy.cbrt",
"scipy.integrate.ode",
"lmfit.Parameters",
"matplotlib.pyplot.subplots"
] | [((365, 384), 'numpy.finfo', 'np.finfo', (['np.double'], {}), '(np.double)\n', (373, 384), True, 'import numpy as np\n'), ((903, 989), 'pandas.DataFrame', 'pd.DataFrame', ([], {'columns': "['Min', 'Max', 'Value', 'Dimension', 'Units', 'Description']"}), "(columns=['Min', 'Max', 'Value', 'Dimension', 'Units',\n 'Desc... |
#!/usr/bin/env python
#---------------------------------------
# IMPORTS
#---------------------------------------
import test
from pymake2 import *
#---------------------------------------
# FUNCTIONS
#---------------------------------------
@target
def my_target_1(conf):
test.equal(conf.value, '123abc', "conf... | [
"test.equal",
"test.success"
] | [((643, 657), 'test.success', 'test.success', ([], {}), '()\n', (655, 657), False, 'import test\n'), ((282, 341), 'test.equal', 'test.equal', (['conf.value', '"""123abc"""', '"""conf.value is incorrect"""'], {}), "(conf.value, '123abc', 'conf.value is incorrect')\n", (292, 341), False, 'import test\n'), ((432, 498), 't... |
# build.py
import os
import platform
import sys
from setuptools import setup, find_packages
from torch.utils.ffi import create_extension
import torch
#extra_compile_args = ['-std=c++11', '-fPIC']
extra_compile_args = ['-std=c99', '-fPIC']
warp_ctc_path = "../build"
if torch.cuda.is_available() or "CUDA_HOME" in os.e... | [
"setuptools.find_packages",
"os.path.join",
"os.path.realpath",
"platform.system",
"torch.cuda.is_available",
"sys.exit"
] | [((272, 297), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (295, 297), False, 'import torch\n'), ((473, 490), 'platform.system', 'platform.system', ([], {}), '()\n', (488, 490), False, 'import platform\n'), ((1049, 1060), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (1057, 1060), False, 'i... |
from unittest.mock import Mock, patch, PropertyMock
from EPPs.common import StepEPP
from scripts import assign_to_workflow_stage
from tests.test_common import fake_all_inputs, TestEPP
class TestAssignWorkflowStage(TestEPP):
def setUp(self):
argv = self.default_argv + [
'--workflow', 'a_workflo... | [
"scripts.assign_to_workflow_stage.AssignWorkflowStage",
"unittest.mock.Mock",
"unittest.mock.patch.object"
] | [((579, 635), 'unittest.mock.patch.object', 'patch.object', (['StepEPP', '"""lims"""'], {'new_callable': 'PropertyMock'}), "(StepEPP, 'lims', new_callable=PropertyMock)\n", (591, 635), False, 'from unittest.mock import Mock, patch, PropertyMock\n'), ((433, 483), 'scripts.assign_to_workflow_stage.AssignWorkflowStage', '... |
import pandas as pd
from utils.storage import load_frame, dump_frame, DATA_PATH, check_if_stepframe, check_if_vecframe
def daySplitter(step_name, data_path=DATA_PATH):
"""
Splits entries into days and saves results as vecframe.
"""
stepframe = load_frame(step_name, data_path)
check_if_stepframe(s... | [
"utils.storage.dump_frame",
"pandas.read_csv",
"utils.storage.check_if_stepframe",
"utils.storage.load_frame",
"utils.storage.check_if_vecframe",
"pandas.concat"
] | [((263, 295), 'utils.storage.load_frame', 'load_frame', (['step_name', 'data_path'], {}), '(step_name, data_path)\n', (273, 295), False, 'from utils.storage import load_frame, dump_frame, DATA_PATH, check_if_stepframe, check_if_vecframe\n'), ((300, 329), 'utils.storage.check_if_stepframe', 'check_if_stepframe', (['step... |
from django.db import models
from cajas.office.models.officeCountry import OfficeCountry
class BoxProvisioning(models.Model):
"""Modelo para la caja de la oficina de un aprovisionamiento
"""
office = models.OneToOneField(
OfficeCountry,
verbose_name='Oficina',
on_delete=models.SE... | [
"django.db.models.OneToOneField",
"django.db.models.BooleanField",
"django.db.models.IntegerField"
] | [((216, 363), 'django.db.models.OneToOneField', 'models.OneToOneField', (['OfficeCountry'], {'verbose_name': '"""Oficina"""', 'on_delete': 'models.SET_NULL', 'blank': '(True)', 'null': '(True)', 'related_name': '"""box_provisioning"""'}), "(OfficeCountry, verbose_name='Oficina', on_delete=\n models.SET_NULL, blank=T... |
import numpy as np
from itertools import chain, islice, product, repeat, cycle, izip
from fos.actor.surf import CommonSurfaceGroup, IlluminatedSurfaceGroup
from fos.core.world import World
from fos.lib.pyglet.gl import *
from fos.lib.pyglet.graphics import Batch
from fos.core.actor import Actor
from fos.geometry.ve... | [
"itertools.chain",
"numpy.eye",
"itertools.cycle",
"numpy.array",
"itertools.chain.from_iterable",
"fos.geometry.vec3.Vec3",
"itertools.izip",
"itertools.repeat"
] | [((1850, 1922), 'itertools.chain.from_iterable', 'chain.from_iterable', (['(vertices[index] for face in faces for index in face)'], {}), '(vertices[index] for face in faces for index in face)\n', (1869, 1922), False, 'from itertools import chain, islice, product, repeat, cycle, izip\n'), ((6900, 6909), 'numpy.eye', 'np... |
import os
import re
import codecs
import unicodedata
def write(config, suites, target):
for suite in suites:
name_parts = suite.name.strip("/").split("/")
for i, s in enumerate(name_parts):
name_parts[i] = slugify(s)
path = "%s/%s" % (target, '/'.join(name_parts[:-1]))
... | [
"unicodedata.normalize",
"re.sub",
"codecs.open",
"os.makedirs"
] | [((4013, 4042), 're.sub', 're.sub', (['"""[-\\\\s]+"""', '"""-"""', 'value'], {}), "('[-\\\\s]+', '-', value)\n", (4019, 4042), False, 'import re\n'), ((322, 354), 'os.makedirs', 'os.makedirs', (['path'], {'exist_ok': '(True)'}), '(path, exist_ok=True)\n', (333, 354), False, 'import os\n'), ((3800, 3836), 'unicodedata.... |
# encoding=utf-8
from flask_login import LoginManager, AnonymousUser
from calepin.models import Blog
login_manager = LoginManager()
AnonymousUser.json = {}
login_manager.anonymous_user = AnonymousUser
login_manager.login_view = "frontend.site"
@login_manager.user_loader
def get_user(id):
return Blog.query.get... | [
"flask_login.LoginManager",
"calepin.models.Blog.query.get"
] | [((119, 133), 'flask_login.LoginManager', 'LoginManager', ([], {}), '()\n', (131, 133), False, 'from flask_login import LoginManager, AnonymousUser\n'), ((306, 324), 'calepin.models.Blog.query.get', 'Blog.query.get', (['id'], {}), '(id)\n', (320, 324), False, 'from calepin.models import Blog\n')] |