text
stringlengths
2
999k
import socket import pandas as pd def read_net_graph(): aux = pd.read_json("/tmp/mud_graph.json") return aux.drop_duplicates() def read_nodes(): aux = pd.read_json("/tmp/mud_nodes.json") return aux.drop_duplicates() def map_address(name): nodes = read_nodes() try: return nodes[nodes.name==name].ip.item() ex...
# 给定长度为 n 的整数数组 nums,其中 n > 1,返回输出数组 output ,其中 output[i] 等于 nums 中除 nums[i] 之外其余各元素的乘积。 class Solution: def productExceptSelf(self, nums: list) -> list: res, l, r = [1] * len(nums), 1, 1 for i, j in zip(range(len(nums)), reversed(range(len(nums)))): res[i], l = res[i] * l, l * nums[i]...
# Copyright 2018, The TensorFlow Federated 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 o...
""" terminal reporting of the full testing process. This is a good source for looking at the various reporting hooks. """ from __future__ import absolute_import, division, print_function import itertools import platform import sys import time import pluggy import py import six from more_itertools import collapse im...
"""Auto-generated file, do not edit by hand. IN metadata""" from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata PHONE_METADATA_IN = PhoneMetadata(id='IN', country_code=91, international_prefix='00', general_desc=PhoneNumberDesc(national_number_pattern='1\\d{7,12}|[2-9]\\d{9,10}', possible_numb...
import os import pytest import sqlalchemy as sa from libweasyl.configuration import configure_libweasyl from libweasyl.models.meta import registry from libweasyl.models.tables import metadata from libweasyl.test.common import NotFound from libweasyl.test.common import dummy_format_media_link from libweasyl import cac...
import datetime from typing import List, Dict import matplotlib.ticker as ticker from matplotlib import colors PLOT_TEXT_DICT = { "contact_rate": "infection risk per contact", "hospital_props_multiplier": "hospital risk multiplier", "compartment_periods.icu_early": "pre-ICU period", "testing_to_detect...
''' Date: 2022-02-11 14:33:56 LastEditors: fuchaoxin LastEditTime: 2022-02-11 09:54:54 FilePath: \Visual Studiod:\Desktop\idsm\part2\transformer\transformer-pytorch\utils\utils.py ''' import math import numpy as np import torch import torch.nn as nn from torch.nn import LayerNorm, Dropout from torch.autograd import Var...
#!/usr/bin/env python # -*- coding: utf-8 -*- # @File : memory.py # @Author: zixiao # @Date : 2019-04-07 # @Desc : import numpy as np class Memory: def __init__(self, size, w, h, frame_len): self.size = size self.index = 0 self.count = 0 self.num_in_memory = 0 self.frame...
""" Module defining nodes which can be focused. A focused node: - consumes all mouse events within its area, preventing underlying nodes from receiving them. - gets first priority on keyboard event handling. A common example of focus is handling overlapping windows - one appears on top of the other and consumes a...
""" Copyright 2011-2015 Kyle Lancaster This program 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 your option) any later version. This program is distributed in ...
# Lint as: python2, python3 # Copyright 2018 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 # ...
import os import re import webbrowser from typing import List, Optional, Tuple, Union import colorama from git import Git, GitCommandError from gutsygit.utils import removeprefix colorama.init(autoreset=True) LEVEL_DEBUG = -1 LEVEL_INFO = 0 LEVEL_HEADER = 1 LEVEL_WARNING = 2 LEVEL_ERROR = 3 OUTPUT_COLORS = { L...
from dotenv import load_dotenv from pathlib import Path env_path = Path('.') / '.env' load_dotenv(dotenv_path=env_path)
from unittest import TestCase from xhtml2pdf.w3c.cssSpecial import parseSpecialRules, splitBorder class FontTest(TestCase): """ Tests if the CSS font property gets split up properly into font-size, font-weight, etc. """ def test_font_size_family(self): func_in = [("font", [("15", "px"), ...
import unittest from d07_the_treachery_of_whales.d01_the_treachery_of_whales import count_min_fuel_for_crab_moving, \ count_min_revised_fuel_consumption class TheTreacheryOfWhalesTestCase(unittest.TestCase): def test_minimal_movement(self): crabs = [16, 1, 2, 0, 4, 2, 7, 1, 2, 14] fuel = coun...
from django import template register = template.Library() class StreamItemNode(template.Node): def __init__(self, entry_var): self.entry_var = template.Variable(entry_var) def render(self, context): entry = self.entry_var.resolve(context) template_name = 'stream/%s.html' % (entry.item...
# 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 # distributed under t...
from django.apps import AppConfig class ZadanieAppConfig(AppConfig): default_auto_field = 'django.db.models.BigAutoField' name = 'shop_app' def ready(self): import shop_app.signals
# -------------------------------------------------------- # Deep Feature Flow # Copyright (c) 2017 Microsoft # Licensed under The MIT License [see LICENSE for details] # Modified by Yuwen Xiong # -------------------------------------------------------- # Based on: # py-faster-rcnn # Copyright (c) 2016 by Contributors ...
#!/usr/bin/env python import argparse import sys import os import yaml import requests import tempfile import subprocess import socket from jinja2 import Template def main(): parser = argparse.ArgumentParser( description="PROTOTYPE: start filebeat with a module configuration") parser.add_argument("--m...
# -*- coding: utf-8 -*- import os import sys from docker import from_env from docker.errors import APIError from fabric.colors import red from google.cloud.storage import Client from requests import ConnectionError from command import ( AnonymousCommand, BasicCommand ) from config import config from messages...
# coding: utf-8 # # Logistic Regression with a Neural Network mindset # # Welcome to your first (required) programming assignment! You will build a logistic regression classifier to recognize cats. This assignment will step you through how to do this with a Neural Network mindset, and so will also hone your intuiti...
# python3 # pylint: disable=g-bad-file-header # Copyright 2019 DeepMind Technologies Limited. 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...
import os import sys import matplotlib.pyplot as plt import numpy as np from keras import backend as K from keras.models import load_model # Only supports convolution filters def visualize_cnn_model(model_file, image_file, output_dir): model = load_model(model_file) print "model json:" print model.to_json() ...
# -*- coding: utf-8 -*- import os import sys import logging import uuid import time from dotenv import load_dotenv from photo import capture_and_download from stepper import move from s3 import store_stream_s3 from files import upload_stack load_dotenv() BASE_DIR = os.path.dirname(os.path.realpath(__file__)) stack...
from django.urls import path, re_path from django.views.generic.base import RedirectView from django.views.i18n import JavaScriptCatalog from django.conf.urls import include from django.conf.urls.static import static from django.conf import settings js_info_dict = { 'domain': 'django', 'packages': None, } ...
# Copyright (C) 2018-2021 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import os import pytest import tests from pathlib import Path def image_path(): path_to_repo = os.environ["DATA_PATH"] path_to_img = os.path.join(path_to_repo, "validation_set", "224x224", "dog.bmp") return path_to_img ...
import tweepy import couchdb import json import math from urllib3.exceptions import ProtocolError # Twitter API authentication details. consumer_key = 'ojOqMVHEPmhCiYwTrZIUrPGGW' consumer_secret = 'LJjqy5MNmoN9iKPAzODyD6C4r4WlzEBG6BbDaFMfQCVorAdT6L' access_token = '1258052304462176258-YLPE8lyYuVnBYDif83I3QCinqw...
import os from psutil import Process from pathlib import Path import pytest import tempfile import os import logging import time import cellpy.readers.core import cellpy.utils.helpers from cellpy import log from cellpy import prms from cellpy.readers.core import humanize_bytes f_in = Path("../testdata/data/20160805_...
#!/usr/bin/env python # # __COPYRIGHT__ # # 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, copy, modify, merge, publish, ...
"""Planning (Chapters 10-11) """ from .utils import Expr class Action: """ Defines an action schema using preconditions and effects Use this to describe actions in PDDL action is an Expr where variables are given as arguments(args) Precondition and effect are both lists with positive and negated ...
import sys from PyQt5 import QtWidgets from hg502_tracker.app import HG502App from hg502_tracker.gui import HG502GUI from hg502_tracker.hg502 import HG502 if sys.platform == 'win32': # This is necessary for the correct display of the icon on the taskbar. import ctypes app_id = 'mycompany.myproduct.subpr...
commerce_buildings = '便利店 五金店 服装店 菜市场 学校 图书城 商贸中心 加油站 追梦快递 民食斋 媒体之声 游泳馆'.split() residence_buildings = '木屋 居民楼 钢结构房 平房 小型公寓 人才公寓 花园洋房 中式小楼 空中别墅 复兴公馆 梦想公寓'.split() industry_buildings = '木材厂 食品厂 造纸厂 水厂 电厂 钢铁厂 纺织厂 零件厂 企鹅机械 人民石油 强国煤业'.split() default_blacklist = "商贸中心 小型公寓 水厂 花园洋房 复兴公馆 加油站 人民石油 纺织厂 钢结构房 钢铁厂 菜市场".split() mo...
# -*- coding: utf-8 -*- # # Copyright (C) 2005-2007 Christopher Lenz <cmlenz@gmx.de> # Copyright (C) 2007 Edgewall Software # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms # are also available at http://bitte...
from blockchain import * from blockStart import * from pymongo import MongoClient newDatabase = database() def save(block, wallets): newDatabase.saveDatabase(block, wallets, "./public/") walletJSON = {"users": []} # user.ownerName can be changed to user.publicAddress for user in wallets: n...
import shutil from country_levels_lib.config import geojson_dir, export_dir from country_levels_lib.fips_utils import get_state_codes, get_county_data from country_levels_lib.utils import read_json, write_json fips_geojson_dir = geojson_dir / 'fips' quality_map = { 5: '20m', 7: '5m', 8: '500k', } def ...
# Copyright 2016 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...
from django.shortcuts import render from .models import Item # Create your views here. def show_cart(request): # need consumer_id later item_list = Item.objects.filter() context = {'item_list':item_list} return render(request, 'cart/show_cart.html', context)
from django.contrib import admin from django.db import models from django.utils.translation import gettext_lazy as _ from .generic_audited_model import GenericAuditedModel from .company_model import Company class Route(GenericAuditedModel): name = models.CharField(max_length=255, verbose_name=_("Name of the rou...
import logging import re from decimal import Decimal class UpdateSqlValidation: def validate_parse_update(self, query): logging.debug("Validating Update Query...") query = self.remove_semicolon(self, query) queryMatch = re.search("^update\s[\w]+\sSET\s.*\swhere\s[\w]+\s=\s[']?[\w]+[']?$"...
# -*- coding: utf-8 -*- import traceback from enum import IntEnum from typing import Sequence, Optional, Dict from abc import abstractmethod, ABC from PyQt5 import QtCore, QtGui from PyQt5.QtCore import Qt, QRect, QSize from PyQt5.QtWidgets import (QMenu, QHBoxLayout, QLabel, QVBoxLayout, QGridLayout, QLineEdit, ...
# Copyright 2017 Red Hat, 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...
""" VCD (Video Content Description) library v4.3.1 Project website: http://vcd.vicomtech.org Copyright (C) 2021, Vicomtech (http://www.vicomtech.es/), (Spain) all rights reserved. VCD is a Python library to create and manage VCD content version 4.3.1. VCD is distributed under MIT License. See LICENSE. """ import ...
from threading import Lock class SingletonMeta(type): """ This is a thread-safe implementation of Singleton. """ _instances = {} _lock: Lock = Lock() """ We now have a lock object that will be used to synchronize threads during first access to the Singleton. """ def __call_...
"""Iterate through our talks and announce them to discord when it's time to go see the talk. TODO: 1. Decide how we want to do the actual scheduling: celery? event loop like tornado? cron job? 2. Iterate over all the talks and test it in Discord 3. Delete all the announcements before we invite anyone in """ from typin...
# objects.py -- Access to base git objects # Copyright (C) 2007 James Westby <jw+debian@jameswestby.net> # Copyright (C) 2008-2013 Jelmer Vernooij <jelmer@jelmer.uk> # # Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU # General Public License as public by the Free Software Foundation; version...
"""SuperB URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.11/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-bas...
__author__ = "Christopher Tomkins-Tinch" __copyright__ = "Copyright 2015, Christopher Tomkins-Tinch" __email__ = "tomkinsc@broadinstitute.org" __license__ = "MIT" import os, re, ftplib from itertools import product, chain from contextlib import contextmanager # module-specific from snakemake.remote import AbstractRem...
# coding: utf-8 """ Genomic Data Store Service No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 The version of the OpenAPI document: v1 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import im...
# JupyterHub configuration # ## If you update this file, do not forget to delete the `jupyterhub_data` volume before restarting the jupyterhub service: ## ## docker volume rm jupyterhub_jupyterhub_data ## ## or, if you changed the COMPOSE_PROJECT_NAME to <name>: ## ## docker volume rm <name>_jupyterhub_data ## ...
""" cfc_project URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.1/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-...
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! import grpc from google.ads.google_ads.v4.proto.resources import campaign_audience_view_pb2 as google_dot_ads_dot_googleads__v4_dot_proto_dot_resources_dot_campaign__audience__view__pb2 from google.ads.google_ads.v4.proto.services import campaign_au...
""" Package for DelibeRating. """
import random from time import sleep import numpy as np import math def sigmoid(x): return 1. / (1 + np.exp(-x)) def sigmoid_derivative(values): return values*(1-values) def tanh_derivative(values): return 1. - values ** 2 # createst uniform random array w/ values in [a,b) and shape args def rand_ar...
from django.core.management.base import BaseCommand, CommandParser from zerver.lib.actions import do_create_user from zerver.lib.management import ZulipBaseCommand from zerver.lib.onboarding import send_initial_pms from zerver.models import Realm, UserProfile from typing import Any class Command(ZulipBaseCommand): ...
import setuptools with open("README.md", "r", encoding='utf8') as fh: long_description = fh.read() setuptools.setup( name="dispander", version="0.5.1", author="1ntegrale9", maintainer="hawk_tomy", author_email="1ntegrale9uation@gmail.com", maintainer_email="hawk201000211101@gmail.com", ...
from datetime import date from django.core import validators from django.db import models from django.shortcuts import reverse class GoogleCalender(models.Model): url = models.CharField(max_length=120, help_text="Please ensure that it starts at the // (i.e. without the https: or webcal...
import _plotly_utils.basevalidators class ColorValidator(_plotly_utils.basevalidators.ColorValidator): def __init__( self, plotly_name="color", parent_name="box.unselected.marker", **kwargs ): super(ColorValidator, self).__init__( plotly_name=plotly_name, parent_name=pa...
#!/usr/bin/env python3 # # Copyright 2017-2020 GridGain Systems. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
import uuid import time import threading import logging import queue import lynk from lynk.backends.dynamodb import DynamoDBControl LOG = logging.getLogger(__file__) THREADS = 20 class SleepyThread(threading.Thread): def __init__(self, session, input_q, output_q): super(SleepyThread, self).__init__() ...
import re from pathlib import Path MAX_ATTEMPTS = 450 MAX_STATUS_LEN = 280 BACKOFF = 0.75 TIMEOUT_BACKOFF = 240 HOME = str(Path.home()) # Compiled web screenshot binary: https://github.com/catleeball/WebScreenShot WSS = "/usr/local/share/tmnt/wss" # This is a slightly modified version of what's what http://glench.co...
from flask import Flask, render_template, jsonify, request, json from modules import extract from modules import ABREVIACIONES as abr app = Flask(__name__, static_folder='./templates/static', template_folder='./templates') @app.route('/api', methods=['POST']) def api(): text = json.load...
import copy as cp import pickle import sys import os sys.path.insert(0, os.path.abspath('../')) from Utils.eval_helper import * from Utils.iohelper import * from Utils.yelpFeatureExtraction import * from Detector.eval_GANG import runGANG from Detector.eval_Fraudar import runFraudar from Detector.eval_SpEagle import ru...
import os import sys import json import logging import pathlib from logging.handlers import RotatingFileHandler ## Config CONFIG_OPTIONS = {} # This'll be populated on import CONFIG_NAME = "config.json" # The name of the config file DEV_CONFIG_NAME = "config.dev.json" # The name of ...
############################################################################### # Copyright (c) 2017-2020 Koren Lev (Cisco Systems), # # Yaron Yogev (Cisco Systems), Ilia Abashin (Cisco Systems) and others # # # ...
#!/usr/bin/python2.5 # # Copyright 2009 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 ...
# ----------------------------------------------------------------------- print('\033[32;1mDESAFIO 030 - Par ou Ímpar\033[m') print('\033[32;1mALUNO:\033[m \033[36;1mJoaquim Fernandes\033[m') print('-' * 50) # ----------------------------------------------------------------------- tipo = ['Par', 'Ímpar'] num = int(inpu...
# -*- coding: utf-8 -*- # Generated by Django 1.11.20 on 2019-05-29 10:33 from __future__ import unicode_literals import json from django.core.serializers.json import DjangoJSONEncoder from django.db import migrations from django.utils import timezone def migrate_forwards(apps, schema_editor): HomePage = apps.ge...
from libcloud.storage.types import Provider from libcloud.storage.providers import get_driver cls = get_driver(Provider.AZURE_BLOBS) driver = cls( key="devstoreaccount1", secret="Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6" "IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==", host="localhost", port=10...
# 输入一个音频,输出PSEQ值和声谱图 import glob import os from argparse import ArgumentParser import librosa import pytorch_lightning as pl import torch from asteroid.metrics import get_metrics import dc_crn from dataset import WavDataset from train import LitModule from vis import showspec import soundfile def main(args): #...
# 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...
#!/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 ...
# DO NOT MODIFY THIS FILE DIRECTLY. THIS FILE MUST BE CREATED BY # mf6/utils/createpackages.py # FILE created on March 19, 2021 03:08:37 UTC from .. import mfpackage from ..data.mfdatautil import ListTemplateGenerator class ModflowGwfdrn(mfpackage.MFPackage): """ ModflowGwfdrn defines a drn package within a ...
import os import keras import numpy as np import tensorflow as tf import tensorflow.contrib.slim as slim from sklearn import utils from utils.logger import get_logger, Progbar from keras.preprocessing.image import ImageDataGenerator def batch_dataset(images, labels, batch_size): total = labels.shape[0] for st...
import names import stringgenerator from utilities import * from pathfinding import *
import sys coins = {.01:"PENNY", .05:"NICKEL", .1:"DIME", .25:"QUARTER", .5:"HALF DOLLAR", 1.: "ONE", 2.:"TWO", 5.:"FIVE", 10.:"TEN", 20.:"TWENTY", 50.:"FIFTY", 100.:"ONE HUNDRED"} def register(n): reg = [] for c in sorted(coins.keys(), reverse=True): while n >= c: reg.append(coins[c]) n = round(...
# coding: utf-8 """ Kubernetes No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) OpenAPI spec version: v1.7.4 Generated by: https://github.com/swagger-api/swagger-codegen.git """ from pprint import pformat from six import iteritems import re ...
# coding: utf-8 """ Kubernetes No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 OpenAPI spec version: v1.14.7 Generated by: https://openapi-generator.tech """ import pprint import re # noqa: F401 import six class V1PodList(...
import logging import copy from datetime import datetime import os import sys import urllib.error import time import datetime from functools import partial from itertools import filterfalse import pytest from appium import webdriver from ._utils import get_json, post_json from .driver.proxy.proxy_mixin import proxy f...
import asyncio import io import os import subprocess from datetime import datetime from PIL import Image from .. import command, module, util PNG_MAGIC = b"\x89\x50\x4e\x47\x0d\x0a\x1a\x0a" class LengthMismatchError(Exception): pass class StickerModule(module.Module): name = "Sticker" async def on_l...
""" tl_polarization_enums.py """ from enum import IntEnum class _CTypesEnum(IntEnum): @classmethod def from_param(cls, obj): return int(obj) class POLAR_PHASE(_CTypesEnum): """ The possible polarization angle values (in degrees) for a pixel in a polarization sensor. The polarization phase ...
''' The Wrapper of statsmodels one parameter exponential family distributions used by GLM, with the added functionality for log likelihood per sample. Loglikelihood per sample is going to be used in IOHMM to estimate emission probability. ''' from __future__ import division from past.utils import old_div from builtins...
from attackToolBox import * from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets("MNIST_data/", one_hot=True) atb = attackToolBox(mnist.train.images[:10000], mnist.train.labels[:10000]) print("finish initializing") atb.polluteByKNN(mnist.test.images[:100], mnist.test.labels[:10...
import sys from logbook import Logger, StreamHandler, INFO, DEBUG, WARNING, ERROR, CRITICAL StreamHandler(sys.stdout).push_application() LEVEL = dict( debug=DEBUG, info=INFO, warning=WARNING, warn=WARNING, error=ERROR, critical=CRITICAL, ) default_level = LEVEL['info'] def Log(name, level=...
# # Copyright 2019 The FATE 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 appli...
from django.forms import ModelForm from .models import Application from django import forms class ApplicationForm(ModelForm): class meta: model = Application def clean_scopes(self): scopes = self.cleaned_data['scopes'] if 'user.read' not in scopes: raise forms.ValidationEr...
# Copyright 2018 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...
import re def filter_data(comment): lines = comment.split('\n') line_filters = list(filter( lambda name: name.startswith('skip_line_'), [k for k, v in globals().items()] )) for i in range(len(lines) - 1, -1, -1): line = lines[i] + '' line = line.strip(' ᅠᅠᅠ ') line = cut_by_regex(line, '^((ре)?-?ролл...
import sys import numpy as np import pandas as pd import tensorflow as tf import datetime from keras.utils import plot_model from keras_preprocessing.image import ImageDataGenerator from keras import backend as k from keras.callbacks import TensorBoard, EarlyStopping, ReduceLROnPlateau, CSVLogger from keras.optimizers ...
import sys import datetime as dt import pytest import numpy as np # Construction class D: def __index__(self) -> int: return 0 class C: def __complex__(self) -> complex: return 3j class B: def __int__(self) -> int: return 4 class A: def __float__(self) -> float: ...
from django.http import HttpRequest, HttpResponse from siteajax.decorators import ajax_dispatch from siteajax.utils import Source, AjaxResponse def test_headers(htmx): client = htmx() response = client.get( '/sample_view_1/', source=Source(id='myid', name='myname'), target='trgt', ...
from __future__ import print_function, division import os import sys import json import pandas as pd def convert_csv_to_dict(csv_path, subset, labels): data = pd.read_csv(csv_path, delimiter=' ', header=None) keys = [] key_labels = [] key_start_frame = [] key_end_frame = [] for i in range(data....
"""Unicode Properties from Unicode version 6.1.0 (autogen).""" unicode_bidi_classes = { "^al": "\x00-\u0607\u0609-\u060a\u060c\u060e-\u061a\u061c-\u061d\u064b-\u066c\u0670\u06d6-\u06e4\u06e7-\u06ed\u06f0-\u06f9\u070e\u0711\u0730-\u074c\u07a6-\u07b0\u07b2-\u089f\u08a1\u08ad-\ufb4f\ufbc2-\ufbd2\ufd3e-\ufd4f\ufd90-\u...
__author__ = 'Gianluca barbon' from tcp_board import TCPBoard import sys import time # this class provides a simple example of how it is possible to read analog values into the Arduino # in this case, the readings we get control the rate at which the LED blinks. class PotentiometerTCP(TCPBoard): def __init__(se...
# Lint-as: python3 # Copyright 2020 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 ag...
"""Raster data processing.""" import numpy as np import rasterio import rasterio.warp def histogram_cutting(raster, percent=2, nodata=None, mask=None): """Perform histogram cutting on a 2D raster Parameters ---------- raster : numpy 2d array Input raster. percent : int Percentile...
__version__ = '2.1.0' __author__ = 'Matt Nishi-Broach' __license__ = 'MIT' __copyright__ = 'Copyright 2015-2018 Matt Nishi-Broach' # Version synonym VERSION = __version__
# See readme.md for instructions on running this code. import re import os class VirtualFsHandler(object): def usage(self): return get_help() def handle_message(self, message, client, state_handler): command = message['content'] stream = message['display_recipient'] topic = me...
# coding: utf-8 from __future__ import annotations from datetime import date, datetime # noqa: F401 import re # noqa: F401 from typing import Any, Dict, List, Optional # noqa: F401 from pydantic import AnyUrl, BaseModel, EmailStr, validator # noqa: F401 class AdminConfig(BaseModel): """NOTE: This class is ...