content stringlengths 4 20k |
|---|
"""
Checks that Pylint does not complain about various
methods on Django form forms.
"""
# pylint: disable=missing-docstring,R0904
from __future__ import print_function
from datetime import datetime, date
from django import forms
from django.contrib.auth.forms import UserCreationForm
class ManyFieldsForm(forms.Form)... |
from __future__ import absolute_import, division, unicode_literals
import unittest
from html5lib.filters.whitespace import Filter
from html5lib.constants import spaceCharacters
spaceCharacters = "".join(spaceCharacters)
try:
unittest.TestCase.assertEqual
except AttributeError:
unittest.TestCase.assertEqual =... |
"""Implementation of a fake image service."""
import copy
import datetime
import uuid
from oslo_config import cfg
from oslo_log import log as logging
from nova.compute import arch
from nova import exception
import nova.image.glance
CONF = cfg.CONF
CONF.import_opt('null_kernel', 'nova.compute.api')
LOG = logging.get... |
import logging
import os
import pickle
from .project import Project, ProjectManager
from .analysis_stats import AnalysisStatisticsBuilder as StatBuilder
from .analysis_steps import (_CleaningStep, _FactGenerationStep, _DatabaseCreationStep,
_SanityCheckStep, _UserOptionsStep, _LoadProjectSt... |
def args():
import argparse as arg
parser = arg.ArgumentParser(description="Check the style of your C/C++ code.")
parser.add_argument("--config", default=".cppstyle")
parser.add_argument("-i", dest="files", default=[], action="append")
return parser.parse_args()
def config(file):
import yaml a... |
from myhdl import *
def TimeCount(tens, ones, tenths, startstop, reset, clock):
""" 3 digit time counter in seconds and tenths of a second.
tens: most significant digit of the seconds
ones: least significant digit of the seconds
tenths: tenths of a second
startstop: input that starts or stops the... |
from gammalib import *
from math import *
# ======================== #
# Simulate CTA observation #
# ======================== #
def simulate(xmlname, e_min, e_max, area, duration):
"""
Simulate CTA observation.
"""
# Allocate MC parameters
dir = GSkyDir()
emin = GEnergy()
emax = GEnergy(... |
"""
Tests for the lms_filter_generator
"""
from mock import patch, Mock
from xmodule.modulestore.django import modulestore
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from student.tests.factories import UserFactory
fr... |
#!/usr/bin/env python
import argparse
import os
import subprocess
import sys
try:
import closure
except ImportError:
closure_compiler = None
else:
closure_compiler = os.path.join(os.path.dirname(closure.__file__), 'closure.jar')
js_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'static', ... |
import re
import docgen
class DocMethod(object):
def __init__(self, code, parent):
self.code = code
self.parent = parent
self.name = ''
self.parameters = []
self.docstring = ''
self.parse()
def parse(self):
definition = self.code[0]
res = r... |
"""
Exercise the wallet backup code. Ported from walletbackup.sh.
Test case is:
4 nodes. 1 2 and 3 send transactions between each other,
fourth node is a miner.
1 2 3 each mine a block to start, then
Miner creates 100 blocks so 1 2 3 each have 50 mature
coins to spend.
Then 5 iterations of 1/2/3 sending coins amongst... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import getpass
import os
import shutil
import time
import tempfile
import six
from binascii import unhexlify
from binascii import hexlify
from nose.plugins.skip import SkipTest
from ansible.compat.tests import unittest
from ansib... |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsImageCache.
.. note:: This program 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 2 of the License, or
(at your option) any later version.
"""
__a... |
from . import test_mail, test_ir_actions
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
from openerp import models, fields, api
def format_code(code_seq):
code = map(int, str(code_seq))
code_len = len(code)
while len(code) < 14:
code.insert(0, 0)
while len(code) < 16:
n = sum([(len(code) + 1 - i) * v for i, v in enumerate(code)]) % 11
if n > 1:
f = 11 -... |
from openerp.osv import fields,osv
from openerp import tools
from openerp.addons.decimal_precision import decimal_precision as dp
class report_analytic_account_close(osv.osv):
_name = "report.analytic.account.close"
_description = "Analytic account to close"
_auto = False
_columns = {
'name': ... |
"""Tests for util.request module."""
import unittest
from django.conf import settings
from django.core.exceptions import SuspiciousOperation
from django.test.client import RequestFactory
from util.request import course_id_from_url, safe_get_host
class ResponseTestCase(unittest.TestCase):
""" Tests for response-... |
#!/usr/bin/env python
""" MultiQC module to parse output from THetA2 """
from __future__ import print_function
from collections import OrderedDict
import logging
import os
import re
from multiqc import config
from multiqc.plots import bargraph
from multiqc.modules.base_module import BaseMultiqcModule
# Initialise t... |
from __future__ import print_function, unicode_literals
import weblab.experiment.devices.exc as DeviceErrors
class InvalidGpibProperty(DeviceErrors.MisconfiguredDeviceError):
def __init__(self, *args, **kargs):
DeviceErrors.MisconfiguredDeviceError.__init__(self, *args, **kargs)
class CantFindGpibProperty... |
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
js_to_json,
smuggle_url,
)
class NTVCoJpCUIE(InfoExtractor):
IE_NAME = 'cu.ntv.co.jp'
IE_DESC = 'Nippon Television Network'
_VALID_URL = r'https?://cu\.ntv\.co\.jp/(?!program)(?P<id>[^/... |
"""
homeassistant.components.script
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Scripts are a sequence of actions that can be triggered manually
by the user or automatically based upon automation events, etc.
"""
import logging
from datetime import timedelta
import homeassistant.util.dt as date_util
import threading
from homeas... |
# Core imports
import os
import shutil
import sys
import thread
import time
# Library imports
import pylirc
# Package imports
from ..core.Threadable import Threadable
from ..settings import Arguments
class Infrared_Sensor(Threadable):
def __init__(self, arguments, thread_manager):
"""
Initialize ... |
"""
Set up lookup paths for mako templates.
"""
import os
import pkg_resources
from django.conf import settings
from mako.lookup import TemplateLookup
from . import LOOKUP
class DynamicTemplateLookup(TemplateLookup):
"""
A specialization of the standard mako `TemplateLookup` class which allows
for addin... |
import os
from oslo_log import log
LOG = log.getLogger(__name__)
class AtropeException(Exception):
msg_fmt = "An unknown exception occurred."
def __init__(self, message=None, **kwargs):
self.kwargs = kwargs
if not message:
try:
message = self.msg_fmt % kwargs
... |
notifications = [ ]
notificationAdded = [ ]
# notifications which are currently on screen (and might be closed by similiar notifications)
current_notifications = [ ]
def __AddNotification(fnc, screen, id, *args, **kwargs):
if ".MessageBox'>" in `screen`:
kwargs["simple"] = True
notifications.append((fnc, screen,... |
from temboo.core.choreography import Choreography
from temboo.core.choreography import InputSet
from temboo.core.choreography import ResultSet
from temboo.core.choreography import ChoreographyExecution
import json
class GetParticipant(Choreography):
def __init__(self, temboo_session):
"""
Create ... |
import os, sys, hashlib, sqlite3
from twisted.enterprise import adbapi
this = sys.modules[__name__]
this.connexion = None
def dict_factory(cursor, row):
d = {}
for idx, col in enumerate(cursor.description):
d[col[0]] = row[idx]
return d
def set_dict_factory(conn):
conn.row_factory = this.dict_factory
dbname='... |
from nova import context
from nova import exception
from nova import objects
from nova.pci import device
from nova import test
dev_dict = {
'created_at': None,
'updated_at': None,
'deleted_at': None,
'deleted': None,
'id': 1,
'compute_node_id': 1,
'address': 'a',
'vendor_id': 'v',
... |
import unittest
import json
import logging
import socketserver
from email.message import EmailMessage
from email.headerregistry import Address
from email import message_from_bytes
from multiprocessing import Process
from http.server import SimpleHTTPRequestHandler
from time import sleep
from mail2alert import server
... |
class BaseSpatialOperations(object):
"""
This module holds the base `BaseSpatialBackend` object, which is
instantiated by each spatial database backend with the features
it has.
"""
truncate_params = {}
# Quick booleans for the type of this spatial backend, and
# an attribute for the sp... |
"""IP address pool management functions.
"""
import ipaddr
from bitarray import bitarray
from ganeti import errors
def _ComputeIpv4NumHosts(network_size):
"""Derives the number of hosts in an IPv4 network from the size.
"""
return 2 ** (32 - network_size)
IPV4_NETWORK_MIN_SIZE = 30
# FIXME: This limit is... |
import nc
import iso
import math
import datetime
import time
from format import Format
now = datetime.datetime.now()
class Creator(iso.Creator):
def __init__(self):
iso.Creator.__init__(self)
self.output_tool_definitions = False
self.m_codes_on_their_own_line = True
s... |
"""The match_hostname() function from Python 3.3.3, essential when using SSL."""
# Note: This file is under the PSF license as the code comes from the python
# stdlib. http://docs.python.org/3/license.html
import re
import sys
# ipaddress has been backported to 2.6+ in pypi. If it is installed on the
# system, us... |
from openerp import api
from openerp.osv import fields,osv
from openerp.addons.at_base import util
class project_work(osv.osv):
def onchange_user(self, cr, uid, ids, date, hours, user_id):
if uid==user_id:
ts_obj = self.pool.get("hr_timesheet_sheet.sheet")
ts_day = ts_obj.get_times... |
"""
STABLE.
"""
import random
import logging
from gi.repository import Gio
colors = [['#B20008', '#FF2B34'],
['#FF2B34', '#B20008'],
['#E6000A', '#FF2B34'],
['#FF2B34', '#E6000A'],
['#FFADCE', '#FF2B34'],
['#9A5200', '#FF2B34'],
['#FF2B34', '#9A5200'],
... |
print('warping img.shape=%r to a new shape=%r' % (img.shape, dsize))
# 1vM Agg info graveyard
#cx2_max_ax = np.cumsum(cx2_nFeats)
#_ax2_cid = [[cid_]*nFeats for (cid_, nFeats) in iter(zip(cx2_cid, cx2_nFeats))]
#ax2_cid = np.array(list(chain.from_iterable(_ax2_cid)))
# dont need no cid stuff here
#qfx2_cx = np.ar... |
"""minicms URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/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-bas... |
from sandbox_scripts.QualiEnvironmentUtils.StorageManager import StorageManager
class BaseSaveRestore(object):
def __init__(self, sandbox):
"""
Get the root directory for the config files on the storage server
:param SandboxBase sandbox: The sandbox save & restore will be done in
... |
from bokeh.io import vform
from bokeh.plotting import figure, hplot, output_file, show, ColumnDataSource
from bokeh.models import CustomJS, Slider
import numpy as np
x = np.linspace(0, 10, 500)
y = np.sin(x)
source = ColumnDataSource(data=dict(x=x, y=y))
plot = figure(y_range=(-10, 10), plot_width=400, plot_height... |
import os
import shutil
import tempfile
import unittest
from gsdview import utils
class TestDirectorySize(unittest.TestCase):
DATASIZE = 1024 # 1 kbyte
def setUp(self):
self.dirname = tempfile.mkdtemp(prefix='gsdview_test_utils_')
def _popuate_test_dir(self):
data = b'0' * self.DATASIZ... |
"""SCons.Tool.aixc++
Tool-specific initialization for IBM xlC / Visual Age C++ compiler.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import logging
from django.conf import settings
from django.http import HttpRequest, HttpResponse
from django.middleware.csrf import CSRF_KEY_LENGTH, CsrfViewMiddleware
from django.template import RequestContext, Template
from django.template.context_pro... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import time
from ansible.plugins.callback import CallbackBase
# define start time
t0 = tn = time.time()
def secondsToStr(t):
# http://bytes.com/topic/python/answers/635958-handy-short-cut-formatting-elapsed-time-floating-poi... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as 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 'NoLongerFriends.followed_on'
db.delete_column(u'followb... |
import unittest as ut
import importlib_wrapper
try:
import pint # pylint: disable=unused-import
except ImportError:
tutorial = importlib_wrapper.MagicMock()
skipIfMissingFeatures = ut.skip(
"Python module pint not available, skipping test!")
else:
tutorial, skipIfMissingFeatures = importlib_wr... |
{
'name': 'Belgium - Accounting',
'version': '1.1',
'category': 'Localization/Account Charts',
'description': """
This is the base module to manage the accounting chart for Belgium in OpenERP.
==============================================================================
After installing this module, t... |
# -*- coding: utf-8 -*-
import base64
from io import BytesIO
from odoo import api, fields, models
class BaseImportModule(models.TransientModel):
""" Import Module """
_name = "base.import.module"
_description = "Import Module"
module_file = fields.Binary(string='Module .ZIP file', required=True)
... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
import json
from ansible.module_utils.basic import AnsibleModule
def main():
module = ... |
# Manage internal options on messages/enums/fields/enum values.
from udpa.annotations import versioning_pb2
def AddHideOption(options):
"""Mark message/enum/field/enum value as hidden.
Hidden messages are ignored when generating output.
Args:
options: MessageOptions/EnumOptions/FieldOptions/EnumValueOpti... |
from django.db import models
from django.contrib.auth.models import User
from django.conf import settings
BOOL_CHOICES = ((1, 'Private'), (0, 'Public'),(2, ''));
class Visit(models.Model):
student = models.ForeignKey(User, related_name='visits')
submitter = models.ForeignKey(User, related_name='submitted_visit... |
"""
==================================
Comparing various online solvers
==================================
An example showing how different online solvers perform
on the hand-written digits dataset.
"""
# License: BSD 3 clause
import numpy as np
import matplotlib.pyplot as plt
from sklearn import datasets
from skle... |
__author__ = 'tayfun elmas'
from counit import coroutine
import unittest
class CoroutineTests(unittest.TestCase):
########################################################
def test_format(self):
self.assertEquals("%4d" % 12, " 12")
self.assertEquals(int("%4d" % 12), 12)
self.assertEqu... |
"""
Implementation of the class `RoosWillmarth1971` to read the steady-state drag
coefficient from a file.
The drag coefficients have been reported in Roos and Willmarth (1971).
_References:_
* Roos, F. W., & Willmarth, W. W. (1971).
Some experimental results on sphere and disk drag.
AIAA Journal, 9(2), 285-291.
... |
"""Test recovery from a crash during chainstate writing.
- 4 nodes
* node0, node1, and node2 will have different dbcrash ratios, and different
dbcache sizes
* node3 will be a regular node, with no crashing.
* The nodes will not connect to each other.
- use default test framework starting chain. initialize s... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
import pytest
from ansible.module_utils._text import to_native
from ansible.module_utils.common.validation import check_type_jsonarg
def test_check_type_jsonarg():
test_cases = (
('a', 'a'),
('a ', 'a'),
... |
#!/usr/bin/env python3
"""List all those Python files that require a coding directive
Usage: nocoding.py dir1 [dir2...]
"""
__author__ = "Oleg Broytmann, Georg Brandl"
import sys, os, re, getopt
# our pysource module finds Python source files
try:
import pysource
except ImportError:
# emulate the module wi... |
"""Utilities for Google Compute Engine
Utilities for making it easier to use OAuth 2.0 on Google Compute Engine.
"""
__author__ = '<EMAIL> (Joe Gregorio)'
import httplib2
import logging
import uritemplate
from oauth2client import util
from oauth2client.anyjson import simplejson
from oauth2client.client import Acces... |
import os
from django.contrib.auth import validators
from django.contrib.auth.models import User
from django.contrib.auth.password_validation import (
CommonPasswordValidator, MinimumLengthValidator, NumericPasswordValidator,
UserAttributeSimilarityValidator, get_default_password_validators,
get_password_v... |
"""This code example gets all product templates.
To create product templates, run create_product_template_templates.py.
"""
# Import appropriate modules from the client library.
from googleads import dfp
def main(client):
# Initialize appropriate service.
product_template_service = client.GetService(
'P... |
#!/usr/bin/python
# Can enable debug output by uncommenting:
#import logging
#logging.basicConfig(level=logging.DEBUG)
import Adafruit_BMP.BMP085 as BMP085
# Default constructor will pick a default I2C bus.
#
# For the Raspberry Pi this means you should hook up to the only exposed I2C bus
# from the main GPIO header... |
import json
from django.core.management.base import LabelCommand
from django.core import serializers
from cbv import models
class Command(LabelCommand):
"""Dump the django cbv app data for a specific version."""
def handle_label(self, label, **options):
filtered_models = (
(models.Project... |
import abc
import numpy
import subprocess
import util
class Agent(metaclass=abc.ABCMeta):
@abc.abstractmethod
def policy(game):
'''Return probabilty matrix of possible actions'''
@abc.abstractmethod
def name():
'''return name of agent'''
class HumanAgent(Agent):
def __init__(self,... |
#!/usr/bin/python
#------------------------------------------------------------------------
# REVISION HISTORY:
# 20160203 JAP: started coding and log, imported code from pyinstal.py
# refactored instal_print_xxx code into instalparser method
# 20160204 JAP: call solver and process answer set (lots of as... |
"""
Copyright 2013 Steven Diamond, Eric Chu
This file is part of CVXPY.
CVXPY 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 later version.
CVXPY is dis... |
#!/usr/bin/env python
"""
FCKeditor - The text editor for Internet - http://www.fckeditor.net
Copyright (C) 2003-2010 Frederico Caldeira Knabben
== BEGIN LICENSE ==
Licensed under the terms of any of the following licenses at your
choice:
- GNU General Public License Version 2 or later (the "GPL")
http://www.gnu.or... |
# -*- coding: utf-8 -*-
"""
This program 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 later version.
This program is distributed in ... |
"""
Hebrew-language mappings for language-dependent features of Docutils.
"""
__docformat__ = 'reStructuredText'
labels = {
# fixed: language-dependent
'author': '\u05de\u05d7\u05d1\u05e8',
'authors': '\u05de\u05d7\u05d1\u05e8\u05d9',
'organization': '\u05d0\u05e8\u05d2\u05d5\u05df',
'ad... |
__registered = False
def register():
global __registered
if not __registered:
from gRefer.conv.internal.bibtex import pybib, preprocessors, quirks
from gRefer.plugins import register_plugin
from gRefer.filer.constants import BIB_FILER_KEY
from gRefer.conv.internal.bibtex.constan... |
from django.contrib import admin
from guidy.models import Task
from clienty.models import Client
def make_delivered(modeladmin, request, queryset):
rows_updated = queryset.update(status='delivered')
modeladmin.message_user(request, "%s tasks successfully marked as delivered."%rows_updated)
make_delivered.short... |
from django.db import IntegrityError
from django.test import TestCase
from student.tests.factories import UserFactory
from user_api.tests.factories import UserPreferenceFactory
class UserPreferenceModelTest(TestCase):
def test_duplicate_user_key(self):
user = UserFactory.create()
UserPreferenceFac... |
from __future__ import absolute_import
from django.conf import settings
import pika
from pika.adapters.blocking_connection import BlockingChannel
from pika.spec import Basic
import logging
import ujson
import random
import time
import threading
import atexit
from collections import defaultdict
from zerver.lib.utils i... |
import math
import sys
import numpy as np
import numpy.random as npr
import scipy.stats
def _bootstrap_mean_sem(samples):
"""Return the estimated standard error for a distribution's mean."""
samples = np.array(samples)
n = len(samples)
indices = npr.randint(0, n, (10000, n))
samples = samples[ind... |
import struct, time, os, hashlib
I2C_CMD_ECHO = 1
I2C_CMD_GETID = 2
I2C_CMD_GETCAPS = 3
I2C_CMD_RESET = 4
I2C_CMD_CONFIG = 5
I2C_CMD_GETLAYOUT = 6
I2C_CMD_MASSERASE = 7
I2C_CMD_PAGEERASE = 8
I2C_CMD_SETRDADDR = 9
I2C_CMD_SETWRADDR = 10
I2C_CMD_READ = 11
I2C_CMD_WRITE = 12
I2C_CMD_COPY = 13
I2C_CMD_CALCHASH = 14
I2C_C... |
import copy
from django.forms.util import flatatt # noqa
class HTMLElement(object):
"""A generic base class that gracefully handles html-style attributes."""
def __init__(self):
self.attrs = getattr(self, "attrs", {})
self.classes = getattr(self, "classes", [])
def get_default_classes(s... |
"""
Module which allows the diffing of multiple files
:author: Toon Willems (Ghent University)
:author: Kenneth Hoste (Ghent University)
"""
import difflib
import math
import os
from vsc.utils import fancylogger
from easybuild.tools.build_log import EasyBuildError
from easybuild.tools.filetools import read_file
from... |
"""
Test the API of the symtable module.
"""
import symtable
import unittest
from test import test_support
TEST_CODE = """
import sys
glob = 42
class Mine:
instance_var = 24
def a_method(p1, p2):
pass
def spam(a, b, *var, **kw):
global bar
bar = 47
x = 23
glob
def internal():
... |
# -*- coding: utf-8 -*-
"""
pygments.lexers.special
~~~~~~~~~~~~~~~~~~~~~~~
Special lexers.
:copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from pygments.lexer import Lexer
from pygments.token import Token, Error, Text
from... |
from django.test import TestCase
from django.core import signing
from django.core.exceptions import SuspiciousOperation
from django.http import HttpResponse
from django.contrib.auth.tests.utils import skipIfCustomUser
from django.contrib.formtools.wizard.storage.cookie import CookieStorage
from django.contrib.formtool... |
WIN1255_CHAR_TO_ORDER_MAP = (
255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, # 00
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 10
253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, # 20
252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, # 30
253, 6... |
from .sub_resource import SubResource
class ApplicationGatewayUrlPathMap(SubResource):
"""UrlPathMaps give a url path to the backend mapping information for
PathBasedRouting.
:param id: Resource ID.
:type id: str
:param default_backend_address_pool: Default backend address pool resource
of U... |
import os
from os.path import join as pjoin
from setuptools import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
import numpy as np
def find_in_path(name, path):
"Find a file in a search path"
# Adapted fom
# http://code.activestate.com/recipes/52224-find-a-file-gi... |
#!/usr/bin/python
# Run this command as:
#
# jira.sh -s https://issues.apache.org/jira -u $user -p $pw \
# -a getIssueList --search \
# "project in (HADOOP,HDFS,MAPREDUCE) and fixVersion = '$vers' and resolution = Fixed" \
# | ./relnotes.py > $vers.html
import csv
import re
import subprocess
import sys
namePat... |
import unittest
from garden import Garden
class KindergartenGardenTests(unittest.TestCase):
def test_alices_garden(self):
self.assertEqual("Radishes Clover Grass Grass".split(),
Garden("RC\nGG").plants("Alice"))
def test_bob_and_charlies_gardens(self):
garden = Gard... |
"""
@author: AAron Walters
@license: GNU General Public License 2.0 or later
@contact: <EMAIL>
@organization: Volatile Systems
"""
from forensics.object2 import *
def info_systime(addr_space, theProfile, symtab):
xtime_vaddr = symtab.lookup('xtime')
timespec = Object('timespec', xtime_vaddr, ... |
"""
Code for rpc message dispatching.
Messages that come in have a version number associated with them. RPC API
version numbers are in the form:
Major.Minor
For a given message with version X.Y, the receiver must be marked as able to
handle messages of version A.B, where:
A = X
B >= Y
The Major versi... |
import time
from pageobjects.environments import Environments, Wizard
from pageobjects.networks import Networks, NeutronParameters
from pageobjects.nodes import Nodes
from pageobjects.settings import Settings
from pageobjects.tabs import Tabs
from settings import OPENSTACK_CENTOS, OPENSTACK_RELEASE_CENTOS
from tests.ba... |
# coding=utf-8
"""
The NagiosPerfdataCollector parses Nagios performance data in the
PNP4Nagios/Graphios/Metricinga key-value format.
#### Dependencies
* Nagios configured to periodically dump performance data files in
PNP4Nagios format
Configuring Nagios/Icinga
-------------------------
If you're already using... |
from django.apps import AppConfig
class BaseAppConfig(AppConfig):
name = "taiga.base"
verbose_name = "Base App Config"
def ready(self):
from .signals.thumbnails import connect_thumbnail_signals
from .signals.cleanup_files import connect_cleanup_files_signals
connect_thumbnail_sig... |
#! /usr/bin/python
import serial
import time
bluetoothSerial = serial.Serial( "/dev/tty.HC-06-DevB", baudrate=9600 )
import termios, fcntl, sys, os
class _Getch:
def __call__(self):
fd = sys.stdin.fileno()
oldterm = termios.tcgetattr(fd)
newattr = termios.tcgetattr(fd)
newattr[3] = newattr[3] & ~termios.I... |
from __future__ import unicode_literals
import threading
import time
from multiple_database.routers import TestRouter
from django.conf import settings
from django.db import connection, router, transaction
from django.db.utils import DEFAULT_DB_ALIAS, ConnectionHandler, DatabaseError
from django.test import (
Tra... |
#pylint: disable=C0111
#pylint: disable=W0621
from lettuce import world, step
from nose.tools import assert_false, assert_equal, assert_regexp_matches
from common import type_in_codemirror, press_the_notification_button
KEY_CSS = '.key input.policy-key'
VALUE_CSS = 'textarea.json'
DISPLAY_NAME_KEY = "display_name"
DI... |
import time
from openerp.report import report_sxw
from openerp.osv import osv
class order(report_sxw.rml_parse):
def get_lines(self, user,objects):
lines=[]
for obj in objects:
if user.id==obj.user_id.id:
lines.append(obj)
return lines
def get_total(self, ... |
#!/usr/bin/env python3
# python setup.py sdist --format=zip,gztar
import os
import sys
import platform
import importlib.util
import argparse
import subprocess
from setuptools import setup, find_packages
from setuptools.command.install import install
MIN_PYTHON_VERSION = "3.6.1"
_min_python_version_tuple = tuple(map... |
#!/usr/bin/env python
########################################################################
# $Header: $
########################################################################
from __future__ import print_function
__RCSID__ = "$Id: $"
import DIRAC
from DIRAC.Core.Base import Script
from DIRAC import exit as dex... |
#
# Warning: this is an alpha module and might be removed/renamed in
# later pyjamas versions
#
from __pyjamas__ import wnd, doc, JS, setCompilerOptions
from __javascript__ import ActiveXObject, XMLHttpRequest
from pyjamas import DOM
from __pyjamas__ import debugger
import sys
setCompilerOptions("noSourceTracking", "n... |
'''Commandline scripts.
These scripts are called by the executables defined in setup.py.
'''
from __future__ import with_statement, print_function
import abc
import sys
from optparse import OptionParser
import rsa
import rsa.bigfile
import rsa.pkcs1
HASH_METHODS = sorted(rsa.pkcs1.HASH_METHODS.keys())
def keygen(... |
# -*- coding: utf-8 -*-
'''
AND, Logical AND with Accumulator Test
This is a test for the logical instruction AND of
the 6502. In the 6502 the logical AND could be
performed against the content of the accumulator or
a content at a specific location.
'''
import unittest
from pynes.tests import MetaInstructionCase
cla... |
'''
Compact, self-contained ELF implementation for bitcoin-core security checks.
'''
import struct
import types
from typing import Dict, List, Optional, Union, Tuple
# you can find all these values in elf.h
EI_NIDENT = 16
# Byte indices in e_ident
EI_CLASS = 4 # ELFCLASSxx
EI_DATA = 5 # ELFDATAxxxx
ELFCLASS32 = 1 #... |
"""
Python Interchangeable Virtual Instrument Library
Copyright (c) 2012-2014 Alex Forencich
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the... |
"""Scikit learn interface for :class:`~gensim.models.word2vec.Word2Vec`.
Follows scikit-learn API conventions to facilitate using gensim along with scikit-learn.
Examples
--------
>>> from gensim.test.utils import common_texts
>>> from gensim.sklearn_api import W2VTransformer
>>>
>>> # Create a model to represent ea... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.