code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
#! /usr/bin/env python
# $Id: test_inline_markup.py 7793 2015-02-17 14:55:01Z milde $
# Author: <NAME> <<EMAIL>>
# Copyright: This module has been placed in the public domain.
"""
Tests for inline markup in PEPs (readers/pep.py).
"""
from __init__ import DocutilsTestSupport
def suite():
s = DocutilsTestSupport... | [
"unittest.main",
"__init__.DocutilsTestSupport.PEPParserTestSuite"
] | [((301, 341), '__init__.DocutilsTestSupport.PEPParserTestSuite', 'DocutilsTestSupport.PEPParserTestSuite', ([], {}), '()\n', (339, 341), False, 'from __init__ import DocutilsTestSupport\n'), ((3207, 3241), 'unittest.main', 'unittest.main', ([], {'defaultTest': '"""suite"""'}), "(defaultTest='suite')\n", (3220, 3241), F... |
import matplotlib.pyplot as plt
import numpy as np
from kino.steps import Paw
from kino.geometry import Trajectory
class Steps:
@staticmethod
def overlay_on_speed_trace(paw: Paw, ax: plt.Axes):
"""
Overlay the start/end of the steps on a paw's speed trace
"""
color = paw.t... | [
"numpy.arange"
] | [((1096, 1122), 'numpy.arange', 'np.arange', (['start', '(stop + 1)'], {}), '(start, stop + 1)\n', (1105, 1122), True, 'import numpy as np\n')] |
import os
import uuid
from .RenderfarmJob import RenderfarmJob
class ExpandedJob(RenderfarmJob):
"""
Implements an expanded render farm job.
An expanded job is used to run a task on the farm. The processing
of the task can be devided by chunks or in case a task cannot
be divided then it performs t... | [
"uuid.uuid1"
] | [((1052, 1064), 'uuid.uuid1', 'uuid.uuid1', ([], {}), '()\n', (1062, 1064), False, 'import uuid\n')] |
# -*- coding: utf-8 -*-
"""
run_doe.py generated by WhatsOpt.
"""
# DO NOT EDIT unless you know what you are doing
# analysis_id: 49
import numpy as np
# import matplotlib
# matplotlib.use('Agg')
import matplotlib.pyplot as plt
from openmdao.api import Problem, SqliteRecorder, CaseReader
from whatsopt.smt_doe_drive... | [
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"openmdao.api.SqliteRecorder",
"optparse.OptionParser",
"mod_branin.ModBranin",
"whatsopt.smt_doe_driver.SmtDoeDriver",
"numpy.zeros",
"matplotlib.pyplot.subplot",
"openmdao.api.CaseReader",
"matplotlib.pyplot.show... | [((420, 434), 'optparse.OptionParser', 'OptionParser', ([], {}), '()\n', (432, 434), False, 'from optparse import OptionParser\n'), ((662, 709), 'whatsopt.smt_doe_driver.SmtDoeDriver', 'SmtDoeDriver', ([], {'sampling_method': '"""LHS"""', 'n_cases': '(50)'}), "(sampling_method='LHS', n_cases=50)\n", (674, 709), False, ... |
# See https://web.archive.org/web/20171130091506/https:/www.sdyoung.com/home/decoding-the-pentair-easytouch-rs-485-protocol/
# For details on pentair protocol
#
import serial
from Connection import Connection, IOConnection
class SerialConnection(IOConnection):
def __init__(self, device):
super().__init__(... | [
"serial.Serial"
] | [((370, 540), 'serial.Serial', 'serial.Serial', ([], {'port': 'self.device', 'baudrate': '(9600)', 'parity': 'serial.PARITY_NONE', 'stopbits': 'serial.STOPBITS_ONE', 'bytesize': 'serial.EIGHTBITS', 'timeout': '(0.1)', 'write_timeout': '(0.1)'}), '(port=self.device, baudrate=9600, parity=serial.PARITY_NONE,\n stopbit... |
import discord
from discord import Option
from discord.ext import commands
from discord.ext.commands import BucketType, cooldown
import asyncio
import random
from Utilities import Checks, CombatObject, PlayerObject, Vars
from Utilities.CombatObject import Belligerent, CombatInstance
from Utilities.Confirm... | [
"discord.ext.commands.Cog.listener",
"Utilities.ConfirmationMenu.OfferMenu",
"random.choice",
"Utilities.CombatObject.Belligerent.load_player",
"Utilities.CombatObject.CombatInstance.on_turn_end",
"Utilities.CombatObject.Belligerent.load_boss",
"discord.ui.button",
"Utilities.PlayerObject.get_player_b... | [((584, 651), 'discord.ui.button', 'discord.ui.button', ([], {'label': '"""Join!"""', 'style': 'discord.ButtonStyle.primary'}), "(label='Join!', style=discord.ButtonStyle.primary)\n", (601, 651), False, 'import discord\n'), ((1239, 1262), 'discord.ext.commands.Cog.listener', 'commands.Cog.listener', ([], {}), '()\n', (... |
# Generated by Django 3.1.7 on 2021-03-28 11:25
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('expense', '0003_auto_20210310_0910'),
]
operations = [
migrations.CreateModel(
name='Budget',
fields=[
... | [
"django.db.models.DateField",
"django.db.models.TextField",
"django.db.models.IntegerField",
"django.db.models.AutoField",
"django.db.models.CharField"
] | [((1050, 1089), 'django.db.models.TextField', 'models.TextField', ([], {'blank': '(True)', 'null': '(True)'}), '(blank=True, null=True)\n', (1066, 1089), False, 'from django.db import migrations, models\n'), ((330, 423), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)', 'primary_key': '(... |
"""
Demo/test program for the AE_Relay driver.
See https://github.com/sensemakersamsterdam/astroplant_explorer
"""
#
# (c) Sensemakersams.org and others. See https://github.com/sensemakersamsterdam/astroplant_explorer
# Author: <NAME>
#
# Warning: if import of ae_* modules fails, then you need to set up PYTHONPATH.
# T... | [
"sys.stdout.flush",
"ae_drivers.relay.AE_Relay",
"time.sleep"
] | [((534, 576), 'ae_drivers.relay.AE_Relay', 'AE_Relay', (['"""rly1"""', '"""Fan1 Relay"""', 'AE_Pin.D16'], {}), "('rly1', 'Fan1 Relay', AE_Pin.D16)\n", (542, 576), False, 'from ae_drivers.relay import AE_Relay\n'), ((760, 768), 'time.sleep', 'sleep', (['(2)'], {}), '(2)\n', (765, 768), False, 'from time import sleep\n')... |
import numpy as np
x = np.array([0, 1])
w = np.array([0.5, 0.5])
b = -0.7
w * b
np.sum(w*x)
np.sum(w*x) + b | [
"numpy.array",
"numpy.sum"
] | [((24, 40), 'numpy.array', 'np.array', (['[0, 1]'], {}), '([0, 1])\n', (32, 40), True, 'import numpy as np\n'), ((46, 66), 'numpy.array', 'np.array', (['[0.5, 0.5]'], {}), '([0.5, 0.5])\n', (54, 66), True, 'import numpy as np\n'), ((85, 98), 'numpy.sum', 'np.sum', (['(w * x)'], {}), '(w * x)\n', (91, 98), True, 'import... |
from django.shortcuts import render, redirect
from django.views.generic import View
from utils.views import LoginRequiredMixin, LoginRequiredJSONMixin, TransactionAtomicMiXin
from django.core.urlresolvers import reverse
from goods.models import GoodsSKU
from django_redis import get_redis_connection
from users.models im... | [
"django.shortcuts.render",
"django_redis.get_redis_connection",
"goods.models.GoodsSKU.objects.get",
"users.models.Address.objects.filter",
"django.http.JsonResponse",
"alipay.AliPay",
"goods.models.GoodsSKU.objects.filter",
"orders.models.OrderInfo.objects.get",
"django.core.urlresolvers.reverse",
... | [((1294, 1349), 'django.shortcuts.render', 'render', (['request', '"""order_comment.html"""', "{'order': order}"], {}), "(request, 'order_comment.html', {'order': order})\n", (1300, 1349), False, 'from django.shortcuts import render, redirect\n'), ((3119, 3326), 'alipay.AliPay', 'AliPay', ([], {'appid': 'settings.ALIPA... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import argparse
from apppath import AppPath
__author__ = "<NAME>"
__doc__ = r"""This script will open data the directory of an app"""
from apppath.system_open_path_utilities import AppPathSubDirEnum, open_app_path
def open_arg():
""""""
parser = argparse.Argum... | [
"apppath.system_open_path_utilities.AppPathSubDirEnum",
"apppath.AppPath",
"argparse.ArgumentParser"
] | [((306, 362), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Apppath Open Path"""'}), "(description='Apppath Open Path')\n", (329, 362), False, 'import argparse\n'), ((894, 916), 'apppath.AppPath', 'AppPath', (['args.APP_NAME'], {}), '(args.APP_NAME)\n', (901, 916), False, 'from apppath ... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import json
import datetime
import os
from os import listdir
from os.path import isfile, join
from shutil import copyfile
import logging
import pandas as pd
logger = logging.getLogger("root")
logging.basicConfig(
format="\033[1;36m%(levelname)s: %(filename)s (def %(f... | [
"logging.getLogger",
"logging.basicConfig",
"os.listdir",
"pandas.read_csv",
"os.path.join",
"os.path.realpath",
"datetime.datetime.now",
"shutil.copyfile",
"pandas.DataFrame"
] | [((215, 240), 'logging.getLogger', 'logging.getLogger', (['"""root"""'], {}), "('root')\n", (232, 240), False, 'import logging\n'), ((241, 393), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""\x1b[1;36m%(levelname)s: %(filename)s (def %(funcName)s %(lineno)s): \x1b[1;37m %(message)s"""', 'level': 'lo... |
# coding: utf-8
"""
HyperOne
HyperOne API # noqa: E501
The version of the OpenAPI document: 0.1.0
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
from h1.configuration import Configuration
class BillingCharges(object):
"""NOTE: This class i... | [
"six.iteritems",
"h1.configuration.Configuration"
] | [((6170, 6203), 'six.iteritems', 'six.iteritems', (['self.openapi_types'], {}), '(self.openapi_types)\n', (6183, 6203), False, 'import six\n'), ((1512, 1527), 'h1.configuration.Configuration', 'Configuration', ([], {}), '()\n', (1525, 1527), False, 'from h1.configuration import Configuration\n')] |
# -*- coding: utf-8 -*-
import os
from masappcli.elevenpaths_auth import mASAPP_CI_auth
from tabulate import tabulate
import json
import time
import datetime
class mASAPP_CI():
"""
TODO ADD MASAPP_CI INFO
"""
LANGUAGES = ["en", "es"]
MASAPP_LINK = "https://masapp.elevenpaths.com/"
def _... | [
"tabulate.tabulate",
"json.loads",
"os.listdir",
"datetime.datetime.strptime",
"time.sleep",
"masappcli.elevenpaths_auth.mASAPP_CI_auth",
"os.path.abspath"
] | [((594, 631), 'masappcli.elevenpaths_auth.mASAPP_CI_auth', 'mASAPP_CI_auth', (['self.key', 'self.secret'], {}), '(self.key, self.secret)\n', (608, 631), False, 'from masappcli.elevenpaths_auth import mASAPP_CI_auth\n'), ((11976, 12001), 'os.path.abspath', 'os.path.abspath', (['app_path'], {}), '(app_path)\n', (11991, 1... |
from pathlib import Path
import re
from setuptools import setup
with open(str(Path(__file__).parent / 'wrapitup' / '_version.py')) as file:
version = file.read().strip()
match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", version, re.MULTILINE)
if match:
version = match.group(1)
else:
raise ValueError('Canno... | [
"setuptools.setup",
"pathlib.Path",
"re.search"
] | [((182, 258), 're.search', 're.search', (['"""^__version__ = [\'\\\\"]([^\'\\\\"]*)[\'\\\\"]"""', 'version', 're.MULTILINE'], {}), '(\'^__version__ = [\\\'\\\\"]([^\\\'\\\\"]*)[\\\'\\\\"]\', version, re.MULTILINE)\n', (191, 258), False, 'import re\n'), ((346, 1120), 'setuptools.setup', 'setup', ([], {'name': '"""wrapit... |
import logging
import os
import datetime
import random
import string
from nhd.NHDCommon import NHDCommon
from enum import Enum
from colorlog import ColoredFormatter
from kubernetes import client, config, watch
from kubernetes.client.rest import ApiException
from nhd.Node import Node
from typing import Dict, List, Set, ... | [
"magicattr.get",
"kubernetes.client.V1Event",
"random.choice",
"kubernetes.client.V1ObjectMeta",
"kubernetes.client.V1EventSource",
"kubernetes.watch.Watch",
"kubernetes.client.CoreV1Api",
"kubernetes.config.load_incluster_config",
"datetime.datetime.utcnow",
"kubernetes.config.load_kube_config",
... | [((942, 971), 'nhd.NHDCommon.NHDCommon.GetLogger', 'NHDCommon.GetLogger', (['__name__'], {}), '(__name__)\n', (961, 971), False, 'from nhd.NHDCommon import NHDCommon\n'), ((8310, 8323), 'kubernetes.watch.Watch', 'watch.Watch', ([], {}), '()\n', (8321, 8323), False, 'from kubernetes import client, config, watch\n'), ((1... |
# -*- coding: utf-8 -*-
"""A collection of combination methods for clustering
"""
# Author: <NAME> <<EMAIL>>
# License: BSD 2 clause
import numpy as np
from sklearn.utils import check_array
from sklearn.utils.validation import check_is_fitted
from numpy.testing import assert_equal
from pyod.utils.utility import che... | [
"sklearn.utils.validation.check_is_fitted",
"numpy.copy",
"numpy.intersect1d",
"numpy.testing.assert_equal",
"numpy.ones",
"numpy.unique",
"numpy.where",
"pyod.utils.utility.check_parameter",
"numpy.sum",
"numpy.zeros",
"numpy.argwhere",
"sklearn.utils.check_array"
] | [((6861, 6897), 'numpy.zeros', 'np.zeros', (['[n_clusters, n_estimators]'], {}), '([n_clusters, n_estimators])\n', (6869, 6897), True, 'import numpy as np\n'), ((6919, 6943), 'numpy.copy', 'np.copy', (['original_labels'], {}), '(original_labels)\n', (6926, 6943), True, 'import numpy as np\n'), ((8288, 8322), 'numpy.zer... |
"""Debug utilities for EGL operations"""
from OpenGL.EGL import *
import itertools
def eglErrorName(value):
"""Returns error constant if known, otherwise returns value"""
return KNOWN_ERRORS.get(value, value)
KNOWN_ERRORS = {
EGL_SUCCESS: EGL_SUCCESS,
EGL_NOT_INITIALIZED: EGL_NOT_INITIAL... | [
"itertools.groupby"
] | [((7284, 7330), 'itertools.groupby', 'itertools.groupby', (['columns', "(lambda x: x['col'])"], {}), "(columns, lambda x: x['col'])\n", (7301, 7330), False, 'import itertools\n')] |
# -*- coding: utf-8 -*-
"""Test suite around :mod:`django_downloadview.api` and deprecation plan."""
import unittest
from six.moves import reload_module as reload
import warnings
from django.core.exceptions import ImproperlyConfigured
import django.test
from django.test.utils import override_settings
from django.utils... | [
"warnings.resetwarnings",
"warnings.catch_warnings",
"six.moves.reload_module",
"warnings.simplefilter",
"django.test.utils.override_settings",
"django.utils.importlib.import_module"
] | [((603, 629), 'django.utils.importlib.import_module', 'import_module', (['module_path'], {}), '(module_path)\n', (616, 629), False, 'from django.utils.importlib import import_module\n'), ((3572, 3669), 'django.test.utils.override_settings', 'override_settings', ([], {'MIDDLEWARE_CLASSES': "['django_downloadview.nginx.X... |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsRasterFileWriterTask.
.. note:: This program 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; either version 2 of the License, or
(at your option) any later versio... | [
"os.path.exists",
"qgis.core.QgsRasterLayer",
"qgis.core.QgsRasterPipe",
"utilities.unitTestDataPath",
"qgis.testing.start_app",
"qgis.testing.unittest.main",
"qgis.core.QgsRasterFileWriter",
"qgis.PyQt.QtCore.QDir.tempPath",
"qgis.PyQt.QtCore.QCoreApplication.processEvents",
"qgis.core.QgsApplica... | [((891, 902), 'qgis.testing.start_app', 'start_app', ([], {}), '()\n', (900, 902), False, 'from qgis.testing import start_app, unittest\n'), ((3451, 3466), 'qgis.testing.unittest.main', 'unittest.main', ([], {}), '()\n', (3464, 3466), False, 'from qgis.testing import start_app, unittest\n'), ((1415, 1443), 'qgis.core.Q... |
from openmdao.api import ExplicitComponent
import numpy as np
class SellarDis1(ExplicitComponent):
"""
Component containing Discipline 1.
"""
def __init__(self, derivative_method='full_analytic', **kwargs):
super(SellarDis1, self).__init__(**kwargs)
self.derivative_method = derivative... | [
"numpy.exp",
"numpy.array",
"numpy.zeros"
] | [((1468, 1507), 'numpy.array', 'np.array', (["[[2.0 * inputs['z'][0], 1.0]]"], {}), "([[2.0 * inputs['z'][0], 1.0]])\n", (1476, 1507), True, 'import numpy as np\n'), ((3185, 3207), 'numpy.array', 'np.array', (['[[1.0, 1.0]]'], {}), '([[1.0, 1.0]])\n', (3193, 3207), True, 'import numpy as np\n'), ((7835, 7855), 'numpy.a... |
import torch
from torch import nn
from utils import spatial_softmax
class Block(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size=(3, 3), stride=1,
padding=1):
super(Block, self).__init__()
self.conv = nn.Conv2d(
in_channels, out_channels, kernel_si... | [
"torch.nn.BatchNorm2d",
"torch.stack",
"torch.relu",
"torch.Tensor",
"torch.pow",
"torch.exp",
"torch.nn.Conv2d",
"torch.unbind",
"torch.nn.UpsamplingBilinear2d",
"torch.reshape",
"torch.linspace"
] | [((3562, 3593), 'torch.stack', 'torch.stack', (['(u_row, u_col)', '(-1)'], {}), '((u_row, u_col), -1)\n', (3573, 3593), False, 'import torch\n'), ((3844, 3911), 'torch.linspace', 'torch.linspace', (['(-1.0)', '(1.0)', 'height'], {'dtype': 'mu.dtype', 'device': 'mu.device'}), '(-1.0, 1.0, height, dtype=mu.dtype, device=... |
import os
def before_all(context):
context.tmpfiles = []
def after_all(context):
for filename in context.tmpfiles:
os.remove(filename)
| [
"os.remove"
] | [((135, 154), 'os.remove', 'os.remove', (['filename'], {}), '(filename)\n', (144, 154), False, 'import os\n')] |
import click
from flask.cli import with_appcontext
from ..helper import db_add, db_commit, db_delete, db_update, get_object_model
@click.group("permission")
def group():
"""
Role permission manager.
"""
@group.command()
@with_appcontext
@click.argument("name")
@click.option("-d", "--des... | [
"click.group",
"click.argument",
"click.option"
] | [((140, 165), 'click.group', 'click.group', (['"""permission"""'], {}), "('permission')\n", (151, 165), False, 'import click\n'), ((270, 292), 'click.argument', 'click.argument', (['"""name"""'], {}), "('name')\n", (284, 292), False, 'import click\n'), ((295, 382), 'click.option', 'click.option', (['"""-d"""', '"""--de... |
# -*- coding: utf-8 -*-
from ckeditor_uploader.widgets import CKEditorUploadingWidget
from django import forms
from .models import Topic
class CommentForm(forms.Form):
'''回答评论表单'''
comment = forms.CharField(label='评论', widget=forms.Textarea(
attrs={'class': 'form-control', 'rows': '3'}), required=Tr... | [
"django.forms.BooleanField",
"django.forms.SelectMultiple",
"django.forms.Textarea",
"django.forms.TextInput",
"ckeditor_uploader.widgets.CKEditorUploadingWidget"
] | [((1198, 1246), 'django.forms.BooleanField', 'forms.BooleanField', ([], {'label': '"""匿名提问"""', 'required': '(False)'}), "(label='匿名提问', required=False)\n", (1216, 1246), False, 'from django import forms\n'), ((1431, 1479), 'django.forms.BooleanField', 'forms.BooleanField', ([], {'label': '"""匿名回答"""', 'required': '(Fa... |
import datetime
import pytz
from pyfacebook import models as m
# This list stores the order in which models should be tested for GET
# Order matters because some models contain others
CONNECTIONS = {
m.AdAccount: {'adgroupstats': {'adgroup_ids': [1, 2, 3, 4, 5],
'start_time': da... | [
"datetime.datetime"
] | [((318, 347), 'datetime.datetime', 'datetime.datetime', (['(2014)', '(3)', '(1)'], {}), '(2014, 3, 1)\n', (335, 347), False, 'import datetime\n'), ((421, 450), 'datetime.datetime', 'datetime.datetime', (['(2014)', '(3)', '(2)'], {}), '(2014, 3, 2)\n', (438, 450), False, 'import datetime\n')] |
"""client
Usage:
client.py [options]
Options:
-a --address ADDRESS Address to connect [default: localhost]
-p --port PORT Port to connect to [default: 9000]
-d --debug Debug enabled? [default: False]
--steam_id steam_id to login with [default: 1]
"""
from web... | [
"_message_factory.GatewayMessageFactory",
"docopt.docopt"
] | [((2494, 2509), 'docopt.docopt', 'docopt', (['__doc__'], {}), '(__doc__)\n', (2500, 2509), False, 'from docopt import docopt\n'), ((673, 696), '_message_factory.GatewayMessageFactory', 'GatewayMessageFactory', ([], {}), '()\n', (694, 696), False, 'from _message_factory import GatewayMessageFactory\n')] |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-04-23 12:39
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('wagtailmenus', '0013_auto_20160423_1124'),
]
operations = [
migrations.Alter... | [
"django.db.models.BooleanField"
] | [((417, 647), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(False)', 'help_text': '"""NOTE: The sub-menu might might not be displayed, even if checked. It depends on how the menu is being used within your project."""', 'verbose_name': '"""allow sub-menu for this item"""'}), "(default=False,... |
from sklearn.utils.estimator_checks import check_estimator
import xgp
def test_regressor_check_estimator():
return
return check_estimator(xgp.XGPRegressor)
| [
"sklearn.utils.estimator_checks.check_estimator"
] | [((133, 166), 'sklearn.utils.estimator_checks.check_estimator', 'check_estimator', (['xgp.XGPRegressor'], {}), '(xgp.XGPRegressor)\n', (148, 166), False, 'from sklearn.utils.estimator_checks import check_estimator\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: ai ts=4 sts=4 et sw=4 nu
# Created by: python.exe -m py2exe main.py -W setup_win.py
import py2exe
from distutils.core import setup
from ramed.static import Constants
RT_MANIFEST = 24
# A manifest which specifies the executionlevel
# and windows common-controls li... | [
"distutils.core.setup"
] | [((1944, 2046), 'distutils.core.setup', 'setup', ([], {'name': '"""RAMED"""', 'console': '[]', 'windows': '[main]', 'zipfile': 'None', 'options': "{'py2exe': py2exe_options}"}), "(name='RAMED', console=[], windows=[main], zipfile=None, options={\n 'py2exe': py2exe_options})\n", (1949, 2046), False, 'from distutils.c... |
import numpy as np
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import backend as K
from scipy.stats import multinomial
from ..utils.array import one_hot
from .categorical import CategoricalDist
if tf.__version__ >= '2.0':
tf.random.set_seed(11)
else:
tf.set_random_seed(11)
rnd ... | [
"numpy.testing.assert_array_almost_equal",
"tensorflow.random.set_seed",
"numpy.ones",
"tensorflow.keras.layers.Lambda",
"tensorflow.keras.layers.Dense",
"tensorflow.keras.Input",
"tensorflow.keras.Model",
"scipy.stats.multinomial",
"tensorflow.set_random_seed",
"numpy.random.RandomState"
] | [((322, 347), 'numpy.random.RandomState', 'np.random.RandomState', (['(13)'], {}), '(13)\n', (343, 347), True, 'import numpy as np\n'), ((438, 471), 'tensorflow.keras.Input', 'keras.Input', (['[5]'], {'dtype': '"""float32"""'}), "([5], dtype='float32')\n", (449, 471), False, 'from tensorflow import keras\n'), ((476, 50... |
# coding=utf-8
# Copyright (c) DIRECT Contributors
import pathlib
import urllib.parse
from direct.utils.io import check_is_valid_url, read_list
def get_filenames_for_datasets(cfg, files_root, data_root):
"""Given a list of filenames of data points, concatenate these into a large list of full filenames.
Para... | [
"direct.utils.io.check_is_valid_url",
"direct.utils.io.read_list",
"pathlib.Path"
] | [((707, 737), 'direct.utils.io.check_is_valid_url', 'check_is_valid_url', (['files_root'], {}), '(files_root)\n', (725, 737), False, 'from direct.utils.io import check_is_valid_url, read_list\n'), ((847, 871), 'pathlib.Path', 'pathlib.Path', (['files_root'], {}), '(files_root)\n', (859, 871), False, 'import pathlib\n')... |
# Generated by Django 4.0.1 on 2022-04-26 16:43
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('company', '0020_alter_building_created_by'),
]
operations = [
migrations.RemoveField(
model_name='building',
name='created_b... | [
"django.db.migrations.RemoveField"
] | [((234, 298), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""building"""', 'name': '"""created_by"""'}), "(model_name='building', name='created_by')\n", (256, 298), False, 'from django.db import migrations\n')] |
#!/usr/bin/python
import sys
import textadapter
import unittest
from .generate import (generate_dataset, IntIter,
MissingValuesIter, FixedWidthIter)
import numpy as np
from numpy.testing import assert_array_equal
import gzip
import os
import io
from six import StringIO
class TestTextAdapter(uni... | [
"textadapter.FixedWidthTextAdapter",
"os.path.exists",
"numpy.dtype",
"unittest.TestLoader",
"textadapter.RegexTextAdapter",
"io.BytesIO",
"textadapter.text_adapter",
"numpy.array",
"gzip.GzipFile",
"six.StringIO",
"io.StringIO",
"unittest.TextTestRunner",
"numpy.testing.assert_array_equal",... | [((798, 817), 'six.StringIO', 'StringIO', (['"""1,2,3\n"""'], {}), "('1,2,3\\n')\n", (806, 817), False, 'from six import StringIO\n'), ((836, 885), 'textadapter.text_adapter', 'textadapter.text_adapter', (['data'], {'field_names': '(False)'}), '(data, field_names=False)\n', (860, 885), False, 'import textadapter\n'), (... |
# Lint as: python3
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | [
"os.path.dirname",
"subprocess.run",
"argparse.ArgumentTypeError"
] | [((2038, 2114), 'subprocess.run', 'subprocess.run', (['args'], {'cwd': 'cwd', 'check': '(True)', 'universal_newlines': 'text'}), '(args, cwd=cwd, check=True, universal_newlines=text, **kwargs)\n', (2052, 2114), False, 'import subprocess\n'), ((1273, 1326), 'argparse.ArgumentTypeError', 'argparse.ArgumentTypeError', (['... |
# Generated by Django 3.1.2 on 2021-04-27 04:52
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0006_auto_20210427_0433'),
]
operations = [
migrations.AddField(
model_name='profile',
name='works_at',
... | [
"django.db.models.CharField"
] | [((335, 452), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'help_text': '"""Tell us where you currently work (optional)"""', 'max_length': '(200)', 'null': '(True)'}), "(blank=True, help_text=\n 'Tell us where you currently work (optional)', max_length=200, null=True)\n", (351, 452), Fa... |
"""Remote client command for stopping pod and container(s)."""
import sys
import podman
from pypodman.lib import AbstractActionBase
from pypodman.lib import query_model as query_pods
class StopPod(AbstractActionBase):
"""Class for stopping pod and container(s)."""
@classmethod
def subparser(cls, parent)... | [
"pypodman.lib.query_model"
] | [((1029, 1065), 'pypodman.lib.query_model', 'query_pods', (['self.client.pods', 'idents'], {}), '(self.client.pods, idents)\n', (1039, 1065), True, 'from pypodman.lib import query_model as query_pods\n')] |
# -*- coding: utf-8 -*-
import os
import platform
from tcfcli.common.user_exceptions import *
home = os.path.expanduser('~')
_USER_CONFIG_FILE = home + '/.tcli_config.ini'
version = platform.python_version()
if version >= '3':
from configparser import ConfigParser
else:
from ConfigParser import ConfigParser
... | [
"ConfigParser.ConfigParser.__init__",
"platform.python_version",
"os.path.expanduser"
] | [((103, 126), 'os.path.expanduser', 'os.path.expanduser', (['"""~"""'], {}), "('~')\n", (121, 126), False, 'import os\n'), ((185, 210), 'platform.python_version', 'platform.python_version', ([], {}), '()\n', (208, 210), False, 'import platform\n'), ((407, 449), 'ConfigParser.ConfigParser.__init__', 'ConfigParser.__init... |
"""
Test file formats.
"""
import wave
import numpy
import pytest
from pytest import approx
from scipy.io import wavfile
from scipy.fftpack import fft
from diapason import generate_wav
@pytest.mark.parametrize(('frequency', 'duration', 'rate'), [
(440., 2., 44100),
(220., 1., 48000),
(880., 3., 16000),
... | [
"pytest.approx",
"wave.open",
"numpy.argmax",
"pytest.mark.parametrize",
"diapason.generate_wav",
"scipy.io.wavfile.read",
"scipy.fftpack.fft"
] | [((190, 318), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (["('frequency', 'duration', 'rate')", '[(440.0, 2.0, 44100), (220.0, 1.0, 48000), (880.0, 3.0, 16000)]'], {}), "(('frequency', 'duration', 'rate'), [(440.0, 2.0, \n 44100), (220.0, 1.0, 48000), (880.0, 3.0, 16000)])\n", (213, 318), False, 'import p... |
# -*- coding: utf-8 -*-
"""
Unit Test Template
"""
from __future__ import absolute_import, division, print_function
import sys
import unittest
import os
import datetime
from ioflo.aid.sixing import *
from ioflo.aid.odicting import odict
from ioflo.test import testing
from ioflo.aid.consoling import getConsole
consol... | [
"datetime.datetime",
"unittest.TestSuite",
"unittest.TestLoader",
"ioflo.aid.timing.timestamp",
"datetime.datetime.utcnow",
"datetime.datetime.now",
"ioflo.aid.timing.Stamper",
"ioflo.aid.timing.tuuid",
"ioflo.aid.timing.iso8601",
"unittest.TextTestRunner",
"ioflo.aid.consoling.getConsole"
] | [((324, 336), 'ioflo.aid.consoling.getConsole', 'getConsole', ([], {}), '()\n', (334, 336), False, 'from ioflo.aid.consoling import getConsole\n'), ((4435, 4461), 'unittest.TestSuite', 'unittest.TestSuite', (['[test]'], {}), '([test])\n', (4453, 4461), False, 'import unittest\n'), ((4770, 4795), 'unittest.TestSuite', '... |
from pandas import DataFrame
from tests.helpers import ExprTestCase
from pylars.dsl import _
class TestStringExpr(ExprTestCase):
def data(self):
return DataFrame({
"animal": ["dog", "cat", "horse"],
"fruit": ["banana", "orange", "apple"],
"fold": ["yo", "YO", "Fluß"],
... | [
"pylars.dsl._.fruit.match",
"pylars.dsl._.animal.capitalize",
"pylars.dsl._.animal.upper",
"pylars.dsl._.fold.casefold",
"pylars.dsl._.fold.contains",
"pylars.dsl._.many.title",
"pandas.DataFrame",
"pylars.dsl._.animal.len",
"pylars.dsl._.animal.replace",
"pylars.dsl._.animal.lower"
] | [((167, 330), 'pandas.DataFrame', 'DataFrame', (["{'animal': ['dog', 'cat', 'horse'], 'fruit': ['banana', 'orange', 'apple'],\n 'fold': ['yo', 'YO', 'Fluß'], 'many': ['dog dog', 'cat cat', 'H H']}"], {}), "({'animal': ['dog', 'cat', 'horse'], 'fruit': ['banana', 'orange',\n 'apple'], 'fold': ['yo', 'YO', 'Fluß'],... |
import argparse
import logging
import os
import copy
from collections import defaultdict
from typing import List
import numpy as np
import torch
from sklearn import metrics
from torch.nn.utils.rnn import pad_sequence
from torch.utils.data.dataloader import DataLoader
from training.models import RNNClassifier
from opera... | [
"torch.manual_seed",
"torch.ones",
"json.JSONEncoder.default",
"torch.sigmoid",
"os.path.join",
"torch.nn.utils.rnn.pad_sequence",
"sklearn.metrics.roc_auc_score",
"sklearn.metrics.recall_score",
"torch.no_grad",
"torch.zeros",
"collections.defaultdict",
"numpy.random.seed",
"copy.deepcopy",... | [((788, 1293), 'training.models.RNNClassifier', 'RNNClassifier', ([], {'arch': 'args.arch', 'static_input_size': 'args.static_input_size', 'dynamic_input_size': 'args.dynamic_input_size', 'static_embedding_size': 'args.static_embedding_size', 'hidden_size': 'args.hidden_size', 'dropout': 'args.dropout', 'rnn_layers': '... |
#!/usr/bin/env python
#--*-- coding:UTF-8 --*--
from PIL import Image
from PIL.ExifTags import TAGS
def get_exif():
ret = {}
i = Image.open('images/image.jpg')
info = i._getexif()
#info = i.tag.tags
for tag, value in info.items():
decoded = TAGS.get(tag, tag)
ret[decoded] = value
return ret
test=get_exi... | [
"PIL.Image.open",
"PIL.ExifTags.TAGS.get"
] | [((132, 162), 'PIL.Image.open', 'Image.open', (['"""images/image.jpg"""'], {}), "('images/image.jpg')\n", (142, 162), False, 'from PIL import Image\n'), ((253, 271), 'PIL.ExifTags.TAGS.get', 'TAGS.get', (['tag', 'tag'], {}), '(tag, tag)\n', (261, 271), False, 'from PIL.ExifTags import TAGS\n')] |
# Copyright 2018,2019,2020,2021 Sony 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/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | [
"collections.namedtuple"
] | [((634, 701), 'collections.namedtuple', 'collections.namedtuple', (['"""_SupportedInfo"""', '"""import_name export_name"""'], {}), "('_SupportedInfo', 'import_name export_name')\n", (656, 701), False, 'import collections\n')] |
"""
This module provides an input processor for information extracted using the
Geneways software suite, converting extraction data in Geneways format into
INDRA statements.
See publication:
Rzhetsky, Andrey, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME> et al. "GeneWays: a system for extracting,
analyzing, visualizi... | [
"indra.statements.Phosphorylation",
"indra.databases.hgnc_client.get_hgnc_from_entrez",
"indra.statements.Agent",
"indra.statements.Complex",
"indra.statements.Evidence",
"indra.ontology.standardize.standardize_agent_name",
"indra.sources.geneways.find_full_text_sentence.FullTextMention",
"indra.sourc... | [((5917, 5952), 'indra.databases.hgnc_client.get_hgnc_from_entrez', 'hgc.get_hgnc_from_entrez', (['entrez_id'], {}), '(entrez_id)\n', (5941, 5952), True, 'import indra.databases.hgnc_client as hgc\n'), ((6015, 6047), 'indra.statements.Agent', 'Agent', (['raw_name'], {'db_refs': 'db_refs'}), '(raw_name, db_refs=db_refs)... |
# -*- coding:utf-8 -*-
import os
import sublime
from urllib.parse import urljoin
from sublime_plugin import ApplicationCommand
from .command import CommandWithStatus
from ..logger import logger
from ..archiver import Archiver
from .. import requests
from .. import SETTINGS_USER_FILE
class UploadCommand(Application... | [
"sublime.active_window",
"sublime.version",
"sublime.set_timeout_async",
"os.unlink",
"sublime.arch",
"sublime.platform",
"sublime.load_settings"
] | [((1811, 1859), 'sublime.set_timeout_async', 'sublime.set_timeout_async', (['self.pack_and_send', '(0)'], {}), '(self.pack_and_send, 0)\n', (1836, 1859), False, 'import sublime\n'), ((2995, 3027), 'os.unlink', 'os.unlink', (['self.archive_filename'], {}), '(self.archive_filename)\n', (3004, 3027), False, 'import os\n')... |
# import class and library
from turtle import Screen
from snake import Snake
from food import Food
from scoreboard import Scoreboard
import time
# setupping screen
screen = Screen()
screen.setup(width=600, height=600)
screen.bgcolor("black")
screen.title("Snake Game")
screen.tracer(0)
# creating snake player from s... | [
"snake.Snake",
"time.sleep",
"scoreboard.Scoreboard",
"turtle.Screen",
"food.Food"
] | [((176, 184), 'turtle.Screen', 'Screen', ([], {}), '()\n', (182, 184), False, 'from turtle import Screen\n'), ((346, 353), 'snake.Snake', 'Snake', ([], {}), '()\n', (351, 353), False, 'from snake import Snake\n'), ((361, 367), 'food.Food', 'Food', ([], {}), '()\n', (365, 367), False, 'from food import Food\n'), ((381, ... |
import torch
from torch import nn
import torch.optim as optim
from tqdm import tqdm
from models import LeNetMLP
from pruning import prune_net, get_pruned_proportion, reset_network
from utils import (
ExperimentConfig, create_log, load_data, calc_accuracy, log_instance
)
device = torch.device('cuda' if torch.cud... | [
"utils.log_instance",
"models.LeNetMLP",
"torch.nn.CrossEntropyLoss",
"utils.load_data",
"utils.calc_accuracy",
"pruning.get_pruned_proportion",
"utils.ExperimentConfig",
"torch.cuda.is_available",
"utils.create_log",
"pruning.reset_network",
"pruning.prune_net"
] | [((497, 518), 'torch.nn.CrossEntropyLoss', 'nn.CrossEntropyLoss', ([], {}), '()\n', (516, 518), False, 'from torch import nn\n'), ((1125, 1214), 'utils.load_data', 'load_data', (['"""data"""'], {'dataset': 'config.train_dataset', 'classes': 'classes', 'noise': 'config.noise'}), "('data', dataset=config.train_dataset, c... |
import os
import torch
import numpy as np
import json
import dgl
import constants
def read_partitions_file(part_file):
"""
Utility method to read metis partitions, which is the output of
pm_dglpart2
Parameters:
-----------
part_file : string
file name which is the output of metis part... | [
"os.makedirs",
"dgl.data.utils.load_tensors",
"os.path.join",
"dgl.save_graphs",
"numpy.array",
"dgl.data.utils.save_tensors",
"numpy.concatenate",
"json.load",
"numpy.loadtxt",
"json.dump"
] | [((692, 744), 'numpy.loadtxt', 'np.loadtxt', (['part_file'], {'delimiter': '""" """', 'dtype': 'np.int64'}), "(part_file, delimiter=' ', dtype=np.int64)\n", (702, 744), True, 'import numpy as np\n'), ((6200, 6252), 'numpy.loadtxt', 'np.loadtxt', (['nodes_file'], {'delimiter': '""" """', 'dtype': '"""int64"""'}), "(node... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: © 2021 Massachusetts Institute of Technology.
# SPDX-FileCopyrightText: © 2021 <NAME> <<EMAIL>>
# NOTICE: authors should document their contributions in concisely in NOTICE
# with details inline in source files... | [
"numpy.mean",
"wavestate.utilities.mpl.mplfigB",
"numpy.argsort",
"numpy.array",
"numpy.argmin"
] | [((755, 768), 'numpy.array', 'np.array', (['arg'], {}), '(arg)\n', (763, 768), True, 'import numpy as np\n'), ((1066, 1079), 'numpy.array', 'np.array', (['arg'], {}), '(arg)\n', (1074, 1079), True, 'import numpy as np\n'), ((1920, 1939), 'numpy.argmin', 'np.argmin', (['self.R_m'], {}), '(self.R_m)\n', (1929, 1939), Tru... |
from datetime import datetime
from multiprocessing import Pipe, Process
from multiprocessing.connection import Connection
from threading import Thread
from typing import Optional
import schedule
from schedule import default_scheduler
class OneTimeJob(schedule.Job):
# Override schedule.Job._schedule_next_run to a... | [
"multiprocessing.Process",
"schedule.default_scheduler.once",
"schedule.CancelJob",
"datetime.datetime.now",
"threading.Thread",
"multiprocessing.Pipe"
] | [((2445, 2518), 'schedule.default_scheduler.once', 'default_scheduler.once', ([], {'self': 'default_scheduler', 'trigger_time': 'trigger_time'}), '(self=default_scheduler, trigger_time=trigger_time)\n', (2467, 2518), False, 'from schedule import default_scheduler\n'), ((1022, 1042), 'schedule.CancelJob', 'schedule.Canc... |
# Copyright 2022 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import os
import subprocess
from pex.cli.testing import run_pex3
from pex.interpreter import PythonInterpreter
from pex.pex_info import PexInfo
from pex.resolve import lockfile
from pex.t... | [
"subprocess.check_call",
"pex.testing.run_pex_command",
"pex.cli.testing.run_pex3",
"pex.pex_info.PexInfo.from_pex",
"pex.resolve.lockfile.load"
] | [((1180, 1199), 'pex.resolve.lockfile.load', 'lockfile.load', (['lock'], {}), '(lock)\n', (1193, 1199), False, 'from pex.resolve import lockfile\n'), ((2119, 2190), 'subprocess.check_call', 'subprocess.check_call', ([], {'args': "[interp.binary, pex, '-c', 'import psutil']"}), "(args=[interp.binary, pex, '-c', 'import ... |
from setuptools import setup
setup(
name='pyg',
version='0.1',
description='HTML markup in Python',
url='http://github.com/ccharly/pyg',
author='<NAME>',
author_email='<EMAIL>',
license='MIT',
packages=['pyg'],
scripts=['bin/pyg'],
zip_safe=False)
| [
"setuptools.setup"
] | [((30, 261), 'setuptools.setup', 'setup', ([], {'name': '"""pyg"""', 'version': '"""0.1"""', 'description': '"""HTML markup in Python"""', 'url': '"""http://github.com/ccharly/pyg"""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'license': '"""MIT"""', 'packages': "['pyg']", 'scripts': "['bin/pyg']", 'zi... |
# 5. Vorlesung 17.10.2020, Skript Python 4 (07_Python_04.pdf)
# Übung 2: Datei auslesen, Summen aus Artikel Anz und Einzelpreisen bilden
import re
muster = "(\d+),.*\s(\d+\.\d+)"
gesamtpreis = 0.0
qd = open("vorl5-ueb2-daten.txt","r")
for qdZeile in qd:
ergebnis = re.search(muster,qdZeile)
if ergebnis:
... | [
"re.search"
] | [((273, 299), 're.search', 're.search', (['muster', 'qdZeile'], {}), '(muster, qdZeile)\n', (282, 299), False, 'import re\n')] |
from secrets import token_bytes
from hashlib import sha384
from datetime import datetime
from datetime import timedelta
from flask import request
from app import db
from app.models import Salt
def gen_salt() -> Salt:
salt = Salt()
salt.string = token_bytes(10).hex()
db.session.add(salt)
db.session.... | [
"app.db.session.commit",
"app.db.session.delete",
"app.models.Salt",
"secrets.token_bytes",
"datetime.datetime.now",
"app.db.session.add",
"app.models.Salt.query.first",
"datetime.timedelta",
"flask.request.headers.get"
] | [((232, 238), 'app.models.Salt', 'Salt', ([], {}), '()\n', (236, 238), False, 'from app.models import Salt\n'), ((284, 304), 'app.db.session.add', 'db.session.add', (['salt'], {}), '(salt)\n', (298, 304), False, 'from app import db\n'), ((309, 328), 'app.db.session.commit', 'db.session.commit', ([], {}), '()\n', (326, ... |
import cgi
import unittest
from whodat.http import *
class HTTPRequestTest(unittest.TestCase):
def test_method(self):
request = HTTPRequest.get()
self.assertEqual(request.method, 'GET')
request = HTTPRequest.head()
self.assertEqual(request.method, 'HEAD')
request = HTTPRe... | [
"unittest.main"
] | [((9852, 9867), 'unittest.main', 'unittest.main', ([], {}), '()\n', (9865, 9867), False, 'import unittest\n')] |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import json
import warnings
import pulumi
import pulumi.runtime
from .. import utilities, tables
class Snapshot(pulumi.CustomResource)... | [
"warnings.warn"
] | [((3355, 3430), 'warnings.warn', 'warnings.warn', (['"""explicit use of __name__ is deprecated"""', 'DeprecationWarning'], {}), "('explicit use of __name__ is deprecated', DeprecationWarning)\n", (3368, 3430), False, 'import warnings\n'), ((3513, 3612), 'warnings.warn', 'warnings.warn', (['"""explicit use of __opts__ i... |
import os
dataset = ['csail', 'manhattan', 'intel', 'mit']
inliers_quantity = [127, 1952, 256, 20]
inliers_percentages = [0.5, 0.6, 0.7, 0.8, 0.9]
sample_size = 10
outliers_quantity = []
for i in range(0, len(dataset)):
outliers_quantity.append([])
for inlier_percentage in inliers_percentages:
inli... | [
"os.chdir",
"os.system"
] | [((459, 501), 'os.chdir', 'os.chdir', (['"""/home/amber/stew/pose_dataset/"""'], {}), "('/home/amber/stew/pose_dataset/')\n", (467, 501), False, 'import os\n'), ((979, 1028), 'os.chdir', 'os.chdir', (["(dataset_name + '_' + configuration_name)"], {}), "(dataset_name + '_' + configuration_name)\n", (987, 1028), False, '... |
import scipy.misc as misc
import torch
import copy
import torchvision.models as models
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
# FCN Net model class for semantic segmentation
##############################################This is a standart FCN with the lat layer split into prediction o... | [
"torch.nn.BatchNorm2d",
"torch.nn.ReLU",
"torch.nn.ModuleList",
"torchvision.models.resnet101",
"torch.nn.Conv2d",
"numpy.array",
"torch.nn.functional.interpolate",
"torch.nn.functional.softmax",
"torch.cat"
] | [((1029, 1062), 'torchvision.models.resnet101', 'models.resnet101', ([], {'pretrained': '(True)'}), '(pretrained=True)\n', (1045, 1062), True, 'import torchvision.models as models\n'), ((1289, 1304), 'torch.nn.ModuleList', 'nn.ModuleList', ([], {}), '()\n', (1302, 1304), True, 'import torch.nn as nn\n'), ((2094, 2109),... |
# !/usr/bin/python
# -*- coding: utf-8 -*-
# @time : 2020/5/14 21:09
# @author : Mo
# @function: 将json格式的corpus转化为macadam的格式(clue数据集)
from macadam.base.utils import txt_write, txt_read, save_json, load_json
from macadam.conf.path_config import path_ner_clue_2020
import json
import os
for code_type in ["train", ... | [
"macadam.base.utils.txt_write",
"macadam.base.utils.txt_read",
"os.path.join",
"json.dumps"
] | [((396, 449), 'os.path.join', 'os.path.join', (['path_ner_clue_2020', 'f"""{code_type}.json"""'], {}), "(path_ner_clue_2020, f'{code_type}.json')\n", (408, 449), False, 'import os\n'), ((466, 528), 'os.path.join', 'os.path.join', (['path_ner_clue_2020', 'f"""ner_clue_2020.{code_type}"""'], {}), "(path_ner_clue_2020, f'... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from gocdpb import gocdpb
import sys
gocdpb.repos(sys.argv)
| [
"gocdpb.gocdpb.repos"
] | [((101, 123), 'gocdpb.gocdpb.repos', 'gocdpb.repos', (['sys.argv'], {}), '(sys.argv)\n', (113, 123), False, 'from gocdpb import gocdpb\n')] |
import numpy as np
import torch
import onqg.dataset.Constants as Constants
def get_non_pad_mask(seq):
assert seq.dim() == 2
return seq.ne(Constants.PAD).type(torch.float).unsqueeze(-1)
def get_attn_key_pad_mask(seq_k, seq_q):
''' For masking out the padding part of key sequence. '''
# ... | [
"torch.max",
"torch.ones"
] | [((2062, 2126), 'torch.ones', 'torch.ones', (['(len_s, len_s)'], {'device': 'seq.device', 'dtype': 'torch.uint8'}), '((len_s, len_s), device=seq.device, dtype=torch.uint8)\n', (2072, 2126), False, 'import torch\n'), ((705, 769), 'torch.ones', 'torch.ones', (['(len_s, len_s)'], {'device': 'seq.device', 'dtype': 'torch.u... |
from pylonemutestcase import PylonEmuTestCase
from pypylon import pylon
import unittest
class CallTestSuite(PylonEmuTestCase):
# Tests that you can set the GainRaw parameter of the camera
def test_gain_raw(self):
cam = self.create_first()
cam.Open()
# Set GainRaw to min value (192)
... | [
"unittest.main"
] | [((2474, 2489), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2487, 2489), False, 'import unittest\n')] |
#! /usr/bin/env python
"""Usage: %(program)s [-D|-d] [options]
Where:
-h
show usage and exit
-d FILE
use the DBM store. A DBM file is larger than the pickle and
creating it is slower, but loading it is much faster,
especially for large word databases. Recommended for use with... | [
"getopt.getopt",
"spambayes.hammie.open",
"os.path.join",
"spambayes.Options.options.default",
"spambayes.mboxutils.getmbox",
"sys.stdin.read",
"spambayes.Options.get_pathname_option",
"sys.exit",
"sys.stdout.flush",
"spambayes.storage.database_type",
"sys.stdout.write"
] | [((2161, 2218), 'spambayes.Options.get_pathname_option', 'get_pathname_option', (['"""Storage"""', '"""persistent_storage_file"""'], {}), "('Storage', 'persistent_storage_file')\n", (2180, 2218), False, 'from spambayes.Options import options, get_pathname_option\n'), ((1986, 2039), 'spambayes.Options.options.default', ... |
import disnake
from disnake.ext import commands
import datetime
from datetime import datetime
import aiosqlite
from MyBot.utils.constants import DATABASE
from MyBot.utils.constants import Constants
from logging import getLogger
log = getLogger(__name__)
class EventHandler(commands.Cog):
def __init__(self, bot):
... | [
"logging.getLogger",
"disnake.ext.commands.Cog.listener",
"disnake.Embed",
"aiosqlite.connect",
"datetime.datetime.now",
"disnake.Color.red",
"MyBot.utils.constants.Constants.welcome"
] | [((235, 254), 'logging.getLogger', 'getLogger', (['__name__'], {}), '(__name__)\n', (244, 254), False, 'from logging import getLogger\n'), ((357, 380), 'disnake.ext.commands.Cog.listener', 'commands.Cog.listener', ([], {}), '()\n', (378, 380), False, 'from disnake.ext import commands\n'), ((3333, 3356), 'disnake.ext.co... |
from pyrogram import Client, filters
@Client.on_message(filters.command('ping', ['!']))
def ping(client, message):
message.reply_text(f"Pong!")
| [
"pyrogram.filters.command"
] | [((58, 88), 'pyrogram.filters.command', 'filters.command', (['"""ping"""', "['!']"], {}), "('ping', ['!'])\n", (73, 88), False, 'from pyrogram import Client, filters\n')] |
"""Test the Xiaomi Miio config flow."""
from unittest.mock import Mock
from miio import DeviceException
from homeassistant import config_entries
from homeassistant.components.xiaomi_miio import config_flow, const
from homeassistant.const import CONF_HOST, CONF_NAME, CONF_TOKEN
from tests.async_mock import patch
TES... | [
"miio.DeviceException",
"unittest.mock.Mock",
"tests.async_mock.patch"
] | [((814, 820), 'unittest.mock.Mock', 'Mock', ([], {}), '()\n', (818, 820), False, 'from unittest.mock import Mock\n'), ((3294, 3396), 'tests.async_mock.patch', 'patch', (['"""homeassistant.components.xiaomi_miio.gateway.gateway.Gateway.info"""'], {'return_value': 'mock_info'}), "('homeassistant.components.xiaomi_miio.ga... |
# Generated by Django 3.0.6 on 2020-11-05 16:16
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app', '0001_squashed_0009_auto_20180709_0256'),
]
operations = [
migrations.AddField(
model_name='fermentationprofile',
... | [
"django.db.models.TextField"
] | [((356, 462), 'django.db.models.TextField', 'models.TextField', ([], {'blank': '(True)', 'default': '""""""', 'help_text': '"""Notes about the fermentation profile (Optional)"""'}), "(blank=True, default='', help_text=\n 'Notes about the fermentation profile (Optional)')\n", (372, 462), False, 'from django.db import... |
import argparse
import base64
import logging
import os
import sys
__version__ = "2017.06.04"
def main(argv):
"""
Entry point for genpad.
Arguments:
argv: command line arguments
"""
logging.basicConfig(level="WARNING", format="%(levelname)s: %(message)s")
parser = argparse.ArgumentPar... | [
"logging.basicConfig",
"os.urandom",
"logging.error",
"argparse.ArgumentParser"
] | [((213, 286), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': '"""WARNING"""', 'format': '"""%(levelname)s: %(message)s"""'}), "(level='WARNING', format='%(levelname)s: %(message)s')\n", (232, 286), False, 'import logging\n'), ((300, 344), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'descri... |
import uuid
from django.db import models
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes.fields import GenericForeignKey
from segmentfault.apps.users.models import User
# Create your models here.
class Notice(models.Model):
from my_utils.CONSTANT import NOTICE_TYPE
... | [
"django.db.models.UUIDField",
"django.db.models.ForeignKey",
"django.db.models.BooleanField",
"django.db.models.PositiveIntegerField",
"django.db.models.DateTimeField",
"django.contrib.contenttypes.fields.GenericForeignKey",
"django.db.models.CharField"
] | [((334, 404), 'django.db.models.UUIDField', 'models.UUIDField', ([], {'primary_key': '(True)', 'default': 'uuid.uuid4', 'editable': '(False)'}), '(primary_key=True, default=uuid.uuid4, editable=False)\n', (350, 404), False, 'from django.db import models\n'), ((455, 561), 'django.db.models.ForeignKey', 'models.ForeignKe... |
import argparse
import numpy as np
from util import load_data, separate_data
from grakel import GraphKernel
from sklearn.svm import SVC
from sklearn.metrics import accuracy_score
def convert(graphs):
X = []
y = []
for graph in graphs:
edge = {i: neighbors for i, neighbors in enumerate(graph.neighb... | [
"util.load_data",
"argparse.ArgumentParser",
"util.separate_data",
"numpy.array",
"grakel.GraphKernel",
"numpy.random.seed",
"sklearn.metrics.accuracy_score",
"sklearn.svm.SVC"
] | [((535, 591), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""WL subtree kernel"""'}), "(description='WL subtree kernel')\n", (558, 591), False, 'import argparse\n'), ((1521, 1538), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (1535, 1538), True, 'import numpy as np\n'),... |
"""
Django settings for technologiesinit project.
"""
import os
import sys
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com... | [
"os.path.abspath",
"os.path.join"
] | [((3480, 3522), 'os.path.join', 'os.path.join', (['BASE_DIR', '"""public"""', '"""static"""'], {}), "(BASE_DIR, 'public', 'static')\n", (3492, 3522), False, 'import os\n'), ((3561, 3602), 'os.path.join', 'os.path.join', (['BASE_DIR', '"""public"""', '"""media"""'], {}), "(BASE_DIR, 'public', 'media')\n", (3573, 3602), ... |
from unittest.mock import MagicMock
import openapi_python_client.schema as oai
from openapi_python_client.parser.errors import ParseError, PropertyError
from openapi_python_client.parser.properties import NoneProperty, Schemas, StringProperty
MODULE_NAME = "openapi_python_client.parser.responses"
def test_response_... | [
"openapi_python_client.parser.errors.ParseError",
"openapi_python_client.parser.errors.PropertyError",
"unittest.mock.MagicMock",
"openapi_python_client.parser.properties.NoneProperty",
"openapi_python_client.schema.MediaType.construct",
"openapi_python_client.parser.properties.Schemas",
"openapi_python... | [((967, 1029), 'openapi_python_client.schema.Response.construct', 'oai.Response.construct', ([], {'description': '""""""', 'content': "{'blah': None}"}), "(description='', content={'blah': None})\n", (989, 1029), True, 'import openapi_python_client.schema as oai\n'), ((2236, 2247), 'unittest.mock.MagicMock', 'MagicMock... |
import sys
import subprocess
'''
Potato scripting engaged.
<NAME> (<EMAIL>)
Genomic Technologies
Garvan Institute
Copyright 2017
batch_tater.py takes list/s of files to extract, and speeds it up a bit, by only opening
one tar file at a time and extracting what is needed.
To run on sun... | [
"subprocess.call"
] | [((2089, 2145), 'subprocess.call', 'subprocess.call', (['cmd'], {'shell': '(True)', 'executable': '"""/bin/bash"""'}), "(cmd, shell=True, executable='/bin/bash')\n", (2104, 2145), False, 'import subprocess\n')] |
# coding=utf-8
from keras.layers import *
from keras.models import *
from keras.optimizers import *
from keras.applications.xception import Xception
def convolution_block(x, filters, size, strides=(1,1), padding='same', activation=True):
x = Conv2D(filters, size, strides=strides, padding=padding)(x)
x = BatchN... | [
"keras.applications.xception.Xception"
] | [((845, 934), 'keras.applications.xception.Xception', 'Xception', ([], {'input_shape': '(input_height, input_width, 3)', 'weights': 'None', 'include_top': '(False)'}), '(input_shape=(input_height, input_width, 3), weights=None,\n include_top=False)\n', (853, 934), False, 'from keras.applications.xception import Xcep... |
import functools
import logging
import logging.handlers
import signal
import sys
import threading
import time
import click
import json
from jsonrpcserver import Methods
from jsonrpcserver.exceptions import ServerError
from path import Path
from two1.wallet import daemonizable
from two1.wallet.socket_rpc_server import ... | [
"logging.getLogger",
"click.Choice",
"logging.StreamHandler",
"two1.wallet.daemonizable.get_daemon_methods",
"time.sleep",
"path.Path",
"two1.wallet.exceptions.WalletLockedError",
"sys.exit",
"click.IntRange",
"click.option",
"threading.Lock",
"json.dumps",
"two1.wallet.exceptions.WalletNotL... | [((819, 847), 'logging.getLogger', 'logging.getLogger', (['"""walletd"""'], {}), "('walletd')\n", (836, 847), False, 'import logging\n'), ((858, 867), 'jsonrpcserver.Methods', 'Methods', ([], {}), '()\n', (865, 867), False, 'from jsonrpcserver import Methods\n'), ((1229, 1245), 'threading.Lock', 'threading.Lock', ([], ... |
import logging
from gensim.models import word2vec
import numpy as np
from scipy import linalg
'''
计算案件之间的相似度
首先对句子分词,然后获取每个单词对应的词向量
然后将所有单词对应的词向量相加求平均值,作为句子的向量
最后,计算句子的向量的夹角余弦值,作为它们之间的相似度
'''
logging.basicConfig(
format='%(asctime)s : %(levelname)s : %(message)s',
level=logging.I... | [
"logging.basicConfig",
"gensim.models.word2vec.Word2Vec",
"numpy.argsort",
"numpy.dot",
"numpy.zeros",
"gensim.models.word2vec.LineSentence",
"scipy.linalg.norm"
] | [((224, 319), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s : %(levelname)s : %(message)s"""', 'level': 'logging.INFO'}), "(format='%(asctime)s : %(levelname)s : %(message)s',\n level=logging.INFO)\n", (243, 319), False, 'import logging\n'), ((361, 392), 'gensim.models.word2vec.LineSe... |
import os
import pytest
import time
from checkov.cloudformation.runner import Runner as cfn_runner
from checkov.common.runners.runner_registry import RunnerRegistry
from checkov.common.util.banner import banner
from checkov.kubernetes.runner import Runner as k8_runner
from checkov.runner_filter import RunnerFilter
fro... | [
"os.path.join",
"checkov.cloudformation.runner.Runner",
"os.path.realpath",
"pytest.mark.benchmark",
"checkov.terraform.runner.Runner",
"checkov.kubernetes.runner.Runner",
"checkov.runner_filter.RunnerFilter"
] | [((923, 1075), 'pytest.mark.benchmark', 'pytest.mark.benchmark', ([], {'group': '"""terraform-performance-tests"""', 'disable_gc': '(True)', 'min_time': '(0.1)', 'max_time': '(0.5)', 'min_rounds': '(5)', 'timer': 'time.time', 'warmup': '(False)'}), "(group='terraform-performance-tests', disable_gc=True,\n min_time=0... |
# flake8: noqa
import random
import unittest
from unittest.mock import Mock
from catalyst.core.callback import Callback, CallbackOrder, CallbackWrapper
class Dummy(Exception):
pass
def _raise(runner: "IRunner"):
raise Dummy()
class RaiserCallback(Callback):
def __init__(self, order, method_to_raise: ... | [
"unittest.mock.Mock",
"catalyst.core.callback.CallbackWrapper"
] | [((498, 553), 'unittest.mock.Mock', 'Mock', ([], {'stage_name': '"""stage1"""', 'loader_name': '"""train"""', 'epoch': '(1)'}), "(stage_name='stage1', loader_name='train', epoch=1)\n", (502, 553), False, 'from unittest.mock import Mock\n'), ((1522, 1577), 'unittest.mock.Mock', 'Mock', ([], {'stage_name': '"""stage1"""'... |
import ssdf
# Load from file
s1 = ssdf.load('test1.ssdf')
# Write to string and read back
tmp = ssdf.saves(s1)
s2 = ssdf.loads(tmp)
# Print, manually inspection required to see whether it matches the test file
print(s2)
| [
"ssdf.load",
"ssdf.saves",
"ssdf.loads"
] | [((38, 61), 'ssdf.load', 'ssdf.load', (['"""test1.ssdf"""'], {}), "('test1.ssdf')\n", (47, 61), False, 'import ssdf\n'), ((104, 118), 'ssdf.saves', 'ssdf.saves', (['s1'], {}), '(s1)\n', (114, 118), False, 'import ssdf\n'), ((125, 140), 'ssdf.loads', 'ssdf.loads', (['tmp'], {}), '(tmp)\n', (135, 140), False, 'import ssd... |
'''
* GridGain Community Edition Licensing
* Copyright 2019 GridGain Systems, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License") modified with Commons Clause
* Restriction; you may not use this file except in compliance with the License. You may obtain a
* ... | [
"redis.StrictRedis"
] | [((2186, 2239), 'redis.StrictRedis', 'redis.StrictRedis', ([], {'host': '"""localhost"""', 'port': '(11211)', 'db': '(0)'}), "(host='localhost', port=11211, db=0)\n", (2203, 2239), False, 'import redis\n')] |
"""Module for all reports generated for taint flow analyses."."""
from varats.report.report import BaseReport, FileStatusExtension, ReportFilename
class TaintPropagationReport(BaseReport):
"""Print the result of filechecking a llvm ir file generated by VaRA or
Phasar in a readable manner."""
SHORTHAND =... | [
"varats.report.report.ReportFilename.get_file_name"
] | [((1397, 1547), 'varats.report.report.ReportFilename.get_file_name', 'ReportFilename.get_file_name', (['TaintPropagationReport.SHORTHAND', 'project_name', 'binary_name', 'project_version', 'project_uuid', 'extension_type', 'file_ext'], {}), '(TaintPropagationReport.SHORTHAND, project_name,\n binary_name, project_ver... |
import torch
from sbibm.metrics import mmd
from .utils import sample_blobs_same
def test_mmd():
X, Y = sample_blobs_same(n=1000)
mmd_1 = mmd(X=X, Y=Y, implementation="tp_sutherland")
mmd_2 = mmd(X=X, Y=Y, implementation="tp_djolonga")
assert torch.allclose(mmd_1, mmd_2, rtol=1e-04, atol=1e-04)
| [
"sbibm.metrics.mmd",
"torch.allclose"
] | [((149, 194), 'sbibm.metrics.mmd', 'mmd', ([], {'X': 'X', 'Y': 'Y', 'implementation': '"""tp_sutherland"""'}), "(X=X, Y=Y, implementation='tp_sutherland')\n", (152, 194), False, 'from sbibm.metrics import mmd\n'), ((207, 250), 'sbibm.metrics.mmd', 'mmd', ([], {'X': 'X', 'Y': 'Y', 'implementation': '"""tp_djolonga"""'})... |
import functools
import warnings
import numpy as np
import numpy.linalg as npla
import sys, os
import time
from PES.compute_covariance import *
from PES.initial_sample import *
from PES.hyper_samples import *
from PES.utilities import *
from PES.sample_minimum import *
from PES.PES import *
from PES.compute... | [
"numpy.eye",
"numpy.asarray",
"numpy.array",
"numpy.zeros",
"functools.partial",
"numpy.random.seed",
"numpy.vstack",
"numpy.argmin",
"time.time",
"warnings.filterwarnings"
] | [((2329, 2362), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (2352, 2362), False, 'import warnings\n'), ((2431, 2451), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (2445, 2451), True, 'import numpy as np\n'), ((3120, 3153), 'warnings.filterwarnings'... |
"""The game Snake."""
import ConfigParser
import dallinger
class SnakeGame(dallinger.experiments.Experiment):
"""Define the structure of the experiment."""
def __init__(self, session):
"""Initialize the experiment."""
config = ConfigParser.ConfigParser()
config.read("config.txt")
... | [
"ConfigParser.ConfigParser"
] | [((255, 282), 'ConfigParser.ConfigParser', 'ConfigParser.ConfigParser', ([], {}), '()\n', (280, 282), False, 'import ConfigParser\n')] |
MYPY = False
if MYPY:
import typing # noqa: F401 # pylint: disable=import-error,unused-import,useless-suppression
try:
# Works for Py 3.3+
from unittest.mock import Mock
except ImportError:
# See https://github.com/python/mypy/issues/1153#issuecomment-253842414
from mock import Mock # type: ignor... | [
"mock.Mock"
] | [((793, 855), 'mock.Mock', 'Mock', ([], {'wraps': 'output_buffer_to_string', 'side_effect': 'record_output'}), '(wraps=output_buffer_to_string, side_effect=record_output)\n', (797, 855), False, 'from mock import Mock\n')] |
# Generated by Django 2.1.2 on 2018-10-08 19:38
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('myapp', '0003_auto_20181008_1447'),
]
operations = [
migrations.CreateModel(
name='Mode',
fields=[
(... | [
"django.db.models.AutoField",
"django.db.models.CharField"
] | [((887, 918), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(50)'}), '(max_length=50)\n', (903, 918), False, 'from django.db import migrations, models\n'), ((326, 419), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(Fals... |
# Generated by Django 4.0 on 2022-06-14 17:34
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('evernote', '0009_note_tag_delete_notehastag'),
]
operations = [
migrations.RenameField(
model_name='note',
old_name='tag',
... | [
"django.db.migrations.RenameField"
] | [((234, 308), 'django.db.migrations.RenameField', 'migrations.RenameField', ([], {'model_name': '"""note"""', 'old_name': '"""tag"""', 'new_name': '"""tags"""'}), "(model_name='note', old_name='tag', new_name='tags')\n", (256, 308), False, 'from django.db import migrations\n')] |
from django.db import models
from django.contrib.auth.models import User
from django.db.models.signals import post_save
from django.dispatch import receiver
departments=[('Cardiologist','Cardiologist'),
('Dermatologist','Dermatologist'),
('Emergency Medicine Specialist','Emergency Medicine Specialist'),
('Allergist/I... | [
"django.db.models.OneToOneField",
"django.db.models.DateField",
"django.db.models.TextField",
"django.db.models.BooleanField",
"django.db.models.PositiveIntegerField",
"django.db.models.ImageField",
"django.dispatch.receiver",
"django.db.models.CharField"
] | [((496, 548), 'django.db.models.OneToOneField', 'models.OneToOneField', (['User'], {'on_delete': 'models.CASCADE'}), '(User, on_delete=models.CASCADE)\n', (516, 548), False, 'from django.db import models\n'), ((557, 606), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(40)', 'default': '"""docto... |
import matplotlib.pyplot as p;
p.switch_backend("SVG")
import mpld3
import seaborn as sns; sns.set()
def Axis_FactorPlot(data, x, y=None, hue=None, row=None, col=None, kind="point"):
sns.set(style="ticks")
ax = sns.factorplot(x=x, y=y, hue=hue, data=data, kind=kind, row=row, col=col)
d = mpld3.fig_to_dict(... | [
"seaborn.rugplot",
"seaborn.lvplot",
"seaborn.set_style",
"seaborn.violinplot",
"matplotlib.pyplot.switch_backend",
"seaborn.pairplot",
"seaborn.set",
"seaborn.regplot",
"seaborn.stripplot",
"seaborn.swarmplot",
"mpld3.fig_to_dict",
"seaborn.barplot",
"seaborn.jointplot",
"seaborn.factorpl... | [((31, 54), 'matplotlib.pyplot.switch_backend', 'p.switch_backend', (['"""SVG"""'], {}), "('SVG')\n", (47, 54), True, 'import matplotlib.pyplot as p\n'), ((91, 100), 'seaborn.set', 'sns.set', ([], {}), '()\n', (98, 100), True, 'import seaborn as sns\n'), ((188, 210), 'seaborn.set', 'sns.set', ([], {'style': '"""ticks""... |
# Modified by 0xzhang.
import math
import taichi as ti
import numpy as np
from body import Body
ti.init(arch=ti.cpu)
# number of planets
N = 100
# galaxy size
galaxy_size = 0.2
# time-step size
h = 1e-4
# substepping
substepping = 1
dt = h / substepping
# center of the screen
center = ti.Vector.field(2, ti.f32, ())... | [
"body.Body",
"taichi.sin",
"taichi.init",
"taichi.random",
"taichi.Vector.field",
"taichi.GUI",
"taichi.cos"
] | [((97, 117), 'taichi.init', 'ti.init', ([], {'arch': 'ti.cpu'}), '(arch=ti.cpu)\n', (104, 117), True, 'import taichi as ti\n'), ((290, 320), 'taichi.Vector.field', 'ti.Vector.field', (['(2)', 'ti.f32', '()'], {}), '(2, ti.f32, ())\n', (305, 320), True, 'import taichi as ti\n'), ((390, 419), 'taichi.Vector.field', 'ti.V... |
from collections import OrderedDict
prefix = '-'
class Specifics:
def __init__(self, surah, ayah, maxayah):
self.surah = surah
self.minAyah = ayah
self.maxAyah = maxayah
self.orderedDict = OrderedDict()
def processRef(ref):
surah = int(ref.split(':')[0])
min_ayah = int(re... | [
"collections.OrderedDict"
] | [((227, 240), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (238, 240), False, 'from collections import OrderedDict\n')] |
import spacy
from spacy.lang.en import English
with open ("../data/processed/Ensemble/Ensemble_v0.txt","r") as file:
Ensemble = file.read()
# ran ge(40) needs more than 300G RAM
Ensemble_trunks=[Ensemble[n*2**28:(n+1)*2**28] for n in range(20)]
nlp = English() # just the language with no model
sentencizer = nlp... | [
"spacy.lang.en.English"
] | [((258, 267), 'spacy.lang.en.English', 'English', ([], {}), '()\n', (265, 267), False, 'from spacy.lang.en import English\n')] |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | [
"logging.getLogger",
"apache_beam.testing.util.equal_to",
"unittest.skipIf",
"apache_beam.io.gcp.experimental.spannerio.ReadFromSpanner",
"uuid.uuid4",
"google.cloud.spanner.Client",
"apache_beam.testing.test_pipeline.TestPipeline",
"unittest.main",
"apache_beam.Pipeline"
] | [((1647, 1674), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1664, 1674), False, 'import logging\n'), ((1710, 1781), 'unittest.skipIf', 'unittest.skipIf', (['(spanner is None)', '"""GCP dependencies are not installed."""'], {}), "(spanner is None, 'GCP dependencies are not installed.')... |
import napalm
driver = napalm.get_network_driver("ios")
conn_details = {
"hostname" : 'sandbox-iosxe-recomm-1.cisco.com',
"username" : 'developer',
"password" : '<PASSWORD>',
"optional_args": {
"port": 22
}
}
device = driver(**conn_details)
device.open()
to_ping = [
"10.0.0.1"
]
for ... | [
"napalm.get_network_driver"
] | [((24, 56), 'napalm.get_network_driver', 'napalm.get_network_driver', (['"""ios"""'], {}), "('ios')\n", (49, 56), False, 'import napalm\n')] |
import pandas as pd
from hydroDL.data import usgs, gageII, gridMET, ntn, GLASS, transform, dbBasin
import numpy as np
import matplotlib.pyplot as plt
from hydroDL.post import axplot, figplot
from hydroDL import kPath, utils
import json
import os
import importlib
from hydroDL.master import basinFull
from hydroDL.app.wa... | [
"hydroDL.data.dbBasin.DataFrameBasin",
"pandas.read_csv",
"os.path.join",
"numpy.nanmean",
"hydroDL.master.basinFull.nameFolder",
"numpy.isnan",
"numpy.nansum",
"numpy.load",
"matplotlib.pyplot.subplots"
] | [((350, 380), 'hydroDL.data.dbBasin.DataFrameBasin', 'dbBasin.DataFrameBasin', (['"""G200"""'], {}), "('G200')\n", (372, 380), False, 'from hydroDL.data import usgs, gageII, gridMET, ntn, GLASS, transform, dbBasin\n'), ((1029, 1084), 'os.path.join', 'os.path.join', (['kPath.dirWQ', '"""modelStat"""', '"""WRTDS-dbBasin"... |
# Copyright (c) 2020, eQualit.ie inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
from baskerville.models.pipeline_training import TrainingPipeline
from baskerville.models.pipelines import RawLogPipeline, El... | [
"baskerville.models.pipelines.RawLogPipeline",
"baskerville.models.pipeline_training.TrainingPipeline",
"baskerville.models.pipelines.ElasticsearchPipeline",
"baskerville.models.pipelines.KafkaPipeline"
] | [((531, 618), 'baskerville.models.pipelines.ElasticsearchPipeline', 'ElasticsearchPipeline', (['config.database', 'config.elastic', 'config.engine', 'config.spark'], {}), '(config.database, config.elastic, config.engine,\n config.spark)\n', (552, 618), False, 'from baskerville.models.pipelines import RawLogPipeline,... |
# -*- coding: utf-8 -*-
"""Unit tests.
These don't seem to work on anymore (at least not on x86)
"""
from unittest import TestCase
try:
from unittest.mock import mock_open, patch
except ImportError:
from mock import mock_open, patch
import sys
import os
pjoin = os.path.join
import gpiomock as gpio
if sys.... | [
"mock.patch",
"gpiomock.setup",
"gpiomock._open.clear",
"gpiomock.set",
"gpiomock.read",
"mock.mock_open"
] | [((924, 942), 'gpiomock._open.clear', 'gpio._open.clear', ([], {}), '()\n', (940, 942), True, 'import gpiomock as gpio\n'), ((1082, 1106), 'mock.mock_open', 'mock_open', ([], {'read_data': '"""0"""'}), "(read_data='0')\n", (1091, 1106), False, 'from mock import mock_open, patch\n'), ((1452, 1476), 'mock.mock_open', 'mo... |
# Generated by Django 3.0.3 on 2020-02-28 10:14
from django.db import migrations, models
import django.db.models.deletion
import products.models
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Cat... | [
"django.db.models.UUIDField",
"django.db.models.TextField",
"django.db.models.IntegerField",
"django.db.models.ForeignKey",
"django.db.models.ManyToManyField",
"django.db.models.BooleanField",
"django.db.models.ImageField",
"django.db.models.SlugField",
"django.db.models.AutoField",
"django.db.mod... | [((372, 465), '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", (388, 465), False, 'from django.db import migrations, models\... |
#!/usr/bin/env python3
import click
import fiona
import pdb
@click.command()
@click.argument('in_file', type=str)
@click.argument('out_file', type=click.Path(dir_okay=False))
@click.option('--vfs', type=str)
def doit(in_file, out_file, vfs):
if vfs:
input = fiona.open(in_file, vfs=vfs)
else:
input = fiona... | [
"click.argument",
"click.option",
"click.Path",
"fiona.open",
"click.command"
] | [((63, 78), 'click.command', 'click.command', ([], {}), '()\n', (76, 78), False, 'import click\n'), ((80, 115), 'click.argument', 'click.argument', (['"""in_file"""'], {'type': 'str'}), "('in_file', type=str)\n", (94, 115), False, 'import click\n'), ((178, 209), 'click.option', 'click.option', (['"""--vfs"""'], {'type'... |