repo_name stringlengths 5 100 | path stringlengths 4 375 | copies stringclasses 991
values | size stringlengths 4 7 | content stringlengths 666 1M | license stringclasses 15
values |
|---|---|---|---|---|---|
miumok98/weblate | examples/mt_service.py | 11 | 1388 | # -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2015 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <http://weblate.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 Foundation, eithe... | gpl-3.0 |
yedidiaklein/local_video_directory | classes/task/googleSpeech/google/protobuf/python/google/protobuf/json_format.py | 19 | 29835 | # 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... | gpl-3.0 |
mvaled/sentry | tests/acceptance/test_organization_sentry_app.py | 2 | 3591 | from __future__ import absolute_import
from exam import mock
from sentry.testutils import AcceptanceTestCase
from tests.acceptance.page_objects.organization_integration_settings import (
OrganizationIntegrationSettingsPage,
)
class OrganizationSentryAppAcceptanceTestCase(AcceptanceTestCase):
"""
As a u... | bsd-3-clause |
nmrao/robotframework | utest/reporting/test_logreportwriters.py | 29 | 1276 | import unittest
from robot.reporting.logreportwriters import LogWriter
from robot.utils.asserts import assert_true, assert_equals
class LogWriterWithMockedWriting(LogWriter):
def __init__(self, model):
LogWriter.__init__(self, model)
self.split_write_calls = []
self.write_called = False
... | apache-2.0 |
sarnold/exaile | xlgui/preferences/appearance.py | 4 | 5192 | # Copyright (C) 2008-2010 Adam Olsen
#
# 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.
#
# This program is distributed in the hope that... | gpl-2.0 |
nonnib/eve-metrics | web2py/applications/admin/controllers/shell.py | 25 | 1413 | import sys
import cStringIO
import gluon.contrib.shell
import code
import thread
import cgi
from gluon.shell import env
if DEMO_MODE or MULTI_USER_MODE:
session.flash = T('disabled in demo mode')
redirect(URL('default', 'site'))
FE = 10 ** 9
def index():
app = request.args(0) or 'admin'
reset()
... | mit |
litex-hub/pythondata-cpu-blackparrot | pythondata_cpu_blackparrot/system_verilog/bp_me/src/asm/test/test.py | 1 | 1385 | from __future__ import print_function
from argparse import ArgumentParser
import os
import sys
parser = ArgumentParser(description='CCE Microcode Test Code Generator')
parser.add_argument('-o', '--outfile', dest='outfile', type=str, default='test.S',
help='Output assembly file')
args = parser.pars... | bsd-3-clause |
percy-g2/Novathor_xperia_u8500 | 6.1.1.B.0.253/external/webkit/Tools/Scripts/webkitpy/tool/bot/botinfo.py | 20 | 2016 | # Copyright (c) 2011 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the ... | gpl-2.0 |
newswangerd/ansible | test/integration/targets/collections/collection_root_user/ansible_collections/testns/testcoll/plugins/vars/custom_vars.py | 58 | 1487 | # Copyright 2019 RedHat, 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.
#
# Ansible i... | gpl-3.0 |
kvandermast/hic_sunt | nodejs/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode.py | 526 | 54812 | # 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.
import filecmp
import gyp.common
import gyp.xcodeproj_file
import errno
import os
import sys
import posixpath
import re
import shutil
import subprocess
import temp... | gpl-3.0 |
solin319/incubator-mxnet | tools/accnn/acc_conv.py | 52 | 3352 | # 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 |
Turbo87/skylines | skylines/commands/import_/airspace.py | 1 | 15825 | from __future__ import print_function
from flask_script import Command, Option
import re
import shutil
import os.path
import subprocess
from flask import current_app
from geoalchemy2.shape import from_shape
from shapely.geometry import polygon
from shapely.wkt import loads
from sqlalchemy.sql.expression import case
... | agpl-3.0 |
verma-varsha/zulip | zerver/webhooks/slack/tests.py | 13 | 2694 | # -*- coding: utf-8 -*-
from zerver.lib.test_classes import WebhookTestCase
from six import text_type
class SlackWebhookTests(WebhookTestCase):
STREAM_NAME = 'slack'
URL_TEMPLATE = "/api/v1/external/slack?stream={stream}&api_key={api_key}"
FIXTURE_DIR_NAME = 'slack'
def test_slack_channel_to_topic(se... | apache-2.0 |
cloudbase/cinder | cinder/tests/unit/volume/drivers/fusionstorage/test_dsware.py | 6 | 35841 | # Copyright (c) 2013 - 2016 Huawei Technologies Co., Ltd.
# 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/LIC... | apache-2.0 |
hajuuk/asuswrt | release/src/router/samba-3.5.8/examples/scripts/shares/python/generate_parm_table.py | 90 | 6683 | #!/usr/bin/env python
######################################################################
##
## Generate parameter dictionary from param/loadparm.c
##
## Copyright (C) Gerald Carter 2004.
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General P... | gpl-2.0 |
Johnzero/erp | openerp/addons/account/report/common_report_header.py | 6 | 6502 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | agpl-3.0 |
h4wkmoon/shinken | shinken/brok.py | 1 | 1976 | #!/usr/bin/env python
#
# -*- coding: utf-8 -*-
#
# Copyright (C) 2009-2014:
# Gabes Jean, naparuba@gmail.com
# Gerhard Lausser, Gerhard.Lausser@consol.de
# Gregory Starck, g.starck@gmail.com
# Hartmut Goebel, h.goebel@goebel-consult.de
#
# This file is part of Shinken.
#
# Shinken is free software: you can... | agpl-3.0 |
potatolondon/potato-mapreduce | mapreduce/test_support.py | 36 | 7134 | #!/usr/bin/env python
#
# 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 applicable law o... | apache-2.0 |
jasonwee/asus-rt-n14uhp-mrtg | tmp/ve_asus-rt-n14uhp-mrtg/lib/python3.4/site-packages/requests/packages/chardet/euckrfreq.py | 3121 | 45978 | ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is Mozilla Communicator client code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights R... | apache-2.0 |
consulo/consulo-python | plugin/src/main/dist/helpers/pydev/third_party/pep8/lib2to3/lib2to3/fixes/fix_except.py | 326 | 3352 | """Fixer for except statements with named exceptions.
The following cases will be converted:
- "except E, T:" where T is a name:
except E as T:
- "except E, T:" where T is not a name, tuple or list:
except E as t:
T = t
This is done because the target of an "except" clause must be a
... | apache-2.0 |
alibarkatali/module_web | venv/lib/python2.7/site-packages/pip/utils/packaging.py | 343 | 2080 | from __future__ import absolute_import
from email.parser import FeedParser
import logging
import sys
from pip._vendor.packaging import specifiers
from pip._vendor.packaging import version
from pip._vendor import pkg_resources
from pip import exceptions
logger = logging.getLogger(__name__)
def check_requires_pyth... | mit |
TheShed/OpenOCD-CMSIS-DAP | tools/xsvf_tools/svf2xsvf.py | 101 | 26710 | #!/usr/bin/python3.0
# Copyright 2008, SoftPLC Corporation http://softplc.com
# Dick Hollenbeck dick@softplc.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 Lic... | gpl-2.0 |
jonludlam/xen | tools/xm-test/tests/cpupool/01_cpupool_basic_pos.py | 36 | 2132 | #!/usr/bin/python
import sys
import re
import time
from XmTestLib import *
#
# Check output of xm info. It must include field 'free_cpus'
# The value must be between 0 - nr_cpus
#
free_cpus = getInfo("free_cpus")
if free_cpus == "":
FAIL("Missing 'free_cpus' entry in xm info output")
if int(free_cpus) not in ra... | gpl-2.0 |
hdd/bigcouch | couchjs/scons/scons-local-2.0.1/SCons/Tool/RCS.py | 61 | 2343 | """SCons.Tool.RCS.py
Tool-specific initialization for RCS.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation
#
# ... | apache-2.0 |
hetajen/vnpy161 | vn.tutorial/tick2trade/vn.trader_t2t/uiBasicWidget.py | 9 | 44280 | # encoding: UTF-8
import json
import csv
import os
from collections import OrderedDict
from PyQt4 import QtGui, QtCore
from eventEngine import *
from vtFunction import *
from vtGateway import *
#----------------------------------------------------------------------
def loadFont():
"""载入字体设置"""
fileName = '... | mit |
mherrmann/osxtrash | setup.py | 1 | 1317 | """Send files to the Trash on OS X (incl. "Put Back" support).
See:
https://github.com/mherrmann/osxtrash"""
from setuptools import setup, Extension
impl = Extension(
'osxtrash',
sources=['src/trash.m'],
extra_compile_args=['-mmacosx-version-min=10.5'],
extra_link_args=[
'-framework', 'AppKit',
'-framework',... | mit |
mjirayu/sit_academy | lms/djangoapps/certificates/tests/test_create_fake_cert.py | 107 | 2003 | """Tests for the create_fake_certs management command. """
from django.test import TestCase
from django.core.management.base import CommandError
from nose.plugins.attrib import attr
from opaque_keys.edx.locator import CourseLocator
from student.tests.factories import UserFactory
from certificates.management.commands i... | agpl-3.0 |
shahankhatch/scikit-learn | benchmarks/bench_mnist.py | 76 | 6136 | """
=======================
MNIST dataset benchmark
=======================
Benchmark on the MNIST dataset. The dataset comprises 70,000 samples
and 784 features. Here, we consider the task of predicting
10 classes - digits from 0 to 9 from their raw images. By contrast to the
covertype dataset, the feature space is... | bsd-3-clause |
martynovp/edx-platform | lms/djangoapps/shoppingcart/processors/CyberSource.py | 142 | 19828 | """
Implementation the CyberSource credit card processor.
IMPORTANT: CyberSource will deprecate this version of the API ("Hosted Order Page") in September 2014.
We are keeping this implementation in the code-base for now, but we should
eventually replace this module with the newer implementation (in `CyberSource2.py`)... | agpl-3.0 |
hydroffice/hyo_soundspeed | hyo2/soundspeed/listener/seacat/seacat_emulator.py | 1 | 5497 | import serial
import time
import traceback
try:
from hyo2.soundspeed.listener.seacat.sbe_serialcomms import SeacatComms, UTF8Serial
except Exception:
print("Seacat serial communications module not found or failed to load")
print("Emulator will still work but the capture function will raise an exception")
... | lgpl-2.1 |
myerpengine/odoo | addons/purchase_requisition/purchase_requisition.py | 10 | 23810 | # -*- encoding: 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 |
kevinmel2000/brython | www/src/Lib/unittest/test/test_assertions.py | 738 | 15398 | import datetime
import warnings
import unittest
from itertools import product
class Test_Assertions(unittest.TestCase):
def test_AlmostEqual(self):
self.assertAlmostEqual(1.00000001, 1.0)
self.assertNotAlmostEqual(1.0000001, 1.0)
self.assertRaises(self.failureException,
... | bsd-3-clause |
gptech/ansible | lib/ansible/module_utils/database.py | 401 | 5839 | # 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 |
julienmalard/Tikon | tikon/datos/valid.py | 1 | 2654 | from tikon.datos.proc import ens, n_existen, prom_vals, suma_pesos, Procesador
def gen_proc_valid(proc):
if isinstance(proc, ProcesadorValid):
return proc
return ProcesadorValid(f_vals=proc)
class PlantillaValid(object):
def __init__(símismo, criterios, peso):
símismo.criterios = criteri... | agpl-3.0 |
mmezzavilla/ns3-mmwave | src/core/bindings/modulegen__gcc_ILP32.py | 15 | 321233 | from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
import pybindgen.settings
import warnings
class ErrorHandler(pybindgen.settings.ErrorHandler):
def handle_error(self, wrapper, exception, traceback_):
warnings.warn("exception %r in wrapper %s" % (exception, wrapper))
... | gpl-2.0 |
ds0nt/or-tools | examples/python/hidato.py | 34 | 6160 | # Copyright 2010 Hakan Kjellerstrand hakank@bonetmail.com
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | apache-2.0 |
AthinaB/synnefo | snf-cyclades-gtools/setup.py | 9 | 1843 | # Copyright (C) 2010-2014 GRNET S.A.
#
# 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 3 of the License, or
# (at your option) any later version.
#
# This program is distributed i... | gpl-3.0 |
PaulAYoung/f2014_iolab | pymongoProject/venv/lib/python2.7/site-packages/passlib/handlers/sha1_crypt.py | 19 | 5325 | """passlib.handlers.sha1_crypt
"""
#=============================================================================
# imports
#=============================================================================
# core
from hmac import new as hmac
from hashlib import sha1
import re
import logging; log = logging.getLogger(__na... | unlicense |
bulletRush/QCloud_yunapi_wrapper | thirdparty/requests/exceptions.py | 895 | 2517 | # -*- coding: utf-8 -*-
"""
requests.exceptions
~~~~~~~~~~~~~~~~~~~
This module contains the set of Requests' exceptions.
"""
from .packages.urllib3.exceptions import HTTPError as BaseHTTPError
class RequestException(IOError):
"""There was an ambiguous exception that occurred while handling your
request.""... | apache-2.0 |
Mirantis/tempest | tempest/services/volume/xml/volumes_client.py | 1 | 17467 | # Copyright 2012 IBM Corp.
# 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 app... | apache-2.0 |
maxfischer2781/cpy2py | cpy2py_unittests/test_descriptor.py | 1 | 1295 | from __future__ import print_function
import unittest
import time
from cpy2py import kernel_state, TwinMaster, TwinObject
class DescriptorObject(TwinObject):
__twin_id__ = 'pypy'
def __init__(self, numeric_value=0):
self.numeric_value = numeric_value
@property
def prop(self):
return... | apache-2.0 |
wmles/scholarium.at | Bibliothek/migrations/0005_auto_20171001_1105.py | 1 | 1586 | # -*- coding: utf-8 -*-
# Generated by Django 1.9.11 on 2017-10-01 11:05
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('Bibliothek', '0004_altes_buch'),
]
operations = [
migrations.AddField(
... | mit |
alexmogavero/home-assistant | tests/components/test_logger.py | 24 | 3191 | """The tests for the Logger component."""
from collections import namedtuple
import logging
import unittest
from homeassistant.setup import setup_component
from homeassistant.components import logger
from tests.common import get_test_home_assistant
RECORD = namedtuple('record', ('name', 'levelno'))
NO_LOGS_CONFIG =... | apache-2.0 |
besacier/WCE-LIG | tools/moses/scripts/analysis/extract-target-trees.py | 2 | 5322 | #!/usr/bin/env python
# Usage: extract-target-trees.py [FILE]
#
# Reads moses-chart's -T output from FILE or standard input and writes trees to
# standard output in Moses' XML tree format.
import re
import sys
class Tree:
def __init__(self, label, children):
self.label = label
self.children = ch... | gpl-3.0 |
VinACE/nltk-trainer | analyze_tagger_coverage.py | 5 | 5537 | #!/usr/bin/env python
import argparse, collections, math, os.path
import nltk.corpus, nltk.corpus.reader, nltk.data, nltk.tag, nltk.metrics
from nltk.corpus.util import LazyCorpusLoader
from nltk_trainer import load_corpus_reader, load_model, simplify_wsj_tag
from nltk_trainer.tagging import taggers
##################... | apache-2.0 |
macmania/klein | setup.py | 2 | 1990 | import codecs
import os
import re
from setuptools import setup
def read(*parts):
"""
Build an absolute path from *parts* and and return the contents of the
resulting file. Assume UTF-8 encoding.
"""
here = os.path.abspath(os.path.dirname(__file__))
with codecs.open(os.path.join(here, *parts)... | mit |
pavels/pootle | pootle/apps/accounts/migrations/0003_remove_pootleprofile_id.py | 15 | 2823 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
def fix_accounts_alt_src_langs(apps, schema_editor):
"""Remove pootleprofile_id column from accounts_user_alt_src_langs
After migration from 2.5.x the pootleprofile_id column is left on
the m2m table account... | gpl-3.0 |
manuelcortez/socializer | doc/documentation_importer.py | 1 | 1072 | # -*- coding: utf-8 -*-
from codecs import open
""" This script converts the hold documentation (saved in markdown files) in a python file with a list of strings to translate it using gettext."""
def prepare_documentation_in_file(fileSource, fileDest):
""" This takes documentation written in a markdown file and put a... | gpl-2.0 |
bcoca/ansible | test/units/playbook/test_block.py | 58 | 2714 | # (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) an... | gpl-3.0 |
tinchoss/Python_Android | python/src/Tools/scripts/linktree.py | 101 | 2425 | #! /usr/bin/env python
# linktree
#
# Make a copy of a directory tree with symbolic links to all files in the
# original tree.
# All symbolic links go to a special symbolic link at the top, so you
# can easily fix things if the original source tree moves.
# See also "mkreal".
#
# usage: mklinks oldtree newtree
import... | apache-2.0 |
songfj/scrapy | scrapy/extensions/feedexport.py | 109 | 7559 | """
Feed Exports extension
See documentation in docs/topics/feed-exports.rst
"""
import os
import sys
import logging
import posixpath
from tempfile import TemporaryFile
from datetime import datetime
from six.moves.urllib.parse import urlparse
from ftplib import FTP
from zope.interface import Interface, implementer
f... | bsd-3-clause |
tanium/pytan | BUILD/doc/source/examples/create_package_code.py | 1 | 4051 | # import the basic python packages we need
import os
import sys
import tempfile
import pprint
import traceback
# disable python from generating a .pyc file
sys.dont_write_bytecode = True
# change me to the path of pytan if this script is not running from EXAMPLES/PYTAN_API
pytan_loc = "~/gh/pytan"
pytan_static_path =... | mit |
fengalin/gstation-edit | gstation_edit/messages/utility_settings_resp.py | 1 | 2960 | """
gstation-edit UtilitySettingsResponse definition
"""
# this file is part of gstation-edit
# Copyright (C) F LAIGNEL 2009-2017 <fengalin@free.fr>
#
# gstation-edit 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 Found... | lgpl-3.0 |
aduric/crossfit | nonrel/django/forms/fields.py | 103 | 38484 | """
Field classes.
"""
import datetime
import os
import re
import time
import urlparse
import warnings
from decimal import Decimal, DecimalException
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
from django.core.exceptions import ValidationError
from django.core import ... | bsd-3-clause |
marty331/jakesclock | flask/lib/python2.7/site-packages/sqlalchemy/dialects/mssql/pymssql.py | 48 | 3019 | # mssql/pymssql.py
# Copyright (C) 2005-2015 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""
.. dialect:: mssql+pymssql
:name: pymssql
:dbapi: pymssql
:connects... | gpl-2.0 |
matterker/csvkit | csvkit/convert/__init__.py | 17 | 2264 | #!/usr/bin/env python
import six
from csvkit.convert.csvitself import csv2csv
from csvkit.convert.fixed import fixed2csv
from csvkit.convert.geojs import geojson2csv
from csvkit.convert.js import json2csv
from csvkit.convert.ndjs import ndjson2csv
from csvkit.convert.xls import xls2csv
from csvkit.convert.xlsx import... | mit |
jorgebastida/gordon | tests/kinesisstream/tests.py | 1 | 1149 | import os
from gordon.utils_tests import BaseIntegrationTest, BaseBuildTest
from gordon.utils import valid_cloudformation_name
from gordon import utils
class IntegrationTest(BaseIntegrationTest):
def setUp(self):
self.stream = self.create_kinesis_stream()
self.extra_env['KINESIS_INTEGRATION'] = ... | bsd-3-clause |
lootr/netzob | netzob/src/netzob/Common/CommandLine.py | 2 | 4169 | # -*- coding: utf-8 -*-
# +---------------------------------------------------------------------------+
# | 01001110 01100101 01110100 01111010 01101111 01100010 |
# | |
# | Netzob : Inferring communication prot... | gpl-3.0 |
mstriemer/zamboni | mkt/developers/views_payments.py | 4 | 19817 | import functools
import json
import urllib
from django import http
from django.conf import settings
from django.contrib import messages
from django.core.urlresolvers import reverse
from django.shortcuts import get_object_or_404, redirect, render
from django.views.decorators.http import require_POST
import commonware
... | bsd-3-clause |
jreback/pandas | pandas/tests/arrays/boolean/test_arithmetic.py | 6 | 3586 | import operator
import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
from pandas.arrays import FloatingArray
@pytest.fixture
def data():
return pd.array(
[True, False] * 4 + [np.nan] + [True, False] * 44 + [np.nan] + [True, False],
dtype="boolean",
)
@pytest.fi... | bsd-3-clause |
zubair-arbi/edx-platform | common/djangoapps/performance/tests/test_logs.py | 110 | 6444 | """Tests that performance data is successfully logged."""
import datetime
import dateutil
import json
import logging
from StringIO import StringIO
from django.test import TestCase
from django.test.client import RequestFactory
from performance.views import performance_log
class PerformanceTrackingTest(TestCase):
... | agpl-3.0 |
Princu7/open-event-orga-server | app/views/users/settings.py | 4 | 4570 | import unicodedata
from flask import Blueprint, render_template
from flask import request, url_for, redirect, jsonify, flash
from flask.ext import login
from flask.ext.scrypt import generate_password_hash, generate_random_salt
from app.helpers.data import DataManager, save_to_db
from app.helpers.data_getter import Da... | gpl-3.0 |
0x90sled/catapult | third_party/gsutil/third_party/boto/boto/s3/multidelete.py | 244 | 4757 | # Copyright (c) 2011 Mitch Garnaat http://garnaat.org/
#
# 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, m... | bsd-3-clause |
fernandolopez/xremotebot | tests/user_test.py | 1 | 2114 | import unittest
from datetime import datetime, timedelta
from xremotebot.models.user import User, UsernameAlreadyTaken
from .test_helper import db
from xremotebot.lib import db as prod_db
import xremotebot.models.user
class UserTest(unittest.TestCase):
def setUp(self):
(engine, self.session) = db()
... | mit |
cpaulik/scipy | scipy/weave/swig2_spec.py | 98 | 14256 | """
This module allows one to use SWIG2 (SWIG version >= 1.3) wrapped
objects from Weave. SWIG-1.3 wraps objects differently from SWIG-1.1.
This module is a template for a SWIG2 wrapped converter. To wrap any
special code that uses SWIG the user simply needs to override the
defaults in the swig2_converter class. Th... | bsd-3-clause |
tboyce021/home-assistant | homeassistant/components/onboarding/views.py | 7 | 6996 | """Onboarding views."""
import asyncio
import voluptuous as vol
from homeassistant.auth.const import GROUP_ID_ADMIN
from homeassistant.components.auth import indieauth
from homeassistant.components.http.data_validator import RequestDataValidator
from homeassistant.components.http.view import HomeAssistantView
from ho... | apache-2.0 |
jeamland/wsproto | wsproto/connection.py | 1 | 16193 | # -*- coding: utf-8 -*-
"""
wsproto/connection
~~~~~~~~~~~~~~
An implementation of a WebSocket connection.
"""
import os
import base64
import hashlib
from collections import deque
from enum import Enum
import h11
from .events import (
ConnectionRequested, ConnectionEstablished, ConnectionClosed,
Connection... | mit |
debugger22/sympy | sympy/matrices/expressions/tests/test_indexing.py | 85 | 2177 | from sympy import (symbols, MatrixSymbol, MatPow, BlockMatrix,
Identity, ZeroMatrix, ImmutableMatrix, eye, Sum)
from sympy.utilities.pytest import raises
k, l, m, n = symbols('k l m n', integer=True)
i, j = symbols('i j', integer=True)
W = MatrixSymbol('W', k, l)
X = MatrixSymbol('X', l, m)
Y = MatrixSymbol('... | bsd-3-clause |
40223136/-2015cd_midterm | static/Brython3.1.1-20150328-091302/Lib/difflib.py | 737 | 82544 | #! /usr/bin/env python3
"""
Module difflib -- helpers for computing deltas between objects.
Function get_close_matches(word, possibilities, n=3, cutoff=0.6):
Use SequenceMatcher to return list of the best "good enough" matches.
Function context_diff(a, b):
For two lists of strings, return a delta in context ... | gpl-3.0 |
tiagochiavericosta/edx-platform | common/djangoapps/util/testing.py | 91 | 2951 | import sys
from mock import patch
from django.conf import settings
from django.core.urlresolvers import clear_url_caches, resolve
class UrlResetMixin(object):
"""Mixin to reset urls.py before and after a test
Django memoizes the function that reads the urls module (whatever module
urlconf names). The m... | agpl-3.0 |
gangadhar-kadam/church-erpnext | selling/doctype/sales_order/sales_order.py | 5 | 17285 | # ERPNext - web based ERP (http://erpnext.com)
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
#
# 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 3 of the License, or
# (at yo... | agpl-3.0 |
infobloxopen/infoblox-netmri | infoblox_netmri/api/broker/v2_10_0/spm_end_hosts_not_present_grid_broker.py | 14 | 6629 | from ..broker import Broker
class SpmEndHostsNotPresentGridBroker(Broker):
controller = "spm_end_hosts_not_present_grids"
def index(self, **kwargs):
"""Lists the available spm end hosts not present grids. Any of the inputs listed may be be used to narrow the list; other inputs will be ignored. Of the... | apache-2.0 |
jinnykoo/christmas | tests/unit/shipping/method_tests.py | 10 | 2641 | from decimal import Decimal as D
from django.test import TestCase
from nose.plugins.attrib import attr
import mock
from oscar.apps.shipping import methods
from oscar.apps.basket.models import Basket
@attr('shipping')
class TestFreeShipppingForEmptyBasket(TestCase):
def setUp(self):
self.method = method... | bsd-3-clause |
kaiyuanl/gem5 | ext/ply/test/yacc_prec1.py | 164 | 1556 | # -----------------------------------------------------------------------------
# yacc_prec1.py
#
# Tests case where precedence specifier doesn't match up to terminals
# -----------------------------------------------------------------------------
import sys
if ".." not in sys.path: sys.path.insert(0,"..")
import ply.... | bsd-3-clause |
xsynergy510x/android_external_chromium_org | mojo/tools/generate_java_callback_interfaces.py | 32 | 1702 | """Generate the org.chromium.mojo.bindings.Callbacks interface"""
import argparse
import sys
CALLBACK_TEMPLATE = ("""
/**
* A generic %d-argument callback.
*
* %s
*/
interface Callback%d<%s> {
/**
* Call the callback.
*/
public void call(%s);
}
"... | bsd-3-clause |
jenalgit/django | django/apps/registry.py | 111 | 15215 | import sys
import threading
import warnings
from collections import Counter, OrderedDict, defaultdict
from functools import partial
from django.core.exceptions import AppRegistryNotReady, ImproperlyConfigured
from django.utils import lru_cache
from .config import AppConfig
class Apps(object):
"""
A registry... | bsd-3-clause |
orgito/ansible | lib/ansible/modules/cloud/vmware/vmware_vm_vm_drs_rule.py | 55 | 12538 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2018, Abhijeet Kasurde <akasurde@redhat.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... | gpl-3.0 |
walterreade/scikit-learn | examples/linear_model/plot_lasso_coordinate_descent_path.py | 42 | 2944 | """
=====================
Lasso and Elastic Net
=====================
Lasso and elastic net (L1 and L2 penalisation) implemented using a
coordinate descent.
The coefficients can be forced to be positive.
"""
print(__doc__)
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# License: BSD 3 clause
from itert... | bsd-3-clause |
jeremiah-c-leary/vhdl-style-guide | vsg/token/configuration_declaration.py | 1 | 1744 |
from vsg import parser
class configuration_keyword(parser.keyword):
'''
unique_id = configuration_body : configuration_keyword
'''
def __init__(self, sString):
parser.keyword.__init__(self, sString)
class identifier(parser.identifier):
'''
unique_id = configuration_body : identifie... | gpl-3.0 |
reverie/jotleaf.com | jotleaf/marketing/views.py | 1 | 2641 | import json
import requests
from django.conf import settings
from django.contrib import messages
from common.views import json as json_view
from marketing.models import YwotTransfer
from django.contrib.auth import get_user_model
User = get_user_model()
YWOT_CHECK_URL = "http://{}/connect/check/".format(settings.Y... | mit |
PocketEngi/nyyhkyytteek | nyyhkyytteek/nyyhkyytteek/nyy.py | 1 | 2517 | #! /usr/bin/env python3
import tkinter as tk
from tkinter import messagebox
import requests
import bs4
def main():
def scrolldown(*args):
"""Emulate scrolling by deleting the first line of content."""
content.set('\n'.join(content.get().split('\n')[1:]))
def back(*args):
"""Retrieve t... | mit |
statgen/pheweb | pheweb/file_utils.py | 1 | 19673 |
from .utils import PheWebError, get_phenolist, chrom_order
from . import conf
from . import parse_utils
import io
import os
import csv
from contextlib import contextmanager
import json
import gzip
import datetime
from boltons.fileutils import AtomicSaver, mkdir_p
import pysam
import itertools, random
from pathlib imp... | agpl-3.0 |
karban/field | resources/python/logilab/common/decorators.py | 2 | 6416 | # copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of logilab-common.
#
# logilab-common is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as publ... | gpl-2.0 |
rhndg/openedx | common/lib/xmodule/xmodule/services.py | 163 | 2772 | """
Module contains various XModule/XBlock services
"""
from django.conf import settings
class SettingsService(object):
"""
Allows server-wide configuration of XBlocks on a per-type basis
XBlock settings are read from XBLOCK_SETTINGS settings key. Each XBlock is allowed access
to single settings buck... | agpl-3.0 |
log2timeline/plaso | tests/parsers/sqlite_plugins/chrome_history.py | 3 | 9090 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Tests for the Google Chrome History database plugin."""
import unittest
from plaso.lib import definitions
from plaso.parsers.sqlite_plugins import chrome_history
from tests.parsers.sqlite_plugins import test_lib
class GoogleChrome8HistoryPluginTest(test_lib.SQLiteP... | apache-2.0 |
yuhcaesar/emacsrc | .emacs.d/.python-environments/default/Lib/site.py | 306 | 27543 | """Append module search paths for third-party packages to sys.path.
****************************************************************
* This module is automatically imported during initialization. *
****************************************************************
In earlier versions of Python (up to 1.5a3), scripts or... | gpl-2.0 |
fangxingli/hue | desktop/core/ext-py/kazoo-2.0/kazoo/protocol/paths.py | 36 | 1344 | def normpath(path, trailing=False):
"""Normalize path, eliminating double slashes, etc."""
comps = path.split('/')
new_comps = []
for comp in comps:
if comp == '':
continue
if comp in ('.', '..'):
raise ValueError('relative paths not allowed')
new_comps.ap... | apache-2.0 |
fevangelista/psi4 | psi4/driver/procrouting/dft/dh_functionals.py | 7 | 18989 | #
# @BEGIN LICENSE
#
# Psi4: an open-source quantum chemistry software package
#
# Copyright (c) 2007-2021 The Psi4 Developers.
#
# The copyrights for code used from other parties are included in
# the corresponding files.
#
# This file is part of Psi4.
#
# Psi4 is free software; you can redistribute it and/or modify
#... | lgpl-3.0 |
laszlocsomor/tensorflow | tensorflow/contrib/lite/toco/python/toco_from_protos_test.py | 2 | 3849 | # 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 |
eendroroy/spikes | spikes/spike.py | 1 | 3009 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
if sys.version_info[0] == 3:
uchr = chr
elif sys.version_info[0] == 2:
uchr = unichr
class Spike(object):
__BAR_INDEX = 8
__BARS = [
' ',
uchr(9601),
uchr(9602),
uchr(9603),
uchr(9604),
uchr(960... | mit |
MrCubanfrog/NorDB | nordb/database/instrument2sql.py | 1 | 2379 | """
This module contains all functions and classes for reading a instrument file in `CSS3.0 format`_ and pushing it into the database
.. _CSS3.0 format: ftp://ftp.pmel.noaa.gov/newport/lau/tphase/data/css_wfdisc.pdf
Functions and Classes
---------------------
"""
import unidecode
from nordb.nordic.instrument import ... | mit |
anarcheuz/CTF | hacklu-2014/exploit/oreo/pwn.py | 1 | 2399 | import socket
from binascii import *
import struct
import time
import telnetlib
s=None
leak=None
arch=None
def init(host, port, archi='x86'):
global s
global arch
arch = archi
s = socket.create_connection((host,port))
return s
def init_leak(l):
global leak
leak = l
def q(a):
return ... | mit |
menegon/geonode | geonode/people/enumerations.py | 35 | 2025 | # -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2012 OpenPlans
#
# 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 versio... | gpl-3.0 |
CameronLonsdale/sec-tools | python2/lib/python2.7/site-packages/pip/vcs/subversion.py | 343 | 9350 | from __future__ import absolute_import
import logging
import os
import re
from pip._vendor.six.moves.urllib import parse as urllib_parse
from pip.index import Link
from pip.utils import rmtree, display_path
from pip.utils.logging import indent_log
from pip.vcs import vcs, VersionControl
_svn_xml_url_re = re.compile... | mit |
codingforentrepreneurs/ecommerce-2-api | src/carts/views.py | 1 | 14126 | import ast
import base64
import braintree
from django.conf import settings
from django.contrib import messages
from django.contrib.auth.forms import AuthenticationForm
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect, Http404, JsonResponse
from django.shortcuts import render, g... | mit |
8l/beri | cheritest/trunk/tests/branch/test_raw_jalr.py | 2 | 1991 | #-
# Copyright (c) 2011 Steven J. Murdoch
# All rights reserved.
#
# This software was developed by SRI International and the University of
# Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237
# ("CTSRD"), as part of the DARPA CRASH research programme.
#
# @BERI_LICENSE_HEADER_START@
#
# Licensed ... | apache-2.0 |
ticosax/django | tests/admin_changelist/tests.py | 12 | 34783 | from __future__ import unicode_literals
import datetime
from django.contrib import admin
from django.contrib.admin.models import LogEntry
from django.contrib.admin.options import IncorrectLookupParameters
from django.contrib.admin.templatetags.admin_list import pagination
from django.contrib.admin.tests import AdminS... | bsd-3-clause |
sv-dev1/odoo | addons/purchase/wizard/purchase_order_group.py | 376 | 3379 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | agpl-3.0 |
elventear/ansible | lib/ansible/modules/cloud/google/gce.py | 16 | 26956 | #!/usr/bin/python
# Copyright 2013 Google 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 vers... | gpl-3.0 |
tangentlabs/django-oscar-parachute | parachute/oscommerce/models.py | 1 | 33421 | # This is an auto-generated Django model module.
# You'll have to do the following manually to clean this up:
# * Rearrange models' order
# * Make sure each model has one field with primary_key=True
# Feel free to rename the models, but don't rename db_table values or field names.
#
# Also note: You'll have to ... | bsd-3-clause |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.