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 |
|---|---|---|---|---|---|
"""Provides the CameraSampleDialog class which creates a window for capturing samples with a camera."""
try:
# Python 3
import tkinter as Tkinter
from tkinter import N, E, S, W
from tkinter import ttk
from tkinter import messagebox as tkMessageBox
except:
# Python 2
import Tkinter... | mbakthav/artos | PyARTOS/GUI/CameraSampler.py | Python | gpl-3.0 | 16,231 |
# -*- 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):
# Adding model 'Currency'
db.create_table(u'currency_currency', (
('iso_code', self.gf('django.d... | pombredanne/1trillioneuros | webapp/currency/migrations/0001_initial.py | Python | gpl-3.0 | 1,131 |
#
# -*- coding: utf-8 -*-
# Copyright 2019 Red Hat
# GNU General Public License v3.0+
# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
"""
The vyos_static_routes class
It is in this file where the current configuration (as dict)
is compared to the provided configuration (as dict) and the command set
necessar... | roadmapper/ansible | lib/ansible/module_utils/network/vyos/config/static_routes/static_routes.py | Python | gpl-3.0 | 20,425 |
# 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 RRrcov(RPackage):
"""rrcov: Scalable Robust Estimators with High Breakdown Point"""
h... | iulian787/spack | var/spack/repos/builtin/packages/r-rrcov/package.py | Python | lgpl-2.1 | 932 |
# 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 RDynamictreecut(RPackage):
"""dynamicTreeCut: Methods for Detection of Clusters in Hierarc... | iulian787/spack | var/spack/repos/builtin/packages/r-dynamictreecut/package.py | Python | lgpl-2.1 | 744 |
"""
Support for Unifi WAP controllers.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/device_tracker.unifi/
"""
import logging
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
import homeassistant.loader as loader
from homea... | alexmogavero/home-assistant | homeassistant/components/device_tracker/unifi.py | Python | apache-2.0 | 3,400 |
# A funny, but common thing you'll see in python scipts is that if __name__ ...
# block below
# To start off, just run this script and see what happens.
# Then run the test and note that it fails in a curious way!
print "I was run - maybe by a test?"
if __name__ == '__main__':
# The problem is that this variab... | marwahaha/python-fundamentals | challenges/04-Functions/B_script_conventions.py | Python | apache-2.0 | 610 |
# -*- coding: utf-8 -*-
# https://gist.github.com/adewes/6103220
import redis
import time
class LockTimeout(BaseException):
pass
class Lock(object):
'''Implements a distributed lock using Redis.'''
def __init__(self, redis, lock_type, key, expires=60):
self.key = key
self.lock_type =... | mfojtik/openshift-docker-registry | docker_registry/lib/rlock.py | Python | apache-2.0 | 1,366 |
# Copyright 2015 IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | phenoxim/nova | nova/tests/unit/cmd/test_baseproxy.py | Python | apache-2.0 | 3,676 |
'''
Created on Jun 10, 2011
Refactored on Jun 11, 2011 to ModelDtsObject, ModelInstanceObject, ModelTestcaseObject
@author: Mark V Systems Limited
(c) Copyright 2011 Mark V Systems Limited, All rights reserved.
'''
from arelle.ModelObject import ModelObject, init as moduleObject_init
elementSubstitutionModelClass = {... | sternshus/Arelle | arelle/ModelObjectFactory.py | Python | apache-2.0 | 8,302 |
# Copyright 2012 Nebula, Inc.
# Copyright 2013 IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required... | takeshineshiro/nova | nova/tests/functional/v3/test_image_size.py | Python | apache-2.0 | 2,115 |
"""Test state helpers."""
import asyncio
from datetime import timedelta
from unittest.mock import patch
import pytest
from homeassistant.components.sun import STATE_ABOVE_HORIZON, STATE_BELOW_HORIZON
from homeassistant.const import (
SERVICE_TURN_OFF,
SERVICE_TURN_ON,
STATE_CLOSED,
STATE_HOME,
STA... | leppa/home-assistant | tests/helpers/test_state.py | Python | apache-2.0 | 7,019 |
# 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... | laosiaudi/tensorflow | tensorflow/contrib/distributions/python/ops/distribution.py | Python | apache-2.0 | 33,964 |
#!/usr/bin/env python3
"""
Parse CHANGES.md into a JSON structure.
Run with two arguments: the .md file to parse, and the JSON file to write:
python parse_relnotes.py CHANGES.md relnotes.json
Every section that has something that looks like a version number in it will
be recorded as the release notes for that versi... | hugovk/coveragepy | ci/parse_relnotes.py | Python | apache-2.0 | 3,133 |
#
# 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... | spektom/incubator-airflow | tests/providers/snowflake/operators/test_s3_to_snowflake.py | Python | apache-2.0 | 3,634 |
"""
Support for Velbus Binary Sensors.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/binary_sensor.velbus/
"""
import logging
from homeassistant.components.binary_sensor import BinarySensorDevice
from homeassistant.components.velbus import (
DOMAIN... | PetePriority/home-assistant | homeassistant/components/velbus/binary_sensor.py | Python | apache-2.0 | 1,110 |
from datetime import datetime
# Defaults
def noop(*args, **kw):
"""No operation. Returns nothing"""
pass
def identity(x):
"""Returns argument x"""
return x
def default_now():
return datetime.utcnow()
def default_comparer(x, y):
return x == y
def default_sub_comparer(x, y):
return x... | dbrattli/RxPY | rx/internal/basic.py | Python | apache-2.0 | 498 |
"""
>>> from django.db.models.fields import *
>>> try:
... from decimal import Decimal
... except ImportError:
... from django.utils._decimal import Decimal
# DecimalField
>>> f = DecimalField(max_digits=4, decimal_places=2)
>>> f.to_python(3) == Decimal("3")
True
>>> f.to_python("3.14") == Decimal("3.14")
... | weigj/django-multidb | tests/regressiontests/model_fields/tests.py | Python | bsd-3-clause | 1,604 |
from functools import wraps
from nose.tools import eq_
from js_helper import TestCase
def uses_feature(name):
def wrap(func):
@wraps(func)
def inner(self, *args, **kw):
func(self, *args, **kw)
self.assert_has_feature(name)
return inner
return wrap
class Feat... | stasm/app-validator | tests/js/test_features.py | Python | bsd-3-clause | 4,061 |
"""
Soft Voting/Majority Rule classifier and Voting regressor.
This module contains:
- A Soft Voting/Majority Rule classifier for classification estimators.
- A Voting regressor for regression estimators.
"""
# Authors: Sebastian Raschka <se.raschka@gmail.com>,
# Gilles Louppe <g.louppe@gmail.com>,
# ... | sergeyf/scikit-learn | sklearn/ensemble/_voting.py | Python | bsd-3-clause | 19,214 |
# Copyright (C) 2009 Valmantas Paliksa <walmis at balticum-tv dot lt>
#
# Licensed under the GNU General Public License Version 3
#
# 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... | nmercier/linux-cross-gcc | linux/lib/python2.7/dist-packages/blueman/plugins/MechanismPlugin.py | Python | bsd-3-clause | 1,268 |
import argparse
import time
import math
import torch
import torch.nn as nn
from torch.autograd import Variable
import data
import model
parser = argparse.ArgumentParser(description='PyTorch PennTreeBank RNN/LSTM Language Model')
parser.add_argument('--data', type=str, default='./data/penn',
help='... | BestSonny/examples | word_language_model/main.py | Python | bsd-3-clause | 7,524 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from django.http import HttpResponse
from .base import ServerBase
class ApacheXSendfileServer(ServerBase):
def serve(self, request, file_obj, **kwargs):
response = HttpResponse()
response['X-Sendfile'] = file_obj.path
# This... | skirsdeda/django-filer | filer/server/backends/xsendfile.py | Python | bsd-3-clause | 647 |
# Stripped down configuration file for ipython-notebook in Topographica.
c = get_config()
#------------------------------------------------------------------------------
# NotebookApp configuration
#------------------------------------------------------------------------------
# NotebookApp will inherit config from:... | Tasignotas/topographica_mirror | platform/ipython/profile_topo/ipython_notebook_config.py | Python | bsd-3-clause | 4,652 |
import functools
import gc
import operator
import platform
import unittest
from datetime import datetime
from itertools import count
from warnings import catch_warnings
from scrapy.utils.python import (
memoizemethod_noargs, binary_is_text, equal_attributes,
WeakKeyCache, get_func_args, to_bytes, to_unicode,
... | starrify/scrapy | tests/test_utils_python.py | Python | bsd-3-clause | 7,687 |
# 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.
"""
Performance runner for d8.
Call e.g. with tools/run-perf.py --arch ia32 some_suite.json
The suite json format is expected to be:
{
"path": <relativ... | endlessm/chromium-browser | v8/tools/run_perf.py | Python | bsd-3-clause | 40,465 |
#!/usr/bin/env python
# standard lib
import warnings
# local
from ..utils import PyDyUserWarning
from .shapes import Shape
from .visualization_frame import VisualizationFrame
__all__ = ['PerspectiveCamera', 'OrthoGraphicCamera']
warnings.simplefilter('once', PyDyUserWarning)
class PerspectiveCamera(VisualizationF... | oliverlee/pydy | pydy/viz/camera.py | Python | bsd-3-clause | 9,435 |
#!/usr/bin/env python
# Copyright (c) 2009, Giampaolo Rodola'. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Sun OS specific tests. These are implicitly run by test_psutil.py."""
import psutil
from test_psutil import *
class SunOSSpec... | szaydel/psutil | test/_sunos.py | Python | bsd-3-clause | 1,322 |
import base64
import json
from twisted.internet.defer import inlineCallbacks, returnValue
from twisted.internet.error import ConnectionLost
from twisted.internet.task import Clock
from twisted.web.server import NOT_DONE_YET
from twisted.python.failure import Failure
from vumi.message import TransportUserMessage
from ... | TouK/vumi | vumi/transports/vumi_bridge/tests/test_vumi_bridge.py | Python | bsd-3-clause | 10,429 |
# -*- coding: utf-8 -*-
"""Tests for http module."""
#
# (C) Pywikibot team, 2014-2017
#
# Distributed under the terms of the MIT license.
#
from __future__ import absolute_import, unicode_literals
import json
import re
import warnings
import requests
import pywikibot
from pywikibot import config2 as config
from py... | Darkdadaah/pywikibot-core | tests/http_tests.py | Python | mit | 23,399 |
"""Functions for replacing j/J and v/V to i/I and u/U"""
__author__ = ["Kyle P. Johnson <kyle@kyle-p-johnson.com>"]
__license__ = "MIT License. See LICENSE."
import re
patterns = [(r"j", "i"), (r"v", "u"), (r"J", "I"), (r"V", "U")]
patterns = [(re.compile(regex), repl) for (regex, repl) in patterns]
def replace_jv... | D-K-E/cltk | src/cltk/text/lat.py | Python | mit | 542 |
import numpy as np
def cshift3D(x, m, d):
s=x.shape
idx=(np.array(range(s[d]))+(s[d]-m%s[d]))%s[d]
if d==0:
return x[idx,:,:]
elif d==1:
return x[:,idx,:]
else:
return x[:,:,idx];
| neuropoly/spinalcordtoolbox | dev/denoise/ornlm/wavelet/cshift3D.py | Python | mit | 224 |
from sympy.core import (S, pi, oo, Symbol, symbols, Rational, Integer,
GoldenRatio, EulerGamma, Catalan, Lambda, Dummy, Eq)
from sympy.functions import (Piecewise, sin, cos, Abs, exp, ceiling, sqrt,
gamma, sign, Max, Min, factorial, beta)
from sympy.sets import Range... | wxgeo/geophar | wxgeometrie/sympy/printing/tests/test_rcode.py | Python | gpl-2.0 | 14,177 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'form.ui'
#
# Created: Mon Mar 24 20:22:18 2014
# by: PyQt4 UI code generator 4.10.3
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except Attribute... | stevefaeembra/cartogram-plugin | form.py | Python | gpl-2.0 | 6,749 |
"""
Routines for watching files for changes
"""
from __future__ import print_function
from builtins import zip
import time
import os
def watch(files, timeout=None, poll=2):
"""
Watch a given file or collection of files
until one changes. Uses polling.
Inputs
======
files - Name of one or mo... | erikgrinaker/BOUT-dev | tools/pylib/boututils/watch.py | Python | gpl-3.0 | 2,197 |
# Google Home page example
#
# Author: Dnpwwo, 2017 - 2018
#
# Demonstrates HTTP/HTTPS connectivity.
# After connection it performs a GET on www.google.com and receives a 302 (Page Moved) response
# It then does a subsequent GET on the Location specified in the 302 response and receives a 200 response.
#
"""
<pl... | gordonb3/domoticz | plugins/examples/HTTP.py | Python | gpl-3.0 | 8,304 |
#
# Copyright 2007-2014 Charles du Jeu - Abstrium SAS <team (at) pyd.io>
# This file is part of Pydio.
#
# Pydio 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 yo... | sanand0/pydio-sync | src/pydio/utils/config_ports.py | Python | gpl-3.0 | 2,742 |
# -*- coding: utf-8 -*-
from openerp.tests import common
class TestProjectScrum(common.TransactionCase):
def test_project_scrum(self)
env = self.env
record = env['project_scrum.0'].create({})
| mohamedhagag/community-addons | project_scrum/tests/test_project_scrum.py | Python | agpl-3.0 | 196 |
"""
Test grade calculation.
"""
from django.http import Http404
from django.test import TestCase
from django.test.client import RequestFactory
from mock import patch, MagicMock
from nose.plugins.attrib import attr
from opaque_keys.edx.locations import SlashSeparatedCourseKey
from opaque_keys.edx.locator import CourseL... | shabab12/edx-platform | lms/djangoapps/courseware/tests/test_grades.py | Python | agpl-3.0 | 18,523 |
#
# setup.py
#
# Copyright (C) 2010 Antoine Mercadal <antoine.mercadal@inframonde.eu>
# 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... | ruthger/Archipel | ArchipelAgent/archipel-agent-virtualmachine-storage/setup.py | Python | agpl-3.0 | 3,255 |
#! /usr/bin/env python3
"""Interfaces for launching and remotely controlling Web browsers."""
# Maintained by Georg Brandl.
import io
import os
import shlex
import sys
import stat
import subprocess
import time
__all__ = ["Error", "open", "open_new", "open_new_tab", "get", "register"]
class Error(Exception):
pass... | LaoZhongGu/kbengine | kbe/src/lib/python/Lib/webbrowser.py | Python | lgpl-3.0 | 21,961 |
#! /usr/bin/env python3
with open('x.c', 'w') as f:
print('int main(void) { return 0; }', file=f)
with open('y', 'w'):
pass
| pexip/meson | test cases/common/229 custom_target source/x.py | Python | apache-2.0 | 132 |
#-*- coding: utf-8 -*-
import unittest
import ModelADDAC as adda
import api_convertors.type_conv as tc
''' Просто заглушка '''
def printRpt( value, valueDisplacemented, valueScaled, valueCode, Kda ):
#print '\nvalueDisplacemented : '+str(valueDisplacemented)
pass
''' Класс тестов '''
class TestCaseModelADDAC(unitt... | zaqwes8811/matlab_ext | measurement/mc-assistant/projects/py_hw_models/trash/testModelADDAC.py | Python | apache-2.0 | 5,245 |
"""
Biodata objects
"""
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import datetime
import json
import ga4gh.server.datamodel as datamodel
import ga4gh.server.exceptions as exceptions
import ga4gh.schemas.protocol as protocol
class Biosample(datamod... | saupchurch/server | ga4gh/server/datamodel/bio_metadata.py | Python | apache-2.0 | 6,910 |
# Copyright 2015 Confluent 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... | airbnb/kafka | tests/kafkatest/utils/util.py | Python | apache-2.0 | 2,970 |
# Copyright (c) 2013 Mirantis 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 writi... | ogazitt/stackalytics | tests/unit/test_mps.py | Python | apache-2.0 | 1,964 |
#!/usr/bin/env python
#
# Copyright 2013 The Rust Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution and at
# http://rust-lang.org/COPYRIGHT.
#
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
#... | aturon/rust | src/etc/generate-deriving-span-tests.py | Python | apache-2.0 | 4,052 |
# -*- coding: UTF-8 -*-
"""
MAYBE: DUPLICATES: #449
NOTE: traceback2 (backport for Python2) solves the problem.
def foo(stop):
raise Exception(u"по русски")
Result:
File "features/steps/steps.py", line 8, in foo
raise Exception(u"по ����ки") <-- This is not
Exception: по русски... | Abdoctor/behave | tests/issues/test_issue0453.py | Python | bsd-2-clause | 2,081 |
"""
Django migrations for django-avatar app
This package does not contain South migrations. South migrations can be found
in the ``south_migrations`` package.
"""
SOUTH_ERROR_MESSAGE = """\n
For South support, customize the SOUTH_MIGRATION_MODULES setting like so:
SOUTH_MIGRATION_MODULES = {
'django-ava... | imgmix/django-avatar | avatar/migrations/__init__.py | Python | bsd-3-clause | 608 |
#!/usr/bin/env python
import sys
import os
from subprocess import *
if len(sys.argv) <= 1:
print('Usage: {0} training_file [testing_file]'.format(sys.argv[0]))
raise SystemExit
# svm, grid, and gnuplot executable files
is_win32 = (sys.platform == 'win32')
if not is_win32:
svmscale_exe = "/Users/sun/bin/svm-sc... | kfieldho/SMQTK | TPL/libsvm-3.1-custom/tools/easy.py | Python | bsd-3-clause | 2,835 |
"""
sentry.plugins.sentry_useragents.models
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2013 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
import httpagentparser
import sentry
from django.utils.translation import ugettext_lazy as _
from sentry.plu... | beni55/sentry | src/sentry/plugins/sentry_useragents/models.py | Python | bsd-3-clause | 2,383 |
from __future__ import unicode_literals
import warnings
from django.db import models
from django.test import TestCase, override_settings
from django.utils import six
class FieldDeconstructionTests(TestCase):
"""
Tests the deconstruct() method on all core fields.
"""
def test_name(self):
"""... | oscaro/django | tests/field_deconstruction/tests.py | Python | bsd-3-clause | 17,552 |
"""
Template for the Chebyshev and Polynomial classes.
This module houses a Python string module Template object (see, e.g.,
http://docs.python.org/library/string.html#template-strings) used by
the `polynomial` and `chebyshev` modules to implement their respective
`Polynomial` and `Chebyshev` classes. It provides a m... | teoliphant/numpy-refactor | numpy/polynomial/polytemplate.py | Python | bsd-3-clause | 21,267 |
from django import forms
from django.contrib import admin
from django.utils.translation import ugettext
from django.contrib.auth.admin import UserAdmin
from django.contrib.admin.sites import NotRegistered
from django.contrib.auth.models import User, Group, Permission
from django.contrib.admin.widgets import FilteredSel... | vongochung/ngudan | permission_backend_nonrel/admin.py | Python | bsd-3-clause | 5,050 |
"""
* Restitutions
*
* by Ricard Marxer
*
* This example shows how the restitution coefficients works.
"""
from fisica import Fisica, FWorld, FCircle
world = None
ballCount = 10
def setup():
global world
size(400, 400)
smooth()
Fisica.init(this)
world = FWorld()
world.setEdges(... | YatharthROCK/agar | libraries/processing.py-0202-macosx/examples.py/Fisica/restitutions.py | Python | mit | 851 |
# Tweepy
# Copyright 2009-2010 Joshua Roesslein
# See LICENSE for details.
from tweepy.error import TweepError
from tweepy.utils import parse_datetime, parse_html_value, parse_a_href
class ResultSet(list):
"""A list like object that holds results from a Twitter API query."""
def __init__(self, max_id=None, s... | dtkelch/Tagger | tweepy/tweepy/models.py | Python | mit | 12,645 |
# This is a sample configuration file for an ISAPI filter and extension
# written in Python.
#
# Please see README.txt in this directory, and specifically the
# information about the "loader" DLL - installing this sample will create
# "_redirector_with_filter.dll" in the current directory. The readme explains
# this.
... | sserrot/champion_relationships | venv/Lib/site-packages/isapi/samples/redirector_with_filter.py | Python | mit | 6,630 |
import os
import sys
from time import time as clock
from rpython.rlib import jit
from rpython.rlib import rrandom
from rpython.jit.codewriter.policy import JitPolicy
# The regex is built up from a combination individual Regex objects.
# Each is responsiblef for implementing a specific operator.
class Regex(object... | perkinslr/pypyjs | tools/rematcher.py | Python | mit | 4,972 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
r_mapcalc.py
------------
Date : February 2016
Copyright : (C) 2016 by Médéric Ribreux
Email : medspx at medspx dot fr
**********************************... | dwadler/QGIS | python/plugins/processing/algs/grass7/ext/r_mapcalc.py | Python | gpl-2.0 | 2,550 |
# Copyright 2005-2006 Daniel Henninger <jadestorm@nc.rr.com>
# Licensed for distribution under the GPL version 2, check COPYING for details
import utils
from twisted.internet import reactor
from twisted.words.xish.domish import Element
import jabw
import config
from debug import LogEvent, INFO, WARN, ERROR
import lang... | Alwnikrotikz/pyicqt | src/contact.py | Python | gpl-2.0 | 9,153 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
test_qgsrulebasedrenderer.py
---------------------
Date : September 2015
Copyright : (C) 2015 by Matthias Kuhn
Email : matthias at opengis dot ch
*******... | rduivenvoorde/QGIS | tests/src/python/test_qgsrulebasedrenderer.py | Python | gpl-2.0 | 23,130 |
import re
import struct
from ubifs.defines import *
from ubifs import nodes
from ubifs.nodes import extract
from ubifs.log import log
class ubifs:
def __init__(self, ubifs_file):
self.log = log()
self._file = ubifs_file
self._sb_node = extract.sb_node(self, UBIFS_COMMON_HDR_SZ)... | n3wb13/OpenNfrGui-5.0-1 | lib/python/Plugins/Extensions/NFR4XBoot/ubi_reader/ubifs/__init__.py | Python | gpl-2.0 | 2,189 |
#! /usr/bin/env python2.5
import sys, time
from mouseInteractor import MouseInteractor
try:
from OpenGL.GLUT import *
from OpenGL.GL import *
from OpenGL.GLU import *
except:
print ''' Error: PyOpenGL nicht intalliert !!'''
sys.exit()
import grind
mesh = None
mesh_subd = None
subdivider = None
prev_t = 0
mesh_s... | mstreatfield/anim-studio-tools | grind/tests/integration/test_mesh_subdivide.py | Python | gpl-3.0 | 4,366 |
# coding=utf-8
"""Unittest for Earthquake Report."""
import os
import io
import shutil
import unittest
from jinja2.environment import Template
from qgis.core import QgsCoordinateReferenceSystem
from safe.definitions.constants import ANALYSIS_SUCCESS, INASAFE_TEST
from safe.definitions.reports.components import (
... | AIFDR/inasafe | safe/report/test/test_impact_report_earthquake.py | Python | gpl-3.0 | 10,484 |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2014-2015 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser 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 S... | Kingdread/qutebrowser | qutebrowser/commands/userscripts.py | Python | gpl-3.0 | 12,321 |
"""
Tests for permissions defined in courseware.rules
"""
import ddt
import six
from django.test import TestCase
from opaque_keys.edx.locator import CourseLocator
from course_modes.tests.factories import CourseModeFactory
from student.models import CourseEnrollment
from student.tests.factories import UserFactory
@... | cpennington/edx-platform | lms/djangoapps/courseware/tests/test_rules.py | Python | agpl-3.0 | 1,680 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2013 Cubic ERP - Teradata SAC (<http://cubicerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the... | titasakgm/brc-stock | openerp/addons/base_report/__openerp__.py | Python | agpl-3.0 | 1,858 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
import model_utils.fields
class Migration(migrations.Migration):
dependencies = [
('student', '0010_auto_20170207_0458'),
]
operations = [
migrations.Cre... | lduarte1991/edx-platform | openedx/core/djangoapps/schedules/migrations/0001_initial.py | Python | agpl-3.0 | 1,410 |
# Amara, universalsubtitles.org
#
# Copyright (C) 2015 Participatory Culture Foundation
#
# 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 op... | norayr/unisubs | utils/breadcrumbs.py | Python | agpl-3.0 | 1,063 |
"""Test of models for embargo app"""
import json
import pytest
from django.db.utils import IntegrityError
from django.test import TestCase
from opaque_keys.edx.locator import CourseLocator
from openedx.core.djangolib.testing.utils import CacheIsolationTestCase
from ..models import (
Country,
CountryAccessRu... | eduNEXT/edx-platform | openedx/core/djangoapps/embargo/tests/test_models.py | Python | agpl-3.0 | 12,595 |
#!/usr/bin/env python
import json
my_list = range(10)
my_list.append('whatever')
my_list.append('some thing')
my_dict = {
'key1': 'val1',
'key2': 'val2',
'key3': 'val3'
}
my_dict['key4'] = my_list
my_dict['key5'] = False
print my_dict
print json.dumps(my_dict)
with open("my_file.json", "w") as f:
json.du... | ktbyers/pynet-ons-mar17 | json_yaml/json_test.py | Python | apache-2.0 | 335 |
# 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... | memo/tensorflow | tensorflow/contrib/data/python/kernel_tests/zip_dataset_op_test.py | Python | apache-2.0 | 4,387 |
# Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: dan@reciprocitylabs.com
# Maintained By: dan@reciprocitylabs.com
from ggrc import db
from ggrc.models.mixins import (
Base, Titled, Described,... | vladan-m/ggrc-core | src/ggrc_workflows/models/cycle_task_group_object.py | Python | apache-2.0 | 2,917 |
# Copyright 2016 Pinterest, 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 writi... | pinterest/teletraan | deploy-board/deploy_board/webapp/helpers/placements_helper.py | Python | apache-2.0 | 1,467 |
# Copyright 2014 OpenStack Foundation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | paramite/blazar | climate/db/migration/alembic_migrations/versions/23d6240b51b2_add_status_to_leases.py | Python | apache-2.0 | 1,737 |
import os
import shakedown
DEFAULT_NODE_COUNT = 3
PACKAGE_NAME = 'mds-cassandra'
TASK_RUNNING_STATE = 'TASK_RUNNING'
DCOS_URL = shakedown.run_dcos_command('config show core.dcos_url')[0].strip()
# expected SECURITY values: 'permissive', 'strict', 'disabled'
if os.environ.get('SECURITY', '') == 'strict':
print('... | akshitjain/dcos-cassandra-service | integration/tests/defaults.py | Python | apache-2.0 | 678 |
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under... | cernops/ceilometer | ceilometer/meter/notifications.py | Python | apache-2.0 | 12,538 |
# -*- coding: utf-8 -*-
# Copyright 2013 Mirantis, 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 requi... | nebril/fuel-web | nailgun/nailgun/test/integration/test_node_allocation_stats_handler.py | Python | apache-2.0 | 1,552 |
from __future__ import unicode_literals
from .responses import APIGatewayResponse
url_bases = [
"https?://apigateway.(.+).amazonaws.com"
]
url_paths = {
'{0}/restapis$': APIGatewayResponse().restapis,
'{0}/restapis/(?P<function_id>[^/]+)/?$': APIGatewayResponse().restapis_individual,
'{0}/restapis/(?P... | Brett55/moto | moto/apigateway/urls.py | Python | apache-2.0 | 2,102 |
"""This service implements all base functions of the ontology graph as a REST
service. The three key functions that most ontology methods rely on are
child_rel, parent_rel, and get_node_property. There are a few other bookkeeping
functions that also need to be implemented here since they access ontology
attributes dire... | johnbachman/indra | indra/ontology/app/app.py | Python | bsd-2-clause | 2,290 |
__author__ = 'tkral'
| timkral/horn | heimdall/setup/__init__.py | Python | bsd-3-clause | 21 |
from django.shortcuts import render, redirect, get_object_or_404
from django.contrib import messages
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.contrib.auth.decorators import permission_required
from django.core.exceptions import PermissionDenied
from django.utils.translation i... | helenwarren/pied-wagtail | wagtail/wagtaildocs/views/documents.py | Python | bsd-3-clause | 5,054 |
#!/bin/env python
"""
This file defines a set of system_info classes for getting
information about various resources (libraries, library directories,
include directories, etc.) in the system. Currently, the following
classes are available:
atlas_info
atlas_threads_info
atlas_blas_info
atlas_blas_threads_info
... | dwillmer/numpy | numpy/distutils/system_info.py | Python | bsd-3-clause | 85,113 |
"""test building messages with streamsession"""
#-------------------------------------------------------------------------------
# Copyright (C) 2011 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of this software.
#-... | WillisXChen/django-oscar | oscar/lib/python2.7/site-packages/IPython/kernel/zmq/tests/test_session.py | Python | bsd-3-clause | 12,721 |
from __future__ import print_function, division
from sympy.core.add import Add
from sympy.core.expr import Expr
from sympy.core.mul import Mul
from sympy.core.relational import Equality
from sympy.sets.sets import Interval
from sympy.core.singleton import S
from sympy.core.symbol import Symbol
from sympy.core.sympify ... | vipulroxx/sympy | sympy/concrete/expr_with_limits.py | Python | bsd-3-clause | 14,916 |
#!/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.
"""
This file emits the list of reasons why a particular build needs to be clobbered
(or a list of 'landmines').
"""
import sys
impor... | SaschaMester/delicium | build/get_landmines.py | Python | bsd-3-clause | 3,458 |
from django.core.exceptions import ValidationError
def validate_no_spaces(value):
if ' ' in value:
raise ValidationError('System name cannot contain spaces.')
| drkitty/cyder | cyder/core/system/validators.py | Python | bsd-3-clause | 173 |
# -*- coding: utf-8 -*-
##############################################################################
# 2013 E2OpenPlugins #
# #
# This file is open source software; you can redistribute... | MDXDave/ModernWebif | plugin/controllers/ER.py | Python | gpl-2.0 | 2,362 |
#!/usr/bin/python
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed... | rmfitzpatrick/ansible | lib/ansible/modules/cloud/amazon/iam_policy.py | Python | gpl-3.0 | 14,001 |
#!/usr/bin/env python
#
# Copyright (C) 2009-2012:
# Gabes Jean, naparuba@gmail.com
# Gerhard Lausser, Gerhard.Lausser@consol.de
# David GUENAULT, dguenault@monitoring-fr.org
#
# This file is part of Shinken.
#
# Shinken is free software: you can redistribute it and/or modify
# it under the terms of the GNU Af... | xorpaul/shinken | windows/Tools/Charp_Services/Shinken_Services/install.d/tools/skonf.py | Python | agpl-3.0 | 35,347 |
"""Conditional module is the xmodule, which you can use for disabling
some xmodules by conditions.
"""
import json
import logging
from lxml import etree
from pkg_resources import resource_string
from xmodule.x_module import XModule
from xmodule.modulestore import Location
from xmodule.seq_module import SequenceDescri... | IITBinterns13/edx-platform-dev | common/lib/xmodule/xmodule/conditional_module.py | Python | agpl-3.0 | 9,200 |
# Copyright 2017 Capital One Services, LLC
#
# 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... | FireballDWF/cloud-custodian | tools/c7n_mailer/c7n_mailer/datadog_delivery.py | Python | apache-2.0 | 4,461 |
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | tensorflow/tensorflow | tensorflow/python/tpu/tpu_embedding_v2_utils_test.py | Python | apache-2.0 | 4,791 |
def foo(x: int):
pass
| IllusionRom-deprecated/android_platform_tools_idea | python/testData/formatter/spaceInAnnotations_after.py | Python | apache-2.0 | 26 |
import abc
from framework.auth.decorators import collect_auth
from website.util import api_url_for, web_url_for
class AddonSerializer(object):
__metaclass__ = abc.ABCMeta
# TODO take addon_node_settings, addon_user_settings
def __init__(self, node_settings=None, user_settings=None):
self.node_se... | billyhunt/osf.io | website/addons/base/serializer.py | Python | apache-2.0 | 7,369 |
#
# [The "BSD license"]
# Copyright (c) 2012 Terence Parr
# Copyright (c) 2012 Sam Harwell
# Copyright (c) 2014 Eric Vergnaud
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redis... | cocosli/antlr4 | runtime/Python3/src/antlr4/PredictionContext.py | Python | bsd-3-clause | 24,709 |
from django.conf import settings
from django.core.cache import get_cache
from django.db.models.fields.files import ImageField
from livesettings import config_value
from satchmo_utils.thumbnail.text import URLify
#ensure config is loaded
import satchmo_utils.thumbnail.config
import fnmatch
import logging
import os
imp... | grengojbo/satchmo | satchmo/apps/satchmo_utils/thumbnail/utils.py | Python | bsd-3-clause | 9,086 |
from __future__ import absolute_import
import logging
import six
import threading
from collections import defaultdict
from sentry.debug.utils.patch_context import PatchContext
DEFAULT_MAX_QUERIES = 25
DEFAULT_MAX_DUPES = 3
class State(threading.local):
def __init__(self):
self.count = 0
self.q... | JackDanger/sentry | src/sentry/utils/performance/sqlquerycount.py | Python | bsd-3-clause | 3,221 |
#!/usr/bin/env python3
# Copyright 2021 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.
# This is generated, do not edit. Update BuildConfigGenerator.groovy and
# 3ppFetch.template instead.
import argparse
import json
imp... | chromium/chromium | third_party/android_deps/libs/com_android_support_documentfile/3pp/fetch.py | Python | bsd-3-clause | 2,497 |
from django.core.management import BaseCommand
from newsfeed.models import Entry
from premises.models import Contention
class Command(BaseCommand):
def handle(self, *args, **options):
for contention in Contention.objects.all():
Entry.objects.create(
object_id=contention.id,
... | beratdogan/arguman.org | web/newsfeed/management/commands/create_initial_newsfeed.py | Python | mit | 557 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.