code stringlengths 1 199k |
|---|
from namespaces import TEXTNS
from element import Element
from style import StyleElement
def A(**args):
args.setdefault('type', 'simple')
return Element(qname = (TEXTNS,'a'), **args)
def AlphabeticalIndex(**args):
return Element(qname = (TEXTNS,'alphabetical-index'), **args)
def AlphabeticalIndexAutoMarkFil... |
from channels.auth import AuthMiddlewareStack
from channels.routing import ProtocolTypeRouter, URLRouter
from ops.urls.ws_urls import urlpatterns as ops_urlpatterns
urlpatterns = []
urlpatterns += ops_urlpatterns
application = ProtocolTypeRouter({
'websocket': AuthMiddlewareStack(
URLRouter(urlpatterns)
... |
"""BibCirculation .........."""
__revision__ = "$Id$"
import invenio.bibcirculation_dblayer as db
import invenio.template
bibcirculation_templates = invenio.template.load('bibcirculation')
from invenio.config import \
CFG_SITE_LANG, \
CFG_CERN_SITE, \
CFG_SITE_SUPPORT_EMAIL
from invenio.dateutils import ... |
import os
import tempfile
import shutil
import simplejson
import dbus
from sugar3.bundle.bundle import Bundle, MalformedBundleException
from jarabe.journal import model
class JournalEntryBundle(Bundle):
"""A Journal entry bundle
See http://wiki.laptop.org/go/Journal_entry_bundles for details
"""
MIME_TY... |
"""Unit tests for SVN interactions"""
__revision__ = "$Id$"
from invenio.testsuite import make_test_suite, run_test_suite, InvenioTestCase
from invenio.base.globals import cfg
from invenio.utils.vcs.svn import harvest_repo
from invenio.utils.shell import which
from tempfile import mkdtemp
from subprocess import call
fr... |
'''
Yoda Add-on
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope ... |
import os
import gettext
import sys
sys.path.append('/usr/lib/linuxmint/common') # noqa
import additionalfiles
DOMAIN = "cinnamon"
PATH = "/usr/share/locale"
os.environ['LANGUAGE'] = "en_US.UTF-8"
gettext.install(DOMAIN, PATH)
prefix = """[Desktop Entry]
Exec=cinnamon-settings
Icon=preferences-system
Terminal=false
Ty... |
from ganeti_webmgr.clusters.models import Cluster
from django.contrib.auth.models import User, Group
from django.test import TestCase
from django.test import LiveServerTestCase
from django.utils import unittest, simplejson as json
from ganeti_webmgr.nodes.models import Node
from ganeti_webmgr.virtualmachines.models imp... |
""" Participants """
from collections import namedtuple
from .base import DonorDriveBase
from .log import root_logger
mod_logger = root_logger.getChild('participants')
Participant = namedtuple('Participant',
[
'avatarImageURL',
'campaign... |
"""Collection Facet"""
from invenio.websearch_facet_builders import CollectionFacetBuilder
facet = CollectionFacetBuilder('collection', order=1) |
'''
Test cases for pyclbr.py
Nick Mathewson
'''
import os
import sys
from textwrap import dedent
from types import FunctionType, MethodType, BuiltinFunctionType
import pyclbr
from unittest import TestCase, main as unittest_main
from test import support
from functools import partial
StaticMethodType = type(staticm... |
"""Usage (via ``inveniomanage``).
.. code-block:: console
$ inveniomanage upgrader create recipe -p invenio_search
$ inveniomanage upgrader create release -r invenio -p invenio_base
$ inveniomanage upgrader show applied
$ inveniomanage upgrader show pending
$ inveniomanage upgrader check
$ inven... |
from test_helper import ApiTestCase
class DiscoveryTest(ApiTestCase):
def test_discovery(self):
r = self.session.get(self.url("/api"))
self.assert_success_json(r)
lst = r.json()
self.assertEqual(lst, [{'version': 1, 'url': '/api/v1'}]) |
from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
class TransConfig(AppConfig):
name = 'weblate.trans'
label = 'trans'
verbose_name = _('Weblate translations') |
import discord
async def blockinvites(cmd, message, args):
if message.author.permissions_in(message.channel).manage_guild:
active = cmd.db.get_guild_settings(message.guild.id, 'BlockInvites')
if active is None:
active = False
if active:
cmd.db.set_guild_settings(messa... |
import logging
import subprocess
from helpers.ec2_helper import EC2Helper
from helpers.sit_helper import SITHelper
from helpers.log import Log
class SITTemplateHelper(object):
def __init__(self, configs_directory='configs', session=None):
self.configs = SITHelper(configs_directory).get_configs('troposphere'... |
"""
Copyright (c) 2006-2017 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
import re
from lib.core.enums import HTTP_HEADER
from lib.core.settings import WAF_ATTACK_VECTORS
__product__ = "Safedog Web Application Firewall (Safedog)"
def detect(get_page):
retval = False
... |
"""Definitions relating to minimum-needs."""
import re
import sys
from PyQt4.QtCore import QVariant
from safe.common.parameters.resource_parameter import ResourceParameter
from safe.gui.tools.minimum_needs.needs_profile import NeedsProfile
__copyright__ = "Copyright 2016, The InaSAFE Project"
__license__ = "GPL version... |
"""Unit tests for host collections."""
from robottelo.common.decorators import skip_if_bug_open
from robottelo import entities
from robottelo.test import APITestCase
class HostCollectionTestCase(APITestCase):
"""Tests for :class:`robottelo.entities.HostCollection`."""
@classmethod
def setUpClass(cls):
... |
from ert.enkf import EnkfObservationImplementationType
from ert.enkf.observations import BlockObservation
from ert.enkf.plot import DataFetcher
class BlockObservationDataFetcher(DataFetcher):
def __init__(self, ert):
super(BlockObservationDataFetcher, self).__init__(ert)
self.__selected_report_step_... |
"""
This file is part of OpenSesame.
OpenSesame is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenSesame is distributed in the hope that it... |
from distutils.core import setup, Extension
from generator import generate_object_files
setup(name="_aubio", version="1.0",
packages = ['aubio'],
ext_modules = [
Extension("_aubio",
["aubiomodule.c",
"aubioproxy.c",
"py-cvec.c",
# example without macro... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'}
DOCUMENTATION = '''
---
module: gcp_cloudscheduler_job_info
description:
- Gather info for GCP Job
short_description: Gather info for G... |
import os
import sys
import argparse
import logging
import traceback
import hashlib
import glob
import pickle
import functools
import tempfile
import h5py
from lazyflow.graph import Graph
from lazyflow.operators.ioOperators import OpStackToH5Writer
import ilastik.utility.monkey_patches
from ilastik.shell.headless.headl... |
from gi.repository import WebKit as webkit
from gi.repository import Gtk
from gi.repository import Pango
import urlparse
from softwarecenter.i18n import get_language
class LocaleAwareWebView(webkit.WebView):
def __init__(self):
# actual webkit init
webkit.WebView.__init__(self)
self.connect(... |
"""
requests_cache.backends.sqlite
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
``sqlite3`` cache backend
"""
from .base import BaseCache
from .storage.dbdict import DbDict, DbPickleDict
class DbCache(BaseCache):
""" sqlite cache backend.
Reading is fast, saving is a bit slower. It can store big amount of data
... |
'Declarations for the errors'
class ProtocolError(Exception):
pass
class SysProtError(ProtocolError):
pass
class FileExistsError(SysProtError):
pass
class FileNotFound(SysProtError):
pass
class ModuleNotFound(SysProtError):
pass
class DirProtError(ProtocolError):
pass
class I2CError(DirProtError... |
import traceback
import sys
import os
import imp
import pkgutil
from util import *
from i18n import _
from util import print_error, profiler
plugins = {}
descriptions = []
loader = None
def is_available(name, w):
for d in descriptions:
if d.get('name') == name:
break
else:
return Fal... |
from __future__ import (unicode_literals, division, absolute_import, print_function)
store_version = 8 # Needed for dynamic plugin loading
__license__ = 'GPL 3'
__copyright__ = '2013-2016, Tomasz Długosz <tomek3d@gmail.com>'
__docformat__ = 'restructuredtext en'
import urllib
from base64 import b64encode
from contextli... |
"""
sphinx.writers.text
~~~~~~~~~~~~~~~~~~~
Custom docutils writer for plain text.
:copyright: Copyright 2007-2016 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import os
import re
import textwrap
from itertools import groupby
import warnings
from six.moves import zip_... |
import unittest
import frappe
from frappe.utils import add_days, add_months, getdate
from erpnext import get_default_company
from erpnext.education.doctype.student.test_student import create_student
from erpnext.education.doctype.student_group.test_student_group import get_random_group
class TestStudentLeaveApplication... |
"""Access to real or simulated datasets for MRI."""
from __future__ import absolute_import |
import json
import logging
from odoo import api, fields, models, _
from odoo.http import request
from odoo.osv import expression
from odoo.exceptions import AccessError
logger = logging.getLogger(__name__)
class SeoMetadata(models.AbstractModel):
_name = 'website.seo.metadata'
_description = 'SEO metadata'
... |
from django.core.urlresolvers import reverse
from taiga.base.utils import json
from taiga.projects import choices as project_choices
from taiga.projects.custom_attributes import serializers
from taiga.permissions.permissions import (MEMBERS_PERMISSIONS,
ANON_PERMISSIONS, USER_... |
from Tkinter import *
import tkFileDialog, tkMessageBox
import sys, os
import pygame
from scipy.io.wavfile import read
import spsModel_function
class SpsModel_frame:
def __init__(self, parent):
self.parent = parent
self.initUI()
pygame.init()
def initUI(self):
choose_label = "Input file (.wav, mono and 441... |
"""
Bing (Web)
@website https://www.bing.com
@provide-api yes (http://datamarket.azure.com/dataset/bing/search),
max. 5000 query/month
@using-api no (because of query limit)
@results HTML (using search portal)
@stable no (HTML can change)
@parse url, title, content
@todo ... |
from __future__ import (
unicode_literals,
print_function,
absolute_import,
division
)
from weakref import WeakSet
from sqlalchemy.sql import expression
class EnumSymbol(expression.ClauseElement):
"""
Define a fixed symbol tied to a parent class.
"""
def __init__(self, cls_, name, value, description, order=0):
... |
"""
Miscellaneous utility functions.
"""
import os
import random
import subprocess
import tempfile
import errno
import stat
import shutil
import pycurl
import gzip
import time
import select
try:
import configparser
except ImportError:
import ConfigParser as configparser
import collections
import ftplib
import s... |
import os, sys, shutil, copy, glob, time
import numpy as np
from .. import io as su2io
from .. import eval as su2eval
from .. import util as su2util
from ..io import redirect_folder
from warnings import warn, simplefilter
inf = 1.0e20
class Project(object):
""" project = SU2.opt.Project(self,config,state=None,
... |
from spack import *
class Minivite(MakefilePackage):
"""miniVite is a proxy application that implements a single phase of
Louvain method in distributed memory for graph community detection.
"""
tags = ['proxy-app', 'ecp-proxy-app']
homepage = "http://hpc.pnl.gov/people/hala/grappolo.html"
git... |
"""Dynamically decide from where to import Google App Engine modules.
All other NDB code should import its Google App Engine modules from
this module. If necessary, add new imports here (in both places).
"""
try:
from google.appengine.datastore import entity_pb
normal_environment = True
except ImportError:
from ... |
from __future__ import (absolute_import, division, print_function)
from cartopy.geodesic._geodesic import Geodesic # noqa: F401
__document_these__ = ['Geodesic'] |
from Py6S import *
from matplotlib.pyplot import *
import copy
def ndvi(red, nir):
return ((nir - red) / (nir + red))
early = SixS()
early.altitudes.set_target_sea_level()
early.altitudes.set_sensor_satellite_level()
early.ground_reflectance = GroundReflectance.HomogeneousLambertian(GroundReflectance.GreenVegetation)... |
class SeleniumLibraryException(Exception):
ROBOT_SUPPRESS_NAME = True
class ElementNotFound(SeleniumLibraryException):
pass
class WindowNotFound(SeleniumLibraryException):
pass
class CookieNotFound(SeleniumLibraryException):
pass
class NoOpenBrowser(SeleniumLibraryException):
pass
class PluginError(... |
import pytest
def pytest_addoption(parser):
parser.addoption("--runperf", action="store_true",
help="run perf tests")
def pytest_runtest_setup(item):
if 'perf' in item.keywords and not item.config.getoption("--runperf"):
pytest.skip("need --runperf option to run") |
from st2reactor.sensor.base import PollingSensor
from elasticsearch import Elasticsearch
import json
import eventlet
class ElasticsearchCountSensor(PollingSensor):
def setup(self):
self.host = self.config.get('host', None)
self.port = self.config.get('port', None)
self.query_window = self.co... |
from __future__ import absolute_import
from __future__ import unicode_literals
VERSION_EXPLANATION = (
'You might be seeing this error because you\'re using the wrong Compose '
'file version. Either specify a version of "2" (or "2.0") and place your '
'service definitions under the `services` key, or omit t... |
import socket
from oslo_config import cfg
from oslo_utils import netutils
netconf_opts = [
cfg.StrOpt("my_ip",
default=netutils.get_my_ipv4(),
sample_default='<host_ipv4>',
help="""
The IP address which the host is using to connect to the management network.
Possible values:
* String with va... |
__ver__ = '0.6.2'
import urllib, urlparse
import time, random
import sys, weakref
import socket
import simplejson
import http
import upload
import errors
import listing, page
import compatibility
try:
import gzip
except ImportError:
gzip = None
try:
from cStringIO import StringIO
except ImportError:
from StringIO i... |
from __future__ import unicode_literals
from boto.ec2.blockdevicemapping import BlockDeviceType, BlockDeviceMapping
from moto.core import BaseBackend
from moto.ec2 import ec2_backends
DEFAULT_COOLDOWN = 300
class InstanceState(object):
def __init__(self, instance, lifecycle_state="InService"):
self.instance... |
"""
CNI implementation
Demultiplexes on the CNI_COMMAND and runs the necessary operation
"""
import ctypes
import errno
import inspect
import json
import os
import sys
from pyroute2 import NetlinkError, IPRoute
cfile = os.path.abspath(inspect.getfile(inspect.currentframe())) # nopep8
sys.path.append(os.path.dirname(os... |
import logging
import os
import re
import webbrowser
from . import System
class Workload(object):
"""
Base class for Android related workloads
"""
_packages = None
_availables = {}
def __init__(self, test_env):
"""
Initialized workloads available on the specified test environment... |
"""This module is deprecated.
Please use `airflow.providers.amazon.aws.transfers.redshift_to_s3`.
"""
import warnings
from airflow.providers.amazon.aws.transfers.redshift_to_s3 import RedshiftToS3Operator
warnings.warn(
"This module is deprecated. Please use `airflow.providers.amazon.aws.transfers.redshift_to_s3`."... |
"""Tests for variable store."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import errors_impl
from tensorflow... |
import pytest
from gunicorn import util
from gunicorn.errors import AppImportError
from gunicorn.six.moves.urllib.parse import SplitResult # pylint: disable=no-name-in-module
@pytest.mark.parametrize('test_input, expected', [
('unix://var/run/test.sock', 'var/run/test.sock'),
('unix:/var/run/test.sock', '/var/... |
from ceilometer.hardware.inspector import base
class InspectorBaseTest(object):
"""Subclass must set self.inspector and self.host in
self.setUp()
"""
cpu = [base.CPUStats(cpu_1_min=0.1,
cpu_5_min=0.2,
cpu_15_min=0.3),
]
network = [(base.In... |
import tempfile
from django.core.files.uploadedfile import InMemoryUploadedFile
from django.core.urlresolvers import reverse
from django import http
from mox import IsA
from openstack_dashboard import api
from openstack_dashboard.dashboards.project.containers import forms
from openstack_dashboard.dashboards.project.con... |
"""TensorFlow is an open source machine learning framework for everyone.
TensorFlow is an open source software library for high performance numerical
computation. Its flexible architecture allows easy deployment of computation
across a variety of platforms (CPUs, GPUs, TPUs), and from desktops to clusters
of servers to... |
"""This code example runs a report equal to the "Sales by salespersons report"
on the DFP website. To download the report run download_report.py."""
__author__ = ('Jeff Sham',
'Vincent Tsao')
import os
import sys
sys.path.insert(0, os.path.join('..', '..', '..', '..', '..'))
import time
from adspygoogle i... |
'''
@author: frank
'''
import sys, os, os.path
from zstacklib.utils import log
from zstacklib.utils import linux
import zstacklib.utils.iptables as iptables
pidfile = '/var/run/zstack/kvmagent.pid'
log.configure_log('/var/log/zstack/zstack-kvmagent.log')
logger = log.get_logger(__name__)
import kvmagent
def prepare_pid... |
import urlparse
import celery
import requests
from celery.utils.log import get_task_logger
from api.base import settings
from framework.tasks import app as celery_app
logger = get_task_logger(__name__)
class VarnishTask(celery.Task):
abstract = True
max_retries = 5
def get_varnish_servers():
# TODO: this s... |
"""Implementation of mb command for creating cloud storage buckets."""
from __future__ import absolute_import
import re
import textwrap
from gslib.cloud_api import BadRequestException
from gslib.command import Command
from gslib.command_argument import CommandArgument
from gslib.cs_api_map import ApiSelector
from gslib... |
''' Master class for payments '''
class BasePayments(object):
''' Base class for payments and interfacing with external subscription systems '''
def __init__(self, user=None, config=None, rdb=None):
''' Initialize the Payments Class '''
self.user = user
self.config = config
self.... |
"""
"""
def main(nshots=1, shot_delay=0):
set_motor('beam',beam_diameter)
accum = 0
if analysis_type=='blank':
info('is blank. not heating')
'''
sleep cumulative time to account for blank
during a multiple position analysis
'''
close(description='Microbone to ... |
"""Test case base for testing proto operations."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import ctypes as ct
import os
from tensorflow.core.framework import types_pb2
from tensorflow.python.kernel_tests.proto import test_example_pb2
from tensorflow.... |
import logging
import dcm.agent.plugins.api.base as plugin_base
import dcmdocker.utils as docker_utils
_g_logger = logging.getLogger(__name__)
class IsDockerHost(docker_utils.DockerJob):
protocol_arguments = {
}
def __init__(self, conf, job_id, items_map, name, arguments):
super(IsDockerHost, self).... |
"""
"""
__authors__ = ['"Bill Magnuson" <billmag@mit.edu>']
import google.appengine.api
import unittest
from datetime import datetime
from game_server.models.game import Game
from game_server.models.game_instance import GameInstance
from game_server.models.message import Message
from google.appengine.ext import db
from... |
import time
import sys
import os
import stomp
user = os.getenv("APOLLO_USER") or "admin"
password = os.getenv("APOLLO_PASSWORD") or "password"
host = os.getenv("APOLLO_HOST") or "localhost"
port = os.getenv("APOLLO_PORT") or 61613
destination = sys.argv[1:2] or ["/topic/event"]
destination = destination[0]
class MyList... |
from __future__ import absolute_import, division, print_function, unicode_literals
from botocore.exceptions import ClientError
from concurrent.futures import as_completed
from c7n.manager import resources
from c7n.query import QueryResourceManager, TypeInfo
from c7n.utils import local_session, chunks, type_schema
from ... |
import atexit
import os
import wave
from cyber.python.cyber_py3 import cyber
from modules.drivers.microphone.proto.audio_pb2 import AudioData
RESPEAKER_CHANNEL = "/apollo/sensor/microphone"
WAV_SAVING_PATH = "/tmp"
frames = [b"" for _ in range(6)]
sample_width = 0
sample_rate = 0
def save_to_wave(frames, filepath, samp... |
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'NAME': '', # Or path to datab... |
default_app_config = 'powerdns.apps.Powerdns' |
"""
@package mi.dataset.parser.rasfl_a_subcon
@file marine-integrations/mi/dataset/parser/rasfl_a_subcon_recovered_driver.py
@author Rachel Manoni
@brief Parser for the rasfl_a_subcon dataset driver
Release notes:
Initial Release
"""
__author__ = 'Rachel Manoni'
__license__ = 'Apache 2.0'
import calendar
import time
im... |
import sys
def expand(filename):
for dir in ('.', '../common', '../anstests/'):
try:
f = open(dir + "/" + filename)
except IOError:
continue
for line in f:
line = line.replace('\r', '')
if line.strip().startswith('#bye'):
sys.ex... |
from __future__ import absolute_import
import json
import logging
import traceback
from telemetry.internal.backends.chrome_inspector import inspector_websocket
from telemetry.internal.backends.chrome_inspector import websocket
class MemoryTimeoutException(Exception):
pass
class MemoryUnrecoverableException(Exception)... |
from .base import BaseTestCase
from sudo.signals import grant, revoke
from sudo.utils import has_sudo_privileges, grant_sudo_privileges
from django.contrib.auth.models import User
from django.contrib.auth.signals import user_logged_in, user_logged_out
class SignalsTestCase(BaseTestCase):
def test_grant(self):
... |
import roslib
import rospy
from sensor_msgs.msg import Joy
class ButtonTransition(object):
""" monitor button transitions
The transition is measured when read
"""
def __init__(self, val_func, down_val=True, up_val=False):
self._raw_value = val_func
self._down_val = down_val
self.... |
import os
SETTINGS_DIR = 'regions'
DEFAULT_REGION = 'oregon-b'
DEFAULT_ENV = 'dev'
TEMPLATE_DIR = os.path.join(
os.sep,
os.path.dirname(
os.path.realpath(__file__)),
'templates')
SUMO_APP_TEMPLATE = 'sumo-app.yaml.j2'
SUMO_NODEPORT_TEMPLATE = 'sumo-nodeport.yaml.j2' |
from celery import task
from django.core.exceptions import ObjectDoesNotExist
from django.db.models import Count
import mkt
from addons.models import AddonDeviceType as ADT
from mkt.site.utils import chunked
from mkt.site.decorators import write
@task
@write
def _task(**kw):
# Remove any dupes. `UNIQUE` constraint ... |
import logging
import os
import traceback
from chroot_file_system import ChrootFileSystem
from content_provider import ContentProvider
import environment
from extensions_paths import CONTENT_PROVIDERS, LOCAL_DEBUG_DIR
from future import Future
from gitiles_file_system import GitilesFileSystem
from local_file_system imp... |
from __future__ import with_statement
from _weakref import ref
__all__ = ['WeakSet']
__version__ = '1.0.0'
class _IterationGuard(object):
# This context manager registers itself in the current iterators of the
# weak container, such as to delay all removals until the context manager
# exits.
# This tech... |
"""Create files with copyright boilerplate and header include guards.
Usage: tools/boilerplate.py path/to/file.{h,cc}
"""
from datetime import date
import os
import os.path
import sys
LINES = [
'Copyright %d The Chromium Authors. All rights reserved.' %
date.today().year,
'Use of this source code is gov... |
"""
Test that CoreFoundation classes CFGregorianDate and CFRange are not improperly uniqued
"""
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
@skipUnlessDarwin
class Rdar10967107TestCase(TestBase):
mydir = TestBase.compute_mydir(__file_... |
"""
This module implements classes to perform bond valence analyses.
"""
import collections
import numpy as np
import operator
import os
import functools
from math import exp, sqrt
from monty.serialization import loadfn
from pymatgen.core.periodic_table import Element, Specie
from pymatgen.symmetry.analyzer import Spac... |
"""Pylons environment configuration"""
import os
from mako.lookup import TemplateLookup
from pylons import config
import chatapp.lib.app_globals as app_globals
import chatapp.lib.helpers
from chatapp.config.routing import make_map
def load_environment(global_conf, app_conf):
"""Configure the Pylons environment via ... |
"""LaTeX2e document tree Writer."""
__docformat__ = 'reStructuredText'
import sys
import os
import time
import re
import string
import urllib
try:
import roman
except ImportError:
import docutils.utils.roman as roman
from docutils import frontend, nodes, languages, writers, utils, io
from docutils.utils.error_r... |
import deepchem as dc
import numpy as np
def test_inmemory_features():
smiles = ["C", "CC", "CCC", "CCCC"]
featurizer = dc.feat.CircularFingerprint(size=1024)
loader = dc.data.InMemoryLoader(tasks=["task1"], featurizer=featurizer)
dataset = loader.create_dataset(smiles, shard_size=2)
assert len(dataset) == 4
... |
import io
import os
import sys
import time
from IOST_Basic import *
from IOST_Config import *
import gtk
import gobject
import gtk.glade
import vte
try:
IOST_DBG_EN
if IOST_DBG_EN:
IOST_WRunPCIE_DebugEnable =0
else:
IOST_WRunPCIE_DebugEnable =0
... |
class DocumentEntry(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually."""
def __init__(self):
"""
Attributes:
swaggerTypes (dict): The key is attribute name and the value is attribute type.
attributeMap (d... |
mtf_culture_1 = 0x00000001
mtf_culture_2 = 0x00000002
mtf_culture_3 = 0x00000004
mtf_culture_4 = 0x00000008
mtf_culture_5 = 0x00000010
mtf_culture_6 = 0x00000020
mtf_cult... |
"""
Narrative Web index for multi languages
"""
import logging
from gramps.gen.const import GRAMPS_LOCALE as glocale
from gramps.plugins.lib.libhtml import Html
from gramps.plugins.webreport.basepage import BasePage
_ = glocale.translation.sgettext
LOG = logging.getLogger(".multilang")
REDIRECT = """
function lang() {
... |
"""
urlresolver XBMC Addon
Copyright (C) 2011 t0mm0
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
... |
import os
from xml.etree import ElementTree
from distutils.version import LooseVersion
def prairie_imaging_parameters(filepath):
def _get_prairieview_version(xml_filepath):
"""Return Prairieview version number"""
for _, elem in ElementTree.iterparse(xml_filepath, events=("start",)):
if e... |
import time
from ctypes import *
lib = cdll.LoadLibrary("libUSBProxyAPI.so")
def set_config():
# Put in some dummy config so that it works for now
lib.set_config(b"HostProxy", b"HostProxy_GadgetFS");
#lib.set_config("DeviceProxy", "DeviceProxy_LibUSB");
#lib.set_config(b"HostProxy", b"HostProxy_TCP");
#lib.set_con... |
import base64
import connection
class PackageUpload(connection.PackageUpload):
user_agent = "rhnpush"
def set_auth(self, username, password):
auth_vals = self.encode_values([username, password])
self.headers["%s-%s" % (self.header_prefix, "Auth")] = auth_vals
def set_session(self, session_st... |
"""
Module for working with FASTA files
"""
import sys
import os
from itertools import izip
from rasmus import util
from . import seqlib
from seqlib import SeqDict
def removestar(value):
return value.replace("*", "")
def firstword(key):
"""Use the first word as the key"""
return key.split()[0]
class Fas... |
"""Soft assert context manager and assert function
A "soft assert" is an assertion that, if it fails, does not fail the entire test.
Soft assertions can be mixed with normal assertions as needed, and will be automatically
collected/reported after a test runs.
Functionality Overview
----------------------
1. If :py:func... |
from setuptools import setup, find_packages
from turbogears.finddata import find_package_data
import os
execfile(os.path.join("validator", "release.py"))
setup(
name="Validator",
version=version,
# uncomment the following lines if you fill them out in release.py
#description=description,
author=auth... |
import re
from gi.repository import GConf
_DEFAULTS_KEY = '/desktop/sugar/journal/defaults'
_GCONF_INVALID_CHARS = re.compile('[^a-zA-Z0-9-_/.]')
_instance = None
class MimeRegistry(object):
def __init__(self):
# TODO move here all mime_type related code from jarabe modules
self._gconf = GConf.Clien... |
from Carbon import Ctl, Controls
from Carbon import Evt, Qd, Win
import Wbase
class ControlWidget(Wbase.ClickableWidget):
"""Baseclass for all native controls."""
def __init__(self, possize, title = "Control", procID = 0, callback = None, value = 0, min = 0, max = 1, viewsize = 0):
Wbase.ClickableWidget... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.