content stringlengths 4 20k |
|---|
import exceptions, os
from repr import Repr
class BetterRepr(Repr):
def __init__(self):
Repr.__init__(self)
# Note: These levels can get adjusted dynamically! My goal is to get more info when printing important debug stuff like exceptions and stack traces and less info when logging normal events.... |
import six
from st2common import log as logging
from st2common.constants.triggers import TRIGGER_INSTANCE_PENDING
from st2common.exceptions.db import StackStormDBObjectNotFoundError
from st2common.models.db.trigger import TriggerInstanceDB
from st2common.persistence.trigger import TriggerInstance
from st2common.servic... |
_GOODBYE_MESSAGE = u'Goodbye'
def web_socket_do_extra_handshake(request):
pass # Always accept.
def web_socket_transfer_data(request):
while True:
line = request.ws_stream.receive_message()
if line is None:
return
if isinstance(line, unicode):
request.ws_stre... |
from django import forms
from .models import *
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
import json
class PersonnelForm(forms.ModelForm):
password = forms.CharField(widget=forms.PasswordInput)
class Meta:
model = Personnel
fields = ('Pe... |
########################################################################
#
# File Name: HTMLFrameElement.py
#
#
"""
WWW: http://4suite.com/4DOM e-mail: <EMAIL>
Copyright (c) 2000 Fourthought Inc, USA. All Rights Reserved.
See http://4suite.com/COPYRIGHT for license and copyright information
"""
... |
#!/usr/bin/env python
"""
=================================
Path with L1- Logistic Regression
=================================
Computes path on IRIS dataset.
"""
print(__doc__)
# License: BSD 3 clause
from datetime import datetime
import numpy as np
import matplotlib.pyplot as plt
from sklearn import linear_model... |
# -*- coding: utf-8 -*-
"""
Pygments
~~~~~~~~
Pygments is a syntax highlighting package written in Python.
It is a generic syntax highlighter for general use in all kinds of software
such as forum systems, wikis or other applications that need to prettify
source code. Highlights are:
* a ... |
from __future__ import unicode_literals
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class Reporter(models.Model):
first_name = models.CharField(max_length=30)
last_name = models.CharField(max_length=30)
email = models.EmailField(... |
import re
from XmTestLib import *
from XmTestLib.block_utils import *
if ENABLE_HVM_SUPPORT:
SKIP("Block-attach not supported for HVM domains")
# Create a domain (default XmTestDomain, with our ramdisk)
domain = XmTestDomain()
try:
console = domain.start()
except DomainError, e:
if verbose:
prin... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import copy
import os
import time
import errno
from abc import ABCMeta, abstractmethod
from ansible import constants as C
from ansible.errors import AnsibleError
from ansible.module_utils.six import with_metaclass
from ansible.mod... |
r"""
=======================================
Robust vs Empirical covariance estimate
=======================================
The usual covariance maximum likelihood estimate is very sensitive to the
presence of outliers in the data set. In such a case, it would be better to
use a robust estimator of covariance to guar... |
#!/usr/bin/python
from mininet_extensions import MininetOSHI
from utility import unmountAll, PropertiesGenerator
import subprocess
def test_add_nodes_and_add_link():
verbose=True
net = MininetOSHI(verbose)
generator = PropertiesGenerator(False)
cr_os = ["cro1","cro2","cro3"]
pe_os = ["peo1","peo2","peo3"]
ctr... |
"""SCons.Warnings
This file implements the warnings framework for SCons.
"""
__revision__ = "src/engine/SCons/Warnings.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
import sys
import SCons.Errors
class Warning(SCons.Errors.UserError):
pass
class WarningOnByDefault(Warning):
pass
# NOTE: ... |
from threading import Thread, Timer
import websocket
import logging
import time
try:
import simplejson as json
except:
import json
class Connection(Thread):
def __init__(self, event_handler, url, log_level=logging.INFO):
self.event_handler = event_handler
self.url = url
self.socket = None
self... |
"""Nearly exact trust-region optimization subproblem."""
import numpy as np
from scipy.linalg import (norm, get_lapack_funcs, solve_triangular,
cho_solve)
from ._trustregion import (_minimize_trust_region, BaseQuadraticSubproblem)
__all__ = ['_minimize_trustregion_exact',
'estimate... |
#!/usr/bin/env python
from nose.tools import *
import networkx as nx
class TestBFS:
def setUp(self):
# simple graph
G=nx.Graph()
G.add_edges_from([(0,1),(1,2),(1,3),(2,4),(3,4)])
self.G=G
def test_successor(self):
assert_equal(nx.bfs_successors(self.G,source=0),
... |
"""This module contains convenience utilities for manipulating waveforms
"""
from __future__ import absolute_import
from pycbc.types import TimeSeries, FrequencySeries, Array, float32, float64, complex_same_precision_as, real_same_precision_as
import lal
import lalsimulation as sim
from math import frexp
import numpy
f... |
ANSIBLE_METADATA = {'status': ['preview'],
'supported_by': 'community',
'version': '1.0'}
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.cloudstack import AnsibleCloudStack, CloudStackException, cs_argument_spec, cs_required_together
class Ansib... |
#!/usr/bin/env python
"""Execute the tests for search/join.
The golden test outputs are generated by the script generate_outputs.sh.
You have to give the root paths to the source and the binaries as arguments to
the program. These are the paths to the directory that contains the 'projects'
directory.
Usage: run_te... |
import os.path
import shutil
from ..optimiser import Optimiser
from animated_gif import OptimiseAnimatedGIF
import logging
class OptimiseGIF(Optimiser):
"""
Optimises gifs. If they aren't animated, it converts them to pngs with ImageMagick before
optimising them as for pngs.
Animated gifs get optimise... |
#!/usr/bin/env python
"""Utility script to convert an old VTK file format to the new VTK XML
file format (serial format). The output XML file will contain *all*
the existing scalars, vectors and tensors in the input file.
This requires VTK 4.x or above.
Created May 2003, Prabhu Ramachandran <<EMAIL>>
Licence: VTK ... |
from heatclient.common import template_utils
from oslo_serialization import jsonutils
from oslo_utils import importutils
import prettytable
import yaml
from senlinclient.common import exc
from senlinclient.common.i18n import _
def import_versioned_module(version, submodule=None):
module = 'senlinclient.v%s' % ve... |
import itertools
from dataclasses import dataclass
from pathlib import PurePath
from typing import Iterable, Optional, Tuple, Type, cast
from pants.core.target_types import FilesSources
from pants.engine.addresses import Address
from pants.engine.fs import (
EMPTY_SNAPSHOT,
Digest,
MergeDigests,
PathGl... |
"""Jieba command line interface."""
import sys
import jieba
from argparse import ArgumentParser
from ._compat import *
parser = ArgumentParser(usage="%s -m jieba [options] filename" % sys.executable, description="Jieba command line interface.", epilog="If no filename specified, use STDIN instead.")
parser.add_argument... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'InCourseReverificationConfiguration'
db.create_table('ver... |
import xlsxwriter
workbook = xlsxwriter.Workbook('chart_pareto.xlsx')
worksheet = workbook.add_worksheet()
# Formats used in the workbook.
bold = workbook.add_format({'bold': True})
percent_format = workbook.add_format({'num_format': '0.0%'})
# Widen the columns for visibility.
worksheet.set_column('A:A', 15)
worksh... |
"""
Support for Sybase via pyodbc.
http://pypi.python.org/pypi/pyodbc/
Connect strings are of the form::
sybase+pyodbc://<username>:<password>@<dsn>/
sybase+pyodbc://<username>:<password>@<host>/<database>
Unicode Support
---------------
The pyodbc driver currently supports usage of these Sybase types with... |
"""FIF module for IO with .fif files"""
# Authors: Alexandre Gramfort <<EMAIL>>
# Matti Hamalainen <<EMAIL>>
#
# License: BSD (3-clause)
from .open import fiff_open, show_fiff, _fiff_get_fid
from .meas_info import read_fiducials, write_fiducials, read_info, write_info
from .proj import make_eeg_average_ref_... |
from __future__ import absolute_import
from __future__ import print_function
import sys
import subprocess
import os
import traceback
import signal
from .zephyr_mirror_backend import parse_args
def die(signal, frame):
# We actually want to exit, so run os._exit (so as not to be caught and restarted)
os._exit(1... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Module used for testing a deployed archive interface."""
import os
from queue import Queue
from threading import Thread
import unittest
import requests
# url for the archive interface just deployed.
# Clean Local files will remove all the test file generated from where the ... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
from ansible.plugins.lookup import LookupBase
from ansible.module_utils.urls import open_url
# this can be made configurable, not should not use ansible.cfg
#
# Made module configurable from playbooks:
# If etcd v2 r... |
"""
The GeometryColumns and SpatialRefSys models for the SpatiaLite backend.
"""
from django.db import models
from django.contrib.gis.db.backends.base import SpatialRefSysMixin
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class GeometryColumns(models.Model):
"""
T... |
import logging
from reportlab.pdfbase import ttfonts
from odoo import api, fields, models
from odoo.report.render.rml2pdf import customfonts
"""This module allows the mapping of some system-available TTF fonts to
the reportlab engine.
This file could be customized per distro (although most Linux/Unix ones)
should ha... |
import time
from test_framework.test_particl import ParticlTestFramework
from test_framework.util import assert_equal
class TimestampIndexTest(ParticlTestFramework):
def set_test_params(self):
self.setup_clean_chain = True
self.num_nodes = 4
self.extra_args = [
# Nodes 0/1 are... |
from importlib import machinery
from .. import abc
from .. import util
from . import util as builtin_util
import sys
import unittest
class FinderTests(abc.FinderTests):
"""Test find_module() for built-in modules."""
def test_module(self):
# Common case.
with util.uncache(builtin_util.NAME):
... |
from test_framework import ComparisonTestFramework
from util import *
from comptool import TestManager, TestInstance
from mininode import *
from blocktools import *
import logging
import copy
import time
'''
In this test we connect to one node over p2p, and test block requests:
1) Valid blocks should be requested and... |
import os, sys; sys.path.insert(0, os.path.join("..", ".."))
from pattern.vector import Document, Model, NB
from pattern.db import Datasheet
# Naive Bayes is one of the oldest classifiers,
# but is is still popular because it is fast for models
# that have many documents and many features.
# It is outperformed by KNN... |
"""Fixer for function definitions with tuple parameters.
def func(((a, b), c), d):
...
->
def func(x, d):
((a, b), c) = x
...
It will also support lambdas:
lambda (x, y): x + y -> lambda t: t[0] + t[1]
# The parens are a syntax error in Python 3
lambda (x): x + y -> lambda x: x + y
"""... |
from distutils.core import setup
setup(
name = 'helper_functions',
version = '2.0.10',
py_modules = ['helper_functions'],
author = 'Sahil Dadia',
author_email = '<EMAIL>',
url = 'https://github.com/sdadia/helper... |
# -*- coding: utf-8 -*-
with open('day20.dat') as datafile:
blacklist = [list(map(int,x.split('-'))) for x in datafile.readlines()]
blacklist.sort(key=lambda arr: arr[0])
doPartOne = False
if doPartOne:
iactiveblacklist = 0
firstip = 0
numclear = 0
for iip in range(0,4294967295+1):
if ii... |
"""
The MIT License
Copyright (c) 2007-2010 Leah Culver, Joe Stump, Mark Paschal, Vic Fryzel
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the ... |
#!/usr/bin/env python
from PIL import Image, ImageDraw, ImageFont
import os
font = ImageFont.truetype('C:/Windows/Fonts/arialbd.ttf', 16)
def draw_label(draw, position, text):
draw.text((position[0] + 1, position[1] + 1), text, (255, 255, 255), font=font)
draw.text(position, text, (0, 0, 0), font=fo... |
__title__ = "FreeCAD SweetHome3D importer"
__author__ = "Yorik van Havre"
__url__ = "http://www.freecadweb.org"
import os,zipfile,xml.sax,FreeCAD,Part,Draft,Arch,Mesh,tempfile,math,Sketcher
DEBUG = True
if open.__module__ == '__builtin__':
pyopen = open # because we'll redefine open below
def open(filename... |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsDatumTransforms.
.. note:: 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 2 of the License, or
(at your option) any later version.
""... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# PEP 263 -- Defining Python Source Code Encodings https://www.python.org/dev/peps/pep-0263/
# PEP 3120 -- Using UTF-8 as the default source encoding https://www.python.org/dev/peps/pep-3120/
"""At least once a day, get all booki... |
from resource import _struct_rusage, struct_rusage
from ctypes import CDLL, c_int, POINTER, byref
from ctypes.util import find_library
__all__ = ["wait3", "wait4"]
libc = CDLL(find_library("c"))
c_wait3 = libc.wait3
c_wait3.argtypes = [POINTER(c_int), c_int, POINTER(_struct_rusage)]
c_wait3.restype = c_int
c_wait4 =... |
import pytest
from selenium.common.exceptions import (
NoSuchElementException,
NoSuchWindowException,
TimeoutException,
WebDriverException)
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
def testGetTitle(driver, pages):
p... |
#!/usr/bin/python
import numpy as np
class ExponentialDecay:
def __init__(self, starter_value, decay_step, decay_rate, staircase=False):
"""Function that applyes an exponential decay to a value.
@param starting_value the value to decay
@param global_step the global step to use for decay ... |
#!/usr/bin/python
# don't expect too much.
# this is a really simple&stupid svg parser, which will use rectangles
# and text fields to produce <widget> snippets for a skin.
# use object "id" fields for source names if you want.
# extracting font information is buggy.
# if you want text fields, please use flow text regi... |
"""
wmlgrammar -- parses a given schema into a more usable form
"""
import collections
import re
REQUIRED = 1
OPTIONAL = 2
REPEATED = 3
FORBIDDEN = 4
class Grammar(object):
def __init__(self, schema):
schema = schema.get_first("schema")
self.datatypes = {
"boolean": re.compile("^(yes|... |
import xml.dom.minidom as dom
from genRoutes import *
import subprocess, sys
from changeNet import *
from pylab import *
import libxml2
durWE = []
durNS = []
routeLenWE = []
routeLenNS = []
minTravelTime = 69.0
def evalTrips(begin, N):
global durWE, durNS
doc = libxml2.parseFile('tripinfo.txt')
la... |
from oslo.config import cfg
from nova import db
from nova.openstack.common.gettextutils import _
from nova.openstack.common import log as logging
from nova.scheduler import filters
LOG = logging.getLogger(__name__)
cpu_allocation_ratio_opt = cfg.FloatOpt('cpu_allocation_ratio',
default=16.0,
help='Vi... |
import sys, os
import paver.easy
import paver.setuputils
NAME = 'pynet'
def configure():
cwd = os.getcwd()
sys.path.insert(0, os.path.join(cwd, 'source'))
package = __import__(NAME)
del sys.path[0]
setup = dict(
version=package.__version__,
url=package.__url__,
... |
from __future__ import absolute_import
import cStringIO
import struct
from . import exception as dns_exception
from . import rdata as dns_rdata
_pows = (1L, 10L, 100L, 1000L, 10000L, 100000L, 1000000L, 10000000L,
100000000L, 1000000000L, 10000000000L)
def _exponent_of(what, desc):
exp = None
for i ... |
import shlex
import os
import sys
URPMI_PATH = '/usr/sbin/urpmi'
URPME_PATH = '/usr/sbin/urpme'
def query_package(module, name):
# rpm -q returns 0 if the package is installed,
# 1 if it is not installed
cmd = "rpm -q %s" % (name)
rc, stdout, stderr = module.run_command(cmd, check_rc=False)
if rc ... |
# drive APMrover2 in SITL
import util, pexpect, sys, time, math, shutil, os
from common import *
from pymavlink import mavutil
import random
# get location of scripts
testdir=os.path.dirname(os.path.realpath(__file__))
#HOME=mavutil.location(-35.362938,149.165085,584,270)
HOME=mavutil.location(40.071374969556928,-1... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Sextractor interface.
Created on Thu May 17 13:29:05 2018
:author: raf
"""
# IMPORT STUFF
from pdb import set_trace as stop
try: import astromatic_wrapper as aw
except ModuleNotFoundError:
pass
import os
import string as st
import numpy as np
import tempfile
f... |
# -*- coding: utf-8 -*-
"""
requests.api
~~~~~~~~~~~~
This module implements the Requests API.
:copyright: (c) 2012 by Kenneth Reitz.
:license: Apache2, see LICENSE for more details.
"""
from . import sessions
def request(method, url, **kwargs):
"""Constructs and sends a :class:`Request <Request>`.
:para... |
import numpy as np
from scipy import sparse
from sklearn.utils.testing import (assert_array_almost_equal, assert_equal,
assert_greater, assert_almost_equal,
assert_greater_equal,
assert_array_equal,
... |
import gdb
import sys
from linux import utils
class LxDmesg(gdb.Command):
"""Print Linux kernel log buffer."""
def __init__(self):
super(LxDmesg, self).__init__("lx-dmesg", gdb.COMMAND_DATA)
def invoke(self, arg, from_tty):
log_buf_addr = int(str(gdb.parse_and_eval(
"(void *... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Downloads the necessary NLTK corpora for TextBlob.
Usage: ::
$ python -m textblob.download_corpora
If you only intend to use TextBlob's default models, you can use the "lite"
option: ::
$ python -m textblob.download_corpora lite
"""
import sys
import nltk
M... |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'CustomField.empty_selection_list'
db.add_column('helpdesk_customfield', 'empty_selection_l... |
"""
Convenience methods for working with datetime objects
"""
import re
from datetime import datetime, timedelta
import six
from django.utils.translation import pgettext, ugettext
from pytz import UnknownTimeZoneError, timezone, utc
def get_default_time_display(dtime):
"""
Converts a datetime to a string r... |
# -*- coding: utf-8 -*-
"""
jinja2.tests
~~~~~~~~~~~~
Jinja test functions. Used with the "is" operator.
:copyright: (c) 2017 by the Jinja Team.
:license: BSD, see LICENSE for more details.
"""
import operator
import re
from collections import Mapping
from jinja2.runtime import Undefined
from jinj... |
import logging
from django.core.urlresolvers import reverse
from django.utils.translation import pgettext_lazy
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ungettext_lazy
from horizon import exceptions
from horizon import tables
from openstack_dashboard import api
from ... |
import sys
try:
from ovirtsdk.api import API
from ovirtsdk.xml import params
except ImportError:
print "failed=True msg='ovirtsdk required for this module'"
sys.exit(1)
# ------------------------------------------------------------------- #
# create connection with API
#
def conn(url, user, password):... |
# -*- coding: utf-8 -*-
# ..#######.########.#######.##....#..######..######.########....###...########.#######.########..######.
# .##.....#.##.....#.##......###...#.##....#.##....#.##.....#...##.##..##.....#.##......##.....#.##....##
# .##.....#.##.....#.##......####..#.##......##......##.....#..##...##.##.....#.... |
"""Support for the MySQL database via Jython's zxjdbc JDBC connector.
JDBC Driver
-----------
The official MySQL JDBC driver is at
http://dev.mysql.com/downloads/connector/j/.
Connecting
----------
Connect string format:
mysql+zxjdbc://<user>:<password>@<hostname>[:<port>]/<database>
Character Sets
----------... |
import sys
import re
from .cxxtest_misc import abort
from . import cxx_parser
import re
def cstr( str ):
'''Convert a string to its C representation'''
return '"' + re.sub('\\\\', '\\\\\\\\', str ) + '"'
def scanInputFiles(files, _options):
'''Scan all input files for test suites'''
suites=[]
for ... |
import copy
from django import forms
from django.contrib.postgres.validators import (
ArrayMaxLengthValidator, ArrayMinLengthValidator,
)
from django.core.exceptions import ValidationError
from django.utils import six
from django.utils.safestring import mark_safe
from django.utils.translation import string_concat,... |
from Core.config import load_config
PA = load_config("pa.cfg") |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'status': ['preview'],
'supported_by': 'community',
'metadata_version': '1.1'}
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.redfish_utils ... |
'''
Created on 24 Aug 2017
Stack of plates
@author: igoroya
'''
from chapter3 import utils
class StackOfPlates(object):
'''
Represents a set of literal stacks plates
'''
def __init__(self, max_stack_size):
'''
Constructor
'''
self._stacks = [] # lazy init of 1st stac... |
"""
Tests for misc.py "replace" directive.
"""
from __init__ import DocutilsTestSupport
def suite():
s = DocutilsTestSupport.ParserTestSuite()
s.generateTests(totest)
return s
totest = {}
totest['replace'] = [
["""\
Test the |name| directive.
.. |name| replace:: "**replace**"
""",
"""\
<document sourc... |
from __future__ import unicode_literals
import datetime
from xml.dom import minidom
from django.contrib.sites.models import Site
from django.contrib.syndication import views
from django.core.exceptions import ImproperlyConfigured
from django.test import TestCase, override_settings
from django.test.utils import requir... |
from cgi import escape
import gzip as gzip_module
import logging
import re
import time
import types
import uuid
from cStringIO import StringIO
logger = logging.getLogger("wptserve")
def resolve_content(response):
rv = "".join(item for item in response.iter_content())
if type(rv) == unicode:
rv = rv.e... |
"""
Option parsing library for pycrc.
use as follows:
from crc_opt import Options
opt = Options()
opt.parse(sys.argv[1:])
"""
from optparse import OptionParser, Option, OptionValueError
from copy import copy
import sys
from crc_models import CrcModels
# Class Options
######################################... |
"""Functions shared by various parts of the code generator.
Extends IdlType and IdlUnion type with |enum_validation_expression| property.
Design doc: http://www.chromium.org/developers/design-documents/idl-compiler
"""
################################################################################
# Utility functi... |
import fnmatch
import json
from webkitpy.common.editdistance import edit_distance
from webkitpy.common.memoized import memoized
from webkitpy.common.system.filesystem import FileSystem
# The list of contributors have been moved to contributors.json
class Contributor(object):
def __init__(self, name, email_or_e... |
"""
The Netio switch component.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/switch.netio/
"""
import logging
from collections import namedtuple
from datetime import timedelta
import voluptuous as vol
from homeassistant.core import callback
from home... |
from openerp.osv import fields, osv
from openerp.tools.translate import _
class stock_invoice_onshipping(osv.osv_memory):
def _get_journal(self, cr, uid, context=None):
journal_obj = self.pool.get('account.journal')
journal_type = self._get_journal_type(cr, uid, context=context)
journals = ... |
# -*- coding: utf-8 -*-
from twisted.spread import pb
from twisted.internet import endpoints, task, defer
from os import environ
import functools
import treq
import lxml.html
import re
import Levenshtein
from urllib import parse as urlparse
import json
import sqlite3
import codecs
import simple_eval
import ipaddress
fr... |
from django.db import models
from django.core import serializers
from network.models import Interface
import subprocess
import os
import uuid
class Tools():
def create_key():
# create key
tmpkeyname = str(uuid.uuid4())
keycmd = "openvpn --genkey --secret /tmp/%s.key" % tmpkeyname
... |
#!/usr/bin/env python
# UserString is a wrapper around the native builtin string type.
# UserString instances should behave similar to builtin string objects.
import string
from test import test_support, string_tests
from UserString import UserString, MutableString
import warnings
class UserStringTest(
string_tes... |
import logging
from scap.model.oval_5.defs.windows.StateType import StateType
logger = logging.getLogger(__name__)
class WmiStateElement(StateType):
MODEL_MAP = {
'tag_name': 'wmi_state',
'elements': [
{'tag_name': 'namespace', 'class': 'scap.model.oval_5.defs.EntityStateType', 'min': ... |
import StringIO
import datetime
import sys
from django.http import HttpResponse
from django.template import loader
from django.utils.encoding import force_unicode, smart_unicode
from django.utils.html import escape
from django.utils.translation import ugettext as _
from django.utils.xmlutils import SimplerXMLGenerator... |
# coding: utf-8
from __future__ import unicode_literals
import json
from .common import InfoExtractor
from ..compat import compat_urllib_request
from ..utils import (
ExtractorError,
parse_iso8601,
)
class VesselIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?vessel\.com/videos/(?P<id>[0-9a-zA-Z]+)... |
'''
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id$'
from ctypes import *
from pyglet.gl import *
from pyglet.image import *
from pyglet.image.codecs import *
from pyglet.image.codecs import gif
import pyglet.lib
import pyglet.window
gdk = pyglet.lib.load_library('gdk-x11-2.0')
gdkpixbuf = pyglet.lib.lo... |
from typing import Any, Callable, Dict, Generic, Optional, TypeVar
import warnings
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpRe... |
# -*- coding:utf-8 -*-
# 使用 UTF-8
import sys
reload(sys)
sys.setdefaultencoding("utf-8")
class Node(object):
def __init__(self):
super(Node, self).__init__()
self.num = 0
self.keys = []
self.pnodes = []
self.isleaf = True
class BNode(Node):
def __init__(self, degree):... |
import os
import re
import socket
import time
import signal
try:
import paramiko
from paramiko.ssh_exception import AuthenticationException
HAS_PARAMIKO = True
except ImportError:
HAS_PARAMIKO = False
from ansible.module_utils.basic import get_exception
from ansible.module_utils.network import Network... |
from __future__ import unicode_literals
from django.db import connection, models
from django.db.backends.utils import truncate_name
from django.test import TestCase
from .models.article import Article, Site
from .models.publication import Publication
class Advertisement(models.Model):
customer = models.CharFiel... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
FieldPyculator.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
************************... |
from datetime import date
from . import base
from . import mixins
class TransformedRecord(mixins.GenericCompensationMixin,
mixins.GenericDepartmentMixin,
mixins.GenericJobTitleMixin,
mixins.MembershipMixin,
mixins.OrganizationMixin,
mixins.PostMixin,
mixins.RaceMixin,
... |
import difflib
class PseudoPatienceSequenceMatcher(difflib.SequenceMatcher):
"""Provides a SequenceMatcher that prefers longer "first" matches to longer
"second" matches.
"""
def get_matching_blocks(self):
"""Returns list of triples describing matching subsequences.
Each triple is of the form (i, j, ... |
"""A package (for Nevow) for defining the schema, validation and rendering of
HTML forms.
"""
version_info = (0, 12, 0)
version = '.'.join([str(i) for i in version_info])
from nevow import static
from formal.types import *
from formal.validation import *
from formal.widget import *
from formal.widgets.restwidget im... |
from django.urls import path
from . import views
urlpatterns = [
path('', views.economy_home, name='economy_home'),
path('deposit/', views.deposits, name='economy_deposit'),
path('deposit/<int:deposit_id>', views.deposit_detail, name='economy_deposit_detail'),
path('deposit/<int:deposit_id>/approve', v... |
#!/usr/bin/env python
from gnuradio import gr
from gnuradio import audio
from gnuradio import trellis
from gnuradio import eng_notation
import math
import sys
import fsm_utils
def run_test (f,Kb,bitspersymbol,K,dimensionality,constellation,N0,seed):
tb = gr.top_block ()
# TX
src = gr.lfsr_32k_source_s()
... |
class ModuleDocFragment(object):
# Avi common documentation fragment
DOCUMENTATION = """
options:
controller:
description:
- IP address or hostname of the controller. The default value is the environment variable C(AVI_CONTROLLER).
username:
description:
- Usernam... |
"""
==================
Find ECG artifacts
==================
Locate QRS component of ECG.
"""
# Authors: Alexandre Gramfort <<EMAIL>>
#
# License: BSD (3-clause)
import numpy as np
import matplotlib.pyplot as plt
import mne
from mne import io
from mne.datasets import sample
print(__doc__)
data_path = sample.data... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.