content stringlengths 4 20k |
|---|
import os
# core to be use
USE_CORE = 'CORE_M0'
# toolchains options
ARCH='arm'
CPU = 'cortex-m0'
CROSS_TOOL='keil'
# get setting from environment.
if os.getenv('RTT_CC'):
CROSS_TOOL = os.getenv('RTT_CC')
# cross_tool provides the cross compiler
# EXEC_PATH is the compiler execute path, for example, Code... |
# -*- coding: utf-8 -*-
from sphinx.ext.autodoc import Documenter, ClassDocumenter
from sphinx.ext.autodoc import setup as core_setup
from sphinx.locale import _
class KivyClassDocumenter(ClassDocumenter):
def add_directive_header(self, sig):
if self.doc_as_attr:
self.directivetype = 'attribut... |
import sys
from artiq import *
class Mandelbrot(EnvExperiment):
"""Mandelbrot set demo"""
def build(self):
self.setattr_device("core")
def col(self, i):
sys.stdout.write(" .,-:;i+hHM$*#@ "[i])
def row(self):
print("")
# based on: http://warp.povusers.org/MandScripts/py... |
### Mail to user
#PBS -m ae
### Queue name (small, medium, long, verylong)
#PBS -q verylong
### Number of nodes
#PBS -l nodes=1:opteron
"""Runs a very long EMT Verlet dynamics on a small system.
Usage:
python LongEMTsmall.py EMT
or
python LongEMTsmall.py EMT2013
"""
from asap3 import *
from asap3.EMT2013Par... |
import time
from openerp import pooler
from openerp.report import report_sxw
class payment_order(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context=None):
super(payment_order, self).__init__(cr, uid, name, context=context)
self.localcontext.update( {
'time': time,
... |
from django.contrib.auth.decorators import login_required
from django.template.context import RequestContext
from django.shortcuts import render_to_response
from django.shortcuts import redirect
from . import forms, markupfile
@login_required
def markup_files(request):
if request.method == 'POST':
if '... |
import logging
import parseexception
import fnmatch
import time
import metric
import defaults
class LiveData(object):
def __init__(self, metricPatterns, interval, metric_source):
logging.info('will query metric_source every {0} seconds'.format(interval))
self._startedAt = time.time()
self.... |
# -*- coding: utf-8 -*-
from typing import Text
from zerver.lib.test_classes import WebhookTestCase
class PagerDutyHookTests(WebhookTestCase):
STREAM_NAME = 'pagerduty'
URL_TEMPLATE = u"/api/v1/external/pagerduty?api_key={api_key}&stream={stream}"
FIXTURE_DIR_NAME = 'pagerduty'
def test_trigger(self):... |
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from .soundcloud import SoundcloudIE
from ..utils import ExtractorError
import time
class AudiomackIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?audiomack\.com/song/(?P<id>[\w/-]+)'
IE_NAME = 'audiomack'
_TE... |
"""tests the "bind" attribute/argument across schema and SQL,
including the deprecated versions of these arguments"""
from sqlalchemy.testing import assert_raises, assert_raises_message
from sqlalchemy import engine, exc
from sqlalchemy import MetaData, ThreadLocalMetaData
from sqlalchemy import Integer, text
from sql... |
# -*- coding: utf-8 -*-
# Usage: py.test tests
import pykeyvi
from test_tools import tmp_dictionary, decode_to_unicode
def test_serialization():
m = pykeyvi.Match()
m.SetStart(22)
m.SetEnd(30)
d = m.dumps()
m2 = pykeyvi.Match.loads(d)
assert m2.GetStart() == 22
assert m2.GetEnd() == 30
... |
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.utils import flt, getdate, add_days, formatdate
from frappe.model.document import Document
from datetime import date
from erpnext.controllers.item_variant import ItemTemplateCannotHaveStock
from erpnext.accounts.utils import get_fisc... |
"""Tokenization help for Python programs.
generate_tokens(readline) is a generator that breaks a stream of
text into Python tokens. It accepts a readline-like method which is called
repeatedly to get the next line of input (or "" for EOF). It generates
5-tuples with these members:
the token type (see token.py)
... |
from openerp.osv import fields, osv
from openerp.tools.translate import _
class stock_invoice_onshipping(osv.osv_memory):
_inherit = "stock.invoice.onshipping"
def _get_journal_type(self, cr, uid, context=None):
if context is None:
context = {}
res_ids = context and context.get... |
import datetime
import json
import os
import logging
from dci_umb.sender import send
logger = logging.getLogger(__name__)
def _get_architecture(job):
arch = "x86_64"
available_arches = ["x86_64", "ppc64le", "aarch64", "s390x"]
for available_arch in available_arches:
if available_arch in job["tag... |
from __future__ import absolute_import, print_function, unicode_literals, division
from flask.ext.restful import Resource
from jormungandr.modules_loader import ModulesLoader
from jormungandr.interfaces.v1.make_links import create_external_link
def index(api):
api.add_resource(Index, '/')
class Index(Resource):... |
""" i/o utilities """
import numpy as np
def get_edgelist(f_edgelist, delimiter=None):
"""
This function returns an edgelist list from a file.
Parameters
----------
f_edgelist : ``str``
The path to the edgelist text file.
delimiter : ``str``
The delimiter that separate the ed... |
import os, sys
import unittest
if os.path.exists("extended_setup.py"):
print "-" * 75
print "You should not run the test suite from the pysqlite build directory."
print "This does not work well because the extension module cannot be found."
print "Just run the test suite from somewhere else, please!"
... |
import collections
from portage import eapi_is_supported
def eapi_has_iuse_defaults(eapi):
return eapi != "0"
def eapi_has_iuse_effective(eapi):
return eapi not in ("0", "1", "2", "3", "4", "4-python", "4-slot-abi")
def eapi_has_slot_deps(eapi):
return eapi != "0"
def eapi_has_slot_operator(eapi):
return eapi ... |
from django.test import TestCase, Client, LiveServerTestCase, RequestFactory
from django.core.urlresolvers import resolve, reverse, reverse_lazy
from django.contrib.auth.models import User
from bucketlist.views import CreateBucketlistView, BucketlistView, DeleteUpdateBucketlistView
from django.contrib.messages.storage... |
"""
couchdb.resource
~~~~~~~~~~~~~~~~~~~~~~
This module providess a common interface for all CouchDB request. This
module makes HTTP request using :mod:`httplib2` module or :mod:`pycurl`
if available. Just use set transport argument for this.
Example:
>>> resource = CouchdbResource()
>>> info = resource.get(... |
from openerp.osv import fields, osv
class event_event(osv.osv):
_description = 'Portal event'
_inherit = 'event.event'
"""
``visibility``: defines if the event appears on the portal's event page
- 'public' means the event will appear for everyone (anonymous)
- '... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
import zipfile
from contextlib import contextmanager
from pants.backend.jvm.jar_dependency_utils import M2Coordinate
from pants.backend.jvm.targets.jar_depe... |
#!/usr/bin/env python
##################################################
# Gnuradio Python Flow Graph
# Title: Affinity Set Test
##################################################
from gnuradio import eng_notation
from gnuradio import gr
from gnuradio import blocks
from gnuradio import filter
from gnuradio.eng_option ... |
INFINITY = float('inf')
NEGATIVE_INFINITY = -INFINITY
class IntervalSet:
__slots__ = ('intervals', 'size')
def __init__(self, intervals, disjoint=False):
self.intervals = intervals
if not disjoint:
self.intervals = union_overlapping(self.intervals)
self.size = sum(i.size for i in self.interva... |
from numpy.testing import (run_module_suite, assert_, assert_allclose,
assert_raises, assert_equal)
import numpy as np
from scipy.optimize._lsq.common import (
step_size_to_bound, find_active_constraints, make_strictly_feasible,
CL_scaling_vector, intersect_trust_region, build_quadra... |
# -*- coding: utf-8 -*-
#
# Django documentation build configuration file, created by
# sphinx-quickstart on Thu Mar 27 09:06:53 2008.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# The contents of this file are pickled, so don't put values in the namespace
# that aren't pickleab... |
from rpython.rlib.objectmodel import instantiate
from rpython.jit.backend.arm.assembler import AssemblerARM
from rpython.jit.backend.arm.locations import imm, ConstFloatLoc
from rpython.jit.backend.arm.locations import RegisterLocation, StackLocation
from rpython.jit.backend.arm.locations import VFPRegisterLocation, ge... |
from test_base import MainTestCase
from main.views import home, show_submission
from odk_viewer.views import survey_responses
from django.core.urlresolvers import reverse
from guardian.shortcuts import assign_perm
class TestFormShowSubmission(MainTestCase):
def setUp(self):
MainTestCase.setUp(self)
... |
import re
class SYNReader:
def __init__(self, filename):
"""
Allow to read files of meteorological observations (SYNOPMAK or SYNOPDOP).
To work with the class, specify the path to the data file
:param filename: path to the file
:type filename: basestring
"""
... |
""" initial table creation commands
Revision ID: 50b6324aa438
Revises:
Create Date: 2015-06-25 22:09:39.345793
"""
# revision identifiers, used by Alembic.
revision = '50b6324aa438'
down_revision = None
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
import sqlalchemy_utils
im... |
from django.conf.urls import url
from bedrock.mozorg.util import page
from bedrock.security.views import (
mitre_cve_feed,
AdvisoriesView,
AdvisoryView,
HallOfFameView,
KVRedirectsView,
OldAdvisoriesListView,
OldAdvisoriesView,
ProductView,
ProductVersionView,
)
urlpatterns = (
... |
"""Celery command"""
from multiprocessing import Process
from typing import Optional
import daemon
import psutil
import sqlalchemy.exc
from celery import maybe_patch_concurrency
from celery.bin import worker as worker_bin
from daemon.pidfile import TimeoutPIDLockFile
from flower.command import FlowerCommand
from lock... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.apps import apps
from django.core import checks
from django.core.checks.registry import registry
from django.core.management.base import BaseCommand, CommandError
class Command(BaseCommand):
help = "Checks the entire Django project for p... |
"""This example gets all products created from a product template.
Tags: ProductService.getProductsByStatement
"""
__author__ = 'Nicholas Chen'
# Import appropriate modules from the client library.
from googleads import dfp
PRODUCT_TEMPLATE_ID = 'INSERT_PRODUCT_TEMPLATE_ID_HERE'
def main(client, product_template_... |
from __future__ import absolute_import
import hashlib
import logging
import traceback
from datetime import datetime, timedelta
from zerver.lib.str_utils import force_bytes
# Adapted http://djangosnippets.org/snippets/2242/ by user s29 (October 25, 2010)
class _RateLimitFilter(object):
last_error = datetime.min
... |
#!/usr/bin/python
#
# File: manage_course_groups
#
# interactively list and edit membership in course staff and instructor groups
import re
from django.core.management.base import BaseCommand
from django.contrib.auth.models import User, Group
#-----------------------------------------------------------------------... |
"see __init__ for docstring"
import json
from catalogService_test import mockedData
from mint.mint_error import TargetExists, TargetMissing
class Authorization(object):
def __init__(self, **kwargs):
self.__dict__.update(kwargs)
class Build(object):
def __init__(self, buildId, buildData):
self... |
from nova import context
from nova import objects
from nova.objects import fields as obj_fields
from nova import test
from nova.tests import uuidsentinel
_HOSTNAME = 'fake-host'
_NODENAME = 'fake-node'
_VIRT_DRIVER_AVAIL_RESOURCES = {
'vcpus': 4,
'memory_mb': 512,
'local_gb': 6,
'vcpus_used': 0,
'... |
"""
Tests for Volume replication code.
"""
import mock
from oslo_config import cfg
from oslo_utils import importutils
from cinder import context
from cinder import db
from cinder import exception
from cinder import test
from cinder.tests.unit import utils as test_utils
from cinder.volume import driver
CONF = cfg.CO... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import textwrap
import os
import random
import subprocess
import sys
from ansible import constants as C
from ansible.errors import AnsibleError
from ansible.utils.color import stringc
from ansible.utils.unicode import to_bytes
cl... |
from copy import deepcopy
from utils import slugify
class Award:
def __init__(self, name, img_url, description):
self.name = name
if not img_url:
self.img_url = "media/awards/" + slugify(name).lower() + ".png"
else:
self.img_url = "media/awards/" + img_url
self.description = description
self.value = ... |
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
x1, y1 = 0.3, 0.3
x2, y2 = 0.7, 0.7
fig = plt.figure(1)
fig.clf()
from mpl_toolkits.axes_grid.axes_grid import Grid
from mpl_toolkits.axes_grid.anchored_artists import AnchoredText
from matplotlib.font_manager import FontProperties
def add_at(ax,... |
import sys
if sys.version_info[0] >= 3: # Python 3
import tkinter as tk
from tkinter import ttk
from tkinter import messagebox as msgbox
else:
import Tkinter as tk
import tkMessageBox as msgbox
import ttk
import pjsua2 as pj
import log
import accountsetting
import account
import b... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf.urls import url
from django.contrib.auth import views as auth_views
from django.contrib.auth.decorators import login_required
from django.views.decorators.cache import cache_page
from django.views.generic import TemplateView
from . impor... |
import pytest
from selenium.webdriver import Firefox
@pytest.fixture
def capabilities():
capabilities = {'marionette': False}
return capabilities
@pytest.fixture
def driver(capabilities):
driver = Firefox(capabilities=capabilities)
yield driver
driver.quit() |
import os
DEBUG = True
ADMINS = (
# ('Your Name', '<EMAIL>'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'chariot',
'USER': 'chariot',
'PASSWORD': 'chariot',
'HOST': 'db',
}
}
# Local time zone for t... |
from __future__ import unicode_literals, division, absolute_import
import logging
from flexget import plugin
from flexget.event import event
from flexget.utils.template import RenderError, render_from_task
log = logging.getLogger('notify_xmpp')
try:
import sleekxmpp
class SendMsgBot(sleekxmpp.ClientXMP... |
"""
Authentication example using Flask-Login
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This provides a simple example of using Flask-Login as the authentication
framework which can guard access to certain API endpoints.
This requires the following Python libraries to be installed:
* Flask
... |
"""
Tests for the Badges app models.
"""
from django.core.exceptions import ValidationError
from django.core.files.images import ImageFile
from django.db.utils import IntegrityError
from django.test import TestCase
from django.test.utils import override_settings
from mock import patch, Mock
from nose.plugins.attrib imp... |
"""Utilities for OAuth.
Utilities for making it easier to work with OAuth 2.0
credentials.
"""
__author__ = '<EMAIL> (Joe Gregorio)'
import os
import threading
from oauth2client.client import Credentials
from oauth2client.client import Storage as BaseStorage
class CredentialsFileSymbolicLinkError(Exception):
""... |
"""Utilities for meta-estimators"""
# Andreas Mueller
# Licence: BSD
from operator import attrgetter
from functools import update_wrapper
__all__ = ['if_delegate_has_method']
class _IffHasAttrDescriptor(object):
"""Implements a conditional property using the descriptor protocol.
Using this class t... |
"""
Contains classes and utilities that help publishing a hyde website to
distributed version control systems.
"""
from hyde.publisher import Publisher
import abc
from subprocess import Popen, PIPE
class DVCS(Publisher):
__metaclass__ = abc.ABCMeta
def initialize(self, settings):
self.settings = se... |
#!/usr/bin/python -N
"""
framework tests
(C) 2008 Guillaume 'Charlie' Chereau <<EMAIL>>
(C) 2008 Michael 'Mickey' Lauer <<EMAIL>>
(C) 2008 Openmoko, Inc.
GPLv2 or later
"""
import unittest
import gobject
import threading
import dbus
from dbus.mainloop.glib import DBusGMainLoop
DBusGMainLoop(set_as_default=True)
impo... |
"""
Template file used by ExpGenerator to generate the actual
permutations.py file by replacing $XXXXXXXX tokens with desired values.
This permutations.py file was generated by:
'/Users/ronmarianetti/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/ExpGenerator.py'
"""
import os
from nupic.swa... |
import numpy as np
import scipy.sparse as sp
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_false
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_not_equal
from sklearn.utils.testing imp... |
import copy
from oslo.config import cfg
database_opts = [
cfg.StrOpt('sqlite_db',
deprecated_group='DEFAULT',
default='nova.sqlite',
help='The file name to use with SQLite'),
cfg.BoolOpt('sqlite_synchronous',
deprecated_group='DEFAULT',
... |
from __future__ import division, absolute_import, print_function, unicode_literals
from awlsim.common.compat import *
from awlsim.core.instructions.main import * #@nocy
from awlsim.core.operators import *
#from awlsim.core.instructions.main cimport * #@cy
class AwlInsn_SPS(AwlInsn): #+cdef
__slots__ = ()
def __i... |
import unittest
from cStringIO import StringIO
from ..backends import static
# There aren't many tests here because it turns out to be way more convenient to
# use test_serializer for the majority of cases
class TestStatic(unittest.TestCase):
def compile(self, input_text, input_data):
return static.com... |
import mergevcf.mergedfile as mergedfile
import argparse
import os
import sys
def main():
"""Merge VCF files, output to stdout or file"""
defsvwindow = 100
parser = argparse.ArgumentParser(description='Merge calls in VCF files')
parser.add_argument('input_files', nargs='+', help='Input VCF files')
... |
from os.path import abspath
import unittest
from coalib.results.Result import Result, RESULT_SEVERITY
from coalib.results.Diff import Diff
from coalib.results.SourceRange import SourceRange
class ResultTest(unittest.TestCase):
def test_origin(self):
uut = Result("origin", "msg")
self.assertEqual... |
from __future__ import unicode_literals
import os.path
from pre_commit.languages.ruby import _install_rbenv
from testing.util import xfailif_windows_no_ruby
@xfailif_windows_no_ruby
def test_install_rbenv(cmd_runner):
_install_rbenv(cmd_runner)
# Should have created rbenv directory
assert os.path.exists... |
from __future__ import unicode_literals, division, absolute_import
import logging
from flexget import plugin
from flexget.event import event
from flexget.utils.log import log_once
log = logging.getLogger('thetvdb')
class FilterTvdb(object):
"""
This plugin allows filtering based on thetvdb series rating... |
from __future__ import division
from itertools import combinations
import cPickle as pickle
import sys
import pylab
import numpy as np
class PLattice:
def __init__(self, dimension, initial_value, temperature, seed=None):
# create an array storing the values on the lattice and set them
#... |
from cerbero.config import Variants
from cerbero.commands import Command, register_command
from cerbero.build.cookbook import CookBook
from cerbero.utils import _, N_
from cerbero.utils import messages as m
from cerbero.packages.packagesstore import PackagesStore
class List(Command):
doc = N_('List all the availa... |
"""Manage HTTP servers with CherryPy."""
import warnings
import cherrypy
from cherrypy.lib import attributes
from cherrypy._cpcompat import basestring, py3k
# We import * because we want to export check_port
# et al as attributes of this module.
from cherrypy.process.servers import *
class Server(ServerAdapter):
... |
import os
import re
from oslo_serialization import jsonutils
from oslo_utils import importutils
import six
from nova import test
from nova.tests.functional import integrated_helpers
class NoMatch(test.TestingException):
pass
class ApiSampleTestBase(integrated_helpers._IntegratedTestBase):
ctype = 'json'
... |
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
parse_duration,
unified_strdate,
)
class HuffPostIE(InfoExtractor):
IE_DESC = 'Huffington Post'
_VALID_URL = r'''(?x)
https?://(embed\.)?live\.huffingtonpost\.com/
(?:
... |
from django.db import models
from django.contrib.contenttypes.models import ContentType
from django.contrib.auth.models import User
from django.contrib.admin.util import quote
from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import smart_unicode
from django.utils.safestring impor... |
from os import path
import logging
from blazeweb.globals import settings
from logging.handlers import RotatingFileHandler
APPLICATION = 25
class Logger(logging.Logger):
def application(self, msg, *args, **kwargs):
"""
a convenience function for logging messages at level 25, which
... |
import unittest
import imath
import IECore
import IECoreScene
import GafferScene
import GafferSceneTest
class MeshDistortionTest( GafferSceneTest.SceneTestCase ) :
def test( self ) :
# Input is a plane stretched in X
plane = IECoreScene.MeshPrimitive.createPlane(
imath.Box2f( imath.V2f( -1 ), imath.V2f( 1... |
"""This code example gets all creatives.
To create creatives, run create_creatives.py.
The LoadFromStorage method is pulling credentials and properties from a
"googleads.yaml" file. By default, it looks for this file in your home
directory. For more information, see the "Caching authentication information"
section of... |
"""Provides methods needed by installation script for OpenStack development
virtual environments.
Since this script is used to bootstrap a virtualenv from the system's Python
environment, it should be kept strictly compatible with Python 2.6.
Synced in from openstack-common
"""
from __future__ import print_function
... |
from sos.plugins import Plugin, RedHatPlugin
class Keepalived(Plugin, RedHatPlugin):
"""Keepalived routing server
"""
plugin_name = 'keepalived'
profiles = ('webserver', 'network', 'cluster')
packages = ('keepalived',)
def setup(self):
self.add_copy_spec([
"/etc/keepaliv... |
# -*- coding: utf-8 -*-
''' Read a xls with Contracts and insert them in the DB.
Usage:
./import_contrato [FILE] [LINES_PER_INSERT]
./import_contrato (-h | --help)
Options:
-h --help Show this message.
'''
import pandas as pd
import numpy as np
from datetime import datetime, timedelta
import calendar
f... |
import unittest
from datetime import timedelta
from streamsx.topology.topology import *
from streamsx.topology import schema
from streamsx.topology.tester import Tester
import streamsx.spl.op as op
import streamsx.spl.toolkit
import spl_tests_utils as stu
class TestMT(unittest.TestCase):
_multiprocess_can_split_... |
import threading
import time as mod_time
import uuid
from redis.exceptions import LockError, WatchError
from redis.utils import dummy
from redis._compat import b
class Lock(object):
"""
A shared, distributed Lock. Using Redis for locking allows the Lock
to be shared across processes and/or machines.
... |
"""Provide a way to connect entities belonging to one device."""
import logging
import uuid
from collections import OrderedDict
import attr
from homeassistant.core import callback
from homeassistant.loader import bind_hass
_LOGGER = logging.getLogger(__name__)
_UNDEF = object()
DATA_REGISTRY = 'device_registry'
S... |
#!/usr/bin/env python
import sys
import pickle
import traceback
class NullDevice():
def write(self, s):
pass
# Prevent use of stdout, as it disrupts pickling mechanism
old_stdout = sys.stdout
sys.stdout = NullDevice()
# log initialization must be done only AFTER rerouting stdout
from gppylib import gplo... |
# -*-: coding utf-8 -*-
"""The microphone setup command."""
import time
from ...base import Base
from ....utils.os_helpers import is_raspi_os, is_node_available, which, file_exists
from ....utils.systemd import Systemd
from ....utils.snipsfile import Snipsfile
from .... import NODE_MODULES_DIR, DEFAULT_SNIPSFILE_PAT... |
from matplotlib.backend_bases import FigureCanvasBase
from matplotlib.backend_bases import RendererBase
from matplotlib.testing.decorators import image_comparison, cleanup
import matplotlib.pyplot as plt
import matplotlib.transforms as transforms
import matplotlib.path as path
from nose.tools import assert_equal
imp... |
from pyface.tasks.traits_dock_pane import TraitsDockPane
from pyface.tasks.traits_task_pane import TraitsTaskPane
from traits.api import Int, Property
from traitsui.api import View, UItem, VGroup, ListStrEditor, TabularEditor, EnumEditor
from traitsui.tabular_adapter import TabularAdapter
# ============= standard lib... |
"""
Database models for the LTI provider feature.
This app uses migrations. If you make changes to this model, be sure to create
an appropriate migration file and check it in at the same time as your model
changes. To do that,
1. Go to the edx-platform dir
2. ./manage.py lms schemamigration lti_provider --auto "descr... |
from grit.format.policy_templates.writers import template_writer
NEWLINE = '\r\n'
def GetWriter(config):
'''Factory method for creating AdmWriter objects.
See the constructor of TemplateWriter for description of
arguments.
'''
return AdmWriter(['win'], config)
class IndentedStringBuilder:
'''Utility c... |
import Queue
import multiprocessing
import threading
import sys
from collections import Iterable
from .common import log
class EventWriter(object):
def __init__(self, process_safe=False):
if process_safe:
self._mgr = multiprocessing.Manager()
self._event_queue = self._mgr.Queue(10... |
"""
Helper lib for instructor_tasks API.
Includes methods to check args for rescoring task, encoding student input,
and task submission logic, including handling the Celery backend.
"""
import hashlib
import json
import logging
from django.utils.translation import ugettext as _
from util.db import outer_atomic
from ... |
"""
This has a series of utility functions that aren't related to
classes in the application, but are useful in a variety of places.
"""
import string, re, time
ANSI_COLOR_REGEXP = re.compile(chr(27) + '\[[0-9;]*[mJ]')
def color(data, fc=37, bc=40, bold=0):
if bold == 1:
return "%c[1;%s;%sm%s%c[0m" % (chr(27), ... |
"""
Mixin to include for Paginated container pages
"""
from selenium.webdriver.common.keys import Keys
class PaginatedMixin(object):
"""
Mixin class used for paginated page tests.
"""
def nav_disabled(self, position, arrows=('next', 'previous')):
"""
Verifies that pagination nav is dis... |
from hum_proto import main
class TestMain(object):
def test_base(self, mocker):
mock_get_ctx = mocker.patch.object(
main.ssl_utils, 'get_ctx', side_effect=['cli', 'srv']
)
mock_connect = mocker.patch.object(main.apploop, 'connect')
sock = mock_connect.return_value
... |
# coding: utf-8
from __future__ import unicode_literals
import time
import math
import os.path
import re
from .common import InfoExtractor
from ..compat import (
compat_html_parser,
compat_urllib_parse,
compat_urllib_request,
compat_urlparse,
)
from ..utils import ExtractorError
class GroovesharkHt... |
"""Unit tests for filter_syms.py"""
import cStringIO
import ntpath
import os
import StringIO
import sys
import unittest
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, os.path.join(ROOT_DIR, '..'))
# In root
import filter_syms
class FilterSysmsTest(unittest.TestCase):
def assertParsed(sel... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
# import module snippets
from ansible.module_utils.basic import AnsibleModule
from ansible.m... |
""" Module for fitting graphs to file """
import matplotlib.pyplot as plt
from plotengine import PlotEngine
# pylint: disable=E1101
import numpy as np
from scipy.optimize import curve_fit
class FitEngine(PlotEngine):
""" Class that performs fitting and saving of plots. """
functions = {"lin": (lambda x, a, ... |
from google.appengine._internal.django.core.exceptions import ImproperlyConfigured
from google.appengine._internal.django.core.management.base import BaseCommand, CommandError
from google.appengine._internal.django.core import serializers
from google.appengine._internal.django.db import connections, router, DEFAULT_DB_... |
'''ASN.1 definitions.
Not all ASN.1-handling code use these definitions, but when it does, they should be here.
'''
from pyasn1.type import univ, namedtype, tag
class PubKeyHeader(univ.Sequence):
componentType = namedtype.NamedTypes(
namedtype.NamedType('oid', univ.ObjectIdentifier()),
namedtype.... |
from osv import fields, osv
class IrModelAccess(osv.osv):
"We inherit ir model access to add specific write unlink and copy behavior"
_name = 'ir.model.access'
_inherit = "ir.model.access"
def _acces_can_be_modified(self, cr, uid, context=None):
context = context or {}
... |
# encoding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from .brightcove import BrightcoveIE
from .discovery import DiscoveryIE
from ..compat import compat_urlparse
class TlcIE(DiscoveryIE):
IE_NAME = 'tlc.com'
_VALID_URL = r'http://www\.tlc\.com\/[a-zA-Z0-9\-]*/... |
"""
Some utilities that were taken from the pexpect source code.
http://pexpect.sourceforge.net/pexpect.html
"""
import os
def pty_make_controlling_tty(tty_fd):
"""
This makes the pseudo-terminal the controlling tty. This should be
more portable than the pty.fork() function. Specifically, this should
... |
import os
import sys
import ybs.utils
import ybs.settings
import sqlite3
import argparse
import time
import StringIO
import multiprocessing
import re
VERSION = ybs.settings.__version__
PROCESSES_NUM = 4
SHOW_INSTALLED_ONLY = False
SHOW_UNINSTALLED_ONLY = False
INSTALL_FORCE = False
IS_VERBOSE = False
PBSLIB_PATH = yb... |
{
'name': 'Sale Order Workflow Improved',
'version': '0.1',
'author': 'NDP Systèmes',
'maintainer': 'NDP Systèmes',
'category': 'Sale',
'depends': ['sale'],
'description': """
Sale Order Workflow Improved
============================
This modules improves the classical workflow of sale order... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.