content string |
|---|
#!/usr/bin/env python
import time
from hashlib import md5
from gluon.dal import DAL
def motp_auth(db=DAL('sqlite://storage.sqlite'),
time_offset=60):
"""
motp allows you to login with a one time password(OTP) generated on a motp client,
motp clients are available for practically all platfo... |
import unittest
from telemetry.core.backends.chrome import desktop_browser_finder
from telemetry.core import browser_options
from telemetry.core.platform import desktop_device
from telemetry.unittest_util import system_stub
# This file verifies the logic for finding a browser instance on all platforms
# at once. It ... |
import socket
import sys
import time
import eventlet
eventlet.monkey_patch()
from oslo_config import cfg
from oslo_log import log as logging
import oslo_messaging
from neutron.agent import rpc as agent_rpc
from neutron.agent import securitygroups_rpc as sg_rpc
from neutron.common import config as common_config
from ... |
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
class SoundgasmIE(InfoExtractor):
IE_NAME = 'soundgasm'
_VALID_URL = r'https?://(?:www\.)?soundgasm\.net/u/(?P<user>[0-9a-zA-Z_\-]+)/(?P<title>[0-9a-zA-Z_\-]+)'
_TEST = {
'url': 'http://soundgasm.... |
"""
Miscellaneous view helpers
--------------------------
Helper functions for view handlers.
All items in this module can be imported directly from :mod:`coaster.views`.
"""
from urllib.parse import urlsplit
import re
from flask import Response, current_app, json, request
from flask import session as request_sessi... |
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import AxesGrid
def get_demo_image():
import numpy as np
from matplotlib.cbook import get_sample_data
f = get_sample_data("axes_grid/bivariate_normal.npy", asfileobj=False)
z = np.load(f)
# z is a numpy array of 15x15
return z, (-3,4,... |
from __future__ import absolute_import, division, print_function
import collections
import itertools
import re
from ._structures import Infinity
__all__ = [
"parse", "Version", "LegacyVersion", "InvalidVersion", "VERSION_PATTERN"
]
_Version = collections.namedtuple(
"_Version",
["epoch", "release", "d... |
categories = ["romutil",
"general_purpose",
"simd128",
"simd64",
"system",
"x87"]
microcode = '''
# X86 microcode
'''
for category in categories:
exec "import %s as cat" % category
microcode += cat.microcode |
# django
import django
from django import template
from django.conf import settings
from django.shortcuts import get_object_or_404
from badger.models import Award, Badge
from django.core.exceptions import ObjectDoesNotExist
from django.core.urlresolvers import reverse
import hashlib
import urllib
from django.utils.... |
import os.path as path
import mimetypes
mimetypes.init()
from django.utils.translation import ugettext as _
from django.contrib.contenttypes.models import ContentType
from taiga.base import filters
from taiga.base import exceptions as exc
from taiga.base.api import ModelCrudViewSet
from taiga.base.api.mixins import B... |
"""
This config file extends the test environment configuration
so that we can run the lettuce acceptance tests.
This is used in the django-admin call as acceptance.py
contains random seeding, causing django-admin to create a random collection
"""
# We intentionally define lots of variables that aren't used, and
# wan... |
"""
This module contains functions that generate ctypes prototypes for the
GDAL routines.
"""
from ctypes import c_char_p, c_double, c_int, c_int64, c_void_p
from functools import partial
from django.contrib.gis.gdal.prototypes.errcheck import (
check_arg_errcode, check_const_string, check_errcode, check_geom,
... |
#!/usr/bin/env python3
import argparse
import os
import subprocess
import sys
def setup():
global args, workdir
programs = ['ruby', 'git', 'apt-cacher-ng', 'make', 'wget']
if args.kvm:
programs += ['python-vm-builder', 'qemu-kvm', 'qemu-utils']
elif args.docker:
dockers = ['docker.io',... |
import datetime
from calendar import monthrange, month_name
from pprint import pprint
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.db.models import Count, Sum
from django.http import HttpResponse
from django.views.generic import TemplateView
from d... |
import struct
from pox.lib.util import initHelper
# Nicira Vendor extensions. Welcome to embrace-and-extend-town
VENDOR_ID = 0x00002320
# sub_types
ROLE_REQUEST = 10
ROLE_REPLY = 11
# role request / reply patterns
ROLE_OTHER = 0
ROLE_MASTER = 1
ROLE_SLAVE = 2
class nx_data(object):
""" base class for the data fiel... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'status': ['preview'],
'supported_by': 'community',
'metadata_version': '1.1'}
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.openstack imp... |
from enigma import getPrevAsciiCode
from Screens.Screen import Screen
from Screens.MessageBox import MessageBox
from Components.ActionMap import NumberActionMap
from Components.Label import Label
from Components.Input import Input
from Components.config import config
from Tools.BoundFunction import boundFunction
from T... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import errno
import fcntl
import getpass
import locale
import logging
import os
import random
import subprocess
import sys
import textwrap
import time
from struct import unpack, pack
from termios import TIOCGWINSZ
from ansible im... |
from sqlalchemy import Column, Enum, Integer
from sqlalchemy.types import BLOB
from sqlalchemy.orm import validates
from inbox.models.base import MailSyncBase
from inbox.security.oracles import get_encryption_oracle, get_decryption_oracle
class Secret(MailSyncBase):
"""Simple local secrets table."""
_secret ... |
# -*- coding: utf-8 -*-
"""
jinja2.defaults
~~~~~~~~~~~~~~~
Jinja default filters and tags.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD, see LICENSE for more details.
"""
from jinja2._compat import range_type
from jinja2.utils import generate_lorem_ipsum, Cycler, Joiner
# defaults for ... |
#!/usr/bin/env python
from nose.tools import *
import networkx as nx
from networkx import NetworkXNotImplemented
class TestStronglyConnected:
def setUp(self):
self.gc=[]
G=nx.DiGraph()
G.add_edges_from([(1,2),(2,3),(2,8),(3,4),(3,7),
(4,5),(5,3),(5,6),(7,4),(7,6),... |
"""
Cells RPC Communication Driver
"""
from oslo_config import cfg
import oslo_messaging as messaging
from nova.cells import driver
from nova import rpc
cell_rpc_driver_opts = [
cfg.StrOpt('rpc_driver_queue_base',
default='cells.intercell',
help="Base queue name to use wh... |
#!/usr/bin/env python
from __tools__ import MyParser
from __tools__ import XmlParser
from __tools__ import XmlWriter
from __tools__ import make_sure_path_exists
from __tools__ import addsuffixtofile
from __cluster__ import write_cluster_batch
from __xtpJobfile__ import splittjobfile
from __xtpJobfile__ import mergejobf... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import ast
import re
from jinja2.compiler import generate
from jinja2.exceptions import UndefinedError
from ansible.compat.six import text_type
from ansible.errors import AnsibleError, AnsibleUndefinedVariable
from ansible.playbo... |
"""
@author: Brendan Dolan-Gavitt
@license: GNU General Public License 2.0
@contact: <EMAIL>
"""
import struct
import volatility.win32.rawreg as rawreg
import volatility.win32.hive as hive
import volatility.win32.hashdump as hashdump
from Crypto.Hash import MD5
from Crypto.Cipher import ARC4, DES
def ... |
from unittest.mock import MagicMock
import boto.swf.layer2 as swf
from boto.swf import layer1
import pytest
from garcon import activity
from garcon import decider
def mock(monkeypatch):
for base in [swf.Decider, swf.WorkflowType, swf.ActivityType, swf.Domain]:
monkeypatch.setattr(base, '__init__', MagicM... |
import serial, urllib2, time
# mbed super class
class mbed:
def __init__(self):
print("This will work as a demo but no transport mechanism has been selected")
def rpc(self, name, method, args):
print("Superclass method not overridden")
# Transport mechanisms, derived from mbed
class SerialRP... |
import os
import base64
from rhn import rpclib
from spacewalk.common import apache, rhnFlags
from spacewalk.common.rhnLog import log_debug, log_error
from spacewalk.common.rhnConfig import CFG
from spacewalk.common.rhnException import rhnFault
from spacewalk.server import rhnPackageUpload, rhnSQL, basePackageUpload
c... |
'''
Econometrics for a Datarich Environment
=======================================
Introduction
------------
In many cases we are performing statistical analysis when many observed variables are
available, when we are in a data rich environment. Machine learning has a wide variety
of tools for dimension reduction an... |
import os, sys
from ctypes import *
up=2
def setlibpath(up):
import sys
path=os.path.normpath(os.path.split(os.path.realpath(__file__))[0]+'\..'*up)
if path not in sys.path:
sys.path.append(path)
setlibpath(up)
from haru import *
from haru.c_func import *
from haru.hpdf_errorcode im... |
from openerp.osv import fields, osv
from openerp.tools.translate import _
class account_fiscalyear_close(osv.osv_memory):
"""
Closes Account Fiscalyear and Generate Opening entries for New Fiscalyear
"""
_name = "account.fiscalyear.close"
_description = "Fiscalyear Close"
_columns = {
'f... |
#!/usr/bin/python2
import getpass
import sys
import pexpect
boot = False
if len(sys.argv) > 1 and sys.argv[1] == 'boot':
print "Boot mode"
boot = True
def get_passes():
old = getpass.getpass('Old password: ')
new1 = 'a'
new2 = 'b'
while new1 != new2:
new1 = getpass.getpass('New pass... |
import rethinkdb as r
from mockthink.test.common import as_db_and_table, assertEqUnordered, assertEqual
from mockthink.test.functional.common import MockTest
from pprint import pprint
class TestLogic1(MockTest):
@staticmethod
def get_data():
data = [
{'id': 'joe', 'has_eyes': True, 'age': 2... |
import six
from airflow.contrib.utils.weekday import WeekDay
from airflow.sensors.base_sensor_operator import BaseSensorOperator
from airflow.utils import timezone
from airflow.utils.decorators import apply_defaults
class DayOfWeekSensor(BaseSensorOperator):
"""
Waits until the first specified day of the week... |
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_... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from units.compat.mock import patch
from ansible.modules.network.onyx import onyx_config
from units.modules.utils import set_module_args
from .onyx_module import TestOnyxModule, load_fixture
class TestOnyxConfigModule(TestOnyxMod... |
import os
import re
import gcs_async
import log_parser
import kubelet_parser
import regex
import view_base
@view_base.memcache_memoize('log-file-junit://', expires=60*60*4)
def find_log_junit(build_dir, junit, log_file):
"""
Looks in build_dir for log_file in a folder that
also includes the junit file.
... |
# coding: utf-8
"""
From http://code.google.com/p/cherrypy-jsonrpc (LGPL)
Some modifications:
- Content-Type (application/json)
"""
import sys
import httplib
import cherrypy
import traceback
try:
import jsonlib2 as json
_ParseError = json.ReadError
except ImportError:
import json
_ParseError = ValueEr... |
"""
Tests for built in Function expressions.
"""
from __future__ import unicode_literals
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class Author(models.Model):
name = models.CharField(max_length=50)
alias = models.CharField(max_leng... |
from setuptools import setup
import os, glob, shutil
import re, json, numpy
import nibabel as ni
here = os.path.abspath(os.path.dirname(__file__))
setup(
name="hcp2bids",
# Versions should comply with PEP440. For a discussion on single-sourcing
# the version across setup.py and the project code, see
... |
import ast
import sys
# We only use StringIO, since we cannot setattr on cStringIO
from StringIO import StringIO
import yaml
import yaml.reader
def find_globals(g, tree):
"""Uses AST to find globals in an ast tree"""
for child in tree:
if hasattr(child, 'body') and isinstance(child.body, list):
... |
from treadmill.infra.setup import base_provision
from treadmill.infra import configuration, connection, constants, instances
from treadmill.api import ipa
import time
class LDAP(base_provision.BaseProvision):
def setup(
self,
image,
count,
key,
cidr_bloc... |
#!/usr/bin/python
######################################################################
# Cloud Routes Bridge
# -------------------------------------------------------------------
# Actions Module
######################################################################
import requests
import time
def action(**kwargs)... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
WrongScriptException.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
******************... |
"""
Create an applet from a Python script.
You can drag in packages, Info.plist files, icons, etc.
It's expected that only one Python script is dragged in.
"""
from __future__ import print_function
import os, sys
from distutils.core import setup
from plistlib import Plist
import py2app
import tempfile
import shutil
... |
from tests import TestCase, add
from yasm import SymbolTable, Expression, YasmError
class TSymbolTable(TestCase):
def setUp(self):
self.symtab = SymbolTable()
def test_keys(self):
self.assertEquals(len(self.symtab.keys()), 0)
self.symtab.declare("foo", None, 0)
keys = self.symt... |
import unittest2 as unittest
import time
class GpMgmtTestRunner(unittest.TextTestRunner):
def _makeResult(self):
return GpMgmtTextTestResult(self.stream, self.descriptions, self.verbosity)
class GpMgmtTextTestResult(unittest.TextTestResult):
def __init__(self, stream, descriptions, verbosity):
... |
import os.path
import re # for folderfilter
from threading import Lock
boxes = {}
localroots = {}
config = None
accounts = None
mblock = Lock()
def init(conf, accts):
global config, accounts
config = conf
accounts = accts
def add(accountname, foldername, localfolders):
i... |
from __future__ import absolute_import
from django.core.urlresolvers import reverse
from django.http import HttpRequest
from sentry.models import User
from sentry.testutils import TestCase
from sentry.utils.auth import EmailAuthBackend, get_login_redirect
class EmailAuthBackendTest(TestCase):
def setUp(self):
... |
from .constants import eStart, eError, eItsMe
# BIG5
BIG5_cls = (
1,1,1,1,1,1,1,1, # 00 - 07 #allow 0x00 as legal value
1,1,1,1,1,1,0,0, # 08 - 0f
1,1,1,1,1,1,1,1, # 10 - 17
1,1,1,0,1,1,1,1, # 18 - 1f
1,1,1,1,1,1,1,1, # 20 - 27
1,1,1,1,1,1,1,1, # 28 - 2f
1,1,1,1,1,1,1,1, # 30 - 3... |
def create_workload(generator, filename):
import cPickle
workload = [sample for sample in generator]
f = open(filename, 'w')
cPickle.dump(workload, f, cPickle.HIGHEST_PROTOCOL)
f.close()
def create_noise_workload(tracefile, count, filename):
# get total number of streams in the trace
impor... |
'''
John Whelchel
Summer 2013
Forms used just for gateways (AG, RG, and UG).
'''
from django import forms
from django_lib.forms import LONGEST_CHAR_FIELD, LONGEST_PASS_FIELD, LONGEST_JSON_FIELD, ReadOnlyWidget
LARGEST_PORT = 65535
class ModifyGatewayConfig(forms.Form):
json_config = forms.FileField(required... |
## A script for extracting info about the patients used in the analysis
## Load necessary modules
from rpy2 import robjects as ro
import numpy as np
import os
ro.r('library(survival)')
import re
##This call will only work if you are running python from the command line.
##If you are not running from the command lin... |
from oslo.config import cfg
from ceilometer import agent
from ceilometer.compute.virt import inspector as virt_inspector
from ceilometer import extension_manager
from ceilometer import nova_client
from ceilometer.openstack.common import log
LOG = log.getLogger(__name__)
class PollingTask(agent.PollingTask):
de... |
"""Contains convenience wrappers for creating variables in TF-Slim.
The variables module is typically used for defining model variables from the
ops routines (see slim.ops). Such variables are used for training, evaluation
and inference of models.
All the variables created through this module would be added to the
MO... |
import datetime
import os
import sys
import traceback
if sys.version_info[0] == 3:
def to_str(value):
return value.decode(sys.getfilesystemencoding())
def execfile(path, global_dict):
"""Execute a file"""
with open(path, 'r') as f:
code = f.read()
code = code.repla... |
"""A kernel module rewriter.
This is a hack that rewrites kernel modules such that they can be loaded on
kernels they were not compiled for.
"""
import os
import platform
import struct
import sys
import logging
from grr.lib import flags
class KernelObjectPatcher(object):
"""The kernel object patching class."... |
"""
Copyright 2018-present Airbnb, 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, sof... |
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'core'}
DOCUMENTATION = r'''
---
module: win_acl
version_added: "2.0"
short_description: Set file/directory/registry permissions for a system user or group
description:
- Add or remove rights/p... |
import urllib
def main():
module = AnsibleModule(
argument_spec = dict(
token = dict(type='str',required=True,no_log=True),
chat_id = dict(type='str',required=True,no_log=True),
msg = dict(type='str',required=True)),
supports_check_mode=True
)
token = u... |
from __future__ import unicode_literals
import webnotes
@webnotes.whitelist()
def get_items(price_list, sales_or_purchase, item=None, item_group=None):
condition = ""
args = {"price_list": price_list}
if sales_or_purchase == "Sales":
condition = "i.is_sales_item='Yes'"
else:
condition = "i.is_purchase_item='... |
"""A simple web server for testing purpose.
It serves the testing html pages that are needed by the webdriver unit tests."""
import logging
import os
import socket
import threading
import urllib
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
def updir():
dirname = os.path.dirname
re... |
""" Encapsulate implicit state that is useful for Bokeh plotting APIs.
Generating output for Bokeh plots requires coordinating several things:
:class:`Documents <bokeh.document>`
Group together Bokeh models that may be shared between plots (e.g.,
range or data source objects) into one common namespace.
:clas... |
try:
import pyrax
HAS_PYRAX = True
except ImportError:
HAS_PYRAX = False
def rax_dns_record_ptr(module, data=None, comment=None, loadbalancer=None,
name=None, server=None, state='present', ttl=7200):
changed = False
results = []
dns = pyrax.cloud_dns
if not dns:
... |
import base_action_rule
import test_models
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
"PYTEST_DONT_REWRITE"
import pytest, py
from _pytest.assertion import util
def exvalue():
return py.std.sys.exc_info()[1]
def f():
return 2
def test_not_being_rewritten():
assert "@py_builtins" not in globals()
def test_assert():
try:
assert f() == 3
except AssertionError:
e = e... |
import os
import xbmc
import xbmcaddon
import xbmcgui
import xbmcvfs
__addon__ = xbmcaddon.Addon()
__addonversion__ = __addon__.getAddonInfo('version')
__addonname__ = __addon__.getAddonInfo('name')
__addonpath__ = __addon__.getAddonInfo('path').decode('utf-8')
__addonprofile__ = xbmc.translatePath( __add... |
"""
The following classes will be available through gnuradio.wxgui.forms:
"""
########################################################################
# External Converters
########################################################################
from converters import \
eval_converter, str_converter, \
float_conver... |
# -*- coding: utf-8 -*-
import cgi
import json
import os.path
import glob
import re
import collections
from lxml import etree
import openerp.addons.base.ir.ir_qweb
import openerp.modules
from openerp.tests import common
from openerp.addons.base.ir import ir_qweb
class TestQWebTField(common.TransactionCase):
def ... |
"""
Script for finding all courses whose org/name pairs == other courses when ignoring case
"""
from django.core.management.base import BaseCommand
from xmodule.modulestore.django import modulestore
from xmodule.modulestore import ModuleStoreEnum
#
# To run from command line: ./manage.py cms --settings dev course_id_... |
import os
import os.path
import string
paRootDirectory = '../../'
paHtmlDocDirectory = os.path.join( paRootDirectory, "doc", "html" )
## Script to check documentation status
## this script assumes that html doxygen documentation has been generated
##
## it then walks the entire portaudio source tree and check that
##... |
# -*- coding: UTF-8 -*-
from tests.unit import unittest
from tests.unit import AWSMockServiceTestCase
from boto.vpc import VPCConnection, VPC
from boto.ec2.securitygroup import SecurityGroup
DESCRIBE_VPCS = b'''<?xml version="1.0" encoding="UTF-8"?>
<DescribeVpcsResponse xmlns="http://ec2.amazonaws.com/doc/2013-02-0... |
import genmsg.msgs
try:
from cStringIO import StringIO #Python 2.x
except ImportError:
from io import StringIO #Python 3.x
MSG_TYPE_TO_CPP = {'byte': 'int8_t',
'char': 'uint8_t',
'bool': 'uint8_t',
'uint8': 'uint8_t',
'int8': 'int8_t'... |
"""
Utilities for use in Mako markup.
"""
import markupsafe
# Text() can be used to declare a string as plain text, as HTML() is used
# for HTML. It simply wraps markupsafe's escape, which will HTML-escape if
# it isn't already escaped.
Text = markupsafe.escape # pylint: disable=invalid-name
... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
from units.compat.mock import patch
from ansible.modules.network.aireos import aireos_command
from units.modules.utils import set_module_args
from .aireos_module import TestCiscoWlcModule, load_fixture
class TestCisc... |
from __future__ import print_function
import time
import pytest
from sssd.testlib.common.utils import sssdTools
@pytest.mark.adsites
class Testadsites(object):
"""
@Title: IDM-SSSD-TC: ad_provider: adsites:
Improve AD site discovery process
Test cases for BZ: 1819012
@Steps:
1. Join client to... |
from django.http import HttpResponse
import json
import socket
from data.models import Comment
def processRequestFromOtherServer(obj, dict_type):
json_dict = {}
json_dict_list = []
if dict_type is "author":
json_dict_list.append(getAuthorDict(obj))
elif dict_type is "posts":
for posts... |
"""
Declare constants used by database modules
"""
#-------------------------------------------------------------------------
#
# constants
#
#-------------------------------------------------------------------------
__all__ = ( 'DBPAGE', 'DBMODE', 'DBCACHE', 'DBLOCKS', 'DBOBJECTS', 'DBUNDO',
'DBEXT', 'DBM... |
from neutron.db import extraroute_db
from neutron.plugins.embrane import base_plugin as base
from neutron.plugins.embrane.l2base.fake import fake_l2_plugin as l2
from neutron.plugins.embrane.l2base.fake import fakeplugin_support as sup
class EmbraneFakePlugin(base.EmbranePlugin, extraroute_db.ExtraRoute_db_mixin,
... |
"""
Period formatters and locators adapted from scikits.timeseries by
Pierre GF Gerard-Marchant & Matt Knox
"""
# TODO: Use the fact that axis can have units to simplify the process
import numpy as np
from matplotlib import pylab
from pandas.tseries.period import Period
from pandas.tseries.offsets import DateOffset
... |
"""
Global Django exception and warning classes.
"""
class DjangoRuntimeWarning(RuntimeWarning):
pass
class ObjectDoesNotExist(Exception):
"The requested object does not exist"
silent_variable_failure = True
class MultipleObjectsReturned(Exception):
"The query returned multiple objects when only one w... |
# Tests for mongodb_replica_set ansible module
#
# How to run these tests:
# 1. move this file to playbooks/library
# 2. rename mongodb_replica_set to mongodb_replica_set.py
# 3. python test_mongodb_replica_set.py
import mongodb_replica_set as mrs
import unittest, mock
from urllib import quote_plus
from copy import de... |
"""A minimal subset of the locale module used at interpreter startup
(imported by the _io module), in order to reduce startup time.
Don't import directly from third-party code; use the `locale` module instead!
"""
import sys
import _locale
if sys.platform.startswith("win"):
def getpreferredencoding(do_setlocale=... |
"""The CardConnection abstract class manages connections with a card and
apdu transmission.
__author__ = "http://www.gemalto.com"
Copyright 2001-2012 gemalto
Author: Jean-Daniel Aussel, mailto:<EMAIL>
This file is part of pyscard.
pyscard is free software; you can redistribute it and/or modify
it under the terms of... |
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import remove_end
class CharlieRoseIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?charlierose\.com/video(?:s|/player)/(?P<id>\d+)'
_TESTS = [{
'url': 'https://charlierose.com/videos/27996',
'md5': 'fd... |
"""
This module contains the base class for all observer objects
"""
#@<< Imports >>
#@+node:<< Imports >>
#@-node:<< Imports >>
#@nl
_is_source_ = True
#@+others
#@+node:class Observer
class Observer(object):
"""
Base Class for all charts and reports.
@var visible: Specifies if the observer is visible
... |
from django.db.backends import BaseDatabaseIntrospection
class DatabaseIntrospection(BaseDatabaseIntrospection):
# Maps type codes to Django Field types.
data_types_reverse = {
16: 'BooleanField',
20: 'BigIntegerField',
21: 'SmallIntegerField',
23: 'IntegerField',
25: '... |
"""A readline()-style interface to the parts of a multipart message.
The MultiFile class makes each part of a multipart message "feel" like
an ordinary file, as long as you use fp.readline(). Allows recursive
use, for nested multipart messages. Probably best used together
with module mimetools.
Suggested use... |
"""Base class for SharedKeyDB and VerifierDB."""
import anydbm
import thread
class BaseDB:
def __init__(self, filename, type):
self.type = type
self.filename = filename
if self.filename:
self.db = None
else:
self.db = {}
self.lock = thre... |
#!/usr/bin/env python
"""This modules contains tests for artifact API handler."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import io
import os
from absl import app
from grr_response_core import config
from grr_response_core.lib.rdfvalues import ar... |
from django.shortcuts import render
from django.http import HttpResponse
from django.template import RequestContext, loader
def tiepoint_registration_1(request):
from voxel_globe.meta import models
image_set_list = models.ImageSet.objects.all()
return render(request, 'tiepoint_registration/html/tiepoint_registra... |
from webob import *
def simple_app(environ, start_response):
start_response('200 OK', [
('Content-Type', 'text/html; charset=utf8'),
])
return ['OK']
def test_response():
req = Request.blank('/')
res = req.get_response(simple_app)
assert res.status == '200 OK'
assert res.status... |
'''An helper file for the pydev debugger (REPL) console
'''
from code import InteractiveConsole
import sys
import traceback
import _pydev_completer
from pydevd_tracing import GetExceptionTracebackStr
from pydevd_vars import makeValidXmlValue
from pydev_imports import Exec
from pydevd_io import IOBuf
from pydev_console... |
# -*- encoding: utf-8 -*-
import sys
import unittest
import ttk
class MockTkApp:
def splitlist(self, arg):
if isinstance(arg, tuple):
return arg
return arg.split(':')
def wantobjects(self):
return True
class MockTclObj(object):
typename = 'test'
... |
from __future__ import unicode_literals
from weboob.tools.backend import Module
from weboob.capabilities.recipe import CapRecipe, Recipe
from .browser import JournaldesfemmesBrowser
__all__ = ['JournaldesfemmesModule']
class JournaldesfemmesModule(Module, CapRecipe):
NAME = 'journaldesfemmes'
DESCRIPTION... |
# BSP Note: For TI EK-TM4C1294XL Tiva C Series Connected LancuhPad (REV D)
import os
# toolchains options
ARCH='arm'
CPU='cortex-m4'
CROSS_TOOL='keil'
if os.getenv('RTT_CC'):
CROSS_TOOL = os.getenv('RTT_CC')
#device options
PART_TYPE = 'PART_TM4C129XNCZAD'
# cross_tool provides the cross compiler
# EXEC_... |
# pylint: skip-file
# flake8: noqa
# pylint: disable=too-many-instance-attributes
class ProjectConfig(OpenShiftCLIConfig):
''' project config object '''
def __init__(self, rname, namespace, kubeconfig, project_options):
super(ProjectConfig, self).__init__(rname, None, kubeconfig, project_options)
cl... |
import sys
import optparse
def main(argv):
parser = optparse.OptionParser()
usage = 'usage: %s [options ...] format_string locale_list'
parser.set_usage(usage.replace('%s', '%prog'))
parser.add_option('-d', dest='dash_to_underscore', action="store_true",
default=False,
... |
from click.testing import CliRunner
import pytest
from peewee_migrate.cli import cli, get_router
runner = CliRunner()
@pytest.fixture
def dir_option(tmpdir):
return '--directory=%s' % tmpdir
@pytest.fixture
def db_url(tmpdir):
db_path = '%s/test_sqlite.db' % tmpdir
open(db_path, 'a').close()
retur... |
from odoo import api, fields, models
class AccountStatementLabelCreate(models.TransientModel):
_name = 'account.statement.label.create'
_description = 'Account Statement Label Create Wizard'
@api.model
def default_get(self, fields_list):
res = super(AccountStatementLabelCreate, self).default_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.