code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import ctypes
import ctypes.util
libc = ctypes.CDLL(ctypes.util.find_library('c'))
# Get network device's name
def if_indextoname (index):
if not isinstance (index, int):
raise TypeError ('Index must be an integer.')
libc.if_indextoname.argtypes = [ctypes.c_uint32, ctypes.c_char_p]
libc.if_indexto... | [
"ctypes.util.find_library",
"ctypes.create_string_buffer"
] | [((53, 82), 'ctypes.util.find_library', 'ctypes.util.find_library', (['"""c"""'], {}), "('c')\n", (77, 82), False, 'import ctypes\n'), ((365, 396), 'ctypes.create_string_buffer', 'ctypes.create_string_buffer', (['(32)'], {}), '(32)\n', (392, 396), False, 'import ctypes\n')] |
import nltk,re,codecs
from nltk.tokenize import word_tokenize,sent_tokenize
from backNode import BackNode
from nltk import Tree
def trace_tree(trace):
if trace.left==None and trace.right==None:
return str(trace.root)+" "+str(trace.word)
return "("+str(trace.root)+"("+str(trace_tree(trace.left))+")"+" "+"("+str... | [
"backNode.BackNode",
"re.sub",
"nltk.Tree.fromstring",
"nltk.data.load"
] | [((1127, 1177), 'nltk.data.load', 'nltk.data.load', (['"""grammars/large_grammars/atis.cfg"""'], {}), "('grammars/large_grammars/atis.cfg')\n", (1141, 1177), False, 'import nltk, re, codecs\n'), ((680, 715), 're.sub', 're.sub', (['"""\\\\d+\\\\s:\\\\s"""', '""""""', 'lines[i]'], {}), "('\\\\d+\\\\s:\\\\s', '', lines[i]... |
#!/usr/bin/env python
# PYTHON_ARGCOMPLETE_OK
"""
{{cookiecutter.project_slug}}.cli
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
{{ cookiecutter.project_short_description }}
:copyright: © 2019 by the Choppy Team.
:license: AGPLv3+, see LICENSE for more details.
"""
"""Console script for {{cookiecutter.proje... | [
"click.echo",
"click.command"
] | [((361, 376), 'click.command', 'click.command', ([], {}), '()\n', (374, 376), False, 'import click\n'), ((462, 571), 'click.echo', 'click.echo', (['"""Replace this message by putting your code into {{cookiecutter.project_slug}}.cli.main"""'], {}), "(\n 'Replace this message by putting your code into {{cookiecutter.p... |
from __future__ import annotations
__all__ = ("executor",)
import inspect
import sys
from asyncio import get_running_loop
from concurrent.futures import Executor
from functools import partial, wraps
from typing import Awaitable, Callable, TypeVar, overload
from asphalt.core import Context
if sys.version_info >= (3,... | [
"inspect.iscoroutinefunction",
"functools.wraps",
"functools.partial",
"typing_extensions.ParamSpec",
"asyncio.get_running_loop",
"typing.TypeVar"
] | [((447, 466), 'typing.TypeVar', 'TypeVar', (['"""T_Retval"""'], {}), "('T_Retval')\n", (454, 466), False, 'from typing import Awaitable, Callable, TypeVar, overload\n'), ((471, 485), 'typing_extensions.ParamSpec', 'ParamSpec', (['"""P"""'], {}), "('P')\n", (480, 485), False, 'from typing_extensions import Concatenate, ... |
import jinja2
page = {}
page['title'] = 'Shkola'
page['item_path'] = '../src/'
page['google_signin_client_id'] = ""
page['google_site_verification'] = ""
page['button'] = {
'width' : '137px',
'height' : '140px',
'font_size' : '111px',
'margin' : '10px',
'choices' : []
}
page['button']['choices... | [
"jinja2.FileSystemLoader",
"jinja2.Environment"
] | [((2134, 2163), 'jinja2.FileSystemLoader', 'jinja2.FileSystemLoader', (['""".."""'], {}), "('..')\n", (2157, 2163), False, 'import jinja2\n'), ((2170, 2208), 'jinja2.Environment', 'jinja2.Environment', ([], {'loader': 'file_loader'}), '(loader=file_loader)\n', (2188, 2208), False, 'import jinja2\n')] |
import logging
import json
import glob
import pandas as pd
import multiprocessing
import numpy as np
from sklearn.ensemble import RandomForestClassifier
from sklearn.ensemble import ExtraTreesClassifier
from sklearn.tree import DecisionTreeClassifier
from sklearn.ensemble import AdaBoostClassifier
from sklearn.metrics... | [
"sklearn.ensemble.ExtraTreesClassifier",
"pandas.read_csv",
"sklearn.metrics.classification_report",
"multiprocessing.cpu_count",
"sklearn.metrics.roc_auc_score",
"sklearn.metrics.precision_score",
"sklearn.metrics.recall_score",
"sklearn.metrics.roc_curve",
"sklearn.model_selection.KFold",
"loggi... | [((666, 700), 'numpy.random.seed', 'np.random.seed', (['config.RANDOM_SEED'], {}), '(config.RANDOM_SEED)\n', (680, 700), True, 'import numpy as np\n'), ((1547, 1574), 'multiprocessing.cpu_count', 'multiprocessing.cpu_count', ([], {}), '()\n', (1572, 1574), False, 'import multiprocessing\n'), ((1832, 1903), 'sklearn.mod... |
# coding: utf-8
from __future__ import unicode_literals
import time
import logging
import traceback
from optparse import make_option
import json
from django.core.management.base import BaseCommand, CommandError
from django.conf import settings
from django_fuzzytest.runner import FuzzyRunner
logger = logging.getLogge... | [
"logging.getLogger",
"json.loads",
"optparse.make_option",
"django_fuzzytest.runner.FuzzyRunner"
] | [((304, 331), 'logging.getLogger', 'logging.getLogger', (['__file__'], {}), '(__file__)\n', (321, 331), False, 'import logging\n'), ((1519, 1543), 'django_fuzzytest.runner.FuzzyRunner', 'FuzzyRunner', (['self.params'], {}), '(self.params)\n', (1530, 1543), False, 'from django_fuzzytest.runner import FuzzyRunner\n'), ((... |
# Generated by Django 2.0.7 on 2018-07-06 19:23
from django.db import migrations, models
import django_extensions.db.fields
class Migration(migrations.Migration):
dependencies = [
('grading_system', '0002_student_email'),
]
operations = [
migrations.RenameField(
model_name='... | [
"django.db.models.DecimalField",
"django.db.migrations.RenameField",
"django.db.models.CharField"
] | [((272, 379), 'django.db.migrations.RenameField', 'migrations.RenameField', ([], {'model_name': '"""assignment"""', 'old_name': '"""assingment_date"""', 'new_name': '"""assignment_date"""'}), "(model_name='assignment', old_name='assingment_date',\n new_name='assignment_date')\n", (294, 379), False, 'from django.db i... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from ... import _utilities
fro... | [
"pulumi.getter",
"pulumi.log.warn",
"pulumi.set",
"pulumi.get"
] | [((2116, 2147), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""osLicense"""'}), "(name='osLicense')\n", (2129, 2147), False, 'import pulumi\n'), ((5829, 5877), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""computeEngineTargetDetails"""'}), "(name='computeEngineTargetDetails')\n", (5842, 5877), False, 'import... |
# coding=utf-8
#------------------------------------------------------------------------------#
import os
import time
import fuse
import errno
from .item import RelFuseItem
from .static_dir import StaticDirectory
#------------------------------------------------------------------------------#
class MountRoot(RelFuseIte... | [
"time.time"
] | [((491, 502), 'time.time', 'time.time', ([], {}), '()\n', (500, 502), False, 'import time\n')] |
"""etravel URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based... | [
"django.conf.urls.static.static",
"django.urls.path"
] | [((1542, 1603), 'django.conf.urls.static.static', 'static', (['settings.MEDIA_URL'], {'document_root': 'settings.MEDIA_ROOT'}), '(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)\n', (1548, 1603), False, 'from django.conf.urls.static import static\n'), ((823, 854), 'django.urls.path', 'path', (['"""admin/"""', 'a... |
import numpy as np
import tensorflow as tf
from tensorflow.contrib import gan as tfgan
from GeneralTools.graph_funcs.my_session import MySession
from GeneralTools.math_funcs.graph_func_support import mean_cov_np, trace_sqrt_product_np
from GeneralTools.misc_fun import FLAGS
class GenerativeModelMetric(object):
d... | [
"tensorflow.unstack",
"numpy.trace",
"tensorflow.transpose",
"tensorflow.contrib.gan.eval.run_inception",
"tensorflow.split",
"tensorflow.contrib.gan.eval.get_graph_def_from_disk",
"tensorflow.contrib.gan.eval.sliced_wasserstein_distance",
"tensorflow.image.ssim_multiscale",
"numpy.concatenate",
"... | [((2250, 2372), 'tensorflow.contrib.gan.eval.run_inception', 'tfgan.eval.run_inception', (['image'], {'graph_def': 'self.inception_graph_def', 'input_tensor': '"""Mul:0"""', 'output_tensor': 'output_tensor'}), "(image, graph_def=self.inception_graph_def,\n input_tensor='Mul:0', output_tensor=output_tensor)\n", (2274... |
import logging
import pytest
from selene import Browser, Config
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from webdriver_manager.chrome import ChromeDriverManager
@pytest.fixture(scope='function')
def browser_func(choose_driver):
"""Browser that closes after each test f... | [
"selenium.webdriver.chrome.options.Options",
"selenium.webdriver.Remote",
"selene.Config",
"selenium.webdriver.ChromeOptions",
"logging.debug",
"webdriver_manager.chrome.ChromeDriverManager",
"selenium.webdriver.FirefoxOptions",
"pytest.fixture",
"selenium.webdriver.DesiredCapabilities",
"logging.... | [((210, 242), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""function"""'}), "(scope='function')\n", (224, 242), False, 'import pytest\n'), ((394, 423), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""class"""'}), "(scope='class')\n", (408, 423), False, 'import pytest\n'), ((563, 593), 'pytest.fixture', ... |
from typing import Any, Callable
import matplotlib.pyplot as plt
from numpy import arange
from .membership import Membership
class BaseSet:
def __init__(
self,
name: str,
membership: Membership,
aggregation: Callable[[Any, Any], Any],
):
self.name = name
self.... | [
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.title",
"numpy.arange"
] | [((1352, 1364), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (1362, 1364), True, 'import matplotlib.pyplot as plt\n'), ((1373, 1393), 'matplotlib.pyplot.title', 'plt.title', (['self.name'], {}), '(self.name)\n', (1382, 1393), True, 'import matplotlib.pyplot as plt\n'), ((1402, 1429), 'matplotlib.pyplot.x... |
import numpy as np
import chess
import chess.engine
from tkinter.filedialog import asksaveasfilename
from parsing.math_encode import tensor_encode, tensor_decode
from inference.infer_action import get_action
class PlayLoop:
__doc__ = '''
An interactive REPL environment for play with a trained chess AI
''... | [
"numpy.flip",
"inference.infer_action.get_action",
"chess.Move.from_uci",
"chess.engine.SimpleEngine.popen_uci",
"tkinter.filedialog.asksaveasfilename",
"chess.Board",
"chess.engine.Limit",
"parsing.math_encode.tensor_encode",
"numpy.around"
] | [((2322, 2335), 'chess.Board', 'chess.Board', ([], {}), '()\n', (2333, 2335), False, 'import chess\n'), ((5869, 5901), 'inference.infer_action.get_action', 'get_action', (['self.board', 'src', 'tgt'], {}), '(self.board, src, tgt)\n', (5879, 5901), False, 'from inference.infer_action import get_action\n'), ((4863, 4916)... |
#
# 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... | [
"mock.patch",
"apache_beam.testing.util.equal_to",
"unittest.skipIf",
"apache_beam.testing.test_stream.TestStream",
"apache_beam.examples.streaming_wordcount_debugging.run",
"apache_beam.testing.util.assert_that",
"unittest.main"
] | [((1516, 1585), 'unittest.skipIf', 'unittest.skipIf', (['(pubsub is None)', '"""GCP dependencies are not installed"""'], {}), "(pubsub is None, 'GCP dependencies are not installed')\n", (1531, 1585), False, 'import unittest\n'), ((1589, 1632), 'mock.patch', 'mock.patch', (['"""apache_beam.io.ReadFromPubSub"""'], {}), "... |
# -*- coding: utf-8 -*-
import pickle
from sklearn.ensemble import RandomForestClassifier
from base_shallow_classifier import BaseShallowClassifier
class RFClassifier(BaseShallowClassifier):
'''
Image classification using random forest classifier (RFC).
Can reach 87.82% accuracy on test set of FashionM... | [
"pickle.dumps",
"sklearn.ensemble.RandomForestClassifier"
] | [((867, 891), 'sklearn.ensemble.RandomForestClassifier', 'RandomForestClassifier', ([], {}), '()\n', (889, 891), False, 'from sklearn.ensemble import RandomForestClassifier\n'), ((1537, 1628), 'sklearn.ensemble.RandomForestClassifier', 'RandomForestClassifier', ([], {'n_estimators': 'n_estimators', 'min_samples_split':... |
from oslo_log import log
from oslo_config import cfg
from report import storage
from pecan import hooks
LOG = log.getLogger(__name__)
class RPCHook(hooks.PecanHook):
def __init__(self, rcp_client):
self._rpc_client = rcp_client
def before(self, state):
state.request.rpc_client = self._rpc_cl... | [
"report.storage.get_connection_from_config",
"oslo_log.log.getLogger"
] | [((111, 134), 'oslo_log.log.getLogger', 'log.getLogger', (['__name__'], {}), '(__name__)\n', (124, 134), False, 'from oslo_log import log\n'), ((417, 461), 'report.storage.get_connection_from_config', 'storage.get_connection_from_config', (['cfg.CONF'], {}), '(cfg.CONF)\n', (451, 461), False, 'from report import storag... |
# Generated by Django 2.0.9 on 2018-11-25 11:21
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('products', '0011_auto_20181123_1446'),
]
operations = [
migrations.RenameField(
model_name='item',
old_name='amount'... | [
"django.db.migrations.RenameField",
"django.db.models.SmallIntegerField"
] | [((236, 321), 'django.db.migrations.RenameField', 'migrations.RenameField', ([], {'model_name': '"""item"""', 'old_name': '"""amount"""', 'new_name': '"""_amount"""'}), "(model_name='item', old_name='amount', new_name='_amount'\n )\n", (258, 321), False, 'from django.db import migrations, models\n'), ((482, 529), 'd... |
from weibo import WeiboClient
from weibo.watchyou import fetch_replies
for r in fetch_replies(): # fetch_replies所依赖的weibo全局变量是在watchyou模块中存在的, 函数无法访问到这个模块中的全局变量
print(r['text'])
| [
"weibo.watchyou.fetch_replies"
] | [((84, 99), 'weibo.watchyou.fetch_replies', 'fetch_replies', ([], {}), '()\n', (97, 99), False, 'from weibo.watchyou import fetch_replies\n')] |
# ============================================================================
# FILE: kind.py
# AUTHOR: <NAME> <Shougo.Matsu at g<EMAIL>>
# License: MIT license
# ============================================================================
import json
import typing
from pathlib import Path
from defx.action import Ac... | [
"defx.session.Session",
"defx.action.ActionTable",
"defx.action.do_action",
"pathlib.Path"
] | [((3830, 3856), 'pathlib.Path', 'Path', (['context.session_file'], {}), '(context.session_file)\n', (3834, 3856), False, 'from pathlib import Path\n'), ((6360, 6409), 'defx.action.do_action', 'do_action', (['view', 'defx', 'view._prev_action', 'context'], {}), '(view, defx, view._prev_action, context)\n', (6369, 6409),... |
import os.path
from typing import List, Tuple
from mapfmclient import MarkedLocation, Problem
class MapParser:
def __init__(self, root_folder: str):
self.root_folder = root_folder
def parse_map(self, name: str) -> Problem:
with open(os.path.join(self.root_folder, name)) as file:
... | [
"mapfmclient.Problem"
] | [((1397, 1440), 'mapfmclient.Problem', 'Problem', (['grid', 'width', 'height', 'starts', 'goals'], {}), '(grid, width, height, starts, goals)\n', (1404, 1440), False, 'from mapfmclient import MarkedLocation, Problem\n')] |
#!/usr/bin/python
# Copyright (c) 2018, 2019, Oracle and/or its affiliates.
# This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Apache License v2.0
# See LICENSE.TXT for ... | [
"ansible.module_utils.basic.AnsibleModule",
"ansible.module_utils.oracle.oci_utils.create_service_client",
"ansible.module_utils.oracle.oci_utils.create_resource",
"oci.identity.models.CreateApiKeyDetails",
"ansible.module_utils.oracle.oci_utils.call_with_backoff",
"oci.util.to_dict",
"ansible.module_ut... | [((7336, 7407), 'ansible.module_utils.oracle.oci_utils.get_common_arg_spec', 'oci_utils.get_common_arg_spec', ([], {'supports_create': '(True)', 'supports_wait': '(True)'}), '(supports_create=True, supports_wait=True)\n', (7365, 7407), False, 'from ansible.module_utils.oracle import oci_utils\n'), ((7876, 7998), 'ansib... |
import pytest
from dlms_cosem import enumerations, state
from dlms_cosem.exceptions import LocalDlmsProtocolError
from dlms_cosem.protocol import acse
from dlms_cosem.protocol.acse import UserInformation
from dlms_cosem.protocol.xdlms import Conformance, InitiateRequestApdu
def test_non_aarq_on_initial_raises_protoc... | [
"dlms_cosem.protocol.acse.ApplicationAssociationResponseApdu",
"dlms_cosem.state.DlmsConnectionState",
"dlms_cosem.protocol.xdlms.Conformance",
"dlms_cosem.protocol.acse.ReleaseResponseApdu",
"pytest.raises"
] | [((340, 367), 'dlms_cosem.state.DlmsConnectionState', 'state.DlmsConnectionState', ([], {}), '()\n', (365, 367), False, 'from dlms_cosem import enumerations, state\n'), ((524, 551), 'dlms_cosem.state.DlmsConnectionState', 'state.DlmsConnectionState', ([], {}), '()\n', (549, 551), False, 'from dlms_cosem import enumerat... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from typing import Optional
from epicteller.core import redis
from epicteller.core.model.credential import Credential
class CredentialDAO:
r = redis.pool
@classmethod
async def set_access_credential(cls, credential: Credential):
await cls.r.pool.set(... | [
"epicteller.core.model.credential.Credential.parse_raw"
] | [((1185, 1211), 'epicteller.core.model.credential.Credential.parse_raw', 'Credential.parse_raw', (['data'], {}), '(data)\n', (1205, 1211), False, 'from epicteller.core.model.credential import Credential\n')] |
from common import *
from model import vocab
option = dict(edim=256, epochs=1.5, maxgrad=1., learningrate=1e-3, sdt_decay_step=1, batchsize=8, vocabsize=vocab, fp16=2, saveInterval=10, logInterval=.4)
option['loss'] = lambda opt, model, y, out, *_, rewards=[]: F.cross_entropy(out.transpose(-1, -2), y, reduction='none')... | [
"qhoptim.pyt.QHAdam"
] | [((949, 1022), 'qhoptim.pyt.QHAdam', 'QHAdam', (['params'], {'lr': 'opt.learningrate', 'nus': '(0.7, 0.8)', 'betas': '(0.995, 0.999)'}), '(params, lr=opt.learningrate, nus=(0.7, 0.8), betas=(0.995, 0.999))\n', (955, 1022), False, 'from qhoptim.pyt import QHAdam\n')] |
import bpy
from aiohttp import web
import numpy as np
from mathutils import Matrix, Vector
import asyncio
from cinebot_mini_render_server.blender_timer_executor import EXECUTOR
routes = web.RouteTableDef()
def delete_animation_helper(obj):
if not obj.animation_data:
return False
if not obj.animation_... | [
"numpy.array",
"aiohttp.web.RouteTableDef",
"aiohttp.web.json_response",
"mathutils.Matrix",
"aiohttp.web.HTTPBadRequest",
"asyncio.get_event_loop",
"bpy.data.actions.new"
] | [((187, 206), 'aiohttp.web.RouteTableDef', 'web.RouteTableDef', ([], {}), '()\n', (204, 206), False, 'from aiohttp import web\n'), ((1489, 1513), 'asyncio.get_event_loop', 'asyncio.get_event_loop', ([], {}), '()\n', (1511, 1513), False, 'import asyncio\n'), ((1791, 1814), 'aiohttp.web.json_response', 'web.json_response... |
from copy import deepcopy
from numba import jit,njit
import numpy as np
import pymctdh.opfactory as opfactory
from pymctdh.cy.sparsemat import CSRmat#,matvec
@njit(fastmath=True)
def matvec(nrows,IA,JA,data,vec,outvec):
"""
"""
d_ind = 0
for i in range(nrows):
ncol = IA[i+1]-IA[i]
for... | [
"numpy.union1d",
"numba.njit",
"pymctdh.cy.sparsemat.CSRmat",
"numpy.array",
"numpy.zeros",
"numpy.dot",
"copy.deepcopy",
"numpy.arange"
] | [((162, 181), 'numba.njit', 'njit', ([], {'fastmath': '(True)'}), '(fastmath=True)\n', (166, 181), False, 'from numba import jit, njit\n'), ((557, 570), 'copy.deepcopy', 'deepcopy', (['op2'], {}), '(op2)\n', (565, 570), False, 'from copy import deepcopy\n'), ((1268, 1282), 'numpy.array', 'np.array', (['data'], {}), '(d... |
# Copyright (c) 2020 DeNA Co., Ltd.
# Licensed under The MIT License [see LICENSE for details]
# kaggle_environments licensed under Copyright 2020 Kaggle Inc. and the Apache License, Version 2.0
# (see https://github.com/Kaggle/kaggle-environments/blob/master/LICENSE for details)
# wrapper of Hungry Geese environment... | [
"torch.nn.BatchNorm2d",
"random.choice",
"kaggle_environments.envs.hungry_geese.hungry_geese.Observation",
"handyrl.envs.kaggle.public_flood_goose.public_flood_agent_goose.step",
"torch.nn.Conv2d",
"torch.cat",
"numpy.zeros",
"torch.nn.Linear",
"handyrl.envs.kaggle.public_flood_goose.State.from_obs_... | [((962, 1073), 'torch.nn.Conv2d', 'nn.Conv2d', (['input_dim', 'output_dim'], {'kernel_size': 'kernel_size', 'padding': 'self.edge_size', 'padding_mode': '"""circular"""'}), "(input_dim, output_dim, kernel_size=kernel_size, padding=self.\n edge_size, padding_mode='circular')\n", (971, 1073), True, 'import torch.nn as... |
# =======================================================================================================================================
# VNU-HCM, University of Science
# Department Computer Science, Faculty of Information Technology
# Authors: <NAME> (<NAME>)
# © 2020
"""
Given a string name, e.g. "Bob", return a g... | [
"unittest.main"
] | [((1535, 1550), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1548, 1550), False, 'import unittest\n')] |
from pygears import gear, Intf
from pygears.common import czip
from pygears.typing import Tuple, Uint, Union, Queue
from pygears.common import fmap, demux, decoupler, fifo, union_collapse
from pygears.cookbook import priority_mux, replicate
TCfg = Tuple[{'reduce_size': Uint['w_reduce_size'], 'init': 't_acc'}]
@gear
... | [
"pygears.common.czip",
"pygears.Intf",
"pygears.common.fifo",
"pygears.common.fmap"
] | [((461, 478), 'pygears.Intf', 'Intf', ([], {'dtype': 'qtype'}), '(dtype=qtype)\n', (465, 478), False, 'from pygears import gear, Intf\n'), ((581, 621), 'pygears.common.fmap', 'fmap', ([], {'f': 'union_collapse', 'fcat': 'czip', 'lvl': '(1)'}), '(f=union_collapse, fcat=czip, lvl=1)\n', (585, 621), False, 'from pygears.c... |
#
# Copyright (c) 2020-2021 Arm Limited and Contributors. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
import pathlib
import tempfile
from unittest import TestCase, mock
from mbed_tools.build.flash import flash_binary, _build_binary_file_path, _flash_dev
from mbed_tools.build.exceptions import Binary... | [
"tempfile.TemporaryDirectory",
"pathlib.Path",
"mbed_tools.build.flash._build_binary_file_path",
"tests.build.factories.DeviceFactory",
"mbed_tools.build.flash._build_binary_file_path.assert_called_once_with",
"unittest.mock.patch"
] | [((390, 450), 'unittest.mock.patch', 'mock.patch', (['"""mbed_tools.build.flash._build_binary_file_path"""'], {}), "('mbed_tools.build.flash._build_binary_file_path')\n", (400, 450), False, 'from unittest import TestCase, mock\n'), ((452, 499), 'unittest.mock.patch', 'mock.patch', (['"""mbed_tools.build.flash._flash_de... |
import time
import typing
import requests
from sys import stderr
from datetime import datetime
from packettotal_sdk import packettotal_api
class SearchTools(packettotal_api.PacketTotalApi):
def __init__(self, api_key: str):
"""
:param api_key: An API authentication token
"""
sup... | [
"time.sleep",
"datetime.datetime.utcnow"
] | [((1428, 1441), 'time.sleep', 'time.sleep', (['(5)'], {}), '(5)\n', (1438, 1441), False, 'import time\n'), ((1315, 1329), 'time.sleep', 'time.sleep', (['(10)'], {}), '(10)\n', (1325, 1329), False, 'import time\n'), ((1387, 1404), 'datetime.datetime.utcnow', 'datetime.utcnow', ([], {}), '()\n', (1402, 1404), False, 'fro... |
from unittest.mock import Mock, patch
import pandas as pd
from sdgym.s3 import is_s3_path, parse_s3_path, write_csv, write_file
def test_is_s3_path_with_local_dir():
"""Test the ``sdgym.s3.is_s3_path`` function with a local directory.
If the path is not an s3 path, it should return ``False``.
Input:
... | [
"sdgym.s3.write_csv",
"unittest.mock.Mock",
"sdgym.s3.is_s3_path",
"pandas.DataFrame",
"unittest.mock.patch",
"sdgym.s3.parse_s3_path"
] | [((2827, 2850), 'unittest.mock.patch', 'patch', (['"""sdgym.s3.boto3"""'], {}), "('sdgym.s3.boto3')\n", (2832, 2850), False, 'from unittest.mock import Mock, patch\n'), ((4090, 4118), 'unittest.mock.patch', 'patch', (['"""sdgym.s3.write_file"""'], {}), "('sdgym.s3.write_file')\n", (4095, 4118), False, 'from unittest.mo... |
from cloud.permission import Permission, NeedPermission
# Define the input output format of the function.
# This information is used when creating the *SDK*.
info = {
'input_format': {
'session_ids': ['str'],
},
'output_format': {
'success': 'bool'
},
'description': 'Delete session... | [
"cloud.permission.NeedPermission"
] | [((328, 379), 'cloud.permission.NeedPermission', 'NeedPermission', (['Permission.Run.Auth.delete_sessions'], {}), '(Permission.Run.Auth.delete_sessions)\n', (342, 379), False, 'from cloud.permission import Permission, NeedPermission\n')] |
# coding=<utf-8>
import requests
import re
import socket
import base64
import psutil
import pywifi
from pywifi import const
import subprocess
import os
import time
def get_host_ip():
try:
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(('8.8.8.8', 80))
ip = s.getsockname()[0... | [
"pywifi.PyWiFi",
"requests.post",
"socket.socket",
"subprocess.Popen",
"time.sleep",
"re.sub",
"psutil.net_if_addrs"
] | [((518, 539), 'psutil.net_if_addrs', 'psutil.net_if_addrs', ([], {}), '()\n', (537, 539), False, 'import psutil\n'), ((206, 254), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_DGRAM'], {}), '(socket.AF_INET, socket.SOCK_DGRAM)\n', (219, 254), False, 'import socket\n'), ((2352, 2411), 're.sub', 're.... |
"""Utilities for approximating gradients."""
import numpy as np
from utils.misc import process_inputs
from utils.simrunners import SimulationRunner
def local_linear_gradients(X, f, p=None, weights=None):
"""Estimate a collection of gradients from input/output pairs.
Given a set of input/output pairs, choo... | [
"numpy.eye",
"numpy.sqrt",
"numpy.ones",
"numpy.log",
"numpy.floor",
"numpy.argsort",
"numpy.sum",
"numpy.zeros",
"numpy.random.randint",
"utils.simrunners.SimulationRunner",
"numpy.linalg.lstsq",
"utils.misc.process_inputs"
] | [((1186, 1203), 'utils.misc.process_inputs', 'process_inputs', (['X'], {}), '(X)\n', (1200, 1203), False, 'from utils.misc import process_inputs\n'), ((1646, 1663), 'numpy.zeros', 'np.zeros', (['(MM, m)'], {}), '((MM, m))\n', (1654, 1663), True, 'import numpy as np\n'), ((2664, 2681), 'utils.misc.process_inputs', 'proc... |
import csv
import sys
from pathlib import Path
from abc import abstractmethod
import numpy as np
import tensorflow as tf
from tqdm import tqdm
import common.tf_utils as tf_utils
import metrics.manager as metric_manager
from common.model_loader import Ckpt
from common.utils import format_text
from common.utils import ... | [
"tensorflow.local_variables_initializer",
"common.tf_utils.BestKeeper",
"common.model_loader.Ckpt",
"sys.exit",
"pathlib.Path",
"tensorflow.global_variables_initializer",
"common.utils.get_logger",
"tensorflow.train.latest_checkpoint"
] | [((570, 586), 'common.utils.get_logger', 'get_logger', (['name'], {}), '(name)\n', (580, 586), False, 'from common.utils import get_logger\n'), ((1289, 1522), 'common.model_loader.Ckpt', 'Ckpt', ([], {'session': 'session', 'include_scopes': 'args.checkpoint_include_scopes', 'exclude_scopes': 'args.checkpoint_exclude_sc... |
from genshi.template import MarkupTemplate
from trac.core import *
from trac.web.chrome import Chrome
from trac.wiki.macros import WikiMacroBase
class GenshiMacro(WikiMacroBase):
def expand_macro(self, formatter, name, text, args):
template = MarkupTemplate(text)
chrome = Chrome(self.env)
... | [
"trac.web.chrome.Chrome",
"genshi.template.MarkupTemplate"
] | [((257, 277), 'genshi.template.MarkupTemplate', 'MarkupTemplate', (['text'], {}), '(text)\n', (271, 277), False, 'from genshi.template import MarkupTemplate\n'), ((295, 311), 'trac.web.chrome.Chrome', 'Chrome', (['self.env'], {}), '(self.env)\n', (301, 311), False, 'from trac.web.chrome import Chrome\n')] |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Hive Colony Framework
# Copyright (c) 2008-2020 Hive Solutions Lda.
#
# This file is part of Hive Colony Framework.
#
# Hive Colony Framework is free software: you can redistribute it and/or modify
# it under the terms of the Apache License as published by the Apach... | [
"colony.Plugin.set_configuration_property",
"scheduler_c.ConsoleScheduler",
"colony.Plugin.unset_configuration_property",
"colony.Plugin.end_load_plugin",
"colony.Plugin.end_unload_plugin",
"colony.unset_configuration_property_method",
"colony.PluginDependency",
"colony.Plugin.load_plugin",
"colony.... | [((4822, 4887), 'colony.set_configuration_property_method', 'colony.set_configuration_property_method', (['"""startup_configuration"""'], {}), "('startup_configuration')\n", (4862, 4887), False, 'import colony\n'), ((5052, 5119), 'colony.unset_configuration_property_method', 'colony.unset_configuration_property_method'... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'D:\SVNzhangy\fast-transfer\src\_sever.ui'
#
# Created by: PyQt4 UI code generator 4.11.4
#
# WARNING! All changes made in this file will be lost!
from PySide import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except Attribut... | [
"PySide.QtCore.QDate",
"PySide.QtGui.QGridLayout",
"PySide.QtGui.QCheckBox",
"PySide.QtCore.QMetaObject.connectSlotsByName",
"PySide.QtGui.QTextBrowser",
"PySide.QtCore.QSize",
"PySide.QtGui.QHBoxLayout",
"PySide.QtGui.QDateTimeEdit",
"PySide.QtCore.QTime",
"PySide.QtGui.QPushButton",
"PySide.Qt... | [((480, 544), 'PySide.QtGui.QApplication.translate', 'QtGui.QApplication.translate', (['context', 'text', 'disambig', '_encoding'], {}), '(context, text, disambig, _encoding)\n', (508, 544), False, 'from PySide import QtCore, QtGui\n'), ((837, 860), 'PySide.QtGui.QGridLayout', 'QtGui.QGridLayout', (['Form'], {}), '(For... |
import json
from aleph.tests.util import TestCase
class DocumentsApiTestCase(TestCase):
def setUp(self):
super(DocumentsApiTestCase, self).setUp()
self.load_fixtures('docs.yaml')
def test_index(self):
res = self.client.get('/api/1/documents')
assert res.status_code == 200, r... | [
"json.dumps"
] | [((3274, 3290), 'json.dumps', 'json.dumps', (['data'], {}), '(data)\n', (3284, 3290), False, 'import json\n'), ((3525, 3541), 'json.dumps', 'json.dumps', (['data'], {}), '(data)\n', (3535, 3541), False, 'import json\n'), ((3968, 3984), 'json.dumps', 'json.dumps', (['data'], {}), '(data)\n', (3978, 3984), False, 'import... |
import numpy as np
import pandas as pd
from os.path import join as oj
import os
import pygsheets
import pandas as pd
import sys
import inspect
from datetime import datetime, timedelta
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(currentdir)
sys.path... | [
"plotly.express.scatter",
"inspect.currentframe",
"os.path.join",
"os.path.dirname",
"numpy.array",
"datetime.datetime.now",
"datetime.datetime.today",
"datetime.timedelta",
"sys.path.append"
] | [((284, 311), 'os.path.dirname', 'os.path.dirname', (['currentdir'], {}), '(currentdir)\n', (299, 311), False, 'import os\n'), ((312, 338), 'sys.path.append', 'sys.path.append', (['parentdir'], {}), '(parentdir)\n', (327, 338), False, 'import sys\n'), ((339, 379), 'sys.path.append', 'sys.path.append', (["(parentdir + '... |
"""
.. module:: cnn_train
:synopsis: Example nuts-ml pipeline for training a MLP on MNIST
"""
import torch
import torch.nn.functional as F
import torch.nn as nn
import torch.optim as optim
import nutsflow as nf
import nutsml as nm
import numpy as np
from nutsml.network import PytorchNetwork
from utils import downl... | [
"numpy.mean",
"utils.load_mnist",
"torch.nn.CrossEntropyLoss",
"nutsml.network.PytorchNetwork",
"nutsflow.Collect",
"nutsml.PlotLines",
"utils.download_mnist",
"torch.cuda.is_available",
"nutsflow.Shuffle",
"nutsflow.PrintProgress",
"torch.nn.Linear",
"nutsml.BuildBatch",
"sklearn.metrics.ac... | [((1856, 1872), 'utils.download_mnist', 'download_mnist', ([], {}), '()\n', (1870, 1872), False, 'from utils import download_mnist, load_mnist\n'), ((1912, 1932), 'utils.load_mnist', 'load_mnist', (['filepath'], {}), '(filepath)\n', (1922, 1932), False, 'from utils import download_mnist, load_mnist\n'), ((1945, 1978), ... |
# Generated by Django 3.1.4 on 2020-12-27 15:03
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Product',
fields=[
('id', models.AutoField(... | [
"django.db.models.FloatField",
"django.db.models.TextField",
"django.db.models.SlugField",
"django.db.models.AutoField",
"django.db.models.ImageField",
"django.db.models.CharField"
] | [((303, 396), '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", (319, 396), False, 'from django.db import migrations, models\... |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import errno
import ... | [
"pants.reporting.plaintext_reporter.PlainTextReporter.Settings",
"pants.reporting.report.Report",
"pants.reporting.plaintext_reporter.PlainTextReporter",
"pants.reporting.reporting_server.ReportingServerManager.get_current_server_pid_and_port",
"os.getenv",
"pants.reporting.report.Report.log_level_from_st... | [((966, 1001), 'os.path.join', 'os.path.join', (['reports_dir', '"""latest"""'], {}), "(reports_dir, 'latest')\n", (978, 1001), False, 'import os\n'), ((1125, 1158), 'os.path.join', 'os.path.join', (['reports_dir', 'run_id'], {}), '(reports_dir, run_id)\n', (1137, 1158), False, 'import os\n'), ((1161, 1181), 'pants.uti... |
"""
All the data sources are scattered around the D drive, this script
organizes it and consolidates it into the "Data" subfolder in the
"Chapter 2 Dune Aspect Ratio" folder.
<NAME>, 5/6/2020
"""
import shutil as sh
import pandas as pd
import numpy as np
import os
# Set the data directory to save files ... | [
"os.path.exists",
"numpy.genfromtxt",
"pandas.read_csv",
"os.path.join",
"os.mkdir",
"shutil.copy",
"pandas.DataFrame",
"numpy.full",
"numpy.loadtxt",
"pandas.concat"
] | [((337, 363), 'os.path.join', 'os.path.join', (['""".."""', '"""Data"""'], {}), "('..', 'Data')\n", (349, 363), False, 'import os\n'), ((426, 501), 'os.path.join', 'os.path.join', (['""".."""', '""".."""', '"""XBeach Modelling"""', '"""Dune Complexity Experiments"""'], {}), "('..', '..', 'XBeach Modelling', 'Dune Compl... |
def end_of_import():
return 0
def end_of_init():
return 0
def end_of_computing():
return 0
import numpy as np
from sklearn.linear_model import LinearRegression
end_of_import()
X = np.array(range(0,100000)).reshape(-1, 1)
# y = 2x + 3
y = np.dot(X, 2) + 3
end_of_init()
reg = LinearRegression().fit(X, y)... | [
"numpy.dot",
"sklearn.linear_model.LinearRegression"
] | [((254, 266), 'numpy.dot', 'np.dot', (['X', '(2)'], {}), '(X, 2)\n', (260, 266), True, 'import numpy as np\n'), ((292, 310), 'sklearn.linear_model.LinearRegression', 'LinearRegression', ([], {}), '()\n', (308, 310), False, 'from sklearn.linear_model import LinearRegression\n')] |
import requests
url = "https://api.korbit.co.kr/v1/ticker/detailed?currency_pair=btc_krw"
r = requests.get(url)
bitcoin = r.json()
print(bitcoin)
print(type(bitcoin))
print(bitcoin['last'])
print(bitcoin['bid'])
print(bitcoin['ask'])
print(bitcoin['volume'])
| [
"requests.get"
] | [((95, 112), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (107, 112), False, 'import requests\n')] |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2018-11-06 01:54
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('myaxf', '0010_minebtns'),
]
operations = [
migrations.AddField(
... | [
"django.db.models.BooleanField"
] | [((390, 423), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(True)'}), '(default=True)\n', (409, 423), False, 'from django.db import migrations, models\n')] |
"""
Utility to get generate all submission pipelines for all primitives.
This script assumes that `generate_annotations.py` has already been run.
"""
import os
import subprocess
import shutil
import fire
from kf_d3m_primitives.data_preprocessing.data_cleaning.data_cleaning_pipeline import DataCleaningPipeline
from... | [
"fire.Fire",
"kf_d3m_primitives.object_detection.retinanet.object_detection_retinanet_pipeline.ObjectDetectionRNPipeline",
"kf_d3m_primitives.data_preprocessing.data_cleaning.data_cleaning_pipeline.DataCleaningPipeline",
"kf_d3m_primitives.clustering.hdbscan.hdbscan_pipeline.HdbscanPipeline",
"kf_d3m_primit... | [((10424, 10453), 'fire.Fire', 'fire.Fire', (['generate_pipelines'], {}), '(generate_pipelines)\n', (10433, 10453), False, 'import fire\n'), ((8809, 8846), 'os.chdir', 'os.chdir', (['f"""/annotations/{primitive}"""'], {}), "(f'/annotations/{primitive}')\n", (8817, 8846), False, 'import os\n'), ((10357, 10391), 'os.syst... |
# Generated by Django 3.2.12 on 2022-02-15 02:57
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='SpotPrice',
fields=[
('id', models.BigAuto... | [
"django.db.models.DateField",
"django.db.models.FloatField",
"django.db.models.CharField",
"django.db.models.BigAutoField"
] | [((306, 402), 'django.db.models.BigAutoField', 'models.BigAutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (325, 402), False, 'from django.db import migrations, m... |
# -*- coding: utf-8 -*-
# Copyright (c) 2021 <NAME>.
# All rights reserved.
# Licensed under BSD-3-Clause-Clear. See LICENSE file for details.
from django.views.generic import View
from django.urls import reverse
from django.http import HttpResponseRedirect
from Functie.rol import Rollen, rol_get_huidige
from .vie... | [
"django.http.HttpResponseRedirect",
"Functie.rol.rol_get_huidige",
"django.urls.reverse"
] | [((598, 622), 'Functie.rol.rol_get_huidige', 'rol_get_huidige', (['request'], {}), '(request)\n', (613, 622), False, 'from Functie.rol import Rollen, rol_get_huidige\n'), ((868, 893), 'django.http.HttpResponseRedirect', 'HttpResponseRedirect', (['url'], {}), '(url)\n', (888, 893), False, 'from django.http import HttpRe... |
import argparse
import os
import csv
import random
from utils import ensure_dir, get_project_path
from collections import defaultdict
# POS-tag for irrelevant tag selection
import nltk
nltk.download('punkt')
nltk.download('averaged_perceptron_tagger')
__author__ = "<NAME>"
def write_tsv(intention_dir_path, filenam... | [
"random.shuffle",
"nltk.download",
"argparse.ArgumentParser",
"csv.writer",
"utils.ensure_dir",
"utils.get_project_path",
"collections.defaultdict",
"csv.reader",
"os.walk"
] | [((187, 209), 'nltk.download', 'nltk.download', (['"""punkt"""'], {}), "('punkt')\n", (200, 209), False, 'import nltk\n'), ((210, 253), 'nltk.download', 'nltk.download', (['"""averaged_perceptron_tagger"""'], {}), "('averaged_perceptron_tagger')\n", (223, 253), False, 'import nltk\n'), ((418, 455), 'csv.writer', 'csv.w... |
###demo code provided by <NAME> at www.steves-internet-guide.com
##email <EMAIL>
###Free to use for any purpose
"""
implements data logging class
"""
import time, os, json, logging
###############
class m_logger(object):
"""Class for logging data to a file. You can set the maximim bunber
of messages i... | [
"json.dumps",
"logging.info",
"os.mkdir",
"os.stat",
"time.time"
] | [((1043, 1054), 'time.time', 'time.time', ([], {}), '()\n', (1052, 1054), False, 'import time, os, json, logging\n'), ((1327, 1338), 'time.time', 'time.time', ([], {}), '()\n', (1336, 1338), False, 'import time, os, json, logging\n'), ((2581, 2632), 'logging.info', 'logging.info', (["('creating log file ' + self.file_n... |
"""
2018 (c) piteren
some little methods (but frequently used) for Python
"""
from collections import OrderedDict
import csv
import inspect
import json
import os
import pickle
import random
import shutil
import string
import time
from typing import List, Callable, Any, Optional
# prepares function parameters... | [
"collections.OrderedDict",
"json.loads",
"pickle.dump",
"random.choice",
"os.makedirs",
"time.strftime",
"pickle.load",
"inspect.getfullargspec",
"shutil.rmtree",
"os.path.isfile",
"os.path.isdir",
"time.time",
"json.load",
"random.random",
"csv.reader",
"json.dump"
] | [((5563, 5602), 'os.makedirs', 'os.makedirs', (['folder_path'], {'exist_ok': '(True)'}), '(folder_path, exist_ok=True)\n', (5574, 5602), False, 'import os\n'), ((426, 439), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (437, 439), False, 'from collections import OrderedDict\n'), ((474, 506), 'inspect.getf... |
#! /usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import unittest
import torch
from botorch.test_functions.michalewicz import (
GLOBAL_MAXIMIZER,
GLOBAL_MAXIMUM,
neg_michalewicz,
)
class TestNegMichalewicz(unittest.TestCase):
def test_single_eval_neg_mic... | [
"botorch.test_functions.michalewicz.neg_michalewicz",
"torch.tensor",
"torch.cuda.is_available",
"torch.Size",
"torch.zeros",
"torch.device"
] | [((791, 816), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (814, 816), False, 'import torch\n'), ((1387, 1412), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (1410, 1412), False, 'import torch\n'), ((2050, 2075), 'torch.cuda.is_available', 'torch.cuda.is_available', ... |
from decimal import Decimal
from typing import List, Any
from common.Enums import SortingType
from models import Message
from .engine import db_engine, DBEngine
class MessageDAO:
def __init__(self, engine: DBEngine):
self.engine = engine
@staticmethod
def __make_insert_values_from_messages_array... | [
"models.Message",
"decimal.Decimal"
] | [((882, 900), 'models.Message', 'Message', ([], {}), '(**message)\n', (889, 900), False, 'from models import Message\n'), ((473, 499), 'decimal.Decimal', 'Decimal', (['message.timestamp'], {}), '(message.timestamp)\n', (480, 499), False, 'from decimal import Decimal\n'), ((1073, 1093), 'decimal.Decimal', 'Decimal', (['... |
#!/usr/bin/python
import socket
import sys
junk = 'A'*500
s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
connect = s.connect(('192.168.129.128',21))
s.recv(1024)
s.send('USER '+junk+'\r\n')
| [
"socket.socket"
] | [((62, 111), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (75, 111), False, 'import socket\n')] |
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.http import urlquote
class ConcreteModel(models.Model):
name = models.CharField(max_length=10)
class ProxyModel(ConcreteModel):
class Meta:
proxy = True
@python_2_unicode_compatible
class F... | [
"django.db.models.CharField",
"django.utils.http.urlquote"
] | [((178, 209), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(10)'}), '(max_length=10)\n', (194, 209), False, 'from django.db import models\n'), ((496, 540), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(30)', 'unique': '(True)'}), '(max_length=30, unique=True)\n', (512... |
from django.http import HttpResponse
from django.utils.deprecation import MiddlewareMixin
class HealthCheckMiddleware:
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request):
if request.META["PATH_INFO"] == "/health-check/":
return HttpRespo... | [
"django.http.HttpResponse"
] | [((311, 329), 'django.http.HttpResponse', 'HttpResponse', (['"""ok"""'], {}), "('ok')\n", (323, 329), False, 'from django.http import HttpResponse\n')] |
import random
from contextlib import suppress
from typing import Optional
from discord import AllowedMentions, Embed, Forbidden
from discord.ext import commands
from bot.constants import Cats, Colours, NEGATIVE_REPLIES
from bot.utils import helpers
class Catify(commands.Cog):
"""Cog for the catify command."""
... | [
"random.choice",
"discord.AllowedMentions.none",
"contextlib.suppress",
"discord.ext.commands.cooldown",
"discord.ext.commands.command",
"random.randint"
] | [((392, 435), 'discord.ext.commands.command', 'commands.command', ([], {'aliases': "['ᓚᘏᗢify', 'ᓚᘏᗢ']"}), "(aliases=['ᓚᘏᗢify', 'ᓚᘏᗢ'])\n", (408, 435), False, 'from discord.ext import commands\n'), ((441, 490), 'discord.ext.commands.cooldown', 'commands.cooldown', (['(1)', '(5)', 'commands.BucketType.user'], {}), '(1, 5... |
import os
import data_utils
from pathlib import Path
top_path = Path(os.path.dirname(os.path.abspath(__file__)))
EBM_NLP = Path('/Users/ben/Desktop/ebm_nlp/repo/ebm_nlp_2_00/')
NO_LABEL = '0'
def overwrite_tags(new_tags, tags):
for i, t in enumerate(new_tags):
if t != NO_LABEL:
tags[i] = t
def get_tags(d... | [
"os.path.abspath",
"data_utils.generate_seqs",
"pathlib.Path"
] | [((124, 177), 'pathlib.Path', 'Path', (['"""/Users/ben/Desktop/ebm_nlp/repo/ebm_nlp_2_00/"""'], {}), "('/Users/ben/Desktop/ebm_nlp/repo/ebm_nlp_2_00/')\n", (128, 177), False, 'from pathlib import Path\n'), ((1145, 1159), 'pathlib.Path', 'Path', (['"""train/"""'], {}), "('train/')\n", (1149, 1159), False, 'from pathlib ... |
#
#
# Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
# 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
#
# www.apache.org/lice... | [
"struct.pack",
"numpy.exp",
"numpy.array",
"numpy.linspace",
"numpy.empty",
"numpy.cos",
"numpy.sin",
"numpy.transpose",
"sympy.combinatorics.Permutation.from_sequence"
] | [((4077, 4095), 'numpy.transpose', 'np.transpose', (['a', 'r'], {}), '(a, r)\n', (4089, 4095), True, 'import numpy as np\n'), ((4688, 4698), 'numpy.cos', 'np.cos', (['(-a)'], {}), '(-a)\n', (4694, 4698), True, 'import numpy as np\n'), ((4705, 4715), 'numpy.sin', 'np.sin', (['(-a)'], {}), '(-a)\n', (4711, 4715), True, '... |
'''
This inference script takes in images of dynamic size
Runs inference in batch
** In this images have been resized but not need for this script
'''
import onnx
import onnxruntime as ort
import numpy as np
import cv2
from imagenet_classlist import get_class
import os
model_path = 'resnet18.onnx'
model = onnx.load(... | [
"os.listdir",
"onnx.helper.printable_graph",
"onnxruntime.InferenceSession",
"os.path.join",
"numpy.argmax",
"numpy.array",
"onnx.load",
"numpy.moveaxis",
"cv2.resize",
"onnx.checker.check_model"
] | [((310, 331), 'onnx.load', 'onnx.load', (['model_path'], {}), '(model_path)\n', (319, 331), False, 'import onnx\n'), ((405, 436), 'onnx.checker.check_model', 'onnx.checker.check_model', (['model'], {}), '(model)\n', (429, 436), False, 'import onnx\n'), ((441, 481), 'onnx.helper.printable_graph', 'onnx.helper.printable_... |
from .functions1 import my_sum, factorial
from .constants import pi
from .print import myprint
from pkg_resources import get_distribution, DistributionNotFound
try:
__version__ = get_distribution(__name__).version
except DistributionNotFound:
# package is not installed
pass
| [
"pkg_resources.get_distribution"
] | [((183, 209), 'pkg_resources.get_distribution', 'get_distribution', (['__name__'], {}), '(__name__)\n', (199, 209), False, 'from pkg_resources import get_distribution, DistributionNotFound\n')] |
# -*- coding: utf-8 -*-
import sys
import pytest
from snake.common import Frame, Point, BoundaryCollision, SelfCollision
from snake.config import GameConfig
from snake.model import SnakeModel
@pytest.fixture
def config():
config = GameConfig()
config.solid_walls = True
config.initial_food_count = 0
... | [
"snake.common.Frame",
"snake.model.SnakeModel",
"snake.common.Point",
"snake.config.GameConfig",
"pytest.raises",
"pytest.mark.skipif"
] | [((240, 252), 'snake.config.GameConfig', 'GameConfig', ([], {}), '()\n', (250, 252), False, 'from snake.config import GameConfig\n'), ((452, 465), 'snake.common.Frame', 'Frame', (['(10)', '(10)'], {}), '(10, 10)\n', (457, 465), False, 'from snake.common import Frame, Point, BoundaryCollision, SelfCollision\n'), ((474, ... |
import numpy as np
import tensorflow as tf
from tqdm import trange
from fedsimul.utils.model_utils import batch_data
from fedsimul.utils.tf_utils import graph_size
from fedsimul.utils.tf_utils import process_grad
class Model(object):
'''
This is the tf model for the MNIST dataset with multiple class learner ... | [
"tensorflow.equal",
"tensorflow.contrib.layers.l2_regularizer",
"tensorflow.nn.softmax",
"tensorflow.set_random_seed",
"tensorflow.RunMetadata",
"tensorflow.Graph",
"tensorflow.Session",
"tensorflow.placeholder",
"fedsimul.utils.model_utils.batch_data",
"tensorflow.train.get_global_step",
"tenso... | [((751, 761), 'tensorflow.Graph', 'tf.Graph', ([], {}), '()\n', (759, 761), True, 'import tensorflow as tf\n'), ((1331, 1380), 'tensorflow.compat.v1.ConfigProto', 'tf.compat.v1.ConfigProto', ([], {'gpu_options': 'gpu_options'}), '(gpu_options=gpu_options)\n', (1355, 1380), True, 'import tensorflow as tf\n'), ((1401, 14... |
""" Runs the server """
from aaxus import app
app.run()
| [
"aaxus.app.run"
] | [((47, 56), 'aaxus.app.run', 'app.run', ([], {}), '()\n', (54, 56), False, 'from aaxus import app\n')] |
import argparse
import logging
import math
from pathlib import Path
import torch.multiprocessing as mp
import os
from datetime import datetime
import nltk
import pandas as pd
import transformers
from torch import nn
import torch.distributed
from torch._C._distributed_c10d import HashStore
from torch.utils.data import... | [
"logging.getLogger",
"sentence_transformers.BiEncoder",
"argparse.ArgumentParser",
"pandas.read_csv",
"os.putenv",
"tqdm.tqdm",
"sentence_transformers.LoggingHandler",
"datetime.datetime.now",
"eval_agritrop.create_evaluator",
"torch.utils.data.DataLoader",
"sentence_transformers.InputExampleDoc... | [((863, 906), 'os.putenv', 'os.putenv', (['"""TOKENIZERS_PARALLELISM"""', '"""true"""'], {}), "('TOKENIZERS_PARALLELISM', 'true')\n", (872, 906), False, 'import os\n'), ((917, 944), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (934, 944), False, 'import logging\n'), ((1026, 1124), 'argp... |
# -*- coding: utf-8 -*-
import time, random
def isort(i_list):
for i in range(1, len(i_list)):
for j in range(i,0, -1):
if i_list[j] < i_list[j-1]:
i_list[j], i_list[j-1] = i_list[j-1], i_list[j]
else:
break
if __name__ == "__main__":
alist = []
... | [
"time.time",
"random.randint"
] | [((409, 420), 'time.time', 'time.time', ([], {}), '()\n', (418, 420), False, 'import time, random\n'), ((453, 464), 'time.time', 'time.time', ([], {}), '()\n', (462, 464), False, 'import time, random\n'), ((368, 390), 'random.randint', 'random.randint', (['(1)', '(100)'], {}), '(1, 100)\n', (382, 390), False, 'import t... |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import os
import math
import networkx as nx
import functools
import scipy.stats
import random
import sys
import copy
import numpy as np
import torch
import utils
try:
sys.path.append('/opt/MatterSim/build/') # local docker or Philly
im... | [
"networkx.all_pairs_dijkstra_path",
"os.getenv",
"MatterSim.Simulator",
"utils.load_nav_graphs",
"numpy.argmax",
"math.radians",
"functools.partial",
"math.atan2",
"sys.exit",
"networkx.all_pairs_dijkstra_path_length",
"sys.path.append"
] | [((247, 287), 'sys.path.append', 'sys.path.append', (['"""/opt/MatterSim/build/"""'], {}), "('/opt/MatterSim/build/')\n", (262, 287), False, 'import sys\n'), ((375, 433), 'sys.path.append', 'sys.path.append', (['"""/home/hoyeung/Documents/vnla/code/build"""'], {}), "('/home/hoyeung/Documents/vnla/code/build')\n", (390,... |
import tensorflow as tf
import numpy as np
import unittest
from dnc.controller import BaseController
class DummyController(BaseController):
def network_vars(self):
self.W = tf.Variable(tf.truncated_normal([self.nn_input_size, 64]))
self.b = tf.Variable(tf.zeros([64]))
def network_op(self, X):... | [
"tensorflow.Graph",
"tensorflow.initialize_all_variables",
"numpy.reshape",
"numpy.allclose",
"tensorflow.nn.rnn_cell.BasicLSTMCell",
"tensorflow.convert_to_tensor",
"tensorflow.Session",
"numpy.exp",
"tensorflow.matmul",
"numpy.random.uniform",
"unittest.main",
"numpy.transpose",
"tensorflo... | [((7097, 7123), 'unittest.main', 'unittest.main', ([], {'verbosity': '(2)'}), '(verbosity=2)\n', (7110, 7123), False, 'import unittest\n'), ((469, 501), 'tensorflow.nn.rnn_cell.BasicLSTMCell', 'tf.nn.rnn_cell.BasicLSTMCell', (['(64)'], {}), '(64)\n', (497, 501), True, 'import tensorflow as tf\n'), ((718, 741), 'tensorf... |
# -*- coding: utf-8 -*-
from scrapy.linkextractors import LinkExtractor
from scrapy.loader import ItemLoader
from scrapy.loader.processors import Join, MapCompose
from scrapy.spiders import CrawlSpider, Rule
from movies.items import MoviesItem
class DoubanSpider(CrawlSpider):
name = 'douban'
allowed_domains ... | [
"scrapy.linkextractors.LinkExtractor",
"scrapy.loader.processors.MapCompose",
"movies.items.MoviesItem",
"scrapy.loader.processors.Join"
] | [((418, 478), 'scrapy.linkextractors.LinkExtractor', 'LinkExtractor', ([], {'restrict_xpaths': '"""//*[contains(@rel, "next")]"""'}), '(restrict_xpaths=\'//*[contains(@rel, "next")]\')\n', (431, 478), False, 'from scrapy.linkextractors import LinkExtractor\n'), ((494, 555), 'scrapy.linkextractors.LinkExtractor', 'LinkE... |
import json
import os
import shutil
import urllib.request
import traceback
import logging
import psutil
from collections import defaultdict
from typing import List, Dict, Tuple
from multiprocessing import Semaphore, Pool
from subprocess import Popen, PIPE
from datetime import datetime, timedelta
from lxml import etree... | [
"psutil.virtual_memory",
"lxml.etree.iterparse",
"pyarrow.parquet.ParquetWriter",
"datetime.timedelta",
"os.remove",
"os.path.exists",
"subprocess.Popen",
"diachronic.global_conf.get_output_prefix",
"os.getpid",
"pyarrow.array",
"shutil.copyfileobj",
"logging.basicConfig",
"google.cloud.stor... | [((673, 716), 'multiprocessing.Semaphore', 'Semaphore', (['global_conf.download_parallelism'], {}), '(global_conf.download_parallelism)\n', (682, 716), False, 'from multiprocessing import Semaphore, Pool\n'), ((524, 542), 'psutil.cpu_count', 'psutil.cpu_count', ([], {}), '()\n', (540, 542), False, 'import psutil\n'), (... |
import inspect
import pytest
import numpy as np
from datar.core.backends.pandas import Categorical, DataFrame, Series
from datar.core.backends.pandas.testing import assert_frame_equal
from datar.core.backends.pandas.core.groupby import SeriesGroupBy
from datar.core.factory import func_factory
from datar.core.tibble im... | [
"datar.tibble.tibble",
"inspect.signature",
"datar.core.backends.pandas.testing.assert_frame_equal",
"datar.core.backends.pandas.DataFrame",
"numpy.array",
"datar.core.backends.pandas.Categorical",
"pytest.raises",
"datar.core.backends.pandas.Series",
"datar.core.factory.func_factory"
] | [((524, 554), 'datar.core.factory.func_factory', 'func_factory', (['"""transform"""', '"""x"""'], {}), "('transform', 'x')\n", (536, 554), False, 'from datar.core.factory import func_factory\n'), ((744, 774), 'datar.core.factory.func_factory', 'func_factory', (['"""transform"""', '"""x"""'], {}), "('transform', 'x')\n"... |
import os
import rasterio
import argparse
from PIL import Image
import subprocess
import pathlib
import shutil
from glob import glob
from numba import njit, prange
from OpenVisus import *
### Configuration
ext_name = ".tif"
dtype = "uint8[3]"
limit = 1000
###--------------
@njit(parallel=True)
def... | [
"os.listdir",
"PIL.Image.open",
"argparse.ArgumentParser",
"pathlib.Path",
"glob.glob.glob",
"rasterio.open",
"subprocess.run",
"numba.njit",
"os.getcwd",
"os.path.basename",
"os.path.abspath",
"numba.prange"
] | [((296, 315), 'numba.njit', 'njit', ([], {'parallel': '(True)'}), '(parallel=True)\n', (300, 315), False, 'from numba import njit, prange\n'), ((698, 757), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Parse set of geotiff"""'}), "(description='Parse set of geotiff')\n", (721, 757), Fal... |
#!/usr/bin/env python3
"""
Created on Tue Sep 1 2020
@author: kstoreyf
"""
import numpy as np
import nbodykit
import pandas as pd
import pickle
from nbodykit import cosmology
def main():
save_fn = '../data/cosmology_train.pickle'
x = generate_training_parameters(n_train=1000)
y, extra_input = generate_... | [
"nbodykit.cosmology.correlation.CorrelationFunction",
"pickle.dump",
"numpy.random.rand",
"nbodykit.cosmology.Cosmology",
"numpy.array",
"numpy.linspace",
"nbodykit.cosmology.LinearPower",
"pandas.DataFrame",
"numpy.meshgrid",
"numpy.arange"
] | [((1335, 1368), 'numpy.linspace', 'np.linspace', (['(0.26)', '(0.34)', 'n_points'], {}), '(0.26, 0.34, n_points)\n', (1346, 1368), True, 'import numpy as np\n'), ((1383, 1415), 'numpy.linspace', 'np.linspace', (['(0.7)', '(0.95)', 'n_points'], {}), '(0.7, 0.95, n_points)\n', (1394, 1415), True, 'import numpy as np\n'),... |
# Copyright 2020 <NAME>
#
# 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 use, copy, modify, merge, publish, distribute... | [
"os.listdir",
"urllib.request.urlretrieve",
"pathlib.Path",
"subprocess.run",
"os.path.join",
"os.environ.copy",
"uuid.uuid4",
"os.path.isfile",
"fnmatch.fnmatch",
"shutil.copy",
"logging.info",
"os.walk"
] | [((2102, 2178), 'logging.info', 'logging.info', (["('Deploying: %s => %s' % (apprun_path, self.app_dir / 'AppRun'))"], {}), "('Deploying: %s => %s' % (apprun_path, self.app_dir / 'AppRun'))\n", (2114, 2178), False, 'import logging\n'), ((2187, 2231), 'shutil.copy', 'shutil.copy', (['apprun_path', 'apprun_deploy_path'],... |
import os
import yaml
import copy
import logging
from pathlib import Path
import torch
from torch.nn import *
from torch.optim import *
import torch.distributed as dist
from torch.optim.lr_scheduler import *
from torch.nn.parallel import DistributedDataParallel
from utils.metrics import *
from models import _get_mode... | [
"logging.getLogger",
"logging.StreamHandler",
"torch.distributed.get_rank",
"pathlib.Path",
"torch.nn.parallel.DistributedDataParallel",
"yaml.safe_load",
"logging.FileHandler",
"copy.deepcopy",
"torch.cuda.set_device",
"torch.cuda.empty_cache",
"models._get_model",
"torch.distributed.get_worl... | [((4679, 4706), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (4696, 4706), False, 'import logging\n'), ((4760, 4783), 'logging.StreamHandler', 'logging.StreamHandler', ([], {}), '()\n', (4781, 4783), False, 'import logging\n'), ((4803, 4833), 'logging.FileHandler', 'logging.FileHandler'... |
from graph_peak_caller.multiplegraphscallpeaks import MultipleGraphsCallpeaks
from graph_peak_caller.intervals import Intervals
from graph_peak_caller import Configuration
from graph_peak_caller.reporter import Reporter
from offsetbasedgraph import GraphWithReversals as Graph, \
DirectedInterval, IntervalCollection... | [
"offsetbasedgraph.IntervalCollection.create_list_from_file",
"offsetbasedgraph.Interval",
"graph_peak_caller.reporter.Reporter",
"graph_peak_caller.Configuration",
"offsetbasedgraph.Block",
"graph_peak_caller.logging_config.set_logging_config",
"offsetbasedgraph.DirectedInterval",
"os.path.isfile",
... | [((7169, 7184), 'unittest.main', 'unittest.main', ([], {}), '()\n', (7182, 7184), False, 'import unittest\n'), ((1570, 1585), 'graph_peak_caller.Configuration', 'Configuration', ([], {}), '()\n', (1583, 1585), False, 'from graph_peak_caller import Configuration\n'), ((1802, 1826), 'graph_peak_caller.reporter.Reporter',... |
import copy
import numpy as np
import torch
from pytorch_lightning.utilities import rank_zero_warn
from pytorch_lightning.callbacks import Callback
class BestEpochCallback(Callback):
TORCH_INF = torch_inf = torch.tensor(np.Inf)
MODE_DICT = {
"min": (torch_inf, "min"),
"max": (-torch_inf, "max"... | [
"torch.tensor",
"copy.copy",
"pytorch_lightning.utilities.rank_zero_warn"
] | [((213, 233), 'torch.tensor', 'torch.tensor', (['np.Inf'], {}), '(np.Inf)\n', (225, 233), False, 'import torch\n'), ((1742, 1777), 'copy.copy', 'copy.copy', (['trainer.callback_metrics'], {}), '(trainer.callback_metrics)\n', (1751, 1777), False, 'import copy\n'), ((744, 855), 'pytorch_lightning.utilities.rank_zero_warn... |
import tensorflow as tf
import tensorflow_hub as hub
from tf_agents.networks import network
# Bert needs this (I think) TODO: Check?
import tensorflow_text as text
embedding = "https://tfhub.dev/google/nnlm-en-dim128-with-normalization/2"
tfhub_handle_encoder = (
"https://tfhub.dev/tensorflow/small_bert/bert_en_u... | [
"tensorflow.keras.layers.Dropout",
"tensorflow.add",
"tensorflow.keras.layers.BatchNormalization",
"tensorflow.keras.layers.Dense",
"tensorflow.reshape",
"tensorflow_hub.KerasLayer",
"tensorflow.math.reduce_sum"
] | [((900, 974), 'tensorflow_hub.KerasLayer', 'hub.KerasLayer', (['embedding'], {'input_shape': '[]', 'dtype': 'tf.string', 'trainable': '(True)'}), '(embedding, input_shape=[], dtype=tf.string, trainable=True)\n', (914, 974), True, 'import tensorflow_hub as hub\n'), ((1053, 1098), 'tensorflow.keras.layers.Dense', 'tf.ker... |
import threading
import time
import RPi.GPIO as GPIO
import logging
import logging.config
# declare logger parameters
logger = logging.getLogger(__name__)
class PWMController(threading.Thread):
""" Thread class with a stop() method.
Handy class to implement PWM on digital output pins """
def __init_... | [
"logging.getLogger",
"threading.Thread.__init__",
"RPi.GPIO.output",
"time.sleep",
"threading.Event"
] | [((128, 155), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (145, 155), False, 'import logging\n'), ((372, 403), 'threading.Thread.__init__', 'threading.Thread.__init__', (['self'], {}), '(self)\n', (397, 403), False, 'import threading\n'), ((562, 579), 'threading.Event', 'threading.Even... |
import math
a = float(input('insira um valor'))
print('a porção inteira do valor {} é {}'.format(a,math.trunc(a))) | [
"math.trunc"
] | [((103, 116), 'math.trunc', 'math.trunc', (['a'], {}), '(a)\n', (113, 116), False, 'import math\n')] |
#from data_loader import *
from scipy import signal
import matplotlib.pyplot as plt
import copy
import os
import shutil
import numpy as np
def data_filter(exp_path, probe_type='point', Xtype='loc',ytype='f',num_point=0):
shutil.rmtree(exp_path+probe_type+'_expand', ignore_errors=True)
os.mkdir(exp_path+probe_t... | [
"numpy.hstack",
"scipy.signal.filtfilt",
"scipy.signal.butter",
"numpy.array",
"os.mkdir",
"shutil.rmtree",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((5134, 5144), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (5142, 5144), True, 'import matplotlib.pyplot as plt\n'), ((226, 294), 'shutil.rmtree', 'shutil.rmtree', (["(exp_path + probe_type + '_expand')"], {'ignore_errors': '(True)'}), "(exp_path + probe_type + '_expand', ignore_errors=True)\n", (239, 294)... |
# Copyright (c) 2012 by Zuse-Institute Berlin and the Technical University of Denmark.
#
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the authors be held liable for any damages
# arising from the use of this software.
#
# Permission is granted to anyone to use this so... | [
"os.path.exists",
"sys.path.insert",
"data.CBFset.CBFset",
"inspect.currentframe",
"os.path.join",
"os.path.isfile",
"os.path.dirname",
"os.path.basename",
"sys.exit",
"getopt.gnu_getopt",
"os.path.relpath"
] | [((1775, 1810), 'os.path.join', 'os.path.join', (['scriptdir', '""".."""', '""".."""'], {}), "(scriptdir, '..', '..')\n", (1787, 1810), False, 'import os, sys, inspect\n'), ((2007, 2015), 'data.CBFset.CBFset', 'CBFset', ([], {}), '()\n', (2013, 2015), False, 'from data.CBFset import CBFset\n'), ((1243, 1273), 'sys.path... |
from copy import deepcopy
import os
import re
from PyQt5.QtWidgets import *
from PyQt5 import QtCore, QtGui
from GUI.Visualization import Ui_Visualization
from FAE.FeatureAnalysis.Classifier import *
from FAE.FeatureAnalysis.FeaturePipeline import FeatureAnalysisPipelines, OnePipeline
from FAE.Description.Description... | [
"os.path.exists",
"os.listdir",
"FAE.FeatureAnalysis.FeaturePipeline.FeatureAnalysisPipelines",
"FAE.Description.Description.Description",
"os.path.join",
"os.path.split",
"os.path.normpath",
"FAE.FeatureAnalysis.FeaturePipeline.OnePipeline",
"re.findall",
"os.walk"
] | [((732, 758), 'FAE.FeatureAnalysis.FeaturePipeline.FeatureAnalysisPipelines', 'FeatureAnalysisPipelines', ([], {}), '()\n', (756, 758), False, 'from FAE.FeatureAnalysis.FeaturePipeline import FeatureAnalysisPipelines, OnePipeline\n'), ((7706, 7732), 'FAE.FeatureAnalysis.FeaturePipeline.FeatureAnalysisPipelines', 'Featu... |
# Copyright 2017 <NAME> <<EMAIL>>
#
# 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 writin... | [
"bookstore.models.Rating",
"random.choice",
"random.randint",
"bookstore.models.Book.objects.all"
] | [((1495, 1513), 'bookstore.models.Book.objects.all', 'Book.objects.all', ([], {}), '()\n', (1511, 1513), False, 'from bookstore.models import Book, Rating\n'), ((1533, 1553), 'random.choice', 'random.choice', (['books'], {}), '(books)\n', (1546, 1553), False, 'import random\n'), ((1573, 1593), 'random.randint', 'random... |
# Copyright (c) 2021, Fruiti Limited
# 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 datetime import datetime
def convert_custom_timestamp_range(timestamp_range: str) -> list:
result = timestamp_range.s... | [
"datetime.datetime.fromisoformat"
] | [((554, 590), 'datetime.datetime.fromisoformat', 'datetime.fromisoformat', (['iso_datetime'], {}), '(iso_datetime)\n', (576, 590), False, 'from datetime import datetime\n')] |
import numpy as np
import cv2
import argparse
from collections import deque
import keyboard as kb
import time
from pynput.keyboard import Key, Controller, Listener
class points(object):
def __init__(self, x, y):
self.x = x
self.y = y
sm_threshold = 100
lg_threshold = 200
guiding = True
keyboar... | [
"cv2.imshow",
"numpy.array",
"cv2.destroyAllWindows",
"collections.deque",
"cv2.erode",
"cv2.line",
"cv2.waitKey",
"numpy.ones",
"cv2.minEnclosingCircle",
"keyboard.is_pressed",
"cv2.morphologyEx",
"cv2.circle",
"cv2.cvtColor",
"cv2.moments",
"pynput.keyboard.Controller",
"cv2.inRange"... | [((324, 336), 'pynput.keyboard.Controller', 'Controller', ([], {}), '()\n', (334, 336), False, 'from pynput.keyboard import Key, Controller, Listener\n'), ((344, 363), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (360, 363), False, 'import cv2\n'), ((371, 387), 'collections.deque', 'deque', ([], {'ma... |
import re
data = open('regex_sum_46353.txt')
numlist = list()
for line in data:
line = line.rstrip()
integers = re.findall('[0-9]+', line)
if len(integers) < 1: continue
for i in range(len(integers)):
num = float(integers[i])
numlist.append(num)
num_sum = sum(numlist)
print (num_sum)
| [
"re.findall"
] | [((120, 146), 're.findall', 're.findall', (['"""[0-9]+"""', 'line'], {}), "('[0-9]+', line)\n", (130, 146), False, 'import re\n')] |
import json
import time
import datetime
import string
import calendar
from helpers import get_cpu_temp, check_login, password_hash
import web
import gv # Gain access to ospi's settings
from urls import urls # Gain access to ospi's URL list
from webpages import ProtectedPage, WebPage
##############
## N... | [
"urls.urls.extend",
"helpers.get_cpu_temp",
"datetime.datetime.fromtimestamp",
"json.loads",
"helpers.password_hash",
"datetime.datetime.strptime",
"string.split",
"json.dumps",
"helpers.check_login",
"web.input",
"datetime.timedelta",
"time.time",
"web.header"
] | [((334, 653), 'urls.urls.extend', 'urls.extend', (["['/jo', 'plugins.mobile_app.options', '/jc',\n 'plugins.mobile_app.cur_settings', '/js',\n 'plugins.mobile_app.station_state', '/jp',\n 'plugins.mobile_app.program_info', '/jn',\n 'plugins.mobile_app.station_info', '/jl', 'plugins.mobile_app.get_logs',\n ... |
# -*- coding: utf-8 -*-
# import json
from tibanna_ffcommon.exceptions import exception_coordinator
from tibanna_cgap.start_run import start_run
from tibanna_cgap.vars import AWS_REGION, LAMBDA_TYPE
config = {
'function_name': 'start_run_' + LAMBDA_TYPE,
'function_module': 'service',
'function_handler': '... | [
"tibanna_ffcommon.exceptions.exception_coordinator",
"tibanna_cgap.start_run.start_run"
] | [((757, 806), 'tibanna_ffcommon.exceptions.exception_coordinator', 'exception_coordinator', (['"""start_run"""', 'metadata_only'], {}), "('start_run', metadata_only)\n", (778, 806), False, 'from tibanna_ffcommon.exceptions import exception_coordinator\n'), ((1051, 1067), 'tibanna_cgap.start_run.start_run', 'start_run',... |
# from https://github.com/django-extensions/django-extensions/blob/master/run_tests.py
from django.conf import settings
from django.core.management import call_command
def main():
# Dynamically configure the Django settings with the minimum necessary to
# get Django running tests
settings.configure(
... | [
"django.core.management.call_command",
"django.conf.settings.configure"
] | [((295, 722), 'django.conf.settings.configure', 'settings.configure', ([], {'INSTALLED_APPS': "('django.contrib.auth', 'django.contrib.contenttypes',\n 'django.contrib.admin', 'django.contrib.sessions', 'ajaxuploader')", 'DATABASE_ENGINE': '"""django.db.backends.sqlite3"""', 'DATABASES': "{'default': {'ENGINE': 'dja... |
#!/usr/bin/env python3
"""Simulation of Shor's algorithm for integer factorization."""
import cmath
import math
import numpy as np
import random
class QuMem:
"""Representation of the memory of the quantum computer."""
def __init__(self, t, n):
"""Initialize the memory. For Shor's algorithm we have t... | [
"math.floor",
"math.gcd",
"math.sqrt",
"math.log",
"cmath.exp",
"random.randint"
] | [((3073, 3106), 'cmath.exp', 'cmath.exp', (['(2 * math.pi * 1.0j / N)'], {}), '(2 * math.pi * 1.0j / N)\n', (3082, 3106), False, 'import cmath\n'), ((3544, 3557), 'math.floor', 'math.floor', (['y'], {}), '(y)\n', (3554, 3557), False, 'import math\n'), ((3923, 3942), 'math.log', 'math.log', (['(N ** 2)', '(2)'], {}), '(... |
import os
import cv2
from WordSegmentation import wordSegmentation, prepareImg
import json
import editdistance
from path import Path
from DataLoaderIAM import DataLoaderIAM, Batch
from Model import Model, DecoderType
from SamplePreprocessor import preprocess
import argparse
import tensorflow as tf
class FilePaths:
... | [
"cv2.rectangle",
"cv2.imwrite",
"os.listdir",
"DataLoaderIAM.Batch",
"os.path.dirname",
"WordSegmentation.wordSegmentation",
"tensorflow.compat.v1.reset_default_graph",
"cv2.imread"
] | [((708, 726), 'DataLoaderIAM.Batch', 'Batch', (['None', '[img]'], {}), '(None, [img])\n', (713, 726), False, 'from DataLoaderIAM import DataLoaderIAM, Batch\n'), ((1128, 1161), 'os.listdir', 'os.listdir', (['"""D:/SimpleHTR/input/"""'], {}), "('D:/SimpleHTR/input/')\n", (1138, 1161), False, 'import os\n'), ((640, 679),... |
#!/usr/bin/env python
"""
Module for holding information about an audio file and doing basic conversions
"""
import hashlib
import logging
import os
import subprocess
from asrtoolkit.file_utils.name_cleaners import (
generate_segmented_file_name,
sanitize_hyphens,
strip_extension,
)
from asrtoolkit.file_u... | [
"logging.getLogger",
"os.path.exists",
"asrtoolkit.file_utils.name_cleaners.generate_segmented_file_name",
"asrtoolkit.file_utils.script_input_validation.valid_input_file",
"os.makedirs",
"asrtoolkit.file_utils.name_cleaners.strip_extension",
"asrtoolkit.file_utils.name_cleaners.sanitize_hyphens",
"os... | [((383, 402), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (400, 402), False, 'import logging\n'), ((1332, 1403), 'asrtoolkit.file_utils.script_input_validation.valid_input_file', 'valid_input_file', (['source_audio_file', "['mp3', 'sph', 'wav', 'au', 'raw']"], {}), "(source_audio_file, ['mp3', 'sph', 'w... |
from flask.ext.wtf import Form
from wtforms import (
TextField, IntegerField, HiddenField, SubmitField, validators
)
class MonkeyForm(Form):
id = HiddenField()
name = TextField('Name', validators=[validators.InputRequired()])
age = IntegerField(
'Age', validators=[
validators.Input... | [
"wtforms.validators.NumberRange",
"wtforms.validators.Email",
"wtforms.SubmitField",
"wtforms.HiddenField",
"wtforms.validators.InputRequired"
] | [((156, 169), 'wtforms.HiddenField', 'HiddenField', ([], {}), '()\n', (167, 169), False, 'from wtforms import TextField, IntegerField, HiddenField, SubmitField, validators\n'), ((552, 573), 'wtforms.SubmitField', 'SubmitField', (['"""Submit"""'], {}), "('Submit')\n", (563, 573), False, 'from wtforms import TextField, I... |
import os
import shutil
import tensorflow as tf
from tensorflow import keras
from logs import logDecorator as lD
import jsonref
import numpy as np
import pickle
import warnings
from tqdm import tqdm
from modules.data import getData
config = jsonref.load(open('../config/config.json'))
logBase = config['logg... | [
"logs.logDecorator.log",
"modules.data.getData.visualiseStackedArray",
"tensorflow.keras.applications.xception.Xception",
"tensorflow.keras.applications.nasnet.NASNetMobile",
"os.path.exists",
"tensorflow.Session",
"tensorflow.keras.applications.mobilenet.MobileNet",
"tensorflow.keras.applications.vgg... | [((479, 512), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (502, 512), False, 'import warnings\n'), ((515, 541), 'logs.logDecorator.log', 'lD.log', (["(logBase + '.model')"], {}), "(logBase + '.model')\n", (521, 541), True, 'from logs import logDecorator as lD\n'), ((253... |