code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from __future__ import print_function
from keras.datasets import mnist
from keras.datasets import cifar10
from keras.utils.np_utils import to_categorical
import numpy as np
from keras import backend as K
from evolution import Evolution
from genome_handler import GenomeHandler
import tensorflow as tf
#import mlflow.kera... | [
"keras.backend.set_image_data_format",
"keras.datasets.cifar10.load_data",
"keras.utils.np_utils.to_categorical",
"tensorflow.config.list_physical_devices",
"evolution.Evolution",
"genome_handler.GenomeHandler"
] | [((494, 534), 'keras.backend.set_image_data_format', 'K.set_image_data_format', (['"""channels_last"""'], {}), "('channels_last')\n", (517, 534), True, 'from keras import backend as K\n'), ((633, 652), 'keras.datasets.cifar10.load_data', 'cifar10.load_data', ([], {}), '()\n', (650, 652), False, 'from keras.datasets imp... |
'''
Autores:<NAME> A01749381
<NAME> A01751192
<NAME> A01379868
<NAME> A01749375
'''
from random import random
from mesa.visualization.modules import CanvasGrid
from mesa.visualiza... | [
"mesa.space.MultiGrid",
"mesa.time.RandomActivation"
] | [((5740, 5771), 'mesa.space.MultiGrid', 'MultiGrid', (['width', 'height', '(False)'], {}), '(width, height, False)\n', (5749, 5771), False, 'from mesa.space import MultiGrid\n'), ((5796, 5818), 'mesa.time.RandomActivation', 'RandomActivation', (['self'], {}), '(self)\n', (5812, 5818), False, 'from mesa.time import Rand... |
from django.shortcuts import render
from django.views.generic.list import ListView
from django.views.generic.detail import DetailView
from django.views.generic.edit import CreateView, UpdateView, DeleteView
from django.urls import reverse_lazy
from django.contrib.auth.views import LoginView
from .models impor... | [
"django.urls.reverse_lazy"
] | [((823, 844), 'django.urls.reverse_lazy', 'reverse_lazy', (['"""tasks"""'], {}), "('tasks')\n", (835, 844), False, 'from django.urls import reverse_lazy\n'), ((939, 960), 'django.urls.reverse_lazy', 'reverse_lazy', (['"""tasks"""'], {}), "('tasks')\n", (951, 960), False, 'from django.urls import reverse_lazy\n'), ((106... |
# Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to us... | [
"logging.basicConfig",
"signal.signal",
"importlib.import_module",
"argparse.ArgumentParser",
"concurrent.futures.ThreadPoolExecutor",
"os.getpid",
"smarts.zoo.worker_servicer.WorkerServicer"
] | [((2917, 2956), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (2936, 2956), False, 'import logging\n'), ((3631, 3672), 'signal.signal', 'signal.signal', (['signal.SIGINT', 'stop_server'], {}), '(signal.SIGINT, stop_server)\n', (3644, 3672), False, 'import signa... |
# V0
import collections
class Solution(object):
def frequencySort(self, s):
count = collections.Counter(s)
count_dict = dict(count)
count_tuple_sorted = sorted(count_dict.items(), key=lambda kv : -kv[1])
res = ''
for item in count_tuple_sorted:
res += item[0] * it... | [
"collections.Counter",
"collections.defaultdict"
] | [((96, 118), 'collections.Counter', 'collections.Counter', (['s'], {}), '(s)\n', (115, 118), False, 'import collections\n'), ((2076, 2104), 'collections.defaultdict', 'collections.defaultdict', (['int'], {}), '(int)\n', (2099, 2104), False, 'import collections\n'), ((771, 793), 'collections.Counter', 'collections.Count... |
#
# 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.transforms.external.ImplicitSchemaPayloadBuilder",
"apache_beam.CombineGlobally",
"apache_beam.Flatten",
"apache_beam.portability.api.external_transforms_pb2.ExternalConfigurationPayload",
"apache_beam.CombinePerKey",
"argparse.ArgumentParser",
"apache_beam.Partition"... | [((1714, 1741), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1731, 1741), False, 'import logging\n'), ((2170, 2241), 'apache_beam.transforms.ptransform.PTransform.register_urn', 'ptransform.PTransform.register_urn', (['"""beam:transforms:xlang:count"""', 'None'], {}), "('beam:transform... |
"""Calculation history Class"""
from calc.calculations.addition import Addition
from calc.calculations.subtraction import Subtraction
from calc.calculations.multiplication import Multiplication
from calc.calculations.division import Division
class Calculations:
"""Calculations class manages the history of calculati... | [
"calc.calculations.multiplication.Multiplication.create",
"calc.calculations.division.Division.create",
"calc.calculations.subtraction.Subtraction.create",
"calc.calculations.addition.Addition.create"
] | [((1632, 1655), 'calc.calculations.addition.Addition.create', 'Addition.create', (['values'], {}), '(values)\n', (1647, 1655), False, 'from calc.calculations.addition import Addition\n'), ((1912, 1938), 'calc.calculations.subtraction.Subtraction.create', 'Subtraction.create', (['values'], {}), '(values)\n', (1930, 1938... |
# coding: utf-8
"""
Merlin
API Guide for accessing Merlin's model management, deployment, and serving functionalities # noqa: E501
OpenAPI spec version: 0.7.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import re # noqa: F401
... | [
"six.iteritems",
"client.api_client.ApiClient"
] | [((3490, 3521), 'six.iteritems', 'six.iteritems', (["params['kwargs']"], {}), "(params['kwargs'])\n", (3503, 3521), False, 'import six\n'), ((722, 733), 'client.api_client.ApiClient', 'ApiClient', ([], {}), '()\n', (731, 733), False, 'from client.api_client import ApiClient\n')] |
"""Define the NonlinearBlockJac class."""
from openmdao.recorders.recording_iteration_stack import Recording
from openmdao.solvers.solver import NonlinearSolver
from openmdao.utils.mpi import multi_proc_fail_check
class NonlinearBlockJac(NonlinearSolver):
"""
Nonlinear block Jacobi solver.
"""
SOLVER... | [
"openmdao.recorders.recording_iteration_stack.Recording",
"openmdao.utils.mpi.multi_proc_fail_check"
] | [((580, 619), 'openmdao.recorders.recording_iteration_stack.Recording', 'Recording', (['"""NonlinearBlockJac"""', '(0)', 'self'], {}), "('NonlinearBlockJac', 0, self)\n", (589, 619), False, 'from openmdao.recorders.recording_iteration_stack import Recording\n'), ((2041, 2075), 'openmdao.utils.mpi.multi_proc_fail_check'... |
# Copyright (c) 2021 GradsFlow. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | [
"torch.as_tensor",
"torch.nn.Linear"
] | [((727, 748), 'torch.nn.Linear', 'torch.nn.Linear', (['(1)', '(4)'], {}), '(1, 4)\n', (742, 748), False, 'import torch\n'), ((906, 924), 'torch.as_tensor', 'torch.as_tensor', (['(1)'], {}), '(1)\n', (921, 924), False, 'import torch\n'), ((1010, 1028), 'torch.as_tensor', 'torch.as_tensor', (['(1)'], {}), '(1)\n', (1025,... |
# MemPool.py
#
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
import logging
from lib.serialize import uint256_to_shortstr
class MemPool(object):
def __init__(self):
self.pool = {}
# setup logging
logging.basicConfi... | [
"logging.basicConfig",
"logging.getLogger",
"lib.serialize.uint256_to_shortstr"
] | [((302, 342), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG'}), '(level=logging.DEBUG)\n', (321, 342), False, 'import logging\n'), ((359, 386), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (376, 386), False, 'import logging\n'), ((458, 483), 'lib.serialize.... |
from django import forms
from django.core.validators import MinValueValidator, MinLengthValidator
class OriginForm(forms.Form):
origin_address = forms.CharField(validators=[MinLengthValidator(1)], widget=forms.TextInput(attrs={'class': 'form-control', 'id': 'inlineFormInputGroup', 'placeholder': '123 Tech St, Sili... | [
"django.core.validators.MinValueValidator",
"django.core.validators.MinLengthValidator",
"django.forms.TextInput"
] | [((209, 351), 'django.forms.TextInput', 'forms.TextInput', ([], {'attrs': "{'class': 'form-control', 'id': 'inlineFormInputGroup', 'placeholder':\n '123 Tech St, Silicon Valley, CA 00000'}"}), "(attrs={'class': 'form-control', 'id':\n 'inlineFormInputGroup', 'placeholder':\n '123 Tech St, Silicon Valley, CA 00... |
from django.contrib import admin
from . import models
class SupplierAdmin(admin.ModelAdmin):
list_display = ('supplier_name', 'contact', )
search_fields = ['supplier_name', 'contact', ]
admin.site.register(models.Suppliers, SupplierAdmin)
class InventoryUserAdmin(admin.ModelAdmin):
list_display = ('empl... | [
"django.contrib.admin.site.register"
] | [((197, 249), 'django.contrib.admin.site.register', 'admin.site.register', (['models.Suppliers', 'SupplierAdmin'], {}), '(models.Suppliers, SupplierAdmin)\n', (216, 249), False, 'from django.contrib import admin\n'), ((430, 491), 'django.contrib.admin.site.register', 'admin.site.register', (['models.InventoryUser', 'In... |
# -*- coding: utf-8 -*-
"""
Description of example
"""
import pyqtgraph as pg
from pyqtgraph.Qt import QtCore, QtGui, mkQApp
import numpy as np
app = mkQApp()
# win.setWindowTitle('pyqtgraph example: ____')
if __name__ == '__main__':
pg.exec()
| [
"pyqtgraph.Qt.mkQApp",
"pyqtgraph.exec"
] | [((152, 160), 'pyqtgraph.Qt.mkQApp', 'mkQApp', ([], {}), '()\n', (158, 160), False, 'from pyqtgraph.Qt import QtCore, QtGui, mkQApp\n'), ((242, 251), 'pyqtgraph.exec', 'pg.exec', ([], {}), '()\n', (249, 251), True, 'import pyqtgraph as pg\n')] |
# -*- encoding: utf-8 -*-
import multiprocessing as mp
import time
from pudb.remote import set_trace
def worker(worker_id):
""" Simple worker process"""
i = 0
while i < 10:
if worker_id == 1: # debug process with id 1
set_trace(term_size=(80, 24))
time.sleep(1) # represents ... | [
"multiprocessing.Process",
"pudb.remote.set_trace",
"time.sleep"
] | [((292, 305), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (302, 305), False, 'import time\n'), ((514, 553), 'multiprocessing.Process', 'mp.Process', ([], {'target': 'worker', 'args': '(p_id,)'}), '(target=worker, args=(p_id,))\n', (524, 553), True, 'import multiprocessing as mp\n'), ((254, 283), 'pudb.remote.se... |
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Implements a frozen dictionary-like object"""
import collections
import copy
import common.memo as memo
class frozendict(collections.Mapping):
"""A f... | [
"common.memo.memo_i",
"copy.deepcopy"
] | [((587, 600), 'common.memo.memo_i', 'memo.memo_i', ([], {}), '()\n', (598, 600), True, 'import common.memo as memo\n'), ((975, 988), 'common.memo.memo_i', 'memo.memo_i', ([], {}), '()\n', (986, 988), True, 'import common.memo as memo\n'), ((945, 970), 'copy.deepcopy', 'copy.deepcopy', (['self._data'], {}), '(self._data... |
# -*- coding: utf-8 -*-
"""Utilities common to CIFAR10 and CIFAR100 datasets.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
from six.moves import cPickle
def load_batch(fpath, label_key='labels'):
"""Internal utility for parsing CIFAR ... | [
"six.moves.cPickle.load"
] | [((602, 617), 'six.moves.cPickle.load', 'cPickle.load', (['f'], {}), '(f)\n', (614, 617), False, 'from six.moves import cPickle\n'), ((648, 681), 'six.moves.cPickle.load', 'cPickle.load', (['f'], {'encoding': '"""bytes"""'}), "(f, encoding='bytes')\n", (660, 681), False, 'from six.moves import cPickle\n')] |
from core.advbase import *
from slot.d import *
def module():
return Luther
class Luther(Adv):
a1 = ('cc',0.10,'hit15')
conf = {}
conf ['slots.d'] = Leviathan()
conf['acl'] = """
`dragon
`s1
`s2, seq=5 and cancel
`s3, seq=5 and cancel or fsc
`fs, seq=5
... | [
"core.simulate.test_with_argv"
] | [((440, 471), 'core.simulate.test_with_argv', 'test_with_argv', (['None', '*sys.argv'], {}), '(None, *sys.argv)\n', (454, 471), False, 'from core.simulate import test_with_argv\n')] |
import hashlib
from io import BytesIO
import logging
import os
from typing import Any, cast, Dict, List, Optional, Sequence, Type, TYPE_CHECKING, Union
from pkg_resources import parse_version
import wandb
from wandb import util
from ._private import MEDIA_TMP
from .base_types.media import BatchableMedia, Media
from .... | [
"wandb.util.get_full_typename",
"numpy.ptp",
"wandb.util.generate_id",
"os.path.join",
"io.BytesIO",
"logging.warning",
"wandb.util.get_module",
"numpy.max",
"os.path.splitext",
"pkg_resources.parse_version",
"wandb.util._get_max_cli_version",
"wandb.termwarn",
"wandb.util.ensure_matplotlib_... | [((1238, 1265), 'wandb.util._get_max_cli_version', 'util._get_max_cli_version', ([], {}), '()\n', (1263, 1265), False, 'from wandb import util\n'), ((1330, 1354), 'pkg_resources.parse_version', 'parse_version', (['"""0.12.10"""'], {}), "('0.12.10')\n", (1343, 1354), False, 'from pkg_resources import parse_version\n'), ... |
#!/usr/bin/env python
"""Pi digits example
Example shows arbitrary precision using mpmath with the
computation of the digits of pi.
"""
from mpmath import libmp, pi
from mpmath import functions as mpf_funs
import math
from time import clock
import sys
def display_fraction(digits, skip=0, colwidth=10, columns=5):
... | [
"mpmath.libmp.numeral",
"mpmath.libmp.bin_to_radix",
"time.clock",
"math.log"
] | [((1224, 1246), 'mpmath.libmp.numeral', 'libmp.numeral', (['(3)', 'base'], {}), '(3, base)\n', (1237, 1246), False, 'from mpmath import libmp, pi\n'), ((1426, 1433), 'time.clock', 'clock', ([], {}), '()\n', (1431, 1433), False, 'from time import clock\n'), ((1548, 1555), 'time.clock', 'clock', ([], {}), '()\n', (1553, ... |
# Copyright 2013 IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... | [
"os.path.split",
"re.match",
"pycodestyle.noqa",
"re.compile"
] | [((878, 907), 're.compile', 're.compile', (['"""^\\\\s*def test.*"""'], {}), "('^\\\\s*def test.*')\n", (888, 907), False, 'import re\n'), ((942, 986), 're.compile', 're.compile', (['"""^\\\\s+def (setUp|tearDown)Class"""'], {}), "('^\\\\s+def (setUp|tearDown)Class')\n", (952, 986), False, 'import re\n'), ((1008, 1047)... |
import SimpleXMLRPCServer
import sys
import logging
from K8055Controller import K8055Controller
logging.basicConfig()
controller_log = logging.getLogger("Controller")
class Controller:
def __init__(self):
self.k8055 = K8055Controller()
controller_log.debug("initialized")
def reset(s... | [
"logging.basicConfig",
"SimpleXMLRPCServer.SimpleXMLRPCServer",
"logging.getLogger",
"K8055Controller.K8055Controller"
] | [((98, 119), 'logging.basicConfig', 'logging.basicConfig', ([], {}), '()\n', (117, 119), False, 'import logging\n'), ((138, 169), 'logging.getLogger', 'logging.getLogger', (['"""Controller"""'], {}), "('Controller')\n", (155, 169), False, 'import logging\n'), ((890, 958), 'SimpleXMLRPCServer.SimpleXMLRPCServer', 'Simpl... |
# vim: set filetype=python ts=4 sw=4
# -*- coding: utf-8 -*-
"""This module retrieves AWS credentials after authenticating with Okta."""
from __future__ import absolute_import, division, print_function, unicode_literals
import logging
from future import standard_library
from tokendito import aws_helpers
from tokendit... | [
"tokendito.helpers.set_local_credentials",
"tokendito.aws_helpers.authenticate_to_roles",
"tokendito.aws_helpers.ensure_keys_work",
"logging.debug",
"tokendito.aws_helpers.select_assumeable_role",
"tokendito.helpers.setup",
"future.standard_library.install_aliases",
"tokendito.okta_helpers.authenticat... | [((404, 438), 'future.standard_library.install_aliases', 'standard_library.install_aliases', ([], {}), '()\n', (436, 438), False, 'from future import standard_library\n'), ((584, 603), 'tokendito.helpers.setup', 'helpers.setup', (['args'], {}), '(args)\n', (597, 603), False, 'from tokendito import helpers\n'), ((609, 6... |
#!/usr/bin/python
# (c) 2020, NetApp, Inc
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
'''
na_ontap_autosupport_invoke
'''
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.1',
's... | [
"traceback.format_exc",
"ansible.module_utils.basic.AnsibleModule",
"ansible_collections.netapp.ontap.plugins.module_utils.netapp.zapi.NaElement.create_node_with_children",
"ansible_collections.netapp.ontap.plugins.module_utils.netapp_module.NetAppModule",
"ansible_collections.netapp.ontap.plugins.module_ut... | [((2077, 2106), 'ansible_collections.netapp.ontap.plugins.module_utils.netapp.has_netapp_lib', 'netapp_utils.has_netapp_lib', ([], {}), '()\n', (2104, 2106), True, 'import ansible_collections.netapp.ontap.plugins.module_utils.netapp as netapp_utils\n'), ((2259, 2301), 'ansible_collections.netapp.ontap.plugins.module_ut... |
from freight.api.serializer import serialize
from freight.testutils import TestCase
class UserSerializerTest(TestCase):
def test_simple(self):
user = self.create_user()
result = serialize(user)
assert result["id"] == str(user.id)
assert result["name"] == user.name
| [
"freight.api.serializer.serialize"
] | [((201, 216), 'freight.api.serializer.serialize', 'serialize', (['user'], {}), '(user)\n', (210, 216), False, 'from freight.api.serializer import serialize\n')] |
import sys
import numpy as np
from matplotlib import pyplot as pl
from rw import WriteGTiff
fn = '../pozo-steep-vegetated-pcl.npy'
pts = np.load(fn)
x, y, z, c = pts[:, 0], pts[:, 1], pts[:, 2], pts[:, 5]
ix = (0.2 * (x - x.min())).astype('int')
iy = (0.2 * (y - y.min())).astype('int')
shape = (100, 100)
xb = np.aran... | [
"matplotlib.pyplot.savefig",
"numpy.zeros",
"numpy.save",
"numpy.ma.masked_invalid",
"numpy.load",
"matplotlib.pyplot.subplots",
"numpy.arange"
] | [((138, 149), 'numpy.load', 'np.load', (['fn'], {}), '(fn)\n', (145, 149), True, 'import numpy as np\n'), ((313, 336), 'numpy.arange', 'np.arange', (['(shape[1] + 1)'], {}), '(shape[1] + 1)\n', (322, 336), True, 'import numpy as np\n'), ((340, 363), 'numpy.arange', 'np.arange', (['(shape[0] + 1)'], {}), '(shape[0] + 1)... |
import os
import pytest
import torch
from hivemind import RemoteExpert
from hivemind.moe.server import background_server
CUSTOM_EXPERTS_PATH = os.path.join(os.path.dirname(__file__), "test_utils", "custom_networks.py")
@pytest.mark.forked
def test_custom_expert(hid_dim=16):
with background_server(
expe... | [
"os.path.dirname",
"hivemind.moe.server.background_server",
"hivemind.RemoteExpert",
"torch.randn"
] | [((159, 184), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (174, 184), False, 'import os\n'), ((289, 458), 'hivemind.moe.server.background_server', 'background_server', ([], {'expert_cls': '"""perceptron"""', 'num_experts': '(2)', 'device': '"""cpu"""', 'hidden_dim': 'hid_dim', 'num_handler... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = "Ringo"
'''
价格动量 策略 (难度:初级)
参考: https://www.shinnytech.com/blog/momentum-strategy/
注: 该示例策略仅用于功能示范, 实盘时请根据自己的策略/经验进行修改
'''
from tqsdk import TqAccount, TqApi, TargetPosTask
# 设置指定合约,获取N条K线计算价格动量
SYMBOL = "SHFE.au1912"
N = 15
api = TqApi()
klines = api.get_... | [
"tqsdk.TargetPosTask",
"tqsdk.TqApi"
] | [((295, 302), 'tqsdk.TqApi', 'TqApi', ([], {}), '()\n', (300, 302), False, 'from tqsdk import TqAccount, TqApi, TargetPosTask\n'), ((397, 423), 'tqsdk.TargetPosTask', 'TargetPosTask', (['api', 'SYMBOL'], {}), '(api, SYMBOL)\n', (410, 423), False, 'from tqsdk import TqAccount, TqApi, TargetPosTask\n')] |
from Library.CreateATree import CreateATree
tree = CreateATree.BinarySearchTree()
nodesList = list((4, 5, 1, 3, 2))
for i in range(0, len(nodesList)):
tree.insert(nodesList[i])
#tree.printInorder()
tree.printPreorder()
#tree.printPostorder()
| [
"Library.CreateATree.CreateATree.BinarySearchTree"
] | [((52, 82), 'Library.CreateATree.CreateATree.BinarySearchTree', 'CreateATree.BinarySearchTree', ([], {}), '()\n', (80, 82), False, 'from Library.CreateATree import CreateATree\n')] |
'''
@author <NAME>
@since 10.8.2019
'''
import sys
from jnius import autoclass
from Conf.Conf import *
class ServiceBase():
def __init__(self):
PythonServiceClass = autoclass('org.kivy.android.PythonService')
self.Context = autoclass('android.content.Context')
self.Service = PythonServi... | [
"jnius.autoclass",
"sys.exit"
] | [((182, 225), 'jnius.autoclass', 'autoclass', (['"""org.kivy.android.PythonService"""'], {}), "('org.kivy.android.PythonService')\n", (191, 225), False, 'from jnius import autoclass\n'), ((249, 285), 'jnius.autoclass', 'autoclass', (['"""android.content.Context"""'], {}), "('android.content.Context')\n", (258, 285), Fa... |
# api/queue/__init__.py
import os
from flask import Flask
from flask_bootstrap import Bootstrap
# instantiate the extensions
bootstrap = Bootstrap()
def create_app(script_info=None):
# instantiate the app
app = Flask(
__name__,
template_folder="../client/templates",
static_folder=... | [
"flask.Flask",
"os.getenv",
"flask_bootstrap.Bootstrap"
] | [((141, 152), 'flask_bootstrap.Bootstrap', 'Bootstrap', ([], {}), '()\n', (150, 152), False, 'from flask_bootstrap import Bootstrap\n'), ((226, 319), 'flask.Flask', 'Flask', (['__name__'], {'template_folder': '"""../client/templates"""', 'static_folder': '"""../client/static"""'}), "(__name__, template_folder='../clien... |
import sys
import os
import psycopg2
import base64
from cryptography.hazmat.primitives import serialization, hashes
from cryptography.hazmat.primitives.asymmetric import padding, rsa
from cryptography.hazmat.backends import default_backend
import time
if len(sys.argv) < 2:
print("Please enter either create or rem... | [
"psycopg2.connect",
"cryptography.hazmat.primitives.serialization.NoEncryption",
"sys.exit",
"time.time",
"cryptography.hazmat.backends.default_backend"
] | [((343, 354), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (351, 354), False, 'import sys\n'), ((361, 439), 'psycopg2.connect', 'psycopg2.connect', (['"""dbname=\'auth_db\' user=\'auth_db\' host=\'authdb\' [redacted-2]"""'], {}), '("dbname=\'auth_db\' user=\'auth_db\' host=\'authdb\' [redacted-2]")\n', (377, 439), F... |
import panel as pn
import param
from awesome_panel_extensions.frameworks.fast import FastTemplate, FastTextInput
WIDGETS = {
"some_text": {"type": FastTextInput, "readonly": True, "sizing_mode": "fixed", "width": 400}
}
class ParameterizedApp(param.Parameterized):
some_text = param.String(default="This is s... | [
"param.Parameter",
"panel.Param",
"awesome_panel_extensions.frameworks.fast.FastTemplate",
"param.String"
] | [((575, 618), 'awesome_panel_extensions.frameworks.fast.FastTemplate', 'FastTemplate', ([], {'main': '[parameterized_app.view]'}), '(main=[parameterized_app.view])\n', (587, 618), False, 'from awesome_panel_extensions.frameworks.fast import FastTemplate, FastTextInput\n'), ((289, 330), 'param.String', 'param.String', (... |
# Importing section
import json
import requests
import argparse
import hashlib
import time
from http import HTTPStatus
# Main
if __name__ == "__main__":
arg_parser = argparse.ArgumentParser()
args = arg_parser.parse_args()
set_cmd = 'updateSla'
params = {
'idx': 'sla04',
... | [
"json.loads",
"requests.post",
"argparse.ArgumentParser",
"requests.get",
"time.sleep"
] | [((173, 198), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (196, 198), False, 'import argparse\n'), ((594, 646), 'requests.post', 'requests.post', (['cmd_url'], {'headers': 'headers', 'json': 'params'}), '(cmd_url, headers=headers, json=params)\n', (607, 646), False, 'import requests\n'), ((6... |
"""
Test harness for smp.py
"""
import sys
import os
sys.path.append('/Users/ptendick/open-source-workspace/cannr Image/source/cannr/lib')
os.environ['PATH'] = '/Library/Frameworks/Python.framework/Versions/3.7/bin:' + os.environ['PATH']
import cannr
import smp
# Test openProcess by opening a Flask process
def test_o... | [
"cannr.readJSONFile",
"smp.openProcess",
"sys.path.append",
"smp.countPorts"
] | [((53, 143), 'sys.path.append', 'sys.path.append', (['"""/Users/ptendick/open-source-workspace/cannr Image/source/cannr/lib"""'], {}), "(\n '/Users/ptendick/open-source-workspace/cannr Image/source/cannr/lib')\n", (68, 143), False, 'import sys\n'), ((351, 504), 'smp.openProcess', 'smp.openProcess', (["{'processInfo'... |
# Copyright 2012 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | [
"httplib2.Http",
"oslo_serialization.jsonutils.dumps"
] | [((3116, 3131), 'httplib2.Http', 'httplib2.Http', ([], {}), '()\n', (3129, 3131), False, 'import httplib2\n'), ((3773, 3788), 'httplib2.Http', 'httplib2.Http', ([], {}), '()\n', (3786, 3788), False, 'import httplib2\n'), ((4430, 4445), 'httplib2.Http', 'httplib2.Http', ([], {}), '()\n', (4443, 4445), False, 'import htt... |
# Copyright 2016 Quora, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | [
"traceback.format_tb"
] | [((11990, 12017), 'traceback.format_tb', 'traceback.format_tb', (['exc_tb'], {}), '(exc_tb)\n', (12009, 12017), False, 'import traceback\n')] |
import os
import random
from typing import Any, Dict, List, Union
import numpy as np
import torch
from colorama import Fore, Style
from sklearn.metrics import f1_score
from sklearn.metrics import precision_recall_fscore_support as score
from sklearn.metrics import precision_score, recall_score
def highlight(input_: ... | [
"torch.cuda.manual_seed_all",
"torch.manual_seed",
"numpy.multiply",
"sklearn.metrics.f1_score",
"sklearn.metrics.precision_recall_fscore_support",
"os.path.join",
"random.seed",
"sklearn.metrics.precision_score",
"sklearn.metrics.recall_score",
"numpy.array",
"torch.cuda.is_available",
"numpy... | [((1110, 1127), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (1121, 1127), False, 'import random\n'), ((1132, 1152), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (1146, 1152), True, 'import numpy as np\n'), ((1157, 1180), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(see... |
"""
PROBLEM
A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers
is 9009 = 91 × 99.
Find the largest palindrome made from the product of two 3-digit numbers.
ANSWER:
906609
Solve time ~ 0.760 seconds
"""
from itertools import product
import unittest
fro... | [
"unittest.main"
] | [((1013, 1028), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1026, 1028), False, 'import unittest\n')] |
import sys
import json
import logging
import argparse
import warnings
import requests
from indexclient import errors
# DEPRECATED 11/2019 -- interacts with old `/alias/` endpoint.
# For creating aliases for indexd records, prefer using
# the `add_alias` function, which interacts with the new
# `/index/{GUID}/aliase... | [
"warnings.warn",
"indexclient.errors.BaseIndexError",
"json.dumps",
"requests.get"
] | [((418, 644), 'warnings.warn', 'warnings.warn', (['"""This function is deprecated. For creating aliases for indexd records, prefer using the `add_alias_for_did` function, which interacts with the new `/index/{GUID}/aliases` endpoint."""', 'DeprecationWarning'], {}), "(\n 'This function is deprecated. For creating al... |
###############################################################################
# @todo add Pilot2-splash-app disclaimer
###############################################################################
""" Get's KRAS states """
import MDAnalysis as mda
from MDAnalysis.analysis import align
from MDAnalysis.lib.mdamath ... | [
"logging.getLogger",
"MDAnalysis.analysis.align.rotation_matrix",
"mummi_core.utils.Naming.dir_res",
"numpy.arccos",
"numpy.cross",
"numpy.asarray",
"os.path.join",
"numpy.array",
"numpy.dot",
"mummi_core.init",
"numpy.concatenate"
] | [((621, 640), 'logging.getLogger', 'getLogger', (['__name__'], {}), '(__name__)\n', (630, 640), False, 'from logging import getLogger\n'), ((840, 857), 'mummi_core.init', 'mummi_core.init', ([], {}), '()\n', (855, 857), False, 'import mummi_core\n'), ((875, 899), 'mummi_core.utils.Naming.dir_res', 'Naming.dir_res', (['... |
"""
homeassistant.components.switch.hikvision
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Support turning on/off motion detection on Hikvision cameras.
Note: Currently works using default https port only.
CGI API Guide: http://bit.ly/1RuyUuF
Configuration:
To use the Hikvision motion detection switch you will need to... | [
"logging.getLogger"
] | [((1149, 1176), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1166, 1176), False, 'import logging\n')] |
from typing import List, Optional, TYPE_CHECKING
import weakref
from PyQt5.QtCore import QEvent, Qt
from PyQt5.QtWidgets import (QComboBox, QGridLayout, QGroupBox, QHBoxLayout, QLabel, QLineEdit,
QVBoxLayout, QWidget)
from electrumsv.app_state import app_state
from electrumsv.bitcoin import script_template_to_str... | [
"electrumsv.i18n._",
"PyQt5.QtWidgets.QComboBox",
"electrumsv.web.create_URI",
"PyQt5.QtWidgets.QHBoxLayout",
"PyQt5.QtWidgets.QGridLayout",
"weakref.proxy",
"electrumsv.logs.logs.get_logger",
"PyQt5.QtWidgets.QGroupBox",
"electrumsv.app_state.app_state.fx.is_enabled",
"PyQt5.QtWidgets.QVBoxLayout... | [((1129, 1155), 'weakref.proxy', 'weakref.proxy', (['main_window'], {}), '(main_window)\n', (1142, 1155), False, 'import weakref\n'), ((1285, 1337), 'electrumsv.logs.logs.get_logger', 'logs.get_logger', (['f"""receive-view[{self._account_id}]"""'], {}), "(f'receive-view[{self._account_id}]')\n", (1300, 1337), False, 'f... |
import os
import sys
if sys.version_info[0] == 2:
_ENCODE = sys.getfilesystemencoding()
def path_join(*args):
bin_args = map(lambda a: a.decode(_ENCODE), args)
return os.path.join(*bin_args).encode(_ENCODE)
def str_join(s, l):
bin_args = map(lambda a: a.decode(_ENCODE), l)
b = s.decode(_ENCODE)... | [
"sys.getfilesystemencoding",
"os.path.join"
] | [((63, 90), 'sys.getfilesystemencoding', 'sys.getfilesystemencoding', ([], {}), '()\n', (88, 90), False, 'import sys\n'), ((181, 204), 'os.path.join', 'os.path.join', (['*bin_args'], {}), '(*bin_args)\n', (193, 204), False, 'import os\n')] |
#!/usr/bin/env python
""" VAPI test """
import unittest
import os
import signal
from framework import VppTestCase, running_extended_tests, \
VppTestRunner, Worker
@unittest.skipUnless(running_extended_tests(), "part of extended tests")
class VOMTestCase(VppTestCase):
""" VPP Object Model Test """
def te... | [
"os.getpgid",
"os.getenv",
"framework.Worker",
"framework.running_extended_tests",
"unittest.main"
] | [((191, 215), 'framework.running_extended_tests', 'running_extended_tests', ([], {}), '()\n', (213, 215), False, 'from framework import VppTestCase, running_extended_tests, VppTestRunner, Worker\n'), ((1478, 1517), 'unittest.main', 'unittest.main', ([], {'testRunner': 'VppTestRunner'}), '(testRunner=VppTestRunner)\n', ... |
from importlib import import_module
import re
from copy import deepcopy
from collections import OrderedDict
from astropy.utils.data_info import MixinInfo
from .column import Column
from .table import Table, QTable, has_info_class
from astropy.units.quantity import QuantityInfo
__construct_mixin_classes = ('astropy.t... | [
"re.match",
"importlib.import_module",
"copy.deepcopy"
] | [((8503, 8521), 'copy.deepcopy', 'deepcopy', (['tbl.meta'], {}), '(tbl.meta)\n', (8511, 8521), False, 'from copy import deepcopy\n'), ((9171, 9194), 'importlib.import_module', 'import_module', (['mod_name'], {}), '(mod_name)\n', (9184, 9194), False, 'from importlib import import_module\n'), ((9109, 9149), 're.match', '... |
'''
Created on Jun 18, 2013
@author: <NAME>
All rights reserved.
'''
import time
from multiprocessing.pool import Pool
parallelSolve = False
infinity = 1 << 30
def solve(par):
H, U, D, F = par
day = 0
amountRise = U
currH = 0
while True:
amountRise = U * (1 - 0.01 * F * day)
cur... | [
"time.time",
"multiprocessing.pool.Pool"
] | [((1018, 1025), 'multiprocessing.pool.Pool', 'Pool', (['(4)'], {}), '(4)\n', (1022, 1025), False, 'from multiprocessing.pool import Pool\n'), ((1054, 1065), 'time.time', 'time.time', ([], {}), '()\n', (1063, 1065), False, 'import time\n'), ((1151, 1162), 'time.time', 'time.time', ([], {}), '()\n', (1160, 1162), False, ... |
from typing import Dict, Optional, List, Any
import torch
import torch.nn.functional as F
from allennlp.data import Vocabulary
from allennlp.models.model import Model
from allennlp.modules import FeedForward, TextFieldEmbedder, Seq2SeqEncoder
from allennlp.nn import InitializerApplicator, RegularizerApplicator
from al... | [
"torch.nn.CrossEntropyLoss",
"allennlp.nn.InitializerApplicator",
"allennlp.training.metrics.CategoricalAccuracy",
"allennlp.training.metrics.F1Measure",
"allennlp.models.model.Model.register",
"allennlp.nn.util.get_final_encoder_states",
"torch.nn.functional.softmax",
"allennlp.nn.util.get_text_field... | [((446, 479), 'allennlp.models.model.Model.register', 'Model.register', (['"""text_classifier"""'], {}), "('text_classifier')\n", (460, 479), False, 'from allennlp.models.model import Model\n'), ((1102, 1125), 'allennlp.nn.InitializerApplicator', 'InitializerApplicator', ([], {}), '()\n', (1123, 1125), False, 'from all... |
#
# -*- coding: utf-8 -*-
"""Development related tasks to be run with 'invoke'"""
import os
import pathlib
import shutil
import invoke
TASK_ROOT = pathlib.Path(__file__).resolve().parent
TASK_ROOT_STR = str(TASK_ROOT)
# shared function
def rmrf(items, verbose=True):
"""Silently remove a list of directories or ... | [
"os.listdir",
"pathlib.Path",
"invoke.Collection",
"os.path.join",
"shutil.rmtree",
"invoke.task",
"os.walk",
"os.remove"
] | [((691, 710), 'invoke.Collection', 'invoke.Collection', ([], {}), '()\n', (708, 710), False, 'import invoke\n'), ((729, 755), 'invoke.Collection', 'invoke.Collection', (['"""clean"""'], {}), "('clean')\n", (746, 755), False, 'import invoke\n'), ((3856, 3884), 'invoke.task', 'invoke.task', ([], {'pre': '[clean_all]'}), ... |
"""Support for Epson Workforce Printer."""
from datetime import timedelta
import logging
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import CONF_HOST, CONF_MONITORED_CONDITIONS
from homeassistant.exceptions import PlatformNotReady
import homeassistant.... | [
"logging.getLogger",
"voluptuous.Required",
"datetime.timedelta",
"epsonprinter_pkg.epsonprinterapi.EpsonPrinterAPI",
"homeassistant.exceptions.PlatformNotReady",
"voluptuous.In"
] | [((451, 478), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (468, 478), False, 'import logging\n'), ((980, 1001), 'datetime.timedelta', 'timedelta', ([], {'minutes': '(60)'}), '(minutes=60)\n', (989, 1001), False, 'from datetime import timedelta\n'), ((1220, 1241), 'epsonprinter_pkg.epso... |
# -*- coding: utf-8 ; test-case-name: bridgedb.test.test_runner -*-
#
# This file is part of BridgeDB, a Tor bridge distribution system.
#
# :authors: <NAME> 0xA3ADB67A2CDB8B35 <<EMAIL>>
# please also see AUTHORS file
# :copyright: (c) 2007-2015, The Tor Project, Inc.
# (c) 2007-2015, all entities... | [
"bridgedb.Bucket.BucketManager",
"logging.debug",
"os.geteuid",
"os.path.isdir",
"os.stat",
"twisted.python.procutils.which"
] | [((984, 1043), 'logging.debug', 'logging.debug', (['("Searching for installed \'%s\'..." % filename)'], {}), '("Searching for installed \'%s\'..." % filename)\n', (997, 1043), False, 'import logging\n'), ((1056, 1090), 'twisted.python.procutils.which', 'procutils.which', (['filename', 'os.X_OK'], {}), '(filename, os.X_... |
from flask import request
from flask_jwt import jwt_required
from flask_restful import Resource
from main.server import app, cache, db
from main.server.models import Message, MessageSchema
messages_schema = MessageSchema(many=True)
message_schema = MessageSchema()
@app.after_request
def add_header(response):
r... | [
"main.server.models.Message.query.all",
"main.server.models.Message.query.count",
"main.server.db.session.commit",
"main.server.cache.cached",
"flask.request.get_json",
"main.server.models.MessageSchema",
"main.server.db.session.add",
"flask_jwt.jwt_required",
"main.server.models.Message.query.filte... | [((210, 234), 'main.server.models.MessageSchema', 'MessageSchema', ([], {'many': '(True)'}), '(many=True)\n', (223, 234), False, 'from main.server.models import Message, MessageSchema\n'), ((252, 267), 'main.server.models.MessageSchema', 'MessageSchema', ([], {}), '()\n', (265, 267), False, 'from main.server.models imp... |
# -*- coding: utf-8 -*- {{{
# vim: set fenc=utf-8 ft=python sw=4 ts=4 sts=4 et:
#
# Copyright 2017, Battelle Memorial Institute.
#
# 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... | [
"volttron.platform.scheduling.periodic",
"weakref.ref",
"volttron.platform.agent.utils.get_aware_utc_now"
] | [((2660, 2677), 'weakref.ref', 'weakref.ref', (['core'], {}), '(core)\n', (2671, 2677), False, 'import weakref\n'), ((2700, 2719), 'weakref.ref', 'weakref.ref', (['pubsub'], {}), '(pubsub)\n', (2711, 2719), False, 'import weakref\n'), ((3626, 3647), 'volttron.platform.scheduling.periodic', 'periodic', (['self.period'],... |
"""Ni-Superalloy dataset.
Scientific Machine Learning Benchmark
A benchmark of regression models in chem- and materials informatics.
2019, <NAME>, Citrine Informatics.
See class NiSuperalloyDataset for details.
"""
import os
import json
import zipfile
from typing import List, Optional, Tuple, Union
import numpy as ... | [
"zipfile.ZipFile",
"os.path.realpath",
"smlb.parameters.params.sequence",
"smlb.exceptions.InvalidParameterError",
"os.path.basename",
"json.load",
"smlb.parameters.params.boolean"
] | [((3363, 3393), 'smlb.parameters.params.boolean', 'params.boolean', (['ignore_dubious'], {}), '(ignore_dubious)\n', (3377, 3393), False, 'from smlb.parameters import params\n'), ((4348, 4374), 'os.path.basename', 'os.path.basename', (['filepath'], {}), '(filepath)\n', (4364, 4374), False, 'import os\n'), ((4518, 4543),... |
import metricbeat
import os
import pytest
import sys
import unittest
class Test(metricbeat.BaseTest):
COMPOSE_SERVICES = ['postgresql']
def common_checks(self, output):
# Ensure no errors or warnings exist in the log.
self.assert_no_logged_warnings()
for evt in output:
t... | [
"pytest.mark.tag",
"unittest.skipUnless",
"os.getenv"
] | [((779, 848), 'unittest.skipUnless', 'unittest.skipUnless', (['metricbeat.INTEGRATION_TESTS', '"""integration test"""'], {}), "(metricbeat.INTEGRATION_TESTS, 'integration test')\n", (798, 848), False, 'import unittest\n'), ((854, 884), 'pytest.mark.tag', 'pytest.mark.tag', (['"""integration"""'], {}), "('integration')\... |
from django.contrib import admin
from books.models import Genre, Author, Book, TBR
# Register your models here.
admin.site.register(Genre)
admin.site.register(Author)
admin.site.register(Book)
admin.site.register(TBR) | [
"django.contrib.admin.site.register"
] | [((114, 140), 'django.contrib.admin.site.register', 'admin.site.register', (['Genre'], {}), '(Genre)\n', (133, 140), False, 'from django.contrib import admin\n'), ((141, 168), 'django.contrib.admin.site.register', 'admin.site.register', (['Author'], {}), '(Author)\n', (160, 168), False, 'from django.contrib import admi... |
# (C) Datadog, Inc. 2018-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import os
from packaging import version
from datadog_checks.base.utils.common import get_docker_hostname
HERE = os.path.dirname(os.path.abspath(__file__))
ROOT = os.path.dirname(os.path.dirname(HERE))
... | [
"os.path.abspath",
"os.path.dirname",
"packaging.version.parse",
"datadog_checks.base.utils.common.get_docker_hostname"
] | [((394, 429), 'packaging.version.parse', 'version.parse', (['RABBITMQ_VERSION_RAW'], {}), '(RABBITMQ_VERSION_RAW)\n', (407, 429), False, 'from packaging import version\n'), ((463, 484), 'datadog_checks.base.utils.common.get_docker_hostname', 'get_docker_hostname', ([], {}), '()\n', (482, 484), False, 'from datadog_chec... |
"""
Binary serialization
NPY format
==========
A simple format for saving numpy arrays to disk with the full
information about them.
The ``.npy`` format is the standard binary file format in NumPy for
persisting a *single* arbitrary NumPy array on disk. The format stores all
of the shape and dtype information necess... | [
"struct.calcsize",
"numpy.compat.pickle.dump",
"numpy.fromfile",
"tokenize.untokenize",
"numpy.frombuffer",
"numpy.multiply.reduce",
"numpy.compat.isfileobj",
"numpy.nditer",
"numpy.memmap",
"io.StringIO",
"struct.pack",
"struct.unpack",
"numpy.ndarray",
"numpy.compat.os_fspath",
"warnin... | [((11608, 11719), 'numpy.dtype', 'numpy.dtype', (["{'names': names, 'formats': formats, 'titles': titles, 'offsets': offsets,\n 'itemsize': offset}"], {}), "({'names': names, 'formats': formats, 'titles': titles,\n 'offsets': offsets, 'itemsize': offset})\n", (11619, 11719), False, 'import numpy\n'), ((14171, 142... |
#!/usr/bin/env python
from zoneinfo import ZoneInfo
import flask
from dateutil.parser import parse
from flask_assets import Bundle, Environment
from logzero import logger, setup_logger
from webassets.filter import get_filter
from config import cfg
from apis import calendar as gcal
setup_logger(name=__name__)
app =... | [
"dateutil.parser.parse",
"logzero.logger.info",
"flask.Flask",
"zoneinfo.ZoneInfo",
"config.cfg.load",
"apis.calendar.build_service",
"flask_assets.Environment",
"logzero.setup_logger",
"webassets.filter.get_filter",
"logzero.logger.exception",
"flask_assets.Bundle"
] | [((286, 313), 'logzero.setup_logger', 'setup_logger', ([], {'name': '__name__'}), '(name=__name__)\n', (298, 313), False, 'from logzero import logger, setup_logger\n'), ((321, 342), 'flask.Flask', 'flask.Flask', (['__name__'], {}), '(__name__)\n', (332, 342), False, 'import flask\n'), ((353, 410), 'webassets.filter.get... |
from typing import List
from ddq.taxonomy.reference import Reference
from ddq.topics.topic import Topic
class Logic(Topic):
def references(self) -> List[Reference]:
return [
Reference("Classical and Nonclassical Logics",
[("Eric", "Schechter")])
]
| [
"ddq.taxonomy.reference.Reference"
] | [((200, 271), 'ddq.taxonomy.reference.Reference', 'Reference', (['"""Classical and Nonclassical Logics"""', "[('Eric', 'Schechter')]"], {}), "('Classical and Nonclassical Logics', [('Eric', 'Schechter')])\n", (209, 271), False, 'from ddq.taxonomy.reference import Reference\n')] |
# Copyright (c) Facebook, Inc. and its affiliates.
import base64
import logging
import os
import sys
from tensorboardX import SummaryWriter
from pythia.utils.distributed_utils import is_main_process
from pythia.utils.general import (ckpt_name_from_core_args,
foldername_from_config_ov... | [
"logging.getLogger",
"os.path.exists",
"logging.StreamHandler",
"pythia.utils.timer.Timer",
"pythia.utils.general.foldername_from_config_override",
"tensorboardX.SummaryWriter",
"logging.captureWarnings",
"os.makedirs",
"logging.Formatter",
"pythia.utils.distributed_utils.is_main_process",
"os.p... | [((551, 558), 'pythia.utils.timer.Timer', 'Timer', ([], {}), '()\n', (556, 558), False, 'from pythia.utils.timer import Timer\n'), ((674, 706), 'pythia.utils.general.ckpt_name_from_core_args', 'ckpt_name_from_core_args', (['config'], {}), '(config)\n', (698, 706), False, 'from pythia.utils.general import ckpt_name_from... |
import sys
import os
import sphinx_rtd_theme
source_path = os.path.normpath(
os.path.join(
os.path.abspath(
os.path.split(__file__)[0])))
try:
from conf_base import *
except ImportError:
sys.path.append(source_path)
from conf_base import *
html_theme = 'sphinx_rtd_theme'
html_the... | [
"sphinx_rtd_theme.get_html_theme_path",
"os.path.exists",
"os.path.join",
"os.path.split",
"sys.path.append"
] | [((331, 369), 'sphinx_rtd_theme.get_html_theme_path', 'sphinx_rtd_theme.get_html_theme_path', ([], {}), '()\n', (367, 369), False, 'import sphinx_rtd_theme\n'), ((389, 430), 'os.path.join', 'os.path.join', (['source_path', '"""phdoc_static"""'], {}), "(source_path, 'phdoc_static')\n", (401, 430), False, 'import os\n'),... |
# Generated by Django 3.1.2 on 2020-10-11 10:53
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='task',
name='author',
field=m... | [
"django.db.models.DateTimeField",
"django.db.models.CharField"
] | [((319, 372), 'django.db.models.CharField', 'models.CharField', ([], {'default': '"""Anonymous"""', 'max_length': '(100)'}), "(default='Anonymous', max_length=100)\n", (335, 372), False, 'from django.db import migrations, models\n'), ((494, 542), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'default'... |
#
# 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... | [
"notification_service.mongo_notification.MongoEvent.get_base_events",
"time.time",
"notification_service.mongo_notification.MongoEvent.get_base_events_by_time",
"notification_service.mongo_notification.MongoEvent",
"mongoengine.connect",
"notification_service.mongo_notification.MongoEvent.get_base_events_... | [((2045, 2063), 'mongoengine.connect', 'connect', ([], {}), '(**db_conf)\n', (2052, 2063), False, 'from mongoengine import connect\n'), ((2155, 2199), 'notification_service.mongo_notification.MongoEvent.get_by_key', 'MongoEvent.get_by_key', (['key', '(0)', '(1)', '"""-version"""'], {}), "(key, 0, 1, '-version')\n", (21... |
import vtk
# Read the file (to test that it was written correctly)
reader = vtk.vtkXMLImageDataReader()
reader.SetFileName("../data/wind_image.vti")
reader.Update()
print(reader.GetOutput())
# Convert the image to a polydata
imageDataGeometryFilter = vtk.vtkImageDataGeometryFilter()
imageDataGeometryFilter.SetInputCon... | [
"vtk.vtkContourFilter",
"vtk.vtkXMLImageDataReader",
"vtk.vtkImageDataGeometryFilter",
"vtk.vtkRenderWindow",
"vtk.vtkRenderWindowInteractor",
"vtk.vtkPolyDataMapper",
"vtk.vtkActor",
"vtk.vtkRenderer"
] | [((77, 104), 'vtk.vtkXMLImageDataReader', 'vtk.vtkXMLImageDataReader', ([], {}), '()\n', (102, 104), False, 'import vtk\n'), ((252, 284), 'vtk.vtkImageDataGeometryFilter', 'vtk.vtkImageDataGeometryFilter', ([], {}), '()\n', (282, 284), False, 'import vtk\n'), ((477, 499), 'vtk.vtkContourFilter', 'vtk.vtkContourFilter',... |
# -*- encoding: utf-8 -*-
# Copyright (c) 2019 European Organization for Nuclear Research (CERN)
#
# 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... | [
"unittest.mock.Mock",
"watcher.decision_engine.strategy.strategies.DummyStrategy",
"unittest.mock.NonCallableMock",
"watcher.decision_engine.model.model_root.ModelRoot",
"unittest.mock.patch.object",
"watcher.tests.decision_engine.model.faker_cluster_state.FakerModelCollector"
] | [((2053, 2108), 'unittest.mock.patch.object', 'mock.patch.object', (['strategies.BaseStrategy', '"""osc"""', 'None'], {}), "(strategies.BaseStrategy, 'osc', None)\n", (2070, 2108), False, 'from unittest import mock\n'), ((2114, 2161), 'unittest.mock.patch.object', 'mock.patch.object', (['manager', '"""DataSourceManager... |
import glob
import os
import sys
import utils
from recorder import StreamRec
OUTDIR = ""
def parse_args(a):
global OUTDIR
i = 1
while i < len(a):
if a[i] in ["-h", "--help", "/?"]:
usage()
if a[i] in ["-d", "--dir"]:
OUTDIR = a[i + 1]
i += 1
i ... | [
"utils.welcome",
"utils.make_directory",
"os.path.basename",
"sys.exit",
"recorder.StreamRec",
"glob.glob"
] | [((681, 692), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (689, 692), False, 'import sys\n'), ((752, 797), 'glob.glob', 'glob.glob', (['"""data/**/*.stream"""'], {'recursive': '(True)'}), "('data/**/*.stream', recursive=True)\n", (761, 797), False, 'import glob\n'), ((1022, 1037), 'utils.welcome', 'utils.welcome', ... |
# Copyright (c) 2017 Huawei Technologies Co., Ltd.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# ... | [
"oslo_policy.policy.DocumentedRuleDefault"
] | [((925, 1132), 'oslo_policy.policy.DocumentedRuleDefault', 'policy.DocumentedRuleDefault', ([], {'name': 'GET_POLICY', 'check_str': 'base.RULE_ADMIN_OR_OWNER', 'description': '"""Show a protectable type."""', 'operations': "[{'method': 'GET', 'path': '/protectables/{protectable_type}'}]"}), "(name=GET_POLICY, check_str... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# routers are dictionaries of URL routing parameters.
#
# For each request, the effective router is:
# the built-in default base router (shown below),
# updated by the BASE router in routes.py routers,
# updated by the app-specific router in routes.py routers (if an... | [
"doctest.testmod"
] | [((9489, 9506), 'doctest.testmod', 'doctest.testmod', ([], {}), '()\n', (9504, 9506), False, 'import doctest\n')] |
# ________
# /
# \ /
# \ /
# \/
import random
import textwrap
import emd_mean
import AdvEMDpy
import emd_basis
import emd_utils
import numpy as np
import pandas as pd
import cvxpy as cvx
import seaborn as sns
import matplotlib.pyplot as plt
from scipy.integrate import odeint
from ... | [
"pandas.read_csv",
"numpy.hstack",
"emd_utils.Utility",
"matplotlib.pyplot.ylabel",
"numpy.array",
"textwrap.fill",
"scipy.ndimage.gaussian_filter",
"numpy.sin",
"numpy.arange",
"numpy.mean",
"seaborn.set",
"emd_hilbert.hilbert_spectrum",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot... | [((670, 695), 'seaborn.set', 'sns.set', ([], {'style': '"""darkgrid"""'}), "(style='darkgrid')\n", (677, 695), True, 'import seaborn as sns\n'), ((715, 746), 'numpy.linspace', 'np.linspace', (['(0)', '(2 * np.pi)', '(1001)'], {}), '(0, 2 * np.pi, 1001)\n', (726, 746), True, 'import numpy as np\n'), ((841, 906), 'emd_ut... |
"""
Revision ID: 0158_remove_rate_limit_default
Revises: 0157_add_rate_limit_to_service
Create Date: 2018-01-09 14:33:08.313893
"""
import sqlalchemy as sa
from alembic import op
revision = "0158_remove_rate_limit_default"
down_revision = "0157_add_rate_limit_to_service"
def upgrade():
op.execute("ALTER TABLE ... | [
"alembic.op.execute"
] | [((296, 360), 'alembic.op.execute', 'op.execute', (['"""ALTER TABLE services ALTER rate_limit DROP DEFAULT"""'], {}), "('ALTER TABLE services ALTER rate_limit DROP DEFAULT')\n", (306, 360), False, 'from alembic import op\n'), ((365, 437), 'alembic.op.execute', 'op.execute', (['"""ALTER TABLE services_history ALTER rate... |
#!/usr/bin/env python
# encoding: utf-8 -*-
"""
This module contains unit tests of the rmgpy.reaction module.
"""
import numpy
import unittest
from external.wip import work_in_progress
from rmgpy.species import Species, TransitionState
from rmgpy.reaction import Reaction
from rmgpy.statmech.translation import Transl... | [
"rmgpy.statmech.torsion.HinderedRotor",
"rmgpy.kinetics.Arrhenius",
"numpy.array",
"rmgpy.thermo.Wilhoit",
"rmgpy.reaction.Reaction",
"rmgpy.kinetics.Troe",
"rmgpy.kinetics.ThirdBody",
"unittest.TextTestRunner",
"rmgpy.species.Species",
"numpy.arange",
"rmgpy.statmech.translation.IdealGasTransla... | [((1776, 1824), 'rmgpy.reaction.Reaction', 'Reaction', ([], {'reactants': 'reactants', 'products': 'products'}), '(reactants=reactants, products=products)\n', (1784, 1824), False, 'from rmgpy.reaction import Reaction\n'), ((13183, 13232), 'numpy.arange', 'numpy.arange', (['(200.0)', '(2001.0)', '(200.0)', 'numpy.float6... |
"""
closed-loop MILP solved to determine optimal ordering defined by ADG
"""
import sys
import yaml
import time
import matplotlib.colors as mcolors
import matplotlib
import matplotlib.pyplot as plt
import random
import logging
import time
import networkx as nx
import csv
import statistics as stat
import os
import ... | [
"logging.getLogger",
"logging.basicConfig",
"matplotlib.pyplot.subplots_adjust",
"sys.path.insert",
"statistics.mean",
"random.seed",
"matplotlib.pyplot.figure",
"os.path.abspath",
"mip.ProgressLog",
"time.time",
"mip.Model",
"networkx.find_cycle"
] | [((426, 458), 'sys.path.insert', 'sys.path.insert', (['(1)', '"""functions/"""'], {}), "(1, 'functions/')\n", (441, 458), False, 'import sys\n'), ((640, 667), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (657, 667), False, 'import logging\n'), ((668, 762), 'logging.basicConfig', 'loggin... |
import rinobot_plugin as bot
import numpy as np
def main():
# lets get our parameters and data
filepath = bot.filepath()
data = bot.loadfile(filepath)
# now comes the custom plugin logic
shift = bot.get_arg('shift', type=float, required=True)
index = bot.index_from_args(data)
data[index] =... | [
"rinobot_plugin.loadfile",
"rinobot_plugin.filepath",
"rinobot_plugin.no_extension",
"rinobot_plugin.index_from_args",
"numpy.savetxt",
"rinobot_plugin.get_arg",
"rinobot_plugin.output_filepath"
] | [((115, 129), 'rinobot_plugin.filepath', 'bot.filepath', ([], {}), '()\n', (127, 129), True, 'import rinobot_plugin as bot\n'), ((141, 163), 'rinobot_plugin.loadfile', 'bot.loadfile', (['filepath'], {}), '(filepath)\n', (153, 163), True, 'import rinobot_plugin as bot\n'), ((217, 264), 'rinobot_plugin.get_arg', 'bot.get... |
from gluon.contrib.memcache.memcache import Client
import time
"""
examle of usage:
cache.memcache=MemcacheClient(request,[127.0.0.1:11211],debug=true)
"""
import cPickle as pickle
import thread
locker = thread.allocate_lock()
def MemcacheClient(*a, **b):
locker.acquire()
if not hasattr(MemcacheClient, '__... | [
"gluon.contrib.memcache.memcache.Client.delete",
"gluon.contrib.memcache.memcache.Client.incr",
"gluon.contrib.memcache.memcache.Client.get",
"gluon.contrib.memcache.memcache.Client.__init__",
"thread.allocate_lock",
"gluon.contrib.memcache.memcache.Client.set"
] | [((208, 230), 'thread.allocate_lock', 'thread.allocate_lock', ([], {}), '()\n', (228, 230), False, 'import thread\n'), ((707, 796), 'gluon.contrib.memcache.memcache.Client.__init__', 'Client.__init__', (['self', 'servers', 'debug', 'pickleProtocol', 'pickler', 'unpickler', 'pload', 'pid'], {}), '(self, servers, debug, ... |
#!/usr/bin/env python
# encoding: utf-8
import numbers
import os
import re
import sys
from itertools import chain
import numpy as np
import scipy.sparse as sp
import six
import pickle
from .model import get_convo_nn2
from .stop_words import THAI_STOP_WORDS
from .utils import CHAR_TYPES_MAP, CHARS_MAP, create_feature_... | [
"scipy.sparse.isspmatrix_csr",
"scipy.sparse.csc_matrix",
"pickle.dump",
"numpy.where",
"os.path.join",
"os.path.dirname",
"itertools.chain.from_iterable",
"numpy.cumsum",
"numpy.dtype",
"numpy.bincount",
"re.search"
] | [((341, 366), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (356, 366), False, 'import os\n'), ((381, 440), 'os.path.join', 'os.path.join', (['MODULE_PATH', '"""weight"""', '"""cnn_without_ne_ab.h5"""'], {}), "(MODULE_PATH, 'weight', 'cnn_without_ne_ab.h5')\n", (393, 440), False, 'import os\... |
# Copyright 2021 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | [
"numpy.zeros",
"cumm.tensorview.from_numpy",
"spconv.core_cc.csrc.utils.boxops.BoxOps.has_boost"
] | [((2449, 2490), 'numpy.zeros', 'np.zeros', (['(N, K)'], {'dtype': 'box_corners.dtype'}), '((N, K), dtype=box_corners.dtype)\n', (2457, 2490), True, 'import numpy as np\n'), ((3105, 3146), 'numpy.zeros', 'np.zeros', (['(N, K)'], {'dtype': 'box_corners.dtype'}), '((N, K), dtype=box_corners.dtype)\n', (3113, 3146), True, ... |
from torch import nn
def get_fc_discriminator(num_classes, ndf=64):
return nn.Sequential(
nn.Conv2d(num_classes, ndf, kernel_size=4, stride=2, padding=1),
nn.LeakyReLU(negative_slope=0.2, inplace=True),
nn.Conv2d(ndf, ndf * 2, kernel_size=4, stride=2, padding=1),
nn.LeakyReLU(negat... | [
"torch.nn.LeakyReLU",
"torch.nn.Conv2d"
] | [((104, 167), 'torch.nn.Conv2d', 'nn.Conv2d', (['num_classes', 'ndf'], {'kernel_size': '(4)', 'stride': '(2)', 'padding': '(1)'}), '(num_classes, ndf, kernel_size=4, stride=2, padding=1)\n', (113, 167), False, 'from torch import nn\n'), ((177, 223), 'torch.nn.LeakyReLU', 'nn.LeakyReLU', ([], {'negative_slope': '(0.2)',... |
import os
from setuptools import find_packages, setup
# Load version number
__version__ = None
src_dir = os.path.abspath(os.path.dirname(__file__))
version_file = os.path.join(src_dir, 'chemprop', '_version.py')
with open(version_file, encoding='utf-8') as fd:
exec(fd.read())
# Load README
with ope... | [
"os.path.dirname",
"setuptools.find_packages",
"os.path.join"
] | [((172, 220), 'os.path.join', 'os.path.join', (['src_dir', '"""chemprop"""', '"""_version.py"""'], {}), "(src_dir, 'chemprop', '_version.py')\n", (184, 220), False, 'import os\n'), ((129, 154), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (144, 154), False, 'import os\n'), ((1144, 1159), 's... |
"""
Main module.
Implement the central Checker class.
Also, it models the Bindings and Scopes.
"""
import __future__
import doctest
import os
import sys
PY2 = sys.version_info < (3, 0)
PY32 = sys.version_info < (3, 3) # Python 2.5 to 3.2
PY33 = sys.version_info < (3, 4) # Python 2.5 to 3.3
PY34 = ... | [
"sys.exc_info",
"doctest.DocTestParser",
"os.environ.get",
"os.path.basename"
] | [((14727, 14762), 'os.environ.get', 'os.environ.get', (['"""PYFLAKES_BUILTINS"""'], {}), "('PYFLAKES_BUILTINS')\n", (14741, 14762), False, 'import os\n'), ((30327, 30350), 'doctest.DocTestParser', 'doctest.DocTestParser', ([], {}), '()\n', (30348, 30350), False, 'import doctest\n'), ((25408, 25439), 'os.path.basename',... |
# Project Name: Auto Screenshot
# Description: Take screenshot of screen when any change take place.
# Author: Mani (Infinyte7)
# Date: 26-10-2020
# License: MIT
from pyscreenshot import grab
from PIL import ImageChops
import os
import time
import subprocess, sys
from datetime import datetime
import tkinter as tk
fr... | [
"subprocess.check_output",
"PIL.ImageChops.difference",
"os.path.exists",
"os.makedirs",
"time.sleep",
"tkinter.font.Font",
"pyscreenshot.grab",
"datetime.datetime.now"
] | [((547, 597), 'tkinter.font.Font', 'font.Font', ([], {'family': '"""Roboto"""', 'size': '(16)', 'weight': '"""bold"""'}), "(family='Roboto', size=16, weight='bold')\n", (556, 597), False, 'from tkinter import font\n'), ((1980, 2054), 'subprocess.check_output', 'subprocess.check_output', (["[sys.executable, 'GetScreenCo... |
# -*- coding: utf-8 -*-
'''
Oracle DataBase connection module
:mainteiner: <NAME> <<EMAIL>>
:maturity: new
:depends: cx_Oracle
:platform: all
:configuration: module provide connections for multiple Oracle DB instances.
**OS Environment**
.. code-block:: text
ORACLE_HOME: path to oracle product
... | [
"logging.getLogger",
"cx_Oracle.makedsn",
"salt.utils.decorators.depends",
"cx_Oracle.clientversion"
] | [((668, 695), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (685, 695), False, 'import logging\n'), ((2680, 2734), 'salt.utils.decorators.depends', 'depends', (['"""cx_Oracle"""'], {'fallback_function': '_cx_oracle_req'}), "('cx_Oracle', fallback_function=_cx_oracle_req)\n", (2687, 2734)... |
from lib.utils.plugin import import_plugin
from .base_executor import parse_exception
from .executors.hive import HiveQueryExecutor
from .executors.presto import PrestoQueryExecutor
from .executors.sqlalchemy import (
MysqlQueryExecutor,
DruidQueryExecutor,
SqliteQueryExecutor,
SnowflakeQueryExecutor,
... | [
"lib.utils.plugin.import_plugin"
] | [((401, 461), 'lib.utils.plugin.import_plugin', 'import_plugin', (['"""executor_plugin"""', '"""ALL_PLUGIN_EXECUTORS"""', '[]'], {}), "('executor_plugin', 'ALL_PLUGIN_EXECUTORS', [])\n", (414, 461), False, 'from lib.utils.plugin import import_plugin\n')] |
# -*- encoding: utf-8
from sqlalchemy.testing import eq_, is_
from sqlalchemy import schema
from sqlalchemy.sql import table, column, quoted_name
from sqlalchemy.dialects import mssql
from sqlalchemy.dialects.mssql import mxodbc
from sqlalchemy.testing import fixtures, AssertsCompiledSQL
from sqlalchemy import sql
from... | [
"sqlalchemy.sql.quoted_name",
"sqlalchemy.delete",
"sqlalchemy.dialects.mssql.base._owner_plus_db",
"sqlalchemy.MetaData",
"sqlalchemy.func.current_date",
"sqlalchemy.String",
"sqlalchemy.dialects.mssql.dialect",
"sqlalchemy.select",
"sqlalchemy.dialects.mssql.mxodbc.dialect",
"sqlalchemy.Column",... | [((663, 678), 'sqlalchemy.dialects.mssql.dialect', 'mssql.dialect', ([], {}), '()\n', (676, 678), False, 'from sqlalchemy.dialects import mssql\n'), ((1360, 1370), 'sqlalchemy.MetaData', 'MetaData', ([], {}), '()\n', (1368, 1370), False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, ... |
"""
This code is used to scrape ScienceDirect of publication urls and write them to
a text file in the current directory for later use.
"""
import selenium
from selenium import webdriver
import numpy as np
import pandas as pd
import bs4
from bs4 import BeautifulSoup
import time
from sklearn.utils import shuffle
def s... | [
"sklearn.utils.shuffle",
"selenium.webdriver.Chrome",
"time.sleep",
"pandas.read_excel",
"numpy.arange"
] | [((4232, 4270), 'pandas.read_excel', 'pd.read_excel', (['"""elsevier_journals.xls"""'], {}), "('elsevier_journals.xls')\n", (4245, 4270), True, 'import pandas as pd\n'), ((4437, 4465), 'sklearn.utils.shuffle', 'shuffle', (['df'], {'random_state': '(42)'}), '(df, random_state=42)\n', (4444, 4465), False, 'from sklearn.u... |
#!/usr/bin/env python3
import json
import platform
def make_sys_report(anonymous=False, skipUsb=False, skipPackages=False):
def get_usb():
try:
import usb.core
except ImportError:
yield "NoLib"
return
speeds = ["Unknown", "Low", "Full", "High", "Super",... | [
"platform.python_implementation",
"platform.version",
"platform.win32_ver",
"platform.platform",
"json.dumps",
"platform.python_build",
"platform.uname",
"platform.python_version",
"platform.release",
"platform.system",
"platform.architecture",
"platform.processor",
"pip._internal.operations... | [((928, 946), 'platform.machine', 'platform.machine', ([], {}), '()\n', (944, 946), False, 'import platform\n'), ((968, 987), 'platform.platform', 'platform.platform', ([], {}), '()\n', (985, 987), False, 'import platform\n'), ((1010, 1030), 'platform.processor', 'platform.processor', ([], {}), '()\n', (1028, 1030), Fa... |
"""
Utils for creating xdelta patches.
"""
import logging
from subprocess import check_output, CalledProcessError
from shutil import copyfile
from os import remove, path
class PatchChecksumError(Exception):
def __init__(self, message, errors):
super(PatchChecksumError, self).__init__(message)
class Patc... | [
"subprocess.check_output",
"os.path.join",
"shutil.copyfile",
"logging.info",
"os.remove"
] | [((674, 706), 'os.path.join', 'path.join', (['xdelta_dir', '"""xdelta3"""'], {}), "(xdelta_dir, 'xdelta3')\n", (683, 706), False, 'from os import remove, path\n'), ((1027, 1044), 'logging.info', 'logging.info', (['cmd'], {}), '(cmd)\n', (1039, 1044), False, 'import logging\n'), ((1567, 1584), 'logging.info', 'logging.i... |
from rotor import Rotor
import sys
import getopt
class Enigma:
def __init__(self, key, rotors):
self.key = list(key)
self.rotors = []
for i in range(0, len(rotors)):
self.rotors.append(Rotor(self.key[i], rotors[i]))
def encrypt(self, word):
cipher = ''
for ... | [
"rotor.Rotor",
"getopt.getopt",
"sys.exit"
] | [((1270, 1363), 'getopt.getopt', 'getopt.getopt', (['argv', '"""hk:p:d"""', "['help', 'key=', 'phrase', 'decrypt', 'r1=', 'r2=', 'r3=']"], {}), "(argv, 'hk:p:d', ['help', 'key=', 'phrase', 'decrypt', 'r1=',\n 'r2=', 'r3='])\n", (1283, 1363), False, 'import getopt\n'), ((1420, 1431), 'sys.exit', 'sys.exit', (['(2)'],... |
"""
Greedy Word Swap with Word Importance Ranking
===================================================
When WIR method is set to ``unk``, this is a reimplementation of the search
method from the paper: Is BERT Really Robust?
A Strong Baseline for Natural Language Attack on Text Classification and
Entailment by Jin et... | [
"torch.Tensor",
"numpy.max",
"numpy.array",
"textattack.shared.validators.transformation_consists_of_word_swaps_and_deletions",
"numpy.arange",
"numpy.random.shuffle"
] | [((6129, 6196), 'textattack.shared.validators.transformation_consists_of_word_swaps_and_deletions', 'transformation_consists_of_word_swaps_and_deletions', (['transformation'], {}), '(transformation)\n', (6180, 6196), False, 'from textattack.shared.validators import transformation_consists_of_word_swaps_and_deletions\n'... |
from lemur import database
def rotate_certificate(endpoint, new_cert):
"""
Rotates a certificate on a given endpoint.
:param endpoint:
:param new_cert:
:return:
"""
# ensure that certificate is available for rotation
endpoint.source.plugin.update_endpoint(endpoint, new_cert)
endpo... | [
"lemur.database.update"
] | [((351, 376), 'lemur.database.update', 'database.update', (['endpoint'], {}), '(endpoint)\n', (366, 376), False, 'from lemur import database\n')] |
# coding: utf-8
# Copyright Luna Technology 2015
# <NAME> <<EMAIL>>
from __future__ import absolute_import
import os
from celery import Celery
# Set the default Django settings module for the 'celery' program
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'pype.settings')
from django.conf import settings
from ce... | [
"os.environ.setdefault",
"celery.Celery",
"logging.config.dictConfig"
] | [((214, 278), 'os.environ.setdefault', 'os.environ.setdefault', (['"""DJANGO_SETTINGS_MODULE"""', '"""pype.settings"""'], {}), "('DJANGO_SETTINGS_MODULE', 'pype.settings')\n", (235, 278), False, 'import os\n'), ((524, 538), 'celery.Celery', 'Celery', (['"""pype"""'], {}), "('pype')\n", (530, 538), False, 'from celery i... |
from gtrain import Model
import numpy as np
import tensorflow as tf
class NetForHypinv(Model):
"""
Implementaion of the crutial function for the HypINV algorithm.
Warning: Do not use this class but implement its subclass, for example see FCNetForHypinv
"""
def __init__(self, weights):
self... | [
"tensorflow.boolean_mask",
"tensorflow.Session",
"tensorflow.placeholder",
"tensorflow.nn.xw_plus_b",
"tensorflow.nn.l2_loss",
"tensorflow.global_variables_initializer",
"tensorflow.gradients",
"numpy.zeros",
"tensorflow.name_scope",
"tensorflow.nn.softmax",
"numpy.linalg.norm",
"tensorflow.st... | [((5555, 5589), 'numpy.zeros', 'np.zeros', (['[1, self.layer_sizes[0]]'], {}), '([1, self.layer_sizes[0]])\n', (5563, 5589), True, 'import numpy as np\n'), ((12110, 12144), 'numpy.zeros', 'np.zeros', (['[1, self.layer_sizes[0]]'], {}), '([1, self.layer_sizes[0]])\n', (12118, 12144), True, 'import numpy as np\n'), ((153... |
import numpy
from keras.preprocessing import sequence
from keras.preprocessing.text import Tokenizer
from src.support import support
class PhraseManager:
def __init__(self, configuration):
self.train_phrases, self.train_labels = self._read_train_phrases()
self.test_phrases, self.test_labels = se... | [
"keras.preprocessing.text.Tokenizer",
"numpy.asarray",
"numpy.array",
"numpy.zeros",
"keras.preprocessing.sequence.pad_sequences"
] | [((1055, 1118), 'keras.preprocessing.text.Tokenizer', 'Tokenizer', ([], {'num_words': 'self.configuration[support.QUANTITY_WORDS]'}), '(num_words=self.configuration[support.QUANTITY_WORDS])\n', (1064, 1118), False, 'from keras.preprocessing.text import Tokenizer\n'), ((1338, 1442), 'keras.preprocessing.sequence.pad_seq... |
from setuptools import setup
version = "1.0.0"
long_description = """
PayPalHttp is a generic http client designed to be used with code-generated projects.
"""
setup(
name="paypalhttp",
long_description=long_description,
version=version,
author="PayPal",
packages=["paypalhttp", "paypalhttp/testu... | [
"setuptools.setup"
] | [((164, 1079), 'setuptools.setup', 'setup', ([], {'name': '"""paypalhttp"""', 'long_description': 'long_description', 'version': 'version', 'author': '"""PayPal"""', 'packages': "['paypalhttp', 'paypalhttp/testutils', 'paypalhttp/serializers']", 'install_requires': "['requests>=2.0.0', 'six>=1.0.0', 'pyopenssl>=0.15']"... |
import gym
import gym.spaces as spaces
import sys
import socket
from _thread import *
import os
import numpy as np
import pandas as pd
import math as m
import time
import random
class NetEnv(gym.Env):
def __init__(self):
# Robot State values that will be bounced with client
self.robot_state = None
self.p... | [
"numpy.array",
"socket.socket"
] | [((347, 380), 'numpy.array', 'np.array', (['(12345)'], {'dtype': 'np.float32'}), '(12345, dtype=np.float32)\n', (355, 380), True, 'import numpy as np\n'), ((621, 670), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (634, 670), False, 'import s... |
# 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 u... | [
"logging.getLogger",
"superset.viz.DistributionBarViz",
"superset.viz.BaseViz",
"superset.viz.DeckScatterViz",
"unittest.mock.patch",
"superset.viz.TableViz",
"pandas.to_datetime",
"datetime.datetime",
"superset.viz.PartitionViz",
"pandas.DataFrame",
"superset.viz.DeckGeoJson",
"unittest.mock.... | [((1253, 1280), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1270, 1280), False, 'import logging\n'), ((13055, 13094), 'unittest.mock.patch', 'patch', (['"""superset.viz.BaseViz.query_obj"""'], {}), "('superset.viz.BaseViz.query_obj')\n", (13060, 13094), False, 'from unittest.mock impo... |
#!/usr/bin/env python
import pandas as pd
from pathlib import Path
from torch.utils.data import DataLoader
class ModelContainer(object):
def __init__(self, model, optimizer, loss_fn, scheduler=None):
self.model = model
self.optimizer = optimizer
self.loss_fn = loss_fn
self.scheduler = scheduler
cl... | [
"torch.utils.data.DataLoader"
] | [((1411, 1476), 'torch.utils.data.DataLoader', 'DataLoader', (['self.train_ds', 'self._bs'], {'shuffle': '(True)', 'drop_last': '(True)'}), '(self.train_ds, self._bs, shuffle=True, drop_last=True)\n', (1421, 1476), False, 'from torch.utils.data import DataLoader\n'), ((1583, 1646), 'torch.utils.data.DataLoader', 'DataL... |
#!/usr/bin/env python
from __future__ import print_function
import logging
import os
def setup_logging():
# Set log level of the messages to show.
level_name = os.environ.get('BUCK_WRAPPER_LOG_LEVEL', 'INFO')
level_name_to_level = {
'CRITICAL': logging.CRITICAL,
'ERROR': logging.ERROR,
... | [
"logging.basicConfig",
"os.environ.get"
] | [((171, 219), 'os.environ.get', 'os.environ.get', (['"""BUCK_WRAPPER_LOG_LEVEL"""', '"""INFO"""'], {}), "('BUCK_WRAPPER_LOG_LEVEL', 'INFO')\n", (185, 219), False, 'import os\n'), ((530, 642), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'level', 'format': '"""%(asctime)s [%(levelname)s][%(filename)s:%(l... |
"""
Name: Bondi
References: Bondi, Proc. Roy. Soc. Lond. A, v282, p303, (1964)
Coordinates: Spherical
Symmetry: Spherical
Notes: Outgoing Coordinates
"""
from sympy import Function, diag, sin, symbols
coords = symbols("r v theta phi", real=True)
variables = ()
functions = symbols("C M", cls=Function)
r, v, th, ph = co... | [
"sympy.symbols",
"sympy.sin"
] | [((211, 246), 'sympy.symbols', 'symbols', (['"""r v theta phi"""'], {'real': '(True)'}), "('r v theta phi', real=True)\n", (218, 246), False, 'from sympy import Function, diag, sin, symbols\n'), ((274, 302), 'sympy.symbols', 'symbols', (['"""C M"""'], {'cls': 'Function'}), "('C M', cls=Function)\n", (281, 302), False, ... |
from __future__ import unicode_literals
import json
from django.apps import apps
from django.core.urlresolvers import NoReverseMatch, reverse
from django.http import Http404, HttpRequest, QueryDict
from django.test import TestCase, override_settings
from django.utils import timezone
from wagtail.wagtailcore.models i... | [
"ask_cfpb.views.redirect_ask_search",
"model_mommy.mommy.make",
"mock.patch",
"v1.util.migrations.get_or_create_page",
"json.loads",
"django.http.QueryDict",
"mock.Mock",
"ask_cfpb.views.view_answer",
"wagtail.wagtailcore.models.Site.objects.get",
"django.utils.timezone.now",
"django.test.overri... | [((623, 637), 'django.utils.timezone.now', 'timezone.now', ([], {}), '()\n', (635, 637), False, 'from django.utils import timezone\n'), ((1970, 2030), 'mock.patch', 'mock.patch', (['"""ask_cfpb.views.ServeView.serve_latest_revision"""'], {}), "('ask_cfpb.views.ServeView.serve_latest_revision')\n", (1980, 2030), False, ... |