content stringlengths 4 20k |
|---|
#! /usr/bin/python
import os
import datetime
import codecs # proper UTF8 handling with files
keys = []
comments = []
now = datetime.datetime.now()
header = r'''# Copyright (C) 2011 Clint Bellanger
# This file is distributed under the same license as the FLARE package.
#
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
msgid ""... |
# -*- coding: utf-8 -*-
from ..Node import Node
import weakref
#from pyqtgraph import graphicsItems
from pyqtgraph.Qt import QtCore, QtGui
from pyqtgraph.graphicsItems.ScatterPlotItem import ScatterPlotItem
from pyqtgraph.graphicsItems.PlotCurveItem import PlotCurveItem
from pyqtgraph import PlotDataItem
from .common ... |
"""Contains utility and supporting functions for DualNet.
This module provides the model interface, including functions for DualNet model
bootstrap, training, validation, loading and exporting.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
... |
from telemetry.page import page
from telemetry import story
class OopifBasicPageSet(story.StorySet):
""" Basic set of pages used to measure performance of out-of-process
iframes.
"""
def __init__(self):
super(OopifBasicPageSet, self).__init__(
archive_data_file='data/oopif_basic.json',
clo... |
import os
import shutil
import tempfile
import datetime
import collections
APP_UTIL = os.path.normpath(os.path.dirname(os.path.abspath(__file__)))
APP_ROOT = os.path.normpath(os.path.join(APP_UTIL, os.pardir))
APP_CONF = os.path.normpath(os.path.join(APP_ROOT, "config"))
APP_LOG = os.path.normpath(os.path.join(APP_RO... |
# -*- coding: utf-8 -*-
from __future__ import print_function # Python 2/3 compatibility
import boto3
import json
import decimal
from boto3.dynamodb.conditions import Key, Attr
# Helper class to convert a DynamoDB item to JSON.
class DecimalEncoder(json.JSONEncoder):
def default(self, o):
if isinstance(o,... |
"""Tests for ExecutionContext concepts"""
from generic_utils import NOTSET
from generic_utils import loggingtools
from generic_utils.datetimetools import utcnow
from generic_utils.exceptions import GenUtilsAttributeError
from generic_utils.exceptions import GenUtilsTypeError
from generic_utils.exceptions import GenUtil... |
import os
import sys
import logging
class StreamToLogger(object):
"""
Fake file-like stream object that redirects writes to a logger instance.
"""
def __init__(self, logger, log_level=logging.INFO):
self.logger = logger
self.log_level = log_level
self.linebuf = ''
def writ... |
#!/usr/bin/env python
"""
Example of adding a custom Vi operator and text object.
(Note that this API is not guaranteed to remain stable.)
"""
from prompt_toolkit import prompt
from prompt_toolkit.enums import EditingMode
from prompt_toolkit.key_binding import KeyBindings
from prompt_toolkit.key_binding.bindings.vi imp... |
Given an unsorted array of integers, find the length of the longest consecutive elements sequence.
For example,
Given [100, 4, 200, 1, 3, 2],
The longest consecutive elements sequence is [1, 2, 3, 4]. Return its length: 4.
Your algorithm should run in O(n) complexity.
https://leetcode.com/discuss/18886/my-really-sim... |
#!/usr/bin/python -B
#Dependencies
import os
import time
import hashlib
import sys
import hdb_conf
import lang.enCA
conf = hdb_conf.conf()
lang = lang.enCA.translation()
class hdb:
def __init__(self):
self.data = []
self.md5Val = ''
self.sha1Val = ''
self.sha256Val = ''
self.sha512Val = ''
self.singleVa... |
from unittest import TestCase
from .ingest_task import get_incandescent_results, get_incandescent_results_callback
from .exceptions import APIGracefulException
from .vpp_mock import activate_incandescent_mock
from .vpp_test import VPPTestCase, setup
from pprint import pprint # noqa @TODO: debug
class IncandescenT... |
import pandas
import Rwrapper
#
# Variables from surveys needed for CASQ
#
# LimeSurvey field names
lime_fields = [ "casq_set1 [casq1]", "casq_set1 [casq2]", "casq_set1 [casq3]", "casq_set1 [casq4]", "casq_set1 [casq5]", "casq_set1 [casq6]", "casq_set2 [casq7]", "casq_set2 [casq8]", "casq_set2 [casq9]", "casq_set2 [... |
import json
import logging
from apiclient import discovery
from oauth2client.client import GoogleCredentials
logging.basicConfig(level=logging.DEBUG)
def main():
"""Transfer from standard Cloud Storage to Cloud Storage Nearline."""
credentials = GoogleCredentials.get_application_default()
storagetransf... |
from socket import *
from string import strip, split
import sys
import tt
# The ThoughtTreasure Server Protocol (TTSP) registered port number
# listed by the Internet Assigned Numbers Authority (IANA).
PORT=1832
class TTConnection:
def __init__(self, host, port):
self.host = host
self.port = port
self.s... |
import time
import os
# List of function words from http://www.flesl.net/Vocabulary/Single-word_Lists/function_word_list.php
function_words = ['about','across', 'against','along','around','at','behind',
'beside','besides','by','despite','down','during','for','from','in','inside','into','near','of','off',
'on','onto... |
# -*- coding: utf-8 -*-
import re
from module.plugins.internal.Crypter import Crypter
class QuickshareCzFolder(Crypter):
__name__ = "QuickshareCzFolder"
__type__ = "crypter"
__version__ = "0.16"
__status__ = "testing"
__pattern__ = r'http://(?:www\.)?quickshare\.cz/slozka-\d+'
__conf... |
import re
import HTMLParser
from .base import BikeShareSystem, BikeShareStation
from . import utils
__all__ = ['BicincittaOld', 'Bicincitta','BicincittaStation']
class BaseSystem(BikeShareSystem):
meta = {
'system': 'Bicincittà',
'company': 'Comunicare S.r.l.'
}
class BicincittaOld(BaseSyste... |
"""
This module contains a utility class to transform between data types.
It also contains a function to launch an introspective dialog, and
one to import custom plugins.
"""
import imp
import inspect
import os
import re
import sys
import pygtk
pygtk.require("2.0")
import gtk
import rose
import rose.gtk.dialog
imp... |
# -*- coding: utf-8 -*-
"""979. Distribute Coins in Binary Tree
https://leetcode.com/problems/distribute-coins-in-binary-tree/
Given the root of a binary tree with N nodes, each node in the tree has
node.val coins, and there are N coins total.
In one move, we may choose two adjacent nodes and move one coin from one... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Autor: Alexey V. Polurotov
# e-mail: <EMAIL>
# Common nick: Niimailtah
# ----------------------------------------------------------------------------
# https://projecteuler.net/problem=51
# Prime digit replacements
# Problem 51
#
# By replacing the 1st digit of the 2-d... |
# -*- coding: utf-8 -*-
#
# Test links:
# http://novafile.com/vfun4z6o2cit
# http://novafile.com/s6zrr5wemuz4
from module.plugins.internal.XFSHoster import XFSHoster
class NovafileCom(XFSHoster):
__name__ = "NovafileCom"
__type__ = "hoster"
__version__ = "0.10"
__status__ = "testing"
__pa... |
__all__ = ["Directory"]
import sys, os
from common import Common
from config import Config
class Directory(object):
'''Implementation of a virtual directory'''
def __init__(self, **kwargs):
self.kwargs = kwargs
self.base_dir = self.kwargs.get("base_dir")
if self.base_dir:
... |
###############################################
# Multilayer Perceptron in Python
# Jhonathan Paulo Banczek - 2013
# <EMAIL> github.com/jhoonb/pymlp
###############################################
from random import random
from math import tanh
def narray(nl, nc, value):
'''
Create array bi-dimensional
... |
"""
EasyBuild support for installing EasyBuild, implemented as an easyblock
@author: Kenneth Hoste (UGent)
"""
import copy
import os
import re
from distutils.version import LooseVersion
from easybuild.easyblocks.generic.pythonpackage import PythonPackage
from easybuild.tools.build_log import EasyBuildError
from easyb... |
from setuptools import setup, find_packages # Always prefer setuptools over distutils
from codecs import open # To use a consistent encoding
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the relevant file
with open(path.join(here, 'DESCRIPTION.rst'), encoding='utf-8... |
import neural_network as nn
# Define some constants that we'll want to have for our project.
LOG_DIR = "logs_dir"
# Note that we want to write the outputs of our training predictions so we can
# take a look at where we went wrong on them.
OUTPUT_FILE_NAME = 'training_predictions.csv'
batch_count = 1
use_partial = inp... |
from collections import defaultdict
import ycm_core
from ycm.server import responses
from ycm import extra_conf_store
from ycm.utils import ToUtf8IfNeeded
from ycm.completers.completer import Completer
from ycm.completers.cpp.flags import Flags, PrepareFlagsForClang
CLANG_FILETYPES = set( [ 'c', 'cpp', 'objc', 'objcpp... |
#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_F_CI_CUST_AUTO_MAPPING').setMaster(sys.argv[2])
sc = SparkContext(conf = conf... |
'''
Pyjnius
=======
Accessing Java classes from Python.
All the documentation is available at: http://pyjnius.readthedocs.org
'''
__version__ = '1.1.2-dev'
from .jnius import * # noqa
from .reflect import * # noqa
# XXX monkey patch methods that cannot be in cython.
# Cython doesn't allow to set new attribute on... |
#!/usr/bin/env python
import os,sys,matplotlib as mpl,matplotlib.pyplot as plt,numpy as np
from scipy.stats import norm
sources = glob.glob("./**/*.mhd")#,recursive=True
if len(sources) < 2:
print "None or one file found, exiting..."
sys.exit()
nr = len(sources)
print nr, "files found:", sources[:3], '...', source... |
#This script is written by Tairan Liu.
import sys
import shutil
import os
import os.path
import subprocess
from subprocess import Popen,PIPE
import time
def RmRigidRed(outputPath, tcBorder, inputList):
pathList=[]
with open('PathConfigure.log','r') as inf:
tempList=inf.readlines()
if len(tem... |
"""
BSD 3-Clause License
Copyright (c) 2017, Mairie de Paris
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of cond... |
from functools import reduce
from pymongo import MongoClient
__author__ = 'tmshv'
"""
Correct 'address' field
"""
mongo = MongoClient()
db = mongo['k2']
BSON_ARRAY = 4
fix_rules_street = [
['Обводного набережная канала', 'Набережная Обводного канала'],
['проспект Большой ПС', 'Большой проспект П.С.'],
... |
__author__ = 'Tom Schaul, <EMAIL>'
from scipy import zeros, array, amin, amax, sqrt
from colormaps import ColorMap
class CiaoPlot(ColorMap):
""" CIAO plot of coevolution performance with respect to the best
individuals from previous generations (Hall of Fame).
Requires 2 populations. """
@staticmet... |
import re, sys
# pre: A nucleotide sequence. no spaces no whitespace
# post Reverse complemented sequence
def rc(seq):
if re.search('[uU]',seq) and re.search('[tT]',seq):
print "Mix of Uu and Tt in sequence. I don't know what it is."
sys.exit()
rna = 0
if re.search('[uU]',seq):
rna = 1
o = ''
f... |
from IsingModel.util import *
import numpy as np
class IsingGrid(object):
"""
An Ising network on a 2D grid.
Each node is either 1 either -1.
Two neighboring nodes i and j have energy -a_ij if they have the same value, and energy a_ij otherwise.
Energy(x) = - 1/2*sum_i(b_i*x_i) - 1/2*sum_ij(x_i*a_... |
# -*- coding: utf-8 -*-
'''
On this module the necessary calcs are made in order to obtain the chair
distribution in an hemicycle.
'''
##
# Imports
##
from math import asin, pi, floor, cos, sin
##
# Constantes
##
MAXCYCLE = 10000
##
# Exception
##
class ChairError(Exception):
pass
##
# Hemicycle calculus
#... |
import ctypes
class DynamicArray():
def __init__(self):
self.n = 0
self.capacity = 1
self.A = self.make_array(self.capacity)
def __len__(self):
return self.n
def __getitem__(self, k):
if not 0 <= k < self.n:
return IndexError('K is out of bounds!')
... |
"""
NeuroTools.datastore
====================
The `datastore` package aims to present a consistent interface for persistent
data storage, irrespective of storage back-end.
It is intended for objects to be able to store part or all of their internal
data, and so the storage/retrieval keys are based on the object ident... |
from __future__ import unicode_literals
import datetime
from frappe import _
import frappe
import frappe.database
import frappe.utils
import frappe.utils.user
from frappe import conf
from frappe.sessions import Session, clear_sessions, delete_session
from frappe.modules.patch_handler import check_session_stopped
from... |
import os
import configparser
class config:
# Check if config.ini exists and load/generate it
def __init__(self, file):
"""
Initialize a config file object
:param file: file name
"""
self.config = configparser.ConfigParser()
self.default = True
self.fileName = file
if os.path.isfile(self.fileName):
... |
from __future__ import division
import numpy as np
np.seterr(divide='ignore')
from matplotlib import pyplot as plt
import pyhsmm
from pyhsmm.util.text import progprint_xrange
np.random.seed(0)
#####################
# data generation #
#####################
N = 4
T = 1000
obs_dim = 600
obs_hypparams = dict(
... |
import argparse
from pathlib import Path
import numpy as np
from keras.callbacks import LearningRateScheduler, ModelCheckpoint
from keras.optimizers import SGD, Adam
from generator import FaceGenerator, ValGenerator
from model import get_model, age_mae
def get_args():
parser = argparse.ArgumentParser(description=... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import datetime
from flask import render_template, redirect, request, flash, url_for, current_app, session, abort
from flask.views import MethodView
# from flask.ext.login import login_user, logout_user, login_required, current_user
# from flask.ext.principal import Identi... |
import os
import sys
import subprocess
import re
import sets
import argparse # requires Python 2.7
# beginning of main
# pseudocode
#
# do a "netstat | grep localhost" to obtain raw port-in-use info
#
# inUseRanges = empty set
# for each line
# for each occurrance of the string "localhost:nnnnn"
# range... |
""" Functionality used for testing. This code itself is not covered in tests.
"""
from __future__ import absolute_import, print_function, division
import os
import sys
import inspect
import shutil
import atexit
import pytest
from _pytest import runner
# Get root dir
THIS_DIR = os.path.abspath(os.path.dirname(__file... |
# Produces countries.txt from hierarchy.txt
#
# Hierarchy.txt format:
#
# Sample lines:
# Iran;Q794;ir;fa
# Iran_South;Q794-South
#
# Number of leading spaces mean hierarchy depth. In above case, Iran_South is inside Iran.
# Then follows a semicolon-separated list:
# 1. MWM file name without extension
# 2. Region name... |
from operator import itemgetter
import math
import numpy as np
import stop_words
class WSD(object):
""" Object that for word sense disambiguation. """
def __init__(self, sense_vectors, word_vectors, window=10, method="sim",
lang="en", max_context_words=3, ignore_case=False, verbose=False):
... |
from nssrc.com.citrix.netscaler.nitro.resource.base.base_resource import base_resource
from nssrc.com.citrix.netscaler.nitro.resource.base.base_resource import base_response
from nssrc.com.citrix.netscaler.nitro.service.options import options
from nssrc.com.citrix.netscaler.nitro.exception.nitro_exception import nitro_... |
#!/usr/bin/python
import sys
import os
import glob
import time
import ConfigParser
import requests
import json
import ast
config = ConfigParser.RawConfigParser()
config.read('../appconfig.ini')
sensor = config.get('sensor', 'water')
baseUri = config.get('url','api')
if sensor:
os.system('modprobe w1-gpio')
... |
from msrest.serialization import Model
class PacketCapture(Model):
"""Parameters that define the create packet capture operation.
All required parameters must be populated in order to send to Azure.
:param target: Required. The ID of the targeted resource, only VM is
currently supported.
:type ... |
import io
import locale
import mimetypes
import pathlib
import sys
import unittest
from test import support
from platform import win32_edition
# Tell it we don't know about external files:
mimetypes.knownfiles = []
mimetypes.inited = False
mimetypes._default_mime_types()
class MimeTypesTestCase(unittest.TestCase):
... |
from django import forms
from django.conf import settings
from django.db import models
from django.forms.extras.widgets import SelectDateWidget
import fields
from datetime import datetime, date, timedelta
import re
from uuid import uuid4
from mongoengine import *
from mongoengine.django.auth import User
MARKUP_LANGU... |
# -*- coding: utf-8 -*-
"""
Current funcionatilities:
- Lifting line theory
- generate field pressures for Abaqus or other softwares
- air properties calculator
- Reynolds calculator
Created on Mon Jul 20 17:26:19 2015
@author: Pedro Leal
"""
from __future__ import print_function
from __future__ import absolute_import... |
import os
from itertools import chain
import numpy as np
from c3nav.mapdata.render.engines import register_engine
from c3nav.mapdata.render.engines.base3d import Base3DEngine
@register_engine
class WavefrontEngine(Base3DEngine):
filetype = 'obj'
def _normal_normal(self, normal):
return normal / (np... |
"""The Mayavi Envisage application.
"""
# Copyright (c) 2008-2015, Enthought, Inc.
# License: BSD Style.
# Standard library imports.
import sys
import os.path
import logging
# Enthought library imports.
from apptools.logger.api import LogFileHandler, FORMATTER
from traits.etsconfig.api import ETSConfig
from traits.ap... |
import codecs
import os
import re
from os.path import join
from tokenize import generate_tokens, NAME, NEWLINE, OP, untokenize
from django.conf import settings
from django.core.cache import caches
from django.template.loader import get_template
from jinja2 import Environment
from .dotlang import (
parse as parse_... |
# ex:ts=4:sw=4:sts=4:et
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
"""
BitBake 'Event' implementation
Classes and functions for manipulating 'events' in the
BitBake build tools.
"""
# Copyright (C) 2003, 2004 Chris Larson
#
# This program is free software; you can redistribute it and/or modify
... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
from ansible.plugins.callback import CallbackBase
class CallbackModule(CallbackBase):
'''
This is the default callback interface, which simply prints messages
to stdout when new callback events are receiv... |
import codecs
import gzip
import json
import logging
import logging.handlers
import os
import random
import socket
import sys
import tempfile
import time
import zlib
from collections import defaultdict
import jsonschema
import mock
import pytest
from pytest_localserver.http import ContentServer
from werkzeug.wrappers ... |
import os
import sys
from argparse import ArgumentParser
import requests
from logger import logger
BASE_URL = 'http://172.23.120.24/builds/latestbuilds/couchbase-server'
CHECKPOINT_DIR = '/home/'
MAX_MISSING = 3
RELEASES = {
'spock': '5.0.0',
'vulcan': '5.5.0',
}
def read_latest(release: str) -> int:
... |
from lava_dispatcher.actions.deploy.docker import Docker
from lava_dispatcher.actions.deploy.image import DeployImages
from lava_dispatcher.actions.deploy.iso import DeployIso
from lava_dispatcher.actions.deploy.fastboot import Fastboot
from lava_dispatcher.actions.deploy.flasher import Flasher
from lava_dispatcher.act... |
# -*- coding: utf-8 -*-
'''
Managing Ruby installations with rbenv
======================================
This module is used to install and manage ruby installations with rbenv and the
ruby-build plugin. Different versions of ruby can be installed, and uninstalled.
Rbenv will be installed automatically the first time... |
# -*- coding: utf-8 -*-
"""Plist parser plugin for Bluetooth plist files."""
from dfdatetime import time_elements as dfdatetime_time_elements
from plaso.containers import plist_event
from plaso.containers import time_events
from plaso.lib import definitions
from plaso.parsers import plist
from plaso.parsers.plist_plu... |
import itertools
def imright(h1, h2):
"House h1 is immediately right of h2 if h1-h2 == 1."
return h1-h2 == 1
def nextto(h1, h2):
"Two houses are next to each other if they differ by 1."
return abs(h1-h2) == 1
def test (dog, snails, fox, horse, ZEBRA):
print (dog, snails, fox, horse, ZEBRA)
def zebr... |
# -*- coding: utf-8 -*-
from . import __version__, __title__
from .workout import sports, Workout, TrackPoint
from .utils import chunks, str_to_datetime, datetime_to_str, gzip_string
from .exceptions import *
import platform
import uuid, socket
import random
from datetime import datetime, timedelta
import requests
i... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
'''Pychemqt, Chemical Engineering Process simulator
Copyright (C) 2009-2017, Juan José Gómez Romera <<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 Foundatio... |
"""Handle MySensors messages."""
from typing import Dict, List
from mysensors import Message
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_send
from homeassistant.helpers.typing import HomeAssistantType
from homeassistant.util import decorator
from .const impor... |
from django.conf import settings
from django.template.loader import render_to_string
from karaage.common.emails import CONTEXT, send_mail
def render_email(name, context):
context.update(CONTEXT)
subject = render_to_string(
['karaage/emails/%s_subject.txt' % name,
'kgapplications/emails/%s... |
"""Test cases for the fnmatch module."""
import unittest
import os
import warnings
from fnmatch import fnmatch, fnmatchcase, translate, filter
class FnmatchTestCase(unittest.TestCase):
def check_match(self, filename, pattern, should_match=True, fn=fnmatch):
if should_match:
self.assertTrue(f... |
__author__ = "Cyril Jaquier"
__version__ = "$Revision: 650 $"
__date__ = "$Date: 2008-02-02 21:07:06 +0100 (Sat, 02 Feb 2008) $"
__copyright__ = "Copyright (c) 2004 Cyril Jaquier"
__license__ = "GPL"
import unittest
from server.datedetector import DateDetector
from server.datetemplate import DateTemplate
class DateDe... |
import unittest
from page_models import *
from emote_model import *
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from belay_test_utils import *
from selenium.webdriver.common.action_chains import *
import time
class EmoteTests(BelayTest):
def setUp(self):
super(Em... |
import sys
from types import *
import pygtk
pygtk.require('2.0')
import gtk
import gtk.glade
import gobject
#from gtk import TRUE, FALSE
from cuon.Misc.cuonlists import cuonlists
class plantlists(cuonlists):
def __init__(self, initialWidget = None, initialFilename = None):
cuonlists.__init__(self, i... |
#!/usr/bin/env python
import sys
import subprocess
import re
# Makes a GNU-Style ChangeLog from a git repository
# Handles git-svn repositories also
# Arguments : same as for git log
release_refs={}
def process_commit(lines, files):
# DATE NAME
# BLANK LINE
# Subject
# BLANK LINE
# ...
# FIL... |
import threading
import eventlet
from eventlet import greenpool
from volt.openstack.common import log as logging
from volt.openstack.common import loopingcall
LOG = logging.getLogger(__name__)
def _thread_done(gt, *args, **kwargs):
"""Callback function to be passed to GreenThread.link() when we spawn()
Ca... |
"""
Module that contains the command line app.
Why does this file exist, and why not put this in __main__?
You might be tempted to import things from __main__ later, but that will cause
problems: the code will get executed twice:
- When you run `python -mflashcards` python will execute
``__main__.py`` as a... |
# -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
import scrapy
from scrapy.pipelines.images import ImagesPipeline
from scrapy.exceptions import DropItem
import os
class MyIma... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import os.path
import sys
import glob
import subprocess
import yaml
import tempfile # for test
import shutil
import hdfs3
from hdfs3 import HDFileSystem
import __builtin__
class TransparentFileSystem(object):
def __init__(self, base=False):
if base... |
from __future__ import absolute_import
import abc
from debtcollector import moves
from oslo_utils import excutils
import six
from taskflow import logging
from taskflow import states
from taskflow.types import failure
from taskflow.types import notifier
LOG = logging.getLogger(__name__)
#: These states will results... |
"""
synaptiks._bindings.xrecord
===========================
Incomplete binding to the XRecord extension atop of :mod:`ctypes`.
.. moduleauthor:: Sebastian Wiesner <<EMAIL>>
"""
from __future__ import (print_function, division, unicode_literals,
absolute_import)
from ctypes ... |
from construct import *
from ..adapters import LinearAdapter
FuncId = Enum(
Int8ul,
RESP_PONG=0x20,
RESP_REPEATED_MESSAGE=0x21,
RESP_REPEATED_MESSAGE_CUSTOM=0x22,
RESP_SYSTEM_INFO=0x23,
RESP_PACKET_INFO=0x24,
RESP_STATISTICS=0x25,
RESP_FULL_SYSTEM_INFO=0x26,
RESP_STORE_AND_FORWARD... |
from .virtual_machine_image_resource import VirtualMachineImageResource
class VirtualMachineImage(VirtualMachineImageResource):
"""Describes a Virtual Machine Image.
:param id: Resource Id
:type id: str
:param name: The name of the resource.
:type name: str
:param location: The supported Azur... |
# coding: utf-8
""" Tests for the Sentry plugin """
import pytest
import did.cli
import did.base
BASIC_CONFIG = """
[general]
email = "Did Tester" <<EMAIL>>
[sentry]
type = sentry
url = https://sentry.io/api/0/
organization = did-tester
"""
BAD_TOKEN_CONFIG = BASIC_CONFIG + "\ntoken = bad-token"
# test token for <... |
from __future__ import unicode_literals
from django.db import models
# Create your models here.
class Cooperativa(models.Model):
nombre = models.CharField(max_length=70)
descripcion = models.CharField(max_length=550)
zona = models.CharField(max_length=70)
responsable = models.CharField(max_length=70)... |
class ValueChecker(object):
"""
A class for general purpose value checks on commandline parameters
passed to subclasses of :class:`twisted.python.usage.Options`.
"""
default_doc = "fix me"
def __init__(self, coerce_doc=None):
if not coerce_doc:
self.coerce_doc = default_doc
... |
"""
Implements the quasimode's transparent window.
Throughout this module, it is important to keep in mind what the
various visual elements of the quasimode are. Below is a mediocre
ASCII representation of those elements:
Description Text
user and auto-complete text
suggestion 1
... |
import random
class Formatter():
def __init__(self, args):
self.builder = []
self.add(args)
def add(self, toAdd):
if (type(toAdd) is list):
for item in toAdd:
self.builder.append(item)
else:
self.builder.append(toAdd)
def randomize... |
"""MonitoredQueue classes and functions.
Authors
-------
* MinRK
* Brian Granger
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2013 Brian Granger, Min Ragan-Kelley
#
# This file is part of pyzmq
#
# Distributed under the terms of the New BSD License. The full l... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ui_geopunt4QgisAbout.ui'
#
# by: PyQt4 UI code generator 4.10.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _from... |
#!/usr/bin/env python
"""
conf file example
[elk-server]
ip = elk.server.ip
kibana = check_http
elasticsearch = check_http!-p 9200
logstash-3333 = check_tcp!3333
logstash-3334 = check_tcp!3334
load = check_nrpe!check_load
"""
import os, sys
import baker
from string import Template
try:
from ConfigParser import Co... |
#! /usr/bin/env python3
import config
config.import_libs()
import unittest
from xmlui import Connector, Logout
from xmlui import GatewayRegister, GatewayUnregister
from xmlui import DeviceParameterGet
from xmlui import DeviceParameterCreate, DeviceParameterUpdate, DeviceParameterDelete
class TestCRUDeviceParameter(... |
# -*- coding: utf-8 -*-
"""
Módulo: Versus
Diseño: Eliana
Código: Eliana
---
Módulo para el modo player versus player. Cada player tiene un round de tiempo. Al finalizar ambos rounds se comparan los resultados y se proclama al ganador.
"""
import pilasengine
import pilasengine.colores
import random... |
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
import compas_rhino
from compas_rhino.artists._shapeartist import ShapeArtist
class BoxArtist(ShapeArtist):
"""Artist for drawing box shapes.
Parameters
----------
shape : :class:`compas.geom... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Test.
#
import sys
from rpython import conftest
class o:
view = False
viewloops = True
conftest.option = o
from rpython.jit.metainterp.test.test_ajit import LLJitMixin
import pytest
from pycket.test.testhelper import parse_file
from pycket.interpreter import *... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
########################################################
# ansible-console is an interactive REPL shell for ansible
# with built-in tab completion for all the documented modules
#
# Available commands:
# cd - change host/group (yo... |
from __future__ import unicode_literals
import re
import urllib
import datetime
from sickbeard import db
import logging
from sickbeard.common import Quality
from sickbeard.common import WANTED, FAILED
from sickrage.helper.encoding import ss
from sickrage.helper.exceptions import EpisodeNotFoundException, ex
from sick... |
"""Test service helpers."""
from copy import deepcopy
import unittest
from unittest.mock import patch
# To prevent circular import when running just this file
import homeassistant.components # noqa
from homeassistant import core as ha, loader
from homeassistant.const import STATE_ON, STATE_OFF, ATTR_ENTITY_ID
from ho... |
from flask import Flask, render_template
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop
from bokeh.application import Application
from bokeh.application.handlers import FunctionHandler
from bokeh.embed import server_document
from bokeh.layouts import column
from bokeh.models import Column... |
import requests
import urllib
import json
class APIEndpoints(object):
EXTRACT_ENTITIES = 'https://api.idolondemand.com/1/api/sync/extractentities/v1'
TOKENIZE_TEXT = 'https://api.idolondemand.com/1/api/sync/tokenizetext/v1'
GET_SENTIMENT = 'https://api.idolondemand.com/1/api/sync/detectsentiment/v1'
cl... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.