content
stringlengths
0
894k
type
stringclasses
2 values
from django.urls import path, include from mighty.functions import setting from mighty.applications.user import views urlpatterns = [ path('user/', include([ path('create/', views.CreateUserView.as_view(), name="use-create"), ])), ] api_urlpatterns = [ path('user/', include([ path('form/',...
python
from django.core.management.base import BaseCommand, CommandError from openfood.models import Product, Category, Position from django.db import models from datetime import datetime import sys import requests class Collector: """ Get products from Open Food Facts database. Register fields for 'Products' &...
python
import altair as alt from model import data_wrangle def return_fatality_bar_chart(value=None): """ creates an altair chart object for the plot of the fatality barchart. Parameters ---------- value: the value passed in from the radio buttons. "0", "1", and "2" for "first-world", "non-first-wo...
python
import sys from collections import OrderedDict import calplot import pandas as pd def loadData(filename: str): df = pd.read_csv(filename, usecols=['DateTime', 'Open', 'High', 'Low', 'Close', 'Volume'], na_values=['nan']) df['DateTime'] = pd.to_datetime(df['DateTime'], utc=True).dt.tz_convert('US/Eastern') ...
python
from aiohttp import web, test_utils import typing import asyncio import functools from .const import InputQuery import attr @attr.s class AppContainer: host: typing.Optional[str] = attr.ib(default=None) port: typing.Optional[int] = attr.ib(default=None) _app: web.Application = attr.ib(factory=web.Applica...
python
'''OpenGL extension SGIS.texture_color_mask Overview (from the spec) This extension implements the same functionality for texture updates that glColorMask implements for color buffer updates. Masks for updating textures with indexed internal formats (the analog for glIndexMask) should be supported by a separate ...
python
from .api import AppSyncAPI
python
# -*- coding: utf-8 -*- import time from typing import List, Dict, Any from chaosaws import aws_client from chaoslib.exceptions import FailedActivity from chaosaws.types import AWSResponse from chaoslib.types import Configuration, Secrets from logzero import logger from .constants import OS_LINUX, OS_WINDOWS, GREP_PR...
python
import torch as T import dataclasses as dc from typing import Optional, Callable def vanilla_gradient( output, input, filter_outliers_quantiles:tuple[float,float]=[.005, .995]): map = T.autograd.grad(output, input) assert isinstance(map, tuple) and len(map) == 1, 'sanity check' map = map[0...
python
import argparse import torch import wandb wandb.login() from dataloader import get_dataloaders from utils import get_model from train import Trainer parser = argparse.ArgumentParser() parser.add_argument('--dataset', required=True, choices=['c10', 'c100', 'svhn']) parser.add_argument('--model', required=True, choice...
python
def divide(num): try: return 42 / num except ZeroDivisionError: print('Error: Invalid argument') print(divide(2)) print(divide(12)) print(divide(0)) print(divide(1))
python
# coding=utf-8 # # created by kpe on 28.Mar.2019 at 15:56 # from __future__ import absolute_import, division, print_function
python
import graphviz dot = graphviz.Digraph(comment='GIADog system overview') dot.render('output/system.gv', view=True)
python
# The MIT License (MIT) # Copyright (c) 2020 Mike Teachman # https://opensource.org/licenses/MIT # Platform-independent MicroPython code for the rotary encoder module # Documentation: # https://github.com/MikeTeachman/micropython-rotary import micropython _DIR_CW = const(0x10) # Clockwise step _DIR_CCW = const(0...
python
from flask import Flask app = Flask(__name__) import sqreen sqreen.start() from app import routes if __name__ == '__main__': app.run(debug=True)
python
"""Module to generate datasets for FROCC """ import os import numpy as np import sklearn.datasets as skds import scipy.sparse as sp def himoon(n_samples=1000, n_dims=1000, sparsity=0.01, dist=5): # n_samples = 1000 # n_dims = 1000 # dist = 5 # sparsity = 0.01 x, y = skds.make_moons(n_samples=n_sa...
python
import pytest from mixer.main import mixer from smpa.models.address import Address, SiteAddress @pytest.fixture def address(): obj = Address() obj.number = "42" obj.property_name = "property name" obj.address_line_1 = "address line 1" obj.address_line_2 = "address line 2" obj.address_line_3 =...
python
# Russell RIchardson # Homework 2, problem 1 """This reads from a text file and returns a string of the text""" def read_from_a_file(the_file): file=open(the_file,'r') the_string=file.read() file.close() return the_string """This takes in a string and writes that string to a text file""" def write...
python
""" Perform inference on inputted text. """ import utils import torch from termcolor import cprint, colored as c import model import data import re import sys source = sys.argv[1] # get an edgt object def get_edgt(): input_chars = list(" \nabcdefghijklmnopqrstuvwxyz01234567890") output_chars = ["<nop>", "<cap...
python
#!/usr/bin/env python # -*- coding: utf-8 -*- '''checkplot.py - Waqas Bhatti (wbhatti@astro.princeton.edu) - Jan 2017 License: MIT. Contains functions to make checkplots: quick views for determining periodic variability for light curves and sanity-checking results from period-finding functions (e.g., from periodbase)...
python
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: lazy_read.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 import symbol_database as _symbol...
python
import os import sys import socket import time from multiprocessing import Process from pathlib import Path from typing import Tuple, Union import torch from torch.utils.tensorboard import SummaryWriter from super_gradients.training.exceptions.dataset_exceptions import UnsupportedBatchItemsFormat # TODO: These utils...
python
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright © 2016-2017 Stella/AboodXD # Supported formats: # -RGBA8 # -RGB10A2 # -RGB565 # -RGB5A1 # -RGBA4 # -L8/R8 # -L8A8/RG8 # -BC1 # -BC2 # -BC3 # -BC4U # -BC4S # -BC5U # -BC5S # Feel free to include this in your own program if you want, just give cr...
python
#!/usr/bin/python # # Copyright 2018-2021 Polyaxon, 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 ...
python
# Marcelo Campos de Medeiros # ADS UNIFIP # REVISÃO DE PYTHON # AULA 10 CONDIÇÕES GUSTAVO GUANABARA ''' Faça um Programa que pergunte o salário do funcionário e calcule o valor do seu aumento. * Para salários superiores a R$ 1.250.00, Calcule um aumento de 10%. * Para os inferiores ou iguais o aumento é de 15%...
python
# global imports from dash.dependencies import Input, Output, State, ALL # ClientsideFunction from dash import html # local imports from ..dash_app import app import pemfc_gui.input as gui_input from .. import dash_layout as dl tab_layout = html.Div(dl.frame(gui_input.main_frame_dicts[1])) @app.callback( Outpu...
python
import bitmex import time import pandas as pd from keys import ID, SECRET, SLACK_TOKEN from slackclient import SlackClient sc = SlackClient(SLACK_TOKEN) client = bitmex.bitmex(test=False, api_key=ID, api_secret=SECRET) dfpair = [] def get_volume_data(client): dfpair.clear() dfxbt = client.Trade.Trade_getBuc...
python
#!/usr/bin/env python3 import sys if len(sys.argv) > 1: infilename = sys.argv[1] else: infilename = 'input.txt' with open(infilename, 'r') as infile: buf= [line.strip().split() for line in infile] max_col = max([len(x) for x in buf]) print(max_col) row_checksums = [] for line in buf: maximum = 0 minim...
python
import itertools from typing import Optional, Sequence from eth_typing import Address, BlockNumber, Hash32 from eth_utils import is_same_address from sqlalchemy import orm from sqlalchemy.orm.exc import NoResultFound from cthaeh.filter import FilterParams from cthaeh.loader import get_or_create_topics from cthaeh.mod...
python
import yaml import contextlib import logging from teuthology import misc as teuthology from teuthology.orchestra import run log = logging.getLogger(__name__) import os import pwd import time import argparse """ # Test yaml to test script mapper for boto3 tests_mapper_v2 = {'test_Mbuckets_basic': 'test_Mbuckets_basic'...
python
#!/usr/bin/python # -*- coding: utf-8 -*- #- Author : (DEK) Devendra Kavthekar # program068: # Please write a program using generator to print the even numbers between # 0 and n in comma separated form while n is input by console. # Example: # If the following n is given as input to the program: # 10 # The...
python
import numpy as np from typing import Union, Optional from ray.rllib.models.action_dist import ActionDistribution from ray.rllib.utils.annotations import override from ray.rllib.utils.exploration.exploration import Exploration, TensorType from ray.rllib.utils.framework import try_import_tf, try_import_torch, \ get...
python
version = "2021.11.29.01"
python
import logging from itertools import chain from pprint import pformat from future.utils import lmap from foxylib.tools.collections.collections_tool import merge_dicts, DictTool, lchain from foxylib.tools.database.elasticsearch.elasticsearch_tool import ElasticsearchTool from foxylib.tools.json.json_tool import JsonTo...
python
from django.shortcuts import render from django.http import HttpResponse from .models import User # Create your views here. def help(request): helpdict = {'help_insert':'HELP PAGE'} return render(request,'appTwo/help.html',context=helpdict) def index(request): return render(request,'appTwo/index.html') d...
python
import wx from wx.adv import CalendarCtrl, GenericCalendarCtrl from get_file import get_file from wx import adv from static.MButton import MButton class TimeFrame(wx.Frame): '''类似于日程表, 可以添加事件及其时间段, 到了相应的时间会提醒用户''' def __init__(self, parent, data=None): wx.Frame.__init__(self, parent, title='日程表', si...
python
import argparse import cv2 # ap = argparse.ArgumentParser() # ap.add_argument("--i", "--image", required=True, help="path to input image") # args= vars(ap.parse_args()) # image = cv2.imread(args["image"]) image = cv2.imread("lena.png") (h, w, c)= image.shape[:3] #height= no of rows, width= no of columns, channnel= ...
python
import discord from discord.ext import commands from discord.utils import get class c259(commands.Cog, name="c259"): def __init__(self, bot: commands.Bot): self.bot = bot @commands.command(name='Abyssal_Awakening', aliases=['c259', 'Abyssal_10']) async def example_embed(self, ctx): embed =...
python
# Imports from django.db import models from django.contrib.auth.models import User # Lead class Lead(models.Model): name = models.CharField(max_length=255) email = models.EmailField(max_length=255, unique=True) message = models.CharField(max_length=500, blank=True) owner = models.ForeignKey(User, related_name=...
python
# ckwg +28 # Copyright 2018 by Kitware, 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 conditi...
python
# 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...
python
# -*- coding: utf-8 -*- r"""Consider the following properties of relation $r$. Because the corruption operations (see `Corruption`_) are applied independently of triples, the resulting candidate corrupt triples could overlap with known positive triples in $\mathcal{K}$. ===================== ========================...
python
import statistics import os import jwql.instrument_monitors.miri_monitors.data_trending.utils.mnemonics as mn import jwql.instrument_monitors.miri_monitors.data_trending.utils.sql_interface as sql import jwql.instrument_monitors.miri_monitors.data_trending.utils.csv_to_AstropyTable as apt from jwql.utils.utils imp...
python
import matplotlib.pyplot as plt def show(*args, **kws): """Show a window with the given plot data. Blocks until window is closed. Parameters ---------- *args : pyplot args **kws : pyplot kw Examples -------- Plot a line. >>> bplot.line(x, y) >>> bplot.show() """ plt.show(*args, *...
python
import matplotlib.pyplot as plt from keras.preprocessing import image import warnings warnings.filterwarnings("ignore") import time import os import numpy as np import pandas as pd from tqdm import tqdm import json #from basemodels import VGGFace, OpenFace, Facenet, Age, Gender, Race, Emotion #from extendedmodels impo...
python
"""Module containing a template class to generate counterfactual explanations. Subclasses implement interfaces for different ML frameworks such as TensorFlow or PyTorch. All methods are in dice_ml.explainer_interfaces""" from abc import ABC, abstractmethod from collections.abc import Iterable import numpy as np...
python
# coding: utf-8 # Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. # This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c...
python
from setuptools import setup setup(name='my-package-ahadmushir', version='0.0.1', description='Testing installation of Package', url='https://github.com/ahadmushir/my_first_package', author='ahadmushir', author_email='a.ahad.mushir@gmail.com', license='MIT', packages=['mypackage'], zip_safe=False)
python
''' Author : Bhishm Daslaniya [17CE023] "Make it work, make it right, make it fast." – Kent Beck ''' n = int(input("Enter number: ")) print("Factors of "+ str(n) ) for _ in range(1,n): if(n % _ == 0): print( _ ,end=" ")
python
# coding: utf-8 from flask import Blueprint scope = Blueprint("scope", __name__, url_prefix="/scope/")
python
__author__ = 'matth' import unittest import sys from processfamily.test import ParentProcess, Config import os import subprocess import requests import time import socket import logging import glob from processfamily.processes import process_exists, kill_process, AccessDeniedError from processfamily import _traceback_...
python
import os import torch from sklearn.manifold import TSNE from matplotlib import cm import matplotlib.pyplot as plt import matplotlib matplotlib.use('Agg') def plot_tsne(feat, index, output_dir): print("feat: global mean = {:.4f}, {:.4f}".format(feat.mean(), feat.std())) embed = TSNE(n_components=2).fit_tran...
python
# pylint: skip-file from yamicache import Cache c = Cache() class App1(object): @c.cached() def test1(self, argument, power): """running test1""" return argument ** power @c.clear_cache() def test2(self): return 0 def test_clear(): """Make sure cache gets cleared""" ...
python
import os import argparse import requests from sanic import Sanic from sanic.response import json from osf_pigeon.pigeon import main, sync_metadata, get_id from concurrent.futures import ThreadPoolExecutor from sanic.log import logger from asyncio import events def run(main): loop = events.new_event_loop() tr...
python
import random import requests from bs4 import BeautifulSoup from colorama import Fore from colorama import Style from blagues_api import BlaguesAPI import asyncio def faituneblague(): blagues = BlaguesAPI( "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiMjAwNTQ5NjM1MDY3MDg0ODAwIiwibGltaXQiOjEwMCwia2...
python
from .weibo_h5 import WeiboH5API as WeiboAPI from .base import WeiboVisible
python
class Cursor: def __init__(self, wnd): self.wnd = wnd self.pos = 0 self.preferred_col = 0 self.preferred_linecol = 0 self.last_screenpos = (-1, -1) def refresh(self, top=None, middle=None, bottom=None, align_always=False): self.pos, y, x = self.w...
python
import warnings import numpy as np import math def ugly_number(n): """ Returns the n'th Ugly number. Ugly Numbers are numbers whose only prime factors are 2,3 or 5. Parameters ---------- n : int represent the position of ugly number """ if(n<1): raise NotImplemente...
python
""" ARC's settings """ import os import string import sys servers = { 'local': { 'path': '/storage/ce_dana/', 'cluster_soft': 'HTCondor', 'un': '[username]', 'cpus': 8, 'memory': 256, }, } # List here servers you'd like to associate with specific ESS. # An ordered list...
python
from setuptools import setup, find_packages setup( name='PyloXyloto', version='1.0', description='PyloXyloto is a simple Deep learning framework built from scratch with python that supports the main ' 'functionalities needed for a deep learning project', py_modules=["activation...
python
import unittest from libsaas.executors import test_executor from libsaas.services import base, twilio class TwilioTestCase(unittest.TestCase): def setUp(self): self.executor = test_executor.use() self.executor.set_response(b'{}', 200, {}) self.service = twilio.Twilio('my-sid', 'my-token...
python
from __future__ import print_function, division import numpy as np import matplotlib.pyplot as plt import os import pandas from functions import getbinary from sklearn.utils import shuffle class LogisticModel(object): def __init__(self): pass def fit(self,X,Y,X_test,Y_test,lr = 10e-7,reg = 10e-22,epoc...
python
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
python
# 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 # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requ...
python
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from __future__ import print_function # Let's import what we need import os import sys import tld import time import random import warnings import argparse import threading from math import log from re import search, findall from requests import get, post try: impor...
python
from flask import Flask from flask_restful import Api from status import Status from runner import Runner app = Flask(__name__) api = Api(app) # Routing api.add_resource(Status, '/') api.add_resource(Runner, '/analyze') if __name__ == '__main__': app.run(host='0.0.0.0', debug=True, port=3000)
python
""" Main lesscss parse library. Contains lexer and parser, along with utility classes """
python
# coding=utf-8 # Marcelo Ambrosio de Goes # marcelogoes@gmail.com # 2022-03-07 # 100 Days of Code: The Complete Python Pro Bootcamp for 2022 # Day 20/21 - Snake Game from turtle import Turtle import random class Food(Turtle): def __init__(self, input_width, input_height): super().__init__() self...
python
from tests.nlg.test_nlg import BaseTestTemplateNLG, BaseTestCamrest from convlab2.nlg.template.camrest.nlg import TemplateNLG class TestTemplateCamrest(BaseTestTemplateNLG, BaseTestCamrest): @classmethod def setup_class(cls): BaseTestTemplateNLG.setup_class() BaseTestCamrest.setup_class() ...
python
from threading import Thread, Timer from time import time import logging import random import numpy as np class Brandbox_temperature_humidity(Thread): """This class is reads out continiously the temperature and humidity from the Brandbox This class inherits all function from the threading class an therefore c...
python
#!/usr/bin/env python3 # # laaso/hydrator.py # # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # ''' Main program to hydrate the Lustre namespace from blob. ''' import datetime import multiprocessing import os import pickle import queue import stat import sys import syslog...
python
from admin_tabs.tests.metaadminpageconfig import *
python
#!/usr/bin/env python3 import sys import operator import unittest import hypothesis from .util import lattice_dimensions_with_lower_bound from synth.search import Simple from synth.search import MinimizedSplit from synth.search import BinaryPartition from synth.search import Saddleback class DummyFunction: def ...
python
from vumi.transports.twitter.twitter import ( ConfigTwitterEndpoints, TwitterTransport) __all__ = ['ConfigTwitterEndpoints', 'TwitterTransport']
python
#!/usr/bin/env python """A mercurial external differ for notebooks. Uses nbdime to create diffs for notebooks instead of plain text diffs of JSON. See the documentation for how to correctly configure mercurial to use this. Use with: hg extdiff -p hg-nbdiff [<commit> [<commit>]] """ from __future__ import print_...
python
# imports import matplotlib.pyplot as plt import scipy.stats as stats import numpy as np import json import pickle from urllib.request import urlopen # helper functions def bisection(array, value): '''Given an ``array`` , and given a ``value`` , returns an index j such that ``value`` is between array[j] a...
python
# Copyright 2016 Google Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except # in compliance with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed ...
python
#!/usr/bin/python3 """ Consumer -------- Write a generator that consumes lines of a text and prints them to standard output. Use this generator and a `flatten` function from the previous task to print contents of two different files to a screen pseudo-simultaneously. """ from course.lesson07.task05.flatten import flat...
python
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon May 6 13:55:09 2019 @author: Mrinmoy Bhattacharjee, PhD Scholar, EEE Dept., IIT Guwahati """ import os import numpy as np import pickle from sklearn import preprocessing import json from sklearn.metrics import confusion_matrix, precision_recall_fscore_...
python
""" Incident Updates API Endpoint """ # Third Party Library from django.views import View from django.urls import reverse from pyvalitron.form import Form from django.http import JsonResponse from django.forms.fields import DateTimeField from django.utils.translation import gettext as _ # Local Library from app.modul...
python
class TreeNode: def __init__(self, val, left, right): self.val = val self.right = right self.left = left class Solution: def mergeTrees(self, t1, t2): """ :type t1: TreeNode :type t2: TreeNode :rtype: TreeNode Given two binary trees and imagine t...
python
from owslib.etree import etree from owslib.util import Authentication, openURL from urllib.parse import urlencode, parse_qsl class WFSCapabilitiesReader(object): """Read and parse capabilities document into a lxml.etree infoset """ def __init__(self, version="1.0", username=None, password=None, headers=...
python
import shutil from django.core.checks import Error, register @register def check_binaries(app_configs, **kwargs): errors = [] if not shutil.which("convert", path="/usr/local/bin:/usr/bin:/bin"): errors.append( Error( 'The "convert" binary could not be found', ...
python
import pytest from ..traittypes import _DelayedImportError def test_delayed_access_raises(): dummy = _DelayedImportError('mypackage') with pytest.raises(RuntimeError): dummy.asarray([1, 2, 3])
python
import os import time import pytest from huntsman.drp.services.plotter import PlotterService @pytest.fixture(scope="function") def plotter_service(config, exposure_collection_real_data): ps = PlotterService(config=config) yield ps # Make sure the service is stopped ps.stop() # Cleanup the imag...
python
from nn_recipe.NN import Network import numpy as np from nn_recipe.utility import OneHotEncoder from nn_recipe.DataLoader import MNISTDataLoader # Loading Data fro mnist Data set mnist = MNISTDataLoader(rootPath="C:\\Users\\mgtmP\\Desktop\\NNRecipe\\mnist", download=False) mnist.load() X_test = mnist.get_test_data()....
python
import os import unittest from conans.model.env_info import DepsEnvInfo from conans.model.profile import Profile from conans.model.settings import Settings from conans.paths import CONANFILE from conans.test.utils.tools import TestBufferConanOutput, TestClient from conans.util.files import save class MockSetting(str...
python
from abc import ABCMeta, abstractmethod from argparse import ArgumentParser from distutils import dir_util import logging from pathlib import Path import platform import sys from typing import NoReturn from hephaistos import backups, config, hashes, helpers, interactive, lua_mod, patchers, sjson_data from hephaistos.c...
python
############################################################ # -*- coding: utf-8 -*- # # # # # # # # # ## ## # ## # # # # # # # # # # # # # # # ## # ## ## ###### # # # # # # # # # Python-based Tool for interaction with the 10micron mounts # GUI with PyQT5 fo...
python
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU...
python
import requests import os if 'TPU_DRIVER_MODE' not in globals(): url = 'http://' + os.environ['COLAB_TPU_ADDR'].split(':')[0] + ':8475/requestversion/tpu_driver0.1-dev20191206' resp = requests.post(url) TPU_DRIVER_MODE = 1 # The following is required to use TPU Driver as JAX's backend. from jax.config import con...
python
"""usersエンティティ用モジュール""" from dataclasses import dataclass from decimal import Decimal from typing import Optional from aws.dynamodb.base import Base from aws.exceptions import DynamoDBError ALL = 0 WEST_JR = 1 HANKYU = 2 HANSHIN = 3 @dataclass class DelayInfoMessages(Base): """鉄道遅延情報メッセージ群クラス""" west_jr: ...
python
from typing import Optional, Iterable, Any from platypush.message.event import Event class DbusSignalEvent(Event): """ Event triggered when a signal is received on the D-Bus. """ def __init__( self, bus: str, interface: str, sender: str, path: str, signal: str, params: Optional[Iterab...
python
""" https://github.com/invl/retry """ import random import time from functools import partial, wraps from typing import Callable, Optional, ParamSpecArgs, ParamSpecKwargs, Tuple, Type, List, Any # sys.maxint / 2, since Python 3.2 doesn't have a sys.maxint... from pydantic import Field, PositiveFloat, PositiveInt, ...
python
# Distributed under the terms of the BSD 3-Clause License. # The full license is in the file LICENSE, distributed with this software. # # Author: Philipp Schmidt <philipp.schmidt@xfel.eu> # Copyright (c) 2020, European X-Ray Free-Electron Laser Facility GmbH. # All rights reserved. from collections.abc import Sequenc...
python
# coding: utf-8 """ SnapshotSnapshotsApi.py Copyright 2016 SmartBear Software 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 ...
python
# # [To-Do] 1. Loop-Unrolling # 2. Boundary Checks # 3. Instuction Reordering # def tc_code_kernel_Store_Results(f, opt_gen_full, l_t3_mapping_tb_2D, l_t3_mapping_reg, size_reg_x, size_reg_y, idx_kernel, opt_accumulated): # # # f.write("\n") f.write("\t// Store Results (Registe...
python
# -*- coding: utf-8 -*- from openprocurement.auctions.core.utils import opresource from openprocurement.auctions.core.views.mixins import AuctionAuctionResource @opresource(name='belowThreshold:Auction Auction', collection_path='/auctions/{auction_id}/auction', path='/auctions/{auction_id}/auc...
python
from django.db import models # ePrice(比價王) # Create your models here. class Post(models.Model): ### id post_id = models.CharField(max_length=64) #帖子ID # 以 https://www.eprice.com.tw/life/talk/9/5242470/1/ 而言, 帖子ID = 5242470 ### user pu_id = models.CharField(max_length=255) #...
python
import lmfit from time import time class ModelFit: """ We collect all information related to a fit between a pygom model and a set of data in this class It has access to the model structure and defines all required parameters and details of fit """ def dumpparams(self,run_id=''): # Have to add self si...
python