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 |
|---|---|---|---|---|---|
# coding: utf-8
"""
pygaarst.hyperionutils
Utility functions for processing Hyperion datasets
Created by Chris Waigl on 2014-04-25.
"""
from __future__ import division, print_function
import os
import numpy as np
def gethyperionbands():
"""
Load Hyperion spectral band values into Numpy structured array.
... | chryss/pygaarst | pygaarst/hyperionutils.py | Python | mit | 2,022 |
import math
import array
import base64
# This is required because Condor doesn't allow ads larger
# than 8192 chars in cronjob classads. Note: it takes x bytes
# to base64-encode .75x bytes, so this should give us 8000
# character chunks.
CHUNK_SIZE = (8000 * 3) / 4
class BitSet(object):
def __init__(self, size):
... | juve/mule | lib/mule/bits.py | Python | apache-2.0 | 2,282 |
##############################################################################
# Copyright (c) 2013-2018, 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... | EmreAtes/spack | var/spack/repos/builtin/packages/siesta/package.py | Python | lgpl-2.1 | 4,211 |
import sys
import threading
import os
import sys
player = None
respond = None
success = True
try:
filePath = sys.argv[1] + '.py'
except:
success = False
print('err received no filepath argument')
if(success):
try:
directoryPath = os.path.dirname(filePath)
fileName = os.path.splitext(o... | jacksondc/crane | client/client.py | Python | mit | 1,373 |
# -*- coding: utf-8 -*-
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
from pathlib import Path
from django.test import override_settings
from mock import DEFAULT, p... | flodolo/bedrock | bedrock/mozorg/tests/test_commands.py | Python | mpl-2.0 | 2,747 |
# -*- coding:utf-8 -*-
import threading
import socket
from ChatFrame import *
from Listener import *
import struct
import os
PACKKEY_SWITCH = '!i1020s'
PACKKEY_CHAT = '!i50si50si908s'
# 用户名长度,用户名,用户颜色长度,用户颜色,聊天信息长度,聊天信息
PACKKEY_FILE = '!i1016s'
# 文件名长度,文件名
class DataCenter():
def __init__(s... | a386881/AKAchat | AKAchatV0.2/DataCenter.py | Python | apache-2.0 | 4,103 |
from packetbeat import BaseTest
"""
Tests for the NFS
"""
class Test(BaseTest):
def test_V3(self):
"""
Should correctly parse NFS v3 packet
"""
self.render_config_template(
nfs_ports=[2049],
)
self.run_packetbeat(pcap="nfs_v3.pcap")
objs = self... | radoondas/elasticbeat | vendor/github.com/elastic/beats/packetbeat/tests/system/test_0061_nfs.py | Python | apache-2.0 | 1,469 |
import json
import sys
from collections import UserList
from django.conf import settings
from django.core.exceptions import ValidationError # backwards compatibility
from django.utils import six, timezone
from django.utils.encoding import force_text
from django.utils.html import escape, format_html, format_html_join,... | twz915/django | django/forms/utils.py | Python | bsd-3-clause | 5,880 |
from django.contrib import admin
from freemix.exhibit import models
class CanvasAdmin(admin.ModelAdmin):
list_display = ('title', 'description')
search_fields = ('title', 'description',)
admin.site.register(models.Canvas, CanvasAdmin)
class ExhibitAdmin(admin.ModelAdmin):
list_display = ('slu... | zepheira/freemix | freemix/exhibit/admin.py | Python | apache-2.0 | 632 |
import pickle
from io import BytesIO
import numpy as np
import scipy.sparse
from sklearn.datasets import load_digits, load_iris
from sklearn.model_selection import train_test_split
from sklearn.model_selection import cross_val_score
from sklearn.externals.six.moves import zip
from sklearn.utils.testing import assert... | mbayon/TFG-MachineLearning | venv/lib/python3.6/site-packages/sklearn/tests/test_naive_bayes.py | Python | mit | 21,805 |
# -*- coding: utf-8 -*-
#
from django.utils.translation import ugettext_lazy as _
from rest_framework import serializers
from django.db.models import F
from common.mixins import BulkSerializerMixin
from terminal.models import Session
from ops.models import CommandExecution
from . import models
class FTPLogSerializer... | jumpserver/jumpserver | apps/audits/serializers.py | Python | gpl-3.0 | 4,392 |
from __future__ import absolute_import, division, print_function
from fractions import Fraction
import sys
import subprocess
sys.path.insert(0, '../')
from compiler import *
from constructs import *
def _test_stencil():
R = Parameter(Int, "R")
C = Parameter(Int, "C")
x = Variable(Int, "x")
y = Varia... | bollu/polymage | sandbox/tests/test_t_stencil.py | Python | apache-2.0 | 1,425 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2012 VMware, Inc.
# Copyright (c) 2011 Citrix Systems, Inc.
# Copyright 2011 OpenStack Foundation
#
# 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
# ... | sridevikoushik31/openstack | nova/virt/vmwareapi/vmware_images.py | Python | apache-2.0 | 6,874 |
import unittest2 as unittest
from jnpr.junos.utils.config import Config
from nose.plugins.attrib import attr
from mock import MagicMock, patch
import re
import sys
import os
from lxml import etree
import six
from jnpr.junos.console import Console
from jnpr.junos.transport.tty_netconf import tty_netconf
from jnpr.junos... | Collisio-Adolebitque/pfne-2017 | py-junos-eznc/tests/unit/test_console.py | Python | gpl-3.0 | 10,886 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#-------------------------------------------------------------------------------
# Name: x6hr.py
# Purpose: log reader of SUUNTO H6HR
# Author: tomoya kamata (iware pref. japan)
# Created: 15 Mar 2010
# Copyright: GPL. please read COPYING file
# ma... | lycopersin/x6hr-python | x6hr.py | Python | gpl-3.0 | 17,896 |
from jinja2 import Environment, PackageLoader
class BaseRenderer(object):
"""
Base Renderer class
Renderers are used to generate a string
which represents the router configuration
"""
def __init__(self, backend):
self.config = backend.config
self.backend = backend
@proper... | openwisp/netjsonconfig | netjsonconfig/backends/base/renderer.py | Python | gpl-3.0 | 1,401 |
import os
import functools
live_connection = False
mturk_host = 'mechanicalturk.sandbox.amazonaws.com'
external_url = 'http://www.example.com/'
SetHostMTurkConnection = None
def config_environment():
global SetHostMTurkConnection
try:
local = os.path.join(os.path.dirname(__file__), 'local.py')
... | Chilledheart/chromium | tools/telemetry/third_party/gsutilz/third_party/boto/tests/mturk/_init_environment.py | Python | bsd-3-clause | 906 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
##################################################
# GNU Radio Python Flow Graph
# Title: Top Block
# Generated: Mon May 23 14:39:00 2016
##################################################
if __name__ == '__main__':
import ctypes
import sys
if sys.platform.sta... | ClydeSpace-GroundStation/GroundStation | GNURadio/Test_Files/Prepend_Append_Test/top_block.py | Python | mit | 3,839 |
#!/usr/bin/env python
# encoding: utf-8
from collections import namedtuple
import unittest
import math
import numpy as np
from scipy.spatial.distance import cosine
from gensim.models.doc2vec import Doc2Vec
from gensim import utils
from gensim.models import translation_matrix
from gensim.models import KeyedVectors
fro... | markroxor/gensim | gensim/test/test_translation_matrix.py | Python | lgpl-2.1 | 5,123 |
from compositor import Compositor
from OpenGL.GL import *
import boxmodel
class Panels(object):
def __init__(self, env, images, x, y, width, height):
self.panes = []
self.x = 0
self.y = 0
self.width = width
self.height = height
self.images = images
self.compo... | cheery/textended-edit | panels.py | Python | mit | 1,873 |
from plex.objects.library.metadata.album import Album
from plex.objects.library.metadata.artist import Artist
from plex.objects.library.metadata.clip import Clip
from plex.objects.library.metadata.episode import Episode
from plex.objects.library.metadata.movie import Movie
from plex.objects.library.metadata.season impo... | fuzeman/plex.py | plex/objects/library/metadata/__init__.py | Python | mit | 436 |
#!/usr/bin/env python3
#
# Copyright (c) Greenplum Inc 2012. All Rights Reserved.
#
from gppylib.commands.base import CommandResult
from mock import patch
from gppylib.commands.gp import is_pid_postmaster, get_postmaster_pid_locally
from test.unit.gp_unittest import GpTestCase, run_tests
class GpCommandTestCase(Gp... | 50wu/gpdb | gpMgmt/bin/gppylib/commands/test/unit/test_unit_gp.py | Python | apache-2.0 | 9,462 |
# Copyright 2019 Ignacio Ibeas <ignacio@acysos.com>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import _, models
from datetime import datetime
EUROPE = ['AT', 'BE', 'BG', 'CY', 'CZ', 'DE', 'DK', 'EE', 'EL', 'FI', 'FR',
'GB', 'HR', 'HU', 'IE', 'IT', 'LT', 'LU', 'LV', 'MT',... | acysos/odoo-addons | l10n_es_vat_book/report/vat_book_issued_xlsx.py | Python | agpl-3.0 | 7,020 |
try:
# Python 3
from django.utils.encoding import smart_text as smart_unicode
except ImportError:
try:
from django.utils.encoding import smart_unicode
except ImportError:
from django.forms.util import smart_unicode
__all__ = (
'smart_unicode',
) | pombredanne/django-fluent-contents | fluent_contents/utils/compat.py | Python | apache-2.0 | 283 |
from __future__ import unicode_literals
def execute():
import webnotes
import webnotes.model.doc
webnotes.conn.sql("delete from `tabDocPerm` where parent='Profile' and permlevel=1")
new_perms = [
{
'parent': 'Profile',
'parentfield': 'permissions',
'parenttype': 'DocType',
'role': 'Administrator',
... | gangadhar-kadam/mtn-erpnext | patches/august_2012/change_profile_permission.py | Python | agpl-3.0 | 759 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
import os
import sys
from os.path import exists
from os.path import join
from os.path import dirname
from os.path import abspath
if __name__ == "__main__":
base_path = dirname(dirname(abspath(__... | Woile/pyfsm | ci/bootstrap.py | Python | mit | 1,917 |
import datetime
import os
import traceback
import urllib
import urllib2
import urlparse
import sys
from dateutil import tz
import pytz
import xbmc
import xbmcaddon
import xbmcgui
import xbmcplugin
import xbmcvfs
from PIL import Image, ImageOps
import vars
def fetch(url):
log('Fetching %s' % url, xbmc.LOGINFO... | ivankokan/xbmc.plugin.video.nba | src/utils.py | Python | gpl-3.0 | 7,110 |
"""Unit test for eventmgr - processing Zookeeper events.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import glob
import io
import os
import shutil
import tempfile
import unittest
from tests.testutils import m... | bretttegart/treadmill | tests/eventmgr_test.py | Python | apache-2.0 | 9,281 |
# -*- coding: utf-8 -*-
import argparse
import re
from kanjinetworks import Kanji
class KanjiNetworksParser():
def parse(self, text, split_shinjitai=True):
def kanjis_from_line(line, split_shinjitai=True):
match = re.match(r'^\s*(?P<kanji>.?)\s+\((?P<strokes>\d*)\)\s+(?P<pronunciation>\S+)\... | acoomans/kanjinetworks | kanjinetworks/extract/parser.py | Python | mit | 13,014 |
from __future__ import division, print_function
import numpy as np
from itertools import product
import warnings
from scipy.sparse import csr_matrix
from sklearn import datasets
from sklearn import svm
from sklearn.datasets import make_multilabel_classification
from sklearn.random_projection import sparse_random_mat... | mbayon/TFG-MachineLearning | venv/lib/python3.6/site-packages/sklearn/metrics/tests/test_ranking.py | Python | mit | 43,099 |
from setuptools import setup, find_packages
from os.path import join, dirname
import PgDumpLoader
setup(
name = 'PgDumpLoader',
version = PgDumpLoader.__version__,
packages = find_packages(),
long_description = open(join(dirname(__file__), 'README.md')).read(),
install_requires=['sqlparse']
) | Dancer3809/PgDumpLoader | setup.py | Python | mit | 315 |
# -*- coding: utf-8 -*-
"""
# TO PUT ON PYTHON 3
##
##
#
# TO PUT ON PYTHON 3
##
##
# TO PUT ON PYTHON 3
##
##
# TO PUT ON PYTHON 3
##
##
# TO PUT ON PYTHON 3
##
##
# TO PUT ON PYTHON 3
##
##
# TO PUT ON PYTHON 3
##
##
# TO PUT ON PYTHON 3
##
##
from builtins import str
from builtins import range
import dzetsaka.scri... | lennepkade/dzetsaka | processing/sieveArea.py | Python | gpl-3.0 | 3,582 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, Ansible by Red Hat, inc
# 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_METADATA = {'metadata_version': '1.1',
... | shanemcd/ansible | lib/ansible/modules/network/junos/junos_banner.py | Python | gpl-3.0 | 5,062 |
#! /usr/bin/env python
###############################################################################
#
# simulavr - A simulator for the Atmel AVR family of microcontrollers.
# Copyright (C) 2001, 2002 Theodore A. Roth
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of th... | simark/simulavr | regress/test_opcodes/test_LDS.py | Python | gpl-2.0 | 2,639 |
from setuptools import setup
version = __import__('ateoto_tasting').__version__
setup(name = 'django-ateoto-tasting',
version = version,
author = 'Matthew McCants',
author_email = 'mattmccants@gmail.com',
description = 'Cupping application for django.',
license = 'BSD',
url = 'https://github.c... | ateoto/django-ateoto-tasting | setup.py | Python | bsd-3-clause | 429 |
from django.conf import settings
from django.core.mail import send_mail
from django.shortcuts import render
from questions.models import Question
from .forms import ContactForm, SignUpForm
from .models import SignUp
# Create your views here.
def home(request):
title = 'Sign Up Now'
form = SignUpForm(request.POST o... | Maelstroms38/Matchmaker | src/newsletter/views.py | Python | mit | 2,070 |
from django.conf import settings
import subprocess
import os, os.path
import csv
import psycopg2
from django.core.management.base import BaseCommand, CommandError
def rm(*paths):
for path in paths:
if os.path.exists(path):
os.remove(path)
def zip(filename, zipfile=None):
zipfile = zipfile... | osmie/osm-irish-townlands | irish_townlands/management/commands/make_dump_files.py | Python | gpl-3.0 | 9,811 |
import logging
from flask import Flask
from flask_appbuilder import AppBuilder, SQLA
"""
Logging configuration
"""
logging.basicConfig(format="%(asctime)s:%(levelname)s:%(name)s:%(message)s")
logging.getLogger().setLevel(logging.DEBUG)
app = Flask(__name__)
app.config.from_object("config")
db = SQLA(app)
appbuilde... | dpgaspar/Flask-AppBuilder | examples/simpleform/app/__init__.py | Python | bsd-3-clause | 382 |
"""
Edraak University ID.
The module is enabled with the following feature flag:
- `EDRAAK_UNIVERSITY_APP`
The module has the following main features:
- Edraak (university): Add tab to the courseware
- Edraak (university): Instructor management view
- Edraak (university): Student form to enter their uni... | Edraak/edraak-platform | lms/djangoapps/edraak_university/__init__.py | Python | agpl-3.0 | 593 |
# settings.py
#######################################################
#
# Definition of the different paths:
# - CellProfiler (Software, input, output)
# - Input
# - Output
#
#######################################################
import os
def init():
global pathList
CPPath= "D:/Logiciel/CellProfiler... | maxBombrun/lipidDroplets | settings.py | Python | bsd-3-clause | 1,178 |
#from http://rosettacode.org/wiki/Probabilistic_choice#Python
#pythran export test()
#runas test()
import random, bisect
def probchoice(items, probs, bincount=1000):
'''
Splits the interval 0.0-1.0 in proportion to probs
then finds where each random.random() choice lies
'''
prob_accumulator = 0
... | hainm/pythran | pythran/tests/rosetta/proba_choice.py | Python | bsd-3-clause | 1,969 |
# 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
# d... | tbachman/group-based-policy | gbpservice/tests/contrib/gbpfunctests/libs/verify_libs.py | Python | apache-2.0 | 16,213 |
'''
Created on 2015/02/08
@author: Taiga
'''
class InvalidReportFormat(Exception):
'''
exception when backtest or optimization report format is invalid
'''
def __init__(self, report_file, err_msg):
'''
Constructor
'''
self.report_file = report_file
self.err... | samuraitaiga/py-metatrader | metatrader/exception.py | Python | apache-2.0 | 452 |
# -*- coding: UTF-8 -*-
#
# Copyright (c) 2015-2019 by Inteos Sp. z o.o.
# All rights reserved. See LICENSE file for details.
#
from __future__ import unicode_literals
from django.db import models
"""
# Create your models here.
class Permissions(models.Model):
class Meta:
managed = False
permiss... | inteos/IBAdmin | system/models.py | Python | agpl-3.0 | 576 |
"""Sanity test using validate-modules."""
from __future__ import absolute_import, print_function
import collections
import json
import os
from lib.sanity import (
SanitySingleVersion,
SanityMessage,
SanityFailure,
SanitySuccess,
SanitySkipped,
)
from lib.util import (
SubprocessError,
dis... | pilou-/ansible | test/runner/lib/sanity/validate_modules.py | Python | gpl-3.0 | 5,727 |
from flask import Flask, request, session, redirect, render_template, g, url_for, jsonify
from functools import wraps
from commandrunner import CommandRunner
import requests, sqlite3, os, bcrypt
application = Flask(__name__)
application.config['DEBUG'] = True
application.secret_key = 'as3r14saf3tGWEF'
salt = "$2b$1... | WilliamMarti/confgr | confgr/confgr.py | Python | mit | 9,392 |
#
# The Multiverse Platform is made available under the MIT License.
#
# Copyright (c) 2012 The Multiverse Foundation
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without restrict... | longde123/MultiversePlatform | server/config/LES_world/group3_test_client.py | Python | mit | 1,909 |
# -*- coding: utf-8 -*-
from django.db.models import F, Q
import pytest
from moneyed import Money
from djmoney._compat import split_expression
from djmoney.models.managers import _expand_money_args, _expand_money_kwargs
from djmoney.utils import get_amount
from .testapp.models import ModelWithNonMoneyField
def ass... | AlexRiina/django-money | tests/test_managers.py | Python | bsd-3-clause | 6,718 |
"""Django admin support for treebeard"""
import sys
import django
from django.conf import settings
from django.conf.urls import url
from django.contrib import admin, messages
from django.http import HttpResponse, HttpResponseBadRequest
from django.utils.translation import ugettext_lazy as _
if sys.version_info >= (... | skirsdeda/django-treebeard | treebeard/admin.py | Python | apache-2.0 | 5,184 |
# -*- coding: utf-8 -*-
"""Test model functions."""
from util import db
import datetime
import frost.model
import pytest
def test_get_unauthed_session(db):
session = frost.model.get_session_data('noauth')
assert session == {
'csrf': 'somecsrf',
}
def test_get_authed_session(db):
session = f... | nickfrostatx/frost | tests/test_model.py | Python | mit | 2,739 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Article.allow_comments'
db.add_column('cms_article', 'all... | josircg/raizcidadanista | raizcidadanista/cms/migrations/0003_auto__add_field_article_allow_comments.py | Python | gpl-3.0 | 13,570 |
import unittest
import numpy as np
from dama.measures import ListMeasure, Measure, MeasureBatch
from dama.measures import accuracy, precision, f1, logloss
from dama.measures import gini_normalized
from dama.data.it import Iterator
class TestListMeasure(unittest.TestCase):
def setUp(self):
self.list_measu... | elaeon/ML | tests/test_measure.py | Python | apache-2.0 | 7,424 |
"""
Trie - Short Encoding of Words (medium)
A valid encoding of an array of `words` is any reference string `s` and array
of `indices` indices such that:
* `words.length == indices.length`
* The reference string `s` ends with the '#' character.
* For each index `indices[i]`, the substring of `s` starting from `indice... | dreamibor/Algorithms-and-Data-Structures-Using-Python | practice/implementation/trie/short_encoding_of_words.py | Python | gpl-3.0 | 3,707 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Language.display_name'
db.add_column('translated_model_language', 'display_name', self.gf(... | charlesmastin/django-simple-cms | simple_cms/contrib/translated_model/migrations/0003_add_display_name.py | Python | mit | 2,647 |
from itertools import permutations
def gon(p):
sum = 10 + p[4] + p[0]
used = (1<<p[4])
start = (10, 0)
spokes = ["10%d%d" % (p[4], p[0])]
for i in range(4):
out = sum - p[i] - p[i+1]
if out > 9 or out < 1: break
used |= (1<<p[i]) + (1<<out)
start = min(start, (out, i... | jokkebk/euler | p68.py | Python | mit | 530 |
import threading
from copy import deepcopy
from functools import reduce
from requests import exceptions
from remix import utils
class RaiseForStatusMixin(object):
def process_request(self, *args, **kwargs):
response = super(RaiseForStatusMixin, self).process_request(*args, **kwargs)
response.rai... | jsurloppe/remix | remix/mixins/request.py | Python | bsd-3-clause | 4,591 |
"""
IP Types
"""
import logging
from ipaddress import ip_address
from socket import AF_INET, AF_INET6
from vpp_papi import VppEnum
from vpp_object import VppObject
try:
text_type = unicode
except NameError:
text_type = str
_log = logging.getLogger(__name__)
class DpoProto:
DPO_PROTO_IP4 = 0
DPO_P... | FDio/vpp | test/vpp_ip.py | Python | apache-2.0 | 6,921 |
"""
@brief test tree node (time=7s)
"""
import sys
import os
import unittest
import warnings
from pyquickhelper.pycode import publish_coverage_on_codecov, ExtTestCase
from pyquickhelper.loghelper.repositories.pygit_helper import GitException
class TestCoverage(ExtTestCase):
@unittest.skipIf(sys.version_i... | sdpython/pyquickhelper | _unittests/ut_pycode/test_coverage.py | Python | mit | 798 |
# Django settings for django-custom-user-example project.
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.b... | jonathanchu/django-custom-user-example | customuser/settings.py | Python | mit | 5,041 |
from __future__ import unicode_literals
import logging
from django.conf import settings
from django.contrib import auth as django_auth
from django.utils.functional import SimpleLazyObject
from django.utils.six import text_type
from django_auth0_toolkit.auth_api import get_user_info_with_id_token
from django_auth0_to... | shauns/django_auth0_toolkit | django_auth0_toolkit/middleware.py | Python | mit | 2,860 |
# encoding: utf-8
"""
Copyright (c) 2012 - 2016, Ernesto Ruge
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of condit... | ruhrmobil-E/mobilitaet-finden | webapp/sync/flinkster.py | Python | bsd-3-clause | 3,968 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2014 Therp BV (<http://therp.nl>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of ... | Therp/purchase_procuration_multi_level | model/res_procuration_limit_user.py | Python | agpl-3.0 | 9,866 |
# Copyright 2017 DataCentred Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | spjmurray/openstack-sentinel | sentinel/tests/functional/network/v2/test_floatingips.py | Python | apache-2.0 | 1,523 |
# Django settings for dbpatterns project.
import os
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choice... | fatiherikli/dbpatterns | web/dbpatterns/dbpatterns/settings.py | Python | mit | 6,851 |
"""
Extract line_walk code from live_dt for use in other places.
Provides a more "hands-on" approach to checking an arbitrary
line segment against existing elements of a CGAL constrained
delaunay triangulation
"""
from __future__ import print_function
from stompy.spatial import robust_predicates
from stompy.grid import... | rustychris/stompy | stompy/grid/cgal_line_walk.py | Python | mit | 13,615 |
#!/usr/bin/env python
__author__ = 'Simon_2'
# ======================================================================================================================
# Extract results from .txt files generated by " " and draw box-and-whisker plots comparing the absolute error of
# estimation using the different metr... | 3324fr/spinalcordtoolbox | dev/atlas/validate_atlas/plot_abs_error_vs_fractional_volume.py | Python | mit | 22,308 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2016 Bet@net
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This progra... | francisco-betancourt/ctrlpyme4 | controllers/product_loss.py | Python | gpl-3.0 | 5,237 |
# -*- coding: utf-8 -*-
#
# This file is a plugin for EventGhost.
# Copyright © 2005-2016 EventGhost Project <http://www.eventghost.net/>
#
# EventGhost 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 v... | WoLpH/EventGhost | plugins/TechniSatUsb/__init__.py | Python | gpl-2.0 | 2,702 |
#!/usr/bin/env python
# -*- coding: latin-1 -*-
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation; either version 3, or (at your option) any later
# version.
#
# This program is distr... | ccpgames/eve-metrics | web2py/gluon/contrib/pysimplesoap/server.py | Python | mit | 21,270 |
"""
Module: num2word_EN_GB_old.py
Requires: num2word_EN_GB_old.py
Version: 0.3
Author:
Taro Ogawa (tso@users.sourceforge.org)
Copyright:
Copyright (c) 2003, Taro Ogawa. All Rights Reserved.
Licence:
This module is distributed under the Lesser General Public Licence.
http://www.opensource.org/licen... | guildenstern70/pyfab | src/numtoword/num2word_EN_GB_old.py | Python | mit | 1,578 |
# -*- coding: utf8 -*-
from django.apps import apps
from django.db import models
from django.core.exceptions import ObjectDoesNotExist
from django.urls import reverse
from taggit.models import GenericTaggedItemBase, TagBase
class CustomTag(TagBase):
"""
A tag can have one of the following two forms:
- a... | ugoertz/django-familio | tags/models.py | Python | bsd-3-clause | 4,293 |
# from .utils import session, streamElements, noQuote
# from .config import config
| adebali/mistipy | mistipy/mistdb_wrapper/__init__.py | Python | mit | 83 |
#!/usr/bin/python
#
# Instead of coding records, this coder loads results from a cache written out by a previous run. This can be used to speed up iteration.
import cPickle
class CachedCoder:
def __init__(self, name):
self._name = name
unpickler = cPickle.Unpickler(open('/tmp/coder.%s.pickle' % name, 'r'))
... | danvk/oldnyc | coders/cached_coder.py | Python | apache-2.0 | 589 |
# encoding: utf-8
# module PyQt4.QtCore
# from /usr/lib/python3/dist-packages/PyQt4/QtCore.cpython-34m-x86_64-linux-gnu.so
# by generator 1.135
# no doc
# imports
import sip as __sip
from .QObject import QObject
class QSignalMapper(QObject):
""" QSignalMapper(QObject parent=None) """
def map(self, QObject=N... | ProfessorX/Config | .PyCharm30/system/python_stubs/-1247971765/PyQt4/QtCore/QSignalMapper.py | Python | gpl-2.0 | 1,738 |
# Copyright (c) 2014 by Ecreall under licence AGPL terms
# available on http://www.gnu.org/licenses/agpl.html
# licence: AGPL
# author: Amen Souissi
import deform
from pyramid.view import view_config
from pyramid import renderers
from dace.objectofcollaboration.principal.util import get_current
from dace.processinsta... | ecreall/nova-ideo | novaideo/views/comment_management/remove.py | Python | agpl-3.0 | 2,434 |
#! /usr/bin/python
## Copyright (C) 2014 Bitergia
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 3 of the License, or
## (at your option) any later version.
##
## This pro... | VizGrimoire/GrimoireLib | grimoirelib_alch/type/timeseries.py | Python | gpl-3.0 | 6,219 |
"""
Loadable.Loadable subclass
"""
# This file is part of Munin.
# Munin 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 version.
# Munin is ... | munin/munin | deprecated/cajbook.py | Python | gpl-2.0 | 7,158 |
# Copyright (c) 2012 The Khronos Group Inc.
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and /or associated documentation files (the "Materials "), to deal in the Materials without restriction, including without limitation the rights to use, copy, modify, merge, publis... | KhronosGroup/COLLADA-CTS | StandardDataSets/collada/library_cameras/camera/optics/orthographic/optics_orthographic_zfar/optics_orthographic_zfar.py | Python | mit | 4,007 |
class User:
def __init__(self,id="",name="", org=None):
if org == None: return
self.id = id
self.name = name
self.key = self.to_key(org.id, id)
self.organization = org
@staticmethod
def to_key(org,id):
return 'organization:%s:user:%s' % (org,id)
| lms-io/scormfu | src/user.py | Python | mit | 316 |
#from distutils.core import setup
from setuptools import setup
import os
try:
import pypandoc
long_description = pypandoc.convert('README.md', 'rst')
except(IOError, ImportError):
long_description = 'Real-time sentiment analysis for twitter.'
filename = 'tweetfeels/version.py'
exec(compile(open(filename, ... | uclatommy/tweetfeels | setup.py | Python | bsd-3-clause | 1,341 |
#!/usr/bin/env python2.7
from nltk.book import *
text1.similar("monstrous")
text2.similar("monstrous") | prinsmike/nltk_book | ch01/03-similar.py | Python | apache-2.0 | 104 |
#!/usr/bin/env python
"""
Various utility functions
--------------------------------------------------------------------
This program is licensed under the GNU General Public License (GPL)
Version 3. See http://www.fsf.org for details of the license.
Rugged Circuits LLC
http://ruggedcircuits.com/gerbmerge
"""
def ... | fightingwalrus/gerbmerge | gerbmerge/util.py | Python | gpl-3.0 | 501 |
# -*- coding: utf-8 -*-
#
# furl - URL manipulation made simple.
#
# Arthur Grunseid
# grunseid.com
# grunseid@gmail.com
#
# License: Build Amazing Things (Unlicense)
import sys
if sys.version_info[0] == 2:
basestring = basestring
else:
basestring = (str, bytes)
if list(sys.version_info[:2]) >= [2, 7]:
... | penyatree/furl | furl/compat.py | Python | unlicense | 755 |
# -*- coding: utf-8 -*-
from __future__ import print_function
from datetime import datetime
import operator
import nose
from numpy import nan, random
import numpy as np
from pandas.compat import lrange
from pandas import compat
from pandas import (DataFrame, Series, MultiIndex, Timestamp,
date_... | andyraib/data-storage | python_scripts/env/lib/python3.6/site-packages/pandas/tests/frame/test_operators.py | Python | apache-2.0 | 45,846 |
from uaperrors import StepError
import sys
from logging import getLogger
from abstract_step import AbstractStep
import os
logger = getLogger('uap_logger')
class PreseqFutureGenomeCoverage(AbstractStep):
'''
The preseq package is aimed at predicting the yield of distinct reads from a
genomic library from ... | kmpf/uap | include/steps/preseq_future_genome_coverage.py | Python | gpl-3.0 | 4,730 |
from .alerttask import AlertTask
class DeadmanAlertTask(AlertTask):
def executeSearchEventsSimple(self):
# We override this method to specify the size as 1
# since we only care about if ANY events are found or not
results = self.main_query.execute(self.es, indices=self.event_indices, size... | jeffbryner/MozDef | alerts/lib/deadman_alerttask.py | Python | mpl-2.0 | 347 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from selenium.webdriver.common.by import By
from pages.base import BasePage
from pages.regions.download_button import D... | ericawright/bedrock | tests/pages/firefox/browsers/browser_history.py | Python | mpl-2.0 | 667 |
from __future__ import print_function
from . import __version__ as gradientzoo_version
import json
import os
import requests
__all__ = ['StatusCodeError', 'NotFoundError', 'Gradientzoo']
DEFAULT_DIR = os.path.realpath(os.path.expanduser('~/.gradientzoo/cache'))
API_BASE = 'https://api.gradientzoo.com'
class Stat... | gradientzoo/python-gradientzoo | gradientzoo/client.py | Python | bsd-3-clause | 5,401 |
REDIS_HOST = 'localhost'
REDIS_PORT = 6379
REDIS_DB = 0
REDIS_PASSWORD = None
DEBUG = True
COMMAND_PREFIX = '!'
| samsam2310/LINE | config.py | Python | bsd-3-clause | 138 |
# #
# Copyright 2012-2015 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://vscentrum.be/nl/en),
# the Hercules foundation (ht... | pneerincx/easybuild-framework | easybuild/toolchains/mpi/mpich.py | Python | gpl-2.0 | 2,426 |
class EngineIOError(Exception):
pass
class ContentTooLongError(EngineIOError):
pass
class UnknownPacketError(EngineIOError):
pass
class QueueEmpty(EngineIOError):
pass
class SocketIsClosedError(EngineIOError):
pass
class ConnectionError(EngineIOError):
pass
| miguelgrinberg/python-engineio | src/engineio/exceptions.py | Python | mit | 292 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2012-2021 SoftBank Robotics. All rights reserved.
# Use of this source code is governed by a BSD-style license (see the COPYING file).
""" QiBuild """
from __future__ import absolute_import
from __future__ import unicode_literals
from __future__ import print... | aldebaran/qibuild | python/qipy/test/test_qipy_deplopy.py | Python | bsd-3-clause | 654 |
import mwparserfromhell
import pywikibot
pywikibot.config.family = "wikipedia"
pywikibot.config.mylang = "en"
site = pywikibot.Site()
site.login()
class UserSandboxTemplateFixer(object):
def __init__(self):
self.user_sandbox_template = pywikibot.Page(site, "Template:User sandbox")
self.user_sand... | HazardSJ/HazardBot | enwiki/user_sandbox.py | Python | mit | 3,290 |
from timeit import default_timer as timer
start = timer()
from datetime import datetime, timedelta
from uuid import uuid4
eventid = datetime.now().strftime('%Y%m-%d%H-%M%S-') + str(uuid4())
start_arc = timer()
import arcpy
done_arc = timer() - start_arc
import os
machine = os.environ['COMPUTERNAME']
d = arcpy.GetIn... | maphew/arcplus | arcplus/arcpy-overhead.py | Python | mit | 684 |
import augeas
import os
import sys
import shutil
import re
import fnmatch
from collections import OrderedDict
import express_utils
from express_utils import LOGGER
from express_utils import APACHE_SERVICES
from express_utils import replace_chars
class ParserException(Exception):
def __init__(self, message, direc... | digicert/express_install | digicert_express/parsers/base.py | Python | mit | 23,783 |
import unittest
from python.src import summation
class test_summation(unittest.TestCase):
def test_find_sum(self):
self.assertEqual(0, summation.find_sum(0))
self.assertEqual(1, summation.find_sum(1))
self.assertEqual(3, summation.find_sum(2))
self.assertEqual(5050, summation.find_sum(100))
| yamaszone/software-testing | tutorials/unittests/python/tests/test_summation.py | Python | mit | 303 |
# Copyright 2012 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... | cboling/SDNdbg | docs/old-stuff/pydzcvr/doc/neutronclient/v2_0/client.py | Python | apache-2.0 | 54,103 |
"""Script to concatenate all the csv output from top level analysis directory.
Assumes analysis directory has the structure below:
timepoint_directory/series_directory/cells.csv
"""
import argparse
import os
import os.path
from csv import header
def print_csv(directory):
csv_path = os.path.join(directory, "ce... | JIC-Image-Analysis/root-3d-segmentation | scripts/cat_csv_files.py | Python | mit | 1,187 |
from django.test import Client, TestCase
from django.urls import reverse
from rest_framework import status
from mediocris.tests.factories import UserFactory, TopicFactory
class TopicViewSetTestCase(TestCase):
def setUp(self):
self.user = UserFactory(is_staff=False, is_superuser=False)
TopicFac... | sdeleeuw/mediocris | mediocris/tests/test_view_topic.py | Python | gpl-3.0 | 1,830 |
"""Models providing Programs support for the LMS and Studio."""
import six
from config_models.models import ConfigurationModel
from django.db import models
from django.utils.translation import ugettext_lazy as _
class ProgramsApiConfig(ConfigurationModel):
"""
This model no longer fronts an API, but now set... | edx-solutions/edx-platform | openedx/core/djangoapps/programs/models.py | Python | agpl-3.0 | 1,380 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.