code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# Lint as: python2, python3
# Copyright 2019 Google LLC. 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless re... | [
"subprocess.check_output",
"tensorflow.python.platform.app.run",
"google.protobuf.text_format.Parse",
"requests.post",
"argparse.ArgumentParser",
"tensorflow_transform.tf_metadata.schema_utils.schema_as_feature_spec",
"json.dumps",
"tensorflow.python.lib.io.file_io.read_file_to_string",
"tensorflow_... | [((1670, 1720), 'tensorflow_transform.tf_metadata.dataset_schema.from_feature_spec', 'dataset_schema.from_feature_spec', (['raw_feature_spec'], {}), '(raw_feature_spec)\n', (1702, 1720), False, 'from tensorflow_transform.tf_metadata import dataset_schema\n'), ((1730, 1770), 'tensorflow_transform.coders.ExampleProtoCode... |
#!/usr/bin/env python
"""Test checkpoint-like periodic snapshots.
We test that there are that many folders and that the currentStep changes.
"""
import mirheo as mir
u = mir.Mirheo(nranks=(1, 1, 1), domain=(4, 6, 8), debug_level=3,
log_filename='log', no_splash=True,
checkpoint_every=1... | [
"mirheo.Interactions.Pairwise",
"mirheo.Integrators.Minimize",
"mirheo.Mirheo",
"mirheo.ParticleVectors.ParticleVector",
"mirheo.InitialConditions.Uniform"
] | [((174, 420), 'mirheo.Mirheo', 'mir.Mirheo', ([], {'nranks': '(1, 1, 1)', 'domain': '(4, 6, 8)', 'debug_level': '(3)', 'log_filename': '"""log"""', 'no_splash': '(True)', 'checkpoint_every': '(10)', 'checkpoint_mode': '"""Incremental"""', 'checkpoint_folder': '"""periodic_snapshots/snapshot_"""', 'checkpoint_mechanism'... |
from abc import ABC, abstractmethod
from typing import Optional
from xml import dom
import numpy as np
import pandas as pd
from .utils import get_factors_rev
def calc_plot_size(domain_x, domain_y, plot_goal, house_goal):
f1 = sorted(get_factors_rev(domain_x))
f2 = sorted(get_factors_rev(domain_y))
plot_... | [
"numpy.tile",
"numpy.ceil",
"numpy.where",
"numpy.floor",
"numpy.zeros",
"numpy.savetxt",
"numpy.concatenate",
"pandas.DataFrame",
"numpy.full",
"numpy.pad"
] | [((1874, 1945), 'pandas.DataFrame', 'pd.DataFrame', (['plots'], {'columns': "['px', 'py', 'domx', 'domy', 'trimmed_dy']"}), "(plots, columns=['px', 'py', 'domx', 'domy', 'trimmed_dy'])\n", (1886, 1945), True, 'import pandas as pd\n'), ((4922, 4965), 'numpy.savetxt', 'np.savetxt', (['filename', 'matrix'], {'delimiter': ... |
#!/usr/bin/env python3
# -*- config: utf-8 -*-
from tkinter import *
from random import random
def on_click():
x = random()
y = random()
bt1.place(relx=x, rely=y)
root = Tk()
root['bg'] = 'white'
root.title('crown')
img = PhotoImage(file='crown.png')
bt1 = Button(image=img, command=on_click)
bt1.place... | [
"random.random"
] | [((122, 130), 'random.random', 'random', ([], {}), '()\n', (128, 130), False, 'from random import random\n'), ((139, 147), 'random.random', 'random', ([], {}), '()\n', (145, 147), False, 'from random import random\n')] |
from django.core.exceptions import ValidationError
from django.core.validators import validate_email
from django.template import Template, TemplateSyntaxError, TemplateDoesNotExist
from django.utils.encoding import force_str
def validate_email_with_name(value):
"""
Validate email address.
Both "<NAME> <<... | [
"django.utils.encoding.force_str",
"django.template.Template",
"django.core.validators.validate_email",
"django.core.exceptions.ValidationError"
] | [((374, 390), 'django.utils.encoding.force_str', 'force_str', (['value'], {}), '(value)\n', (383, 390), False, 'from django.utils.encoding import force_str\n'), ((588, 613), 'django.core.validators.validate_email', 'validate_email', (['recipient'], {}), '(recipient)\n', (602, 613), False, 'from django.core.validators i... |
# Input DOI / URL
import re
import sys
# Pyperclip is not built-in, check and download if needed
try:
import pyperclip
except (ImportError, ModuleNotFoundError):
print('Pyperclip module not found. Please download it.')
sys.exit(0)
# Regex for links
link_regex = re.compile(r'''(
http[s]?://
(?:[a-... | [
"pyperclip.paste",
"sys.exit",
"re.match",
"re.compile"
] | [((277, 450), 're.compile', 're.compile', (['"""(\n http[s]?://\n (?:[a-zA-Z]|\n [0-9]|\n [$-_@.&+]|\n [!*\\\\(\\\\),]|\n (?:%[0-9a-fA-F][0-9a-fA-F]))+\n )"""', '(re.IGNORECASE | re.VERBOSE)'], {}), '(\n """(\n http[s]?://\n (?:[a-zA-Z]|\n [0-9]|\n [$-_@.&+]|\n [!*\\\\(\\\\),]|\n ... |
import os
import sys
import logging
import time
import argparse
import numpy as np
from collections import OrderedDict
import scripts.options as option
import utils.util as util
from data.util import bgr2ycbcr
from data import create_dataset, create_dataloader
from models import create_model
# options
parser = argpar... | [
"logging.getLogger",
"utils.util.calculate_ssim",
"utils.util.tensor2img",
"argparse.ArgumentParser",
"scripts.options.dict2str",
"collections.OrderedDict",
"scripts.options.dict_to_nonedict",
"utils.util.saveEXRfromMatrix",
"utils.util.mkdir",
"utils.util.tensor2exr",
"utils.util.calculate_psnr... | [((314, 339), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (337, 339), False, 'import argparse\n'), ((584, 612), 'scripts.options.dict_to_nonedict', 'option.dict_to_nonedict', (['opt'], {}), '(opt)\n', (607, 612), True, 'import scripts.options as option\n'), ((614, 706), 'utils.util.setup_log... |
from api import db
from uuid import uuid4
from ariadne import MutationType
from api.models import Post
from api.store import queues
mutation = MutationType()
@mutation.field("createPost")
async def create_post_resolver(obj, info, input):
try:
post = Post(postId=uuid4(), caption=input["caption"])
... | [
"api.db.session.commit",
"api.db.session.add",
"uuid.uuid4",
"ariadne.MutationType"
] | [((145, 159), 'ariadne.MutationType', 'MutationType', ([], {}), '()\n', (157, 159), False, 'from ariadne import MutationType\n'), ((320, 340), 'api.db.session.add', 'db.session.add', (['post'], {}), '(post)\n', (334, 340), False, 'from api import db\n'), ((349, 368), 'api.db.session.commit', 'db.session.commit', ([], {... |
import abc
from typing import TypeVar, Generic, List, Dict
T = TypeVar('T')
class CRUDInterface(Generic[T], metaclass=abc.ABCMeta):
@abc.abstractmethod
def all(self) -> List[T]:
pass
@abc.abstractmethod
def one_by_id(self, entity_id: int) -> T:
pass
@abc.abstractmethod
def ... | [
"typing.TypeVar"
] | [((64, 76), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {}), "('T')\n", (71, 76), False, 'from typing import TypeVar, Generic, List, Dict\n')] |
# Copyright 2015 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 applica... | [
"mistral.context.ctx",
"six.text_type",
"mistral.api.controllers.v2.resources.Services",
"mistral.service.coordination.get_service_coordinator",
"wsmeext.pecan.wsexpose",
"mistral.exceptions.CoordinationException",
"mistral.api.controllers.v2.resources.Service.from_dict",
"oslo_log.log.getLogger"
] | [((1153, 1180), 'oslo_log.log.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1170, 1180), True, 'from oslo_log import log as logging\n'), ((1282, 1321), 'wsmeext.pecan.wsexpose', 'wsme_pecan.wsexpose', (['resources.Services'], {}), '(resources.Services)\n', (1301, 1321), True, 'import wsmeext.pec... |
from setuptools import setup
setup(
name="greek-utils",
version="0.2",
description="various utilities for processing Ancient Greek",
license="MIT",
url="http://github.com/jtauber/greek-utils",
author="<NAME>",
author_email="<EMAIL>",
packages=["greekutils"],
classifiers=[
"D... | [
"setuptools.setup"
] | [((30, 649), 'setuptools.setup', 'setup', ([], {'name': '"""greek-utils"""', 'version': '"""0.2"""', 'description': '"""various utilities for processing Ancient Greek"""', 'license': '"""MIT"""', 'url': '"""http://github.com/jtauber/greek-utils"""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'packages':... |
"""
tweet stuff in intervals
"""
import time
import datetime
import twitter
from markov_chains import german_text
from config import config_no, config_yes
MAX_TWEET_LENGTH = 280
greeting = ' Sehr geehrte/r Anstragssteller/in.'
ending = ' MfG'
num_tweets = 3
class FoiaBot:
def __init__(self, config):
s... | [
"time.strptime",
"time.mktime",
"datetime.datetime.now",
"twitter.Api",
"markov_chains.german_text.setup_model"
] | [((330, 553), 'twitter.Api', 'twitter.Api', ([], {'consumer_key': "config['consumer_key']", 'consumer_secret': "config['consumer_secret']", 'access_token_key': "config['access_token']", 'access_token_secret': "config['access_token_secret']", 'sleep_on_rate_limit': '(True)'}), "(consumer_key=config['consumer_key'], cons... |
from django.conf import settings
from netaddr import mac_unix, mac_eui48
import importlib
import warnings
class mac_linux(mac_unix):
"""MAC format with zero-padded all upper-case hex and colon separated"""
word_fmt = '%.2X'
def default_dialect(eui_obj=None):
# Check to see if a default dialect class has... | [
"warnings.warn",
"django.conf.settings.MACADDRESS_DEFAULT_DIALECT.split",
"pkg_resources.get_distribution",
"importlib.import_module"
] | [((2348, 2385), 'pkg_resources.get_distribution', 'get_distribution', (['"""django-macaddress"""'], {}), "('django-macaddress')\n", (2364, 2385), False, 'from pkg_resources import get_distribution, DistributionNotFound\n'), ((825, 871), 'django.conf.settings.MACADDRESS_DEFAULT_DIALECT.split', 'settings.MACADDRESS_DEFAU... |
from django.db import models
from utils.models import BaseModel
from users.models import User, Address
from goods.models import GoodsSKU
# Create your models here.
class OrderInfo(BaseModel):
"""订单信息"""
PAY_METHOD = ['1', '2']
PAY_METHOD_CHOICES = (
(1, "货到付款"),
(2, "支付宝"),
)
OR... | [
"django.db.models.TextField",
"django.db.models.IntegerField",
"django.db.models.ForeignKey",
"django.db.models.SmallIntegerField",
"django.db.models.DecimalField",
"django.db.models.CharField"
] | [((911, 980), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(64)', 'primary_key': '(True)', 'verbose_name': '"""订单号"""'}), "(max_length=64, primary_key=True, verbose_name='订单号')\n", (927, 980), False, 'from django.db import models\n'), ((992, 1062), 'django.db.models.ForeignKey', 'models.Foreig... |
import os
from pathlib import Path
from typing import Any, Dict
from determined.common import util
MASTER_SCHEME = "http"
MASTER_IP = "localhost"
MASTER_PORT = "8080"
DET_VERSION = None
DEFAULT_MAX_WAIT_SECS = 1800
MAX_TASK_SCHEDULED_SECS = 30
MAX_TRIAL_BUILD_SECS = 90
DEFAULT_TF1_CPU_IMAGE = "determinedai/environm... | [
"os.path.dirname",
"determined.common.util.safe_load_yaml_with_exceptions",
"os.environ.get",
"pathlib.Path"
] | [((703, 734), 'os.environ.get', 'os.environ.get', (['"""TF1_CPU_IMAGE"""'], {}), "('TF1_CPU_IMAGE')\n", (717, 734), False, 'import os\n'), ((776, 807), 'os.environ.get', 'os.environ.get', (['"""TF2_CPU_IMAGE"""'], {}), "('TF2_CPU_IMAGE')\n", (790, 807), False, 'import os\n'), ((849, 880), 'os.environ.get', 'os.environ.... |
from django.contrib.contenttypes.models import ContentType
from rest_framework import serializers, exceptions
from greenbudget.lib.rest_framework_utils.fields import ModelChoiceField
from greenbudget.lib.rest_framework_utils.serializers import (
EnhancedModelSerializer)
from greenbudget.app.budget.models import B... | [
"rest_framework.serializers.DateTimeField",
"rest_framework.serializers.IntegerField",
"rest_framework.serializers.PrimaryKeyRelatedField",
"django.contrib.contenttypes.models.ContentType.objects.get_for_model",
"greenbudget.lib.rest_framework_utils.fields.ModelChoiceField",
"greenbudget.app.common.serial... | [((760, 800), 'rest_framework.serializers.IntegerField', 'serializers.IntegerField', ([], {'read_only': '(True)'}), '(read_only=True)\n', (784, 800), False, 'from rest_framework import serializers, exceptions\n'), ((812, 849), 'rest_framework.serializers.CharField', 'serializers.CharField', ([], {'read_only': '(True)'}... |
import contextlib
import logging
import typing
from typing import Any, Dict, Tuple
import attr
from dbnd._core.configuration import get_dbnd_project_config
from dbnd._core.constants import (
RESULT_PARAM,
DbndTargetOperationStatus,
DbndTargetOperationType,
TaskRunState,
)
from dbnd._core.current impo... | [
"logging.getLogger",
"dbnd._core.tracking.script_tracking_manager.try_get_inplace_tracking_task_run",
"dbnd._core.current.current_task_run",
"dbnd._core.utils.callable_spec.args_to_kwargs",
"targets.values.get_value_type_of_obj",
"dbnd._core.current.is_verbose",
"dbnd._core.task_build.task_definition.Ta... | [((1443, 1470), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1460, 1470), False, 'import logging\n'), ((1538, 1547), 'attr.ib', 'attr.ib', ([], {}), '()\n', (1545, 1547), False, 'import attr\n'), ((1587, 1596), 'attr.ib', 'attr.ib', ([], {}), '()\n', (1594, 1596), False, 'import attr\n... |
import os
import logging
from json import loads, dumps
from datetime import timedelta
from argparse import ArgumentParser
from redis import Redis
from flask import Response, Flask, request
app = Flask(__name__)
log = logging.getLogger(__name__)
parser = ArgumentParser()
parser.add_argument("-a", "--address",
... | [
"logging.getLogger",
"json.loads",
"argparse.ArgumentParser",
"flask.Flask",
"json.dumps",
"redis.Redis",
"flask.request.headers.get"
] | [((197, 212), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (202, 212), False, 'from flask import Response, Flask, request\n'), ((219, 246), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (236, 246), False, 'import logging\n'), ((257, 273), 'argparse.ArgumentParser', 'Argume... |
"""
启动此 spider 前需要手动启动 Chrome,cmd 命令如下:
cd 进入 Chrome 可执行文件 所在的目录
执行:chrome.exe --remote-debugging-port=9222
此时在浏览器窗口地址栏访问:http://127.0.0.1:9222/json,如果页面出现 json 数据,则表明手动启动成功
启动此 spider 后,注意与命令行交互!
在 settings 当中要做的:
# ROBOTSTXT_OBEY = False # 如果不关闭,parse 方法无法执行
# COOKIES_ENABLED = True # 以便 Request 值在传递时自动传递 cookies... | [
"ZhihuSpider.items.ZhihuAnswerItem",
"json.loads",
"ZhihuSpider.items.ZhihuQuestionItem",
"re.match",
"datetime.datetime.now",
"scrapy.Request",
"ZhihuSpider.utils.browsezhihu.get_cookies",
"urllib.parse.urljoin"
] | [((4606, 4631), 'json.loads', 'json.loads', (['response.text'], {}), '(response.text)\n', (4616, 4631), False, 'import json\n'), ((5969, 5982), 'ZhihuSpider.utils.browsezhihu.get_cookies', 'get_cookies', ([], {}), '()\n', (5980, 5982), False, 'from ZhihuSpider.utils.browsezhihu import get_cookies\n'), ((2082, 2114), 'u... |
import nose
import angr
import logging
l = logging.getLogger("angr.tests.test_bindiff")
import os
test_location = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..', 'binaries', 'tests')
# todo make a better test
def test_bindiff_x86_64():
binary_path_1 = os.path.join(test_location, 'x86_64', '... | [
"logging.getLogger",
"angr.Project",
"os.path.join",
"os.path.realpath",
"nose.tools.assert_in"
] | [((44, 88), 'logging.getLogger', 'logging.getLogger', (['"""angr.tests.test_bindiff"""'], {}), "('angr.tests.test_bindiff')\n", (61, 88), False, 'import logging\n'), ((281, 331), 'os.path.join', 'os.path.join', (['test_location', '"""x86_64"""', '"""bindiff_a"""'], {}), "(test_location, 'x86_64', 'bindiff_a')\n", (293,... |
from pathlib import Path
BASE_DIR = Path(__file__).resolve().parent.parent
# def handle_uploaded_file(f):
# with open('screenshot.png', 'wb') as destination:
# # for chunk in f.chunks():
# # destination.write(chunk)
# destination.write(f)
with open(
BASE_DIR/'media'/'Greater_coat... | [
"pathlib.Path"
] | [((38, 52), 'pathlib.Path', 'Path', (['__file__'], {}), '(__file__)\n', (42, 52), False, 'from pathlib import Path\n')] |
#!/usr/bin/env python3
#
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | [
"aiohttp.web.run_app",
"os.getenv",
"aiohttp.web.Response",
"capstone.Cs",
"aiohttp.web.Application",
"asyncio.Queue",
"gdbproc.GDBProcess.create",
"aiohttp.web.get",
"asyncio.gather",
"socketio.AsyncServer",
"asyncio.get_event_loop"
] | [((1008, 1062), 'capstone.Cs', 'capstone.Cs', (['capstone.CS_ARCH_X86', 'capstone.CS_MODE_64'], {}), '(capstone.CS_ARCH_X86, capstone.CS_MODE_64)\n', (1019, 1062), False, 'import capstone\n'), ((1070, 1092), 'socketio.AsyncServer', 'socketio.AsyncServer', ([], {}), '()\n', (1090, 1092), False, 'import socketio\n'), ((1... |
from django.core.urlresolvers import reverse
from sentry.models import Project
from sentry.testutils import APITestCase
class ProjectDetailsTest(APITestCase):
def test_simple(self):
project = self.project # force creation
self.login_as(user=self.user)
url = reverse('sentry-api-0-project-d... | [
"sentry.models.Project.objects.filter",
"sentry.models.Project.objects.get",
"django.core.urlresolvers.reverse"
] | [((289, 363), 'django.core.urlresolvers.reverse', 'reverse', (['"""sentry-api-0-project-details"""'], {'kwargs': "{'project_id': project.id}"}), "('sentry-api-0-project-details', kwargs={'project_id': project.id})\n", (296, 363), False, 'from django.core.urlresolvers import reverse\n'), ((669, 743), 'django.core.urlres... |
# encoding: utf-8
"""Unit-test suite for `pptx.table` module."""
import pytest
from pptx.dml.fill import FillFormat
from pptx.dml.border import BorderFormat
from pptx.enum.text import MSO_ANCHOR
from pptx.oxml.ns import qn
from pptx.oxml.table import CT_Table, CT_TableCell, TcRange
from pptx.shapes.graphfrm import G... | [
"pptx.table._Cell",
"pptx.table._CellCollection",
"pptx.table._RowCollection",
"pptx.table._ColumnCollection",
"pptx.oxml.ns.qn",
"pytest.raises",
"pytest.fixture",
"pptx.util.Inches",
"pptx.table.Table",
"pptx.util.Pt"
] | [((4728, 5322), 'pytest.fixture', 'pytest.fixture', ([], {'params': "[('a:tbl', 'first_row', False), ('a:tbl/a:tblPr', 'first_row', False), (\n 'a:tbl/a:tblPr{firstRow=1}', 'first_row', True), (\n 'a:tbl/a:tblPr{firstRow=0}', 'first_row', False), (\n 'a:tbl/a:tblPr{firstRow=true}', 'first_row', True), (\n '... |
from serial import Serial
from tqdm import tqdm
import binascii
import hashlib
import struct
import time
import sys
import os
def if_read(ser, data_len):
data = bytearray(0)
received = 0
while received < data_len:
tmp = ser.read(data_len - received)
if len(tmp) == 0:
... | [
"hashlib.sha256",
"binascii.hexlify",
"tqdm.tqdm",
"struct.pack",
"time.sleep",
"os.path.realpath",
"struct.unpack",
"serial.Serial",
"sys.exit"
] | [((528, 543), 'time.sleep', 'time.sleep', (['(0.2)'], {}), '(0.2)\n', (538, 543), False, 'import time\n'), ((858, 873), 'time.sleep', 'time.sleep', (['(0.2)'], {}), '(0.2)\n', (868, 873), False, 'import time\n'), ((898, 914), 'time.sleep', 'time.sleep', (['(0.05)'], {}), '(0.05)\n', (908, 914), False, 'import time\n'),... |
import random
def estimate_pi(sims, needles):
trials = []
for _ in xrange(sims):
trials.append(simulate_pi(needles))
mean = sum(trials) / sims
return mean
# use a unit square
def simulate_pi(needles):
hits = 0 # how many hits we hit the circle
for _ in xrange(needles):
x = ran... | [
"random.uniform"
] | [((317, 342), 'random.uniform', 'random.uniform', (['(-1.0)', '(1.0)'], {}), '(-1.0, 1.0)\n', (331, 342), False, 'import random\n'), ((353, 376), 'random.uniform', 'random.uniform', (['(-1)', '(1.0)'], {}), '(-1, 1.0)\n', (367, 376), False, 'import random\n')] |
#!/usr/bin/env python3
#
# This file is part of the MicroPython project, http://micropython.org/
#
# The MIT License (MIT)
#
# Copyright (c) 2019 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in t... | [
"makeqstrdata.qstr_escape",
"re.search",
"argparse.ArgumentParser",
"makeqstrdata.static_qstr_list.index",
"re.match",
"elftools.elf.elffile.ELFFile",
"struct.pack",
"os.path.dirname",
"struct.pack_into",
"sys.exit",
"struct.unpack_from"
] | [((2472, 2506), 'struct.pack', 'struct.pack', (['"""<BI"""', '(233)', '(entry - 5)'], {}), "('<BI', 233, entry - 5)\n", (2483, 2506), False, 'import sys, os, struct, re\n'), ((2835, 2861), 'struct.pack', 'struct.pack', (['"""<HH"""', 'b0', 'b1'], {}), "('<HH', b0, b1)\n", (2846, 2861), False, 'import sys, os, struct, r... |
from PyQt4 import QtGui
from ui_mant_libros_new import NewLibrosWindow
from ui_mant_libros_edit import EditLibrosWindow
from ui_mant_libros_id_edit import GetIdEditWindow
# Debug only
import inspect
class MenuLibros(QtGui.QWidget):
"""
Ventana-menu para editar Libros
"""
def __init__(self):
... | [
"ui_mant_libros_new.NewLibrosWindow",
"PyQt4.QtGui.QApplication",
"inspect.stack",
"PyQt4.QtGui.QPushButton",
"ui_mant_libros_id_edit.GetIdEditWindow",
"PyQt4.QtGui.QIcon",
"PyQt4.QtGui.QVBoxLayout",
"PyQt4.QtGui.QHBoxLayout"
] | [((2188, 2216), 'PyQt4.QtGui.QApplication', 'QtGui.QApplication', (['sys.argv'], {}), '(sys.argv)\n', (2206, 2216), False, 'from PyQt4 import QtGui\n'), ((658, 684), 'PyQt4.QtGui.QPushButton', 'QtGui.QPushButton', (['"""Nuevo"""'], {}), "('Nuevo')\n", (675, 684), False, 'from PyQt4 import QtGui\n'), ((780, 807), 'PyQt4... |
import logging
import re
from anime_downloader.extractors.base_extractor import BaseExtractor
from anime_downloader.sites import helpers
logger = logging.getLogger(__name__)
class VidStream(BaseExtractor):
def _get_data(self):
QUALITIES = {
"360":[],
"480":[],
"720":[],
"10... | [
"logging.getLogger",
"anime_downloader.sites.helpers.get",
"re.search"
] | [((147, 174), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (164, 174), False, 'import logging\n'), ((410, 426), 'anime_downloader.sites.helpers.get', 'helpers.get', (['url'], {}), '(url)\n', (421, 426), False, 'from anime_downloader.sites import helpers\n'), ((585, 606), 'anime_download... |
# Copyright © 2020 Province of British Columbia
#
# 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 agr... | [
"registry_schemas.validate",
"copy.deepcopy"
] | [((921, 948), 'copy.deepcopy', 'copy.deepcopy', (['SEARCH_QUERY'], {}), '(SEARCH_QUERY)\n', (934, 948), False, 'import copy\n'), ((1195, 1232), 'registry_schemas.validate', 'validate', (['query', '"""searchQuery"""', '"""ppr"""'], {}), "(query, 'searchQuery', 'ppr')\n", (1203, 1232), False, 'from registry_schemas impor... |
"""
Module to contain Pywork decorators
"""
__author__ = '<NAME>'
import re
import time
import itertools
import logging
log = logging.getLogger(__name__)
| [
"logging.getLogger"
] | [((129, 156), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (146, 156), False, 'import logging\n')] |
from __future__ import unicode_literals
import pytest
from django.test import TestCase
from rest_framework import status
from rest_framework.authentication import BasicAuthentication
from rest_framework.decorators import (
action, api_view, authentication_classes, detail_route, list_route,
parser_classes, per... | [
"rest_framework.decorators.renderer_classes",
"rest_framework.decorators.permission_classes",
"rest_framework.decorators.list_route",
"rest_framework.decorators.authentication_classes",
"rest_framework.decorators.api_view",
"rest_framework.response.Response",
"rest_framework.decorators.throttle_classes"... | [((856, 875), 'rest_framework.test.APIRequestFactory', 'APIRequestFactory', ([], {}), '()\n', (873, 875), False, 'from rest_framework.test import APIRequestFactory\n'), ((997, 1064), 'rest_framework.views.APIView.finalize_response', 'APIView.finalize_response', (['self', 'request', 'response', '*args'], {}), '(self, re... |
# Copyright (c) 2020, <NAME>, Honda Research Institute Europe GmbH, and
# Technical University of Darmstadt.
# 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 mus... | [
"pyrado.tasks.sequential.SequentialTasks",
"numpy.array",
"pyrado.tasks.final_reward.FinalRewMode",
"numpy.add.at",
"pyrado.tasks.condition_only.ConditionOnlyTask",
"numpy.empty",
"numpy.concatenate",
"pyrado.ValueErr",
"pyrado.tasks.masked.MaskedTask",
"pyrado.spaces.box.BoxSpace",
"pyrado.spac... | [((6388, 6439), 'os.path.join', 'osp.join', (['pyrado.MUJOCO_ASSETS_DIR', 'graph_file_name'], {}), '(pyrado.MUJOCO_ASSETS_DIR, graph_file_name)\n', (6396, 6439), True, 'import os.path as osp\n'), ((7273, 7351), 'numpy.concatenate', 'np.concatenate', (['[self.init_qpos, self.init_qvel, init_ball_pos, init_cup_goal]'], {... |
# pyRasp
# Copyright (c) <NAME> 2020. Licensed under MIT.
# requirement :
# Python 3
# pip install pyyaml
# pip install request
# pip install f90nml
from downloadGFSA import downloadGFSA
from prepare_wps import prepare_wps
from ungrib import ungrib
from metgrid import metgrid
from prepare_wrf import prepare_wrf
fro... | [
"real.real",
"prepare_wrf.prepare_wrf",
"ungrib.ungrib",
"prepare_wps.prepare_wps",
"downloadGFSA.downloadGFSA",
"metgrid.metgrid",
"wrf.wrf"
] | [((369, 387), 'downloadGFSA.downloadGFSA', 'downloadGFSA', (['(True)'], {}), '(True)\n', (381, 387), False, 'from downloadGFSA import downloadGFSA\n'), ((388, 407), 'prepare_wps.prepare_wps', 'prepare_wps', (['result'], {}), '(result)\n', (399, 407), False, 'from prepare_wps import prepare_wps\n'), ((408, 416), 'ungrib... |
import pandas as pd
import ta
from app.common import reshape_data
from app.strategies.base_strategy import BaseStrategy
pd.set_option("display.max_columns", None)
pd.set_option("display.width", None)
class EMABBAlligatorStrategy(BaseStrategy):
BUY_SIGNAL = "buy_signal"
SELL_SIGNAL = "sell_signal"
def c... | [
"ta.momentum.AwesomeOscillatorIndicator",
"pandas.set_option"
] | [((122, 164), 'pandas.set_option', 'pd.set_option', (['"""display.max_columns"""', 'None'], {}), "('display.max_columns', None)\n", (135, 164), True, 'import pandas as pd\n'), ((165, 201), 'pandas.set_option', 'pd.set_option', (['"""display.width"""', 'None'], {}), "('display.width', None)\n", (178, 201), True, 'import... |
import numpy as np
import matplotlib.pyplot as plt
from scipy import stats
from sklearn.linear_model import ARDRegression, LinearRegression
# Parameters of the example
np.random.seed(0)
n_samples, n_features = 100, 100
# Create Gaussian data
X = np.random.randn(n_samples, n_features)
# Create weights with a precision... | [
"numpy.sqrt",
"sds.distributions.lingauss.SingleOutputLinearGaussianWithKnownPrecision",
"matplotlib.pyplot.ylabel",
"sklearn.linear_model.ARDRegression",
"copy.deepcopy",
"numpy.atleast_2d",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"sds.distributions.gaussian.GaussianWithKnownMeanAndDi... | [((170, 187), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (184, 187), True, 'import numpy as np\n'), ((248, 286), 'numpy.random.randn', 'np.random.randn', (['n_samples', 'n_features'], {}), '(n_samples, n_features)\n', (263, 286), True, 'import numpy as np\n'), ((352, 372), 'numpy.zeros', 'np.zeros',... |
#!/usr/bin/python3
import os
import json
import re
import ast
import json
from graphviz import Digraph
import pandas as pd
# color the graph
import graph_tool.all as gt
import copy
import matplotlib.colors as mcolors
import sys
import utils
from tompkins.ilp import schedule, jobs_when_where
from collections import d... | [
"os.listdir",
"os.path.join",
"graph_tool.all.Graph",
"tompkins.ilp.jobs_when_where",
"tompkins.ilp.schedule",
"matplotlib.colors.CSS4_COLORS.keys",
"pulp.value",
"collections.defaultdict",
"graphviz.Digraph",
"pulp.GUROBI_CMD",
"time.time"
] | [((626, 647), 'os.listdir', 'os.listdir', (['stats_dir'], {}), '(stats_dir)\n', (636, 647), False, 'import os\n'), ((1123, 1167), 'os.path.join', 'os.path.join', (['stats_dir', 'f"""{benchmark}.iopt"""'], {}), "(stats_dir, f'{benchmark}.iopt')\n", (1135, 1167), False, 'import os\n'), ((2469, 2513), 'os.path.join', 'os.... |
import datetime as dt
import logging
from babel import Locale, UnknownLocaleError
from babel.dates import format_datetime, format_time, format_date
import pytz
from tzlocal import get_localzone
from . import settings
logger = logging.getLogger(__name__)
class LocaleHelper:
"""Helpers for converting date & tim... | [
"logging.getLogger",
"pytz.timezone",
"babel.dates.format_time",
"tzlocal.get_localzone",
"babel.dates.format_date",
"babel.Locale.parse",
"babel.dates.format_datetime",
"babel.Locale.default"
] | [((230, 257), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (247, 257), False, 'import logging\n'), ((2602, 2661), 'babel.dates.format_date', 'format_date', (['my_datetime'], {'format': '"""full"""', 'locale': 'self.locale'}), "(my_datetime, format='full', locale=self.locale)\n", (2613, ... |
import signal
class KillableProcess(object):
def __init__(self):
self.interrupt = False
signal.signal(signal.SIGTERM, self._signal_handler)
signal.signal(signal.SIGINT, self._signal_handler)
def _signal_handler(self, sign, frame):
self.interrupt = True | [
"signal.signal"
] | [((110, 161), 'signal.signal', 'signal.signal', (['signal.SIGTERM', 'self._signal_handler'], {}), '(signal.SIGTERM, self._signal_handler)\n', (123, 161), False, 'import signal\n'), ((170, 220), 'signal.signal', 'signal.signal', (['signal.SIGINT', 'self._signal_handler'], {}), '(signal.SIGINT, self._signal_handler)\n', ... |
#
# Copyright (c) 2016 <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, ... | [
"behem0th.utils.read_file_seq",
"json.loads",
"select.select",
"behem0th.log.error",
"os.rename",
"base64.b64encode",
"json.dumps",
"base64.b64decode",
"behem0th.log.info_v",
"behem0th.log.info",
"os.mkdir",
"tempfile.NamedTemporaryFile",
"queue.Queue",
"behem0th.log.warn",
"os.remove"
] | [((5172, 5185), 'queue.Queue', 'queue.Queue', ([], {}), '()\n', (5183, 5185), False, 'import queue\n'), ((5679, 5745), 'behem0th.log.info', 'log.info', (['"""Connected to {0}:{1}"""', 'self.address[0]', 'self.address[1]'], {}), "('Connected to {0}:{1}', self.address[0], self.address[1])\n", (5687, 5745), False, 'from b... |
from django.utils.translation import gettext
from wagtail.admin.rich_text.editors.draftail import features as draftail_features
from wagtail.core import hooks
from .richtext import KaTeXEntityElementHandler, katex_entity_decorator
@hooks.register('register_rich_text_features')
def register_katex_features(features):... | [
"wagtail.core.hooks.register",
"django.utils.translation.gettext"
] | [((236, 281), 'wagtail.core.hooks.register', 'hooks.register', (['"""register_rich_text_features"""'], {}), "('register_rich_text_features')\n", (250, 281), False, 'from wagtail.core import hooks\n'), ((855, 874), 'django.utils.translation.gettext', 'gettext', (['"""Equation"""'], {}), "('Equation')\n", (862, 874), Fal... |
'''
Copyright 2017 Dell Inc. or its subsidiaries. All Rights Reserved.
This script tests arbitrary payload of the RackHD API 2.0 OS bootstrap workflows.
The default case is running a minimum payload Windows OS install.
Other Windows-type OS install cases can be specified by creating a payload file and specifiying it u... | [
"fit_common.cancel_active_workflows",
"json.loads",
"datetime.datetime.fromtimestamp",
"nose.plugins.attrib.attr",
"fit_common.unittest.main",
"fit_common.json.dumps",
"json.dumps",
"flogging.get_loggers",
"time.time",
"fit_common.fitcfg",
"fit_common.time.sleep",
"fit_common.rackhdapi",
"fi... | [((1983, 2005), 'flogging.get_loggers', 'flogging.get_loggers', ([], {}), '()\n', (2003, 2005), False, 'import flogging\n'), ((5096, 5111), 'nose.plugins.attrib.attr', 'attr', ([], {'all': '(False)'}), '(all=False)\n', (5100, 5111), False, 'from nose.plugins.attrib import attr\n'), ((7596, 7628), 'nosedep.depends', 'de... |
from flask import Flask, render_template
from flask_ask import Ask, statement
import random
app = Flask(__name__)
ask = Ask(app, '/')
@ask.intent('RandomNumber', convert={'lowerLimit': int, 'upperLimit': int})
def hello(lowerLimit, upperLimit):
if lowerLimit == None:
lowerLimit = 0
if upperLimit == None:
upperL... | [
"flask.render_template",
"flask_ask.Ask",
"flask.Flask",
"flask_ask.statement",
"random.randint"
] | [((99, 114), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (104, 114), False, 'from flask import Flask, render_template\n'), ((121, 134), 'flask_ask.Ask', 'Ask', (['app', '"""/"""'], {}), "(app, '/')\n", (124, 134), False, 'from flask_ask import Ask, statement\n'), ((341, 379), 'random.randint', 'random.r... |
import numpy as np
import pybullet as p
import itertools
from robot import Robot
class World():
def __init__(self):
# create the physics simulator
self.physicsClient = p.connect(p.GUI)
p.setGravity(0,0,-9.81)
self.max_communication_distance = 2.0
# We will int... | [
"pybullet.resetDebugVisualizerCamera",
"robot.Robot",
"pybullet.loadSDF",
"pybullet.connect",
"pybullet.setGravity",
"pybullet.setPhysicsEngineParameter",
"pybullet.changeDynamics",
"numpy.linalg.norm",
"pybullet.stepSimulation",
"pybullet.resetBasePositionAndOrientation",
"pybullet.loadURDF"
] | [((194, 210), 'pybullet.connect', 'p.connect', (['p.GUI'], {}), '(p.GUI)\n', (203, 210), True, 'import pybullet as p\n'), ((219, 244), 'pybullet.setGravity', 'p.setGravity', (['(0)', '(0)', '(-9.81)'], {}), '(0, 0, -9.81)\n', (231, 244), True, 'import pybullet as p\n'), ((386, 437), 'pybullet.setPhysicsEngineParameter'... |
"""
입력 예시
3 16
출력 예시
3
5
7
11
13
"""
import math
left, right = map(int, input().split())
array = [True for i in range(right+1)]
array[1] = 0
for i in range(2, int(math.sqrt(right)) + 1):
if array[i] == True:
j = 2
while i * j <= right:
array[i * j] = False
j += 1
for i in... | [
"math.sqrt"
] | [((166, 182), 'math.sqrt', 'math.sqrt', (['right'], {}), '(right)\n', (175, 182), False, 'import math\n')] |
# Copyright 2015 The TensorFlow 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 applica... | [
"tensorflow.tools.quantization.quantize_graph.set_attr_dtype",
"tensorflow.python.framework.importer.import_graph_def",
"numpy.array",
"tensorflow.tools.quantization.quantize_graph.quantize_weight_eightbit",
"tensorflow.core.framework.graph_pb2.GraphDef",
"numpy.reshape",
"tensorflow.tools.quantization.... | [((1481, 1496), 'tensorflow.python.framework.ops.Graph', 'ops_lib.Graph', ([], {}), '()\n', (1494, 1496), True, 'from tensorflow.python.framework import ops as ops_lib\n'), ((1888, 1908), 'tensorflow.core.framework.graph_pb2.GraphDef', 'graph_pb2.GraphDef', ([], {}), '()\n', (1906, 1908), False, 'from tensorflow.core.f... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.10 on 2018-04-26 09:14
import colorfield.fields
from django.db import migrations, models
import django.db.models.deletion
import giscube.utils
class Migration(migrations.Migration):
initial = True
dependencies = [
('giscube', '0002_update'),
]... | [
"django.db.models.DateField",
"django.db.models.TextField",
"django.db.models.IntegerField",
"django.db.models.ForeignKey",
"django.db.models.FileField",
"django.db.models.BooleanField",
"django.db.models.AutoField",
"django.db.models.DecimalField",
"django.db.models.CharField"
] | [((450, 543), '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", (466, 543), False, 'from django.db import migrations, models\... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-06-09 03:01
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('extensions', '0011_auto_20170502_0908'),
]
operations = [
migrations.AlterF... | [
"django.db.models.CharField"
] | [((413, 465), 'django.db.models.CharField', 'models.CharField', ([], {'default': '"""imports/"""', 'max_length': '(255)'}), "(default='imports/', max_length=255)\n", (429, 465), False, 'from django.db import migrations, models\n')] |
'''
multi-threading (python3 version)
https://docs.python.org/3/library/threading.html
'''
from time import clock
import threading
THREADS=2
lock = threading.Lock()
A = 0
B = 0
C = 0
def test_globals():
global A, B, C
for i in range(1024*1024):
lock.acquire()
A += 1
B += 2
C = A + B
lock.release()
def... | [
"threading.Lock",
"threading.Thread",
"time.clock"
] | [((150, 166), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (164, 166), False, 'import threading\n'), ((377, 384), 'time.clock', 'clock', ([], {}), '()\n', (382, 384), False, 'from time import clock\n'), ((431, 477), 'threading.Thread', 'threading.Thread', ([], {'target': 'test_globals', 'args': '()'}), '(targe... |
import numpy as np
class Board:
"""
0 - black
1 - white
"""
def __init__(self):
board = [
[0, 1] * 4,
[1, 0] * 4
] * 4
players_board = [
[0, 1] * 4, # player 1
[1, 0] * 4
] + [[0] * 8] * 4 + [ # 4 rows of nothing
[0, 2] * 4, # player 2
[2, 0] * 4
]
se... | [
"numpy.array"
] | [((331, 346), 'numpy.array', 'np.array', (['board'], {}), '(board)\n', (339, 346), True, 'import numpy as np\n'), ((372, 395), 'numpy.array', 'np.array', (['players_board'], {}), '(players_board)\n', (380, 395), True, 'import numpy as np\n')] |
#
# This file is part of LiteX-Boards.
#
# Copyright (c) 2017-2019 <NAME> <<EMAIL>>
# SPDX-License-Identifier: BSD-2-Clause
from litex.build.generic_platform import *
from litex.build.xilinx import XilinxPlatform, VivadoProgrammer
# IOs ---------------------------------------------------------------------------------... | [
"litex.build.xilinx.XilinxPlatform.__init__",
"litex.build.xilinx.VivadoProgrammer",
"litex.build.xilinx.XilinxPlatform.do_finalize"
] | [((18029, 18124), 'litex.build.xilinx.XilinxPlatform.__init__', 'XilinxPlatform.__init__', (['self', '"""xcku040-ffva1156-2-e"""', '_io', '_connectors'], {'toolchain': '"""vivado"""'}), "(self, 'xcku040-ffva1156-2-e', _io, _connectors,\n toolchain='vivado')\n", (18052, 18124), False, 'from litex.build.xilinx import ... |
import os
import traceback
class InputHandler:
IMAGES_PARENT_FOLDER = './images'
def __init__(self):
filesList = []
def listFiles(self,path=''):
if path != '':
self.IMAGES_PARENT_FOLDER = path
try:
self.listFiles = [os.path.join(self.IMAGES_PAREN... | [
"traceback.print_exec",
"os.listdir",
"os.path.join"
] | [((290, 340), 'os.path.join', 'os.path.join', (['self.IMAGES_PARENT_FOLDER', 'imageFile'], {}), '(self.IMAGES_PARENT_FOLDER, imageFile)\n', (302, 340), False, 'import os\n'), ((357, 394), 'os.listdir', 'os.listdir', (['self.IMAGES_PARENT_FOLDER'], {}), '(self.IMAGES_PARENT_FOLDER)\n', (367, 394), False, 'import os\n'),... |
import os
import tmdbsimple as tmdb
import media
import fresh_tomatoes as ft
movies = []
if os.environ.get('TMDB_API', False):
# Retrieve API KEY
tmdb.API_KEY = os.environ['TMDB_API']
# TMDB Movie Ids
movie_ids = [271110, 297761, 246655, 278154, 135397, 188927]
# Get Configuration
configurat... | [
"fresh_tomatoes.open_movies_page",
"tmdbsimple.Configuration",
"os.environ.get",
"media.Movie",
"tmdbsimple.Movies"
] | [((94, 127), 'os.environ.get', 'os.environ.get', (['"""TMDB_API"""', '(False)'], {}), "('TMDB_API', False)\n", (108, 127), False, 'import os\n'), ((4683, 4710), 'fresh_tomatoes.open_movies_page', 'ft.open_movies_page', (['movies'], {}), '(movies)\n', (4702, 4710), True, 'import fresh_tomatoes as ft\n'), ((1066, 1087), ... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file './elements_ui.ui',
# licensing of './elements_ui.ui' applies.
#
# Created: Wed Jun 16 14:29:03 2021
# by: pyside2-uic running on PySide2 5.13.2
#
# WARNING! All changes made in this file will be lost!
from PySide2 import QtCore, QtGui... | [
"PySide2.QtCore.QMetaObject.connectSlotsByName",
"PySide2.QtGui.QIcon",
"PySide2.QtWidgets.QSizePolicy",
"PySide2.QtWidgets.QTableView",
"PySide2.QtWidgets.QStatusBar",
"PySide2.QtGui.QPixmap",
"PySide2.QtWidgets.QFrame",
"PySide2.QtWidgets.QHBoxLayout",
"PySide2.QtCore.QRect",
"PySide2.QtCore.QSi... | [((531, 564), 'PySide2.QtWidgets.QWidget', 'QtWidgets.QWidget', (['ElementsWindow'], {}), '(ElementsWindow)\n', (548, 564), False, 'from PySide2 import QtCore, QtGui, QtWidgets\n'), ((655, 696), 'PySide2.QtWidgets.QVBoxLayout', 'QtWidgets.QVBoxLayout', (['self.centralwidget'], {}), '(self.centralwidget)\n', (676, 696),... |
from tanim.utils.config_ops import digest_config
from tanim.utils.iterables import list_update
# Currently, this is only used by both Scene and Mobject.
# Still, we abstract its functionality here, albeit purely nominally.
# All actual implementation has to be handled by derived classes for now.
class Container(obj... | [
"tanim.utils.config_ops.digest_config",
"tanim.utils.iterables.list_update"
] | [((368, 395), 'tanim.utils.config_ops.digest_config', 'digest_config', (['self', 'kwargs'], {}), '(self, kwargs)\n', (381, 395), False, 'from tanim.utils.config_ops import digest_config\n'), ((619, 658), 'tanim.utils.iterables.list_update', 'list_update', (['self.submobjects', 'mobjects'], {}), '(self.submobjects, mobj... |
import numpy as np
from pysz import compress, decompress
def test_compress_decompress():
a = np.linspace(0, 100, num=1000000).reshape((100, 100, 100)).astype(np.float32)
tolerance = 0.0001
compressed = compress(a, tolerance=tolerance)
recovered = decompress(compressed, a.shape, a.dtype)
asse... | [
"pysz.decompress",
"numpy.linspace",
"pysz.compress",
"numpy.allclose"
] | [((216, 248), 'pysz.compress', 'compress', (['a'], {'tolerance': 'tolerance'}), '(a, tolerance=tolerance)\n', (224, 248), False, 'from pysz import compress, decompress\n'), ((266, 306), 'pysz.decompress', 'decompress', (['compressed', 'a.shape', 'a.dtype'], {}), '(compressed, a.shape, a.dtype)\n', (276, 306), False, 'f... |
import json
from sparkdq.outliers.params.OutlierSolverParams import OutlierSolverParams
from sparkdq.outliers.OutlierSolver import OutlierSolver
class KSigmaParams(OutlierSolverParams):
def __init__(self, deviation=1.5):
self.deviation = deviation
def model(self):
return OutlierSolver.kSigm... | [
"json.loads"
] | [((382, 402), 'json.loads', 'json.loads', (['json_str'], {}), '(json_str)\n', (392, 402), False, 'import json\n')] |
import re
from setuptools import setup, find_packages
import sys
if sys.version_info < (3, 5):
raise 'must use Python version 3.5 or higher'
with open('./gmailapi_backend/__init__.py', 'r') as f:
MATCH_EXPR = "__version__[^'\"]+(['\"])([^'\"]+)"
VERSION = re.search(MATCH_EXPR, f.read()).group(2).strip()
... | [
"setuptools.find_packages"
] | [((398, 413), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (411, 413), False, 'from setuptools import setup, find_packages\n')] |
"""Script to ensure a configuration file exists."""
import argparse
import os
import openpeerpower.config as config_util
from openpeerpower.core import OpenPeerPower
# mypy: allow-untyped-calls, allow-untyped-defs
def run(args):
"""Handle ensure config commandline script."""
parser = argparse.ArgumentParser... | [
"os.makedirs",
"argparse.ArgumentParser",
"os.getcwd",
"openpeerpower.core.OpenPeerPower",
"os.path.isdir",
"openpeerpower.config.async_ensure_config_exists",
"openpeerpower.config.get_default_config_dir"
] | [((297, 406), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Ensure a Open Peer Power config exists, creates one if necessary."""'}), "(description=\n 'Ensure a Open Peer Power config exists, creates one if necessary.')\n", (320, 406), False, 'import argparse\n'), ((998, 1013), 'openp... |
#!/bin/env python
from black import main
import spacy
import json
from spacy import displacy
import unidecode
import pandas as pd
import numpy as np
import os
csv_source = "scripts/spacy_files/data/thesis_200_with_school.csv"
df = pd.read_csv(csv_source)
df = df[df['isScan']==False]
df = df.sort_values('isScan', asce... | [
"json.load",
"pandas.read_csv",
"unidecode.unidecode"
] | [((233, 256), 'pandas.read_csv', 'pd.read_csv', (['csv_source'], {}), '(csv_source)\n', (244, 256), True, 'import pandas as pd\n'), ((465, 480), 'json.load', 'json.load', (['file'], {}), '(file)\n', (474, 480), False, 'import json\n'), ((701, 727), 'unidecode.unidecode', 'unidecode.unidecode', (['text1'], {}), '(text1)... |
from django.db import models
from django import forms
from audit_log.models.managers import AuditLog
# Create your models here.
class Port(models.Model):
name = models.CharField(max_length=250)
port = models.CharField(max_length=250)
description = models.TextField(blank=True)
audit_log = AuditLog()... | [
"django.db.models.TextField",
"audit_log.models.managers.AuditLog",
"django.db.models.CharField"
] | [((169, 201), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(250)'}), '(max_length=250)\n', (185, 201), False, 'from django.db import models\n'), ((213, 245), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(250)'}), '(max_length=250)\n', (229, 245), False, 'from django.d... |
import tensorflow as tf
import json
import math
import cv2
import time
import argparse
import concurrent.futures
import posenet
import keyboard
import sys
import numpy as np
from threading import Thread
from slugify import slugify
parser = argparse.ArgumentParser()
parser.add_argument('--model', type=int, default=101)... | [
"argparse.ArgumentParser",
"posenet.draw_skel_and_kp",
"math.sqrt",
"posenet.read_cap",
"keyboard.is_pressed",
"cv2.imshow",
"time.sleep",
"posenet.load_model",
"cv2.waitKey",
"cv2.destroyAllWindows",
"cv2.VideoCapture",
"time.time",
"tensorflow.compat.v1.Session"
] | [((241, 266), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (264, 266), False, 'import argparse\n'), ((6386, 6456), 'math.sqrt', 'math.sqrt', (['((pointB[0] - pointA[0]) ** 2 + (pointB[1] - pointA[1]) ** 2)'], {}), '((pointB[0] - pointA[0]) ** 2 + (pointB[1] - pointA[1]) ** 2)\n', (6395, 6456)... |
# 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, software
# distrib... | [
"otcextensions.sdk.dcs.v1.restore.Restore.existing",
"random.choice",
"otcextensions.sdk.dcs.v1.statistic.Statistic.existing",
"mock.Mock",
"otcextensions.sdk.dcs.v1.config.Config.existing",
"uuid.uuid4",
"otcextensions.sdk.dcs.v1.instance.Instance.existing",
"otcextensions.sdk.dcs.v1.backup.Backup.ex... | [((1083, 1094), 'mock.Mock', 'mock.Mock', ([], {}), '()\n', (1092, 1094), False, 'import mock\n'), ((1181, 1192), 'mock.Mock', 'mock.Mock', ([], {}), '()\n', (1190, 1192), False, 'import mock\n'), ((1229, 1240), 'mock.Mock', 'mock.Mock', ([], {}), '()\n', (1238, 1240), False, 'import mock\n'), ((1273, 1284), 'mock.Mock... |
# -*- coding:utf-8 -*-
# Copyright (c) 2020 Huawei Technologies Co.,Ltd.
#
# openGauss is licensed under Mulan PSL v2.
# You can use this software according to the terms
# and conditions of the Mulan PSL v2.
# You may obtain a copy of Mulan PSL v2 at:
#
# http://license.coscl.org.cn/MulanPSL2
#
# THIS SOFTWARE... | [
"subprocess.getstatusoutput"
] | [((1074, 1105), 'subprocess.getstatusoutput', 'subprocess.getstatusoutput', (['cmd'], {}), '(cmd)\n', (1100, 1105), False, 'import subprocess\n'), ((1848, 1879), 'subprocess.getstatusoutput', 'subprocess.getstatusoutput', (['cmd'], {}), '(cmd)\n', (1874, 1879), False, 'import subprocess\n'), ((2293, 2324), 'subprocess.... |
import subprocess
from .Genome_fasta import get_fasta
import matplotlib
matplotlib.use('Agg')
from matplotlib import pyplot as plt
import numpy as np
import pysam
def run(parser):
args = parser.parse_args()
bases,chrs = get_fasta(args.genome)
l={}
for c in chrs:
l[c]=len(bases[c])
chrs = se... | [
"matplotlib.pyplot.savefig",
"argparse.ArgumentParser",
"matplotlib.use",
"matplotlib.pyplot.pie",
"pysam.AlignmentFile",
"numpy.array",
"matplotlib.pyplot.figure",
"numpy.zeros",
"matplotlib.pyplot.axis",
"matplotlib.pyplot.subplot",
"numpy.arange"
] | [((72, 93), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (86, 93), False, 'import matplotlib\n'), ((1984, 1996), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (1994, 1996), True, 'from matplotlib import pyplot as plt\n'), ((2001, 2017), 'matplotlib.pyplot.subplot', 'plt.subplot', ... |
#!/usr/bin/env python3
# Copyright 2016 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | [
"potty_oh.common.get_cmd_line_parser",
"potty_oh.common.ParserArguments.length",
"potty_oh.common.ParserArguments.filename",
"potty_oh.waveform.mix_down",
"potty_oh.common.call_main",
"potty_oh.common.ParserArguments.set_defaults",
"potty_oh.signal_generator.Generator",
"potty_oh.common.ParserArgument... | [((958, 1005), 'potty_oh.common.get_cmd_line_parser', 'common.get_cmd_line_parser', ([], {'description': '__doc__'}), '(description=__doc__)\n', (984, 1005), False, 'from potty_oh import common\n'), ((1010, 1049), 'potty_oh.common.ParserArguments.filename', 'common.ParserArguments.filename', (['parser'], {}), '(parser)... |
from dataclasses import dataclass
from hrepr import H
from hrepr import hrepr as real_hrepr
from hrepr.h import styledir
from .common import one_test_per_assert
css_hrepr = open(f"{styledir}/hrepr.css", encoding="utf-8").read()
hrepr = real_hrepr.variant(fill_resources=False)
@dataclass
class Point:
x: int
... | [
"hrepr.H.raw",
"hrepr.H.div",
"hrepr.hrepr",
"hrepr.H.meta",
"hrepr.hrepr.page",
"hrepr.H.b",
"hrepr.hrepr.variant",
"hrepr.H.style"
] | [((239, 279), 'hrepr.hrepr.variant', 'real_hrepr.variant', ([], {'fill_resources': '(False)'}), '(fill_resources=False)\n', (257, 279), True, 'from hrepr import hrepr as real_hrepr\n'), ((8050, 8126), 'hrepr.H.meta', 'H.meta', (["{'http-equiv': 'Content-type'}"], {'content': '"""text/html"""', 'charset': '"""UTF-8"""'}... |
import numpy as np
from unittest import TestCase
import numpy.testing as npt
from distancematrix.util import diag_indices_of
from distancematrix.consumer.distance_matrix import DistanceMatrix
class TestContextualMatrixProfile(TestCase):
def setUp(self):
self.dist_matrix = np.array([
[8.67, 1... | [
"numpy.atleast_2d",
"numpy.testing.assert_equal",
"numpy.full_like",
"distancematrix.util.diag_indices_of",
"numpy.array",
"distancematrix.consumer.distance_matrix.DistanceMatrix",
"numpy.full"
] | [((289, 1251), 'numpy.array', 'np.array', (['[[8.67, 1.1, 1.77, 1.26, 1.91, 4.29, 6.32, 4.24, 4.64, 5.06, 6.41, 4.07, \n 4.67, 9.32, 5.09], [4.33, 4.99, 0.14, 2.79, 2.1, 6.26, 9.4, 4.14, 5.53,\n 4.26, 8.21, 5.91, 6.83, 9.26, 6.19], [0.16, 9.05, 1.35, 4.78, 7.01, \n 4.36, 5.24, 8.81, 7.9, 5.84, 8.9, 7.88, 3.37,... |
"""Constants file for Supervisor."""
from enum import Enum
from ipaddress import ip_network
from pathlib import Path
SUPERVISOR_VERSION = "DEV"
URL_HASSIO_ADDONS = "https://github.com/home-assistant/addons"
URL_HASSIO_APPARMOR = "https://version.home-assistant.io/apparmor.txt"
URL_HASSIO_VERSION = "https://version.ho... | [
"ipaddress.ip_network",
"pathlib.Path"
] | [((371, 384), 'pathlib.Path', 'Path', (['"""/data"""'], {}), "('/data')\n", (375, 384), False, 'from pathlib import Path\n'), ((407, 443), 'pathlib.Path', 'Path', (['SUPERVISOR_DATA', '"""addons.json"""'], {}), "(SUPERVISOR_DATA, 'addons.json')\n", (411, 443), False, 'from pathlib import Path\n'), ((463, 497), 'pathlib... |
import torch
import torch.nn as nn
import os
import torch.nn.functional as F
class LDS(nn.Module):
def __init__(self,):
super(LDS, self).__init__()
self.pool1 = nn.MaxPool2d(kernel_size=(2, 2), stride=2, padding=0)
self.pool2 = nn.MaxPool2d(kernel_size=(2, 2), stride=2, padding=0)
... | [
"torch.nn.functional.upsample",
"torch.nn.BatchNorm2d",
"torch.nn.ReLU",
"torch.nn.Softmax",
"torch.nn.ModuleList",
"torch.load",
"os.path.splitext",
"torch.nn.Conv2d",
"torch.nn.MaxPool2d",
"torch.cat"
] | [((12471, 12519), 'torch.nn.MaxPool2d', 'nn.MaxPool2d', ([], {'kernel_size': '(3)', 'stride': '(1)', 'padding': '(1)'}), '(kernel_size=3, stride=1, padding=1)\n', (12483, 12519), True, 'import torch.nn as nn\n'), ((12532, 12590), 'torch.nn.Conv2d', 'nn.Conv2d', (['(512)', '(1024)'], {'kernel_size': '(3)', 'padding': '(... |
from __future__ import (absolute_import, division, print_function, unicode_literals)
from builtins import (ascii, bytes, chr, dict, filter, hex, input, int, map, next, oct, open, pow, range, round, str,
super, zip)
from ...._utils import send_session_request
from ..._PortalEndpointBase import Por... | [
"builtins.super"
] | [((659, 666), 'builtins.super', 'super', ([], {}), '()\n', (664, 666), False, 'from builtins import ascii, bytes, chr, dict, filter, hex, input, int, map, next, oct, open, pow, range, round, str, super, zip\n')] |
from unittest import TestCase
import numpy as np
from robustnessgym.cachedops.spacy import Spacy
from robustnessgym.slicebuilders.subpopulations.length import LengthSubpopulation
from tests.testbeds import MockTestBedv0
class TestLengthSubpopulation(TestCase):
def setUp(self):
self.testbed = MockTestBed... | [
"tests.testbeds.MockTestBedv0",
"robustnessgym.cachedops.spacy.Spacy",
"numpy.array",
"robustnessgym.cachedops.spacy.Spacy.retrieve",
"robustnessgym.slicebuilders.subpopulations.length.LengthSubpopulation"
] | [((309, 324), 'tests.testbeds.MockTestBedv0', 'MockTestBedv0', ([], {}), '()\n', (322, 324), False, 'from tests.testbeds import MockTestBedv0\n'), ((490, 537), 'robustnessgym.slicebuilders.subpopulations.length.LengthSubpopulation', 'LengthSubpopulation', ([], {'intervals': '[(1, 3), (4, 5)]'}), '(intervals=[(1, 3), (4... |
import json
from astroquery.vizier import Vizier
with open("Jankowski_2018_raw.txt", "r") as raw_file:
lines = raw_file.readlines()
print(lines)
pulsar_dict = {}
for row in lines[3:]:
row = row.split("|")
print(row)
pulsar = row[0].strip().replace("−", "-")
freqs = []
fluxs = []
flux_e... | [
"json.dumps"
] | [((1103, 1126), 'json.dumps', 'json.dumps', (['pulsar_dict'], {}), '(pulsar_dict)\n', (1113, 1126), False, 'import json\n')] |
# Copyright (c) 2019 Leiden University Medical Center
#
# 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, me... | [
"pathlib.Path"
] | [((1269, 1285), 'pathlib.Path', 'Path', (['"""applause"""'], {}), "('applause')\n", (1273, 1285), False, 'from pathlib import Path\n'), ((1320, 1334), 'pathlib.Path', 'Path', (['"""buzzer"""'], {}), "('buzzer')\n", (1324, 1334), False, 'from pathlib import Path\n'), ((1205, 1219), 'pathlib.Path', 'Path', (['"""sounds""... |
#!/usr/bin/env python3
# Copyright (c) 2016 Anki, 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 in the file LICENSE.txt or at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unles... | [
"aiohttp.web.run_app",
"sys.exit",
"cozmo.logger.warning",
"aiohttp.web.Response",
"aiohttp.web.Application",
"cozmo.connect_on_loop",
"cozmo.setup_basic_logging",
"re.search"
] | [((4131, 4148), 'aiohttp.web.Application', 'web.Application', ([], {}), '()\n', (4146, 4148), False, 'from aiohttp import web\n'), ((4596, 4648), 're.search', 're.search', (['"""([\\\\w.]+)@([\\\\w.]+)"""', 'from_email_address'], {}), "('([\\\\w.]+)@([\\\\w.]+)', from_email_address)\n", (4605, 4648), False, 'import re\... |
# -*- coding: utf-8 -*-
"""
Created on Fri May 30 17:15:27 2014
@author: Parke
"""
from __future__ import division, print_function, absolute_import
import numpy as np
import matplotlib as mplot
import matplotlib.pyplot as plt
import mypy.my_numpy as mnp
dpi = 100
fullwidth = 10.0
halfwidth = 5.0
# use these with li... | [
"numpy.log10",
"numpy.sqrt",
"numpy.array",
"numpy.sin",
"mypy.my_numpy.inranges",
"mayavi.mlab.view",
"numpy.isscalar",
"numpy.asarray",
"numpy.diff",
"numpy.max",
"numpy.issubdtype",
"numpy.linspace",
"mayavi.mlab.quiver3d",
"matplotlib.pyplot.axis",
"numpy.abs",
"numpy.allclose",
... | [((1184, 1196), 'numpy.array', 'np.array', (['xy'], {}), '(xy)\n', (1192, 1196), True, 'import numpy as np\n'), ((1998, 2009), 'numpy.log10', 'np.log10', (['x'], {}), '(x)\n', (2006, 2009), True, 'import numpy as np\n'), ((2378, 2395), 'numpy.asarray', 'np.asarray', (['edges'], {}), '(edges)\n', (2388, 2395), True, 'im... |
from django.shortcuts import render,redirect
from django.http import HttpResponse,HttpResponseRedirect
from django.views import generic
from django.contrib.auth.decorators import login_required
from django.utils.decorators import method_decorator
from .models import Character,Comic,Power,CharacterPower,CharacterComic
f... | [
"django.shortcuts.render",
"django.http.HttpResponse",
"django.utils.decorators.method_decorator",
"django.shortcuts.redirect",
"django.urls.reverse_lazy"
] | [((792, 841), 'django.utils.decorators.method_decorator', 'method_decorator', (['login_required'], {'name': '"""dispatch"""'}), "(login_required, name='dispatch')\n", (808, 841), False, 'from django.utils.decorators import method_decorator\n'), ((1187, 1236), 'django.utils.decorators.method_decorator', 'method_decorato... |
"""Set-up and execute the main loop"""
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
#Right motor input A
GPIO.setup(18,GPIO.OUT)
#Right motor input B
GPIO.setup(23,GPIO.OUT)
GPIO.output(18,GPIO.HIGH)
GPIO.output(23,GPIO.LOW)
| [
"RPi.GPIO.setup",
"RPi.GPIO.setwarnings",
"RPi.GPIO.output",
"RPi.GPIO.setmode"
] | [((76, 98), 'RPi.GPIO.setmode', 'GPIO.setmode', (['GPIO.BCM'], {}), '(GPIO.BCM)\n', (88, 98), True, 'import RPi.GPIO as GPIO\n'), ((99, 122), 'RPi.GPIO.setwarnings', 'GPIO.setwarnings', (['(False)'], {}), '(False)\n', (115, 122), True, 'import RPi.GPIO as GPIO\n'), ((145, 169), 'RPi.GPIO.setup', 'GPIO.setup', (['(18)',... |
import pymysql
# 连接配置信息
config = {
'host': '127.0.0.1',
'port': 3306,
'user': 'root',
'password': '',
'db': 'classdata',
'charset': 'utf8',
'cursorclass': pymysql.cursors.DictCursor,
}
def get_summary_db(unitag):
# 创建连接
conn = pymysql.connect(**config)
cur = conn.cursor()
... | [
"pymysql.connect"
] | [((266, 291), 'pymysql.connect', 'pymysql.connect', ([], {}), '(**config)\n', (281, 291), False, 'import pymysql\n'), ((624, 649), 'pymysql.connect', 'pymysql.connect', ([], {}), '(**config)\n', (639, 649), False, 'import pymysql\n')] |
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | [
"tempfile.TemporaryDirectory",
"importlib.import_module",
"os.path.join",
"sys.exit",
"pyiree.tf.compiler.tf_load_saved_model"
] | [((949, 986), 'importlib.import_module', 'importlib.import_module', (['"""tensorflow"""'], {}), "('tensorflow')\n", (972, 986), False, 'import importlib\n'), ((1225, 1236), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (1233, 1236), False, 'import sys\n'), ((1765, 1794), 'tempfile.TemporaryDirectory', 'tempfile.Tempo... |
#!/usr/bin/env python3
"""
script for calculating gc skew
<NAME>
<EMAIL>
"""
# python modules
import os
import sys
import argparse
import numpy as np
from scipy import signal
from itertools import cycle, product
# plotting modules
from matplotlib import use as mplUse
mplUse('Agg')
import matplotlib.pyplot as plt
fr... | [
"ctbBio.fasta.iterate_fasta",
"itertools.cycle",
"numpy.ones",
"argparse.ArgumentParser",
"matplotlib.use",
"itertools.product",
"numpy.asarray",
"scipy.signal.fftconvolve",
"matplotlib.pyplot.suptitle",
"matplotlib.pyplot.close",
"matplotlib.rc",
"matplotlib.pyplot.title",
"matplotlib.pyplo... | [((272, 285), 'matplotlib.use', 'mplUse', (['"""Agg"""'], {}), "('Agg')\n", (278, 285), True, 'from matplotlib import use as mplUse\n'), ((431, 498), 'matplotlib.rc', 'rc', (['"""font"""'], {}), "('font', **{'family': 'sans-serif', 'sans-serif': ['Helvetica']})\n", (433, 498), False, 'from matplotlib import rc\n'), ((8... |
import os
import json
import shutil
with open("entry.tp") as entry:
entry = json.loads(entry.read())
startcmd = entry['plugin_start_cmd'].split("%TP_PLUGIN_FOLDER%")[1].split("\\")
filedirectory = startcmd[0]
fileName = startcmd[1]
if os.path.exists(filedirectory):
os.remove(os.path.join(os.getcwd(), "Wi... | [
"os.path.exists",
"os.listdir",
"shutil.make_archive",
"os.makedirs",
"os.rename",
"os.path.join",
"os.getcwd"
] | [((246, 275), 'os.path.exists', 'os.path.exists', (['filedirectory'], {}), '(filedirectory)\n', (260, 275), False, 'import os\n'), ((389, 404), 'os.listdir', 'os.listdir', (['"""."""'], {}), "('.')\n", (399, 404), False, 'import os\n'), ((664, 713), 'os.rename', 'os.rename', (['"""dist\\\\Main.exe"""', '"""dist\\\\WinT... |
# <NAME> (<EMAIL>)
# April 2018
import os, sys
BASE_DIR = os.path.normpath(
os.path.join(os.path.dirname(os.path.abspath(__file__))))
sys.path.append(os.path.join(BASE_DIR, '..'))
from datasets import *
from generate_outputs import *
from scipy.optimize import linear_sum_assignment
#import matplotlib.pyplot a... | [
"os.path.exists",
"scipy.optimize.linear_sum_assignment",
"os.makedirs",
"os.path.join",
"numpy.argmax",
"numpy.linalg.norm",
"numpy.array",
"numpy.zeros",
"numpy.sum",
"numpy.expand_dims",
"numpy.argmin",
"os.path.abspath",
"numpy.save"
] | [((159, 187), 'os.path.join', 'os.path.join', (['BASE_DIR', '""".."""'], {}), "(BASE_DIR, '..')\n", (171, 187), False, 'import os, sys\n'), ((758, 778), 'numpy.argmax', 'np.argmax', (['A'], {'axis': '(1)'}), '(A, axis=1)\n', (767, 778), True, 'import numpy as np\n'), ((1732, 1752), 'numpy.array', 'np.array', (['dists_i... |
import os
from conans import ConanFile, tools
from conans.errors import ConanInvalidConfiguration
class CxxOptsConan(ConanFile):
name = "cxxopts"
homepage = "https://github.com/jarro2783/cxxopts"
url = "https://github.com/conan-io/conan-center-index"
description = "Lightweight C++ option parser librar... | [
"conans.tools.check_min_cppstd",
"conans.tools.get",
"os.path.join",
"conans.tools.Version"
] | [((1859, 1912), 'conans.tools.get', 'tools.get', ([], {}), "(**self.conan_data['sources'][self.version])\n", (1868, 1912), False, 'from conans import ConanFile, tools\n'), ((1067, 1123), 'conans.tools.check_min_cppstd', 'tools.check_min_cppstd', (['self', 'self._minimum_cpp_standard'], {}), '(self, self._minimum_cpp_st... |
"""
Standard Regression model
-------------------------
"""
import numpy as np
import pandas as pd
from typing import Union
from ..logging import get_logger
from .regression_model import RegressionModel
from sklearn.linear_model import LinearRegression
logger = get_logger(__name__)
class LinearRegressionModel(Regre... | [
"sklearn.linear_model.LinearRegression"
] | [((1658, 1684), 'sklearn.linear_model.LinearRegression', 'LinearRegression', ([], {}), '(**kwargs)\n', (1674, 1684), False, 'from sklearn.linear_model import LinearRegression\n')] |
import random
from pymongo import MongoClient
from observable import Observable
from phrase import Phrase
class MongoDbProxy:
"""Proxy for MongoDB"""
def __init__(self, url, dbName, tableName):
self.client = MongoClient(url)
self.db = self.client[dbName]
self.table = tableName
... | [
"phrase.Phrase",
"pymongo.MongoClient",
"observable.Observable",
"random.randrange"
] | [((231, 247), 'pymongo.MongoClient', 'MongoClient', (['url'], {}), '(url)\n', (242, 247), False, 'from pymongo import MongoClient\n'), ((2173, 2187), 'observable.Observable', 'Observable', (['{}'], {}), '({})\n', (2183, 2187), False, 'from observable import Observable\n'), ((1564, 1592), 'random.randrange', 'random.ran... |
#!flask/bin/python
#from user import User
from sampleObjects.User import User
from datetime import datetime
from sampleObjects.DetectionPoint import DetectionPoint
import time, requests, random, atexit
def requestGenerator():
userObject = randomUser()
detectionPointObject = randomDetectionPoint()
req = r... | [
"sampleObjects.DetectionPoint.DetectionPoint",
"atexit.register",
"sampleObjects.User.User",
"time.sleep",
"requests.get",
"datetime.datetime.now",
"random.randint"
] | [((1351, 1379), 'atexit.register', 'atexit.register', (['closingTime'], {}), '(closingTime)\n', (1366, 1379), False, 'import time, requests, random, atexit\n'), ((535, 585), 'requests.get', 'requests.get', (['"""http://localhost:5000/getResponses"""'], {}), "('http://localhost:5000/getResponses')\n", (547, 585), False,... |
import os
from pathlib import Path
def write(file_name, content):
Path(os.path.dirname(file_name)).mkdir(parents=True, exist_ok=True)
with open(file_name, 'w') as file:
file.write(content)
def read_line_looping(file_name, count):
i = 0
lines = []
file = open(file_name, 'r')
line = fi... | [
"os.path.dirname"
] | [((77, 103), 'os.path.dirname', 'os.path.dirname', (['file_name'], {}), '(file_name)\n', (92, 103), False, 'import os\n')] |
from aux_sys_err_prediction_module.additive.R_runmed_spline.my_R_runmed_spline_fit import R_runmed_smooth_spline
from numpy import random, array, median, zeros, arange, hstack
from win32com.client import Dispatch
import math
myName = 'R_runmed_spline'
useMAD = True # use median absolute deviations instead of ... | [
"numpy.random.normal",
"pylab.ylim",
"win32com.client.Dispatch",
"time.clock",
"pylab.subplot",
"math.floor",
"pylab.plot",
"pylab.show",
"numpy.hstack",
"aux_sys_err_prediction_module.additive.R_runmed_spline.my_R_runmed_spline_fit.R_runmed_smooth_spline",
"numpy.array",
"numpy.linspace",
"... | [((619, 661), 'win32com.client.Dispatch', 'Dispatch', (['"""StatConnectorSrv.StatConnector"""'], {}), "('StatConnectorSrv.StatConnector')\n", (627, 661), False, 'from win32com.client import Dispatch\n'), ((2552, 2596), 'numpy.arange', 'arange', (['sparRange[0]', 'sparRange[1]', 'sparStep'], {}), '(sparRange[0], sparRan... |
#!/usr/bin/env python
# Copyright (c) 2016-present, <NAME>
# All rights reserved.
#
# This software may be modified and distributed under the terms
# of the BSD license. See the LICENSE file for details.
import os
import sys
from setuptools import setup
try:
import cffi
except ImportError:
cffi = None
import... | [
"setup_zstd.get_c_extension",
"os.environ.get",
"make_cffi.ffi.distutils_extension",
"sys.argv.remote",
"sys.argv.remove"
] | [((407, 452), 'os.environ.get', 'os.environ.get', (['"""ZSTD_WARNINGS_AS_ERRORS"""', '""""""'], {}), "('ZSTD_WARNINGS_AS_ERRORS', '')\n", (421, 452), False, 'import os\n'), ((542, 569), 'sys.argv.remove', 'sys.argv.remove', (['"""--legacy"""'], {}), "('--legacy')\n", (557, 569), False, 'import sys\n'), ((630, 662), 'sy... |
# Copyright (c) 2017-2018 <NAME>
#
# SPDX-License-Identifier: BSD-3-Clause
# The BSD-3-Clause license for this file can be found in the LICENSE file included with this distribution
# or at https://spdx.org/licenses/BSD-3-Clause.html#licenseText
import os
import pytest
from imx import img
# Used Directories
DATA_DIR =... | [
"os.path.abspath",
"os.path.join"
] | [((410, 448), 'os.path.join', 'os.path.join', (['DATA_DIR', '"""dcd_test.txt"""'], {}), "(DATA_DIR, 'dcd_test.txt')\n", (422, 448), False, 'import os\n'), ((459, 497), 'os.path.join', 'os.path.join', (['DATA_DIR', '"""dcd_test.bin"""'], {}), "(DATA_DIR, 'dcd_test.bin')\n", (471, 497), False, 'import os\n'), ((350, 375)... |
from setuptools import setup, find_packages
from retrobiocat_web import __version__
with open('requirements.txt') as f:
requirements = f.read().splitlines()
setup(
name = 'retrobiocat_web',
packages = find_packages(),
include_package_data=True,
version = __version__,
license='',
description = 'Retrosynt... | [
"setuptools.find_packages"
] | [((209, 224), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (222, 224), False, 'from setuptools import setup, find_packages\n')] |
# -*- coding: utf-8 -*-
import pickle
import numpy as np
from rdkit import Chem
from rdkit.Chem import AllChem,DataStructs
def get_classes(path):
f = open(path, 'rb')
dict_ = pickle.load(f)
f.close()
classes = sorted(dict_.items(), key=lambda d: d[1],reverse=True)
classes = [(x,y) fo... | [
"pickle.load",
"rdkit.Chem.MolFromSmiles",
"rdkit.Chem.AllChem.GetMorganFingerprintAsBitVect",
"rdkit.Chem.DataStructs.ConvertToNumpyArray",
"numpy.empty",
"numpy.concatenate"
] | [((196, 210), 'pickle.load', 'pickle.load', (['f'], {}), '(f)\n', (207, 210), False, 'import pickle\n'), ((1698, 1727), 'numpy.concatenate', 'np.concatenate', (['(pfp, rxn_fp)'], {}), '((pfp, rxn_fp))\n', (1712, 1727), True, 'import numpy as np\n'), ((694, 718), 'rdkit.Chem.MolFromSmiles', 'Chem.MolFromSmiles', (['rsmi... |
import functools
import logging
import random
from flask import Flask, render_template, request
import joblib
from lxml.html import html5parser
import lxml.html
import requests
import yarl
import webstruct.model
import webstruct.sequence_encoding
import webstruct.webannotator
webstruct_demo = Flask(__name__, instan... | [
"flask.render_template",
"flask.request.args.get",
"requests.auth.HTTPBasicAuth",
"random.shuffle",
"flask.Flask",
"functools.reduce",
"joblib.load",
"requests.get",
"logging.exception",
"lxml.html.html5parser.document_fromstring",
"yarl.URL"
] | [((298, 344), 'flask.Flask', 'Flask', (['__name__'], {'instance_relative_config': '(True)'}), '(__name__, instance_relative_config=True)\n', (303, 344), False, 'from flask import Flask, render_template, request\n'), ((1444, 1462), 'yarl.URL', 'yarl.URL', (['base_url'], {}), '(base_url)\n', (1452, 1462), False, 'import ... |
# Generated by Django 3.1.6 on 2021-02-15 19:01
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('website', '0083_remove_aisubmission_code'),
]
operations = [
migrations.AddField(
model_name='e... | [
"django.db.models.ForeignKey",
"django.db.models.AutoField",
"django.db.models.CharField",
"django.db.models.IntegerField"
] | [((373, 403), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'default': '(1)'}), '(default=1)\n', (392, 403), False, 'from django.db import migrations, models\n'), ((996, 1132), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'blank': '(True)', 'null': '(True)', 'on_delete': 'django.db.models.d... |
"""Core experiments for the dependency label prediction task."""
import collections
import copy
import logging
from typing import (Any, Dict, Iterator, Optional, Sequence, Set, Tuple, Type,
Union)
from ldp import datasets, learning
from ldp.models import probes, projections
from ldp.parse import pt... | [
"logging.getLogger",
"wandb.log",
"torch.stack",
"ldp.learning.EarlyStopping",
"numpy.sum",
"collections.defaultdict",
"copy.deepcopy",
"ldp.models.projections.Projection",
"logging.info",
"ldp.learning.test"
] | [((11285, 11312), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (11302, 11312), False, 'import logging\n'), ((12378, 12427), 'ldp.learning.test', 'learning.test', (['probe', 'test_dataset'], {'device': 'device'}), '(probe, test_dataset, device=device)\n', (12391, 12427), False, 'from ldp... |
import os
import sentry_sdk
from sentry_sdk.integrations.django import DjangoIntegration
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
PWA_SERVICE_WORKER_PATH = os.path.join(
BASE_DIR, 'routes/static/routes/js', 'serv... | [
"os.getenv",
"sentry_sdk.integrations.django.DjangoIntegration",
"os.path.join",
"os.environ.get",
"os.path.abspath"
] | [((260, 329), 'os.path.join', 'os.path.join', (['BASE_DIR', '"""routes/static/routes/js"""', '"""serviceworker.js"""'], {}), "(BASE_DIR, 'routes/static/routes/js', 'serviceworker.js')\n", (272, 329), False, 'import os\n'), ((480, 517), 'os.environ.get', 'os.environ.get', (['"""SECRET_KEY"""', '"""<KEY>"""'], {}), "('SE... |
'''
* @author Waldinsamkeit
* @email <EMAIL>
* @create date 2020-09-25 14:33:38
* @desc
'''
import torch
'''--------------------- Weighted Binary cross Entropy ----------------------'''
'''
In Torch BCELoss, weight is set to every element of input instead of to every class
'''
def weighted_binary_cross_entropy... | [
"torch.mean",
"torch.tensor",
"torch.log",
"torch.clamp"
] | [((969, 1006), 'torch.clamp', 'torch.clamp', (['y_pred', '(1e-07)', '(1 - 1e-07)'], {}), '(y_pred, 1e-07, 1 - 1e-07)\n', (980, 1006), False, 'import torch\n'), ((660, 676), 'torch.mean', 'torch.mean', (['loss'], {}), '(loss)\n', (670, 676), False, 'import torch\n'), ((581, 598), 'torch.log', 'torch.log', (['output'], {... |
from typing import *
import attr
from dlms_cosem.hdlc import validators
@attr.s(auto_attribs=True)
class HdlcAddress:
"""
A client address shall always be expressed on one byte.
To enable addressing more than one logical device within a single physical device
and to support the multi-drop configurat... | [
"attr.s",
"attr.ib"
] | [((77, 102), 'attr.s', 'attr.s', ([], {'auto_attribs': '(True)'}), '(auto_attribs=True)\n', (83, 102), False, 'import attr\n'), ((790, 843), 'attr.ib', 'attr.ib', ([], {'validator': '[validators.validate_hdlc_address]'}), '(validator=[validators.validate_hdlc_address])\n', (797, 843), False, 'import attr\n'), ((882, 94... |
from __future__ import division, absolute_import, print_function
import warnings
import numpy as np
try:
import scipy.stats as stats
except ImportError:
pass
from .common import Benchmark
class Anderson_KSamp(Benchmark):
def setup(self, *args):
self.rand = [np.random.normal(loc=i, size=1000) fo... | [
"scipy.stats.beta.rvs",
"scipy.stats.gamma.rvs",
"numpy.random.rand",
"scipy.stats.norm.rvs",
"scipy.stats.ttest_ind",
"scipy.stats.gamma.pdf",
"scipy.stats.cauchy.fit",
"numpy.random.seed",
"scipy.stats.beta.fit",
"warnings.simplefilter",
"numpy.random.normal",
"scipy.stats.gamma.cdf",
"sci... | [((813, 864), 'scipy.stats.fisher_exact', 'stats.fisher_exact', (['self.a'], {'alternative': 'alternative'}), '(self.a, alternative=alternative)\n', (831, 864), True, 'import scipy.stats as stats\n'), ((931, 955), 'numpy.random.seed', 'np.random.seed', (['(12345678)'], {}), '(12345678)\n', (945, 955), True, 'import num... |