content
string
""" Groups together code used for creating a NuPIC model and dealing with IO. (This is a component of the One Hot Gym Prediction Tutorial.) """ import importlib import sys import csv import datetime from nupic.data.inference_shifter import InferenceShifter from nupic.frameworks.opf.metrics import MetricSpec from nupic...
from test_framework.test_framework import BitcoinTestFramework from test_framework.util import * from test_framework.mininode import CTransaction, COIN from io import BytesIO def txFromHex(hexstring): tx = CTransaction() f = BytesIO(hex_str_to_bytes(hexstring)) tx.deserialize(f) return tx class ListTr...
"""run all examples to make sure we don't get an exception Note: If an example contaings plt.show(), then all plot windows have to be closed manually, at least in my setup. uncomment plt.show() to show all plot windows """ from __future__ import print_function from statsmodels.compat import input stop_on_error = Tru...
"""Utility file for visualizing generated images.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import math from tensorflow.python.framework import ops from tensorflow.python.ops import array_ops __all__ = [ "image_grid", "image_reshaper", ]...
from __future__ import unicode_literals import frappe from frappe.utils import flt from erpnext.stock.utils import get_buying_amount, get_sales_bom_buying_amount def execute(filters=None): if not filters: filters = {} stock_ledger_entries = get_stock_ledger_entries(filters) source = get_source_data(filters) item...
def _get_quote_state(token, quote_char): ''' the goal of this block is to determine if the quoted string is unterminated in which case it needs to be put back together ''' # the char before the current one, used to see if # the current character is escaped prev_char = None for idx, cur_c...
#!/usr/bin/python from __future__ import print_function from bcc import BPF import sys import socket import os import argparse import time import netifaces as ni from sys import argv from kafka import KafkaProducer from kafka.errors import KafkaError from datetime import datetime #args def usage(): print("USAGE:...
import os, os.path import sys import re import time, datetime import csv, json import urllib.request, urllib.error PATH = "C:\\BlueFors logs" FOLDER_PATTERN = r"([0-9]{2})-([0-9]{2})-([0-9]{2})" FRIDGE = 'BlueFors_QT1' SENSORS = ((1, "Fifty_K"), (2, "Four_K"), (3, "Magnet"), (5, "Still...
import github import Framework class Issue214(Framework.TestCase): # https://github.com/jacquev6/PyGithub/issues/214 def setUp(self): Framework.TestCase.setUp(self) self.repo = self.g.get_user().get_repo("PyGithub") self.issue = self.repo.get_issue(1) def testAssignees(self): ...
""" Object The Object is the "naked" base class for things in the game world. Note that the default Character, Room and Exit does not inherit from this Object, but from their respective default implementations in the evennia library. If you want to use this class as a parent to change the other types, you can do so b...
"""Utils.""" import gettext import grp import pwd import re from otopi import util from otopi import plugin from otopi import constants as otopicons def _(m): return gettext.dgettext(message=m, domain='ovirt-engine-setup') @util.export def editConfigContent( content, params, keep_existing=False, ...
""" Automated tests for checking transformation algorithms (the models package). """ from __future__ import with_statement import logging import unittest import os import tempfile from six.moves import zip as izip from collections import namedtuple import numpy as np from gensim import utils, matutils from gensim....
'''Top-level Pygame module. Pygame is a set of Python modules designed for writing games. It is written on top of the excellent SDL library. This allows you to create fully featured games and multimedia programs in the Python language. The package is highly portable, with games running on Windows, MacOS, OS X, BeOS, F...
__author__ = "George Chantzialexiou" __copyright__ = "Copyright 2012-2013, The Pilot Project" __license__ = "MIT" """ A Mandelbrot Fractal Generator Using Pilot Job This is an example of mandelbrot Fracatl Generator using the capabilities of Pilot Job API. It requires the Python Image Library (PIL) which c...
"""Authentication helpers.""" import hmac HAVE_KERBEROS = True try: import kerberos except ImportError: HAVE_KERBEROS = False from base64 import standard_b64decode, standard_b64encode from collections import namedtuple from hashlib import md5, sha1 from random import SystemRandom from bson.binary import Bin...
from django.core.urlresolvers import reverse from onadata.apps.main.models import MetaData from onadata.apps.main.views import edit from onadata.apps.logger.models import XForm from onadata.apps.logger.views import delete_xform from test_base import TestBase class TestFormEdit(TestBase): def setUp(self): ...
import json import os import tempfile import fixtures from testtools import matchers from tests.software_config import common class HeatConfigKubeletORCTest(common.RunScriptTest): fake_hooks = ['kubelet'] data = [{ "id": "abcdef001", "group": "kubelet", "name": "mysql", "co...
from django.db import models from django.contrib.auth.models import AbstractUser, UserManager from django.utils import timezone from django.dispatch import receiver from django.db.models.signals import post_save from localflavor.in_ import in_states gettext_noop = lambda s: s EDUCATIONAL_ROLE= ( ('vb', gettext_n...
import socket import traceback, sys from binascii import hexlify import time, os from test_framework.socks5 import Socks5Configuration, Socks5Command, Socks5Server, AddressType from test_framework.test_framework import BitcoinTestFramework from test_framework.util import * ''' Test plan: - Start bitcoind's with differ...
import os import sys # # an almost exact copy of the shutil.which() implementation from python3.4 # def which(cmd, mode=os.F_OK | os.X_OK, path=None): """Given a command, mode, and a PATH string, return the path which conforms to the given mode on the PATH, or None if there is no such file. `mode` de...
"""A Transformed Distribution class.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from tensorflow.contrib.distributions.python.ops import distribution as distributions from tensorflow.contrib.distributions.python.ops import distribution_util from tenso...
# -*- coding: utf-8 -*- """ An alphabetical list of Finnish municipalities for use as `choices` in a formfield. This exists in this standalone file so that it's only imported into memory when explicitly needed. """ MUNICIPALITY_CHOICES = ( ('akaa', u"Akaa"), ('alajarvi', u"Alajärvi"), ('alavieska', u"Alav...
#!/bin/env python import unittest import glfw from OpenGL import GL from PIL import Image import numpy from vrprim.imposter import sphere def images_are_identical(img1, img2): ar1 = numpy.array(img1.convert('RGBA')) ar2 = numpy.array(img2.convert('RGBA')) return numpy.array_equiv(ar1, ar2)...
import cPickle as pickle import os import shutil import sys import warnings import rope.base.fscommands from rope.base import exceptions, taskhandle, prefs, history, pycore, utils from rope.base.resourceobserver import * from rope.base.resources import File, Folder, _ResourceMatcher class _Project(object): def ...
#!/usr/bin/env python # # Python sample application that reads from the raspicomm's RS-485 Port # # Thanks to Acmesystems, program edited by Giovanni Manzoni @ HardElettroSoft # # 9600 8N1 flow control Xon/Xoff # import array import serial maxReadCount=10 readBuffer = array.array('c') print('this sample application...
from __future__ import with_statement import json import os import subprocess import urllib from django.conf import settings GITHUB_REPOS = "https://api.github.com/repos/mozilla/kuma/contributors" class Human(object): def __init__(self): self.name = None self.website = None class HumansTXT(ob...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type from ansible.errors import * from ansible.plugins.lookup import LookupBase from ansible.utils.listify import listify_lookup_plugin_terms class LookupModule(LookupBase): def _check_list_of_one_list(self, term): # make ...
import datetime import dateutil.parser import http import http.client import json import logging import multiprocessing import os import platform import ssl import re import threading import urllib logger = logging.getLogger(__name__) class Beacon(object): USER_AGENT = "Paperwork" UPDATE_CHECK_INTERVAL = d...
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from dnfpluginscore import logger, _ import dnf import dnf.cli import dnfpluginscore import functools import os import re import stat def list_opened_files(uid): fo...
# encoding: utf-8 from __future__ import unicode_literals import re from .common import InfoExtractor class DumpIE(InfoExtractor): _VALID_URL = r'^https?://(?:www\.)?dump\.com/(?P<id>[a-zA-Z0-9]+)/' _TEST = { 'url': 'http://www.dump.com/oneus/', 'md5': 'ad71704d1e67dfd9e81e3e8b42d69d99', ...
""" Table of Contents Extension for Python-Markdown * * * (c) 2008 [Jack Miller](http://codezen.org) Dependencies: * [Markdown 2.1+](http://packages.python.org/Markdown/) """ from __future__ import absolute_import from __future__ import unicode_literals from . import Extension from ..treeprocessors import Treeproce...
from javascript import JSConstructor, JSObject from .vector import vec class primitive: def __init__(self, prim, **kwargs): for _key in kwargs.keys(): if isinstance(kwargs[_key], vec): kwargs[_key]=kwargs[_key]._vec self._prim=prim(kwargs) def rotate(self, **kwargs): if '...
from datetime import timedelta from xmodule.modulestore.django import modulestore class CourseGradingModel(object): """ Basically a DAO and Model combo for CRUD operations pertaining to grading policy. """ # Within this class, allow access to protected members of client classes. # This comes up wh...
{ 'name': 'Stock Picking Locations', 'version': '8.0.1.0.0', 'category': 'Warehouse Management', 'sequence': 14, 'summary': '', 'description': """ Stock Picking Locations ======================= Add Location and Destiny Location to stock picking. When stock moves are created they are taken by de...
"""Tests many modules to compute energy of LiH.""" import os import unittest import numpy from openfermion.config import DATA_DIRECTORY from openfermion.chem import MolecularData from openfermion.transforms.opconversions import (get_fermion_operator, normal_ordered, j...
"""BibFormat element - Prints date of the entry of the record in database """ __revision__ = "$Id$" def format_element(bfo): """ Date of the entry of the record in the database @see: date.py """ date = bfo.field('909C1c') return date
from msrest.serialization import Model class PoolAddParameter(Model): """A pool in the Azure Batch service to add. :param id: A string that uniquely identifies the pool within the account. The ID can contain any combination of alphanumeric characters including hyphens and underscores, and cannot co...
from pyasn1.type import tag, namedtype, namedval, univ, useful from pyasn1_modules import rfc2459 # Start of OCSP module definitions # This should be in directory Authentication Framework (X.509) module class CRLReason(univ.Enumerated): namedValues = namedval.NamedValues( ('unspecified', 0), ('k...
# -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import print_function from typing import Any, Dict from zerver.lib.test_helpers import ( get_user_profile_by_email, most_recent_message, ) from zerver.lib.test_classes import ( ZulipTestCase, ) from zerver.models import ( ...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type import os from ansible.errors import AnsibleError from ansible.module_utils._text import to_native from ansible.plugins.action import ActionBase class ActionModule(ActionBase): TRANSFERS_FILES = True def run(self, tmp=N...
import sys import random import os.path from openid import cryptutil # Most of the purpose of this test is to make sure that cryptutil can # find a good source of randomness on this machine. def test_cryptrand(): # It's possible, but HIGHLY unlikely that a correct implementation # will fail by returning the ...
from Screens.Screen import Screen from Screens.MessageBox import MessageBox from Screens.HelpMenu import HelpableScreen from Components.ActionMap import ActionMap from Components.Sources.StaticText import StaticText from Components.FileList import FileList from Tools.Directories import fileExists, resolveFilename, SCOP...
#!/usr/bin/env python """ Vagrant external inventory script. Automatically finds the IP of the booted vagrant vm(s), and returns it under the host group 'vagrant' Example Vagrant configuration using this script: config.vm.provision :ansible do |ansible| ansible.playbook = "./provision/your_playbook.yml" ...
# This file helps to compute a version number in source trees obtained from # git-archive tarball (such as those provided by githubs download-from-tag # feature). Distribution tarballs (built by setup.py sdist) and build # directories (produced by setup.py build) will contain a much shorter file # that just contains th...
"""The wrapper which starts the application. openduckbilld is a wrapper to rest of the application code. The function StartOpenDuckbill calls the code which reads the config file and does rest of the initialisation. """ import daemon def StartOpenDuckbill(): """Starts the process of setting up environment and in...
import os from testtools.matchers import ( DirExists, FileExists ) import integration_tests class TarPluginTestCase(integration_tests.TestCase): def test_stage_nil_plugin(self): self.run_snapcraft('stage', 'tar') expected_files = [ 'flat', os.path.join('flatdir'...
#!/usr/bin/env python __author__ = 'Tom Schaul (<EMAIL>)' from pybrain.datasets import SequentialDataSet class ParityDataSet(SequentialDataSet): """ Determine whether the bitstring up to the current point conains a pair number of 1s or not.""" def __init__(self): SequentialDataSet.__init__(self, 1,1) ...
# test asynchat from test import support # If this fails, the test will be skipped. thread = support.import_module('_thread') import asynchat import asyncore import errno import socket import sys import time import unittest import unittest.mock try: import threading except ImportError: threading = None HOST...
"""Certificate chain with 1 intermediary, where the target is expired (violates validity.notBefore). Verification is expected to fail.""" import common # Self-signed root certificate (part of trust store). root = common.create_self_signed_root_certificate('Root') root.set_validity_range(common.JANUARY_1_2015_UTC, com...
# 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 'XForm.has_start_time' db.add_column('odk_logger_xform', 'has_start_time', self.gf('django.db.models...
""" Utilities for creating dot output from a MachOGraph XXX: need to rewrite this based on altgraph.Dot """ from collections import deque try: from itertools import imap except ImportError: imap = map __all__ = ['itergraphreport'] def itergraphreport(nodes, describe_edge, name='G'): edges = deque() ...
""" Confirm that net.join_member works """ import samba.tests import os from samba.net import Net, LIBNET_JOIN_AUTOMATIC from samba.credentials import DONT_USE_KERBEROS from samba import NTSTATUSError, ntstatus import ctypes class NetJoinTests(samba.tests.TestCaseInTempDir): def setUp(self): super(NetJoi...
#***Before using this example the motor/controller combination must be #***tuned and the settings saved to the Roboclaw using IonMotion. #***The Min and Max Positions must be at least 0 and 50000 import time import roboclaw def displayspeed(): enc1 = roboclaw.ReadEncM1(address) enc2 = roboclaw.ReadEncM2(ad...
from __future__ import absolute_import, division, unicode_literals from . import support # flake8: noqa import unittest import codecs from io import BytesIO from six.moves import http_client from html5lib.inputstream import (BufferedStream, HTMLInputStream, HTMLUnicodeInputStream, ...
"""Invenio Arxiv Pdf Checker Task. It checks periodically if arxiv papers are not missing pdfs """ from invenio.base.factory import with_app_context @with_app_context() def main(): from .arxiv import main as arxiv_main return arxiv_main()
#A place for code to be called from C-code # that implements more complicated stuff. import re import sys import warnings from numpy.compat import asbytes, bytes if (sys.byteorder == 'little'): _nbo = asbytes('<') else: _nbo = asbytes('>') def _makenames_list(adict): from numpy.core import dtype al...
""" Run sequence classification experiment with Input -> RDSE encoder -> Union model Search for the optimal union window One needs to run the script "run_encoder_only.py" first to get the optimal encoder resolution """ import pickle import time import matplotlib.pyplot as plt import multiprocessing from util_functio...
from zope.interface import implements, Interface, Attribute from twisted.internet.protocol import Protocol, ServerFactory, ClientFactory, \ connectionDone from twisted.internet import defer from twisted.protocols import basic from twisted.python import log from twisted.web import server, resource, http from thrift...
#STANDARD LIB from datetime import datetime from decimal import Decimal from itertools import chain import warnings #LIBRARIES from django.conf import settings from django.db import models from django.db.backends.util import format_number from django.db import IntegrityError from django.utils import timezone from goo...
#!/usr/bin/env python import os import sys import subprocess import shutil import commands def runCommand(workingDir, bextractLocation, sfpluginLocation, extraBextractCmdArgs, mfFileLocation, outputMplFile, testFile, goodFilename): os.chdir(workingDir) bextractCmd = ("%s %s -t %s -p %s") % (be...
from __future__ import print_function import time, signal, sys from upm import pyupm_lcd as upmLCD def main(): myLCD = upmLCD.SSD1308(0, 0x3C); logoArr = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 192, 192, 192, 224, ...
"""This example deletes an ad group criterion using the 'REMOVE' operator. To get ad group criteria, run get_placements.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 a...
""" ================================= Compare BIRCH and MiniBatchKMeans ================================= This example compares the timing of Birch (with and without the global clustering step) and MiniBatchKMeans on a synthetic dataset having 100,000 samples and 2 features generated using make_blobs. If ``n_clusters...
# META: timeout=long import pytest from tests.support.asserts import assert_dialog_handled, assert_error, assert_success def close(session): return session.transport.send( "DELETE", "session/{session_id}/window".format(**vars(session))) @pytest.fixture def check_user_prompt_closed_without_exception(se...
# -*- coding: utf-8 -*- ''' Specto Add-on Copyright (C) 2015 lambda 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 l...
""" >>> from django.utils.datastructures import SortedDict >>> d = SortedDict() >>> d[7] = 'seven' >>> d[1] = 'one' >>> d[9] = 'nine' >>> d.keys() [7, 1, 9] >>> d.values() ['seven', 'one', 'nine'] >>> d.items() [(7, 'seven'), (1, 'one'), (9, 'nine')] # Overwriting an item keeps it's place. >>> d[1] = 'ONE' >>> d.valu...
import traceback from couchpotato import get_db from couchpotato.api import addApiView from couchpotato.core.event import addEvent from couchpotato.core.helpers.encoding import toUnicode from couchpotato.core.logger import CPLog from couchpotato.core.plugins.base import Plugin from .index import CategoryIndex, Categor...
import sys import socket import codecs import unittest import warnings import os.path from itertools import chain # In Python > 2.7 DeprecationWarnings are disabled by default warnings.simplefilter('default') import libcloud.utils.files from libcloud.utils.misc import get_driver, set_driver from libcloud.utils.py3...
""" The **asdf** subpackage contains code that is used to serialize astropy types so that they can be represented and stored using the Advanced Scientific Data Format (ASDF). This subpackage defines classes, referred to as **tags**, that implement the logic for serialization and deserialization. ASDF makes use of abst...
#!/usr/bin/env python """Check if a '(data page)' for a biomolecule exists""" __author__ = "Kenny Billiau" __copyright__ = "2014, GMD" __license__ = "GPL v2" __version__ = "0.1" import sys import urllib2 import re import downloadinchi as inchi import openpyxl as px import urllib def get_molecules_from_xlsx(fn): ...
from allauth.socialaccount import providers from allauth.socialaccount.providers.base import ProviderAccount from allauth.socialaccount.providers.oauth2.provider import OAuth2Provider from allauth.socialaccount import app_settings class VKAccount(ProviderAccount): def get_profile_url(self): return self.ac...
""" Syndication feed generation library -- used for generating RSS, etc. Sample usage: >>> feed = feedgenerator.Rss201rev2Feed( ... title=u"Poynter E-Media Tidbits", ... link=u"http://www.poynter.org/column.asp?id=31", ... description=u"A group weblog by the sharpest minds in online media/journalism/publi...
"""Miscellaneous WSGI-related Utilities""" import posixpath __all__ = [ 'FileWrapper', 'guess_scheme', 'application_uri', 'request_uri', 'shift_path_info', 'setup_testing_defaults', ] class FileWrapper: """Wrapper to convert file-like objects to iterables""" def __init__(self, filelike, blksize=819...
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import DataMigration from django.db import models class Migration(DataMigration): def forwards(self, orm): "Write your forwards methods here." # Note: Remember to use orm['appname.ModelName'] rather than "from appname.mo...
"""Tests for reduction operators.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np from tensorflow.compiler.tests.xla_test import XLATestCase from tensorflow.python.framework import dtypes from tensorflow.python.framework import errors...
"""Tests for the behavior of the auto-compilation pass.""" 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.compiler.tests.xla_test import XLATestCase from ...
import os import sys sys.path.append(os.path.join(os.path.dirname(__file__), "lib")) import facebook import websites import feeds #import beachstatus from event import EventVault import logging import datetime import time import locale locale.setlocale(locale.LC_TIME, '') # locale for date, time an the infamous germ...
#!/usr/bin/env python # generate logging code # this requires an analysis of the parameters for verbose and do actual call import sys, string, re from read import read_gl def do_logfunc(f_in, f_out): (gl, wgl, glX) = read_gl(f_in) for l in (gl, glX): for t in l: # process ret type to strip trailing spaces ...
#!/usr/bin/env trial import gflags import json import mock import sys import urlparse from ct.client import log_client from ct.client import async_log_client from ct.client import log_client_test_util as test_util from ct.client.db import database from twisted.internet import defer from twisted.internet import task fr...
from pyui.import_image import Ui_ImportImage from PyQt5.QtWidgets import QWidget, QToolBar, QDialog, QDialogButtonBox, QProgressDialog, QMessageBox from PyQt5.QtGui import QIcon from PyQt5.QtCore import Qt, QCoreApplication from qmathplotwidget import QMathPlotWidget, QImPlotWidget import matplotlib.pyplot as plt from ...
from ..route_handler import ModelRouter from ..pubsub_providers.base_provider import PUBACTIONS from .dragon_test_case import DragonTestCase from .models import FooSelfPub, BarSelfPub from .serializers import FooSelfPubSerializer, BarSelfPubSerializer from datetime import datetime class FooModelRouter(ModelRouter): ...
""" Tests for the DjangoXBlockUserService. """ from django.test import TestCase from xblock_django.user_service import ( DjangoXBlockUserService, ATTR_KEY_IS_AUTHENTICATED, ATTR_KEY_USER_ID, ATTR_KEY_USERNAME, ATTR_KEY_USER_IS_STAFF, ) from student.models import anonymous_id_for_user from student.te...
import fixtures from oslo_config import cfg from ironic.common import config CONF = cfg.CONF CONF.import_opt('host', 'ironic.common.service') class ConfFixture(fixtures.Fixture): """Fixture to manage global conf settings.""" def __init__(self, conf): self.conf = conf def setUp(self): s...
from gnuradio import gr from gnuradio import audio from gnuradio import blocks from gnuradio import vocoder from gnuradio.vocoder import codec2 def build_graph(): tb = gr.top_block() src = audio.source(8000) src_scale = blocks.multiply_const_ff(32767) f2s = blocks.float_to_short() enc = vocoder.cod...
from django.conf.urls import patterns, url from radpress.views import ( ArticleArchiveView, ArticleDetailView, ArticleListView, PreviewView, PageDetailView, SearchView, ZenModeView, ZenModeUpdateView) from radpress.feeds import ArticleFeed urlpatterns = patterns( '', url(r'^$', view=ArticleLis...
"""Test for version 2 of the zero_out op.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import tensorflow as tf from tensorflow.examples.adding_an_op import zero_out_grad_2 # pylint: disable=unused-import from tensorflow.examples.adding_an_op import...
{ 'name': 'Dashboards', 'version': '1.0', 'category': 'Hidden', 'description': """ Lets the user create a custom dashboard. ======================================== Allows users to create custom dashboard. """, 'author': 'OpenERP SA', 'depends': ['base', 'web'], 'data': [ 'secur...
{ 'name': 'Thank You Letters', 'version': '10.0.2.1.1', 'category': 'Other', 'author': 'Compassion CH', 'license': 'AGPL-3', 'website': 'http://www.compassion.ch', 'depends': [ 'partner_communication', 'advanced_translation', 'web_widget_digitized_signature', ], ...
def check_requirements(installed_dists): missing_reqs_dict = {} incompatible_reqs_dict = {} for dist in installed_dists: key = '%s==%s' % (dist.project_name, dist.version) missing_reqs = list(get_missing_reqs(dist, installed_dists)) if missing_reqs: missing_reqs_dict[ke...
""" Models to support Course Surveys feature """ import logging from lxml import etree from collections import OrderedDict from django.db import models from student.models import User from django.core.exceptions import ValidationError from model_utils.models import TimeStampedModel from survey.exceptions import Surv...
""" This script runs every build as a hook. If it detects that the build should be clobbered, it will touch the file <build_dir>/.landmine_triggered. The various build scripts will then check for the presence of this file and clobber accordingly. The script will also emit the reasons for the clobber to stdout. A landm...
import unittest from lib import cloudshell from lib.TableSplitsBenchmark import TableSplitsBenchmark class CloudStone5(TableSplitsBenchmark): "Creates a table with many splits" def suite(): result = unittest.TestSuite([ CloudStone5(), ]) return result
#!/usr/bin/env python #weight_heuristic.py import random from alphabeta import UPPER_BOUND from alphabeta import LOWER_BOUND class WeightHeuristic(object): def __init__(self, weight_m): self.weights = weight_m self.wins = 0 self.losses = 0 def __call__(self, game_state): value = 0 state = self.parse(gam...
from openerp.osv import fields, osv class res_company(osv.osv): _inherit = "res.company" _columns = { 'expects_chart_of_accounts': fields.boolean('Expects a Chart of Accounts'), 'tax_calculation_rounding_method': fields.selection([ ('round_per_line', 'Round per Line'), (...
from werkzeug.utils import redirect from werkzeug.exceptions import NotFound from couchy.utils import render_template, expose, \ validate_url, url_for, Pagination from couchy.models import URL @expose('/') def new(request): error = url = '' if request.method == 'POST': url = request.form.get('url...
""" Easyconfig constants module that provides all constants that can be used within an Easyconfig file. @author: Stijn De Weirdt (Ghent University) @author: Kenneth Hoste (Ghent University) """ import platform from vsc.utils import fancylogger from easybuild.tools.systemtools import get_shared_lib_ext, get_os_name, g...
"""\ ======================= Whole File Writer ======================= This component accepts file creation jobs and signals the completion of each jobs. Creation jobs consist of a list [ filename, contents ] added to "inbox". Completion signals consist of the string "done" being sent to "outbox". All jobs are proces...
from django.core.urlresolvers import reverse from rest_framework.compat import patterns, url from rest_framework.test import APITestCase from rest_framework.tests.models import NullableForeignKeySource from rest_framework.tests.serializers import NullableFKSourceSerializer from rest_framework.tests.views import Nullab...
class ModuleDocFragment(object): # Standard files documentation fragment DOCUMENTATION = ''' options: hostname: description: - IP Address or hostname of APIC resolvable by Ansible control host. required: yes aliases: [ host ] username: description: - The username to use for authentic...
import os import sys import unittest if sys.platform != 'win32': raise unittest.SkipTest('Windows only') import _winapi import asyncio from asyncio import _overlapped from asyncio import test_utils from asyncio import windows_events class UpperProto(asyncio.Protocol): def __init__(self): self.buf =...