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 |
|---|---|---|---|---|---|
Lujeni/ansible | lib/ansible/modules/web_infrastructure/deploy_helper.py | 149 | 19571 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2014, Jasper N. Brouwer <jasper@nerdsweide.nl>
# (c) 2014, Ramon de la Fuente <ramon@delafuente.nl>
#
# 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
__metaclas... | gpl-3.0 |
jaeilepp/mne-python | mne/io/egi/tests/test_egi.py | 1 | 4257 | # -*- coding: utf-8 -*-
# Authors: Denis A. Engemann <denis.engemann@gmail.com>
# simplified BSD-3 license
import os.path as op
import warnings
import inspect
import numpy as np
from numpy.testing import assert_array_equal, assert_allclose
from nose.tools import assert_true, assert_raises, assert_equal
fr... | bsd-3-clause |
hectord/lettuce | tests/integration/lib/Django-1.3/tests/regressiontests/sites_framework/tests.py | 92 | 1784 | from django.conf import settings
from django.contrib.sites.models import Site
from django.test import TestCase
from models import SyndicatedArticle, ExclusiveArticle, CustomArticle, InvalidArticle, ConfusedArticle
class SitesFrameworkTestCase(TestCase):
def setUp(self):
Site.objects.get_or_create(id=setti... | gpl-3.0 |
cardoe/virt-manager | virtinst/CPU.py | 3 | 9479 | #
# Copyright 2010 Red Hat, Inc.
# Cole Robinson <crobinso@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 versi... | gpl-2.0 |
tedelhourani/ansible | lib/ansible/modules/network/nxos/nxos_ospf.py | 26 | 4221 | #!/usr/bin/python
#
# 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.
#
# Ansible is distribut... | gpl-3.0 |
TileStache/TileStache | TileStache/PixelEffects.py | 9 | 4207 | """ Different effects that can be applied to tiles.
Options are:
- blackwhite:
"effect":
{
"name": "blackwhite"
}
- greyscale:
"effect":
{
"name": "greyscale"
}
- desaturate:
Has an optional parameter "factor" that defines the saturation of the image.
Defaults to 0.85.
... | bsd-3-clause |
dakcarto/QGIS | python/plugins/processing/algs/qgis/Explode.py | 10 | 3527 | # -*- coding: utf-8 -*-
"""
***************************************************************************
Explode.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
*******************************... | gpl-2.0 |
waynenilsen/statsmodels | statsmodels/sandbox/examples/try_quantile_regression1.py | 33 | 1188 | '''Example to illustrate Quantile Regression
Author: Josef Perktold
polynomial regression with systematic deviations above
'''
import numpy as np
from statsmodels.compat.python import zip
from scipy import stats
import statsmodels.api as sm
from statsmodels.regression.quantile_regression import QuantReg
sige = 0.... | bsd-3-clause |
elevien/mlmc-rdme | crn_mc/simulation/rhs.py | 3 | 4024 | from ..mesh import *
from ..model import *
from .timer import *
import copy,json
import numpy as np
from scipy.integrate import ode
def res(x,y):
return x - min(x,y)
# Right hand sides --------------------------------------------------------
# curretly spending too much time inside this function. perhaps don't
... | mit |
meabsence/python-for-android | python-modules/twisted/twisted/persisted/journal/rowjournal.py | 78 | 3077 | # Copyright (c) 2001-2004 Twisted Matrix Laboratories.
# See LICENSE for details.
#
"""Journal using twisted.enterprise.row RDBMS support.
You're going to need the following table in your database::
| CREATE TABLE journalinfo
| (
| commandIndex int
| );
| INSERT INTO journalinfo VALUES (0);
... | apache-2.0 |
nmfisher/poincare-embeddings | scripts/create_mammal_subtree.py | 2 | 1450 | from __future__ import print_function, division, unicode_literals, absolute_import
import random
from nltk.corpus import wordnet as wn
import click
def transitive_closure(synsets):
hypernyms = set([])
for s in synsets:
paths = s.hypernym_paths()
for path in paths:
hypernyms.update... | mit |
pjdelport/django | django/contrib/messages/tests/fallback.py | 199 | 6978 | from django.contrib.messages import constants
from django.contrib.messages.storage.fallback import (FallbackStorage,
CookieStorage)
from django.contrib.messages.tests.base import BaseTest
from django.contrib.messages.tests.cookie import (set_cookie_data,
stored_cookie_messages_count)
from django.contrib.message... | bsd-3-clause |
bbossola/robotframework-selenium2library | src/Selenium2Library/keywords/_javascript.py | 61 | 6560 | import os
from selenium.common.exceptions import WebDriverException
from keywordgroup import KeywordGroup
class _JavaScriptKeywords(KeywordGroup):
def __init__(self):
self._cancel_on_next_confirmation = False
# Public
def alert_should_be_present(self, text=''):
"""Verifies an alert is pr... | apache-2.0 |
jacquesqiao/Paddle | python/paddle/batch.py | 6 | 1574 | # Copyright (c) 2016 PaddlePaddle 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 applic... | apache-2.0 |
IONISx/edx-platform | openedx/core/djangoapps/content/course_overviews/migrations/0004_default_lowest_passing_grade_to_None.py | 62 | 3157 | # -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'CourseOverview.lowest_passing_grade'
db.alter_column('... | agpl-3.0 |
nwjs/chromium.src | components/feed/tools/mockserver_textpb_to_binary.py | 3 | 2151 | #!/usr/bin/python3
# Copyright 2020 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.
# Lint as: python3
"""The tool converts a textpb into a binary proto using chromium protoc binary.
After converting a feed response textp... | bsd-3-clause |
xorpaul/shinken | libexec/discovery/cluster_discovery_runner.py | 20 | 4633 | #!/usr/bin/env python
# Copyright (C) 2009-2012:
# Camille, VACQUIE
# Romain, FORLOT, romain.forlot@sydel.fr
#
# This file is part of Shinken.
#
# Shinken 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 Foun... | agpl-3.0 |
toshywoshy/ansible | lib/ansible/modules/cloud/ovirt/ovirt_storage_domain_info.py | 20 | 4336 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 Red Hat, 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
#... | gpl-3.0 |
pklimai/py-junos-eznc | tests/unit/test_rpcmeta.py | 2 | 10679 | import unittest
import os
import re
from nose.plugins.attrib import attr
from jnpr.junos.device import Device
from jnpr.junos.rpcmeta import _RpcMetaExec
from jnpr.junos.facts.swver import version_info
from ncclient.manager import Manager, make_device_handler
from ncclient.transport import SSHSession
from jnpr.junos.e... | apache-2.0 |
yapengsong/ovirt-engine | packaging/setup/plugins/ovirt-engine-common/eayunos-version/version.py | 4 | 2554 | """EayunOS Version plugin."""
import os
from otopi import plugin, util
from ovirt_engine_setup import constants as osetupcons
from ovirt_engine_setup.engine import constants as oenginecons
from ovirt_engine_setup.engine_common import constants as oengcommcons
@util.export
class Plugin(plugin.PluginBase):
"""E... | apache-2.0 |
Widiot/simpleblog | venv/lib/python3.5/site-packages/pygments/lexers/shell.py | 25 | 31426 | # -*- coding: utf-8 -*-
"""
pygments.lexers.shell
~~~~~~~~~~~~~~~~~~~~~
Lexers for various shells.
:copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from pygments.lexer import Lexer, RegexLexer, do_insertions, bygroups, \
... | mit |
vibhorag/scikit-learn | sklearn/metrics/tests/test_score_objects.py | 138 | 14048 | import pickle
import numpy as np
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_raises
from sklearn.utils.testing import assert_raises_regexp
from sklearn.utils.testing import assert_true
from sklearn.utils.testing im... | bsd-3-clause |
albertrdixon/CouchPotatoServer | couchpotato/core/plugins/profile/main.py | 47 | 6878 | import traceback
from couchpotato import get_db, tryInt
from couchpotato.api import addApiView
from couchpotato.core.event import addEvent, fireEvent
from couchpotato.core.helpers.encoding import toUnicode
from couchpotato.core.logger import CPLog
from couchpotato.core.plugins.base import Plugin
from .index import Pro... | gpl-3.0 |
endlessm/chromium-browser | third_party/protobuf/python/google/protobuf/service.py | 243 | 9144 | # Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redi... | bsd-3-clause |
kurli/blink-crosswalk | Source/build/scripts/make_runtime_features.py | 51 | 4136 | #!/usr/bin/env python
# Copyright (C) 2013 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 ... | bsd-3-clause |
mdrumond/tensorflow | tensorflow/python/estimator/inputs/pandas_io.py | 86 | 4503 | # 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 |
AOSP-S4-KK/platform_external_chromium_org | tools/cr/cr/commands/command.py | 25 | 3270 | # 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.
"""Module to hold the Command plugin."""
import argparse
import cr
class Command(cr.Plugin, cr.Plugin.Type):
"""Base class for implementing cr commands.... | bsd-3-clause |
kamyu104/django | tests/template_tests/syntax_tests/test_comment.py | 521 | 3667 | from django.test import SimpleTestCase
from ..utils import setup
class CommentSyntaxTests(SimpleTestCase):
@setup({'comment-syntax01': '{# this is hidden #}hello'})
def test_comment_syntax01(self):
output = self.engine.render_to_string('comment-syntax01')
self.assertEqual(output, 'hello')
... | bsd-3-clause |
dufferzafar/mitmproxy | test/pathod/test_language_http2.py | 3 | 6779 | from six import BytesIO
from netlib import tcp
from netlib.http import user_agents
from pathod import language
from pathod.language import http2
from pathod.protocols.http2 import HTTP2StateProtocol
from . import tutils
def parse_request(s):
return next(language.parse_pathoc(s, True))
def parse_response(s):
... | mit |
havrlant/fca-search | src/tests/common_tests.py | 1 | 2118 | import unittest
import string
from common.list import splitlist
from common.string import sjoin, isletter, strip_accents, remove_nonletters,\
normalize_text, replace_white_spaces, replace_single, replace_dict
class TestString(unittest.TestCase):
def test_sjoin(self):
self.assertEqual('', sjoin([]))
self.assertEq... | bsd-2-clause |
resmo/ansible | lib/ansible/plugins/inventory/yaml.py | 54 | 7175 | # Copyright (c) 2017 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = '''
inventory: yaml
version_added: "2.4"
short_description: Uses a speci... | gpl-3.0 |
molobrakos/home-assistant | tests/components/mqtt/test_vacuum.py | 1 | 26645 | """The tests for the Mqtt vacuum platform."""
import copy
import json
import pytest
from homeassistant.components import mqtt, vacuum
from homeassistant.components.mqtt import (
CONF_COMMAND_TOPIC, vacuum as mqttvacuum)
from homeassistant.components.mqtt.discovery import async_start
from homeassistant.components.v... | apache-2.0 |
orgito/ansible | lib/ansible/modules/storage/purestorage/purefb_dsrole.py | 11 | 6100 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2018, Simon Dodsley (simon@purestorage.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 |
terbolous/CouchPotatoServer | libs/tmdb3/cache.py | 32 | 4661 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#-----------------------
# Name: cache.py
# Python Library
# Author: Raymond Wagner
# Purpose: Caching framework to store TMDb API results
#-----------------------
import time
import os
from tmdb_exceptions import *
from cache_engine import Engines
import cache_null
impo... | gpl-3.0 |
iModels/ffci | github/tests/Issue54.py | 1 | 2363 | # -*- coding: utf-8 -*-
# ########################## Copyrights and license ############################
# #
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
# Copyright 2012 Zearin <zearin@gonk.net> ... | mit |
HackerEarth/django-allauth | allauth/socialaccount/providers/openid/provider.py | 6 | 2030 | from urlparse import urlparse
from django.core.urlresolvers import reverse
from django.utils.http import urlencode
from allauth.socialaccount import providers
from allauth.socialaccount.providers.base import Provider, ProviderAccount
class OpenIDAccount(ProviderAccount):
def get_brand(self):
ret = super(O... | mit |
foreni-administrator/pyew | vtrace/envitools.py | 17 | 4179 |
"""
Some tools that require the envi framework to be installed
"""
import sys
import traceback
import envi
import envi.archs.i386 as e_i386 # FIXME This should NOT have to be here
class RegisterException(Exception):
pass
def cmpRegs(emu, trace):
for idx,name in reg_map:
er = emu.getRegister(idx)
... | gpl-2.0 |
romankagan/DDBWorkbench | python/lib/Lib/site-packages/django/db/models/sql/where.py | 289 | 13163 | """
Code to manage the creation and SQL rendering of 'where' constraints.
"""
import datetime
from itertools import repeat
from django.utils import tree
from django.db.models.fields import Field
from django.db.models.query_utils import QueryWrapper
from datastructures import EmptyResultSet, FullResultSet
# Connection... | apache-2.0 |
4eek/edx-platform | common/djangoapps/track/tests/test_logs.py | 163 | 2712 | """Tests that tracking data are successfully logged"""
import mock
import unittest
from django.test import TestCase
from django.core.urlresolvers import reverse
from django.conf import settings
from track.models import TrackingLog
from track.views import user_track
@unittest.skip("TODO: these tests were not being ru... | agpl-3.0 |
einstein95/crunchy-xml-decoder | crunchy-xml-decoder/unidecode/x0d7.py | 252 | 4559 | data = (
'hwen', # 0x00
'hwenj', # 0x01
'hwenh', # 0x02
'hwed', # 0x03
'hwel', # 0x04
'hwelg', # 0x05
'hwelm', # 0x06
'hwelb', # 0x07
'hwels', # 0x08
'hwelt', # 0x09
'hwelp', # 0x0a
'hwelh', # 0x0b
'hwem', # 0x0c
'hweb', # 0x0d
'hwebs', # 0x0e
'hwes', # 0x0f
'hwess', #... | gpl-2.0 |
rickardo10/distributed-db-app | auth.py | 1 | 5815 | # -*- encoding: UTF-8 -*-
#
# Form based authentication for CherryPy. Requires the
# Session tool to be loaded.
#
import cherrypy
SESSION_KEY = '_cp_username'
def check_credentials(username, password):
"""Verifies credentials for username and password.
Returns None on success or a string describing the error... | mit |
appsembler/edx-platform | openedx/core/djangoapps/bookmarks/tasks.py | 20 | 5912 | """
Tasks for bookmarks.
"""
import logging
from celery.task import task # pylint: disable=import-error,no-name-in-module
from django.db import transaction
from opaque_keys.edx.keys import CourseKey
from xmodule.modulestore.django import modulestore
from . import PathItem
log = logging.getLogger('edx.celery.task')... | agpl-3.0 |
Tepira/binwalk | src/binwalk/modules/disasm.py | 1 | 7773 | import capstone
import binwalk.core.common
import binwalk.core.compat
from binwalk.core.module import Module, Option, Kwarg
class ArchResult(object):
def __init__(self, **kwargs):
for (k,v) in kwargs.iteritems():
setattr(self, k, v)
class Architecture(object):
def __init__(self, **kwargs):... | mit |
drepetto/chiplotle | chiplotle/tools/mathtools/rotate_2d.py | 1 | 1793 | from chiplotle.geometry.core.coordinate import Coordinate
from chiplotle.geometry.core.coordinatearray import CoordinateArray
import math
## TODO: refactor, this is nasty. Take one type only!
def rotate_2d(xy, angle, pivot=(0, 0)):
'''2D rotation.
- `xy` is an (x, y) coordinate pair or a list of coordinate p... | gpl-3.0 |
mrmans0n/sublime-text-3-config | Packages/Androguard/androguard/decompiler/dad/decompile.py | 6 | 12959 | # This file is part of Androguard.
#
# Copyright (c) 2012 Geoffroy Gueguen <geoffroy.gueguen@gmail.com>
# All Rights Reserved.
#
# Androguard is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either versi... | mit |
yencarnacion/jaikuengine | .google_appengine/lib/django-1.5/django/contrib/localflavor/mx/models.py | 197 | 2266 | from django.utils.translation import ugettext_lazy as _
from django.db.models.fields import CharField
from django.contrib.localflavor.mx.mx_states import STATE_CHOICES
from django.contrib.localflavor.mx.forms import (MXRFCField as MXRFCFormField,
MXZipCodeField as MXZipCodeFormField, MXCURPField as MXCURPFormField... | apache-2.0 |
noironetworks/group-based-policy | gbpservice/neutron/services/grouppolicy/config.py | 1 | 1327 | # 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 |
Flight/django-filer | filer/south_migrations/0013_remove_null_file_name.py | 22 | 11402 | # -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
for file_name_null in orm.File.objects.filter(name__isnull=True):
file_name_null.name = ""
file_... | bsd-3-clause |
40123248/2015cd_midterm2 | static/Brython3.1.0-20150301-090019/Lib/textwrap.py | 745 | 16488 | """Text wrapping and filling.
"""
# Copyright (C) 1999-2001 Gregory P. Ward.
# Copyright (C) 2002, 2003 Python Software Foundation.
# Written by Greg Ward <gward@python.net>
import re
__all__ = ['TextWrapper', 'wrap', 'fill', 'dedent', 'indent']
# Hardcode the recognized whitespace characters to the US-ASCII
# whit... | gpl-3.0 |
matteo88/gasistafelice | gasistafelice/supplier/management/commands/export_SBW_suppliers.py | 6 | 10164 |
from django.core.management.base import BaseCommand, CommandError
from django.conf import settings
from django.db import IntegrityError, transaction
from django.core.files import File
from django.contrib.auth.models import User
from gasistafelice.lib.csvmanager import CSVManager
from gasistafelice.lib import get_para... | agpl-3.0 |
geerlingguy/ansible | lib/ansible/parsing/plugin_docs.py | 38 | 4260 | # Copyright: (c) 2017, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import ast
from ansible.module_utils._text import to_text
from ansible.parsing.yaml.loader import... | gpl-3.0 |
pombredanne/pyfpm | docs/conf.py | 2 | 7784 | # -*- coding: utf-8 -*-
#
# pyfpm documentation build configuration file, created by
# sphinx-quickstart on Sat Aug 4 20:39:29 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.
#
# All c... | mit |
miragshin/pupy | pupy/packages/all/interactive_shell.py | 25 | 1683 | # -*- coding: UTF8 -*-
import sys
from subprocess import PIPE, Popen
from threading import Thread
from Queue import Queue, Empty
import time
import traceback
ON_POSIX = 'posix' in sys.builtin_module_names
def write_output(out, queue):
try:
for c in iter(lambda: out.read(1), b""):
queue.put(c)
out.close()
e... | bsd-3-clause |
VanirAOSP/kernel_oppo_n1 | tools/perf/util/setup.py | 4998 | 1330 | #!/usr/bin/python2
from distutils.core import setup, Extension
from os import getenv
from distutils.command.build_ext import build_ext as _build_ext
from distutils.command.install_lib import install_lib as _install_lib
class build_ext(_build_ext):
def finalize_options(self):
_build_ext.finalize_optio... | gpl-2.0 |
markYoungH/chromium.src | tools/telemetry/telemetry/core/platform/power_monitor/power_monitor_controller_unittest.py | 25 | 1135 | # 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
import telemetry.core.platform.power_monitor as power_monitor
from telemetry.core.platform.power_monitor import power_monitor_controller
c... | bsd-3-clause |
quickresolve/accel.ai | flask-aws/lib/python2.7/site-packages/pip/_vendor/requests/packages/chardet/mbcsgroupprober.py | 2769 | 1967 | ######################## 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... | mit |
fintech-circle/edx-platform | lms/djangoapps/course_wiki/settings.py | 260 | 1247 | """
These callables are used by django-wiki to check various permissions
a user has on an article.
"""
from course_wiki.utils import user_is_article_course_staff
def CAN_DELETE(article, user): # pylint: disable=invalid-name
"""Is user allowed to soft-delete article?"""
return _is_staff_for_article(article, ... | agpl-3.0 |
Endika/c2c-rd-addons | mrp_no_gap/mrp.py | 4 | 1542 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
# Copyright (C) 2012-2012 ChriCar Beteiligungs- und Beratungs- GmbH (<http://www.camptocamp.at>)
#
# Thi... | agpl-3.0 |
ashang/calibre | src/calibre/utils/recycle_bin.py | 14 | 5429 | #!/usr/bin/env python2
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
from __future__ import print_function
__license__ = 'GPL v3'
__copyright__ = '2010, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
import os, shutil, time, sys
from calibre import isbytestring
from calibre.constant... | gpl-3.0 |
kcorring/ds4100-music-analytics | muslytics/ITunesUtils.py | 1 | 12418 | #!/usr/bin/python
'''itunes utility classes'''
from __future__ import absolute_import, print_function
import logging
import re
from muslytics.Utils import strip_featured_artists, AbstractTrack, MULT_ARTIST_PATTERN, UNKNOWN_GENRE
logger = logging.getLogger(__name__)
FEAT_GROUP_PATTERN = re.compile('.*\(feat\.(?P<art... | mit |
jay-z007/dxr | tests/test_basic/test_basic.py | 7 | 2874 | from dxr.testing import DxrInstanceTestCase
from nose.tools import eq_, ok_
class BasicTests(DxrInstanceTestCase):
"""Tests for functionality that isn't specific to particular filters"""
def test_text(self):
"""Assert that a plain text search works."""
self.found_files_eq('main', ['main.c', ... | mit |
wfxiang08/django178 | django/utils/translation/__init__.py | 49 | 6780 | """
Internationalization support.
"""
from __future__ import unicode_literals
import re
from django.utils.encoding import force_text
from django.utils.functional import lazy
from django.utils import six
__all__ = [
'activate', 'deactivate', 'override', 'deactivate_all',
'get_language', 'get_language_from_requ... | bsd-3-clause |
romain-dartigues/ansible | lib/ansible/modules/cloud/smartos/vmadm.py | 48 | 24315 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, Jasper Lievisse Adriaanse <j@jasper.la>
# 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.... | gpl-3.0 |
camradal/ansible | lib/ansible/modules/cloud/profitbricks/profitbricks_volume_attachments.py | 6 | 8222 | #!/usr/bin/python
# 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.
#
# Ansible is distributed... | gpl-3.0 |
adamwwt/chvac | venv/lib/python2.7/site-packages/pygments/formatters/other.py | 363 | 3811 | # -*- coding: utf-8 -*-
"""
pygments.formatters.other
~~~~~~~~~~~~~~~~~~~~~~~~~
Other formatters: NullFormatter, RawTokenFormatter.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from pygments.formatter import Formatter
from pygments... | mit |
fredericmohr/mitro | browser-ext/third_party/firefox-addon-sdk/python-lib/cuddlefish/rdf.py | 29 | 7542 | # 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/.
import os
import xml.dom.minidom
import StringIO
RDF_NS = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
EM_NS = "http:/... | gpl-3.0 |
abutcher/origin | vendor/github.com/google/certificate-transparency/python/ct/crypto/asn1/oid_test.py | 35 | 2146 | #!/usr/bin/env python
import unittest
from ct.crypto import error
from ct.crypto.asn1 import oid
from ct.crypto.asn1 import type_test_base
class ObjectIdentifierTest(type_test_base.TypeTestBase):
asn1_type = oid.ObjectIdentifier
hashable = True
initializers = (
((0, 0), "0.0"),
((1, 2)... | apache-2.0 |
GlobalBoost/GlobalBoost | test/functional/feature_cltv.py | 5 | 5840 | #!/usr/bin/env python3
# Copyright (c) 2015-2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test BIP65 (CHECKLOCKTIMEVERIFY).
Test that the CHECKLOCKTIMEVERIFY soft-fork activates at (regtest) b... | mit |
bcl/pykickstart | tests/commands/rhsm.py | 2 | 5046 | #
# Copyright 2019 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. This program is distributed in the hope that it
# will be useful, but WITHOUT ANY WARRANTY expressed... | gpl-2.0 |
TieWei/nova | nova/cells/filters/__init__.py | 58 | 2117 | # Copyright (c) 2012-2013 Rackspace Hosting
# 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
#
# Unles... | apache-2.0 |
Didacti/tornadozencoder | test/test_reports.py | 2 | 2671 | import unittest
from mock import patch
from test_util import TEST_API_KEY, load_response
from zencoder import Zencoder
import datetime
class TestReports(unittest.TestCase):
def setUp(self):
self.zen = Zencoder(api_key=TEST_API_KEY)
@patch("requests.Session.get")
def test_reports_vod(self, get):
... | mit |
yvxiang/tera | src/sdk/python/sample.py | 2 | 1915 | #!/usr/bin/env python
"""
sample of using Tera Python SDK
"""
from TeraSdk import Client, RowMutation, MUTATION_CALLBACK, TeraSdkException
import time
def main():
"""
REQUIRES: tera.flag in current work directory; table `oops' was created
"""
try:
client = Client("./tera.flag", "pysdk")
... | bsd-3-clause |
mjgrav2001/scikit-learn | sklearn/metrics/tests/test_regression.py | 272 | 6066 | from __future__ import division, print_function
import numpy as np
from itertools import product
from sklearn.utils.testing import assert_raises
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.... | bsd-3-clause |
broferek/ansible | lib/ansible/module_utils/network/edgeswitch/edgeswitch_interface.py | 52 | 3521 | # 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 |
cryvate/project-euler | project_euler/solutions/problem_51.py | 1 | 1244 | from collections import Counter
from itertools import combinations
from ..library.number_theory.primes import is_prime, prime_sieve
from ..library.base import list_to_number, number_to_list
def solve() -> int:
primes = prime_sieve(1_000_000)
for prime in primes:
if prime < 100_000:
conti... | mit |
bgxavier/nova | nova/api/openstack/compute/plugins/v3/personality.py | 43 | 2485 | # Copyright 2014 NEC Corporation. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required ... | apache-2.0 |
rue89-tech/edx-analytics-pipeline | edx/analytics/tasks/enrollments.py | 1 | 21343 | """Compute metrics related to user enrollments in courses"""
import logging
import datetime
import luigi
import luigi.task
from edx.analytics.tasks.database_imports import ImportAuthUserProfileTask
from edx.analytics.tasks.mapreduce import MapReduceJobTaskMixin, MapReduceJobTask
from edx.analytics.tasks.pathutil imp... | agpl-3.0 |
donaloconnor/bitcoin | test/functional/rpc_named_arguments.py | 22 | 1211 | #!/usr/bin/env python3
# Copyright (c) 2016-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test using named arguments for RPCs."""
from test_framework.test_framework import BitcoinTestFramework... | mit |
mozilla/inventory | user_systems/migrations/0001_initial.py | 2 | 14540 | # -*- 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):
# Adding model 'UserOperatingSystem'
db.create_table('user_systems_useroperatingsystem', (
('id'... | bsd-3-clause |
rchav/vinerack | saleor/order/migrations/0011_auto_20160207_0534.py | 14 | 1053 | # -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-02-07 11:34
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import django_prices.models
class Migration(migrations.Migration):
dependencies = [
('discount', '0003_auto_20160207_0... | bsd-3-clause |
pricingassistant/mrq | mrq/scheduler.py | 1 | 4982 | from future.builtins import str, object
from .context import log, queue_job
import datetime
import ujson as json
import time
def _hash_task(task):
""" Returns a unique hash for identify a task and its params """
params = task.get("params")
if params:
params = json.dumps(sorted(list(task["params"]... | mit |
peterlauri/django | django/core/serializers/python.py | 109 | 7851 | """
A Python "serializer". Doesn't do much serializing per se -- just converts to
and from basic Python data types (lists, dicts, strings, etc.). Useful as a basis for
other serializers.
"""
from __future__ import unicode_literals
from collections import OrderedDict
from django.apps import apps
from django.conf impor... | bsd-3-clause |
caterinaurban/Typpete | typpete/src/stubs/str_methods.py | 1 | 3955 | """Stub file for methods invoked on strings
TODO make some arguments optional
"""
from typing import List
def capitalize(s: str) -> str:
"""Return a new string with the first letter capitalized"""
pass
def center(s: str, width: int, fillchar: str) -> str:
"""Returns a space-padded string with the origi... | mpl-2.0 |
mainulhossain/phenoproc | app/biowl/libraries/shippi/img_pipe2.py | 2 | 58923 |
#@author: Amit Kumar Mondal
#@address: SR LAB, Computer Science Department, USASK
#Email: amit.mondal@usask.ca
import paramiko
import re
import sys
import os
import io
#import errno
import cv2
import numpy as np
#import functools
from skimage import *
from skimage import color
from skimage.feature import blob_doh
from... | mit |
Hakuba/youtube-dl | youtube_dl/extractor/blinkx.py | 199 | 3217 | from __future__ import unicode_literals
import json
from .common import InfoExtractor
from ..utils import (
remove_start,
int_or_none,
)
class BlinkxIE(InfoExtractor):
_VALID_URL = r'(?:https?://(?:www\.)blinkx\.com/#?ce/|blinkx:)(?P<id>[^?]+)'
IE_NAME = 'blinkx'
_TEST = {
'url': 'http:... | unlicense |
Voluntarynet/BitmessageKit | BitmessageKit/Vendor/static-python/Lib/encodings/cp858.py | 416 | 34271 | """ Python Character Mapping Codec for CP858, modified from cp850.
"""
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'):
return codecs.charmap_decod... | mit |
pilou-/ansible | lib/ansible/modules/cloud/vmware/vcenter_license.py | 9 | 9447 | #!/usr/bin/python
# Copyright: (c) 2017, Dag Wieers (@dagwieers) <dag@wieers.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 |
memsharded/conan | conans/test/unittests/search/disk_search_test.py | 1 | 3782 | import os
import unittest
from conans.client.cache.cache import ClientCache
from conans.client.tools import chdir
from conans.model.info import ConanInfo
from conans.model.ref import ConanFileReference
from conans.paths import (BUILD_FOLDER, CONANINFO, EXPORT_FOLDER, PACKAGES_FOLDER)
from conans.search.search import s... | mit |
360youlun/django-nose | django_nose/tools.py | 52 | 1647 | # vim: tabstop=4 expandtab autoindent shiftwidth=4 fileencoding=utf-8
"""
Provides Nose and Django test case assert functions
"""
from django.test.testcases import TransactionTestCase
from django.core import mail
import re
## Python
from nose import tools
for t in dir(tools):
if t.startswith('assert_'):
... | bsd-3-clause |
ssundaresan/sculpte-simulator | flow.py | 1 | 5360 | import sys
import os
import random as rnd
import numpy as np
from numpy import random as rv
import route
import gen
import heapq
class flowgen(object):
'''
Flow generator class. Instantiates objects inside
- for flow arrival, size of flow and throughput assignment.
'''
def __init__(self,fptr,tm):
self.... | gpl-2.0 |
vgupta6/Project-2 | modules/tests/core/core_dataTable.py | 2 | 12017 | __all__ = ["dt_filter",
"dt_row_cnt",
"dt_data",
"dt_data_item",
"dt_find",
"dt_links",
"dt_action",
]
# @ToDo: There are performance issues
# - need to profile and find out in which functions are the bottlenecks
import time
from gluo... | mit |
jittat/cafe-grader-web | lib/assets/Lib/timeit.py | 9 | 11830 | #! /usr/bin/python3.4
"""Tool for measuring execution time of small code snippets.
This module avoids a number of common traps for measuring execution
times. See also Tim Peters' introduction to the Algorithms chapter in
the Python Cookbook, published by O'Reilly.
Library usage: see the Timer class.
Comm... | mit |
amirrpp/django-oscar | sites/sandbox/urls.py | 41 | 1577 | from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.i18n import i18n_patterns
from django.conf.urls.static import static
from django.contrib import admin
from oscar.app import application
from oscar.views import handler500, handler404, handler403
from apps.sitemaps import ... | bsd-3-clause |
jcoady9/python-for-android | python3-alpha/extra_modules/gdata/apps/groups/service.py | 48 | 12986 | #!/usr/bin/python
#
# Copyright (C) 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... | apache-2.0 |
Andrey-Tkachev/Creto | node_modules/npm/node_modules/node-gyp/gyp/PRESUBMIT.py | 1369 | 3662 | # 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.
"""Top-level presubmit script for GYP.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more details about the presubmit API built... | mit |
garnaat/boto | boto/roboto/awsqueryservice.py | 153 | 4453 | from __future__ import print_function
import os
import urlparse
import boto
import boto.connection
import boto.jsonresponse
import boto.exception
from boto.roboto import awsqueryrequest
class NoCredentialsError(boto.exception.BotoClientError):
def __init__(self):
s = 'Unable to find credentials'
s... | mit |
blindpenguin/blackboard | node_modules/gulp-sass/node_modules/node-sass/node_modules/node-gyp/gyp/tools/graphviz.py | 2679 | 2878 | #!/usr/bin/env python
# Copyright (c) 2011 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.
"""Using the JSON dumped by the dump-dependency-json generator,
generate input suitable for graphviz to render a dependency graph of
targets... | gpl-3.0 |
zakdoek/django-simple-resizer | simple_resizer/_version.py | 1 | 7478 |
# This file helps to compute a version number in source trees obtained from
# git-archive tarball (such as those provided by githubs download-from-tag
# feature). Distribution tarballs (built by setup.py sdist) and build
# directories (produced by setup.py build) will contain a much shorter file
# that just contains t... | mit |
tlksio/tlksio | env/lib/python3.4/site-packages/django/contrib/redirects/models.py | 115 | 1077 | from django.contrib.sites.models import Site
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _
@python_2_unicode_compatible
class Redirect(models.Model):
site = models.ForeignKey(Site, models.CASCADE, verbose_name=_('... | mit |
hamiltont/CouchPotatoServer | couchpotato/core/providers/torrent/torrentshack/main.py | 4 | 2881 | from bs4 import BeautifulSoup
from couchpotato.core.helpers.encoding import tryUrlencode
from couchpotato.core.helpers.variable import tryInt
from couchpotato.core.logger import CPLog
from couchpotato.core.providers.torrent.base import TorrentProvider
import traceback
log = CPLog(__name__)
class TorrentShack(Torrent... | gpl-3.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.