code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
from django.shortcuts import * # noqa
def paginate(object_list, page, per_page, orphans=0,
allow_empty_first_page=True):
from django.http import Http404
from django.core.paginator import Paginator, EmptyPage
from misago.core.exceptions import ExplicitFirstPage
if page in (1, "1"):
... | 390910131/Misago | misago/core/shortcuts.py | Python | gpl-2.0 | 736 |
from __future__ import division, absolute_import, print_function
import sys
import platform
from decimal import Decimal
import warnings
import itertools
import numpy as np
from numpy.core import *
from numpy.random import rand, randint, randn
from numpy.testing import *
from numpy.core.multiarray import dot as dot_
... | ruibarreira/linuxtrail | usr/lib/python2.7/dist-packages/numpy/core/tests/test_numeric.py | Python | gpl-3.0 | 65,826 |
# -*- coding: utf-8 -*-
from ..internal.SimpleCrypter import SimpleCrypter
class CrockoComFolder(SimpleCrypter):
__name__ = "CrockoComFolder"
__type__ = "crypter"
__version__ = "0.07"
__status__ = "testing"
__pattern__ = r'http://(?:www\.)?crocko\.com/f/.+'
__config__ = [("activated", "bool"... | Arno-Nymous/pyload | module/plugins/crypter/CrockoComFolder.py | Python | gpl-3.0 | 862 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module is Copyright (c) 2009-2013 General Solutions (http://gscom.vn) All Rights Reserved.
#
# This program is free software: you can redistribute it and/or... | addition-it-solutions/project-all | addons/l10n_vn/__openerp__.py | Python | agpl-3.0 | 1,696 |
#-*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2010 Camptocamp SA (http://www.camptocamp.com)
# All Right Reserved
#
# Author : Ferdinand Gassauer (ChriCar Beteiligungs- und Beratungs- GmbH)
#
# WARNING: This program as such is intended to be use... | VitalPet/c2c-rd-addons | stock_product_zero/report/__init__.py | Python | agpl-3.0 | 1,453 |
# 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... | maheshp/novatest | nova/api/openstack/compute/limits.py | Python | apache-2.0 | 15,804 |
from datetime import datetime, timedelta
from .interchange import WaypointType, ActivityStatisticUnit, ActivityType, LapIntensity, LapTriggerMethod
from .devices import DeviceIdentifier, DeviceIdentifierType
import struct
import sys
import pytz
class FITFileType:
Activity = 4 # The only one we care about now.
class ... | cmgrote/tapiriik | tapiriik/services/fit.py | Python | apache-2.0 | 22,972 |
"""
.. module: lemur.auth.views
:platform: Unix
:copyright: (c) 2015 by Netflix Inc., see AUTHORS for more
:license: Apache, see LICENSE for more details.
.. moduleauthor:: Kevin Glisson <kglisson@netflix.com>
"""
import jwt
import base64
import requests
from flask import g, Blueprint, current_app
from fl... | rhoml/lemur | lemur/auth/views.py | Python | apache-2.0 | 8,442 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Michael Still and Canonical 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:... | ntt-sic/nova | nova/virt/configdrive.py | Python | apache-2.0 | 6,518 |
import sys
import unittest
import traceback
import maya.cmds as cmds
import pymel.core as pm
import pymel.util as util
import pymel.util.testing as testing
class TestConstraintVectorQuery(testing.TestCaseExtended):
def setUp(self):
cmds.file(new=1, f=1)
def _doTestForConstraintType(self, constraintT... | assumptionsoup/pymel | tests/test_animation.py | Python | bsd-3-clause | 11,519 |
import os
import stat
import unittest
import tempfile
import shutil
from mock import Mock
try:
import catkin.environment_cache
from catkin.environment_cache import _append_header, _set_variable, _append_comment, _is_not_windows, generate_environment_script
except ImportError as impe:
raise ImportError(
... | thaddeustaylor/catkin | test/unit_tests/test_environment_cache.py | Python | bsd-3-clause | 3,047 |
#!/usr/bin/env python
#
# Copyright 2007 Google 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 applicable law o... | ProfessionalIT/maxigenios-website | sdk/google_appengine/google/appengine/cron/GrocParser.py | Python | mit | 29,691 |
"""A backport of the get_terminal_size function from Python 3.3's shutil."""
__title__ = "backports.shutil_get_terminal_size"
__version__ = "1.0.0"
__license__ = "MIT"
__author__ = "Christopher Rosell"
__copyright__ = "Copyright 2014 Christopher Rosell"
__all__ = ["get_terminal_size"]
from .get_terminal_size import ... | nateprewitt/pipenv | pipenv/vendor/backports/shutil_get_terminal_size/__init__.py | Python | mit | 338 |
from test import test_support
import time
import unittest
class TimeTestCase(unittest.TestCase):
def setUp(self):
self.t = time.time()
def test_data_attributes(self):
time.altzone
time.daylight
time.timezone
time.tzname
def test_clock(self):
time.clock()
... | zephyrplugins/zephyr | zephyr.plugin.jython/jython2.5.2rc3/Lib/test/test_time.py | Python | epl-1.0 | 9,726 |
#CHIPSEC: Platform Security Assessment Framework
#Copyright (c) 2010-2016, Intel Corporation
#
#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; Version 2.
#
#This program is distributed in the hope... | chipsecintel/chipsec | source/tool/chipsec/modules/tools/vmm/hv/define.py | Python | gpl-2.0 | 23,148 |
from moment_plots import *
np.random.seed(1)
ts = test_series()
s = ts.cumsum()
ts2 = test_series()
s2 = ts2.cumsum()
s[20:50] = np.NaN
s[120:150] = np.NaN
fig, axes = plt.subplots(3, 1, figsize=(8, 10), sharex=True)
ax0, ax1, ax2 = axes
ax0.plot(s.index, s.values)
ax0.plot(s2.index, s2.values)
ax0.set_title('time... | Ziqi-Li/bknqgis | pandas/doc/plots/stats/moments_rolling_binary.py | Python | gpl-2.0 | 617 |
# (c) 2016 RedHat
#
# This file is part of Ansible.
#
# Ansible 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.
#
# Ansible is distribu... | naslanidis/ansible | lib/ansible/plugins/shell/__init__.py | Python | gpl-3.0 | 6,488 |
# Copyright (C) 2012,2013
# Max Planck Institute for Polymer Research
# Copyright (C) 2008,2009,2010,2011
# Max-Planck-Institute for Polymer Research & Fraunhofer SCAI
#
# This file is part of ESPResSo++.
#
# ESPResSo++ is free software: you can redistribute it and/or modify
# it under the terms of t... | MrTheodor/espressopp | testsuite/interaction_potentials/unittest/PTestFENE.py | Python | gpl-3.0 | 1,424 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2008 PC Solutions (<http://pcsol.be>). All Rights Reserved
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free... | crmccreary/openerp_server | openerp/addons/point_of_sale/account_bank_statement.py | Python | agpl-3.0 | 3,115 |
# -*- coding: utf-8 -*-
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
... | KL-WLCR/incubator-airflow | tests/test_logging_config.py | Python | apache-2.0 | 7,599 |
"""
This component provides HA cover support for Abode Security System.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/cover.abode/
"""
import logging
from homeassistant.components.abode import AbodeDevice, DOMAIN as ABODE_DOMAIN
from homeassistant.comp... | ewandor/home-assistant | homeassistant/components/cover/abode.py | Python | apache-2.0 | 1,326 |
#!/bin/env python
import npyscreen
class MainFm(npyscreen.Form):
def create(self):
self.mb = self.add(npyscreen.MonthBox,
use_datetime = True)
class TestApp(npyscreen.NPSAppManaged):
def onStart(self):
self.addForm("MAIN", MainFm)
if __name__ == "__main__":
A = TestA... | tescalada/npyscreen-restructure | tests/testMonthbox.py | Python | bsd-2-clause | 337 |
# originally inspired by "six" by Benjamin Peterson
import inspect
import sys
if sys.version_info < (3,0):
text_type = unicode
binary_type = str
import StringIO
StringIO = BytesIO = StringIO.StringIO
else:
text_type = str
binary_type = bytes
import io
StringIO = io.StringIO
Byte... | eschleicher/flask_shopping_list | venv/lib/python3.4/site-packages/argh/compat.py | Python | mit | 2,834 |
# -*- coding: utf-8 -*-
"""
flaskbb.utils.fields
~~~~~~~~~~~~~~~~~~~~
Additional fields for wtforms
:copyright: (c) 2014 by the FlaskBB Team.
:license: BSD, see LICENSE for more details.
"""
from datetime import datetime
from wtforms.fields import DateField
class BirthdayField(DateField):
""... | KevinHock/rtdpyt | profiling/test_projects/flaskbb_lite_3/flaskbb/utils/fields.py | Python | gpl-2.0 | 1,093 |
# Natural Language Toolkit (NLTK) Help
#
# Copyright (C) 2001-2015 NLTK Project
# Authors: Steven Bird <stevenbird1@gmail.com>
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
"""
Provide structured access to documentation.
"""
from __future__ import print_function
import re
from textwrap import w... | Reagankm/KnockKnock | venv/lib/python3.4/site-packages/nltk/help.py | Python | gpl-2.0 | 1,649 |
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Tests for L{twisted.internet.iocpreactor}.
"""
import errno
from array import array
from struct import pack
from socket import AF_INET6, AF_INET, SOCK_STREAM, SOL_SOCKET, error, socket
from zope.interface.verify import verifyClass
from twis... | Architektor/PySnip | venv/lib/python2.7/site-packages/twisted/internet/test/test_iocp.py | Python | gpl-3.0 | 5,182 |
from datetime import datetime
from treeherder.log_parser.parsers import StepParser
def test_date_with_milliseconds():
"""Handle buildbot dates that have a decimal on the seconds."""
parser = StepParser()
dt = parser.parsetime('2015-01-20 16:42:33.352621')
assert dt == datetime(2015, 1, 20, 16, 42, 33... | adusca/treeherder | tests/log_parser/test_step_parser.py | Python | mpl-2.0 | 570 |
########################################################################
#
# File Name: HTMLSelectElement.py
#
#
"""
WWW: http://4suite.com/4DOM e-mail: support@4suite.com
Copyright (c) 2000 Fourthought Inc, USA. All Rights Reserved.
See http://4suite.com/COPYRIGHT for license and copyright info... | alanjw/GreenOpenERP-Win-X86 | python/Lib/site-packages/_xmlplus/dom/html/HTMLSelectElement.py | Python | agpl-3.0 | 4,750 |
# 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... | cg31/tensorflow | tensorflow/contrib/distributions/python/ops/operator_test_util.py | Python | apache-2.0 | 6,295 |
#!/usr/bin/python
# Test tool to disassemble MC files. By Nguyen Anh Quynh, 2017
import array, os.path, sys
from capstone import *
# convert all hex numbers to decimal numbers in a text
def normalize_hex(a):
while(True):
i = a.find('0x')
if i == -1: # no more hex number
break
h... | bSr43/capstone | suite/disasm_mc.py | Python | bsd-3-clause | 7,561 |
"""
TestCases for DB.associate.
"""
import sys, os, string
import tempfile
import time
from pprint import pprint
try:
from threading import Thread, currentThread
have_threads = 1
except ImportError:
have_threads = 0
import unittest
from test_all import verbose
try:
# For Pythons w/distutils pybsddb
... | xbmc/atv2 | xbmc/lib/libPython/Python/Lib/bsddb/test/test_associate.py | Python | gpl-2.0 | 11,198 |
"""
Customizations of sphinx for gnuradio use.
"""
from sphinx.ext.autodoc import py_ext_sig_re
from sphinx.ext.autodoc import ClassDocumenter, FunctionDocumenter, members_option
from sphinx.ext.autodoc import bool_option, members_set_option, identity
from sphinx.ext.autodoc import ALL
# A dictionary of the number of... | chiotlune/ext | gnuradio-3.7.0.1/docs/sphinx/gnuradio_sphinx.py | Python | gpl-2.0 | 7,553 |
#!/usr/bin/env python
# Copyright (C) 2018 Duncan Macleod, Collin Capano
#
# 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 versi... | ligo-cbc/pycbc | docs/_include/transforms-table.py | Python | gpl-3.0 | 1,272 |
#!/usr/bin/python
#
# This file is part of Ansible
#
# Ansible 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.
#
# Ansible is distribut... | ColOfAbRiX/ansible | lib/ansible/modules/network/nxos/nxos_pim.py | Python | gpl-3.0 | 9,817 |
"""
Django Extensions additional model fields
"""
import re
import six
import string
import warnings
try:
import uuid
HAS_UUID = True
except ImportError:
HAS_UUID = False
try:
import shortuuid
HAS_SHORT_UUID = True
except ImportError:
HAS_SHORT_UUID = False
from django.core.exceptions import ... | devs1991/test_edx_docmode | venv/lib/python2.7/site-packages/django_extensions/db/fields/__init__.py | Python | agpl-3.0 | 20,102 |
import logging
from colorama import init, Fore, Back, Style
class Header():
def __init__(self):
init() # for colorama
def first_title(self):
init()
print Style.BRIGHT + Fore.WHITE
print '|====================================================================|'
print '| ... | theoneandonly-vector/LaZagne | Windows/src/LaZagne/config/header.py | Python | lgpl-3.0 | 1,270 |
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..compat import compat_str
class TF1IE(InfoExtractor):
"""TF1 uses the wat.tv player."""
_VALID_URL = r'https?://(?:(?:videos|www|lci)\.tf1|(?:www\.)?(?:tfou|ushuaiatv|histoire|tvbreizh))\.fr/(?:[^/]+/)*(?P<id>[^/?... | vinegret/youtube-dl | youtube_dl/extractor/tf1.py | Python | unlicense | 3,611 |
"""Testing for the boost module (sklearn.ensemble.boost)."""
import numpy as np
from sklearn.utils.testing import assert_array_equal, assert_array_less
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_raises, assert_rais... | Barmaley-exe/scikit-learn | sklearn/ensemble/tests/test_weight_boosting.py | Python | bsd-3-clause | 15,811 |
"""
WSGI config for server project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "server.settings")
from django.core.wsg... | iscarecrow/sb | server/wsgi.py | Python | mit | 387 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | inovtec-solutions/OpenERP | openerp/addons/account_analytic_plans/account_analytic_plans.py | Python | agpl-3.0 | 24,226 |
"""
Support for real-time departure information for public transport in Munich.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.mvglive/
"""
import logging
from datetime import timedelta
import voluptuous as vol
import homeassistant.helpers.confi... | MungoRae/home-assistant | homeassistant/components/sensor/mvglive.py | Python | apache-2.0 | 6,071 |
# This file is part of Invenio.
# Copyright (C) 2011 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 later version.
#
# Invenio is d... | jmacmahon/invenio | modules/oairepository/lib/oai_repository_config.py | Python | gpl-2.0 | 1,219 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
QGIS Server HTTP wrapper for testing purposes
================================================================================
This script launches a QGIS Server listening on port 8081 or on the port
specified on the environment variable QGIS_SERVER_PORT.
Hostname is ... | minorua/QGIS | tests/src/python/qgis_wrapped_server.py | Python | gpl-2.0 | 19,452 |
import numpy as np
from ..filters import gaussian
def binary_blobs(length=512, blob_size_fraction=0.1, n_dim=2,
volume_fraction=0.5, seed=None):
"""
Generate synthetic binary image with several rounded blob-like objects.
Parameters
----------
length : int, optional
Linear... | Hiyorimi/scikit-image | skimage/data/_binary_blobs.py | Python | bsd-3-clause | 1,995 |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2015, Continuum Analytics, Inc. All rights reserved.
#
# Powered by the Bokeh Development Team.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#----------------------------------------... | daodaoliang/bokeh | bokeh/server/websocket/manager.py | Python | bsd-3-clause | 3,294 |
# Copyright 2011-2012 10gen, 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 applicable law or agreed to in writing... | 0111001101111010/open-health-inspection-api | venv/lib/python2.7/site-packages/pymongo/common.py | Python | gpl-2.0 | 23,408 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# MySQL Connector/Python - MySQL driver written in Python.
# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
# MySQL Connector/Python is licensed under the terms of the GPLv2
# <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most... | mrquim/mrquimrepo | script.module.myconnpy/lib/examples/engines.py | Python | gpl-2.0 | 1,881 |
#!/usr/bin/python
#
# This is a 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 Ansible library is distributed in the hope that i... | chepazzo/ansible-modules-extras | cloud/amazon/ec2_eni.py | Python | gpl-3.0 | 13,881 |
# (c) 2013-2014, Michael DeHaan <michael.dehaan@gmail.com>
# Stephen Fromm <sfromm@gmail.com>
# Brian Coca <briancoca+dev@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as publish... | wulczer/ansible | lib/ansible/runner/action_plugins/assemble.py | Python | gpl-3.0 | 6,198 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | balajikris/autorest | src/generator/AutoRest.Python.Tests/Expected/AcceptanceTests/BodyDate/autorestdatetestservice/operations/date_model_operations.py | Python | mit | 13,757 |
# Copyright Hybrid Logic Ltd. See LICENSE file for details.
"""
Network utilities.
"""
from ipaddr import IPAddress
import netifaces
def ipaddress_from_string(ip_address_string):
"""
Parse an IPv4 or IPv6 address string and return an
IPAddress instance.
Remove the "embedded scope id" from IPv6 addr... | jml/flocker | flocker/common/_net.py | Python | apache-2.0 | 1,289 |
# -*- coding: utf-8 -*-
from gluon import *
from s3 import *
from s3layouts import *
try:
from .layouts import *
except ImportError:
pass
import s3menus as default
# =============================================================================
class S3MainMenu(default.S3MainMenu):
"""
Custom Main ... | flavour/eden | modules/templates/historic/WACOP/menus.py | Python | mit | 8,445 |
"""
Module for code that should run during LMS startup
"""
import django
from django.conf import settings
# Force settings to run so that the python path is modified
settings.INSTALLED_APPS # pylint: disable=pointless-statement
from openedx.core.lib.django_startup import autostartup
import edxmako
import logging
im... | cognitiveclass/edx-platform | lms/startup.py | Python | agpl-3.0 | 6,065 |
from ..broker import Broker
class IfPerfHourlyBroker(Broker):
controller = "if_perf_hourlies"
def index(self, **kwargs):
"""Lists the available if perf hourlies. Any of the inputs listed may be be used to narrow the list; other inputs will be ignored. Of the various ways to query lists, using this me... | infobloxopen/infoblox-netmri | infoblox_netmri/api/broker/v3_8_0/if_perf_hourly_broker.py | Python | apache-2.0 | 73,070 |
# -*- coding: utf-8 -*-
import datetime
import os
import time
from gluon import current
# =============================================================================
class Daily():
""" Daily Maintenance Tasks """
def __call__(self):
db = current.db
s3db = current.s3db
request = cu... | nck0405/ChennaiEden | private/templates/ChennaiFR/maintenance.py | Python | mit | 1,353 |
"""
Copyright 2008, 2009, 2011 Free Software Foundation, Inc.
This file is part of GNU Radio
GNU Radio Companion 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... | pgoeser/gnuradio | grc/gui/MainWindow.py | Python | gpl-3.0 | 10,676 |
"""Test that sys.modules is used properly by import."""
from .. import util
import sys
from types import MethodType
import unittest
class UseCache:
"""When it comes to sys.modules, import prefers it over anything else.
Once a name has been resolved, sys.modules is checked to see if it contains
the modul... | Microvellum/Fluid-Designer | win64-vc/2.78/python/lib/test/test_importlib/import_/test_caching.py | Python | gpl-3.0 | 3,599 |
"""Webhooks for external integrations."""
from __future__ import absolute_import
from django.http import HttpRequest, HttpResponse
from django.utils.translation import ugettext as _
from zerver.models import get_client, UserProfile
from zerver.lib.actions import check_send_message
from zerver.lib.response import json... | dawran6/zulip | zerver/webhooks/freshdesk/view.py | Python | apache-2.0 | 5,886 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# (c) 2017, Marc-Aurèle Brothier @marcaurele
# (c) 2017, René Moser <mail@renemoser.net>
#
# This file is part of Ansible
#
# Ansible 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 Soft... | nwchandler/ansible | lib/ansible/modules/cloud/cloudstack/cs_instance_nic.py | Python | gpl-3.0 | 8,254 |
"""
=======================================================
Permutation F-test on sensor data with 1D cluster level
=======================================================
One tests if the evoked response is significantly different
between conditions. Multiple comparison problem is addressed
with cluster level permuta... | rajegannathan/grasp-lift-eeg-cat-dog-solution-updated | python-packages/mne-python-0.10/examples/stats/plot_cluster_stats_evoked.py | Python | bsd-3-clause | 2,991 |
#!/usr/bin/env python
import logging
import os
import tempfile
from zlib import adler32
from subprocess import Popen, PIPE
from pelican import logger
def generate_uml_image(path, plantuml_code, imgformat):
tf = tempfile.NamedTemporaryFile(delete=False)
tf.write('@startuml\n'.encode('utf8'))
tf.write(plant... | jeorryb/datarambler | plugins/plantuml/generateUmlDiagram.py | Python | mit | 2,006 |
# Authors:
# Trevor Perrin
# Dave Baggett (Arcode Corporation) - cleanup handling of constants
# Yngve Pettersen (ported by Paul Sokolovsky) - TLS 1.2
#
# See the LICENSE file for legal information regarding use of this file.
"""Class for setting handshake parameters."""
from .constants import CertificateType
... | Teamxrtc/webrtc-streaming-node | third_party/webrtc/src/chromium/src/third_party/tlslite/tlslite/handshakesettings.py | Python | mit | 9,606 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | wanghaven/nupic | src/nupic/support/pymysqlhelpers.py | Python | agpl-3.0 | 4,179 |
import string
import random
from django import forms
from django.conf import settings
from django.contrib.auth import forms as auth_forms
from django.contrib.auth.forms import AuthenticationForm
from django.contrib.sites.models import get_current_site
from django.core.exceptions import ValidationError
from django.util... | QLGu/django-oscar | src/oscar/apps/customer/forms.py | Python | bsd-3-clause | 15,465 |
from wptserve.utils import isomorphic_decode, isomorphic_encode
def handle_headers(frame, request, response):
status = 302
if b'redirect_status' in request.GET:
status = int(request.GET[b'redirect_status'])
response.status = status
if b'location' in request.GET:
url = isomorphic_decode(r... | scheib/chromium | third_party/blink/web_tests/external/wpt/fetch/api/resources/redirect.h2.py | Python | bsd-3-clause | 505 |
# -*- coding: utf-8 -*-
"""
Procurement
A module to handle Procurement
Currently handles
Suppliers
Planned Procurements
@ToDo: Extend to
Purchase Requests (PRs)
Purchase Orders (POs)
"""
module = request.controller
resourcename = request.function
if not settings.has... | sahana/Turkey | controllers/proc.py | Python | mit | 1,092 |
# Copyright (c) 2006-2009 Mitch Garnaat http://garnaat.org/
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modi... | jxta/cc | vendor/boto/boto/manage/volume.py | Python | apache-2.0 | 16,328 |
# Copyright 2013 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.
import json
import re
import weakref
from telemetry.core import extension_page
from telemetry.core.backends.chrome import inspector_backend
class ExtensionN... | Philippe12/external_chromium_org | tools/telemetry/telemetry/core/backends/chrome/extension_dict_backend.py | Python | bsd-3-clause | 2,641 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-today OpenERP SA (<http://www.openerp.com>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms o... | jaggu303619/asylum | openerp/addons/crm_claim/crm_claim.py | Python | agpl-3.0 | 11,219 |
import numpy as np
import matplotlib.pyplot as plt
from scipy.signal import hamming, hanning, triang, blackmanharris, resample
import math
import sys, os, time
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../../software/models/'))
import utilFunctions as UF
import hpsModel as HPS
(fs,... | acmaheri/sms-tools | lectures/7-Sinusoidal-plus-residual-model/plots-code/hpsModel-sax-phrase.py | Python | agpl-3.0 | 1,834 |
import inspect
import re
def _hook_add(func, add, name=''):
if not hasattr(func, '_hook'):
func._hook = []
func._hook.append(add)
if not hasattr(func, '_filename'):
func._filename = func.func_code.co_filename
if not hasattr(func, '_args'):
argspec = inspect.getargspec(func)
... | Jeebeevee/DouweBot_JJ15 | plugins_org/util/hook.py | Python | unlicense | 2,904 |
# Copyright (c) 2013 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... | barnsnake351/neutron | neutron/tests/unit/extensions/test_agent.py | Python | apache-2.0 | 7,027 |
# Copyright 2013 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... | jeffrey4l/nova | nova/tests/unit/api/openstack/compute/contrib/test_block_device_mapping.py | Python | apache-2.0 | 13,826 |
#!flask/bin/python
import os
import sys
if sys.platform == 'win32':
pybabel = 'flask\\Scripts\\pybabel'
else:
pybabel = 'flask/bin/pybabel'
if len(sys.argv) != 2:
print "usage: tr_init <language-code>"
sys.exit(1)
os.system(pybabel +
' extract -F babel.cfg -k lazy_gettext -o messages.pot app')... | wasmith63/bluebird | tr_init.py | Python | bsd-3-clause | 440 |
# -*- coding: utf-8 -*-
"""
pygments.lexers.javascript
~~~~~~~~~~~~~~~~~~~~~~~~~~
Lexers for JavaScript and related languages.
:copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from pygments.lexer import RegexLexer, include, ... | prashanthr/wakatime | wakatime/packages/pygments_py3/pygments/lexers/javascript.py | Python | bsd-3-clause | 47,525 |
# Copyright 2017 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... | memo/tensorflow | tensorflow/python/summary/text_summary_test.py | Python | apache-2.0 | 2,226 |
from __future__ import absolute_import, division, unicode_literals
from pip._vendor.six import text_type
from collections import OrderedDict
from lxml import etree
from ..treebuilders.etree import tag_regexp
from . import base
from .. import _ihatexml
def ensure_str(s):
if s is None:
return None
e... | RalfBarkow/Zettelkasten | venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treewalkers/etree_lxml.py | Python | gpl-3.0 | 6,357 |
# -*- coding: utf-8 -*-
from django.core.exceptions import ValidationError
from django.forms.util import flatatt, ErrorDict, ErrorList
from django.test import TestCase
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy
class FormsUtilTestCase(TestCase):
# Tests fo... | LethusTI/supportcenter | vendor/django/tests/regressiontests/forms/tests/util.py | Python | gpl-3.0 | 3,154 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | ucloud/uai-sdk | examples/mxnet/train/imagenet/code/symbols/googlenet.py | Python | apache-2.0 | 4,152 |
# -*- coding: utf-8 -*-
"""Cluster Robust Standard Errors with Two Clusters
Created on Sat Dec 17 08:39:16 2011
Author: Josef Perktold
"""
from statsmodels.compat.python import urlretrieve
import numpy as np
from numpy.testing import assert_almost_equal
import statsmodels.api as sm
import statsmodels.stats.sandwich... | DonBeo/statsmodels | statsmodels/examples/ex_sandwich3.py | Python | bsd-3-clause | 1,967 |
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file ex... | vmanoria/bluemix-hue-filebrowser | hue-3.8.1-bluemix/apps/sqoop/src/sqoop/settings.py | Python | gpl-2.0 | 916 |
# -*- coding: utf-8 -*-
{
'name': "Check Printing in Expenses",
'summary': """Print amount in words on checks issued for expenses""",
'category': 'Accounting',
'description': """
Print amount in words on checks issued for expenses
""",
'version': '1.0',
'depends': ['account_check_pri... | t3dev/odoo | addons/hr_expense_check/__manifest__.py | Python | gpl-3.0 | 421 |
# Copyright 2015 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... | jwlawson/tensorflow | tensorflow/python/keras/_impl/keras/layers/__init__.py | Python | apache-2.0 | 2,093 |
# test the functions imported from cmath
try:
from cmath import *
except ImportError:
print("SKIP")
import sys
sys.exit()
# make sure these constants exist in cmath
print("%.5g" % e)
print("%.5g" % pi)
test_values_non_zero = []
base_values = (0.0, 0.5, 1.2345, 10.)
for r in base_values:
for i in ... | xhat/micropython | tests/float/cmath_fun.py | Python | mit | 1,699 |
import os
import warnings
from django.conf import settings, global_settings
from django.core.exceptions import ImproperlyConfigured
from django.http import HttpRequest
from django.test import SimpleTestCase, TransactionTestCase, TestCase, signals
from django.test.utils import override_settings
from django.utils import... | waseem18/oh-mainline | vendor/packages/Django/tests/regressiontests/settings_tests/tests.py | Python | agpl-3.0 | 12,386 |
# coding: utf-8
from django.conf.urls.defaults import *
import views
urlpatterns = patterns('',
(r'^view/$', views.normal_view),
(r'^not_found/$', views.not_found),
(r'^error/$', views.server_error),
(r'^null_view/$', views.null_view),
(r'^permission_denied/$', views.permission_denied),
(r'^t... | mzdaniel/oh-mainline | vendor/packages/Django/tests/regressiontests/middleware_exceptions/urls.py | Python | agpl-3.0 | 437 |
"""
Sandbox tests for the projection operator
"""
import numpy as np
import theano
from pylearn2.sandbox.nlp.linear.matrixmul import MatrixMul
from pylearn2.utils import sharedX
from theano import tensor
def test_matrixmul():
"""
Tests for projection
"""
rng = np.random.RandomState(222)
dtypes = ... | fyffyt/pylearn2 | pylearn2/sandbox/nlp/linear/tests/test_matrixmul.py | Python | bsd-3-clause | 1,494 |
# check that we can do certain things without allocating heap memory
import gc
def f1(a):
print(a)
def f2(a, b=2):
print(a, b)
def f3(a, b, c, d):
x1 = x2 = a
x3 = x4 = b
x5 = x6 = c
x7 = x8 = d
print(x1, x3, x5, x7, x2 + x4 + x6 + x8)
global_var = 1
def test():
global global_var
... | suda/micropython | tests/micropython/heapalloc.py | Python | mit | 891 |
# Ed25519 digital signatures
# Based on http://ed25519.cr.yp.to/python/ed25519.py
# See also http://ed25519.cr.yp.to/software.html
# Adapted by Ron Garret
# Sped up considerably using coordinate transforms found on:
# http://www.hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html
# Specifically add-2008-hwcd-4 and d... | zwChan/VATEC | ~/eb-virt/Lib/site-packages/wheel/signatures/djbec.py | Python | apache-2.0 | 6,755 |
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible 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) an... | bootswithdefer/ansible | v2/ansible/playbook/__init__.py | Python | gpl-3.0 | 3,162 |
# 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... | jjas0nn/solvem | tensorflow/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/dataframe/transform.py | Python | mit | 10,524 |
#!/usr/bin/python
#
# Copyright 2008-2010 WebDriver committers
# Copyright 2008-2010 Google 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... | ktan2020/legacy-automation | win/Lib/site-packages/selenium/webdriver/ie/__init__.py | Python | mit | 643 |
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class Article(models.Model):
headline = models.CharField(max_length=100, default='Default headline')
pub_date = models.DateTimeField()
def __str__(self):
return self.headline
... | diegoguimaraes/django | tests/fixtures_model_package/models/__init__.py | Python | bsd-3-clause | 543 |
# -*- coding: utf-8 -*-
"""
pygments.lexers.smalltalk
~~~~~~~~~~~~~~~~~~~~~~~~~
Lexers for Smalltalk and related languages.
:copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from pygments.lexer import RegexLexer, include, bygroups, defa... | prashanthr/wakatime | wakatime/packages/pygments_py3/pygments/lexers/smalltalk.py | Python | bsd-3-clause | 7,215 |
"""
Base file upload handler classes, and the built-in concrete subclasses
"""
from __future__ import unicode_literals
from io import BytesIO
from django.conf import settings
from django.core.files.uploadedfile import (
InMemoryUploadedFile, TemporaryUploadedFile,
)
from django.utils.encoding import python_2_uni... | KrzysztofStachanczyk/Sensors-WWW-website | www/env/lib/python2.7/site-packages/django/core/files/uploadhandler.py | Python | gpl-3.0 | 6,876 |
#!/usr/bin/python
from utils import mathfont
import fontforge
nArySumCodePoint = 0x2211 # largeop operator
v = 3 * mathfont.em
f = mathfont.create("limits-lowerlimitbaselinedropmin%d" % v)
mathfont.createSquareGlyph(f, nArySumCodePoint)
f.math.LowerLimitBaselineDropMin = v
f.math.LowerLimitGapMin = 0
f.math.OverbarE... | shinglyu/servo | tests/wpt/web-platform-tests/mathml/tools/limits.py | Python | mpl-2.0 | 2,284 |
# Copyright (C) 2010 Google Inc. 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 list of conditions and the ... | klim-iv/phantomjs-qt5 | src/webkit/Tools/Scripts/webkitpy/layout_tests/models/test_results_unittest.py | Python | bsd-3-clause | 2,300 |
"""
Course rerun page in Studio
"""
from .course_page import CoursePage
from .utils import set_input_value
class CourseRerunPage(CoursePage):
"""
Course rerun page in Studio
"""
url_path = "course_rerun"
COURSE_RUN_INPUT = '.rerun-course-run'
def is_browser_on_page(self):
"""
... | ahmadiga/min_edx | common/test/acceptance/pages/studio/course_rerun.py | Python | agpl-3.0 | 971 |
# Copyright (C) 2001-2006 Python Software Foundation
# Author: Keith Dart
# Contact: email-sig@python.org
"""Class representing application/* type MIME documents."""
__all__ = ["MIMEApplication"]
from email import encoders
from email.mime.nonmultipart import MIMENonMultipart
class MIMEApplication(MIMENonMultipart)... | huran2014/huran.github.io | wot_gateway/usr/lib/python2.7/email/mime/application.py | Python | gpl-2.0 | 1,256 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the... | diogocs1/comps | web/addons/mrp_byproduct/__init__.py | Python | apache-2.0 | 1,074 |