code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# Copyright (c) 2017 Intel Corporation
#
# 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 i... | [
"logging.getLogger",
"itertools.chain",
"re.compile",
"io.BytesIO",
"time.sleep",
"yardstick.network_services.vnf_generic.vnf.iniparser.ConfigParser",
"itertools.repeat",
"yardstick.common.utils.ip_to_hex",
"re.finditer",
"six.moves.cStringIO",
"six.moves.zip",
"os.linesep.join",
"collection... | [((1434, 1461), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1451, 1461), False, 'import logging\n'), ((2794, 2852), 'collections.namedtuple', 'namedtuple', (['"""CoreTuple"""', '"""core_id, socket_id, hyperthread"""'], {}), "('CoreTuple', 'core_id, socket_id, hyperthread')\n", (2804, ... |
# using_rules.py
from openpyxl import load_workbook
from openpyxl.formatting.rule import Rule
from openpyxl.styles import PatternFill
from openpyxl.styles.differential import DifferentialStyle
def applying_rules(path, rule_formula, output_path):
workbook = load_workbook(filename=path)
sheet = workbook.active... | [
"openpyxl.load_workbook",
"openpyxl.styles.differential.DifferentialStyle",
"openpyxl.formatting.rule.Rule",
"openpyxl.styles.PatternFill"
] | [((264, 292), 'openpyxl.load_workbook', 'load_workbook', ([], {'filename': 'path'}), '(filename=path)\n', (277, 292), False, 'from openpyxl import load_workbook\n'), ((335, 366), 'openpyxl.styles.PatternFill', 'PatternFill', ([], {'bgColor': '"""00FFFF00"""'}), "(bgColor='00FFFF00')\n", (346, 366), False, 'from openpyx... |
#!/usr/bin/env python
import units.main.main as main
main.main()
# def cli():
# import units.ui.cli.cli as cli
# cli.entry_point()
| [
"units.main.main.main"
] | [((54, 65), 'units.main.main.main', 'main.main', ([], {}), '()\n', (63, 65), True, 'import units.main.main as main\n')] |
from django.contrib import admin
from django.contrib.auth.models import Group, User
from .models import Dweet, Profile
class ProfileInline(admin.StackedInline):
model = Profile
class UserAdmin(admin.ModelAdmin):
model = User
fields = ["username"]
inlines = [ProfileInline]
admin.site.unregister(Us... | [
"django.contrib.admin.site.unregister",
"django.contrib.admin.site.register"
] | [((296, 323), 'django.contrib.admin.site.unregister', 'admin.site.unregister', (['User'], {}), '(User)\n', (317, 323), False, 'from django.contrib import admin\n'), ((324, 360), 'django.contrib.admin.site.register', 'admin.site.register', (['User', 'UserAdmin'], {}), '(User, UserAdmin)\n', (343, 360), False, 'from djan... |
from flask import render_template, abort, url_for, redirect, flash
from . import main
from flask_login import login_required, current_user
from ..decorators import admin_required, permission_required
from ..models import Permission, User, Role
from .forms import EditProfileForm, EditProfileAdminForm
from .. import db
... | [
"flask.render_template",
"flask.abort",
"flask.flash",
"flask.url_for"
] | [((375, 424), 'flask.render_template', 'render_template', (['"""main/index.html"""'], {'title': '"""Index"""'}), "('main/index.html', title='Index')\n", (390, 424), False, 'from flask import render_template, abort, url_for, redirect, flash\n'), ((829, 885), 'flask.render_template', 'render_template', (['"""user.html"""... |
# -*- coding: utf-8 -*-
# scip plugin
from spring_cloud.gateway.pathpattern import (
LiteralPathElement,
PathElement,
PathPatternParser,
SeparatorPathElement,
WildcardTheRestPathElement,
)
__author__ = "Waterball (<EMAIL>)"
__license__ = "Apache 2.0"
parser = PathPatternParser()
class TestParser... | [
"spring_cloud.gateway.pathpattern.PathPatternParser"
] | [((282, 301), 'spring_cloud.gateway.pathpattern.PathPatternParser', 'PathPatternParser', ([], {}), '()\n', (299, 301), False, 'from spring_cloud.gateway.pathpattern import LiteralPathElement, PathElement, PathPatternParser, SeparatorPathElement, WildcardTheRestPathElement\n')] |
import urllib.request
from bs4 import BeautifulSoup
from django.core.exceptions import ObjectDoesNotExist
import re
from standard.models import *
from projects.models import *
dwc_url = 'http://rs.tdwg.org/dwc/terms/'
simple_dwc_url ='http://rs.tdwg.org/dwc/terms/simple/'
def get_dwc_html(url=dwc_url):
opener = ... | [
"bs4.BeautifulSoup",
"re.compile"
] | [((434, 468), 'bs4.BeautifulSoup', 'BeautifulSoup', (['html', '"""html.parser"""'], {}), "(html, 'html.parser')\n", (447, 468), False, 'from bs4 import BeautifulSoup\n'), ((563, 594), 're.compile', 're.compile', (['"""Begin Terms Table"""'], {}), "('Begin Terms Table')\n", (573, 594), False, 'import re\n')] |
import numpy as np
from numba import jit
# Tridiag solver from Carnahan
# Not used in main program
def TDMAsolver_carnahan(A, B, C, D):
"""
Our solution for the TDMA solver based on carnahan (not used in main program)
"""
# send the vectors a, b, c, d with the coefficents
vector_len = D.shape[0] ... | [
"numpy.zeros",
"numpy.arange"
] | [((392, 412), 'numpy.zeros', 'np.zeros', (['vector_len'], {}), '(vector_len)\n', (400, 412), True, 'import numpy as np\n'), ((443, 463), 'numpy.zeros', 'np.zeros', (['vector_len'], {}), '(vector_len)\n', (451, 463), True, 'import numpy as np\n'), ((491, 511), 'numpy.zeros', 'np.zeros', (['vector_len'], {}), '(vector_le... |
import json
import logging
import os
import tweepy
from tweepy import OAuthHandler, Stream, api
from tweepy.models import Status
from tweepy.streaming import StreamListener
logger = logging.getLogger(__name__)
data_directory = "{}/Bot/data".format(os.getcwd())
tweets_path = "{}/tweets.json".format(data_directory)
fo... | [
"logging.getLogger",
"os.makedirs",
"tweepy.Stream",
"os.getcwd",
"os.path.isfile",
"tweepy.API",
"os.path.isdir",
"tweepy.api.get_user",
"json.dump",
"tweepy.OAuthHandler"
] | [((184, 211), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (201, 211), False, 'import logging\n'), ((2465, 2506), 'tweepy.OAuthHandler', 'OAuthHandler', (['consumerKey', 'consumerSecret'], {}), '(consumerKey, consumerSecret)\n', (2477, 2506), False, 'from tweepy import OAuthHandler, Str... |
import inspect
from functools import partial
import jax.numpy as jnp
from jax import jit
from onnx_jax.handlers.backend_handler import BackendHandler
from onnx_jax.handlers.handler import onnx_op
from onnx_jax.pb_wrapper import OnnxNode
@onnx_op("Pad")
class Pad(BackendHandler):
@classmethod
def _common(cls... | [
"onnx_jax.handlers.handler.onnx_op",
"jax.numpy.pad",
"inspect.signature",
"jax.numpy.size",
"functools.partial"
] | [((242, 256), 'onnx_jax.handlers.handler.onnx_op', 'onnx_op', (['"""Pad"""'], {}), "('Pad')\n", (249, 256), False, 'from onnx_jax.handlers.handler import onnx_op\n'), ((1660, 1698), 'functools.partial', 'partial', (['jit'], {'static_argnums': '(1, 2, 3)'}), '(jit, static_argnums=(1, 2, 3))\n', (1667, 1698), False, 'fro... |
import torch
import torch.nn as nn
from pytorch_pretrained_bert.modeling import PreTrainedBertModel, BertEmbeddings, BertModel, BertForSequenceClassification, CrossEntropyLoss
class BertPosattnForSequenceClassification(PreTrainedBertModel):
def __init__(self, config, num_labels=2, max_offset=10, offset_emb=30):
... | [
"torch.nn.Dropout",
"torch.nn.Tanh",
"torch.nn.Softmax",
"pytorch_pretrained_bert.modeling.BertModel",
"torch.cat",
"torch.nn.Linear",
"pytorch_pretrained_bert.modeling.CrossEntropyLoss",
"torch.nn.Embedding"
] | [((737, 754), 'pytorch_pretrained_bert.modeling.BertModel', 'BertModel', (['config'], {}), '(config)\n', (746, 754), False, 'from pytorch_pretrained_bert.modeling import PreTrainedBertModel, BertEmbeddings, BertModel, BertForSequenceClassification, CrossEntropyLoss\n'), ((778, 816), 'torch.nn.Dropout', 'nn.Dropout', ([... |
# -*- coding: utf-8 -*-
from __future__ import print_function
import pytest
mods = ('clu.all',
'clu.abstract',
'clu.constants.consts',
'clu.constants.polyfills',
'clu.config.base',
'clu.config.settings',
'clu.config.ns',
'clu.csv',
'clu.fs.appdirectories... | [
"clu.naming.qualified_import",
"pytest.mark.parametrize",
"clu.repl.modules.compare_module_lookups_for_all_things",
"clu.naming.nameof",
"clu.repl.modules.ModuleMap",
"pytest.raises",
"copy.deepcopy",
"copy.copy"
] | [((2907, 2950), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""modulename"""', 'mods'], {}), "('modulename', mods)\n", (2930, 2950), False, 'import pytest\n'), ((884, 923), 'clu.repl.modules.compare_module_lookups_for_all_things', 'compare_module_lookups_for_all_things', ([], {}), '()\n', (921, 923), False... |
from flask import Response
import json
from src.database.db_model import RecordInformation
class RecordedAPI:
def __init__(self, db_manager, heartbeat_api):
self.db_manager = db_manager
self.heartbeat = heartbeat_api
def get_recorded(self, id):
query = """SELECT ri.order_id,
... | [
"src.database.db_model.RecordInformation",
"json.dumps",
"flask.Response"
] | [((1152, 1196), 'flask.Response', 'Response', (['"""Something went wrong"""'], {'status': '(500)'}), "('Something went wrong', status=500)\n", (1160, 1196), False, 'from flask import Response\n'), ((1444, 1488), 'flask.Response', 'Response', (['"""Something went wrong"""'], {'status': '(500)'}), "('Something went wrong... |
# Copyright (c) 2012-2016 <NAME>
# Copyright (c) 2012-2018 The Bitmessage developers
"""
This is not what you run to run the Bitmessage API. Instead, enable the API
( https://bitmessage.org/wiki/API ) and optionally enable daemon mode
( https://bitmessage.org/wiki/Daemon ) then run bitmessagemain.py.
"""
import base6... | [
"logging.getLogger",
"helper_sql.sqlStoredProcedure",
"helper_sql.sqlExecute",
"binascii.hexlify",
"base64.b64encode",
"helper_sent.insert",
"helper_sql.sqlQuery",
"queues.apiAddressGeneratorReturnQueue.queue.clear",
"queues.addressGeneratorQueue.put",
"proofofwork.run",
"binascii.unhexlify",
... | [((1143, 1171), 'logging.getLogger', 'logging.getLogger', (['"""default"""'], {}), "('default')\n", (1160, 1171), False, 'import logging\n'), ((1229, 1250), 'logging.NullHandler', 'logging.NullHandler', ([], {}), '()\n', (1248, 1250), False, 'import logging\n'), ((2231, 2253), 'addresses.decodeAddress', 'decodeAddress'... |
import common
import json
def get_all(resource_group_name: str):
common.print_info(f"Fetching resources in ResourceGroup {resource_group_name}")
command_result = common.shell_exec(f"az resource list -g {resource_group_name}")
resources = json.loads(command_result.stdout)
return resources
def delete(... | [
"common.print_info",
"json.loads",
"common.shell_exec"
] | [((71, 150), 'common.print_info', 'common.print_info', (['f"""Fetching resources in ResourceGroup {resource_group_name}"""'], {}), "(f'Fetching resources in ResourceGroup {resource_group_name}')\n", (88, 150), False, 'import common\n'), ((172, 235), 'common.shell_exec', 'common.shell_exec', (['f"""az resource list -g {... |
from sklearn import svm
from sklearn import metrics
from sklearn.model_selection import KFold
from mlxtend.feature_selection import SequentialFeatureSelector as SFS
import numpy as np
import pandas as pd
from pathlib import Path
this_dir = Path.cwd()
csv_file = this_dir / "data/pd_speech_features.csv"
df = pd.read_cs... | [
"pandas.read_csv",
"pathlib.Path.cwd",
"sklearn.metrics.precision_score",
"sklearn.metrics.recall_score",
"sklearn.model_selection.KFold",
"sklearn.metrics.accuracy_score",
"sklearn.svm.SVC"
] | [((242, 252), 'pathlib.Path.cwd', 'Path.cwd', ([], {}), '()\n', (250, 252), False, 'from pathlib import Path\n'), ((310, 345), 'pandas.read_csv', 'pd.read_csv', (['csv_file'], {'skiprows': '[0]'}), '(csv_file, skiprows=[0])\n', (321, 345), True, 'import pandas as pd\n'), ((1037, 1087), 'sklearn.model_selection.KFold', ... |
# Generated by Django 4.0.2 on 2022-03-10 17:01
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('forms', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='requestform',
name='currency',
... | [
"django.db.models.CharField"
] | [((330, 532), 'django.db.models.CharField', 'models.CharField', ([], {'choices': "[('Bitcoin', 'Bitcoin'), ('Dollars', 'Dollars'), ('Etherum', 'Etherum'), (\n 'Pounds Sterling', 'Pounds Sterling'), ('Naira', 'Naira'), ('Euro', 'Euro')\n ]", 'max_length': '(2000)'}), "(choices=[('Bitcoin', 'Bitcoin'), ('Dollars', ... |
from django.db.models.signals import post_save, pre_save, post_delete
from django.contrib.auth.models import User
from .models import UserProfile
def create_profile(sender, instance, created, **kwargs):
if created:
UserProfile.objects.create(
user=instance,
name=instance.username,
username=instan... | [
"django.db.models.signals.post_save.connect"
] | [((736, 782), 'django.db.models.signals.post_save.connect', 'post_save.connect', (['create_profile'], {'sender': 'User'}), '(create_profile, sender=User)\n', (753, 782), False, 'from django.db.models.signals import post_save, pre_save, post_delete\n'), ((783, 829), 'django.db.models.signals.post_save.connect', 'post_sa... |
import setuptools
from pathlib import Path
this_directory = Path(__file__).parent
long_description = (this_directory / "README.md").read_text()
setuptools.setup(
name='valentine',
version='0.1.4',
description='Valentine Matcher',
license_files=('LICENSE',),
author='<NAME>',
author_email='<EMAI... | [
"setuptools.find_packages",
"pathlib.Path"
] | [((61, 75), 'pathlib.Path', 'Path', (['__file__'], {}), '(__file__)\n', (65, 75), False, 'from pathlib import Path\n'), ((536, 593), 'setuptools.find_packages', 'setuptools.find_packages', ([], {'exclude': "('tests*', 'examples*')"}), "(exclude=('tests*', 'examples*'))\n", (560, 593), False, 'import setuptools\n')] |
# Generated by Django 2.2.10 on 2020-02-26 19:53
import json
import pkgutil
from django.db import migrations
from django.db import models
class Migration(migrations.Migration):
dependencies = [("api", "0012_auto_20200225_2022")]
operations = [
migrations.AddField(
model_name="costmodelm... | [
"django.db.models.TextField"
] | [((388, 504), 'django.db.models.TextField', 'models.TextField', ([], {'choices': "[('Infrastructure', 'Infrastructure'), ('Supplementary', 'Supplementary')]", 'null': '(True)'}), "(choices=[('Infrastructure', 'Infrastructure'), (\n 'Supplementary', 'Supplementary')], null=True)\n", (404, 504), False, 'from django.db... |
# -*- coding: utf-8 -*-
# ----------------------------------------------------------------------
# Copyright (c) 2021
#
# See the LICENSE file for details
# see the AUTHORS file for authors
# ----------------------------------------------------------------------
#--------------------
# System wide imports
# ----------... | [
"logging.getLogger",
"streetool.utils.paging",
"statistics.mean",
"PIL.Image.open",
"numpy.unique",
"numpy.average",
"numpy.where",
"matplotlib.widgets.Button",
"streetool.utils.get_image",
"numpy.array",
"matplotlib.pyplot.subplots",
"sklearn.cluster.DBSCAN",
"matplotlib.pyplot.show"
] | [((780, 811), 'logging.getLogger', 'logging.getLogger', (['"""streetoool"""'], {}), "('streetoool')\n", (797, 811), False, 'import logging\n'), ((8498, 8538), 'streetool.utils.paging', 'paging', ([], {'iterable': 'cursor', 'headers': 'headers'}), '(iterable=cursor, headers=headers)\n', (8504, 8538), False, 'from street... |
"""Testing the MutableBaseModel and NewBaseModel objects of cbc_sdk.base"""
import pytest
import logging
from cbc_sdk.base import MutableBaseModel, NewBaseModel
from cbc_sdk.endpoint_standard import Policy, Event, Recommendation
from cbc_sdk.platform import Process
from cbc_sdk.rest_api import CBCloudAPI
from cbc_sdk.... | [
"logging.basicConfig",
"cbc_sdk.endpoint_standard.Event",
"cbc_sdk.base.NewBaseModel",
"cbc_sdk.base.MutableBaseModel",
"cbc_sdk.endpoint_standard.Event.new_object",
"cbc_sdk.endpoint_standard.Recommendation",
"pytest.raises",
"tests.unit.fixtures.CBCSDKMock.CBCSDKMock",
"cbc_sdk.endpoint_standard.P... | [((1450, 1563), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s %(levelname)s:%(message)s"""', 'level': 'logging.DEBUG', 'filename': '"""log.txt"""'}), "(format='%(asctime)s %(levelname)s:%(message)s', level=\n logging.DEBUG, filename='log.txt')\n", (1469, 1563), False, 'import logging\... |
#!/usr/bin/env python3
import argparse
import copy
from collections import defaultdict
from pathlib import Path
import os
import sys
import time
import numpy as np
import pandas as pd
from sklearn.metrics import f1_score, precision_recall_fscore_support, log_loss, average_precision_score
import torch
import torch.opt... | [
"apex.amp.scale_loss",
"src.factory.get_model",
"src.utils.load_model",
"numpy.array",
"apex.amp.initialize",
"copy.deepcopy",
"src.factory.get_loader_train",
"os.path.exists",
"argparse.ArgumentParser",
"pathlib.Path",
"src.utils.save_pickle",
"torch.mean",
"src.utils.get_logger",
"src.ut... | [((1436, 1459), 'json.load', 'json.load', (['setting_json'], {}), '(setting_json)\n', (1445, 1459), False, 'import json\n'), ((1568, 1622), 'src.utils.get_logger', 'get_logger', (["(output_dir / f'fold{args.fold}_output.log')"], {}), "(output_dir / f'fold{args.fold}_output.log')\n", (1578, 1622), False, 'from src.utils... |
# Generated by Django 3.0.4 on 2020-03-15 04:06
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('pollumeterbeta', '0006_auto_20200314_2046'),
]
operations = [
migrations.RenameField(
model_name='pollimetermodel',
old_name... | [
"django.db.migrations.RemoveField",
"django.db.migrations.RenameField"
] | [((234, 336), 'django.db.migrations.RenameField', 'migrations.RenameField', ([], {'model_name': '"""pollimetermodel"""', 'old_name': '"""fac_avg_speed"""', 'new_name': '"""indpro"""'}), "(model_name='pollimetermodel', old_name=\n 'fac_avg_speed', new_name='indpro')\n", (256, 336), False, 'from django.db import migra... |
'''
Created on Feb 22, 2020
@author: ballance
'''
class Backend():
_inst = None
def event(self):
raise Exception("Backend.event() unimplemented")
def delay(self, time_ps, units=None):
raise Exception("Backend.delay() unimplemented")
def delta(self):
raise Ex... | [
"cocotb.triggers.Event",
"cocotb.triggers.Timer",
"cocotb.triggers.Join",
"cocotb.fork",
"cocotb.triggers.Lock"
] | [((1071, 1078), 'cocotb.triggers.Event', 'Event', ([], {}), '()\n', (1076, 1078), False, 'from cocotb.triggers import Event\n'), ((1183, 1204), 'cocotb.triggers.Timer', 'Timer', (['time_ps', 'units'], {}), '(time_ps, units)\n', (1188, 1204), False, 'from cocotb.triggers import Timer\n'), ((1351, 1357), 'cocotb.triggers... |
#!flask/bin/python
# -- coding: utf-8 --
__author__ = 'cloudtogo'
from flask import render_template
from flask import Flask
import os
import ctypes
import sys
app = Flask(__name__)
reload(sys)
sys.setdefaultencoding('utf8')
###########################################################################... | [
"flask.render_template",
"sys.setdefaultencoding",
"flask.Flask"
] | [((177, 192), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (182, 192), False, 'from flask import Flask\n'), ((209, 239), 'sys.setdefaultencoding', 'sys.setdefaultencoding', (['"""utf8"""'], {}), "('utf8')\n", (231, 239), False, 'import sys\n'), ((753, 791), 'flask.render_template', 'render_template', (['... |
# coding=UTF-8
import numpy as np
import videoseam as vs
class weights_delegate(object):
"""Delegate class to manage the weightning for the graph construction"""
def __init__(self, parent, fill_with=np.inf, ndim=3):
super(weights_delegate, self).__init__()
self.parent = parent
self.fill_with = fill_wi... | [
"numpy.abs",
"numpy.zeros"
] | [((2218, 2242), 'numpy.zeros', 'np.zeros', (['((1,) + I.shape)'], {}), '((1,) + I.shape)\n', (2226, 2242), True, 'import numpy as np\n'), ((3384, 3408), 'numpy.zeros', 'np.zeros', (['((1,) + I.shape)'], {}), '((1,) + I.shape)\n', (3392, 3408), True, 'import numpy as np\n'), ((4446, 4470), 'numpy.zeros', 'np.zeros', (['... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*
#/// DEPENDENCIES
import discord #python3.7 -m pip install -U discord.py
import logging
import random
from util import pages
from discord.ext import commands
from discord.ext.commands import Bot, MissingPermissions, has_permissions
from chk.enbl import e... | [
"util.pages.PageThis",
"random.choice",
"util.ez.wrap",
"discord.ext.commands.check",
"discord.ext.commands.command"
] | [((448, 643), 'discord.ext.commands.command', 'commands.command', ([], {'aliases': '[]', 'help': '"""fun"""', 'brief': '"""Flips a virtual coin {x} times!"""', 'usage': '""";]coin {?count}"""', 'description': '"""COUNT [NUMBER] - How many times the coin should be flipped\n"""'}), '(aliases=[], help=\'fun\', brief=\n ... |
#tests/tests_basics.py
import unittest
from flask import current_app
from app import create_app, db
class BasicTestCase(unittest.TestCase):
#setUp and teardown will be called before and after each test respectively
def setUp(self):
#Create app and configure it for testing
self.app = create_app... | [
"app.db.create_all",
"app.db.drop_all",
"app.create_app",
"app.db.session.remove"
] | [((310, 331), 'app.create_app', 'create_app', (['"""testing"""'], {}), "('testing')\n", (320, 331), False, 'from app import create_app, db\n'), ((487, 502), 'app.db.create_all', 'db.create_all', ([], {}), '()\n', (500, 502), False, 'from app import create_app, db\n'), ((571, 590), 'app.db.session.remove', 'db.session.r... |
import os
import random
from typing import List
import numpy as np
import pandas as pd
from tqdm import tqdm
def fix_random_seed(seed: int = 42) -> None:
"""
乱数のシードを固定する。
Parameters
----------
seed : int
乱数のシード。
"""
os.environ['PYTHONHASHSEED'] = str(seed)
random.see... | [
"pandas.DataFrame",
"numpy.random.seed",
"random.seed",
"pandas.read_csv"
] | [((310, 327), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (321, 327), False, 'import random\n'), ((332, 352), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (346, 352), True, 'import numpy as np\n'), ((733, 867), 'pandas.read_csv', 'pd.read_csv', (['input_filepath'], {'sep': '"""\\\\s+... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division
from psychopy import locale_setup, visual, core
import numpy as np
from psychopy.hardware import keyboard
from psychopy import misc
def createPalette(size):
"""
Creates the color palette array in HSV and returns as... | [
"psychopy.visual.Rect",
"psychopy.core.quit",
"numpy.ones",
"psychopy.misc.hsv2rgb",
"psychopy.visual.Slider",
"psychopy.visual.TextStim",
"numpy.linspace",
"numpy.zeros",
"psychopy.hardware.keyboard.Keyboard",
"psychopy.visual.Window",
"psychopy.visual.ImageStim"
] | [((1159, 1222), 'psychopy.visual.Window', 'visual.Window', ([], {'size': '[1920, 1080]', 'fullscr': '(False)', 'units': '"""height"""'}), "(size=[1920, 1080], fullscr=False, units='height')\n", (1172, 1222), False, 'from psychopy import locale_setup, visual, core\n'), ((1239, 1347), 'psychopy.visual.ImageStim', 'visual... |
from zope.interface import Interface, Attribute
class IWidget(Interface):
content = Attribute('Content of widget')
pos_x = Attribute('X position of widget')
pos_y = Attribute('Y position of widget')
width = Attribute('Width of widget')
height = Attribute('Height of widget')
parent = Attribute... | [
"zope.interface.Attribute"
] | [((91, 121), 'zope.interface.Attribute', 'Attribute', (['"""Content of widget"""'], {}), "('Content of widget')\n", (100, 121), False, 'from zope.interface import Interface, Attribute\n'), ((134, 167), 'zope.interface.Attribute', 'Attribute', (['"""X position of widget"""'], {}), "('X position of widget')\n", (143, 167... |
# -*- coding: utf-8 -*-
import pytest
from ci_release_publisher import config, latest_release
tag_name_tests = [
('branch', ['{}-branch-{}', '{}{}-branch-{}']),
('-branch-_name-', ['{}--branch-_name--{}', '{}{}--branch-_name--{}']),
]
def test_tag_name():
for branch, expected in tag_name_tests:
... | [
"ci_release_publisher.latest_release._tag_name",
"ci_release_publisher.latest_release._break_tag_name",
"ci_release_publisher.latest_release._tag_name_tmp",
"ci_release_publisher.latest_release._break_tag_name_tmp"
] | [((468, 506), 'ci_release_publisher.latest_release._break_tag_name', 'latest_release._break_tag_name', (['expect'], {}), '(expect)\n', (498, 506), False, 'from ci_release_publisher import config, latest_release\n'), ((834, 876), 'ci_release_publisher.latest_release._break_tag_name_tmp', 'latest_release._break_tag_name_... |
from scipy.stats import multivariate_normal # 生成多维概率分布的方法
import numpy as np
class GaussianMixture:
def __init__(self, n_components: int = 1, covariance_type: str = 'full',
tol: float = 0.001, reg_covar: float = 1e-06, max_iter: int = 100):
self.n_components = n_components
self.m... | [
"numpy.identity",
"numpy.ones",
"scipy.stats.multivariate_normal",
"matplotlib.pyplot.clf",
"numpy.argmax",
"numpy.fill_diagonal",
"numpy.sum",
"numpy.zeros",
"sklearn.datasets.samples_generator.make_blobs",
"model_selection.train_test_split.train_test_split",
"matplotlib.pyplot.scatter",
"num... | [((3113, 3184), 'sklearn.datasets.samples_generator.make_blobs', 'make_blobs', ([], {'cluster_std': '(1.5)', 'random_state': '(42)', 'n_samples': '(1000)', 'centers': '(3)'}), '(cluster_std=1.5, random_state=42, n_samples=1000, centers=3)\n', (3123, 3184), False, 'from sklearn.datasets.samples_generator import make_blo... |
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.pyplot import gca
import matplotlib as mb
path = r'D:\data\20200213\100602_awg_sweep'
data_name = path+path[16:]+r'.dat'
data = np.loadtxt(data_name, unpack=True)
n = 701
# print(len(data[0]))
# print(len(data[0])/601.0)
curr = np.arra... | [
"numpy.array_split",
"numpy.rot90",
"matplotlib.pyplot.title",
"numpy.loadtxt",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show"
] | [((207, 241), 'numpy.loadtxt', 'np.loadtxt', (['data_name'], {'unpack': '(True)'}), '(data_name, unpack=True)\n', (217, 241), True, 'import numpy as np\n'), ((313, 339), 'numpy.array_split', 'np.array_split', (['data[0]', 'n'], {}), '(data[0], n)\n', (327, 339), True, 'import numpy as np\n'), ((385, 411), 'numpy.array_... |
# Note: this file was automatically converted to Python from the
# original steve-language source code. Please see the original
# file for more detailed comments and documentation.
import breve
class RegressionController( breve.Control ):
def __init__( self ):
breve.Control.__init__( self )
RegressionControll... | [
"breve.Control.__init__",
"breve.createInstances",
"breve.PushGP.__init__"
] | [((269, 297), 'breve.Control.__init__', 'breve.Control.__init__', (['self'], {}), '(self)\n', (291, 297), False, 'import breve\n'), ((358, 402), 'breve.createInstances', 'breve.createInstances', (['breve.RegressionGP', '(1)'], {}), '(breve.RegressionGP, 1)\n', (379, 402), False, 'import breve\n'), ((518, 545), 'breve.P... |
import json
import platform
import subprocess
import time
import requests
from ._version import __version__ # noqa: F401
class NotificationError(Exception):
'''Notification Error'''
pass
class BaseNotification:
'''Notification Superclass'''
def set_typed_variable(self, value, specified_type):
... | [
"requests.post",
"subprocess.run",
"win10toast.ToastNotifier",
"json.dumps",
"time.sleep",
"platform.system"
] | [((1503, 1520), 'platform.system', 'platform.system', ([], {}), '()\n', (1518, 1520), False, 'import platform\n'), ((4859, 4878), 'subprocess.run', 'subprocess.run', (['cmd'], {}), '(cmd)\n', (4873, 4878), False, 'import subprocess\n'), ((7690, 7709), 'subprocess.run', 'subprocess.run', (['cmd'], {}), '(cmd)\n', (7704,... |
"""
Weekly task 5
Write a program that outputs whether or not today is a weekday. An example of running this program on a Thursday is given below.
$ python weekday.py
Yes, unfortunately today is a weekday.
An example of running it on a Saturday is as follows.
$ python weekday.py
It is the weekend, yay!
"""
from da... | [
"datetime.datetime.now"
] | [((349, 363), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (361, 363), False, 'from datetime import datetime\n')] |
"""The manager module provides the :class:`CacheManager` class."""
from threading import RLock
import typing as t
from .cache import Cache
class CacheManager:
"""
The cache manager provides an interface for accessing multiple caches indexed by name.
Each named cache is a separate cache instance with it... | [
"threading.RLock"
] | [((2036, 2043), 'threading.RLock', 'RLock', ([], {}), '()\n', (2041, 2043), False, 'from threading import RLock\n')] |
""" Cisco_IOS_XR_tty_management_cmd_oper
This module contains a collection of YANG definitions
for Cisco IOS\-XR tty\-management\-cmd package operational data.
This module contains definitions
for the following management objects\:
show\-users\: Show users statistics
Copyright (c) 2013\-2016 by Cisco Systems, Inc... | [
"ydk.types.YList",
"ydk.errors.YPYModelError"
] | [((1464, 1471), 'ydk.types.YList', 'YList', ([], {}), '()\n', (1469, 1471), False, 'from ydk.types import Empty, YList, YLeafList, DELETE, Decimal64, FixedBitsDict\n'), ((3088, 3136), 'ydk.errors.YPYModelError', 'YPYModelError', (['"""Key property session_id is None"""'], {}), "('Key property session_id is None')\n", (... |
import re
import collections
import xml.etree.ElementTree as ET
import itertools
from . import DEFAULT_CP2K_INPUT_XML
class GeneratorError(Exception):
pass
class SectionNotFoundError(Exception):
pass
class KeywordNotFoundError(Exception):
pass
class SectionParametersNotFoundError(Exception):
pa... | [
"collections.namedtuple",
"xml.etree.ElementTree.parse",
"re.search"
] | [((556, 632), 'collections.namedtuple', 'collections.namedtuple', (['"""TreeNode"""', "['name', 'dictref', 'xmlnode', 'indent']"], {}), "('TreeNode', ['name', 'dictref', 'xmlnode', 'indent'])\n", (578, 632), False, 'import collections\n'), ((1031, 1048), 'xml.etree.ElementTree.parse', 'ET.parse', (['xmlspec'], {}), '(x... |
from backend.core.config_loader import init_configs
from backend.database.migration import run_migrations
from backend.server.server import start_server
if __name__ == '__main__':
# Initialize all configurations
init_configs()
# Run Database Migration Scripts
run_migrations()
# Start Server
s... | [
"backend.server.server.start_server",
"backend.database.migration.run_migrations",
"backend.core.config_loader.init_configs"
] | [((221, 235), 'backend.core.config_loader.init_configs', 'init_configs', ([], {}), '()\n', (233, 235), False, 'from backend.core.config_loader import init_configs\n'), ((278, 294), 'backend.database.migration.run_migrations', 'run_migrations', ([], {}), '()\n', (292, 294), False, 'from backend.database.migration import... |
from src.main import app
import os
if __name__ == "__main__":
app.run(
host=os.environ.get("HOST", "0.0.0.0"),
port=os.environ.get("PORT", 5000),
debug=os.environ.get("DEBUG", False),
)
| [
"os.environ.get"
] | [((89, 122), 'os.environ.get', 'os.environ.get', (['"""HOST"""', '"""0.0.0.0"""'], {}), "('HOST', '0.0.0.0')\n", (103, 122), False, 'import os\n'), ((137, 165), 'os.environ.get', 'os.environ.get', (['"""PORT"""', '(5000)'], {}), "('PORT', 5000)\n", (151, 165), False, 'import os\n'), ((181, 211), 'os.environ.get', 'os.e... |
from django.contrib import admin
from .models import *
admin.site.register(BudgetAccount)
admin.site.register(UserBudget)
admin.site.register(Envelope)
admin.site.register(Transaction)
admin.site.register(ScheduledTransaction)
admin.site.register(SavingsHistory)
| [
"django.contrib.admin.site.register"
] | [((57, 91), 'django.contrib.admin.site.register', 'admin.site.register', (['BudgetAccount'], {}), '(BudgetAccount)\n', (76, 91), False, 'from django.contrib import admin\n'), ((92, 123), 'django.contrib.admin.site.register', 'admin.site.register', (['UserBudget'], {}), '(UserBudget)\n', (111, 123), False, 'from django.... |
import click
from numpy import argmax
from achilles.model import AchillesModel
from achilles.utils import get_dataset_labels
from colorama import Fore
from pathlib import Path
Y = Fore.YELLOW
G = Fore.GREEN
RE = Fore.RESET
@click.command()
@click.option(
"--model",
"-m",
default=None,
help="Model fil... | [
"achilles.model.AchillesModel",
"pathlib.Path",
"click.option",
"numpy.argmax",
"achilles.utils.get_dataset_labels",
"click.command"
] | [((227, 242), 'click.command', 'click.command', ([], {}), '()\n', (240, 242), False, 'import click\n'), ((244, 346), 'click.option', 'click.option', (['"""--model"""', '"""-m"""'], {'default': 'None', 'help': '"""Model file HD5."""', 'show_default': '(True)', 'metavar': '""""""'}), "('--model', '-m', default=None, help... |
#!python3.6
#http://blog.mudatobunka.org/entry/2016/05/08/154934
import difflib
str1 = "スパゲッティー"
str2 = "スパゲティ"
s = difflib.SequenceMatcher(None, str1, str2).ratio()
print(str1, "<~>", str2)
print("match ratio:", s, "\n")
# 半角と全角は0.0%になってしまう
strs = [
"スパゲティ",
"スパゲティー",
"スパゲッティ",
"スパゲッティー",
u"スパゲ... | [
"difflib.SequenceMatcher",
"unicodedata.normalize"
] | [((732, 767), 'unicodedata.normalize', 'unicodedata.normalize', (['"""NFKC"""', 'str1'], {}), "('NFKC', str1)\n", (753, 767), False, 'import unicodedata\n'), ((790, 825), 'unicodedata.normalize', 'unicodedata.normalize', (['"""NFKC"""', 'str2'], {}), "('NFKC', str2)\n", (811, 825), False, 'import unicodedata\n'), ((117... |
# pylint: disable=no-self-use
import unittest
from unittest.mock import patch, MagicMock
from app.data_model.answer_store import Answer, AnswerStore, upgrade_to_1_update_date_formats, upgrade_to_2_add_group_instance_id
from app.questionnaire.questionnaire_schema import QuestionnaireSchema
class TestAnswer(unittest.T... | [
"app.questionnaire.questionnaire_schema.QuestionnaireSchema",
"unittest.mock.MagicMock",
"app.data_model.answer_store.Answer",
"app.data_model.answer_store.AnswerStore",
"unittest.mock.patch"
] | [((610, 678), 'app.data_model.answer_store.Answer', 'Answer', ([], {'answer_id': '"""4"""', 'answer_instance': '(1)', 'group_instance': '(1)', 'value': '(25)'}), "(answer_id='4', answer_instance=1, group_instance=1, value=25)\n", (616, 678), False, 'from app.data_model.answer_store import Answer, AnswerStore, upgrade_t... |
#!/usr/bin/env python3
import argparse
import os
import random
import torch
import sys
from pathlib import Path
from torch.autograd import Variable
sys.path.append("../..")
from core.prediction import RNNPredictor
from core.corpus import Corpus
from core.data_processor import PennTreeBankProcessor
from core.common_help... | [
"core.corpus.Corpus.load",
"argparse.ArgumentParser",
"pathlib.Path",
"core.common_helpers.TorchHelper.set_seed",
"core.common_helpers.TorchHelper.load",
"core.prediction.RNNPredictor",
"argparse.ArgumentTypeError",
"core.data_processor.PennTreeBankProcessor",
"sys.path.append",
"torch.zeros"
] | [((148, 172), 'sys.path.append', 'sys.path.append', (['"""../.."""'], {}), "('../..')\n", (163, 172), False, 'import sys\n'), ((748, 773), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (771, 773), False, 'import argparse\n'), ((2371, 2386), 'pathlib.Path', 'Path', (['file_path'], {}), '(file_p... |
from django.db import models
from datetime import datetime, date
community_choice = (
('Syro-Malabar','SYRO-MALABAR'),
('Latin', 'LATIN'),
('Malankara','MALANKARA'),
)
fam_choice = (
('Low','LOW'),
('Middle', 'MIDDLE'),
('Upper Middle','UPPER MIDDLE'),
('Rich','RICH'),
)
# Create your mode... | [
"django.db.models.EmailField",
"datetime.datetime.now",
"django.db.models.CharField"
] | [((369, 423), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(50)', 'blank': '(True)', 'null': '(True)'}), '(max_length=50, blank=True, null=True)\n', (385, 423), False, 'from django.db import models\n'), ((438, 493), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(200)',... |
import cv2 as cv
import numpy as np
from colorthief import ColorThief
from AreaSelector.area_collector import AreaCollector
if __name__ == "__main__":
path_to_image = 'data/chris.jpeg'
path_output_image = 'data/rectOut.bmp'
image_array = cv.imread(path_to_image)
image_array = cv.cvtColor(image_array, ... | [
"AreaSelector.area_collector.AreaCollector",
"cv2.imread",
"cv2.cvtColor",
"colorthief.ColorThief"
] | [((252, 276), 'cv2.imread', 'cv.imread', (['path_to_image'], {}), '(path_to_image)\n', (261, 276), True, 'import cv2 as cv\n'), ((295, 337), 'cv2.cvtColor', 'cv.cvtColor', (['image_array', 'cv.COLOR_BGR2RGB'], {}), '(image_array, cv.COLOR_BGR2RGB)\n', (306, 337), True, 'import cv2 as cv\n'), ((356, 381), 'colorthief.Co... |
import torch
import torch.nn as nn
from .transporter_encoder import TransporterBlock
class TransporterDecoder(nn.Module):
def __init__(self, config: dict):
""" Creates class instance.
Decoder consists of a series of Transporter blocks,
consisting of stride 1 convolutions and 2D ... | [
"torch.nn.Sequential",
"torch.nn.UpsamplingBilinear2d"
] | [((3121, 3155), 'torch.nn.Sequential', 'nn.Sequential', (['*transporter_blocks'], {}), '(*transporter_blocks)\n', (3134, 3155), True, 'import torch.nn as nn\n'), ((2389, 2428), 'torch.nn.UpsamplingBilinear2d', 'nn.UpsamplingBilinear2d', ([], {'scale_factor': '(2)'}), '(scale_factor=2)\n', (2412, 2428), True, 'import to... |
from mock import Mock, sentinel, patch
import pytest
import selenium
import pytest_webdriver
def test_browser_to_use():
caps = Mock(CHROME=sentinel.chrome, UNKNOWN=None)
wd = Mock(DesiredCapabilities = Mock(return_value = caps))
assert pytest_webdriver.browser_to_use(wd, 'chrome') == sentinel.chrome
... | [
"mock.Mock",
"pytest.raises",
"pytest_webdriver.browser_to_use"
] | [((134, 176), 'mock.Mock', 'Mock', ([], {'CHROME': 'sentinel.chrome', 'UNKNOWN': 'None'}), '(CHROME=sentinel.chrome, UNKNOWN=None)\n', (138, 176), False, 'from mock import Mock, sentinel, patch\n'), ((251, 296), 'pytest_webdriver.browser_to_use', 'pytest_webdriver.browser_to_use', (['wd', '"""chrome"""'], {}), "(wd, 'c... |
#!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | [
"restapp.RestApp",
"google.appengine.api.users.get_current_user",
"webapp2.Response"
] | [((718, 756), 'restapp.RestApp', 'restapp.RestApp', (['"""/api/v1"""'], {'debug': '(True)'}), "('/api/v1', debug=True)\n", (733, 756), False, 'import restapp\n'), ((835, 868), 'webapp2.Response', 'webapp2.Response', (['"""AUUUUUUTH!!!!"""'], {}), "('AUUUUUUTH!!!!')\n", (851, 868), False, 'import webapp2\n'), ((1256, 12... |
DOCUMENTATION = r"""
inventory: publicapis
plugin_type: inventory
author:
- <NAME> (@sean-m-sullivan)
short_description: Creates an inventory from an API
version_added: "2.12.3"
description:
- Creates an inventory from an API
options:
validate_certs:
descrip... | [
"requests.get",
"ansible.errors.AnsibleError"
] | [((1180, 1247), 'ansible.errors.AnsibleError', 'AnsibleError', (['"""Python requests module is required for this plugin."""'], {}), "('Python requests module is required for this plugin.')\n", (1192, 1247), False, 'from ansible.errors import AnsibleError, AnsibleParserError\n'), ((1685, 1744), 'requests.get', 'requests... |
import numpy as np
import numpy.random as random
import matplotlib.pyplot as plt
amplitude = eval( input( "Enter amplitude of impulse noise: " ) )
probability = eval( input( "Enter probability of impulse noise(%): " ) )
t = np.linspace( 0, 1, 200, endpoint = False ) # 定義時間陣列
x = 10 * np.cos( 2 * np.pi * 5 * t ) #... | [
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.linspace",
"matplotlib.pyplot.figure",
"numpy.zeros",
"matplotlib.pyplot.stem",
"numpy.cos",
"numpy.random.uniform",
"matplotlib.pyplot.axis",
"matplotlib.pyplot.show"
] | [((226, 264), 'numpy.linspace', 'np.linspace', (['(0)', '(1)', '(200)'], {'endpoint': '(False)'}), '(0, 1, 200, endpoint=False)\n', (237, 264), True, 'import numpy as np\n'), ((335, 351), 'numpy.zeros', 'np.zeros', (['x.size'], {}), '(x.size)\n', (343, 351), True, 'import numpy as np\n'), ((573, 586), 'matplotlib.pyplo... |
# Copyright 2021 <NAME>
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software... | [
"logging.getLogger",
"libsbml.writeSBMLToFile",
"re.compile",
"cobra.io.sbml._parse_annotations",
"cobra.io.sbml._parse_notes_dict",
"libsbml.SyntaxChecker.isValidSBMLSId",
"cobra.io.sbml.Gene",
"cobra.io.sbml._create_bound",
"cobra.io.sbml._create_parameter",
"cobra.io.sbml._sbase_annotations",
... | [((1986, 2013), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (2003, 2013), False, 'import logging\n'), ((2023, 2038), 'cobra.Configuration', 'Configuration', ([], {}), '()\n', (2036, 2038), False, 'from cobra import Configuration\n'), ((2055, 2152), 're.compile', 're.compile', (['"""pro... |
import sys
if sys.version_info < (3, 8):
exit('This game requires Python 3.8+')
import os
from pathlib import Path
import subprocess
HERE = Path(__file__).parent
venv_path = HERE / 'venv'
possible_python_locations = 'bin/python', 'scripts/python'
def run(args, **kwargs):
kwargs.setdefault('check', True)
... | [
"subprocess.run",
"pathlib.Path"
] | [((147, 161), 'pathlib.Path', 'Path', (['__file__'], {}), '(__file__)\n', (151, 161), False, 'from pathlib import Path\n'), ((376, 406), 'subprocess.run', 'subprocess.run', (['args'], {}), '(args, **kwargs)\n', (390, 406), False, 'import subprocess\n'), ((728, 752), 'pathlib.Path', 'Path', (['"""requirements.txt"""'], ... |
import json
from datetime import datetime
from discord.ext import commands
from .util import send_embed_message
from MongoDB.Connector import Connector
import pathlib
path = pathlib.Path(__file__).parent.absolute()
class Corona(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command(p... | [
"MongoDB.Connector.Connector",
"pathlib.Path",
"json.load",
"discord.ext.commands.command",
"json.dump"
] | [((302, 482), 'discord.ext.commands.command', 'commands.command', ([], {'pass_context': '(True)', 'description': '"""Given country, it shows the specific cases inside that country, otherwise it shows general information about the virus."""'}), "(pass_context=True, description=\n 'Given country, it shows the specific... |
# Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | [
"tensorflow.train.NewCheckpointReader",
"argparse.ArgumentParser",
"re.compile",
"json.dumps",
"os.path.join",
"re.match",
"tensorflow.gfile.MakeDirs",
"os.path.expanduser"
] | [((1341, 1382), 'os.path.expanduser', 'os.path.expanduser', (['FLAGS.checkpoint_file'], {}), '(FLAGS.checkpoint_file)\n', (1359, 1382), False, 'import os\n'), ((1394, 1433), 'tensorflow.train.NewCheckpointReader', 'tf.train.NewCheckpointReader', (['chk_fpath'], {}), '(chk_fpath)\n', (1422, 1433), True, 'import tensorfl... |
from collections import namedtuple
import numpy as np
from scipy.interpolate import Akima1DInterpolator as Akima
import openmdao.api as om
"""United States standard atmosphere 1976 tables, data obtained from http://www.digitaldutch.com/atmoscalc/index.htm"""
USatm1976Data = namedtuple("USatm1976Data", ["al... | [
"numpy.array",
"collections.namedtuple",
"scipy.interpolate.Akima1DInterpolator"
] | [((288, 376), 'collections.namedtuple', 'namedtuple', (['"""USatm1976Data"""', "['alt', 'T', 'P', 'rho', 'speed_of_sound', 'viscosity']"], {}), "('USatm1976Data', ['alt', 'T', 'P', 'rho', 'speed_of_sound',\n 'viscosity'])\n", (298, 376), False, 'from collections import namedtuple\n'), ((398, 1244), 'numpy.array', 'n... |
import unittest
import io
from ppci import ir
from ppci.irutils import verify_module
from ppci.lang.c import CBuilder
from ppci.lang.c.options import COptions
from ppci.arch.example import ExampleArch
from ppci.lang.c import CSynthesizer
class CSynthesizerTestCase(unittest.TestCase):
def test_hello(self):
... | [
"ppci.arch.example.ExampleArch",
"ppci.irutils.verify_module",
"ppci.lang.c.options.COptions",
"ppci.lang.c.CSynthesizer",
"unittest.main",
"io.StringIO"
] | [((846, 861), 'unittest.main', 'unittest.main', ([], {}), '()\n', (859, 861), False, 'import unittest\n'), ((517, 530), 'ppci.arch.example.ExampleArch', 'ExampleArch', ([], {}), '()\n', (528, 530), False, 'from ppci.arch.example import ExampleArch\n'), ((593, 609), 'io.StringIO', 'io.StringIO', (['src'], {}), '(src)\n'... |
from django.urls import path
from . import views
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
path('block_printing',views.block_printing,name='block_printing'),
]
urlpatterns = urlpatterns + static(settings.MEDIA_URL,document_root=settings.MEDIA_ROOT) | [
"django.conf.urls.static.static",
"django.urls.path"
] | [((146, 213), 'django.urls.path', 'path', (['"""block_printing"""', 'views.block_printing'], {'name': '"""block_printing"""'}), "('block_printing', views.block_printing, name='block_printing')\n", (150, 213), False, 'from django.urls import path\n'), ((244, 305), 'django.conf.urls.static.static', 'static', (['settings.... |
import os
import string
from ast import literal_eval
import numpy as np
import operator
from random import shuffle
import gc
import EmbeddingsManager as em
from nltk import sent_tokenize
import re
import random
from collections import OrderedDict
SOS_TOKEN = 0 # Start of sentence token
EOS_TOKEN = 1 # End of sent... | [
"random.shuffle",
"numpy.ones",
"os.path.join",
"EmbeddingsManager.EmbeddingsManager",
"numpy.max",
"ast.literal_eval",
"numpy.array",
"nltk.sent_tokenize",
"gc.collect",
"re.sub",
"operator.itemgetter"
] | [((15227, 15347), 'EmbeddingsManager.EmbeddingsManager', 'em.EmbeddingsManager', (['"""./embeddings/glove.6B.50d.txt"""', '(50)', '(10000)', 'processor.vocabulary', 'processor.sorted_vocabulary'], {}), "('./embeddings/glove.6B.50d.txt', 50, 10000, processor.\n vocabulary, processor.sorted_vocabulary)\n", (15247, 153... |
import os
import numpy as np
import cv2
import sys
import argparse
import pathlib
import glob
import time
sys.path.append('../../')
from util import env, inverse, project_so, make_dirs
from mesh import Mesh
import scipy.io as sio
"""
Draw a 3 by n point cloud using open3d library
"""
def draw(vertex):
import o... | [
"open3d.PointCloud",
"util.project_so",
"open3d.draw_geometries",
"numpy.array",
"numpy.loadtxt",
"numpy.linalg.norm",
"sys.path.append",
"argparse.ArgumentParser",
"numpy.random.seed",
"numpy.concatenate",
"numpy.random.permutation",
"open3d.voxel_down_sample",
"numpy.eye",
"open3d.Vector... | [((106, 131), 'sys.path.append', 'sys.path.append', (['"""../../"""'], {}), "('../../')\n", (121, 131), False, 'import sys\n'), ((452, 457), 'util.env', 'env', ([], {}), '()\n', (455, 457), False, 'from util import env, inverse, project_so, make_dirs\n'), ((684, 746), 'argparse.ArgumentParser', 'argparse.ArgumentParser... |
from datetime import datetime, timezone
from unittest import TestCase
from coordinates_label_photos.coordinates import Coordinates
from coordinates_label_photos.gpx import gpx_parser
class TestCoordinatesCollection(TestCase):
filename = 'resources/photo-gps/track.gpx'
coords_collection = gpx_parser(filename)... | [
"datetime.datetime",
"coordinates_label_photos.gpx.gpx_parser",
"coordinates_label_photos.coordinates.Coordinates"
] | [((300, 320), 'coordinates_label_photos.gpx.gpx_parser', 'gpx_parser', (['filename'], {}), '(filename)\n', (310, 320), False, 'from coordinates_label_photos.gpx import gpx_parser\n'), ((720, 772), 'datetime.datetime', 'datetime', (['(2022)', '(3)', '(6)', '(10)', '(28)', '(0)'], {'tzinfo': 'timezone.utc'}), '(2022, 3, ... |
# Copyright 2017 Google LLC.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
#... | [
"six.b",
"deepvariant.realigner.python.ssw.Filter",
"absl.testing.absltest.main",
"deepvariant.realigner.python.ssw.Aligner.construct"
] | [((3158, 3173), 'absl.testing.absltest.main', 'absltest.main', ([], {}), '()\n', (3171, 3173), False, 'from absl.testing import absltest\n'), ((2036, 2192), 'deepvariant.realigner.python.ssw.Aligner.construct', 'ssw.Aligner.construct', ([], {'match_score': 'match', 'mismatch_penalty': 'mismatch', 'gap_opening_penalty':... |
import math
from time import time as _time
from typing import Iterator, Tuple
_YEAR = 33177600
_MOON = 2764800
_DAY = 86400
_HOUR = 3600
_MINUTE = 60
_SECOND = 1
_EORZEA_MINUTE = 60
_EORZEA_BELL = 60
_EORZEA_SUN = 24
_EORZEA_MOON = 32
_EORZEA_YEAR = 12
_EORZEA_TIME_CONST = 3600.0 / 175.0
_MILLISECOND_EORZEA_PER_MINUTE... | [
"math.ceil",
"time.time"
] | [((1752, 1802), 'math.ceil', 'math.ceil', (['(eorzea_timestamp / _MOON % _EORZEA_YEAR)'], {}), '(eorzea_timestamp / _MOON % _EORZEA_YEAR)\n', (1761, 1802), False, 'import math\n'), ((1817, 1866), 'math.ceil', 'math.ceil', (['(eorzea_timestamp / _DAY % _EORZEA_MOON)'], {}), '(eorzea_timestamp / _DAY % _EORZEA_MOON)\n', ... |
import time
import os
import gym
import gym_panda
import reflexxes
import pybullet as p
import math
import numpy as np
import cv2
import pandas as pd
class MovementData:
def __init__(self, id):
self.mov_id=id
self.currentPosition = [0.0, 0.0, 0.0]*2
self.currentVelocity = [0.0, 0.0, 0.0]*2
... | [
"cv2.imwrite",
"pybullet.getMatrixFromQuaternion",
"os.path.exists",
"numpy.sqrt",
"pandas.DataFrame",
"os.makedirs",
"pybullet.getBasePositionAndOrientation",
"time.sleep",
"cv2.cvtColor",
"pybullet.stepSimulation",
"gym.make",
"pybullet.getLinkState"
] | [((4247, 4283), 'cv2.cvtColor', 'cv2.cvtColor', (['rgb', 'cv2.COLOR_RGB2BGR'], {}), '(rgb, cv2.COLOR_RGB2BGR)\n', (4259, 4283), False, 'import cv2\n'), ((4298, 4334), 'cv2.cvtColor', 'cv2.cvtColor', (['cad', 'cv2.COLOR_RGB2BGR'], {}), '(cad, cv2.COLOR_RGB2BGR)\n', (4310, 4334), False, 'import cv2\n'), ((4343, 4373), 'c... |
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the 'License');
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [
"risk.k_map_estimate_analysis",
"risk.k_anonymity_analysis",
"risk.categorical_risk_analysis",
"pytest.raises",
"pytest.fixture",
"risk.l_diversity_analysis",
"risk.numerical_risk_analysis"
] | [((998, 1028), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (1012, 1028), False, 'import pytest\n'), ((1393, 1423), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (1407, 1423), False, 'import pytest\n'), ((2000, 2128), 'risk.numer... |
from pathlib import Path
import numpy as np
import pandas as pd
import nibabel as nib
import matplotlib.pyplot as plt
import matplotlib.ticker as mtick
color_tables_dir = Path(__file__).parent
class Parcellation:
def __init__(self, parcellation_path):
self.parcellation_path = Path(parcellation_path)
... | [
"numpy.unique",
"pandas.read_csv",
"nibabel.load",
"pathlib.Path",
"matplotlib.ticker.PercentFormatter",
"numpy.hstack",
"numpy.argsort",
"numpy.count_nonzero",
"numpy.array",
"matplotlib.pyplot.tight_layout",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show"
] | [((174, 188), 'pathlib.Path', 'Path', (['__file__'], {}), '(__file__)\n', (178, 188), False, 'from pathlib import Path\n'), ((294, 317), 'pathlib.Path', 'Path', (['parcellation_path'], {}), '(parcellation_path)\n', (298, 317), False, 'from pathlib import Path\n'), ((1696, 1724), 'nibabel.load', 'nib.load', (['resection... |
from __future__ import annotations
from explainaboard import TaskType
from explainaboard.metric import MetricConfig
from explainaboard.processors.processor import Processor
_processor_registry: dict = {}
def get_processor(task: TaskType | str) -> Processor:
"""
return a processor based on the task type
... | [
"explainaboard.TaskType"
] | [((375, 389), 'explainaboard.TaskType', 'TaskType', (['task'], {}), '(task)\n', (383, 389), False, 'from explainaboard import TaskType\n')] |
#-*-coding:utf-8-*-
'''
Created on Nov14 31,2018
@author: pengzhiliang
'''
import time
import numpy as np
import os
import os.path as osp
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from tqdm import tqdm
from torch.utils.data import Dataset,DataLoader
from torch.o... | [
"utils.crf.dense_crf",
"torch.load",
"os.path.join",
"numpy.asarray",
"utils.metrics.Score",
"model.unet.UNet",
"os.path.isfile",
"torch.cuda.is_available",
"dataloader.coder.merge_classes",
"torch.no_grad",
"torch.nn.functional.softmax"
] | [((855, 900), 'os.path.join', 'osp.join', (['"""/home/cv_xfwang/data/"""', '"""MRBrainS"""'], {}), "('/home/cv_xfwang/data/', 'MRBrainS')\n", (863, 900), True, 'import os.path as osp\n'), ((1430, 1448), 'utils.metrics.Score', 'Score', ([], {'n_classes': '(4)'}), '(n_classes=4)\n', (1435, 1448), False, 'from utils.metri... |
# Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | [
"hpccm.primitives.shell.shell",
"posixpath.isabs",
"posixpath.join",
"hpccm.primitives.copy.copy",
"hpccm.primitives.comment.comment",
"posixpath.basename",
"re.search"
] | [((4601, 4632), 'hpccm.primitives.shell.shell', 'shell', ([], {'commands': 'self.__commands'}), '(commands=self.__commands)\n', (4606, 4632), False, 'from hpccm.primitives.shell import shell\n'), ((4454, 4489), 'hpccm.primitives.comment.comment', 'comment', (['self.__url'], {'reformat': '(False)'}), '(self.__url, refor... |
"""
Cluster Agent for Cloud Foundry tasks
"""
import os
from invoke import task
from .build_tags import get_default_build_tags
from .cluster_agent_helpers import build_common, clean_common, refresh_assets_common, version_common
# constants
BIN_PATH = os.path.join(".", "bin", "datadog-cluster-agent-cloudfoundry")
... | [
"os.path.join"
] | [((255, 317), 'os.path.join', 'os.path.join', (['"""."""', '"""bin"""', '"""datadog-cluster-agent-cloudfoundry"""'], {}), "('.', 'bin', 'datadog-cluster-agent-cloudfoundry')\n", (267, 317), False, 'import os\n')] |
import csv
import os
from clients.models import Client
class ClientsServices():
def __init__(self, database) -> None:
self.database = database
self.database_tmp = f'{database}.tmp'
def create_client(self, client):
with open(self.database, mode='a') as f:
writer = csv.DictW... | [
"os.rename",
"clients.models.Client.schema",
"os.remove"
] | [((1164, 1188), 'os.remove', 'os.remove', (['self.database'], {}), '(self.database)\n', (1173, 1188), False, 'import os\n'), ((1201, 1244), 'os.rename', 'os.rename', (['self.database_tmp', 'self.database'], {}), '(self.database_tmp, self.database)\n', (1210, 1244), False, 'import os\n'), ((340, 355), 'clients.models.Cl... |
# -*- coding: utf-8 -*-
"""
/dms/survey/views_start.py
.. enthaelt den View zum Starten der Dateneingabe des Fragebogens
Django content Management System
<NAME>
<EMAIL>
Die Programme des dms-Systems koennen frei genutzt und den spezifischen
Beduerfnissen entsprechend angepasst werden.
0.01 21.01.2008 Beg... | [
"dms.roles.require_permission",
"dms.queries.get_site_url"
] | [((619, 662), 'dms.roles.require_permission', 'require_permission', (['"""perm_manage_folderish"""'], {}), "('perm_manage_folderish')\n", (637, 662), False, 'from dms.roles import require_permission\n'), ((851, 893), 'dms.queries.get_site_url', 'get_site_url', (['item_container', '"""index.html"""'], {}), "(item_contai... |
import torch
from torch import nn
from torchvision.models import resnet18
# based on Encoder code from discimantor
from models.BigGAN_networks import Discriminator
class DiscriminatorWriter(Discriminator):
def __init__(self, opt, output_dim, **kwargs):
super(DiscriminatorWriter, self).__init__(**vars(o... | [
"torch.nn.Conv2d",
"torch.nn.AdaptiveAvgPool2d",
"torch.squeeze"
] | [((1234, 1252), 'torch.squeeze', 'torch.squeeze', (['out'], {}), '(out)\n', (1247, 1252), False, 'import torch\n'), ((426, 523), 'torch.nn.Conv2d', 'nn.Conv2d', (["self.arch['out_channels'][-1]", 'output_dim'], {'kernel_size': '(4, 2)', 'padding': '(0)', 'stride': '(2)'}), "(self.arch['out_channels'][-1], output_dim, k... |
import pytest
from liberaction.users.models import User, PhoneNumber, Address
@pytest.fixture
def user(db):
return User.objects.create(email='<EMAIL>', password='<PASSWORD>')
def test_user_exists(user):
assert User.objects.exists()
@pytest.fixture
def phone_number(user):
return PhoneNumber.objects.create... | [
"liberaction.users.models.User.objects.exists",
"liberaction.users.models.PhoneNumber.objects.create",
"liberaction.users.models.Address.objects.exists",
"liberaction.users.models.Address.objects.create",
"liberaction.users.models.User.objects.create",
"liberaction.users.models.PhoneNumber.objects.exists"... | [((120, 179), 'liberaction.users.models.User.objects.create', 'User.objects.create', ([], {'email': '"""<EMAIL>"""', 'password': '"""<PASSWORD>"""'}), "(email='<EMAIL>', password='<PASSWORD>')\n", (139, 179), False, 'from liberaction.users.models import User, PhoneNumber, Address\n'), ((220, 241), 'liberaction.users.mo... |
from battered import BatteredMiddleware
from wsgiref.simple_server import make_server, demo_app
battered = BatteredMiddleware(demo_app, {})
with make_server('', 8000, battered) as httpd:
print("start port 8000 ...")
httpd.serve_forever()
| [
"wsgiref.simple_server.make_server",
"battered.BatteredMiddleware"
] | [((108, 140), 'battered.BatteredMiddleware', 'BatteredMiddleware', (['demo_app', '{}'], {}), '(demo_app, {})\n', (126, 140), False, 'from battered import BatteredMiddleware\n'), ((147, 178), 'wsgiref.simple_server.make_server', 'make_server', (['""""""', '(8000)', 'battered'], {}), "('', 8000, battered)\n", (158, 178),... |
import numpy
import numpy as np
from skimage.metrics import structural_similarity as ssim, peak_signal_noise_ratio
from sklearn.metrics import mean_absolute_error, mean_squared_error, accuracy_score
import torch
from torch.nn import MSELoss,L1Loss
# PSNR and SSIM calculation for inputting a 3d array (amount, height, wi... | [
"numpy.reshape",
"skimage.metrics.structural_similarity",
"torch.Tensor.cpu",
"torch.nn.L1Loss",
"torch.nn.MSELoss",
"torch.no_grad",
"skimage.metrics.peak_signal_noise_ratio",
"torch.FloatTensor"
] | [((2048, 2057), 'torch.nn.MSELoss', 'MSELoss', ([], {}), '()\n', (2055, 2057), False, 'from torch.nn import MSELoss, L1Loss\n'), ((2071, 2079), 'torch.nn.L1Loss', 'L1Loss', ([], {}), '()\n', (2077, 2079), False, 'from torch.nn import MSELoss, L1Loss\n'), ((3383, 3489), 'numpy.reshape', 'numpy.reshape', (['x_set[:, :, 2... |
import os
import re
import json
from functools import partial
from .constants import *
def convert(s):
a = re.compile("((?<=[a-z0-9])[A-Z]|(?!^)[A-Z](?=[a-z]))")
return a.sub(r"_\1", s).lower()
def convertArray(a):
newArr = []
for i in a:
if isinstance(i, list):
newArr.append(con... | [
"json.load",
"re.sub",
"os.path.join",
"re.compile"
] | [((113, 167), 're.compile', 're.compile', (['"""((?<=[a-z0-9])[A-Z]|(?!^)[A-Z](?=[a-z]))"""'], {}), "('((?<=[a-z0-9])[A-Z]|(?!^)[A-Z](?=[a-z]))')\n", (123, 167), False, 'import re\n'), ((1375, 1401), 're.sub', 're.sub', (['"""--+"""', '"""-"""', 'string'], {}), "('--+', '-', string)\n", (1381, 1401), False, 'import re\... |
# Generated by Django 3.1.7 on 2021-03-03 19:26
import logging
import os
from django.conf import settings
from django.db import migrations
from django.db.utils import ProgrammingError
from psycopg2.errors import DuplicateDatabase
from psycopg2.errors import DuplicateObject
from psycopg2.errors import InsufficientPrivi... | [
"logging.getLogger",
"django.conf.settings.DATABASES.get",
"django.db.migrations.RunPython"
] | [((333, 360), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (350, 360), False, 'import logging\n'), ((4624, 4660), 'django.db.migrations.RunPython', 'migrations.RunPython', (['create_hive_db'], {}), '(create_hive_db)\n', (4644, 4660), False, 'from django.db import migrations\n'), ((501, ... |
import datetime
import pytest
from trackintel.preprocessing.util import calc_temp_overlap
@pytest.fixture
def time_1():
return datetime.datetime(year=1, month=1, day=1, hour=0, minute=0, second=0)
@pytest.fixture
def one_hour():
return datetime.timedelta(hours=1)
class TestCalc_temp_overlap():
def t... | [
"datetime.datetime",
"datetime.timedelta",
"trackintel.preprocessing.util.calc_temp_overlap"
] | [((135, 204), 'datetime.datetime', 'datetime.datetime', ([], {'year': '(1)', 'month': '(1)', 'day': '(1)', 'hour': '(0)', 'minute': '(0)', 'second': '(0)'}), '(year=1, month=1, day=1, hour=0, minute=0, second=0)\n', (152, 204), False, 'import datetime\n'), ((250, 277), 'datetime.timedelta', 'datetime.timedelta', ([], {... |
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from collections import defaultdict
import datetime
import json
from apiclient import discovery
from apiclient.errors import HttpError
import httplib2
from ... | [
"httplib2.Http",
"datetime.datetime.utcnow",
"oauth2client.client.SignedJwtAssertionCredentials",
"json.load",
"apiclient.discovery.build"
] | [((1353, 1465), 'oauth2client.client.SignedJwtAssertionCredentials', 'client.SignedJwtAssertionCredentials', (["service_account['client_email']", "service_account['private_key']", 'scope'], {}), "(service_account['client_email'],\n service_account['private_key'], scope)\n", (1389, 1465), False, 'from oauth2client im... |
"""Tables for User, Password, Comments, Friends and Posts
Revision ID: 3d6c688278ae
Revises:
Create Date: 2019-10-08 15:19:44.799296
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '3d6c688278ae'
down_revision = None
branch_labels = None
depends_on = None
de... | [
"sqlalchemy.ForeignKeyConstraint",
"sqlalchemy.DateTime",
"alembic.op.drop_table",
"alembic.op.f",
"sqlalchemy.Boolean",
"sqlalchemy.PrimaryKeyConstraint",
"sqlalchemy.Date",
"sqlalchemy.Integer",
"sqlalchemy.String"
] | [((3416, 3441), 'alembic.op.drop_table', 'op.drop_table', (['"""comments"""'], {}), "('comments')\n", (3429, 3441), False, 'from alembic import op\n'), ((3516, 3538), 'alembic.op.drop_table', 'op.drop_table', (['"""posts"""'], {}), "('posts')\n", (3529, 3538), False, 'from alembic import op\n'), ((3619, 3644), 'alembic... |
import numpy as np
import logging
class PID(object):
def __init__(self, kp, ki, kd):
self.kp = kp
self.ki = ki
self.kd = kd
self.reset()
def update(self, t, e):
# TODO add anti-windup logic
# Most environments have a short execution time
# the co... | [
"numpy.round"
] | [((4723, 4738), 'numpy.round', 'np.round', (['motor'], {}), '(motor)\n', (4731, 4738), True, 'import numpy as np\n')] |
from sikr.db.connector import Base, engine
from sikr.models.users import UserGroup, User
from sikr.models.entries import Group, Entry
from sikr.utils.logs import logger
def generate_schema():
"""Generate the initial schema for the database."""
start_msg = "Creating database schema..."
end_msg = "Database ... | [
"sikr.utils.logs.logger.error",
"sikr.utils.logs.logger.info",
"sikr.db.connector.Base.metadata.create_all"
] | [((374, 396), 'sikr.utils.logs.logger.info', 'logger.info', (['start_msg'], {}), '(start_msg)\n', (385, 396), False, 'from sikr.utils.logs import logger\n'), ((414, 446), 'sikr.db.connector.Base.metadata.create_all', 'Base.metadata.create_all', (['engine'], {}), '(engine)\n', (438, 446), False, 'from sikr.db.connector ... |
from typing import List
from pytest import fixture
from pytest_bdd import scenarios, given, when, then
from pytest_bdd.parsers import parse
from game import Game
from puzzle import HintType, Puzzle
from dictionary import Dictionary
@fixture(scope="session")
def dictionary() -> Dictionary:
return Dictionary.from... | [
"puzzle.Puzzle",
"pytest_bdd.scenarios",
"dictionary.Dictionary.from_text_file",
"game.Game",
"pytest.fixture",
"pytest_bdd.parsers.parse"
] | [((237, 261), 'pytest.fixture', 'fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (244, 261), False, 'from pytest import fixture\n'), ((353, 366), 'pytest_bdd.scenarios', 'scenarios', (['""""""'], {}), "('')\n", (362, 366), False, 'from pytest_bdd import scenarios, given, when, then\n'), ((305, 350), ... |
#! /usr/bin/env python
import urllib
import tarfile
import os
print("Downloading...")
testfile = urllib.URLopener()
testfile.retrieve("http://www.cs.toronto.edu/~kriz/cifar-10-binary.tar.gz", "cifar-10-binary.tar.gz")
print("Unzipping...")
tar = tarfile.open("cifar-10-binary.tar.gz")
tar.extractall()
tar.close()
... | [
"tarfile.open",
"os.system",
"urllib.URLopener"
] | [((100, 118), 'urllib.URLopener', 'urllib.URLopener', ([], {}), '()\n', (116, 118), False, 'import urllib\n'), ((251, 289), 'tarfile.open', 'tarfile.open', (['"""cifar-10-binary.tar.gz"""'], {}), "('cifar-10-binary.tar.gz')\n", (263, 289), False, 'import tarfile\n'), ((320, 361), 'os.system', 'os.system', (['"""rm -f c... |
# -*- coding: utf-8 -*-
"""
------------------------------------------------
rcmg.util.database.redis_util
------------------------------------------------
Author: <NAME> (email: <EMAIL>)
Create: 2020-07-03
------------------------------------------------
ChangeLog
---------------------------------------------... | [
"redis.ConnectionPool",
"logging.info",
"logging.error",
"redis.Redis"
] | [((630, 662), 'logging.info', 'logging.info', (['"""Begin init Redis"""'], {}), "('Begin init Redis')\n", (642, 662), False, 'import logging\n'), ((705, 835), 'redis.ConnectionPool', 'redis.ConnectionPool', ([], {'host': "_conf['host']", 'db': "_conf['index_name']", 'username': "_conf['master_name']", 'password': "_con... |
from pyttsx3 import init
from speech_recognition import Recognizer, Microphone
from pywhatkit import playonyt, search
from pyjokes import get_joke
from keyboard import wait
recog = Recognizer()
convertor = init()
voices = convertor.getProperty("voices")
convertor.setProperty("voice", voices[1].id) # female v... | [
"pywhatkit.search",
"pyttsx3.init",
"pyjokes.get_joke",
"speech_recognition.Recognizer",
"speech_recognition.Microphone",
"keyboard.wait",
"pywhatkit.playonyt"
] | [((188, 200), 'speech_recognition.Recognizer', 'Recognizer', ([], {}), '()\n', (198, 200), False, 'from speech_recognition import Recognizer, Microphone\n'), ((214, 220), 'pyttsx3.init', 'init', ([], {}), '()\n', (218, 220), False, 'from pyttsx3 import init\n'), ((1955, 1967), 'speech_recognition.Recognizer', 'Recogniz... |
import os
import numpy as np
import cv2 as cv
from tests_common import NewOpenCVTests
def generate_test_trajectory():
result = []
angle_i = np.arange(0, 271, 3)
angle_j = np.arange(0, 1200, 10)
for i, j in zip(angle_i, angle_j):
x = 2 * np.cos(i * 3 * np.pi/180.0) * (1.0 + 0.5 * np.cos(1.2 + ... | [
"cv2.viz.makeTransformToGlobal",
"cv2.viz_WCoordinateSystem",
"cv2.viz_Mesh",
"cv2.viz_Color",
"tests_common.NewOpenCVTests.bootstrap",
"numpy.array",
"numpy.sin",
"cv2.viz_WCameraPosition",
"numpy.arange",
"cv2.viz_WCloudCollection",
"cv2.viz_WTrajectory",
"cv2.viz_WTrajectorySpheres",
"cv2... | [((151, 171), 'numpy.arange', 'np.arange', (['(0)', '(271)', '(3)'], {}), '(0, 271, 3)\n', (160, 171), True, 'import numpy as np\n'), ((186, 208), 'numpy.arange', 'np.arange', (['(0)', '(1200)', '(10)'], {}), '(0, 1200, 10)\n', (195, 208), True, 'import numpy as np\n'), ((837, 869), 'cv2.viz_Viz3d', 'cv.viz_Viz3d', (['... |
import requests
import base64
with open('../tr/imgs/web.png', 'rb') as image:
image_string = base64.b64encode(image.read()).decode('UTF-8')
r = requests.post('http://localhost:8080/api/ocr/base64', json={'image': image_string, 'ext': '.png'})
print(r.json())
| [
"requests.post"
] | [((152, 254), 'requests.post', 'requests.post', (['"""http://localhost:8080/api/ocr/base64"""'], {'json': "{'image': image_string, 'ext': '.png'}"}), "('http://localhost:8080/api/ocr/base64', json={'image':\n image_string, 'ext': '.png'})\n", (165, 254), False, 'import requests\n')] |
import scrapy
class TagItem(scrapy.Item):
name = scrapy.Field()
| [
"scrapy.Field"
] | [((55, 69), 'scrapy.Field', 'scrapy.Field', ([], {}), '()\n', (67, 69), False, 'import scrapy\n')] |
import pandas as pd
from coralinedb import BaseDB
class MSSQLDB(BaseDB):
"""
Class for MS SQL Server
"""
def get_engine_url(self, db_name: str) -> str:
"""Get Engine URL for MS SQL Server
Parameters
----------
db_name : str
database name
Returns
... | [
"pandas.read_sql"
] | [((1412, 1459), 'pandas.read_sql', 'pd.read_sql', (['sql', 'connection'], {'coerce_float': '(True)'}), '(sql, connection, coerce_float=True)\n', (1423, 1459), True, 'import pandas as pd\n'), ((910, 957), 'pandas.read_sql', 'pd.read_sql', (['sql', 'connection'], {'coerce_float': '(True)'}), '(sql, connection, coerce_flo... |
"""
Example file showing a demo with 100 agents split in four groups initially positioned in four corners of the environment. Each agent attempts to move to other side of the environment through a narrow passage generated by four obstacles. There is no roadmap to guide the agents around the obstacles.
"""
import math
i... | [
"rvo.simulator.Simulator",
"rvo.vector.Vector2",
"math.cos",
"gym.envs.classic_control.rendering.Viewer",
"gym.envs.classic_control.rendering.Transform",
"rvo.math.normalize",
"rvo.math.abs_sq",
"random.random",
"math.sin"
] | [((645, 656), 'rvo.simulator.Simulator', 'Simulator', ([], {}), '()\n', (654, 656), False, 'from rvo.simulator import Simulator\n'), ((945, 962), 'rvo.vector.Vector2', 'Vector2', (['(0.0)', '(0.0)'], {}), '(0.0, 0.0)\n', (952, 962), False, 'from rvo.vector import Vector2\n'), ((1855, 1875), 'rvo.vector.Vector2', 'Vecto... |
#!/usr/bin/env python3
"""
Project 8: Maze Solver with Reinforcement Learning
Author: <NAME> <***<EMAIL>>
Learn policies to walk through a maze by reinforcement learning. This program
implements value iteration with synchronous updates.
Data Assumptions:
1. Maze data are rectangular (i.e. all rows have the same numbe... | [
"numpy.nanargmax",
"numpy.absolute",
"warnings.catch_warnings",
"numpy.asarray",
"numpy.zeros",
"numpy.empty",
"numpy.isnan",
"numpy.nanmax",
"warnings.simplefilter",
"numpy.set_printoptions"
] | [((890, 942), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'threshold': 'np.inf', 'linewidth': '(100)'}), '(threshold=np.inf, linewidth=100)\n', (909, 942), True, 'import numpy as np\n'), ((2165, 2186), 'numpy.asarray', 'np.asarray', (['maze_data'], {}), '(maze_data)\n', (2175, 2186), True, 'import numpy as n... |
import math
from pygame.math import Vector2
class Geometry:
@classmethod
def polygon_point_intersection(cls, point_list, point):
"""
:param point_list: Reference to polygon object
:param point: Reference to point object
:return: true if point is inside polygon
"""
... | [
"math.cos",
"pygame.math.Vector2",
"math.sin"
] | [((2143, 2158), 'pygame.math.Vector2', 'Vector2', (['px', 'py'], {}), '(px, py)\n', (2150, 2158), False, 'from pygame.math import Vector2\n'), ((1979, 1994), 'math.cos', 'math.cos', (['angle'], {}), '(angle)\n', (1987, 1994), False, 'import math\n'), ((2002, 2017), 'math.sin', 'math.sin', (['angle'], {}), '(angle)\n', ... |
import json
from schematics.exceptions import ConversionError
from nose.tools import eq_,raises
from enum import Enum
from moncli import column_value as cv
from moncli.enums import ColumnType
from moncli.types import StatusType
# default class and data mapping declaration for common use
class Status(Enum):
ready = ... | [
"json.dumps",
"nose.tools.raises",
"nose.tools.eq_",
"moncli.types.StatusType"
] | [((4347, 4370), 'nose.tools.raises', 'raises', (['ConversionError'], {}), '(ConversionError)\n', (4353, 4370), False, 'from nose.tools import eq_, raises\n'), ((4884, 4907), 'nose.tools.raises', 'raises', (['ConversionError'], {}), '(ConversionError)\n', (4890, 4907), False, 'from nose.tools import eq_, raises\n'), ((5... |
import logging
import os
import signal
import sys
import threading
import time
import eel
from src.app import App
from src.card import Card
from src.data import delete_user, EasyHandle, get_users_name, register_user, room
from src.startup import start_up
from src.reservation import resd, tdd, getdated, delscheduled
... | [
"logging.basicConfig",
"src.reservation.resd",
"sys.exit",
"eel.start",
"src.data.room",
"eel.init",
"src.reservation.tdd",
"src.reservation.delscheduled",
"src.startup.start_up",
"src.app.log_app.setLevel",
"src.card.Card",
"eel.say_hello_or_seeu2",
"src.app.App",
"nfc.clf.log.setLevel",
... | [((345, 363), 'src.startup.start_up', 'start_up', (['sys.argv'], {}), '(sys.argv)\n', (353, 363), False, 'from src.startup import start_up\n'), ((443, 547), 'logging.basicConfig', 'logging.basicConfig', ([], {'filename': 'f"""{PATH_USER_DATA}/log/err.log"""', 'level': 'logging.WARN', 'format': 'formatter'}), "(filename... |