code stringlengths 20 1.04M | apis list | extract_api stringlengths 75 9.94M |
|---|---|---|
# (C) Copyright 2014, Google Inc.
# (C) Copyright 2018, <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 o... | [
"atexit.register",
"subprocess.run",
"tempfile.TemporaryDirectory",
"argparse.ArgumentParser",
"argparse.Namespace.__eq__",
"os.environ.copy",
"shutil.which",
"logging.getLogger",
"datetime.date.today",
"os.environ.get",
"platform.uname",
"pathlib.Path",
"tempfile.mkdtemp",
"shutil.copy",
... | [((1057, 1084), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1074, 1084), False, 'import logging\n'), ((4508, 4832), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'epilog': '"""\n The font names specified in --fontlist need to be recognizable by Pango using\n fontco... |
# coding=utf-8
from unityagents import UnityEnvironment
import numpy as np
env = UnityEnvironment(file_name="./Soccer_Windows_x86_64/Soccer.exe")
# print the brain names
print(env.brain_names)
# set the goalie brain
g_brain_name = env.brain_names[0]
g_brain = env.brains[g_brain_name]
# set the striker brain
s_bra... | [
"numpy.zeros",
"numpy.any",
"numpy.random.randint",
"unityagents.UnityEnvironment"
] | [((83, 147), 'unityagents.UnityEnvironment', 'UnityEnvironment', ([], {'file_name': '"""./Soccer_Windows_x86_64/Soccer.exe"""'}), "(file_name='./Soccer_Windows_x86_64/Soccer.exe')\n", (99, 147), False, 'from unityagents import UnityEnvironment\n'), ((1626, 1648), 'numpy.zeros', 'np.zeros', (['num_g_agents'], {}), '(num... |
from django.shortcuts import redirect
from django.views.generic import View
from django.contrib.auth.mixins import LoginRequiredMixin
from dashboard.views.utils import page_manage
class Index(LoginRequiredMixin, View):
redirect_field_name = 'next'
@page_manage
def get(self, request):
return redi... | [
"django.shortcuts.redirect"
] | [((316, 332), 'django.shortcuts.redirect', 'redirect', (['"""apps"""'], {}), "('apps')\n", (324, 332), False, 'from django.shortcuts import redirect\n')] |
import numpy as np
from scipy.special import logsumexp
from numba import njit
def hilbert_iter(n_qubits):
"""
An iterator over all 2**n_qubits bitstrings in a given hilbert space basis.
"""
for n in range(2**n_qubits):
yield np.fromiter(map(int, np.binary_repr(n, width=n_qubits)), dtype=np.boo... | [
"numpy.binary_repr",
"numpy.random.choice",
"numpy.tanh",
"numpy.log",
"numpy.vdot",
"numpy.max",
"numpy.imag",
"numpy.exp",
"numpy.real",
"scipy.special.logsumexp"
] | [((448, 462), 'numpy.max', 'np.max', (['z.real'], {}), '(z.real)\n', (454, 462), True, 'import numpy as np\n'), ((923, 937), 'numpy.max', 'np.max', (['x.real'], {}), '(x.real)\n', (929, 937), True, 'import numpy as np\n'), ((947, 961), 'numpy.max', 'np.max', (['y.real'], {}), '(y.real)\n', (953, 961), True, 'import num... |
# coding: utf-8
"""
Hydrogen Atom API
The Hydrogen Atom API # noqa: E501
OpenAPI spec version: 1.7.0
Contact: <EMAIL>
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
class CardProgram(object):
"""NOTE: This class is a... | [
"six.iteritems"
] | [((11684, 11717), 'six.iteritems', 'six.iteritems', (['self.swagger_types'], {}), '(self.swagger_types)\n', (11697, 11717), False, 'import six\n')] |
# https://leetcode.com/problems/insert-delete-getrandom-o1-duplicates-allowed/
import random
class RandomizedCollection(object):
def __init__(self):
"""
Initialize your data structure here.
"""
self.items = []
self.contained_items = {}
def insert(self, val):
... | [
"random.random"
] | [((1621, 1636), 'random.random', 'random.random', ([], {}), '()\n', (1634, 1636), False, 'import random\n')] |
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from Platforms.Discord.main_discord import PhaazebotDiscord
import random
from Utils.Classes.discordcommand import DiscordCommand
from Utils.Classes.discordcommandcontext import DiscordCommandContext
async def randomChoice(_cls:"PhaazebotDiscord", _Command:DiscordCo... | [
"random.choice"
] | [((690, 709), 'random.choice', 'random.choice', (['pool'], {}), '(pool)\n', (703, 709), False, 'import random\n')] |
from entities.Dealer import Dealer
from entities.Player import Player
from cards.Shuffle import Shuffle
from gameplay.GameState import GameState
from gameplay.GameStateHandler import GameStateHandler
from gameplay.PlayerAction import PlayerAction
from console.ConsoleReader import ConsoleReader
from console.ConsoleWrit... | [
"console.ConsoleReader.ConsoleReader.read_action",
"console.ConsoleWriter.ConsoleWriter.write_cards",
"cards.Shuffle.Shuffle.generate_card_deck",
"console.ConsoleWriter.ConsoleWriter.write_message",
"entities.Dealer.Dealer",
"console.ConsoleReader.ConsoleReader.read_bet",
"gameplay.GameStateHandler.Game... | [((730, 752), 'gameplay.GameStateHandler.GameStateHandler', 'GameStateHandler', (['self'], {}), '(self)\n', (746, 752), False, 'from gameplay.GameStateHandler import GameStateHandler\n'), ((776, 784), 'entities.Dealer.Dealer', 'Dealer', ([], {}), '()\n', (782, 784), False, 'from entities.Dealer import Dealer\n'), ((360... |
from runeatest import pysparkconnect
def add_testcase(name, issuccess, testdescription="", failurereason=""):
context = pysparkconnect.get_context()
return {
"test": name,
"issuccess": str(issuccess),
"description": str(testdescription),
"classname": (context["extraContext"]["n... | [
"runeatest.pysparkconnect.get_context"
] | [((126, 154), 'runeatest.pysparkconnect.get_context', 'pysparkconnect.get_context', ([], {}), '()\n', (152, 154), False, 'from runeatest import pysparkconnect\n')] |
import pandas as pd
import numpy as np
from pandas import DataFrame
from typing import Optional, Iterable, Tuple, List, Union
def get_sep(file_path: str) -> str:
"""Figure out the sep based on file name. Only helps with tsv and csv.
Args:
file_path: Path of file.
Returns: sep
"""
if fil... | [
"pandas.read_csv",
"numpy.nanquantile"
] | [((2164, 2221), 'pandas.read_csv', 'pd.read_csv', (['path'], {'sep': '"""\t"""', 'skiprows': '(2)', 'low_memory': '(False)'}), "(path, sep='\\t', skiprows=2, low_memory=False)\n", (2175, 2221), True, 'import pandas as pd\n'), ((5353, 5397), 'pandas.read_csv', 'pd.read_csv', (['file_path'], {'sep': 'sep', 'index_col': '... |
import os
import torch
import torchvision as tv
import torchvision.transforms as transforms
import torch.nn as nn
import torch.optim as optim
import argparse
import skimage.data
import skimage.io
import skimage.transform
import numpy as np
import matplotlib.pyplot as plt
# 定义是否使用GPU
device = torch.device... | [
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.show",
"torch.nn.ReLU",
"matplotlib.pyplot.imshow",
"numpy.asarray",
"torch.nn.Conv2d",
"torch.cuda.is_available",
"torch.nn.Linear",
"torch.nn.MaxPool2d",
"torchvision.transforms.ToTensor"
] | [((508, 529), 'torchvision.transforms.ToTensor', 'transforms.ToTensor', ([], {}), '()\n', (527, 529), True, 'import torchvision.transforms as transforms\n'), ((776, 794), 'numpy.asarray', 'np.asarray', (['img256'], {}), '(img256)\n', (786, 794), True, 'import numpy as np\n'), ((1972, 1985), 'matplotlib.pyplot.subplot',... |
# Copyright (c) 2015, MapR Technologies
#
# 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... | [
"sahara.plugins.mapr.services.yarn.yarn.YARNv251"
] | [((930, 945), 'sahara.plugins.mapr.services.yarn.yarn.YARNv251', 'yarn.YARNv251', ([], {}), '()\n', (943, 945), True, 'import sahara.plugins.mapr.services.yarn.yarn as yarn\n')] |
from __future__ import unicode_literals
from django.db import models
from phonenumber_field.modelfields import PhoneNumberField
class School(models.Model):
club = models.ForeignKey('clubs.Club', on_delete=models.CASCADE)
created = models.DateTimeField(auto_now_add=True)
updated = models.DateTimeField(aut... | [
"django.db.models.ForeignKey",
"django.db.models.DateTimeField",
"django.db.models.CharField",
"phonenumber_field.modelfields.PhoneNumberField"
] | [((170, 227), 'django.db.models.ForeignKey', 'models.ForeignKey', (['"""clubs.Club"""'], {'on_delete': 'models.CASCADE'}), "('clubs.Club', on_delete=models.CASCADE)\n", (187, 227), False, 'from django.db import models\n'), ((242, 281), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'auto_now_add': '(Tr... |
import numpy as np
import skfuzzy as fuzz
from skfuzzy import control as ctrl
class FcSiso:
"""
This class takes in `distance` as an input and returns `speed` as an output.
"""
def __init__(self):
# Declaire a domain of linguistic variables
self.distance = ctrl.Antecedent(np.arange(0... | [
"skfuzzy.control.ControlSystemSimulation",
"skfuzzy.trapmf",
"skfuzzy.control.Rule",
"numpy.arange",
"skfuzzy.control.ControlSystem"
] | [((615, 659), 'skfuzzy.trapmf', 'fuzz.trapmf', (['distance.universe', '[0, 0, 2, 6]'], {}), '(distance.universe, [0, 0, 2, 6])\n', (626, 659), True, 'import skfuzzy as fuzz\n'), ((688, 733), 'skfuzzy.trapmf', 'fuzz.trapmf', (['distance.universe', '[2, 6, 8, 12]'], {}), '(distance.universe, [2, 6, 8, 12])\n', (699, 733)... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Filename: whileLoop.py
# using: time
import time as t
class MyTimer():
def __init__(self):
self.unit = ['年','月','天','小时','分钟','秒']
self.prompt = "未开始计时!!"
self.lasted = []
self.begin = 0
self.end = 0
... | [
"time.localtime"
] | [((771, 784), 'time.localtime', 't.localtime', ([], {}), '()\n', (782, 784), True, 'import time as t\n'), ((1018, 1031), 'time.localtime', 't.localtime', ([], {}), '()\n', (1029, 1031), True, 'import time as t\n')] |
import json
import os
from PIL import Image
from io import BytesIO
import base64
import face_recognition as fr
import numpy as np
import cv2
# No warnings in production
import warnings
warnings.filterwarnings("ignore")
# Load model here
# model =
def handle(req):
"""handle a request to the function
Args:
... | [
"json.loads",
"warnings.filterwarnings",
"os.path.dirname",
"json.dumps",
"base64.b64decode",
"numpy.array",
"base64.b64encode",
"cv2.imencode",
"os.path.join"
] | [((187, 220), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (210, 220), False, 'import warnings\n'), ((509, 524), 'json.loads', 'json.loads', (['req'], {}), '(req)\n', (519, 524), False, 'import json\n'), ((942, 960), 'json.dumps', 'json.dumps', (['result'], {}), '(result... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2017 <NAME> <<EMAIL>>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.1',
's... | [
"re.split",
"os.makedirs",
"os.path.isdir",
"os.path.exists",
"ansible.module_utils.basic.AnsibleModule"
] | [((7441, 7504), 'ansible.module_utils.basic.AnsibleModule', 'AnsibleModule', ([], {'argument_spec': 'arg_spec', 'supports_check_mode': '(True)'}), '(argument_spec=arg_spec, supports_check_mode=True)\n', (7454, 7504), False, 'from ansible.module_utils.basic import AnsibleModule\n'), ((6750, 6775), 're.split', 're.split'... |
#!/usr/bin/env python
#
# Public Domain 2014-present MongoDB, Inc.
# Public Domain 2008-2014 WiredTiger, Inc.
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a com... | [
"sys.platform.startswith",
"csv.reader",
"optparse.OptionParser",
"logging.Formatter",
"platform.win32_ver",
"glob.glob",
"distutils.spawn.find_executable",
"os.path.join",
"threading.Thread.__init__",
"logging.FileHandler",
"threading.Condition",
"os.path.exists",
"win32com.shell.shell.SHGe... | [((5137, 5209), 'subprocess.Popen', 'subprocess.Popen', (['args'], {'stdout': 'subprocess.PIPE', 'stderr': 'subprocess.STDOUT'}), '(args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)\n', (5153, 5209), False, 'import os, sys, platform, signal, subprocess, threading, time\n'), ((5631, 5660), 'subprocess.check_output... |
# -*- coding: utf-8 -*-
# This repo is licensed under the Apache License, Version 2.0 (the "License")
#
# Copyright (c) 2014-2021 Megvii Inc. All rights reserved.
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT ... | [
"pickle.loads",
"megengine.save",
"boto3.client",
"collections.defaultdict",
"common.utils.save_dict_to_json",
"os.path.join",
"megengine.load",
"pickle.dumps"
] | [((1472, 1503), 'collections.defaultdict', 'defaultdict', (['utils.AverageMeter'], {}), '(utils.AverageMeter)\n', (1483, 1503), False, 'from collections import defaultdict\n'), ((1555, 1586), 'collections.defaultdict', 'defaultdict', (['utils.AverageMeter'], {}), '(utils.AverageMeter)\n', (1566, 1586), False, 'from col... |
from django.conf.urls.defaults import patterns, include, url
from django.conf import settings
from django.contrib import admin
from courses.api import CourseResource, UserResource, PageResource, EnrollmentResource
from courses.views import CourseList
from tastypie.api import Api
from accounts import views as accounts_v... | [
"django.contrib.admin.autodiscover",
"settings.base.settings_check.check_settings",
"courses.api.UserResource",
"courses.api.CourseResource",
"courses.api.PageResource",
"django.conf.urls.defaults.url",
"django.conf.urls.defaults.include",
"tastypie.api.Api",
"courses.views.CourseList.as_view",
"c... | [((672, 688), 'settings.base.settings_check.check_settings', 'check_settings', ([], {}), '()\n', (686, 688), False, 'from settings.base.settings_check import check_settings\n'), ((690, 710), 'django.contrib.admin.autodiscover', 'admin.autodiscover', ([], {}), '()\n', (708, 710), False, 'from django.contrib import admin... |
r"""
Sensitivity Analysis
====================
Quantifying the sensitivity of a model output :math:`f` to the model parameters :math:`\rv` can be an important component of any modeling exercise. This section demonstrates how to use popular local and global sensitivity analysis.
Sobol Indices
-------------
Any function... | [
"matplotlib.pyplot.show",
"pyapprox.approximate.approximate",
"pyapprox.plot_interaction_values",
"pyapprox.analyze_sensitivity_polynomial_chaos",
"pyapprox.benchmarks.benchmarks.setup_benchmark",
"pyapprox.plot_total_effects",
"pyapprox.plot_main_effects",
"matplotlib.pyplot.subplots",
"pyapprox.ge... | [((3403, 3442), 'pyapprox.benchmarks.benchmarks.setup_benchmark', 'setup_benchmark', (['"""ishigami"""'], {'a': '(7)', 'b': '(0.1)'}), "('ishigami', a=7, b=0.1)\n", (3418, 3442), False, 'from pyapprox.benchmarks.benchmarks import setup_benchmark\n'), ((3479, 3551), 'pyapprox.generate_independent_random_samples', 'pya.g... |
import time
from functools import partial
import numpy as np
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras.callbacks import (EarlyStopping, ReduceLROnPlateau,
TensorBoard)
from tensorflow.keras.optimizers import Adam
from tqdm import tqdm
... | [
"nets.ssd.SSD300",
"functools.partial",
"tqdm.tqdm",
"numpy.random.seed",
"tensorflow.convert_to_tensor",
"utils.anchors.get_anchors",
"utils.utils.BBoxUtility",
"tensorflow.config.experimental.set_memory_growth",
"tensorflow.keras.optimizers.schedules.ExponentialDecay",
"tensorflow.keras.optimize... | [((3264, 3327), 'tensorflow.config.experimental.list_physical_devices', 'tf.config.experimental.list_physical_devices', ([], {'device_type': '"""GPU"""'}), "(device_type='GPU')\n", (3308, 3327), True, 'import tensorflow as tf\n'), ((3351, 3402), 'tensorflow.config.experimental.set_memory_growth', 'tf.config.experimenta... |
from __future__ import absolute_import, unicode_literals
from django.utils.translation import ugettext_lazy as _
from mayan.apps.events.classes import EventTypeNamespace
namespace = EventTypeNamespace(
label=_('Web links'), name='linking'
)
event_web_link_created = namespace.add_event_type(
label=_('Web lin... | [
"django.utils.translation.ugettext_lazy"
] | [((215, 229), 'django.utils.translation.ugettext_lazy', '_', (['"""Web links"""'], {}), "('Web links')\n", (216, 229), True, 'from django.utils.translation import ugettext_lazy as _\n'), ((310, 331), 'django.utils.translation.ugettext_lazy', '_', (['"""Web link created"""'], {}), "('Web link created')\n", (311, 331), T... |
# Dependencies
import pandas as pd
import numpy as np
from datetime import datetime
from dateutil.parser import *
import json
import requests
from pprint import pprint
from config import driver, username, password, host, port, database
from sqlalchemy import create_engine
from time import ctime
from sqlalchemy.ext.auto... | [
"pandas.DataFrame",
"time.ctime",
"sqlalchemy.orm.Session",
"pandas.read_sql_table",
"pandas.to_datetime",
"requests.get",
"sqlalchemy.create_engine",
"sqlalchemy.ext.automap.automap_base"
] | [((569, 601), 'sqlalchemy.create_engine', 'create_engine', (['connection_string'], {}), '(connection_string)\n', (582, 601), False, 'from sqlalchemy import create_engine, func\n'), ((666, 680), 'sqlalchemy.ext.automap.automap_base', 'automap_base', ([], {}), '()\n', (678, 680), False, 'from sqlalchemy.ext.automap impor... |
from __future__ import division
from math import sqrt, pi
beta = 1. # inverse T
# Local
U = 6. # Hubbard U
eps = 1. # Local energy measured from eps_0 = -U/2 (eps = 0 <=> half-filling)
# Bath
D = 4. # half-bandwidth
t = D / 2. # Bethe hopping
Gamma = 1. # impurity-bath coupling
# Discrete bath
N = 4 # number ... | [
"math.sqrt"
] | [((434, 462), 'math.sqrt', 'sqrt', (['(2 * D * Gamma / pi / N)'], {}), '(2 * D * Gamma / pi / N)\n', (438, 462), False, 'from math import sqrt, pi\n'), ((785, 807), 'math.sqrt', 'sqrt', (['(1 - (x / D) ** 2)'], {}), '(1 - (x / D) ** 2)\n', (789, 807), False, 'from math import sqrt, pi\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
MONGO_HOST = os.environ.get('MONGO_HOST', 'localhost')
MONGO_PORT = int(os.environ.get('MONGO_PORT', 27017))
MONGO_USERNAME = os.environ.get('MONGO_USERNAME', '')
MONGO_PASSWORD = os.environ.get('MONGO_PASSWORD', '')
MONGO_DBNAME = os.environ.get('MONGO_DBNAME',... | [
"os.environ.get"
] | [((71, 112), 'os.environ.get', 'os.environ.get', (['"""MONGO_HOST"""', '"""localhost"""'], {}), "('MONGO_HOST', 'localhost')\n", (85, 112), False, 'import os\n'), ((184, 220), 'os.environ.get', 'os.environ.get', (['"""MONGO_USERNAME"""', '""""""'], {}), "('MONGO_USERNAME', '')\n", (198, 220), False, 'import os\n'), ((2... |
import os
import re
import git
from popper.cli import log
def init_repo_object():
"""Function to initialize the global repo
object before every scm utility functions."""
repo = None
try:
repo = git.Repo(search_parent_directories=True)
except git.exc.InvalidGitRepositoryError:
# O... | [
"popper.cli.log.debug",
"os.path.basename",
"os.getcwd",
"os.path.dirname",
"os.path.exists",
"git.Repo",
"git.Repo.clone_from",
"popper.cli.log.fail",
"re.compile"
] | [((1640, 1661), 'os.path.basename', 'os.path.basename', (['url'], {}), '(url)\n', (1656, 1661), False, 'import os\n'), ((4978, 5002), 'os.path.exists', 'os.path.exists', (['repo_dir'], {}), '(repo_dir)\n', (4992, 5002), False, 'import os\n'), ((6094, 6237), 're.compile', 're.compile', (['"""^(http://|https://|git@)?(?:... |
from django.db import models
from django.conf import settings
class Services(models.Model):
user_id = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
service_name = models.CharField(max_length=250)
service_type = models.CharField(max_length=250) | [
"django.db.models.ForeignKey",
"django.db.models.CharField"
] | [((108, 177), 'django.db.models.ForeignKey', 'models.ForeignKey', (['settings.AUTH_USER_MODEL'], {'on_delete': 'models.CASCADE'}), '(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)\n', (125, 177), False, 'from django.db import models\n'), ((197, 229), 'django.db.models.CharField', 'models.CharField', ([], {'max_len... |
import datetime
def convert_to_datetime(t):
return datetime.datetime(t.year, t.month, t.day, t.hour)
| [
"datetime.datetime"
] | [((58, 107), 'datetime.datetime', 'datetime.datetime', (['t.year', 't.month', 't.day', 't.hour'], {}), '(t.year, t.month, t.day, t.hour)\n', (75, 107), False, 'import datetime\n')] |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from dataclasses import dataclass
from omegaconf import MISSING, DictConfig
import hydra
from hydra.core.config_store import ConfigStore
@dataclass
class TestConfig:
param: int = MISSING
config_store = ConfigStore.instance()
config_store.s... | [
"hydra.core.config_store.ConfigStore.instance",
"hydra.main"
] | [((283, 305), 'hydra.core.config_store.ConfigStore.instance', 'ConfigStore.instance', ([], {}), '()\n', (303, 305), False, 'from hydra.core.config_store import ConfigStore\n'), ((375, 443), 'hydra.main', 'hydra.main', ([], {'version_base': 'None', 'config_path': '"""."""', 'config_name': '"""config"""'}), "(version_bas... |
import unittest
import torch
from pyronear import nn
# Based on https://github.com/pytorch/pytorch/blob/master/test/test_nn.py
class NNTester(unittest.TestCase):
def test_adaptive_pooling_input_size(self):
for numel in (2,):
for pool_type in ('Concat',):
cls_name = 'Adaptive{... | [
"unittest.main",
"torch.randn"
] | [((1080, 1095), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1093, 1095), False, 'import unittest\n'), ((479, 503), 'torch.randn', 'torch.randn', (['output_size'], {}), '(output_size)\n', (490, 503), False, 'import torch\n'), ((898, 929), 'torch.randn', 'torch.randn', (['((4,) * (numel + 1))'], {}), '((4,) * (n... |
#!/usr/bin/env python
import sys
import json
import traceback
import backoff
from datetime import datetime
from celery import uuid
from hysds.celery import app
from hysds.es_util import get_mozart_es
from hysds.orchestrator import run_job
from hysds.log_utils import log_job_status
from utils import revoke
STATUS_AL... | [
"json.load",
"hysds.log_utils.log_job_status",
"hysds.orchestrator.run_job.apply_async",
"celery.uuid",
"backoff.on_exception",
"datetime.datetime.utcnow",
"hysds.celery.app.AsyncResult",
"traceback.format_exc",
"hysds.es_util.get_mozart_es",
"utils.revoke"
] | [((363, 378), 'hysds.es_util.get_mozart_es', 'get_mozart_es', ([], {}), '()\n', (376, 378), False, 'from hysds.es_util import get_mozart_es\n'), ((492, 565), 'backoff.on_exception', 'backoff.on_exception', (['backoff.expo', 'Exception'], {'max_tries': '(10)', 'max_value': '(64)'}), '(backoff.expo, Exception, max_tries=... |
#!/usr/bin/python3
# coding=utf-8
import os
from pathlib import Path
import logging
from logging.config import dictConfig
DIR_BASE = Path(os.path.dirname(os.path.realpath(__file__))).parent
DIR_RESOURCES = DIR_BASE / 'resources'
DIR_ASSETS = DIR_RESOURCES / 'assets'
DIR_MODELS = DIR_RESOURCES / 'models'
FILE_LOGGING... | [
"pathlib.Path",
"os.path.realpath",
"logging.getLogger"
] | [((323, 349), 'pathlib.Path', 'Path', (['"""/tmp/naix/naix.log"""'], {}), "('/tmp/naix/naix.log')\n", (327, 349), False, 'from pathlib import Path\n'), ((1258, 1285), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1275, 1285), False, 'import logging\n'), ((156, 182), 'os.path.realpath', ... |
# ========================================================================|
# 导入一些必要的包 ==> 初始化环境
from AIDetector_pytorch import Detector
import imutils
import time
from utils_leon import *
import os
# ========================================================================|
class Leon_detect():
def __init__(self):... | [
"os.getcwd",
"time.time",
"AIDetector_pytorch.Detector",
"imutils.resize",
"os.path.join"
] | [((12806, 12817), 'time.time', 'time.time', ([], {}), '()\n', (12815, 12817), False, 'import time\n'), ((713, 724), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (722, 724), False, 'import os\n'), ((2215, 2251), 'os.path.join', 'os.path.join', (['self.root', '"""train.csv"""'], {}), "(self.root, 'train.csv')\n", (2227, 2... |
# -*- coding: utf-8 -*-
"""
General input/output helpers
"""
import pickle
import json
from typing import Any, TypeVar
__author__ = "<NAME>"
__version__ = "0.1.0"
__license__ = "MIT"
class FileUtil:
"""
Class of file manipulation utilities
"""
FileObj = TypeVar('FileObj', str, bytes, bytearray)
... | [
"pickle.dump",
"json.loads",
"json.dumps",
"pickle.load",
"typing.TypeVar"
] | [((275, 316), 'typing.TypeVar', 'TypeVar', (['"""FileObj"""', 'str', 'bytes', 'bytearray'], {}), "('FileObj', str, bytes, bytearray)\n", (282, 316), False, 'from typing import Any, TypeVar\n'), ((1828, 1847), 'json.loads', 'json.loads', (['str_val'], {}), '(str_val)\n', (1838, 1847), False, 'import json\n'), ((2039, 20... |
# Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.
#
# 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 us... | [
"random.sample",
"numpy.mean"
] | [((1521, 1559), 'random.sample', 'random.sample', (['self.memory', 'batch_size'], {}), '(self.memory, batch_size)\n', (1534, 1559), False, 'import random\n'), ((2235, 2266), 'numpy.mean', 'np.mean', (['self.buffer[direction]'], {}), '(self.buffer[direction])\n', (2242, 2266), True, 'import numpy as np\n'), ((3175, 3195... |
# 从数据库查询数据 并且传给模板
import flask
from flask import render_template, url_for, redirect, request, make_response, session
from sqlalchemy import and_
from sqlalchemy.orm import sessionmaker
from models.models import engine, User
from . import index_blu
# LOGIN_FLAG = False # 标记是否登录 默认没有登录
@index_blu.route('/profile_v... | [
"flask.request.form.get",
"sqlalchemy.and_",
"flask.session.get",
"flask.session.query",
"flask.url_for",
"flask.render_template",
"flask.make_response",
"sqlalchemy.orm.sessionmaker",
"flask.session.close",
"flask.session.clear"
] | [((566, 605), 'flask.session.get', 'flask.session.get', (['"""login_flag"""', '"""fail"""'], {}), "('login_flag', 'fail')\n", (583, 605), False, 'import flask\n'), ((1343, 1378), 'flask.render_template', 'render_template', (['"""index/login.html"""'], {}), "('index/login.html')\n", (1358, 1378), False, 'from flask impo... |
"""Logic for creating function signatures."""
import functools
import inspect
from collections import namedtuple
from pysignature.exceptions import (
BadTypeSpecError, TypeAssertionError,
FunctionTypeCheckError
)
import pysignature.types as t
class Signature(object):
"""Encapsulate the logic of handling
... | [
"pysignature.exceptions.BadTypeSpecError",
"inspect.getcallargs",
"inspect.getargspec",
"collections.namedtuple",
"functools.wraps",
"pysignature.exceptions.FunctionTypeCheckError",
"pysignature.types.assert_type"
] | [((3175, 3224), 'collections.namedtuple', 'namedtuple', (['"""TypeArgumentError"""', "['arg', 'error']"], {}), "('TypeArgumentError', ['arg', 'error'])\n", (3185, 3224), False, 'from collections import namedtuple\n'), ((557, 579), 'inspect.getargspec', 'inspect.getargspec', (['fn'], {}), '(fn)\n', (575, 579), False, 'i... |
import pytest
from stai.util.generator_tools import list_to_batches
def test_empty_lists():
# An empty list should return an empty iterator and skip the loop's body.
for _, _ in list_to_batches([], 1):
assert False
def test_valid():
for k in range(1, 10):
test_list = [x for x in range(0,... | [
"stai.util.generator_tools.list_to_batches",
"pytest.raises"
] | [((188, 210), 'stai.util.generator_tools.list_to_batches', 'list_to_batches', (['[]', '(1)'], {}), '([], 1)\n', (203, 210), False, 'from stai.util.generator_tools import list_to_batches\n'), ((827, 852), 'pytest.raises', 'pytest.raises', (['ValueError'], {}), '(ValueError)\n', (840, 852), False, 'import pytest\n'), ((8... |
class detect_screen_size():
def detect_os(self):
import platform
os_name = platform.system()
return os_name
def detect_screen_siz(self):
import tkinter as tk
root = tk.Tk()
screen_width = root.winfo_screenwidth()
screen_height = root.winfo_screenheight()... | [
"platform.system",
"tkinter.Tk"
] | [((95, 112), 'platform.system', 'platform.system', ([], {}), '()\n', (110, 112), False, 'import platform\n'), ((215, 222), 'tkinter.Tk', 'tk.Tk', ([], {}), '()\n', (220, 222), True, 'import tkinter as tk\n')] |
from cpg.matsuoka_joint import MatsuokaJoint
import numpy as np
import copy
class BioloidNetwork:
""" Generic algorithm to simulate a bioloid network, more specifically in CPG applications """
def __init__(self, weights, simulation_time, simulation_type):
"""
:param weights: square matrix (np.n... | [
"copy.deepcopy",
"numpy.zeros",
"numpy.ones",
"numpy.random.rand",
"cpg.matsuoka_joint.MatsuokaJoint"
] | [((1098, 1141), 'numpy.zeros', 'np.zeros', (['[self.simulation_time, self.size]'], {}), '([self.simulation_time, self.size])\n', (1106, 1141), True, 'import numpy as np\n'), ((782, 807), 'numpy.random.rand', 'np.random.rand', (['self.size'], {}), '(self.size)\n', (796, 807), True, 'import numpy as np\n'), ((930, 948), ... |
import numpy as np
import pandas as pd
def f(group):
return group[group.y == 'yes']['y'].count()
# 1 - Dataset upload
df = pd.read_csv('dataset/bank_dataset.csv', sep=';')
print('-- Size before clean --')
print(f'Row: {df.shape[0]}')
print(f'Column: {df.shape[1]}', end='\n\n')
# 2 - Clean NaN values
df_clean =... | [
"pandas.read_csv",
"pandas.get_dummies",
"numpy.max",
"numpy.mean",
"numpy.min"
] | [((131, 179), 'pandas.read_csv', 'pd.read_csv', (['"""dataset/bank_dataset.csv"""'], {'sep': '""";"""'}), "('dataset/bank_dataset.csv', sep=';')\n", (142, 179), True, 'import pandas as pd\n'), ((723, 746), 'numpy.mean', 'np.mean', (["df_last['age']"], {}), "(df_last['age'])\n", (730, 746), True, 'import numpy as np\n')... |
#!/usr/bin/python3
import simplefft
from server import Server
import argparse
import logging
defaults = {
'host': 'localhost',
'port': 9002
}
def main(args):
server = Server(args.host, args.port, simplefft.process)
server.serve()
if __name__ == '__main__':
logging.basicConfig(format='%(asct... | [
"logging.root.setLevel",
"server.Server",
"argparse.ArgumentParser",
"logging.basicConfig"
] | [((185, 232), 'server.Server', 'Server', (['args.host', 'args.port', 'simplefft.process'], {}), '(args.host, args.port, simplefft.process)\n', (191, 232), False, 'from server import Server\n'), ((286, 364), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s - %(message)s"""', 'level': 'loggin... |
'''
Get windows_ip:wsl_ip
'''
import socket
import re
with open("/etc/resolv.conf") as f:
match = re.search("^nameserver +(?P<win_ip>[0-9.]+)$", f.read(), re.MULTILINE)
if match:
win_ip = match.group("win_ip")
else:
raise Exception("Can't find windows ip in resolv.conf")
s = socket.socket... | [
"socket.socket"
] | [((307, 355), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_DGRAM'], {}), '(socket.AF_INET, socket.SOCK_DGRAM)\n', (320, 355), False, 'import socket\n')] |
from rest_framework import serializers
from sluggen.models import Slug
from sluggen.utils import generate_new_slug
class SlugListSerializer(serializers.ModelSerializer):
class Meta:
model = Slug
fields = '__all__'
class SlugCreateSerializer(serializers.ModelSerializer):
class Meta:
m... | [
"sluggen.utils.generate_new_slug",
"sluggen.models.Slug.objects.create"
] | [((447, 467), 'sluggen.utils.generate_new_slug', 'generate_new_slug', (['(3)'], {}), '(3)\n', (464, 467), False, 'from sluggen.utils import generate_new_slug\n'), ((483, 522), 'sluggen.models.Slug.objects.create', 'Slug.objects.create', ([], {'url': 'url', 'slug': 'slug'}), '(url=url, slug=slug)\n', (502, 522), False, ... |
import itertools
import re
class Moon:
def __init__(self, x, y, z):
self.x = x
self.y = y
self.z = z
self.dx = 0
self.dy = 0
self.dz = 0
def gravity_step(self, other):
for axis in 'xyz':
if getattr(other, axis) > getattr(self, axis):
... | [
"itertools.combinations",
"re.match"
] | [((964, 996), 'itertools.combinations', 'itertools.combinations', (['moons', '(2)'], {}), '(moons, 2)\n', (986, 996), False, 'import itertools\n'), ((1249, 1312), 're.match', 're.match', (['"""<x=([-+]?\\\\d+), y=([-+]?\\\\d+), z=([-+]?\\\\d+)>"""', 'moon'], {}), "('<x=([-+]?\\\\d+), y=([-+]?\\\\d+), z=([-+]?\\\\d+)>',... |
#! /usr/bin/python3
#
# Copyright (c) 2017 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0
#
#
# FIXME:
#
# - command line method to discover installed capabiltiies; print
# each's __doc__
"""
Core Provisioning OS functionality
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This module provides tools to image devices... | [
"pprint.pformat",
"commonl.yamll.parse_verify",
"commonl.ttbd_locate_helper",
"collections.defaultdict",
"commonl.yamll.load",
"json.loads",
"os.path.dirname",
"socket.gethostbyname",
"traceback.format_exc",
"operator.itemgetter",
"inspect.getsourcefile",
"Levenshtein.seqratio",
"os.path.bas... | [((8226, 8258), 'random.choice', 'random.choice', (['subversion_images'], {}), '(subversion_images)\n', (8239, 8258), False, 'import random\n'), ((8901, 8932), 'os.path.basename', 'os.path.basename', (['root_part_dev'], {}), '(root_part_dev)\n', (8917, 8932), False, 'import os\n'), ((21962, 22064), 'commonl.ttbd_locate... |
# -*- coding: utf-8 -*-
"""
This module implements:
1. particle history classes, which store the full or partial history
of a SMC algorithm.
2. off-line smoothing algorithms as methods of these classes.
For on-line smoothing, see instead the `collectors` module.
History classes
===============
A `SMC` object ... | [
"numpy.sum",
"particles.resampling.MultinomialQueue",
"numpy.empty",
"particles.resampling.multinomial_once",
"particles.SQMC",
"particles.hilbert.hilbert_sort",
"numpy.arange",
"numpy.mean",
"collections.deque",
"numpy.std",
"numpy.logical_not",
"particles.qmc.sobol",
"numpy.cumsum",
"par... | [((19508, 19523), 'numpy.zeros', 'np.zeros', (['(T - 1)'], {}), '(T - 1)\n', (19516, 19523), True, 'import numpy as np\n'), ((19690, 19709), 'time.perf_counter', 'time.perf_counter', ([], {}), '()\n', (19707, 19709), False, 'import time\n'), ((5962, 5979), 'collections.deque', 'deque', (['[]', 'length'], {}), '([], len... |
#
# Pyserini: Reproducible IR research with sparse and dense representations
#
# 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... | [
"threading.Lock"
] | [((736, 752), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (750, 752), False, 'import threading\n')] |
#!/usr/bin/env python3
import gym
import ptan
import ptan.ignite as ptan_ignite
from datetime import datetime, timedelta
import argparse
import collections
import warnings
from typing import List, Tuple
import torch
import torch.optim as optim
import torch.multiprocessing as mp
from ignite.engine import Engine
from i... | [
"ptan.ignite.PeriodicEvents",
"argparse.ArgumentParser",
"ptan.experience.ExperienceReplayBuffer",
"torch.device",
"lib.common.calc_loss_dqn",
"ptan.experience.ExperienceSourceFirstLast",
"lib.common.EpsilonTracker",
"ignite.metrics.RunningAverage",
"warnings.simplefilter",
"datetime.timedelta",
... | [((511, 597), 'collections.namedtuple', 'collections.namedtuple', (['"""EpisodeEnded"""'], {'field_names': "('reward', 'steps', 'epsilon')"}), "('EpisodeEnded', field_names=('reward', 'steps',\n 'epsilon'))\n", (533, 597), False, 'import collections\n'), ((656, 681), 'gym.make', 'gym.make', (['params.env_name'], {})... |
"""
Test run/step/stop aspects of a simple workflow.
"""
import os
import unittest
from openmdao.examples.mdao.sellar_MDF import SellarMDF
from openmdao.examples.mdao.sellar_IDF import SellarIDF
from openmdao.examples.mdao.sellar_CO import SellarCO
from openmdao.examples.mdao.sellar_BLISS import SellarBLISS
from ope... | [
"openmdao.examples.mdao.sellar_MDF.SellarMDF",
"sys.argv.append",
"openmdao.main.api.set_as_top",
"openmdao.lib.datatypes.api.Float",
"nose.runmodule",
"openmdao.util.testutil.assert_rel_error",
"openmdao.examples.mdao.sellar_CO.SellarCO",
"openmdao.examples.mdao.sellar_BLISS.SellarBLISS",
"openmdao... | [((776, 829), 'openmdao.lib.datatypes.api.Float', 'Float', (['(0.0)'], {'iotype': '"""in"""', 'desc': '"""Disciplinary Coupling"""'}), "(0.0, iotype='in', desc='Disciplinary Coupling')\n", (781, 829), False, 'from openmdao.lib.datatypes.api import Float\n'), ((843, 896), 'openmdao.lib.datatypes.api.Float', 'Float', ([]... |
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import annotations
import logging
from pants.backend.python.goals.lockfile import GeneratePythonLockfile
from pants.backend.python.subsystems.setup import PythonSetup
fro... | [
"pants.engine.target.TransitiveTargetsRequest",
"pants.backend.python.util_rules.interpreter_constraints.InterpreterConstraints",
"logging.getLogger",
"pants.engine.rules.collect_rules"
] | [((934, 961), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (951, 961), False, 'import logging\n'), ((3710, 3725), 'pants.engine.rules.collect_rules', 'collect_rules', ([], {}), '()\n', (3723, 3725), False, 'from pants.engine.rules import Get, collect_rules, goal_rule\n'), ((1986, 2021),... |
import argparse
import json
import torch
from transformers import BertTokenizer, BertForMaskedLM, XLMRobertaTokenizer, XLMRobertaModel
from utils import clean_sentence, tokenize, locate_reference, list_positions, get_nltk_detokenizer, format_attention
MODEL_CLASSES = {
'bert-base-multilingual-uncased': (BertToke... | [
"argparse.ArgumentParser",
"torch.stack",
"json.loads",
"utils.get_nltk_detokenizer",
"utils.locate_reference",
"torch.max",
"utils.format_attention",
"torch.cuda.is_available",
"utils.list_positions",
"torch.zeros",
"utils.clean_sentence",
"utils.tokenize"
] | [((474, 488), 'torch.stack', 'torch.stack', (['A'], {}), '(A)\n', (485, 488), False, 'import torch\n'), ((551, 570), 'torch.max', 'torch.max', (['A'], {'dim': '(0)'}), '(A, dim=0)\n', (560, 570), False, 'import torch\n'), ((1017, 1044), 'utils.format_attention', 'format_attention', (['attention'], {}), '(attention)\n',... |
from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton
from pyrogram import Client, filters
from utils import USERNAME, mp
from config import Config
U=USERNAME
CHAT=Config.CHAT
msg=Config.msg
HOME_TEXT = "<b>Helo, [{}](tg://user?id={})\n\nIam VCPvtBot 2.0 which plays music in Channels and Groups 24*7.\n\... | [
"pyrogram.types.InlineKeyboardButton",
"pyrogram.types.InlineKeyboardMarkup",
"utils.mp.delete",
"pyrogram.filters.command"
] | [((2099, 2128), 'pyrogram.types.InlineKeyboardMarkup', 'InlineKeyboardMarkup', (['buttons'], {}), '(buttons)\n', (2119, 2128), False, 'from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton\n'), ((1531, 1571), 'pyrogram.filters.command', 'filters.command', (["['start', f'start@{U}']"], {}), "(['start', f... |
from typing import Dict, List, Tuple, Union
import re
import logging
from lib.modernisation.regex_rules import RegexRules
from lib.modernisation.syllable_corrector import SyllableCorrector
LOGGER = logging.getLogger(__name__)
class Modernisation:
"""
Class responsible for translating historical Dutch into ... | [
"lib.modernisation.regex_rules.RegexRules",
"lib.modernisation.syllable_corrector.SyllableCorrector",
"logging.getLogger",
"re.compile"
] | [((201, 228), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (218, 228), False, 'import logging\n'), ((943, 955), 'lib.modernisation.regex_rules.RegexRules', 'RegexRules', ([], {}), '()\n', (953, 955), False, 'from lib.modernisation.regex_rules import RegexRules\n'), ((990, 1009), 'lib.mo... |
from contextlib import contextmanager
from distutils.version import LooseVersion
from itertools import groupby
import logging
from typing import Dict
from typing import List
from typing import Optional
from typing import Tuple
from typing import Union
import numpy
import torch
from typeguard import check_argument_type... | [
"espnet2.torch_utils.device_funcs.force_gatherable",
"torch.topk",
"distutils.version.LooseVersion",
"espnet.nets.e2e_asr_common.ErrorCalculator",
"typeguard.check_argument_types",
"torch.nonzero",
"espnet.nets.pytorch_backend.maskctc.add_mask_token.mask_uniform",
"numpy.array",
"espnet.nets.beam_se... | [((1298, 1329), 'distutils.version.LooseVersion', 'LooseVersion', (['torch.__version__'], {}), '(torch.__version__)\n', (1310, 1329), False, 'from distutils.version import LooseVersion\n'), ((1333, 1354), 'distutils.version.LooseVersion', 'LooseVersion', (['"""1.6.0"""'], {}), "('1.6.0')\n", (1345, 1354), False, 'from ... |
import time
from copy import deepcopy
from functools import partial
from multiprocessing import Pool, cpu_count
import fire
import numpy as np
import pandas as pd
from neuralforecast.losses.numpy import mape
from prophet import Prophet
from sklearn.model_selection import ParameterGrid
from src.data import get_data
p... | [
"pandas.DataFrame",
"functools.partial",
"src.data.get_data",
"pandas.date_range",
"fire.Fire",
"neuralforecast.losses.numpy.mape",
"numpy.argmin",
"time.time",
"prophet.Prophet",
"sklearn.model_selection.ParameterGrid",
"pandas.concat",
"multiprocessing.cpu_count"
] | [((556, 582), 'sklearn.model_selection.ParameterGrid', 'ParameterGrid', (['params_grid'], {}), '(params_grid)\n', (569, 582), False, 'from sklearn.model_selection import ParameterGrid\n'), ((695, 760), 'pandas.date_range', 'pd.date_range', ([], {'start': '"""1970-01-01"""', 'periods': 'ts.shape[0]', 'freq': 'freq'}), "... |
import numpy as np
import pandas as pd
from keras.models import Model
from keras.layers import Input, Dense, Embedding, SpatialDropout1D, Dropout, add, concatenate
from keras.layers import CuDNNLSTM, Bidirectional, GlobalMaxPooling1D, GlobalAveragePooling1D
from keras.preprocessing import text, sequence
from keras.call... | [
"pickle.dump",
"pandas.read_csv",
"keras.preprocessing.sequence.pad_sequences",
"keras.models.Model",
"gc.collect",
"pickle.load",
"keras.callbacks.LearningRateScheduler",
"keras.layers.Input",
"keras.backend.reshape",
"keras.preprocessing.text.Tokenizer",
"keras.layers.GlobalMaxPooling1D",
"n... | [((2720, 2808), 'pandas.read_csv', 'pd.read_csv', (['"""../input/jigsaw-unintended-bias-in-toxicity-classification/train.csv"""'], {}), "(\n '../input/jigsaw-unintended-bias-in-toxicity-classification/train.csv')\n", (2731, 2808), True, 'import pandas as pd\n'), ((2811, 2898), 'pandas.read_csv', 'pd.read_csv', (['""... |
import time
from pprint import pprint
N, S1, S2, S3 = 25, 6, 7, 10
S1 = S1 % N
S2 = S2 % N
S3 = S3 % N
if all([S1, S2, S3]) == 0:
assert "Error!"
print("Error!")
exit(-1)
N1 = 1
min_coeffs = tuple()
all_coeffs = list()
print(f'Circulant C({N}; {S1}, {S2}, {S3}).')
start_time = time.time()
for N2 in rang... | [
"time.time"
] | [((294, 305), 'time.time', 'time.time', ([], {}), '()\n', (303, 305), False, 'import time\n')] |
import socket
def main():
#1.创建服务端套接字
lis_ser_socket = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
#2.绑定监听端口
lis_ser_socket.bind(("",4546))
#3.套接字变被动连接
lis_ser_socket.listen(128)
print("------1--------")
while True:
print("等待下一个客户的接入:")
#4.等待客户连接
... | [
"socket.socket"
] | [((69, 118), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (82, 118), False, 'import socket\n')] |
# 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
# distributed under th... | [
"inspect.isclass",
"orquesta.utils.expression.format_error",
"orquesta.utils.strings.unescape",
"re.match",
"json.dumps",
"orquesta.exceptions.WorkflowInspectionError",
"orquesta.exceptions.SchemaDefinitionError",
"yaml.safe_load",
"re.findall",
"orquesta.utils.schema.merge_schema",
"orquesta.ut... | [((990, 1017), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1007, 1017), False, 'import logging\n'), ((1050, 1072), 'inspect.isclass', 'inspect.isclass', (['value'], {}), '(value)\n', (1065, 1072), False, 'import inspect\n'), ((4130, 4159), 'six.iteritems', 'six.iteritems', (['property... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
import cv2
import numpy as np
import chumpy as ch
from chumpy import Ch, depends_on
from chumpy.utils import col
from opendr.geometry import Rodrigues
class OrthoProjectPoints(Ch):
terms = 'near', 'far', 'width', 'height'
dterms = 'v', 'rt', 't', 'left', 'right'... | [
"cv2.Rodrigues",
"opendr.geometry.Rodrigues",
"chumpy.utils.col",
"chumpy.depends_on"
] | [((616, 637), 'chumpy.depends_on', 'depends_on', (['"""t"""', '"""rt"""'], {}), "('t', 'rt')\n", (626, 637), False, 'from chumpy import Ch, depends_on\n'), ((674, 698), 'cv2.Rodrigues', 'cv2.Rodrigues', (['self.rt.r'], {}), '(self.rt.r)\n', (687, 698), False, 'import cv2\n'), ((731, 744), 'chumpy.utils.col', 'col', (['... |
import sqlite3
import datetime
class Reader:
_sqlite_db = 'subway_status.db'
def _query_dbase(self, q, a = ''):
connection = sqlite3.connect(self._sqlite_db)
cursor = connection.cursor()
cursor.execute(q, a)
result = cursor.fetchall()
connection.close()
retu... | [
"sqlite3.connect",
"datetime.datetime.fromtimestamp"
] | [((147, 179), 'sqlite3.connect', 'sqlite3.connect', (['self._sqlite_db'], {}), '(self._sqlite_db)\n', (162, 179), False, 'import sqlite3\n'), ((1273, 1312), 'datetime.datetime.fromtimestamp', 'datetime.datetime.fromtimestamp', (['row[0]'], {}), '(row[0])\n', (1304, 1312), False, 'import datetime\n')] |
import diffgram
from diffgram.pytorch_diffgram.diffgram_pytorch_dataset import DiffgramPytorchDataset
project = diffgram.Project(project_string_id = "voc-test",
client_id = "LIVE__p0blrrm6p5fnan5sh8ec",
client_secret = "<KEY>",
debug = True)
file = project.file.ge... | [
"matplotlib.pyplot.subplot",
"PIL.Image.new",
"matplotlib.pyplot.show",
"matplotlib.pyplot.imshow",
"diffgram.pytorch_diffgram.diffgram_pytorch_dataset.DiffgramPytorchDataset",
"matplotlib.pyplot.figure",
"diffgram.Project"
] | [((113, 239), 'diffgram.Project', 'diffgram.Project', ([], {'project_string_id': '"""voc-test"""', 'client_id': '"""LIVE__p0blrrm6p5fnan5sh8ec"""', 'client_secret': '"""<KEY>"""', 'debug': '(True)'}), "(project_string_id='voc-test', client_id=\n 'LIVE__p0blrrm6p5fnan5sh8ec', client_secret='<KEY>', debug=True)\n", (1... |
# Copyright (c) Microsoft. All rights reserved.
from enum import Enum
from sklearn.metrics import matthews_corrcoef
from sklearn.metrics import accuracy_score, f1_score
from sklearn.metrics import roc_auc_score
from scipy.stats import pearsonr, spearmanr
from seqeval.metrics import classification_report
from data_util... | [
"seqeval.metrics.classification_report",
"data_utils.squad_eval.evaluate_func",
"sklearn.metrics.accuracy_score",
"scipy.stats.spearmanr",
"scipy.stats.pearsonr",
"sklearn.metrics.roc_auc_score",
"sklearn.metrics.f1_score",
"sklearn.metrics.matthews_corrcoef"
] | [((872, 903), 'sklearn.metrics.roc_auc_score', 'roc_auc_score', (['labels', 'predicts'], {}), '(labels, predicts)\n', (885, 903), False, 'from sklearn.metrics import roc_auc_score\n'), ((1507, 1554), 'seqeval.metrics.classification_report', 'classification_report', (['y_true', 'y_pred'], {'digits': '(4)'}), '(y_true, y... |
import tornado, json, sys
from tornado.httpclient import HTTPClient
#curl -i -X POST -H 'Content-type':'application/json' -d '{"header":{},"request":{"c":"","m":"query_correct","p":{"query":"andio"}}}' http://192.168.9.140:1111/query_correct
url = "http://%s:%s/%s" % ("127.0.0.1", "1111", "query_correct")
http_client... | [
"tornado.httpclient.HTTPClient",
"json.dumps"
] | [((323, 335), 'tornado.httpclient.HTTPClient', 'HTTPClient', ([], {}), '()\n', (333, 335), False, 'from tornado.httpclient import HTTPClient\n'), ((616, 651), 'json.dumps', 'json.dumps', (['obj'], {'ensure_ascii': '(False)'}), '(obj, ensure_ascii=False)\n', (626, 651), False, 'import tornado, json, sys\n')] |
from __future__ import unicode_literals
import math
import json
from functools import partial
import param
import numpy as np
from bokeh.models.widgets import Select, Slider, AutocompleteInput, TextInput, Div
from bokeh.layouts import widgetbox, row, column
from ...core import Store, NdMapping, OrderedDict
from ...c... | [
"param.Integer",
"functools.partial",
"bokeh.layouts.widgetbox",
"bokeh.models.widgets.AutocompleteInput",
"param.Dict",
"param.Boolean",
"json.dumps",
"math.log10",
"bokeh.models.widgets.Slider",
"bokeh.models.widgets.Select",
"param.String",
"param.ObjectSelector"
] | [((926, 1041), 'param.Dict', 'param.Dict', ([], {'default': '{}', 'doc': '"""\n Additional options controlling display options of the widgets."""'}), '(default={}, doc=\n """\n Additional options controlling display options of the widgets."""\n )\n', (936, 1041), False, 'import param\n'), ((1048, 12... |
from capy import *
from operators import *
from qChain import *
from utility import *
from IPython import embed
import os
import time
import numpy as np
from scipy import signal
import matplotlib.pyplot as plt
import cmath
import h5py
def getNormalModes(t,y):
#has a threshold normal modes of 1/100 of absolute m... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.show",
"numpy.random.seed",
"matplotlib.pyplot.plot",
"scipy.signal.filtfilt",
"numpy.fft.fft",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.grid",
"scipy.signal.butter",
"numpy.sqrt"
] | [((978, 1012), 'scipy.signal.butter', 'signal.butter', (['(5)', 'fraction_nyquist'], {}), '(5, fraction_nyquist)\n', (991, 1012), False, 'from scipy import signal\n'), ((1584, 1608), 'matplotlib.pyplot.plot', 'plt.plot', (['erange', 'errors'], {}), '(erange, errors)\n', (1592, 1608), True, 'import matplotlib.pyplot as ... |
import os
import logging
import jsonpickle
import boto3
from botocore.exceptions import ClientError
from aws_xray_sdk.core import xray_recorder
from aws_xray_sdk.core import patch_all
import taskfile
import taskissue
import taskmessage
logger = logging.getLogger()
logger.setLevel(logging.INFO)
patch_all()
def pream... | [
"taskissue.get_issue_table",
"boto3.client",
"taskmessage.send_task_message",
"taskissue.write_task_issues",
"aws_xray_sdk.core.patch_all",
"jsonpickle.decode",
"aws_xray_sdk.core.xray_recorder.begin_segment",
"taskfile.get_task_file_blob",
"aws_xray_sdk.core.xray_recorder.end_segment",
"logging.g... | [((247, 266), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (264, 266), False, 'import logging\n'), ((297, 308), 'aws_xray_sdk.core.patch_all', 'patch_all', ([], {}), '()\n', (306, 308), False, 'from aws_xray_sdk.core import patch_all\n'), ((558, 580), 'boto3.client', 'boto3.client', (['"""lambda"""'], {}... |
import quex.engine.state_machine.algebra.intersection as intersection
import quex.engine.state_machine.algebra.complement as complement
def do(A, B):
A_and_B = intersection.do([A, B])
not_A_and_B = complement.do(A_and_B)
# Difference: It only remains in A what is not in A and B.
return intersec... | [
"quex.engine.state_machine.algebra.complement.do",
"quex.engine.state_machine.algebra.intersection.do"
] | [((172, 195), 'quex.engine.state_machine.algebra.intersection.do', 'intersection.do', (['[A, B]'], {}), '([A, B])\n', (187, 195), True, 'import quex.engine.state_machine.algebra.intersection as intersection\n'), ((214, 236), 'quex.engine.state_machine.algebra.complement.do', 'complement.do', (['A_and_B'], {}), '(A_and_... |
from os import listdir
from os.path import isfile, join
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
from skimage import data, measure
from skimage.filters import threshold_otsu, rank, gaussian
import skimage.io as skio
import skimage as ski
from skimage import filters
from skimage.morpholog... | [
"numpy.full",
"skimage.filters.threshold_otsu",
"skimage.exposure.adjust_gamma",
"math.ceil",
"numpy.zeros",
"math.floor",
"skimage.filters.gaussian"
] | [((3546, 3577), 'skimage.filters.gaussian', 'gaussian', (['fullycropped_image', '(5)'], {}), '(fullycropped_image, 5)\n', (3554, 3577), False, 'from skimage.filters import threshold_otsu, rank, gaussian\n'), ((3827, 3863), 'skimage.filters.threshold_otsu', 'ski.filters.threshold_otsu', (['subimage'], {}), '(subimage)\n... |
##
# File: PdbxReader.py
# Date: 2012-01-09 Jdw Adapted from PdbxParser
#
# Updates:
#
# 2012-01-09 - (jdw) Separate reader and writer classes.
#
# 2012-09-02 - (jdw) Revise tokenizer to better handle embedded quoting.
#
##
"""
PDBx/mmCIF dictionary and data file parser.
Acknowledgements:
The tokenizer used in ... | [
"re.compile"
] | [((12501, 12627), 're.compile', 're.compile', (['"""(?:(?:_(.+?)[.](\\\\S+))|(?:[\'](.*?)(?:[\']\\\\s|[\']$))|(?:["](.*?)(?:["]\\\\s|["]$))|(?:\\\\s*#.*$)|(\\\\S+))"""'], {}), '(\n \'(?:(?:_(.+?)[.](\\\\S+))|(?:[\\\'](.*?)(?:[\\\']\\\\s|[\\\']$))|(?:["](.*?)(?:["]\\\\s|["]$))|(?:\\\\s*#.*$)|(\\\\S+))\'\n )\n', (1... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import pulumi
import pulumi.runtime
class GetSubnetworkResult(object):
"""
A collection of values returned by getSubnetwork.
... | [
"pulumi.runtime.invoke"
] | [((3535, 3609), 'pulumi.runtime.invoke', 'pulumi.runtime.invoke', (['"""gcp:compute/getSubnetwork:getSubnetwork"""', '__args__'], {}), "('gcp:compute/getSubnetwork:getSubnetwork', __args__)\n", (3556, 3609), False, 'import pulumi\n')] |
"""
# ==================================
# AUTHOR : <NAME>, <NAME>
# CREATE DATE : 02.10.2020
# Contact : <EMAIL>
# ==================================
# Change History: None
# ==================================
"""
########## Import python libs ##########
import os
########## Import third-party libs ######... | [
"numpy.pad",
"numpy.moveaxis",
"os.getcwd",
"numpy.float32",
"numpy.zeros",
"numpy.array",
"numpy.arange",
"numpy.reshape",
"os.path.join"
] | [((541, 569), 'numpy.arange', 'np.arange', (['dataset_view_nums'], {}), '(dataset_view_nums)\n', (550, 569), True, 'import numpy as np\n'), ((3616, 3641), 'numpy.array', 'np.array', (['preds_crop_seqs'], {}), '(preds_crop_seqs)\n', (3624, 3641), True, 'import numpy as np\n'), ((4078, 4113), 'numpy.zeros', 'np.zeros', (... |
from django.db import models
from datetime import date
# Create your models here.
class Role(models.Model):
class Meta:
ordering = ['name']
def __str__(self):
return self.name
name = models.CharField(max_length = 30)
description = models.TextField(blank=True)
class Deliverable(m... | [
"django.db.models.TextField",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.BooleanField",
"django.db.models.IntegerField",
"django.db.models.DecimalField",
"django.db.models.DateField"
] | [((219, 250), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(30)'}), '(max_length=30)\n', (235, 250), False, 'from django.db import models\n'), ((271, 299), 'django.db.models.TextField', 'models.TextField', ([], {'blank': '(True)'}), '(blank=True)\n', (287, 299), False, 'from django.db import m... |
"""Builds a preferred serie on a given thematics from multiple series."""
import pandas as pd
from scipy.interpolate import CubicSpline
import numpy as np
class measured_serie(object):
"""A serie as it is measured in one or multiple data sources.
A given serie is being measured from different data sources. ... | [
"pandas.date_range",
"scipy.interpolate.CubicSpline",
"pandas.merge",
"numpy.mean",
"pandas.to_datetime",
"pandas.isna",
"pandas.to_numeric"
] | [((3066, 3139), 'pandas.merge', 'pd.merge', (['data', 'allmonths'], {'how': '"""outer"""', 'left_on': '"""month"""', 'right_on': '"""month"""'}), "(data, allmonths, how='outer', left_on='month', right_on='month')\n", (3074, 3139), True, 'import pandas as pd\n'), ((3250, 3346), 'scipy.interpolate.CubicSpline', 'CubicSpl... |
from coralillo import Engine
from itacate import Config
import os
import pytest
from pymongo import MongoClient
from cacahuate.models import bind_models as bimo
def ismybirthday(value):
if value.month == 5 and value.day == 10:
return 'Today is my birthday!'
return 'Is not my birthday'
TESTING_SETTI... | [
"pymongo.MongoClient",
"os.path.dirname",
"os.path.realpath",
"pytest.fixture",
"cacahuate.models.bind_models",
"coralillo.Engine",
"cacahuate.http.wsgi.app.test_client",
"cacahuate.http.wsgi.app.config.from_mapping"
] | [((1049, 1077), 'pytest.fixture', 'pytest.fixture', ([], {'autouse': '(True)'}), '(autouse=True)\n', (1063, 1077), False, 'import pytest\n'), ((1341, 1369), 'pytest.fixture', 'pytest.fixture', ([], {'autouse': '(True)'}), '(autouse=True)\n', (1355, 1369), False, 'import pytest\n'), ((1116, 1129), 'pymongo.MongoClient',... |
import regex as re
import os
import markdown2
from oboe import GLOBAL
def slug_case(text):
# Function from django/utils/text.py, should output the same as markdown2's variant
import unicodedata
text = str(text)
text = unicodedata.normalize('NFKC', text)
text = re.sub(r'[^\w\s-]', '', text.lower())... | [
"unicodedata.normalize",
"markdown2.markdown",
"regex.sub",
"regex.finditer"
] | [((236, 271), 'unicodedata.normalize', 'unicodedata.normalize', (['"""NFKC"""', 'text'], {}), "('NFKC', text)\n", (257, 271), False, 'import unicodedata\n'), ((999, 1061), 'regex.finditer', 're.finditer', (['"""\\\\[{2}([^\\\\]]*?)[|#\\\\]]([^\\\\]]*?)\\\\]+"""', 'document'], {}), "('\\\\[{2}([^\\\\]]*?)[|#\\\\]]([^\\\... |
from collections import deque
from item_engine import ACTION, INDEX, STATE
from item_engine.textbase.items.chars import Char
from item_engine.textbase.items.tokens import Token
from typing import Deque, Dict, Iterator, List, Tuple
__all__ = ['lexer']
def lexer_propagator(current: Token, item: Char) -> Tuple[ACTION,... | [
"item_engine.textbase.items.tokens.Token.cursor",
"item_engine.textbase.items.tokens.Token",
"item_engine.textbase.items.tokens.Token.EOF",
"collections.deque"
] | [((2643, 2650), 'collections.deque', 'deque', ([], {}), '()\n', (2648, 2650), False, 'from collections import deque\n'), ((4403, 4420), 'item_engine.textbase.items.tokens.Token.EOF', 'Token.EOF', ([], {'at': 'eof'}), '(at=eof)\n', (4412, 4420), False, 'from item_engine.textbase.items.tokens import Token\n'), ((2926, 29... |
# Copyright 2019 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | [
"numpy.allclose",
"numpy.array",
"mindarmour.adv_robustness.evaluations.BlackDefenseEvaluate"
] | [((1013, 1256), 'numpy.array', 'np.array', (['[[0.1, 0.1, 0.2, 0.6], [0.1, 0.7, 0.0, 0.2], [0.8, 0.1, 0.0, 0.1], [0.1, \n 0.1, 0.2, 0.6], [0.1, 0.7, 0.0, 0.2], [0.8, 0.1, 0.0, 0.1], [0.1, 0.1, \n 0.2, 0.6], [0.1, 0.7, 0.0, 0.2], [0.8, 0.1, 0.0, 0.1], [0.1, 0.1, 0.2, 0.6]\n ]'], {}), '([[0.1, 0.1, 0.2, 0.6], [0... |
"""
This command is used to flush old temporary accounts from the database.
Users with a username prefix of "tmp-" more than the specified number of
days old will be deleted. The default number of days is 1.
Execution: python manage.py flush_tmp_users [days]
"""
from django.core.management.base import BaseCommand, C... | [
"uniauth.utils.get_input",
"uniauth.utils.flush_old_tmp_users"
] | [((678, 799), 'uniauth.utils.get_input', 'get_input', (['(\'Are you sure you want to delete all temporary\' + \n """users more than %d days old?\nAnswer [y/n]:""" % days)'], {}), '(\'Are you sure you want to delete all temporary\' + \n """users more than %d days old?\nAnswer [y/n]:""" % days)\n', (687, 799), Fals... |
import os
import shutil
import unittest
import logging
from filecmp import dircmp
from io import BytesIO
import json
from utils.object import Object
working_dir = os.environ['WORKING_DIR']
resource_dir = os.environ['TEST_RESOURCE_DIR']
test_object_name = 'a_archival_description_0001'
test_object_working_path = os.pat... | [
"shutil.rmtree",
"os.path.basename",
"os.path.isdir",
"logging.getLogger",
"json.dumps",
"utils.object.Object",
"os.path.isfile",
"shutil.copytree",
"os.path.join",
"filecmp.dircmp"
] | [((314, 357), 'os.path.join', 'os.path.join', (['working_dir', 'test_object_name'], {}), '(working_dir, test_object_name)\n', (326, 357), False, 'import os\n'), ((386, 441), 'os.path.join', 'os.path.join', (['resource_dir', '"""objects"""', 'test_object_name'], {}), "(resource_dir, 'objects', test_object_name)\n", (398... |
import numpy as np
import pandas as pd
from sklearn.datasets import make_classification
def make_uplift_classification(n_samples=1000,
treatment_name=['control', 'treatment1', 'treatment2', 'treatment3'],
y_name='conversion',
... | [
"pandas.DataFrame",
"numpy.random.uniform",
"numpy.zeros_like",
"numpy.random.seed",
"sklearn.datasets.make_classification",
"numpy.clip",
"numpy.random.normal",
"numpy.random.choice",
"numpy.random.permutation"
] | [((5313, 5345), 'numpy.random.seed', 'np.random.seed', ([], {'seed': 'random_seed'}), '(seed=random_seed)\n', (5327, 5345), True, 'import numpy as np\n'), ((5384, 5398), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (5396, 5398), True, 'import pandas as pd\n'), ((5591, 5628), 'numpy.random.permutation', 'np.ran... |
#
# This file is part of USB3-PIPE project.
#
# Copyright (c) 2019-2020 <NAME> <<EMAIL>>
# SPDX-License-Identifier: BSD-2-Clause
from functools import reduce
from operator import xor
from migen import *
from litex.soc.interconnect import stream
from usb3_pipe.common import COM
# Scrambler Unit (Appendix B) -------... | [
"litex.soc.interconnect.stream.Endpoint"
] | [((4422, 4466), 'litex.soc.interconnect.stream.Endpoint', 'stream.Endpoint', (["[('data', 32), ('ctrl', 4)]"], {}), "([('data', 32), ('ctrl', 4)])\n", (4437, 4466), False, 'from litex.soc.interconnect import stream\n'), ((4498, 4542), 'litex.soc.interconnect.stream.Endpoint', 'stream.Endpoint', (["[('data', 32), ('ctrl... |
# Copyright (c) 2016 Hitachi Data Systems, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... | [
"ddt.data",
"unittest.mock.Mock",
"json.dumps",
"manila.share.drivers.hitachi.hsp.rest.HSPRestBackend._send_delete.assert_called_once_with",
"manila.share.drivers.hitachi.hsp.rest.HSPRestBackend",
"manila.share.drivers.hitachi.hsp.rest.HSPRestBackend._send_get.assert_called_once_with",
"manila.share.dri... | [((1712, 1730), 'ddt.data', 'ddt.data', (['(202)', '(500)'], {}), '(202, 500)\n', (1720, 1730), False, 'import ddt\n'), ((2321, 2443), 'ddt.data', 'ddt.data', (["{'code': 200, 'content': 'null'}", "{'code': 200, 'content': 'fake_content'}", "{'code': 500, 'content': 'null'}"], {}), "({'code': 200, 'content': 'null'}, {... |
from unittest import TestCase
from iubeo import config
def custom_callable(value):
return "CUSTOM_CALLABLE"
class IubeoConfigTestCase(TestCase):
test_1 = {
"N0": custom_callable,
"N1": {
"N10": str,
"N11": {
"N110": int,
},
},
... | [
"iubeo.config"
] | [((3532, 3551), 'iubeo.config', 'config', (['self.test_1'], {}), '(self.test_1)\n', (3538, 3551), False, 'from iubeo import config\n'), ((3581, 3617), 'iubeo.config', 'config', (['self.test_1'], {'prefix': '"""PREFIX"""'}), "(self.test_1, prefix='PREFIX')\n", (3587, 3617), False, 'from iubeo import config\n'), ((3644, ... |
# THIS FILE IS AUTOMATICALLY GENERATED.
"""
Sample Calm DSL for Hello blueprint
The top-level folder contains the following files:
HelloBlueprint/
├── .local
│ └── keys
│ ├── centos
│ └── centos_pub
├── blueprint.py
└── scripts
├── pkg_install_task.sh
└── pkg_uninstall_task.sh
On launch, this bl... | [
"calm.dsl.builtins.AhvVmDisk.Disk.Scsi.cloneFromVMDiskPackage",
"calm.dsl.builtins.basic_cred",
"calm.dsl.builtins.AhvVmGC.CloudInit",
"calm.dsl.builtins.AhvVmNic.DirectNic.ingress",
"calm.dsl.builtins.parallel",
"calm.dsl.builtins.CalmTask.Exec.ssh",
"calm.dsl.builtins.CalmVariable.Simple",
"calm.dsl... | [((2159, 2235), 'calm.dsl.builtins.basic_cred', 'basic_cred', (['CENTOS_USER', 'CENTOS_KEY'], {'name': '"""Centos"""', 'type': '"""KEY"""', 'default': '(True)'}), "(CENTOS_USER, CENTOS_KEY, name='Centos', type='KEY', default=True)\n", (2169, 2235), False, 'from calm.dsl.builtins import action, parallel, ref, basic_cred... |
import os
import json
from flask import jsonify
from google.cloud import datastore
DS_KIND = 'FX'
DS_CLIENT = datastore.Client()
API_TOKEN = ''
def main(request):
response = {}
if not request.args and 'currency' not in request.args:
return jsonify({'error': 'Bad request. Missing required parameters.'}... | [
"google.cloud.datastore.Client",
"flask.jsonify"
] | [((111, 129), 'google.cloud.datastore.Client', 'datastore.Client', ([], {}), '()\n', (127, 129), False, 'from google.cloud import datastore\n'), ((821, 838), 'flask.jsonify', 'jsonify', (['response'], {}), '(response)\n', (828, 838), False, 'from flask import jsonify\n'), ((258, 321), 'flask.jsonify', 'jsonify', (["{'e... |
from urllib.parse import urlparse
import logging
import os
import requests
import tarfile
import urllib.request
import zipfile
from tqdm import tqdm
logger = logging.getLogger(__name__)
def _reporthook(t):
""" ``reporthook`` to use with ``urllib.request`` that prints the process of the download.
Uses ``tq... | [
"tqdm.tqdm",
"zipfile.ZipFile",
"os.makedirs",
"os.stat",
"os.path.basename",
"os.path.isdir",
"requests.Session",
"logging.getLogger",
"os.path.isfile",
"tarfile.open",
"os.path.join",
"urllib.parse.urlparse"
] | [((161, 188), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (178, 188), False, 'import logging\n'), ((1705, 1723), 'requests.Session', 'requests.Session', ([], {}), '()\n', (1721, 1723), False, 'import requests\n'), ((2356, 2373), 'os.stat', 'os.stat', (['filename'], {}), '(filename)\n',... |
# Import packages
import os
import argparse
import cv2
import numpy as np
import sys
import importlib.util
import tensorflow as tf
import InputManager
import Object_detection_image
import Object_detection_video
import Object_detection_webcam
# Define and parse input arguments
parser = argparse.ArgumentParser()
parser.... | [
"Object_detection_image.detect",
"argparse.ArgumentParser",
"Object_detection_webcam.detect",
"Object_detection_video.detect"
] | [((287, 312), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (310, 312), False, 'import argparse\n'), ((1654, 1695), 'Object_detection_video.detect', 'Object_detection_video.detect', (['VIDEO_NAME'], {}), '(VIDEO_NAME)\n', (1683, 1695), False, 'import Object_detection_video\n'), ((1727, 1768), ... |
"""
Program to generate stats on command line to STDOUT.
"""
from osr_stat_generator.generator import generate_stats
def _horizontal_line_str (nrof_sets):
hstring = "-----"
for i in range(0,nrof_sets):
hstring = hstring + "-----"
return hstring
def _header_str (nrof_sets):
hstring = "SET"... | [
"osr_stat_generator.generator.generate_stats"
] | [((615, 640), 'osr_stat_generator.generator.generate_stats', 'generate_stats', (['nrof_sets'], {}), '(nrof_sets)\n', (629, 640), False, 'from osr_stat_generator.generator import generate_stats\n')] |
""" Defines the SelectableOverlayPlotContainer class.
"""
from __future__ import with_statement
from numpy import array, float64
# Enthought library imports
from traits.api import Bool, Float, Enum
from enable.api import ColorTrait
# Local imports
from .plot_containers import OverlayPlotContainer
class SelectableO... | [
"enable.api.ColorTrait",
"traits.api.Float",
"traits.api.Enum",
"traits.api.Bool"
] | [((622, 632), 'traits.api.Float', 'Float', (['(0.0)'], {}), '(0.0)\n', (627, 632), False, 'from traits.api import Bool, Float, Enum\n'), ((796, 806), 'traits.api.Float', 'Float', (['(0.0)'], {}), '(0.0)\n', (801, 806), False, 'from traits.api import Bool, Float, Enum\n'), ((867, 878), 'traits.api.Bool', 'Bool', (['(Fal... |
# print ('Hello, sparta')
# # 파이썬에서는 True 는 대문자로 써야된다
# def f(x):
# return 2*x+5
# y = f(2)
# print(y)
import requests
from bs4 import BeautifulSoup
# URL을 읽어서 HTML를 받아오고,
headers = {'User-Agent' : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36'... | [
"bs4.BeautifulSoup",
"pymongo.MongoClient",
"requests.get"
] | [((329, 442), 'requests.get', 'requests.get', (['"""https://movie.naver.com/movie/sdb/rank/rmovie.nhn?sel=pnt&date=20200303"""'], {'headers': 'headers'}), "(\n 'https://movie.naver.com/movie/sdb/rank/rmovie.nhn?sel=pnt&date=20200303',\n headers=headers)\n", (341, 442), False, 'import requests\n'), ((493, 532), 'b... |
"""Pipeline definition for greenscreen processing/removal.
Todo:
- Add license boilerplate.
- Cleanup
- File necessary?
"""
from os.path import isfile, join
from os import listdir
from types import MethodWrapperType
from typing import List
from multiprocessing import Lock
import cv2
from cv2 import imrea... | [
"numpy.uint8",
"cv2.waitKey",
"cv2.destroyAllWindows",
"ImageBot.image_processing.masks.clean_mask_surrounding",
"ImageBot.infrastructure.Pipeline.Pipeline",
"cv2.setMouseCallback",
"cv2.destroyWindow",
"cv2.imshow",
"cv2.namedWindow"
] | [((772, 807), 'ImageBot.infrastructure.Pipeline.Pipeline', 'Pipeline', ([], {'with_multiprocessing': '(True)'}), '(with_multiprocessing=True)\n', (780, 807), False, 'from ImageBot.infrastructure.Pipeline import Pipeline\n'), ((2387, 2421), 'cv2.imshow', 'cv2.imshow', (['"""image"""', 'message.image'], {}), "('image', m... |
import numpy as np
import os
from PySide import QtGui, QtCore
import sharppy.sharptab as tab
import sharppy.databases.inset_data as inset_data
from sharppy.sharptab.constants import *
## routine written by <NAME> and <NAME>
## <EMAIL> and <EMAIL>
__all__ = ['backgroundSTPEF', 'plotSTPEF']
class backgroundSTPEF(QtGui... | [
"PySide.QtGui.QFontMetrics",
"numpy.asarray",
"sharppy.databases.inset_data.condSTPData",
"PySide.QtGui.QPainter",
"PySide.QtCore.QRectF",
"PySide.QtGui.QBrush",
"numpy.arange",
"PySide.QtCore.QRect",
"PySide.QtGui.QColor",
"PySide.QtGui.QFont",
"PySide.QtGui.QPen"
] | [((970, 1005), 'PySide.QtGui.QFont', 'QtGui.QFont', (['"""Helvetica"""', '(fsize + 1)'], {}), "('Helvetica', fsize + 1)\n", (981, 1005), False, 'from PySide import QtGui, QtCore\n'), ((1030, 1061), 'PySide.QtGui.QFont', 'QtGui.QFont', (['"""Helvetica"""', 'fsize'], {}), "('Helvetica', fsize)\n", (1041, 1061), False, 'f... |
#!/usr/bin/python
import os
import setuptools
def readme():
with open('README.md') as f:
return f.read()
def get_requirements_filename():
return "REQUIREMENTS.txt"
install_requires = [
line.rstrip() for line in open(os.path.join(os.path.dirname(__file__), get_requirements_filename()))
]
se... | [
"os.path.dirname"
] | [((257, 282), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (272, 282), False, 'import os\n')] |
from functools import lru_cache
m= [0,
1,
2,
3,
4,
7,
8,
9,
10,
11,
14,
15,
18,
19,
20,
21,
22,
25,
26,
27,
30,
31,
32,
33,
36,
39,
40,
41,
42,
45,
46,
49,
52,
53,
54,
55,
56,
59,
60,
61,
64,
65,
66,
69,
70,
71,
72,
73,
76,
77,
78,
81,
82,
83,
84,
87,
88,
89,
92,
93,
94,
95,
98,
99,
100,
101,
104,
107,
108,
109,
110,
1... | [
"functools.lru_cache"
] | [((781, 796), 'functools.lru_cache', 'lru_cache', (['None'], {}), '(None)\n', (790, 796), False, 'from functools import lru_cache\n')] |
from django.contrib import admin
from .models import RegistroHoraExtra
# Register your models here.
admin.site.register(RegistroHoraExtra)
| [
"django.contrib.admin.site.register"
] | [((101, 139), 'django.contrib.admin.site.register', 'admin.site.register', (['RegistroHoraExtra'], {}), '(RegistroHoraExtra)\n', (120, 139), False, 'from django.contrib import admin\n')] |
import os
import unittest
from collections import namedtuple
from unittest.mock import patch, Mock
from common.repos import Repo
from examples.update_git_hub_labels import GitHubLabelManager
@patch.dict(os.environ, {"GITHUB_TOKEN": "THE TOKEN"})
class TestGitHubLabelManager(unittest.TestCase):
def setUp(self):
... | [
"examples.update_git_hub_labels.GitHubLabelManager",
"unittest.mock.Mock",
"unittest.mock.patch.dict",
"unittest.mock.patch",
"collections.namedtuple",
"common.repos.Repo"
] | [((195, 248), 'unittest.mock.patch.dict', 'patch.dict', (['os.environ', "{'GITHUB_TOKEN': 'THE TOKEN'}"], {}), "(os.environ, {'GITHUB_TOKEN': 'THE TOKEN'})\n", (205, 248), False, 'from unittest.mock import patch, Mock\n'), ((1852, 1912), 'unittest.mock.patch', 'patch', (['"""examples.update_git_hub_labels.submit_graphq... |
""" Entry point for the graphical user interface """
try:
from . import compile_resources
compile_resources()
except Exception as e:
print("Failed to compiled resources. %s" % e)
import os
import sys
from PyQt5.QtCore import QCoreApplication, QDir, Qt, pyqtSignal, QUrl, QSettings, QPoint, QTim... | [
"PyQt5.QtCore.pyqtSignal",
"PyQt5.QtWidgets.QApplication.desktop",
"winreg.SetValueEx",
"PyQt5.QtCore.QUrl",
"fmpy.gui.model.VariablesTreeModel",
"winreg.CloseKey",
"PyQt5.QtCore.QCoreApplication.setApplicationVersion",
"PyQt5.QtGui.QColor.fromRgb",
"PyQt5.QtWidgets.QFileDialog.getOpenFileName",
"... | [((1152, 1208), 'PyQt5.QtCore.QCoreApplication.setApplicationVersion', 'QCoreApplication.setApplicationVersion', (['fmpy.__version__'], {}), '(fmpy.__version__)\n', (1190, 1208), False, 'from PyQt5.QtCore import QCoreApplication, QDir, Qt, pyqtSignal, QUrl, QSettings, QPoint, QTimer, QStandardPaths, QPointF, QBuffer, Q... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.