content
string
# coding: utf-8 from __future__ import unicode_literals from django.template import TemplateSyntaxError from django.test import SimpleTestCase from ..utils import SomeClass, SomeOtherException, UTF8Class, setup class FilterSyntaxTests(SimpleTestCase): @setup({'filter-syntax01': '{{ var|upper }}'}) def test...
class Setup(object): def __init__(self, load_from=None): self.commit(load_from) def is_valid_key(self, key): return key == key.upper() and not key.startswith("_") def commit(self, source): if source: if not hasattr(source, "items"): # pragma: no cover ...
import string import conditions def parse_expression(exp): if isinstance(exp, list): functionsymbol = exp[0] return PrimitiveNumericExpression(functionsymbol, [conditions.parse_term(arg) for arg in exp[1:]]) elif exp.replace(".","").isdigit(): r...
# -*- coding: utf-8 -*- # <nbformat>3.0</nbformat> # <headingcell level=2> # Usage of IC 4069 # <codecell> from __future__ import print_function from BinPy import * # <codecell> # Usage of IC 4069: ic = IC_4069() print(ic.__doc__) # <codecell> # The Pin configuration is: inp = {2: 0, 3: 1, 4: 0, 5: 1, 7: 0, ...
"""Module docstring. Generic Library. Many are for reference, make them "inline" """ __author__ = "Zacharias El Banna" ################################# Generics #################################### def debug_decorator(func_name): def decorator(func): def decorated(*args,**kwargs): res = func(*args,**kwargs) ...
"""Defines trials for parameter exploration.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import time from REDACTED.tensorflow_models.mlperf.models.rough.transformer_lingvo.lingvo.core import hyperparams class Trial(object): """Base class for a t...
from django.conf.urls.defaults import * urlpatterns = patterns('', (r'^$', 'django.views.generic.simple.redirect_to', {'url': '/docs'}), (r'^api(?P<the_rest>/.*)$', 'django.views.generic.simple.redirect_to', {'url': '%(the_rest)s'}), (r'^keys$', 'api.views.api_keys'), (r...
ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} from ansible.module_utils.basic import AnsibleModule try: from ansible.module_utils.network.avi.avi import ( avi_common_argument_spec, avi_ansible_api, HAS_AVI) except ...
#!BPY import struct import bpy import Blender def newFileName(ext): return '.'.join(Blender.Get('filename').split('.')[:-1] + [ext]) def saveAllMeshes(filename): for object in Blender.Object.Get(): if object.getType() == 'Mesh': mesh = object.getData() if (len(mesh.verts) > 0)...
import logging from scrapy.exceptions import NotConfigured from scrapy import signals logger = logging.getLogger(__name__) class AutoThrottle(object): def __init__(self, crawler): self.crawler = crawler if not crawler.settings.getbool('AUTOTHROTTLE_ENABLED'): raise NotConfigured ...
# -*- coding: utf-8 -*- import re import os import sys import xbmc import urllib import xbmcvfs import xbmcaddon import xbmcgui,xbmcplugin from bs4 import BeautifulSoup import requests import simplejson __addon__ = xbmcaddon.Addon() __author__ = __addon__.getAddonInfo('author') __scriptid__ = __addon__.getAddo...
from __future__ import absolute_import from base64 import b64encode from ..packages.six import b ACCEPT_ENCODING = 'gzip,deflate' def make_headers(keep_alive=None, accept_encoding=None, user_agent=None, basic_auth=None, proxy_basic_auth=None, disable_cache=None): """ Shortcuts for generatin...
from testbase import * class SimpleRemoveTests(OperationsTests): @staticmethod def buildPkgs(pkgs, *args): pkgs.leaf = FakePackage('foo', '2.5', '1.1', '0', 'noarch') pkgs.leaf.addFile('/bin/foo') pkgs.requires_leaf = FakePackage('bar', '4') pkgs.requires_leaf.addRequires('foo...
import time from psycopg2 import OperationalError from openerp import SUPERUSER_ID from openerp.osv import fields, osv import openerp.addons.decimal_precision as dp from openerp.tools.translate import _ import openerp PROCUREMENT_PRIORITIES = [('0', 'Not urgent'), ('1', 'Normal'), ('2', 'Urgent'), ('3', 'Very Urgent'...
from django.db import models # from simple_history.models import HistoricalRecords #to store history from django.db.models.fields import * from django.core.mail import send_mail from django.template.loader import get_template from django.template import Context from django.conf import settings import caching.base # ca...
try: import svgwrite except ImportError: # if svgwrite is not 'installed' append parent dir of __file__ to sys.path import sys, os sys.path.insert(0, os.path.abspath(os.path.split(os.path.abspath(__file__))[0]+'/..')) import svgwrite from svgwrite import cm, mm def basic_shapes(name): dwg =...
import bpy from bpy.props import BoolProperty from mathutils import Matrix, Vector from .utils import * from . import fkik #------------------------------------------------------------- # Plane #------------------------------------------------------------- def getRigAndPlane(scn): rig = None plane = None ...
""" This module contains the implementation of SSHSession, which (by default) allows access to a shell and a python interpreter over SSH. Maintainer: Paul Swartz """ import struct import signal import sys import os from zope.interface import implements from twisted.internet import interfaces, protocol from twisted.p...
""" Opal file management. """ import sys import pycurl import opal.core class OpalFile: """ File on Opal file system """ def __init__(self, path): self.path = path def get_meta_ws(self): return '/files/meta' + self.path def get_ws(self): return '/files' + self.path ...
from mock import patch import matplotlib matplotlib.use('Agg') class TestConfig: def setup(self): pass # setup() before each test method def teardown(self): pass # teardown() after each test method @classmethod def setup_class(cls): pass # setup_class...
#! /usr/bin/env python """ This script adds a license file to a DMG. Requires Xcode and a plain ascii text license file. Obviously only runs on a Mac. Copyright (C) 2011-2013 Jared Hobbs Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (t...
"""OAuth 2.0 utilities for Django. Utilities for using OAuth 2.0 in conjunction with the Django datastore. """ __author__ = '<EMAIL> (Joe Gregorio)' import oauth2client import base64 import pickle from django.db import models from oauth2client.client import Storage as BaseStorage class CredentialsField(models.Fiel...
from share.transform.chain import ChainTransformer, Parser, Delegate, RunPython, ParseDate, ParseName, Map, ctx, Try, Subjects, IRI, Concat class Subject(Parser): name = ctx class ThroughSubjects(Parser): subject = Delegate(Subject, ctx) class Tag(Parser): name = ctx class ThroughTags(Parser): t...
""" ============================ Faces dataset decompositions ============================ This example applies to :ref:`olivetti_faces` different unsupervised matrix decomposition (dimension reduction) methods from the module :py:mod:`sklearn.decomposition` (see the documentation chapter :ref:`decompositions`) . """...
#!/usr/bin/env python # -*- coding: utf-8 -*- from core import FeatureExtractorRegistry from twinkle.connectors.core import ConnectorRegistry class FeatureExtractorPipelineFactory(object): """ Factory object for creating a pipeline from a file """ def __init__(self): """ """ pass def buildInput(self,...
# -*- encoding: utf-8 -*- from __future__ import unicode_literals import re from unittest import skipUnless from django.core.management import call_command from django.db import connection from django.test import TestCase, skipUnlessDBFeature from django.utils.six import PY3, StringIO class InspectDBTestCase(TestCa...
import crm_helpdesk_report # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
from django.test import TestCase import pytest from django.test import Client from django.core.urlresolvers import reverse from webapp.apps.register.models import Subscriber # run this with `py.test --pdb -s -m register` # actually no. `py.test -q webapp/apps/register/tests.py` @pytest.mark.register class Register...
"""Fichier contenant la fonction a_rang.""" from primaires.format.fonctions import supprimer_accents from primaires.scripting.fonction import Fonction from primaires.scripting.instruction import ErreurExecution class ClasseFonction(Fonction): """Retourne vrai si le personnage a le rang indiqué dans la guilde."""...
import os import sys here = os.path.split(__file__)[0] def wpt_path(*args): return os.path.join(here, *args) # Imports sys.path.append(wpt_path("harness")) from wptrunner import wptcommandline def update_tests(**kwargs): from wptrunner import update set_defaults(kwargs) logger = update.setup_logg...
import os, re, string, sys from file_util import * import git_util as git # script directory script_dir = os.path.dirname(__file__) # CEF root directory cef_dir = os.path.abspath(os.path.join(script_dir, os.pardir)) # Valid extensions for files we want to lint. DEFAULT_LINT_WHITELIST_REGEX = r"(.*\.cpp|.*\.cc|.*\.h)...
# -*- coding: utf-8 -*- """ Created on Sun May 06 05:32:15 2012 Author: Josef Perktold editted by: Paul Hobson (2012-08-19) """ from scipy import stats from matplotlib import pyplot as plt import statsmodels.api as sm #example from docstring data = sm.datasets.longley.load() data.exog = sm.add_constant(data.exog, pre...
"""Tests for distutils.command.bdist_rpm.""" import unittest import sys import os import tempfile import shutil from test.support import run_unittest from distutils.core import Distribution from distutils.command.bdist_rpm import bdist_rpm from distutils.tests import support from distutils.spawn import find_executabl...
ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'network'} import re from ansible.module_utils.network.nxos.nxos import get_config, load_config, run_commands from ansible.module_utils.network.nxos.nxos import get_capabilities, nxos_argumen...
# pylint: disable=missing-docstring # pylint: disable=redefined-outer-name import os from lettuce import world, step from nose.tools import assert_true, assert_in # pylint: disable=no-name-in-module from django.conf import settings from student.roles import CourseStaffRole, CourseInstructorRole, GlobalStaff from stu...
from ..family.target_kinetis import Kinetis from ..family.flash_kinetis import Flash_Kinetis from ...core.memory_map import (FlashRegion, RamRegion, MemoryMap) from ...debug.svd.loader import SVDFile RCM_MR = 0x4007f010 RCM_MR_BOOTROM_MASK = 0x6 FLASH_ALGO = { 'load_address' : 0x20000000, 'instructions' : [ ...
from django.forms.models import ModelFormMetaclass, ModelForm from django.template import RequestContext, loader from django.http import Http404, HttpResponse, HttpResponseRedirect from django.core.xheaders import populate_xheaders from django.core.exceptions import ObjectDoesNotExist, ImproperlyConfigured from django....
from django.core.exceptions import ImproperlyConfigured from django.forms import models as model_forms from django.http import HttpResponseRedirect from django.views.generic.base import ContextMixin, TemplateResponseMixin, View from django.views.generic.detail import ( BaseDetailView, SingleObjectMixin, SingleObjec...
#!/usr/bin/env python import unittest from PySide2.QtCore import QObject, Slot, SIGNAL, SLOT class MyObject(QObject): def __init__(self, parent=None): QObject.__init__(self, parent) self._slotCalledCount = 0 @Slot() def mySlot(self): self._slotCalledCount = self._slotCalledCount ...
import mxnet as mx import numpy as np import logging from solver import Solver, Monitor try: import cPickle as pickle except: import pickle def extract_feature(sym, args, auxs, data_iter, N, xpu=mx.cpu()): input_buffs = [mx.nd.empty(shape, ctx=xpu) for k, shape in data_iter.provide_data] input_names = [...
ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['preview'], 'supported_by': 'community'} DOCUMENTATION = r''' --- module: win_msg version_added: "2.3" short_description: Sends a message to logged in users on Windows hosts. description: - Wraps the msg.exe command i...
import json from telemetry.core import web_contents from telemetry.core.backends.chrome import inspector_backend class MiscWebContentsBackend(object): """Provides acccess to chrome://oobe/login page, which is neither an extension nor a tab.""" def __init__(self, browser_backend): self._browser_backend = bro...
# http://www.absoft.com/literature/osxuserguide.pdf # http://www.absoft.com/documentation.html # Notes: # - when using -g77 then use -DUNDERSCORE_G77 to compile f2py # generated extension modules (works for f2py v2.45.241_1936 and up) import os from numpy.distutils.cpuinfo import cpu from numpy.distutils.fcompiler ...
import types import numpy def _extend_mode_to_code(mode): """Convert an extension mode to the corresponding integer code. """ if mode == 'nearest': return 0 elif mode == 'wrap': return 1 elif mode == 'reflect': return 2 elif mode == 'mirror': return 3 elif mo...
from __future__ import print_function import getpass import inspect import os import sys import textwrap from oslo_utils import encodeutils from oslo_utils import strutils import prettytable import six from six import moves from nova.openstack.common._i18n import _ class MissingArgs(Exception): """Supplied arg...
""" Tests for logout for enterprise flow """ import ddt import mock from django.test.utils import override_settings from django.urls import reverse from openedx.core.djangolib.testing.utils import CacheIsolationTestCase, skip_unless_lms from openedx.features.enterprise_support.api import enterprise_enabled from ope...
#-*- coding:utf-8 -*- """ This file is part of PyGaze. PyGaze 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. PyGaze is distributed in the...
#!/usr/bin/env python import vtk from vtk.test import Testing from vtk.util.misc import vtkGetDataRoot VTK_DATA_ROOT = vtkGetDataRoot() # Create the RenderWindow, Renderer and both Actors ren1 = vtk.vtkRenderer() renWin = vtk.vtkRenderWindow() renWin.AddRenderer(ren1) iren = vtk.vtkRenderWindowInteractor() iren.SetRen...
import os import synapse.exc as s_exc import synapse.common as s_common import synapse.lib.rstorm as s_rstorm import synapse.tests.utils as s_test rst_in = ''' HI ## .. storm-cortex:: default .. storm-cortex:: default .. storm-opts:: {"vars": {"foo": 10, "bar": "baz"}} .. storm-pre:: [ inet:asn=$foo ] .. storm:: $l...
#!/usr/bin/env python """ Which - locate a command * adapted from Brian Curtin's http://bugs.python.org/file15381/shutil_which.patch * see http://bugs.python.org/issue444582 * uses ``PATHEXT`` on Windows * searches current directory before ``PATH`` on Windows, but not before an explicitly passed ...
"""Windows service. Requires pywin32.""" import os import win32api import win32con import win32event import win32service import win32serviceutil from cherrypy.process import wspbus, plugins class ConsoleCtrlHandler(plugins.SimplePlugin): """A WSPBus plugin for handling Win32 console events (like Ct...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = { 'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community' } from ansible.module_utils.utm_utils import UTM, UTMModule from ansible.module_utils._text import to_native def main(...
import logging from translate import _ _logger = logging.getLogger(__name__) #------------------------------------------------------------- #ENGLISH #------------------------------------------------------------- to_19 = ( 'Zero', 'One', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine...
import json import mock from cinder import context from cinder.tests.unit.consistencygroup import fake_consistencygroup from cinder.tests.unit import fake_constants as fake from cinder.tests.unit import fake_snapshot from cinder.tests.unit import fake_volume from cinder.tests.unit.volume.drivers.emc import s...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ .. module:: tcpiface.py :platform: Unix, Windows :synopsis: Ulyxes - an open source project to drive total stations and publish observation results. GPL v2.0 license Copyright (C) 2010- Zoltan Siki <<EMAIL>>. .. moduleauthor:: Bence Turak <<EMAIL>> ...
import itertools import os import json from collections import OrderedDict, defaultdict import sqlparse import dbt.project import dbt.utils import dbt.include import dbt.tracking from dbt.utils import get_materialization, NodeType, is_type from dbt.linker import Linker import dbt.compat import dbt.context.runtime i...
#!/usr/bin/env python # -*- coding: utf-8 -*- from runner.koan import * import random class DiceSet: def __init__(self): self._values = None @property def values(self): return self._values def roll(self, n): # Needs implementing! # Tip: random.r...
#!/usr/bin/env python """ @file statistics.py @author Michael Behrisch @author Daniel Krajzewicz @date 2008-10-17 @version $Id: statistics.py 12898 2012-10-26 08:58:14Z behrisch $ Collecting statistics for the CityMobil parking lot SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ Copyright...
import os import re from django.conf import settings from django.core.management.base import CommandError from django.db import models from django.db.models import get_models def sql_create(app, style, connection): "Returns a list of the CREATE TABLE SQL statements for the given app." if connection.settings_...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type import json import re from ansible.errors import AnsibleConnectionFailure from ansible.module_utils._text import to_text, to_bytes from ansible.plugins.terminal import TerminalBase class TerminalModule(TerminalBase): termin...
from __future__ import with_statement from contextlib import contextmanager from django.conf import settings from django.contrib.auth.models import AnonymousUser, User from django.http import HttpRequest from django_lean.experiments.models import (AnonymousVisitor, Experiment, ...
from os import listdir, path from lxml import etree, objectify from pickle import load from sys import argv from StringIO import StringIO from collections import OrderedDict import time from utilities.norm_arxiv import norm_arxiv from utilities.norm_attribute import norm_attribute from utilities.norm_mrow ...
from boto.exception import JSONResponseError class CaseIdNotFound(JSONResponseError): pass class CaseCreationLimitExceeded(JSONResponseError): pass class InternalServerError(JSONResponseError): pass class AttachmentLimitExceeded(JSONResponseError): pass class DescribeAttachmentLimitExceeded(JS...
"""\ A library of useful helper classes to the SAX classes, for the convenience of application and driver writers. """ import os, urllib.parse, urllib.request import io from . import handler from . import xmlreader def __dict_replace(s, d): """Replace substrings of a string using a dictionary.""" for key, val...
# -*- coding: UTF-8 -*- """ Test libpython.py. This is already partly tested by test_libcython_in_gdb and Lib/test/test_gdb.py in the Python source. These tests are run in gdb and called from test_libcython_in_gdb.main() """ import os import sys import gdb from Cython.Debugger import libcython from Cython.Debugger ...
from django.shortcuts import render, render_to_response from django.http import HttpResponse, HttpResponseRedirect from django.views import generic from django.core.context_processors import csrf from django.views.decorators.csrf import csrf_protect from django.contrib import auth from django.contrib import messages fr...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from datetime import date from django.db import migrations, models POSTS = [ { "title": "Django 1.0 Release", "slug": "django-10-released", "pub_date": date(2008, 9, 3), "startups": [], "tags": ["django", "pyt...
""" =========== Zoom Window =========== This example shows how to connect events in one window, for example, a mouse press, to another figure window. If you click on a point in the first window, the z and y limits of the second will be adjusted so that the center of the zoom in the second window will be the x,y coord...
import cStringIO import os import pickle import socket import sys import pyauto class RemoteHost(object): """Class used as a host for tests that use the PyAuto RemoteProxy. This class fires up a listener which waits for a connection from a RemoteProxy and receives method call requests. Run python remote_host.p...
""" An implementation of a key manager that reads its key from the project's configuration options. This key manager implementation provides limited security, assuming that the key remains secret. Using the volume encryption feature as an example, encryption provides protection against a lost or stolen disk, assuming ...
from test import test_support import unittest import nis class NisTests(unittest.TestCase): def test_maps(self): try: maps = nis.maps() except nis.error, msg: # NIS is probably not active, so this test isn't useful if test_support.verbose: print "...
#!/usr/bin/python # -*- coding:utf-8 -*- """ A script to create the "Terrain Table" on the TerrainCodeTableWML wiki page. Add the output to the wiki whenever a new terrain is added to mainline. """ from __future__ import with_statement # For python < 2.6 import os import sys import re try: import argparse excep...
#!/usr/bin/env python """A class representing entity property range.""" # pylint: disable=g-bad-name # pylint: disable=g-import-not-at-top import datetime from google.appengine.ext import ndb from google.appengine.ext import db from mapreduce import errors from mapreduce import util __all__ = [ "should_shard...
import mock import unittest from cloudbaseinit.openstack.common import cfg from cloudbaseinit.plugins.windows.userdataplugins import urldownload CONF = cfg.CONF class UrlDownloadHandlerTests(unittest.TestCase): def setUp(self): self._urldownload = urldownload.URLDownloadPlugin() @mock.patch('cloud...
# -*- coding: utf-8 -*- """ werkzeug.contrib.profiler ~~~~~~~~~~~~~~~~~~~~~~~~~ This module provides a simple WSGI profiler middleware for finding bottlenecks in web application. It uses the :mod:`profile` or :mod:`cProfile` module to do the profiling and writes the stats to the stream provide...
"""Tests for qutebrowser.misc.split.""" import collections import pytest from qutebrowser.misc import split # Most tests copied from Python's shlex. # The original test data set was from shellwords, by Hartmut Goebel. # Format: input/split|output|without|keep/split|output|with|keep/ test_data_str = r""" one two/o...
""" Plugin for ResolveUrl Copyright (C) 2020 gujal 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...
"""Test configs for unpack.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np import tensorflow as tf from tensorflow.lite.testing.zip_test_utils import create_tensor_data from tensorflow.lite.testing.zip_test_utils import make_zip_of_tes...
"""<MyProject>, a CherryPy application. Use this as a base for creating new CherryPy applications. When you want to make a new app, copy and paste this folder to some other location (maybe site-packages) and rename it to the name of your project, then tweak as desired. Even before any tweaking, this should serve a fe...
"""Support for switch sensor using I2C MCP23017 chip.""" from adafruit_mcp230xx.mcp23017 import MCP23017 # pylint: disable=import-error import board # pylint: disable=import-error import busio # pylint: disable=import-error import digitalio # pylint: disable=import-error import voluptuous as vol from homeassistant...
#!/usr/bin/python3 import sys import random def make_net(n,order): def previous(i): return (((i-2) % n) + 1) print('petri net "leader election %i" {' % n) print(' places {') for i in range(1,n+1): print(' ', end='') for j in range(1,n+1): print('s%in%i ' % (i,j)...
from django.db.models.manager import Manager from django.contrib.gis.db.models.query import GeoQuerySet class GeoManager(Manager): "Overrides Manager to return Geographic QuerySets." # This manager should be used for queries on related fields # so that geometry columns on Oracle and MySQL are selected ...
""" Views for managing Neutron Networks. """ from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse_lazy from django.utils.translation import ugettext_lazy as _ from horizon import exceptions from horizon import forms from horizon import tables from horizon.utils import memoized from...
import re import os import kirk import numpy as n import pickle def trimmean(arr, percent): n = len(arr) k = int(round(n*(float(percent)/100)/2)) return n.mean(arr[k+1:n-k]) File = kirk.File width = kirk.width height = kirk.height box_size = kirk.box_size #Dictionary data structure to hold out parsed data...
"""Timeseries plotting functions.""" from __future__ import division import numpy as np import pandas as pd from scipy import stats, interpolate import matplotlib as mpl import matplotlib.pyplot as plt from .external.six import string_types from . import utils from . import algorithms as algo from .palettes import c...
import re, time, random from openerp import api from openerp.osv import fields, osv from openerp.tools.translate import _ import logging _logger = logging.getLogger(__name__) """ account.invoice object: - Add support for Belgian structured communication - Rename 'reference' field labels to 'Communica...
""" Test functions for linalg module """ from __future__ import division, absolute_import, print_function import numpy as np from numpy import linalg, arange, float64, array, dot, transpose from numpy.testing import ( TestCase, run_module_suite, assert_equal, assert_array_equal, assert_array_almost_equal, asse...
"""Exceptions for generated client libraries.""" class Error(Exception): """Base class for all exceptions.""" class TypecheckError(Error, TypeError): """An object of an incorrect type is provided.""" class NotFoundError(Error): """A specified resource could not be found.""" class UserError(Error)...
# -*- coding: utf-8 -*- from odoo.tests import common class TestStockCommon(common.TransactionCase): def setUp(self): super(TestStockCommon, self).setUp() self.ProductObj = self.env['product.product'] self.UomObj = self.env['uom.uom'] self.PartnerObj = self.env['res.partner'] ...
from __future__ import (absolute_import, division, print_function, unicode_literals) import logging import datetime import time from . import boundary_plugin from . import status_store """ If getting statistics from CloudWatch fails, we will retry up to this number of times before giving up and aborting the plugin. ...
"""Keras scikit-learn API wrapper.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from tensorflow.python.keras._impl.keras.wrappers.scikit_learn import KerasClassifier from tensorflow.python.keras._impl.keras.wrappers.scikit_learn import KerasRegressor ...
#!/usr/bin/env python import re, os, sys, fnmatch # Regex pattern to extract the directory path in a #define FILE_DIR filedir_pattern = re.compile(r'^#define\s*FILE_DIR\s*"(.*?)"') # Regex pattern to extract any single quoted piece of text. This can also # match single quoted strings inside of double quote...
import os import urllib2 import re import logging from subprocess import Popen from subprocess import PIPE class Downloader(object): def __init__(self, config): self._ctx = config self._log = logging.getLogger('downloads') self._init_proxy() def _init_proxy(self): handlers = ...
# !/usr/bin/env python3 import threading import time import urllib.request import json from .. import modulebase weather_check_interval = 60 # check every minute city = 'Kanata,ON' cur_weather_url = ('http://api.openweathermap.org/data/2.5/weather?q=%s&units=metric') % (city) forecast_url = ('http://api.openweath...
#!/usr/bin/env python ''' Run this script to update all the copyright headers of files that were changed this year. For example: // Copyright (c) 2009-2012 The Bitcoin Core developers it will change it to // Copyright (c) 2009-2015 The Bitcoin Core developers ''' import os import time import re year = time.gmtime(...
# -*- coding: utf-8 -*- import random from openerp import SUPERUSER_ID from openerp.osv import osv, orm, fields from openerp.addons.web.http import request class payment_transaction(orm.Model): _inherit = 'payment.transaction' _columns = { # link with the sale order 'sale_order_id': fields.m...
from __future__ import unicode_literals import webnotes from webnotes.utils import cstr class DocType: def __init__(self, d, dl): self.doc, self.doclist = d, dl def autoname(self): self.doc.name = self.doc.dt + "-" + self.doc.script_type def on_update(self): webnotes.clear_cache(doctype=self.doc.dt) de...
# -*- coding: utf-8 -*- import json from .base import BikeShareSystem, BikeShareStation from . import utils class BySykkel(BikeShareSystem): authed = True meta = { 'system': 'BySykkel', 'company': ['Urban Infrastructure Partner'] } def __init__(self, tag, meta, feed_url, feed_detai...
import os import datetime import itertools import string from django.db import models from django.db.models import Q from django.contrib.auth.models import User, Group from django.db.models.signals import post_save from django.dispatch import receiver from django.core.urlresolvers import reverse from django.utils.trans...
'''craigslist blob event module. This should only be used internally by the client module.''' import hashlib import clblob import clcommon.anybase import clcommon.profile class Event(object): '''Base class for various events used in the client.''' params = [] def __init__(self, client, method, name, ...