src stringlengths 721 1.04M |
|---|
#!/usr/bin/env python
import logging
import sys
import curator
import elasticsearch
import certifi
HOSTS = ["{{ logstash_output_elasticsearch_hosts | join('\", \"') }}"]
USERNAME = '{{ logstash_output_elasticsearch_user }}'
PASSWORD = '{{ logstash_output_elasticsearch_password }}'
DELETE_OLDER_THAN = {{ logstash_rem... |
from ..ponyfiles.data_structures import *
from . import channel_amplitudes
#from
import traceback
from . import Rabi
from . import gauss_hd
from .. import pulses
def get_hadamard(device, qubit_id):
pi2 = get_excitation_pulse(device, qubit_id, np.pi / 2.)
channel_amplitudes_ = channel_amplitudes.channel_amplit... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... |
from __future__ import nested_scopes, generators, division, absolute_import, with_statement, print_function, unicode_literals
from .videoutils import *
def default_labeller(x):
try:
return int(x.split('_')[1].split('.')[0])
except:
try:
return int(basename(x).split('_')[1].split(... |
import logging
import asyncio
import server.db as db
from server.abc.base_game import InitMode
from server.players import Player
logger = logging.getLogger(__name__)
from .game import Game, ValidityState
import operator
import config
class LadderGame(Game):
"""Class for 1v1 ladder game"""
init_mode = Init... |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... |
import os
import ConfigParser
import glob
from prettytable import PrettyTable
import re
inputdir = "ini/N*s[2,3,4,5]*.ini"
inputdir = "ini/NSF*s1*.ini"
#inputdir = "ini/24NET-s1*.ini"
#inputdir = "ini/E*s1*.ini"
#inputdir = "ini/24NET-s*e90*.ini"
#inputdir = "ini/24NET-hs*e120*.ini"
def atoi(text):
retur... |
'''
Created on 8 Apr 2010
@author: tcezard
'''
from threading import Thread
import logging
from subprocess import Popen, PIPE
import os
###################################
# Command utilities #
###################################
class Output_Logger(Thread):
"""Close the stdin and log the s... |
# Django settings for weibome project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
import os
if 'SERVER_SOFTWARE' in os.environ:
from sae.const import (
MYSQL_HOST, MYSQL_PORT, MYSQL_USER, MYSQL_PASS, MYSQL_DB
)
else:
# Make ... |
"""
Django settings for app project.
Generated by 'django-admin startproject' using Django 1.8.
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 paths insi... |
# pylint: disable=C0111,R0903
"""
Displays the unread emails count for one or more Thunderbird inboxes
Parameters:
* thunderbird.home: Absolute path of your .thunderbird directory (e.g.: /home/pi/.thunderbird)
* thunderbird.inboxes: Comma separated values for all MSF inboxes and their parent directory (accoun... |
"""Support for Traccar device tracking."""
from datetime import datetime, timedelta
import logging
import voluptuous as vol
from homeassistant.components.device_tracker import PLATFORM_SCHEMA
from homeassistant.const import (
CONF_HOST, CONF_PORT, CONF_SSL, CONF_VERIFY_SSL,
CONF_PASSWORD, CONF_USERNAME, ATTR_... |
import os
from collections import OrderedDict
from .imports import *
from corpustools.phonoprob.phonotactic_probability import (phonotactic_probability,
phonotactic_probability_all_words)
from corpustools.neighdens.io import load_words_neighden
from corpustools.corpu... |
import web
import gradebook
import hashlib
import time
#
#Requires a DB with a table called 'States' with columns 'state' and 'page'
#Requires a DB with a tabe called 'Users' with columns 'username' and 'section'
def sha1digest(s):
salt = "boy this is salty frdew34567uhygfrer6uhgfrtyuhijhbgftrdfg"
ho = hashli... |
#
# Copyright 2016 Red Hat, Inc.
#
# 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 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in th... |
"""
Top level OpenShift 4 component
===============================
The :py:func:`conf` component recognizes insights-operator and must-gather
archives.
"""
import logging
import os
import yaml
from fnmatch import fnmatch
from insights.core.plugins import component, datasource
from insights.core.context import Insight... |
import json
import os
from hashlib import sha1
from flask import request, jsonify, current_app
from flask.ext.restful import Resource
import time
from werkzeug.utils import secure_filename
import traceback
from audio import play_file
from provider.provider import Provider
from provider.task import TaskState
from util... |
from django.core.urlresolvers import reverse_lazy
from django.test import TestCase
from timepiece.tests import factories
from timepiece.tests.base import ViewTestMixin
from ..models import Project
class TestCreateProject(ViewTestMixin, TestCase):
url_name = 'create_project'
template_name = 'timepiece/projec... |
#!/usr/bin/env python
import os
import yaml
AUTH_URL = os.environ['auth_url']
ADMIN_PASSWORD = os.environ['admin_password']
CLOUD_NAME = os.environ['cloud_name']
HOME_DIR = os.environ['home_dir']
IDENTITY_API_VERSION = os.environ['identity_api_version']
PROJECT_NAME = os.environ['project_name']
PROJECT_DOMAIN_NAME = ... |
import os
import posixpath
import mimetypes
from datetime import datetime
from gzip import GzipFile
from tempfile import SpooledTemporaryFile
from django.core.files.base import File
from django.core.files.storage import Storage
from django.core.exceptions import ImproperlyConfigured, SuspiciousOperation
from django.ut... |
#!/usr/bin/env python3
"""
FILE: lowering_directory.py
DESCRIPTION: Gearman worker the handles the tasks of creating a new lowering
data directory and updating the lowering directory structure when additional
subdirectories must be added.
BUGS:
NOTES:
AUTHOR: Webb Pinner
COMPANY: Capable Solutions
... |
#!/usr/bin/env python
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
#
# This file is part of the E-Cell System
#
# Copyright (C) 1996-2016 Keio University
# Copyright (C) 2008-2016 RIKEN
# Copyright (C) 2005-2009 The Molecular Sciences Institute
#
#:::::::::::::::::... |
# Copyright (C) 2010-2011 Mathijs de Bruin <mathijs@mathijsfietst.nl>
#
# This file is part of django-shopkit.
#
# django-shopkit is free software; you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 2, or (at... |
"""
ManyMan - A Many-core Visualization and Management System
Copyright (C) 2012
University of Amsterdam - Computer Systems Architecture
Jimi van der Woning and Roy Bakker
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
t... |
from PyObjCTools.TestSupport import *
from Quartz.CoreGraphics import *
try:
long
except NameError:
long = int
class TestCGDirectPalette (TestCase):
def testStructs(self):
v = CGDeviceByteColor()
self.assertTrue(hasattr(v, 'red'))
self.assertTrue(hasattr(v, 'green'))
self.... |
import os, logging, md5, jinja2
import wsgiref.handlers
from google.appengine.ext import webapp
from google.appengine.ext.webapp import template
from google.appengine.api import datastore
from google.appengine.ext import db
from google.appengine.api import users
from models import Company
from google.appengine.api impo... |
#!/usr/bin/env python
import os
import sys
import django
from django.conf import settings
DEFAULT_SETTINGS = dict(
INSTALLED_APPS=[
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sites",
"pinax.ratings",
"pinax.ratings.tests"
],
MIDDLEWARE_C... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Learn sentiment-specific word embeddings from tweets.
Author: Giuseppe Attardi
"""
import logging
import numpy as np
import argparse
from ConfigParser import ConfigParser
from itertools import chain
# allow executing from anywhere without installing the package
impo... |
#------------------------------------------------------------------------------
# cli_parser.py
#------------------------------------------------------------------------------
'''
@author : rgiyer
Date : October 20th, 2014
This module is responsible for parsing command model defined in
cl... |
import os
import vgg_preprocessing
import tensorflow as tf
_DEFAULT_IMAGE_SIZE = 224
_NUM_CHANNELS = 3
_LABEL_CLASSES = 1001
_FILE_SHUFFLE_BUFFER = 1024
_SHUFFLE_BUFFER = 1500
class ImagenetDataSet(object):
"""Imagenet data set
"""
def __init__(self, data_dir, subset='train', use_distortion=True):
self.d... |
"""
This script reads in BVJHK photometry from Kharchenko et al 2009,
and measured E(B-V) from my spectra. It then prepares the
Chorizos input file
"""
import os
class StarInfo:
def __init__(self):
self.name = "" # Star designation
self.EBV = 0.0 # E(B-V)
self.B = 0.0 # B mag
... |
# githook.py
"""Small library to handle interaction with Git for notification scripts.
"""
from datetime import datetime
import re
import subprocess
_EMAIL_RE = re.compile("^(.*) <(.*)>$")
def parse_input(f):
"""Parse the hook input data from Git.
"""
data = []
for line in f.readlines():
old, new,... |
# PyMaster
# Copyright (C) 2014, 2015 FreedomOfRestriction <FreedomOfRestriction@openmailbox.org>
#
# 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... |
#!/usr/bin/env python
################################################################################
# GIPS: Geospatial Image Processing System
#
# AUTHOR: Matthew Hanson
# EMAIL: matt.a.hanson@gmail.com
#
# Copyright (C) 2014-2018 Applied Geosolutions
#
# This program is free software; you can redist... |
import socket
from datetime import timedelta
from celery.decorators import task, periodic_task
from celery.utils.log import get_task_logger
from django.utils import timezone
from beetle.models import VirtualDevice, PrincipalGroup
from network.models import ConnectedGateway, ConnectedDevice, DeviceMapping, \
Service... |
# Copyright (C) 2008, OLPC
#
# 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 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope... |
from api.subtitle.model import to_model, Media, Subtitle
def test_subtitle_equality():
assert Subtitle('S1', None, 'srt', 1, 'enc', False) == \
Subtitle('S1', None, 'srt', 1, 'enc', False)
assert Subtitle('S2', None, 'srt', 1, 'enc', False) != \
Subtitle('S1', None, 'srt', 1, 'enc', False)
d... |
from flask import Flask, request, g
import os
from flask.ext.sqlalchemy import SQLAlchemy
from python_logging.setup_logging import setup_logging
from .republish_all import RepublishTitles
from kombu import Connection, Producer, Exchange, Queue, Consumer
setup_logging()
app = Flask(__name__)
db = SQLAlchemy(app)
app.c... |
import numpy as np
from numpy.random import rand, binomial
class simple_matching(object):
"""
Implements a simple dynamic matching environment,
where arrivals and departures are generated stochastically.
"""
def __init__(self,
types,
weight_matrix,
ar... |
import os
import logging
from py2030.base_component import BaseComponent
class OsxOscVideoResumer(BaseComponent):
config_name = 'osx_osc_video_resumers'
def __init__(self, options = {}):
self.options = options
self.resume_on = options['resume_on'] if 'resume_on' in self.options else []
... |
# encoding: utf-8
# module PyQt4.QtNetwork
# from /usr/lib/python3/dist-packages/PyQt4/QtNetwork.cpython-34m-x86_64-linux-gnu.so
# by generator 1.135
# no doc
# imports
import PyQt4.QtCore as __PyQt4_QtCore
class QHttpMultiPart(__PyQt4_QtCore.QObject):
"""
QHttpMultiPart(QObject parent=None)
QHttpMultiPa... |
import datetime
import random
import types
from django.template.loader import render_to_string
from django.test import TestCase
from mock import patch, MagicMock
from atx_restaurant_ratings import scraper
def random_date():
now = datetime.date.today()
r = random.randint(-1000, 1000)
return (now - dateti... |
#!/usr/bin/env python
#Version 5.5
"""
Created on Sun Jan 16 2017
@author: Laurent
"""
import sys
sys.path.append('/var/www/html/modules/libraries')
from astral import *
from time import gmtime,strftime
import datetime
import paho.mqtt.client as mqtt
import os
import time
import string
import smtplib
import mysql.con... |
import os
import stat
from django.core.management import BaseCommand
COMMIT_MSG_HOOK = """
# BEGIN ZERODOWNTIME_COMMIT_MSG_HOOK
commit_regex='(\[allow\-unsafe\-migrations]|merge)'
if ! grep -iqE "$commit_regex" "$1"; then
source ./venv/bin/activate
./manage.py check_migrations
migration_check=$?
if... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from datetime import datetime
from flask_security import current_user
from flask_restplus.inputs import boolean
from udata.auth import admin_permission
from udata.api import api, API, fields
from udata.core.user.api_fields import user_ref_fields
from .... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2014 - 2019 Adam.Dybbroe
# Author(s):
# Adam.Dybbroe <a000680@c14526.ad.smhi.se>
# 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... |
from django.utils.translation import gettext_lazy as _
MEDIA = (("Ethernet", _("Ethernet")), ("ATM", _("ATM")), ("Multiple", _("Multiple")))
POC_ROLES = (
("Abuse", _("Abuse")),
("Maintenance", _("Maintenance")),
("Policy", _("Policy")),
("Technical", _("Technical")),
("NOC", _("NOC")),
("Publ... |
import pytest
from agilentpyvisa.B1500 import *
import agilentpyvisa
import visa
import ipdb
import types
#import logging
#logging.basicConfig(level=logging.INFO)
class DummyTester():
def __init__(self, *args,**kwargs):
pass
def query(*args, **kwargs):
print(*[x for x in args if isinstance(x... |
import json
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_noop
from corehq.apps.fixtures.models import FixtureDataType, FixtureDataItem
from corehq.apps.locations.util import load_locs_json, location_hierarchy_config
from corehq.apps.reports.filters.base import BaseReportFil... |
########################################################################
# File name: test_stringprep.py
# This file is part of: aiosasl
#
# LICENSE
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software ... |
def generate_prolog(x, name, file):
header = '''\
:- initialization main.
:- use_module(pythonTypeSystem).
:- use_module(prettyTypes).
'''
fun = generate_fun(x, name)
m = '''main :-
open('%s.txt', write, Stream),
(
f(%s, Z0, Z1),
unvar(Z0, Z1, Z2, Z3, Z4), %% replace free vars wit... |
"""Implements a logging formatter which produces colorized output, suitable
for use on an ANSI console.
"""
import logging
import time
# Attributes
# 0 Reset all attributes
# 1 Bright
# 2 Dim
# 4 Underscore
# 5 Blink
# 7 Reverse
# 8 Hidden
LT_BLACK = "\x1b[1;30m"
LT_RED = "\x1b[1;31m"
LT_GREEN = "\x1b[1;32m"
LT_YEL... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
from collections import deque,defaultdict
class Phrase_Table:
# TODO: unit names should actually be objects with sub-fields
def __init__(self, lines, unit_names):
self.phrase_table = self.build_phrase_table(lines, unit_names)
# store the ... |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... |
# This file is part of Buildbot. Buildbot 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, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... |
#!/usr/bin/python
#------------------------------------------------------------------------
# Copyright (c) 1998 by Total Control Software
# All Rights Reserved
#------------------------------------------------------------------------
#
# Module Name: fcgi.py
#
# Descripti... |
from .algorithm import CosineSimilarity
from apps.data.songs.models import Song, SongSimilarity
from apps.similarities.Cosine.benchmark.models import BenchCosine_SongTitle
from django.db import transaction
from django.utils import timezone
from multiprocessing.dummy import Pool as ThreadPool
from apps.CONSTANTS import ... |
#!/usr/local/bin/python3
"""
Copyright (c) 2015-2019 Ad Schellevis <ad@opnsense.org>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain th... |
'''
Created on Jun 25, 2012
@author: Peyman Kazemian
'''
from headerspace.hs import headerspace
from net_plumbing.net_plumber_nodes import RuleNode, SourceNode, SinkNode,\
ProbeNode,SourceReachabilityProbeNode
from net_plumbing.net_plumber_process import *
from multiprocessing import cpu_count, Event, JoinableQueue as... |
from oldowan.mtconvert import seq2sites, sites2seq, str2sites
from string import translate
import pandas as pd
import numpy as np
import sys
sys.path.append('../../scripts')
from utils import *
## load metadata
metadata = pd.read_csv('metadata.csv', index_col=0)
region = range2region(metadata.ix[0,'SeqRange'])
with ... |
source("../../shared/qtcreator.py")
source("../../shared/suites_qtta.py")
# entry of test
def main():
# expected error texts - for different compilers
expectedErrorAlternatives = ["'SyntaxError' was not declared in this scope",
"'SyntaxError' : undeclared identifier"]
start... |
# Copyright 2014 Hewlett-Packard Development Company, L.P.
# All Rights Reserved.
#
# 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... |
# -*- encoding: utf-8 -*-
################################################################################
# #
# Copyright (C) 2013-Today Carlos Eduardo Vercelino - CLVsol #
# ... |
def validate_RT_RL_CRT(in_data, ranges, fileName):
"""
Validates the values of curve fit parameters
Args:
in_data(list): calculated values of curve fit parameters
ranges(list of list): expected values of curve fit parameters
fileName(str): fileName
Returns:
null
... |
# -*- coding: utf-8 -*-
import datetime
from PyQt4.QtSql import QSqlQuery, QSqlQueryModel
from PyQt4.QtGui import QMessageBox, QLineEdit, QComboBox
from PyQt4.QtCore import Qt, QDate
from qgis.core import QgsMapLayerRegistry
from ..generic_functions import SwitchStreetBrowserMode, ZoomSelectCanvas, ipdb_breakpoint
f... |
#!/usr/bin/env python
import pygame
from pygame.locals import *
import random
class Wandering_text:
def __init__(self, text, color, center, bbox):
self.font = pygame.font.Font(None, 36)
self.surface = self.font.render(text, 1, color)
self.pos = self.surface.get_rect(center=center)
... |
#!/usr/bin/env python
from gi.repository import Gtk, Gdk
import pairdefs
class Picker:
'''RandomSK UI and related functions.'''
def pick_rand(self, widget=None, data=None):
'''Pick a random sequence from our current pairdict and set output text.'''
self.disp.set_text(self.pairdict.pick())
... |
from dojme import app
from flask import render_template, request, redirect
from urlparse import urlparse
import httplib2
import re
def status_check(url):
"""
Get the headers of a web resource to check if it exists
"""
h = httplib2.Http()
try:
resp = h.request(url, 'HEAD')
if resp[0... |
#-----------------------------------------------------------------------------
# Copyright 2013 Ra-el Peters
#-----------------------------------------------------------------------------
# This file is part of pythonGameOfLife.
#
# pythonGameOfLife is free software: you can redistribute it and/or modify
# it ... |
import os
import sys
from pycli_tools import rawinput
def test_default_yes_yes():
def raw_input_mock(prompt):
return 'y'
rawinput.raw_input = raw_input_mock
assert True == rawinput.ask_user_yesno()
def test_default_yes_no():
def raw_input_mock(prompt):
return 'n'
rawinput.raw_i... |
# Disco-cake
# Copyright (C) 2017 Maugere Lucas
# 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 later version.
# This program is dist... |
# Copyright 2014 Intel Corporation
# All Rights Reserved.
#
# 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 require... |
#!/usr/bin/python
import sys
pairs = []
for line in sys.stdin:
pairs.extend(line.strip().split())
pairs = zip(pairs[::2], pairs[1::2])
fixed = {
'ERROR_ACCESS_DENIED': 'STATUS_ACCESS_DENIED',
'ERROR_CANNOT_IMPERSONATE': 'STATUS_CANNOT_IMPERSONATE',
'ERROR_CONNECTION_ABORTED': 'STATUS_CONNECTION_ABORT... |
# GemRB - Infinity Engine Emulator
# Copyright (C) 2003 The GemRB Project
#
# 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 2
# of the License, or (at your option) any later versi... |
'''
Created on Mar 13, 2014
@author: leal
'''
import config.config
import logging
from data.messages import Messages
import simplejson
from config.config import configParser
import ast
logger = logging.getLogger(__name__)
class MethodsHandler(object):
'''
classdocs
'''
def __init__(self):
... |
import unittest
import requests.exceptions
import responses
from seaworthy.checks import docker_client, dockertest
from seaworthy.client import ContainerHttpClient, wait_for_response
from seaworthy.definitions import ContainerDefinition
from seaworthy.helpers import DockerHelper, fetch_images
# Small (<4MB) image ... |
# -*- coding: utf-8 -*-
# This file is part of Viper - https://github.com/viper-framework/viper
# See the file 'LICENSE' for copying permission.
import hashlib
import zipfile
from viper.common.abstracts import Module
from viper.core.session import __sessions__
class Jar(Module):
cmd = 'jar'
description = 'P... |
# -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding:utf-8 -*-
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 fileencoding=utf-8
#
# MDAnalysis --- http://www.mdanalysis.org
# Copyright (c) 2006-2016 The MDAnalysis Development Team and contributors
# (see the file AUTHORS for the full list of names)
#
... |
# -*- coding: utf-8 -*-
#
# thrush documentation build configuration file, created by
# sphinx-quickstart on Sun May 5 16:31:03 2013.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All ... |
import lib.puylogger
# def init():
# global last_value
# last_value = {}
# return last_value
last_value = {}
class ValueRate(object):
metrics_value_rate = 0
def __init__(self):
self.metrics_value_rate = 0
def record_value_rate(self, mytype, myvalue, timestamp):
if mytype not... |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# 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 later version.
#
# This program is distrib... |
#!/usr/bin/python
from __future__ import print_function
import argparse
import gzip
import os
import radix
import re
import sys
from bz2 import BZ2File
from datetime import datetime, timedelta
from multiprocessing import Process, Queue, cpu_count
from netaddr import IPSet
# own imports
import mrtx
verbose = False
... |
import sys
sys.path.append('..')
from src.sim import Sim
from src.node import Node
from src.link import Link
from src.transport import Transport
from src.tcp import TCP
from networks.network import Network
import optparse
import os
import subprocess
class AppHandler(object):
def __init__(self,filename):
... |
#!/usr/bin/env python
import os, time
import numpy as np
import matplotlib.pyplot as plt
import scipy.signal
results_directory = os.getenv('HOME') + "/rfi_capture_results/"
SAMPLE_FREQUENCY = 3600.0 # MHz and us
ADC_SCALE_VALUE = 707.94
# algorithm:
# open a .npy file (or do the disk buffer thing)
filename = raw_in... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
PIR scanner
dependencies: operator, logbook
(python3 compatible)
"""
from time import sleep
import logging
import logging.handlers
import configparser
import requests
import re
import sys
import socket
import time
import serial
"""
notes
=====
When pluggin the USB d... |
# coding: utf-8
import pymongo
import pandas as pd
import datetime
try:
from .newbar import NewMinuteBar, NewDayBar
except SystemError:
pass
class LoadBase(object):
"""
导入期货历史数据
"""
def __init__(self, path, symbol):
"""
:param path: 数据路径
:param contract: 合约名
... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
import csv
from io import StringIO
from itertools import count
import sys
try:
# Python 2
from itertools import izip_longest
except ImportError:
# Python 3
from itertools import zip_longest as izip_longest
def csvpp(csv_input):
max_widths = []
ma... |
# (C) British Crown Copyright 2013 - 2019, Met Office
#
# This file is part of cartopy.
#
# cartopy is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation, either version 3 of the License, or
# (at your option)... |
"""
mbed CMSIS-DAP debugger
Copyright (c) 2006-2015 ARM Limited
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable ... |
import unittest
from PyQt4.QtCore import QSettings
from opengeo.gui.explorer import OpenGeoExplorer
from opengeo.test import utils
from opengeo.gui.gsexploreritems import GsCatalogItem
from opengeo.gui.pgexploreritems import PgConnectionItem
class ExplorerIntegrationTest(unittest.TestCase):
@classmethod
def... |
from unittest.mock import patch
from unittest import TestCase
from nose.tools import assert_list_equal
from pgpbuddy.crypto import *
from tests.mock_gpg import *
class TestCheckEncryptionAndSignature(TestCase):
@patch('gnupg.GPG', decrypt=mock_decrypt(Encryption.missing, Signature.missing))
def test_plain... |
#!/usr/bin/env python3
"""Centralised validation function for all parsers."""
from logging import getLogger
def has_value_for_key(datapoint, key, logger):
"""checks that the key exists in datapoint and that the corresponding value
is not None"""
if datapoint['production'].get(key, None) is None:
... |
# -*- coding: utf-8 -*-
# <nbformat>3.0</nbformat>
# <codecell>
a='51.01 633.55 Td\n'
b='(LICZBA UPRAWNIONYCH) Tj\n'
re.compile(r'() () Td\\n')
m = re.match(r'(?P<x>[\d\.]+) (?P<y>[\d\.]+) Td\n', a)
print(m.groupdict())
t = re.match(r'\((?P<t>.*)\) Tj\n', b)
print(t.groupdict())
# <codecell>
import json
import re
... |
from unittest import skipUnless
from django.db import IntegrityError
from django.db import connection
from django.test import TestCase, TransactionTestCase
from versions.util.postgresql import get_uuid_like_indexes_on_table
from versions_tests.models import ChainStore, Color
@skipUnless(connection.vendor == 'postgr... |
import os
import sys
import fcntl
import ssl
from SocketServer import UnixStreamServer, TCPServer
from SimpleXMLRPCServer import (SimpleXMLRPCServer, SimpleXMLRPCDispatcher,
SimpleXMLRPCRequestHandler)
import urllib
class UnixStreamSimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler)... |
# MIT License
#
# Copyright (c) 2016 Daily Actie
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, ... |
#!/usr/bin/env python
import sqlite3 as lite
import sys
import hashlib
from itertools import product
from string import *
# The purpose of the script is to use multiple convinations of values to generate hashes and find one in the db
# It is believed that cyrpto function was something like: CommonHash($salt,$pass)
# ... |
from __future__ import with_statement
from couchpotato.api import addApiView
from couchpotato.core.event import addEvent, fireEvent
from couchpotato.core.helpers.encoding import isInt, toUnicode
from couchpotato.core.helpers.request import getParams, jsonified
from couchpotato.core.helpers.variable import mergeDicts, t... |
import logging
from .base import AbstractProducerNode
from datetime import timedelta
from ebu_tt_live.bindings import div_type, br_type, p_type, style_type, styling, layout, region_type, span_type
from ebu_tt_live.bindings._ebuttdt import LimitedClockTimingType
from ebu_tt_live.documents.ebutt3 import EBUTT3Document
fr... |
#!/usr/bin/env pythonw
# -*- coding: UTF-8 -*-
#
# untitled
#
# Created by Giovanni Porcari on 2007-03-24.
# Copyright (c) 2007 Softwell. All rights reserved.
#
""" RSS READER """
from gnr.core.gnrbag import Bag
class GnrCustomWebPage(object):
maintable = 'rss.feed'
css_requires = 'rssreader'
py_requir... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.