text
stringlengths
1
927k
from django.conf.urls import include, url # Uncomment the next two lines to enable the admin: # from django.contrib import admin # admin.autodiscover() urlpatterns = [ # Examples: # url(r'^$', 'django_outbox.views.home', name='home'), # url(r'^django_outbox/', include('django_outbox.foo.urls')), # U...
""" Route transformations """ from enum import Enum, auto from functools import partial from random import randint from typing import Callable from .types import (Point, Route, add_points, subtract_points) from .validation import (all_points_consecutive, ...
#----------------------------------------------------------------------------- # Copyright (c) 2012 - 2021, Anaconda, Inc., and Bokeh Contributors. # All rights reserved. # # The full license is in the file LICENSE.txt, distributed with this software. #-------------------------------------------------------------------...
# Copyright (c) 2019 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...
# Copyright 2018 The Cirq Developers # # 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 agreed to in ...
from xml.dom import minidom import urllib.request def readWpData(url: str ="") -> dict: response = urllib.request.urlopen( 'https://forwardcreating.com/wp-content/themes/forwardcreating_v3/ta_added_links.xml' ) results = response.read() # print(results) xmldoc = minidom.parseString(resu...
_base_ = "./ss_v1_dibr_mlBCE_FreezeBN_woCenter_woDepth_refinePM10_ape.py" OUTPUT_DIR = "output/self6dpp/ssLM/ss_v1_dibr_mlBCE_FreezeBN_woCenter_woDepth_refinePM10/duck" DATASETS = dict( TRAIN=("lm_real_duck_train",), TRAIN2=("lm_pbr_duck_train",), TRAIN2_RATIO=0.0, TEST=("lm_real_duck_test",) ) MODEL = dict( WE...
# -*- coding: utf-8 -*- r""" Quasisymmetric functions REFERENCES: .. [Ges] \I. Gessel, *Multipartite P-partitions and inner products of skew Schur functions*, Contemp. Math. **34** (1984), 289-301. http://people.brandeis.edu/~gessel/homepage/papers/multipartite.pdf .. [MR] \C. Malvenuto and C. Reutenauer, *Dua...
from __future__ import with_statement import thread from django.conf import settings from django.contrib.auth.models import User from django.db import connection from django.http import HttpResponse from django.test import TestCase, RequestFactory from django.template import Template, Context from django.utils import ...
#!/usr/bin/env python3 import argparse import json import os import subprocess from pathlib import Path from typing import Union from urllib.parse import quote import call_wrapper PathLike = Union[str, Path] def close(repo_dir: PathLike): if not repo_dir: repo_dir = Path(os.getcwd()).absolute() ...
from setuptools import setup, find_packages import os def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() setup( name='jsonwriter', version='0.1.4', description='Easy JSON Writer', long_description=read('README.md'), long_description_content_type='text/markdown'...
# Copyright (c) 2015-2018 Cisco Systems, Inc. # # 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, modify, merge...
import functools import sqlite3 try: from contextlib import nullcontext except ImportError: from contextlib import suppress as nullcontext import pytest from RPA.Database import Database from . import RESOURCES_DIR, RESULTS_DIR, temp_filename DB_PATH = str(RESULTS_DIR / "database.db") RETURNING_REASON = "O...
import os import sys import time import glob import numpy as np import torch import utils import logging import argparse import torch.nn as nn import torch.utils import torch.nn.functional as F import torchvision.datasets as dset import torch.backends.cudnn as cudnn from torch.autograd import Variable from model_searc...
import os import copy import numpy as np import matplotlib import matplotlib.pyplot as plt from matplotlib.lines import Line2D from matplotlib.colors import LinearSegmentedColormap, Normalize from matplotlib.cm import ScalarMappable import matplotlib.transforms as mtransforms from matplotlib.widgets import Button, Slid...
"""CoinPaprika view""" __docformat__ = "numpy" import logging import os from pandas.plotting import register_matplotlib_converters import openbb_terminal.cryptocurrency.overview.coinpaprika_model as paprika from openbb_terminal.cryptocurrency.dataframe_helpers import ( lambda_long_number_format_with_type_check, ...
from typing import Union from .._tier0 import plugin_function from .._tier0 import Image from .._tier0 import push from ._AffineTransform3D import AffineTransform3D from skimage.transform import AffineTransform import numpy as np @plugin_function def affine_transform(source : Image, destination : Image = None, transf...
# -*- coding: utf-8 -*- # Copyright 2017-2019 ControlScan, Inc. # # This file is part of Cyphon Engine. # # Cyphon Engine is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, version 3 of the License. # # Cyphon En...
# Copyright 2019 kubeflow.org. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...
# Copyright (c) 2020, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause from ._op_reqs import register_op from coremltools.converters.mil.mil import get_new_symbol, get_new_...
from datetime import datetime import os.path import tempfile from jinja2 import Environment, FileSystemLoader, select_autoescape TEMPLATE_PATH = os.path.join( os.path.dirname(os.path.abspath(__file__)), 'templates' ) IMAGE_PATH = os.path.join( TEMPLATE_PATH, 'images' ) DEFAULT_TEMPLATE_NAME = 'labe...
#! /usr/bin/env python # <<BEGIN-copyright>> # Copyright 2019, Lawrence Livermore National Security, LLC. # See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: MIT # <<END-copyright>> """ Some simple stuff that is not repeatable as pointers are printed. """ from __future__ import print_functi...
_base_ = [ '../_base_/models/fcnsp_r50sp.py', '../_base_/datasets/hyper_c3.py', '../_base_/default_runtime.py', '../_base_/schedules/schedule_4k.py' ] norm_cfg = dict(type='BN', track_running_stats=True, requires_grad=True) model = dict( backbone=dict(norm_cfg=norm_cfg), decode_head=dict(num_classes=2,...
################################################################################ # Copyright (c) 2020-2021, Berkeley Design Technology, Inc. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to ...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Partially based on AboutMethods in the Ruby Koans # from runner.koan import * def my_global_function(a,b): return a + b class AboutMethods(Koan): def test_calling_a_global_function(self): self.assertEqual(5, my_global_function(2,3)) # NOTE: Wron...
import re from http_request_randomizer.requests.errors.ParserExceptions import ParserException __author__ = 'pgaref' class UrlParser(object): """ An abstract class representing any URL containing Proxy information To add an extra Proxy URL just implement this class and provide a 'url specific' p...
class Solution: def replaceElements(self, a: List[int]) -> List[int]: m = -1 for i in range(len(a) - 1, -1, -1): a[i], m = m, max(m, a[i]) return a
import json import domoticz import configuration import blacklist class Device(): def __init__(self, alias, value_key, device_name_suffix = ''): self.alias = alias self.value_key = value_key self.device_name_suffix = device_name_suffix self.check_values_on_update = True def _ge...
from ursina import * import sys sys.path.append('../Parkour/') from block import * normalSpeed = 2 boostSpeed = 5 normalJump = 0.3 # Level02 class Level02(Entity): def __init__(self): super().__init__() self.is_enabled = False self.mountain = Entity(model = "mountain_level_2.obj", textu...
# -* encoding: utf-8 *- # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. from aptly_api.parts.misc import MiscAPISection from aptly_api.parts.packages import PackageAPIS...
# 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, software # d...
class RandomAgent(object): """The world's simplest agent!""" def __init__(self, action_space): self.action_space = action_space def act(self, observation, reward, done): return self.action_space.sample()
# 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 __a...
#!/usr/bin/python3 -u # SPDX-License-Identifier: BSD-2 import itertools import unittest from tpm2_pytss import * from base64 import b64decode rsa_parent_key = b"""-----BEGIN RSA PRIVATE KEY----- MIIEpAIBAAKCAQEA0FeMzAfnskx8eZYICdqURfwRhcgAWHkanaDZQXAMsKyBwkov yso31lhQQpjghFv1hzxy9z9yvcE+7LnFWbTnhWH2PPYyR87iM6eaW9wGda...
from otp.otpbase import OTPGlobals from otp.otpbase import OTPLauncherGlobals from otp.otpbase import OTPLocalizer from direct.gui.DirectGui import * from pandac.PandaModules import * import os class LeaveToPayDialog: def __init__(self, paidUser, destructorHook = None, doneFunc = None): self.destructorHoo...
from __future__ import unicode_literals from django.views import generic from django.views.generic.list import ListView from django.views.generic.detail import DetailView from django.shortcuts import get_object_or_404, redirect from django.contrib import messages from django.contrib.auth.mixins import LoginRequiredMixi...
from setuptools import find_packages, setup setup( name='src', packages=find_packages(), version='0.1.0', description='downlads_free_springer_books', author='anosillus', license='MIT', )
#!/usr/bin/env python """Django's command-line utility for administrative tasks.""" import os import sys def main(): os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'fancy_glitter_29730.settings') try: from django.core.management import execute_from_command_line except ImportError as exc: ...
from dataclasses import dataclass, field from typing import List, Dict from ..component import * from _anvil_designer.common_structures import * @dataclass class Icon(): pass @dataclass class LatLng(): def lat(self): """Returns the latitude in degrees. """ pass def lng(self): ...
# Generated by Django 2.2 on 2021-05-18 12:38 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('core', '0003_ingredient'), ] operations = [ migrations.CreateModel( ...
from typing import Iterable, Callable import torch from torch.optim import Optimizer def compute_sam(group: dict, closure: Callable): grads = [] params_with_grads = [] rho = group['rho'] # update internal_optim's learning rate for p in group['params']: if p.grad is not None: ...
#!/usr/bin/env python """Convert a MinION fast5 to a npRead for cPecan Format: line 1 [2D read length] [# of template events] [# of complement events] [template scale] [template shift] [template var] [template scale_sd] [template var_sd] [complement scale] [complement shift] [complement var] [complement ...
#!/usr/bin/env python from setuptools import setup extras = { 'aws': ['boto3'], 'mqtt': ['paho-mqtt'], 'redis': ['redis'], 'chrome': ['pyppeteer'], } extras['all'] = [package for packages in extras.values() for package in packages] setup( name='skyscraper', version='0.1.1', ...
import typing import apache_beam as beam class Coders: TABLE = { 'bytes': 'Bytes', 'utf8': 'UTF-8', 'utf_8': 'UTF-8', } CODERS = { 'Bytes': beam.coders.coders.BytesCoder, 'UTF-8': beam.coders.coders.StrUtf8Coder, } @classmethod def get_coder(cls, code...
#!/usr/bin/python import sys import xml.etree.ElementTree as ET threshold = 0.0001 print("testing with", threshold, "margin..\n" ) def tree_to_list(tree): x = [] return parse_tree_to_list(tree, x) def parse_tree_to_list(tree, x): x.append(tree.tag) elem = tree.attrib for a,b in elem.items() : ...
# Copyright 2018 The TensorFlow 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 applica...
# # 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...
# -*- coding: utf-8 -*- import csv import datetime import scrapy from locations.items import GeojsonPointItem from locations.hours import OpeningHours DAYS = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"] class MarshallsSpider(scrapy.Spider): name = "marshalls" allowed_domains = ["tjx.com"] chains ...
from abc import abstractmethod from typing import List, Dict from cloudrail.knowledge.context.mergeable import Mergeable from cloudrail.knowledge.context.aws.ec2.network_interface import NetworkInterface from cloudrail.knowledge.context.aws.prefix_lists import PrefixLists, PrefixList from cloudrail.knowledge.context.aw...
# Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # Copyright 2011 Justin Santa Barbara # Copyright (c) 2012 NTT DOCOMO, INC. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not...
import theano import numpy as np import os from theano import tensor as T from collections import OrderedDict # nb might be theano.config.floatX dtype = T.config.floatX # @UndefinedVariable class Elman(object): def __init__(self, ne, de, na, nh, n_out, cs, npos, update_embeddings=True): ...
"""Support for Overkiz Vertical Covers.""" from __future__ import annotations from typing import Any, cast from pyoverkiz.enums import ( OverkizCommand, OverkizCommandParam, OverkizState, UIClass, UIWidget, ) from homeassistant.components.cover import ( ATTR_POSITION, CoverDeviceClass, ...
# -*- coding: utf-8 -*- """ Module :mod:`runner` defines the entry point of xrt - :func:`run_ray_tracing`, containers for job properties and functions for running the processes or threads and accumulating the resulting histograms. """ __author__ = "Konstantin Klementiev, Roman Chernikov" __date__ = "26 Mar 2016" impor...
# -*- coding: utf-8 -*- # Copyright (c) 2018, VHRS and Contributors # See license.txt from __future__ import unicode_literals import frappe import unittest class TestVerifyEmploymentCheck2(unittest.TestCase): pass
import imageio import matplotlib.pyplot as plt import Image import numpy as np im = Image.new("RGB", (65,65), "white") pic = np.array(im) im=pic imageio.imsave("white.png", im)
# TODO arithmetic ['Rank'] + headers # Using Lambda: Lambda definition does not include a “return” statement, # it always contains an expression that is returned. We can also put a lambda definition anywhere # a function is expected, and we don’t have to assign it to a variable at all. This is the # simplicity of lam...
# Copyright (c) Vera Galstyan Jan 2018 numbers = list(range(1,10)) for number in numbers: if number == 1: print("1st") elif number == 2: print("2nd") elif number == 3: print("3rd") else: print(str(number) + "th")
#!/usr/bin/env python # # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # # Michael A.G. Aivazis # California Institute of Technology # (C) 1998-2005 All Rights Reserved # # {LicenseText} # # ~~~~~~~~~~~~~~~~~~~~~~~~...
#!/usr/bin/env python3 # Copyright (c) 2016 Mastersoft # Using examples from the Cozmo SDK by Anki, 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 in the file LICENSE.txt or at # # ht...
import asyncio import websockets import json from websockets.exceptions import ConnectionClosedError from . import communicator async def websocket_server(websocket, path): try: async for message in websocket: communicator.message_queue.put(json.loads(message)) except ConnectionClosedError...
#################### # # Copyright (c) 2018 Fox-IT # # 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, modify, merge...
DB_URI = 'sqlite:///.sqlite3'
"""test /COG endpoints.""" import os from io import BytesIO from unittest.mock import patch import numpy import pytest from ..conftest import DATA_DIR, mock_rasterio_open, parse_img @patch("rio_tiler.io.cogeo.rasterio") def test_bounds(rio, app): """test /bounds endpoint.""" rio.open = mock_rasterio_open ...
#%% """ bmshj2018 """ import argparse import glob import sys from absl import app from absl.flags import argparse_flags import numpy as np import tensorflow.compat.v1 as tf import tensorflow_compression as tfc from dynamic import * SCALES_MIN = 0.11 SCALES_MAX = 256 SCALES_LEVELS = 64 def read_png(filename): ...
from django import template register = template.Library() @register.inclusion_tag('news/tags/message.html') def show_message_from_level_important(messages): """Shows messages after submitting form.""" context = {'messages': messages} return context
import logging import re import subprocess import urllib.request from collections import OrderedDict from io import BytesIO from zipfile import ZipFile import os import pandas from django.core.management import call_command from django.db import models from django.http import HttpResponse from django.http import JsonRe...
# flake8: noqa from __future__ import absolute_import, unicode_literals import warnings warnings.warn( 'The contactform content has been deprecated. Use form-designer instead.', DeprecationWarning, stacklevel=2)
from base64 import b64decode from io import BytesIO import PIL.Image import PIL.ExifTags def get_image_b64(img_b64): image = PIL.Image.open(BytesIO(b64decode(img_b64))) # rotate image according to exif try: for orientation in PIL.ExifTags.TAGS.keys(): if PIL.ExifTags.TAGS[orientation]=='Orientation...
from django.db import models from django.contrib.auth.models import User from django.db.models.signals import post_save from django.dispatch import receiver from rest_framework.authtoken.models import Token import uuid class Room(models.Model): title = models.CharField(max_length=50, default="DEFAULT TITLE") d...
class Solution: def findOcurrences(self, text: str, first: str, second: str) -> List[str]: val = text.split(" ") ans = [] for i in range(len(val) - 2): if val[i] == first and val[i+1] == second: ans.append(val[i+2]) return ans
import re from channels.db import database_sync_to_async from datetime import timedelta from django.conf import settings from django.core.mail import send_mail from django.template.loader import render_to_string from django.utils.html import strip_tags from urllib import parse from boards.channels import actions from...
#!/usr/bin/python3 import os import glob import subprocess import yaml with open('configure.yaml') as file: obj = yaml.safe_load(file) metric = ('seqlev', ) distance = (2, ) base_dir = os.getcwd() input_dir = os.path.join(base_dir, "results", "13_TagReadWithGeneExon") output_dir = os.path.join(base_dir, "result...
from datetime import datetime from logging import exception from time import sleep from requests import post, delete, get from backup.models import Snapshot from dbaas_credentials.models import CredentialType from workflow.steps.util.base import HostProviderClient from util import get_credentials_for from physical.mod...
#!/bin/bash/python3 import base64 from bson import ObjectId import csv import getpass import json import os import readline import requests import subprocess from typing import Any, Callable, List import sys # Constants VALID_STATUSES = { '1': 'Applied', '2': 'Accepted', '3': 'Waitlisted', '4': 'Declin...
from setuptools import setup project_name = 'requests-ntlm2' # PyPi supports only reStructuredText, so pandoc should be installed # before uploading package try: import pypandoc long_description = pypandoc.convert('README.md', 'rst') except ImportError: long_description = '' requires = [ "requests ==...
from __future__ import print_function, absolute_import, unicode_literals from hashlib import sha256 import six from zope.interface import implementer from attr import attrs, attrib from attr.validators import provides, instance_of from spake2 import SPAKE2_Symmetric from hkdf import Hkdf from nacl.secret import SecretB...
""" In order to create a package for pypi, you need to follow several steps. 1. Create a .pypirc in your home directory. It should look like this: ``` [distutils] index-servers = pypi pypitest [pypi] username=allennlp password= Get the password from LastPass. [pypitest] repository=https://test.pypi.org/legacy/ ...
# Copyright 2014 Tesora, 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 ...
#!/usr/bin/env python # encoding: utf-8 from sqlalchemy import Column, Integer, ForeignKey, Boolean from sqlalchemy.orm import relationship, backref from ..api.database import Base class ColorGame(Base): '''Represents a color game that is stored in the database. A game is linked to a pattern that is the corr...
# -*- coding: utf-8 -*- __name__ = 'covid' __author__ = '7Stalks Consulting LLC' __version_info__ = (1, 1, 0) __version__ = '.'.join(map(str, __version_info__)) __date__ = '04/02/2020 4:30 PM' __credits__ = ['Steven Klass'] __license__ = 'See the file LICENSE.txt for licensing information.'
def area(larg, comp): area = larg * comp print(f'A área de um terreno {larg:.2f}x{comp:.2f} é de {area} m^2') print('Controle de Terrenos') print('-' * 20) larg = float(input('LARGURA (m): ')) comp = float(input('COMPRIMENTO (m): ')) area(larg, comp)
# protoc plugin to map from FileDescriptorProtos to Envoy doc style RST. # See https://github.com/google/protobuf/blob/master/src/google/protobuf/descriptor.proto # for the underlying protos mentioned in this file. See # https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html for Sphinx RST syntax. fro...
""" This module is an example of a barebones numpy reader plugin for napari. It implements the ``napari_get_reader`` hook specification, (to create a reader plugin) but your plugin may choose to implement any of the hook specifications offered by napari. see: https://napari.org/docs/dev/plugins/hook_specifications.htm...
# GOAL OF THIS SOFTWARE: print Bundle name & image URL info in Terminal, then download each image item into a png ## please install PYTHON3, CHROMEDRIVER, SELENIUM, then proceed ### then enter in Terminal ```pip install -r setup.py``` #### NOW, you can run this script in Terminal with ```python3 scrape_bundles.py``` ##...
import tensorflow as tf from tensorflow_probability import distributions as tfd from functools import partial from .AbstractGaussianSimple import AbstractGaussianSimple import types import sonnet as snt class MultivariateNormalTriL(AbstractGaussianSimple): def __init__(self, output_size, ...
from django.http import HttpResponse from django.template import loader from django.views.decorators.csrf import csrf_exempt from geopy.geocoders import Nominatim import requests import json # disabling csrf (cross site request forgery) def mars(request): template = loader.get_template('weather/mars.html') ...
import botocore import GetConnection bucket_names = ["testb1", "testb2", "testb3"] if __name__ == '__main__': s3 = GetConnection.getConnection() # create bucket for bucket in bucket_names: # response: class dict # ResponseMetadata: class dict # RequestId ...
from __future__ import unicode_literals from dvc.exceptions import DvcException class DependencyDoesNotExistError(DvcException): def __init__(self, path): msg = "dependency '{}' does not exist".format(path) super(DependencyDoesNotExistError, self).__init__(msg) class DependencyIsNotFileOrDirErr...
# -*- coding: utf-8 -*- #%% name = 'python' for character in name: print(character) #%% name = 'python' index = 0 for character in name: print(index, character) index = index + 1 #%% for index in range(len(name)): print('Nr indeksu: ', index, ' Litera: ', name[index]) #%% for i in enumer...
import unittest class TestIssue135(unittest.TestCase): def test_issue135(self): print "something" raise KeyError("fake")
# coding: utf-8 import pprint import re import six from huaweicloudsdkcore.sdk_response import SdkResponse class ListEncryptTaskResponse(SdkResponse): """ Attributes: openapi_types (dict): The key is attribute name and the value is attribute type. attribute_map (d...
# Copyright (c) OpenMMLab. All rights reserved. from itertools import chain # from torch.nn.parallel import DataParallel from paddle import DataParallel from .scatter_gather import scatter_kwargs class MMDataParallel(DataParallel): """The DataParallel module that supports DataContainer. MMDataParallel has ...
# # Test our constraints parser # import unittest from juju import constraints class TestConstraints(unittest.TestCase): def test_mem_regex(self): m = constraints.MEM self.assertTrue(m.match("10G")) self.assertTrue(m.match("1G")) self.assertFalse(m.match("1Gb")) self.ass...
from django.contrib import admin from core.models import EventPageContent from .models import Sponsor, Donor class SponsorInline(admin.TabularInline): model = EventPageContent.sponsors.through extra = 1 verbose_name_plural = 'Sponsors' class SponsorAdmin(admin.ModelAdmin): list_display = ('id', 'na...
""" Dependenpy package. Show the inter-dependencies between modules of Python packages. With dependenpy you will be able to analyze the internal dependencies in your Python code, i.e. which module needs which other module. You will then be able to build a dependency matrix and use it for other purposes. If you read ...
""" cfg_loader.fields ~~~~~~~~~~~~~~~~~ Implement marshmallow fields to validate against specific input data :copyright: Copyright 2017 by ConsenSys France. :license: BSD, see :ref:`license` for more details. """ import os from marshmallow import validate, fields class PathValidator(validate.V...
# coding: utf8 from copy import copy import numpy as np import pandas as pd from os import path def neighbour_session(session, session_list, neighbour): if session not in session_list: temp_list = session_list + [session] temp_list.sort() else: temp_list = copy(session_list) t...
from django.core.mail import EmailMessage class Util: @staticmethod def send_email(data): email = EmailMessage( subject=data["email_subject"], body=data["email_body"], to=[data["to_email"]]) email.send()
version https://git-lfs.github.com/spec/v1 oid sha256:fd76abc8270fd3b6b9a8cfe3903a42e83db16aaddf5a96aebcc22bfe97555565 size 2382
import unittest from app.models import Source, Article class SourceArticleTest(unittest.TestCase): ''' Test Class to test the behaviour of the Source class ''' def setUp(self): ''' Set up method that will run before every Test ''' self.new_source = Source('abc-news',...