content
stringlengths
5
1.05M
# Generated by Django 3.2.6 on 2021-08-21 19:02 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('iotdb_cloud_core', '0002_alter_iotdbrelease_started'), ] operations = [ migrations.AddField( model_name='iotdbrelease', ...
from backend.autoControllers import abcControllerPID from typing import List class YawController(abcControllerPID.abcControllerPID): def __init__(self, upper_limit: int = 1600, lower_limit: int = 1400, kP: float = 0.02, kI: float = 0.0, kD: float...
from __future__ import print_function import numpy as np import tensorflow as tf from edward.stats import norm from scipy import stats sess = tf.Session() def _assert_eq(val_ed, val_true): with sess.as_default(): assert np.allclose(val_ed.eval(), val_true) def _test_logpdf_scalar(x): xtf = tf.consta...
import scipy.io as sio from ops import * class decoder: def __init__(self, name): self.name = name def __call__(self, inputs): with tf.variable_scope(self.name, reuse=tf.AUTO_REUSE): inputs = tf.nn.relu(deconv("3_4", inputs, 256, 3, 2)) inputs = tf.nn.relu(c...
import os import os.path as op from PyQt5 import QtCore, QtGui, QtWidgets, uic # from .config import Ui_dlg_config class config_dialog(QtWidgets.QDialog): """ Dialog box class representing common options for a gear configuration. """ def __init__(self, parent=None, cbo_val=None): """ ...
class Settings: """Settings for bob bot.""" def __init__(self): # Distances before redirecting. self.safe_front_dist = 45 # Trig pin self.trig = 27 # Echo pin self.echo = 22 # H-Bridge self.in1 = 2 self.in2 = 3 self.in3 = 4 ...
"""Copyright (c) 2014 High-Performance Computing and GIS (HPCGIS) Laboratory. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. Authors and contributors: Eric Shook (eshook@kent.edu); Jayakrishnan Ajayakumar (jajayaku@kent.edu) """ from ..core.Opera...
from .auth_token_provider import AuthTokenProvider, AuthTokenProviderFactory from .simple_auth_token_provider import SimpleAuthTokenProvider, SimpleAuthTokenProviderFactory
"""Dreamhost python module""" import json import logging import os from urllib.request import urlopen from urllib.parse import urlencode logger = logging.getLogger(__name__) DREAMHOST_API_KEY = os.environ["DREAMHOST_API_KEY"] def _call(cmd, **params): params['cmd'] = cmd params['key'] = DREAMHOST_API_KEY ...
from tradssat.tmpl.var import CharacterVar, FloatVar from ._utils import _return_vars _standard_cul_vars = { 'VAR#': { 'class': CharacterVar, 'args': dict(size=6, spc=0, info='Identification code or number for the specific cultivar.') }, 'VRNAME': {'class': CharacterVar, 'args': dict(size=1...
import pyaml import yaml class Singleton(type): _instances = {} def __call__(cls, *args, **kwargs): if cls not in cls._instances: cls._instances[cls] = \ super(Singleton, cls).__call__(*args, **kwargs) return cls._instances[cls] class YamlConfigManager(metaclass=...
import tweepy def authenticate(consumer_key: str, consumer_secret: str, access_key: str, access_secret: str): auth = tweepy.OAuthHandler(consumer_key=consumer_key, consumer_secret=consumer_secret) auth.set_access_token(key=access_key, secret=access_secret) return tweepy.API(auth, timeout=900, wait_on_rat...
import os import shutil import numpy as np import pickle as pk import pandas as pd from keras.utils import to_categorical ,Sequence from keras import losses, models, optimizers from keras.models import load_model from keras.models import Sequential from keras.activations import relu, softmax from keras.callbacks import...
#!/usr/bin/env python3 """ Base classes and functions used by deepnox.tests.repositories. This file is a part of python-wipbox project. (c) 2021, Deepnox SAS. """ import logging import pandas as pd from pandas import DataFrame from deepnox import loggers LOGGER: logging.Logger = loggers.factory(__name__) loggers...
#!/bin/python num_list = [ 2, 23, 43, 56, 76, 98, 89, 34] greater_than_60 = filter(lambda n: n > 60, num_list) print(list(greater_than_60)) greater_than_50 = list(filter(lambda n: n > 50, num_list)) print(greater_than_50)
from django.db import models # Create your models here. from django.utils import timezone class Patient(models.Model): name = models.CharField(max_length=20, blank=False) # father_name = models.CharField(max_length=20, blank=False) address = models.CharField(max_length=30, blank=False) phone = models...
#!/usr/bin/env python # -*- coding: utf-8 -*- """Bokeh Visualization Template This template is a general outline for turning your data into a visualization using Bokeh. """ from __future__ import (division, absolute_import, print_function, unicode_literals) import os import pandas as pd # Bo...
from ....models.models import MotionCommentSection from ....permissions.permissions import Permissions from ...generics.create import CreateAction from ...util.default_schema import DefaultSchema from ...util.register import register_action @register_action("motion_comment_section.create") class MotionCommentSectionC...
#!/usr/bin/env python # Copyright (c) 2020 Carnegie Mellon University # # 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...
from django.contrib import admin from .models import Neighbourhood, healthservices, notifications, Business, Health, Authorities, BlogPost, Profile class HealthAdmin(admin.ModelAdmin): filter_horizontal = ['healthservices'] # Register your models here. admin.site.register(Neighbourhood) admin.site.register(notifi...
""" Unit tests for the lexer """ import pytest from pypred import parser, ast class MockPred(object): def static_resolve(self, identifier): if identifier[0] == identifier[-1] and identifier[0] in ("'", "\""): return identifier[1:-1] return ast.Undefined() def resolve_identifier(sel...
""" Author: Haris Hasic, Phd Student @ Ishida Laboratory, Department of Computer Science, Tokyo Institute of Technology Created on: November 9th, 2019 Explanation: This file contains necessary functions that help with the visualization of molecules and reactions. """ import io from PIL import Image from cairosvg...
for x in range (-22, 22): if x % 3 == 0 and x % 5 == 0: print("Fizz Buzz") elif x % 3 == 0: print ("Fizz") elif x % 5 == 0: print ("Buzz") else: print (x)
from scipy.signal import find_peaks import numpy as np import pandas as pd import tsfresh from tsfresh.feature_extraction import settings from tsfresh.utilities.dataframe_functions import impute from typing import Tuple, Optional class Preprocess: def __init__(self, feature_path: str, n_features: int): im...
from Bio.SeqUtils import MeltingTemp import sys def Tm(primerSeq): TM=MeltingTemp.Tm_NN(primerSeq,Na=50, K=50, Mg=2,nn_table=MeltingTemp.DNA_NN4) return(TM) if __name__=="__main__": oligo=sys.argv[1] print(round(Tm(oligo),2))
from importlib import resources from rich.traceback import install from .exceptions import InstaterError from .main import run_tasks install() VERSION = resources.read_text("instater", "VERSION").strip() __all__ = [ "InstaterError", "VERSION", "run_tasks", ]
# # # Author: Touseef Liaqat <tliaqat@vmware.com> from installer import Installer class InstallerContainer(object): def __init__(self, install_config, maxy=0, maxx=0, iso_installer=False, rpm_path="../stage/RPMS", log_path="../stage/LOGS", log_level="info"): self.inst...
""" Base event loop interface. The naming convention is kept similar to asyncio as much as possible. A special thanks to asyncio (tulip), Twisted, Tornado and Trollius for setting a good example on how to implement event loops. Possible, in the future, we'll run entirely on top of asyncio, but right now, we're still ...
from __future__ import unicode_literals from django.utils import six from djblets.testing.decorators import add_fixtures from reviewboard.reviews.fields import BaseTextAreaField from reviewboard.reviews.models import ReviewRequest from reviewboard.testing import TestCase class BaseTextAreaFieldTests(TestCase): """Unit...
#!/usr/bin/python ####################### # Butuh Bantuan Hubungi 0895401454905 # ####################### mess = """====================================================== Deface Script Creator Ubaii ID Feat Goodhand11. ==============================================...
import ast from argparse import ArgumentParser, FileType from functools import partial, partialmethod from irun.base import Matchers from irun.preprocessor import transpile DEFINITION_TYPES = (ast.FunctionDef, ast.AsyncFunctionDef, ast.ClassDef) class singleton(ast.AST): _fields = () _attributes = ("lineno"...
from marshmallow import Schema, fields, RAISE, EXCLUDE def validate_config(configuration: dict, source_cls, transform_cls, target_cls): source_config_schema: Schema = source_cls.configuration_schema() source_config_errors = source_config_schema.valid...
from __future__ import (absolute_import, division, print_function, unicode_literals) from builtins import * import collections import itertools import regex as re import textwrap from commitsan.checks import checker from commitsan.git import git_show def split_lines(s): return [line.stri...
from typing import Tuple from construct import Construct, Container from mercury_engine_data_structures.formats import BaseResource, standard_format from mercury_engine_data_structures.game_check import Game BMMDEF = standard_format.create('CMinimapDef', 0x02000001) class Bmmdef(BaseResource): @classmethod ...
#!/usr/bin/env python3 # # NextBus.py # Response to Target Case Study # Candidate: Dave White, dave4mpls@gmail.com, 612-695-3289 # Position: Guest Reliability Engineer # Date Completed: 7-31-2018 # # See design questions section below for design decisions that were made # # Purpose: Contacts the Metro Transit XML web s...
# -*- coding: utf-8 -*- """ >>> from cStringIO import StringIO >>> stream = StringIO(''' ... [ ... { ... "rgb": {"r": 255, "g": 0, "b": 0}, ... "hsv": {"h": 0, "s": 100, "v": 100}, ... "hex": "FF0000" ... }, ... { ... "rgb": {"r": 0, "g": 0, "b": 0...
import datetime from typing import List, Optional from pydantic import BaseModel class V2_FundProfileData(BaseModel): symbol: str name: str description: str fund_type: str inception_date: datetime.date cusip: str isin: str website: str class Config: orm_mode = True clas...
#!/usr/bin/env python # -*- coding:utf-8 -*- from __future__ import absolute_import from __future__ import unicode_literals from __future__ import division from __future__ import print_function import itertools import tempfile import unittest import networkx as nx import numpy as np from dataset.taxonomy import BasicT...
import time import asyncio # 定义异步函数 async def hello(): print("Hello World:%s" % time.time()) # 必须使用await,不能使用yield from;如果是使用yield from ,需要采用@asyncio.coroutine相对应 await asyncio.sleep(1) print("Hello wow World:%s" % time.time()) def run(): tasks = [] for i in range(5): tasks.append(hel...
import unittest import requests_mock import os import pycef from pycef import Fund from datetime import date import requests class TestClient(unittest.TestCase): @requests_mock.Mocker() def setUp(self, mock_client): directory_path = os.path.dirname(__file__) self.system_path = os.getcwd() ...
import requests from flask import Flask, request, jsonify, redirect def get_current_weather_json(): CLIENT_IP = request.remote_addr GEO_KEY = "Api Key Goes Here" WEATHER_KEY = 'Api Key Goes Here' CURRENT_GEO_ENDPOINT = 'https://api.ipgeolocation.io/ipgeo?apiKey={0}&ip={1}&fields=geo'.format(GEO_KEY,CLI...
from experimentum.Storage.Migrations import Migration class AddTestcaseData(Migration): """Create the add_testcase_data migration.""" revision = '20190411131223' def up(self): """Run the migrations.""" with self.schema.table('testcases') as table: table.integer('value') ...
import os import multiprocessing from plugin import PluginInterface, PluginResult class Plugin(PluginInterface): def get_data(self): # 1 Minute load average adjusted by number of CPUs to give a percentage # adjusted by the number of CPUs in the system (avg, _, _) = os.getloadavg() p...
# Generated from UnitX.g4 by ANTLR 4.5.1 from antlr4 import * # This class defines a complete generic visitor for a parse tree produced by UnitXParser. class UnitXVisitor(ParseTreeVisitor): # Visit a parse tree produced by UnitXParser#program. def visitProgram(self, ctx): return self.visitChildren(ct...
import random from forward43.scraper import ForwardScraper from hparams import keywords class KickstarterScraper(ForwardScraper): def __init__(self, keywords, num_pages): ForwardScraper.__init__(self, 'kickstarter') self.base_url = 'https://www.kickstarter.com/discover/advanced.json?' ...
import contextlib from io import StringIO from pathlib import Path import sys from tests.mk import ( CmkTestCase, EmptyFileTests, stdin_as_string, patch, parameterized, skiptest, ) from csvmedkit.exceptions import * from csvmedkit.utils.csvslice import CSVSlice, launch_new_instance class Tes...
# Copyright 2021 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
# Repository: https://gitlab.com/quantify-os/quantify-scheduler # Licensed according to the LICENCE file on the master branch """Module containing the core concepts of the scheduler.""" from __future__ import annotations import logging import inspect import json import ast from abc import ABC from collections import U...
""" # Adapted from: Copyright 2016 United States Government as represented by the Administrator of the National Aeronautics and Space Administration. All Rights Reserved. Portion of this code is Copyright Geoscience Australia, Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file e...
import numpy as np from pandas import DataFrame, Timestamp, date_range import pandas._testing as tm class TestDataFrameValues: def test_values_duplicates(self): df = DataFrame( [[1, 2, "a", "b"], [1, 2, "a", "b"]], columns=["one", "one", "two", "two"] ) result = df.values ...
#!/usr/bin/python3 # Copyright (c) 2018 Bart Massey # [This program is licensed under the "MIT License"] # Please see the file LICENSE in the source distribution of # this software for license terms. # Solve a "Robot Tour" problem (Skiena, Algorithm Design # Manual [2nd ed], Chapter 1) by greedy closest pair # connec...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import gel.fields class Migration(migrations.Migration): dependencies = [ ('gel', '0006_manufacturer_brands'), ] operations = [ migrations.AddField( model_name='silicapac...
__author__ = "Lekan Molu" __maintainer__ = "Lekan Molu" __email__ = "patlekno@icloud.com" __status__ = "Completed" __all__ = ["addGhostExtrapolate"] import copy import logging import cupy as cp import numpy as np from LevelSetPy.Utilities import * logger = logging.getLogger(__name__) def addGhostExtrapolate(...
from . import api from application import db from flask import request, jsonify from application.helper.rest.request_query_helper import ( model_to_dict, model_to_dict_params ) from application.helper.rest.auth_helpler import ( required_token, get_user_data_from_request ) from application.models.user import U...
#!/usr/bin/python import picamera from pkg_resources import resource_filename import os import sys import threading from bottle import ( get, post, request, response, route, run, static_file, template, ) parent_dir = os.path.split(os.path.dirname(__file__))[-1] if dir == 'scripts': ...
import random from random import randint import time import asyncpg import asyncio import aiohttp from discord.ext import commands import discord from utils import checks MEMES = { "intellectual": "https://cdn.discordapp.com/attachments/386029171303776257/386379713431470081/unknown-2.png", "bestdad": "https://cdn....
import concurrent.futures import json import threading from typing import Tuple, Callable import _quickjs def test(): return _quickjs.test() Context = _quickjs.Context Object = _quickjs.Object JSException = _quickjs.JSException StackOverflow = _quickjs.StackOverflow class Function: # There are unit tests...
from gpanel import * coordinates(0, 0, 10, 10) @event def on_mouse_move(panel, x, y): print(panel, x, y)
# Math Algorithms # # Purpose: Calculating some convergent series # Language: Python # Author: José Cintra # Year: 2018 # Web Site: https://github.com/JoseCintra/MathAlgorithms # License: Unlicense, described in http://unlicense.org # Online demo: https://onlinegdb.com/SJ...
import tensorflow as tf import numpy as np import matplotlib.pyplot as plt def add_layer(inputs, insize, outsize, n_layer, activation_function=None): layer_name = 'layer%s' % n_layer # define layer name with tf.name_scope('layer'): # define weights name with tf.name_scope('Weights'): ...
import numpy as np from itca.utils import compute_y_dist EPS = 1e-15 def _check_consistency(y_ori, y_mer, transform): n_classes_ori = max(transform.keys()) + 1 n_classes_mer = max(transform.values()) + 1 assert (n_classes_mer <= n_classes_ori) assert (len(transform) == n_classes_ori) return n_cla...
# Default configs from .admin import * from .api_host import * from .celery_settings import * from .context_processors import * from .core import * from .email import * from .integrations import * from .logging import * from .oauth import * from .secrets import * from .redis_settings import * from .tracker import * fro...
# $Id$ # # Copyright (C) 2002-2006 greg Landrum and Rational Discovery LLC # # @@ All Rights Reserved @@ # This file is part of the RDKit. # 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 RDKit source tree. # """ unit testing code...
# coding:utf-8 from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver import Chrome, ChromeOptions import os import time # Chromeを起動する関数 def set_driver(driver_path, headless_flg): # Chromeドライバーの読み込み options = ChromeOptions() # ヘッドレスモード(画面非表示モード)をの設定 if ...
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from textwrap import dedent from pants.backend.jvm.register import build_file_aliases as register_jvm from pants.backend.project_info.tasks.depmap import Depmap from pants.backend.python....
from dvc.dependency.hdfs import HDFSDependency from tests.unit.dependency.test_local import TestLocalDependency class TestHDFSDependency(TestLocalDependency): def _get_cls(self): return HDFSDependency
# Copyright 2019-2021 ETH Zurich and the DaCe authors. All rights reserved. import copy import numpy as np import dace def test_call_multiple_sdfgs(): inparr = dace.float32[2, 2] axis = 1 out_tmp_shape = inparr.shape out_tmp_dtype = inparr.dtype tmp_max_shape = list(copy.deepcopy(inparr.shape)) ...
""" Crie uma tupla preenchida com os 20 primeiros colocaados da tabela do campeonato brasileiro de futebol, na ordem de colocação. depois mostre: A) apenas os 5 primeiros colocados B) Os últimos 4 colocados da tabela C) Uma lista com os times em ordem alfabetica. D Em que posição na tabela está o time da chapecoense. ...
import json def load_json(path, method="r"): with open(path, method, encoding='utf-8') as f: data = json.load(f) return data def write_json(path, data, method="w"): with open(path, method, encoding='utf-8') as f: json.dump(data, f, indent=4)
# -*- coding: utf-8 -*- # # 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...
#!/usr/bin/env python # Copyright 2014-2015 Boundary, 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 ...
import numpy as np import matplotlib.pyplot as plt import timeit import random import math def insertionSort(a): for i in range(1,len(a)): value = a[i] pos = i while (pos > 0 and value < a[pos-1]): a[pos] = a[pos-1] pos = pos-1 a[pos] = value def countingSort(a,max): m = max+1 co...
from rest_framework import routers from todo.views import TodoViewSet, TodoListViewSet router = routers.DefaultRouter() router.register('todos', TodoViewSet) router.register('todos-list', TodoListViewSet)
import tingbot from tingbot import * import pygame # setup code here screen.fill(color='black') screen.text('Press a key', color='red') @every(seconds=1.0/10) def loop(): # drawing code here if pygame.key.get_focused(): press=pygame.key.get_pressed() for i in xrange(0,len(press)): ...
#!/usr/bin/env python # -*- coding: utf-8 -*- import logging fully = True patch_size = 51 training_stride = 20 flatten = False def generate_nnet(feats): """Generate a neural network. Parameters ---------- feats : list with at least one feature vector Returns ------- Neural network obje...
""" Given a TensorFlow Savedmodel (1.x) and desired output nodes, create a TensorFlow.js model. """ import os import shutil import tensorflow as tf from tensorflow.python.tools.freeze_graph import freeze_graph from tensorflowjs.converters.tf_saved_model_conversion_v2 import convert_tf_frozen_model def freeze_savedmod...
from apetools.info.constants import TEMPLATE, BOLD, RESET, NAME_TEMPLATE, BLUE name = NAME_TEMPLATE.format(name="apetools", description="(nee' RFKill)").center(80) synopsis = """ The {bold}time-to-recover-test{reset} ({blue}ttr{reset}) characterizes the time a device's connection takes to ...
# -*- coding: utf-8 -*- import argparse import numpy as np import avocado import os import sys main_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "..")) sys.path.insert(0, main_path) from tqdm import tqdm import time from collections import defaultdict """ this script only work with plasticc_augment...
#!/usr/bin/env python """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 = [ ] test_requirements = [ ] setup( author="Marvin Tasche...
from math import * from fractions import * L = 10 a = [1, 0] b = [0, 1] for i in xrange(2, L): a.append((i-1) * a[i-2] + a[i-1]) b.append((i-1) * b[i-2] + b[i-1]) p = 1 for i in xrange(L): if i > 0: p *= b[i] print a[i], b[i], p
import sequence import ps sequence.font = ps.Courier(12) ps.put_header() p = sequence.Uml_sequence_page("NORMAL SUCCESSFUL WRITE") encp = p.add_class_role(sequence.Uml_class_role("Encp")) lm = p.add_class_role(sequence.Uml_class_role("LibMan")) mover = p.add_class_role(sequence.Uml_class_role("Mover")) mc ...
# Copyright 2021 Rafał Safin (rafsaf). 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 applicabl...
#Types. from typing import Dict, List, IO, Any #BLS lib. from e2e.Libs.BLS import PrivateKey #Merit classes. from e2e.Classes.Merit.BlockHeader import BlockHeader from e2e.Classes.Merit.BlockBody import BlockBody from e2e.Classes.Merit.Block import Block from e2e.Classes.Merit.Blockchain import Blockchain #Blake2b s...
# Generated by Django 2.1.2 on 2018-11-09 20:09 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('assets', '0001_initial'), ] operations = [ migrations.AlterField( model_name='cuci', name='chapter_name_en', ...
""" @copyright: Copyright (C) Mellanox Technologies Ltd. 2014-2020. ALL RIGHTS RESERVED. This software product is a proprietary product of Mellanox Technologies Ltd. (the "Company") and all right, title, and interest in and to the software product, including all associated intellectual property rights...
from keycloak import KeycloakOpenID import token_service.main.client_credentials_handler as handler from token_service.test.test_data import ( keycloak_authorized_response, create_client_token_event, ok_response, keycloak_auth_error, unauthorized_response, http_event_invalid_body, bad_requ...
# -*- coding: utf-8 -*- """ Milestone 2: Simulation of a CE economy Course: Advanced Public Finance by Prof. Hendrik Rommerswil Date: 10. April Authors: David Biasi Description: The following code simulates a CE economy. It uses as an input The output is Analytical backgroun...
import numpy as np import cv2 import pyautogui from PIL import Image import pytesseract import pyttsx3 import win32api import time # ----------------------- # BOARD IS CALIBRATED FOR 1920 X 1080 WINDOW SIZE # ---------------------- # Board Position start_position = (362, 208) end_position = (0, 0) # Board Tile Size ...
"""http://projecteuler.net/problem=033 Digit canceling fractions The fraction 49/98 is a curious fraction, as an inexperienced mathematician in attempting to simplify it may incorrectly believe that 49/98 = 4/8, which is correct, is obtained by cancelling the 9s. We shall consider fractions like, 30/50 = 3/5, to be t...
class ContinuousMarginalDistribution(): """ Superclass for 1d continuous distributions """ def __init__(self, name, dist_type): self.name = name self.type = dist_type def __str__(self): """ What to show when the object is printed """ return '{} DESCRIPTI...
class IncompatibleAdapterException(Exception): pass
import pytorch_lightning as pl from argparse import ArgumentParser from src.data.load_data import load_dataset, create_dataloader from src.models.model_pl import BERT_Model from variables import PROJECT_PATH if __name__ == '__main__': # Define parser parser = ArgumentParser() # Add PROGRAM level args (No...
# -*- coding: utf-8 -*- # Generated by Django 1.10 on 2017-11-23 11:30 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('users_messages', '0005_comment_message_id'), ] operations = [ migrations.Alte...
import json import stackeddag.core as sd def fromMXNET(json_file): f = open(json_file, 'r') json_dict = json.load(f) la = [] for i in json_dict['nodes']: la.append((i, json_dict['nodes'][i]['name'])) ed = [] for i in json_dict['nodes']: for j in json_dict['nodes'][i]['inputs']: ...
import asyncio import socket from mock import AsyncMock, MagicMock, Mock, patch import pytest from aioesphomeapi.api_pb2 import ConnectResponse, HelloResponse from aioesphomeapi.connection import APIConnection, ConnectionParams from aioesphomeapi.core import APIConnectionError from aioesphomeapi.host_resolver import ...
""" ============================================================================== Program: TestDataFix.py Author: Kyle Reese Almryde Date: Description: ============================================================================== """ import unittest from dataFix import * class TestDataFix(unittest.TestCas...
import ast import codecs import re from os import path from setuptools import find_packages, setup # parts below shamelessly stolen from pypa/pip here = path.abspath(path.dirname(__file__)) def read(*parts): with codecs.open(path.join(here, *parts), 'r') as fp: return fp.read() _version_re = re.compil...
import json import re from jsonc_parser.errors import FileError, FunctionParameterError, ParserError import os from typing import Union class JsoncParser: # regex = re.compile(r"//.*?\n|/\*.*?\*/", re.MULTILINE | re.DOTALL) regex = re.compile(r"(\".*?\"|\'.*?\')|(/\*.*?\*/|//[^\r\n]*$)", re.MULTILINE | re.DO...
from ..methods.transaction import Transaction as NodeTransaction from ..models import Transaction, Block from ..services import TransactionService from webargs.flaskparser import use_args from ..services import AddressService from ..services import OutputService from ..services import BlockService from ..services impor...
# %% [300. **Longest Increasing Subsequence](https://leetcode.com/problems/longest-increasing-subsequence/) # 問題:単調増加する部分リストの最大長を求めよ # 解法:nums[i]を最後の要素とする最大長をdp[i]として計算する class Solution: def lengthOfLIS(self, nums: List[int]) -> int: dp = [] for num in nums: mx = max([d if n < num else 0...