code
stringlengths
1
199k
from hanlp.metrics.parsing import conllx_eval from hanlp.datasets.parsing.ptb import PTB_SD330_DEV, PTB_SD330_TRAIN, PTB_SD330_TEST, PTB_TOKEN_MAPPING from hanlp.components.parsers.biaffine_parser_tf import BiaffineTransformerDependencyParserTF, \ StructuralAttentionDependencyParserTF from hanlp.pretrained.glove im...
"""Logic to update a TensorFlow model graph with quantization operations.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import re from tensorflow.contrib import graph_editor from tensorflow.contrib.quantize.python import graph_matcher from tensorflow.con...
import mock from oslo_config import cfg from oslo_messaging.rpc import dispatcher import six from heat.common import exception from heat.common import identifier from heat.engine.clients.os import keystone from heat.engine import dependencies from heat.engine import resource as res from heat.engine import service from ...
from distutils.core import setup setup( name='megad-mqtt-gw', version='0.3', description='Gateway between MQTT queue and MegaD devices (http://ab-log.ru)', author='rs', author_email='repalov@gmail.com', url='https://github.com/repalov/megad-mqtt-gw', license='Apache License', classifiers...
import os import sys import logging import webbrowser import socket import time import json import traceback import cv2 import tornado.ioloop import tornado.web import tornado.websocket from tornado.concurrent import run_on_executor from concurrent.futures import ThreadPoolExecutor # `pip install futures` for python2...
from charms.reactive import Endpoint, when class TestAltProvides(Endpoint): invocations = [] @when('endpoint.{endpoint_name}.joined') def handle_joined(self): self.invocations.append('joined: {}'.format(self.endpoint_name)) @when('endpoint.{endpoint_name}.changed') def handle_changed(self): ...
from djangomako.shortcuts import render_to_response from django.shortcuts import redirect from django.http import HttpResponse, Http404 from models import UserLocation import settings import os import time import string from urlparse import urlparse def tutorials_last_url(tutorial_view): def save_user_location(requ...
import web urls = ( '/(.*)', 'router' ) app = web.application(urls, globals()) class router: def GET(self, path): if path == '': path = 'index.html' f = open('_build/html/'+path) return f.read() if __name__ == "__main__": app = web.application(urls, globals()) app.run...
"""@package src.ec2.helpers.query @copyright Copyright (c) 2012 Institute of Nuclear Physics PAS <http://www.ifj.edu.pl/> @author Oleksandr Gituliar <gituliar@gmail.com> """ from datetime import datetime import urllib from ec2.base.auth import _sign_parameters_ver2 def query(parameters, aws_key=None, aws_secret=None, e...
__author__ = 'tom' from django.contrib import admin from core.models import Post, Project admin.site.register(Post) admin.site.register(Project)
from .base import * class OpStash(object): cache = {} @classmethod def Add(cls, object): t = object.type cls.cache[t] = object @classmethod def Lookup(cls, type): return cls.cache[type] @classmethod def Define(cls, pt): cls.Add(pt) return pt class OpRe...
from django import template from django.utils.safestring import mark_safe from django.template.base import Node register = template.Library() from tag_parser import template_tag from tag_parser.basetags import BaseNode @template_tag(register, 'asset') class JsCssAssetNode(BaseNode): """ Implement asset filter ...
import tensorflow as tf import edward as ed import numpy as np from numpy import array from numpy.linalg import norm from edward.models import Dirichlet, Multinomial, Gamma, Poisson sess = tf.Session() def build_toy_dataset(n, p, A, b): """ toy HMM with: n=number of timesteps, p=m length array w...
import json import numpy as np import sys CUSTOM_PRECISION = 1000 BENCH_DOUBLE_PRECISION = 100 CUSTOM_PRECISION_CLASSES = [ "solomon", "homberger", "li_lim", "VFMP_V", "HFVRP", "cordeau", ] def uses_custom_precision(bench): custom = False for current_class in CUSTOM_PRECISION_CLASSES: ...
""" Small wrapper around the python ConfigParser module. """ import ConfigParser CONFIG = ConfigParser.ConfigParser() DEFAULTS = { 'patterns': { 'path' : '(?P<artist>\w+) - (?P<year>\d+) - (?P<album>\w+)' } } def get_param(section, name): try: param = CONFIG.get(section, name) ...
from morphforge.simulation.neuron.core.neuronsimulationenvironment import NEURONEnvironment from morphforgecontrib.simulation.channels.neuroml_via_neurounits.neuroml_via_neurounits_core import NeuroML_Via_NeuroUnits_Channel from neurounits.importers.neuroml import ChannelMLReader from morphforgecontrib.simulation.chann...
''' Created by auto_sdk on 2015.04.21 ''' from aliyun.api.base import RestApi class Ecs20140526DeleteSnapshotRequest(RestApi): def __init__(self,domain='ecs.aliyuncs.com',port=80): RestApi.__init__(self,domain, port) self.SnapshotId = None def getapiname(self): return 'ecs.aliyuncs.com.DeleteSnapshot.2014-05-26...
import bee from bee import * import dragonfly from dragonfly.commandhive import commandhive, commandapp from dragonfly.sys import exitactuator from dragonfly.io import display, commandsensor from dragonfly.std import variable, transistor, test from dragonfly.sys import on_next_tick from components.workers.chessprocesso...
""" Normal-Gamma density.""" import numpy as np from scipy.special import gammaln, psi class NormalGamma(object): """Normal-Gamma density. Attributes ---------- mu : numpy.ndarray Mean of the Gaussian density. kappa : float Factor of the precision matrix. alpha : float Sh...
import sys from optparse import make_option from django.core.management.base import BaseCommand, CommandError from django.db import IntegrityError, transaction from django.contrib.auth.models import User from annotate.models import * class Command(BaseCommand): def add_arguments(self, parser): parser.add_ar...
from ..excel_comparison_test import ExcelComparisonTest from ...workbook import Workbook class TestCompareXLSXFiles(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.set_filename('textbox38.xlsx') def test_create_file(self): ...
"""professor => instructor Revision ID: 3fab9480c190 Revises: 31ded1f6ad6 Create Date: 2014-02-17 00:56:12.566690 """ revision = '3fab9480c190' down_revision = '31ded1f6ad6' from alembic import op import sqlalchemy as sa metadata = sa.MetaData() role = sa.Table('Role', metadata, sa.Column('id', sa.Integer()), s...
from __future__ import (absolute_import, division, print_function) import copy from ..util import import_ from ._base import _NativeCodeBase, _NativeSysBase, _compile_kwargs pyodeint = import_('pyodeint') class NativeOdeintCode(_NativeCodeBase): wrapper_name = '_odeint_wrapper' def __init__(self, *args, **kwarg...
from __future__ import absolute_import import shutil from tempfile import mkdtemp from datetime import datetime import pytest import os import glob import numpy as np from numpy.testing import assert_array_almost_equal, assert_allclose import sunpy.data.test from sunpy.spectra.sources.callisto import ( CallistoSpec...
from __future__ import print_function import argparse import os from falafel import findout_terminal_width from falafel import test_list from falafel.runners import FalafelTestRunner from falafel.loaders import FalafelTestLoader parser = argparse.ArgumentParser(description='custom test runner for ' ...
""" """ import logging import numpy as np from numpy import ma from cotede.qctests import QCCheckVar try: import pandas as pd PANDAS_AVAILABLE = True except ImportError: PANDAS_AVAILABLE = False module_logger = logging.getLogger(__name__) def gradient(x): return curvature(x) def _curvature_pandas(x): ...
import pyaf.Bench.TS_datasets as tsds import tests.artificial.process_artificial_dataset as art art.process_dataset(N = 1024 , FREQ = 'D', seed = 0, trendtype = "PolyTrend", cycle_length = 30, transform = "Quantization", sigma = 0.0, exog_count = 0, ar_order = 0);
from django.conf.urls import * from django.conf import settings from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', # django-flags for internationalization (r'^lang/', include('sampleproject.flags.urls')), # FOR DEBUG AND TEST ONLY (r'^.*switch/(?P<username>.*)/(?P<password>...
from django.test import TestCase from freezegun import freeze_time from unittest.mock import patch from testil import eq from corehq.util.soft_assert.core import SoftAssert from casexml.apps.case.exceptions import ReconciliationError from casexml.apps.case.xml.parser import CaseUpdateAction, KNOWN_PROPERTIES from coreh...
""" subplot - Manage modern mode figure subplot configuration and selection. """ import contextlib from pygmt.clib import Session from pygmt.exceptions import GMTInvalidInput from pygmt.helpers import ( build_arg_string, fmt_docstring, is_nonstr_iter, kwargs_to_strings, use_alias, ) @fmt_docstring @...
""" EVENNIA SERVER LAUNCHER SCRIPT This is the start point for running Evennia. Sets the appropriate environmental variables and launches the server and portal through the evennia_runner. Run without arguments to get a menu. Run the script with the -h flag to see usage information. """ from __future__ import print_func...
from traits.api import HasTraits, Int, Bool from kiva.trait_defs.api import KivaFont from enable.colors import ColorTrait class TextFieldStyle(HasTraits): """ This class holds style settings for rendering an EnableTextField. fixme: See docstring on EnableBoxStyle """ # The color of the text text...
import warnings from django.core.urlresolvers import ResolverMatch from django.core.urlresolvers import ( RegexURLPattern as DjangoRegexURLPattern, RegexURLResolver ) from django.core.exceptions import ImproperlyConfigured from django.utils import six from django.utils.deprecation import RemovedInDjango20Warnin...
import datetime from django.db import models from django.conf import settings class ServerVariable(models.Model): name = models.CharField(max_length=64, blank=True, null=True) value = models.TextField(blank=True, null=True) class Meta: app_label = 'website' @staticmethod def get(name): ...
"""The WaveBlocks Project Function for stem-plotting functions of the type f:IxI -> C with abs(f) as z-value and phase(f) as color code. This function makes a three dimensional stem plot. @author: R. Bourquin @copyright: Copyright (C) 2012, 2014, 2016 R. Bourquin @license: Modified BSD License """ from numpy import rea...
''' circle_urls.py will rename all url files to not have extension .html ''' import sys import os from glob import glob site_dir = os.path.abspath(sys.argv[1]) print("Using site directory %s" %(site_dir)) files = glob("%s/*.html" %(site_dir)) search_names = [os.path.basename(f).replace('.html','') for f in files] for h...
from django.contrib.auth.models import AbstractUser from django.db import models from django.utils.encoding import python_2_unicode_compatible from django.utils.translation import ugettext_lazy as _ @python_2_unicode_compatible class User(AbstractUser): # First Name and Last Name do not cover name patterns # ar...
from south.utils import datetime_utils as datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Changing field 'PayPalIPN.custom' db.alter_column(u'paypal_ipn', 'custom', self.gf('django.db.mode...
from django.conf.urls import * from . import views from . import z_queries from rockletonfortune import settings from django.contrib.auth.views import login, logout from django.contrib.auth.decorators import login_required from django.contrib.auth import views as auth_views from django.views.static import serve from dj...
""" Ops for masked arrays. """ from typing import ( Optional, Union, ) import numpy as np from pandas._libs import ( lib, missing as libmissing, ) def kleene_or( left: Union[bool, np.ndarray], right: Union[bool, np.ndarray], left_mask: Optional[np.ndarray], right_mask: Optional[np.ndarra...
u""" =============================== Shimehari.core.manage.commands.create ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ アプリケーションを新たに作成する create コマンド 各コマンドモジュールは共通インターフェースとして Command クラスを持ちます。 =============================== """ import os import sys import errno import shutil from optparse import make_optio...
import unittest2 as unittest import asp.jit.asp_module as asp_module import asp.codegen.cpp_ast as cpp_ast from mock import Mock class TimerTest(unittest.TestCase): def test_timer(self): pass class ASPDBTests(unittest.TestCase): def test_creating_db(self): db = asp_module.ASPDB("test_specializer...
''' The validation module provides the capability to perform integrity checks on an entire collection of Bokeh models. To create a Bokeh visualization, the central task is to assemble a collection model objects from |bokeh.models| into a graph that represents the scene that should be created in the client. It is possib...
from master import gitiles_poller def Update(config, active_master, c): master_poller = gitiles_poller.GitilesPoller( 'https://chromium.googlesource.com/external/mojo') c['change_source'].append(master_poller)
"""OpenAPI core validation request shortcuts module""" from functools import partial from openapi_core.validation.request.validators import RequestBodyValidator from openapi_core.validation.request.validators import ( RequestParametersValidator, ) from openapi_core.validation.request.validators import RequestSecuri...
from phovea_server.ns import Namespace, abort from phovea_server.util import jsonify from phovea_server.config import get as get_config from phovea_server.plugin import list as list_plugins import logging app = Namespace(__name__) _log = logging.getLogger(__name__) @app.route('/<path:path>') def _config(path): path =...
import numpy as np from ._base import _BaseImputer from ..utils.validation import FLOAT_DTYPES from ..metrics import pairwise_distances_chunked from ..metrics.pairwise import _NAN_METRICS from ..neighbors._base import _get_weights from ..neighbors._base import _check_weights from ..utils import is_scalar_nan from ..uti...
import time import unittest import node LEADER = 1 ROUTER = 2 ED1 = 3 SED1 = 4 class Cert_5_6_1_NetworkDataLeaderAsBr(unittest.TestCase): def setUp(self): self.nodes = {} for i in range(1,5): self.nodes[i] = node.Node(i) self.nodes[LEADER].set_panid(0xface) self.nodes[LEA...
import mock from tests import base from girder.models.model_base import ValidationException def setUpModule(): base.enabledPlugins.append('ythub') base.startServer() def tearDownModule(): base.stopServer() class FakeAsyncResult(object): def __init__(self): self.task_id = 'fake_id' def get(se...
def extractSecretchateauWordpressCom(item): ''' Parser for 'secretchateau.wordpress.com' ''' vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title']) if not (chp or vol) or "preview" in item['title'].lower(): return None titlemap = [ ('GRMHCD ', 'Grim Reaper Makes His C-Debut', 'transla...
from os import environ from uwsgiconf.presets.nice import Section, PythonSection def test_nice_section(assert_lines): assert_lines([ 'env = LANG=en_US.UTF-8', 'workers = %k', 'die-on-term = true', 'vacuum = true', 'threads = 4', ], Section(threads=4)) assert_lines([ ...
from slider import * def setup(): global slidy size(400,200) slidy = Slider( Rect(50,80,300,40), minVal=100, maxVal=255 ) def draw(): background(slidy.value) slidy.draw() def mousePressed(): slidy.press() def mouseDragged(): slidy.drag() def mouseReleased(): slidy.release()
from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [("election_snooper", "0002_auto_20170314_1754")] operations = [ migrations.AddField( model_name="snoopedelection", name="extra", fie...
import os gettext = lambda s: s urlpatterns = [] def configure(**extra): from django.conf import settings os.environ['DJANGO_SETTINGS_MODULE'] = 'cms.test_utils.cli' defaults = dict( CACHE_BACKEND='locmem:///', DEBUG=True, DATABASE_SUPPORTS_TRANSACTIONS=True, DATABASES={ ...
"""Utility script for generating sqlstore configs sample settings file: default_params = { 'roles': ['m', 's', 'b', 'g', 'h'], 'rw_user': { 'user': 'rw_user', 'passwd': 'password' }, 'ro_user': { 'user': 'ro_user', 'passwd': 'password' }, 'tables': [], } farms = {...
import sys import html5lib import urllib2 from numpy import median, array from xml_icd import parseICD from html5lib import treebuilders def salt(): wx = {} try: tcs = parseICD("http://icd.salt/xml/salt-tcs-icd.xml") time = tcs['tcs xml time info'] bms = tcs['bms external conditions'] ...
import os import sys from setuptools.command.test import test as TestCommand from jsonmodels import __version__, __author__, __email__ from setuptools import setup PROJECT_NAME = 'jsonmodels' if sys.argv[-1] == 'publish': os.system('python setup.py sdist upload') sys.exit() class PyTest(TestCommand): user_o...
import numpy as np from ..utils import check_fname, _check_fname def read_fine_calibration(fname): """Read fine calibration information from a .dat file. The fine calibration typically includes improved sensor locations, calibration coefficients, and gradiometer imbalance information. Parameters ---...
''' This SimpleCV example uses a technique called frame differencing to determine if motion has occured. You take an initial image, then another, subtract the difference, what is left over is what has changed between those two images this are typically blobs on the images, so we do a blob search to count the number of...
from datetime import date, datetime import os from django.conf import settings from django.contrib import admin from django.contrib.auth.models import User from django.db import models from django.db.models import Q from django.utils.timezone import now from pytz import timezone localtz = timezone(settings.TIME_ZONE) d...
males['Age'].mean()
import django.db.models.deletion from django.db import migrations, models import jsonfield.fields class Migration(migrations.Migration): dependencies = [ ('data_interfaces', '0005_remove_match_type_choices'), ] operations = [ migrations.CreateModel( name='CaseRuleAction', ...
from pisi.actionsapi import autotools from pisi.actionsapi import pisitools from pisi.actionsapi import get def build(): autotools.make() def install(): autotools.rawInstall("INSTALL_DIR=%s" % get.installDIR() + "/usr/share/openttd/data")
import os, re, inspect, keyword import maya.cmds as cmds import maya.mel as mm import pymel.util as util import pymel.versions as versions from . import plogging from . import startup _logger = plogging.getLogger(__name__) moduleNameShortToLong = { 'modeling' : 'Modeling', 'rendering' : 'Rendering', 'eff...
import google import re from bs4 import BeautifulSoup def findContactPage(url): html = google.get_page(url) soup = BeautifulSoup(html) contactStr = soup.find_all('a', href=re.compile(".*?contact", re.IGNORECASE)) return contactStr if __name__ == "__main__": url = "http://www.wrangler.com/" conta...
import sys, os sys.path.append(os.path.abspath('../..')) sys.path.append(os.path.abspath('./ext')) extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.intersphinx','plot_directive','only_directives', 'sphinx.ext.inheritance_diagram'] extensions.append('sphinx.ext.pngmath') ...
from __future__ import unicode_literals from django.db import migrations from corehq.sql_db.operations import RawSQLMigration from corehq.form_processor.models import XFormInstanceSQL migrator = RawSQLMigration(('corehq', 'sql_accessors', 'sql_templates'), { 'FORM_STATE_DELETED': XFormInstanceSQL.DELETED }) class M...
"""The WaveBlocks Project Test the complex math functions. @author: R. Bourquin @copyright: Copyright (C) 2010, 2011 R. Bourquin @license: Modified BSD License """ from numpy import * from matplotlib.pyplot import * from WaveBlocks.ComplexMath import * from WaveBlocks.Plot import plotcf a = linspace(0,5,1000) b = linsp...
import numpy as np from menpo.base import Targetable, Vectorizable from menpo.model import MeanInstanceLinearModel from menpofit.differentiable import DP def similarity_2d_instance_model(shape): r""" A MeanInstanceLinearModel that encodes all possible 2D similarity transforms of a 2D shape (of n_points). ...
import os import subprocess import re import glob import numpy as np from astropy.io import fits from astropy.time import Time from astropy.table import Table import desiutil.log import desisurvey.config import desisurvey.plan import desisurvey.tiles from desisurvey.utils import yesno logger = desiutil.log.get_logger()...
import pyaf.Bench.TS_datasets as tsds import tests.artificial.process_artificial_dataset as art art.process_dataset(N = 128 , FREQ = 'D', seed = 0, trendtype = "MovingAverage", cycle_length = 5, transform = "Fisher", sigma = 0.0, exog_count = 100, ar_order = 0);
import pyaf.Bench.TS_datasets as tsds import tests.artificial.process_artificial_dataset as art art.process_dataset(N = 32 , FREQ = 'D', seed = 0, trendtype = "PolyTrend", cycle_length = 7, transform = "Anscombe", sigma = 0.0, exog_count = 0, ar_order = 0);
from __future__ import absolute_import, print_function from sentry.testutils import APITestCase class SharedGroupDetailsTest(APITestCase): def test_simple(self): self.login_as(user=self.user) group = self.create_group() event = self.create_event(group=group) url = '/api/0/shared/issu...
"""Package contenant le paramètre 'éditer' de la commande 'auberge'.""" from primaires.interpreteur.masque.parametre import Parametre class PrmEditer(Parametre): """Paramètre 'éditer de la commande 'auberge'""" def __init__(self): """Constructeur du paramètre.""" Parametre.__init__(self, "éditer...
""" Django settings for mysite2 project. Generated by 'django-admin startproject' using Django 1.9. For more information on this file, see https://docs.djangoproject.com/en/1.9/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.9/ref/settings/ """ import os BASE_DIR...
""" """ import pandas as pd import numpy as np from OfferPandas import Frame, load_offerframe import sys import os import datetime import time def create_fan(energy, reserve, fName=None, return_fan=True, break_tp=False, force_plsr_only=True, verbose=False, *args, **kargs): """ A wrapper which impleme...
from __future__ import absolute_import, unicode_literals import json from django.template.loader import render_to_string from django.utils.translation import ugettext_lazy as _ from wagtail.wagtailadmin.widgets import AdminChooser class AdminSnippetChooser(AdminChooser): target_content_type = None def __init__(...
""" Copyright (c) 2017-2022, Vanessa Sochat 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 of conditions and the follo...
import bottle from cork import Cork from utils import skeleton aaa = Cork('users', email_sender='c.emmery@outlook.com', smtp_url='smtp://smtp.magnet.ie') authorize = aaa.make_auth_decorator(fail_redirect='/login', role="user") def postd(): return bottle.request.forms def post_get(name, default=''): r...
import ctypes import math import sys import threading import time import pyglet _debug = pyglet.options['debug_media'] import mt_media from . import lib_dsound as lib from pyglet.window.win32 import user32, kernel32 class DirectSoundException(mt_media.MediaException): pass def _db(gain): """Convert linear gain ...
__doc__ = _doc = """ This is part of Storn's "Differential Evolution" test suite, as defined in [2], with 'Corana' function definitions drawn from [3,4], 'Griewangk' function definitions drawn from [5], and 'Zimmermann' function definitions drawn from [6]. References:: [1] Storn, R. and Price, K. "Differential Evol...
import uuid import re import datetime import decimal import itertools import functools import random import string import six from six import iteritems from ..exceptions import ( StopValidation, ValidationError, ConversionError, MockCreationError ) try: from string import ascii_letters # PY3 except ImportError:...
"""A class that creates resource projection specification.""" import sys from googlecloudsdk.third_party.py27 import py27_copy as copy PROJECTION_ARG_DOC = ' projection: The parent ProjectionSpec.' ALIGN_DEFAULT = 'left' ALIGNMENTS = {'left': lambda s, w: s.ljust(w), 'center': lambda s, w: s.center(w), ...
import logging from pdb import set_trace import requests import simplejson from time import time import os import facebook def run(): data = get_from_cal_json() msg = create_msg(data) post(msg) def get_from_cal_json(): print "Getting data from OpenACalendar" r = requests.get(MY_API_URL) if r.sta...
""" Display logged-in username. Configuration parameters: format: display format for whoami (default '{username}') Format placeholders: {username} display current username Inspired by i3 FAQ: https://faq.i3wm.org/question/1618/add-user-name-to-status-bar.1.html @author ultrabug SAMPLE OUTPUT {'full_text': u...
from kapteyn import maputils from matplotlib import pyplot as plt fitsobj = maputils.FITSimage("m101.fits") fig = plt.figure() fig.subplots_adjust(left=0.18, bottom=0.10, right=0.90, top=0.90, wspace=0.95, hspace=0.20) for i in range(4): f = fig.add_subplot(2,2,i+1) mplim = fitsobj.Annotatedim...
from datetime import datetime, timedelta import logging from urllib import urlencode from django.http import Http404 from django.utils import html from django.utils.safestring import mark_safe import pytz from corehq import Domain from corehq.apps import reports from corehq.apps.app_manager.models import get_app, Form,...
from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('bookmarks', '0005_auto_20170915_1015'), ] operations = [ migrations.AddField( model_name='bookmark', name='collections', ...
from django.http import Http404 from django.shortcuts import get_object_or_404 from django.urls.base import reverse_lazy as reverse from django.utils.translation import ugettext_lazy as _ from ..forms.journals import JournalEntryForm, JournalForm, JournalLeaderEntryForm from ..models.journals import Journal, JournalEnt...
"""Common classes and functions for firewall rules.""" import re from googlecloudsdk.calliope import arg_parsers from googlecloudsdk.calliope import exceptions as calliope_exceptions ALLOWED_METAVAR = 'PROTOCOL[:PORT[-PORT]]' LEGAL_SPECS = re.compile( r""" (?P<protocol>[a-zA-Z0-9+.-]+) # The protocol group. ...
from __future__ import print_function """Search for code repositories and generate reports""" import datetime import errno import logging import os import pprint import re import subprocess import sys from collections import deque, namedtuple from distutils.util import convert_path from itertools import chain, imap, iz...
from django.core.cache import caches def get_cache(alias): return caches[alias] def get_redis_connection(alias='default', write=True): """ Helper used for obtain a raw redis client. """ cache = get_cache(alias) if not hasattr(cache.client, 'get_client'): raise NotImplementedError("This b...
""" =================== Resource Management =================== This module provides a tool to manage dependencies on resources within a :mod:`vivarium` simulation. These resources take the form of things that can be created and utilized by components, for example columns in the :mod:`state table <vivarium.framework.po...
from .util import DummyDict from .util import tprint import deepdish as dd import numpy as np def to_caffe(tfW, name=None, shape=None, color_layer='', conv_fc_transitionals=None, info=DummyDict()): assert conv_fc_transitionals is None or name is not None if tfW.ndim == 4: if (name == 'conv1_1' or name =...
from . import resource class Binary(resource.Resource): """ Pure binary content defined by a format other than FHIR. A resource that represents the data of a single raw artifact as digital content accessible in its native format. A Binary resource can contain any content, whether text, image, pdf, zip ...
"""Base classes for a test and validator which upload results (reference images, error images) to cloud storage.""" import os import re import tempfile from telemetry import test from telemetry.core import bitmap from telemetry.page import cloud_storage from telemetry.page import page_test test_data_dir = os.path.abspa...
from os import makedirs from os.path import abspath, basename, dirname, join, exists, getsize from shutil import rmtree from zipfile import is_zipfile, ZipFile from tarfile import is_tarfile, TarFile from tempfile import NamedTemporaryFile from compare import expect from django.test import TestCase from django.test.cli...
""" This module contains the 'validate_account' menu node. """ from textwrap import dedent from menu.character import _options_choose_characters def validate_account(caller, input): """Prompt the user to enter the received validation code.""" text = "" options = ( { "key": "b", ...
""" requests._oauth ~~~~~~~~~~~~~~~ This module comtains the path hack neccesary for oauthlib to be vendored into requests while allowing upstream changes. """ import os import sys try: from oauthlib.oauth1 import rfc5849 from oauthlib.common import extract_params from oauthlib.oauth1.rfc5849 import (Client...
from django.contrib.localflavor.co.forms import CODepartmentSelect from utils import LocalFlavorTestCase class COLocalFlavorTests(LocalFlavorTestCase): def test_CODepartmentSelect(self): d = CODepartmentSelect() out = u"""<select name="department"> <option value="AMA">Amazonas</option> <option value...