content stringlengths 4 20k |
|---|
#!/usr/bin/env python3
import os
from pathlib import Path
import uuid
cl_compile = []
cl_include = []
source_dirs = set()
for root, subdirs, files in os.walk('src'):
for file in [os.path.join(root, f) for f in files]:
lowerfile = file.lower()
add_source_dir = False
if lowerfile.endswith('.cpp') or l... |
from django import template
from django.core.exceptions import ObjectDoesNotExist
class NextPreviousNode(template.Node):
def __init__(self, direction, queryset, date_field, varname):
(self.direction,
self.date_field,
self.varname) = (direction,
date_field,
... |
from threading import Thread
from random import randint
from time import sleep
from Acspy.Clients.SimpleClient import PySimpleClient
from Acspy.ContainerActivationMap import ContainerActivationMap
'''
Test the ContainerActivationMap
'''
class ContainerSimulator(Thread):
'''
ContainerSimulator activate/deactiv... |
from __future__ import (absolute_import, division, print_function)
from ranger.ext.direction import Direction
class Accumulator(object):
def __init__(self):
self.pointer = 0
self.pointed_obj = None
def move(self, narg=None, **keywords):
direction = Direction(keywords)
lst = ... |
# -*- coding: utf-8 -*-
"""
All code involving requests and responses over the http network
must be abstracted in this file.
"""
__title__ = 'newspaper'
__author__ = 'Lucas Ou-Yang'
__license__ = 'MIT'
__copyright__ = 'Copyright 2014, Lucas Ou-Yang'
import logging
import requests
from .configuration import Configurat... |
import numpy as np
from matplotlib.colors import LogNorm, Normalize
from matplotlib import cm
from qtpy.QtCore import Qt
from qtpy.QtGui import QPixmap, QIcon, QImage
from qtpy.QtWidgets import QWidget
from mantid.plots.utility import get_colormap_names
from mantidqt.utils.qt import load_ui
from mantidqt.utils.qt.line... |
#!/usr/bin/python
import sys
class HexParserException(Exception):
""" Ausnahmeklasse fuer den Intel-Hex-Parser """
pass
class Segment:
""" Speicher einen String mit Speicherinhalten zusammen mit seiner Startadresse """
def __init__(self, address = 0, data = ''):
self.address = address
self.data = data
def... |
#!/usr/bin/env python
import sys
def readSRCFile(fileName, clusters):
srcfile = open(fileName, "r")
for line in srcfile.readlines():
if line[0] == '#': #header
continue
line = line.rstrip()
reads = line.split(' ')
query_read_id = int(reads[0]) - 1
for read in... |
#!/usr/bin/env py.test
"""Unit tests for SubDomain"""
# Copyright (C) 2013 Johan Hake
#
# This file is part of DOLFIN.
#
# DOLFIN 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 3 of th... |
#File to read the data from mysql and push into CSV.
# Python imports
import datetime as dt
import csv
import copy
import os
import pickle
# 3rd party imports
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# QSTK imports
from QSTK.qstkutil import qsdateutil as du
import QSTK.qstkutil.DataEvol... |
"""
Copyright 2015 Brocade Communications Systems, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed t... |
'''
Created on Aug 28, 2014
@author: lwoydziak
'''
from __future__ import print_function
import sys
import argparse
from re import compile, IGNORECASE
def preprocess(inputfile):
with open("README.rst", mode='w') as output:
regex = compile('^@@INSERT@@', IGNORECASE) # regex to matches the package name at t... |
#!/usr/bin/python2
# -*- coding: utf-8 -*-
# $File: learner.py
# $Date: Sun May 25 19:09:33 2014 +0800
# $Author: Xinyu Zhou <zxytim[at]gmail[dot]com>
#
# TODO:
# generalize metrics, see:
# http://scikit-learn.org/stable/modules/classes.html#sklearn-metrics-metrics
import sklearn
from sklearn.neighbors import ... |
import warnings
from django.conf import settings
from django.core.urlresolvers import reverse, NoReverseMatch
from oscar.core import prices
from oscar.core.loading import get_class, get_model
from rest_framework import serializers, exceptions
from django.utils.translation import ugettext_lazy as _
from oscarapi.baske... |
from telemetry.value import improvement_direction
from telemetry.value import list_of_scalar_values
from telemetry.web_perf.metrics import timeline_based_metric
class _SingleEventMetric(timeline_based_metric.TimelineBasedMetric):
"""Reports directly durations of specific trace events that start during the
user in... |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from ccdproc import CCDData
import argparse
import matplotlib
matplotlib.use('Qt5Agg')
import matplotlib.pyplot as plt
# disables the s key event for saving.
# plt.rcParams['keymap.save'] = ''
import astropy.uni... |
#!/usr/bin/python3
from xml.etree import ElementTree as ET
import zipfile
import rdflib
import os.path
import re
def read_tree(filename=None, ignore_version=False):
if filename is None:
raise ValueError('Filename missing.')
elif not os.path.isfile(filename):
raise OSError('File not found: ' +... |
"""This module contains the auxiliary class ContextTypes."""
from typing import Type, Generic, overload, Dict # pylint: disable=W0611
from telegram.ext.callbackcontext import CallbackContext
from telegram.ext.utils.types import CCT, UD, CD, BD
class ContextTypes(Generic[CCT, UD, CD, BD]):
"""
Convenience cl... |
# -*- coding: utf-8 -*-
from openerp.tests.common import TransactionCase
class TestGetWeight(TransactionCase):
"""Test get_weight functions."""
# some helpers
def _create_order(self, customer):
return self.env['sale.order'].create({
'partner_id': customer.id,
})
def _cre... |
# -*- coding: utf-8 -*-
class Charset(object):
common_name = 'NotoSansTamil-Bold'
native_name = ''
def glyphs(self):
chars = []
chars.append(0x0000) #uni0000 ????
chars.append(0x200B) #uniFEFF ZERO WIDTH SPACE
chars.append(0x200C) #uni200C ZERO WIDTH NON-JOINER
... |
from unittest import TestCase
from importio2 import ExtractorUtilities
from importio2 import CrawlRunAPI
from tests.unit.importio2.test_data import ExtractorRunAndWait
import logging
logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.INFO)
class TestExtractorAPI(TestCase):
def test_construc... |
"""
Copyright (C) <2010> Autin L.
This file ePMV_git/softimage/plugin/ePMVPlugin.py is part of ePMV.
ePMV 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 License,... |
"""abydos.distance._eudex.
eudex distance functions
"""
from typing import (
Any,
Callable,
Generator,
Iterable,
List,
Optional,
Union,
cast,
)
from ._distance import _Distance
from ..phonetic import Eudex as EudexPhonetic
__all__ = ['Eudex']
class Eudex(_Distance):
"""Distance... |
import os
import re
import logging
log = logging.getLogger(__name__)
from vdisk.helpers import copy_file
from vdisk.helpers import create_directory
from vdisk.helpers import install_packages
from vdisk.helpers import write_mounted
from vdisk.externalcommand import ExternalCommand
chroot = ExternalCommand("chroot")
... |
import os
import urllib
import socket
from gi.repository import GObject, Nautilus
# do not touch the following line.
appname = 'ownCloud'
def get_local_path(url):
if url[0:7] == 'file://':
url = url[7:]
return urllib.unquote(url)
def get_runtime_dir():
"""Returns the value of $XDG_RUNTIME_DIR, a... |
# from __future__ import division
import sys
from PIL import Image
import os
import numpy as np
from util import load_image, array2PIL
import argparse
from scipy.stats import percentileofscore
parser = argparse.ArgumentParser()
parser.add_argument('-image' , type=str , default= 'image.png')
parser.add_argu... |
#import these to compile code and install values
from askbot import const
import askbot
import askbot.conf.minimum_reputation
import askbot.conf.vote_rules
import askbot.conf.reputation_changes
import askbot.conf.karma_and_badges_visibility
import askbot.conf.email
import askbot.conf.forum_data_rules
import askbot.conf... |
"""
Feature descriptors. (Szeliski 4.1.2)
"""
import numpy as np
import scipy as sp
from compvis.utils import get_patch_centered
def cross_corr(patch_0, patch_1):
"""
Returns the cross-correlation between two same-sized image patches.
Parameters :
patch_0, patch_1 : image patches
"""... |
from __future__ import unicode_literals
from django import forms
from django.contrib.auth import password_validation
from django.contrib.auth.forms import ReadOnlyPasswordHashField
from django.utils.translation import ugettext, ugettext_lazy as _
from emailauth.models import User
class UserCreationForm(forms.ModelF... |
import math
import struct
from pycoin.encoding.b58 import a2b_hashed_base58
from pycoin.intbytes import indexbytes
LOG_2 = math.log(2)
def filter_size_required(element_count, false_positive_probability):
# The size S of the filter in bytes is given by
# (-1 / pow(log(2), 2) * N * log(P)) / 8
# Of course... |
import unittest
from libsaas import port
from libsaas.executors import test_executor
from libsaas.services import instagram
from libsaas.services.base import MethodNotSupported
class InstagramTestCase(unittest.TestCase):
def setUp(self):
self.executor = test_executor.use()
self.executor.set_resp... |
import collections
import bpy
from sverchok.node_tree import SverchCustomTreeNode
from sverchok.data_structure import zip_long_repeat
class SvSeparateMeshNode(bpy.types.Node, SverchCustomTreeNode):
'''Separate Loose mesh parts'''
bl_idname = 'SvSeparateMeshNode'
bl_label = 'Separate Loose Parts'
bl_... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
account action
author <EMAIL>
"""
from kpages import url,not_empty
from kpages.model import ModelMaster
from utility import ActionHandler
from logic.utility import m_update,m_del,m_info,m_exists
AModel = ModelMaster()('AccountModel')
@url(r"/admin/?")
class A... |
"""
Helpers for the OpenSSL test suite, largely copied from
U{Twisted<http://twistedmatrix.com/>}.
"""
from six import PY2
# This is the UTF-8 encoding of the SNOWMAN unicode code point.
NON_ASCII = b"\xe2\x98\x83".decode("utf-8")
def is_consistent_type(theType, name, *constructionArgs):
"""
Perform variou... |
#! -*- coding: utf-8 -*-
"""
针对sqlalchemy 的练习
"""
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String, DateTime, ForeignKey
from sqlalchemy.orm import relationship, sessionmaker
import datetime
engine = create_engine('sqlite:///:... |
import six
from neutronclient._i18n import _
from neutronclient.neutron import v2_0 as neutronV20
def _format_provider(pool):
return pool.get('provider') or 'N/A'
class ListPool(neutronV20.ListCommand):
"""List pools that belong to a given tenant."""
resource = 'pool'
list_columns = ['id', 'name',... |
"""
Generates a scalar field given a grid of points and their relative scalar values
-
Provided by Wasp 0.5
Args:
BOU: List of geometries defining the boundaries of the field. Geometries must be closed breps or meshes. All points of the field outside the geometries will be assigned a 0 value
PTS: 3d... |
"""
Defines functions that can be used to inspect the properties of a
function call. For example
lhs_info() can be used to get retrieve the names and number of
arguments that are being assigned to a function
return
"""
from __future__ import (absolute_import, divis... |
"""Test the TcEx Threat Intel Module."""
# standard library
import os
from random import randint
from .ti_helpers import TestThreatIntelligence, TIHelper
class TestUserAgentIndicators(TestThreatIntelligence):
"""Test TcEx User Agent Indicators."""
indicator_field = 'User Agent String'
indicator_field_ar... |
"""Pipeline options validator.
For internal use only; no backwards-compatibility guarantees.
"""
# pytype: skip-file
import logging
import re
from apache_beam.internal import pickler
from apache_beam.options.pipeline_options import DebugOptions
from apache_beam.options.pipeline_options import GoogleCloudOptions
from... |
from openerp.osv import fields, osv
from openerp.tools.translate import _
import logging
_l = logging.getLogger(__name__)
class hr_job(osv.Model):
_name = 'hr.job'
_inherit = 'hr.job'
def _get_all_child_ids(self, cr, uid, ids, field_name, arg, context=None):
result = dict.fromkeys(ids)
... |
from django.core.management.base import BaseCommand, CommandError
from contento.backends.files import FlatFilesBackend
from contento.backends.sql import SQLBackend
from contento.exceptions import CmsPageAlreadyExisting
sql_backend = SQLBackend()
class Command(BaseCommand):
help = 'Closes the specified poll for v... |
"""This module implements operators that AutoGraph overloads.
Note that "operator" is used loosely here, and includes control structures like
conditionals and loops, implemented in functional form, using for example
closures for the body.
"""
# Naming conventions:
# * operator names match the name usually used for t... |
#http://katalog.we-online.com/en/pbs/WE-MAPI]
#sizes,shapes,etc]
#name, L, W, pad-w, pad-gap, pad-h
inductors = [
[1610,1.6,1.6,1.8,0.4,1.8],
[2010,2.0,1.6,2.3,0.6,1.9],
[2506,2.5,2.0,2.8,1.1,2.3],
[2508,2.5,2.0,2.8,1.1,2.3],
[2510,2.5,2.0,2.8,1.1,2.3],
[2512,2.5,2.0,2.8,1.1,2.3],
[3010,3.0,3.0,3.4,0.8,3.4],
[3012,3.0... |
"""Manages mapping of users to roles and roles to privileges."""
__author__ = 'Pavel Simakov (<EMAIL>)'
import collections
import config
import messages
from common import utils
from common import users
from models import MemcacheManager
from models import RoleDAO
GCB_ADMIN_LIST = config.ConfigProperty(
'gcb_ad... |
import os.path
from blivet.arch import get_arch
from blivet.util import mount
from pyanaconda.core.constants import SOURCES_DIR
from pyanaconda.core.storage import device_matches
from pyanaconda.core.util import join_paths
from pyanaconda.payload.image import find_first_iso_image
from pyanaconda.anaconda_loggers imp... |
from zeit.cms.repository.interfaces import ICollection, INonRecursiveCollection
from zeit.retresco.interfaces import ISkipEnrich
import argparse
import gocept.runner
import grokcore.component as grok
import logging
import time
import transaction
import zeit.cms.celery
import zeit.cms.checkout.interfaces
import zeit.cms... |
'''
Created on Apr 24, 2017
@author: Tian Shi and Ping Wang
'''
import random
import numpy as np
import networkx as nx
import matplotlib.pyplot as plt
np.random.seed(0)
random.seed(0)
def set_service():
print '--------------------------------------------'
n_nodes = 20
total_svs = 10
max_svs = 2
m... |
import automata
import bisect
import random
class Matcher(object):
def __init__(self, l):
self.l = l
self.probes = 0
def __call__(self, w):
self.probes += 1
pos = bisect.bisect_left(self.l, w)
if pos < len(self.l):
return self.l[pos]
else:
... |
#!/usr/bin/python3
"""
Print lyrics of a song.
Usage:
lyrics.py <song_title>
"""
import re
import sys
from urllib.parse import quote
import urllib.request
from lxml import html
def makerequest(search):
"""
Construct a musixmatch search request
Parameter: string:search
Returns: string
"""
... |
from django.contrib.auth.models import Permission
from django.urls import include, path, reverse
from django.utils.translation import gettext_lazy as _
from wagtail.admin.menu import MenuItem
from wagtail.contrib.search_promotions import admin_urls
from wagtail.core import hooks
@hooks.register('register_admin_urls'... |
"""
Django settings for ShcoolWork project.
Generated by 'django-admin startproject' using Django 1.9.4.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os... |
#------------------------------------------------------------------------------
'''Module for system-wide constants'''
import os
import lamana as la
# Name for hook function/method; used in `theoires.handshake()` with models
HOOKNAME = '_use_model_'
# Default export directory path; used in `utils.get_path()`
source... |
"""
Models in the protocol
======================
The protocol itself is embedded in JSON requests transmitted through an HTTP
server.
All classes in this module are fully serializable back and forth.
These are the states of an embedded server and can be observed by the
requesting attendant client.
"""
from .utils.... |
import sys, unittest
sys.path.append ('../..')
#from pyreadline.modes.vi import *
#from pyreadline import keysyms
from pyreadline.lineeditor import lineobj
from pyreadline.lineeditor.history import LineHistory
import pyreadline.lineeditor.history as history
import pyreadline.logger
pyreadline.logger.sock_sile... |
import os
import logging
import subprocess
import shutil
import math
import tempfile
'''Given a list of commands run single threaded or in parallel'''
class CommandRunner:
def __init__(self, output_directory, logger, threads):
self.logger = logger
self.threads = threads
self.output_directory = output_directory... |
from curses import initscr,curs_set,newwin,endwin,KEY_RIGHT,KEY_LEFT,KEY_DOWN,KEY_UP
from random import randrange
initscr()
curs_set(0)
win = newwin(16,60,0,0)
win.keypad(1)
win.nodelay(1)
win.border('|','|','-','-','+','+','+','+')
win.addch(4,44,'O')
snake = [ [30,7],[29,8],[28,7],[27,7],[26,7],[25,7] ]
key = KEY_RIG... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible import constants as C
from ansible.errors import *
from ansible.playbook.block import Block
from ansible.playbook.task import Task
from ansible.utils.boolean import boolean
__all__ = ['PlayIterator']
class HostStat... |
"""Projector test app
=====================
App to test the projector - MCS hardware data link.
"""
from kivy.app import App
from kivy.lang import Builder
from kivy.factory import Factory
from kivy.properties import BooleanProperty, StringProperty, ObjectProperty
from kivy.graphics.opengl import glEnable, GL_DITHER, ... |
# -*- coding: cp936 -*-
import ctypes
# MpqOpenArchiveForUpdate flags
MOAU_CREATE_NEW = 0x00 #If archive does not exist, it will be created. If it exists, the function will fail
MOAU_CREATE_ALWAYS = 0x08 #Will always create a new archive
MOAU_OPEN_EXISTING = 0x04 #If archive exists, it will be op... |
__all__ = ["const", "register_naming", "naming", "PERMITTED"]
import sys
import dis
from .bytecode import ByteCode, command_to_string
UNPACK_SEQUENCE = dis.opmap["UNPACK_SEQUENCE"]
STORE_FAST = dis.opmap["STORE_FAST"]
STORE_GLOBAL = dis.opmap["STORE_GLOBAL"]
STORE_NAME = dis.opmap["STORE_NAME"]
STORE_DEREF = dis.opma... |
import datetime
from django.contrib.auth import get_user_model
from django.urls import reverse
from apps.challenge.tests.factories import QualificationFactory, SessionFactory
from apps.salary import HOURLY_RATE_HELPER, timesheets_overview
from apps.user.tests.factories import UserFactory
from defivelo.roles import us... |
from BidirectionalCategoryEnum import BidirectionalCategoryEnum
from CharacterDecompositionMappingEnum import CharacterDecompositionMappingEnum
from GeneralCategoryEnum import GeneralCategoryEnum
class HPPGenerator:
def __init__(self, output, datas, specialCasing):
self.__output = output
self.__... |
#!/usr/bin/env python
import cairo
import sys
# parse FASTA format files
def parse(seq):
output = ""
lines = seq.split("\n")
for line in lines:
if line.startswith(">"):
continue
else:
output += line
return output
file = open(sys.argv[1], mode="r")
dna = pars... |
from txt2midi.ui import UiApplication;
import tkinter as tk;
'''
--------------------------------------------------------------------------------
Desc: Wrapper Interface for the UI Application
--------------------------------------------------------------------------------
'''
class UiWrapper:
__ui=None;#private var... |
#!/usr/bin/env python
"""Bootstrap setuptools installation
To use setuptools in your package's setup.py, include this
file in the same directory and add this to the top of your setup.py::
from ez_setup import use_setuptools
use_setuptools()
To require a specific version of setuptools, set a download
mirror, ... |
import os
import re
import sys
import parted
from time import sleep
from OSEncryptionState import *
class SplitRootPartitionState(OSEncryptionState):
def __init__(self, context):
super(SplitRootPartitionState, self).__init__('SplitRootPartitionState', context)
def should_enter(self):
self.co... |
#!/usr/bin/python
# for all predicted peptides of a genome, compare its hmmout to the hmmout
# of all possible translations. putting this onto the scaffolds will
# show where genes might have been missed.
from low import *
import getopt, sys
import string
from gff3 import GeneFeature
# ==============================... |
# -*- coding: utf-8 -*-
"""
File related views, including view_file, edit_file, view_history_file,
view_trash_file, view_snapshot_file
"""
import os
import hashlib
import json
import stat
import tempfile
import urllib
import urllib2
import chardet
from django.contrib.sites.models import Site, RequestSite
from django.... |
from twisted.web.resource import Resource
from twisted.web.server import NOT_DONE_YET
from twisted.internet.defer import inlineCallbacks
from vumi import log
def make_resource_worker(cls, publish_func, path_key):
resource = cls(publish_func)
return (resource, path_key)
class MoResource(Resource):
isLeaf... |
#!/usr/bin/env python
# encoding: utf-8
# pylint: disable=no-member, no-init, too-many-public-methods
# pylint: disable=attribute-defined-outside-init
# pylint: disable=missing-docstring, unused-import, invalid-name, import-error, super-on-old-class
"""Tests for final submissions."""
import os
os.environ['FLASK_CONF']... |
"""Possible vm states for instances.
Compute instance vm states represent the state of an instance as it pertains to
a user or administrator. When combined with task states (task_states.py), a
better picture can be formed regarding the instance's health.
"""
ACTIVE = 'active'
BUILDING = 'building'
REBUILDING = 'rebu... |
"""Windows specific response plugins."""
from builtins import str
import itertools
import re
import win32api
import pythoncom
import win32com.client
from rekall import plugin
from rekall import obj
from rekall_lib import utils
from rekall.plugins.common import address_resolver
from rekall.plugins.response import commo... |
#!/usr/bin/env python3
import os
import sys
from random import seed, shuffle
import multiprocessing
from statistics import mean, stdev
from time import sleep
sys.path.extend(['..'])
import tensorflow as tf
import dataset
import model_cnn_w2w as cnn_w2w
import model_rnn_w2w as rnn_w2w
import model_cnn12_w2t as cnn12... |
def len_seq(n):
length = 1
while n > 1:
if n & 1 == 0:
n = n >> 1
else:
n = 3 * n + 1
length += 1
return length
if __name__ == '__main__':
maxN = 0
lengthMax = 0
for i in range(2, 1000000):
lenN = len_seq(i)
if lenN > lengthMax:
... |
"""
Django settings for fask_dj project.
Generated by 'django-admin startproject' using Django 1.11.
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 unittest
import IECore
import Gaffer
import GafferScene
import GafferSceneTest
class SceneLoopTest( GafferSceneTest.SceneTestCase ) :
def testDefaultName( self ) :
s = GafferScene.SceneLoop()
self.assertEqual( s.getName(), "SceneLoop" )
def testLoop( self ) :
script = Gaffer.ScriptNode()
script... |
import codecs
import os
import sys
from plume import DATA_DIR, FILE_PREFIX
from plume.backend import get_document, get_documents_list, get_file_path, get_history
from whoosh import index as Index, query, sorting
from whoosh.analysis import StemmingAnalyzer
from whoosh.fields import SchemaClass, DATETIME, ID, KEYWORD, ... |
#!/usr/bin/env python
""" nav_square.py - Version 1.1 2013-12-20
A basic demo of the using odometry data to move the robot
along a square trajectory.
Created for the Pi Robot Project: http://www.pirobot.org
Copyright (c) 2012 Patrick Goebel. All rights reserved.
This program is free software; y... |
from units.modules.utils import ModuleTestCase, set_module_args
from ansible.compat.tests.mock import patch
from ansible.compat.tests.mock import Mock
from ansible.module_utils.basic import AnsibleModule
from ansible.modules.system.java_keystore import create_jks, cert_changed, ArgumentSpec
class TestCreateJavaKeysto... |
"""module to handle command files
@contact: Debian FTP Master <<EMAIL>>
@copyright: 2012, Ansgar Burchardt <<EMAIL>>
@license: GPL-2+
"""
# 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... |
# -*- coding: utf-8 -*-
import numpy as np
import pytest
import pandas as pd
import pandas.util.testing as tm
from pandas import NaT, Period, PeriodIndex, Int64Index, Index, period_range
class TestPeriodIndexAsType(object):
@pytest.mark.parametrize('dtype', [
float, 'timedelta64', 'timedelta64[ns]'])
... |
import urlparse
import logging
from paxes_cinder import _
LOG = logging.getLogger(__name__)
from paxes_cinder.scohack.scohack_http import Store as HttpStore
from paxes_cinder.scohack.scohack_http \
import StoreLocation as HttpStoreLocation
from paxes_cinder.scohack.scohack_scohack \
import Store as ScohackSto... |
"""
Unit test for Treadmill presense module.
"""
import os
import shutil
import tempfile
import time
import unittest
# Disable W0611: Unused import
import tests.treadmill_test_deps # pylint: disable=W0611
import mock
import kazoo
import kazoo.client
import yaml
import treadmill
from treadmill import presence
from ... |
import os
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
import sys
sys.path.append(os.path.join('doc', 'common'))
try:
from doctools import build_doc, test_doc
except ImportError:
build_doc = test_doc = None
setup(
name = 'Babel',
versi... |
from __future__ import unicode_literals
def test_list(runner, product_id):
topic = runner.invoke(
["topic-create", "--name", "osp", "--product-id", product_id]
)["topic"]
teams = runner.invoke(["team-list"])["teams"]
team_id = teams[0]["id"]
runner.invoke(["topic-attach-team", topic["id"]... |
"""Generate docs for the TensorFlow Python API."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import os
import sys
import six
from tensorflow.python.util import tf_inspect
from tensorflow.tools.common import public_api
from tensorflow... |
import asyncio
import json
import aiohttp.web
from hatter import util
import hatter.json_validator
async def create_web_server(backend, host, port, webhook_path, web_path):
srv = WebServer()
srv._backend = backend
srv._app = aiohttp.web.Application()
srv._app.router.add_route(
'GET', '/', lam... |
import csv
import json
import numpy as np
import os
import pandas as pd
import pickle
config_file = "SETTINGS.json"
def get_paths():
paths = json.loads(open(config_file).read())
return paths
def get_json():
return json.loads(open(config_file).read())
def save_json(config):
json_file = open(... |
import math
from klampt import so3
from klampt import se3
from klampt import vectorops
from klampt.glprogram import *
def interpolate_linear(a,b,u):
"""Interpolates linearly in cartesian space between a and b."""
return vectorops.madd(a,vectorops.sub(b,a),u)
def interpolate_euler_angles(ea,eb,u,convention='zy... |
import logging
from pyrundeck.xml2native import ParserEngine
__author__ = "Panagiotis Koutsourakis <<EMAIL>>"
class RundeckParser(object):
"""This class contains the parsing tables for various rundeck elements.
Each parse table describes a specific tag. See
:py:class:`pyrundeck.xml2native.ParserEngine`... |
#!/usr/bin/env python
# Try to determine how much RAM is currently being used per program.
# Note per _program_, not per process. So for example this script
# will report RAM used by all httpd process together. In detail it reports:
# sum(private RAM for program processes) + sum(Shared RAM for program processes)
# The... |
# -*- coding: utf-8 -*-
"""
Local settings
- Run in Debug mode
- Use console backend for emails
- Add Django Debug Toolbar
- Add django-extensions as app
"""
from .common import * # noqa
# DEBUG
# ------------------------------------------------------------------------------
DEBUG = env.bool('DJANGO_DEBUG', default... |
r"""
***************************
espressopp.interaction.OPLS
***************************
This class provides methods to compute forces and energies of
the OPLS dihedral potential. To create a new dihedral potential.
.. math::
U = \sum^4_{j=1} K_j (1 + cos(j \phi))
.. function:: espressopp.interaction... |
#!/usr/bin/env python
from sanic import Blueprint, response
from urllib.parse import unquote
from owllook.fetcher.function import get_time, get_netloc
from owllook.fetcher.extract_novels import extract_chapters
from owllook.fetcher.decorators import authenticator, auth_params
from owllook.fetcher.cache import cache_ow... |
"""Basic components support
"""
import sys
import types
if sys.version_info[0] < 3: #pragma NO COVER
def _normalize_name(name):
if isinstance(name, basestring):
return unicode(name)
raise TypeError("name must be a regular or unicode string")
CLASS_TYPES = (type, types.ClassType)
... |
#!/usr/bin/python
from mtracepy.columns import ColumnValue, Address, Unsigned, AccessType, LabelString, create_column_string, create_column_objects, get_column_object
import sqlite3
import sys
mtrace_label_heap = 1
mtrace_label_block = 2
mtrace_label_static = 3
mtrace_label_percpu = 4
mtrace_lab... |
# -*- coding:utf-8 -*-
"""
/***************************************************************************
Python Console for QGIS
-------------------
begin : 2012-09-10
copyright : (C) 2012 by Salvatore Larosa
email : lrssvtml (at) gmail (dot) com
***... |
"""
AMP test saving module
"""
import sys
from .tests import *
from .exceptions import UnknownTestError
def _import_data_functions():
"""
Load all the available data parsing functions for the AMP tests.
"""
modules = {}
for name in tests.__all__:
modules[name] = sys.modules['ampsave.tests... |
import mock
from openstackclient.network.v2 import floating_ip_pool
from openstackclient.tests.unit.compute.v2 import fakes as compute_fakes
# Tests for Compute network
class TestFloatingIPPoolCompute(compute_fakes.TestComputev2):
def setUp(self):
super(TestFloatingIPPoolCompute, self).setUp()
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.