repo_name stringlengths 6 100 | path stringlengths 4 294 | copies stringlengths 1 5 | size stringlengths 4 6 | content stringlengths 606 896k | license stringclasses 15
values |
|---|---|---|---|---|---|
jazkarta/edx-platform | common/lib/xmodule/xmodule/errortracker.py | 177 | 1476 | import logging
import sys
import traceback
from collections import namedtuple
log = logging.getLogger(__name__)
ErrorLog = namedtuple('ErrorLog', 'tracker errors')
def exc_info_to_str(exc_info):
"""Given some exception info, convert it into a string using
the traceback.format_exception() function.
"""
... | agpl-3.0 |
ahoyosid/scikit-learn | sklearn/metrics/setup.py | 299 | 1024 | import os
import os.path
import numpy
from numpy.distutils.misc_util import Configuration
from sklearn._build_utils import get_blas_info
def configuration(parent_package="", top_path=None):
config = Configuration("metrics", parent_package, top_path)
cblas_libs, blas_info = get_blas_info()
if os.name ==... | bsd-3-clause |
asen6/amartyasenguptadotcom | django/test/utils.py | 54 | 5195 | import sys
import time
import os
import warnings
from django.conf import settings
from django.core import mail
from django.core.mail.backends import locmem
from django.test import signals
from django.template import Template, loader, TemplateDoesNotExist
from django.template.loaders import cached
from django.utils.tran... | bsd-3-clause |
alexBaizeau/lint-review | tests/tools/test_flake8.py | 2 | 2258 | from lintreview.review import Problems
from lintreview.review import Comment
from lintreview.tools.flake8 import Flake8
from unittest import TestCase
from nose.tools import eq_
class TestFlake8(TestCase):
fixtures = [
'tests/fixtures/pep8/no_errors.py',
'tests/fixtures/pep8/has_errors.py',
]
... | mit |
ahmadio/edx-platform | common/test/acceptance/tests/lms/test_lms_cohorted_courseware_search.py | 51 | 13915 | """
Test courseware search
"""
import os
import json
from ..helpers import remove_file
from ...pages.common.logout import LogoutPage
from ...pages.studio.overview import CourseOutlinePage
from ...pages.lms.courseware_search import CoursewareSearchPage
from ...pages.lms.staff_view import StaffPage
from ...fixtures.cour... | agpl-3.0 |
CartoDB/crankshaft | src/py/crankshaft/test/test_clustering_kmeans.py | 6 | 2722 | import unittest
import numpy as np
from helper import fixture_file
from crankshaft.clustering import Kmeans
from crankshaft.analysis_data_provider import AnalysisDataProvider
import crankshaft.clustering as cc
from crankshaft import random_seeds
import json
from collections import OrderedDict
class FakeDataProvide... | bsd-3-clause |
tachang/uwsgi | examples/uwsgirouter.py | 13 | 1882 | import uwsgi
def application(env, start_response):
# open the socket
fd = uwsgi.async_connect("192.168.173.100:3032")
# wait for connection ready (3s timeout)
yield uwsgi.wait_fd_write(fd, 3)
# has timed out ?
if env['x-wsgiorg.fdevent.timeout']:
print "connection timed out !!!"
uwsgi.close(fd)
raise St... | gpl-2.0 |
rickyboy69/tvportugal | requestsX/adapters.py | 23 | 16246 | # -*- coding: utf-8 -*-
"""
requests.adapters
~~~~~~~~~~~~~~~~~
This module contains the transport adapters that Requests uses to define
and maintain connections.
"""
import socket
from .models import Response
from .packages.urllib3 import Retry
from .packages.urllib3.poolmanager import PoolManager, proxy_from_url
... | apache-2.0 |
ryanmiao/libvirt-test-API | utils/xml_parser.py | 1 | 7336 | #!/usr/bin/env python
#
# xml_parser.py: Parse XML document, the result is a python dict.
#
# Copyright (C) 2010-2012 Red Hat, Inc.
#
# libvirt-test-API 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 v... | gpl-2.0 |
acmeyer/voteid | client/DNS/__init__.py | 40 | 1895 | # -*- encoding: utf-8 -*-
# $Id: __init__.py,v 1.8.2.7 2009/06/09 18:05:29 customdesigned Exp $
#
# This file is part of the pydns project.
# Homepage: http://pydns.sourceforge.net
#
# This code is covered by the standard Python License.
#
# __init__.py for DNS class.
__version__ = '2.3.4'
import Type,Opcode,Status,... | mit |
ksmit799/Toontown-Source | toontown/cogdominium/CogdoMazeGameObjects.py | 1 | 10289 | from pandac.PandaModules import CollisionSphere, CollisionTube, CollisionNode
from pandac.PandaModules import NodePath, BitMask32
from pandac.PandaModules import Point3, Point4, WaitInterval, Vec3, Vec4
from direct.interval.IntervalGlobal import LerpScaleInterval, LerpColorScaleInterval, LerpPosInterval, LerpFunc
from ... | mit |
rschiang/shedskin | examples/mm/game.py | 6 | 1208 | import board
import row
import code
""" copyright Sean McCarthy, license GPL v2 or later """
class Game:
"""Class Game, provides functions for playing"""
def __init__(self,maxguesses=16):
secret = code.Code()
secret.setRandomCode()
self.__secretCode = secret
self.__board = boa... | gpl-3.0 |
nikhilprathapani/python-for-android | python3-alpha/python3-src/Lib/encodings/cp737.py | 272 | 34681 | """ Python Character Mapping Codec cp737 generated from 'VENDORS/MICSFT/PC/CP737.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... | apache-2.0 |
dharmabumstead/ansible | lib/ansible/utils/module_docs_fragments/cnos.py | 33 | 3747 | # Copyright (C) 2017 Lenovo, Inc.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansi... | gpl-3.0 |
Ramalus/herovoices | .buildozer/venv/lib/python2.7/site-packages/pip/_vendor/html5lib/treeadapters/sax.py | 1835 | 1661 | from __future__ import absolute_import, division, unicode_literals
from xml.sax.xmlreader import AttributesNSImpl
from ..constants import adjustForeignAttributes, unadjustForeignAttributes
prefix_mapping = {}
for prefix, localName, namespace in adjustForeignAttributes.values():
if prefix is not None:
pre... | gpl-2.0 |
JakubBrachTieto/openthread | tools/harness-automation/cases/ed_6_2_2.py | 16 | 1867 | #!/usr/bin/env python
#
# Copyright (c) 2016, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# notic... | bsd-3-clause |
CeltonMcGrath/TACTIC | src/tactic/ui/checkin/branch_wdg.py | 6 | 5640 | ###########################################################
#
# Copyright (c) 2011, Southpaw Technology
# All Rights Reserved
#
# PROPRIETARY INFORMATION. This software is proprietary to
# Southpaw Technology, and is not to be reproduced, transmitted,
# or disclosed in any way without written permi... | epl-1.0 |
chromium/chromium | ui/ozone/generate_constructor_list.py | 5 | 5576 | #!/usr/bin/env python
# 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.
"""Code generator for PlatformObject<> constructor list.
This script takes as arguments a list of platform names as a text file and
a ... | bsd-3-clause |
wschwa/Mr-Orange-Sick-Beard | lib/imdb/parser/http/topBottomParser.py | 128 | 3845 | """
parser.http.topBottomParser module (imdb package).
This module provides the classes (and the instances), used to parse the
lists of top 250 and bottom 100 movies.
E.g.:
http://akas.imdb.com/chart/top
http://akas.imdb.com/chart/bottom
Copyright 2009 Davide Alberani <da@erlug.linux.it>
This program is free... | gpl-3.0 |
acsone/odoo | addons/procurement/wizard/__init__.py | 374 | 1077 | # -*- 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 |
l0b0/cds-invenio-vengmark | modules/bibformat/lib/elements/bfe_contact.py | 4 | 1536 | # -*- coding: utf-8 -*-
##
## This file is part of CDS Invenio.
## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 CERN.
##
## CDS Invenio is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either versio... | gpl-2.0 |
kaiyuanl/gem5 | src/dev/Ethernet.py | 37 | 8157 | # Copyright (c) 2005-2007 The Regents of The University of Michigan
# 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 ... | bsd-3-clause |
msmolens/VTK | ThirdParty/Twisted/twisted/conch/insults/helper.py | 30 | 14146 | # -*- test-case-name: twisted.conch.test.test_helper -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Partial in-memory terminal emulator
@author: Jp Calderone
"""
import re, string
from zope.interface import implements
from twisted.internet import defer, protocol, reactor
from twist... | bsd-3-clause |
frankchin/mezzanine | mezzanine/utils/device.py | 35 | 2035 | from __future__ import unicode_literals
def device_from_request(request):
"""
Determine's the device name from the request by first looking for an
overridding cookie, and if not found then matching the user agent.
Used at both the template level for choosing the template to load and
also at the ca... | bsd-2-clause |
filias/django | django/utils/numberformat.py | 431 | 1944 | from __future__ import unicode_literals
from decimal import Decimal
from django.conf import settings
from django.utils import six
from django.utils.safestring import mark_safe
def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep='',
force_grouping=False):
"""
Gets a number (... | bsd-3-clause |
littlstar/chromium.src | tools/telemetry/telemetry/core/extension_to_load.py | 53 | 2127 | # 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.
import os
from telemetry.core.backends.chrome import crx_id
class ExtensionPathNonExistentException(Exception):
pass
class MissingPublicKeyException(Exc... | bsd-3-clause |
prakritish/ansible | test/units/executor/module_common/test_recursive_finder.py | 34 | 5973 | # (c) 2017, 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 |
paolodedios/tensorflow | tensorflow/lite/python/authoring/authoring.py | 2 | 9077 | # Copyright 2021 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 |
jgibbons-cp/sva_scan_examples | app/sva_scan_examples/config_helper.py | 1 | 1913 | import os
import sys
class ConfigHelper():
"""
Manage all configuration information for the application
"""
def __init__(self):
TRUE = "True"
FALSE = "False"
ERROR = 1
self.halo_key = os.getenv("HALO_API_KEY")
self.halo_secret = os.getenv("HALO_API_SECRET_K... | bsd-2-clause |
Sweetgrassbuffalo/ReactionSweeGrass-v2 | .meteor/local/dev_bundle/python/Lib/test/curses_tests.py | 201 | 1241 | #!/usr/bin/env python
#
# $Id: ncurses.py 36559 2004-07-18 05:56:09Z tim_one $
#
# Interactive test suite for the curses module.
# This script displays various things and the user should verify whether
# they display correctly.
#
import curses
from curses import textpad
def test_textpad(stdscr, insert_mode=False):
... | gpl-3.0 |
lecaoquochung/ddnb.django | django/utils/tzinfo.py | 97 | 3923 | "Implementation of tzinfo classes for use with datetime.datetime."
from __future__ import unicode_literals
from datetime import timedelta, tzinfo
import time
import warnings
from django.utils.deprecation import RemovedInDjango19Warning
from django.utils.encoding import force_str, force_text, DEFAULT_LOCALE_ENCODING
... | bsd-3-clause |
SpectreJan/gnuradio | gr-qtgui/python/qtgui/util.py | 15 | 1148 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2016 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... | gpl-3.0 |
KavyaSharma/Algo_Ds_Notes | Bellmanford_Algorithm/Bellmanford.py | 4 | 2026 | class BellmanFord:
"""
Input : Directed Graph
Output : Minimum distance from provided source
Requirements
==========================================================
* Adjency List in the form of a dictionary
* Note : Each node should have a corresponding key (even if empty)
* A so... | gpl-3.0 |
emakis/erpnext | erpnext/controllers/taxes_and_totals.py | 1 | 24666 | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import json
import frappe, erpnext
from frappe import _, scrub
from frappe.utils import cint, flt, cstr, fmt_money, round_based_on_smallest_currency_fra... | gpl-3.0 |
ashhher3/pattern | pattern/web/pdf/utils.py | 28 | 8540 | #!/usr/bin/env python2
"""
Miscellaneous Routines.
"""
import struct
from sys import maxint as INF
## Matrix operations
##
MATRIX_IDENTITY = (1, 0, 0, 1, 0, 0)
def mult_matrix((a1,b1,c1,d1,e1,f1), (a0,b0,c0,d0,e0,f0)):
"""Returns the multiplication of two matrices."""
return (a0*a1+c0*b1, b0*a1+d0*b1,
... | bsd-3-clause |
jtattermusch/grpc | tools/run_tests/xds_k8s_test_driver/framework/rpc/grpc.py | 4 | 3384 | # Copyright 2020 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 |
nismod/energy_demand | energy_demand/plotting/fig_p2_weather_val.py | 1 | 14554 | """Fig 2 figure
"""
import numpy as np
import matplotlib.pyplot as plt
#from scipy.stats import mstats
import pandas as pd
import geopandas as gpd
from scipy import stats
from shapely.geometry import Point
import matplotlib.pyplot as plt
from collections import defaultdict
from matplotlib.colors import Normalize
from ... | mit |
sidartaoliveira/ansible | lib/ansible/modules/packaging/os/svr4pkg.py | 71 | 8220 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2012, Boyd Adamson <boyd () boydadamson.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of th... | gpl-3.0 |
sivertkh/gtrackcore | gtrackcore/track_operations/raw_operations/Shift.py | 1 | 4473 |
import numpy as np
def shift(starts, ends, regionSize, strands=None, shiftLength=None,
useFraction=False, useStrands=True, treatMissingAsNegative=False):
"""
Shift elements in a track a give nr of BP.
:param starts: numpy array. Starts
:param ends: numpy array. Ends
:param regionSize: I... | gpl-3.0 |
jumpojoy/neutron | neutron/db/migration/alembic_migrations/versions/38495dc99731_ml2_tunnel_endpoints_table.py | 22 | 1550 | # Copyright 2014 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 ... | apache-2.0 |
Cabalist/Comix | src/preferences.py | 1 | 25264 | # coding=utf-8
"""preferences.py - Preference handler."""
from __future__ import absolute_import
import cPickle
import os
import gtk
from src import constants
from src import labels
ZOOM_MODE_BEST = 0
ZOOM_MODE_WIDTH = 1
ZOOM_MODE_HEIGHT = 2
ZOOM_MODE_MANUAL = 3
# All the preferences are stored here.
prefs = {
... | gpl-2.0 |
percy-g2/Novathor_xperia_u8500 | 6.1.1.B.0.253/external/webkit/Tools/Scripts/webkitpy/style/checker_unittest.py | 15 | 33983 | #!/usr/bin/python
# -*- coding: utf-8; -*-
#
# Copyright (C) 2009 Google Inc. All rights reserved.
# Copyright (C) 2009 Torch Mobile Inc.
# Copyright (C) 2009 Apple Inc. All rights reserved.
# Copyright (C) 2010 Chris Jerdonek (chris.jerdonek@gmail.com)
#
# Redistribution and use in source and binary forms, with or wit... | gpl-2.0 |
AngryBork/apex-sigma-plugins | fun/economy/givetovault.py | 3 | 1328 | import discord
async def givetovault(cmd, message, args):
if args:
try:
amount = int(abs(int(args[0])))
except ValueError:
amount = None
if amount:
currency = cmd.bot.cfg.pref.currency
current_kud = cmd.db.get_currency(message.author, message... | gpl-3.0 |
owtf/owtf | owtf/shell/interactive.py | 1 | 6596 | """
owtf.shell.interactive
~~~~~~~~~~~~~~~~~~~~~~
The shell module allows running arbitrary shell commands and is critical
to the framework in order to run third party tools. The interactive shell module allows non-blocking
interaction with subprocesses running tools or remote connections (i.e. shells)
"""
import logg... | bsd-3-clause |
karmix/anaconda | pyanaconda/ui/gui/spokes/advstorage/zfcp.py | 5 | 6251 | # zFCP configuration dialog
#
# Copyright (C) 2013 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distributed... | gpl-2.0 |
Murder66/mpc-hc-master | src/mpc-hc/mpcresources/UpdateISPOT.py | 4 | 1161 | # (C) 2013 see Authors.txt
#
# This file is part of MPC-HC.
#
# MPC-HC is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# MPC-HC is di... | gpl-3.0 |
danaukes/popupcad | popupcad/filetypes/genericshapebase.py | 2 | 15733 |
# -*- coding: utf-8 -*-
"""
Written by Daniel M. Aukes and CONTRIBUTORS
Email: danaukes<at>asu.edu.
Please see LICENSE for full license.
"""
from popupcad.geometry.vertex import ShapeVertex
import numpy
import qt.QtCore as qc
import qt.QtGui as qg
from dev_tools.enum import enum
import popupcad
class ShapeInvalid... | mit |
gauribhoite/personfinder | tests/server_test_cases/secret_tests.py | 8 | 2796 | #!/usr/bin/python2.7
# encoding: utf-8
# Copyright 2010 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 ... | apache-2.0 |
basilfx/BierApp-Server | bierapp/core/decorators.py | 1 | 1740 | from django.shortcuts import get_object_or_404
from django.http import Http404
from functools import wraps
from bierapp.accounts.models import User
from bierapp.core.models import Transaction, ProductGroup, Product, \
TransactionTemplate
from bierapp.utils.types import get_int
def resolve_user(func):
@wraps... | gpl-3.0 |
Leo-g/Flask-Scaffold | app/roles/views.py | 2 | 4405 | from flask import Blueprint, request, jsonify, make_response
from app.roles.models import Roles, RolesSchema
from flask_restful import Api
from app.baseviews import Resource
from app.basemodels import db
from sqlalchemy.exc import SQLAlchemyError
from marshmallow import ValidationError
roles = Blueprint('roles', __nam... | mit |
tincan24/electron | script/cpplint.py | 153 | 1850 | #!/usr/bin/env python
import fnmatch
import os
import sys
from lib.util import execute
IGNORE_FILES = [
os.path.join('atom', 'app', 'atom_main.cc'),
os.path.join('atom', 'browser', 'mac', 'atom_application.h'),
os.path.join('atom', 'browser', 'mac', 'atom_application_delegate.h'),
os.path.join('atom', 'brows... | mit |
lavajumper/sexcoin | contrib/linearize/linearize-data.py | 105 | 10081 | #!/usr/bin/env python3
#
# linearize-data.py: Construct a linear, no-fork version of the chain.
#
# Copyright (c) 2013-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
from __future__ import print... | mit |
yelizariev/account-financial-tools | account_journal_always_check_date/__init__.py | 37 | 1089 | # -*- encoding: utf-8 -*-
##############################################################################
#
# Account Journal Always Check Date module for OpenERP
# Copyright (C) 2013-2014 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
#
# This program is free so... | agpl-3.0 |
bguillot/OpenUpgrade | addons/sale_mrp/sale_mrp.py | 61 | 4738 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
# This program is free software: you can redistribute it and/or modify
# ... | agpl-3.0 |
ghber/My-Django-Nonrel | django/contrib/flatpages/models.py | 410 | 1134 | from django.db import models
from django.contrib.sites.models import Site
from django.utils.translation import ugettext_lazy as _
class FlatPage(models.Model):
url = models.CharField(_('URL'), max_length=100, db_index=True)
title = models.CharField(_('title'), max_length=200)
content = models.TextField(_(... | bsd-3-clause |
chippey/gaffer | python/GafferImageUITest/ImageGadgetTest.py | 1 | 3183 | ##########################################################################
#
# Copyright (c) 2015, Image Engine Design 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:
#
# * Redistrib... | bsd-3-clause |
freedesktop-unofficial-mirror/gstreamer-sdk__pygobject | codegen/argtypes.py | 6 | 45180 | # -*- Mode: Python; py-indent-offset: 4 -*-
import string
import keyword
import struct
py_ssize_t_clean = False
class ArgTypeError(Exception):
pass
class ArgTypeNotFoundError(ArgTypeError):
pass
class ArgTypeConfigurationError(ArgTypeError):
pass
class VarList:
"""Nicely format a C variable list""... | lgpl-2.1 |
2015fallproject/2015fallcase2 | static/Brython3.2.0-20150701-214155/Lib/sre_constants.py | 692 | 7172 | #
# Secret Labs' Regular Expression Engine
#
# various symbols used by the regular expression engine.
# run this script to update the _sre include files!
#
# Copyright (c) 1998-2001 by Secret Labs AB. All rights reserved.
#
# See the sre.py file for information on usage and redistribution.
#
"""Internal support modul... | agpl-3.0 |
angelapper/edx-platform | common/djangoapps/student/tests/test_email.py | 5 | 20181 |
import json
import unittest
import mock
from django.conf import settings
from django.contrib.auth.models import User
from django.core import mail
from django.core.urlresolvers import reverse
from django.db import transaction
from django.http import HttpResponse
from django.test import override_settings, TestCase, Tra... | agpl-3.0 |
gurneyalex/odoo | addons/sale_timesheet/tests/test_project_billing_multicompany.py | 7 | 1603 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo.addons.sale_timesheet.tests.common import TestCommonSaleTimesheetMultiCompanyNoChart
class TestProjectBillingMulticompany(TestCommonSaleTimesheetMultiCompanyNoChart):
@classmethod
def setUpClass(cls):... | agpl-3.0 |
srajag/nova | nova/tests/integrated/v3/test_extended_availability_zone.py | 31 | 1318 | # Copyright 2012 Nebula, Inc.
# 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... | apache-2.0 |
nervenXC/topical_word_embeddings | TWE-1/gensim/examples/dmlcz/sources.py | 83 | 12976 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
This module contains implementations (= different classes) which encapsulate the
idea of a Digital Library document source.
A docum... | mit |
sebastic/libkml-1 | third_party/gtest-1.7.0/test/gtest_catch_exceptions_test.py | 2139 | 9901 | #!/usr/bin/env python
#
# Copyright 2010 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 o... | bsd-3-clause |
aringh/odl | odl/util/vectorization.py | 1 | 8540 | # Copyright 2014-2017 The ODL contributors
#
# This file is part of ODL.
#
# This Source Code Form is subject to the terms of the Mozilla Public License,
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
# obtain one at https://mozilla.org/MPL/2.0/.
"""Utilities for internal functionality con... | mpl-2.0 |
carolinux/QGIS | python/plugins/GdalTools/tools/doExtractProj.py | 12 | 7701 | # -*- coding: utf-8 -*-
"""
***************************************************************************
doExtractProj.py
---------------------
Date : August 2011
Copyright : (C) 2011 by Alexander Bruy
Email : alexander dot bruy at gmail dot com
************... | gpl-2.0 |
jpush/jbox | Server/venv/lib/python3.5/site-packages/pip/_vendor/lockfile/symlinklockfile.py | 536 | 2616 | from __future__ import absolute_import
import os
import time
from . import (LockBase, NotLocked, NotMyLock, LockTimeout,
AlreadyLocked)
class SymlinkLockFile(LockBase):
"""Lock access to a file using symlink(2)."""
def __init__(self, path, threaded=True, timeout=None):
# super(Symlin... | mit |
saintpai/sos | sos/plugins/ppp.py | 5 | 1213 | # 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 |
Tatsh/youtube-dl | youtube_dl/YoutubeDL.py | 3 | 112834 | #!/usr/bin/env python
# coding: utf-8
from __future__ import absolute_import, unicode_literals
import collections
import contextlib
import copy
import datetime
import errno
import fileinput
import io
import itertools
import json
import locale
import operator
import os
import platform
import re
import shutil
import su... | unlicense |
tvibliani/odoo | addons/base_vat/res_company.py | 448 | 1404 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Business Applications
# Copyright (c) 2011 OpenERP S.A. <http://openerp.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GN... | agpl-3.0 |
Metaswitch/horizon | openstack_dashboard/test/integration_tests/regions/forms.py | 17 | 12197 | # 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 |
openhatch/oh-mainline | vendor/packages/twisted/doc/core/howto/listings/deferred/deferred_ex7.py | 16 | 1592 | #!/usr/bin/env python
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
from twisted.internet import defer
from twisted.python import failure, util
"""
The deferred callback chain is stateful, and can be executed before
or after all callbacks have been added to the chain
"""
class Counter(obje... | agpl-3.0 |
Rawk/xbmc | tools/EventClients/Clients/J2ME Client/j2me_remote.py | 111 | 5784 | #!/usr/bin/python
#
# XBMC Media Center
# J2ME Remote
# Copyright (c) 2008 topfs2
#
# 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 lat... | gpl-2.0 |
timkrentz/SunTracker | IMU/VTK-6.2.0/ThirdParty/Twisted/twisted/spread/util.py | 2 | 6555 | # -*- test-case-name: twisted.test.test_pb -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Utility classes for spread.
"""
from twisted.internet import defer
from twisted.python.failure import Failure
from twisted.spread import pb
from twisted.protocols import basic
fro... | mit |
tgsd96/gargnotes | venv/lib/python2.7/site-packages/django/utils/functional.py | 59 | 16093 | import copy
import operator
from functools import wraps
import sys
import warnings
from django.utils import six
from django.utils.deprecation import RemovedInDjango19Warning
from django.utils.six.moves import copyreg
# You can't trivially replace this with `functools.partial` because this binds
# to classes and retu... | mit |
71squared/Cocos2DX-ParticleSystemOpacity | cocos2d/plugin/tools/toolsForGame/modifyManifest.py | 263 | 2068 | import sys, string, os
from xml.etree import ElementTree as ET
manifestFile = sys.argv[1]
pluginStr = sys.argv[2]
pluginsDir = sys.argv[3]
androidNS = 'http://schemas.android.com/apk/res/android'
sourceCfgFile = '/android/ForManifest.xml'
def doModify(sourceFile, root):
bRet = False
sourceTree = ET.parse(sou... | mit |
aidanlister/django | django/db/backends/oracle/base.py | 174 | 24995 | """
Oracle database backend for Django.
Requires cx_Oracle: http://cx-oracle.sourceforge.net/
"""
from __future__ import unicode_literals
import datetime
import decimal
import os
import platform
import sys
import warnings
from django.conf import settings
from django.db import utils
from django.db.backends.base.base ... | bsd-3-clause |
gsehub/edx-platform | openedx/core/djangoapps/oauth_dispatch/models.py | 9 | 4655 | """
Specialized models for oauth_dispatch djangoapp
"""
from datetime import datetime
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django_mysql.models import ListCharField
from oauth2_provider.settings import oauth2_settings
from organizations.models import Organization
fr... | agpl-3.0 |
a-parhom/edx-platform | lms/djangoapps/instructor_task/tasks_helper/module_state.py | 2 | 19768 | """
Instructor Tasks related to module state.
"""
import json
import logging
from time import time
from django.utils.translation import ugettext_noop
from opaque_keys.edx.keys import UsageKey
from capa.responsetypes import LoncapaProblemError, ResponseError, StudentInputError
from courseware.courses import get_course... | agpl-3.0 |
sujeet4github/MyLangUtils | LangPython/oreilly-intro-to-flask-video/venv/lib/python3.6/site-packages/wtforms/widgets/html5.py | 78 | 2440 | """
Widgets for various HTML5 input types.
"""
from .core import Input
__all__ = (
'ColorInput', 'DateInput', 'DateTimeInput', 'DateTimeLocalInput',
'EmailInput', 'MonthInput', 'NumberInput', 'RangeInput', 'SearchInput',
'TelInput', 'TimeInput', 'URLInput', 'WeekInput',
)
class SearchInput(Input):
"... | gpl-3.0 |
CiscoSystems/vespa | neutron/plugins/embrane/plugins/embrane_fake_plugin.py | 18 | 1360 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 Embrane, 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/l... | apache-2.0 |
euphorie/Euphorie | src/euphorie/client/authentication.py | 1 | 9395 | """
Authentication
--------------
User account plugins and authentication.
"""
from ..content.api.authentication import authenticate_token as authenticate_cms_token
from . import model
from .interfaces import IClientSkinLayer
from AccessControl import ClassSecurityInfo
from Acquisition import aq_parent
from App.class... | gpl-2.0 |
tensorflow/models | official/vision/beta/modeling/backbones/resnet_3d_test.py | 1 | 3813 | # Copyright 2021 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 |
home-assistant/home-assistant | homeassistant/components/zha/api.py | 2 | 44893 | """Web socket API for Zigbee Home Automation devices."""
import asyncio
import collections
from collections.abc import Mapping
import logging
from typing import Any
import voluptuous as vol
from zigpy.config.validators import cv_boolean
from zigpy.types.named import EUI64
from zigpy.zcl.clusters.security import IasAc... | apache-2.0 |
angelapper/edx-platform | lms/djangoapps/instructor/views/instructor_dashboard.py | 2 | 35911 | """
Instructor Dashboard Views
"""
import datetime
import logging
import uuid
import pytz
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse
from django.http import Http404, HttpResponseServerError
from django.utils.html import escap... | agpl-3.0 |
DFO-Ocean-Navigator/Ocean-Data-Map-Project | tests/test_scriptGen.py | 1 | 5515 | import ast
from plotting.scriptGenerator import generatePython, generateR
from oceannavigator import create_app
import hashlib
import json
import unittest
from io import BytesIO
class TestScriptGenerator(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.app = create_app()
def test_genera... | gpl-3.0 |
tumbl3w33d/ansible | lib/ansible/modules/cloud/cloudstack/cs_securitygroup_rule.py | 38 | 12923 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# (c) 2015, René Moser <mail@renemoser.net>
# 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 |
larryweya/dry-pyramid | drypyramid/tests.py | 1 | 20737 | import unittest
import colander
from webob.multidict import MultiDict
from webtest import TestApp
from pyramid import testing
from pyramid.httpexceptions import (
HTTPNotFound,
HTTPFound
)
from sqlalchemy import (
create_engine,
Column,
Integer,
String,
Table,
ForeignKey,
)
from sqlalch... | mit |
2014c2g12/c2g12 | exts/wsgi/static/Brython2.1.0-20140419-113919/Lib/pprint.py | 96 | 12700 | # Author: Fred L. Drake, Jr.
# fdrake@acm.org
#
# This is a simple little module I wrote to make life easier. I didn't
# see anything quite like it in the library, though I may have overlooked
# something. I wrote this when I was trying to read some heavily nested
# tuples with fairly non-desc... | gpl-2.0 |
SteveXiSong/ECE757-SnoopingPredictions | src/arch/x86/isa/insts/general_purpose/data_transfer/xchg.py | 89 | 3288 | # Copyright (c) 2007 The Hewlett-Packard Development Company
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implemen... | bsd-3-clause |
takis/odoo | addons/purchase/__init__.py | 439 | 1185 | # -*- 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 |
dkubiak789/odoo | addons/hr_payroll/__openerp__.py | 260 | 2421 | #-*- coding:utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# d$
#
# This program is free software: you can redistribute it and/or modify
# it ... | agpl-3.0 |
sopier/django | tests/m2o_recursive/models.py | 282 | 1047 | """
Relating an object to itself, many-to-one
To define a many-to-one relationship between a model and itself, use
``ForeignKey('self', ...)``.
In this example, a ``Category`` is related to itself. That is, each
``Category`` has a parent ``Category``.
Set ``related_name`` to designate what the reverse relationship i... | bsd-3-clause |
apache/libcloud | libcloud/common/gridscale.py | 5 | 4296 | # 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 |
gimler/techism2 | djangoappengine/management/commands/runserver.py | 8 | 3454 | #!/usr/bin/python2.4
#
# 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... | apache-2.0 |
6aika/issue-reporting | issues/models/applications.py | 1 | 1241 | from django.db import models
from django.utils.crypto import get_random_string
from issues.excs import InvalidAppError
DEFAULT_APP_DATA = { # Used by `.autodetermine()` and the migration
'identifier': 'default',
'name': 'Default',
'key': ''
}
def generate_api_key():
return get_random_string(30)
c... | mit |
Sorsly/subtle | google-cloud-sdk/lib/third_party/prompt_toolkit/eventloop/base.py | 4 | 2521 | from __future__ import unicode_literals
from abc import ABCMeta, abstractmethod
from six import with_metaclass
__all__ = (
'EventLoop',
'INPUT_TIMEOUT',
)
#: When to trigger the `onInputTimeout` event.
INPUT_TIMEOUT = .5
class EventLoop(with_metaclass(ABCMeta, object)):
"""
Eventloop interface.
... | mit |
andrewleech/SickRage | lib/validators/i18n/fi.py | 28 | 2214 | import re
from validators.utils import validator
business_id_pattern = re.compile(r'^[0-9]{7}-[0-9]$')
ssn_checkmarks = '0123456789ABCDEFHJKLMNPRSTUVWXY'
ssn_pattern = re.compile(
r"""^
(?P<date>([0-2]\d|3[01])
(0\d|1[012])
(\d{{2}}))
[A+-]
(?P<serial>(\d{{3}}))
(?P<checksum>[{checkmarks}]... | gpl-3.0 |
gisadmin/vb2py | vb2py/test/testconfig.py | 2 | 10226 | #
# Turn off logging in extensions (too loud!)
import vb2py.extensions
import unittest
vb2py.extensions.disableLogging()
import vb2py.vbparser
vb2py.vbparser.log.setLevel(0) # Don't print all logging stuff
import vb2py.config
import ConfigParser
from vb2py.vbparser import convertVBtoPython
import re
class TestConfig(... | gpl-3.0 |
surhudm/scipy | benchmarks/benchmarks/cython_special.py | 31 | 2055 | from __future__ import division, absolute_import, print_function
import re
import six
import numpy as np
from scipy import special
try:
from scipy.special import cython_special
except ImportError:
pass
from .common import Benchmark, with_attributes
FUNC_ARGS = {
'airy_d': (1,),
'airy_D': (1,),
... | bsd-3-clause |
udomsak/RedisLive | src/util/redis-fill-data.py | 13 | 1024 | #! /usr/bin/env python
import redis
from time import strftime
import time
import random
def monitor():
redisHost = "127.0.0.1"
redisPort = 6379
redisClient = redis.StrictRedis(host=redisHost, port=redisPort, db=0)
while True:
x = random.randint(1, 100)
y = random.randint(1, 20)
if y==1:
for z in xr... | mit |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.