repo_name stringlengths 5 100 | path stringlengths 4 294 | copies stringclasses 990
values | size stringlengths 4 7 | content stringlengths 666 1M | license stringclasses 15
values |
|---|---|---|---|---|---|
srcLurker/home-assistant | homeassistant/components/notify/file.py | 11 | 1902 | """
Support for file notification.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/notify.file/
"""
import logging
import os
import voluptuous as vol
import homeassistant.util.dt as dt_util
from homeassistant.components.notify import (
ATTR_TITLE, A... | mit |
Mikrobit/uwsgi.it | uwsgi_it_api/uwsgi_it_api/views_metrics.py | 2 | 7226 | from django.http import HttpResponseForbidden
from django.core.cache import get_cache
from uwsgi_it_api.config import UWSGI_IT_BASE_UID, UWSGI_IT_METRICS_CACHE
from uwsgi_it_api.decorators import need_basicauth
from uwsgi_it_api.utils import spit_json
import datetime
def metrics_container_do(request, container, qs, ... | mit |
s3nk4s/flaskTutorials | FlaskApp/FlaskApp/venv/local/lib/python2.7/site-packages/pip/wheel.py | 184 | 20618 | """
Support for installing and building the "wheel" binary package format.
"""
from __future__ import with_statement
import compileall
import csv
import functools
import hashlib
import os
import re
import shutil
import sys
from base64 import urlsafe_b64encode
from email.parser import Parser
from pip.backwardcompat i... | mit |
Robpol86/sphinxcontrib-versioning | tests/test_routines/test_pre_build.py | 1 | 4796 | """Test function in module."""
import posixpath
import py
import pytest
from sphinxcontrib.versioning.lib import HandledError
from sphinxcontrib.versioning.routines import gather_git_info, pre_build
from sphinxcontrib.versioning.versions import Versions
def test_single(local_docs):
"""With single version.
... | mit |
gerddie/nipype | examples/dmri_group_connectivity_mrtrix.py | 9 | 7497 | """
==================================================
dMRI: Group connectivity - MRtrix, FSL, FreeSurfer
==================================================
Introduction
============
This script, dmri_group_connectivity_mrtrix.py, runs group-based connectivity analysis using
the dmri.mrtrix.connectivity_mapping Nipyp... | bsd-3-clause |
nkcr/WebIndex | app/venv/lib/python3.5/site-packages/nltk/classify/rte_classify.py | 7 | 6477 | # Natural Language Toolkit: RTE Classifier
#
# Copyright (C) 2001-2016 NLTK Project
# Author: Ewan Klein <ewan@inf.ed.ac.uk>
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
"""
Simple classifier for RTE corpus.
It calculates the overlap in words and named entities between text and
hypothesis, and... | mit |
pleeplee-robot/interface | pleepleeapp/menu_init.py | 1 | 7422 | #!/usr/bin/env python3
import pygame
import sys
import time
import os
from pygame.locals import *
from .button import Button
from .pygame_textinput import TextInput
from .globals import (screen_width, screen_height, FPS, fps_clock,
fontPath, assetsPath)
from .tool import (swap_c_is_chosing_color... | mit |
MungoRae/home-assistant | homeassistant/components/automation/event.py | 8 | 1353 | """
Offer event listening automation rules.
For more details about this automation rule, please refer to the documentation
at https://home-assistant.io/docs/automation/trigger/#event-trigger
"""
import asyncio
import logging
import voluptuous as vol
from homeassistant.core import callback
from homeassistant.const im... | apache-2.0 |
JuezUN/INGInious | base-containers/base/inginious/rst.py | 1 | 1612 | # -*- coding: utf-8 -*-
#
# This file is part of INGInious. See the LICENSE and the COPYRIGHTS files for
# more information about the licensing of this file.
import os
import base64
def get_codeblock(language, text):
""" Generates rst codeblock for given text and language """
rst = "\n\n.. code-block:: " + la... | agpl-3.0 |
postrational/django | django/contrib/gis/db/models/proxy.py | 220 | 2595 | """
The GeometryProxy object, allows for lazy-geometries. The proxy uses
Python descriptors for instantiating and setting Geometry objects
corresponding to geographic model fields.
Thanks to Robert Coup for providing this functionality (see #4322).
"""
from django.contrib.gis import memoryview
from django.utils impor... | bsd-3-clause |
mlassnig/pilot | ProxyGuard.py | 4 | 4281 | import os
import commands
from pUtil import tolog
class ProxyGuard:
"""
This class is used to hide the grid proxy for the payload
"""
def __init__(self):
""" Default init """
self.proxy = None
self.read = False
self.x509_user_proxy = None
def isRead(self):
... | apache-2.0 |
sparkslabs/kamaelia_ | Sketches/THF/Packages/Kamaelia/Community/THF/Kamaelia/UI/OpenGL/Label.py | 12 | 8568 | #!/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 |
jbassen/edx-platform | lms/djangoapps/bulk_email/migrations/0006_add_course_email_template.py | 182 | 6003 | # -*- coding: utf-8 -*-
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'CourseEmailTemplate'
db.create_table('bulk_email_courseemailtemplate', (
('id', self.gf('django.... | agpl-3.0 |
akaariai/django | tests/template_tests/syntax_tests/test_include.py | 31 | 12841 | from django.template import (
Context, Template, TemplateDoesNotExist, TemplateSyntaxError, engines,
)
from django.test import SimpleTestCase, override_settings
from ..utils import setup
from .test_basic import basic_templates
include_fail_templates = {
'include-fail1': '{% load bad_tag %}{% badtag %}',
'... | bsd-3-clause |
hanicker/odoo | addons/product_email_template/models/invoice.py | 321 | 1969 | # -*- coding: utf-8 -*-
from openerp.osv import osv
class account_invoice(osv.Model):
_inherit = 'account.invoice'
def invoice_validate_send_email(self, cr, uid, ids, context=None):
Composer = self.pool['mail.compose.message']
for invoice in self.browse(cr, uid, ids, context=context):
... | agpl-3.0 |
procangroup/edx-platform | openedx/core/djangoapps/schedules/tests/test_content_highlights.py | 18 | 5398 | # -*- coding: utf-8 -*-
from openedx.core.djangoapps.schedules.config import COURSE_UPDATE_WAFFLE_FLAG
from openedx.core.djangoapps.schedules.content_highlights import get_week_highlights, course_has_highlights
from openedx.core.djangoapps.schedules.exceptions import CourseUpdateDoesNotExist
from openedx.core.djangolib... | agpl-3.0 |
pskrz/ansible | lib/ansible/plugins/lookup/fileglob.py | 176 | 1345 | # (c) 2012, 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) any lat... | gpl-3.0 |
Allow2CEO/browser-ios | brave/node_modules/ad-block/vendor/depot_tools/third_party/boto/s3/tagging.py | 236 | 1732 | from boto import handler
import xml.sax
class Tag(object):
def __init__(self, key=None, value=None):
self.key = key
self.value = value
def startElement(self, name, attrs, connection):
return None
def endElement(self, name, value, connection):
if name == 'Key':
... | mpl-2.0 |
mollstam/UnrealPy | UnrealPyEmbed/Development/Python/2015.08.07-Python2710-x64-Source-vs2015/Python27/Source/boto-2.38.0/boto/plugin.py | 150 | 2711 | # Copyright 2010 Google Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish, dis-
# trib... | mit |
SebasSBM/django | django/core/files/uploadhandler.py | 335 | 6876 | """
Base file upload handler classes, and the built-in concrete subclasses
"""
from __future__ import unicode_literals
from io import BytesIO
from django.conf import settings
from django.core.files.uploadedfile import (
InMemoryUploadedFile, TemporaryUploadedFile,
)
from django.utils.encoding import python_2_uni... | bsd-3-clause |
TimYi/django | django/contrib/sessions/backends/cached_db.py | 231 | 2861 | """
Cached, database-backed sessions.
"""
import logging
from django.conf import settings
from django.contrib.sessions.backends.db import SessionStore as DBStore
from django.core.cache import caches
from django.core.exceptions import SuspiciousOperation
from django.utils import timezone
from django.utils.encoding imp... | bsd-3-clause |
dboonz/polymode | examples/ex9_batch_solver.py | 5 | 1194 | from pylab import *
from numpy import *
from Polymode import *
## Parameters:
symmetry = 4
Nx = (200,21)
wl = 1.0
## Materials
air = Material.Air()
si = Material.Silica()
wg = Waveguide.Waveguide(material=si, symmetry=symmetry)
#Create holes in square lattice
Nrings = 2
D = 4.0
d = 0.5*D
for nr in range(1,Nrings+1)... | gpl-3.0 |
saumishr/django | django/contrib/localflavor/uy/forms.py | 87 | 2143 | # -*- coding: utf-8 -*-
"""
UY-specific form helpers.
"""
from __future__ import absolute_import
from django.core.validators import EMPTY_VALUES
from django.forms.fields import Select, RegexField
from django.forms import ValidationError
from django.utils.translation import ugettext_lazy as _
from django.contrib.local... | bsd-3-clause |
sykora/limits | limits.py | 1 | 1294 | #! /usr/bin/env python
# Helper script to format output from the limts_backend program.
#
# Copyright 2008 P.C. Shyamshankar <sykora@lucentbeing.com>
#
# This file is part of Limits.
#
# Limits is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by... | gpl-3.0 |
jumpstarter-io/keystone | keystone/tests/unit/test_ipv6.py | 9 | 1741 | # Copyright 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/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | apache-2.0 |
n6151h/pyconau2016 | alembic/versions/17_4ed1a2dd2573_populate_database.py | 6 | 34582 | """Populate database
Revision ID: 4ed1a2dd2573
Revises: 590a0265a5f
Create Date: 2015-08-04 14:29:52.468792
"""
# revision identifiers, used by Alembic.
revision = '4ed1a2dd2573'
down_revision = '590a0265a5f'
import datetime
import logging
from alembic import op
import sqlalchemy as sa
meta = sa.MetaData()
log =... | gpl-2.0 |
RedHatInsights/insights-core | insights/command_parser.py | 1 | 3671 | #!/usr/bin/env python
"""
Command Parser module
---------------------
Implements the ``insights`` command line. Each function is the first
argument followed by the function specific arguments. See USAGE text
below.
"""
from __future__ import print_function
import argparse
import sys
USAGE = """insights <command> [<... | apache-2.0 |
aidanlister/django | tests/i18n/tests.py | 87 | 85521 | # -*- encoding: utf-8 -*-
from __future__ import unicode_literals
import datetime
import decimal
import gettext as gettext_module
import os
import pickle
from contextlib import contextmanager
from importlib import import_module
from threading import local
from unittest import skipUnless
from django import forms
from ... | bsd-3-clause |
pythonfei/yourheart | ihome/handlers/profile.py | 1 | 3238 | # coding=utf-8
from BaseHandler import BaseHandler
from utils.common import require_logined
from utils.image_storage import storage
from utils.response_code import RET
from config import image_url_prefix
import logging
class ProfileHandler(BaseHandler):
"""头像验证"""
@require_logined
def post(self):
user_id = self.... | gpl-3.0 |
jimyx17/jimh | lib/requests/packages/chardet/sbcharsetprober.py | 190 | 4583 | ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is Mozilla Universal charset detector code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 2001
# the Initial Developer. All R... | gpl-3.0 |
UManPychron/pychron | pychron/experiment/tests/identifier.py | 2 | 1144 | from __future__ import absolute_import
from pychron.experiment.utilities.identifier import get_analysis_type
__author__ = 'argonlab2'
import unittest
class IdentifierTestCase(unittest.TestCase):
def test_background(self):
self._atype_tester('bg-01-J', 'background')
def test_blank_air(self):
... | apache-2.0 |
cyc805/VM | src/core/bindings/modulegen_customizations.py | 54 | 21107 | import re
import os
import sys
from pybindgen.typehandlers import base as typehandlers
from pybindgen import ReturnValue, Parameter
from pybindgen.cppmethod import CustomCppMethodWrapper, CustomCppConstructorWrapper
from pybindgen.typehandlers.codesink import MemoryCodeSink
from pybindgen.typehandlers import ctypepars... | gpl-2.0 |
sunzhxjs/JobGIS | lib/python2.7/site-packages/selenium/webdriver/common/action_chains.py | 67 | 9934 | # Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The SFC licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | mit |
UnofficialAOKPLWW/android_kernel_semc_msm7x30 | scripts/gcc-wrapper.py | 364 | 3936 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2011-2012, The Linux Foundation. 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 th... | gpl-2.0 |
jalaziz/django-cms-grappelli-old | cms/migrations/0033_auto__del_field_title_publisher_is_draft__del_field_title_publisher_st.py | 8 | 17460 | # -*- coding: utf-8 -*-
from south.db import db
from south.v2 import SchemaMigration
class Migration(SchemaMigration):
def forwards(self, orm):
# Removing unique constraint on 'Title', fields ['publisher_is_draft', 'language', 'page']
db.delete_unique('cms_title', ['publisher_is_draft', '... | bsd-3-clause |
BavoGoosens/Gaiter | feature_extraction/time_domain_feature_extractor.py | 1 | 17578 | from data_utils import featured_frame
from feature_extractor import *
from data_utils.featured_frame import *
import numpy as np
import scipy.stats as sts
import scipy.integrate as integr
from scipy.interpolate import interp1d
from sympy import mpmath
class TimeDomainFeatureExtractor(FeatureExtractor):
def __in... | mit |
kumar303/addons-server | src/olympia/reviewers/management/commands/send_info_request_last_warning_notifications.py | 8 | 1931 | # -*- coding: utf-8 -*-
from datetime import datetime, timedelta
from django.core.management.base import BaseCommand
import olympia.core.logger
from olympia import amo
from olympia.activity.models import ActivityLog
from olympia.activity.utils import notify_about_activity_log
from olympia.addons.models import Addon
... | bsd-3-clause |
ChristopherHogan/pip | pip/_vendor/requests/packages/urllib3/packages/six.py | 2375 | 11628 | """Utilities for writing code that runs on Python 2 and 3"""
#Copyright (c) 2010-2011 Benjamin Peterson
#Permission is hereby granted, free of charge, to any person obtaining a copy of
#this software and associated documentation files (the "Software"), to deal in
#the Software without restriction, including without l... | mit |
jmontoyam/mne-python | examples/inverse/plot_morph_data.py | 15 | 2220 | """
==========================================================
Morph source estimates from one subject to another subject
==========================================================
A source estimate from a given subject 'sample' is morphed
to the anatomy of another subject 'fsaverage'. The output
is a source estimate ... | bsd-3-clause |
gustavospiess/GeneticPie | src/FirstGradeFunctionSearcher.py | 1 | 1914 | import geneticPie
from geneticPie import *
class FuncFGen(RunnableGen):
def __init__(self):
buff = GenBuffer(new_instace = self.get_gen, gen_class = geneticPie.Default.FracGen.__class__)
RunnableGen.__init__(self, req_gens = {'a' : buff, 'b' : buff})
def run(self, param):
a = self.ind... | gpl-3.0 |
littlecodersh/itchatmp | itchatmp/controllers/statistics.py | 1 | 3906 | from .common import BaseController
from .mpapi.mp import statistics as mpStat
'''
yiw"lpfuviwpyiw2jfu;viwp3k2d3j
'''
class Statistics(BaseController):
def user_summary(self, startTime, timeSection=None):
args = (startTime,) if timeSection is None else (startTime, timeSection)
return self... | mit |
nprapps/portland | fabfile/render.py | 15 | 3386 | #!/usr/bin/env python
"""
Commands for rendering various parts of the app stack.
"""
from glob import glob
import os
from fabric.api import local, task
import app
def _fake_context(path):
"""
Create a fact request context for a given path.
"""
return app.app.test_request_context(path=path)
def _vi... | mit |
KhronosGroup/COLLADA-CTS | StandardDataSets/collada/library_geometries/geometry/mesh/polylist/simple/simple.py | 18 | 3713 |
# Copyright (c) 2012 The Khronos Group Inc.
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and /or associated documentation files (the "Materials "), to deal in the Materials without restriction, including without limitation the rights to use, copy, modify, merge, publ... | mit |
sergmelikyan/murano | murano/openstack/common/versionutils.py | 2 | 4960 | # Copyright (c) 2013 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 ... | apache-2.0 |
cyanna/edx-platform | cms/djangoapps/contentstore/management/commands/export.py | 17 | 1355 | """
Script for exporting courseware from Mongo to a tar.gz file
"""
import os
from django.core.management.base import BaseCommand, CommandError
from xmodule.modulestore.xml_exporter import export_course_to_xml
from xmodule.modulestore.django import modulestore
from opaque_keys.edx.keys import CourseKey
from xmodule.co... | agpl-3.0 |
DanieSchro3/Daniel | py/openage/codegen/codegen.py | 46 | 2295 | from ..convert.util import dbg
import os
import sys
contenttemplate = """\
{prefix} Warning: this file was auto-generated; manual changes are futile.
{prefix} For details, see buildsystem/codegen.cmake and py/openage/codegen.
{code}"""
def generate_all_raw(cpp_src_dir):
# add invocations to all individual gener... | gpl-3.0 |
janczak10/incubator-airflow | tests/contrib/hooks/test_aws_dynamodb_hook.py | 16 | 2380 | # -*- coding: utf-8 -*-
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
... | apache-2.0 |
lfcnassif/MultiContentViewer | release/modules/ext/libreoffice/program/wizards/ui/ImageList.py | 1 | 18510 | #
# This file is part of the LibreOffice project.
#
# 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 http://mozilla.org/MPL/2.0/.
#
# This file incorporates work covered by the following license noti... | lgpl-3.0 |
justacec/bokeh | bokeh/document.py | 2 | 38920 | """ The document module provides the Document class, which is a container
for all Bokeh objects that must be reflected to the client side BokehJS
library.
"""
from __future__ import absolute_import
import logging
logger = logging.getLogger(__file__)
from functools import wraps
from json import loads
import jinja2
f... | bsd-3-clause |
eicher31/compassion-modules | advanced_translation/__manifest__.py | 4 | 1857 | # -*- coding: utf-8 -*-
##############################################################################
#
# ______ Releasing children from poverty _
# / ____/___ ____ ___ ____ ____ ___________(_)___ ____
# / / / __ \/ __ `__ \/ __ \/ __ `/ ___/ ___/ / __ \/ __ \
# / /___/ /_/ / / / / / / /_/... | agpl-3.0 |
sobercoder/gem5 | src/arch/x86/isa/insts/simd128/floating_point/compare/__init__.py | 91 | 2396 | # 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 |
AdrianGaudebert/socorro | socorro/cron/jobs/clean_raw_adi_logs.py | 6 | 1140 | from configman import Namespace
from crontabber.base import BaseCronApp
from crontabber.mixins import (
with_postgres_transactions,
with_single_postgres_transaction,
)
@with_postgres_transactions()
@with_single_postgres_transaction()
class CleanRawADILogsCronApp(BaseCronApp):
app_name = 'clean-raw-adi-log... | mpl-2.0 |
rodelrod/putsches | askbot/api.py | 17 | 2404 | """place for the API calls into askbot
at this point most of the useful functions are still
in the askbot.models module, but
api must become a place to manupulate the data in the askbot application
so that other implementations of the data storage could be possible
"""
from django.db.models import Q
from askbot import ... | gpl-3.0 |
caveman-dick/ansible | lib/ansible/modules/utilities/logic/pause.py | 21 | 2784 | # -*- coding: utf-8 -*-
# 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': ['stableinterface'],
... | gpl-3.0 |
donkirkby/django | tests/generic_views/views.py | 286 | 7527 | from __future__ import unicode_literals
from django.contrib.auth.decorators import login_required
from django.core.paginator import Paginator
from django.core.urlresolvers import reverse, reverse_lazy
from django.utils.decorators import method_decorator
from django.views import generic
from .models import Artist, Aut... | bsd-3-clause |
ZenHarbinger/snapcraft | snapcraft/tests/plugins/test_kbuild.py | 2 | 7992 | # -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2016 Canonical Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# This program is distributed in the h... | gpl-3.0 |
jfmartinez64/test | libs/xmpp/client.py | 198 | 16709 | ## client.py
##
## Copyright (C) 2003-2005 Alexey "Snake" Nezhdanov
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2, or (at your option)
## any later version.
... | gpl-3.0 |
jboissard/mathExperiments | games/roulette.py | 1 | 1364 | """
Simulation of the roulette game
"""
from random import randint
import math
import numpy as np
"""
@return: {even: 0, odd: 1, zero: -1}
"""
def evenOrOdd(x):
if x==0:
return -1;
else:
if x % 2 == 0:
return 0
else:
return 1
"""
@param x: black or white
@param preva:
@par... | apache-2.0 |
yangming85/lettuce | tests/integration/lib/Django-1.2.5/django/contrib/webdesign/tests.py | 379 | 1054 | # -*- coding: utf-8 -*-
import unittest
from django.contrib.webdesign.lorem_ipsum import *
from django.template import loader, Context
class WebdesignTest(unittest.TestCase):
def test_words(self):
self.assertEqual(words(7), u'lorem ipsum dolor sit amet consectetur adipisicing')
def test_paragraphs... | gpl-3.0 |
tbeadle/django | tests/forms_tests/widget_tests/test_textinput.py | 175 | 2914 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.forms import TextInput
from django.utils.safestring import mark_safe
from .base import WidgetTest
class TextInputTest(WidgetTest):
widget = TextInput()
def test_render(self):
self.check_html(self.widget, 'email', '', html='... | bsd-3-clause |
zerkh/GroundHog | experiments/nmt/preprocess/shuffle-hdf5.py | 17 | 2397 | #!/usr/bin/env python
import argparse
import cPickle
import gzip
import sys
import tables
import numpy
parser = argparse.ArgumentParser()
parser.add_argument("source_input",
type=argparse.FileType('r'),
help="The source input HDF5 file")
parser.add_argument("target_input",
... | bsd-3-clause |
babluboy/bookworm | data/scripts/mobi_lib/mobi_utils.py | 2 | 8654 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab
# flake8: noqa
from __future__ import unicode_literals, division, absolute_import, print_function
from .compatibility_utils import PY2, text_type, bchr, bord
import binascii
if PY2:
range = xrange
from itertools impo... | gpl-3.0 |
getsentry/zeus | zeus/migrations/426b74e836df_migrate_sources.py | 1 | 1556 | """migrate_sources
Revision ID: 426b74e836df
Revises: 070ac78ddbcb
Create Date: 2019-11-25 11:26:47.059916
"""
import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = "426b74e836df"
down_revision = "070ac78ddbcb"
branch_labels = ... | apache-2.0 |
pwns4cash/vivisect | vivisect/contrib/pycparser/pycparser/ply/lex.py | 482 | 40739 | # -----------------------------------------------------------------------------
# ply: lex.py
#
# Copyright (C) 2001-2011,
# David M. Beazley (Dabeaz LLC)
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions ar... | apache-2.0 |
APCVSRepo/sdl_implementation_reference | tools/InterfaceGenerator/generator/parsers/RPCBase.py | 9 | 27635 | """RPC XML base parser.
Contains base parser for SDLRPC v1/v2 and JSON RPC XML format.
"""
import collections
import xml.etree.ElementTree
from generator import Model
class ParseError(Exception):
"""Parse error.
This exception is raised when XML contains errors and can't be parsed.
"""
pass
... | bsd-3-clause |
amitskwalia/codesters | Imaging-1.1.7/build/lib.linux-x86_64-2.7/Image.py | 38 | 67234 | #
# The Python Imaging Library.
# $Id$
#
# the Image class wrapper
#
# partial release history:
# 1995-09-09 fl Created
# 1996-03-11 fl PIL release 0.0 (proof of concept)
# 1996-04-30 fl PIL release 0.1b1
# 1999-07-28 fl PIL release 1.0 final
# 2000-06-07 fl PIL release 1.1
# 2000-10-20 fl PIL release 1.1.1... | mit |
darrenxyli/deeplearning | projects/project2/problem_unittests.py | 15 | 6934 | import os
import numpy as np
import tensorflow as tf
import random
from unittest.mock import MagicMock
def _print_success_message():
return print('Tests Passed')
def test_folder_path(cifar10_dataset_folder_path):
assert cifar10_dataset_folder_path is not None,\
'Cifar-10 data folder not set.'
as... | apache-2.0 |
liduanw/Monkey | Monkey/OctoKit/External/ISO8601DateFormatter/testparser.sh.py | 52 | 1063 | #!/usr/bin/env python
outfile = file('testparser.sh', 'w')
outfile.write('#!/bin/sh\n')
hash = '#'
colon = ':'
shell_prompt = '% '
echo_format = "echo '%s'\n"
newline = '\n'
echo_by_itself = 'echo\n'
import re
bs_exp = re.compile('(\\\\*)\n')
escape_newline_exp = re.compile('\\\\\n')
empty = ''
import fileinput
ho... | mit |
RudolfCardinal/crate | crate_anon/crateweb/consent/management/commands/populate.py | 1 | 1566 | #!/usr/bin/env python
"""
crate_anon/crateweb/consent/management/commands/populate.py
===============================================================================
Copyright (C) 2015-2021 Rudolf Cardinal (rudolf@pobox.com).
This file is part of CRATE.
CRATE is free software: you can redistribute it a... | gpl-3.0 |
AdaEne/CATMAID | django/applications/catmaid/management/commands/catmaid_rebuild_edge_table.py | 2 | 3975 | import os
import catmaid
from django.core.management.base import BaseCommand, CommandError
from django.db import connection, transaction
from catmaid.models import Project
from optparse import make_option
class DryRunRollback(Exception):
pass
class Command(BaseCommand):
args = '<project_id>'
help = 'Rebu... | gpl-3.0 |
jakey-wan-kenobi/angular-sass-uirouter-browsersync-seed | node_modules/node-gyp/gyp/buildbot/buildbot_run.py | 1467 | 4228 | #!/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.
"""Argument-less script to select what to run on the buildbots."""
import os
import shutil
import subprocess
import sys
BUILDBOT_DIR = os.... | mit |
debianitram/w2p-acreditacion | models/db.py | 1 | 4705 | # -*- coding: utf-8 -*-
import locale
from gluon.contrib.appconfig import AppConfig
# Config Locale
locale.setlocale(locale.LC_ALL, ('es_AR', 'UTF-8'))
## once in production, remove reload=True to gain full speed
myconf = AppConfig(reload=True)
install = True
db = DAL(myconf.take('db.uri'),
pool_size=mycon... | gpl-2.0 |
c0ryb4k3r/android_kernel_samsung_klte | tools/perf/scripts/python/syscall-counts-by-pid.py | 11180 | 1927 | # system call counts, by pid
# (c) 2010, Tom Zanussi <tzanussi@gmail.com>
# Licensed under the terms of the GNU GPL License version 2
#
# Displays system-wide system call totals, broken down by syscall.
# If a [comm] arg is specified, only syscalls called by [comm] are displayed.
import os, sys
sys.path.append(os.env... | gpl-2.0 |
MartijnBraam/CouchPotatoServer | libs/tornado/testing.py | 14 | 26109 | #!/usr/bin/env python
"""Support classes for automated testing.
* `AsyncTestCase` and `AsyncHTTPTestCase`: Subclasses of unittest.TestCase
with additional support for testing asynchronous (`.IOLoop` based) code.
* `ExpectLog` and `LogTrapTestCase`: Make test logs less spammy.
* `main()`: A simple test runner (wra... | gpl-3.0 |
ghchinoy/tensorflow | tensorflow/python/distribute/all_reduce_test.py | 15 | 10639 | # 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 |
krmahadevan/selenium | py/test/selenium/webdriver/marionette/mn_launcher_tests.py | 18 | 1511 | # Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The SFC licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | apache-2.0 |
jumpstarter-io/nova | nova/tests/test_versions.py | 36 | 2070 | # Copyright 2011 Ken Pepple
#
# 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 agre... | apache-2.0 |
thirdwing/mxnet | python/mxnet/gluon/model_zoo/vision/densenet.py | 10 | 7356 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | apache-2.0 |
gcode-mirror/audacity | lib-src/lv2/lv2/plugins/eg01-amp.lv2/waflib/Tools/c_preproc.py | 85 | 16652 | #! /usr/bin/env python
# encoding: utf-8
# WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file
import re,string,traceback
from waflib import Logs,Utils,Errors
from waflib.Logs import debug,error
class PreprocError(Errors.WafError):
pass
POPFILE='-'
recursion_limit=150
... | gpl-2.0 |
jungle90/Openstack-Swift-I-O-throttler | swift/account/utils.py | 17 | 4423 | # Copyright (c) 2010-2013 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | apache-2.0 |
acsone/odoo | addons/account_anglo_saxon/stock.py | 57 | 3489 | # -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of t... | agpl-3.0 |
dsm054/pandas | pandas/tests/arrays/categorical/test_dtypes.py | 3 | 6796 | # -*- coding: utf-8 -*-
import numpy as np
import pytest
from pandas.compat import long
from pandas.core.dtypes.dtypes import CategoricalDtype
from pandas import Categorical, CategoricalIndex, Index, Series, Timestamp
import pandas.util.testing as tm
class TestCategoricalDtypes(object):
def test_is_equal_dtyp... | bsd-3-clause |
j0gurt/ggrc-core | test/integration/ggrc/services/__init__.py | 6 | 3614 | # Copyright (C) 2016 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
import random
from sqlalchemy.orm import validates
import ggrc
import ggrc.builder
import ggrc.services
from ggrc import db
from ggrc.models.mixins import Base
from ggrc.models.exceptions import Validation... | apache-2.0 |
Chilledheart/chromium | tools/telemetry/third_party/gsutilz/gslib/commands/stat.py | 12 | 5619 | # -*- coding: utf-8 -*-
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | bsd-3-clause |
seanli9jan/tensorflow | tensorflow/python/keras/layers/__init__.py | 3 | 8594 | # 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 |
alabs/petateca | petateca/apps/serie/urls/entity.py | 1 | 2327 | # pylint: disable-msg=W0401,W0614
from django.conf.urls.defaults import *
from django.views.generic.list_detail import object_detail
from serie.models import Actor
get_actor = {
'template_name': 'serie/get_actor.html',
'template_object_name': 'actor',
'queryset': Actor.objects.select_related('poster').all(... | agpl-3.0 |
lamesjim/Chess-AI | multi_chess_ai.py | 1 | 12958 | # -*- coding: utf-8 -*-
from subprocess import call
from time import sleep
from game import Game
from test_helpers import heuristic_gen, get_successors
from node import Node
import heuristics
import random
import time
from multiprocessing import Pool
import math
cache = {}
found_in_cache = 0
class Test_Engine():
... | mit |
eli-b/pytest | testing/deprecated_test.py | 8 | 2446 | import pytest
def test_yield_tests_deprecation(testdir):
testdir.makepyfile("""
def func1(arg, arg2):
assert arg == arg2
def test_gen():
yield "m1", func1, 15, 3*5
yield "m2", func1, 42, 6*7
""")
result = testdir.runpytest('-ra')
result.stdout.fnmatc... | mit |
chand3040/sree_odoo | openerp/addons/base/res/res_bank.py | 242 | 10554 | # -*- 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... | agpl-3.0 |
beniwohli/apm-agent-python | elasticapm/context/__init__.py | 1 | 2631 | # BSD 3-Clause License
#
# Copyright (c) 2019, Elasticsearch BV
# 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, t... | bsd-3-clause |
MartinDelzant/scikit-learn | examples/ensemble/plot_adaboost_twoclass.py | 347 | 3268 | """
==================
Two-class AdaBoost
==================
This example fits an AdaBoosted decision stump on a non-linearly separable
classification dataset composed of two "Gaussian quantiles" clusters
(see :func:`sklearn.datasets.make_gaussian_quantiles`) and plots the decision
boundary and decision scores. The di... | bsd-3-clause |
bbozhev/flask-test | flask/lib/python2.7/site-packages/setuptools/dist.py | 35 | 35701 | __all__ = ['Distribution']
import re
import os
import sys
import warnings
import numbers
import distutils.log
import distutils.core
import distutils.cmd
import distutils.dist
from distutils.core import Distribution as _Distribution
from distutils.errors import (DistutilsOptionError, DistutilsPlatformError,
Distuti... | mit |
jtriley/s3site | check.py | 1 | 5637 | #!/usr/bin/env python
import os
import re
import ast
import sys
import glob
import subprocess
import pep8
from pyflakes import checker
CHECKS = [
#{
#'start_msg': 'Running Pyflakes...',
#'command': 'pyflakes %s',
#'match_files': ['.*\.py$'],
#},
#{
#'start_msg': 'Running p... | gpl-3.0 |
dandygithub/kodi | addons/plugin.audio.music.yandex/requests/packages/idna/intranges.py | 154 | 1521 | """
Given a list of integers, made up of (hopefully) a small number of long runs
of consecutive integers, compute a representation of the form
((start1, end1), (start2, end2) ...). Then answer the question "was x present
in the original list?" in time O(log(# runs)).
"""
import bisect
def intranges_from_list(list_):
... | gpl-3.0 |
skakri/django-unstructured | docs/conf.py | 1 | 8199 | # -*- coding: utf-8 -*-
#
# django-wiki documentation build configuration file, created by
# sphinx-quickstart on Mon Jul 23 16:13:51 2012.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
#... | gpl-3.0 |
mapr/hue | desktop/libs/hadoop/src/hadoop/mini_cluster.py | 23 | 18119 | #!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | apache-2.0 |
yanheven/console | openstack_dashboard/dashboards/admin/aggregates/urls.py | 12 | 1149 | # 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 |
softak/webfaction_demo | vendor-local/lib/python/lettuce/core.py | 1 | 31789 | # -*- coding: utf-8 -*-
# <Lettuce - Behaviour Driven Development for python>
# Copyright (C) <2010-2011> Gabriel Falcão <gabriel@nacaolivre.org>
#
# 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 Foundatio... | bsd-3-clause |
ashishnitinpatil/vnitstudnotifs | dbindexer/backends.py | 21 | 21299 | import django
from django.core.exceptions import ImproperlyConfigured
from django.db import models
from django.db.models.fields import FieldDoesNotExist
from django.utils.tree import Node
try:
from django.db.models.sql.where import SubqueryConstraint
except ImportError:
SubqueryConstraint = None
from djangoto... | bsd-3-clause |
gigglesninja/senior-design | MissionPlanner/Lib/encodings/iso8859_2.py | 593 | 13660 | """ Python Character Mapping Codec iso8859_2 generated from 'MAPPINGS/ISO8859/8859-2.TXT' with gencodec.py.
"""#"
import codecs
### Codec APIs
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self,input,errors='... | gpl-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.