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 |
|---|---|---|---|---|---|
# coding: utf-8
from __future__ import division, unicode_literals
"""
This module defines the BorgQueen class, which manages drones to assimilate
data using Python's multiprocessing.
"""
__author__ = "Shyue Ping Ong"
__copyright__ = "Copyright 2012, The Materials Project"
__version__ = "1.0"
__maintainer__ = "Shyue... | Dioptas/pymatgen | pymatgen/apps/borg/queen.py | Python | mit | 5,010 |
class Node(object):
"""Node class"""
def __init__(self, data=None, next=None):
self.data = data
self.next = next
def get_data(self):
return self.data
def get_next(self):
return self.next
def add_next(self, new_next):
self.next = new_next
def print_list(... | chandps/Topcoder | sandbox/LinkedList.py | Python | mit | 1,015 |
import sys, os, yaml, glob
import subprocess
import argparse
def main(args):
workingDir = os.getcwd()
samples_data_dir = args.sample_data_dir
assemblies_data_dir = args.assemblies_data_dir
assemblers = sum(args.assemblers, [])
for sample_dir_name in [dir for dir in os.listdir(samples_data_d... | senthil10/NouGAT | utils/prepare_validation_config.py | Python | mit | 5,461 |
# Generated by Haxe 4.0.5
# coding: utf-8
import sys
class Main:
__slots__ = ()
@staticmethod
def main():
print("Hello World")
class python_internal_MethodClosure:
__slots__ = ("obj", "func")
def __init__(self,obj,func):
self.obj = obj
self.func = func
def __call_... | sebgod/linguist | test/fixtures/Generated/Haxe/main.py | Python | mit | 392 |
"""Descriptor - Provide useful descriptions for common file types.
Refer to https://mxr.mozilla.org/webtools-central/source/mxr/Local.pm#27
"""
from itertools import ifilter
import re
from os import listdir
from os.path import splitext, basename, join, isfile
import dxr.indexers
def is_readme(filename):
"""Retur... | pelmers/dxr | dxr/plugins/descriptor/__init__.py | Python | mit | 6,361 |
#!/usr/bin/env python
# encoding: utf-8
################################################################################
#
# RMG - Reaction Mechanism Generator
#
# Copyright (c) 2009-2011 by the RMG Team (rmg_dev@mit.edu)
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of thi... | chatelak/RMG-Py | rmgpy/util.py | Python | mit | 3,431 |
class Solution:
# @param A, a list of integers
# @return an integer
def maxSubArray(self, A):
miniPrefix = 0
maxiSubArraySum = A[0]
sum = 0
for i in A:
sum += i
maxiSubArraySum = max(maxiSubArraySum, sum - miniPrefix)
miniPrefix = ... | happylixue/LeetCodeSol | problems/maximum-subarray/sol.py | Python | mit | 385 |
from django.conf.urls.defaults import *
from account.forms import *
urlpatterns = patterns('',
url(r'^login/$', 'account.views.login', name="acct_login"),
url(r'^password_change/$', 'account.views.password_change', name="acct_passwd"),
url(r'^password_reset/$', 'account.views.password_reset', name="acct_pa... | bhaugen/localecon | account/urls.py | Python | mit | 458 |
from pyquark.nxt.color_sensor import ColorSensor
import logging
import time
from pyquark.io.i2c import I2c
if __name__ == '__main__':
log = logging.getLogger('pyquark')
log.setLevel(logging.INFO)
i2c = I2c()
bus = i2c.smbus
bus.write_byte_data(0x20, 0x29, 0x04)
color_sensor = ColorSensor()
... | rli9/pygalileo | example/color_sensor.py | Python | mit | 483 |
###############################################################################
#
# The MIT License (MIT)
#
# Copyright (c) Crossbar.io Technologies GmbH
#
# 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 ... | oberstet/autobahn-python | examples/twisted/wamp/pubsub/unsubscribe/frontend.py | Python | mit | 2,743 |
from .account.views import account, github_bp
from .content import content
from .matrix.views import matrix
from .members.views import members
from .projects.views import projects
blueprints = [account, content, github_bp, matrix, members, projects]
def init_app(app):
for blueprint in blueprints:
app.reg... | jazzband/site | jazzband/blueprints.py | Python | mit | 347 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import pytest
from lxml import etree
from interpparser import gpo_cfr
from regparser.test_utils.xml_builder import XMLBuilder
from regparser.tree.xml_parser import tree_utils
def test_interpretation_markers():
text = '1. Kiwis and Mangos'
asser... | tadhg-ohiggins/regulations-parser | tests/interpparser/gpo_cfr_tests.py | Python | cc0-1.0 | 14,139 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('blocks', '0012_auto_20160428_1303'),
('tasks', '0008_taskmodel__contained_concepts'),
]
operations = [
migrations.Re... | effa/flocs | tasks/migrations/0009_auto_20160428_1329.py | Python | gpl-2.0 | 654 |
import unittest
from PyFoam.Execution.StepAnalyzedWatcher import StepAnalyzedWatcher
theSuite=unittest.TestSuite()
| Unofficial-Extend-Project-Mirror/openfoam-extend-Breeder-other-scripting-PyFoam | unittests/Execution/test_StepAnalyzedWatcher.py | Python | gpl-2.0 | 117 |
import unittest
import ctypes
from ctypes.test import need_symbol
import _ctypes_test
@need_symbol('c_wchar')
class UnicodeTestCase(unittest.TestCase):
def test_wcslen(self):
dll = ctypes.CDLL(_ctypes_test.__file__)
wcslen = dll.my_wcslen
wcslen.argtypes = [ctypes.c_wchar_p]
self.... | bruderstein/PythonScript | PythonLib/full/ctypes/test/test_unicode.py | Python | gpl-2.0 | 1,997 |
"""
This file is part of exparser.
exparser 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.
exparser is distributed in the hope that it wil... | lvanderlinden/exparser | exparser/Constants.py | Python | gpl-2.0 | 916 |
from resources.lib.handler.requestHandler import cRequestHandler
from resources.lib.parser import cParser
from resources.lib.config import cConfig
from resources.hosters.hoster import iHoster
import re
class cHoster(iHoster):
def __init__(self):
self.__sDisplayName = 'Vodlocker'
self.__sFileName =... | mino60/venom-xbmc-addons-beta | plugin.video.vstream/resources/hosters/vodlocker.py | Python | gpl-2.0 | 2,050 |
# coding:utf-8
import gevent
from gevent import (monkey,
queue,
event,
pool)
import re
import sys
import logging
import unittest
import urllib
import urlparse
import requests
from threading import Timer
from pyquery import PyQuery
from utils import HtmlAnalyz... | xujun10110/Hammer | lib/spider/spider.py | Python | gpl-2.0 | 7,646 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import unittest
import bob
class BobTests(unittest.TestCase):
def test_stating_something(self):
self.assertEqual(
'Whatever.',
bob.hey('Tom-ay-to, tom-aaaah-to.')
)
def test_shouting(self):
self... | vellonce/python-exercises | bob/bob_test.py | Python | gpl-2.0 | 2,904 |
##
# Copyright 2013 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://vscentrum.be/nl/en),
# the Hercules foundation (http://w... | geimer/easybuild-easyblocks | easybuild/easyblocks/p/psi.py | Python | gpl-2.0 | 6,029 |
#!/usr/bin/python
#
# Copyright (c) 2018 Zim Kalinowski, <zikalino@microsoft.com>
#
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | maartenq/ansible | lib/ansible/modules/cloud/azure/azure_rm_containerregistry_facts.py | Python | gpl-3.0 | 8,582 |
###########################################################
#
# Simple executor script for Batch class methods.
#
# The script is concatenated on the fly with the required
# batch system class definition
#
# 15.11.2014
# Author: A.T.
#
###########################################################
from __future__ im... | petricm/DIRAC | Resources/Computing/BatchSystems/executeBatch.py | Python | gpl-3.0 | 848 |
#################################################################
# This file is part of glyr
# + a command-line tool and library to download various sort of music related metadata.
# + Copyright (C) [2011-2012] [Christopher Pahl]
# + Hosted at: https://github.com/sahib/glyr
#
# glyr is free software: you can redistri... | emillon/glyr-debian | spec/provider/tests/__common__.py | Python | gpl-3.0 | 1,130 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Core Zen Coding library. Contains various text manipulation functions:
== Expand abbreviation
Expands abbreviation like ul#nav>li*5>a into a XHTML string.
=== How to use
First, you have to extract current string (where cursor is) from your test
editor and use <code>fi... | Bruno-sm/fguess | training_files/Python/zen_core.py | Python | gpl-3.0 | 32,262 |
# Copyright: (c) 2018 Ansible Project
# 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
import bisect
import json
import pkgutil
import re
from ansible import constants as C
from ansible... | maxamillion/ansible | lib/ansible/executor/interpreter_discovery.py | Python | gpl-3.0 | 9,978 |
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) an... | shepdelacreme/ansible | lib/ansible/inventory/manager.py | Python | gpl-3.0 | 24,181 |
import numpy as np
def kMeans(X, K, maxIters = 10):
centroids = X[np.random.choice(np.arange(len(X)), K), :]
for i in range(maxIters):
# Cluster Assignment step
C = np.array([np.argmin([np.dot(x_i-y_k, x_i-y_k) for y_k in centroids]) for x_i in X])
# Move centroids step
centroi... | hacktoberfest17/programming | machine_learning/Kmeans/kmeans.py | Python | gpl-3.0 | 900 |
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) an... | konstruktoid/ansible-upstream | lib/ansible/inventory/manager.py | Python | gpl-3.0 | 23,980 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright: (c) 2017, F5 Networks 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',
... | veger/ansible | lib/ansible/modules/network/f5/bigip_provision.py | Python | gpl-3.0 | 29,288 |
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from frappe.model.document import Document
class LostReasonDetail(Document):
pass
| mhbu50/erpnext | erpnext/crm/doctype/lost_reason_detail/lost_reason_detail.py | Python | gpl-3.0 | 206 |
from __future__ import absolute_import, division, unicode_literals
from collections.abc import Mapping
class Trie(Mapping):
"""Abstract base class for tries"""
def keys(self, prefix=None):
# pylint:disable=arguments-differ
keys = super(Trie, self).keys()
if prefix is None:
... | unreal666/outwiker | plugins/webpage/webpage/libs/html5lib/_trie/_base.py | Python | gpl-3.0 | 934 |
# -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
#
# This file is part of the LibreOffice project.
#
# 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 http://mozilla.org/MPL/2.0/.
#
fr... | Limezero/libreoffice | librelogo/source/LibreLogo/LibreLogo.py | Python | gpl-3.0 | 79,003 |
#
# Copyright (C) 2015 FreeIPA Contributors see COPYING for license
#
from collections import namedtuple
from ipalib import _
from ipalib import Command
from ipalib import errors
from ipalib import output
from ipalib.parameters import Int
from ipalib.plugable import Registry
from ipapython.dn import DN
__doc__ = ... | apophys/freeipa | ipaserver/plugins/domainlevel.py | Python | gpl-3.0 | 4,514 |
# -*- coding: utf-8 -*-
# Copyright (C) 2010-2012 Nik Lutz <nik.lutz@gmail.com>
# Copyright (C) 2009 Harry Karvonen <harry.karvonen@gmail.com>
#
# 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; e... | Alwnikrotikz/veromix-plasmoid | dbus-service/pulseaudio/PulseVolume.py | Python | gpl-3.0 | 3,659 |
# Copyright 2013 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | s20121035/rk3288_android5.1_repo | cts/apps/CameraITS/tests/scene1/test_param_sensitivity.py | Python | gpl-3.0 | 2,539 |
"""
This is the base model for Gasista Felice.
It includes common data on which all (or almost all) other applications rely on.
"""
from django.db import models
from django.utils.translation import ugettext, ugettext_lazy as _
from django.contrib.auth.models import User
from django.core.exceptions import ImproperlyCon... | befair/gasistafelice | gasistafelice/gf/base/models.py | Python | agpl-3.0 | 48,753 |
#-*- coding:utf-8 -*-
#
#
# Copyright (C) 2013 Michael Telahun Makonnen <mmakonnen@gmail.com>.
# All Rights Reserved.
#
# 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, eith... | bwrsandman/openerp-hr | hr_schedule/wizard/validate_schedule.py | Python | agpl-3.0 | 2,390 |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PySingledispatch(PythonPackage):
"""This library brings functools.singledispatch to Python... | iulian787/spack | var/spack/repos/builtin/packages/py-singledispatch/package.py | Python | lgpl-2.1 | 762 |
import logging
from datetime import datetime, timedelta
from rapidsms.message import Message
from rapidsms.i18n import ugettext_noop as _
from logger.models import IncomingMessage
from weltel.models import Site, Nurse, Patient, PatientState, EventLog
from weltel.models import UNSUBSCRIBE_CODE, INACTIVE_CODE
##########... | commtrack/temp-rapidsms | apps/weltel/callbacks.py | Python | lgpl-3.0 | 6,301 |
#
# 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... | chuckchen/spark | python/pyspark/pandas/indexing.py | Python | apache-2.0 | 67,583 |
# 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... | ppwwyyxx/tensorflow | tensorflow/python/debug/lib/check_numerics_callback_test.py | Python | apache-2.0 | 22,712 |
# -*- coding: utf-8 -*-
# Copyright 2014 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | KaranToor/MA450 | google-cloud-sdk/platform/gsutil/gslib/translation_helper.py | Python | apache-2.0 | 35,255 |
"""Sensor platform support for yeelight."""
import logging
from homeassistant.components.binary_sensor import BinarySensorEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from .const import DA... | jawilson/home-assistant | homeassistant/components/yeelight/binary_sensor.py | Python | apache-2.0 | 1,782 |
# 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... | xuweiliang/Codelibrary | nova/notifications/objects/base.py | Python | apache-2.0 | 6,689 |
import itertools
import struct
import time
import pytest
import logging
from flaky import flaky
from cassandra import ConsistencyLevel, InvalidRequest
from cassandra.metadata import NetworkTopologyStrategy, SimpleStrategy
from cassandra.policies import FallthroughRetryPolicy
from cassandra.query import SimpleStatemen... | beobal/cassandra-dtest | cql_test.py | Python | apache-2.0 | 66,309 |
# -*- coding: utf-8 -*-
"""
flask.ext.security.datastore
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This module contains an user datastore classes.
:copyright: (c) 2012 by Matt Wright.
:license: MIT, see LICENSE for more details.
"""
from .utils import get_identity_attributes, string_types
class Datastore(ob... | davidvon/pipa-pay-server | site-packages/flask_security/datastore.py | Python | apache-2.0 | 10,317 |
import re
import types
import numpy as np
from numba.cuda.testing import unittest, skip_on_cudasim, CUDATestCase
from numba import cuda, jit, int32
from numba.core.errors import TypingError
class TestDeviceFunc(CUDATestCase):
def test_use_add2f(self):
@cuda.jit("float32(float32, float32)", device=True... | stonebig/numba | numba/cuda/tests/cudapy/test_device_func.py | Python | bsd-2-clause | 3,985 |
"""
Test Scipy functions versus mpmath, if available.
"""
from __future__ import division, print_function, absolute_import
import numpy as np
from numpy.testing import assert_, assert_allclose
from numpy import pi
import pytest
import itertools
from distutils.version import LooseVersion
import scipy.special as sc
f... | gfyoung/scipy | scipy/special/tests/test_mpmath.py | Python | bsd-3-clause | 74,561 |
# -*- coding: utf-8 -*-
import re
import types
from datetime import datetime, timedelta
from django.core.exceptions import ValidationError
from django.core.validators import *
from django.utils.unittest import TestCase
NOW = datetime.now()
TEST_DATA = (
# (validator, value, expected),
(validate_integer, '42... | faun/django_test | tests/modeltests/validators/tests.py | Python | bsd-3-clause | 6,315 |
from unittest import TestCase
from chatterbot.storage import StorageAdapter
from chatterbot.conversation import Statement, Response
class StorageAdapterTestCase(TestCase):
"""
This test case is for the StorageAdapter base class.
Although this class is not intended for direct use,
this test case ensures... | Gustavo6046/ChatterBot | tests/storage_adapter_tests/test_storage_adapter.py | Python | bsd-3-clause | 1,702 |
# Copyright 2017 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 print_function
from __future__ import division
from __future__ import absolute_import
import datetime
import json
import unittest
fr... | catapult-project/catapult | dashboard/dashboard/api/alerts_test.py | Python | bsd-3-clause | 12,059 |
# Author: Shao Zhang and Phil Saltzman
# Last Updated: 4/19/2005
#
# This tutorial is intended as a initial panda scripting lesson going over
# display initialization, loading models, placing objects, and the scene graph.
#
# Step 4: In this step, we will load the rest of the planets up to Mars.
# In addition to loadin... | toontownfunserver/Panda3D-1.9.0 | samples/Solar-System/Tut-Step-4-Load-System.py | Python | bsd-3-clause | 7,262 |
from django.contrib.auth.models import AnonymousUser
from django.test import RequestFactory, TestCase
from mock import MagicMock, patch
from . import general_context
class TestGeneralContext(TestCase):
maxDiff = None
@patch("evennia.web.utils.general_context.GAME_NAME", "test_name")
@patch("evennia.web.u... | jamesbeebop/evennia | evennia/web/utils/tests.py | Python | bsd-3-clause | 3,513 |
"""
.. _tut_viz_evoked:
=====================
Visualize Evoked data
=====================
"""
import os.path as op
import numpy as np
import matplotlib.pyplot as plt
import mne
###############################################################################
# In this tutorial we focus on plotting functions of :class:... | nicproulx/mne-python | tutorials/plot_visualize_evoked.py | Python | bsd-3-clause | 9,661 |
# coding: utf-8
# Copyright (c) 2012, Machinalis S.R.L.
# This file is part of quepy and is distributed under the Modified BSD License.
# You should have received a copy of license in the LICENSE file.
#
# Authors: Rafael Carrascosa <rcarrascosa@machinalis.com>
# Gonzalo Garcia Berrotaran <ggarcia@machinalis.... | apostolosSotiropoulos/interQuepy | quepy/settings.py | Python | bsd-3-clause | 897 |
import pytest
from mitmproxy.contentviews import javascript
from . import full_eval
def test_view_javascript():
v = full_eval(javascript.ViewJavaScript())
assert v(b"[1, 2, 3]")
assert v(b"[1, 2, 3")
assert v(b"function(a){[1, 2, 3]}") == ("JavaScript", [
[('text', 'function(a) {')],
... | zlorb/mitmproxy | test/mitmproxy/contentviews/test_javascript.py | Python | mit | 791 |
# Rabbits Multiplying
# A (slightly) more realistic model of rabbit multiplication than the Fibonacci
# model, would assume that rabbits eventually die. For this question, some
# rabbits die from month 6 onwards.
#
# Thus, we can model the number of rabbits as:
#
# rabbits(1) = 1 # There is one pair of immature rabbit... | mi1980/projecthadoop3 | udacity/cs101-intro-cs/code/lesson6/problem-set/multiplying_rabbits.py | Python | mit | 1,473 |
class BowlingGame:
def __init__(self):
pass
def roll(self, pins):
pass
def score(self):
pass
| jmluy/xpython | exercises/practice/bowling/bowling.py | Python | mit | 131 |
# test attributes of builtin range type
try:
range(0).start
except AttributeError:
import sys
print("SKIP")
sys.exit()
# attrs
print(range(1, 2, 3).start)
print(range(1, 2, 3).stop)
print(range(1, 2, 3).step)
# bad attr (can't store)
try:
range(4).start = 0
except AttributeError:
print('Attri... | puuu/micropython | tests/basics/builtin_range_attrs.py | Python | mit | 332 |
# encoding: utf-8
ONE_MILE = float(0.62137) # km units
ONE_FEET = float(3.2808)
ONE_KILOMETER = float(1000.00) # m units
UNIT_KM = 'km'
UNIT_M = 'm'
MODE_DRIVING = 1
MODE_WALKING = 2
MODE_BICYCLING = 3
MODES = (
(MODE_DRIVING, 'driving'),
(MODE_WALKING, 'walking'),
(MODE_BICYCLING, 'bicycling')
)
... | arcticio/ice-bloc-hdr | utils/external/geolocation/distance_matrix/const.py | Python | mit | 479 |
"""
Port of Queue.Queue from the python standard library.
"""
__all__ = ['Full', 'Empty', 'Queue']
import collections
import events
from util import priority
class Full(Exception):
pass
class Empty(Exception):
pass
class QGet(events.TimedOperation):
"A operation for the queue get call."
... | pombredanne/cogen | cogen/core/queue.py | Python | mit | 10,675 |
# encoding: utf-8
# The MIT License
#
# Copyright (c) 2012 the bpython authors.
#
# 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... | crakensio/django_training | lib/python2.7/site-packages/bpython/_py3compat.py | Python | cc0-1.0 | 1,574 |
## opcodes.py
# -*- coding: utf-8 -*
#
# Copyright 2011 David Martínez Moreno <ender@debian.org>
# This software is not affiliated in any way with Facebook, my current employer.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Ge... | merckhung/bokken | ui/opcodes.py | Python | gpl-2.0 | 4,343 |
# Copyright (C) 2003-2004, 2006, 2009 The Written Word, 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 2, or (at your option)
# any later version.
#
# This program is dist... | tjyang/sbutils | lib/depot/ftp.py | Python | gpl-2.0 | 4,505 |
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))
... | ericjpj/ns-3-dev | src/energy/bindings/modulegen__gcc_LP64.py | Python | gpl-2.0 | 360,229 |
#!/usr/bin/env python
__author__ = 'Mike McCann'
__version__ = '$Revision: $'.split()[1]
__date__ = '$Date: $'.split()[1]
__copyright__ = '2011'
__license__ = 'GPL v3'
__contact__ = 'mccann at mbari.org'
__doc__ = '''
convertToMatlab.py simply copies a set of .csv files to a parallel set renaming
the headers s... | duane-edgington/stoqs | stoqs/loaders/MarMenor/toNetCDF/convertToMatlab.py | Python | gpl-3.0 | 2,914 |
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2017-2018 Canonical Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# This program is distributed in ... | ubuntu-core/snapcraft | tests/unit/sources/test_checksum.py | Python | gpl-3.0 | 2,851 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
# This program is free software: you can redistribute it and/or modif... | jaggu303619/asylum | openerp/addons/auto_backup/backup_scheduler.py | Python | agpl-3.0 | 4,346 |
"""Anon job view
Revision ID: e49788bea4a
Revises: 5a725fd5ddd6
Create Date: 2015-02-07 01:46:03.956058
"""
# revision identifiers, used by Alembic.
revision = 'e49788bea4a'
down_revision = '5a725fd5ddd6'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.create_table('anon_job_view',
sa... | nhannv/hasjob | alembic/versions/e49788bea4a_anon_job_view.py | Python | agpl-3.0 | 1,146 |
#!/usr/bin/env python
# -*- mode: python; encoding: utf-8 -*-
#
"""This plugin renders the results from Rekall."""
import json
import re
from django.utils import html as django_html
from rekall.ui import json_renderer
import logging
from grr.client.client_actions import grr_rekall
from grr.gui import renderers
f... | wandec/grr | gui/plugins/rekall_viewer.py | Python | apache-2.0 | 9,626 |
# Copyright 2021 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | GoogleCloudPlatform/asl-ml-immersion | notebooks/kubeflow_pipelines/pipelines/solutions/trainer_image_vertex/train.py | Python | apache-2.0 | 3,462 |
#!/usr/bin/env python3
# Copyright 2018-present Facebook, 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 applic... | rmaz/buck | scripts/migrations/migrate_include_defs_to_load.py | Python | apache-2.0 | 6,097 |
#
# 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... | Acehaidrey/incubator-airflow | airflow/migrations/versions/952da73b5eff_add_dag_code_table.py | Python | apache-2.0 | 2,874 |
#!/usr/bin/python
#
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | richardfergie/googleads-python-lib | examples/dfp/v201502/audience_segment_service/populate_first_party_audience_segments.py | Python | apache-2.0 | 2,508 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2013 New Dream Network, LLC (DreamHost)
#
# 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/li... | citrix-openstack-build/neutron | neutron/tests/unit/services/loadbalancer/drivers/haproxy/test_namespace_driver.py | Python | apache-2.0 | 14,148 |
"""The tests for the Yr sensor platform."""
from datetime import datetime
from homeassistant.bootstrap import async_setup_component
from homeassistant.const import DEGREE, SPEED_METERS_PER_SECOND, UNIT_PERCENTAGE
import homeassistant.util.dt as dt_util
from tests.async_mock import patch
from tests.common import asser... | nkgilley/home-assistant | tests/components/yr/test_sensor.py | Python | apache-2.0 | 4,271 |
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | gquirozbogner/contentbox-master | main/templatetags/youtube_embed.py | Python | apache-2.0 | 1,817 |
# Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The SFC licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | p0deje/selenium | py/test/selenium/webdriver/firefox/mn_set_context_tests.py | Python | apache-2.0 | 2,055 |
"""AirTouch 4 component to control of AirTouch 4 Climate Devices."""
import logging
from homeassistant.components.climate import ClimateEntity
from homeassistant.components.climate.const import (
FAN_AUTO,
FAN_DIFFUSE,
FAN_FOCUS,
FAN_HIGH,
FAN_LOW,
FAN_MEDIUM,
HVAC_MODE_AUTO,
HVAC_MODE... | sander76/home-assistant | homeassistant/components/airtouch4/climate.py | Python | apache-2.0 | 11,301 |
# Licensed to the StackStorm, Inc ('StackStorm') 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 th... | grengojbo/st2 | st2api/st2api/controllers/v1/stream.py | Python | apache-2.0 | 1,903 |
# Copyright 2014 Red Hat, 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, s... | zhimin711/nova | nova/virt/hardware.py | Python | apache-2.0 | 56,084 |
"""Fallback pure Python implementation of msgpack"""
import sys
import struct
import warnings
if sys.version_info[0] == 2:
PY2 = True
int_types = (int, long)
def dict_iteritems(d):
return d.iteritems()
else:
PY2 = False
int_types = int
unicode = str
xrange = range
def dict_ite... | xyuanmu/XX-Net | python3.8.2/Lib/site-packages/pip/_vendor/msgpack/fallback.py | Python | bsd-2-clause | 37,491 |
# -*- coding:utf-8 -*-
# Copyright (c) 2015, Galaxy Authors. All Rights Reserved
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# Author: wangtaize@baidu.com
# Date: 2015-04-06
import datetime
import logging
from sofa.pbrpc import client
from galaxy import master... | imotai/galaxy | platform/src/galaxy/sdk.py | Python | bsd-3-clause | 2,033 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('base', '0035_remove_deleted_field'),
]
operations = [
migrations.AddField(
model_name='project',
nam... | participedia/pontoon | pontoon/base/migrations/0036_project_has_changed.py | Python | bsd-3-clause | 408 |
from __future__ import print_function, absolute_import, division
import six
import numpy as np
import struct
import warnings
import string
from astropy import log
from astropy.io import registry as io_registry
from ..spectral_cube import BaseSpectralCube
from .fits import load_fits_cube
"""
.. TODO::
When any sec... | radio-astro-tools/spectral-cube | spectral_cube/io/class_lmv.py | Python | bsd-3-clause | 29,674 |
"""
Github Enterprise OAuth2 backend, docs at:
https://python-social-auth.readthedocs.io/en/latest/backends/github_enterprise.html
"""
from six.moves.urllib.parse import urljoin
from ..utils import append_slash
from .github import GithubOAuth2, GithubOrganizationOAuth2, \
GithubTeamOAuth2
cla... | tobias47n9e/social-core | social_core/backends/github_enterprise.py | Python | bsd-3-clause | 1,344 |
#http://documen.tician.de/pyopencl/
import pyopencl as cl
import numpy as np
import struct
import timing
timings = timing.Timing()
#ctx = cl.create_some_context()
mf = cl.mem_flags
class Bitonic:
def __init__(self, max_elements, cta_size, dtype):
plat = cl.get_platforms()[0]
device = plat.get_de... | vbud/adventures_in_opencl | experiments/bitonic/bitonic.py | Python | mit | 7,569 |
# This is a sample file, and shows the basic framework for using an "Object" based
# document, rather than a "filename" based document.
# This is referenced by the Pythonwin .html documentation.
# In the example below, the OpenObject() method is used instead of OpenDocumentFile,
# and all the core MFC document open fu... | sserrot/champion_relationships | venv/Lib/site-packages/pythonwin/pywin/Demos/objdoc.py | Python | mit | 1,556 |
from __future__ import print_function
import optparse
parser = optparse.OptionParser()
parser.add_option('-s', '--strand', type='choice', choices=['D', 'R', 'both'],
default='D', help="Strand ('D', 'R' or 'both')")
options, args = parser.parse_args()
if len(args) != 2:
parser.error('Specify 2 in... | TGAC/tgac-galaxytools | tools/rsat_filter_snps/rsat_filter_snps.py | Python | mit | 1,369 |
CODONS = {'AUG': "Methionine", 'UUU': "Phenylalanine",
'UUC': "Phenylalanine", 'UUA': "Leucine", 'UUG': "Leucine",
'UCU': "Serine", 'UCC': "Serine", 'UCA': "Serine",
'UCG': "Serine", 'UAU': "Tyrosine", 'UAC': "Tyrosine",
'UGU': "Cysteine", 'UGC': "Cysteine", 'UGG': "Tryptophan",
... | behrtam/xpython | exercises/protein-translation/example.py | Python | mit | 801 |
# FILE: autoload/conque_term/conque_globals.py
# AUTHOR: Nico Raffo <nicoraffo@gmail.com>
# WEBSITE: http://conque.googlecode.com
# MODIFIED: __MODIFIED__
# VERSION: __VERSION__, for Vim 7.0
# LICENSE:
# Conque - Vim terminal/console emulator
# Copyright (C) 2009-__YEAR__ Nico Raffo
#
# MIT License
#
# Permissi... | jcordry/dotfiles | vim/bundle/conque/autoload/conque_term/conque_globals.py | Python | mit | 14,560 |
from django.conf.urls import patterns, include, url
from rest_framework.routers import DefaultRouter
from django.contrib import admin
from tweeter import views
admin.autodiscover()
router = DefaultRouter()
router.register(r'tweets', views.TweetViewSet)
router.register(r'users', views.UserViewSet)
urlpatterns = pat... | nnja/tweeter | angulardjango/urls.py | Python | mit | 625 |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2006 Donald N. Allingham
# Copyright (C) 2009-2011 Gary Burton
#
# 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... | SNoiraud/gramps | gramps/gui/editors/displaytabs/buttontab.py | Python | gpl-2.0 | 12,717 |
#! /usr/bin/python3
# SPDX-License-Identifier: GPL-2.0+
# Copyright 2019 Google LLC
#
"""
Script to remove boards
Usage:
rmboard.py <board_name>...
A single commit is created for each board removed.
Some boards may depend on files provided by another and this will cause
problems, generally the removal of files w... | Stane1983/u-boot | tools/rmboard.py | Python | gpl-2.0 | 4,368 |
#!/usr/bin/env python
# txt2tags - generic text conversion tool
# http://txt2tags.sf.net
#
# Copyright 2001, 2002, 2003, 2004 Aurelio Marinho Jargas
#
# 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 F... | txt2tags/old | txt2tags-2.1.py | Python | gpl-2.0 | 141,312 |
"""Should be called last, if nothing can do a better job with the URL"""
from gruntle.memebot.scanner import Scanner, ScanResult
class DefaultScanner(Scanner):
rss_templates = {None: 'memebot/scanner/rss/default.html'}
def handle(self, response, log, browser):
return ScanResult(response=response,
... | icucinema/madcow | contrib/django-memebot/gruntle/memebot/scanner/default.py | Python | gpl-3.0 | 552 |
#
# Script for exporting Blender models (meshes) to Colobot model files
# (text format)
#
# Copyright (C) 2012-2014, TerranovaTeam
#
bl_info = {
"name": "Colobot Model Format (.txt)",
"author": "TerranovaTeam",
"version": (0, 0, 2),
"blender": (2, 6, 4),
"location": "File > Export > Colobot (.txt)... | ManuelBlanc/colobot | tools/blender-scripts.py | Python | gpl-3.0 | 23,570 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
from django.db.models import F
from taggit.models import TaggedItem
class Migration(DataMigration):
def forwards(self, orm):
"""
At some point we created some tags with identi... | scrollback/kuma | kuma/wiki/migrations/0018_clean_documenttags.py | Python | mpl-2.0 | 17,300 |
import os
import re
import sys
import unittest
import unittest.mock
from pkg_resources import VersionConflict
from coalib.coala_main import run_coala
from coalib.output.printers.LogPrinter import LogPrinter
from coalib import assert_supported_version, coala
from pyprint.ConsolePrinter import ConsolePrinter
from coala_... | refeed/coala | tests/coalaTest.py | Python | agpl-3.0 | 7,484 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2011 OpenStack, LLC.
# 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... | usc-isi/extra-specs | nova/rootwrap/filters.py | Python | apache-2.0 | 5,011 |