code stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 226 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k |
|---|---|---|---|---|---|
#!/usr/bin/env python
# ===============================================================================
# Copyright (c) 2014 Geoscience Australia
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
... | alex-ip/agdc | api/source/test/python/datacube/api/test_query.py | Python | bsd-3-clause | 12,587 |
# -*- coding: utf-8 -*-
import glob
import os
import polib
from django import VERSION as DJANGO_VERSION
from django.core.management.commands.makemessages import (
Command as OriginalMakeMessagesCommand)
from django.utils import translation
from django.utils.translation.trans_real import CONTEXT_SEPARATOR
class Co... | divio/django-commontranslations | django_commontranslations/management/commands/makemessages_unique.py | Python | bsd-3-clause | 4,136 |
from distutils.core import setup
import py2exe
setup(console=['server.py'])
| mbeloshitsky/syslog2eventlog | setup.py | Python | bsd-3-clause | 77 |
import logging; logger = logging.getLogger("morse." + __name__)
import socket
import select
import json
import morse.core.middleware
from functools import partial
from morse.core import services
class MorseSocketServ:
def __init__(self, port, component_name):
# List of socket clients
self._client_s... | Arkapravo/morse-0.6 | src/morse/middleware/socket_mw.py | Python | bsd-3-clause | 6,797 |
import unittest
from autosklearn.pipeline.components.classification.extra_trees import \
ExtraTreesClassifier
from autosklearn.pipeline.util import _test_classifier, \
_test_classifier_iterative_fit, _test_classifier_predict_proba
import numpy as np
import sklearn.metrics
import sklearn.ensemble
class Extra... | hmendozap/auto-sklearn | test/test_pipeline/components/classification/test_extra_trees.py | Python | bsd-3-clause | 3,415 |
#
# Copyright (c) 2009-2015, Jack Poulson
# All rights reserved.
#
# This file is part of Elemental and is under the BSD 2-Clause License,
# which can be found in the LICENSE file in the root directory, or at
# http://opensource.org/licenses/BSD-2-Clause
#
import El, time, random
n0 = n1 = 50
numRowsB = 5
numRH... | justusc/Elemental | examples/interface/LSE.py | Python | bsd-3-clause | 4,375 |
from lib.common import helpers
class Module:
def __init__(self, mainMenu, params=[]):
self.info = {
'Name': 'Get-Screenshot',
'Author': ['@obscuresec', '@harmj0y'],
'Description': ('Takes a screenshot of the current desktop and '
'returns ... | pierce403/EmpirePanel | lib/modules/collection/screenshot.py | Python | bsd-3-clause | 3,876 |
# -*- coding: utf-8 -*-
__docformat__="restructuredtext"
from rest import RestClient, Result, ResponseFormats
from datetime import datetime
class NeocortexRestClient(object):
BASE_URL = "http://api.meaningtool.com/0.2/neocortex"
__builder__ = None
class Builder(RestClient):
_functions = {... | popego/neocortex-api-python | src/neocortex/client.py | Python | bsd-3-clause | 3,380 |
# -*- coding:utf-8 -*-
from django import test
from django.conf import settings
from django.contrib.auth import authenticate
from django.contrib.auth.models import User
from django.core.management import call_command
from mock import patch
from nose.tools import eq_
class BcryptTests(test.TestCase):
def setUp(se... | fwenzel/django-sha2 | test/django13/tests/test_bcrypt.py | Python | bsd-3-clause | 6,294 |
from getpass import getuser
from Job import Job
from datetime import datetime
import os.path
import time
import re
import Database
class Upload( object ):
@classmethod
def CreateUpload( cls, filename=None ):
if not filename:
filename = Upload.defaultNewFilename()
... | SPlanzer/AIMS | ElectoralAddress/Upload.py | Python | bsd-3-clause | 4,556 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 1024 , FREQ = 'D', seed = 0, trendtype = "PolyTrend", cycle_length = 0, transform = "Anscombe", sigma = 0.0, exog_count = 20, ar_order = 12); | antoinecarme/pyaf | tests/artificial/transf_Anscombe/trend_PolyTrend/cycle_0/ar_12/test_artificial_1024_Anscombe_PolyTrend_0_12_20.py | Python | bsd-3-clause | 265 |
import csv
import osgeo.ogr
from osgeo import ogr, osr
EPSG_LAT_LON = 4326
def read_tazs_from_csv(csv_zone_locs_fname):
taz_tuples = []
tfile = open(csv_zone_locs_fname, 'rb')
treader = csv.reader(tfile, delimiter=',', quotechar="'")
for ii, row in enumerate(treader):
if ii == 0: continue
... | PatSunter/pyOTPA | TAZs-OD-Matrix/taz_files.py | Python | bsd-3-clause | 1,176 |
from functools import wraps
from django.utils.translation import ugettext as _
from django.contrib.admin.forms import AdminAuthenticationForm
from django.contrib.auth.views import login
from django.contrib.auth import REDIRECT_FIELD_NAME
def staff_member_required(backoffice):
def decorate(view_func):
"""
... | vikingco/django-advanced-reports | advanced_reports/backoffice/decorators.py | Python | bsd-3-clause | 1,384 |
import contextlib
import os
import shutil
import tempfile
import numpy
from PIL import Image
from kiva.fonttools import Font
from kiva.constants import MODERN
class DrawingTester(object):
""" Basic drawing tests for graphics contexts.
"""
def setUp(self):
self.directory = tempfile.mkdtemp()
... | tommy-u/enable | kiva/tests/drawing_tester.py | Python | bsd-3-clause | 5,452 |
from django.shortcuts import get_object_or_404, render_to_response
from django.http import Http404, HttpResponseRedirect
from django.template import RequestContext
from django.core.urlresolvers import reverse
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from djan... | sedden/django-basic-apps | basic/messages/views.py | Python | bsd-3-clause | 5,111 |
def extractNotoriousOnlineBlogspotCom(item):
'''
Parser for 'notorious-online.blogspot.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('PRC', 'PRC', 'translated')... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractNotoriousOnlineBlogspotCom.py | Python | bsd-3-clause | 569 |
import cx_Logging
import os
import sys
import threading
if len(sys.argv) > 1:
numThreads = int(sys.argv[1])
else:
numThreads = 5
if len(sys.argv) > 2:
numIterations = int(sys.argv[2])
else:
numIterations = 1000
def Run(threadNum):
cx_Logging.Debug("Thread-%d: starting", threadNum)
iterationsLe... | marhar/cx_OracleTools | cx_Logging/test/test_threading.py | Python | bsd-3-clause | 968 |
"""
Prototype demo:
python holoviews/ipython/convert.py Conversion_Example.ipynb | python
"""
import ast
from nbconvert.preprocessors import Preprocessor
def comment_out_magics(source):
"""
Utility used to make sure AST parser does not choke on unrecognized
magics.
"""
filtered = []
for line ... | basnijholt/holoviews | holoviews/ipython/preprocessors.py | Python | bsd-3-clause | 7,474 |
import os
from fabric.api import env, run, cd, sudo, settings
from fabric.contrib.files import upload_template
def get_env_variable(var_name):
""" Get the environment variable or return exception """
try:
return os.environ[var_name]
except KeyError:
error_msg = "Variable %s is not set in ... | setaris/django-tesseract2 | deployment/fabfile.py | Python | bsd-3-clause | 2,815 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Includes the HRV stitcher data source class
"""
import pandas as pd
import numpy as np
from scipy.io import loadmat
from scipy.interpolate import UnivariateSpline
from data_source import DataSource
from schema import Schema, Or, Optional
def _val(x, pos, label_bin):
... | janmtl/pypsych | pypsych/data_sources/hrvstitcher.py | Python | bsd-3-clause | 10,502 |
import os
from django.template import Context
from django.template.engine import Engine
from django.test import SimpleTestCase
from .utils import ROOT, TEMPLATE_DIR
OTHER_DIR = os.path.join(ROOT, 'other_templates')
class RenderToStringTest(SimpleTestCase):
def setUp(self):
self.engine = ... | yephper/django | tests/template_tests/test_engine.py | Python | bsd-3-clause | 1,984 |
from django.db import models
from machina.models.fields import ExtendedImageField, MarkupTextField
RESIZED_IMAGE_WIDTH = 100
RESIZED_IMAGE_HEIGHT = 100
VALIDATED_IMAGE_MIN_WIDTH = 100
VALIDATED_IMAGE_MAX_WIDTH = 120
VALIDATED_IMAGE_MIN_HEIGHT = 100
VALIDATED_IMAGE_MAX_HEIGHT = 120
VALIDATED_IMAGE_MAX_SIZE = 12000
... | ellmetha/django-machina | tests/models.py | Python | bsd-3-clause | 1,013 |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['Fisher'] , ['Lag1Trend'] , ['Seasonal_Hour'] , ['LSTM'] ); | antoinecarme/pyaf | tests/model_control/detailed/transf_Fisher/model_control_one_enabled_Fisher_Lag1Trend_Seasonal_Hour_LSTM.py | Python | bsd-3-clause | 154 |
#!/usr/bin/env python3
"""Python binding of UART wrapper of LetMeCreate library."""
import ctypes
_LIB = ctypes.CDLL('libletmecreate_core.so')
# Baudrates
UART_BD_1200 = 1200
UART_BD_2400 = 2400
UART_BD_4800 = 4800
UART_BD_9600 = 9600
UART_BD_19200 = 19200
UART_BD_38400 = 38400
UART_BD_57600 = 57600
def init():
... | francois-berder/PyLetMeCreate | letmecreate/core/uart.py | Python | bsd-3-clause | 2,730 |
""" A module to contain utility ISO-19115 metadata parsing helpers """
from _collections import OrderedDict
from copy import deepcopy
from frozendict import frozendict as FrozenOrderedDict
from parserutils.collections import filter_empty, reduce_value, wrap_value
from parserutils.elements import get_element_name, get... | consbio/gis-metadata-parser | gis_metadata/iso_metadata_parser.py | Python | bsd-3-clause | 32,703 |
from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.core.urlresolvers import reverse
from django.contrib import messages
from models import UserVote
from forms import UserVoteForm
def vote(request):
if request.method ... | django-stars/dash2011 | presence/apps/vote/views.py | Python | bsd-3-clause | 684 |
from django.forms import ModelForm
from .models import DistributionRequests
class DistributionRequestForm(ModelForm):
class Meta:
model = DistributionRequests
| pulilab/django-collectform | collectform/forms.py | Python | bsd-3-clause | 173 |
from django.contrib import admin
from django.contrib.sites.models import RequestSite
from django.contrib.sites.models import Site
from django.utils.translation import ugettext_lazy as _
from .models import RegistrationProfile
from opps.core.admin import apply_opps_rules
@apply_opps_rules('registration')
class Regist... | opps/opps-registration | opps/registration/admin.py | Python | bsd-3-clause | 1,708 |
import itertools
from whylog.config.investigation_plan import Clue
from whylog.constraints.exceptions import TooManyConstraintsToNegate
from whylog.front.utils import FrontInput
class Verifier(object):
UNMATCHED = Clue(None, None, None, None)
@classmethod
def _create_investigation_result(cls, clues_comb... | andrzejgorski/whylog | whylog/constraints/verifier.py | Python | bsd-3-clause | 8,521 |
#!/usr/bin/env python
#-*- coding: utf-8 -*-
from __future__ import unicode_literals
import sqlite3
from flask import Flask, render_template, g, current_app, request
from flask.ext.paginate import Pagination
app = Flask(__name__)
app.config.from_pyfile('app.cfg')
@app.before_request
def before_request():
g.conn... | wangjun/flask-paginate | example/app.py | Python | bsd-3-clause | 2,185 |
from serial_settings import SerialSettings
class AbstractStream(object):
def __init__(self, config, name):
"""
:type name: str
"""
self.config = config
self.name = name
def open(self):
raise NotImplementedError
def close(self):
raise... | ThomasGerstenberg/serial_monitor | stream/__init__.py | Python | bsd-3-clause | 551 |
from __future__ import division, print_function, absolute_import
import warnings
import numpy as np
from scipy.special import factorial
from scipy.lib.six import xrange
__all__ = ["KroghInterpolator", "krogh_interpolate", "BarycentricInterpolator",
"barycentric_interpolate", "PiecewisePolynomial",
... | maciejkula/scipy | scipy/interpolate/polyint.py | Python | bsd-3-clause | 32,302 |
import urllib
def command_oraakkeli(bot, user, channel, args):
"""Asks a question from the oracle (http://www.lintukoto.net/viihde/oraakkeli/)"""
if not args: return
args = urllib.quote_plus(args)
answer = getUrl("http://www.lintukoto.net/viihde/oraakkeli/index.php?kysymys=%s&html=0" % args).getCon... | nigeljonez/newpyfibot | modules/module_oraakkeli.py | Python | bsd-3-clause | 459 |
import datetime
from django.db import models, IntegrityError
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
from django.core.urlresolvers import reverse as django_reverse
from django.utils.http import urlquote
from django.conf import settings
from tower import ugettext as _, ... | mozilla/spark | apps/users/models.py | Python | bsd-3-clause | 13,725 |
# -*- coding: utf-8 -*-
default_app_config = 'allink_apps.locations.apps.AllinkLocationsConfig'
__version__ = '0.0.1'
| allink/allink-apps | locations/__init__.py | Python | bsd-3-clause | 118 |
import subprocess
import os
import sys
import commands
import numpy as np
import pyroms
import pyroms_toolbox
from remap_bio_woa import remap_bio_woa
from remap_bio_glodap import remap_bio_glodap
data_dir_woa = '/archive/u1/uaf/kate/COBALT/'
data_dir_glodap = '/archive/u1/uaf/kate/COBALT/'
dst_dir='./'
src_grd = py... | kshedstrom/pyroms | examples/cobalt-preproc/Clim_bio/make_clim_file_bio_addons.py | Python | bsd-3-clause | 4,460 |
# # # # # # # # # # # # # #
# CAPTAINHOOK IDENTIFIER #
# # # # # # # # # # # # # #
from .utils import bash, filter_python_files
DEFAULT = 'off'
CHECK_NAME = 'frosted'
NO_FROSTED_MSG = (
"frosted is required for the frosted plugin.\n"
"`pip install frosted` or turn it off in your tox.ini file.")
REQUIRED_FILES... | Friz-zy/captainhook | captainhook/checkers/frosted_checker.py | Python | bsd-3-clause | 629 |
# -*- coding: utf-8 -*-
from unittest import TestCase
import logging
log = logging.getLogger(__name__)
from formencode import validators, Invalid
from nose.tools import *
import formencode
from coregae.widget.field import *
class TestBasefield(TestCase):
def test_basefield(self):
"""
Test for ... | Letractively/aha-gae | aha/widget/tests/test_fields.py | Python | bsd-3-clause | 5,382 |
import optparse
from os import curdir
from os.path import abspath
import sys
from autoscalebot.tasks import start_autoscaler
from autoscalebot import version
def main(args=sys.argv[1:]):
CLI_ROOT = abspath(curdir)
sys.path.insert(0, CLI_ROOT)
parser = optparse.OptionParser(
usage="%prog or type ... | wieden-kennedy/autoscalebot | autoscalebot/cli.py | Python | bsd-3-clause | 747 |
AuthorizedException = (
BufferError,
ArithmeticError,
AssertionError,
AttributeError,
EnvironmentError,
EOFError,
LookupError,
MemoryError,
ReferenceError,
RuntimeError,
SystemError,
TypeError,
ValueError
)
| ainafp/nilearn | nilearn/_utils/exceptions.py | Python | bsd-3-clause | 311 |
# Hierarchical Agglomerative Cluster Analysis
#
# Copyright (C) 2013 Folgert Karsdorp
# Author: Folgert Karsdorp <fbkarsdorp@gmail.com>
# URL: <https://github.com/fbkarsdorp/HAC-python>
# For licence information, see LICENCE.TXT
import numpy
from numpy import dot, sqrt
def binarize_vector(u):
return u > 0
def co... | mikekestemont/PyStyl | pystyl/clustering/distance.py | Python | bsd-3-clause | 1,971 |
# -*- coding: utf-8 -*-
import json
from unittest import mock
from oauthlib.common import Request
from oauthlib.oauth2.rfc6749 import errors
from oauthlib.oauth2.rfc6749.grant_types import (
ResourceOwnerPasswordCredentialsGrant,
)
from oauthlib.oauth2.rfc6749.tokens import BearerToken
from tests.unittest import ... | idan/oauthlib | tests/oauth2/rfc6749/grant_types/test_resource_owner_password.py | Python | bsd-3-clause | 7,233 |
import typing
import anyio
from starlette.requests import Request
from starlette.responses import Response, StreamingResponse
from starlette.types import ASGIApp, Receive, Scope, Send
RequestResponseEndpoint = typing.Callable[[Request], typing.Awaitable[Response]]
DispatchFunction = typing.Callable[
[Request, Re... | encode/starlette | starlette/middleware/base.py | Python | bsd-3-clause | 2,630 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2015, Alcatel-Lucent Inc, 2017 Nokia
# 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 copyrigh... | nuagenetworks/vspk-python | vspk/v5_0/nuctranslationmap.py | Python | bsd-3-clause | 9,274 |
from __future__ import unicode_literals
from os.path import abspath, basename, dirname, join, normpath
from sys import path
import markdown
"""Common settings and globals."""
# PATH CONFIGURATION
# Absolute filesystem path to the Django project directory:
DJANGO_ROOT = dirname(dirname(abspath(__file__)))
# Absolut... | eliostvs/django-kb-example | example/settings/settings/base.py | Python | bsd-3-clause | 7,689 |
# -----------------------------------------------------------------------------
# Copyright (c) 2014--, The Qiita Development Team.
#
# Distributed under the terms of the BSD 3-clause License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... | antgonza/qiita | qiita_pet/handlers/api_proxy/sample_template.py | Python | bsd-3-clause | 8,355 |
from __future__ import unicode_literals
from django.utils.encoding import python_2_unicode_compatible
"""
Model for testing arithmetic expressions.
"""
from django.db import models
@python_2_unicode_compatible
class Number(models.Model):
integer = models.BigIntegerField(db_column='the_integer')
float = models... | ericholscher/django | tests/expressions_regress/models.py | Python | bsd-3-clause | 766 |
from django.contrib import admin
from achievs.models import Achievement
# from achievs.models import Gold
# from achievs.models import Silver
# from achievs.models import Bronze
# from achievs.models import Platinum
from achievs.models import Level
# class PlatinumInline(admin.StackedInline):
# model=Platinum
# cla... | eawerbaneth/Scoreboard | achievs/admin.py | Python | bsd-3-clause | 1,116 |
import numpy as np
import pytest
from pandas import (
DataFrame,
Index,
Series,
)
import pandas._testing as tm
import pandas.core.common as com
class TestSample:
@pytest.fixture(params=[Series, DataFrame])
def obj(self, request):
klass = request.param
if klass is Series:
... | gfyoung/pandas | pandas/tests/frame/methods/test_sample.py | Python | bsd-3-clause | 12,586 |
from functools import reduce
class ScopedString (object):
def __init__ (self):
self._stack = []
def push (self, frame):
self._stack.append (frame)
def pop (self):
frame = self._stack.pop()
return frame
def __str__ (self... | doffm/dbuf | src/dbuf/util.py | Python | bsd-3-clause | 3,108 |
import os
from sublime import active_window
from sublime import find_resources
from sublime import load_settings
from sublime import save_settings
import sublime_plugin
def _load_preferences():
return load_settings('Preferences.sublime-settings')
def _save_preferences():
return save_settings('Preferences.... | gerardroche/sublime-polyfill | ui.py | Python | bsd-3-clause | 8,584 |
from datetime import timedelta
import unittest
import mock
from django.test import TestCase
from django.core.urlresolvers import reverse
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Group, Permission
from django.core import mail
from django.core.paginator import Paginator
from ... | jorge-marques/wagtail | wagtail/wagtailadmin/tests/test_pages_views.py | Python | bsd-3-clause | 93,571 |
def get_file_extension(filename):
return filename.split(".")[-1]
| finiteloopsoftware/django-compressor | compress/utils.py | Python | bsd-3-clause | 69 |
import pytest
import numpy as np
from numpy.testing import assert_allclose
from .....extern.six.moves import range
from ..mle import design_matrix, periodic_fit
@pytest.fixture
def t():
rand = np.random.RandomState(42)
return 10 * rand.rand(10)
@pytest.mark.parametrize('freq', [1.0, 2])
@pytest.mark.paramet... | kelle/astropy | astropy/stats/lombscargle/implementations/tests/test_mle.py | Python | bsd-3-clause | 1,921 |
"""The WaveBlocks Project
IOM plugin providing functions for handling various
overlap matrices of linear combinations of general
wavepackets.
@author: R. Bourquin
@copyright: Copyright (C) 2013 R. Bourquin
@license: Modified BSD License
"""
import numpy as np
def add_overlaplcwp(self, parameters, timeslots=None, m... | WaveBlocks/WaveBlocksND | WaveBlocksND/IOM_plugin_overlaplcwp.py | Python | bsd-3-clause | 10,811 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2010-2011, Monash e-Research Centre
# (Monash University, Australia)
# Copyright (c) 2010-2011, VeRSI Consortium
# (Victorian eResearch Strategic Initiative, Australia)
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modificatio... | aaryani/CoreTardis | tardis/apps/microtardis/filters/__init__.py | Python | bsd-3-clause | 3,708 |
# proxy module
from __future__ import absolute_import
from envisage.ui.single_project.action.configure_action import *
| enthought/etsproxy | enthought/envisage/ui/single_project/action/configure_action.py | Python | bsd-3-clause | 119 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.10 on 2018-03-19 19:08
from __future__ import unicode_literals
import channels.models
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migr... | mitodl/open-discussions | channels/migrations/0002_add_subscription.py | Python | bsd-3-clause | 1,675 |
#!/usr/bin/env python
import os
import shutil
import glob
import time
import sys
import subprocess
from optparse import OptionParser, make_option
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
PARAMETERS = None
ADB_CMD = "adb"
def doCMD(cmd):
# Do not need handle timeout in this short script, let tool... | yugang/crosswalk-test-suite | stability/wrt-stablonglast2d-android-tests/inst.apk.py | Python | bsd-3-clause | 3,243 |
# -*- coding: utf-8 -*-
"""
Author
------
Bo Zhang
Email
-----
bozhang@nao.cas.cn
Created on
----------
- Sat Sep 03 12:00:00 2016
Modifications
-------------
- Sat Sep 03 12:00:00 2016
Aims
----
- normalization
Notes
-----
This is migrated from **SLAM** package
"""
from __future__ import division
import numpy... | hypergravity/hrs | twodspec/normalization.py | Python | bsd-3-clause | 8,493 |
#####################################################################
#
# metro.py
#
# Copyright (c) 2016, Eran Egozy
#
# Released under the MIT License (http://opensource.org/licenses/MIT)
#
#####################################################################
from clock import kTicksPerQuarter, quantize_tick_up
cla... | rusch95/calypso | src/common/metro.py | Python | bsd-3-clause | 2,521 |
from django.core import mail
from django.test import TestCase
from users.default_roles import DefaultGroups
from users.models import Invitation, Membership, OCUser
from communities.tests.common import create_sample_community
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext as ... | hasadna/OpenCommunity | src/users/tests/invitation_test.py | Python | bsd-3-clause | 4,187 |
"""
gatefilter.py
Driver function that creates an ARTView display and initiates Gatefilter.
"""
import os
import sys
from ..core import Variable, QtGui, QtCore
from ..components import RadarDisplay, Menu
from ._common import _add_all_advanced_tools, _parse_dir, _parse_field
from ..plugins import GateFilter
def run(... | jjhelmus/artview | artview/scripts/gatefilter.py | Python | bsd-3-clause | 1,159 |
import logging
def same_ocr_mrz(mrz_data, zones):
last_name_is_valid = mrz_data["last_name"][:25] == zones["last_name"]["value"][:25]
logging.debug(
"MRZ last name: {}; OCR last name: {}; matching {}".format(
mrz_data["last_name"], zones["last_name"]["value"], last_name_is_valid
)... | LouisTrezzini/projet-mairie | api/franceocr/check_mrz_ocr.py | Python | bsd-3-clause | 968 |
#!/usr/bin/env python3
import predict
import sklearn.metrics
import argparse, sys
import os
import numpy as np
import glob
import re
import matplotlib.pyplot as plt
def calc_auc(predictions):
y_true =[]
y_score=[]
for line in predictions:
values= line.split(" ")
y_true.append(float(values[1]))
y_score.append... | gnina/scripts | bootstrap.py | Python | bsd-3-clause | 3,080 |
import re
from crispy_forms import layout
from django import forms
from django.conf import settings
from django.core.exceptions import ValidationError
from django.core.validators import validate_email
from django.http import HttpResponseRedirect, Http404
from django.utils.translation import gettext_lazy
from cradmin_l... | devilry/devilry-django | devilry/devilry_admin/views/common/bulkimport_users_common.py | Python | bsd-3-clause | 5,904 |
# This file helps to compute a version number in source trees obtained from
# git-archive tarball (such as those provided by githubs download-from-tag
# feature). Distribution tarballs (built by setup.py sdist) and build
# directories (produced by setup.py build) will contain a much shorter file
# that just contains t... | yt-project/unyt | unyt/_version.py | Python | bsd-3-clause | 18,446 |
"""An example of a python script which can be executed by the task queue
"""
import sys
def execute():
"""Simply write the python executable
"""
sys.stdout.write(sys.executable)
if __name__ == '__main__':
execute()
| quantmind/pulsar-queue | tests/example/executable.py | Python | bsd-3-clause | 235 |
# -*- coding: utf-8 -*-
from django.conf import settings
from django.db import models
from django.template.context import Context
from django.template.loader import get_template_from_string
from django.utils import timezone
import swapper
class BaseLogEntry(models.Model):
"""
A base class that implements the... | jpulec/django-loggit | loggit/models.py | Python | bsd-3-clause | 3,864 |
# Copyright The IETF Trust 2008, All Rights Reserved
from django.conf.urls.defaults import patterns, include
from ietf.wginfo import views, edit, milestones
from django.views.generic.simple import redirect_to
urlpatterns = patterns('',
(r'^$', views.wg_dir),
(r'^summary.txt', redirect_to, { 'url':'/wg/1wg-... | mcr/ietfdb | ietf/wginfo/urls.py | Python | bsd-3-clause | 2,177 |
# -*-coding:Utf-8 -*
# Copyright (c) 2012 NOEL-BARON Léo
# 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
# li... | stormi/tsunami | src/secondaires/cuisine/commandes/recettes/__init__.py | Python | bsd-3-clause | 2,392 |
# Helper for the mirror on GAE
# GAE GETs an action gae_file, giving GAE host and a secret
# PyPI GETs /mkupload/secret, learning path and upload session
# PyPI POSTs to upload session
import urllib2, httplib, threading, os, binascii, urlparse
POST="""\
--%(boundary)s
Content-Disposition: form-data; name="secret"
%(s... | ericholscher/pypi | gae.py | Python | bsd-3-clause | 1,646 |
from __future__ import unicode_literals
import time
from django.conf import settings
from django.test import TestCase
from django.test.client import FakePayload, Client
from django.utils.encoding import force_text
from tastefulpy.serializers import Serializer
try:
from urllib.parse import urlparse
except ImportE... | mjschultz/django-tastefulpy | tastefulpy/test.py | Python | bsd-3-clause | 18,927 |
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# pylint: disable=W0212
import fcntl
import inspect
import logging
import os
import psutil
import textwrap
from devil import base_error
from devil impo... | endlessm/chromium-browser | third_party/catapult/devil/devil/android/forwarder.py | Python | bsd-3-clause | 18,608 |
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Presubmit script for Chromium browser resources.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more details about t... | keishi/chromium | ui/resources/resource_check/resource_scale_factors.py | Python | bsd-3-clause | 3,857 |
#!/usr/bin/env python
"""
lit - LLVM Integrated Tester.
See lit.pod for more information.
"""
from __future__ import absolute_import
import math, os, platform, random, re, sys, time
import lit.ProgressBar
import lit.LitConfig
import lit.Test
import lit.run
import lit.util
import lit.discovery
class TestingProgress... | JianpingZeng/xcc | xcc/java/utils/lit/lit/main.py | Python | bsd-3-clause | 21,621 |
from django.template.defaultfilters import rjust
from django.test import SimpleTestCase
from django.utils.safestring import mark_safe
from ..utils import setup
class RjustTests(SimpleTestCase):
@setup({'rjust01': '{% autoescape off %}.{{ a|rjust:"5" }}. .{{ b|rjust:"5" }}.{% endautoescape %}'})
de... | yephper/django | tests/template_tests/filter_tests/test_rjust.py | Python | bsd-3-clause | 1,060 |
from sklearn2sql_heroku.tests.classification import generic as class_gen
class_gen.test_model("LogisticRegression" , "BinaryClass_10" , "db2")
| antoinecarme/sklearn2sql_heroku | tests/classification/BinaryClass_10/ws_BinaryClass_10_LogisticRegression_db2_code_gen.py | Python | bsd-3-clause | 145 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""An extensible ASCII table reader and writer.
basic.py:
Basic table read / write functionality for simple character
delimited files with various options for column header definition.
:Copyright: Smithsonian Astrophysical Observatory (2011)
:Author:... | AustereCuriosity/astropy | astropy/io/ascii/basic.py | Python | bsd-3-clause | 10,920 |
# Copyright (C) 2011 Bheesham Persaud
# The license is available in LICENSE
from __future__ import division
import re
from includes.functions import *
class fileserve_com:
def init( self ):
self.url_pattern = re.compile( r'(http://www\.fileserve\.com/file/([A-Za-z0-9]+))', re.I )
self.result_pattern = re.compile... | bheesham/PyLinkChecker | hosts/fileserve_com.py | Python | bsd-3-clause | 1,325 |
from django.conf import settings
from django.contrib.auth.decorators import user_passes_test
from django.core.paginator import Paginator
from django.core.urlresolvers import reverse
from django.http import Http404, HttpResponseRedirect, HttpResponse
from django.shortcuts import render_to_response
from django.template i... | 20tab/upy | upy/contrib/rosetta/views.py | Python | bsd-3-clause | 18,100 |
# -*-coding:Utf-8 -*
# Copyright (c) 2010 LE GOFF Vincent
# 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
# l... | TheProjecter/kassie | src/bases/importeur.py | Python | bsd-3-clause | 10,203 |
input_name = '../examples/diffusion/poisson.py'
output_name = 'test_poisson.vtk'
from testsBasic import TestInput
class Test( TestInput ):
pass
| olivierverdier/sfepy | tests/test_input_poisson.py | Python | bsd-3-clause | 149 |
"""
XStatic resource package
See package 'XStatic' for documentation and basic tools.
"""
# official name, upper/lowercase allowed, no spaces
DISPLAY_NAME = 'Angular-lrdragndrop'
# name used for PyPi
PACKAGE_NAME = 'XStatic-%s' % DISPLAY_NAME
NAME = __name__.split('.')[-1] # package name (e.g. 'foo' or 'foo_bar')
... | stackforge/xstatic-angular-lrdragndrop | xstatic/pkg/angular_lrdragndrop/__init__.py | Python | mit | 1,969 |
# coding: utf-8
from pathlib import Path
import pandas as pd
import lightgbm as lgb
if lgb.compat.MATPLOTLIB_INSTALLED:
import matplotlib.pyplot as plt
else:
raise ImportError('You need to install matplotlib and restart your session for plot_example.py.')
print('Loading data...')
# load or create your datas... | henry0312/LightGBM | examples/python-guide/plot_example.py | Python | mit | 2,004 |
from .sql import *
__all__ = ['DBAdapter', 'get_db_adapter', 'async_atomic', 'async_atomic_func', 'get_db_settings']
| technomaniac/trelliopg | trelliopg/__init__.py | Python | mit | 118 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2017, Thierry Sallé (@seuf)
# 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
ANSIBLE_METADATA = {
'status': ['preview'],
'supported_by': 'com... | sgerhart/ansible | lib/ansible/modules/monitoring/grafana_dashboard.py | Python | mit | 14,915 |
################ Lispy: Scheme Interpreter in Python
## (c) Peter Norvig, 2010-14; See http://norvig.com/lispy.html
################ Types
from __future__ import division
Symbol = str # A Lisp Symbol is implemented as a Python str
List = list # A Lisp List is implemented as a Python list
Number =... | obask/lispify | src/python3/lis.py | Python | mit | 4,615 |
#!/usr/bin/env python3
# Copyright (c) 2014-2018 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 node disconnect and ban behavior"""
import time
from test_framework.test_framework import GuldenT... | nlgcoin/guldencoin-official | test/functional/p2p_disconnect_ban.py | Python | mit | 5,333 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/loot/collectible/collectible_parts/shared_sculpture_structure_04.iff... | obi-two/Rebelion | data/scripts/templates/object/tangible/loot/collectible/collectible_parts/shared_sculpture_structure_04.py | Python | mit | 508 |
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.utils import cstr
from frappe.model.document import Document
class LDAPSettings(Document):
def va... | ESS-LLP/frappe | frappe/integrations/doctype/ldap_settings/ldap_settings.py | Python | mit | 4,156 |
#!/usr/bin/env python
#coding: utf-8
## Definition for a binary tree node
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
# @param num, a list of integers
# @return a tree node
def sortedArrayToBST(self, num):
if n... | wh-acmer/minixalpha-acm | LeetCode/Python/convert_sorted_array_to_binary_search_tree.py | Python | mit | 583 |
from PyQt5.QtCore import QObject, pyqtSlot, pyqtSignal
from PyQt5.Qt import QSystemTrayIcon, QIcon
class TrayIcon(QSystemTrayIcon):
ActivationReason = ['Unknown', 'Context', 'DoubleClick', 'Trigger', 'MiddleClick']
onactivate = pyqtSignal(int, str)
onmessageclick = pyqtSignal()
def __init__(self, p... | xiruibing/hae | src/trayicon.py | Python | mit | 1,695 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/ship/crafted/reactor/shared_base_reactor_subcomponent_mk5.iff"
resu... | obi-two/Rebelion | data/scripts/templates/object/tangible/ship/crafted/reactor/shared_base_reactor_subcomponent_mk5.py | Python | mit | 499 |
# -*- coding: utf-8 -*-
from collections import defaultdict
import pprint
import re
_re_num = re.compile('\s(?P<num>\d+)\s+(?P<name>(RPL|ERR)_\w+)\s*(?P<_>.*)')
_re_mask = re.compile('^\s{24,25}(?P<_>("(<|:).*|\S.*"$))')
def main():
print('Parsing rfc file...')
item = None
items = []
out = open('irc... | gawel/irc3 | irc3/_parse_rfc.py | Python | mit | 5,523 |
from sha3 import sha3_256
from ethereum.utils import big_endian_to_int
def sha3(seed):
return sha3_256(bytes(seed)).digest()
# colors
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
def DEBUG(*args, **kargs):
print(FAIL + repr(args) + repr(kargs) + ENDC)
colors = ['\033[9%dm' % ... | HydraChain/hydrachain | hydrachain/consensus/utils.py | Python | mit | 750 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Creature()
result.template = "object/mobile/shared_shaupaut.iff"
result.attribute_template_id = 9
result.stfName... | obi-two/Rebelion | data/scripts/templates/object/mobile/shared_shaupaut.py | Python | mit | 430 |
"""Main view for geo locator application"""
from django.shortcuts import render
def index(request):
if request.location:
location = request.location
else:
location = None
return render(request, "homepage.html", {'location': location})
| mindcube/mindcube-django-cookiecutter | {{cookiecutter.repo_name}}/project/apps/geo_locator/views.py | Python | mit | 265 |
#
# Autogenerated by Thrift Compiler (0.9.2)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
# options string: py:twisted
#
from thrift.Thrift import TType, TMessageType, TException, TApplicationException
from thrift.transport import TTransport
from thrift.protocol import TBinaryProtocol, TPro... | mlhenderson/data_api | lib/doekbase/data_api/annotation/genome_annotation/service/ttypes.py | Python | mit | 58,338 |
from flask_login import LoginManager, UserMixin, login_user, logout_user, current_user, login_required
from werkzeug.security import generate_password_hash, check_password_hash
import ctf
class User(UserMixin, ctf.db.Model):
__tablename__ = 'users'
id = ctf.db.Column(ctf.db.Integer, primary_key=True)
user... | abdesslem/CTF | models.py | Python | mit | 1,692 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.