text
stringlengths
2
999k
""" Tests for functions in class SolveDiffusion2D """ import numpy as np #import pytest from diffusion2d import SolveDiffusion2D from unittest import TestCase class TestOperations(TestCase): """ Test suite for mathematical operations functions. """ def setUp(self): # Fixture self.w = ...
#!/usr/bin/env python # # Author: Qiming Sun <osirpt.sun@gmail.com> # ''' Access AO integrals Mole.intor and Mole.intor_by_shell functions can generate AO integrals. Calling Mole.intor with the integral function name returns a integral matrix for all basis functions defined in Mole. If the integral operator has many...
from setuptools import setup, find_packages from distutils.extension import Extension import numpy as np import cython_gsl import versioneer def read_requirements(): import os path = os.path.dirname(os.path.abspath(__file__)) requirements_file = os.path.join(path, 'requirements.txt') try: wi...
# -*- coding: utf-8 -*- # Generated by Django 1.10 on 2017-03-17 03:31 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Semester...
import pickle # ============================================================================= # EL MÉTODO __str__ NO PERMITE IMPRIMIR LA INFO DEL OBJETO COMO STRING, YA QUE # DE LO CONTRARIO EL MÉTODO showp() MOSTRARÍA LOS OBJETOS CREADOS EN MEMORIA # PERO NO SU INFO: (<__main__.People object at 0x00000218F088B...
# Trie Tree Node from typing import Optional class TrieNode: def __init__(self, char: Optional[str] = None): self.char = char self.children = [] self.counter = 0 self.end = False def add(self, word: str): node = self for char in word: found_in_child...
from moto.ec2.utils import add_tag_specification from ._base_response import EC2BaseResponse class ElasticIPAddresses(EC2BaseResponse): def allocate_address(self): domain = self._get_param("Domain", if_none="standard") reallocate_address = self._get_param("Address", if_none=None) tags = se...
#!/usr/bin/python """ HeaderID Extension for Python-Markdown ====================================== Adds ability to set HTML IDs for headers. Basic usage: >>> import markdown >>> text = "# Some Header # {#some_id}" >>> md = markdown.markdown(text, ['headerid']) >>> md u'<h1 id="some_id">Some Hea...
# Copyright (C) 2016-2018 Alibaba Group Holding 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 License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
# -------------------------------------------------------- # Written by: Romuald FOTSO # Licensed: MIT License # Copyright (c) 2017 # Based on 'dandxy89' github repository: # https://github.com/dandxy89/ImageModels/blob/master/KerasLayers/Custom_layers.py # -------------------------------------------------------- from ...
from .timer import Timer from .simple import Counter from .heartbeat import HeartBeat from .collector import Collector
# Copyright (c) 2020, Manfred Moitzi # License: MIT License from pathlib import Path from time import perf_counter import ezdxf from ezdxf.render.forms import sphere from ezdxf.addons import MengerSponge from ezdxf.addons.pycsg import CSG DIR = Path('~/Desktop/Outbox').expanduser() doc = ezdxf.new() doc.layers.new('...
from __future__ import division import six import keras from keras.models import Model from keras.layers import ( Input, Activation, Dense, Flatten ) from keras.layers import Conv2D, MaxPooling2D, AveragePooling2D from keras.layers import add from keras.layers import BatchNormalization from keras.regul...
import math class CustomType(type): def __new__(mcls, name, bases, class_dict): print(f'Using custom metaclass {mcls} to create class {name}...') cls_obj = super().__new__(mcls, name, bases, class_dict) cls_obj.circ = lambda self: 2 * math.pi * self.r return cls_obj class Circle(m...
from time import sleep import numpy as np import matplotlib.pyplot as plt def get_initial_state(size): return np.random.choice([0, 1], size) def compute_next_state(state): new_state = np.zeros(state.shape, dtype=int) for i in range(state.shape[0]): for j in range(state.shape[1]): low...
import datetime import re from unittest import mock from django import forms from django.contrib.auth.forms import ( AdminPasswordChangeForm, AuthenticationForm, PasswordChangeForm, PasswordResetForm, ReadOnlyPasswordHashField, ReadOnlyPasswordHashWidget, SetPasswordForm, UserChangeForm, UserCreationForm, ...
# encoding=utf8 # pylint: disable=anomalous-backslash-in-string, old-style-class import math __all__ = ['ChungReynolds'] class ChungReynolds: r"""Implementation of Chung Reynolds functions. Date: 2018 Authors: Lucija Brezočnik License: MIT Function: **Chung Reynolds function** :math:...
# 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
class Device: def __init__(self, id=None, token=None, platform=None, endpoint=None, created_at=None, updated_at=None): self.id = id self.token = token self.platform = platform self.endpoint = endpoint self.created_at = created_at self.updated_at = updated_at
from distutils.version import LooseVersion import os import importlib import logging import sys from django.core.management.base import BaseCommand from django.utils.version import get_version from django_rq.queues import get_queues from django_rq.workers import get_exception_handlers from redis.exceptions import Co...
import torch import argparse # ----- Parser ----- def parser(): PARSER = argparse.ArgumentParser(description='Training parameters.') # Dataset PARSER.add_argument('--dataset', default='CIFAR10', type=str, choices=['CIFAR10', 'CelebA', 'Imagenette', 'ImageNet32', 'ImageNet64'], ...
# Copyright 2017 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 json import sys from dashboard.common import testing_common from dashboard.common import utils from dashboard.models import histogram from tracing.va...
""" Django settings for mysite project. Generated by 'django-admin startproject' using Django 2.0.5. For more information on this file, see https://docs.djangoproject.com/en/2.0/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/2.0/ref/settings/ """ i...
"""Provide functions for filtering.""" from .stats_filter import stats_filter from .topology_filter import topology_filter from .run_filters import run_filters
#===----------------------------------------------------------------------===## # # Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. # See https://llvm.org/LICENSE.txt for license information. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception # #===----------------------------------...
import pandas as pd import numpy as np from sklearn.preprocessing import StandardScaler from DataUtility import get_column_names class LiPolymerDataScaler: """ a special class to scale the lithium polymer database """ def __init__(self): self.scaling_dict = {} self.main_val_params = [...
def test_func(i): print(i) if i>10: return else: test_func(i+1) if __name__ == "__main__": test_func(2)
""" Format String 2D array 2d array for compositing term-formated strings -autoexpanding vertically -interesting get_item behavior (renders fmtstrs) -caching behavior eventually >>> a = FSArray(10, 14) >>> a.shape (10, 14) >>> a[1] = 'i' >>> a[3:4, :] = ['i' * 14] >>> a[16:17, :] = ['j' * 14] >>> a.shape, a[16, 0] ...
import heapq # Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def mergeKLists(self, lists: List[ListNode]) -> ListNode: heap = [] root = res = ListNode(None) for i in range...
# Copyright 2020 - 2021 MONAI Consortium # 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 wri...
# -*- coding: utf- """ wsgi.py :Created: 12 Jun 2014 :Author: tim """ from spyne.server.wsgi import WsgiApplication as _SpyneWsgiApplication from spyne_smev.server import _AllYourInterfaceDocuments class WsgiApplication(_SpyneWsgiApplication): def __init__(self, app, c...
class Node: def __init__(self, next: int): self.next = next self.up = False def MakeNodes(data: str): values = [int(ch) - 1 for ch in data] nodes = [] for value in range(len(values)): index = values.index(value) next = values[(index + 1) % len(values)] no...
# coding: utf-8 from __future__ import unicode_literals import re from ..compat import compat_str from ..utils import int_or_none, str_or_none, try_get from .common import InfoExtractor class PalcoMP3BaseIE(InfoExtractor): _GQL_QUERY_TMPL = """{ artist(slug: "%s") { %s } }""" _ARTIST_FIELDS_TMPL = "...
# 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. """ Data and labels file for various datasets. """ import json import logging import os from typing import List import numpy as np from fvcor...
''' Created on Nov 20, 2019 @author: Melody Griesen ''' if __name__ == '__main__': pass
import sys import os from datetime import datetime from pyspark import SparkConf, SparkContext from pyspark.sql import SparkSession from pyspark.sql.types import (StructType, StructField as Fld, DoubleType as Dbl, IntegerType as Int, DateType as Date, Boolea...
#!/usr/bin/env python3 """ Generates Pulr "pull" config section from JSON, created with fetch-tags.py """ import sys import argparse from textwrap import dedent try: import rapidjson as json except: import json import yaml DEFAULT_FREQ = 1 DEFAULT_PATH = '1,0' DEFAULT_CPU = 'LGX' DEFAULT_TIMEOUT = 2 def ...
#!/usr/bin/python # -*- coding: utf-8 -*- import json import os import sys import os.path import re from pprint import pprint from subprocess import Popen, PIPE readme = open('README.md', 'w') readme.write("# Free Hack Quest 2016\n") def getListOfDirsWithTasks(): result = [] dirs = os.listdir('./'); for d in di...
import sys import click import json from urllib.request import urlopen from urllib.parse import quote RESPONSES_CODE = { 200 : "SMS sent", 400 : "One parameter is missing (identifier, password or message).", 402 : "Too many SMS sent.", 403 : "Service not activated or false login/key.", 500 : "Serv...
import os from tqdm import tqdm # dataset = [['Bike','NYC','all','365','sum','0.1'],['DiDi','Xian','all','all','sum','0.1'], # ['Metro','Chongqing','all','all','sum','0.1'],['ChargeStation','Beijing','all','all','max','0.1'], # ['METR','LA','all','all','average','0.2'],['PEMS','BAY','all','all','average','0.2']] datase...
import cv2 import sys import pyglet cascade_path = sys.argv[1] classifier = cv2.CascadeClassifier(cascade_path) # https://realpython.com/blog/python/face-detection-in-python-using-a-webcam/ video_capture = cv2.VideoCapture(0) # Scale the video down to size so as not to break performance video_capture.set(cv2.cv.CV_C...
# Copyright 2012 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2012 Nebula, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the...
class handler(): def __init__(self): self.greeting = "Hello World" def __repr__(self): return self.greeting if __name__ == "__main__": pass
#!/usr/bin/env python from gimpfu import * from gimpenums import * import sys import os def color2id(color): a = (color[0]<<16) | (color[1]<<8) | color[2] b = (a & 0xF00000) >> 12 | (a & 0xF000) >> 8 | (a & 0xF00) << 4 | \ (a & 0xF0) >> 4 c = (b & 0xF000) | (b & 0x800) >> 11 | (b & 0x400) >> 7 | \ ...
# GENERATED BY KOMAND SDK - DO NOT EDIT import komand import json class Input: FORCE = "force" ID = "id" LINK = "link" V = "v" class Output: SUCCESS = "success" class ContainerRemoveInput(komand.Input): schema = json.loads(""" { "type": "object", "title": "Variables", "pro...
import functools import numpy as np import math import types import warnings # trapz is a public function for scipy.integrate, # even though it's actually a NumPy function. from numpy import trapz from scipy.special import roots_legendre from scipy.special import gammaln __all__ = ['fixed_quad', 'quadrature', 'romber...
from abc import abstractmethod, ABCMeta from indy_common.authorize.auth_actions import split_action_id from indy_common.authorize.auth_constraints import AbstractAuthConstraint, AbstractConstraintSerializer from indy_common.state import config from plenum.common.metrics_collector import MetricsName, MetricsCollector f...
"""Validate some things around restore.""" from __future__ import annotations from typing import Any import voluptuous as vol from ..backups.const import BackupType from ..const import ( ATTR_ADDONS, ATTR_COMPRESSED, ATTR_CRYPTO, ATTR_DATE, ATTR_DOCKER, ATTR_FOLDERS, ATTR_HOMEASSISTANT, ...
import heapq from typing import Iterable class HeapQueue: def __init__(self, init_h: Iterable): self.h = [(-val, index) for index, val in init_h] heapq.heapify(self.h) def replace_largest(self, new_val): heapq.heapreplace(self.h, (-new_val, self.max_index)) def pop(self): ...
## ## # File auto-generated against equivalent DynamicSerialize Java class class LockChangeRequest(object): def __init__(self): self.requests = None self.workstationID = None self.siteID = None def getRequests(self): return self.requests def setRequests(self, requests): ...
import os from xua import helpers from xua.constants import CLI, BUILD from xua.exceptions import UserError from xua.builders.doc import htmlOld def getBuildEngine(project, config): if project == CLI.PROJECT_SERVER_PHP: # @TODO return None elif project == CLI.PROJECT_MARSHAL_DART: # @T...
from random import shuffle import time import logger from couchbase_helper.cluster import Cluster from membase.api.exception import StatsUnavailableException, \ ServerAlreadyJoinedException, RebalanceFailedException, \ FailoverFailedException, InvalidArgumentException, ServerSelfJoinException, \ AddNodeExce...
""" HTML5 Push Messaging notification service. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/notify.html5/ """ import datetime import json import logging import time import uuid from aiohttp.hdrs import AUTHORIZATION import voluptuous as vol from volup...
from django.urls import path from mysit.views import * app_name = 'mysit' urlpatterns = [ path('',index_views, name='index'), path('about',about_views, name='about'), path('contact',contact_views, name='contact'), path('gallery',gallery_views, name='gallery'), path('menu',menu_views, name='menu')...
#!/usr/bin/env python3 import rclpy from rclpy.node import Node from std_msgs.msg import Int64 class NumberPublisher(Node): def __init__(self): super().__init__('number_publisher') self.publisher_ = self.create_publisher(Int64, 'numbers', 10) timer_period = 0.5 # seconds self.ti...
from functools import partial import click from odc import dscache from odc.dscache.tools.tiling import ( bin_by_native_tile, web_gs, extract_native_albers_tile, parse_gridspec) from odc.dscache._dscache import mk_group_name from odc.index import bin_dataset_stream @click.command('dstiler') @click.op...
#!/usr/bin/env python # -*- coding: utf-8 -*- import pygame from pygame.locals import * import codecs import os import random import struct import sys SCR_RECT = Rect(0, 0, 640, 480) GS = 32 DOWN,LEFT,RIGHT,UP = 0,1,2,3 STOP, MOVE = 0, 1 # 移動タイプ PROB_MOVE = 0.005 # 移動確率 TRANS_COLOR = (190,179,145) # マップチップの透明色 sou...
# Date: 09/28/2017 # Author: Ethical-H4CK3R # Description: A Simple C&C Server from core.prompt import Prompt from core.server import Server from template.design import Designer from core.console import MainController from core.communicate import Communicate __version__ = 0.1 class Flex(Prompt, Server, Designer, Mai...
import os from flask import Flask, flash, render_template, request from helpers import * app = Flask(__name__) app.secret_key = 'dkjkffksks' @app.route('/', methods=["GET", "POST"]) def index(): """Index page""" if request.method == "POST": msg = request.form.get("textarea") img = request.form.get("output_imag...
# -*- coding: utf-8 -*- # # ownCloud Documentation documentation build configuration file, created by # sphinx-quickstart on Mon Oct 22 23:16:40 2012. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this # autogenerate...
from azure.cosmosdb.table.tableservice import TableService from azure.cosmosdb.table.models import Entity import uuid class PhotoCollectionAzureTable: _connectionstring = '' def __init__(self, connectionstring): self._connectionstring = connectionstring def fetchall(self): table_service ...
from blocktorch.data_checks import DataCheckAction, DataCheckActionCode def test_data_check_action_attributes(): data_check_action = DataCheckAction(DataCheckActionCode.DROP_COL) assert data_check_action.action_code == DataCheckActionCode.DROP_COL assert data_check_action.metadata == {} data_check_ac...
# -------------------------------------------------------- # Fast R-CNN # Copyright (c) 2015 Microsoft # Licensed under The MIT License [see LICENSE for details] # Written by Ross Girshick # -------------------------------------------------------- """The data layer used during training to train a DA Fast R-CNN network...
# -*- coding: utf-8 -*- import codecs import io import os import sys import unittest import pytest import pdfgen from pdfgen.errors import InvalidSourceError TEST_PATH = os.path.dirname(os.path.realpath(__file__)) EXAMPLE_HTML_FILE = f'{TEST_PATH}/fixtures/example.html' class TestPdfGenerationSyncApi(unittest.TestC...
import FWCore.ParameterSet.Config as cms process = cms.Process("PROD") process.load('SimG4CMS.HcalTestBeam.TB2006Geometry33XML_cfi') process.load('SimGeneral.HepPDTESSource.pdt_cfi') process.load('Configuration.StandardSequences.Services_cff') process.load('FWCore.MessageService.MessageLogger_cfi') process.load("Geom...
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Deleting field 'Comment.reply_text' db.delete_column(u'canvas_comment', 'reply_text') def backwards(...
# -*- coding: utf-8 -*- from django.conf.urls import patterns, url urlpatterns = patterns('', # Examples: # url(r'^$', 'povary.views.home', name='home'), # url(r'^povary/', include('povary.foo.urls')), url(r'^recipe_gallery/(?P<recipe_slug>.*)/$', 'gallery.views.recipe_gallery_upload', name='recipe_...
# coding: utf-8 """ Isilon SDK Isilon SDK - Language bindings for the OneFS API # noqa: E501 OpenAPI spec version: 10 Contact: sdk@isilon.com Generated by: https://github.com/swagger-api/swagger-codegen.git """ import pprint import re # noqa: F401 import six from isi_sdk_9_0_0.models.hdfs_f...
#!/usr/bin/env python __all__ = ['universal_download'] from ..common import * from .embed import * def universal_download(url, output_dir='.', merge=True, info_only=False, **kwargs): try: content_type = get_head(url, headers=fake_headers)['Content-Type'] except: content_type = get_head(url, h...
# coding=utf-8 import pandas as pd from pathlib import Path # extract corpus to seprate files OUT_PUT_DIR = r'D:\data\edgar\example\documents' df = pd.read_csv(r'D:\data\edgar\example\corpus.csv') # def write_to_file(cik,filingId,fileName,content): def write_to_file(cik,filingId,fileName,content): base_dir = Path(...
# Copyright 2013-2019 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) from spack import * class RAdsplit(RPackage): """This package implements clustering of microarray gene expression ...
class Group: """ name: Name of group (String) deposit: $ Amount required to book the group (Float) type: Speedball, Recball, Rental (String) players: ([Object]) paint_bags: list of paint the group has purchased ([Int]) transactions: ([Object]) """ def __init__(self, name, ...
from __future__ import division, print_function import numpy as np import multiprocessing from tools import _pickle_method, _unpickle_method try: import copy_reg except: import copyreg as copy_reg import types copy_reg.pickle(types.MethodType, _pickle_method, _unpickle_method) class GeneticAlgorithm(object): ...
#!/usr/bin/env python # coding: utf8 # # Copyright (c) 2020 Centre National d'Etudes Spatiales (CNES). # # This file is part of PANDORA # # https://github.com/CNES/Pandora # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may...
import datetime import json import os import boto3 import pandas as pd import io import requests import numpy as np from io import StringIO import uuid s3 = boto3.resource( service_name='s3', region_name='us-east-2') bucket_name = 'secom-daas-bucket' # already created on S3 link1 = 'https://archive.ics.uci....
# --- # jupyter: # jupytext: # formats: ipynb,py:light # text_representation: # extension: .py # format_name: light # format_version: '1.5' # jupytext_version: 1.4.2 # kernelspec: # display_name: Python 3 # language: python # name: python3 # --- # # Check alignments # Ch...
# Copyright The PyTorch Lightning team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
# Copyright (C) 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, ...
# -*-coding:utf-8-*- from flask import Flask __author__ = 'ZeroLoo'
import http.client import urllib.request, urllib.parse, urllib.error import urllib.request, urllib.error, urllib.parse import re import csv from http.cookiejar import CookieJar class pyGTrends(object): """ Google Trends API Recommended usage: from csv import DictReader r = pyGTrends(us...
import platform, sys, os, subprocess import psutil from app.api.models.LXDModule import LXDModule import logging def readInstanceDetails(): instanceDetails = ("Python Version: {}".format(platform.python_version())) instanceDetails +=("\nPython Path: {}".format(' '.join(path for path in sys.path))) instanc...
import json filename = "num_predileto.txt" try: numero = int(input("Qual o seu numero predileto? ")) except ValueError: print("Você digitou um valor incorreto.") else: with open(filename, "w") as f: json.dump(numero, f)
#AUTOGENERATED! DO NOT EDIT! File to edit: dev/07_data.block.ipynb (unless otherwise specified). __all__ = ['TransformBlock', 'CategoryBlock', 'MultiCategoryBlock', 'DataBlock'] #Cell from ..torch_basics import * from ..test import * from .core import * from .load import * from .external import * from .transforms imp...
#!/usr/bin/env python # -*- coding: utf-8 -*- import setuptools with open('README.md', 'r') as fp: long_description = fp.read() pos = long_description.find('# Development') if pos > -1: long_description = long_description[:pos] setuptools.setup( name='qri', version='0.1.5', author='Du...
def test_something(): assert 1 == 1
from slick_reporting.views import SampleReportView from .models import OrderLine class MonthlyProductSales(SampleReportView): report_model = OrderLine date_field = 'date_placed' # or 'order__date_placed' group_by = 'product' columns = ['name', 'sku'] time_series_pattern = 'monthly' time_serie...
#!/usr/bin/env python3 """ Synopsis: utilities/generate_schema.py > lib/schema.py This routine pulls the current table definitions from the csv2 database and writes the schema to stdout. To use the schema definitions: from lib.schema import <view_or_table_name_1>, <view_or_table_name_2>, ... """ from sub...
import string import torch from torch.nn import CrossEntropyLoss from torch.nn import CTCLoss import torch.optim as optim from torch.utils.tensorboard import SummaryWriter from torchsummary import summary from tqdm import tqdm from cnn_seq2seq import ConvSeq2Seq from cnn_seq2seq import Decoder from cnn_seq2seq import...
import os import pytest import yaml from tests import AsyncMock from asyncio import Future from app.utility.file_decryptor import decrypt @pytest.mark.usefixtures( 'init_base_world' ) class TestFileService: def test_save_file(self, loop, file_svc, tmp_path): filename = "test_file.txt" paylo...
#!/usr/bin/env python2 # -*- coding: utf-8 -*- # # cbc_decode.py # # Programma minimale per l'applicazione di un cifrario # a blocchi su un messaggio, in modalità CBC (Chained Block Cypher) # in cui ogni blocco viene messo in OR esclusivo con il codice # del blocco precedente prima di essere cifrato. # # Nel nostro cas...
import asyncio from typing import TYPE_CHECKING from uvicorn.config import Config if TYPE_CHECKING: # pragma: no cover from uvicorn.server import ServerState async def handle_http( reader: asyncio.StreamReader, writer: asyncio.StreamWriter, server_state: "ServerState", config: Config, ) -> None...
"""Test for the appeaser strategy.""" import axelrod from .test_player import TestPlayer C, D = axelrod.Actions.C, axelrod.Actions.D class TestAppeaser(TestPlayer): name = "Appeaser" player = axelrod.Appeaser expected_classifier = { 'memory_depth': float('inf'), # Depends on internal memory. ...
#!/usr/bin/env python import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns # Custom style plt.style.use('scientific') # absolute tolerances for chimera absolutes = np.array([0.67, 1080000, 0.2, 0.15848931924611134]) # load in gryffin runs with Naive score as objective df_nai...
from src.json2df import PubChemBioAssayJsonConverter c = PubChemBioAssayJsonConverter("./examples", "PUBCHEM400.json") df = c.get_all_results() c.save_df(df, "./examples") c.get_description("./examples")
## code simplified from the dca package import os import numpy as np import scanpy.api as sc import keras from keras.layers import Input, Dense, Dropout, Activation, BatchNormalization from keras.models import Model from keras.objectives import mean_squared_error from keras import backend as K import tensorflow as t...
from flask_wtf import FlaskForm from wtforms import ( StringField, PasswordField, SubmitField, SelectMultipleField, BooleanField, ) try: from wtforms.fields import EmailField except ImportError: from wtforms.fields.html5 import EmailField from wtforms.validators import DataRequired, Length,...
from collections import namedtuple from .api import APIItems # Represents a CIE 1931 XY coordinate pair. XYPoint = namedtuple("XYPoint", ["x", "y"]) # Represents the Gamut of a light. GamutType = namedtuple("GamutType", ["red", "green", "blue"]) class Lights(APIItems): """Represents Hue Lights. https://d...
import app gameApp = app.app() gameApp.Run()
# Copyright 2019-2020 The Lux Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed...
""" Module: 'flowlib.m5mqtt' on M5 FlowUI v1.4.0-beta """ # MCU: (sysname='esp32', nodename='esp32', release='1.11.0', version='v1.11-284-g5d8e1c867 on 2019-08-30', machine='ESP32 module with ESP32') # Stubber: 1.3.1 - updated from typing import Any class M5mqtt: """""" def _daemonTask(self, *argv) -> Any: ...