repo_name
stringlengths
6
100
path
stringlengths
4
294
copies
stringlengths
1
5
size
stringlengths
4
6
content
stringlengths
606
896k
license
stringclasses
15 values
erickt/hue
desktop/core/ext-py/Django-1.6.10/tests/wsgi/tests.py
57
3341
from __future__ import unicode_literals from django.core.exceptions import ImproperlyConfigured from django.core.servers.basehttp import get_internal_wsgi_application from django.core.signals import request_started from django.core.wsgi import get_wsgi_application from django.db import close_old_connections from djang...
apache-2.0
nicholas-leonard/hyperopt
hyperopt/pyll/tests/test_stochastic.py
5
2032
import numpy as np from hyperopt.pyll import scope, as_apply, dfs, rec_eval from hyperopt.pyll.stochastic import * def test_recursive_set_rng_kwarg(): uniform = scope.uniform a = as_apply([uniform(0, 1), uniform(2, 3)]) rng = np.random.RandomState(234) recursive_set_rng_kwarg(a, rng) print(a) v...
bsd-3-clause
TakashiMatsuda/sag_svm
scaling.py
1
1287
#!/Users/takashi/.pyenv/shims/python import numpy as np import math def scaling(data): """ Scaling. Make x's average to 0, variance to 1 => CHANGED. Divide by normal deviation """ print("input:") print(data) scaled_data = np.zeros_like(data) """ average section """...
mit
rhdedgar/openshift-tools
openshift/installer/vendored/openshift-ansible-3.7.0/roles/lib_openshift/library/oc_adm_policy_user.py
2
71554
#!/usr/bin/env python # pylint: disable=missing-docstring # flake8: noqa: T001 # ___ ___ _ _ ___ ___ _ _____ ___ ___ # / __| __| \| | __| _ \ /_\_ _| __| \ # | (_ | _|| .` | _|| / / _ \| | | _|| |) | # \___|___|_|\_|___|_|_\/_/_\_\_|_|___|___/_ _____ # | \ / _ \ | \| |/ _ \_ _| | __| \_ ...
apache-2.0
watonyweng/nova
nova/objects/base.py
14
21945
# 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 by applicable law or agree...
apache-2.0
Lautitia/newfies-dialer
newfies/common_functions.py
4
1480
# # Newfies-Dialer License # http://www.newfies-dialer.org # # 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/. # # Copyright (C) 2011-2014 Star2Billing S.L. # # The Initia...
mpl-2.0
emilio/servo
tests/wpt/web-platform-tests/tools/pywebsocket/example/echo_wsh.py
494
2197
# Copyright 2011, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the f...
mpl-2.0
rohitwaghchaure/erpnext_develop
erpnext/manufacturing/doctype/bom_update_tool/bom_update_tool.py
4
2240
# -*- coding: utf-8 -*- # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors # For license information, please see license.txt from __future__ import unicode_literals import frappe from frappe.utils import cstr, flt from frappe import _ from erpnext.manufacturing.doctype.bom.bom import get_boms_in_bott...
gpl-3.0
hwu25/AppPkg
Applications/Python/Python-2.7.2/Lib/encodings/iso8859_16.py
93
14120
""" Python Character Mapping Codec iso8859_16 generated from 'MAPPINGS/ISO8859/8859-16.TXT' with gencodec.py. """#" import codecs ### Codec APIs class Codec(codecs.Codec): def encode(self,input,errors='strict'): return codecs.charmap_encode(input,errors,encoding_table) def decode(self...
bsd-2-clause
edx/edx-app-ios
Pods/NewRelicAgent/NewRelic.xcframework/Resources/requests/adapters.py
79
21344
# -*- coding: utf-8 -*- """ requests.adapters ~~~~~~~~~~~~~~~~~ This module contains the transport adapters that Requests uses to define and maintain connections. """ import os.path import socket from urllib3.poolmanager import PoolManager, proxy_from_url from urllib3.response import HTTPResponse from urllib3.util ...
apache-2.0
avoinsystems/odoo
openerp/addons/base/res/__init__.py
384
1261
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU...
agpl-3.0
synconics/odoo
addons/edi/__init__.py
437
1157
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Business Applications # Copyright (c) 2011 OpenERP S.A. <http://openerp.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GN...
agpl-3.0
xiami9916057/volatility
volatility/plugins/linux/pstree.py
50
1893
# This file is part of Volatility. # Copyright (C) 2007-2013 Volatility Foundation # # Volatility is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any late...
gpl-2.0
pwong-mapr/private-hue
desktop/core/ext-py/Django-1.4.5/django/contrib/gis/geoip/tests.py
80
4670
import os from django.conf import settings from django.contrib.gis.geos import GEOSGeometry from django.contrib.gis.geoip import GeoIP, GeoIPException from django.utils import unittest # Note: Requires use of both the GeoIP country and city datasets. # The GEOIP_DATA path should be the only setting set (the directory ...
apache-2.0
damianmoore/django-cms
cms/migrations/0038_publish_page_permission.py
15
16221
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import DataMigration from django.db import models try: from django.contrib.auth import get_user_model except ImportError: # django < 1.5 from django.contrib.auth.models import User else: User = get_user_model() user_orm_label = ...
bsd-3-clause
zerobatu/edx-platform
cms/djangoapps/contentstore/views/tests/test_container_page.py
158
9232
""" Unit tests for the container page. """ import re import datetime from pytz import UTC from mock import patch, Mock from django.http import Http404 from django.test.client import RequestFactory from django.utils import http import contentstore.views.component as views from contentstore.views.tests.utils import Stu...
agpl-3.0
supriyantomaftuh/django
django/contrib/auth/management/commands/changepassword.py
149
2610
from __future__ import unicode_literals import getpass from django.contrib.auth import get_user_model from django.contrib.auth.password_validation import validate_password from django.core.exceptions import ValidationError from django.core.management.base import BaseCommand, CommandError from django.db import DEFAULT...
bsd-3-clause
timestocome/Test-stock-prediction-algorithms
StockMarketLinearRegression/PredictGold.py
2
3318
# http://github.com/timestocome # Attempt to predict gold prices and find outliers # http://web.ipac.caltech.edu/staff/fmasci/home/astro_refs/TestForRandomness_RunsTest.pdf import numpy as np import pandas as pd import matplotlib.pyplot as plt ####################################################################...
mit
ashray/VTK-EVM
Accelerators/Piston/Testing/Python/TestSlice.py
21
2735
#!/usr/bin/env python """ This tests VTK's use of Piston's slice operator. """ import sys import vtk from vtk.test import Testing from PistonTestCommon import * def widgetCallBack(obj,event): global plane, filter obj.GetPlane(plane) filter.Update() #TODO: Why is this necessary? class TestSlice(Testi...
bsd-3-clause
tszym/ansible
lib/ansible/modules/windows/win_regedit.py
18
6352
#!/usr/bin/python # -*- coding: utf-8 -*- # (c) 2015, Adam Keech <akeech@chathamfinancial.com>, Josh Ludwig <jludwig@chathamfinancial.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 Fr...
gpl-3.0
andyneff/voxel-globe
voxel_globe/build_voxel_world/tasks.py
1
6207
from voxel_globe.common_tasks import shared_task, VipTask from celery.utils.log import get_task_logger logger = get_task_logger(__name__) import logging import os @shared_task(base=VipTask, bind=True) def run_build_voxel_model(self, image_collection_id, scene_id, bbox, skip_frames, cleanup...
mit
qaisjp/mtasa-blue
vendor/freetype/builds/meson/extract_libtool_version.py
12
2521
#!/usr/bin/env python """Extract the libtool version from `configure.raw`. This script parses the `configure.raw` file to extract the libtool version number. By default, the full dotted version number is printed, but `--major`, `--minor` or `--patch` can be used to only print one of these values instead. """ from __...
gpl-3.0
Softmotions/edx-platform
lms/djangoapps/courseware/features/annotatable.py
158
3492
import textwrap from lettuce import world, steps from nose.tools import assert_in, assert_equals from common import i_am_registered_for_the_course, visit_scenario_item DATA_TEMPLATE = textwrap.dedent("""\ <annotatable> <instructions>Instruction text</instructions> <p>{}</p> </annotatable> """...
agpl-3.0
sunlightlabs/tcamp
tcamp/reg/forms.py
1
1825
from django import forms from localflavor.us.us_states import STATE_CHOICES from bootstrap_toolkit.widgets import BootstrapTextInput import datetime from reg.models import Sale, Ticket, AMBASSADOR_PROGRAM_CHOICES class SaleForm(forms.ModelForm): class Meta: model = Sale class TicketForm(forms.ModelForm):...
bsd-3-clause
bufferapp/buffer-django-nonrel
django/db/__init__.py
150
4304
from django.conf import settings from django.core import signals from django.core.exceptions import ImproperlyConfigured from django.db.utils import ConnectionHandler, ConnectionRouter, load_backend, DEFAULT_DB_ALIAS, \ DatabaseError, IntegrityError from django.utils.functional import curry ...
bsd-3-clause
schqiushui/Kernel_Lollipop_GPE5.1_M8ACE
Documentation/target/tcm_mod_builder.py
4981
41422
#!/usr/bin/python # The TCM v4 multi-protocol fabric module generation script for drivers/target/$NEW_MOD # # Copyright (c) 2010 Rising Tide Systems # Copyright (c) 2010 Linux-iSCSI.org # # Author: nab@kernel.org # import os, sys import subprocess as sub import string import re import optparse tcm_dir = "" fabric_ops...
gpl-2.0
ewheeler/vaxtrack
vaxapp/migrations/0018_auto__add_field_countrystockstats_days_of_stock_data.py
1
12586
# encoding: utf-8 import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding field 'CountryStockStats.days_of_stock_data' db.add_column('vaxapp_countrystockstats', 'days_of_s...
bsd-3-clause
kjagoo/wger_stark
wger/nutrition/tests/test_calories_calculator.py
2
6684
# This file is part of wger Workout Manager. # # wger Workout Manager is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # wger W...
agpl-3.0
9miao/Firefly
firefly/utils/services.py
8
4997
#coding:utf8 ''' Created on 2011-1-3 服务类 @author: sean_lan ''' import threading from twisted.internet import defer,threads from twisted.python import log class Service(object): """A remoting service attributes: ============ * name - string, service name. * runstyle """ SINGLE_STYL...
mit
hyokun31/wisekb-management-platform
wisekb-uima-ducc/bin/properties.py
2
8155
#!/usr/bin/python import os import re import platform import string # ----------------------------------------------------------------------- # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional informat...
apache-2.0
OpenMOOC/moocng
moocng/api/urls.py
1
2050
# -*- coding: utf-8 -*- # Copyright 2012-2013 UNED # # 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...
apache-2.0
georgekis/salary
main/control/pay.py
1
2523
from flask.ext import wtf import auth import flask import model import wtforms import util from main import app ############################################################################### # Create ############################################################################### class PayUpdateForm(wtf.Form): nam...
mit
postlund/pyatv
tests/scripts/script_env.py
1
4004
"""Simulated environment for functional script testing.""" from contextlib import contextmanager from importlib import import_module from io import StringIO import sys from unittest.mock import patch from aiohttp.test_utils import AioHTTPTestCase import pyatv from pyatv.const import Protocol from tests import fake_...
mit
goujonpa/jeankevin
modules/numberCoupleClass.py
1
2707
#!/usr/local/bin/python # -*-coding:Utf-8 -* from modules.individualClass import Individual import random class NumberCouple(Individual): """NumberCouple class: represent one couple of real individual, inherits from the Individual class Properties: key : standardized representation of the problem [[x1, ...
mit
FATruden/boto
boto/file/key.py
82
6867
# Copyright 2010 Google Inc. # Copyright (c) 2011, Nexenta Systems Inc. # # 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...
mit
tcr3dr/ardupilot-releases
Tools/LogAnalyzer/tests/TestVCC.py
218
1278
from LogAnalyzer import Test,TestResult import DataflashLog import collections class TestVCC(Test): '''test for VCC within recommendations, or abrupt end to log in flight''' def __init__(self): Test.__init__(self) self.name = "VCC" def run(self, logdata, verbose): self.result = ...
gpl-3.0
geekboxzone/lollipop_external_chromium_org
third_party/closure_linter/closure_linter/javascripttokens.py
266
4955
#!/usr/bin/env python # # Copyright 2008 The Closure Linter 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 #...
bsd-3-clause
DavidNorman/tensorflow
tensorflow/lite/toco/python/toco_from_protos_test.py
7
3877
# 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...
apache-2.0
mancoast/CPythonPyc_test
cpython/271_test_cpickle.py
35
3995
import cPickle, unittest from cStringIO import StringIO from test.pickletester import AbstractPickleTests, AbstractPickleModuleTests from test.pickletester import AbstractPicklerUnpicklerObjectTests from test import test_support class cPickleTests(AbstractPickleTests, AbstractPickleModuleTests): def setUp(self): ...
gpl-3.0
benoitsteiner/tensorflow-opencl
tensorflow/python/framework/test_util.py
2
44238
# 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...
apache-2.0
ryfeus/lambda-packs
Tensorflow_OpenCV_Nightly/source/google/protobuf/internal/message_set_extensions_pb2.py
6
8404
# Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/protobuf/internal/message_set_extensions.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from goo...
mit
apocalypsebg/odoo
addons/project/wizard/__init__.py
381
1075
# -*- 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...
agpl-3.0
linked67/p2pool-exclusivecoin
wstools/TimeoutSocket.py
293
5293
"""Based on code from timeout_socket.py, with some tweaks for compatibility. These tweaks should really be rolled back into timeout_socket, but it's not totally clear who is maintaining it at this point. In the meantime, we'll use a different module name for our tweaked version to avoid any confusion. T...
gpl-3.0
mkaluza/external_chromium_org
third_party/jinja2/visitor.py
1401
3316
# -*- coding: utf-8 -*- """ jinja2.visitor ~~~~~~~~~~~~~~ This module implements a visitor for the nodes. :copyright: (c) 2010 by the Jinja Team. :license: BSD. """ from jinja2.nodes import Node class NodeVisitor(object): """Walks the abstract syntax tree and call visitor functions for every...
bsd-3-clause
simonlynen/or-tools
examples/python/data/nonogram_regular/nonogram_p199.py
74
1527
# Copyright 2010 Hakan Kjellerstrand hakank@bonetmail.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.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
apache-2.0
xz/cyber-security
api/api/routes/autogen.py
10
1692
from flask import Flask, request, session, send_from_directory, render_template from flask import Blueprint import api import json import mimetypes import os.path from datetime import datetime from api.common import WebSuccess, WebError from api.annotations import api_wrapper, require_login, require_teacher, require_a...
mit
albertomurillo/ansible
test/units/executor/test_task_queue_manager_callbacks.py
29
4530
# (c) 2016, Steve Kuznetsov <skuznets@redhat.com> # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later v...
gpl-3.0
moijes12/oh-mainline
vendor/packages/scrapy/scrapy/utils/request.py
25
3547
""" This module provides some useful functions for working with scrapy.http.Request objects """ import hashlib import weakref from urlparse import urlunparse from twisted.internet.defer import Deferred from w3lib.http import basic_auth_header from scrapy.utils.url import canonicalize_url from scrapy.utils.httpobj im...
agpl-3.0
sc68cal/GAE-Django
appengine_django/serializer/pyyaml.py
40
1585
#!/usr/bin/python2.4 # # Copyright 2009 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...
apache-2.0
vitan/django
django/contrib/messages/storage/base.py
526
6285
from __future__ import unicode_literals from django.conf import settings from django.contrib.messages import constants, utils from django.utils.encoding import force_text, python_2_unicode_compatible LEVEL_TAGS = utils.get_level_tags() @python_2_unicode_compatible class Message(object): """ Represents an ac...
bsd-3-clause
makerhanoi/tagio
tagio/views/api/__init__.py
1
1249
"""API.""" from flask import Blueprint, jsonify, request from tagio.models.user import User from tagio.extensions import csrf_protect from . import user __all__ = ('user',) blueprint = Blueprint('api', __name__, url_prefix='/api/v<string:version>') @blueprint.route('/l...
bsd-3-clause
grandamp/certificate-transparency
python/utilities/log_list/java_generator.py
30
3064
import datetime import textwrap import base64 def _write_java_header(output, package): year = datetime.date.today().year output.write( "/*\n" " * Copyright (C) %(year)d The Android Open Source Project\n" " *\n" " * Licensed under the Apache License, Version 2.0 (the \"License\")...
apache-2.0
msebire/intellij-community
python/helpers/py3only/docutils/writers/odf_odt/pygmentsformatter.py
244
4671
# $Id: pygmentsformatter.py 5853 2009-01-19 21:02:02Z dkuhlman $ # Author: Dave Kuhlman <dkuhlman@rexx.com> # Copyright: This module has been placed in the public domain. """ Additional support for Pygments formatter. """ import pygments import pygments.formatter class OdtPygmentsFormatter(pygments.formatter.For...
apache-2.0
Immortalin/python-for-android
python-build/python-libs/gdata/build/lib/atom/url.py
280
4277
#!/usr/bin/python # # Copyright (C) 2008 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 ...
apache-2.0
ville-k/tensorflow
tensorflow/contrib/keras/python/keras/layers/convolutional_recurrent_test.py
53
5831
# 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...
apache-2.0
jedbarlow/dia
plug-ins/python/scascale.py
10
4424
# PyDia Simple Scale # Copyright (c) 2003, Hans Breuer <hans@breuer.org> # # Experimental scaleing (selected) Objects via property api # # Known Issues: # - HANDLE_NON_MOVEABLE ? # - bezier control points # - unsizeable objects (or sizeable via multiple text size changing, e.g. UML Class) # # This program is free ...
gpl-2.0
balister/gnuradio
gr-digital/python/digital/qa_binary_slicer_fb.py
57
1914
#!/usr/bin/env python # # Copyright 2011-2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio 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, or (at your opt...
gpl-3.0
oryxr/dxf2gcode
Core/Config.py
1
14468
# -*- coding: utf-8 -*- ############################################################################ # # Copyright (C) 2009-2014 # Christian Kohlöffel # Jean-Paul Schouwstra # # This file is part of DXF2GCODE. # # DXF2GCODE is free software: you can redistribute it and/or modify # it under the terms of t...
gpl-3.0
agusc/scrapy
scrapy/commands/settings.py
114
1503
from __future__ import print_function from scrapy.commands import ScrapyCommand class Command(ScrapyCommand): requires_project = False default_settings = {'LOG_ENABLED': False} def syntax(self): return "[options]" def short_desc(self): return "Get settings values" def add_option...
bsd-3-clause
weld-project/weld
weld-python/weld/grizzly/weld/str.py
2
12446
""" String functions exported as weldfuncs. Each function takes an argument representing an array of strings, and outputs a program that applies some transformation on each string. The functions are annotated with `weld.lazy.weldfunc`, so they accept `WeldLazy` objects and return functions for constructing Weld progra...
bsd-3-clause
diegospc/pyafipws
tests/wscdc.py
16
3077
#!/usr/bin/python # -*- coding: utf8 -*- # 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, or (at your option) any later # version. # # This program is distributed in the hope th...
gpl-3.0
EdDev/vdsm
tests/storage_check_test.py
1
15159
# # Copyright 2016 Red Hat, 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 of the License, or # (at your option) any later version. # # This program is distributed in th...
gpl-2.0
jseabold/scikit-learn
sklearn/linear_model/tests/test_omp.py
272
7752
# Author: Vlad Niculae # Licence: BSD 3 clause import numpy as np from sklearn.utils.testing import assert_raises from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_array_almost_equa...
bsd-3-clause
Work4Labs/lettuce
tests/integration/lib/Django-1.2.5/tests/regressiontests/model_regress/models.py
121
1683
# coding: utf-8 from django.db import models CHOICES = ( (1, 'first'), (2, 'second'), ) class Article(models.Model): headline = models.CharField(max_length=100, default='Default headline') pub_date = models.DateTimeField() status = models.IntegerField(blank=True, null=True, choices=CHOICES) m...
gpl-3.0
proversity-org/edx-platform
common/lib/xmodule/xmodule/modulestore/search.py
18
5844
''' useful functions for finding content and its position ''' from logging import getLogger from .exceptions import (ItemNotFoundError, NoPathToItem) LOGGER = getLogger(__name__) def path_to_location(modulestore, usage_key, full_path=False): ''' Try to find a course_id/chapter/section[/position] path to loc...
agpl-3.0
OriHoch/Open-Knesset
laws/listeners.py
5
3362
# encoding: utf-8 from django.db.models.signals import m2m_changed, post_save from django.contrib.contenttypes.models import ContentType from actstream import action from actstream.models import Action from tagging.models import TaggedItem from knesset.utils import cannonize, disable_for_loaddata from laws.models.bill...
bsd-3-clause
kholidfu/django
django/contrib/gis/geos/prototypes/errcheck.py
486
2954
""" Error checking functions for GEOS ctypes prototype functions. """ from ctypes import c_void_p, string_at from django.contrib.gis.geos.error import GEOSException from django.contrib.gis.geos.libgeos import GEOSFuncFactory # Getting the `free` routine used to free the memory allocated for # string pointers returne...
bsd-3-clause
jicksy/oneanddone_test
vendor-local/lib/python/mptt/managers.py
4
42656
""" A custom manager for working with trees of objects. """ from __future__ import unicode_literals import contextlib from django.db import models, transaction, connections, router from django.db.models import F, Max, Q from django.utils.translation import ugettext as _ from mptt.exceptions import CantDisableUpdates,...
mpl-2.0
JioCloud/nova
nova/api/openstack/compute/plugins/v3/servers.py
6
51142
# Copyright 2010 OpenStack Foundation # Copyright 2011 Piston Cloud Computing, 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.apach...
apache-2.0
xodus7/tensorflow
tensorflow/python/tools/strip_unused_test.py
97
6993
# 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...
apache-2.0
sunqm/pyscf
pyscf/cc/test/test_bz.py
2
2117
#!/usr/bin/env python # Copyright 2014-2018 The PySCF Developers. 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 # # U...
apache-2.0
kenglishhi/gae-django-sandbox
django/contrib/gis/tests/geo3d/tests.py
36
11376
import os, re, unittest from django.contrib.gis.db.models import Union, Extent3D from django.contrib.gis.geos import GEOSGeometry, Point, Polygon from django.contrib.gis.utils import LayerMapping, LayerMapError from models import City3D, Interstate2D, Interstate3D, \ InterstateProj2D, InterstateProj3D, \ Point...
apache-2.0
kushankr/approval_frame
approval_frame/urls.py
1
1127
from django.conf.urls import include, patterns, url from django.contrib import admin from approval_frame import views from views import CustomRegistrationView # autodiscover is required only for older versions of Django admin.autodiscover() urlpatterns = patterns( '', url(r'^approval_polls/', include('approv...
gpl-3.0
Dellware78/mtasa-blue
vendor/google-breakpad/src/tools/gyp/test/generator-output/gyptest-actions.py
198
2019
#!/usr/bin/env python # Copyright (c) 2012 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ Verifies --generator-output= behavior when using actions. """ import TestGyp # Android doesn't support --generator-output. test = Test...
gpl-3.0
fheinle/Photoblog
gdata/Crypto/Util/test.py
228
18297
# # test.py : Functions used for testing the modules # # Part of the Python Cryptography Toolkit # # Distribute and use freely; there are no restrictions on further # dissemination and usage except those imposed by the laws of your # country of residence. This software is provided "as is" without # warranty of fitn...
gpl-3.0
jazzabeanie/python_koans
python2/koans/about_comprehension.py
70
2244
#!/usr/bin/env python # -*- coding: utf-8 -*- from runner.koan import * class AboutComprehension(Koan): def test_creating_lists_with_list_comprehensions(self): feast = ['lambs', 'sloths', 'orangutans', 'breakfast cereals', 'fruit bats'] comprehension = [delicacy.capitalize() for de...
mit
kirchnerlab/libtemplate
test/memtest.py
4
5039
#!/usr/bin/python # run valgrind's memory error checker on all tests. # filter uninteresting errors and known false positives # # # This file is based on kdevplatform/veritas/tests/runMemcheck.py # by the KDevelop project, www.kdevelop.org # from os import system, remove, environ, defpath, path, pathsep, X_OK, access...
mit
boundary/boundary-api-cli
boundary/plugin_base.py
4
1272
# # Copyright 2015 BMC Software, 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 ...
apache-2.0
jnewland/home-assistant
homeassistant/components/qnap/sensor.py
7
13548
"""Support for QNAP NAS Sensors.""" import logging from datetime import timedelta import voluptuous as vol from homeassistant.components.sensor import PLATFORM_SCHEMA from homeassistant.helpers.entity import Entity from homeassistant.const import ( CONF_HOST, CONF_USERNAME, CONF_PASSWORD, CONF_PORT, CONF_SSL, ATT...
apache-2.0
NeverDecaf/syncplay
syncplay/messages_de.py
1
38136
# coding:utf8 """Deutsch dictionary""" de = { "LANGUAGE": "Deutsch", # (German) # Client notifications "config-cleared-notification": "Einstellungen gelöscht. Änderungen werden gespeichert, wenn du eine gültige Konfiguration speicherst.", "relative-config-notification": "Relative Konfigurationsdate...
apache-2.0
baslr/ArangoDB
3rdParty/V8/V8-5.0.71.39/build/gyp/test/copies/gyptest-all.py
100
1368
#!/usr/bin/env python # Copyright (c) 2009 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ Verifies file copies using an explicit build target of 'all'. """ import TestGyp test = TestGyp.TestGyp() test.run_gyp('copies.gyp', ...
apache-2.0
alexston/calibre-webserver
src/calibre/ebooks/mobi/debug/index.py
4
9479
#!/usr/bin/env python # vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai from __future__ import (unicode_literals, division, absolute_import, print_function) __license__ = 'GPL v3' __copyright__ = '2012, Kovid Goyal <kovid@kovidgoyal.net>' __docformat__ = 'restructuredtext en' import struct ...
gpl-3.0
z1gm4/desarrollo_web_udp
env/lib/python2.7/site-packages/django/test/utils.py
178
20899
import logging import re import sys import time import warnings from contextlib import contextmanager from functools import wraps from unittest import skipIf, skipUnless from xml.dom.minidom import Node, parseString from django.apps import apps from django.conf import UserSettingsHolder, settings from django.core impo...
gpl-3.0
payne/sqlparse
sqlparse/formatter.py
118
5113
# Copyright (C) 2008 Andi Albrecht, albrecht.andi@gmail.com # # This module is part of python-sqlparse and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php. """SQL formatter""" from sqlparse import filters from sqlparse.exceptions import SQLParseError def validate_options(opti...
bsd-3-clause
myself659/TeamTalk
win-client/3rdParty/src/json/doxybuild.py
136
6798
"""Script to generate doxygen documentation. """ import re import os import os.path import sys import shutil from devtools import tarball def find_program(*filenames): """find a program in folders path_lst, and sets env[var] @param filenames: a list of possible names of the program to search for @return: ...
apache-2.0
beiko-lab/gengis
bin/Lib/site-packages/numpy/lib/arraysetops.py
1
12374
""" Set operations for 1D numeric arrays based on sorting. :Contains: ediff1d, unique, intersect1d, setxor1d, in1d, union1d, setdiff1d :Notes: For floating point arrays, inaccurate results may appear due to usual round-off and floating point comparison issues. Speed could be gained in...
gpl-3.0
alxgu/ansible
lib/ansible/modules/cloud/azure/azure_rm_sqlserver_facts.py
14
6222
#!/usr/bin/python # # Copyright (c) 2017 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', ...
gpl-3.0
seed2014/kraken
kraken-panel/panel/models.py
1
2573
from django.db import models from django.utils import timezone from datetime import timedelta # Create your models here. class Bot(models.Model): computer_name = models.CharField(max_length=100) system = models.CharField(max_length=100) node = models.CharField(max_length=100) release = models.CharField(max_len...
gpl-2.0
ioannistsanaktsidis/invenio
modules/bibexport/lib/bibexport_method_marcxml.py
35
9151
# -*- coding: utf-8 -*- ## ## This file is part of Invenio. ## Copyright (C) 2009, 2010, 2011 CERN. ## ## Invenio is free software; you can redistribute it and/or ## modify it under the terms of the GNU General Public License as ## published by the Free Software Foundation; either version 2 of the ## License, or (at yo...
gpl-2.0
cbeighley/peregrine
tests/test_iqgen_msg_glo.py
2
4120
# Copyright (C) 2016 Swift Navigation Inc. # # Contact: Valeri Atamaniouk <valeri@swiftnav.com> # This source is subject to the license found in the file 'LICENSE' which must # be be distributed together with this source. All other rights reserved. # # THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF A...
gpl-3.0
DirectXMan12/nova-hacking
nova/openstack/common/db/sqlalchemy/models.py
5
3675
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright (c) 2011 X.commerce, a business unit of eBay Inc. # Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # Copyright 2011 Piston Cloud Computing, Inc. # Copyright 2012 Cloudscaling Gro...
apache-2.0
thewtex/tomviz
acquisition/tests/mock/__init__.py
3
1313
import diskcache import requests import tempfile import os from bisect import bisect_left url = 'https://data.kitware.com/api/v1/file' def angle_to_page(angle): if angle < -72 or angle > 73: return (None, None) angles = range(-73, 74, 2) index = bisect_left(angles, angle) return (index, an...
bsd-3-clause
ForestClaw/forestclaw
applications/geoclaw/tohoku/make_plots.py
1
11633
""" Set up the plot figures, axes, and items to be done for each frame. This module is imported by the plotting routines and then the function setplot is called to set the plot parameters. """ #-------------------------- def setplot(plotdata): #-------------------------- """ Specify what is to be plotted ...
bsd-2-clause
stone5495/NewsBlur
apps/analyzer/phrase_filter.py
20
3083
import re from pprint import pprint class PhraseFilter: def __init__(self): self.phrases = {} def run(self, text, storyid): chunks = self.chunk(text) self.count_phrases(chunks, storyid) def print_phrases(self): pprint(self.phrases) def get_phr...
mit
bacher09/Gentoolkit
pym/gentoolkit/equery/size.py
4
4567
# Copyright(c) 2009, Gentoo Foundation # # Licensed under the GNU General Public License, v2 # # $Header: $ """Print total size of files contained in a given package""" from __future__ import print_function __docformat__ = 'epytext' # ======= # Imports # ======= import sys from getopt import gnu_getopt, GetoptErro...
gpl-2.0
Jgarcia-IAS/SAT
openerp/addons-extra/odoo-pruebas/odoo-server/addons/account_bank_statement_extensions/res_partner_bank.py
381
1582
# -*- encoding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # # Copyright (c) 2011 Noviat nv/sa (www.noviat.be). All rights reserved. # # This program is free software: you can redistribute it and/or modify # it under ...
agpl-3.0
martonw/phantomjs
src/qt/qtwebkit/Source/JavaScriptCore/KeywordLookupGenerator.py
117
11965
# Copyright (C) 2011 Apple Inc. All rights reserved. # Copyright (C) 2012 Sony Network Entertainment. 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. Redistributions of source code must retai...
bsd-3-clause
fkolacek/FIT-VUT
bp-revok/python/lib/python2.7/email/mime/multipart.py
480
1573
# Copyright (C) 2002-2006 Python Software Foundation # Author: Barry Warsaw # Contact: email-sig@python.org """Base class for MIME multipart/* type messages.""" __all__ = ['MIMEMultipart'] from email.mime.base import MIMEBase class MIMEMultipart(MIMEBase): """Base class for MIME multipart/* type messages."""...
apache-2.0
eloquence/unisubs
apps/auth/backends.py
5
5311
# Amara, universalsubtitles.org # # Copyright (C) 2013 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...
agpl-3.0
bcb/qutebrowser
tests/unit/config/test_style.py
9
3507
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: # Copyright 2015-2016 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 Sof...
gpl-3.0