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 |
|---|---|---|---|---|---|
#***************************************************************************
#* *
#* Copyright (c) 2011, 2012 *
#* Jose Luis Cercos Pita <jlcercos@gmail.com> *
#* ... | wood-galaxy/FreeCAD | src/Mod/Plot/Plot.py | Python | lgpl-2.1 | 13,577 |
import glob
import json
import os
import struct
import unittest
from nose.tools import assert_almost_equal, assert_equals, assert_true, assert_raises
from numpy import allclose, arange, array, array_equal
from numpy import dtype as dtypeFunc
from thunder.rdds.fileio.seriesloader import SeriesLoader
from thunder.utils... | pearsonlab/thunder | test/test_seriesloader.py | Python | apache-2.0 | 10,333 |
"""
Creative Applications of Deep Learning w/ Tensorflow.
Kadenze, Inc.
Copyright Parag K. Mital, June 2016.
"""
import numpy as np
import tensorflow as tf
from tensorflow.python.platform import gfile
from .utils import download
from skimage.transform import resize as imresize
def celeb_vaegan_download():
"""Down... | pkmital/CADL | session-5/libs/celeb_vaegan.py | Python | apache-2.0 | 2,738 |
"""Support for the QR image processing."""
from homeassistant.core import split_entity_id
from homeassistant.components.image_processing import (
ImageProcessingEntity, CONF_SOURCE, CONF_ENTITY_ID, CONF_NAME)
def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the demo image process... | MartinHjelmare/home-assistant | homeassistant/components/qrcode/image_processing.py | Python | apache-2.0 | 1,716 |
match x<caret>: | jwren/intellij-community | python/testData/codeInsight/smartEnter/firstClauseAfterEmptyMatchStatementWithSubjectAndColon.py | Python | apache-2.0 | 15 |
from memory_profiler import profile
@profile
def my_func():
a = [1] * (10 ** 6)
b = [2] * (2 * 10 ** 7)
del b
return a
if __name__ == '__main__':
my_func()
| olivetree123/memory_profiler | test/test_import.py | Python | bsd-3-clause | 179 |
#This script is not really portable. It's just to automate some manual steps I usually do when releasing.
#It might evolve into someting more robust but for now it's ok for me.
import os
import shutil
def run(cmd):
print("\nRunning command: " + cmd)
if os.system(cmd) == 0: print("\nWarning, command failed... | CyanogenMod/android_external_mockito | releasing/release.undo.py | Python | mit | 676 |
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
import unittest
from jnius import autoclass, JavaException
class Interface(unittest.TestCase):
def test_reflect_interface(self):
Interface = autoclass('org.jnius.InterfaceWithPublicEnum')
... | kivy/pyjnius | tests/test_interface.py | Python | mit | 620 |
def fake_get_value_from_db():
return 5
def check_outdated():
total = fake_get_value_from_db()
return total > 10
def task_put_more_stuff_in_db():
def put_stuff(): pass
return {'actions': [put_stuff],
'uptodate': [check_outdated],
}
| gh0std4ncer/doit | doc/tutorial/uptodate_callable.py | Python | mit | 279 |
#!/usr/bin/env python3
#
# Create frozen modules structure for MicroPython.
#
# Usage:
#
# Have a directory with modules to be frozen (only modules, not packages
# supported so far):
#
# frozen/foo.py
# frozen/bar.py
#
# Run script, passing path to the directory above:
#
# ./make-frozen.py frozen > frozen.c
#
# Include... | jimkmc/micropython | tools/make-frozen.py | Python | mit | 1,041 |
# -*- coding: utf-8 -*-
# Copyright(C) 2010-2011 Romain Bignon
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your... | frankrousseau/weboob | weboob/tools/log.py | Python | agpl-3.0 | 2,262 |
# coding=utf-8
# Copyright 2016 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from pants.backend.c... | landism/pants | src/python/pants/backend/codegen/antlr/java/register.py | Python | apache-2.0 | 791 |
# Copyright 2009, 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 f... | Xperia-Nicki/android_platform_sony_nicki | external/webkit/LayoutTests/http/tests/websocket/tests/hybi/close-on-unload_wsh.py | Python | apache-2.0 | 2,370 |
# Copyright 2015 Deutsche Telekom AG
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | pczerkas/tempest | tempest/api/compute/keypairs/base.py | Python | apache-2.0 | 1,347 |
"""
Separate module with function samples for serialization tests,
to avoid issues with __main__.
"""
import math
from numba import jit, generated_jit
from numba.core import types
@jit((types.int32, types.int32))
def add_with_sig(a, b):
return a + b
@jit
def add_without_sig(a, b):
return a + b
@jit(nopyth... | cpcloud/numba | numba/tests/serialize_usecases.py | Python | bsd-2-clause | 2,317 |
#! /usr/bin/env python
#
# Copyright (C) 2007-2009 Cournapeau David <cournape@gmail.com>
# 2010 Fabian Pedregosa <fabian.pedregosa@inria.fr>
descr = """A set of python modules for machine learning and data mining"""
import sys
import os
import shutil
from distutils.command.clean import clean as Clean
i... | JT5D/scikit-learn | setup.py | Python | bsd-3-clause | 5,576 |
#!/usr/bin/env python
# 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.
"""Build NaCl tools (e.g. sel_ldr and ncval) at a given revision."""
import build_utils
import optparse
import os
import shutil
im... | aYukiSekiguchi/ACCESS-Chromium | native_client_sdk/src/build_tools/make_nacl_tools.py | Python | bsd-3-clause | 7,703 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "chat.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| ststaynov/fishGame | manage.py | Python | bsd-3-clause | 245 |
"""
This module converts requested URLs to callback view functions.
RegexURLResolver is the main class here. Its resolve() method takes a URL (as
a string) and returns a ResolverMatch object which provides access to all
attributes of the resolved URL match.
"""
import functools
import re
import threading
from importli... | ifduyue/django | django/urls/resolvers.py | Python | bsd-3-clause | 21,041 |
#!/usr/bin/env python
# Copyright 2014 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.
"""Check that explain_binary_size_delta seems to work."""
import cStringIO
import sys
import unittest
import explain_binary_size_delt... | xin3liang/platform_external_chromium_org | tools/binary_size/explain_binary_size_delta_unittest.py | Python | bsd-3-clause | 10,211 |
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
DATE_FORMAT = r'j N Y'
TIME_FORMAT = r'H:i:s'
DATETIME_FORMAT = r'j N Y H:i:s'
YEAR_MONTH_FORMAT = r'F Y'
MONTH_DAY_FORMAT = r'j \de F'
SHORT_DATE_FORMAT = r'd/m/Y'
SHORT_DATETIME_FORMAT = r'd/m/Y H:i'
FIRST... | hunch/hunch-gift-app | django/conf/locale/es_AR/formats.py | Python | mit | 735 |
# coding: utf-8
#
# Copyright © 2010—2014 Andrey Mikhaylenko and contributors
#
# This file is part of Argh.
#
# Argh is free software under terms of the GNU Lesser
# General Public License version 3 (LGPLv3) as published by the Free
# Software Foundation. See the file README.rst for copying conditions.
#
"""
Inte... | eschleicher/flask_shopping_list | venv/lib/python3.4/site-packages/argh/interaction.py | Python | mit | 2,403 |
#
# Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
# Use of this file is governed by the BSD 3-clause license that
# can be found in the LICENSE.txt file in the project root.
#/
# Represents an executor for a sequence of lexer actions which traversed during
# the matching operation of a lexer rule (to... | damorim/compilers-cin | antigo/ap3/antlr4-python3-runtime-4.7.2/src/antlr4/atn/LexerActionExecutor.py | Python | mit | 6,374 |
# -*- coding:utf-8 -*-
"""
/***************************************************************************
Python Console for QGIS
-------------------
begin : 2012-09-10
copyright : (C) 2012 by Salvatore Larosa
email : lrssvtml (at) gmail (dot) com
***... | ghtmtt/QGIS | python/console/console.py | Python | gpl-2.0 | 36,846 |
"""SCons.Tool.m4
Tool-specific initialization for m4.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001 - 2014 The SCons Foundation
#
# Permission is hereby granted, free of charge, to a... | stonekyx/binary | vendor/scons-local-2.3.4/SCons/Tool/m4.py | Python | gpl-3.0 | 2,309 |
# 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... | mdrumond/tensorflow | tensorflow/python/layers/core_test.py | Python | apache-2.0 | 19,327 |
###############################################################################
##
## Copyright (C) 2013-2014 Tavendo GmbH
##
## 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
##
## h... | ahmedbodi/AutobahnPython | autobahn/autobahn/wamp/message.py | Python | apache-2.0 | 84,035 |
# 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... | ghchinoy/tensorflow | tensorflow/python/keras/utils/conv_utils.py | Python | apache-2.0 | 13,585 |
# Copyright 2014 NEC Corporation. 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 ... | zhimin711/nova | nova/api/openstack/compute/schemas/migrate_server.py | Python | apache-2.0 | 1,742 |
# Copyright 2012, 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 f... | nwjs/chromium.src | third_party/blink/web_tests/http/tests/websocket/echo-with-no-extension_wsh.py | Python | bsd-3-clause | 2,057 |
"""Network subnets."""
| softlayer/softlayer-python | SoftLayer/CLI/subnet/__init__.py | Python | mit | 23 |
import sys
from operator import add, mul, sub
if sys.version_info[0] == 2:
from operator import div
else:
from operator import floordiv as div
VALID_OPERATIONS = {"plus": add, "minus": sub,
"multiplied by": mul, "divided by": div}
def calculate(stmt):
if not (stmt.startswith("What i... | wobh/xpython | wordy/example.py | Python | mit | 1,109 |
# Autodetecting setup.py script for building the Python extensions
#
# Modified for BeOS build. Donn Cave, March 27 2001.
__version__ = "special BeOS after 1.37"
import sys, os
from distutils import sysconfig
from distutils import text_file
from distutils.errors import *
from distutils.core import Extension, setup
f... | teeple/pns_server | work/install/Python-2.7.4/Misc/BeOS-setup.py | Python | gpl-2.0 | 23,664 |
from .config import ProxyConfig
from .root_context import RootContext
from .server import ProxyServer, DummyServer
__all__ = [
"ProxyServer", "DummyServer",
"ProxyConfig",
"RootContext"
]
| zlorb/mitmproxy | mitmproxy/proxy/__init__.py | Python | mit | 201 |
#!/usr/bin/env python
# PyQt tutorial 3
import sys
from PyQt4 import QtGui
app = QtGui.QApplication(sys.argv)
window = QtGui.QWidget()
window.resize(200, 120)
quit = QtGui.QPushButton("Quit", window)
quit.setFont(QtGui.QFont("Times", 18, QtGui.QFont.Bold))
quit.setGeometry(10, 40, 180, 40)
quit.clicked.connect(... | jacksonwilliams/arsenalsuite | cpp/lib/PyQt4/examples/tutorial/t3.py | Python | gpl-2.0 | 367 |
# -*- coding: utf8 -*-
"""
Tests for pika.callback
"""
import logging
try:
import mock
except ImportError:
from unittest import mock
try:
import unittest2 as unittest
except ImportError:
import unittest
from pika import amqp_object
from pika import callback
from pika import frame
from pika import spe... | skftn/pika | tests/unit/callback_tests.py | Python | mpl-2.0 | 16,337 |
def foo(x):
pass
x = 42
y = 42
z = 42
foo(x, y, <caret>) | siosio/intellij-community | python/testData/multipleArgumentsCompletion/noExceptionIfMoreArgumentsThanParameters.py | Python | apache-2.0 | 61 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
sys.path += ['../']
from mingus.containers.track import Track
from mingus.containers.bar import Bar
from mingus.containers.instrument import Instrument, Piano, Guitar
import unittest
class test_Track(unittest.TestCase):
def setUp(self):
self.i = Track(... | speksi/python-mingus | unittest/test_track.py | Python | gpl-3.0 | 739 |
# 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... | drpngx/tensorflow | tensorflow/contrib/distributions/python/ops/vector_diffeomixture.py | Python | apache-2.0 | 44,484 |
from ctypes import *
from ctypes.wintypes import HANDLE
from ctypes.wintypes import BOOL
from ctypes.wintypes import LPCWSTR
_stdcall_libraries = {}
_stdcall_libraries['kernel32'] = WinDLL('kernel32')
from ctypes.wintypes import DWORD
from ctypes.wintypes import WORD
from ctypes.wintypes import BYTE
INVALID_HANDLE_VAL... | pacoqueen/cican | utils/gmapcatcher/gmapcatcher/pyGPSD/nmea/serial/win32.py | Python | gpl-3.0 | 9,044 |
from base64 import b16encode, b32decode, b64encode
from distutils.version import LooseVersion
from hashlib import sha1
import httplib
import json
import os
import re
import urllib2
from couchpotato.core._base.downloader.main import DownloaderBase, ReleaseDownloadList
from couchpotato.core.helpers.encoding import isInt... | gchaimovitz/CouchPotatoServer | couchpotato/core/downloaders/hadouken.py | Python | gpl-3.0 | 17,821 |
import base64
import json
import os
import uuid
import threading
from multiprocessing.managers import AcquirerProxy, BaseManager, DictProxy
class ServerDictManager(BaseManager):
shared_data = {}
def _get_shared():
return ServerDictManager.shared_data
ServerDictManager.register("get_dict",
... | anthgur/servo | tests/wpt/web-platform-tests/tools/wptserve/wptserve/stash.py | Python | mpl-2.0 | 5,785 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, models
from odoo.tools import pycompat
class Board(models.AbstractModel):
_name = 'board.board'
_description = "Board"
_auto = False
@api.model
def create(self, vals):
... | Aravinthu/odoo | addons/board/models/board.py | Python | agpl-3.0 | 1,665 |
import ui
class DynaTable:
def onModuleLoad(self):
slot = ui.RootPanel.get("calendar") | pombredanne/pyjs | tests/test022.py | Python | apache-2.0 | 100 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
***************************************************************************
mkuidefaults.py
---------------------
Date : June 2013
Copyright : (C) 2013 by Juergen E. Fischer
Email : jef at norbit dot de
***... | kalxas/QGIS | scripts/mkuidefaults.py | Python | gpl-2.0 | 2,903 |
#!/usr/bin/python
#
# Copyright (c) 2018 Yuwei Zhou, <yuwzho@microsoft.com>
#
# 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',
... | helldorado/ansible | lib/ansible/modules/cloud/azure/azure_rm_servicebus.py | Python | gpl-3.0 | 6,397 |
# Copyright 2014 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
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | wolverineav/neutron | neutron/db/migration/alembic_migrations/brocade_init_ops.py | Python | apache-2.0 | 2,634 |
#!/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 distributed... | e-gob/plataforma-kioscos-autoatencion | scripts/ansible-play/.venv/lib/python2.7/site-packages/ansible/modules/cloud/amazon/rds.py | Python | bsd-3-clause | 56,122 |
#!/usr/bin/env python
# File created on 27 Sep 2011
from __future__ import division
__author__ = "Antonio Gonzalez Pena"
__copyright__ = "Copyright 2011, The QIIME Project"
__credits__ = [
"Antonio Gonzalez Pena",
"Andrew J. King",
"Michael S. Robeson",
]
__license__ = "GPL"
__version__ = "1.9.1-dev"
__mai... | zachcp/qiime | tests/test_distance_matrix_from_mapping.py | Python | gpl-2.0 | 8,329 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2015, Manuel Sousa <manuel.sousa@gmail.com>
# 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_vers... | valentin-krasontovitsch/ansible | lib/ansible/modules/messaging/rabbitmq/rabbitmq_exchange.py | Python | gpl-3.0 | 6,655 |
# -*- 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
... | gilt/incubator-airflow | airflow/contrib/operators/datastore_export_operator.py | Python | apache-2.0 | 4,628 |
# -*- coding: utf-8 -*-
# This file is part of Invenio.
# Copyright (C) 2013, 2014 CERN.
#
# Invenio is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any ... | zenodo/invenio | invenio/base/signals.py | Python | gpl-2.0 | 3,895 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2016, techbizdev <techbizdev@paloaltonetworks.com>
# 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':... | skg-net/ansible | lib/ansible/modules/network/panos/panos_security_rule.py | Python | gpl-3.0 | 19,823 |
#!/usr/bin/python
import sys
from participantCollection import ParticipantCollection
names = sys.argv[1::]
participants = ParticipantCollection()
for name in names:
if participants.hasParticipantNamed(name):
participants.participantNamed(name).hasCheckedIn = True
print "just checked in " + name
... | foobarbazblarg/stayclean | stayclean-2017-january/checkin.py | Python | mit | 427 |
# -*- 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 ... | hayderimran7/tempest | tempest/api/baremetal/admin/test_chassis.py | Python | apache-2.0 | 3,455 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
from django.contrib.auth.models import User
class Migration(DataMigration):
def forwards(self, orm):
users = User.objects.all()
for user in users:
user.profile.pref... | lucidbard/NewsBlur | apps/profile/migrations/0005_view_settings_to_preferences.py | Python | mit | 4,350 |
# -*- coding: utf-8 -*-
# This software may be modified and distributed under the terms
# of the BSD license. See the LICENSE file for details.
from aniso8601 import compat
class DateResolution(object):
Year, Month, Week, Weekday, Day, Ordinal = list(compat.range(6))
class TimeResolution(object):
Seconds, ... | morissette/devopsdays-hackathon-2016 | venv/lib/python2.7/site-packages/aniso8601/resolution.py | Python | gpl-3.0 | 359 |
# Test IShellItem and related interfaces
from win32com.shell import shell, shellcon, knownfolders
import unittest
class TestShellItem(unittest.TestCase):
def assertShellItemsEqual(self, i1, i2):
n1 = i1.GetDisplayName(shellcon.SHGDN_FORPARSING)
n2 = i2.GetDisplayName(shellcon.SHGDN_FORPARSING)
... | JulienMcJay/eclock | windows/Python27/Lib/site-packages/pywin32-218-py2.7-win32.egg/win32comext/shell/test/testShellItem.py | Python | gpl-2.0 | 2,921 |
# -*- coding: utf-8 -*-
from . import models
from . import controllers
from . import wizard
| ddico/odoo | addons/sale_product_configurator/__init__.py | Python | agpl-3.0 | 93 |
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the... | JioCloud/horizon | openstack_dashboard/dashboards/project/data_processing/cluster_templates/panel.py | Python | apache-2.0 | 917 |
#
# (c) 2016 Red Hat Inc.
#
# 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 d... | drmrd/ansible | lib/ansible/plugins/terminal/iosxr.py | Python | gpl-3.0 | 1,883 |
# -*- coding: utf-8 -*-
"""Tests for Regression Diagnostics and Specification Tests
Created on Thu Feb 09 13:19:47 2012
Author: Josef Perktold
License: BSD-3
currently all tests are against R
"""
#import warnings
#warnings.simplefilter("default")
# ResourceWarning doesn't exist in python 2
#warnings.simplefilter("i... | hlin117/statsmodels | statsmodels/stats/tests/test_diagnostic.py | Python | bsd-3-clause | 40,146 |
# -*- coding: utf-8 -*-
# This code is part of Ansible, but is an independent component.
# This particular file snippet, and this file snippet only, is BSD licensed.
# Modules you write using this snippet, which is embedded dynamically by Ansible
# still belong to the author of the module, and may assign their own lic... | thaim/ansible | lib/ansible/module_utils/hetzner.py | Python | mit | 4,484 |
"""
Timezone-related classes and functions.
"""
import functools
from contextlib import ContextDecorator
from datetime import datetime, timedelta, tzinfo
from threading import local
import pytz
from django.conf import settings
__all__ = [
'utc', 'get_fixed_timezone',
'get_default_timezone', 'get_default_tim... | Beauhurst/django | django/utils/timezone.py | Python | bsd-3-clause | 8,544 |
# Copyright 2013 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
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | yosshy/nova | nova/api/openstack/compute/server_usage.py | Python | apache-2.0 | 2,859 |
#!/usr/bin/python
#
# (c) 2015 Peter Sprygada, <psprygada@ansible.com>
#
# Copyright (c) 2016 Dell Inc.
#
# 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 versi... | sivel/ansible-modules-core | network/dellos9/dellos9_command.py | Python | gpl-3.0 | 6,997 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
| This file is part of the web2py Web Framework
| Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>
| License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
"""
from SimpleXMLRPCServer import SimpleXMLRPCDispatcher
def handler(request, response, methods):
... | manuelep/openshift_v3_test | wsgi/web2py/gluon/xmlrpc.py | Python | mit | 748 |
#!/usr/bin/env python
# Copyright 2012 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required... | ltilve/ChromiumGStreamerBackend | tools/telemetry/third_party/webpagereplay/proxyshaper_test.py | Python | bsd-3-clause | 4,988 |
# 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... | harshilasu/GraphicMelon | y/google-cloud-sdk/platform/gsutil/third_party/boto/boto/ec2/elb/instancestate.py | Python | gpl-3.0 | 2,657 |
a = {"abc": "d<caret>ef"} | asedunov/intellij-community | python/testData/breadcrumbs/dictKey.py | Python | apache-2.0 | 25 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2016, Cumulus Networks <ce-ceng@cumulusnetworks.com>
# 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_versio... | hryamzik/ansible | lib/ansible/modules/network/cumulus/_cl_ports.py | Python | gpl-3.0 | 2,580 |
# 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... | npuichigo/ttsflow | third_party/tensorflow/tensorflow/compiler/tests/slice_ops_test.py | Python | apache-2.0 | 5,088 |
from builtins import str
import logging
import subprocess
from airflow.executors.base_executor import BaseExecutor
from airflow.utils import State
class SequentialExecutor(BaseExecutor):
"""
This executor will only run one task instance at a time, can be used
for debugging. It is also the only executor t... | wangtuanjie/airflow | airflow/executors/sequential_executor.py | Python | apache-2.0 | 1,230 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2012-today OpenERP SA (<http://www.openerp.com>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms o... | inovtec-solutions/OpenERP | openerp/addons/auth_signup/res_users.py | Python | agpl-3.0 | 13,630 |
"""
Move a file in the safest way possible::
>>> from django.core.files.move import file_move_safe
>>> file_move_safe("/tmp/old_file", "/tmp/new_file")
"""
import os
from shutil import copystat
from django.core.files import locks
__all__ = ['file_move_safe']
def _samefile(src, dst):
# Macintosh, Unix.... | BitWriters/Zenith_project | zango/lib/python3.5/site-packages/django/core/files/move.py | Python | mit | 2,794 |
"""For starting up remote processes"""
import sys, pickle, os
if __name__ == '__main__':
if hasattr(os, 'setpgrp'):
os.setpgrp() ## prevents signals (notably keyboard interrupt) being forwarded from parent to this process
if sys.version[0] == '3':
#name, port, authkey, ppid, targetStr, path, p... | AOtools/soapy | soapy/pyqtgraph/multiprocess/bootstrap.py | Python | gpl-3.0 | 1,162 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'Point of Sale',
'version': '1.0.1',
'category': 'Point Of Sale',
'sequence': 20,
'summary': 'Touchscreen Interface for Shops',
'description': """
Quick and Easy sale process
===========... | vileopratama/vitech | src/addons/point_of_sale/__openerp__.py | Python | mit | 2,836 |
# Copyright (c) 2018 Fortinet and/or its affiliates.
#
# 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 late... | alxgu/ansible | lib/ansible/plugins/httpapi/fortimanager.py | Python | gpl-3.0 | 13,169 |
# -*- coding: utf-8 -*-
# Unix SMB/CIFS implementation.
# Copyright © Jelmer Vernooij <jelmer@samba.org> 2008
#
# 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, ... | yasoob/PythonRSSReader | venv/lib/python2.7/dist-packages/samba/ndr.py | Python | mit | 1,563 |
"""
This file contains the logic for cohorts, as exposed internally to the
forums, and to the cohort admin views.
"""
import logging
import random
from django.db import transaction
from django.db.models.signals import post_save, m2m_changed
from django.dispatch import receiver
from django.http import Http404
from dja... | zofuthan/edx-platform | openedx/core/djangoapps/course_groups/cohorts.py | Python | agpl-3.0 | 16,159 |
# from http://diydrones.com/forum/topics/mission-planner-python-script?commentId=705844%3AComment%3A2035437&xg_source=msg_com_forum
import socket
import sys
import math
from math import sqrt
import clr
import time
import re, string
clr.AddReference("MissionPlanner.Utilities")
import MissionPlanner #import *
clr.AddRe... | ryokochang/Slab-GCS | bin/Release/Scripts/example6.py | Python | gpl-3.0 | 3,744 |
import re
from bisect import bisect
from django.conf import settings
from django.db.models.related import RelatedObject
from django.db.models.fields.related import ManyToManyRel
from django.db.models.fields import AutoField, FieldDoesNotExist
from django.db.models.fields.proxy import OrderWrt
from django.db.models.loa... | ychen820/microblog | y/google-cloud-sdk/platform/google_appengine/lib/django-1.3/django/db/models/options.py | Python | bsd-3-clause | 20,313 |
from __future__ import unicode_literals
import re
import time
import xml.etree.ElementTree
from .common import InfoExtractor
from ..utils import (
ExtractorError,
parse_duration,
)
class ClipfishIE(InfoExtractor):
IE_NAME = 'clipfish'
_VALID_URL = r'^https?://(?:www\.)?clipfish\.de/.*?/video/(?P<id... | apllicationCOM/youtube-dl-api-server | youtube_dl_server/youtube_dl/extractor/clipfish.py | Python | unlicense | 1,624 |
#!/usr/bin/env python
# fake-build-for-whole-module.py - Optimized fake build -*- python -*-
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See https://swift.... | jckarter/swift | test/Driver/PrivateDependencies/Inputs/fake-build-whole-module.py | Python | apache-2.0 | 1,067 |
# -*- coding: utf-8 -*-
from openerp.osv import fields, osv
class company_pad(osv.osv):
_inherit = 'res.company'
_columns = {
'pad_server': fields.char('Pad Server', help="Etherpad lite server. Example: beta.primarypad.com"),
'pad_key': fields.char('Pad Api Key', help="Etherpad lite api key.", ... | diogocs1/comps | web/addons/pad/res_company.py | Python | apache-2.0 | 423 |
#
# Copyright 2009 Eigenlabs Ltd. http://www.eigenlabs.com
#
# This file is part of EigenD.
#
# EigenD 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) a... | barnone/EigenD | tools/pip_cmd/__init__.py | Python | gpl-3.0 | 715 |
"""
Models to support Course Surveys feature
"""
import logging
from lxml import etree
from collections import OrderedDict
from django.db import models
from student.models import User
from django.core.exceptions import ValidationError
from model_utils.models import TimeStampedModel
from survey.exceptions import Surv... | ahmadiga/min_edx | lms/djangoapps/survey/models.py | Python | agpl-3.0 | 8,631 |
from operator import attrgetter
from django.test import TestCase
from models import Post, Question, Answer
class OrderWithRespectToTests(TestCase):
def test_basic(self):
q1 = Question.objects.create(text="Which Beatle starts with the letter 'R'?")
q2 = Question.objects.create(text="What is your ... | mzdaniel/oh-mainline | vendor/packages/Django/tests/modeltests/order_with_respect_to/tests.py | Python | agpl-3.0 | 2,870 |
from __future__ import print_function, division
from time import time
import argparse
import numpy as np
from sklearn.dummy import DummyClassifier
from sklearn.datasets import fetch_20newsgroups_vectorized
from sklearn.metrics import accuracy_score
from sklearn.utils.validation import check_array
from sklearn.ensemb... | RPGOne/Skynet | scikit-learn-0.18.1/benchmarks/bench_20newsgroups.py | Python | bsd-3-clause | 3,555 |
"""
Adds crowdsourced hinting functionality to lon-capa numerical response problems.
Currently experimental - not for instructor use, yet.
"""
import logging
import json
import random
import copy
from pkg_resources import resource_string
from lxml import etree
from xmodule.x_module import XModule, STUDENT_VIEW
fro... | ahmadiga/min_edx | common/lib/xmodule/xmodule/crowdsource_hinter.py | Python | agpl-3.0 | 17,456 |
#!/usr/bin/env python
from __future__ import division, print_function
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('compat', parent_package, top_path)
return config
if __name__ == '__main__':
from numpy.distutils.core i... | LumPenPacK/NetworkExtractionFromImages | win_build/nefi2_win_amd64_msvc_2015/site-packages/numpy/compat/setup.py | Python | bsd-2-clause | 371 |
# This program is free software; you can redistribute it and/or modify
# it under the terms of the (LGPL) GNU Lesser General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will ... | marcellodesales/svnedge-console | svn-server/lib/suds/umx/typed.py | Python | agpl-3.0 | 4,646 |
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
from __future__ import unicode_literals
DATE_FORMAT = r'j \d\e F \d\e Y'
TIME_FORMAT = 'H:i'
DATETIME_FORMAT = r'j \d\e F \d\e Y \a \l\a\s H:i'
YEAR_MONTH_FORMAT = r'F \d\e Y'
MONTH_DAY_FORMAT = r'j \d\e F'
SHORT_DATE_... | KrzysztofStachanczyk/Sensors-WWW-website | www/env/lib/python2.7/site-packages/django/conf/locale/es_CO/formats.py | Python | gpl-3.0 | 767 |
import sys
import csv
from django.core.management.base import BaseCommand
from django.contrib.auth import get_user_model
from wafer.talks.models import ACCEPTED, PROVISIONAL
class Command(BaseCommand):
help = ("List speakers and associated tickets. By default, only lists"
" speakers for provisionall... | CTPUG/wafer | wafer/management/commands/wafer_speaker_tickets.py | Python | isc | 1,984 |
from django import forms
from django.conf.global_settings import LANGUAGES
from liqpay.constants import CURRENCIES, ACTIONS
class ApiForm(forms.Form):
version = forms.IntegerField()
public_key = forms.CharField(max_length=20, min_length=5)
action = forms.ChoiceField(choices=ACTIONS)
amount = for... | pmaigutyak/mp-shop | liqpay/forms.py | Python | isc | 904 |
# !/usr/bin/env python
# coding: utf-8
# filter()把传入的函数依次作用于每个元素,然后根据返回值是True还是False决定保留还是丢弃该元素
def is_odd(n):
return n % 2 == 1
l = [1, 2, 4, 5, 6, 8, 19]
print filter(is_odd, l)
def not_empty(s):
return s and s.strip()
l = ['A', ' ', None, 'C', ' ']
print filter(not_empty, l)
| snownothing/Python | liaoxuefeng.com/018-Filter.py | Python | mit | 376 |
import requests
import json
import os
import string
from lxml import etree
SITE_ROOT = "http://magiccards.info"
SITE_MAP = "http://magiccards.info/sitemap.html"
GET_CARD_ABILITIES = True
def filename_encode(name):
return ''.join([n for n in name if n in string.digits + string.letters])
def parse_sets(url):
... | kyleconroy/brushwagg | scrape.py | Python | mit | 2,745 |
#!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2017
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as publish... | rogerscristo/BotFWD | env/lib/python3.6/site-packages/telegram/ext/typehandler.py | Python | mit | 4,005 |
import yaml
from django.core.management.base import BaseCommand, CommandError
from workshops.views import _export_instructors
class Command(BaseCommand):
args = 'no arguments'
help = 'Display YAML for airports.'
def handle(self, *args, **options):
print(yaml.dump(_export_instructors()).rstrip())
| shapiromatron/amy | workshops/management/commands/export_airports.py | Python | mit | 319 |
import numpy as np
class ObliviousTree:
'This is an implementation of Oblvious Tree'
def __init__(self,data=[],func="C4.5",autoload=False):
self.data=data
self.split_funct=func
self.autoload=autoload
self.feature_names=self.data.columns.tolist()
self.feature_name_doma... | eliethesaiyan/ObliviousDecisionTree | ObliviousTree.py | Python | mit | 3,395 |