content string |
|---|
"""Test that rack models are properly parsed."""
import ulid2
import tarfile
import io
import drydock_provisioner.objects as objects
from drydock_provisioner.statemgmt.state import DrydockState
from drydock_provisioner.control.bootaction import BootactionUtils
class TestClass(object):
def test_bootaction_tarbui... |
import unittest
from tests.tools import AgentTestCase, patch, DEFAULT
from azurelinuxagent.daemon.resourcedisk.default import ResourceDiskHandler
class TestResourceDisk(AgentTestCase):
def test_mount_flags_empty(self):
partition = '/dev/sdb1'
mountpoint = '/mnt/resource'
options = None
... |
#!/usr/bin/python3
import datetime, sys, os
# import numpy as np #only needed for colouring
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
homedir = os.getenv("HOME")
try:
sys.path.append(homedir + '/Pigrow/scripts/')
import pigrow_defs
script = 'chirp_graph.py'
loc_locs = h... |
import sys
import re
import os
import codecs
import unicodedata
# This script will clean up the author transliterations
# the synonym file generated by the /batch/command=dump-authors
# process; it removes duplicates and also deals with some
# obvious data problems
#
# usage:
# python clean_transliterations.py synony... |
from MenderAPI import *
class Artifacts():
artifacts_tool_path = "mender-artifact"
def reset(self):
# Reset all temporary values.
pass
def make_artifact(self, image, device_type, artifact_name, artifact_file_created, signed=False, scripts=[]):
signed_arg = ""
if artifact... |
#!/usr/bin/env python
import ConfigParser
import argparse
import functools
import hashlib
import json
import logging
import os
import shutil
import tempfile
import requests
import sh
import redo
from mardor.marfile import MarFile
log = logging.getLogger(__name__)
ALLOWED_URL_PREFIXES = [
"http://download.cdn.moz... |
from twext.python.log import Logger
from twisted.internet.abstract import isIPAddress, isIPv6Address
from twistedcaldav.client.pool import installPool
from twistedcaldav.config import config, fullServerPath
from twistedcaldav.xmlutil import readXML
from txdav.caldav.datastore.scheduling.ischedule.utils import getIPsFr... |
"""
Django settings for mgbudget project.
Generated by 'django-admin startproject' using Django 1.11.1.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
import o... |
import gobject
import gtk
from sltv.settings import UI_DIR
from sltv.ui.save_button import SaveButton
from core import InputUI
class DVInputUI(InputUI):
def __init__(self):
InputUI.__init__(self)
self.interface.add_from_file(UI_DIR + "/input/dvinput.ui")
self.box = self.interface.get_object... |
'''
Create a SCP side-channel to transfer a file to remote network device.
SCP requires a separate SSH connection.
Currently only supports Cisco IOS.
'''
from __future__ import print_function
from __future__ import unicode_literals
import re
import os
import hashlib
import paramiko
import scp
class SCPConn(objec... |
from django.conf.urls import patterns, url
from . import views
urlpatterns = patterns('',
url(r'^$',
views.DashboardView.as_view(),
name="dashboard"),
# Organizations
url(r'^organization/$',
views.OrganizationListView.as_view(),
name="organization-list"),
url(r'^organ... |
"""
Helper methods for operations related to the management of volumes,
and storage repositories
"""
from nova.openstack.common.gettextutils import _
from nova.openstack.common import log as logging
from nova.virt.vmwareapi import vim_util
from nova.virt.vmwareapi import vm_util
LOG = logging.getLogger(__name__)
cl... |
"""Utilities to assist with commerce tasks."""
import json
import logging
from urllib import urlencode
from urlparse import urljoin
import requests
import waffle
from django.conf import settings
from django.contrib.auth import get_user_model
from django.core.urlresolvers import reverse
from django.utils.translation im... |
import btk
import unittest
class WrenchTest(unittest.TestCase):
def test_Constructor_default(self):
test = btk.btkWrench()
self.assertEqual(test.GetPosition().GetLabel(), "")
self.assertEqual(test.GetPosition().GetType(), btk.btkPoint.Marker)
self.assertEqual(test.GetForce().GetLabe... |
# coding=utf-8
"""InaSAFE Disaster risk tool by Australian Aid - Classified Polygon on
Population Metadata Definitions.
Contact : <EMAIL>
.. 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 Foun... |
__version__ = '1.0'
__author__ = 'Zachary Nowak'
"""STANDARD LIBRARY IMPORTS"""
from statistics import median#FIXME
def create_dict(pressCharTimeLine,pressTimeLine,releaseCharTimeLine, releaseTimeLine, dataDict):
"""FIND NUMBER OF UNIQUE CHARACTERS"""
runningHistory = ""
for char in pressCharTimeLine:
if char n... |
import os.path
from umit.pm.gui.plugins.containers import setup
setup(
name='CFieldsExplorer',
version='1.0',
author=['Francesco Piccinno'],
license=['GPL'],
copyright=['2008 Adriano Monteiro Marques'],
url='http://blog.archpwn.org',
scripts=['sources/main.py'],
start_file="main",
p... |
from Screens.Screen import Screen
from Components.ConfigList import ConfigListScreen
from Components.ActionMap import ActionMap
from Components.Sources.StaticText import StaticText
from Components.config import config, configfile, getConfigListEntry
from Components.NimManager import nimmanager, InitNimManager
from Comp... |
import sys
from django.core import management
def main(settings_file, logfile=None):
try:
mod = __import__(settings_file)
components = settings_file.split('.')
for comp in components[1:]:
mod = getattr(mod, comp)
except ImportError, e:
sys.stderr.write("Error loadi... |
#!/usr/bin/env python
"""
Hosts requests sent to the NLPipeline as ROS services.
"""
# Copyright (C) 2012 Constantine Lignos
#
# This file is a part of SLURP.
#
# SLURP 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 Fo... |
import numpy as np
from lsst.sims.utils import CoordinateTransformations as ct
import matplotlib.pyplot as plt
def inclined_vec(a,i,t,theta_0=0.,omega0=2*np.pi):
omega = a**(-3/2.)*omega0
theta_0_rad = np.deg2rad(theta_0)
x = a*np.cos(omega*t + theta_0_rad)
y = a*np.cos(i)*np.sin(omega*t + theta_0_rad)... |
from config.experiment_config_lib import ControllerConfig
from sts.topology import FatTree
from sts.control_flow.fuzzer import Fuzzer
from sts.input_traces.input_logger import InputLogger
from sts.simulation_state import SimulationConfig
from sts.util.convenience import backtick
def get_additional_metadata():
path =... |
import os
import glob
from collections import defaultdict
from itertools import izip
import math
import numpy
from numpy.testing import assert_array_almost_equal
from nose import SkipTest
from nose.tools import assert_true, assert_less, assert_equal
import importlib
import distributions
from goftests import multinomial... |
'''
Created on Feb 12, 2016
@author: hoeseong
'''
import time
import mController
import mLogger
# ==== main():begin =====
if __name__ == '__main__':
# record the begin time
begin_time = time.time()
# declare 'logger' class to send a message to a log file
logger = mLogger.mLogger()
logger.debug(str(time... |
# for controlling the browser
from selenium import webdriver
# for soup what else?! (to parse the data)
from bs4 import BeautifulSoup
# to emulate pressing enter instead of getting the button and clicking it
from selenium.webdriver.common.keys import Keys
# To select 2nd sem from drop down list
from selenium.webdriver.... |
import re, time, random
from osv import fields, osv
from tools.translate import _
import netsvc
logger=netsvc.Logger()
"""
account.invoice object:
- Add support for Belgian structured communication
- Rename 'reference' field labels to 'Communication'
"""
class account_invoice(osv.osv):
_inher... |
'''
Created on Sep 12, 2014
@author: Ronald Haentjens Dekker
'''
import unittest
from collatex import Collation, collate
from collatex.exceptions import SegmentationError
class Test(unittest.TestCase):
def assertTask(self, expected_description, expected_args, actual):
# compare description (as string)
... |
from pyasn1.type import univ, char, namedtype, namedval, tag, constraint, useful
from pyasn1_modules import rfc2560
from pyasn1_modules import rfc5280
MAX = float('inf')
# Imports from RFC 5280
AlgorithmIdentifier = rfc5280.AlgorithmIdentifier
AuthorityInfoAccessSyntax = rfc5280.AuthorityInfoAccessSyntax
Certifica... |
RESEARCH_EXPORTS_APP = 'manage_research_exports'
RESEARCH_EXPORTS_API = 'https://www.coursera.org/api/onDemandExports.v2/'
COURSE_API = 'https://www.coursera.org/api/onDemandCourses.v1/'
PARTNER_API = 'https://www.coursera.org/api/partners.v1/'
CLICKSTREAM_API = 'https://www.coursera.org/api/clickstreamExportsDownload.... |
from .rfc822 import _parse_date_rfc822
_months = [
'jan',
'feb',
'mar',
'apr',
'may',
'jun',
'jul',
'aug',
'sep',
'oct',
'nov',
'dec',
]
def _parse_date_asctime(dt):
"""Parse asctime-style dates.
Converts asctime to RFC822-compatible dates and uses the RFC822 ... |
from selenium.common.exceptions import StaleElementReferenceException
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.remote.webelement import WebElement
from selenium.webdriver.remote.command import Command
from selenium.webdriver.support.ui import Select
import re
clas... |
"""
Python Interchangeable Virtual Instrument Library
Copyright (c) 2013-2016 Alex Forencich
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... |
from openerp import models, api
from odoo.exceptions import ValidationError
class AccountInvoiceConfirm(models.TransientModel):
_inherit = "account.invoice.confirm"
@api.multi
def invoice_confirm(self):
context = dict(self._context or {})
active_ids = context.get('active_ids', []) or []
... |
import getopt
import json
import os
import shlex
from urllib.parse import parse_qs
from flask import (
Flask,
request,
Response
)
import praw
from slacker import Slacker
from rx import Observable, Observer
from rx.concurrency import new_thread_scheduler
from util import (
retrieve_credentials
)
import... |
"""
Checker for common errors in Lore documents.
"""
from xml.dom import minidom as dom
import parser, urlparse, os.path
from twisted.lore import tree, process
from twisted.web import domhelpers
from twisted.python import reflect
# parser.suite in Python 2.3 raises SyntaxError, <2.3 raises parser.ParserError
parser... |
from ..base.utilities import remove_duplicates
from .exceptions import ObjectAlreadyExists, ObjectNotFound
from .exceptions import NonMatchingTaxonomyIds
__all__ = [
'format_annotation',
'format_annotations',
'format_label',
'format_labels',
'validate_annotations',
'validate_go_annotations',
... |
#!/usr/bin/env python3
#-*- coding: utf-8 -*-
from __future__ import print_function
from subprocess import Popen, PIPE
import os, sys
try:
import netifaces
except ImportError:
install_binary("python3-netifaces")
W = '\033[1;37m' # white (normal)
R = '\033[31m' # red
G = '\033[32m' # green
O = '\033[33m' # orange... |
from oslo_policy import policy
from nova.policies import base
POLICY_ROOT = 'os_compute_api:os-server-groups:%s'
server_groups_policies = [
policy.DocumentedRuleDefault(
POLICY_ROOT % 'create',
base.RULE_ADMIN_OR_OWNER,
"Create a new server group",
[
{
... |
from google.cloud.asset_v1p1beta1.services.asset_service.client import AssetServiceClient
from google.cloud.asset_v1p1beta1.services.asset_service.async_client import AssetServiceAsyncClient
from google.cloud.asset_v1p1beta1.types.asset_service import SearchAllIamPoliciesRequest
from google.cloud.asset_v1p1beta1.types... |
from django.test import TestCase
from curious import model_registry
from curious.query import Query
from curious_tests.models import Blog, Entry, Author
from curious_tests import assertQueryResultsEqual
import curious_tests.models
class TestQueryJoins(TestCase):
def setUp(self):
names = ('Databases', 'Relationa... |
"""Unit tests for the search engine query parsers."""
import pypeg2
import pytest
from pytest import generate_tests
from invenio_query_parser.ast import GreaterOp, Keyword, KeywordOp, Value
from invenio_query_parser.contrib.elasticsearch.walkers import dsl
from invenio_query_parser.contrib.spires import converter
fro... |
"""Test praw.models.inbox."""
import mock
import pytest
from prawcore import Forbidden
from praw.models import Comment, Message, Redditor, Subreddit
from .. import IntegrationTest
class TestInbox(IntegrationTest):
def test_all(self):
self.reddit.read_only = False
with self.recorder.use_cassette(... |
"""The tests for the Sun component."""
from datetime import datetime, timedelta
from unittest.mock import patch
from pytest import mark
import homeassistant.components.sun as sun
from homeassistant.const import EVENT_STATE_CHANGED
import homeassistant.core as ha
from homeassistant.setup import async_setup_component
i... |
from __future__ import unicode_literals
"""build query for doclistview and return results"""
import frappe, json
import frappe.defaults
import frappe.share
import frappe.permissions
from frappe.utils import flt, cint, getdate, get_datetime, get_time, make_filter_tuple, get_filter
from frappe import _
from frappe.model... |
#!/usr/bin/env python
"""
Author: Timothy A.V. Teatro <http://www.timteatro.net>
Date : Oct 25, 2010
Lisence: Creative Commons BY-SA
(http://creativecommons.org/licenses/by-sa/2.0/)
Description:
A program which uses an explicit finite difference
scheme to solve the diffusion equation with fixed
boundary values and... |
#!/usr/bin/env python
import os
import sys
import time
import getopt
import calendar
import threading
from datetime import datetime, timedelta
import jinja2
import cherrypy
from cherrypy.process.plugins import Daemonizer
import logging
try:
from logging.handlers import WatchedFileHandler
except ImportError:
... |
#merge.py
#Given two intelhex16bit objects, merge them together with various options
from pymomo.utilities import intelhex
def insert_hex(stub, payload, start_addr, skip_ranges, payload_size):
addrs = clip_payload(payload, payload_size)
print "Inserting Hex file [0x%X, 0x%X]" % (addrs[0], addrs[-1])
curr = start... |
import collections
from oslo.config import cfg
import psutil
import six
from six.moves.urllib import parse
import yaml
from stackalytics.openstack.common import log as logging
from stackalytics.processor import config
from stackalytics.processor import default_data_processor
from stackalytics.processor import lp
from... |
#!/usr/bin/env python3
import sys
import os
import shutil
import path_utils
import detect_repo_type
import git_lib
def _test_repo_path(path):
v, r = detect_repo_type.detect_repo_type(path)
if not v:
return False, r
if r is None:
return False, "Path [%s] does not point to a supported repo... |
"""
Defines the shoppingcart URLs
"""
from __future__ import absolute_import
from django.conf import settings
from django.conf.urls import url
from shoppingcart import views
urlpatterns = [
# Both the ~accept and ~reject callback pages are handled here
url(r'^postpay_callback/$', views.postpay_callback, nam... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ui/src/log.ui'
#
# by: PyQt4 UI code generator 4.7.3
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
class Ui_Log(object):
def setupUi(self, Log):
Log.setObjectName("Log")
L... |
import utils, shlex
from flask import json
from sqlalchemy import asc, desc, and_, or_
from types import LongType, DictType, ListType
from octohaven import db, api
from sparkmodule import SPARK_OCTOHAVEN_JOB_ID
class Job(db.Model):
uid = db.Column(db.Integer, primary_key=True, autoincrement=True)
name = db.Col... |
#!/usr/bin/env python
"""
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License");... |
import os
from qtpy import QtWidgets, QtGui
from ..globals import pointers, constants
from ..connections import signals
class ActionInMenu(QtWidgets.QAction):
def __init__(self, name, menu):
super().__init__(name, menu)
menu.addAction(self)
self.triggered.connect(self.on_trigger)
de... |
#!/usr/bin/python
import MySQLdb
import sys
var1 = 1
while var1 == 1:
hid = { 4: 'a', 5: 'b', 6: 'c', 7: 'd', 8: 'e', 9: 'f', 10: 'g', 11: 'h', 12: 'i', 13: 'j', 14: 'k', 15: 'l', 16: 'm', 17: 'n', 18: 'o', 19: 'p', 20: 'q', 21: 'r', 22: 's', 23: 't', 24: 'u', 25: 'v', 26: 'w', 27: 'x', 28: 'y', 29: 'z', 30: '1', 31... |
#!/usr/bin/env python
from counters import __version__
sdict = {
'name' : 'counters',
'version' : __version__,
'description' : 'A Python port of https://github.com/francois/counters',
'long_description' : 'Provides an easy interface to count any kind of performance metrics within a system',
'url': ... |
import codecs
import datetime
import locale
from decimal import Decimal
from urllib.parse import quote, unquote_to_bytes
from django.utils import six
from django.utils.functional import Promise
class DjangoUnicodeDecodeError(UnicodeDecodeError):
def __init__(self, obj, *args):
self.obj = obj
Unic... |
import abc
class SenderGetter(abc.ABC):
"""
Helper base class that introduces the `sender`, `input_sender`
and `sender_id` properties and `get_sender` and `get_input_sender`
methods.
"""
def __init__(self, sender_id=None, *, sender=None, input_sender=None):
self._sender_id = sender_id
... |
from euca2ools.commands.argtypes import delimited_list
from euca2ools.commands.autoscaling import AutoScalingRequest
from requestbuilder import Arg
class EnableMetricsCollection(AutoScalingRequest):
DESCRIPTION = "Enable monitoring of an auto-scaling group's group metrics"
ARGS = [Arg('AutoScalingGroupName', ... |
from future import standard_library
standard_library.install_aliases()
from builtins import object, str
from copy import deepcopy
from pickle import dumps
import simplejson
import os
import getpass
from socket import getfqdn
from uuid import uuid1
import numpy as np
try:
from collections import OrderedDict
except... |
import gtk
from xl import (
covers,
settings,
xdg
)
from xl.nls import gettext as _
from xlgui import icons
from xlgui.preferences import widgets
name = _('Covers')
icon = 'image-x-generic'
ui = xdg.get_data_path('ui', 'preferences', 'cover.ui')
class TagCoverFetching(widgets.CheckPreference):
defaul... |
#!/usr/bin/env python
# encoding: utf-8
import os
from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL
from efl import elementary
from efl.elementary.window import StandardWindow
from efl.elementary.background import Background
from efl.elementary.button import Button
from efl.elementary.scroller import Scroller
fro... |
from __future__ import absolute_import, division, print_function, unicode_literals
from amaascore.assets.asset import Asset
class Sukuk(Asset):
def __init__(self, asset_manager_id, asset_id, maturity_date, asset_issuer_id=None,
asset_status='Active', roll_price=True, issue_date=None, display_na... |
# -*- coding: utf8 -*-
import sys
import os
import logging
import argparse
from datetime import datetime
from collections import defaultdict
from common_tools import parent_parser
from parser import Request_Parser, Response_Parser
from config import settings
from image import image_type_detection, get_image_info, cal... |
"""Unit tests for data sample obtained from MiSchroe."""
import unittest
from datetime import datetime
from pyvlx.const import NodeTypeWithSubtype, NodeVariation, Velocity
from pyvlx.api.frame_creation import frame_from_raw
from pyvlx.api.frames import (
FrameGetAllNodesInformationNotification,
FrameGetNodeInf... |
# -*- coding: utf8 -*-
from unittest import skipIf
import django
from django.contrib.auth import authenticate
from django.test.utils import override_settings
from django.utils import unittest
from mock import patch, MagicMock
from nopassword.backends.base import NoPasswordBackend
from nopassword.backends.sms import ... |
import datetime
import logging
from abc import abstractmethod
from email.utils import parseaddr
import jmespath
from c7n_azure import constants
from c7n_azure.actions.base import AzureBaseAction, AzureEventAction
from c7n_azure.tags import TagHelper
from c7n_azure.utils import StringUtils
from dateutil import tz as tz... |
from kamene.all import *
import builtins
#####################################################################
# Helpers and constants
#####################################################################
skinny_messages_cls = {
# Station -> Callmanager
0x0000: "SkinnyMessageKeepAlive",
0x0001: "SkinnyMessageReg... |
# -*- coding: utf-8 -*-
from collections import OrderedDict
import inspect
def _namespace(obj):
"""
Return qualified name from object
"""
module = obj.__module__ or __name__
if hasattr(obj, '__qualname__'):
name = obj.__qualname__
return '.'.join((module, name))
klass = getat... |
from mien.nmpml.basic_tools import NmpmlObject
import os
##from popen2 import Popen4
from mien.math.array import *
import tempfile
from time import time
SIMULATOR_COMMANDS = {"Neuron":"neuron"}
def getDir(name):
if os.path.isdir("/scratch"):
dir="/scratch/"
else:
dir=os.getcwd()
d=tempfile.mkdtemp(prefix=name... |
import django_tables2 as tables
from django.contrib.contenttypes.models import ContentType
from django.utils.safestring import mark_safe
from django.utils.html import escape
from lava.utils.lavatable import LavaTable
from lava_scheduler_app.tables import RestrictedIDLinkColumn
from lava_results_app.models import (
... |
#coding=UTF-8
from pyspark import SparkContext, SparkConf, SQLContext, Row, HiveContext
from pyspark.sql.types import *
from datetime import date, datetime, timedelta
import sys, re, os
st = datetime.now()
conf = SparkConf().setAppName('PROC_O_CEN_CBOD_ECCMRCMS').setMaster(sys.argv[2])
sc = SparkContext(conf = conf)
s... |
from sympy import factorial, sqrt, exp, S, laguerre_l, Float
def R_nl(n, l, r, Z=1):
"""
Returns the Hydrogen radial wavefunction R_{nl}.
n, l .... quantum numbers 'n' and 'l'
r .... radial coordinate
Z .... atomic number (1 for Hydrogen, 2 for Helium, ...)
Everything is in Hartree atom... |
from __future__ import absolute_import, division, print_function, unicode_literals
import textwrap
import unittest
from pants.option.config import Config
from pants.util.contextutil import temporary_file
class ConfigTest(unittest.TestCase):
def setUp(self):
self.ini1_content = textwrap.dedent(
"""
... |
#!/usr/bin/env python3
"""A simple example which loads a SEG Y file and saves it again.
Usage:
loadsave.py <in.segy> <out.segy>
"""
from __future__ import print_function
import os
import sys
import traceback
from segpy.reader import create_reader
from segpy.writer import write_segy
def make_progress_indic... |
"""
ResourceData object
"""
from oslo_versionedobjects import base
from oslo_versionedobjects import fields
from heat.common import exception
from heat.db import api as db_api
class ResourceData(
base.VersionedObject,
base.VersionedObjectDictCompat,
base.ComparableVersionedObject,
):
fields = {
... |
#!/usr/bin/env python
"""
copy the nvd datafiles from NIST and then use the
nvd2sqlite3 program to load them into /var/db/cvedb
this is a python app which implements control of shell
commands. depends on curl, gunzip and rm to implement
the features.
Mark Menkhus, June 2016
"""
import datetim... |
from cmsis_svd.parser import SVDParser
import json
import re
# ------------------------------------
svd_name = 'STM32F303x.svd'
want_ofs = True
want_len = True
# Do not print poripheral field definitions (same as first instance)
no_print_fields = [
'GPIOB',
'GPIOC',
'GPIOD',
'GPIOG',
'GPIOF',
'USART2',
'USAR... |
from gi.repository import Gtk, Gdk, GObject, GdkPixbuf
from math import pi
import cairo
import os
from lollypop.define import Lp, ArtSize
class BaseArt(GObject.GObject):
"""
Base art manager
"""
_CACHE_PATH = os.path.expanduser("~") + "/.cache/lollypop"
__gsignals__ = {
'cover-change... |
from __future__ import division, print_function, absolute_import
import gc
import os
import re
import sys
import threading
import numpy as np
from nose import SkipTest
from numpy.testing import (assert_raises, assert_equal, dec, run_module_suite, assert_,
assert_allclose)
from scipy._lib._t... |
import re
from .atype import AmigaType, AmigaTypeWithName
from .cstring import CString
class AmigaTypeDecorator(object):
def __init__(self, struct_def, wrap, funcs, allow_struct):
if wrap is None:
wrap = {}
self.struct_def = struct_def
self.wrap = wrap
self.funcs = funcs
self.allow_struct ... |
from django import forms
from django.conf import settings
from django.contrib import admin
from django.utils.safestring import mark_safe
from dal import autocomplete
from .models import Place
class GeonamesLookupWidget(autocomplete.Select2):
'''Customize autocomplete select widget to display Geonames URI
as ... |
#!/usr/bin/env python
"""
Copyright (c) 2004-Present Pivotal Software, Inc.
This program and the accompanying materials are made available under
the terms of the 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 ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@script : daemontools.py
@about :
"""
import os, re
import subprocess
import shlex
import platform
from time import sleep, time
__version__ = "0.0.2"
def system(command):
"""
Результат выполнения системной команды
$ ret=system('dmesg | grep hda')
$ print ret[... |
import mock
import os
import sys
import unittest
import util
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
import volume
class test_volume(unittest.TestCase):
def check_volume_stat_result(self, stat_result):
self.assertIsInstance(stat_result["key"], str)
try:
self.as... |
import tensorflow as tf
class PatchUnit(tf.keras.Model):
def __init__(self, ndf: int = 64, strides: int = 2, use_bias: bool = False, batch_norm: bool = True,
relu: bool = True):
super().__init__()
self.pad = tf.keras.layers.ZeroPadding2D(padding=2)
self.conv = tf.keras.la... |
# -*- coding: 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 model 'Publisher'
db.create_table('utils_publisher', (
('id', self.gf('django.db.models... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
This module implements community detection.
"""
__all__ = ["partition_at_level", "modularity", "best_partition", "generate_dendogram", "induced_graph"]
__author__ = """Thomas Aynaud (<EMAIL>)"""
'''
Copyright (c) 2009, Thomas Aynaud <<EMAIL>>
All rights reserved.
Redistri... |
"""
Github: https://github.com/MaxInGaussian/GPoFM
Author: Max W. Y. Lam [<EMAIL>]
"""
import os
import sys
import time
import shutil
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.common.exceptions import NoSuchElementException
class Bot(object):
br_dict, i... |
import collectd
# Function to split DataType definition into string (used in map function)
def split_to_value(item):
return item.split(":")[0]
# Read types.db to memory
def read_types_from_file():
global data_sources
data_sources = {}
types_file = open('./collectd_plugin/types.db', 'r')
for str ... |
import SocketServer
import SimpleHTTPServer
import threading
from time import sleep
class HTTPServer:
"""
Simple HTTP Server
"""
# internal SocketServer instance
server = None
def __init__(self, handler=None, port=8080):
"""Configure Server Setup"""
self.port = port
se... |
import glob
import os
import os.path
import sys
import tempfile
import time
import warnings
from contextlib import contextmanager
from pyanaconda.anaconda_loggers import get_module_logger, get_stdout_logger
from pyanaconda.core import util
from pyanaconda.core.configuration.anaconda import conf
from pyanaconda.core.k... |
# coding: utf-8
from quokka.core.tests import BaseTestCase
from quokka.core.models import Channel
from ..models import Post
class TestPost(BaseTestCase):
def setUp(self):
self.channel, new = Channel.objects.get_or_create(title="test channel")
self.post_dict = {
"title": "Python Reache... |
import os
import ycm_core
# These are the compilation flags that will be used in case there's no
# compilation database set (by default, one is not set).
# CHANGE THIS LIST OF FLAGS. YES, THIS IS THE DROID YOU HAVE BEEN LOOKING FOR.
flags = [
'-Wall',
'-Wextra',
'-Wno-unused-parameter',
'-fno-strict-aliasing',
#'-std=... |
from keystone.common import sql
from keystone.contrib import roles
from keystone import exception
from keystone.i18n import _
class Role(sql.ModelBase, sql.ModelDictMixin):
__tablename__ = 'role_fiware'
__table_args__ = (sql.UniqueConstraint('name', 'application_id'), {'extend_existing': True})
attributes... |
from __future__ import absolute_import, unicode_literals
import sys
from unittest import TestCase
from prometheus_client import CollectorRegistry, Counter
from prometheus_client.exposition import CONTENT_TYPE_LATEST
if sys.version_info < (2, 7):
from unittest2 import skipUnless
else:
from unittest import ski... |
{
"name": "Invoice Line Lots",
"version": "8.0.0.1.0",
'category': 'Generic Modules/Accounting',
"depends": [
"sale_stock",
"stock_account"],
"author": "AvanzOSC",
"summary": "Display delivered serial numbers in invoice lines",
'website': 'http://www.avanzosc.es',
'data':... |
from django.urls import reverse
from rest_framework import status
from rest_framework.test import force_authenticate, APITestCase, APIClient, APIRequestFactory
from core.models import User, AccessLevel, Owner
from core.views import UserViewSet, AccessLevelViewSet, OwnerViewSet
class AuthAPITestCase(APITestCase):
... |
# -*- coding: utf-8 -*-
from openerp import models, fields, api
from openerp.tools.translate import _
from openerp.exceptions import Warning
#TODO :
# - Ajouter les filtres dans la zone de recherche sur toutes les colonnes $
# - Revoir le niveau en champ de type texte avec des tirets devant
# - Ajouter le segment
... |
# -*- coding: utf-8 -*-
from __future__ import (unicode_literals, division, absolute_import, print_function)
store_version = 1 # Needed for dynamic plugin loading
__license__ = 'GPL 3'
__copyright__ = '2011, Tomasz Długosz <<EMAIL>>'
__docformat__ = 'restructuredtext en'
import re
import urllib
from contextlib impor... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.