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 |
|---|---|---|---|---|---|
import binascii
import sys
class ProtocolTreeNode(object):
def __init__(self, tag, attributes = None, children = None, data = None):
self.tag = tag
self.attributes = attributes or {}
self.children = children or []
self.data = data
assert type(self.children) is list, "Childr... | metis-ai/yowsup | yowsup/structs/protocoltreenode.py | Python | gpl-3.0 | 4,746 |
"""Update Calendar index.
Revision ID: 1c73ca99c03b
Revises: 1d7a72222b7c
Create Date: 2015-02-26 00:50:52.322510
"""
# revision identifiers, used by Alembic.
revision = '1c73ca99c03b'
down_revision = '1d7a72222b7c'
from alembic import op
def upgrade():
op.drop_constraint('calendar_ibfk_1', 'calendar', type_=... | nylas/sync-engine | migrations/versions/144_update_calendar_index.py | Python | agpl-3.0 | 1,080 |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from nipype.testing import assert_equal
from nipype.interfaces.camino.convert import FSL2Scheme
def test_FSL2Scheme_inputs():
input_map = dict(args=dict(argstr='%s',
),
bscale=dict(argstr='-bscale %d',
units='NA',
),
bval_file=dict(argstr='-... | JohnGriffiths/nipype | nipype/interfaces/camino/tests/test_auto_FSL2Scheme.py | Python | bsd-3-clause | 1,562 |
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the author be held liable for any damages
# arising from the use of this software.
#
# Permission is granted to anyone to use this software for any purpose,
# including commercial applications, and to alter it and redistri... | abpai/mailin-test | python/dkim/canonicalization.py | Python | mit | 4,252 |
# PLURAL - last updated for NodeBox 1rc7
# Author: Tom De Smedt <tomdesmedt@organisms.be>
# See LICENSE.txt for details.
# Based on "An Algorithmic Approach to English Pluralization" by Damian Conway:
# http://www.csse.monash.edu.au/~damian/papers/HTML/Plurals.html
# Prepositions are used to solve things like
# "moth... | RensaProject/nodebox_linguistics_extended | nodebox_linguistics_extended/plural.py | Python | gpl-2.0 | 12,919 |
#!/usr/bin/env python
# (c) 2015, Marc Abramowitz <marca@surveymonkey.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
# (... | hryamzik/ansible | contrib/inventory/serf.py | Python | gpl-3.0 | 3,026 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2014, 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... | subutai/nupic | tests/integration/nupic/algorithms/extensive_tm_test_base.py | Python | agpl-3.0 | 22,199 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# Author: Nicolas Bessi.
# Copyright Camptocamp SA 2011
#
# 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
#... | Ehtaga/account-financial-reporting | account_financial_report_webkit/account_move_line.py | Python | agpl-3.0 | 3,309 |
"""Configuration for Ring tests."""
import re
import pytest
import requests_mock
from tests.common import load_fixture
@pytest.fixture(name="requests_mock")
def requests_mock_fixture():
"""Fixture to provide a requests mocker."""
with requests_mock.mock() as mock:
# Note all devices have an id of 98... | tchellomello/home-assistant | tests/components/ring/conftest.py | Python | apache-2.0 | 1,963 |
# 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 agreed to in... | wolverineav/neutron | neutron/_i18n.py | Python | apache-2.0 | 1,355 |
from twisted.trial import unittest
class TestTwisted(unittest.TestCase):
def test(self):
pass
def test_fail(self):
self.fail("I failed")
def test_error(self):
raise TypeError("oops, wrong type")
def test_skip(self):
raise unittest.SkipTest('skip me')
| DESHRAJ/fjord | vendor/packages/nose/functional_tests/support/twist/test_twisted.py | Python | bsd-3-clause | 304 |
"""
SleekXMPP: The Sleek XMPP Library
Copyright (C) 2012 Nathanael C. Fritz
This file is part of SleekXMPP.
See the file LICENSE for copying permission.
"""
from sleekxmpp.stanza import Message
from sleekxmpp.util import unicode
from sleekxmpp.thirdparty import OrderedDict
from sleekxmpp.xmlstream im... | danielvdao/facebookMacBot | venv/lib/python2.7/site-packages/sleekxmpp/plugins/xep_0071/stanza.py | Python | mit | 2,862 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Guewen Baconnier
# Copyright 2013 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# pu... | acsone/connector-magento | magentoerpconnect_export_partner/__openerp__.py | Python | agpl-3.0 | 1,687 |
# 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... | karllessard/tensorflow | tensorflow/python/framework/subscribe_test.py | Python | apache-2.0 | 13,361 |
from __future__ import absolute_import, unicode_literals
import threading
import unittest
import gobject
gobject.threads_init()
import mock
import pygst
pygst.require('0.10')
import gst # noqa
import pykka
from mopidy import audio
from mopidy.audio.constants import PlaybackState
from mopidy.internal import path
... | dbrgn/mopidy | tests/audio/test_actor.py | Python | apache-2.0 | 19,047 |
"""
SleekXMPP: The Sleek XMPP Library
Copyright (C) 2012 Nathanael C. Fritz, Lance J.T. Stout
This file is part of SleekXMPP.
See the file LICENSE for copying permission.
"""
from sleekxmpp.xmlstream import ElementBase, ET
class UserGaming(ElementBase):
name = 'gaming'
namespace = 'urn:xmpp... | danielvdao/facebookMacBot | venv/lib/python2.7/site-packages/sleekxmpp/plugins/xep_0196/stanza.py | Python | mit | 536 |
from ..trezor.qt_generic import QtPlugin
from keepkey import KeepKeyPlugin
class Plugin(KeepKeyPlugin, QtPlugin):
icon_paired = ":icons/keepkey.png"
icon_unpaired = ":icons/keepkey_unpaired.png"
@classmethod
def pin_matrix_widget_class(self):
from keepkeylib.qt.pinmatrix import PinMatrixWidge... | pknight007/electrum-vtc | plugins/keepkey/vtc.py | Python | mit | 353 |
"""
This module deals with making images (np arrays). It provides drawing
methods that are difficult to do with the existing Python libraries.
"""
import numpy as np
def blit(im1, im2, pos=[0, 0], mask=None, ismask=False):
""" Blit an image over another.
Blits ``im1`` on ``im2`` as position ``pos=(x,y)``... | kerimlcr/ab2017-dpyo | ornek/moviepy/moviepy-0.2.2.12/moviepy/video/tools/drawing.py | Python | gpl-3.0 | 8,604 |
# -*- coding: utf-8 -*-
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3
from . import account_invoice
from . import purchase_expense_type
from . import purchase_cost_distribution
from . import purchase_order
from . import stock_picking
| rosenvladimirov/addons | purchase_landed_cost_bg/models/__init__.py | Python | agpl-3.0 | 247 |
# -*- coding: utf-8 -*-
try: # pragma: no cover
compat_basestring = basestring
except NameError:
compat_basestring = str
try:
compat_next = next
except NameError: # pragma: no cover
def compat_next(it):
return it.next()
| GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/classytags/compat.py | Python | agpl-3.0 | 248 |
# ***************************************************************************
# * Copyright (c) 2017 Markus Hovorka <m.hovorka@live.de> *
# * Copyright (c) 2018 Bernd Hahnebach <bernd@bimstatik.org> *
# * *
# * Th... | sanguinariojoe/FreeCAD | src/Mod/Fem/femtools/femutils.py | Python | lgpl-2.1 | 14,528 |
"""Check that the constants are on the right side of the comparisons"""
# pylint: disable=singleton-comparison, missing-docstring, too-few-public-methods
class MyClass(object):
def __init__(self):
self.attr = 1
def dummy_return(self):
return self.attr
def dummy_return():
return 2
def ba... | arju88nair/projectCulminate | venv/lib/python3.5/site-packages/pylint/test/functional/misplaced_comparison_constant.py | Python | apache-2.0 | 1,003 |
from unittest import TestCase
from .mixin.spider_cache import SpiderCacheMixin
class BasicSpiderTestCase(TestCase, SpiderCacheMixin):
def setUp(self):
SpiderCacheMixin.setUp(self)
def setup_cache(self, bot):
bot.setup_cache(backend='mysql', database='spider_test',
use... | alihalabyah/grab | test/spider_mysql_cache.py | Python | mit | 346 |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2010, 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 opt... | jmartinm/invenio | modules/miscutil/lib/plotextractor_converter.py | Python | gpl-2.0 | 8,021 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.utils.rename_field import rename_field
def execute():
frappe.reload_doc('projects', 'doctype', 'project')
if f... | Zlash65/erpnext | erpnext/patches/v11_0/renamed_from_to_fields_in_project.py | Python | gpl-3.0 | 461 |
#!/usr/bin/env python
import re, os, time, socket, sys, signal
import urlparse, SocketServer, urllib, BaseHTTPServer
from Crypto.Cipher import AES
from OpenSSL import SSL
import hmac, hashlib
from threading import Thread
isThereDatabaseSupport = False
try:
import MySQLdb
isThereDatabaseSupport = True
except ImportEr... | lizaifang/yubico-yubiserve | yubiserve.py | Python | gpl-3.0 | 18,768 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# CRM phone module for Odoo/OpenERP
# Copyright (c) 2012-2014 Akretion (http://www.akretion.com)
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
#
# This program is free software: you can re... | cgstudiomap/cgstudiomap | main/parts/connector-telephony/crm_phone/crm_phone.py | Python | agpl-3.0 | 4,443 |
"""
API for initiating and tracking requests for credit from a provider.
"""
import datetime
import logging
import pytz
import uuid
from django.db import transaction
from lms.djangoapps.django_comment_client.utils import JsonResponse
from openedx.core.djangoapps.credit.exceptions import (
UserIsNotEligible,
... | rismalrv/edx-platform | openedx/core/djangoapps/credit/api/provider.py | Python | agpl-3.0 | 15,435 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | phenoxim/nova | nova/objects/bandwidth_usage.py | Python | apache-2.0 | 3,995 |
#!/usr/bin/env python
"""Test for the ee.number module."""
import unittest
import ee
from ee import apitestcase
class NumberTest(apitestcase.ApiTestCase):
def testNumber(self):
"""Verifies basic behavior of ee.Number."""
num = ee.Number(1)
self.assertEquals(1, num.encode())
computed = ee.Numbe... | mortcanty/earthengine | src/ee/tests/number_test.py | Python | mit | 905 |
#!/usr/bin/env python
# coding: utf-8
# Author: "Chris Ward" <cward@redhat.com>
'''
Mr.Bob Hooks
src: http://mrbob.readthedocs.org/en/latest/api.html#module-mrbob.hooks
'''
def pre_render(configurator):
pass
def post_render(configurator):
# remove unnecessary __init__.py, hooks.py
pass
def pre_ask_q... | tvieira/did | examples/mr.bob/hooks.py | Python | gpl-2.0 | 706 |
#!/usr/bin/env python
import sys
str = sys.stdin.read().decode('utf-8')
characters = set(str)
for c in characters:
print c.encode('utf-8')
# EOF #
| Lily-Ayta/aosc-os-abbs | extra-games/pingus/autobuild/overrides/usr/share/pingus/images/fonts/buildset.py | Python | gpl-2.0 | 155 |
# Author: Leonardo Pistone
# Copyright 2015 Camptocamp SA
#
# This program 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 option) any la... | brain-tec/stock-logistics-workflow | stock_dropshipping_dual_invoice/tests/test_need_two_invoices.py | Python | agpl-3.0 | 4,106 |
from django.conf.urls import include, url
from tastypie.api import Api
from .resources import NoteResource, UserResource
api = Api()
api.register(NoteResource())
api.register(UserResource())
urlpatterns = [
url(r'^api/', include(api.urls)),
]
| Perkville/django-tastypie | tests/profilingtests/urls.py | Python | bsd-3-clause | 252 |
# -*- coding: utf-8 -*-
import unittest
import six
from six.moves.urllib.parse import urlparse
from scrapy.spiders import Spider
from scrapy.utils.url import (url_is_from_any_domain, url_is_from_spider,
add_http_if_no_scheme, guess_scheme,
parse_url, strip_u... | rolando-contrib/scrapy | tests/test_utils_url.py | Python | bsd-3-clause | 19,716 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'PortfolioEntry.receive_maintainer_updates'
db.add_column('profile_portfolioentry', 're... | jledbetter/openhatch | mysite/profile/migrations/0088_add_field_portfolioentry_receive_maintainer_updates.py | Python | agpl-3.0 | 17,027 |
"""
Tests for the badges API views.
"""
from ddt import ddt, data, unpack
from django.conf import settings
from django.test.utils import override_settings
from nose.plugins.attrib import attr
from badges.tests.factories import BadgeAssertionFactory, BadgeClassFactory, RandomBadgeClassFactory
from openedx.core.lib.api.... | louyihua/edx-platform | lms/djangoapps/badges/api/tests.py | Python | agpl-3.0 | 9,405 |
"""
This module contains several handy functions primarily meant for internal use.
"""
from datetime import date, datetime, timedelta
from time import mktime
import re
import sys
from types import MethodType
__all__ = ('asint', 'asbool', 'convert_to_datetime', 'timedelta_seconds',
'time_difference', 'datet... | ecdpalma/napscheduler | napscheduler/util.py | Python | mit | 6,708 |
# -*- coding: utf-8 -*-
# <Lettuce - Behaviour Driven Development for python>
# Copyright (C) <2010-2012> Gabriel Falcão <gabriel@nacaolivre.org>
#
# 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 Foundatio... | yangming85/lettuce | tests/integration/test_bamboo.py | Python | gpl-3.0 | 2,162 |
#!/usr/bin/env python
import os
import sys
PREFIX_DELIMITER = '_'
def enumerate_symbols(symbols_folder_path):
symbols = []
for filename in os.listdir(symbols_folder_path):
parts = os.path.splitext(filename)
if parts[1] == ".svg":
symbols.append(parts[0])
return symbols
def ... | rokuz/omim | tools/python/generate_local_ads_symbols.py | Python | apache-2.0 | 1,823 |
# -*- coding: utf-8 -*-
#
# Copyright 2012-2015 Spotify AB
#
# 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... | percyfal/luigi | test/dynamic_import_test.py | Python | apache-2.0 | 1,810 |
from django.utils.encoding import force_text
# Levels
DEBUG = 10
INFO = 20
WARNING = 30
ERROR = 40
CRITICAL = 50
class CheckMessage:
def __init__(self, level, msg, hint=None, obj=None, id=None):
assert isinstance(level, int), "The first argument should be level."
self.level = level
self.... | auready/django | django/core/checks/messages.py | Python | bsd-3-clause | 2,214 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import io
import struct
import warnings
from psd_tools.utils import unpack, read_fmt, read_unicode_string
def single_value(fmt):
def decoder(data):
return unpack(fmt, data)[0]
return decoder
def unicode_string(data):
return read_unicod... | vgatto/psd-tools | src/psd_tools/decoder/decoders.py | Python | mit | 783 |
# -*- coding: utf-8 -*-
#
# Sphinx RTD theme demo documentation build configuration file, created by
# sphinx-quickstart on Sun Nov 3 11:56:36 2013.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated... | groovey/Documentation | sphinx/demo_docs/source/conf.py | Python | mit | 8,213 |
"""TestSuite"""
import sys
from . import case
from . import util
__unittest = True
def _call_if_exists(parent, attr):
func = getattr(parent, attr, lambda: None)
func()
class BaseTestSuite(object):
"""A simple test suite that doesn't provide class or module shared fixtures.
"""
_cleanup = True... | Microvellum/Fluid-Designer | win64-vc/2.78/python/lib/unittest/suite.py | Python | gpl-3.0 | 10,478 |
# test_run.py -- Tests for selftest.run
# Copyright (C) 2012 Jelmer Vernooij <jelmer@samba.org>
#
# 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 3
# of the License or (at your option) a... | kamenim/samba | selftest/tests/test_run.py | Python | gpl-3.0 | 5,985 |
# -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2016 OSGeo
#
# 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 ... | PixelDragon/pixeldragon2 | pixeldragon2/layers/translation.py | Python | gpl-3.0 | 1,232 |
#
# django-atompub by James Tauber <http://jtauber.com/>
# http://code.google.com/p/django-atompub/
# An implementation of the Atom format and protocol for Django
#
# For instructions on how to use this module to generate Atom feeds,
# see http://code.google.com/p/django-atompub/wiki/UserGuide
#
#
# Copyright (c) 2... | hzlf/openbroadcast | website/_notification/atomformat.py | Python | gpl-3.0 | 22,948 |
# -*- coding: utf-8 -*-
from django.db import migrations
def set_collection_path_collation(apps, schema_editor):
"""
Treebeard's path comparison logic can fail on certain locales such as sk_SK, which
sort numbers after letters. To avoid this, we explicitly set the collation for the
'path' column to th... | kaedroho/wagtail | wagtail/core/migrations/0027_fix_collection_path_collation.py | Python | bsd-3-clause | 906 |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
from pylab import plot, figure, ion, Line2D, draw, arange
from pybrain.rl.environments.renderer import Renderer
import threading
import time
class SimpleRenderer(Renderer):
def __init__(self):
Renderer.__init__(self)
self.dataLock = threading... | RatulGhosh/pybrain | pybrain/rl/environments/simple/renderer.py | Python | bsd-3-clause | 2,133 |
#
# Copyright 2015 Peter Sprygada <psprygada@ansible.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) any... | alexlo03/ansible | lib/ansible/plugins/action/nxos_config.py | Python | gpl-3.0 | 4,248 |
#!/usr/bin/env python3
# Copyright (C) 2018 Freie Universität Berlin
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
import base64
import os
import re
import socket
import sys
import subprocess
im... | x3ro/RIOT | tests/gnrc_sock_dns/tests/01-run.py | Python | lgpl-2.1 | 12,071 |
#!/usr/bin/python
import os, sys, shutil, collections
from optparse import OptionParser
# Fix for python 2
try:
input = raw_input
except NameError:
pass
def find_recursive(root, subpath, maxdepth=4):
queue = collections.deque([(root, 0)])
if 'PATH' in os.environ:
envpath = os.environ['PATH'].split(':')
... | rokuz/omim | tools/android/set_up_android.py | Python | apache-2.0 | 3,533 |
# Copyright (C) 2014 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 ... | weolar/miniblink49 | third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/browser_test_driver.py | Python | apache-2.0 | 4,526 |
"""
# Relative Path Markdown Extension
During the MkDocs build we rewrite URLs that link to local
Markdown or media files. Using the following pages configuration
we can look at how the output is changed.
pages:
- ['index.md']
- ['tutorial/install.md']
- ['tutorial/intro.md']
## Markdown URLs
When l... | ramramps/mkdocs | mkdocs/relative_path_ext.py | Python | bsd-2-clause | 4,804 |
#!/usr/bin/env python
'''
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id: $'
import gzip
import cPickle as marshal
import optparse
import os
import sys
import xml.sax
def parse_type(type_string):
'''Get a tuple of the type components for a SWIG-formatted type.
For example, given the type "p.f(p.... | sangh/LaserShow | pyglet-hg/experimental/swigtypes/parse.py | Python | bsd-3-clause | 12,636 |
# Graph functions used by KCC intersite
#
# Copyright (C) Dave Craft 2011
# Copyright (C) Andrew Bartlett 2015
#
# Andrew Bartlett's alleged work performed by his underlings Douglas
# Bagnall and Garming Sam.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Genera... | urisimchoni/samba | python/samba/kcc/graph.py | Python | gpl-3.0 | 27,975 |
# Copyright 2012 James McCauley
#
# This file is part of POX.
#
# POX 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.
#
# POX is distri... | 0xdyu/RouteFlow-Exodus | pox/pox/lib/graph/nom.py | Python | apache-2.0 | 4,353 |
# mysql/mysqlconnector.py
# Copyright (C) 2005-2016 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""
.. dialect:: mysql+mysqlconnector
:name: MySQL Connector/Python
... | Microvellum/Fluid-Designer | win64-vc/2.78/python/lib/site-packages/sqlalchemy/dialects/mysql/mysqlconnector.py | Python | gpl-3.0 | 5,323 |
#
# Module for starting a process object using os.fork() or CreateProcess()
#
# multiprocessing/forking.py
#
# Copyright (c) 2006-2008, R Oudkerk
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
... | teeple/pns_server | work/install/Python-2.7.4/Lib/multiprocessing/forking.py | Python | gpl-2.0 | 16,314 |
# -*- coding: utf-8 -*-
"""
test_rfc7838
~~~~~~~~~~~~
Test the RFC 7838 ALTSVC support.
"""
import pytest
import h2.config
import h2.connection
import h2.events
import h2.exceptions
class TestRFC7838Client(object):
"""
Tests that the client supports receiving the RFC 7838 AltSvc frame.
"""
example_r... | UK992/servo | tests/wpt/web-platform-tests/tools/third_party/h2/test/test_rfc7838.py | Python | mpl-2.0 | 15,036 |
# Copyright 2013-2014 MongoDB, 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 writin... | TPopovich/mongo-connector | tests/test_util.py | Python | apache-2.0 | 1,776 |
from openerp import tools
from openerp.osv import fields, osv
from openerp.tools.translate import _
class wizard_valuation_history(osv.osv_memory):
_name = 'wizard.valuation.history'
_description = 'Wizard that opens the stock valuation history table'
_columns = {
'choose_date': fields.boolean('C... | mycodeday/crm-platform | stock_account/wizard/stock_valuation_history.py | Python | gpl-3.0 | 8,050 |
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Presubmit script for rappor.xml.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more details on the presubmit API built ... | guorendong/iridium-browser-ubuntu | tools/metrics/rappor/PRESUBMIT.py | Python | bsd-3-clause | 1,156 |
#!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
AUTHOR = 'KMOL'
SITENAME = '2016Fall 課程網誌 (虎尾科大MDE)'
# 不要用文章所在目錄作為類別
USE_FOLDER_AS_CATEGORY = False
#PATH = 'content'
#OUTPUT_PATH = 'output'
TIMEZONE = 'Asia/Taipei'
DEFAULT_LANG = 'en'
# Feed generation is usually not desire... | 40423217/2016fallcadp_hw | pelicanconf.py | Python | agpl-3.0 | 1,944 |
#!/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.
"""Sets environment variables needed to run a chromium unit test."""
import os
import stat
import subprocess
import sys
# This is... | Teamxrtc/webrtc-streaming-node | third_party/webrtc/src/chromium/src/testing/test_env.py | Python | mit | 8,248 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2012, Boyd Adamson <boyd () boydadamson.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 th... | mattbernst/polyhartree | support/ansible/modules/extras/packaging/os/svr4pkg.py | Python | gpl-3.0 | 7,426 |
"""
XX. Generating HTML forms from models
This is mostly just a reworking of the ``form_for_model``/``form_for_instance``
tests to use ``ModelForm``. As such, the text may not make sense in all cases,
and the examples are probably a poor fit for the ``ModelForm`` syntax. In other
words, most of these tests should be r... | vv1133/home_web | tests/model_forms/models.py | Python | bsd-3-clause | 9,471 |
# Module 'ntpath' -- common operations on WinNT/Win95 pathnames
"""Common pathname manipulations, WindowsNT/95 version.
Instead of importing this module directly, import os and refer to this
module as os.path.
"""
import os
import sys
import stat
import genericpath
import warnings
from genericpath impor... | ktan2020/legacy-automation | win/Lib/ntpath.py | Python | mit | 18,605 |
# 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.
"""Parses options for the instrumentation tests."""
import os
# TODO(gkanwar): Some downstream scripts current rely on these functions
# existing. Thi... | hugegreenbug/libgestures | include/build/android/pylib/utils/test_options_parser.py | Python | bsd-3-clause | 3,471 |
"""
=========================================================
Comparing different clustering algorithms on toy datasets
=========================================================
This example aims at showing characteristics of different
clustering algorithms on datasets that are "interesting"
but still in 2D. The last ... | RPGOne/Skynet | scikit-learn-0.18.1/examples/cluster/plot_cluster_comparison.py | Python | bsd-3-clause | 4,681 |
import sys
py3k = sys.version_info >= (3, 0)
try:
import threading
except ImportError:
import dummy_threading as threading
| YosaiProject/yosai_dpcache | yosai_dpcache/dogpile/core/util.py | Python | apache-2.0 | 133 |
from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver
import libcloud.security
# This assumes you don't have SSL set up.
# Note: Code like this poses a security risk (MITM attack) and
# that's the reason why you should never use it for anything else
# besides testing. You have ... | dcorbacho/libcloud | docs/examples/compute/openstack/force_base_url.py | Python | apache-2.0 | 680 |
#!/usr/bin/env python
# Copyright 2014 the V8 project 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 unittest
from pool import Pool
def Run(x):
if x == 10:
raise Exception("Expected exception triggered by test.")
retu... | CTSRD-SOAAP/chromium-42.0.2311.135 | v8/tools/testrunner/local/pool_unittest.py | Python | bsd-3-clause | 1,222 |
# Copyright (c) 2008-2009 Aryeh Leib Taurog, http://www.aryehleib.com
# All rights reserved.
#
# Modified from original contribution by Aryeh Leib Taurog, which was
# released under the New BSD license.
import unittest
from django.contrib.gis.geos.mutable_list import ListMixin
class UserListA(ListMixin):
_mytyp... | wkschwartz/django | tests/gis_tests/geos_tests/test_mutable_list.py | Python | bsd-3-clause | 14,848 |
"""
Views related to course groups functionality.
"""
from django.views.decorators.csrf import ensure_csrf_cookie
from django.views.decorators.http import require_POST
from django.contrib.auth.models import User
from django.core.paginator import Paginator, EmptyPage
from django.core.urlresolvers import reverse
from dj... | ahmadiga/min_edx | openedx/core/djangoapps/course_groups/views.py | Python | agpl-3.0 | 19,178 |
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
import pybindgen.settings
import warnings
class ErrorHandler(pybindgen.settings.ErrorHandler):
def handle_error(self, wrapper, exception, traceback_):
warnings.warn("exception %r in wrapper %s" % (exception, wrapper))
... | JBonsink/GSOC-2013 | tools/ns-allinone-3.14.1/ns-3.14.1/src/config-store/bindings/modulegen__gcc_LP64.py | Python | gpl-3.0 | 54,535 |
from __future__ import print_function
def handler(event, context):
print(event)
return True
| aperigault/ansible | test/integration/targets/sns_topic/files/sns_topic_lambda/sns_topic_lambda.py | Python | gpl-3.0 | 102 |
# 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... | npuichigo/ttsflow | third_party/tensorflow/tensorflow/python/kernel_tests/softplus_op_test.py | Python | apache-2.0 | 4,807 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-TODAY OpenERP S.A. <http://www.openerp.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms o... | fossoult/odoo | openerp/addons/base/ir/ir_sequence.py | Python | agpl-3.0 | 14,812 |
#
# 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... | fharenheit/template-spark-app | src/main/python/mllib/ranking_metrics_example.py | Python | apache-2.0 | 2,197 |
# (c) 2012-2014, Chris Meyers <chris.meyers.fsu@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... | nrwahl2/ansible | test/units/plugins/callback/test_callback.py | Python | gpl-3.0 | 11,491 |
# $Id: cs.py 7119 2011-09-02 13:00:23Z milde $
# Author: Marek Blaha <mb@dat.cz>
# Copyright: This module has been placed in the public domain.
# New language mappings are welcome. Before doing a new translation, please
# read <http://docutils.sf.net/docs/howto/i18n.html>. Two files must be
# translated for each lan... | JulienMcJay/eclock | windows/Python27/Lib/site-packages/docutils/parsers/rst/languages/cs.py | Python | gpl-2.0 | 4,857 |
# 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... | npuichigo/ttsflow | third_party/tensorflow/tensorflow/python/kernel_tests/string_to_hash_bucket_op_test.py | Python | apache-2.0 | 4,034 |
NOT_NULL = 1
PRI_KEY = 2
UNIQUE_KEY = 4
MULTIPLE_KEY = 8
BLOB = 16
UNSIGNED = 32
ZEROFILL = 64
BINARY = 128
ENUM = 256
AUTO_INCREMENT = 512
TIMESTAMP = 1024
SET = 2048
PART_KEY = 16384
GROUP = 32767
UNIQUE = 65536
| zwChan/VATEC | ~/eb-virt/Lib/site-packages/pymysql/constants/FLAG.py | Python | apache-2.0 | 214 |
DEBUG = False
USERNAME = 'hikaru'
CHANNEL = 'random'
VOCAB = {
'RANDOM': ['random', ':troll:', ':trollface:'],
'PASS': ['pass', 'skip'],
'RESIGN': ['resign', 'give up'],
'VOTE': ['vote', 'move', 'play'],
'VOTES': ['votes', 'moves', 'voted', 'chance'],
'CAPTURES': ['captures'],
'SHOW': ['s... | shobute/go-slack | config.py | Python | isc | 1,009 |
# -*- coding: utf-8 -*-
'''
Created on 23 de feb. de 2016
@author: david
'''
class SensorState(object):
'''
Sensor's state
'''
def __init__(self):
'''
Constructor
'''
self.accels = [0.0]*3
self.angleSpeeds = [0.0]*3
self.angles = [0.0]*3
| dpm76/eaglebone | drone/flight/stabilization/state.py | Python | isc | 315 |
#!/usr/bin/env python
import click
import json
import re
from icinga2_api.api import Api
from icinga2_api import defaults
VALID_ACTIONS = ['create', 'read', 'update', 'delete']
def validate_uri(ctx, param, value):
if not value.startswith('/'):
raise click.BadParameter('should begin with single /')
return va... | saurabh-hirani/icinga2_api | icinga2_api/cmdline.py | Python | isc | 3,123 |
default_app_config = "oscarapicheckout.apps.Config"
| thelabnyc/django-oscar-api-checkout | src/oscarapicheckout/__init__.py | Python | isc | 52 |
# -*- coding: utf-8 -*-
"""
=====================================
Harmonic-percussive source separation
=====================================
This notebook illustrates how to separate an audio signal into
its harmonic and percussive components.
We'll compare the original median-filtering based approach of
`Fitzgerald... | librosa/librosa | docs/examples/plot_hprss.py | Python | isc | 6,271 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2018-2022 F4PGA Authors
#
# 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
#
# Unl... | SymbiFlow/fpga-tool-perf | utils/utils.py | Python | isc | 5,117 |
#!/usr/bin/env python
from . import dentist
from .watchers import LogNotify, Notifier, Poller
import logging
import os
import sys
def parse():
from optparse import OptionParser
parser = OptionParser()
parser.add_option('-d', '--daemonize', dest='daemonize',
action='store_true', defa... | easies/dentist | dentist/main.py | Python | mit | 2,740 |
import sys
sys.dont_write_bytecode = True
from traceback import format_exc as formatted_exception, extract_stack
from inspect import currentframe as inspect_currentframe, getmembers as inspect_getmembers
from os.path import split as path_split, exists as path_exists
from copy import deepcopy
get_globals = globals
ge... | Sw4T/Warband-Development | mb_warband_module_system_1166/Module_system 1.166/compiler.py | Python | mit | 91,472 |
# This file is autogenerated. Do not edit it manually.
# If you want change the content of this file, edit
#
# spec/fixtures/responses/whois.fi/property_status_graceperiod
#
# and regenerate the tests with the following script
#
# $ scripts/generate_tests.py
#
from nose.tools import *
from dateutil.parser import ... | huyphan/pyyawhois | test/record/parser/test_response_whois_fi_property_status_graceperiod.py | Python | mit | 3,795 |
from module1 import Module1
from module2 import Module2
import subpackage
| patrickwolf/python-tutorial | pyintro_b_modules/y_packages_self_contained/package_self_contained/__init__.py | Python | mit | 74 |
from lttngc import __version__
from lttngc import utils
from PyQt4 import Qt
import os.path
class QLttngcAboutDialog(utils.QCommonDialog, utils.QtUiLoad):
_UI_NAME = 'about'
def __init__(self):
super().__init__()
self._setup_ui()
def _set_version(self):
self.version_label.setText... | eepp/lttngc | lttngc/about_dialog.py | Python | mit | 763 |
import _plotly_utils.basevalidators
class TextfontValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(self, plotly_name="textfont", parent_name="funnelarea", **kwargs):
super(TextfontValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/python-api | packages/python/plotly/plotly/validators/funnelarea/_textfont.py | Python | mit | 1,867 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting field 'Podcast.clean'
db.delete_column('podcast_podcast', 'clean')
# Adding field 'Podca... | stickwithjosh/hypodrical | apps/podcast/migrations/0006_auto__del_field_podcast_clean__add_field_podcast_explicit__del_field_e.py | Python | mit | 5,558 |
#!/usr/bin/env python
import rospy
import cv2
from sensor_msgs.msg import Image
from cv_bridge import CvBridge
class image_publisher:
def __init__(self):
self.bridge = CvBridge()
self.image_pub = rospy.Publisher('/image', Image, latch=True)
def publish(self, filename):
cv_image = cv2... | LCAS/teaching | cmp3103m-code-fragments/scripts/image_publisher.py | Python | mit | 532 |
from i3pystatus import IntervalModule, formatp
import datetime
import math
import decimal
import os
from i3pystatus.core.util import TimeWrapper
dec = decimal.Decimal
class MoonPhase(IntervalModule):
"""
Available Formatters
status: Allows for mapping of current moon phase
- New Moon:
- Waxin... | onkelpit/i3pystatus | i3pystatus/moon.py | Python | mit | 2,598 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.