content string |
|---|
"""
=================
Structured Arrays
=================
Introduction
============
NumPy provides powerful capabilities to create arrays of structured datatype.
These arrays permit one to manipulate the data by named fields. A simple
example will show what is meant.: ::
>>> x = np.array([(1,2.,'Hello'), (2,3.,"Wo... |
#!/bin/env python
""" Pausing example: person is paused at every node
- random movement
- at every node the person stops for 20 ticks
- uses pause_movement and Simulation.person_alarm_clock for waking up
(could alternativly be implemented using a special Location at every node)
- output t... |
import os
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = ()
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'example.sqlite',
}
}
ALLOWED_HOSTS = []
TIME_ZONE = 'America/Chicago'
LANGUAGE_CODE = 'en-us'
SITE_ID = 1
USE_I18N = True
USE_L10N = Tr... |
''' Defines a set of delegates to display widgets in a table/tree cell
.. Created on Dec 11, 2010
.. codeauthor:: Robert Langlois <<EMAIL>>
'''
#from ..dialogs.WorkflowDialog import Dialog as WorkflowDialog
from ..util.qt4_loader import QtGui,QtCore, qtSignal
import os, logging
_logger = logging.getLogger(__name__)
_... |
"""Hooks for use with GTFlow Estimator."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
from tensorflow.contrib.learn.python.learn import session_run_hook
from tensorflow.contrib.learn.python.learn.session_run_hook import SessionRunArgs
from t... |
import pos_users_product
import account_statement
import pos_receipt
import pos_invoice
import pos_lines
import pos_details
import pos_payment_report
import pos_report
import pos_order_report
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
"""
Portable file locking utilities.
Based partially on example by Jonathan Feignberg <<EMAIL>> in the Python
Cookbook, licensed under the Python Software License.
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65203
Example Usage::
>>> from django.core.files import locks
>>> with open('./file'... |
#!/usr/bin/env python
"""
Remove non-codeswitched tweets.
Constantine Lignos
February 2013
"""
# Copyright (c) 2013 Constantine Lignos
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Red... |
# -*- coding: utf-8 -*-
# __
# /__) _ _ _ _ _/ _
# / ( (- (/ (/ (- _) / _)
# /
"""
Requests HTTP library
~~~~~~~~~~~~~~~~~~~~~
Requests is an HTTP library, written in Python, for human beings. Basic GET
usage:
>>> import requests
>>> r = requests.get('https://www.python.org')
>>> ... |
"""
Verifies building a target from a .gyp file a few subdirectories
deep when the --generator-output= option is used to put the build
configuration files in a separate directory tree.
"""
import TestGyp
# Android doesn't support --generator-output.
test = TestGyp.TestGyp(formats=['!android'])
test.writable(test.wor... |
import time
from datetime import datetime
from openerp.osv import fields, osv
from openerp import tools
from openerp.tools.translate import _
import openerp.addons.decimal_precision as dp
class account_analytic_account(osv.osv):
_name = 'account.analytic.account'
_inherit = ['mail.thread']
_description = ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
import os
from shutil import rmtree
from tempfile import mkdtemp
from nipype.testing import (assert_equal, assert_raises,
assert_a... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
import sys
import time
from pathlib import Path
from flask import current_app
from flask_login import current_user
from flask_restful import reqparse
from emcweb.emcweb_webapi.login_resource import LoginResource
from werkzeug.utils import secur... |
import cgi, gc, pprint, re, weakref
from PyQt4.QtCore import *
from PyQt4.QtGui import *
import dbgutil
def invisibleWindows():
"""List of invisible top-level widgets excluding menus"""
return [w for w in QApplication.topLevelWidgets()
if w.isHidden() and not isinstance(w, QMenu)]
def orphanedWi... |
# -*- coding: utf-8 -*-
"""
Models used to implement SAML SSO support in third_party_auth
(inlcuding Shibboleth support)
"""
from config_models.models import ConfigurationModel, cache
from django.conf import settings
from django.core.exceptions import ValidationError
from django.db import models
from django.utils impor... |
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from registration.models import RegistrationProfile
from django.core import mail
from django.http import HttpRequest
from django.test import override_settings
from treemap.models impo... |
"""Network Data Representation (NDR) marshalling and unmarshalling."""
def ndr_pack(object):
"""Pack a NDR object.
:param object: Object to pack
:return: String object with marshalled object.
"""
ndr_pack = getattr(object, "__ndr_pack__", None)
if ndr_pack is None:
raise TypeError("%r... |
"""Protobuf related tests."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import ops
from tensorflow.python.platform import test
class ProtoTest(t... |
import time
import bson
import bson.objectid
import bson.errors
import tornado.escape
from tornado.websocket import WebSocketHandler
from tornado.web import RequestHandler
from tornado.ioloop import IOLoop
from tornado import gen
class TailHandler(WebSocketHandler):
listeners = {}
def open(self, counter_id)... |
'''
Informations Retrieval Library
==============================
Matrix is an index for documents, terms, and their classes.
'''
import sys, math, random
from superlist import SuperList
from progress import Progress
class MatrixDocs(list):
def doc_fields(self):
return set(['id', 'class', 'terms'])
... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.compat.tests.mock import patch
from ansible.modules.network.ios import ios_ping
from .ios_module import TestIosModule, load_fixture, set_module_args
class TestIosPingModule(TestIosModule):
''' Class used for Unit... |
#!/usr/bin/env python
import sys
import logging
import logging.handlers
#The terminal has 8 colors with codes from 0 to 7
BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE = range(8)
#These are the sequences need to get colored ouput
RESET_SEQ = "\033[0m"
COLOR_SEQ = "\033[1;%dm"
BOLD_SEQ = "\033[1m"
#The backg... |
import time
import os
try:
import pycurl
HAS_PYCURL = True
except ImportError:
HAS_PYCURL = False
try:
from linode import api as linode_api
HAS_LINODE = True
except ImportError:
HAS_LINODE = False
def randompass():
'''
Generate a long random password that comply to Linode requiremen... |
from Exporter import Exporter
from ClassExporter import ClassExporter
from FunctionExporter import FunctionExporter
from EnumExporter import EnumExporter
from VarExporter import VarExporter
from infos import *
from declarations import *
import os.path
import exporters
import MultipleCodeUnit
#=========================... |
import subprocess
import os
import optparse
import sys
parser = optparse.OptionParser(usage='Usage: %prog [options]')
parser.add_option('', '--dir',
help='Determines what directory the application resides in and '
'should be started from.')
(options, args) = parser.parse_ar... |
from Screen import Screen
from MessageBox import MessageBox
from Components.AVSwitch import AVSwitch
from Tools import Notifications
class Scart(Screen):
def __init__(self, session, start_visible=True):
Screen.__init__(self, session)
self.msgBox = None
self.notificationVisible = None
self.avswitch = AVSwitch... |
"""
Extracts the version of the PostgreSQL server.
"""
import re
# This reg-exp is intentionally fairly flexible here.
# Needs to be able to handle stuff like:
# PostgreSQL 8.3.6
# EnterpriseDB 8.3
# PostgreSQL 8.3 beta4
# PostgreSQL 8.4beta1
VERSION_RE = re.compile(r'\S+ (\d+)\.(\d+)\.?(\d+)?')
def _parse_... |
from __future__ import unicode_literals
import unittest
from datetime import datetime, timedelta
import django
from django.contrib.auth import get_user_model
from django.core import management
from django.test import TestCase
from simple_history import exceptions, register
from six.moves import cStringIO as StringIO
... |
import sys
def main():
print "# this test is generated by change_text.py"
print "# generate hot text expansion test cases"
print "--disable_warnings"
print "DROP TABLE IF EXISTS t;"
print "--enable_warnings"
print "SET SESSION DEFAULT_STORAGE_ENGINE=\"TokuDB\";"
print "SET SESSION TOKUDB_DIS... |
"""The `gcloud meta debug` command."""
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.meta import debug
class Debug(base.Command):
"""Run an interactive debug console with the Cloud SDK libraries loaded.
This command runs an interactive console with the Cloud SDK libraries loaded.
I... |
# -*- coding: utf-8 -*-
"""
pygments.styles.friendly
~~~~~~~~~~~~~~~~~~~~~~~~
A modern style based on the VIM pyte theme.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from pygments.style import Style
from pygments.token import Keyw... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
import os
import pipes
import tempfile
from ansible import constants as C
from ansible.plugins.action import ActionBase
from ansible.utils.boolean import boolean
from ansible.utils.hashing import checksum
from ansible.... |
#!/usr/bin/env python
"""
This script bootstraps Phobos from a supplied path and feeds it
information regarding EVE data paths and where to dump data. It then imports
some other scripts and uses them to convert the json data into a SQLite
database and then compare the new database to the existing one, producing a
diff ... |
#
# number.py : Number-theoretic functions
#
# Part of the Python Cryptography Toolkit
#
# Distribute and use freely; there are no restrictions on further
# dissemination and usage except those imposed by the laws of your
# country of residence. This software is provided "as is" without
# warranty of fitness for us... |
from binascii import b2a_hex
import httpserver
import json
import logging
import networkserver
import socket
from time import time
import traceback
WithinLongpoll = httpserver.AsyncRequest
class _SentJSONError(BaseException):
def __init__(self, rv):
self.rv = rv
class JSONRPCHandler(httpserver.HTTPHandler):
defa... |
"""
=================================================
SVM: Separating hyperplane for unbalanced classes
=================================================
Find the optimal separating hyperplane using an SVC for classes that
are unbalanced.
We first find the separating plane with a plain SVC and then plot
(dashed) the ... |
# -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
import json
import csv
import codecs
from collections import OrderedDict
#from pm.comm.log import *
from pm.items import PmIte... |
""" shwo user who share similar interest """
from PyQt5.QtWidgets import QWidget, QTableWidgetItem
from PyQt5 import QtCore, QtGui, QtWidgets
class Interest(QWidget):
def __init__(self, parent=None):
super(Interest, self).__init__(parent)
self.setupUi(self)
def setupUi(self, Form):
F... |
try:
import pyclamd
HAVE_CLAMD = True
except ImportError:
HAVE_CLAMD = False
from viper.common.abstracts import Module
from viper.core.session import __sessions__
class ClamAV(Module):
cmd = 'clamav'
description = 'Scan file from local ClamAV daemon'
authors = ['neriberto']
def __init__(... |
"""Presubmit script for Chromium browser resources.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more details about the presubmit API built into gcl/git cl, and see
http://www.chromium.org/developers/web-development-style-guide for the rules
we're checking against here.
"""
import ... |
""" NOTE
Needs yade compiled with CGAL feature
"""
O.engines=[
ForceResetter(),
InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Box_Aabb(),Bo1_Facet_Aabb()]),
InteractionLoop([Ig2_Facet_Sphere_ScGeom()],[Ip2_FrictMat_FrictMat_FrictPhys()],[Law2_ScGeom_FrictPhys_CundallStrack()],),
NewtonIntegrator(damping=0.01,gravit... |
"""This file implements all-or-nothing package transformations.
An all-or-nothing package transformation is one in which some text is
transformed into message blocks, such that all blocks must be obtained before
the reverse transformation can be applied. Thus, if any blocks are corrupted
or lost, the original message... |
from modules.OsmoseTranslation import T_
from .Analyser_Osmosis import Analyser_Osmosis
sql10 = """
SELECT
t.id,
nodes.id AS nid,
ST_AsText(nodes.geom),
CASE
WHEN admin_level IN ('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14')
THEN 100 + admin_level:... |
"""This module contains operator to move data from Hive to Samba."""
from tempfile import NamedTemporaryFile
from airflow.models import BaseOperator
from airflow.providers.apache.hive.hooks.hive import HiveServer2Hook
from airflow.providers.samba.hooks.samba import SambaHook
from airflow.utils.decorators import apply... |
#!/usr/bin/env python
# encoding: utf-8
"""
This script enables the automatic merging of two or more Chemkin files (and
associated species dictionaries) into a single unified Chemkin file. Simply
pass the paths of the Chemkin files and species dictionaries on the
command-line, e.g.
$ python mergeModels.py /path/... |
import shutil
import logging
from lib.common.abstracts import Package
log = logging.getLogger(__name__)
class HTML(Package):
"""HTML file analysis package."""
PATHS = [
("ProgramFiles", "Internet Explorer", "iexplore.exe"),
]
def start(self, path):
iexplore = self.get_path("browser")... |
source("../../shared/qtcreator.py")
def handleInsertVirtualFunctions(expected):
treeView = waitForObject("{container={title='Functions to insert:' type='QGroupBox' unnamed='1'"
" visible='1'} type='QTreeView' unnamed='1' visible='1'}")
model = treeView.model()
classIndices = d... |
"""
Views for managing instance snapshots.
"""
import logging
from django.core.urlresolvers import reverse, reverse_lazy
from django.utils.translation import ugettext_lazy as _
from horizon import exceptions
from horizon import forms
from openstack_dashboard import api
from .forms import CreateSnapshot
LOG = logg... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import json
import pytest
import sys
from nose.plugins.skip import SkipTest
if sys.version_info < (2, 7):
raise SkipTest("F5 Ansible modules require Python >= 2.7")
from units.compat import unittest
from units.compa... |
from hashlib import md5
from io import BytesIO
from bson.objectid import ObjectId
from gridfs import GridFS
from werkzeug.exceptions import NotFound
import pytest
from flask_pymongo.tests.util import FlaskPyMongoTest
class GridFSCleanupMixin(object):
def tearDown(self):
gridfs = GridFS(self.mongo.db)
... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('analytics', '0001_initial'),
('catalogue', '0001_initial'),
migrations.swappable_dependency(... |
#TODO: KI
"""
Uno: A clone of the cardgame UNO (C)
Copyright (C) 2011 Alexander Thaller <<EMAIL>>
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... |
# modRana current-platform detection
import os
import sys
from core import qrc
DEFAULT_DEVICE_MODULE_ID = "pc"
DEFAULT_GUI_MODULE_ID = "GTK"
import logging
log = logging.getLogger("core.platform_detection")
def getBestDeviceModuleId():
log.info("** detecting current device **")
result = _check()
if re... |
"""An Address Space for processing ELF64 coredumps."""
# References:
# VirtualBox core format:
# http://www.virtualbox.org/manual/ch12.html#guestcoreformat
# ELF64 format: http://downloads.openwatcom.org/ftp/devel/docs/elf-64-gen.pdf
# Note that as of version 1.6.0 WinPmem also uses ELF64 as the default imaging
# form... |
# -*- coding: utf-8 -*-
"""
werkzeug.contrib.atom
~~~~~~~~~~~~~~~~~~~~~
This module provides a class called :class:`AtomFeed` which can be
used to generate feeds in the Atom syndication format (see :rfc:`4287`).
Example::
def atom_feed(request):
feed = AtomFeed("My Blog", feed... |
import json
import time
import urllib
from tempest.common.rest_client import RestClient
from tempest import exceptions
class ImagesClientJSON(RestClient):
def __init__(self, config, username, password, auth_url, tenant_name=None):
super(ImagesClientJSON, self).__init__(config, username, password,
... |
"""Let's Encrypt constants."""
import os
import logging
from acme import challenges
SETUPTOOLS_PLUGINS_ENTRY_POINT = "letsencrypt.plugins"
"""Setuptools entry point group name for plugins."""
CLI_DEFAULTS = dict(
config_files=[
"/etc/letsencrypt/cli.ini",
# http://freedesktop.org/wiki/Software/x... |
from __future__ import unicode_literals
from .common import InfoExtractor
from ..compat import compat_urllib_parse
from ..utils import (
encode_dict,
get_element_by_attribute,
int_or_none,
)
class MiTeleIE(InfoExtractor):
IE_DESC = 'mitele.es'
_VALID_URL = r'http://www\.mitele\.es/[^/]+/[^/]+/[^/... |
'''
New Perf Test for creating SG and other SG rules related operations.
The created number will depends on the environment variable: ZSTACK_TEST_NUM
The default max threads are 1000. It could be modified by env variable:
ZSTACK_THREAD_THRESHOLD
This case might need to run in KVM simulator environemnt, if t... |
# -*- coding: utf-8 -*-
try:
import _jsre as re
except:
import re
import random
import time
letters = 'abcdefghijklmnopqrstuvwxyz'
letters += letters.upper()+'0123456789'
class URL:
def __init__(self,src):
elts = src.split(maxsplit=1)
self.href = elts[0]
self.alt = ''
if ... |
# encoding: utf-8
from datetime import datetime
from unittest import TestCase
from django import forms
from django.conf import settings
from django.contrib import admin
from django.contrib.admin import widgets
from django.contrib.admin.widgets import FilteredSelectMultiple, AdminSplitDateTime
from django.contrib.admi... |
import datetime
from django.core.exceptions import ObjectDoesNotExist
from django.db import models
from django.db.models import Sum
from django.contrib.contenttypes.models import ContentType
class TrendingManager(models.Manager):
def trending(self, model, days=30, kind=""):
views = self.filter(
... |
'''This module contains the framework for exporting data from zim.
The main API for exporting from the application is the L{Exporter}
object. There are subclasses of Exporter to export to multiple files,
to a single file or to a MHTML file.
To configure the exporter object an additional L{ExportLayout} object
is used... |
import os
import sys
import vtkAll as vtk
import math
import time
import types
import functools
import numpy as np
from director import transformUtils
from director import lcmUtils
from director.timercallback import TimerCallback
from director.asynctaskqueue import AsyncTaskQueue
from director import objectmodel as om... |
"""
===============================
Wikipedia principal eigenvector
===============================
A classical way to assert the relative importance of vertices in a
graph is to compute the principal eigenvector of the adjacency matrix
so as to assign to each vertex the values of the components of the first
eigenvect... |
# -*- coding: utf-8 -*-
"""
Student dashboard page.
"""
from bok_choy.page_object import PageObject
from bok_choy.promise import EmptyPromise
from . import BASE_URL
class DashboardPage(PageObject):
"""
Student dashboard, where the student can view
courses she/he has registered for.
"""
url = BAS... |
import sys
import unittest
import vdf
from io import BytesIO
from collections import OrderedDict
u = str if sys.version_info >= (3,) else unicode
class BinaryVDF(unittest.TestCase):
def test_BASE_INT(self):
repr(vdf.BASE_INT())
def test_simple(self):
pairs = [
('a', 'test'),
... |
"""Unit test for Google Test's --gtest_list_tests flag.
A user can ask Google Test to list all tests by specifying the
--gtest_list_tests flag. This script tests such functionality
by invoking gtest_list_tests_unittest_ (a program written with
Google Test) the command line flags.
"""
__author__ = '<EMAIL> (Patrick H... |
"""W3C Document Object Model implementation for Python.
The Python mapping of the Document Object Model is documented in the
Python Library Reference in the section on the xml.dom package.
This package contains the following modules:
minidom -- A simple implementation of the Level 1 DOM with namespace
sup... |
import pickle
from unittest import TestCase
from django.core.exceptions import ValidationError
class PickableValidationErrorTestCase(TestCase):
def test_validationerror_is_picklable(self):
original = ValidationError('a', code='something')
unpickled = pickle.loads(pickle.dumps(original))
... |
"""
Provides a python interface to the Mac OSX IOBluetooth Framework classes,
through PyObjC.
For example:
>>> from lightblue import _IOBluetooth
>>> for d in _IOBluetooth.IOBluetoothDevice.recentDevices_(0):
... print d.getName()
...
Munkey
Adam
My Nokia 6600
>>>
See http:/... |
data = (
'Zhui ', # 0x00
'Ping ', # 0x01
'Bian ', # 0x02
'Zhou ', # 0x03
'Zhen ', # 0x04
'Senchigura ', # 0x05
'Ci ', # 0x06
'Ying ', # 0x07
'Qi ', # 0x08
'Xian ', # 0x09
'Lou ', # 0x0a
'Di ', # 0x0b
'Ou ', # 0x0c
'Meng ', # 0x0d
'Zhuan ', # 0x0e
'Peng ', # 0x0f
'Lin ', ... |
# 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... |
"""
Implements a simple polling interface for file descriptors that don't work with
select() - this is pretty much only useful on Windows.
"""
from zope.interface import implements
from twisted.internet.interfaces import IConsumer, IPushProducer
MIN_TIMEOUT = 0.000000001
MAX_TIMEOUT = 0.1
class _PollableResource... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
################################################################################
# Documentation
################################################################################
ANSIBLE_METADATA = {'metadata_version': '1.1', 'statu... |
from browser import document, html, window
from javascript import console, JSConstructor
from .rect import Rect
#import pygame.rect
canvas_ID=1
_canvas_id=None
class Surface:
def __init__(self, dim=[], depth=16, surf=None):
if surf is None:
self._depth=depth
self._canvas=html.CANVAS(width=... |
from pyscf.pbc.gto import Cell
from pyscf.pbc.scf import RHF
from pyscf.pbc.tdscf import TDHF
from pyscf.pbc.tdscf.rhf_slow import PhysERI, PhysERI4, PhysERI8, TDRHF
from pyscf.tdscf.common_slow import eig
from test_common import retrieve_m, retrieve_m_hf, assert_vectors_close
import unittest
from numpy import testin... |
from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin
class Kimchi(Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin):
"""kimchi-related information
"""
plugin_name = 'kimchi'
packages = ('kimchi',)
def setup(self):
log_limit = self.get_option('log_size')
self.a... |
import unittest, os, sys, re, threading, time
myDirectory = os.path.realpath(sys.argv[0])
rootDirectory = re.sub("/testing/.*", "", myDirectory)
sys.path.append(rootDirectory)
from testing.lib import BaseTestSuite
excludes = ['test_MINITEST3']
# All test-case classes should have the naming convention test_.*
cla... |
from charmhelpers.core import unitdata
class FlagManager:
'''
FlagManager - A Python class for managing the flags to pass to an
application without remembering what's been set previously.
This is a blind class assuming the operator knows what they are doing.
Each instance of this class should be ... |
"""
Tests to visually inspect the results of the library's functionality.
Run checks via
python check_visually.py
"""
from __future__ import print_function, division
import argparse
import numpy as np
from skimage import data
import imgaug as ia
from imgaug import augmenters as iaa
def main():
parser = arg... |
"""HTML reporting for Coverage."""
import os, re, shutil, sys
import coverage
from coverage.backward import pickle
from coverage.misc import CoverageException, Hasher
from coverage.phystokens import source_token_lines, source_encoding
from coverage.report import Reporter
from coverage.results import Numbers
from cove... |
import sys
from telemetry.core.platform import linux_platform_backend
from telemetry.core.platform import mac_platform_backend
from telemetry.core.platform import win_platform_backend
class Platform(object):
"""The platform that the target browser is running on.
Provides a limited interface to interact with the ... |
# import statements
import numpy as np
import matplotlib.pyplot as plt #for figures
from mpl_toolkits.basemap import Basemap #to render maps
import math
import json #to write dict with parameters
from GrowYourIC import positions, geodyn, geodyn_trg, geodyn_static, plot_data, data
plt.rcParams['figure.figsize'] = (8.0... |
"""
Movielens 1-M dataset.
Movielens 1-M dataset contains 1 million ratings from 6000 users on 4000
movies, which was collected by GroupLens Research. This module will download
Movielens 1-M dataset from
http://files.grouplens.org/datasets/movielens/ml-1m.zip and parse training
set and test set into paddle reader crea... |
# -*- coding: utf-8 -*-
import types
import sys
import six
from django.db import models, connections
from psycopg2.extensions import lobject as lobject_class
class LargeObjectFile(object):
"""
Proxy class over psycopg2 large object file instance.
"""
def __init__(self, oid=0, field=None, instance=No... |
from os import system
import pyttsx
#Setting up the speaker
def onStart(name):
print ""
def onWord(name, location, length):
print ""
def onEnd(name, completed):
print ""
engine = pyttsx.init()
rate = engine.getProperty('rate')
engine.setProperty('rate', rate-50)
engine.connect('started-utterance', onStart)
e... |
import formatter
import unittest
from test import test_support
htmllib = test_support.import_module('htmllib', deprecated=True)
class AnchorCollector(htmllib.HTMLParser):
def __init__(self, *args, **kw):
self.__anchors = []
htmllib.HTMLParser.__init__(self, *args, **kw)
def get_anchor_info(s... |
import time
# reading the last Version information
[FCVersionMajor,FCVersionMinor,FCVersionBuild,FCVersionDisDa,dummy] = open("../Version.h",'r').readlines()
# increasing build number
BuildNumber = int(FCVersionBuild[23:-1]) +1
# writing new Version.h File
open("../Version.h",'w').writelines([FCVersionMajor... |
import copy
class Element:
''' This class implements the node element that is used to create the data store tree structure.'''
def generateKey(vals):
''' This methods generates a node key based on the node id and name'''
if isinstance(vals,list):
return ':'.join(vals)
r... |
# coding=utf-8
__author__ = 'tony'
from unittest import TestCase
from yaya.config import Config
from yaya.recognition import person_recognition
from yaya.recognition import place_recognition
from yaya.recognition import organization_recognition
from yaya.seg.viterbi import viterbi
from yaya.seg.wordnet import WordNet,... |
"""Seeds a number of variables defined in chromium_config.py.
The recommended way is to fork this file and use a custom DEPS forked from
config/XXX/DEPS with the right configuration data."""
import os
import re
import socket
SERVICE_ACCOUNTS_PATH = '/creds/service_accounts'
class classproperty(object):
"""A dec... |
from java.awt import Color
aliceblue = Color(240, 248, 255)
antiquewhite = Color(250, 235, 215)
aqua = Color(0, 255, 255)
aquamarine = Color(127, 255, 212)
azure = Color(240, 255, 255)
beige = Color(245, 245, 220)
bisque = Color(255, 228, 196)
black = Color(0, 0, 0)
blanchedalmond = Color(255, 235, 205)
blue = Color(0... |
from collections import OrderedDict as OD
data = (
OD((
("enabled", "on"),
)),
OD((
("GlobalShortcuts", (
OD((
("new_search", "Ctrl+f"),
("start_search", ""),
("find_item", ""),
("edit_item", ""),
)),
... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
import re
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.n... |
from django import template
register = template.Library()
@register.inclusion_tag('admin/prepopulated_fields_js.html', takes_context=True)
def prepopulated_fields_js(context):
"""
Creates a list of prepopulated_fields that should render Javascript for
the prepopulated fields for both the admin form and i... |
# pylint: disable=missing-docstring
# pylint: disable=redefined-outer-name
# pylint: disable=unused-argument
from lettuce import world, step
from component_settings_editor_helpers import enter_xml_in_advanced_problem
from nose.tools import assert_true, assert_equal
from contentstore.utils import reverse_usage_url
@s... |
import os
import time
import calculate
from github import Github
from django.conf import settings
from calaccess_raw import get_model_list
from calaccess_raw.management.commands import CalAccessCommand
from django.contrib.humanize.templatetags.humanize import intcomma
class Command(CalAccessCommand):
help = 'Crea... |
from __future__ import print_function, unicode_literals
from io import BytesIO
from django.core.files.uploadedfile import InMemoryUploadedFile
from django.core.urlresolvers import reverse
from ...base import ArticleWebTestBase
class AttachmentTests(ArticleWebTestBase):
def setUp(self):
super(Attachmen... |
#!/usr/bin/python
#
# Utilitaire pour pre-traiter les resultats
#
import os
# variables
out_dir = "results"
base = "time_dragonizer"
suffix = ".data"
def get_or_create(data, key):
if (data.has_key(key) == False):
data[key] = {}
return data[key]
def get_or_create_path(data, path_elem):
if (len(path_elem) == 0):... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.