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 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.
from telemetry.core.backends.chrome import timeline_recorder
from telemetry.timeline import inspector_timeline_data
class TabBackendException(Exception):
... | TeamEOS/external_chromium_org | tools/telemetry/telemetry/core/backends/chrome/inspector_timeline.py | Python | bsd-3-clause | 3,318 |
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""Test cases for bounce message generation
"""
from twisted.trial import unittest
from twisted.mail import bounce
import cStringIO
import email.message
import email.parser
class BounceTests(unittest.TestCase):
"""
testcases for bounce ... | EricMuller/mynotes-backend | requirements/twisted/Twisted-17.1.0/src/twisted/mail/test/test_bounce.py | Python | mit | 1,029 |
import urllib
from askbot.deps.django_authopenid.util import OAuthConnection
class Twitter(OAuthConnection):
def __init__(self):
super(Twitter, self).__init__('twitter')
self.tweet_url = 'https://api.twitter.com/1.1/statuses/update.json'
def tweet(self, text, access_token=None):
client... | PearsonIOKI/compose-forum | askbot/utils/twitter.py | Python | gpl-3.0 | 479 |
from django.db import models
# Django doesn't support big auto fields out of the box, see
# https://code.djangoproject.com/ticket/14286.
# This is a stripped down version of the BoundedBigAutoField from Sentry.
class BigAutoField(models.AutoField):
description = "Big Integer"
def db_type(self, connection):
... | adusca/treeherder | treeherder/model/fields.py | Python | mpl-2.0 | 1,086 |
"""Support for sending data to Emoncms."""
import logging
from datetime import timedelta
import requests
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.const import (
CONF_API_KEY, CONF_WHITELIST, CONF_URL, STATE_UNKNOWN, STATE_UNAVAILABLE,
CONF_SCAN_INTERVAL)... | MartinHjelmare/home-assistant | homeassistant/components/emoncms_history/__init__.py | Python | apache-2.0 | 2,839 |
#
# 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
# ... | dims/neutron | neutron/db/migration/alembic_migrations/versions/mitaka/expand/32e5974ada25_add_neutron_resources_table.py | Python | apache-2.0 | 1,390 |
"""
Boolean geometry difference of solids.
"""
from __future__ import absolute_import
#Init has to be imported first because it has code to workaround the python bug where relative imports don't work if the module is imported as a main module.
import __init__
from fabmetheus_utilities.geometry.geometry_utilities im... | dob71/x2swn | skeinforge/fabmetheus_utilities/geometry/solids/difference.py | Python | gpl-3.0 | 1,517 |
# ***************************************************************************
# * Copyright (c) 2017 Markus Hovorka <m.hovorka@live.de> *
# * Copyright (c) 2020 Bernd Hahnebach <bernd@bimstatik.org> *
# * *
# * Th... | sanguinariojoe/FreeCAD | src/Mod/Fem/femobjects/constraint_electrostaticpotential.py | Python | lgpl-2.1 | 4,421 |
try:
import os, gettext
locale_dir = os.path.split(__file__)[0]
gettext.install('4Suite', locale_dir)
except (ImportError,AttributeError,IOError):
def _(msg):
return msg
SYNTAX_ERR_MSG = _("Error parsing expression:\n'%s'\nSyntax error at or near '%s' Line: %d")
INTERNAL_ERR_MSG = _("Error pars... | selfcommit/gaedav | pyxml/xpath/XPathParserBase.py | Python | lgpl-2.1 | 2,924 |
##########################################################################
#
# Copyright (c) 2008, Image Engine Design 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:
#
# * Redistribu... | lento/cortex | test/IECoreMaya/PluginLoadUnload.py | Python | bsd-3-clause | 2,870 |
import json
import traceback
from couchpotato.core._base.downloader.main import DownloaderBase
from couchpotato.core.helpers.encoding import isInt
from couchpotato.core.helpers.variable import cleanHost
from couchpotato.core.logger import CPLog
import requests
log = CPLog(__name__)
autoload = 'Synology'
class Syn... | loulich/Couchpotato | couchpotato/core/downloaders/synology.py | Python | gpl-3.0 | 10,004 |
# 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... | nburn42/tensorflow | tensorflow/contrib/autograph/pyct/parser_test.py | Python | apache-2.0 | 1,514 |
#!/usr/bin/env python3
import subprocess as sp
def main(args):
with open(args.disk, 'rb') as f:
f.seek(args.block * args.block_size)
block = (f.read(args.block_size)
.ljust(args.block_size, b'\xff'))
# what did you expect?
print("%-8s %-s" % ('off', 'data'))
return sp.run... | adfernandes/mbed | storage/filesystem/littlefsv2/littlefs/scripts/readblock.py | Python | apache-2.0 | 858 |
#
# Copyright 2015 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | catapult-project/catapult-csm | third_party/google-endpoints/apitools/base/py/testing/testclient/fusiontables_v1_messages.py | Python | bsd-3-clause | 4,998 |
from crits.vocabulary.vocab import vocab
class RelationshipTypes(vocab):
"""
Vocabulary for Relationship Types.
"""
COMPRESSED_FROM = "Compressed From"
COMPRESSED_INTO = "Compressed Into"
CONNECTED_FROM = "Connected From"
CONNECTED_TO = "Connected To"
CONTAINS = "Contains"
CONTA... | ckane/crits | crits/vocabulary/relationships.py | Python | mit | 4,362 |
# 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.
class RequestHeaders(object):
'''A custom dictionary impementation for headers which ignores the case
of requests, since different HTTP libraries seem t... | 7kbird/chrome | chrome/common/extensions/docs/server2/servlet.py | Python | bsd-3-clause | 4,151 |
from cStringIO import StringIO
import unittest
import unittest2
from unittest2.test.support import resultFactory
class TestUnittest(unittest2.TestCase):
def assertIsSubclass(self, actual, klass):
self.assertTrue(issubclass(actual, klass), "Not a subclass.")
def testInheritance(self):
self.... | endlessm/chromium-browser | third_party/llvm/lldb/third_party/Python/module/unittest2/unittest2/test/test_new_tests.py | Python | bsd-3-clause | 1,677 |
# Copyright 2013 The Servo Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution.
#
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
#... | chotchki/servo | python/licenseck.py | Python | mpl-2.0 | 1,985 |
# Authors: Gilles Louppe, Mathieu Blondel, Maheshakya Wijewardena
# License: BSD 3 clause
import numpy as np
from .base import SelectorMixin
from ..base import BaseEstimator, clone
from ..externals import six
from ..exceptions import NotFittedError
from ..utils.fixes import norm
def _get_feature_importances(estima... | pprett/scikit-learn | sklearn/feature_selection/from_model.py | Python | bsd-3-clause | 6,968 |
#!/usr/bin/env python
# -*- coding=utf-8 -*-
import sys
import re
import os
import argparse
import requests
from lxml import html as lxml_html
try:
import html
except ImportError:
import HTMLParser
html = HTMLParser.HTMLParser()
try:
import cPickle as pk
except ImportError:
import pickle as pk
c... | RadonX/iScript | leetcode_problems.py | Python | mit | 4,146 |
KEYIDS = {
"KEY_RESERVED": 0,
"KEY_ESC": 1,
"KEY_1": 2,
"KEY_2": 3,
"KEY_3": 4,
"KEY_4": 5,
"KEY_5": 6,
"KEY_6": 7,
"KEY_7": 8,
"KEY_8": 9,
"KEY_9": 10,
"KEY_0": 11,
"KEY_MINUS": 12,
"KEY_EQUAL": 13,
"KEY_BACKSPACE": 14,
"KEY_TAB": 15,
"KEY_Q": 16,
"KEY_W": 17,
"KEY_E": 18,
"KEY_R": 19,
"KEY_T": 20,
"KEY_Y": 21,
"KEY_U... | openhdf/enigma2-wetek | keyids.py | Python | gpl-2.0 | 5,381 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from .. import Provider as PhoneNumberProvider
class Provider(PhoneNumberProvider):
phonenumber_prefixes = [134, 135, 136, 137, 138, 139, 147, 150,
151, 152, 157, 158, 159, 182, 187, 188,
130, 1... | Nebucatnetzer/tamagotchi | pygame/lib/python3.4/site-packages/faker/providers/phone_number/zh_CN/__init__.py | Python | gpl-2.0 | 589 |
"""Test result object"""
import os
import sys
import traceback
from StringIO import StringIO
from . import util
from functools import wraps
__unittest = True
def failfast(method):
@wraps(method)
def inner(self, *args, **kw):
if getattr(self, 'failfast', False):
self.stop()
retur... | HiSPARC/station-software | user/python/Lib/unittest/result.py | Python | gpl-3.0 | 6,308 |
from django.utils import timezone
import pytest
from django_bulk_update.helper import bulk_update
from django.db.models import DateTimeField
from osf_tests.factories import UserFactory, PreprintFactory, NodeFactory
@pytest.mark.django_db
class TestGuidAutoInclude:
guid_factories = [
UserFactory,
... | erinspace/osf.io | osf_tests/test_guid_auto_include.py | Python | apache-2.0 | 7,146 |
# 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... | gunan/tensorflow | tensorflow/python/ops/quantized_ops_test.py | Python | apache-2.0 | 4,127 |
# 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.
from __future__ import division
from telemetry.core import _bitmap
def Channels(bitmap):
return bitmap.bpp
def Width(bitmap):
return bitmap.width
de... | guorendong/iridium-browser-ubuntu | tools/telemetry/telemetry/image_processing/image_util_bitmap_impl.py | Python | bsd-3-clause | 1,221 |
""" Django admin pages for student app """
from django import forms
from django.contrib.auth.models import User
from ratelimitbackend import admin
from xmodule.modulestore.django import modulestore
from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys import CourseKey
from config_models.admin import Config... | hamzehd/edx-platform | common/djangoapps/student/admin.py | Python | agpl-3.0 | 6,073 |
# (c) 2017 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = '''
callback: syslog_json
callback_type: notification
... | thaim/ansible | lib/ansible/plugins/callback/syslog_json.py | Python | mit | 3,681 |
# 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... | unnikrishnankgs/va | venv/lib/python3.5/site-packages/tensorflow/contrib/seq2seq/python/ops/decoder.py | Python | bsd-2-clause | 11,345 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
__author__="Josh Montague"
__license__="MIT License"
"""
This script is designed to run inline (%run 3d-example.py) in
the corresponding IPython notebook. It generates a 3d scatter
plot using scikit-learn data generation and with a number of
samples and clusters determi... | mhdella/Data-Science-45min-Intros | choosing-k-in-kmeans/3d-example.py | Python | unlicense | 2,925 |
# -*- coding: utf-8 -*-
"""
pygments.styles.default
~~~~~~~~~~~~~~~~~~~~~~~
The default highlighting style.
:copyright: 2007 by Tiberius Teng.
:copyright: 2006 by Georg Brandl.
:license: BSD, see LICENSE for more details.
"""
from pygments.style import Style
from pygments.token import Keyword... | alon/polinax | libs/external_libs/Pygments-0.11.1/pygments/styles/default.py | Python | gpl-2.0 | 2,543 |
#!/usr/bin/python
#coding: utf-8 -*-
# (c) 2013, David Stygstra <david.stygstra@gmail.com>
# Portions copyright @ 2015 VMware, 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
ANSIB... | e-gob/plataforma-kioscos-autoatencion | scripts/ansible-play/.venv/lib/python2.7/site-packages/ansible/modules/network/ovs/openvswitch_bridge.py | Python | bsd-3-clause | 8,968 |
#
# This file is part of pyasn1 software.
#
# Copyright (c) 2005-2019, Ilya Etingof <etingof@gmail.com>
# License: http://snmplabs.com/pyasn1/license.html
#
import time
from datetime import datetime
from sys import version_info
__all__ = ['strptime']
if version_info[:2] <= (2, 4):
def strptime(text, dateFormat)... | endlessm/chromium-browser | tools/swarming_client/third_party/pyasn1/pyasn1/compat/dateandtime.py | Python | bsd-3-clause | 482 |
# Hermite polynomials H_n(x) on the real line for n=0,1,2,3,4
f0 = lambda x: hermite(0,x)
f1 = lambda x: hermite(1,x)
f2 = lambda x: hermite(2,x)
f3 = lambda x: hermite(3,x)
f4 = lambda x: hermite(4,x)
plot([f0,f1,f2,f3,f4],[-2,2],[-25,25]) | pducks32/intergrala | python/sympy/doc/src/modules/mpmath/plots/hermite.py | Python | mit | 240 |
# Copyright (C) 2010-2014 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This progr... | ExploreEmbedded/Tit-Windows | tools/share/gdb/python/gdb/__init__.py | Python | bsd-3-clause | 3,494 |
for x in undefined(): # ty<caret>pe: int
pass | smmribeiro/intellij-community | python/testData/intentions/PyConvertTypeCommentToVariableAnnotationIntentionTest/simpleForLoop.py | Python | apache-2.0 | 50 |
from framework.routing import Rule, json_renderer
from addons.s3 import views
api_routes = {
'rules': [
Rule(
[
'/settings/s3/accounts/',
],
'post',
views.s3_add_user_account,
json_renderer,
),
Rule(
[... | mluo613/osf.io | addons/s3/routes.py | Python | apache-2.0 | 1,947 |
from django.test import TestCase
from readthedocs.builds.constants import LATEST
from readthedocs.projects.models import Project
from readthedocs.restapi.views.footer_views import get_version_compare_data
class VersionCompareTests(TestCase):
fixtures = ['eric.json', 'test_data.json']
def test_not_highest(se... | SteveViss/readthedocs.org | readthedocs/rtd_tests/tests/test_api_version_compare.py | Python | mit | 1,173 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
# Event
# -------------
from __future__ import unicode_literals
import frappe
@frappe.whitelist()
def get_cal_events(m_st, m_end):
# load owned events
res1 = frappe.db.sql("""select name from `tabEvent`
WHERE... | gangadharkadam/shfr | frappe/widgets/event.py | Python | mit | 1,523 |
from time import sleep
class TestPyTest:
def testOne(self):
sleep(1.5) # To check duration
assert 4 == 2*2
def testTwo(self):
assert True
def testThree():
assert 4 == 2*2
| paplorinc/intellij-community | python/testData/testRunner/env/pytest/test1.py | Python | apache-2.0 | 209 |
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))
... | mcgee/ns-3 | src/click/bindings/modulegen__gcc_LP64.py | Python | gpl-2.0 | 362,122 |
from flask import Blueprint
auth = Blueprint('auth', __name__)
from . import views | federicoviola/alpha | wsgi/app/auth/__init__.py | Python | mit | 84 |
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the... | Daniex/horizon | openstack_dashboard/api/base.py | Python | apache-2.0 | 12,076 |
from mod_pywebsocket import handshake
from mod_pywebsocket.handshake.hybi import compute_accept
def web_socket_do_extra_handshake(request):
message = 'HTTP/1.1 101 Switching Protocols\r\n'
message += 'Upgrade: websocket\r\n'
message += 'Connection: Upgrade\r\n'
message += 'Sec-WebSocket-Accept: %s\r\n... | axinging/chromium-crosswalk | third_party/WebKit/LayoutTests/http/tests/websocket/duplicated-headers_wsh.py | Python | bsd-3-clause | 754 |
#!/usr/bin/python
# (c) 2017, 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'],
... | hryamzik/ansible | lib/ansible/modules/storage/netapp/na_cdot_qtree.py | Python | gpl-3.0 | 6,978 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2015, Maciej Delmanowski <drybjed@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_version': '1.1... | alxgu/ansible | lib/ansible/modules/cloud/misc/virt_pool.py | Python | gpl-3.0 | 21,816 |
# <hr>Calculates the tangents and bitangents for the imported meshes.
#
# Does nothing if a mesh does not have normals. You might want this post
# processing step to be executed if you plan to use tangent space calculations
# such as normal mapping applied to the meshes. There's a config setting,
# <tt>#AI_CONFIG_P... | ivansoban/ILEngine | thirdparty/assimp/port/PyAssimp/pyassimp/postprocess.py | Python | mit | 23,509 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | inovtec-solutions/OpenERP | openerp/addons/account/report/account_journal.py | Python | agpl-3.0 | 9,777 |
# -*- coding: utf-8 -*-
"""
flask.testsuite.templating
~~~~~~~~~~~~~~~~~~~~~~~~~~
Template functionality
:copyright: (c) 2011 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import flask
import unittest
from flask.testsuite import FlaskTestCase
class TemplatingTestCase(Flask... | zwChan/VATEC | ~/eb-virt/Lib/site-packages/flask/testsuite/templating.py | Python | apache-2.0 | 11,237 |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
Name : DB Manager
Description : Database manager plugin for QGIS
Date : May 23, 2011
copyright : (C) 2011 by Giuseppe Sucameli
email : brush.tyler@... | uclaros/QGIS | python/plugins/db_manager/db_plugins/html_elems.py | Python | gpl-2.0 | 5,237 |
# -*- test-case-name: twisted.names.test.test_tap -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Domain Name Server
"""
import os, traceback
from twisted.python import usage
from twisted.names import dns
from twisted.application import internet, service
from twisted.names import ser... | skycucumber/Messaging-Gateway | webapp/venv/lib/python2.7/site-packages/twisted/names/tap.py | Python | gpl-2.0 | 4,832 |
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
int_or_none,
float_or_none,
unified_strdate,
)
class PornoVoisinesIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?pornovoisines\.com/videos/show/(?P<id>\d+)/(?P<display_id>[... | epitron/youtube-dl | youtube_dl/extractor/pornovoisines.py | Python | unlicense | 4,003 |
"""
DataSource is a wrapper for the OGR Data Source object, which provides
an interface for reading vector geometry data from many different file
formats (including ESRI shapefiles).
When instantiating a DataSource object, use the filename of a
GDAL-supported data source. For example, a SHP file or a
TIGER/Line... | ychen820/microblog | y/google-cloud-sdk/platform/google_appengine/lib/django-1.3/django/contrib/gis/gdal/datasource.py | Python | bsd-3-clause | 4,734 |
# 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... | npuichigo/ttsflow | third_party/tensorflow/tensorflow/python/kernel_tests/distributions/exponential_test.py | Python | apache-2.0 | 5,672 |
#!/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.
"""Generate java source files from protobuf files.
This is a helper file for the genproto_java action in protoc_java.gypi.
It per... | Teamxrtc/webrtc-streaming-node | third_party/webrtc/src/chromium/src/build/protoc_java.py | Python | mit | 2,330 |
# -*- coding: utf-8 -*-
"""
LucasArts Font parser.
Author: Cyril Zorin
Creation date: 1 January 2007
"""
from lib.hachoir_parser import Parser
from lib.hachoir_core.field import (FieldSet,
UInt8, UInt16, UInt32, GenericVector)
from lib.hachoir_core.endian import LITTLE_ENDIAN
class CharData(FieldSet):
def... | Branlala/docker-sickbeardfr | sickbeard/lib/hachoir_parser/game/laf.py | Python | mit | 2,900 |
#!/usr/bin/env python
#
# 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.
"""Gets and writes the configurations of the attached devices.
This configuration is used by later build steps to determine which de... | Teamxrtc/webrtc-streaming-node | third_party/webrtc/src/chromium/src/build/android/gyp/get_device_configuration.py | Python | mit | 2,134 |
"""Microsoft Internet Explorer cookie loading on Windows.
Copyright 2002-2003 Johnny Lee <typo_pl@hotmail.com> (MSIE Perl code)
Copyright 2002-2006 John J Lee <jjl@pobox.com> (The Python port)
This code is free software; you can redistribute it and/or modify it
under the terms of the BSD or ZPL 2.1 licenses (see the ... | openhatch/oh-mainline | vendor/packages/mechanize/mechanize/_msiecookiejar.py | Python | agpl-3.0 | 14,694 |
#!/usr/bin/env python
import subprocess
import re
import os
import errno
import collections
import sys
class Platform(object):
pass
sdk_re = re.compile(r'.*-sdk ([a-zA-Z0-9.]*)')
def sdkinfo(sdkname):
ret = {}
for line in subprocess.Popen(['xcodebuild', '-sdk', sdkname, '-version'], stdout=subprocess.PI... | teeple/pns_server | work/install/Python-2.7.4/Modules/_ctypes/libffi/generate-ios-source-and-headers.py | Python | gpl-2.0 | 5,303 |
# Copyright (C) 2013 eNovance SAS <licensing@enovance.com>
#
# Author: Sylvain Afchain <sylvain.afchain@enovance.com>
#
# 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.apach... | shakamunyi/neutron-vrrp | neutron/tests/unit/services/metering/drivers/__init__.py | Python | apache-2.0 | 665 |
from todoman import version # type: ignore
__version__ = version.version
__documentation__ = "https://todoman.rtfd.org/en/latest/"
| pimutils/todoman | todoman/__init__.py | Python | isc | 133 |
"""
Interface definition.
"""
from zope import interface
class IMailer(interface.Interface):
"""
An object that sends e-mail.
"""
def send(sender, recipient, content):
"""
Sends the content to the recipient as the sender.
"""
class ITemplate(interface.Interface):
"""
... | lvh/txeasymail | txeasymail/interface.py | Python | isc | 541 |
#
# (C)opyright 2015 Signal Processing Devices Sweden AB
#
# This script showcases in Python
# - How to connect to ADQ devices in Python
# - Upload of waveforms to the SDR14
# - Using a playlist on the SDR14
# - How to setup an acquisition of data
# - How to read data by GetData API in Python
# - How to plot data in Py... | thomasbarillot/DAQ | HHGMonitor/ADQAPI_python/SDR14_Playlist_example.py | Python | mit | 8,460 |
import unittest
import pytk.geo as geo
class GeoQuatTest(unittest.TestCase):
def test_shape(self):
self.assertRaises(geo.GeoException, geo.quat, [])
self.assertRaises(geo.GeoException, geo.quat, [0])
self.assertRaises(geo.GeoException, geo.quat, [0, 1])
self.assertRaises(geo.GeoE... | bigblindbais/pytk | tests/geo/test_quat.py | Python | mit | 10,747 |
class ParamsException(Exception):
"""Exception raised when tp, fmt and size values are wrongs"""
pass
class LineSizeException(Exception):
"""Exception raised when line size is bigger then specified"""
pass
class LineIdentifierException(Exception):
"""Exception raised when line indentifier rased ... | anderson89marques/PyFixedFlatFile | pyFixedFlatFile/exceptions.py | Python | mit | 476 |
import json
import numpy as np
import pandas as pd
import numbers
class NumpyAndPandasEncoder(json.JSONEncoder):
def default(self, obj):
if isinstance(obj, (np.ndarray, np.matrix)):
return [self.default(x) for x in obj]
if isinstance(obj, pd.DataFrame):
return [self.default... | PKU-Dragon-Team/Datalab-Utilities | __init__.py | Python | mit | 672 |
"""Contain common module fields."""
# pylint: disable=too-many-public-methods
from __future__ import absolute_import
import re
from django.db import models
from django.core.exceptions import ValidationError
class NameField(models.CharField):
"""Item name string field.
This field is limited to 64 characters ... | gregoil/rotest | src/rotest/common/django_utils/fields.py | Python | mit | 2,999 |
#!/usr/bin/env python
"""Convert 3 fastq inputs (read 1, read 2, UMI) into paired inputs with UMIs in read names
Usage:
bcbio_fastq_umi_prep.py single <out basename> <read 1 fastq> <read 2 fastq> <umi fastq>
or:
bcbio_fastq_umi_prep.py autopair [<list> <of> <fastq> <files>]
Creates two fastq files with embedded U... | brainstorm/bcbio-nextgen | scripts/bcbio_fastq_umi_prep.py | Python | mit | 4,259 |
#!/usr/bin/env python
import collections
def read_only(self, name, val):
raise ValueError('not supported')
class SimpleObject(object):
def __init__(self, a, b, c):
self.a = a
self.b = b
self.b = c
class SimpleObjectImmutable(object):
def __init__(self, a, b, c):
self.a =... | androm3da/struct_bench | types_.py | Python | mit | 505 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from glob import glob
from vlpp.utils import save_json
from vlpp.qamosaic import Mosaic
def main():
# Usefull directories
os.mkdir("data")
# Informations
participant_id = "${sub.sub}"
# Images Path
try: anat = glob("${sub.anat}")[0]
... | villeneuvelab/vlpp | pipelines/templates/qa_mosaics_T1w.py | Python | mit | 2,115 |
from typing import Any, Dict, Tuple, Union
__cached_defs: Dict[str, Any] = {}
def __getattr__(name: str) -> Any:
import importlib # noqa # isort:skip
if name in __cached_defs:
return __cached_defs[name]
if name == "JsonBase":
module = importlib.import_module(".json_base", "tomodachi.e... | kalaspuff/tomodachi | tomodachi/envelope/__init__.py | Python | mit | 1,527 |
"""
example with 'calls_expected' in addtoBatch used
"""
import batchOpenMPI
def f_mult(x) :
return x*2.0
f = batchOpenMPI.batchFunction(f_mult) #creating function wrapper
batchOpenMPI.begin_MPI_loop() # both the workers and the master process run the same code up until here
f.addtoBatch(4,calls_expected=4)
bat... | hamish2014/batchOpenMPI | examples/ex3.py | Python | mit | 719 |
# -*- coding: utf-8 -*-
# Copyright (c) 2015 Holger Nahrstaedt
# See COPYING for license details.
"""
wavelet toolbox
"""
from __future__ import division, print_function, absolute_import
from .dwt import *
from .utility import *
from ._pyyawt import *
from .dwt1d import *
from .dwt2d import *
from .dwt3d import *... | holgern/pyyawt | pyyawt/__init__.py | Python | mit | 565 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.db.models.deletion
import django.utils.timezone
from django.conf import settings
def siteconf_func(apps, schema_editor):
Site = apps.get_model('sites', 'Site')
db_alias = schema_editor.conne... | devunt/hydrocarbon | board/migrations/0001_squashed_0022_auto_20141229_2347.py | Python | mit | 10,743 |
#!/usr/bin/python
import sys
sys.path.append('..')
from bcert_pb2 import *
import binascii
# fill out a minimal bitcoin cert
cert = BitcoinCert()
# first the data part (the part is later signed by the "higher level cert" or "the blockchain")
cert.data.version = '0.1'
cert.data.subjectname = 'Foo Inc.'
email = cert.... | bcpki/bitcoin | src/bcert/examples/mk_foo1_static.py | Python | mit | 2,934 |
# -*- coding: utf-8 -*-
#
# sammy documentation build configuration file, created by
# sphinx-quickstart on Sun Feb 17 11:46:20 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 file.
#
# All c... | tyrog236/site-perso | docs/conf.py | Python | mit | 7,708 |
#!/usr/bin/env python
# encoding: utf-8
import argparse
import cmd
import os
import shlex
import sys
from tabulate import tabulate
import time
from talus_client.cmds import TalusCmdBase
import talus_client.api
import talus_client.errors as errors
from talus_client.models import Image,Field
class ImageCmd(TalusCmdBas... | optiv-labs/talus_client | talus_client/cmds/images.py | Python | mit | 11,313 |
"""Yummly data models.
"""
from inspect import getargspec
class Storage(dict):
"""An object that is like a dict except `obj.foo` can be used in addition
to `obj['foo']`.
Raises Attribute/Key errors for missing references.
>>> o = Storage(a=1, b=2)
>>> assert(o.a == o['a'])
>>> assert(o.b =... | dgilland/yummly.py | yummly/models.py | Python | mit | 8,795 |
# -*- coding: utf-8 -*-
import scrapy
import json
import re
from locations.items import GeojsonPointItem
class McDonalsILSpider(scrapy.Spider):
name = "mcdonalds_il"
allowed_domains = ["www.mcdonalds.co.il"]
start_urls = (
'https://www.mcdonalds.co.il/%D7%90%D7%99%D7%AA%D7%95%D7%A8_%D7%9E%D7%A1%D... | iandees/all-the-places | locations/spiders/mcdonalds_il.py | Python | mit | 3,804 |
class DinkyFish:
def monthsUntilCrowded(self, tankVolume, maleNum, femaleNum):
months = 0
while maleNum + femaleNum <= (tankVolume * 2):
minFishes = min(maleNum, femaleNum)
maleNum += minFishes
femaleNum += minFishes
months += 1
return ... | Oscarbralo/TopBlogCoder | SRMs/SRM180PY/250/250.py | Python | mit | 326 |
#!/usr/bin/env python
# coding=utf-8
from mcurl.utils import monkey_patch
import zmq.green as zmq
import sys
import json
__author__ = 'chenfengyuan'
monkey_patch.dummy()
def client(port):
host = '127.0.0.1'
context = zmq.Context()
socket = context.socket(zmq.REQ)
socket.connect("tcp://%s:%s" % (host... | chenfengyuan/mcurl | python3/get_info.py | Python | mit | 751 |
from os.path import expanduser
######################
# Common project files
######################
# These are files, packages, and folders that will be copied from the
# development folder to the destination obfuscated project.
######################
# Python packages to obfuscate.
obfuscated_packages = [
'con... | rdevost/pymixup | common/settings.py | Python | mit | 4,238 |
from django import template
register = template.Library()
@register.assignment_tag(takes_context=True)
def has_bookmark_permission(context, action):
"""Checks if the current user can bookmark the action item.
Returns a boolean.
Syntax::
{% has_bookmark_permission action %}
"""
request =... | HMSBeagle1831/rapidscience | rlp/bookmarks/templatetags/bookmarks.py | Python | mit | 990 |
# -*- coding: utf-8 -*-
import sys, time
from PySide import QtGui, QtCore
from presentacion.form_abm_paciente import FormPacienteABM
if __name__ == "__main__":
app = QtGui.QApplication(sys.argv)
# Create and display the splash screen
splash_pix = QtGui.QPixmap('splash.png')
splash = QtGui.QSplashS... | gabofer82/taller_programacion_2017 | Documentación/SOURCE/Programa/main.py | Python | mit | 1,181 |
#!/usr/bin/python3
from tkinter import *
from tkinter.messagebox import *
fenetre = Tk()
fenetre.title("The Enigma Machine")
fenetre.configure(background='white')
fenetre.geometry("550x800")
class AutoScrollbar(Scrollbar):
#create a 'responsive' scrollbar
def set(self, lo, hi):
if float(lo) <= 0.0 and ... | omnitrogen/enigma | gui/enigma-gui-resizable-window.py | Python | mit | 11,660 |
import pytest
from pillowtalk import *
# TODO: test when where returns [] or None or [None]
# TODO: test update() (or autoupdate?)
@pytest.fixture
def folder_json():
return {'count' : 59,
'created_at' ... | jvrana/Pillowtalk | tests/test_with_larger_examples/test_sequence_example/test_examples.py | Python | mit | 5,684 |
def topgeo ('topgeo'):
"""
Esta libreria funciona para realizar calculos topograficos.
"""
| Alan-Jairo/topgeo | doc.py | Python | mit | 103 |
__author__ = 'leif'
from game_models import HighScore, UserProfile
from ifind.common.utils import encode_string_to_url
from django.contrib.auth.models import User
from django.db.models import Max, Sum, Avg
# ranking based on highest total score (top x players)
# ranking of players based on level/xp
# top players in ... | leifos/pagefetch | pagefetch_project/pagefetch/game_leaderboards.py | Python | mit | 5,894 |
"""Generate year files with news counts
Usage:
filter_news.py <directory> <output> <lang>
Options:
-h, --help
"""
from docopt import docopt
from os import listdir
from os.path import isfile, join, getsize
import datetime
from tqdm import *
import pandas as pd
def find_index(id, lis):
for i in range(0, len(l... | geektoni/Influenza-Like-Illness-Predictor | data_analysis/filter_news.py | Python | mit | 2,317 |
# test-case-name: twisted.names.test.test_dns
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Tests for twisted.names.dns.
"""
from __future__ import division, absolute_import
from io import BytesIO
import struct
from zope.interface.verify import verifyClass
from twisted.python.failure... | whitehorse-io/encarnia | pyenv/lib/python2.7/site-packages/twisted/names/test/test_dns.py | Python | mit | 154,060 |
#-------------------------------------------------------------------------------
# Name: Heuristic_Coeff.py
# Purpose: Implements FIH algorithm found in "An Integer Linear Programming Scheme to Sanitize Sensitive Frequent Itemsets" by Kagklis et al.
# Author: Vasileios Kagklis
# Created: 20/03/2... | kagklis/Frequent-Itemset-Hiding-Toolbox-x86 | Heuristic_Coeff.py | Python | mit | 4,188 |
#!/usr/bin/env python
"""Exponential and Quaternion code for Lab 6.
Course: EE 106, Fall 2015
Author: Victor Shia, 9/24/15
This Python file is a code skeleton Lab 6 which calculates the rigid body transform
given a rotation / translation and computes the twist from rigid body transform.
When you think you have the me... | AravindK95/ee106b | project1/src/lab1/src/exp_quat_func.py | Python | mit | 7,708 |
from struct import pack
from sqlite3 import Binary
def pts(c):
return ["dd",[c.X,c.Y]]
def pt4mp(c):
return ["Bidd",[1,1,c.X,c.Y]]
def mp(coordinates):
partCount=coordinates.partCount
i=0
out = ["I",[0]]
while i<partCount:
pt = coordinates.getPart(i)
[ptrn,c]=pt4mp(pt... | calvinmetcalf/arcsqlite | wkb.py | Python | mit | 3,451 |
import os
from lib.base_plugin import BasePlugin
from lib.paths import SteamCloudPath, SteamGamesPath
class CogsPlugin(BasePlugin):
Name = "Cogs"
support_os = ["Windows"]
def backup(self, _):
_.add_folder('Data', os.path.join(SteamCloudPath, '26500'), 'remote')
def restore(self, _):
... | Pr0Ger/SGSB | plugins/Cogs.py | Python | mit | 526 |
# Config.py file for motion-track.py
# Display Settings
debug = True # Set to False for no data display
window_on = False # Set to True displays opencv windows (GUI desktop reqd)
diff_window_on = False # Show OpenCV image difference window
thresh_window_on = False # Show OpenCV image Threshold window
SHOW_C... | lustigerluke/motion-track | config.py | Python | mit | 1,176 |
import unittest
import doctest
import spiralx.fileproc
# -----------------------------------------------------------------------------
def load_tests(loader, tests, ignore):
fileprocTestSuite = unittest.TestSuite()
fileprocTestSuite.addTests(doctest.DocTestSuite(spiralx.fileproc))
return fileprocTestSui... | spiralx/mypy | mypy/spiralx/fileproc/__test.py | Python | mit | 358 |
"""
The MIT License (MIT)
Copyright (c) 2015 Robert Hodgen
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, modify, merge... | roberthodgen/thought-jot | src/api_v2.py | Python | mit | 37,593 |
import warnings
from apification.utils import Noninstantiable, NoninstantiableMeta
def test_noninstantiable():
e, o = None, None
try:
o = Noninstantiable()
except TypeError as e: pass
assert o is None
assert isinstance(e, TypeError)
def test_noninstantiable_keyword_self_check_invalid():... | Quantify-world/apification | src/apification/utils/tests/test_noninstantiable.py | Python | mit | 1,632 |
# Functions to download yesterday's races and associated raceforms from host
import configparser
import requests
import re
import sys
import time
import pymongo
import random
from datetime import datetime, timedelta
from hracing.db import parse_racesheet
from hracing.db import mongo_insert_race
from hracing.tools imp... | mzunhammer/hracing | hracing/scrape.py | Python | mit | 7,747 |
#!/usr/bin/env python
from algorithms.sorting.selection_sort import *
from __prototype__ import *
if __name__ == '__main__':
test_all(selection_sort) | pymber/algorithms | tests/run-test-sort-selection.py | Python | mit | 154 |