content string |
|---|
from __future__ import print_function
import argparse
from functools import partial
def keep_line(line, pos_cols, region):
fields = line.rstrip().split(b'\t')
if fields[pos_cols[0]] == region[0]: # same chromosome
if (
region[1] < int(fields[pos_cols[1]]) < region[2]
) or (
... |
#!/usr/bin/env python2
# vim:fileencoding=utf-8
from __future__ import (unicode_literals, division, absolute_import,
print_function)
__license__ = 'GPL v3'
__copyright__ = '2014, Kovid Goyal <kovid at kovidgoyal.net>'
# A implementation of the GMenuModel export of menus/actions on DBus.
# GMen... |
from bs4 import BeautifulSoup
from couchpotato.core.helpers.encoding import tryUrlencode
from couchpotato.core.helpers.variable import tryInt
from couchpotato.core.logger import CPLog
from couchpotato.core.providers.torrent.base import TorrentProvider
import traceback
log = CPLog(__name__)
class IPTorrents(TorrentPr... |
{
'name': 'Check Writing',
'version': '1.1',
'author': 'OpenERP SA, NovaPoint Group',
'category': 'Generic Modules/Accounting',
'description': """
Module for the Check Writing and Check Printing.
================================================
""",
'website': 'https://www.odoo.com/page/acco... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Update Piwik for nodes that were forked, registered or templated prior to
October 2014.
"""
import datetime
import logging
import sys
import time
from modularodm import Q
from framework.analytics.piwik import _update_node_object
from scripts import utils as scripts_ut... |
try:
import uwsgi
except ImportError:
pass
# raise ImportError('uWSGI is required to run this package')
from django.contrib.auth.decorators import login_required, user_passes_test
from django.http import HttpResponse
from django.template import RequestContext
from django.utils.functional import Promise
from... |
#!/usr/bin/env python3.4
#
import sys
import uuid
import smtplib
import time
import logging
from email.mime.text import MIMEText
from ACNode import ACNode
class AlertEmail(ACNode):
default_smtphost = 'localhost'
default_smtpport = 25
default_alertsubject = "[Node alert]"
default_alertfrom = 'acnode@unknown'
... |
"""'with'-compliant StringIO implementation."""
import StringIO as OldStringIO
class StringIO(OldStringIO.StringIO):
def __enter__(self):
return self
def __exit__(self, type, value, traceback):
pass |
#!/usr/bin/python
from __future__ import (absolute_import, division, print_function)
# Copyright 2019 Fortinet, Inc.
#
# 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 3 of the Lic... |
import os.path
import pkg_resources
import sys
from trac.admin import *
from trac.api import IEnvironmentSetupParticipant
from trac.core import *
from trac.wiki import model
from trac.wiki.api import WikiSystem, validate_page_name
from trac.util import read_file
from trac.util.datefmt import datetime_now, format_datet... |
import boto.exception
from boto.compat import json
import requests
import boto
from boto.cloudsearchdomain.layer1 import CloudSearchDomainConnection
class SearchServiceException(Exception):
pass
class CommitMismatchError(Exception):
# Let's do some extra work and let the user handle errors on his/her own.
... |
"""Contrib contains extensions that are shipped with nova.
It can't be called 'extensions' because that causes namespacing problems.
"""
from nova.api.openstack import extensions
from nova import flags
from nova.openstack.common import log as logging
FLAGS = flags.FLAGS
LOG = logging.getLogger(__name__)
def stan... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
lasmerge.py
---------------------
Date : September 2013
Copyright : (C) 2013 by Martin Isenburg
Email : martin near rapidlasso point com
****************... |
from datetime import datetime
from django.db import models
from django.utils.translation import ugettext_lazy as _
from djblets.util.fields import Base64Field
from reviewboard.scmtools.models import Repository
class FileDiff(models.Model):
"""
A diff of a single file.
This contains the patch and inform... |
from boto.regioninfo import RegionInfo, get_regions
def regions():
"""
Get all available regions for the AWS Key Management Service.
:rtype: list
:return: A list of :class:`boto.regioninfo.RegionInfo`
"""
from boto.kms.layer1 import KMSConnection
return get_regions('kms', connection_cls=K... |
"""Build a language detector model
The goal of this exercise is to train a linear classifier on text features
that represent sequences of up to 3 consecutive characters so as to be
recognize natural languages by using the frequencies of short character
sequences as 'fingerprints'.
"""
# License: Simplified BSD
impor... |
""" AVR architecture.
See for good documentation about AVR ABI:
- https://gcc.gnu.org/wiki/avr-gcc
The stack grows downwards in AVR. The stack pointer points to the current
empty stack slot. This is somewhat confusing, because on other machines
the stack pointer points to the latests pushed byte.
The stack frame is... |
import copy
import pickle
from django.utils.unittest import TestCase
from django.utils.functional import SimpleLazyObject, empty
class _ComplexObject(object):
def __init__(self, name):
self.name = name
def __eq__(self, other):
return self.name == other.name
def __hash__(self):
r... |
"""
Classes that represent database functions.
"""
from django.db.models import Func, Transform, Value, fields
class Cast(Func):
"""
Coerce an expression to a new field type.
"""
function = 'CAST'
template = '%(function)s(%(expressions)s AS %(db_type)s)'
mysql_types = {
fields.CharFie... |
"""
Quantum PLUMgrid Plug-in for PLUMgrid Virtual Technology
This plugin will forward authenticated REST API calls
to the Network Operating System by PLUMgrid called NOS
"""
import httplib
import urllib2
from quantum.openstack.common import jsonutils as json
from quantum.openstack.common import log as logging
from qu... |
import falcon
import mock
import binascii
import base64
import json
import deuce
from deuce.transport.wsgi import hooks
from deuce.drivers import swift
from deuce.tests import HookTest
def before_hooks_swift(req, resp, params):
return [
hooks.OpenstackSwiftHook(req, resp, params)
]
class DummyClassO... |
"""A non-blocking, single-threaded TCP server."""
from __future__ import absolute_import, division, print_function, with_statement
import errno
import os
import socket
from tornado.log import app_log
from tornado.ioloop import IOLoop
from tornado.iostream import IOStream, SSLIOStream
from tornado.netutil import bind_... |
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = r'''
---
module: win_route
version_added: "2.4"
short_description: Add or remove a static route
description:
- Add or remove a static route.
options:
destinat... |
#!/usr/bin/env python
"""
script to run configre for all hwdef.dat, to check for syntax errors
"""
import os
import shutil
import subprocess
import sys
import fnmatch
import argparse
parser = argparse.ArgumentParser(description='configure all ChibiOS boards')
parser.add_argument('--build', action='store_true', defa... |
from threading import RLock
try:
from UserDict import DictMixin
except ImportError:
from collections import Mapping as DictMixin
# With lazy loading, we might end up with multiple threads triggering
# it at the same time. We need a lock.
_fill_lock = RLock()
class LazyDict(DictMixin):
"""Dictionary popu... |
{
'name': 'Language path mixin',
'summary': "Setting the partner's language in RML reports",
'version': '1.0',
'author': 'Therp BV,Odoo Community Association (OCA)',
'maintainer': 'Odoo Community Association (OCA)',
'website': 'https://github.com/OCA/server-tools',
'license': 'AGPL-3',
'... |
import re
from threading import Lock
import crash_utils
REVIEW_URL_PATTERN = re.compile(r'Review URL:( *)(.*?)/(\d+)')
class Match(object):
"""Represents a match entry.
A match is a CL that is suspected to have caused the crash. A match object
contains information about files it changes, their authors, etc... |
#!/usr/bin/env python
import argparse
import os
import platform
import subprocess
import sys
from lib.config import get_target_arch, PLATFORM
from lib.util import get_host_arch, import_vs_env
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
def main():
os.chdir(SOURCE_ROOT)
if PLATFO... |
from unittest import mock
from unittest.mock import MagicMock
from content_api.tests import ApiTestCase
_fake_packages_resource = MagicMock()
_fake_packages_service = MagicMock()
_fake_backend = MagicMock(name='superdesk backend')
def _fake_get_backend():
"""Return mocked superdesk backend."""
return _fake... |
# Originally written by Kevin Breen (@KevTheHermit):
# https://github.com/kevthehermit/RATDecoders/blob/master/unrecom.py
import string
from zipfile import ZipFile
from cStringIO import StringIO
from Crypto.Cipher import ARC4
import xml.etree.ElementTree as ET
from viper.common.out import *
def extract_embedded(zip_... |
from openerp.osv import osv
from openerp.tools.translate import _
from openerp.addons.account.wizard.pos_box import CashBox
class PosBox(CashBox):
_register = False
def run(self, cr, uid, ids, context=None):
if not context:
context = dict()
active_model = context.get('active_mode... |
"""Configuration for testing.
Test files should import this module before mod_pywebsocket.
"""
import os
import sys
# Add the parent directory to sys.path to enable importing mod_pywebsocket.
sys.path.insert(0, os.path.join(os.path.split(__file__)[0], '..'))
# vi:sts=4 sw=4 et |
### Import necessary packages
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from xml.etree import ElementTree as et
import cv2, os, sys, shutil, glob, argparse, re, io
import numpy as np
import tensorflow as tf
import PIL, hashlib, logging
from PIL import ... |
"""Unit tests for layout functions."""
import networkx as nx
from networkx.testing import almost_equal
import pytest
numpy = pytest.importorskip("numpy")
test_smoke_empty_graphscipy = pytest.importorskip("scipy")
class TestLayout:
@classmethod
def setup_class(cls):
cls.Gi = nx.grid_2d_graph(5, 5)
... |
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
parse_duration,
parse_iso8601,
js_to_json,
)
from ..compat import compat_str
class RDSIE(InfoExtractor):
IE_DESC = 'RDS.ca'
_VALID_URL = r'https?://(?:www\.)?rds\.ca/vid(?:[eé]|%C3%A9)o... |
import json
from django.contrib.messages import constants
from django.contrib.messages.storage.base import Message
from django.contrib.messages.storage.cookie import (
CookieStorage, MessageDecoder, MessageEncoder,
)
from django.test import SimpleTestCase, override_settings
from django.utils.safestring import Safe... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = r'''
---
module: bigip_device_group
short_description: Manage device groups ... |
from . import test_sale_to_invoice
checks = [
test_sale_to_invoice,
]
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
"""
Models for reverification features common to both lms and studio
"""
from datetime import datetime
import pytz
from django.core.exceptions import ValidationError
from django.db import models
from util.validate_on_save import ValidateOnSaveMixin
from xmodule_django.models import CourseKeyField
class MidcourseReve... |
"""
Implementations for `XMPP Extensions`_.
=======================================
Each submodule or subpackage should implement one extension or closely
related group of extensions.
.. _XMPP Extensions: http://xmpp.org/xmpp-protocols/xmpp-extensions/
"""
__docformat__ = "restructuredtext en"
# vi: sts=4 et sw=4 |
import nose.tools
from angr import SimState, SimHeapPTMalloc
# TODO: Make these tests more architecture-independent (note dependencies of some behavior on chunk metadata size)
def chunk_iterators_are_same(iterator1, iterator2):
for ck in iterator1:
ck2 = next(iterator2)
if ck.base != ck2.base:
... |
"""This module implements functions that have to do with number theory."""
import random
from operator import mul
_stock_primes = [2, 3, 5, 7, 11, 13, 17, 19]
def int_pow(x, n):
"""Raise x to the power n (if n is negative a ValueError is raised).
intPow(0, 0) is defined to be 0.
"""
if n < 0:
... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import re
from ansible.module_utils._text import to_text
def get_sysctl(module, prefixes):
sysctl_cmd = module.get_bin_path('sysctl')
cmd = [sysctl_cmd]
cmd.extend(prefixes)
sysctl = dict()
try:
rc,... |
from __future__ import print_function
import os
import numpy as np
from dataset.imdb import Imdb
import xml.etree.ElementTree as ET
from evaluate.eval_voc import voc_eval
import cv2
class PascalVoc(Imdb):
"""
Implementation of Imdb for Pascal VOC datasets
Parameters:
----------
image_set : str
... |
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = r'''
---
module: win_iis_webapppool
version_added: "2.0"
short_description: Configure IIS Web Application Pools
description:
- Creates, removes and configures an ... |
from tempest.api.orchestration import base
from tempest.common.utils import data_utils
from tempest import config
from tempest import exceptions
from tempest.openstack.common import log as logging
from tempest import test
LOG = logging.getLogger(__name__)
CONF = config.CONF
class TestSoftwareConfig(base.BaseOrchestr... |
#!/usr/bin/env python
"""
Converts netscreen snoop hex-dumps to a hex-dump that text2pcap can read.
Copyright (c) 2004 by Gilbert Ramirez <<EMAIL>>
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; ei... |
"""
Exception definitions.
"""
class CommandError(Exception):
pass
class ValidationError(Exception):
pass
class AuthorizationFailure(Exception):
pass
class NoTokenLookupException(Exception):
"""This form of authentication does not support looking up
endpoints from an existing token."""
... |
#!/usr/local/bin/python
import os
import datetime
import re
import docker
from jinja2 import Template
from yaml import load
TEMPLATES_DIRECTORY = os.environ['TEMPLATE_DIRECTORY']
CONFIG_DIRECTORY = os.environ['CONFIG_DIRECTORY']
SERVICE_NAMES = {
'dns': os.environ.get('DNS_SERVICE_NAME', 'dns'),
'dhcp': os.... |
from test.support import findfile, run_unittest, TESTFN
import unittest
import os
import aifc
class AIFCTest(unittest.TestCase):
def setUp(self):
self.f = self.fout = None
self.sndfilepath = findfile('Sine-1000Hz-300ms.aif')
def tearDown(self):
if self.f is not None:
sel... |
from django import forms
from base.forms.utils.emptyfield import EmptyField
class MailReminderRow(forms.Form):
responsible = EmptyField(label='')
learning_unit_years = EmptyField(label='')
check = forms.BooleanField(required=False, label='')
person_id = forms.IntegerField(widget=forms.HiddenInput(), ... |
import json
from airflow.contrib.hooks.gcs_hook import GoogleCloudStorageHook
from airflow.contrib.hooks.bigquery_hook import BigQueryHook
from airflow.models import BaseOperator
from airflow.utils.decorators import apply_defaults
class GoogleCloudStorageToBigQueryOperator(BaseOperator):
"""
Loads files from... |
#!/usr/bin/env python
'''
The MIT License (MIT)
Copyright (c) <2014> <Mathias Lesche>
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 rights
... |
import scipy
from scipy import ndimage
import cv2
import numpy as np
import sys
import torch
import resnet_dilated_frozen_r5_D #TODO
import resnet_dilated_frozen_r5_D #TODO
import resnet_dilated_frozen_r5_D_pose #TODO
import resnet_dilated_frozen_r5_D_pose #TODO
from torch.autograd import Variable
import torchvision.m... |
from __future__ import print_function
import sys
import os
table_name = None
if os.environ in 'hive_streaming_tablename':
table_name = os.environ['hive_streaming_tablename']
for line in sys.stdin:
print(line)
print("dummy", file=sys.stderr) |
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
from builtins import range
from future import standard_library
standard_library.install_aliases()
import sys
PYTHON_VERSION = sys.version_info[:3]
PY2 = (PYTHON_VERSION[0... |
import unittest
import inspect
import os
from os.path import join
import numpy as np
from cylp.cy import CyCoinMpsIO
from cylp.cy.CyCoinMpsIO import getQpsExample
currentFilePath = os.path.dirname(inspect.getfile(inspect.currentframe()))
class TestCyCoinMpsIO(unittest.TestCase):
def test(self):
problem... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.netcfg import NetworkConfig, dumps
from ansible.module_utils.dellos10 import get_config, get_subleve... |
"""Tests for tensorflow.models.ptb_lstm.ptb_reader."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os.path
import tensorflow as tf
from tensorflow.models.rnn.ptb import reader
class PtbReaderTest(tf.test.TestCase):
def setUp(self):
sel... |
import pytest
from cfme import test_requirements
from cfme.infrastructure.provider import InfraProvider
from cfme.markers.env_markers.provider import ONE_PER_TYPE
from cfme.utils.appliance.implementations.ui import navigate_to
from cfme.utils.wait import wait_for
pytestmark = [
pytest.mark.tier(2),
test_requ... |
#!/usr/bin/env python3
import zmq
import time
import pickle
import logging
import threading
logger = logging.getLogger(__name__)
class CommandClient(object):
""" CommandClient
"""
def __init__(self, ip_address, port_range):
"""
Parameters
----------
ip_address: str
... |
class User(object):
"""Information about an authenticated user.
Providers return different forms of information. This container is
meant to provide a common interface with that information across all
vendors.
"""
ATTRIBUTES = [
'id',
'name',
'nickname',
'email',... |
from piston.handler import BaseHandler, rc
from systems.models import System, RelengDistro, SystemRack,SystemStatus,NetworkAdapter,KeyValue
from truth.models import Truth, KeyValue as TruthKeyValue
from dhcp.DHCP import DHCP as DHCPInterface
from dhcp.models import DHCP
from MacroExpansion import MacroExpansion
from Ke... |
#!/usr/bin/python
import os
import smtplib
import time
from email.mime.text import MIMEText
mailserver = "XXXX.de"
smtpport = 25
smtpuser = "XXXX"
smtpasswd = "XXXXX"
recipient = "<EMAIL>"
smtpsender = "<EMAIL>"
alarmtemp = 25
day = repr(time.localtime()[2]) + "."+repr(time.localtime()[1])+"."+repr(time.localtime()... |
import numpy
from numpy.testing import assert_raises
from fuel.datasets import CalTech101Silhouettes
from tests import skip_if_not_available
def test_caltech101_silhouettes16():
skip_if_not_available(datasets=['caltech101_silhouettes16.hdf5'])
for which_set, size, num_examples in (
('train', 16, ... |
# -*- coding: utf-8 -*-
"""
Goodreads Activity
==================
A Pelican plugin to lists books from your Goodreads shelves.
Copyright (c) Talha Mansoor
"""
from __future__ import unicode_literals
import logging
logger = logging.getLogger(__name__)
from pelican import signals
class GoodreadsActivity():
def... |
# Monitor the system for dropped packets and proudce a report of drop locations and counts
import os
import sys
sys.path.append(os.environ['PERF_EXEC_PATH'] + \
'/scripts/python/Perf-Trace-Util/lib/Perf/Trace')
from perf_trace_context import *
from Core import *
from Util import *
drop_log = {}
kallsyms = []
def... |
"""Tests for local response normalization."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import copy
import numpy as np
import tensorflow as tf
class LRNOpTest(tf.test.TestCase):
def _LRN(self, input_image, lrn_depth_radius=5, bias=1.0,
... |
from functools import partial
import inspect
import logging
import sys
import re
import six
from silk.profiling.profiler import silk_profile
Logger = logging.getLogger('silk')
def _get_module(module_name):
"""
Given a module name in form 'path.to.module' return module object for 'module'.
"""
if '... |
import json
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Group
from django.core.urlresolvers import reverse
from django.test import TestCase
from django.conf import settings
from guardian.shortcuts import get_anonymous_user
from geonode.groups.models import GroupProfile, Group... |
from anybox.testing.openerp import SharedSetupTransactionCase
from openerp.exceptions import ValidationError
class TestMedicalHospitalOr(SharedSetupTransactionCase):
_data_files = (
'data/medical_his_data.xml',
)
_module_ns = 'medical_his'
def setUp(self):
SharedSetupTransactionCase... |
import logging
from jira.resources import Resource
from airflow.contrib.operators.jira_operator import JIRAError
from airflow.contrib.operators.jira_operator import JiraOperator
from airflow.operators.sensors import BaseSensorOperator
from airflow.utils.decorators import apply_defaults
class JiraSensor(BaseSensorOp... |
from __future__ import unicode_literals
from unittest import skipIf
from django.db import connection, connections
from django.db.migrations.graph import NodeNotFoundError
from django.db.migrations.loader import AmbiguityError, MigrationLoader
from django.db.migrations.recorder import MigrationRecorder
from django.tes... |
from __future__ import absolute_import
#
# Copyright 2012-2016 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation; either version 2 of the License, or
# (at your option) any l... |
from supybot.test import *
import supybot.ircutils as ircutils
class ReplyTestCase(ChannelPluginTestCase):
plugins = ('Reply',)
def testPrivate(self):
m = self.getMsg('private [list]')
self.failIf(ircutils.isChannel(m.args[0]))
def testNotice(self):
m = self.getMsg('notice [list]')... |
from __future__ import absolute_import, division, print_function
ANSIBLE_METADATA = {
'status': ['preview'],
'supported_by': 'community',
'metadata_version': '1.1'
}
import json
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.urls import fetch_url, url_argument_spec
from an... |
"""
Ansible CloudStack external inventory script.
=============================================
Generates Ansible inventory from CloudStack. Configuration is read from
'cloudstack.ini'. If you need to pass the project, write a simple wrapper
script, e.g. project_cloudstack.sh:
#!/bin/bash
cloudstack.py --project ... |
"""
Create and verify jws-js format Ed25519 signatures.
"""
__all__ = [ 'sign', 'verify' ]
import json
from ..util import urlsafe_b64decode, urlsafe_b64encode, native, binary
ed25519ll = None
ALG = "Ed25519"
def get_ed25519ll():
"""Lazy import-and-test of ed25519 module"""
global ed25519ll
if not ... |
"""Views for the node settings page."""
# -*- coding: utf-8 -*-
import httplib as http
from flask import request
from modularodm.exceptions import ValidationError
from framework.exceptions import HTTPError
from website.project.decorators import (
must_have_addon,
must_have_permission,
must_not_be_registr... |
import github.GithubObject
import github.NamedUser
import github.CommitStats
import github.Gist
class GistHistoryState(github.GithubObject.CompletableGithubObject):
"""
This class represents GistHistoryStates as returned for example by http://developer.github.com/v3/todo
"""
@property
def change... |
#!/usr/bin/env python
# WARNING. There is a bug in this script so that it does not simulate the actual Tahoe Two server selection algorithm that it was intended to simulate. See http://allmydata.org/trac/tahoe-lafs/ticket/302 (stop permuting peerlist, use SI as offset into ring instead?)
import random
SERVER_CAPACIT... |
"""
---
database.py
~~~~~~~~~~~
Lifts flatfile database accessing / querying functions.
"""
# For with clause, create new db_manager that connects
def dbm(db_file):
return DB_Manager(db_file)
class DB_Manager():
def __init__(self, db_file):
self.db_file = db_file
pass
# __enter__ a... |
from subprocess import Popen, PIPE
import os
import sys
print sys.path[0]
script = """
# setup commands:
# begin indexname indextypes schema
# types:
# bint = big integer
# int = integer
# sint = small integer
# tint = tiny integer
# float = double (float)
# dec = decimal
# str = string
# general comm... |
#!/usr/bin/env python
import os
import subprocess
import sys
import tempfile
import urllib
# Compresses the contents of a folder and upload the result to Box.
# Run this script as:
#
# $ upload-logs.py LOG_DIR DEST_NAME
#
# e.g.:
#
# $ upload-logs.py /tmp/wsklogs logs-5512.tar.gz
def upload_file(local_file, remote_fi... |
class ConnectionSettingAttribute(object):
"""
Represents the ConnectionSetting segment of ELB Attributes.
"""
def __init__(self, connection=None):
self.idle_timeout = None
def __repr__(self):
return 'ConnectionSettingAttribute(%s)' % (
self.idle_timeout)
def startEl... |
#!/usr/bin/python
############################################################
# For Penn genomes, 06.2020
# Takes a log file from a clipkit run on amino acid sequence
# and removes corresponding sites from codon alignment.
############################################################
import sys, os, core, coreseq, arg... |
import urlparse
import datetime
import urllib2
from smap.driver import SmapDriver
from smap.util import periodicSequentialCall
from smap.contrib import dtutil
from sklearn import linear_model
from smap.archiver.client import RepublishClient
from functools import partial
from mpc import *
class SimpleMPC(SmapDriver):
... |
#!/usr/bin/env python
''' Small script to rewrite McStas trace output to CSV data for plotting '''
import argparse
import sys
import numpy as np
import x3d
from util import parse_multiline, rotate, get_line, debug, draw_circle
UC_COMP = 'COMPONENT:'
MC_COMP = 'MCDISPLAY: component'
MC_COMP_SHORT = 'COMP: '... |
import sys
import json
sys.path.append('../common/tests')
from testtools.matchers import Equals, Contains
from test_utils import *
import test_common
import test_case
class NBTestExtraFieldsPresenceCodeDefault(test_case.NeutronBackendTestCase):
def test_extra_fields_on_network(self):
test_obj = self._cre... |
from ansible import utils, errors
import os
HAVE_DNS=False
try:
import dns.resolver
from dns.exception import DNSException
HAVE_DNS=True
except ImportError:
pass
# ==============================================================
# DNSTXT: DNS TXT records
#
# key=domainname
# TODO: configurable reso... |
import time
import logging
import flexx
from flexx import app, ui
import faulthandler
faulthandler.enable()
#logging.log
class MyApp(ui.Widget):
#_config = ui.App.Config(title='Flexx test app', size=(400, 300),
# )#icon='https://assets-cdn.github.com/favicon.ico')
... |
from m5.params import *
from m5.proxy import *
from Device import PioDevice
from Platform import Platform
class BaseGic(PioDevice):
type = 'BaseGic'
abstract = True
cxx_header = "dev/arm/base_gic.hh"
platform = Param.Platform(Parent.any, "Platform this device is part of.")
class Pl390(BaseGic):
... |
"""
Form generation utilities for App Engine's new ``ndb.Model`` class.
The goal of ``model_form()`` is to provide a clean, explicit and predictable
way to create forms based on ``ndb.Model`` classes. No malabarism or black
magic should be necessary to generate a form for models, and to add custom
non-model related fi... |
__author__ = 'Bohdan Mushkevych'
import unittest
from settings import enable_test_mode
enable_test_mode()
from db.model.site_statistics import DOMAIN_NAME, TIMEPERIOD
from constants import PROCESS_SITE_MONTHLY
from tests import daily_fixtures
from tests import monthly_fixtures
from tests.test_abstract_worker import A... |
import pandas as pd
data = pd.read_csv("DevelopmentData.csv")
n = len(data.columns)
# Add all parameters (Taylor coefficients) as 0 in rows following the data:
for i in range(data.shape[0]):
for j in range(n+2, n+34):
data.set_value(i, j, 0)
data.rename(columns={n+2: "a", n+3: "a1", n+4: "a2"... |
from MaKaC.webinterface.rh import contribMod
def index(req, **params):
return contribMod.RHContributionModification( req ).process( params )
def newPrimAuthor(req, **params):
return contribMod.RHNewPrimaryAuthor( req ).process( params )
def searchPrimAuthor(req, **params):
return contribMod.RHSearchPrima... |
# -*- coding: utf-8 -*-
from collections import namedtuple
# Data containers
Header = namedtuple(
'Header',
['sample_counter', 'datagram_counter', 'num_items', 'timecode',
'charID', 'extra_data']
)
Euler = namedtuple(
'Euler',
['segment_ID', 'tx', 'ty', 'tz', 'rx', 'ry', 'rz']
)
Quaternion = nam... |
"""Test the basics including the bmark and tags"""
from bookie.models import (
DBSession,
Bmark,
)
from bookie.models.auth import User
from bookie.tests import gen_random_word
from bookie.tests import TestDBBase
class TestBmark(TestDBBase):
"""Handle bmark function checks"""
def test_has_access_sa... |
import codecs
import copy
import logging
from fluent.syntax import ast, FluentParser, FluentSerializer
from pontoon.sync.exceptions import SyncError
from pontoon.sync.formats.base import ParsedResource
from pontoon.sync.utils import create_parent_directory
from pontoon.sync.vcs.models import VCSTranslation
log = log... |
"""MIME-Type Parser
This module provides basic functions for handling mime-types. It can handle
matching mime-types against a list of media-ranges. See section 14.1 of the
HTTP specification [RFC 2616] for a complete explanation.
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1
Contents:
- parse_mi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.