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 |
|---|---|---|---|---|---|
technicalpickles/zulip | scripts/setup/generate_secrets.py | 114 | 2179 | #!/usr/bin/env python
# This tools generates local_settings_generated.py using the template
import sys, os, os.path
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..'))
os.environ['DJANGO_SETTINGS_MODULE'] = 'zproject.settings'
from django.utils.crypto import get_random_string
from zerver.lib.util... | apache-2.0 |
YOTOV-LIMITED/kuma | vendor/packages/nose/plugins/cover.py | 48 | 11673 | """If you have Ned Batchelder's coverage_ module installed, you may activate a
coverage report with the ``--with-coverage`` switch or NOSE_WITH_COVERAGE
environment variable. The coverage report will cover any python source module
imported after the start of the test run, excluding modules that match
testMatch. If you ... | mpl-2.0 |
EchO-KID/google-breakpad | src/testing/gtest/test/gtest_filter_unittest.py | 2826 | 21261 | #!/usr/bin/env python
#
# Copyright 2005 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... | bsd-3-clause |
boomsbloom/dtm-fmri | DTM/for_gensim/lib/python2.7/site-packages/sklearn/manifold/tests/test_locally_linear.py | 85 | 5600 | from itertools import product
import numpy as np
from numpy.testing import assert_almost_equal, assert_array_almost_equal
from scipy import linalg
from sklearn import neighbors, manifold
from sklearn.manifold.locally_linear import barycenter_kneighbors_graph
from sklearn.utils.testing import assert_less
from sklearn.... | mit |
arraypan/Food-Stickers | FoodStickersMessages/lib/python3.5/site-packages/PIL/ImageQt.py | 14 | 6051 | #
# The Python Imaging Library.
# $Id$
#
# a simple Qt image interface.
#
# history:
# 2006-06-03 fl: created
# 2006-06-04 fl: inherit from QImage instead of wrapping it
# 2006-06-05 fl: removed toimage helper; move string support to ImageQt
# 2013-11-13 fl: add support for Qt5 (aurelien.ballier@cyclonit.com)
#
# Copyr... | mit |
DavidPurcell/murano_temp | murano/tests/unit/policy/test_congress_rules.py | 1 | 10637 | # Copyright (c) 2014 OpenStack Foundation.
# 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... | apache-2.0 |
xen0l/ansible | lib/ansible/modules/remote_management/oneview/oneview_san_manager.py | 146 | 7717 | #!/usr/bin/python
# Copyright (c) 2016-2017 Hewlett Packard Enterprise Development LP
# 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 |
clovertrail/cloudinit-bis | tests/unittests/test_builtin_handlers.py | 3 | 2366 | """Tests of the built-in user data handlers."""
import os
import shutil
import tempfile
try:
from unittest import mock
except ImportError:
import mock
from . import helpers as test_helpers
from cloudinit import handlers
from cloudinit import helpers
from cloudinit import util
from cloudinit.handlers import... | gpl-3.0 |
minhphung171093/OpenERP_V8 | openerp/addons/stock_dropshipping/__init__.py | 223 | 1085 | # -*- 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 |
ralphbean/moksha | moksha/apps/docs/moksha/apps/docs.py | 2 | 1876 | # This file is part of Moksha.
# Copyright (C) 2008-2010 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 b... | apache-2.0 |
mikeh77/mi-instrument | mi/instrument/teledyne/test/test_driver.py | 2 | 32748 | """
@package mi.instrument.teledyne.test.test_driver
@file marine-integrations/mi/instrument/teledyne/test/test_driver.py
@author Roger Unwin
@brief Driver for the teledyne family
Release notes:
"""
__author__ = 'Roger Unwin'
__license__ = 'Apache 2.0'
import time
import unittest
from mi.core.log import get_logger
l... | bsd-2-clause |
vaidap/zulip | zerver/webhooks/teamcity/tests.py | 43 | 2927 | # -*- coding: utf-8 -*-
import ujson
from zerver.models import Recipient
from zerver.lib.test_classes import WebhookTestCase
class TeamcityHookTests(WebhookTestCase):
STREAM_NAME = 'teamcity'
URL_TEMPLATE = u"/api/v1/external/teamcity?stream={stream}&api_key={api_key}"
SUBJECT = u"Project :: Compile"
F... | apache-2.0 |
Chilledheart/chromium | build/android/pylib/monkey/test_runner.py | 26 | 4186 | # 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.
"""Runs a monkey test on a single device."""
import logging
import random
from devil.android import device_errors
from devil.android.sdk import intent
from... | bsd-3-clause |
eawag-rdm/ckanapi | ckanapi/tests/mock/mock_ckan.py | 7 | 2184 | import json
import cgi
import csv
from wsgiref.util import setup_testing_defaults
from wsgiref.simple_server import make_server
def mock_ckan(environ, start_response):
status = '200 OK'
headers = [
('Content-type', 'application/json;charset=utf-8'),
]
if environ['PATH_INFO'] == '/api/action... | mit |
elfi-dev/elfi | elfi/loader.py | 2 | 5463 | """Loading makes precomputed data accessible to nodes."""
import numpy as np
from elfi.utils import get_sub_seed, observed_name
class Loader:
"""Base class for Loaders."""
@classmethod
def load(cls, context, compiled_net, batch_index):
"""Load precomputed data into nodes of `compiled_net`.
... | bsd-3-clause |
saneyuki/servo | tests/wpt/web-platform-tests/tools/third_party/hyperframe/test/test_frames.py | 24 | 25009 | # -*- coding: utf-8 -*-
from hyperframe.frame import (
Frame, Flags, DataFrame, PriorityFrame, RstStreamFrame, SettingsFrame,
PushPromiseFrame, PingFrame, GoAwayFrame, WindowUpdateFrame, HeadersFrame,
ContinuationFrame, AltSvcFrame, ExtensionFrame
)
from hyperframe.exceptions import (
UnknownFrameError,... | mpl-2.0 |
neteler/QGIS | python/plugins/processing/algs/gdal/ClipByExtent.py | 3 | 3290 | # -*- coding: utf-8 -*-
"""
***************************************************************************
ClipByExtent.py
---------------------
Date : September 2013
Copyright : (C) 2013 by Alexander Bruy
Email : alexander bruy at gmail dot com
**************... | gpl-2.0 |
tarzan0820/addons-yelizariev | sale_mediation_custom/wizard/sale_case.py | 16 | 1959 | from openerp import api,models,fields,exceptions
from openerp.osv import fields as old_fields
from openerp.osv import osv
from openerp.tools.translate import _
def _get_active_id(self):
return self._context.get('active_id')
def _get_active_ids(self):
return self._context.get('active_ids')
SIGNAL_SELECTION ... | lgpl-3.0 |
KevinPike/pycache | tests/integration/test_cache_router.py | 1 | 2491 | from time import sleep
import unittest
import subprocess
import os
from hamcrest import assert_that, is_
from requests import request
current_directory = os.path.dirname(os.path.realpath(__file__))
class TestCacheRouter(unittest.TestCase):
"""Test running a external server and pointing the cache at it"""
... | mit |
quodlibet/quodlibet | quodlibet/plugins/__init__.py | 2 | 17198 | # Copyright 2012 - 2020 Christoph Reiter, Nick Boultbee
#
# 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.
from typing i... | gpl-2.0 |
mdsitton/pyogl | opengl/glx.py | 1 | 35603 | '''
OpenGL binding For python
WARNING - This is generated code, do not modify directly.
'''
import ctypes as ct
from opengl.bindutils import gl_func
from opengl import gltypes as t
def set_func(name, returnType, paramTypes):
'''gl_func wrapper that inserts function in globals.'''
globals()[name] = gl_func(nam... | bsd-2-clause |
lra/mackup | setup.py | 1 | 1084 | """Setup file to automate the install of Mackup in the Python environment."""
from setuptools import setup
from mackup.constants import VERSION
setup(
name="mackup",
version=VERSION,
author="Laurent Raufaste",
author_email="analogue@glop.org",
url="https://github.com/lra/mackup",
description="... | gpl-3.0 |
diydrones/ardupilot | Tools/scripts/build_binaries_history.py | 18 | 3381 | #!/usr/bin/env python
from __future__ import print_function
import os
import sqlite3
class BuildBinariesHistory():
def __init__(self, db_filepath):
self.db_filepath = db_filepath
self.assure_db_present()
def progress(self, msg):
print("BBHIST: %s" % msg)
def conn(self):
... | gpl-3.0 |
alexandrucoman/labs | python/solutii/vlad_cristia_avram/from_icao.py | 5 | 1254 | """Rezolvarea problemei from_icao"""
from __future__ import print_function
import os
ICAO = {
'a': 'alfa', 'b': 'bravo', 'c': 'charlie', 'd': 'delta', 'e': 'echo',
'f': 'foxtrot', 'g': 'golf', 'h': 'hotel', 'i': 'india', 'j': 'juliett',
'k': 'kilo', 'l': 'lima', 'm': 'mike', 'n': 'november', 'o': 'oscar'... | mit |
atruberg/django-custom | django/conf/locale/ko/formats.py | 118 | 2323 | # -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'Y년 n월 j일'
TIME_FORMAT = 'A g:i:s'... | bsd-3-clause |
marrow/WebCore | web/core/context.py | 1 | 4200 | # encoding: utf-8
"""A `MutableMapping` subclass for use as a request-local context object."""
# ## Imports
from __future__ import unicode_literals
from collections import MutableMapping
# ## Mapping Class
class Context(MutableMapping):
"""An attribute access dictionary, of a kind.
This utility class is used... | mit |
wolfskaempf/ga_statistics | lib/python2.7/site-packages/django/core/validators.py | 50 | 11700 | from __future__ import unicode_literals
import re
from django.core.exceptions import ValidationError
from django.utils import six
from django.utils.deconstruct import deconstructible
from django.utils.encoding import force_text
from django.utils.ipv6 import is_valid_ipv6_address
from django.utils.six.moves.urllib.par... | mit |
witcxc/scipy | scipy/weave/tests/test_inline_tools.py | 91 | 1523 | from __future__ import absolute_import, print_function
from numpy.testing import TestCase, assert_, run_module_suite
from scipy.weave import inline_tools
from weave_test_utils import dec
class TestInline(TestCase):
"""These are long running tests...
Would be useful to benchmark these things somehow.
"... | bsd-3-clause |
splav/servo | tests/wpt/web-platform-tests/tools/third_party/h2/examples/eventlet/eventlet-server.py | 25 | 2846 | # -*- coding: utf-8 -*-
"""
eventlet-server.py
~~~~~~~~~~~~~~~~~~
A fully-functional HTTP/2 server written for Eventlet.
"""
import collections
import json
import eventlet
from eventlet.green.OpenSSL import SSL, crypto
from h2.config import H2Configuration
from h2.connection import H2Connection
from h2.events import... | mpl-2.0 |
ashray/VTK-EVM | ThirdParty/ZopeInterface/zope/interface/registry.py | 40 | 18877 | ##############################################################################
#
# Copyright (c) 2006 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOF... | bsd-3-clause |
chienlieu2017/it_management | odoo/addons/mrp_byproduct/models/mrp_subproduct.py | 30 | 1445 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models, _
from odoo.addons import decimal_precision as dp
class MrpSubProduct(models.Model):
_name = 'mrp.subproduct'
_description = 'Byproduct'
product_id = fields.Many2one('... | gpl-3.0 |
ezequielpereira/Time-Line | libs/wx/lib/agw/flatmenu.py | 2 | 170722 | # --------------------------------------------------------------------------------- #
# FLATMENU wxPython IMPLEMENTATION
#
# Andrea Gavana, @ 03 Nov 2006
# Latest Revision: 26 Feb 2010, 21.00 GMT
#
#
# TODO List
#
# 1. Work is still in progress, so other functionalities may be added in the future;
# 2. No shadows under... | gpl-3.0 |
ychfan/tensorflow | tensorflow/python/training/tensorboard_logging_test.py | 132 | 4456 | # 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 |
gqwest-erp/server | openerp/addons/warning/__init__.py | 446 | 1071 | # -*- 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 |
takeshineshiro/nova | nova/tests/unit/scheduler/filters/test_availability_zone_filters.py | 57 | 2170 | # 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
# d... | apache-2.0 |
tesidroni/mp | Lib/contextlib.py | 261 | 4424 | """Utilities for with-statement contexts. See PEP 343."""
import sys
from functools import wraps
from warnings import warn
__all__ = ["contextmanager", "nested", "closing"]
class GeneratorContextManager(object):
"""Helper for @contextmanager decorator."""
def __init__(self, gen):
self.gen = gen
... | gpl-3.0 |
csachs/openmicroscopy | components/tools/OmeroPy/test/integration/test_exporter.py | 9 | 2346 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2011-2014 Glencoe Software, Inc. All Rights Reserved.
# Use is subject to license terms supplied in LICENSE.txt
#
# 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... | gpl-2.0 |
t-tran/libcloud | libcloud/compute/drivers/openstack.py | 1 | 87667 | # 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 ... | apache-2.0 |
bsmr-Bitcraze/crazyflie-clients-python | src/cfclient/utils/singleton.py | 9 | 1513 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# || ____ _ __
# +------+ / __ )(_) /_______________ _____ ___
# | 0xBC | / __ / / __/ ___/ ___/ __ `/_ / / _ \
# +------+ / /_/ / / /_/ /__/ / / /_/ / / /_/ __/
# || || /_____/_/\__/\___/_/ \__,_/ /___/\___/
#
# Copyright (C) 20... | gpl-2.0 |
xingyepei/edx-platform | lms/djangoapps/bulk_email/tests/test_tasks.py | 12 | 21247 | # -*- coding: utf-8 -*-
"""
Unit tests for LMS instructor-initiated background tasks.
Runs tasks on answers to course problems to validate that code
paths actually work.
"""
import json
from uuid import uuid4
from itertools import cycle, chain, repeat
from mock import patch, Mock
from nose.plugins.attrib import attr
... | agpl-3.0 |
dgquintas/grpc | src/python/grpcio_tests/tests/interop/server.py | 5 | 2233 | # Copyright 2015 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... | apache-2.0 |
adambrenecki/django | django/contrib/messages/tests/test_fallback.py | 234 | 7033 | from django.contrib.messages import constants
from django.contrib.messages.storage.fallback import (FallbackStorage,
CookieStorage)
from django.contrib.messages.tests.base import BaseTests
from django.contrib.messages.tests.test_cookie import (set_cookie_data,
stored_cookie_messages_count)
from django.contrib.m... | bsd-3-clause |
FlyCamel/enjarify | enjarify/dalvikformats.py | 30 | 4154 | # Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | apache-2.0 |
elba7r/lite-system | erpnext/schools/utils.py | 11 | 1848 | # -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies and contributors
# For lice
from __future__ import unicode_literals
import frappe
from frappe import _
class OverlapError(frappe.ValidationError): pass
def validate_overlap_for(doc, doctype, fieldname, value=None):
"""Checks overlap for specified fei... | gpl-3.0 |
molobrakos/home-assistant | tests/components/alexa/test_flash_briefings.py | 12 | 3225 | """The tests for the Alexa component."""
# pylint: disable=protected-access
import asyncio
import datetime
import pytest
from homeassistant.core import callback
from homeassistant.setup import async_setup_component
from homeassistant.components import alexa
from homeassistant.components.alexa import const
SESSION_ID... | apache-2.0 |
Eric-Zhong/odoo | openerp/report/render/rml2pdf/trml2pdf.py | 256 | 46679 | # -*- 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 |
vmax-feihu/hue | desktop/core/ext-py/requests-2.6.0/requests/packages/chardet/escsm.py | 2930 | 7839 | ######################## 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... | apache-2.0 |
gangadharkadam/saloon_erp_install | erpnext/controllers/buying_controller.py | 24 | 10406 | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe import _, msgprint
from frappe.utils import flt
from erpnext.setup.utils import get_company_currency
from erpnext.accounts.pa... | agpl-3.0 |
CloudWareChile/OpenChile | openerp/addons/crm/wizard/crm_partner_to_opportunity.py | 9 | 3111 | # -*- 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 |
fredericlepied/ansible | lib/ansible/modules/database/influxdb/influxdb_database.py | 8 | 5123 | #!/usr/bin/python
# (c) 2016, Kamil Szczygiel <kamil.szczygiel () intel.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.0',
... | gpl-3.0 |
CatBakun/AutobahnPython | examples/wamp/authentication/client.py | 27 | 2349 | ###############################################################################
##
## Copyright 2012 Tavendo GmbH
##
## 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-2.0 |
lihui7115/ChromiumGStreamerBackend | build/android/pylib/instrumentation/setup.py | 35 | 4043 | # 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.
"""Generates test runner factory and tests for instrumentation tests."""
import logging
import os
from pylib import constants
from pylib import valgrind_to... | bsd-3-clause |
ruchee/vimrc | vimfiles/bundle/vim-python/submodules/pydocstyle/src/tests/test_cases/sections.py | 3 | 12481 | """A valid module docstring."""
from .expected import Expectation
expectation = Expectation()
expect = expectation.expect
_D213 = 'D213: Multi-line docstring summary should start at the second line'
_D400 = "D400: First line should end with a period (not '!')"
@expect(_D213)
@expect("D405: Section name should be ... | mit |
cavestruz/L500analysis | caps/util/sg_filter.py | 1 | 3482 | from math import *
from numpy import *
def resub(D, rhs):
""" solves D D^T = rhs by resubstituion.
D is lower triangle-matrix from cholesky-decomposition """
M = D.shape[0]
x1= zeros((M,),float)
x2= zeros((M,),float)
# resub step 1
for l in range(M):
sum = rhs[l]
fo... | mit |
tzewangdorje/SIPserv | Twisted-13.1.0/twisted/internet/test/test_udp_internals.py | 35 | 5001 | # Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Tests for the internal implementation details of L{twisted.internet.udp}.
"""
from __future__ import division, absolute_import
import socket
from twisted.trial import unittest
from twisted.internet.protocol import DatagramProtocol
from twis... | gpl-3.0 |
vikas1885/test1 | lms/djangoapps/django_comment_client/utils.py | 43 | 28663 | from collections import defaultdict
from datetime import datetime
import json
import logging
import pytz
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.db import connection
from django.http import HttpResponse
from django.utils.timezone import UTC
import pystache_c... | agpl-3.0 |
oscartorresco/financial | financiero/compras/views.py | 1 | 12247 | # Create your views here.
import json
from django.shortcuts import render, get_object_or_404, get_list_or_404, redirect, render_to_response
from django.http import HttpResponse, HttpResponseRedirect
from compras.models import Proveedor, Producto_Proveedor, Compra, Compra_Producto
from django.db import IntegrityError
fr... | gpl-2.0 |
babyliynfg/cross | tools/project-creator/Python2.6.6/Lib/test/lock_tests.py | 1 | 15776 | """
Various tests for synchronization primitives.
"""
import sys
import time
from thread import start_new_thread, get_ident
import threading
import unittest
from test import test_support as support
def _wait():
# A crude wait/yield function not relying on synchronization primitives.
time.slee... | mit |
sonali0901/zulip | zerver/webhooks/gitlab/tests.py | 21 | 14333 | # -*- coding: utf-8 -*-
from zerver.lib.webhooks.git import COMMITS_LIMIT
from zerver.lib.test_classes import WebhookTestCase
class GitlabHookTests(WebhookTestCase):
STREAM_NAME = 'gitlab'
URL_TEMPLATE = "/api/v1/external/gitlab?&api_key={api_key}"
FIXTURE_DIR_NAME = 'gitlab'
def test_push_event_messa... | apache-2.0 |
yangjae/grpc | src/python/src/grpc/framework/face/_calls.py | 12 | 15160 | # Copyright 2015, 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... | bsd-3-clause |
shybovycha/buck | scripts/top_down_stress_tester.py | 25 | 6514 | import argparse
import itertools
import json
import logging
import os
import subprocess
import sys
import tempfile
import zipfile
CACHE_DIR = 'buck-cache'
class CacheEntry(object):
pass
def get_cache_entry(path):
with zipfile.ZipFile(path) as f:
entry_map = {os.path.basename(n): n for n in f.namel... | apache-2.0 |
yinquan529/platform-external-chromium_org | third_party/markupsafe/_native.py | 1243 | 1187 | # -*- coding: utf-8 -*-
"""
markupsafe._native
~~~~~~~~~~~~~~~~~~
Native Python implementation the C module is not compiled.
:copyright: (c) 2010 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
from markupsafe import Markup
from markupsafe._compat import text_type
def escape(... | bsd-3-clause |
codenote/chromium-test | chrome/test/functional/secure_shell.py | 68 | 4066 | #!/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.
import glob
import logging
import os
import time
import pyauto_functional # must be imported before pyauto
import pyauto
class ... | bsd-3-clause |
lxybox1/MissionPlanner | Lib/encodings/mac_roman.py | 93 | 14043 | """ Python Character Mapping Codec mac_roman generated from 'MAPPINGS/VENDORS/APPLE/ROMAN.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(s... | gpl-3.0 |
gunan/tensorflow | tensorflow/python/debug/wrappers/grpc_wrapper.py | 25 | 8662 | # 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 |
ZLLab-Mooc/edx-platform | common/test/acceptance/pages/lms/certificate_page.py | 110 | 1582 | # -*- coding: utf-8 -*-
"""
Module for Certificates pages.
"""
from bok_choy.page_object import PageObject
from . import BASE_URL
class CertificatePage(PageObject):
"""
Certificate web view page.
"""
url_path = "certificates"
def __init__(self, browser, user_id, course_id):
"""Initializ... | agpl-3.0 |
mgrosvenor/fastnet | fast_net_scale.py | 1 | 2979 | #! /usr/bin/python
import math
import sys
import os
import subprocess
#PTYPES = [ "eth_ip_udp_head_t", "ip_udp_head_t", "eth_32ip_udp_head_t", "eth_64ip_udp_head_t", "eth64_64ip64_64udp_head_t", "eth6464_64ip64_64udp_head_t" ]
#PTYPES = [ "eth_ip_udp_head_t", "eth_32ip_udp_head_t", "eth_64ip_udp_head_t", "eth64_64... | bsd-3-clause |
zenhacklab/OpenBazaar | obelisk/numbertheory.py | 21 | 2813 |
def inverse_mod( a, m ):
"""Inverse of a mod m."""
if a < 0 or m <= a: a = a % m
# From Ferguson and Schneier, roughly:
c, d = a, m
uc, vc, ud, vd = 1, 0, 0, 1
while c != 0:
q, c, d = divmod( d, c ) + ( c, )
uc, vc, ud, vd = ud - q*uc, vd - q*vc, uc, vc
# At this point, d is the GCD, and ud*a... | agpl-3.0 |
zivaharoni/gradual-learning-rnn | tensorflow_impl/model.py | 1 | 19610 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
from tensorflow.python.framework import ops
from tensorflow.python.ops import math_ops
from tensorflow.python.ops import random_ops
import rnn_cell_additions as dr
import optimizers
impor... | mit |
DiptoDas8/Biponi | lib/python2.7/site-packages/django/contrib/gis/geos/point.py | 103 | 4401 | from ctypes import c_uint
from django.contrib.gis.geos import prototypes as capi
from django.contrib.gis.geos.error import GEOSException
from django.contrib.gis.geos.geometry import GEOSGeometry
from django.utils import six
from django.utils.six.moves import range
class Point(GEOSGeometry):
_minlength = 2
_m... | mit |
beagles/neutron_hacking | neutron/db/migration/alembic_migrations/versions/1c33fa3cd1a1_extra_route_config.py | 3 | 2588 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# 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... | apache-2.0 |
gladsonvm/haystackdemo | lib/python2.7/site-packages/django/utils/html.py | 78 | 9474 | """HTML utilities suitable for global use."""
import re
import string
import urllib
import urlparse
from django.utils.safestring import SafeData, mark_safe
from django.utils.encoding import smart_str, force_unicode
from django.utils.functional import allow_lazy
from django.utils.text import normalize_newlines
# Conf... | mit |
nitinitprof/odoo | addons/web/controllers/main.py | 46 | 66013 | # -*- coding: utf-8 -*-
import ast
import base64
import csv
import functools
import glob
import itertools
import jinja2
import logging
import operator
import datetime
import hashlib
import os
import re
import simplejson
import sys
import time
import urllib2
import zlib
from xml.etree import ElementTree
from cStringIO ... | agpl-3.0 |
ProfessionalIT/maxigenios-website | sdk/google_appengine/lib/django-1.5/django/contrib/gis/db/backends/base.py | 104 | 11139 | """
Base/mixin classes for the spatial backend database operations and the
`SpatialRefSys` model the backend.
"""
import re
from django.contrib.gis import gdal
from django.utils import six
from django.utils.encoding import python_2_unicode_compatible
class BaseSpatialOperations(object):
"""
This module holds t... | mit |
crate/crate-python | src/crate/client/sqlalchemy/tests/bulk_test.py | 1 | 2714 | # -*- coding: utf-8; -*-
#
# Licensed to CRATE Technology GmbH ("Crate") under one or more contributor
# license agreements. See the NOTICE file distributed with this work for
# additional information regarding copyright ownership. Crate licenses
# this file to you under the Apache License, Version 2.0 (the "License"... | apache-2.0 |
bdh1011/wau | venv/lib/python2.7/encodings/euc_jisx0213.py | 816 | 1051 | #
# euc_jisx0213.py: Python Unicode Codec for EUC_JISX0213
#
# Written by Hye-Shik Chang <perky@FreeBSD.org>
#
import _codecs_jp, codecs
import _multibytecodec as mbc
codec = _codecs_jp.getcodec('euc_jisx0213')
class Codec(codecs.Codec):
encode = codec.encode
decode = codec.decode
class IncrementalEncoder(m... | mit |
FedoraScientific/salome-paravis | test/VisuPrs/MeshPresentation/K9.py | 1 | 2459 | # Copyright (C) 2010-2014 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library ... | lgpl-2.1 |
leeon/annotated-django | django/conf/locale/hu/formats.py | 82 | 1123 | # -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'Y. F j.'
TIME_FORMAT = 'G.i.s'
DA... | bsd-3-clause |
magvugr/AT | EntVirtual/lib/python2.7/site-packages/django/contrib/flatpages/forms.py | 108 | 2162 | from django import forms
from django.conf import settings
from django.contrib.flatpages.models import FlatPage
from django.utils.translation import ugettext, ugettext_lazy as _
class FlatpageForm(forms.ModelForm):
url = forms.RegexField(
label=_("URL"),
max_length=100,
regex=r'^[-\w/\.~]+$... | gpl-3.0 |
skinny121/MCEdit-TallWorlds | pymclevel/test/templevel.py | 13 | 1394 | import atexit
import os
from os.path import join
import shutil
import tempfile
from pymclevel import mclevel
__author__ = 'Rio'
tempdir = os.path.join(tempfile.gettempdir(), "pymclevel_test")
if not os.path.exists(tempdir):
os.mkdir(tempdir)
def mktemp(suffix):
td = tempfile.mkdtemp(suffix, dir=tempdir)
... | isc |
askomics/askomics | askomics/libaskomics/LdapAuth.py | 2 | 2823 | import logging
import ldap
from askomics.libaskomics.ParamManager import ParamManager
class LdapAuth(ParamManager):
"""[summary]
[description]
"""
def __init__(self, settings, session):
ParamManager.__init__(self, settings, session)
self.log = logging.getLogger(__name__)
se... | agpl-3.0 |
google/material-design-icons | update/venv/lib/python3.9/site-packages/fontTools/colorLib/table_builder.py | 5 | 7714 | """
colorLib.table_builder: Generic helper for filling in BaseTable derivatives from tuples and maps and such.
"""
import collections
import enum
from fontTools.ttLib.tables.otBase import (
BaseTable,
FormatSwitchingBaseTable,
UInt8FormatSwitchingBaseTable,
)
from fontTools.ttLib.tables.otConverters impor... | apache-2.0 |
Silmathoron/NNGT | doc/examples/attributes.py | 1 | 6916 | #-*- coding:utf-8 -*-
#
# This file is part of the NNGT project to generate and analyze
# neuronal networks and their activity.
# Copyright (C) 2015-2019 Tanguy Fardet
#
# 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 F... | gpl-3.0 |
lutianming/leetcode | longest_palindromic_substring.py | 1 | 1460 | class Solution:
# @param {string} s
# @return {string}
def longestPalindrome(self, s):
max_length = 0
max_left = 0
max_right = 0
n = len(s)
for i, c in enumerate(s):
left = None
right = None
if (i-1) >= 0 and c == s[i-1]:
... | mit |
hollabaq86/haikuna-matata | env/lib/python2.7/site-packages/psycopg2/__init__.py | 61 | 5838 | """A Python driver for PostgreSQL
psycopg is a PostgreSQL_ database adapter for the Python_ programming
language. This is version 2, a complete rewrite of the original code to
provide new-style classes for connection and cursor objects and other sweet
candies. Like the original, psycopg 2 was written with the aim of b... | mit |
saintpai/sos | sos/plugins/openssl.py | 5 | 1873 | # Copyright (C) 2007 Sadique Puthen <sputhenp@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 Foundation; either version 2 of the License, or
# (at your option) any later version.
# This progr... | gpl-2.0 |
rosmo/ansible | lib/ansible/modules/cloud/rackspace/rax_mon_entity.py | 77 | 5795 | #!/usr/bin/python
# Copyright: Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
... | gpl-3.0 |
bankonme/OpenBazaar-Server | keyutils/keys.py | 4 | 1674 | __author__ = 'chris'
import bitcoin
import nacl.signing
import nacl.encoding
from db.datastore import KeyStore
from keyutils.guid import GUID
from nacl.public import PrivateKey
class KeyChain(object):
def __init__(self):
self.db = KeyStore()
guid_keys = self.db.get_key("guid")
if guid_keys... | mit |
jesseengel/magenta | magenta/music/musicnet_io.py | 1 | 3870 | # Copyright 2019 The Magenta 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 ... | apache-2.0 |
DReckoning/AcousticPositioning | Client/PulseCorrection.py | 1 | 1744 | # this will correct missing or false pulses.
def process(rocks,syncs,nn):
# checker
for n in range(nn):
rockavg = 0
for s in rocks[n]:
rockavg+= float(s)/float(len(rocks[n]))
lastsamp = 0
i = 0
print 'avg ',rockavg
for s in rocks[n]:
i ... | gpl-2.0 |
ghisvail/scikit-fftw | skfftw/backend/_cffi.py | 1 | 2359 | # coding: utf8
# Copyright (c) 2014, 2015 Ghislain Antony Vaillant.
#
# This file is distributed under the new BSD License, see the LICENSE file or
# checkout the license terms at http://opensource.org/licenses/BSD-2-Clause).
from __future__ import absolute_import, division, print_function
import binascii
import os... | bsd-3-clause |
OpenSourcePolicyCenter/multi-country | Python/Archive/Stage2/Unincorporated Demographics/StepbyStepv1.py | 2 | 35778 | from __future__ import division
import sys
import numpy as np
import scipy as sp
import scipy.optimize as opt
import time as time
from matplotlib import pyplot as plt
#DEMOGRAPHICS FUNCTIONS
def getDemographics(params, PrintAges, DiffDemog):
"""
Description:
-Imports data from csv files for initial populations, f... | mit |
JonathanStein/odoo | openerp/tools/graph.py | 441 | 26118 | #!/usr/bin/env python
# -*- 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 unde... | agpl-3.0 |
tntC4stl3/scrapy | tests/test_http_headers.py | 161 | 6348 | import unittest
import copy
from scrapy.http import Headers
class HeadersTest(unittest.TestCase):
def assertSortedEqual(self, first, second, msg=None):
return self.assertEqual(sorted(first), sorted(second), msg)
def test_basics(self):
h = Headers({'Content-Type': 'text/html', 'Content-Length... | bsd-3-clause |
samdowd/drumm-farm | drumm_env/lib/python2.7/site-packages/django/views/decorators/http.py | 58 | 4411 | """
Decorators for views based on HTTP headers.
"""
import logging
from calendar import timegm
from functools import wraps
from django.http import HttpResponseNotAllowed
from django.middleware.http import ConditionalGetMiddleware
from django.utils.cache import get_conditional_response
from django.utils.decorators imp... | mit |
artemalive/DigitalWhip | framework/colorama/initialise.py | 86 | 1831 | # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
import atexit
import contextlib
import sys
from .ansitowin32 import AnsiToWin32
orig_stdout = None
orig_stderr = None
wrapped_stdout = None
wrapped_stderr = None
atexit_done = False
def reset_all():
AnsiToWin32(orig_stdout).reset_all(... | mit |
HSAnet/glimpse_client | 3rdparty/breakpad/src/tools/gyp/tools/pretty_sln.py | 806 | 5092 | #!/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.
"""Prints the information in a sln file in a diffable way.
It first outputs each projects in alphabetical order with their
dependenci... | bsd-3-clause |
mw46d/ardupilot | Tools/ardupilotwaf/cmake.py | 42 | 13322 | #!/usr/bin/env python
# encoding: utf-8
# Copyright (C) 2015-2016 Intel Corporation. All rights reserved.
#
# This file 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
# (... | gpl-3.0 |
holmboe/hyde | hydeengine/path_util.py | 14 | 2092 | import os
class PathUtil:
@staticmethod
def filter_hidden_inplace(item_list):
if(not len(item_list)):
return
wanted = filter(
lambda item:
not ((item.startswith('.') and item != ".htaccess") or item.endswith('~')), item_list)
... | mit |
cloudbase/lis-tempest | tempest/tests/test_rest_client.py | 4 | 23314 | # 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 agreed t... | apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.