text
stringlengths
1
927k
from viewer.models import Face import os import shutil SIZES = (120, 160, 320, 640, 1000) SIZENAMES = ("thumb", "small", "medium", "large", "huge") for face in Face.objects.filter(id__gte=1536): # if not face.image.name.startswith("f/img/mlfw"): print(str(face.id) + ": " + face.image.name) #namepart = fac...
#! /usr/bin/env python # TODO: Convert key exchange protocol part into function to reduce # repetition of code. import threading import time import sys import network from diffie_hellman import DiffieHellman from crypto_protocol import CryptoProtocol def usage(): print "Usage:" print " " + sys.argv[0] + ...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # filters.py # # Authors: # - Mamadou CISSE <mciissee.@gmail.com> # from django.contrib.auth import get_user_model from django_filters import rest_framework as filters from django.db.models import Q User = get_user_model() class UserFilter(filters.FilterSet):...
# **************************************************************************** # Copyright 2018 The Apollo 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 # # ht...
# This module contains all the Windows-specific code to create native # message boxes using the winapi. # If you'd like to learn more about calling the winapi functions from # Python, you can check out my other module "nicewin" to see nicely-documented # examples. It is at https://github.com/asweigart/nicewin # The d...
import pandas as pd import random import statistics import logging logger = logging.getLogger(__name__) # MonkeyPatch Python 3.6 choices into random 3.5.5 import bisect as _bisect import itertools as _itertools def choices(population, weights=None, cum_weights=None, k=1): """Return a k sized list of population ...
import sys try: data = sys.argv[1].replace(r'\x', '') except: print(f"[+] Enter you shellcode as the first argument") print(f"[+] Example:") print("\t" + r'python3 ./script.py "\xeb\x1a\x31\xc0\x31\xdb\x5e\x88\x46\x07\x89\x46\x08\x89\x46\x0c\x89\xf3\xb0\x0b\x8d..."') sys.exit(1) data = bytes.fromh...
#! /usr/bin/env python3 # -*- coding: utf-8 -*- import sys from common.Utilities import get_code, error_exit from ast import ASTGenerator import Extractor import Oracle import Logger import Filter import Emitter def slice_code_from_trace(diff_info, trace_list, path_a, path_b): Logger.trace(__name__ + ":" + sys....
import datetime import itertools import unittest from copy import copy from django.db import ( DatabaseError, IntegrityError, OperationalError, connection, ) from django.db.models import Model from django.db.models.deletion import CASCADE from django.db.models.fields import ( AutoField, BigIntegerField, Binary...
import os import io from keras_autodoc import utils from . import dummy_package def test_import_object(): assert os.path.join == utils.import_object('os.path.join') assert io.BytesIO.flush == utils.import_object('io.BytesIO.flush') assert dummy_package == utils.import_object('tests.dummy_package')
#!/usr/bin/env python # -*- coding: utf-8 -*- from runner.koan import * class AboutControlStatements(Koan): def test_if_then_else_statements(self): if True: result = 'true value' else: result = 'false value' self.assertEqual('true value', result) def test_if_t...
from .dmixmatch import DMixMatch from .dmix_tuning import DMixTuning from .fine_tuning import FineTuning from .fixmatch import FixMatch from .self_tuning import SelfTuning __all__ = [ 'DMixMatch', 'FixMatch', 'FineTuning', 'DMixTuning', 'SelfTuning' ]
import tkinter as tk from os import listdir from os.path import isfile, join from pages.StartPage import StartPage from pages.ConfigurationPage import ConfigurationPage from pages.TrainingPage import TrainingPage from pages.ResultPage import ResultPage from pages.ChooseDatePage import ChooseDatePage from pages.ChooseIn...
import torch.nn as nn import torch import torch.nn.functional as F import torchvision.models import os import utils.network_utils from utils.pointnet2_utils import PointNetSetAbstraction,PointNetFeaturePropagation import cuda.emd.emd_module as emd # Set the path for pretrain weight os.environ['TORCH_HOME'] = '/media...
import os import sys import ast import astor import unittest from scalpel.core.mnode import MNode from scalpel.SSA.const import SSA code_str = """ b = 10 if b>0: a = a+b else: a = 10 print(a) """ def main(): mnode = MNode("local") mnode.source = code_str mnode.gen_ast() cfg = mnode.gen_cfg() ...
"""Metadata Module. Source repository: https://github.com/awslabs/aws-data-wrangler Documentation: https://aws-data-wrangler.readthedocs.io/ """ __title__: str = "awswrangler" __description__: str = "Pandas on AWS." __version__: str = "2.12.1" __license__: str = "Apache License 2.0"
from rlpython.utils.argument_parser import ReplArgumentParser from rlpython.utils.table import write_table class LonaConnectionsCommand: """ List all current connections to Lona """ NAME = 'lona_connections' def __init__(self, repl): self.repl = repl def run(self, argv): # p...
import os import sys import logging from app.config import config logging.basicConfig(format=config.LOGGER_FORMAT) def get_level(level): return { 'CRITICAL': logging.CRITICAL, 'DEBUG': logging.DEBUG, 'ERROR': logging.ERROR, 'FATAL': logging.FATAL, 'INFO': logging.INFO, ...
#! /usr/bin/env python from distutils.core import setup from setuptools import find_packages import sys # python2 and python3 support try: reload except NameError: # py3k has unicode by default pass else: reload(sys).setdefaultencoding('utf-8') setup( name='django-tabbed-admin', version='1.0....
"""Tests for dials.merge command line program.""" import procrunner import pytest from cctbx import uctbx from dxtbx.model.experiment_list import ExperimentListFactory from iotbx import mtz from dials.array_family import flex def validate_mtz(mtz_file, expected_labels, unexpected_labels=None): assert mtz_file...
def validate_subseuence(arr, seq): arr_idx=0 seq_idx=0 while(arr_idx<len(arr) and seq_idx<len(seq)): if arr[arr_idx]== seq[seq_idx]: seq_idx+=1 arr_idx+=1 return seq_idx==len(seq) print(validate_subseuence([1,2,3,4,5,6], [2,4,6])) print(validate_subseuence([1,2,3,4,5,6], [4...
import torch import torch.nn as nn import torch.nn.functional as F from torch.distributions import Categorical class Policy(nn.Module): def __init__(self, s_size=4, h_size=8, a_size=2): super(Policy, self).__init__() self.fc1 = nn.Linear(s_size, h_size) self.fc2 = nn.Linear(h_size,...
# Copyright 2017 Rackspace US, 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 writin...
class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None # O(n) time | O(Log(n)) space def maxPathSum(tree): _, maxSum =findMaxSum(tree) return maxSum def findMaxSum(tree): if tree is None: return (0, 0) leftMaxSumAsBranch, leftMax...
#!/home/debian/server_synth/venv/bin/python3 """Django's command-line utility for administrative tasks.""" import os import sys def main(): os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'server.settings') try: from django.core.management import execute_from_command_line except ImportError as exc...
# _*_ coding:utf-8 _*_ # !/usr/bin/env python from __future__ import absolute_import, division, print_function, unicode_literals import numpy as np import logging import nltk from nltk.corpus import stopwords from gensim.models.wrappers import FastText from gensim.models import Word2Vec import random import threading i...
import unittest from test import test_support, test_genericpath import posixpath, os from posixpath import realpath, abspath, dirname, basename # An absolute path to a temporary filename for testing. We can't rely on TESTFN # being an absolute path, so we need this. ABSTFN = abspath(test_support.TESTFN) def skip_if...
import time from struct import pack from electrum.i18n import _ from electrum.util import PrintError, UserCancelled from electrum.keystore import bip39_normalize_passphrase from electrum.bitcoin import serialize_xpub class GuiMixin(object): # Requires: self.proto, self.device messages = { 3: _("Conf...
# Copyright 2020 QuantumBlack Visual Analytics 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 # # THE SOFTWARE IS PROVIDED "AS IS",...
# Copyright (c) 2018, NVIDIA CORPORATION. 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...
""" The OGRGeometry is a wrapper for using the OGR Geometry class (see https://gdal.org/api/ogrgeometry_cpp.html#_CPPv411OGRGeometry). OGRGeometry may be instantiated when reading geometries from OGR Data Sources (e.g. SHP files), or when given OGC WKT (a string). While the 'full' API is not present yet, the API ...
"""Support for displaying IPs banned by fail2ban.""" from __future__ import annotations from datetime import timedelta import logging import os import re import voluptuous as vol from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity from homeassistant.const import CONF_FILE_PATH, CONF_NAME from h...
# Copyright 2020 Google Research. 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...
# modify from https://github.com/rosinality/stylegan2-pytorch/blob/master/op/upfirdn2d.py # noqa:E501 import os import torch from torch.autograd import Function from torch.nn import functional as F BASICSR_JIT = os.getenv('BASICSR_JIT') if BASICSR_JIT == 'True': from torch.utils.cpp_extension import load mod...
from flask_wtf import Form from wtforms import StringField, IntegerField from wtforms.fields.html5 import EmailField from wtforms.validators import * class CreateMonkeyForm(Form): name = StringField('name', validators=[DataRequired()]) age = IntegerField('age', validators=[DataRequired()]) email = EmailFi...
# -*- coding: utf-8 -*- """ Created on Fri Apr 9 09:50:42 2021 @author: Zeyu """ import serial import time from data_gen import data_checkout,raw_data_checkout if __name__ == '__main__': try: ser = serial.Serial('COM12', 115200) except: print('Serial Connection Failed, Will Try Again in 3 SE...
"""Module for airplane schema""" from marshmallow import fields from .base.base_schema import BaseSchema from ..utilities.helpers.common_schema_args import common_schema_args from ..utilities.validators.string_length_validator import \ string_length_validator, empty_string_validator from ..utilities.validators.n...
#!/usr/bin/env vpython # Copyright 2015 The LUCI Authors. All rights reserved. # Use of this source code is governed under the Apache License, Version 2.0 # that can be found in the LICENSE file. import test_env from recipe_engine import recipe_api, config RECIPE_PROPERTY = recipe_api.BoundProperty.RECIPE_PROPERTY ...
from __future__ import print_function, division import os import sys import subprocess def class_process(dir_path, dst_dir_path, class_name): class_path = os.path.join(dir_path, class_name) if not os.path.isdir(class_path): return dst_class_path = os.path.join(dst_dir_path, class_name) if not os.path.exis...
# Import your libraries import pandas as pd # Start writing code Grouped = airbnb_contacts.groupby('id_guest').sum().reset_index().sort_values(by=['n_messages'], ascending =False) Grouped['ranking'] = Grouped['n_messages'].rank(method='dense',ascending =False) Grouped
import logging, time from abc import ABC from itertools import count from enum import Enum from datetime import datetime, timedelta from typing import Callable import attr from .observable import ObservableMixin, Event @attr.s class Trigger(object): n_items = count(0) tgid = attr.ib(init=False, factory=n_item...
# Copyright 2018 Tensorforce Team. 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 la...
import pytest import mxnet as mx import numpy as np from mxfusion.models import Model from mxfusion.components.variables.runtime_variable import is_sampled_array, get_num_samples from mxfusion.components.distributions import ConditionalGaussianProcess from mxfusion.components.distributions.gp.kernels import RBF from mx...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Copyright 2017 The Procyon 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 # # Un...
from django.contrib.auth.base_user import BaseUserManager from django.utils.translation import ugettext_lazy as _ class CustomUserManager(BaseUserManager): def create_user(self, nick, email, password, first_name, last_name, **extra_fields): """ Create and save a User with the given nickname, email...
#!/usr/bin/env python # -*- encoding: utf-8 -*- # Copyright (c) "Neo4j" # Neo4j Sweden AB [http://neo4j.com] # # This file is part of Neo4j. # # 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 #...
import pytest from pip._vendor.packaging.tags import Tag from pip._internal import pep425tags from pip._internal.exceptions import InvalidWheelFilename from pip._internal.models.wheel import Wheel class TestWheelFile(object): def test_std_wheel_pattern(self): w = Wheel('simple-1.1.1-py2-none-any.whl') ...
# Copyright 2020-2021 Cambridge Quantum Computing # # 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 a...
""" q44.py ~~~~~~ Check Balanced: Implement a function to check if a binary tree is balanced. For the purposes of this question, a balanced tree is defined to be a tree such that the heights of the two subtrees of any node never differ by more than one. Hints: #21, #33, #49, #105, #124 """ impo...
# coding: utf-8 """ Influx API Service No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 OpenAPI spec version: 0.1.0 Generated by: https://openapi-generator.tech """ import pprint import re # noqa: F401 import six class Flux...
# VMware vCloud Python SDK # Copyright (c) 2014-2018 VMware, 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 # # U...
import logging from django.core.management import BaseCommand from django.db import connection log = logging.getLogger(__name__) class Command(BaseCommand): help = "Cleans up old and useless post views and history to save DB space" def handle(self, *args, **options): # cleanup anonymous post_views ...
import logging import sys from pathlib import Path import ujson from loguru import logger from app.extension.logging.interceptHandler import InterceptHandler class CustomizeLogger: @classmethod def make_logger(cls): config_path = "logging_config.json" config = cls.load_logging_config(config_...
from mock_decorators import setup, teardown from threading import Thread import socket import time stop_client_thread = False client_thread = None @setup('Simple echo server') def setup_echo_server(e): global stop_client_thread global client_thread def echo_client_thread(): server_address = socket...
#!/usr/bin/python3 import os from pathlib import Path import pytest from brownie.project.scripts import run # browniemix is parametrized with every mix repo from https://www.github.com/brownie-mix/ def test_mixes(plugintesterbase, project, tmp_path, rpc, browniemix): path = Path(project.from_brownie_mix(browni...
import biorbd import numpy as np from bioptim import OdeSolver, CostType, RigidBodyDynamics from bioptim import Solver, DefectType from humanoid_2d import Humanoid2D, Integration, add_custom_plots, HumanoidOcp, HumanoidOcpMultiPhase def torque_driven_dynamics(model: biorbd.Model, states: np.array, controls: np.arra...
import smtplib from email import encoders from email.header import Header from email.mime.base import MIMEBase from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText from email.utils import parseaddr, formataddr class SmtpKeys(object): SMTP_HOST = 'smtp_host' SMTP_PORT = 'smtp_por...
# -*- coding: utf-8 -*- """Tests for the Config class.""" from click.testing import CliRunner from made import cli import pytest @pytest.fixture def runner(): """TODO.""" return CliRunner() def test_cli(runner): """Tests that the cli can be launched.""" result = runner.invoke(cli.cli) assert ...
from __future__ import absolute_import # this file was generated by infoObjectGenerator.py. # this file should not be edited by hand. import weakref from warnings import warn from fontTools import ufoLib from defcon.objects.base import BaseObject from copy import copy from functools import partial def _guidelineDepre...
from . import get_connector, get_engine import pandas as pd def get_dataframe(table_name, limit=None): # limit query limit_query="" if limit: limit_query="limit {}".format(limit) # create query query = "SELECT * FROM {} {}".format(table_name, limit_query) # get dataframe from sql qu...
""" MIT License Copyright (c) 2021 UltronRoBo 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, di...
from django.http import HttpResponseRedirect from django.shortcuts import render, get_object_or_404 from django.urls import reverse from django.core.files.storage import FileSystemStorage from django.contrib.auth.decorators import login_required from .models import MincePie, Review from .forms import MincePieForm, Rev...
#LetterFrequency.py #This program will create a CSV file of frequencies based on a text file. #Use Excel or similar spreadsheet software to visualize the frequencies of the CSV file. import os def countLetters(message): dir_path = os.path.dirname(os.path.realpath(__file__)) os.chdir(dir_path) alpha = "AB...
import pandas as pd import json class Element: def __init__(self, name, abrivation, atomic_number, atomic_mass, period, group): self.name = name self.abrivation = abrivation self.atomic_number = atomic_number self.atomic_mass = atomic_mass self.period = period #row self.gro...
# -*- coding: utf-8 -*- """ wechatpy.events ~~~~~~~~~~~~~~~~ This module contains all the events WeChat callback uses. :copyright: (c) 2014 by messense. :license: MIT, see LICENSE for more details. """ from __future__ import absolute_import, unicode_literals from wechatpy.fields import ( Stri...
# coding: utf-8 # three_body_2d.py """ Use Docstrings like this so that help() can give useful output. These can be multi-line, that's nice ;-) Simple 3-body simulation constrained to 2D """ # run it at os command line: # osprompt> py three_body_2d.py # v8 - adjusted to run in pythonista # v7 - put previous ...
import setuptools with open("README.md", "r") as fh: long_description = fh.read() setuptools.setup( name="xlnet", version="0.0.1", author="zihangdai", author_email="zander.dai@gmail.com", description="XLNet: Generalized Autoregressive Pretraining for Language Understanding", long_descripti...
# -*- coding: utf-8 -*- """Family module for Wiktionary.""" # # (C) Pywikibot team, 2005-2020 # # Distributed under the terms of the MIT license. # from __future__ import absolute_import, division, unicode_literals from pywikibot import family from pywikibot.tools import classproperty # The Wikimedia family that is ...
# coding: utf-8 from tornado.web import RequestHandler class Base(RequestHandler): def initialize(self): self.log = self.application.settings['logger']
"""REST API Module using AppLogger""" import json import logging from flask import Flask, jsonify import sys import os sys.path.append(os.path.join(os.getcwd(),'monitoring')) from src.logger import AppLogger component_name ="API_2" app = Flask(component_name) logging_config_file_path = os.path.join(os.getcwd(),'mon...
from typing import Tuple class Clock: MINS_PER_HOUR = 60 HOURS_PER_DAY = 24 def __init__(self, hour: int, minute: int) -> None: nhours, nmins = self.__normalize(hour, minute, self.MINS_PER_HOUR) _, nhours = self.__normalize(0, nhours, self.HOURS_PER_DAY) self.hours = nhours ...
import torch.nn as nn import torchvision import copy import torch import numpy as np from .bnneck import BNClassifier, Classifier, Classifier_without_bias from torch.autograd import Variable def weights_init_kaiming(m): classname = m.__class__.__name__ if classname.find('Linear') != -1: nn.init.kaiming...
#!/usr/bin/env python # coding: utf8 # # Copyright (c) 2021 Centre National d'Etudes Spatiales (CNES). # # This file is part of PANDORA_MCCNN # # https://github.com/CNES/Pandora_MCCNN # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the Licens...
""" This is an example of how it is possible to spawn multiple bfx ws instances to comply with the open subscriptions number constraint (max. 25) (https://docs.bitfinex.com/docs/requirements-and-limitations) """ import sys sys.path.append('../../../') import asyncio import json from datetime import datetime from func...
# pylint: disable=invalid-name """ Template formatting helpers """ from datetime import datetime import locale import re from django import template from django.utils.safestring import mark_safe from django.utils.timesince import timesince locale.setlocale(locale.LC_ALL, '') register = template.Library() @registe...
#Exercício Python 017: Faça um programa que leia o comprimento do cateto oposto e do cateto adjacente de um triângulo retângulo # Calcule e mostre o comprimento da hipotenusa. from math import hypot co = float(input("Cateto oposto:")) ca = float(input("Cateto adjacente:")) hi = hypot(co,ca) print(hi)
# aws-pcf-quickstart # # Copyright (c) 2017-Present Pivotal Software, Inc. All Rights Reserved. # # This program and the accompanying materials are made available under # the terms of the under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Sep 17 20:43:41 2019 @author: anilosmantur """ import numpy as np import matplotlib.pyplot as plt from sklearn.neighbors import KNeighborsClassifier from sklearn.preprocessing import MinMaxScaler from sklearn import metrics from pylab import rcParams r...
from .conf import settings from . import conffile from .utils import get_resource import logging import os.path import shutil import json import time APP_NAME = 'plex-mpv-shim' log = logging.getLogger('video_profile') class MPVSettingError(Exception): """Raised when MPV does not support a required setting.""" ...
"""CSC148 Assignment 2 === CSC148 Winter 2020 === Department of Computer Science, University of Toronto This code is provided solely for the personal and private use of students taking the CSC148 course at the University of Toronto. Copying for purposes other than this use is expressly prohibited. All forms of distri...
from discord.ext import commands ''' Copyright (c) 2020 nizcomix https://github.com/niztg/CyberTron5000 under the terms of the MIT LICENSE ''' def check_admin_or_owner(): def predicate(ctx): if ctx.message.author.id == 670564722218762240: return True elif ctx.message.author.permission...
#!/usr/bin/env python # coding=utf-8 # chrome 60 + chromedriver 2.31 import os import random import sys import time import commands import argparse import requests import mysql.connector from requests.adapters import HTTPAdapter from selenium import webdriver from selenium.webdriver import ActionChains from selenium...
from cgi import test import torch from torchvision import transforms import torchvision.models as models from torch.utils import data from sklearn.neighbors import KNeighborsClassifier from sklearn.metrics.pairwise import cosine_similarity from scipy.spatial.distance import cdist from PIL import Image import pandas as...
# Copyright 2018 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 os import StringIO import unittest from telemetry import story from telemetry import benchmark from telemetry.internal.results import html_output_for...
DATABASE = 'data/say_what.db' BILL_TEXT_ROOT = 'data/bills/'
# coding: utf-8 """ Cisco Intersight OpenAPI specification. The Cisco Intersight OpenAPI specification. OpenAPI spec version: 1.0.9-1461 Generated by: https://github.com/swagger-api/swagger-codegen.git """ from pprint import pformat from six import iteritems import re class RecoveryBackupPro...
# 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
import logging from django.db import IntegrityError from django.http import HttpResponse from django.contrib.auth import authenticate, login from django.urls import resolve from oauthlib.oauth1 import SignatureOnlyEndpoint from oauthlib.common import urlencode from urllib.parse import urlparse from django_lti_login.val...
import xml.etree.ElementTree as ET import copy from Model import * def Read_cm_header(fileName): portsLst = [] flg = False f = open(fileName, 'r') while True: line = f.readline() if not line: break # find ports if(line.strip() == "// [Region] Ports"): flg = ...
import numpy as np from operator import truediv def AA_andEachClassAccuracy(confusion_matrix): counter = confusion_matrix.shape[0] list_diag = np.diag(confusion_matrix) # 对角线 list_raw_sum = np.sum(confusion_matrix, axis=1) each_acc = np.nan_to_num(truediv(list_diag, list_raw_sum)) average_acc = n...
# # This file is part of pyasn1 software. # # Copyright (c) 2005-2019, Ilya Etingof <etingof@gmail.com> # License: http://snmplabs.com/pyasn1/license.html # import sys try: import unittest2 as unittest except ImportError: import unittest from tests.base import BaseTestCase from pyasn1.type import tag from py...
from numpy import ndarray from fastai.torch_imports import * from fastai.core import * from matplotlib.axes import Axes from fastai.dataset import FilesDataset, ImageData, ModelData, open_image from fastai.transforms import Transform, scale_min, tfms_from_stats, inception_stats from fastai.transforms import CropType, N...
from django.http import HttpResponse from django.shortcuts import render # Create your views here. from rest_framework.views import APIView from rest_framework.response import Response from libs.captcha.captcha import captcha from django_redis import get_redis_connection from verifications.serializers import Register...
# Copyright (C) 2018-2021 Intel Corporation # # SPDX-License-Identifier: MIT import errno import io import os import os.path as osp from django.db.models import query import pytz import shutil import traceback import uuid from datetime import datetime from distutils.util import strtobool from tempfile import mkstemp, ...
import typer import os from pathlib import Path from typing import List, Optional from nb_prep.files import ( find_files_in_paths, insert_commithash_filename_placeholder, ) from nb_prep._utils import git_version from nb_prep.nb_convert_strip import convert_notebook app = typer.Typer() @app.command() def re...
numbers = sorted((map(int, input().split()))) print(min(numbers[0], numbers[1]) * min(numbers[2], numbers[3]))
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT from __future__ import unicode_literals from ..convert import Shredder def test_Shredder_inputs(): input_map = dict(args=dict(argstr='%s', ), chunksize=dict(argstr='%d', position=2, units='NA', ), environ=dict(nohash=True, usedefaul...
import locale import random from typing import List import CynanBotCommon.utils as utils from CynanBotCommon.cuteness.cutenessResult import CutenessResult from CynanBotCommon.trivia.absTriviaQuestion import AbsTriviaQuestion from CynanBotCommon.trivia.triviaScoreResult import TriviaScoreResult from CynanBotCommon.triv...
from plotly.basedatatypes import BaseTraceHierarchyType import copy class XBins(BaseTraceHierarchyType): # end # --- @property def end(self): """ Sets the end value for the x axis bins. The last bin may not end exactly at this value, we increment the bin edge by `size` ...
# Copyright 2020 Amazon.com, Inc. or its affiliates. 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. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the 'license' file acc...