text
stringlengths
2
999k
#!/usr/bin/env python # Copyright 2010 Allan Saddi <allan@saddi.com> # # 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 ...
"""MSSDK 是基于 Python 的为麦思多维科技客户服务的专用 API 接口""" """ 0.0.1: 发布测试版本 v0.0.1 0.0.2: 发布测试版本 v0.0.2 0.0.3: 发布测试版本 v0.0.3 0.0.4: 发布测试版本 v0.0.4 0.0.5: 发布测试版本 v0.0.5 0.0.6: 发布测试版本 v0.0.6 0.0.7: 发布测试版本 v0.0.7 0.0.8: 发布测试版本 v0.0.8 0.0.9: 发布测试版本 v0.0.9 0.0.10: 发布测试版本 v0.0.10 0.0.11: 发布测试版本 v0.0.11 0.0.12: 发布测试版本 v0.0.12 """ __vers...
# -*- coding: utf-8 -*- from flask import make_response, jsonify from flask_restful import Resource from .definitions import UDFTypen __license__ = "Apache License, Version 2.0" __author__ = "Sören Gebbert" __copyright__ = "Copyright 2018, Sören Gebbert, mundialis" __maintainer__ = "Soeren Gebbert" __email__ = "soeren...
import os import time from pathlib import Path from unittest.mock import patch import horovod.torch as hvd_torch import pytest import ray import ray.util.sgd.v2 as sgd import tensorflow as tf import torch from ray._private.test_utils import wait_for_condition from ray.util.sgd.v2 import Trainer, TorchConfig, Tensorflo...
""" Command list: bucket select [<name> | <uuid>] bucket create <name> bucket list [all | deleted] bucket rm [<name> | <uuid>] bucket restore [<name> | <uuid> | all] bucket clean [-f] [<name> | <uuid> | all] """ from scidb.core import Database, Bucket from typing import List, Set, Union import scidb.client.global_env...
#!/usr/bin/env python ##################################### # Installation module for nmap-dev ##################################### # AUTHOR OF MODULE NAME AUTHOR="Mauro Risonho de Paula Assumpcao (firebits), updated by Russ Swift (0xsalt)" # DESCRIPTION OF THE MODULE DESCRIPTION="This module will install/update Nma...
from abc import ABCMeta, abstractproperty, abstractmethod import six from dagster import check from dagster.core.definitions.config import ConfigMapping from dagster.core.types.field_utils import check_user_facing_opt_field_param from dagster.core.errors import DagsterInvalidDefinitionError from dagster.utils import ...
# MIT LICENSE # # Copyright 1997 - 2020 by IXIA Keysight # # 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,...
# coding: utf-8 """ Qc API Qc API # noqa: E501 The version of the OpenAPI document: 3.0.0 Contact: cloudsupport@telestream.net Generated by: https://openapi-generator.tech """ from __future__ import absolute_import import unittest import datetime import telestream_cloud_qc from telestream_cl...
# -*- coding: utf-8 -*- __author__ = 'huangpeng' class AGList(list): def each(self, func): for a in self: func(a) return self def map(self, func): return map(func, self) def filter(self, func): return filter(func, self) class AGDict(dict): def each(self,...
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' ***************************************** Author: zhlinh Email: zhlinhng@gmail.com Version: 0.0.1 Created Time: 2016-03-24 Last_modify: 2016-03-24 ****************************************** ''' ''' Write an algorithm to determine if a numbe...
import tensorflow as tf import os from datetime import datetime import rfc3339 import grpc import api_pb2 import api_pb2_grpc import sys from logging import getLogger, StreamHandler, INFO class TFEventFileParser: def find_all_files(self, directory): for root, dirs, files in tf.gfile.Walk(directory): ...
import json import decimal import boto3 import os from boto3.dynamodb.types import TypeDeserializer from datetime import datetime client = boto3.client('firehose') comprehend_client = boto3.client('comprehend') FIREHOSE_STREAM_NAME = os.environ['FIREHOSE_STREAM_NAME'] def lambda_handler(event, context): record_co...
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import unittest os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' import numpy as np import tensorflow as tf import tensorlayer as tl from tests.utils import CustomTestCase class Layer_Merge_Test(CustomTestCase): @classmethod def setUpClass(cls): pas...
#!/usr/bin/env python # coding: utf-8 from setuptools import find_packages, setup if __name__ == '__main__': with open('README.md') as file: long_description = file.read() packages = find_packages(exclude=['tests']) package_data = {package: ['py.typed'] for package in packages} setup( ...
from django.contrib.auth.backends import ModelBackend from ratelimitbackend.backends import RateLimitMixin from .profiles.models import User from .utils import is_email class CaseInsensitiveModelBackend(ModelBackend): def authenticate(self, username, password, request): try: user = User.obje...
# Copyright (c) 2021 PaddlePaddle 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...
import os import pickle os.chdir("C:\\Users\Augusto\Desktop\Python-Studies\College") os.getcwd() man = [] other = [] try: with open('man_data.txt', 'wb') as man_file: pickle.dump(man, man_file) with open('other_man_data.txt', 'wb') as other_file: pickle.dump(other, other_file) except IOError ...
# Copyright 2018 The TensorFlow Probability 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...
# Copyright 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 in...
#! /usr/bin/python ''' Running Support Vector Regression Model. ''' from __future__ import print_function import os import sys import pandas as pd from sklearn.svm import SVR from sklearn import cross_validation import numpy as np import matplotlib.pyplot as plt from datetime import datetime from skl...
## ## # # SOFTWARE HISTORY # # Date Ticket# Engineer Description # ------------ ---------- ----------- -------------------------- # 09/10/14 #3623 randerso Manually created, do not regenerate # ## class DeactivateSiteRequest(object): def __init__(s...
import math def swap(arr, i, j): arr[i], arr[j] = arr[j], arr[i] def selection_sort(a, lo, hi): for i in range(lo, hi): m = i for j in range(i, hi): if a[j] < a[m]: m = j swap(a, i, m) def bubble_sort(a, lo, hi): for i in range(lo, hi): for j...
from abc import ABC from optimus.helpers.functions import match_date from optimus.engines.base.meta import Meta from optimus.helpers.types import * from optimus.helpers.columns import parse_columns from optimus.helpers.constants import ProfilerDataTypes from optimus.helpers.core import val_to_list, one_list_to_val fro...
""" WSGI config for config project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/3.2/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application os.environ.setdefault('DJANGO_SETTIN...
"""scrapli.factory""" import importlib from copy import deepcopy from io import BytesIO from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union, cast from scrapli.driver import AsyncGenericDriver, AsyncNetworkDriver, GenericDriver, NetworkDriver from scrapli.driver.core import ( AsyncEOSDriver, ...
""" Loads raw prediction data from npy files to train model """ import os import keras import numpy as np from sklearn.model_selection import train_test_split from scripts.zhymir_scripts.task2 import make_ensemble, add_checkpoint, train_model from utils.file import load_from_json model_config = load_from_json('.....
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html import sphinx_rtd_theme # -- Path setup -----------------------------------------------...
from ariadne.objects import ObjectType from dataloaders import UserByIdLoader, OnPathwayByIdLoader from dataloaders import MilestoneByDecisionPointLoader from models import Milestone, DecisionPoint from graphql.type import GraphQLResolveInfo from typing import Union, List DecisionPointObjectType = ObjectType("Decision...
#!/usr/bin/env python __author__ = "bt3" '''To use timeit you create a Timer object whose parameters are two Python statements. The first parameter is a Python statement that you want to time; the second parameter is a statement that will run once to set up the test. The timeit module will then time how long it takes...
# Copyright 2017 Battelle Energy Alliance, LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed t...
from rest_framework import authentication, exceptions from rest_framework.authentication import get_authorization_header from django.utils.translation import ugettext_lazy as _ from .models import Token class TokenAuthentication(authentication.BaseAuthentication): """ Simple token based authentication. Cl...
# -*- coding: utf-8 -*- # 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...
# Copyright 2000-2020 JetBrains s.r.o. # Use of this source code is governed by the Apache 2.0 license that can be found # in the LICENSE file. """projector-installer setup file.""" import sys from shutil import copyfile, rmtree from os.path import isfile, join from os import remove from typing import List from setup...
class Decorator: """Clase de decorador simple.""" def __init__(self, a,b): self.a = a self.b = b def suma(self): print(self.a+self.b) self.c=self.a*self.b def resta(self): print(self.c) elvis=Decorator(10,5) elvis.resta()
"""Small, fast HTTP client library for Python. Features persistent connections, cache, and Google App Engine Standard Environment support. """ from __future__ import print_function __author__ = "Joe Gregorio (joe@bitworking.org)" __copyright__ = "Copyright 2006, Joe Gregorio" __contributors__ = [ "Thomas Broyer ...
import discord import logging from datetime import datetime def dateformat(dtime=None): """Formats a date. Args: dtime: The datetime. If None, this will be the current time. """ if dtime is None: dtime = datetime.now() return dtime.strftime("%Y-%m-%d %H:%M:%S") def init_logging(...
from cv2 import cv2 as cv import numpy as np from Pincel import Pincel from Cor import Cor desenhando = False cor = Cor(0, 0, 0) pincel = Pincel(0, 0, cor, 0) def nada(x): pass def desenho(event, x, y, flags, param): global pincel,cor,desenhando pincel.x = x pincel.y = y if event == cv.EVENT_LBU...
from contextlib import contextmanager from logging import getLogger, Logger from typing import Iterator, Tuple, ClassVar from sqlalchemy import create_engine from sqlalchemy.orm import Session as sqlaSession, sessionmaker from sqlalchemy.pool import StaticPool from .base import Base class Database: """ A simpli...
# -*- coding: utf-8 -*- # Generated by Django 1.10.3 on 2016-11-28 07:43 from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ migrations.swappable_depende...
#!/usr/bin/env python # SPDX-License-Identifier: Apache-2.0 import os import io from onnx import defs, load, AttributeProto from onnx.backend.test.case import collect_snippets from onnx.backend.test.runner import Runner from onnx.backend.test.loader import load_model_tests from typing import Any, IO, Sequence, Dict,...
import os import sys import shutil import re import sys from pathlib import Path from settings import IGNORE_PATTERN, EMPTY_LABEL, logger, enable_debug from compat import input def add_label_transaction(path, label=EMPTY_LABEL): if not path.name.endswith(label): new_path = Path(path.parent, path.name + ...
from prologlib.ui import Console console = Console() console.solveloop()
import qsort from nose import tools fixture_lsts = [ [1, 2, 3, 4], [1, 2, 4, 3], [1, 3, 2, 4], [1, 3, 2, 3], [4, 2, 3, 1], [1, 4, 3, 2], [3, 2, 1, 4], [3, 2, 2, 4], [3, 1, 1, 3], [1, 1, 1, 1], [1, 2, 1, 1], [1, 2, 3], [1, 3, 2], [2, 1, 3], [2, 3, 1], [3, 1, 2], [3, 2, 1], [3, 2, 3], [3, 1, 1], [], ...
#!/usr/bin/env python # -*- coding: utf-8 -*- def parse_elementary_attributes(records): # record = (process, RIP, API_call) n_RIP = len(records) API_calls = [] processes = [] for record in records: process = record[0] if not process in processes: processes.append(pr...
# -*- coding: utf-8 -*- """ Test du Stanford NER tagger avec les modèles CRF d'Europeana entrainés sur des journaux : http://lab.kbresearch.nl/static/html/eunews.html La fonction est lente --> songer au multiprocessing """ import warnings with warnings.catch_warnings(): warnings.filterwarnings("ignore",category=De...
import torch from torch.optim import SGD from d3rlpy.models.torch.v_functions import create_value_function from d3rlpy.models.torch.policies import squash_action, create_normal_policy from d3rlpy.models.torch.policies import create_categorical_policy from .utility import torch_api, train_api, eval_api from .utility im...
#!/usr/bin/python import os import shutil import numpy as np #------------------------------------------------------------- #-------------Change script here------------------------------ #------------------------------------------------------------- os.system("source ../../../../Session_1/export_aims_metadata.sh") os...
""" sphinx.builders ~~~~~~~~~~~~~~~ Builder superclass for all builders. :copyright: Copyright 2007-2020 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. """ import pickle import time from os import path from typing import Any, Dict, Iterable, List, Sequence, Set, Tuple, T...
############################################################################### # # Tests for XlsxWriter. # # Copyright (c), 2013-2020, John McNamara, jmcnamara@cpan.org # from ..excel_comparsion_test import ExcelComparisonTest from ...workbook import Workbook class TestCompareXLSXFiles(ExcelComparisonTest): """...
# Generated by Django 2.2.5 on 2019-10-14 11:17 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('poem_super_admin', '0001_initial'), ] operations = [ migrations.RemoveField( model_name='metrictemplate', name='cloned', ...
import unittest from collections import Counter from data_structures.sumtree.sumtree import SumTree class SumTreeTest(unittest.TestCase): @staticmethod def _create_and_initialize_sumtree() -> SumTree: sumtree = SumTree(capacity=10) for idx in range(1, 11): sumtree.add(idx, chr(96...
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT from ..petpvc import PETPVC def test_PETPVC_inputs(): input_map = dict( alpha=dict( argstr="-a %.4f", usedefault=True, ), args=dict( argstr="%s", ), debug=dict( argstr="-d"...
import numpy as np import torch from torch import nn as nn from rlkit.policies.base import Policy from rlkit.torch.core import eval_np from rlkit.torch.distributions.tanh_normal import TanhNormal class TanhPolicy(Policy, nn.Module): def __init__( self, module, return_raw_actio...
# Compatible with ranger 1.6.0 through 1.7.* # # This is a sample plugin that displays "Hello World" in ranger's console after # it started. from __future__ import absolute_import, division, print_function # We are going to extend the hook "ranger.api.hook_ready", so first we need # to import ranger.api: import range...
# Generated by Django 2.2.15 on 2020-08-03 16:21 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Produto', fields=[ ('id', models.AutoField...
# -*- coding: utf-8 -*- from django.db import models, migrations from django.conf import settings import devilry.devilry_gradingsystem.models class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('core', '0001_initial'), ] o...
from pyspark.sql import SparkSession logFile = "README.md" # Should be some file on your system spark = SparkSession.builder.appName("SimpleApp").getOrCreate() logData = spark.read.text(logFile).cache() numAs = logData.filter(logData.value.contains('a')).count() numBs = logData.filter(logData.value.contains('b')).co...
#!/usr/bin/env python # -*- coding: utf-8 -*- # Example # ============================================================================= # # # You can access main configuration module or better create your own in the # config module: # # from core.config.settings import DEMO_MUSIC_DIR # # # Simple command exampl...
#!/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 ...
# 作者:西岛闲鱼 # https://github.com/globien/easy-python # https://gitee.com/globien/easy-python # 用蒙特卡洛法计算圆周率,即,往一个正方形里扔豆子,计算有多少比例的豆子扔在了该正方形的内切圆中 import random num_all = 0 #随机点总计数器 num_cir = 0 #随机点在圆内的计数器 num_halt = 10000000 #每产生这么多个随机点后,计算并打印一次目前的结果 print("将进行无限计算,请用Ctrl_C或其他方式强制退出!!!") input("按回车(Enter...
""" Django settings for examplewebsite project. Generated by 'django-admin startproject' using Django 3.0.3. 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/settings/ """ impor...
"""Functions for loading/saving Klampt' objects to disk in the same format as the Klampt C++ bindings / JSON formats. Can read/write objects using the general purpose reader/writer functions 'read(type,text)' and 'write(x,type)'. Can load/save objects using the general purpose loader/saver functions 'load(type,fileNa...
import math def encryption(s): row = math.floor(math.sqrt(len(s))) col = math.ceil(math.sqrt(len(s))) if row*col==len(s): pass elif row*col<len(s): row=col elif row*col>len(s): if row*row>=len(s): col=row # # print(row,col) matrix=[[None for i in ra...
from gnn.argparser import parse_arguments from utils import load_adjacency_matrix, get_device from gnn.dataset import TrafficDataset from torch.utils.data import DataLoader from gnn import models import torch.optim as optim from run import run_epoch import optuna import logging import inspect import re from datetime im...
import os import numpy as np import pandas as pd import tensorflow as tf from numpy.random import seed from preprocess import * from utils import * import argparse from sklearn.metrics import adjusted_rand_score, normalized_mutual_info_score from sklearn import metrics import scipy.io as scio seed(1) tf.random.set_see...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Copyright (c) 2018-2021 mundialis GmbH & Co. KG 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 Unl...
from environs import Env # environs kutubxonasidan foydalanish env = Env() env.read_env() # .env fayl ichidan quyidagilarni o'qiymiz BOT_TOKEN = env.str("BOT_TOKEN") # Bot token ADMINS = env.list("ADMINS") # adminlar ro'yxati IP = env.str("ip") # Xosting ip manzili
import os from unittest import TestCase from checkov.terraform.graph_builder.variable_rendering.evaluate_terraform import evaluate_terraform, replace_string_value, \ remove_interpolation class TestTerraformEvaluation(TestCase): def test_directive(self): input_str = '"Hello, %{ if "d" != "" }named%{ e...
import json import responses from pbpstats.data_loader.live.boxscore.file import LiveBoxscoreFileLoader from pbpstats.data_loader.live.boxscore.loader import LiveBoxscoreLoader from pbpstats.data_loader.live.boxscore.web import LiveBoxscoreWebLoader from pbpstats.resources.boxscore.live_boxscore_item import LiveBoxsc...
import abc import ctypes import itertools import numpy as np from petsc4py import PETSc from pyop2 import ( caching, configuration as conf, datatypes as dtypes, exceptions as ex, mpi, profiling, sparsity, utils ) from pyop2.types.access import Access from pyop2.types.data_carrier impor...
# Copyright (c) 2021, salesforce.com, inc. # All rights reserved. # SPDX-License-Identifier: BSD-3-Clause # For full license text, see the LICENSE file in the repo root # or https://opensource.org/licenses/BSD-3-Clause import argparse import logging import os import sys import time import ray from utils import remote...
from flask_unchained.bundles.controller import ( controller, func, include, prefix, resource, rule) from .views import (SiteController, ProductController, simple, UserResource, RoleResource, AnotherResource) explicit_routes = lambda: [ controller('/', SiteController, rules=[ rule(...
# Copyright 2016, 2017 John J. Rofrano. 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable ...
# The MIT License (MIT) # # Copyright (c) 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...
# Copyright 2016 Johns Hopkins University (Dan Povey) # 2016 Vijayaditya Peddinti # 2017 Google Inc. (vpeddinti@google.com) # 2017 Vimal Manohar # Apache 2.0. """ This module contains layers that just map to a single component. """ from __future__ import print_function import...
#!/usr/bin/env python # -*- coding: utf-8 -*- """Process data and generates some comparison results. Synopsis: python path_to_folder/bbob_pproc/runcompall.py [OPTIONS] FOLDER_NAME... Help: python path_to_folder/bbob_pproc/runcompall.py -h """ from __future__ import absolute_import, print_function...
import os.path def main(): fname = input("Enter The Name Of File:") while not os.path.exists(fname): print(fname, "Doesn't Exists, Kindly Enter a valid file name") fname = input("Enter The Name Of File:") with open(fname, "rt") as fobj: lines = fobj.readlines() numOfLines ...
from __future__ import absolute_import, division, print_function, unicode_literals import unittest import torch from tests.utils import jitVsGlow class TestAdd(unittest.TestCase): def test_add_basic(self): """Basic test of the PyTorch add Node on Glow.""" def test_f(a, b): c = a.add...
"""Main module for the streamlit app""" import streamlit as st import awesome_streamlit as ast import src.pages.dashboard_instagram_post import src.pages.instagram_stories import src.pages.home ast.core.services.other.set_logging_format() PAGES = { "Instagram Posts": src.pages.dashboard_instagram_post, "Insta...
import FWCore.ParameterSet.Config as cms import os ############################################################################## # customisations for L1 ntuple generation # # Add new customisations to this file! # # Example usage : # cmsDriver.py testNtuple -s NONE --customise=L1Trigger/L1TNtuples/customiseL1Ntuple...
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import os from pathlib import Path from typing import Any, List import optuna from hydra.core.override_parser.overrides_parser import OverridesParser from hydra.core.plugins import Plugins from hydra.plugins.sweeper import Sweeper from hydra.test_u...
# Copyright The PyTorch Lightning team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
#!/usr/bin/env python3 import warnings import torch def psd_safe_cholesky(A, upper=False, out=None, jitter=None): """Compute the Cholesky decomposition of A. If A is only p.s.d, add a small jitter to the diagonal. Args: :attr:`A` (Tensor): The tensor to compute the Cholesky decomposition ...
#! /usr/bin/env python # Copyright 2009 Google Inc. All Rights Reserved. # Copyright 2014 Altera Corporation. All Rights Reserved. # Copyright 2014-2018 John McGehee # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may ...
# Copyright 2014 The Crashpad 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 applicabl...
from .base import BaseGroup from .root import RootGroup import inspect class ContextManagerGroup(BaseGroup): """ A group that gathers tests with a context manager. """ def __enter__(self): self.is_collecting = True frame = inspect.currentframe(1) self.spec = RootGroup.from_fram...
# Copyright (c) 2013 Bull. # # 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, sof...
from logging import Logger from time import sleep from fixtures.constants import Errors, Objects from fixtures.models.register import RegisterData import pytest import logging logger: Logger = logging.getLogger("moodle") class TestRegistration: def test_registration_with_valid_data(self, app, user_data): ...
# Django from django.utils.translation import ugettext_lazy as _ # AWX from awx.conf import fields, register from awx.api.fields import OAuth2ProviderField from oauth2_provider.settings import oauth2_settings register( 'SESSION_COOKIE_AGE', field_class=fields.IntegerField, min_value=60, max_value=300...
import pathlib from multiprocessing import Lock, Process, JoinableQueue from tqdm import tqdm from utils import * OUTPUT_DIR = RESULTS_DIR + "active_learning_topk" logger = logging.getLogger(__name__) process_lock = Lock() def main_accuracy_topk(args: argparse.Namespace, sample=True, eval=True, plot=True) -> None...
############################################################################### # Tested so far: # # DhcpGetClientInfoV4 # DhcpV4GetClientInfo # # Not yet: # # ################################################################################ import unittest import ConfigParser import socket from impacket.dcerpc.v...
import socketserver class MyUDPHandler(socketserver.BaseRequestHandler): """ This class works similar to the TCP handler class, except that self.request consists of a pair of data and client socket, and since there is no connection the client address must be given explicitly when sending data back ...
# Copyright (c) 2021 PaddlePaddle 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 appl...
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import torch class _InfiniteSampler(torch.utils.data.Sampler): """Wraps another Sampler to yield an infinite stream.""" def __init__(self, sampler): self.sampler = sampler def __iter__(self): while True: ...
# Generated by Django 2.2.9 on 2020-01-23 06:36 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("warehouse", "0001_initial"), ] operations = [ migrations.AlterField( model_name="warehouse", name="company_name", ...
import numpy as np import cv2 import pyrealsense2 as rs import pyqtgraph.colormap from pyqtgraph.Qt import QtCore, QtGui import pyqtgraph.opengl as gl import sys # Initialise OpenGL app app = QtGui.QApplication(sys.argv) def get_pointcloud(depth_image, color_frame, img, img_size): point_cloud = rs...
age = input('Insert your age: ') print(age) # exibe a entrada print(type(age)) # tipo string newAge = int(age) + 5 # converter para inteiro para calcular print(type(int(age))) # tipo convertido print(newAge) # imprimir o resultado
from pathlib import Path from coltrane.retriever import get_content_items def test_location(settings, tmp_path: Path): settings.BASE_DIR = tmp_path (tmp_path / "content").mkdir() (tmp_path / "content/test.md").write_text("test data") actual = get_content_items() assert len(actual) == 1 asse...
from __future__ import absolute_import from __future__ import division from torchvision.transforms import * from PIL import Image import random import numpy as np class Random2DTranslation(object): """ With a probability, first increase image size to (1 + 1/8), and then perform random crop. Args: -...