src stringlengths 721 1.04M |
|---|
import PyPDF2
import tkinter as tk
import tkinter.ttk as ttk
import tkinter.filedialog as fd
class Application(tk.Frame):
def __init__(self, master=None):
root = tk.Tk()
root.iconbitmap('icon\\interleave-pdf.ico')
self.input_path = tk.StringVar();
self.output_path = tk.StringVar();
ttk.Frame.__init__(self... |
#!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2014 Thomas Voegtlin
#
# 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 y... |
from time import sleep
import os
import re
import subprocess
import sys
from setuptools.command.test import test as TestCommand
from setuptools import setup, Command
try:
# Python 2 backwards compat
from __builtin__ import raw_input as input
except ImportError:
pass
readme = os.path.join(os.path.dirname(__... |
#
# Copyright 2012 Cisco Systems, Inc.
#
# Author: Soren Hansen <sorhanse@cisco.com>
#
# 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... |
# -*- coding: utf-8 -*-
# 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... |
# test_wallet.py
import pytest
from wallet import Wallet, InsufficientAmount, NegativeTransaction
@pytest.fixture
def empty_wallet():
'''Returns a wallet with balance = 0
'''
return Wallet()
@pytest.fixture
def wallet():
'''Returns a wallet with balance = 20
'''
return Wallet(20)
def test_default_initia... |
"""
BaseClasses.py
INTRODUCTION
YNABpy - A Python module for the YNAB (You Need A Budget) application.
AUTHOR
Mark J. Nenadov (2011)
* Essex, Ontario
* Email: <marknenadov@gmail.com>
LICENSING
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public... |
def generate():
return list('?'*32)
def resolveAND(i, j):
if i == '?' and j == '?':
return '?'
if (i == '?' or j == '?') and (i == '0' or j == '0'):
return '0'
if (i == '?' or j == '?') and (i == '1' or j == '1'):
return '?'
b = bool(int(i)) and bool(int(j))
return s... |
#!/usr/bin/python
#prueba de red LSTM
#genera grafica de las senales de entrada y la respuesta de la redes
#entrada senoidal
from __future__ import division
import numpy as np
from pybrain.datasets import SequentialDataSet
from itertools import cycle
from pybrain.supervised import RPropMinusTrainer
from sys import std... |
# -*- coding: utf-8 -*-
#
# sigi.apps.ocorrencias.forms
#
# Copyright (c) 2015 by Interlegis
#
# GNU General Public License (GPL)
#
# 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... |
from sublime_plugin import WindowCommand, TextCommand
import sublime
__all__ = ['ST2', 'ST3', 'WindowAndTextCommand', 'Settings', 'FileSettings']
ST2 = sublime.version().startswith('2')
ST3 = not ST2
class WindowAndTextCommand(WindowCommand, TextCommand):
"""A class to derive from when using a Window- and a Tex... |
from models import *
from run import db
import sys
import math
import hashlib
import time
from communication import sendPickNotificationEmail
'''DATABASE INSERTION/UPDATE'''
#Adds driver to database
def addDriver(id, alias, oLat, oLon, dLat, dLon, date):
url = makeURL(id)
driver = Driver(id, alias, oLat, oLon, dLa... |
# 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 use ... |
#! /usr/bin/python
"""
QoSPath.py ---------------------------------------------------------------------------------------------------
Developed By: Ryan Wallner (ryan.wallner1@marist.edu)
Add QoS to a specific path in the network. Utilized circuit pusher developed by KC Wang
[Note]
*circuitpusher.py is needed in the s... |
# -*- coding: utf-8 -*-
import json
import re
from module.network.RequestFactory import getURL
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class OpenloadIo(SimpleHoster):
__name__ = "OpenloadIo"
__type__ = "hoster"
__version__ = "0.10"
__status__ = "testing"
... |
# Source: http://en.wikipedia.org/wiki/Centripetal_Catmull%E2%80%93Rom_spline
# http://people.wku.edu/qi.li/teaching/446/cg14_curve_surface.pdf
import numpy as np
from utils import distance
def CatmullRomSpline(P0, P1, P2, P3, nPoints=100):
"""
P0, P1, P2, and P3 should be (x,y) point pairs that define the Cat... |
#!/usr/bin/env python3
# Copyright (c) 2015-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
'''
Test script for security-check.py
'''
import subprocess
import unittest
def write_testcode(filename)... |
#-------------------------------------------------------------------------------
#
# Copyright (c) 2007, Enthought, Inc.
# All rights reserved.
#
# This Software is provided without warranty under the terms of the
# BSD
# license included in /LICENSE.txt and may be redistributed only
# under the conditions descri... |
import urllib2
import os
import time
import datetime
delay = 180 # seconds => 3 minutes
max_fails = 4 # * 3 minutes => 12 minutes
max_hard_fails = 960 # * 3 minutes => 2 days
check_url = "http://pass.telekom.de/home?continue=true"
second_check_url = "http://test.kurz.pw/test.html" # just in case pass.telekom.de is do... |
import unittest
import command
import re
from datetime import timedelta
class CommandTest(unittest.TestCase):
def test_command(self):
''' Test the base class throws errors correctly
This test case was written by binki to show me how to write test cases
'''
failed_to_throw =... |
# 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... |
# -*- coding: utf-8 -*-
# <nbformat>3.0</nbformat>
# <markdowncell>
# Hack BroBeur
# <markdowncell>
# python script to make account at centre for logins.
# <codecell>
from github import Github
import os
import getpass
import git
import time
from clint.textui import colored
import dominate
from dominate.tags impo... |
# Copyright 2013 Mirantis 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 ... |
"""
tests/test_notifiers.py
The latest version of this package is available at:
<https://github.com/jantman/piface_webhooks>
################################################################################
Copyright 2015 Jason Antman <jason@jasonantman.com> <http://www.jasonantman.com>
This file is part of pifac... |
from tests.mixins.base import BaseMixin
class LocationTestsMixin(BaseMixin):
def test_location_is_comma_separated_string(self):
query = self.api_call(locations="L001,L002")[1]
self.assertTrue(query["r"], "L001,L002")
def test_location_string_whitespace_is_removed(self):
query = self.a... |
# Note: Following stuff must be considered in a GangaRepository:
#
# * lazy loading
# * locking
from GangaCore.Core.GangaRepository import GangaRepository, RepositoryError, InaccessibleObjectError
from GangaCore.Utility.Plugin import PluginManagerError
import os
import os.path
import time
import errno
import copy
impo... |
# 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 __future__ import absolute_import
import logging
import time
import threading
from appenlight_client.utils import import_from_module
from datetime import datetime, timedelta
from functools import wraps
from operator import itemgetter
default_timer = time.time
class AppenlightLocalStorage(object):
def __in... |
from .compat import int_types, string_types, binary_types
def check_type(value, typ):
if not isinstance(value, typ):
raise TypeError('type %s is expected, but %s is given' % (typ, type(value)))
def check_types(value, types):
if isinstance(value, types):
return
t = ', '.join([str(t) for t i... |
__author__ = 'Andrzej Skrodzki - as292510'
from .LatteParsers.LatteTypes import *
from .LatteParsers.LatteExpressions import *
from .LatteParsers.LatteParameters import *
from .LatteParsers.LatteStatements import *
from .LatteParsers.LatteTopDefinitions import *
from .LatteExceptions import *
import ply.yacc as yacc
... |
# Copyright (c) 2015 The Pycroft Authors. See the AUTHORS file.
# This file is part of the Pycroft project and licensed under the terms of
# the Apache License, Version 2.0. See the LICENSE file for details.
import string
import pytest
from wtforms_widgets.fields.core import DateField
__author__ = 'shreyder'
def te... |
import os
#checks if settings.ini should be generated. if not given universe, username and password it will generate a settings.ini with the default account
#This settings_generator will only work for universe 82 if the flag argument is given als True(to make sure that universe 82 is intended)
def settings_generator(... |
'''
uix.textinput tests
========================
'''
import unittest
from kivy.tests.common import GraphicUnitTest
from kivy.uix.textinput import TextInput
class TextInputTest(unittest.TestCase):
def test_focusable_when_disabled(self):
ti = TextInput()
ti.disabled = True
ti.focused = Tr... |
"""
ve_phantom.py - setup sge scripts to launch sims on the cluster
Guassian excitation sims for UWM for soft, VE phantoms and processing phase
velocity information.
"""
__author__ = 'Mark Palmeri'
__date__ = '2014-10-16'
import os
# define some stuff
G0 = [10.0] # kPa
GI = [1.0] # kPa
ETA = [0.01, 1.0, 3.0, 6.0,... |
# -*- coding: utf-8 -*-
# Copyright 2017 ProjectQ-Framework (www.projectq.ch)
#
# 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
#
# ... |
# Copyright (C) 2020 Leandro Lisboa Penz <lpenz@lpenz.org>
# This file is subject to the terms and conditions defined in
# file 'LICENSE', which is part of this source code package.
'''ansible playbook checker'''
import yaml
import subprocess
import re
from omnilint.error import Error
from omnilint.checkers import Ch... |
#! /usr/bin/python
import numpy as np
import getelec_mod as gt
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import matplotlib as mb
font = 30
# mb.rcParams["font.family"] = "Serif"
mb.rcParams["font.size"] = font
mb.rcParams["axes.labelsize"] = font
mb.rcParams["xtick.labelsize"] = font
mb.... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'D:\EpubBuilder\ui_mainwindow.ui'
#
# Created: Mon Feb 22 23:49:35 2016
# by: PyQt5 UI code generator 5.4
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
... |
def element_dict_to_tuple(my_dict):
"""Of type Element"""
if 'hid' not in my_dict:
my_dict['hid'] = None
if 'name' not in my_dict:
my_dict['name'] = None
if 'type' not in my_dict:
my_dict['type'] = None
if 'state' not in my_dict:
my_dict['state'] = None
if 'over... |
#!/usr/bin/env python
from ethereum.tools import tester
from ethereum.tools.tester import TransactionFailed
from pytest import raises, fixture
from utils import AssertLog, longToHexString, bytesToHexString, stringToBytes, longTo32Bytes, garbageAddress, garbageBytes20, garbageBytes32, twentyZeros, thirtyTwoZeros
from s... |
#! /usr/bin/env python
"""This script handles reading command line arguments and starting the
training process. It shouldn't be executed directly; it is used by
run_nips.py or run_nature.py.
"""
import os
import argparse
import logging
import ale_python_interface
import cPickle
import numpy as np
import theano
impor... |
# -*- coding: utf-8 -*-
import urlparse
from openerp.osv import osv, fields
class view(osv.osv):
_inherit = "ir.ui.view"
def save_embedded_field(self, cr, uid, el, context=None):
Model = self.pool[el.get('data-oe-model')]
field = el.get('data-oe-field')
column = Model._all_column... |
"""
Test the virtual mail management commands.
"""
import sys
import StringIO
from django.core.management import call_command
from django.core.management.base import CommandError
from django.test import TestCase
from ..models import MailUser, Domain, Alias
class BaseCommandTestCase(object):
fixtures = ['vmail_... |
from .util import TestCase, load_json_fixture
from babbage.model import Model
class ModelTestCase(TestCase):
def setUp(self):
super(ModelTestCase, self).setUp()
self.simple_model_data = load_json_fixture('models/simple_model.json')
self.simple_model = Model(self.simple_model_data)
de... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012, Red Hat, 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
#
... |
import os
import json
import requests
from base import *
from server.settings.settings_model import Settings
# Use the App Engine Requests adapter. This makes sure that Requests uses URLFetch.
from requests_toolbelt.adapters import appengine
appengine.monkeypatch()
DEBUG = False
SECURE_PROXY_SSL_HEADER = ('HTTP_X_F... |
from datetime import datetime
import gpgme
from io import BytesIO
class PublicKey:
def __init__(self, fp):
if isinstance(fp, str):
fp = BytesIO(bytes(fp, "ascii"))
elif isinstance(fp, bytes):
fp = BytesIO(fp)
self.ctx = gpgme.Context()
self.ctx.armor = Fals... |
from django.db import models
from django.core.urlresolvers import reverse
from django.db.models.signals import post_save
from django.utils.text import slugify
from django.utils.safestring import mark_safe
# Create your models here.
class ProductQuerySet(models.query.QuerySet):
def active(self):
return self.filter(a... |
# Copyright 2018 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... |
#
# 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 django.shortcuts import render
from . import forms
from django.core.urlresolvers import reverse
from django.contrib.auth.decorators import login_required
from django.http import HttpResponse, HttpResponseRedirect
from django.contrib.auth import authenticate,login,logout
# Create your views here.
@login_required... |
# Copyright 2009 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Database classes including and related to CodeImportMachine."""
__metaclass__ = type
__all__ = [
'CodeImportMachine',
'CodeImportMachineSet',
]
from sqlobject imp... |
# Copyright (c) 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... |
# -*-python-*-
# GemRB - Infinity Engine Emulator
# Copyright (C) 2003 The GemRB Project
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) ... |
"""
* Copyright 2007 Fred Sauer
*
* 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... |
# -*- coding: utf-8 -*-
# Django settings for mds_website project.
import os
DEBUG = True
TEMPLATE_DEBUG = DEBUG
PROJECT_DIR = os.path.dirname(__file__)
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.contrib.gis.db.backends.pos... |
#!/usr/bin/python
# geocode_csv.py
# A script to geocode the "address" column in a CSV and outputing the result
# into a new CSV with "latitude" and "longitude" columns
#
# Author: Falcon Dai
# Date: 4/7/2013
# License: MIT License
if __name__ == '__main__':
import sys, csv, time
from batch_geocode im... |
'''
Created on 24.06.2010
@author: mhoefli
'''
import random
import re
def readProbabilities(pbfile):
"""Reads in probabilities from a specific probability file, 1st colum is the regexp to match, 2nd the name and 3rd the probability in the ensemble"""
with open(pbfile) as pfh:
probabilities = []
... |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
"""Manage remote docker containers as first class citizens.
A possible workflow would be to start your containers using the method of
your choice and build the list of available dockers using the
:py:func:`enoslib.docker.get_dockers` function.
A ``DockerHost`` is a specialization of a ``Host`` and thus can be fed int... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import random
import unittest
from mock import patch
from mock import MagicMock as Mock
import pyrax
import pyrax.autoscale
from pyrax.autoscale import AutoScaleClient
from pyrax.autoscale import AutoScalePolicy
fr... |
#!/usr/bin/env python
# This file was copied from the phylesystem-api repo and is intended
# to replace it.
from ConfigParser import SafeConfigParser
from cStringIO import StringIO
import requests
import gzip
import json
import sys
import os
_CONFIG = None
_CONFIG_FN = None
if 'VERBOSE_TESTING' in os.environ:
tr... |
from kqml import KQMLList, KQMLString
from tfta.tfta import TFTA
from tfta.tfta_module import TFTA_Module
from bioagents.tests.util import ekb_from_text, ekb_kstring_from_text, \
get_request, agent_clj_from_text
from bioagents.tests.integration import _IntegrationTest, _FailureTest
from... |
"""
This defines a the Server's generic session object. This object represents
a connection to the outside world but don't know any details about how the
connection actually happens (so it's the same for telnet, web, ssh etc).
It is stored on the Server side (as opposed to protocol-specific sessions which
are stored o... |
import math
import random
class ColorSelector:
def __init__(self):
self._colors_for_selection = ['F94F48', 'FF6A41', 'B4B4B4', 'D5D5D5', 'E973F5', '237FEA',
'F2B838', '19EC5A', '2395DE', 'D4B57F', 'FFD700']
self._colors_already_selected = []
def get_ran... |
# coding: utf-8
__author__ = 'linlin'
import os
import logging
import re
import pdb
logger = logging.getLogger(__name__)
################################################################
root_dir = '/home/linlin/time/0903_classify_false_start/1003_raw_features/'
separator = '\t\t'
#####################################... |
# Copyright 2017 Canonical Ltd.
# Licensed under the LGPLv3, see LICENCE file for details.
import abc
import macaroonbakery as bakery
class Identity(object):
''' Holds identity information declared in a first party caveat added when
discharging a third party caveat.
'''
__metaclass__ = abc.ABCMeta
... |
from sprox.fillerbase import FillerBase, TableFiller, EditFormFiller, AddFormFiller, FormFiller, ConfigBaseError
from sprox.test.base import setup_database, sorted_user_columns, SproxTest, User, Example
from nose.tools import raises, eq_
session = None
engine = None
connection = None
trans = None
def setup():
glo... |
# VDSM REST API
# Copyright (C) 2011 Adam Litke, IBM Corporation
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, ... |
#!/usr/bin/env python
###############################################################################
# $Id: elas.py 32163 2015-12-13 17:44:50Z goatbar $
#
# Project: GDAL/OGR Test Suite
# Purpose: Test ELAS driver
# Author: Even Rouault, <even dot rouault at mines dash paris dot org>
#
############################... |
import argparse
from psi.application import (add_default_options, launch_experiment,
parse_args)
from psi.application.experiment_description import experiments
def main():
class ControllerAction(argparse.Action):
def __call__(self, parser, namespace, value, option_string=None... |
from keras.layers import LSTM, Dropout, Dense
from keras.models import Sequential
from keras import backend as KB
from keras.layers.core import K
from keras.objectives import categorical_crossentropy
import tensorflow as tf
import numpy as np
import word2vec2
tf.set_random_seed(1001)
f = open("cleanedRapLyrics.txt")
... |
"""
Filters for jurisdiction Views
"""
# Third Party
import django_filters
from dal import forward
# MuckRock
from muckrock.core import autocomplete
from muckrock.jurisdiction.models import Exemption, Jurisdiction
LEVELS = (("", "All"), ("f", "Federal"), ("s", "State"), ("l", "Local"))
class JurisdictionFilterSet(... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2017, Wei Gao <gaowei3@qq.com>
# Copyright: (c) 2018, Ansible Project
#
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE... |
# Copyright (c) 2006-2008 The Regents of The University of Michigan
# 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 ... |
#!/usr/bin/env python
"""
A GUI to help user take snapshot with hand camera
"""
import rospy
import struct
import Tkinter as tk
import tkFileDialog, tkMessageBox
import tkSimpleDialog
from baxter_interface.camera import CameraController
from PIL import Image
from PIL import ImageTk, ImageDraw
import numpy as np
f... |
import gc
import sys
import time
import blinker
from nose.tools import assert_raises
jython = sys.platform.startswith('java')
pypy = hasattr(sys, 'pypy_version_info')
def collect_acyclic_refs():
# cpython releases these immediately without a collection
if jython or pypy:
gc.collect()
if jython... |
import os
import re
import math
import maya.cmds as m
from fxpt.fx_refsystem.com import messageBoxMaya, globalPrefsHandler, getRelativePath, getRefRootValue, expandPath
from fxpt.fx_refsystem.log_dialog import log
from fxpt.fx_refsystem.ref_handle import RefHandle, ATTR_REF_FILENAME, REF_NODE_SUFFIX, INSTANCES_SOURCE... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import enum
import importlib
import platform
class Location(enum.Enum):
"""Describe the different locations that can be queried using functions
such as :func:`.get_writable_path` and :func:`.get_standard_paths`.
Some of the values in this enum represent a us... |
# Copyright 2012, 2013 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Fake Provisioning API.
:class:`FakeSynchronousProvisioningAPI` is intended to be useful in a Django
environment, or similar, where the Provisioning API is being used via
... |
#!/usr/bin/env python
from __future__ import print_function
from __future__ import unicode_literals
import sys
import time
import argparse
from os import getenv
from os.path import expanduser
from threading import Thread
try:
from Queue import Queue
except:
from queue import Queue
import dropbox
PY2 = (s... |
from mako.template import Template
t_str = '''
// enum count
template<>
constexpr int EnumCount<${T}>() { return ${length}; }
// string array
static const char* ${T}Strings[] =
{
${CStrings}
};
// cstring array
template<>
inline constexpr const char** EnumToCStringArray<${T}>()
{
return ${T}Strings;
}
// ind... |
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import (
compat_parse_qs,
compat_urllib_parse_urlparse,
)
from ..utils import (
determine_ext,
dict_get,
int_or_none,
try_get,
urljoin,
compat_str,
)
class SVTBaseIE(Info... |
# coding:utf-8
import platform
import sys
sys.path.append("../")
if 'twisted.internet.reactor' not in sys.modules:
if platform.system() == "Linux":
from twisted.internet import epollreactor
epollreactor.install()
else:
from twisted.internet import iocpreactor
iocpreactor.inst... |
#!/usr/bin/env python
import argparse
import os.path
import sys
import collections
# -i 10000 -s 20
# -i 10010000000110000 -s 272
# -i 10010000000110000 -s 35651584
def get_options(argv=None):
"""parse the commandline options.
Check for all supported flags and do any available pre-processing
"""
opts = argpa... |
from django import forms
from extras.forms import (
AddRemoveTagsForm, CustomFieldModelForm, CustomFieldBulkEditForm, CustomFieldFilterForm, CustomFieldModelCSVForm,
)
from extras.models import Tag
from utilities.forms import (
BootstrapMixin, CommentField, CSVModelChoiceField, CSVModelForm, DynamicModelChoice... |
"""
Django settings for hiren project.
Generated by 'django-admin startproject' using Django 1.9.5.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
impo... |
# encoding: utf-8
from django.db import models
from django.contrib.auth.models import User, Group
class Address(models.Model):
"""
Address Model
contains just searchname and E-Mail. Rest is configurable by
Contactdata
"""
adr_searchname = models.CharField(verbose_name=u'Name', max_length=255)... |
import unittest
from .context import SpreadsheetServer, SpreadsheetClient
from time import sleep
import os, shutil
import sys
import logging
PY2 = sys.version_info[0] == 2
PY3 = sys.version_info[0] == 3
EXAMPLE_SPREADSHEET = "example.ods"
SOFFICE_PIPE = "soffice_headless"
SPREADSHEETS_PATH = "./spreadsheets"
TESTS_PA... |
# Handle application process
from datetime import datetime
from members.models import Person, Membership, Subscription, TextBlock, AdultApplication
from members.services import (
subscription_create,
subscription_activate,
subscription_create_invoiceitems,
invoice_create,
)
from cardless.services impo... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Regular expression triggers on user messages."""
import re
from random import randint
import util.cfg
bot = None
triggers = {}
def init(botInstance):
"""Inits the msgTrigger module"""
global bot, triggers
bot = botInstance
util.cfg.default = trigge... |
"""Global flag for DEBUG printing """
DEBUG_MODE = True
"""Global Constants"""
CORPUS_SPLIT = 3
EXCLUSION_LIST_FOR_LIVE_DEMO = []
def d_print(first_msg, *rest_msg, source='?'):
"""
Global debug print function; use by importing 'meta' and calling: meta.d_print(...)
:param first_msg: your debug message, pa... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
from goods.models import Stock
def insertDefaultCargoIDs(apps, schema_editor):
"""inserts the default stock IDs for the newly created OneToOneField"""
Ship = apps.get_model("ships", "Ship")
for ship in... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import argparse
import bisect
import itertools
import logging
import random
import re
import string
import sys
import platform
from math import sqrt
from threading import currentThread, Thread
from time import time
try:
from htt... |
from sqlalchemy import Column, Integer, String, ForeignKey, Boolean, Float
from sqlalchemy.orm import relationship
from base import Base
from unit import Unit
class Variable(Base):
__tablename__ = 'Variables'
id = Column('VariableID', Integer, primary_key=True)
code = Column('VariableCode', String, nul... |
from django.conf.urls import url
from api.collections import views
app_name = 'osf'
urlpatterns = [
url(r'^$', views.CollectionList.as_view(), name=views.CollectionList.view_name),
url(r'^(?P<collection_id>\w+)/$', views.CollectionDetail.as_view(), name=views.CollectionDetail.view_name),
url(r'^(?P<colle... |
from Orange.data import Table
from Orange.classification.majority import MajorityLearner, ConstantModel
from Orange.preprocess.preprocess import Preprocess
from Orange.widgets import widget, gui
from Orange.widgets.settings import Setting
class OWMajority(widget.OWWidget):
name = "Majority"
description = "Cla... |
# Copyright (c) 2011 OpenStack, LLC.
# 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 requi... |
# Copyright (c) 2019 Manfred Moitzi
# License: MIT License
from typing import cast
import pytest
import ezdxf
from ezdxf.entities.idbuffer import FieldList
from ezdxf.lldxf.tagwriter import TagCollector, basic_tags_from_text
FIELDLIST = """0
FIELDLIST
5
0
102
{ACAD_REACTORS
330
0
102
}
330
0
100
AcDbIdSet
90
12
100
Ac... |
# -*- 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.