code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
"""
An API for client-side validation of (potential) user data.
"""
from rest_framework.response import Response
from rest_framework.views import APIView
from rest_framework.throttling import AnonRateThrottle
from openedx.core.djangoapps.user_api.accounts.api import (
get_email_validation_... | philanthropy-u/edx-platform | openedx/core/djangoapps/user_api/validation/views.py | Python | agpl-3.0 | 7,749 |
"""Deprecated import support. Auto-generated by import_shims/generate_shims.sh."""
# pylint: disable=redefined-builtin,wrong-import-position,wildcard-import,useless-suppression,line-too-long
from import_shims.warn import warn_deprecated_import
warn_deprecated_import('grades.rest_api.v1', 'lms.djangoapps.grades.rest_a... | eduNEXT/edunext-platform | import_shims/lms/grades/rest_api/v1/__init__.py | Python | agpl-3.0 | 377 |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyRequestsToolbelt(PythonPackage):
"""A toolbelt of useful classes and functions to be use... | rspavel/spack | var/spack/repos/builtin/packages/py-requests-toolbelt/package.py | Python | lgpl-2.1 | 807 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created on Mon Nov 15 19:54:08 2010
@author: sat kumar tomer (http://civil.iisc.ernet.in/~satkumar/)
Functions:
utm2deg: Calculate utm co-ordinates from Lat, Lon
deg2utm : Calculate Lat, Lon from UTM
kabini:
berambadi:
great_circle_distance:
... | tectronics/ambhas | ambhas/gis.py | Python | lgpl-2.1 | 12,300 |
#!/usr/bin/env python
# encoding: utf-8
#
# 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 Licens... | apache/cloudstack-ec2stack | tests/utils.py | Python | apache-2.0 | 2,163 |
# 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... | sarvex/tensorflow | tensorflow/compiler/tests/image_ops_test.py | Python | apache-2.0 | 53,739 |
import sys
import binascii
from init_data import MARKETS
xbrmm_key_file = sys.argv[1]
#from init_data import ACCOUNTS, _ACCOUNT_KEYS
#xbr_marketmaker = 'marketop1-marketmaker1'
#addr, pkey = _ACCOUNT_KEYS[ACCOUNTS[xbr_marketmaker]]
addr = MARKETS[0]['maker']
pkey = MARKETS[0]['maker_pkey']
print(xbrmm_key_file)
w... | crossbario/crossbarexamples | xbr/teststack1/_init/set_xbrmm_key.py | Python | apache-2.0 | 521 |
# Copyright (c) 2017 Orange.
# 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 a... | stackforge/networking-bagpipe-l2 | networking_bagpipe/tests/unit/agent/sfc/test_agent_extension.py | Python | apache-2.0 | 54,420 |
# -*- coding: utf-8 -*-
#-------------------------------------------------------------------------
# drawElements Quality Program utilities
# --------------------------------------
#
# Copyright 2015 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use t... | chadversary/deqp | scripts/caselist_diff.py | Python | apache-2.0 | 15,192 |
'''
Created on Feb 6, 2011
@author: Mark V Systems Limited
(c) Copyright 2011 Mark V Systems Limited, All rights reserved.
'''
from tkinter import *
try:
from tkinter.ttk import *
except ImportError:
from ttk import *
from arelle.CntlrWinTooltip import ToolTip
import io
from arelle import (XmlUtil, ViewWinList... | Arelle/Arelle | arelle/ViewWinXml.py | Python | apache-2.0 | 1,337 |
# -*- coding: utf-8 -*-
"""Class to represent binary data as hexadecimal."""
class Hexdump(object):
"""Class that defines a hexadecimal representation formatter (hexdump)."""
@classmethod
def _FormatDataLine(cls, data, data_offset, data_size):
"""Formats binary data in a single line of hexadecimal represen... | ostree/plaso | plaso/cli/hexdump.py | Python | apache-2.0 | 2,539 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1)
#
# (1) Kamaelia Contributors are listed in the AUTHORS file and at
# http://www.kamaelia.org/AUTHORS - please extend this file,
# not this notice.
#
# Licensed under the Apache License, Ve... | sparkslabs/kamaelia_ | Sketches/MPS/BugReports/FixTests/Kamaelia/Kamaelia/Apps/JsonRPC/BDJsonRPC.py | Python | apache-2.0 | 35,300 |
# coding=UTF-8
import sys
from base_string_script import BaseStringScript
BAD_ELLIPSIS = "..."
GOOD_ELLIPSIS = "…"
BAD_ELLIPSIS_SPACING = " …"
GOOD_ELLIPSIS_SPACING = "…"
BAD_SINGLE_QUOTE = "\\\'%1$s\\\'"
BAD_DOUBLE_QUOTE = "\\\"%1$s\\\""
GOOD_DOUBLE_QUOTE = "“%1$s”"
class FixTypographyScript(BaseStringScript):
... | samtstern/FirebaseUI-Android | scripts/translations/fix_typography.py | Python | apache-2.0 | 1,375 |
#
# 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... | lukecwik/incubator-beam | sdks/python/apache_beam/runners/dataflow/internal/apiclient_test.py | Python | apache-2.0 | 47,214 |
"""Support for GitHub."""
from datetime import timedelta
import logging
import github
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import (
ATTR_NAME,
CONF_ACCESS_TOKEN,
CONF_NAME,
CONF_PATH,
CONF_URL,
)
import homeassistant.helpers.... | nkgilley/home-assistant | homeassistant/components/github/sensor.py | Python | apache-2.0 | 9,350 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Copyright 2011-2014, Nigel Small
#
# 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... | nigelsmall/py2neo | py2neo/packages/httpstream/watch.py | Python | apache-2.0 | 3,162 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.core.validators
import powerdns.models.powerdns
class Migration(migrations.Migration):
dependencies = [
('powerdns', '0014_auto_20151124_0505'),
]
operations = [
migrat... | allegro/django-powerdns-dnssec | powerdns/migrations/0015_auto_20151214_0632.py | Python | bsd-2-clause | 1,537 |
from Foundation import *
from PyObjCTools.TestSupport import *
try:
unicode
except NameError:
unicode = str
try:
long
except NameError:
long = int
class TestNSRange (TestCase):
def testStructs(self):
v = NSRange()
self.assertHasAttr(v, 'location')
self.assertHasAttr(v, '... | albertz/music-player | mac/pyobjc-framework-Cocoa/PyObjCTest/test_nsrange.py | Python | bsd-2-clause | 1,400 |
"""
This module contains the default values for all settings used by Scrapy.
For more information about these settings you can read the settings
documentation in docs/topics/settings.rst
Scrapy developers, if you add a setting here remember to:
* add it in alphabetical order
* group similar settings without leaving ... | starrify/scrapy | scrapy/settings/default_settings.py | Python | bsd-3-clause | 9,161 |
#!/usr/bin/env python
"""
Simple example of a CLI that demonstrates fish-style auto suggestion.
When you type some input, it will match the input against the history. If One
entry of the history starts with the given input, then it will show the
remaining part as a suggestion. Pressing the right arrow will insert this... | niklasf/python-prompt-toolkit | examples/auto-suggestion.py | Python | bsd-3-clause | 1,386 |
from functools import partial
from nose.tools import eq_
from bleach import clean
clean = partial(clean, tags=['p'], attributes=['style'])
def test_allowed_css():
tests = (
('font-family: Arial; color: red; float: left; '
'background-color: red;', 'color: red;', ['color']),
('border: ... | mozilla/popcorn_maker | vendor-local/lib/python/bleach/tests/test_css.py | Python | bsd-3-clause | 3,630 |
from __future__ import absolute_import, unicode_literals
import json
import os
from django.contrib.contenttypes.models import ContentType
from django.core.serializers.json import DjangoJSONEncoder
from django.db import models
from django.shortcuts import render
from django.utils.encoding import python_2_unicode_compa... | chrxr/wagtail | wagtail/wagtailforms/models.py | Python | bsd-3-clause | 9,515 |
from flask import Flask, render_template
from os.path import dirname, join, abspath
import logging
approot = abspath(dirname(dirname(__file__)))
app = Flask('sampleapp')
app.debug = True
import pandas as pd
from bokeh.pluginutils import app_document
from bokeh.plotting import output_server, session, circle
import numpy... | sahat/bokeh | examples/app/sampleapp/server.py | Python | bsd-3-clause | 1,456 |
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
"""
Simple data processing pipeline plugin for Ginga.
**Plugin Type: Local**
``Pipeline`` is a local plugin, which means it is associated with a channel.
An instance can be opened for each channel.
**Usage**
... | pllim/ginga | ginga/rv/plugins/Pipeline.py | Python | bsd-3-clause | 14,214 |
"""Common tools for building restful resources."""
import flask
import flask_restful
import flask_restful.reqparse
import functools
import sqlalchemy
import sqlalchemy.orm as orm
import backend
import backend.common.auth as auth
class RequestParser(flask_restful.reqparse.RequestParser):
"""RequestParser subcla... | andymcguinness/Planet-Lab | backend/src/backend/common/resource.py | Python | bsd-3-clause | 7,704 |
def omp_parallel_reduction():
import math
dt = 0.5
rounding_error = 1.E-9
sum = 0
dsum = 0
dt = 1. / 3.
result = True
product = 1
logic_and = 1
logic_or = 0
bit_and = 1
bit_or = 0
exclusiv_bit_or = 0
known_sum = (1000 * (1000 + 1)) / 2
'omp parallel for sch... | artas360/pythran | pythran/tests/openmp.legacy/omp_parallel_reduction.py | Python | bsd-3-clause | 4,440 |
__author__ = 'oleduc'
| oleduc/ferrymang | ferrymang/modules/__init__.py | Python | bsd-3-clause | 22 |
##########################################################################
#
# Copyright (c) 2011-2012, Image Engine Design Inc. All rights reserved.
# Copyright (c) 2012, John Haddon. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provi... | DoubleNegativeVisualEffects/gaffer | python/GafferUI/VectorDataPlugValueWidget.py | Python | bsd-3-clause | 3,631 |
#!/usr/bin/env python
from erlpack import pack, unpack
import socket
import struct
from string import Template
PORT = 5001
HOST = ''
BACKLOG = 5
file_tmpl = Template("""
from erlpack import Atom, pack, unpack
${testcases}
""".strip())
testcase_pack_tmpl = Template("""
def test_pack_${name}():
assert pack(${pyt... | dylanh724/tol-node-public | tol2-test/node_modules/erlpack/py/tests/integration/echo_server.py | Python | mit | 2,060 |
from collections.abc import Mapping
from ctypes import c_int, c_int32, c_double, c_char_p, POINTER, \
create_string_buffer, c_size_t
from weakref import WeakValueDictionary
import numpy as np
from numpy.ctypeslib import as_array
from openmc.exceptions import AllocationError, InvalidIDError
from . import _dll
from... | mit-crpg/openmc | openmc/lib/filter.py | Python | mit | 16,055 |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | QingChenmsft/azure-cli | src/azure-cli-core/azure/cli/core/tests/test_command_registration.py | Python | mit | 15,404 |
import ctypes
import six
from cupy import carray
from cupy import internal
def _make_cindexer(n):
class CIndexer(ctypes.Structure):
_fields_ = [('size', ctypes.c_int),
('shape', ctypes.c_int * n),
('index', ctypes.c_int * n)]
return CIndexer
_cindexers = [_m... | ikasumi/chainer | cupy/cindexer.py | Python | mit | 754 |
"""Learner that implements a greedy learning algorithm"""
import time
from pebl import network, result, evaluator
from pebl.util import *
from pebl.learner.base import *
class GreedyLearnerStatistics:
def __init__(self):
self.restarts = -1
self.iterations = 0
self.unimproved_iterations = ... | arnaudsj/pebl | src/pebl/learner/greedy.py | Python | mit | 4,765 |
"""
Support for showing the time in a different time zone.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.worldclock/
"""
import logging
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.cons... | Smart-Torvy/torvy-home-assistant | homeassistant/components/sensor/worldclock.py | Python | mit | 1,805 |
from __future__ import unicode_literals
import pytest
@pytest.fixture
def doc(EN):
return EN('This is a sentence. This is another sentence. And a third.')
@pytest.mark.models
def test_sent_spans(doc):
sents = list(doc.sents)
assert sents[0].start == 0
assert sents[0].end == 5
assert len(sents)... | lukw00/spaCy | tests/spans/test_span.py | Python | mit | 579 |
"""
Tests that ensure the correct items are returned from api calls.
Also tests whether the users with permissions can create logs.
"""
import csv
import datetime
import uuid
from django.core.urlresolvers import reverse
from rest_framework import status
from rest_framework.test import APITestCase
from kolibri.auth.mo... | 66eli77/kolibri | kolibri/logger/test/test_api.py | Python | mit | 13,270 |
class ListResource(object):
def __init__(self, version):
"""
:param Version version:
"""
self._version = version
""" :type: Version """
| tysonholub/twilio-python | twilio/base/list_resource.py | Python | mit | 180 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | SUSE/azure-sdk-for-python | azure-mgmt-servermanager/azure/mgmt/servermanager/models/session_parameters.py | Python | mit | 2,307 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 University of Dundee & Open Microscopy Environment.
# All Rights Reserved.
# Use is subject to license terms supplied in LICENSE.txt
#
"""
FOR TRAINING PURPOSES ONLY!
"""
from omero.gateway import BlitzGateway
from Parse_OMERO_Pr... | dominikl/openmicroscopy | examples/Training/python/Groups_Permissions.py | Python | gpl-2.0 | 2,523 |
import sync
import ui
import features
import functools
import save as _save
from freeciv.dropbox import get_download_path
def _impl_save(name, path):
def _do():
data = open(path, 'rb').read()
sync.request_with_sid('/sync/upload_save',
name=name,
... | eric-stanley/freeciv-android | lib/freeciv/dropbox_civsync.py | Python | gpl-2.0 | 1,258 |
##
# Copyright 2009-2013 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://vscentrum.be/nl/en),
# the Hercules foundation (htt... | geimer/easybuild-easyblocks | easybuild/easyblocks/m/mvapich2.py | Python | gpl-2.0 | 6,289 |
#!/usr/bin/env python
# Copyright (C) 2012 Swift Navigation Inc.
#
# This source is subject to the license found in the file 'LICENSE' which must
# be be distributed together with this source. All other rights reserved.
#
# THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
# EITHER EXPRESSED ... | henryhallam/peregrine | peregrine/analysis/acquisition.py | Python | gpl-3.0 | 8,541 |
# sqlalchemy/events.py
# Copyright (C) 2005-2013 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
"""Core event interfaces."""
from . import event, exc
from .pool import Pool
fro... | michaelgugino/web_keyer | sqlalchemy/events.py | Python | gpl-3.0 | 31,080 |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser 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 Softwa... | toofar/qutebrowser | tests/unit/utils/test_urlmatch.py | Python | gpl-3.0 | 17,880 |
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe, json
from frappe import _
from frappe.model.mapper import get_mapped_doc
from frappe.utils import get_url, random_string,... | bhupennewalkar1337/erpnext | erpnext/buying/doctype/request_for_quotation/request_for_quotation.py | Python | gpl-3.0 | 8,686 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import random
import os
import subprocess
if __name__=='__main__':
HADOOP_PATH = "/usr/share/hadoop"
DICT_PATH = "/usr/share/dict/words"
DATA_DIR = os.path.dirname(os.path.realpath(__file__))
OUT_PATH = os.path.join(DATA_DIR, "wordcount.in")
vocab = ... | DevinZ1993/Code-Cupboard | java/demos/hadoop/gen_data.py | Python | mpl-2.0 | 959 |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyNistats(PythonPackage):
"""Modeling and Statistical analysis of fMRI data in Python."""
... | LLNL/spack | var/spack/repos/builtin/packages/py-nistats/package.py | Python | lgpl-2.1 | 1,272 |
#* This file is part of the MOOSE framework
#* https://www.mooseframework.org
#*
#* All rights reserved, see COPYRIGHT for full restrictions
#* https://github.com/idaholab/moose/blob/master/COPYRIGHT
#*
#* Licensed under LGPL 2.1, please see LICENSE for details
#* https://www.gnu.org/licenses/lgpl-2.1.html
import uuid... | nuclear-wizard/moose | python/MooseDocs/extensions/floats.py | Python | lgpl-2.1 | 8,900 |
'''
Servants is of primary interest to Python component developers.
The module names should sufficiently described their intended uses.
'''
__revision__ = "$Id: __init__.py,v 1.4 2005/02/25 23:42:32 dfugate Exp $"
| ACS-Community/ACS | LGPL/CommonSoftware/acspy/src/Acspy/Servants/__init__.py | Python | lgpl-2.1 | 214 |
# 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... | reminisce/mxnet | python/mxnet/symbol/numpy_extension/__init__.py | Python | apache-2.0 | 996 |
# Copyright 2015 Mellanox Technologies, Ltd
#
# 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 t... | silenci/neutron | neutron/tests/unit/plugins/ml2/drivers/mech_sriov/agent/extension_drivers/test_qos_driver.py | Python | apache-2.0 | 3,786 |
# Copyright 2011 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... | sebrandon1/nova | nova/tests/unit/test_cinder.py | Python | apache-2.0 | 9,333 |
"""Support for Flipr binary sensors."""
from __future__ import annotations
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_PROBLEM,
BinarySensorEntity,
BinarySensorEntityDescription,
)
from . import FliprEntity
from .const import DOMAIN
BINARY_SENSORS_TYPES: tuple[BinarySensorEntityDesc... | jawilson/home-assistant | homeassistant/components/flipr/binary_sensor.py | Python | apache-2.0 | 1,353 |
input = """
1 2 2 1 3 4
1 3 2 1 2 4
1 4 0 0
1 5 2 1 6 7
1 6 2 1 5 7
1 7 0 0
1 8 2 1 9 10
1 9 2 1 8 10
1 10 0 0
1 11 2 1 12 13
1 12 2 1 11 13
1 13 0 0
1 14 1 0 2
1 15 1 0 5
1 16 1 0 8
1 17 1 0 11
1 18 1 0 2
1 19 1 0 5
1 20 1 0 2
1 21 1 0 5
1 22 1 0 8
1 23 1 0 11
1 21 2 1 19 20
1 24 1 1 18
1 23 1 0 8
1 25 1 1 18
1 26 1 0... | Yarrick13/hwasp | tests/asp/AllAnswerSets/tight/bug.learning.03.asp.test.py | Python | apache-2.0 | 599 |
"""
gdalinfo tests/gis_tests/data/rasters/raster.tif:
Driver: GTiff/GeoTIFF
Files: tests/gis_tests/data/rasters/raster.tif
Size is 163, 174
Coordinate System is:
PROJCS["NAD83 / Florida GDL Albers",
GEOGCS["NAD83",
DATUM["North_American_Datum_1983",
SPHEROID["GRS 1980",6378137,298.2572221010002... | cloudera/hue | desktop/core/ext-py/Django-1.11.29/tests/gis_tests/gdal_tests/test_raster.py | Python | apache-2.0 | 21,062 |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import logging
import pickle
from collections import OrderedDict
import torch
from maskrcnn_benchmark.utils.model_serialization import load_state_dict
from maskrcnn_benchmark.utils.registry import Registry
def _rename_basic_resnet_weights(layer... | mlperf/training_results_v0.7 | NVIDIA/benchmarks/maskrcnn/implementations/pytorch/maskrcnn_benchmark/utils/c2_model_loading.py | Python | apache-2.0 | 7,055 |
#!/usr/bin/python
#
# Copyright 2014 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 b... | wubr2000/googleads-python-lib | examples/dfa/v1_20/add_advertiser_user_filter.py | Python | apache-2.0 | 2,962 |
# Copyright 2013-2014 MongoDB, 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 writin... | ShaneHarvey/mongo-connector | tests/test_oplog_manager_sharded.py | Python | apache-2.0 | 28,458 |
def foo(a_new, b_new):
print(a_new + b_new * 123)
def f():
a = 1
b = 1
foo(a, b) | IllusionRom-deprecated/android_platform_tools_idea | python/testData/refactoring/extractmethod/Statement.after.py | Python | apache-2.0 | 98 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed unde... | froyobin/horizon | openstack_dashboard/test/test_data/sahara_data.py | Python | apache-2.0 | 17,441 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2005 onwards University of Deusto
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
#
# This software consists of contributions made by many individual... | weblabdeusto/weblabdeusto | server/src/experiments/vm/user_manager/manager.py | Python | bsd-2-clause | 2,115 |
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import unittest
import common_util
class SerializeAttributesTestCase(unittest.TestCase):
class Foo(object):
def __init__(self, foo_fighters, whisky_... | axinging/chromium-crosswalk | tools/android/loading/common_util_unittest.py | Python | bsd-3-clause | 2,005 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import collections
import copy
import datetime
import decimal
import math
import uuid
import warnings
from base64 import b64decode, b64encode
from itertools import tee
from django.apps import apps
from django.db import connection
from django.db.models.lo... | andyzsf/django | django/db/models/fields/__init__.py | Python | bsd-3-clause | 84,287 |
import os
from whylog.log_reader.exceptions import EmptyFile, OffsetBiggerThanFileSize
class ReadUtils(object):
STANDARD_BUFFER_SIZE = 512
@classmethod
def size_of_opened_file(cls, fh):
prev_position = fh.tell()
fh.seek(0, os.SEEK_END)
size = fh.tell()
fh.seek(prev_positi... | andrzejgorski/whylog | whylog/log_reader/read_utils.py | Python | bsd-3-clause | 2,366 |
# -----------------------------------------------------------------------------
# Copyright (c) 2014--, The Qiita Development Team.
#
# Distributed under the terms of the BSD 3-clause License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... | josenavas/QiiTa | qiita_db/handlers/tests/oauthbase.py | Python | bsd-3-clause | 841 |
import numpy as np
from bokeh.layouts import layout
from bokeh.models import CustomJS, Slider, ColumnDataSource, WidgetBox
from bokeh.plotting import figure, output_file, show
output_file('dashboard.html')
tools = 'pan'
def bollinger():
# Define Bollinger Bands.
upperband = np.random.random_integers(100, 1... | schoolie/bokeh | examples/howto/layouts/dashboard.py | Python | bsd-3-clause | 2,816 |
import math
import re
import actions
import predefinedentities
from jstypes import JSArray, JSObject, JSWrapper
# Function prototypes should implement the following:
# wrapper : The JSWrapper instace that is being called
# arguments : A list of argument nodes; untraversed
# traverser : The current traverser object... | mstriemer/amo-validator | validator/testcases/javascript/call_definitions.py | Python | bsd-3-clause | 12,988 |
#-------------------------------------------------------------------------
# Copyright (c) Microsoft. 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.apa... | lmazuel/azure-sdk-for-python | azure-servicebus/azure/servicebus/_common_serialization.py | Python | mit | 18,799 |
# Copyright 2015 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompa... | LockScreen/Backend | venv/lib/python2.7/site-packages/boto3/s3/transfer.py | Python | mit | 27,752 |
# 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... | ininex/geofire-python | resource/lib/python2.7/site-packages/gcloud/bigtable/test_instance.py | Python | mit | 31,982 |
# -*- coding: utf-8 -*-
# Resource object code
#
# Created: Wed Mar 20 13:39:06 2013
# by: The Resource Compiler for PyQt (Qt v4.8.4)
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore
qt_resource_data = "\
\x00\x00\x3a\x7c\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x... | Distrotech/PyQt-x11 | examples/graphicsview/dragdroprobot/dragdroprobot_rc2.py | Python | gpl-2.0 | 62,689 |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsComposerShape.
.. note:: This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
"""
... | mhugent/Quantum-GIS | tests/src/python/test_qgscomposershapes.py | Python | gpl-2.0 | 3,326 |
"""RPC Implementation, originally written for the Python Idle IDE
For security reasons, GvR requested that Idle's Python execution server process
connect to the Idle process, which listens for the connection. Since Idle has
only one client per server, this was not a limitation.
+---------------------------------+... | FFMG/myoddweb.piger | monitor/api/python/Python-3.7.2/Lib/idlelib/rpc.py | Python | gpl-2.0 | 21,137 |
# -*- coding: utf-8 -*-
#
# test_quantal_stp_synapse.py
#
# This file is part of NEST.
#
# Copyright (C) 2004 The NEST Initiative
#
# NEST 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 th... | HBPNeurorobotics/nest-simulator | pynest/nest/tests/test_quantal_stp_synapse.py | Python | gpl-2.0 | 4,353 |
from __future__ import unicode_literals
import frappe
def execute():
hr_settings = frappe.get_single("HR Settings")
hr_settings.leave_approval_notification_template = "Leave Approval Notification"
hr_settings.leave_status_notification_template = "Leave Status Notification"
hr_settings.save() | Zlash65/erpnext | erpnext/patches/v11_0/set_default_email_template_in_hr.py | Python | gpl-3.0 | 297 |
#
# Copyright 2010-2011 Free Software Foundation, Inc.
#
# 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 progra... | n4hy/gnuradio | volk/gen/make_c.py | Python | gpl-3.0 | 3,494 |
""" # lint-amnesty, pylint: disable=cyclic-import
XFields for video module.
"""
import datetime
from xblock.fields import Boolean, DateTime, Dict, Float, List, Scope, String
from xmodule.fields import RelativeTime
# Make '_' a no-op so we can scrape strings. Using lambda instead of
# `django.utils.translation.ug... | eduNEXT/edx-platform | common/lib/xmodule/xmodule/video_module/video_xfields.py | Python | agpl-3.0 | 9,242 |
from __future__ import division, print_function, absolute_import
from scipy import stats
import numpy as np
from numpy.testing import assert_almost_equal, assert_, assert_raises, \
assert_array_almost_equal, assert_array_almost_equal_nulp, run_module_suite
def test_kde_1d():
#some basic tests comparing to no... | GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/scipy/stats/tests/test_kdeoth.py | Python | agpl-3.0 | 6,021 |
#!/usr/bin/env python
import sys
import csv
import os
import decimal
os.environ['DJANGO_SETTINGS_MODULE'] = 'pombola.settings'
sys.path.append('../../../')
sys.path.append('../../')
from django.utils.text import slugify
from pombola.core.models import Place
from pombola.place_data.models import Entry
place_kind_sl... | hzj123/56th | pombola/place_data/bin/import_place_data.py | Python | agpl-3.0 | 3,048 |
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from .kaltura import KalturaIE
from ..utils import (
extract_attributes,
remove_end,
)
class AsianCrushIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?asiancrush\.com/video/(?:[^/]+/)?0+(?P<id>\d+)v\... | rrooij/youtube-dl | youtube_dl/extractor/asiancrush.py | Python | unlicense | 3,951 |
"""The tests for the Rfxtrx light platform."""
import unittest
import RFXtrx as rfxtrxmod
import pytest
from homeassistant.components import rfxtrx as rfxtrx_core
from homeassistant.setup import setup_component
from tests.common import get_test_home_assistant, mock_component
@pytest.mark.skipif("os.environ.get('RF... | leppa/home-assistant | tests/components/rfxtrx/test_light.py | Python | apache-2.0 | 12,456 |
import sys
import time
import eventlet
from eventlet.green import subprocess
import eventlet.patcher
import tests
original_subprocess = eventlet.patcher.original('subprocess')
def test_subprocess_wait():
# https://bitbucket.org/eventlet/eventlet/issue/89
# In Python 3.3 subprocess.Popen.wait() method acquire... | kawamon/hue | desktop/core/ext-py/eventlet-0.24.1/tests/subprocess_test.py | Python | apache-2.0 | 3,313 |
import yaml
from st2common.runners.base_action import Action
class YamlStringToObject(Action):
def run(self, yaml_str):
return yaml.safe_load(yaml_str)
| punalpatel/st2 | contrib/examples/actions/pythonactions/yaml_string_to_object.py | Python | apache-2.0 | 168 |
# Copyright 2018 Capital One Services, 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.0
#
# Unless required by applicable law or agreed to in... | ewbankkit/cloud-custodian | tools/c7n_azure/c7n_azure/resources/vm.py | Python | apache-2.0 | 6,309 |
# 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... | lukeiwanski/tensorflow-opencl | tensorflow/python/ops/image_ops_impl.py | Python | apache-2.0 | 49,912 |
"""Facility to use the Expat parser to load a minidom instance
from a string or file.
This avoids all the overhead of SAX and pulldom to gain performance.
"""
# Warning!
#
# This module is tightly bound to the implementation details of the
# minidom DOM and can't be used with other DOM implementations. This
# is due... | tempbottle/ironpython3 | Src/StdLib/Lib/xml/dom/expatbuilder.py | Python | apache-2.0 | 35,641 |
from include import IncludeManager
from django.apps import apps
from django.db import models
from django.utils import timezone
from osf.models.base import BaseModel, ObjectIDMixin
from osf.utils.datetime_aware_jsonfield import DateTimeAwareJSONField
from osf.utils.fields import NonNaiveDateTimeField
from website.util ... | TomBaxter/osf.io | osf/models/nodelog.py | Python | apache-2.0 | 7,049 |
'''
This module holds the constants used for specifying the states of the debugger.
'''
DEBUG_TRACE_LEVEL = -1
DEBUG_TRACE_BREAKPOINTS = -1
STATE_RUN = 1
STATE_SUSPEND = 2
try:
__setFalse = False
except:
import __builtin__
setattr(__builtin__, 'True', 1)
setattr(__builtin__, 'False', 0)
class Deb... | hinesmr/mica | util/pydevd/pysrc/pydevd_constants.py | Python | apache-2.0 | 6,291 |
from math import pi
import pandas as pd
from bokeh.io import output_file, show
from bokeh.palettes import Category20c
from bokeh.plotting import figure
from bokeh.transform import cumsum
output_file("pie.html")
x = {
'United States': 157,
'United Kingdom': 93,
'Japan': 89,
'China': 63,
'Germany'... | mindriot101/bokeh | examples/plotting/file/pie.py | Python | bsd-3-clause | 1,053 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import Queue
import signal
import sys
import os
import threading
import time
from ConfigParser import ConfigParser
from thread_manager import ThreadManager
from thread_mysql import ThreadMySQL
from thread_statsd import ThreadStatsd, ThreadFakeStatsd
clas... | spilgames/mysql-statsd | mysql_statsd/mysql_statsd.py | Python | bsd-3-clause | 5,234 |
##########################################################################
#
# Copyright (c) 2010, Image Engine Design 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:
#
# * Redistribu... | appleseedhq/cortex | python/IECoreMaya/FileSequenceParameterUI.py | Python | bsd-3-clause | 3,597 |
from unittest import TestCase
from scrapy.http import Response, Request
from scrapy.spider import Spider
from scrapy.contrib.spidermiddleware.offsite import OffsiteMiddleware
from scrapy.utils.test import get_crawler
class TestOffsiteMiddleware(TestCase):
def setUp(self):
self.spider = self._get_spider(... | joshlk/scrapy | scrapy/tests/test_spidermiddleware_offsite.py | Python | bsd-3-clause | 1,982 |
import re
from django import forms
from django.core.files.uploadedfile import InMemoryUploadedFile
from django.forms.util import flatatt
from django.forms.widgets import FileInput
from django.template import Context
from django.template.loader import render_to_string
from django.utils import formats, six
from django.ut... | manevant/django-oscar | src/oscar/forms/widgets.py | Python | bsd-3-clause | 11,772 |
#!/usr/bin/env python
import argparse
import ConfigParser
import sys
import os
import multiprocessing
import itertools
import copy
import subprocess
from pprint import pprint
from benchmark.benchmarker import Benchmarker
from setup.linux.unbuffered import Unbuffered
from setup.linux import setup_util
from ast import l... | PermeAgility/FrameworkBenchmarks | toolset/run-tests.py | Python | bsd-3-clause | 11,680 |
from os import environ
from django.conf.urls import include, url
from django.conf import settings
from django.conf.urls.static import static
from .wooey_urls import *
if settings.DEBUG:
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
urlpatterns += static(settings.STATIC_URL, doc... | wooey/django-djangui | wooey/conf/project_template/urls/user_urls.py | Python | bsd-3-clause | 353 |
import numpy
import chainer
from chainer import backend
from chainer import function_node
from chainer.utils import type_check
def _as_mat(x):
if x.ndim == 2:
return x
return x.reshape(len(x), -1)
def _ij_ik_il_to_jkl(a, b, c):
ab = chainer.functions.matmul(a[:, :, None], b[:, None, :]) # ijk
... | okuta/chainer | chainer/functions/connection/bilinear.py | Python | mit | 9,015 |
# jhbuild - a tool to ease building collections of source packages
# Copyright (C) 2001-2004 James Henstridge
#
# autobuild.py: non-interactive build that generates a report
#
# 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... | mujin/jhbuild | jhbuild/commands/autobuild.py | Python | gpl-2.0 | 3,732 |
"""
This page is in the table of contents.
Temperature is a script to set the temperature for the object and raft.
==Operation==
The default 'Activate Temperature' checkbox is on. When it is on, the functions described below will work, when it is off, the functions will not be called.
==Settings==
===Rate===
The def... | makerbot/ReplicatorG | skein_engines/skeinforge-35/skeinforge_application/skeinforge_plugins/craft_plugins/temperature.py | Python | gpl-2.0 | 9,647 |
import os, platform
import SCons.Script
import SConfig
class Platform(SConfig.Node):
def __init__(self, scons_env, scons_opts, required=False):
SConfig.Node.__init__(self, scons_env, scons_opts, required)
self.checks = [self.print_results]
# Will be set after successful configuration.
... | geodynamics/gale | gLucifer/config/SConfig/Platform.py | Python | gpl-2.0 | 2,519 |
# Copyright (C) 2010 Anders Logg
#
# This file is part of DOLFIN.
#
# DOLFIN is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
#... | MiroK/dolfin | demo/undocumented/extrapolation/python/demo_extrapolation.py | Python | gpl-3.0 | 1,227 |