content
stringlengths
4
20k
"""Xception Keras application.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from tensorflow.python.keras.applications.xception import decode_predictions from tensorflow.python.keras.applications.xception import preprocess_input from tensorflow.python....
# Zulip, Inc's internal git plugin configuration. # The plugin and example config are under api/integrations/ # Leaving all the instructions out of this file to avoid having to # sync them as we update the comments. ZULIP_USER = "<EMAIL>" ZULIP_API_KEY = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" # commit_notice_destination...
import os import re import sys import unittest from coalib import coala_ci from coalib.misc.ContextManagers import prepare_file from tests.TestUtilities import bear_test_module, execute_coala class coalaCITest(unittest.TestCase): def setUp(self): self.old_argv = sys.argv self.unescaped_coafile =...
#!/usr/bin/env python """ Install bok-choy page objects for acceptance and end-to-end tests. """ import os from setuptools import setup VERSION = '0.0.1' DESCRIPTION = "Bok-choy page objects for edx-platform" # Pip 1.5 will try to install this package from outside # the directory containing setup.py, so we need to ...
__author__ = 'Kondal Rao Komaragiri' import multiprocessing import select import logging import FSM TIMEOUT = 5000 class FsmEngine(object): def __init__(self, dispatch=None, flags=None): self.fsm_object_dict = {} self.dispatch = dispatch self.flags = flags self.logger = None ...
""" Tests for site configuration's django models. """ from django.test import TestCase from django.db import IntegrityError, transaction from django.contrib.sites.models import Site from openedx.core.djangoapps.site_configuration.models import SiteConfigurationHistory from openedx.core.djangoapps.site_configuration.t...
from __future__ import unicode_literals import frappe import frappe.share from frappe import _ from frappe.utils import cstr, now_datetime, cint, flt from erpnext.controllers.status_updater import StatusUpdater class UOMMustBeIntegerError(frappe.ValidationError): pass class TransactionBase(StatusUpdater): def load_n...
ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['stableinterface'], 'supported_by': 'core'} DOCUMENTATION = r''' --- module: win_file version_added: "1.9.2" short_description: Creates, touches or removes files or directories description: - Creates (empty) files, u...
# -*- coding: utf-8 -*- """ 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 3 of the License, or (at your option) any later version. This program is distributed in ...
import select from thread_pool import * from helpers import * class LithiumThreadPoolDispatcher(): """ Dispatches opened sockets into the threadpool """ def __init__(self, server, pair): server.pool.add_task(self.process_input, server, pair) def process_input(self, server, pair): try: ...
from setuptools import setup import codecs import os import re # to release: # python setup.py register sdist bdist_egg upload here = os.path.abspath(os.path.dirname(__file__)) # Read the version number from a source file. # Why read it, and not import? # see https://groups.google.com/d/topic/pypa-dev/0PkjVpcxTzQ/...
class Coroutine: """A simple message-passing coroutine implementation. Not thread- or signal-safe. Usage: def my_iter (plexer, args): some_async_task (..., callback=plexer.send (tokens)) yield None tokens, (data, ) = plexer.receive () ... Coroutine (my_iter, args).begin () """ def __init__ (self,...
from django.utils.translation import ugettext_lazy as _ import horizon from openstack_dashboard.api import keystone class Domains(horizon.Panel): name = _("Domains") slug = 'domains' policy_rules = (("identity", "identity:get_domain"), ("identity", "identity:list_domains")) @sta...
import pprint import os import re import sys import stat import time import json import hmac import shutil import string import pycurl import random import base64 import urllib import datetime import hashlib import StringIO import tempfile import calendar import vcycle.vacutils class Ec2Error(Exception): pass cla...
import logging from .enums import MachineState class CodingStateMachine(object): """ A state machine to verify a byte sequence for a particular encoding. For each byte the detector receives, it will feed that byte to every active state machine available, one byte at a time. The state machine...
""" Serial Port Protocol """ # system imports import os, errno # dependent on pyserial ( http://pyserial.sf.net/ ) # only tested w/ 1.18 (5 Dec 2002) import serial from serial import PARITY_NONE, PARITY_EVEN, PARITY_ODD from serial import STOPBITS_ONE, STOPBITS_TWO from serial import FIVEBITS, SIXBITS, SEVENBITS, EIG...
import struct import dns.rdata import dns.rdatatype class DSBase(dns.rdata.Rdata): """Base class for rdata that is like a DS record @ivar key_tag: the key tag @type key_tag: int @ivar algorithm: the algorithm @type algorithm: int @ivar digest_type: the digest type @type digest_type: int ...
""" pytest local configuration plug-in """ import gc import warnings import pytest @pytest.yield_fixture(scope='function', autouse=True) def error_on_ResourceWarning(): """This fixture captures ResourceWarning's and reports an "error" describing the file handles left open. This is show...
from miscellaneous.decorators import update_paths from objects.objects import node_subtype, link_class from os.path import join from PyQt5.QtWidgets import ( QFileDialog, QGridLayout, QLabel, QLineEdit,...
from . import ( res_partner, )
""" switch.py ========= Light up some leds when the USR switch on the pyboard is pressed. Example Usage:: Micro Python v1.0.1 on 2014-05-12; PYBv1.0 with STM32F405RG Type "help()" for more information. >>> import switch >>> switch.run_loop() Loop started. Press Ctrl+C to break out of the loop...
"""Fixer that changes map(F, ...) into list(map(F, ...)) unless there exists a 'from future_builtins import map' statement in the top-level namespace. As a special case, map(None, X) is changed into list(X). (This is necessary because the semantics are changed in this case -- the new map(None, X) is equivalent to [(x...
from __future__ import unicode_literals from django.db import models from django.test import SimpleTestCase, override_settings from django.utils import six class FieldDeconstructionTests(SimpleTestCase): """ Tests the deconstruct() method on all core fields. """ def test_name(self): """ ...
"""Read genome build configurations from Galaxy *.loc and bcbio-nextgen resource files. """ from six.moves import configparser import glob import os import sys from xml.etree import ElementTree import toolz as tz import yaml from bcbio import utils from bcbio.cwl import cwlutils from bcbio.distributed import objectst...
""" The configuration classes and routines in yum are splattered over too many places, hard to change and debug. The new structure here will replace that. Its goal is to: * accept configuration options from all three sources (the main config file, repo config files, command line switches) * handle all the logic of s...
from sympy.physics.mechanics import (dynamicsymbols, ReferenceFrame, Point, RigidBody, LagrangesMethod, Particle, inertia, Lagrangian) from sympy import symbols, pi, sin, cos, tan, simplify, Function, \ Derivative, Matrix def test_disc_on...
from turbogears import validators #the shiny validator part class WidgetSchemaFactory(object): """ The purpose of the class is to produce a validators.Schema object according to method arguments that are retrieved from minions """ def __init__(self,method_argument_dict): """ @p...
from __future__ import unicode_literals import frappe, unittest from frappe.core.doctype.data_export import exporter from frappe.core.doctype.data_import import importer from frappe.utils.csvutils import read_csv_content class TestDataImport(unittest.TestCase): def test_export(self): exporter.export_data("User", a...
#!/usr/bin/env python ''' fit best estimate of magnetometer rotation to GPS data ''' import sys, time, os, math from argparse import ArgumentParser parser = ArgumentParser(description=__doc__) parser.add_argument("--no-timestamps",dest="notimestamps", action='store_true', help="Log doesn't have timestamps") parser.a...
ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['stableinterface'], 'supported_by': 'core'} from ansible.module_utils.basic import AnsibleModule def main(): module = AnsibleModule( argument_spec=dict( data=dict(required=False, default=None), ...
import pwd import grp import spwd import operator import re import os import csv import time line_open = '<tr><td>' line_mid = '</td><td>' line_close = '</td></tr>\n' xmlfilename = str(os.uname()[1].split(".")[0]) + "_UserGroupList_" + str(time.strftime("%Y%m%d")) + ".xml" #builds the filename with the hostname, t...
"""Unit tests for the PipelineRunner and DirectRunner classes. Note that PipelineRunner and DirectRunner functionality is tested in all the other unit tests. In this file we choose to test only aspects related to caching and clearing values that are not tested elsewhere. """ import unittest import hamcrest as hc im...
{ 'name': 'Drop Shipping', 'version': '1.0', 'category': 'Warehouse Management', 'summary': 'Drop Shipping', 'description': """ Manage drop shipping orders =========================== This module adds a pre-configured Drop Shipping picking type as well as a procurement route that allow configuring ...
from django.core.management.base import BaseCommand, CommandError from driver27.models import Result import csv class Command(BaseCommand): help = 'Update results via csv' @staticmethod def _create_result(row): invalid_keywords = [] result_fields = [f.column for f in Result._meta.get_fiel...
"""Generate a C++ header from ibus_input_methods.txt. This program generates a C++ header file containing the information on available input methods. It parses input_methods.txt, and then generates a static array definition from the information extracted. The input and output file names are specified on the command l...
from __future__ import unicode_literals import re import json from .common import InfoExtractor from ..utils import ( int_or_none, js_to_json, qualities, ) class PornHdIE(InfoExtractor): _VALID_URL = r'http://(?:www\.)?pornhd\.com/(?:[a-z]{2,4}/)?videos/(?P<id>\d+)(?:/(?P<display_id>.+))?' _TEST...
"""ExportStrategy class represents different flavors of model export.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import collections from tensorflow.python.util import tf_inspect __all__ = ['ExportStrategy'] class ExportStrategy( collections....
import os from django.conf import settings CAPTCHA_FONT_PATH = getattr(settings, 'CAPTCHA_FONT_PATH', os.path.normpath(os.path.join(os.path.dirname(__file__), '..', 'fonts/Vera.ttf'))) CAPTCHA_FONT_SIZE = getattr(settings, 'CAPTCHA_FONT_SIZE', 22) CAPTCHA_LETTER_ROTATION = getattr(settings, 'CAPTCHA_LETTER_ROTATION',...
# -*- coding: utf-8 -*- from __future__ import print_function from __future__ import unicode_literals from __future__ import division import dateutil.parser from rest_framework import decorators from rest_framework.exceptions import ValidationError, ParseError from rest_framework.permissions import AllowAny from rest_...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'core'} # FIXME: standardize into module_common from traceback import format_exc from ansible.module_util...
""" from https://github.com/keithito/tacotron Modifed to add support for time and slight tweaks to _expand_number """ import inflect import re _inflect = inflect.engine() _comma_number_re = re.compile(r'([0-9][0-9\,]+[0-9])') _decimal_number_re = re.compile(r'([0-9]+\.[0-9]+)') _pounds_re = re.compile(r'£([0-9\,]*[...
import sys sys.path.insert(1, "../../") import h2o def levels_nlevels_setlevel_setLevels_test(ip,port): iris = h2o.import_file(path=h2o.locate("smalldata/iris/iris.csv")) # frame (default) levels = iris.levels() nlevels = iris.nlevels() # frame (w/ index) levels = iris.levels(col=...
# coding: utf-8 from __future__ import unicode_literals import re from .common import InfoExtractor from ..utils import ( int_or_none, parse_iso8601, xpath_with_ns, xpath_text, find_xpath_attr, ) class XstreamIE(InfoExtractor): _VALID_URL = r'''(?x) (?: ...
from datetime import datetime from sqlalchemy.orm import deferred from sqlalchemy import Column, Integer, DateTime, Sequence, String, event from aquilon.aqdb.model import Base, SingleInstanceMixin _TN = 'host_environment' class HostEnvironment(SingleInstanceMixin, Base): """ Describes the state a host is withi...
ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} import traceback try: import ovirtsdk4.types as otypes except ImportError: pass from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.ovirt impo...
"""Call BibFormat engine and create HTML brief (and other) formats for bibliographic records. Upload formats via BibUpload.""" __revision__ = "$Id$" import sys try: from invenio.dbquery import run_sql from invenio.config import \ CFG_SITE_URL,\ CFG_TMPDIR,\ CFG_BINDIR from...
#!/usr/bin/env python """ Generate a cache of all the ComputerVision highlevelfeatures to send to Pylearn2 """ from __future__ import division import neukrill_net.augment import neukrill_net.highlevelfeatures import neukrill_net.utils import copy import numpy as np from sklearn.externals import joblib # Define outpu...
#!/usr/bin/python from __future__ import (absolute_import, division, print_function) # Copyright 2019 Fortinet, Inc. # # 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 3 of the Lic...
import yaml import logging class YamlTag(object): """ Superclass for constructors of custom tags defined in yaml file. __str__ is overriden in subclass and used for serialization in module recorder. """ def __init__(self, **kwargs): self.__dict__.update(kwargs) def __getitem__(self, key...
"""Functions for downloading and reading MNIST data.""" from __future__ import print_function import gzip import os import urllib import numpy SOURCE_URL = 'http://yann.lecun.com/exdb/mnist/' def maybe_download(filename, work_directory): """Download the data from Yann's website, unless it's already here.""" if not ...
import datetime import pytz from django.contrib.auth.decorators import login_required from django.http import HttpResponse from django.shortcuts import redirect from django_future.csrf import ensure_csrf_cookie from edxmako.shortcuts import render_to_response from track import tracker from track import contexts fr...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'certified'} DOCUMENTATION = r''' --- module: bigip_dns_nameserver short_description: Manage LTM DNS name...
import hashlib import os def generate_hash(f, cs=128): return __generate_hash__(f, cs) \ if os.path.isfile(f) \ else __generate_hash_path__(f, cs) def __generate_hash__(f, cs=128): hash = hashlib.md5() with open(f, "rb") as file: for chunk in iter(lambda: file.read(cs), b''): ...
EDUPERSON_OID = "urn:oid:1.3.6.1.4.1.5923.1.1.1." X500ATTR = "urn:oid:2.5.4." NOREDUPERSON_OID = "urn:oid:1.3.6.1.4.1.2428.90.1." NETSCAPE_LDAP = "urn:oid:2.16.840.1.113730.3.1." UCL_DIR_PILOT = "urn:oid:0.9.2342.19200300.100.1." PKCS_9 = "urn:oid:1.2.840.113549.1.9." UMICH = "urn:oid:1.3.6.1.4.1.250.1.57." MAP = { ...
{ 'name': 'Contracts Management', 'version': '1.1', 'category': 'Sales Management', 'description': """ This module is for modifying account analytic view to show important data to project manager of services companies. =====================================================================================...
""" An example demonstrating bisecting k-means clustering. Run with: bin/spark-submit examples/src/main/python/ml/bisecting_k_means_example.py """ # $example on$ from pyspark.ml.clustering import BisectingKMeans from pyspark.ml.evaluation import ClusteringEvaluator # $example off$ from pyspark.sql import SparkSession...
import BoostBuild import os t = BoostBuild.Tester("--build-system=project-test1", boost_build_path='', pass_toolset=0) # This test does no modifications, so run in in the invocation dir. os.chdir(t.original_workdir) expected_output1="""Project Roots: """ expected_output2="""'%(root-dir-prefix)sdir2': Module...
""" Script for exporting courseware from Mongo to a tar.gz file """ import os from django.core.management.base import BaseCommand, CommandError from xmodule.modulestore.xml_exporter import export_course_to_xml from xmodule.modulestore.django import modulestore from opaque_keys.edx.keys import CourseKey from xmodule.co...
import os import glob import logging import pprint from virtualenvapi.manage import VirtualEnvironment import virtualenvapi.exceptions as ve from pyp2rpm.exceptions import VirtualenvFailException from pyp2rpm.settings import DEFAULT_PYTHON_VERSION, MODULE_SUFFIXES logger = logging.getLogger(__name__) def site_pack...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type from functools import partial import types try: import netaddr except ImportError: # in this case, we'll make the filters return error messages (see bottom) netaddr = None else: class mac_linux(netaddr.mac_unix): ...
from django.db.backends import BaseDatabaseValidation class DatabaseValidation(BaseDatabaseValidation): def validate_field(self, errors, opts, f): """ There are some field length restrictions for MySQL: - Prior to version 5.0.3, character fields could not exceed 255 characters in...
from ansible import utils from ansible.errors import AnsibleError import ansible.constants as C import os import os.path class Connection(object): ''' Handles abstract connections to remote hosts ''' def __init__(self, runner): self.runner = runner def connect(self, host, port, user, password, t...
#! /usr/bin/env python #coding=utf-8 import logging, json import data import config import datetime class OperateAppStaticInfor: ''' 类功能:通过操作audit_static_infor数据,实现apk静态信息的保存 ''' @staticmethod def SearchFileInforFromTaskTable(fileMd5): ''' 函数功能:以文件的md5值为关键字,是否有该apk文件 ...
from __future__ import (absolute_import, division, generators, nested_scopes, print_function, unicode_literals, with_statement) import codecs import os import re from pkg_resources import resource_string from pygments.formatters.html import HtmlFormatter from pygments.styles import get_all_sty...
""" Settings for Bok Choy tests that are used when running Studio. Bok Choy uses two different settings files: 1. test_static_optimized is used when invoking collectstatic 2. bok_choy is used when running the tests Note: it isn't possible to have a single settings file, because Django doesn't support both generating ...
from __future__ import print_function from functools import partial import numpy as np import paddle.fluid as fluid import paddle.fluid.layers as layers pos_enc_param_names = ( "src_pos_enc_table", "trg_pos_enc_table", ) batch_size = 2 def position_encoding_init(n_position, d_pos_vec): """ Generat...
import re class LogFileParser(object): def __init__(self, log_file_obj, message_pattern, message_factory=dict, content_group_name='content'): self.log_file = log_file_obj self.message_pattern = message_pattern self.message_factory = message_factory self.content_group_name = conten...
""" Wrapper for loading templates from a plain Python dict. """ import warnings from django.template import Origin, TemplateDoesNotExist from django.utils.deprecation import RemovedInDjango20Warning from .base import Loader as BaseLoader class Loader(BaseLoader): def __init__(self, engine, templates_dict): ...
import base64 import logging import urlparse from integration_tests import chrome_proxy_metrics as metrics from metrics import loading from telemetry.core import exceptions from telemetry.page import page_test class ChromeProxyLatency(page_test.PageTest): """Chrome proxy latency measurement.""" def __init__(sel...
""" ======================== Partial Dependence Plots ======================== Partial dependence plots show the dependence between the target function [2]_ and a set of 'target' features, marginalizing over the values of all other features (the complement features). Due to the limits of human perception the size of t...
from setuptools import setup, find_packages import os # The version of the wrapped library is the starting point for the # version number of the python package. # In bugfix releases of the python package, add a '-' suffix and an # incrementing integer. # For example, a packaging bugfix release version 1.4.4 of the # j...
# -*- coding: utf-8 -*- """ /*************************************************************************** Name : DB Manager Description : Database manager plugin for QGIS Date : May 23, 2011 copyright : (C) 2011 by Giuseppe Sucameli email : <EMAIL> **...
""" Utility functions TODO: write more documentation """ __docformat__ = 'restructedtext en' __authors__ = ("Razvan Pascanu " "KyungHyun Cho " "Caglar Gulcehre ") __contact__ = "Razvan Pascanu <r.pascanu@gmail>" import numpy import random import string import copy as pycopy import thea...
"""Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as _reflection from google.protobuf import symbol_database as _symbol_database _sym_db = _symbol_database.Default() from google.appengine...
# -*- encoding: utf-8 -*- from __future__ import unicode_literals import warnings from django.db import models class People(models.Model): name = models.CharField(max_length=255) parent = models.ForeignKey('self') class Message(models.Model): from_field = models.ForeignKey(People, db_column='from_id') ...
# -*- coding: utf-8 -*- from .structures import LookupDict _codes = { # Informational. 100: ('continue',), 101: ('switching_protocols',), 102: ('processing',), 103: ('checkpoint',), 122: ('uri_too_long', 'request_uri_too_long'), 200: ('ok', 'okay', 'all_ok', 'all_okay', 'all_good', '\\o/'...
''' (*)~--------------------------------------------------------------------------- Pupil - eye tracking platform Copyright (C) 2012-2017 Pupil Labs Distributed under the terms of the GNU Lesser General Public License (LGPL v3.0). See COPYING and COPYING.LESSER for license details. -----------------------------------...
""" Testing for Theil-Sen module (sklearn.linear_model.theil_sen) """ # License: BSD 3 clause from __future__ import division, print_function, absolute_import import os import sys from contextlib import contextmanager import numpy as np from numpy.testing import assert_array_equal, assert_array_less from numpy.testi...
# -*- coding: utf-8 -*- try: # Python 2.7 from collections import OrderedDict except: # Python 2.6 from gluon.contrib.simplejson.ordered_dict import OrderedDict from gluon import current from gluon.storage import Storage def config(settings): """ Template settings for an Incident Response...
# -*- coding: utf-8 -*- """ pygments.lexers.actionscript ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Lexers for ActionScript and MXML. :copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import re from pygments.lexer import RegexLexer, bygroups, using,...
import sys from unittest import TestCase import simplejson as json import simplejson.decoder from simplejson.compat import b, PY3 class TestScanString(TestCase): # The bytes type is intentionally not used in most of these tests # under Python 3 because the decoder immediately coerces to str before # calli...
# coding=utf-8 from tvdb_api.tvdb_api import Tvdb from sickbeard import helpers initConfig = { 'valid_languages': [ "da", "fi", "nl", "de", "it", "es", "fr", "pl", "hu", "el", "tr", "ru", "he", "ja", "pt", "zh", "cs", "sl", "hr", "ko", "en", "sv", "no" ], 'langabbv_to_id': { 'el': ...
import os import shutil import unittest import imath import tempfile import IECore import IECoreScene import IECoreAlembic class Timer( object ) : def __init__( self, name) : self.name = name self.timer = IECore.Timer( False, IECore.Timer.WallClock ) def __enter__( self ) : self.timer.start() return self...
""" Tests for Dates Tab API in the Course Home API """ import ddt from django.urls import reverse from course_modes.models import CourseMode from lms.djangoapps.course_home_api.tests.utils import BaseCourseHomeTests from student.models import CourseEnrollment @ddt.ddt class DatesTabTestViews(BaseCourseHomeTests):...
#!/usr/bin/env python # -*- coding: utf-8 -*- from runner.koan import * class AboutExceptions(Koan): class MySpecialError(RuntimeError): pass def test_exceptions_inherit_from_exception(self): mro = self.MySpecialError.__mro__ self.assertEqual(__, mro[1].__name__) self.assert...
"""Helper functions for training and constructing time series Models.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import re import numpy from tensorflow.contrib.framework.python.ops import variables from tensorflow.contrib.layers.python.layers impo...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} import time from ansible.module_utils.azure_rm_common import AzureRMModuleBase try: fr...
#!/usr/bin/python """ Generate all parsers from PyX12-1.5.0.zip Example Usage: python generate_all_parsers.py ../../Downloads/pyx12-1.5.0.zip """ import argparse import fnmatch import logging import os import sys import zipfile from tigershark.tools import convertPyX12 def convert_from_zip(zip_file_path, dest_p...
'''SSL with SNI_-support for Python 2. Follow these instructions if you would like to verify SSL certificates in Python 2. Note, the default libraries do *not* do certificate checking; you need to do additional work to validate certificates yourself. This needs the following packages installed: * pyOpenSSL (tested wi...
from django import http from django.contrib.auth.models import Permission from django.contrib.sites.requests import RequestSite from django.db import transaction from django.views.decorators.http import require_POST from django.shortcuts import render, get_object_or_404, redirect from crashstats.crashstats.decorators ...
import psycopg2 import logging from openerp.osv import orm from openerp.tools.float_utils import float_compare _logger = logging.getLogger(__name__) def _format_inserts_values(vals): cols = vals.keys() if 'line_id' in cols: cols.remove('line_id') return (', '.join(cols), ', '.join(['%%(%s)s' % i f...
import argparse import sys import time from .btc import encoder, decoder, error, list_to_dict, dict_to_list, client _description = 'remove torrent' def main(): parser = argparse.ArgumentParser() parser.add_argument('-d', '--drop-data', default=False, action="store_true") parser.add_argument('-k', '--keep-...
""" ui model signals """ # pylint: disable=unused-argument from django.conf import settings from django.db.models.signals import pre_delete, post_save from django.dispatch import receiver from django.contrib.auth.signals import user_logged_out from cloudsync.tasks import remove_youtube_video, remove_youtube_caption fr...
from __future__ import print_function import unittest from robot.output.listeners import Listeners, LibraryListeners from robot.output import LOGGER from robot.utils.asserts import * from robot.utils import JYTHON from robot.running.outputcapture import OutputCapturer LOGGER.unregister_console_logger() class Mock...
import RPi.GPIO as GPIO import time import sys GPIO.setmode(GPIO.BOARD) class SPI_Master(): def __init__(self, CLK, MISO, MOSI, CS, freq=1000): self.CLK = CLK # Clock self.MISO = MISO # Master out, slave in self. MOSI = MOSI # Master in, slave out self.CS = ...
# -*- coding: utf-8 -*- """ EDACC Web Frontend Tests ------------------------ Unit tests of web frontend functions. :copyright: (c) 2010 by Daniel Diepold. :license: MIT, see LICENSE for details. """ import unittest import struct from edacc.tests import fixtures from edacc import config TEST_DA...
import BaseHTTPServer from thrift.server import TServer from thrift.transport import TTransport class ResponseException(Exception): """Allows handlers to override the HTTP response Normally, THttpServer always sends a 200 response. If a handler wants to override this behavior (e.g., to simulate a misconfigur...
""" filters.py - misc stuff for handling LDAP filter strings (see RFC2254) See http://www.python-ldap.org/ for details. \$Id: filter.py,v 1.9 2011/07/22 07:20:53 stroeder Exp $ Compability: - Tested with Python 2.0+ """ import six def escape_filter_chars(assertion_value, escape_mode=0): """ Replace all spe...
from __future__ import absolute_import from __future__ import print_function from typing import Any from argparse import ArgumentParser from django.core.management.base import BaseCommand from zerver.models import get_realm, Realm import sys class Command(BaseCommand): help = """Show the admins in a realm.""" ...
import types import urllib import locale import datetime import codecs from decimal import Decimal from django.utils.functional import Promise class DjangoUnicodeDecodeError(UnicodeDecodeError): def __init__(self, obj, *args): self.obj = obj UnicodeDecodeError.__init__(self, *args) def __str_...