content stringlengths 4 20k |
|---|
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
def calc_usage(blockdir):
return sum(os.path.getsize(blockdir+f) for f in os.listdir(blockdir) if os.path.isfile(blockdir+f)) / (1024. * 1024.)
class PruneTest(BitcoinTestFramework):
def __init__(self):
s... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.plugins.action import ActionBase
class ActionModule(ActionBase):
TRANSFERS_FILES = False
def run(self, tmp=None, task_vars=None):
if task_vars is None:
task_vars = dict()
if self... |
#!/usr/bin/env
# -*- coding: utf-8 -*-
"""Migrates old-style unregistered users (dictionaries in Node#contributor_list)
to actual User records.
"""
import logging
from modularodm.exceptions import ValidationValueError
from website import app, models
from framework import auth
from framework.auth import Auth
from tests... |
from muntjac.api import \
(VerticalLayout, VerticalSplitPanel, Label, HorizontalSplitPanel,
CheckBox)
from muntjac.ui.button import IClickListener
from muntjac.terminal.sizeable import ISizeable
class SplitPanelBasicExample(VerticalLayout):
brownFox = ('The quick brown fox jumps over the lazy dog. '
... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
import subprocess
from contextlib import closing
from StringIO import StringIO
from pants.goal.goal import Goal
from pants.ivy.bootstrapper import Bootstrap... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
import re
import sys
import os
import glob
from . import helper
from .mockable_test_result import MockableTestResult
from runner import path_to_enlightenment
from libs.colorama import init, Fore, Style
init() # init colorama
class Sensei(MockableTestResu... |
#!/usr/bin/env python
"""
@package mi.dataset.parser.test
@file marine-integrations/mi/dataset/parser/test/test_vel3d_k_wfp_stc.py
@author Steve Myerson (Raytheon)
@brief Test code for a vel3d_k_wfp_stc data parser
"""
import os
from StringIO import StringIO
import ntplib
from nose.plugins.attrib import attr
from m... |
"""Plot drainage network.
"""
# KRB, FEB 2017.
import six
from landlab import CORE_NODE, FIXED_VALUE_BOUNDARY, FIXED_GRADIENT_BOUNDARY, CLOSED_BOUNDARY
import matplotlib.pylab as plt
from landlab.plot.imshow import imshow_node_grid
import numpy as np
def drainage_plot(mg,
surface='topographic__elev... |
import re
from loguru import logger
from flexget import plugin
from flexget.entry import Entry
from flexget.event import event
from flexget.utils.cached_input import cached
from flexget.utils.requests import RequestException
from flexget.utils.soup import get_soup
logger = logger.bind(name='horriblesubs')
class Ho... |
"""
Select reactor
"""
from __future__ import division, absolute_import
from time import sleep
import sys, select, socket
from errno import EINTR, EBADF
from zope.interface import implementer
from twisted.internet.interfaces import IReactorFDSet
from twisted.internet import posixbase
from twisted.python import log
... |
# -*- coding: utf-8 -*-
from django.db import models
from django.contrib.auth.models import User
from pyuploadcare.dj import ImageField
class Category(models.model):
"""Model for ingredient's category"""
name = models.CharField(max_length=100)
def __unicode__(self):
return self.name
class Ingre... |
from datetime import datetime, time
from django.shortcuts import render, get_object_or_404, redirect
from django.contrib.auth.decorators import login_required
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.contrib.auth.decorators import user_passes_test
from django.contrib.auth.de... |
import warnings
from django import test
from django.contrib.contenttypes.fields import GenericRelation
from django.core.exceptions import FieldDoesNotExist
from django.db.models.fields import CharField, related
from django.utils.deprecation import RemovedInDjango20Warning
from .models import BasePerson, Person
from .... |
import os
import shutil
import tempfile
import dnf
class DnfBaseWrapper(object):
def __init__(self, arch=None, cache_dir=None):
# prepopulate dict, everything else is redirected to the base object
self.__dict__["tmp_dir"] = None
self.__dict__["base"] = None
self.__dict__["conf"] =... |
__author__ = 'Ming'
import numpy as np
import cv2
import serial
import pygame
from pygame.locals import *
import socket
class TextPrint:
def __init__(self):
self.reset()
self.font = pygame.font.Font(None, 20)
self.x = 10
self.y = 10
self.line_height = 15
self.black ... |
"""Masks one `Series` based on the content of another `Series`."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.contrib.learn.python.learn.dataframe import transform
from tensorflow.python.ops import string_ops
class HashFast(transform.... |
CTRL_A = chr(1)
CTRL_B = chr(2)
CTRL_C = chr(3)
CTRL_D = chr(4)
CTRL_E = chr(5)
CTRL_F = chr(6)
CTRL_K = chr(11)
CTRL_L = chr(12)
CTRL_N = chr(14)
CTRL_P = chr(16)
CTRL_W = chr(23)
CTRL_Y = chr(25)
ALT_B = chr(27) + chr(98)
ALT_D = chr(27) + chr(100)
ALT_F = chr(27) + chr(102)
ALT_BKSPACE = chr(27) + chr(127)
DEL = chr... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
import traceback
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.ovirt import (
check_sdk,
create_connection,
get_dict_of_struct,
o... |
import pickle
import datetime
from django.test import TestCase
from models import Group, Event, Happening
class PickleabilityTestCase(TestCase):
def assert_pickles(self, qs):
self.assertEqual(list(pickle.loads(pickle.dumps(qs))), list(qs))
def test_related_field(self):
g = Group.objects.cre... |
from telemetry.page.actions.all_page_actions import *
from telemetry.page import page as page_module
from telemetry.page import page_set as page_set_module
class MemoryTestsPage(page_module.Page):
def __init__(self, page_set):
super(MemoryTestsPage, self).__init__(
url='file://../../data/gpu/mem_css3d.ht... |
import configparser
import importlib
import os
from collections import defaultdict
from typing import Dict, List, Optional
from django.conf import settings
from django.db.models import Sum
from django.db.models.functions import Length
from django.db.models.query import F
from zerver.models import BotConfigData, UserP... |
"""Implementation of JSONEncoder
"""
import re
try:
from simplejson._speedups import encode_basestring_ascii as c_encode_basestring_ascii
except ImportError:
c_encode_basestring_ascii = None
try:
from simplejson._speedups import make_encoder as c_make_encoder
except ImportError:
c_make_encoder = None
... |
from __future__ import unicode_literals
from django.conf import settings
from django.db import models
from django.utils import timezone
from django.utils.encoding import python_2_unicode_compatible
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
# Compatibi... |
"""
Serialization
``django.core.serializers`` provides interfaces to converting Django
``QuerySet`` objects to and from "flat" data (i.e. strings).
"""
from decimal import Decimal
from django.db import models
class CategoryMetaDataManager(models.Manager):
def get_by_natural_key(self, kind, name):
retur... |
import textwrap
from pip.locations import build_prefix, src_prefix
from pip.util import display_path, backup_dir
from pip.log import logger
from pip.exceptions import InstallationError
from pip.commands.install import InstallCommand
class BundleCommand(InstallCommand):
"""Create pybundles (archives containing mul... |
"""Tests for contrib.seq2seq.python.seq2seq.decoder."""
# pylint: disable=unused-import,g-bad-import-order
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# pylint: enable=unused-import
import sys
# TODO(jart): #6568 Remove this hack that makes dlopen() not... |
# -*- coding: utf-8 -*-
"""
An alphabetical list of provinces for use as `choices` in a formfield.
Reference:
http://en.wikipedia.org/wiki/ISO_3166-2:CN
http://en.wikipedia.org/wiki/Province_%28China%29
http://en.wikipedia.org/wiki/Direct-controlled_municipality
http://en.wikipedia.org/wiki/Autonomous_regions_of_Chin... |
from __future__ import print_function
import numpy as np
import cntk
from cntk.ops.functions import load_model
def LoadData(fn,is_training):
n=".\\Data\\"+fn
datainp=cntk.io.StreamDef("features",45)
dataout=cntk.io.StreamDef("labels",3,is_sparse=True)
dataall=cntk.io.StreamDefs(features=datainp,labels=... |
#!/usr/bin/python3
"""
picoCTF API Startup script
"""
import api
from argparse import ArgumentParser
from api.app import app
def main():
"""
Runtime management of the picoCTF API
"""
parser = ArgumentParser(description="picoCTF API configuration")
parser.add_argument("-v", "--verbose", action="... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['stableinterface'],
'supported_by': 'community'}
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.cloudstack import (
AnsibleCloudStack,
CloudStackException,
cs_argument_spec,
... |
from datetime import datetime, timedelta
from django.contrib.auth import get_user_model
from django.core.urlresolvers import reverse
from django.test import TestCase
from tastypie.test import ResourceTestCaseMixin
from django.contrib.auth.models import Group
from geonode.groups.models import GroupProfile
from guardian... |
# 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):
# Changing field 'UserProfile.meta'
db.alter_column('auth_userprofile', 'meta', self.gf('django.db.models.fields.... |
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
class VLAN(object):
def __init_... |
from msrest.pipeline import ClientRawResponse
from msrestazure.azure_exceptions import CloudError
from msrestazure.azure_operation import AzureOperationPoller
import uuid
from .. import models
class LROsCustomHeaderOperations(object):
"""LROsCustomHeaderOperations operations.
:param client: Client for servi... |
# coding=UTF-8
"""
tests for overrides
"""
import datetime
import mock
import pytz
from nose.plugins.attrib import attr
from courseware.field_overrides import OverrideFieldData # pylint: disable=import-error
from django.test.utils import override_settings
from request_cache.middleware import RequestCache
from student... |
'''The 'grit build' tool along with integration for this tool with the
SCons build system.
'''
import filecmp
import getopt
import os
import shutil
import sys
from grit import grd_reader
from grit import util
from grit.tool import interface
from grit import shortcuts
# It would be cleaner to have each module regist... |
"""
Prerequis
---------
Discussion facebook dans le folder: messages.htm
To run
------
git clone https://github.com/ownaginatious/fbchat-archive-parser.git
cd fbchat-archive-parser
python setup.py install
fbcap messages.htm -r -f json > file.json
-r: utile pour remplacer les ids par les vrais noms. Vu que c'est ... |
import datetime
from django.conf import settings
from django.contrib.admin.util import lookup_field, display_for_field, label_for_field
from django.contrib.admin.views.main import ALL_VAR, EMPTY_CHANGELIST_VALUE
from django.contrib.admin.views.main import ORDER_VAR, ORDER_TYPE_VAR, PAGE_VAR, SEARCH_VAR
from django.cor... |
#!/usr/bin/env python3
"""Read all test files for a particular file format using a single
importer instance. Read them again in reversed order. This is used
to verify that a loader does proper cleanup and can be called
repeatedly."""
import sys
import os
import subprocess
# hack-load utils.py and settings.py from ..... |
import datetime
import json
import pytest
from django.http.response import Http404
from django.test import override_settings
from django.utils.timezone import now
from shuup.admin.shop_provider import set_shop
from shuup.core.models import Shop
from shuup.discounts.admin.views import (
ArchivedDiscountListView, D... |
"""Test JSON."""
import unittest
from . import validate_json_format
import os
import fnmatch
class TestSettings(unittest.TestCase):
"""Test JSON settings."""
def _get_json_files(self, pattern, folder='.'):
"""Get JSON files."""
for root, dirnames, filenames in os.walk(folder):
fo... |
from django.contrib.gis.db import models
from django.contrib.gis.tests.utils import mysql, spatialite
from django.utils.encoding import python_2_unicode_compatible
# MySQL spatial indices can't handle NULL geometries.
null_flag = not mysql
@python_2_unicode_compatible
class NamedModel(models.Model):
name = model... |
#! /usr/bin/env python3
import sys
import os.path
import pybindgen.settings
from pybindgen.castxmlparser import ModuleParser, PygenClassifier, PygenSection, WrapperWarning, find_declaration_from_name
from pybindgen.typehandlers.codesink import FileCodeSink
from pygccxml.declarations import templates
from pygccxml.dec... |
import os
import logging
import socket
from dessn.framework.fitter import Fitter
from dessn.framework.models.approx_model import ApproximateModelW, ApproximateModel, ApproximateModelWSimplified
from dessn.framework.simulations.snana import SNANASimulation
if __name__ == "__main__":
logging.basicConfig(level=log... |
"""
Description of the video:
The screen is split in two parts showing Carry and Audrey at the phone,
talking at the same time, because it is actually two scenes of a same
movie put together.
"""
from moviepy.editor import *
from moviepy.video.tools.drawing import color_split
duration = 6 # duration of the final cli... |
import math
import numpy
def growtobox(array, boxw, boxh):
"""Grow array to fill box while keeping aspect ratio"""
# Find max scale ratio
(oldw, oldh) = array.shape
ratiow = int(math.floor(boxw / oldw))
ratioh = int(math.floor(boxh / oldh))
if ratiow < ratioh:
ratio = ratiow
else:
... |
"""Test relative imports (PEP 328)."""
from .. import util
from . import util as import_util
import sys
import unittest
class RelativeImports(unittest.TestCase):
"""PEP 328 introduced relative imports. This allows for imports to occur
from within a package without having to specify the actual package name.
... |
import sys
from services.spawn import MobileTemplate
from services.spawn import WeaponTemplate
from resources.datatables import WeaponType
from resources.datatables import Difficulty
from resources.datatables import Options
from java.util import Vector
def addTemplate(core):
mobileTemplate = MobileTemplate()
mobi... |
"""Constants used for communicating with the Python devappserver2 runtime."""
SERVER_SOFTWARE = 'Development/2.0'
# Internal AppEngine prefix for Headers (Environment variables)
# used in production. See apphosting/base/http_proto.cc for the full list.
APPENGINE_HEADER_PREFIX = 'X-Appengine-'
APPENGINE_ENVIRON_PREF... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import django
from django.test import SimpleTestCase
from django.contrib.gis.db import models as gismodels
from .. import PLUGINS, PLUGIN_FORMS, _normalize_plugins_config
from ..templatetags import leaflet_tags
from ..admin import LeafletGeoAdmin
from ..... |
"""
-----------
DOCSTRING
@author: Cyril Desjouy
"""
import curses
import locale
import abc
code = locale.getpreferredencoding()
class PadWin(abc.ABC):
""" General Pad Abstract Class """
def __init__(self, app):
self.app = app
@abc.abstractmethod
def color(self, item):
""" Pad c... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=================================================================
Model selection with Probabilistic (PCA) and Factor Analysis (FA)
=================================================================
Probabilistic PCA and Factor Analysis are probabilistic models.
The conseq... |
from odoo import _, fields, models
class EventStage(models.Model):
_name = 'event.stage'
_description = 'Event Stage'
_order = 'sequence, name'
name = fields.Char(string='Stage Name', required=True, translate=True)
description = fields.Text(string='Stage description', translate=True)
sequence... |
"""
Attributes testing module
Covers all operations which access the .attrs property, with the
exception of data read/write and type conversion. Those operations
are tested by module test_attrs_data.
"""
from __future__ import absolute_import
import six
import numpy as np
import collections
from .... |
"""A very simple MNIST classifier.
See extensive documentation at
http://tensorflow.org/tutorials/mnist/beginners/index.md
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import sys
# Import data
from tensorflow.examples.tutorials.mnist... |
from openerp import models
from openerp.tools import mute_logger
from openerp.osv.orm import except_orm
from openerp.tests import common
class TestAPI(common.TransactionCase):
""" test the new API of the ORM """
def assertIsRecordset(self, value, model):
self.assertIsInstance(value, models.BaseModel)... |
#!/usr/bin/python
import argparse
import json
import sys
def parse_args():
parser = argparse.ArgumentParser(
description="""Extracts information from a json file by navigating the JSON object using a
sequence of property accessors and returning the JSON subtree, or the raw data, found
... |
from math import log
def calcShannonEnt(dataSet):
numEntries = len(dataSet)
labelCounts = {}
for featVec in dataSet:
currentLabel = featVec[-1]
if currentLabel not in labelCounts.keys():
labelCounts[currentLabel] = 0
labelCounts[currentLabel] += 1
shannonEnt = 0.... |
from sympy.external import import_module
from sympy.utilities.pytest import raises, SKIP
from sympy.core.compatibility import range
theano = import_module('theano')
if theano:
import numpy as np
ts = theano.scalar
tt = theano.tensor
xt, yt, zt = [tt.scalar(name, 'floatX') for name in 'xyz']
else:
#... |
import unittest
from extensions_paths import EXAMPLES, PUBLIC_TEMPLATES, STATIC_DOCS
from local_file_system import LocalFileSystem
from render_servlet import RenderServlet
from server_instance import ServerInstance
from servlet import Request, Response
from test_util import ReadFile
class _RenderServletDelegate(Rend... |
"""
HTMLParser-based link extractor
"""
import warnings
from six.moves.html_parser import HTMLParser
from six.moves.urllib.parse import urljoin
from w3lib.url import safe_url_string
from scrapy.link import Link
from scrapy.utils.python import unique as unique_list
from scrapy.exceptions import ScrapyDeprecationWarni... |
import marshal
import os
import sys
import time
import getopt
from signal import signal, \
SIGPIPE, SIGINT, SIG_DFL, \
default_int_handler
signal(SIGPIPE, SIG_DFL)
s = signal(SIGINT, SIG_DFL)
if s != default_int_handler:
signal(SIGINT, s)
def die(msg, *args):
for a in args:
msg = "%s %s" % (msg,... |
""" Python 'utf-8-sig' Codec
This work similar to UTF-8 with the following changes:
* On encoding/writing a UTF-8 encoded BOM will be prepended/written as the
first three bytes.
* On decoding/reading if the first three bytes are a UTF-8 encoded BOM, these
bytes will be skipped.
"""
import codecs
### Codec APIs
... |
from django.db import models
from django.db.models import Q
from django.utils.encoding import force_unicode
from weblate.lang.models import Language
from weblate.trans.formats import AutoFormat, StringIOMode
from weblate.trans.models.project import Project
from translate.storage.csvl10n import csvfile
from django.core.... |
import time
import logging
from autotest.client.shared import error
@error.context_aware
def run_nmi_bsod_catch(test, params, env):
"""
Generate a dump on NMI, then analyse the dump file:
1) Boot a windows guest.
2) Edit the guest's system registry if need.
3) Reboot the guest.
4) Send inject-... |
import test_average_price
checks = [
test_average_price,
] |
"""
Output for vt100 terminals.
A lot of thanks, regarding outputting of colors, goes to the Pygments project:
(We don't rely on Pygments anymore, because many things are very custom, and
everything has been highly optimized.)
http://pygments.org/
"""
from __future__ import unicode_literals
from prompt_toolkit.filter... |
import os
import urllib2
import re
import logging
from subprocess import Popen
from subprocess import PIPE
class Downloader(object):
def __init__(self, config):
self._ctx = config
self._log = logging.getLogger('downloads')
self._init_proxy()
def _init_proxy(self):
handlers = ... |
#!/usr/bin/env python
"""
This script prepares the local source tree to be built with
custom optdata. Simply run this script and follow the
instructions to inject manually created optdata into the build.
"""
import argparse
import os
from os import path
import shutil
import subprocess
import sys
import xm... |
from __future__ import division
from io import BytesIO
import pytest
from mapproxy.request.wms import (
WMS111MapRequest,
WMS111FeatureInfoRequest,
WMS111CapabilitiesRequest,
)
from mapproxy.test.image import is_jpeg
from mapproxy.test.helper import validate_with_dtd
from mapproxy.test.http import assert... |
#!/usr/bin/env python
import os
import glob
import sys
import platform
import subprocess
import difflib
import filecmp
from optparse import OptionParser
#
# Get standard testsuite test arguments: srcdir exepath
#
srcdir = "."
tmpdir = "."
path = "../.."
# Options for the command line
parser = OptionParser()
parse... |
"""
Test JSON-RPC support.
"""
from twisted.internet import reactor, defer
from twisted.trial import unittest
from twisted.web import server, static
from txjsonrpc import jsonrpclib
from txjsonrpc.jsonrpc import addIntrospection
from txjsonrpc.web import jsonrpc
class TestRuntimeError(RuntimeError):
pass
class... |
from neutron.common import exceptions as exc
class ContrailError(exc.NeutronException):
message = '%(msg)s'
class ContrailNotFoundError(exc.NotFound):
message = '%(msg)s'
class ContrailConflictError(exc.Conflict):
message = '%(msg)s'
class ContrailBadRequestError(exc.BadRequest):
message = '%(ms... |
from collections.abc import Iterable
from numbers import Real
import numpy as np
import openmc.checkvalue as cv
from openmc.mixin import EqualityMixin
from .angle_energy import AngleEnergy
from .function import Tabulated1D, Polynomial, Function1D
class Product(EqualityMixin):
"""Secondary particle emitted in a ... |
# __MyClass0.py_____________________________________________________
from ASGNode import *
from ATOM3Type import *
from ATOM3Integer import *
from ATOM3Boolean import *
from graph_MyClass0 import *
class MyClass0(ASGNode, ATOM3Type):
def __init__(self, parent = None):
ASGNode.__init__(self)
... |
import sys
import mock
import netaddr
from neutron.common import constants as l3_constants
from neutron.openstack.common import uuidutils
from neutron.tests import base
from neutron.plugins.cisco.cfg_agent.device_drivers.csr1kv import (
cisco_csr1kv_snippets as snippets)
sys.modules['ncclient'] = mock.MagicMock(... |
#! /usr/bin/env python
import os
import sys
import pyfits
from astrometry.util.util import *
import pyfits
from astrometry.util.sdss_noise import *
from astrometry.util.sdss_psfield import *
def main():
from optparse import OptionParser
parser = OptionParser(usage='%prog [options] <ra> <dec> <fpC> <cutout> [<fpM> ... |
import membership_invoice
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
"""
Requirements file parsing
"""
from __future__ import absolute_import
import optparse
import os
import re
import shlex
import sys
from pip._vendor.six.moves import filterfalse
from pip._vendor.six.moves.urllib import parse as urllib_parse
from pip._internal.cli import cmdoptions
from pip._internal.download impor... |
"""The group_snapshots api."""
from oslo_log import log as logging
import six
import webob
from webob import exc
from cinder.api import common
from cinder.api.openstack import wsgi
from cinder.api.v3.views import group_snapshots as group_snapshot_views
from cinder import exception
from cinder import group as group_ap... |
"""
WSGI config for orgwolf 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_APPLICATION`` ... |
from core import perf_benchmark
from telemetry import benchmark
from telemetry.timeline import tracing_category_filter
from telemetry.web_perf import timeline_based_measurement
import page_sets
TEXT_SELECTION_CATEGORY = 'blink'
TIMELINE_REQUIRED_CATEGORY = 'blink.console'
class _TextSelection(perf_benchmark.PerfBe... |
from __future__ import (absolute_import, division, print_function)
from mantid.api import mtd
from testhelpers import (assertRaisesNothing, create_algorithm, illhelpers)
import unittest
class ReflectometryILLPolarizationCorTest(unittest.TestCase):
def tearDown(self):
mtd.clear()
def testExecutes(se... |
#! /usr/bin/python
LOGICAL=["AND","OR","XOR"]
RELATIONAL=["<",">","=",'<=','>=','<>']
ADD_SUB=['+','-']
MULT=['*','/','%']
def list_statement(source):
(tokens,pos)=source
if pos>=len(tokens) or tokens[pos]=='\n':
return None
else:
ret=expression(source)
if len(source[0])>source[-1] and expect(source,','):
... |
"""
Test pakit_tests
"""
from __future__ import absolute_import, print_function
import os
import tempfile
import mock
import pytest
from pakit_tests import (
create_args_parser, extract_repo_names, extract_repo_block, main,
scan_recipes, format_lines, write_file, TEMPLATE
)
import tests.common as tc
def test... |
"""
RTP (Real-time Transport Protocol).
"""
from scapy.packet import *
from scapy.fields import *
_rtp_payload_types = {
# http://www.iana.org/assignments/rtp-parameters
0: 'G.711 PCMU', 3: 'GSM',
4: 'G723', 5: 'DVI4',
6: 'DVI4', 7: 'LPC',
8: 'PCMA', 9: 'G722'... |
import os
import sys
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), "python-bitcoinrpc"))
import json
import shutil
import subprocess
import tempfile
import traceback
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException
from util import *
def check_array_result(object_array,... |
"""
Get a clinical report selected variants, this only works for non-panel reports
"""
import os
import requests
from requests.auth import HTTPBasicAuth
import sys
import simplejson as json
import argparse
# Load environment variables for request authentication parameters
if "FABRIC_API_PASSWORD" not in os.environ:
... |
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
from ansible.module_utils.network.che... |
import time
from openerp.report import report_sxw
from openerp import pooler
def titlize(journal_name):
words = journal_name.split()
while words.pop() != 'journal':
continue
return ' '.join(words)
class order(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(ord... |
#pylint: disable=no-init
from __future__ import (absolute_import, division, print_function)
from mantid.api import PythonAlgorithm, AlgorithmFactory, ITableWorkspaceProperty
from mantid.kernel import Direction, Stats
import mantid.simpleapi as ms
from mantid import mtd, logger
import numpy as np
from six import iterit... |
import base64
import hashlib
from libcloud.utils.py3 import hexadigits
from libcloud.utils.py3 import bchr
__all__ = [
'get_pubkey_openssh_fingerprint',
'get_pubkey_ssh2_fingerprint',
'get_pubkey_comment'
]
try:
from Crypto.Util.asn1 import DerSequence, DerObject
from Crypto.PublicKey.RSA import ... |
import dbapi20
import dbapi20_tpc
from testutils import skip_if_tpc_disabled
from testutils import unittest, decorate_all_tests
import psycopg2
from testconfig import dsn
class Psycopg2Tests(dbapi20.DatabaseAPI20Test):
driver = psycopg2
connect_args = ()
connect_kw_args = {'dsn': dsn}
lower_func = 'l... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from jinja2.exceptions import UndefinedError
from ansible.errors import AnsibleError, AnsibleUndefinedVariable
from ansible.plugins.lookup import LookupBase
from ansible.utils.listify import listify_lookup_plugin_terms
class Look... |
import os
from flask.ext.assets import Bundle
from aleph.core import assets
base_assets = Bundle(
# include via CDN
# 'vendor/jquery/dist/jquery.js',
'vendor/moment/moment.js',
'vendor/pdfjs-dist/build/pdf.js',
'vendor/pdfjs-dist/build/pdf.worker.js',
filters='uglifyjs',
output='assets/bas... |
"""
Run Selenium Tests
Requires a clean install. After reinstalling fresh db, call
frappe --execute erpnext.tests.sel_tests.start
"""
from __future__ import unicode_literals
import frappe
from frappe.utils import sel
import time
def start():
try:
run()
finally:
sel.close()
def run():
def next_slide(idx, ... |
# -*- coding: utf-8 -*-
from . import html_domain
from . import github
# add Odoo style to pygments
from . import odoo_pygments
from . import sphinx_monkeypatch
sphinx_monkeypatch.patch()
def setup(app):
html_domain.setup(app)
github.setup(app)
app.add_directive('exercise', Exercise)
app.add_node(exe... |
"""Implementation of kernel-methods-related loss operations."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import ops
from tensorflow.python.ops import array_ops
from tenso... |
"""
Loads functions that are mixed in to the standard library. E.g. builtins are
written in C (binaries), but my autocompletion only understands Python code. By
mixing in Python code, the autocompletion should work much better for builtins.
"""
import os
import inspect
from jedi._compatibility import is_py3, builtins... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['stableinterface'],
'supported_by': 'community'}
# This is a modification of @bcoca's `svc` module
DOCUMENTATION = r'''
---
module: r... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.