code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import wx
import os
import lib.elements as elements
LOGRX = wx.NewEventType()
EVT_LOGRX = wx.PyEventBinder(LOGRX, 0)
class LogRxEvent(wx.PyCommandEvent):
"""
Remote Log Event handler, for displaying logs in the daskboard console
"""
eventType = LOGRX
def __init__(self, windowID, data):
wx... | [
"wx.NewEventType",
"lib.elements.LOG_CONSOLE.GetValue",
"os.path.join",
"os.getcwd",
"wx.PyEventBinder",
"wx.PyCommandEvent.__init__",
"lib.elements.LOG_CONSOLE.AppendText"
] | [((62, 79), 'wx.NewEventType', 'wx.NewEventType', ([], {}), '()\n', (77, 79), False, 'import wx\n'), ((92, 118), 'wx.PyEventBinder', 'wx.PyEventBinder', (['LOGRX', '(0)'], {}), '(LOGRX, 0)\n', (108, 118), False, 'import wx\n'), ((632, 668), 'lib.elements.LOG_CONSOLE.AppendText', 'elements.LOG_CONSOLE.AppendText', (['ms... |
from django.db.models import QuerySet
from django.db.models.deletion import Collector
from django.utils import six
from . import (create_history_record,
close_active_records,
insert_history_records,
get_transaction_start_ts,
TimeTravelDBModException,
... | [
"django.utils.six.iteritems"
] | [((3484, 3508), 'django.utils.six.iteritems', 'six.iteritems', (['self.data'], {}), '(self.data)\n', (3497, 3508), False, 'from django.utils import six\n'), ((3701, 3734), 'django.utils.six.iteritems', 'six.iteritems', (['self.field_updates'], {}), '(self.field_updates)\n', (3714, 3734), False, 'from django.utils impor... |
import os
class Config(object):
ENABLE_USER_REGISTRATION = \
(os.getenv("ENABLE_USER_REGISTRATION").lower() == "true")
| [
"os.getenv"
] | [((76, 113), 'os.getenv', 'os.getenv', (['"""ENABLE_USER_REGISTRATION"""'], {}), "('ENABLE_USER_REGISTRATION')\n", (85, 113), False, 'import os\n')] |
"""High level parallel chip-seq analysis
"""
import os
import copy
import toolz as tz
from bcbio.log import logger
from bcbio import utils
from bcbio.pipeline import config_utils
from bcbio.pipeline import datadict as dd
from bcbio.provenance import do
from bcbio.distributed.transaction import file_transaction
def g... | [
"bcbio.pipeline.datadict.get_work_dir",
"bcbio.utils.file_exists",
"bcbio.pipeline.datadict.get_peakcaller",
"bcbio.pipeline.datadict.get_work_bam",
"bcbio.pipeline.config_utils.get_program",
"bcbio.utils.append_stem",
"bcbio.pipeline.datadict.get_sample_name",
"bcbio.log.logger.info",
"bcbio.pipeli... | [((1383, 1404), 'bcbio.pipeline.datadict.get_work_bam', 'dd.get_work_bam', (['data'], {}), '(data)\n', (1398, 1404), True, 'from bcbio.pipeline import datadict as dd\n'), ((1512, 1536), 'bcbio.pipeline.datadict.get_sample_name', 'dd.get_sample_name', (['data'], {}), '(data)\n', (1530, 1536), True, 'from bcbio.pipeline ... |
import unittest
from pybox.math import util
class MathUtilTest(unittest.TestCase):
def test_dot(self):
l1 = [1, 2, 3]
l2 = [3, 4, 6]
self.assertEqual(util.dot(l1, l2), 29)
if __name__ == '__main__':
unittest.main()
| [
"unittest.main",
"pybox.math.util.dot"
] | [((236, 251), 'unittest.main', 'unittest.main', ([], {}), '()\n', (249, 251), False, 'import unittest\n'), ((181, 197), 'pybox.math.util.dot', 'util.dot', (['l1', 'l2'], {}), '(l1, l2)\n', (189, 197), False, 'from pybox.math import util\n')] |
import logging
from rest_framework import serializers, exceptions
logger = logging.getLogger(__name__)
class ResourceTypeSerializer(serializers.Serializer):
'''
Serializer for describing the types of available Resources
that users may choose.
'''
resource_type_key = serializers.CharField(max_leng... | [
"logging.getLogger",
"rest_framework.serializers.JSONField",
"rest_framework.serializers.CharField"
] | [((77, 104), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (94, 104), False, 'import logging\n'), ((290, 326), 'rest_framework.serializers.CharField', 'serializers.CharField', ([], {'max_length': '(50)'}), '(max_length=50)\n', (311, 326), False, 'from rest_framework import serializers, e... |
from django.contrib.auth.forms import AuthenticationForm
from django.contrib.auth.models import User
from .models import Imovel
from django import forms
from django.utils.html import strip_tags
class AuthenticateForm(AuthenticationForm):
username = forms.CharField(widget=forms.widgets.TextInput(attrs={'placeholder... | [
"django.forms.widgets.PasswordInput",
"django.utils.html.strip_tags",
"django.forms.widgets.TextInput"
] | [((277, 334), 'django.forms.widgets.TextInput', 'forms.widgets.TextInput', ([], {'attrs': "{'placeholder': 'usuário'}"}), "(attrs={'placeholder': 'usuário'})\n", (300, 334), False, 'from django import forms\n'), ((374, 438), 'django.forms.widgets.PasswordInput', 'forms.widgets.PasswordInput', ([], {'attrs': "{'placehol... |
import requests
from scrapy.selector import Selector
import MySQLdb
conn = MySQLdb.connect(host="127.0.0.1", user="root", passwd="", db="article_spider", charset="utf8")
curcor = conn.cursor()
def crawl_ips():
# 爬取西刺的免费代理
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537... | [
"MySQLdb.connect",
"scrapy.selector.Selector",
"requests.get"
] | [((76, 175), 'MySQLdb.connect', 'MySQLdb.connect', ([], {'host': '"""127.0.0.1"""', 'user': '"""root"""', 'passwd': '""""""', 'db': '"""article_spider"""', 'charset': '"""utf8"""'}), "(host='127.0.0.1', user='root', passwd='', db=\n 'article_spider', charset='utf8')\n", (91, 175), False, 'import MySQLdb\n'), ((519, ... |
import uiautomator2 as u2
class Douyin:
def __init__(self,appName='抖音',appPkgName='com.ss.android.ugc.aweme',serial='FJH7N19114001942'):
self.d = u2.connect_usb(serial)
print("正在启动app:" + appName + "...")
print(appName + "包名:" + appPkgName)
self.d.app_start(appPkgName)
self.... | [
"uiautomator2.connect_usb"
] | [((159, 181), 'uiautomator2.connect_usb', 'u2.connect_usb', (['serial'], {}), '(serial)\n', (173, 181), True, 'import uiautomator2 as u2\n')] |
from sklearn.model_selection import train_test_split
import pandas as pd
import numpy as np
class Preprocessor:
"""Class for preprocessing data.
Attribute: None
Methods:
decompose
scale
split_data
fit_decomposer
fit_scaler
""... | [
"sklearn.decomposition.NMF",
"sklearn.decomposition.PCA",
"sklearn.model_selection.train_test_split",
"sklearn.preprocessing.StandardScaler",
"sklearn.preprocessing.RobustScaler",
"sklearn.preprocessing.MinMaxScaler"
] | [((1137, 1154), 'sklearn.decomposition.PCA', 'PCA', (['n_components'], {}), '(n_components)\n', (1140, 1154), False, 'from sklearn.decomposition import PCA, NMF\n'), ((1169, 1186), 'sklearn.decomposition.NMF', 'NMF', (['n_components'], {}), '(n_components)\n', (1172, 1186), False, 'from sklearn.decomposition import PCA... |
#%%
import cv2
import numpy as np
from scipy.signal import convolve2d
from harris_corner_detector import harris_corner_detector
def harris_corner_detector_plot(img_color_orig, thresh, sigma=1, window_size=5):
img_color = img_color_orig.copy()
Points = harris_corner_detector(img_color, thresh, sigma, window_si... | [
"cv2.circle",
"harris_corner_detector.harris_corner_detector"
] | [((262, 323), 'harris_corner_detector.harris_corner_detector', 'harris_corner_detector', (['img_color', 'thresh', 'sigma', 'window_size'], {}), '(img_color, thresh, sigma, window_size)\n', (284, 323), False, 'from harris_corner_detector import harris_corner_detector\n'), ((420, 481), 'cv2.circle', 'cv2.circle', (['img_... |
#!/usr/bin/env python
# 3rd party modules
from sklearn.linear_model import LinearRegression
from sklearn.metrics import mean_absolute_error
import numpy as np
# config
n = 10**6
feature_dim = 3
# create data
x = np.random.rand(n * feature_dim).reshape(n, feature_dim)
y_true = np.random.rand(n)
# x[:, 1] = x[:, 0]
pr... | [
"sklearn.metrics.mean_absolute_error",
"sklearn.linear_model.LinearRegression",
"numpy.random.rand"
] | [((280, 297), 'numpy.random.rand', 'np.random.rand', (['n'], {}), '(n)\n', (294, 297), True, 'import numpy as np\n'), ((433, 451), 'sklearn.linear_model.LinearRegression', 'LinearRegression', ([], {}), '()\n', (449, 451), False, 'from sklearn.linear_model import LinearRegression\n'), ((215, 246), 'numpy.random.rand', '... |
from application import celery
from application import init_app, Flask
app: Flask = init_app("application.settings.dev")
@celery.task(name="send_sms")
def send_sms(mobile: str):
"""占用celery导包,不然代码格式化把导包删除了,shell启动不了celery"""
print("发送短信~")
if __name__ == '__main__':
app.run()
send_sms.delay("188888... | [
"application.init_app",
"application.celery.task"
] | [((85, 121), 'application.init_app', 'init_app', (['"""application.settings.dev"""'], {}), "('application.settings.dev')\n", (93, 121), False, 'from application import init_app, Flask\n'), ((125, 153), 'application.celery.task', 'celery.task', ([], {'name': '"""send_sms"""'}), "(name='send_sms')\n", (136, 153), False, ... |
# Copyright (c) 2020 NVIDIA Corporation. All rights reserved.
# This work is licensed under the NVIDIA Source Code License - Non-commercial. Full
# text can be found in LICENSE.md
import torch
import torch.nn as nn
import time
import sys, os
import numpy as np
import cv2
import scipy
import matplotlib.pyplot as plt
f... | [
"scipy.io.savemat",
"torch.from_numpy",
"numpy.linalg.norm",
"numpy.divide",
"os.remove",
"matplotlib.pyplot.imshow",
"os.path.exists",
"utils.nms.nms",
"numpy.where",
"matplotlib.pyplot.plot",
"numpy.exp",
"numpy.matmul",
"matplotlib.pyplot.Rectangle",
"numpy.ones",
"matplotlib.pyplot.g... | [((6030, 6077), 'os.path.join', 'os.path.join', (['output_dir', '"""results_posecnn.mat"""'], {}), "(output_dir, 'results_posecnn.mat')\n", (6042, 6077), False, 'import sys, os\n'), ((6085, 6109), 'os.path.exists', 'os.path.exists', (['filename'], {}), '(filename)\n', (6099, 6109), False, 'import sys, os\n'), ((1392, 1... |
import unittest
import numpy as np
import tensorflow as tf
from lib import tf_utils
class TensorDotTest(unittest.TestCase):
def test_adj_tensor_dot(self):
# adj: [[1, 0], [0, 1]]
# SparseTensor(indices=[[0, 0], [1, 2]], values=[1, 2], dense_shape=[3, 4])
adj_indices = [[0, 0], [1, 1]]
... | [
"tensorflow.SparseTensor",
"lib.tf_utils.adj_tensor_dot",
"tensorflow.Session",
"numpy.array",
"tensorflow.constant",
"numpy.array_equal",
"unittest.main"
] | [((949, 964), 'unittest.main', 'unittest.main', ([], {}), '()\n', (962, 964), False, 'import unittest\n'), ((339, 373), 'numpy.array', 'np.array', (['[1, 1]'], {'dtype': 'np.float32'}), '([1, 1], dtype=np.float32)\n', (347, 373), True, 'import numpy as np\n'), ((415, 466), 'tensorflow.SparseTensor', 'tf.SparseTensor', ... |
#! /usr/bin/env python
# --------------------------------------------------------------------
import re
from epydoc import docstringparser as dsp
CYTHON_SIGNATURE_RE = re.compile(
# Class name (for builtin methods)
r'^\s*((?P<class>\w+)\.)?' +
# The function name
r'(?P<func>\w+)' +
# The paramete... | [
"epydoc.cli.cli",
"re.compile"
] | [((171, 360), 're.compile', 're.compile', (["('^\\\\s*((?P<class>\\\\w+)\\\\.)?' + '(?P<func>\\\\w+)' +\n '\\\\(((?P<self>(?:self|cls|mcs)),?)?(?P<params>.*)\\\\)' +\n '(\\\\s*(->)\\\\s*(?P<return>\\\\w+(?:\\\\s*\\\\w+)))?' + '\\\\s*(?:\\\\n|$)')"], {}), "('^\\\\s*((?P<class>\\\\w+)\\\\.)?' + '(?P<func>\\\\w+)' +... |
from pybunpro import StudyQueueSchema
class TestStudyQueueSchema(object):
def test_dump(self, study_queue, study_queue_dict):
schema = StudyQueueSchema()
result, errors = schema.dump(study_queue)
assert errors == dict()
assert result == study_queue_dict
def test_load(self, s... | [
"pybunpro.StudyQueueSchema"
] | [((150, 168), 'pybunpro.StudyQueueSchema', 'StudyQueueSchema', ([], {}), '()\n', (166, 168), False, 'from pybunpro import StudyQueueSchema\n'), ((368, 386), 'pybunpro.StudyQueueSchema', 'StudyQueueSchema', ([], {}), '()\n', (384, 386), False, 'from pybunpro import StudyQueueSchema\n')] |
#!/usr/bin/env python3
from functools import lru_cache
from typing import NamedTuple, Dict, Any
from datetime import datetime
from pathlib import Path
import json
import pytz
from mycfg import paths
# TODO Json type?
# TODO memoised properties?
# TODO lazy mode and eager mode?
# lazy is a bit nicer in terms of more ... | [
"functools.lru_cache",
"datetime.datetime.fromtimestamp",
"pathlib.Path"
] | [((1248, 1260), 'functools.lru_cache', 'lru_cache', (['(1)'], {}), '(1)\n', (1257, 1260), False, 'from functools import lru_cache\n'), ((551, 590), 'datetime.datetime.fromtimestamp', 'datetime.fromtimestamp', (['ts'], {'tz': 'pytz.utc'}), '(ts, tz=pytz.utc)\n', (573, 590), False, 'from datetime import datetime\n'), ((1... |
# coding: utf-8
import abc
import dataclasses
import typing
from urllib.parse import urlencode
import serpyco
from guilang.description import Description
from rolling.model.event import ZoneEvent
from rolling.model.event import ZoneEventData
from rolling.rolling_types import ActionType
from rolling.server.controller.... | [
"urllib.parse.urlencode",
"rolling.server.controller.url.CHARACTER_ACTION.format",
"rolling.server.controller.url.WITH_RESOURCE_ACTION.format",
"rolling.server.controller.url.WITH_CHARACTER_ACTION.format"
] | [((1258, 1389), 'rolling.server.controller.url.CHARACTER_ACTION.format', 'CHARACTER_ACTION.format', ([], {'character_id': 'character_id', 'action_type': 'action_type.value', 'action_description_id': 'action_description_id'}), '(character_id=character_id, action_type=action_type.\n value, action_description_id=action... |
"""
Only for test purpose
"""
from django.db import models
class SoccerTeam(models.Model):
name = models.CharField(max_length=50)
number_of_supporters = models.IntegerField()
@property
def all_players(self):
return SoccerPlayer.objects.filter(team=self)
def __str__(self):
return ... | [
"django.db.models.ForeignKey",
"django.db.models.CharField",
"django.db.models.IntegerField"
] | [((104, 135), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(50)'}), '(max_length=50)\n', (120, 135), False, 'from django.db import models\n'), ((163, 184), 'django.db.models.IntegerField', 'models.IntegerField', ([], {}), '()\n', (182, 184), False, 'from django.db import models\n'), ((405, 434... |
from django.core.management.base import BaseCommand
import redis
class Command(BaseCommand):
help = 'executes the transaction'
def handle(self, *args, **options):
connection = redis.Redis('redis', 6379)
pubsub = connection.pubsub()
pubsub.subscribe('back-channel')
for item... | [
"redis.Redis"
] | [((198, 224), 'redis.Redis', 'redis.Redis', (['"""redis"""', '(6379)'], {}), "('redis', 6379)\n", (209, 224), False, 'import redis\n')] |
#!/usr/bin/env python
#############################################################################
##
# This file is part of Taurus
##
# http://taurus-scada.org
##
# Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
##
# Taurus is free software: you can redistribute it and/or modify
# it under the terms of t... | [
"taurus.external.qt.Qt.QFileDialog.getSaveFileName",
"datetime.datetime.fromtimestamp",
"taurus.external.qt.Qt.QMessageBox.critical",
"taurus.external.qt.Qt.QMessageBox.information",
"taurus.external.qt.Qt.QString",
"datetime.datetime.now",
"taurus.qt.qtgui.application.TaurusApplication"
] | [((10634, 10661), 'taurus.qt.qtgui.application.TaurusApplication', 'TaurusApplication', (['sys.argv'], {}), '(sys.argv)\n', (10651, 10661), False, 'from taurus.qt.qtgui.application import TaurusApplication\n'), ((2617, 2631), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (2629, 2631), False, 'from datetime... |
# Generated by Django 2.2 on 2019-08-06 15:18
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('commun... | [
"django.db.migrations.swappable_dependency",
"django.db.models.ManyToManyField",
"django.db.models.ForeignKey"
] | [((245, 302), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (276, 302), False, 'from django.db import migrations, models\n'), ((488, 599), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'default': '""""""', ... |
from __future__ import print_function
import argparse
import torch
import torch.utils.data
from torch import nn, optim
from torch.autograd import Variable
from torchvision import datasets, transforms
from torchvision.utils import save_image
from torch.nn import functional as F
import numpy as np
import collections
from... | [
"torch.manual_seed",
"torch.cuda.FloatTensor",
"vae_conv_model_mnist.VAE",
"pytorch_summary.Summary",
"argparse.ArgumentParser",
"torch.load",
"torch.cuda.is_available",
"numpy.full",
"torch.cuda.manual_seed",
"torch.autograd.Variable",
"torch.FloatTensor",
"numpy.set_printoptions"
] | [((418, 478), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""PyTorch MNIST Example"""'}), "(description='PyTorch MNIST Example')\n", (441, 478), False, 'import argparse\n'), ((1034, 1062), 'torch.manual_seed', 'torch.manual_seed', (['args.seed'], {}), '(args.seed)\n', (1051, 1062), False... |
import click
@click.command('ping:ping')
def cli():
"""
Just ping it
"""
click.echo('pong')
| [
"click.echo",
"click.command"
] | [((15, 41), 'click.command', 'click.command', (['"""ping:ping"""'], {}), "('ping:ping')\n", (28, 41), False, 'import click\n'), ((90, 108), 'click.echo', 'click.echo', (['"""pong"""'], {}), "('pong')\n", (100, 108), False, 'import click\n')] |
'''Autogenerated by xml_generate script, do not edit!'''
from OpenGL import platform as _p, arrays
# Code generation uses this
from OpenGL.raw.GL import _types as _cs
# End users want this...
from OpenGL.raw.GL._types import *
from OpenGL.raw.GL import _errors
from OpenGL.constant import Constant as _C
import ctypes
_... | [
"OpenGL.platform.types",
"OpenGL.constant.Constant",
"OpenGL.platform.createFunction"
] | [((535, 572), 'OpenGL.constant.Constant', '_C', (['"""GL_ALL_BARRIER_BITS"""', '(4294967295)'], {}), "('GL_ALL_BARRIER_BITS', 4294967295)\n", (537, 572), True, 'from OpenGL.constant import Constant as _C\n'), ((602, 643), 'OpenGL.constant.Constant', '_C', (['"""GL_ATOMIC_COUNTER_BARRIER_BIT"""', '(4096)'], {}), "('GL_A... |
import torch
import math
import time
from transformers.debug_utils import DebugOption
from transformers.trainer_utils import speed_metrics
from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Tuple, Union
from torch.utils.data import DataLoader, Dataset, IterableDataset, RandomSampler, SequentialSampl... | [
"torch.jit.trace",
"transformers.is_torch_tpu_available",
"math.ceil",
"intel_extension_for_pytorch.optimize",
"torch.cpu.amp.autocast",
"torch.jit.freeze",
"torch_xla.debug.metrics.metrics_report",
"sys.argv.index",
"time.time",
"torch.ones"
] | [((860, 884), 'transformers.is_torch_tpu_available', 'is_torch_tpu_available', ([], {}), '()\n', (882, 884), False, 'from transformers import Trainer, is_torch_tpu_available\n'), ((1984, 1995), 'time.time', 'time.time', ([], {}), '()\n', (1993, 1995), False, 'import time\n'), ((2159, 2220), 'torch.ones', 'torch.ones', ... |
r"""
*****
Array
*****
.. autofunction:: is_all_equal
.. autofunction:: is_all_finite
.. autofunction:: is_crescent
"""
from numpy import asarray, isfinite, mgrid, prod, rollaxis
from numpy import sum as _sum
from numpy import unique as _unique
try:
from numba import boolean, char, float64, int32, int64, jit
... | [
"numpy.prod",
"numpy.unique",
"numba.boolean",
"dask.array.unique",
"numpy.asarray",
"numpy.rollaxis"
] | [((601, 613), 'numpy.asarray', 'asarray', (['arr'], {}), '(arr)\n', (608, 613), False, 'from numpy import asarray, isfinite, mgrid, prod, rollaxis\n'), ((854, 866), 'numpy.asarray', 'asarray', (['arr'], {}), '(arr)\n', (861, 866), False, 'from numpy import asarray, isfinite, mgrid, prod, rollaxis\n'), ((2378, 2408), 'n... |
'''
Configure:
python setup.py build
StructuredModels
<NAME>
2013
'''
from distutils.core import setup
# from setuptools import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
import numpy as np
# ext_modules = [
# Extension("pyKinectTools_algs_Dijkstras", ["pyKinectTools/... | [
"numpy.get_include"
] | [((872, 888), 'numpy.get_include', 'np.get_include', ([], {}), '()\n', (886, 888), True, 'import numpy as np\n')] |
# © 2019 University of Illinois Board of Trustees. All rights reserved
"""
Script to produce VCF from training data
"""
import argparse
import vcfFromContigs
from PySamFastaWrapper import PySamFastaWrapper
import multiprocessing
# import MemmapData
import MemmapDataLite
import _pickle as pickle
import logging
import s... | [
"logging.basicConfig",
"logging.debug",
"argparse.ArgumentParser",
"vcfFromContigs.createVcfRecord",
"os.path.splitext",
"os.path.split",
"PySamFastaWrapper.PySamFastaWrapper",
"multiprocessing.Pool",
"subprocess.call",
"logging.info"
] | [((565, 587), 'PySamFastaWrapper.PySamFastaWrapper', 'PySamFastaWrapper', (['ref'], {}), '(ref)\n', (582, 587), False, 'from PySamFastaWrapper import PySamFastaWrapper\n'), ((1523, 1545), 'PySamFastaWrapper.PySamFastaWrapper', 'PySamFastaWrapper', (['ref'], {}), '(ref)\n', (1540, 1545), False, 'from PySamFastaWrapper i... |
# coding=utf-8
# Copyright (c) HISSL Contributors
try:
import h5py
except ImportError:
raise ValueError("You must have h5py installed to run this script: pip install h5py.")
from pathlib import Path
# Idea of this script is to take the TCGA-CRCk or TCGA-BC features saved per tile in h5 format and output them
... | [
"pathlib.Path",
"h5py.File"
] | [((952, 991), 'h5py.File', 'h5py.File', (["cfg['PATH_TO_INPUT_H5']", '"""r"""'], {}), "(cfg['PATH_TO_INPUT_H5'], 'r')\n", (961, 991), False, 'import h5py\n'), ((3504, 3543), 'h5py.File', 'h5py.File', (["cfg['PATH_TO_INPUT_H5']", '"""r"""'], {}), "(cfg['PATH_TO_INPUT_H5'], 'r')\n", (3513, 3543), False, 'import h5py\n'),... |
from datetime import datetime
import pytest as pytest
import os
import vdocipher as vdocipher_lib
from vdocipher import Video
class BaseTest:
vdocipher = vdocipher_lib
vdocipher.authenticate(os.getenv('VDOCIPHER_API_SECRET', default=''))
@pytest.yield_fixture
def video(self) -> Video:
with... | [
"datetime.datetime.now",
"os.getenv"
] | [((203, 248), 'os.getenv', 'os.getenv', (['"""VDOCIPHER_API_SECRET"""'], {'default': '""""""'}), "('VDOCIPHER_API_SECRET', default='')\n", (212, 248), False, 'import os\n'), ((403, 417), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (415, 417), False, 'from datetime import datetime\n')] |
#!/usr/bin/env python
# -*- coding:utf8 -*-
# Power by viekie. 2017-05-19 15:36:33
import struct
class Loader(object):
def __init__(self, path, count):
self.path = path
self.count = count
def get_file_content(self):
with open(self.path, 'rb') as f:
content = f.read()
... | [
"struct.unpack"
] | [((382, 406), 'struct.unpack', 'struct.unpack', (['"""B"""', 'byte'], {}), "('B', byte)\n", (395, 406), False, 'import struct\n')] |
"""This module implements the LBFGSMinimizer class."""
from __future__ import annotations
import logging
from bqskitrs import LBFGSMinimizerNative
from bqskit.ir.opt.minimizer import Minimizer
_logger = logging.getLogger(__name__)
class LBFGSMinimizer(LBFGSMinimizerNative, Minimizer):
"""
The LBFGSMinimiz... | [
"logging.getLogger"
] | [((207, 234), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (224, 234), False, 'import logging\n')] |
import torch
import pickle
import gzip
from torchtext import data
from slt.signjoey.model import build_model
from slt.signjoey.batch import Batch
from slt.signjoey.data import make_data_iter
from slt.signjoey.vocabulary import PAD_TOKEN
from slt.signjoey.dataset import SignTranslationDataset
from slt.signjoey.phoenix_... | [
"torch.split",
"pickle.dump",
"torchtext.data.Field",
"gzip.open",
"slt.signjoey.helpers.load_checkpoint",
"torch.stack",
"pickle.load",
"torchtext.data.RawField",
"torch.no_grad",
"torch.zeros",
"slt.signjoey.data.make_data_iter",
"slt.signjoey.model.build_model",
"slt.signjoey.helpers.bpe_... | [((740, 761), 'slt.signjoey.helpers.load_config', 'load_config', (['cfg_file'], {}), '(cfg_file)\n', (751, 761), False, 'from slt.signjoey.helpers import bpe_postprocess, load_config, load_checkpoint\n'), ((1577, 1682), 'slt.signjoey.vocabulary.build_vocab', 'build_vocab', ([], {'field': '"""gls"""', 'min_freq': 'None'... |
import argparse
import torch
from Processing.Load_Data import load_data
from Processing.Process import process_batch
from Training_Functions.Sumerise import summarise
from Training_Functions.Interpolation_NoML import spline_interpolation, flat_interpolation, linear_interpolation
# This file is used to perfo... | [
"Training_Functions.Interpolation_NoML.linear_interpolation",
"Processing.Process.process_batch",
"argparse.ArgumentParser",
"Processing.Load_Data.load_data",
"torch.stack",
"Training_Functions.Interpolation_NoML.flat_interpolation",
"Training_Functions.Interpolation_NoML.spline_interpolation",
"torch... | [((377, 402), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (400, 402), False, 'import argparse\n'), ((923, 948), 'Processing.Load_Data.load_data', 'load_data', (['None', 'test_dir'], {}), '(None, test_dir)\n', (932, 948), False, 'from Processing.Load_Data import load_data\n'), ((957, 972), 't... |
from typing import List, Tuple, Union
from io import StringIO
from nltk.corpus import stopwords
import torch
from torch import Tensor
import torch.nn.functional as F
from transformers import BertTokenizer, BertForMaskedLM
from transformers.tokenization_utils import PreTrainedTokenizer
class MaskedStego:
def __in... | [
"transformers.BertForMaskedLM.from_pretrained",
"nltk.corpus.stopwords.words",
"transformers.BertTokenizer.from_pretrained",
"torch.no_grad",
"io.StringIO",
"torch.nn.functional.softmax"
] | [((432, 481), 'transformers.BertTokenizer.from_pretrained', 'BertTokenizer.from_pretrained', (['model_name_or_path'], {}), '(model_name_or_path)\n', (461, 481), False, 'from transformers import BertTokenizer, BertForMaskedLM\n'), ((504, 555), 'transformers.BertForMaskedLM.from_pretrained', 'BertForMaskedLM.from_pretrai... |
# -*- coding: utf-8 -*-
"""
Created on Sun Jul 15 16:02:16 2018
@author: ning
"""
import os
working_dir = ''
import pandas as pd
pd.options.mode.chained_assignment = None
import statsmodels.formula.api as sm
import numpy as np
from sklearn.preprocessing import StandardScaler
result_dir = '../results/'
# Exp 1
exper... | [
"os.path.join",
"statsmodels.formula.api.Logit",
"numpy.random.seed",
"numpy.concatenate",
"numpy.vstack",
"pandas.DataFrame"
] | [((764, 785), 'numpy.random.seed', 'np.random.seed', (['(12345)'], {}), '(12345)\n', (778, 785), True, 'import numpy as np\n'), ((3952, 3973), 'pandas.DataFrame', 'pd.DataFrame', (['results'], {}), '(results)\n', (3964, 3973), True, 'import pandas as pd\n'), ((5428, 5449), 'numpy.random.seed', 'np.random.seed', (['(123... |
import functools
import time
REGISTERED = {}
def register(func):
REGISTERED[func.__name__] = func
return func
def timer(func):
""" template for decorators """
@functools.wraps(func)
def _timer(*args, **kwargs):
t0 = time.perf_counter()
value = func(*args, **kwargs)
t1 =... | [
"time.perf_counter",
"functools.wraps",
"functools.update_wrapper"
] | [((182, 203), 'functools.wraps', 'functools.wraps', (['func'], {}), '(func)\n', (197, 203), False, 'import functools\n'), ((1189, 1210), 'functools.wraps', 'functools.wraps', (['func'], {}), '(func)\n', (1204, 1210), False, 'import functools\n'), ((1921, 1942), 'functools.wraps', 'functools.wraps', (['func'], {}), '(fu... |
"""Calculate the Foo et al. parameterization for atmospheric sea-spray
physics
Currently this module simply calculates the volume of a sphere from a
user-supplied radius.
Authors
-------
- <NAME>
Use
---
This module can be executed via the command line as such:
python foo_parameterization.py -r <ra... | [
"argparse.ArgumentParser"
] | [((1658, 1683), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1681, 1683), False, 'import argparse\n')] |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2018-11-28 14:14
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('core', '0006_databasecolumn'),
]
operations = [
... | [
"django.db.models.TextField",
"django.db.models.AutoField",
"django.db.models.CharField",
"django.db.models.ForeignKey"
] | [((423, 516), '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", (439, 516), False, 'from django.db import migrations, models\... |
import torch.autograd as autograd
import torch.nn.functional as F
from torch.autograd import Variable
def linear(inputs, weight, bias, meta_step_size=0.001, meta_loss=None, stop_gradient=False):
if meta_loss is not None:
if not stop_gradient:
grad_weight = autograd.grad(meta_loss, weight, cre... | [
"torch.nn.functional.linear",
"torch.nn.functional.conv2d",
"torch.autograd.grad",
"torch.nn.functional.threshold",
"torch.nn.functional.max_pool2d"
] | [((2445, 2484), 'torch.nn.functional.threshold', 'F.threshold', (['inputs', '(0)', '(0)'], {'inplace': '(True)'}), '(inputs, 0, 0, inplace=True)\n', (2456, 2484), True, 'import torch.nn.functional as F\n'), ((2556, 2614), 'torch.nn.functional.max_pool2d', 'F.max_pool2d', (['inputs', 'kernel_size', 'stride'], {'padding'... |
# -*- coding: utf-8 -*-
"""<EMAIL>.
功能描述:one hot encoding for manifacture name
"""
import os
from pyspark.sql import SparkSession
from dataparepare import *
from interfere import *
from pdu_feature import *
from pyspark.sql.types import *
from pyspark.sql.functions import when
from pyspark.sql.functions import explo... | [
"pandas.DataFrame",
"pyspark.sql.SparkSession.builder.master",
"os.getenv"
] | [((1089, 1119), 'os.getenv', 'os.getenv', (['"""AWS_ACCESS_KEY_ID"""'], {}), "('AWS_ACCESS_KEY_ID')\n", (1098, 1119), False, 'import os\n'), ((1134, 1168), 'os.getenv', 'os.getenv', (['"""AWS_SECRET_ACCESS_KEY"""'], {}), "('AWS_SECRET_ACCESS_KEY')\n", (1143, 1168), False, 'import os\n'), ((1889, 1908), 'pandas.DataFram... |
# -*- coding: utf-8 -*-
"""
@author: LeeZChuan
"""
import pandas as pd
import numpy as np
import requests
import os
from pandas.core.frame import DataFrame
import json
import datetime
import time
pd.set_option('display.max_columns',1000)
pd.set_option('display.width', 1000)
pd.set_option('display.max_colwidth',100... | [
"numpy.mean",
"os.path.exists",
"os.listdir",
"pandas.read_csv",
"pandas.to_datetime",
"numpy.min",
"pandas.value_counts",
"pandas.set_option",
"numpy.max",
"numpy.array",
"os.getcwd",
"pandas.read_excel",
"os.mkdir",
"numpy.std",
"pandas.DataFrame",
"pandas.core.frame.DataFrame",
"n... | [((201, 243), 'pandas.set_option', 'pd.set_option', (['"""display.max_columns"""', '(1000)'], {}), "('display.max_columns', 1000)\n", (214, 243), True, 'import pandas as pd\n'), ((243, 279), 'pandas.set_option', 'pd.set_option', (['"""display.width"""', '(1000)'], {}), "('display.width', 1000)\n", (256, 279), True, 'im... |
from __future__ import absolute_import
from flask import Flask
app = Flask(__name__)
from . import db
from . import api
| [
"flask.Flask"
] | [((71, 86), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (76, 86), False, 'from flask import Flask\n')] |
import unittest
from unittest_data_provider import data_provider
import sys
import numpy as np
from board import *
from tests.test_utils.generate_board import generate_board_and_add_position, generate_empty_board, generate_full_board, generate_board_and_add_positions
from tests.test_utils.print_board import print_boa... | [
"tests.test_utils.generate_board.generate_full_board",
"tests.test_utils.generate_board.generate_board_and_add_positions",
"tests.test_utils.generate_board.generate_board_and_add_position",
"tests.test_utils.print_board.print_board_if_verbosity_is_set",
"numpy.array",
"tests.test_utils.generate_board.gene... | [((1388, 1419), 'unittest_data_provider.data_provider', 'data_provider', (['positions_values'], {}), '(positions_values)\n', (1401, 1419), False, 'from unittest_data_provider import data_provider\n'), ((2410, 2446), 'unittest_data_provider.data_provider', 'data_provider', (['good_positions_values'], {}), '(good_positio... |
from src.utils import utils
from src.configurations import classifier_config as config
from src.configurations import embeddings_config as embeddings_config
from src.dataset.dataset import *
from src.modules.contextual_embedder import ContextualEmbedder
from src.evaluation.evaluators import RetrievalEvaluator
from src.... | [
"src.models.modeling.MBERTClassifier",
"src.evaluation.evaluators.RetrievalEvaluator"
] | [((947, 1025), 'src.models.modeling.MBERTClassifier', 'MBERTClassifier', ([], {'strategy': '"""cls"""', 'train_model': '(False)', 'use_sense_embeddings': '(False)'}), "(strategy='cls', train_model=False, use_sense_embeddings=False)\n", (962, 1025), False, 'from src.models.modeling import SiameseSentenceEmbedder, MBERTC... |
import abc # Abstract Base Class
from eth_account import Account
from collections import defaultdict
import sqlalchemy
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer
from sqlalchemy.orm import sessionmaker
from sqlalchemy.sql import f... | [
"sqlalchemy.orm.sessionmaker",
"sqlalchemy.create_engine",
"collections.defaultdict",
"sqlalchemy.ext.declarative.declarative_base",
"sqlalchemy.sql.func.sum",
"sqlalchemy.Column"
] | [((332, 350), 'sqlalchemy.ext.declarative.declarative_base', 'declarative_base', ([], {}), '()\n', (348, 350), False, 'from sqlalchemy.ext.declarative import declarative_base\n'), ((2293, 2326), 'sqlalchemy.Column', 'Column', (['Integer'], {'primary_key': '(True)'}), '(Integer, primary_key=True)\n', (2299, 2326), False... |
# Copyright (c) 2020 <NAME> <<EMAIL>>
#
# 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, di... | [
"aesqlapius.function_def.parse_function_definition",
"re.match"
] | [((2180, 2220), 're.match', 're.match', (['"""-- .*[^-\\\\s]"""', 'lines[end_idx]'], {}), "('-- .*[^-\\\\s]', lines[end_idx])\n", (2188, 2220), False, 'import re\n'), ((2588, 2633), 'aesqlapius.function_def.parse_function_definition', 'parse_function_definition', (['current_annotation'], {}), '(current_annotation)\n', ... |
import numpy as np
import keras
model = keras.Sequential(layers=[keras.layers.Dense(
units=1,
input_shape=[1],
)])
model.compile(
optimizer='sgd',
loss='mean_squared_error',
)
Xs = np.array([-1.0, 0.0, 1.0, 2.0, 3.0, 4.0], dtype=float)
Ys = np.array([-3.0, -1.0, 1.0, 3.0, 5.0, 7.0], dtype=float... | [
"keras.layers.Dense",
"numpy.array"
] | [((205, 259), 'numpy.array', 'np.array', (['[-1.0, 0.0, 1.0, 2.0, 3.0, 4.0]'], {'dtype': 'float'}), '([-1.0, 0.0, 1.0, 2.0, 3.0, 4.0], dtype=float)\n', (213, 259), True, 'import numpy as np\n'), ((266, 321), 'numpy.array', 'np.array', (['[-3.0, -1.0, 1.0, 3.0, 5.0, 7.0]'], {'dtype': 'float'}), '([-3.0, -1.0, 1.0, 3.0, ... |
# Copyright 2020 Huawei Technologies Co., Ltd
#
# 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... | [
"ast_impl.insert_npu_keras_opt_func",
"ast_impl.insert_npu_import",
"ast_impl.attribute",
"ast_impl.insert_empty_hook",
"astunparse.unparse",
"ast_impl.ast_assign",
"ast_impl.insert_NPUBroadcastGlobalVariablesHook_import",
"ast_impl.ast_call",
"ast_impl.insert_config_pb2_import",
"ast_impl.insert_... | [((3874, 3917), 'util_global.set_value', 'util_global.set_value', (['"""need_conver"""', '(False)'], {}), "('need_conver', False)\n", (3895, 3917), False, 'import util_global\n'), ((3922, 3971), 'util_global.set_value', 'util_global.set_value', (['"""import_config_pb2"""', '(False)'], {}), "('import_config_pb2', False)... |
"""AyudaEnPython: https://www.facebook.com/groups/ayudapython
Implemente una función que reciba como parámetros tres listas y
devuelva una nueva lista con el promedio de las otras tres,
elemento por elemento.
"""
from itertools import zip_longest
from math import floor
from random import randint, sample
from typing im... | [
"itertools.zip_longest",
"random.randint"
] | [((425, 439), 'random.randint', 'randint', (['(1)', '(10)'], {}), '(1, 10)\n', (432, 439), False, 'from random import randint, sample\n'), ((1029, 1049), 'itertools.zip_longest', 'zip_longest', (['a', 'b', 'c'], {}), '(a, b, c)\n', (1040, 1049), False, 'from itertools import zip_longest\n')] |
# plot 2d 2rd-order regression
import matplotlib.pyplot as plt
import numpy as np
I = np.arange(4.40990640657, 58.51715740979401, 0.1) # (min, max, step)
I_coef_list = [
[-0.13927776461608068, 0.002038919337462459, 2.3484253283211487], # doubles
[-0.09850865867608666, 0.001429693439506745, 1.673346834786426],... | [
"numpy.power",
"matplotlib.pyplot.yticks",
"matplotlib.pyplot.subplots",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((88, 136), 'numpy.arange', 'np.arange', (['(4.40990640657)', '(58.51715740979401)', '(0.1)'], {}), '(4.40990640657, 58.51715740979401, 0.1)\n', (97, 136), True, 'import numpy as np\n'), ((540, 594), 'numpy.arange', 'np.arange', (['(0.3978092294245647)', '(7.325677230721877)', '(0.01)'], {}), '(0.3978092294245647, 7.3... |
from numpy import random # only used to simulate data loss
from decoder import Decoder # necessary for the functionality
from encoder import Encoder # necessary for the functionality
from utils import NUMBER_OF_ENCODED_BITS # only used for statistic
# showcase steering elements:
STOP_ENCODER_ON_DECODING = True #... | [
"numpy.random.random",
"encoder.Encoder",
"decoder.Decoder"
] | [((781, 793), 'encoder.Encoder', 'Encoder', (['(500)'], {}), '(500)\n', (788, 793), False, 'from encoder import Encoder\n'), ((883, 892), 'decoder.Decoder', 'Decoder', ([], {}), '()\n', (890, 892), False, 'from decoder import Decoder\n'), ((1754, 1769), 'numpy.random.random', 'random.random', ([], {}), '()\n', (1767, 1... |
"""
Logger of Lin
~~~~~~~~~
logger模块,用户行为日志记录器
:copyright: © 2020 by the Lin team.
:license: MIT, see LICENSE for more details.
"""
import re
from functools import wraps
from flask import Response, request
from flask_jwt_extended import get_current_user
from sqlalchemy import Column, Integer, Str... | [
"sqlalchemy.func.count",
"sqlalchemy.Integer",
"functools.wraps",
"sqlalchemy.String",
"re.findall",
"flask_jwt_extended.get_current_user",
"sqlalchemy.func"
] | [((482, 491), 'sqlalchemy.Integer', 'Integer', ([], {}), '()\n', (489, 491), False, 'from sqlalchemy import Column, Integer, String, func\n'), ((532, 543), 'sqlalchemy.String', 'String', (['(450)'], {}), '(450)\n', (538, 543), False, 'from sqlalchemy import Column, Integer, String, func\n'), ((582, 591), 'sqlalchemy.In... |
import re
text = "N1: +48 123 456 789"
pattern = re.compile(r"\+(\d{2})((?: \d{3}){3})")
| [
"re.compile"
] | [((50, 91), 're.compile', 're.compile', (['"""\\\\+(\\\\d{2})((?: \\\\d{3}){3})"""'], {}), "('\\\\+(\\\\d{2})((?: \\\\d{3}){3})')\n", (60, 91), False, 'import re\n')] |
# https:github.com/timestocome
# take xor neat-python example and convert it to predict tomorrow's stock
# market change using last 5 days data
# uses Python NEAT library
# https://github.com/CodeReclaimers/neat-python
from __future__ import print_function
import os
import neat
import visualize
import pan... | [
"pandas.read_csv",
"neat.Config",
"visualize.draw_net",
"neat.StatisticsReporter",
"numpy.arange",
"matplotlib.pyplot.plot",
"numpy.asarray",
"neat.nn.FeedForwardNetwork.create",
"neat.StdOutReporter",
"visualize.plot_stats",
"os.path.dirname",
"matplotlib.pyplot.title",
"matplotlib.pyplot.l... | [((750, 788), 'pandas.read_csv', 'pd.read_csv', (['"""LeveledLogStockData.csv"""'], {}), "('LeveledLogStockData.csv')\n", (761, 788), True, 'import pandas as pd\n'), ((1179, 1192), 'numpy.asarray', 'np.asarray', (['x'], {}), '(x)\n', (1189, 1192), True, 'import numpy as np\n'), ((1197, 1210), 'numpy.asarray', 'np.asarr... |
"""
Code for turning a GAE Search query into a SOLR query.
"""
import logging
from appscale.search.constants import InvalidRequest
from appscale.search.models import SolrQueryOptions, SolrSchemaFieldInfo
from appscale.search.query_parser import parser
logger = logging.getLogger(__name__)
def prepare_solr_query(gae_... | [
"logging.getLogger",
"appscale.search.models.SolrQueryOptions",
"appscale.search.query_parser.parser.parse_query"
] | [((263, 290), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (280, 290), False, 'import logging\n'), ((2565, 2599), 'appscale.search.query_parser.parser.parse_query', 'parser.parse_query', (['self.gae_query'], {}), '(self.gae_query)\n', (2583, 2599), False, 'from appscale.search.query_par... |
import torch
import numpy as np
from elf.io import open_file
from elf.wrapper import RoiWrapper
from ..util import ensure_tensor_with_channels
class RawDataset(torch.utils.data.Dataset):
"""
"""
max_sampling_attempts = 500
@staticmethod
def compute_len(path, key, patch_shape, with_channels):
... | [
"numpy.random.randint",
"elf.io.open_file",
"elf.wrapper.RoiWrapper"
] | [((330, 355), 'elf.io.open_file', 'open_file', (['path'], {'mode': '"""r"""'}), "(path, mode='r')\n", (339, 355), False, 'from elf.io import open_file\n'), ((944, 973), 'elf.io.open_file', 'open_file', (['raw_path'], {'mode': '"""r"""'}), "(raw_path, mode='r')\n", (953, 973), False, 'from elf.io import open_file\n'), (... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import logging
import torch
import torch.nn as nn
BN_MOMENTUM = 0.1
logger = logging.getLogger(__name__)
def conv3x3(in_planes, out_planes, stride=1):
"""3x3 convolution wit... | [
"logging.getLogger",
"torch.nn.BatchNorm2d",
"torch.nn.ReLU",
"torch.nn.Sequential",
"torch.load",
"torch.nn.Conv2d",
"torch.nn.MaxPool2d"
] | [((214, 241), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (231, 241), False, 'import logging\n'), ((345, 434), 'torch.nn.Conv2d', 'nn.Conv2d', (['in_planes', 'out_planes'], {'kernel_size': '(3)', 'stride': 'stride', 'padding': '(1)', 'bias': '(False)'}), '(in_planes, out_planes, kernel... |
from b_rabbit import BRabbit
def event_listener(msg):
print('Event received')
print("Message body is: " + msg.body)
print("Message properties are: " + str(msg.properties))
rabbit = BRabbit(host='localhost', port=5672)
subscriber = rabbit.EventSubscriber(
b_rabbit=rabb... | [
"b_rabbit.BRabbit"
] | [((197, 233), 'b_rabbit.BRabbit', 'BRabbit', ([], {'host': '"""localhost"""', 'port': '(5672)'}), "(host='localhost', port=5672)\n", (204, 233), False, 'from b_rabbit import BRabbit\n')] |
import urllib
import os
import datetime
import hashlib
import tweepy as tp
import cv2
import oauth # oauthの認証キー
class StreamListener(tp.StreamListener):
# フォルダー作成用
def mkdir(self):
self.base_path = "./" + self.old_date.isoformat() + "/"
self.raw_dir = self.base_path + "raw/"
self.face_... | [
"os.path.exists",
"cv2.imwrite",
"urllib.request.urlretrieve",
"os.path.splitext",
"oauth.get_oauth",
"tweepy.API",
"os.mkdir",
"datetime.date.today",
"cv2.imread",
"os.remove"
] | [((3316, 3333), 'oauth.get_oauth', 'oauth.get_oauth', ([], {}), '()\n', (3331, 3333), False, 'import oauth\n'), ((754, 775), 'datetime.date.today', 'datetime.date.today', ([], {}), '()\n', (773, 775), False, 'import datetime\n'), ((956, 977), 'datetime.date.today', 'datetime.date.today', ([], {}), '()\n', (975, 977), F... |
import pytest
import pyprctl
ALL_CAPS_SET = set(pyprctl.Cap)
def test_capstate_to_text() -> None:
assert str(pyprctl.CapState()) == "="
assert str(pyprctl.CapState(effective={pyprctl.Cap.CHOWN})) == "cap_chown=e"
assert str(pyprctl.CapState(effective=ALL_CAPS_SET - {pyprctl.Cap.CHOWN})) == "=e cap_cho... | [
"pyprctl.CapState",
"pyprctl.FileCaps.from_text",
"pyprctl.FileCaps",
"pyprctl.CapState.from_text",
"pytest.raises"
] | [((1721, 1739), 'pyprctl.CapState', 'pyprctl.CapState', ([], {}), '()\n', (1737, 1739), False, 'import pyprctl\n'), ((1752, 1782), 'pyprctl.CapState.from_text', 'pyprctl.CapState.from_text', (['""""""'], {}), "('')\n", (1778, 1782), False, 'import pyprctl\n'), ((1809, 1840), 'pyprctl.CapState.from_text', 'pyprctl.CapSt... |
#
# This file is part of PKPDApp (https://github.com/pkpdapp-team/pkpdapp) which
# is released under the BSD 3-clause license. See accompanying LICENSE.md for
# copyright notice and full license details.
#
import dash_core_components as dcc
import dash_html_components as html
import dash_bootstrap_components as dbc
fr... | [
"json.loads",
"django_plotly_dash.DjangoDash",
"dash.dependencies.Output",
"json.dumps",
"pandas.DataFrame.from_dict",
"dash.dependencies.Input",
"plotly.graph_objects.Figure",
"dash_core_components.Dropdown",
"dash_html_components.Label",
"dash_html_components.P"
] | [((523, 581), 'django_plotly_dash.DjangoDash', 'dpd.DjangoDash', ([], {'name': '"""auce_view"""', 'add_bootstrap_links': '(True)'}), "(name='auce_view', add_bootstrap_links=True)\n", (537, 581), True, 'import django_plotly_dash as dpd\n'), ((2055, 2092), 'dash.dependencies.Output', 'Output', (['"""dataset-dropdown"""',... |
# Generated by Django 3.2.5 on 2021-10-17 10:01
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('artisticmovements', '0002_auto_20211017_1102'),
]
operations = [
migrations.AlterField(
model_name='artwork',
name='... | [
"django.db.models.ManyToManyField"
] | [((353, 468), 'django.db.models.ManyToManyField', 'models.ManyToManyField', ([], {'help_text': '"""Select an art movement for this artwork"""', 'to': '"""artisticmovements.ArtMovement"""'}), "(help_text='Select an art movement for this artwork',\n to='artisticmovements.ArtMovement')\n", (375, 468), False, 'from djan... |
import logging
# Set up the logger
logger = logging.getLogger('jb-nvim')
# Use a console handler, set it to debug by default
logger_ch = logging.StreamHandler()
logger.setLevel(logging.INFO)
log_formatter = logging.Formatter(('%(levelname)s: %(asctime)s %(processName)s:%(process)d'
'... | [
"logging.getLogger",
"logging.Formatter",
"logging.StreamHandler"
] | [((45, 73), 'logging.getLogger', 'logging.getLogger', (['"""jb-nvim"""'], {}), "('jb-nvim')\n", (62, 73), False, 'import logging\n'), ((138, 161), 'logging.StreamHandler', 'logging.StreamHandler', ([], {}), '()\n', (159, 161), False, 'import logging\n'), ((208, 359), 'logging.Formatter', 'logging.Formatter', (['"""%(le... |
from django.db import transaction
from django.db.models import Q
from analysis.models import TagNode, Analysis, Tag
from analysis.tasks.variant_tag_tasks import analysis_tag_created_task, analysis_tag_deleted_task
def _analysis_tag_nodes_set_dirty(analysis: Analysis, tag: Tag):
""" Needs to be sync so version is... | [
"analysis.models.TagNode.objects.filter",
"django.db.models.Q",
"analysis.tasks.variant_tag_tasks.analysis_tag_created_task.si",
"analysis.tasks.variant_tag_tasks.analysis_tag_deleted_task.si"
] | [((407, 438), 'django.db.models.Q', 'Q', ([], {'tagnodetag__tag__isnull': '(True)'}), '(tagnodetag__tag__isnull=True)\n', (408, 438), False, 'from django.db.models import Q\n'), ((441, 463), 'django.db.models.Q', 'Q', ([], {'tagnodetag__tag': 'tag'}), '(tagnodetag__tag=tag)\n', (442, 463), False, 'from django.db.models... |
import sqlalchemy as db
from sqlalchemy.orm import relationship
from src.db import helper
from src.db.sqlalchemy import Base
from src.model.category import Category
class Local(Base):
__tablename__ = 'compra_local_local'
id = db.Column(db.Integer, helper.get_sequence(__tablename__), primary_key=True)
... | [
"sqlalchemy.orm.relationship",
"sqlalchemy.ForeignKey",
"src.db.helper.get_sequence",
"sqlalchemy.String",
"sqlalchemy.Column"
] | [((490, 525), 'sqlalchemy.Column', 'db.Column', (['db.Float'], {'nullable': '(False)'}), '(db.Float, nullable=False)\n', (499, 525), True, 'import sqlalchemy as db\n'), ((542, 577), 'sqlalchemy.Column', 'db.Column', (['db.Float'], {'nullable': '(False)'}), '(db.Float, nullable=False)\n', (551, 577), True, 'import sqlal... |
from django.db import models
# Cnreate your models here.
class posts(models.Model):
post = models.CharField(max_length=200)
summary = models.CharField(max_length=50)
author = models.CharField(max_length=50)
date = models.DateTimeField('date published')
title = models.CharField(max_length=50)
def __str__(self):... | [
"django.db.models.DateTimeField",
"django.db.models.CharField"
] | [((93, 125), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(200)'}), '(max_length=200)\n', (109, 125), False, 'from django.db import models\n'), ((137, 168), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(50)'}), '(max_length=50)\n', (153, 168), False, 'from django.db i... |
# -*- encoding: utf-8 -*-
'''
Copyright 2016 Amazon.com, Inc. or its affiliates. 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. A copy of the License is located at
http://aws.amazon.com/apache2.0/
or in the "l... | [
"json.loads",
"urllib2.urlopen",
"boto3.client",
"hashlib.md5",
"os.getenv"
] | [((1214, 1263), 'json.loads', 'json.loads', (["event['Records'][0]['Sns']['Message']"], {}), "(event['Records'][0]['Sns']['Message'])\n", (1224, 1263), False, 'import json\n'), ((1757, 1777), 'urllib2.urlopen', 'urllib2.urlopen', (['url'], {}), '(url)\n', (1772, 1777), False, 'import urllib2\n'), ((1817, 1830), 'hashli... |
from __future__ import annotations
import math
class Vector:
"""Class of 2D vector objects known from linear algebra"""
def __init__(self, x: float = 0, y: float = 0):
self.x = x
self.y = y
def add(self, vector: Vector):
self.x += vector.x
self.y += vector.y
def sub... | [
"math.pow"
] | [((845, 864), 'math.pow', 'math.pow', (['self.x', '(2)'], {}), '(self.x, 2)\n', (853, 864), False, 'import math\n'), ((867, 886), 'math.pow', 'math.pow', (['self.y', '(2)'], {}), '(self.y, 2)\n', (875, 886), False, 'import math\n'), ((1292, 1326), 'math.pow', 'math.pow', (['(vector1.x - vector2.x)', '(2)'], {}), '(vect... |
#!/usr/bin/env python3
from dotenv import load_dotenv, find_dotenv
# Load .env
load_dotenv(find_dotenv())
from api.server import app
app.run(debug=False)
| [
"api.server.app.run",
"dotenv.find_dotenv"
] | [((135, 155), 'api.server.app.run', 'app.run', ([], {'debug': '(False)'}), '(debug=False)\n', (142, 155), False, 'from api.server import app\n'), ((91, 104), 'dotenv.find_dotenv', 'find_dotenv', ([], {}), '()\n', (102, 104), False, 'from dotenv import load_dotenv, find_dotenv\n')] |
# Copyright 2021 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0
from django.test import TestCase, Client
from django.contrib.auth.models import User
from rest_framework import status
import mdot_rest.models as resource_models
import json
import datetime
from mock import patch
class ResourceTes... | [
"datetime.datetime",
"mdot_rest.models.UWResource.objects.create",
"mock.patch",
"json.loads",
"mdot_rest.models.ResourceLink.objects.create",
"mdot_rest.models.IntendedAudience.objects.create",
"django.test.Client"
] | [((383, 424), 'datetime.datetime', 'datetime.datetime', (['(1945)', '(11)', '(3)', '(12)', '(3)', '(34)'], {}), '(1945, 11, 3, 12, 3, 34)\n', (400, 424), False, 'import datetime\n'), ((3575, 3583), 'django.test.Client', 'Client', ([], {}), '()\n', (3581, 3583), False, 'from django.test import TestCase, Client\n'), ((43... |
from . import Regression
from ..tests import random_plane,scattered_plane
import numpy as N
def test_coordinates():
"""Tests coordinate length"""
plane,coefficients = random_plane()
fit = Regression(plane)
assert N.column_stack(plane).shape[0] == fit.C.shape[0]
def test_regression():
"""Make sure ... | [
"numpy.column_stack"
] | [((230, 251), 'numpy.column_stack', 'N.column_stack', (['plane'], {}), '(plane)\n', (244, 251), True, 'import numpy as N\n')] |
# Time-CNN
import tensorflow.keras as keras
import numpy as np
import time
class Classifier_CNN:
def __init__(self,input_shape, nb_classes):
self.model = self.build_model(input_shape, nb_classes)
def build_model(self, input_shape, nb_classes):
padding = 'valid'
input_layer = keras.l... | [
"tensorflow.keras.layers.Input",
"tensorflow.keras.layers.AveragePooling1D",
"tensorflow.keras.layers.Dense",
"tensorflow.keras.models.Model",
"tensorflow.keras.layers.Flatten",
"tensorflow.keras.layers.Conv1D"
] | [((313, 344), 'tensorflow.keras.layers.Input', 'keras.layers.Input', (['input_shape'], {}), '(input_shape)\n', (331, 344), True, 'import tensorflow.keras as keras\n'), ((960, 1020), 'tensorflow.keras.models.Model', 'keras.models.Model', ([], {'inputs': 'input_layer', 'outputs': 'output_layer'}), '(inputs=input_layer, o... |
# Copyright 2020 DeepMind Technologies Limited.
#
# 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 ag... | [
"numpy.prod",
"numpy.int32",
"cv2.imshow",
"numpy.array",
"cv2.destroyAllWindows",
"cv2.drawMarker",
"cv2.resizeWindow",
"cv2.multiply",
"cv2.line",
"cv2.contourArea",
"cv2.setWindowTitle",
"cv2.arrowedLine",
"cv2.waitKey",
"numpy.round",
"cv2.drawContours",
"numpy.ones",
"cv2.setTra... | [((2029, 2044), 'numpy.array', 'np.array', (['scale'], {}), '(scale)\n', (2037, 2044), True, 'import numpy as np\n'), ((5028, 5065), 'cv2.resize', 'cv2.resize', (['image', '(size[1], size[0])'], {}), '(image, (size[1], size[0]))\n', (5038, 5065), False, 'import cv2\n'), ((5165, 5270), 'cv2.fastNlMeansDenoisingColored',... |
from models.posts import (
BaseCreatePostModel,
BaseDeletePostModel,
CreatePostModel,
ReturnPostModel,
)
from core.errors import ConflictError
import sqlite3
from models.user import UserModel
class PostsCRUD:
def create(
self, conn: sqlite3.Connection, data: BaseCreatePostMode... | [
"core.errors.ConflictError",
"models.posts.ReturnPostModel"
] | [((1279, 1326), 'core.errors.ConflictError', 'ConflictError', (['"""Action was interrupted by user"""'], {}), "('Action was interrupted by user')\n", (1292, 1326), False, 'from core.errors import ConflictError\n'), ((1806, 1905), 'models.posts.ReturnPostModel', 'ReturnPostModel', ([], {'id': 'id', 'creator': 'creator',... |
import multiprocessing
import os
import subprocess
from typing import List
ALLOWED_EXTENSIONS = {'.rxn': 'AAM', '.mol': 'MET'}
class Images(object):
"""Images class for the generation of images from chemical files."""
def __init__(self, input_path: str, output_path: str) -> None:
"""Initialize the Im... | [
"os.listdir",
"os.path.splitext",
"multiprocessing.cpu_count",
"subprocess.call",
"multiprocessing.Pool"
] | [((1689, 1716), 'multiprocessing.cpu_count', 'multiprocessing.cpu_count', ([], {}), '()\n', (1714, 1716), False, 'import multiprocessing\n'), ((1732, 1769), 'multiprocessing.Pool', 'multiprocessing.Pool', ([], {'processes': 'count'}), '(processes=count)\n', (1752, 1769), False, 'import multiprocessing\n'), ((2093, 2120... |
from django.contrib.auth import get_user_model
import django_filters
from .models import Ticket, Project, Team
from django.forms import DateInput
User = get_user_model()
class TicketFilter(django_filters.FilterSet):
# STATUS_CHOICES = (
# ('open', 'Open'),
# ('assigned', 'Assigned'),
# ('i... | [
"django.contrib.auth.get_user_model",
"django_filters.CharFilter",
"django.forms.DateInput"
] | [((154, 170), 'django.contrib.auth.get_user_model', 'get_user_model', ([], {}), '()\n', (168, 170), False, 'from django.contrib.auth import get_user_model\n'), ((552, 602), 'django_filters.CharFilter', 'django_filters.CharFilter', ([], {'lookup_expr': '"""icontains"""'}), "(lookup_expr='icontains')\n", (577, 602), Fals... |
import pandas as pd
import numpy as np
class PayoffMatrix():
def __init__(self, sim):
self.sim = sim
self.matrix = np.zeros(shape=(len(self.sim.subclones), len(self.sim.subclones)))
self.populate_matrix(self.sim.t)
def populate_matrix(self, t):
treatments = self.sim.treatments... | [
"pandas.DataFrame",
"numpy.dot"
] | [((813, 864), 'pandas.DataFrame', 'pd.DataFrame', (['self.matrix'], {'index': 'labs', 'columns': 'labs'}), '(self.matrix, index=labs, columns=labs)\n', (825, 864), True, 'import pandas as pd\n'), ((450, 497), 'numpy.dot', 'np.dot', (['self.sim.subclones[j].alpha', 'treatments'], {}), '(self.sim.subclones[j].alpha, trea... |
import re
# FIXME: depends on builtin_signed
######## COMMON API ##########
E_INTEGER = 'INT'
E_STRING = 'STR'
E_BIN_RAW = 'RAW'
E_BLOCK = 'BLK'
E_BUILTIN_FUNC = 'BUILTIN'
E_NEEDS_WORK = 'NEEDS_WORK'
def e_needs_work(length=None):
return {'len': length, 'final': False, 'type':E_NEEDS_WORK, 'data': None}
... | [
"re.compile"
] | [((2346, 2387), 're.compile', 're.compile', (['"""\\\\[rbp\\\\+(?P<mul>[0-9]+)\\\\]"""'], {}), "('\\\\[rbp\\\\+(?P<mul>[0-9]+)\\\\]')\n", (2356, 2387), False, 'import re\n')] |
from django.contrib import messages
from django.shortcuts import render, redirect, get_object_or_404
from .forms import BookModelForm
from .models import BookModel
def index(request):
all_books = BookModel.objects.all()
return render(request, 'index.html', {'books': all_books})
def create(request):
con... | [
"django.shortcuts.render",
"django.shortcuts.redirect",
"django.shortcuts.get_object_or_404",
"django.contrib.messages.success"
] | [((238, 289), 'django.shortcuts.render', 'render', (['request', '"""index.html"""', "{'books': all_books}"], {}), "(request, 'index.html', {'books': all_books})\n", (244, 289), False, 'from django.shortcuts import render, redirect, get_object_or_404\n'), ((500, 539), 'django.shortcuts.render', 'render', (['request', '"... |
######################## SYSTEM TEST ########################
"""
This test is meant to test the nested strands, where the parent strand regs are visible to
child process, if the regs are followed by a '.'
"""
###########################################################
import simpy
import sys
from copy import... | [
"fate.utils.graph.Graph",
"fate.parameters.Parameters",
"fate.DUT.accelerator.Accelerator",
"sys.exit",
"fate.DUT.logger.Logger",
"simpy.Environment",
"fate.utils.graph_functions.reference_intersection",
"fate.DUT.addrSpace.AddrSpace",
"fate.utils.example_generator.create_vector",
"fate.utils.prel... | [((795, 825), 'fate.utils.example_generator.create_vector', 'create_vector', (['length', 'density'], {}), '(length, density)\n', (808, 825), False, 'from fate.utils.example_generator import create_vector\n'), ((841, 871), 'fate.utils.example_generator.create_vector', 'create_vector', (['length', 'density'], {}), '(leng... |
from importlib import import_module
from django.conf import settings as dj_settings
from django.db import models
DEFAULTS = {
'OBFUSCATOR_CLASS': 'obfuscator.utils.ObfuscatorUtils',
'FIELDS_MAPPING': {
models.CharField: 'text',
models.TextField: 'text',
models.EmailField: 'email',
... | [
"importlib.import_module"
] | [((656, 682), 'importlib.import_module', 'import_module', (['module_path'], {}), '(module_path)\n', (669, 682), False, 'from importlib import import_module\n')] |
# setup.py
from setuptools import setup
from distutils.util import convert_path
# from sphinx.setup_command import BuildDoc
name = 'ArgDoc'
main_ns = {}
ver_path = convert_path('argdoc/version.py')
with open(ver_path) as ver_file:
exec(ver_file.read(), main_ns)
with open('README.md', 'r') as rm:
long_descri... | [
"setuptools.setup",
"distutils.util.convert_path"
] | [((167, 200), 'distutils.util.convert_path', 'convert_path', (['"""argdoc/version.py"""'], {}), "('argdoc/version.py')\n", (179, 200), False, 'from distutils.util import convert_path\n'), ((784, 1480), 'setuptools.setup', 'setup', ([], {'name': 'name', 'version': "main_ns['__version__']", 'author': '"""<NAME>"""', 'aut... |
import torch
import torch.nn as nn
import torchvision.models as models
class EncoderCNN(nn.Module):
def __init__(self, embed_size):
super(EncoderCNN, self).__init__()
resnet = models.resnet50(pretrained=True)
for param in resnet.parameters():
param.requires_grad_(False)
... | [
"torch.nn.Sequential",
"torch.nn.LSTM",
"torch.cat",
"torch.nn.Linear",
"torch.nn.LogSoftmax",
"torchvision.models.resnet50",
"torch.nn.Embedding"
] | [((198, 230), 'torchvision.models.resnet50', 'models.resnet50', ([], {'pretrained': '(True)'}), '(pretrained=True)\n', (213, 230), True, 'import torchvision.models as models\n'), ((391, 414), 'torch.nn.Sequential', 'nn.Sequential', (['*modules'], {}), '(*modules)\n', (404, 414), True, 'import torch.nn as nn\n'), ((436,... |
##Generate patches from a large raster##
"""preprocessing model for creating a non-overlapping sliding window of fixed size to generate tfrecords for model training"""
import rasterio
import tensorflow as tf
import numpy as np
def extract_patches(image, width, height):
# The size of sliding window
ksizes = [1... | [
"tensorflow.expand_dims",
"tensorflow.squeeze",
"tensorflow.image.extract_patches"
] | [((794, 818), 'tensorflow.expand_dims', 'tf.expand_dims', (['image', '(0)'], {}), '(image, 0)\n', (808, 818), True, 'import tensorflow as tf\n'), ((839, 903), 'tensorflow.image.extract_patches', 'tf.image.extract_patches', (['image', 'ksizes', 'strides', 'rates', 'padding'], {}), '(image, ksizes, strides, rates, paddin... |
from PySide.QtCore import *
from PySide.QtGui import *
from PySide.QtUiTools import *
import plugin.databaseConnect as database
import plugin.image as imageHandle
class editProfileUI(QMainWindow):
def __init__(self,parent = None):
QMainWindow.__init__(self,None)
self.setMinimumSize(770,415)
... | [
"plugin.databaseConnect.databaseLogin",
"plugin.databaseConnect.databaseUser"
] | [((3117, 3140), 'plugin.databaseConnect.databaseUser', 'database.databaseUser', ([], {}), '()\n', (3138, 3140), True, 'import plugin.databaseConnect as database\n'), ((3162, 3186), 'plugin.databaseConnect.databaseLogin', 'database.databaseLogin', ([], {}), '()\n', (3184, 3186), True, 'import plugin.databaseConnect as d... |
import argparse
from src.utils.logger import Logger
class CustomFormatter(
argparse.ArgumentDefaultsHelpFormatter, argparse.RawDescriptionHelpFormatter
):
pass
class CustomArgumentParser(argparse.ArgumentParser):
def __init__(self, *args, **kwargs):
super().__init__(
formatter_class... | [
"argparse.ArgumentParser"
] | [((475, 530), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '""""""', 'add_help': '(False)'}), "(description='', add_help=False)\n", (498, 530), False, 'import argparse\n')] |
from typing import Union
from beartype import beartype
from UQpy.sampling.adaptive_kriging_functions.baseclass.LearningFunction import (
LearningFunction,
)
import scipy.stats as stats
class ExpectedFeasibility(LearningFunction):
@beartype
def __init__(
self,
eff_a: Union[float, int] = ... | [
"scipy.stats.norm.cdf",
"scipy.stats.norm.pdf"
] | [((1441, 1459), 'scipy.stats.norm.cdf', 'stats.norm.cdf', (['t3'], {}), '(t3)\n', (1455, 1459), True, 'import scipy.stats as stats\n'), ((1539, 1557), 'scipy.stats.norm.pdf', 'stats.norm.pdf', (['t3'], {}), '(t3)\n', (1553, 1557), True, 'import scipy.stats as stats\n'), ((1580, 1598), 'scipy.stats.norm.cdf', 'stats.nor... |
import os.path
import site
# add `lib` subdirectory as a site packages directory, so our `main` module can load
# third-party libraries.
site.addsitedir(os.path.join(os.path.dirname(__file__), 'lib'))
import logging
import os
from paste.deploy import loadapp
from pyramid.paster import (
setup_logging,
get_app... | [
"logging.getLogger",
"asgiref.wsgi.WsgiToAsgi",
"os.environ.get",
"multiprocessing.cpu_count",
"os.path.realpath",
"os.path.dirname"
] | [((366, 393), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (383, 393), False, 'import logging\n'), ((818, 833), 'asgiref.wsgi.WsgiToAsgi', 'WsgiToAsgi', (['app'], {}), '(app)\n', (828, 833), False, 'from asgiref.wsgi import WsgiToAsgi\n'), ((167, 192), 'os.path.dirname', 'os.path.dirnam... |
import pandas as pd
import numpy as np
import itertools
from matplotlib import cm
import matplotlib.pyplot as plt
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection import GridSearchCV
from sklearn.metrics import confusion_matrix, make_scorer, roc_auc_score, average_precision_score, classifi... | [
"sklearn.model_selection.GridSearchCV",
"matplotlib.pyplot.ylabel",
"sklearn.metrics.classification_report",
"numpy.array",
"sklearn.metrics.roc_curve",
"matplotlib.pyplot.imshow",
"sklearn.linear_model.SGDClassifier",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.yticks... | [((5901, 5959), 'sklearn.linear_model.SGDClassifier', 'SGDClassifier', ([], {'loss': '"""log"""', 'penalty': '"""elasticnet"""', 'n_jobs': '(-1)'}), "(loss='log', penalty='elasticnet', n_jobs=-1)\n", (5914, 5959), False, 'from sklearn.linear_model import LogisticRegression, SGDClassifier\n'), ((5976, 6034), 'sklearn.mo... |
#!/usr/bin/env python3
import os
import re
import cv2
import keras
import numpy as np
import pandas as pd
DATA_PATH = 'cage/images/'
LEFT_PATH = 'data/left.h5'
RIGHT_PATH = 'data/right.h5'
NUM_PATH = 'data/numbers.csv'
DataSet = (np.ndarray, np.ndarray, np.ndarray)
def extract() -> (list, list):
l_data, r_data... | [
"os.path.exists",
"keras.layers.Conv2D",
"keras.models.load_model",
"keras.layers.Flatten",
"keras.layers.MaxPooling2D",
"pandas.DataFrame",
"re.match",
"numpy.array",
"keras.layers.Dropout",
"keras.layers.Dense",
"keras.models.clone_model",
"cv2.imread",
"os.walk",
"numpy.random.shuffle"
... | [((389, 422), 'os.walk', 'os.walk', (['DATA_PATH'], {'topdown': '(False)'}), '(DATA_PATH, topdown=False)\n', (396, 422), False, 'import os\n'), ((1154, 1179), 'numpy.random.shuffle', 'np.random.shuffle', (['l_full'], {}), '(l_full)\n', (1171, 1179), True, 'import numpy as np\n'), ((1184, 1209), 'numpy.random.shuffle', ... |
import numpy as np
import termcolor
import cnc_structs
def string_array_to_char_array(m):
c = np.array([x.decode('ascii')[0] if len(x) > 0 else ' ' for x in m.flat]).reshape(m.shape)
return '\n'.join(map(''.join, c))
def staticmap_array(map: cnc_structs.CNCMapDataStruct) -> np.ndarray:
tile_names = np.... | [
"numpy.array",
"numpy.zeros",
"termcolor.colored"
] | [((317, 376), 'numpy.zeros', 'np.zeros', (['(map.MapCellHeight * map.MapCellWidth)'], {'dtype': '"""S32"""'}), "(map.MapCellHeight * map.MapCellWidth, dtype='S32')\n", (325, 376), True, 'import numpy as np\n'), ((628, 701), 'numpy.zeros', 'np.zeros', (['(static_map.MapCellHeight, static_map.MapCellWidth)'], {'dtype': '... |
import csv
# Основные ф-и и классы этого пакета:
# ф-я csv.reader
# ф-я csv.writer
# Производят чтение и записть из листа в лист
# класс csv.DictWriter
# класс csv.DictReader
# Более мощные по функционалу. Это чтение и запись в объект типа Словарь/Dict
# -------------------------- Открытие и чтение ------------------... | [
"csv.DictReader",
"csv.reader"
] | [((483, 499), 'csv.reader', 'csv.reader', (['file'], {}), '(file)\n', (493, 499), False, 'import csv\n'), ((2458, 2474), 'csv.reader', 'csv.reader', (['file'], {}), '(file)\n', (2468, 2474), False, 'import csv\n'), ((3022, 3038), 'csv.reader', 'csv.reader', (['file'], {}), '(file)\n', (3032, 3038), False, 'import csv\n... |
# ---------------------------------------------------------------------#
# Configuration file for running the Campbell-Diaz model and optimizer #
# #
# <NAME> and <NAME>, Wageningen 2020 #
#-------------------------------------------... | [
"os.path.dirname",
"os.path.join",
"yaml.safe_load"
] | [((392, 417), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (407, 417), False, 'import sys, os\n'), ((429, 454), 'os.path.dirname', 'os.path.dirname', (['this_dir'], {}), '(this_dir)\n', (444, 454), False, 'import sys, os\n'), ((467, 496), 'os.path.join', 'os.path.join', (['top_dir', '"""dat... |
# -*- coding: utf-8 -*-
from bottle import route, run, template, static_file, url
import json
import math
import weather_data
# Read a "css" & "js"
@route('/static/<filepath:path>',name='static_file')
def static(filepath):
return static_file(filepath, root='./static')
# Get the temperature and humidity from URL
... | [
"bottle.static_file",
"bottle.template",
"weather_data.get_weather",
"bottle.route",
"math.trunc",
"bottle.run"
] | [((150, 202), 'bottle.route', 'route', (['"""/static/<filepath:path>"""'], {'name': '"""static_file"""'}), "('/static/<filepath:path>', name='static_file')\n", (155, 202), False, 'from bottle import route, run, template, static_file, url\n'), ((321, 363), 'bottle.route', 'route', (['"""/<temperature:int>/<humidity:int>... |
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2018-2019 Fetch.AI Limited
#
# 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 ... | [
"aea.decision_maker.base.DecisionMaker",
"aea.decision_maker.messages.state_update.StateUpdateMessage",
"aea.decision_maker.base.OwnershipState",
"aea.mail.base.OutBox",
"aea.protocols.default.message.DefaultMessage",
"os.path.join",
"aea.decision_maker.base.Preferences",
"aea.crypto.wallet.Wallet",
... | [((1688, 1704), 'aea.decision_maker.base.OwnershipState', 'OwnershipState', ([], {}), '()\n', (1702, 1704), False, 'from aea.decision_maker.base import OwnershipState, Preferences, DecisionMaker\n'), ((1731, 1744), 'aea.decision_maker.base.Preferences', 'Preferences', ([], {}), '()\n', (1742, 1744), False, 'from aea.de... |
###############################################################################
# Copyright 2013 The University of Texas at Austin #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); #... | [
"datetime.datetime.strptime",
"ipf.error.StepError"
] | [((17891, 17946), 'datetime.datetime.strptime', 'datetime.datetime.strptime', (['dtStr', '"""%Y-%m-%dT%H:%M:%SZ"""'], {}), "(dtStr, '%Y-%m-%dT%H:%M:%SZ')\n", (17917, 17946), False, 'import datetime\n'), ((2726, 2823), 'ipf.error.StepError', 'StepError', (['"""username parameter not provided and OS_USERNAME not set in t... |
import os
import sys
import unittest
relative_path = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
if relative_path not in sys.path:
sys.path.insert(0, relative_path)
from onesaitplatform.auth.token import Token
from onesaitplatform.auth.authclient import AuthClient
class AuthClientTest(unittest.Te... | [
"sys.path.insert",
"onesaitplatform.auth.token.Token.from_json",
"onesaitplatform.auth.authclient.AuthClient",
"onesaitplatform.auth.token.Token",
"onesaitplatform.auth.authclient.AuthClient.from_json",
"os.path.dirname",
"unittest.main",
"unittest.skip"
] | [((151, 184), 'sys.path.insert', 'sys.path.insert', (['(0)', 'relative_path'], {}), '(0, relative_path)\n', (166, 184), False, 'import sys\n'), ((3668, 3715), 'unittest.skip', 'unittest.skip', (['"""Real credentials are necessary"""'], {}), "('Real credentials are necessary')\n", (3681, 3715), False, 'import unittest\n... |