text stringlengths 2 999k |
|---|
import sys
import re
def print_table(table):
#
# Show Board
#
print('-------')
for i in range(3):
line = " "
for j in range(3):
line = line + str(table[i][j]) + " "
print(line)
print('-------')
def input_command(table, turn):
#
... |
from os.path import join
from pathlib import Path
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
SECRET_KEY = 'yiamnr83kv$okon9j)d58t)(wr&_hb4f(yr#reec4$ae6s_t62'
DEBUG = True
ALLOWED_HOSTS = []
INSTALLED_APPS = [
'django.contrib.admin',
'... |
from concurrent import futures
from fixtures import * # noqa: F401,F403
from time import time
from tqdm import tqdm
import pytest
import random
num_workers = 480
num_payments = 10000
@pytest.fixture
def executor():
ex = futures.ThreadPoolExecutor(max_workers=num_workers)
yield ex
ex.shutdown(wait=Fal... |
import logging
from typing import Tuple, List, Optional
from blspy import G1Element
from clvm.casts import int_from_bytes, int_to_bytes
from cryptodoge.clvm.singleton import SINGLETON_LAUNCHER
from cryptodoge.consensus.block_rewards import calculate_pool_reward
from cryptodoge.consensus.coinbase import pool_parent_id
... |
def _genrule_repository(ctx):
ctx.download_and_extract(
ctx.attr.urls,
"", # output
ctx.attr.sha256,
"", # type
ctx.attr.strip_prefix,
)
for ii, patch in enumerate(ctx.attr.patches):
patch_input = "patch-input-%d.patch" % (ii,)
ctx.symlink(patch, pat... |
import os
import csv
samples = []
with open('data/driving_log.csv') as csvfile:
reader = csv.reader(csvfile)
for line in reader:
samples.append(line)
samples.pop(0) #Removing row names of csv file
from sklearn.model_selection import train_test_split
train_samples, validation_samples = train_test_split(... |
from hazelcast.core import DistributedObjectEvent
from hazelcast.protocol.codec import client_create_proxy_codec, client_destroy_proxy_codec, \
client_add_distributed_object_listener_codec, client_remove_distributed_object_listener_codec
from hazelcast.proxy.atomic_long import AtomicLong
from hazelcast.proxy.atomic... |
from __future__ import unicode_literals
from django import forms
from django.core.exceptions import MultipleObjectsReturned
from django.core.validators import MaxValueValidator, MinValueValidator
from django.db.models import Count
from taggit.forms import TagField
from dcim.models import Site, Rack, Device, I... |
#!/usr/bin/python
import websocket
import json
try:
import thread
except ImportError:
import _thread as thread
import time
def empty(dictionry, key):
if key in dictionry:
if dictionry[key]:
return False
return True
def on_message(ws, message):
original = json.loads(message)... |
# -*- coding:utf-8 -*-
# =========================================================================== #
# Project : Data Mining #
# File : \mymain.py #
# Python : 3.9.1 ... |
from src.core.Stock import Stock
|
# -*- coding: utf-8 -*-
import pandas as pd
from zvdata.utils.pd_utils import normal_index_df
from zvt.api.computing import macd
from zvt.factors.factor import Scorer, Transformer
class MaTransformer(Transformer):
def __init__(self, windows=[5, 10]) -> None:
self.windows = windows
def transform(sel... |
# Generated by Django 3.1.5 on 2021-01-12 15:39
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import uuid
class Migration(migrations.Migration):
dependencies = [
('dg', '0001_initial'),
]
operations = [
migrations.CreateModel(... |
#!/usr/bin/env python
"""This is a script that analyzes the agreement between two
annotations of the same file. The script measures:
* Object counts: are they the same?
* Object assignment: given the least-squares mapping of objects
onto each other, to what extent do they differ?
"""
from __future__ import print_f... |
"""
Adapted from: https://github.com/debbiemarkslab/DeepSequence/blob/master/DeepSequence/model.py
VAE Reference: https://github.com/AntixK/PyTorch-VAE/blob/master/models/vanilla_vae.py
"""
import torch
import torch.nn as nn
from torch import Tensor
from torch.nn import functional as F
import numpy as np
from scipy.spe... |
import insightconnect_plugin_runtime
from .schema import GetFileInfoInput, GetFileInfoOutput, Input, Output, Component
# Custom imports below
import filetype
import base64
class GetFileInfo(insightconnect_plugin_runtime.Action):
def __init__(self):
super(self.__class__, self).__init__(
name="... |
#! /usr/bin/python3
import sys
import os
import time
from typing import Tuple
BASE_SUBJECT_NUMBER = 7
DIVIDER = 20201227
def get_next_value(value: int, subject_number: int = BASE_SUBJECT_NUMBER) -> int:
return (value * subject_number) % DIVIDER
def get_loop_size(target: int) -> int:
value = 1
cycle =... |
# Copyright 2014 Intel Corporation, All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... |
# Copyright 2020 Red Hat, Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
import pandas as pd
def process_features(features_df, target_df):
"""Join features with labels
"""
features_df = features_df.loc[features_df.user_id.isin(target_df.user_id)]
features_df['month'] = pd.to_datetime(features_df['month'])
return features_df
def process_data(df):
"""Convert 'mon... |
# ex:ts=4:sw=4:sts=4:et
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
import logging
import sys
log = logging.getLogger("svtplay_dl")
progress_stream = sys.stderr
|
#!/usr/bin/env python3
# Copyright (c) 2016-2019 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test compact blocks (BIP 152).
Version 1 compact blocks are pre-segwit (txids)
Version 2 compact block... |
import pytest
from tests import FILE_TESTCASE, create_response, create_soup
from fb_group.spiders.page import PageSpider
class PageParse:
spider = PageSpider(group_id="0")
def test_parse_stories(self, test_args):
response = create_response(test_args["html"])
stories = self.spider.parse_stori... |
"""empty message
Revision ID: 2be1c43393d0
Revises: a2881c3b07f3
Create Date: 2020-04-27 23:50:35.426100
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '2be1c43393d0'
down_revision = 'a2881c3b07f3'
branch_labels = None
depends_on = None
def upgrade():
# ... |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "awardpro.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the... |
from django.shortcuts import render
from django.http import JsonResponse
from django.views import generic
from django.views.generic import View
from .models import Entry, Person
def index(request):
"""View function for home page of site."""
# Render the HTML template index.html with the data in the context va... |
# Copyright 2016 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
import logging
import time
import gae_event_mon
from server import task_result
DIMENSIONS = (
('cores', int),
('cpu', unicode),
('... |
def set_size(width, fraction=1, subplots=(1, 1)):
"""Set figure dimensions to avoid scaling in LaTeX.
Parameters
----------
width: float or string
Document width in points, or string of predined document type
fraction: float, optional
Fraction of the width which you wish the... |
"""Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "e83168170a0d0bdf856a109187936bc44853c1b8"
TFRT_SHA256 = "4656da7df17e58470774f60afeb0... |
# -*- coding: utf-8 -*-
from rest_framework.response import Response
from rest_framework.viewsets import ModelViewSet
from rest_framework_extensions.mixins import NestedViewSetMixin
from rest_framework_extensions.decorators import action, link
from .models import (
DefaultRouterUserModel,
DefaultRouterGroupMo... |
import datetime
from telethon import events
from telethon.errors.rpcerrorlist import YouBlockedUserError
from telethon.tl.functions.account import UpdateNotifySettingsRequest
from uniborg.util import admin_cmd
@borg.on(admin_cmd(pattern="heroku ?(.*)"))
async def _(event):
if event.fwd_from:
return
i... |
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import colors
import warnings
"""
@desc: Plot spike train of neurons in reservoir
"""
def reservoirSpikeTrain(self, fr=0, to=None, figsize=None, colorEx=None, colorIn=None):
# Set 'to' to total times steps if not defined
if to is None: to = sel... |
import functools
import logging
import os
from kivy.app import App
from kivy.properties import StringProperty, ObjectProperty, NumericProperty, BooleanProperty, Clock
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.recycleview import RecycleDataAdapter, RecycleView
from kivymd.uix.button import MDIconButton
fro... |
from __future__ import annotations
from prettyqt.qt import QtCore
class AbstractNativeEventFilter(QtCore.QAbstractNativeEventFilter):
pass
|
import copy
from typing import TYPE_CHECKING
from PyQt5.QtWidgets import (QDialog, QLineEdit, QTextEdit, QVBoxLayout, QLabel,
QWidget, QHBoxLayout, QComboBox)
from btchip.btchip import BTChipException
from electrum.gui.qt.util import PasswordLineEdit
from electrum.i18n import _
from ele... |
# Copyright 2013 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.
import os
import subprocess
from telemetry.core import util
from telemetry.core.backends.chrome import android_browser_finder
from telemetry.core.platform i... |
# Copyright 2021 AI Redefined Inc. <dev+cogment@ai-r.com>
#
# 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 l... |
# To add a new artifact module, import it here as shown below:
# from scripts.artifacts.fruitninja import get_fruitninja
# Also add the grep search for that module using the same name
# to the 'tosearch' data structure.
import traceback
from scripts.artifacts.accounts_ce import get_accounts_ce
from scripts.artifa... |
from openbiolink.edgeType import EdgeType
from openbiolink.graph_creation.metadata_infile.infileMetadata import InfileMetadata
from openbiolink.graph_creation.types.infileType import InfileType
from openbiolink.nodeType import NodeType
class InMetaOntoHpoIsA(InfileMetadata):
CSV_NAME = "DB_ONTO_HPO__IS_Aontology... |
"""MyPictorial URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-b... |
from django.conf import settings
from django.conf.urls.static import static
from django.contrib.staticfiles.views import serve
urlpatterns = []
def staticfiles_urlpatterns(prefix=None):
"""
Helper function to return a URL pattern for serving static files.
"""
if prefix is None:
pr... |
from TestUtils.models import BaseTestCase
from Places.models import Place, Accept, Rating, PlaceImage
class LocalBaseTestCase(BaseTestCase):
"""
Базовый класс для тестов в этом файле
"""
def setUp(self):
super().setUp()
self.place = Place.objects.create(name='Test', latitude=56, longit... |
"""
import the graph functions into the graph namespace
"""
from .laplacian import *
|
#!/Users/Drake/dev/bluecollarbi/bluecollarbi/bin/python3
#
# The Python Imaging Library
# $Id$
#
# this demo script creates four windows containing an image and a slider.
# drag the slider to modify the image.
#
import sys
if sys.version_info[0] > 2:
import tkinter
else:
import Tkinter as tkinter
from PIL im... |
import numpy
import theano
import theano.tensor as T
from theano.tensor.nnet import conv
from theano.tensor.signal import downsample
class LeNetConvPoolLayer(object):
"""Pool Layer of a convolutional network """
def __init__(self, rng, input, filter_shape, image_shape, poolsize=(2, 2)):
"""
A... |
import h5py as h5
import numpy as np
import configparser
import os
import sharpy.utils.algebra as algebra
import sharpy.utils.generate_cases as gc
case_name = 'hinged_controlled_wing'
route = os.path.dirname(os.path.realpath(__file__)) + '/'
# m = 16 gives flutter with 165
m_main = 4
amplitude = 5*np.pi/180
period =... |
# Copyright 2015 IBM Corp.
#
# 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, sof... |
def merge_sort(collection):
"""Pure implementation of the merge sort algorithm in Python
:param collection: some mutable ordered collection with heterogeneous
comparable items inside
:return: the same collection ordered by ascending
Examples:
>>> merge_sort([0, 5, 3, 2, 2])
[0, 2, 2, ... |
import datetime
import typing
FORMAT_STRING = "%Y-%m-%dT%H%M%S.%fZ"
def get_datetime_now(as_string: bool = False) -> typing.Union[datetime.datetime, str]:
now = datetime.datetime.utcnow()
return to_string(now) if as_string else now
def to_string(date: datetime.datetime) -> str:
return date.strftime(FOR... |
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2018-2019 Fetch.AI Limited
#
# 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 ... |
from django import forms
from django.forms import Form
from members.models import PhoneCodeMapper
class AuthenticateForm(Form):
code = forms.CharField(max_length=5)
phone = forms.CharField(max_length=11)
def clean(self):
data = self.cleaned_data
phone = data.get('phone', '')
code... |
import rlkit.misc.hyperparameter as hyp
from rlkit.demos.source.dict_to_mdp_path_loader import EncoderDictToMDPPathLoader
from rlkit.launchers.experiments.ashvin.awac_rig import awac_rig_experiment
from rlkit.launchers.launcher_util import run_experiment
from rlkit.launchers.arglauncher import run_variants
from rlkit.t... |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... |
# Copyright (c) 2010 Philip Taylor
# Released under the BSD license and W3C Test Suite License: see LICENSE.txt
# Current code status:
#
# This was originally written for use at
# http://philip.html5.org/tests/canvas/suite/tests/
#
# It has been adapted for use with the Web Platform Test Suite suite at
# https://githu... |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2020 CERN.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Test Jinja template loading."""
import shutil
import tempfile
from os import environ
f... |
from typing import Tuple
import pandas as pd
import torch
from genrl.utils.data_bandits.base import DataBasedBandit
from genrl.utils.data_bandits.utils import download_data, fetch_data_with_header
URL = "https://archive.ics.uci.edu/ml/machine-learning-databases/census1990-mld/USCensus1990.data.txt"
class CensusDat... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 5/15/20 4:49 PM
# @File : grover.py
# qubit number=4
# total number=12
import cirq
import cirq.google as cg
from typing import Optional
import sys
from math import log2
import numpy as np
#thatsNoCode
from cirq.contrib.svg import SVGCircuit
# Symbols for... |
import json
import aiohttp
from aiohttp.client_exceptions import ClientConnectionError
from aiohttp.web_exceptions import HTTPError
from src.util.coins import Currency
from src.util.oracle.price_source_base import PriceSourceBase
class BinancePriceOracle(PriceSourceBase):
API_URL = "https://api.binance.com/api... |
from __future__ import absolute_import
from ..exceptions import CcinoBail, TestDidNotRaise, TestDidNotReturn, \
UnknownSignature
from .runnable import Runnable
from ..util import get_num_args
class Test(Runnable):
"""Runnable class representing a single unit."""
def run(self, reporter, options):
... |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
"""message_insights_worker - Augur Worker that analyzes PR and issue messages"""
__version__ = '0.0.0'
__author__ = 'Augur Team <s@goggins.com>'
__all__ = [] |
# coding: utf-8
"""
Velo Payments APIs
## Terms and Definitions Throughout this document and the Velo platform the following terms are used: * **Payor.** An entity (typically a corporation) which wishes to pay funds to one or more payees via a payout. * **Payee.** The recipient of funds paid out by a payor.... |
# The Fibonacci sequence is defined by the recurrence relation:
# F_n = F_{n-1} + F_{n-2}, where F_1 = 1 and F_2 = 1.
# Hence the first 12 terms will be:
# F_1 = 1
# F_2 = 1
# F_3 = 2
# F_4 = 3
# F_5 = 5
# F_6 = 8
# F_7 = 13
# F_8 = 21
# F_9 = 34
# F_10 = 55
# F_11 = 89
# F_12 = 144
# The 12th term, F_12, is the firs... |
import boto
|
def distance(n, point1, point2):
point1_x, point1_y = point1
point2_x, point2_y = point2
if abs(point1_x) >= n or abs(point1_y) >= n or abs(point2_x) >= n or abs(point2_y) >= n:
raise ValueError("coords are not from given range")
dist_x = min(abs(point1_x - point2_x), point1_x + (n - point2_x)... |
import matplotlib.pyplot as plt
import random
def func(x):
val = 4*x**3
return val
s = 0
for i in range(ini, end):
x = random.random()
y = random.random()
if y <= func(x):
s += 1
plt.plot(x, y)
print ("val =", s/10**5)
plt.show()
|
#retriever
"""Retriever script for direct download of PRISM climate data"""
from future import standard_library
standard_library.install_aliases()
from builtins import range
from retriever import VERSION
from retriever.lib.templates import Script
import urllib.request, urllib.parse, urllib.error
from pkg_resources imp... |
from __future__ import absolute_import
from .typeddict import Dict
|
# Copyright 1999-2020 Alibaba Group Holding 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 a... |
#!/usr/bin/python
# Format the output from various oiio command line "$tool --help" invocations,
# and munge such that txt2man generates a simple man page with not-too-horrible
# formatting.
from __future__ import print_function
from __future__ import absolute_import
import sys
lines = [l.rstrip().replace('\t', ' '*... |
#!/usr/bin/env python2
# coding=utf-8
# ^^^^^^^^^^^^ TODO remove when supporting only Python3
# Copyright (c) 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.
"""Test Hierarchical Deterministic walle... |
# 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.
# -----------------------------------------------------... |
from __future__ import division
import libtbx.load_env
from libtbx.test_utils import approx_equal
from libtbx.utils import null_out
import os
def exercise () :
hkl_file = libtbx.env.find_in_repositories(
relative_path="phenix_regression/reflection_files/1yjp.mtz",
test=os.path.isfile)
if (hkl_file is None... |
"""
Train script for qmix learning.
The number of samples used for an epoch is:
horizon * num_workers = num_steps * num_processes where num_steps is the number
of steps in a rollout (horizon) and num_processes is the number of parallel
processes/workers collecting data.
Example:
python train_qmix.py --num-processes ... |
__version__ = "0.2.4"
__version__ = "0.2.2"
import logging
from . import converters, exceptions, model, options, validators, values
from .compat import TypeRegistry, get_type
from .config import config
from .converters import converter
from .dispatch import type_dispatch
from .model import Model, field
from .validato... |
# Copyright 2017 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... |
from flask_restful import reqparse
class IntegratoonTestDelete(object):
req_parser = reqparse.RequestParser()
req_parser.add_argument('email', type=str, required=True) |
from typing import Callable
from hypothesis import given # type: ignore
from hypothesis import strategies as st
from expression import compose, identity
Func = Callable[[int], int]
@given(st.integers()) # type: ignore
def test_compose_identity_implicit(x: int):
fn = compose()
assert fn(x) == x
@given(... |
from time import sleep
from .password import lookup_pwned
class PasswordCache(dict):
"""
If the password hash has not been requested before, requests it.
If you have the same password for many entries, this would only request that once.
"""
def __missing__(self, key: str) -> int:
"""
... |
from pyqubo import Array, UnaryEncInteger, LogEncInteger, Constraint, Placeholder
import neal
a = LogEncInteger("a", (0, 5))
b = LogEncInteger("b", (0, 6))
c = LogEncInteger("c", (0, 4))
H = -a*b*c
print(H)
print(dir(H))
model = H.compile()
bqm = model.to_bqm()
sa = neal.SimulatedAnnealingSampler()
sampleset = sa.s... |
# Copyright 2017 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... |
# 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 ... |
from setuptools import setup, find_packages
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the README file
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='problem',
version='1... |
import time
import copy
import numpy as np
import pandas as pd
import jacinle.random as random
from jacinle.utils.meta import notnone_property
from jaclearn.rl.env import SimpleRLEnvBase
from .grid import get_random_grid_generator
from .grid import get_solved_grid
__all__ = ['Grid', 'randomly_generate_grid_from_data'... |
from __future__ import annotations
from datetime import (
datetime,
time,
)
import numpy as np
from pandas._libs.lib import is_list_like
from pandas.core.dtypes.generic import (
ABCIndex,
ABCSeries,
)
from pandas.core.dtypes.missing import notna
def to_time(arg, format=None, infer_time_format=Fals... |
# Licensed under the Apache License, Version 2.0 (the “License”); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under th... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from setuptools import setup, find_packages
def _read(filename):
with open(filename) as f:
return f.read()
# Load package version.
exec(_read('jubakit/_version.py'))
def get_extras_requires():
extras_requires = {
'test': ['numpy', 'scipy',
... |
# -*- coding: utf-8 -*-
"""
jishaku.features.shell
~~~~~~~~~~~~~~~~~~~~~~~~
The jishaku shell commands.
:copyright: (c) 2021 Devon (Gorialis) R
:license: MIT, see LICENSE for more details.
"""
from disnake.ext import commands
from jishaku.codeblocks import Codeblock, codeblock_converter
from jishaku.exception_han... |
#coding=utf-8
import serial
ser = serial.Serial("/dev/rfcomm0", 9600)
ser.write("Successfully connected(input)!".encode())
while True:
count = ser.inWaiting()
if count!=0:
recv = ser.read(count)
print recv.split(' ' , -1)
|
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... |
"""
Project Euler Problem 203: https://projecteuler.net/problem=203
The binomial coefficients (n k) can be arranged in triangular form, Pascal's
triangle, like this:
1
1 1
1 2 1
1 3 3 1
1 4 6 4 ... |
"""
sentry.web.frontend
~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2013 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
|
import torch
import numpy as np
import albumentations as alb
from src.bicanet import BiCADenseNet
class Segmentator:
PORTRAIT_MEAN, PORTRAIT_STD = (0.5107, 0.4506, 0.4192), (0.3020, 0.2839, 0.2802)
_image_transform = alb.Compose([
alb.Normalize(mean=PORTRAIT_MEAN, std=PORTRAIT_STD, always_apply=Tr... |
from tm.settings.staging import * # NOQA (ignore all errors on this line)
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'travis_ci_test',
'USER': 'postgres',
'PASSWORD': '',
'HOST': 'localhost',
'PORT': '',
}
}
|
# Copyright 2019 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
"""
Copyright (c) 2019, Arm Limited and 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 License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Un... |
from torch.utils.data import Dataset
import os
import torch
import json
from PIL import Image
from lxml import etree
class VOC2012DataSet(Dataset):
"""读取解析PASCAL VOC2012数据集"""
def __init__(self, voc_root, transforms, year='VOC2012', train_set='train.txt'):
self.root = os.path.join(voc_root, "VOCdevki... |
__licence__ = 'MIT'
__author__ = 'kuyaki'
__credits__ = ['kuyaki']
__maintainer__ = 'kuyaki'
__date__ = '2021/04/22'
from unittest import TestCase
class PDGTestCase(TestCase):
def test_convert_pdg_to_cdg(self) -> None:
pass
def test_convert_pdg_to_cfg(self) -> None:
pass
def test_conve... |
import numpy as np
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql as psql
from sqlalchemy.orm import relationship
from sqlalchemy.ext.hybrid import hybrid_property
from sqlalchemy.schema import UniqueConstraint
from .core import Base
from .constants import APER_KEY, APERTURE_RADIUS
__all__ = ['Fo... |
# Generated by Django 2.1.1 on 2018-10-20 00:13
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('IoT_MaintOps', '0065_auto_20181019_2348'),
]
operations = [
migrations.RenameField(
model_name=... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.