text
stringlengths
1
927k
"""Forms for authentication module.""" from django import forms from django.utils.translation import ugettext_lazy as _ from django.contrib.auth.tokens import default_token_generator from django.contrib.sites.shortcuts import get_current_site from django.contrib.auth import get_user_model from django.template import lo...
# coding: utf-8 """ Pure Storage FlashBlade REST 1.4 Python SDK Pure Storage FlashBlade REST 1.4 Python SDK, developed by [Pure Storage, Inc](http://www.purestorage.com/). Documentations can be found at [purity-fb.readthedocs.io](http://purity-fb.readthedocs.io/). OpenAPI spec version: 1.4 Contact: i...
# Copyright (C) 2015-2022 by Vd. # This file is part of Rocketgram, the modern Telegram bot framework. # Rocketgram is released under the MIT License (see LICENSE). import warnings from dataclasses import dataclass from datetime import datetime from typing import Dict, List, Optional from .animation import Animation...
import logging import time from typing import Callable, Optional from fastapi import FastAPI, Request from fastapi.exceptions import RequestValidationError from fastapi.middleware.gzip import GZipMiddleware from servicelib.fastapi.openapi import override_fastapi_openapi_method from starlette import status from starlet...
import pytest # from collections import namedtuple from colt import Plugin @pytest.fixture def plugin(): class ExamplePlugin(Plugin): _plugins_storage = '_methods' _is_plugin_factory = True class PluginOne(ExamplePlugin): pass class PluginTwo(ExamplePlugin): pass c...
import hashlib from corehq.apps.integration.models import ( DialerSettings, GaenOtpServerSettings, HmacCalloutSettings, ) def domain_uses_dialer(domain): try: settings = DialerSettings.objects.get(domain=domain) return settings.is_enabled except DialerSettings.DoesNotExist: ...
#!/usr/bin/python3 import ftplib, linecache, sys, time, os def login(ftp,user,passw): try: ftp.login(user.strip(),passw.strip()) print("\nType 'q' or 'quit' to quit\n") print("List Local Directory: local") print("List Host Directory: ls") print("Download: download") ...
import speech_recognition as sr import pyttsx3 listener = sr.Recognizer() engine = pyttsx3.init() def speak(phrase): engine.say(phrase) engine.runAndWait() def set_voice(): """ Set voice to English by default. Can modify the chosen_voice variable to set a different default voice. :return...
import numpy as np from collections import namedtuple import json import tensorflow as tf # hyperparameters for our model. I was using an older tf version, when HParams was not available ... # controls whether we concatenate (z, c, h), etc for features used for car. MODE_ZCH = 0 MODE_ZC = 1 MODE_Z = 2 MODE_Z_HIDDEN =...
"""AyudaEnPython: https://www.facebook.com/groups/ayudapython Simulador de dado simple # ┌────────-┬-─────┬────────-┬──────┬─────────┬──────┐ # │ Unicode │ Char │ Unicode │ Char │ Unicode │ Char │ # └─────────┴──────┴─────────┴──────┴─────────┴──────┘ # u+2680 ⚀ u+2681 ⚁ u+2682 ⚂ # ...
"""calc_LU_impact.py author: Auke Visser date: 12.10.2016 This script calculates the land use impact on temperature following the algorithm by Kumar et al. (2013) and Lejeune et al. (2016, in rev.) This code is inspired by Quentin Lejeune's NCL version of the Kumar algorithm. """ import netCDF4 as nc import numpy...
import discord import nekos from discord.ext import commands class NSFW(commands.Cog): def __init__(self, bot): self.bot = bot @commands.command() @commands.is_nsfw() async def nsfwtrap(self, ctx: commands.Context): await ctx.send(nekos.img("trap")) @commands.command() @comma...
# -*- coding: utf-8 -*- # # Copyright © 2014-2015 Colin Duquesnoy # Copyright © 2009- The Spyder Developmet Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) """ Provides widget classes and functions. .. warning:: Only PyQt4/PySide QtGui classes compatible with PyQt5.QtWidgets ar...
import logging import json import os import maya.cmds as cmds from avalon import io, api from avalon.maya.pipeline import AVALON_CONTAINER_ID from ....utils import get_representation_path_ from ....maya import lib, utils from ...pipeline import ( get_container_from_namespace, iter_containers_from_namespace, ...
import copy import numpy as np from environment.basic_classes import Space # class bandit: # def __init__(self, value_mean=0.0, value_var=1.0): # """ # bandit, reward is produced by a normal distribution with mean and variance; # :param value_mean: mean # :param value_var: varianc...
import torch import lietorch import numpy as np import matplotlib.pyplot as plt from lietorch import SE3 from modules.corr import CorrBlock, AltCorrBlock import geom.projective_ops as pops class FactorGraph: def __init__(self, video, update_op, device="cuda:0", corr_impl="volume", max_factors=-1): self.v...
import requests as req from ndj_toolbox.fetch import (xml_df, save_files) url_base = 'https://www.al.sp.gov.br/repositorioDados/' url_file = 'deputados/areas_atuacao.xml' url = url_base + url_file def main(): xml_data = req.get(url).content dataset = xml_df(xml_data).process_data() dataset = dataset[['I...
from sqlalchemy.dialects.postgresql import UUID from sqlalchemy.schema import FetchedValue from sqlalchemy.ext.associationproxy import association_proxy from app.api.utils.models_mixins import Base from app.extensions import db class MineReportSubmission(Base): __tablename__ = "mine_report_submission" mine_r...
############################################################################### ## ## Copyright (C) 2014-2016, New York University. ## Copyright (C) 2011-2014, NYU-Poly. ## Copyright (C) 2006-2011, University of Utah. ## All rights reserved. ## Contact: contact@vistrails.org ## ## This file is part of VisTrails. ## ## ...
import json from collections import defaultdict import emoji import requests from disco.types.message import MessageEmbed from holster.enum import Enum from rowboat.models.guild import Guild from rowboat.plugins import RowboatPlugin as Plugin from rowboat.redis import rdb from rowboat.types import SlottedModel, DictF...
"""Other tests.""" import sys import pytest import humanize def test_version(): if sys.version_info >= (3, 7): with pytest.warns(DeprecationWarning): VERSION = humanize.VERSION else: VERSION = humanize.VERSION assert VERSION == humanize.__version__
from csapp.models import Kruptos from rest_framework import viewsets, permissions from rest_framework.response import Response from rest_framework import status from .serializers import KruptosSerializer class KruptosViewSet(viewsets.ModelViewSet): permission_classes = [ permissions.AllowAny ] ser...
#!/usr/bin/venv python3 import threading from time import sleep, ctime loops = [4, 2] def loop(nloop, nsec): print('start loop', nloop, 'at:', ctime()) sleep(nsec) print('loop', nloop, 'done at:', ctime()) def main(): print('starting at:', ctime()) threads = [] nloops = range(len(loops)) ...
from torch import nn, Tensor from typing import List, Union __all__ = ["ApplySoftmaxTo", "ApplySigmoidTo", "Ensembler", "PickModelOutput"] class ApplySoftmaxTo(nn.Module): def __init__(self, model: nn.Module, output_key: Union[str, List[str]] = "logits", dim=1, temperature=1): """ Apply softmax a...
#-*- coding: utf-8 -*- from .ActionEnum import * from .Position import Position class Action(object): def __init__(self, action, position, value, organism): self.__action = action self.__position = position self.__value = value self.__organism = organism # getters & setters ...
from data import DataSeq def InsertionSort(ds): assert isinstance(ds, DataSeq), "Type Error" Length = ds.length for i in range(Length): tmp = ds.data[i] j=i while j>=1 and ds.data[j-1]>tmp: ds.SetVal(j, ds.data[j-1]) j-=1 ds.SetVal(j, tmp) if __nam...
#%% #! python import h5py import matplotlib.pyplot as plt import mcmc.image_cupy as im import mcmc.plotting as p import numpy as np import scipy.linalg as sla import scipy.special as ssp import mcmc.util_cupy as util import cupy as cp import importlib import datetime import pathlib,os import argparse import parser_help...
#!/usr/bin/env python # Copyright 2013, 2016 by Iddo Friedberg idoerg@gmail.com # All rights reserved. # This file is part of the Biopython distribution and governed by your # choice of the "Biopython License Agreement" or the "BSD 3-Clause License". # Please see the LICENSE file that should have been included as part ...
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. """OSCD datamodule.""" from typing import Any, Dict, List, Optional, Tuple import kornia.augmentation as K import pytorch_lightning as pl import torch from einops import repeat from torch.utils.data import DataLoader, Datas...
# Class to hold information about fx-files # # 2014-10-23 SR # 2015-05-04 ME - rewrote to handle arbitrary fx-file (hopefully) # # Currently holds just an unique ID value (string) # and the full path of the file (including name and extension) # import pdb class FX_file_exception(Exception): pass class FX_fil...
import pytz import datetime, os ### CONVERT FROM ONE TIME ZONE TO ANOTHER def convert_timezone(_from, to): # samples 'Africa/Lagos', 'US/Central' source_zone = pytz.timezone(_from) target_zone = pytz.timezone(to) curtime = source_zone.localize(datetime.datetime.now()) curtime = curtime.astimezone...
from mock import Mock from backdrop import StatsClient class TestStatsd(object): def setup(self): self.client = Mock() self.wrapper = StatsClient(self.client) def test_timer(self): self.wrapper.timer('foo.bar', data_set='monkey') self.client.timer.assert_called_with('monkey.fo...
# This file is generated by objective.metadata # # Last update: Sun Mar 22 17:16:16 2020 # # flake8: noqa import objc, sys if sys.maxsize > 2 ** 32: def sel32or64(a, b): return b else: def sel32or64(a, b): return a misc = {} constants = """$PSEnclosureDownloadStateDidChangeNotification$P...
# 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...
import os import meshio import numpy as np import pandas as pd import ezdxf catalogue_columns = ["t0", "m0", "mw", "x", "y", "z", "area", "dt"] def read_binary(file: str, format: str, endian: str = "little"): """ Reads integer values from binary files that are output of RSQSim :param file: file to read...
import time from pathlib import Path from random import choice import cv2 import numpy as np from PIL import Image from PIL import ImageDraw from PIL import ImageFont from skimage.morphology import square, dilation def get_grid_char_img(fonts_paths): font_name = choice(fonts_paths) size = np.random.randint(5...
""" Prepare all X-ray structures for FAH # Projects 13430 : apo Mpro monomer His41(0) Cys145(0) 13431 : apo Mpro monomer His41(+) Cys145(-) 13432 : holo Mpro monomer His41(0) Cys145(0) 13433 : holo Mpro monomer His41(+) Cys145(-) 13434 : apo Mpro dimer His41(0) Cys145(0) 13435 : apo Mpro dimer...
""" Implement the missing code, denoted by ellipses. You may not modify the pre-existing code. It frustrates you more than you'd like to admit that the solution operator in Python can be applied to non-integer values. When you write code, you expect the result of the solution operator to always be an integer, but thank...
from Number_Theory.optimized_gcd import * import numpy as np ################################################################## # Function : mod_inv # Utilizes the extended gcd function defined in optimized_gcd.py # to find the modular inverse of a mod(n) when a and n are # relatively prime. # # Throws an error if a a...
"""SCons.Tool.clang Tool-specific initialization for Clang as CUDA Compiler. There normally shouldn't be any need to import this module directly. It will usually be imported through the generic SCons.Tool.Tool() selection method. """ import SCons.Tool import SCons.Scanner.C import SCons.Defaults import os import pl...
# Ivy Tech - SDEV 140 - Introduction to Software Development # Chapter 5 Exercise 12. Maximum of Two Values # Andrew M. Pierce Associate of Applied Science - Software Development # Python 3.8.6 # logging for exceptions / sys for quit / time for sleep import logging import sys import time # Handles all user input, ex...
# # 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...
import sys import numpy as np sys.path.append('../..') from data.datagenerator import DataGenerator if __name__ == '__main__': if(len(sys.argv) != 3): print('Usage: python thisfile.py desc.bin desc.txt') sys.exit(1) pc_mat = DataGenerator.load_point_cloud(sys.argv[1], 3+32) np.savetxt(sys...
import os import re from opsbro.collector import Collector class DiskUsage(Collector): def launch(self): logger = self.logger # logger.debug('getDiskUsage: start') # logger.debug('getDiskUsage: attempting Popen') if os.name == 'nt': self.set_not_eligible('This...
# coding: utf-8 # Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved. # This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c...
try: from tkinter import * except: from Tkinter import * import geren.gerenciamento as ger import GUI.cadastro as cad import GUI.sobre as sob import GUI.relatorios as rel ger.abertura() class Janela: def __init__(self,toplevel): self.toplevel = toplevel self.toplevel.title('Gerenciament...
from .atari_env import PomdpAtariEnv
""" average results Zhiang Chen, Oct 2 """ import os import numpy as np import matplotlib.pyplot as plt training = True if training: npy_files = [f for f in os.listdir('results') if 'true' not in f] else: npy_files = [f for f in os.listdir('results') if 'true' in f] results_all = np.zeros((200, 200, len(npy...
from datetime import datetime from .humanize import humanize_file_size from ..defaults.default_data_structure import default_client_backup_report import os class TxtReports: """ Formats a dict of clients and prints to stdout or exports to file """ def __init__(self, clients, file=Non...
# # PySNMP MIB module HP-ICF-GPPCV2-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HP-ICF-GPPCV2-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:21:34 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Ma...
# electric_car.py class Car(): """一次模拟汽车的简单尝试""" def __init__(self, make, model, year): """初始化描述汽车的属性""" self.make = make self.model = model self.year = year self.odometer_reading = 0 def get_descriptive_name(self): """返回整洁的描述性信息""" long_...
#!/usr/bin/python # -*- encoding: utf-8 -*- import torch import torch.nn as nn import torch.nn.functional as F import torch.cuda.amp as amp ## # version 1: use torch.autograd class LabelSmoothSoftmaxCEV1(nn.Module): ''' This is the autograd version, you can also try the LabelSmoothSoftmaxCEV2 that uses der...
# coding: utf-8 """ Pure Storage FlashBlade REST 1.10 Python SDK Pure Storage FlashBlade REST 1.10 Python SDK. Compatible with REST API versions 1.0 - 1.10. Developed by [Pure Storage, Inc](http://www.purestorage.com/). Documentations can be found at [purity-fb.readthedocs.io](http://purity-fb.readthedocs.io/...
""" Contains classes for the comparison of models on the MNIST dataset. Main models: - MLPNet: Feed forward NN with linear layers - SPNNet: Same as MLPNet but replaces certain layers with SPNLayer - SPNNeuron: Defines the SPN architecture of a single neuron in a SPNLayer """ import logging import time import numpy as ...
#!/usr/bin/env python3 from concurrent.futures import ThreadPoolExecutor import os import rackspace_monitoring.providers import rackspace_monitoring.types import network import scan MAX_WORKERS = 100 DEFAULT_MONITORING_ZONES = \ ("mzdfw", "mzord", "mziad", "mzlon", "mzhkg", "mzsyd") def get_driver(user, api_k...
#!/usr/bin/python __author__ = "Bassim Aly" __EMAIL__ = "basim.alyy@gmail.com" # Example 1 import re intf_ip = 'Gi0/0/0.911 10.200.101.242 YES NVRAM up up' match = re.search('10.200.101.242', intf_ip) if match: print match.group() # Example 2 import re intf_ip = '''Gi0/0/0.705 ...
from flask import Flask, render_template, flash, redirect, url_for, session, request, logging from passlib.hash import sha256_crypt from . import admin as bp from .. import mysql from ..decoradores import usuario_conectado, usuario_nao_conectado, admin_conectado, admin_nao_conectado @bp.route('/admin_entrar', met...
# 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 ...
# -*- coding: utf-8 -*- # This code is part of Qiskit. # # (C) Copyright IBM 2017, 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any...
from avalon.vendor import qargparse from avalon.tvpaint import lib, pipeline class ImportImage(pipeline.Loader): """Load image or image sequence to TVPaint as new layer.""" families = ["render", "image", "background", "plate"] representations = ["*"] label = "Import Image" order = 1 icon = "...
#!/usr/bin/env python # Copyright 2013 - 2018, New York University and the TUF contributors # SPDX-License-Identifier: MIT OR Apache-2.0 """ <Program Name> setup.py <Author> Vladimir Diaz <vladimir.v.diaz@gmail.com> <Started> March 2013. <Copyright> See LICENSE-MIT OR LICENSE for licensing information. <P...
#A* ------------------------------------------------------------------- #B* This file contains source code for the PyMOL computer program #C* Copyright (c) Schrodinger, LLC. #D* ------------------------------------------------------------------- #E* It is unlawful to modify or remove this copyright notice. #F* --------...
# The MIT License (MIT) # # Copyright (c) 2016 deeredman1991 # # 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, m...
import paramiko from getpass import getpass import time class SSHConn: def __init__(self, host, username, password): self.host = host self.username = username self.password = password def open(self): remote_conn_pre = paramiko.SSHClient() remote_conn_pre.set_missing_ho...
""" A standard multi-qubit gate set module. Variables for working with the 2-qubit model containing the gates I*I, I*X(pi/2), I*Y(pi/2), X(pi/2)*I, Y(pi/2)*I, and X(pi/2)*X(pi/2) """ #*************************************************************************************************** # Copyright 2015, 2019 National Tec...
import re from setuptools import setup, find_packages import sys if sys.version_info.major != 3: print('This Python is only compatible with Python 3, but you are running ' 'Python {}. The installation will likely fail.'.format(sys.version_info.major)) extras = { 'test': [ 'filelock', ...
# -*- coding: utf-8 -*- # Copyright 2019 Cohesity Inc. class CloudParameters(object): """Implementation of the 'CloudParameters' model. Specifies Cloud parameters that are applicable to all Protection Sources in a Protection Job in certain scenarios. Attributes: failover_to_cloud (bool): Sp...
#Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length. #Do not allocate extra space for another array, you must do this in place with constant memory. class Solution(object): def removeDuplicates(self, nums): """ :type nums: List[int] :rtype: int ...
import time import logging from mwklient.errors import MaximumRetriesExceeded LOG = logging.getLogger(__name__) class Sleepers(): """ A class that allows for the creation of multiple `Sleeper` objects with shared arguments. Examples: Firstly a `Sleepers` object containing the shared attr...
# 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. # -----------------------------------------------------...
# -*- coding: utf-8 -*- # # SelfTest/Hash/common.py: Common code for Crypto.SelfTest.Hash # # Written in 2008 by Dwayne C. Litzenberger <dlitz@dlitz.net> # # =================================================================== # The contents of this file are dedicated to the public domain. To # the extent that dedicat...
# coding: utf-8 # Copyright (c) Pymatgen Development Team. # Distributed under the terms of the MIT License. from __future__ import division, unicode_literals import warnings import ruamel.yaml as yaml import os """ This module provides classes to perform topological analyses of structures. """ __author__ = "Shyue ...
""" Testing simple packet class creation and usage """ #pylint: disable=C0326,W0621 from __future__ import unicode_literals import copy import six import pytest #pylint: disable=unused-import from tests.values.simple import good_values, set_values #pylint: disable=unused-import from packeteer import packets, fields ##...
from panda3d.core import Point3, VBase3, Vec4 objectStruct = { 'Objects': { '1153420207.826859a20': { 'Type': 'Building Interior', 'Name': '', 'Instanced': False, 'Objects': { '1165346291.34kmuller': { 'Type': 'Furniture', ...
import ctypes import weakref import operator import threading from claripy.ast import Base import logging l = logging.getLogger('claripy.backend') class Backend: """ Backends are Claripy's workhorses. Claripy exposes ASTs (claripy.ast.Base objects) to the world, but when actual computation has to be done,...
# coding: utf-8 """ Kubernetes No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 OpenAPI spec version: v1.14.7 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import import unittest import kube...
import setuptools with open("README.md", "r") as fh: long_description = fh.read() setuptools.setup( name="pyleapo", version="1.0.3", author="Zana Aziz", author_email="mail@zanaaziz.com", description="A Python API for accessing your Leap Card balance, overview, and travel credit history.", long_description=long...
# -*- coding: utf-8 -*- from .datasets import * # noqa from . import datasets from .macadam_limits import is_within_macadam_limits from .mesh import is_within_mesh_volume from .pointer_gamut import is_within_pointer_gamut from .spectrum import ( generate_pulse_waves, XYZ_outer_surface, solid_RoschMacAdam,...
from __future__ import division from __future__ import print_function from __future__ import absolute_import import os import importlib.machinery import importlib.util import gpflow from dotmap import DotMap from dmbrl.modeling.models import NN, BNN, TFGP def create_config(env_name, ctrl_type, ctrl_args, overrides...
import textwrap import more_itertools import pytest from blackdoc import blacken from blackdoc.formats import ipython from .data import ipython as data @pytest.mark.parametrize( "lines,expected", ( pytest.param(data.lines[0], None, id="no_line"), pytest.param( data.lines[9], ((1...
# -*- coding: utf-8 -*- from decimal import Decimal, InvalidOperation from django import template from django.utils import formats from django.utils.encoding import force_text from django.utils.safestring import mark_safe # from django.utils.http import urlquote from django.conf import settings # import logging from...
import logging import logging.config import sys from click.testing import CliRunner from narq.cli import cli from narq.worker import WorkerSettings async def foobar(ctx): return 42 def worker_pre_init(): log_level = "DEBUG" logging.config.dictConfig( { 'version': 1, 'dis...
# Auto-generated at 2021-09-27T17:01:26.617526+08:00 # from: Justice Lobby Service (1.33.0) # Copyright (c) 2018 - 2021 AccelByte Inc. All Rights Reserved. # This is licensed software from AccelByte Inc, for limitations # and restrictions contact your company contract manager. # pylint: disable=duplicate-code # pylin...
from part1 import ( gamma_board, gamma_busy_fields, gamma_delete, gamma_free_fields, gamma_golden_move, gamma_golden_possible, gamma_move, gamma_new, ) """ scenario: test_random_actions uuid: 717339084 """ """ random actions, total chaos """ board = gamma_new(4, 3, 2, 6) assert board is...
from __future__ import unicode_literals, division, absolute_import from builtins import * # noqa pylint: disable=unused-import, redefined-builtin import logging import re from flexget import plugin from flexget.event import event from flexget.plugins.internal.urlrewriting import UrlRewritingError from flexget.utils....
import os import platform from importlib import import_module __version__ = '0.0.1' class color: '''Related colors.''' HEADER = '\033[95m' OKBLUE = '\033[94m' OKCYAN = '\033[96m' OKGREEN = '\033[92m' WARNING = '\033[93m' FAIL = '\033[91m' ENDC = '\033[0m' BOLD = '\033[1m' UNDE...
# -*- coding: utf-8 -*- # This file as well as the whole tsfresh package are licenced under the MIT licence (see the LICENCE.txt) # Maximilian Christ (maximilianchrist.com), Blue Yonder Gmbh, 2016 from random import shuffle from unittest import TestCase import warnings from tsfresh.feature_extraction.feature_calculat...
# Copyright 2014 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...
from wp.command import WPCommand class DBQuery(WPCommand): command = ['db', 'query'] # SQL. sql = '' # Required # Skips outputting column names. skip_column_names = bool def __init__(self, sql, **args): super().__init__(**args) self.sql = sql self.skip_column_names...
import time from typing import Dict, Callable import os import random import pprint import numpy as np import pandas as pd from joblib import Parallel, delayed from matplotlib.figure import Figure from pandas.core.generic import NDFrame import tensorflow as tf def disable_tensorflowgpu(): os.environ['CUDA_VISIBL...
import Anreal class RendererBuildDesc(Anreal.BuildDesc) : def SetDependency(self) : self.DependencyList.append("Core") self.DependencyList.append("RHI") def SetOther(self) : self.ModuleName = "Renderer" def GetBuildDesc() : return RendererBuildDesc()
import logging from contextlib import contextmanager from collections import defaultdict from peewee import fn from data import database from data import model from data.cache import cache_key from data.model import oci, DataModelException from data.model.oci.retriever import RepositoryContentRetriever from data.data...
import unittest from headliner.preprocessing.keras_tokenizer import KerasTokenizer from headliner.preprocessing.vectorizer import Vectorizer class TestVectorizer(unittest.TestCase): def test_vectorize(self): data = [('a b c', 'd')] tokenizer_encoder = KerasTokenizer() tokenizer_decoder =...
import mysql.connector db = mysql.connector.connect(host="127.0.0.1", user="root", passwd="root", db="books")
'''Trains LSGAN on MNIST using Keras LSGAN is similar to DCGAN except for the MSE loss used by the Discriminator and Adversarial networks. [1] Radford, Alec, Luke Metz, and Soumith Chintala. "Unsupervised representation learning with deep convolutional generative adversarial networks." arXiv preprint arXiv:1511.06...
# encoding=utf-8 # Author: Yu-Lun Chiang # Description: Test evaluate function import logging from KeyExtractor.utils import struct as st logger = logging.getLogger(__name__) def test__evaluate_calculate_score(testcase3, extractor): tokenized_text = testcase3["tokenized_text"] _, n_gram_text = extractor._pr...
#/bin/python import SocketServer import socket SERVER_ADDRESS = ("0.0.0.0", 8888) class EchoHandler(SocketServer.BaseRequestHandler): def handle(self): print "Received a connection from: ", self.client_address data = "start" while len(data): data = self.request.recv(1024) self.request.s...
import torch from layers import Conv2d, Linear class ConvModel(torch.nn.Module): def __init__(self, in_channels: int, out_channels: int, dropout: bool = True): super().__init__() self.features = torch.nn.Sequential( Conv2d(in_channels, 32, 3, padding=1), torch.nn.ReLU(), ...
# Copyright European Organization for Nuclear Research (CERN) # # 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 # # Authors: # - Vincent Garonne, <v...
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ .. _utils-fits: Gammapy FITS utilities ====================== .. _utils-fits-tables: FITS tables ----------- In Gammapy we use the nice `astropy.table.Table` class a lot to represent all kinds of data (e.g. event lists, spectral points, light curve...