content
stringlengths
4
20k
from __future__ import unicode_literals import keyword import re from collections import OrderedDict from django.core.management.base import BaseCommand, CommandError from django.db import DEFAULT_DB_ALIAS, connections from django.db.models.constants import LOOKUP_SEP from django.utils.encoding import force_text cl...
import mxnet as mx def save_checkpoint(prefix, epoch, arg_params, aux_params): """Checkpoint the model data into file. :param prefix: Prefix of model name. :param epoch: The epoch number of the model. :param arg_params: dict of str to NDArray Model parameter, dict of name to NDArray of net's w...
"""`ReaderSource` produces `Tensor`s of keys and values using a `tf.Reader`.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from tensorflow.contrib.learn.python.learn.dataframe import transform from tensorflow.python.ops import io_ops from tensorflow.py...
import torch from .module import Module from .. import functional as F class PairwiseDistance(Module): r""" Computes the batchwise pairwise distance between vectors v1,v2: .. math :: \Vert x \Vert _p := \left( \sum_{i=1}^n \vert x_i \vert ^ p \right) ^ {1/p} Args: x ...
import sys from Ledart.ArgumentParser import get_args try: from PygameController import PygameController, PygameDummyController except Exception as e: print("pygamecontroller>> " + str(e)) def translate(value, leftmin, leftmax, rightmin, rightmax): leftspan = leftmax - leftmin rightspan = rightmax - ...
import math import hashlib import bisect import unittest def key_to_digest(key): return hashlib.md5(key).hexdigest() def point_from_hex(s): return long(s[6:8] + s[4:6] + s[2:4] + s[0:2], 16) def hashi(key): return point_from_hex(key_to_digest(key)[0:8]) def get_server(key, continuum): """maps given ...
import sys, os, shutil from distutils.core import setup, Extension shutil.copyfile("sslstrip.py", "sslstrip/sslstrip") setup (name = 'sslstrip', version = '0.9', description = 'A MITM tool that implements Moxie Marlinspike\'s HTTPS stripping attacks.', author = 'Moxie Marlinspike'...
from __future__ import absolute_import, division, print_function, unicode_literals from pants_test.task_test_base import TaskTestBase from pants.contrib.go.tasks.go_task import GoTask class ImportOracleTest(TaskTestBase): class ImportTask(GoTask): def execute(self): raise NotImplementedError() @clas...
RATE_48000 = 48000 RATE_44100 = 44100 RATE_32000 = 32000 RATE_22050 = 22050 RATE_16000 = 16000 RATE_11025 = 11025 RATE_8000 = 8000 SAMPFMT_TWOSCOMP= 1 SAMPFMT_FLOAT = 32 SAMPFMT_DOUBLE = 64 SAMPLE_8 = 1 SAMPLE_16 = 2 # SAMPLE_24 is the low 24 bits of a long,...
import babel.dates import email.utils import jinja2 from pyramid.threadlocal import get_current_request @jinja2.contextfilter def format_date(ctx, *args, **kwargs): request = ctx.get("request") or get_current_request() kwargs.setdefault("locale", request.locale) return babel.dates.format_date(*args, **kw...
import Gaffer import GafferUI import GafferArnold def __samplingSummary( plug ) : info = [] if plug["aaSamples"]["enabled"].getValue() : info.append( "AA %d" % plug["aaSamples"]["value"].getValue() ) if plug["giDiffuseSamples"]["enabled"].getValue() : info.append( "Diffuse %d" % plug["giDiffuseSamples"]["value...
from django.contrib.auth import get_user_model from django.contrib.sites.models import Site from django.core import mail from django.urls import reverse from django.test import TestCase from django.test.client import Client from helpdesk.models import Queue, Ticket, FollowUp from helpdesk import settings as helpdesk_se...
"""Support for UK Met Office weather service.""" from homeassistant.components.weather import WeatherEntity from homeassistant.const import LENGTH_KILOMETERS, TEMP_CELSIUS from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.typing import ConfigType from .const import ( ATTRIBUTION, ...
from msrest import Serializer, Deserializer from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azur...
import unittest import numpy as np from pymatgen.util.testing import PymatgenTest from pymatgen.analysis.nmr import ChemicalShielding, ElectricFieldGradient class TestChemicalShieldingNotation(PymatgenTest): def test_construction(self): cs = ChemicalShielding(np.arange(9).reshape((3, 3))) self.as...
from __future__ import unicode_literals from functools import partial from django.contrib.admin.checks import InlineModelAdminChecks from django.contrib.admin.options import InlineModelAdmin, flatten_fieldsets from django.contrib.contenttypes.fields import GenericForeignKey from django.contrib.contenttypes.forms impo...
import threading import select import time import utils import global_var as g from xlog import getLogger xlog = getLogger("smart_router") class Buf(object): def __init__(self): self.buf = [] self.size = 0 self.num = 0 def add(self, data): self.buf.append(data) self....
""" ====================================================== Imputing missing values before building an estimator ====================================================== This example shows that imputing the missing values can give better results than discarding the samples containing any missing value. Imputing does not ...
import random import tempfile import os class TestFile(): def __init__(self, size, debug=False, random_data=True): self._temp_file = tempfile.NamedTemporaryFile(delete=False) self._full_filename = self._temp_file.name self._file_path = os.path.dirname(self._full_filename) self._fi...
import unittest from mixbox.vendor.six import StringIO import sdv import sdv.errors as errors from sdv.validators.stix.profile import InstanceMapping STIX_NO_VERSION_XML = \ """ <stix:STIX_Package xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:stix="http://stix.mitre.org/stix-1" > <stix:S...
"""Generic (shallow and deep) copying operations. Interface summary: import copy x = copy.copy(y) # make a shallow copy of y x = copy.deepcopy(y) # make a deep copy of y For module specific errors, copy.Error is raised. The difference between shallow and deep copying is only relev...
"""Integration tests for mv command.""" from __future__ import absolute_import import os import crcmod from gslib.cs_api_map import ApiSelector from gslib.tests.test_cp import TestCpMvPOSIXBucketToLocalErrors from gslib.tests.test_cp import TestCpMvPOSIXBucketToLocalNoErrors from gslib.tests.test_cp import TestCpMvP...
# -*- coding: utf-8 -*- from nfe.pysped.xml_sped import * from nfe.pysped.nfe.manual_401 import ESQUEMA_ATUAL import os DIRNAME = os.path.dirname(__file__) class InfEventoEnviado(XMLNFe): def __init__(self): super(InfEventoEnviado, self).__init__() self.Id = TagCaracter(nome=u'infEvento', co...
''' Valence Virtual Orbitals ref. 10.1021/acs.jctc.7b00493 ''' import numpy import scipy.linalg from pyscf.lo import iao from pyscf.lo import orth from pyscf.lo import ibo from pyscf import __config__ def vvo(mol, orbocc, orbvirt, iaos=None, s=None, verbose=None): '''Valence Virtual Orbitals ref. 10.1021/acs.jct...
from openerp import fields, models, api, exceptions, _ class WizSplitProduction(models.TransientModel): _name = 'wiz.split.production' _description = 'Wizard split production' product_qty = fields.Integer('Quantity to produce', readonly=True) capacity_min = fields.Integer('Capacity min.', readonly=Tr...
from __future__ import absolute_import, division, unicode_literals from six import text_type, string_types import gettext _ = gettext.gettext from xml.dom import Node DOCUMENT = Node.DOCUMENT_NODE DOCTYPE = Node.DOCUMENT_TYPE_NODE TEXT = Node.TEXT_NODE ELEMENT = Node.ELEMENT_NODE COMMENT = Node.COMMENT_NODE ENTITY =...
import compiler import dis import types def extract_code_objects(co): l = [co] for const in co.co_consts: if type(const) == types.CodeType: l.append(const) return l def compare(a, b): if not (a.co_name == "?" or a.co_name.startswith('<lambda')): assert a.co_name == b.co_nam...
''' Definitions needed for events. See :ref:`Events` for info on how to use it.''' class Event(object): # TODO nice descriptive subclasses of Event instead of strings? pass their instances to the callback instead of an undocumented arg list? DEPENDENCY_DISCOVERED = "event.core.dependency.discovered" # trigge...
import functools import logging import simplejson import werkzeug.utils from werkzeug.exceptions import BadRequest import openerp from openerp import SUPERUSER_ID import openerp.addons.web.http as oeweb from openerp.addons.web.controllers.main import db_monodb, set_cookie_and_redirect, login_and_redirect from openerp...
"""Manages GO group headers and optionally sections containing GO group headers.""" import collections as cx from goatools.gosubdag.go_tasks import chk_goids __copyright__ = "Copyright (C) 2016-2017, DV Klopfenstein, H Tang, All rights reserved." __author__ = "DV Klopfenstein" class HdrgosSections(object): """M...
""" Nova Auth Middleware. """ import webob.dec import webob.exc from nova import context from nova import flags from nova import wsgi FLAGS = flags.FLAGS flags.DECLARE('use_forwarded_for', 'nova.api.auth') class NovaKeystoneContext(wsgi.Middleware): """Make a request context from keystone headers""" @we...
from configman import Namespace from socorro.external import MissingArgumentError, BadArgumentError from socorro.external.postgresql.service_base import ( PostgreSQLWebServiceBase ) from socorro.lib import external_common #============================================================================== class Bugs(...
import csv import numpy from keras.layers import Dense, Input from keras.models import Model, Sequential import matplotlib.pyplot as plt reader = csv.reader(open("track1489492822.csv", "r"), delimiter = ",") l = list(reader) x_train = [] x_res = [] y_train = [] y_res = [] for i in l[1:]: x_train.append(i[4]) x_r...
import json import copy from util.json_request import JsonResponse from django.http import HttpResponseBadRequest from django.contrib.auth.decorators import login_required from django.views.decorators.http import require_http_methods from django_future.csrf import ensure_csrf_cookie from edxmako.shortcuts import rende...
from StringIO import StringIO from unittest import TestCase from django.conf import settings from pyazure.storage import BlobStorage from pyazure.tests.utils import clear_storage class SaveTestCase(TestCase): def setUp(self): self.blob = BlobStorage(settings.AZURE_FILES['account_name'], ...
from __future__ import unicode_literals, division, absolute_import import logging from flexget import plugin from flexget.event import event log = logging.getLogger('urlrewrite_redirect') class UrlRewriteRedirect(object): """Rewrites urls which actually redirect somewhere else.""" def __init__(self): ...
from LogAnalyzer import Test,TestResult import DataflashLog import collections class TestPitchRollCoupling(Test): '''test for divergence between input and output pitch/roll, i.e. mechanical failure or bad PID tuning''' # TODO: currently we're only checking for roll/pitch outside of max lean angle, will come ...
import logging import pytest from copy import copy from tests.common.impala_test_suite import ImpalaTestSuite from tests.common.test_vector import * from tests.common.test_dimensions import create_exec_option_dimension from tests.common.test_dimensions import create_uncompressed_text_dimension # Tests very deep expres...
import frappe from frappe.website.utils import find_first_image from frappe.utils import cstr import re def execute(): item_details = frappe._dict() for d in frappe.db.sql("select name, description, image from `tabItem`", as_dict=1): description = cstr(d.description).strip() item_details.setdefault(d.name, frapp...
""" Author: Junxiu Liu @ CPU Verification Platform Group Email: <EMAIL> Description: pj leda sub cmd entrence """ import os import re import shutil import subprocess import pcom import env_booter import filelst_gen LOG = pcom.gen_logger(__name__) class LedaProc(object): """leda flow processor for pj""" def _...
from flask import render_template, flash, redirect, url_for from app import app, db from models import Aggregate, Day, Hours, Statistics, Predictions from bitcoin import consolidate import json @app.route('/') @app.route('/index') def index(): consolidate() # List of Dictionaries of points for the graph ...
import copy import logging import os from collections import defaultdict, Mapping from six import integer_types, iteritems, itervalues, string_types from . import sslutils from .utils import get_port _renamed_props = { "host": "browser_host", "bind_hostname": "bind_address", "external_host": "server_hos...
import os import mxnet as mx from common import models import pickle as pkl def test_attr_basic(): with mx.AttrScope(group='4', data='great'): data = mx.symbol.Variable('data', attr={'dtype':'data', 'group': '1', ...
""" These are tests for disabling and enabling student accounts, and for making sure that students with disabled accounts are unable to access the courseware. """ import unittest from student.tests.factories import UserFactory, UserStandingFactory from student.models import UserStanding from django.conf import setting...
""" Support for Elasticsearch (1.0.0 or newer). Provides an :class:`ElasticsearchTarget` and a :class:`CopyToIndex` template task. Modeled after :class:`luigi.contrib.rdbms.CopyToTable`. A minimal example (assuming elasticsearch is running on localhost:9200): .. code-block:: python class ExampleIndex(CopyToInd...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations from django.conf import settings class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ migrations.Create...
"""Support for interface with an LG webOS Smart TV.""" import asyncio from datetime import timedelta from functools import wraps import logging from aiopylgtv import PyLGTVCmdException, PyLGTVPairException, WebOsClient from websockets.exceptions import ConnectionClosed from homeassistant import util from homeassistan...
import numpy as np import scipy as sp def to_categorical(y, nb_classes=None): '''Convert class vector (integers from 0 to nb_classes) to binary class matrix, for use with categorical_crossentropy ''' y = np.asarray(y, dtype='int32') if not nb_classes: nb_classes = np.max(y)+1 Y = np.zer...
from sys import exit try: import setuptools except: from sys import stdout stdout.write(''' setuptools not found. Please install it. On linux, the package is often called python-setuptools\n''') exit(1) exec(compile(open('jug/jug_version.py').read(), 'jug/jug_version.py', 'exec')) long_description = o...
#! /usr/bin/env python """Remote CVS -- command line interface""" # XXX To do: # # Bugs: # - if the remote file is deleted, "rcvs update" will fail # # Functionality: # - cvs rm # - descend into directories (alraedy done for update) # - conflict resolution # - other relevant commands? # - branches # # - Finesses: # -...
import handlers from django.conf.urls import * from treeio.core.api.auth import auth_engine from treeio.core.api.doc import documentation_view from treeio.core.api.resource import CsrfExemptResource ad = {'authentication': auth_engine} # documents resources folderResource = CsrfExemptResource(handler=handlers.FolderH...
from os import system, path as os_path from string import maketrans, strip from Components.config import config, ConfigYesNo, NoSave, ConfigSubsection, ConfigText, ConfigSelection, ConfigPassword from Components.Console import Console from Components.Network import iNetwork from pythonwifi.iwlibs import getNICnames, W...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Unit tests for gluon.recfile """ import unittest import os import shutil import uuid from fix_path import fix_sys_path fix_sys_path(__file__) from gluon import recfile class TestRecfile(unittest.TestCase): def setUp(self): os.mkdir('tests') de...
# coding: utf-8 from __future__ import unicode_literals import re from .common import InfoExtractor from ..compat import compat_urlparse from ..utils import ( get_element_by_attribute, qualities, unescapeHTML, ) class OraTVIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?(?:ora\.tv|unsafespeech\....
import unittest from . import operand from . import operator from . import context from . import expression class Test(unittest.TestCase): def testConstantOptimize(self): ctx = context.Context() ctx.setValue('A', operand.Constant(1)) e = expression.parse("1+A") e = e.optimizedWith...
import traceback from _prof_imports import TSerialization from _prof_imports import TBinaryProtocol from _prof_imports import ProfilerRequest from _prof_imports import IS_PY3K from prof_util import ProfDaemonThread import struct def send_message(sock, message): """ Send a serialized message (protobuf Message i...
# -*- coding: utf-8 -*- import os import codecs import re ''' This file contains all phonetics related functions. The phonetic transcription is obtained using eSpeak speech synthesizer (http://espeak.sourceforge.net/). For English the list of available phonetic vowels can be found here: http://espeak.sourceforge...
ANSIBLE_METADATA = {'status': ['preview'], 'supported_by': 'community', 'version': '1.0'} def main(): module = AnsibleModule( argument_spec=dict( name=dict(required=True, type='list'), state=dict( default='present', ...
""" Package containing all pip commands """ from __future__ import absolute_import from pip.commands.completion import CompletionCommand from pip.commands.download import DownloadCommand from pip.commands.freeze import FreezeCommand from pip.commands.hash import HashCommand from pip.commands.help import HelpCommand fr...
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Deleting field 'Invoice.tax_id' db.delete_column('shoppingcart_invoice', 'tax_id') # Adding field...
from m5.params import * from m5.proxy import * from BaseTLB import BaseTLB from MemObject import MemObject class X86PagetableWalker(MemObject): type = 'X86PagetableWalker' cxx_class = 'X86ISA::Walker' cxx_header = 'arch/x86/pagetable_walker.hh' port = MasterPort("Port for the hardware table walker") ...
from south.db import db from django.db import models from mysite.search.models import * class Migration: def forwards(self, orm): # Adding field 'Answer.title' db.add_column('search_answer', 'title', orm['search.answer:title']) # Deleting model 'buganswer' db....
# -*- coding: utf-8 -*- # Page model for Intel->Chargeback->Rates. from wait_for import TimedOutError from cached_property import cached_property from navmazing import NavigateToSibling, NavigateToAttribute from widgetastic.utils import ParametrizedLocator, ParametrizedString from widgetastic.widget import Text, Param...
from galaxy.model import Tag import re from sqlalchemy.sql.expression import func, and_ from sqlalchemy.sql import select from galaxy.model import History, HistoryTagAssociation, Dataset, DatasetTagAssociation, \ HistoryDatasetAssociation, HistoryDatasetAssociationTagAssociation, Page, PageTagAssociation class Tag...
""" Standard container-class for easy multiple-inheritance. Try to inherit from the ndarray instead of using this class as this is not complete. """ from __future__ import division, absolute_import, print_function from numpy.core import ( array, asarray, absolute, add, subtract, multiply, divide, remainder, ...
from django.db import models from django.contrib.auth.models import User from django.utils.encoding import python_2_unicode_compatible from securedpi_locks.models import Lock from django.db.models.signals import post_save from django.dispatch import receiver import requests from securedpi_facerec.facial_recognition imp...
""" LMfit-py provides a Least-Squares Minimization routine and class with a simple, flexible approach to parameterizing a model for fitting to data. Named Parameters can be held fixed or freely adjusted in the fit, or held between lower and upper bounds. If the separate asteval module has been ...
from twisted.web.http import HTTPChannel from ClientRequest import ClientRequest class StrippingProxy(HTTPChannel): '''sslstrip is, at heart, a transparent proxy server that does some unusual things. This is the basic proxy server class, where we get callbacks for GET and POST methods. We then proxy these ...
"""terminalcommand.py -- A minimal interface to Terminal.app. To run a shell command in a new Terminal.app window: import terminalcommand terminalcommand.run("ls -l") No result is returned; it is purely meant as a quick way to run a script with a decent input/output window. """ # # This module is a fairly s...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'core'} import re import os.path import tempfile # import module snippets from ansible.module_utils.basic...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} DOCUMENTATION = r''' --- module: aws_secret short_description: Manage secrets stored in AWS ...
import io import operator from unittest import mock import subunit import testtools from stestr import bisect_tests from stestr.repository import abstract from stestr.tests import base class FakeTestRun(abstract.AbstractTestRun): def get_test(self): case = subunit.ByteStreamToStreamResult(io.BytesIO(sel...
import os vars = { 'ptr_lib_version': '1.0.10', 'ptr_lib_stable_version': '1.0.10', 'cube_sdk_version': '1.0.44.39-SNAPSHOT' } files = [ 'README.md', 'README-cn.md', 'ptr-lib/pom.xml', 'ptr-lib/gradle.properties', 'ptr-demo/pom.xml', 'ptr-...
import time from boto.compat import json class OptionStatus(dict): """ Presents a combination of status field (defined below) which are accessed as attributes and option values which are stored in the native Python dictionary. In this class, the option values are merged from a JSON object that is...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type import os import time import glob import urlparse from ansible.module_utils._text import to_text from ansible.plugins.action.junos import ActionModule as _ActionModule class ActionModule(_ActionModule): def run(self, tmp=Non...
from unittest import TestCase from ..nbbase import ( NotebookNode, new_code_cell, new_text_cell, new_worksheet, new_notebook, new_output, new_author, new_metadata ) class TestCell(TestCase): def test_empty_code_cell(self): cc = new_code_cell() self.assertEqual(cc.cell_type,u'code') ...
"""A collection of statistical utility functions to be used by metrics.""" import bisect import math def Clamp(value, low=0.0, high=1.0): """Clamp a value between some low and high value.""" return min(max(value, low), high) def NormalizeSamples(samples): """Sorts the samples, and map them linearly to the ra...
from __future__ import unicode_literals import os from django.apps import apps from django.test import TestCase from django.test.utils import extend_sys_path from django.utils._os import upath from django.utils import six class EggLoadingTest(TestCase): def setUp(self): self.egg_dir = '%s/eggs' % os.pa...
# # Monitor of Natural Language Processing (RelexServer and NLGen) # # @author Zhenhua Cai <<EMAIL>> # # @date 2011-04-23 # import sys import time import zmq import json from PyQt4.QtCore import * from PyQt4.QtGui import * from common import * ########################################################################...
from __future__ import unicode_literals import frappe from frappe.utils import cint, cstr, flt from frappe import _ from frappe.model.document import Document from operator import itemgetter class BOM(Document): def autoname(self): last_name = frappe.db.sql("""select max(name) from `tabBOM` where name like "B...
{ "name": "Make Sale Procurement Date based on Sale Confirm Date", 'version': '8.0.1.0.0', 'category': 'Sales Management', 'sequence': 14, 'author': 'ADHOC SA', 'website': 'www.adhoc.com.ar', 'license': 'AGPL-3', 'summary': '', "description": """ Make Sale Procurement Date based on ...
# -*- coding: utf-8 -*- """ flask.ctx ~~~~~~~~~ Implements the objects required to keep the context. :copyright: (c) 2011 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ import sys from werkzeug.exceptions import HTTPException from .globals import _request_ctx_stack, _app_ct...
from __future__ import unicode_literals from django.db import models from django.contrib.sites.models import Site from django.core.urlresolvers import get_script_prefix from django.utils.translation import ugettext_lazy as _ from django.utils.encoding import iri_to_uri, python_2_unicode_compatible @python_2_unicode_c...
import unittest from . import basic_example class BasicTestCase(unittest.TestCase): def setUp(self): basic_example.app.config['DATABASE'] = 'sqlite:///:memory:' basic_example.app.config['TESTING'] = True self.app = basic_example.app.test_client() with basic_example.app.app_context...
#!python """Bootstrap distribute installation If you want to use setuptools in your package's setup.py, just include this file in the same directory with it, and add this to the top of your setup.py:: from distribute_setup import use_setuptools use_setuptools() If you want to require a specific version of se...
#!/usr/bin/env python # coding: utf-8 from __future__ import unicode_literals import unittest from mkdocs.tests.base import dedent, markdown_to_toc class TableOfContentsTests(unittest.TestCase): def test_indented_toc(self): md = dedent(""" # Heading 1 ## Heading 2 ### Heading 3 ...
import pyglet from os import path def replace_layout_batch(layout, batch=None, group=None): '''Replace the batch and group currently in use by a pyglet.text.Layout subclass''' document = layout.document layout.delete() if isinstance(layout, pyglet.text.layout.IncrementalTextLayout): document.push_handlers(layo...
# Calculate gem prompt A/B test results # TODO: Why is no-prompt group 50% larger? import sys from mixpanel import Mixpanel try: import json except ImportError: import simplejson as json # NOTE: mixpanel dates are by day and inclusive # E.g. '2014-12-08' is any date that day, up to 2014-12-09 12am if __nam...
import os, sys, traceback import Ice slice_dir = Ice.getSliceDir() if not slice_dir: print(sys.argv[0] + ': Slice directory not found.') sys.exit(1) Ice.loadSlice("'-I" + slice_dir + "' Test.ice") import Test class ServerLocatorRegistry(Test.TestLocatorRegistry): def __init__(self): self._adapter...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Codetags finder ~~~~~~~~~~~~~~~ Find code tags in specified files and/or directories and create a report in HTML format. :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import sys,...
# -*- encoding:ascii -*- from mako import runtime, filters, cache UNDEFINED = runtime.UNDEFINED __M_dict_builtin = dict __M_locals_builtin = locals _magic_number = 6 _modified_time = 1417442147.008255 _template_filename='templates/grid_base_async.mako' _template_uri='grid_base_async.mako' _template_cache=cache.Cache(__...
from pyanaconda import ihelp from pyanaconda.constants_text import INPUT_PROCESSED, INPUT_DISCARDED from pyanaconda.ui.tui import simpleline as tui from pyanaconda.ui.tui.tuiobject import TUIObject, HelpScreen from pyanaconda.ui import common from pyanaconda.i18n import _, N_ class TUIHub(TUIObject, common.Hub): ...
"""core""" import re, pydoc, optparse, inspect import tokenize import docutils.core from docutils import nodes from docutils.nodes import SparseNodeVisitor from docutils.writers import Writer try: from cStringIO import StringIO except ImportError: from StringIO import StringIO wiki_word_re = re.compile(r'^[A-Z...
#!/usr/bin/env python #-*-coding:utf-8-*- ''' You are given the following information, but you may prefer to do some research for yourself. 1 Jan 1900 was a Monday. Thirty days has September, April, June and November. All the rest have thirty-one, Saving February alone, Which has twenty-eight, rain or shine. And on l...
from __future__ import absolute_import import datetime import logging import os import sys import socket from socket import error as SocketError, timeout as SocketTimeout import warnings from .packages import six from .packages.six.moves.http_client import HTTPConnection as _HTTPConnection from .packages.six.moves.http...
# -*- coding: utf-8 -*- """ requests.adapters ~~~~~~~~~~~~~~~~~ This module contains the transport adapters that Requests uses to define and maintain connections. """ import os.path import socket from .models import Response from .packages.urllib3.poolmanager import PoolManager, proxy_from_url from .packages.urllib...
from openerp.osv import fields, osv class mail_vote(osv.Model): ''' Mail vote feature allow users to like and unlike messages attached to a document. This allows for example to build a ranking-based displaying of messages, for FAQ. ''' _name = 'mail.vote' _description = 'Mail Vote' _c...
import ConfigParser import os import shutil import urllib import dbus from mediaconsole import UPNP, Container, Device class _DscUpnp(UPNP): def __init__(self): UPNP.__init__(self) def get_servers(self): return self._manager.GetServers() class _DscContainer(Container): def __init__(self,...
from Screens.Screen import Screen from Components.ActionMap import NumberActionMap from Components.Label import Label from Components.ChoiceList import ChoiceEntryComponent, ChoiceList from Components.Sources.StaticText import StaticText import enigma class ChoiceBox(Screen): def __init__(self, session, title="", lis...
import os import json import logging import logging.config PROJECT_NAME = 'waterbutler' PROJECT_CONFIG_PATH = '~/.cos' try: import colorlog # noqa DEFAULT_FORMATTER = { '()': 'colorlog.ColoredFormatter', 'format': '%(cyan)s[%(asctime)s]%(log_color)s[%(levelname)s][%(name)s]: %(reset)s%(messa...