src stringlengths 721 1.04M |
|---|
import unittest
import crypto.ciphers as ciphers
from crypto.alphabets import EnglishAlphabet
class SubstitutionCipherTests(unittest.TestCase):
def setUp(self):
self.alph = EnglishAlphabet()
self.key = {letter: letter for letter in self.alph}
def test_invalid_key_type(self):
with self... |
# -*- coding: utf-8 -*-
from qtdjango.helpers import test_connection
__author__ = 'darvin'
from qtdjango.connection import *
__author__ = 'darvin'
from PyQt4.QtCore import *
from PyQt4.QtGui import *
class BooleanEdit(QCheckBox):
def text(self):
return QVariant(self.checkState()).toString()
def ... |
import sublime
import sublime_plugin
import os.path
# import filecmp
# import shutil
# import time
# import json
from subprocess import Popen, PIPE
from collections import namedtuple as nt
import xml.etree.ElementTree as ET
import webbrowser
import urllib
scripts = {"Script_1D": "0 Master Script",
"Script... |
#! /usr/bin/python
#! coding: utf-8
# decode_sphinx_inventory, mb, 2013, 2014-07-26, 2015-12-17
# ÄÖÜäöüß
# ==================================================
# The following __doc__ string is displayed on --info
# --------------------------------------------------
"""\
decode_sphinx_inventory - Decode an objects.inv... |
#
# Copyright (c) 2009-2019 Tom Keffer <tkeffer@gmail.com> and
# Gary Roderick <gjroderick@gmail.com>
#
# See the file LICENSE.txt for your full rights.
#
"""Classes to support fixes or other bulk corrections of weewx data."""
from __future__ import with_statement
from __future__ impor... |
import os
import sys
import re
import xlrd
import csv
import glob
import shutil
import comtypes.client
PATH_DICT = { "pb_dir": "\\\\p7fs0003\\nd\\3033-Horizon-FA-Share\\PB_DeltaOne",
"cln_filename": "\\\\p7fs0003\\nd\\3033-Horizon-FA-Share\\PB_DeltaOne\\Daily_Data\\ClientDetails_????????.xlsx",
"distro_dir": "... |
import tensorflow as tf
from tensorflow.python.framework import ops
from model import Model
class ATWModel(Model):
"""
ATWModel implements a variant on the E-T-D model from model.Model()
Instead of doing next frame prediction, ATW attempts to encode the entire
sequence, then reproduce the video from o... |
import pandas as pd
import numpy as np
from utils.webdata import get_close_of_symbols
class TradeSimulator(object):
def __init__(self, start_val=1000000, leverage=2.0, allow_short=True):
"""
Parameters
----------
start_val: float
start value of the portfolio
l... |
#!/usr/bin/python3
#
# select-session.py
# Copyright (C) 2010 Canonical Ltd.
# Copyright (C) 2012-2014 Dustin Kirkland <kirkland@byobu.org>
#
# Authors: Dustin Kirkland <kirkland@byobu.org>
# Ryan C. Thompson <rct@thompsonclan.org>
#
# This program is free software: you can redistribute it an... |
import pandas as pd
from absl import flags
from absl import app
FLAGS = flags.FLAGS
flags.DEFINE_string('preprocess_file',
'NPS_1978-2018_Data.tsv',
'file path to tsv file with data to proess',
short_name='p')
def convert_nan_for_calculation(value):
if ... |
#!/usr/bin/env python2.7
import sys
sys.path.insert(0, 'buildlib/jinja2.egg')
sys.path.insert(0, 'buildlib')
# import zlib
# zlib.Z_DEFAULT_COMPRESSION = 9
import tarfile
import os
import shutil
import subprocess
import time
import jinja2
import configure
import plat
# Are we doing a Ren'Py build?
RENPY = os.path... |
from datetime import date
from calendartools import defaults
from calendartools.views.calendars import (
YearView, TriMonthView, MonthView, WeekView, DayView
)
class YearAgenda(YearView):
template_name = 'calendar/agenda/year.html'
paginate_by = defaults.MAX_AGENDA_ITEMS_PER_PAGE
class MonthAgenda(Month... |
import warnings
warnings.filterwarnings("ignore")
DATE_FMT = "%d/%m/%Y"
def parse_dates(sd, ed):
if not ed:
ed = datetime.today().strftime(DATE_FMT)
return datetime.strptime(sd, DATE_FMT), datetime.strptime(ed, DATE_FMT)
def main(site, start_date, end_date):
start_date, end_date = parse_dates(... |
# Copyright (c) 2014 Mirantis 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 writing, so... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
"""Contains classes and functions that a SAML2.0 Identity provider (IdP)
or attribute authority (AA) may use to conclude its tasks.
"""
import logging
import os
import importlib
import shelve
import threading
from saml2.eptid import EptidShelve, Eptid
from saml2.saml i... |
import unittest
import tom
class PlainPySequence:
"""Simple list of symbols: [o_0, ..., o_{N-1}]."""
def __init__(self, data):
if type(data) is list:
self.data = data
else:
self.data = list(range(data))
def __repr__(self):
return str(self.data)
def len... |
# -*- coding: utf-8 -*-
"""This module contains API Wrapper implementations of the HTTP Redirect service
"""
import logging
from ..session import DynectSession
from ...compat import force_unicode
__author__ = 'xorg'
__all__ = ['HTTPRedirect']
class HTTPRedirect(object):
"""HTTPRedirect is a service which sets u... |
from __future__ import absolute_import, print_function, division
import pandas as pd
import re
import warnings
from datetime import datetime as dt
from datetime import timedelta as td
from config import ConverterConfig
__all__ = []
# TODO: set `datetime_format` by reading from config file
DT_FMT = 'yyyy/MM/dd' #... |
if __name__ == "__main__":
import sys,os
selfname = sys.argv[0]
full_path = os.path.abspath(selfname)[:]
last_slash = full_path.rfind('/')
dirpath = full_path[:last_slash] + '/..'
print "Append to PYTHONPATH: %s" % (dirpath)
sys.path.append(dirpath)
import copy, string
import math
import nu... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
import os
from pyowm import owm
from pyowm.agroapi10.polygon import GeoPolygon
from pyowm.agroapi10.soil import Soil
class IntegrationTestsSoilData(unittest.TestCase):
__owm = owm.OWM(os.getenv('OWM_API_KEY', None))
def test_call_soil_data(self)... |
import unittest
import shutil
import tempfile
import os
import mock
import json
import subprocess
import sys
import signal
from queue import Queue
import numpy as np
from clouds.obj.subject import Subject
from clouds.obj.arena import Arena
from clouds.obj.classifier import Classifier
from clouds.tests import util
fro... |
"""
@authors Tina Howard, Grant Gadomski, Nick Mattis, Laura Silva, Nils Sohn
"""
from django.shortcuts import render, get_object_or_404, redirect
from django.utils.datastructures import MultiValueDictKeyError
from django.http import Http404, HttpResponseRedirect, HttpResponse #TODO Take off HttpResponse after fig... |
#
# ----------------------------------------------------------------------------------------------------
#
# Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify ... |
# -*- coding: utf-8 -*-
"""
Script to help time determenistic uuid creation
"""
from __future__ import absolute_import, division, print_function
from six.moves import range, builtins
import os
import multiprocessing
import time
from PIL import Image
import hashlib
import numpy as np
import uuid
from utool._internal.met... |
import re
from django.utils.translation import ugettext_lazy as _
from .base import (
ADDON_DICT, ADDON_EXTENSION, ADDON_LPAPP, ADDON_PLUGIN,
ADDON_SEARCH, ADDON_STATICTHEME, ADDON_THEME)
from olympia.versions.compare import version_int as vint
class App(object):
@classmethod
def matches_user_agent... |
from slugify import slugify
from sqlalchemy import desc
from sqlalchemy.orm import aliased
from zou.app.models.asset_instance import AssetInstance
from zou.app.models.entity import Entity, EntityLink
from zou.app.models.entity_type import EntityType
from zou.app.utils import fields, events
from zou.app.services impo... |
# --------------------------------------------------------------------------
# The MIT License (MIT)
#
# Copyright (c) 2014-2016 Digital Sapphire
#
# 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 Soft... |
#
# Generated by TigerShark.tools.convertPyX12 on 2012-07-10 16:29:58.981434
#
from tigershark.X12.parse import Message, Loop, Segment, Composite, Element, Properties
parsed_278_HEADER = Loop( u'HEADER', Properties(looptype=u'wrapper',repeat=u'1',pos=u'015',req_sit=u'R',desc=u'Table 1 - Header'),
Segment( u'BHT', Prop... |
"""
Cuneiform Recogniser
"""
from __future__ import absolute_import
import os
import codecs
import shutil
import tempfile
import subprocess as sp
import numpy
from nodetree import node
from . import base
from .. import stages, types, utils
class CuneiformRecognizer(base.CommandLineRecognizerNode):
"""
Re... |
# FRAUDAR: Bounding Graph Fraud in the Face of Camouflage
# Authors: Bryan Hooi, Hyun Ah Song, Alex Beutel, Neil Shah, Kijung Shin, Christos Faloutsos
#
# This software is licensed under Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a c... |
import pickle
from LOTlib import break_ctrlc
import LOTlib # if we want to set LOTlib.SIG_INTERRUPTED=False for resuming ipython
import numpy
def build_conceptlist(c,l):
return "CONCEPT_%s__LIST_%s.txt"%(c,l)
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Load the hypotheses
# ~~~~~... |
# -*- coding: utf-8 -*-
import pilas
archi = open('datos.txt', 'r')
nivel = archi.readline()
pantalla = archi.readline()
idioma = archi.readline()
archi.close()
if idioma == "ES":
from modulos.ES import *
else:
from modulos.EN import *
class Elemento(pilas.actores.Texto):
def __init__(self, texto='', x... |
# Copyright (c) 2010, PRESENSE Technologies GmbH
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of... |
def RowChanger(row,textToSearch,textToReplace,fileToSearch):
a=1
import fileinput
tempFile = open( fileToSearch, 'r+' )
for line in fileinput.input( fileToSearch ):
if row in line :
print('done yet')
a=0
if a:
if textToReplace=="0":
textToReplace =... |
#!/usr/bin/env python3
import sys
if sys.version_info < (3, 3):
raise RuntimeError('At least Python 3.3 is required')
from lxml import etree
from datetime import timedelta
import hashers, processors
from os.path import join as path_join, dirname, normpath, isabs, abspath
import logging
LOGGER = logging.getLogger(__n... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2016-12-02 23:39
from __future__ import unicode_literals
import datetime
import django.contrib.gis.db.models.fields
from django.db import migrations, models
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
... |
"""
https://leetcode.com/problems/degree-of-an-array/
https://leetcode.com/submissions/detail/130966108/
"""
class Solution:
def findShortestSubArray(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
d = dict()
for index, num in enumerate(nums):
if... |
# coding: utf-8
# imports
import os, re, datetime
from time import gmtime, strftime
# django imports
from django.conf import settings
# filebrowser imports
from filebrowser.settings import *
from filebrowser.functions import get_file_type, url_join, is_selectable, get_version_path
# PIL import
if STRICT_PIL:
fr... |
from django.contrib.contenttypes.models import ContentType
from django.contrib.sites.models import Site
from django_comments.models import Comment
from rest_framework import serializers, generics, filters
class CommentSerializer(serializers.ModelSerializer):
user = serializers.SlugRelatedField(slug_field='usernam... |
from __future__ import absolute_import
# Copyright (c) 2010-2015 openpyxl
import pytest
from openpyxl.xml.functions import fromstring, tostring
from openpyxl.tests.helper import compare_xml
@pytest.fixture
def SurfaceChart():
from ..surface_chart import SurfaceChart
return SurfaceChart
class TestSurfaceCha... |
# encoding: utf-8
# Copyright 2013 maker
# License
"""
Knowledge base: test suites
"""
from django.test import TestCase
from django.test.client import Client
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User as DjangoUser
from maker.core.models import User, Group, Perspectiv... |
# Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""A mock LocalWPT class with canned responses."""
class MockLocalWPT(object):
def __init__(self,
test_patch=None,
app... |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# 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... |
"""Runs backwards optimization on Swirlnet model."""
import os
os.environ['CUDA_VISIBLE_DEVICES'] = '-1'
import argparse
import numpy
from keras import backend as K
from keras.models import load_model as load_keras_model
from gewittergefahr.deep_learning import model_interpretation
from gewittergefahr.deep_learning im... |
"""Tests for expression sat_all functionality."""
from tt.errors import NoEvaluationVariationError
from tt.expressions import BooleanExpression as be
from ._helpers import ExpressionTestCase
class TestExpressionSatAll(ExpressionTestCase):
def test_only_constants_exprs_cause_exception(self):
"""Test tha... |
import pytest
import praw
from app import reddit, scraper
from app.models import Submission, Comment
def get_and_parse_reddit_submission(submission_id):
reddit_submission = reddit.get_submission(submission_id=submission_id)
info, comments = scraper.parse_submission(reddit_submission, Submission)
return... |
import hashlib
import os
from textwrap import dedent
from ..cache import BaseCache
from ..controller import CacheController
try:
FileNotFoundError
except NameError:
# py2.X
FileNotFoundError = IOError
def _secure_open_write(filename, fmode):
# We only want to write to this file, so open it in write ... |
import json
from collections import OrderedDict
from datetime import datetime
from io import BytesIO
from . import amqptypes
from . import serialisation
class Message(object):
"""
An AMQP Basic message.
Some of the constructor parameters are ignored by the AMQP broker and are provided
just for the co... |
def extractCurrentlyTLingBuniMi(item):
"""
"""
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol or frag) or 'preview' in item['title'].lower():
return None
if item['title'].startswith('[BNM]'):
return buildReleaseMessageWithType(item, 'Bu ni Mi wo Sasagete Hyaku to ... |
"""
Django settings for regenschirm project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...... |
from collections import ChainMap
import logging
import time
import sys
import GetArgs
import GetSite
from Config import Defaults
from Config import LoadSites
from Config import LoadConfig
from Config import Settings
def work():
def init_config():
args = GetArgs.get_args()
return ChainMap(args, L... |
"""
Views for the Indivo Problems app
Ben Adida
ben.adida@childrens.harvard.edu
"""
from utils import *
import uuid
from django.utils import simplejson
def start_auth(request):
"""
begin the oAuth protocol with the server
expects either a record_id or carenet_id parameter,
now that we are caren... |
"""The goal of this problem is to implement a variant of the 2-SUM algorithm
(covered in the Week 6 lecture on hash table applications).
The file contains 500,000 positive integers (there might be some repetitions!).
This is your array of integers, with the ith row of the file specifying the ith
entry of the array.
Yo... |
#!/usr/bin/env python
import os
import sys
import string
import logging
import argparse
import urlparse
import random
import pprint
import cPickle
import time
import signal
import subprocess
import glob
import numpy
from collections import defaultdict
from datetime import datetime
sys.path.append('..')
from webloader.... |
"""
Created on Aug 26, 2013
@author: rgeorgi
"""
import sys, re, unittest
from collections import defaultdict, Callable, OrderedDict
class CountDict(object):
def __init__(self):
self._dict = defaultdict(int)
def add(self, key, value=1):
self[key] += value
def __str__(self):
retu... |
# Copyright 2019 Allan Galarza
#
# 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 writi... |
############################################################################
# This file is part of the Maui Web site.
#
# Copyright (c) 2012 Pier Luigi Fiorini
# Copyright (c) 2009-2010 Krzysztof Grodzicki
#
# Author(s):
# Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
#
# $BEGIN_LICENSE:AGPL3+$
#
# This program ... |
import unittest
from tests.unit_tests_rob import _domain_rob, _domain_rob_unittest
from tests.unit_tests_rob.global_test_suite import get_global_test_pipeline, execute_sql, init_db
class TestCase_Domain(unittest.TestCase):
def setUp(self):
self.pipeline = get_global_test_pipeline()
self.pipe = s... |
"""
This sample demonstrates a simple skill built with the Amazon Alexa Skills Kit.
The Intent Schema, Built-in Slots, and Sample Utterances for this skill, as well
as testing instructions are located at http://amzn.to/1LzFrj6
For additional samples, visit the Alexa Skills Kit Getting Started guide at
http://amzn.to/1... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#É adimensional?
adi = False
#É para salvar as figuras(True|False)?
save = True
#Caso seja para salvar, qual é o formato desejado?
formato = 'jpg'
#Caso seja para salvar, qual é o diretório que devo salvar?
dircg = 'fig-sen'
#Caso seja para salvar, qual é o nome do arquivo... |
import xml.sax
import ParseUtils
from Enums import *
####################################################################################################
class BaseConfiguration(xml.sax.ContentHandler):
def loadFromDisk(self, filename):
xml.sax.parse(filename, self)
######################################... |
## @file
# This file is used to parse a Module file of .PKG file
#
# Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials are licensed and made available
# under the terms and conditions of the BSD License which accompanies this
# distribution. The full ... |
# Copyright 2009-2012 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Layers used by Launchpad tests.
Layers are the mechanism used by the Zope3 test runner to efficiently
provide environments for tests and are documented in the lib/zope/tes... |
# Problem: Insert Delete GetRandom O(1) - Duplicates allowed
#
# Design a data structure that supports all following operations in average O(1) time.
#
# Note: Duplicate elements are allowed.
# 1. insert(val): Inserts an item val to the collection.
# 2. remove(val): Removes an item val from the collection if presen... |
#Copyright ReportLab Europe Ltd. 2000-2012
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/graphics/charts/legends.py
__version__=''' $Id: legends.py 3959 2012-09-27 14:39:39Z robin $ '''
__doc__="""This will be a collection of legends to be... |
# PyAlgoTrade
#
# Copyright 2011-2015 Gabriel Martin Becedillas Ruiz
#
# 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 ap... |
#=======================================================================
# Author: Donovan Parks
#
# Perform Tukey-Kramer post-hoc test.
#
# Copyright 2011 Donovan Parks
#
# This file is part of STAMP.
#
# STAMP is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public Licen... |
#!/usr/bin/python
from k5test import *
# Create a realm with the KDC one hour in the past.
realm = K5Realm(start_kdc=False)
realm.start_kdc(['-T', '-3600'])
# kinit (no preauth) should work, and should set a clock skew allowing
# kvno to work, with or without FAST.
realm.kinit(realm.user_princ, password('user'))
real... |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# This is pncconf, a graphical configuration editor for LinuxCNC
# Chris Morley copyright 2009
# This is based from stepconf, a graphical configuration editor for linuxcnc
# Copyright 2007 Jeff Epler <jepler@unpythonic.net>
#
# This program is free software... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
(b'myhronet', b'0001_initial'),
]
operations = [
migrations.AddField(
model_name=b'url',
name=b'ip',
... |
'''
Ultimate Whitecream
Copyright (C) 2015 mortael
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.
... |
#!/usr/bin/python
#
# Copyright 2021 Jigsaw Operations LLC
#
# 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 applicabl... |
#!/usr/bin/env python
from nose.tools import *
from networkx import *
from networkx.generators.random_graphs import *
class TestGeneratorsRandom():
def smoke_test_random_graph(self):
seed = 42
G=gnp_random_graph(100,0.25,seed)
G=binomial_graph(100,0.25,seed)
G=erdos_renyi_graph(100,... |
"""Base Class for all Custom Objects, highly based on sklearn Base Class"""
#Author: Miguel Molero <miguel.molero@gmail.com>
import inspect
import six
import numpy as np
def _pprint(params, offset=0, printer=repr):
"""Pretty print the dictionary 'params'
Parameters
----------
params: dict
The ... |
import os
import asyncio
from bobsled import storages, runners, callbacks
from bobsled.environment import EnvironmentProvider
from bobsled.tasks import TaskProvider
from bobsled.utils import get_env_config, load_args
class Bobsled:
def __init__(self):
self.settings = {"secret_key": os.environ.get("BOBSLED... |
# Copyright 2019 The TensorFlow Authors. 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 applica... |
from PIL import Image as Img
from PIL import ImageOps
class Image(object):
"""
Image object
"""
def __init__(self, filePath):
self.file = filePath
_f = self.rawFile
self.im = Img.open(_f)
self.size = self.im.size
_f.close()
def resize(self, width, height):... |
# # -*- coding: utf-8 -*-
import re
import datetime
from flask import request
from flask_api import status
from flask_restful import Resource
from sqlalchemy.exc import IntegrityError
from werkzeug.security import generate_password_hash
from app import db, token_auth
from app.models.user_model import UserModel, get_u... |
from PyQt5.QtCore import Qt
from PyQt5.QtSql import QSqlQuery
from PyQt5.QtWidgets import *
from OpenNumismat.Collection.CollectionFields import FieldTypes as Type
from OpenNumismat.Tools.Gui import createIcon
from OpenNumismat.Settings import Settings
class FilterMenuButton(QPushButton):
DefaultType = 0
Sel... |
"""
Plot the hourly stage IV precip data
"""
import sys
import os
import datetime
import pygrib
import pytz
from pyiem.util import utc, logger
from pyiem.plot import MapPlot, get_cmap
LOG = logger()
def doit(ts):
"""
Generate hourly plot of stage4 data
"""
gmtnow = datetime.datetime.utcnow()
... |
from django.contrib.auth.models import User
from django.conf import settings
def is_allowed_username(username):
disallowed = getattr(settings, 'AUTH_DISALLOWED_USERNAMES', [])
return username.lower() not in disallowed
def get_username(basename):
disallowed = getattr(settings, 'AUTH_DISALLOWED_USERNAMES... |
import sys
from abc import ABCMeta, abstractmethod
from datetime import datetime
import feedparser
import requests
from requests.exceptions import ConnectionError, Timeout
from uthportal.database.mongo import MongoDatabaseManager
from uthportal.logger import get_logger
from uthportal.util import truncate_str
class ... |
"""Code for parallel-building a set of targets, if needed."""
from __future__ import print_function
import errno, os, stat, signal, sys, tempfile, time
from . import cycles, env, helpers, jobserver, logs, paths, state
from .logs import debug2, err, warn, meta
def _nice(t):
return state.relpath(t, env.v.STARTDIR)
... |
import xmg.compgen.Symbol
import xmg.compgen.Grammar
# Punctuation
semicolon=xmg.compgen.Symbol.T(";")
colon=xmg.compgen.Symbol.T(":")
pipe=xmg.compgen.Symbol.T("|")
quote=xmg.compgen.Symbol.T("'")
arrow=xmg.compgen.Symbol.T("->")
equal=xmg.compgen.Symbol.T("=")
coma=xmg.compgen.Symbol.T(',')
openpred=xmg.compgen.Symb... |
#!/usr/bin/python3
## Copyright (C) 2015 Manuel Tondeur
## 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 ... |
from pyramid.httpexceptions import HTTPFound
from pyramid.security import (
remember,
forget,
)
from pyramid.response import Response
from sqlalchemy.exc import DBAPIError
from ..models import Course
from pyramid.view import (
view_config,
view_defaults
)
from ..security import (
USE... |
#!/usr/bin/env python3
# Akvo Reporting is covered by the GNU Affero General Public License.
# See more details in the license.txt file located at the root folder of the Akvo RSR module.
# For additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >.
""" Import projects from Optimy f... |
# CTCI 8.7
# Permutations Without Dups
#-------------------------------------------------------------------------------
# My Solution
#-------------------------------------------------------------------------------
def perm(str):
if str == None:
return None
result = []
if len(str) == 0:
... |
import logging
from flask import make_response
from sqlalchemy.orm.exc import NoResultFound
from Pegasus.service._query import InvalidQueryError
from Pegasus.service._serialize import jsonify
from Pegasus.service._sort import InvalidSortError
from Pegasus.service.base import ErrorResponse, InvalidJSONError
from Pegas... |
# -*- coding: utf-8 -*-
"""Module containing functionality for conjugate gradients.
Conjugate gradients is motivated from a first order Taylor expansion of the
objective:
.. math::
f(\\theta_t + \\alpha_t d_t) \\approx f(\\theta_t) + \\alpha_td_t^Tf'(\\theta_t).
To locally decrease the objective, it is optimal t... |
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
from aldryn_news import __version__
REQUIREMENTS = [
'django-filer',
'django-hvad',
'django_select2',
# last version that supports django 1.5
'django-taggit<=0.18.1',
'djangocms-text-ckeditor',
'translitcodec',
'Unideco... |
import unittest, json
from tests import pulp_test
from pulp_auto import Pulp
from pulp_auto.role import Role
from pulp_auto.user import User
from pulp_auto.repo import Repo
def setUpModule():
pass
class RoleTest(pulp_test.PulpTest):
@classmethod
def setUpClass(cls):
super(RoleTest, cls).setUpCla... |
""" This is a test of the SystemLoggingDB
It supposes that the DB is present and installed in DIRAC
"""
# pylint: disable=invalid-name,wrong-import-position,protected-access
import unittest
from DIRAC.Core.Base.Script import parseCommandLine
parseCommandLine()
from DIRAC import gLogger
from DIRAC.Core.Utilitie... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2015-12-28 00:55
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import django_extensions.db.fields
class Migration(migrations.Migration... |
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.font_manager import FontProperties, findfont
from matplotlib.legend_handler import HandlerPatch
import matplotlib.patches as mpatches
import matplotlib as mpl
from matplotlib import cm
import xlrd
from config import SHEET_INDEX, ROW_START, ROW_END, COLU... |
import getpass
import os
import sys
from werkzeug.datastructures import MultiDict
import models
import forms
# Make sure the database gets installed properly
models.db.create_all()
values = MultiDict()
form = forms.SetUser(values)
values['email'] = sys.argv[1] if len(sys.argv) > 1 else raw_input('%s: ' % form.emai... |
"""
Miscellaneous convenience functions for iterating over blocks, txs, etc.
"""
import time
import threading
from .scan import LongestChainBlockIterator, TxIterator
from .track import TrackedSpendingTxIterator, UtxoSet
from .blockchain import BlockChainIterator
#####################################################... |
# coding: utf-8
"""
EVE Swagger Interface
An OpenAPI for EVE Online
OpenAPI spec version: 0.4.6
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
class GetCharactersCharacterIdWallets200Ok(object):
"""
... |
'''
Script that creates a randomized list of station/night pairs.
Given a list of station names and a list of night dates, this script
writes a semi-randomized list of the elements of the cartesian product
of the two lists to a CSV file. The station names cycle through an
alphabetized version of the input station name... |
from backdoors.backdoor import *
import subprocess
import threading
class Bash2(Backdoor):
prompt = Fore.RED + "(bash) " + Fore.BLUE + ">> " + Fore.RESET
def __init__(self, core):
cmd.Cmd.__init__(self)
self.intro = GOOD + "Using second Bash module..."
self.core = core
self.opt... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.