text
stringlengths
2
999k
from filebeat import BaseTest from beat.beat import INTEGRATION_TESTS import os import unittest import glob import subprocess from elasticsearch import Elasticsearch import json import logging from parameterized import parameterized from deepdiff import DeepDiff # datasets for which @timestamp is removed due to date ...
from abc import ABC, abstractmethod import ctypes from .libnodave import _LibNoDave from .common import DaveArea from .buffer import DaveBuffer class PyNoDave(ABC): def __init__(self): super().__init__() self._libnodave_c = _LibNoDave() self._libnodave = _LibNoDave().libnodave ...
import cv2 import numpy as np # Gray scale def BGR2GRAY(img): b = img[:, :, 0].copy() g = img[:, :, 1].copy() r = img[:, :, 2].copy() # Gray scale out = 0.2126 * r + 0.7152 * g + 0.0722 * b out = out.astype(np.uint8) return out # emboss filter def emboss_filter(img, K_size=3): H, W, C = img.shape # zero p...
# -*- coding: utf-8 -*- # © 2015-2018, ETH Zurich, Institut für Theoretische Physik # Author: Dominik Gresch <greschd@gmx.ch> """ Defines the function to serialize and deserialize pytest-score objects to JSON. """ import numbers from functools import singledispatch import numpy as np from ._score import ScoreSheet,...
from elixir import (Entity, OneToMany, Field, Unicode, Integer, Enum, Float) from draughtcraft.model.deepcopy import ShallowCopyMixin class InvalidStatistic(Exception): pass class Style(Entity, ShallowCopyMixin): TYPES = [ 'LAGER', 'ALE', 'MEAD', 'CIDER' ] uid = Fie...
# coding: utf-8 """ FreeClimb API FreeClimb is a cloud-based application programming interface (API) that puts the power of the Vail platform in your hands. FreeClimb simplifies the process of creating applications that can use a full range of telephony features without requiring specialized or on-site teleph...
from typing import Any from optuna.integration._lightgbm_tuner.optimize import _imports from optuna.integration._lightgbm_tuner.optimize import LightGBMTuner from optuna.integration._lightgbm_tuner.optimize import LightGBMTunerCV # NOQA if _imports.is_successful(): from optuna.integration._lightgbm_tuner.sklear...
"""Definitions for the base Cranelift language."""
# -*- coding: utf-8 -*- #Plotting is on python since this will make it much easier to debug and adjsut #no need to recompile everytime i change graph color.... #needs a serious refactor from matplotlib import pyplot as plt import numpy as np from .nputil import mid, minmax, vector_apply from util import parse_arg, de...
from abc import ABC, abstractmethod import numpy as np from numpy.lib.function_base import diff import torch as th import torch.distributed as dist def create_named_schedule_sampler(name, diffusion): """ Create a ScheduleSampler from a library of pre-defined samplers. :param name: the name of the sample...
from collections import ( OrderedDict, ) from collections.abc import ( Hashable, ) from typing import ( Any, Callable, Dict, Iterator, List, Mapping, MutableMapping, Optional, Sequence, Type, TypeVar, Union, cast, ) from eth_utils import ( is_integer, ) ...
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
# Copyright (c) 2006,2007 Mitch Garnaat http://garnaat.org/ # # 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, modi...
# Generated by Django 2.0.5 on 2018-08-22 14:17 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('team', '0117_merge_20180809_1021'), ('team', '0122_auto_20180821_1319'), ] operations = [ ]
print('hello test1.664664664664664664')
# Copyright 2014 OpenStack Foundation. # 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 req...
import argparse import random import sys from pathlib import Path from typing import Tuple import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from torch import optim from torch.optim.optimizer import Optimizer from torch.utils.data import DataLoader from torchvision import datasets, ...
# -*- coding: utf-8 -*- """ Copyright (c) 2017 beyond-blockchain.org. 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 l...
# 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 ...
from setuptools import setup, find_packages from pip.req import parse_requirements from pip.download import PipSession from setuptools.command.test import test as TestCommand class PyTest(TestCommand): def finalize_options(self): TestCommand.finalize_options(self) self.test_args = [] self.t...
''' Make a password generator that generates a random password of desired length specified by user input. For example: Enter desired password length>> 7 hY@rSdA ''' import random import string import argparse import sys def create_character_list(args): """Create the list of allowed characters to generate passwo...
import requests import time import json import hmac import hashlib from models.log import setup_custom_logger class Session(): def __init__(self, key, secret, base_url, api_url): self.key = key self.secret = secret self.base_url = base_url self.api_url = api_url self.logger...
import pylab as plt import numpy as np from astrometry.util.fits import * from glob import glob import os import subprocess import fitsio import hashlib base = '/global/cfs/cdirs/cosmo/work/legacysurvey/dr9m/south/' outdir = 'fix-wise-psfdepth' pat = base + 'tractor/*/tractor-*.fits' print('Searching for', pat) fns = ...
######################### ## Imports. ######################### import datetime # Obligatory OpenSAFELY import. from cohortextractor import ( StudyDefinition, patients, codelist, codelist_from_csv, codelist ) # Import codelists.py script. from codelists import * # Import study_parameters. #/////import study_par...
def input_dig(): x=True while x: n = input("digite um número: ") x = n.isalpha() n = int(n) print(x) def input_str(): x=True while x: n =input ( "digite uma letra: ") x= n.isdigit() n= str(n) print(x)
from __future__ import absolute_import from itertools import chain from bokeh.models.annotations import ( Legend, Arrow, BoxAnnotation, Span, LabelSet, Label, Title ) from bokeh.models import ColumnDataSource, ArrowHead from bokeh.core.enums import NamedColor as Color, LineJoin, LineCap, TextAlign FILL = ["fill...
# [project]: # [branch]: # [timeout]: # [test_case_name]: # [test_case_id]: # [test_case_description]: # encoding = utf-8 from ATScripts.ATSrc.ATImpl.ATAcutor.BaseTestCase import CATBaseCase from ATScripts import ATAPI as AT from ATScripts.ATCommon.apiutil import StepDesc import time ''' precondition: 地图关闭,后台杀死中,VA:...
""" This is the latest, and most correct version! """ def isMatch2(s, p): # Tokenize the pattern into groups based on match groups # ex. a?b*cde will be split into a list consisting of ["a", "?", "b*", "cde"] groups = tokenize_pattern(p) index = 0 matched_group = [] # The elements in this list wi...
formatter = "{} {} {} {}" #Python takes the formittor string car = 'bmw' #this formatter.format pass to format, four arguments to match up for four {} print(formatter.format("bmw", "audi", 2 , 3)) # you would alsways needs to have 4 variable #to replace all four {} in formatter print(f"love {car}") one_four = '1,...
from __future__ import print_function import codecs import os import pprint import time from collections import defaultdict from itertools import chain import numpy as np from nltk.tokenize import word_tokenize import torch import torch.nn as nn import torch.optim as optim from torch.autograd import Variable # TODO...
""" mbed SDK Copyright (c) 2016 ARM 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 Unless required by applicable law or agreed to in writing, so...
# Copyright 2013 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. ''' TraceEventImporter imports TraceEvent-formatted data into the provided model. This is a port of the trace event importer from https://code.google.com/p/tr...
from tkinter import * from os import path from tkinter import filedialog from tkinter import Menu from tkinter import ttk from tkinter import scrolledtext from tkinter import messagebox import os #from sintactico import ejecutar_analisis import reportes.RealizarReportes import reportes.reportesimbolos as rs from Ins...
# -*- coding: utf-8 -*- {{{ # vim: set fenc=utf-8 ft=python sw=4 ts=4 sts=4 et: # Copyright (c) 2015, Battelle Memorial Institute # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # 1. Redistri...
# -*- coding: utf-8 -*- import logging from types import FunctionType import wx from classes.ui import UIManager from classes.ui import UIControllerObject from classes.ui import MainWindowController from app import log from app.app_utils import GripyBitmap class ToolBarToolController(UIControllerObject): tid ...
import yaml device_list = [ {"device_name": 'Cisco3', "hostname": 'cisco3.lasthop.io', "username": 'admin', "password": 'secret123'}, {"device_name": 'Cisco4', "hostname": 'cisco4.lasthop.io', "username": 'admin', "password": 'secret123'}, {"device_name": 'Arista1', "hostname": 'arista1.lasthop.io', "username": 'admin'...
import fauxmo, logging, time from debounce_handler import debounce_handler logging.basicConfig(level=logging.DEBUG) # Device callback functions class device_handler(debounce_handler): """Publishes the on/off state requested, and the IP address of the Echo making the request. """ TRIGGERS = {"device...
from main import * # Tables saving monster information name/health/attack. imp_scout = Trash(name='Imp Scout', health=2, attack=1).save() goblin_scout = Trash(name='Goblin Scout', health=4, attack=1).save() goblin_thug = Trash(name='Goblin Thug', health=5, attack=2).save() goblin_archer = Trash(name='Goblin Archer', ...
import datetime from warnings import warn from jwt import ExpiredSignatureError, InvalidTokenError, InvalidAudienceError try: from flask import _app_ctx_stack as ctx_stack except ImportError: # pragma: no cover from flask import _request_ctx_stack as ctx_stack from flask_jwt_extended.config import config fro...
# Copyright 2012 Nebula, 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...
# encoding=utf8 # This is temporary fix to import module from parent folder # It will be removed when package is published on PyPI import sys sys.path.append('../') # End of fix from niapy.algorithms.modified import SelfAdaptiveBatAlgorithm from niapy.task import StoppingTask from niapy.benchmarks import Griewank # ...
# -*- coding: utf-8 -*- # # Copyright: (c) 2019, F5 Networks Inc. # GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import (absolute_import, division, print_function) __metaclass__ = type import os import json import pytest import sys if sys.version_info < (2...
from helpers import gatherSubNodesD, getNodeKind import re def fixIndents( nodes ): prefix = "" for sub_node in gatherSubNodesD( nodes ): if getNodeKind( sub_node ) == "DEDENT": space_rgx = re.compile( r"(.*?)( +)(\n*)$", re.S ) m = space_rgx.match( sub_node.prefix ) ...
while True: a = int(input()) if a == 0: break print(a,end=" ") if a < 1896: print("No summer games") elif a in (1916,1940,1944): print("Games cancelled") elif a > 2020 and a%4 == 0: print("No city yet chosen") elif a % 4 == 0: print("Summer Olympics") ...
import itertools import numpy as np from nengo.exceptions import ValidationError from nengo.transforms import ChannelShape, Convolution from nengo_loihi.compat import is_transform_type class ImageSlice: """Represents a slice of a larger image across rows/columns/channels. Parameters ---------- full...
# -*- coding: utf-8 -*- """ Created on Sat Jun 20 14:15:24 2020 @author: fcosta Francisco Costa García University of Stuttgart(c) Here we calculate the uncertainties related with components in the `photonics` module. - noise definintions: - Photodetector: H. Rongqing, “Introduction to Fiber-Optic Com...
from dotenv import load_dotenv from twitchio.ext import commands import os load_dotenv() # Set up the bot. bot = commands.Bot( irc_token=os.environ['TMI_TOKEN'], client_id=os.environ['CLIENT_ID'], nick=os.environ['BOT_NICK'], prefix=os.environ['BOT_PREFIX'], initial_channels=[os.enviro...
"""Environment for training the acceleration behavior of vehicles in a loop.""" import numpy as np from flow.core import rewards from flow.envs.loop.loop_accel import AccelEnv from flow.multiagent_envs.multiagent_env import MultiEnv class MultiAgentAccelEnv(AccelEnv, MultiEnv): """Adversarial multi-agent env. ...
from event_testing.tests import TunableTestVariant from interactions.utils.tunable_icon import TunableIcon from sims4.localization import TunableLocalizedStringFactory from sims4.tuning.tunable import Tunable, TunableTuple, TunableList, TunableReference from sims4.tuning.tunable_base import ExportModes import services ...
def binary_search(arr, x): low = 0 high = len(arr) - 1 mid = 0 while low <= high: mid = (high + low) // 2 # Check if x is present at the mid if arr[mid] < x: low = mid + 1 # If x is greater, ignore the left half elif arr[mid] > x: ...
# MONK AND ROTATIONS for _ in range(int(input())): res = [] n,k = list(map(int, input().split())) Arr = input().split() k = k%n if k==0: print(' '.join(Arr)) else: for i in range(n-k,n,1): res.append(Arr[i]) for i in range(n-k): res.a...
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import contextlib import logging import queue import numpy as np import torch from PIL import Image from torch.utils.data import Dataset from torch.utils.data.distributed import DistributedSampler def get_mean_image(crop_size): """ Helper...
import setuptools with open("README.md", "r") as fh: long_description = fh.read() setuptools.setup( name="plotly-utils", version="0.0.3", author="Geza Kovacs", author_email="noreply@gkovacs.com", description="High level API for plotting via Plotly in Jupyter Notebook", long_description=lon...
# Generated by Django 2.0.1 on 2018-02-20 05:44 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('accounts', '0011_auto_20180220_1438'), ('creator', '0009_auto_20180220_1334'), ] operations = [ mig...
# -*- coding: utf-8 -*- # PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN: # https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code from ccxt.async_support.base.exchange import Exchange from ccxt.base.errors import ExchangeError from ccxt.base.errors import Authenticatio...
# -*- coding: utf-8 -*- """Utility functions for use in tests.""" import logging import subprocess import textwrap from os import chdir, environ, mkdir from os.path import abspath from os.path import join as pjoin from shutil import copytree from tempfile import mkdtemp from django.contrib.auth.models import User fro...
#!/usr/bin/env python """ create-counties-file.py ======================= A script to create a file containing a set of randomly selected counties from the MIDAS-Open UK daily temperature data set. Writes counties list to an output file. Usage: ------ create-counties-file.py """ # Imports import os import ra...
#!/usr/bin/env python import sys try: from setuptools.core import setup, Command except ImportError: from distutils.core import setup, Command import firebirdsql class TestCommand(Command): user_options = [] def initialize_options(self): pass def finalize_options(self): pass ...
#!/home/crack/crackhouse02/School/python/djangox/djangox/bin/python3 # When the django-admin.py deprecation ends, remove this script. import warnings from django.core import management try: from django.utils.deprecation import RemovedInDjango40Warning except ImportError: raise ImportError( 'django-adm...
import weakref, sys from rpython.rlib.rstrategies import logger from rpython.rlib import jit, objectmodel, rerased, rarithmetic from rpython.rlib.objectmodel import specialize, not_rpython def make_accessors(strategy='strategy', storage='storage'): """ Instead of using this generator, the methods can be imple...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Составить программу для решения задачи: # В списке, состоящем из вещественных элементов, вычислить: # 1) сумму положительных элементов списка; # 2) произведение элементов списка, расположенных между максимальным # по модулю и минимальным по модулю элементами. # Упорядоч...
# Generated by Django 3.0.6 on 2020-07-25 06:54 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('mpls_monitor', '0009_auto_20200724_1833'), ] operations = [ migrations.RemoveField( model_name='device', name='management', ...
from abc import ABC, abstractmethod import numpy as np class Augmentation(ABC): @abstractmethod def apply(self, audio: np.ndarray, sample_rate: int): raise NotImplementedError(f"{__class__} has not implemented apply")
#!/usr/bin/env python # coding: utf-8 ''' Description : calculator for how much life insurance is needed @author : Jincheng Dan email : jcdan@bu.edu ''' import numpy as np import pandas as pd from financial_planner.entities.term_structure import term_structure # get interest rate of US treasury chromdriver_p...
#!/usr/bin/env python3 # Description: Vacuum. # Dependencies and Logistics =================================================== # Command to navigate between directories from os import chdir # Command to acquire directory path from os.path import dirname # Command to acquire script name and module search path from ...
import os from shutil import copy RPM_INSTALLER = 'dnf' def fetch_and_install_pkg(dest_dir, pkg, verbose=False): cmd = [RPM_INSTALLER, 'install', pkg, '--installroot', dest_dir, '-y'] if not verbose: cmd.append('-q') print('Fetching and Installing:', pkg, '...') os.system(' '.join...
from django.db import models from django.contrib.auth.models import User from django.db.models.signals import post_save from django.dispatch import receiver class Profile(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE) bio = models.TextField(max_length=500, blank=True) profile_ph...
from django.utils.translation import pgettext_lazy class OrderStatus: DRAFT = "draft" UNFULFILLED = "unfulfilled" PARTIALLY_FULFILLED = "partially fulfilled" FULFILLED = "fulfilled" CANCELED = "canceled" CHOICES = [ ( DRAFT, pgettext_lazy( "Stat...
from flask import render_template, redirect, request, url_for, flash from flask_login import login_user, logout_user, login_required, \ current_user from . import auth from app import main from .. import db from ..models import User from ..email import send_email from .forms import LoginForm, RegistrationForm, Chan...
from .converter import convert import argparse def main(): parser = argparse.ArgumentParser() parser.add_argument("path", help="your image path (to be converted)") parser.add_argument("-w", "--width", help="resize your image to this width (proportionally, if you don't assign height at the same time)",...
# Copyright 2019-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" fil...
from emcee.utils import MPIPool from mpfit import mpfit from statistics import mean import copy import corner # import datetime import emcee import itertools import math import matplotlib.pyplot as plt import numpy as np import os import pickle import random import statistics import sys import subprocess from itertools...
# Copyright (c) 2012 OpenStack, LLC. # Copyright (c) 2015 EMC 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/l...
import logging from dataclasses import dataclass from pathlib import Path from typing import Any, List, Tuple import yaml # loading package files: https://stackoverflow.com/a/20885799 try: import importlib.resources as pkg_resources except ImportError: # Try backported to PY<37 `importlib_resources`. imp...
''' This script is about converting any image to corresponding icon file (i.e. .ico file) libraries used : tkinter - for creating gui, button, labels and all from tkinter used filedialog, for choosing image from the local system function defined: 1.) img_choose() - to choose an image from the local system 2.) img_co...
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); y...
import vaex import vaex.ml import vaex.ml.datasets import vaex.ml.ui def test_widgetize(): # Load datasets ds = vaex.ml.datasets.load_iris() # define the list of transformers transformer_list = [vaex.ml.StandardScaler(), vaex.ml.MinMaxScaler(), vaex.ml.P...
# 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 ...
# Generated by Django 3.0.2 on 2020-01-28 12:31 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ('academic', '0001_initial'), ('address', '0001_initial'), ] operations = [ migra...
#!/usr/bin/env python import unittest import sys, os from os import path from mock import patch from pySpacebroClient import SpacebroClient from dotmap import DotMap timeout=1 verbose=True class TestSpacebroClient(unittest.TestCase): def on_newClient(self, args): #print(args) #print('on_newClient...
# This package includes the .ui files and the generated *_ui.py files. # *_ui.py files are generated and should not be edited. The files are automatically generated when # `python setup.py install` is ran, or by running `python setup.py build_ui`
import json def change_value(file, value, changeto): try: with open(file, "r") as jsonFile: data = json.load(jsonFile) except FileNotFoundError: raise FileNotFoundError("The file you tried to get does not exist...") data[value] = changeto with open(file, "w") as jsonFile: ...
from abc import ABC, abstractmethod from trust_stores_observatory.certificates_repository import RootCertificatesRepository from trust_stores_observatory.trust_store import TrustStore class StoreFetcherInterface(ABC): @abstractmethod def fetch(self, certs_repo: RootCertificatesRepository, should_update_repo...
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
#!/usr/bin/env python3 # Copyright (c) 2014-2019 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 mempool limiting together/eviction with the wallet.""" from decimal import Decimal from test_fra...
# -------------- import pandas as pd from sklearn import preprocessing #path : File path # Code starts here # read the dataset dataset = pd.read_csv(path) # look at the first five columns print(dataset.head()) # Check if there's any column which is not useful and remove it like the column id dataset = dataset.dro...
import argparse import logging import os import sys import socket import json import pickle import torch from datetime import datetime from transformers import AutoConfig, AutoTokenizer, AutoModel from torch.utils.data import DataLoader, RandomSampler from .framework import RerankerFramework from ..datasets import (E...
#!/usr/bin/env python3 import rospy from std_msgs.msg import Int32 n = 0 def cb(message): global n n = message.data*2 if __name__ == '__main__': rospy.init_node('twice') sub = rospy.Subscriber('count_up', Int32, cb) pub = rospy.Publisher('twice', Int32, queue_size=1) rate = rospy.Rate(10) ...
#!/usr/bin/env python3 import sys import os from os import path # base dir of sqlx workspace dir_workspace = path.dirname(path.dirname(path.realpath(__file__))) # dir of tests dir_tests = path.join(dir_workspace, "tests") # extend import path to tests/ sys.path.append(dir_tests) import subprocess import time impor...
# Create bot log import logging logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.INFO)
import csv """ There are 8 types of notification that a user can receive - someone @mentioned you in a discussion - someone left you a message on your user page - someone reverted one of your edits - someone changed your userrights - someone sent you an email - someone thanked you for your edit - someone reviewed an a...
# Copyright (c) AIRBUS and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from __future__ import annotations import multiprocessing import os import sys from typing import Optional, Callable from skdecide import Domain, Solv...
import math def gcd(a, b): if a % b == 0: return b return gcd(b, a % b) def is_square(n): sqrt_n = int(math.sqrt(n)) return n == sqrt_n * sqrt_n if __name__ == "__main__": L = 10 ** 12 s = set() for a in xrange(2, 10000): for b in xrange(1, a): if a * a * a * b...
# encoding: utf-8 import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding model 'Post' db.create_table('canvas_post', ( ('id', self.gf('django.db.models.fields...
"""This module serves as an object-oriented front-end to the jqiskit interface and orchestrates the simulation.""" from typing import Optional, Dict, List import numpy as np from .gates import CX, CY, CZ, Hadamard, SWAP, CSWAP, SQRTNOT, Parametric from .backend import run_program, get_ground_state, preprocess_swaps,...
from turtle import TNavigator, TPen class PdfTurtle(TNavigator, TPen): """ Helper class to include turtle graphics within a PDF document. """ class _Screen(object): def __init__(self, drawing, width, height): self.cv = drawing self._window_width = width self._windo...
from io import StringIO, BytesIO import pandas as pd from flask import Flask, render_template, request from flask import send_file import services app = Flask(__name__) @app.route('/') def index(): return render_template('index.html') @app.route('/upload', methods=['POST']) def upload(): file = request.f...
import base64 import datetime import decimal import sys import time import unittest from unittest import mock import xmlrpc.client as xmlrpclib import xmlrpc.server import http.client import http, http.server import socket import threading import re import io import contextlib from test import support from test.support...
from typing import Callable import numpy as np from engine.estimators.base_estimator import BaseEstimator from engine.optimizers.base_optimizer import BaseOptimizer from engine.optimizers.sgd_logistic import LogisticSGD from engine.utils import projections class LogisticRegression(BaseEstimator): def __init__(sel...
# (C) 2021 GoodData Corporation from __future__ import annotations import json import os import pytest from gooddata_sdk.compute.model.attribute import Attribute from gooddata_sdk.compute.model.base import ObjId from gooddata_sdk.compute.model.execution import compute_model_to_api_model from gooddata_sdk.compute.mod...