content stringlengths 4 20k |
|---|
# search.py
# ---------
# Licensing Information: Please do not distribute or publish solutions to this
# project. You are free to use and extend these projects for educational
# purposes. The Pacman AI projects were developed at UC Berkeley, primarily by
# John DeNero (<EMAIL>) and Dan Klein (<EMAIL>).
# For more info,... |
from __future__ import absolute_import
from __future__ import unicode_literals
from gnuradio import gr, filter, analog
from .atsc_rx_filter import *
class atsc_rx(gr.hier_block2):
def __init__(self, input_rate, sps):
gr.hier_block2.__init__(self, "atsc_rx",
gr.io_signature(1... |
"""Convert Gettext PO localization files to Comma-Separated Value (.csv) files.
See: http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/csv2po.html
for examples and usage instructions.
"""
from translate.storage import csvl10n, po
class po2csv:
def convertcomments(self, inputunit):
... |
"""This functional test spawns a web server, and runs chrome to point
at that web server.
The content served contains prefetch requests, and the tests assert that the
webserver logs reflect that.
Run like any functional test:
$ python chrome/test/functional/prefetch.py
in a repo with a built pyautolib
The import of ... |
import unittest
from buck_tool import CommandLineArgs
class TestCommandLineArgs(unittest.TestCase):
def test_empty_command(self):
args = CommandLineArgs(["buck"])
self.assertEqual(args.command, None)
self.assertEqual(args.buck_options, [])
self.assertEqual(args.command_options, []... |
import datetime
import gettext
import iso8601
import netaddr
from oslo_utils import timeutils
from oslo_versionedobjects import fields
from magnum.common import context as magnum_context
from magnum.common import exception
from magnum.objects import base
from magnum.objects import utils
from magnum.tests import base ... |
import os
import sys
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__),
"..")))
import tkinter as tk
import tkinter.ttk as ttk
import TkUtil.Scrollbar
class TextEdit(ttk.Frame):
"""A scrollable tk.Text widget
Note that the kwargs are given to the tk.Text not the outer
ttk.Frame. ... |
def answer(population, x, y, strength):
# your code here
rows = len(population)
cols = len(population[0])
patients_unchecked = [(x,y)]
patients_checked = []
# function to loop through unchecked patients
def next():
for patient in patients_unchecked:
yield patient
f... |
from __future__ import print_function
from helpers import unittest
import luigi.target
import luigi.format
class TestException(Exception):
pass
class TargetTest(unittest.TestCase):
def test_cannot_instantiate(self):
def instantiate_target():
luigi.target.Target()
self.assertR... |
import threading
from openerp.osv import fields, osv
class procurement_compute(osv.osv_memory):
_name = 'procurement.order.compute'
_description = 'Compute Procurement'
def _procure_calculation_procure(self, cr, uid, ids, context=None):
try:
proc_obj = self.pool.get('procurement.order'... |
# encoding: 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 'Package.pypi_home_page'
db.delete_column('package_package', 'pypi_home_page')
#... |
from fcntl import ioctl
from struct import pack, unpack
def getFPVersion():
ret = None
try:
ret = long(open("/proc/stb/fp/version", "r").read())
except IOError:
try:
fp = open("/dev/dbox/fp0")
ret = ioctl(fp.fileno(),0)
except IOError:
print "getFPVersion failed!"
return ret
def setFPWakeuptime(wut... |
"""
Slovak districts according to http://sk.wikipedia.org/wiki/Administrat%C3%ADvne_%C4%8Dlenenie_Slovenska
"""
from django.utils.translation import ugettext_lazy as _
DISTRICT_CHOICES = (
('BB', _('Banska Bystrica')),
('BS', _('Banska Stiavnica')),
('BJ', _('Bardejov')),
('BN', _('Banovce nad Bebravo... |
import utils
import cPickle
class AccountManager(object):
"""
This is the account manager.
It provides a generic way for the user interface to query for the
available registered accounts, and add or delete accounts.
This class returns an Account Dictionary used by
the :class:`Engine` to start... |
from xml.dom.minidom import parse
import string
import os
import sys
###############################################################################
# Exceptions
###############################################################################
class DomainConfigError(Exception): pass
##################################... |
#!/usr/bin/python
#coding=utf-8
"""****************************************************************************
Copyright (c) 2013 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), t... |
from django.contrib.auth import get_user_model
from django.core.urlresolvers import reverse
from misago.acl.testutils import override_acl
from misago.users.models import Rank
from misago.users.testutils import AuthenticatedUserTestCase
class UsersListTestCase(AuthenticatedUserTestCase):
def setUp(self):
... |
#! /usr/bin/env python3.7
from enum import Enum
from calendar import timegm
import time
TIMESTAMPFORMATS = Enum('TIMESTAMPFORMATS',
(
'DATETIMESEC_DOTS',
'MMDDYYYY_SLASHES',
),
)
def timestamp(t=None, f=TIMESTAMPFORMATS.DATETIMESEC_DOTS):
"""
@param t `float` seconds since epoch as returned by `time.time... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from learnbot_dsl.Clients.Client import *
from learnbot_dsl.Clients.Devices import *
import os, Ice, numpy as np, PIL.Image as Image, io, cv2, paho.mqtt.client
import learnbot_dsl.Clients.Devices as Devices
from learnbot_dsl.functions import getFuntions
from learnbot_dsl im... |
from .basecase import BaseTestCase
class TestCqlshInvocation(BaseTestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_normal_run(self):
pass
def test_python_interpreter_location(self):
pass
def test_color_capability_detection(self):
pass
... |
import os
import sys
import gtk
class Indicator(object):
"""This class provides access to application indicators in Gnome envirnoments"""
def __init__(self, parent):
self._parent = parent
self._menu = gtk.Menu()
self._create_menu_items()
base_path = os.path.dirname(os.path.dirname(sys.argv[0]))
self._i... |
"""
Provide a mock lock platform.
Call init before using it in your tests to ensure clean test data.
"""
from homeassistant.components.lock import SUPPORT_OPEN, LockEntity
from tests.common import MockEntity
ENTITIES = {}
def init(empty=False):
"""Initialize the platform with entities."""
global ENTITIES
... |
from os import path
import time
import smtplib
import logging
logger = logging.getLogger(__name__)
# -----------------------------------------------------------------------------
# BASIC
# -----------------------------------------------------------------------------
data_dir = path.expanduser('~/data')
json_db_path =... |
# -*- coding: utf-8 -*-
from hachoir_core.compatibility import any, sorted
from hachoir_core.endian import endian_name
from hachoir_core.tools import makePrintable, makeUnicode
from hachoir_core.dict import Dict
from hachoir_core.error import error, HACHOIR_ERRORS
from hachoir_core.i18n import _
from hachoir_core.log i... |
import xhtml2pdf.pisa as pisa
import StringIO
import logging
log = logging.getLogger("xhtml2pdf.wsgi")
class Filter(object):
def __init__(self, app):
self.app = app
def __call__(self, environ, start_response):
script_name = environ.get('SCRIPT_NAME', '')
path_info = environ.get('PA... |
import numpy as np
from bokeh.plotting import figure, show, output_file
from bokeh.models.sources import AjaxDataSource
output_file("ajax_source_realtime.html", title="ajax_source_realtime.py example")
source = AjaxDataSource(data_url='http://localhost:5050/data', mode="append",
if_modified=Tr... |
# Since this package contains a "django" module, this is required on Python 2.
from __future__ import absolute_import
import errno
import io
import string
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.template import Origin, TemplateDoesNotExist
from django.utils... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from pants.base.exceptions import TaskError
from pants.base.workunit import WorkUnitLabel
from pants.util.contextutil import pushd
from pants.contrib.node.tasks.node_... |
"""
Archive tools for wheel.
"""
import os
import time
import logging
import os.path
import zipfile
log = logging.getLogger("wheel")
def archive_wheelfile(base_name, base_dir):
'''Archive all files under `base_dir` in a whl file and name it like
`base_name`.
'''
olddir = os.path.abspath(os.curdir)
... |
# -*- coding: utf-8 -*-
'''
Production Configurations
- Use djangosecure
- Use Amazon's S3 for storing static files and uploaded media
- Use mailgun to send emails
- Use Redis on Heroku
'''
from boto.s3.connection import OrdinaryCallingFormat
from django.utils import six
from .common import * # noqa
# SECRET CO... |
import datetime
import logging
import string
from unittest import TestCase
from unittest import mock
from elasticsearch_raven import exceptions
from elasticsearch_raven import transport
class DummyMock(mock.Mock):
def __eq__(self, other):
return True
class ParseSentryHeadersTest(TestCase):
def test... |
#!/usr/bin/env python
"""
A modification of updating_plot3.py.
Three of the plots are now oriented vertically, but the dataspace of all
6 plots is still linked. Panning along the X axis of a vertical plot
will move the Y axis of one of the horizontally-oriented plots, and vice
versa.
"""
# Major library imports
from ... |
# pylint: skip-file
# flake8: noqa
# pylint: disable=too-many-arguments
class OCConfigMap(OpenShiftCLI):
''' Openshift ConfigMap Class
ConfigMaps are a way to store data inside of objects
'''
def __init__(self,
name,
from_file,
from_literal,
... |
from __future__ import with_statement
import re
from django.template import (Node, Variable, TemplateSyntaxError,
TokenParser, Library, TOKEN_TEXT, TOKEN_VAR)
from django.template.base import _render_value_in_context
from django.template.defaulttags import token_kwargs
from django.utils import translation
regist... |
from itertools import imap
import threading
import time
import hashlib
import struct
__b58chars = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
__b58base = len(__b58chars)
global PUBKEY_ADDRESS
global SCRIPT_ADDRESS
PUBKEY_ADDRESS = 130
SCRIPT_ADDRESS = 30
def rev_hex(s):
return s.decode('hex')[::... |
import os
import io
import sys
import json
import shutil
import locale
from os.path import basename, dirname, isdir, join, isfile
from conda_build.config import config
from conda_build.post import SHEBANG_PAT
ISWIN = sys.platform.startswith('win')
def _force_dir(dirname):
if not isdir(dirname):
os.maked... |
from io import BytesIO
import logging
import os
import re
import struct
import sys
from .compat import sysconfig, detect_encoding, ZipFile
from .resources import finder
from .util import (FileOperator, get_export_entry, convert_path,
get_executable, in_venv)
logger = logging.getLogger(__name__)
_D... |
import warnings
from abc import ABC
from typing import TYPE_CHECKING, List, Optional
if TYPE_CHECKING:
from airflow.models.connection import Connection
class BaseSecretsBackend(ABC):
"""Abstract base class to retrieve Connection object given a conn_id or Variable given a key"""
def __init__(self, **kwar... |
# pylint: disable=invalid-name
"""
Utility library for working with the edx-milestones app
"""
from django.conf import settings
from django.utils.translation import ugettext as _
from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys import CourseKey
from courseware.models import StudentModule
from xmodule... |
class InfluxQueryHelper(object):
def __init__(self):
self.where_clause = ''
self.limit_clause = ''
self.query = ''
def build_query(self, base_query, **kwargs):
where_clause_dict = {}
if 'start' in kwargs:
where_clause_dict['start'] = kwargs['start'].pop()
... |
"""
Base class to make checking the certs easier.
"""
# We subclass from ``object`` instead of ``TestCase`` here so that this doesn't
# add noise to the test suite (otherwise these no-ops would run on every
# import).
class ServiceCertVerificationTest(object):
ssl = True
# SUBCLASSES MUST OVERRIDE THIS!
... |
"""defines Allocation Manager Utilities"""
# -*- python -*-
from hodlib.allocationManagers.goldAllocationManager import goldAllocationManager
class allocationManagerUtil:
def getAllocationManager(name, cfg, log):
"""returns a concrete instance of the specified AllocationManager"""
if name == 'gold':
r... |
"""
Tests for kqueue wrapper.
"""
import errno
import os
import select
import socket
import sys
import time
import unittest
from test import support
if not hasattr(select, "kqueue"):
raise unittest.SkipTest("test works only on BSD")
class TestKQueue(unittest.TestCase):
def test_create_queue(self):
kq ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from runner.koan import *
class AboutControlStatements(Koan):
def test_if_then_else_statements(self):
if True:
result = 'true value'
else:
result = 'false value'
self.assertEqual(__, result)
def test_if_then_statem... |
"""
Support for monitoring an OpenEVSE Charger.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.openevse/
"""
import logging
from requests import RequestException
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
fro... |
# -*- coding: utf-8 -*-
"""The path specification resolver."""
from dfvfs.credentials import keychain
from dfvfs.lib import definitions
from dfvfs.lib import errors
from dfvfs.mount import manager as mount_manager
from dfvfs.path import path_spec
from dfvfs.resolver import context
class Resolver(object):
"""Class ... |
{
'name': 'Attendances',
'version': '1.1',
'category': 'Human Resources',
'description': """
This module aims to manage employee's attendances.
==================================================
Keeps account of the attendances of the employees on the basis of the
actions(Sign in/Sign out) performed by... |
"""
Signal handling functions for use with external commerce service.
"""
import json
import logging
from urlparse import urljoin
from django.conf import settings
from django.contrib.auth.models import AnonymousUser
from django.dispatch import receiver
from django.utils.translation import ugettext as _
from ecommerce_... |
#!/usr/bin/env python
import argparse
import os
import subprocess
import sys
from lib.config import LIBCHROMIUMCONTENT_COMMIT, BASE_URL, PLATFORM, \
enable_verbose_mode, is_verbose_mode, get_target_arch
from lib.util import execute_stdout, get_atom_shell_version, scoped_cwd
SOURCE_ROOT = os.p... |
"""
This module contains configuration settings via waffle flags
for the Video Pipeline app.
"""
from edx_toggles.toggles import LegacyWaffleFlag, LegacyWaffleFlagNamespace
from openedx.core.djangoapps.waffle_utils import CourseWaffleFlag
# Videos Namespace
WAFFLE_NAMESPACE = 'videos'
# .. toggle_name: videos.deprec... |
"""
UUTrack.View.Camera.workerThread
================================
Thread that acquires continuously data until a variable is changed. This enables to acquire at any frame rate without freezing the GUI or overloading it with data being acquired too fast.
"""
from pyqtgraph.Qt import QtCore
class work... |
# encoding: utf-8
from __future__ import unicode_literals
import re
from .crunchyroll import CrunchyrollIE
from .common import InfoExtractor
from ..compat import compat_HTTPError
from ..utils import (
ExtractorError,
int_or_none,
remove_start,
xpath_text,
)
class SoompiBaseIE(InfoExtractor):
de... |
#!/usr/bin/python
"""usage: python stylechecker.py /path/to/the/c/code"""
import os
import sys
import string
import re
WHITE = '\033[97m'
CYAN = '\033[96m'
BLUE = '\033[94m'
GREEN = '\033[92m'
YELLOW = '\033[93m'
RED = '\033[91m'
ENDC = '\033[0m'
def check_file(file):
if re.search('\.[c|h]$', file) == None:
... |
import errno
from oslo_log import log as logging
from cinder import exception
from cinder.i18n import _, _LI, _LW
import cinder.volume.driver
from cinder.volume.drivers.prophetstor import dplcommon
LOG = logging.getLogger(__name__)
class DPLISCSIDriver(dplcommon.DPLCOMMONDriver,
cinder.volume.... |
import abc
class AutoStorage:
__counter = 0
def __init__(self):
cls = self.__class__
prefix = cls.__name__
index = cls.__counter
self.storage_name = '_{}#{}'.format(prefix, index)
cls.__counter += 1
def __get__(self, instance, owner):
if instance is None:
... |
"""
The scrapy package must be installed.
Usage:
scrapy runspider adafruit_api.py -o adafruit.json
"""
import scrapy
from bs4 import BeautifulSoup
URL = "https://circuitpython.readthedocs.io/en/3.x/shared-bindings/index.html"
class AdafruitSpider(scrapy.Spider):
name = "AdafruitSpider"
start_urls = [URL]... |
from __future__ import unicode_literals
from django.db.models.signals import post_save, pre_save
from django.test import TestCase
from .models import Account, Employee, Person, Profile, ProxyEmployee
class UpdateOnlyFieldsTests(TestCase):
def test_update_fields_basic(self):
s = Person.objects.create(nam... |
import sys, re, inspect, textwrap, pydoc
import sphinx
import collections
from .docscrape import NumpyDocString, FunctionDoc, ClassDoc
if sys.version_info[0] >= 3:
sixu = lambda s: s
else:
sixu = lambda s: str(s, 'unicode_escape')
class SphinxDocString(NumpyDocString):
def __init__(self, docstring, confi... |
import supybot.conf as conf
import supybot.registry as registry
def configure(advanced):
# This will be called by supybot to configure this module. advanced is
# a bool that specifies whether the user identified himself as an advanced
# user or not. You should effect your configuration by manipulating th... |
TWITTER_BUTTON = """
<a href="https://twitter.com/igor_chubin?ref_src=twsrc%5Etfw" class="twitter-follow-button" data-show-count="false">Follow @igor_chubin</a><script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
"""
GITHUB_BUTTON = """
<a aria-label="Star chubin/wttr.in on GitHub" dat... |
from . import calendar
import controllers
import contacts |
from __future__ import unicode_literals
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist, ValidationError
from django.http import HttpRequest
from django.test import TestCase, modify_settings, override_settings
from . import models
from .middleware import CurrentSiteMiddleware
fr... |
from bernard.i18n.translator import (
Sentence,
SentenceGroup,
SortingDict,
TransItem,
)
def test_sentence():
item1 = TransItem('FOO', 1, 'foo 1', {})
item2 = TransItem('FOO', 1, 'foo 2', {})
s = Sentence()
assert not s.check()
s.append(item1)
s.append(item2)
assert s.che... |
"""
Provides factory methods to assemble the Galaxy web application
"""
import atexit
import config
import logging
import os
import sys
from inspect import isclass
from paste.request import parse_formvars
from paste.util import import_string
from paste import httpexceptions
from galaxy.util import asbool
import pkg_... |
from voluptuous import PREVENT_EXTRA, Any, Required, Schema
from ansible.module_utils.six import string_types
list_string_types = list(string_types)
suboption_schema = Schema(
{
Required('description'): Any(list_string_types, *string_types),
'required': bool,
'choices': list,
'alias... |
import netsvc
from osv import fields, orm
import tools
from tools.translate import _
from account_banking.parsers import models
def parser_types(*args, **kwargs):
'''Delay evaluation of parser types until start of wizard, to allow
depending modules to initialize and add their parsers to the list
'''
... |
"""Support for Tahoma devices."""
from collections import defaultdict
import logging
from requests.exceptions import RequestException
from tahoma_api import Action, TahomaApi
import voluptuous as vol
from homeassistant.const import CONF_EXCLUDE, CONF_PASSWORD, CONF_USERNAME
from homeassistant.helpers import config_va... |
import random
from fifth.languages import LANGUAGES
from fifth.processor import CharacterProcessor
class AbstractBackground(object):
def name(self):
return self.NAME if hasattr(self, 'NAME') else self.__class__.__name__
def personality_trait(self):
return random.choice(self.PERSONALITY_TRAI... |
from openerp import SUPERUSER_ID
from openerp.osv import orm, fields
from openerp.tools.translate import _
class MassObject(orm.Model):
_name = "mass.object"
_columns = {
'name': fields.char("Name", size=64, required=True, select=1),
'model_id': fields.many2one(
'ir.model', 'Model... |
import sys
import random
import string
import subprocess
from optparse import OptionParser
def all (results, predicate):
for result in results:
if not predicate(result):
return False
return True
def any (results, predicate):
for result in results:
if predicate(result):
return True
return False
class Fi... |
# Tests universal newline support for both reading and parsing files.
import unittest
import os
import sys
from test import test_support
if not hasattr(sys.stdin, 'newlines'):
raise test_support.TestSkipped, \
"This Python does not have universal newline support"
FATX = 'x' * (2**14)
DATA_TEMPLATE = [
... |
import sqlalchemy as sa
from sqlalchemy import exc as sa_exc
from sqlalchemy import types as sql_types
from sqlalchemy import inspect
from sqlalchemy import MetaData, Integer, String
from sqlalchemy.engine.reflection import Inspector
from sqlalchemy.testing import engines, fixtures
from sqlalchemy.testing.schema import... |
import ir_module_reference_print
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
#!/usr/bin/python
""" PN-CLI vrouter-ospf-add/remove """
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any... |
from __future__ import absolute_import, division, print_function, unicode_literals
class ScaleTier(object):
BASIC = 'BASIC'
STANDARD_1 = 'STANDARD_1'
PREMIUM_1 = 'PREMIUM_1'
BASIC_GPU = 'BASIC_GPU'
CUSTOM = 'CUSTOM'
class TrainingInput(object):
def __init__(self, package_uris, python_module,... |
import json
import pytest
@pytest.mark.parametrize('stdin', [{}], indirect=['stdin'])
def test_warn(am, capfd):
am.warn('warning1')
with pytest.raises(SystemExit):
am.exit_json(warnings=['warning2'])
out, err = capfd.readouterr()
assert json.loads(out)['warnings'] == ['warning1', 'warning2'... |
#!/usr/bin/python -u
#
# This test exercise the redirection of error messages with a
# functions defined in Python.
#
import sys
import libxml2
# Memory debug specific
libxml2.debugMemory(1)
expect="""--> (3) xmlns: URI foo is not absolute
--> (4) Opening and ending tag mismatch: x line 0 and y
"""
err=""
def callba... |
"""
Support to interact with a Music Player Daemon.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/media_player.mpd/
"""
import logging
from datetime import timedelta
import voluptuous as vol
from homeassistant.components.media_player import (
MEDI... |
import hooking
import traceback
def main():
"""Forward IPv6 configuration from the network 'custom' properties
to VDSM API."""
setup_nets_config = hooking.read_json()
for network, attrs in setup_nets_config['request']['networks'].items():
if 'remove' in attrs:
continue
e... |
"""
The httplib2 algorithms ported for use with requests.
"""
import logging
import re
import calendar
import time
from email.utils import parsedate_tz
from pip._vendor.requests.structures import CaseInsensitiveDict
from .cache import DictCache
from .serialize import Serializer
logger = logging.getLogger(__name__)
... |
"""Installs deps for using SDK emulator for testing.
The script will download the SDK and system images, if they are not present, and
install and enable KVM, if virtualization has been enabled in the BIOS.
"""
import logging
import optparse
import os
import re
import shutil
import sys
from pylib import cmd_helper
f... |
import matplotlib.pyplot as plt
import numpy as np
from scipy.fftpack import fft, fftshift
plt.figure(1, figsize=(9.5, 7))
M = 64
N = 64
x1 = np.hanning(M)
x2 = np.cos(2*np.pi*2/M*np.arange(M))
y1 = x1*x2
mY1 = 20 * np.log10(np.abs(fftshift(fft(y1, N))))
plt.subplot(3,2,1)
plt.title('x1 (hanning)')
plt.plot(np.arange... |
"""functions used to manipulate access keys in strings"""
from translate.storage.placeables.general import XMLEntityPlaceable
DEFAULT_ACCESSKEY_MARKER = u"&"
class UnitMixer(object):
"""Helper to mix separately defined labels and accesskeys into one unit."""
def __init__(self, labelsuffixes, accesskeysuff... |
{
"name": "Product Variant Cost",
"version": "1.0",
"depends": [
"product",
"stock_account"
],
"author": "OdooMRP team,"
"AvanzOSC,"
"Serv. Tecnol. Avanzados - Pedro M. Baeza",
"category": "Product",
"website": "http://www.odoomrp.com",
"summar... |
"""
Handlers for keys related to number theory: prime, even, odd, etc.
"""
from __future__ import print_function, division
from sympy.assumptions import Q, ask
from sympy.assumptions.handlers import CommonHandler
from sympy.ntheory import isprime
from sympy.core import S, Float
class AskPrimeHandler(CommonHandler):
... |
"""
Tests for L{twisted.internet.iocpreactor}.
"""
import errno
from array import array
from struct import pack
from socket import AF_INET6, AF_INET, SOCK_STREAM, SOL_SOCKET, error, socket
from zope.interface.verify import verifyClass
from twisted.trial import unittest
from twisted.python.log import msg
from twisted... |
import webbrowser
import os.path
import platform
import config
class Help:
def __init__(self,helproot=None,url=None):
print "HELPROOT =",config.HELPROOT
self.goonline=False
if url is not None:
self.webhelproot = url
self.goonline = True
else:
self.webhelproot = config.WEBHELPROOT
if helproot=... |
"""Unit test for treadmill.cli.ssh
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import unittest
import click
import click.testing
from gevent import queue as g_queue
import mock
from treadmill import plugin_ma... |
"""
This module is used to integrate child process termination into a
reactor event loop. This is a challenging feature to provide because
most platforms indicate process termination via SIGCHLD and do not
provide a way to wait for that signal and arbitrary I/O events at the
same time. The naive implementation involv... |
__revision__ = "src/engine/SCons/Scanner/Dir.py 5134 2010/08/16 23:02:40 bdeegan"
import SCons.Node.FS
import SCons.Scanner
def only_dirs(nodes):
is_Dir = lambda n: isinstance(n.disambiguate(), SCons.Node.FS.Dir)
return list(filter(is_Dir, nodes))
def DirScanner(**kw):
"""Return a prototype Scanner insta... |
"""
Various utilities and cookbook-like things.
"""
# STDLIB
import codecs
import contextlib
import io
import re
import gzip
from distutils import version
__all__ = [
'convert_to_writable_filelike',
'stc_reference_frames',
'coerce_range_list_param',
]
@contextlib.contextmanager
def convert_to_wri... |
"""
sentry.buffer.redis
~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
from django.conf import settings
from django.db import models
from django.utils.encoding import force_bytes
fr... |
"""
Unit tests for `multinomial` module.
"""
import numpy as np
import scipy
from bayespy.nodes import (Multinomial,
Dirichlet,
Mixture)
from bayespy.utils import random
from bayespy.utils.misc import TestCase
class TestMultinomial(TestCase):
"""
Unit ... |
import unittest
import cmapPy.clue_api_client.setup_logger as setup_logger
import logging
import cmapPy.clue_api_client.clue_api_client as clue_api_client
import os.path
import collections
__authors__ = "David L. Lahr"
__email__ = "<EMAIL>"
logger = logging.getLogger(setup_logger.LOGGER_NAME)
config_filepath = os.p... |
{
"name": "Management System - Action",
"version": "8.0.1.2.2",
"author": "Savoir-faire Linux,Odoo Community Association (OCA)",
"website": "http://www.savoirfairelinux.com",
"license": "AGPL-3",
"category": "Management System",
"description": """\
This module enables you to manage the diffe... |
"""proj1 URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based... |
# Mimic the sqlite3 console shell's .dump command
def _iterdump(connection):
"""
Returns an iterator to the dump of the database in an SQL text format.
Used to produce an SQL dump of the database. Useful to save an in-memory
database for later restoration. This function should not be called
dire... |
import sys
from django import http
from django.core import signals
from django.utils.encoding import force_unicode
from django.utils.importlib import import_module
from django.utils.log import getLogger
logger = getLogger('django.request')
class BaseHandler(object):
# Changes that are always applied to a respon... |
from kubernetes_py.models.v1.JobCondition import JobCondition
from kubernetes_py.utils import is_valid_list, is_valid_string
class JobStatus(object):
"""
http://kubernetes.io/docs/api-reference/batch/v1/definitions/#_v1_jobstatus
"""
def __init__(self, model=None):
super(JobStatus, self).__in... |
from cgi import escape
from misago.acl import add_acl
from misago.threads.checksums import update_event_checksum
from misago.threads.models import Event
__all__ = ['record_event', 'add_events_to_posts']
LINK_TEMPLATE = '<a href="%s" class="event-%s">%s</a>'
NAME_TEMPLATE = '<strong class="event-%s">%s</strong>'
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.