code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('security', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='loggedrequest',
name='request_timestamp',
field=models.DateTimeField(verb... | [
"django.db.models.DateTimeField"
] | [((295, 364), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'verbose_name': '"""Request timestamp"""', 'db_index': '(True)'}), "(verbose_name='Request timestamp', db_index=True)\n", (315, 364), False, 'from django.db import migrations, models\n')] |
#!/usr/bin/python
#
# Copyright (c) 2017-2019 NVIDIA CORPORATION. All rights reserved.
# This file is part of the objectio library.
# See the LICENSE file for licensing terms (BSD-style).
#
__all__ = "objopen gopen config".split()
import os
import sys
import time
import subprocess
import yaml
import io
from urllib.pa... | [
"os.path.exists",
"urllib.parse.urlparse",
"yaml.dump",
"subprocess.Popen",
"os.environ.get",
"yaml.load",
"time.sleep",
"os.path.dirname",
"os.path.basename",
"os.path.abspath",
"io.StringIO"
] | [((630, 680), 'os.environ.get', 'os.environ.get', (["(ENV_PREFIX + 'PATH')", 'objectio_PATH'], {}), "(ENV_PREFIX + 'PATH', objectio_PATH)\n", (644, 680), False, 'import os\n'), ((432, 473), 'os.environ.get', 'os.environ.get', (["(ENV_PREFIX + 'DEBUG')", '"""0"""'], {}), "(ENV_PREFIX + 'DEBUG', '0')\n", (446, 473), Fals... |
import BSPy
def hello_proc(bsp: BSPy.BSPObject):
# Get the data we need about the BSP instance
cores = bsp.cores
pid = bsp.pid
# Queue all messages for sending
for destination in range(cores):
bsp.send("Hello from proc %d to proc %d"%(pid, destination), pid=destination)
# Synchronise ... | [
"BSPy.run"
] | [((492, 515), 'BSPy.run', 'BSPy.run', (['hello_proc', '(2)'], {}), '(hello_proc, 2)\n', (500, 515), False, 'import BSPy\n')] |
# To generate the random input for the computer's choice.
from random import randint
# Allows a natural delay to make the game seem more normal.
from time import sleep
def choice_logic(num):
"""
Based on a numeric value this function will assign the value
to an option which will be either rock, paper or s... | [
"random.randint",
"time.sleep"
] | [((1327, 1338), 'time.sleep', 'sleep', (['(0.75)'], {}), '(0.75)\n', (1332, 1338), False, 'from time import sleep\n'), ((1207, 1220), 'random.randint', 'randint', (['(1)', '(3)'], {}), '(1, 3)\n', (1214, 1220), False, 'from random import randint\n'), ((2883, 2894), 'time.sleep', 'sleep', (['(0.75)'], {}), '(0.75)\n', (... |
from rest_framework import serializers
class BaseSerializer(serializers.Serializer):
'''
Base serializer
'''
id = serializers.CharField(read_only=True)
created_at = serializers.DateTimeField(read_only=True)
updated_at = serializers.DateTimeField(read_only=True)
deleted_at = serializers.Dat... | [
"rest_framework.serializers.DateTimeField",
"rest_framework.serializers.CharField",
"rest_framework.serializers.BooleanField"
] | [((132, 169), 'rest_framework.serializers.CharField', 'serializers.CharField', ([], {'read_only': '(True)'}), '(read_only=True)\n', (153, 169), False, 'from rest_framework import serializers\n'), ((187, 228), 'rest_framework.serializers.DateTimeField', 'serializers.DateTimeField', ([], {'read_only': '(True)'}), '(read_... |
from typing import Union, Iterable
import torch
import torch.nn.functional as F
def cross_entropy(
outs: torch.Tensor,
labels: torch.Tensor,
reduction: str = "mean"
) -> torch.Tensor:
"""
cross entropy with logits
"""
return F.cross_entropy(outs, labels, reduction=reduction)
def cross... | [
"torch.nn.functional.mse_loss",
"torch.norm",
"torch.nn.functional.log_softmax",
"torch.nn.functional.cross_entropy",
"torch.nn.functional.kl_div",
"torch.nn.functional.softmax"
] | [((259, 309), 'torch.nn.functional.cross_entropy', 'F.cross_entropy', (['outs', 'labels'], {'reduction': 'reduction'}), '(outs, labels, reduction=reduction)\n', (274, 309), True, 'import torch.nn.functional as F\n'), ((826, 855), 'torch.nn.functional.log_softmax', 'F.log_softmax', (['logits'], {'dim': '(-1)'}), '(logit... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
@author: sharpdeep
@file:model.py
@time: 2016-01-02 00:19
"""
from core import util
from core.status import *
from datetime import datetime
from mongoengine import *
from conf.config import configs
from datetime import datetime
import time
connect(configs.db.name) #连接mon... | [
"datetime.datetime",
"datetime.datetime.now",
"datetime.datetime.strftime",
"datetime.datetime.strptime"
] | [((1259, 1307), 'datetime.datetime.strftime', 'datetime.strftime', (['self.leave_date', '"""%Y年%m月%d日 """'], {}), "(self.leave_date, '%Y年%m月%d日 ')\n", (1276, 1307), False, 'from datetime import datetime\n'), ((5822, 6017), 'datetime.datetime', 'datetime', ([], {'year': 'leave_date.year', 'month': 'leave_date.month', 'd... |
import FWCore.ParameterSet.Config as cms
# Configuration parameters for Method 2
m2Parameters = cms.PSet(
applyPedConstraint = cms.bool(True),
applyTimeConstraint = cms.bool(True),
applyPulseJitter = cms.bool(False),
applyTimeSlew = cms.bool(True), #units
ts4Min ... | [
"FWCore.ParameterSet.Config.vdouble",
"FWCore.ParameterSet.Config.int32",
"FWCore.ParameterSet.Config.double",
"FWCore.ParameterSet.Config.bool"
] | [((136, 150), 'FWCore.ParameterSet.Config.bool', 'cms.bool', (['(True)'], {}), '(True)\n', (144, 150), True, 'import FWCore.ParameterSet.Config as cms\n'), ((180, 194), 'FWCore.ParameterSet.Config.bool', 'cms.bool', (['(True)'], {}), '(True)\n', (188, 194), True, 'import FWCore.ParameterSet.Config as cms\n'), ((224, 23... |
#!/usr/bin/env python
"""config_puppet.py: Arquivo inicializa objeto api"""
from flask_restx import Api
api = Api(
version="0.2",
title="API_Ciclope_Puppets",
description="Api responsável por interfacear dispositivos de controle de acesso.",
terms_url="/",
contact="<EMAIL>",
# l... | [
"flask_restx.Api"
] | [((121, 502), 'flask_restx.Api', 'Api', ([], {'version': '"""0.2"""', 'title': '"""API_Ciclope_Puppets"""', 'description': '"""Api responsável por interfacear dispositivos de controle de acesso."""', 'terms_url': '"""/"""', 'contact': '"""<EMAIL>"""', 'license_url': '"""192.168.10.81:5020"""', 'default': '"""Ciclope"""... |
#!/usr/bin/env python
# coding=utf-8
import tensorflow as tf
import numpy as np
tf.compat.v1.disable_eager_execution()
a = tf.random.normal(shape=[10], dtype=tf.float32)
with tf.device("/MY_DEVICE:0"):
eagle = tf.bitcast(a, tf.float16)
with tf.device("/CPU:0"):
cpu = tf.bitcast(a, tf.float16)
sess = tf.compa... | [
"tensorflow.compat.v1.ConfigProto",
"tensorflow.device",
"tensorflow.random.normal",
"tensorflow.bitcast",
"tensorflow.compat.v1.disable_eager_execution",
"tensorflow.less"
] | [((80, 118), 'tensorflow.compat.v1.disable_eager_execution', 'tf.compat.v1.disable_eager_execution', ([], {}), '()\n', (116, 118), True, 'import tensorflow as tf\n'), ((123, 169), 'tensorflow.random.normal', 'tf.random.normal', ([], {'shape': '[10]', 'dtype': 'tf.float32'}), '(shape=[10], dtype=tf.float32)\n', (139, 16... |
# Copyright 2017 <NAME>. and
# Cable Television Laboratories, Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | [
"logging.getLogger",
"os.path.realpath",
"snaps_openstack.provision.openstack.plugin.kolla_impl.kolla_utils.clean_up",
"snaps_openstack.provision.openstack.plugin.kolla_impl.kolla_utils.main",
"sys.path.append",
"snaps_openstack.provision.openstack.plugin.kolla_impl.kolla_utils.upgrade_downgrade_cluster"
... | [((736, 769), 'logging.getLogger', 'logging.getLogger', (['"""deploy_infra"""'], {}), "('deploy_infra')\n", (753, 769), False, 'import logging\n'), ((1118, 1146), 'sys.path.append', 'sys.path.append', (['plugin_path'], {}), '(plugin_path)\n', (1133, 1146), False, 'import sys\n'), ((1017, 1043), 'os.path.realpath', 'os.... |
from django.template.library import Library
from snpdb.templatetags.related_data_tags import related_data_context
register = Library()
@register.inclusion_tag("pathtests/tags/related_data_for_case.html", takes_context=True)
def related_data_for_case(context, case):
samples = case.patient.get_samples()
conte... | [
"snpdb.templatetags.related_data_tags.related_data_context",
"django.template.library.Library"
] | [((127, 136), 'django.template.library.Library', 'Library', ([], {}), '()\n', (134, 136), False, 'from django.template.library import Library\n'), ((330, 368), 'snpdb.templatetags.related_data_tags.related_data_context', 'related_data_context', (['context', 'samples'], {}), '(context, samples)\n', (350, 368), False, 'f... |
from setuptools import setup
from setuptools import find_packages
setup(
name='csv_utils',
version='0.0.2',
url='https://github.com/Augusto94/csv_utils',
license='MIT',
author='<NAME>',
author_email='<EMAIL>',
description='Python and CSV as never',
keywords=['python', 'csv', 'reader', ... | [
"setuptools.find_packages"
] | [((344, 359), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (357, 359), False, 'from setuptools import find_packages\n')] |
from tqdm import tqdm #pip install tqdm
import time
def complicated_function():
time.sleep(2) #Simulating some complicated processing
for i in tqdm(range(100)):
complicated_function() | [
"time.sleep"
] | [((89, 102), 'time.sleep', 'time.sleep', (['(2)'], {}), '(2)\n', (99, 102), False, 'import time\n')] |
# Copyright (C) 2014 Universidad Politecnica de Madrid
#
# 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 la... | [
"keystone.exception.NotImplemented",
"six.add_metaclass",
"keystone.common.extension.register_public_extension",
"keystone.openstack.common.log.getLogger",
"keystone.common.extension.register_admin_extension",
"keystone.common.dependency.requires",
"keystone.common.dependency.provider"
] | [((855, 878), 'keystone.openstack.common.log.getLogger', 'log.getLogger', (['__name__'], {}), '(__name__)\n', (868, 878), False, 'from keystone.openstack.common import log\n'), ((1446, 1521), 'keystone.common.extension.register_admin_extension', 'extension.register_admin_extension', (["EXTENSION_DATA['alias']", 'EXTENS... |
import matplotlib.pyplot as plt
plt.rcParams.update({
'xtick.labelsize': 20,
'xtick.major.size': 10,
'ytick.labelsize': 20,
'ytick.major.size': 10,
'font.size': 20,
'axes.labelsize': 20,
'axes.titlesize': 15,
'legend.fontsize': 14,
'figure.subplot.wspace': 0.4,
'figure.subp... | [
"matplotlib.pyplot.rcParams.update"
] | [((33, 336), 'matplotlib.pyplot.rcParams.update', 'plt.rcParams.update', (["{'xtick.labelsize': 20, 'xtick.major.size': 10, 'ytick.labelsize': 20,\n 'ytick.major.size': 10, 'font.size': 20, 'axes.labelsize': 20,\n 'axes.titlesize': 15, 'legend.fontsize': 14, 'figure.subplot.wspace': \n 0.4, 'figure.subplot.hsp... |
# -*- coding: utf-8 -*-
# snapshottest: v1 - https://goo.gl/zC4yUc
from __future__ import unicode_literals
from snapshottest import Snapshot
snapshots = Snapshot()
snapshots['MetadataSetsGraphQLTestCase::test_getting_metadata_sets 1'] = {
'data': {
'metadataSets': {
'edges': [
... | [
"snapshottest.Snapshot"
] | [((156, 166), 'snapshottest.Snapshot', 'Snapshot', ([], {}), '()\n', (164, 166), False, 'from snapshottest import Snapshot\n')] |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import os
import json
import threading
import io
import numpy as np
import mlflow
from flask import send_file
from PIL import Image
from queue import Queue
from backwardcompatibilityml.helpers import training
from backwardcompatibilityml.metrics ... | [
"os.path.exists",
"PIL.Image.fromarray",
"io.BytesIO",
"numpy.zeros",
"flask.send_file",
"threading.Thread",
"queue.Queue",
"backwardcompatibilityml.helpers.training.compatibility_sweep"
] | [((5589, 5596), 'queue.Queue', 'Queue', ([], {}), '()\n', (5594, 5596), False, 'from queue import Queue\n'), ((5745, 5752), 'queue.Queue', 'Queue', ([], {}), '()\n', (5750, 5752), False, 'from queue import Queue\n'), ((5818, 6569), 'threading.Thread', 'threading.Thread', ([], {'target': 'training.compatibility_sweep', ... |
import logging.config
import os
import structlog
from node_launcher.constants import NODE_LAUNCHER_DATA_PATH, OPERATING_SYSTEM
timestamper = structlog.processors.TimeStamper(fmt='%Y-%m-%d %H:%M:%S')
pre_chain = [
# Add the log level and a timestamp to the event_dict if the log entry
# is not from structlog.
... | [
"structlog.get_logger",
"structlog.stdlib.LoggerFactory",
"structlog.dev.ConsoleRenderer",
"os.path.join",
"structlog.processors.StackInfoRenderer",
"structlog.processors.TimeStamper",
"structlog.stdlib.PositionalArgumentsFormatter"
] | [((144, 201), 'structlog.processors.TimeStamper', 'structlog.processors.TimeStamper', ([], {'fmt': '"""%Y-%m-%d %H:%M:%S"""'}), "(fmt='%Y-%m-%d %H:%M:%S')\n", (176, 201), False, 'import structlog\n'), ((2196, 2218), 'structlog.get_logger', 'structlog.get_logger', ([], {}), '()\n', (2216, 2218), False, 'import structlog... |
# -*- coding: utf-8 -*-
import pytest
import json
import crime_data.common.credentials as c
class TestCredentialsUnit:
"""Tests for the credentials class"""
def test_credentials_lookup_when_undefined(self, monkeypatch):
monkeypatch.delenv('VCAP_SERVICES', raising=False)
c.service_credentials.c... | [
"crime_data.common.credentials.service_credentials.cache_clear",
"json.dumps",
"pytest.raises",
"crime_data.common.credentials.get_credential",
"crime_data.common.credentials.service_credentials"
] | [((297, 332), 'crime_data.common.credentials.service_credentials.cache_clear', 'c.service_credentials.cache_clear', ([], {}), '()\n', (330, 332), True, 'import crime_data.common.credentials as c\n'), ((794, 829), 'crime_data.common.credentials.service_credentials.cache_clear', 'c.service_credentials.cache_clear', ([], ... |
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 27 13:49:16 2021
@author: luis
"""
# Plantilla de pre-procesado #
# Cómo importar las librerías
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# Importar el dataset a Spyder
dataset = pd.read_csv('Data.csv') # Definir la ubicación del archivo
# ... | [
"sklearn.preprocessing.LabelEncoder",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"sklearn.preprocessing.OneHotEncoder",
"sklearn.preprocessing.StandardScaler",
"sklearn.impute.SimpleImputer"
] | [((259, 282), 'pandas.read_csv', 'pd.read_csv', (['"""Data.csv"""'], {}), "('Data.csv')\n", (270, 282), True, 'import pandas as pd\n'), ((826, 890), 'sklearn.impute.SimpleImputer', 'SimpleImputer', ([], {'missing_values': 'np.nan', 'strategy': '"""mean"""', 'verbose': '(0)'}), "(missing_values=np.nan, strategy='mean', ... |
from .__init__ import EntroQ
from . import entroq_pb2 as pb
import click
import datetime
from datetime import timezone
import grpc
import json
from google.protobuf import json_format
class _ClickContext: pass
def _task_str_raw(task):
return EntroQ.to_dict(task)
def _task_str_json(task):
return EntroQ.to_... | [
"datetime.datetime.fromtimestamp",
"click.group",
"click.option",
"json.dumps",
"google.protobuf.json_format.MessageToDict",
"google.protobuf.json_format.MessageToJson"
] | [((353, 366), 'click.group', 'click.group', ([], {}), '()\n', (364, 366), False, 'import click\n'), ((368, 474), 'click.option', 'click.option', (['"""--svcaddr"""'], {'default': '"""localhost:37706"""', 'show_default': '(True)', 'help': '"""EntroQ service address"""'}), "('--svcaddr', default='localhost:37706', show_d... |
import re
class AttrRegEx:
@staticmethod
def get_attr_types(docstring):
"""
Takes in a docstring String and returns a tuple of two lists.
First list contains tuples of input variable name and types.
Second list contains tuples of return names and variable types.
... | [
"re.findall",
"re.search"
] | [((504, 537), 're.search', 're.search', (['param_regex', 'docstring'], {}), '(param_regex, docstring)\n', (513, 537), False, 'import re\n'), ((557, 591), 're.search', 're.search', (['return_regex', 'docstring'], {}), '(return_regex, docstring)\n', (566, 591), False, 'import re\n'), ((1315, 1350), 're.findall', 're.find... |
import random
from qaviton.utils.random_util import random_number
class Optional:
""" use this object to insert random behavior on none mandatory operations for exploratory testing.
example:
class Cat:
def __init__(self, name):
self.name = name
... | [
"random.random",
"qaviton.utils.random_util.random_number"
] | [((2320, 2335), 'random.random', 'random.random', ([], {}), '()\n', (2333, 2335), False, 'import random\n'), ((3543, 3565), 'qaviton.utils.random_util.random_number', 'random_number', (['*chance'], {}), '(*chance)\n', (3556, 3565), False, 'from qaviton.utils.random_util import random_number\n')] |
from resttorrent.decorators import command
@command('1', '/sessions/<session_id>')
def get_session(session_id):
from resttorrent.modules.torrent import get_session as get_info
return get_info(session_id)
| [
"resttorrent.modules.torrent.get_session",
"resttorrent.decorators.command"
] | [((46, 84), 'resttorrent.decorators.command', 'command', (['"""1"""', '"""/sessions/<session_id>"""'], {}), "('1', '/sessions/<session_id>')\n", (53, 84), False, 'from resttorrent.decorators import command\n'), ((193, 213), 'resttorrent.modules.torrent.get_session', 'get_info', (['session_id'], {}), '(session_id)\n', (... |
# -*- coding: utf-8 -*-
# Import Python libs
from __future__ import absolute_import, print_function, unicode_literals
# Import Salt Testing Libs
from tests.support.mixins import LoaderModuleMockMixin
from tests.support.unit import skipIf, TestCase
from tests.support.mock import (
NO_MOCK,
NO_MOCK_REASON,
M... | [
"salt.states.boto_kinesis.present",
"tests.support.mock.MagicMock",
"tests.support.mock.patch.dict",
"salt.states.boto_kinesis.absent",
"tests.support.unit.skipIf"
] | [((412, 443), 'tests.support.unit.skipIf', 'skipIf', (['NO_MOCK', 'NO_MOCK_REASON'], {}), '(NO_MOCK, NO_MOCK_REASON)\n', (418, 443), False, 'from tests.support.unit import skipIf, TestCase\n'), ((1798, 1900), 'tests.support.mock.MagicMock', 'MagicMock', ([], {'side_effect': "[{'result': True}, {'result': False}, {'resu... |
import numpy as np
from noduleCADEvaluationLUNA16 import noduleCADEvaluation
import os
import csv
from multiprocessing import Pool
import functools
import SimpleITK as sitk
from config_testing import config
from layers import nms
annotations_filename = './labels/new_nodule.csv'
annotations_excluded_filename = './lab... | [
"os.path.exists",
"os.listdir",
"os.makedirs",
"csv.writer",
"numpy.exp",
"numpy.array",
"layers.nms",
"multiprocessing.Pool",
"functools.partial",
"numpy.expand_dims",
"numpy.load",
"noduleCADEvaluationLUNA16.noduleCADEvaluation",
"numpy.save"
] | [((1211, 1230), 'numpy.array', 'np.array', (['[1, 1, 1]'], {}), '([1, 1, 1])\n', (1219, 1230), True, 'import numpy as np\n'), ((1249, 1318), 'numpy.load', 'np.load', (["(sideinfopath + bboxfname[:-8] + '_origin.npy')"], {'mmap_mode': '"""r"""'}), "(sideinfopath + bboxfname[:-8] + '_origin.npy', mmap_mode='r')\n", (1256... |
from functools import partial
import pyproj
from shapely.geometry import shape, mapping
from shapely.ops import transform
from landgrab.task import BaseTask
PRESERVE_TOPOLOGY = False
class BufferGeometryTask(BaseTask):
"""
Buffers the geometry of a GeoJSON feature by a configurable buffer size amount, e.g.:... | [
"shapely.geometry.shape",
"shapely.geometry.mapping",
"pyproj.Proj"
] | [((1625, 1635), 'shapely.geometry.mapping', 'mapping', (['s'], {}), '(s)\n', (1632, 1635), False, 'from shapely.geometry import shape, mapping\n'), ((2510, 2520), 'shapely.geometry.mapping', 'mapping', (['s'], {}), '(s)\n', (2517, 2520), False, 'from shapely.geometry import shape, mapping\n'), ((1411, 1443), 'pyproj.Pr... |
import argparse
import cv2
import numpy as np
import torch
import kornia as K
from kornia.contrib import FaceDetector, FaceDetectorResult, FaceKeypoint
def draw_keypoint(img: np.ndarray, det: FaceDetectorResult, kpt_type: FaceKeypoint) -> np.ndarray:
kpt = det.get_keypoint(kpt_type).int().tolist()
return cv... | [
"cv2.imshow",
"torch.cuda.is_available",
"cv2.destroyAllWindows",
"kornia.contrib.FaceDetectorResult",
"kornia.image_to_tensor",
"argparse.ArgumentParser",
"cv2.line",
"cv2.VideoWriter",
"kornia.contrib.FaceDetector",
"cv2.VideoWriter_fourcc",
"cv2.waitKey",
"cv2.getTickFrequency",
"cv2.putT... | [((318, 357), 'cv2.circle', 'cv2.circle', (['img', 'kpt', '(2)', '(255, 0, 0)', '(2)'], {}), '(img, kpt, 2, (255, 0, 0), 2)\n', (328, 357), False, 'import cv2\n'), ((584, 603), 'torch.device', 'torch.device', (['"""cpu"""'], {}), "('cpu')\n", (596, 603), False, 'import torch\n'), ((787, 806), 'cv2.VideoCapture', 'cv2.V... |
import os
import re
import io
import sys
import glob
import json
import argparse
import datetime
from operator import itemgetter
from bs4 import BeautifulSoup
DURATION_RE = r'PT(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?'
def convert_to_type(s):
return s.replace('http://www.google.com/voice#', '')
def convert_to_tel(s)... | [
"argparse.FileType",
"argparse.ArgumentParser",
"json.dumps",
"os.path.join",
"io.open",
"bs4.BeautifulSoup",
"operator.itemgetter",
"re.search"
] | [((393, 418), 're.search', 're.search', (['DURATION_RE', 's'], {}), '(DURATION_RE, s)\n', (402, 418), False, 'import re\n'), ((679, 712), 'bs4.BeautifulSoup', 'BeautifulSoup', (['raw', '"""html.parser"""'], {}), "(raw, 'html.parser')\n", (692, 712), False, 'from bs4 import BeautifulSoup\n'), ((1463, 1496), 'bs4.Beautif... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '.\plot_display_dialog.ui'
#
# Created by: PyQt5 UI code generator 5.15.0
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 impor... | [
"PyQt5.QtWidgets.QWidget",
"PyQt5.QtWidgets.QListWidget",
"PyQt5.QtCore.QMetaObject.connectSlotsByName",
"PyQt5.QtWidgets.QHBoxLayout",
"PyQt5.QtWidgets.QVBoxLayout",
"PyQt5.QtWidgets.QSizePolicy",
"PyQt5.QtCore.QSize"
] | [((573, 615), 'PyQt5.QtWidgets.QHBoxLayout', 'QtWidgets.QHBoxLayout', (['plot_display_dialog'], {}), '(plot_display_dialog)\n', (594, 615), False, 'from PyQt5 import QtCore, QtGui, QtWidgets\n'), ((710, 748), 'PyQt5.QtWidgets.QWidget', 'QtWidgets.QWidget', (['plot_display_dialog'], {}), '(plot_display_dialog)\n', (727,... |
# -*- coding: utf-8 -*-
import numpy, matplotlib.pyplot as plt, time
from sklearn.metrics import mean_squared_error, accuracy_score, roc_auc_score
class ExternalRNN(object):
"""Class that implements a External Recurent Neural Network"""
def __init__(self, hidden_layer_size=3, learning_rate=0.2, max_epochs=100... | [
"numpy.repeat",
"numpy.random.rand",
"numpy.ones",
"numpy.roll",
"sklearn.metrics.roc_auc_score",
"sklearn.metrics.mean_squared_error",
"numpy.array",
"numpy.dot",
"numpy.zeros",
"numpy.exp",
"numpy.append",
"numpy.nan_to_num"
] | [((786, 854), 'numpy.random.rand', 'numpy.random.rand', (['(1 + self.input_layer_size)', 'self.hidden_layer_size'], {}), '(1 + self.input_layer_size, self.hidden_layer_size)\n', (803, 854), False, 'import numpy, matplotlib.pyplot as plt, time\n'), ((873, 942), 'numpy.random.rand', 'numpy.random.rand', (['(1 + self.hidd... |
# data_loader.py - StyleTransfer-PyTorch
#
# BSD 3-Clause License
#
# Copyright (c) 2019, <NAME>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must reta... | [
"torchvision.transforms.CenterCrop",
"torch.utils.data.DataLoader",
"torchvision.transforms.Resize",
"torchvision.datasets.ImageFolder",
"torch.cuda.is_available",
"torchvision.datasets.MNIST",
"torchvision.datasets.CIFAR10",
"torchvision.transforms.Normalize",
"torchvision.transforms.ToTensor"
] | [((2304, 2391), 'torchvision.datasets.MNIST', 'datasets.MNIST', ([], {'root': 'args.data_dir', 'train': '(True)', 'download': '(True)', 'transform': 'transform'}), '(root=args.data_dir, train=True, download=True, transform=\n transform)\n', (2318, 2391), False, 'from torchvision import datasets, transforms\n'), ((24... |
# Generated by Django 2.0.4 on 2018-05-22 01:10
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('instruments', '0005_remove_instruments_id_sale'),
('sales', '0005_sale_id_sale_instrument'),
]
operations =... | [
"django.db.migrations.RemoveField",
"django.db.models.ForeignKey"
] | [((331, 399), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""sale"""', 'name': '"""id_sale_Instrument"""'}), "(model_name='sale', name='id_sale_Instrument')\n", (353, 399), False, 'from django.db import migrations, models\n'), ((553, 673), 'django.db.models.ForeignKey', 'models.Fo... |
# Generated by Django 2.2 on 2019-05-05 12:51
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('LottoWebCore', '0003_ticket_winner'),
]
operations = [
migrations.CreateModel(
name='Prize',
fields=[
... | [
"django.db.models.AutoField",
"django.db.migrations.RemoveField",
"django.db.models.ManyToManyField",
"django.db.models.CharField"
] | [((552, 610), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""raffle"""', 'name': '"""prizes"""'}), "(model_name='raffle', name='prizes')\n", (574, 610), False, 'from django.db import migrations, models\n'), ((754, 826), 'django.db.models.ManyToManyField', 'models.ManyToManyField',... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (c) 2016-2018 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
# All Rights Reserved.
#
""" System Inventory Storage Backend Utilities and helper functions."""
import ast
import pecan
import wsme
from inventory.common import constants
from... | [
"inventory.common.exception.InvalidStorageBackend",
"ast.literal_eval",
"inventory.common.i18n._",
"wsme.exc.ClientSideError",
"inventory.common.exception.IncompleteCephMonNetworkConfig",
"oslo_log.log.getLogger"
] | [((459, 482), 'oslo_log.log.getLogger', 'log.getLogger', (['__name__'], {}), '(__name__)\n', (472, 482), False, 'from oslo_log import log\n'), ((7090, 7137), 'inventory.common.exception.InvalidStorageBackend', 'exception.InvalidStorageBackend', ([], {'backend': 'target'}), '(backend=target)\n', (7121, 7137), False, 'fr... |
from applications.models import db
# 创建中间表
user_role = db.Table(
"admin_user_role", # 中间表名称
db.Column("id", db.Integer, primary_key=True, autoincrement=True, comment='标识'), # 主键
db.Column("user_id", db.Integer, db.ForeignKey("admin_user.id"), comment='用户编号'), # 属性 外键
db.Column("role_id", db.Integer, ... | [
"applications.models.db.ForeignKey",
"applications.models.db.Column"
] | [((101, 180), 'applications.models.db.Column', 'db.Column', (['"""id"""', 'db.Integer'], {'primary_key': '(True)', 'autoincrement': '(True)', 'comment': '"""标识"""'}), "('id', db.Integer, primary_key=True, autoincrement=True, comment='标识')\n", (110, 180), False, 'from applications.models import db\n'), ((225, 255), 'app... |
import pandas as pd
from .. import config
def process(filename, is_continuous=False, threshold=1.96):
"""
Parameters
----------
filename: :str
tab separated file in which the first row contains gene name/entrez gene id combined
and patient ids. The rest of the rows are the genes and their... | [
"pandas.DataFrame",
"pandas.read_csv"
] | [((1099, 1127), 'pandas.read_csv', 'pd.read_csv', (['fpath'], {'sep': '"""\t"""'}), "(fpath, sep='\\t')\n", (1110, 1127), True, 'import pandas as pd\n'), ((2626, 2688), 'pandas.DataFrame', 'pd.DataFrame', (['z_scores'], {'index': 'data.index', 'columns': 'data.columns'}), '(z_scores, index=data.index, columns=data.colu... |
# -*- coding: utf-8 -*-
# Copyright (c) 2014-2016 Tigera, Inc. All rights reserved.
# Copyright 2015 Cisco Systems
#
# 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.or... | [
"logging.getLogger",
"calico.common.validate_profile",
"mock.Mock",
"calico.common.validate_endpoint",
"calico.common.validate_port",
"nose.tools.assert_raises",
"copy.deepcopy",
"calico.common.validate_ip_addr",
"calico.common.validate_tags",
"calico.common.validate_rule_port",
"calico.common.v... | [((1141, 1191), 'collections.namedtuple', 'namedtuple', (['"""Config"""', "['IFACE_PREFIX', 'HOSTNAME']"], {}), "('Config', ['IFACE_PREFIX', 'HOSTNAME'])\n", (1151, 1191), False, 'from collections import namedtuple\n'), ((1209, 1236), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1226, ... |
###############################################################################
#
# codingDensityPlots.py - Create a GC histogram and a delta-CD plot.
#
###############################################################################
# #
#... | [
"checkm.plot.tetraDistPlots.TetraDistPlots",
"checkm.plot.gcPlots.GcPlots",
"checkm.plot.codingDensityPlots.CodingDensityPlots",
"AbstractPlot.AbstractPlot.__init__"
] | [((1741, 1777), 'AbstractPlot.AbstractPlot.__init__', 'AbstractPlot.__init__', (['self', 'options'], {}), '(self, options)\n', (1762, 1777), False, 'from AbstractPlot import AbstractPlot\n'), ((2321, 2342), 'checkm.plot.gcPlots.GcPlots', 'GcPlots', (['self.options'], {}), '(self.options)\n', (2328, 2342), False, 'from ... |
# -*- coding: utf-8 -*-
from argparse import ArgumentParser
class DataServiceArgumentParser(object):
def __init__(self):
self._parser = ArgumentParser()
def parse_build(self, short_description, long_description, **kwargs):
self._parser.add_argument(short_description, long_description, **kwa... | [
"argparse.ArgumentParser"
] | [((152, 168), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (166, 168), False, 'from argparse import ArgumentParser\n')] |
import torch.nn as nn
from typing import Optional, Union, List
from .model_config import MODEL_CONFIG
from .decoder.unet import UnetDecoder
from .get_encoder import build_encoder
from .base_model import SegmentationModel
from .lib import SynchronizedBatchNorm2d
BatchNorm2d = SynchronizedBatchNorm2d
class Flatten(nn.M... | [
"torch.nn.Dropout",
"torch.nn.Conv2d",
"torch.nn.UpsamplingBilinear2d",
"torch.nn.AdaptiveAvgPool2d",
"torch.nn.Linear",
"torch.nn.Identity"
] | [((4084, 4150), 'torch.nn.Conv2d', 'nn.Conv2d', (['decoder_channels[-1]', 'classes'], {'kernel_size': '(3)', 'padding': '(1)'}), '(decoder_channels[-1], classes, kernel_size=3, padding=1)\n', (4093, 4150), True, 'import torch.nn as nn\n'), ((3985, 4033), 'torch.nn.UpsamplingBilinear2d', 'nn.UpsamplingBilinear2d', ([], ... |
# Copyright 2021 Splunk Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | [
"logging.getLogger"
] | [((696, 715), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (713, 715), False, 'import logging\n')] |
import bs4 as bs
import datetime as dt
import os
import pandas_datareader.data as web
import pickle
import requests
def save_sp500_tickers():
resp = requests.get('http://en.wikipedia.org/wiki/List_of_S%26P_500_companies')
soup = bs.BeautifulSoup(resp.text, 'lxml')
table = soup.find('table', {'class': 'wiki... | [
"bs4.BeautifulSoup",
"pickle.dump",
"requests.get"
] | [((154, 226), 'requests.get', 'requests.get', (['"""http://en.wikipedia.org/wiki/List_of_S%26P_500_companies"""'], {}), "('http://en.wikipedia.org/wiki/List_of_S%26P_500_companies')\n", (166, 226), False, 'import requests\n'), ((238, 273), 'bs4.BeautifulSoup', 'bs.BeautifulSoup', (['resp.text', '"""lxml"""'], {}), "(re... |
from __future__ import unicode_literals
import codecs
def encode_hex(value):
return '0x' + codecs.decode(codecs.encode(value, 'hex'), 'utf8')
def decode_hex(value):
_, _, hex_part = value.rpartition('x')
return codecs.decode(hex_part, 'hex')
| [
"codecs.encode",
"codecs.decode"
] | [((228, 258), 'codecs.decode', 'codecs.decode', (['hex_part', '"""hex"""'], {}), "(hex_part, 'hex')\n", (241, 258), False, 'import codecs\n'), ((112, 139), 'codecs.encode', 'codecs.encode', (['value', '"""hex"""'], {}), "(value, 'hex')\n", (125, 139), False, 'import codecs\n')] |
import sys
##sys.path.append("./../.")
sys.path.insert(1, "./../.")
from sec_edgar_downloader import Downloader
download_path = './download_files'
dl = Downloader(download_path);
dl.get(None,"", include_amends=True, query = "\"opportunities doctrine\"", dry_run=False )
#dl.get(None,"", include_amends=True, query = "... | [
"sec_edgar_downloader.Downloader",
"sys.path.insert"
] | [((39, 67), 'sys.path.insert', 'sys.path.insert', (['(1)', '"""./../."""'], {}), "(1, './../.')\n", (54, 67), False, 'import sys\n'), ((154, 179), 'sec_edgar_downloader.Downloader', 'Downloader', (['download_path'], {}), '(download_path)\n', (164, 179), False, 'from sec_edgar_downloader import Downloader\n')] |
import pandas as pd
import numpy as np
import os
import matplotlib.pyplot as plt
from matplotlib.image import imread
images = os.listdir('')
flow =os.listdir('')
data_1 = []
for i in range (0,22873):
curr = []
if(i<10):
curr_file_1 = '0000'+str(i)+"_img1.ppm"
curr_file_2 = '0000' + str(i) + "... | [
"pandas.DataFrame",
"os.listdir"
] | [((127, 141), 'os.listdir', 'os.listdir', (['""""""'], {}), "('')\n", (137, 141), False, 'import os\n'), ((148, 162), 'os.listdir', 'os.listdir', (['""""""'], {}), "('')\n", (158, 162), False, 'import os\n'), ((1104, 1158), 'pandas.DataFrame', 'pd.DataFrame', (['data_1'], {'columns': "['img1', 'img2', 'flow']"}), "(dat... |
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | [
"numpy.repeat",
"math.ceil",
"six.add_metaclass",
"numpy.sum",
"numpy.zeros",
"numpy.argwhere",
"paddle.abs",
"numpy.cumsum"
] | [((3223, 3253), 'six.add_metaclass', 'six.add_metaclass', (['abc.ABCMeta'], {}), '(abc.ABCMeta)\n', (3240, 3253), False, 'import six\n'), ((5200, 5230), 'six.add_metaclass', 'six.add_metaclass', (['abc.ABCMeta'], {}), '(abc.ABCMeta)\n', (5217, 5230), False, 'import six\n'), ((7291, 7306), 'numpy.cumsum', 'np.cumsum', (... |
# -*- encoding: utf-8 -*-
from app import app
if __name__ == '__main__':
#app.run(debug=True) # for local webserver
app.run(host='0.0.0.0', port=80) | [
"app.app.run"
] | [((124, 156), 'app.app.run', 'app.run', ([], {'host': '"""0.0.0.0"""', 'port': '(80)'}), "(host='0.0.0.0', port=80)\n", (131, 156), False, 'from app import app\n')] |
# Copyright 2020 Neural Networks and Deep Learning lab, MIPT
#
# 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 applicab... | [
"numpy.isfinite",
"deeppavlov.core.common.metrics_registry.register_metric",
"sklearn.metrics.mean_squared_error"
] | [((771, 808), 'deeppavlov.core.common.metrics_registry.register_metric', 'register_metric', (['"""mean_squared_error"""'], {}), "('mean_squared_error')\n", (786, 808), False, 'from deeppavlov.core.common.metrics_registry import register_metric\n'), ((1192, 1248), 'sklearn.metrics.mean_squared_error', 'mean_squared_erro... |
#!/usr/bin/env python
# _*_ coding: UTF-8 _*_
import json
import codecs
import argparse
import numpy as np
def compute_edit_distance(hypothesis: list, reference: list):
insert, delete, substitute = 0, 0, 0
correct = 0
len_hyp, len_ref = len(hypothesis), len(reference)
if len_hyp == 0 or len_ref =... | [
"json.load",
"numpy.zeros",
"codecs.open",
"json.dump"
] | [((391, 443), 'numpy.zeros', 'np.zeros', (['(len_hyp + 1, len_ref + 1)'], {'dtype': 'np.int16'}), '((len_hyp + 1, len_ref + 1), dtype=np.int16)\n', (399, 443), True, 'import numpy as np\n'), ((532, 583), 'numpy.zeros', 'np.zeros', (['(len_hyp + 1, len_ref + 1)'], {'dtype': 'np.int8'}), '((len_hyp + 1, len_ref + 1), dty... |
# -*- coding: UTF-8 -*-
# SPDX-License-Identifier: MIT
from __future__ import print_function, unicode_literals
from pythonic_testcase import *
from pymta.api import IMTAPolicy
from pymta.command_parser import SMTPCommandParser
from pymta.compat import basestring, b64encode
from pymta.test_util import BlackholeDelive... | [
"pymta.test_util.BlackholeDeliverer",
"pymta.test_util.MockChannel",
"pymta.compat.b64encode",
"pymta.test_util.DummyAuthenticator"
] | [((450, 470), 'pymta.test_util.BlackholeDeliverer', 'BlackholeDeliverer', ([], {}), '()\n', (468, 470), False, 'from pymta.test_util import BlackholeDeliverer, DummyAuthenticator, MockChannel\n'), ((635, 648), 'pymta.test_util.MockChannel', 'MockChannel', ([], {}), '()\n', (646, 648), False, 'from pymta.test_util impor... |
# Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | [
"googlecloudsdk.api_lib.ml.language.util.LanguageClient",
"googlecloudsdk.api_lib.ml.language.util.GetContentSource"
] | [((1961, 2049), 'googlecloudsdk.api_lib.ml.language.util.LanguageClient', 'util.LanguageClient', ([], {'version': 'api_version', 'entity_sentiment_enabled': 'entity_sentiment'}), '(version=api_version, entity_sentiment_enabled=\n entity_sentiment)\n', (1980, 2049), False, 'from googlecloudsdk.api_lib.ml.language imp... |
import random
import operator
import matplotlib.pyplot
import matplotlib.animation
import agentframework
#random.seed(2)
random.seed(2)
f = open("M:/Python/Fourth Step - Animation/in.txt")
environment = []
for line in f:
parsed_line = str.split(line,",")
rowlist = []
for word in parsed_line:
ro... | [
"random.random",
"agentframework.Agent",
"random.seed"
] | [((123, 137), 'random.seed', 'random.seed', (['(2)'], {}), '(2)\n', (134, 137), False, 'import random\n'), ((618, 674), 'agentframework.Agent', 'agentframework.Agent', (['environment', 'agents', 'neighbourhood'], {}), '(environment, agents, neighbourhood)\n', (638, 674), False, 'import agentframework\n'), ((1005, 1020)... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np
from helpers import load_problem
experiments = ['synth', 'iso']
cases = ['spacefilling', 'alt', 'refine']
#experiments = ['synth']
#experiments = ['iso']
#cases = ['spacefilling', 'refine']
run_idx = 0
for experiment in experiments:
# load exp... | [
"helpers.load_problem",
"numpy.median",
"numpy.exp",
"numpy.sum",
"numpy.zeros",
"numpy.random.seed",
"numpy.savetxt",
"numpy.load"
] | [((3557, 3594), 'numpy.load', 'np.load', (['"""output/failure_example.npz"""'], {}), "('output/failure_example.npz')\n", (3564, 3594), True, 'import numpy as np\n'), ((3666, 3696), 'numpy.zeros', 'np.zeros', (['(n_eval.size - 1, 3)'], {}), '((n_eval.size - 1, 3))\n', (3674, 3696), True, 'import numpy as np\n'), ((3792,... |
# Copyright 2021 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... | [
"numpy.fromfile",
"os.listdir",
"PIL.Image.open",
"argparse.ArgumentParser",
"src.eval_utils.metrics",
"pycocotools.coco.COCO",
"os.path.join",
"numpy.squeeze",
"numpy.array"
] | [((862, 920), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""ssd acc calculation"""'}), "(description='ssd acc calculation')\n", (885, 920), False, 'import argparse\n'), ((1332, 1353), 'PIL.Image.open', 'Image.open', (['file_name'], {}), '(file_name)\n', (1342, 1353), False, 'from PIL im... |
# See URL: https://hakibenita.com/fast-load-data-python-postgresql
import time
from functools import wraps
from memory_profiler import memory_usage # type: ignore
def profile(fn):
@wraps(fn)
def inner(*args, **kwargs):
fn_kwargs_str = ", ".join(f"{k}={v}" for k, v in kwargs.items())
print(f... | [
"time.perf_counter",
"functools.wraps",
"memory_profiler.memory_usage"
] | [((190, 199), 'functools.wraps', 'wraps', (['fn'], {}), '(fn)\n', (195, 199), False, 'from functools import wraps\n'), ((392, 411), 'time.perf_counter', 'time.perf_counter', ([], {}), '()\n', (409, 411), False, 'import time\n'), ((595, 669), 'memory_profiler.memory_usage', 'memory_usage', (['(fn, args, kwargs)'], {'ret... |
import unittest
from MixFormatError import MixFormatError
class TestSyntaxErrors(unittest.TestCase):
def test_unexpected_token_ex_1_10(self):
error = MixFormatError("** (SyntaxError) lib/skoach_bot/repo/users.ex:150: unexpected token: end. The \"{\" at line 149 is missing terminator \"}\"", "")
s... | [
"unittest.main",
"MixFormatError.MixFormatError"
] | [((1524, 1539), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1537, 1539), False, 'import unittest\n'), ((164, 315), 'MixFormatError.MixFormatError', 'MixFormatError', (['"""** (SyntaxError) lib/skoach_bot/repo/users.ex:150: unexpected token: end. The "{" at line 149 is missing terminator "}\\""""', '""""""'], {... |
from django.db import models
from app_user.models import *
from app_goods.models import *
# Create your models here.
class Order(models.Model):
serialnumber = models.CharField(
default='0', max_length=50, verbose_name='序列号')
user = models.ForeignKey(User, null=True, blank=True,
... | [
"django.db.models.DateTimeField",
"django.db.models.IntegerField",
"django.db.models.CharField",
"django.db.models.ForeignKey"
] | [((165, 229), 'django.db.models.CharField', 'models.CharField', ([], {'default': '"""0"""', 'max_length': '(50)', 'verbose_name': '"""序列号"""'}), "(default='0', max_length=50, verbose_name='序列号')\n", (181, 229), False, 'from django.db import models\n'), ((250, 360), 'django.db.models.ForeignKey', 'models.ForeignKey', ([... |
# coding: utf8
from openerp.osv import osv, fields
class atribuir_wiz (osv.osv_memory):
_name = "atribuir.wiz"
_columns = {
'responsavel': fields.many2one("ud.solicitacao.responsavel", "Responsável: ", required=True),
}
def atribuir (self, cr, uid, ids, ctx):
lt = ... | [
"openerp.osv.fields.many2one"
] | [((165, 242), 'openerp.osv.fields.many2one', 'fields.many2one', (['"""ud.solicitacao.responsavel"""', '"""Responsável: """'], {'required': '(True)'}), "('ud.solicitacao.responsavel', 'Responsável: ', required=True)\n", (180, 242), False, 'from openerp.osv import osv, fields\n')] |
# coding: utf-8
import os
from django.utils import simplejson
from django.http import HttpResponse, HttpResponseRedirect
from django.views.generic import DetailView, TemplateView, ListView
from django.core.urlresolvers import reverse
from django.contrib.auth.decorators import login_required
from datetime import datet... | [
"django.core.urlresolvers.reverse",
"grade.models.Talk.objects.dates",
"grade.models.Talk.objects.filter",
"django.http.HttpResponse",
"grade.models.Room.objects.create",
"grade.models.Zone.objects.filter",
"grade.models.Zone.objects.get",
"grade.models.Zone.objects.create",
"grade.models.Talk.objec... | [((4770, 4798), 'grade.models.Talk.objects.get', 'Talk.objects.get', ([], {'id': 'talk_id'}), '(id=talk_id)\n', (4786, 4798), False, 'from grade.models import Room, Area, Zone, Author, Talk\n'), ((7084, 7111), 'django.utils.simplejson.loads', 'simplejson.loads', (['data_json'], {}), '(data_json)\n', (7100, 7111), False... |
import unittest
from mock import MagicMock
from mock import Mock
from mock import patch
import httpretty
from bluegreen import BlueGreen
class TestBlueGreen(unittest.TestCase):
def setUp(self):
self.config = {
'name': 'test-app',
'deploy_dir': '.',
'retry_times': 3,
'retry_sleep': 0,
... | [
"httpretty.register_uri",
"mock.Mock",
"bluegreen.BlueGreen",
"httpretty.last_request",
"httpretty.Response",
"mock.MagicMock"
] | [((673, 721), 'bluegreen.BlueGreen', 'BlueGreen', (['"""token"""', '"""tsuruhost.com"""', 'self.config'], {}), "('token', 'tsuruhost.com', self.config)\n", (682, 721), False, 'from bluegreen import BlueGreen\n'), ((846, 960), 'httpretty.register_uri', 'httpretty.register_uri', (['httpretty.GET', '"""http://tsuruhost.co... |
import random
from OpenGL.GL import *
from OpenGL.GLUT import *
from OpenGL.GLU import *
"""
Generating squares
This example will generate 25 squares each in a randomly chosen grayvalue.
The grayvalue is chosen out of 25 different possiblities. Every redraw of the
window will create a new set of squares.
http://ww... | [
"random.randint"
] | [((653, 674), 'random.randint', 'random.randint', (['(0)', '(25)'], {}), '(0, 25)\n', (667, 674), False, 'import random\n'), ((734, 756), 'random.randint', 'random.randint', (['(0)', '(640)'], {}), '(0, 640)\n', (748, 756), False, 'import random\n'), ((758, 780), 'random.randint', 'random.randint', (['(0)', '(480)'], {... |
################################################################################
##
## Register map generation tool
##
## Copyright (C) 2018 <NAME> <<EMAIL>>
##
## Permission is hereby granted, free of charge, to any person obtaining a copy
## of this SW component a... | [
"os.path.abspath",
"sys.path.insert"
] | [((2188, 2219), 'sys.path.insert', 'sys.path.insert', (['(0)', 'PYXACT_PATH'], {}), '(0, PYXACT_PATH)\n', (2203, 2219), False, 'import sys\n'), ((2110, 2135), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (2125, 2135), False, 'import os\n')] |
import os
def set_jjba_paths_and_files(module_path):
PATHS.MODULE_DIR = module_path
PATHS.set_jjba_paths()
PATHS.set_jjba_files()
class PATHS:
MODULE_DIR = None
OUTPUT_DIR = None
DATA_DIR = None
class DATA:
AUDIO_DIR = None
IMAGES_DIR = None
class AUDIO:
... | [
"os.path.join"
] | [((500, 540), 'os.path.join', 'os.path.join', (['PATHS.MODULE_DIR', '"""output"""'], {}), "(PATHS.MODULE_DIR, 'output')\n", (512, 540), False, 'import os\n'), ((570, 608), 'os.path.join', 'os.path.join', (['PATHS.MODULE_DIR', '"""data"""'], {}), "(PATHS.MODULE_DIR, 'data')\n", (582, 608), False, 'import os\n'), ((645, ... |
# general libraries
import time
from datetime import datetime
import pandas as pd
# crawling libraries
import urllib.request
from urllib.error import URLError, HTTPError, ContentTooShortError
import itertools
# scraping libraries
from bs4 import BeautifulSoup
from lxml.html import fromstring, tostring
im... | [
"pandas.Series",
"json.loads",
"datetime.datetime.fromtimestamp",
"datetime.datetime.utcnow",
"pandas.DatetimeIndex",
"datetime.datetime.strptime",
"json.dumps",
"lxml.html.fromstring",
"time.sleep",
"bs4.BeautifulSoup",
"itertools.count",
"pandas.DataFrame",
"pymongo.MongoClient",
"csv.re... | [((554, 591), 'pymongo.MongoClient', 'MongoClient', (['"""XXX.XXX.XXX.XXX"""', '(27017)'], {}), "('XXX.XXX.XXX.XXX', 27017)\n", (565, 591), False, 'from pymongo import MongoClient\n'), ((882, 908), 'datetime.datetime.fromtimestamp', 'datetime.fromtimestamp', (['ts'], {}), '(ts)\n', (904, 908), False, 'from datetime imp... |
"""
Document module.
"""
from dockie.core import errors, ensure
class Document:
"""Document class. A document is the basic storage primitive in a document database."""
def __init__(self, document_id, data: dict):
"""
Creates a Document instance.
:param document_id: The document id.
... | [
"dockie.core.errors.ObjectCreateError"
] | [((424, 478), 'dockie.core.errors.ObjectCreateError', 'errors.ObjectCreateError', (['"""Document id not specified."""'], {}), "('Document id not specified.')\n", (448, 478), False, 'from dockie.core import errors, ensure\n'), ((545, 681), 'dockie.core.errors.ObjectCreateError', 'errors.ObjectCreateError', (['"""Documen... |
#!/usr/bin/env python3
# Usage: ./01-create-db.py
import my_db_utils
from config import CONFIG
# db_name = ':memory:' # to make a in memory db
db_name = CONFIG['data_dir']+CONFIG['db_file']
table_name = CONFIG['table_name']
table_fields = CONFIG['table_fields']
my_db_utils.create_table(db_name, table_name, table_fiel... | [
"my_db_utils.create_table"
] | [((264, 323), 'my_db_utils.create_table', 'my_db_utils.create_table', (['db_name', 'table_name', 'table_fields'], {}), '(db_name, table_name, table_fields)\n', (288, 323), False, 'import my_db_utils\n')] |
from datetime import datetime,timedelta
import numpy as np
import json
from urllib.request import urlopen
from html.parser import HTMLParser
import os
# -----------------------------------------------
# General
# -----------------------------------------------
def get_dir(dirname,json_file='input/dirs.json'):
with... | [
"datetime.datetime",
"numpy.copy",
"html.parser.HTMLParser.__init__",
"os.listdir",
"numpy.logical_and",
"numpy.where",
"datetime.datetime.strptime",
"os.rename",
"datetime.datetime.datetime",
"numpy.argsort",
"numpy.array",
"numpy.isnan",
"json.load",
"datetime.timedelta",
"urllib.reque... | [((1518, 1539), 'os.listdir', 'os.listdir', (['input_dir'], {}), '(input_dir)\n', (1528, 1539), False, 'import os\n'), ((2193, 2249), 'numpy.logical_and', 'np.logical_and', (['(array >= start_value)', '(array <= end_value)'], {}), '(array >= start_value, array <= end_value)\n', (2207, 2249), True, 'import numpy as np\n... |
# Copyright 2013 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | [
"six.BytesIO",
"glance_store.exceptions.NotFound",
"glance_store._drivers.rbd.Store",
"glance_store.location.Location",
"glance_store._drivers.rbd.StoreLocation",
"mock.patch.object"
] | [((5000, 5045), 'mock.patch.object', 'mock.patch.object', (['MockRBD.Image', '"""__enter__"""'], {}), "(MockRBD.Image, '__enter__')\n", (5017, 5045), False, 'import mock\n'), ((5051, 5102), 'mock.patch.object', 'mock.patch.object', (['rbd_store.Store', '"""_create_image"""'], {}), "(rbd_store.Store, '_create_image')\n"... |
import abc
import asyncio
import logging
from typing import Any, Callable, List, Optional, TYPE_CHECKING, Union
from discord import Message, Reaction, TextChannel, User
from discord.abc import GuildChannel
from discord.ext.commands import Context
from dpymenus import Page, PagesError, Session, SessionError
from dpyme... | [
"dpymenus.hooks.call_hook",
"dpymenus.Page.convert_from",
"dpymenus.Session.create",
"asyncio.sleep",
"logging.info",
"dpymenus.Session.get"
] | [((5337, 5374), 'dpymenus.hooks.call_hook', 'call_hook', (['self', '"""_hook_before_close"""'], {}), "(self, '_hook_before_close')\n", (5346, 5374), False, 'from dpymenus.hooks import HookEvent, HookWhen, call_hook\n'), ((5630, 5666), 'dpymenus.hooks.call_hook', 'call_hook', (['self', '"""_hook_after_close"""'], {}), "... |
#!/usr/bin/env python
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', 'python'))
import dpkt
import json
from cStringIO import StringIO
from inform import InformSerializer
def go_debug(filename):
arr = lambda x: [ord(i) for i in x]
packet = ser.parse(open('test_files/2.... | [
"cStringIO.StringIO",
"os.path.splitext",
"os.path.join",
"dpkt.ethernet.Ethernet",
"os.path.dirname",
"os.path.basename",
"inform.InformSerializer",
"json.load",
"glob.glob"
] | [((846, 856), 'cStringIO.StringIO', 'StringIO', ([], {}), '()\n', (854, 856), False, 'from cStringIO import StringIO\n'), ((1381, 1411), 'inform.InformSerializer', 'InformSerializer', (['""""""', 'keystore'], {}), "('', keystore)\n", (1397, 1411), False, 'from inform import InformSerializer\n'), ((1521, 1555), 'glob.gl... |
#!/usr/bin/env python3
from animal import Animal
import sys
class Dog(Animal):
def __init__(self, kind: str, name: str):
super().__init__(kind, name, 4)
def run(self):
print('I can run by {} legs'.format(self.legs))
if __name__ == '__main__':
try:
Animal.hello() ## failed to ru... | [
"animal.Animal.hello",
"animal.Animal.run"
] | [((403, 415), 'animal.Animal.run', 'Animal.run', ([], {}), '()\n', (413, 415), False, 'from animal import Animal\n'), ((290, 304), 'animal.Animal.hello', 'Animal.hello', ([], {}), '()\n', (302, 304), False, 'from animal import Animal\n')] |
import grpc
from tensorflow_serving.apis import prediction_service_pb2_grpc
import pickle
import time
import sys
sys.path.append('/home/yitao/Documents/fun-project/tensorflow-related/tf-pose-estimation/')
from module_pose.pose_openpose_rim import PoseOpenpose
from module_pose.pose_thinpose_rim import PoseThinpose
from... | [
"module_pose.pose_thinpose_rim.PoseThinpose",
"module_pose.pose_openpose_rim.PoseOpenpose",
"tensorflow_serving.apis.prediction_service_pb2_grpc.PredictionServiceStub",
"grpc.insecure_channel",
"module_pose.pose_recognition_rim.PoseRecognition",
"cv2.VideoCapture",
"time.time",
"sys.path.append"
] | [((114, 210), 'sys.path.append', 'sys.path.append', (['"""/home/yitao/Documents/fun-project/tensorflow-related/tf-pose-estimation/"""'], {}), "(\n '/home/yitao/Documents/fun-project/tensorflow-related/tf-pose-estimation/')\n", (129, 210), False, 'import sys\n'), ((404, 525), 'cv2.VideoCapture', 'cv2.VideoCapture', (... |
import os
import argparse
import subprocess
import numpy as np
import pandas as pd
def training_model(filename, technique, pruning_rate, layer):
""" Training the pruned model """
# Opens the temporary file
f = open('../eval.txt', 'a+')
# Training with pre-trained weights
if technique.upper() != ... | [
"argparse.ArgumentParser",
"os.chdir",
"subprocess.call",
"numpy.arange",
"os.remove"
] | [((744, 790), 'subprocess.call', 'subprocess.call', (['command'], {'shell': '(True)', 'stdout': 'f'}), '(command, shell=True, stdout=f)\n', (759, 790), False, 'import subprocess\n'), ((1341, 1387), 'subprocess.call', 'subprocess.call', (['command'], {'shell': '(True)', 'stdout': 'f'}), '(command, shell=True, stdout=f)\... |
import time
from haystack.constants import ID, DJANGO_CT, DJANGO_ID
### Useful For Querying
def get_backend(index_instance, using=None):
""" given an index, return the backend, by default using the default connection """
using = using or 'default'
return index_instance._get_backend(using=using)
def get... | [
"time.time"
] | [((1196, 1207), 'time.time', 'time.time', ([], {}), '()\n', (1205, 1207), False, 'import time\n')] |
## Preprocessing.py
"""
Preprocessing Steps :-
1. Convert to lowercase
2. Remove punctuations with empty space
3. Remove digits
4. Apply lemmatization
5. Remove Stopwords
6. Remove words that do not have word embeddings
7. Remove words that have length < 3.
*** NOT APPLYING STEMMING (Instead applying lemmat... | [
"preprocessing_data.get_bbc_data"
] | [((1477, 1496), 'preprocessing_data.get_bbc_data', 'get_bbc_data', (['dtype'], {}), '(dtype)\n', (1489, 1496), False, 'from preprocessing_data import get_bbc_data\n')] |
from itertools import groupby
from typing import Tuple
def longest_repetition(chars: str) -> Tuple[str,int]:
"Character with longest consecutive repetition"
if not (chars and type(chars) is str):
return ('',0)
return max(((c,len(list(g))) for c,g in groupby(chars)), key=lambda x: x[1]) | [
"itertools.groupby"
] | [((271, 285), 'itertools.groupby', 'groupby', (['chars'], {}), '(chars)\n', (278, 285), False, 'from itertools import groupby\n')] |
from __future__ import absolute_import
from abc import ABCMeta, abstractmethod
from six import add_metaclass, iteritems
@add_metaclass(ABCMeta)
class Auth(object):
def __init__(
self, app, authorization_hook=None, _overwrite_index=True, protect_assets=False
):
self.app = app
self._in... | [
"six.add_metaclass",
"six.iteritems"
] | [((125, 147), 'six.add_metaclass', 'add_metaclass', (['ABCMeta'], {}), '(ABCMeta)\n', (138, 147), False, 'from six import add_metaclass, iteritems\n'), ((1054, 1095), 'six.iteritems', 'iteritems', (['self.app.server.view_functions'], {}), '(self.app.server.view_functions)\n', (1063, 1095), False, 'from six import add_m... |
# Generated by Django 2.0.3 on 2018-07-19 10:20
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [("account", "0022_auto_20180718_0956")]
operations = [
migrations.AlterModelOptions(
name="user",
options={
"permissions": ... | [
"django.db.migrations.AlterModelOptions"
] | [((212, 412), 'django.db.migrations.AlterModelOptions', 'migrations.AlterModelOptions', ([], {'name': '"""user"""', 'options': "{'permissions': (('manage_users', 'Manage customers.'), ('manage_staff',\n 'Manage staff.'), ('impersonate_users', 'Impersonate customers.'))}"}), "(name='user', options={'permissions': ((\... |
# -*- coding: UTF-8 -*-
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
... | [
"paddle.static.InputSpec",
"os.path.join",
"argparse.ArgumentParser",
"paddle.load"
] | [((855, 887), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['__doc__'], {}), '(__doc__)\n', (878, 887), False, 'import argparse\n'), ((1811, 1840), 'paddle.load', 'paddle.load', (['args.params_path'], {}), '(args.params_path)\n', (1822, 1840), False, 'import paddle\n'), ((1573, 1612), 'os.path.join', 'os.path... |
from cloudinary.models import CloudinaryField
from django.contrib.auth import get_user_model
from django.db import models
# Create your models here.
from MetioTube.core.validators import validate_video_file, validate_image
UserModel = get_user_model()
class Video(models.Model):
title = models.CharField(
... | [
"django.contrib.auth.get_user_model",
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.IntegerField",
"django.db.models.DateTimeField",
"cloudinary.models.CloudinaryField",
"django.db.models.CharField"
] | [((237, 253), 'django.contrib.auth.get_user_model', 'get_user_model', ([], {}), '()\n', (251, 253), False, 'from django.contrib.auth import get_user_model\n'), ((295, 326), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(30)'}), '(max_length=30)\n', (311, 326), False, 'from django.db import mode... |
# -*- coding: utf-8 -*-
"""
Created on Fri Dec 6 13:45:30 2019
@author: LOVESA
"""
#importing relevant packages
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
import os
import cv2
import math
from os.path import isfile, join
import Helper as Functions
#Paramet... | [
"matplotlib.pyplot.imshow",
"Helper.region_of_interest",
"Helper.canny",
"numpy.copy",
"Helper.hough_lines",
"numpy.ones",
"Helper.weighted_img",
"numpy.array",
"Helper.grayscale",
"Helper.gaussian_blur"
] | [((910, 927), 'matplotlib.pyplot.imshow', 'plt.imshow', (['image'], {}), '(image)\n', (920, 927), True, 'import matplotlib.pyplot as plt\n'), ((1136, 1162), 'Helper.grayscale', 'Functions.grayscale', (['image'], {}), '(image)\n', (1155, 1162), True, 'import Helper as Functions\n'), ((1168, 1197), 'matplotlib.pyplot.ims... |
# =========================================
# IMPORTS
# --------------------------------------
import rootpath
rootpath.append()
from humanizer.tests import helper
# =========================================
# RUN
# --------------------------------------
helper.run(__file__)
| [
"rootpath.append",
"humanizer.tests.helper.run"
] | [((120, 137), 'rootpath.append', 'rootpath.append', ([], {}), '()\n', (135, 137), False, 'import rootpath\n'), ((274, 294), 'humanizer.tests.helper.run', 'helper.run', (['__file__'], {}), '(__file__)\n', (284, 294), False, 'from humanizer.tests import helper\n')] |
import os
import mock
import pytest
from prequ._pip_compat import PIP_10_OR_NEWER, PIP_192_OR_NEWER, path_to_url
from prequ.exceptions import DependencyResolutionFailed
from prequ.repositories.pypi import PyPIRepository
from prequ.scripts._repo import get_pip_command
PY27_LINUX64_TAGS = [
('cp27', 'cp27mu', 'man... | [
"mock.patch",
"prequ._pip_compat.path_to_url",
"os.path.split",
"pytest.raises",
"prequ.scripts._repo.get_pip_command",
"prequ.repositories.pypi.PyPIRepository"
] | [((6478, 6510), 'prequ._pip_compat.path_to_url', 'path_to_url', (['failing_package_dir'], {}), '(failing_package_dir)\n', (6489, 6510), False, 'from prequ._pip_compat import PIP_10_OR_NEWER, PIP_192_OR_NEWER, path_to_url\n'), ((7468, 7485), 'prequ.scripts._repo.get_pip_command', 'get_pip_command', ([], {}), '()\n', (74... |
'''
@Author: <NAME>
@Date: 2020-03-20 15:54:19
LastEditors: <NAME>
LastEditTime: 2021-05-04 19:31:24
@Description:
@Email: <EMAIL>
@Company: SZU
@Version: 1.0
'''
from flask import abort, jsonify, Flask, request, Response
from flask import make_response, send_from_directory
import datetime
from flask_cors import CORS
i... | [
"os.path.exists",
"flask.send_from_directory",
"flask_cors.CORS",
"flask.Flask",
"argparse.ArgumentParser",
"base64.b64encode",
"base64.b64decode",
"os.mkdir",
"os.path.abspath",
"flask.make_response",
"time.time",
"flask.jsonify"
] | [((645, 660), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (650, 660), False, 'from flask import abort, jsonify, Flask, request, Response\n'), ((661, 686), 'flask_cors.CORS', 'CORS', (['app'], {'resources': '"""/*"""'}), "(app, resources='/*')\n", (665, 686), False, 'from flask_cors import CORS\n'), ((45... |
# _*_ coding: utf-8 _*_
import re
import pytest # type: ignore
from pydantic.error_wrappers import ValidationError
from pydantic.errors import ConfigError
from fhir.resources.fhirtypes import Id
from fhir.resources.organization import Organization
def test_primitive_type_id():
"""Issue#https://github.com/nazru... | [
"fhir.resources.organization.Organization",
"pytest.raises",
"fhir.resources.fhirtypes.Id.configure_constraints",
"re.compile"
] | [((1438, 1478), 'fhir.resources.fhirtypes.Id.configure_constraints', 'Id.configure_constraints', ([], {'max_length': '(128)'}), '(max_length=128)\n', (1462, 1478), False, 'from fhir.resources.fhirtypes import Id\n'), ((1483, 1516), 'fhir.resources.organization.Organization', 'Organization', ([], {}), '(**org_resource_c... |
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicode_literals
import pytest
import csv
from random import randint
from mipqctool.model import qctypes
from mipqctool.config import ERROR
# Tests
@pytest.mark.parametrize('value, res... | [
"csv.DictReader",
"mipqctool.model.qctypes.profile_integer",
"mipqctool.model.qctypes.get_suffix_integer",
"mipqctool.model.qctypes.describe_integer",
"pytest.mark.parametrize",
"mipqctool.model.qctypes.infer_integer",
"random.randint",
"pytest.warns"
] | [((285, 646), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""value, result"""', "[('13', 'd'), ('13(cm3)', 'd(cm3)'), ('0.', ERROR), ('0.3 %', ERROR), (\n '23,4', ERROR), ('12341 123', ERROR), ('123.223 3', ERROR), ('test112',\n ERROR), ('1231 thisvery(long)suffix', ERROR), (14, 'd'), (32.32, ERROR),... |
import sys
from cx_Freeze import setup, Executable
# Dependencies are automatically detected, but it might need fine tuning.
build_exe_options = {"packages": ["os"]}
# GUI applications require a different base on Windows (the default is for a
# console application).
if sys.platform == "win32":
base = "Win32GUI"
... | [
"cx_Freeze.Executable"
] | [((492, 535), 'cx_Freeze.Executable', 'Executable', (['"""imageset-viewer.py"""'], {'base': 'base'}), "('imageset-viewer.py', base=base)\n", (502, 535), False, 'from cx_Freeze import setup, Executable\n')] |
from .storage_util import directory_size, directory_size_w_exclusions, find_oldest_backup
from display_util.string_display_util import print_info, print_warning, print_notification
import archive_util.archive as archive
from archive_util.archive import zip_dir, zip_dir_delete_orig
from colorama import Fore
import os
im... | [
"tempfile.TemporaryDirectory",
"display_util.string_display_util.print_warning",
"archive_util.archive.zip_dir",
"archive_util.archive.zip_dir_delete_orig",
"display_util.string_display_util.print_info",
"display_util.string_display_util.print_notification",
"os.remove"
] | [((1443, 1479), 'display_util.string_display_util.print_info', 'print_info', (['"""Zipping target folders"""'], {}), "('Zipping target folders')\n", (1453, 1479), False, 'from display_util.string_display_util import print_info, print_warning, print_notification\n'), ((1567, 1632), 'tempfile.TemporaryDirectory', 'tempfi... |
# Manual download instead of using snakemake remote function because we snakemake checks for updates on the remote files
def download(link,output):
cmd = "curl -L -o " + output + " " + link
return(cmd)
def has_custom_db(tool):
import os
return True if os.path.isfile(workflow.basedir + "/tools/"+tool+"_db_custom.sm... | [
"os.path.isfile"
] | [((257, 326), 'os.path.isfile', 'os.path.isfile', (["(workflow.basedir + '/tools/' + tool + '_db_custom.sm')"], {}), "(workflow.basedir + '/tools/' + tool + '_db_custom.sm')\n", (271, 326), False, 'import os\n')] |
import json
import pandas as pd
import constants
def recommender(df):
recommended = df.sample(n=5)
return recommended["recipe_id"]
if __name__ == "__main__":
df = pd.read_csv(constants.ROOT+"/resources/recipe_data.csv")
recommendations = recommender(df)
recipes = {}
for recipe_id in recomm... | [
"json.dumps",
"pandas.read_csv"
] | [((181, 239), 'pandas.read_csv', 'pd.read_csv', (["(constants.ROOT + '/resources/recipe_data.csv')"], {}), "(constants.ROOT + '/resources/recipe_data.csv')\n", (192, 239), True, 'import pandas as pd\n'), ((431, 460), 'json.dumps', 'json.dumps', (['recipes'], {'indent': '(4)'}), '(recipes, indent=4)\n', (441, 460), Fals... |
import csv # csv libary
import cv2
from math import ceil
import numpy as np
import matplotlib.pyplot as plt
import sklearn
from sklearn.utils import shuffle
from sklearn.model_selection import train_test_split
from scipy import ndimage
# Global Parameters
epochs = 5
batch_size = 32
validation_split = 0.2
correction =... | [
"keras.layers.core.Flatten",
"matplotlib.pyplot.ylabel",
"scipy.ndimage.imread",
"numpy.array",
"keras.layers.pooling.MaxPooling2D",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"csv.reader",
"matplotlib.pyplot.savefig",
"keras.layers.convolutional.Cropping2D",
"sklearn.model_selection.... | [((3208, 3259), 'sklearn.model_selection.train_test_split', 'train_test_split', (['lines'], {'test_size': 'validation_split'}), '(lines, test_size=validation_split)\n', (3224, 3259), False, 'from sklearn.model_selection import train_test_split\n'), ((3916, 3928), 'keras.models.Sequential', 'Sequential', ([], {}), '()\n... |
from pyweidentity.weidentityService import weidentityService
URL = "http://172.16.58.3:6001"
# WeIdentity RestService URL
weid = weidentityService(URL)
# create_weid = weid.create_weidentity_did()
# print(create_weid)
_weid = "did:weid:3:0xbce3653371dd7d77aebd17a6832dca8eb8c8a212"
# 创建cpt
# cptJsonSchema = {
# ... | [
"pyweidentity.weidentityService.weidentityService"
] | [((131, 153), 'pyweidentity.weidentityService.weidentityService', 'weidentityService', (['URL'], {}), '(URL)\n', (148, 153), False, 'from pyweidentity.weidentityService import weidentityService\n')] |
import logging
import subprocess
import uuid
import boto3
import os
import json
import sys
import math
import PIL.Image as Image
from botocore.exceptions import ClientError
s3 = boto3.client('s3')
rek = boto3.client('rekognition')
sqs = boto3.client('sqs')
dynamoDBTableName = "metaData"
dynamodb = boto3.resource("dy... | [
"logging.getLogger",
"subprocess.check_output",
"os.listdir",
"boto3.client",
"PIL.Image.open",
"os.environ.get",
"os.path.join",
"math.log",
"boto3.resource",
"os.path.basename",
"logging.error",
"os.remove"
] | [((180, 198), 'boto3.client', 'boto3.client', (['"""s3"""'], {}), "('s3')\n", (192, 198), False, 'import boto3\n'), ((205, 232), 'boto3.client', 'boto3.client', (['"""rekognition"""'], {}), "('rekognition')\n", (217, 232), False, 'import boto3\n'), ((239, 258), 'boto3.client', 'boto3.client', (['"""sqs"""'], {}), "('sq... |
import scipy.io as io
import numpy as np
import os
from dataset.data_util import pil_load_img
from dataset.dataload import TextDataset, TextInstance
class TotalText(TextDataset):
def __init__(self, data_root, ignore_list=None, is_training=True, transform=None):
super().__init__(transform)
self.da... | [
"os.listdir",
"scipy.io.loadmat",
"os.path.join",
"util.augmentation.Augmentation",
"numpy.stack",
"dataset.data_util.pil_load_img",
"dataset.dataload.TextInstance"
] | [((2619, 2663), 'util.augmentation.Augmentation', 'Augmentation', ([], {'size': '(512)', 'mean': 'means', 'std': 'stds'}), '(size=512, mean=means, std=stds)\n', (2631, 2663), False, 'from util.augmentation import BaseTransform, Augmentation\n'), ((628, 697), 'os.path.join', 'os.path.join', (['data_root', '"""Images"""'... |
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
from ..pr... | [
"numpy.issubdtype"
] | [((1355, 1405), 'numpy.issubdtype', 'np.issubdtype', (['op.classes_.dtype', 'np.signedinteger'], {}), '(op.classes_.dtype, np.signedinteger)\n', (1368, 1405), True, 'import numpy as np\n')] |
import argparse
import json
import sys
import Image
from instance import *
from rich.progress import track
import PixivAPI
import complex_image
def update():
download_test = False
response = PixivAPI.get("https://raw.githubusercontent.com/Elaina-Alex/pixiv_crawler/main/update.json")
if not os... | [
"PixivAPI.PixivApp.get_user_info",
"PixivAPI.rec_id",
"PixivAPI.Tag.search_information",
"argparse.ArgumentParser",
"PixivAPI.PixivLogin.open_browser",
"Image.ImageInfo",
"PixivAPI.refresh_pixiv_token",
"PixivAPI.PixivApp.recommend_images",
"PixivAPI.PixivApp.author_information",
"PixivAPI.PixivAp... | [((213, 315), 'PixivAPI.get', 'PixivAPI.get', (['"""https://raw.githubusercontent.com/Elaina-Alex/pixiv_crawler/main/update.json"""'], {}), "(\n 'https://raw.githubusercontent.com/Elaina-Alex/pixiv_crawler/main/update.json'\n )\n", (225, 315), False, 'import PixivAPI\n'), ((8337, 8362), 'argparse.ArgumentParser',... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#from __future__ import division, with_statement
'''
Copyright 2013, 陈同 (<EMAIL>).
===========================================================
'''
__author__ = 'chentong & ct586[9]'
__author_email__ = '<EMAIL>'
#=========================================================
de... | [
"statsmodels.stats.multitest.multipletests",
"json.dumps",
"optparse.OptionParser",
"math.log",
"scipy.stats.stats.pearsonr",
"sys.exit",
"os.system",
"time.localtime"
] | [((1089, 1105), 'optparse.OptionParser', 'OP', ([], {'usage': 'usages'}), '(usage=usages)\n', (1091, 1105), True, 'from optparse import OptionParser as OP\n'), ((827, 856), 'json.dumps', 'json_dumps', (['content'], {'indent': '(1)'}), '(content, indent=1)\n', (837, 856), True, 'from json import dumps as json_dumps\n'),... |
import django_filters
import django_tables2 as tables
from django import forms
from django.db.models import Q
from reimbursement.models import Reimbursement, RE_STATUS
class ReimbursementFilter(django_filters.FilterSet):
search = django_filters.CharFilter(method='search_filter', label='Search')
sta... | [
"django.db.models.Q",
"django_filters.MultipleChoiceFilter",
"django_filters.CharFilter",
"django_tables2.TemplateColumn",
"django_tables2.CheckBoxColumn"
] | [((246, 311), 'django_filters.CharFilter', 'django_filters.CharFilter', ([], {'method': '"""search_filter"""', 'label': '"""Search"""'}), "(method='search_filter', label='Search')\n", (271, 311), False, 'import django_filters\n'), ((326, 448), 'django_filters.MultipleChoiceFilter', 'django_filters.MultipleChoiceFilter'... |