src stringlengths 721 1.04M |
|---|
#!/usr/bin/env python
from dblayer import DBlayer
import getpass
db = DBlayer(DEBUG=True)
print 'so you want to add an admin, eh?'
name = raw_input("full name: ")
usern = raw_input("user name: ")
trys = 0
while True:
pw = getpass.getpass("password: ")
pw2 = getpass.getpass("re-type password: ")
if pw == ... |
"""
Given a list of distinct numbers, find the longest monotonically increasing
subsequence within that list.
For example:
S = [2, 4, 3, 5, 1, 7, 6, 9, 8] -> [2, 3, 5, 6, 8]
or [2, 4, 5, 7, 8]
or [2, 4, 5, 7, 9]
If there's more than one solut... |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Rubric'
db.create_table(u'grader_rubric', (
(u'id', self.gf('django.db.models.fi... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import logging
from dateutil.parser import parse
from flask import request, url_for
from flask.ext.restplus.fields import *
log = logging.getLogger(__name__)
class ISODateTime(String):
__schema_format__ = 'date-time'
def format(self, value)... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2016 Francesco Lumachi <francesco.lumachi@gmail.com>
from __future__ import division
from gensim import models, utils
import math
class QLModel(models.TfidfModel):
""" Use of models.TfidfModel as base to build Query Likelihood Model (12.9) appeared i... |
#!/usr/bin/env python
"""utilities.py: datafile checking and format conversions
"""
import csv
import gdal
import json
import numpy as np
import os
import shapefile
from gdalconst import *
from osgeo import osr, gdal
from random import randint
import matplotlib.pyplot as plt
import pandas
""" Do basic checks on any... |
""" Tick generator classes and helper functions for calculating axis
tick-related values (i.e., bounds and intervals).
"""
import numpy as np
from traits.api import (Array, HasStrictTraits, Instance, Property,
cached_property)
from .bounding_box import BoundingBox
class BaseGridLayout(HasSt... |
""".bytes file reading and writing primitives."""
import sys
from io import BytesIO
from struct import Struct
from contextlib import contextmanager
from collections import namedtuple
from .printing import PrintContext
from ._argtaker import ArgTaker
from .lazy import LazySequence
from trampoline import trampoline
i... |
#!/usr/bin/env python
from __future__ import absolute_import, division, print_function
import codecs
import os
import re
from setuptools import find_packages, setup
def get_version(filename):
with codecs.open(filename, 'r', 'utf-8') as fp:
contents = fp.read()
return re.search(r"__version__ = ['\"](... |
import urllib.request
import json
class TeleBot34:
token = None
botinfo = None
curroffset = 0
updateQueue = []
regClients = []
def __init__(self, token):
self.token = token
self.getBotInfo()
pass
def getBotInfo(self):
# make request
f = urllib.reques... |
# 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 or agreed to in... |
import pytest
from instantauth.verifiers import BypassVerifier, DataKeyVerifier
from instantauth.verifiers.timehash import TimeHashVerifier
from instantauth.coders.json import JsonCoder
bypass = BypassVerifier('pubkey')
datakey = DataKeyVerifier(JsonCoder(), 'key')
timehash = TimeHashVerifier(now=lambda : 100000000... |
###################################################################################
## MODULE : spell.lib.adapter.data
## DATE : Mar 18, 2011
## PROJECT : SPELL
## DESCRIPTION: Hook for the C++ data containers
## --------------------------------------------------------------------------------
##
## Copyr... |
# 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 u... |
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from .models import StormpathUser
from .forms import StormpathUserCreationForm, StormpathUserChangeForm
class StormpathUserAdmin(UserAdmin):
# Set the add/modify forms
add_form = StormpathUserCreationForm
form = StormpathUse... |
"""
pyexcel.constants
~~~~~~~~~~~~~~~~~~~
Constants appeared in pyexcel
:copyright: (c) 2015-2017 by Onni Software Ltd.
:license: New BSD License
"""
# flake8: noqa
DEFAULT_NA = ''
DEFAULT_NAME = 'pyexcel sheet'
DEFAULT_SHEET_NAME = 'pyexcel_sheet1'
MESSAGE_WARNING = "We do not overwrite files"
M... |
# Copyright 2015 Isotoma 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 law or agreed to in writing... |
# -*- coding: utf-8 -*-
from robot.api import logger
from robot.utils import ConnectionCache
import httplib
import base64
import json
import socket
import urlparse
import urllib
class RabbitMqManager(object):
"""
Библиотека для управления сервером RabbitMq.
Реализована на основе:
... |
# -*- coding: utf-8 -*-
#
# ns-3 documentation build configuration file, created by
# sphinx-quickstart on Tue Dec 14 09:00:39 2010.
#
# 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 co... |
'''
sumdigitsCodeEval.py - Solution to Problem Lowercase (Category - Easy)
Copyright (C) 2013, Shubham Verma
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... |
__author__ = "Christian Kongsgaard"
__license__ = 'MIT'
# -------------------------------------------------------------------------------------------------------------------- #
# IMPORTS
# Modules:
import copy
from collections import namedtuple, OrderedDict
import typing
# RiBuild Modules:
from delphin_6_automation.... |
import json
import random
from urllib.error import URLError
from urllib.parse import urlencode
from urllib.request import urlopen, http, Request
import time
from datetime import date
from Profiler import Profiler
import __setup_photo__ as setup
class VkError(Exception):
def __init__(self, value):
self.val... |
#!/usr/bin/env python3
import argparse
import os
import subprocess
import sys
import requests
import yaml
# Make a Python 3 virtualenv and install requests and PyYAML
# pyvenv pulp_checkout
# source pulp_checkout/bin/activate
# pip install requests PyYAML
#
# Run the script using the Python3 interpreter
# ... |
# A place to store all the settings in a thread-safe (blocking) way.
#
# Settings just for the thermostat, of course.
import copy
import json
import threading
# ------- Module Data (Singletonish) -------
settingsLock = threading.RLock()
# Don't read this directly, use the methods below.
settings = {}
DAYS = ["Sund... |
#!/usr/bin/env python
"""
Written by Chris Hupman
Github: https://github.com/chupman/
Example: Get guest info with folder and host placement
"""
import json
from tools import cli, service_instance
data = {}
def get_nics(guest):
nics = {}
for nic in guest.net:
if nic.network: # Only return adapter ... |
from functools import partial
from PyQt5.QtGui import QIcon, QKeySequence
from PyQt5.QtWidgets import QMenu, QAction
from umlfri2.application import Application
from umlfri2.qtgui.base import image_loader
class ContextMenu(QMenu):
def _add_menu_item(self, icon, label, shortcut, action=None, sub_menu=None):
... |
"""Rever tools tests"""
import os
import tempfile
import pytest
from rever.tools import indir, render_authors, hash_url, replace_in_file
@pytest.mark.parametrize('inp, pattern, new, leading_whitespace, exp', [
('__version__ = "wow.mom"', r'__version__\s*=.*', '__version__ = "WAKKA"',
True, '__version__ = "W... |
# PyVision License
#
# Copyright (c) 2006-2008 David S. Bolme
# 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 the above copyright
# notice, thi... |
import traceback
from main import main
from utility import load_config
def batch_vardev():
conf = load_config("VarDevConf")
try:
main(conf)
except:
print traceback.format_exc()
def batch_countdev():
c = 1
for num_steps in xrange(3+c,7):
conf = load_conf... |
import json
import os
import urllib2
import time
print('Loading elasticsearch keyword function')
#ELASTICSEARCH_URL = "https://search-bigimage-2gtgp2nq3ztfednwgnd6ma626i.us-west-2.es.amazonaws.com"
ELASTICSEARCH_URL = os.environ['ELASTICSEARCH_URL']
def extractImages(tweet):
'return a list of some of the images ... |
#-*- coding: utf-8 -*-
from __future__ import division, print_function
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from mpl_toolkits.mplot3d import Axes3D
class simulation_output(object):
def __init__(self, filename, update_scale_time = 0, frame_rate = 25):
"""
... |
# This file is part of Indico.
# Copyright (C) 2002 - 2016 European Organization for Nuclear Research (CERN).
#
# Indico 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 (a... |
# -*- coding: utf-8 -*-
'''
setup module to pip integration of Diacamma accounting
@author: Laurent GAY
@organization: sd-libre.fr
@contact: info@sd-libre.fr
@copyright: 2015 sd-libre.fr
@license: This file is part of Lucterios.
Lucterios is free software: you can redistribute it and/or modify
it under the terms of t... |
# 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 ... |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# Thinkopen Brasil
# Copyright (C) Thinkopen Solutions Brasil (<http://www.tkobr.com>).
#
# This ... |
from django.conf.urls import patterns, include, url
from .views import ParteTemplateView, ParteResponsableTemplateView, ParteListView, ParteCreateView, ParteDetailView, ParteUpdateView
from .views import ParteResponsableListView, ParteResponsableBaseDatatableView, ParteDeleteView
from .views import grid_config, grid_h... |
#!/usr/bin/python
# Copyright (c) 2012 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import optparse
import os.path
import shutil
import subprocess
import stat
import sys
import time
import traceback
ARCH_MAP = {
... |
# vi: ts=4 expandtab
#
# Copyright (C) 2012 Yahoo! Inc.
#
# Author: Joshua Harlow <harlowja@yahoo-inc.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3, as
# published by the Free Software Foundation.
#
# This... |
#!/usr/bin/env python
"""
"""
import os
from optparse import make_option
from django.core.management.base import NoArgsCommand
def starting_imports():
from django.db.models.loading import get_models
for m in get_models():
exec "from %s import %s" % (m.__module__, m.__name__)
from datetime import ... |
"""
Script loading the atomic properties from the pyNEB package.
Mostly line transitions.
Input to the line fitting procedures
"""
import numpy as n
from scipy.interpolate import interp1d
import pyneb as pn
# Conversion from Morton (1991, ApJS, 77, 119) wavelength in Angstrom
# SDSS spectra are in the vacuum, ther... |
import time
from django.conf import settings
from django.core.cache import cache
from django.db import models
from .permissions import UserCanManageDevicePermissions
from kolibri.auth.models import Facility
from kolibri.auth.models import FacilityUser
device_permissions_fields = [
'is_superuser',
'can_manage... |
import glob
import logging
import os
import subprocess
from plugins import BaseAssembler
from yapsy.IPlugin import IPlugin
logger = logging.getLogger(__name__)
class DiscovarAssembler(BaseAssembler, IPlugin):
def run(self):
"""
Build the command and run.
Return list of contig file(s)
... |
from StringIO import StringIO
from celery.task import Task
from celery.task.sets import TaskSet, subtask
from dulwich.protocol import ReceivableProtocol
from dulwich.server import ReceivePackHandler
from vacuous.backends import load_backend
from vacuous.backends.dulwich.utils import WebBackend
from vacuous.tasks imp... |
from __future__ import print_function
import IMP
import IMP.test
import IMP.atom
import IMP.core
import IMP.saxs
import os
import time
class Tests(IMP.test.TestCase):
def test_surface_area(self):
"""Check protein surface computation"""
m = IMP.Model()
#! read PDB
mp = IMP.atom.re... |
import os
import re
import shutil
import sublime
import sublime_plugin
from const import *
from listener import *
from statusprocess import *
from asyncprocess import *
class ShowClosureLinterResultCommand(sublime_plugin.WindowCommand):
"""show closure linter result"""
def run(self):
self.window.run_command("s... |
# ./_xlink.py
# -*- coding: utf-8 -*-
# PyXB bindings for NM:b43cd366527ddb6a0e58594876e07421e0148f30
# Generated 2017-10-09 18:48:41.313719 by PyXB version 1.2.6 using Python 3.6.2.final.0
# Namespace http://www.w3.org/1999/xlink [xmlns:xlink]
from __future__ import unicode_literals
import pyxb
from pyxb.binding.data... |
#!/usr/bin/env python
# coding: utf-8
# Lambert Scattering (irrad_method='horvat')
# ============================
#
# Setup
# -----------------------------
# Let's first make sure we have the latest version of PHOEBE 2.2 installed. (You can comment out this line if you don't use pip for your installation or don't wa... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from gaebusiness.business import CommandExecutionException
from tekton.gae.middleware.json_middleware import JsonResponse
from book_app import facade
def index():
cmd = facade.list_books_cmd()
book_list = cmd()
short_form=fac... |
# -*- encoding: LATIN1 -*-
#
# Copyright 2009 Prima Tech.
#
# Licensed under the Environ License, Version 1.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.intip.com.br/licenses/ENVIRON-LICENSE-1.0
#
# Unless required by ... |
#!/usr/bin/env python
###########################################################################
# Copyright (C) 2005 by Janne Oksanen #
# jaosoksa@cc.jyu.fi #
# ... |
#!/usr/bin/env python
import redis
import socket
import struct
import subprocess
import time
TEST_ROUNDS = 50
JAIL_TIME = 95
TEST_SUCCESS = 1
TEST_FAILED = 2
TEST_SVR_NO_RESP = 3
TEST_OTHER = 4
resolvers = [
'216.146.35.35',
'216.146.36.36',
'208.67.222.222',
'208.67.220.220',
]
jail_time = {}
... |
import msp_fr5969_model as model
from msp_isa import isa
# low level wrappers for isa methods
def _as(fmt, name, smode, dmode, fields):
ins = isa.modes_to_instr(fmt, name, smode, dmode)
#print('{:s} {:s} {:s} {:s}'.format(name, smode, dmode, repr(fields)))
words = isa.inhabitant(ins, fields)
return wo... |
# coding: utf-8
# This file is part of Supysonic.
#
# Supysonic is a Python implementation of the Subsonic server API.
# Copyright (C) 2013 Alban 'spl0k' Féron
#
# This program 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 F... |
import asyncio
import struct
class ClientError(Exception):
pass
class InvalidPassword(Exception):
pass
class MinecraftClient:
def __init__(self, host, port, password):
self.host = host
self.port = port
self.password = password
self._auth = None
self._reader = Non... |
import sys
class fastaReader:
def __init__(self, fn):
self.done=False
self.ifile=open(fn)
self.hdr=self.ifile.readline().rstrip()
def __iter__(self):
return self
def next(self):
if self.done:
raise StopIteration
body=''
while True:
... |
# -*- coding: utf-8 -*-
import re
import os
import scrapy
import random
import string
import tempfile
import webbrowser
from os.path import join
from urllib import urlencode
from StringIO import StringIO
from engineshooter.items import SearchResultItem
class BaiduEngine:
name = 'baidu'
BASE_URL = 'https://ww... |
from django.db import models
from django.utils.translation import ugettext as _
from device.models import SnmpDevice
from device.choices import *
# Create your models here.
class PartitionSensor(models.Model):
snmp_device = models.ForeignKey(SnmpDevice, on_delete=models.CASCADE)
enabled = models.BooleanFiel... |
import json
import logging
from google.appengine.ext import ndb
from lib import tools
default_permissions = {'reader': 0, 'administrator': 0}
class User(ndb.Model):
username = ndb.StringProperty()
email = ndb.StringProperty()
password=ndb.StringProperty()
first_name = ndb.StringProperty()
last_... |
# -*- coding: utf-8 -*-
from abc import abstractmethod
from .core import *
class Recurrent(MaskedLayer):
"""
Recurrent Neural Network
"""
@staticmethod
def get_padded_shuffled_mask(mask, pad=0):
"""
change the order of dims of mask, to match the dim of inputs outside
... |
import logging
import os
import sys
import time
import inspect
import shutil
import threading
import traceback
import uuid
from functools import partial
from numbers import Number
from six.moves import queue
from ray.util.debug import log_once
from ray.tune import TuneError, session
from ray.tune.trainable import Tra... |
import MySQLdb, string, sys, time, os, math
from pyslalib import slalib as s
RADTODEG = float('57.295779513082320876798154814105170332405472466564')
DEGTORAD = float('1.7453292519943295769236907684886127134428718885417e-2')
RADTOHRS = float('3.8197186342054880584532103209403446888270314977710')
HRSTORAD = ... |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import pyquery
from django.conf import settings
from django.urls import reverse
from crashstats.crashstats import mode... |
# shell.py
# Shell CLI command.
#
# Copyright (C) 2016 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distribu... |
import uuid
from kolibri.core.auth.test.migrationtestcase import TestMigrations
from kolibri.core.content.models import ChannelMetadata as RealChannelMetadata
from kolibri.core.content.models import ContentNode as RealContentNode
class ChannelFieldsTestCase(TestMigrations):
migrate_from = '0011_auto_20180907_10... |
#Copyright ReportLab Europe Ltd. 2000-2008
#see license.txt for license details
__version__='''$Id: testutils.py 3662 2010-02-09 11:23:58Z rgbecker $'''
__doc__="""Provides support for the test suite.
The test suite as a whole, and individual tests, need to share
certain support functions. We have to put these ... |
from OpenSSL import crypto
from cffi import FFI
ffi = FFI()
class PKCS7VerifyError(Exception):
def __init__(self, message=None, **kwargs):
super(PKCS7VerifyError, self).__init__(
message or ffi.string(crypto._lib.ERR_error_string(crypto._lib.ERR_get_error(), ffi.NULL)),
**kwargs
... |
#
# $Filename$
# $Authors$
# Last Changed: $Date$ $Committer$ $Revision-Id$
#
# Copyright (c) 2003-2011, German Aerospace Center (DLR)
# All rights reserved.
#
#
#Redistribution and use in source and binary forms, with or without
#modification, are permitted provided that the following conditions are
#met:
... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'dlgNewProject.ui'
#
# Created: Fri Apr 01 12:27:36 2016
# by: PyQt4 UI code generator 4.10.2
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except ... |
# Amara, universalsubtitles.org
#
# Copyright (C) 2013 Participatory Culture Foundation
#
# This program 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 3 of the
# License, or (at your op... |
""" Looking at concurrency. Moving two head motors (pitch and yaw),
and logging data simultaneously.
"""
# MEMORY_VALUE_NAMES is the list of ALMemory values names you want to save.
ALMEMORY_KEY_NAMES = [
"Device/SubDeviceList/HeadYaw/Position/Sensor/Value",
"Device/SubDeviceList/HeadYaw/Position/Actuator/Value",
... |
"""RoomMessageLogFetcherFunction
Fetches recent room messages.
"""
from __future__ import print_function
import os
import json
import time
import operator
from multiprocessing.pool import ThreadPool
import boto3
import botocore
from apigateway_helpers.exception import APIGatewayException
from apigateway_helpers.hea... |
from setuptools import setup, find_packages
setup(
name='prometheus-kafka-consumer-group-exporter',
version='0.5.5',
description='Kafka consumer group Prometheus exporter',
url='https://github.com/Braedon/prometheus-kafka-consumer-group-exporter',
author='Braedon Vickers',
author_email='braedon... |
#!/usr/bin/env python3
# vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2018, Kovid Goyal <kovid at kovidgoyal.net>
import concurrent.futures
import os
import shlex
import shutil
import subprocess
from typing import Dict, Iterator, List, Optional, Sequence, Tuple, Union
from . import global_data
from .collect im... |
from resources.lib.gui.guiElement import cGuiElement
from resources.lib.handler.ParameterHandler import ParameterHandler
from resources.lib.config import cConfig
import logger
from resources.lib.gui.gui import cGui
import xbmc
import time
class XstreamPlayer(xbmc.Player):
def __init__(self, *args, **kwargs):
... |
#
# 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 us... |
# coding: utf-8
"""
ORCID Member
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: Latest
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import si... |
#!/usr/bin/env python
"""
The IO Control Block (IOCB) is an object that holds the parameters
for some kind of operation or function and a place for the result.
The IOController processes the IOCBs it is given and returns the
IOCB back to the caller.
"""
from bacpypes.debugging import bacpypes_debugging, ModuleLogg... |
import RPi.GPIO as GPIO
import time
import serial
import threading
import random
class RpiRobotArmButtons(threading.Thread):
def __init__(self):
self.FlagPress_TeachingButton=0
self.FlagPress_InsertMovementButton=0
... |
import random
import os
quotes = []
def init():
global quotes
quotes = []
with open("quotes.txt","r")as f:
quotes = f.read().splitlines()
def quote_handler(string):
if len(quotes) == 0:
return "Error: quotes.txt wasn't initialized properly?"
if string == None:
return quotes[random.randint(0, len(quotes)-1... |
# -*- 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... |
# Copyright 2017 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 or ag... |
"""Markdown widgets"""
from django import forms
from django.utils.safestring import mark_safe
from django.utils.deconstruct import deconstructible
from json import dumps
@deconstructible
class MarkdownTextarea(forms.Textarea):
"""Basic textarea widget for rendering Markdown objects"""
pass
@deconstructibl... |
from matplotlib import pyplot as plt
import matplotlib.ticker as plticker
import seaborn as sns
import pandas as pd
import numpy as np
import math
import warnings
from collections import Counter
import nfldatatools as nfltools
rs_pbp = nfltools.gather_data(playoffs=False)
po_pbp = nfltools.gather_data(playoffs=True)
... |
# -*- coding: utf-8 -*-
# Copyright (c) 2011, Per Rovegård <per@rovegard.se>
# 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 the above copyright
#... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
GetScriptsAndModels.py
---------------------
Date : June 2014
Copyright : (C) 2014 by Victor Olaya
Email : volayaf at gmail dot com
*********************... |
from django.core.urlresolvers import reverse
from unittest2 import skipIf
from django.test import RequestFactory
from django.test.utils import override_settings
from django.test.client import Client
from sqlshare_rest.util.db import get_backend
from sqlshare_rest.test.api.base import BaseAPITest
from sqlshare_rest.test... |
import subprocess
import tempfile
import time
import sys
import os
def have_interface(ifname):
try:
bash_cmd("ip addr show dev \"{0}\"".format(ifname))
except:
return False
return True
def shell_cmd(arr, ignore_fail=False):
if subprocess.call(arr) != 0 and ignore_fail == False:
raise RuntimeError("Command ... |
from typing import Optional, Tuple, Any
from cetus.types import (FiltersType,
FilterType)
from cetus.utils import join_str
from .utils import normalize_value
LOGICAL_OPERATORS = {'AND', 'OR'}
INCLUSION_OPERATORS = {'IN', 'NOT IN'}
RANGE_OPERATORS = {'BETWEEN'}
COMPARISON_OPERATORS = {'=', '!... |
#coding:utf8
import numpy as np
import math
import pylab as pl
import matplotlib.cm as cm
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import json
class GraphTree:
def __init__(self):
self.jsonobj = {}
self.leafNode = dict(boxstyle = 'roun... |
# Copyright 2015-present The Scikit Flow 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 require... |
import pdfkit
import re
import urllib2
import os
from urlparse import urlparse
# Open the file
with open ("ref_liste.bib", "r") as myfile:
data=myfile.read()#.replace('\n', '')
# Create the list
listOrig = re.findall("url = {.+}", data)
listStripped = []
# Strip the url = { and } and store in listStripped
for l... |
import pygen
from unittest_helper import BaseDockerTestCase
class GeneratorTest(BaseDockerTestCase):
app = None
def tearDown(self):
super(GeneratorTest, self).tearDown()
if hasattr(self, 'app') and self.app:
self.app.api.close()
def test_generate(self):
test_containe... |
import django.dispatch
from rest_framework import serializers
from heritages.models import Heritage, BasicInformation, Origin, Tag, Multimedia, Selector, AnnotationTarget, \
AnnotationBody, Annotation, User
class BasicInformationSerializer(serializers.ModelSerializer):
class Meta:
model = BasicInform... |
#!/usr/bin/env python
import unittest
import socket
import struct
from framework import VppTestCase, VppTestRunner
from vpp_neighbor import VppNeighbor
from vpp_ip_route import find_route
from util import mk_ll_addr
from scapy.layers.l2 import Ether, getmacbyip, ARP
from scapy.layers.inet import IP, UDP, ICMP
from s... |
#
# Copyright (c) 2014 Chris Jerdonek. All rights reserved.
#
# 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, modi... |
# -* coding: utf-8 -*-
from hashlib import md5
from pyrcp import *
import pyrcp.db as pydb
from flask import Flask, request, redirect, render_template
from flask_login import (LoginManager, login_required, login_user,
current_user, logout_user, UserMixin, AnonymousUserMixin)
from itsdangerous i... |
from south.db import db
from django.db import models
from commoner.profiles.models import *
class Migration:
def forwards(self, orm):
# Adding model 'CommonerProfile'
db.create_table('profiles_commonerprofile', (
('id', orm['profiles.CommonerProfile:id']),
('u... |
# 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 u... |
"""
events.py
Defines a simple event handler system similar to that used in C#. Events allow
multicast delegates and arbitrary message passing. They use weak references so
they don't keep their handlers alive if they are otherwise out of scope.
"""
import weakref
import maya.utils
from functools import partial, wrap... |
from .base_cmdline import *
def is_spatial(parser):
parser.add_argument(
'--is_geospatial',
'-geo',
'-g',
action="store_true",
help="add geometry columns"
)
def db_parser(prog_name='bin/loader', tables=['Could be (Decarative) Base.metadata.sorted_tables'], url_require... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.