content stringlengths 4 20k |
|---|
# UserString is a wrapper around the native builtin string type.
# UserString instances should behave similar to builtin string objects.
import string
from test import test_support, string_tests
from UserString import UserString, MutableString
import warnings
class UserStringTest(
string_tests.CommonTest,
str... |
# This script embeds the PortMidi Portable MIDI library via ctypes.
# It is based on Grant Yoshida's 2007 version with some updates from
# Christopher Arndt from 2009 with some bugs fixed and restructured a bit.
import os
import sys
from ctypes import (CDLL, CFUNCTYPE, POINTER, Structure, byref, c_char_p,
c_int3... |
__author__ = 'Jeremy Emerson'
from core.domain import event_services
from core.domain import exp_domain
from core.domain import exp_services
from core.domain import rule_domain
from core.domain import stats_domain
from core.domain import stats_jobs
from core.domain import stats_services
from core.tests import test_uti... |
"""MapReduce Tasks.
A Task represents a unit of work and the mechanism for carrying it out.
"""
from __future__ import division, print_function
import copy
import itertools
from operator import itemgetter
from . import datasets
from . import fileformats
from . import serializers
from . import util
from logging imp... |
from __future__ import print_function
import os
from textwrap import wrap
from ipalib import api
from ipalib.plugable import Plugin, API
from ipalib.errors import ValidationError
from ipapython import admintool
from ipapython.ipa_log_manager import log_mgr
"""
To add configuration instructions for a new use case, d... |
from __future__ import print_function
import os
import json
from subprocess import check_call
import git
import requests
from datetime import datetime
def read_file(path, fname, content_type=None):
p = os.path.join(path, fname)
with open(p) as f:
if content_type in ("json",):
data = json.l... |
from __future__ import unicode_literals
import frappe, os, time, sys
from frappe.utils import update_progress_bar
def sync_statics(rebuild=False):
s = sync()
s.verbose = True
while True:
s.start(rebuild)
frappe.db.commit()
time.sleep(2)
rebuild = False
class sync(object):
def __init__(self, verbose=False... |
"""Cisco Spark platform for notify component."""
import logging
import voluptuous as vol
from homeassistant.const import CONF_TOKEN
import homeassistant.helpers.config_validation as cv
from homeassistant.components.notify import (
ATTR_TITLE,
PLATFORM_SCHEMA,
BaseNotificationService,
)
_LOGGER = logging... |
import io
import shlex
import string
import unittest
from test import support
# The original test data set was from shellwords, by Hartmut Goebel.
data = r"""x|x|
foo bar|foo|bar|
foo bar|foo|bar|
foo bar |foo|bar|
foo bar bla fasel|foo|bar|bla|fasel|
x y z xxxx|x|y|z|xxxx|
\x bar|\|x|bar|
... |
import factory
from oscar.core.loading import get_model
__all__ = [
'RangeFactory', 'ConditionFactory', 'BenefitFactory',
'ConditionalOfferFactory',
]
class RangeFactory(factory.DjangoModelFactory):
name = factory.Sequence(lambda n: 'Range %d' % n)
slug = factory.Sequence(lambda n: 'range-%d' % n)
... |
microcode = '''
def macroop INS_M_R {
# Find the constant we need to either add or subtract from rdi
ruflag t0, 10
movi t3, t3, dsz, flags=(CEZF,), dataSize=asz
subi t4, t0, dsz, dataSize=asz
mov t3, t3, t4, flags=(nCEZF,), dataSize=asz
zexti t2, reg, 15, dataSize=8
mfence
ld t6, intse... |
"""This file provides a class for parsing/building frames of the WebSocket
protocol version HyBi 00 and Hixie 75.
Specification:
- HyBi 00 http://tools.ietf.org/html/draft-ietf-hybi-thewebsocketprotocol-00
- Hixie 75 http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol-75
"""
from mod_pywebsocket import commo... |
from oslo_log import log as logging
import nova.conf
from nova.scheduler import filters
from nova.scheduler.filters import utils
LOG = logging.getLogger(__name__)
CONF = nova.conf.CONF
class AvailabilityZoneFilter(filters.BaseHostFilter):
"""Filters Hosts by availability zone.
Works with aggregate metadat... |
'''
Created on 06 Jan 2013
@author: George
'''
'''
OrderDecomposition is a Core Object that takes an order after design and decomposes to order components
dummy object: infinite capacity no processing time
'''
# from SimPy.Simulation import Process, Resource
# from SimPy.Simulation import waituntil, now, hold, infini... |
# 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):
# Adding field 'RLStats.reviewed'
db.add_column('resources_rlstats', 'reviewed', self.gf('django.db.models... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'interfaz.ui'
#
# by: PyQt4 UI code generator 4.10.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
... |
import re, requests, json
from bs4 import BeautifulSoup, NavigableString
locs = {"18" :"Berlin",
"40" :"Nord",
"16" :"Ost",
"17" :"Süd",
"39" :"West"}
bas = {'design': 'Bestes Design', 'world': 'Mit Code die Welt verbessern', 'audience': 'Publikumspreis', 'code': 'Bester Code... |
#!/usr/bin/env python
import sched
import time
import unittest
from test import support
class TestCase(unittest.TestCase):
def test_enter(self):
l = []
fun = lambda x: l.append(x)
scheduler = sched.scheduler(time.time, time.sleep)
for x in [0.05, 0.04, 0.03, 0.02, 0.01]:
... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, with_statement
import datetime
import os
import sys
from tornado.options import OptionParser, Error
from tornado.util import basestring_type
from tornado.test.util import unittest
try:
from cStringIO import StringIO # pyth... |
# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/336012
import SimpleHTTPServer
import BaseHTTPServer
import httplib
import os
class StoppableHttpRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
"""http request handler with QUIT stopping the server"""
def do_QUIT(self):
"""send 20... |
"""
Integration tests of the payment flow, including course mode selection.
"""
import six
from django.urls import reverse
from course_modes.tests.factories import CourseModeFactory
from student.models import CourseEnrollment
from student.tests.factories import UserFactory
from xmodule.modulestore.tests.django_utils... |
from invenio.websearchadminlib import add_col, add_col_dad_son, delete_col
from invenio.dbquery import run_sql
COLLECTION_TREE = {
'name' : 'OpenAIRE Orphan Record Repository', 'query' : '',
'children' : [
{
'name' : 'Articles & Reports',
'query' : '',
'children' : [... |
"""
Builds a (pre)release build of SumatraPDF, including the installer,
and optionally uploads it to s3.
"""
import os
import os.path
import shutil
import sys
import time
import re
from util import log, run_cmd_throw, test_for_flag, s3UploadFilePublic
from util import s3UploadDataPublic, ensure_s3_doesnt_exist, ensur... |
from setuptools import setup, Extension
import codecs
import os
import sys
readme_note = """\
.. note::
For the latest source, discussion, etc, please visit the
`GitHub repository <https://github.com/spotify/annoy>`_\n\n
.. image:: https://img.shields.io/github/stars/spotify/annoy.svg
:target: https://gith... |
import gtk
from db import db
from Timetableasy import app
# Themes
planning_themes = {
'db' : {
'pepper' : 0,
'default' : 1,
'blue' : 2,
'eggplant' : 3,
'lightness' : 4,
'mint' : 5,
},
'db_inv': {
0 : 'pepper',
1 : 'default',
2 : 'blue',
3 : ... |
import logging
import os
import sys
from webkitpy.common.checkout.scm.detection import SCMDetector
from webkitpy.common.memoized import memoized
from webkitpy.common.net import buildbot, web
from webkitpy.common.net.buildbot.chromiumbuildbot import ChromiumBuildBot
from webkitpy.common.system.systemhost import SystemH... |
from openerp.osv import orm, fields
class product_product(orm.Model):
_inherit = "product.product"
_columns = {
'listprice_update_date': fields.date('Date of import pricelist')
} |
import string
import numpy as np
import keras
# import seq2seq
# from seq2seq.models import Seq2Seq
import seq2seq
import modelscopy
import operator
from keras.models import Sequential
from keras.layers.embeddings import Embedding
from keras.preprocessing import sequence
def main():
max_eng_len = 20
max_api... |
from __future__ import unicode_literals
from .core import AshesTest
heading = 'comparator helpers'
class eq_const(AshesTest):
template = '{@eq key="blue" value="blue"}Blue{/eq}, the color of her eyes.'
json_context = '{}'
rendered = 'Blue, the color of her eyes.'
class ne_const(AshesTest):
templat... |
from django.template import TemplateSyntaxError
from django.test import SimpleTestCase
from ..utils import setup
class CycleTagTests(SimpleTestCase):
@setup({'cycle01': '{% cycle a %}'})
def test_cycle01(self):
with self.assertRaises(TemplateSyntaxError):
self.engine.get_template('cycle0... |
#!/usr/bin/python
import time
import psycopg2
from os.path import dirname
from get_config import config
from import_campaigns import import_campaigns
from import_members import import_members
from import_users import import_users
def create_tables():
""" create tables in the PostgreSQL database"""
commands =... |
"""
Check that all of the certs on all service endpoints validate.
"""
import unittest
from tests.integration import ServiceCertVerificationTest
import boto.cloudtrail
class CloudTrailCertVerificationTest(unittest.TestCase, ServiceCertVerificationTest):
cloudtrail = True
regions = boto.cloudtrail.regions()
... |
''' unit test template for ONTAP Ansible module '''
from __future__ import print_function
import json
import pytest
from units.compat import unittest
from units.compat.mock import patch, Mock
from ansible.module_utils import basic
from ansible.module_utils._text import to_bytes
import ansible.module_utils.netapp as n... |
#!/usr/bin/env python
"""
pytss is a python language wrapper for the Tspi library provided by the
TrouSerS project. libtspi is a library for interfacing with a TPM services
daemon.
Author: Matthew Garrett (<EMAIL>)
Copyright 2013 Nebula, Inc
Licensed under the Apache License, Version 2.0 (the "License");
you may not... |
from __future__ import unicode_literals
import django.template.loader
import pytest
from django.conf.urls import url
from django.core.exceptions import ImproperlyConfigured, PermissionDenied
from django.http import Http404
from django.template import Template, TemplateDoesNotExist
from django.test import TestCase, ove... |
__title__ = "FreeCAD FEM command base class"
__author__ = "Przemo Firszt, Bernd Hahnebach"
__url__ = "https://www.freecadweb.org"
## @package manager
# \ingroup FEM
# \brief FreeCAD FEM command base class
import FreeCAD
from femtools.femutils import is_of_type
if FreeCAD.GuiUp:
from PySide import QtCore
i... |
# Returns a valid response when request's |referrer| matches
# |expected_referrer|.
def main(request, response):
# We want |referrer| to be the referrer header with no query params,
# because |expected_referrer| will not contain any query params, and
# thus cannot be compared with the actual referrer header... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
ogr2ogr.py
---------------------
Date : November 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
*****************************... |
{ 'sequence': 500,
"name" : "Invoice to Picking Relation"
, "description" : """Adds reference between Invoice and Picking"""
, "version" : "0.9"
, "depends" : ["stock", "account", "purchase", "sale"]
, "category" : "Accounting & Finance"
, "author" : "ChriCar Beteiligungs- und Beratungs- Gm... |
import urllib.parse
import math
from operator import attrgetter
from secrets import compare_digest
import colander
from ekklesia_common.cell import Cell
from functools import cached_property
from eliot import log_call
from sqlalchemy import func
from ekklesia_portal.app import App
from ekklesia_portal.concepts.argume... |
import os
import time
from itertools import groupby
from pyface.timer.do_later import do_later
from traits.api import Any, on_trait_change, Int, List, Bool, \
Instance, Property, Str, HasTraits, Event, Long
from traits.trait_types import Date
from traitsui.api import View, Item, UItem
from pychron.core.helpers.ct... |
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
"""
Test that the --debug=stree option prints a dependency tree with output
that indicates the state of various Node status flags.
"""
import TestSCons
test = TestSCons.TestSCons(match = TestSCons.match_re_dotall)
CC = test.detect('CC')
LINK = test.detec... |
#!/usr/bin/env python3
from pprint import pprint
import matplotlib.pyplot as plt
from ruamel import yaml
from .prefixedunit import PrefixedUnit
def frange(start, stop, step=1.0):
f = start
while f < stop:
f += step
yield f
# Input (usually from ECM model)
result = {
'min performance': ... |
# -*- coding: utf-8 -*-
"""
oauthlib.parameters
~~~~~~~~~~~~~~~~~~~
This module contains methods related to `section 3.5`_ of the OAuth 1.0a spec.
.. _`section 3.5`: http://tools.ietf.org/html/rfc5849#section-3.5
"""
from __future__ import absolute_import, unicode_literals
try:
from urlparse import urlparse, url... |
import warnings
from rope.base import change, taskhandle, builtins, ast, codeanalyze
from rope.refactor import patchedast, similarfinder, sourceutils
from rope.refactor.importutils import module_imports
class Restructure(object):
"""A class to perform python restructurings
A restructuring transforms pieces ... |
"""Extensions to the 'distutils' for large or complex distributions"""
import os
import functools
import distutils.core
import distutils.filelist
from distutils.core import Command as _Command
from distutils.util import convert_path
from fnmatch import fnmatchcase
from setuptools.extern.six.moves import filterfalse, ... |
from oslo_config import cfg
from nova.tests.functional.api_sample_tests import test_servers
CONF = cfg.CONF
CONF.import_opt('osapi_compute_extension',
'nova.api.openstack.compute.legacy_v2.extensions')
class ServersIpsJsonTest(test_servers.ServersSampleBase):
extends_name = 'core_only'
sampl... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from units.compat.mock import patch
from units.modules.utils import set_module_args
from ansible.modules.network.ironware import ironware_config
from .ironware_module import TestIronwareModule, load_fixture
class TestIronwareConf... |
from neutron.agent.linux import ip_monitor
from neutron.tests import base
class TestIPMonitorEvent(base.BaseTestCase):
def test_from_text_parses_added_line(self):
event = ip_monitor.IPMonitorEvent.from_text(
'3: wlp3s0 inet 192.168.3.59/24 brd 192.168.3.255 '
'scope global dynam... |
"""Tool for uploading Google Code issues to GitHub.
Issue migration from Google Code to GitHub.
This tools allows you to easily migrate your downloaded Google Code issues to
GitHub.
To use this tool see the documentation available at:
https://code.google.com/p/support-tools/wiki/IssueExporterTool
"""
impor... |
import csv
import itertools
import re
from django.utils.encoding import smart_text
from django.core.exceptions import FieldDoesNotExist
MARKDOWN_LIST_ITEM_REG = r'^(?P<indent>\s*)[\-+*]\s(?P<item>.*)$'
class Echo(object):
"""An object that implements just the write method of the file-like interface."""
de... |
"""Setup CLI configuration."""
# :license: MIT, see LICENSE for more details.
import os.path
import SoftLayer
from SoftLayer import auth
from SoftLayer.CLI import config
from SoftLayer.CLI import environment
from SoftLayer.CLI import exceptions
from SoftLayer.CLI import formatting
from SoftLayer import utils
import c... |
import sys
import operator
MIN_FLOAT = -3.14e100
MIN_INF = float("-inf")
if sys.version_info[0] > 2:
xrange = range
def get_top_states(t_state_v, K=4):
return sorted(t_state_v, key=t_state_v.__getitem__, reverse=True)[:K]
def viterbi(obs, states, start_p, trans_p, emit_p):
V = [{}] # tabular
mem_p... |
"""Unit Tests for classes in dumping_wrapper.py."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import glob
import os
import shutil
import tempfile
import threading
from tensorflow.python.client import session
from tensorflow.python.debug.lib import deb... |
#! /usr/bin/python
import time
import m3.toolbox as m3t
import Numeric as nu
import math
import yaml
import m3.rt_proxy as m3p
import m3.toolbox as m3t
import m3.component_factory as mcf
#Image stuff
from PIL import Image
from PIL import ImageDraw
import sys
import matplotlib.pyplot as plt
import matplotlib.image as ... |
#!/usr/bin/env python3
"""
Global Sea Ice Extent Graph for 1979-Current
Website : https://github.com/emmatoday/PyClimateGraphs
Author : Emma M - GitHub: @emmatoday
Date : 15 February 2017
This code will download and render a current graph of the global sea ice
extent. Beginning in 1979 until yesterday (base... |
# fly ArduPlane in SIL
import util, pexpect, sys, time, math, shutil, os
from common import *
from pymavlink import mavutil
import random
# get location of scripts
testdir=os.path.dirname(os.path.realpath(__file__))
HOME_LOCATION='-35.362938,149.165085,585,354'
WIND="0,180,0.2" # speed,direction,variance
homeloc =... |
"""Vera tests."""
from requests.exceptions import RequestException
from homeassistant import config_entries, data_entry_flow
from homeassistant.components.vera import CONF_CONTROLLER, CONF_LEGACY_UNIQUE_ID, DOMAIN
from homeassistant.const import CONF_EXCLUDE, CONF_LIGHTS, CONF_SOURCE
from homeassistant.core import Hom... |
"""This module implements the data export renderer.
The data export renderer is a way of exporting structured data from Rekall. The
renderer is based on the JsonRenderer but has a different goal - while the
JsonRenderer is designed to be able to exactly recreate the objects in the
future the data export renderer aims ... |
{
'name': 'Smile Purchase Access Rights',
'version': '1.0',
'depends': [
'base',
'purchase',
],
'author': 'Smile',
'description': """
# Purchase Access Rights (Groups)
""",
'summary': '',
'website': 'http://www.smile.fr',
'category': 'Purchase Manageme... |
""" modified 2012/11/24 to add cast for LayerTop
modified 2014/11/07
temporally remove "__main__"
add I/O for radar file
add I/O for lidar file
combine readrain.py
combine read_ecmwf.py
modif... |
import os
home = os.environ['HOME']
for a in os.listdir("%s/.forever" % home):
if not a.endswith('.log'):
continue
print(a)
open(os.path.join(home, '.forever', a), 'w') |
from math import pi
from pickle import load, dump
import numpy as np
from ase.units import Bohr
from _gpaw import localize
from gpaw.utilities.tools import dagger, lowdin
class Wannier:
def __init__(self, calc=None, spin=0, nbands=None):
self.spin = spin
self.Z_nnc = None
if calc is not ... |
from numpy.distutils.cpuinfo import cpu
from numpy.distutils.fcompiler import FCompiler
compilers = ['MIPSFCompiler']
class MIPSFCompiler(FCompiler):
compiler_type = 'mips'
description = 'MIPSpro Fortran Compiler'
version_pattern = r'MIPSpro Compilers: Version (?P<version>[^\s*,]*)'
executables = {... |
config_extension_def = """
[LineNumbers]
enable=1
enable_shell=0
visible=True
[LineNumbers_cfgBindings]
linenumbers-show=
"""
import sys
if sys.version < '3':
from Tkinter import END, Text, LEFT, Y, NONE, RIGHT, NORMAL, DISABLED, Label, TOP, Frame, X
else:
from tkinter import END, Text, LEFT, Y, NONE, RIGHT... |
"""
Email backend that writes messages to console instead of sending them.
"""
import sys
import threading
from django.core.mail.backends.base import BaseEmailBackend
class EmailBackend(BaseEmailBackend):
def __init__(self, *args, **kwargs):
self.stream = kwargs.pop('stream', sys.stdout)
self._loc... |
#!/usr/bin/python
import sys
import os
import time
def gettime():
return time.strftime("%Y-%m-%d %k:%M:%S", time.localtime())
def hadoop_ls(dir):
cmd = "hadoop fs -ls %s" % dir
file = os.popen(cmd)
line = file.readline();
reslist = []
while True:
line = file.readline()
if len(line) == 0:
b... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
try:
import boto.ec2
from boto.ec2.blockdevicemapping import BlockDeviceType, BlockDeviceMapping
HAS_BOTO=True
except ImportError:
HAS_BOTO=False
import json
def... |
from __future__ import absolute_import
from __future__ import division
from collections import namedtuple
from contextlib import contextmanager
from monkeypatch import MonkeyPatchScope
from vdsm.common import libvirtconnection
from vdsm import v2v
from testlib import VdsmTestCase as TestCaseBase, namedTemporaryDir
fr... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
v_edit.py
---------
Date : March 2016
Copyright : (C) 2016 by Médéric Ribreux
Email : medspx at medspx dot fr
*******************************************... |
#
# convert-smbconfig.py: Convert an smb.conf file into OpenPLi format
#
import sys
import os.path
import collections
import ConfigParser
# ini files processed by this command
SMBCONF = "/etc/samba/smb.conf"
SMBUSERCONF = "/etc/samba/smb-user.conf"
# location of the share config
SHAREPATH = '/etc/samba/shares'
#
# ... |
""" Functions for converting from DOS to UNIX line endings
"""
from __future__ import division, absolute_import, print_function
import sys, re, os
def dos2unix(file):
"Replace CRLF with LF in argument files. Print names of changed files."
if os.path.isdir(file):
print(file, "Directory!")
ret... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
from os import getenv
from os.path import isfile
try:
from taiga import TaigaAPI
from taiga.exceptions import TaigaException
TAIGA_MODULE_IMPORTED=True
except ImportE... |
import select
import socket
from django.utils.translation import ugettext as _
from desktop import conf
from desktop.lib.i18n import smart_str
__all__ = ['CaseInsensitiveDict', 'create_synchronous_io_multiplexer']
class CaseInsensitiveDict(dict):
def __setitem__(self, key, value):
super(CaseInsensitiveDict, s... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
import traceback
try:
import libvirt
except ImportError:
HAS_VIRT = False
else:
... |
# -*- coding: utf-8 -*-
"""
head_request.py
~~~~~~~~~~~~~~~
A short example that demonstrates a client that makes HEAD requests to certain
websites.
This example is intended as a reproduction of nghttp2 issue 396, for the
purposes of compatibility testing.
"""
from __future__ import print_function
from twisted.inter... |
import sys
import ns.core
import ns.csma
import ns.internet
import ns.network
import ns.tap_bridge
def main(argv):
#
# We are interacting with the outside, real, world. This means we have to
# interact in real-time and therefore we have to use the real-time simulator
# and take the time to calculate... |
"""Cache lines from files.
This is intended to read lines from modules imported -- hence if a filename
is not found, it will look down the module search path for a file by
that name.
"""
import sys
import os
__all__ = ["getline", "clearcache", "checkcache"]
def getline(filename, lineno, module_globals=None):
li... |
import defaults, sys
defaults.xkbFile = sys.argv[1]
import xkb, dead_keys, codecs
from terminators import terminators
keyTemplate = """key %(QWERTYNAME)s {
label: '%(UPPERNAME)s'
base: '%(LOWERNAME)s'
shift, capslock: '%(UPPERNAME)s'
shift+capslock: '%(LOWER2NAME)s'
... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.core.management.base import BaseCommand, CommandError
from django.db import DEFAULT_DB_ALIAS, connections
from django.db.migrations.loader import MigrationLoader
class Command(BaseCommand):
help = "Shows all available migrations for the ... |
from timeit import Timer
# This is gratefully modeled after the benchmarks found in
# the numpy svn repository. http://svn.scipy.org/svn/numpy/trunk
class Benchmark(object):
"""
Benchmark a method or simple bit of code using different Graph classes.
If the test code is the same for each graph class, then... |
{
'name': 'Luxembourg - Accounting',
'version': '1.0',
'category': 'Localization/Account Charts',
'description': """
This is the base module to manage the accounting chart for Luxembourg.
======================================================================
* the Luxembourg Official Chart of Accou... |
from enum import Enum
class Reaction(Enum):
positive = 1
neutral = 0
negative = -1
class Suggestion():
def __init__(self, topic, candidate_ids, reaction):
self.topic = topic
self.candidate_ids = candidate_ids
self.reaction = reaction
def serialize(self):
return ... |
#!/usr/bin/python3
import os
import sys
import shutil
import argparse
# -- Configuration
MODEL_DIR = 'report'
MODEL_REPORT_FILE = 'report.tex'
MODEL_METADATA_FILE = 'metadata.tex'
REPORT_NAME = 'report'
REPORT_DIR = 'report'
def parse_args():
"""
Parses the command line arguments.
:return: metadata
... |
"""
Test finding orphans via the view and django config
"""
import json
import ddt
from opaque_keys.edx.locator import BlockUsageLocator
from contentstore.tests.utils import CourseTestCase
from contentstore.utils import reverse_course_url
from student.models import CourseEnrollment
from xmodule.modulestore import Mod... |
""" algorithms tests
thomas moll 2015
"""
import unittest
import algorithms
class TestAlgorithms(unittest.TestCase):
def setUp(self):
self.list_a = [12,43,60,32,10]
self.list_b = [43,60,32,10,12]
self.list_c = [10,12,9,7,40,6]
self.big_sorted = list(xrange(1000))
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""ExpandRank keyphrase extraction model.
Graph-based ranking approach to keyphrase extraction described in:
* Xiaojun Wan and Jianguo Xiao.
Single Document Keyphrase Extraction Using Neighborhood Knowledge.
*In proceedings of AAAI*, pages 855-860, 2008.
"""
from _... |
from warnings import warnpy3k
warnpy3k("the SV module has been removed in Python 3.0", stacklevel=2)
del warnpy3k
NTSC_XMAX = 640
NTSC_YMAX = 480
PAL_XMAX = 768
PAL_YMAX = 576
BLANKING_BUFFER_SIZE = 2
MAX_SOURCES = 2
# mode parameter for Bind calls
IN_OFF = 0 # No Video
IN_OVER = 1 ... |
import github.GithubObject
import github.Commit
class Branch(github.GithubObject.NonCompletableGithubObject):
"""
This class represents Branchs. The reference can be found here http://developer.github.com/v3/repos/#list-branches
"""
@property
def commit(self):
"""
:type: :class:`... |
#!/usr/bin/python
#
# Graham Jones, May 2013.
import alsaaudio, audioop
class audioInput:
""" A simple class to grab frames of audio samples from the audio system """
def __init__(self,sampFreq,frameSize):
print("auidioInput.__init__");
self.audioSampleFreq = sampFreq
self.frameSize =... |
from __future__ import unicode_literals
from xml.etree import cElementTree
import re
from django.utils.translation import ugettext_lazy as _
import six
from weblate.trans.checks.base import TargetCheck
BBCODE_MATCH = re.compile(
r'(?P<start>\[(?P<tag>[^]]+)(@[^]]*)?\])(.*?)(?P<end>\[\/(?P=tag)\])',
re.MULT... |
from odoo import fields, models, api, _
from odoo.exceptions import Warning as UserError
import odoo.addons.decimal_precision as dp
from datetime import date
class RibaList(models.Model):
@api.multi
def _compute_acceptance_move_ids(self):
for riba in self:
move_ids = self.env['account.mov... |
#!/usr/bin/env python
from celeryutils import task
from django.core.exceptions import ObjectDoesNotExist
from django.db.models import Count
import amo
from addons.models import AddonDeviceType as ADT
from amo.decorators import write
from amo.utils import chunked
@task
@write
def _task(**kw):
# Remove any dupes... |
# -*- coding: utf-8 -*-
"""
flask_security.confirmable
~~~~~~~~~~~~~~~~~~~~~~~~~~
Flask-Security confirmable module
:copyright: (c) 2012 by Matt Wright.
:license: MIT, see LICENSE for more details.
"""
from datetime import datetime
from flask import current_app as app
from werkzeug.local import ... |
"""ConditionalBijector base."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.ops.distributions import bijector
from tensorflow.python.ops.distributions import util as distribution_util
__all__ = ["ConditionalBijector"]
class Co... |
# -*- coding: utf-8 -*-
from flask import Blueprint, jsonify, current_app, request
from ..webapp import db, redis, basic_auth
from ..action import (stats, scanner, record_manager, genre_manager, user_settings,
scan_manager, export_manager, debug)
bp = Blueprint('api', __name__)
@bp.before_requ... |
"""Functional tests for slice op."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from six.moves import xrange # pylint: disable=redefined-builtin
from tensorflow.python.framework import constant_op
from tensorflow.python.framework i... |
import numpy as np
import pytest
from pandas import DataFrame
import pandas._testing as tm
class TestDataFrameReindexLike:
def test_reindex_like(self, float_frame):
other = float_frame.reindex(index=float_frame.index[:10], columns=["C", "B"])
tm.assert_frame_equal(other, float_frame.reindex_like... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
import os
import time
# import ansible utils
from ansible.module_utils.basic import Ansibl... |
#!/usr/bin/env python
import os, processing
from child import Child
MTN = ["mtn", "--db=~/oe/OE.mtn"]
DIFF = ["diff", "-u"]
def handle_parents(revision):
parents = Child(*MTN+["au", "parents", revision]).stdout.strip().split('\n')
if not parents:
return
print "revision: %s (parents: %s)" % (revis... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.