content string |
|---|
from __future__ import print_function
from cclib import CCHEXFile, getOptions, openCCDebugger
import sys
# Get serial port either form environment or from arguments
opts = getOptions("Generic CCDebugger Flash Writer Tool", hexIn=True,
erase="Full chip erase before write", offset=":Offset the addresses in the .hex fil... |
#!/usr/bin/env python
'''
Generate valid and invalid base58 address and private key test vectors.
Usage:
gen_base58_test_vectors.py valid 50 > ../../src/test/data/base58_keys_valid.json
gen_base58_test_vectors.py invalid 50 > ../../src/test/data/base58_keys_invalid.json
'''
# 2012 Wladimir J. van der Laan
# R... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
import os
import stat
import tempfile
from ansible.constants import mk_boolean as boolean
from ansible.errors import AnsibleError, AnsibleFileNotFound
from ansible.module_utils._text import to_bytes, to_native, to_text... |
"""
Tests for L{twisted.trial._dist.disttrial}.
"""
import os
import sys
from cStringIO import StringIO
from twisted.internet.protocol import ProcessProtocol
from twisted.internet.defer import fail, succeed
from twisted.internet.task import Cooperator, deferLater
from twisted.internet.main import CONNECTION_DONE
from... |
class ReferenceFormatter(object):
def __init__(self):
pass
def format_reference(self, reference, format_generator):
"""
Sets the 'entry' attribute of 'reference'
"""
format_generator.setup_new_reference()
format_generator.generate_header()
... |
from __future__ import division
import yaml
class ScanvarkConfig(object):
def __init__(self, conffile):
with open(conffile) as fh:
config = yaml.safe_load(fh)
self.device = config['device']
self.device_config = config.get('scan-settings', {})
self.source_single = confi... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# author B-y <EMAIL>
import os
import re
import json
import sys
class Singleton(type):
"""docstring for Singleton"""
def __init__(self, name,bases,dic):
super(Singleton, self).__init__(name,bases,dic)
self.instance = None
def __call__(self,*args,**kwargs):
if s... |
'''
Data structures for (Steiner) tree networks
'''
import networkx as nx
class Net(object):
'''Network'''
def __init__(self, nodes, arcs):
'''
nodes: node IDs
arcs: tuples of node IDs (tail, head)
'''
self.dg = nx.DiGraph()
self.dg.add_nodes_from(nodes)
... |
data = (
'', # 0x00
'', # 0x01
'C', # 0x02
'', # 0x03
'', # 0x04
'', # 0x05
'', # 0x06
'', # 0x07
'', # 0x08
'', # 0x09
'', # 0x0a
'', # 0x0b
'', # 0x0c
'H', # 0x0d
'', # 0x0e
'', # 0x0f
'', # 0x10
'', # 0x11
'', # 0x12
'', # 0x13
'', # 0x14
'N', # 0x15
... |
#!/usr/bin/env python
import new
from plasTeX import Command, Environment
from plasTeX.Base.LaTeX.Floats import Float, Caption
class newfloat(Command):
args = 'name:str pos:str capfile:str [ reset:str ]'
def invoke(self, tex):
Command.invoke(self, tex)
name = str(self.attributes['name'])
... |
"""
=====================================================================
Decision boundary of label propagation versus SVM on the Iris dataset
=====================================================================
Comparison for decision boundary generated on iris dataset
between Label Propagation and SVM.
This demon... |
import json
import uuid
from rest_framework.authtoken.models import Token
ALL_METHODS = ('get', 'post', 'put', 'patch', 'delete')
def token_authenticate(api_client, user):
token, _ = Token.objects.get_or_create(user=user)
api_client.credentials(HTTP_AUTHORIZATION='ApiKey ' + token.key)
return api_client... |
# -*- coding: utf-8 -*-
from django.db import models
from admin_sort.models import SortableModelMixin
class Author(SortableModelMixin, models.Model):
"""
SortableModelMixin: on save, intercept and first update needed other
instances, then save
"""
name = models.CharField('Name', null=True, blank=... |
import numpy as np
import warnings
from ..base import BaseEstimator, MetaEstimatorMixin, RegressorMixin, clone
from ..utils import check_random_state, check_array, check_consistent_length
from ..utils.random import sample_without_replacement
from ..utils.validation import check_is_fitted
from .base import LinearRegres... |
from __future__ import unicode_literals
import codecs
import os
import re
from django.conf import settings
from django.core.management.base import CommandError
from django.db import models
from django.db.models import get_models
from django.utils._os import upath
def sql_create(app, style, connection):
"Returns... |
""" Implements a Hidden Alignment Conditional Random Field (HACRF). """
from __future__ import absolute_import
import numpy as np
import lbfgs
from .algorithms import forward, backward
from .algorithms import forward_predict, forward_max_predict
from .algorithms import gradient, gradient_sparse, populate_sparse_featur... |
from __future__ import absolute_import, unicode_literals
from distutils.version import LooseVersion
from sqlalchemy.sql.expression import ClauseElement
from flask import Flask
import json
import requests
from gitlab_freak.models import db, ProjectDependency
import gitlab
app = Flask(__name__)
app.config.from_envvar... |
from pyanaconda.constants import *
from pyanaconda.i18n import _, N_
class Translator:
"""A simple class to facilitate on-the-fly translation for newt buttons"""
def __init__(self, button, check):
self.button = button
self.check = check
def __getitem__(self, which):
if which == 0:
... |
from setuptools import setup, find_packages
import codecs
import os.path as path
# buildout build system
# http://www.buildout.org/en/latest/docs/tutorial.html
# setup() documentation:
# http://python-packaging-user-guide.readthedocs.org/en/
# latest/distributing/#setup-py
cwd = path.dirname(__file__)
longdesc = ... |
from __future__ import absolute_import, division
import time
import os
try:
unicode
except NameError:
unicode = str
from . import LockBase, NotLocked, NotMyLock, LockTimeout, AlreadyLocked
class SQLiteLockFile(LockBase):
"Demonstrate SQL-based locking."
testdb = None
def __init__(self, path, t... |
"""
Proxy Backends
------------------
Provides a utility and a decorator class that allow for modifying the behavior
of different backends without altering the class itself or having to extend the
base backend.
.. versionadded:: 0.5.0 Added support for the :class:`.ProxyBackend` class.
"""
from .api import CacheBa... |
# pylint: disable=missing-docstring
from collections import OrderedDict, defaultdict
import select
import socket
import sys
class Style(object):
RESET = 0
BOLD = 1
UNDERSCORE = 4
BLINK = 5
INVERT = 7
CONCEAL = 8
FG_BLACK = 30
FG_RED = 31
FG_GREEN = 32
FG_YELLOW = 33
FG_BLU... |
#!/usr/bin/env python
import os
import subprocess
import sys
jq_paths = ["/usr/local/bin/jq", "/Users/nst/bin/jq"]
dir_path = "/Users/nst/Projects/dropbox/JSON/test_cases/"
existing_jq_paths = [p for p in jq_paths if os.path.exists(p)]
if len(existing_jq_paths) == 0:
print "-- cannot find jq"
sys.exit(1)
jq... |
"""Tests for the experimental input pipeline ops."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.contrib.data.python.ops import dataset_ops
from tensorflow.python.framework import dtypes
from tensorflow.python.framewor... |
from contextlib import contextmanager
from logbook import FileHandler
from zipline.finance.blotter import ORDER_STATUS
from six import itervalues
import pandas as pd
def to_utc(time_str):
return pd.Timestamp(time_str, tz='US/Eastern').tz_convert('UTC')
def setup_logger(test, path='test.log'):
test.log_han... |
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import (
compat_str,
compat_urllib_parse_urlencode,
)
from ..utils import (
ExtractorError,
int_or_none,
try_get,
)
class SohuIE(InfoExtractor):
_VALID_URL = r'https?://(?P<mytv>... |
"""
plugins
"""
from __future__ import absolute_import, division, print_function
from collections import defaultdict
import logging
import itertools
import os
import imp
import traceback
from mcedit2 import editortools
from mcedit2.editortools import generate
from mcedit2.util import load_ui
from mcedit2.util.setti... |
from __future__ import unicode_literals
import base64
import calendar
import datetime
import re
import sys
from binascii import Error as BinasciiError
from email.utils import formatdate
from django.utils.datastructures import MultiValueDict
from django.utils.encoding import force_str, force_text
from django.utils.fu... |
"""
@author: AAron Walters and Nick Petroni
@license: GNU General Public License 2.0
@contact: <EMAIL>, <EMAIL>
@organization: Volatility Foundation
"""
#pylint: disable-msg=C0111
import volatility.win32.tasks as tasks
def lsmod(addr_space):
""" A Generator for modules """
for m in tasks.get_... |
"""
Analyze a historical week to understand Firefox churn.
"""
import healthreportutils
from datetime import date, datetime, timedelta
import os, shutil, csv
import sys, codecs
import traceback
import mrjob
from mrjob.job import MRJob
import tempfile
try:
import simplejson as json
except ImportError:
import ... |
"""Prints the information in a sln file in a diffable way.
It first outputs each projects in alphabetical order with their
dependencies.
Then it outputs a possible build order.
"""
__author__ = 'nsylvain (Nicolas Sylvain)'
import os
import re
import sys
import pretty_vcproj
def BuildProject(project, built... |
import math
import json
import weakref
from jmespath import exceptions
from jmespath.compat import string_type as STRING_TYPE
from jmespath.compat import get_methods
# python types -> jmespath types
TYPES_MAP = {
'bool': 'boolean',
'list': 'array',
'dict': 'object',
'NoneType': 'null',
'unicode':... |
"""Google Storage specific Files API calls."""
from __future__ import with_statement
__all__ = ['create']
import os
import re
from urllib import urlencode
from xml.dom import minidom
from google.appengine.api import app_identity
from google.appengine.api import urlfetch
from google.appengine.api.files import ... |
# -----------------------------------------------------------------------
# This is an example illustrating how to implement a CLI
# (c) Hex-Rays
#
from idaapi import NW_OPENIDB, NW_CLOSEIDB, NW_TERMIDA, NW_REMOVE, COLSTR, cli_t
#<pycode(ex_cli_ex1)>
class mycli_t(cli_t):
flags = 0
sname = "pycli"
... |
import time
from datetime import date, datetime, timedelta
from openerp.osv import fields, osv
from openerp.tools import float_compare, float_is_zero
from openerp.tools.translate import _
class hr_payslip(osv.osv):
'''
Pay Slip
'''
_inherit = 'hr.payslip'
_description = 'Pay Slip'
_columns = ... |
import time
from datetime import date, datetime, timedelta
from openerp.osv import fields, osv
from openerp.tools import float_compare, float_is_zero
from openerp.tools.translate import _
class hr_payslip(osv.osv):
'''
Pay Slip
'''
_inherit = 'hr.payslip'
_description = 'Pay Slip'
_columns = ... |
from __future__ import unicode_literals
import importlib
import logging
import re
from django.conf import settings
from stackdio.core.config import StackdioConfigException
logger = logging.getLogger(__name__)
def get_provider_driver_class(provider):
provider_classes = get_cloud_providers()
for provider_cla... |
from lxml import etree
import webob
from nova.api.openstack.compute.contrib import extended_server_attributes
from nova import compute
from nova import db
from nova import exception
from nova.objects import instance as instance_obj
from nova.openstack.common import jsonutils
from nova import test
from nova.tests.api.o... |
from django.test import TestCase,Client
from httmock import urlmatch, response, HTTMock
import os
from django.contrib.auth.models import User
from django.template.defaultfilters import slugify
from .models import *
def register_valid_proxy(name,url,refresh=100):
p = SourceDocument.objects.create(Name=name,Source... |
from __future__ import annotations # isort:skip
import pytest ; pytest
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
# External imports
from flaky import flaky
# Bokeh imports
from bokeh._testin... |
"""
Some unit tests for the S3 Bucket
"""
from mock import patch, Mock
import unittest
import time
from boto.exception import S3ResponseError
from boto.s3.connection import S3Connection
from boto.s3.bucketlogging import BucketLogging
from boto.s3.lifecycle import Lifecycle
from boto.s3.lifecycle import Transition
fro... |
from __future__ import unicode_literals
import json
import re
from .common import InfoExtractor
from ..compat import compat_str
from ..utils import (
int_or_none,
try_get,
)
class TEDIE(InfoExtractor):
IE_NAME = 'ted'
_VALID_URL = r'''(?x)
(?P<proto>https?://)
(?P<type>www|embed(?:-... |
"""WebSocket utilities."""
import array
import errno
# Import hash classes from a module available and recommended for each Python
# version and re-export those symbol. Use sha and md5 module in Python 2.4, and
# hashlib module in Python 2.6.
try:
import hashlib
md5_hash = hashlib.md5
sha1_hash = hashlib... |
import json
import logging
import mongoengine as me
import rmc.shared.util as util
class AggregateRating(me.EmbeddedDocument):
rating = me.FloatField(min_value=0.0, max_value=1.0, default=0.0)
count = me.IntField(min_value=0, default=0)
sorting_score_positive = me.FloatField(
min_value=0.0, max_... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
GdalAlgorithmTests.py
---------------------
Date : January 2016
Copyright : (C) 2016 by Matthias Kuhn
Email : <EMAIL>
***********************************... |
import os
import smtplib
import json
from ansible.plugins.callback import CallbackBase
def mail(subject='Ansible error mail', sender=None, to=None, cc=None, bcc=None, body=None, smtphost=None):
if sender is None:
sender='<root>'
if to is None:
to='root'
if smtphost is None:
smtphos... |
"""
Django settings for example project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
im... |
from CIM15.IEC61970.Core.IdentifiedObject import IdentifiedObject
class BasePower(IdentifiedObject):
"""The BasePower class defines the base power used in the per unit calculations.The BasePower class defines the base power used in the per unit calculations.
"""
def __init__(self, basePower=0.0, *args, **... |
import handlers
from treeio.core.api.auth import auth_engine
from treeio.core.api.doc import documentation_view
from treeio.core.api.resource import CsrfExemptResource
from django.conf.urls import *
ad = {'authentication': auth_engine}
# finance resources
currencyResource = CsrfExemptResource(handler=handlers.Curren... |
import os
import time
from gi.repository import Gtk
from bcloud import Config
_ = Config._
from bcloud import util
from bcloud.Widgets import LeftLabel
from bcloud.Widgets import SelectableLeftLabel
(PIXBUF_COL, NAME_COL, PATH_COL, TOOLTIP_COL, SIZE_COL, HUMAN_SIZE_COL,
ISDIR_COL, MTIME_COL, HUMAN_MTIME_COL, TYP... |
# -*- coding: utf-8 -*-
import logging
import pprint
import werkzeug
from openerp import http, SUPERUSER_ID
from openerp.http import request
_logger = logging.getLogger(__name__)
class OgoneController(http.Controller):
_accept_url = '/payment/ogone/test/accept'
_decline_url = '/payment/ogone/test/decline'
... |
"""
The :mod:`sklearn.covariance` module includes methods and algorithms to
robustly estimate the covariance of features given a set of points. The
precision matrix defined as the inverse of the covariance is also estimated.
Covariance estimation is closely related to the theory of Gaussian Graphical
Models.
"""
from ... |
import re
from datetime import datetime
from html import unescape
from pathlib import Path
from random import choice, random
from typing import List, Tuple, Union
from aiohttp_wrapper import SessionManager
from discord import Embed, File
from minoshiro import Medium, Site
from bot.anime_searcher import AnimeSearcher
... |
#!/usr/bin/python
"""Create new scenario test instance from an existing results directory.
This automates creation of regression tests for the results parsers.
There are 2 primary use cases for this.
1) Bug fixing: Parser broke on some input in the field and we want
to start with a test that operates on that input an... |
import unittest
import mock
from airflow.exceptions import AirflowException
from airflow.providers.amazon.aws.hooks.sagemaker import SageMakerHook
from airflow.providers.amazon.aws.operators.sagemaker_transform import SageMakerTransformOperator
role = 'arn:aws:iam:role/test-role'
bucket = 'test-bucket'
key = 'test... |
from django.db.backends.sqlite3.schema import DatabaseSchemaEditor
from django.db.utils import DatabaseError
class SpatialiteSchemaEditor(DatabaseSchemaEditor):
sql_add_geometry_column = (
"SELECT AddGeometryColumn(%(table)s, %(column)s, %(srid)s, "
"%(geom_type)s, %(dim)s, %(null)s)"
)
sq... |
# -*- coding: utf-8 -*-
"""Django CMS come with a set of ready to use widgets that you can enable
in the admin via a placeholder tag in your template."""
from pages.settings import PAGES_MEDIA_URL, PAGE_TAGGING
from pages.settings import PAGE_TINYMCE, PAGE_LANGUAGES
from pages.models import Page
from pages.widgets_reg... |
from pyanaconda.ui.tui.spokes import StandaloneTUISpoke
from pyanaconda.ui.tui.hubs.summary import SummaryHub
from pyanaconda.core.i18n import N_, _
from pyanaconda.core.util import is_unsupported_hw
from pyanaconda.product import productName
from simpleline.render.widgets import TextWidget
from pyanaconda.anaconda_... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
try:
import boto
import boto.redshift
HAS_BOTO = True
except ImportError:
H... |
import scipy
from scipy import *
import seqload
import sys, argparse
from Bio.Alphabet import IUPAC
def getLq(J):
L = int(((1+sqrt(1+8*J.shape[0]))/2) + 0.5)
q = int(sqrt(J.shape[1]) + 0.5)
return L, q
def energies(s, J):
L, q = getLq(J)
pairenergy = zeros(s.shape[0])
for n,(i,j) in enumerate(... |
#!/usr/bin/env python
# coding: utf-8
"""
Tests for metrics module in machine learning.
"""
import unittest
from simpleai.machine_learning.metrics import Counter, OnlineEntropy, \
OnlineLogProbability, \
OnlineInformationGain
... |
"""Generic entry point script."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys as _sys
from tensorflow.python.platform import flags
from tensorflow.python.util.all_util import remove_undocumented
def run(main=None, argv=None):
"""Runs the ... |
from future import standard_library
standard_library.install_aliases()
import logging
import json
import re
import fnmatch
import configparser
from urllib.parse import urlparse
import boto
from boto.s3.connection import S3Connection
from boto.sts import STSConnection
boto.set_stream_logger('boto')
logging.getLogger("b... |
"""Lattice module.
In this module the lattice of the corresponding accelerator is defined.
"""
import math as _math
from pyaccel import lattice as _pyacc_lat, elements as _pyacc_ele, \
accelerator as _pyacc_acc, optics as _pyacc_opt
from . import segmented_models as _segmented_models
energy = 0.150e9 # [eV]
def... |
INITIALISED = False
babel = None
babelPresetEs2015 = None
def js6_to_js5(code):
global INITIALISED, babel, babelPresetEs2015
if not INITIALISED:
import signal, warnings, time
warnings.warn('\nImporting babel.py for the first time - this can take some time. \nPlease note that currently Javascrip... |
import pycurl
import StringIO
import sys
import string
import os
from os.path import expanduser
CROWDIN_KEY = ''
PROJECT_IDENTIFIER = 'ankidroid'
path = './AnkiDroid/src/main/res/values/'
files = ['01-core', '02-strings', '03-dialogs', '04-network', '05-feedback', '06-statistics', '07-cardbrowser', '08-widget', '09-... |
from nova import db
from nova import exception
from nova import objects
from nova.objects import base
from nova.objects import fields
OPTIONAL_FIELDS = ['extra_specs', 'projects']
class Flavor(base.NovaPersistentObject, base.NovaObject):
# Version 1.0: Initial version
# Version 1.1: Added save_projects(), s... |
import platform, os, logging_subprocess, random, string, logging, sys, json, urllib2, fileinput
logger = logging.getLogger()
string_pool = string.ascii_letters + string.digits
gen_random_text = lambda s: ''.join(map(lambda _: random.choice(string_pool), range(s)))
def run_command(cmd):
return not (logging_subpro... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.template.defaultfilters import truncatewords_html
from django.test import SimpleTestCase
class FunctionTests(SimpleTestCase):
def test_truncate_zero(self):
self.assertEqual(truncatewords_html('<p>one <a href="#">two - three <br>... |
import os
##
# Represents a file in the file system. Simplifies operations such as loading, saving, and
# tracking modifications outside of the process.
class File():
##
# Class initializer.
# @param filename Name of the file to load. If "None", will not be associated with a file until
# ... |
"""Provides HTTP functions for gdata.service to use on Google App Engine
AppEngineHttpClient: Provides an HTTP request method which uses App Engine's
urlfetch API. Set the http_client member of a GDataService object to an
instance of an AppEngineHttpClient to allow the gdata library to run on
Google App Engin... |
"""Unit test for the gtest_xml_output module."""
__author__ = "<EMAIL> (Keith Ray)"
import os
from xml.dom import minidom, Node
import gtest_test_utils
import gtest_xml_test_utils
GTEST_OUTPUT_SUBDIR = "xml_outfiles"
GTEST_OUTPUT_1_TEST = "gtest_xml_outfile1_test_"
GTEST_OUTPUT_2_TEST = "gtest_xml_outfile2_test_"
... |
"""
WSGI config for cigar_example project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICAT... |
import unittest, sys
from ctypes import *
import _ctypes_test
ctype_types = [c_byte, c_ubyte, c_short, c_ushort, c_int, c_uint,
c_long, c_ulong, c_longlong, c_ulonglong, c_double, c_float]
python_types = [int, int, int, int, int, int,
int, int, int, int, float, float]
class PointersT... |
"""Targets class describes which languages/platforms we support."""
__author__ = '<EMAIL> (Will Clarkson)'
import logging
import os
from googleapis.codegen.filesys import files
from googleapis.codegen.utilities import json_expander
from googleapis.codegen.utilities import json_with_comments
class Targets(object):... |
"""Extensions to the 'distutils' for large or complex distributions"""
import os
import sys
import distutils.core
import distutils.filelist
from distutils.core import Command as _Command
from distutils.util import convert_path
from fnmatch import fnmatchcase
import setuptools.version
from setuptools.extension import ... |
import logging
import traceback
from datetime import date
from django.conf import settings
from django.contrib.sites.models import Site
from django.db import connection, transaction
# NOTE: This import is just so _fire_task gets registered with celery.
import tidings.events # noqa
from celery import task
from multid... |
# coding: utf-8
import logging
import requests
from odoo import api, fields, models, _
from odoo.addons.payment.models.payment_acquirer import ValidationError
from odoo.exceptions import UserError
from odoo.tools.safe_eval import safe_eval
_logger = logging.getLogger(__name__)
# Force the API version to avoid break... |
# -*- coding: utf-8 -*-
"""
hyperframe/flags
~~~~~~~~~~~~~~~~
Defines basic Flag and Flags data structures.
"""
import collections
Flag = collections.namedtuple("Flag", ["name", "bit"])
class Flags(collections.MutableSet):
"""
A simple MutableSet implementation that will only accept known flags as elements... |
import re
from io import BytesIO
from time import sleep
from livestreamer.exceptions import PluginError
from livestreamer.packages.flashmedia import AMFPacket, AMFMessage
from livestreamer.packages.flashmedia.types import AMF3ObjectBase
from livestreamer.plugin import Plugin
from livestreamer.plugin.api import http, ... |
"""Tests for waitress.channel maintenance logic
"""
import doctest
class FakeSocket: # pragma: no cover
data = ''
setblocking = lambda *_: None
close = lambda *_: None
def __init__(self, no):
self.no = no
def fileno(self):
return self.no
def getpeername(self):
return ... |
"""Unit tests for coverage_posix.py.
Run a single test with a command such as:
./coverage_posix_unittest.py CoveragePosixTest.testFindTestsAsArgs
Waring that running a single test like that may interfere with the arg
parsing tests, since coverage_posix.py uses optparse.OptionParser()
which references globals.
"""
... |
from django.db import models
from jsonfield import JSONField
from .permissions import UserCanReadExamAssignmentData
from .permissions import UserCanReadExamData
from kolibri.core.auth.constants import role_kinds
from kolibri.core.auth.models import AbstractFacilityDataModel
from kolibri.core.auth.models import Collect... |
import errno, os
FUTEX_WAIT = 0
FUTEX_WAKE = 1
FUTEX_PRIVATE_FLAG = 128
FUTEX_CLOCK_REALTIME = 256
FUTEX_CMD_MASK = ~(FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME)
NSECS_PER_SEC = 1000000000
def avg(total, n):
return total / n
def nsecs(secs, nsecs):
return secs * NSECS_PER_SEC + nsecs
def nsecs_secs(nsecs... |
"""Timezone helper functions.
This module uses pytz when it's available and fallbacks when it isn't.
"""
from datetime import datetime, timedelta, tzinfo
from threading import local
import time as _time
try:
import pytz
except ImportError:
pytz = None
from django.conf import settings
__all__ = [
'utc',... |
import unittest
import os
import commands
import comm
import time
class TestPrivateNotesAppBuild(unittest.TestCase):
def test_close(self):
comm.setUp()
app_name = "privateNotes"
pkg_name = "com.example." + app_name
if not comm.check_app_installed(pkg_name, self):
comm.a... |
"""
Tests to verify that CorrectMap behaves correctly
"""
import unittest
from capa.correctmap import CorrectMap
import datetime
class CorrectMapTest(unittest.TestCase):
"""
Tests to verify that CorrectMap behaves correctly
"""
def setUp(self):
super(CorrectMapTest, self).setUp()
sel... |
from .bases import _StandardStemmer
from whoosh.compat import u
class DutchStemmer(_StandardStemmer):
"""
The Dutch Snowball stemmer.
:cvar __vowels: The Dutch vowels.
:type __vowels: unicode
:cvar __step1_suffixes: Suffixes to be deleted in step 1 of the algorithm.
:type __step1_suffixes: t... |
import time
# Register addresses.
MPR121_I2CADDR_DEFAULT = 0x5A
MPR121_TOUCHSTATUS_L = 0x00
MPR121_TOUCHSTATUS_H = 0x01
MPR121_FILTDATA_0L = 0x04
MPR121_FILTDATA_0H = 0x05
MPR121_BASELINE_0 = 0x1E
MPR121_MHDR = 0x2B
MPR121_NHDR = 0x2C
MPR121_NCLR = 0x2D
MPR121_FDLR ... |
#!/usr/bin/env python
"""
Python script for building documentation.
To build the docs you must have all optional dependencies for pandas
installed. See the installation instructions for a list of these.
<del>Note: currently latex builds do not work because of table formats that are not
supported in the latex generat... |
"""Prints the information in a sln file in a diffable way.
It first outputs each projects in alphabetical order with their
dependencies.
Then it outputs a possible build order.
"""
__author__ = 'nsylvain (Nicolas Sylvain)'
import os
import re
import sys
import pretty_vcproj
def BuildProject(project, built... |
from openerp.osv import osv, fields
# TODO for trunk, remove me
class MailThread(osv.AbstractModel):
_inherit = 'mail.thread'
_columns = {
'website_message_ids': fields.one2many(
'mail.message', 'res_id',
domain=lambda self: [
'&', ('model', '=', self._name), ('... |
#!/usr/bin/env python
'''
sweety.loader
This module contains the functions for loading modules.
@author: Chris Chou <m2chrischou AT gmail.com>
@description:
'''
import os
import sys
import traceback
from sweety.log import get_logger
def load_file(filename):
'''
load_file(filename) -> module
Loads... |
import os
try:
from pyvcloud.vcloudair import VCA
HAS_PYVCLOUD = True
except ImportError:
HAS_PYVCLOUD = False
from ansible.module_utils.basic import AnsibleModule
SERVICE_MAP = {'vca': 'ondemand', 'vchs': 'subscription', 'vcd': 'vcd'}
LOGIN_HOST = {'vca': 'vca.vmware.com', 'vchs': 'vchs.vmware.com'}
DEF... |
from frappe import _
def get_data():
return [
{
"label": _("Documents"),
"icon": "icon-star",
"items": [
{
"type": "doctype",
"name": "Lead",
"description": _("Database of potential customers."),
},
{
"type": "doctype",
"name": "Customer",
"description": _("Custome... |
###############################################
# Snakemake rules associated with combined
# analysis of each biosample from subsample resutls
# this file must be included into another
# Snakemake file
###############################################
# rename each contig with subsample information
# this rule is no lo... |
import datetime
from django.contrib.auth.models import User
from django.shortcuts import render_to_response
from django.template.context import RequestContext
from django.views.generic.list_detail import object_list
from taggit.models import Tag
from cab.models import Snippet, Language, Bookmark
from cab.utils impor... |
import 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):
super(GpMgm... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('instruct... |
from django.contrib.gis.gdal import OGRException
from django.contrib.gis.geos import GEOSGeometry, GEOSException
from django.forms.widgets import Textarea
from django.template.loader import render_to_string
class OpenLayersWidget(Textarea):
"""
Renders an OpenLayers map using the WKT of the geometry.
"""
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.