content string |
|---|
import uuid
from player import Player
class Rooms:
def __init__(self, capacity=2):
"""
Handle rooms and set maximum rooms capacity
"""
self.rooms = {}
self.players = {}
self.room_capacity = capacity
def register(self, addr, udp_port):
"""
Regis... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from runner.koan import *
class AboutNewStyleClasses(Koan):
class OldStyleClass:
"An old style class"
# Original class style have been phased out in Python 3.
class NewStyleClass(object):
"A new style class"
# Introduced in Python... |
import remi.gui as gui
from remi import start, App
import math
class SvgPolygon(gui.SvgPolyline):
def __init__(self, _maxlen=None, *args, **kwargs):
super(SvgPolygon, self).__init__(_maxlen, *args, **kwargs)
self.type = 'polygon'
def set_stroke(self, width=1, color='black'):
... |
#!/usr/bin/env python
"""
@package coverage_model.hdf_utils
@file coverage_model/hdf_utils.py
@author Christopher Mueller
@brief Utility functions wrapping various HDF5 binaries
"""
import os
import re
import shutil
import subprocess
import StringIO
import fcntl
import h5py
import gevent.coros
from pyon.util.log impo... |
import logging
import numpy as np
def identity(x):
return x
def relim(lo, hi, log=False):
logging.getLogger(__name__).debug("Inputs to relim: %r %r", lo, hi)
x, y = lo, hi
if log:
if lo < 0:
x = 1e-5
if hi < 0:
y = 1e5
return x * .95, y * 1.05
del... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Install routine for gigasetelements command-line interface."""
import os
import codecs
from setuptools import setup, find_packages
HERE = os.path.abspath(os.path.dirname(__file__))
with codecs.open(os.path.join(HERE, 'DESCRIPTION.rst'), encoding='utf-8') as f:
... |
'''
Converts kobo-specific structures into xlsform-standard structures:
This enables us to use the form-builder to open and save structures which are not
standardized xlsform features.
Example structures: scoring, ranking
'''
import re
import json
import random
import string
class RowHandler(object):
def handle_... |
kv_error_types = {}
class MetaKeyValueError(type):
def __init__(self, name, inherits, attributes):
error_code = attributes.get('ERROR_CODE', None)
if error_code is not None:
kv_error_types[error_code] = self
class KeyValueError(Exception):
__metaclass__ = MetaKeyValueError
d... |
import os
import sys
import shutil
import subprocess
# Constants
REPO_ORIGIN_PREFIX = 'origin/'
# Utilities
def delete_repo_at_path(path):
print "Cleaning up"
print "Deleting the test directory at " + path
shutil.rmtree(path, True)
def git_command(args):
command_output = ''
error = False
tr... |
# -*- coding: utf-8 -*-
'''
Genesis Add-on
Copyright (C) 2015 Blazetamer
Copyright (C) 2015 lambda
Copyright (C) 2015 spoyser
Copyright (C) 2015 crzen
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as publ... |
from __future__ import unicode_literals
from datetime import datetime
import swapper
from factory import (
Iterator,
Sequence,
SubFactory,
)
from factory.django import DjangoModelFactory
from pytz import utc
from .application_factory import ApplicationFactory
from .entrepreneur_factory import Entreprene... |
import argparse
import sys
import unittest
from tap.i18n import _
from tap.loader import Loader
def main(argv=sys.argv, stream=sys.stderr):
"""Entry point for ``tappy`` command."""
args = parse_args(argv)
loader = Loader()
suite = loader.load(args.files)
runner = unittest.TextTestRunner(verbosi... |
from BaseTopology import BaseTopology
class Cluster(BaseTopology):
""" A cluster is a group of nodes which are all one hop from eachother
Clusters can also contain other clusters
When creating this kind of topology, return a single cluster (usually
the root cluster) from create_system in co... |
# -*- coding: utf-8 -*-
import os
from utils import make_dir, INSTANCE_FOLDER_PATH
class BaseConfig(object):
PROJECT = "reddit_parser"
# Get app root path, also can use flask.root_path.
# ../../config.py
PROJECT_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
DEBUG = True
... |
"""
Camshift
problem with meanshift: window always has same size when car (in example) is farther away and is very close to camera
not good
need to adapt window size with size and rotation of target
solution from OpenCV Labs
CAMshift - continously adaptive meanshift by Gary Bradsky
applies meanshift first
... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import copy
class Entry(object):
def __init__(self, fields):
self.__fields = fields
# Some inner status
self.__isenableedit = False
self.__isenablequery = False
# The really data to save
self.__realdict = {}
def getfi... |
"""Pylons middleware initialization"""
from beaker.middleware import CacheMiddleware, SessionMiddleware
from paste.cascade import Cascade
from paste.registry import RegistryManager
from paste.urlparser import StaticURLParser
from paste.deploy.converters import asbool
from pylons import config
from pylons.middleware imp... |
#These tests are used for the adapter_oracle
#Require oracle connected, unixODBC and oracle driver installed.
#Test 1: test loading records from the oracle table to create an index.
#Test 2: When the server is running, update the record in oracle,
# then the listener should fetch the results.
#Test 3: Shut down ... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import logging
from peewee import Model, SqliteDatabase, InsertQuery, IntegerField,\
CharField, FloatField, BooleanField, DateTimeField
from datetime import datetime
from base64 import b64encode
from .utils import get_pokemon_name
from .transform import tra... |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
import socket
def get_ipaddress():
try:
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(("baidu.com",80))
ip = s.getsockname()[0]
s.close()
return ip
except Exception, e:
return socket.gethostbyname(socket... |
""" Creates a local NPM package for testing using the output generated
from 'prepare_distribution_package.py' """
#!/usr/bin/python
# Imports
import os
import shutil
import glob
import cli
#
# Gets the main package folder
#
def get_package_folder():
""" Gets the main package folder """
project_path = cli.get... |
from __future__ import absolute_import
from __future__ import print_function
import sys
athresh = 100
border = 20
segf = sys.argv[1]
if len(sys.argv) > 2:
pref = sys.argv[2]
else:
pref = '/tmp/cut'
rects = []
starts = {}
for l in open(segf).readlines():
ls = l.split()
if len(ls) == 6 and ls[-1] == 'r... |
import pyxb.binding.generate
import pyxb.utils.domutils
import pyxb.utils.utility
from pyxb.utils.utility import MakeIdentifier
import os.path
xsd='''<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="simple_type">
<xs:simpleContent>
<... |
import oauth2 as oauth
import urllib2 as urllib
# See assignment1.html instructions or README for how to get these credentials
api_key = "O7mnwEwvi2fxPYr8uCbA2OYWK"
api_secret = "E1PGhC65EAVpHDuRM0Ox8SY04sOvnR8eT0c0DzeqU5SCcgv5nv"
access_token_key = "16523704-o7MhGQY5NEcYocE1m1Sp5m6yJM6YXc6NLniQ7cWSH"
access_token_se... |
"""dodo file. test + management stuff"""
import glob
import os
import pytest
from doit.tools import create_folder
DOIT_CONFIG = {'default_tasks': ['checker', 'ut']}
CODE_FILES = glob.glob("doit/*.py")
TEST_FILES = glob.glob("tests/test_*.py")
TESTING_FILES = glob.glob("tests/*.py")
PY_FILES = CODE_FILES + TESTING_... |
from node import Node
class Queue(object):
def __init__(self, tail=None, head=None):
self.tail = tail
self.head = head
self.size = 0
def __repr__(self):
'''Return the size of the queue and node at the head of the queue.'''
return 'The Queue has {num} nodes, with {head}... |
import os
import sys
import subprocess
import time
import shutil
import glob
#Config parameters
# USER CAN EDIT
basePath = "/bigData/irodsData/showers/auger_ta_corsika76400/"
hadModel = "QGSJII-04"
primComp = "proton"
evtNum = "34"
runNum = 3
cpuCores = 6
evtGenPath = "/auger_fd_scale_reconstruct/QGSJETII-04/run1/"
... |
from django.shortcuts import render
from django.conf import settings
import os, mimetypes
# Create your views here.
import logging
from django.shortcuts import render
from django.http import HttpResponse
from django.contrib.auth.decorators import login_required
from django.views.generic import ListView, DetailView, Te... |
# coding: utf8
# modi.py
# 8/13/2013 jichi
if __name__ == '__main__': # DEBUG
import sys
sys.path.append("..")
import os
# This file must be consistent with modiocr.h
# enum modiocr_lang : unsigned long
#modiocr_lang_null = 0 # failed
LANG_JA = 1 << 0 # miLANG_JAPANESE = 17,
LANG_ZHS = 1 << 1 # miLANG_CHINESE_... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
二叉树:一个节点最多有两个孩子节点的树。
如果是从0索引开始存储,那么对应于节点p的孩子节点是2p+1和2p+2两个节点,
相反,节点p的父亲节点是(p-1)/2位置上的点
'''
# 直接使用list来实现二叉树,可读性差
'''
def binary_tree(r):
return [r, [], []]
def insert_left(root, new_branch):
t = root.pop(1)
if len(t) > 1:
# new_branch becomes the... |
"""
Along with apirpc, implements an API-validating and versioning scheme for
xmlrpc calls.
"""
import inspect
import itertools
import traceback
from conary import versions
from conary.deps import deps
from conary.deps.deps import ThawFlavor
from conary.deps.deps import ThawDependencySet
from conary.lib import util
... |
# FIXME: the command stuff should have a more state like configuration alias -- MPD
import time
try:
import boto
import boto.ec2
from boto import route53
from boto.route53 import Route53Connection
from boto.route53.record import ResourceRecordSets
HAS_BOTO = True
except ImportError:
HAS_BO... |
import numpy as np
import scipy.interpolate
from pyqtgraph.Qt import QtGui, QtCore
class ColorMap(object):
"""
A ColorMap defines a relationship between a scalar value and a range of colors.
ColorMaps are commonly used for false-coloring monochromatic images, coloring
scatter-plot points, and colorin... |
from madanalysis.enumeration.ma5_running_type import MA5RunningType
import os
import logging
class DelphesMA5tuneConfiguration:
userVariables = { "detector" : ["cms","atlas"],\
"output": ["true","false"],\
"pileup": ["none"] }
def __init__(self):
se... |
#
"""
Tool to generate YubiKey secret keys using YubiHSM.
After generation with this tool, you can (given that you know the AES
key for the key handle used in the HSM) generate a CSV file of the
unencrypted AEADs formatted for YubiKey personalization using the
YubiKey multi configuration utility (Windows) using the co... |
"""
Test classifier
"""
import logging
import os
import csv
from bz2 import BZ2File
import filecmp
import sys
from bioy_pkg import main
from __init__ import TestBase, TestCaseSuppressOutput, datadir as datadir
log = logging.getLogger(__name__)
class TestClassifier(TestBase, TestCaseSuppressOutput):
def main... |
from __future__ import print_function
import sys
import argparse
import pykickstart
import pykickstart.parser
from pykickstart.i18n import _
from pykickstart.version import DEVEL, makeVersion
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument("-c", "--config", dest="kscfg", required=True... |
# -*- coding: utf-8 -*-
from resources.lib.gui.gui import cGui
from resources.lib.gui.guiElement import cGuiElement
from resources.lib.handler.requestHandler import cRequestHandler
from resources.lib.parser import cParser
from resources.lib.handler.ParameterHandler import ParameterHandler
from resources.lib import logg... |
import argparse
import logging
from collections import defaultdict
from enum import Enum
import requests
from waiter import terminal, http_util
from waiter.data_format import load_data
from waiter.querying import get_token, query_token, get_target_cluster_from_token
from waiter.util import deep_merge, FALSE_STRINGS, ... |
#!/usr/bin/env python
import cgi
import os
import json
from uuid import uuid1
from flask import Flask, render_template, abort, url_for, request, flash, session, redirect
from mdx_github_gists import GitHubGistExtension
from mdx_strike import StrikeExtension
from mdx_quote import QuoteExtension
from mdx_code_multiline i... |
"""
A simple heartbeat creater
Copyright 2016 22Acacia 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 req... |
import os
import sys
sys.path.insert(0, os.path.abspath('../..'))
# -- General configuration ----------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = [
'sphinx... |
import asyncio
import aiohttp
import configparser
import json
import random
import discord
from discord.ext import commands
import derpibooru as d
import aiofiles
import checks
config = configparser.ConfigParser()
config.read("config.ini")
source = config['Bot']['source_url']
timers = {}
class Utility:
"""Co... |
# Written by Scaevolus 2010
import string
import re
from util import hook, http, text, pyexec
re_lineends = re.compile(r'[\r\n]*')
db_ready = []
# some simple "shortcodes" for formatting purposes
shortcodes = {
'[b]': '\x02',
'[/b]': '\x02',
'[u]': '\x1F',
'[/u]': '\x1F',
'[i]': '\x16',
'[/... |
# -*- coding: utf-8 -*-
import os, csv, glob
langdata = {}
def proc_csv(fname, count_key):
fcsv = open(fname, 'rb')
reader = csv.reader(fcsv)
headers = reader.next()
for record in reader:
lang, cnt = record
if lang not in langdata:
langdata[lang] = {}
langdata[lang]... |
import os
import sh
import time
import pytest
from os.path import exists
from utils import cd, source_activated
def cleanup():
if exists('tmp/test_cli/'):
sh.rm('-R', 'tmp/test_cli/')
def init_build():
""" Tests that the CLI can properly init a new project install packages and build it
1. `e... |
import matplotlib as mpl
from cycler import cycler
CATEGORIES = ['left', 'mainstream', 'right']
RATINGS = ['no factual content', 'mostly false', 'mixture of true and false', 'mostly true']
palette = ['#1f77b4', '#ff7f0e', '#2ca02c', '#d62728', '#9467bd', '#8c564b', '#e377c2', '#7f7f7f', '#bcbd22', '#17becf']
mpl.rc... |
"""Formatter for the shell item events."""
from plaso.formatters import interface
class ShellItemFileEntryEventFormatter(interface.ConditionalEventFormatter):
"""Class that formats Windows volume creation events."""
DATA_TYPE = 'windows:shell_item:file_entry'
FORMAT_STRING_PIECES = [
u'Name: {name}',
... |
import configparser
from pathlib import Path
import unittest
from TM1py.Services import TM1Service
from TM1py.Utils.Utils import CaseAndSpaceInsensitiveSet, CaseAndSpaceInsensitiveDict, CaseAndSpaceInsensitiveTuplesDict
config = configparser.ConfigParser()
config.read(Path(__file__).parent.joinpath('config.ini'))
c... |
#!/usr/bin/env python
import sys
import csv
import _csv
import psycopg2
import math
import cStringIO
import re
import traceback
csv.field_size_limit(524288000)
byte_counter = 0
type_rank = [
'decimal',
'character varying'
]
def try_type(anystring, existing):
def current_type():
if anystring ... |
# -*- coding: utf-8 -*-
import json
def content_filter(line):
index = line.find('[TAG]')
if index == -1:
return None
data_list = line.split('@$_$@')
json_data = json.loads(data_list[-1])
del data_list[-1]
del data_list[0]
data_list.append(json_data.get('companyId', ''))
doc_co... |
#!/usr/bin/env python
"""Custom reST_ directive for plantuml_ integration.
Adapted from ditaa_rst plugin.
.. _reST: http://docutils.sourceforge.net/rst.html
.. _plantuml: http://plantuml.sourceforge.net/
"""
from __future__ import unicode_literals
import sys
import os
import tempfile
import io
from subprocess imp... |
from spack import *
class Plplot(CMakePackage):
"""PLplot is a cross-platform package for creating scientific plots."""
homepage = "http://plplot.sourceforge.net/"
url = "https://sourceforge.net/projects/plplot/files/plplot/5.13.0%20Source/plplot-5.13.0.tar.gz/download"
version('5.15.0', sha256... |
import mock
from networking_brocade.vdx.ml2driver import (
mechanism_brocade as brocademechanism)
from neutron.plugins.ml2 import config as ml2_config
from neutron.tests.unit.plugins.ml2 import test_plugin
from oslo_log import log as logging
from oslo_utils import importutils
LOG = logging.getLogger(__name__)
MEC... |
# import pytest
from yMathematics import *
# average
def test_returns_None_instead_of_raising_exceptions():
assert average([], 0) is None # empty list
assert average([], 3) is None # wrong averaging type
assert average([[1, 2], 3], 0) is None # unstructured list
assert average([[1, 2], [3, 4, 5]], ... |
from django.db import models
from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin
from configuration.models import Country, ValueUser
from django.urls import reverse
from .conf import settings
class User(AbstractBaseUser, PermissionsMixin):
"""
The model representing a user of QCAT. Thi... |
__author__ = 'ipetrash'
from pluginmanager_ui import Ui_PluginManager
from PySide.QtGui import *
from PySide.QtCore import *
from pluginmodel import PluginModel
from pluginsloader import PluginsLoader
class PluginManager(QDialog, QObject):
def __init__(self, data_singleton, parent=None):
super().__init_... |
import unittest
import time
import threading
import kazoo.sync
import kazoo.sync.util
realthread = kazoo.sync.util.get_realthread()
class SyncStrategyTests(unittest.TestCase):
def setUp(self):
self.sync = kazoo.sync.get_sync_strategy()
print "Sync strategy is %s" % self.sync.name
def tearDow... |
from __future__ import division
import math
import time
from mapproxy.compat import iteritems, itervalues
from mapproxy.response import Response
from mapproxy.exception import RequestError
from mapproxy.service.base import Server
from mapproxy.request.tile import tile_request
from mapproxy.request.base import split_m... |
"""empty message
Revision ID: b68a125b8470
Revises: 57c7302610d1
Create Date: 2017-03-07 16:37:44.598935
"""
# revision identifiers, used by Alembic.
revision = 'b68a125b8470'
down_revision = '57c7302610d1'
from alembic import op
import sqlalchemy as sa
def upgrade():
# ### commands auto generated by Alembic ... |
#!/usr/bin/env python
# encoding: UTF-8
import ast
from setuptools import setup
import os.path
try:
import cloudhands.ops.__version__ as version
except ImportError:
# Pip evals this file prior to running setup.
# This causes ImportError in a fresh virtualenv.
version = str(ast.literal_eval(
... |
import os
from icgc_utils.utils import *
from icgc_utils.mysql import *
#########################################
def get_position_translation(cursor, tcga_somatic_table, ref_assembly):
standard_chroms = [str(i) for i in range(1,23)] + ['X','Y']
meta_table_name = tcga_somatic_table.split("_")[0] + "_mutations_meta"
... |
# -*- coding: utf-8 -*-
import unittest
import warnings
import pytest
from docker.constants import DEFAULT_DOCKER_API_VERSION
from docker.errors import InvalidArgument, InvalidVersion
from docker.types import (
ContainerConfig, ContainerSpec, EndpointConfig, HostConfig, IPAMConfig,
IPAMPool, LogConfig, Mount... |
"""Test guassian mixture models against known values"""
import unittest
from collections import Counter
from numpy.testing import assert_almost_equal
from sparktkregtests.lib import sparktk_test
class GMMModelTest(sparktk_test.SparkTKTestCase):
def setUp(self):
data_file = self.get_file("gmm_data.csv")
... |
import datetime
from task_base import TaskBase
from models.project import Project
from utils.notifier import Notifier
class ProjectTask(TaskBase):
def __init__(self):
self._n = Notifier()
super(ProjectTask, self).__init__()
def info(self):
try:
project = Project.get()
self._n.success("Project created!"... |
"""
Created on 9 Nov 2016
@author: Bruno Beloff (<EMAIL>)
https://xy1eszuu23.execute-api.us-west-2.amazonaws.com/staging/topicMessages?
topic=south-coast-science-dev/production-test/loc/1/gases&
startTime=2018-03-31T07:50:59.712Z&
endTime=2018-03-31T07:55:59.712Z
header:
CURLOPT_HTTPHEADER => array('Accept: applicat... |
#!/usr/bin/env python
import argparse
import os
import shutil
# Parse command-line arguments
def options():
parser = argparse.ArgumentParser(description="Get file names to run FASTQC over")
parser.add_argument("-d", "--directory", help="directory to run script over.")
parser.add_argument("-o", "--outdir"... |
from __future__ import division
from __future__ import print_function
def input(in_msg):
import inspect
in_msg.input_file = inspect.getfile(inspect.currentframe())
print("*** read input from ", in_msg.input_file)
# 8=MSG1, 9=MSG2, 10=MSG3
#in_msg.sat_nr=0
#in_msg.RSS=True
#in_msg.sat_n... |
"""
Django settings for driver_web project.
Generated by 'django-admin startproject' using Django 1.8.4.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Build p... |
# -*- encoding: utf-8 -*-
# vim: ts=4 sw=4 expandtab ai
"""
Usage::
hammer product [OPTIONS] SUBCOMMAND [ARG] ...
Parameters::
SUBCOMMAND subcommand
[ARG] ... subcommand arguments
Subcommands::
create Create a product
delete ... |
__author__ = "<EMAIL> (John Admanski)"
import os, sys
try:
import autotest.client.common_lib.check_version as check_version
except ImportError:
# This must run on Python versions less than 2.4.
dirname = os.path.dirname(sys.modules[__name__].__file__)
common_dir = os.path.abspath(os.path.join(dirname,... |
import asyncio
import logging
from argparse import ArgumentParser, _ArgumentGroup, Namespace
from typing import Dict, Type, TypeVar, NamedTuple, TYPE_CHECKING
from collections import OrderedDict
from lightbus.schema.schema import Parameter
from lightbus.exceptions import PluginHookNotFound, LightbusShutdownInProgress... |
"""
Push events to Gerrit
"""
import time
import warnings
from pkg_resources import parse_version
from twisted.internet import defer
from twisted.internet import reactor
from twisted.internet.protocol import ProcessProtocol
from twisted.python import log
from buildbot.process.results import EXCEPTION
from buildbot.p... |
import unittest
from tests.either_or import either_or
class nxppyTests(unittest.TestCase):
"""Basic tests for the NXP Read Library python wrapper."""
def test_import(self):
"""Test that it can be imported"""
import nxppy
@either_or('detect')
def test_detect_mifare_present(self):
... |
"""Generic Node base class for all workers that run on hosts."""
import inspect
import os
import random
from oslo_concurrency import processutils
from oslo_config import cfg
from oslo_db import exception as db_exc
from oslo_log import log as logging
import oslo_messaging as messaging
from oslo_service import looping... |
# -*- coding: utf-8 -*-
"""
"""
__package__='odmltables'
import datetime
import xlwt
import numpy as np
# Workaround Python 2 and 3 unicode handling.
try:
unicode = unicode
except NameError:
unicode = str
from .odml_table import OdmlTable
from .xls_style import XlsStyle
class OdmlXlsTable(OdmlTable):
... |
# -*- coding: utf-8 -*-
import json
import scrapy
from locations.items import GeojsonPointItem
class SuperonefoodsSpider(scrapy.Spider):
name = "superonefoods"
allowed_domains = ["www.superonefoods.com"]
start_urls = (
'https://www.superonefoods.com/store-finder',
)
def parse(self, respo... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'digOutputEditForm.ui'
#
# Created by: PyQt5 UI code generator 5.10
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_digOutputEditForm(object):
def setupUi(self, digOutputEditF... |
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 10 22:18:28 2014
@author: sunshine
"""
import sys
import getopt
import pandas as pd
import numpy as np
import os.path as osp
import requests as rq
import datetime as dt
from lxml import html
from threading import Thread
from Queue import Queue
from shared import *
clas... |
from ikalog.utils import *
# Needed in GUI mode
try:
import wx
except:
pass
# IkaOutput_Fluentd: IkaLog Output Plugin for Fluentd ecosystem
#
class Fluentd(object):
def apply_ui(self):
self.enabled = self.checkEnable.GetValue()
self.host = self.editHost.GetValue()
self.port = se... |
import socket
from ompvids import *
import time
passkey = ''
in_bucket_name = os.environ['AWS_IN_BUCKET'] # will assplode if not defined in environment
out_bucket_name = os.environ['AWS_OUT_BUCKET']
server_hostname = os.environ['SERVER_HOSTNAME']
tmp_path = '/tmp/'
def do_out(key, bucket, suffix, type):
out_k = Key... |
#!/usr/bin/env python
# Verbose, notice, and spam log levels for Python's logging module.
#
# Last Change: March 7, 2017
# URL: https://verboselogs.readthedocs.io
"""Setup script for the `verboselogs` package."""
# Standard library modules.
import codecs
import os
import re
# De-facto standard solution for Python p... |
""" unit testing code for the descriptor COM server
"""
from __future__ import print_function
from rdkit import RDConfig
import unittest
import Parser
from win32com.client import Dispatch
from Numeric import *
class TestCase(unittest.TestCase):
def setUp(self):
print('\n%s: '%self.shortDescription(),end='')
d... |
# -*- coding: utf-8 -*-
from openerp import models, fields, api, _
class server_hostname(models.Model):
""""""
_name = 'it_infrastructure.server_hostname'
_description = 'server_hostname'
_sql_constraints = [
('name_uniq', 'unique(name, wildcard)',
'Hostname/wildcard must be uni... |
# -*- coding: utf-8 -*-
import os
import pickle
from tempfile import gettempdir
from watson.common.contextmanagers import suppress
from watson.http.sessions.abc import StorageMixin
class Storage(StorageMixin):
"""A file based storage adapter for session data.
By default it will store data in the systems tem... |
from spack import *
class Clamr(CMakePackage):
"""The CLAMR code is a cell-based adaptive mesh refinement (AMR)
mini-app developed as a testbed for hybrid algorithm development
using MPI and OpenCL GPU code.
"""
homepage = "https://github.com/lanl/CLAMR"
url = "https://github.com/lanl/CL... |
from django import template
from vcms.www.models import Banner
import settings
register = template.Library()
def print_log(banner, has_banner):
print("banner | %s" % banner)
print("banner_images | %s" % banner.get_images())
print("has_banner | %s" % has_banner)
print("banner_style | %s" % banner.styl... |
"""Storage backend for VMware Datastore"""
import hashlib
import httplib
import logging
import os
import socket
from oslo.config import cfg
from oslo.vmware import api
import six.moves.urllib.parse as urlparse
import glance_store
from glance_store import exceptions
from glance_store.i18n import _
from glance_store.i... |
'''
room-challenge
Author: Daniel Karandikar
App to calculate room volume, floor area, and paint required for walls
'''
import tkinter as tk
from tkinter import ttk
class App(tk.Tk):
'''The main app, calculates volume, area and paint required
Calculates the volume of the room, the area of the floor, and the ... |
from flask import Blueprint, flash, g, redirect, render_template, url_for
from sqlalchemy import func
from sqlalchemy.orm import foreign, remote
from si_site import db, messages
from si_site.auth import session_auth
from si_site.forms import CapeForm, ChangePassForm, ServerAddForm, \
ServerEditForm, SkinForm
from ... |
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup ------------------------------------------------------------... |
#!/usr/bin/env python
''' W celu poprawniego dzialania ponizszego skryptu, trzeba skonigurowac
logowanie RSA / DSA na maszynie na ktora, bedziemy przenosic nasza kopie zapasowa. Sposob konfiguracji mozna znalezc tutaj
http://www.nerdokracja.pl/linux-logowanie-ssh-klucze-rsa/
'''
import os
import os.path
print ('Tw... |
#!/usr/bin/env python
"""Provide functions for working with our DAGs."""
# Imports
from logzero import logger as log
from functools import partial
from collections import deque
import networkx as nx
from munch import Munch, munchify
import synapseclient as synapse
import veoibd_synapse.errors as e
# Metadata
__a... |
import simplejson
import json
import urllib
import urllib2
import pprint
import sys
import time
import ast
import sys
try:
import iocminion
except ImportError:
print "iocminion not installed see: https://github.com/pun1sh3r/iocminion"
import argparse
iocObj = iocminion.iocMinion()
def process_list(data,desc,fd)... |
import os
def isProductionEnvironment():
'''check if the program is running in a lofar producution environment'''
return os.environ.get('LOFARENV', '') == 'PRODUCTION'
def isTestEnvironment():
'''check if the program is running in a lofar test environment'''
return os.environ.get('LOFARENV', '') == 'T... |
import pytest
import networkx as nx
from discoutils.tokens import DocumentFeature, Token
from eval.pipeline.feature_extractors import FeatureExtractor
from eval.pipeline.tokenizers import XmlTokenizer
@pytest.fixture
def valid_AN_features():
return [('big', 'cat'), ('black', 'cat'), ('small', 'bird'), ('red', 'b... |
"""Describe what tasks this Process accomplishes."""
# Order of imported packages should be:
# Standard libraries
from pathlib import Path
from shutil import copy2
# Third party libraries
from plumbum import TEE
# Resolwe
from resolwe.process import (
Process,
SchedulingClass,
Persistence,
Cmd,
St... |
__app__ = "MQTT to Cloud"
__author__ = "Xose Pérez"
__contact__ = "<EMAIL>"
__copyright__ = "Copyright (C) 2013 Xose Pérez"
__license__ = 'GPL v3'
import sys
from libs.Config import Config
from libs.Mosquitto import Mosquitto
from libs.Manager import Manager
from libs.services.Cosm import Cosm
if __name__ == "__mai... |
# -*- coding: utf-8 -*-
# ProjectEuler/src/python/problem165.py
#
# Intersections
# =============
# Published on Saturday, 27th October 2007, 10:00 am
#
# A segment is uniquely defined by its two endpoints. By considering two line
# segments in plane geometry there are three possibilities: the segments have
# zero p... |
from dataclasses import dataclass
from pathlib import Path
from typing import Optional, List, Dict, Tuple
import nassl
from sslyze.errors import TlsHandshakeFailed
from sslyze.plugins.certificate_info._cert_chain_analyzer import (
CertificateDeploymentAnalyzer,
CertificateDeploymentAnalysisResult,
)
from ssly... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.