code stringlengths 1 199k |
|---|
import logging
import tempfile
import csv
import os
import traceback
import time
from airflow.hooks import MemcacheHook
from airflow.models import BaseOperator
from airflow.utils.decorators import apply_defaults
from airflow.hooks import MySqlHook
from airflow.hooks import RedisHook
from airflow.models import Variable
... |
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
from django.db.utils import OperationalError
class Migration(SchemaMigration):
def forwards(self, orm):
try:
db.delete_foreign_key('sentry_eventuser', 'pro... |
from .qt.QtGui import QLabel
from .qt.QtCore import Qt
from ...common.abstract_label import AbstractLabel
from .widget import Widget
horizontal_alignments = {
'left': Qt.AlignLeft,
'center': Qt.AlignCenter,
'right': Qt.AlignRight,
'justify': Qt.AlignJustify,
}
vertical_alignments = {
'top': Qt.Align... |
from setup import *
from pyglet_gui.manager import Manager
from pyglet_gui.document import Document
from pyglet_gui.theme import Theme
theme = Theme({"font": "Lucida Grande",
"font_size": 12,
"text_color": [255, 255, 255, 255],
"gui_color": [64, 64, 64, 255],
... |
import datetime
import csv
import base64
import os
from django import http
from django.contrib.auth.models import User
from django.test import TestCase
from django.conf import settings
from django.utils import simplejson as json
import jflow
def loadtestids(name):
name = os.path.join(os.path.dirname(__file__),name)... |
from __future__ import division, print_function
import os
import sys
import pickle
import copy
import warnings
import platform
import textwrap
from os.path import join
from numpy.distutils import log
from distutils.dep_util import newer
from distutils.sysconfig import get_config_var
from numpy._build_utils.apple_accele... |
import OpenPNM
import OpenPNM.Utilities.vertexops as vo
class DelaunayCubicTest:
def test_simple_cubic(self):
pn = OpenPNM.Network.DelaunayCubic(shape=[3, 3, 3])
pn.add_boundaries()
B1 = pn.pores("top_boundary")
B2 = pn.pores("bottom_boundary")
assert vo.vertex_dimension(pn, ... |
import numpy as np
import pycuda.driver as drv
from neon.backends.nervanagpu import NervanaGPU
from openai_gemm import matmul_test
ng = NervanaGPU()
print drv.Context.get_current().get_device().name()
ones = 0
out = 0
small_1 = (1,2,3,4,5,6,7,8,9,16,32,64,65,72,120,127,128,192)
medium_1 = (32,64,128,192,778,785,786,7... |
"""
Run all doctests in web.py modules
"""
import webtest
def suite():
modules = [
"webmod.utils",
]
return webtest.doctest_suite(modules)
if __name__ == "__main__":
webtest.main() |
from distutils.core import setup
from setuptools import find_packages
setup(
name='pylibui',
version='0.0.1',
description='Python wrapper for libui',
packages=find_packages()
) |
from swgpy.object import *
def create(kernel):
result = Creature()
result.template = "object/mobile/shared_dressed_sith_shadow_zab_f_nco.iff"
result.attribute_template_id = 9
result.stfName("npc_name","zabrak_base_female")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return result |
"""This is an alternative to python_reader which tries to emulate
the CPython prompt as closely as possible, with the exception of
allowing multiline input and multiline history entries.
"""
import sys
from pyrepl.readline import multiline_input, _error, _get_reader
def check(): # returns False if there is a proble... |
import functools
import json
from shelf.error_code import ErrorCode
from shelf.get_container import get_container
import shelf.response_map as response_map
from jsonschema import ValidationError
from fuzzywuzzy import fuzz
from copy import deepcopy
"""
This module contains decorator functions that are commonly
... |
from __future__ import print_function, division, absolute_import, unicode_literals
from ..common import sliding_window
from . import hd44780_a00, hd44780_a02
CR = -1
LF = -2
class FoundMultiCharMapping(Exception):
"""
Exception to escape nested loops.
"""
pass
class Codec(object):
def __init__(self,... |
from apiwrapper.endpoints.endpoint import Endpoint
from apiwrapper.endpoints.monetary_account import MonetaryAccount
class MasterCardAction(Endpoint):
__endpoint_mastercard_action = "mastercard-action"
@classmethod
def _get_base_endpoint(cls, user_id, account_id, action_id=None):
endpoint = Monetary... |
from django.conf.urls import include, url
from django.core.urlresolvers import reverse_lazy
from django.views.generic import RedirectView
urlpatterns = [
# Redirect the base URL to the dashboard.
url(r'^$', RedirectView.as_view(url=reverse_lazy('dashboard'))),
url('', include('timepiece.crm.urls')),
url... |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
import logging
import os
from flexget import plugin
from flexget.event import event
log = logging.getLogger('proxy')
PROTOCOLS = ['http', 'https', 'ftp', 'socks5', 'socks5h'... |
"""Base class for RPC testing."""
import configparser
from enum import Enum
import logging
import argparse
import os
import pdb
import shutil
import sys
import tempfile
import time
from .authproxy import JSONRPCException
from . import coverage
from .test_node import TestNode
from .mininode import NetworkThread
from .ut... |
import numpy as np
import warnings
from cymodules import _fast_gte
def fast_gte(x, y, markov_order=2, nlevels=None, valid=None, y_offset=1,
norm=True, return_pdf=False):
"""
Compute the Generalized Transfer Entropy for a pair of signals
Arguments:
-----------
x, y: uint8 arrays
... |
from setuptools import setup, find_packages
NAME = "autorestdurationtestservice"
VERSION = "1.0.0"
REQUIRES = ["msrest>=0.1.0", "msrestazure>=0.1.0"]
setup(
name=NAME,
version=VERSION,
description="AutoRestDurationTestService",
author_email="",
url="",
keywords=["Swagger", "AutoRestDurationTestS... |
from django.conf.urls import patterns, include, url
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'social_auth_demo.views.home', name='home'),
# url(r'^social_auth_demo/', include('social_auth_demo.foo.urls')),
# Uncomment the admin/doc line below to enable admin documentation:
# url(r'^admin/... |
from mcturtle import minecraftturtle
from mcpi import minecraft
mc = minecraft.Minecraft.create()
pos = mc.player.getPos()
steve = minecraftturtle.MinecraftTurtle(mc, pos)
steve.speed(10)
steve.forward(10)
steve.right(90)
steve.forward(10)
steve.right(90)
steve.forward(10)
steve.right(90)
steve.forward(10)
steve.walk()... |
import unittest
from word_count import count_words
class WordCountTest(unittest.TestCase):
def test_count_one_word(self):
self.assertEqual(count_words("word"), {"word": 1})
def test_count_one_of_each_word(self):
self.assertEqual(count_words("one of each"), {"one": 1, "of": 1, "each": 1})
def... |
import setuptools # noqa
from setuptools import Extension
def count_down_delay(delay):
from time import sleep
import sys
while delay:
sys.stdout.write("Continuing in %d seconds... \r" % delay)
sys.stdout.flush()
delay -= 1
sleep(1)
print("")
DASH_SEPARATOR = 75 * "-"
d... |
import types
import datetime
from decimal import Decimal
class DjangoUnicodeDecodeError(UnicodeDecodeError):
def __init__(self, obj, *args):
self.obj = obj
UnicodeDecodeError.__init__(self, *args)
def __str__(self):
original = UnicodeDecodeError.__str__(self)
return '%s. You pass... |
from flappy.geom import Rectangle
from flappy.display import DisplayObjectContainer
class Sprite(DisplayObjectContainer):
def __init__(self, name=None):
DisplayObjectContainer.__init__(self, name)
def startDrag(self, lock_center=False, bounds=None):
if self.stage:
self.stage._start_d... |
"""
This module handles txtorcon debug messages.
"""
from twisted.python import log as twlog
__all__ = ['txtorlog']
txtorlog = twlog.LogPublisher()
def debug_logging():
stdobserver = twlog.PythonLoggingObserver('txtorcon')
fileobserver = twlog.FileLogObserver(open('txtorcon.log', 'w'))
txtorlog.addObserver(... |
from django.db import migrations, models
import waldur_core.media.models
class Migration(migrations.Migration):
dependencies = [
('marketplace', '0056_offering_divisions'),
]
operations = [
migrations.AddField(
model_name='serviceprovider',
name='image',
f... |
print(texto.replace('caixa 1 ', 'pacote 2 ')) |
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import sys
import unittest
import SCons.Errors
import SCons.Node.Python
class ValueTestCase(unittest.TestCase):
def test_Value(self):
"""Test creating a Value() object
"""
v1 = SCons.Node.Python.Value('a')
assert v1.value ... |
from __future__ import unicode_literals
from flask import session
from indico.modules.designer.models.templates import DesignerTemplate
from indico.modules.events import EventLogKind, EventLogRealm
def update_template(template, title, data, is_clonable, backside_template_id=None, clear_background=False):
"""Update ... |
import json
import os
import unittest2
from google.appengine.ext import ndb
from google.appengine.ext import testbed
from helpers.location_helper import LocationHelper
from models.event import Event
from models.sitevar import Sitevar
from models.team import Team
class TestLocationHelper(unittest2.TestCase):
def set... |
"""
HTTP middleware for the Deis REST API.
See https://docs.djangoproject.com/en/1.6/topics/http/middleware/
"""
import json
from django.http import HttpResponse
from rest_framework import status
from api import __version__
class APIVersionMiddleware(object):
"""
Return an error if a client request is incompati... |
"""Zygomatic has a number of online gaming portals that all
seem to use the same platform. This module contains an asbstract
base class which will crawl sites generated by this platform.
"""
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdri... |
import unittest
from .unionfind import UnionFind
class UnionFindTests(unittest.TestCase):
def setUp(self):
self.nodes = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h']
self.U = UnionFind(self.nodes)
def test_find_pre_union(self):
self.assertEqual(self.U.find('a'), 'a')
def test_single_union... |
from django.db import IntegrityError
from rest_framework import test
from . import factories
class UniquePropertiesTest(test.APITransactionTestCase):
def test_unable_to_create_properties_with_duplicate_backend_id(self):
property_factories = (
factories.ImageFactory,
factories.RegionF... |
import redis
from rq.queue import Queue
from urlparse import urlparse
from biicode.server.background.model.priority import Priority
from biicode.common.utils.bii_logging import logger
import traceback
from redis.exceptions import ConnectionError
from biicode.server.conf import BII_ANALYTIC_REDIS_URL, BII_LOG_TO_REDIS
r... |
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 field 'ProgramInfo.created'
db.add_column(u'director_programinfo', 'created',
self.gf('django.db.models.... |
import unittest
import numpy as np
from chainer import testing
from chainer_tests.dataset_tests.tabular_tests import dummy_dataset
@testing.parameterize(*testing.product({
'mode': [tuple, dict],
'return_array': [True, False],
}))
class TestTabularDataset(unittest.TestCase):
def test_fetch(self):
def... |
class RedisError(Exception):
pass
class AuthenticationError(RedisError):
pass
class CommandError(RedisError):
pass
class ProtocolError(RedisError):
pass
class ServerError(RedisError):
pass
class CannotConnectError(RedisError):
pass
class ConnectionError(ServerError):
pass
class TimeoutError(... |
from swgpy.object import *
def create(kernel):
result = Creature()
result.template = "object/mobile/tatooine_npc/shared_brea_tonnika.iff"
result.attribute_template_id = 9
result.stfName("npc_name","human_base_female")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return result |
import imp
from django.core.management import execute_manager
import sys
import os
sys.path.insert(0, os.path.abspath('../..'))
try:
imp.find_module('settings') # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory c... |
from __future__ import unicode_literals
import frappe
import os, json
from frappe import _
from frappe.modules import scrub, get_module_path
from frappe.utils import flt, cint, get_html_format, cstr
from frappe.model.utils import render_include
from frappe.translate import send_translations
import frappe.desk.reportvie... |
from __future__ import print_function
from twisted.spread import pb
from twisted.internet import reactor
def main():
factory = pb.PBClientFactory()
reactor.connectTCP("localhost", 8800, factory)
d = factory.getRootObject()
d.addCallbacks(got_obj)
reactor.run()
def got_obj(obj):
# change "broken"... |
from msrest.paging import Paged
class LoadBalancerPaged(Paged):
"""
A paging container for iterating over a list of :class:`LoadBalancer <azure.mgmt.network.v2017_06_01.models.LoadBalancer>` object
"""
_attribute_map = {
'next_link': {'key': 'nextLink', 'type': 'str'},
'current_page': {'... |
from __future__ import unicode_literals
from django.db import migrations, models
import wagtail.core.blocks
import wagtail.core.fields
import wagtail.images.blocks
class Migration(migrations.Migration):
dependencies = [
('pages', '0019_auto_20171102_1856'),
]
operations = [
migrations.AlterF... |
from openturns import *
TESTPREAMBLE()
try:
charlier = CharlierFactory(2.5)
print "charlier=", charlier
for i in range(10):
print "charlier(", i, ")=", charlier.build(i)
roots = charlier.getRoots(10)
print "charlier(10) roots=", repr(roots)
nodes, weights = charlier.getNodesAndWeights(10... |
import ssl
import time
import typing
import pytest
from OpenSSL import SSL
from mitmproxy import connection
from mitmproxy.connection import ConnectionState, Server
from mitmproxy.proxy import commands, context, events, layer
from mitmproxy.proxy.layers import tls
from mitmproxy.tls import ClientHelloData, TlsData
from... |
dump_block_on_failed_verification = False
import time
from itertools import count
import sys
import rlp
from rlp.sedes import big_endian_int, Binary, binary, CountableList
from rlp.utils import decode_hex, encode_hex
from ethereum import pruning_trie as trie
from ethereum.pruning_trie import Trie
from ethereum.securetr... |
from netforce.model import Model,fields,get_model
from netforce import access
import time
class Route(Model):
_name="delivery.route"
_string="Route"
_name_field="number"
_fields={
"number": fields.Char("Number",required=True,search=True),
"date": fields.Date("Date",required=True,search=T... |
class Solution:
# @param {character[][]} board
# @param {string[]} words
# @return {string[]}
def findWords(self, board, words):
trie = {}
for word in words:
t = trie
for c in word:
if c not in t:
t[c] = {}
t = t... |
"""
(c) 2013 LinkedIn Corp. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");?you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,... |
import re
def match(command, settings):
return ('rm' in command.script
and 'is a directory' in command.stderr)
def get_new_command(command, settings):
return re.sub('^rm (.*)', 'rm -rf \\1', command.script) |
import hashlib
def create_md5(filename):
with open(filename, 'rb') as f:
return str(hashlib.md5(f.read()).hexdigest()) |
from portage.tests import TestCase
from portage.tests.resolver.ResolverPlayground import (ResolverPlayground,
ResolverPlaygroundTestCase)
class SlotAbiTestCase(TestCase):
def __init__(self, *args, **kwargs):
super(SlotAbiTestCase, self).__init__(*args, **kwargs)
def testSubSlot(self):
ebuilds = {
"dev-libs/ic... |
ilcsoft_release='hps_v01-00-02'
ilcsoft_install_prefix = "/u1/projects/slic/"
CMake_version = "2.8.12.2"
ILCUTIL_version = "v01-00"
XercesC_version = "3.1.1"
LCIO_version = "v02-04-03"
Geant4_version = "9.6.p01"
HepPDT_version = "3.04.01"
GDML_version = "v03-01-01"
LCDD_version = "v03-03-04"
SLIC_version = "v03-01-05" |
"""RemoteTransport client for the smart-server.
This module shouldn't be accessed directly. The classes defined here should be
imported from bzrlib.smart.
"""
from __future__ import absolute_import
__all__ = ['RemoteTransport', 'RemoteTCPTransport', 'RemoteSSHTransport']
from cStringIO import StringIO
from bzrlib impo... |
import os
import sys
import urlparse
import xbmc
import xbmcaddon
import xbmcgui
addon_ = xbmcaddon.Addon(id='plugin.video.emby')
addon_path = addon_.getAddonInfo('path').decode('utf-8')
base_resource = xbmc.translatePath(os.path.join(addon_path, 'resources', 'lib')).decode('utf-8')
sys.path.append(base_resource)
impor... |
import os
import gettext
from parted import PARTITION_RAID
__trans = gettext.translation('yali', fallback=True)
_ = __trans.ugettext
from yali.storage.library import raid
from yali.storage.formats import Format, FormatError, register_device_format
class RaidMemberError(FormatError):
pass
class RaidMember(Format):
... |
_continue = [
"16 16 4 1",
" c None",
". c #68BD68",
"+ c #7C7C7C",
"@ c #323232",
" ",
" .......... ",
" +..........+ ",
" .............. ",
" .............. ",
" ......@....... ",
" ......@....... ",
" .............. ",
" .............. ",
" ......@....... ",
" ......@....... ",
" ................. |
import mock
from stoq.gui.launcher import LauncherApp, COL_APP
from stoq.gui.test.baseguitest import BaseGUITest
class TestLauncher(BaseGUITest):
def test_initial(self):
app = self.create_app(LauncherApp, u'launcher')
self.check_app(app, u'launcher')
def test_open_admin(self):
self._test... |
import xbmcaddon,xbmcplugin,xbmcgui,urllib,sys,re,os
addon = xbmcaddon.Addon()
pluginhandle = int(sys.argv[1])
addonID = addon.getAddonInfo('id')
iconTivi=xbmc.translatePath('special://home/addons/'+addonID+'/iconTivi.png')
iconKIKA=xbmc.translatePath('special://home/addons/'+addonID+'/iconKIKA.png')
iconNick=xbmc.tran... |
'''
Genesis Add-on
Copyright (C) 2015 lambda
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 pr... |
__revision__ = "$Id$"
__lastupdated__ = "$Date$"
import sys
from invenio import webstat
from invenio.dbquery import run_sql
from invenio.bibtask import task_init, task_get_option, task_set_option, \
task_has_option, task_update_progress, write_message
from invenio.webstat_config import CFG_W... |
"""Utility methods."""
from twisted.internet import protocol, reactor, defer
from twisted.python import failure
try:
import cStringIO as StringIO
except ImportError:
import StringIO
def _callProtocolWithDeferred(protocol, executable, args, env, path, reactor):
d = defer.Deferred()
p = protocol(d)
re... |
import ConfigParser
import errno
from text import *
from util import *
cf = ConfigParser.ConfigParser()
cf.read(GetINIfile())
CLIMATE_DATA_DIR = None
SPATIAL_DATA_DIR = None
BMP_DATA_DIR = None
MEASUREMENT_DATA_DIR = None
if 'PATH' in cf.sections():
BASE_DATA_DIR = cf.get('PATH', 'BASE_DATA_DIR'.lower())
CLIMAT... |
"""
EasyBuild support for Armadillo, implemented as an easyblock
@author: Kenneth Hoste (Ghent University)
"""
import os
from easybuild.easyblocks.generic.cmakemake import CMakeMake
from easybuild.tools.build_log import EasyBuildError
from easybuild.tools.modules import get_software_root
from easybuild.tools.systemtool... |
import bpy
def api_dump(use_properties=True, use_functions=True):
def prop_type(prop):
if prop.type == "pointer":
return prop.fixed_type.identifier
else:
return prop.type
def func_to_str(struct_id_str, func_id, func):
args = []
for prop in func.args:
... |
"""
EasyBuild support for building and installing Cufflinks, implemented as an easyblock
@author: Cedric Laczny (Uni.Lu)
@author: Fotis Georgatos (Uni.Lu)
@author: Kenneth Hoste (Ghent University)
"""
import fileinput
import glob
import re
import os
import sys
from easybuild.easyblocks.generic.configuremake import Conf... |
import threading
import time
class Timer( threading.Thread ):
def __init__( self, count, orgCount, stop ):
threading.Thread.__init__( self )
self.count = count
self.orgCount = orgCount
self.stop = stop
def reset( self ):
self.count = self.orgCount
print( "Timer restored" )
def run( self ):... |
from sqlalchemy.types import SchemaType, TypeDecorator, Enum
import re
class EnumSymbol(object):
"""Define a fixed symbol tied to a parent class."""
def __init__(self, cls_, name, value, **kwargs):
self.cls_ = cls_
self.name = name # in Python land
self.value = value # in DB land
... |
import os
import os.path as path
import re
import itertools
def get_rulelist(file):
rules = []
with open(file, 'r') as f:
for line in f.readlines():
if line.startswith('RULE:'):
rule = re.split('[\s]+', line.strip())[2:]
rules.append(tuple(map(int, rule)))
... |
from __future__ import unicode_literals
from indico.modules.events.requests.controllers import (RHRequestsEventRequests, RHRequestsEventRequestDetails,
RHRequestsEventRequestWithdraw, RHRequestsEventRequestProcess)
from indico.web.flask.wrappers import IndicoBluep... |
from __future__ import (unicode_literals, division, absolute_import,
print_function)
__license__ = 'GPL v3'
__copyright__ = '2012, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
import re
from functools import partial
from PyQt5.Qt import (
QStandardItem, QStanda... |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import datetime
import itertools
from .. import feed
from .. import TimeFrame
from ..utils import date2num
class VChartCSVData(feed.CSVDataBase):
vctframes = dict(
I=TimeFrame.Minutes,
D=Time... |
from enum import IntEnum, unique
from time import time
from logbook import Logger
VALIDITY = 24 * 60 * 60 # Price validity period, 24 hours
REREQUEST = 4 * 60 * 60 # Re-request delay for failed fetches, 4 hours
TIMEOUT = 15 * 60 # Network timeout delay for connection issues, 15 minutes
pyfalog = Logger(__name__)
@un... |
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
"""
Use the Model.save() methods to add `study` and `experiment` foreign keys
from existing FKs ... |
import os
import sys
import time
import traceback
import struct
import binascii
import base64
import ctypes
import socket
import ConfigParser
try:
import argparse
except:
print "[-] please make sure python's argparse module is available\n%s" % repr(sys.exc_info())
sys.exit(0)
import idaapi
import idautils
f... |
from __future__ import absolute_import
from PyQt4.QtGui import QWidget
from PyQt4.QtGui import QToolBar
from PyQt4.QtGui import QPushButton
from PyQt4.QtGui import QIcon
from PyQt4.QtGui import QStyle
from PyQt4.QtGui import QStackedWidget
from PyQt4.QtGui import QHBoxLayout
from PyQt4.QtGui import QVBoxLayout
from PyQ... |
import os
import sys
import multiprocessing as mp
import math
import logging
from checkm.defaultValues import DefaultValues
from checkm.util.seqUtils import readFasta, baseCount, calculateN50
from checkm.common import binIdFromFilename, makeSurePathExists
from checkm.prodigal import ProdigalGeneFeatureParser
from numpy... |
import pytest
from abjad import *
def test_scoretools_FixedDurationTuplet_trim_01():
tuplet = scoretools.FixedDurationTuplet(Duration(2, 4), "c'8 d'8 e'8")
tuplet.trim(0)
assert systemtools.TestManager.compare(
tuplet,
r'''
\tweak #'text #tuplet-number::calc-fraction-text
\tw... |
import os
import collections
import re
import libcalamares
import configparser
DesktopEnvironment = collections.namedtuple(
'DesktopEnvironment', ['executable', 'desktop_file']
)
desktop_environments = [
DesktopEnvironment('/usr/bin/startkde', 'plasma'), # KDE Plasma 5
DesktopEnvironment('/usr/bin/star... |
from microscope.cameras import _SDK3 as SDK3
class ATProperty:
def connect(self, handle, propertyName):
self.handle = handle
self.propertyName = propertyName
def isImplemented(self):
return SDK3.IsImplemented(self.handle, self.propertyName).value
def isReadable(self):
return ... |
"""
kallithea.lib.annotate
~~~~~~~~~~~~~~~~~~~~~~
Annotation library for usage in Kallithea, previously part of vcs
This file was forked by the Kallithea project in July 2014.
Original author and date, and relevant copyright and licensing information is below:
:created_on: Dec 4, 2011
:author: marcink
:copyright: (c) 2... |
import os
import unittest
import HPOlibConfigSpace
import HPOlibConfigSpace.converters.pcs_parser as pcs_parser
from HPOlibConfigSpace.random_sampler import RandomSampler
class TestPCSConverterOnMiniAutoSklearn(unittest.TestCase):
# TODO test the other formats once they are ready!
def test_read_and_write_pcs(se... |
import sqlalchemy as sa
from niamoto.data_marts.dimensions.base_dimension import BaseDimension
from niamoto.data_publishers.raster_data_publisher import \
RasterValueCountPublisher
class RasterDimension(BaseDimension):
"""
Dimension extracted from a registered raster, contains the different
values of a ... |
import os
import random
from nupic.frameworks.prediction.helpers import (updateConfigFromSubConfig,
getSubExpDir)
from nupic.encoders import (LogEncoder,
DateEncoder,
Mult... |
LEFT = 0
RIGHT = 1
ops = [None, '+', '-', '*', '/', '^']
ZP = [0, 1, 3, 4, 2, 5]
ZA = [LEFT, LEFT, LEFT, LEFT, LEFT, RIGHT]
EP = [0, 4, 4, 2, 2, 1]
EA = [LEFT, LEFT, LEFT, LEFT, LEFT, RIGHT]
def isOp(e):
return e in ops
def prec(o1, o2, base):
o1, o2 = ops.index(o1), ops.index(o2)
if base:
o1, o2 = ZP[o1], ZP[o2]
... |
from gi.repository import Peas
from gi.repository import Gtk
from gi.repository import Totem
from gi.repository import Gio
from gi.repository import GObject
import mpdserver
class Pause(mpdserver.Pause):
def handle_pause(self):
print "Pause catched"
self.player.action_play_pause()
class MpdServerPlugin(GObject.Obj... |
"""
This provides handlers for specially formatted configuration files. Entries are
expected to consist of simple key/value pairs, and anything after "#" is
stripped as a comment. Excess whitespace is trimmed and empty lines are
ignored. For instance:
user.name Galen
user.password yabba1234 # here's an inline comment
u... |
"""Displays statistics and plots graphs from RTC protobuf dump."""
from __future__ import division
from __future__ import print_function
import collections
import sys
import matplotlib.pyplot as plt
import numpy
import misc
import pb_parse
class RTPStatistics(object):
"""Has methods for calculating and plotting RTP s... |
import os
EXE = __file__
EXEDIR = os.path.dirname(EXE)
PREFIX = os.path.normpath(os.path.join(EXEDIR, ".."))
BINDIR = os.path.join(PREFIX, "bin")
SBINDIR = os.path.join(PREFIX, "sbin")
DATADIR = os.path.join(PREFIX, "share")
LIBDIR = os.path.join(PREFIX, "lib")
LIBEXECDIR = os.path.join(PREFIX, "libexec")
ETCDIR = os.p... |
from __future__ import (unicode_literals, division, absolute_import,
print_function)
__license__ = 'GPL v3'
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
import os, sys, shutil
from lxml import etree
from calibre import walk, guess_type
from calibre.ebooks.metadata import string_... |
import urllib.request, urllib.error, urllib.parse
LOGIN = 'wesley'
PASSWD = "you'llNeverGuess"
URL = 'http://localhost'
REALM = 'Secure Archive'
def handler_version(url):
hdlr = urllib.request.HTTPBasicAuthHandler()
hdlr.add_password(REALM,
urllib.parse.urlparse(url)[1], LOGIN, PASSWD)
opener = urll... |
type = "passive"
def handler(fit, module, context):
module.boostItemAttr("explosionDelayBonus", module.getModifiedChargeAttr("explosionDelayBonusBonus")) |
""" Git cache manager """
from __future__ import print_function
import os
from six import iteritems
from pybombs import pb_logging
from pybombs.utils import sysutils
from pybombs.utils import subproc
class GitCacheManager(object):
" Git cache manager "
def __init__(self, path):
self.path = path
... |
import os
import sys
if os.path.exists(os.path.expanduser('~/plutokore')):
sys.path.append(os.path.expanduser('~/plutokore'))
else:
sys.path.append(os.path.expanduser('~/uni/plutokore'))
import plutokore as pk
import matplotlib as mpl
mpl.use('PS')
import matplotlib.pyplot as plot
import numpy as np
import argp... |
import os.path
import decisionlib
from decisionlib import CONFIG, SHARED
def main(task_for):
if CONFIG.git_ref.startswith("refs/heads/"):
branch = CONFIG.git_ref[len("refs/heads/"):]
CONFIG.treeherder_repository_name = "servo-" + (
branch if not branch.startswith("try-") else "try"
... |
from django.conf import settings
import jinja2
from django.template.loader import render_to_string
from django_jinja import library
from bedrock.firefox.firefox_details import firefox_desktop, firefox_android, firefox_ios
from bedrock.base.urlresolvers import reverse
from lib.l10n_utils import get_locale
def desktop_bu... |
import os
import setuptools
here = os.path.dirname(__file__)
with open(os.path.join(here, 'please_cli', 'VERSION')) as f:
version = f.read().strip()
def read_requirements(file_):
lines = []
with open(file_) as f:
for line in f.readlines():
line = line.strip()
if line.startswi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.