content string |
|---|
"""Copyright 2008 Orbitz WorldWide
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, software... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
try:
import shade
HAS_SHADE = True
except ImportError:
HAS_SHADE = False
def _present_volume(module, cloud):
if cloud.volume_exists(module.params['display_name']... |
"""
Convert use of sys.exitfunc to use the atexit module.
"""
from lib2to3 import pytree, fixer_base
from lib2to3.fixer_util import Name, Attr, Call, Comma, Newline, syms
class FixExitfunc(fixer_base.BaseFix):
keep_line_order = True
BM_compatible = True
PATTERN = """
(
s... |
#!/usr/bin/env python
# Created by Pearu Peterson, September 2002
from __future__ import division, print_function, absolute_import
__usage__ = """
Build fftpack:
python setup_fftpack.py build
Run tests if scipy is installed:
python -c 'import scipy;scipy.fftpack.test(<level>)'
Run tests if fftpack is not installe... |
"""Ecuaciones termodinamicas ideales para el calculo de propiedades termodinamicas
del Manual del ingeniero quimico Perry"""
from math import sinh, cosh
from scipy import integrate
import numpy as np
def antoine(T, C1, C2, C3, C4, C5):
"""Ecuación para calculo de presión de vapor (Pa)"""
return np.exp(C1 + ... |
# encoding: utf-8
import sublime, sublime_plugin
try:
from . import util
except ValueError:
import util
class PerformEventListener(sublime_plugin.EventListener):
"""Suggest subroutine completions for the perform statement."""
def on_query_completions(self, view, prefix, points):
if not util.... |
#!/usr/bin/python
# scriptlib.py by Ambrosa http://www.ambrosa.net
# derived from E2_LOADEPG
# 22-Dec-2011
__author__ = "ambrosa http://www.ambrosa.net"
__copyright__ = "Copyright (C) 2008-2011 Alessandro Ambrosini"
__license__ = "CreativeCommons by-nc-sa http://creativecommons.org/licenses/by-nc-sa/3.0/"
import os... |
import cPickle, re
from bisect import bisect_right
from time import time
from threading import Lock
from whoosh import __version__
from whoosh.fields import Schema
from whoosh.index import Index
from whoosh.index import EmptyIndexError, OutOfDateError, IndexVersionError
from whoosh.index import _DEF_INDEX_NAME
from wh... |
import sys
from gnuradio import filter
try:
from PyQt4 import QtGui, QtCore
import sip
except ImportError:
print "Error: Program requires PyQt4."
sys.exit(1)
try:
from gnuradio.qtgui.plot_from import plot_form
except ImportError:
from plot_form import plot_form
class plot_spectrogram_form(plo... |
import argparse
import gettext
import logging
import re
from itertools import zip_longest
from os import path, listdir
from xml.etree import ElementTree
# add an option to change the verbosity
logging.basicConfig(level=logging.INFO)
def getxmlfloc():
""" Returns the supposed location of the XML file
"""
... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'
}
import traceback
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils._text import to_native... |
from __future__ import with_statement
from contextlib import contextmanager
from copy import deepcopy
from fudge.patcher import with_patched_object
from functools import partial
from types import StringTypes
import copy
import getpass
import os
import re
import shutil
import sys
import tempfile
from fudge import Fake... |
import pygame
from abstractscreen import AbstractScreen
from settings import *
S = Settings()
instance = None
# Behaves like the actual LED screen, but shows the screen content on a computer screen
class VirtualScreen(AbstractScreen):
def __init__(self,
width=int(S.get('screen', 'matrix_width'... |
# Exercise 43: Basic Object-Oriented Analysis and Design
# Process to build something to evolve problems
# 1. Write or draw about the problem.
# 2. Extract key concepts from 1 and research them.
# 3. Create a class hierarchy and object map for the concepts.
# 4. Code the classes and a test to run them.
# 5. Repeat and... |
class ModuleDocFragment(object):
# Standard files documentation fragment
DOCUMENTATION = """
options:
file_mode:
description:
- Don't connect to any device, only use I(config_file) as input and Output.
default: false
type: bool
version_added: "2.4"
config_file:
description:
... |
"""
Test for export all courses.
"""
import shutil
from tempfile import mkdtemp
from contentstore.management.commands.export_all_courses import export_courses_to_output_path
from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.django import modulestore
from xmodule.modulestore.tests.django_utils i... |
"""
mysensors platform that offers a Climate(MySensors-HVAC) component.
For more details about this platform, please refer to the documentation
https://home-assistant.io/components/climate.mysensors
"""
import logging
from homeassistant.components import mysensors
from homeassistant.components.climate import (
ST... |
from __future__ import absolute_import
import logging
import time
import select
from tornado import ioloop
from django.conf import settings
try:
# Tornado 2.4
orig_poll_impl = ioloop._poll
def instrument_tornado_ioloop():
ioloop._poll = InstrumentedPoll
except:
# Tornado 3
from tornado.iol... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.errors import AnsibleError
from ansible.plugins.action import ActionBase
from ansible.utils.boolean import boolean
class ActionModule(ActionBase):
TRANSFERS_FILES = False
def run(self, tmp=None, task_vars=di... |
import sale
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
"""Tests for type_check."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy
from tensorflow.python.autograph.utils import type_check
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import test_util
from ten... |
from django.apps import apps
from django.core import management
from django.db.models import signals
from django.test import TestCase, override_settings
from django.utils import six
APP_CONFIG = apps.get_app_config('migrate_signals')
PRE_MIGRATE_ARGS = ['app_config', 'verbosity', 'interactive', 'using']
MIGRATE_DATABA... |
import sys
import subprocess
if sys.version_info[0] < 3:
cuni = unicode
else:
def to_utf8(s):
return s.decode("utf-8", errors = 'replace')
cuni = to_utf8
def get_svn_revision(path=""):
stdout = ""
try:
p = subprocess.Popen("svnversion -n \"%s\"" % path, shell=True,
... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime
from django.core.files.uploadedfile import SimpleUploadedFile
from django.db import models
from django.forms import (
CharField, FileField, Form, ModelChoiceField, ModelForm,
)
from django.forms.models import ModelFormMetaclass
from d... |
from BusTrack.repository import Base
from BusTrack.repository import engine
# import all relevant db models here.
from BusTrack.repository.models.Bus import Bus
from BusTrack.repository.models.UserType import UserType
from BusTrack.repository.models.User import User
from BusTrack.repository.models.UserLogin import Use... |
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'network'}
import re
from ansible.module_utils.network.nxos.nxos import get_config, load_config, run_commands
from ansible.module_utils.network.nxos.nxos import nxos_argument_spec, check_args... |
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'network'}
import re
from ansible.module_utils.nxos import get_config, load_config, run_commands
from ansible.module_utils.nxos import nxos_argument_spec, check_args
from ansible.module_utils.... |
"""
Module to control libvirtd service.
"""
import re
import logging
import aexpect
from avocado.utils import path
from avocado.utils import process
from avocado.utils import wait
from . import remote
from . import utils_misc
from .staging import service
from .utils_gdb import GDB
try:
path.find_command("libvirt... |
from __future__ import absolute_import
import imp
import logging
import os
import sys
import tempfile
from pip.compat import uses_pycache, WINDOWS
from pip.exceptions import UninstallationError
from pip.utils import (rmtree, ask, is_local, dist_is_local, renames,
normalize_path)
from pip.utils.... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
import re
from copy import deepcopy
from time import sleep
from ansible.module_utils._tex... |
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
from horizon import tables
from openstack_dashboard import api
class SpecCreateKeyValuePair(tables.LinkAction):
# this is to create a spec key-value pair for an existing QOS Spec
name = "create"
verbose_... |
# Test the runpy module
import unittest
import os
import os.path
import sys
import re
import tempfile
import py_compile
from test.support import forget, make_legacy_pyc, run_unittest, unload, verbose
from test.script_helper import (
make_pkg, make_script, make_zip_pkg, make_zip_script, temp_dir)
from runpy import... |
import RPi.GPIO as GPIO
from time import sleep as sleep
'''
Defining class to handle shifing data out to shift register
OutPin = output pin
ClkPin = clock Pin
Len = length of data in bytes (default 1 Byte)
Speed = delay between each bit (Default 0.01 sec)
'''
# Keyword args, ie: def my_function(*args... |
import unittest
import heron.common.tests.python.utils.mock_generator as mock_generator
class OutgoingTupleHelperTest(unittest.TestCase):
DEFAULT_STREAM_ID = "stream_id"
def setUp(self):
pass
def test_sample_success(self):
out_helper = mock_generator.MockOutgoingTupleHelper()
prim_data_tuple, size... |
"""Build script to generate a new sdk_tools bundle.
This script packages the files necessary to generate the SDK updater -- the
tool users run to download new bundles, update existing bundles, etc.
"""
import buildbot_common
import build_version
import glob
import optparse
import os
import sys
SCRIPT_DIR = os.path.d... |
import unittest
from zang.inboundxml.elements.say import Say
from zang.inboundxml.elements.base_node import BaseNode
from zang.inboundxml.elements.enums.voice import Voice
class TestSay(unittest.TestCase):
def setUp(self):
self.text = 'Hello from Zang'
def test_init_with_required_values(self):
... |
from frasco import current_app
from frasco.ext import get_extension_state
from suds.client import Client as SudsClient
from suds import WebFault
import xml.etree.ElementTree as ET
import requests
import datetime
EU_COUNTRIES = {
"AT": "EUR", # Austria
"BE": "EUR", # Belgium
"BG": "BGN", # Bulgaria
"DE... |
from __future__ import absolute_import, unicode_literals
from functools import update_wrapper
from django.db import connection
from django.test import TestCase, skipUnlessDBFeature, skipIfDBFeature
from django.utils import six, unittest
from .models import Reporter, Article
if connection.vendor == 'oracle':
exp... |
import time
from telemetry.results import progress_reporter
from telemetry.value import failure
from telemetry.value import skip
class GTestProgressReporter(progress_reporter.ProgressReporter):
"""A progress reporter that outputs the progress report in gtest style."""
def __init__(self, output_stream, output_sk... |
from __future__ import absolute_import
import errno
import os
import posixpath
import stat
from . import encoding, error, pycompat, util
from .i18n import _
def _lowerclean(s):
return encoding.hfsignoreclean(s.lower())
class pathauditor(object):
"""ensure that a filesystem path contains no banned componen... |
"""
PostgreSQL database backend for Django.
Requires psycopg 2: http://initd.org/projects/psycopg2
"""
import logging
import sys
from django.db.backends import *
from django.db.backends.postgresql_psycopg2.operations import DatabaseOperations
from django.db.backends.postgresql_psycopg2.client import DatabaseClient
fr... |
#!/usr/bin/env python
# Nom nom nom nom
# TODO: there is currently a dependency on the order of initialization of
# client and server... . for example:
# $ pox.py nom_client nom_server # blocks indefinitely
# whereas
# $ pox.py nom_server nom_client # works
from pox.core import core, UpEvent
from pox.lib.r... |
import logging
import os
import time
from itertools import cycle
import numpy as np
import torch
import torch.optim
import torch.utils.data
from apex.parallel import DistributedDataParallel as DDP
from apex.optimizers import FusedAdam
from apex import amp
import mlperf_compliance
from seq2seq.train.fp_optimizers impo... |
# Generated from 'Components.h'
def FOUR_CHAR_CODE(x): return x
kAppleManufacturer = FOUR_CHAR_CODE('appl')
kComponentResourceType = FOUR_CHAR_CODE('thng')
kComponentAliasResourceType = FOUR_CHAR_CODE('thga')
kAnyComponentType = 0
kAnyComponentSubType = 0
kAnyComponentManufacturer = 0
kAnyComponentFlagsMask = 0
cmpIsM... |
import gdb
from linux import cpus, utils
module_type = utils.CachedType("struct module")
def module_list():
global module_type
module_ptr_type = module_type.get_type().pointer()
modules = gdb.parse_and_eval("modules")
entry = modules['next']
end_of_list = modules.address
while entry != end... |
#!/usr/bin/env python
from __future__ import print_function
import os
from posixpath import basename
from six.moves.urllib.parse import urlparse
from .common.spiders import BaseDocumentationSpider
from typing import Any, List, Set
def get_help_images_dir(help_images_path):
# type: (str) -> str
# Get index... |
import calendar
import datetime as dt
from locale import LC_ALL, LC_TIME, getlocale, setlocale
from click import style
from .terminal import colored
from .utils import get_month_abbr_len
setlocale(LC_ALL, '')
def get_weekheader(firstweekday):
try:
mylocale = '.'.join(getlocale(LC_TIME))
except Type... |
# -*- coding: utf-8 -*-
r"""
werkzeug.contrib.sessions
~~~~~~~~~~~~~~~~~~~~~~~~~
This module contains some helper classes that help one to add session
support to a python WSGI application. For full client-side session
storage see :mod:`~werkzeug.contrib.securecookie` which implements a
secure,... |
"""
Text Segmentation Metrics
1. Windowdiff
Pevzner, L., and Hearst, M., A Critique and Improvement of
an Evaluation Metric for Text Segmentation,
Computational Linguistics 28, 19-36
2. Generalized Hamming Distance
Bookstein A., Kulyukin V.A., Raita T.
Generalized Hamming Distance
Information Retrieval 5, 2002, ... |
# pylint: disable=C0111
# pylint: disable=W0621
from lettuce import world, step
from common import *
from nose.tools import assert_true, assert_false, assert_equal # pylint: disable=E0611
from logging import getLogger
logger = getLogger(__name__)
@step(u'I have a course with no sections$')
def have_a_course(step):... |
"""
Simple tester for the vgg19_trainable
"""
import tensorflow as tf
from tensoflow_vgg import vgg19_trainable as vgg19
from tensoflow_vgg import utils
img1 = utils.load_image("./test_data/tiger.jpeg")
img1_true_result = [1 if i == 292 else 0 for i in range(1000)] # 1-hot result for tiger
batch1 = img1.reshape((1... |
from __future__ import absolute_import, division, unicode_literals
from six import text_type
from lxml import etree
from ..treebuilders.etree import tag_regexp
from gettext import gettext
_ = gettext
from . import _base
from .. import ihatexml
def ensure_str(s):
if s is None:
return None
elif isin... |
from m5.params import *
from BaseCPU import BaseCPU
class CheckerCPU(BaseCPU):
type = 'CheckerCPU'
abstract = True
cxx_header = "cpu/checker/cpu.hh"
exitOnError = Param.Bool(False, "Exit on an error")
updateOnError = Param.Bool(False,
"Update the checker with the main CPU's state on an erro... |
"""
An implementation of an object that acts like a collection of on/off bits.
"""
import operator
from array import array
from bisect import bisect_left, bisect_right, insort
from whoosh.compat import integer_types, izip, izip_longest, next, xrange
from whoosh.util.numeric import bytes_for_bits
# Number of '1' bit... |
import array, sys
# Run time aliasing of Python2/3 differences
def htmlescape(s, quote=True):
# this is html.escape reimplemented with cgi.escape,
# so it works for python 2.x, 3.0 and 3.1
import cgi
s = cgi.escape(s, quote)
if quote:
# python 3.2 also replaces the single quotes:
... |
#!python3
"""
Project: Voltcraft Data Analyzer
Author: Valer Bocan, PhD <<EMAIL>>
Last updated: September 14th, 2014
Module
description: The VoltcraftDataFile module processes data files containing history of voltage, current and power factor,
as generated by the Voltcraft Energy-Logger 4000.... |
from django.test import TestCase
from django.urls import reverse, NoReverseMatch
class URLTest(TestCase):
def test_email_allows_slash(self):
try:
reverse('list_member_options', kwargs={
'list_id': 'test.example.com',
'email': 'slashed/are/<EMAIL>',
... |
from distutils.core import setup
setup(
name="more_collections",
packages = ['more_collections'],
version="0.3.0",
author="Mario Wenzel",
author_email="<EMAIL>",
url="https://github.com/maweki/more-collections",
description="more_collections is a Python library providing more collections (m... |
import telemetry.timeline.counter as tracing_counter
import telemetry.timeline.event as event_module
import telemetry.timeline.event_container as event_container
import telemetry.timeline.thread as tracing_thread
class Process(event_container.TimelineEventContainer):
''' The Process represents a single userland pro... |
# -*- coding: utf-8 -*-
"""
pygments.formatters.terminal
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Formatter for terminal output with ANSI sequences.
:copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import sys
from pygments.formatter import Format... |
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['deprecated'],
'supported_by': 'community'}
from ansible.module_utils.basic import AnsibleModule
try:
import pan.xapi
from pan.xapi import PanXapiError
import pandevice
from pandevice import base
from... |
r"""Installs files needed for tornado testing on windows.
These instructions are compatible with the VMs provided by http://modern.ie.
The bootstrapping script works on the WinXP/IE6 and Win8/IE10 configurations,
although tornado's tests do not pass on XP.
1) Install virtualbox guest additions (from the device menu i... |
from superdesk.locators.locators import find_cities
import logging
from apps.archive.common import format_dateline_to_locmmmddsrc
from superdesk.utc import get_date
import superdesk
from superdesk.metadata.item import CONTENT_TYPE
from apps.publish.content.common import ITEM_PUBLISH
logger = logging.getLogger(__name__... |
"""
pkgdata is a simple, extensible way for a package to acquire data file
resources.
The getResource function is equivalent to the standard idioms, such as
the following minimal implementation::
import sys, os
def getResource(identifier, pkgname=__name__):
pkgpath = os.path.dirname(sys.modules[pkgna... |
import struct, os, time
from config import config, ConfigSelection, ConfigYesNo, ConfigSubsection, ConfigText
from enigma import eHdmiCEC, eActionMap
from Components.VolumeControl import VolumeControl
from Tools.StbHardware import getFPWasTimerWakeup
from enigma import eTimer
from Screens import Standby
from Tools impo... |
import os
import xapian
from djapian.utils.decorators import reopen_if_modified
class Database(object):
def __init__(self, path):
self._path = path
def open(self, write=False):
"""
Opens database for manipulations
"""
if not os.path.exists(self._path):
os.m... |
""" Returns information about a module """
import os
from ..tools import get_modname
from .base import ModTool, ModToolException
class ModToolInfo(ModTool):
""" Return information about a given module """
name = 'info'
description = 'Return information about a given module.'
def __init__(self, pyt... |
import sys
import unittest
import pywintypes
import time
from pywin32_testutil import str2bytes, ob2memory
import datetime
import operator
class TestCase(unittest.TestCase):
def testPyTimeFormat(self):
struct_current = time.localtime()
pytime_current = pywintypes.Time(struct_current)
# try ... |
#!/usr/bin/env python
#https://docs.python.org/dev/library/ssl.html
import socket, ssl
def server():
bindsocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
bindsocket.bind(('127.0.0.1', 10000))
bindsocket.listen(5)
print "Listening for a connection"
tls_serv = ssl.wrap_socket(bindsocket, ... |
"""
linguistics module (imdb package).
This module provides functions and data to handle in a smart way
languages and articles (in various languages) at the beginning of movie titles.
Copyright 2009-2012 Davide Alberani <<EMAIL>>
2012 Alberto Malagoli <albemala AT gmail.com>
2009 H. Turgut Uyar <<... |
import numpy as np
import pytest
from sklearn import config_context
from sklearn.impute import KNNImputer
from sklearn.metrics.pairwise import nan_euclidean_distances
from sklearn.metrics.pairwise import pairwise_distances
from sklearn.neighbors import KNeighborsRegressor
from sklearn.utils._testing import assert_allc... |
from distutils.command.build_ext import build_ext as _du_build_ext
try:
# Attempt to use Pyrex for building extensions, if available
from Pyrex.Distutils.build_ext import build_ext as _build_ext
except ImportError:
_build_ext = _du_build_ext
import os, sys
from distutils.file_util import copy_file
from set... |
#encoding: utf-8
import datetime
from django.db.models.signals import post_save, pre_delete, post_delete
from django.contrib.contenttypes.models import ContentType
from planet.models import Feed, Post
from actstream import action
from actstream.models import Follow
from knesset.utils import cannonize, disable_for_loadd... |
import random
import pytest
from learning import DataSet
from probabilistic_learning import *
random.seed("aima-python")
def test_naive_bayes():
iris = DataSet(name='iris')
# discrete
nbd = NaiveBayesLearner(iris, continuous=False)
assert nbd([5, 3, 1, 0.1]) == 'setosa'
assert nbd([6, 3, 4, 1.1... |
import random
import sqlalchemy as sa
from sqlalchemy import orm
from sqlalchemy.orm import joinedload
from neutron.common import constants
from neutron.db import agents_db
from neutron.db import agentschedulers_db
from neutron.db import model_base
from neutron.extensions import lbaas_agentscheduler
from neutron.open... |
import os
import signal
import subprocess
import time
class BrowserProcessBase(object):
def __init__(self, handle):
self.handle = handle
print 'PID', self.handle.pid
def GetReturnCode(self):
return self.handle.returncode
def IsRunning(self):
return self.handle.poll() is None
def Wait(self, ... |
from openerp.osv import fields, orm
class travel_passenger(orm.Model):
_inherit = 'travel.passenger'
_columns = {
'passport_id': fields.many2one('res.passport', 'Passport',
help="Passport to use on Travel."),
} |
import os
import unittest
from . import TEST_DATA_DIR
from FastxIO import fastx
class TestFastq(unittest.TestCase):
def setUp(self):
self.fastq_file = os.path.join(TEST_DATA_DIR, "test.fastq")
self.gz_fastq_file = os.path.join(TEST_DATA_DIR, "test.fastq.gz")
self.windows_fastq_file = os.p... |
from struct import pack, unpack
def bucket_stats(l):
"""given a list of khashmir instances, finds min, max, and average number of nodes in tables"""
max = avg = 0
min = None
def count(buckets):
c = 0
for bucket in buckets:
c = c + len(bucket.l)
return c
for node ... |
import requests
from mycroft.tts import TTSValidator
from mycroft.tts.remote_tts import RemoteTTS
__author__ = 'jdorleans'
class FATTS(RemoteTTS):
PARAMS = {
'voice[name]': 'cmu-slt-hsmm',
'input[type]': 'TEXT',
'input[locale]': 'en_US',
'input[content]': 'Hello World',
'... |
# -*- coding: utf-8 -*-
'''
Manage PHP pecl extensions.
'''
from __future__ import absolute_import
# Import python libs
import re
import logging
try:
from shlex import quote as _cmd_quote # pylint: disable=E0611
except ImportError:
from pipes import quote as _cmd_quote
# Import salt libs
import salt.utils
... |
__version__ = "1.1"
from struct import pack
from binascii import b2a_hex
from random import randint
from base64 import b64encode
from beaker.crypto.util import hmac as HMAC, hmac_sha1 as SHA1
def strxor(a, b):
return "".join([chr(ord(x) ^ ord(y)) for (x, y) in zip(a, b)])
class PBKDF2(object):
"""PBKDF2.py... |
# -*- coding: utf-8 -*-
import time
from module.plugins.internal.Account import Account
from module.common.json_layer import json_loads
class FileserveCom(Account):
__name__ = "FileserveCom"
__type__ = "account"
__version__ = "0.22"
__status__ = "testing"
__description__ = """Fileserve.c... |
from django.contrib.admin import SimpleListFilter
from django.utils.translation import ugettext as _
from appointment.function_def import manager_list_of_calendar_user
from appointment.models.users import CalendarUserProfile
class ManagerFilter(SimpleListFilter):
title = _('manager')
parameter_name = 'manager... |
#! /usr/bin/env python
#
# Implementation of elliptic curves, for cryptographic applications.
#
# This module doesn't provide any way to choose a random elliptic
# curve, nor to verify that an elliptic curve was chosen randomly,
# because one can simply use NIST's standard curves.
#
# Notes from X9.62-1998 (draft):
# ... |
"""
Tests course_creators.admin.py.
"""
from django.test import TestCase
from django.contrib.auth.models import User
from django.contrib.admin.sites import AdminSite
from django.http import HttpRequest
import mock
from course_creators.admin import CourseCreatorAdmin
from course_creators.models import CourseCreator
fr... |
import logging
import os
import tempfile
import getpass
import werkzeug.urls
import werkzeug.exceptions
from openid import oidutil
from openid.store import filestore
from openid.consumer import consumer
from openid.cryptutil import randomString
from openid.extensions import ax, sreg
import openerp
from openerp impor... |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
import logging
from flexget import plugin
from flexget.event import event
log = logging.getLogger("archetorrent")
class UrlRewriteArchetorrent(object):
"""Archetorr... |
"""
Verifies simple build of a "Hello, world!" program with shared libraries,
including verifying that libraries are rebuilt correctly when functions
move between libraries.
"""
import TestGyp
test = TestGyp.TestGyp()
test.run_gyp('library.gyp',
'-Dlibrary=shared_library',
'-Dmoveable_funct... |
"""add port-security in ml2
Revision ID: 35a0f3365720
Revises: 341ee8a4ccb5
Create Date: 2014-09-30 09:41:14.146519
"""
# revision identifiers, used by Alembic.
revision = '35a0f3365720'
down_revision = '341ee8a4ccb5'
from alembic import op
def upgrade():
context = op.get_context()
if context.bind.dialec... |
"""Misc subprocess tests"""
import unittest
import os
import sys
import signal
import time
from test import test_support
from subprocess import PIPE, Popen, _cmdline2list
class TerminationAndSignalTest(unittest.TestCase):
def setUp(self):
program = '''
import signal, sys
def print_signal(signum, frame):... |
import urllib
import json
from openerp import models, fields, api
class ResBannedRemote(models.Model):
_name = 'res.banned.remote'
_rec_name = 'remote'
_GEOLOCALISATION_URL = "http://ip-api.com/json/{}"
# Default Section
def _default_ban_date(self):
return fields.Datetime.now()
# C... |
from sympy import Matrix, Tuple, symbols, sympify, Basic, Dict, S, FiniteSet, Integer
from sympy.core.containers import tuple_wrapper
from sympy.utilities.pytest import raises
from sympy.core.compatibility import is_sequence, iterable, u, range
def test_Tuple():
t = (1, 2, 3, 4)
st = Tuple(*t)
assert set(... |
# -- coding: utf-8 --
#from ptrace.debugger.child import createChild
from os import system, dup2, close, open as fopen, O_RDONLY
from sys import stdin
from os import (
fork, execv, execve, getpid,
close, dup2, devnull, O_RDONLY)
from ptrace.binding import ptrace_traceme
from ptrace import PtraceError
from re... |
import os
import socket
import ssl
from thrift.transport import TSocket
from thrift.transport.TTransport import TTransportException
class TSSLSocket(TSocket.TSocket):
"""
SSL implementation of client-side TSocket
This class creates outbound sockets wrapped using the
python standard ssl module for encrypted ... |
# -*- coding: utf-8 -*-
from django.conf.urls import url, include
from django.views.decorators.csrf import csrf_exempt
from rest_framework import routers
from . import api
from . import views
api_router = routers.DefaultRouter()
api_router.register(r'topics', api.TopicApiView)
api_router.register(r'post', api.PostApiV... |
ANSIBLE_METADATA = {'status': ['preview'], 'supported_by': 'community', 'version': '1.0'}
from ansible.module_utils.basic import AnsibleModule
try:
from ansible.module_utils.avi import (
avi_common_argument_spec, HAS_AVI, avi_ansible_api)
except ImportError:
HAS_AVI = False
def main():
argument_... |
import unittest
from unittest.mock import MagicMock
from moto import mock_sqs
from airflow import DAG
from airflow.providers.amazon.aws.hooks.sqs import SQSHook
from airflow.providers.amazon.aws.operators.sqs import SQSPublishOperator
from airflow.utils import timezone
DEFAULT_DATE = timezone.datetime(2019, 1, 1)
... |
import os.path
class CompsIcons:
'''
This class manages the access to group name and icons
'''
def __init__(self, rpm_groups, icon_path=None):
if icon_path:
self.icon_path = icon_path if icon_path.endswith("/") else icon_path + "/"
else:
self.icon_path = "/usr/s... |
import os
SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
CHROME_SRC = os.path.dirname(SCRIPT_DIR)
def apply_gyp_environment_from_file(file_path):
"""Reads in a *.gyp_env file and applies the valid keys to os.environ."""
if not os.path.exists(file_path):
return
with open(file_path, 'rU') as f:
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.