content string |
|---|
__all__ = ["send",
"track_send_item",
"send_shipment",
"receive",
"track_recv_item",
"recv_shipment",
"recv_sent_shipment",
"send_rec",
"send_get_id",
"send_get_ref",
"recv_rec",
"recv_get_id",
... |
from __future__ import absolute_import
from __future__ import unicode_literals
from django import forms
from shipping.models import AppVersion
class ModelInstanceField(forms.fields.Field):
def __init__(self, model, key='pk', *args, **kwargs):
self.model = model
self.key = key
self._insta... |
__title__="FreeCAD OpenSCAD Workbench - 2D helper fuctions"
__author__ = "Sebastian Hoogen"
__url__ = ["http://www.freecadweb.org"]
'''
This Script includes python functions to find out the most basic shape type
in a compound and to change the color of shapes according to their shape type
'''
import FreeCAD
def shape... |
# $language = "python"
# $interface = "1.0"
import os
import sys
import logging
# Add script directory to the PYTHONPATH so we can import our modules (only if run from SecureCRT)
if 'crt' in globals():
script_dir, script_name = os.path.split(crt.ScriptFullName)
if script_dir not in sys.path:
sys.path.... |
from vtk import *
source = vtkRandomGraphSource()
source.SetNumberOfVertices(200)
source.SetEdgeProbability(0.01)
source.SetUseEdgeProbability(True)
source.SetStartWithTree(True)
source.IncludeEdgeWeightsOn()
source.AllowParallelEdgesOn()
# Connect to the vtkVertexDegree filter.
degree_filter = vtkVertexDegree()
degr... |
from collections import defaultdict
from dbworker import DBWorker
class Groups(DBWorker):
"""Groups are named collections of members, belonging to an owner."""
def __init__(self, **params):
DBWorker.__init__(self, **params)
execute = self.execute
execute(""" create table if not exis... |
from supybot.test import *
import supybot.irclib as irclib
import supybot.plugins as plugins |
#!/usr/bin/python -u
#
# this tests the entities substitutions with the XmlTextReader interface
#
import sys
import libxml2
try:
import StringIO
str_io = StringIO.StringIO
except:
import io
str_io = io.StringIO
docstr="""<?xml version='1.0'?>
<!DOCTYPE doc [
<!ENTITY tst "<p>test</p>">
]>
<doc>&tst;</d... |
import ansible.constants as C
from ansible.inventory.host import Host
from ansible.inventory.group import Group
from ansible import errors
from ansible import utils
import os
import yaml
import sys
class InventoryParserYaml(object):
''' Host inventory parser for ansible '''
def __init__(self, filename=C.DEFAU... |
import sys
import json
import unittest
from datetime import datetime
sys.path.insert(0, ".")
from coalib.output.JSONEncoder import JSONEncoder
class TestClass1(object):
def __init__(self):
self.a = 0
class TestClass2(object):
def __init__(self):
self.a = 0
self.b = TestClass1()
cl... |
import time
from electrum.i18n import _
from electrum.util import PrintError, UserCancelled
from electrum.wallet import BIP44_Wallet
class GuiMixin(object):
# Requires: self.proto, self.device
messages = {
3: _("Confirm the transaction output on your %s device"),
4: _("Confirm internal entro... |
Latin5_BulgarianCharToOrderMap = (
255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, # 00
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 10
253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, # 20
252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, # 30
2... |
#: E261:1:5
pass # an inline comment
#: E262:1:12
x = x + 1 #Increment x
#: E262:1:12
x = x + 1 # Increment x
#: E262:1:12
x = y + 1 #: Increment x
#: E265:1:1
#Block comment
a = 1
#: E265:2:1
m = 42
#! This is important
mx = 42 - 42
#: E266:3:5 E266:6:5
def how_it_feel(r):
### This is a variable ###
a = ... |
"""Fixer for callable().
This converts callable(obj) into isinstance(obj, collections.Callable), adding a
collections import if needed."""
# Local imports
from lib2to3 import fixer_base
from lib2to3.fixer_util import Call, Name, String, Attr, touch_import
class FixCallable(fixer_base.BaseFix):
BM_compatible = Tr... |
#!/usr/bin/python
import sys
import os
import glob
import os.path
from subprocess import call, PIPE
import unittest
stdout = os.open("/dev/null",0) #sys.stdout
stderr = os.open("/dev/null",0) # sys.stderr
apt_args = [] # ["-o","Debug::pkgAcquire::Auth=true"]
class testAuthentication(unittest.TestCase):
"""
... |
"""Identify approved and open patches, that are probably just trivial rebases.
Prints out list of approved patches that failed to merge and are currently
still open. Only show patches that are likely to be trivial rebases.
"""
import getpass
import optparse
import sys
from reviewstats import utils
def main(argv=No... |
"""
HTTP BASIC authentication.
@see: U{http://tools.ietf.org/html/rfc1945}
@see: U{http://tools.ietf.org/html/rfc2616}
@see: U{http://tools.ietf.org/html/rfc2617}
"""
import binascii
from zope.interface import implements
from twisted.cred import credentials, error
from twisted.web.iweb import ICredentialFactory
c... |
r"""
============================================
plots - Plotting tools (:mod:`pyemma.plots`)
============================================
.. currentmodule:: pyemma.plots
User-API
========
**Graph plots**
.. autosummary::
:toctree: generated/
plot_implied_timescales
plot_cktest
**Contour plots**
.. au... |
"""
Python package for automating GUI manipulation on Windows
"""
__revision__ = "$Revision$"
__version__ = "0.4.2"
import findwindows
WindowAmbiguousError = findwindows.WindowAmbiguousError
WindowNotFoundError = findwindows.WindowNotFoundError
import findbestmatch
MatchError = findbestmatch.MatchError
... |
# csvBuild from Adventure 6.
# import required modules
import mcpi.minecraft as minecraft
import mcpi.block as block
# connect to minecraft
mc = minecraft.Minecraft.create()
# define some constants
GAP = block.AIR.id
WALL = block.GOLD_BLOCK.id
FLOOR = block.GRASS.id
# Open the file containing maze data
FILENAME = "... |
import sale_margin
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
from openerp.addons.web.http import request
from openerp.osv import osv
class Report(osv.Model):
_inherit = 'report'
def translate_doc(self, cr, uid, doc_id, model, lang_field, template, values, context=None):
if request and hasattr(request, 'website'):
if request.website is not None:
... |
from .mininode import *
from io import BytesIO
import dbm.dumb as dbmd
class BlockStore(object):
def __init__(self, datadir):
self.blockDB = dbmd.open(datadir + "/blocks", 'c')
self.currentBlock = 0
self.headers_map = dict()
def close(self):
self.blockDB.close()
def erase(... |
from __future__ import print_function
import email.Utils
from gi.repository import Gtk
import math
import pychess
import random
import signal
import subprocess
from threading import Thread
from pychess.compat import urlopen, urlencode
from pychess.Players.PyChess import PyChess
from pychess.System.prefix import addDa... |
from __future__ import unicode_literals
import unittest
from django.contrib.admindocs import views
from django.db import models
from django.db.models import fields
from django.utils.translation import ugettext as _
class CustomField(models.Field):
description = "A custom field type"
class DescriptionLackingFi... |
"""Functional tests for slice op."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from six.moves import xrange # pylint: disable=redefined-builtin
import tensorflow as tf
class SliceTest(tf.test.TestCase):
def testEmpty(self):
... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
try:
import consul
from requests.exceptions import ConnectionError
class Patch... |
from sqlalchemy import Integer, ForeignKey, String
from sqlalchemy.types import PickleType, TypeDecorator, VARCHAR
from sqlalchemy.orm import mapper, Session, composite
from sqlalchemy.orm.mapper import Mapper
from sqlalchemy.orm.instrumentation import ClassManager
from sqlalchemy.testing.schema import Table, Column
fr... |
"""thumbnail.py - Thumbnail module for Comix implementing (most of) the
freedesktop.org "standard" at http://jens.triq.net/thumbnail-spec/
Only normal size (i.e. 128x128 px) thumbnails are supported.
"""
import os
from urllib import pathname2url, url2pathname
try: # The md5 module is deprecated as of Python 2.5, repl... |
"""Verifies that Google Test warns the user when not initialized properly."""
import gtest_test_utils
COMMAND = gtest_test_utils.GetTestExecutablePath('googletest-uninitialized-test_')
def Assert(condition):
if not condition:
raise AssertionError
def AssertEq(expected, actual):
if expected != actual:
... |
#! /usr/bin/env python3
import sys
from os.path import abspath, expanduser, dirname, join
from itertools import chain
import json
import argparse
from vis import vis, unvis, VIS_WHITE
__dir__ = dirname(abspath(__file__))
OUTPUT_FILE = join(__dir__, '..', 'fixtures', 'unvis_fixtures.json')
# Add custom fixtures her... |
"""A setup module for psidPy
Based on the pypa sample project.
A tool to download data and build psid panels based on psidR by Florian Oswald.
See:
https://github.com/floswald/psidR
https://github.com/tyler-abbot/psidPy
"""
from setuptools import setup, find_packages
from codecs import open
from os import path
her... |
import string, sys, os, glob, itertools
# current output directory
#
output_dir = None
# A function that generates a sorting key. We want lexicographical order
# (primary key) except that capital letters are sorted before lowercase
# ones (secondary key).
#
# The primary key is implemented by lowercasing the input... |
# -*- coding: utf-8 -*-
import os
ccdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
template = """<!DOCTYPE html>
<meta charset=utf-8>
"""
errors = {
"date-year-0000": "0000-12-09",
"date-month-00": "2002-00-15",
"date-month-13": "2002-13-15",
"date-0005-02-29": "0005-02-29",
"date... |
import urllib2
import json
# Copyright 2016, Aman Alam
#
# 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 la... |
import os
from django.conf import settings
from django.template import Template, Context, TemplateSyntaxError
from sorl.thumbnail.tests.classes import BaseTest, RELATIVE_PIC_NAME
class ThumbnailTagTest(BaseTest):
def render_template(self, source):
context = Context({
'source': RELATIVE_PIC_NAM... |
from pyjamas import DOM
from pyjamas.ui import Event
DROP_EVENTS = [ "dragenter", "dragover", "dragleave", "drop"]
def fireDropEvent(listeners, event):
etype = DOM.eventGetType(event)
if etype == "dragenter":
for listener in listeners:
listener.onDragEnter(event)
return True
el... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Interpreter version: python 2.7
#
# Imports =====================================================================
import pytest
import dhtmlparser
import harvester.edeposit_autoparser as autoparser
# Variables ========================================================... |
#!/bin/env python
from setuptools import setup
setup(
name='zerotk.reraiseit',
use_scm_version=True,
author='Alexandre Andrade',
author_email='<EMAIL>',
url='https://github.com/zerotk/reraiseit',
description='Reraise exceptions.',
long_description='''A function to re-raise exceptions ad... |
print """
This program shows how to access the Temporal Memory directly by demonstrating
how to create a TM instance, train it with vectors, get predictions, and
inspect the state.
The code here runs a very simple version of sequence learning, with one
cell per column. The TM is trained with the simple sequence A->B->... |
import collections
import unittest2
from lxml import etree as ET
from lxml.builder import E
from openerp.tests import common
from openerp.tools.convert import _eval_xml
Field = E.field
Value = E.value
class TestEvalXML(common.TransactionCase):
def eval_xml(self, node, obj=None, idref=None):
return _eval_... |
import base64
import datetime
import os.path
import re
_GDATA_LIBS_FOUND = True
try:
import gdata.auth
import gdata.service
import gdata.alt.appengine
except ImportError:
_GDATA_LIBS_FOUND = False
from google.appengine.api import urlfetch
from google.appengine.api import users
from google.appengine.ext impor... |
"""
Given an array with positive and negative integers. Re-range it to interleaving with positive and negative integers.
Have you met this question in a real interview? Yes
Example
Given [-1, -2, -3, 4, 5, 6], after re-range, it will be [-1, 5, -2, 4, -3, 6] or any other reasonable answer.
Note
You are not necessary ... |
from MySQLdb.constants import FIELD_TYPE
from django.contrib.gis.gdal import OGRGeomType
from django.db.backends.mysql.introspection import DatabaseIntrospection
class MySQLIntrospection(DatabaseIntrospection):
# Updating the data_types_reverse dictionary with the appropriate
# type for Geometry fields.
... |
import sys
import json
full_search = len(sys.argv) > 3 and sys.argv[3] == '--full'
with open(sys.argv[1]) as f:
data = f.readlines()
thread = None
for entry in data:
entry = json.loads(entry)
if thread and "thread" in entry:
if entry["thread"] == thread:
print(j... |
"""Null links that ignore tickets passed to them."""
from grpc.framework.base import interfaces
class _NullForeLink(interfaces.ForeLink):
"""A do-nothing ForeLink."""
def accept_back_to_front_ticket(self, ticket):
pass
def join_rear_link(self, rear_link):
raise NotImplementedError()
class _NullRear... |
import boto
from boto.s3.connection import S3Connection
from boto.s3.connection import SubdomainCallingFormat
from boto.gs.bucket import Bucket
class GSConnection(S3Connection):
DefaultHost = 'commondatastorage.googleapis.com'
QueryString = 'Signature=%s&Expires=%d&AWSAccessKeyId=%s'
def __in... |
from openerp import tools
from openerp.osv import fields, osv
from openerp.addons.decimal_precision import decimal_precision as dp
class campaign_analysis(osv.osv):
_name = "campaign.analysis"
_description = "Campaign Analysis"
_auto = False
_rec_name = 'date'
def _total_cost(self, cr, uid, ids, f... |
widths = {'A': 600,
'AE': 600,
'Aacute': 600,
'Acircumflex': 600,
'Adieresis': 600,
'Agrave': 600,
'Aring': 600,
'Atilde': 600,
'B': 600,
'C': 600,
'Ccedilla': 600,
'D': 600,
'E': 600,
'Eacute': 600,
'Ecircumflex': 600,
'Edieresis': 600,
'Egrave': 600,
'Eth': 600,
'Euro': 600,
'F': 600,
'G': 600,
'... |
"""
run this with ./manage.py test website
see http://www.djangoproject.com/documentation/testing/ for details
"""
import os
from django.conf import settings
from django.shortcuts import render_to_response
from django.test import TestCase
from paypal.standard.pdt.forms import PayPalPDTForm
from paypal.standard.pdt.mode... |
from cloudinit import distros as ds
from cloudinit import util
distros = ['ubuntu', 'debian']
def handle(name, cfg, cloud, log, args):
if len(args) != 0:
value = args[0]
else:
value = util.get_cfg_option_str(cfg, "byobu_by_default", "")
if not value:
log.debug("Skipping module n... |
#!/usr/bin/env python
# File created on 1 April 2012
from __future__ import division
__author__ = "Jens Reeder"
__copyright__ = "Copyright 2011, The QIIME Project"
__credits__ = ["Jens Reeder", "Jose Antonio Navas Molina", "Jai Ram Rideout"]
__license__ = "GPL"
__version__ = "1.9.1-dev"
__maintainer__ = "Jens Reeder"
... |
data = (
'sseum', # 0x00
'sseub', # 0x01
'sseubs', # 0x02
'sseus', # 0x03
'sseuss', # 0x04
'sseung', # 0x05
'sseuj', # 0x06
'sseuc', # 0x07
'sseuk', # 0x08
'sseut', # 0x09
'sseup', # 0x0a
'sseuh', # 0x0b
'ssyi', # 0x0c
'ssyig', # 0x0d
'ssyigg', # 0x0e
'ssyigs', # 0x0f
'ss... |
from topaz.celldict import CellDict, Cell, GlobalsDict
from .base import BaseTopazTest
class TestCellDict(BaseTopazTest):
def test_single_set(self, space):
c = CellDict()
v = c.version
c.set(space, "a", 2)
assert c.version is not v
assert c._get_cell("a", c.version) == 2
... |
from unittest import TestCase
import simplejson as json
from operator import itemgetter
class TestItemSortKey(TestCase):
def test_simple_first(self):
a = {'a': 1, 'c': 5, 'jack': 'jill', 'pick': 'axe', 'array': [1, 5, 6, 9], 'tuple': (83, 12, 3), 'crate': 'dog', 'zeak': 'oh'}
self.assertEqual(
... |
"""
Tests for L{twisted.web.util}.
"""
from __future__ import absolute_import, division
import gc
from twisted.python.failure import Failure
from twisted.trial.unittest import SynchronousTestCase, TestCase
from twisted.internet import defer
from twisted.python.compat import _PY3, intToBytes, networkString
from twist... |
from pyface.qt.QtCore import Qt
from pyface.qt.QtGui import QColor
from traitsui.tree_node import TreeNode
from pychron.envisage.resources import icon
from pychron.pipeline.engine import Pipeline
from pychron.pipeline.nodes import ReviewNode
class PipelineGroupTreeNode(TreeNode):
icon_name = ''
label = 'name... |
# -*- coding: utf-8 -*-
# (mostly translation, see implementation details)
# Licence: BSD 3 clause
"""
The built-in correlation models submodule for the gaussian_process module.
"""
import numpy as np
def absolute_exponential(theta, d):
"""
Absolute exponential autocorrelation model.
(Ornstein... |
import os
from textwrap import dedent
from jedi._compatibility import u
from jedi.evaluate.sys_path import (_get_parent_dir_with_file,
_get_buildout_scripts,
sys_path_with_modifications,
_check_module)
from jedi... |
import json
from lucid.misc.io.showing import _display_html
def renderObservable(url, cells=None, data=None):
"""Display observable notebook cells in iPython.
Args:
url: url fragment to observable notebook. ex: '@observablehq/downloading-and-embedding-notebooks'
cells: an array of strings for the names of... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import datetime
import os
import traceback
import textwrap
from ansible.compat.six import iteritems
from ansible.errors import AnsibleError, AnsibleOptionsError
from ansible.plugins import module_loader
from ansible.cli import CL... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
from ansible.module_utils.facts.namespace import PrefixFactNamespace
from ansible.module_utils.facts.collector import BaseFactCollector
class FacterFactCollector(BaseFactCollector):
name = 'facter'
_fact_ids... |
'''Command to link static content to settings.STATIC_DOC_ROOT
Created on Aug 24, 2010
@author: jnaous
'''
from django.core.management.base import NoArgsCommand
from django.conf import settings
import pkg_resources
import os
class Command(NoArgsCommand):
help = "Link static content from package to %s" % settings.... |
'''
A "pvec" is a changeset property based on the theory of vector clocks
that can be compared to discover relatedness without consulting a
graph. This can be useful for tasks like determining how a
disconnected patch relates to a repository.
Currently a pvec consist of 448 bits, of which 24 are 'depth' and the
remain... |
from __future__ import absolute_import
from datetime import date
from django.test import TestCase
from .models import Article
class MethodsTests(TestCase):
def test_custom_methods(self):
a = Article.objects.create(
headline="Area man programs in Python", pub_date=date(2005, 7, 27)
)... |
from . import models
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
import numpy as np
from functools import reduce
from string import ascii_uppercase
from ..externals.six import string_types
from ..utils import deprecated
from ..fixes import matrix_rank
# The following function is a rewriting of scipy.stats.f_oneway
# Contrary to the scipy.stats.f_oneway implementation it does not
#... |
#!/usr/bin/env python
# Capstone Python bindings, by Nguyen Anh Quynnh <<EMAIL>>
from __future__ import print_function
from capstone import *
import binascii
import sys
from xprint import to_hex, to_x, to_x_32
_python3 = sys.version_info.major == 3
X86_CODE16 = b"\x8d\x4c\x32\x08\x01\xd8\x81\xc6\x34\x12\x00\x00"
X... |
#!/usr/bin/env python2.7
# pylint: disable=C0301
from __future__ import absolute_import, unicode_literals, print_function, division
from sys import argv
from os import environ, stat, chdir, remove as _delete_file
from os.path import dirname, basename, abspath, realpath, expandvars
from hashlib import sha256
from subpr... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import
from django.test import TestCase
from ..forms import QuoteForm
class TestQuoteForm(TestCase):
def setUp(self):
pass
def test_validate_emtpy_quote(self):
form = QuoteForm({'message': ''})
self.assertFals... |
# -*- coding: utf-8 -*-
import pprint
import logging
import urlparse
from openerp import http
from openerp.http import request
_logger = logging.getLogger(__name__)
class AuthorizeController(http.Controller):
_return_url = '/payment/authorize/return/'
_cancel_url = '/payment/authorize/cancel/'
@http.ro... |
# -*- coding: UTF-8 -*-
"""
Copyright 2007--2009 Ulrik Sverdrup <<EMAIL>>
This file is a part of the program kupfer, which is
released under GNU General Public License v3 (or any later version),
see the main program file, and COPYING for details.
"""
import os
from os import path
import gobject
from kupfer import ... |
import calendar
from collections import defaultdict
import datetime
import json
import time
import urllib.request, urllib.error, urllib.parse
class WeatherData(object):
'''Caching front-end to weather data API.'''
# minimum time to wait, in seconds, between calls to the weather api
MIN_TIME_BETWEEN_CALLS ... |
"""
Utilities for the modular DevTools build.
"""
from os import path
import os
try:
import simplejson as json
except ImportError:
import json
def read_file(filename):
with open(path.normpath(filename), 'rt') as input:
return input.read()
def write_file(filename, content):
if path.exists(f... |
"""Provides a container for DescriptorProtos."""
__author__ = '<EMAIL> (Matt Toia)'
class DescriptorDatabase(object):
"""A container accepting FileDescriptorProtos and maps DescriptorProtos."""
def __init__(self):
self._file_desc_protos_by_file = {}
self._file_desc_protos_by_symbol = {}
def Add(self,... |
"""
Class representing the list of files in a distribution.
Equivalent to distutils.filelist, but fixes some problems.
"""
import fnmatch
import logging
import os
import re
from . import DistlibException
from .compat import fsdecode
from .util import convert_path
__all__ = ['Manifest']
logger = logging.getLogger(_... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import re
import time
import glob
from ansible.plugins.action.normal import ActionModule as _ActionModule
from ansible.module_utils._text import to_text
from ansible.module_utils.six.moves.urllib.parse import urlsplit
fr... |
from __future__ import unicode_literals
import frappe
import os
from frappe.utils.file_manager import get_content_hash, get_file, get_file_name
from frappe.utils import get_files_path, get_site_path
# The files missed by the previous patch might have been replaced with new files
# with the same filename
#
# This patc... |
"""
Read tokens, phonemes and audio data from the NLTK TIMIT Corpus.
This corpus contains selected portion of the TIMIT corpus.
- 16 speakers from 8 dialect regions
- 1 male and 1 female from each dialect region
- total 130 sentences (10 sentences per speaker. Note that some
sentences are shared among ... |
import os.path
import urllib
import duplicity.backend
from duplicity import globals
from duplicity import log
from duplicity import tempdir
class NCFTPBackend(duplicity.backend.Backend):
"""Connect to remote store using File Transfer Protocol"""
def __init__(self, parsed_url):
duplicity.backend.Backe... |
#!/usr/bin/env python
import io
import sys
import os
import sqlite3
import hashlib
import binascii
print "Setting Up Mark System"
print "This will, delete all data but the ones in the backup-folder !"
print "If you are shure you want to continue, type \" YES \". yep, in capslock!\n"
ShouldInstall = unicode(raw_input(... |
'''
@author: Frank
'''
import unittest
import time
import os.path
from kvmagent import kvmagent
from kvmagent.plugins import nfs_primarystorage_plugin
from zstacklib.utils import http
from zstacklib.utils import jsonobject
from zstacklib.utils import log
from zstacklib.utils import uuidhelper
from zstackl... |
from airflow.ti_deps.deps.base_ti_dep import BaseTIDep
from airflow.utils.db import provide_session
from airflow.utils.state import State
class NotRunningDep(BaseTIDep):
NAME = "Task Instance Not Already Running"
# Task instances must not already be running, as running two copies of the same
# task insta... |
import csv
class ExceptionStats:
def __init__(self):
self.status = None
self.owner = None
self.count = 0
self.hash = None
def inc_count(self):
self.count += 1
class ExceptionData:
def __init__(self, ident):
self.ident = ident
self.prev_stats = Exc... |
import rebound
import inspect
import docstring_to_markdown
def convert_code_blocks(doc):
new_doc = ""
lines = doc.split("\n")
first = True
for line in lines:
if first:
if line[:3]==">>>":
first = False
new_doc += "```python\n"
new_doc +... |
from bambou import NURESTFetcher
class NUInfrastructureGatewayProfilesFetcher(NURESTFetcher):
""" Represents a NUInfrastructureGatewayProfiles fetcher
Notes:
This fetcher enables to fetch NUInfrastructureGatewayProfile objects.
See:
bambou.NURESTFetcher
"""
@clas... |
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.utils import now, cint
from frappe.model import no_value_fields
from frappe.model.document import Document
from frappe.model.db_schema import type_map
from frappe.core.doctype.property_setter.property_setter import make_property_se... |
import sys
import cherrypy
if sys.version_info >= (2, 6):
# Python 2.6: simplejson is part of the standard library
import json
else:
try:
import simplejson as json
except ImportError:
json = None
if json is None:
def json_decode(s):
raise ValueError('No JSON library is avai... |
"""A library for math related things
Copyright 2015 Heung Ming Tai
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... |
"""Parser for utmpx files."""
# TODO: Add support for other implementations than Mac OS X.
# The parser should be checked against IOS UTMPX file.
import construct
import logging
from plaso.lib import errors
from plaso.lib import event
from plaso.lib import eventdata
from plaso.lib import parser
from plaso.lib ... |
"""
bjson/request.py
Asynchronous Bidirectional JSON-RPC protocol implementation over TCP/IP
Copyright (c) 2010 David Martinez Marti
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditio... |
"""
A shim for the TP class that transparently implements TemporalMemory,
for use with OPF.
"""
import numpy
from nupic.research.temporal_memory import TemporalMemory
class TPShim(TemporalMemory):
"""
TP => Temporal Memory shim class.
"""
def __init__(self,
numberOfCols=500,
c... |
from temboo.core.choreography import Choreography
from temboo.core.choreography import InputSet
from temboo.core.choreography import ResultSet
from temboo.core.choreography import ChoreographyExecution
import json
class GetAttachedRecipientLists(Choreography):
def __init__(self, temboo_session):
"""
... |
"""Constants for selecting regexp syntaxes for the obsolete regex module.
This module is only for backward compatibility. "regex" has now
been replaced by the new regular expression module, "re".
These bits are passed to regex.set_syntax() to choose among
alternative regexp syntaxes.
"""
# 1 means plain parentheses... |
#!/usr/bin/env python
import sys
sys.dont_write_bytecode = True
import glob
import yaml
import os
import sys
import time
import logging
import re
from threading import Thread
from logging.handlers import RotatingFileHandler
from slackclient import SlackClient
def dbg(debug_string):
"""
Used to write debuggi... |
# -*- coding: utf-8 -*-
# pylint: skip-file
from django.conf import settings
from django.contrib.auth import get_user_model
from django.contrib.auth.hashers import check_password
class SettingsBackend:
"""
Authenticates against the settings ADMIN_LOGIN and ADMIN_PASSWORD
Use the login name and a hash of ... |
#! /usr/bin/env python
from subprocess import Popen, PIPE
import re
def getTags():
Popen('git fetch --tags'.split(), stdout=PIPE).communicate()
(stdout, _) = Popen('git tag'.split(), stdout=PIPE).communicate()
return sorted(stdout.split(), key=lambda s: [int(x) for x in s.replace('v', '').split('.')])
... |
import httplib # basic HTTP library for HTTPS connections
import logging
from quantum.plugins.nicira.nicira_nvp_plugin.api_client import (
client_eventlet, request_eventlet)
LOG = logging.getLogger("NVPApiHelper")
LOG.setLevel(logging.INFO)
class NVPApiHelper(client_eventlet.NvpApiClientEventlet):
'''
H... |
from argparse import ArgumentError
import diagnostics
from .targets import StdlibDeploymentTarget
class HostSpecificConfiguration(object):
"""Configuration information for an individual host."""
def __init__(self, host_target, args):
"""Initialize for the given `host_target`."""
# Compute... |
#! /usr/bin/env python
# This script translates a list of arguments into one value specified by a rule file. Usage:
# translate ruleFilename key1 key2 ...
# It prints out the value corresponds to [key1, key2, ...] from a dictionary read from ruleFilename.
# To see how the dictionary is generated, see readRules function... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.