filename
stringlengths
13
19
text
stringlengths
134
1.04M
the-stack_106_27608
import pytplot import numpy as np import copy def avg_res_data(tvar,res,new_tvar=None): """ Averages the variable over a specified period of time. Parameters: tvar1 : str Name of tplot variable. res : int/float The new data resolution new_tvar : str ...
the-stack_106_27610
# Bundles for JS/CSS Minification PIPELINE_JS = { "common": { "source_filenames": ( "sumo/js/i18n.js", "underscore/underscore.js", "moment/moment.js", "jquery/dist/jquery.min.js", "jquery/jquery-migrate.js", "sumo/js/libs/jquery.cookie...
the-stack_106_27612
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * class PartnerVO(object): def __init__(self): self._biz_status = None self._partner_id = None self._partner_name = None self._short_code = None @property def biz...
the-stack_106_27613
import torch from torch2trt_dynamic.torch2trt_dynamic import (get_arg, tensorrt_converter, trt_) @tensorrt_converter('torch.Tensor.unsqueeze') @tensorrt_converter('torch.unsqueeze') def convert_unsqueeze(ctx): input = ctx.method_args[0] dim = get_arg(ctx, 'dim...
the-stack_106_27614
import datetime from decimal import Decimal import django_filters import pytz from django.db import transaction from django.db.models import F, Prefetch, Q from django.db.models.functions import Coalesce, Concat from django.http import FileResponse from django.shortcuts import get_object_or_404 from django.utils.timez...
the-stack_106_27616
from django.http import HttpResponseRedirect, Http404 from django.shortcuts import render from django.urls import reverse from .models import * def notice(request): notices = {'notices': Notice.objects.all()} return render(request, 'notice.html', notices) def notice_post(request): if request.method == "...
the-stack_106_27618
# -*- coding: utf-8 -*- """ flask提供代理的增删接口 需要nginx部署,保证redis能被访问,才能进行对应的增删操作 """ from flask import Flask, g from flask import request from redis_server.db import RedisClient __all__ = ['app'] app = Flask(__name__) def get_conn(): if not hasattr(g, 'redis'): # 用于判断对象是否包含对应的属性 g.redis = RedisClient() ...
the-stack_106_27619
# -*- 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...
the-stack_106_27620
"""Config flow to configure Xiaomi Miio.""" import logging from re import search from micloud import MiCloud from micloud.micloudexception import MiCloudAccessDenied import voluptuous as vol from homeassistant import config_entries from homeassistant.components import zeroconf from homeassistant.config_entries import...
the-stack_106_27623
#!/usr/bin/python # -*- coding: utf-8 -*- # Hive Netius System # Copyright (c) 2008-2020 Hive Solutions Lda. # # This file is part of Hive Netius System. # # Hive Netius System is free software: you can redistribute it and/or modify # it under the terms of the Apache License as published by the Apache # Foun...
the-stack_106_27624
import os print("XLang 0.0.1 Alpha") print("type `help@' for more info") while True: request = input(">>> ") if request.startswith("PRINT >"): print = request.replace("PRINT >","",1) print(print) elif request.startswith("external@"): com = request.replace("external@","",1) import os os.syste...
the-stack_106_27625
from neuron import h, crxd as rxd, gui import numpy import sys import time import itertools npar = len(sys.argv) # if(npar<2): # print "usage: python wave1d.py <nseg> <nsubseg>" # sys.exit(0) # rxd.options.nsubseg =int(sys.argv[2]) rxd.options.subseg_interpolation = 0 rxd.options.subseg_averaging = 0 sec = h....
the-stack_106_27628
# Copyright 2014 The Emscripten Authors. All rights reserved. # Emscripten is available under two separate licenses, the MIT license and the # University of Illinois/NCSA Open Source License. Both these licenses can be # found in the LICENSE file. from __future__ import print_function import glob import hashlib impo...
the-stack_106_27630
# Copyright 2015 Mirantis Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by...
the-stack_106_27631
# -*- coding: utf-8 -*- import os def is_virtualenv(path): if os.name == "nt": # Windows! clues = ("Scripts", "lib", "include") else: clues = ("bin", "lib", "include") try: dircontents = os.listdir(path) except (OSError, TypeError): # listdir failed, probably d...
the-stack_106_27632
# File: fully_connected_nn.py # Version: 1.0 # Author: SkalskiP https://github.com/SkalskiP # Date: 31.10.2018 # Description: The file contains a simple implementation of a fully connected neural network. # The original implementation can be found in the Medium article: # ...
the-stack_106_27633
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class Xmlf90(AutotoolsPackage): """xmlf90 is a suite of libraries to handle XML in Fortran.""" ...
the-stack_106_27636
#! /bin/python import os import sys import json import luigi import nifty.tools as nt import nifty.distributed as ndist import cluster_tools.utils.volume_utils as vu import cluster_tools.utils.function_utils as fu from cluster_tools.cluster_tasks import SlurmTask, LocalTask, LSFTask # # Graph Tasks # class Initi...
the-stack_106_27640
from django import forms from django.utils.translation import pgettext_lazy from ...seo.models import SeoModel from ..widgets import CharsLeftWidget SEO_FIELD_HELP_TEXT = pgettext_lazy( 'Form field help text', 'If empty, the preview shows what will be autogenerated.') MIN_DESCRIPTION_LENGTH = 120 MIN_TITLE_LE...
the-stack_106_27641
# Inside custom tag - is_active.py from django import template from django.urls import reverse register = template.Library() @register.simple_tag def is_active(request, url): try: path = request.path # Main idea is to check if the url and the current path is a match if path == reverse(url...
the-stack_106_27642
"""Tradingview view""" __docformat__ = "numpy" import logging import os from gamestonk_terminal.decorators import log_start_end from gamestonk_terminal.helper_funcs import export_data, print_rich_table from gamestonk_terminal.rich_config import console from gamestonk_terminal.stocks.technical_analysis import tradingv...
the-stack_106_27644
''' Набор общих юнитов @author: Kosh ''' import cv2 import random import numpy as np from streampy.units.base.pooled import Pool, Worker as Base import copy class Worker(Base): ''' Аугментируем и ресайзим картинку до нужного размера Так же преобразуем боксы, отбрасываем не поместившиеся и сл...
the-stack_106_27645
# To Find The Total Number Of Digits In A Number N = int(input("Enter The number")) count = 0 while(N!=0): N = (N-N%10)/10 count+=1 print(count)
the-stack_106_27646
# -*- coding: utf-8 -*- import os import re import socket import sys import threading import time import warnings import six from six.moves import queue from airtest.core.android.constant import STFLIB from airtest.utils.logger import get_logger from airtest.utils.nbsp import NonBlockingStreamReader from airtest.utils...
the-stack_106_27650
# -*- coding: utf-8 -*- """Implementation of basic instance factory which creates just instances based on standard KG triples.""" from dataclasses import dataclass from typing import Mapping import numpy as np import scipy.sparse from torch.utils import data from ..typing import MappedTriples from ..utils import fi...
the-stack_106_27651
'''generic limbs. Offsets, etc.''' import maya.cmds as cmds import mpyr.lib.rigmath as mpMath import mpyr.lib.rig as mpRig import mpyr.lib.joint as mpJoint import mpyr.lib.nurbs as mpNurbs import mpyr.lib.attr as mpAttr import mpyr.rig.limb.limbBase as limbBase class WorldOffset(limbBase.Limb): '''A character's r...
the-stack_106_27655
"""Creates a custom kinematics body with two links and one joint """ from openravepy import * import numpy, time env = Environment() # create openrave environment env.SetViewer('qtcoin') # attach viewer (optional) with env: # geometries infobox0 = KinBody.Link.GeometryInfo() infobox0._type = GeometryType.Bo...
the-stack_106_27656
# This file is part of h5py, a Python interface to the HDF5 library. # # http://www.h5py.org # # Copyright 2008-2013 Andrew Collette and contributors # # License: Standard 3-clause BSD; see "license.txt" for full license terms # and contributor agreement. from __future__ import absolute_import import sys ...
the-stack_106_27657
#!/usr/bin/env python # -*- coding: utf-8 -*- from xml.etree.ElementTree import Element, SubElement, tostring from lxml import etree import codecs XML_EXT = '.xml' ENCODE_METHOD = 'utf-8' class PascalVocWriter: def __init__(self, foldername, filename, imgSize, localImgPath=None, databaseSrc='Unknown'): ...
the-stack_106_27661
import pytest @pytest.mark.parametrize("string", ["a", "abc", "abcde", "potato"]) def test_string_inside_tuple(get_contract, string): code = f""" struct Person: name: String[6] age: uint256 @external def test_return() -> Person: return Person({{ name:"{string}", age:42 }}) """ c1 = get_contrac...
the-stack_106_27663
# coding:utf8 # code needed to get customized constants for different OS import sys OS_WINDOWS = "win" OS_LINUX = "linux" OS_MACOS = "darwin" OS_BSD = "freebsd" OS_DRAGONFLY = "dragonfly" OS_DEFAULT = "default" def getValueForOS(constantDict): if sys.platform.startswith(OS_WINDOWS): return constantDict[OS...
the-stack_106_27666
import copy import io import os from contextlib import contextmanager from importlib import import_module from unittest import SkipTest from unittest.mock import patch from django.conf import settings from django.core.management import call_command, CommandError from django.template import Context, Origin, Template fr...
the-stack_106_27667
""" Author: Fritz Alder Copyright: Secure Systems Group, Aalto University https://ssg.aalto.fi/ This code is released under Apache 2.0 license http://www.apache.org/licenses/LICENSE-2.0 """ import onnx from onnx import numpy_helper import numpy as np print("These tests work with a fractional of 1 and a downscale o...
the-stack_106_27668
# pylint: disable=no-member, no-name-in-module, import-error from __future__ import absolute_import import glob import os import distutils.command.sdist import distutils.log import subprocess from setuptools import Command, setup import setuptools.command.sdist # Patch setuptools' sdist behaviour with distutils' sdis...
the-stack_106_27669
""" User enters cost, amount of money given. Calculate change in quarters, dimes, nickels, pennies """ cost = float(input("What is the cost of the product? ")) tender = float(input("How much money are you giving to buy the product? ")) while cost < tender: print("You still owe $" + "%.2f" % (cost - tender)) chang...
the-stack_106_27670
# coding: utf-8 import pprint import re import six class BatchDeleteFunctionTriggersRequest: """ Attributes: openapi_types (dict): The key is attribute name and the value is attribute type. attribute_map (dict): The key is attribute name ...
the-stack_106_27672
# coding: utf-8 """ Onshape REST API The Onshape REST API consumed by all clients. # noqa: E501 The version of the OpenAPI document: 1.113 Contact: api-support@onshape.zendesk.com Generated by: https://openapi-generator.tech """ from __future__ import absolute_import import re # noqa: F401 im...
the-stack_106_27676
from ...types.groups.group_call_participant import GroupCallParticipant from ...types.update import Update class JoinedGroupCallParticipant(Update): """A participant joined to the Group Call Attributes: chat_id (``int``): Unique identifier of chat. participant (:obj:`~pytgcalls.ty...
the-stack_106_27678
import gzip import colorsys import numpy as np import numexpr as ne from scipy.spatial import cKDTree from skimage import measure from vapory import (Camera, Scene, LightSource, Background, Sphere, Isosurface, Box, Texture, Pigment, Finish, ContainedBy, Function) def save_mb_o...
the-stack_106_27679
import sys import os import os.path import logging import logging.config import tornado.log from nanotools.common import ensure_dir FMT = "[%(asctime)s][%(levelname)s] - %(filename)s:%(lineno)s - %(message)s" SERVER_LOGGING_CONFIG = { "version": 1, "disable_existing_loggers": False, "format...
the-stack_106_27680
# Pyrogram - Telegram MTProto API Client Library for Python # Copyright (C) 2017-2018 Dan Tès <https://github.com/delivrance> # # This file is part of Pyrogram. # # Pyrogram is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published # by the Free S...
the-stack_106_27681
import tensorflow.keras.backend as K from tensorflow.keras.callbacks import Callback import math class OneCycleScheduler(Callback): def __init__(self, start_lr=1e-4, max_lr=3e-3, moms=None, switch_point=0.3): self.start_lr = start_lr self.max_lr = max_lr self.switch_point = switch_poin...
the-stack_106_27682
import argparse import os import shutil import sys import checks as submission_checks import constants import report def verify_submission(args): root_dir = args.root public_key = args.public_key private_key = args.private_key encrypt_out = args.encrypt_out decrypt_out = args.decrypt_out # v...
the-stack_106_27683
# team = 'BLUE' # rcj_soccer_player controller - ROBOT Y1 # Feel free to import built-in libraries import math # You can also import scripts that you put into the folder with controller import rcj_soccer_robot import utils class MyRobot(rcj_soccer_robot.RCJSoccerRobot): def run(self): if self.name[0] ==...
the-stack_106_27684
#Necessary packages import os import time import ujson as json import numpy as np import pandas as pd import torch import torch.nn as nn from torch.utils.data import Dataset, DataLoader class MySet(Dataset): """Load complete data Args: --epochs 1 --batch_size 32 --model brits Returns: - r...
the-stack_106_27686
import sys import time def create_versioned_files(src_filename, filenames): timestamp = int(time.time()) with open(src_filename, encoding='utf-8') as html_file: html_file_content = html_file.read() for filename in filenames: usages_count = html_file_content.count(filename) ...
the-stack_106_27687
"""Code and data structures for storing and displaying errors.""" from __future__ import print_function import collections import csv import logging import re import sys from pytype import abstract from pytype import debug from pytype import function from pytype import mixin from pytype import utils from pytype.pytd...
the-stack_106_27690
import os, socket import urllib.request # set fake user agent here ua = 'Wget/1.19.4 (linux-gnu)' def handle_client(c): hdr = c.recv(1024).decode("utf-8") url = hdr.split(' ')[1] print(url, "=> downloading") data = urllib.request.urlopen(urllib.request.Request(url, headers={'User-Agent': ua})).read() ...
the-stack_106_27692
#!/usr/bin/env python3 # Copyright (c) 2020-2021 The Eleccoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test wallet replace-by-fee capabilities in conjunction with the fallbackfee.""" from test_framework.te...
the-stack_106_27696
""" A convenience script to playback random demonstrations from a set of demonstrations stored in a hdf5 file. Example: $ python playback_demonstrations_from_hdf5.py --folder ../models/assets/demonstrations/SawyerPickPlace/ """ import os import h5py import argparse import random import numpy as np import robosuit...
the-stack_106_27697
import ast import math import numpy as np def add(p1, p2): return [p1,p2] def canReduce(p): return checkExplode(p) or checkSplit(p) def checkExplode(p, depth=0): #print(p, depth) if isinstance(p, list): if depth>=4: return True else: return checkExplode(p[0], d...
the-stack_106_27698
import torch # Function from https://github.com/ikostrikov/pytorch-a2c-ppo-acktr/blob/master/model.py def initialize_parameters(m): classname = m.__class__.__name__ if classname.find('Linear') != -1: m.weight.data.normal_(0, 1) m.weight.data *= 1 / torch.sqrt(m.weight.data.pow(2).sum(1, keepdi...
the-stack_106_27701
""" Logging Settings """ import os from masonite import env """Default Channel The default channel will be used by Masonite whenever it needs to use the logging channel. You can switch the channel at any time. """ DEFAULT = env("LOG_CHANNEL", "single") """Channels Channels dictate how logging drivers will be initi...
the-stack_106_27705
# -*- coding: utf-8 -*- # This software is open source software available under the BSD-3 license. # # Copyright (c) 2020 Triad National Security, LLC. All rights reserved. # Copyright (c) 2020 Lawrence Livermore National Security, LLC. All rights # reserved. # Copyright (c) 2020 UT-Battelle, LLC. All rights reserved. ...
the-stack_106_27707
""" This module collects helper functions and classes that "span" multiple levels of MVC. In other words, these functions/classes introduce controlled coupling for convenience's sake. """ from django.http import ( Http404, HttpResponse, HttpResponsePermanentRedirect, HttpResponseRedirect, ) from django.template imp...
the-stack_106_27708
# # Copyright (c) 2017, Massachusetts Institute of Technology All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # Redistributions of source code must retain the above copyright notice, this # list ...
the-stack_106_27710
''' Created on Oct 5, 2010 @author: Mark V Systems Limited (c) Copyright 2010 Mark V Systems Limited, All rights reserved. ''' import os, threading, time, logging from tkinter import Menu, BooleanVar, font as tkFont from arelle import (ViewWinTkTable, ModelDocument, ModelDtsObject, ModelInstanceObject, XbrlConst, ...
the-stack_106_27715
import shutil from country_levels_lib.config import geojson_dir, export_dir from country_levels_lib.utils import read_json, osm_url, write_json from country_levels_lib.wam_download import wam_data_dir from country_levels_lib.wam_collect import validate_iso1, validate_iso2 wam_geojson_simp_dir = geojson_dir / 'wam' / ...
the-stack_106_27717
""" Desenvolva um programa que leia o nome, idade, e sexo de 4 pessoas. No final do programa, mostre: -A média da idade do grupo; -Qual é o nome do homem mais velho; -Quantas mulheres têm menos de 20 anos. """ soma_idade = 0 media_idade = 0 maior_idade_homem = 0 nome_velho = '' total_mulher_20 = 0 for p in range(1, ...
the-stack_106_27718
""" Tests for the fiu_ctrl.py module. Note the command line utility is covered by the utils/ tests, not from here, this is just for the Python module. """ import subprocess import fiu_ctrl import errno import time fiu_ctrl.PLIBPATH = "./libs/" def run_cat(**kwargs): return fiu_ctrl.Subprocess(["./small-cat"], ...
the-stack_106_27720
# Copyright 2019 WebPageTest LLC. # Copyright 2017 Google Inc. # Use of this source code is governed by the Apache 2.0 license that can be # found in the LICENSE file. """Support for Safari on iOS using iWptBrowser""" import base64 from datetime import datetime import gzip import io import logging import multiprocessin...
the-stack_106_27723
#!/usr/bin/env python from future import standard_library standard_library.install_aliases() import json commands = [] with open("sites.conf") as sites: for line in sites.readlines(): line = line.strip() names, args = line.split(" ", 1) names = names.split(",") command = {"args": a...
the-stack_106_27728
from __future__ import unicode_literals from django.shortcuts import redirect from django.template import RequestContext from mezzanine.conf import settings from mezzanine.forms.forms import FormForForm from mezzanine.forms.models import Form from mezzanine.forms.signals import form_invalid, form_valid from mezzanine...
the-stack_106_27729
#!/usr/bin/env python # -*- coding: UTF-8 -*- """ Construct and visualize phylogenetic trees from: 1. MCSCAN output 2. CDS sequences in FASTA format Options are provided for each step: 1. sequence alignment: ClustalW2 or MUSCLE (wrapped on Biopython) 2. alignment editting: GBlocks (optional) 3. build tre...
the-stack_106_27732
# pylint:disable=unused-variable # pylint:disable=unused-argument # pylint:disable=redefined-outer-name # pylint:disable=no-value-for-parameter # pylint:disable=protected-access # pylint:disable=too-many-arguments import pytest from dask_task_models_library.container_tasks.events import ( BaseTaskEvent, TaskCa...
the-stack_106_27734
import os import sys import edx_theme # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. sys.path.insert(0, os.path.abspath('..')) ...
the-stack_106_27735
# Copyright The Cloud Custodian Authors. # SPDX-License-Identifier: Apache-2.0 from datetime import datetime import re from concurrent.futures import as_completed from dateutil.tz import tzutc from dateutil.parser import parse from c7n.actions import ( ActionRegistry, BaseAction, ModifyVpcSecurityGroupsAction) fr...
the-stack_106_27736
# -*- coding: utf-8 -*- {{{ # vim: set fenc=utf-8 ft=python sw=4 ts=4 sts=4 et: # # Copyright 2019, Battelle Memorial Institute. # # 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...
the-stack_106_27737
# -*- coding: utf-8 -*- ''' Template render systems ''' from __future__ import absolute_import # Import python libs import codecs import os import imp import logging import tempfile import traceback import sys # Import third party libs import jinja2 import jinja2.ext # Import salt libs import salt.utils import salt...
the-stack_106_27739
from cgmbrush.cgmbrush import * from cgmbrush.plots.plots import * import matplotlib.pyplot as plt import numpy as np provider = BolshoiProvider() date = '2022-06-03' date2 = '2022-06-03' resolutions = [4,8,16,32] precipProfile = MassDependentProfile(PrecipitationProfile(), NFWProfile(), 10**13.3) profiles = [(Spheri...
the-stack_106_27740
import os import pickle import uuid import xml.etree.ElementTree as ET import numpy as np import scipy.sparse from datasets.imdb import imdb from model.utils.config import cfg class kittivoc(imdb): def __init__(self, image_set, devkit_path=None): imdb.__init__(self, 'kittivoc_' + image_set) self...
the-stack_106_27742
""" If a model is provided using a second argument, the classification is run using the pretrained autoembedder. - python scripts/supervised_classification_wembedding.py ./data/training_input/ [./data/model/autoembedder] """ import sys import pandas as pd import tensorflow as tf from utils.params import with_params ...
the-stack_106_27745
import asyncio from contextlib import suppress from sanic import Blueprint, response from sanic.exceptions import abort from sanic_openapi import doc from .. import helpers, settings, utils from ..models import Template blueprint = Blueprint("Templates", url_prefix="/templates") @blueprint.get("/") @doc.summary("L...
the-stack_106_27746
from flask import Flask, jsonify, request from math import sqrt app = Flask(__name__) @app.route("/name", methods=["GET"]) def name(): name = { "name": "Matthew" } return jsonify(name) @app.route("/hello/<name>", methods=["GET"]) def hello(name): message = { "message":...
the-stack_106_27747
from distutils.core import setup with open('requirements.txt') as fobj: install_requires = [line.strip() for line in fobj] setup( name='instantnews', version='1.2.4', description='Get live news instantaneously', author='shivam singh', author_email='shivam043@gmail.com', url='...
the-stack_106_27749
#synthDrivers/mssp.py #A part of NonVisual Desktop Access (NVDA) #Copyright (C) 2011 NV Access Inc #This file is covered by the GNU General Public License. #See the file COPYING for more details. from .sapi5 import SynthDriver class SynthDriver(SynthDriver): COM_CLASS = "speech.SPVoice" name="mssp" de...
the-stack_106_27750
import h5py import tensorflow as tf from tensorflow.keras.applications.inception_v3 import InceptionV3 import file_utils import numpy as np import pandas as pd from tensorflow.keras.preprocessing.image import load_img, img_to_array from tensorflow.keras.preprocessing import image import cv2 import math from PIL import ...
the-stack_106_27751
from selfdrive.car import apply_std_steer_torque_limits from selfdrive.car.subaru import subarucan from selfdrive.car.subaru.values import DBC, PREGLOBAL_CARS from opendbc.can.packer import CANPacker from common.dp_common import common_controller_ctrl class CarControllerParams(): def __init__(self): self.STEER_...
the-stack_106_27752
#!/usr/lib/python2.7 #####!/usr/bin/env python import subprocess import os import glob import re import sys if sys.version_info[0] > 2: print('Python Detected: ', sys.version_info[0]) else: try: import commands # py2 except NameError: pass # Global variables WEAR_WARN_860_PRO_1TB = 5500 W...
the-stack_106_27753
# -*- coding:utf-8 -*- """ Library for generating XML as a stream without first building a tree in memory. Basic usage:: import elementflow file = open('text.xml', 'w') # can be any object with .write() method with elementflow.xml(file, 'root') as xml: xml.element('item', attrs={'key': 'value'},...
the-stack_106_27758
from baselayer.app.custom_exceptions import AccessError from .general_prediction import GeneralPredictionHandler from ..models import Prediction, Project, DBSession from .. import util import tornado.gen import cesium import uuid import datetime import tempfile import requests import traceback import json class Sci...
the-stack_106_27759
import asyncio import pytest from click.testing import CliRunner pytest.importorskip("requests") import os from multiprocessing import cpu_count from time import sleep import requests from dask.utils import tmpfile import distributed.cli.dask_worker from distributed import Client from distributed.compatibility im...
the-stack_106_27762
""" Django settings for laalaa project. For more information on this file, see https://docs.djangoproject.com/en/1.7/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.7/ref/settings/ """ # Build paths inside the project like this: os.path.join(BASE_DIR, ...) imp...
the-stack_106_27763
# 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 ...
the-stack_106_27765
# # 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...
the-stack_106_27766
# coding=utf-8 import copy import time from config.TicketEnmu import ticket from config.emailConf import sendEmail from config.serverchanConf import sendServerChan from config.bearyChat import notification_by_bearyChat from myException.ticketIsExitsException import ticketIsExitsException from myException.ticketNumOutE...
the-stack_106_27767
# coding=utf-8 # Copyright 2020 The ML Fairness Gym 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 applicab...
the-stack_106_27768
import datetime import re import time import unicodedata import urllib from django.contrib.gis.db import models from django.conf import settings from django.db import connections, transaction from django.db.models import Q from connections import get_connection_name from constants import (STATUS_CHOICES, STATUS_LIVE, U...
the-stack_106_27772
"""HTML slide show Exporter class""" # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. from copy import deepcopy from warnings import warn from traitlets import Bool, Unicode, default from ..preprocessors.base import Preprocessor from .html import HTMLExporter cl...
the-stack_106_27775
from db_user import User from blog_handler import BlogHandler from utils import * from db_comment import Comment from db_like import Like import time ## Class to delete post class DeletePost(BlogHandler): def get(self, post_id): if self.user: ## Getting post key using post_id and user_id ...
the-stack_106_27776
# coding=utf-8 # Copyright 2018 The Tensor2Tensor 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...
the-stack_106_27779
#calculate output cell errors def calculate_output_cell_error(batch_labels,output_cache,parameters): #to store the output errors for each time step output_error_cache = dict() activation_error_cache = dict() how = parameters['how'] #loop through each time step for i in range(1,len(output_ca...
the-stack_106_27781
# -*- coding: utf-8 -*- # MooQuant # # Copyright 2017 bopo.wang<ibopo@126.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 req...
the-stack_106_27782
import pytest from pathlib import Path from daemon.models import FlowModel from jina import Client, Document cur_dir = Path(__file__).parent api = '/flow' @pytest.mark.skip( reason='TestClient uses a ThreadPoolExecutor which messes up RollingUpdate' ) def test_flow_api(monkeypatch, partial_flow_client): fl...
the-stack_106_27785
from PIL import Image, ImageDraw from cv.face_recognition import face_recognition # Load the jpg file into a numpy array image = face_recognition.load_image_file("biden.jpg") # Find all facial features in all the faces in the image face_landmarks_list = face_recognition.face_landmarks(image) print("I found {} face(s...
the-stack_106_27788
state = '10011111011011001' disk_length = 35651584 def mutate(a): b = ''.join(['1' if x == '0' else '0' for x in reversed(a)]) return a + '0' + b def checksum(a): result = '' i = 0 while i < len(a) - 1: if a[i] == a[i+1]: result += '1' else: result += '0' ...
the-stack_106_27791
from django.shortcuts import redirect, render from django.views.generic import View, DetailView from django.db.models import Q from config.settings import AWS_ACCESS_KEY_ID, AWS_S3_REGION_NAME, AWS_SECRET_ACCESS_KEY, AWS_STORAGE_BUCKET_NAME import boto3 from boto3.session import Session from datetime import datetime i...
the-stack_106_27792
import container_service_extension.broker_manager as broker_manager from container_service_extension.exceptions import ClusterAlreadyExistsError from container_service_extension.exceptions import ClusterNotFoundError import container_service_extension.ovdc_utils as ovdc_utils import container_service_extension.pksbroke...
the-stack_106_27795
#!/usr/bin/env python3 # Copyright (c) 2020 The C1pzo Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test the send RPC command.""" from decimal import Decimal, getcontext from itertools import product from tes...
the-stack_106_27797
import glob import math import os import shutil from datetime import datetime from datetime import timezone import regex as re import yaml from feedgen.feed import FeedGenerator from .CONSTANTS.directories import content_dir, static_dir, public_dir from .CONSTANTS.environment import jinja_env from .CONSTANTS.config i...