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 |
|---|---|---|---|---|---|
xin3liang/platform_external_chromium_org | tools/telemetry/telemetry/unittest/progress_reporter_unittest.py | 33 | 1548 | # Copyright 2014 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 unittest
from telemetry.unittest import progress_reporter
class TestFoo(unittest.TestCase):
# Test method doesn't have test- prefix intentionally... | bsd-3-clause |
bbc/kamaelia | Code/Python/Kamaelia/Kamaelia/UI/OpenGL/SkyGrassBackground.py | 12 | 2597 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1)
#
# (1) Kamaelia Contributors are listed in the AUTHORS file and at
# http://www.kamaelia.org/AUTHORS - please extend this file,
# not this notice.
#
# Licensed under the Apache License... | apache-2.0 |
hynnet/openwrt-mt7620 | staging_dir/host/lib/python2.7/cProfile.py | 169 | 6515 | #! /usr/bin/env python
"""Python interface for the 'lsprof' profiler.
Compatible with the 'profile' module.
"""
__all__ = ["run", "runctx", "help", "Profile"]
import _lsprof
# ____________________________________________________________
# Simple interface
def run(statement, filename=None, sort=-1):
"""Run s... | gpl-2.0 |
hbwzhsh/scrapy | scrapy/link.py | 56 | 1253 | """
This module defines the Link object used in Link extractors.
For actual link extractors implementation see scrapy.linkextractors, or
its documentation in: docs/topics/link-extractors.rst
"""
import six
class Link(object):
"""Link objects represent an extracted link by the LinkExtractor."""
__slots__ = [... | bsd-3-clause |
wndhydrnt/airflow | tests/impersonation.py | 15 | 4984 | # -*- coding: utf-8 -*-
#
# 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
#... | apache-2.0 |
czgu/metaHack | env/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/exceptions.py | 214 | 4109 |
## Base Exceptions
class HTTPError(Exception):
"Base exception used by this module."
pass
class HTTPWarning(Warning):
"Base warning used by this module."
pass
class PoolError(HTTPError):
"Base exception for errors caused within a pool."
def __init__(self, pool, message):
self.pool ... | apache-2.0 |
acfogarty/espressopp | contrib/mpi4py/mpi4py-2.0.0/test/test_cco_buf.py | 8 | 29323 | from mpi4py import MPI
import mpiunittest as unittest
import arrayimpl
from functools import reduce
prod = lambda sequence,start=1: reduce(lambda x, y: x*y, sequence, start)
def maxvalue(a):
try:
typecode = a.typecode
except AttributeError:
typecode = a.dtype.char
if typecode == ('f'):
... | gpl-3.0 |
habeanf/Open-Knesset | laws/migrations/0007_add_laws_votes_and_committee_meetings.py | 15 | 17457 | # encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding M2M table for field committee_meetings on 'PrivateProposal'
db.create_table('laws_privateprop... | bsd-3-clause |
dstndstn/astrometry.net | net/urls.py | 1 | 10681 | from django.conf.urls import include, url
from astrometry.net import settings
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()
urlpatterns = []
from astrometry.net.views.home import home, support, api_help, explore
urlpatterns.extend([
url(r'^/?$', h... | bsd-3-clause |
AlexOugh/horizon | openstack_dashboard/dashboards/admin/volumes/snapshots/tests.py | 34 | 4219 | # 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 |
deadRaccoons/TestAirlines | tabo/cherrypy/cherrypy/_cplogging.py | 29 | 17181 | """
Simple config
=============
Although CherryPy uses the :mod:`Python logging module <logging>`, it does so
behind the scenes so that simple logging is simple, but complicated logging
is still possible. "Simple" logging means that you can log to the screen
(i.e. console/stdout) or to a file, and that you can easily ... | gpl-2.0 |
Nick-Hall/gramps | gramps/gen/filters/rules/person/_hasevent.py | 5 | 2501 | #
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2002-2006 Donald N. Allingham
#
# 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 you... | gpl-2.0 |
SwagColoredKitteh/servo | tests/wpt/web-platform-tests/tools/wptserve/wptserve/stash.py | 125 | 5248 | import base64
import json
import os
import uuid
from multiprocessing.managers import BaseManager, DictProxy
class ServerDictManager(BaseManager):
shared_data = {}
def _get_shared():
return ServerDictManager.shared_data
ServerDictManager.register("get_dict",
callable=_get_shared,
... | mpl-2.0 |
lupyuen/RaspberryPiImage | home/pi/GrovePi/Software/Python/others/temboo/Library/Google/Contacts/GetContactsWithQuery.py | 4 | 5460 | # -*- coding: utf-8 -*-
###############################################################################
#
# GetContactsWithQuery
# Retrieves the contact or contacts in that account that match a specified query term.
#
# Python versions 2.6, 2.7, 3.x
#
# Copyright 2014, Temboo Inc.
#
# Licensed under the Apache License... | apache-2.0 |
chrisfilo/NeuroVault | neurovault/apps/statmaps/migrations/0060_auto_20160103_0406.py | 4 | 2687 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('statmaps', '0059_auto_20160101_0410'),
]
operations = [
migrations.AlterField(
model_name='collection',
... | mit |
UKTradeInvestment/export-wins-data | users/managers.py | 1 | 1308 | from django.contrib.auth.models import UserManager as BaseUserManager
class UserManager(BaseUserManager):
"""
Much of this is just copied out of BaseUserManager, excluding the
requirement for a username.
"""
def _create_user(self, email, password, **extra_fields):
"""
Creates and ... | gpl-3.0 |
PyQwt/PyQwt | junk/PyEdit.py | 1 | 2691 | #!/usr/bin/env python
import sys
from PQTokenize import *
from keyword import *
from qt import *
class PyEdit(QTextEdit):
def __init__(self, parent=None):
QTextEdit.__init__(self, parent)
# user interface setup
self.setTextFormat(QTextEdit.PlainText)
#self.setWrapPolicy(QTextEdit... | gpl-2.0 |
whs/django | django/db/backends/base/creation.py | 20 | 11972 | import sys
from io import StringIO
from django.apps import apps
from django.conf import settings
from django.core import serializers
from django.db import router
# The prefix to put on the default database name when creating
# the test database.
TEST_DATABASE_PREFIX = 'test_'
class BaseDatabaseCreation:
"""
... | bsd-3-clause |
gitcoinco/web | app/marketing/management/commands/debug_test.py | 1 | 1299 | '''
Copyright (C) 2021 Gitcoin Core
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This progra... | agpl-3.0 |
mikkylok/mikky.lu | venv/lib/python2.7/site-packages/setuptools/sandbox.py | 80 | 14549 | import os
import sys
import tempfile
import operator
import functools
import itertools
import re
import contextlib
import pickle
import textwrap
from setuptools.extern import six
from setuptools.extern.six.moves import builtins, map
import pkg_resources.py31compat
if sys.platform.startswith('java'):
import org.p... | mit |
playm2mboy/edx-platform | lms/djangoapps/courseware/migrations/0010_rename_xblock_field_content_to_user_state_summary.py | 114 | 11590 | # -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Removing unique constraint on 'XModuleSettingsField', fields ['usage_id', 'field_name']
db.delete_unique('... | agpl-3.0 |
fhamborg/news-please | newsplease/crawler/simple_crawler.py | 1 | 3455 | import socket
import copy
import threading
import logging
import requests
import urllib3
from .response_decoder import decode_response
MAX_FILE_SIZE = 20000000
MIN_FILE_SIZE = 10
LOGGER = logging.getLogger(__name__)
# customize headers
HEADERS = {
'Connection': 'close',
'User-Agent': 'Mozilla/5.0 (Macintos... | apache-2.0 |
alexkogon/ansible | test/units/plugins/connections/test_connection.py | 86 | 3988 | # (c) 2015, Toshio Kuratomi <tkuratomi@ansible.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later... | gpl-3.0 |
collmot/ardupilot | libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32H743xx.py | 11 | 34833 | #!/usr/bin/env python
'''
these tables are generated from the STM32 datasheets for the STM32H743bi
'''
# additional build information for ChibiOS
build = {
"CHIBIOS_STARTUP_MK" : "os/common/startup/ARMCMx/compilers/GCC/mk/startup_stm32h7xx.mk",
"CHIBIOS_PLATFORM_MK" : "os/hal/ports/STM32/STM32H7xx/platform.mk... | gpl-3.0 |
dcifuen/cloudbday | src/lib/gae_mini_profiler/instrumented_profiler.py | 13 | 2781 | """CPU profiler that works by instrumenting all function calls (uses cProfile).
This profiler provides detailed function timings for all function calls
during a request.
This is just a simple wrapper for cProfile with result formatting. See
http://docs.python.org/2/library/profile.html for more.
PRO: since every fun... | mit |
837468220/python-for-android | python-build/python-libs/gdata/src/gdata/apps/migration/__init__.py | 168 | 8177 | #!/usr/bin/python
#
# Copyright (C) 2008 Google
#
# 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... | apache-2.0 |
eayunstack/nova | nova/virt/xenapi/agent.py | 13 | 17806 | # Copyright (c) 2010 Citrix Systems, Inc.
# Copyright 2010-2012 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/LICENS... | apache-2.0 |
mapennell/ansible | v1/ansible/module_utils/ec2.py | 127 | 7586 | # This code is part of Ansible, but is an independent component.
# This particular file snippet, and this file snippet only, is BSD licensed.
# Modules you write using this snippet, which is embedded dynamically by Ansible
# still belong to the author of the module, and may assign their own license
# to the complete wo... | gpl-3.0 |
dennis-sheil/commandergenius | project/jni/python/src/Lib/test/test_structmembers.py | 56 | 3373 | from _testcapi import test_structmembersType, \
CHAR_MAX, CHAR_MIN, UCHAR_MAX, \
SHRT_MAX, SHRT_MIN, USHRT_MAX, \
INT_MAX, INT_MIN, UINT_MAX, \
LONG_MAX, LONG_MIN, ULONG_MAX, \
LLONG_MAX, LLONG_MIN, ULLONG_MAX
import warnings, exceptions, unittest, sys
from test import test_support
ts=test_structm... | lgpl-2.1 |
livlogik/Evil_Yummy_Gumdrop--Tmo-V10-Kernel | scripts/tracing/draw_functrace.py | 14676 | 3560 | #!/usr/bin/python
"""
Copyright 2008 (c) Frederic Weisbecker <fweisbec@gmail.com>
Licensed under the terms of the GNU GPL License version 2
This script parses a trace provided by the function tracer in
kernel/trace/trace_functions.c
The resulted trace is processed into a tree to produce a more human
view of the call ... | gpl-2.0 |
malderete/ninja-ide | ninja_ide/gui/editor/checkers/migration_lists.py | 6 | 6160 | # -*- coding: utf-8 -*-
#
# This file is part of NINJA-IDE (http://ninja-ide.org).
#
# NINJA-IDE 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
# any later version.
#
# NIN... | gpl-3.0 |
pombredanne/teamwork | wsgi/static/Brython2.1.0-20140419-113919/Lib/signal.py | 743 | 1646 | """This module provides mechanisms to use signal handlers in Python.
Functions:
alarm() -- cause SIGALRM after a specified time [Unix only]
setitimer() -- cause a signal (described below) after a specified
float time and the timer may restart then [Unix only]
getitimer() -- get current value of timer [... | gpl-2.0 |
marcsans/cnn-physics-perception | phy/lib/python2.7/site-packages/setuptools/command/install.py | 529 | 4683 | from distutils.errors import DistutilsArgError
import inspect
import glob
import warnings
import platform
import distutils.command.install as orig
import setuptools
# Prior to numpy 1.9, NumPy relies on the '_install' name, so provide it for
# now. See https://github.com/pypa/setuptools/issues/199/
_install = orig.in... | mit |
ol-loginov/intellij-community | python/helpers/epydoc/markup/doctest.py | 90 | 13069 | #
# doctest.py: Syntax Highlighting for doctest blocks
# Edward Loper
#
# Created [06/28/03 02:52 AM]
# $Id: restructuredtext.py 1210 2006-04-10 13:25:50Z edloper $
#
"""
Syntax highlighting for doctest blocks. This module defines two
functions, L{doctest_to_html()} and L{doctest_to_latex()}, which can
be used to per... | apache-2.0 |
atopuzov/nitro-python | nssrc/com/citrix/netscaler/nitro/resource/config/cmp/cmpparameter.py | 3 | 14320 | #
# Copyright (c) 2008-2015 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.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | apache-2.0 |
noxrepo/nox-classic | src/utilities/switch_command.py | 16 | 2438 | #!/usr/bin/python
#
# Send arbitrary command to a switch
#
import getopt,sys,os
import httplib
import simplejson
import urllib
# TODO: need to set the path for this
from nox.webapps.webserviceclient.simple import PersistentLogin, NOXWSClient
def usage():
print """
Usage:
switch_command.py -d <direc... | gpl-3.0 |
piquadrat/django | django/middleware/csrf.py | 11 | 13363 | """
Cross Site Request Forgery Middleware.
This module provides a middleware that implements protection
against request forgeries from other sites.
"""
import logging
import re
import string
from urllib.parse import urlparse
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from... | bsd-3-clause |
Hao-Liu/avocado-vt | virttest/staging/utils_cgroup.py | 12 | 26346 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Helpers for cgroup testing.
:copyright: 2011 Red Hat Inc.
:author: Lukas Doktor <ldoktor@redhat.com>
"""
import logging
import os
import shutil
import subprocess
import time
import re
import random
import commands
from tempfile import mkdtemp
from avocado.core import exce... | gpl-2.0 |
suse110/linux-1 | scripts/analyze_suspend.py | 1537 | 120394 | #!/usr/bin/python
#
# Tool for analyzing suspend/resume timing
# Copyright (c) 2013, Intel Corporation.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms and conditions of the GNU General Public License,
# version 2, as published by the Free Software Foundation.
#
# This prog... | gpl-2.0 |
mbayon/TFG-MachineLearning | vbig/lib/python2.7/site-packages/sklearn/metrics/cluster/bicluster.py | 359 | 2797 | from __future__ import division
import numpy as np
from sklearn.utils.linear_assignment_ import linear_assignment
from sklearn.utils.validation import check_consistent_length, check_array
__all__ = ["consensus_score"]
def _check_rows_and_columns(a, b):
"""Unpacks the row and column arrays and checks their shap... | mit |
Denisolt/IEEE-NYIT-MA | local/lib/python2.7/site-packages/django/contrib/gis/gdal/prototypes/raster.py | 320 | 4013 | """
This module houses the ctypes function prototypes for GDAL DataSource (raster)
related data structures.
"""
from ctypes import POINTER, c_char_p, c_double, c_int, c_void_p
from functools import partial
from django.contrib.gis.gdal.libgdal import GDAL_VERSION, std_call
from django.contrib.gis.gdal.prototypes.genera... | gpl-3.0 |
molebot/brython | www/src/Lib/test/test_osx_env.py | 112 | 1342 | """
Test suite for OS X interpreter environment variables.
"""
from test.support import EnvironmentVarGuard, run_unittest
import subprocess
import sys
import sysconfig
import unittest
@unittest.skipUnless(sys.platform == 'darwin' and
sysconfig.get_config_var('WITH_NEXT_FRAMEWORK'),
... | bsd-3-clause |
hhbyyh/spark | python/pyspark/sql/group.py | 24 | 12490 | #
# 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 |
171121130/SWI | venv/Lib/site-packages/mako/ext/pygmentplugin.py | 61 | 4530 | # ext/pygmentplugin.py
# Copyright (C) 2006-2016 the Mako authors and contributors <see AUTHORS file>
#
# This module is part of Mako and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
from pygments.lexers.web import \
HtmlLexer, XmlLexer, JavascriptLexer, CssLexer
from pyg... | mit |
iambibhas/django | django/conf/locale/cs/formats.py | 115 | 1702 | # -*- 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 = 'j. E Y'
TIME_FORMAT = 'G:i'
DATET... | bsd-3-clause |
Gilbert32/leo-3.4 | tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/SchedGui.py | 12980 | 5411 | # SchedGui.py - Python extension for perf script, basic GUI code for
# traces drawing and overview.
#
# Copyright (C) 2010 by Frederic Weisbecker <fweisbec@gmail.com>
#
# This software is distributed under the terms of the GNU General
# Public License ("GPL") version 2 as published by the Free Software
# Foundation.
... | gpl-2.0 |
renyi533/tensorflow | tensorflow/python/keras/optimizer_v2/adadelta_test.py | 2 | 8161 | # 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 |
sammerry/ansible | lib/ansible/executor/playbook_executor.py | 24 | 11332 | # (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) an... | gpl-3.0 |
zozo123/buildbot | master/buildbot/monkeypatches/python14653.py | 3 | 1194 | # 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... | gpl-3.0 |
sameetb-cuelogic/edx-platform-test | common/lib/logsettings.py | 39 | 5740 | import os
import platform
import sys
from logging.handlers import SysLogHandler
LOG_LEVELS = ['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL']
def get_logger_config(log_dir,
logging_env="no_env",
tracking_filename="tracking.log",
edx_filename="edx.log... | agpl-3.0 |
wichovw/tca-gt | server/tca/cars.py | 1 | 1570 | import uuid
import random
class Car:
speed = 0
change_lane_intention = 0
street = None
next_street = None
probability = {}
def __init__(self, **kwargs):
if 'id' in kwargs:
self.id = kwargs['id']
else:
self.id = str(uuid.uuid4())
if 'speed' in... | mit |
zincumyx/Mammoth | mammoth-src/build/contrib/hod/testing/helper.py | 182 | 1122 | #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 thi... | apache-2.0 |
Ernesto99/odoo | addons/l10n_es/__openerp__.py | 314 | 2772 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (c) 2008-2010 Zikzakmedia S.L. (http://zikzakmedia.com) All Rights Reserved.
# Jordi Esteve <jesteve@zikzakmedia.com>
# Copy... | agpl-3.0 |
brianinnes/pycupi | python/vPiP/generators/concircle.py | 2 | 3534 | # Copyright 2016 Mark Benson, portions Copyright 2016 Brian Innes
#
# 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 app... | apache-2.0 |
daenamkim/ansible | lib/ansible/modules/network/illumos/ipadm_ifprop.py | 33 | 8192 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2016, Adam Števko <adam.stevko@gmail.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | gpl-3.0 |
MrSurly/micropython | tests/extmod/ubinascii_a2b_base64.py | 14 | 1248 | try:
try:
import ubinascii as binascii
except ImportError:
import binascii
except ImportError:
print("SKIP")
raise SystemExit
print(binascii.a2b_base64(b""))
print(binascii.a2b_base64(b"Zg=="))
print(binascii.a2b_base64(b"Zm8="))
print(binascii.a2b_base64(b"Zm9v"))
print(binascii.a2b_ba... | mit |
Gebesa-Dev/Addons-gebesa | account_invoice_stock_picking_id/models/account_invoice.py | 1 | 18261 | # -*- coding: utf-8 -*-
# © <YEAR(S)> <AUTHOR(S)>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import _, api, fields, models
from openerp.tools import DEFAULT_SERVER_DATE_FORMAT
from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT
from datetime import datetime, timedelta
from d... | agpl-3.0 |
inares/edx-platform | lms/djangoapps/shoppingcart/admin.py | 63 | 5399 | """Django admin interface for the shopping cart models. """
from ratelimitbackend import admin
from shoppingcart.models import (
PaidCourseRegistrationAnnotation,
Coupon,
DonationConfiguration,
Invoice,
CourseRegistrationCodeInvoiceItem,
InvoiceTransaction
)
class SoftDeleteCouponAdmin(admin.M... | agpl-3.0 |
DennisDenuto/puppet-commonscripts | files/aws_cli/AWS-ElasticBeanstalk-CLI-2.6.3/eb/linux/python3/lib/elasticbeanstalk/request.py | 8 | 11961 | #!/usr/bin/env python
#==============================================================================
# Copyright 2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Amazon Software License (the "License"). You may not use
# this file except in compliance with the License. A copy of the... | mit |
seladb/PcapPlusPlus | Tests/ExamplesTest/tests/test_pcapsplitter.py | 1 | 9849 | import pytest
import os
import ipaddress
from scapy.all import rdpcap, IP, IPv6, TCP, UDP
from .test_utils import ExampleTest
class TestPcapSplitter(ExampleTest):
pytestmark = [pytest.mark.pcapsplitter, pytest.mark.no_network]
def test_split_by_file_size(self, tmpdir):
args = {
'-f': os.path.join('pcap_exampl... | unlicense |
yongtang/tensorflow | tensorflow/python/saved_model/simple_save.py | 25 | 4169 | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | apache-2.0 |
ktan2020/legacy-automation | win/Lib/test/test_descr.py | 7 | 162732 | import __builtin__
import sys
import types
import unittest
from copy import deepcopy
from test import test_support
class OperatorsTest(unittest.TestCase):
def __init__(self, *args, **kwargs):
unittest.TestCase.__init__(self, *args, **kwargs)
self.binops = {
'add': '+',
... | mit |
cloakedcode/CouchPotatoServer | libs/sqlalchemy/engine/base.py | 12 | 120156 | # engine/base.py
# Copyright (C) 2005-2012 the SQLAlchemy authors and contributors <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""Basic components for SQL execution and interfacing with DB-API.
Defines the basic ... | gpl-3.0 |
ChanderG/numpy | numpy/polynomial/tests/test_polyutils.py | 202 | 3094 | """Tests for polyutils module.
"""
from __future__ import division, absolute_import, print_function
import numpy as np
import numpy.polynomial.polyutils as pu
from numpy.testing import (
TestCase, assert_almost_equal, assert_raises,
assert_equal, assert_, run_module_suite)
class TestMisc(TestCase):
def... | bsd-3-clause |
SanPen/PracticalGridModeling | examples/substation.py | 1 | 1669 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Nov 20 16:40:22 2017
@author: santi
"""
import pandas as pd
import numpy as np
import networkx as nx
from matplotlib import pyplot as plt
if __name__ == "__main__":
# load data
conn_df = pd.read_excel('substation.xl... | gpl-3.0 |
sergiorua/libcloud | libcloud/dns/drivers/zerigo.py | 31 | 18314 | # 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 |
FlaPer87/django-nonrel | tests/regressiontests/forms/localflavor/au.py | 25 | 3528 | # -*- coding: utf-8 -*-
# Tests for the contrib/localflavor/ AU form fields.
tests = r"""
## AUPostCodeField ##########################################################
A field that accepts a four digit Australian post code.
>>> from django.contrib.localflavor.au.forms import AUPostCodeField
>>> f = AUPostCodeField()... | bsd-3-clause |
madeleinel/WoMentor | twitter/tweetparse.py | 1 | 2950 | import re
from acceptedlangs import accepted_langs_normal, accepted_langs_lower
def tweetParse(tweetString):
# first identify if mentor or mentee
isMentorBool = '#mentor' in tweetString.lower()
isMentor = 'mentor' if isMentorBool else 'mentee'
# then identify indices of '-'s in string
indices = [i ... | mit |
catsop/CATMAID | django/applications/djsopnet/control/segment.py | 1 | 25749 | import json
from collections import namedtuple
import pysopnet
from django.core.exceptions import ValidationError
from django.db import connection
from django.http import Http404, HttpResponse
from django.shortcuts import get_object_or_404
from catmaid.control.authentication import requires_user_role
from catmaid.mo... | gpl-3.0 |
thinkopensolutions/geraldo | site/newsite/django_1_0/django/utils/_os.py | 27 | 1041 | from os.path import join, normcase, abspath, sep
def safe_join(base, *paths):
"""
Joins one or more path components to the base path component intelligently.
Returns a normalized, absolute version of the final path.
The final path must be located inside of the base path component (otherwise
a Valu... | lgpl-3.0 |
akionakamura/scikit-learn | sklearn/linear_model/tests/test_coordinate_descent.py | 40 | 23697 | # Authors: Olivier Grisel <olivier.grisel@ensta.org>
# Alexandre Gramfort <alexandre.gramfort@inria.fr>
# License: BSD 3 clause
from sys import version_info
import numpy as np
from scipy import interpolate, sparse
from copy import deepcopy
from sklearn.datasets import load_boston
from sklearn.utils.testing ... | bsd-3-clause |
M4rtinK/modrana | core/bundle/upoints/weather_stations.py | 2 | 12056 | #
# vim: set sw=4 sts=4 et tw=80 fileencoding=utf-8:
#
"""weather_stations - Imports weather station data files"""
# Copyright (C) 2007-2010 James Rowe
#
# 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 Fou... | gpl-3.0 |
jcftang/ansible | lib/ansible/modules/network/cumulus/cl_ports.py | 27 | 7194 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2016, Cumulus Networks <ce-ceng@cumulusnetworks.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... | gpl-3.0 |
Jenselme/servo | components/script/dom/bindings/codegen/parser/tests/test_attr_sequence_type.py | 276 | 1626 | def WebIDLTest(parser, harness):
threw = False
try:
parser.parse("""
interface AttrSequenceType {
attribute sequence<object> foo;
};
""")
results = parser.finish()
except:
threw = True
harness.ok(threw, "Attribute type must not be a... | mpl-2.0 |
sozoStudio/sozoStudio.github.io | FoguangTemple_web/node_modules/node-gyp/gyp/pylib/gyp/xcode_ninja.py | 1789 | 10585 | # Copyright (c) 2014 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.
"""Xcode-ninja wrapper project file generator.
This updates the data structures passed to the Xcode gyp generator to build
with ninja instead. The Xcode project i... | apache-2.0 |
openstack/watcher | watcher/conf/clients_auth.py | 2 | 1085 | # -*- encoding: utf-8 -*-
# Copyright (c) 2016 Intel Corp
#
# Authors: Prudhvi Rao Shedimbi <prudhvi.rao.shedimbi@intel.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.apa... | apache-2.0 |
SlimRoms/android_external_chromium_org | chrome/common/extensions/docs/server2/template_data_source_test.py | 15 | 2395 | #!/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 json
import unittest
from extensions_paths import SERVER2
from server_instance import ServerInstance
from template_data_sou... | bsd-3-clause |
glaubitz/fs-uae-debian | launcher/OpenGL/raw/GL/AMD/debug_output.py | 9 | 2233 | '''Autogenerated by xml_generate script, do not edit!'''
from OpenGL import platform as _p, arrays
# Code generation uses this
from OpenGL.raw.GL import _types as _cs
# End users want this...
from OpenGL.raw.GL._types import *
from OpenGL.raw.GL import _errors
from OpenGL.constant import Constant as _C
import ctypes
_... | gpl-2.0 |
elainenaomi/sciwonc-dataflow-examples | sbbd2016/experiments/1-postgres/3_workflow_full_10files_primary_nosh_nors_annot_with_proj_3s/pegasus.bDkvI/pegasus-4.6.0/lib/python2.7/dist-packages/Pegasus/netlogger/configobj.py | 1 | 88638 | # configobj.py
# A config file reader/writer that supports nested sections in config files.
# Copyright (C) 2005-2008 Michael Foord, Nicola Larosa
# E-mail: fuzzyman AT voidspace DOT org DOT uk
# nico AT tekNico DOT net
# ConfigObj 4
# http://www.voidspace.org.uk/python/configobj.html
# Released subject to th... | gpl-3.0 |
mcepl/youtube-dl | devscripts/make_lazy_extractors.py | 14 | 2840 | from __future__ import unicode_literals, print_function
from inspect import getsource
import os
from os.path import dirname as dirn
import sys
print('WARNING: Lazy loading extractors is an experimental feature that may not always work', file=sys.stderr)
sys.path.insert(0, dirn(dirn((os.path.abspath(__file__)))))
la... | unlicense |
duke605/RunePy | commands/viswax.py | 1 | 2553 | from discord.ext import commands
from datetime import datetime
from bs4 import BeautifulSoup
import discord
import re
class VisWax:
def __init__(self, bot):
self.bot = bot
@commands.command(pass_context=True, aliases=['wax'],
description='Shows the combination of runes needed f... | mit |
adafruit/micropython | py/makeqstrdefs.py | 1 | 5324 | """
This script processes the output from the C preprocessor and extracts all
qstr. Each qstr is transformed into a qstr definition of the form 'Q(...)'.
This script works with Python 2.6, 2.7, 3.3 and 3.4.
"""
from __future__ import print_function
import re
import sys
import os
# Python 2/3 compatibility:
# - it... | mit |
nkoep/pymanopt | examples/dominant_eigenvector.py | 1 | 1598 | import numpy as np
import theano.tensor as T
from numpy import linalg as la, random as rnd
import pymanopt
from pymanopt.manifolds import Sphere
from pymanopt.solvers import ConjugateGradient
def dominant_eigenvector(A):
"""
Returns the dominant eigenvector of the symmetric matrix A.
Note: For the same ... | bsd-3-clause |
mluke93/osf.io | scripts/osfstorage/correct_moved_node_settings.py | 18 | 1767 | import sys
import logging
from scripts import utils as script_utils
from framework.transactions.context import TokuTransaction
from website.app import init_app
from website.addons.osfstorage import model
logger = logging.getLogger(__name__)
def do_migration():
count = 0
errored = 0
for node_settings in ... | apache-2.0 |
mitnk/letsencrypt | acme/acme/challenges.py | 6 | 16438 | """ACME Identifier Validation Challenges."""
import abc
import functools
import hashlib
import logging
import socket
from cryptography.hazmat.primitives import hashes
import OpenSSL
import requests
from acme import errors
from acme import crypto_util
from acme import fields
from acme import jose
logger = logging.ge... | apache-2.0 |
maelnor/nova | nova/tests/api/openstack/compute/contrib/test_migrate_server.py | 9 | 10692 | # Copyright 2011 OpenStack Foundation
# 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 ... | apache-2.0 |
mith1979/ansible_automation | applied_python/applied_python/lib/python2.7/site-packages/django/db/migrations/executor.py | 71 | 10728 | from __future__ import unicode_literals
from django.apps.registry import apps as global_apps
from django.db import migrations
from .loader import MigrationLoader
from .recorder import MigrationRecorder
from .state import ProjectState
class MigrationExecutor(object):
"""
End-to-end migration execution - load... | apache-2.0 |
flyher/pymo | android/pgs4a-0.9.6/python-install/lib/python2.7/test/test_index.py | 84 | 9958 | import unittest
from test import test_support
import operator
from sys import maxint
maxsize = test_support.MAX_Py_ssize_t
minsize = -maxsize-1
class oldstyle:
def __index__(self):
return self.ind
class newstyle(object):
def __index__(self):
return self.ind
class TrapInt(int):
def __index... | mit |
kch8qx/osf.io | scripts/clone_wiki_pages.py | 17 | 2766 | """
Create copies of wiki pages for existing forks and registrations instead of
using the same NodeWikiPage objects as the original node.
"""
import logging
import sys
from modularodm import Q
from framework.mongo import database as db
from framework.transactions.context import TokuTransaction
from website.addons.wi... | apache-2.0 |
hakanozadam/bal | bal/core/step.py | 1 | 10734 |
# AUTHORS:
# Hakan Ozadam
# Rachel Brown
#
# Moore Laboratory
# UMASS Medical School / HHMI
# RNA Therapeutics Institute
# Albert Sherman Center, ASC4-1009
# 368 Plantation Street
# Worcester, MA 01605
# USA
#
##############################################... | gpl-2.0 |
Endika/c2c-rd-addons | c2c_budget_report/__init__.py | 4 | 1415 | # -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) Camptocamp SA - http://www.camptocamp.com
# Author: Arnaud WÃŒst ported by nbessi
#
# This file is part of the c2c_budget module
#
# WARNING: This program as such is intended to be used by profes... | agpl-3.0 |
HSAnet/glimpse_client | 3rdparty/breakpad/src/tools/gyp/test/defines-escaping/gyptest-defines-escaping.py | 350 | 4737 | #!/usr/bin/env python
# Copyright (c) 2010 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 build of an executable with C++ define specified by a gyp define using
various special characters such as quotes, commas, etc.
... | bsd-3-clause |
larsbergstrom/servo | tests/wpt/web-platform-tests/tools/third_party/funcsigs/funcsigs/__init__.py | 48 | 30011 | # Copyright 2001-2013 Python Software Foundation; All Rights Reserved
"""Function signature objects for callables
Back port of Python 3.3's function signature tools from the inspect module,
modified to be compatible with Python 2.6, 2.7 and 3.2+.
"""
from __future__ import absolute_import, division, print_function
imp... | mpl-2.0 |
msscully/datamart | datamart/secure_redirect.py | 1 | 1259 | """
Takend from http://flask.pocoo.org/snippets/63/
"""
from urlparse import urlparse, urljoin
from flask import request, url_for, redirect
from flask.ext.wtf import Form
from wtforms import HiddenField
def is_safe_url(target):
ref_url = urlparse(request.host_url)
test_url = urlparse(urljoin(request.host_ur... | mit |
wd15/corr | corr-db/corrdb/common/models/profile_model.py | 1 | 1739 | import datetime
from ..core import db
from ..models import UserModel
from ..models import FileModel
import json
from bson import ObjectId
class ProfileModel(db.Document):
created_at = db.StringField(default=str(datetime.datetime.utcnow()))
user = db.ReferenceField(UserModel, reverse_delete_rule=db.CA... | mit |
Chemcy/vnpy | vn.trader/ctaStrategy/datayesClient.py | 14 | 2853 | # encoding: UTF-8
'''一个简单的通联数据客户端,主要使用requests开发,比通联官网的python例子更为简洁。'''
import requests
import json
FILENAME = 'datayes.json'
HTTP_OK = 200
########################################################################
class DatayesClient(object):
"""通联数据客户端"""
name = u'通联数据客户端'
#---------------------... | mit |
bestwpw/mysql-5.6 | xtrabackup/test/python/BytesIO.py | 31 | 3807 |
# http://wiki.python.org/moin/BytesIO
#
# A skeleton one used for systems that don't have BytesIO.
#
# It's enough for subunit at least....
class BytesIO(object):
""" A file-like API for reading and writing bytes objects.
Mostly like StringIO, but write() calls modify the underlying
bytes object.
>>... | gpl-2.0 |
whitmo/ansible-charm | setup.py | 1 | 1123 | #!/usr/bin/env python
import os
from setuptools import setup
from setuptools import find_packages
PROJECT = u'AnsibleCharm'
VERSION = '0.1'
URL = "https://blog.juju.solutions"
AUTHOR = u'Whit Morriss <whit.morriss@canonical.com>'
AUTHOR_EMAIL = u'whit.morriss@canonical.com'
DESC = "Python library for charming with ans... | gpl-3.0 |
koobonil/Boss2D | Boss2D/addon/tensorflow-1.2.1_for_boss/tensorflow/contrib/distributions/python/kernel_tests/bijectors/inline_test.py | 79 | 3122 | # 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... | mit |
exploreodoo/datStruct | odoo/addons/marketing_campaign/__openerp__.py | 260 | 3127 | # -*- 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... | gpl-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.