text
stringlengths
1
927k
import os.path from django.test import TestCase from dojo.tools.burp.parser import BurpParser from dojo.models import Test def sample_path(file_name): return os.path.join("dojo/unittests/scans/burp", file_name) class TestBurpParser(TestCase): def test_burp_with_one_vuln_has_one_finding(self): with...
#!/usr/bin/python # Copyright (c) 2014 Wladimir J. van der Laan # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. ''' Script to generate list of seed nodes for chainparams.cpp. This script expects two text files in the directory tha...
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may ...
# https://programmers.co.kr/learn/courses/30/lessons/42583?language=python3 def solution(bridge_length, weight, truck_weights): time = 0 q = [0] * bridge_length while q: time += 1 q.pop(0) if truck_weights: if sum(q) + truck_weights[0] <= weight: q.appe...
"""Example of a highway section network with on/off ramps.""" from flow.envs.highway_ramps_env import HighwayRampsEnv from flow.envs.multiagent import highway from flow.controllers import car_following_models from flow.controllers.car_following_models import IDMController, LACController from flow.core.params import Su...
import plotly.offline as pyo import plotly.express as px from plotly.subplots import make_subplots import pandas as pd import plotly.graph_objects as go def rindex(lst, value): return len(lst) - lst[::-1].index(value) - 1 dashboard = open("./gh-pages/benchmark.html", 'w') dashboard.write("<html><head></head><...
import torch import numpy from typing import Union, List, Any class NonMaxSuppression: """ Given a set of bounding box defined over possibly different tissue Use Intersection_over_Minimum criteria to filter out overlapping proposals. """ @staticmethod @torch.no_grad() def compute_nm_mask(...
import tensorflow as tf def get_network(x): '''Gets a discriminator network with the shared base of the VGG19 network. x(tf.Tensor) -- the VGG19 base network ''' with tf.variable_scope('VGG19_top', None, [x], reuse=tf.AUTO_REUSE): conv1 = tf.layers.conv2d(x, 512, 3, activation=tf.nn.leaky_rel...
# _*_ coding: utf-8 _*_ from math import radians, cos, sin, asin, sqrt from app.libs.poi_search.es_search_category import search from app.libs.poi_search.es_search_street import search as search_street from app.models.new_shop import NewShop as Shop from app.models.group import Group from app.models.new_user import Ne...
#!/usr/bin/env python import argparse import os import re import subprocess from tabulate import tabulate parser = argparse.ArgumentParser(prog="forces", description='''A script that parses an OUTCAR file to compute a the net positive and...
from django.urls import path from django.contrib.auth import views as auth_views from users import views as user_views urlpatterns = [ path('register/', user_views.register, name='users-register'), path('employee/', user_views.employee, name='users-employee'), path('profile/', user_views.profile, name='us...
# Copyright 2014 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
__author__ = 'lionel' #!/usr/bin/python # -*- coding: utf-8 -*- import struct import sys # 搜狗的scel词库就是保存的文本的unicode编码,每两个字节一个字符(中文汉字或者英文字母) # 找出其每部分的偏移位置即可 # 主要两部分 # 1.全局拼音表,貌似是所有的拼音组合,字典序 # 格式为(index,len,pinyin)的列表 # index: 两个字节的整数 代表这个拼音的索引 # len: 两个字节的整数 拼音的字节长度 # pinyin: 当前的拼音,每个字符两个字节,总...
# Copyright (c) 2011-2020 Eric Froemling # # 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,...
from seeq.control import * import unittest class TestQControl(unittest.TestCase): π = np.pi σz = np.array([[1., 0.],[0., -1.]]) σx = np.array([[0., 1.],[1., 0.]]) σy = np.array([[0., -1.j],[1.j, 0.]]) ψ0 = np.eye(2) def test_nothing(self): """For a qubit to remain the same, we do noth...
import numpy as np class uncertainty: def __init__(self): pass class uncertainties: def __init__(self): self.uncertainty_collection = {} self.uncertainty_count = {} self.norm_func = {'MinMax' : lambda x: (x-np.min(x)) / (np.max(x)-np.min(x)), 'Zscor...
import h5py import numpy as np """ This file writes all of the materials data (multi-group nuclear cross-sections) for the Takeda benchmark problem to an HDF5 file. The script uses the h5py Python package to interact with the HDF5 file format. This may be a good example for those wishing to write their nuclear data to...
#!/usr/bin/python import sys #initialize previous key, index, and value: previous_key = None prev_ind = None prev_v = None #initialize list: calc_list = [] for line in sys.stdin: #strip and get the values in each line (i.e. the key, the index and the value) line = line.strip() ind, key, v = line.split("...
#|----------------------------------------------------------------------------- #| This source code is provided under the Apache 2.0 license -- #| and is provided AS IS with no warranty or guarantee of fit for purpose. -- #| See the project's LICENSE.md for details. -- ...
# coding=utf-8 # ------------------------------------ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # ------------------------------------ import uuid import pytest import functools from devtools_testutils import recorded_by_proxy, set_bodiless_matcher, set_custom_default_matcher from azure....
import os import time import cv2 import numpy as np from PIL import ImageGrab class Screen(object): WINDOW_NAME = 'data' def __init__(self): self.image = None self.data = None self.event = None @property def inverted_image_size(self): return (self.image.size[1], se...
# Copyright 2015 PerfKitBenchmarker 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...
# coding:utf8 # author:GXR from app import app from flask_script import Manager manage = Manager(app) if __name__ == '__main__': # app.run() manage.run()
from __future__ import division, absolute_import, print_function import numpy as np from numpy.compat import long from numpy.testing import ( TestCase, assert_, assert_equal, assert_array_equal, run_module_suite ) from numpy.lib.type_check import ( common_type, mintypecode, isreal, iscomplex, isposinf, isn...
# -*- coding: utf-8 -*- import networkx as nx import numpy as np from utils import sparse_to_tuple import scipy.sparse as sp class Graph(): def __init__(self,edgelist,weighted,directed,labelfile,featurefile): self.edgelist = edgelist self.weighted = weighted self.directed = directed ...
import os import pandas as pd import numpy as np import pickle import logging, shutil, glob import pymongo, joblib from Fuzzy_clustering.ver_tf2.Clusterer import clusterer from Fuzzy_clustering.ver_tf2.Cluster_predict_regressors import cluster_predict from Fuzzy_clustering.ver_tf2.Global_predict_regressor import global...
# -*- coding: utf-8 -*- """ An execution module which can manipulate an f5 bigip via iControl REST :maturity: develop :platform: f5_bigip_11.6 """ # Import python libs from __future__ import absolute_import, print_function, unicode_literals # Import salt libs import salt.exceptions import salt.utils...
#!/usr/bin/env python # # Copyright (c) 2013 Eric Romano (@gelstudios) # released under The MIT license (MIT) http://opensource.org/licenses/MIT # """ gitfiti noun : Carefully crafted graffiti in a GitHub commit history calendar """ from datetime import datetime, timedelta import itertools import json import math try...
"""Decoder definition for transformer-transducer models.""" import torch from espnet.nets.pytorch_backend.transducer.blocks import build_blocks from espnet.nets.pytorch_backend.transducer.joint_network import JointNetwork from espnet.nets.pytorch_backend.transducer.utils import check_state from espnet.nets.pytorch_ba...
# coding: utf-8 """ App Center Client Microsoft Visual Studio App Center API # noqa: E501 OpenAPI spec version: preview Contact: benedetto.abbenanti@gmail.com Project Repository: https://github.com/b3nab/appcenter-sdks """ from __future__ import absolute_import import unittest import appcente...
from datetime import datetime from django.db import models from django.contrib.auth.models import User class Day(models.Model): """ A day containing logged meals and foods """ date = models.DateField(default=datetime.now) user = models.ForeignKey(User, null=False, on_delete=models.CASCADE) class Food(m...
from datetime import timedelta from waldur_core.core import WaldurExtension class SupportExtension(WaldurExtension): class Settings: WALDUR_SUPPORT = { # wiki for global options: https://opennode.atlassian.net/wiki/display/WD/Assembly+plugin+configuration 'ENABLED': False, ...
# # MIT License # # Copyright (c) 2020-2021 NVIDIA CORPORATION. # # 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, ...
{ 'targets': [ { 'target_name': 'lib', 'type': 'static_library', 'sources': ['lib.cc'], 'arflags': ['--nonexistent'], }, ], }
def iter_ngram(seq, max_order, min_order=None, sent_start=None, sent_end=None): if min_order > max_order: raise ValueError("min_order > max_order (%d > %d)" % (min_order, max_order)) if min_order is None: min_order = max_order orders = range(min_order, max_order+1) it = iter(seq) ...
from ..imports import * from .. import utils as U from .preprocessor import ImagePreprocessor def show_image(img_path): """ Given file path to image, show it in Jupyter notebook """ if not os.path.isfile(img_path): raise ValueError('%s is not valid file' % (img_path)) img = plt.imread(img_...
#!/usr/bin/env python3 # Copyright (c) 2016 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test the bumpfee RPC. Verifies that the bumpfee RPC creates replacement transactions successfully when its ...
# Generated by Django 3.1.2 on 2020-10-25 15:42 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('regions', '0002_auto_20201025_1128'), ] operations = [ migrations.AlterModelOptions( name='region', options={'ordering': ('n...
# # Copyright (c) 2020 Idiap Research Institute, http://www.idiap.ch/ # Written by Angelos Katharopoulos <angelos.katharopoulos@idiap.ch>, # Apoorv Vyas <avyas@idiap.ch> # import os from os import getenv import time import unittest import torch from torch.nn.init import normal_ from fast_transformers.aggregate impor...
''' # TASK 5 - Write a function that takes a string and a shift integer and returns the string with each letter shifted - you can iterate over the letters in a string - for letter in str: ''' def get_shifted_string(string, shift): ''' return the input string with each letter shifted shift steps ''' raise ...
# coding: utf-8 # https://hskhsk.pythonanywhere.com # Alan Davies alan@hskhsk.com import sys import threading import time from flask import Flask, render_template from pages.cidian import cidian_page from pages.deprecated import frequency_order_word_link, frequency_order_char_link from pages.flashcards import flashca...
import os import random import numpy as np import pandas as pd import torch import torch.utils.data as data from PIL import Image from torchvision import transforms import settings # import transforms DATA_DIR = settings.DATA_DIR TRAIN_DIR = DATA_DIR + '/train-640' TEST_DIR = DATA_DIR + '/test-640' def pil_load(i...
# Copyright (c) Facebook, Inc. and its affiliates. import torch import torch.distributed as dist from fvcore.nn.distributed import differentiable_all_reduce from torch import nn from torch.nn import functional as F from ..utils import comm, env from .wrappers import BatchNorm2d class FrozenBatchNorm2d(nn.Module): ...
from __future__ import absolute_import from math import log, ceil from myhdl import Signal, intbv, always_seq from . import MemoryMapped class AXI4Lite(MemoryMapped): def __init__(self, glbl, data_width=8, address_width=16): """ """ super(AXI4Lite, self).__init__(glbl, ...
# -*- coding: utf-8 -*- # Generated by Django 1.10.5 on 2017-03-29 00:55 from __future__ import unicode_literals from django.db import migrations import wagtail.core.blocks import wagtail.core.fields import wagtail.embeds.blocks import wagtail.images.blocks class Migration(migrations.Migration): dependencies = ...
from typing import * import re LOWER_ERROR = "Only dictionaries and lists can be modified by this method." def apply_deep(data: Union[Mapping, List], fun: Callable) -> Union[dict, list]: ''' Applies fun to all keys in data. The method is recursive and applies as deep as possible in the dictionary nest. ...
from flask import Flask, request from flask_restful import Resource, Api app = Flask(__name__) api = Api(app) class Greeting (Resource): def get(self): return 'Hello Python World! from Indrani' api.add_resource(Greeting, '/') # Route_1 if __name__ == '__main__': app.run('0.0.0.0','3333')
# -*- coding: utf-8 -*- import datetime from typing import AsyncIterator, List, Union from related import BooleanField, ChildField, IntegerField, StringField, immutable from .._api_helper import FilterType from .._endpoints import DATA_ATTENDANCE from ..model import ( DateTime, Serializable, Subject, ...
""" Django settings for {{cookiecutter.project_name}} project. Generated by 'django-admin startproject' using Django 3.0.7. For more information on this file, see https://docs.djangoproject.com/en/3.0/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/3.0/ref/setti...
from docopt import docopt from appdirs import AppDirs try: from urlparse import urlparse except ImportError: from urllib import parse as urlparse import sys import os import shutil import time import logging from psiopic2.app.baseApp import Arg, BaseApp from psiopic2.app.baseApp import BASE_OPTIONS from psiopic2...
# Copyright 2013-2022 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 Sicm(CMakePackage): """SICM: Simplified Interface to Complex Memory.""" homepage = "h...
# Copyright (c) 2014 Pure Storage, 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 re...
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: mediapipe/util/tracking/tracking.proto """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as _refle...
from torch.nn.functional import one_hot from operations.base import Operator class OneHot(Operator): def __init__(self, dim=-1, non_zero_values_only=False): self.dim = dim self.non_zero_values_only = non_zero_values_only super().__init__() def forward(self, indices, depth, values): ...
import logging from blspy import PrivateKey from stai.cmds.init_funcs import check_keys from stai.util.keychain import Keychain from pathlib import Path from typing import Any, Dict, List, Optional, cast # Commands that are handled by the KeychainServer keychain_commands = [ "add_private_key", "check_keys", ...
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. from abc import ABC, abstractmethod from typing import Dict, Pattern, Optional, List from decimal import Decimal, getcontext import regex from recognizers_text.utilities import RegExpUtility from recognizers_text.extractor ...
from django import forms from .models import * class ProfileForm(forms.ModelForm): class Meta: model=Profile exclude=['username'] class BlogPostForm(forms.ModelForm): class Meta: model=BlogPost exclude=['username','neighborhood','profpic'] class CommentForm(forms.ModelForm): class Meta: ...
"""Implement the Yandex Smart Home toggles capabilities.""" from __future__ import annotations from abc import ABC import logging from typing import Any from homeassistant.components import cover, fan, media_player, vacuum from homeassistant.const import ATTR_ENTITY_ID, ATTR_SUPPORTED_FEATURES from homeassistant.core...
""" Responsible for cryptographic operations. """ # PyCrypto needs to be installed for Crypto to work import tkMessageBox from Crypto.Cipher import AES from Crypto import Random import hashlib import base64 # Pads data def pad(data): BS = 16 # Block Size r = data + (BS - len(data) % BS) * chr(BS - len(data) ...
from . import db from werkzeug.security import generate_password_hash, check_password_hash from flask_login import UserMixin from . import login_manager from datetime import datetime @login_manager.user_loader def load_user(user_id): return User.query.get(int(user_id)) class User(UserMixin, db.Model): __tab...
# 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 os import csv import pprint import math import decimal with open(os.path.join("Resources","election_data.csv"), "r") as in_file: in_csv = csv.reader(in_file) header = next(in_csv) # activating this will exculede the firs line. data = list(in_csv) # print(data) ################################...
import numpy as np import ipdb from scipy.stats import wilcoxon, ttest_rel # MNIST mi_attack = [90.000000, 87.575768, 81.515160, 90.909088, 84.848480, 88.787872, 89.090904] di_attack = [90.606056, 90.000000, 85.454552, 91.818176, 88.484856, 89.696968, 0.606071] tid_attack = [90.000000, 83.939...
# Generated by Django 2.2 on 2021-03-21 19:39 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ('auth', '0011_update_proxy_permissions'), ] operations = [ migrations.CreateModel( name='UserProfile', ...
import subprocess import sys from scream import detect_changed_packages from scream.package import Package, PackageDoesNotExistException from .install import install def deploy_packages(all_packages=None, package_name=None): """ Run a deploy script. For packages that have changed or if your dependencies ...
import os import glob import pandas as pd class BaseReader(): """ Implements several verifications and utilities for handling spectral files. """ def __init__(self): pass def check_file_if_exists(self,filepath): """ Verifies that a required file exists. """ ...
import os import sys from typing import Iterable, Union, Dict, Tuple, List, Callable, TypeVar, Optional, Any, cast import numpy as np from pathlib import Path from loguru import logger from pathos.pools import ProcessPool import itertools import pickle import random from dpu_utils.codeutils import split_identifier_into...
import numpy as np from scipy.integrate import solve_ivp def HS_ode(t,y,HS): rhs = -HS.gamma*y + HS.lambda_value(y) return rhs def at_HS_equilibrium(t,y,HS,tol = 1e-3): val = np.linalg.norm(HS_ode(t,y,HS)) - tol if val < 0: return 0 else: return val def simulate_HS(x0,HS,max_time...
from expression_evaluator.token import * class Concatenate(BasicOperator): symbols = ['||'] priority = PriorityLevel.String @classmethod def _function(cls, a, b,*args): result=u'{0}{1}'.format(a, b) for arg in args: result=u'{0}{1}'.format(result, arg) return result
import os def main(): try: while True: while True: mode = input('Mode: ').lower() if 'search'.startswith(mode): mode = False break elif 'destroy'.startswith(mode): mode = True ...
""" # Copyright: (c) OpenSpug Organization. https://github.com/openspug/spug # Copyright: (c) <spug.dev@gmail.com> # Released under the MIT License. Django settings for spug project. Generated by 'django-admin startproject' using Django 2.2.7. For more information on this file, see https://docs.djangoproject.com/en/...
""" simple demo for using the PyMol RPC server Author: Greg Landrum (Landrum@RationalDiscovery.com) Created: February 2004 $LastChangedDate: 2009-02-01 14:02:14 -0500 (Sun, 01 Feb 2009) $ License: PyMol Requires: - a python xmlrpclib distribution containing the SimpleXMLRPCServer ...
import uuid from typing import List, Optional from django import urls from django.conf import settings from django.contrib.contenttypes import fields as contenttypes_fields from django.contrib.postgres import fields as postgres_fields from django.core.validators import MaxLengthValidator from django.db import models f...
from asyncio import sleep, CancelledError, wait_for, TimeoutError from pytest import mark, raises from dagather import Dagather, PropagateError, ContinueResult, CancelPolicy, Abort, sibling_tasks, SiblingTaskState from dagather.exceptions import CycleError, DiscardedTask atest = mark.asyncio @atest async def test_...
from cuml.manifold import TSNE from sklearn.manifold.t_sne import trustworthiness from sklearn import datasets import pandas as pd import numpy as np import cudf import pytest dataset_names = ['digits', 'boston', 'iris', 'breast_cancer', 'diabetes'] @pytest.mark.parametrize('name', dataset_names) d...
from __future__ import absolute_import from sage.libs.pynac.pynac import I i = I from .ring import SR from .constants import (pi, e, NaN, golden_ratio, log2, euler_gamma, catalan, khinchin, twinprime, mertens, glaisher) from .expression import Expression, solve_diophantine, hold from .callable ...
import random from unittest.mock import patch import cv2 import pytest import numpy as np import imgaug as ia import albumentations as A import albumentations.augmentations.functional as F from .utils import OpenMock TEST_SEEDS = (0, 1, 42, 111, 9999) def set_seed(seed): random.seed(seed) np.random.seed(se...
# -*- coding: utf-8 -*- # Copyright 2018 New Vector 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 la...
#!/usr/bin/env python # -*- coding: utf-8 -*- # File: train.py import argparse import itertools import numpy as np import os import cv2 import six import shutil assert six.PY3, "FasterRCNN requires Python 3!" import tensorflow as tf import tqdm import tensorpack.utils.viz as tpviz from tensorpack import * from tenso...
# Copyright 2018-2021 Xiang Yu(x-yu17(at)mails.tsinghua.edu.cn) # # 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 .base_options import BaseOptions class TrainOptions(BaseOptions): """This class includes training options. It also includes shared options defined in BaseOptions. """ def initialize(self, parser): parser = BaseOptions.initialize(self, parser) # visdom and HTML visualization para...
import tkinter as tk import tkinter.ttk as ttk win = tk.Tk() regular_button = ttk.Button(win, text="regular button") small_button = ttk.Button(win, text="small button", style="small.TButton") big_button = ttk.Button(win, text="big button", style="big.TButton") big_dangerous_button = ttk.Button(win, text="big dangerou...
""" File: newton.py Project 6.9 Compute the square root of a number (uses recursive function with default second parameter). 1. The input is a number, or enter/return to halt the input process. 2. The outputs are the program's estimate of the square root using Newton's method of successive approximations, and ...
# Copyright 2021 Google # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, soft...
fields = { 100000201 : [100000205, 2], 103000003 : [103000008, 1], 102000003 : [102000004, 1], 101000003 : [101000004, 2], # 120000101 : [100000205, 2], } currentMap = sm.getFieldID() if currentMap == 120000101:# Pirates sm.chatBlue("[WIP] no MapID for Hall of Pirates") elif currentMap in fields: sm.warp(field...
# Copyright 2019 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 dataclasses import typing import logging from google.cloud import datastore from google.protobuf import json_format from chromeperf.pinpoint.actions ...
# Copyright (c) 2012 OpenStack Foundation. # # 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...
import dataclasses import enum import typing import dacite @dataclasses.dataclass class IgnoreArea: x: int = None y: int = None width: int = None height: int = None @dataclasses.dataclass class TestRun: name: str = None imageBase64: str = None os: str = None browser: str = None ...
from flask_jwt_extended import JWTManager from flask_restful import Api from user_service.application import app from user_service.resources.user import User as UserResource, UserList from user_service.resources.auth import UserAuth api = Api(app) jwt = JWTManager(app) @app.route('/') def hello_world(): return ...
#!/usr/bin/python # -*- coding:utf-8 -*- import os import os.path import logging import logging.handlers import sqlite3 import tweepy import requests from six.moves.urllib.request import urlretrieve from six.moves.urllib.parse import urlencode DB_FILENAME = 'aladin.db' LOG_FILENAME = 'aladin.log' ALADIN_ITEM_ENDPOI...
import tensorflow as tf import numpy as np from keras.engine import data_adapter from matplotlib import cm def colorize_img(value, vmin=None, vmax=None, cmap='jet'): """ A utility function for TensorFlow that maps a grayscale image to a matplotlib colormap for use with TensorBoard image summaries. By defa...
""" ASGI config for es project. It exposes the ASGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/3.1/howto/deployment/asgi/ """ import os from django.core.asgi import get_asgi_application os.environ.setdefault('DJANGO_SETTINGS_M...
from .defaults import get_cfg_defaults from .utils import *
"""A class for a normal form game""" from itertools import product import numpy as np from scipy.optimize import linprog from scipy.spatial import HalfspaceIntersection def build_halfspaces(M): """ Build a matrix representation for a halfspace corresponding to: Mx <= 1 and x >= 0 This is of the...
from __future__ import with_statement from contextlib import contextmanager @contextmanager def Switch(): D = {} class _P(Exception): pass def _mkCase(var): class _PP(_P): V = var def __repr__(self): return str(self.V) D[var]=_PP return _PP ...
"""Platform for Flexit AC units with CI66 Modbus adapter.""" from __future__ import annotations import logging import voluptuous as vol from homeassistant.components.climate import ( PLATFORM_SCHEMA, ClimateEntity, ClimateEntityFeature, ) from homeassistant.components.climate.const import HVAC_MODE_COOL ...
# Copyright (c) 2011 Zadara Storage Inc. # Copyright (c) 2011 OpenStack Foundation # 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....
import pathlib import argparse usage_string = '''Welcome to Olymptester! Usage: > olymptester run|test|init [-d dirname] [-p path/to/app] [-t path/to/tests]''' def path(s): return pathlib.Path(s).absolute() def validate_paths(d): if d['mode'] in ['run', 'test']: workdir = path(d['workdir'...
#!/usr/bin/env python # Copyright 2015-2016 Yelp 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 ...
import socket from time import sleep class PLC(): def __init__(self, typePLC, IP_address, Port): self.typePLC = typePLC self.dest = (IP_address, Port) self._setPLC() client = socket.socket(socket.AF_INET, socket.SOCK_STREAM) subheader = '5000' network_number = '00' destinat...