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 |
|---|---|---|---|---|---|
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2012 OpenStack, LLC
#
# 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.... | tylertian/Openstack | openstack F/cinder/cinder/api/sizelimit.py | Python | apache-2.0 | 1,789 |
# 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... | mlperf/training_results_v0.5 | v0.5.0/google/cloud_v3.8/ssd-tpuv3-8/code/ssd/model/tpu/models/official/squeezenet/squeezenet_main.py | Python | apache-2.0 | 4,590 |
"""
@package mi.dataset.parser.test
@file mi/dataset/parser/test/test_nutnr_m_glider.py
@author Emily Hahn
@brief A test parser for the nutnr series m instrument through a glider
"""
import os
from nose.plugins.attrib import attr
from mi.core.exceptions import SampleException, ConfigurationException, DatasetParserExce... | oceanobservatories/mi-instrument | mi/dataset/parser/test/test_nutnr_m_glider.py | Python | bsd-2-clause | 7,448 |
from __future__ import print_function, division
from sympy.core import Basic
from sympy.core.compatibility import xrange
import random
class GrayCode(Basic):
"""
A Gray code is essentially a Hamiltonian walk on
a n-dimensional cube with edge length of one.
The vertices of the cube are represented by... | hrashk/sympy | sympy/combinatorics/graycode.py | Python | bsd-3-clause | 11,202 |
'''
(c) 2011, 2012 Georgia Tech Research Corporation
This source code is released under the New BSD license. Please see
http://wiki.quantsoftware.org/index.php?title=QSTK_License
for license details.
Created on Jan 1, 2011
@author:Drew Bratcher
@contact: dbratcher@gatech.edu
@summary: Contains tutorial for backteste... | wogsland/QSTK | build/lib.linux-x86_64-2.7/QSTK/qstkutil/qsdateutil.py | Python | bsd-3-clause | 9,008 |
# -*- coding: utf-8 -*-
# <nbformat>3.0</nbformat>
# <headingcell level=2>
# Usage of IC 7443
# <codecell>
from __future__ import print_function
from BinPy import *
# <codecell>
# Usage of IC 7443:
ic = IC_7443()
print(ic.__doc__)
# <codecell>
# The Pin configuration is:
inp = {8: 0, 12: 0, 13: 1, 14: 0, 15:... | daj0ker/BinPy | BinPy/examples/source/ic/Series_7400/IC7443.py | Python | bsd-3-clause | 1,225 |
"""
The DoInterestManager keeps track of which parent/zones that we currently
have interest in. When you want to "look" into a zone you add an interest
to that zone. When you want to get rid of, or ignore, the objects in that
zone, remove interest in that zone.
p.s. A great deal of this code is just code moved from ... | chandler14362/panda3d | direct/src/distributed/DoInterestManager.py | Python | bsd-3-clause | 29,162 |
"""
Extra HTML Widget classes
"""
import datetime
import re
from django.newforms.widgets import Widget, Select
from django.utils.dates import MONTHS
from django.utils.safestring import mark_safe
__all__ = ('SelectDateWidget',)
RE_DATE = re.compile(r'(\d{4})-(\d\d?)-(\d\d?)$')
class SelectDateWidget(Widget):
""... | paulsmith/geodjango | django/newforms/extras/widgets.py | Python | bsd-3-clause | 2,692 |
from __future__ import absolute_import, division, print_function
import os
from time import ctime
from qtpy import QtWidgets
from glue import core
from glue.utils.qt import load_ui
class MessageWidget(QtWidgets.QWidget, core.hub.HubListener):
""" This simple class displays all messages broadcast
by a hub. I... | stscieisenhamer/glue | glue/core/qt/message_widget.py | Python | bsd-3-clause | 1,541 |
#!/usr/bin/env python
######################################################################
# Software License Agreement (BSD License)
#
# Copyright (c) 2010, Rice University
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that t... | davetcoleman/ompl | demos/RigidBodyPlanningWithODESolverAndControls.py | Python | bsd-3-clause | 4,218 |
"""This file exists for backwards compatability.
Please use the separate backends found in either `djangae.contrib.gauth.datastore.backends` or
`djangae.contrib.gauth.sql.backends`.
"""
import warnings
from djangae.contrib.gauth.datastore.backends import AppEngineUserAPIBackend
warnings.warn(
'AppEngineUserAPI is... | Ali-aqrabawi/ezclinic | lib/djangae/contrib/gauth/backends.py | Python | mit | 482 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django import forms
from django.template import Context
from django.utils.translation import ugettext as _
from django.utils.translation import activate, deactivate
from .compatibility import get_template_from_string
from .conftest import only_boot... | samabhi/pstHealth | venv/lib/python2.7/site-packages/crispy_forms/tests/test_layout_objects.py | Python | mit | 16,205 |
import asyncio
import discord
from discord.ext import commands
if not discord.opus.is_loaded():
# the 'opus' library here is opus.dll on windows
# or libopus.so on linux in the current directory
# you should replace this with the location the
# opus library is located in and with the proper filename.
... | Boy-314/winner-winner-bidget-sbinner | examples/playlist.py | Python | mit | 8,569 |
"""An NNTP client class based on:
- RFC 977: Network News Transfer Protocol
- RFC 2980: Common NNTP Extensions
- RFC 3977: Network News Transfer Protocol (version 2)
Example:
>>> from nntplib import NNTP
>>> s = NNTP('news')
>>> resp, count, first, last, name = s.group('comp.lang.python')
>>> print('Group', name, 'ha... | MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-3.5.0/Lib/nntplib.py | Python | mit | 43,081 |
#!/usr/bin/env python3
# Copyright (c) 2020-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.
import argparse
import io
import requests
import subprocess
import sys
DEFAULT_GLOBAL_FAUCET = 'https://... | jamesob/bitcoin | contrib/signet/getcoins.py | Python | mit | 6,271 |
#
# DBus interface for the interactive partitioning module
#
# Copyright (C) 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, or (at your option) any later version.... | jkonecny12/anaconda | pyanaconda/modules/storage/partitioning/interactive/interactive_interface.py | Python | gpl-2.0 | 1,424 |
from fail2ban.server.action import ActionBase
class TestAction(ActionBase):
def __init__(self, jail, name):
super(TestAction, self).__init__(jail, name)
def start(self):
raise Exception()
def stop(self):
raise Exception()
def ban(self):
raise Exception()
def un... | jakesyl/fail2ban | fail2ban/tests/files/action.d/action_errors.py | Python | gpl-2.0 | 378 |
### Copyright (C) 2005 Thomas M. Hinkle
### Copyright (C) 2009 Rolf Leggewie
###
### This library 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) an... | Lamecarlate/gourmet | gourmet/gtk_extras/timeEntry.py | Python | gpl-2.0 | 4,398 |
#!/usr/bin/python
import re
source_files = {}
comment_re = re.compile(r'\s+#\s+T:\s+(.+)\s*$')
def get_file(file):
if not file in source_files:
#~ print 'Extracting comments from', file
source_files[file] = open(file).readlines()
source_files[file].append('')
return source_files[file]
def extract_comment(f... | tmhorne/simplewiki | tools/extract_translator_comments.py | Python | gpl-2.0 | 1,702 |
from pele.concurrent import BasinhoppingWorker
from start_server import create_system, get_server_uri
def main():
system = create_system()
uri = get_server_uri()
worker = BasinhoppingWorker(uri, system=system)
worker.run(1000)
if __name__ == "__main__":
main()
| smcantab/pele | examples/parallel_pele/start_basinhopping_worker.py | Python | gpl-3.0 | 287 |
def propagate(la): # la: [list(int)]
print la, la # [str], [str]
propagate([1]) # []
propagate([2]) # []
| shedskin/shedskin | tests/28.py | Python | gpl-3.0 | 210 |
#!/usr/bin/env python
#
# Copyright 2011,2013 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
#
from gnuradio import gr, gr_unittest, vocoder, blocks
class test_g723_24_vocoder (gr_unittest.TestCase):
def setUp(self):
self.tb = gr.top_bl... | mrjacobagilbert/gnuradio | gr-vocoder/python/vocoder/qa_g723_24_vocoder.py | Python | gpl-3.0 | 858 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import print_function, unicode_literals
import frappe, random, erpnext
from frappe.desk import query_report
from erpnext.stock.stock_ledger import NegativeStockError
from erpn... | ovresko/erpnext | erpnext/demo/user/stock.py | Python | gpl-3.0 | 4,466 |
# 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/.
#
# Copyright (c) 2015 Etherios, Inc. All rights reserved.
# Etherios, Inc. is a Division of Digi International.
| brucetsao/python-devicecloud | devicecloud/test/unit/__init__.py | Python | mpl-2.0 | 312 |
# 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/.
# Common codegen classes.
from collections import defaultdict
from itertools import groupby
import operator
import os
... | srivassumit/servo | components/script/dom/bindings/codegen/CodegenRust.py | Python | mpl-2.0 | 284,993 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
def get_comma_split_names( name ):
split_name_list = [name]
if ',' in name:
split_name_list = name.split(",")
elif ';' in name:
split_name_list = name.split(";")
for i in range(0, len(split_name_list)):
split_name_lis... | openelisglobal/openelisglobal-sandbox | liquibase/OE2.7/CILNSPMassive/scripts/dictionary.py | Python | mpl-2.0 | 1,212 |
'''OpenGL extension OES.blend_subtract
This module customises the behaviour of the
OpenGL.raw.GLES1.OES.blend_subtract to provide a more
Python-friendly API
The official definition of this extension is available here:
http://www.opengl.org/registry/specs/OES/blend_subtract.txt
'''
from OpenGL import platform, const... | stack-of-tasks/rbdlpy | tutorial/lib/python2.7/site-packages/OpenGL/GLES1/OES/blend_subtract.py | Python | lgpl-3.0 | 768 |
#!/usr/bin/env python # pylint: disable=too-many-lines
# ___ ___ _ _ ___ ___ _ _____ ___ ___
# / __| __| \| | __| _ \ /_\_ _| __| \
# | (_ | _|| .` | _|| / / _ \| | | _|| |) |
# \___|___|_|\_|___|_|_\/_/_\_\_|_|___|___/_ _____
# | \ / _ \ | \| |/ _ \_ _| | __| \_ _|_ _|
# | |) | (_) ... | ivanhorvath/openshift-tools | ansible/roles/lib_openshift_3.2/library/oc_secret.py | Python | apache-2.0 | 37,290 |
# Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import torch
class GradMultiply(... | mlperf/training_results_v0.5 | v0.5.0/nvidia/submission/code/translation/pytorch/fairseq/modules/grad_multiply.py | Python | apache-2.0 | 550 |
# Copyright 2018 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... | tensorflow/tensorflow | tensorflow/python/ops/ragged/ragged_tensor_value.py | Python | apache-2.0 | 4,366 |
# Copyright (C) 2016 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
import os
import logging
logger = logging.getLogger(__name__)
def create_directory(path):
"""
Creates a directory if it doesn't already exist.
"""
# Check if path is a file_path or a dir_path. Di... | NejcZupec/ggrc-core | test/selenium/src/lib/file_ops.py | Python | apache-2.0 | 886 |
# Copyright (c) 2014 Freescale, 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 agreed to in wr... | samsu/neutron | tests/unit/ml2/drivers/freescale/test_mechanism_fslsdn.py | Python | apache-2.0 | 11,225 |
# Generated by Django 2.2.14 on 2020-07-09 10:37
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import olympia.amo.models
class Migration(migrations.Migration):
initial = True
dependencies = [
('versions', '0008_auto_20200625_1114'),
(... | bqbn/addons-server | src/olympia/promoted/migrations/0001_initial.py | Python | bsd-3-clause | 2,466 |
"""
Feature agglomeration. Base classes and functions for performing feature
agglomeration.
"""
# Author: V. Michel, A. Gramfort
# License: BSD 3 clause
import numpy as np
from ..base import TransformerMixin
from ..utils import array2d
###############################################################################
... | florian-f/sklearn | sklearn/cluster/_feature_agglomeration.py | Python | bsd-3-clause | 2,350 |
# -*- coding: utf-8 -*-
"""
Use nose
`$ pip install nose`
`$ nosetests`
"""
from hyde.generator import Generator
from hyde.site import Site
from fswrap import File
from pyquery import PyQuery
TEST_SITE = File(__file__).parent.parent.child_folder('_test')
class TestBlockdown(object):
def setUp(self):
TE... | hyde/hyde | tests/ext/test_blockdown.py | Python | mit | 1,332 |
"""
tcp_message Inline Script Hook API Demonstration
------------------------------------------------
* modifies packets containing "foo" to "bar"
* prints various details for each packet.
example cmdline invocation:
mitmdump -T --host --tcp ".*" -q -s examples/tcp_message.py
"""
from mitmproxy.utils import strutils
... | dwfreed/mitmproxy | examples/complex/tcp_message.py | Python | mit | 917 |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
from datetime import timedelta
import logging
from sqlalchemy import desc, func
from flexget import plugin
from flexget.event import event
from flexget.manager import Ses... | sean797/Flexget | flexget/plugins/estimators/est_release_series_internal_db.py | Python | mit | 2,707 |
from flask import Flask
from flask.ext.bootstrap import Bootstrap
from flask.ext.mail import Mail
from flask.ext.moment import Moment
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.login import LoginManager
from flask.ext.pagedown import PageDown
from config import config
bootstrap = Bootstrap()
mail = Mai... | fakdora/flaksy-upto-login | app/__init__.py | Python | mit | 1,012 |
# -*- coding: utf-8 -*-
# -------------------------------------------------------------------------------
# Name: sfp_XXX
# Purpose: Description of the plug-in.
#
# Author: Name and e-mail address
#
# Created: Date
# Copyright: (c) Name
# Licence: GPL
# ----------------------------... | LubyRuffy/spiderfoot | modules/sfp_template.py | Python | gpl-2.0 | 2,631 |
# Copyright (c) Mathias Kaerlev 2012.
# This file is part of pyspades.
# pyspades 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 versi... | NateShoffner/PySnip | feature_server/scheduler.py | Python | gpl-3.0 | 2,339 |
# A module to expose various thread/process/job related structures and
# methods from kernel32
#
# The MIT License
#
# Copyright (c) 2006 the Mozilla Foundation <http://www.mozilla.org>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentati... | mastizada/kuma | vendor/packages/ipython/IPython/frontend/process/winprocess.py | Python | mpl-2.0 | 9,831 |
# pylint: disable=missing-docstring
import logging
import numpy as np
from scipy import stats
from rest_framework.generics import GenericAPIView
from rest_framework.response import Response
from edxval.api import get_videos_for_course
from openedx.core.djangoapps.request_cache.middleware import request_cached
from ope... | gsehub/edx-platform | cms/djangoapps/contentstore/api/views/course_quality.py | Python | agpl-3.0 | 9,779 |
"""Mock helpers for Z-Wave component."""
from pydispatch import dispatcher
from tests.async_mock import MagicMock
def value_changed(value):
"""Fire a value changed."""
dispatcher.send(
MockNetwork.SIGNAL_VALUE_CHANGED,
value=value,
node=value.node,
network=value.node._network,... | sdague/home-assistant | tests/mock/zwave.py | Python | apache-2.0 | 6,380 |
# Copyright 2015 Mirantis, 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 agreed to in writing, s... | weiting-chen/manila | manila/db/migrations/alembic/versions/533646c7af38_remove_unused_attr_status.py | Python | apache-2.0 | 2,171 |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) 2015, Vispy Development Team. All Rights Reserved.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
# -------------------------------------------------------------------------... | kkuunnddaannkk/vispy | vispy/visuals/mesh.py | Python | bsd-3-clause | 12,882 |
# 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.
"""Class for storing Skia Gold comparison properties.
Examples:
* git revision being tested
* Whether the test is being run locally or on a bot
* What the co... | ric2b/Vivaldi-browser | chromium/build/skia_gold_common/skia_gold_properties.py | Python | bsd-3-clause | 4,742 |
''' Provides a command line application for Bokeh.
The following subcommands are available:
'''
from __future__ import absolute_import
def _build_docstring():
global __doc__
from . import subcommands
for cls in subcommands.all:
__doc__ += "%8s : %s\n" % (cls.name, cls.help)
_build_docstring()
d... | phobson/bokeh | bokeh/command/__init__.py | Python | bsd-3-clause | 340 |
from __future__ import unicode_literals
from django.utils.six.moves.urllib.parse import parse_qs, urlsplit
from reviewboard.hostingsvcs.utils.paginator import (APIPaginator,
InvalidPageError,
ProxyPaginator)
from... | KnowNo/reviewboard | reviewboard/hostingsvcs/utils/tests.py | Python | mit | 7,168 |
#!/usr/bin/env python
"""
C.11.3 Bibliography and Citation (p208)
"""
import plasTeX, codecs
from plasTeX.Base.LaTeX.Sectioning import chapter, section
from plasTeX import Command, Environment
from Lists import List
log = plasTeX.Logging.getLogger()
class bibliography(chapter):
args = 'files:str'
linkType ... | nibrahim/PlasTeX | plasTeX/Base/LaTeX/Bibliography.py | Python | mit | 4,545 |
from flask import render_template, jsonify, request
from jsonrpclib import jsonrpc
import base64
import urllib
from maraschino import app, logger
from maraschino.tools import *
def nzbget_http():
if get_setting_value('nzbget_https') == '1':
return 'https://'
else:
return 'http://'
def nzbge... | hephaestus9/Ironworks | modules/plugins/nzbget.py | Python | mit | 3,148 |
# coding=utf-8
"""Test Hazard Metadata."""
from unittest import TestCase
from safe.common.utilities import unique_filename
from safe.metadata import HazardLayerMetadata
__copyright__ = "Copyright 2016, The InaSAFE Project"
__license__ = "GPL version 3"
__email__ = "info@inasafe.org"
__revision__ = '$Format:%H$'
cl... | AIFDR/inasafe | safe/metadata/test/test_hazard_metadata.py | Python | gpl-3.0 | 886 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from psycopg2 import OperationalError
from odoo import api, fields, models, registry, _
from odoo.exceptions import UserError
import odoo.addons.decimal_precision as dp
PROCUREMENT_PRIORITIES = [('0', 'Not urgent'), (... | chienlieu2017/it_management | odoo/addons/procurement/models/procurement.py | Python | gpl-3.0 | 12,497 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2015, Joseph Callen <jcallen () csc.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.0',
... | fernandezcuesta/ansible | lib/ansible/modules/cloud/vmware/vmware_dvswitch.py | Python | gpl-3.0 | 7,199 |
#!/usr/bin/env python
import os.path
import sys
DIRNAME = os.path.dirname(__file__)
if not DIRNAME in sys.path:
sys.path.append(DIRNAME)
from django.core.management import execute_manager
try:
import settings # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Erro... | luxnovalabs/enjigo_door | web_interface/keyedcache/test_app/manage.py | Python | unlicense | 668 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# no... | gochist/horizon | openstack_dashboard/dashboards/project/access_and_security/keypairs/views.py | Python | apache-2.0 | 3,012 |
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class TestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@no_debug_info_test
def test(self):
self.build()
self.dbg.CreateTarget(self.getBuildArtifact("a.... | google/llvm-propeller | lldb/test/API/lang/cpp/alignas_base_class/TestAlignAsBaseClass.py | Python | apache-2.0 | 473 |
#
# Copyright (c) 2014 Juniper Networks, Inc. All rights reserved.
#
import gevent
from gevent import monkey; monkey.patch_all()
import argparse
import os
import socket
import random
import math
import uuid
from netaddr import IPAddress
from pysandesh.sandesh_base import *
from pysandesh.util import UTCTimestampUsec
f... | Juniper/contrail-dev-controller | src/vnsw/agent/uve/mock_generator.py | Python | apache-2.0 | 16,590 |
# Copyright 2012 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... | liucode/tempest-master | tempest/api/compute/images/test_list_image_filters.py | Python | apache-2.0 | 12,355 |
#!/usr/bin/env vpython3
# 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.
"""Script for updating the active milestones for the chromium project.
To activate a new chromium branch, run the following from the ... | nwjs/chromium.src | infra/config/scripts/milestones.py | Python | bsd-3-clause | 4,423 |
'''tzinfo timezone information for Asia/Ashkhabad.'''
from pytz.tzinfo import DstTzInfo
from pytz.tzinfo import memorized_datetime as d
from pytz.tzinfo import memorized_ttinfo as i
class Ashkhabad(DstTzInfo):
'''Asia/Ashkhabad timezone definition. See datetime.tzinfo for details'''
zone = 'Asia/Ashkhabad'
... | newvem/pytz | pytz/zoneinfo/Asia/Ashkhabad.py | Python | mit | 1,535 |
"""
Setup for the API
"""
import api
log = api.logger.use(__name__)
def index_mongo():
"""
Ensure the mongo collections are indexed.
"""
db = api.common.get_conn()
log.debug("Ensuring mongo is indexed.")
db.users.ensure_index("uid", unique=True, name="unique uid")
db.users.ensure_index... | PATechmasters/techmaster-ctf | api/api/setup.py | Python | mit | 873 |
from __future__ import absolute_import
import os
import base64
from kombu.serialization import registry
from celery.exceptions import SecurityError
from celery.security.serialization import SecureSerializer, register_auth
from celery.security.certificate import Certificate, CertStore
from celery.security.key import ... | sunze/py_flask | venv/lib/python3.4/site-packages/celery/tests/security/test_serialization.py | Python | mit | 2,252 |
#######################################################################
#
# An example of creating Excel Scatter charts with Python and XlsxWriter.
#
# Copyright 2013-2015, John McNamara, jmcnamara@cpan.org
#
import xlsxwriter
workbook = xlsxwriter.Workbook('chart_scatter.xlsx')
worksheet = workbook.add_worksheet()
bo... | lewislone/mStocks | packets-analysis/lib/XlsxWriter-0.7.3/examples/chart_scatter.py | Python | mit | 5,416 |
import os
import sys
def is_active():
return True
def get_name():
return "X11"
def can_build():
if (os.name!="posix"):
return False
if sys.platform == "darwin":
return False # no x11 on mac for now
errorval=os.system("pkg-config --version > /dev/null")
if (errorval):
print("pkg-co... | hipgraphics/godot | platform/x11/detect.py | Python | mit | 5,057 |
"""
Forwards events to a HTTP call. The configuration used by this notifier
is as follows:
url
Full URL to contact with the event data. A POST request will be made to this
URL with the contents of the events in the body.
Eventually this should be enhanced to support authentication credentials as well.
"""
import... | rbramwell/pulp | server/pulp/server/event/http.py | Python | gpl-2.0 | 2,330 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
# mappings for table dumps
# "remember to add indexes!"
data_map = {
"Company": {
"columns": ["name"],
"conditions": ["docstatus < 2"]
},
"Fisc... | Zlash65/erpnext | erpnext/startup/report_data_map.py | Python | gpl-3.0 | 9,520 |
# -*- coding: utf-8 -*-
# pylint: disable=protected-access
"""Test for Video Xmodule functional logic.
These test data read from xml, not from mongo.
We have a ModuleStoreTestCase class defined in
common/lib/xmodule/xmodule/modulestore/tests/django_utils.py. You can
search for usages of this in the cms and lms tests f... | JioEducation/edx-platform | common/lib/xmodule/xmodule/tests/test_video.py | Python | agpl-3.0 | 42,276 |
# 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... | kobejean/tensorflow | tensorflow/python/profiler/model_analyzer_test.py | Python | apache-2.0 | 33,231 |
#
# [The "BSD license"]
# Copyright (c) 2012 Terence Parr
# Copyright (c) 2012 Sam Harwell
# Copyright (c) 2014 Eric Vergnaud
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redis... | sidhart/antlr4 | runtime/Python3/src/antlr4/atn/LexerATNSimulator.py | Python | bsd-3-clause | 26,465 |
import pytest
from pandas import interval_range
import pandas._testing as tm
@pytest.mark.parametrize(
"kwargs",
[
{"start": 0, "periods": 4},
{"start": 1, "periods": 5},
{"start": 5, "end": 10, "closed": "left"},
],
)
def test_interval_array_equal(kwargs):
arr = interval_rang... | dsm054/pandas | pandas/tests/util/test_assert_interval_array_equal.py | Python | bsd-3-clause | 2,158 |
# Copyright 2019 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os.path
import subprocess
import sys
_enable_style_format = None
_clang_format_command_path = None
_gn_command_path = None
def init(root_src_dir, e... | scheib/chromium | third_party/blink/renderer/bindings/scripts/bind_gen/style_format.py | Python | bsd-3-clause | 3,817 |
# Copyright (c) 2011 The Chromium OS Authors.
#
# SPDX-License-Identifier: GPL-2.0+
#
import command
import re
import os
import series
import subprocess
import sys
import terminal
import checkpatch
import settings
def CountCommitsToBranch():
"""Returns number of commits between HEAD and the tracking branch.
... | lkylei/ten_thousand | roms/u-boot/tools/patman/gitutil.py | Python | gpl-2.0 | 18,813 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2013, Adam Miller (maxamillion@fedoraproject.org)
#
# 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 ... | alxgu/ansible-modules-extras | system/firewalld.py | Python | gpl-3.0 | 20,455 |
# This file is a part of MediaDrop (http://www.mediadrop.net),
# Copyright 2009-2015 MediaDrop contributors
# For the exact contribution history, see the git revision log.
# The source code contained in this file is licensed under the GPLv3 or
# (at your option) any later version.
# See LICENSE.txt in the main project ... | rbu/mediadrop | mediadrop/migrations/versions/004-280565a54124-add_custom_head_tags.py | Python | gpl-3.0 | 1,908 |
# 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... | karllessard/tensorflow | tensorflow/python/training/saving/saveable_object.py | Python | apache-2.0 | 3,646 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# 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-... | zestrada/nova-cs498cc | nova/api/openstack/compute/contrib/multiple_create.py | Python | apache-2.0 | 1,025 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# 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 t... | nwjs/chromium.src | third_party/protobuf/python/google/protobuf/internal/message_test.py | Python | bsd-3-clause | 109,614 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
import os
from collections import OrderedDict
from django.core.management.base import BaseCommand, CommandParser
from django.core.management.color import no_style
def add_builtin_arguments(parser):
parser.add_argume... | Aendra/django_vgv | management/commands/subcommands/base.py | Python | bsd-3-clause | 3,253 |
# This file is part of Buildbot. Buildbot 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, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... | seankelly/buildbot | master/buildbot/scripts/trycmd.py | Python | gpl-2.0 | 903 |
## @file
# process VTF generation
#
# Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found ... | carmark/vbox | src/VBox/Devices/EFI/Firmware/BaseTools/Source/Python/GenFds/Vtf.py | Python | gpl-2.0 | 7,215 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# GuessIt - A library for guessing information from filenames
# Copyright (c) 2013 Nicolas Wack <wackou@gmail.com>
#
# GuessIt is free software; you can redistribute it and/or modify it under
# the terms of the Lesser GNU General Public License as published by
# the Free ... | Hellowlol/PyTunes | libs/guessit/__init__.py | Python | gpl-3.0 | 7,831 |
import tempfile
import shutil
import sys
from unittest import mock
import pytest
from tools.wpt import run
from tools import localpaths # noqa: F401
from wptrunner.browsers import product_list
@pytest.fixture(scope="module")
def venv():
from tools.wpt import virtualenv
class Virtualenv(virtualenv.Virtuale... | CYBAI/servo | tests/wpt/web-platform-tests/tools/wpt/tests/test_run.py | Python | mpl-2.0 | 1,969 |
#
# 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... | ConeyLiu/spark | python/pyspark/ml/param/shared.py | Python | apache-2.0 | 21,249 |
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the... | JioCloud/horizon | openstack_dashboard/dashboards/admin/info/views.py | Python | apache-2.0 | 1,536 |
'''test using string.find() in if statement as a boolean. it returns an int'''
class X:
'''check string.find() usage'''
def foo(self):
s = 'abc'
if s.find('ab'):
print 'this is a bug'
if not s.find('ab'):
print 'this is also a bug'
if s.find('ab') >= 0:
print 'this is not a bu... | lavjain/incubator-hawq | tools/bin/pythonSrc/pychecker-0.8.18/test_input/test96.py | Python | apache-2.0 | 387 |
#!/usr/bin/env python3
# Copyright 2018 The Crashpad 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
#
# Unle... | nwjs/chromium.src | third_party/crashpad/crashpad/build/install_linux_sysroot.py | Python | bsd-3-clause | 2,174 |
from __future__ import absolute_import
from django.core.urlresolvers import reverse
from exam import fixture
from sentry.testutils import TestCase
class ReactivateAccountTest(TestCase):
@fixture
def path(self):
return reverse('sentry-reactivate-account')
def test_renders(self):
user = s... | zenefits/sentry | tests/sentry/web/frontend/test_reactivate_account.py | Python | bsd-3-clause | 796 |
# -*- 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 'PayPalPDT.ipaddress'
db.alter_column('paypal_pdt', 'ip... | aarticianpc/greenpointtrees | src/paypal/standard/pdt/south_migrations/0004_auto__chg_field_paypalpdt_ipaddress.py | Python | mit | 15,085 |
#!/usr/bin/env python2
# -*- coding: utf-8; -*-
"""
Copyright (C) 2007-2012 Lincoln de Sousa <lincoln@minaslivre.org>
Copyright (C) 2007 Gabriel Falcão <gabrielteratos@gmail.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 th... | TempleBishop/guake | src/guake/main.py | Python | gpl-2.0 | 8,822 |
"""
E-commerce Tab Instructor Dashboard Coupons Operations views
"""
from django.contrib.auth.decorators import login_required
from django.core.exceptions import ObjectDoesNotExist
from django.db.models import Q
from django.views.decorators.http import require_POST
from django.utils.translation import ugettext as _
fro... | xiandiancloud/edxplaltfom-xusong | lms/djangoapps/instructor/views/coupons.py | Python | agpl-3.0 | 6,252 |
import os, glob
__all__ = [os.path.basename(f)[:-3] for f in glob.glob(os.path.dirname(__file__) + "/*.py")] | dana-i2cat/felix | msjp/module/common/__init__.py | Python | apache-2.0 | 108 |
# test basic complex number functionality
# constructor
print(complex(1))
print(complex(1.2))
print(complex(1.2j))
print(complex("1"))
print(complex("1.2"))
print(complex("1.2j"))
print(complex(1, 2))
print(complex(1j, 2j))
# unary ops
print(bool(1j))
print(+(1j))
print(-(1 + 2j))
# binary ops
print(1j + False)
prin... | AriZuu/micropython | tests/float/complex1.py | Python | mit | 2,231 |
import os
import sys
import stat
from ._compat import open_stream, text_type, filename_to_ui, get_streerror
from .exceptions import BadParameter
from .utils import safecall, LazyFile
class ParamType(object):
"""Helper for converting values through types. The following is
necessary for a valid type:
* ... | patrickwind/My_Blog | venv/lib/python2.7/site-packages/click/types.py | Python | gpl-2.0 | 15,176 |
# -*- coding: utf-8 -*-
##############################################################################
#
# This program 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 Foundation, either version 3 of the L... | Eficent/odoomrp-wip | mrp_project_link_mto/models/stock_move.py | Python | agpl-3.0 | 1,072 |
# This file is part of OpenHatch.
# Copyright (C) 2010 John Stumpo
#
# This program 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 Foundation, either version 3 of the License, or
# (at your option) any later versi... | nirmeshk/oh-mainline | mysite/missions/models.py | Python | agpl-3.0 | 1,422 |
# Copyright 2012 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | petrutlucian94/nova_dev | nova/api/openstack/compute/contrib/user_data.py | Python | apache-2.0 | 949 |
# Copyright 2015 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 law or a... | ivano666/tensorflow | tensorflow/python/kernel_tests/pad_op_test.py | Python | apache-2.0 | 6,742 |
# vim: set encoding=utf-8
# Copyright (c) 2016 Intel 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 require... | dmsuehir/spark-tk | python/sparktk/dicom/dicom.py | Python | apache-2.0 | 10,173 |
# pylint: skip-file
# pylint: disable=too-many-instance-attributes
class OCVersion(OpenShiftCLI):
''' Class to wrap the oc command line tools '''
# pylint allows 5
# pylint: disable=too-many-arguments
def __init__(self,
config,
debug):
''' Constructor for OCVer... | appuio/ansible-role-openshift-zabbix-monitoring | vendor/openshift-tools/ansible/roles/lib_openshift_3.2/build/src/oc_version.py | Python | apache-2.0 | 2,732 |
# -*- coding:utf-8 -*-
from __future__ import unicode_literals
import logging
import warnings
from admin_scripts.tests import AdminScriptTestCase
from django.core import mail
from django.core.files.temp import NamedTemporaryFile
from django.test import RequestFactory, TestCase, override_settings
from django.test.uti... | h4r5h1t/django-hauthy | tests/logging_tests/tests.py | Python | bsd-3-clause | 16,206 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.