content
string
from pathlib import Path import textwrap from django.core.management.base import BaseCommand class Command(BaseCommand): help = 'Convert a template to use Fluent for l10n' requires_system_checks = False def add_arguments(self, parser): subparsers = parser.add_subparsers( title='subco...
from test.support import run_unittest from test.script_helper import assert_python_failure, temp_dir import unittest import sys import cgitb class TestCgitb(unittest.TestCase): def test_fonts(self): text = "Hello Robbie!" self.assertEqual(cgitb.small(text), "<small>{}</small>".format(text)) ...
""" This module contains helper classes and methods for the facebook integration module .. module:: application.facebook.facebook .. moduleauthor:: Devin Schwab <<EMAIL>> """ import facebooksdk as fb import models from flask import flash class AlbumList(object): def __init__(self, token): """ G...
from ibis.common import IbisError import ibis.expr.operations as ops import ibis.expr.types as ir import ibis.expr.temporal as T from ibis.expr.tests.mocks import MockConnection from ibis.compat import unittest class TestFixedOffsets(unittest.TestCase): def setUp(self): self.con = MockConnection() ...
import sys from django import http from django.core import signals from django.utils.encoding import force_unicode from django.utils.importlib import import_module class BaseHandler(object): # Changes that are always applied to a response (in this order). response_fixes = [ http.fix_location_header, ...
""" mbed SDK Copyright (c) 2011-2013 ARM Limited 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 wr...
""" This file contains implementation override of SearchFilterGenerator which will allow * Filter by all courses in which the user is enrolled in """ from microsite_configuration import microsite from student.models import CourseEnrollment from opaque_keys import InvalidKeyError from opaque_keys.edx.keys import Co...
# coding: utf-8 from __future__ import unicode_literals from .common import InfoExtractor from ..utils import ( parse_iso8601, int_or_none, ) class TwentyFourVideoIE(InfoExtractor): IE_NAME = '24video' _VALID_URL = r'https?://(?:www\.)?24video\.net/(?:video/(?:view|xml)/|player/new24_play\.swf\?id=)(...
# coding: utf-8 from __future__ import unicode_literals import re from .common import InfoExtractor from ..compat import compat_str from ..utils import ( int_or_none, js_to_json, strip_or_none, try_get, unified_timestamp, ) class WatchBoxIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?w...
""" Module that takes control of versioning. @author: Stijn De Weirdt (Ghent University) @author: Dries Verdegem (Ghent University) @author: Kenneth Hoste (Ghent University) @author: Pieter De Baets (Ghent University) @author: Jens Timmerman (Ghent University) """ import os from distutils.version import LooseVersion f...
import os import sys import getopt import shutil import string # Globals quiet = 0 test = 0 comments = 0 sysfsprefix = "/sys/devices/system/rttest/rttest" statusfile = "/status" commandfile = "/command" # Command opcodes cmd_opcodes = { "schedother" : "1", "schedfifo" : "2", "lock" : "3",...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type import os import json import pytest import sys if sys.version_info < (2, 7): pytestmark = pytest.mark.skip("F5 Ansible modules require Python >= 2.7") from ansible.module_utils.basic import AnsibleModule try: from librar...
import matplotlib.pyplot as plt from zipline.algorithm import TradingAlgorithm from zipline.utils.factory import load_from_yahoo # Import exponential moving average from talib wrapper from zipline.transforms.ta import EMA from datetime import datetime import pytz class DualEMATaLib(TradingAlgorithm): """Dual M...
import time from osv import osv, fields import decimal_precision as dp import netsvc from tools.translate import _ class account_bank_statement(osv.osv): _inherit = 'account.bank.statement' def write(self, cr, uid, ids, vals, context=None): if context is None: context = {} # bypass...
""" Useful auxilliary data structures for query construction. Not useful outside the SQL domain. """ class EmptyResultSet(Exception): pass class FullResultSet(Exception): pass class MultiJoin(Exception): """ Used by join construction code to indicate the point at which a multi-valued join was att...
"""Parser for the environment markers micro-language defined in PEP 345.""" import ast import os import sys import platform from .compat import python_implementation, string_types from .util import in_venv __all__ = ['interpret'] class Evaluator(object): """ A limited evaluator for Python expressions. ...
import zmq import array import time import struct import numpy as np import pmt import sys class zmq_pull_socket(): def __init__(self, tcp_str, verbose=0): self.context = zmq.Context() self.receiver = self.context.socket(zmq.PULL) self.receiver.connect(tcp_str) def poll(self, type_str...
""" Many-to-one relationships To define a many-to-one relationship, use ``ForeignKey()``. """ from __future__ import unicode_literals from django.db import models from django.utils.encoding import python_2_unicode_compatible @python_2_unicode_compatible class Reporter(models.Model): first_name = models.CharFiel...
from __future__ import (absolute_import, division, print_function, unicode_literals) import numpy as np from ggplot.utils import make_iterable_ntimes from .geom import geom # Note when documenting # slope and intercept can be functions that compute the slope # and intercept using the data. If ...
import uuid from django.contrib.auth import get_permission_codename from django.contrib.sites.models import Site from django.core.exceptions import ValidationError from django.db import models from django.utils.encoding import python_2_unicode_compatible from django.utils.translation import ugettext_lazy as _ from cm...
"""Tests for the Hisense AEH-W4A1 init file.""" from unittest.mock import patch from pyaehw4a1 import exceptions from homeassistant import config_entries, data_entry_flow from homeassistant.components import hisense_aehw4a1 from homeassistant.setup import async_setup_component async def test_creating_entry_sets_up_...
""" ======================================= Receiver Operating Characteristic (ROC) ======================================= Example of Receiver Operating Characteristic (ROC) metric to evaluate classifier output quality. ROC curves typically feature true positive rate on the Y axis, and false positive rate on the X a...
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer PORT_NUMBER = 8000 # This class will handles any incoming request. class HTTPHandler(BaseHTTPRequestHandler): # Handler for the GET requests def do_GET(self): self.send_response(200) self.send_header('Content-type','text/html') self.end_hea...
""" Clickjacking Protection Middleware. This module provides a middleware that implements protection against a malicious site loading resources from your site in a hidden frame. """ from django.conf import settings class XFrameOptionsMiddleware(object): """ Middleware that sets the X-Frame-Options HTTP head...
import requests import json import numpy as np import pandas as pd import CoHouseToken from difflib import SequenceMatcher # In[3]: def exactMatch(line1, line2): line1=line1.upper().rstrip() line2=line2.upper().rstrip() #print("|"+line1+"|"+line2+"|",line1==line2) return line1==line2 def aS...
import pyMIC as mic import numpy as np device = mic.devices[0] a = device.zeros((8,8))
#!/usr/bin/env python """html2text: Turn HTML into equivalent Markdown-structured text.""" __version__ = "2.36" __author__ = "Aaron Swartz (<EMAIL>)" __copyright__ = "(C) 2004-2008 Aaron Swartz. GNU GPL 3." __contributors__ = ["Martin 'Joey' Schulze", "Ricardo Reyes", "Kevin Jay North"] # TODO: # Support decoded ent...
"""Copyright (c) 2012 Nezar Abdennur This module contains code adapted from the Python implementation of the heapq module, which was written by Kevin O'Connor and augmented by Tim Peters and Raymond Hettinger. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated...
DROP_TBL_PERFDATA = "DROP TABLE perfdata" CREATE_TBL_PERFDATA = """CREATE TABLE `perfdata` ( `pk` int(11) NOT NULL AUTO_INCREMENT, `id` varchar(16) NOT NULL, `fn` varchar(256) NOT NULL, `wt` int(11) NOT NULL, `ct` int(11) NOT NULL, `pmu` int(11) NOT NULL, `mu` int(11) NOT NULL, `cpu` int(11) NOT NULL, ...
import datetime from decimal import Decimal import re from weboob.deprecated.browser import Page from weboob.capabilities.bank import Account from weboob.tools.capabilities.bank.transactions import FrenchTransaction class LoginPage(Page): def login(self, login, passwd): self.browser.select_form(name='frm...
import inspect import logging as std_logging import os import random from oslo.config import cfg from oslo.messaging import server as rpc_server from neutron.common import config from neutron.common import rpc as n_rpc from neutron import context from neutron.db import api as session from neutron import manager from ...
''' This is a dummy file for me to get started making an Ising model. I'll get this 2-D Ising running, then generalize. ''' import argparse from itertools import izip import numpy as np from matplotlib import pyplot as plt import seaborn as sns sns.set() def run_ising(N, d, K, J,h, n_steps, plot = False): ''' ...
""" HTMLParser-based link extractor """ from HTMLParser import HTMLParser from urlparse import urljoin from w3lib.url import safe_url_string from scrapy.link import Link from scrapy.utils.python import unique as unique_list class HtmlParserLinkExtractor(HTMLParser): def __init__(self, tag="a", attr="href", pro...
# # soar # io.py - object-oriented interface to the robot # # This io file makes use of the "official" soar interface # (sonarDistances, etc), and it is still ugly, since it relies on having # a handle on the brain environment, but it is arguably neater than # the io.py file. However it seems to introduce some kind ...
import os from charms import layer from charms.reactive import hook from charms.reactive import is_state from charms.reactive import remove_state from charms.reactive import set_state from charms.reactive import when from charms.reactive import when_not from charmhelpers.core import hookenv from shlex import split ...
#!/usr/bin/env python2.7 from __future__ import absolute_import, unicode_literals, print_function, division from sys import argv from os import environ, stat, remove as _delete_file from os.path import isfile, dirname, basename, abspath from hashlib import sha256 from subprocess import check_call as run from boto.s3....
#========================================================================== # imViewer-Simple.py # # An example program that opens uncompressed DICOM images and # converts them via numPy and PIL to be viewed in wxWidgets GUI # apps. The conversion is currently: # # pydicom->NumPy->PIL->wxPython.Image->wxPython.B...
from pyasn1.type import constraint, error from pyasn1.error import PyAsn1Error from sys import version_info if version_info[0:2] < (2, 7) or \ version_info[0:2] in ( (3, 0), (3, 1) ): try: import unittest2 as unittest except ImportError: import unittest else: import unittest class Single...
"""Platform for Time of Flight sensor VL53L1X from STMicroelectronics.""" import asyncio from functools import partial import logging from VL53L1X2 import VL53L1X # pylint: disable=import-error import voluptuous as vol from homeassistant.components import rpi_gpio from homeassistant.components.sensor import PLATFOR...
from shinken_test import * class TestsericeTplNoHostname(ShinkenTest): def setUp(self): self.setup_with_file('etc/shinken_servicetpl_no_hostname.cfg') def test_dummy(self): # # Config is not correct because of a wrong relative path # in the main config file # ...
from msrest.service_client import ServiceClient from msrest import Configuration, Serializer, Deserializer from .version import VERSION from .operations.datetime_model_operations import DatetimeModelOperations from . import models class AutoRestDateTimeTestServiceConfiguration(Configuration): """Configuration for...
#!/usr/bin/python3 import csv import pymysql singleList = [] multipleList = [] # Connect to the database connection = pymysql.connect( host='localhost', user='operator', passwd='operator', db='chunk4_images', charset='utf8mb4', ...
import numpy as np from unittest import TestCase from diffprivlib.mechanisms import ExponentialCategorical from diffprivlib.utils import global_seed class TestExponential(TestCase): def setup_method(self, method): if method.__name__ .endswith("prob"): global_seed(314159) self.mech = ...
""" ARX (autoregressive exogenous) Model """ from sparktk.loggers import log_load; log_load(__name__); del log_load from sparktk import TkContext from sparktk.propobj import PropertiesObject __all__ = ["train", "load", "ArxModel"] def train(frame, ts_column, x_columns, y_max_lag, x_max_lag, no_intercept=False): ...
from test_framework import BitcoinTestFramework from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException from util import * import os import shutil # Create one-input, one-output, no-fee transaction: class MempoolSpendCoinbaseTest(BitcoinTestFramework): def setup_network(self): # Just need one ...
import honeyd import time import support from htmltmpl import TemplateManager, TemplateProcessor global counter self.send_response(200) self.send_header("Content-Type", "text/html") self.send_nocache() self.end_headers() # Compile or load already precompiled template. template = TemplateManager().prepare(self.root+"...
from .enums import MachineState HZ_CLS = ( 1,0,0,0,0,0,0,0, # 00 - 07 0,0,0,0,0,0,0,0, # 08 - 0f 0,0,0,0,0,0,0,0, # 10 - 17 0,0,0,1,0,0,0,0, # 18 - 1f 0,0,0,0,0,0,0,0, # 20 - 27 0,0,0,0,0,0,0,0, # 28 - 2f 0,0,0,0,0,0,0,0, # 30 - 37 0,0,0,0,0,0,0,0, # 38 - 3f 0,0,0,0,0,0,0,0, # 40 - 47 0,0,0,0,0,0,0,0, # 48 -...
""" Defines data types and models required specifically for RTC support. """ import logging from ryu.lib.packet.bgp import RF_RTC_UC from ryu.services.protocols.bgp.info_base.base import Destination from ryu.services.protocols.bgp.info_base.base import NonVrfPathProcessingMixin from ryu.services.protocols.bgp.info_...
"""TensorFlow Ops for Sequence to Sequence models.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from tensorflow.contrib import rnn from tensorflow.python.framework import dtypes from tensorflow.python.framework import ops from tensorflow.python.ops im...
""" Standardized versions of various cool and/or strange things that you can do with Python's reflection capabilities. """ import sys from .compat import PY3 class _NoModuleFound(Exception): """ No module was found because none exists. """ class InvalidName(ValueError): """ The given name is n...
from .mbcharsetprober import MultiByteCharSetProber from .codingstatemachine import CodingStateMachine from .chardistribution import Big5DistributionAnalysis from .mbcssm import Big5SMModel class Big5Prober(MultiByteCharSetProber): def __init__(self): MultiByteCharSetProber.__init__(self) self._mC...
# -*- coding: utf-8 -*- import time import unittest from nive.security import AdminUser, UserFound from db_app import * class ObjectTest(unittest.TestCase): def setUp(self): self.app = app() def tearDown(self): self.app.Close() pass def test_add(self): a=self.app ...
import py import types import sys def checksubpackage(name): obj = getattr(py, name) if hasattr(obj, '__map__'): # isinstance(obj, Module): keys = dir(obj) assert len(keys) > 0 print (obj.__map__) for name in list(obj.__map__): assert hasattr(obj, name), (obj, name) ...
import re import sys import subprocess import sublime from .abstract import AbstractRegexLinkResolver try: import urllib.request, urllib.parse, urllib.error except ImportError: import urllib PATTERN_SETTING = 'orgmode.open_link.resolver.https.pattern' PATTERN_DEFAULT = r'^(https):(?P<url>.+)$' URL_SETTING = ...
"""unit tests for geonode.upload.files module""" from geonode.tests.base import GeoNodeBaseTestSupport from geonode.upload import files class FilesTestCase(GeoNodeBaseTestSupport): def test_scan_hint_kml_ground_overlay(self): result = files.get_scan_hint(["kml", "other"]) kml_file_type = files....
"""Unit tests for the :mod:`networkx.generators.expanders` module. """ try: import scipy is_scipy_available = True except: is_scipy_available = False import networkx as nx from networkx import adjacency_matrix from networkx import number_of_nodes from networkx.generators.expanders import chordal_cycle_gra...
from __future__ import division from PyQt4 import QtCore, QtGui from vistrails.core.configuration import get_vistrails_configuration, \ get_vistrails_persistent_configuration from vistrails.core.system import systemType, vistrails_root_directory from vistrails.core.utils impor...
from requestcounter import requestcounter from debug import debug # provide the gamemod gui & server list class guiprovider: FILECHECK_INTERVAL = 60*60 # 1h DBGTAG = "guiprovider" DBGTAG_REQUEST = DBGTAG+"/request" DBGTAG_REPLY = DBGTAG+"/reply" LIST_REQUEST = "list" READABLELIST_REQUEST = "readablelist" d...
'''hooks for controlling repository access This hook makes it possible to allow or deny write access to given branches and paths of a repository when receiving incoming changesets via pretxnchangegroup and pretxncommit. The authorization is matched based on the local user name on the system where the hook runs, and n...
import bpy, mathutils from ogre_mesh_exporter.log_manager import LogManager, Message from operator import attrgetter # Mesh export settings class to define how we are going to export the mesh. class MeshExportSettings(): def __init__(self, fixUpAxisToY = True, requireMaterials = True, applyModifiers = False, skeleto...
"""Search API module.""" from search import AtomField from search import Cursor from search import DateField from search import DeleteError from search import DeleteResult from search import Document from search import DOCUMENT_ID_FIELD_NAME from search import Error from search import ExpressionError from search impor...
from oslo_log import log as logging import oslo_messaging from neutron.common import constants as consts from neutron.common import utils from neutron.i18n import _LE from neutron import manager from neutron.plugins.common import constants as service_constants LOG = logging.getLogger(__name__) class MeteringRpcCall...
from mock import patch, Mock, MagicMock from path import Path import pytest import sys # Munge the python path so we can find our hook code d = Path('__file__').parent.abspath() / 'hooks' sys.path.insert(0, d.abspath()) # Import the modules from the hook import install class TestInstallHook(): @patch('install.p...
import netCDF4 import numpy from hamcrest import assert_that, is_ import unittest from cis.cis_main import evaluate_cmd, col_cmd from cis.test.integration.base_integration_test import BaseIntegrationTest from cis.test.integration_test_data import * from cis.parse import parse_args from cis.test.unit.eval.test_calc im...
""" Wrapper for loading templates from "templates" directories in INSTALLED_APPS packages. """ import io from django.core.exceptions import SuspiciousFileOperation from django.template.base import TemplateDoesNotExist from django.template.utils import get_app_template_dirs from django.utils._os import safe_...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('sites', '0001_initial'), ] operations = [ migrations.CreateModel( name='Redirect', fields=[ ...
from __future__ import unicode_literals from operator import attrgetter from django.db import connection from django.test import TestCase, skipIfDBFeature, skipUnlessDBFeature from django.test.utils import override_settings from .models import Country, Restaurant, Pizzeria, State, TwoFields class BulkCreateTests(T...
""" .. dialect:: mysql+gaerdbms :name: Google Cloud SQL :dbapi: rdbms :connectstring: mysql+gaerdbms:///<dbname>?instance=<instancename> :url: https://developers.google.com/appengine/docs/python/cloud-sql/\ developers-guide This dialect is based primarily on the :mod:`.mysql.mysqldb` dialect with ...
#!/usr/bin/env python """ Take a imgapi_images-*.gz manatee table dump and emit a JSON array of images. Usage: gzcat imgapi_images-2014-11-15-00-01-56.gz | ./manatee2images.py > images.json """ import json import sys import operator from pprint import pprint import codecs # TODO: ideally we wouldn't hardcode ...
""" Tools for converting old- to new-style metadata. """ from collections import namedtuple from .pkginfo import read_pkg_info from .util import OrderedDefaultDict try: from collections import OrderedDict except ImportError: OrderedDict = dict import re import os.path import textwrap import pkg_resources impo...
import cloud_detection_new as cloud_detection from matplotlib import pyplot as plt import views from skimage import exposure nir = cloud_detection.get_nir()[0:600,2000:2600] red = cloud_detection.get_red()[0:600,2000:2600] green = cloud_detection.get_green()[0:600,2000:2600] blue = cloud_detection.get_blue()[0:600,200...
''' DDS: DDS image loader ''' __all__ = ('ImageLoaderDDS', ) from kivy.lib.ddsfile import DDSFile from kivy.logger import Logger from kivy.core.image import ImageLoaderBase, ImageData, ImageLoader class ImageLoaderDDS(ImageLoaderBase): @staticmethod def extensions(): return ('dds', ) def load(...
""" This module holds simple classes to convert geospatial values from the database. """ from django.contrib.gis.db.models.fields import GeoSelectFormatMixin from django.contrib.gis.geometry.backend import Geometry from django.contrib.gis.measure import Area, Distance class BaseField(object): empty_strings_allow...
from tempest import config from tempest.lib.common.utils import data_utils from tempest.lib.common.utils import test_utils import tempest.test CONF = config.CONF class BaseIdentityTest(tempest.test.BaseTestCase): @classmethod def setup_credentials(cls): # Create no network resources for these test. ...
# -*- coding: utf-8 -*- """QGIS Unit tests for QgsMessageLog. .. note:: This program 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; either version 2 of the License, or (at your option) any later version. """ __a...
from jsonrpc import ServiceProxy import sys import string import getpass # ===== BEGIN USER SETTINGS ===== # if you do not set these you will be prompted for a password for every command rpcuser = "" rpcpass = "" # ====== END USER SETTINGS ====== if rpcpass == "": access = ServiceProxy("http://127.0.0.1:8332") e...
""" Support for Microsoft face recognition. For more details about this component, please refer to the documentation at https://home-assistant.io/components/microsoft_face/ """ import asyncio import json import logging import aiohttp from aiohttp.hdrs import CONTENT_TYPE import async_timeout import voluptuous as vol ...
import ns.applications import ns.core import ns.csma import ns.internet import ns.mobility import ns.network import ns.olsr import ns.wifi # # # # This function will be used below as a trace sink # # # static void # CourseChangeCallback(std.string path, Ptr<const MobilityModel> model) # { # Vector position = mod...
# -*- coding: utf-8 -*- """ Plot oscilloscope files from MultiSim """ import numpy as np import matplotlib.pyplot as plt import sys import os from matplotlib import rc rc('font',family="Consolas") files=["real_zad5_05f_p2.txt"] for NazwaPliku in files: print NazwaPliku Plik=open(NazwaPliku) #print DeltaT ...
# Wrapper module for waagent # # waagent is not written as a module. This wrapper module is created # to use the waagent code as a module. # # Copyright 2014 Microsoft Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # Y...
""" This module houses the GEOS ctypes prototype functions for the topological operations on geometries. """ __all__ = ['geos_boundary', 'geos_buffer', 'geos_centroid', 'geos_convexhull', 'geos_difference', 'geos_envelope', 'geos_intersection', 'geos_linemerge', 'geos_pointonsurface', 'geos_pre...
"""Fixtures for component.""" from unittest.mock import patch from pyatv import conf, net import pytest from .common import MockPairingHandler, create_conf @pytest.fixture(autouse=True, name="mock_scan") def mock_scan_fixture(): """Mock pyatv.scan.""" with patch("homeassistant.components.apple_tv.config_fl...
import logging import unittest2 as unittest from webkitpy.common.system.filesystem_mock import MockFileSystem from webkitpy.common.system.executive_mock import MockExecutive2 from webkitpy.common.system.outputcapture import OutputCapture from webkitpy.common.system.systemhost_mock import MockSystemHost from webkitpy.p...
"""Utilities for with-statement contexts. See PEP 343.""" import sys from functools import wraps __all__ = ["contextmanager", "nested", "closing"] class GeneratorContextManager(object): """Helper for @contextmanager decorator.""" def __init__(self, gen): self.gen = gen def __enter__(self): ...
#!/usr/bin/env python3 import os import argparse import configparser import logging import sys import logging import subprocess from datetime import datetime from pathlib import Path from Pegasus.api import * logging.basicConfig(level=logging.DEBUG) def parse_args(args=sys.argv[1:]): parser = argparse.ArgumentPa...
from setuptools import setup, find_packages from phonenumber_field import __version__ setup( name="django-phonenumber-field", version=__version__, url='http://github.com/stefanfoulis/django-phonenumber-field', license='BSD', platforms=['OS Independent'], description="An international phone num...
#!/usr/bin/env python """ Get rid of lines containing duplicate copies of the same atom in the "Atoms" section of a LAMMPS data file. Duplicate lines which occur later are preserved and the earlier lines are erased. The file is read from sys.stdin. This program does not parse the entire data file. Th...
from django.contrib.contenttypes import generic from django.contrib.auth.models import User, Group from django.db import models from mezzanine.pages.models import Page, RichText,Displayable from mezzanine.core.fields import FileField, RichTextField from mezzanine.core.models import Ownable from mezzanine.generic.models...
#!/usr/bin/env python from gnuradio import gr from gnuradio import trellis, digital, filter, blocks from gnuradio import eng_notation import math import sys import random import fsm_utils try: from gnuradio import analog except ImportError: sys.stderr.write("Error: Program requires gr-analog.\n") sys.exit...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import cms.models.fields import cms.test_utils.project.placeholderapp.models class Migration(migrations.Migration): dependencies = [ ('cms', '0002_auto_20140816_1918'), ] operations = [ ...
import sys import os.path from pytest import raises from multiconf import mc_config, ConfigItem, ConfigException, MC_REQUIRED from multiconf.envs import EnvFactory from .utils.utils import config_error, next_line_num, replace_ids, lines_in, start_file_line from .utils.messages import already_printed_msg, config_erro...
import unittest from django.contrib.gis.geos.mutable_list import ListMixin from django.utils import six class UserListA(ListMixin): _mytype = tuple def __init__(self, i_list, *args, **kwargs): self._list = self._mytype(i_list) super(UserListA, self).__init__(*args, **kwargs) def __len__...
"""Tests for the raise statement.""" from test import support import sys import types import unittest def get_tb(): try: raise OSError() except: return sys.exc_info()[2] class Context: def __enter__(self): return self def __exit__(self, exc_type, exc_value, exc_tb): ...
import datetime import logging import multiprocessing import os import subprocess import sys import optparse from pylib import android_commands def _ListTombstones(adb): """List the tombstone files on the device. Args: adb: An instance of AndroidCommands. Yields: Tuples of (tombstone filename, date t...
"""SCons.Tool.tar Tool-specific initialization for tar. 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. """ # # __COPYRIGHT__ # # Permission is hereby granted, free of charge, to any person obtaining # a copy of...
""" Copyright (C) 2020 Google Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software di...
#! /usr/bin/env python import sys import ddlib # DeepDive python utility ARR_DELIM = '~^~' # For each input tuple for row in sys.stdin: parts = row.strip().split('\t') if len(parts) != 6: print >>sys.stderr, 'Failed to parse row:', row continue # Get all fields from a row words = parts[0].split(...
"""Fixer for intern(). intern(s) -> sys.intern(s)""" # Local imports from .. import pytree from .. import fixer_base from ..fixer_util import Name, Attr, touch_import class FixIntern(fixer_base.BaseFix): PATTERN = """ power< 'intern' trailer< lpar='(' ( not(arglist | argument...
""" Creates permissions for all installed apps that need permissions. """ from django.contrib.auth import models as auth_app from django.db.models import get_models, signals def _get_permission_codename(action, opts): return u'%s_%s' % (action, opts.object_name.lower()) def _get_all_permissions(opts): "Retu...
#!/usr/bin/env python from __future__ import division, absolute_import, print_function from numpy.testing import * from numpy.distutils.misc_util import appendpath, minrelpath, \ gpaths, get_shared_lib_extension from os.path import join, sep, dirname ajoin = lambda *paths: join(*((sep,)+paths)) class TestAppendp...