text stringlengths 2 999k |
|---|
# Copyright (c) 2019 UAVCAN Consortium
# This software is distributed under the terms of the MIT License.
# Author: Pavel Kirienko <pavel@uavcan.org>
from __future__ import annotations
import abc
import typing
import warnings
import dataclasses
import pyuavcan.util
from ._transfer import Transfer, TransferFrom
from ._... |
import logging
from .observer import Observer
from .publisher import ScenarioTimeIntervalPublisher
from .schemas import ModeStatus, TimeStatus
from .simulator import Mode, Simulator
logger = logging.getLogger(__name__)
class ConnectionConfig(object):
"""Connection configuration.
The configuration settings ... |
import bitmex, json, sys
from datetime import datetime
from time import sleep
import pandas as pd
import decimal # this module is used to round up the tickSize
from market_maker.utils import log, errors, constants
# import mombot.settings as settings
from market_maker.settings import settings
from market_maker.utils.ma... |
import os
import os.path as osp
import tempfile
import numpy as np
import pytest
import torch
from mmhuman3d.models import HybrIK_trainer, HybrIKHead
from mmhuman3d.models.builder import build_body_model
from mmhuman3d.models.utils.inverse_kinematics import (
batch_get_3children_orient_svd,
batch_get_pelvis_o... |
# This file is part of the standard library of Pycopy project, minimalist
# and lightweight Python implementation.
#
# https://github.com/pfalcon/pycopy
# https://github.com/pfalcon/pycopy-lib
#
# The MIT License (MIT)
#
# Copyright (c) 2014-2020 Paul Sokolovsky
#
# Permission is hereby granted, free of charge, to any ... |
import machine
import time
from machine import Timer, Pin, PWM
from micropython import const
import gc
import wlan_wrapper
import uart_wrapper
from _thread import allocate_lock, start_new_thread
import json
DEVICE_FREQ = const(240 * 1000000)
BOOT_TIME = const(3)
HEARTBEAT_PERIOD = const(5) # s
DEFAULT_MOTION_DURATION... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__version__ = '0.0.2'
from jsonform import JsonForm
|
#!/usr/bin/env python3
# Copyright (c) 2014-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.
"""Base class for RPC testing."""
import argparse
import configparser
from enum import Enum
import loggin... |
from geography_api import __version__
def test_version():
assert __version__ == '0.1.0'
|
import subprocess
import ast
from decimal import *
def txallinfo(txids):
# Variables
outputs_value = []
sumoutputs = 0
input_txids = []
input_vouts = []
input_value = []
outputadresses = []
suminput = 0
getcontext().prec = 7
txinfo = subprocess.getoutput("bitcoin-cli getrawtra... |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
"""
A module to perform diffusion analyses (e.g. calculating diffusivity from
mean square displacements etc.). If you use this module, please consider
citing the following papers::
Ong, S. P., Mo, Y., Rich... |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) 2009- Spyder Kernels Contributors
#
# Licensed under the terms of the MIT License
# (see spyder_kernels/__init__.py for details)
# ---------------------------------------------------------------------... |
from __future__ import absolute_import
from collections import Iterable, OrderedDict, Sequence
import difflib
import itertools
import re
import warnings
import numpy as np
from six import string_types
from ..models import (
BoxSelectTool, BoxZoomTool, CategoricalAxis,
TapTool, CrosshairTool, DataRange1d, Dat... |
"""Generate mypy config."""
from __future__ import annotations
import configparser
import io
import os
from pathlib import Path
from typing import Final
from .model import Config, Integration
# Modules which have type hints which known to be broken.
# If you are an author of component listed here, please fix these e... |
from django.contrib import admin
from django.contrib import admin
from .models import TranslationKey, Translation
from .forms import AtLeastOneRequiredInlineFormSet
# Register your models here.
class TranslationInline(admin.TabularInline):
model = Translation
formset = AtLeastOneRequiredInlineFormSet
class ... |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/unittest_mset_wire_format.proto
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf i... |
from django.test import TestCase
from django.contrib.auth import get_user_model
from core import models
def sample_user(email='test@londonappdev.com', password='testpass'):
"""Create a sample user"""
return get_user_model().objects.create_user(email, password)
class ModelTests(TestCase):
def test_crea... |
from elasticsearch import Elasticsearch
from elasticsearch_dsl import Q, Search
import pandas as pd
es = Elasticsearch([{'host': '10.10.10.10', 'port': 9200}])
delete_docs = False
query = Q('range', update_time={'gte': "2021-06-01T01:31:00"}) | Q('range', title={'lte': 10})
s = Search(using=es, index='s2').query(que... |
#!/usr/bin/env python3
##########################################################################
#
# Copyright 2014 VMware, Inc
# All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in th... |
"""
path.py
-----------
A module designed to work with vector paths such as
those stored in a DXF or SVG file.
"""
import numpy as np
import copy
import collections
from ..points import plane_fit
from ..geometry import plane_transform
from ..visual import to_rgba
from ..constants import log
from ..constants import t... |
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-unsafe
"""
CUSUM stands for cumulative sum, it is a changepoint detection algorithm.
In the Kats implementation, it has two main compon... |
''' A script to scrape a list of 744 confirmed Halal restaurants in
NYC area from Zabiha.com
As well as, requesting 338 halal tagged restaurants in NYC from Zomato.com
'''
import review_scraper
import pandas as pd
import os, requests, json
from dotenv import load_dotenv
def _zabiha_to_csv(url_dict):
webdriv... |
# coding: utf-8
#
# Copyright 2022 :Barry-Thomas-Paul: Moss
#
# 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 applicab... |
from datetime import datetime
from time import sleep
from rpiHAT import AltIMU
def callimu():
imu = AltIMU()
imu.enable()
imu.calibrateGyroAngles()
start = datetime.now()
imu.initComplementaryFromAccel=True
imu.initKalmanFromAccel = True
while True:
stop = datetime.now() - start
... |
"""
Provide classes to perform the groupby aggregate operations.
These are not exposed to the user and provide implementations of the grouping
operations, primarily in cython. These classes (BaseGrouper and BinGrouper)
are contained *in* the SeriesGroupBy and DataFrameGroupBy objects.
"""
import collections
from typi... |
from airflow.hooks.postgres_hook import PostgresHook
# select session, count(*) from timeout_err_20200726 where error = 'null' group by session
# select error, count(*) from timeout_err_20200726 group by error
def push_message(instance, message):
print(f'Push message: error_count={message}')
instance.xcom_pus... |
# Author: Martin McBride
# Created: 2022-01-22
# Copyright (C) 2022, Martin McBride
# License: MIT
from generativepy.color import Color
from generativepy.drawing import make_image, setup
import math
from generativepy.geometry import Polygon, Transform
def create_spiro(a, b, d):
dt = 0.01
t = 0
pts = []
... |
from wsgiref import simple_server
from ui import setup_ui
# do not use this in production
# this is a dev only method provided for convenience
def main():
simple_server.make_server('0.0.0.0', 6060, setup_ui(backend_url="http://localhost:6080/")).serve_forever() # nosec
if __name__ == "__main__":
try:
... |
import unittest, sys
from lxml.tests.common_imports import make_doctest
from lxml.etree import LIBXML_VERSION
import lxml.html
from lxml.html.clean import Cleaner
class CleanerTest(unittest.TestCase):
def test_allow_tags(self):
html = """
<html>
<head>
</head>
... |
from django.db import models
# Create your models here.
from django.conf import settings
from blogapp.models import BaseModel,Article
class Comment(BaseModel):
message = models.TextField('评论', max_length=400)
author = models.ForeignKey(
settings.AUTH_USER_MODEL,
verbose_name='作者',
on_d... |
from flask import Blueprint, redirect, request
from sqlalchemy.sql.expression import func
from ..decorators import templated
from .models import User
members = Blueprint("members", __name__)
@members.route("/members")
@templated()
def index():
return {"members": User.active_members().order_by(func.random())}
... |
"""
Functions for surface manipulation.
"""
import os
import warnings
import collections
import gzip
from distutils.version import LooseVersion
from collections import namedtuple
import numpy as np
from scipy import sparse, interpolate
import sklearn.preprocessing
import sklearn.cluster
try:
from sklearn.exceptio... |
from .runner import main
main()
|
# Generated by Django 2.1.4 on 2018-12-21 12:37
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
ope... |
#!/usr/bin/env python3
"""Run PEtab test suite (https://github.com/PEtab-dev/petab_test_suite)"""
import logging
import os
import sys
import amici
import petab
import petabtests
import pytest
from _pytest.outcomes import Skipped
from amici.gradient_check import check_derivatives as amici_check_derivatives
from amici... |
from pbrl.algorithms.ppo.policy import Policy
from pbrl.algorithms.ppo.ppo import PPO
from pbrl.algorithms.ppo.runner import Runner
|
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) 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 co... |
"""add stages_authors
Revision ID: cdd8c82b1f69
Revises: d27963ee5cc1
Create Date: 2021-07-03 18:41:41.131811
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'cdd8c82b1f69'
down_revision = 'd27963ee5cc1'
branch_labels = None
depends_on = None
def upgrade():
... |
from __future__ import print_function
import matplotlib.pyplot as plt
import argparse
import torch
import torch.utils.data
import torch.nn as nn
import torch.optim as optim
from torch.autograd import Variable
from torch.utils.data import Dataset,DataLoader
from torchvision import datasets, transforms, models
... |
import os
from autogl.data.graph import GeneralStaticGraphGenerator
from autogl.data import InMemoryStaticGraphSet
from ._dataset_registry import DatasetUniversalRegistry
import torch_geometric
from torch_geometric.datasets import (
Amazon, Coauthor, Flickr, ModelNet,
Planetoid, PPI, QM9, Reddit, TUDataset
)
... |
from django import template
__author__ = "Alex Laird"
__copyright__ = "Copyright 2018, Alex Laird"
__version__ = "0.1.0"
register = template.Library()
@register.simple_tag
def active(request, pattern):
"""
Returns 'active' if the give pattern is in the current URL.
"""
try:
if (request.path ... |
from __future__ import absolute_import
from django import template
from django.utils.safestring import mark_safe
from numpy import array
import six
register = template.Library()
COMPARISON_PHRASE_MAP = {
206: ["more than double", ""],
195: ["about double", ""],
180: ["nearly double", ""],
161: ["more ... |
start = input()
n = len(start)
lol = []
for x in range(0, n):
lol.append(start[x : n])
lol.sort()
for s in lol:
print(s) |
import numpy as np
from numpy.core.numeric import Infinity
import gym
from collections import namedtuple
from time import sleep
import plotting
DEFAULT_CONFIG = {
'MAX_EPISODES': 2000,
'MAX_STEPS_PER_EPISODE': 1000,
'LEARNING_RATE': 0.01,
'DISCOUNT_RATE': 0.99,
'EXPLORATION_DECAY': 0.01,
'MIN_EXPLORATION_... |
import unittest
from sprial import spiral
class TestSpiralMethods(unittest.TestCase):
def test_spiral(self):
funcs = [spiral]
for func in funcs:
self.assertEqual(func(3), [[1,2,3], [8,9,4], [7,6,5]])
if __name__ == '__main__':
unittest.main() |
from oic.oic.message import AuthorizationErrorResponse, ClientRegistrationErrorResponse
from .util import should_fragment_encode
class OAuthError(ValueError):
def __init__(self, message, oauth_error):
super().__init__(message)
self.oauth_error = oauth_error
class InvalidAuthorizationCode(OAuthE... |
# @File: insect_navigation.py
# @Info: to create an agent of insect navigation based on the insect brain model in insect_brain_model.py
# @Author: Xuelong Sun, UoL, UK
# @Time: 2020-02-17
import numpy as np
from scipy.special import expit
from image_processing import visual_sense
from insect_brain_model import... |
"""
encoder是使用了学长文中TRecgNet中的构建
使用ResNet18卷积部分的改版来构建
"""
import torch.nn as nn
import torch.nn.functional as F
import torchvision.models as models
from config.secret_config import SECRET_CONFIG
import os
import torch
class Encoder(nn.Module):
def __init__(self, config):
"""
用于初始化Encoder网络
... |
# SPDX-License-Identifier: Apache-2.0
version = '1.10.0'
git_version = '0065af6273eac0e911a0e75eab1cdf6be1c9ac7b'
|
from __future__ import absolute_import
from __future__ import unicode_literals
from webfriend.scripting.commands.base import CommandProxy
from webfriend.utils import autotype
from webfriend.scripting.parser import types
class FormatProxy(CommandProxy):
qualifier = 'fmt'
doc_name = 'Format'
def autotype(s... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2018-04-13 04:50
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('opportunities', '0002_auto_20180412_1918'),
]
operations = [
migrations.Add... |
import numpy
from generate import *
def generate():
vectors = []
x, y = random_complex64(256), random_complex64(256)
vectors.append(TestVector([], [x, y], [x * numpy.conj(y)], "2 256 ComplexFloat32 inputs, 256 ComplexFloat32 output"))
return BlockSpec("MultiplyConjugateBlock", vectors, 1e-6)
|
"""
*
* Author: Juarez Paulino(coderemite)
* Email: juarez.paulino@gmail.com
*
"""
I=lambda:map(int,input().split())
n,k=I()
a=*I(),
b=*I(),
c=[0]*(k+1)
for x in a:c[x]+=1
l=k-len({*a})
a=sorted(zip(b,a))
r=0
for i in range(n):
if l<1:break
if c[a[i][1]]>1:
r+=a[i][0]
c[a[i][1]]-=1
l-=1
print(r) |
from crispy_forms.layout import (
Button,
Div,
Field,
Hidden,
HTML,
Layout,
Row,
Submit
)
from crispy_forms.bootstrap import (
AppendedText,
FormActions,
PrependedText,
Tab,
TabHolder
)
from crispy_forms.bootstrap import StrictButton
from crispy_forms.helpe... |
import os
import numpy as np
import random
import torch
import torch.nn as nn
import yaml
from typing import Any, List, Tuple, Dict
from types import ModuleType
from utils.logger import setup_logger
logger = setup_logger(__name__)
def get_instance(module: ModuleType, name: str, config: Dict, *args: Any) -> Any:
... |
# Copyright 2018 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
import logging
import os
import textwrap
from urllib.request import urlopen
from indic_transliteration import sanscript
from bs4 import BeautifulSoup
from tqdm import tqdm
from curation_projects.raamaayana.dump import aandhra
from doc_curation.md import get_md_with_pandoc
from doc_curation.md.file import MdFile
from... |
#!/usr/bin/python
'''
python TCP echo client by Chris <nodexy@gmail>
USAGE: %s <server_ip> <server_port> <msg>
'''
# 2012-2-22 Shenzhen, China
import socket
from sys import argv
def f(host,port,msg):
sock = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
sock.connect((host,port))
sock.send(msg)
pri... |
import logging
from collections import OrderedDict
import torch
import torch.nn as nn
from torch.nn.parallel import DataParallel, DistributedDataParallel
import models.networks as networks
import models.lr_scheduler as lr_scheduler
from .base_model import BaseModel
from models.loss import GANLoss
import wandb
from util... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
07b.py
~~~~~~
Advent of Code 2017 - Day 7: Recursive Circus
Part Two
The programs explain the situation: they can't get down. Rather, they could
get down, if they weren't expending all of their energy trying to keep the
tower balanced. Appa... |
# 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.
# -----------------------------------------------------... |
"""
Given an array of integers nums sorted in ascending order, find the starting and ending position of a given target value.
Your algorithm's runtime complexity must be in the order of O(log n).
If the target is not found in the array, return [-1, -1].
Solution:
- It's a typical binary search with a slight variatio... |
from theano import shared
from .cost_functions import mse, cip_relevancy, cip_redundancy, neg_corr, cip_synergy, cip_full
from .logger import Logger
from .regularizer_functions import L2
from .score_functions import mutual_information_cs
from .update_functions import sgd, count_iterations, sgd_cip
from .utils_function... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import annotations
from typing import Any, Dict, List, Optional, Tuple, Type
import torch
from ax.cor... |
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os
import shutil
import sys
import pytest
import llnl.util.filesystem
import spack.compilers
import spack.main
im... |
# Copyright (c) Shopkick 2017
# See LICENSE for details.
'''
Shell
-----
Running subprocesses with a shell-like interface.
'''
import contextlib
import os
import tempfile
import time
import signal
import subprocess
import attr
class ProcessError(Exception):
"""
A process has exited with non-zero status.
... |
try:
from .._torch_blade._mlir import *
_is_available = True
except ImportError as e:
# MLIR support is disable
_is_available = False
import contextlib
from torch_blade import utils
from torch_blade.config import OptPipelines
from torch_blade.mlir.disc_engine_conversion import (
_optimize_mlir,
... |
import numpy as np
from os import path
from Tree import Tree
DATASET = '../data'
def load():
print('Load Trees...')
with open(path.join(DATASET, 'STree.txt')) as f:
trees = []
for line in f.readlines():
tree = line.split('|')
tree = np.array(tree).astype(int)
... |
"""
This file offers the methods to automatically retrieve the graph Streptomyces sp. R1NS10.
The graph is automatically retrieved from the STRING repository.
Report
---------------------
At the time of rendering these methods (please see datetime below), the graph
had the following characteristics:
Datetime: 202... |
"""Abstract linear algebra library.
This module defines a class hierarchy that implements a kind of "lazy"
matrix representation, called the ``LinearOperator``. It can be used to do
linear algebra with extremely large sparse or structured matrices, without
representing those explicitly in memory. Such matrices can be a... |
class Account:
def __init__(self, balance, account_no):
self.balance = float(balance)
self.account_no = account_no
def deposit(self, amount):
self.balance+=amount
def print_balance(self):
pri... |
"""
compute.py
======================================
Methods for computing signatures over windows.
"""
import torch
from torch import nn
import signatory
from sklearn.base import BaseEstimator, TransformerMixin
import src.models.rescaling as rescaling_module
import src.features.window as window_module
from src.featur... |
# -*- coding: utf-8 -*-
"""
Created on Fri Jul 13 05:16:40 2018
@author: J-Y Moon
"""
import matplotlib.pyplot as plt # import matplotlib
import numpy as np # import numpy
import scipy as sp # import scipy
from scipy import sparse # import sparse module from scipy
import ne... |
from __future__ import print_function
import sys, os
from subprocess import check_output, CalledProcessError, STDOUT
from os import path
import re
args = sys.argv
filelist=args[1:]
filelist[0] = path.abspath(filelist[0])
searchdir = filelist[0] if path.isdir(filelist[0]) else path.split(filelist[0])[0]
ans=None
while... |
from cms.app_base import CMSApp
from cms.apphook_pool import apphook_pool
from django.utils.translation import ugettext_lazy as _
class GroupplanerApphook(CMSApp):
name = _("Groupplaner")
urls = ["groupplaner.urls"]
apphook_pool.register(GroupplanerApphook)
|
import sys
#list of exempted element: book, foods, medical products
exemptedList = ["book", "chocolate", "headache pills"]
def appliedTaxesPrice(rawPrice, quantity, isExempted, isImported):
"""
Compute taxes on good prices: imported goods + 5%; not exempted food 10%
:param str rawPrice: not taxed priced i... |
import pandas as pd
d = pd.read_csv("D:\\445\\13.csv")
d['Smoke'].value_counts()
|
# -*- coding: utf-8 -*-
# Copyright (c) 2016-2017, Zhijiang Yao, Jie Dong and Dongsheng Cao
# All rights reserved.
# This file is part of the PyBioMed.
# The contents are covered by the terms of the BSD license
# which is included in the file license.txt, found at the root
# of the PyBioMed source tree.
'''
#####... |
from django.contrib import admin
from .models import CustomUser, Jwt, Favorite
admin.site.register((CustomUser, Jwt, Favorite))
|
class Links:
def __init__(self):
self.mineral_id = None
self.controller_id = None
self.source_ids = []
self.other_ids = []
self.storage_id = None
self.terminal_id = None
def get_mineral(self):
return Game.getObjectById(self.mineral_id)
def get_controll... |
from setuptools import find_packages, setup
setup(
name="determined-deploy",
version="0.16.2.dev0",
author="Determined AI",
author_email="hello@determined.ai",
url="https://determined.ai/",
description="Determined Deep Learning Training Platform",
long_description="See https://docs.determin... |
#############################################################################
# NOTICE #
# #
# This software (or technical data) was produced for the U.S. Government #
# under ... |
#!/usr/bin/python
#
# Copyright 2015 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 b... |
# Copyright 2012 Viewfinder Inc. All Rights Reserved.
# -*- coding: utf-8 -*-
"""Test for Calendar objects.
"""
__author__ = 'spencer@emailscrubbed.com (Spencer Kimball)'
import datetime
import time
import unittest
from viewfinder.backend.resources.calendar import Calendar
class CalendarTestCase(unittest.TestCase)... |
# Copyright 2013 New Dream Network, LLC (DreamHost)
#
# 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 a... |
# -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://doc.scrapy.org/en/latest/topics/item-pipeline.html
import csv
import pymysql
from pymysql.cursors import DictCursor
from douban import settings
class DoubanPipeline(object):
... |
# pylint: disable-msg=E1101,W0612
import operator
import pytest
from numpy import nan
import numpy as np
import pandas as pd
from pandas import Series, DataFrame, bdate_range, Panel
from pandas.errors import PerformanceWarning
from pandas.core.indexes.datetimes import DatetimeIndex
from pandas.tseries.offsets import... |
from django.db import models
from django_backblaze_b2 import BackblazeB2Storage, LoggedInStorage, PublicStorage, StaffStorage
class ModelWithFiles(models.Model):
b2StorageFile = models.FileField(
name="b2StorageFile",
upload_to="uploads",
verbose_name="B2 Storage File",
storage=Ba... |
from django.shortcuts import render, redirect
from .form import UserRegister, UserUpdate, ProfileUpdate
from django.contrib import messages
from django.contrib.auth.views import LoginView
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
# Create your views here.
d... |
# Copyright 2016 Amazon Web Services, Inc. or its affiliates. All Rights Reserved.
# This file is licensed to you under the AWS Customer Agreement (the "License").
# You may not use this file except in compliance with the License.
# A copy of the License is located at http://aws.amazon.com/agreement/ .
# This file... |
from pathlib import Path
from typing import Any, Dict, List, Optional, Tuple, Union, cast
import numpy as np
import pandas as pd
from IPython.display import display
from pycocotools.helpers import CocoClassDistHelper as COCO
from pycocotools.helpers import CocoJsonBuilder
from tqdm.auto import tqdm
from .metadata imp... |
from Tkinter import *
import sqlite3
from tkMessageBox import *
con=sqlite3.Connection("Procurement System")
cur=con.cursor()
#cur.execute("insert into Login values('123','123') " )
root =Tk()
root.geometry('500x450')
root.title("Python Project")
Label(root,text='Procurement System',relief='ridge',bg='green',f... |
class CoffeeMachine:
water_state = 0
milk_state = 0
beans_state = 0
cups_state = 0
money_state = 0
power = True
# Espresso Gradients
espresso_water = 250
espresso_beans = 16
espresso_price = 4
# Latte Gradients
latte_water = 350
latte_milk = 75
latte_beans = 20
... |
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... |
##############################################################################
# Copyright by The HDF Group. #
# All rights reserved. #
# #
# Th... |
from . import SentenceEvaluator
from typing import Iterable
class SequentialEvaluator(SentenceEvaluator):
"""
This evaluator allows that multiple sub-evaluators are passed. When the model is evaluated,
the data is passed sequentially to all sub-evaluators.
All scores are passed to 'main_score_function... |
import os.path
from data.base_dataset import BaseDataset, get_params, get_transform
from data.image_folder import make_dataset
from PIL import Image
import cv2
import numpy as np
class AlignedDataset(BaseDataset):
"""A dataset class for paired image dataset.
It assumes that the directory '/path/to/data/train'... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_codegen
----------------------------------
Tests for `codegen` module.
"""
import sys
import unittest
from contextlib import contextmanager
from click.testing import CliRunner
from codegen import codegen
from codegen import cli
class TestCodegen(unittest.Te... |
#!/usr/bin/env python
from setuptools import setup
if __name__ == "__main__":
setup(
name='pyeither',
version='0.1.1',
packages=['either',],
license='MIT',
description='An implementation of Data.Either from Haskell in Python',
long_description=open('README.md').read... |
# -*- coding: utf-8 -*-
# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
from ccxt.async_support.base.exchange import Exchange
from ccxt.base.errors import ExchangeError
from ccxt.base.errors import ArgumentsRequ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.