repo_name
stringlengths
5
100
path
stringlengths
4
375
copies
stringclasses
991 values
size
stringlengths
4
7
content
stringlengths
666
1M
license
stringclasses
15 values
maestrano/odoo
addons/mrp_operations/__init__.py
443
1091
# -*- 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...
agpl-3.0
GetOcean/ocean-linux
Documentation/networking/cxacru-cf.py
14668
1626
#!/usr/bin/env python # Copyright 2009 Simon Arlott # # 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 i...
gpl-2.0
muffinresearch/olympia
apps/reviews/urls.py
15
1197
from django.conf.urls import include, patterns, url from reviews.feeds import ReviewsRss from . import views def review_detail_patterns(prefix): # These all start with /addon/:id/reviews/:review_id/. return patterns( '', url('^$', views.review_list, name='%s.reviews.detail' % prefix), ...
bsd-3-clause
Fkawala/gcloud-python
bigtable/unit_tests/test_row_filters.py
3
35560
# Copyright 2016 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
apache-2.0
ratnania/pyccel
pyccel/parser/errors.py
1
9058
from collections import OrderedDict # ... #ERROR = 'error' #INTERNAL = 'internal' #WARNING = 'warning' #FATAL = 'fatal' # #PYCCEL = 'pyccel' # #def make_symbol(s): # return str(s) try: from termcolor import colored ERROR = colored('error', 'red', attrs=['blink', 'bold']) INTERNAL = colored('internal', ...
mit
Shedino/SherpaHighLevel
catkin_ws/src/casy_rover/mavlink/pymavlink/build/lib.linux-x86_64-2.7/pymavlink/generator/lib/genxmlif/xmlifApi.py
81
55686
# # genxmlif, Release 0.9.0 # file: xmlifapi.py # # API (interface) classes for generic interface package # # history: # 2007-06-29 rl created, classes extracted from xmlifbase.py # # Copyright (c) 2005-2008 by Roland Leuthe. All rights reserved. # # -------------------------------------------------------...
bsd-3-clause
sgraham/nope
tools/perf/measurements/tab_switching.py
1
3826
# 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. """The tab switching measurement. This measurement opens pages in different tabs. After all the tabs have opened, it cycles through each tab in sequence, an...
bsd-3-clause
houstar/libnl
python/netlink/route/tc.py
34
15933
# # Copyright (c) 2011 Thomas Graf <tgraf@suug.ch> # from __future__ import absolute_import __all__ = [ 'TcCache', 'Tc', 'QdiscCache', 'Qdisc', 'TcClassCache', 'TcClass', ] from .. import core as netlink from . import capi as capi from .. import util as util from . import link as Link TC_PA...
lgpl-2.1
Timeship/scrapy
tests/test_dupefilters.py
110
2315
import hashlib import tempfile import unittest import shutil from scrapy.dupefilters import RFPDupeFilter from scrapy.http import Request from scrapy.utils.python import to_bytes class RFPDupeFilterTest(unittest.TestCase): def test_filter(self): dupefilter = RFPDupeFilter() dupefilter.open() ...
bsd-3-clause
barbuza/django
tests/template_tests/filter_tests/test_iriencode.py
388
1603
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.template.defaultfilters import iriencode, urlencode from django.test import SimpleTestCase from django.utils.safestring import mark_safe from ..utils import setup class IriencodeTests(SimpleTestCase): """ Ensure iriencode keeps safe...
bsd-3-clause
tinkhaven-organization/odoo
doc/cla/stats.py
319
1451
#!/usr/bin/python # # Runme From the repo toplevel directory # import subprocess import glob import re import pprint cla_glob = "doc/cla/*/*.md" cla = ''.join(open(f).read() for f in glob.glob(cla_glob)) cla = cla.lower() def cla_signed(email): if re.match('.*(odoo|openerp|tinyerp).com$',email): return T...
agpl-3.0
overtherain/scriptfile
software/googleAppEngine/lib/django_1_4/django/core/management/commands/runserver.py
77
5859
from optparse import make_option import os import re import sys import socket from django.core.management.base import BaseCommand, CommandError from django.core.servers.basehttp import AdminMediaHandler, run, WSGIServerException, get_internal_wsgi_application from django.utils import autoreload naiveip_re = re.compil...
mit
ShawnPengxy/Flask-madeBlog
site-packages/alembic/ddl/oracle.py
19
2690
from sqlalchemy.ext.compiler import compiles from .impl import DefaultImpl from .base import alter_table, AddColumn, ColumnName, \ format_column_name, ColumnNullable, \ format_server_default,ColumnDefault, format_type, ColumnType class OracleImpl(DefaultImpl): __dialect__ = 'oracle' transactional_ddl ...
mit
majorika/crawlers
peoplepower/popong/spiders/utils.py
3
1556
import re import itertools import lxml.html __all__ = ["convert_to_text", "extract", "extract_text", "extract_table", "extract_ids", "extract_texts", "extract_texts", "extract_url"] def grouper(n, iterable, fillvalue=None): args = [iter(iterable)] * n return itertools.izip_longest(fillvalue=fillvalue, *args) ...
agpl-3.0
JCROM-Android/jcrom_external_chromium_org
native_client_sdk/src/build_tools/generate_index.py
58
1043
# Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import collections import easy_template def CmpByName(x, y): return cmp(x['NAME'], y['NAME']) class LandingPage(object): def __init__(self): ...
bsd-3-clause
lucastheis/isa
code/experiments/visualize.py
1
2233
""" Visualizes parameters of a learned model. """ import sys sys.path.append('./code') from tools import Experiment, stitch, imformat from pgf import * from numpy import * from numpy import min, max from numpy.random import randn from scipy.stats import laplace RES = 1 PERC = 99.5 NUM_COLS = 32 def main(argv): e...
mit
crichardson17/starburst_atlas
Low_resolution_sims/DustFree_LowRes/Geneva_Rot_cont/Geneva_Rot_cont_age5/Optical2.py
33
7437
import csv import matplotlib.pyplot as plt from numpy import * import scipy.interpolate import math from pylab import * from matplotlib.ticker import MultipleLocator, FormatStrFormatter import matplotlib.patches as patches from matplotlib.path import Path import os # --------------------------------------------------...
gpl-2.0
marinkaz/orange3
Orange/canvas/utils/__init__.py
19
1492
from functools import reduce def dotted_getattr(obj, name): """ `getattr` like function accepting a dotted name for attribute lookup. """ return reduce(getattr, name.split("."), obj) def qualified_name(obj): """ Return a qualified name for `obj` (type or function). """ if obj.__name_...
bsd-2-clause
gregbuehler/ansible-modules-extras
packaging/svr4pkg.py
51
7426
#!/usr/bin/python # -*- coding: utf-8 -*- # (c) 2012, Boyd Adamson <boyd () boydadamson.com> # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of th...
gpl-3.0
waseem18/oh-mainline
vendor/packages/twisted/doc/core/examples/courier.py
19
2823
#!/usr/bin/env python # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. """ Example of a interfacing to Courier's mail filter interface. """ LOGFILE = '/tmp/filter.log' # Setup log file from twisted.python import log log.startLogging(open(LOGFILE, 'a')) import sys sys.stderr = log.logfile # T...
agpl-3.0
Hiyorimi/scikit-image
doc/tools/apigen.py
7
16334
""" Attempt to generate templates for module reference with Sphinx To include extension modules, first identify them as valid in the ``_uri2path`` method, then handle them in the ``_parse_module_with_import`` script. Notes ----- This parsing is based on import and introspection of modules. Previously functions and cl...
bsd-3-clause
jk1/intellij-community
python/lib/Lib/site-packages/django/contrib/messages/tests/user_messages.py
241
2619
from django import http from django.contrib.auth.models import User from django.contrib.messages.storage.user_messages import UserMessagesStorage,\ LegacyFallbackStorage from django.contrib.messages.tests.base import skipUnlessAuthIsInstalled from django.contrib.messages.tests.cookie import set_cookie_data from dja...
apache-2.0
rebeling/spaCy
fabfile.py
3
4486
from fabric.api import local, lcd, env, settings, prefix from os.path import exists as file_exists from fabtools.python import virtualenv from os import path import os import shutil PWD = path.dirname(__file__) VENV_DIR = path.join(PWD, '.env') def counts(): pass # Tokenize the corpus # tokenize() ...
mit
0x0all/scikit-learn
sklearn/cluster/__init__.py
19
1215
""" The :mod:`sklearn.cluster` module gathers popular unsupervised clustering algorithms. """ from .spectral import spectral_clustering, SpectralClustering from .mean_shift_ import mean_shift, MeanShift, estimate_bandwidth, \ get_bin_seeds from .affinity_propagation_ import affinity_propagation, AffinityPropagatio...
bsd-3-clause
larsks/cobbler-larsks
cobbler/modules/manage_isc.py
5
6666
""" This is some of the code behind 'cobbler sync'. Copyright 2006-2009, Red Hat, Inc Michael DeHaan <mdehaan@redhat.com> John Eckersberg <jeckersb@redhat.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 Fo...
gpl-2.0
mr-c/tools-iuc
tools/macs2/dir2html.py
1
1499
#!/usr/bin/env python import os import sys from xml.sax.saxutils import escape def make_table( directory ): ret = ['<table class="fileList">\n'] for file in os.listdir( directory ): ret.append('<tr><td class="file"><a href="%s">%s</a></td></tr>\n' % ( file, escape(file).replace( 'MACS2_', '' ) ...
mit
Jumpscale/web
pythonlib/flask_admin/form/upload.py
2
15149
import os import os.path as op from flask import url_for from werkzeug import secure_filename from werkzeug.datastructures import FileStorage from wtforms import ValidationError, fields from wtforms.widgets import HTMLString, html_params try: from wtforms.fields.core import _unset_value as unset_value except Im...
apache-2.0
Lujeni/ansible
test/units/modules/network/fortios/test_fortios_wireless_controller_hotspot20_anqp_ip_address_type.py
21
9225
# Copyright 2019 Fortinet, Inc. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the...
gpl-3.0
JensWehner/votca-scripts
xtp/xtp_JandEvisualise.py
2
14486
#!/usr/bin/env python import sqlite3 import sys import numpy as np import matplotlib.pyplot as plt import matplotlib as mpl import os import numpy.linalg as lg import argparse as ap parser=ap.ArgumentParser(description="VMD interface to depict coupling and siteenergies of sql file") parser.add_argument("-f","--sqlfile...
apache-2.0
repotvsupertuga/tvsupertuga.repository
script.module.streamtvsupertuga/lib/resources/lib/modules/js2py/translators/translator.py
33
6294
from . import pyjsparser #from pyesprima import esprima from . import translating_nodes import hashlib import re # the re below is how we'll recognise numeric constants. # it finds any 'simple numeric that is not preceded with an alphanumeric character # the numeric can be a float (so a dot is found) but # it does no...
gpl-2.0
GRUPO-ES2-GJLRT/XADREZ_ES2
src/cython/move.py
1
10994
#<PyxReplace># from collections import namedtuple from utils.fake_cython import cython Board = namedtuple("Board", "none") from constants import ( # Directions N, S, E, W, EMPTY, # Board A1, A7, H1, H7, # Pieces PAWN, ROOK, QUEEN, KING, PIECE_EMPTY, # Colors WHITE, BLACK, # Move...
mit
mpvoss/RickAndMortyWeatherTweets
env/lib/python3.5/site-packages/pip/_vendor/lockfile/__init__.py
536
9371
# -*- coding: utf-8 -*- """ lockfile.py - Platform-independent advisory file locks. Requires Python 2.5 unless you apply 2.4.diff Locking is done on a per-thread basis instead of a per-process basis. Usage: >>> lock = LockFile('somefile') >>> try: ... lock.acquire() ... except AlreadyLocked: ... print 'some...
mit
unseenlaser/python-for-android
python3-alpha/python3-src/Lib/test/test_pty.py
48
7684
from test.support import verbose, run_unittest, import_module, reap_children #Skip these tests if either fcntl or termios is not available fcntl = import_module('fcntl') import_module('termios') import errno import pty import os import sys import signal import unittest TEST_STRING_1 = b"I wish to buy a fish license....
apache-2.0
RodolfoSilva/linux
tools/perf/scripts/python/net_dropmonitor.py
1812
1749
# Monitor the system for dropped packets and proudce a report of drop locations and counts import os import sys sys.path.append(os.environ['PERF_EXEC_PATH'] + \ '/scripts/python/Perf-Trace-Util/lib/Perf/Trace') from perf_trace_context import * from Core import * from Util import * drop_log = {} kallsyms = [] def...
gpl-2.0
drakeloud/louderdev
louderdev/bin/wsdump.py
1
5934
#!/Users/Drake/dev/LouderDev/louderdev/bin/python3 import argparse import code import sys import threading import time import ssl import six from six.moves.urllib.parse import urlparse import websocket try: import readline except ImportError: pass def get_encoding(): encoding = getattr(sys.stdin, "enc...
mit
lucywyman/slides-ii
v/lib/python2.7/site-packages/pygments/lexers/_stan_builtins.py
74
9382
# -*- coding: utf-8 -*- """ pygments.lexers._stan_builtins ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This file contains the names of functions for Stan used by ``pygments.lexers.math.StanLexer. This is for Stan language version 2.4.0. :copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS. :li...
apache-2.0
AkhilHector/Rex.Inc
.env/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py
252
106466
""" Package resource API -------------------- A resource is a logical file contained within a package, or a logical subdirectory thereof. The package resource API expects resource names to have their path parts separated with ``/``, *not* whatever the local path separator is. Do not use os.path operations to manipul...
mit
Mlieou/oj_solutions
leetcode/python/ex_297.py
6
1185
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str ...
mit
atpkpe/test_dab
sites/all/modules/contrib/proj4js/lib/proj4js/build/build.py
129
3416
#!/usr/bin/env python import sys sys.path.append("../tools") import mergejs import optparse def build(config_file = None, output_file = None, options = None): have_compressor = [] try: import jsmin have_compressor.append("jsmin") except ImportError: print "No jsmin" try: ...
gpl-2.0
jopohl/urh
src/urh/ui/ui_options.py
1
25857
# -*- coding: utf-8 -*- # # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_DialogOptions(object): def setupUi(self, DialogOptions): DialogOptions.setObjectName("DialogOptions") DialogOptions.resize(814, 822) icon = QtGui.QIcon....
gpl-3.0
aleasoluciones/infrabbitmq
integration_tests/test_rabbitmq_event_publisher_publish_object.py
1
1783
# -*- coding: utf-8 -*- import unittest import os from time import sleep from doublex import * from hamcrest import * from infrabbitmq import factory NETWORK='a_network' TOPIC='a_topic' DATA = {'foo': 'foo'} class FakeEvent(object): def __init__(self, topic, network, data): self._data = data sel...
mit
ebilionis/py-best
unit_tests/linalg.py
1
3076
"""Unit-tests for best.linalg. Author: Ilias Bilionis Date: 7/30/2013 """ if __name__ == '__main__': import fix_path import unittest import numpy as np import best.linalg class BestLinAlgTest(unittest.TestCase): def test_kron_prod(self): print '-------------------------------' ...
lgpl-3.0
pvarenik/PyCourses
test/test_contact_data.py
1
3345
__author__ = 'pvarenik' import re from model.contact import Contact import pytest def test_data_on_home_page(app, db): with pytest.allure.step("Getting contacts from home page"): contact_from_home_page = sorted(app.contact.get_contact_list(), key=Contact.id_or_max) with pytest.allure.step("Getting cont...
gpl-2.0
drawks/ansible
lib/ansible/modules/source_control/gitlab_group.py
6
12168
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright: (c) 2019, Guillaume Martinez (lunik@tiwabbit.fr) # Copyright: (c) 2015, Werner Dijkerman (ikben@werner-dijkerman.nl) # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, pri...
gpl-3.0
ravibhure/ansible
lib/ansible/plugins/netconf/junos.py
12
6939
# # (c) 2017 Red Hat Inc. # # 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 d...
gpl-3.0
Sophist-UK/Sophist_picard
test/test_emptydir.py
5
4016
# -*- coding: utf-8 -*- # # Picard, the next-generation MusicBrainz tagger # # Copyright (C) 2019 Philipp Wolfer # Copyright (C) 2020 Laurent Monin # # 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 Foundati...
gpl-2.0
sillywilly42/simian
src/tests/simian/mac/admin/release_report_test.py
1
1485
#!/usr/bin/env python # # Copyright 2016 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...
apache-2.0
glaubitz/fs-uae-debian
arcade/OpenGL/GL/NV/occlusion_query.py
9
4454
'''OpenGL extension NV.occlusion_query This module customises the behaviour of the OpenGL.raw.GL.NV.occlusion_query to provide a more Python-friendly API Overview (from the spec) The HP_occlusion_test extension defines a mechanism whereby an application can query the visibility of an object, where "visible" me...
gpl-2.0
stijnvanhoey/EGU2015
scatter_hist_season.py
1
11943
import numpy as np import pylab as p import matplotlib.pyplot as plt import hydropy as hp from matplotlib.ticker import MaxNLocator from model_evaluation_mc import ObjectiveFunctions from mpl_toolkits.axes_grid import make_axes_locatable p.rc('mathtext', default='regular') def translate_...
bsd-2-clause
mdworks2016/work_development
Python/20_Third_Certification/venv/lib/python3.7/site-packages/pip/_vendor/urllib3/util/__init__.py
51
1038
from __future__ import absolute_import # For backwards compatibility, provide imports that used to be here. from .connection import is_connection_dropped from .request import make_headers from .response import is_fp_closed from .ssl_ import ( SSLContext, HAS_SNI, IS_PYOPENSSL, IS_SECURETRANSPORT, a...
apache-2.0
yxl/emscripten-calligra-mobile
3rdparty/google-breakpad/src/tools/gyp/test/win/gyptest-link-generate-manifest.py
103
1657
#!/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. """ Make sure we generate a manifest file when linking binaries, including handling AdditionalManifestFiles. """ import TestGyp import sys...
gpl-2.0
openpeer/webrtc-gyp
test/compiler-override/gyptest-compiler-global-settings.py
137
2020
#!/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 that make_global_settings can be used to override the compiler settings. """ import TestGyp import os import copy import sys fro...
bsd-3-clause
ericchill/gnofract4d
fract4dgui/test_preferences.py
1
1266
#!/usr/bin/env python # test classes for preferences logic import unittest import sys import os sys.path.insert(1, "..") import preferences from fract4d import fractconfig class CallCounter: def __init__(self): self.count = 0 def cb(self,*args): self.count += 1 class Test(unittest.TestCase)...
bsd-3-clause
okwow123/djangol2
example/env/lib/python2.7/site-packages/requests/packages/idna/intranges.py
154
1521
""" Given a list of integers, made up of (hopefully) a small number of long runs of consecutive integers, compute a representation of the form ((start1, end1), (start2, end2) ...). Then answer the question "was x present in the original list?" in time O(log(# runs)). """ import bisect def intranges_from_list(list_): ...
mit
bigswitch/nova
nova/api/ec2/__init__.py
10
2373
# Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # 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 ...
apache-2.0
dermoth/gramps
gramps/plugins/gramplet/personresidence.py
8
5000
# Gramps - a GTK+/GNOME based genealogy program # # Copyright (C) 2011 Nick Hall # # 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 late...
gpl-2.0
balloob/home-assistant
tests/components/litejet/test_init.py
17
1519
"""The tests for the litejet component.""" import logging import unittest from homeassistant.components import litejet from tests.common import get_test_home_assistant _LOGGER = logging.getLogger(__name__) class TestLiteJet(unittest.TestCase): """Test the litejet component.""" def setup_method(self, metho...
apache-2.0
pombredanne/pants
tests/python/pants_test/backend/jvm/tasks/test_jvm_run_integration.py
4
3367
# coding=utf-8 # Copyright 2014 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import (absolute_import, division, generators, nested_scopes, print_function, unicode_literals, with_statement) from pants_test.pant...
apache-2.0
bankur16/SU2
SU2_PY/SU2/io/redirect.py
3
8531
#!/usr/bin/env python ## \file redirect.py # \brief python package for file redirection # \author T. Lukaczyk, F. Palacios # \version 4.0.1 "Cardinal" # # SU2 Lead Developers: Dr. Francisco Palacios (Francisco.D.Palacios@boeing.com). # Dr. Thomas D. Economon (economon@stanford.edu). # # SU2 De...
lgpl-2.1
darjus-amzn/boto
boto/gs/bucket.py
130
42117
# Copyright 2010 Google 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, copy, modify, merge, publish, dis- # trib...
mit
Integral-Technology-Solutions/ConfigNOW-4.3
Lib/xml/dom/ext/XHtmlPrinter.py
13
1634
import string import Printer from xml.dom import XHTML_NAMESPACE # Wrapper classes to convert nodes from HTML to XHTML class XHtmlDocType: def __init__(self, doctype): self.name = 'html' self.publicId = "-//W3C//DTD XHTML 1.0 Strict//EN" self.systemId = "DTD/xhtml1-strict.dtd" self...
mit
GDGLima/contentbox
third_party/djangoappengine/tests/test_order.py
28
2128
from django.test import TestCase from .models import OrderedModel class OrderTest(TestCase): def create_ordered_model_items(self): pks = [] priorities = [5, 2, 9, 1] for pk, priority in enumerate(priorities): pk += 1 model = OrderedModel(pk=pk, priority=priority) ...
apache-2.0
bravo-zhang/spark
python/pyspark/mllib/clustering.py
10
36955
# # 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...
apache-2.0
atruberg/django-custom
tests/ordering/models.py
114
1139
""" 6. Specifying ordering Specify default ordering for a model using the ``ordering`` attribute, which should be a list or tuple of field names. This tells Django how to order ``QuerySet`` results. If a field name in ``ordering`` starts with a hyphen, that field will be ordered in descending order. Otherwise, it'll ...
bsd-3-clause
elkingtonmcb/pattern
pattern/server/cherrypy/cherrypy/lib/gctools.py
40
7396
import gc import inspect import os import sys import time try: import objgraph except ImportError: objgraph = None import cherrypy from cherrypy import _cprequest, _cpwsgi from cherrypy.process.plugins import SimplePlugin class ReferrerTree(object): """An object which gathers all referrers of an object ...
bsd-3-clause
Leila20/django
django/contrib/gis/db/models/aggregates.py
414
2395
from django.contrib.gis.db.models.fields import ExtentField from django.db.models.aggregates import Aggregate __all__ = ['Collect', 'Extent', 'Extent3D', 'MakeLine', 'Union'] class GeoAggregate(Aggregate): function = None is_extent = False def as_sql(self, compiler, connection): # this will be c...
bsd-3-clause
MphasisWyde/eWamSublimeAdaptor
POC/v0_4_POC_with_generic_cmd_and_swagger/third-party/requests/packages/chardet/gb2312prober.py
2994
1681
######################## BEGIN LICENSE BLOCK ######################## # The Original Code is mozilla.org code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. # # Con...
mit
ehiller/mobilecsp-v18
extensions/tags/gcb/__init__.py
5
10480
# Copyright 2013 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 law or ...
apache-2.0
tectronics/smap-data
python/smap/csvloader.py
6
2308
""" Copyright (c) 2011, 2012, Regents of the University of California 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 l...
bsd-2-clause
drxaero/calibre
src/calibre/library/caches.py
6
47393
#!/usr/bin/env python2 # vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai from __future__ import with_statement __license__ = 'GPL v3' __copyright__ = '2010, Kovid Goyal <kovid@kovidgoyal.net>' __docformat__ = 'restructuredtext en' import itertools, time, traceback, locale from itertools import repeat, izip, imap f...
gpl-3.0
andi34/kernel_samsung_espresso-cm
tools/perf/scripts/python/check-perf-trace.py
11214
2503
# perf script event handlers, generated by perf script -g python # (c) 2010, Tom Zanussi <tzanussi@gmail.com> # Licensed under the terms of the GNU GPL License version 2 # # This script tests basic functionality such as flag and symbol # strings, common_xxx() calls back into perf, begin, end, unhandled # events, etc. ...
gpl-2.0
eduNEXT/edx-platform
lms/djangoapps/branding/migrations/0001_initial.py
4
1825
from django.db import migrations, models import django.db.models.deletion from django.conf import settings class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ migrations.CreateModel( name='Brandin...
agpl-3.0
o5k/openerp-oemedical-v0.1
openerp/addons/account_asset/__openerp__.py
122
2168
# -*- encoding: 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 G...
agpl-3.0
sudheerchintala/LearnEraPlatForm
common/djangoapps/service_status/test.py
88
1381
"""Test for async task service status""" from django.utils import unittest from django.test.client import Client from django.core.urlresolvers import reverse import json class CeleryConfigTest(unittest.TestCase): """ Test that we can get a response from Celery """ def setUp(self): """ ...
agpl-3.0
rgreinho/molecule
test/unit/command/test_base.py
1
1925
# Copyright (c) 2015-2016 Cisco 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, copy, modify, merge...
mit
osvalr/odoo
addons/crm_partner_assign/report/crm_lead_report.py
309
5104
# -*- 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
0be1/ansible
test/units/TestConstants.py
164
1600
# -*- coding: utf-8 -*- import unittest from ansible.constants import get_config import ConfigParser import random import string import os def random_string(length): return ''.join(random.choice(string.ascii_uppercase) for x in range(6)) p = ConfigParser.ConfigParser() p.read(os.path.join(os.path.dirname(__fil...
gpl-3.0
jazzmes/pyroute2
pyroute2/ipdb/transactional.py
1
11000
''' ''' import uuid import threading from pyroute2.common import Dotkeys from pyroute2.ipdb.common import DeprecationException from pyroute2.ipdb.linkedset import LinkedSet class State(object): def __init__(self, lock=None): self.lock = lock or threading.Lock() self.flag = 0 def acquire(self...
gpl-2.0
twiindan/selenium_lessons
04_Selenium/exercices/solutions/expedia_wait.py
1
1943
from selenium.webdriver.support.select import Select from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.support.ui import WebDriverWait from time import sleep # Configure the baseURL baseUrl = "https://www....
apache-2.0
ericmckean/rietveld
codereview/views.py
21
174681
# Copyright 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 or agreed to in writing, ...
apache-2.0
AnhellO/DAS_Sistemas
Ago-Dic-2018/David Perez/Practica3_y_exposicion/AbstractFactory1.py
1
1521
#Aplicación para construir coches mediante #el ensamblado de sus partes (motor, chasis, etc.) class AbstractFactory(object): def crearCoche(self, **args): raise NotImplementedError("Requires derived factory class for implementation.") def crearMotor(self, **args): raise NotImplementedError("Requ...
mit
Haynie-Research-and-Development/jarvis
deps/lib/python3.4/site-packages/pubnub/endpoints/channel_groups/list_channels_in_channel_group.py
1
1889
import six from pubnub import utils from pubnub.endpoints.endpoint import Endpoint from pubnub.errors import PNERR_GROUP_MISSING from pubnub.exceptions import PubNubException from pubnub.enums import HttpMethod, PNOperationType from pubnub.models.consumer.channel_group import PNChannelGroupsListResult class ListChan...
gpl-2.0
joone/chromium-crosswalk
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
ga4gh/server
ga4gh/server/backend.py
3
43958
""" Module responsible for handling protocol requests and returning responses. """ from __future__ import division from __future__ import print_function from __future__ import unicode_literals import ga4gh.server.datamodel as datamodel import ga4gh.server.exceptions as exceptions import ga4gh.server.paging as paging i...
apache-2.0
dimazalfrianz/namebench
nb_third_party/dns/rcode.py
248
3106
# Copyright (C) 2001-2007, 2009, 2010 Nominum, Inc. # # Permission to use, copy, modify, and distribute this software and its # documentation for any purpose with or without fee is hereby granted, # provided that the above copyright notice and this permission notice # appear in all copies. # # THE SOFTWARE IS PROVIDED ...
apache-2.0
ihidalgo/uip-prog3
Parciales/practicas/kivy-designer-master/designer/uix/editcontview.py
1
3247
from kivy.uix.actionbar import ContextualActionView, ActionButton from kivy.properties import ObjectProperty from functools import partial class EditContView(ContextualActionView): '''EditContView is a ContextualActionView, used to display Edit items: Copy, Cut, Paste, Undo, Redo, Select All, Add Custom W...
mit
Soya93/Extract-Refactoring
python/lib/Lib/distutils/unixccompiler.py
81
13282
"""distutils.unixccompiler Contains the UnixCCompiler class, a subclass of CCompiler that handles the "typical" Unix-style command-line C compiler: * macros defined with -Dname[=value] * macros undefined with -Uname * include search directories specified with -Idir * libraries specified with -lllib * library...
apache-2.0
pombreda/py2neo
py2neo/legacy/index.py
1
11934
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright 2011-2014, Nigel Small # # 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...
apache-2.0
gerrive/horizon
horizon/tabs/views.py
67
7029
# 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 t...
apache-2.0
gunthercox/jsondb
setup.py
1
1403
#!/usr/bin/env python # -*- coding: utf-8 -*- try: from setuptools import setup except ImportError: from distutils.core import setup HISTORY = open('history.rst').read().replace('.. :changelog:', '') README = lambda f: open(f, 'r').read() # Dynamically import the package information JSONDB = __import__('jso...
bsd-3-clause
Jazende/ProjectEuler
problem_058_2.py
1
2695
import math import cProfile ## top_left diagonal -> even**2 + 1 ## bot_left diagonal -> even**2 + (even+1**2 - even**2) //2 +1 ## bot_right diagonal -> oneven ** 2 ## top_right diagonal -> oneven**2 + (oneven+1**2 - even**2)//2+1 ## Voor elke waarde van kant: ## 1 waarde: i**2 (als even +1) ...
gpl-3.0
endlessm/chromium-browser
third_party/grpc/src/src/python/grpcio_tests/tests/qps/worker_server.py
5
7603
# Copyright 2016 gRPC authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing...
bsd-3-clause
chrisburr/scikit-learn
examples/linear_model/lasso_dense_vs_sparse_data.py
348
1862
""" ============================== Lasso on dense and sparse data ============================== We show that linear_model.Lasso provides the same results for dense and sparse data and that in the case of sparse data the speed is improved. """ print(__doc__) from time import time from scipy import sparse from scipy ...
bsd-3-clause
NeCTAR-RC/nova
nova/tests/unit/virt/test_events.py
113
1178
# 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 writing, softw...
apache-2.0
uwafsl/MissionPlanner
Lib/distutils/command/install.py
53
26935
"""distutils.command.install Implements the Distutils 'install' command.""" from distutils import log # This module should be kept compatible with Python 2.1. __revision__ = "$Id$" import sys, os, string from types import * from distutils.core import Command from distutils.debug import DEBUG from dis...
gpl-3.0
0jpq0/kbengine
kbe/src/lib/python/Lib/idlelib/idle_test/test_text.py
75
6760
# Test mock_tk.Text class against tkinter.Text class by running same tests with both. import unittest from test.support import requires from _tkinter import TclError import tkinter as tk class TextTest(object): hw = 'hello\nworld' # usual initial insert after initialization hwn = hw+'\n' # \n present at in...
lgpl-3.0
tsmrachel/remo
remo/reports/tests/test_views.py
2
20038
import datetime from django.core.urlresolvers import reverse from django.shortcuts import redirect from django.test.client import Client import mock from mock import patch from nose.tools import eq_, ok_ from remo.base.tests import RemoTestCase, requires_login, requires_permission from remo.profiles.tests import Fun...
bsd-3-clause
1nc1n3rat0r/scapy
scapy/layers/dhcp6.py
6
71414
## This file is part of Scapy ## See http://www.secdev.org/projects/scapy for more informations ## Copyright (C) Philippe Biondi <phil@secdev.org> ## This program is published under a GPLv2 license ## Copyright (C) 2005 Guillaume Valadon <guedou@hongo.wide.ad.jp> ## Arnaud Ebalard <arnaud.ebalard@...
gpl-2.0
ge0rgi/cinder
api-ref/source/conf.py
6
7653
# -*- coding: utf-8 -*- # # 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, softwa...
apache-2.0
tgroh/incubator-beam
sdks/python/apache_beam/metrics/cells_test.py
8
5004
# # 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...
apache-2.0