code stringlengths 20 1.05M | apis list | extract_api stringlengths 75 5.24M |
|---|---|---|
import importlib
__all__ = ['mount_gdrive']
def mount_gdrive() -> str:
"""Mount Google Drive storage of the current Google account and return the root path.
Functionality only available in Google Colab Enviroment; otherwise, it raises a RuntimeError.
"""
if (importlib.util.find_spec("google.colab")... | [
"importlib.util.find_spec",
"google.colab.drive.mount"
] | [((452, 502), 'google.colab.drive.mount', 'drive.mount', (['"""/content/gdrive"""'], {'force_remount': '(True)'}), "('/content/gdrive', force_remount=True)\n", (463, 502), False, 'from google.colab import drive\n'), ((280, 320), 'importlib.util.find_spec', 'importlib.util.find_spec', (['"""google.colab"""'], {}), "('go... |
import HandRankings as Hand
from deuces.deuces import Card, Evaluator
class GameData:
def __init__(self, name, opponent_name, stack_size, bb):
# match stats
self.name = name
self.opponent_name = opponent_name
self.starting_stack_size = int(stack_size)
self.num_hands = 0
... | [
"deuces.deuces.Card.new",
"deuces.deuces.Evaluator",
"HandRankings.hand_win_odds"
] | [((2278, 2315), 'HandRankings.hand_win_odds', 'Hand.hand_win_odds', (['self.current_hand'], {}), '(self.current_hand)\n', (2296, 2315), True, 'import HandRankings as Hand\n'), ((5028, 5048), 'deuces.deuces.Card.new', 'Card.new', (['board_card'], {}), '(board_card)\n', (5036, 5048), False, 'from deuces.deuces import Car... |
from django.db import models
from django.contrib.auth.models import User
from django.utils import timezone
class Todo(models.Model):
time_add = models.DateTimeField(auto_now_add=True)
title = models.CharField(max_length=64)
detail = models.TextField(blank=True)
deadline = models.DateTimeField(blank=Tr... | [
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.BooleanField",
"django.utils.timezone.now",
"django.db.models.DateTimeField",
"django.db.models.CharField"
] | [((150, 189), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'auto_now_add': '(True)'}), '(auto_now_add=True)\n', (170, 189), False, 'from django.db import models\n'), ((202, 233), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(64)'}), '(max_length=64)\n', (218, 233), False, 'f... |
import os
from trame import change, update_state
from trame.layouts import SinglePageWithDrawer
from trame.html import vtk, vuetify, widgets
from vtkmodules.vtkCommonDataModel import vtkDataObject
from vtkmodules.vtkFiltersCore import vtkContourFilter
from vtkmodules.vtkIOXML import vtkXMLUnstructuredGridReader
from ... | [
"trame.layouts.SinglePageWithDrawer",
"trame.html.vuetify.VSelect",
"vtkmodules.vtkFiltersCore.vtkContourFilter",
"trame.html.vuetify.VCardTitle",
"vtkmodules.vtkRenderingCore.vtkRenderWindow",
"trame.html.vtk.VtkLocalView",
"trame.change",
"trame.html.vuetify.VContainer",
"vtkmodules.vtkRenderingCo... | [((1453, 1466), 'vtkmodules.vtkRenderingCore.vtkRenderer', 'vtkRenderer', ([], {}), '()\n', (1464, 1466), False, 'from vtkmodules.vtkRenderingCore import vtkActor, vtkDataSetMapper, vtkRenderer, vtkRenderWindow, vtkRenderWindowInteractor\n'), ((1482, 1499), 'vtkmodules.vtkRenderingCore.vtkRenderWindow', 'vtkRenderWindo... |
# Copyright 1996-2021 Soft_illusion.
#
# 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 w... | [
"geometry_msgs.msg.Twist",
"rclpy.init",
"rclpy.shutdown",
"rclpy.spin"
] | [((2699, 2720), 'rclpy.init', 'rclpy.init', ([], {'args': 'args'}), '(args=args)\n', (2709, 2720), False, 'import rclpy\n'), ((2750, 2764), 'rclpy.spin', 'rclpy.spin', (['ls'], {}), '(ls)\n', (2760, 2764), False, 'import rclpy\n'), ((2792, 2808), 'rclpy.shutdown', 'rclpy.shutdown', ([], {}), '()\n', (2806, 2808), False... |
from random import sample
from time import sleep
jogos = list()
print('-' * 20)
print(f'{"MEGA SENA":^20}')
print('-' * 20)
while True:
n = int(input("\nQuatos jogos você quer que eu sorteie? "))
if (n > 0):
break
print('\n[ERRO] Valor fora do intervalo')
print()
print('-=' * 3, e... | [
"time.sleep"
] | [((458, 468), 'time.sleep', 'sleep', (['(0.6)'], {}), '(0.6)\n', (463, 468), False, 'from time import sleep\n')] |
from importlib import import_module
from unittest import TestCase as UnitTestCase
from django.contrib.auth.models import Group
from django.core.management import BaseCommand
from django.conf import settings
from django.test import TestCase
from django.views.generic import TemplateView
try:
from unittest.mock impor... | [
"mock.patch",
"django_roles_access.models.ViewAccess.objects.create",
"importlib.import_module",
"django_roles_access.utils.analyze_by_role",
"django_roles_access.utils.view_access_analyzer",
"mock.Mock",
"django_roles_access.utils.walk_site_url",
"django_roles_access.utils.check_django_roles_is_used"... | [((16946, 16991), 'mock.patch', 'patch', (['"""django_roles_access.utils.ViewAccess"""'], {}), "('django_roles_access.utils.ViewAccess')\n", (16951, 16991), False, 'from mock import Mock, patch\n'), ((19821, 19874), 'mock.patch', 'patch', (['"""django_roles_access.utils.ViewAccess.objects"""'], {}), "('django_roles_acc... |
import libcst as cst
import libcst.matchers as m
from fixit import CstLintRule
from fixit import InvalidTestCase as Invalid
from fixit import ValidTestCase as Valid
class UseFstringRule(CstLintRule):
MESSAGE: str = (
"As mentioned in the [Contributing Guidelines]"
+ "(https://github.com/TheAlgori... | [
"libcst.matchers.SimpleString",
"libcst.ensure_type",
"fixit.ValidTestCase",
"libcst.matchers.Name",
"libcst.matchers.Modulo",
"fixit.InvalidTestCase"
] | [((592, 641), 'fixit.ValidTestCase', 'Valid', (['"""assigned=\'string\'; f\'testing {assigned}\'"""'], {}), '("assigned=\'string\'; f\'testing {assigned}\'")\n', (597, 641), True, 'from fixit import ValidTestCase as Valid\n'), ((651, 675), 'fixit.ValidTestCase', 'Valid', (['"""\'simple string\'"""'], {}), '("\'simple s... |
# AUTOGENERATED! DO NOT EDIT! File to edit: source_nbs/13_model_fn.ipynb (unless otherwise specified).
__all__ = ['variable_summaries', 'filter_loss', 'BertMultiTaskBody', 'BertMultiTaskTop', 'BertMultiTask']
# Cell
from typing import Dict, Tuple
from inspect import signature
import tensorflow as tf
import transform... | [
"tensorflow.compat.v1.name_scope",
"tensorflow.reduce_min",
"tensorflow.compat.v1.summary.histogram",
"tensorflow.reduce_sum",
"tensorflow.keras.metrics.Mean",
"tensorflow.compat.v1.summary.scalar",
"inspect.signature",
"tensorflow.reduce_max",
"tensorflow.GradientTape",
"tensorflow.keras.layers.D... | [((722, 751), 'tensorflow.compat.v1.name_scope', 'tf.compat.v1.name_scope', (['name'], {}), '(name)\n', (745, 751), True, 'import tensorflow as tf\n'), ((768, 800), 'tensorflow.reduce_mean', 'tf.reduce_mean', ([], {'input_tensor': 'var'}), '(input_tensor=var)\n', (782, 800), True, 'import tensorflow as tf\n'), ((809, 8... |
import os.path
import tron.Misc
from tron import g, hub
from tron.Hub.Command.Encoders.ASCIICmdEncoder import ASCIICmdEncoder
from tron.Hub.Nub.SocketActorNub import SocketActorNub
from tron.Hub.Reply.Decoders.ASCIIReplyDecoder import ASCIIReplyDecoder
name = 'hal'
def start(poller):
cfg = tron.Misc.cfg.get(g.... | [
"tron.Hub.Reply.Decoders.ASCIIReplyDecoder.ASCIIReplyDecoder",
"tron.hub.dropActor",
"tron.Hub.Command.Encoders.ASCIICmdEncoder.ASCIICmdEncoder",
"tron.hub.addActor",
"tron.hub.findActor"
] | [((540, 581), 'tron.Hub.Reply.Decoders.ASCIIReplyDecoder.ASCIIReplyDecoder', 'ASCIIReplyDecoder', ([], {'cidFirst': '(True)', 'debug': '(1)'}), '(cidFirst=True, debug=1)\n', (557, 581), False, 'from tron.Hub.Reply.Decoders.ASCIIReplyDecoder import ASCIIReplyDecoder\n'), ((590, 648), 'tron.Hub.Command.Encoders.ASCIICmdE... |
# This file is part of Viper - https://github.com/viper-framework/viper
# See the file 'LICENSE' for copying permission.
import time
import datetime
from lib.common.out import *
from lib.common.objects import File
from lib.core.database import Database
from lib.core.investigation import __project__
class Session(ob... | [
"time.time",
"lib.core.database.Database",
"lib.common.objects.File"
] | [((1970, 1980), 'lib.common.objects.File', 'File', (['path'], {}), '(path)\n', (1974, 1980), False, 'from lib.common.objects import File\n'), ((610, 621), 'time.time', 'time.time', ([], {}), '()\n', (619, 621), False, 'import time\n'), ((2113, 2123), 'lib.core.database.Database', 'Database', ([], {}), '()\n', (2121, 21... |
# 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... | [
"werkzeug.exceptions.MethodNotAllowed",
"werkzeug.exceptions.NotFound",
"unittest.mock.patch.object"
] | [((1172, 1223), 'unittest.mock.patch.object', 'patch.object', (['ScalarsProcessor', '"""get_metadata_list"""'], {}), "(ScalarsProcessor, 'get_metadata_list')\n", (1184, 1223), False, 'from unittest.mock import patch\n'), ((2030, 2081), 'unittest.mock.patch.object', 'patch.object', (['ScalarsProcessor', '"""get_metadata... |
import dash_bootstrap_components as dbc
import dash_html_components as html
DBC_DOCS = (
"https://dash-bootstrap-components.opensource.faculty.ai/docs/components/"
)
def make_subheading(label, link):
slug = label.replace(" ", "")
heading = html.H2(
html.Span(
[
label,... | [
"dash_html_components.I",
"dash_bootstrap_components.Tooltip"
] | [((657, 731), 'dash_bootstrap_components.Tooltip', 'dbc.Tooltip', (['f"""See {label} documentation"""'], {'target': 'f"""tooltip_target_{slug}"""'}), "(f'See {label} documentation', target=f'tooltip_target_{slug}')\n", (668, 731), True, 'import dash_bootstrap_components as dbc\n'), ((365, 407), 'dash_html_components.I'... |
"""
Copyright (C) 2018-2021 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... | [
"mo.front.mxnet.extractors.utils.get_mxnet_layer_attrs"
] | [((935, 974), 'mo.front.mxnet.extractors.utils.get_mxnet_layer_attrs', 'get_mxnet_layer_attrs', (['node.symbol_dict'], {}), '(node.symbol_dict)\n', (956, 974), False, 'from mo.front.mxnet.extractors.utils import get_mxnet_layer_attrs\n')] |
import cv2
from PIL import Image
import argparse
from pathlib import Path
from multiprocessing import Process, Pipe,Value,Array
import torch
from config import get_config
from mtcnn import MTCNN
from Learner_trans_tf import face_learner
from utils import load_facebank, draw_box_name, prepare_facebank, save_label_score,... | [
"matplotlib.pyplot.ylabel",
"sklearn.metrics.auc",
"numpy.array",
"sklearn.metrics.roc_curve",
"sklearn.model_selection.KFold",
"utils.prepare_facebank",
"os.remove",
"os.path.exists",
"os.listdir",
"argparse.ArgumentParser",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.... | [((651, 711), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""for face verification"""'}), "(description='for face verification')\n", (674, 711), False, 'import argparse\n'), ((2874, 2896), 'config.get_config', 'get_config', (['(True)', 'args'], {}), '(True, args)\n', (2884, 2896), False,... |
from jinja2 import nodes
from jinja2.ext import Extension
class FragmentCacheExtension(Extension):
# a set of names that trigger the extension.
tags = set(['cache'])
def __init__(self, environment):
super(FragmentCacheExtension, self).__init__(environment)
# add the defaults to the envir... | [
"jinja2.nodes.Const"
] | [((1151, 1168), 'jinja2.nodes.Const', 'nodes.Const', (['None'], {}), '(None)\n', (1162, 1168), False, 'from jinja2 import nodes\n')] |
# api.py
# Part of PyBBIO
# github.com/alexanderhiam/PyBBIO
# MIT License
#
# Beaglebone platform API file.
from bbio.platform.platform import detect_platform
PLATFORM = detect_platform()
if "3.8" in PLATFORM:
from bone_3_8.adc import analog_init, analog_cleanup
from bone_3_8.pwm import pwm_init, pwm_cleanup
... | [
"bone_3_2.pwm.pwm_cleanup",
"bbio.platform.platform.detect_platform",
"serial_port.serial_cleanup",
"bone_3_2.adc.analog_cleanup",
"bone_3_2.pwm.pwm_init",
"bone_3_2.adc.analog_init"
] | [((175, 192), 'bbio.platform.platform.detect_platform', 'detect_platform', ([], {}), '()\n', (190, 192), False, 'from bbio.platform.platform import detect_platform\n'), ((559, 572), 'bone_3_2.adc.analog_init', 'analog_init', ([], {}), '()\n', (570, 572), False, 'from bone_3_2.adc import analog_init, analog_cleanup\n'),... |
import re
import sys
from urllib.parse import quote as _uriquote
import requests
from . import __version__, errors, utils
from .converters import _county_types, _leaderboard_types, _vpn_types, _not_none
from . import checks
from .cog import request_cog
GET='get'
POST='post'
class HTTPClient:
__CSRF_token_regex... | [
"requests.cookies.create_cookie",
"urllib.parse.quote",
"requests.Session",
"re.compile"
] | [((323, 388), 're.compile', 're.compile', (['"""const csrfToken[ ]{0,1}=[ ]{0,1}["|\'](.{36})["|\']"""'], {}), '(\'const csrfToken[ ]{0,1}=[ ]{0,1}["|\\\'](.{36})["|\\\']\')\n', (333, 388), False, 'import re\n'), ((414, 480), 're.compile', 're.compile', (['"""const username[ ]{0,1}=[ ]{0,1}["|\'](.{1,16})["|\']"""'], {... |
import numpy as np
DEFAULT_FILE_PATH = "utils/datasets/glove.6B.50d.txt"
def loadWordVectors(tokens, filepath=DEFAULT_FILE_PATH, dimensions=50):
"""Read pretrained GloVe vectors"""
wordVectors = np.zeros((len(tokens), dimensions))
with open(filepath) as ifs:
for line in ifs:
line = lin... | [
"numpy.asarray"
] | [((692, 708), 'numpy.asarray', 'np.asarray', (['data'], {}), '(data)\n', (702, 708), True, 'import numpy as np\n')] |
#!/usr/bin/env python3
import subprocess
import sys
import json
SERVICES = {
'control': [
'control',
'nodemgr',
'named',
'dns',
],
'config-database': [
'nodemgr',
'zookeeper',
'rabbitmq',
'cassandra',
],
'webui': [
'web',
... | [
"subprocess.check_output",
"sys.exit"
] | [((3148, 3158), 'sys.exit', 'sys.exit', ([], {}), '()\n', (3156, 3158), False, 'import sys\n'), ((972, 990), 'sys.exit', 'sys.exit', (['CRITICAL'], {}), '(CRITICAL)\n', (980, 990), False, 'import sys\n'), ((2025, 2043), 'sys.exit', 'sys.exit', (['CRITICAL'], {}), '(CRITICAL)\n', (2033, 2043), False, 'import sys\n'), ((... |
import argparse
import numpy as np
from .._helpers import read, reader_map
from ._helpers import _get_version_text
def info(argv=None):
# Parse command line arguments.
parser = _get_info_parser()
args = parser.parse_args(argv)
# read mesh data
mesh = read(args.infile, file_format=args.input_for... | [
"numpy.any",
"numpy.zeros",
"argparse.ArgumentParser"
] | [((1006, 1113), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Print mesh info."""', 'formatter_class': 'argparse.RawTextHelpFormatter'}), "(description='Print mesh info.', formatter_class=\n argparse.RawTextHelpFormatter)\n", (1029, 1113), False, 'import argparse\n'), ((469, 510), 'n... |
#!/pxrpythonsubst
#
# Copyright 2016 Pixar
#
# Licensed under the Apache License, Version 2.0 (the "Apache License")
# with the following modification; you may not use this file except in
# compliance with the Apache License and the following modification to it:
# Section 6. Trademarks. is deleted and replaced with:
#
... | [
"pxr.Sdf.Layer.CreateNew",
"pxr.Tf.IsValidIdentifier",
"pxr.Sdf.Payload",
"pxr.Usd.ModelAPI",
"pxr.Kind.Registry.IsA",
"pxr.Usd.Stage.Open",
"os.path.basename",
"pxr.Kind.Registry.GetAllKinds"
] | [((3531, 3585), 'pxr.Sdf.Layer.CreateNew', 'Sdf.Layer.CreateNew', (['fileName'], {'args': "{'format': 'usda'}"}), "(fileName, args={'format': 'usda'})\n", (3550, 3585), False, 'from pxr import Tf, Kind, Sdf, Usd\n'), ((3599, 3624), 'pxr.Usd.Stage.Open', 'Usd.Stage.Open', (['rootLayer'], {}), '(rootLayer)\n', (3613, 362... |
from __future__ import print_function
import json
import os
from django.conf import settings
from django.contrib.auth.hashers import make_password
from django.contrib.auth.models import User
from wagtail.wagtailcore.models import Page, Site
from v1.models import HomePage, BrowseFilterablePage
def run():
print(... | [
"wagtail.wagtailcore.models.Site",
"v1.models.BrowseFilterablePage.objects.filter",
"v1.models.BrowseFilterablePage",
"os.environ.get",
"wagtail.wagtailcore.models.Site.objects.first",
"django.contrib.auth.models.User.objects.filter",
"v1.models.HomePage.objects.filter",
"wagtail.wagtailcore.models.Pa... | [((446, 483), 'django.contrib.auth.models.User.objects.filter', 'User.objects.filter', ([], {'username': '"""admin"""'}), "(username='admin')\n", (465, 483), False, 'from django.contrib.auth.models import User\n'), ((843, 881), 'v1.models.HomePage.objects.filter', 'HomePage.objects.filter', ([], {'title': '"""CFGOV"""'... |
# -*- coding: utf-8 -*-
from zvt.contract.api import df_to_db
from zvt.contract.recorder import Recorder
from zvt.domain.meta.stockhk_meta import Stockhk
from zvt.recorders.em import em_api
class EMStockhkRecorder(Recorder):
provider = "em"
data_schema = Stockhk
def run(self):
df_south = em_api.... | [
"zvt.recorders.em.em_api.get_tradable_list",
"zvt.contract.api.df_to_db"
] | [((313, 375), 'zvt.recorders.em.em_api.get_tradable_list', 'em_api.get_tradable_list', ([], {'entity_type': '"""stockhk"""', 'hk_south': '(True)'}), "(entity_type='stockhk', hk_south=True)\n", (337, 375), False, 'from zvt.recorders.em import em_api\n'), ((481, 528), 'zvt.recorders.em.em_api.get_tradable_list', 'em_api.... |
# -*- test-case-name: twisted.names.test.test_rootresolve -*-
# Copyright (c) 2001-2009 Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Resolver implementation for querying successive authoritative servers to
lookup a record, starting from the root nameservers.
@author: <NAME>
todo::
robustify it
... | [
"twisted.names.client.Resolver",
"twisted.internet.defer.deferredGenerator",
"twisted.internet.defer.Deferred",
"twisted.internet.defer.DeferredList",
"twisted.names.common.ResolverBase.__init__",
"twisted.names.dns.Query"
] | [((5016, 5058), 'twisted.internet.defer.deferredGenerator', 'defer.deferredGenerator', (['discoverAuthority'], {}), '(discoverAuthority)\n', (5039, 5058), False, 'from twisted.internet import defer\n'), ((6368, 6389), 'twisted.internet.defer.DeferredList', 'defer.DeferredList', (['L'], {}), '(L)\n', (6386, 6389), False... |
# ================================================================
# MIT License
# Copyright (c) 2021 edwardyehuang (https://github.com/edwardyehuang)
# ================================================================
import os, sys
rootpath = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, os.pard... | [
"os.path.exists",
"sys.path.insert",
"PIL.Image.open",
"absl.flags.DEFINE_integer",
"os.path.join",
"ids.voc2012.get_colormap",
"absl.app.run",
"tensorflow.io.gfile.listdir",
"os.path.dirname",
"os.mkdir",
"absl.flags.DEFINE_string",
"ids.cityscapes_fine.get_colormap"
] | [((326, 354), 'sys.path.insert', 'sys.path.insert', (['(1)', 'rootpath'], {}), '(1, rootpath)\n', (341, 354), False, 'import os, sys\n'), ((634, 690), 'absl.flags.DEFINE_string', 'flags.DEFINE_string', (['"""input_dir"""', 'None', '"""input dir path"""'], {}), "('input_dir', None, 'input dir path')\n", (653, 690), Fals... |
import sqlite3
conn = sqlite3.connect('example.db')
c = conn.cursor()
import os
import hashlib
import time
def get_file_md5(filePath):
h = hashlib.md5()
h.update(open(filePath,"rb").read())
return h.hexdigest()
def get_file_sha256(filePath):
h = hashlib.sha256()
h.update(open(filePath,"rb").read())
return h.... | [
"os.path.getsize",
"hashlib.sha256",
"hashlib.md5",
"sqlite3.connect",
"os.path.getctime",
"time.strftime",
"os.path.realpath",
"os.walk"
] | [((22, 51), 'sqlite3.connect', 'sqlite3.connect', (['"""example.db"""'], {}), "('example.db')\n", (37, 51), False, 'import sqlite3\n'), ((144, 157), 'hashlib.md5', 'hashlib.md5', ([], {}), '()\n', (155, 157), False, 'import hashlib\n'), ((255, 271), 'hashlib.sha256', 'hashlib.sha256', ([], {}), '()\n', (269, 271), Fals... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | [
"azure.mgmt.core.polling.arm_polling.ARMPolling",
"azure.core.exceptions.map_error",
"azure.core.polling.LROPoller",
"azure.core.exceptions.HttpResponseError",
"azure.core.polling.NoPolling",
"azure.core.polling.LROPoller.from_continuation_token",
"azure.core.paging.ItemPaged",
"typing.TypeVar"
] | [((1181, 1193), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {}), "('T')\n", (1188, 1193), False, 'from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union\n'), ((5708, 5741), 'azure.core.paging.ItemPaged', 'ItemPaged', (['get_next', 'extract_data'], {}), '(get_next, extract_data)\n', (5717, 57... |
"""Support for MQTT discovery."""
import asyncio
import logging
from hatasmota.discovery import (
TasmotaDiscovery,
get_device_config as tasmota_get_device_config,
get_entities_for_platform as tasmota_get_entities_for_platform,
get_entity as tasmota_get_entity,
has_entities_with_platform as tasmota... | [
"logging.getLogger",
"hatasmota.discovery.has_entities_with_platform",
"hatasmota.discovery.get_device_config",
"asyncio.Lock",
"hatasmota.discovery.get_entity",
"homeassistant.helpers.dispatcher.async_dispatcher_send",
"hatasmota.discovery.unique_id_from_hash",
"hatasmota.discovery.TasmotaDiscovery",... | [((541, 568), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (558, 568), False, 'import logging\n'), ((4432, 4446), 'asyncio.Lock', 'asyncio.Lock', ([], {}), '()\n', (4444, 4446), False, 'import asyncio\n'), ((4517, 4564), 'hatasmota.discovery.TasmotaDiscovery', 'TasmotaDiscovery', (['dis... |
# Copyright 2019 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | [
"tfx.proto.infra_validator_pb2.ValidationSpec",
"tensorflow_serving.apis.prediction_log_pb2.RegressLog",
"absl.logging.exception",
"absl.logging.info",
"tfx.components.infra_validator.model_server_runners.kubernetes_runner.KubernetesRunner",
"tfx.proto.infra_validator_pb2.RequestSpec",
"tfx.components.i... | [((4482, 4528), 'absl.logging.info', 'logging.info', (['"""Model passed infra validation."""'], {}), "('Model passed infra validation.')\n", (4494, 4528), False, 'from absl import logging\n'), ((4729, 4775), 'absl.logging.info', 'logging.info', (['"""Model failed infra validation."""'], {}), "('Model failed infra valid... |
from django.db import models
from products.models import Product
from utils.models import Utility
class Inventory(Utility):
inventory_number = models.CharField(unique=True, max_length=100, blank=True, null=True)
supplier = models.CharField(max_length=100, blank=True, null=True)
user = models.ForeignKey('... | [
"django.db.models.PositiveIntegerField",
"django.db.models.CharField",
"django.db.models.BooleanField",
"django.db.models.ForeignKey"
] | [((150, 218), 'django.db.models.CharField', 'models.CharField', ([], {'unique': '(True)', 'max_length': '(100)', 'blank': '(True)', 'null': '(True)'}), '(unique=True, max_length=100, blank=True, null=True)\n', (166, 218), False, 'from django.db import models\n'), ((234, 289), 'django.db.models.CharField', 'models.CharF... |
from django.shortcuts import render
from hierarchical_app.models import Folder
# Create your views here.
def index_view(request):
return render(request, 'index.html', {'welcome': "Welcome to Kens Hierarchical Data and You assessment", 'folders': Folder.objects.all()})
| [
"hierarchical_app.models.Folder.objects.all"
] | [((252, 272), 'hierarchical_app.models.Folder.objects.all', 'Folder.objects.all', ([], {}), '()\n', (270, 272), False, 'from hierarchical_app.models import Folder\n')] |
import sys
import os
import argparse
import logging
import json
import time
import subprocess
from shutil import copyfile
import numpy as np
from sklearn import metrics
from easydict import EasyDict as edict
import torch
from torch.utils.data import DataLoader
import torch.nn.functional as F
from torch.nn import DataP... | [
"sklearn.metrics.auc",
"torch.cuda.device_count",
"numpy.array",
"sklearn.metrics.roc_curve",
"os.path.exists",
"tensorboardX.SummaryWriter",
"argparse.ArgumentParser",
"torch.unsqueeze",
"json.dumps",
"os.mkdir",
"subprocess.getstatusoutput",
"utils.misc.lr_schedule",
"time.time",
"data.d... | [((466, 486), 'torch.manual_seed', 'torch.manual_seed', (['(0)'], {}), '(0)\n', (483, 486), False, 'import torch\n'), ((487, 516), 'torch.cuda.manual_seed_all', 'torch.cuda.manual_seed_all', (['(0)'], {}), '(0)\n', (513, 516), False, 'import torch\n'), ((711, 761), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ... |
import unittest
from hf_src.main import soma
class TestSoma(unittest.TestCase):
def test_retorno_soma_15_30(self):
self.assertEqual(soma(15, 30), 45)
| [
"hf_src.main.soma"
] | [((146, 158), 'hf_src.main.soma', 'soma', (['(15)', '(30)'], {}), '(15, 30)\n', (150, 158), False, 'from hf_src.main import soma\n')] |
import copy
import json
from oic.utils.authn.client import CLIENT_AUTHN_METHOD
from oic.utils.keyio import KeyJar
from oic.utils.keyio import KeyBundle
__author__ = 'roland'
import logging
logger = logging.getLogger(__name__)
class OIDCError(Exception):
pass
def flow2sequence(operations, item):
flow = o... | [
"logging.getLogger",
"oic.utils.keyio.KeyJar",
"json.dumps",
"oic.utils.keyio.KeyBundle",
"copy.copy"
] | [((202, 229), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (219, 229), False, 'import logging\n'), ((2044, 2076), 'copy.copy', 'copy.copy', (["kwargs['preferences']"], {}), "(kwargs['preferences'])\n", (2053, 2076), False, 'import copy\n'), ((2812, 2820), 'oic.utils.keyio.KeyJar', 'KeyJ... |
from YoshiViz import Gui
if __name__ == '__main__':
#file director
gui = Gui.Gui()
"""
report_generator.\
generate_pdf_report(fileDirectory, repositoryName, tempCommunityType)
"""
print('the type of', repositoryName, 'is', tempCommunityType, '\n"check .\YoshiViz\output"')
| [
"YoshiViz.Gui.Gui"
] | [((83, 92), 'YoshiViz.Gui.Gui', 'Gui.Gui', ([], {}), '()\n', (90, 92), False, 'from YoshiViz import Gui\n')] |
''' Wrap an __init__ function so that I don't have to assign all the
parameters to a self. variable. '''
# https://stackoverflow.com/questions/5048329/python-decorator-for-automatic-binding-init-arguments
import inspect
from functools import wraps
def lazy_init(init):
''' Create an annotation to assign all the p... | [
"inspect.getfullargspec",
"functools.wraps"
] | [((441, 452), 'functools.wraps', 'wraps', (['init'], {}), '(init)\n', (446, 452), False, 'from functools import wraps\n'), ((375, 403), 'inspect.getfullargspec', 'inspect.getfullargspec', (['init'], {}), '(init)\n', (397, 403), False, 'import inspect\n')] |
# def register_feed():
import os
import cv2
path = '/UserImage'
cam = cv2.VideoCapture(0)
name=input("Name: ")
cv2.namedWindow("test")
img_counter = 0
while True:
ret, frame = cam.read()
if not ret:
print("failed to grab frame")
break
else:
cv2.imshow("test", frame)
k = c... | [
"cv2.imwrite",
"cv2.imshow",
"cv2.destroyAllWindows",
"cv2.VideoCapture",
"cv2.waitKey",
"cv2.namedWindow"
] | [((70, 89), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (86, 89), False, 'import cv2\n'), ((112, 135), 'cv2.namedWindow', 'cv2.namedWindow', (['"""test"""'], {}), "('test')\n", (127, 135), False, 'import cv2\n'), ((758, 781), 'cv2.destroyAllWindows', 'cv2.destroyAllWindows', ([], {}), '()\n', (779, ... |
# -*- encoding: utf-8 -*-
'''
@Author : lance
@Email : <EMAIL>
'''
import time
from model_cx.inceptionresnet import inceptionresnet
from model_cx.vgg19two import vgg19_all_lr
from model_cx.inceptionv3 import inceptionv3
from model_cx.densenet import densenet
from model_cx.nasnet import nasnet
from ... | [
"time.time",
"model_cx.vgg19two.vgg19_all_lr",
"model_cx.nasnet.nasnet",
"model_cx.merge.merge"
] | [((687, 698), 'time.time', 'time.time', ([], {}), '()\n', (696, 698), False, 'import time\n'), ((2581, 2592), 'time.time', 'time.time', ([], {}), '()\n', (2590, 2592), False, 'import time\n'), ((1263, 1327), 'model_cx.merge.merge', 'merge', (['classes', 'epochs', 'steps_per_epoch', 'validation_steps', 'shape'], {}), '(... |
"""Coordinate changes in state space models."""
import abc
try:
# cached_property is only available in Python >=3.8
from functools import cached_property
except ImportError:
from cached_property import cached_property
import numpy as np
import scipy.special # for vectorised factorial
from probnum impor... | [
"numpy.abs",
"numpy.eye",
"probnum.randvars.Normal",
"probnum.linops.Scaling",
"numpy.diag",
"probnum.linops.Identity",
"numpy.arange"
] | [((1145, 1210), 'probnum.randvars.Normal', 'randvars.Normal', (['new_mean', 'new_cov'], {'cov_cholesky': 'new_cov_cholesky'}), '(new_mean, new_cov, cov_cholesky=new_cov_cholesky)\n', (1160, 1210), False, 'from probnum import config, linops, randvars\n'), ((2482, 2506), 'numpy.arange', 'np.arange', (['order', '(-1)', '(... |
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torchvision import datasets
from torch.autograd import Variable
from sklearn.model_selection import train_test_split
import time
import pandas as pd
import numpy as np
import csv
batch_size = 128
NUM_EPOC... | [
"numpy.int64",
"numpy.reshape",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"torch.LongTensor",
"torch.nn.LSTM",
"torch.unsqueeze",
"torch.utils.data.TensorDataset",
"torch.nn.Conv2d",
"numpy.concatenate",
"torch.utils.data.DataLoader",
"torch.nn.Linear",
"torch.nn.functio... | [((2241, 2281), 'pandas.read_csv', 'pd.read_csv', (['"""./drive/My Drive/DATA.csv"""'], {}), "('./drive/My Drive/DATA.csv')\n", (2252, 2281), True, 'import pandas as pd\n'), ((2387, 2416), 'torch.FloatTensor', 'torch.FloatTensor', (['board_data'], {}), '(board_data)\n', (2404, 2416), False, 'import torch\n'), ((2422, 2... |
import json, io, os, os.path
from Catalog.Schema import DBSchema, DBSchemaEncoder, DBSchemaDecoder
from Query.Plan import PlanBuilder
from Storage.StorageEngine import StorageEngine
class Database:
"""
A top-level database engine class.
For now, this primarily maintains a simple catalog,
... | [
"json.loads",
"json.dumps",
"os.path.join",
"doctest.testmod",
"Storage.StorageEngine.StorageEngine",
"Query.Plan.PlanBuilder",
"Catalog.Schema.DBSchema"
] | [((4600, 4617), 'doctest.testmod', 'doctest.testmod', ([], {}), '()\n', (4615, 4617), False, 'import doctest\n'), ((3331, 3351), 'Query.Plan.PlanBuilder', 'PlanBuilder', ([], {'db': 'self'}), '(db=self)\n', (3342, 3351), False, 'from Query.Plan import PlanBuilder\n'), ((4415, 4454), 'json.loads', 'json.loads', (['buffe... |
import unittest
from routes import Mapper
class TestMapperStr(unittest.TestCase):
def test_str(self):
m = Mapper()
m.connect('/{controller}/{action}')
m.connect('entries', '/entries', controller='entry', action='index')
m.connect('entry', '/entries/{id}', controller='entry',... | [
"routes.Mapper"
] | [((124, 132), 'routes.Mapper', 'Mapper', ([], {}), '()\n', (130, 132), False, 'from routes import Mapper\n')] |
# -*- coding: utf-8 -*-
"""
TencentBlueKing is pleased to support the open source community by making 蓝鲸智云-权限中心(BlueKing-IAM) available.
Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in compliance with th... | [
"logging.getLogger",
"backend.biz.group.GroupCheckBiz",
"backend.apps.group.models.Group.objects.all",
"backend.apps.group.models.Group.objects.none",
"backend.biz.role.RoleBiz",
"backend.account.permissions.role_perm_class",
"backend.apps.template.models.PermTemplatePolicyAuthorized.objects.filter_by_s... | [((3317, 3348), 'logging.getLogger', 'logging.getLogger', (['"""permission"""'], {}), "('permission')\n", (3334, 3348), False, 'import logging\n'), ((4682, 4701), 'backend.apps.group.models.Group.objects.all', 'Group.objects.all', ([], {}), '()\n', (4699, 4701), False, 'from backend.apps.group.models import Group\n'), ... |
#!/usr/bin/python3
from PIL import Image
from numpy import complex, array
from tqdm import tqdm
import colorsys
W=512
#W=142
def mandelbrot(x, y):
def get_colors(i):
color = 255 * array(colorsys.hsv_to_rgb(i / 255.0, 1.0, 0.5))
return tuple(color.astype(int))
c, cc = 0, complex(x, y)
fo... | [
"numpy.complex",
"colorsys.hsv_to_rgb"
] | [((300, 313), 'numpy.complex', 'complex', (['x', 'y'], {}), '(x, y)\n', (307, 313), False, 'from numpy import complex, array\n'), ((202, 242), 'colorsys.hsv_to_rgb', 'colorsys.hsv_to_rgb', (['(i / 255.0)', '(1.0)', '(0.5)'], {}), '(i / 255.0, 1.0, 0.5)\n', (221, 242), False, 'import colorsys\n')] |
#!/usr/bin/env python
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# <NAME>
# California Institute of Technology
# (C) 2006-2010 All Rights Reserved
#
# {LicenseText}
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~... | [
"journal.debug",
"unittestX.main",
"mcni.utils.conversion.e2v",
"numpy.array",
"mcni.neutron",
"numpy.linalg.norm",
"journal.warning",
"mccomponents.mccomponentsbp.create_Broadened_E_Q_Kernel"
] | [((445, 491), 'journal.debug', 'journal.debug', (['"""Broadened_E_Q_Kernel_TestCase"""'], {}), "('Broadened_E_Q_Kernel_TestCase')\n", (458, 491), False, 'import journal\n'), ((504, 552), 'journal.warning', 'journal.warning', (['"""Broadened_E_Q_Kernel_TestCase"""'], {}), "('Broadened_E_Q_Kernel_TestCase')\n", (519, 552... |
# -*- coding: utf-8 -*-
"""
Created on Fri Apr 24 18:45:34 2020
@author: kakdemi
"""
import pandas as pd
#importing generators
all_generators = pd.read_excel('generators2.xlsx', sheet_name='NEISO generators (dispatch)')
#getting all oil generators
all_oil = all_generators[all_generators['typ']=='oil'].copy()
#gett... | [
"pandas.DataFrame",
"pandas.concat",
"pandas.read_excel"
] | [((147, 222), 'pandas.read_excel', 'pd.read_excel', (['"""generators2.xlsx"""'], {'sheet_name': '"""NEISO generators (dispatch)"""'}), "('generators2.xlsx', sheet_name='NEISO generators (dispatch)')\n", (160, 222), True, 'import pandas as pd\n'), ((5938, 6124), 'pandas.concat', 'pd.concat', (['[all_other, CT_agg_oil_df... |
from fastapi import APIRouter, status, Body, HTTPException
from fastapi.encoders import jsonable_encoder
from starlette.responses import JSONResponse
from app.models.common import *
from app.models.clickup import *
from app.database.crud.clickup import *
router = APIRouter()
@router.get("/", response_description="C... | [
"fastapi.APIRouter",
"fastapi.encoders.jsonable_encoder",
"fastapi.Body"
] | [((266, 277), 'fastapi.APIRouter', 'APIRouter', ([], {}), '()\n', (275, 277), False, 'from fastapi import APIRouter, status, Body, HTTPException\n'), ((789, 798), 'fastapi.Body', 'Body', (['...'], {}), '(...)\n', (793, 798), False, 'from fastapi import APIRouter, status, Body, HTTPException\n'), ((815, 840), 'fastapi.e... |
# coding=utf-8
import dateutil.parser
import flask
import json
import os
import time
import urllib
import yaml
EPISODES = yaml.load(open("episodes.yaml").read())
app = flask.Flask(__name__,
static_path="/assets",
static_folder="assets")
app.jinja_env.filters["strftime"] = \
... | [
"flask.render_template",
"flask.send_from_directory",
"urllib.quote_plus",
"flask.Flask",
"os.path.join"
] | [((172, 240), 'flask.Flask', 'flask.Flask', (['__name__'], {'static_path': '"""/assets"""', 'static_folder': '"""assets"""'}), "(__name__, static_path='/assets', static_folder='assets')\n", (183, 240), False, 'import flask\n'), ((458, 495), 'os.path.join', 'os.path.join', (['app.root_path', '"""assets"""'], {}), "(app.... |
# Generated by Django 2.2.14 on 2020-11-08 05:40
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('processes', '0131_auto_20201107_2316'),
]
operations = [
migrations.RunSQL(
"UPDATE processes_workflow SET run_environ... | [
"django.db.migrations.RunSQL"
] | [((242, 403), 'django.db.migrations.RunSQL', 'migrations.RunSQL', (['"""UPDATE processes_workflow SET run_environment_id = scheduling_run_environment_id WHERE run_environment_id IS NULL;"""'], {'reverse_sql': '""""""'}), "(\n 'UPDATE processes_workflow SET run_environment_id = scheduling_run_environment_id WHERE run... |
from __future__ import absolute_import, unicode_literals
from dcs.celeryconf import app
import time
from django.core.mail import EmailMessage
@app.task(bind=True, ignore_result=False, max_retries=3)
def demo_task1(self):
result = {
'val1': 1,
'val2': 2,
'val3': 3,
}
print("hellp")
... | [
"dcs.celeryconf.app.task"
] | [((145, 200), 'dcs.celeryconf.app.task', 'app.task', ([], {'bind': '(True)', 'ignore_result': '(False)', 'max_retries': '(3)'}), '(bind=True, ignore_result=False, max_retries=3)\n', (153, 200), False, 'from dcs.celeryconf import app\n')] |
from typing import Any, List, Callable
from fastapi import APIRouter, HTTPException, status, BackgroundTasks
from app import schemas
from app.core import docker_client
import json
from copy import deepcopy
router = APIRouter()
@router.get("/images", response_model=schemas.DockerImageRespond)
def get_docker_image(... | [
"app.core.docker_client.images.list",
"fastapi.APIRouter",
"app.core.docker_client.volumes.list"
] | [((219, 230), 'fastapi.APIRouter', 'APIRouter', ([], {}), '()\n', (228, 230), False, 'from fastapi import APIRouter, HTTPException, status, BackgroundTasks\n'), ((348, 383), 'app.core.docker_client.images.list', 'docker_client.images.list', ([], {'all': '(True)'}), '(all=True)\n', (373, 383), False, 'from app.core impo... |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
from __future__ import unicode_literals
import json
import os
import os.path
import subprocess
import sys
import unittest
import pytest
from ...__main__ import TESTING_TOOLS_ROOT
CWD = os.getcwd()
DATA_DIR = os.path.join... | [
"subprocess.check_output",
"json.loads",
"os.path.join",
"os.getcwd",
"os.path.dirname"
] | [((285, 296), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (294, 296), False, 'import os\n'), ((366, 416), 'os.path.join', 'os.path.join', (['TESTING_TOOLS_ROOT', '"""run_adapter.py"""'], {}), "(TESTING_TOOLS_ROOT, 'run_adapter.py')\n", (378, 416), False, 'import os\n'), ((321, 346), 'os.path.dirname', 'os.path.dirname'... |
'''
Wavelet kernel
slice allows kernel operation on feature subset
active_dims is iterable of feature dimensions to extract
input_dim must equal dimension defined by active_dims
'''
import numpy as np
import tensorflow as tf
from .. import util
from . import kernel
from .kernel_extras import *
class WaveletSlice(ke... | [
"tensorflow.reduce_prod",
"tensorflow.shape",
"tensorflow.Variable",
"tensorflow.ones",
"tensorflow.einsum",
"tensorflow.exp",
"tensorflow.cos"
] | [((1704, 1738), 'tensorflow.einsum', 'tf.einsum', (['"""i,j->ij"""', 'kern1', 'kern2'], {}), "('i,j->ij', kern1, kern2)\n", (1713, 1738), True, 'import tensorflow as tf\n'), ((660, 698), 'tensorflow.Variable', 'tf.Variable', (['[shift]'], {'dtype': 'tf.float32'}), '([shift], dtype=tf.float32)\n', (671, 698), True, 'imp... |
#!/usr/bin/python3
#program to parse png images and change images
# cmd: python3 transform.py
# you must have local input/ and output/ directories
#
# name: <NAME>
# date: 12/27/20
# cmdline: python transform.py cmd show image='city.png' --ulx=1 --uly=2 --brx=0 --bry=9
# python transform.py show city.png
# ... | [
"matplotlib.pyplot.imshow",
"argparse.ArgumentParser",
"matplotlib.image.imread",
"os.access",
"os.path.isfile",
"os.path.isdir",
"imghdr.what",
"time.time",
"image.Image",
"matplotlib.pyplot.show"
] | [((679, 749), 'image.Image', 'Image', ([], {'x_pixels': 'x_pixels', 'y_pixels': 'y_pixels', 'num_channels': 'num_channels'}), '(x_pixels=x_pixels, y_pixels=y_pixels, num_channels=num_channels)\n', (684, 749), False, 'from image import Image\n'), ((1212, 1282), 'image.Image', 'Image', ([], {'x_pixels': 'x_pixels', 'y_pi... |
# -*- coding: utf-8 -*-
# ----------------------------------------------------------------------------
# Copyright 2019-2020 ARM Limited or its affiliates
#
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the... | [
"re.split",
"argparse.FileType",
"suit_tool.keygen.KeyGenerators.keys",
"suit_tool.keygen.OutputFormaters.keys",
"suit_tool.get_pubkey.OutputFormaters.keys"
] | [((1319, 1347), 're.split', 're.split', (['"""="""', 'e'], {'maxsplit': '(1)'}), "('=', e, maxsplit=1)\n", (1327, 1347), False, 'import re\n'), ((2418, 2440), 'argparse.FileType', 'argparse.FileType', (['"""r"""'], {}), "('r')\n", (2435, 2440), False, 'import sys, argparse, os\n'), ((2658, 2681), 'argparse.FileType', '... |
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 7 11:48:59 2020
@author: mazal
"""
"""
=========================================
Support functions of pydicom (Not sourced)
=========================================
Purpose: Create support functions for the pydicom project
"""
"""
Test mode 1 | Basics... | [
"distutils.dir_util.mkpath",
"distutils.dir_util.create_tree",
"distutils.dir_util.copy_tree",
"math.log1p",
"pandas.read_csv",
"numpy.array",
"scipy.stats.loglaplace",
"os.listdir",
"scipy.stats.loglaplace.ppf",
"pandas.DataFrame",
"random.randrange",
"scipy.stats.loglaplace.std",
"scipy.st... | [((1713, 1734), 'os.chdir', 'os.chdir', (['path_source'], {}), '(path_source)\n', (1721, 1734), False, 'import os\n'), ((1756, 1779), 'os.listdir', 'os.listdir', (['path_source'], {}), '(path_source)\n', (1766, 1779), False, 'import os\n'), ((2403, 2443), 'pandas.DataFrame', 'pd.DataFrame', ([], {'data': 'Population_Di... |
from django.db import models
from django.urls import reverse
from django.utils import timezone
from django.utils.safestring import mark_safe
from django.conf import settings
MAX_LEN_AUTHORS_FIELD = 512
CITATION_FORMAT_FLAVORS = ['html', 'ris', 'bibtex', 'biblatex']
DEFAULT_KEYWORDS = ['surface', 'topography']
class... | [
"django.db.models.OneToOneField",
"django.db.models.ForeignKey",
"django.db.models.FileField",
"django.utils.timezone.now",
"django.db.models.PositiveIntegerField",
"django.utils.safestring.mark_safe",
"django.urls.reverse",
"django.db.models.DateTimeField",
"django.db.models.CharField"
] | [((704, 759), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(10)', 'unique': '(True)', 'null': '(True)'}), '(max_length=10, unique=True, null=True)\n', (720, 759), False, 'from django.db import models\n'), ((774, 871), 'django.db.models.OneToOneField', 'models.OneToOneField', (['"""manager.Surf... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-07-24 19:36
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('vendor', '0002_store_image'),
]
operations = [
migrations.AddField(
... | [
"django.db.models.CharField"
] | [((392, 434), 'django.db.models.CharField', 'models.CharField', ([], {'default': '(1)', 'max_length': '(30)'}), '(default=1, max_length=30)\n', (408, 434), False, 'from django.db import migrations, models\n')] |
#!/usr/bin/python
import praw
reddit = praw.Reddit('mob-secondbot')
subreddit = reddit.subreddit("learnpython")
for submission in subreddit.hot(limit=5):
print("Title: ", submission.title)
print("Text: ", submission.selftext)
print("Score: ", submission.score)
print("---------------------------------... | [
"praw.Reddit"
] | [((40, 68), 'praw.Reddit', 'praw.Reddit', (['"""mob-secondbot"""'], {}), "('mob-secondbot')\n", (51, 68), False, 'import praw\n')] |
#!/usr/bin/env python3
import sys
import re
import numpy as np
from PIL import Image
moves = { 'e': (2, 0), 'se': (1, 2), 'sw': (-1, 2), 'w': (-2, 0), 'nw': (-1, -2), 'ne': (1, -2) }
# Save (x, y): True/False in tiles. True = black, False = white.
tiles = {}
for line in open(sys.argv[1]).read().splitlines():
po... | [
"numpy.copy",
"numpy.where",
"PIL.Image.new",
"numpy.array",
"numpy.zeros",
"re.findall"
] | [((683, 722), 'numpy.zeros', 'np.zeros', (['(width * heigth)'], {'dtype': 'np.int8'}), '(width * heigth, dtype=np.int8)\n', (691, 722), True, 'import numpy as np\n'), ((1959, 1974), 'numpy.where', 'np.where', (['board'], {}), '(board)\n', (1967, 1974), True, 'import numpy as np\n'), ((324, 340), 'numpy.array', 'np.arra... |
#!/usr/bin/env python
# Copyright 2017 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 __future__ import absolute_import
from __future__ import print_function
import argparse
import gzip
import json
import os
import s... | [
"os.path.exists",
"argparse.ArgumentParser",
"gzip.open",
"six.itervalues",
"os.makedirs",
"os.path.join",
"shutil.copyfile",
"os.path.abspath",
"six.iteritems",
"six.moves.zip",
"json.dump"
] | [((407, 441), 'os.path.join', 'os.path.join', (['_OUTPUT_DIR', '"""graph"""'], {}), "(_OUTPUT_DIR, 'graph')\n", (419, 441), False, 'import os\n'), ((5509, 5541), 'six.itervalues', 'six.itervalues', (["root['children']"], {}), "(root['children'])\n", (5523, 5541), False, 'import six\n'), ((5977, 6009), 'six.itervalues',... |
"""Write raw files to BIDS format.
example usage: $ mne_bids raw_to_bids --subject_id sub01 --task rest
--raw data.edf --bids_root new_path
"""
# Authors: <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
#
# License: BSD (3-clause)
import mne_bids
from mne_bids import write_raw_bids, BIDSPath
from mne_bids.read import _... | [
"mne.commands.utils.get_optparser",
"mne_bids.read._read_raw",
"mne_bids.write_raw_bids",
"mne_bids.BIDSPath"
] | [((444, 561), 'mne.commands.utils.get_optparser', 'get_optparser', (['__file__'], {'usage': '"""usage: %prog options args"""', 'prog_prefix': '"""mne_bids"""', 'version': 'mne_bids.__version__'}), "(__file__, usage='usage: %prog options args', prog_prefix=\n 'mne_bids', version=mne_bids.__version__)\n", (457, 561), ... |
# -*- coding: utf-8 -*-
"""
Python Markdown
A Python implementation of <NAME>'s Markdown.
Documentation: https://python-markdown.github.io/
GitHub: https://github.com/Python-Markdown/markdown/
PyPI: https://pypi.org/project/Markdown/
Started by <NAME> (http://www.dwerg.net/).
Maintained for a few years by <NAME> (ht... | [
"io.BytesIO",
"markdown.blockparser.State",
"markdown.extensions.Extension",
"markdown.util.AtomicString",
"markdown.serializers.to_xhtml_string",
"os.remove",
"markdown.util.etree.Element",
"json.dumps",
"warnings.simplefilter",
"markdown.util.etree.Comment",
"markdown.serializers.to_html_strin... | [((1426, 1445), 'markdown.Markdown', 'markdown.Markdown', ([], {}), '()\n', (1443, 1445), False, 'import markdown\n'), ((2160, 2203), 'markdown.Markdown', 'markdown.Markdown', ([], {'extensions': "['footnotes']"}), "(extensions=['footnotes'])\n", (2177, 2203), False, 'import markdown\n'), ((2322, 2385), 'markdown.Markd... |
import os
class StressedNetConfig:
def __init__(self,
synaptic_environmental_constraint=0.8,
group_environmental_constraint=0.6,
stress_factor=0.8,
save_folder=os.path.expanduser("~/.nervous/models/")):
self._synaptic_environmental_const... | [
"os.makedirs",
"os.path.exists",
"os.path.expanduser"
] | [((235, 275), 'os.path.expanduser', 'os.path.expanduser', (['"""~/.nervous/models/"""'], {}), "('~/.nervous/models/')\n", (253, 275), False, 'import os\n'), ((1030, 1063), 'os.path.exists', 'os.path.exists', (['self._save_folder'], {}), '(self._save_folder)\n', (1044, 1063), False, 'import os\n'), ((1077, 1107), 'os.ma... |
# Copyright 2020 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... | [
"mindspore.ops.composite.HyperMap",
"mindspore.ops.composite.MultitypeFuncGraph",
"mindspore._checkparam.Validator.check_value_type",
"mindspore.common.Tensor",
"mindspore.ops.functional.partial",
"mindspore._checkparam.Validator.check_number",
"mindspore.ops.operations.ApplyFtrl"
] | [((1043, 1075), 'mindspore.ops.composite.MultitypeFuncGraph', 'C.MultitypeFuncGraph', (['"""ftrl_opt"""'], {}), "('ftrl_opt')\n", (1063, 1075), True, 'from mindspore.ops import functional as F, composite as C, operations as P\n'), ((1655, 1733), 'mindspore._checkparam.Validator.check_value_type', 'validator.check_value... |
'''
Author: huangbaochen<<EMAIL>>
Date: 2021-12-11 20:04:19
LastEditTime: 2021-12-11 21:46:16
LastEditors: huangbaochen<<EMAIL>>
Description: 测试Try单子
No MERCY
'''
import pytest
from fppy.try_monad import Try, Success, Fail
from fppy.option import Just, Nothing
@pytest.mark.try_monad
def test_try_apply():
assert Tr... | [
"fppy.try_monad.Try",
"fppy.try_monad.Fail.unapply",
"fppy.try_monad.Success",
"pytest.raises",
"fppy.option.Nothing",
"fppy.try_monad.Try.apply",
"fppy.try_monad.Success.unapply",
"fppy.option.Just"
] | [((318, 330), 'fppy.try_monad.Try.apply', 'Try.apply', (['(1)'], {}), '(1)\n', (327, 330), False, 'from fppy.try_monad import Try, Success, Fail\n'), ((334, 344), 'fppy.try_monad.Success', 'Success', (['(1)'], {}), '(1)\n', (341, 344), False, 'from fppy.try_monad import Try, Success, Fail\n'), ((356, 362), 'fppy.try_mo... |
import csv
from pyspark.sql import SparkSession
from pyspark.sql.types import IntegerType
spark = SparkSession.builder.appName("Assignment4").getOrCreate()
sc = spark.sparkContext
# load data to dataframe
path = 'fake_data.csv'
df = spark.read.format('csv').option('header','true').load(path)
# cast income as an int... | [
"pyspark.sql.types.IntegerType",
"pyspark.sql.SparkSession.builder.appName"
] | [((100, 143), 'pyspark.sql.SparkSession.builder.appName', 'SparkSession.builder.appName', (['"""Assignment4"""'], {}), "('Assignment4')\n", (128, 143), False, 'from pyspark.sql import SparkSession\n'), ((372, 385), 'pyspark.sql.types.IntegerType', 'IntegerType', ([], {}), '()\n', (383, 385), False, 'from pyspark.sql.ty... |
import unittest
from appium import webdriver
class MSiteDefaultBrowserAndroidUITests(unittest.TestCase):
def setUp(self):
# Default browser does not exist for android >= 6.0
desired_caps = {
'platformName': 'Android',
'deviceName': 'Android Emulator',
'appPac... | [
"unittest.TextTestRunner",
"unittest.TestLoader",
"appium.webdriver.Remote"
] | [((491, 553), 'appium.webdriver.Remote', 'webdriver.Remote', (['"""http://127.0.0.1:4723/wd/hub"""', 'desired_caps'], {}), "('http://127.0.0.1:4723/wd/hub', desired_caps)\n", (507, 553), False, 'from appium import webdriver\n'), ((724, 745), 'unittest.TestLoader', 'unittest.TestLoader', ([], {}), '()\n', (743, 745), Fa... |
'''Functional tests for CPG'''
from .. import CircuitPlayground
from .. import __version__ as CircuitPlaygroundVersion
import time
def funcTest(timestamps: bool = False) -> None:
cpg = CircuitPlayground()
if timestamps:
_printFuncTestHeadingWithDeliLine(f'cpg_scpi v{CircuitPlaygroundVersion}\nRUNNING... | [
"time.sleep"
] | [((989, 1002), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (999, 1002), False, 'import time\n')] |
from django.db import models
class Account(models.Model):
clsNb = models.IntegerField()
Name = models.CharField(max_length=10)
pw = models.IntegerField()
def __str__(self):
return self.Name | [
"django.db.models.CharField",
"django.db.models.IntegerField"
] | [((72, 93), 'django.db.models.IntegerField', 'models.IntegerField', ([], {}), '()\n', (91, 93), False, 'from django.db import models\n'), ((105, 136), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(10)'}), '(max_length=10)\n', (121, 136), False, 'from django.db import models\n'), ((146, 167), '... |
from math import sqrt
import torch
from torch_geometric.utils import geodesic_distance
def test_geodesic_distance():
pos = torch.Tensor([[0, 0, 0], [2, 0, 0], [0, 2, 0], [2, 2, 0]])
face = torch.tensor([[0, 1, 3], [0, 2, 3]]).t()
out = geodesic_distance(pos, face)
expected = [
[0, 1, 1, sqrt... | [
"torch_geometric.utils.geodesic_distance",
"torch.tensor",
"torch.Tensor",
"math.sqrt"
] | [((130, 188), 'torch.Tensor', 'torch.Tensor', (['[[0, 0, 0], [2, 0, 0], [0, 2, 0], [2, 2, 0]]'], {}), '([[0, 0, 0], [2, 0, 0], [0, 2, 0], [2, 2, 0]])\n', (142, 188), False, 'import torch\n'), ((252, 280), 'torch_geometric.utils.geodesic_distance', 'geodesic_distance', (['pos', 'face'], {}), '(pos, face)\n', (269, 280),... |
# Copyright 2009-present MongoDB, 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 wri... | [
"bson.int64.Int64",
"gridfs.errors.CorruptGridFile",
"gridfs.errors.FileExists",
"bson.binary.Binary",
"datetime.datetime.utcnow",
"bson.objectid.ObjectId",
"io.BytesIO",
"io.UnsupportedOperation",
"pymongo.errors.ConfigurationError",
"bson.son.SON",
"pymongo.errors.InvalidOperation",
"gridfs.... | [((1622, 1670), 'bson.son.SON', 'SON', (["[('files_id', ASCENDING), ('n', ASCENDING)]"], {}), "([('files_id', ASCENDING), ('n', ASCENDING)])\n", (1625, 1670), False, 'from bson.son import SON\n'), ((1682, 1739), 'bson.son.SON', 'SON', (["[('filename', ASCENDING), ('uploadDate', ASCENDING)]"], {}), "([('filename', ASCEN... |
"""This module tests Stanford NLP processors."""
import os
import unittest
from texar.torch import HParams
from forte.pipeline import Pipeline
from forte.data.readers import StringReader
from forte.processors.stanfordnlp_processor import StandfordNLPProcessor
from ft.onto.base_ontology import Token, Sentence
class ... | [
"forte.processors.stanfordnlp_processor.StandfordNLPProcessor",
"os.getcwd",
"forte.processors.stanfordnlp_processor.StandfordNLPProcessor.default_hparams",
"forte.pipeline.Pipeline",
"forte.data.readers.StringReader",
"unittest.skip"
] | [((938, 1025), 'unittest.skip', 'unittest.skip', (['"""We need to test this without needing to download models everytime"""'], {}), "(\n 'We need to test this without needing to download models everytime')\n", (951, 1025), False, 'import unittest\n'), ((414, 424), 'forte.pipeline.Pipeline', 'Pipeline', ([], {}), '()... |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Serve current folder files in a HTTP webserver.
"""
import socketserver
from threading import Thread
from http.server import SimpleHTTPRequestHandler
PORT = 8000
def start_http_server(port=PORT):
httpd = socketserver.TCPServer(("", port), SimpleHTTPRequestHand... | [
"threading.Thread",
"socketserver.TCPServer"
] | [((264, 324), 'socketserver.TCPServer', 'socketserver.TCPServer', (["('', port)", 'SimpleHTTPRequestHandler'], {}), "(('', port), SimpleHTTPRequestHandler)\n", (286, 324), False, 'import socketserver\n'), ((342, 376), 'threading.Thread', 'Thread', ([], {'target': 'httpd.serve_forever'}), '(target=httpd.serve_forever)\n... |
# coding: utf-8
class AppTestCompile:
def test_simple(self):
import sys
co = compile('1+2', '?', 'eval')
assert eval(co) == 3
co = compile(memoryview(b'1+2'), '?', 'eval')
assert eval(co) == 3
exc = raises(ValueError, compile, chr(0), '?', 'eval')
assert str(... | [
"ast.parse",
"marshal.dumps"
] | [((4989, 5004), 'ast.parse', 'ast.parse', (['code'], {}), '(code)\n', (4998, 5004), False, 'import ast\n'), ((5432, 5447), 'ast.parse', 'ast.parse', (['code'], {}), '(code)\n', (5441, 5447), False, 'import ast\n'), ((4463, 4481), 'ast.parse', 'ast.parse', (['codestr'], {}), '(codestr)\n', (4472, 4481), False, 'import a... |
import yfinance as yf
import matplotlib.pyplot as plt
import plotly.express as px
import plotly.graph_objects as go
from plotly.subplots import make_subplots
import pandas as pd
from IPython.display import Markdown
import numpy as np
from datetime import date, timedelta
def plot_and_get_info(ticker, start = None, en... | [
"plotly.graph_objects.Bar",
"plotly.subplots.make_subplots",
"IPython.display.Markdown",
"datetime.timedelta",
"plotly.graph_objects.Figure",
"plotly.graph_objects.Scatter",
"pandas.DataFrame",
"datetime.date.today",
"yfinance.Ticker",
"pandas.concat",
"pandas.to_datetime"
] | [((361, 378), 'yfinance.Ticker', 'yf.Ticker', (['ticker'], {}), '(ticker)\n', (370, 378), True, 'import yfinance as yf\n'), ((711, 810), 'plotly.subplots.make_subplots', 'make_subplots', ([], {'rows': '(2)', 'cols': '(1)', 'shared_xaxes': '(True)', 'vertical_spacing': '(0.03)', 'row_heights': '[0.8, 0.2]'}), '(rows=2, ... |
#!/usr/bin/env python
"""Tests for `bids_statsmodels_design_synthesizer` package."""
import pytest
import subprocess as sp
from pathlib import Path
SYNTHESIZER = "aggregate_stats_design.py"
from bids_statsmodels_design_synthesizer import aggregate_stats_design as synth_mod
# from bids_statsmodels_design_synthesizer... | [
"subprocess.check_output",
"pathlib.Path",
"pytest.mark.xfail",
"pytest.raises",
"bids_statsmodels_design_synthesizer.aggregate_stats_design.main"
] | [((1737, 1802), 'pytest.mark.xfail', 'pytest.mark.xfail', ([], {'reason': '"""Container not setup for boutiques yet"""'}), "(reason='Container not setup for boutiques yet')\n", (1754, 1802), False, 'import pytest\n'), ((896, 929), 'bids_statsmodels_design_synthesizer.aggregate_stats_design.main', 'synth_mod.main', (['E... |
#!/usr/bin/env python
# coding: utf-8
__author__ = 'whoami'
"""
@version: 1.0
@author: whoami
@license: Apache Licence 2.0
@contact: <EMAIL>
@site: http://www.itweet.cn
@software: PyCharm Community Edition
@file: plugin_api.py
@time: 2015-11-28 下午1:52
"""
from linux import cpu,disk,iostats,loadavg,memory,netstats,swa... | [
"linux.cpu.monitor",
"linux.iostats.monitor",
"linux.swap.monitor",
"linux.netstats.monitor",
"linux.memory.monitor",
"linux.loadavg.monitor",
"linux.disk.monitor"
] | [((355, 372), 'linux.loadavg.monitor', 'loadavg.monitor', ([], {}), '()\n', (370, 372), False, 'from linux import cpu, disk, iostats, loadavg, memory, netstats, swap\n'), ((407, 420), 'linux.cpu.monitor', 'cpu.monitor', ([], {}), '()\n', (418, 420), False, 'from linux import cpu, disk, iostats, loadavg, memory, netstat... |
import numpy as np
import eyekit
import algorithms
import core
data = eyekit.io.load(core.FIXATIONS / 'sample.json')
passages = eyekit.io.load(core.DATA / 'passages.json')
original_sequence = data['trial_5']['fixations']
fixation_XY = np.array([fixation.xy for fixation in original_sequence], dtype=int)
word_XY = np.... | [
"eyekit.vis.Image",
"eyekit.vis.Figure",
"numpy.column_stack",
"algorithms.dynamic_time_warping",
"eyekit.io.load",
"numpy.array"
] | [((71, 117), 'eyekit.io.load', 'eyekit.io.load', (["(core.FIXATIONS / 'sample.json')"], {}), "(core.FIXATIONS / 'sample.json')\n", (85, 117), False, 'import eyekit\n'), ((129, 172), 'eyekit.io.load', 'eyekit.io.load', (["(core.DATA / 'passages.json')"], {}), "(core.DATA / 'passages.json')\n", (143, 172), False, 'import... |
#!/usr/bin/python3
'''
This script follows formulas put forth in Kislyuk et al. (2011) to calculate genome
fluidity of a pangenome dataset. Variance and standard error are estimated as total
variance containing both the variance due to subsampling all possible combinations
(without replacement) of N genomes from th... | [
"matplotlib.pyplot.grid",
"scipy.optimize.differential_evolution",
"matplotlib.pyplot.ylabel",
"numpy.array",
"random.choices",
"sys.exit",
"numpy.mean",
"argparse.ArgumentParser",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.minorticks_on",
"numpy.exp",
"os.path.... | [((1749, 1760), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (1758, 1760), False, 'import os, sys, re, argparse, random, itertools, scipy, warnings, subprocess\n'), ((1921, 2213), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'usage': '"""./%(prog)s [options] -i orthogroups -o output_folder"""', 'descripti... |
#
# This module provides the Instance class that encapsulate some complex server instances related operations
#
from __future__ import print_function
from json import loads
from neutronclient.v2_0 import client as neutron_client
from novaclient import client as nova_client
from cinderclient import client as cinder_cli... | [
"json.loads",
"osvolbackup.verbose.vprint",
"cinderclient.client.Client",
"osvolbackup.server.ServerInstance",
"neutronclient.v2_0.client.Client",
"time.sleep",
"osvolbackup.osauth.get_session",
"novaclient.client.Client",
"time.time"
] | [((757, 770), 'osvolbackup.osauth.get_session', 'get_session', ([], {}), '()\n', (768, 770), False, 'from osvolbackup.osauth import get_session, VERSION\n'), ((794, 832), 'neutronclient.v2_0.client.Client', 'neutron_client.Client', ([], {'session': 'session'}), '(session=session)\n', (815, 832), True, 'from neutronclie... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Tools to create profiles (i.e. 1D "slices" from 2D images)."""
import numpy as np
import scipy.ndimage
from astropy import units as u
from astropy.convolution import Box1DKernel, Gaussian1DKernel
from astropy.coordinates import Angle
from astropy.table ... | [
"numpy.sqrt",
"astropy.table.Table",
"numpy.arange",
"numpy.digitize",
"matplotlib.pyplot.gca",
"numpy.diff",
"astropy.convolution.Gaussian1DKernel",
"matplotlib.pyplot.figure",
"numpy.isnan",
"numpy.nanmax",
"astropy.convolution.Box1DKernel",
"numpy.nansum",
"astropy.units.Quantity"
] | [((5684, 5691), 'astropy.table.Table', 'Table', ([], {}), '()\n', (5689, 5691), False, 'from astropy.table import Table\n'), ((8050, 8068), 'astropy.units.Quantity', 'u.Quantity', (['radius'], {}), '(radius)\n', (8060, 8068), True, 'from astropy import units as u\n'), ((12194, 12221), 'matplotlib.pyplot.figure', 'plt.f... |
"""versatileimagefield Field mixins."""
import os
import re
from .datastructures import FilterLibrary
from .registry import autodiscover, versatileimagefield_registry
from .settings import (
cache,
VERSATILEIMAGEFIELD_CREATE_ON_DEMAND,
VERSATILEIMAGEFIELD_SIZED_DIRNAME,
VERSATILEIMAGEFIELD_FILTERED_DIR... | [
"os.path.split",
"os.path.splitext",
"os.path.join",
"re.compile"
] | [((848, 886), 're.compile', 're.compile', (["(filter_regex_snippet + '$')"], {}), "(filter_regex_snippet + '$')\n", (858, 886), False, 'import re\n'), ((901, 938), 're.compile', 're.compile', (["(sizer_regex_snippet + '$')"], {}), "(sizer_regex_snippet + '$')\n", (911, 938), False, 'import re\n'), ((964, 1024), 're.com... |
# Copyright 2020, Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | [
"utils.task_utils.define_task_flags",
"absl.logging.info",
"tensorflow_federated.simulation.run_training_process",
"tensorflow_federated.aggregators.clipping_factory",
"tensorflow_federated.aggregators.PrivateQuantileEstimationProcess.no_noise",
"tensorflow_federated.aggregators.MeanFactory",
"absl.flag... | [((941, 973), 'utils.utils_impl.record_hparam_flags', 'utils_impl.record_hparam_flags', ([], {}), '()\n', (971, 973), False, 'from utils import utils_impl\n'), ((1025, 1073), 'utils.optimizers.optimizer_utils.define_optimizer_flags', 'optimizer_utils.define_optimizer_flags', (['"""client"""'], {}), "('client')\n", (106... |
import open3d as o3d
import numpy as np
pc_load_pathname = '/home/caizhongang/github/waymo_kitti_converter/007283-000.bin'
pc = np.fromfile(pc_load_pathname, dtype=np.float32).reshape(-1, 3)
pcd = o3d.geometry.PointCloud()
pcd.points = o3d.utility.Vector3dVector(pc)
axis = o3d.geometry.TriangleMesh.create_coordinat... | [
"numpy.fromfile",
"open3d.visualization.draw_geometries",
"open3d.geometry.PointCloud",
"open3d.geometry.TriangleMesh.create_coordinate_frame",
"open3d.utility.Vector3dVector"
] | [((199, 224), 'open3d.geometry.PointCloud', 'o3d.geometry.PointCloud', ([], {}), '()\n', (222, 224), True, 'import open3d as o3d\n'), ((239, 269), 'open3d.utility.Vector3dVector', 'o3d.utility.Vector3dVector', (['pc'], {}), '(pc)\n', (265, 269), True, 'import open3d as o3d\n'), ((278, 353), 'open3d.geometry.TriangleMes... |
"""node-path implementation for OpenGLContext
"""
from vrml.vrml97 import nodepath, nodetypes
from vrml.cache import CACHE
from OpenGLContext import quaternion
from OpenGL.GL import glMultMatrixf
class _NodePath( object ):
"""OpenGLContext-specific node-path class
At the moment this only adds a single method,... | [
"OpenGLContext.quaternion.Quaternion",
"OpenGL.GL.glMultMatrixf",
"OpenGLContext.quaternion.fromXYZR"
] | [((1074, 1095), 'OpenGL.GL.glMultMatrixf', 'glMultMatrixf', (['matrix'], {}), '(matrix)\n', (1087, 1095), False, 'from OpenGL.GL import glMultMatrixf\n'), ((1435, 1458), 'OpenGLContext.quaternion.Quaternion', 'quaternion.Quaternion', ([], {}), '()\n', (1456, 1458), False, 'from OpenGLContext import quaternion\n'), ((15... |
import random
from math import sqrt
sum = 0
for x in range(101):
sum += x
print(sum)
'''
range(101) 0-100 一共101个数
range(1,101) 1-100
range(1,101,2) 1-100间的奇数 步长为2
range(100,0,-2) 100-0间的偶数 步长为-2
'''
sum = 0
for x in range(100, 0, -2):
sum += x
print(sum)
# while
# 0-100间的随机数
answer = random.randint(0, 1... | [
"math.sqrt",
"random.randint"
] | [((301, 323), 'random.randint', 'random.randint', (['(0)', '(100)'], {}), '(0, 100)\n', (315, 323), False, 'import random\n'), ((789, 798), 'math.sqrt', 'sqrt', (['num'], {}), '(num)\n', (793, 798), False, 'from math import sqrt\n')] |
#!/usr/bin/env python
"""
Compute diffusion coefficient from MSD data.
Time interval, DT, is obtained from in.pmd in the same directory.
Usage:
msd2diff.py [options] MSD_FILE
Options:
-h, --help Show this message and exit.
-o, --offset OFFSET
Offset of given data. [default: 0]
--plot Plot ... | [
"seaborn.set",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.plot",
"os.path.dirname",
"numpy.array",
"numpy.linalg.lstsq",
"docopt.docopt",
"numpy.var"
] | [((2111, 2126), 'numpy.var', 'np.var', (['A[:, 0]'], {}), '(A[:, 0])\n', (2117, 2126), True, 'import numpy as np\n'), ((2142, 2178), 'numpy.linalg.lstsq', 'np.linalg.lstsq', (['A', 'msds'], {'rcond': 'None'}), '(A, msds, rcond=None)\n', (2157, 2178), True, 'import numpy as np\n'), ((2436, 2451), 'docopt.docopt', 'docop... |
import pytest
import numbers
import numpy as np
from numpy.testing import assert_raises
from numpy.testing import assert_array_equal
from numpy.testing import assert_equal
from numpy.testing import assert_raises_regex
from skopt.space import LogN, Normalize
@pytest.mark.fast_test
def test_logn2_integer():
transf... | [
"numpy.round",
"skopt.space.LogN",
"numpy.testing.assert_raises",
"skopt.space.Normalize"
] | [((328, 335), 'skopt.space.LogN', 'LogN', (['(2)'], {}), '(2)\n', (332, 335), False, 'from skopt.space import LogN, Normalize\n'), ((559, 566), 'skopt.space.LogN', 'LogN', (['(2)'], {}), '(2)\n', (563, 566), False, 'from skopt.space import LogN, Normalize\n'), ((793, 822), 'skopt.space.Normalize', 'Normalize', (['(1)',... |
import tensorflow as tf
FLIPPING_TENSOR = tf.constant([1.0, -1.0, 1.0])
@tf.function
def sample_data(points, labels, num_point):
if tf.random.uniform(shape=()) >= 0.5:
return points * FLIPPING_TENSOR, labels
return points, labels
mock_data = tf.constant([
[1., 2., 3.],
[4., 5., 6.],
[7.... | [
"tensorflow.random.uniform",
"tensorflow.data.Dataset.from_tensors",
"tensorflow.constant"
] | [((43, 72), 'tensorflow.constant', 'tf.constant', (['[1.0, -1.0, 1.0]'], {}), '([1.0, -1.0, 1.0])\n', (54, 72), True, 'import tensorflow as tf\n'), ((263, 327), 'tensorflow.constant', 'tf.constant', (['[[1.0, 2.0, 3.0], [4.0, 5.0, 6.0], [7.0, 8.0, 9.0]]'], {}), '([[1.0, 2.0, 3.0], [4.0, 5.0, 6.0], [7.0, 8.0, 9.0]])\n',... |
from flask import Flask
app = Flask(__name__)
@app.route('/')
def index():
return 'This is the app index page.'
| [
"flask.Flask"
] | [((30, 45), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (35, 45), False, 'from flask import Flask\n')] |
# Generated by Django 3.1.6 on 2021-02-16 11:37
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('schedule', '0026_event'),
]
operations = [
migrations.AlterField(
model_name='group',
name='students',
f... | [
"django.db.models.ManyToManyField"
] | [((325, 403), 'django.db.models.ManyToManyField', 'models.ManyToManyField', ([], {'blank': '(True)', 'to': '"""schedule.Student"""', 'verbose_name': '"""Учні"""'}), "(blank=True, to='schedule.Student', verbose_name='Учні')\n", (347, 403), False, 'from django.db import migrations, models\n'), ((528, 615), 'django.db.mod... |
from django.test import SimpleTestCase as TestCase
from corehq.apps.app_manager.models import _parse_xml
import os
class XMLParsingTest(TestCase):
def testUnicodeError(self):
"""Tests a bug found in Unicode processing of a form"""
file_path = os.path.join(os.path.dirname(__file__), "data", "un... | [
"os.path.dirname",
"corehq.apps.app_manager.models._parse_xml"
] | [((282, 307), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (297, 307), False, 'import os\n'), ((443, 463), 'corehq.apps.app_manager.models._parse_xml', '_parse_xml', (['xml_data'], {}), '(xml_data)\n', (453, 463), False, 'from corehq.apps.app_manager.models import _parse_xml\n')] |
import unittest
from app.models import News
# News = news.News
class NewsTest(unittest.TestCase):
'''
Test Class to test the behaviour of the Movie class
'''
def setUp(self):
'''
Set up method that will run before every Test
'''
self.new_news = News('abc-news','ABC NEWS... | [
"app.models.News"
] | [((295, 492), 'app.models.News', 'News', (['"""abc-news"""', '"""ABC NEWS"""', '"""Your trusted source for breaking news, analysis, exclusive interviews, headlines, and videos at ABCNews.com."""', '"""http://www.abc.net.au/news"""', '"""business"""', '"""au"""'], {}), "('abc-news', 'ABC NEWS',\n 'Your trusted source... |
from sanic import Blueprint, Request, HTTPResponse, response
from sanic.models.handler_types import RouteHandler
from functools import wraps
from inspect import isawaitable
from typing import Callable, Dict, Any, Union, Awaitable, List, Optional
ACCEPTED_WISH_VERS = ['wish.alpha.v1']
WishHandler = Callable[..., Union... | [
"sanic.response.json",
"inspect.isawaitable",
"functools.wraps"
] | [((604, 613), 'functools.wraps', 'wraps', (['fn'], {}), '(fn)\n', (609, 613), False, 'from functools import wraps\n'), ((1107, 1147), 'sanic.response.json', 'response.json', (["{'error': None, **retval}"], {}), "({'error': None, **retval})\n", (1120, 1147), False, 'from sanic import Blueprint, Request, HTTPResponse, re... |
import argparse
import boto3
import json
import logging
import os
from progressbar import ProgressBar
import sys
"""
Collects IAM Policies
Evaluates policies looking for badness (*.*, Effect:Allow + NotAction)
Need to add more tests/use cases
"""
def get_policies(profile):
session = boto3.session.Session(profi... | [
"logging.basicConfig",
"boto3.session.Session",
"argparse.ArgumentParser",
"json.dumps",
"os.path.join",
"logging.info",
"logging.error",
"progressbar.ProgressBar"
] | [((293, 336), 'boto3.session.Session', 'boto3.session.Session', ([], {'profile_name': 'profile'}), '(profile_name=profile)\n', (314, 336), False, 'import boto3\n'), ((1735, 1783), 'progressbar.ProgressBar', 'ProgressBar', (['"""\tChecking for Dangerous Policies"""'], {}), "('\\tChecking for Dangerous Policies')\n", (17... |
import json
import os
import re
from testinfra.utils.ansible_runner import AnsibleRunner
import util
testinfra_hosts = AnsibleRunner(os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('agent-integrations')
def _get_key_value(tag_list):
for key, value in (pair.split(':', 1) for pair in tag_list):
yield ke... | [
"json.loads",
"re.compile",
"testinfra.utils.ansible_runner.AnsibleRunner",
"util.wait_until",
"json.dump"
] | [((2256, 2295), 'util.wait_until', 'util.wait_until', (['assert_topology', '(30)', '(3)'], {}), '(assert_topology, 30, 3)\n', (2271, 2295), False, 'import util\n'), ((3514, 3555), 'util.wait_until', 'util.wait_until', (['wait_for_metrics', '(180)', '(3)'], {}), '(wait_for_metrics, 180, 3)\n', (3529, 3555), False, 'impo... |
import os
import sys
from contextlib import contextmanager
from invoke import UnexpectedExit
def git_commit(c, addstr, msg):
try:
c.run("git config --get user.email")
c.run("git config --get user.name")
except UnexpectedExit:
c.run('git config --local user.email "<EMAIL>"')
c.... | [
"os.chdir",
"sys.path.pop",
"os.getcwd"
] | [((469, 480), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (478, 480), False, 'import os\n'), ((485, 502), 'os.chdir', 'os.chdir', (['dirpath'], {}), '(dirpath)\n', (493, 502), False, 'import os\n'), ((554, 566), 'os.chdir', 'os.chdir', (['wd'], {}), '(wd)\n', (562, 566), False, 'import os\n'), ((571, 586), 'sys.path.po... |
from scipy.io import wavfile
import numpy as np
import pingouin as pg
import pandas as pd
_,data = wavfile.read('wav//ed//mp3baked.wav')
_,data1 = wavfile.read('wav//ing//ingeating.wav')
i= data.shape[0]-1
j = data1.shape[0]-1
index_1 = -1
index_2 = -1
try:
data.shape[1]
except IndexError:
... | [
"scipy.io.wavfile.read",
"pingouin.corr"
] | [((106, 143), 'scipy.io.wavfile.read', 'wavfile.read', (['"""wav//ed//mp3baked.wav"""'], {}), "('wav//ed//mp3baked.wav')\n", (118, 143), False, 'from scipy.io import wavfile\n'), ((155, 194), 'scipy.io.wavfile.read', 'wavfile.read', (['"""wav//ing//ingeating.wav"""'], {}), "('wav//ing//ingeating.wav')\n", (167, 194), F... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.