code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# -*- coding:utf-8 -*-
# /usr/bin/env python
"""
Date: 2021/12/9 19:09
Desc: HTTP 测试
"""
import requests
import pandas as pd
url = "http://1172.16.17.32:8080/api/stock_financial_hk_analysis_indicator_em"
params = {
"stock": "00700",
"indicator": "年度"
}
r = requests.get(url, params=params)
temp_df = pd.DataFra... | [
"requests.get"
] | [((267, 299), 'requests.get', 'requests.get', (['url'], {'params': 'params'}), '(url, params=params)\n', (279, 299), False, 'import requests\n')] |
from django.db import models
from django.core.validators import MinValueValidator, MaxValueValidator
from django.template.defaultfilters import slugify
# Create your models here.
class Tournament(models.Model):
year = models.CharField(max_length=99)
title = models.CharField(max_length=99, blank=True)
slug... | [
"django.db.models.OneToOneField",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.core.validators.MinValueValidator",
"django.db.models.BooleanField",
"django.db.models.SlugField",
"django.db.models.EmailField",
"django.template.defaultfilters.slugify",
"django.core.validators.M... | [((224, 255), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(99)'}), '(max_length=99)\n', (240, 255), False, 'from django.db import models\n'), ((268, 311), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(99)', 'blank': '(True)'}), '(max_length=99, blank=True)\n', (284, ... |
#!/usr/bin/env python
#-*- coding: utf-8 -*-
#
# Copyright 2012 <EMAIL>
#
import tornado.httpserver
import tornado.ioloop
from tornadows import soaphandler
from tornadows import webservices
from tornadows import xmltypes
from tornadows.soaphandler import webservice
from time import ctime,sleep
import Comm... | [
"sys.path.append",
"os.path.abspath",
"tornadows.webservices.WebService"
] | [((497, 521), 'sys.path.append', 'sys.path.append', (['AIX_dir'], {}), '(AIX_dir)\n', (512, 521), False, 'import sys\n'), ((578, 602), 'sys.path.append', 'sys.path.append', (['EMC_dir'], {}), '(EMC_dir)\n', (593, 602), False, 'import sys\n'), ((665, 692), 'sys.path.append', 'sys.path.append', (['VMware_dir'], {}), '(VM... |
import json
from os.path import abspath, dirname, isfile, join
CURRENT_DIR = dirname(abspath(__file__))
TEST_DATA_DIR = join(dirname(dirname(dirname(CURRENT_DIR))), 'test_data')
from opendp_apps.analysis.testing.base_stat_spec_test import StatSpecTestCase
from opendp_apps.analysis.tools.dp_count_spec import DPCountSp... | [
"os.path.abspath",
"opendp_apps.model_helpers.msg_util.msgt",
"os.path.dirname",
"json.dumps",
"opendp_apps.analysis.tools.dp_count_spec.DPCountSpec",
"os.path.isfile",
"os.path.join"
] | [((86, 103), 'os.path.abspath', 'abspath', (['__file__'], {}), '(__file__)\n', (93, 103), False, 'from os.path import abspath, dirname, isfile, join\n'), ((749, 764), 'opendp_apps.analysis.tools.dp_count_spec.DPCountSpec', 'DPCountSpec', (['{}'], {}), '({})\n', (760, 764), False, 'from opendp_apps.analysis.tools.dp_cou... |
# coding: utf-8
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
from func import linear
from rnns import cell as cell
class gru(cell.Cell):
"""The Gated Recurrent Unit."""
def __init__(self, d, ln=False, scope='gru'):
... | [
"tensorflow.tanh",
"func.linear",
"tensorflow.sigmoid"
] | [((668, 729), 'func.linear', 'linear', (['x', '(self.d * 2)'], {'bias': '(False)', 'ln': 'self.ln', 'scope': '"""gate_x"""'}), "(x, self.d * 2, bias=False, ln=self.ln, scope='gate_x')\n", (674, 729), False, 'from func import linear\n'), ((769, 826), 'func.linear', 'linear', (['x', 'self.d'], {'bias': '(False)', 'ln': '... |
import json
import os
import tempfile
from unittest import mock
from remeha import read_config, FileLogger
from remeha_core import Frame
from tests.test_base import TestBase
class TestRemeha(TestBase):
raw_test_data = bytearray([0x02, 0x01, 0xfe, 0x06, 0x48, 0x02, 0x01, 0xa2,
0x12,... | [
"tempfile.TemporaryDirectory",
"json.loads",
"os.path.exists",
"unittest.mock.patch.dict",
"unittest.mock.patch",
"remeha.FileLogger",
"remeha.read_config",
"remeha_core.Frame",
"os.path.join"
] | [((1019, 1048), 'tempfile.TemporaryDirectory', 'tempfile.TemporaryDirectory', ([], {}), '()\n', (1046, 1048), False, 'import tempfile\n'), ((1179, 1244), 'os.path.join', 'os.path.join', (['self.test_config_directory.name', '"""test_config.json"""'], {}), "(self.test_config_directory.name, 'test_config.json')\n", (1191,... |
from talon import Context
ctx = Context()
ctx.matches = r"""
tag: user.vim_ultisnips
mode: user.python
mode: command
and code.language: python
"""
# spoken name -> snippet name
ultisnips_snippets = {
"header": "#!",
"if main": "ifmain",
"for loop": "for",
"class": "class",
"function": "def",
"m... | [
"talon.Context"
] | [((33, 42), 'talon.Context', 'Context', ([], {}), '()\n', (40, 42), False, 'from talon import Context\n')] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# DSA nonce recovery from repeated nonce
#
# Cryptanalytic MVP award.
#
# This attack (in an elliptic curve group) broke the PS3. It is a great,
# great attack.
#
# In this file:
#
# https://cryptopals.com/static/challenge-data/44.txt
#
# find a collection of DSA-s... | [
"util.text.to_bytes",
"util.sha1.SHA1",
"inspect.getfile",
"itertools.combinations",
"util.misc.invmod"
] | [((2037, 2049), 'util.misc.invmod', 'invmod', (['k', 'q'], {}), '(k, q)\n', (2043, 2049), False, 'from util.misc import invmod\n'), ((3850, 3871), 'itertools.combinations', 'combinations', (['msgs', '(2)'], {}), '(msgs, 2)\n', (3862, 3871), False, 'from itertools import combinations\n'), ((2130, 2142), 'util.misc.invmo... |
import socket
from typing import Union
from urllib.parse import urlparse
from . import types
__all__ = [
'Host',
'Address',
'InvalidHost',
'InvalidIP',
]
class Host:
hostname: str
port: Union[int, None]
username: Union[str, None]
password: Union[str, None]
def __init__(self, net... | [
"socket.inet_pton",
"urllib.parse.urlparse"
] | [((2383, 2425), 'socket.inet_pton', 'socket.inet_pton', (['socket.AF_INET', 'hostname'], {}), '(socket.AF_INET, hostname)\n', (2399, 2425), False, 'import socket\n'), ((3836, 3885), 'urllib.parse.urlparse', 'urlparse', (['value'], {'scheme': "(default_protocol or 'udp')"}), "(value, scheme=default_protocol or 'udp')\n"... |
#!/usr/bin/env python3
# Copyright (c) 2021 The Bitcoin developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the resolution of conflicting proofs via avalanche."""
import time
from test_framework.avatools import (
... | [
"test_framework.messages.LegacyAvalancheProof",
"test_framework.util.try_rpc",
"test_framework.avatools.gen_proof",
"test_framework.avatools.get_ava_p2p_interface",
"time.time",
"test_framework.messages.AvalancheVote",
"test_framework.avatools.create_coinbase_stakes",
"test_framework.util.assert_raise... | [((3281, 3296), 'test_framework.avatools.gen_proof', 'gen_proof', (['node'], {}), '(node)\n', (3290, 3296), False, 'from test_framework.avatools import create_coinbase_stakes, gen_proof, get_ava_p2p_interface, get_proof_ids\n'), ((3561, 3618), 'test_framework.avatools.create_coinbase_stakes', 'create_coinbase_stakes', ... |
# -*- coding: utf-8 -*-
'''
Created on 20 июл. 2017 г.
@author: krtkr
'''
import sys
import getopt
from KicadSymGen.draw import Library
from KicadSymGen.generate import Generator
from KicadSymGen.generate import Layout
from KicadSymGen.parse.altera import Max10Reader
from KicadSymGen.parse.altera import Max10Parser... | [
"getopt.getopt",
"KicadSymGen.generate.Layout",
"sys.exit",
"KicadSymGen.draw.Library",
"KicadSymGen.generate.Generator",
"KicadSymGen.parse.altera.Max10Reader"
] | [((1154, 1162), 'KicadSymGen.generate.Layout', 'Layout', ([], {}), '()\n', (1160, 1162), False, 'from KicadSymGen.generate import Layout\n'), ((1182, 1207), 'KicadSymGen.parse.altera.Max10Reader', 'Max10Reader', (['pinouts_path'], {}), '(pinouts_path)\n', (1193, 1207), False, 'from KicadSymGen.parse.altera import Max10... |
"""
Module made to merge and process all configs for PromAC into a single nested
dictionary. Ready to be injected into the settings models that PromAC uses.
Copyright © 2020 <NAME> - Licensed under the Apache License 2.0
"""
import os
from box import Box
from loguru import logger
import prometheus_adaptive_cards.co... | [
"prometheus_adaptive_cards.config.settings_utils.cast",
"prometheus_adaptive_cards.config.settings_utils.merge",
"os.path.dirname",
"prometheus_adaptive_cards.config.settings_utils.parse_yamls",
"os.environ.get",
"prometheus_adaptive_cards.config.settings_utils.unflatten",
"loguru.logger.bind",
"prome... | [((2855, 2892), 'prometheus_adaptive_cards.config.settings_utils.parse_yamls', 'settings_utils.parse_yamls', (['locations'], {}), '(locations)\n', (2881, 2892), True, 'import prometheus_adaptive_cards.config.settings_utils as settings_utils\n'), ((4057, 4083), 'loguru.logger.debug', 'logger.debug', (['"""Cast vars."""'... |
#!/usr/bin/env python
# SPDX-FileCopyrightText: 2021 <NAME> <<EMAIL>>
# SPDX-License-Identifier: MIT
import random
import sys
class Operation(object):
def valid (self, a, b):
return True
def result(self, a, b):
raise TypeError
def symbol(self):
raise TypeError
class Addition(Op... | [
"random.shuffle",
"sys.exit"
] | [((2795, 2865), 'sys.exit', 'sys.exit', (["('Usage: %s add|sub|mul NUMBER_FROM_1_TO_10' % (sys.argv[0],))"], {}), "('Usage: %s add|sub|mul NUMBER_FROM_1_TO_10' % (sys.argv[0],))\n", (2803, 2865), False, 'import sys\n'), ((1761, 1786), 'random.shuffle', 'random.shuffle', (['questions'], {}), '(questions)\n', (1775, 1786... |
from datetime import datetime
from django.test import TestCase, Client
from django.urls import reverse
from students.models.students import Student
from students.models.groups import Group
class TestStudentList(TestCase):
def setUp(self):
# create 2 groups
group1, created = Group.objects.get_or... | [
"students.models.groups.Group.objects.get_or_create",
"datetime.datetime.today",
"students.models.students.Student.students.all",
"django.test.Client",
"django.urls.reverse",
"students.models.groups.Group.objects.filter"
] | [((300, 342), 'students.models.groups.Group.objects.get_or_create', 'Group.objects.get_or_create', ([], {'title': '"""MtM-1"""'}), "(title='MtM-1')\n", (327, 342), False, 'from students.models.groups import Group\n'), ((382, 424), 'students.models.groups.Group.objects.get_or_create', 'Group.objects.get_or_create', ([],... |
# NVIDIA
import unittest
from test_bert_batch_1 import *
#from test_bert_batch_7 import *
from test_embeddings_batch_1 import *
from test_encoders_batch_1 import *
if __name__ == '__main__':
unittest.main(verbosity=2)
| [
"unittest.main"
] | [((196, 222), 'unittest.main', 'unittest.main', ([], {'verbosity': '(2)'}), '(verbosity=2)\n', (209, 222), False, 'import unittest\n')] |
import click
from apigee import console
from apigee.auth import common_auth_options, gen_auth
from apigee.backups.backups import Backups
# from apigee.cls import OptionEatAll
from apigee.prefix import common_prefix_options
from apigee.silent import common_silent_options
from apigee.verbose import common_verbos... | [
"click.option",
"click.Choice",
"apigee.auth.gen_auth",
"click.Path",
"click.group"
] | [((500, 593), 'click.group', 'click.group', ([], {'help': '"""Download configuration files from Apigee that can later be restored."""'}), "(help=\n 'Download configuration files from Apigee that can later be restored.')\n", (511, 593), False, 'import click\n'), ((1941, 2050), 'click.option', 'click.option', (['"""-e... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2017-01-25 18:54
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('dynadb', '0074_auto_2017012... | [
"django.db.models.ForeignKey"
] | [((475, 618), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'blank': '(True)', 'db_column': '"""user_id"""', 'null': '(True)', 'on_delete': 'django.db.models.deletion.DO_NOTHING', 'to': 'settings.AUTH_USER_MODEL'}), "(blank=True, db_column='user_id', null=True, on_delete=\n django.db.models.deletion.DO_N... |
import os
import numpy as np
import json
import torch
from .utils import skeleton
class SkeletonDataset(torch.utils.data.Dataset):
""" Feeder for skeleton-based action recognition
Arguments:
data_path: the path to data folder
random_choose: If true, randomly choose a portion of the input seque... | [
"json.load",
"numpy.zeros",
"numpy.einsum",
"numpy.array",
"os.path.join",
"os.listdir"
] | [((1924, 2012), 'numpy.zeros', 'np.zeros', (['(num_channel, num_keypoints, num_frame, self.num_track)'], {'dtype': 'np.float32'}), '((num_channel, num_keypoints, num_frame, self.num_track), dtype=np.\n float32)\n', (1932, 2012), True, 'import numpy as np\n'), ((1556, 1568), 'json.load', 'json.load', (['f'], {}), '(f... |
# SPDX-FileCopyrightText: 2020 <NAME>
#
# SPDX-License-Identifier: MIT
import logging
logger = logging.getLogger(__name__)
def add_parser(subparsers):
parser = subparsers.add_parser('log-server', help='Log server')
subparsers = parser.add_subparsers(dest='cmd')
subparsers.required = True
sync_parser... | [
"logging.getLogger"
] | [((97, 124), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (114, 124), False, 'import logging\n')] |
'''7. Faça uma função que sorteia 10 números aleatórios entre 0 e 100 e retorna o maior entre eles.'''
import random
def sorteio():
maior = 0
menor = 0
for i in range(10):
x = random.randint(0,100)
if i==1:
menor = x
if x<menor:
menor = x
... | [
"random.randint"
] | [((197, 219), 'random.randint', 'random.randint', (['(0)', '(100)'], {}), '(0, 100)\n', (211, 219), False, 'import random\n')] |
import sys
import uncertainty_rfr
import pandas as pd
import numpy as np
from sklearn.ensemble import RandomForestRegressor
import pandas.api.types as ptypes
sys.path.append("../")
df_test = pd.read_csv('./xiaofeng_lasso/unittest_dummy.csv', nrows=5)
X_test, y_test = uncertainty_rfr.descriptors_outputs(df_test, d_st... | [
"sys.path.append",
"pandas.DataFrame",
"uncertainty_rfr.traintest",
"pandas.read_csv",
"uncertainty_rfr.predict_append",
"uncertainty_rfr.descriptors_outputs",
"sklearn.ensemble.RandomForestRegressor",
"uncertainty_rfr.uncertainty_rfr_cv",
"uncertainty_rfr.largest_uncertainty",
"numpy.array",
"u... | [((159, 181), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (174, 181), False, 'import sys\n'), ((194, 253), 'pandas.read_csv', 'pd.read_csv', (['"""./xiaofeng_lasso/unittest_dummy.csv"""'], {'nrows': '(5)'}), "('./xiaofeng_lasso/unittest_dummy.csv', nrows=5)\n", (205, 253), True, 'import pand... |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.utils import flt
from frappe import _
from frappe.model.document import Document
class CForm(Document):
def validate(self):
... | [
"frappe.utils.flt",
"frappe.db.sql",
"frappe.db.get_value",
"frappe.db.set",
"frappe._"
] | [((1430, 1526), 'frappe.db.sql', 'frappe.db.sql', (['"""update `tabSales Invoice` set c_form_no=null where c_form_no=%s"""', 'self.name'], {}), "('update `tabSales Invoice` set c_form_no=null where c_form_no=%s'\n , self.name)\n", (1443, 1526), False, 'import frappe\n'), ((2236, 2287), 'frappe.db.set', 'frappe.db.se... |
# MIT License
#
# Copyright (C) The Adversarial Robustness Toolbox (ART) Authors 2018
#
# 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
# r... | [
"scipy.stats.entropy",
"numpy.split",
"numpy.array",
"numpy.squeeze",
"art.utils.clip_and_round",
"logging.getLogger",
"numpy.repeat"
] | [((1598, 1625), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1615, 1625), False, 'import logging\n'), ((6455, 6527), 'art.utils.clip_and_round', 'clip_and_round', (['(x - epsilon_map[i])', 'self.clip_values', 'self.round_samples'], {}), '(x - epsilon_map[i], self.clip_values, self.roun... |
import pytest
from salt.ext.tornado.httpclient import HTTPError
@pytest.fixture
def app(app):
app.wsgi_application.config["global"]["tools.hypermedia_out.on"] = True
return app
async def test_default_accept(http_client, content_type_map):
response = await http_client.fetch("/", method="GET")
assert ... | [
"pytest.raises"
] | [((440, 464), 'pytest.raises', 'pytest.raises', (['HTTPError'], {}), '(HTTPError)\n', (453, 464), False, 'import pytest\n')] |
import base64
from typing import Dict, Optional
from ciphey.iface import Config, Decoder, ParamSpec, T, U, registry
@registry.register
class Base64_url(Decoder[str]):
def decode(self, ctext: T) -> Optional[U]:
"""
Performs Base64 URL decoding
"""
ctext_padding = ctext + "=" * (4 -... | [
"base64.urlsafe_b64decode"
] | [((369, 408), 'base64.urlsafe_b64decode', 'base64.urlsafe_b64decode', (['ctext_padding'], {}), '(ctext_padding)\n', (393, 408), False, 'import base64\n')] |
import numpy as np
import straxen
import tempfile
import os
import unittest
import shutil
import uuid
test_run_id_1T = '180423_1021'
class TestBasics(unittest.TestCase):
@classmethod
def setUpClass(cls) -> None:
temp_folder = uuid.uuid4().hex
# Keep one temp dir because we don't want to down... | [
"uuid.uuid4",
"straxen.contexts.demo",
"tempfile.gettempdir",
"os.path.exists",
"numpy.isnan",
"straxen.get_livetime_sec",
"straxen.mini_analysis",
"shutil.rmtree"
] | [((529, 552), 'straxen.contexts.demo', 'straxen.contexts.demo', ([], {}), '()\n', (550, 552), False, 'import straxen\n'), ((744, 771), 'os.path.exists', 'os.path.exists', (['cls.tempdir'], {}), '(cls.tempdir)\n', (758, 771), False, 'import os\n'), ((1514, 1573), 'straxen.get_livetime_sec', 'straxen.get_livetime_sec', (... |
from __future__ import annotations
from asyncio.events import AbstractEventLoop, TimerHandle
from asyncio.futures import Future
from typing import Mapping
from safe_set_result import safe_set_result
import scrypted_sdk
import numpy as np
import re
import tflite_runtime.interpreter as tflite
from pycoral.utils.edgetpu i... | [
"pycoral.utils.edgetpu.make_interpreter",
"multiprocessing.Lock",
"pycoral.utils.edgetpu.run_inference",
"urllib.parse.urlparse",
"safe_set_result.safe_set_result",
"scrypted_sdk.mediaManager.convertMediaObjectToBuffer",
"json.loads",
"pycoral.adapters.common.input_size",
"asyncio.ensure_future",
... | [((2148, 2170), 'multiprocessing.Lock', 'multiprocessing.Lock', ([], {}), '()\n', (2168, 2170), False, 'import multiprocessing\n'), ((1611, 1619), 'asyncio.futures.Future', 'Future', ([], {}), '()\n', (1617, 1619), False, 'from asyncio.futures import Future\n'), ((1643, 1649), 'third_party.sort.Sort', 'Sort', ([], {}),... |
import os
import shutil
import unittest
from pypirun import utility
class TestUtility(unittest.TestCase):
test_key = 'OUROATH_UTILITY'
def tearDown(self):
try:
del os.environ[self.test_key]
except KeyError:
pass
def test__env_bool__default(self):
self.ass... | [
"pypirun.utility.env_bool",
"shutil.which",
"pypirun.utility.which"
] | [((782, 826), 'pypirun.utility.which', 'utility.which', (['"""python3"""'], {'allow_symlink': '(True)'}), "('python3', allow_symlink=True)\n", (795, 826), False, 'from pypirun import utility\n'), ((952, 997), 'pypirun.utility.which', 'utility.which', (['"""python3"""'], {'allow_symlink': '(False)'}), "('python3', allow... |
from sqlalchemy import Column, Table, MetaData, Index
import logging
from sqlalchemy.dialects.mysql.base import DATETIME
from sqlalchemy.dialects.mysql.base import INTEGER
from sqlalchemy.dialects.mysql.base import VARCHAR
LOG = logging.getLogger(__name__)
def upgrade(migrate_engine):
meta = MetaData()
meta... | [
"sqlalchemy.MetaData",
"sqlalchemy.Index",
"sqlalchemy.Table",
"sqlalchemy.Column",
"sqlalchemy.dialects.mysql.base.INTEGER",
"sqlalchemy.dialects.mysql.base.VARCHAR",
"logging.getLogger"
] | [((231, 258), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (248, 258), False, 'import logging\n'), ((301, 311), 'sqlalchemy.MetaData', 'MetaData', ([], {}), '()\n', (309, 311), False, 'from sqlalchemy import Column, Table, MetaData, Index\n'), ((1383, 1393), 'sqlalchemy.MetaData', 'Meta... |
# -*- coding:utf-8 -*-
"""
通联数据
Created on 2015/08/24
@author: <NAME>
@group : waditu
@contact: <EMAIL>
"""
from io import StringIO
import pandas as pd
from tushare.util import vars as vs
from tushare.util.common import Client
from tushare.util import upass as up
class Idx():
def __init__(self, client=None)... | [
"tushare.util.upass.get_token",
"io.StringIO"
] | [((1209, 1225), 'io.StringIO', 'StringIO', (['result'], {}), '(result)\n', (1217, 1225), False, 'from io import StringIO\n'), ((382, 396), 'tushare.util.upass.get_token', 'up.get_token', ([], {}), '()\n', (394, 396), True, 'from tushare.util import upass as up\n')] |
import torch
# After running `make install` in the torchmps folder, this should work
from torchmps import ProbMPS
# Dummy parameters for the model and data
bond_dim = 13
input_dim = 2
batch_size = 55
sequence_len = 21
complex_params = True
# Verify that you can initialize the model
my_mps = ProbMPS(sequence_len, inp... | [
"torch.randint",
"torchmps.ProbMPS"
] | [((295, 353), 'torchmps.ProbMPS', 'ProbMPS', (['sequence_len', 'input_dim', 'bond_dim', 'complex_params'], {}), '(sequence_len, input_dim, bond_dim, complex_params)\n', (302, 353), False, 'from torchmps import ProbMPS\n'), ((534, 596), 'torch.randint', 'torch.randint', ([], {'high': 'input_dim', 'size': '(sequence_len,... |
"""
Tests handle's interactivity.
"""
import vcs.vtk_ui
import vtk_ui_test
import decimal
class test_vtk_ui_handle_interaction(vtk_ui_test.vtk_ui_test):
def setUp(self):
super(test_vtk_ui_handle_interaction, self).setUp()
self.h = None
self.h2 = None
def do(self):
self.win.Set... | [
"decimal.Decimal"
] | [((1075, 1101), 'decimal.Decimal', 'decimal.Decimal', (["('%f' % dx)"], {}), "('%f' % dx)\n", (1090, 1101), False, 'import decimal\n'), ((1105, 1132), 'decimal.Decimal', 'decimal.Decimal', (["('%f' % 0.1)"], {}), "('%f' % 0.1)\n", (1120, 1132), False, 'import decimal\n'), ((1209, 1235), 'decimal.Decimal', 'decimal.Deci... |
#!/usr/bin/python3
# scrape twitter example going to web page for twitter profile
# author: <NAME>
# date: 2015 06 02
# Note: MUST USE PYTHON 3 from terminal
import json
import urllib.request, urllib.parse
import random
from bs4 import BeautifulSoup
useragents = ['Mozilla/5.0','Bandicout Broadway 2.4','Carls Crawler ... | [
"bs4.BeautifulSoup",
"random.choice"
] | [((495, 521), 'random.choice', 'random.choice', (['listofterms'], {}), '(listofterms)\n', (508, 521), False, 'import random\n'), ((573, 599), 'bs4.BeautifulSoup', 'BeautifulSoup', (['twitterpage'], {}), '(twitterpage)\n', (586, 599), False, 'from bs4 import BeautifulSoup\n')] |
'''
This script contains examples of Logistic Regression analysis, using the
SciKit-Learn library.
Logistic regression is useful when trying to classify data between 2 binary
groups / labels. For example, a logistic model would be useful to predict if
someone has a disease (1) or does not have a disease (0).
Logistic... | [
"seaborn.set_style",
"matplotlib.pyplot.show",
"pandas.read_csv",
"pandas.get_dummies",
"sklearn.model_selection.train_test_split",
"sklearn.metrics.classification_report",
"sklearn.linear_model.LogisticRegression",
"seaborn.boxplot",
"seaborn.countplot",
"sklearn.metrics.confusion_matrix",
"pan... | [((853, 873), 'pandas.read_csv', 'pd.read_csv', (['csv_url'], {}), '(csv_url)\n', (864, 873), True, 'import pandas as pd\n'), ((977, 1009), 'seaborn.set_style', 'sns.set_style', ([], {'style': '"""whitegrid"""'}), "(style='whitegrid')\n", (990, 1009), True, 'import seaborn as sns\n'), ((1087, 1097), 'matplotlib.pyplot.... |
import editor
editor.start()
| [
"editor.start"
] | [((14, 28), 'editor.start', 'editor.start', ([], {}), '()\n', (26, 28), False, 'import editor\n')] |
import argparse
import hashlib
import binascii
def run(args):
h = hashlib.new('md4', args.password.encode('utf-16le')).digest()
print(binascii.hexlify(h).decode('utf-8'))
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Make an NTLM hash from a password.')
parser.add_argument('... | [
"binascii.hexlify",
"argparse.ArgumentParser"
] | [((221, 294), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Make an NTLM hash from a password."""'}), "(description='Make an NTLM hash from a password.')\n", (244, 294), False, 'import argparse\n'), ((143, 162), 'binascii.hexlify', 'binascii.hexlify', (['h'], {}), '(h)\n', (159, 162), F... |
r"""
Monte Carlo vs Black-Scholes-Merton
===========================================
Time values of options and guarantees for various in-the-moneyness
are calculated using Monte Carlo simulations and the Black-Scholes-Merton
pricing formula for European put options.
The Black-Scholes-Merton pricing formula for Europ... | [
"numpy.average",
"matplotlib.pyplot.subplots",
"modelx.read_model"
] | [((1161, 1194), 'modelx.read_model', 'mx.read_model', (['"""CashValue_ME_EX1"""'], {}), "('CashValue_ME_EX1')\n", (1174, 1194), True, 'import modelx as mx\n'), ((1531, 1545), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (1543, 1545), True, 'import matplotlib.pyplot as plt\n'), ((1382, 1408), 'numpy.a... |
"""
Summary
In this kata, you have to make a function named uglify_word (uglifyWord in Java and Javascript). It accepts a string parameter.
What does the uglify_word do?
It checks the char in the given string from the front with an iteration, in the iteration it does these steps:
There is a flag and it will be starte... | [
"re.match"
] | [((1375, 1398), 're.match', 'match', (['"""[a-zA-Z]"""', 'char'], {}), "('[a-zA-Z]', char)\n", (1380, 1398), False, 'from re import match\n')] |
# pylint: disable=W0611
#
# Copyright (c) 2003-2013 LOGILAB S.A. (Paris, FRANCE).
# http://www.logilab.fr/ -- mailto:<EMAIL>
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of... | [
"logilab.common.compat.builtins.__dict__.copy",
"re.compile"
] | [((4277, 4301), 'logilab.common.compat.builtins.__dict__.copy', 'builtins.__dict__.copy', ([], {}), '()\n', (4299, 4301), False, 'from logilab.common.compat import builtins\n'), ((14366, 14396), 're.compile', 're.compile', (['"""^_{2,}.*[^_]+_?$"""'], {}), "('^_{2,}.*[^_]+_?$')\n", (14376, 14396), False, 'import re\n')... |
import unittest
class Node(object):
def __init__(self, data, children=None):
self.data = data
if children is None:
self.children = []
else:
self.children = children
def is_connected(a, b):
todo = [a]
seen = set(todo)
while len(todo) > 0:
current = todo.pop() # DFS
if current ... | [
"unittest.main"
] | [((1115, 1130), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1128, 1130), False, 'import unittest\n')] |
import types
from collections.abc import Iterator
import torch
import torch.nn as nn
from uninas.register import Register
from uninas.utils.shape import Shape, ShapeList, ShapeOrList
from uninas.utils.args import ArgsInterface
from uninas.utils.paths import make_base_dirs
from uninas.utils.torch.misc import randomize_p... | [
"uninas.utils.torch.misc.randomize_parameters",
"types.MethodType",
"uninas.utils.paths.make_base_dirs",
"torch.nn.Module.__init__",
"uninas.utils.args.ArgsInterface.__init__",
"uninas.register.Register.builder.from_config",
"torch.no_grad",
"torch.onnx.export"
] | [((561, 585), 'torch.nn.Module.__init__', 'nn.Module.__init__', (['self'], {}), '(self)\n', (579, 585), True, 'import torch.nn as nn\n'), ((12825, 12850), 'uninas.utils.paths.make_base_dirs', 'make_base_dirs', (['save_path'], {}), '(save_path)\n', (12839, 12850), False, 'from uninas.utils.paths import make_base_dirs\n'... |
import os
import numpy as np
from sst import Fisher
from sst import camb_tools as ct
from sst import plot_tools
opj = os.path.join
def get_cls(cls_path, lmax, A_lens=1):
'''
returns
-------
cls : array-like
Lensed Cls (shape (4,lmax-1) with BB lensing power
reduced depending on A_len... | [
"sst.camb_tools.get_so_noise",
"sst.plot_tools.cls_matrix",
"numpy.zeros",
"sst.Fisher",
"numpy.ones",
"numpy.einsum",
"numpy.where",
"numpy.arange",
"numpy.loadtxt",
"numpy.interp",
"sst.camb_tools.get_spectra",
"numpy.sqrt"
] | [((387, 452), 'sst.camb_tools.get_spectra', 'ct.get_spectra', (['cls_path'], {'tag': '"""r0"""', 'lensed': '(False)', 'prim_type': '"""tot"""'}), "(cls_path, tag='r0', lensed=False, prim_type='tot')\n", (401, 452), True, 'from sst import camb_tools as ct\n'), ((502, 566), 'sst.camb_tools.get_spectra', 'ct.get_spectra',... |
from Vector import Vector
from Neuron import Neuron
class HiddenLayer:
def __init__(self, size, input_size, weights, activation, activation_d, loss, loss_d, bias=1.0):
self.size = size
#self.input_layer = input_layer
self.input_size = input_size
#self.output_layer = output_layer
... | [
"Vector.Vector",
"Neuron.Neuron"
] | [((1241, 1251), 'Vector.Vector', 'Vector', (['op'], {}), '(op)\n', (1247, 1251), False, 'from Vector import Vector\n'), ((1259, 1270), 'Vector.Vector', 'Vector', (['lin'], {}), '(lin)\n', (1265, 1270), False, 'from Vector import Vector\n'), ((571, 612), 'Neuron.Neuron', 'Neuron', (['w', 'activation', 'activation_d', 'b... |
# -*- coding: utf-8 -*-
#
# This file is part of BridgeDB, a Tor bridge distribution system.
#
# :authors: <NAME> 0xA3ADB67A2CDB8B35 <<EMAIL>>
# please also see AUTHORS file
# :copyright: (c) 2013 Isis Lovecruft
# (c) 2007-2013, The Tor Project, Inc.
# (c) 2007-2013, all entities withi... | [
"logging.error",
"bridgedb.parse.addr.isIPAddress",
"bridgedb.parse.addr.isIPv4",
"logging.debug",
"bridgedb.parse.parseUnpaddedBase64",
"logging.warn",
"bridgedb.parse.addr.PortList"
] | [((6251, 6361), 'logging.warn', 'logging.warn', (['("Networkstatus parser received non \'a\'-line for %r: %r" % (fingerprint or\n \'Unknown\', line))'], {}), '("Networkstatus parser received non \'a\'-line for %r: %r" % (\n fingerprint or \'Unknown\', line))\n', (6263, 6361), False, 'import logging\n'), ((6882,... |
import weakref
import numpy as np
class Tree:
'''
Implementation of Nary-tree.
The source code is modified based on https://github.com/lianemeth/forest/blob/master/forest/NaryTree.py
Parameters
----------
key: object
key of the node
num_branch: int
how many branches in e... | [
"numpy.full",
"numpy.lexsort",
"numpy.any",
"numpy.argsort",
"weakref.ref"
] | [((1995, 2016), 'numpy.lexsort', 'np.lexsort', (['F.T[::-1]'], {}), '(F.T[::-1])\n', (2005, 2016), True, 'import numpy as np\n'), ((2127, 2143), 'numpy.full', 'np.full', (['N', '(True)'], {}), '(N, True)\n', (2134, 2143), True, 'import numpy as np\n'), ((2154, 2166), 'numpy.any', 'np.any', (['left'], {}), '(left)\n', (... |
import gunicorn
import os
workers = os.getenv("GUNICORN_WORKERS")
worker_class = "gevent"
keepalive = os.getenv("GUNICORN_KEEP_ALIVE")
bind = "0.0.0.0:5000"
gunicorn.SERVER_SOFTWARE = "None"
| [
"os.getenv"
] | [((38, 67), 'os.getenv', 'os.getenv', (['"""GUNICORN_WORKERS"""'], {}), "('GUNICORN_WORKERS')\n", (47, 67), False, 'import os\n'), ((104, 136), 'os.getenv', 'os.getenv', (['"""GUNICORN_KEEP_ALIVE"""'], {}), "('GUNICORN_KEEP_ALIVE')\n", (113, 136), False, 'import os\n')] |
from django.conf.urls import include
from django.urls import path
urlpatterns = [
path("task", include("aws_pubsub.urls")),
]
| [
"django.conf.urls.include"
] | [((101, 127), 'django.conf.urls.include', 'include', (['"""aws_pubsub.urls"""'], {}), "('aws_pubsub.urls')\n", (108, 127), False, 'from django.conf.urls import include\n')] |
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 07 11:41:07 2016
@author: Ferriss
"""
from pynams import experiments
reload(experiments)
experiments.convertH(110.,) | [
"pynams.experiments.convertH"
] | [((139, 166), 'pynams.experiments.convertH', 'experiments.convertH', (['(110.0)'], {}), '(110.0)\n', (159, 166), False, 'from pynams import experiments\n')] |
#!
'''
..%%%%...%%%%%%..%%%%%%..........%%%%%...%%..%%..%%%%%%..%%......%%%%%%.
.%%......%%........%%............%%..%%..%%..%%....%%....%%........%%...
.%%.%%%..%%%%......%%............%%%%%...%%..%%....%%....%%........%%...
.%%..%%..%%........%%............%%..%%..%%..%%....%%....%%........%%...
..%%%%...%%%%%%....%%... | [
"app.app.route",
"flask_cors.CORS",
"app.models.Customer.query.filter_by",
"flask.abort",
"app.models.BudgetItemSchema",
"json.dumps",
"app.models.Customer",
"flask.request.get_json",
"flask.jsonify",
"app.db.session.delete",
"app.db.session.commit",
"flask.render_template",
"app.db.session.... | [((752, 761), 'flask_cors.CORS', 'CORS', (['app'], {}), '(app)\n', (756, 761), False, 'from flask_cors import CORS\n'), ((781, 797), 'app.models.CustomerSchema', 'CustomerSchema', ([], {}), '()\n', (795, 797), False, 'from app.models import Customer, BudgetItem, CustomerSchema, BudgetItemSchema\n'), ((814, 841), 'app.m... |
#
# Copyright 2022 Intel (Autonomous Agents Lab)
#
# 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... | [
"tensorflow.keras.layers.Dense",
"open3d.ml.tf.layers.ContinuousConv",
"tensorflow.dtypes.cast",
"tensorflow.concat",
"tensorflow.sort",
"tensorflow.math.count_nonzero",
"tensorflow.zeros_like",
"tensorflow.cast",
"tensorflow.shape",
"collections.namedtuple",
"tensorflow.broadcast_to",
"tensor... | [((758, 852), 'collections.namedtuple', 'namedtuple', (['"""NNSResult"""', "['neighbors_index', 'neighbors_distance', 'neighbors_row_splits']"], {}), "('NNSResult', ['neighbors_index', 'neighbors_distance',\n 'neighbors_row_splits'])\n", (768, 852), False, 'from collections import namedtuple\n'), ((18555, 18650), 't... |
import pytest
from pathlib import Path
@pytest.fixture(scope="module")
def resources_path():
return Path(__file__).parent / "resources"
@pytest.fixture(scope="module")
def tasks_base_path(resources_path):
return resources_path / "tasks"
@pytest.fixture(scope="module")
def results_base_path(resources_path)... | [
"pathlib.Path",
"pytest.mark.skip",
"pytest.fixture"
] | [((42, 72), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (56, 72), False, 'import pytest\n'), ((145, 175), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (159, 175), False, 'import pytest\n'), ((252, 282), 'pytest.fixture', 'pytes... |
#from __future__ import print_function
import winreg as reg
from scapy.all import *
import logging
logging.getLogger("scapy.runtime").setLevel(logging.ERROR)
ADAPTER_KEY = r'SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}'
OpenVpnPath = "C:\\Program Files\\OpenVPN\\bin\\openvpn.exe"
... | [
"winreg.QueryValueEx",
"logging.getLogger",
"winreg.EnumKey",
"winreg.OpenKey"
] | [((670, 718), 'winreg.OpenKey', 'reg.OpenKey', (['reg.HKEY_LOCAL_MACHINE', 'ADAPTER_KEY'], {}), '(reg.HKEY_LOCAL_MACHINE, ADAPTER_KEY)\n', (681, 718), True, 'import winreg as reg\n'), ((102, 136), 'logging.getLogger', 'logging.getLogger', (['"""scapy.runtime"""'], {}), "('scapy.runtime')\n", (119, 136), False, 'import ... |
from PyFlow.Core.Common import *
from PyFlow.Core import FunctionLibraryBase
from PyFlow.Core import IMPLEMENT_NODE
PIN_ALLOWS_ANYTHING = {PinSpecifires.ENABLED_OPTIONS: PinOptions.AllowAny | PinOptions.ArraySupported | PinOptions.DictSupported}
class ActionLibrary(FunctionLibraryBase):
'''doc string for DemoLi... | [
"PyFlow.Core.IMPLEMENT_NODE"
] | [((444, 575), 'PyFlow.Core.IMPLEMENT_NODE', 'IMPLEMENT_NODE', ([], {'returns': 'None', 'nodeType': 'NodeTypes.Callable', 'meta': "{NodeMeta.CATEGORY: 'ActionLibrary-L0', NodeMeta.KEYWORDS: []}"}), "(returns=None, nodeType=NodeTypes.Callable, meta={NodeMeta.\n CATEGORY: 'ActionLibrary-L0', NodeMeta.KEYWORDS: []})\n",... |
from cpt.packager import ConanMultiPackager, tools
if __name__ == "__main__":
builder = ConanMultiPackager(
reference="turtle/{}".format( tools.load("version.txt") )
)
builder.add_common_builds()
builder.run()
| [
"cpt.packager.tools.load"
] | [((152, 177), 'cpt.packager.tools.load', 'tools.load', (['"""version.txt"""'], {}), "('version.txt')\n", (162, 177), False, 'from cpt.packager import ConanMultiPackager, tools\n')] |
from PyQt5 import QtWidgets
from PyQt5.QtWidgets import QMainWindow, QAction, QFileDialog, QCheckBox
class Window(QMainWindow):
def __init__(self, controller):
super().__init__()
self.controller = controller
# setup actions
open_comparison_dir_action = QAction('Open Comparison I... | [
"PyQt5.QtWidgets.QWidget",
"PyQt5.QtWidgets.QFileDialog.getExistingDirectory",
"PyQt5.QtWidgets.QHBoxLayout",
"PyQt5.QtWidgets.QPushButton",
"PyQt5.QtWidgets.QCheckBox",
"PyQt5.QtWidgets.QVBoxLayout",
"PyQt5.QtWidgets.QAction"
] | [((294, 343), 'PyQt5.QtWidgets.QAction', 'QAction', (['"""Open Comparison Images Directory"""', 'self'], {}), "('Open Comparison Images Directory', self)\n", (301, 343), False, 'from PyQt5.QtWidgets import QMainWindow, QAction, QFileDialog, QCheckBox\n'), ((598, 627), 'PyQt5.QtWidgets.QAction', 'QAction', (['"""Open Da... |
from __future__ import print_function, absolute_import
import collections
import os
from ctypes import (POINTER, c_char_p, c_longlong, c_int, c_size_t,
c_void_p, string_at, byref)
from . import ffi
from .module import parse_assembly
from .common import _decode_string, _encode_string
def get_defa... | [
"ctypes.c_int",
"ctypes.string_at",
"ctypes.byref",
"collections.namedtuple",
"ctypes.POINTER"
] | [((8017, 8072), 'collections.namedtuple', 'collections.namedtuple', (['"""LibFunc"""', "['identity', 'name']"], {}), "('LibFunc', ['identity', 'name'])\n", (8039, 8072), False, 'import collections\n'), ((8210, 8227), 'ctypes.POINTER', 'POINTER', (['c_char_p'], {}), '(c_char_p)\n', (8217, 8227), False, 'from ctypes impo... |
#!/usr/bin/env python
import socket
class Socket:
'''from python.org docs
demonstration class only -- coded for clarity, not efficiency
'''
def __init__(self, sock=None):
if sock is None:
self.sock = socket.socket(
socket.AF_INET, socket.SOCK_STREAM)
e... | [
"socket.socket"
] | [((244, 293), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (257, 293), False, 'import socket\n')] |
'''
Created on 2.10.2011
@author: xaralis
'''
from django import template
from django.conf import settings
from boris.services.models.core import service_list
register = template.Library()
@register.inclusion_tag('services/interface.html')
def render_service_interface(encounter):
return {
'encounter':... | [
"boris.services.models.core.service_list",
"django.template.Library"
] | [((174, 192), 'django.template.Library', 'template.Library', ([], {}), '()\n', (190, 192), False, 'from django import template\n'), ((407, 437), 'boris.services.models.core.service_list', 'service_list', (['encounter.person'], {}), '(encounter.person)\n', (419, 437), False, 'from boris.services.models.core import servi... |
#!/usr/bin/env python3
# Copyright (c) 2020 Arm Limited
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2... | [
"pyocd.commands.base.ALL_COMMANDS.values"
] | [((3830, 3851), 'pyocd.commands.base.ALL_COMMANDS.values', 'ALL_COMMANDS.values', ([], {}), '()\n', (3849, 3851), False, 'from pyocd.commands.base import ALL_COMMANDS, ValueBase\n')] |
# Copyright (c) 2011, <NAME>, <NAME>, TU 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:
#
# * Redistributions of source code must retain the above copyright
# notice, this list ... | [
"python_qt_binding.QtCore.Slot",
"python_qt_binding.QtCore.Signal",
"python_qt_binding.QtCore.qDebug",
"qt_gui.window_changed_signaler.WindowChangedSignaler",
"qt_gui.dock_widget_title_bar.DockWidgetTitleBar",
"traceback.format_exc",
"qt_gui.dock_widget.DockWidget"
] | [((2234, 2250), 'python_qt_binding.QtCore.Signal', 'Signal', (['str', 'str'], {}), '(str, str)\n', (2240, 2250), False, 'from python_qt_binding.QtCore import qCritical, qDebug, QObject, Qt, qWarning, Signal, Slot\n'), ((2270, 2281), 'python_qt_binding.QtCore.Signal', 'Signal', (['str'], {}), '(str)\n', (2276, 2281), Fa... |
import sys
import pickle
import numpy as np
sys.path.append('./../')
sys.path.append('./../../')
from src.LocalGlobalAttentionModel.model import Model as parent_model
from .vel_param import VelParam as vel_param
from src.HMC.hmc import HMC
class Model(parent_model):
"""
This class describes a model where fi... | [
"sys.path.append",
"pickle.dump",
"numpy.zeros",
"numpy.unravel_index",
"numpy.array",
"numpy.exp",
"numpy.sqrt",
"src.HMC.hmc.HMC"
] | [((46, 70), 'sys.path.append', 'sys.path.append', (['"""./../"""'], {}), "('./../')\n", (61, 70), False, 'import sys\n'), ((71, 98), 'sys.path.append', 'sys.path.append', (['"""./../../"""'], {}), "('./../../')\n", (86, 98), False, 'import sys\n'), ((1755, 1808), 'numpy.unravel_index', 'np.unravel_index', (['inds', 'se... |
import copy
import os
from datetime import datetime
import dialogic
import attr
from dialogic.cascade import Cascade, Pr, DialogTurn
from dialogic.dialog import Context, Response
from dialogic.dialog_manager import TurnDialogManager
csc = Cascade()
@attr.s
class PTurn(DialogTurn):
forms_collection = attr.ib(de... | [
"copy.deepcopy",
"os.path.join",
"dialogic.dialog.Response",
"attr.ib",
"datetime.datetime.now",
"dialogic.cascade.Cascade",
"os.listdir"
] | [((242, 251), 'dialogic.cascade.Cascade', 'Cascade', ([], {}), '()\n', (249, 251), False, 'from dialogic.cascade import Cascade, Pr, DialogTurn\n'), ((310, 331), 'attr.ib', 'attr.ib', ([], {'default': 'None'}), '(default=None)\n', (317, 331), False, 'import attr\n'), ((358, 379), 'attr.ib', 'attr.ib', ([], {'default': ... |
import torch
import torch.nn as nn
import numpy as np
from itertools import combinations
import torch.nn.functional as F
def sigmoid(x):
return 1 / (1 + np.exp(-x))
def cal_l2(x, y):
return torch.pow((x - y), 2).sum(-1).sum()
class ContrastiveLoss(nn.Module):
"""
Contrastive loss
Takes embedding... | [
"itertools.combinations",
"torch.cuda.is_available",
"numpy.exp",
"torch.pow",
"torch.nn.functional.relu",
"torch.zeros"
] | [((159, 169), 'numpy.exp', 'np.exp', (['(-x)'], {}), '(-x)\n', (165, 169), True, 'import numpy as np\n'), ((607, 632), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (630, 632), False, 'import torch\n'), ((724, 738), 'torch.zeros', 'torch.zeros', (['(1)'], {}), '(1)\n', (735, 738), False, 'impo... |
from ..testutils import BaseTestCase, compare_files, temp_files, regenerate_references
import unittest
import numpy as np
import pickle
import time
import warnings
import pygsti
from pygsti.extras import idletomography as idt
#Helper functions
#Global dicts describing how to prep and measure in various bases
prepDict... | [
"pygsti.obj.Circuit",
"numpy.abs",
"pygsti.do_long_sequence_gst",
"pygsti.construction.build_cloudnoise_model_from_hops_and_weights",
"pygsti.construction.filter_dataset",
"unittest.main",
"pygsti.extras.idletomography.predicted_intrinsic_rates",
"pygsti.do_long_sequence_gst_base",
"pygsti.modelpack... | [((1386, 1764), 'pygsti.construction.build_cloudnoise_model_from_hops_and_weights', 'pygsti.construction.build_cloudnoise_model_from_hops_and_weights', (['nQubits', "['Gx', 'Gy', 'Gcnot']", 'nonstd_gate_unitaries', 'None', 'availability', 'None', 'geometry', 'maxIdleWeight', 'maxSpamWeight', 'maxhops', 'extraWeight1Hop... |
import pytest
import mock
from marshmallow import ValidationError
from puzzle_engine.hitori.schemas import (
CellSchema,
BoardSchema,
HitoriSolutionSchema
)
class TestCellSchema:
@pytest.fixture
def data(self):
return {
'id': 1,
'row_number': 1,
'col... | [
"puzzle_engine.hitori.schemas.CellSchema",
"mock.patch",
"puzzle_engine.hitori.schemas.BoardSchema",
"pytest.raises",
"pytest.mark.parametrize",
"puzzle_engine.hitori.schemas.HitoriSolutionSchema"
] | [((1179, 1220), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""data"""', 'bad_data'], {}), "('data', bad_data)\n", (1202, 1220), False, 'import pytest\n'), ((5592, 5633), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""data"""', 'bad_data'], {}), "('data', bad_data)\n", (5615, 5633), False, 'im... |
#!/usr/bin/python3
import pandas as pd
import argparse
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("-i", "--input", help="xlsx sheet containing the time tracks of the installation")
parser.add_argument("-o", "--output", help="output file path")
parser.add_argument... | [
"pandas.DataFrame",
"argparse.ArgumentParser",
"pandas.read_excel"
] | [((97, 122), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (120, 122), False, 'import argparse\n'), ((1997, 2288), 'pandas.DataFrame', 'pd.DataFrame', (["{'OWEC': installationTimes['OWEC'], 'Nacelle Installation End':\n installationTimes['Nacelle Installation End'],\n 'Blade Installation... |
import logging
import shutil
import subprocess
import uuid
import datetime
import json
from murakami.errors import RunnerError
from murakami.runner import MurakamiRunner
logger = logging.getLogger(__name__)
class Ndt5Client(MurakamiRunner):
"""Run NDT5 test."""
def __init__(self, config=None, data_cb=None,
... | [
"subprocess.run",
"json.loads",
"shutil.which",
"json.dumps",
"datetime.datetime.utcnow",
"logging.getLogger",
"murakami.errors.RunnerError"
] | [((181, 208), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (198, 208), False, 'import logging\n'), ((822, 849), 'shutil.which', 'shutil.which', (['"""ndt5-client"""'], {}), "('ndt5-client')\n", (834, 849), False, 'import shutil\n'), ((1247, 1273), 'datetime.datetime.utcnow', 'datetime.d... |
# -*- encoding:utf-8 -*-
from kscore.session import get_session
if __name__ == "__main__":
s = get_session()
client = s.create_client("kec", "cn-beijing-6", use_ssl=False)
# https://docs.ksyun.com/read/latest/52/_book/oaDescribeInstances.html
client.describe_instances()
# https://docs.ksyun.com... | [
"kscore.session.get_session"
] | [((101, 114), 'kscore.session.get_session', 'get_session', ([], {}), '()\n', (112, 114), False, 'from kscore.session import get_session\n')] |
from unittest import TestCase
from numpy import sort
from pm4py.objects.petri import importer
from pm4py.objects.log.importer.xes import factory as xes_importer
from da4py.main.analytics.amstc import Amstc, samplingVariantsForAmstc
class TestAmstc(TestCase):
'''
This class aims at testing amstc.py file.
... | [
"da4py.main.analytics.amstc.samplingVariantsForAmstc",
"pm4py.objects.petri.importer.factory.apply",
"pm4py.objects.log.importer.xes.factory.apply"
] | [((343, 402), 'pm4py.objects.petri.importer.factory.apply', 'importer.factory.apply', (['"""../../examples/medium/model2.pnml"""'], {}), "('../../examples/medium/model2.pnml')\n", (365, 402), False, 'from pm4py.objects.petri import importer\n'), ((413, 467), 'pm4py.objects.log.importer.xes.factory.apply', 'xes_importer... |
import sys
import os
import arginfer
import argparse
import logging
import msprime
from arginfer.mcmc import *
from arginfer.plots import *
# import comparison.plot
'''
command line interface for arginfer
'''
logger = logging.getLogger(__name__)
log_format = "%(asctime)s %(levelname)s %(message)s"
def error_exit(messa... | [
"argparse.ArgumentParser",
"logging.basicConfig",
"os.getcwd",
"msprime.load",
"argparse.FileType",
"logging.getLogger"
] | [((218, 245), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (235, 245), False, 'import logging\n'), ((566, 621), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'log_level', 'format': 'log_format'}), '(level=log_level, format=log_format)\n', (585, 621), False, 'import loggin... |
# Generated by Django 3.2 on 2021-04-24 03:25
from django.db import migrations, models # pragma: no cover
import django.db.models.deletion # pragma: no cover
class Migration(migrations.Migration): # pragma: no cover
dependencies = [
('api', '0001_initial'),
]
operations = [
migrations.C... | [
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.FloatField",
"django.db.models.AutoField"
] | [((413, 479), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(40)', 'primary_key': '(True)', 'serialize': '(False)'}), '(max_length=40, primary_key=True, serialize=False)\n', (429, 479), False, 'from django.db import migrations, models\n'), ((512, 563), 'django.db.models.CharField', 'models.Char... |
# -*- coding: utf-8 -*-
"""
MIT License
Copyright (c) 2019-2020 Arthur
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, m... | [
"datetime.datetime.now"
] | [((1931, 1945), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (1943, 1945), False, 'from datetime import datetime\n')] |
import argparse
import time
import matplotlib.pyplot as plt
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torchvision import datasets, transforms, models
from models import *
from diagnostics import do_diagnostics
# TODOs
# Fix hyperparameters to match previous l... | [
"torchvision.models.resnet18",
"argparse.ArgumentParser",
"diagnostics.do_diagnostics",
"torch.utils.data.DataLoader",
"torchvision.transforms.RandomHorizontalFlip",
"torch.manual_seed",
"torch.nn.CrossEntropyLoss",
"time.time",
"torchvision.datasets.CIFAR10",
"torchvision.transforms.ToTensor",
... | [((340, 365), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (363, 365), False, 'import argparse\n'), ((1695, 1723), 'torch.manual_seed', 'torch.manual_seed', (['args.seed'], {}), '(args.seed)\n', (1712, 1723), False, 'import torch\n'), ((1809, 1852), 'torch.device', 'torch.device', (["('cuda' ... |
import os
from pip.req import parse_requirements
from setuptools import find_packages, setup
from typing import List
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
def long_description() -> str:
path = os.path.join(BASE_DIR, 'README.rst')
with open(path, 'r') as f:
long_description = f.read()
... | [
"os.path.abspath",
"os.path.join",
"setuptools.find_packages",
"pip.req.parse_requirements"
] | [((145, 170), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (160, 170), False, 'import os\n'), ((216, 252), 'os.path.join', 'os.path.join', (['BASE_DIR', '"""README.rst"""'], {}), "(BASE_DIR, 'README.rst')\n", (228, 252), False, 'import os\n'), ((394, 450), 'os.path.join', 'os.path.join', ([... |
from flask import Flask
app = Flask(__name__)
@app.route('/<name>')
def hello_name(name):
return 'Hello %s!' % name
@app.route('/<int:postID>')
def show_blog(postID):
return 'Blog Number %d' % postID
@app.route('/<float:revNo>')
def revision(revNo):
return 'Revision Number %f' % revNo
if __name__... | [
"flask.Flask"
] | [((31, 46), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (36, 46), False, 'from flask import Flask\n')] |
import unittest
import itertools
import ir_measures
class TestPytrecEval(unittest.TestCase):
def test_nDCG(self):
qrels = list(ir_measures.read_trec_qrels('''
0 0 D0 0
0 0 D1 1
0 0 D2 1
0 0 D3 2
0 0 D4 0
1 0 D0 1
1 0 D3 2
1 0 D5 2
'''))
run = list(ir_measures.read_trec_run('''
0 0 D0 1 0.8 run
0 ... | [
"unittest.main",
"ir_measures.read_trec_run",
"ir_measures.read_trec_qrels"
] | [((3014, 3029), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3027, 3029), False, 'import unittest\n'), ((142, 260), 'ir_measures.read_trec_qrels', 'ir_measures.read_trec_qrels', (['"""\n0 0 D0 0\n0 0 D1 1\n0 0 D2 1\n0 0 D3 2\n0 0 D4 0\n1 0 D0 1\n1 0 D3 2\n1 0 D5 2\n"""'], {}), '(\n """\n0 0 D0 0\n0 0 D1 1\n0... |
# pyOCD debugger
# Copyright (c) 2019 Arm Limited
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# ... | [
"logging.getLogger"
] | [((717, 744), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (734, 744), False, 'import logging\n')] |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-07-09 20:10
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('query_processor', '0019_auto_20160709_1732'),
]
operations = [
migrations.RemoveFiel... | [
"django.db.migrations.RemoveField",
"django.db.migrations.DeleteModel"
] | [((299, 368), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""platformresponse"""', 'name': '"""request"""'}), "(model_name='platformresponse', name='request')\n", (321, 368), False, 'from django.db import migrations\n'), ((413, 459), 'django.db.migrations.DeleteModel', 'migrations... |
# Source from Codecademy
from tree import build_tree, print_tree, car_data, car_labels, classify
import random
random.seed(4)
# The features are the price of the car, the cost of maintenance, the number of doors, the number of people the car can hold, the size of the trunk, and the safety rating
unlabeled_point = ['hi... | [
"tree.build_tree",
"random.seed",
"random.randint",
"tree.classify"
] | [((111, 125), 'random.seed', 'random.seed', (['(4)'], {}), '(4)\n', (122, 125), False, 'import random\n'), ((587, 625), 'tree.build_tree', 'build_tree', (['data_subset', 'labels_subset'], {}), '(data_subset, labels_subset)\n', (597, 625), False, 'from tree import build_tree, print_tree, car_data, car_labels, classify\n... |
import requests
from bs4 import BeautifulSoup
import pandas
data = requests.get("https://www.imdb.com/chart/toptv/?ref_=nv_tvv_250",
headers={"Accept-language": "en-US"})
soup = BeautifulSoup(data.text, "html.parser")
tbl = soup.find("table", {"class": "chart full-width"})
tbody = tbl.find("tbody"... | [
"bs4.BeautifulSoup",
"pandas.DataFrame",
"requests.get"
] | [((68, 176), 'requests.get', 'requests.get', (['"""https://www.imdb.com/chart/toptv/?ref_=nv_tvv_250"""'], {'headers': "{'Accept-language': 'en-US'}"}), "('https://www.imdb.com/chart/toptv/?ref_=nv_tvv_250', headers={\n 'Accept-language': 'en-US'})\n", (80, 176), False, 'import requests\n'), ((199, 238), 'bs4.Beauti... |
#
# Author : <NAME>
# Copyright (c) 2020 <NAME>. All rights reserved.
# Licensed under the MIT License. See LICENSE file in the project root for full license information.
#
#
# Test function helpers.
#
import numpy as np
def constantode(t,x):
"""Function containing a constant ODE x' = 1.
"""
xprime = np.empty... | [
"numpy.empty",
"numpy.sin",
"numpy.cos"
] | [((312, 332), 'numpy.empty', 'np.empty', (['[1]', 'float'], {}), '([1], float)\n', (320, 332), True, 'import numpy as np\n'), ((456, 479), 'numpy.empty', 'np.empty', (['[1, 1]', 'float'], {}), '([1, 1], float)\n', (464, 479), True, 'import numpy as np\n'), ((587, 607), 'numpy.empty', 'np.empty', (['[1]', 'float'], {}),... |
import pytest
from flask import Flask
from hades_logs import HadesLogs
from tests.hades_logs import get_hades_logs_config
@pytest.fixture(scope='session')
def hades_logs_config():
return get_hades_logs_config()
@pytest.fixture(scope='session')
def app(hades_logs_config):
app = Flask('test')
app.config.... | [
"flask.Flask",
"pytest.fixture",
"tests.hades_logs.get_hades_logs_config",
"hades_logs.HadesLogs"
] | [((126, 157), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (140, 157), False, 'import pytest\n'), ((221, 252), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (235, 252), False, 'import pytest\n'), ((364, 395), 'pytest.fixture'... |
"""
Serializers for chain blocks and tree nodes.
.. warning::
You need to take extra care when defining custom serializations. Be
sure that your serialization includes all the fields in the original
structure. E.g., for chain blocks:
- ``self.index``
- ``self.fingers``
- Your payload
Unle... | [
"defaultcontext.with_default_context",
"attr.Factory",
"msgpack.unpackb",
"warnings.warn",
"msgpack.packb"
] | [((2491, 2532), 'defaultcontext.with_default_context', 'with_default_context', ([], {'use_empty_init': '(True)'}), '(use_empty_init=True)\n', (2511, 2532), False, 'from defaultcontext import with_default_context\n'), ((1322, 1389), 'msgpack.packb', 'msgpack.packb', (['(PROTO_VERSION, marker, obj_repr)'], {'use_bin_type... |
#!/bin/env python
from nand import Chip, Nand
ab = ["a", "b"]
x = ["x"]
out = ["out"]
sel = ["sel"]
Not = Chip("Not")
Not.inputs = x
Not.outputs = out
Not.add(Nand, a="x", b="x", out="out")
And = Chip("And")
And.inputs = ab
And.outputs = out
And.add(Nand, a="a", b="b", out="aNandB")
And.add(Not, x="aNandB", out="ou... | [
"nand.Chip"
] | [((109, 120), 'nand.Chip', 'Chip', (['"""Not"""'], {}), "('Not')\n", (113, 120), False, 'from nand import Chip, Nand\n'), ((200, 211), 'nand.Chip', 'Chip', (['"""And"""'], {}), "('And')\n", (204, 211), False, 'from nand import Chip, Nand\n'), ((330, 340), 'nand.Chip', 'Chip', (['"""Or"""'], {}), "('Or')\n", (334, 340),... |
##############################################################################
# Copyright by The HDF Group. #
# All rights reserved. #
# #
# Th... | [
"unittest.main",
"helper.getEndpoint",
"json.loads",
"config.get",
"json.dumps",
"time.time",
"helper.getUUIDByPath",
"uuid.uuid1",
"requests.delete",
"requests.get",
"helper.getTestDomain",
"helper.getRequestHeaders",
"helper.getParentDomain",
"requests.post",
"requests.put",
"helper.... | [((17655, 17670), 'unittest.main', 'unittest.main', ([], {}), '()\n', (17668, 17670), False, 'import unittest\n'), ((1106, 1155), 'helper.getTestDomainName', 'helper.getTestDomainName', (['self.__class__.__name__'], {}), '(self.__class__.__name__)\n', (1130, 1155), False, 'import helper\n'), ((1164, 1200), 'helper.setu... |
from pyinspect import install_traceback
from rich import pretty
install_traceback()
pretty.install()
from loguru import logger
import sys
# comment these two lines out to show logging info
logger.remove()
logger.add(sys.stderr, level="INFO")
logger.level("EXPRESSION", no=15, color="<yellow>", icon="🖇")
logger.leve... | [
"pyinspect.install_traceback",
"loguru.logger.level",
"loguru.logger.add",
"loguru.logger.remove",
"rich.pretty.install"
] | [((65, 84), 'pyinspect.install_traceback', 'install_traceback', ([], {}), '()\n', (82, 84), False, 'from pyinspect import install_traceback\n'), ((85, 101), 'rich.pretty.install', 'pretty.install', ([], {}), '()\n', (99, 101), False, 'from rich import pretty\n'), ((192, 207), 'loguru.logger.remove', 'logger.remove', ([... |
from __init__ import *
import sys
from threading import Thread
from StartScreen.start_screen import StartScreen
from GameScreen.game_screen import GameScreen
from Options.options import Options
from WaitingRoom.waiting_room import WaitingRoom
from Results.results import Results
from style_sheets import Theme
class ... | [
"Options.options.Options.Module.overwrite_config",
"GameScreen.game_screen.GameScreen.Controller",
"Options.options.Options.Controller",
"style_sheets.Theme.DarkTheme.widget",
"WaitingRoom.waiting_room.WaitingRoom.Controller",
"style_sheets.Theme.LightTheme.widget",
"StartScreen.start_screen.StartScreen... | [((917, 944), 'Options.options.Options.Module.get_config', 'Options.Module.get_config', ([], {}), '()\n', (942, 944), False, 'from Options.options import Options\n'), ((1023, 1052), 'style_sheets.Theme.LightTheme.widget', 'Theme.LightTheme.widget', (['self'], {}), '(self)\n', (1046, 1052), False, 'from style_sheets imp... |
import datetime
from django.db import models
from django.utils import timezone
# Create your models here.
class AddMail(models.Model):
mail_address = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
def __str__(self):
return self.mail_address
def wa... | [
"django.db.models.CharField",
"django.db.models.DateTimeField",
"datetime.timedelta",
"django.utils.timezone.now"
] | [((163, 195), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(200)'}), '(max_length=200)\n', (179, 195), False, 'from django.db import models\n'), ((212, 250), 'django.db.models.DateTimeField', 'models.DateTimeField', (['"""date published"""'], {}), "('date published')\n", (232, 250), False, 'fr... |
from sklearn import datasets
import numpy as np
def get_info():
return {
'name': 'sklearn_iris',
'description': 'ScikitLearn | Iris',
'class_names': ['Iris Setosa', 'Iris Versicolor', 'Iris Virginica']
}
def get_data(datasets_path):
data = datasets.load_iris()
return {
... | [
"sklearn.datasets.load_iris",
"numpy.array"
] | [((280, 300), 'sklearn.datasets.load_iris', 'datasets.load_iris', ([], {}), '()\n', (298, 300), False, 'from sklearn import datasets\n'), ((334, 353), 'numpy.array', 'np.array', (['data.data'], {}), '(data.data)\n', (342, 353), True, 'import numpy as np\n'), ((374, 395), 'numpy.array', 'np.array', (['data.target'], {})... |
import sys
from pathlib import Path # if you haven't already done so
root = str(Path(__file__).resolve().parents[1])
sys.path.append(root)
import argparse
import tempfile
import os
import shutil
import yaml
import csv
from collections import OrderedDict
from Bio import SeqIO
from Bio.Seq import Seq
from Bio.SeqRecord i... | [
"sys.path.append",
"yaml.load",
"Bio.SeqIO.parse",
"argparse.ArgumentParser",
"Bio.SeqIO.write",
"csv.DictReader",
"Bio.SeqRecord.SeqRecord",
"pathlib.Path",
"tempfile.mkdtemp",
"collections.OrderedDict",
"shutil.rmtree",
"os.path.join",
"sys.exit"
] | [((117, 138), 'sys.path.append', 'sys.path.append', (['root'], {}), '(root)\n', (132, 138), False, 'import sys\n'), ((521, 762), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['"""pvacseq generate_protein_fasta"""'], {'description': '"""Generate an annotated fasta file from a VCF with protein sequences of muta... |
'''
Created on Mar 7, 2020
@author: ballance
'''
import os
import sys
import importlib
from tsr.engine_info import EngineInfo
from tsr.messaging import verbose_note, error
from tsr.tool_info import ToolInfo
import subprocess
from _io import StringIO
import cmd
from tsr.plusarg_info import PlusargInfo
from json impor... | [
"cmd.extend",
"tsr.messaging.verbose_note",
"json.load",
"os.path.abspath",
"os.path.basename",
"os.path.isdir",
"tsr.plusarg_info.PlusargInfo",
"subprocess.check_output",
"os.path.dirname",
"os.path.isfile",
"os.path.splitext",
"os.path.join",
"os.listdir",
"importlib.util.module_from_spe... | [((1666, 1684), 'os.listdir', 'os.listdir', (['pp_dir'], {}), '(pp_dir)\n', (1676, 1684), False, 'import os\n'), ((3411, 3462), 'tsr.messaging.verbose_note', 'verbose_note', (["('processing mkfiles directory ' + dir)"], {}), "('processing mkfiles directory ' + dir)\n", (3423, 3462), False, 'from tsr.messaging import ve... |
#!/usr/bin/env python
import sys
import django
from django.conf import settings
from django.test.runner import DiscoverRunner
settings.configure(DEBUG=True,
DATABASES={
'default':{
'ENGINE':'django.db.backends.sqlite3',
}
},
ROOT_URLCONF='flowr.urls',
INSTALLED_APPS=(
... | [
"django.conf.settings.configure",
"django.test.runner.DiscoverRunner",
"django.setup",
"sys.exit"
] | [((129, 409), 'django.conf.settings.configure', 'settings.configure', ([], {'DEBUG': '(True)', 'DATABASES': "{'default': {'ENGINE': 'django.db.backends.sqlite3'}}", 'ROOT_URLCONF': '"""flowr.urls"""', 'INSTALLED_APPS': "('django.contrib.auth', 'django.contrib.contenttypes',\n 'django.contrib.sessions', 'django.contr... |
# Copyright 2020 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Software flag module to store and report binary status."""
import hw_driver
# pylint: disable=invalid-name
# This follows servod drv naming conventi... | [
"hw_driver.HwDriverError"
] | [((985, 1046), 'hw_driver.HwDriverError', 'hw_driver.HwDriverError', (["('Invalid value: %d' % self.vstore[0])"], {}), "('Invalid value: %d' % self.vstore[0])\n", (1008, 1046), False, 'import hw_driver\n'), ((1538, 1601), 'hw_driver.HwDriverError', 'hw_driver.HwDriverError', (["('Invalid default: %d' % self.vstore[0])"... |
import numpy as np
import pandas as pd
import WindFarmGenetic # wind farm layout optimization using genetic algorithms classes
from datetime import datetime
import os
from sklearn.svm import SVR
import pickle
# Wind farm settings and algorithm settings
# parameters for the genetic algorithm
elite_rate = 0.2... | [
"sklearn.svm.SVR",
"os.makedirs",
"numpy.savetxt",
"numpy.zeros",
"os.path.exists",
"numpy.arange",
"WindFarmGenetic.WindFarmGenetic",
"datetime.datetime.now"
] | [((581, 603), 'numpy.arange', 'np.arange', (['(121)', '(145)', '(1)'], {}), '(121, 145, 1)\n', (590, 603), True, 'import numpy as np\n'), ((2996, 3268), 'WindFarmGenetic.WindFarmGenetic', 'WindFarmGenetic.WindFarmGenetic', ([], {'rows': 'rows_cells', 'cols': 'cols_cells', 'N': 'wt_N', 'NA_loc': 'NA_loc', 'pop_size': 'p... |
# -*- coding: utf-8 -*-
"""
目的
- アノテーション作業の前の一番最初の画像データの前処理
- 画像サイズを小さくする & 画像サイズを揃える
"""
import os
import glob
import numpy as np
from PIL import Image
import argparse
def main(args):
img_files = glob.glob(os.path.join(args.img_dir, args.img_filter))
print('image_dir : ', args.img_dir, ', filter : ', args... | [
"numpy.array",
"os.path.join",
"argparse.ArgumentParser",
"PIL.Image.open"
] | [((1035, 1083), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""argparser"""'}), "(description='argparser')\n", (1058, 1083), False, 'import argparse\n'), ((216, 259), 'os.path.join', 'os.path.join', (['args.img_dir', 'args.img_filter'], {}), '(args.img_dir, args.img_filter)\n', (228, 259... |
from flask import render_template, flash, redirect, url_for, request
import pymysql
import json
from app import *
from app.form import ServerInfo
from app.handler import *
@app.route('/', methods=['GET', 'POST'])
def login():
form = ServerInfo()
if form.validate_on_submit():
flash('Login requested for user {}, r... | [
"json.dumps",
"flask.url_for",
"app.form.ServerInfo",
"flask.render_template",
"pymysql.connect"
] | [((237, 249), 'app.form.ServerInfo', 'ServerInfo', ([], {}), '()\n', (247, 249), False, 'from app.form import ServerInfo\n'), ((438, 478), 'flask.render_template', 'render_template', (['"""index.html"""'], {'form': 'form'}), "('index.html', form=form)\n", (453, 478), False, 'from flask import render_template, flash, re... |
import math
from datetime import datetime, timedelta
from Ops import Op
def splitTc(tc):
hrs, mins, secs, frames = tc.split(":")
return hrs, mins, secs, frames
def TCFtoInt(tc, fps):
hrs, mins, secs, frames = splitTc(tc)
fps = math.ceil(float(fps))
if hrs != "" and mins != "" and secs != "" and frames != "" and... | [
"datetime.timedelta",
"Registry.registerOp"
] | [((1854, 1907), 'Registry.registerOp', 'Registry.registerOp', (['"""Set Frame Range"""', 'SetFrameRange'], {}), "('Set Frame Range', SetFrameRange)\n", (1873, 1907), False, 'import Registry\n'), ((1014, 1034), 'datetime.timedelta', 'timedelta', ([], {'seconds': '(1)'}), '(seconds=1)\n', (1023, 1034), False, 'from datet... |
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
import matplotlib
matplotlib.use('Agg')
# True indicates it's for 10-class multiway version
test_f1s_filename = '/Users/sofiaserrano/Downloads/paperResults/binaryTEST_withcontext_bootstrappedf1s.csv'
dev_f1s_filename = '/Users/sofiaserrano/Down... | [
"pandas.DataFrame",
"matplotlib.pyplot.title",
"matplotlib.pyplot.close",
"matplotlib.pyplot.figure",
"seaborn.boxplot",
"matplotlib.use",
"seaborn.set",
"matplotlib.pyplot.savefig"
] | [((92, 113), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (106, 113), False, 'import matplotlib\n'), ((399, 408), 'seaborn.set', 'sns.set', ([], {}), '()\n', (406, 408), True, 'import seaborn as sns\n'), ((2123, 2154), 'pandas.DataFrame', 'pd.DataFrame', (['list_of_row_dicts'], {}), '(list_of_r... |
import time
import microcontroller
from hardware import drivers
if drivers.vbus_detect.value:
from . import low_battery_splash
while drivers._read_bat_percent() < 4:
time.sleep(5)
print(f"[time: {time.monotonic()}] battery too low, waiting to boot")
else:
print("battery charged to 4+ percent, restarti... | [
"microcontroller.reset",
"hardware.drivers._read_bat_percent",
"time.monotonic",
"time.sleep"
] | [((139, 166), 'hardware.drivers._read_bat_percent', 'drivers._read_bat_percent', ([], {}), '()\n', (164, 166), False, 'from hardware import drivers\n'), ((176, 189), 'time.sleep', 'time.sleep', (['(5)'], {}), '(5)\n', (186, 189), False, 'import time\n'), ((329, 352), 'microcontroller.reset', 'microcontroller.reset', ([... |
# Copyright 2020 The TensorFlow Authors
#
# 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 i... | [
"numpy.random.seed",
"tensorflow.compat.v1.train.SummarySaverHook",
"tensorflow_graphics.projects.cvxnet.lib.utils.define_flags",
"tensorflow.compat.v1.data.make_one_shot_iterator",
"tensorflow.compat.v1.disable_eager_execution",
"tensorflow.compat.v1.set_random_seed",
"tensorflow.compat.v1.train.AdamOp... | [((951, 979), 'tensorflow.compat.v1.disable_eager_execution', 'tf.disable_eager_execution', ([], {}), '()\n', (977, 979), True, 'import tensorflow.compat.v1 as tf\n'), ((1023, 1064), 'tensorflow.compat.v1.logging.set_verbosity', 'tf.logging.set_verbosity', (['tf.logging.INFO'], {}), '(tf.logging.INFO)\n', (1047, 1064),... |