content stringlengths 4 20k |
|---|
from openerp.osv import fields, osv
class account_bilan_report(osv.osv_memory):
_name = 'account.bilan.report'
_description = 'Account Bilan Report'
def _get_default_fiscalyear(self, cr, uid, context=None):
fiscalyear_id = self.pool.get('account.fiscalyear').find(cr, uid)
return fiscalyear... |
#!/usr/bin/env python3
import os
import sys
import csv
import sqlite3
os.chdir(os.path.dirname(__file__))
def main():
assert(os.path.exists('db.sqlite'))
with sqlite3.connect('db.sqlite', isolation_level = None) as db:
db.execute('''
CREATE TABLE output (
run_id INTEGER,
time REAL,
... |
# coding: utf-8
"""
Unit tests for defaults.py.
"""
import unittest
import pystache
from pystache.tests.common import AssertStringMixin
# TODO: make sure each default has at least one test.
class DefaultsConfigurableTestCase(unittest.TestCase, AssertStringMixin):
"""Tests that the user can change the defaul... |
from __future__ import print_function
import argparse
import datetime
import difflib
import glob
import os
import re
import sys
parser = argparse.ArgumentParser()
parser.add_argument(
"filenames",
help="list of files to check, all files if unspecified",
nargs='*')
rootdir = os.path.dirname(__file__) + "/... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import absolute_import
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.db.models import signals
"""
There are three kinds of plugin base models:
1) SimplePlugin - an object purely associa... |
#!/usr/bin/env python
title = "File Tree (GenericTreeModel)"
description = """
This is a file list demo which makes use of the GenericTreeModel python
implementation of the Gtk.TreeModel interface. This demo shows what methods
need to be overridden to provide a valid TreeModel to a TreeView.
"""
import os
import stat... |
import requests
from bs4 import BeautifulSoup
import xmltodict
import time
date = time.strftime("%B %d %Y")
ls =[]
det = {}
tScore = {}
url = 'fdfdfdgfgh.com'
r = requests.get(url)
data = r.text
doc = xmltodict.parse(data)
soup = BeautifulSoup(data,'html.parser')
matches = soup.find_all(['match','Tme'])
#directScore =... |
from django.template import Library, Node, TemplateSyntaxError
from django.template import resolve_variable
from django.core.cache import cache
from django.utils.encoding import force_unicode
register = Library()
class CacheNode(Node):
def __init__(self, nodelist, expire_time, fragment_name, vary_on):
sel... |
"""Quits Chrome.
This script sends a WM_CLOSE message to each window of Chrome and waits until
the process terminates.
"""
import optparse
import os
import pywintypes
import sys
import time
import win32con
import win32gui
import winerror
import chrome_helper
def CloseWindows(process_path):
"""Closes all windows ... |
# -*- test-case-name: openid.test.test_xri -*-
"""Utility functions for handling XRIs.
@see: XRI Syntax v2.0 at the U{OASIS XRI Technical Committee<http://www.oasis-open.org/committees/tc_home.php?wg_abbrev=xri>}
"""
import re
from functools import reduce
from openid import codecutil # registers 'oid_percent_escape... |
"""Tests for gather_with_default op."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# Dependency imports
from absl.testing import parameterized
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
from tenso... |
# -*- coding: utf-8 -*-
"""
Simple examples demonstrating the use of GLMeshItem.
"""
## Add path to library (just for examples; you do not need this)
import initExample
from pyqtgraph.Qt import QtCore, QtGui
import pyqtgraph as pg
import pyqtgraph.opengl as gl
app = QtGui.QApplication([])
w = gl.GLViewWidget()
w.sh... |
from django import forms
from django.contrib.auth import authenticate
from django.contrib.auth.forms import AuthenticationForm
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy, ugettext as _
ERROR_MESSAGE = ugettext_lazy("Please enter a correct username and password. "
... |
"""\
The ``comports`` function is expected to return an iterable that yields tuples
of 3 strings: port name, human readable description and a hardware ID.
As currently no method is known to get the second two strings easily, they are
currently just identical to the port name.
"""
import glob
import sys
import os
from... |
'''
app.forms
~~~~~~~~~
Forms we need to use when posting datas in our website.
flask_wtf.Form is still useable, but FlaskForm is suggested.
'''
from flask_wtf import FlaskForm
from wtforms import StringField, BooleanField, TextAreaField
from wtforms.validators import DataRequired, Length
from flask_babel import get... |
import gevent
from zerorpc import zmq
def test1():
def server():
c = zmq.Context()
s = c.socket(zmq.REP)
s.bind('tcp://0.0.0.0:9999')
while True:
print 'srv recving...'
r = s.recv()
print 'srv', r
print 'srv sending...'
s... |
"""
This file contains several queries and logic to fetch statistics that can be displayed on the statistics views.
Please note that this file is only meant for the statistics app, and can change at any time!
"""
from pprint import pprint
import asyncio
from datetime import datetime
from peewee import JOIN
from pypl... |
"""An implementation of the Web Site Process Bus.
This module is completely standalone, depending only on the stdlib.
Web Site Process Bus
--------------------
A Bus object is used to contain and manage site-wide behavior:
daemonization, HTTP server start/stop, process reload, signal handling,
drop privileges, PID f... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from os import path, walk
import re
from ansible.errors import AnsibleError
from ansible.module_utils.six import string_types
from ansible.module_utils._text import to_native, to_text
from ansible.plugins.action import ActionBase
... |
"""
openerp_mailgate.py
"""
import cgitb
import time
import optparse
import sys
import xmlrpclib
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.base import MIMEBase
from email.mime.text import MIMEText
from email.utils import COMMASPACE, formatdate
from email import Encoders
class D... |
"""
Twitter Streaming API.
@see: U{http://dev.twitter.com/pages/streaming_api}.
"""
import simplejson as json
from twisted.internet import defer
from twisted.protocols.basic import LineReceiver
from twisted.protocols.policies import TimeoutMixin
from twisted.python import log
from twisted.web.client import ResponseD... |
import pydevconsole
try:
import __builtin__
except ImportError:
import builtins as __builtin__
try:
False
True
except NameError: # version < 2.3 -- didn't have the True/False builtins
setattr(__builtin__, 'True', 1)
setattr(__builtin__, 'False', 0)
try:
import java.lang #@UnusedImport... |
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = r'''
---
module: win_webpicmd
version_added: "2.0"
short_description: Installs packages using Web Platform Installer command-line
description:
- Installs packag... |
from __future__ import print_function
import re
import linecache
import time
import sys
import threading
# tracing
_trace_ignore = set()
_trace_filter = set()
def trace_ignore (names):
"""Add given names to trace ignore set, or clear set if names is None."""
if names is None:
_trace_ignore.clear()
... |
from oslo_config import cfg
from heat.api.openstack.v1 import util
from heat.common import serializers
from heat.common import wsgi
from heat.rpc import client as rpc_client
class BuildInfoController(object):
"""
WSGI controller for BuildInfo in Heat v1 API
Returns build information for current app
"... |
"""
ovirt external inventory script
=================================
Generates inventory that Ansible can understand by making API requests to
oVirt via the ovirt-engine-sdk-python library.
When run against a specific host, this script returns the following variables
based on the data obtained from the ovirt_sdk Nod... |
from kmip.core.repo.repo import ManagedObjectRepo
class MemRepo(ManagedObjectRepo):
def __init__(self):
self.repo = {}
self.uuid = 1
def save(self, managed_object, attributes):
# TODO (nate) verify the parameters
uuid = "{0}".format(self.uuid)
self.repo[uuid] = (manag... |
from django.shortcuts import render
from .forms import UserForm
from .nodes import UserNode
from django.http import HttpResponse,HttpResponseRedirect
from django.contrib.auth import authenticate,login,logout
from .models import UserProfile
# Create your views here.
def index(request):
context={}
if request.user... |
from threading import RLock
from collections import defaultdict
__all__ = ['RequestsManager']
class RequestsManager(object):
def __init__(self):
self.callbacks = defaultdict(lambda: lambda *args, **kwargs: None)
self.lock = RLock()
def request(self, name, *args, **kwargs):
with self... |
from __future__ import absolute_import
import unittest
import os, shutil, sys
from modulegraph import find_modules
from modulegraph import modulegraph
class PackagesTestCase (unittest.TestCase):
if not hasattr(unittest.TestCase, 'assertIsInstance'):
def assertIsInstance(self, object, types, message=None... |
from __future__ import absolute_import
import logging
from os.path import dirname
import imp
import sys
from six.moves.queue import Queue
from tornado.web import Application, FallbackHandler
from tornado.wsgi import WSGIContainer
from .settings import settings as server_settings
from . import websocket
##bokeh_app i... |
import os
import re
import sys
try:
import selinux
except ImportError:
print "failed=True msg='libselinux-python required for this module'"
sys.exit(1)
# getter subroutines
def get_config_state(configfile):
myfile = open(configfile, "r")
lines = myfile.readlines()
myfile.close()
for line i... |
""" Analysis Module for Pyneal Real-time Scan
These tools will set up and apply the specified analysis steps to incoming
volume data during a real-time scan
"""
import os
import sys
import logging
import importlib
import numpy as np
import nibabel as nib
class Analyzer:
""" Analysis Class
This is the mai... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import os
import socket
import ssl
import struct
from ._ssl import (
create_thriftpy_context,
RESTRICTED_SERVER_CIPHERS,
DEFAULT_CIPHERS
)
from .socket import TSocket, TServerSocket
class TSSLSocket(TSocket):
"""SSL socket implementatio... |
from twisted.internet.defer import inlineCallbacks, returnValue
from model import Model
from floranet.appserver.reflector import Reflector
from floranet.lora.bands import LoraBand
from floranet.util import validIPv4Address, validIPv6Address
class Config(Model):
"""NetServer Configuration model
Model repr... |
"""Convert the HDF5 from one group with one table per timestep into a table
with one group with one table per catchment.
This converter is for the aggregation per tribuary.
"""
import numpy as np
import tables
import fnmatch
from crosswater.read_config import read_config
from crosswater.tools.time_helper... |
"""
Test the partitions and partitions service
"""
from unittest import TestCase
from mock import Mock
from opaque_keys.edx.locations import SlashSeparatedCourseKey
from stevedore.extension import Extension, ExtensionManager
from xmodule.partitions.partitions import (
Group, UserPartition, UserPartitionError, No... |
__author__ = 'sdk'
from time import strftime, gmtime, mktime
import datetime
from xml.dom import minidom
import numpy as np
import cx_Oracle
from password import databaseSCO as database
import pandas as pd
pd.options.mode.chained_assignment = None
tables = {"ASDM": "XML_ASDM_ENTITIES", "Main": "XML_MAINTABLE_ENTITIES"... |
"""Treadmill Identity Group CLI
Create, delete and manage identity groups.
"""
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import absolute_import
import logging
import click
from treadmill import cli
from treadmill import context
fro... |
import math, util, rotmat
from rotmat import Vector3, Matrix3
class Aircraft(object):
'''a basic aircraft class'''
def __init__(self):
self.home_latitude = 0
self.home_longitude = 0
self.home_altitude = 0
self.ground_level = 0
self.frame_height = 0.0
self.latitu... |
from openerp import models, api
class SaleOrderLine(models.Model):
_inherit = "sale.order.line"
@api.multi
def product_id_change(
self, pricelist, product, qty=0, uom=False, qty_uos=0,
uos=False, name='', partner_id=False, lang=False,
update_tax=True, date_order=False,... |
from os.path import join
from numpy.distutils.system_info import get_info, get_standard_file, \
BlasNotFoundError
def configuration(parent_package='', top_path=None):
import numpy
from numpy.distutils.misc_util import Configuration
config = Configuration('utils', parent_package, top_path)
confi... |
"""distutils.command.install_scripts
Implements the Distutils 'install_scripts' command, for installing
Python scripts."""
# contributed by Bastian Kleineidam
# This module should be kept compatible with Python 2.1.
__revision__ = "$Id: install_scripts.py 37828 2004-11-10 22:23:15Z loewis $"
import os
from distuti... |
import sys
"""
Class to extract system information from a Linux Box via /proc
The following variables are accessable:
os
cpu
totalRAM
availableRAM
totalVM
availableVM
loadAvg
Example:
s = SystemInformation()
print s.os
s.refresh() # If you need to refresh the dynamic data
"""
class SystemInformation:
def __ini... |
#!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4 encoding=utf-8
def probe(verbose=False):
"""Searches for probable ports on the system"""
import platform
from gsmmodem import GsmModem
import serial
# Common baudrates in approximate popularity order
baudrates = [115200, 9600, 19200]
ports ... |
# Placed into Public Domain in June 2006 by Sean D. Spencer
# Sean D. Spencer
# <EMAIL>
# 2/19/2006
# Last Revision: 4/19/2007
# MIDI Parsing Library for Python.
TRUE = -1
FALSE = 0
class format:
SingleTrack = 0
MultipleTracksSync = 1
MultipleTracksAsync = 2
class voice:
NoteOff = 0x80
NoteOn... |
# -*- coding:utf-8 -*-
import time
import log, config, util
from os import path
LOG = log.get_logger("zxLogger")
Song_Type={0:'unknown',1:u"虾米", 2:"网易"}
class Handler(object):
"""
handler class encapsulate xiami or netease object
"""
def __init__(self, proxies = None):
self.proxies = proxie... |
# coding: utf-8
from __future__ import unicode_literals
from .mtv import MTVServicesInfoExtractor
class TVLandIE(MTVServicesInfoExtractor):
IE_NAME = 'tvland.com'
_VALID_URL = r'https?://(?:www\.)?tvland\.com/(?:video-clips|(?:full-)?episodes)/(?P<id>[^/?#.]+)'
_FEED_URL = 'http://www.tvland.com/feeds/mr... |
"""Sigmoid Tests."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from scipy import special
from tensorflow.contrib.distributions.python.ops.bijectors.sigmoid import Sigmoid
from tensorflow.python.ops.distributions.bijector_test_util ... |
import os, re
from mercurial import util
from common import NoRepo, commit, converter_source, checktool
from common import commandline
from mercurial.i18n import _
class monotone_source(converter_source, commandline):
def __init__(self, ui, path=None, rev=None):
converter_source.__init__(self, ui, path, re... |
from odoo import models, api, _
from odoo.exceptions import UserError
import logging
_logger = logging.getLogger(__name__)
class ProductUom(models.Model):
_inherit = "product.uom"
@api.multi
def action_get_pyafipws_product_uoms(self):
self.get_pyafipws_product_uoms()
@api.multi
def get_... |
from django.test import SimpleTestCase, ignore_warnings, override_settings
from django.test.utils import require_jinja2
from django.utils.deprecation import RemovedInDjango110Warning
@override_settings(
ROOT_URLCONF='shortcuts.urls',
)
class ShortcutTests(SimpleTestCase):
def test_render_to_response(self):
... |
#! /usr/bin/env python3
"""
combinerefs path
A helper for analyzing PYTHONDUMPREFS output.
When the PYTHONDUMPREFS envar is set in a debug build, at Python shutdown
time Py_Finalize() prints the list of all live objects twice: first it
prints the repr() of each object while the interpreter is still fully intact.
Af... |
#!/usr/bin/env python
# coding=utf-8
import datetime
from setting import baseorm, dataorm
class MarkModel(dataorm.Model):
create_time = dataorm.DatetimeField(ddl='datetime', updatable=False)
update_time = dataorm.DatetimeField(ddl='timestamp')
tid = baseorm.IdField(unique='data', updatable=False)
def ... |
"""
The :mod:`sklearn.decomposition` module includes matrix decomposition
algorithms, including among others PCA, NMF or ICA. Most of the algorithms of
this module can be regarded as dimensionality reduction techniques.
"""
from .nmf import NMF, non_negative_factorization
from .pca import PCA, RandomizedPCA
from .incr... |
from subprocess import Popen, PIPE
import sys
import json
result = {}
result['all'] = {}
pipe = Popen(['zoneadm', 'list', '-ip'], stdout=PIPE, universal_newlines=True)
result['all']['hosts'] = []
for l in pipe.stdout.readlines():
# 1:work:running:/zones/work:3126dc59-9a07-4829-cde9-a816e4c5040e:native:shared
... |
from __future__ import absolute_import, unicode_literals
from datetime import datetime
from itertools import count
from time import time
from celery import states
from celery.events import Event as _Event
from celery.events.state import State, Worker, Task
from celery.utils import gen_unique_id
from djcelery import ... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
try:
import boto3
import botocore
HAS_BOTO3 = True
except ImportError:
HAS_BOTO3 = False
from ansible.module_utils.ec2 import get_aws_connection_info, ec2_argumen... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'core'}
import time
from ansible.module_utils.nxos import run_commands
from ansible.module_utils.pycompat24 import get_exception
from ansible.module_utils.basic import AnsibleModule
from ansi... |
"""
Requirements file parsing
"""
from __future__ import absolute_import
import os
import re
import shlex
import optparse
import warnings
from pip._vendor.six.moves.urllib import parse as urllib_parse
from pip._vendor.six.moves import filterfalse
import pip
from pip.download import get_file_content
from pip.req.req... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
This script fixes links that contain common spelling mistakes.
This is only possible on wikis that have a template for these misspellings.
Command line options:
-always:XY instead of asking the user what to do, always perform the same
action. For examp... |
""" API implementation for course-oriented interactions. """
import logging
from django.conf import settings
from django.http import Http404
from rest_framework.authentication import SessionAuthentication
from rest_framework_oauth.authentication import OAuth2Authentication
from rest_framework.exceptions import Authen... |
import sys
__all__ = ['ObjectProxy']
class ObjectProxy(object):
"""
Object that acts as a proxy to another object, forwarding
attribute accesses and method calls. This can be useful
for implementing lazy initialization.
"""
__slots__ = ()
def _get_target(self):
raise NotImplementedError(self)
def __geta... |
import cStringIO
import json
import unicodecsv as ucsv
import uuid
from celery import task
from celery import current_task
from celery.result import AsyncResult
from collections import defaultdict
from copy import deepcopy
from datetime import datetime
from django.contrib.auth.models import User
from onadata.libs.uti... |
"""
Verifies that dependencies on generated headers work, even if the header has
a mixed-case file name.
"""
import TestGyp
test = TestGyp.TestGyp()
CHDIR = 'generated-header'
test.run_gyp('test.gyp', chdir=CHDIR)
test.build('test.gyp', 'program', chdir=CHDIR)
test.up_to_date('test.gyp', 'program', chdir=CHDIR)
ex... |
"""Getting graphs of NAV-collected data from Graphite"""
import re
from urllib import urlencode
from django.core.urlresolvers import reverse
TIMETICKS_IN_DAY = 100 * 3600 * 24
TARGET_TOKENS = re.compile(r'[\w\-*?]+|[(){}\[\]]|,|\.')
def get_sensor_meta(metric_path):
"""
Returns meta information for drawing a... |
import nltk
class DecisionTreeClassifierHelper :
""" Decorator object for DecisionTreeClassifier instances """
def __init__(self, classifier) :
self.classifier = classifier
classifier.pythoncode = self.pythoncode
classifier.pythonclasscode = self.pythonclasscode
def pythoncode(sel... |
import testUtils
import wiotp.sdk
import pytest
class FakePahoMessageCommand:
topic = "iot-2/type/typeid/id/deviceid/cmd/commandid/fmt/json"
payload = b'{"a":4}'
class FakePahoMessageNotification:
topic = "iot-2/type/typeid/id/deviceid/notify"
payload = b'{"a":4}'
class TestGatewayMsg(testUtils.Ab... |
from __future__ import print_function, division
import matplotlib
matplotlib.use('Agg') # Must be before importing matplotlib.pyplot or pylab!
from neuralnilm import Net, RealApplianceSource, BLSTMLayer, DimshuffleLayer
from lasagne.nonlinearities import sigmoid, rectify
from lasagne.objectives import crossentropy, mse... |
from django import forms
from django.db import transaction
from django.db.models import Q
from django.utils.encoding import smart_unicode
from django.utils.translation import ugettext as _
from categories.models import Category
class CategoryChoiceField(forms.ModelChoiceField):
"""
Field to select from a list... |
#!/usr/bin/env python3
"""Example for aiohttp.web basic server
"""
import asyncio
import textwrap
from aiohttp.web import Application, Response, StreamResponse
def intro(request):
txt = textwrap.dedent("""\
Type {url}/hello/John {url}/simple or {url}/change_body
in browser url bar
""").forma... |
import errno
import hashlib
import os
import re
from nova import exception
from nova import flags
from nova.openstack.common import cfg
from nova.openstack.common import jsonutils
from nova.openstack.common import log as logging
from nova import utils
from nova.virt import images
LOG = logging.getLogger(__name__)
... |
"""
Type-related matchers.
"""
import inspect
from callee.base import BaseMatcher
__all__ = [
'InstanceOf', 'IsA', 'SubclassOf', 'Inherits', 'Type', 'Class',
]
class TypeMatcher(BaseMatcher):
"""Matches an object to a type.
This class shouldn't be used directly.
"""
def __init__(self, type_):
... |
import functools
import numpy as np
from .. import color
from ..util.dtype import convert
__all__ = ['adapt_rgb', 'hsv_value', 'each_channel']
def is_rgb_like(image):
"""Return True if the image *looks* like it's RGB.
This function should not be public because it is only intended to be used
for funct... |
"""
WebSubmit Metadata Plugin - This is the plugin to update metadata from
PDF files.
Dependencies: pdftk
"""
__plugin_version__ = "WebSubmit File Metadata Plugin API 1.0"
import os
import shutil
import tempfile
from invenio.shellutils import run_shell_command
from invenio.bibdocfile import decompose_file
from inven... |
from random import shuffle, sample
###########################
# ZIG-ZAG
# SEEDERS
###########################
# Fair at the top
def snake_generator(players, groups):
step = 1
limits = {-1: 0 , 1: groups-1}
n = 0
while players > 0:
players -= 1
yield n
if n == limits[step]:
... |
#!/usr/bin/env python
"""This implements the auditing system.
How does it work?
Noteworthy events within the GRR system (such as approval granting, flow
execution etc) generate events to notify listeners about the event.
The audit system consists of a group of event listeners which receive these
events and act upon ... |
#!/usr/bin/env python
# encoding: utf-8
# Jérôme Carretero, 2011 (zougloub)
from waflib import Options
from waflib.Tools import ccroot
from waflib.Configure import conf
@conf
def find_dcc(conf):
conf.find_program(['dcc'], var='CC', path_list=getattr(Options.options, 'diabbindir', ""))
conf.env.CC_NAME = 'dcc'
@con... |
import sys
if __name__ == '__main__':
import os
pkg_dir = os.path.split(os.path.abspath(__file__))[0]
parent_dir, pkg_name = os.path.split(pkg_dir)
is_pygame_pkg = (pkg_name == 'tests' and
os.path.split(parent_dir)[1] == 'pygame')
if not is_pygame_pkg:
sys.path.insert(0,... |
"""Tests for resnet_v1_beta module."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import functools
import numpy as np
import tensorflow as tf
from deeplab.core import resnet_v1_beta
from tensorflow.contrib.slim.nets import resnet_utils
slim = tf.con... |
from mock import MagicMock
import pytest
import f5_cccl.resource.ltm.monitor.tcp_monitor as target
@pytest.fixture
def tcp_config():
return {"name": "test_monitor",
"partition": "Test",
"interval": 1,
"timeout": 10,
"send": "GET /\r\n",
"recv": "SERVER"... |
from datetime import timedelta
import pytz
from openerp import models, fields, api, _
from openerp.exceptions import Warning
class event_type(models.Model):
""" Event Type """
_name = 'event.type'
_description = 'Event Type'
name = fields.Char(string='Event Type', required=True)
default_reply_to... |
"""
FILE: s.py
AUTHOR: Cody Precord
@summary: Lexer configuration module for the S and R statistical languages
"""
__author__ = "Cody Precord <<EMAIL>>"
__svnid__ = "$Id: _s.py 70466 2012-01-26 20:55:16Z CJP $"
__revision__ = "$Revision: 70466 $"
#---------------------------------------------------------------------... |
import sys, os
sys.path.insert(0, os.path.abspath('../'))
from synnefo.versions.webproject import __version__
project = u'snf-webproject'
copyright = u'2012-2013, GRNET'
version = __version__
release = __version__
html_title = 'synnefo ' + version
templates_path = ['_templates']
source_suffix = '.rst'
master_doc = '... |
import re
from xml.sax.saxutils import escape, unescape
import html5lib
from html5lib import treebuilders, treewalkers, serializer
from html5lib.tokenizer import HTMLTokenizer
from html5lib.constants import tokenTypes
class HTMLSanitizerMixin(object):
""" sanitization of XHTML+MathML+SVG and of inline style attr... |
"""
==========================
FastICA on 2D point clouds
==========================
This example illustrates visually in the feature space a comparison by
results using two different component analysis techniques.
:ref:`ICA` vs :ref:`PCA`.
Representing ICA in the feature space gives the view of 'geometric ICA':
ICA... |
from sqlalchemy import exc
from sqlalchemy import ForeignKey
from sqlalchemy import func
from sqlalchemy import Integer
from sqlalchemy import select
from sqlalchemy import String
from sqlalchemy import testing
from sqlalchemy import tuple_
from sqlalchemy.orm import aliased
from sqlalchemy.orm import Bundle
from sqlal... |
"""The tests for the time automation."""
from datetime import timedelta
import unittest
from unittest.mock import patch
from homeassistant.core import callback
from homeassistant.setup import setup_component
import homeassistant.util.dt as dt_util
import homeassistant.components.automation as automation
from tests.co... |
""" This module allows you to translate and execute Javascript in pure python.
Basically its implementation of ECMAScript 5.1 in pure python.
Use eval_js method to execute javascript code and get resulting python object (builtin if possible).
EXAMPLE:
>>> import js2py
>>> add = js2py.eval_js('func... |
"""
Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
Copyright (C) ITsysCOM GmbH
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 y... |
"""
This code was taken from https://github.com/ActiveState/appdirs and modified
to suite our purposes.
"""
from __future__ import absolute_import
import os
import sys
from pip.compat import WINDOWS
def user_cache_dir(appname):
r"""
Return full path to the user-specific cache dir for this application.
... |
"""
Built-in, globally-available admin actions.
"""
from django.core.exceptions import PermissionDenied
from django.contrib.admin import helpers
from django.contrib.admin.util import get_deleted_objects, model_ngettext
from django.db import router
from django.template.response import TemplateResponse
from django.utils... |
"""
SQLAlchemy-Qubit test suite.
"""
import unittest
import tempfile
# turn of warnings we don't care about
import warnings
from sqlalchemy import func, exc as sa_exc
from sqlaqubit import models, keys, load_test_sql, create_engine, init_models
class InformationObjectTest(unittest.TestCase):
def setUp(self):
... |
from __future__ import division
import hashlib
import random
import p2pool
from p2pool.util import math, pack
def hash256(data):
return pack.IntType(256).unpack(hashlib.sha256(hashlib.sha256(data).digest()).digest())
def hash160(data):
if data == '04ffd03de44a6e11b9917f3a29f9443283d9871c9d743ef30d5eddcd3709... |
"""
Dialog for building Tkinter accelerator key bindings
"""
from Tkinter import *
import tkMessageBox
import string
class GetKeysDialog(Toplevel):
def __init__(self,parent,title,action,currentKeySequences):
"""
action - string, the name of the virtual event these keys will be
mapp... |
from openerp.osv import fields, osv
class account_journal(osv.osv):
_inherit = 'account.journal'
_columns = {
'journal_user': fields.boolean('PoS Payment Method', help="Check this box if this journal define a payment method that can be used in point of sales."),
'amount_authorized_diff' : fiel... |
#!/usr/bin/env python3
# ==============================================================================
# In the 20×20 grid below, four numbers along a diagonal line have been marked
# in red.
#
# ... in p011.txt ...
#
# The product of these numbers is 26 × 63 × 78 × 14 = 1788696.
#
# What is the greatest product of f... |
#!/usr/bin/env python
"""
Usage: python show_negative_chains.py <path_to_a_saved_DBM.pkl>
Show negative chains of a saved DBM model.
"""
from __future__ import print_function
__authors__ = "Ian Goodfellow"
__copyright__ = "Copyright 2012, Universite de Montreal"
__credits__ = ["Ian Goodfellow"]
__license__ = "3-claus... |
from flask import Blueprint, render_template, request, url_for, redirect, g
from sqlalchemy.orm import subqueryload, contains_eager
from sqlalchemy.sql.expression import or_
from skylines.lib.util import str_to_bool
from skylines.database import db
from skylines.model.event import Event, Notification, Flight, group_ev... |
"""
reTrip will take text files of TripAdvisor data and turn them into Geocoded locations to transpose onto the map.
This uses a rather hacky text-based method because of time constraints. A full-featured web crawler that could be used for many pages or other sites at once would be much better. But since we only collec... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.