text stringlengths 2 999k |
|---|
# インストールした discord.py を読み込む
import discord
import threading
import queue
import asyncio
import cmdgroup.bb as cm_bb
import cmdgroup.common as cm_common
import easy_cmd_convert
import os
class mitsune_if(discord.Client):
# 自分のBotのアクセストークンに置き換えてください
TOKEN = os.environ["YOUR_CHANNEL_ACCESS_TOKEN"]
... |
# Copyright (c) SenseTime. All Rights Reserved.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import logging
import os
import time
import math
import json
import random
import numpy as np
import tor... |
# import pytest
#
# from .. import shape_helpers as sh
# from ..test_creation_functions import frange
# from ..test_manipulation_functions import roll_ndindex
# from ..test_signatures import extension_module
#
#
# def test_extension_module_is_extension():
# assert extension_module("linalg")
#
#
# def test_extension... |
#!/usr/bin/env python3
# Copyright (c) 2014-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Helpful routines for regression testing
#
import os
import sys
from binascii import hexlify, unhex... |
__author__ = 'Danyang'
def drange(start, stop, step):
r = start
while r<stop:
yield r
r += step
def frange(start, stop, step):
return list(drange(start, stop, step)) |
def http_requests():
s = "(java.io.PrintStream.write).*","(accepttypes).*","(request.browser).*","(request.files).*","(request.headers).*","(request.httpmethod).*","(request.item).*","(request.querystring).*","(request.form).*","(request.cookies).*","(request.certificate).*","(request.rawurl).*","(request.server... |
#!e:\workspace_ygcbook\ygcbook\venv\scripts\python.exe
from django.core import management
if __name__ == "__main__":
management.execute_from_command_line()
|
mijn_slaapkamer = {
'adres': "De Houtmanstraat 129",
'postcode': 6826,
'stad': "Arnhem",
'oppervlakte': 20,
'plafon hoogte':2.5,
'deuren': 1,
'ramen':3,
'bedden' : 1,
'koelkast' : 1,
}
|
"""Parser for JINOU Beacon BLE advertisements"""
import logging
from struct import unpack
_LOGGER = logging.getLogger(__name__)
def parse_jinou(self, data, source_mac, rssi):
"""Jinou parser"""
msg_length = len(data)
firmware = "Jinou"
result = {"firmware": firmware}
if msg_length == 15:
... |
# (C) Datadog, Inc. 2020-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
from codecs import open # To use a consistent encoding
from os import path
from setuptools import setup
HERE = path.dirname(path.abspath(__file__))
# Get version info
ABOUT = {}
with open(path.join(HER... |
# Copyright 2009-2012 10gen, 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,... |
linha = input().split()
a = float(linha[0])
b = float(linha[1])
c = float(linha[2])
numeros = [a, b, c]
ordenados = sorted(numeros)
c = (ordenados[0])
b = (ordenados[1])
a = (ordenados[2])
if a >= b+c:
print("NAO FORMA TRIANGULO")
else:
if a ** 2 == b ** 2 + c ** 2:
print("TRIANGULO RETANGULO")
... |
#!/usr/bin/python
from datmo.core.util.i18n import get as __
class ArgumentError(Exception):
pass
class TaskNotComplete(ArgumentError):
pass
class TaskNoCommandGiven(ArgumentError):
pass
class TaskInteractiveDetachError(ArgumentError):
pass
class SnapshotCreateFromTaskArgs(ArgumentError):
... |
# -*- coding: utf-8 -*-
# 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 o... |
"""Initial Migration
Revision ID: 2476073f996b
Revises:
Create Date: 2020-12-14 22:22:02.178020
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '2476073f996b'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto ... |
# -*- coding: utf-8 -*-
#
# This file is part of PyBuilder
#
# Copyright 2011-2020 PyBuilder Team
#
# 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/l... |
from base64 import standard_b64decode
from ..utils import now
from .forms import ClientAuthForm, PublicPasswordGrantForm
from .models import AccessToken
class BaseBackend(object):
"""
Base backend used to authenticate clients as defined in :rfc:`1` against
our database.
"""
def authenticate(self,... |
from pm4pymdl.algo.mvp.utils import filter_metaclass
from pm4pymdl.algo.mvp.utils import succint_mdl_to_exploded_mdl
def filter_float(df, act, attr, v1, v2, parameters=None):
if parameters is None:
parameters = {}
try:
if df.type == "succint":
df = succint_mdl_to_exploded_mdl.appl... |
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.tree import DecisionTreeClassifier
from sklearn.metrics import confusion_matrix
from sklearn.preprocessing import LabelEncoder
from sklearn.decomposition import PCA
from sklearn.metrics import classification_report... |
import uuid
import os
from resize_backend import settings
from django.db import models
from resize_backend.tasks import fila
from django.db.models import signals
import json
def scramble_uploaded_filename(instance, filename):
extension = filename.split(".")[-1]
return "{}.{}".format(uuid.uuid4(), extension)
... |
from src.neural_network.Neuron import Neuron
from src.neural_network.exceptions import NotAvailableActivationFunction
from src.neural_network.activation_function import Sigmoid, Step, Tanh
import numpy as np
class NeuronLayer:
"""
This class provides the functionality to operate a layer of neurons.
"""
... |
import _plotly_utils.basevalidators
class YsideValidator(_plotly_utils.basevalidators.EnumeratedValidator):
def __init__(self, plotly_name="yside", parent_name="layout.grid", **kwargs):
super(YsideValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... |
import os
from setuptools import setup, find_packages
def read(filename):
with open(os.path.join(os.path.dirname(__file__), filename)) as f:
return f.read()
setup(
author_email='luis.domenzain@parrot.com',
author='Luis Mario Domenzain',
classifiers=[
'Development Status :: 3 - Alpha'... |
# EQUIPE: Ana Laura Schoffen Rodrigues e Bruno Fusieger Santana
# RAs: 115456 e 112646
from copy import copy
from math import inf
from typing import List, Dict
from collections import deque
from random import choice, random
class Vertice:
"""
Representa um vértice de um grafo com um número, uma lista de adjac... |
# -*- coding: utf-8
from flask import Flask # type: ignore
from . import initializers
def create_app(config=None):
""" Application Factories
http://flask.pocoo.org/docs/patterns/appfactories/
"""
app = Flask(
__name__, static_folder='static/dist', static_url_path='/static')
if config:... |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
"""
Implementation of the "fetcher" module of HMA.
Fetching involves connecting to the ThreatExchange API and downloading
signals to synchronize a local copy of the database, which will then
be fed into various indices.
"""
import logging
import ... |
import pytest
from scarpa.generate.modulation import create_modulation
from scarpa.generate.template import stack_template
from scarpa.generate.shapes import sinus, hanning
from scarpa.estimate.periodic import fit_with_plen_known, vec2parms
import numpy as np
@pytest.fixture
def mixture():
pcount = 23.5
plen ... |
# This sample tests type inference for list expressions.
# pyright: strict, reportUnknownVariableType=false
from typing import Any, Collection, Dict, Generic, List, Literal, Optional, Sequence, TypeVar
v1 = [1, 2, 3]
t_v1: Literal["list[int]"] = reveal_type(v1)
v2 = [1, 3.4, "hi"]
t_v2: Literal["list[int | float |... |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
OpenAPI spec version: v1.15.7
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import unittest
import kube... |
# -*- coding: utf-8 -*-
from django.conf import settings
from django.conf.urls import include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = [
url(r'^', include('bviewer.core.urls')),
url(r'^archive/', include('bviewer.archive.urls')),
url(r'^api/', include('bviewer.api.urls')),
... |
# Copyright (c) 2010-2012 OpenStack Foundation
#
# 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 agree... |
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions a... |
import datetime
import json
import string
import dateparser
from flask import Flask
from flask import render_template
from flask import request
import dbconfig
if dbconfig.test:
from mockdbhelper import MockDBHelper as DBHelper
else:
from dbhelper import DBHelper
app = Flask(__name__)
DB = DBHelper()
cate... |
import time
import os
from pathlib import Path
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.keys import Keys
import utils.config as cfg
import utils.console as console
class FBGrabber:
def __init__(self, name):
f_name = name.replace(' ', '%20')
self.u... |
#
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
# its licensors.
#
# For complete copyright and license terms please see the LICENSE at the root of this
# distribution (the "License"). All use of this software is governed by the License,
# or, if provided, by the license below or th... |
"""Test the parallel groups."""
import unittest
import itertools
from collections.abc import Iterable
import numpy as np
import openmdao.api as om
from openmdao.utils.mpi import MPI
try:
from parameterized import parameterized
except ImportError:
from openmdao.utils.assert_utils import SkipParameterized as... |
"""
REST API Documentation for the NRS TFRS Credit Trading Application
The Transportation Fuels Reporting System is being designed to streamline
compliance reporting for transportation fuel suppliers in accordance with
the Renewable & Low Carbon Fuel Requirements Regulation.
OpenAPI spec version: ... |
# Generated by Django 2.2.2 on 2019-11-20 07:37
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0113_auto_20191112_1400'),
]
operations = [
migrations.AddField(
model_name='method',
name='complete',
... |
# !/usr/bin/python3
# -*- coding: utf-8 -*-
# @Author:梨花菜
# @File: run_all_auto_case.py
# @Time : 2019/2/18 15:02
# @Email: lihuacai168@gmail.com
# @Software: PyCharm
from django.http import HttpResponse, JsonResponse
import json
from fastrunner import models
from FasterRunner.mycelery import app
from djcelery.models... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2017-03-11 11:36
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = []
operations = [
migrations.CreateModel(
name="EmailTemplate... |
import sys, math, pygame
from mob import *
from player import *
class Tripleshot(Mob):
def __init__(self, startPos=[0,0]):
Mob.__init__(self, "PNG/Power-ups/Tripleshot.png", [0,0], startPos)
# ~ print self.rect.center, speed
self.kind = "tripleShot"
self.lives = 1
self.aliv... |
from typing import List
import numpy as np
from graph import show_routes, sum_route_capacity
from utils import sort_with_key
from moves import shift
def create_n_routes(nodes: List[dict], clients: int) -> List[np.array]:
"""
Cria lista de arrays em que cada array possui apenas o valor da cidade.
"""
... |
# Copyright 2010 OpenStack Foundation
# 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 requ... |
#!/bin/usr/python
import sys
def readline():
return sys.stdin.readline()
def get_int():
return int(readline())
string = 'These aren\'t the droids you\'re looking for.'
print('%s\nWho said it? ' % string, end='')
sys.stdout.flush()
inp = readline().strip()
print('%s says, \"%s\"' % (inp, string))
|
'''
Hodgkin-Huxley equations (1952)
We calculate the extracellular field potential at various places.
'''
from brian2 import *
defaultclock.dt = 0.01*ms
morpho = Cylinder(x=[0, 10]*cm, diameter=2*238*um, n=1000, type='axon')
El = 10.613* mV
ENa = 115*mV
EK = -12*mV
gl = 0.3*msiemens/cm**2
gNa0 = 120*msiemens/cm**2
gK... |
import dropbox
from prefect.core import Task
from prefect.utilities.tasks import defaults_from_attrs
class DropboxDownload(Task):
"""
Task for downloading a file from Dropbox. Note that _all_ initialization settings can be
provided / overwritten at runtime.
Args:
- path (str, optional): the ... |
import os
import sys
import json
import xlrd
import getopt
def print_args():
print(""" This program is used to convert 2 columns of excel sheet to json data as key: value pair.
Usage:
python Excel2Json.py --file <filename and path> [options]
Options:
--file <filename> give... |
# Copyright 2020 Quentin Gliech
# Copyright 2020-2021 The Matrix.org Foundation C.I.C.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... |
# Use with caution -- This saves the LastPass vault in the iOS keychain.
# Although the keychain is encrypted, I believe it is not 100% secure.
# At a minimum you probably should `keychain.set_master_password()`
import clipboard, console, keychain, lastpass, uuid, webbrowser
email = keychain.get_password('lastpass_em... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""The setup script."""
from setuptools import setup, find_packages
with open('README.rst') as readme_file:
readme = readme_file.read()
with open('HISTORY.rst') as history_file:
history = history_file.read()
requirements = ['Click>=6.0', ]
setup_requirements =... |
import sys
import os
import logging
import json
from qtpy import QtGui, QtCore, QtWidgets
def getInstrumentserverPath(*subfolder: str) -> str:
"""get the absolute path of the instrumentserver module
by specifying a subfolder, get the absolute path of that.
:example:
>>> getInstrumentserverPath... |
from mwclient import Site
import html2markdown
import re
import discord
import os
import functools
try:
from dotenv import load_dotenv
load_dotenv()
except ImportError:
pass
VERSION = '1.0.1'
command = os.getenv('DISCORD_BOT_COMMAND')
if command == None or len(command) == 0:
command = '$wiki'
def to... |
from random import randint
c = 0
while True:
op = str(input('PAR ou ÍMPAR? ')).strip().upper()[0]
n = int(input('Qual o número? '))
npc = randint(1, 10)
s = n + npc
if op == 'P':
if s % 2 == 0:
print(f'Vc ganhou!! Deu par, o pc jogou \033[31m{npc}\033[m e vc \033[31m{n}\033[m')
... |
"""
Contains the core building blocks of the framework.
"""
import math
from copy import deepcopy
import pandas as pd
import numpy as np
import cython as cy
class Node(object):
"""
The Node is the main building block in bt's tree structure design.
Both StrategyBase and SecurityBase inherit Node. It cont... |
# Copyright 2015, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... |
from .viz import (
CircleViz,
GraduatedCircleViz,
HeatmapViz,
ClusteredCircleViz,
ImageViz,
RasterTilesViz,
ChoroplethViz,
LinestringViz,
)
from .layers import (
CircleLayer,
GraduatedCircleLayer,
HeatmapLayer,
ClusteredCircleLayer,
ImageLayer,
RasterTilesLayer,
... |
# Copyright (C) 2016 Igalia S.L. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the ... |
# -*- coding: utf-8 -*-
# this file is released under public domain and you can use without limitations
#########################################################################
## This is a sample controller
## - index is the default action of any application
## - user is required for authentication and authorization... |
#!/usr/bin/env python3
SUPPORTED_LANGUAGES = ["ar-EG", "ca-ES", "cs-CZ", "da-DK", "de-DE", "en-GB", "en-US", "eo-ZZ",\
"es-ES", "fi-FI", "fr-FR", "hu-HU", "it-IT", "ja-JP", "ko-KR", "nb-NO",\
"nl-NL", "pl-PL", "pt-BR", "ru-RU", "sv-SE", "tr-TR", "zh-CN", "zh-TW"]
|
"""
Goals of this part of the examples:
1. Learn how to create a custom `Optimizer` class
2. Learn the different optimizer frameworks
3. Learn the usage of `StatisticsAnalyzer`
4. Understand the motivation behing `AixCaliBuHA`
"""
# Start by importing all relevant packages
import matplotlib.pyplot as plt
import numpy a... |
# encoding: utf-8
import os
ENV_NAME_PATTERN = "HOLLOWMAN_{namespace}_{option_name}"
def get_option(namespace, option_name):
"""
Gets an options based on an namespace and an option name.
All option are read from Environ variables. The formation name is:
HOLLOWMAN_<NAMESPACE>_<OPTIONNAME>
If OPTI... |
# coding: utf-8
"""
OpenShift API (with Kubernetes)
OpenShift provides builds, application lifecycle, image content management, and administrative policy on top of Kubernetes. The API allows consistent management of those objects. All API operations are authenticated via an Authorization bearer token that is... |
from fixtureless.factory import Factory
|
# Generated by Django 2.0.2 on 2018-03-21 14:50
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('profBasic', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='profbasic',
name='email',
),
]... |
# area of circle = pi(3.14159265359) * radius**2(π نق * نق)
from math import pi
print(f"area of circle is {pi * float(input('Enter radius: '))**2}")
# in the above way we solved the problem with just one line after import library
# you can solve it in many way.
# good luck
|
import bpy
from bpy.props import *
from bpy.types import Node, NodeSocket
from arm.logicnode.arm_nodes import *
class SeparateColorNode(Node, ArmLogicTreeNode):
'''Separate color node'''
bl_idname = 'LNSeparateColorNode'
bl_label = 'Separate RGB'
bl_icon = 'CURVE_PATH'
def init(self, context):... |
#!/usr/bin/env python
# encoding: utf8
#
# Copyright © Burak Arslan <burak at arskom dot com dot tr>,
# Arskom Ltd. http://www.arskom.com.tr
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are ... |
"""Config flow for Subaru integration."""
from __future__ import annotations
from datetime import datetime
import logging
from subarulink import (
Controller as SubaruAPI,
InvalidCredentials,
InvalidPIN,
SubaruException,
)
from subarulink.const import COUNTRY_CAN, COUNTRY_USA
import voluptuous as vol
... |
#!/usr/bin/env python
import base64
import os
import subprocess
from flask import Flask
from flask import request
import json
import requests
import logging
import sys
logging.basicConfig(stream=sys.stderr, level=logging.DEBUG)
app = Flask(__name__)
opa_url = os.environ.get("OPA_ADDR", "http://localhost:8181")
pol... |
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Apple Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-3-clause license that can be
# found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
from __future__ import print_function as _
from __future__ import division a... |
import unittest
from asterisk import ami
from tests.settings import connection, login
def debug(*args, **kwargs):
print(map(str, args), map(lambda t: map(str, t), kwargs.items()))
class AutoReconnectTest(unittest.TestCase):
client = None
auto_reconnect = None
response = None
def setUp(self):
... |
from django.contrib.auth.decorators import user_passes_test
from django.core.files.storage import FileSystemStorage
from django.shortcuts import render, redirect
from django.contrib import messages
from cole.forms import *
import time
import sys
import os
@user_passes_test(lambda u: u.is_staff)
def upload_template(r... |
import datetime
import pandas as pd
import os
# http://api.bitcoincharts.com/v1/csv/
def file_processor(data_file):
if os.access('data/bitcoin_coinbase_M5.csv', os.R_OK):
print('Reading bitcoin market data file from: data/bitcoin_coinbase_M5.csv')
p = pd.read_csv('data/bitcoin_coinbase_M5.csv', se... |
# Copyright 2020 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to ... |
import json
import sys
import unittest
from functools import reduce
from http import HTTPStatus
from unittest.mock import patch
import cloudfoundry_client.main.main as main
from abstract_test_case import AbstractTestCase
from fake_requests import mock_response
class TestServiceKeys(unittest.TestCase, AbstractTestCas... |
import pytest
import json
import os.path
import importlib
import jsonpickle
from fixture.application import Application
from fixture.db import DbFixture
from fixture.orm import ORMFixture
fixture = None
target = None
def load_config(file):
global target
if target is None:
config_file = os.path.join(... |
#
#
# Copyright (C) University of Melbourne 2012
#
#
#
#Permission is hereby granted, free of charge, to any person obtaining a copy
#of this software and associated documentation files (the "Software"), to deal
#in the Software without restriction, including without limitation the rights
#to use, copy, modify... |
#!/usr/bin/python
# Copyright 2013 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 ... |
import redis3 as redis
import configparser
from os import environ
from colorama import Fore
class FemtoDB:
def __init__(self, host='localhost', port=6379):
self.host = host
self.port = port
self.secret_key = None
self.connect()
def connect(self):
"""
Config... |
# 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 ... |
from exptools.launching.affinity import encode_affinity
from exptools.launching.exp_launcher import run_experiments
from exptools.launching.variant import make_variants, VariantLevel
affinity_code = encode_affinity(
n_cpu_core=16,
n_gpu=4,
hyperthread_offset=20,
n_socket=2
# cpu_per_run=2,
)
runs_... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from ... import _utilities, _tables
from... |
# coding:utf-8
from scrapy.item import Item
from scrapy import Field # 只能通过x['aa']或者x.get('aa')访问, x.aa无法访问, 除非重写__getattribute__()
from pprint import pformat
from collections import MutableMapping
import six
from scrapy.utils.trackref import object_ref
__all__ = [
'DictItem', # 可被a.b访问属性的DictI... |
import numpy as np
import tensorflow as tf
from .module import Module
class RBFExpansion(Module):
def __init__(self, low, high, gap, dim=1, name=None):
self.low = low
self.high = high
self.gap = gap
self.dim = dim
xrange = high - low
self.centers = np.linspace(low... |
#!/usr/bin/env python3
#
# Copyright 2017, Data61
# Commonwealth Scientific and Industrial Research Organisation (CSIRO)
# ABN 41 687 119 230.
#
# This software may be distributed and modified according to the terms of
# the BSD 2-Clause license. Note that NO WARRANTY is provided.
# See "LICENSE_BSD2.txt" for details.
... |
# Copyright 2010 Jacob Kaplan-Moss
# Copyright 2011 OpenStack Foundation
# Copyright 2012 Grid Dynamics
# Copyright 2013 OpenStack Foundation
# 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... |
# Copyright 2021 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
import os.path
from csv import DictReader
from django.contrib.gis.geos import Point
from django.core.management.base import BaseCommand
from obj_update import obj_update_or_create
from tqdm import tqdm
from mixed_beverages.apps.receipts.models import Location
def get_coordinate_quality(accuracy: str) -> str:
# ... |
# Register multiple images to the same reference image
#
# Copyright (C) 2018 Yves Pauchard
# License: BSD 3-clause (see LICENSE)
import SimpleITK as sitk
import os
import logging
import configparser
import argparse
import csv
#TODO: clean up how we know what are expected ini sections and options.
# Now it is defined... |
import os
import platform
import re
import subprocess
import sys
import pytest
def normalize(exception):
"""Normalize exception output for reproducible test cases"""
if os.name:
exception = re.sub(
r'File[^"]+"[^"]+\.py[^"]*"', lambda m: m.group().replace("\\", "/"), exception
)
... |
# -*- coding: utf-8 -*-
# Resource object code
#
# Created by: The Resource Compiler for PyQt5 (Qt v5.11.2)
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore
qt_resource_data = b"\
\x00\x00\x06\x7b\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
\x00\x00\x18\x... |
# Copyright (c) 2016-2017, Neil Booth
#
# All rights reserved.
#
# See the file "LICENCE" for information about the copyright
# and warranty status of this software.
'''Class for handling asynchronous connections to a blockchain
daemon.'''
import asyncio
import itertools
import json
import time
from calendar import t... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os, sys, tarfile
from six.moves import urllib
from tensorflow.python.eager import context
from tensorflow.python.framework import ops
from tensorflow.python.ops import data_flow_ops
from tensorf... |
# Generated by Django 2.0.2 on 2018-08-31 12:07
import datetime
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Course',
f... |
# Electrum - Lightweight Bitcoin Client
# Copyright (c) 2011-2016 Thomas Voegtlin
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including without limitation the rig... |
"""
Copyright 2020 The Magma Authors.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES O... |
import frappe
import datetime
def calcular_edades():
pacientes = frappe.get_list("Paciente")
for p in pacientes:
paciente = frappe.get_doc("Paciente",p.name)
paciente.edad = (datetime.date.today() - p.fecha_de_nacimiento).days/365
paciente.db_update() |
import argparse
import os
from functools import partial
import cv2
import numpy as np
import pandas as pd
from multiprocessing import Pool
from tqdm import tqdm
from reid.insightface.model import ArcFaceModel
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument('--mtcnn_path', type=str)
... |
from typing import Any
class PychartIndexable:
@staticmethod
def from_expr(expr: Any):
if isinstance(expr, PychartIndexable):
return expr
raise RuntimeError("Not indexable")
def get(self, index: Any) -> Any:
raise RuntimeError("Cannot index base indexable")
def se... |
import paramiko
from select import select
import re
_JUNOS_PROMPT = '> '
_SHELL_PROMPT = '% '
_SELECT_WAIT = 0.1
_RECVSZ = 1024
class StartShell(object):
"""
Junos shell execution utility. This utility is written to
support the "context manager" design pattern. For example::
def _ssh_exec(sel... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.