content stringlengths 4 20k |
|---|
"""
Example command line tool for pairing/unpairing
"""
# python import
import logging
import sys
from typing import Dict, Tuple, List
import queue
from pyzwaver import zmessage
from pyzwaver.command_translator import CommandTranslator
from pyzwaver.node import Nodeset, Node
from pyzwaver import zwave as z
class Fa... |
import json
import os
import unittest
import urllib2
import uuid
import wptserve
from base import TestUsingServer, doc_root
class TestFileHandler(TestUsingServer):
def test_GET(self):
resp = self.request("/document.txt")
self.assertEquals(200, resp.getcode())
self.assertEquals("text/plain"... |
"""Allows the LiteJet lighting system to be controlled by Home Assistant.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/litejet/
"""
import logging
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.helpe... |
from oslo_config import cfg
from nova import exception
from nova.i18n import _
from nova import utils
from nova.virt.libvirt.volume import volume as libvirt_volume
volume_opts = [
cfg.StrOpt('rbd_user',
help='The RADOS client name for accessing rbd volumes'),
cfg.StrOpt('rbd_secret_uuid',
... |
# -*- coding: utf-8 -*-
from Components.Converter.Converter import Converter
from enigma import iServiceInformation, iPlayableService, iPlayableServicePtr, eServiceCenter
from ServiceReference import resolveAlternate
from Components.Element import cached
class ServiceOrbitalPosition(Converter, object):
FULL = 0
SHO... |
from __future__ import absolute_import
from typing import Any, Dict
from zerver.lib.url_preview.parsers.base import BaseParser
class GenericParser(BaseParser):
def extract_data(self):
# type: () -> Dict
return {
'title': self._get_title(),
'description': self._get_descripti... |
# -*- coding: utf-8 -*-
"""
===================================
Demo of DBSCAN clustering algorithm
===================================
Finds core samples of high density and expands clusters from them.
"""
print(__doc__)
import numpy as np
from sklearn.cluster import DBSCAN
from sklearn import metrics
from sklearn... |
# -*- coding: utf-8 -*-
import scrapy
class TableSpider(scrapy.Spider):
name = "table"
allowed_domains = ["https://filippo.io/"]
start_urls = (
'https://filippo.io/linux-syscall-table/',
)
typetable = {
'fd': 'T_INTEGER',
'count': 'T_SIZE_T',
'flags': 'T_INTEGER',
... |
import re
def parse(raw_data, tld_addr):
if tld_addr == "whois.aero":
return aero_parser(raw_data)
elif tld_addr == "whois.iana.org":
return arpa_parser(raw_data)
elif tld_addr == "whois.nic.asia":
return asia_parser(raw_data)
elif tld_addr == "whois.biz":
return biz_par... |
"""
Common stuff.
"""
import traceback
from . import core
from .util import from_
__all__ = ['step', 'Installable', 'Interactive', 'Continuous', 'installer',
'uninstaller']
def step():
def decorator(func):
cls = core.Component(Step)
cls._installer = staticmethod(func)
return ... |
"""engine.SCons.Platform.aix
Platform-specific initialization for IBM AIX systems.
There normally shouldn't be any need to import this module directly. It
will usually be imported through the generic SCons.Platform.Platform()
selection method.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 20... |
"""Tests for the FoldIt module"""
import json
import logging
from functools import partial
from django.test import TestCase
from django.test.client import RequestFactory
from django.core.urlresolvers import reverse
from foldit.views import foldit_ops, verify_code
from foldit.models import PuzzleComplete, Score
from s... |
from common_fixtures import * # NOQA
def test_agent_instance_create(super_client, new_context):
account_id = new_context.project.id
network = create_and_activate(super_client, 'network',
accountId=account_id)
vnet = create_and_activate(super_client, 'vnet',
... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
from ansible.module_utils.basic import AnsibleModule
OPS = ( '=', '-', '+' )
class Capa... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
# ===========================================
# Stackdriver module specific support methods... |
from cgitb import enable
__author__ = 'Cyril'
#!/usr/bin/env python3
"""
Avalam agent.
Copyright (C) 2015, <<<<<<<<<<< YOUR NAMES HERE >>>>>>>>>>>
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; ver... |
"""Platform for the Aladdin Connect cover component."""
import logging
from aladdin_connect import AladdinConnectClient
import voluptuous as vol
from homeassistant.components.cover import (
PLATFORM_SCHEMA,
SUPPORT_CLOSE,
SUPPORT_OPEN,
CoverEntity,
)
from homeassistant.const import (
CONF_PASSWORD... |
import os
import sys
import unittest
import tempfile
from datetime import datetime
try:
from mock import patch, Mock, call
except ImportError:
from unittest.mock import patch, Mock
from aws2fa import AWS2FA
from aws2fa.bin import main
from aws2fa.helpers import ConfigParser
class TestAWS2FA(unittest.TestCas... |
# 各組分別在各自的 .py 程式中建立應用程式 (第1步/總共3步)
from flask import Blueprint, render_template
# 利用 Blueprint建立 ag1, 並且 url 前綴為 /ag1, 並設定 template 存放目錄
ag4_40323109 = Blueprint('ag4_40323109', __name__, url_prefix='/ag4_40323109', template_folder='templates')
# 展示傳回 Brython 程式
@ag4_40323109.route('/4a')
def task1():
outstring... |
from pyasn1.type import constraint
from pyasn1.type import namedtype
from pyasn1.type import tag
from pyasn1.type import univ
class ObjectName(univ.ObjectIdentifier):
pass
class SimpleSyntax(univ.Choice):
componentType = namedtype.NamedTypes(
namedtype.NamedType('number', univ.Integer()),
na... |
import itertools
import os
import sys
from argparse import ArgumentParser
import sqlalchemy as sa
from ..core import app, db
from ..models import Account, SSHKey, GroupMembership
from ..models.sshkey import rewrite_authorized_keys
def main():
arg_parser = ArgumentParser()
arg_parser.add_argument('--delete... |
"""Utilities that help manage directory path in distributed settings.
In multi-worker training, the need to write a file to distributed file
location often requires only one copy done by one worker despite many workers
that are involved in training. The option to only perform saving by chief is
not feasible for a coup... |
from __future__ import absolute_import
import base64
import hashlib
import imp
import os
import re
import shlex
import traceback
import urlparse
from ansible import errors
from ansible import utils
from ansible.callbacks import vvv, vvvv, verbose
from ansible.runner.shell_plugins import powershell
try:
from winrm... |
"""Fichier contenant les aides du scripting."""
syntaxe = r"""Tout script se compose d'instructions, chacune écrite sur une ligne, et
qui sont exécutées au fur et à mesure par le système de scripting. Pour
écrire une instruction, il suffit de l'entrer dans l'éditeur sans la
préfixer d'aucune option.
Il existe trois t... |
#!/usr/bin/python
import sqlite3
import matplotlib.pyplot as plt
import numpy as np
# Connect DB create cursor
connection = sqlite3.connect("Gasmeter.db")
cursor = connection.cursor()
# SQL-Query
sql = """select tstamp,
case cast (strftime('%H', tstamp) as integer)
when 00 then '0'
w... |
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
js_to_json,
unescapeHTML,
ExtractorError,
)
class DVTVIE(InfoExtractor):
IE_NAME = 'dvtv'
IE_DESC = 'http://video.aktualne.cz/'
_VALID_URL = r'http://video\.aktualne\.cz... |
import re
import traceback
from bs4 import BeautifulSoup
import sickbeard
from sickbeard import logger, tvcache
from sickrage.helper.common import convert_size, try_int
from sickrage.providers.torrent.TorrentProvider import TorrentProvider
class LimeTorrentsProvider(TorrentProvider): # pylint: disable=too-many-ins... |
# coding: utf8
"""
webencodings.tests
~~~~~~~~~~~~~~~~~~
A basic test suite for Encoding.
:copyright: Copyright 2012 by Simon Sapin
:license: BSD, see LICENSE for details.
"""
from __future__ import unicode_literals
from . import (lookup, LABELS, decode, encode, iter_decode, iter_encode,
... |
from unittest import TestCase
from minio import xml
from minio.commonconfig import ENABLED, Filter
from minio.lifecycleconfig import Expiration, LifecycleConfig, Rule, Transition
class LifecycleConfigTest(TestCase):
def test_config(self):
config = LifecycleConfig(
[
Rule(
... |
from __future__ import print_function, unicode_literals, division, absolute_import
import os, sys, json, subprocess, pipes
import collections, datetime
import dxpy
from .describe import (get_field_from_jbor, get_job_from_jbor, get_index_from_jbor,
is_job_ref, job_output_to_str, JOB_STATES)
from... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
try:
import boto3
from botocore.exceptions import ClientError
HAS_BOTO3 = True
except ImportError:
HAS_BOTO3 = False
def list_mfa_devices(connection, module):
... |
from django.db import models
from django import forms
class installed(models.Model):
name = models.CharField(max_length=300)
active = models.CharField(max_length=300)
class vectors(models.Model):
name = models.CharField(max_length=300)
active = models.CharField(max_len... |
import sys, os, Ice
ROBOCOMP = ''
try:
ROBOCOMP = os.environ['ROBOCOMP']
except:
print('$ROBOCOMP environment variable not set, using the default value /opt/robocomp')
ROBOCOMP = '/opt/robocomp'
if len(ROBOCOMP)<1:
print('ROBOCOMP environment variable not set! Exiting.')
sys.exit()
additionalPathStr = ''
icePath... |
from twisted.internet.defer import Deferred
from smartanthill.exception import DeviceNotResponding
from smartanthill.network.protocol import ControlMessage
from smartanthill.util import get_service_named, singleton
@singleton
class ZeroVirtualDevice(object):
ID = 0x0
def __init__(self):
self._litem... |
"""
This package contains Docutils Writer modules.
"""
__docformat__ = 'reStructuredText'
import os.path
import docutils
from docutils import languages, Component
from docutils.transforms import universal
class Writer(Component):
"""
Abstract base class for docutils Writers.
Each writer module or pac... |
from web3.formatters import input_filter_params_formatter, log_array_formatter
from web3.utils.events import get_event_data
from web3.utils.filters import construct_event_filter_params
from inspect import getframeinfo, stack
from web3.utils.compat import (
Timeout,
)
class LogHandler:
def __init__(self, web3, ... |
#! /usr/bin/env python3
# main script to run FUCHS
def main(circtools_parser=None):
# required packages
import os
import argparse
import datetime
import time
parser = argparse.ArgumentParser(description='Main script of the FUCHS pipeline.'
'Fo... |
import GithubObject
import NamedUser
class CommitComment(GithubObject.GithubObject):
@property
def body(self):
self._completeIfNotSet(self._body)
return self._NoneIfNotSet(self._body)
@property
def commit_id(self):
self._completeIfNotSet(self._commit_id)
return self._... |
'''
Read-Write for NetCDF,
Based on Scientific.IO
'''
#at some point add in code for gdal layers to make it compatible in qgis
from Scientific.IO import NetCDF
import numpy as np
import osgeo.gdal as gdal
import os
class UnsuportedRasterVariableError(Exception): #note this is in Error checks somewhere
def __init__... |
# encoding: utf-8
from __future__ import unicode_literals
import re
import json
from .common import InfoExtractor
from ..compat import (
compat_urllib_request,
)
from ..utils import (
ExtractorError,
)
class IviIE(InfoExtractor):
IE_DESC = 'ivi.ru'
IE_NAME = 'ivi'
_VALID_URL = r'https?://(?:www\... |
"""
Killer Sudoku in Google CP Solver.
http://en.wikipedia.org/wiki/Killer_Sudoku
'''
Killer sudoku (also killer su doku, sumdoku, sum doku, addoku, or
samunamupure) is a puzzle that combines elements of sudoku and kakuro.
Despite the name, the simpler killer sudokus can be easier to solve
than regular ... |
import logging
import os
import unittest
from telemetry.core import util
from telemetry.core.platform import linux_based_platform_backend
class TestBackend(linux_based_platform_backend.LinuxBasedPlatformBackend):
# pylint: disable=W0223
def __init__(self):
super(TestBackend, self).__init__()
self._mock... |
from openerp import models, api
from .confirminet import Confirminet
class BankingExportCsbWizard(models.TransientModel):
_inherit = 'banking.export.csb.wizard'
@api.model
def _check_company_bank_account(self, payment_order):
"""Don't make this check for Confirminet."""
if not payment_ord... |
# -*- coding: utf-8 -*-
"""
pygments.formatters.latex
~~~~~~~~~~~~~~~~~~~~~~~~~
Formatter for LaTeX fancyvrb output.
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from pygments.formatter import Formatter
from pygments.token import T... |
from boto.exception import BotoServerError
class InvalidRequestException(BotoServerError):
pass
class CloudHsmServiceException(BotoServerError):
pass
class CloudHsmInternalException(BotoServerError):
pass |
"""
Filters that accept a `CommandLineInterface` as argument.
"""
from __future__ import unicode_literals
from .base import Filter
from prompt_toolkit.enums import EditingMode
from prompt_toolkit.key_binding.vi_state import InputMode as ViInputMode
from prompt_toolkit.cache import memoized
__all__ = (
'HasArg',
... |
from __future__ import absolute_import, division, print_function, unicode_literals
import fnmatch
import os
from builtins import object
from collections import defaultdict
from twitter.common.collections import OrderedSet
from pants.util.dirutil import safe_walk
from pants.util.objects import datatype
from pants.uti... |
""" Test script for the Unicode implementation.
Written by Bill Tutt.
Modified for Python 2.0 by Fredrik Lundh (<EMAIL>)
(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
"""#"
import unittest
from test import test_support
class UnicodeNamesTest(unittest.TestCase):
def checkletter(self, name, code):
... |
import functools
import os
from perfkitbenchmarker import flags
from perfkitbenchmarker import vm_util
from perfkitbenchmarker.vm_util import POLL_INTERVAL
FLAGS = flags.FLAGS
flags.DEFINE_string('openstack_auth_url',
os.environ.get('OS_AUTH_URL', 'http://localhost:5000'),
('... |
import time
class TSTCache(dict):
""" TSTCache stands for TimeStamped Test Cache
This class provides an implementation of a dict that only adds values
depending on a test function that should be overriden (always true by
default).
It is timestamped because data is added with a timestamp. When ti... |
"""
======== Offline calculation of grades =============================================================
Computing grades of a large number of students can take a long time. These routines allow grades to
be computed offline, by a batch process (eg cronjob).
The grades are stored in the OfflineComputedGrade table of... |
"""
Helper code to generate SHA1 and SHA256 signatures given a private key.
Expects CWD to be the scripts directory.
"""
import base64
import os
import subprocess
import sys
sys.path += ['../../../../../net/data/verify_certificate_chain_unittest']
import common
def sign_data(key_path, data_to_sign, digest):
"""Re... |
from cStringIO import StringIO
from PIL import Image
from PIL.JpegImagePlugin import JpegImageFile
__author__ = 'dominic'
# A constant for the JPEG image format
_FORMAT_JPEG = JpegImageFile.format
# A list of image formats
_IMAGE_FORMATS = [
_FORMAT_JPEG
]
# A dictionary of known image formats
KNOWN_IMAGE_FORMA... |
""" an XML-RPC server to allow remote control of PyMol
Author: Greg Landrum (<EMAIL>)
Created: January 2002
$LastChangedDate$
License: This file is part of the RDKit. The contents are covered by the terms of
the BSD license which is included in the file license.txt, found at the
... |
import datetime
from oslo.config import cfg
import webob.exc
from nova.api.openstack import extensions
from nova import compute
from nova.i18n import _
from nova import utils
CONF = cfg.CONF
CONF.import_opt('compute_topic', 'nova.compute.rpcapi')
authorize = extensions.extension_authorizer('compute',
... |
import os, inspect
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(os.path.dirname(currentdir))
os.sys.path.insert(0, parentdir)
import math
import gym
import time
from gym import spaces
from gym.utils import seeding
import numpy as np
import pybullet
... |
"""Generator for Clustering
"""
from numpy import matrix
from shogun.Distance import EuclideanDistance
import shogun.Clustering as clustering
from shogun.Library import Math_init_random
import fileop
import featop
import dataop
import category
def _run (name, first_arg):
"""
Run generator for a specific clusteri... |
# -*- coding: utf-8 -*-
# @Author: J. Alejandro Cardona Valdes
"""
Soporte al manejo de errores del Compilador.
Una de las partes mas importantes (y dificiles) de escribir un compilador
es un reporte confiable de mensajes de error al usuario. Este archivo
define una funcionalidad generica para tratar con errores a t... |
"""
.. dialect:: mssql+pyodbc
:name: PyODBC
:dbapi: pyodbc
:connectstring: mssql+pyodbc://<username>:<password>@<dsnname>
:url: http://pypi.python.org/pypi/pyodbc/
Additional Connection Examples
-------------------------------
Examples of pyodbc connection string URLs:
* ``mssql+pyodbc://mydsn`` - co... |
# -*- coding: utf-8 -*-
"""
pygments.formatters.rtf
~~~~~~~~~~~~~~~~~~~~~~~
A formatter that generates RTF files.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from pygments.formatter import Formatter
__all__ = ['RtfFormatter']
... |
from datetime import datetime
from django.conf.urls import patterns, url
from django.contrib.sitemaps import Sitemap, GenericSitemap, FlatPageSitemap, views
from django.contrib.auth.models import User
from django.views.decorators.cache import cache_page
class SimpleSitemap(Sitemap):
changefreq = "never"
priori... |
import os
import re
import pty
import fcntl
import contextlib
import subprocess
import signal
import math
from time import time
from . import basecase
DEFAULT_CQLSH_PROMPT = '\ncqlsh(:\S+)?> '
DEFAULT_CQLSH_TERM = 'xterm'
cqlshlog = basecase.cqlshlog
def set_controlling_pty(master, slave):
os.setsid()
os.clo... |
import glob
import os
import sys
import re
from settings import nodecrypt
from animolite.filetools import decrypt, createandwrite
from animolite.binded import unbind
def dump(gamedir='.'):
running_dir = os.getcwd()
os.chdir(gamedir)
datafiles = glob.glob('data/**', recursive=True)
for filepath in dat... |
import sys
import contextlib
from distutils.errors import DistutilsOptionError
from unittest import TestLoader
from setuptools.extern import six
from setuptools.extern.six.moves import map
from pkg_resources import (resource_listdir, resource_exists, normalize_path,
working_set, _namespace_... |
import functools
import logging
import os
import shlex
import sys
def memoize(default=None):
"""This decorator caches the return value of a parameterless pure function"""
def memoizer(func):
val = []
@functools.wraps(func)
def inner():
if not val:
ret = func()
val.append(ret if r... |
import project |
from django.conf import settings
from django.contrib.contenttypes.fields import GenericForeignKey
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from jsonfield import JSONField
@python_2_unicode_compatible
class Customer (models.Model):
user = models.ForeignKey(settings... |
ANSIBLE_METADATA = {
'status': ['preview'],
'supported_by': 'community',
'metadata_version': '1.0'
}
from ansible.module_utils.f5_utils import (
AnsibleF5Client,
AnsibleF5Parameters,
HAS_F5SDK,
F5ModuleError,
iteritems,
iControlUnexpectedHTTPError
)
from deepdiff import DeepDiff
c... |
from django.core.exceptions import ImproperlyConfigured
from django.test import TestCase
from regressiontests.generic_views.models import Artist, Author, Page
class DetailViewTest(TestCase):
fixtures = ['generic-views-test-data.json']
urls = 'regressiontests.generic_views.urls'
def test_simple_object(se... |
import settings
##########################################################################
# Initialize settings
if not hasattr(settings, 'WIDIDIT_HOSTNAME'):
raise Exception('You must configure WIDIDIT_HOSTNAME in settings.py')
##########################################################################
# Model ut... |
import weakref
import Gaffer
import GafferUI
class SplinePlugValueWidget( GafferUI.PlugValueWidget ) :
def __init__( self, plug, **kw ) :
self.__splineWidget = GafferUI.SplineWidget()
GafferUI.PlugValueWidget.__init__( self, self.__splineWidget, plug, **kw )
self.__splineWidget._qtWidget().setFixedHeight( ... |
import logging
import os
import subprocess
import sys
from telemetry import decorators
from telemetry.core import util
from telemetry.core.platform import platform_backend
from telemetry.core.platform import posix_platform_backend
from telemetry.core.platform import proc_supporting_platform_backend
from telemetry.page... |
"""SCons.Tool.ifort
Tool-specific initialization for newer versions of the Intel Fortran Compiler
for Linux/Windows (and possibly Mac OS X).
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) ... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import ast
import sys
from ansible import constants as C
from ansible.module_utils.six import string_types
from ansible.module_utils.six.moves import builtins
from ansible.plugins.loader import filter_loader, test_loader
def saf... |
#!/usr/bin/env python
'''
A WebSocket server that echos back whatever it receives from the client.
Copyright 2010 Joel Martin
Licensed under LGPL version 3 (see docs/LICENSE.LGPL-3)
You can make a cert/key with openssl using:
openssl req -new -x509 -days 365 -nodes -out self.pem -keyout self.pem
as taken from http://... |
import getpass
import os
import re
import socket
import sys
import urlparse
import xmlrpclib
from rhn import rpclib
from optparse import Option, OptionParser
import gettext
t = gettext.translation('rhn-client-tools', fallback=True)
_ = t.ugettext
_LIBPATH = "/usr/share/rhn"
# add to the path if need be
if _LIBPATH n... |
from __future__ import absolute_import
import logging
from tornado import web
from tornado import gen
from .control import ControlHandler
logger = logging.getLogger(__name__)
class ListWorkers(ControlHandler):
@web.authenticated
@gen.coroutine
def get(self):
"""
List workers
**Example reques... |
"""
WSGI config for archaeobotany project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICAT... |
import fastlmm.inference.lmm_cov as lmm
import numpy as np
import fastlmm.util.stats.chi2mixture as c2
import fastlmm.association as association
import scipy.stats as st
import tests_util as tu
class lrt(association.varcomp_test):
__slots__ = ["lmm","lrt","forcefullrank","nullModel","altModel","G0","K0","__testGca... |
# -*- coding: utf-8 -*-
'''Define model res.partner.relation'''
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2013 Therp BV (<http://therp.nl>).
#
# This program is free software: you can redistribute it a... |
"""Generic testing tools.
Authors
-------
- Fernando Perez <<EMAIL>>
"""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
import os
import re
import sys
import tempfile
import unittest
from contextlib import contextmanager
from io import StringIO
from subprocess ... |
#
# The Python Imaging Library.
# $Id$
#
# MPO file handling
#
# See "Multi-Picture Format" (CIPA DC-007-Translation 2009, Standard of the
# Camera & Imaging Products Association)
#
# The multi-picture object combines multiple JPEG images (with a modified EXIF
# data format) into a single file. While it can theoretical... |
#!/usr/bin/env python
from __future__ import print_function
import sys
import getpass
import datetime
# PyGithub >= 1.13 is required https://pypi.python.org/pypi/PyGithub
from github import Github
from github_issues import GithubIssuesBase, GithubIssues
# You could use OAuth here too for unattended access
# see http... |
from __future__ import print_function
from util import *
import argparse
import sys
cprintconf.name = "One Command"
cprintconf.color = bcolors.PEACH
parser = argparse.ArgumentParser()
parser.add_argument("-m", "--manual", help="Uses manual mode", dest="manual", action="store_true")
parser.add_argument("-i", "--inst... |
"""This module provides a helperclass to transform marked_up messages to plaintext with entities"""
import re
from ptbtest.errors import BadMarkupException
from telegram import MessageEntity
class EntityParser():
"""
Placeholder class for the static parser methods
"""
def __init__(self):
pas... |
import hashlib
from Tkinter import *
import tkFont
from threading import Thread
import time
import tkMessageBox
import os
import myProp
import paths
import sys
from getconf import getconf
import utils
import logging
logger = logging.getLogger()
_clientConfigurationFile = 'client.conf'
_configurationServer = 'https:... |
# -*- coding: utf-8 -*-
from .structures import LookupDict
_codes = {
# Informational.
100: ('continue',),
101: ('switching_protocols',),
102: ('processing',),
103: ('checkpoint',),
122: ('uri_too_long', 'request_uri_too_long'),
200: ('ok', 'okay', 'all_ok', 'all_okay', 'all_good', '\\o/'... |
import webob.dec
from neutron import wsgi
class Fault(webob.exc.HTTPException):
"""Error codes for API faults."""
_fault_names = {
400: "malformedRequest",
401: "unauthorized",
451: "CredentialNotFound",
452: "QoSNotFound",
453: "NovatenantNotFound",
454: "Mul... |
import numpy as np
import logging
log = logging.getLogger('Jacapo')
'''
provides functions to determine if an input parameter has changed.
'''
#######################################################################
#### changed functions
def kpts_changed(calc, x):
'''
check if kpt grid has changed.
we ... |
"""
==============================
Generate simulated evoked data
==============================
"""
# Alexandre Gramfort <<EMAIL>>
#
# License: BSD (3-clause)
import numpy as np
import matplotlib.pyplot as plt
import mne
from mne.datasets import sample
from mne.time_frequency import fit_iir_model_raw
from m... |
#!/usr/bin/env python
### cut a fasta query (arg1) in "nbPart" (arg3)
### subFasta files and launches a blast programm (arg4)
### vs the bank (arg2) for each subfasta and then
### concatenates the tab delimited blast results in
### one file. You can add any additional blastall option in the
### arg5 with quotes like th... |
from datetime import timedelta
from pyromancer import utils
from pyromancer.objects import Timer
example_command = lambda m: m
MESSAGES = [
('Hello world', ('Hello world', [], {})),
(('Hello {}', 'world'), ('Hello {}', ['world'], {})),
(('Hello {} and {}', 'world', 'Mars'),
('Hello {} and {}', ['wor... |
import copy
import datetime
import unittest
from babel.dates import format_datetime, UTC
from babel.messages import catalog
from babel.util import FixedOffsetTimezone
class MessageTestCase(unittest.TestCase):
def test_python_format(self):
assert catalog.PYTHON_FORMAT.search('foo %d bar')
assert ... |
import re
from livestreamer.plugin import Plugin
from livestreamer.plugin.api import http, validate
from livestreamer.stream import RTMPStream
INFO_URL = "http://mvn.vaughnsoft.net/video/edge/{domain}_{channel}"
DOMAIN_MAP = {
"breakers": "btv",
"vapers": "vtv",
"vaughnlive": "live",
}
_url_re = re.comp... |
import unittest
from tangled.web import Application, config
from tangled.web import Resource as BaseResource
from tangled.web.resource.config import Config
class TestConfig(unittest.TestCase):
def setUp(self):
self.app = Application({})
def test_no_args_raises_TypeError(self):
with self.ass... |
from __future__ import absolute_import, unicode_literals
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Permission
from django.core.urlresolvers import reverse
from django.test import TestCase
from django.utils.text import capfirst
from wagtail.contrib.settings.registry import S... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from itertools import chain
from django.utils.itercompat import is_iterable
class Tags(object):
"""
Built-in tags for internal checks.
"""
admin = 'admin'
compatibility = 'compatibility'
models = 'models'
security = 'securit... |
class NoStemmer(Exception):
pass
class NoStopWords(Exception):
pass
# Data and functions for language names
languages = ("ar", "da", "nl", "en", "fi", "fr", "de", "hu", "it", "no", "pt",
"ro", "ru", "es", "sv", "tr")
aliases = {
# By ISO 639-1 three letter codes
"ara": "... |
from oslo_serialization import jsonutils
import six
from nova import objects
from nova import test
from nova.tests.unit.api.openstack import fakes
UUID1 = '00000000-0000-0000-0000-000000000001'
UUID2 = '00000000-0000-0000-0000-000000000002'
UUID3 = '00000000-0000-0000-0000-000000000003'
NW_CACHE = [
{
'ad... |
import os
import tempfile
import shutil
#
# Generate a bootable ISO image.
#
def iso_func(target, source, env):
# Create a temporary directory.
temp = tempfile.mkdtemp()
# Temporary workaround for intel/nuc. Place grub.cfg in /boot/grub.
os.makedirs(temp + '/boot/grub')
# Copy required files to ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.