code stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 226 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 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 later... | jmartinm/invenio-oauthclient | invenio_oauthclient/contrib/github.py | Python | gpl-2.0 | 3,966 |
# (c) 2019 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 dis... | aperigault/ansible | test/units/modules/network/nxos/test_nxos_bfd_global.py | Python | gpl-3.0 | 10,607 |
#!/usr/bin/env python3
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
from __future__ import absolute_import
import os
import platform
import sys
import subprocess
DIR_OF_THIS_SCRIPT = os.path.dirname( os.path.abspath( __file__ ) )
DIR_OF_DOCS = os.path.... | Valloric/ycmd | update_api_docs.py | Python | gpl-3.0 | 1,822 |
# coding=utf-8
# This file is part of SickRage.
#
# URL: https://sickrage.github.io
# Git: https://github.com/SickRage/SickRage.git
#
# SickRage 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... | Maximilian-Reuter/SickRage-1 | sickrage/providers/torrent/TorrentProvider.py | Python | gpl-3.0 | 5,136 |
from django.db import migrations, models
from django.conf import settings
from opaque_keys.edx.django.models import CourseKeyField
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
... | eduNEXT/edx-platform | lms/djangoapps/course_goals/migrations/0001_initial.py | Python | agpl-3.0 | 1,064 |
# -*- coding: utf-8 -*-
from django.db import migrations, models
import django.db.models.deletion
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel... | stvstnfrd/edx-platform | openedx/core/djangoapps/video_pipeline/migrations/0001_initial.py | Python | agpl-3.0 | 1,352 |
"""
Data models used for Blockstore API Client
"""
from datetime import datetime
from uuid import UUID
import attr
import six
def _convert_to_uuid(value):
if not isinstance(value, UUID):
return UUID(value)
return value
@attr.s(frozen=True)
class Collection(object):
"""
Metadata about a blo... | stvstnfrd/edx-platform | openedx/core/lib/blockstore_api/models.py | Python | agpl-3.0 | 2,551 |
'''
Created on Jun 6, 2013
@author: dmitchell
'''
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
from student.tests.factories import AdminFactory
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
import xmodule_modifiers
import datetime
from pytz import UTC
from xmodule... | PepperPD/edx-pepper-platform | common/djangoapps/tests.py | Python | agpl-3.0 | 2,072 |
# -*- coding: utf-8 -*-
#***************************************************************************
#* *
#* Copyright (c) 2015 Yorik van Havre <yorik@uncreated.net> *
#* ... | timthelion/FreeCAD | src/Mod/Path/PathScripts/PathSimpleCopy.py | Python | lgpl-2.1 | 3,675 |
'''
* Copyright (C) 2015 Tripwire, 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 wr... | xujun10110/TARDIS | parseSTIX.py | Python | apache-2.0 | 2,526 |
# Copyright (c) 2016 PaddlePaddle 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 applic... | emailweixu/Paddle | demo/image_classification/image_provider.py | Python | apache-2.0 | 3,297 |
# Copyright 2019 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... | tensorflow/tensorflow | tensorflow/python/debug/lib/debug_v2_ops_test.py | Python | apache-2.0 | 31,247 |
# -*- coding: utf-8 -*-
"""
This module contains backports to support older Python versions.
They contain the backported code originally developed for Python. It is
therefore distributed under the PSF license, as follows:
PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
--------------------------------------------
1. Th... | valhallasw/pywikibot-core | pywikibot/backports.py | Python | mit | 6,204 |
import logging
import six
import warnings
from ..auth import auth
from ..constants import INSECURE_REGISTRY_DEPRECATION_WARNING
from .. import utils
from .. import errors
log = logging.getLogger(__name__)
class ImageApiMixin(object):
@utils.check_resource
def get_image(self, image):
res = self._get... | AccelAI/accel.ai | flask-aws/lib/python2.7/site-packages/docker/api/image.py | Python | mit | 9,342 |
try:
# Try using ez_setup to install setuptools if not already installed.
from ez_setup import use_setuptools
use_setuptools()
except ImportError:
# Ignore import error and assume Python 3 which already has setuptools.
pass
from setuptools import setup, find_packages
classifiers = ['Development St... | cwalk/CapacitiveTouchLamp | setup.py | Python | mit | 1,311 |
import sys
import urllib
import urlparse
import weakref
import datetime
import json
import xbmc
import xbmcaddon
import xbmcplugin
import xbmcvfs
from ..abstract_context import AbstractContext
from .xbmc_plugin_settings import XbmcPluginSettings
from .xbmc_context_ui import XbmcContextUI
from .xbmc_system_version imp... | guidosarducci/plugin.video.youtube | resources/lib/kodion/impl/xbmc/xbmc_context.py | Python | gpl-2.0 | 9,558 |
# -*- coding: utf-8 -*-
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe, json
from frappe.model.document import Document
class SetupProgress(Document):
pass
def get_setup_progress():
if not ... | ovresko/erpnext | erpnext/setup/doctype/setup_progress/setup_progress.py | Python | gpl-3.0 | 1,811 |
#!/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.
# TODO(brettw) bug 582594: merge this with build/android/gn/zip.py and update
# callers to use the existing template rather than invo... | geminy/aidear | oss/qt/qt-everywhere-opensource-src-5.9.0/qtwebengine/src/3rdparty/chromium/mojo/public/tools/gn/zip.py | Python | gpl-3.0 | 2,774 |
# -*- coding: utf-8 -*-
# Copyright(C) 2012 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 opti... | laurent-george/weboob | modules/prixcarburants/pages.py | Python | agpl-3.0 | 2,744 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
##
# myapp.urls
##
##
# Copyright (C) $YEAR$, $AUTHOR_NAME$ <$AUTHOR_EMAIL$>
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of version 3 of the GNU Affero General Public License as
# published by the Free Software Found... | maaku/django-reuse | templates/apps/basic/myapp/urls.py | Python | agpl-3.0 | 886 |
# -*- coding: utf-8 -*-
from . import sale
from . import magento_model
| acsone/connector-magento | magentoerpconnect_order_comment/__init__.py | Python | agpl-3.0 | 72 |
'''Autogenerated by xml_generate script, do not edit!'''
from OpenGL import platform as _p, arrays
# Code generation uses this
from OpenGL.raw.GL import _types as _cs
# End users want this...
from OpenGL.raw.GL._types import *
from OpenGL.raw.GL import _errors
from OpenGL.constant import Constant as _C
import ctypes
_... | stack-of-tasks/rbdlpy | tutorial/lib/python2.7/site-packages/OpenGL/raw/GL/SGIX/shadow.py | Python | lgpl-3.0 | 750 |
"""
SAX driver for the pyexpat C module. This driver works with
pyexpat.__version__ == '2.22'.
"""
version = "0.20"
from xml.sax._exceptions import *
from xml.sax.handler import feature_validation, feature_namespaces
from xml.sax.handler import feature_namespace_prefixes
from xml.sax.handler import feature_external_... | batermj/algorithm-challenger | code-analysis/programming_anguage/python/source_codes/Python3.5.9/Python-3.5.9/Lib/xml/sax/expatreader.py | Python | apache-2.0 | 15,704 |
# Copyright 2012 Nebula, Inc.
# Copyright 2013 IBM Corp.
#
# 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... | yosshy/nova | nova/tests/functional/api_samples_test_base.py | Python | apache-2.0 | 15,165 |
from nose.tools import * # flake8: noqa
from api.base import settings
from tests.base import ApiTestCase
# The versions below are specifically for testing purposes and do not reflect the actual versioning of the API.
# If changes are made to this list, or to DEFAULT_VERSION, please reflect those changes in:
# api/... | acshi/osf.io | api_tests/base/test_versioning.py | Python | apache-2.0 | 6,291 |
# $Id$
#
# Copyright (C) 2005 Gregory P. Smith (greg@krypto.org)
# Licensed to PSF under a Contributor Agreement.
#
__doc__ = """hashlib module - A common interface to many hash functions.
new(name, string='') - returns a new hash object implementing the
given hash function; initia... | nmercier/linux-cross-gcc | win32/bin/Lib/hashlib.py | Python | bsd-3-clause | 8,063 |
#import binwalk.core.C
import binwalk.core.plugin
#from binwalk.core.common import *
class CompressdPlugin(binwalk.core.plugin.Plugin):
# '''
# Searches for and validates compress'd data.
# '''
MODULES = ['Signature']
#READ_SIZE = 64
#COMPRESS42 = "compress42"
#COMPRESS42_FUNCTIONS = [
... | cristianst85/binwalk | src/binwalk/plugins/compressd.py | Python | mit | 1,421 |
"""
A component which allows you to send data to Dweet.io.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/dweet/
"""
import logging
from datetime import timedelta
import voluptuous as vol
from homeassistant.const import EVENT_STATE_CHANGED, STATE_UNKNO... | mikaelboman/home-assistant | homeassistant/components/dweet.py | Python | mit | 1,961 |
class A:
def test(self):
print "I##|nitializing A", "test"##|
attribute = "hello"
def my_method(self):
print self.attribute
a = A()
a.test()
##r Should expand to Full String "Initializing A"
# Invalid selection:
# nitializing A", "test" | aptana/Pydev | tests/org.python.pydev.refactoring.tests/src/python/visitor/selectionextension/testSelectionExtensionExprFail.py | Python | epl-1.0 | 286 |
import rtaudio as rt
from math import cos
import struct
class audio_generator:
def __init__(self):
self.idx = -1
self.freq = 440.
def __call__(self):
self.idx += 1
if self.idx%48000 == 0:
self.freq *= 2**(1/12.)
return 0.5*cos(2.*3.1416*self.freq*self.... | naivesound/glitch | vendor/github.com/thestk/rtaudio/contrib/python/pyrtaudio/PyRtAudioTest.py | Python | gpl-3.0 | 1,553 |
#!/bin/false
# This file is part of Espruino, a JavaScript interpreter for Microcontrollers
#
# Copyright (C) 2013 Gordon Williams <gw@pur3.co.uk>
#
# 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 h... | vshymanskyy/Espruino | boards/STM32F429IDISCOVERY.py | Python | mpl-2.0 | 5,336 |
# Copyright 2016 Twitter. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | zhangzhonglai/heron | integration-test/src/python/integration_test/core/constants.py | Python | apache-2.0 | 1,130 |
"""
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 use this ... | zouzhberk/ambaridemo | demo-server/src/main/resources/stacks/HDP/2.1.GlusterFS/services/YARN/package/scripts/application_timeline_server.py | Python | apache-2.0 | 1,573 |
# Copyright 2011 VMware, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | shakamunyi/neutron-vrrp | neutron/neutron_plugin_base_v2.py | Python | apache-2.0 | 14,707 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2019-06-27 20:29
from __future__ import unicode_literals
from django.db import migrations
import osf.utils.fields
class Migration(migrations.Migration):
dependencies = [
('addons_onedrive', '0002_auto_20171121_1426'),
]
operations = [
... | Johnetordoff/osf.io | addons/onedrive/migrations/0003_rename_deleted_field.py | Python | apache-2.0 | 997 |
#!/user/bin/env python
"""
@package mi.dataset.param_dict
@file mi/dataset/param_dict.py
@author Emily Hahn
@brief Extend the protocol param dict to handle dataset encoding exceptions
"""
import re
from mi.core.instrument.protocol_param_dict import ProtocolParameterDict, ParameterDescription
from mi.core.instrument.p... | janeen666/mi-instrument | mi/dataset/param_dict.py | Python | bsd-2-clause | 7,444 |
# 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 logging
import os
from document_parser import ParseDocument
from third_party.json_schema_compiler.model import UnixName
class DocumentRenderer(objec... | TeamEOS/external_chromium_org | chrome/common/extensions/docs/server2/document_renderer.py | Python | bsd-3-clause | 4,116 |
import re
import ast
from setuptools import setup, find_packages
_version_re = re.compile(r'__version__\s+=\s+(.*)')
with open('mycli/__init__.py', 'rb') as f:
version = str(ast.literal_eval(_version_re.search(
f.read().decode('utf-8')).group(1)))
description = 'CLI for MySQL Database. With auto-completi... | suzukaze/mycli | setup.py | Python | bsd-3-clause | 1,852 |
#-----------------------------------------------------------------------------
# Copyright (c) 2008-2012, David P. D. Moss. All rights reserved.
#
# Released under the BSD license. See the LICENSE file for details.
#-----------------------------------------------------------------------------
"""Routines for IPv4 a... | ecolitan/fatics | venv/lib/python2.7/site-packages/netaddr/ip/__init__.py | Python | agpl-3.0 | 66,411 |
#!/usr/bin/env python
# ___ ___ _ _ ___ ___ _ _____ ___ ___
# / __| __| \| | __| _ \ /_\_ _| __| \
# | (_ | _|| .` | _|| / / _ \| | | _|| |) |
# \___|___|_|\_|___|_|_\/_/_\_\_|_|___|___/_ _____
# | \ / _ \ | \| |/ _ \_ _| | __| \_ _|_ _|
# | |) | (_) | | .` | (_) || | | _|| |) | | ... | twiest/openshift-tools | openshift/installer/vendored/openshift-ansible-git-2016-04-18/roles/lib_openshift_api/library/oadm_router.py | Python | apache-2.0 | 28,872 |
from ..broker import Broker
class FailOverConfigurationBroker(Broker):
controller = "fail_over_configurations"
def get_config(self, **kwargs):
"""Get the failover configuration for the specified unit.
**Inputs**
| ``api version min:`` None
| ``api version max:`... | infobloxopen/infoblox-netmri | infoblox_netmri/api/broker/v3_8_0/fail_over_configuration_broker.py | Python | apache-2.0 | 12,204 |
# testyacc.py
import unittest
try:
import StringIO
except ImportError:
import io as StringIO
import sys
import os
sys.path.insert(0,"..")
sys.tracebacklimit = 0
import ply.yacc
def check_expected(result,expected):
resultlines = []
for line in result.splitlines():
if line.startswith("WARNING... | anuragiitg/nixysa | third_party/ply-3.1/test/testyacc.py | Python | apache-2.0 | 13,190 |
# Used swedish insurance data from smalldata instead of MASS/insurance due to the license of the MASS R package.
import h2o
from h2o.estimators.glm import H2OGeneralizedLinearEstimator
h2o.init()
h2o_df = h2o.import_file("http://h2o-public-test-data.s3.amazonaws.com/smalldata/glm_test/Motor_insurance_sweden.txt", sep ... | YzPaul3/h2o-3 | h2o-docs/src/booklets/v2_2015/source/GLM_Vignette_code_examples/glm_poisson_example.py | Python | apache-2.0 | 514 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from dateutil import relativedelta
from odoo import fields, models, api
class LeadTest(models.Model):
_name = "base.automation.lead.test"
_description = "Automated Rule Test"
name = fields.Char(string='Sub... | t3dev/odoo | addons/base_automation/tests/test_models.py | Python | gpl-3.0 | 1,762 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import unittest
from openerp.tools.translate import quote, unquote, xml_translate
class TranslationToolsTestCase(unittest.TestCase):
def test_quote_unquote(self):
def test_string(str):
quoted =... | minhphung171093/GreenERP | openerp/addons/base/tests/test_translate.py | Python | gpl-3.0 | 6,065 |
"""
Map urls to the relevant view handlers
"""
from django.conf.urls import url
from openedx.core.djangoapps.zendesk_proxy.v0.views import ZendeskPassthroughView as v0_view
from openedx.core.djangoapps.zendesk_proxy.v1.views import ZendeskPassthroughView as v1_view
urlpatterns = [
url(r'^v0$', v0_view.as_view()... | eduNEXT/edunext-platform | openedx/core/djangoapps/zendesk_proxy/urls.py | Python | agpl-3.0 | 412 |
# Copyright (c) 2012 Citrix Systems, 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 ... | ntt-sic/nova | nova/api/openstack/compute/contrib/aggregates.py | Python | apache-2.0 | 8,962 |
# Copyright (C) 2012 Balazs Ankes (bank@inf.u-szeged.hu) University of Szeged
#
# 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 lis... | hujiajie/chromium-crosswalk | third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/png_unittest.py | Python | bsd-3-clause | 3,001 |
# Test the Unicode versions of normal file functions
# open, os.open, os.stat. os.listdir, os.rename, os.remove, os.mkdir, os.chdir, os.rmdir
import sys, os, unittest
from unicodedata import normalize
from test import test_support
filenames = [
'1_abc',
u'2_ascii',
u'3_Gr\xfc\xdf-Gott',
u'4_\... | ktan2020/legacy-automation | win/Lib/test/test_pep277.py | Python | mit | 8,085 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
inOutSelector.py
---------------------
Date : April 2011
Copyright : (C) 2011 by Giuseppe Sucameli
Email : brush dot tyler at gmail dot com
*************... | dracos/QGIS | python/plugins/GdalTools/tools/inOutSelector.py | Python | gpl-2.0 | 7,841 |
#
# Copyright (C) 2012 Stanislav Bohm
#
# This file is part of Kaira.
#
# Kaira 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 3 of the License, or
# (at your option) any later versi... | Kobzol/kaira | ptp/base/paths.py | Python | gpl-3.0 | 1,340 |
# Copyright 2014 Mirantis.inc
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | rushiagr/keystone | keystone/common/sql/migrate_repo/versions/050_fk_consistent_indexes.py | Python | apache-2.0 | 2,112 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'configdialog.ui'
#
# by: PyQt4 UI code generator 4.5.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
class Ui_Dialog(object):
def setupUi(self, Dialog):
Dialog.setObjectName("Dia... | shakna-israel/rst2pdf | gui/Ui_configdialog.py | Python | mit | 7,900 |
"""
Module for Image annotations using annotator.
"""
from lxml import etree
from pkg_resources import resource_string
from xmodule.x_module import XModule
from xmodule.raw_module import RawDescriptor
from xblock.core import Scope, String
from xmodule.annotator_mixin import get_instructions, html_to_text
from xmodule.... | c0710204/edx-platform | common/lib/xmodule/xmodule/imageannotation_module.py | Python | agpl-3.0 | 7,154 |
"""A Mailman newsletter subscription interface.
To use this plugin, enable the newsletter module and set the newsletter module and name settings
in the admin settings page.
"""
from django.utils.translation import ugettext as _
from Mailman import MailList, Errors
from models import Subscription
from livesettings imp... | mitchellzen/pops | satchmo/apps/satchmo_ext/newsletter/mailman.py | Python | bsd-3-clause | 5,119 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2008, 2009, 2010, 2011, 2012, 2013 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,... | Lilykos/invenio | invenio/legacy/bibedit/cli.py | Python | gpl-2.0 | 10,826 |
#!/usr/bin/env python
"""Execute the tests for the samcat program.
The golden test outputs are generated by the script generate_outputs.sh.
You have to give the root paths to the source and the binaries as arguments to
the program. These are the paths to the directory that contains the 'projects'
directory.
Usage: ... | rrahn/gdf_tools | include/seqan/apps/samcat/tests/run_tests.py | Python | gpl-3.0 | 3,112 |
# Copyright (c) 2014 Red Hat, 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 require... | mattt416/neutron | neutron/tests/functional/agent/linux/test_keepalived.py | Python | apache-2.0 | 2,730 |
"""
A pure python (slow) implementation of rijndael with a decent interface
To include -
from rijndael import rijndael
To do a key setup -
r = rijndael(key, block_size = 16)
key must be a string of length 16, 24, or 32
blocksize must be 16, 24, or 32. Default is 16
To use -
ciphertext = r.encrypt(plaintext)
plai... | azumimuo/family-xbmc-addon | script.mrknow.urlresolver/lib/urlresolver9/plugins/lib/rijndael.py | Python | gpl-2.0 | 10,498 |
def format_date(dt):
return dt.strftime('%Y-%m-%d %H:%M:%S')
| aabed/mhn | server/mhn/common/templatetags.py | Python | lgpl-2.1 | 65 |
# ==================================================================================================
# Copyright 2013 Twitter, Inc.
# --------------------------------------------------------------------------------------------------
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use thi... | WCCCEDU/twitter-commons | src/python/twitter/common/rpc/finagle/__init__.py | Python | apache-2.0 | 1,073 |
from django.contrib.gis.gdal import OGRGeomType
from django.db.backends.postgresql.introspection import DatabaseIntrospection
class GeoIntrospectionError(Exception):
pass
class PostGISIntrospection(DatabaseIntrospection):
# Reverse dictionary for PostGIS geometry types not populated until
# introspectio... | sametmax/Django--an-app-at-a-time | ignore_this_directory/django/contrib/gis/db/backends/postgis/introspection.py | Python | mit | 4,388 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Test functionality of coursera module.
"""
import json
import os.path
import pytest
from six import iteritems
from mock import patch, Mock, mock_open
from coursera import coursera_dl
# JSon Handling
@pytest.fixture
def get_page(monkeypatch):
monkeypatch.setat... | rihbyne/coursera-dl | coursera/test/test_parsing.py | Python | lgpl-3.0 | 3,627 |
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
ExtractorError,
int_or_none,
update_url_query,
)
class NaverIE(InfoExtractor):
_VALID_URL = r'https?://(?:m\.)?tv(?:cast)?\.naver\.com/v/(?P<id>\d+)'
_TESTS = [{
'url': 'http:/... | epitron/youtube-dl | youtube_dl/extractor/naver.py | Python | unlicense | 5,293 |
#
# 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 ... | rosmo/aurora | src/main/python/apache/aurora/common/cluster.py | Python | apache-2.0 | 3,365 |
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public L... | jaggu303619/asylum | openerp/addons/sale_margin/sale_margin.py | Python | agpl-3.0 | 4,272 |
#!/usr/bin/env python3
"""Utility program to post a comment to a github PR"""
import argparse
import json
import os
import sys
import urllib.parse
from urllib.error import HTTPError, URLError
from urllib.request import urlopen, Request
def _parse_args():
pr_link_var = "ghprbPullLink"
pr_link_option = "--pr-li... | zero323/spark | dev/ansible-for-test-node/roles/jenkins-worker/files/util_scripts/post_github_pr_comment.py | Python | apache-2.0 | 2,930 |
#
# configparse.py
#
# an example of using the parsing module to be able to process a .INI configuration file
#
# Copyright (c) 2003, Paul McGuire
#
from pyparsing import \
Literal, Word, ZeroOrMore, Group, Dict, Optional, \
printables, ParseException, restOfLine
import pprint
inibnf = ... | dbbhattacharya/kitsune | vendor/packages/pyparsing/examples/configParse.py | Python | bsd-3-clause | 1,856 |
from browser import window
_kids=['Marsha', 'Jan', 'Cindy']
def continue1(event):
_objectStore.get('Jan', onsuccess=exists, onerror=continue2)
def continue2(event):
for _kid in _kids:
_rec={'name': _kid}
_objectStore.put(_rec, _kid, onsuccess=printmsg, onerror=printerr)
_objectStore.get(... | jonathanverner/brython | www/tests/test_indexedDB.py | Python | bsd-3-clause | 1,790 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
def setup_module(module):
from nose import SkipTest
from nltk.parse.malt import MaltParser
try:
depparser = MaltParser('maltparser-1.7.2')
except LookupError:
raise SkipTest("MaltParser is not available")
| sdoran35/hate-to-hugs | venv/lib/python3.6/site-packages/nltk/test/gluesemantics_malt_fixt.py | Python | mit | 302 |
#! /usr/bin/env python
# $Id: test_inline_markup.py 4564 2006-05-21 20:44:42Z wiemann $
# Author: David Goodger <goodger@python.org>
# Copyright: This module has been placed in the public domain.
"""
Tests for inline markup in PEPs (readers/pep.py).
"""
from __init__ import DocutilsTestSupport
def suite():
s =... | waseem18/oh-mainline | vendor/packages/docutils/test/test_readers/test_pep/test_inline_markup.py | Python | agpl-3.0 | 3,252 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from frappe import _
class ItemAttribute(Document):
def validate(self):
self.valid... | treejames/erpnext | erpnext/stock/doctype/item_attribute/item_attribute.py | Python | agpl-3.0 | 1,275 |
#!/usr/bin/env python
#
# Copyright (C) 2013 Nippon Telegraph and Telephone Corporation.
# Copyright (C) 2013 YAMAMOTO Takashi <yamamoto at valinux co jp>
#
# 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... | sivaramakrishnansr/ryu | ryu/cmd/of_config_cli.py | Python | apache-2.0 | 15,609 |
import os
import sys
import shutil
from glob import glob
# --------------------------------------------------------------------------
DOC_DIR = 'hr-html'
PYWRAPS_FN = 'idaapi.py'
# --------------------------------------------------------------------------
def add_footer(lines):
S1 = 'Generated by Epydoc'
S2 =... | zachriggle/idapython | hrdoc.py | Python | bsd-3-clause | 3,025 |
import agents as ag
def HW2Agent() -> object:
"An agent that keeps track of what locations are clean or dirty."
oldPercepts = [('None', 'Clean')]
oldActions = ['NoOp']
actionScores = [{
'Right': 0,
'Left': 0,
'Up': -1,
'Down': -1,
'NoOp': -100,
}]
level ... | WhittKinley/aima-python | submissions/Sery/vacuum2.py | Python | mit | 1,432 |
# example for using Python with cython bindings as a [HAL]HALFILE
# in the ini file, add as last HALFILE:
#[HAL]
#HALFILE = haltest.py
from machinekit.halfile import rt, hal
rt.loadrt("supply")
hal.addf("supply.0.update","servo-thread")
| ArcEye/machinekit-testing | configs/sim/axis/haltest.py | Python | lgpl-2.1 | 242 |
# Support for the GeoRSS format
# Copyright 2010-2015 Kurt McKee <contactme@kurtmckee.org>
# Copyright 2002-2008 Mark Pilgrim
# All rights reserved.
#
# This file is a part of feedparser.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following con... | terbolous/SickRage | lib/feedparser/namespaces/georss.py | Python | gpl-3.0 | 11,117 |
# 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... | odejesush/tensorflow | tensorflow/python/debug/wrappers/local_cli_wrapper_test.py | Python | apache-2.0 | 13,116 |
# -*- coding: utf-8 -*-
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
from frappe.model.document import Document
class ChapterMember(Document):
pass
| ovresko/erpnext | erpnext/non_profit/doctype/chapter_member/chapter_member.py | Python | gpl-3.0 | 267 |
# coding: utf8
{
'"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the results of a JOIN': '"Uaktualnij" jest dodatkowym wyra\xc5\xbceniem postaci "pole1=\'nowawarto\xc5\x9b\xc4\x87\'". Nie mo\xc5\xbcesz uaktualni\xc4\x87 lub usun\xc4\x85\xc4\x87 wynik\xc3\xb3w z JOIN:',
'%Y-%m... | montaggroup/montag-token-redeemer | web2py/applications/token_redeemer/languages/pl-pl.py | Python | gpl-3.0 | 3,788 |
# -*- coding: utf-8 -*-
"""
Models for Credit Eligibility for courses.
Credit courses allow students to receive university credit for
successful completion of a course on EdX
"""
import datetime
from collections import defaultdict
import logging
import pytz
from django.conf import settings
from django.core.cache im... | tiagochiavericosta/edx-platform | openedx/core/djangoapps/credit/models.py | Python | agpl-3.0 | 24,095 |
# -*- coding: utf-8 -*-
"""
flaskext.babel
~~~~~~~~~~~~~~
Implements i18n/l10n support for Flask applications based on Babel.
:copyright: (c) 2010 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import os
# this is a workaround for a snow... | SohKai/ChronoLogger | web/flask/lib/python2.7/site-packages/flaskext/babel.py | Python | mit | 18,730 |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | ueshin/apache-spark | python/pyspark/pandas/tests/test_window.py | Python | apache-2.0 | 13,671 |
#!/usr/bin/env python
# normalDate.py - version 1.0 - 20000717
#hacked by Robin Becker 10/Apr/2001
#major changes include
# using Types instead of type(0) etc
# BusinessDate class
# __radd__, __rsub__ methods
# formatMS stuff
# derived from an original version created
# by Jeff Bauer of Rubicon Research and us... | Microvellum/Fluid-Designer | win64-vc/2.78/python/lib/reportlab/lib/normalDate.py | Python | gpl-3.0 | 20,867 |
__author__ = 'matjaz'
| anirudhvenkats/clowdflows | workflows/management/commands/__init__.py | Python | gpl-3.0 | 23 |
PRIORITY_EMAIL_NOW = 0
PRIORITY_HIGH = 1
PRIORITY_NORMAL = 3
PRIORITY_LOW = 5
RESULT_SENT = 0
RESULT_SKIPPED = 1
RESULT_FAILED = 2
PRIORITIES = {
'now': PRIORITY_EMAIL_NOW,
'high': PRIORITY_HIGH,
'normal': PRIORITY_NORMAL,
'low': PRIORITY_LOW,
}
PRIORITY_HEADER = 'X-Mail-Queue-Priority'
try:
fro... | mfwarren/django-mailer-2 | django_mailer/constants.py | Python | mit | 475 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2015, Joseph Callen <jcallen () csc.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',
... | e-gob/plataforma-kioscos-autoatencion | scripts/ansible-play/.venv/lib/python2.7/site-packages/ansible/modules/cloud/vmware/vmware_vmkernel_ip_config.py | Python | bsd-3-clause | 3,594 |
def main(request, response):
import simplejson as json
f = file('config.json')
source = f.read()
s = json.JSONDecoder().decode(source)
url1 = "http://" + s['host'] + ":" + str(s['ports']['http'][1])
url2 = "http://" + s['host'] + ":" + str(s['ports']['http'][0])
_CSP = "media-src " + url1 + ... | kaixinjxq/web-testing-service | wts/tests/csp/csp_media-src_corss-origin_audio_allowed_ext.py | Python | bsd-3-clause | 3,027 |
# head.py
# Copyright (C) 2008-2010 Michael Trier (mtrier@gmail.com) and contributors
#
# This module is part of GitPython and is released under
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
import commit
class Head(object):
"""
A Head is a named reference to a Commit. Every Head insta... | biswajitsahu/kuma | vendor/packages/git/head.py | Python | mpl-2.0 | 2,739 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# 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.
#
... | j00bar/ansible | lib/ansible/modules/cloud/amazon/ec2_ami_copy.py | Python | gpl-3.0 | 6,886 |
from ..models import models
class RasterModel(models.Model):
rast = models.RasterField('A Verbose Raster Name', null=True, srid=4326, spatial_index=True, blank=True)
class Meta:
required_db_features = ['supports_raster']
def __str__(self):
return str(self.id)
| DONIKAN/django | tests/gis_tests/rasterapp/models.py | Python | bsd-3-clause | 292 |
#!/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... | hryamzik/ansible | lib/ansible/modules/network/cloudengine/ce_file_copy.py | Python | gpl-3.0 | 12,627 |
import logging
from django.template import Context, Engine, Variable, VariableDoesNotExist
from django.test import SimpleTestCase, ignore_warnings
from django.utils.deprecation import RemovedInDjango21Warning
class TestHandler(logging.Handler):
def __init__(self):
super().__init__()
self.log_reco... | tysonclugg/django | tests/template_tests/test_logging.py | Python | bsd-3-clause | 4,731 |
import cbor
with open("/tmp/data.cbor", "rb") as f:
serialized = f.read()
data = cbor.loads(serialized)
print(data)
assert(data["name"] == "python-cbor")
assert(data["versions"] == ["1", "2"])
assert(data["group"]["is_a_package"] is True)
assert(data["group"]["value"] == 42)
| masahir0y/buildroot-yamada | support/testing/tests/package/sample_python_cbor_dec.py | Python | gpl-2.0 | 281 |
import os as _os
__path__.append(_os.path.join(__path__[0], '..', '..', 'gen', 'ortools', 'algorithms'))
__path__.append(_os.path.join(__path__[0], '..', '..', '..', 'lib'))
| capturePointer/or-tools | src/ortools/algorithms/__init__.py | Python | apache-2.0 | 174 |
# 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... | benoitsteiner/tensorflow-xsmm | tensorflow/python/ops/linalg/linear_operator_full_matrix.py | Python | apache-2.0 | 6,537 |
#!/usr/bin/python
# (c) 2018-2019, NetApp, 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',
'status': ['preview'],
... | kustodian/ansible | lib/ansible/modules/storage/netapp/na_ontap_cluster_peer.py | Python | gpl-3.0 | 12,647 |
import sys
import glob
def read_fileb(filename, mode='rb'):
f = open(filename, mode)
try:
return f.read()
finally:
f.close()
def write_fileb(filename, value, mode='wb'):
f = open(filename, mode)
try:
f.write(value)
finally:
f.close()
for filename in glob.glob... | pouyana/teireader | webui/scripts/fixws.py | Python | mit | 646 |
from __future__ import absolute_import
from django.test import TestCase
from .models import Person
class SaveDeleteHookTests(TestCase):
def test_basic(self):
p = Person(first_name="John", last_name="Smith")
self.assertEqual(p.data, [])
p.save()
self.assertEqual(p.data, [
... | LethusTI/supportcenter | vendor/django/tests/modeltests/save_delete_hooks/tests.py | Python | gpl-3.0 | 761 |
'''
Bubble
======
.. versionadded:: 1.1.0
.. image:: images/bubble.jpg
:align: right
The Bubble widget is a form of menu or a small popup where the menu options
are stacked either vertically or horizontally.
The :class:`Bubble` contains an arrow pointing in the direction you
choose.
Simple example
------------... | BillBillBillBill/Tickeys-linux | tickeys/kivy_32/kivy/uix/bubble.py | Python | mit | 12,590 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.