content stringlengths 4 20k |
|---|
#!/usr/bin/env python3
#!/usr/bin/python
import re
# pass_regex = re.compile(r'passing', re.MULTILINE)
# pass_regex = re.compile(r'hello', re.MULTILINE)
# pass_regex = re.compile(r'.*hello.*')
pass_regex = re.compile(r'.*?(?P<passing>\d+?) passing.*', re.MULTILINE)
# pass_regex = re.compile(r'.*passing.*', re.MULTIL... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# prompts
PRIMARY_OS = 'Ubuntu-14.04'
PRIMARY = '''#!/bin/sh
FQDN="{fqdn}"
export DEBIAN_FRONTEND=noninteractive
# locale
sudo locale-gen en_US.UTF-8
# /etc/hostname - /etc/hosts
echo $FQDN > /etc/hostname
service hostname restart
sleep 5
apt-get update
apt-get -y up... |
# coding: utf-8
from utils import CanadianScraper, CanadianPerson as Person
import re
COUNCIL_PAGE = 'https://www.v3r.net/a-propos-de-la-ville/vie-democratique/conseil-municipal/maire-et-conseillers-municipaux'
class TroisRivieresPersonScraper(CanadianScraper):
def scrape(self):
page = self.lxmlize(COUN... |
from pycp2k.inputsection import InputSection
class _each413(InputSection):
def __init__(self):
InputSection.__init__(self)
self.Just_energy = None
self.Powell_opt = None
self.Qs_scf = None
self.Xas_scf = None
self.Md = None
self.Pint = None
self.Meta... |
"""
Platform independant VPN launcher interface.
"""
import getpass
import hashlib
import os
import stat
from abc import ABCMeta, abstractmethod
from functools import partial
# from leap.bitmask.backend.settings import Settings, GATEWAY_AUTOMATIC
# from leap.bitmask.config.providerconfig import ProviderConfig
from le... |
'''
Given a collection of intervals, merge all overlapping intervals.
Link: https://leetcode.com/problems/merge-intervals/?tab=Description
Example:
For example,
Given [1,3],[2,6],[8,10],[15,18],
return [1,6],[8,10],[15,18].
Solution:
Just go through the interv... |
import os
import numpy as np
from tests.data import voyager_h5, voyager_fil
import blimpy as bl
import pytest
def test_info():
a = bl.Waterfall(voyager_h5)
print(a)
a.info()
a.blank_dc(n_coarse_chan=1)
a.calibrate_band_pass_N1()
# Below: orphaned functions (not used anywhere else).
# That ... |
"""private_mkt will be populated from puppet and placed in this directory"""
from mkt.settings import * # noqa
from settings_base import * # noqa
import private_mkt
DOMAIN = "marketplace-altdev.allizom.org"
SERVER_EMAIL = '<EMAIL>'
SITE_URL = 'https://marketplace-altdev.allizom.org'
BROWSERID_AUDIENCES = [SITE_UR... |
"""Make supplementary crossvalidation PRC/ROC figures.
Author: Seth Axen
E-mail: <EMAIL>
"""
import os
import glob
import logging
from matplotlib import pyplot as plt
import seaborn as sns
from python_utilities.scripting import setup_logging
from e3fp_paper.plotting.defaults import DefaultColors
from e3fp_paper.plot... |
#!/usr/bin/python
import time
import string
import sys
import os
import re
# Set your decoder swig path in here!
sys.path.append("/home/user/decoder/src/swig");
import Decoder
def runto(frame):
while (frame <= 0 or t.frame() < frame):
if (not t.run()):
break
def rec(start, end):
st = o... |
# This is here to allow a sub-object that contains all of our crud information within the
# peewee model and avoid messing with model object data as much as possible
class ResponseMessages:
# Errors
ErrorDoesNotExist = 'Resource with id \'{0}\' does not exist'
ErrorTypeInteger = 'Value \'{0}\' must be an ... |
import numpy as np
try:
import astropy.io.fits as pyfits
import astropy.wcs as pywcs
except ImportError:
import pyfits
import pywcs
def fits_overlap(file1,file2):
"""
Create a header containing the exact overlap region between two .fits files
Does NOT check to make sure the FITS files are ... |
import os
import time
import sys
import re
import base64
import math
__all__ = ("newid",
"Stopwatch")
# Note on the ID range [0, 2**53]. We once reduced the range to [0, 2**31].
# This lead to extremely hard to track down issues due to ID collisions!
# Here: https://github.com/crossbario/autobahn-python/... |
from ert.cwrap import clib, CWrapper
from ert.job_queue import WorkflowJob
from ert.test import TestAreaContext, ExtendedTestCase
from ert_tests.job_queue.workflow_common import WorkflowCommon
test_lib = clib.ert_load("libjob_queue") # create a local namespace
cwrapper = CWrapper(test_lib)
alloc_config = cwrapper.p... |
import subprocess, re, urllib, datetime, rpiutil
def connect_type (word_list):
if 'wlan0' in word_list or 'wlan1' in word_list:
con_type = 'wifi'
elif 'eth0' in word_list:
con_type = 'ethernet'
else:
con_type = 'current'
return con_type
def getPrivateIp () :
arg='ip route list... |
"""Module to load flags.
.. moduleauthor:: Xiaodong Wang <<EMAIL>>
"""
import sys
from optparse import OptionParser
PARSER = OptionParser()
OPTIONS = None
def init():
"""Init flag parsing.
"""
global OPTIONS
(options, argv) = PARSER.parse_args()
sys.argv = [sys.argv[0]] + argv
OPTIONS =... |
description = "parses OmegaScan config files, constructs associated output json objects, etc. Parsing inspired by https://github.com/ligovirgo/gwdetchar/blob/master/gwdetchar/omega/scan.py"
author = "<EMAIL>"
#-------------------------------------------------
import os
from commands import gps2str
#-----------... |
#!/usr/bin/python
import sys
import time
from datetime import datetime
import requests
import argparse
import logging
import logging.config
import json
import sensors
def load_log_config(filename='weather_log.json'):
with open(filename) as fin:
logging.config.dictConfig(json.loads(fin.read()))
class Wea... |
#!/usr/bin/env python
import os
import unittest
class TestShell(unittest.TestCase):
'''Class to test functions in vsc.shell'''
def test_shells(self):
from vsc.shell import get_shells
expected_shells = set(['bash', 'sh', 'tcsh', 'csh'])
self.assertEqual(expected_shells, set(get_shells... |
import sys, time
from commontest import *
from rdiff_backup import rpath, Globals
"""benchmark.py
When possible, use 'rdiff-backup' from the shell, which allows using
different versions of rdiff-backup by altering the PYTHONPATH. We
just use clock time, so this isn't exact at all.
"""
output_local = 1
output_desc ... |
#!/usr/bin/python3
'''
reinhart_not_hardt.py
Author: Kevin Fronczak
Date : Dec 18, 2016
Desc : How hard is it to spell 'Reinhart'? Apparently really fucking difficult,
otherwise I wouldn't be making this bot.
'''
import praw
import sys
import os
import time
from app import logger
LOGGER = logger.Logger("... |
import csv, re
inged = open(r'c:\data\earlysaints\ward-watt\iowa.ged', 'rU')
outcsv = open(r'c:\data\earlysaints\ward-watt\iowa.csv', 'w')
fields=['id','assert_type','subject','predicate','object']
csvwriter = csv.DictWriter(outcsv, fieldnames=fields,lineterminator='\n')
csvwriter.writeheader()
inlines = inged.readline... |
"""STEREO Map subclass definitions"""
#pylint: disable=W0221,W0222,E1121
__author__ = "Keith Hughitt"
__email__ = "<EMAIL>"
from sunpy.map import Map
from sunpy.time import parse_time
from sunpy.cm import cm
__all__ = ['EUVIMap', 'CORMap']
class EUVIMap(Map):
"""EUVI Image Map definition"""
@classmethod
... |
#!/usr/bin/env python3
# Script for converting eddie format (sqlite, hashes) to joshua format (files, paths)
import sys
import os
_, filename = sys.argv
import sqlite3
uri = 'file:{}?mode=ro'.format(filename)
conn = sqlite3.connect(uri, uri=True) # type: ignore
def iterate(conn):
yield from (t for t in co... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'qt\ui\openmenu.ui'
#
# by: PyQt4 UI code generator 4.8.5
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
_fromUtf8 = lamb... |
import pygame
from ngine.resources import tools
class SoundHandler:
def __init__(self):
pygame.mixer.init()
self.__files = {}
def load(self, sounds):
for filename in sounds:
if not pygame.mixer:
self.__files[key] = NoneSound()
else:
... |
from .models import Network, DnsDomain, DnsARecord, DnsCName, Vlan, DhcpEntry
from rest_framework import viewsets, filters
from .serializers import DnsDomainSerializer, NetworkSerializer, DnsARecordSerializer, DnsCnameSerializer
from .serializers import VlanSerializer, DhcpEntrySerializer, NetworkAddressSerializer, Vla... |
"""
Created on Thu Nov 8 16:19:30 2018
@author: fergal
"""
from __future__ import print_function
from __future__ import division
from pdb import set_trace as debug
import matplotlib.pyplot as plt
import matplotlib as mpl
import pandas as pd
import numpy as np
from kepler.plateau import plateau
import kepler.kplrfi... |
import os
import sys
import madcow
sys.path.insert(0, os.path.join(os.path.dirname(madcow.__file__), 'include'))
# parse_qsl moved to urlparse module in v2.6
try:
from urlparse import parse_qsl
except:
from cgi import parse_qsl
import oauth2 as oauth
REQUEST_TOKEN_URL = 'https://api.twitter.com/oauth/request_to... |
from studio.lib.datasource_discovery import *
import pylons
def ogr_list(ogr_string):
dsa = discover_datasources(ogr_string)
for ds in dsa:
dsc = discover_datasource_columns(ogr_string,ds['hash'])
datadir = pylons.config['default_datastore_dir']
def test_directory():
dsa = discov... |
#!/usr/bin/env python
import json
import yaml
import glob
import os
import subprocess
import signal
import atexit
from argparse import ArgumentParser
from flask import Flask, Response, request
app = Flask(__name__)
# path where datawire configuration is stored
DATAWIRE_CONFIG_ROOT = None
# path where the Watson exe... |
import os
import re
import subprocess
import sys
from contextlib import contextmanager
from datetime import datetime
from distutils.log import ERROR, set_threshold
from distutils.text_file import TextFile
from glob import glob
import click
from setuptools import find_packages
from setuptools.command.egg_info import Fi... |
import atexit
import fcntl
import os
import sys
from quantum.agent.linux import utils
from quantum.openstack.common import log as logging
LOG = logging.getLogger(__name__)
class Pidfile(object):
def __init__(self, pidfile, procname, root_helper='sudo'):
try:
self.fd = os.open(pidfile, os.O_C... |
from navmazing import NavigateToSibling, NavigateToAttribute
from widgetastic.exceptions import NoSuchElementException
from wrapanapi.hawkular import CanonicalPath
from cfme.common import WidgetasticTaggable, UtilizationMixin
from cfme.exceptions import MiddlewareDatasourceNotFound
from cfme.middleware.provider import... |
"""
Contrail wrapper around ESX
"""
import re
import time
import socket
import sys
import uuid
from oslo.config import cfg
from nova import exception
from nova.openstack.common import log as logging
from nova.openstack.common import loopingcall
from nova.openstack.common import uuidutils
from nova.virt import driver
... |
"""Tests of using the context manager style.
The context manager is based on the InterceptFixture used in gabbi.
"""
import socket
from uuid import uuid4
import py.test
import requests
import urllib3
from httplib2 import Http, ServerNotFoundError
# don't use six as the monkey patching gets confused
try:
import ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import ast
import sys
from os.path import join, abspath, dirname
ROOT = abspath(join(dirname(abspath(__file__)), "..", ".."))
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is rel... |
from time import time
import logging
from binascii import unhexlify, hexlify
from struct import pack, unpack
log = logging.getLogger("btctl")
LLID_LMP = 3
EXT_OPCODE = 0x100
# LMP opcodes
LMP_NAME_REQ = 1
LMP_NAME_RES = 2
LMP_ACCEPTED = 3
LMP_NOT_ACCEPTED ... |
"""
This module provides an interface to the Elastic Compute Cloud (EC2)
service from AWS.
"""
from boto.ec2.connection import EC2Connection
from boto.regioninfo import RegionInfo
RegionData = {
'us-east-1': 'ec2.us-east-1.amazonaws.com',
'us-gov-west-1': 'ec2.us-gov-west-1.amazonaws.com',
'us-west-1': 'e... |
from __future__ import absolute_import
import datetime as dt
import logging
from decimal import Decimal
from django.utils import timezone
from silver.models import Customer, Subscription, Proforma, Invoice, Provider, BillingLog
from silver.utils.dates import ONE_DAY
logger = logging.getLogger(__name__)
class Do... |
"""`plot_axon_map`, `plot_implant_on_axon_map`"""
# https://stackoverflow.com/questions/21784641/installation-issue-with-matplotlib-python
from sys import platform
import matplotlib as mpl
if platform == "darwin": # OS X
mpl.use('TkAgg')
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches im... |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import os.path
import sys
def clean(rename=False):
# for file in os.listdir('.'):
for root, dirs, files in os.walk('.'):
for file in files:
fullfile = os.path.join(root, file)
if os.path.isfile(fullfile):
... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
import re
import itertools
from ansible.module_utils.netcli import CommandRunner
from ansible.module_utils.network import NetworkModule
import ansible.module_utils.dellos9
clas... |
''' Main Module holding all the documents '''
import copy
import os
import stat
import gtk
from Pyblio.GnomeUI import Document, Utils
from Pyblio import Base, Config
class Pybliographic:
''' Main class holding all the documents and performing
general tasks '''
def __init__ (self):
self.documents... |
from tzlocal import get_localzone
import OpenSSL
from ..helpers.colours import colourise
from ..helpers.sanitisers import sanitise
from .base import Renderer as BaseRenderer
class Renderer(BaseRenderer):
RENDERS = [BaseRenderer.TYPE_SSLCERT]
TIME_FORMAT = "%a %b %d %H:%M:%S %Z %Y"
def on_result(self, r... |
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 20 12:28:32 2015
@author: boland
"""
import sys
sys.path.append('/home/boland/Anaconda/lib/python2.7/site-packages')
import pickle
import numpy as np
import matplotlib.pyplot as plt
from scipy.cluster.vq import kmeans
import multiprocessing as mp
import pyproj
import os
... |
#!/usr/bin/python
# Sam Bingham - PantherROV IV
# top tcp/ip communication interface
# to rabbit microcontroller
import sys
import socket
from ctypes import *
#from ansi import *
from PyQt4 import QtCore
# motor pwm command buffer indexes
# global LV, RV, LH, RV
LV = 1
RV = 2
LH = 3
RH = 4
# rabbit microcontroller addr... |
#!/usr/bin/env python
# -*- coding: utf8 -*-
# *****************************************************************
# ** PTS -- Python Toolkit for working with SKIRT **
# ** © Astronomical Observatory, Ghent University **
# *****************************************************************
##... |
"""
CellProfiler is distributed under the GNU General Public License,
but this file is licensed under the more permissive BSD license.
See the accompanying file LICENSE for details.
Copyright (c) 2003-2009 Massachusetts Institute of Technology
Copyright (c) 2009-2015 Broad Institute
All rights reserved.
Please see th... |
import pickle
import unittest
from lsst.sphgeom import Box3d, CONTAINS, DISJOINT, Interval1d, Vector3d
class Box3dTestCase(unittest.TestCase):
def test_construction(self):
a = Box3d(Vector3d(0, 0, 0))
b = Box3d(a)
self.assertEqual(a, b)
self.assertNotEqual(id(a), id(b))
a... |
"""
GUI-specific interface functions for Mac OS X.
"""
__revision__ = "$Rev: 2466 $"
__date__ = "$Date: 2007-12-10 04:50:57 -0500 (Mon, 10 Dec 2007) $"
__author__ = "$Author: johann $"
import os
import time
import appscript
import MacOS
from shotfactory04 import gui as base
from shotfactory04.image import pdf
class... |
"""Logging framework
This module creates the cfme logger, for use throughout the project. This logger only captures log
messages explicitly sent to it, not logs emitted by other components (such as selenium). To capture
those, consider using the pytest-capturelog plugin.
Example Usage
^^^^^^^^^^^^^
.. code-block:: p... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'core'}
import collections
from ansible.module_utils.basic import AnsibleModule
from ansible.module_uti... |
from .. import Tables
__author__ = "Charles R Schmidt <<EMAIL>>"
__all__ = ['GeoDaTxtReader']
class GeoDaTxtReader(Tables.DataTable):
"""GeoDa Text File Export Format
"""
__doc__ = Tables.DataTable.__doc__
FORMATS = ['geoda_txt']
MODES = ['r']
def __init__(self, *args, **kwargs):
"""... |
from __future__ import unicode_literals
import warnings
from django.conf.urls import url, include
from django.core.exceptions import ImproperlyConfigured
from django.http import HttpResponse, HttpResponseBadRequest
from tastypie.compat import reverse
from tastypie.exceptions import NotRegistered, BadRequest
from tastyp... |
"""
This module provides a large set of colormaps, functions for
registering new colormaps and for getting a colormap by name
"""
import os
import numpy as np
from numpy import ma
import colors
from _cm import datad
cmap_d = dict()
# reverse all the colormaps.
# reversed colormaps have '_r' appended to the name.
... |
"""Online data normalization."""
import sonnet as snt
import tensorflow.compat.v1 as tf
class Normalizer(snt.AbstractModule):
"""Feature normalizer that accumulates statistics online."""
def __init__(self, size, max_accumulations=10**6, std_epsilon=1e-8,
name='Normalizer'):
super(Normalizer, ... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
""" Constans and enums.
Copyright (c) Karol Będkowski, 2013
This file is part of wxGTD
Licence: GPLv2+
"""
__author__ = "Karol Będkowski"
__copyright__ = "Copyright (c) Karol Będkowski, 2013"
__version__ = "2013-04-26"
import gettext
_ = gettext.gettext
ngettext = gettext... |
from random import choice
from helpers.command import Command
@Command('choose')
def cmd(send, msg, args):
"""Chooses between multiple choices.
Syntax: {command} <object> or <object> (or <object>...)
"""
if not msg:
send("Choose what?")
return
choices = msg.split(' or ')
action... |
from __future__ import absolute_import
from testutil.dott import feature, sh, testtmp # noqa: F401
sh % "hg init repo"
sh % "cd repo"
sh % "echo 'added file1'" > "file1"
sh % "echo 'another line of text'" >> "file1"
sh % "echo 'added file2'" > "file2"
sh % "hg add file1 file2"
sh % "hg commit -m 'added file1 and f... |
"""SCons.Tool.nasm
Tool-specific initialization for nasm, the famous Netwide Assembler.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001 - 2019 The SCons Foundation
#
# Permission is he... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
test_qgsrulebasedrenderer.py
---------------------
Date : September 2015
Copyright : (C) 2015 by Matthias Kuhn
Email : matthias at opengis dot ch
*******... |
import pokemon as PK
# Read in Pokemon file
def read_pokemon_from_file(filename):
pkList = []
try:
file_in = open(filename, 'r')
except IOError:
# File not found
return
for line in file_in:
if line == "\n":
continue
# ---------- Output format ------... |
from ft_cmd_get import CommandGet
from ft_cmd_put import CommandPut
from ft_cmd_shell import CommandShell
from ft_cmd_help import CommandHelp
from ft_cmd_ftpop import CommandFtpop
class CommandFactory:
__processor = None
def __init__(self, processor):
self.__processor = processor
def get... |
#!/usr/bin/env python
""" update local cfg
"""
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
from DIRAC.Core.Base import Script
Script.setUsageMessage('\n'.join([__doc__.split('\n')[1],
'Usage:',
... |
__author__ = 'Georgios Rizos (<EMAIL>)'
from dateutil import parser as duparser
import calendar
# import datetime
########################################################################################################################
# Reddit author features.
########################################################... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for the PAM config checks."""
from grr.lib import flags
from grr.lib import test_lib
from grr.lib.checks import checks_test_lib
from grr.parsers import linux_pam_parser
class PamConfigTests(checks_test_lib.HostCheckTest):
@classmethod
def setUpClass(cls):
... |
import logging
import typing
from datetime import datetime
import discord
from cogbot.types import ChannelId
log = logging.getLogger(__name__)
class CogBotServerState:
def __init__(self, bot, server: discord.Server, log_channel: ChannelId = None):
self.bot = bot
self.server: discord.Server = se... |
import os
from astropy import units as u
import numpy as np
import pytest
import tardis
from tardis.io.model_reader import (read_artis_density,
read_simple_ascii_abundances)
data_path = os.path.join(tardis.__path__[0], 'io', 'tests', 'data')
@pytest.fixture
def artis_density_fname():
return os.path.join(data_p... |
import re
import numpy as np
import pandas as pd
import requests
from collections import OrderedDict
import xml.etree.ElementTree as ET
from six import iteritems
from . loader_utils import (
guarded_conversion,
safe_int,
Mapping,
date_conversion,
source_to_records
)
def get_treasury_date(dstri... |
# -*- encoding: utf-8 -*-
# As code is written in the new_api structure, it should go in here and be removed from core.py
from openerp import models, fields, api, _
from openerp.exceptions import except_orm, AccessDenied
from openerp import sql_db, SUPERUSER_ID
SKIP_DATE = 'SKIP_DATE_RECORDING'
import logging
_log... |
"""Class to show and manipulate user fields in odf documents."""
import sys
import time
import zipfile
import xml.sax
import xml.sax.handler
import xml.sax.saxutils
from odf.namespaces import OFFICENS, TEXTNS
from cStringIO import StringIO
OUTENCODING = "utf-8"
# OpenDocument v.1.0 section 6.7.1
VALUE_TYPES = {
... |
"""
Support for the yandex speechkit tts service.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/tts/yandextts/
"""
import asyncio
import logging
import aiohttp
import async_timeout
import voluptuous as vol
from homeassistant.components.tts import CO... |
import os
import json
import logging
LOG = logging.getLogger(__name__)
class MockAWSClient(object):
def __init__(self, service_name, region_name, account_id):
self.service_name = service_name
self.region_name = region_name
self.account_id = account_id
def _get_stored_response(self, ... |
# Viper Port of MyToken
# THIS CONTRACT HAS NOT BEEN AUDITED!
# ERC20 details at:
# https://theethereum.wiki/w/index.php/ERC20_Token_Standard
# https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
# Events of the token.
Transfer: __log__({_from: indexed(address), _to: indexed(address), _value: num... |
from oslo_log import log as logging
from sqlalchemy import desc
from webob import exc
from murano.api.v1 import request_statistics
from murano.common.helpers import token_sanitizer
from murano.common.i18n import _LI
from murano.common import policy
from murano.common import utils
from murano.common import wsgi
from mu... |
from temboo.core.choreography import Choreography
from temboo.core.choreography import InputSet
from temboo.core.choreography import ResultSet
from temboo.core.choreography import ChoreographyExecution
import json
class GetHyphenation(Choreography):
def __init__(self, temboo_session):
"""
Create ... |
from setuptools import setup
version = '0.4.4.dev0'
long_description = '\n\n'.join([
open('README.rst').read(),
open('TODO.rst').read(),
open('CREDITS.rst').read(),
open('CHANGES.rst').read(),
])
install_requires = [
'Django',
'django-extensions',
'django-nose',
'lizard-ui >= 3.0'... |
#!/usr/bin/env python
"""
<Author>
Trishank Karthik Kuppusamy
"""
from pyasn1.type import univ, char, namedtype, namedval, tag, constraint, useful
from metadataverificationmodule import *
import metadata
def get_asn_signed(json_signed):
rootMetadata = RootMetadata()\
.subtype(implicitTag=tag.... |
# -*- coding: utf-8 -*-
'''
Flixnet Add-on
Copyright (C) 2016 Flixnet
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any... |
import aeidon
import codecs
from aeidon.i18n import _
from unittest.mock import patch
class TestModule(aeidon.TestCase):
def test_code_to_description(self):
code_to_description = aeidon.encodings.code_to_description
assert code_to_description("cp1006") == _("Urdu")
assert code_to_descr... |
import re
import os
class LexerError(Exception):
def __init__(self, msg):
self.msg = msg
def __str__(self):
return repr(self.msg)
class Id:
def __init__(self, name):
self.name = name
def __str__(self):
return self.name
class Array:
def __init__(self, data):
... |
import numpy as np
from sklearn.cluster import DBSCAN
from sklearn import metrics
# http://datasyndrome.com/post/69514893525/yelp-dataset-challenge-part-0-geographic
# Compute DBSCAN
def dbscan_cluster(data):
X = data
# X = StandardScaler().fit_transform(data)
db = DBSCAN(eps=0.3, min_samples=10).fit(X)
... |
from libqtile.extension.dmenu import Dmenu
class WindowList(Dmenu):
"""
Give vertical list of all open windows in dmenu. Switch to selected.
"""
defaults = [
("item_format", "{group}.{id}: {window}", "the format for the menu items"),
("all_groups", True, "If True, list windows from al... |
import logging
class Period:
def __init__(self, ticks_max):
self.ticks_max = ticks_max
self.ticks = []
def add_tick(self, tick):
self.ticks.append(tick)
self.ticks = self.ticks[-1 * self.ticks_max:]
def is_list(self):
# Get the latest tick.
latest = self.... |
import argparse
import requests
import csv
import json
from collections import defaultdict
parser = argparse.ArgumentParser()
parser.add_argument('media', choices=['audio'])
parser.add_argument('filename')
args = parser.parse_args()
def embed_code(url):
resp = requests.get("http://soundcloud.com/oembed", params=... |
### Author: Dag Wieers <<EMAIL>>
class dstat_plugin(dstat):
def __init__(self):
self.name = 'thermal'
self.type = 'd'
self.width = 3
self.scale = 20
if os.path.exists('/sys/bus/acpi/devices/LNXTHERM:01/thermal_zone/'):
self.vars = os.listdir('/sys/bus/acpi/devic... |
"""Support for BME280 temperature, humidity and pressure sensor."""
from datetime import timedelta
from functools import partial
import logging
from i2csense.bme280 import BME280 # pylint: disable=import-error
import smbus # pylint: disable=import-error
import voluptuous as vol
from homeassistant.components.sensor ... |
# Create your views here.
from django.contrib import auth
from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt
from django.utils import simplejson
from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response
from django.template import RequestContext
... |
from hbcal.my_collections import OrderedSet
class AmbiguousKeyError(KeyError):
"""An exception class raised by AbbrevSet if the supplied key could be
used to provide two or more possible values."""
pass
class AbbrevSet(OrderedSet):
"""This class provides a set with lookup by key. Only the
start ... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '/home/rlessard/packages/omtk/0.4.999/python/omtk/ui/widget_create_component.ui'
#
# by: pyside2-uic running on Qt 2.0.0~alpha0
#
# WARNING! All changes made in this file will be lost!
from Qt import QtCore, QtGui, QtWidgets, QtCompat
... |
import argparse
import os
import sys
import m5
import m5.util
from m5.objects import *
m5.util.addToPath("../../")
from common import SysPaths
from common import CpuConfig
import devices
from devices import AtomicCluster, KvmCluster
default_dtb = 'armv8_gem5_v1_big_little_2_2.dtb'
default_kernel = 'vmlinux4.3.aarc... |
"""Fetch web urls results from google."""
import csv
import datetime
import dateutil.parser
import io
import re
import subprocess
import time
from mediawords.util.log import create_logger
from mediawords.util.parse_json import encode_json, decode_json
import mediawords.util.url
from topics_base.posts import get_mock... |
import copy
def translateVistrail(_vistrail):
# FIXME should this be a deepcopy?
vistrail = copy.deepcopy(_vistrail)
for action in vistrail.db_get_actions():
# print 'translating action %s' % action.db_time
if action.db_what == 'addModule':
if action.db_datas[0].db_cache == 0:
... |
import re
import traceback
import sickbeard
import generic
from sickbeard.common import Quality
from sickbeard import logger
from sickbeard import tvcache
from sickbeard import show_name_helpers
from sickbeard.common import Overview
from sickbeard.exceptions import ex
from sickbeard import clients
from lib import req... |
# -*- coding: utf-8 -*-
## @package palette.core.hist_3d
#
# Implementation of 3D color histograms.
# @author tody
# @date 2015/08/28
import numpy as np
from palette.core.color_pixels import ColorPixels
from palette.core.hist_common import *
## Implementation of 3D color histograms.
class Hist3D:
... |
"""Graph base class"""
import os
path = os.path.abspath(__file__)
localpath = os.path.dirname(path)
import re
def prettify_keys(string):
"""Utility function used to clean keys with numerical values, so that
they can be ordered alphabetically the way they should be."""
r = re.compile("bandwidth_([0-9]{... |
import sys
sys.path.append("../../modules")
from mymath import *
from physics.body2d import body2d
from gameobject import *
from random import randint
import pygame.gfxdraw
import pygame
import math
from line import lineMaker
show_collisions = False
show_text = True
ball_group = pygame.sprite.Group()
active_group = ... |
#!/usr/bin/env python
'''monitor sensor consistancy'''
import time, math, mavutil
mpstate = None
class sensors_report(object):
def __init__(self):
self.last_report = 0
self.ok = True
self.value = 0
class sensors_state(object):
def __init__(self):
self.ground_alt = 0
s... |
"""Unbinned log-likelihood fit
fit a Gaussian signal on a flat background
compare results from binned and unbinned log-likelihood fits
"""
from kafe2 import Fit, Plot, HistContainer, UnbinnedContainer
import numpy as np
import matplotlib.pyplot as plt
def generate_data(N, min, max, pos, width, s):
"""ge... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.