src stringlengths 721 1.04M |
|---|
#!/usr/bin/python
import os
import sys
import time
import select
import socket
import hashlib
import requests
import resolver
import tempfile
CONSUL = os.environ.get("consul", "127.0.0.1")
HAPROXY_CFG = "/tmp/haproxy.cfg"
HAPROXY_PID = "/tmp/haproxy.pid"
def haproxy_cfg ():
cfg = """
global
user haproxy
... |
# -*- coding: utf-8 -*-
'''Public section, including homepage and signup.'''
from flask import (Blueprint, request, render_template, flash, url_for,
redirect, session, make_response, jsonify, current_app)
from flask.ext.login import login_user, login_required, logout_user
from fantacalcio.extensions... |
import os.path
from xml.dom.minidom import parse
home_dir = os.path.dirname(os.path.dirname(__file__)) #elearning/
html_path = os.path.join(home_dir,'toc.html') #elearning/toc.html
tocs_root_rel_path = 'sidebars'
tocs_path = os.path.join(home_dir,tocs_root_rel_path) #elearning/tocs partial tocs home
class_name = 'nav_... |
# From tutorialspoint.com about Python Multithreaded Programming
# https://www.tutorialspoint.com/python/python_multithreading.htm
# !/usr/bin/python
import Queue
import threading
import time
exitFlag = 0
class myThread (threading.Thread):
def __init__(self, threadID, name, q):
threading.Thread.__init_... |
#-------------------------------------
# OGN-Flight-Logger Settings
#-------------------------------------
# Python APRS/OGN program to log flight times, durations, maximum heights achieved and tracks
#
# This python program creates an SQlite db of flights from a given location and aircraft list
# (the later two para... |
import logging
import os
import time
import simplejson as json
import boto3
import click
import click_log
from tabulate import tabulate
from swag_client.backend import SWAGManager
from swag_client.__about__ import __version__
from swag_client.migrations import run_migration
from swag_client.util import parse_swag_con... |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
from FlightGear import FlightGear
import time
def main():
fg = FlightGear('localhost', 5500)
# Wait five seconds for simulator to settle down
while 1:
if fg['/sim/time/elapsed-sec'] > 5:
break
time.sleep(1.0)
print(fg['/s... |
"""engine.SCons.Platform.hpux
Platform-specific initialization for HP-UX systems.
There normally shouldn't be any need to import this module directly. It
will usually be imported through the generic SCons.Platform.Platform()
selection method.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 200... |
"""Report any climodat sites without recent observations."""
# stdlib
import datetime
# Third Party
from pandas.io.sql import read_sql
from pyiem.util import get_dbconn, logger
LOG = logger()
FLOOR = datetime.date.today() - datetime.timedelta(days=365)
def remove_track(iemid):
"""Cull the defunct tracks."""
... |
# This file is part of Checkbox.
#
# Copyright 2012 Canonical Ltd.
# Written by:
# Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
#
# Checkbox 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 versio... |
"""Tests for options manager for :class:`Poly` and public API functions."""
import pytest
from diofant import (CC, EX, FF, GF, QQ, RR, ZZ, ComplexField, GeneratorsError,
I, Integer, OptionError, Options, RealField, Symbol, lex,
sqrt)
from diofant.abc import x, y, z
from diofa... |
from __future__ import absolute_import
import pytz
from six.moves.urllib.parse import urlencode
from mock import patch
from django.db.models import F
from sentry.models import Project
from sentry.testutils import AcceptanceTestCase, SnubaTestCase
from sentry.testutils.helpers.datetime import before_now, iso_format
f... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.contrib.gis.db.models.fields
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Parcel',
fields=[
... |
"""
File: DaqDevDiscovery01.py
Library Call Demonstrated: mcculw.ul.get_daq_device_inventory()
mcculw.ul.create_daq_device()
mcculw.ul.release_daq_device()
Purpose: Discovers DAQ devices and assigns board number to
... |
# Copyright 2014-2016 Insight Software Consortium.
# Copyright 2004-2008 Roman Yakovenko.
# Distributed under the Boost Software License, Version 1.0.
# See http://www.boost.org/LICENSE_1_0.txt
import warnings
from . import scanner
# keep py2exe happy
import xml.etree.ElementTree
import xml.etree.cElement... |
import unittest
class MetaTestCase(type):
def __init__(cls, name, bases, classdict):
super(MetaTestCase, cls).__init__(name, bases, classdict)
cls._auto_create_methods(bases)
class ObjectSchema(object):
def __init__(self, *args, **kwargs):
self.fields = args
self.nested_sch... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2017 Felipe Gallego. All rights reserved.
#
# This 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 ... |
"""LICENSE
Copyright 2015 Hermann Krumrey <hermann@krumreyh.com>
This file is part of kudubot.
kudubot 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 lat... |
#########################################################################################################
# AVRRead #
# A utility to read the XML files (probably .atdf in fact) in a Studio 6/7 installation and use #
# ... |
# -*- coding: utf-8 -*-
import inspect
import os
try:
from collections.abc import MutableMapping
except ImportError:
from collections import MutableMapping
NO_DEFAULT = object()
# must not inherit from AttributeError, so not to mess with python's attribute-lookup flow
class EnvironmentVariableError(KeyErro... |
# vim: tabstop=8 shiftwidth=4 softtabstop=4 expandtab smarttab autoindent
# Altai API Service
# Copyright (C) 2012-2013 Grid Dynamics Consulting Services, Inc
# All Rights Reserved
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License ... |
import atexit
import functools
import os
import sys
from taichi.core.util import ti_core as _ti_core
import taichi as ti
try:
import sourceinspect as oinspect
except ImportError:
ti.warn('`sourceinspect` not installed!')
ti.warn(
'Without this package Taichi may not function well in Python IDLE i... |
from parsimonious import NodeVisitor, Grammar
from ravel import grammars
from ravel import types
class BaseParser(NodeVisitor):
def reduce_children(self, children):
children = [c for c in children if c is not None]
if children:
return children if len(children) > 1 else children[0]
... |
#!/usr/bin/env python
class A3MFormatError(Exception):
def __init__(self, value):
self.value = "ERROR: "+value
def __str__(self):
return repr(self.value)
class A3M_Container:
RESIDUES = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
VALID_MATCH_STATES = set(RESIDUES)
VALID_INSERTION_STATES = set(... |
# WPA2-Enterprise PMKSA caching tests
# Copyright (c) 2013-2014, Jouni Malinen <j@w1.fi>
#
# This software may be distributed under the terms of the BSD license.
# See README for more details.
import logging
logger = logging.getLogger()
import subprocess
import time
import hostapd
from wpasupplicant import WpaSupplic... |
# -*- coding: utf-8 -*-
from operator import attrgetter
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType
from pyangbind.lib.yangtypes import RestrictedClassType
from pyangbind.lib.yangtypes import TypedListType
from pyangbind.lib.yangtypes import YANGBool
from pyangbind.lib.yangtypes import YANGListTy... |
#- Sphinx build configuration file
#- conf.py ~~
#
# This file was originally generated by `sphinx-quickstart`, but it wasn't
# especially readable (because I'm a picky jerkface). It's important to note
# the following:
#
# - This file is execfile()d with the current directory set to its
# containing... |
"""
Contains classes corresponding to the Maya type hierarchy, including `DependNode`, `Transform`, `Mesh`, and `Camera`.
"""
import sys, os, re
import inspect, itertools, math
import pymel.util as _util
import pymel.internal.pmcmds as cmds #@UnresolvedImport
import pymel.internal.factories as _factories
import pymel.... |
import logging
import os
import tempfile
import shutil
from PyPDF2 import PdfFileWriter, PdfFileReader
logger=logging.getLogger("pdfedit")
def AddPdfKeys(pdf_file, keydict):
"""
Add a dictionary of key-value pairs to a pdf file.
Adds metadata to PDF files so you know what generated them.
"""
multi... |
"""New revision
Revision ID: 5b8d8ca36aeb
Revises: 5d164bbb4813
Create Date: 2021-06-14 13:57:26.772630
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '5b8d8ca36aeb'
down_revision = '5d164bbb4813'
branch_labels = None
depends_on = None
def upgrade():
con... |
#!/usr/bin/env python3
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
class ScrolledWindow(Gtk.Window):
def __init__(self):
Gtk.Window.__init__(self)
self.set_title("ScrolledWindow")
self.set_default_size(200, 200)
self.connect("destroy", Gtk.main_quit)
... |
# -*- coding: utf-8 -*-
"""
Helper functions used in views.
"""
from json import dumps
from functools import wraps
from flask import Response
def jsonify(function):
"""
Creates a response with the JSON representation of wrapped function result.
"""
@wraps(function)
def inner(*args,... |
#!/usr/bin/python3
#import time # time.sleep(5.5)
import http.client
from socket import error as socket_error
import time
logCtrlFile = '/tmp/kotelnik.log'
logTempFile = '/tmp/kotelnikTemps.log'
class connectionError(RuntimeError):
def __init__(self, arg):
self.args = arg
class sensorError(RuntimeError):
def __i... |
#!/usr/bin/env python
#
# This code was copied from the data generation program of Tencent Alchemy
# project (https://github.com/tencent-alchemy).
#
#
# #
# # Copyright 2019 Tencent America LLC. All Rights Reserved.
# #
# # Licensed under the Apache License, Version 2.0 (the "License");
# # you may not use this file e... |
#
# Project:
# glideinWMS
#
# File Version:
#
# Description:
# This module implements classes to query the condor daemons
# and manipulate the results
# Please notice that it also converts \" into "
#
# Author:
# Igor Sfiligoi (Aug 30th 2006)
#
import condorExe
import condorSecurity
import os
import string
... |
# Copyright 2004-2012 Tom Rothamel <pytom@bishoujo.us>
#
# 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, m... |
#-------------------------------------------------------------------------------
# Name: plugin.video.miratuserietv
# Purpose: Plugin para Kodi/XBMC para ver las series del canal miratuserie.tv
#
# Author: roque.pulido@outlook.com
#
# Created: 07/11/2014
# Copyright: (c) roque.pulido 2014
# Licence: ... |
#!/usr/bin/env python
# coding: utf-8
import os, signal, socket, sys, unittest
sys.path.insert(0, '.')
import pinktrace
import pinktrace.event
import pinktrace.socket
import pinktrace.syscall
import pinktrace.trace
UNAME = os.uname()
class TestSocket_01_Invalid(unittest.TestCase):
def test_01_name(self):
... |
# -*- encoding: utf-8 -*-
"""Test class for Content Credentials UI
:Requirement: ContentCredentials
:CaseAutomation: Automated
:CaseLevel: Component
:CaseComponent: GPGKeys
:TestType: Functional
:CaseImportance: High
:Upstream: No
"""
from nailgun import entities
from robottelo.constants import CONTENT_CREDENTI... |
# -*- coding: utf-8 -*-
import os, time
import json
import ssl
import xbmc
import xbmcaddon
import xbmcvfs
try:
from urllib.parse import quote, unquote
import urllib.request
python="3"
except ImportError:
from urllib import quote, unquote
import urllib2
python="2"
addon = xbmcaddon.Addon()
ena... |
'''This actually runs everything'''
import sys, os, time
sys.path.append(os.getcwd()+'/Resources')
import ForumsToCheck, scraper, config, log_it
import necroDetector, profanityDetector, capsDetector, annoyanceAlerts
from multiprocessing import Process
def init(queue):
global q
q = queue
def main():
'''()... |
#!/usr/bin/python3
"""
Usage: transfer ( -l | -p | -u <file> | -d | -h)
Options:
-h Help.
-d Download file into your local folder
-l List files that have been uploaded to transfer.sh
-p Purge the files from list that have Expired
-u <file> Upload a fi... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
from umibukela.models import Programme, Funder
def noop(apps, schema_editor):
pass
def create_funders(apps, schema_editor):
mavc = Funder(name="MAVC")
mavc.save()
sash_funder = Funder(name="Brot fur die... |
# coding: utf-8
from django.contrib import admin
from protocolle.core.models import (TipoDocumento, Carater, Natureza,
Status, TipoInstituicao, Grupo)
class TipoDocumentoAdmin(admin.ModelAdmin):
fields = ['nome']
list_per_page = 15
list_display = ['nome']
search_f... |
# Copyright 2017-2021 TensorHub, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'confirmDialog.ui'
#
# Created: Fri Jun 05 09:54:07 2015
# by: PyQt4 UI code generator 4.11.3
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except ... |
from os.path import basename, splitext
from dxtbx.model.experiment_list import ExperimentList
import dials.util
from dials.algorithms.refinement.refinement_helpers import calculate_frame_numbers
from dials.array_family import flex
from dials.util import Sorry
from dials.util.multi_dataset_handling import generate_exp... |
# -*- coding: UTF-8 -*-
from lxml import etree
import lxml
import requests
import csv
import codecs
import sys
# This script is going to scrape Slovari.Yandex.com for stressed
# letters for a given word
def inputFromCSV(csvfile_name):
indexed_csv = []
csvfile = open(csvfile_name,'rb')
output_file = open(csvf... |
from core.himesis import Himesis
import uuid
class Hlayer3rule4(Himesis):
def __init__(self):
"""
Creates the himesis graph representing the DSLTrans rule layer3rule4.
"""
# Flag this instance as compiled now
self.is_compiled = True
... |
# coding=utf-8
import datetime, copy, time
from common.simpelTools.src.logging_default import *
from common.simpelTools.src.platform_detect import *
from common.simpelTools.src.magic_strings import strip_command_arguments, helper_type_conversion
'''
this module is intendet to run commands on a command line.
It is des... |
# Create your views here.
from django.utils import timezone
# from django.views.generic import View, TemplateView, UpdateView
from django.views.generic import ListView, RedirectView
from models import Registro
from django.core.urlresolvers import reverse
class RedirectDia(RedirectView):
permanent = False
def... |
# vim: set fileencoding=utf-8 :
#
# (C) 2012 Intel Corporation <markus.lehtonen@linux.intel.com>
# 2013,2017 Guido Günther <agx@sigxcpu.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 Fo... |
"""
Suppose a casino invents a new game that you must pay $250 to play. The game
works like this: The casino draws random numbers between 0 and 1, from a
uniform distribution. It adds them together until their sum is greater than 1,
at which time it stops drawing new numbers. You get a payout of $100 each time
a new nu... |
import os
from typing import ContextManager, TextIO, cast
from ..utils import DummyContext
from .base import PipeInput
from .vt100 import Vt100Input
__all__ = [
"PosixPipeInput",
]
class PosixPipeInput(Vt100Input, PipeInput):
"""
Input that is send through a pipe.
This is useful if we want to send t... |
# Copyright 2011-2017 Facundo Batista
# All Rigths Reserved
"""The server for kilink."""
import logging
import time
from functools import update_wrapper
from flask import (
Flask,
jsonify,
render_template,
request,
make_response
)
# from flask.ext.assets import Environment
# from flask_assets i... |
#!/usr/bin/env python
import os.path
import importlib
import unittest
tests_dir = os.path.abspath(os.path.dirname(__file__))
package_name = tests_dir.split(os.path.sep)[-2].replace('-', '_')
package = importlib.import_module(package_name)
class VersioningTestCase(unittest.TestCase):
def assert_proper_attribute(... |
# -*- coding: utf-8 -*-
"""
Tests for verify_student utility functions.
"""
from datetime import timedelta
import ddt
import unittest
from mock import patch
from pytest import mark
from django.conf import settings
from django.utils import timezone
from lms.djangoapps.verify_student.models import SoftwareSecurePhotoVe... |
from typing import Optional
class TileDanger:
IMPOSSIBLE_WAIT = {
"value": 0,
"description": "Impossible wait",
}
SAFE_AGAINST_THREATENING_HAND = {
"value": 0,
"description": "Tile can't be used by analyzed threat",
}
# honor tiles
HONOR_THIRD = {
"valu... |
import pandas as pd
import click
def skip_lines(path):
n = 0
with open(path) as f:
for line in f:
if line.startswith("track"):
n += 1
else:
break
return n
def read_bed(path):
n_skip = skip_lines(path)
df = pd.read_table(path, sep="\t... |
import itertools
import re
from enum import IntEnum, Enum
from array import array
from lib.CurrencyManager import cm
from lib.ItemCollection import ItemCollection
from lib.Utility import logger, dround
from lib.ItemClass import ItemClass, dir_to_id
float_expr = '[0-9]+|[0-9]+\s*\.\s*[0-9]+'
_BO_PRICE_REGEX = re.comp... |
""" a panflute filter to format elements types
that may contain reference labels, i.e. Math, Image and Table.
The :py:mod:`ipypublish.filters_pandoc.prepare_labels` filter should be run
first to access the functionality below:
If the parent of the element is a Span (or Div for Table), with a class
labelled-Math/label... |
from django import forms
from django.utils.translation import ugettext as _
from nmadb_entrance import models
from nmadb_registration.conditions import check_condition
class BaseInfoForm(forms.ModelForm):
""" Form for entering basic info.
"""
def clean(self):
""" Forbids registration.
""... |
# Copyright 2018 The dm_control Authors.
#
# 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 i... |
import _plotly_utils.basevalidators
class SplomValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(self, plotly_name="splom", parent_name="", **kwargs):
super(SplomValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
data_clas... |
#
# Copyright © 2012 - 2021 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <https://weblate.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 Lice... |
from models import Rubric, RubricOption
import logging
log = logging.getLogger(__name__)
def get_rubric_data(problem_id, target_scores = None):
"""
Retrieve the local rubric that is associated with a given api problem
problem_id - the id of the problem object that the rubric is associated with
target_... |
#!/usr/bin/env python
#
# Copyright 2010 Brett Slatkin, Nathan Naze
#
# 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 a... |
from flask import current_app, request, render_template, redirect, url_for
from flask.views import MethodView
from plq.views.indexform import IndexForm
from plq.utils.utils import Utils
from plq import mongo
utils = Utils()
class Index(MethodView):
methods = ['GET', 'POST']
def get(self):
''' Dispat... |
""" Temp module until astro units are added to quantities
"""
from quantities import *
L_s = solar_luminosity = UnitQuantity(
'solar_luminosity',
3.839*(10**26)*W,
symbol='L_s',
)
L_s.latex_symbol = 'L_\odot'
R_s = solar_radius = UnitLength(
'solar_radius',
6.995 * (10**8) * m,
aliases=['solar... |
# Copyright 2015 Hewlett-Packard Development Company, L.P.
#
# 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... |
"""
A tutorial exercise for using different SVM kernels.
Adapted from:
https://scikit-learn.org/stable/auto_examples/exercises/plot_iris_exercise.html
"""
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from sklearn import datasets, svm
kernel = 'linear' # choice of line... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import psycopg2
import sys
def init_all(db_name, user, host, password):
try:
conn = psycopg2.connect("dbname='" + db_name + "' user='" + user +
"' host='" + host + "' password='" + password +
"'")
... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
("website", "0002_auto_20150413_0435"),
]
operations = [
migrations.AlterField(
m... |
from app.models import all_models
from app.utils import mkdir_p
from app import GENERATED_TILES_FOLDER, RANDOM_FOLDER, BACKPROPS_FOLDER
from scipy import misc
import glob
import numpy as np
import os
from keras.models import load_model, Model
from keras.optimizers import Adam, SGD, Adagrad
from keras.layers import Lo... |
# -*- encoding: utf-8 -*-
##############################################################################
# pos_order_categories
# Copyright (c) 2017 Francisco Manuel García Claramonte <francisco@garciac.es>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the ... |
__author__ = 'Georgios Rizos (georgerizos@iti.gr)'
import sys
import subprocess
import urllib
from amqp import Connection, Message
from amqp.exceptions import PreconditionFailed
if sys.version_info > (3,):
import urllib.parse as urlparse
else:
import urlparse
def translate_rabbitmq_url(url):
if url[0:... |
# 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
# d... |
# position/urls.py
# Brought to you by We Vote. Be good.
# -*- coding: UTF-8 -*-
from django.conf.urls import url
from . import views, views_admin
urlpatterns = [
# admin_views.py
url(r'^$', views_admin.position_list_view, name='position_list',),
url(r'^delete/$', views_admin.position_delete_process_view,... |
#!/usr/bin/env python
import sys
sys.path.append('.')
from sfepy.base.base import Output
from sfepy.discrete.fem.mesh import Mesh
from sfepy.mesh.mesh_generators import gen_tiled_mesh
from optparse import OptionParser
usage = """%prog [options] filename_in filename_out
The program scales a periodic input mesh (a rec... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import codecs, csv, datetime, ftplib, itertools, json, logging, operator, os, pprint, shutil, time, zipfile
import MySQLdb # really pymysql; see config/__init__.py
import requests
from django.conf import settings as project_settings
from django.core.url... |
"""Gaussian Process layers for Keras."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from keras.engine import InputSpec
from keras.engine import Layer
# Backend for neural networks
from keras import backend as K
# Backend for Gauss... |
"""Add self-referential image reference
Revision ID: 8f5b2066cbac
Revises: 698cc06661d6
Create Date: 2016-03-20 19:35:31.321144
"""
# revision identifiers, used by Alembic.
revision = '8f5b2066cbac'
down_revision = '698cc06661d6'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Licensed to Sebastian Schelter (ssc[at]apache.org), who licenses this file
# to You 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.apach... |
import json
import logging
from datetime import date, datetime
from nefertari import wrappers
from nefertari.utils import get_json_encoder
from nefertari.json_httpexceptions import JHTTPOk, JHTTPCreated
from nefertari.events import trigger_after_events
log = logging.getLogger(__name__)
class _JSONEncoder(json.JSONE... |
from __future__ import print_function
from __future__ import unicode_literals
import sys
import logging
import datetime
import dateutil
import uploader
import utilities
import formatter
import postprocess
import oneaday_filter
import result_formatter
import scraper_connection
import to_mongo
from petrarch import petrar... |
from collections import OrderedDict
import re
class Tracestate(object):
_KEY_WITHOUT_VENDOR_FORMAT = r'[a-z][_0-9a-z\-\*\/]{0,255}'
_KEY_WITH_VENDOR_FORMAT = r'[0-9a-z][_0-9a-z\-\*\/]{0,240}@[a-z][_0-9a-z\-\*\/]{0,13}'
_KEY_FORMAT = _KEY_WITHOUT_VENDOR_FORMAT + '|' + _KEY_WITH_VENDOR_FORMAT
_VALUE_FORMAT = r'[\x20... |
""" Wind implementation for BlueSky."""
from numpy import array, sin, cos, arange, radians, ones, append, ndarray, \
amin, minimum, repeat, delete, zeros, around, maximum, floor, \
interp, pi
from bluesky.tools.aero import ft
class Windfield():
""" Windfield class:
... |
#!/usr/bin/env python
__description__ = ""
__author__ = "Konrad Foerstner <konrad@foerstner.org>"
__copyright__ = "2013 by Konrad Foerstner <konrad@foerstner.org>"
__license__ = "ISC license"
__email__ = "konrad@foerstner.org"
__version__ = ""
import argparse
import csv
import sys
sys.path.append(".")
from kufpybio.g... |
#!/usr/bin/env python
import StringIO
import sys
import logging
import os
import re
import flask
from flask import Flask, request, jsonify
import geojson
import requests
import json
import mapzen.whosonfirst.geojson
import mapzen.whosonfirst.export
import mapzen.whosonfirst.search
import mapzen.whosonfirst.utils
impo... |
"""
Tests for Blocks api.py
"""
from __future__ import absolute_import
from itertools import product
import ddt
import six
from django.test.client import RequestFactory
from mock import patch
from openedx.core.djangoapps.content.block_structure.api import clear_course_from_cache
from openedx.core.djangoapps.content... |
from datetime import datetime
from threading import Timer
class TourbillonStream(object):
def __init__(self, tb, stream_name):
self.tb = tb
self.r = self.tb.r
self.stream_name = stream_name
self.channel = None
# self.message_queue
self.halt_next = False
self.seconds_delay = 1
def add(self, tick_tuple):... |
# -*- coding: utf-8 -*-
# <nbformat>3.0</nbformat>
# <markdowncell>
# Utility functions.
# <codecell>
import numpy as np
# <codecell>
def get_chisq_sensitivity(NN_case, NN_control):
"""sensitivity for the chi-square statistic based on 2x3 genotype tables"""
NN = NN_case + NN_control # total number of sub... |
#!/usr/bin/env python
"""
################################################################################
# #
# fix_database #
# ... |
import datetime
from flask_babel import _
from flask_login import current_user
from flask_wtf import FlaskForm
from wtforms import StringField, TextAreaField, DateTimeField, SelectField
from wtforms.ext.sqlalchemy.fields import QuerySelectField
from wtforms.validators import InputRequired, Optional
from app import co... |
from common_fixtures import * # NOQA
from cattle import ApiError
import yaml
def _get_agent_for_container(context, container):
agent = None
for map in container.hosts()[0].instanceHostMaps():
try:
c = map.instance()
except Exception:
continue
if c.agentId is no... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# persistence.py
# Copyright 2012 Julian Fietkau <http://www.julian-fietkau.de/>
#
# This file is part of Streets4MPI.
#
# Streets4MPI 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... |
# Copyright 2015 Google Inc. 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 required by applicable law ... |
#
# Secret Labs' Regular Expression Engine
#
# convert template to internal format
#
# Copyright (c) 1997-2001 by Secret Labs AB. All rights reserved.
#
# See the sre.py file for information on usage and redistribution.
#
"""Internal support module for sre"""
import _sre
import sre_parse
from sre_constants import *... |
"""
This tests the files
lib/counter.py
"""
import mock
from contextlib import contextmanager
from .base import MyTestCase
from privacyidea.lib.counter import increase, decrease, reset, read
from privacyidea.models import EventCounter
def increase_and_read(name):
""" helper function that increases the event co... |
class Circle:
def __init__(self, members, enclosed, color, key, range=None, type='normal'): # type = 'normal', 'internal', 'dual'
self.members = set(members)
self.enclosed = set(enclosed)
self.color = color
self.range = range
self.type = type
self.key = key
def ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.