code
stringlengths
1
199k
from __future__ import unicode_literals VOWELS = "àáảãạaằắẳẵặăầấẩẫậâèéẻẽẹeềếểễệêìíỉĩịi" + \ "òóỏõọoồốổỗộôờớởỡợơùúủũụuừứửữựưỳýỷỹỵy" def join(alist): return "".join(alist) def is_vowel(char): char = char.lower() return char in VOWELS def change_case(string, case): """ Helper: Return new strin...
"""moose_constants.py: Last modified: Sat Jan 18, 2014 05:01PM """ __author__ = "Dilawar Singh" __copyright__ = "Copyright 2013, Dilawar Singh, NCBS Bangalore" __credits__ = ["NCBS Bangalore"] __license__ = "GNU GPL" __version__ = "1.0.0" __maintainer__ = "Dilawar Sing...
""" Add a new DIRAC SiteName to DIRAC Configuration, including one or more CEs. If site is already in the CS with another name, error message will be produced. If site is already in the CS with the right name, only new CEs will be added. """ __RCSID__ = "$Id$" from DIRAC.Core.Base import Script from DIRAC.Configu...
""" WSGI config for writeit project. This module contains the WSGI application used by Django's development server and any production WSGI deployments. It should expose a module-level variable named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover this application via the ``WSGI_APPLICATION`` s...
import fnmatch import inspect import logging import os import re import sys import time from platform import system from functools import wraps from html import entities from itertools import starmap, repeat from xml.etree.ElementTree import tostring log = logging.getLogger(__name__) PY3 = sys.version_info[0] == 3 PY2 ...
import discord from discord.ext import commands from .utils.dataIO import fileIO import os import asyncio import time import logging class RemindMe: """Never forget anything anymore.""" def __init__(self, bot): self.bot = bot self.reminders = fileIO("data/remindme/reminders.json", "load") ...
DOCUMENTATION = """ --- module: ec2_asg short_description: Create or delete AWS Autoscaling Groups description: - Can create or delete AWS Autoscaling Groups - Works with the ec2_lc module to manage Launch Configurations version_added: "1.6" author: "Gareth Rushgrove (@garethr)" options: state: description: ...
from odoo import api, fields, models, _ class PurchaseOrder(models.Model): _inherit = 'purchase.order' mrp_production_count = fields.Integer( "Count of MO Source", compute='_compute_mrp_production_count', groups='mrp.group_mrp_user') @api.depends('order_line.move_dest_ids.group_id.mr...
""" Unit tests for SafeSessionMiddleware """ import ddt from django.conf import settings from django.contrib.auth import SESSION_KEY from django.contrib.auth.models import AnonymousUser from django.http import HttpResponse, HttpResponseRedirect, SimpleCookie from django.test import TestCase from django.test.client impo...
import os import sys import socket import logging import getpass import smtplib import urllib from optparse import OptionParser, OptionGroup from email.mime.text import MIMEText from email.MIMEImage import MIMEImage from email.mime.multipart import MIMEMultipart shinken_image_dir = '/var/lib/shinken/share/images' shink...
from lxml import etree import cgi import logging import lxml.html import lxml.html.clean as clean import openerp.pooler as pooler import random import re import socket import threading import time from email.utils import getaddresses from openerp.loglevels import ustr _logger = logging.getLogger(__name__) tags_to_kill ...
BLANK = [ list("............................................................"), list("............................................................"), list("............................................................"), list("............................................................"), list("...........................
from spack import * class PyCxOracle(PythonPackage): """Python interface to Oracle""" homepage = "https://oracle.github.io/python-cx_Oracle" pypi = "cx_Oracle/cx_Oracle-8.3.0.tar.gz" version('8.3.0', sha256='3b2d215af4441463c97ea469b9cc307460739f89fdfa8ea222ea3518f1a424d9') depends_on('python@3....
from spack import * class CbtfLanl(CMakePackage): """CBTF LANL project contains a memory tool and data center type system command monitoring tool.""" homepage = "http://sourceforge.net/p/cbtf/wiki/Home/" git = "https://github.com/OpenSpeedShop/cbtf-lanl.git" version('develop', branch='master...
from __future__ import print_function import argparse import os import llnl.util.tty as tty import spack.build_environment as build_env import spack.cmd import spack.cmd.common.arguments as arguments description = "show install environment for a spec, and run commands" section = "build" level = "long" def setup_parser(...
"""Provides functions and lists of commands to set up Draft menus and toolbars.""" from PySide.QtCore import QT_TRANSLATE_NOOP def get_draft_drawing_commands(): """Return the drawing commands list.""" from draftguitools import gui_arcs from draftguitools import gui_beziers arc_group = gui_arcs.ArcGroup ...
"""Given an array of ints, return a new array length 2 containing the first and last elements from the original array. The original array will be length 1 or more.""" def make_ends(nums): new_list = [] new_list.append(nums[0]) new_list.append(nums[-1]) return new_list print(make_ends([1, 2, 3])) # [1,...
import sys import os import argparse import logging logging.basicConfig(level=logging.INFO) import pydoop import pydoop.hadut as hadut import pydoop.hdfs as hdfs import pydoop.test_support as pts from timer import Timer DEFAULT_SCRIPT = "../../examples/wordcount/bin/wordcount-full.py" CONF = { "mapred.map.tasks": "...
from __future__ import print_function import re from .utils import assert_files_exist def assert_workspace_initialized(path): assert_files_exist(path, ['.catkin_tools']) def assert_warning_message(out_str, pattern=''): """ Assert that the stdout returned from a call contains a catkin_tools warning. ...
"""Base handler class for all mapreduce handlers.""" import httplib import logging from mapreduce.lib import simplejson try: from mapreduce import pipeline_base except ImportError: pipeline_base = None try: import cloudstorage except ImportError: cloudstorage = None from google.appengine.ext import webapp from ...
from itertools import chain, imap from thrift_compiler import frontend autogen_comment = '''Autogenerated by Thrift DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING @''' 'generated' class Generator(object): ''' Base class for a thrift code generator. This class defines the basic routines fo...
""" Views related to OAuth2 platform applications. Intended for OSF internal use only """ from rest_framework.exceptions import APIException from rest_framework import generics from rest_framework import renderers from rest_framework import permissions as drf_permissions from modularodm import Q from framework.auth imp...
"""Test Group config panel.""" import asyncio import json from unittest.mock import patch, MagicMock from homeassistant.bootstrap import async_setup_component from homeassistant.components import config VIEW_NAME = 'api:config:group:config' @asyncio.coroutine def test_get_device_config(hass, test_client): """Test g...
from sqlalchemy.orm import exc from quantum.common import exceptions as q_exc import quantum.db.api as db_api from quantum.db import models_v2 from quantum.openstack.common import log as logging from quantum.plugins.hyperv.common import constants from quantum.plugins.hyperv import model as hyperv_model LOG = logging.ge...
""" Custom exceptions. """ __author__ = 'Easyhard' __version__ = '1.0' class DataConverterException(Exception): """It is thrown if there is any error of data converter.""" def __init__(self, msg): self.msg = msg def __str__(self): return repr(self.msg) class DataReaderException(Exception): ...
from openstack_dashboard.dashboards.project.instances.workflows.\ create_instance import LaunchInstance from openstack_dashboard.dashboards.project.instances.workflows.\ resize_instance import ResizeInstance from openstack_dashboard.dashboards.project.instances.workflows.\ update_instance import UpdateInsta...
""" >>> from pyspark.conf import SparkConf >>> from pyspark.context import SparkContext >>> conf = SparkConf() >>> conf.setMaster("local").setAppName("My app") <pyspark.conf.SparkConf object at ...> >>> conf.get("spark.master") u'local' >>> conf.get("spark.app.name") u'My app' >>> sc = SparkContext(conf=conf) >>> sc.ma...
"""This module contains a Google Cloud Speech Hook.""" from typing import Dict, Optional, Sequence, Union from google.api_core.retry import Retry from google.cloud.speech_v1 import SpeechClient from google.cloud.speech_v1.types import RecognitionAudio, RecognitionConfig from airflow.providers.google.common.consts impor...
import sys, os sys.path.append(os.path.join(os.path.dirname(__file__),'..')) from singa.model import * from examples.datasets import mnist pvalues = {'batchsize' : 64, 'shape' : 784, 'std_value' : 127.5, 'mean_value' : 127.5} X_train, X_test, workspace = mnist.load_data(**pvalues) m = Sequential('mlp', argv=...
''' 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 use this ...
import argparse import ConfigParser import os import sys import commands def main(argv): os_master = sys.argv[1] self_ip = sys.argv[2] internal_vip = sys.argv[3] openstack_ip_list_str = sys.argv[4] openstack_ip_list = openstack_ip_list_str.split(",") mysql_svc = 'mysql' status,output = comma...
import asyncio import logging from typing import Union, Optional, List, Callable from ..execution_manager import ExecutionManager from . import types, update, mod_abc from opentrons.drivers.thermocycler.driver import ( HOLD_TIME_FUZZY_SECONDS, SimulatingDriver, Thermocycler as ThermocyclerDriver) MODULE_LOG...
from __future__ import absolute_import from st2common.exceptions import StackStormBaseException from st2common.exceptions import StackStormPluginException class SensorPluginException(StackStormPluginException): pass class TriggerTypeRegistrationException(SensorPluginException): pass class SensorNotFoundExceptio...
from telemetry.page import legacy_page_test from telemetry.timeline.model import TimelineModel from telemetry.timeline import tracing_config from telemetry.util import statistics from telemetry.value import scalar class V8GCTimes(legacy_page_test.LegacyPageTest): _TIME_OUT_IN_SECONDS = 60 _CATEGORIES = ['blink.cons...
""" Implementation of diagnostic command line tools Tools are: * nipy_diagnose * nipy_tsdiffana This module has the logic for each command. The command script files deal with argument parsing and any custom imports. The implementation here accepts the ``args`` object from ``argparse`` and does the work. """ from __futu...
import gzip from os import path from datetime import datetime from django.core.files.storage import FileSystemStorage, get_storage_class from django.utils.functional import LazyObject, SimpleLazyObject from compressor.conf import settings class CompressorFileStorage(FileSystemStorage): """ Standard file system ...
"""SCons.Tool.pdf Common PDF Builder definition for various other Tool modules that use it. Add an explicit action to run epstopdf to convert .eps files to .pdf """ __revision__ = "src/engine/SCons/Tool/pdf.py 3897 2009/01/13 06:45:54 scons" import SCons.Builder import SCons.Tool PDFBuilder = None EpsPdfAction = SCons....
pass
import logging import base64 import random import os import ssl import time import copy import sys from pydispatch import dispatcher from flask import Flask, request, make_response from lib.common import helpers from lib.common import agents from lib.common import encryption from lib.common import packets from lib.comm...
from __future__ import print_function, division import numpy as np import numpy.linalg as npl import matplotlib import matplotlib.pyplot as plt from matplotlib import colors from matplotlib import gridspec import os import re import json import nibabel as nib from utils import subject_class as sc from utils import outl...
import glob import logging import optparse import os import shutil import sys import tempfile import zipfile import pyauto_functional # Must be imported before pyauto import pyauto import pyauto_utils class ImportsTest(pyauto.PyUITest): """Import settings from other browsers. Import settings tables below show whic...
import json from vilya.libs.auth.decorators import login_required from vilya.libs.template import st _q_exports = ['setting', ] @login_required def _q_index(request): user = request.user return st('settings/codereview.html', **locals()) @login_required def setting(request): is_enable = request.get_form_var(...
class User(): def __init__(self, username): self.username = username def is_authenticated(self): return True def is_active(self): return True def is_anonymous(self): return False def get_id(self): return self.username
import io import unittest import importlib_resources as resources from importlib_resources._adapters import ( CompatibilityFiles, wrap_spec, ) from . import util class CompatibilityFilesTests(unittest.TestCase): @property def package(self): bytes_data = io.BytesIO(b'Hello, world!') retur...
from __future__ import unicode_literals, division, absolute_import from builtins import * # noqa pylint: disable=unused-import, redefined-builtin from flexget.utils.template import get_template from future.moves.urllib.parse import urlparse, parse_qsl import os import re import logging from collections import defaultd...
import os compiler = './gcc.py' mpicompiler = './gcc.py' mpilinker = 'cc' extra_compile_args = ['-std=c99'] libraries = ['z'] library_dirs += [os.environ['LIBXCDIR'] + '/lib'] include_dirs += [os.environ['LIBXCDIR'] + '/include'] libraries += ['xc'] scalapack = True hdf5 = True define_macros += [('GPAW_NO_UNDERSCORE_CB...
''' The MIT License (MIT) Copyright (c) 2014 NTHUOJ team 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, pu...
from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('creditor', '0008_auto_20151226_2116'), ] operations = [ migrations.AlterModelOptions( name='recurringtransaction', options={'orde...
import os INFO = {'name': 'RadialNet', 'version': '0.44', 'website': 'http://www.dca.ufrn.br/~joaomedeiros/radialnet/', 'authors': ['João Paulo de Souza Medeiros'], 'copyright': 'Copyright (C) 2007, 2008 Insecure.Com LLC'}
import gtk import awn import rsvg class EffectedDA(gtk.DrawingArea): def __init__(self): gtk.DrawingArea.__init__(self) self.modify_bg(gtk.STATE_NORMAL, gtk.gdk.Color(65535, 0, 32000)) self.useSVG = True self.effects = awn.Effects(self) # two ways to do the same set_property(...
from gnuradio import gr, gr_unittest, digital, blocks class test_pn_correlator_cc(gr_unittest.TestCase): def setUp(self): self.tb = gr.top_block() def tearDown(self): self.tb = None def test_000_make(self): c = digital.pn_correlator_cc(10) def test_001_correlate(self): de...
import sqlite3 import time import urllib import zlib conn = sqlite3.connect('index.sqlite') conn.text_factory = str cur = conn.cursor() cur.execute('''SELECT Messages.id, sender FROM Messages JOIN Senders ON Messages.sender_id = Senders.id''') sendorgs = dict() for message_row in cur : sender = message_row[1] ...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type from yaml.resolver import Resolver from ansible.parsing.yaml.constructor import AnsibleConstructor from ansible.module_utils.common.yaml import HAS_LIBYAML, Parser if HAS_LIBYAML: class AnsibleLoader(Parser, AnsibleConstructor, ...
""" Tests for maximal (not maximum) independent sets. """ from nose.tools import * import networkx as nx import random class TestMaximalIndependantSet(object): def setup(self): self.florentine = nx.Graph() self.florentine.add_edge('Acciaiuoli', 'Medici') self.florentine.add_edge('Castellani'...
import io import re import logging import collections from flask import json, current_app as app from eve.utils import config from superdesk.errors import SuperdeskApiError from superdesk.services import BaseService from superdesk.notification import push_notification from apps.dictionaries.resource import DICTIONARY_F...
from PyPDF2 import PdfFileWriter, PdfFileReader from PyPDF2.generic import DictionaryObject, DecodedStreamObject, NameObject, createStringObject, ArrayObject from PyPDF2.utils import b_ from datetime import datetime import io import hashlib DEFAULT_PDF_DATETIME_FORMAT = "D:%Y%m%d%H%M%S+00'00'" def _unwrapping_get(self,...
from openerp.osv import fields, osv from datetime import datetime, date, time import logging import openerp.tools import pytz class stock_location_product(osv.osv_memory): _inherit = "stock.location.product" _logger = logging.getLogger(__name__) _columns = { 'from_date2': fields.datetime('From'),...
from spack import * class Nccl(MakefilePackage, CudaPackage): """Optimized primitives for collective multi-GPU communication.""" homepage = "https://github.com/NVIDIA/nccl" url = "https://github.com/NVIDIA/nccl/archive/v2.7.3-1.tar.gz" maintainers = ['adamjstewart'] version('2.11.4-1', sha256='...
""" This module implements Version and version-ish objects. These are: Version A single version of a package. VersionRange A range of versions of a package. VersionList A list of Versions and VersionRanges. All of these types support the following operations, which can be called on any of the types:: __eq__, _...
import os import pyblish.lib import pyblish.plugin from . import lib from nose.tools import ( with_setup, raises ) package_path = pyblish.lib.main_package_path() plugin_path = os.path.join(package_path, 'tests', 'plugins') pyblish.plugin.deregister_all_paths() pyblish.plugin.register_plugin_path(plugin_path) @w...
from lettuce import world, after, before from tools import environment_request from tools.environment_request import EnvironmentRequest from tools.constants import PAAS, KEYSTONE_URL, PAASMANAGER_URL, TENANT, USER,\ PASSWORD, VDC, SDC_URL from tools import terrain_steps @before.each_feature def before_each_scenario...
"""This code example creates new line items. To determine which line items exist, run get_all_line_items.py. To determine which orders exist, run get_all_orders.py. To determine which placements exist, run get_all_placements.py.""" from datetime import date import uuid from googleads import dfp ORDER_ID = 'INSERT_ORDER...
"""Add more network info attributes to 'network_allocations' table. Revision ID: 5155c7077f99 Revises: 293fac1130ca Create Date: 2015-12-22 12:05:24.297049 """ revision = '5155c7077f99' down_revision = '293fac1130ca' from alembic import op import sqlalchemy as sa def upgrade(): default_label_value = 'user' op.a...
import argparse import os import logging from common import modelzoo import mxnet as mx from mxnet.contrib.quantization import * def download_calib_dataset(dataset_url, calib_dataset, logger=None): if logger is not None: logger.info('Downloading calibration dataset from %s to %s' % (dataset_url, calib_datas...
from typing import TYPE_CHECKING, Optional, Sequence from airflow.models import BaseOperator from airflow.providers.mysql.hooks.mysql import MySqlHook from airflow.providers.trino.hooks.trino import TrinoHook from airflow.www import utils as wwwutils if TYPE_CHECKING: from airflow.utils.context import Context class...
""" Interfaces with Alarm.com alarm control panels. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/alarm_control_panel.alarmdotcom/ """ import logging import re import voluptuous as vol import homeassistant.components.alarm_control_panel as alarm from hom...
"""Registration and usage mechanisms for KL-divergences.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from tensorflow.contrib.distributions.python.ops import distribution from tensorflow.python.framework import ops from tensorflow.python.ops import arra...
"""Converting code to AST. Adapted from Tangent. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import inspect import linecache import re import sys import textwrap import tokenize import astunparse import gast import six from tensorflow.python.autograph...
import datetime from mock import MagicMock, patch import testtools from trove.backup import models from trove.backup import state from trove.common import context from trove.common import exception from trove.common import utils from trove.instance import models as instance_models from trove.taskmanager import api from...
import logging import numpy as np import pandas as pd from scipy import optimize as optimization from oggm import entity_task import oggm.core.massbalance as mbmods from oggm.core.flowline import flowline_model_run log = logging.getLogger(__name__) @entity_task(log) def run_uncertain_random_climate(gdir, nyears=700, ...
from social_core.pipeline.user import USER_FIELDS, get_username, create_user, \ user_details
from .. utils import TranspileTestCase, BuiltinFunctionTestCase class GlobalsTests(TranspileTestCase): def test_simple(self): self.assertCodeExecution(""" print("There are %s globals" % len(globals())) x = 1 y = 'z' print("There are %s globals" % len(globals()...
__docformat__='restructuredtext' import re, time, datetime __all__ = ['strToDatetime'] def strToDatetime(str): return datetime.datetime(*_parse_date_w3dtf(str)[0:6]) def _parse_date_w3dtf(dateString): def __extract_date(m): year = int(m.group('year')) if year < 100: year = 100 * int(...
import sys try: import setuptools except ImportError: from ez_setup import use_setuptools use_setuptools() from setuptools import setup, find_packages, Extension, Feature from distutils.command.build_ext import build_ext from distutils.errors import CCompilerError, DistutilsExecError, \ DistutilsPlatfor...
import logging as logger import os from django.db.models import Sum from kolibri.tasks.management.commands.base import AsyncCommand from ...content_db_router import using_content_database from ...models import File from ...utils import paths, transfer logging = logger.getLogger(__name__) class Command(AsyncCommand): ...
""" Support for Dovado router. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/sensor.dovado/ """ import logging import re from datetime import timedelta import voluptuous as vol from homeassistant.helpers.entity import Entity from homeassistant.util impor...
""" *************************************************************************** RandomPointsPolygonsFixed.py --------------------- Date : April 2014 Copyright : (C) 2014 by Alexander Bruy Email : alexander dot bruy at gmail dot com **************************...
import time start=time.time() all=xrange(1,10**7) def check(num): a=list(str(num)) b=a[::-1] if a==b: return True return False for i in all: if check(i): if check(i**2): print i,i**2 end=time.time() print end-start
from numpy import * from pylab import * from scipy import * from shogun import RealFeatures from shogun import MeanShiftDataGenerator from shogun import GaussianKernel, CombinedKernel from shogun import LinearTimeMMD, MMDKernelSelectionOpt from shogun import PERMUTATION, MMD1_GAUSSIAN from shogun import EuclideanDistan...
import numpy as np from pele.potentials import BasePotential from pele.potentials.fortran import gupta as fortran_gupta class gupta(BasePotential): """The Gupta potential for transition metals. Parameters ---------- p : float p is dimensionless, goes inside the repulsive exponential q : f...
class ValidationResult(object): TYPE_INFO = 'info' TYPE_WARN = 'warning' TYPE_ERROR = 'error' def __init__(self, restype, bookpath, linenumber, charoffset, message): self.restype = restype self.bookpath = bookpath self.linenumber = linenumber self.charoffset = charoffse...
""" Oggetto principale """ import logging from lib.fbwrapper.src import fbwrapper from lib.fbwrapper.src import version as fbwrapper_version from lib.fbwrapper.src.shared import caching_levels import version import fbobj logger = logging.getLogger(version.lib_name) logger.addHandler(logging.NullHandler()) if fbwrapper_...
from __future__ import unicode_literals from django.db import migrations, models def add_language_name(apps, schema_editor): """ Add correct names for default language entries """ Language = apps.get_model("rw", "language") for language in Language.objects.all(): if language.language_code ==...
import logging from django.template import defaultfilters from django.utils.translation import ugettext_lazy as _ # noqa from horizon import messages from horizon import tables from openstack_dashboard import api LOG = logging.getLogger(__name__) ENABLE = 0 DISABLE = 1 class CreateUserLink(tables.LinkAction): name...
from AlgorithmImports import * class DisplacedMovingAverageRibbon(QCAlgorithm): # Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized. def Initialize(self): self.SetStartDate(2009, 1, 1) #Set Start Date self.Se...
""" 一个简单的Python爬虫, 用于抓取coursera网站的下载链接和pdf Anthor: Andrew Liu Version: 0.0.2 Date: 2014-12-15 Language: Python2.7.8 Editor: Sublime Text2 Operate: 具体操作请看README.md介绍 """ import scrapy import random, string from scrapy.http import Request, FormRequest from scrapy.selector import Selector from coursera.items import Course...
import nose.tools as nt from IPython.utils.dir2 import dir2 class Base(object): x = 1 z = 23 def test_base(): res = dir2(Base()) assert ('x' in res) assert ('z' in res) assert ('y' not in res) assert ('__class__' in res) nt.assert_equal(res.count('x'), 1) nt.assert_equal(res.count('_...
import os from oslo.config import cfg reldir = os.path.join(os.path.dirname(__file__), '..', '..', '..') absdir = os.path.abspath(reldir) cfg.CONF.state_path = absdir cfg.CONF.use_stderr = False
"""Tests for sorting operators.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np from tensorflow.compiler.tests import xla_test from tensorflow.compiler.tf2xla.python import xla from tensorflow.python.framework import dtypes from tensorfl...
"""Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. WSO2 Inc. licenses this file to you 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 ...
import logging import platform import socket import time import os import warnings import pysb SECONDS_IN_HOUR = 3600 LOG_LEVEL_ENV_VAR = 'PYSB_LOG' BASE_LOGGER_NAME = 'pysb' EXTENDED_DEBUG = 5 NAMED_LOG_LEVELS = {'NOTSET': logging.NOTSET, 'EXTENDED_DEBUG': EXTENDED_DEBUG, 'DEBUG...
from streamlink.plugins.zhanqi import Zhanqitv from tests.plugins import PluginCanHandleUrl class TestPluginCanHandleUrlZhanqitv(PluginCanHandleUrl): __plugin__ = Zhanqitv should_match = [ 'https://www.zhanqi.tv/lpl', ]
""" Classes to represent the definitions of aggregate functions. """ from django.db.models.constants import LOOKUP_SEP def refs_aggregate(lookup_parts, aggregates): """ A little helper method to check if the lookup_parts contains references to the given aggregates set. Because the LOOKUP_SEP is contained in...
""" Operators present in the FE discretization of (adjoint) Navier-Stokes terms. """ from __future__ import print_function from __future__ import absolute_import import sympy as s from six.moves import range def create_scalar(name, n_ep): vec = s.zeros(n_ep, 1) for ip in range(n_ep): vec[ip,0] = '%s%d' ...
from trac.db import Table, Column, Index, DatabaseManager def do_upgrade(env, ver, cursor): # Make changeset cache multi-repository aware cursor.execute("CREATE TEMPORARY TABLE rev_old " "AS SELECT * FROM revision") cursor.execute("DROP TABLE revision") cursor.execute("CREATE TEMPORAR...
""" India-specific Form helpers. """ from django.newforms import ValidationError from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES from django.utils.encoding import smart_unicode from django.utils.translation import gettext import re class INZipCodeField(RegexField): default_error_messages ...
from pyface.toolkit import toolkit_object DockPane = toolkit_object('tasks.dock_pane:DockPane')
import datetime import logging import os import random import shutil import sys import tempfile from py_utils import cloud_storage # pylint: disable=import-error from telemetry.internal.util import file_handle from telemetry.timeline import trace_data as trace_data_module from telemetry import value as value_module fr...
import numpy as np import nibabel as nib import numpy.linalg as npl from dipy.io.dpy import Dpy def flirt2aff(mat, in_img, ref_img): """ Transform from `in_img` voxels to `ref_img` voxels given `matfile` Parameters ---------- matfile : (4,4) array contents (as array) of output ``-omat`` transfor...
import plumbum from plumbum import cli, colors class MyApp(cli.Application): PROGNAME = colors.green VERSION = colors.blue | "1.0.2" COLOR_GROUPS = {"Meta-switches" : colors.bold & colors.yellow} opts = cli.Flag("--ops", help=colors.magenta | "This is help") def main(self): print("HI") if _...