content
stringlengths
5
1.05M
# from .test_api import * # from .test_data import *
# -*- coding: utf-8 -*- from __future__ import print_function, division, absolute_import, unicode_literals from fontTools.misc.py23 import * from fontTools.misc import sstruct from fontTools.misc.xmlWriter import XMLWriter from fontTools.misc.loggingTools import CapturingLogHandler import struct import unittest from fo...
import numpy as np import pandas as pd import multiprocessing from multiprocessing import Pool from datetime import date def construct_OD(process_name, from_ind, to_ind, bart_data, stop_table, bart_OD): print('Start process' + process_name) for i in bart_data.index[from_ind:to_ind]: # [from_ind,...
from roblib import * def draw_crank(x): θ1=x[0,0] θ2=x[1,0] z=L1*array([[cos(θ1)],[sin(θ1)]]) y=z+L2*array([[cos(θ1+θ2)],[sin(θ1+θ2)]]) plot( [0,z[0,0],y[0,0]],[0,z[1,0],y[1,0]],'magenta', linewidth = 2) draw_disk(c,r,ax,"cyan") L1,L2 = 4,3 c = array([[1],[2]]) r=4 dt = 0.05 ...
#-------------------------------- # Name: et_numpy.py # Purpose: NumPy ET functions #-------------------------------- # import logging import math import numpy as np try: import et_common import et_image import et_numpy import python_common as dripy except ModuleNotFoundError: import...
from PyQt5 import QtCore, QtGui, QtWidgets class InstaLog(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(960, 540) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontal...
# -*- coding: utf-8 -*- # Generated by Django 1.9.7 on 2016-07-18 14:12 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('numbas_lti', '0015_attempt_deleted'), ] operations = [ migrations.AddField( ...
#!/usr/bin/env python import serial import signal import sys import time import re import config as cfg import os # Pretty print for debug messages from debug_message import DebugMessage dm = DebugMessage(enable_logging=True) is_running = True def signal_handler(*args): dm.print_warning("SIGINT detected, closing...
import os import random import string from configparser import ConfigParser import netifaces from scale.logger import create_logger from scale.network.node import Node class VPNManager: def __init__(self, config): self.logger = create_logger('VPN') self.config = config self.nodes: list[N...
import re import htmlgenerator as hg from django import forms from django.contrib.auth.decorators import user_passes_test from django.utils.translation import gettext_lazy as _ from django_celery_results.models import TaskResult from bread import layout from bread.layout import admin from bread.layout.components.data...
# IMPORTATION STANDARD from datetime import datetime # IMPORTATION THIRDPARTY import pytest # IMPORTATION INTERNAL from openbb_terminal.stocks.screener import yahoofinance_view @pytest.fixture(scope="module") def vcr_config(): return { "filter_headers": [("User-Agent", None)], "filter_query_para...
#!/usr/bin/env python from setuptools import setup setup( entry_points=""" [nose.plugins] pylons = pylons.test:PylonsPlugin """ )
from ..utils import Object class AuthenticationCodeTypeSms(Object): """ An authentication code is delivered via an SMS message to the specified phone number Attributes: ID (:obj:`str`): ``AuthenticationCodeTypeSms`` Args: length (:obj:`int`): Length of the code Re...
class StoreRequest(object): def __init__(self): self.op = None self.records = None self.filename = None def getOp(self): return self.op def setOp(self, op): self.op = op def getRecords(self): return self.records def setRecords(self, records): ...
from .. import db import datetime class AttemptsModel(db.Model): """ [summary] Args: AttemptsMixin ([type]): [description] db ([type]): [description] """ __tablename__ = 'attempts' id = db.Column(db.Integer, primary_key=True) max_score = db.Column(db.Integer, nullable=Fal...
#!/usr/bin/env python """ _SiblingSubscriptionsComplete_ MySQL implementation of Subscription.SiblingSubscriptionsComplete """ from WMCore.Database.DBFormatter import DBFormatter class SiblingSubscriptionsComplete(DBFormatter): """ For each file in the input fileset count the number of subscriptions (on...
import pytest from lstchain.io import EventSelector, DL3FixedCuts, DataBinning import numpy as np import pandas as pd from astropy.table import QTable import astropy.units as u def test_event_selection(): evt_fil = EventSelector() data_t = QTable( { "a": u.Quantity([1, 2, 3], unit=u.kg), ...
import numpy as np from random import random from math import log, ceil from time import time, ctime class Hyperband: def __init__(self, data, get_params_function, try_params_function, max_iter=81): self.data = data self.get_params = get_params_function self.try_params = try_params_functi...
from contextlib import contextmanager from pathlib import Path from typing import IO, Any, Iterator, List, Optional, Tuple, Union, cast from .gettable import Gettable from .padded_text_file import SplittedPaddedTextFile class ColumnNotFoundError(Exception): pass class _PaddedCSVFile(Gettable): """Represent...
load("//bazel/rules/cpp:main.bzl", "cpp_main") load("@rules_pkg//:pkg.bzl", "pkg_deb", "pkg_tar") load("//bazel/rules/data:package_data.bzl", "package_data") def distributable_data(name, description, file_groups): EVERYTHING_EXTENSION = "-debian-all" MAINTAINER = "Trevor Hickey <[email protected]>" ...
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from pytext.exporters.exporter import ModelExporter __all__ = ["ModelExporter"]
from tzlocal import get_localzone def add_local_tz(date): ''' Add the local time zone to the given date and returns a new date. Parameters ---------- date : :obj:`datetime` Date to which to adjust with the local time zone. Returns ------- :obj:`datetime` Date ...
# # Copyright (c) 2019-2020, NVIDIA CORPORATION. # Copyright (c) 2019-2020, BlazingSQL, 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...
def format_date(date): """format the date of blog to correct format""" date = date.strftime('%H:%M:%S %m/%d/%Y') return date
import pandas as pd from datetime import datetime, timedelta class JHUData(object): url_pattern = ( "https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/" "csse_covid_19_data/csse_covid_19_time_series/time_series_19-covid-{}.csv" ) def __init__(self, refresh_rate=30): ...
# -*- coding: utf-8 -*- # Copyright (C) 2010-2015 Mag. Christian Tanzer All rights reserved # Glasauergasse 32, A--1130 Wien, Austria. [email protected] # **************************************************************************** # This module is part of the package GTW.__test__. # # This module is licensed under th...
from typing import List import json from time import sleep from datetime import date from os import path from api import BilibiliApi from writer import write_md, write_raw_data BASE_PATH = './archive' NAP_TIME = .5 def generate_md(raw_data: BilibiliApi.RAW_DATA_T) -> str: res = [] for video in raw_data: ...
class Source: def __init__ (self,category,id,name,description,url): self.category = category self.id = id self.name = name self.description = description self.url = url
from gpbasics import global_parameters as global_param global_param.ensure_init() import tensorflow as tf from enum import Enum class SimilarityType(Enum): LINEAR = 0 SQRT_LINEAR = 1 LOG_LINEAR = 2 RECIPROCAL = 3 def get_similarity_based_distance(distance, similarity_type: SimilarityType): if ...
import sys,shutil,os,glob,re use_comma_separated_values = False def summarizeLoRaD(model): lc_model = model.lower() # set default values in case there are no results yet for this analysis rnseed = 0 cov1 = 0.0 logL1 = 0.0 cov2 = 0.0 logL2 = 0.0 cov3 = 0.0 l...
import copy from django import forms from django.contrib.admin.options import BaseModelAdmin from django.contrib.admin.widgets import AutocompleteSelect, AutocompleteSelectMultiple from django.db import models from django.utils.translation import gettext as _ from paper_admin.admin import widgets from paper_admin.mon...
#!/usr/bin/python with open("/dev/axis_fifo_0x0000000080002000", "r+b") as character: writewords = [] #SPI config register writewords.append("\x84\x0A\x03\x00") #GEN config writewords.append("\x80\x01\x04\x00") #power down control writewords.append("\x00\x00\x09\x00") #DACRANGE writ...
# Access to KEGG API from bioservices.kegg import KEGG import ora_msc import matplotlib.pyplot as plt # Define the path of metabolomics data DATA_PATH = './data/' # Stating the annotation files & modzscore files pos_annot = DATA_PATH + 'annotation_pos.txt' pos_mod = DATA_PATH + 'modzscore_pos_annotated.tsv' neg_ann...
from abc import ABC, abstractmethod from datetime import datetime import os from typing import Tuple from omegaconf import DictConfig import torch from rlcycle.common.models.base import BaseModel class LearnerBase(ABC): """Abstract base class for Learner""" @abstractmethod def update_model( sel...
import os config = { 'CURRENT_DIR': os.getcwd(), 'IGNORED_DIRS': 'venv', }
import os true_strings = ['true', 'True', 't', '1'] # S3 AWS_ACCESS_KEY_ID = os.getenv('AWS_ACCESS_KEY_ID') AWS_SECRET_ACCESS_KEY = os.getenv('AWS_SECRET_ACCESS_KEY') AWS_DEFAULT_REGION = os.getenv('AWS_DEFAULT_REGION') # Datastores KAFKA_HOSTS = os.getenv('KAFKA_HOSTS', 'kafka:9092') ZOOKEEPER_HOST = os.getenv('ZOO...
from showml.deep_learning.layers import Activation import numpy as np class Sigmoid(Activation): """A layer which applies the Sigmoid operation to an input. """ def forward(self, X: np.ndarray) -> np.ndarray: return 1 / (1 + np.exp(-X)) def backward(self, X: np.ndarray) -> np.ndarray: ...
class IFormattable: """ Provides functionality to format the value of an object into a string representation. """ def ToString(self,format,formatProvider): """ ToString(self: IFormattable,format: str,formatProvider: IFormatProvider) -> str Formats the value of the current instance using the specif...
# Please keep this file so we can directly use this repo as a package.
# Copyright 2018 Contributors to Hyperledger Sawtooth # # 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 ...
class Solution: def maximizeSweetness(self, sweetness: List[int], k: int) -> int: left = 1 right = sum(sweetness) + 2 maximum = 0 while left < right: mid = left + (right - left)// 2 if self.verify(sweetness, mid, k): maximum = mid ...
import threading import collections import zephyr class EventStream: def __init__(self): self.events = [] self.events_cleaned_up = 0 self.lock = threading.RLock() def __iter__(self): with self.lock: return iter(self.events[:]) def __...
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from conversationinsights.channels.console import ConsoleInputChannel def test_console_input(): import conversationinsights.channels.console # Overwrites the in...
import math import numpy as np import time from enum import Enum PYGAME_DISPLAY = None class Rotation(object): """Used to represent the rotation of an actor or obstacle. Rotations are applied in the order: Roll (X), Pitch (Y), Yaw (Z). A 90-degree "Roll" maps the positive Z-axis to the positive Y-axis. ...
import datetime from django.db import models from django.utils import timezone from django.utils.translation import ugettext_lazy as _ from django.contrib.auth.models import User class Question(models.Model): question_text = models.CharField(max_length=500) pub_date = models.DateTimeField('date published') ...
class RevStr(str): def __iter__(self): return ItRevStr(self) class ItRevStr: def __init__(self, chaine_a_parcourir): self.chaine_a_parcourir=chaine_a_parcourir self.position=len(self.chaine_a_parcourir) def __next__(self): if self.position==0: raise StopIteration self.position-=1 return self.chaine...
import json from gzip import ( compress, decompress ) import numpy as np from slovnet.record import Record from slovnet.tar import Tar, DumpTar from slovnet.vocab import Vocab PROTOCOL = 1 META = 'meta.json' MODEL = 'model.json' class Meta(Record): __attributes__ = ['id', 'protocol'] def __init...
import os from datetime import datetime, timedelta def create_folder_if_needed(path): if not os.path.exists(path): os.makedirs(path) def format_time(hour: int, minute: int) -> str: """Turns hours and minutes to a string with the format 'HH:MM'. Assumes 24h clock""" return f"{str(hour).rjust(2, '...
from codecs import open from setuptools import setup, find_packages with open('README.rst', encoding='utf-8') as f: long_description = f.read() setup( name='blog.kottenator.com', version='0.5.0.dev1', description='Super simple blog engine', long_description=long_description, url='https://gith...
# Imports from 3rd party libraries import dash import dash_bootstrap_components as dbc import dash_core_components as dcc import dash_html_components as html from dash.dependencies import Input, Output import plotly.express as px # Imports from this application from app import app # 2 column layout. 1st column width ...
PRM_Header = [ 'Mass [m/z]', # MS1 m/z 'Formula [M]', 'Formula type', 'Species', 'CS [z]', # Integer 'Polarity', # "Positive" 'Start [min]', 'End [min]', '(N)CE', '(N)CE type', 'MSX ID', 'Comment', ]
import utils utils.prepare_test_resources()
def format(number, total=7, decimal=4): return "{{: {0}.{1}f}}".format(total, decimal).format(number) def formatInt(number, spaces=4): return '{{:{0}d}}'.format(spaces).format(number) import math s = 1/8 tot = 0 steps = [] while tot <=1: steps.append(tot) tot += s size = 10 for step in steps: ...
__all__ = ["network_common", "network_tests" ]
import numpy as np import pandas as pd from sklearn.model_selection import train_test_split from tensorflow.keras.utils import to_categorical from tensorflow.keras import Sequential from tensorflow.keras.layers import Dense, Activation, Dropout from sklearn.metrics import confusion_matrix, classification_report import ...
from webbot import Browser from baixar import baixar import time # Ativo o navegador e entro no site do detran web = Browser() web.go_to('https://acesso.detran.mg.gov.br/veiculos/leiloes/editais') configuracao = input("Configurou? S/n: ") i = 0 parar = False # Variavel de Parada do while texto_array = [] print("\n...
from .mobilenet_pretrained import mobilenet_v2 from .resnet_pretrained import resnet18, resnet34, resnet50, resnet101, resnet152, resnext50_32x4d, resnext101_32x8d from .squeezenet_pretrained import squeezenet1_0, squeezenet1_1
""" Semi-Quantum Conference Key Agreement (SQCKA) Author: - Ruben Andre Barreiro ([email protected]) Supervisors: - Andre Nuno Souto ([email protected]) - Antonio Maria Ravara ([email protected]) Acknowledgments: - Paulo Alexandre Mateus ([email protected]) """ # Class of Utilities class Utilities: ...
from astropy.table import QTable, join from collections import defaultdict from DRE.misc.read_catalog import cat_to_table import os class Summary: def __init__(self, name): self.name = name self.parameters = defaultdict(list) self.row_idx = 0 def append(self, params): self.pa...
from future.utils import python_2_unicode_compatible @python_2_unicode_compatible class LazyStr: def __init__(self, fn): self.fn = fn def __str__(self): return self.fn() def parse_list(s, sep=','): s = s.strip() if not s: return [] return [item.strip() for item in s.spli...
"""This module contains `docker image rm` class""" from docker.errors import APIError from .command import Command class Rm(Command): """This class implements `docker image rm` command""" name = "image rm" require = [] def __init__(self): Command.__init__(self) self.settings[self.n...
from datetime import datetime from django.core.management.base import BaseCommand from plugins.polio.models import Campaign, Preparedness from plugins.polio.preparedness.calculator import get_preparedness_score from plugins.polio.preparedness.parser import ( get_national_level_preparedness, get_regional_level...
# -*- coding: utf-8 -*- """ biothings_explorer.dispatcher ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This module contains code that biothings_explorer use to communicate to and receive from APIs. It serves as a glue between "apicall" module and "api_output_parser" module. """ from .json_transformer import Transformer class Out...
import logging from rest_framework import serializers from helium.feed.models import ExternalCalendar from helium.feed.services import icalexternalcalendarservice from helium.feed.services.icalexternalcalendarservice import HeliumICalError __author__ = "Alex Laird" __copyright__ = "Copyright 2021, Helium Edu" __vers...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @author: Pranay S. Yadav """ from hypno import read_raw_hypnogram, load_hypnogram, resample_hypnogram from cycle_detection import detect_cycles, update_hypnogram_cycles from visualize import plot_hypnogram, save_hypnogram_plot
import datetime import random import uuid import requests # basically everything in this file was generated by CoPilot ! def main(): print('Hello World') dt = get_datetime() print(f'The time and date is {dt}') print('The random number is {rn}'.format(rn=get_random_number())) print('The string "H...
"""Adiabatic evolution for the Ising Hamiltonian using linear scaling.""" import os import argparse import json import time import qibo from qibo import callbacks, hamiltonians, models parser = argparse.ArgumentParser() parser.add_argument("--nqubits", default=4, type=int) parser.add_argument("--dt", default=1e-2, typ...
import param import panel as pn PAGES = { "About": pn.pane.Markdown("about " * 2500, sizing_mode="stretch_width", name="About"), "Holoviews": pn.pane.Markdown( "holoviews " * 2500, sizing_mode="stretch_width", name="Holoviews" ), "Plotly": pn.pane.Markdown("plotly " * 2500, sizing_mode="stretc...
from tkinter import * PROGRAM_NAME = "Footprint Editor" root = Tk() root.geometry('350x350') root.title(PROGRAM_NAME) menu_bar = Menu(root) # menu begins file_menu = Menu(menu_bar, tearoff=0) # all file menu-items will be added here next menu_bar.add_cascade(label='File', menu=file_menu) edit_menu = Menu(menu_ba...
"""rla_export: Export data from ColoradoRLA to allow public verification of the audit ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Examples -------- With no options, the command will run queries using all the standard .sql files provided in the package, and put the resulting expo...
from ...core.enum.ea_mode import EAMode from ...core.models.assembly_parameter import AssemblyParameter from ...core.enum import ea_mode_bin from ...core.enum.ea_mode_bin import parse_ea_from_binary from ...simulator.m68k import M68K from ...core.util.split_bits import split_bits from ...core.opcodes.opcode import Opco...
# -*- coding: utf-8 -*- """ /dms/usermanagementorg/help_form.py .. enthaelt die kompletten Kontext-Hilfetexte fuer die User-Verwaltung der Institutionen Django content Management System Hans Rauch [email protected] Die Programme des dms-Systems koennen frei genutzt und den spezifischen Beduerfnissen entspr...
class Solution: def minmaxGasDist(self, stations: List[int], K: int) -> float: dists = self.getDists(stations) left, right = min(dists) / K, max(dists) while left + 10e-6 < right: print(left, right) count = 0 mid = (left + right) / 2 for i in...
""" author: "Md. Sabuj Sarker" copyright: "Copyright 2017-2018, The Synamic Project" credits: ["Md. Sabuj Sarker"] license: "MIT" maintainer: "Md. Sabuj Sarker" email: "[email protected]" status: "Development" """ import unittest from synamic.core.standalones.function...
import glob import os import random import re import shutil import sys from typing import List, Tuple import numpy as np import torch from torch.nn.utils.rnn import pad_sequence from torch.utils.data import RandomSampler, DistributedSampler, DataLoader from torch.utils.tensorboard import SummaryWriter from tqdm import...
''' Remove_json.py Remove all json files in sub-directories. Useful when you are cloning directories that have already been featurized to get new feature embeddings with nlx-model repo. ''' import os def removejson(listdir): for i in range(len(listdir)): if listdir[i][-5:]=='.json': os.remov...
import model import torch import torchvision import torchvision.transforms as transforms import os # 默认参数声明 # batch_size = 64 # epochs = 60 # WORKERS = 4 # dataloder线程数 # ROOT = './dataset/' # 数据集保存路径 # pth_dir = './model_pth/' # 模型保存路径 classes = ('plane', 'car', 'bird', 'cat', 'deer', 'd...
from djangobench.base_settings import * # NOQA INSTALLED_APPS = ['model_save_new']
# bug 2 # Print the squares of the numbers 0 to 9: for num in range(10): x = num**2 print(x) print("Done")
from .exceptions import (LookupNotFoundException, NetworkFailureException, # noqa APIKeyException) # noqa from .options import ScriptOptions # noqa
import pandas as pd def add_column_length(table_name, table_data): indicies = [('w', 'wld_id'), ('p', 'hs_id'), ('b', 'bra_id')] for index, column in indicies: if index in table_name: table_data[column + "_len"] = pd.Series( map(lambda x: len(str(x)), table_data.index.get_level_values(colum...
def main(): import webbrowser recherche = 0 while True: if recherche >= 2: print("Vous avez fait " + str(recherche) + " recherches.") recherche += 1 adresse = input("Quel adresse veut-tu ouvrir") webbrowser.open(adresse) if __name__ == "__main__": main()
from datetime import timedelta from pathlib import Path from environs import Env BASE_DIR = Path(__file__).resolve().parent.parent env = Env() env.read_env() # Django environment SECRET_KEY = env.str('SECRET_KEY') DEBUG = env.bool("DEBUG", False) ALLOWED_HOSTS = env.list('ALLOWED_HOSTS') DATABASES = { 'default...
#! /usr/bin/env python """ Create files for ht unit test """ import nmrglue.fileio.pipe as pipe import nmrglue.process.pipe_proc as p d, a = pipe.read("1D_time_real.fid") d, a = p.ht(d, a) pipe.write("ht1.glue", d, a, overwrite=True) d, a = pipe.read("1D_time_real.fid") d, a = p.ht(d, a, td=True) pipe.write("ht2.glu...
# Copyright 2016 Jake Dube # # ##### BEGIN GPL LICENSE BLOCK ###### # This file is part of MeshTools. # # MeshTools is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at yo...
import pybullet_envs from stable_baselines3 import TD3_PER model = TD3_PER('MlpPolicy', 'MinitaurBulletEnv-v0', verbose=1, tensorboard_log="results/long_TD3_PER_MinitaurBullet/") model.learn(total_timesteps=3000000)
# pylint: disable=redefined-outer-name # pylint: disable=unused-argument # pylint: disable=unused-variable from datetime import datetime import pytest from fastapi import FastAPI from fastapi.params import Query from fastapi.routing import APIRouter from pydantic.types import PositiveFloat @pytest.fixture def app()...
# coding: utf-8 from __future__ import unicode_literals from uuid import uuid4 import json from .common import InfoExtractor from ..utils import ( int_or_none, url_or_none, ExtractorError, ) class IplaIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?ipla\.tv/.+/(?P<id>[0-9a-fA-F]+)' _TESTS =...
from phase_diagram.phase_diagram import PhaseDiagram from src.point_in_curve import point_in_function import numpy as np from functools import partial water = PhaseDiagram('H2O') ureg = water.ureg Q_ = ureg.Quantity water_clapeyron_sv = partial(water._clapeyron_sv_lv, curve='sv') water_clapeyron_lv = partial(water._c...
import ast import datetime import json import requests # from django.conf import settings from django.conf import settings TASKS_PATH = 'api/tasks' TASKS_INFO_PATH = 'api/task/info/' TASKS_EXEC_PATH = 'api/task/send-task/' TASKS_ABORT_PATH = 'api/task/abort/' class Task: args = None children = None clie...
from typing import Dict from domain.exceptions.models_exception import PathNotFound from domain.models.models_info import ModelsInfo from domain.models.paths import Paths from domain.models.pretrained_models import PretrainedModels from domain.services.contracts.abstract_path_service import AbstractPathService from do...
"""test_dependency_algorithm.py - tests :) """ from dependency_algorithm import Dependencies import pytest ################################################################################ # Data structures to use in these tests ################################################################################...
import tensorflow as tf from keras.layers import Dense, Flatten, Dropout, Lambda, Activation, MaxPooling2D from keras.layers.convolutional import Convolution2D from keras.models import Sequential from keras.optimizers import Adam from keras.callbacks import ModelCheckpoint import helper # parameters to adjust IMAGE_HE...
import torch import torch.nn as nn import torch.nn.functional as F if __name__ == '__main__': pad_layer = nn.ZeroPad2d(padding=(-1, 0, 0, 0)) input = torch.randn(1, 1, 3, 3) print(pad_layer(input).shape) class TVLoss(nn.Module): def __init__(self): super(TVLoss, self).__init__() self....
import itertools from collections import OrderedDict from pytest import raises from triad.utils.iter import ( EmptyAwareIterable, Slicer, make_empty_aware, slice_iterable, to_kv_iterable, ) def test_empty_aware_iterable(): i = _get_iterable("1,2,3") e = make_empty_aware(i) assert not ...
import copy import tarfile import os import os.path import itertools import math import numpy as np import scipy.signal as signal from pysit.util.image_processing import blur_image from pysit.gallery.gallery_base import GeneratedGalleryModel from pysit import * #PML, Domain from pysit.core.domain import PML from p...
from . import gui, model
from teleapi import TelegramApi api = TelegramApi(token='TOKEN') api_proxy = TelegramApi(token='TOKEN', proxy='https://USERNAME:PASSWORD@IP:PORT') message = api.send_message(-100, 'Hello') print(message.text) message = api.forward_message(-100, -100, 1) # 1 - id message print(message.text) photo = api.send_photo(-10...
import sys import unittest import pynsive class WhenCreatingThePluginManager(unittest.TestCase): def setUp(self): self.manager = pynsive.PluginManager() def tearDown(self): self.manager.destroy() def test_correct_meta_path_insertion(self): finder_index = sys.meta_path.index(self...
from .AccountAdapter import AccountAdapter from .LocalFileSystemAccountAdapter import LocalFileSystemAccountAdapter