code stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 226 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k |
|---|---|---|---|---|---|
# Copyright 2013 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | wolverineav/neutron | neutron/agent/linux/ovsdb_monitor.py | Python | apache-2.0 | 4,444 |
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
import pkg... | megaserg/pants | src/python/pants/backend/python/tasks/python_eval.py | Python | apache-2.0 | 6,421 |
from __future__ import unicode_literals
from django_evolution.mutations import AddField
from django.db import models
MUTATIONS = [
AddField('HostingServiceAccount', 'hosting_url', models.CharField,
max_length=256, null=True)
]
| chipx86/reviewboard | reviewboard/hostingsvcs/evolutions/account_hosting_url.py | Python | mit | 247 |
# -*- coding: utf-8 -*-
# Copyright (c) 2010 Mark Sandstrom
# Copyright (c) 2011-2015 Raphaël Barrois
#
# 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 ... | jessekl/flixr | venv/lib/python2.7/site-packages/factory/helpers.py | Python | mit | 4,614 |
import logging
from autotest.client.shared import error
def run(test, params, env):
"""
QMP Specification test-suite: this checks if the *basic* protocol conforms
to its specification, which is file QMP/qmp-spec.txt in QEMU's source tree.
IMPORTANT NOTES:
o Most tests depend heavily on QMP'... | PyLearner/tp-qemu | qemu/tests/qmp_basic_rhel6.py | Python | gpl-2.0 | 14,327 |
# ale_python_interface.py
# Author: Ben Goodrich
# This directly implements a python version of the arcade learning
# environment interface.
from ctypes import *
import numpy as np
from numpy.ctypeslib import as_ctypes
import os
ale_lib = cdll.LoadLibrary(os.path.join(os.path.dirname(__file__),
... | CyCraig/AtariRL | ale_python_interface/ale_python_interface.py | Python | gpl-2.0 | 10,369 |
#!/usr/bin/env python
# ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are ... | shrimpboyho/herblore | pyglet-1.1.4/examples/programming_guide/events.py | Python | gpl-2.0 | 2,441 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2016, 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
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | Jorge-Rodriguez/ansible | lib/ansible/modules/database/postgresql/postgresql_schema.py | Python | gpl-3.0 | 10,842 |
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document
class ProjectTemplateTask(Document):
pass
| Zlash65/erpnext | erpnext/projects/doctype/project_template_task/project_template_task.py | Python | gpl-3.0 | 287 |
# -*- encoding: utf-8 -*-
import model
| kailIII/emaresa | trunk.pe/account_asset_analytic/__init__.py | Python | agpl-3.0 | 39 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# Account Statement Operation multi-company module for Odoo
# Copyright (C) 2015 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
#
# This program is free so... | odoo-romania/extra | account_statement_operation_multicompany/__openerp__.py | Python | agpl-3.0 | 1,519 |
# 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... | tillahoffmann/tensorflow | tensorflow/contrib/distributions/python/ops/mixture.py | Python | apache-2.0 | 18,846 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import random
sys.path.append('.')
from twisted.internet import reactor
from twisted.python import log
from . import driver
from . import multiplexer
from . import record_layer
from . import updater
from . import dsl
from . import conf
EVENT_LOOP_FREQUENCY_S ... | flipchan/LayerProx | versions/offthewire_version/marionette_tg/client.py | Python | apache-2.0 | 3,635 |
# Copyright 2012 NEC Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | yanheven/horizon | openstack_dashboard/dashboards/project/networks/ports/views.py | Python | apache-2.0 | 4,904 |
from XDSM import XDSM
opt = 'Optimization'
dat = 'DataInter'
mda = 'MDA'
anl = 'Analysis'
x = XDSM()
#x.addComp('driver', mda, 'Solver')
x.addComp('assembly inputs', anl, 'assembly inputs')
x.addComp('compress', anl, 'compress')
x.addComp('mission', anl, 'mission')
x.addComp('pod', anl, 'pod')
x.addComp('flow_limit',... | whiplash01/Hyperloop | docs/xdsm/hyperloop_xdsm.py | Python | apache-2.0 | 1,244 |
#!/usr/bin/env python3
# Copyright 2017 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.
'''Unit test suite that collects template_writer tests.'''
import os
import sys
import unittest
class TestSuiteAll(unittest.TestSuit... | nwjs/chromium.src | components/policy/tools/template_writers/test_suite_all.py | Python | bsd-3-clause | 2,777 |
"""
Due to compatibility, numpy has a very large number of different naming
conventions for the scalar types (those subclassing from `numpy.generic`).
This file produces a convoluted set of dictionaries mapping names to types,
and sometimes other mappings too.
.. data:: allTypes
A dictionary of names to types that... | simongibbons/numpy | numpy/core/_type_aliases.py | Python | bsd-3-clause | 7,272 |
#!/usr/bin/python
import sys
sys.path.append('/homes/gws/aritter/twitter_nlp/python')
from twokenize import tokenize
from LdaFeatures import LdaFeatures
from Vocab import Vocab
from Dictionaries import Dictionaries
entityDocs = {}
prevText = None
for line in sys.stdin:
line = line.rstrip('\n')
fields = lin... | adarshlx/twitter_nlp | hbc/python/tweets2entityDocs.py | Python | gpl-3.0 | 2,087 |
########################################################################
#
# File Name: HTMLDListElement
#
#
### This file is automatically generated by GenerateHtml.py.
### DO NOT EDIT!
"""
WWW: http://4suite.com/4DOM e-mail: support@4suite.com
Copyright (c) 2000 Fourthought Inc, USA. All Right... | alanjw/GreenOpenERP-Win-X86 | python/Lib/site-packages/_xmlplus/dom/html/HTMLDListElement.py | Python | agpl-3.0 | 1,396 |
################################################################################
# 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... | wwjiang007/flink | flink-python/pyflink/fn_execution/table/state_data_view.py | Python | apache-2.0 | 10,571 |
#!/usr/bin/env python
#
# 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
# "L... | johnbelamaric/themis | vendor/github.com/apache/thrift/test/py.tornado/test_suite.py | Python | apache-2.0 | 6,403 |
# project
from tests.checks.common import AgentCheckTest
Win32_OperatingSystem_attr = {
'BootDevice': "\\Device\\HarddiskVolume1",
'BuildNumber': "9600",
'BuildType': "Multiprocessor Free",
'Caption': "Microsoft Windows Server 2012 R2 Standard Evaluation",
'CodeSet': "1252",
'CountryCode': "1"... | GabrielNicolasAvellaneda/dd-agent | tests/checks/mock/test_wmi_check.py | Python | bsd-3-clause | 6,955 |
# (c) 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) any lat... | s-hertel/ansible | lib/ansible/utils/display.py | Python | gpl-3.0 | 19,334 |
from otm1_migrator.migration_rules.standard_otm1 import MIGRATION_RULES
from treemap.models import ITreeCodeOverride, ITreeRegion, User
UDFS = {
'plot': {
'owner_additional_id': {
'udf.name': 'Owner Additional Id'
},
'owner_additional_properties': {
'udf.name': 'Own... | johnsonc/OTM2 | opentreemap/otm1_migrator/migration_rules/philadelphia.py | Python | gpl-3.0 | 3,768 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting field 'ThreadedComment.email_hash'
db.delete_column('generic_threadedcomment', 'email_hash')
... | orlenko/bccf | src/mezzanine/generic/migrations/0009_auto__del_field_threadedcomment_email_hash.py | Python | unlicense | 7,904 |
"""
Allows to configure a switch using the PiFace Digital I/O module on a RPi.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/switch.rpi_pfio/
"""
import logging
import voluptuous as vol
from homeassistant.components.switch import PLATFORM_SCHEMA
impor... | MungoRae/home-assistant | homeassistant/components/switch/rpi_pfio.py | Python | apache-2.0 | 2,515 |
# -*- coding: utf-8 -*-
#
# Copyright 2012-2015 Spotify AB
#
# 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... | laserson/luigi | test/import_test.py | Python | apache-2.0 | 1,296 |
# Copyright 2010 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 requ... | scripnichenko/nova | nova/tests/unit/api/openstack/test_common.py | Python | apache-2.0 | 26,175 |
# -*- mode: python; fill-column: 100; comment-column: 100; -*-
import unittest
import sys
import os
sys.path.append(
os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)))
import base_test
class ForwardTest(base_test.WebDriverBaseTest):
# Get a static page that must be the same upon refr... | qiuzhong/crosswalk-test-suite | misc/webdriver-w3c-tests/navigation/forward.py | Python | bsd-3-clause | 962 |
import string
import Printer
from xml.dom import XHTML_NAMESPACE
# Wrapper classes to convert nodes from HTML to XHTML
class XHtmlDocType:
def __init__(self, doctype):
self.name = 'html'
self.publicId = "-//W3C//DTD XHTML 1.0 Strict//EN"
self.systemId = "DTD/xhtml1-strict.dtd"
self... | alanjw/GreenOpenERP-Win-X86 | python/Lib/site-packages/_xmlplus/dom/ext/XHtmlPrinter.py | Python | agpl-3.0 | 1,634 |
# Copyright 2019 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... | sarvex/tensorflow | tensorflow/lite/micro/examples/person_detection/utils/raw_to_bitmap.py | Python | apache-2.0 | 5,452 |
# Copyright 2013 Cloudbase Solutions Srl
# 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 r... | afrolov1/nova | nova/virt/hyperv/vhdutilsv2.py | Python | apache-2.0 | 9,112 |
# Copyright 2011 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 requ... | Brocade-OpenSource/OpenStack-DNRM-Nova | nova/tests/scheduler/test_scheduler_options.py | Python | apache-2.0 | 5,241 |
"""
SleekXMPP: The Sleek XMPP Library
Copyright (C) 2011 Nathanael C. Fritz
This file is part of SleekXMPP.
See the file LICENSE for copying permission.
"""
from sleekxmpp.xmlstream import StanzaBase, ElementBase
class STARTTLS(ElementBase):
"""
"""
name = 'starttls'
namespace = '... | danielvdao/facebookMacBot | venv/lib/python2.7/site-packages/sleekxmpp/features/feature_starttls/stanza.py | Python | mit | 769 |
"""
modifier: Da-Rong Liu
Date: 2/01/2017
In this implementation, sentences of the same length are put into one bucket.
This helps to avoid doing padding.
Refenrence: https://github.com/ketranm/RMN/blob/master/text/TextProcessor.lua
"""
import collections
import os
import sys
import pickle
import numpy as np
from ra... | darongliu/Lstm_Turing_LM_tf | exp_model_composition/fix/lstm+attention_fix+pretrained+entropy/reader.py | Python | mit | 7,849 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2013, Romeo Theriault <romeot () hawaii.edu>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of th... | akirakoyasu/ansible-modules-core | network/basics/uri.py | Python | gpl-3.0 | 19,263 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"gui2py's CheckBox control (uses wx.CheckBox)"
__author__ = "Mariano Reingart (reingart@gmail.com)"
__copyright__ = "Copyright (C) 2013- Mariano Reingart" # where applicable
# Initial implementation was based on PythonCard's CehckBox component,
# but redesigned an... | google-code-export/gui2py | gui/controls/checkbox.py | Python | lgpl-3.0 | 1,619 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# ===--- test_compare_perf_tests.py --------------------------------------===//
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library... | jckarter/swift | benchmark/scripts/test_compare_perf_tests.py | Python | apache-2.0 | 46,859 |
# coding=utf-8
# Copyright 2022 The Tensor2Robot Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | google-research/tensor2robot | utils/__init__.py | Python | apache-2.0 | 605 |
# -*- coding: utf-8 -*-
"""
celery.task
~~~~~~~~~~~
Creating tasks, subtasks, sets and chords.
:copyright: (c) 2009 - 2012 by Ask Solem.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
from ..app import app_or_default, current_task as _current_task
from ..... | chirilo/mozillians | vendor-local/lib/python/celery/task/__init__.py | Python | bsd-3-clause | 2,664 |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | nburn42/tensorflow | tensorflow/contrib/optimizer_v2/adadelta_test.py | Python | apache-2.0 | 6,887 |
# Copyright 2019 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... | ghchinoy/tensorflow | tensorflow/python/saved_model/model_utils/mode_keys_test.py | Python | apache-2.0 | 2,347 |
################################################################
### functions specific to text line processing
### (text line segmentation is in lineseg)
################################################################
from scipy import stats
from scipy.ndimage import interpolation,morphology,filters
from pylab impor... | stweil/ocropy | OLD/lineproc.py | Python | apache-2.0 | 6,891 |
from TCAction import TCActionBase
from NativeLog import NativeLog
import time
import random
import string
TEST_COUNT_ONE_ROUND = 500
class TestCase(TCActionBase.CommonTCActionBase):
def __init__(self, test_case, test_env, timeout=45, log_path=TCActionBase.LOG_PATH):
TCActionBase.CommonTCActionBase.__init... | dschaefer/esp-idf | components/idf_test/integration_test/TestCaseScript/TCPStress/TCPMultiSTASendRecv.py | Python | apache-2.0 | 7,518 |
import functools
import sys
import unittest
import platform
HOST = "127.0.0.1"
def requires_mac_ver(*min_version):
"""Decorator raising SkipTest if the OS is Mac OS X and the OS X
version if less than min_version.
For example, @requires_mac_ver(10, 5) raises SkipTest if the OS X version
is lesser th... | elelianghh/gunicorn | tests/support.py | Python | mit | 1,597 |
#!python
# Copyright 2012 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 required by applicable... | wangming28/syzygy | syzygy/scripts/test_bot/PRESUBMIT.py | Python | apache-2.0 | 1,582 |
#!/usr/bin/env python3
# Copyright (c) 2015-2021 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 behavior of -maxuploadtarget.
* Verify that getdata requests for old blocks (>1week) are dropped
... | pataquets/namecoin-core | test/functional/feature_maxuploadtarget.py | Python | mit | 6,579 |
# 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... | akashlevy/Lyff | lyff_lambda/boto/gs/bucket.py | Python | mit | 42,702 |
# This is an auto-generated file. Do not edit it.
from twisted.python import versions
version = versions.Version('twisted.lore', 11, 0, 0)
| mzdaniel/oh-mainline | vendor/packages/twisted/twisted/lore/_version.py | Python | agpl-3.0 | 139 |
#!/usr/bin/env python3
# Copyright (C) 2016 Kaspar Schleiser <kaspar@schleiser.de>
# Copyright (C) 2016 Takuo Yonezawa <Yonezawa-T2@mail.dnp.co.jp>
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
... | BytesGalore/RIOT | tests/pkg_tinycbor/tests/01-run.py | Python | lgpl-2.1 | 474 |
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Runs an exe through Valgrind and puts the intermediate files in a
directory.
"""
import datetime
import glob
import logging
import optparse
import os... | 7kbird/chrome | tools/valgrind/valgrind_test.py | Python | bsd-3-clause | 45,890 |
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Vispy Development Team.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
import vispy.plot as vp
from vispy.testing import (assert_raises, requires_application,
run_tests_if_main)
@requires_application()
def test_figure... | ghisvail/vispy | vispy/plot/tests/test_plot.py | Python | bsd-3-clause | 624 |
#! /usr/bin/env python
# $Id: test_paragraphs.py 4564 2006-05-21 20:44:42Z wiemann $
# Author: David Goodger <goodger@python.org>
# Copyright: This module has been placed in the public domain.
"""
Tests for states.py.
"""
from __init__ import DocutilsTestSupport
def suite():
s = DocutilsTestSupport.ParserTestSu... | openhatch/oh-mainline | vendor/packages/docutils/test/test_parsers/test_rst/test_paragraphs.py | Python | agpl-3.0 | 1,329 |
import urllib.parse
from wptserve.utils import isomorphic_encode
def main(request, response):
"""Handler that causes multiple redirections. Redirect chain is as follows:
1. Initial URL containing multi-redirect.py
2. Redirect to cross-origin URL
3. Redirect to same-origin URL
4. Fin... | scheib/chromium | third_party/blink/web_tests/external/wpt/resource-timing/resources/multi_redirect.py | Python | bsd-3-clause | 2,682 |
#!/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... | melice/akiraguru | mapreduce/quota.py | Python | bsd-3-clause | 5,154 |
from __future__ import print_function
import numpy as np
import itertools
from numpy.testing import (assert_equal,
assert_almost_equal,
assert_array_equal,
assert_array_almost_equal)
from pytest import raises as assert_raises
from scipy.sp... | mbayon/TFG-MachineLearning | venv/lib/python3.6/site-packages/scipy/spatial/tests/test_spherical_voronoi.py | Python | mit | 6,854 |
# 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 l... | dims/glance | glance/version.py | Python | apache-2.0 | 686 |
from django.core.exceptions import ImproperlyConfigured
from django.template import engines
from django.test import SimpleTestCase, override_settings
class TemplateStringsTests(SimpleTestCase):
@override_settings(TEMPLATES=[{
'BACKEND': 'raise.import.error',
}])
def test_backend_import_error(self... | willharris/django | tests/template_backends/test_utils.py | Python | bsd-3-clause | 1,198 |
# -*- coding: utf-8 -*-
"""
pygments.styles.paraiso_light
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Paraíso (Light) by Jan T. Sott
Pygments template by Jan T. Sott (https://github.com/idleberg)
Created with Base16 Builder by Chris Kempson
(https://github.com/chriskempson/base16-builder).
:copyright: ... | wandb/client | wandb/vendor/pygments/styles/paraiso_light.py | Python | mit | 5,645 |
import os
import tempfile
import unittest
import stat
# from unittest.mock import patch
from mackup import utils
def convert_to_octal(file_name):
"""
Using os.stat, returns file permissions (read, write, execute) as an octal.
"""
return oct(os.stat(file_name)[stat.ST_MODE])[-3:]
class TestMackup(u... | theone4ever/mackup | tests/utils_test.py | Python | gpl-3.0 | 11,764 |
"""
Fixture to configure XQueue response.
"""
import requests
import json
from common.test.acceptance.fixtures import XQUEUE_STUB_URL
class XQueueResponseFixtureError(Exception):
"""
Error occurred while configuring the stub XQueue.
"""
pass
class XQueueResponseFixture(object):
"""
Configu... | louyihua/edx-platform | common/test/acceptance/fixtures/xqueue.py | Python | agpl-3.0 | 1,433 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017 F5 Networks Inc.
# 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 os
import json
import sys
import pytest
from nose.plugins.skip imp... | rahushen/ansible | test/units/modules/network/f5/test_bigip_monitor_tcp_echo.py | Python | gpl-3.0 | 10,010 |
"""Ensure credentials are preserved through the authorization.
The Authorization Code Grant will need to preserve state as well as redirect
uri and the Implicit Grant will need to preserve state.
"""
from __future__ import absolute_import, unicode_literals
import json
import mock
from .test_utils import get_query_cre... | nirmeshk/oh-mainline | vendor/packages/oauthlib/tests/oauth2/rfc6749/endpoints/test_credentials_preservation.py | Python | agpl-3.0 | 4,860 |
#
# (c) 2015, Peter Sprygada <psprygada@ansible.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any late... | jordiclariana/ansible | lib/ansible/utils/module_docs_fragments/iosxr.py | Python | gpl-3.0 | 2,875 |
from django.http import HttpResponseRedirect
from django.utils.encoding import smart_str
def serve_file(request, file, **kwargs):
"""Serves files by redirecting to file.url (e.g., useful for Amazon S3)"""
return HttpResponseRedirect(smart_str(file.url))
def public_download_url(file, **kwargs):
"""Directs ... | GDGLima/contentbox | third_party/filetransfers/backends/url.py | Python | apache-2.0 | 405 |
#!/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... | vmanoria/bluemix-hue-filebrowser | hue-3.8.1-bluemix/desktop/libs/hadoop/src/hadoop/yarn/tests.py | Python | gpl-2.0 | 1,708 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
cookiecutter.find
-----------------
Functions for finding Cookiecutter templates and other components.
"""
import logging
import os
from .exceptions import NonTemplatedInputDirException
def find_template(repo_dir):
"""
Determines which child directory of `... | GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/cookiecutter/find.py | Python | agpl-3.0 | 1,092 |
"""Simple tools for timing functions' execution, when IPython is not available. """
from __future__ import print_function, division
import timeit
import math
from sympy.core.compatibility import range
_scales = [1e0, 1e3, 1e6, 1e9]
_units = [u's', u'ms', u'\N{GREEK SMALL LETTER MU}s', u'ns']
def timed(func, setup... | wxgeo/geophar | wxgeometrie/sympy/utilities/timeutils.py | Python | gpl-2.0 | 2,063 |
# -*- 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... | rosenvladimirov/odoo | anglo_saxon_dropshipping/__init__.py | Python | agpl-3.0 | 1,071 |
"""
============================================================
Parameter estimation using grid search with cross-validation
============================================================
This examples shows how a classifier is optimized by cross-validation,
which is done using the :class:`sklearn.model_selection.GridS... | RPGOne/Skynet | scikit-learn-0.18.1/examples/model_selection/grid_search_digits.py | Python | bsd-3-clause | 2,764 |
# NeoPixel driver for MicroPython on ESP8266
# MIT license; Copyright (c) 2016 Damien P. George
from esp import neopixel_write
class NeoPixel:
ORDER = (1, 0, 2, 3)
def __init__(self, pin, n, bpp=3):
self.pin = pin
self.n = n
self.bpp = bpp
self.buf = bytearray(n * bpp)
... | swegener/micropython | ports/esp8266/modules/neopixel.py | Python | mit | 836 |
#===- disassembler.py - Python LLVM Bindings -----------------*- python -*--===#
#
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
#===---------------------------------... | endlessm/chromium-browser | third_party/llvm/llvm/bindings/python/llvm/disassembler.py | Python | bsd-3-clause | 5,918 |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | maropu/spark | python/pyspark/sql/pandas/__init__.py | Python | apache-2.0 | 959 |
"""
This module implements a transaction manager that can be used to define
transaction handling in a request or view function. It is used by transaction
control middleware and decorators.
The transaction manager can be in managed or in auto state. Auto state means the
system is using a commit-on-save strategy (actual... | ychen820/microblog | y/google-cloud-sdk/platform/google_appengine/lib/django-1.4/django/db/transaction.py | Python | bsd-3-clause | 10,043 |
# (c) Fastly, inc 2016
# (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 = """
callback: selective
callback_type: stdout
requirements:... | alxgu/ansible | lib/ansible/plugins/callback/selective.py | Python | gpl-3.0 | 10,438 |
#coding: utf-8
import unittest
import bottle
from bottle import tob, touni
class TestSecureCookies(unittest.TestCase):
def setUp(self):
self.data = dict(a=5, b=touni('υηι¢σ∂є'), c=[1,2,3,4,tob('bytestring')])
self.key = tob('secret')
def testDeEncode(self):
cookie = bottle.cookie_enco... | Eddy0402/Environment | vim/ycmd/third_party/bottle/test/test_securecookies.py | Python | gpl-3.0 | 2,109 |
#
# The Python Imaging Library.
# $Id$
#
# TGA file handling
#
# History:
# 95-09-01 fl created (reads 24-bit files only)
# 97-01-04 fl support more TGA versions, including compressed images
# 98-07-04 fl fixed orientation and alpha layer bugs
# 98-09-11 fl fixed orientation for runlength decoder
#
# Copyright ... | Microvellum/Fluid-Designer | win64-vc/2.78/Python/lib/site-packages/PIL/TgaImagePlugin.py | Python | gpl-3.0 | 4,991 |
import uuid
from nose.tools import eq_
from kazoo.testing import KazooTestCase
class KazooCounterTests(KazooTestCase):
def _makeOne(self, **kw):
path = "/" + uuid.uuid4().hex
return self.client.Counter(path, **kw)
def test_int_counter(self):
counter = self._makeOne()
eq_(co... | johankaito/fufuka | microblog/venv/lib/python2.7/site-packages/kazoo/tests/test_counter.py | Python | apache-2.0 | 883 |
from django.test import TestCase
from django.db import models, DEFAULT_DB_ALIAS
from django.db.models import signals
from django.core import management
from django.core.exceptions import FieldError
from django.contrib.contenttypes.models import ContentType
from models import MyPerson, Person, StatusPerson, LowerStatu... | mzdaniel/oh-mainline | vendor/packages/Django/tests/modeltests/proxy_models/tests.py | Python | agpl-3.0 | 11,673 |
"""Extended file operations available in POSIX.
f = posixfile.open(filename, [mode, [bufsize]])
will create a new posixfile object
f = posixfile.fileopen(fileobject)
will create a posixfile object from a builtin file object
f.file()
will return the original builtin file object
f.dup()
will r... | huran2014/huran.github.io | wot_gateway/usr/lib/python2.7/posixfile.py | Python | gpl-2.0 | 8,003 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import base64
from .common import InfoExtractor
from ..compat import compat_urllib_parse_unquote
from ..utils import (
ExtractorError,
parse_iso8601,
parse_duration,
)
class XuiteIE(InfoExtractor):
IE_DESC = '隨意窩Xuite影音'
_REGEX_BASE... | miminus/youtube-dl | youtube_dl/extractor/xuite.py | Python | unlicense | 5,378 |
#!/usr/bin/env python
# SPDX-License-Identifier: GPL-2.0
# exported-sql-viewer.py: view data from sql database
# Copyright (c) 2014-2018, Intel Corporation.
# To use this script you will need to have exported data using either the
# export-to-sqlite.py or the export-to-postgresql.py script. Refer to those
# scripts f... | Pingmin/linux | tools/perf/scripts/python/exported-sql-viewer.py | Python | gpl-2.0 | 159,347 |
# -*- coding: utf-8 -*-
# Copyright: (c) 2012, Dag Wieers <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
DOCUMENTATION = '''
callback: mail
type: notification
short_d... | vmindru/ansible | lib/ansible/plugins/callback/mail.py | Python | gpl-3.0 | 8,479 |
from django.db.models import CharField, Value as V
from django.db.models.functions import Coalesce, Length, Upper
from django.test import TestCase
from django.test.utils import register_lookup
from .models import Author
class UpperBilateral(Upper):
bilateral = True
class FunctionTests(TestCase):
def test_... | nesdis/djongo | tests/django_tests/tests/v22/tests/db_functions/tests.py | Python | agpl-3.0 | 2,439 |
# encoding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
int_or_none,
parse_duration,
)
class KontrTubeIE(InfoExtractor):
IE_NAME = 'kontrtube'
IE_DESC = 'KontrTube.ru - Труба зовёт'
_VALID_URL = r'http://(?:www\.)?kontrtube\.ru/... | Buggaarde/youtube-dl | youtube_dl/extractor/kontrtube.py | Python | unlicense | 2,732 |
#!/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... | garyjyao1/ansible | lib/ansible/modules/core/files/stat.py | Python | gpl-3.0 | 13,076 |
import os
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.core.files.storage import default_storage, Storage, FileSystemStorage
from django.utils.datastructures import SortedDict
from django.utils.functional import memoize, LazyObject
from django.utils.importlib impo... | ychen820/microblog | y/google-cloud-sdk/platform/google_appengine/lib/django-1.3/django/contrib/staticfiles/finders.py | Python | bsd-3-clause | 9,183 |
# 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... | hyokun31/wisekb-management-platform | wisekb-uima-ducc/cassandra-server/pylib/cqlshlib/__init__.py | Python | apache-2.0 | 784 |
from core import start, register_plugin, set_bounds, add_initialization_hook
| JBonsink/GSOC-2013 | tools/ns-allinone-3.14.1/ns-3.14.1/src/visualizer/visualizer/__init__.py | Python | gpl-3.0 | 79 |
#!/usr/bin/env python3
# Goshu IRC Bot
# written by Daniel Oaks <daniel@danieloaks.net>
# licensed under the ISC license
from gbot.modules import Module
from gbot.libs.helper import split_num
class commands(Module):
"""Provides general IRC commands such as msg, me, join, part."""
core = True
# irc
d... | DanielOaks/goshu | modules/commands.py | Python | isc | 1,851 |
# -*- coding: utf-8 -*-
#
# script.py
# colorific
#
import sys
import optparse
from colorific import config
from colorific.palette import (
extract_colors, print_colors, save_palette_as_image, color_stream_mt,
color_stream_st)
class Application(object):
def __init__(self):
self.parser = self.c... | 99designs/colorific | colorific/script.py | Python | isc | 4,123 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import pip
from pip.req import parse_requirements
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
with open('README.rst') as readme_file:
readme = readme_file.read()
with open('HISTORY.rst') as history_file:
hist... | kgogineni/gigon | setup.py | Python | isc | 1,914 |
import cxmate
import logging
import seaborn as sns
from Adapter import IgraphAdapter
from handlers import CommunityDetectionHandlers
logging.basicConfig(level=logging.DEBUG)
# Label for CXmate output
OUTPUT_LABEL = 'out_net'
# Community detection algorithm name
ALGORITHM_TYPE = 'type'
# Palette name
PALETTE_NAME =... | idekerlab/graph-services | services/ig_community/service/test/myservice.py | Python | mit | 1,621 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tully.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the
... | evonove/urt-tully | django-tully/manage.py | Python | mit | 803 |
import pytest
from ..context import dnsimple, fixture_path
from ..request_helper import RequestHelper, request
from dnsimple.client import Client
class TestClient(RequestHelper, object):
def test_constructor_raises_errors_when_improperly_configured(self):
with pytest.raises(dnsimple.credentials.... | vigetlabs/dnsimple | tests/unit/test_client.py | Python | mit | 3,371 |
"""
Extensions to mitmproxy master.
"""
import multiprocessing
from seproxer import mitmproxy_extensions
import seproxer.mitmproxy_extensions.addons # NOQA
import seproxer.mitmproxy_extensions.options
import mitmproxy.addons
import mitmproxy.proxy.server
import mitmproxy.master
class ProxyMaster(mitmproxy.master.M... | Rastii/seproxer | seproxer/mitmproxy_extensions/master.py | Python | mit | 3,377 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('hack_plot', '0009_auto_20150703_2236'),
]
operations = [
migrations.CreateModel(
name='SshHackLocation',
... | hellsgate1001/graphs | hack_plot/migrations/0010_auto_20150705_2020.py | Python | mit | 1,309 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from runner.koan import *
class AboutClasses(Koan):
class Dog:
"Dogs need regular walkies. Never, ever let them drive."
def test_instances_of_classes_can_be_created_adding_parentheses(self):
# NOTE: The .__name__ attribute will convert the class
... | sourabhv/python-koans-solutions | python3/koans/about_classes.py | Python | mit | 4,953 |
import numpy
from cupy._core._scalar import get_typename
# Base class for cuda types.
class TypeBase:
def __str__(self):
raise NotImplementedError
def declvar(self, x):
return f'{self} {x}'
class Void(TypeBase):
def __init__(self):
pass
def __str__(self):
return '... | cupy/cupy | cupyx/jit/_cuda_types.py | Python | mit | 3,661 |
from django.urls import path
from django.http import HttpResponse
from jinja2 import Template as Jinja2_Template
from jinja2 import Environment, DictLoader, escape
def a(request):
# Load the template
template = request.GET['template']
env = SandboxedEnvironment(undefined=StrictUndefined)
t = env.from_... | github/codeql | python/ql/src/experimental/Security/CWE-074/JinjaGood.py | Python | mit | 523 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.