code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
# built-in libraries
import argparse
import os
# scientific libraries
import numpy as np
import numpy.ma as ma
import h5py
# others
from joblib import Parallel, delayed
import sys
# my statistics library
sys.path.append(r'D:\stephen\code\statstools')
import stats
import tsstats
# wormtracker package
sys.path.appen... | stephenhelms/WormTracker | python/calculate_correlation_functions.py | Python | apache-2.0 | 7,055 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 Red Hat, Inc.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUME... | andmos/ansible | lib/ansible/modules/cloud/ovirt/ovirt_template.py | Python | gpl-3.0 | 25,051 |
#!/usr/bin/env python
#
# WCSimDev
#
# The HyperK WCSim development version
#
# Author P G Jones - 2014-06-20 <p.g.jones@qmul.ac.uk> : New file.
####################################################################################################
import nusoft.package.local as local_package
import os
import nusoft.envfi... | pgjones/nusoft | packages/hyperk/wcsim_dev.py | Python | mit | 3,401 |
import unittest
from src.position import Position
class TestPosition(unittest.TestCase):
def test_getters(self):
position = Position(1, 2)
x = position.get_horizontal_position()
y = position.get_vertical_position()
self.assertEqual(x, 1)
self.assertEqual(y, 2)
def tes... | georgidimov/cannon-wars | tests/test_position.py | Python | gpl-2.0 | 1,788 |
#-------------------------------------------------------------------------------
# Name: module1
# Purpose:
#
# Author: calebma
#
# Created: 04/03/2016
# Copyright: (c) calebma 2016
# Licence: <your licence>
#-------------------------------------------------------------------------------
import os... | Bolton-and-Menk-GIS/GPServices_Workshop_2016 | GP/python/mailing.py | Python | gpl-3.0 | 2,811 |
from .element import *
from . import mtoken
class MRow(Element):
class Strategy:
def layout(self, elements):
"""Set positions of elements in a row;
Returns (width, height, axis) of row"""
global_axis = 0
max_height_non_stretchy = 0
max_height_stretchy = 0
max_dep... | ahjulstad/mathdom-python3 | mathml/pmathml/mrow.py | Python | mit | 5,197 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-03-31 00:18
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('BloggingAPI', '0003_post_image'),
]
operations = [
migrations.RenameField(
... | pmaidens/CMPUT404-project | BloggingAPI/BloggingAPI/migrations/0004_auto_20160331_0018.py | Python | apache-2.0 | 432 |
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.http import HttpResponse
import changevolume
def home(request):
return render_to_response('sonoro.html', {
'changed' : False,
'current_volume': changevolume.get_volume(),
}
)
def set_... | aroman/telecomando | sonoro/views.py | Python | gpl-3.0 | 619 |
import pytest
from .addons import hardware_nvidia_gpu, using
import json
import qcengine as qcng
import psi4
pytestmark = [pytest.mark.smoke, pytest.mark.quick]
@using("gdma")
def test_gdma():
"""gdma1"""
#! Water RHF/cc-pVTZ distributed multipole analysis
ref_energy = -76.0571685433842219
ref_dm... | jturney/psi4 | tests/pytests/test_addons.py | Python | lgpl-3.0 | 54,248 |
"""
Django settings for exchange_rates project.
Generated by 'django-admin startproject' using Django 1.10.6.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
im... | romulocollopy/exchange_rates | project/settings/base.py | Python | mit | 3,523 |
# ===============================================================================
# Copyright 2014 Jake Ross
#
# 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... | USGSDenverPychron/pychron | pychron/core/ui/qt/combobox_editor.py | Python | apache-2.0 | 7,255 |
from registry import event_registry
def autodiscover():
"""
Auto-discover INSTALLED_APPS events.py modules and fail silently when
not present. This forces an import on them to register any admin bits they
may want.
"""
import copy
from django.conf import settings
from django.utils.impo... | ministryofjustice/cla_backend | cla_backend/apps/cla_eventlog/__init__.py | Python | mit | 1,313 |
import os
import uuid
import flask
import bus
import http_response as http
import queries
import handlers
import commands
class Server(flask.Flask):
def __init__(self, import_name, repository=None):
self.bus = None
self.query_dispatcher = None
self.repository = repository
root_... | guillaumevincent/rangevoting | server.py | Python | mit | 3,765 |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
LDMP - A QGIS plugin
This plugin supports monitoring and reporting of land degradation to the UNCCD
and in support of the SDG Land Degradation Neutrality (LDN) target.
-------------... | ConservationInternational/ldmp-qgis-plugin | LDMP/test/unit/test_dialog_settings.py | Python | gpl-2.0 | 2,713 |
from __future__ import absolute_import
from __future__ import print_function
import filecmp
import os
import ujson
from django.core import mail
from django.http import HttpResponse
from django.test import override_settings
from mock import patch
from typing import Any, Dict, List, Mapping
from zerver.lib.actions imp... | vaidap/zulip | zerver/tests/test_bots.py | Python | apache-2.0 | 39,111 |
from unittest import TestCase
from mock import Mock, patch
from describe.mock.registry import Registry
class TestRegistry(TestCase):
def test_starts_with_no_registries(self):
self.assertEqual(Registry.registries, [])
def test_creating_registries_add_to_master_list(self):
n = len(Registry.re... | jeffh/describe | tests/describe/mocks/test_registry.py | Python | mit | 957 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
import json
from frappe import msgprint, _
from frappe.utils import cstr, flt, cint, getdate, now_datetime, formatdate
from frappe.website... | meisterkleister/erpnext | erpnext/stock/doctype/item/item.py | Python | agpl-3.0 | 20,758 |
__author__ = 'Joe Linn'
#import pylastica.filter.abstractfilter
from .abstractfilter import AbstractFilter
class BoolNot(AbstractFilter):
def __init__(self, filter_object):
super(BoolNot, self).__init__()
self.set_filter(filter_object)
def set_filter(self, filter_object):
"... | jlinn/pylastica | pylastica/filter/boolnot.py | Python | apache-2.0 | 831 |
from src.graphDb import *
db = 'db/test.db'
def test_text_format():
assert text_format("asdkjhaeih") == "asdkjhaeih"
assert text_format("as&dkj>hae<ih") == "as&dkj>hae<ih"
assert text_format("") == ""
def test_creatingGroups():
conn = sqlite3.connect(db)
conn.execute("INSERT INTO TW... | planaspa/Data-Mining | tests/test_graphDb.py | Python | mit | 4,201 |
from django.test import TestCase
from rest_framework_captcha.generators import default
class DefaultGeneratorTestCase(TestCase):
def test_default_generator_returns_6_char_string(self):
self.assertTrue(len(default()) == 6)
| leonardoarroyo/rest-framework-captcha | rest_framework_captcha/tests/test_generators.py | Python | mit | 229 |
from os import environ
from django.core.urlresolvers import reverse
from rest_framework import status
from rest_framework.test import APISimpleTestCase
GATHERER_URI = 'http://gatherer.wizards.com/Handlers/Image.ashx?type=card'
TEST_CARD = 'manor skeleton'
TEST_CARD_GATHERER_URI = 'http://gatherer.wizards.com/Handle... | mmedal/magicbot | tests/test_api.py | Python | mit | 2,038 |
# -*- coding: utf-8 -*-
u"""Common execution template.
:copyright: Copyright (c) 2015 RadiaSoft LLC. All Rights Reserved.
:license: http://www.apache.org/licenses/LICENSE-2.0.html
"""
from __future__ import absolute_import, division, print_function
from pykern import pkio
from pykern import pkjinja
from pykern.pkcoll... | mrakitin/sirepo | sirepo/template/template_common.py | Python | apache-2.0 | 16,587 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import getopt
import codecs
import collections
import pulp
from . import tools
def summarize(text, char_limit, sentence_filter=None, debug=False):
'''
select sentences in terms of maximum coverage problem
Args:
text: text to be summarized (... | iinm/summpy | summpy/mcp_summ.py | Python | mit | 3,773 |
#!/usr/bin/env python
# Jonas Schnelli, 2013
# make sure the Chipcoin-Qt.app contains the right plist (including the right version)
# fix made because of serval bugs in Qt mac deployment (https://bugreports.qt-project.org/browse/QTBUG-21267)
from string import Template
from datetime import date
bitcoinDir = "./";
in... | chipcoins/chipcoin | share/qt/clean_mac_info_plist.py | Python | mit | 897 |
import sys
class KaffeError(Exception):
pass
# Ordering of the blobs
IDX_WEIGHTS = 0
IDX_BIAS = 1
# The tensors are ordered (c_o, c_i, h, w) or (n, c, h, w)
IDX_N = 0
IDX_C = 1
IDX_C_OUT = 0
IDX_C_IN = 1
IDX_H = 2
IDX_W = 3
def print_stderr(msg):
sys.stderr.write('%s\... | polltooh/FineGrainedAction | nn/kaffe/base.py | Python | mit | 328 |
# Created By: Virgil Dupras
# Created On: 2009-11-25
# Copyright 2015 Hardcoded Software (http://www.hardcoded.net)
#
# This software is licensed under the "GPLv3" License as described in the "LICENSE" file,
# which should be included with this package. The terms are also available at
# http://www.gnu.org/licenses/gpl-... | mahmutf/dupeguru | qtlib/column.py | Python | gpl-3.0 | 4,488 |
from __future__ import print_function, unicode_literals
from gratipay.testing import Harness
from gratipay.models.team import Team
class TestIsApproved(Harness):
def setUp(self):
Harness.setUp(self)
self.admin = self.make_participant('admin', is_admin=True)
self.alice = self.make_particip... | mccolgst/www.gittip.com | tests/py/test_is_approved.py | Python | cc0-1.0 | 1,698 |
def extractArtegTheBear(item):
"""
Parser for 'Arteg the Bear'
"""
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or 'preview' in item['title'].lower():
return None
if 'WATTT' in item['tags']:
return buildReleaseMessageWithType(item, 'WATTT', vol, chp, frag=frag,... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractArtegTheBear.py | Python | bsd-3-clause | 352 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under th... | openstack/horizon | openstack_dashboard/dashboards/admin/hypervisors/compute/urls.py | Python | apache-2.0 | 1,052 |
# This module manages all endpoints for /api/v1_0/extractors*
from .. import swagger_api, swagger, hierarchy_dict
from . import Resource
from ..models import ExtractorInputModel, ExtractorOutputModel
import json
# from flask_restful import request
from flask import Response, request, jsonify
from mongoengine import V... | usc-isi-i2/dig-crowd-sourcing | adnota/adnota/api/v1_0/views/extractor_route.py | Python | apache-2.0 | 14,764 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# ----------------------------------------------------------------------------
# Xcode 4 template generator for cocos2d project
# (c) 2011 Ricardo Quesada
# (c) 2012 PJ Cabrera, modifications for Emo Framework
#
# LICENSE: Dual License: MIT & GNU GPL v2 Whatever suits you best.... | team-emo/emo-framework | template_generator.py | Python | bsd-3-clause | 5,838 |
# -*- coding: utf-8 -*-
"""
raisin.recipe.transformation
"""
import os
from setuptools import setup, find_packages
version = '1.1.1'
long_description = """The raisin.recipe.transformation package is a Buildout recipe used
for transforming data for the data warehouse of Raisin, the web application used for
publishing ... | rna-seq/raisin.recipe.transformation | setup.py | Python | gpl-3.0 | 2,278 |
from pentest.command import JarvisCmd
import sys
__name__ = "nbtscan"
def main():
args_config = {
"passthrough_args": ["--help", "-h"],
}
cmd = JarvisCmd(sys.argv)
cmd.set_recordable(True)
cmd.set_args_config(args_config)
cmd.run()
| BastienFaure/jarvis | src/pentest/hooks/nbtscan.py | Python | mit | 243 |
from django.contrib import admin
from offers.models import Offer, OfferHistory, OfferReview
admin.site.register(Offer)
admin.site.register(OfferHistory)
admin.site.register(OfferReview)
| cliffton/localsecrets | offers/admin.py | Python | mit | 187 |
#!/usr/bin/env python3
# Copyright (c) 2015-2016 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 bitcoind with different proxy configuration.
Test plan:
- Start bitcoind's with different proxy c... | gamecredits-project/GameCredits | test/functional/proxy_test.py | Python | mit | 8,419 |
# -*- coding: utf-8 -*-
# Begin CVS Header
# $Source: /Volumes/Home/Users/shoops/cvs/copasi_dev/copasi/bindings/python/unittests/Test_CEvaluationTree.py,v $
# $Revision: 1.9 $
# $Name: $
# $Author: shoops $
# $Date: 2012/03/05 18:09:29 $
# End CVS Header
# Copyright (C) 2011 - 2010 by Pedro Mendes, V... | jonasfoe/COPASI | copasi/bindings/python/unittests/Test_CEvaluationTree.py | Python | artistic-2.0 | 3,130 |
'''-------------------------------------------------------------------------
Copyright IBM Corp. 2015, 2015 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/... | Open-I-Beam/swift-storlets | Deploy/playbook/roles/common_files/swift_config.py | Python | apache-2.0 | 7,026 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2013, 2014 CERN.
#
# Invenio is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any... | zenodo/invenio | invenio/modules/documents/api.py | Python | gpl-2.0 | 6,443 |
"""
:mod:`esda` --- Exploratory Spatial Data Analysis
=================================================
"""
import mapclassify
import moran
import smoothing
import getisord
import geary
import join_counts
import gamma
| TaylorOshan/pysal | pysal/esda/__init__.py | Python | bsd-3-clause | 219 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# system
import os
import sys
dir = os.path.split(os.path.split(os.path.split(os.path.realpath(__file__))[0])[0])[0]
sys.path.append(os.path.join(dir, 'scripts'))
# testing
import mock
import unittest
from mock import patch
# program
import download_search.query as Query
... | luiscape/hdx-monitor-download-search | tests/unit/test_query.py | Python | mit | 656 |
import os
import shutil
import pytest
import stat
from IPython.nbformat import write as write_nb
from IPython.nbformat.v4 import new_notebook
@pytest.mark.usefixtures("temp_cwd")
class BaseTestApp(object):
def _empty_notebook(self, path):
nb = new_notebook()
full_dest = os.path.join(os.getcwd(),... | MatKallada/nbgrader | nbgrader/tests/apps/base.py | Python | bsd-3-clause | 1,462 |
def func():
value = "not-none"
<caret>if value is None:
print("None")
return
# Is not none
print(value) | siosio/intellij-community | python/testData/intentions/PyInvertIfConditionIntentionTest/commentsNoElseReturnFollowup.py | Python | apache-2.0 | 137 |
# -*- coding: utf-8 -*-
"""
flask.ext.security.views
~~~~~~~~~~~~~~~~~~~~~~~~
Flask-Security views module
:copyright: (c) 2012 by Matt Wright.
:license: MIT, see LICENSE for more details.
"""
from flask import current_app, redirect, request, render_template, jsonify, \
after_this_request, Blu... | shea256/flask-security | flask_security/views.py | Python | mit | 11,012 |
#
# Copyright 2008-2015 Semantic Discovery, 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 applicab... | KoehlerSB747/sd-tools | src/main/python/util/StatsAccumulator.py | Python | apache-2.0 | 5,869 |
from .._abstract.abstract import BaseSecurityHandler, BaseAGSServer
from ..security.security import AGSTokenSecurityHandler
import json, types
########################################################################
class GeoDataService(BaseAGSServer):
"""
Represents a single mobile service layer
"""
_u... | achapkowski/ArcREST | src/arcrest/ags/_geodataservice.py | Python | apache-2.0 | 3,800 |
from cloudbot import hook
import plugins.log
channel_columns = ['chan NOT NULL',
'admins', 'permissions', 'ops', 'bans', 'disabled', 'ignored', 'badwords', 'flood', 'cmdflood', 'trimlength', 'autoop', 'votekick', 'voteban',
'primary key(chan)']
user_columns = ['nick NOT NULL',
'mask', 'version', 'locat... | ihatevim/aetherbot | cloudbot/util/database.py | Python | gpl-3.0 | 2,405 |
from __future__ import absolute_import, print_function
import traceback
import sys
import click
import itertools
from netlib import tcp
import netlib.utils
from . import flow, filt, contentviews
from .exceptions import ContentViewException
class DumpError(Exception):
pass
class Options(object):
attributes ... | fimad/mitmproxy | mitmproxy/dump.py | Python | mit | 11,044 |
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | wubr2000/googleads-python-lib | examples/adxbuyer/v201506/basic_operations/__init__.py | Python | apache-2.0 | 631 |
# Author: Mathieu Blondel <mathieu@mblondel.org>
# License: BSD 3 clause
import time
import matplotlib.pyplot as plt
from sklearn.utils import check_random_state
from sklearn.metrics.pairwise import pairwise_distances
from sklearn.metrics.pairwise import pairwise_kernels
def plot(func):
random_state = check_ran... | manhhomienbienthuy/scikit-learn | benchmarks/bench_plot_parallel_pairwise.py | Python | bsd-3-clause | 1,272 |
from OpenSSL import crypto
BITS=4096
C="ES"
ST="Madrid"
L="Madrid"
O="Tuxhound"
OU="IT Department"
def createKeyPair():
pkey = crypto.PKey()
pkey.generate_key(crypto.TYPE_RSA, BITS)
return pkey
def createCertRequest(pkey, name, digest="sha256"):
req = crypto.X509Req()
subject = req.get_subject... | smurfix/letsencrypt | lets_enc/certificate.py | Python | gpl-2.0 | 1,938 |
#!/usr/bin/env python
# Creates and saves a JSON file to update the D3.js graphs
import MySQLdb
import MySQLdb.cursors
import json
import Reference as r
import logging
def CreateSentimentIndex(NegativeWords, PositiveWords, TotalWords):
''' Creates a sentiment value for the word counts'''
if TotalWords... | AdamDynamic/TwitterMetrics | CreateJson.py | Python | gpl-2.0 | 2,191 |
#! /usr/bin/python
# extracts document annotated in the source files.
# TO BE IMPLEMENTED
import glob
sections = {}
def process_file(fn):
section = ""
section_name = ""
in_section = False
for line in open(fn, 'r'):
if line[0:2] != "//" or line[0:3] == "///":
# end of a section (a... | nlsynth/nli | docs/extract-document.py | Python | gpl-3.0 | 806 |
# standard library
import json
# django
from django.views.generic import View
from django.http import HttpResponse
from django.utils.decorators import method_decorator
from django.contrib.auth.decorators import login_required
# local django
from user.decorators import is_health_professional
from medicine.models impor... | fga-gpp-mds/2017.2-Receituario-Medico | medical_prescription/prescription/views/autocompletemedicine.py | Python | mit | 2,824 |
import random,time
def get_number():
s=random.randint(0,100)
return str(s)
def get_datetime():
return time.ctime()
def main_index():
return """<lu>
<li>the datetime is {datetime}</li>
<li>the number is {random_number}</li>
</lu>""".format(
datetime=... | xluren/awesome_flask | simple_flaskcache/Flask-Cache_for_module_03/app/views.py | Python | mit | 393 |
# coding: utf-8
import flask
from apps.auth import helpers
from apps.user import models
from .import CONFIG
provider = helpers.make_provider(CONFIG)
bp = helpers.make_provider_bp(provider.name, __name__)
@bp.route('/authorized/')
def authorized():
response = provider.authorized_response()
if response is None:
... | gmist/gae-de-init | main/apps/auth/providers/dropbox/views.py | Python | mit | 1,175 |
"""
(c) 2013 LinkedIn Corp. 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 writing... | pusnik/pyexchange | tests/exchange2010/test_delete_folder.py | Python | apache-2.0 | 2,309 |
from unittest import TestCase
import pred.webserver.customresult
from pred.webserver.customresult import CustomResultData
from pred.webserver.errors import ClientException
from mock import MagicMock, patch
class TestCustomResultData(TestCase):
def test_find_with_invalid_uuid(self):
with self.assertRaises... | Duke-GCB/TF-DNA-PredictionsDB | tests/test_customresult.py | Python | mit | 5,096 |
#!/usr/bin/env python
# -*- coding: windows-1252 -*-
import os
import struct
import array
import mmap
from rhCompression import lzss
PATH_SUBTITLES = "./subtitles/out-ptbr"
PATH_OUTPUT = "./subtitles/ptbr"
def vertical(buffer):
c = ''
for y in range(8)[::-1]:
c += buffer[4*y:4*(y+1)]
return c
d... | leomontenegro6/megaman-zx-advent-traducao-ptbr | tool/legendas/repack_subtitles.py | Python | mit | 5,617 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
#
# Copyright 2016 Pieter Robyns.
#
# This is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
#
# This sof... | Wosser1sProductions/gr-lora | python/lora_receiver.py | Python | gpl-3.0 | 3,594 |
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the... | jd/pifpaf | pifpaf/drivers/artemis.py | Python | apache-2.0 | 3,219 |
#!/usr/bin/python
import json
import re
import time
from datetime import date
from io import BytesIO
from django.http import HttpResponse
from django.contrib.auth.decorators import permission_required, login_required
from django.shortcuts import render
from reportlab.lib import colors
from reportlab.lib.pagesizes i... | rectory-school/rectory-apps | seating_charts/views/display.py | Python | mit | 8,815 |
from muntjac.ui.tab_sheet import TabSheet
from muntjac.demo.sampler.features.tabsheets.TabSheetIcons import TabSheetIcons
from muntjac.demo.sampler.features.tabsheets.TabSheetScrolling import TabSheetScrolling
from muntjac.demo.sampler.features.tabsheets.TabSheetDisabled import TabSheetDisabled
from muntjac.demo.samp... | rwl/muntjac | muntjac/demo/sampler/features/tabsheets/TabSheetClosing.py | Python | apache-2.0 | 1,130 |
def read_log(filename):
with open(filename, "r") as f:
lines = f.readlines()
return [l.strip() for l in lines]
def only_success(log_lines):
return [l for l in log_lines if "processed user" in l]
def only_errors(log_lines):
return [l for l in log_lines if "processing error" in l]
def get_stats(line):
unparse... | rolandshoemaker/ghpn | log_parse.py | Python | mit | 1,392 |
""" Captcha.Visual.BAse
Base classes for visual CAPTCHAs. We use the Python Imaging Library
to manipulate these images.
"""
#
# PyCAPTCHA Package
# Copyright (C) 2004 Micah Dowty <micah@navi.cx>
#
from Sycamore.support import Captcha
from PIL import Image
__all__ = ['ImageCaptcha', 'Layer']
class ImageCaptcha(Capt... | philipn/sycamore | Sycamore/support/Captcha/Visual/Base.py | Python | gpl-2.0 | 2,266 |
#!/usr/bin/python3
# szymon version 12/03/2014
# modules used by workout101 program
from tkinter import *
import tkinter.font as tkFont
import shelve
from time import *
from calendar import monthcalendar
############################################################## BACKGROUND ######
class Background(Frame):
'''... | jameslivulpi/workout101 | workout.py | Python | gpl-3.0 | 51,985 |
import sys
import os
#sys.exit("sd")
def jingdu(i,max):
shu=i/max
shu=int(shu*max)
shu="\r{du}>{shu}%".format(du="#"*i,shu=shu)
#print(shu)
sys.stdout.write(shu)
sys.stdout.flush()
def main():
for i in range(0,101):
jingdu(i,100)
main() | xiaoyongaa/ALL | 函数和常用模块/81sys模块.py | Python | apache-2.0 | 276 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2013 Cubic ERP - Teradata SAC (<http://cubicerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the ... | jolevq/odoopub | extra-addons/cash_box/account.py | Python | agpl-3.0 | 7,666 |
# Copyright 2011 OpenStack Foundation
# 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 requ... | ntt-sic/nova | nova/api/openstack/compute/contrib/server_diagnostics.py | Python | apache-2.0 | 2,561 |
from os.path import isfile, getsize
import json
from django.contrib import admin
from django.contrib.admin.views.main import ChangeList
from django.conf.urls import url
from django.http import HttpResponse, Http404
from django_logtail.models import Log
from django_logtail import app_settings
from django.template.respo... | alex2/django_logtail | django_logtail/admin.py | Python | mit | 2,962 |
# -*- encoding:utf-8 -*-
"""
卖出择时示例因子: 较小利润值 < 买入后最大收益价格 - 今日价格 < 较大利润值 -> 止盈卖出
只做为单边止盈因子使用,作为利润保护因子使用
"""
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
from .ABuFactorSellBase import AbuFactorSellBase, ESupportDirection
__author__ = '阿布'
__weixi... | bbfamily/abu | abupy/FactorSellBu/ABuFactorCloseAtrNStop.py | Python | gpl-3.0 | 2,940 |
import pickle
import tensorflow as tf
from sklearn.model_selection import train_test_split
from alexnet import AlexNet
# TODO: Load traffic signs data.
# TODO: Split data into training and validation sets.
# TODO: Define placeholders and resize operation.
# TODO: pass placeholder as first argument to `AlexNet`.
fc7... | akshaybabloo/Car-ND | Term_1/Transfer_Learning_8/Alexnet_8_1/train_feature_extraction.py | Python | mit | 853 |
def fib(n):
if n == 0 or n == 1:
return n
else:
return fib(n-1) + fib(n-2)
print(fib(10))
| encima/Comp_Thinking_In_Python | scripts/fib_recur.py | Python | mit | 115 |
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 23 14:33:44 2015
@author: Eric
"""
from os import chdir
chdir("..")
import numpy as np
import matplotlib.pyplot as plt
import scipy.io
from pca.pca import PCA
import SAILnet
imfile = "patches.mat"
imname = "patches"
nullpca = PCA()
normalpca = PCA(... | emdodds/SAILnet | tests/pcareptest.py | Python | mit | 1,755 |
# Django settings for mcjsms project.
import os
DEBUG = False
TEMPLATE_DEBUG = DEBUG
SITE_ROOT = os.path.realpath(os.path.dirname(__file__))
ADMINS = []
MANAGERS = ADMINS
if DEBUG:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql',... | sayar/mcj2011 | sms/settings.py | Python | apache-2.0 | 5,993 |
"""
Staff view of courseware
"""
from bok_choy.page_object import PageObject
from .courseware import CoursewarePage
class StaffPage(CoursewarePage):
"""
View of courseware pages while logged in as course staff
"""
url = None
PREVIEW_MENU_CSS = '.preview-menu'
VIEW_MODE_OPTIONS_CSS = '.preview... | eestay/edx-platform | common/test/acceptance/pages/lms/staff_view.py | Python | agpl-3.0 | 3,002 |
# encoding: utf8
from spline.tests import *
from splinext.pokedex.controllers.pokedex_search import MoveSearchForm
class TestMoveSearchController(TestController):
def do_search(self, **criteria):
u"""Small wrapper to run a move search for the given criteria."""
return self.app.get(url(controller=... | Sanqui/spline-pokedex | splinext/pokedex/tests/test_move_search.py | Python | mit | 11,624 |
"""Unit tests for the Paver asset tasks."""
import os
from unittest import TestCase
import ddt
import paver.tasks
from mock import patch
from paver.easy import call_task, path
from watchdog.observers import Observer
from pavelib.assets import COLLECTSTATIC_LOG_DIR_ARG, collect_assets
from ..utils.envs import Env
f... | msegado/edx-platform | pavelib/paver_tests/test_assets.py | Python | agpl-3.0 | 15,101 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2014, 2015, 2019 Adam.Dybbroe
# Author(s):
# Adam.Dybbroe <a000680@c14526.ad.smhi.se>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foun... | adybbroe/mesan_compositer | tests/__init__.py | Python | gpl-3.0 | 1,864 |
# Copyright 2016 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... | lukeiwanski/tensorflow-opencl | tensorflow/tools/dist_test/python/benchmark_util.py | Python | apache-2.0 | 2,742 |
from __future__ import unicode_literals
import re
import mwparserfromhell
import pywikibot
pywikibot.config.family = "commons"
pywikibot.config.mylang = "commons"
site = pywikibot.Site()
site.login()
category = pywikibot.Category(site, "Category:Sammlung Duncker")
for page in category.articles():
try:
... | HazardSJ/HazardBot | commonswiki/sammlungduncker.py | Python | mit | 1,407 |
# -*- coding: utf-8 -*-
#
# This file is part of Zenodo.
# Copyright (C) 2019 CERN.
#
# Zenodo is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later v... | slint/zenodo | zenodo/modules/deposit/scopes.py | Python | gpl-2.0 | 1,343 |
# -*- encoding: utf-8 -*-
"""Test class for Navigation UI
:Requirement: Navigation
:CaseAutomation: Automated
:CaseLevel: Acceptance
:CaseComponent: UI
:TestType: Functional
:CaseImportance: High
:Upstream: No
"""
from robottelo.decorators import skip_if_bug_open, tier1
from robottelo.test import UITestCase
fro... | ares/robottelo | tests/foreman/ui/test_navigation.py | Python | gpl-3.0 | 5,977 |
# SPDX-License-Identifier: MIT
# Copyright (C) 2019 Tobias Gruetzmacher
from dosagelib.helpers import joinPathPartsNamer, queryNamer
class TestNamer(object):
"""
Tests for comic namer.
"""
def test_queryNamer(self):
testurl = 'http://FOO?page=result&page2=result2'
assert queryNamer('p... | webcomics/dosage | tests/test_helpers.py | Python | mit | 894 |
from django.conf.urls import url
from core.views.community import CommunityView
from visual_translations.models import VisualTranslationsEUCommunity, VisualTranslationsBRICCommunity
from visual_translations.views.community import VisualTranslationsHtmlView, VisualTanslationsDisambiguationView
from visual_translations.... | fako/datascope | src/visual_translations/urls.py | Python | gpl-3.0 | 2,010 |
#
# 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... | manuzhang/incubator-beam | sdks/python/apache_beam/runners/worker/sdk_worker_main.py | Python | apache-2.0 | 2,367 |
import _plotly_utils.basevalidators
class FontValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(self, plotly_name="font", parent_name="funnelarea.title", **kwargs):
super(FontValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/python-api | packages/python/plotly/plotly/validators/funnelarea/title/_font.py | Python | mit | 1,857 |
"""
Views handling read (GET) requests for the Discussion tab and inline discussions.
"""
import logging
from functools import wraps
import six
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.contrib.staticfiles.storag... | edx-solutions/edx-platform | lms/djangoapps/discussion/views.py | Python | agpl-3.0 | 43,638 |
import unittest
from core import *
class test_matlabarray(unittest.TestCase):
"""Expanding matlabarray"""
def test010(self):
"""Two-dimensional assignment to []"""
a = matlabarray()
a[a.shape[0]+1,[1,2,3]] = [123,456,789]
a[a.shape[0]+1,[1,2,3]] = [123,456,789]
a[a.shape... | Wenice/smop | smop/test_matlabarray.py | Python | mit | 4,770 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import gzip
import random
import re
from io import BytesIO
from unittest import skipIf
from django.conf import settings
from django.core import mail
from django.http import (
FileResponse, HttpRequest, HttpResponse, HttpResponsePermanentRedirect,
... | ytjiang/django | tests/middleware/tests.py | Python | bsd-3-clause | 31,700 |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | wscullin/spack | lib/spack/spack/cmd/use.py | Python | lgpl-2.1 | 1,669 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# Slobodni programi d.o.o.
# Copyright (C) 2012- Slobodni programi (<http://www.slobodni-programi.hr>).
#
# This module was originally developed by Camptocamp.
# We thank them for their contribution.
#... | decodio/l10n_hr | l10n_hr_currency_rate_update/__openerp__.py | Python | agpl-3.0 | 4,167 |
# pylint: disable=invalid-name
from django.db import migrations
from django.db import models
class Migration(migrations.Migration):
dependencies = [('centre_registry', '0002_auto_20141128_1731'), ]
operations = [
migrations.AlterModelOptions(
name='centre',
options={'ordering'... | clarin-eric/Centre-Registry | centre-registry-app/centre_registry/migrations/0003_auto_20150223_1840.py | Python | gpl-3.0 | 2,822 |
"""
Eyes for pies.
"""
import argparse
import datetime
from pathlib import Path
import random
from picamera import PiCamera
import time
import curio
from fractions import Fraction
def long_exposure(length=6,
framerate=6,
resolution=(1280, 720),
iso=800):
"""... | openbermuda/karmapi | karmapi/veyes.py | Python | gpl-3.0 | 2,011 |
import os
import re
from docutils import nodes
from docutils.parsers import rst
from docutils.statemachine import ViewList
from google.protobuf import descriptor_pb2
from google.protobuf.descriptor import FileDescriptor, MakeDescriptor
from google.protobuf.descriptor_database import DescriptorDatabase
from sphinx impo... | m-sc/yamcs | docs/http-api/_ext/proto.py | Python | agpl-3.0 | 19,936 |
# proxy module
from __future__ import absolute_import
from chaco.tools.legend_tool import *
| enthought/etsproxy | enthought/chaco/tools/legend_tool.py | Python | bsd-3-clause | 92 |
# -*- coding: utf-8 -*-
''' Test the QShortcut constructor'''
import unittest
import sys
from PySide import QtGui, QtCore
class Foo(QtGui.QWidget):
def __init__(self):
QtGui.QWidget.__init__(self)
self.ok = False
self.copy = False
def slot_of_foo(self):
self.ok = True
d... | M4rtinK/pyside-android | tests/QtGui/qshortcut_test.py | Python | lgpl-2.1 | 1,185 |
"""Utility class to start/stop Pyro Event Server.
__author__ = "http://www.gemalto.com"
Copyright 2001-2012 gemalto
Author: Jean-Daniel Aussel, mailto:jean-daniel.aussel@gemalto.com
This file is part of pyscard.
pyscard is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser Gen... | moreati/pyscard | smartcard/pyro/server/PyroEventServer.py | Python | lgpl-2.1 | 3,204 |
import pytest
#from src import customer_info
#from src import time_frame
from src.clv import *
#from src.clv import top_x_simple_ltv_customers
#from src.clv import argument_parse
#from src.clv import event_iteration
from datetime import datetime
def test_ci_get_amount():
ci = customer_info('0')
assert ci.get_amount... | xuwenyihust/Shutterfly-Customer-Lifetime-Value | tests/clv_test.py | Python | mit | 6,026 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'snow'
import ast
import re
from setuptools import setup
_version_re = re.compile(r'__version__\s+=\s+(.*)')
with open('core/__init__.py', 'rb') as f:
version = str(ast.literal_eval(_version_re.search(
f.read().decode('utf-8')).group(1)))
set... | fairy-rui/oj | setup.py | Python | gpl-2.0 | 722 |
"""
Connect against database backend.
Tools for SoapSy
Yes, we could put something very sophisticated here in order to allow integration with
a variety of datbases; however, for reasons of simplicity I decided to just put the code
for connecting against the XML RPC database here.
@author: Michael Pilgermann
@contac... | kichkasch/ioids | soapsytools/dbconnector.py | Python | gpl-3.0 | 12,118 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.