text
stringlengths
2
999k
# Created by Andrew Silva """ Adapted from https://github.com/Adoni/word2vec_pytorch """ import torch from torch import nn import torch.nn.functional as F import numpy as np class SkipGramModel(nn.Module): """Skip gram model of word2vec. Attributes: emb_size: Embedding size. emb_dimention: Em...
import subprocess from threading import Thread startupinfo = subprocess.STARTUPINFO() startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW startupinfo.wShowWindow = subprocess.SW_HIDE def listCam(): global startupinfo process1 = subprocess.run(["ffmpeg.exe","-list_devices","true","-f","dshow","-i","dummy"],...
import discord from discord.commands import CommandPermission, SlashCommandGroup from discord.ext import commands bot = discord.Bot(debug_guilds=[...], owner_id=...) # main file class Example(commands.Cog): def __init__(self, bot): self.bot = bot greetings = SlashCommandGroup("greetings", "Various ...
# # 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 us...
from rdkit import Chem from rdkit.Chem import AllChem, Descriptors import numpy as np from rdkit.ML.Descriptors import MoleculeDescriptors from sklearn import preprocessing import random from hyperopt import tpe, fmin, Trials from sklearn.metrics import average_precision_score, roc_auc_score from sklearn.model_selectio...
import json import os import subprocess import uuid from subprocess import Popen from story.utils import * class Story: def __init__( self, story_start, context="", seed=None, game_state=None, upload_story=False ): self.story_start = story_start self.context = context self.rat...
import sqlite3 # UNCOMMENT AND USE CODE BELOW IF northwind_small.sqlite3 FILE NOT IN LOCAL STORAGE # !wget https://github.com/lechemrc/DS-Unit-3-Sprint-2-SQL-and-Databases/blob/master/\ # northwind_small.sqlite3?raw=true -O northwind_small.sqlite3 conn = sqlite3.connect('northwind_small.sqlite3') c...
import os import numpy as np opj = os.path.join from astropy.io import fits data_path = '../../data/cosmology' def downsample(parameter_file, root_dir, resize=64, nsamples=30000, ncosmo=10): ''' downsample cosmolgy image ''' print('preprocessing...') img_size = 256 params_ = np.loadtxt(para...
import numpy as np import matplotlib.pyplot as plt import seaborn as sns from random import * import math # Traitement des donnees # Comme chaque ligne contient id:context:reward, la classe data permet de bien gérer et stocker les données class Data: def __init__(self, FILENAME): self.reward=[] # Contient ...
# # -*- coding: utf-8 -*- # # Copyright (c) 2019 Intel Corporation # # 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 ...
# Python imports from os.path import abspath, basename, dirname, join, normpath import sys # ##### PATH CONFIGURATION ################################ # fetch Django's project directory DJANGO_ROOT = dirname(dirname(abspath(__file__))) # fetch the project_root PROJECT_ROOT = dirname(DJANGO_ROOT) # the name of the ...
# -*- coding: utf-8 -*- # # 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 #...
#!C:\Users\Harry\PycharmProjects\GASEN\venv\Scripts\python.exe # EASY-INSTALL-ENTRY-SCRIPT: 'pip==10.0.1','console_scripts','pip3' __requires__ = 'pip==10.0.1' import re import sys from pkg_resources import load_entry_point if __name__ == '__main__': sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]...
# Copyright 2019 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import sys import config_util # pylint: disable=import-error # This class doesn't need an __init__ method, so we disable the warning # pylint: disable=no...
# -*- coding: utf-8 -*- from __future__ import print_function, division, absolute_import from scipy.misc import lena from numpy import ones import numpy from numba.decorators import jit from numba import int32, int64 # Original approach will be slower for now due to the object mode failback # for numpy.zero_like # #...
# Generated by Django 2.2.4 on 2019-09-07 19:33 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('blog', '0001_initial'), ] operations = [ migrations.AlterField( model_name='post', name='slug', field=mo...
from pathlib import Path from unittest import TestCase import toml from assertpy import assert_that from gsfpy3_08 import __version__ as module_version class TestVersion(TestCase): def test_version(self): pyproject_file = Path(__file__).parents[2] / "pyproject.toml" pyproject = toml.load(pyproje...
from rest_framework import serializers from .models import Profile,Project class MerchSerializer(serializers.ModelSerializer): class Meta: model = Profile fields = ('name', 'bio') class MerchSerializer1(serializers.ModelSerializer): class Meta: model = Project ...
#### NOTICE: THIS FILE IS AUTOGENERATED #### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY #### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES from swgpy.object import * def create(kernel): result = Tangible() result.template = "object/tangible/veteran_reward/shared_frn_vet_tie_fighter_toy.iff" result.attribute...
import sys, os import click from comet_ml import ExistingExperiment import comet_ml @click.command() @click.argument('experiment_dir', type=click.Path(exists=True)) def cli(experiment_dir): comet_config_filepath = os.path.abspath(os.path.join(experiment_dir,".comet.config")) if not os.path.exist...
def quicksort(source_list): control_stack = [] control_stack.append([0, len(source_list) - 1, (len(source_list) - 1) / 2]) while len(control_stack) > 0: point = control_stack.pop() source_list.sort() return source_list
from distutils.core import setup from Cython.Build import cythonize import numpy setup( name = 'cyclic decoding', ext_modules = cythonize("decoding.pyx"), include_dirs=[numpy.get_include()] )
# 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 ...
# -*- test-case-name: twisted.web.test.test_flatten -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. """ Context-free flattener/serializer for rendering Python objects, possibly complex or arbitrarily nested, as strings. """ from __future__ import division, absolute_import from io import B...
import os import platform import random from Tkinter import * from PIL import Image, ImageTk import pygame """Pythonic implementation of Conway's Game of Life. Rules: 1. Any live cell with fewer than two live neighbours dies, as if caused by under-population. 2. Any live cell with two or three live neighbou...
# Copyright 2019 Pascal Audet # # This file is part of RfPy. # # 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, mod...
""" Django settings for deet_34478 project. Generated by 'django-admin startproject' using Django 2.2.2. For more information on this file, see https://docs.djangoproject.com/en/2.2/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/2.2/ref/settings/ """ import os...
# -*- coding: utf-8 -*- import pydash as _ import arrow from time import sleep from common.kafka import consumer from common.log import logger from common.mongo.bson_c import json_util from .base import Base class Kafka2Elasticsearch(Base): def __init__(self): Base.__init__(self) self._consumer...
#!/usr/bin/env python # -*- coding: utf-8 -*- # AUTHOR = u'San Diego Python' SITENAME = u'San Diego Python' SITEURL = 'http://pythonsd.org' TIMEZONE = 'America/Los_Angeles' DEFAULT_LANG = u'en' TEMPLATE_PAGES = { 'static/home.html': 'index.html', } # Social widget # Icons are in themes/sandiegopython/static/im...
#******************************************************************************* # Copyright 2020 Intel Corporation # All Rights Reserved. # # This software is licensed under the Apache License, Version 2.0 (the # "License"), the following terms apply: # # You may not use this file except in compliance with the ...
import re import json from .consts import * from .backend import BackendMixin import Jumpscale from Jumpscale import j from collections import defaultdict SCHEME_UID_PAT = "(?P<schema>.+?)://(?P<id>.+)" j.data.schema.get_from_text( """ @url = proj.todoitem title** = "" (S) done** = False (B) """ ) j.data.sche...
''' Created by auto_sdk on 2018.07.25 ''' from top.api.base import RestApi class LocationRelationQueryRequest(RestApi): def __init__(self, domain='gw.api.taobao.com', port=80): RestApi.__init__(self, domain, port) self.location_relation = None def getapiname(self): return ...
""" test_domain_js ~~~~~~~~~~~~~~ Tests the JavaScript Domain :copyright: Copyright 2007-2020 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. """ from unittest.mock import Mock import pytest from docutils import nodes from sphinx import addnodes from sphinx.addnodes imp...
# import logging # # import decouple # import structlog # from gunicorn import glogging # # processors = [ # structlog.stdlib.add_log_level, # structlog.stdlib.PositionalArgumentsFormatter(), # structlog.processors.TimeStamper(fmt="iso"), # structlog.processors.JSONRenderer(sort_keys=True), # ] # if dec...
# -*- mode:python; coding:utf-8 -*- # Copyright (c) 2020 IBM Corp. 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 # ...
from unittest import TestCase from rest_framework import status from rest_framework.reverse import reverse from rest_framework.test import APIClient from chibi_user.models import Token from chibi_user.tests import get_user_test, get_superuser_test from test_runners.snippet.response import get_location, assert_status_c...
import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets("MNIST_data/", one_hot=True) x=tf.placeholder(tf.float32, [None, 784]) W = tf.Variable(tf.zeros([784,10])) b = tf.Variable(tf.zeros([10])) y = tf.nn.softmax(tf.matmul(x,W) + b) y_ = tf.placeholder(t...
#BEGIN_LEGAL # #Copyright (c) 2019 Intel Corporation # # 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 ...
# Copyright 2019, Kay Hayen, mailto:kay.hayen@gmail.com # # Python test originally created or extracted from other peoples work. The # parts from me are licensed as below. It is at least Free Software where # it's copied from other people. In these cases, that will normally be # indicated. # # L...
''' You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees (clockwise). Note: You have to rotate the image in-place, which means you have to modify the input 2D matrix directly. DO NOT allocate another 2D matrix and do the rotation. Example 1: Given input matrix = [ [1,2,3], [...
# coding: utf-8 """ Kubernetes No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 OpenAPI spec version: v1.13.5 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import import unittest import kube...
# flake8: noqa """ Copyright 2020 - Present Okta, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in ...
# * * * * * # * * * * * # * * * * * # * * * * * # * * * * * # for i in range(0, 5): # for j in range(0, 5): # print('*', end=" ") # print("") #---------------------------------------------------------------------------------------- # 1 1 1 1 1 # 1 1 1 1 1 # 1 1 1 1 1 # 1 1 1 1 1 # 1 ...
#!/usr/bin/env python """Look up and set the delivery mechanism for all 3M books.""" from nose.tools import set_trace import os import sys bin_dir = os.path.split(__file__)[0] package_dir = os.path.join(bin_dir, "..") sys.path.append(os.path.abspath(package_dir)) from core.monitor import IdentifierSweepMonitor from cor...
class BaseMaskConfigException(Exception): """Raise if base mask for demux_reads is malformed""" pass def split_bases_mask(bases_mask): """Parse a picard style bases mask and return a list of tuples >>> split_bases_mask("100T8B8B100T") [('T', 100), ('B', 8), ('B', 8), ('T', 100)] """ split...
import xlsxwriter import mysql.connector from selenium.webdriver.chrome.options import Options from selenium import webdriver import time from bs4 import BeautifulSoup import numpy as np import pandas as pd import xlrd from selenium import webdriver import requests, time import re import os from webdriver_manager.chro...
import datetime from functools import partial import cftime import numpy as np from .functions import _DEPRECATION_ERROR_CLASS _default_calendar = "gregorian" # -------------------------------------------------------------------- # Mapping of CF calendars to cftime date-time objects # ------------------------------...
# Copyright 2019 Google LLC. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
from setuptools import setup from codecs import open from os import path here = path.abspath(path.dirname(__file__)) with open(path.join(here, 'README.md'), encoding='utf-8') as f: long_description = f.read() try: import pypandoc long_description = pypandoc.convert_text( long_descr...
#!/usr/bin/python # -*- coding: utf-8 -*- #from weibopy.api import API from weibo import APIClient import sys,os,urllib,urllib2,cookielib,httplib import webbrowser import urlparse #模拟授权并且获取回调地址上的code,以获得acces token和token过期的UNIX时间 def get_code(): APP_KEY = 'xxxxxxxxxx' #你申请的APP_KEY APP_SECRET = 'xxxxxxxxxxxxxxxxxxxx...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('video', '0003_auto_20160621_0250'), ] operations = [ migrations.AddField( model_name='category', nam...
import datetime from flask_socketio import SocketIO from flask import Flask, json, Response, request, jsonify, send_file from werkzeug.utils import secure_filename from os import path, getcwd from db import Database from face import Face app = Flask(__name__) app.config['SECRET_KEY'] = 'asdewq123' socketio = SocketIO...
# -*- coding: utf-8 -*- # Copyright 2019 The GraphicsFuzz Project 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
import datetime as _dt import pydantic from uuid import UUID from typing import List, Optional class PlanReqBase(pydantic.BaseModel): credit_price: int access_type: str duration: int class PlanResBase(PlanReqBase): id: str class PlanResponse(PlanResBase): date_created: _dt.datetime last_up...
# 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 textmodifier.__main__ import TextModifier
from dask.distributed import Client import numpy as np import matplotlib as mpl import matplotlib.mlab as mlab import matplotlib.pyplot as plt import matplotlib.tri as tri import cartopy.crs as ccrs import geodata as gd import pystare as ps import h5py as h5 from pyhdf.SD import SD, SDC import yaml from sortedcon...
""" Quantization modules """ import torch import torch.nn as nn import torch.nn.functional as F from .utee import wage_quantizer def dorefa_quant(x, nbit, dequantize=True): x = torch.tanh(x) scale = 2**nbit - 1 x = x / 2 / x.abs().max() + 1/2 xq = torch.round(x * scale) if dequantize: ...
# Task 1B Demonstration program # Yuqing Xue (yx357) from floodsystem.stationdata import build_station_list from floodsystem.geo import stations_by_distance def run(): stations=build_station_list() cambridge=(52.2053, 0.1218) x=stations_by_distance(stations, cambridge) print("The closest 10 entries:",...
# Copyright 2018 Autodesk, Inc. All rights reserved. # # Use of this software is subject to the terms of the Autodesk license agreement # provided at the time of installation or download, or which otherwise accompanies # this software in either electronic or hard copy form. # # See docs folder for detailed usage info...
# v1.0 import datetime as dt import platform import subprocess import time from web3 import Web3 from web3.middleware import geth_poa_middleware import csv w3 = Web3(Web3.HTTPProvider('https://bsc-dataseed1.binance.org/')) w3.middleware_onion.inject(geth_poa_middleware, layer=0) class dapps: pancak...
# Copyright 2021 Huawei Technologies Co., Ltd # # 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...
""" Utils for handling local network with ip and ports. """ # The MIT License (MIT) # Copyright © 2021 Yuma Rao # 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...
# 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 ...
import re import ctypes import struct import itertools def normalize(distxt): # runs of spaces become one space distxt = re.sub(r'\s+', ' ', distxt) # remove spaces after commas distxt = re.sub(r', +', ',', distxt) # remove leading zeroes from hex immediates distxt = re.sub(r'0x(0+)', '0x', distxt) # map regs ...
import pytest @pytest.mark.asyncio async def test_video_info(client): video = await client.video("fLAcgHX160k") assert video.title == "The Advent of Omegaα"
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * class AlipayOpenMiniDeveloppackageQueryModel(object): def __init__(self): self._bundle_id = None self._deploy_version = None self._developer_version = None self._inst_co...
"""Auto-generated file, do not edit by hand. IN metadata""" from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata PHONE_METADATA_IN = PhoneMetadata(id='IN', country_code=91, international_prefix='00', general_desc=PhoneNumberDesc(national_number_pattern='008\\d{9}|1\\d{7,12}|[2-9]\\d{9,10}', pos...
# Copyright The IETF Trust 2017-2019, All Rights Reserved # -*- coding: utf-8 -*- # Autogenerated by the makeresources management command 2017-02-15 10:10 PST from tastypie.resources import ModelResource from tastypie.fields import ToManyField # pyflakes:ignore from tastypie.constants import ALL, ALL_...
# 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 from ... import _utilities, _tables from...
# -*- coding: utf-8 -*- # Generated by Django 1.11.5 on 2017-09-25 07:22 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('emails', '0001_initial'), ] operations = [ migrations.CreateModel( ...
import operator from functools import reduce from django.db import models from django.db.models import Q class AuditTrailManager(models.Manager): def get_queryset(self): return super(AuditTrailManager, self).get_queryset().filter( version_superseded_time=None) class OutletQuerySet(models.Que...
# 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...
print(__doc__) import warnings import matplotlib.pyplot as plt import numpy as np from scipy import linalg from sklearn.linear_model import (RandomizedLasso, lasso_stability_path, LassoLarsCV) from sklearn.feature_selection import f_regression from sklearn.preprocessing import Stan...
# Copyright 2014-2015 MongoDB, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writin...
# Implements part of speech tagging using fully unsupervised HMM from read_got import * import random import numpy as np import os class POSTagger(object): def __init__(self, data, resume=True): """ __init__(POSTagger, DataProvider, bool) -> None data: An instantiation of a subclass of DataProvider resum...
import requests import json import os import evidence_label as el import evidence_direction as ed import logging import mutation_type as mut from warnings import warn resourceURLs = { "assertions": "/v2/assertion/search" } mmService = "http://api.molecularmatch.com" apiKey = os.environ.get('MOLECULAR_MATCH_API_...
#!/usr/bin/env python # coding: utf-8 # by nayebiga@msu.edu __version__ = "0.0.1" from numpy.random import choice from torch import ( Tensor, argmax, cat, diagonal, empty, eye, fliplr, index_select, mode, randperm, ) from torch import sum as torch_sum from torch import tensor f...
# 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...
# Name: ruleanalyzer.py # Author: Michael Miranda import re import argparse parser = argparse.ArgumentParser() parser.add_argument("rules", help="path to the rules file to analyze") parser.add_argument("--report", help="rule field to print: action,protocol,source,source_port,destination,destination_port,header,optio...
""" loginpass.instagram ~~~~~~~~~~~~~~~~~~ Loginpass Backend of Instagram (instagram.com) Useful Links: - Dev Portal: https://www.instagram.com/developer/ - Apps need to be reviewed: https://www.instagram.com/developer/review/ :copyright: (c) 2019 by Ruben Di Battista :license: BSD, ...
""" WSGI config for KayakMask 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/2.2/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application os.environ.setdefault('DJANGO_SET...
# (C) Datadog, Inc. 2019-present # All rights reserved # Licensed under a 3-clause BSD style license (see LICENSE) METRIC_MAP = { 'go_gc_duration_seconds': 'go.gc.duration.seconds', 'go_goroutines': 'go.goroutines', 'go_info': 'go.info', 'go_memstats_alloc_bytes': 'go.memstats.alloc.bytes', 'go_mems...
import usocket as socket import setting import time import gc import ujson _mimeTypes = { b'.txt' : b'text/plain', b'.htm' : b'text/html', b'.html' : b'text/html', b'.css' : b'text/css', b'.json' : b'application/json', b'.jpg' : b'image/jpeg', b'.jpeg' : b'image/jpeg...
from django.apps import AppConfig class SearchapiConfig(AppConfig): name = 'searchApi'
import getopt import sys import vcf pathLoc = None outFName = None options, args = getopt.getopt(sys.argv[1:], 'p:o:h') for opt, par in options: if opt == '-h': print 'options:' print '-h: print this help and exit' print '-p: <pathLoc> specify vcf file' print '-o: <outFName> sp...
# -*- coding: utf-8 -*- info = { "name": "eu", "date_order": "YMD", "january": [ "urtarrila", "urt" ], "february": [ "otsaila", "ots" ], "march": [ "martxoa", "mar" ], "april": [ "apirila", "api" ], "may": [ ...
def get_parameter_count(network): """ Calculate the number of parameters used by the fully connected network. Hint: Casting the result of network.parameters() to a list may make it easier to work with Args: network: Network to calculate the parameters of Returns: param_count: The number ...
from itertools import zip_longest def abbreviate(text): acronym = text[0].upper() for curr, nextt in zip_longest(text, text[1:]): if curr == ':' or nextt is None: break if curr == ' ' or curr == '-' or nextt.isupper(): acronym += nextt.upper() return acronym
import os import secrets from PIL import Image from flask import render_template, url_for, flash, redirect, request from calendarapp.forms import LoginForm, RegistrationForm, EventForm from calendarapp import app, db, bcrypt from calendarapp.models import User, Event from flask_login import login_user, current_user, lo...
# coding: utf-8 """ clouddb OpenAPI spec version: 2018-06-21T02:28:05Z Generated by: https://github.com/swagger-api/swagger-codegen.git """ import pprint import re # noqa: F401 import six class GetCloudDBImageProductListRequest(object): """NOTE: This class is auto generated by the swagger c...
"""Common configure functions for TACACS server""" # Python import logging # Unicon from unicon.core.errors import SubCommandFailure log = logging.getLogger(__name__) def configure_tacacs_server(device, server_config): """ Configure tacacs server Args: device ('obj'): Device object ...
from enum import Enum import json import re from typing import List, Optional from gochan.event_handler import CollectionChangedEventArgs, CollectionChangedEventHandler, CollectionChangedEventKind from gochan.models.board import ThreadHeader from gochan.models.thread import Response, Thread class BreakException(Exce...
# Copyright 2011 Sybren A. Stüvel <sybren@stuvel.eu> # # 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 applicabl...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.contrib import admin from .models import Submit admin.site.register(Submit)
def test_repl(started_standalone_bootstrap_node): repl_commands = [ '5', 'new s(`rho:io:stdout`) in { s!("foo") }', '@"listCh"!([1, 2, 3]) | for(@list <- @"listCh"){ match list { [a, b, c] => { new s(`rho:io:stdout`) in { s!(a) } } } }', ] for repl_cmd in repl_commands: start...
import threading, queue def run_thread_classes(thread_cls, num_of_threads, list_of_init_args=None): thread_classes = [] for i in range(num_of_threads): if list_of_init_args and i < len(list_of_init_args): thread_classes.append(thread_cls(*list_of_init_args[i]).start()) else...
# # Copyright 2014 Apache Software 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 agree...
"""empty message Revision ID: 6aa1a423eb00 Revises: Create Date: 2020-12-03 13:47:02.155535 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '6aa1a423eb00' down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands auto gene...
"""This module contains the general information for AdaptorIpV6RssHashProfile ManagedObject.""" from ...ucsmo import ManagedObject from ...ucscoremeta import MoPropertyMeta, MoMeta from ...ucsmeta import VersionMeta class AdaptorIpV6RssHashProfileConsts: IP_HASH_DISABLED = "disabled" IP_HASH_ENABLED = "enabl...