text
stringlengths
2
999k
# SPDX-License-Identifier: MIT # # Copyright (c) 2021 The Anvil Extras project team members listed at # https://github.com/anvilistas/anvil-extras/graphs/contributors # # This software is published at https://github.com/anvilistas/anvil-extras import random import anvil.js from anvil import Component as _Component fro...
# vim: sw=4:ts=4:et:cc=120 import threading import saq import saq.network_semaphore from saq.network_semaphore import ( initialize_fallback_semaphores, add_undefined_fallback_semaphore, NetworkSemaphoreServer, NetworkSemaphoreClient, LoggingSemaphore ) from saq.service import *...
# Copyright (c) 2020-2021 impersonator.org authors (Wen Liu and Zhixin Piao). All rights reserved. import unittest import torch from easydict import EasyDict from iPERCore.services.options.options_setup import setup from iPERCore.tools.trainers.lwg_trainer import LWGTrainer class TrainerTestCase(unittest.TestCase):...
# coding: utf-8 """ Kubernetes No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) OpenAPI spec version: v1.9.4 Generated by: https://github.com/swagger-api/swagger-codegen.git """ from __future__ import absolute_import import os import sys im...
import os from time import sleep from dailyScript import Daily class Weekly: def __init__(self): validAccounts = open('quinterac/validAccountsListFile.txt', 'r') self.inputValidAccounts = validAccounts.readlines() self.runWeek() def runWeek(self): """ This method run...
from collections import OrderedDict import time from ..core import SerialDriver from serial import SerialException _REQUEST_SEQ = b"\x02\x01\x00\xFE" def _checksum(res): return 0xFF - (sum(res[1:]) & 0xFF) def _check(res): return _checksum(res[:-1]) != res[-1] class Driver(SerialDriver): def __init...
import logging import time import traceback from pathlib import Path from secrets import token_bytes from typing import Any, Dict, List, Optional, Tuple from blspy import AugSchemeMPL from joker.types.blockchain_format.coin import Coin from joker.types.blockchain_format.program import Program from joker.types.blockch...
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import glob import os import json import shutil import re from allennlp.models.archival import archive_model from tqdm import tqdm def archive_all_checkpoint(checkpoint_folder): config_path = os.path.join(checkpoint_folder, "config.json") ...
#!/usr/bin/env python from __future__ import with_statement from contextlib import closing from subprocess import call, Popen, PIPE from params_template import dogpack_data_template def main(cfl, ts_method, space_order, time_order, iterations, mx_start, n_start): """Run a sample. Runs time stepping met...
# Natural Language Toolkit: Switchboard Corpus Reader # # Copyright (C) 2001-2019 NLTK Project # Author: Edward Loper <edloper@gmail.com> # URL: <http://nltk.org/> # For license information, see LICENSE.TXT import re from nltk.tag import str2tuple, map_tag from nltk.corpus.reader.util import * from nltk.corpus.reader...
""" eZmax API Definition (Full) This API expose all the functionnalities for the eZmax and eZsign applications. # noqa: E501 The version of the OpenAPI document: 1.1.7 Contact: support-api@ezmax.ca Generated by: https://openapi-generator.tech """ import sys import unittest import eZmaxApi from...
from model import Conv2D, ReLU, Flatten, Linear, Softmax, MLP from model import MLPnGPU from model import Conv2DnGPU from model import LinearnGPU from model import MaxPool from resnet_tf import ResNetTF def make_basic_cnn(nb_filters=64, nb_classes=10, input_shape=(None, 28, 28, 1)): layers = [...
#!/usr/bin/env python # -*- coding: utf-8 -*- # ************************************************************************** # Copyright © 2016, 2017 jianglin # File Name: log.py # Author: jianglin # Email: mail@honmaple.com # Created: 2016-11-19 10:32:05 (CST) # Last Update: Wednesday 2018-09-26 10:52:52 (CST) # ...
from build.management.commands.build_structures import Command as BuildStructures class Command(BuildStructures): pass
from copy import deepcopy from shutil import copyfile from sys_simulator.a2c.framework import A2CDiscreteFramework from typing import List from time import time from sys_simulator.a2c.agent import A2CAgent, A2CCentralAgent from sys_simulator.general.actions_discretizations import db_six from sys_simulator.q_learning.en...
"""OpenDrive Rendering This rendering is specific to a particular application and does not represent a universal blueprint for different tasks! However, it can be adapted to other applications. This script provides a rendering class that uses the underlying OpenDrive Map to render images. In addition, it provides the...
from __future__ import absolute_import import unittest import sys import os class NoExtensionTestSuite(unittest.TestSuite): def run(self, result): import simplejson simplejson._toggle_speedups(False) result = unittest.TestSuite.run(self, result) simplejson._toggle_speedups(True) ...
from pythonds.basic.stack import Stack def parChecker(symbolString): s = Stack() balanced = True i = 0 while i < len(symbolString) and balanced: symbol = symbolString[i] if symbol in "([{": s.push(symbol) else: if s.isEmpty(): balanced = F...
"""Command line interface including input and output.""" import argparse import sys from seedrecover.wordlist import Wordlist from seedrecover.order import iterate from seedrecover.keyderiv import seed_to_stakeaddress, ChecksumError from seedrecover.stakecheck import StakeAddresses from seedrecover.bfstakecheck import...
import FWCore.ParameterSet.Config as cms hltAK4PFPuppiJetCorrectorL1 = cms.EDProducer("L1FastjetCorrectorProducer", #algorithm = cms.string('AK4PFPuppiHLT'), algorithm = cms.string('AK4PFPuppi'), level = cms.string('L1FastJet'), srcRho = cms.InputTag("fixedGridRhoFastjetAllTmp") )
import datetime import csv import logging from django.db.models import Sum from django.conf import settings from django.shortcuts import get_object_or_404, redirect from django.http import HttpResponseRedirect, HttpResponse, Http404 from django.core.urlresolvers import reverse_lazy from django.utils.text import slugif...
"""Generic helper module.""" import argparse import numpy as np import os import random import shutil import torch def create_safe_directory(directory, logger=None): """Create a directory and archive the previous one if already existed.""" if os.path.exists(directory): if logger is not None: ...
# importing enum for enumerations from enum import Enum, unique @unique # creating enumerations using class class TRn11comSoapServicePort(Enum): Category = "CategoryServicePortSoap11" Product = "ProductServicePortSoap11" Order = "OrderServicePortSoap11" City = "CityServicePortSoap11" ProductSellin...
from django import forms from allauth.account.forms import SignupForm from django.contrib.auth.models import User from django.contrib.auth.forms import UserCreationForm from .models import Profile class UserRegisterForm(UserCreationForm): email=forms.EmailField() first_name=forms.CharField(label='First Name')...
from aesara.tensor.nlinalg import * from aesara.tensor.slinalg import *
import unittest from vector import Vector from plane import Plane class TestPlane(unittest.TestCase): p1 = Plane(Vector([-0.412, 3.806, 0.728]), -3.46) p2 = Plane(Vector([1.03, -9.515, -1.82]), 8.65) p3 = Plane(Vector([2.611, 5.528, 0.283]), 4.6) p4 = Plane(Vector([7.715, 8.306, 5.342]), 3.76) p...
#!/usr/bin/env python3 # 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 # "L...
test = { 'name': 'q33', 'points': 1, 'suites': [ { 'cases': [ { 'code': r""" >>> import math; >>> math.isclose(average_total_pay, 11445294.11764706, rel_tol = 0.1) True """, 'hidden': False, 'locked': False } ], ...
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi SDK Generator. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union, overload from ... import _utilities __...
from _sha256 import sha256 from binascii import hexlify from common.serializers.serialization import domain_state_serializer from ledger.util import F from plenum.common.constants import NYM, ROLE, STEWARD, DOMAIN_LEDGER_ID, \ TXN_TIME, VERKEY, TARGET_NYM from plenum.common.exceptions import UnauthorizedClientRequ...
import os from geospark.core.enums import FileDataSplitter, IndexType from geospark.core.geom.envelope import Envelope from tests.tools import tests_path input_location = os.path.join(tests_path, "resources/primaryroads-polygon.csv") query_window_set = os.path.join(tests_path, "resources/zcta510-small.csv") offset = ...
cidade = str(input('Em que cidade você nasceu? ')).strip() # verifica se o nome da cidade tem santo no começo print(cidade[:5].upper() == 'SANTO')
# Copyright (c) 2009-2019 The Regents of the University of Michigan # This file is part of the HOOMD-blue project, released under the BSD 3-Clause License. # Maintainer: joaander / All Developers are free to add commands for new features R""" Specify values that vary over time. This package contains various commands...
# -*- coding: utf-8 -*- # @Time : 2021/9/29 14:09 # @Author : vivian import math from collections import namedtuple import numpy as np from shapely.geometry import Polygon class DetectionICDAR2013Evaluator(object): def __init__( self, area_recall_constraint=0.8, area_precision_constraint=0.4, ...
# Copyright IBM Corp. 2015, 2015 All Rights Reserved # Copyright (c) 2010-2016 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/LICEN...
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors # License: GNU General Public License v3. See license.txt from __future__ import unicode_literals import frappe def execute(): for dt in ("Sales Order", "Purchase Order"): frappe.db.sql("update `tab{0}` set status='Closed' where status='Stoppe...
from django.contrib.auth.models import User, Group from django.test import TestCase from django.test.client import Client from ...consumers.models import Consumer from ...financial.models import Payment, Invoice from ...report.models import Report, Ticket, BreakType, UrgencyType from ...water_network.models import Zon...
#!/usr/bin/python3 from pwn import * from sys import argv,exit if len(argv) < 2: sys.exit("Target IP Missing") level14 = ssh(host=argv[1],user='level14',password='level14') encrypted_token = (level14.download_data('/home/flag14/token')).decode() decrypted_token = "" for i in range(len(encrypted_token)): try: c...
""" This program builds a two-layer neural network for the Iris dataset. The first layer is a relu layer with 10 units, and the second one is a softmax layer. The network structure is specified in the "train" function. The parameters are learned using SGD. The forward propagation and backward propagation are carri...
import unittest from user import User, Credentials class TestClass(unittest.TestCase): def test_init(self): self.assertEqual(self.new_user.username,"sharon") self.assertEqual(self.new_user.password,"sharon123") def setUp(self): self.new_user = User("sharon","sharon123") ...
from datetime import datetime from django.test import TestCase from ..models import UserAccessLog, UserAgent class TestUserAccessLogManager(TestCase): @staticmethod def get_kwargs(**kwargs): defaults = { 'user_id': 'test_user', 'action': 'login', 'ip': '127.0.0.1',...
""" This is a python interface to Adobe Font Metrics Files. Although a number of other python implementations exist, and may be more complete than this, it was decided not to go with them because they were either: 1) copyrighted or used a non-BSD compatible license 2) had too many dependencies and a free standin...
import _plotly_utils.basevalidators class SideValidator(_plotly_utils.basevalidators.EnumeratedValidator): def __init__( self, plotly_name='side', parent_name='scatterternary.marker.colorbar.title', **kwargs ): super(SideValidator, self).__init__( plotly_na...
import os # Set PYNE version PYNE_MAJOR_VERSION = 0 PYNE_MINOR_VERSION = 7 PYNE_PATCH_VERSION = 6 PYNE_VERSION = '{0}.{1}.{2}'.format(PYNE_MAJOR_VERSION, PYNE_MINOR_VERSION, PYNE_PATCH_VERSION) def write_cpp_header(path="."): with open(os.path.join(path , 'pyne_version.h') , 'w') as pvh: header_text = '...
#!/usr/bin/env python # coding=utf-8 # aeneas is a Python/C library and a set of tools # to automagically synchronize audio and text (aka forced alignment) # # Copyright (C) 2012-2013, Alberto Pettarin (www.albertopettarin.it) # Copyright (C) 2013-2015, ReadBeyond Srl (www.readbeyond.it) # Copyright (C) 2015-2017, A...
from absl import logging import numpy as np import tensorflow as tf import cv2 from PySide2.QtWidgets import QApplication, QMainWindow, QPushButton, QPlainTextEdit from PySide2.QtUiTools import QUiLoader import glo from signal import signal, SIGPIPE, SIG_DFL, SIG_IGN signal(SIGPIPE, SIG_IGN) output_old = 'A' print("...
# -*- coding: utf-8 -*- # ====================================================================================================================== # Copyright (©) 2015-2021 LCS - Laboratoire Catalyse et Spectrochimie, Caen, France. = # CeCILL-B FREE SOFTWARE LICENSE AGREEMENT - See ful...
# Docstrings for generated ufuncs # # The syntax is designed to look like the function add_newdoc is being # called from numpy.lib, but in this file add_newdoc puts the # docstrings in a dictionary. This dictionary is used in # _generate_pyx.py to generate the docstrings for the ufuncs in # scipy.special at the C level...
import logging import torch import torch.nn.functional as F import torch.nn as nn import torch.utils.checkpoint as cp import torch.distributed as dist from torch.nn.modules.batchnorm import _BatchNorm from mmcv.cnn import constant_init, kaiming_init from mmcv.runner import load_checkpoint, get_dist_info from mmcv.cnn...
import cupy from cupy.random import generator # TODO(beam2d): Implement many distributions def beta(a, b, size=None, dtype=float): """Beta distribution. Returns an array of samples drawn from the beta distribution. Its probability density function is defined as .. math:: f(x) = \\frac{x^{\\...
import logging import os import shutil import sys import portend from .conf import OPTIONS from .server import get_status from .server import LISTEN_ADDRESS from .server import NotRunning logger = logging.getLogger(__name__) PORT_AVAILABILITY_CHECK_TIMEOUT = 2 def check_other_kolibri_running(port): """ Ma...
# Generated by Django 3.0.4 on 2020-04-15 10:07 from django.conf import settings from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('core', '0007_trip_votes'), ] operations = [ migrations.AlterField( model_name='trip', ...
from __future__ import absolute_import from __future__ import unicode_literals from django.db.models.signals import pre_save, post_delete from django.dispatch import receiver from tastypie.exceptions import ImmediateHttpResponse from tastypie.http import HttpBadRequest from corehq.motech.repeaters.models import FormRe...
"""Tests for the ``utils`` module.""" from datetime import datetime from nose.tools import * from mock import patch from facepy import * patch = patch('requests.session') def mock(): global mock_request mock_request = patch.start()().request def unmock(): patch.stop() @with_setup(mock, unmock) de...
#!/usr/bin/env python3 # 正则 import re from yvhai.demo.base import YHDemo class RegexDemo(YHDemo): def __init__(self): super(RegexDemo, self).__init__('Regex') @staticmethod def test_match(): _sec = RegexDemo.mark_section('re.match用法') print(' ==> re.match 尝试从字符串的起始位置匹配一个模式,如果不是...
# Generated by Django 2.2 on 2021-06-15 05:24 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('arrival', '0003_auto_20210511_2358'), ] operations = [ migrations.AlterField( model_name='partsar...
# -*- coding: utf-8 -*- """ Ir_Black Colorscheme ~~~~~~~~~~~~~~~~~~~~ Converted by Vim Colorscheme Converter """ from pygments.style import Style from pygments.token import Token, Comment, Name, Keyword, Generic, Number, Operator, String class IrBlackStyle(Style): background_color = '#000000' sty...
# -*- coding: utf-8 -*- import tensorflow as tf import numpy as np from custom_lstm import CustomBasicLSTMCell from constants import FEATURES_LIST, SEQUENCE_LENGTH # Actor-Critic Network Base Class # (Policy network and Value network) class GameACNetwork(object): def __init__(self, action_size, ...
# Lint as: python3 # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
# coding: utf-8 """ Kubernetes No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) OpenAPI spec version: v1.5.0-beta.1 Generated by: https://github.com/swagger-api/swagger-codegen.git Licensed under the Apache License, Version 2.0 (the "Lice...
## FormEncode, a Form processor ## Copyright (C) 2003, Ian Bicking <ianb@colorstudy.com> """ Validator/Converters for use with FormEncode. """ import cgi import locale import re import warnings try: set except NameError: # Python < 2.4 from sets import Set as set try: import DNS DNS.DiscoverNameServ...
""" Steven 20/03/2020 generate dataset """ #python3 steven import numpy as np import pandas as pd import matplotlib.pyplot as plt gSavePath=r'./db/' def noise(len): return np.random.rand(len) def appendComment(file,comment,mode='a'): with open(file, mode) as f: f.write(comment) def createCSV_NFe...
import traceback from django.contrib.auth import get_user_model from django.contrib.auth.backends import UserModel from django.contrib.auth.hashers import make_password from rest_framework import serializers from rest_framework import mixins class FriendSerializer(serializers.Serializer): name=serializers.CharFie...
#!/usr/bin/env python from acme import Product from random import randint, sample, uniform ADJECTIVES = ['Awesome ', 'Shiny ', 'Impressive ', 'Portable ', 'Improved '] NOUNS = ['Anvil', 'Catapult', 'Disguise', 'Mousetrap', '???'] def generate_products(num_products=30): products = [] i = 0 while (i < num...
from simglucose.simulation.env import T1DSimEnv as _T1DSimEnv from simglucose.patient.t1dpatient import T1DPatient from simglucose.sensor.cgm import CGMSensor from simglucose.actuator.pump import InsulinPump from simglucose.simulation.scenario_gen import RandomScenario from simglucose.controller.base import Action impo...
from .course import Course class CourseClass: """ All information needed to be collected about a course The best name for this class would be Class, but that would risk collisions with the python's class """ def __init__(self, course: Course, class_dict=None): """ All None at...
# Copyright 2013 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 accompa...
# 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 agreed to in writing, ...
# 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...
import json from urllib.parse import urlencode import pytest from quart import Quart, Response, url_for from quart.testing import QuartClient from werkzeug.datastructures import Headers from .app import create_app @pytest.fixture def app() -> Quart: # import app factory pattern app = create_app(graphiql=Tru...
# coding: utf-8 """ Kubernetes No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501 OpenAPI spec version: v1.10.6 Generated by: https://github.com/swagger-api/swagger-codegen.git """ import pprint import re # noqa: F401 class V...
# Importing essential libraries import numpy as np # Math lib import matplotlib.pyplot as plt # Plot lib import pandas as pd # Manage Data lib # Importing dataset dataset = pd.read_csv('train.csv') cols = list(dataset.columns.values) cols.pop(cols.index('Survived')) cols = cols + ['Survived'] dataset = dataset[cols]
"""A `WorkItem` carries information about potential and completed work in the Cosmic Ray system. `WorkItem` is one of the central structures in CR. It can describe both work to be done and work that has been done, and it indicates how test sessions have completed. """ def make_record(name, fields=(), docstring=""): ...
""" Plot a square on H2 with Poincare Disk visualization with two clusters from uniformly sampled random points. Then apply the K-means algorithm and plot the points labels as two distinct colors. """ import os import matplotlib.pyplot as plt import geomstats.backend as gs import geomstats.visualization as visualizat...
import numpy as np from model.constant_variables import Z_field, Z_lab def set_up_model_geometry(geom="FieldScale0.5m"): """ Set-up model geometry Arguments ------------------------------ geom Flag for geometry of choice Results --------------------------- n...
""" Tketris Tetris using tkinter Author: Anshul Kharbanda Created: 10 - 11 - 2018 """
# -*- coding: utf-8 -*- # # Cerberus documentation build configuration file, created by # sphinx-quickstart on Thu Oct 11 15:52:25 2012. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # Al...
#!/bin/python import numpy as np class Function: def __init__(self): pass def __call__(self, x): return self.fx(x) def fx(self, x): return x def dfx(self, x): return np.zeros(x.shape) class Logistic(Function): def __init__(self): pass def fx(self, x): return 1/(1+np.exp(-x)) d...
# Copyright (c) 2018 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 numpy as np import tensorflow as tf import timeit embeddings = np.genfromtxt("embeddings.txt", delimiter=',') def test(): embeddings1 = embeddings[0:1] embeddings2 = embeddings[1:10001] # embeddings1 = tf.divide(embeddings1, tf.norm(embeddings1, axis=1, keepdims=True)) # embeddings2 = tf.divi...
#! /usr/bin/env python # -*- coding: utf-8 -*- import unittest import json import requests import twython twitter = twython.Twython() class TestTwythonRequests(unittest.TestCase): def test_search(self): result = twitter.search(q='python') self.assertTrue(result['results']) def test_search...
## @file # Common routines used by all tools # # Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR> # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the lic...
import numpy as np import matplotlib.pyplot as plt from matplotlib import animation from scipy.optimize import curve_fit from pylab import cm as plcm # colors for plotting import pickle # for storing calculations and reading again while editing plot details plt.rcParams.update({'f...
import logging from typing import Union, Callable, Optional, Any from pydantic import BaseModel, conlist, validator, validate_arguments, Extra from .normalization import NodeLabelType, ConditionType from .normalization import normalize_node_label, normalize_conditions, normalize_response, normalize_processing logge...
""" ================================ Demo Colorbar With Inset Locator ================================ """ import matplotlib.pyplot as plt from mpl_toolkits.axes_grid1.inset_locator import inset_axes fig, (ax1, ax2) = plt.subplots(1, 2, figsize=[6, 3]) axins1 = inset_axes(ax1, width="50%", # wi...
import copy import math import os import networkx as nx import numpy as np import torch from loguru import logger from Baseline_Benchmark.greedy_baseline import greedy_baseline from Environment.Env import NetworkEnv from Environment.Interfernce_Model.Interference_Maker import Interference from Environment.Packets imp...
from .compare import compareVersion
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2012 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2012 Nebula, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # no...
# # 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...
''' Base class for some data corpus and the samples it contains. ''' from itertools import islice def _take(n, iterable): "Return first n items of the iterable as a list" return list(islice(iterable, n)) class Meta(object): ''' A simple class that will take a dictionary as input and put the value...
import logging from typing import Optional import json from fastapi import APIRouter, Depends, HTTPException from pydantic import BaseModel from sqlalchemy.ext.asyncio import AsyncSession from api.endpoints.dependencies.db import get_db from api.endpoints.dependencies.tenant_security import get_from_context from api....
# coding=utf-8 # Copyright 2014 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import (absolute_import, division, generators, nested_scopes, print_function, unicode_literals, with_statement) import six from twit...
from .simple_sampler import SimpleSampler import numpy as np class ClassifierSampler(SimpleSampler): def __init__(self, algorithm=None, **kwargs): super().__init__(**kwargs) if algorithm: assert hasattr(algorithm, 'get_reward'), ( 'Must implement `get_reward` method to ...
# Copyright 2016 The Closure Rules 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: utf-8 -*- from .coupling import AffineCouplingTransform __all__ = ["AffineCouplingTransform"]
################################################## # CompanyService_services_types.py # generated by ZSI.generate.wsdl2python ################################################## import ZSI import ZSI.TCcompound from ZSI.schema import LocalElementDeclaration, ElementDeclaration, TypeDefinition, GTD, GED ############...
ar = [[4, 5, 7],[3, 9, 1],[7, 6, 2]] flat_list = [item for sublist in ar for item in sublist] rev = flat_list[::-1] #[9, 8, 7, 6, 5, 4, 3, 2, 1] steps = list(range(0, len(flat_list), len(ar))) #[0, 3, 6] patt = list(range(1, len(ar)+1)) + list(range(len(ar)-1, 0, -1)) #[1, 2, 3, 2, 1] size = len(patt)//2 b = (x for x i...
# Working on: EOL Reached. # Finished: FINAL RELEASE v2.0 # Update Description: Finishes up all features. Everything will be completed after 2.0 gets released. This will be the last update to S.A.N.E. # Future Ideas: NEOL Reached. # Imports from tkinter.constants import END import speech_recognition as sr import pyt...
import os, inspect, glob, random, shutil import numpy as np PACK_PATH = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))+"/.." class DataSet(object): def __init__(self, setname, tr_ratio=0.9): self.data_path = os.path.join(PACK_PATH, "..", setname) self.tr_ratio = tr_rat...
# Importing default django methods: from django.shortcuts import render, redirect from django.db.models import Count from django.core.paginator import Paginator from django.db.models.functions import TruncDay from django.http import HttpResponseRedirect # Importing plotly methods: import plotly.graph_objs as go from p...