content string |
|---|
#!/usr/bin/python
"""
process_file(filename)
takes templated file .xxx.src and produces .xxx file where .xxx
is .pyf .f90 or .f using the following template rules:
'<..>' denotes a template.
All function and subroutine blocks in a source file with names that
contain '<..>' will be replicated according to ... |
#!/usr/bin/env python
import os
from icalendar import Calendar
def get_ics(filename):
return filename.endswith('ics')
def check_if_correct_parse(ics_file):
fh = open(ics_file, 'rb')
try:
# some calendars, such as Austrian ones have multiple
# vCalendar entries - we probably don't want ... |
import functools
import os
import llnl.util.filesystem
import spack.cmd.common.arguments
import spack.cmd.modules
def add_command(parser, command_dict):
lmod_parser = parser.add_parser(
'lmod', help='manipulate hierarchical module files'
)
sp = spack.cmd.modules.setup_parser(lmod_parser)
# S... |
import optparse
import gettext
__trans = gettext.translation('pisilinux', fallback=True)
_ = __trans.ugettext
import pisilinux.cli.command as command
import pisilinux.context as ctx
import pisilinux.api
import pisilinux.db
class ListNewest(command.Command, metaclass=command.autocommand):
__doc__ = _("""List newe... |
import logging
import bpy
__logger = None
__mapping = {'debug': logging.DEBUG,
'warning': logging.WARNING,
'error': logging.ERROR,
'critical': logging.CRITICAL}
def get_logger():
global __logger
if not __logger:
__logger = logging.getLogger(__name__)
... |
#!/usr/bin/env python
import sys, os, shutil
lang_map = {
"af-ZA": "Afrikaans",
"cs-CZ": "Czech",
"da": "Danish",
"de": "German",
"en": "English (US)",
"es": "Spanish",
"es-419" : "Spanish (Argentina)",
"fi": "Finnish",
"fr": "French",
"grk": "Greek",
"he": "Hebrew",
"hr-HR": "Croatian",
"is-IS": "Icelan... |
#the_poetry_generator 2017
import random #needed for random selection of words
import tkinter as tk
from tkinter import ttk
from tkinter import filedialog
import os
def main():
#"""Opens up one of the two random files."""
poem = open("Poem_Generator.txt","w") #Opens up new file "Poem_Generator.txt"
... |
import zstackwoodpecker.test_state as ts_header
import os
TestAction = ts_header.TestAction
def path():
return dict(initial_formation="template5", checking_point=1, faild_point=100000, path_list=[
[TestAction.create_mini_vm, 'vm1', 'cluster=cluster2'],
[TestAction.destroy_vm, 'vm1'],
[TestAction.recover_vm, ... |
import array
import numbers
from collections.abc import Mapping, Sequence
from fastavro.const import INT_MAX_VALUE, INT_MIN_VALUE, LONG_MAX_VALUE, LONG_MIN_VALUE
from ._validate_common import ValidationError, ValidationErrorData
from .schema import extract_record_type, extract_logical_type, schema_name, parse_schema
f... |
from kataja.SavedField import SavedField
from kataja.SavedObject import SavedObject
from kataja.saved.DerivationStep import DerivationStep
from kataja.singletons import log, ctrl
from kataja.syntactic_state_to_nodes import syntactic_state_to_nodes
from kataja.syntax.SyntaxState import SyntaxState
from collections impo... |
microcode = '''
def macroop FABS {
absfp st(0), st(0), SetStatus=True
};
def macroop FCHS {
chsfp st(0), st(0), SetStatus=True
};
''' |
from openerp.osv import fields, osv
class account_analytic_journal(osv.osv):
_name = 'account.analytic.journal'
_description = 'Analytic Journal'
_columns = {
'name': fields.char('Journal Name', size=64, required=True),
'code': fields.char('Journal Code', size=8),
'active': fields.b... |
from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'N j, Y'
TIME_FORMAT = 'P'
DATETIME_FORMAT = 'N j, Y, P'
YEAR_MONTH_FORMAT = 'F Y'
MONTH_DAY_FORMAT = 'F j'
SHORT_DATE_FORMAT = 'm/d/Y'... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import base64
import urllib
from wechatpy.utils import to_text, to_binary
from wechatpy.client.api.base import BaseWeChatAPI
class WeChatDevice(BaseWeChatAPI):
API_BASE_URL = 'https://api.weixin.qq.com/device/'
def send_messag... |
import content_index
import std_index
import document
import report
import wizard
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
try:
import moogli
except Exception as e:
print( "[INFO ] Could not import moogli. Quitting..." )
quit()
import moose
from PyQt4 import Qt, QtCore, QtGui
import sys
import os
import rdesigneur as rd
PI = 3.14159265358979
frameRunTime = 0.0001
runtime = 0.1
inject = 15e-10
simdt = 5e-5
RM = 1.0
RA = 1.0
CM... |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'FeedIcon'
db.create_table('rss_feeds_feedicon', (
('feed', self.gf('utils.fiel... |
"""
Verifies simple actions when using the default build target.
"""
import TestGyp
test = TestGyp.TestGyp(workdir='workarea_default')
test.run_gyp('actions.gyp', chdir='src')
test.relocate('src', 'relocate/src')
# Some gyp files use an action that mentions an output but never
# writes it as a means to making the ... |
"""refactor alerts
Revision ID: 666668eae682
Revises: 8526f853643a
Create Date: 2016-05-05 16:46:05.656646
"""
from datetime import datetime
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = '666668eae682'
down_revision = '85... |
'''
Created on 26.01.2010
@author: Tillsten
'''
from TeamsAndPlayers import *
import random
class Round(object):
def __init__(self, left_teams, freedraw):
self.games_open = []
self.games_finnished = []
self.games_in_progress = []
self.games = []
while left... |
"""Factory functions for asymmetric cryptography.
@sort: generateRSAKey, parseXMLKey, parsePEMKey, parseAsPublicKey,
parseAsPrivateKey
"""
from compat import *
from RSAKey import RSAKey
from Python_RSAKey import Python_RSAKey
import cryptomath
if cryptomath.m2cryptoLoaded:
from OpenSSL_RSAKey import OpenSSL_RSAK... |
from base64 import b64encode
from ..packages import six
ACCEPT_ENCODING = 'gzip,deflate'
def make_headers(keep_alive=None, accept_encoding=None, user_agent=None,
basic_auth=None, proxy_basic_auth=None):
"""
Shortcuts for generating request headers.
:param keep_alive:
If ``True... |
import os
import sys
sys.path.insert(0, os.path.abspath('../..'))
# -- General configuration ----------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = [
'sphinx... |
"""
fs.httpfs
=========
"""
from fs.base import FS
from fs.path import normpath
from fs.errors import ResourceNotFoundError, UnsupportedError
from urlparse import urlparse
from urllib2 import urlopen, URLError
class HTTPFS(FS):
"""Can barely be called a filesystem, but this enables the opener system
to... |
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import ExtractorError
class RTVNHIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?rtvnh\.nl/video/(?P<id>[0-9]+)'
_TEST = {
'url': 'http://www.rtvnh.nl/video/131946',
'md5': 'cdbec9f4455... |
"""
Created on 18 Apr 2018
@author: Bruno Beloff (<EMAIL>)
"""
import optparse
# --------------------------------------------------------------------------------------------------------------------
class CmdCSVLoggerConf(object):
"""unix command line handler"""
def __init__(self):
"""
Cons... |
""" Tests for tab functions (just primitive). """
import json
from contentstore.tests.utils import CourseTestCase
from contentstore.utils import reverse_course_url
from contentstore.views import tabs
from xmodule.modulestore.django import modulestore
from xmodule.modulestore.tests.django_utils import ModuleStoreTestC... |
"""
Namespace that defines fields common to all blocks used in the LMS
"""
#from django.utils.translation import ugettext_noop as _
from lazy import lazy
from xblock.fields import Boolean, Scope, String, XBlockMixin, Dict
from xblock.validation import ValidationMessage
from xmodule.modulestore.inheritance import User... |
"""
Python tests for the Survey views
"""
import json
from collections import OrderedDict
from django.test.client import Client
from django.core.urlresolvers import reverse
from survey.models import SurveyForm, SurveyAnswer
from student.tests.factories import UserFactory
from xmodule.modulestore.tests.factories imp... |
from openerp import tools
import openerp.addons.decimal_precision as dp
from openerp.osv import fields,osv
class account_invoice_report(osv.osv):
_name = "account.invoice.report"
_description = "Invoices Statistics"
_auto = False
_rec_name = 'date'
def _compute_amounts_in_user_currency(self, cr, u... |
"""This module is deprecated. Please use :mod:`airflow.providers.qubole.sensors.qubole`."""
import warnings
from airflow.providers.qubole.sensors.qubole import ( # noqa
QuboleFileSensor,
QubolePartitionSensor,
QuboleSensor,
)
warnings.warn(
"This module is deprecated. Please use `airflow.providers.q... |
import re
from pybindgen.typehandlers import base as typehandlers
from pybindgen import ReturnValue, Parameter
from pybindgen.cppmethod import CustomCppMethodWrapper, CustomCppConstructorWrapper
from pybindgen.typehandlers.codesink import MemoryCodeSink
from pybindgen.typehandlers import ctypeparser
from pybindgen imp... |
"""
Polish-specific form helpers
"""
import re
from django.forms import ValidationError
from django.forms.fields import Select, RegexField
from django.utils.translation import ugettext_lazy as _
class PLProvinceSelect(Select):
"""
A select widget with list of Polish administrative provinces as choices.
"... |
from __future__ import absolute_import
from .asctime import _parse_date_asctime
from .greek import _parse_date_greek
from .hungarian import _parse_date_hungarian
from .iso8601 import _parse_date_iso8601
from .korean import _parse_date_onblog, _parse_date_nate
from .perforce import _parse_date_perforce
from .rfc822 imp... |
#coding: utf-8
import math
# 導入數學函式後, 圓周率為 pi
# deg 為角度轉為徑度的轉換因子
deg = math.pi/180.
class Spur(object):
def __init__(self, ctx):
self.ctx = ctx
def create_line(self, x1, y1, x2, y2, width=3, fill="red"):
self.ctx.beginPath()
self.ctx.lineWidth = width
self.ctx.moveTo(x1, y1)
... |
"""Tests for distutils.command.install_scripts."""
import os
import unittest
from distutils.command.install_scripts import install_scripts
from distutils.core import Distribution
from distutils.tests import support
from test.test_support import run_unittest
class InstallScriptsTestCase(support.TempdirManager,
... |
import math
import time
from collections import defaultdict, namedtuple
from twitter.common import log
from apache.aurora.client.base import DEFAULT_GROUPING, format_response, group_hosts
from apache.aurora.common.aurora_job_key import AuroraJobKey
from gen.apache.aurora.api.constants import LIVE_STATES
from gen.apa... |
from routes import url_for
from zk.model import Product
from BeautifulSoup import BeautifulSoup
from .fixtures import CeilingFactory, ProductCategoryFactory, ProductFactory, PersonFactory, RoleFactory, RegistrationFactory, InvoiceFactory, InvoiceItemFactory, CompletePersonFactory
from .utils import do_login
from .cr... |
from django_jinja import library
from django_sites import get_by_id as get_site_by_id
from taiga.front.urls import urls
register = library.Library()
@register.global_function(name="resolve_front_url")
def resolve(type, *args):
site = get_site_by_id("front")
url_tmpl = "{scheme}//{domain}{url}"
scheme ... |
from __future__ import absolute_import
from datetime import date
from django.contrib.gis.geos import GEOSGeometry, Point, MultiPoint
from django.contrib.gis.db.models import Collect, Count, Extent, F, Union
from django.contrib.gis.geometry.backend import Geometry
from django.contrib.gis.tests.utils import mysql, orac... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import sys
import copy
from ansible import constants as C
from ansible.module_utils._text import to_text
from ansible.module_utils.connection import Connection
from ansible.plugins.action.network import ActionModule as ActionNetwo... |
import logging
import os
import shlex
from webkitpy.layout_tests.breakpad.dump_reader import DumpReader
_log = logging.getLogger(__name__)
class DumpReaderWin(DumpReader):
"""DumpReader for windows breakpad."""
def __init__(self, host, build_dir):
super(DumpReaderWin, self).__init__(host, build_di... |
#!/usr/bin/env python
'''
extract one mode type from a log
'''
import sys, time, os, struct
from argparse import ArgumentParser
parser = ArgumentParser(description=__doc__)
parser.add_argument("--no-timestamps", dest="notimestamps", action='store_true', help="Log doesn't have timestamps")
parser.add_argument("--rob... |
"""Tools for helping with testing capa."""
import gettext
import os
import os.path
import fs.osfs
from capa.capa_problem import LoncapaProblem, LoncapaSystem
from capa.inputtypes import Status
from mock import Mock, MagicMock
import xml.sax.saxutils as saxutils
TEST_DIR = os.path.dirname(os.path.realpath(__file__)... |
from .copy_source import CopySource
class EloquaSource(CopySource):
"""A copy activity Eloqua server source.
:param additional_properties: Unmatched properties from the message are
deserialized this collection
:type additional_properties: dict[str, object]
:param source_retry_count: Source retry... |
import os
import logging
import ConfigParser
logger = logging.getLogger("HPOlib.config_parser.parse")
def parse_config(config_files, allow_no_value=True, optimizer_version="",
cli_values=None):
if type(config_files) is str:
if not os.path.isfile(config_files):
raise Exceptio... |
from .base import BaseTestCase
class CommitteesSearchTestCase(BaseTestCase):
url_tmpl = '/api/v1/committees/'
data = dict(state='ex', chamber='lower')
def test_count(self):
self.assertEquals(
len(self.json),
self.db.committees.find(self.data).count())
def test_correc... |
# -*- coding: utf-8 -*-
import os
import sys
import subprocess
from setuptools import setup
sys.path.append(os.path.join('doc', 'common'))
try:
from doctools import build_doc, test_doc
except ImportError:
build_doc = test_doc = None
from distutils.cmd import Command
class import_cldr(Command):
descrip... |
import threading
from time import sleep
from datetime import timedelta
from django import db
from django.utils import unittest
from django.core.management import call_command
from django.test.utils import override_settings
from django.test.client import Client
from django.core.urlresolvers import reverse
from django.c... |
#!/usr/bin/env python
"""
The Cython debugger
The current directory should contain a directory named 'cython_debug', or a
path to the cython project directory should be given (the parent directory of
cython_debug).
Additional gdb args can be provided only if a path to the project directory is
given.
"""
import os
i... |
import mraa as m
import unittest as u
from i2c_checks_shared import *
class I2cChecksWriteByte(u.TestCase):
def setUp(self):
self.i2c = m.I2c(MRAA_I2C_BUS_NUM)
def tearDown(self):
del self.i2c
def test_i2c_write_byte(self):
self.i2c.address(MRAA_MOCK_I2C_ADDR)
test_byte = 0xEE
self.assertE... |
from numpy import log2
from .AbstractEval import AbstractEval
class LetorNdcgEval(AbstractEval):
"""Compute NDCG as implemented in the Letor toolkit."""
def get_dcg(self, labels, cutoff=-1):
if (cutoff == -1):
cutoff = len(labels)
dcg = 0
# [0:cutoff] returns the labels u... |
"""An implementation of the Porter2 stemming algorithm.
See http://snowball.tartarus.org/algorithms/english/stemmer.html
Adapted from pyporter2 by Michael Dirolf.
This algorithm is more correct but (at least in this implementation)
several times slower than the original porter algorithm as implemented
in stemming.por... |
"""
Integration tests for Moksha's CSRF protection.
These tests are meant to ensure the validity of Moksha's CSRF WSGI middleware
and repoze.who metadata provider plugin.
"""
from moksha.tests import TestController
class TestCSRFProtection(TestController):
application_under_test = 'main'
def test_csrf_prot... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from pants.backend.jvm.subsystems.jvm_tool_mixin import JvmToolMixin
from pants.base.workunit import WorkUnitLabel
from pants.java.jar.jar_dependency import JarDepende... |
import json
import uuid
import sqlalchemy as sql
from sqlalchemy import orm
from keystone import config
from keystone import exception
CONF = config.CONF
def upgrade(migrate_engine):
meta = sql.MetaData()
meta.bind = migrate_engine
role_table = sql.Table('role', meta, autoload=True)
# name should... |
#!/usr/bin/env python
# coding: utf-8
from __future__ import unicode_literals
import shutil
# Allow direct execution
import os
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from test.helper import FakeYDL
from youtube_dl.cache import Cache
def _is_empt... |
try:
from zabbix_api import ZabbixAPI, ZabbixAPISubClass
from zabbix_api import ZabbixAPIException
from zabbix_api import Already_Exists
HAS_ZABBIX_API = True
except ImportError:
HAS_ZABBIX_API = False
# Extend the ZabbixAPI
# Since the zabbix-api python module too old (version 1.0, and there's no... |
import sys, os, itertools
try:
import cStringIO as StringIO
except:
import StringIO
import numpy as np
import scipy.sparse as sp
from gensim.corpora import TextCorpus
from gensim.models import LsiModel, TfidfModel, LdaModel
from gensim.matutils import corpus2csc
from sklearn.feature_extraction import FeatureHashe... |
from google.appengine.ext import webapp
import model
class SVNRevision(webapp.RequestHandler):
def get(self, svn_revision_number):
svn_revisions = model.SVNRevision.all().filter('number =', int(svn_revision_number)).order('-date').fetch(1)
if not svn_revisions:
self.error(404)
... |
import sys
import unittest
from libcloud.utils.py3 import httplib
from libcloud.common.linode import LinodeException
from libcloud.dns.types import RecordType, ZoneDoesNotExistError
from libcloud.dns.types import RecordDoesNotExistError
from libcloud.dns.drivers.linode import LinodeDNSDriver
from libcloud.... |
"""Class to subsample minibatches by balancing positives and negatives.
Subsamples minibatches based on a pre-specified positive fraction in range
[0,1]. The class presumes there are many more negatives than positive examples:
if the desired batch_size cannot be achieved with the pre-specified positive
fraction, it fi... |
# -*- coding: utf-8 -*-
"""Parameter declaration parser
:copyright: Copyright (c) 2015 Bivio Software, Inc. All Rights Reserved.
:license: http://www.apache.org/licenses/LICENSE-2.0.html
"""
from __future__ import absolute_import, division, print_function
import UserDict
import __builtin__
import copy
import enum
im... |
{
'name': 'Res Partner url validation: missing details',
'version': '0.2',
'author': 'cgstudiomap',
'maintainer': 'cgstudiomap',
'license': 'AGPL-3',
'category': 'Sales',
'summary': 'Set up for urls for missing details bot',
'depends': [
'res_partner_missing_details',
're... |
from FIAT import finite_element, polynomial_set, dual_set, functional, P0, quadrature
from FIAT.polynomial_set import mis
import numpy
class DiscontinuousTaylorDualSet(dual_set.DualSet):
"""The dual basis for Taylor elements. This class works for
intervals. Nodes are function and derivative evaluation
a... |
#coding=utf-8
from time import sleep
from public.common import mytest
from public.pages import baiduIndexPage
from public.common import datainfo
class TestBaiduIndex(mytest.MyTest):
"""百度搜索测试"""
def _search(self,searchKey):
"""封装百度搜索的函数"""
baidupage = baiduIndexPage.BaiduIndexPage(self.dr)
... |
"""
Generator for fborender* tests.
This file needs to be run in its folder.
"""
import sys
_DO_NOT_EDIT_WARNING = """<!--
This file is auto-generated from fborender_test_generator.py
DO NOT EDIT!
-->
"""
_HTML_TEMPLATE = """<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<ti... |
"""
Copyright 2013 Tiago Antao
This file is part of igrat.
igrat is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
igrat is distribut... |
#!/usr/bin/env python
""" PickleShare - a small 'shelve' like datastore with concurrency support
Like shelve, a PickleShareDB object acts like a normal dictionary. Unlike
shelve, many processes can access the database simultaneously. Changing a
value in database is immediately visible to other processes accessing the... |
from .smoketests import SmokeTest |
'''
>>> from virtual_functions_ext import *
>>> class C1(concrete):
... def f(self, y):
... return concrete.f(self, Y(-y.value()))
>>> class C2(concrete):
... pass
>>> class A1(abstract):
... def f(self, y):
... return y.value() * 2
... def g(self, y):
... return self
>>> cla... |
"""
The I{xdate} module provides classes for converstion
between XML dates and python objects.
"""
from logging import getLogger
from suds import *
from suds.xsd import *
import time
import datetime as dt
import re
log = getLogger(__name__)
class Date:
"""
An XML date object.
Supported formats:
... |
from gettext import gettext as _
import logging
from umake.tools import InputError
logger = logging.getLogger(__name__)
class Choice:
def __init__(self, id, label, callback_fn, txt_shorcut=None, is_default=False):
"""Choice element containing label and callback function"""
self.id = id
s... |
import webob.exc
from nova.api.openstack import extensions
from nova.api.openstack import wsgi
from nova.api.openstack import xmlutil
from nova import compute
from nova import exception
from nova.openstack.common.gettextutils import _
authorize = extensions.extension_authorizer('compute', 'server_diagnostics')
sd_ns... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import logging
import unittest
from contextlib import contextmanager
from pants.util.osutil import OS_ALIASES, known_os_names, normalize_os_name
class OsutilTest(un... |
"""SymPy is a Python library for symbolic mathematics. It aims to become a
full-featured computer algebra system (CAS) while keeping the code as
simple as possible in order to be comprehensible and easily extensible.
SymPy is written entirely in Python and does not require any external
libraries, except optionally for ... |
"""Experimental API for TensorFlow's "Eager" mode of execution."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python import pywrap_tensorflow
from tensorflow.python.eager import memory_trace
from tensorflow.python.framework import error... |
"""
The file name should contain the representitive class/struct name.
If the file contains class/struct decls or defs, the file name should be
one of classes.
If the class/struct name starts with "C", "C" can be ommited in the file name.
== Vilolation ==
= a.h = <== Violation. It should contain class name 'TestC... |
import re
from django.utils import datetime_safe
from django.template import loader, Context
from haystack.exceptions import SearchFieldError
class NOT_PROVIDED:
pass
DATETIME_REGEX = re.compile('^(?P<year>\d{4})-(?P<month>\d{2})-(?P<day>\d{2})(T|\s+)(?P<hour>\d{2}):(?P<minute>\d{2}):(?P<second>\d{2}).*?$')
#... |
# -*- coding: utf-8 -*-
"""
requests._internal_utils
~~~~~~~~~~~~~~
Provides utility functions that are consumed internally by Requests
which depend on extremely few external helpers (such as compat)
"""
from .compat import is_py2, builtin_str, str
def to_native_string(string, encoding='ascii'):
"""Given a str... |
from ctypes import byref, c_uint
from django.contrib.gis.geos import prototypes as capi
from django.contrib.gis.geos.geometry import GEOSGeometry
from django.contrib.gis.geos.libgeos import GEOM_PTR, get_pointer_arr
from django.contrib.gis.geos.linestring import LinearRing
from django.utils import six
from django.util... |
"""
## @file
This file defines the LogPolar filter, an ImageSensor filter that distorts
incoming images in a "fish-eye" manner.
"""
from PIL import Image
import numpy
from nupic.regions.ImageSensorFilters.BaseFilter import BaseFilter
class LogPolar(BaseFilter):
"""
Apply a LogPolar transformation to the origin... |
from contextlib import contextmanager
from robot.errors import DataError
from robot.utils import split_from_equals, unic, is_string, DotDict
from .isvar import validate_var
from .splitter import VariableSplitter
class VariableTableSetter(object):
def __init__(self, store):
self._store = store
def ... |
import argparse
import inspect
import json
import sys
try:
from unittest import loader
except ImportError:
# unittest in python 2.6 does not contain loader, so uses unittest2
from unittest2 import loader
from oslo_log import log as logging
from testtools import testsuite
from tempest.stress import driver
... |
"""Definition of targets run distribution package tests."""
import os.path
import sys
sys.path.insert(0, os.path.abspath('..'))
import python_utils.jobset as jobset
def create_docker_jobspec(name, dockerfile_dir, shell_command, environ={},
flake_retries=0, timeout_retries=0):
"""Creates jobspec... |
# Read a pycbc_inspiral HDF5 trigger file and check that it contains triggers
# compatible with GW150914
# 2016 Tito Dal Canton
import sys
import h5py
import numpy as np
# GW150914 params from my run
# https://www.atlas.aei.uni-hannover.de/~tito/LSC/er8/er8b_c00_1.2.0_run1
gw150914_time = 1126259462.4
gw150914_snr =... |
#!/usr/bin/env python
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
__license__ = 'GPL v3'
__copyright__ = '2011, Kovid Goyal <<EMAIL>>'
__docformat__ = 'restructuredtext en'
from PyQt4.Qt import (QDialog, QLabel, QVBoxLayout, QDialogButtonBox,
QProgressBar, QSize, QTimer, pyqtSignal, Qt)
from calibre... |
from __future__ import print_function
import argparse
import csv
import sys
from math import sqrt
class PerformanceTestResult(object):
"""PerformanceTestResult holds results from executing an individual
benchmark from the Swift Benchmark Suite as reported by the test driver
(Benchmark_O, Benchmark_Onone,... |
# -*- coding: utf-8 -*-
# import requests
# import urllib
import re
import urllib
import json
import sys
def search_doi(s):
url = "http://search.crossref.org/?q=" + convert_string(s)
htmlfile = urllib.urlopen(url)
htmltext = htmlfile.read()
regex ="href='http://dx.doi.org/"+ '(.*)' + "'>"
pattern = re.compile(re... |
import datetime
import operator
import sickbeard
from sickbeard import db
from sickbeard import helpers, logger, show_name_helpers
from sickbeard import providers
from sickbeard import search
from sickbeard.common import SNATCHED_FRENCH
from sickbeard.common import showLanguages
import re
resultFilters ... |
from django.db import models
class Component(models.Model):
name = models.CharField(max_length=50, unique=True)
photoUrl = models.URLField(null=True, blank=True)
brand = models.ForeignKey(
'Brand',
on_delete=models.CASCADE,
)
class Brand(models.Model):
name = models.CharField(max... |
#!/usr/bin/env python
"""Usage:
python teach.py nmlfile outputfile
If outputfile is not specified, writes to standard output.
You must ". scripts/rip-environment" before running this script, if you use
run-in-place.
"""
# Copyright 2007 Jeff Epler <<EMAIL>>
#
# This program is free software; you can redistri... |
from baseClass import baseClass
from targetScanner import targetScanner
import sys, time
__author__="Iman Karim(<EMAIL>)"
__date__ ="$03.09.2009 01:29:37$"
class singleScan(baseClass):
def _load(self):
self.URL = None
self.quite = False
def setURL(self, URL):
self.URL = URL
def ... |
import gtk
from lib.common import datafile_path
class TreeViews(gtk.TreeView):
'''Main TextView elements'''
def __init__(self, core, textviews):
self.store = gtk.ListStore(gtk.gdk.Pixbuf, str, str, str, str)
super(TreeViews,self).__init__(self.store)
self.uicore = core
self.te... |
"""
.. dialect:: mysql+zxjdbc
:name: zxjdbc for Jython
:dbapi: zxjdbc
:connectstring: mysql+zxjdbc://<user>:<password>@<hostname>[:<port>]/\
<database>
:driverurl: http://dev.mysql.com/downloads/connector/j/
.. note:: Jython is not supported by current versions of SQLAlchemy. The
zxjdbc di... |
#! /usr/bin/env python
# linktree
#
# Make a copy of a directory tree with symbolic links to all files in the
# original tree.
# All symbolic links go to a special symbolic link at the top, so you
# can easily fix things if the original source tree moves.
# See also "mkreal".
#
# usage: mklinks oldtree newtree
import... |
import os, string, re
from ..PluginBase import PluginFeatureBase, ProjectBase, ConfigBase, QueryBase
from ..PluginBase import PluginProcess
from ..CtagsCache import CtagsThread
class GtagsFeature(PluginFeatureBase):
def __init__(self):
PluginFeatureBase.__init__(self)
self.feat_desc = [
['REF', '-r'],
['... |
"""
Problem Page.
"""
from bok_choy.page_object import PageObject
class ProblemPage(PageObject):
"""
View of problem page.
"""
url = None
CSS_PROBLEM_HEADER = '.problem-header'
def is_browser_on_page(self):
return self.q(css='.xblock-student_view').present
@property
def prob... |
#Boa:Frame:PlotFrame
from __future__ import division
import wx
import sys
import os
PPRZ_SRC = os.getenv("PAPARAZZI_SRC", os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)),
'../../../..')))
sys.path.append(PPRZ_SRC + "/sw/li... |
from os import path
import os
import sys
def generate_include_tag(resource_path):
if (resource_path.endswith('.js')):
return ' <script type="text/javascript" src="%s"></script>\n' % resource_path
elif (resource_path.endswith('.css')):
return ' <link rel="stylesheet" type="text/css" href=... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.