repo_name stringlengths 5 100 | ref stringlengths 12 67 | path stringlengths 4 244 | copies stringlengths 1 8 | content stringlengths 0 1.05M ⌀ |
|---|---|---|---|---|
Jannes123/inasafe | refs/heads/develop | safe/gis/geodesy.py | 7 | # coding=utf-8
"""point.py - Represents a generic point on a sphere as a Python object.
See documentation of class Point for details.
Ole Nielsen, ANU 2002
"""
from math import cos, sin, pi
from math import acos as unsafe_acos # this may cause a domain error
import numpy
def acos(c):
"""acos - Safe in... |
ThirdProject/android_external_chromium_org | refs/heads/cm-11.0 | ppapi/generators/idl_node.py | 23 | #!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Nodes for PPAPI IDL AST"""
#
# IDL Node
#
# IDL Node defines the IDLAttribute and IDLNode objects which are constructed
# by th... |
titasakgm/brc-stock | refs/heads/master | openerp/addons/report_geraldo/lib/geraldo/site/newsite/site-geraldo/appengine_django/auth/models.py | 23 | # 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, ... |
CAAD-RWTH/ClockworkForDynamo | refs/heads/master | nodes/0.7.x/python/Document.SaveAs.py | 12 | import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument
path = IN[0]
if doc.IsFamilyDocument:
path += '.rfa'
else:
path += '.rvt'
OUT = doc.S... |
arkadoel/directORM | refs/heads/master | python/core/__init__.py | 3 | __author__ = 'fer'
|
rowemoore/odoo | refs/heads/8.0 | openerp/workflow/__init__.py | 378 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2014 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... |
akash1808/nova | refs/heads/master | nova/objects/flavor.py | 3 | # Copyright 2013 Red Hat, Inc
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... |
blademainer/intellij-community | refs/heads/master | python/testData/completion/propertyDecorator.after.py | 83 | class C(object):
def __init__(self):
self._x = None
@property
def x(self):
return self._x
@x.setter |
bsipocz/astropy | refs/heads/hacking | astropy/io/misc/asdf/tags/table/table.py | 4 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
import numpy as np
from asdf import tagged
from asdf import yamlutil
from asdf.tags.core.ndarray import NDArrayType
from astropy import table
from astropy.io.misc.asdf.types import AstropyType, AstropyAsdfType
class TableType:
... |
rdeits/iris | refs/heads/master | python/irispy/test/test_iris.py | 1 | import irispy
import numpy as np
from unittest import TestCase
class IRISTest(TestCase):
def test_box(self):
obstacles = [np.array([[0.0, 1.0],
[0.0, 0.0]]),
np.array([[1.0, 1.0],
[0.0, 1.0]]),
np.array... |
bamford/astrobamf | refs/heads/master | gaussian.py | 1 | # functions for plotting and fitting gaussians
from math import sqrt, pi, log10
import numpy as N
def g_residuals(p, x, y):
ampl, centre, sigma = p
g = gaussian(x, ampl, centre, sigma)
return y - g
def multi_g_residuals(p, n, x, y):
ampl = p[0::3]
centre = p[1::3]
sigma = p[2::3]
g = multi... |
The-Sickness/S6-MM | refs/heads/master | tools/perf/scripts/python/futex-contention.py | 11261 | # futex contention
# (c) 2010, Arnaldo Carvalho de Melo <acme@redhat.com>
# Licensed under the terms of the GNU GPL License version 2
#
# Translation of:
#
# http://sourceware.org/systemtap/wiki/WSFutexContention
#
# to perf python scripting.
#
# Measures futex contention
import os, sys
sys.path.append(os.environ['PER... |
htc-mirror/endeavor-ics-qmr-2.6.39-69960c7 | refs/heads/master | tools/perf/scripts/python/futex-contention.py | 11261 | # futex contention
# (c) 2010, Arnaldo Carvalho de Melo <acme@redhat.com>
# Licensed under the terms of the GNU GPL License version 2
#
# Translation of:
#
# http://sourceware.org/systemtap/wiki/WSFutexContention
#
# to perf python scripting.
#
# Measures futex contention
import os, sys
sys.path.append(os.environ['PER... |
bratsche/Neutron-Drive | refs/heads/master | google_appengine/google/appengine/_internal/django/core/files/temp.py | 23 | """
The temp module provides a NamedTemporaryFile that can be re-opened on any
platform. Most platforms use the standard Python tempfile.TemporaryFile class,
but MS Windows users are given a custom class.
This is needed because in Windows NT, the default implementation of
NamedTemporaryFile uses the O_TEMPORARY flag, ... |
vikatory/kbengine | refs/heads/master | kbe/src/lib/python/Lib/encodings/mac_arabic.py | 272 | """ Python Character Mapping Codec generated from 'VENDORS/APPLE/ARABIC.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_map)
def decode(self,input,errors='strict'):
... |
wangyum/tensorflow | refs/heads/master | tensorflow/python/kernel_tests/cwise_ops_test.py | 4 | # 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... |
beni55/rinohtype | refs/heads/master | rinoh/frontend/sphinx/nodes.py | 1 | # This file is part of RinohType, the Python document preparation system.
#
# Copyright (c) Brecht Machiels.
#
# Use of this source code is subject to the terms of the GNU Affero General
# Public License v3. See the LICENSE file or http://www.gnu.org/licenses/.
import unicodedata
from itertools import chain
from ...... |
Matt-Deacalion/django | refs/heads/master | django/utils/dates.py | 590 | "Commonly-used date structures"
from django.utils.translation import pgettext_lazy, ugettext_lazy as _
WEEKDAYS = {
0: _('Monday'), 1: _('Tuesday'), 2: _('Wednesday'), 3: _('Thursday'), 4: _('Friday'),
5: _('Saturday'), 6: _('Sunday')
}
WEEKDAYS_ABBR = {
0: _('Mon'), 1: _('Tue'), 2: _('Wed'), 3: _('Thu'),... |
CyanogenMod/android_external_chromium_org | refs/heads/cm-12.0 | chrome/common/extensions/docs/server2/samples_data_source.py | 8 | # 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 json
import logging
import posixpath
import re
import traceback
from extensions_paths import EXAMPLES
import third_party.json_schema_compiler.jso... |
michitomo/ansible-modules-core | refs/heads/devel | windows/win_user.py | 208 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2014, Matt Martz <matt@sivel.net>, and others
#
# 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 t... |
seankelly/buildbot | refs/heads/master | master/buildbot/test/unit/test_steps_python_twisted.py | 1 | # This file is part of Buildbot. Buildbot 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, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... |
mlperf/training_results_v0.7 | refs/heads/master | Google/benchmarks/bert/implementations/bert-cloud-TF2.0-tpu-v3-32/bert/tf2_encoder_checkpoint_converter.py | 2 | # Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
suncycheng/intellij-community | refs/heads/master | python/lib/Lib/encodings/cp424.py | 593 | """ Python Character Mapping Codec cp424 generated from 'MAPPINGS/VENDORS/MISC/CP424.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,input,errors='... |
areski/django | refs/heads/master | django/db/migrations/operations/fields.py | 362 | from __future__ import unicode_literals
from django.db.models.fields import NOT_PROVIDED
from django.utils import six
from django.utils.functional import cached_property
from .base import Operation
class AddField(Operation):
"""
Adds a field to a model.
"""
def __init__(self, model_name, name, fiel... |
jpshort/odoo | refs/heads/8.0 | comunity_modules/sale_fast_confirm/models/sale_fast_confirm.py | 3 | # -*- encoding: utf-8 -*-
##############################################################################
#
# Odoo, Open Source Management Solution
#
# Author: Andrius Laukavičius. Copyright: JSC NOD Baltic
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of t... |
Antiun/c2c-rd-addons | refs/heads/8.0 | survey_export_xml/__init__.py | 4 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
# Copyright (C) 2010-2012 ChriCar Beteiligungs- und Beratungs- GmbH (<http://www.camptocamp.at>)
#
# Thi... |
FroeMic/CDTM-Backend-Workshop-WT2016 | refs/heads/master | src/server/server/database/utils.py | 11 | from flask import g
import sqlite3
from server import app
# make sure to use this gets only called within app.app_context()
def get_db():
db = getattr(g, '_database', None)
if db is None:
db = g._database = sqlite3.connect('task.db')
db.execute("PRAGMA foreign_keys = 1")
db.row_factory... |
lidavidm/mathics-heroku | refs/heads/master | venv/lib/python2.7/site-packages/pip/vendor/html5lib/ihatexml.py | 1727 | from __future__ import absolute_import, division, unicode_literals
import re
import warnings
from .constants import DataLossWarning
baseChar = """
[#x0041-#x005A] | [#x0061-#x007A] | [#x00C0-#x00D6] | [#x00D8-#x00F6] |
[#x00F8-#x00FF] | [#x0100-#x0131] | [#x0134-#x013E] | [#x0141-#x0148] |
[#x014A-#x017E] | [#x0180-... |
wshallum/ansible | refs/heads/devel | lib/ansible/modules/windows/win_updates.py | 23 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2015, Matt Davis <mdavis_ansible@rolpdog.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 t... |
nakomis/cassandra | refs/heads/trunk | pylib/cqlshlib/displaying.py | 62 | # 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 u... |
ppwwyyxx/tensorflow | refs/heads/master | tensorflow/python/kernel_tests/linalg/linear_operator_adjoint_test.py | 8 | # Copyright 2018 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... |
m0ppers/arangodb | refs/heads/devel | 3rdParty/V8/V8-5.0.71.39/testing/gtest/test/gtest_output_test.py | 188 | #!/usr/bin/env python
#
# Copyright 2008, 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... |
zackster/HipHopGoblin | refs/heads/master | lib/python2.6/django/bin/profiling/gather_profile_stats.py | 330 | #!/usr/bin/env python
"""
gather_profile_stats.py /path/to/dir/of/profiles
Note that the aggregated profiles must be read with pstats.Stats, not
hotshot.stats (the formats are incompatible)
"""
from hotshot import stats
import pstats
import sys, os
def gather_stats(p):
profiles = {}
for f in os.listdir(p):
... |
tiagochiavericosta/edx-platform | refs/heads/master | lms/djangoapps/instructor_task/tests/test_api.py | 16 | """
Test for LMS instructor background task queue management
"""
from mock import patch, Mock
from bulk_email.models import CourseEmail, SEND_TO_ALL
from courseware.tests.factories import UserFactory
from xmodule.modulestore.exceptions import ItemNotFoundError
from instructor_task.api import (
get_running_instruct... |
nyergler/pythonslides | refs/heads/ps | readthedocs/vcs_support/utils.py | 2 | import logging
import os
import time
log = logging.getLogger(__name__)
class Lock(object):
"""
A simple file based lock with timeout
On entering the context, it will try to aquire the lock. If timeout passes,
it just gets the lock anyway.
If we're in the same thread as the one holding this lock... |
yasserglez/tagfs | refs/heads/master | packages/tagfs/contrib/django/contrib/localflavor/it/util.py | 436 | from django.utils.encoding import smart_str, smart_unicode
def ssn_check_digit(value):
"Calculate Italian social security number check digit."
ssn_even_chars = {
'0': 0, '1': 1, '2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8,
'9': 9, 'A': 0, 'B': 1, 'C': 2, 'D': 3, 'E': 4, 'F': 5, 'G': ... |
apache/bookkeeper | refs/heads/master | stream/clients/python/bookkeeper/common/timeout.py | 3 | # 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 th... |
bchareyre/ratchet | refs/heads/master | scripts/hackett-warn-replace.py | 6 | #!/usr/bin/env python
# This scripts attempts to replace deprecated symbols by their new equivalents based on compiler's output log. Symbol map must be
# given explicitly (see renamedSymbols below).
#
# The only command-line argument is yade's buildRoot (trunk) directory. This script further on the fact that all filen... |
benfinkelcbt/CPD200 | refs/heads/master | CPD200-Lab05-Python/oauth2client/contrib/_win32_opener.py | 21 | # 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 required by applicable law or ... |
stilley2/filesdb | refs/heads/master | filesdb/__init__.py | 1 | from ._filesdb import *
|
kwailamchan/programming-languages | refs/heads/master | javascript/backbone/backbone-templates/backbone-fileupload/venvs/lib/python2.7/site-packages/django/contrib/localflavor/hr/hr_choices.py | 91 | # -*- coding: utf-8 -*-
"""
Sources:
Croatian Counties: http://en.wikipedia.org/wiki/ISO_3166-2:HR
Croatia doesn't have official abbreviations for counties.
The ones provided are in common use.
"""
from django.utils.translation import ugettext_lazy as _
HR_COUNTY_CHOICES = (
('GZG', _('Grad Zagreb')),... |
jzoldak/edx-platform | refs/heads/master | openedx/core/djangoapps/monitoring/startup.py | 2 | """
Registers signal handlers at startup.
"""
# pylint: disable=unused-import
import openedx.core.djangoapps.monitoring.signals
import openedx.core.djangoapps.monitoring.exceptions
|
argv0/cloudstack | refs/heads/master | tools/waf/mkisofs.py | 2 | # Copyright 2012 Citrix Systems, Inc. Licensed under the
# Apache License, Version 2.0 (the "License"); you may not use this
# file except in compliance with the License. Citrix Systems, Inc.
# reserves all rights not expressly granted by the License.
# You may obtain a copy of the License at http://www.apache.org/lic... |
sumedhasingla/VTK | refs/heads/master | ThirdParty/Twisted/twisted/words/protocols/oscar.py | 29 | # -*- test-case-name: twisted.words.test -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
An implementation of the OSCAR protocol, which AIM and ICQ use to communcate.
Maintainer: Paul Swartz
"""
import struct
import string
import socket
import random
import types
import re
from hashl... |
QuantSoftware/QuantSoftwareToolkit | refs/heads/master | Legacy/epydoc-3.0.1/epydoc/docwriter/dotgraph.py | 91 | # epydoc -- Graph generation
#
# Copyright (C) 2005 Edward Loper
# Author: Edward Loper <edloper@loper.org>
# URL: <http://epydoc.sf.net>
#
# $Id: dotgraph.py 1663 2007-11-07 15:29:47Z dvarrazzo $
"""
Render Graphviz directed graphs as images. Below are some examples.
.. importgraph::
.. classtree:: epydoc.apidoc.A... |
jvehent/cipherscan | refs/heads/master | cscan/modifiers.py | 2 | # Copyright (c) 2016 Hubert Kario
# Released under Mozilla Public License 2.0
"""Methods for modifying the scan configurations on the fly."""
from __future__ import print_function
proto_versions = {(3, 0): "SSLv3",
(3, 1): "TLSv1.0",
(3, 2): "TLSv1.1",
(3, 3): "T... |
fedora-conary/conary | refs/heads/master | conary/lib/ext/pack.py | 2 | #
# Copyright (c) SAS Institute 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 w... |
adaussy/eclipse-monkey-revival | refs/heads/master | plugins/python/org.eclipse.eclipsemonkey.lang.python/Lib/test/test_urllib2net.py | 21 | #!/usr/bin/env python
import unittest
from test import test_support
from test.test_urllib2 import sanepathname2url
import socket
import urllib2
import os
import sys
TIMEOUT = 60 # seconds
def _retry_thrice(func, exc, *args, **kwargs):
for i in range(3):
try:
return func(*args, **kwargs)
... |
oberlin/pressgang | refs/heads/master | pressgang/actions/lockdown/steps/caching.py | 2 |
from django.template.loader import render_to_string
from django.utils.translation import ugettext_lazy as _
from pressgang.actions.lockdown.exceptions import LockdownError
from pressgang.actions.lockdown.steps import LockdownStep
from pressgang.actions.options.utils import sitewide_activate_plugin
from pressgang.core... |
alazaro/tennis_tournament | refs/heads/master | django/db/models/fields/files.py | 156 | import datetime
import os
import django.utils.copycompat as copy
from django.conf import settings
from django.db.models.fields import Field
from django.core.files.base import File, ContentFile
from django.core.files.storage import default_storage
from django.core.files.images import ImageFile, get_image_dimensions
fr... |
Jereromanoo/agencia | refs/heads/master | app/core/migrations/0004_trabajo_trabajo_id.py | 1 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-11-10 12:52
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0003_trabajo_empresa'),
]
operations = [
migrations.AddField(
... |
aginzberg/crowdsource-platform | refs/heads/develop2 | crowdsourcing/migrations/0007_auto_20151208_1957.py | 2 | # -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2015-12-08 19:57
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('crowdsourcing', '0006_batchfile_name'),
]
operations ... |
Ernesto99/odoo | refs/heads/8.0 | openerp/addons/base/tests/test_ir_attachment.py | 433 | import hashlib
import os
import openerp
import openerp.tests.common
HASH_SPLIT = 2 # FIXME: testing implementations detail is not a good idea
class test_ir_attachment(openerp.tests.common.TransactionCase):
def setUp(self):
super(test_ir_attachment, self).setUp()
registry, cr, uid = self.regi... |
coinkeeper/2015-06-22_18-37_devcoin | refs/heads/master | share/qt/clean_mac_info_plist.py | 635 | #!/usr/bin/env python
# Jonas Schnelli, 2013
# make sure the Bitcoin-Qt.app contains the right plist (including the right version)
# fix made because of serval bugs in Qt mac deployment (https://bugreports.qt-project.org/browse/QTBUG-21267)
from string import Template
from datetime import date
bitcoinDir = "./";
inF... |
uni-peter-zheng/autotest | refs/heads/master | tko/utils_unittest.py | 4 | #!/usr/bin/python
import os
import unittest
import time
import datetime
import itertools
try:
import autotest.common as common
except ImportError:
import common
from autotest.client.shared.test_utils import mock
from autotest.tko import utils
class get_timestamp_test(unittest.TestCase):
def test_zero_t... |
fitoria/askbot-devel | refs/heads/master | askbot/migrations/0033_add__consecutive_days_visit_count__to__auth_user.py | 13 | # encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
from askbot.migrations_api import safe_add_column
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'User.consecutive_days_visit_count'
s... |
dancingdan/tensorflow | refs/heads/master | tensorflow/python/kernel_tests/rnn_test.py | 2 | # 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... |
sshnaidm/ru | refs/heads/master | plugin.video.hdkinoklub.ru/default.py | 2 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#/*
# * Copyright (C) 2011 Silen
# *
# *
# * This Program is free software; you can redistribute it and/or modify
# * it under the terms of the GNU General Public License as published by
# * the Free Software Foundation; either version 2, or (at your option)
# * any la... |
Flexget/Flexget | refs/heads/develop | flexget/api/__init__.py | 3 | from .app import APIClient, APIResource, api, api_app # noqa
from .core import ( # noqa
authentication,
cached,
database,
format_checker,
plugins,
schema,
server,
tasks,
user,
)
|
Russell-IO/ansible | refs/heads/devel | lib/ansible/modules/network/cumulus/_cl_interface_policy.py | 33 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2016, Cumulus Networks <ce-ceng@cumulusnetworks.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_versio... |
matthewelse/micropython | refs/heads/emscripten | tests/thread/mutate_bytearray.py | 41 | # test concurrent mutating access to a shared bytearray object
#
# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
import _thread
# the shared bytearray
ba = bytearray()
# main thread function
def th(n, lo, hi):
for repeat in range(n):
for i in range(lo, hi):
l = len(b... |
udoprog/rested | refs/heads/master | rested/types.py | 1 | class FieldType(object):
"""
Base class for types.
Custom types can be created by inheriting from this and
defining the __call__ function with one string parameter.
Whatever gets returned should be associated to the finalized namespace.
metavar: The name of the (meta)argument on fields, like ... |
enitihas/SAC-Website | refs/heads/master | venv/bin/venv/lib/python2.7/site-packages/jinja2/testsuite/ext.py | 402 | # -*- coding: utf-8 -*-
"""
jinja2.testsuite.ext
~~~~~~~~~~~~~~~~~~~~
Tests for the extensions.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD, see LICENSE for more details.
"""
import re
import unittest
from jinja2.testsuite import JinjaTestCase
from jinja2 import Environment, DictLoader... |
MalloyPower/parsing-python | refs/heads/master | front-end/testsuite-python-lib/Python-3.3.0/Lib/test/test_super.py | 3 | """Unit tests for new super() implementation."""
import sys
import unittest
from test import support
class A:
def f(self):
return 'A'
@classmethod
def cm(cls):
return (cls, 'A')
class B(A):
def f(self):
return super().f() + 'B'
@classmethod
def cm(cls):
return... |
tswast/google-cloud-python | refs/heads/master | bigtable/synth.py | 2 | # Copyright 2018 Google 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 writing, s... |
TeamSirius/Utilities | refs/heads/master | kNN.py | 1 | # Brett (Berty) Fischler and Hunter (Kenneth) Wapman
# October 2014
# kNN Implementation for Senior Design Project
from collections import Counter
import sets
import math
import sys
import os
from math import isinf
from datetime import datetime
#-------------
# CONSTANTS
#-------------
COEFF_JACCARD = 1.6
COEFF_EUC... |
isandlaTech/cohorte-devtools | refs/heads/master | org.cohorte.eclipse.runner.basic/files/test/cohorte/vote/servlet.py | 1 | #!/usr/bin/env python
# -- Content-Encoding: UTF-8 --
"""
Voting system servlet: shows the charts made by the cartoonist
:author: Thomas Calmant
:license: Apache Software License 2.0
:version: 1.1.0
..
Copyright 2014 isandlaTech
Licensed under the Apache License, Version 2.0 (the "License");
you may not... |
rowemoore/odoo | refs/heads/8.0 | addons/l10n_do/__init__.py | 309 | # -*- coding: utf-8 -*-
# #############################################################################
#
# OpenERP, Open Source Management Solution
#
# 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 Fr... |
techhat/libcloud | refs/heads/trunk | libcloud/backup/drivers/dummy.py | 31 | # 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 use ... |
simonlynen/or-tools | refs/heads/master | examples/python/circuit.py | 32 | # 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 applicable ... |
HybridF5/nova | refs/heads/master | nova/tests/unit/test_api_validation.py | 9 | # Copyright 2013 NEC Corporation. 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 ... |
zitouni/gnuradio-3.6.1 | refs/heads/master | gr-digital/python/ofdm_sync_pn.py | 24 | #!/usr/bin/env python
#
# Copyright 2007,2008 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... |
gam-phon/taiga-back | refs/heads/master | taiga/projects/milestones/permissions.py | 1 | # Copyright (C) 2014-2016 Andrey Antukh <niwi@niwi.nz>
# Copyright (C) 2014-2016 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014-2016 David Barragán <bameda@dbarragan.com>
# Copyright (C) 2014-2016 Alejandro Alonso <alejandro.alonso@kaleidos.net>
# This program is free software: you can redistribute it and/or mo... |
40223225/2015-cdb_g3-40223225 | refs/heads/master | static/Brython3.1.1-20150328-091302/Lib/test/support.py | 603 | """Supporting definitions for the Python regression tests."""
if __name__ != 'test.support':
raise ImportError('support must be imported from the test package')
import contextlib
import errno
import functools
import gc
import socket
import sys
import os
import platform
import shutil
import warnings
import unittes... |
hxddh/youtube-dl | refs/heads/master | youtube_dl/extractor/bandcamp.py | 94 | from __future__ import unicode_literals
import json
import re
from .common import InfoExtractor
from ..compat import (
compat_str,
compat_urlparse,
)
from ..utils import (
ExtractorError,
)
class BandcampIE(InfoExtractor):
_VALID_URL = r'https?://.*?\.bandcamp\.com/track/(?P<title>.*)'
_TESTS = ... |
oudalab/fajita | refs/heads/master | pythonAPI/flask/lib/python3.5/site-packages/setuptools/command/test.py | 33 | import os
import operator
import sys
import contextlib
import itertools
from distutils.errors import DistutilsError, DistutilsOptionError
from distutils import log
from unittest import TestLoader
from setuptools.extern import six
from setuptools.extern.six.moves import map, filter
from pkg_resources import (resource_... |
pyatil/jenkins-job-builder | refs/heads/master | jenkins_jobs/modules/project_maven.py | 20 | # Copyright 2012 Hewlett-Packard Development Company, L.P.
#
# 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... |
hynnet/hiwifi-openwrt-HC5661-HC5761 | refs/heads/master | staging_dir/target-mipsel_r2_uClibc-0.9.33.2/usr/lib/python2.7/distutils/tests/test_util.py | 95 | """Tests for distutils.util."""
import sys
import unittest
from test.test_support import run_unittest
from distutils.errors import DistutilsPlatformError, DistutilsByteCompileError
from distutils.util import byte_compile
class UtilTestCase(unittest.TestCase):
def test_dont_write_bytecode(self):
# makes s... |
guewen/odoo | refs/heads/master | addons/website_event_track/controllers/__init__.py | 382 | import event
|
hflynn/openmicroscopy | refs/heads/develop | components/tools/OmeroPy/src/omero/cli.py | 1 | #!/usr/bin/env python
"""
Python driver for OMERO
Provides access to various OMERO.blitz server- and client-side
utilities, including starting and stopping servers, running
analyses, configuration, and more.
Usable via the ./omero script provided with the distribution
as well as from python via "import omero.cli; om... |
toobaz/pandas | refs/heads/master | pandas/io/parquet.py | 1 | """ parquet compat """
from warnings import catch_warnings
from pandas.compat._optional import import_optional_dependency
from pandas.errors import AbstractMethodError
from pandas import DataFrame, get_option
from pandas.io.common import get_filepath_or_buffer, is_s3_url
def get_engine(engine):
""" return our... |
mer-hybris/android_kernel_lge_hammerhead | refs/heads/hybris-11.0 | tools/perf/python/twatch.py | 7370 | #! /usr/bin/python
# -*- python -*-
# -*- coding: utf-8 -*-
# twatch - Experimental use of the perf python interface
# Copyright (C) 2011 Arnaldo Carvalho de Melo <acme@redhat.com>
#
# This application is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License... |
flotre/Sick-Beard | refs/heads/development | lib/hachoir_metadata/__init__.py | 90 | from lib.hachoir_metadata.version import VERSION as __version__
from lib.hachoir_metadata.metadata import extractMetadata
# Just import the module,
# each module use registerExtractor() method
import lib.hachoir_metadata.archive
import lib.hachoir_metadata.audio
import lib.hachoir_metadata.file_system
import lib.hacho... |
lociii/googleads-python-lib | refs/heads/master | examples/adspygoogle/dfp/v201302/activity_group_service/create_activity_groups.py | 3 | #!/usr/bin/python
#
# 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 b... |
freedomtan/tensorflow | refs/heads/master | tensorflow/python/ops/control_flow_v2_func_graphs.py | 10 | # Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
Matt-Deacalion/django | refs/heads/master | django/db/migrations/recorder.py | 478 | from __future__ import unicode_literals
from django.apps.registry import Apps
from django.db import models
from django.db.utils import DatabaseError
from django.utils.encoding import python_2_unicode_compatible
from django.utils.timezone import now
from .exceptions import MigrationSchemaMissing
class MigrationRecor... |
wolf29/games | refs/heads/master | py-proj-building-blocks/BeautifulSoup-3.1.0.1/BeautifulSoupTests.py | 89 | # -*- coding: utf-8 -*-
"""Unit tests for Beautiful Soup.
These tests make sure the Beautiful Soup works as it should. If you
find a bug in Beautiful Soup, the best way to express it is as a test
case like this that fails."""
import unittest
from BeautifulSoup import *
class SoupTest(unittest.TestCase):
def ass... |
jasper-chen/SoftwareSystems | refs/heads/master | hw03/check_uniform.py | 24 | """This file contains code for use with "Think Stats",
by Allen B. Downey, available from greenteapress.com
Copyright 2014 Allen B. Downey
License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html
"""
import sys
import thinkstats2
import thinkplot
def read_file(filename):
t = []
for line in open(filename):
... |
ericMayer/tekton-master | refs/heads/master | backend/venv/lib/python2.7/site-packages/pytz/lazy.py | 514 | from threading import RLock
try:
from UserDict import DictMixin
except ImportError:
from collections import Mapping as DictMixin
# With lazy loading, we might end up with multiple threads triggering
# it at the same time. We need a lock.
_fill_lock = RLock()
class LazyDict(DictMixin):
"""Dictionary popu... |
bolabola/PTVS | refs/heads/master | Python/Tests/TestData/Grammar/WhileStmt.py | 18 | while 1:
pass
while 1:
pass
else:
pass |
jonyroda97/redbot-amigosprovaveis | refs/heads/develop | lib/numpy/core/tests/test_abc.py | 168 | from __future__ import division, absolute_import, print_function
from numpy.testing import TestCase, assert_, run_module_suite
import numbers
from numpy.core.numerictypes import sctypes
class ABC(TestCase):
def test_floats(self):
for t in sctypes['float']:
assert_(isinstance(t(), numbers.Real... |
jobec/rfc5424-logging-handler | refs/heads/master | tests/test_message.py | 1 | # coding=utf-8
import logging
import pytest
from conftest import (
address, message, SomeClass
)
from mock import patch
from rfc5424logging import Rfc5424SysLogHandler, NILVALUE
def test_unicode_msg(logger):
sh = Rfc5424SysLogHandler(address=address)
logger.addHandler(sh)
message = u"This is a ℛℯα∂α... |
sketchfab/blender-exporter | refs/heads/master | packages/requests/api.py | 637 | # -*- coding: utf-8 -*-
"""
requests.api
~~~~~~~~~~~~
This module implements the Requests API.
:copyright: (c) 2012 by Kenneth Reitz.
:license: Apache2, see LICENSE for more details.
"""
from . import sessions
def request(method, url, **kwargs):
"""Constructs and sends a :class:`Request <Request>`.
Retur... |
jonludlam/xen | refs/heads/master | tools/python/xen/xend/XendBase.py | 41 | #!/usr/bin/python
#============================================================================
# This library is free software; you can redistribute it and/or
# modify it under the terms of version 2.1 of the GNU Lesser General Public
# License as published by the Free Software Foundation.
#
# This library is distribu... |
MoisesTedeschi/python | refs/heads/master | Scripts-Python/Modulos-Diversos/deteccao-de-faces-com-python-e-opencv/Lib/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.py | 102 | """Module for supporting the lxml.etree library. The idea here is to use as much
of the native library as possible, without using fragile hacks like custom element
names that break between releases. The downside of this is that we cannot represent
all possible trees; specifically the following are known to cause proble... |
cfe-lab/Kive | refs/heads/master | api/kiveapi/endpoint_manager.py | 1 | import re
class EndpointManager:
def __init__(self, session):
self.session = session
def __getattr__(self, name):
return SessionContext(self.session, name)
class SessionContext:
def __init__(self, session, name):
self.session = session
self.prefix = '/api/{}/'.format(nam... |
mozilla/olympia | refs/heads/master | src/olympia/lib/jingo_minify_helpers.py | 4 | import errno
import os
import subprocess
import time
from django.conf import settings
from django.contrib.staticfiles.finders import find as find_static_path
import jinja2
try:
from build import BUILD_ID_CSS, BUILD_ID_JS, BUILD_ID_IMG, BUNDLE_HASHES
except ImportError:
BUILD_ID_CSS = BUILD_ID_JS = BUILD_ID_I... |
troup-system/troup | refs/heads/master | poc/subprocess_poc.py | 1 | import subprocess
pipe = subprocess.Popen(['/usr/bin/python3', 'test-process.py', 'a1', 'a2'], cwd='.')
pipe.wait()
print('Done')
|
reeshupatel/demo | refs/heads/master | keystone/tests/test_config.py | 9 | # Copyright 2013 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 ... |
madan96/sympy | refs/heads/master | sympy/tensor/__init__.py | 28 | """A module to manipulate symbolic objects with indices including tensors
"""
from .indexed import IndexedBase, Idx, Indexed
from .index_methods import get_contraction_structure, get_indices
from .array import (MutableDenseNDimArray, ImmutableDenseNDimArray,
MutableSparseNDimArray, ImmutableSparseNDimArray, NDimAr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.