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 |
|---|---|---|---|---|---|
#
# 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... | wileeam/airflow | tests/providers/google/cloud/operators/test_kubernetes_engine_system.py | Python | apache-2.0 | 1,271 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# uTorrent.py version 0.1.1 ALPHA
# Copyright (C) 2006 Rob Crowther <weilawei@gmail.com>
#
# This library 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 Foun... | Marquand/cutorrent | uTorrent_py/uTorrent.py | Python | apache-2.0 | 11,902 |
#!/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/dfp/v201411/team_service/create_teams.py | Python | apache-2.0 | 1,762 |
# Copyright (c) 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 or agreed to... | shakamunyi/neutron-vrrp | neutron/tests/unit/cisco/test_network_plugin.py | Python | apache-2.0 | 53,883 |
# portalocker.py - Cross-platform (posix/nt) API for flock-style file locking.
# Requires python 1.5.2 or better.
"""Cross-platform (posix/nt) API for flock-style file locking.
Synopsis:
import portalocker
file = open("somefile", "r+")
portalocker.lock(file, portalocker.LOCK_EX)
file.seek... | dsuch/ConcurrentLogHandler | src/portalocker.py | Python | apache-2.0 | 3,780 |
from __future__ import absolute_import
from typing import Optional, Any, Dict
from collections import OrderedDict
from django.views.generic import TemplateView
from django.conf import settings
from django.http import HttpRequest, HttpResponse
import ujson
from zerver.lib import bugdown
from zerver.lib.integrations im... | sup95/zulip | zerver/views/integrations.py | Python | apache-2.0 | 4,038 |
from unittest import TestCase
from luigi import hive
class TestHiveTask(TestCase):
def test_error_cmd(self):
self.assertRaises(hive.HiveCommandError, hive.run_hive_cmd, "this is a bogus command and should cause an error;")
def test_ok_cmd(self):
"Test that SHOW TABLES doesn't throw an error"
... | cpcloud/luigi | test/_hive_test.py | Python | apache-2.0 | 362 |
# -*- coding: 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 License, Version 2.0 (the
#... | artwr/airflow | tests/contrib/operators/test_gcp_sql_operator_system.py | Python | apache-2.0 | 2,927 |
# EF-SMT solver implementation
#
# This example shows:
# 1. How to combine 2 different solvers
# 2. How to extract information from a model
#
from pysmt.shortcuts import Solver, get_model
from pysmt.shortcuts import Symbol, Bool, Real, Implies, And, Not, Equals
from pysmt.shortcuts import GT, LT, LE, Minus, Times
fro... | idkwim/pysmt | examples/efsmt.py | Python | apache-2.0 | 2,475 |
# 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... | alshedivat/tensorflow | tensorflow/python/kernel_tests/logging_ops_test.py | Python | apache-2.0 | 14,951 |
from keras.layers import Layer
class MaskedLayer(Layer):
"""
Keras 2.0 allowed for arbitrary differences in arguments to the ``call`` method of ``Layers``.
As part of this, they removed the default ``mask=None`` argument, which means that if you want
to implement ``call`` with a mask, you need to disa... | matt-gardner/deep_qa | deep_qa/layers/masked_layer.py | Python | apache-2.0 | 786 |
from paddle.trainer_config_helpers import *
settings(learning_rate=1e-4, batch_size=1000)
seq_in = data_layer(name='input', size=200)
labels = data_layer(name='labels', size=5000)
probs = data_layer(name='probs', size=10)
xe_label = data_layer(name='xe-label', size=10)
hidden = fc_layer(input=seq_in, size=4)
output... | lispc/Paddle | python/paddle/trainer_config_helpers/tests/configs/test_cost_layers.py | Python | apache-2.0 | 1,402 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010-2011 OpenStack LLC.
# 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... | houshengbo/nova_vmware_compute_driver | nova/api/openstack/compute/views/limits.py | Python | apache-2.0 | 3,495 |
# 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 under the Li... | openstack/manila | manila/db/migrations/alembic/versions/fdfb668d19e1_add_gateway_to_network_allocations_table.py | Python | apache-2.0 | 1,178 |
# -*- coding: utf-8 -*-
# Copyright (C) 2013 Yahoo! 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... | openstack/taskflow | taskflow/examples/resume_vm_boot.py | Python | apache-2.0 | 9,636 |
__author__ = 'root'
import random, socket, time, select
import struct, string, re
import types, errno
class NetBIOS():
def __init__(self, broadcast=True, listen_port=0):
self.broadcast = broadcast
self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
self.HEADER_STRUCT_FORMAT = '>HH... | borisoop/AtEar | module/NetBIOS.py | Python | apache-2.0 | 3,922 |
"""map types"""
def main():
a = map[string]int{
'x': 1,
'y': 2,
'z': 3,
}
print( a['x'] )
assert a['x']==1
b = map[int]string{ 0:'a', 1:'b' }
print( b[0] )
print( b[1] )
assert b[0]=='a'
assert b[1]=='b'
## infers type of key and value ##
c = {'x':100, 'y':200}
print( c['x'] )
print( c['y'] )
a... | pombredanne/Rusthon | regtests/go/maps.py | Python | bsd-3-clause | 359 |
from .test_groups import *
| puttarajubr/commcare-hq | corehq/apps/groups/tests/__init__.py | Python | bsd-3-clause | 27 |
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.test import Client
from django.test.utils import override_settings
from mock import patch
from nose.tools import eq_, ok_
from mozillians.common.templatetags.helpers import urlparams
from mozillians.common.tests impor... | akatsoulas/mozillians | mozillians/phonebook/tests/test_views/test_views_register.py | Python | bsd-3-clause | 3,421 |
"""
sentry.models.authenticator
~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2016 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import os
import hmac
import time
import base64
import hashlib
import six
from u2flib_server impor... | alexm92/sentry | src/sentry/models/authenticator.py | Python | bsd-3-clause | 20,330 |
import builtins
import getpass
import os
import sys
from datetime import date
from io import StringIO
from unittest import mock
from django.apps import apps
from django.contrib.auth import get_permission_codename, management
from django.contrib.auth.management import (
create_permissions, get_default_username,
)
f... | theo-l/django | tests/auth_tests/test_management.py | Python | bsd-3-clause | 41,076 |
from django.forms import Media
from wagtail.admin.staticfiles import versioned_static
# Feature objects: these are mapped to feature identifiers within the rich text
# feature registry (wagtail.core.rich_text.features). Each one implements
# a `construct_options` method which modifies an options dict as appropriate t... | timorieber/wagtail | wagtail/admin/rich_text/editors/draftail/features.py | Python | bsd-3-clause | 2,173 |
import re
from tkinter import *
import tkinter.messagebox as tkMessageBox
from idlelib.editor import EditorWindow
from idlelib import iomenu
class OutputWindow(EditorWindow):
"""An editor window that can serve as an output file.
Also the future base class for the Python shell window.
This class has no... | yotchang4s/cafebabepy | src/main/python/idlelib/outwin.py | Python | bsd-3-clause | 4,385 |
class PublicClass:
pass
class _PrivateClass:
pass
def public_function():
pass
def _private_function():
pass
| josiah-wolf-oberholtzer/uqbar | tests/fake_package/multi/two.py | Python | mit | 130 |
#!/usr/bin/env python3
# Copyright (c) 2018-2020 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Verify that starting bitcoin with -h works as expected."""
from test_framework.test_framework import B... | yenliangl/bitcoin | test/functional/feature_help.py | Python | mit | 2,481 |
from pythonforandroid.recipe import PythonRecipe
class PyamlRecipe(PythonRecipe):
version = "15.8.2"
url = 'https://pypi.python.org/packages/source/p/pyaml/pyaml-{version}.tar.gz'
depends = ["setuptools"]
site_packages_name = 'yaml'
call_hostpython_via_targetpython = False
recipe = PyamlRecipe()... | kivy/python-for-android | pythonforandroid/recipes/pyaml/__init__.py | Python | mit | 321 |
while(True):
n = input()
if(n == 42):
break
else:
print n | aqfaridi/Code-Online-Judge | web/env/Main1145/Main1145.py | Python | mit | 90 |
"""
Copyright (c) 2016 Keith Sterling
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, distribute,... | dkamotsky/program-y | src/programy/utils/classes/loader.py | Python | mit | 1,706 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | sjsucohort6/openstack | python/venv/lib/python2.7/site-packages/neutronclient/tests/functional/test_clientlib.py | Python | mit | 3,224 |
# Julia domain for Sphinx
# http://sphinx.pocoo.org/domains.html
import re
import sphinx.domains.python
sphinx.domains.python.py_sig_re = re.compile(
r'''^ ([\w.]+\.)? # class name(s)
([^\s(]+) \s* # thing name
(?: \((.*)\) # optional: arguments
(?:\s* ... | tom--lee/Jumos.jl | doc/_ext_/juliadoc/julia.py | Python | mpl-2.0 | 698 |
"""
Code related to the handling of Proctored Exams in Studio
"""
import logging
import six
from django.conf import settings
from edx_proctoring.api import (
create_exam,
create_exam_review_policy,
get_all_exams_for_course,
get_exam_by_content_id,
remove_review_policy,
update_exam,
update... | edx-solutions/edx-platform | cms/djangoapps/contentstore/proctoring.py | Python | agpl-3.0 | 5,635 |
from myhdl import *
from myhdl.conversion import analyze
DESCENDING, ASCENDING = False, True
def compare(a1, a2, z1, z2, dir):
@always_comb
def logic():
z1.next = a1
z2.next = a2
if dir == (a1 > a2):
z1.next = a2
z2.next = a1
return logic
... | forrestv/myhdl | example/cookbook/bitonic/bitonic.py | Python | lgpl-2.1 | 2,041 |
##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | EmreAtes/spack | var/spack/repos/builtin/packages/sga/package.py | Python | lgpl-2.1 | 2,703 |
#!/usr/bin/env python
import os
import sys
import xapi
import xapi.storage.api.plugin
from xapi.storage import log
class Implementation(xapi.storage.api.plugin.Plugin_skeleton):
def query(self, dbg):
return {
"plugin": "tapdisk",
"name": "The tapdisk user-space datapath plugin",
... | jjd27/xapi-storage-datapath-plugins | src/tapdisk/plugin.py | Python | lgpl-2.1 | 1,061 |
# encoding: utf-8
from __future__ import unicode_literals
import json
import re
import itertools
from .common import InfoExtractor
from ..compat import (
compat_HTTPError,
compat_urlparse,
)
from ..utils import (
encode_dict,
ExtractorError,
InAdvancePagedList,
int_or_none,
RegexNotFoundEr... | citassa1985/youtube-dl | youtube_dl/extractor/vimeo.py | Python | unlicense | 28,337 |
"""Platform to control a Zehnder ComfoAir Q350/450/600 ventilation unit."""
import logging
from pycomfoconnect import (
SENSOR_BYPASS_STATE,
SENSOR_DAYS_TO_REPLACE_FILTER,
SENSOR_FAN_EXHAUST_DUTY,
SENSOR_FAN_EXHAUST_FLOW,
SENSOR_FAN_EXHAUST_SPEED,
SENSOR_FAN_SUPPLY_DUTY,
SENSOR_FAN_SUPPLY_F... | tchellomello/home-assistant | homeassistant/components/comfoconnect/sensor.py | Python | apache-2.0 | 9,175 |
# Copyright (c) 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... | leeseuljeong/leeseulstack_neutron | neutron/api/v2/attributes.py | Python | apache-2.0 | 28,875 |
# -*- coding: utf-8 -*-
###############################################################################
#
# GetInstance
# Retrieves information about the specified Instance.
#
# Python versions 2.6, 2.7, 3.x
#
# Copyright 2014, Temboo Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may n... | jordanemedlock/psychtruths | temboo/core/Library/Google/ComputeEngine/Instances/GetInstance.py | Python | apache-2.0 | 5,317 |
from modularodm.exceptions import ValidationValueError
def copy_files(src, target_node, parent=None, name=None):
"""Copy the files from src to the target node
:param Folder src: The source to copy children from
:param Node target_node: The node settings of the project to copy files to
:param Folder pa... | arpitar/osf.io | website/files/utils.py | Python | apache-2.0 | 3,388 |
# 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... | Acehaidrey/incubator-airflow | tests/providers/amazon/aws/operators/test_glue_crawler.py | Python | apache-2.0 | 3,458 |
# 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... | ghchinoy/tensorflow | tensorflow/python/training/saving/functional_saver_test.py | Python | apache-2.0 | 5,040 |
# Licensed to the StackStorm, Inc ('StackStorm') 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 use th... | punalpatel/st2 | st2api/st2api/controllers/v1/auth.py | Python | apache-2.0 | 8,136 |
"""
This file is to provide a unifed testing framework for NEXT.
"""
import requests
import os
import json
import time
import numpy as np
HOSTNAME = os.environ.get('NEXT_BACKEND_GLOBAL_HOST', 'localhost') \
+ ':' + os.environ.get('NEXT_BACKEND_GLOBAL_PORT', '8000')
def initExp(initExp_args_dict, assert_20... | sumeetsk/NEXT-1 | next/apps/test_utils.py | Python | apache-2.0 | 5,270 |
from temboo.Library.GitHub.GistsAPI.Gists.CheckGist import CheckGist, CheckGistInputSet, CheckGistResultSet, CheckGistChoreographyExecution
from temboo.Library.GitHub.GistsAPI.Gists.CreateGist import CreateGist, CreateGistInputSet, CreateGistResultSet, CreateGistChoreographyExecution
from temboo.Library.GitHub.GistsAPI... | jordanemedlock/psychtruths | temboo/core/Library/GitHub/GistsAPI/Gists/__init__.py | Python | apache-2.0 | 1,595 |
#
# 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
# ... | miguelgrinberg/heat | heat/engine/clients/os/trove.py | Python | apache-2.0 | 4,752 |
# 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... | hfp/tensorflow-xsmm | tensorflow/contrib/lookup/lookup_ops_test.py | Python | apache-2.0 | 106,863 |
from onadata.apps.logger.models.attachment import Attachment # flake8: noqa
from onadata.apps.logger.models.instance import Instance
from onadata.apps.logger.models.survey_type import SurveyType
from onadata.apps.logger.models.xform import XForm
from onadata.apps.logger.xform_instance_parser import InstanceParseError
... | jomolinare/kobocat | onadata/apps/logger/models/__init__.py | Python | bsd-2-clause | 437 |
import requests
from cStringIO import StringIO
from PIL import Image
from django.conf import settings
from django.core.files.storage import get_storage_class
from django.core.files.base import ContentFile
from tempfile import NamedTemporaryFile
from onadata.libs.utils.viewer_tools import get_path
def flat(*nums):... | piqoni/onadata | onadata/libs/utils/image_tools.py | Python | bsd-2-clause | 3,265 |
import numpy as np
import sympy as sy
from bokeh.core.properties import value
from bokeh.io import curdoc
from bokeh.layouts import column, widgetbox
from bokeh.models import ColumnDataSource, Legend, LegendItem, Slider, TextInput, PreText
from bokeh.plotting import figure
xs = sy.Symbol('x')
expr = sy.exp(-xs)*sy.si... | dennisobrien/bokeh | examples/app/taylor.py | Python | bsd-3-clause | 2,101 |
from __future__ import absolute_import
import six
from sentry.api.serializers import Serializer, register
from sentry.models import ReleaseFile
@register(ReleaseFile)
class ReleaseFileSerializer(Serializer):
def serialize(self, obj, attrs, user):
return {
'id': six.text_type(obj.id),
... | alexm92/sentry | src/sentry/api/serializers/models/release_file.py | Python | bsd-3-clause | 515 |
from django.conf.urls import url
from django.contrib.auth import views as auth_views
from django.contrib.auth.forms import AuthenticationForm
from oscar.core.application import (
DashboardApplication as BaseDashboardApplication)
from oscar.core.loading import get_class
class DashboardApplication(BaseDashboardApp... | sonofatailor/django-oscar | src/oscar/apps/dashboard/app.py | Python | bsd-3-clause | 2,615 |
from django.contrib import admin
from django.utils.encoding import smart_text
from import_export.admin import ExportMixin
from remo.dashboard.models import ActionItem
def encode_action_item_names(modeladmin, request, queryset):
for obj in queryset:
ActionItem.objects.filter(pk=obj.id).update(name=smart_... | tsmrachel/remo | remo/dashboard/admin.py | Python | bsd-3-clause | 835 |
#!/usr/bin/env python
# Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All c... | wangscript/libjingle-1 | trunk/third_party/webrtc/tools/barcode_tools/barcode_decoder.py | Python | bsd-3-clause | 10,771 |
"""
Implementation of Rabin-Karp search on a given string.
Rabin-Karp Search
-----------------
Search for a substring in a given string, by comparing hash values
of the strings.
Time Complexity: O(nm)
Psuedo Code: http://en.wikipedia.org/wiki/Rabin-Karp_algorithm
"""
from hashlib import... | rexshihaoren/algorithms | algorithms/searching/rabinkarp_search.py | Python | bsd-3-clause | 950 |
from pywin.mfc import dialog
import win32api
import win32con
import win32ui
import copy
import string
from . import scintillacon
# Used to indicate that style should use default color
from win32con import CLR_INVALID
######################################################
# Property Page for syntax formatting options
... | sserrot/champion_relationships | venv/Lib/site-packages/pythonwin/pywin/scintilla/configui.py | Python | mit | 9,244 |
from __future__ import absolute_import, division, print_function
import matplotlib
import numpy as np
import os
import subprocess
import sys
import tempfile
matplotlib.use('pdf')
import matplotlib.pyplot as plt
from dragonn.metrics import ClassificationResult
from keras.layers.core import (Activation, Dense, Dropout, F... | Agent007/deepchem | contrib/dragonn/models.py | Python | mit | 16,267 |
"""add pjsip endpoint_identifier_order
Revision ID: 45e3f47c6c44
Revises: 945b1098bdd
Create Date: 2015-03-02 09:32:20.632015
"""
# revision identifiers, used by Alembic.
revision = '45e3f47c6c44'
down_revision = '945b1098bdd'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_column('ps_glo... | leedm777/asterisk | contrib/ast-db-manage/config/versions/45e3f47c6c44_add_pjsip_endpoint_identifier_order.py | Python | gpl-2.0 | 462 |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2002-2007 Donald N. Allingham
# Copyright (C) 2007-2008 Brian G. Matherly
# Copyright (C) 2008 Jerome Rapinat
# Copyright (C) 2008 Benny Malengier
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the ... | beernarrd/gramps | gramps/gen/filters/rules/family/_hasnote.py | Python | gpl-2.0 | 1,759 |
"""
Imitate the parser representation.
"""
import inspect
import re
import sys
import os
from functools import partial
from jedi._compatibility import builtins as _builtins, unicode
from jedi import debug
from jedi.cache import underscore_memoization, memoize_method
from jedi.parser.tree import Param, Base, Operator, ... | snakeleon/YouCompleteMe-x86 | third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/evaluate/compiled/__init__.py | Python | gpl-3.0 | 17,309 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | ctrlaltdel/neutrinator | vendor/keystoneauth1/tests/unit/k2k_fixtures.py | Python | gpl-3.0 | 5,454 |
import traceback
from abc import ABCMeta, abstractmethod
class Protocol(object):
"""Backend for a specific browser-control protocol.
Each Protocol is composed of a set of ProtocolParts that implement
the APIs required for specific interactions. This reflects the fact
that not all implementaions will... | peterjoel/servo | tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/executors/protocol.py | Python | mpl-2.0 | 10,206 |
"""
Computes the data to display on the Instructor Dashboard
"""
from courseware import models
from django.db.models import Count
from django.utils.translation import ugettext as _
from xmodule.course_module import CourseDescriptor
from xmodule.modulestore.django import modulestore
from xmodule.modulestore.inheritanc... | XiaodunServerGroup/ddyedx | lms/djangoapps/class_dashboard/dashboard_data.py | Python | agpl-3.0 | 15,860 |
"""add end_points and hosts tables
Revision ID: 1414da92b3ca
Revises: 42185d6d93cb
Create Date: 2015-04-20 11:49:17.783924
"""
# revision identifiers, used by Alembic.
revision = '1414da92b3ca'
down_revision = '42185d6d93cb'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto gener... | TeXitoi/navitia | source/tyr/migrations/versions/1414da92b3ca_add_end_point_and_host.py | Python | agpl-3.0 | 2,048 |
from __future__ import absolute_import
import re
import math
import contextlib
from .LineTransformProcessor import LineTransformProcessor
import makerbot_driver
class AnchorProcessor(LineTransformProcessor):
def __init__(self):
super(AnchorProcessor, self).__init__()
self.is_bundleable = True
... | madhuni/AstroBox | src/ext/makerbot_driver/GcodeProcessors/AnchorProcessor.py | Python | agpl-3.0 | 5,212 |
##############################################################################
# Copyright (c) 2017, Los Alamos National Security, LLC
# Produced at the Los Alamos National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-647188
#
# For details, ... | skosukhin/spack | var/spack/repos/builtin/packages/berkeley-db/package.py | Python | lgpl-2.1 | 2,089 |
# coding=utf-8
# Module arial_narrow_16
# generated from Arial Narrow 12pt
name = "Arial Narrow 16"
start_char = '!'
end_char = chr(127)
char_height = 16
space_width = 8
gap_width = 2
bitmaps = (
# @0 '!' (1 pixels wide)
0x00, #
0x80, # O
0x80, # O
0x80, # O
0x80, # O
0x80, ... | HudsonWerks/OLED-SSD1306 | ssd1306/fonts/arial_narrow_16.py | Python | lgpl-3.0 | 52,921 |
# Copyright 2014 Hewlett-Packard Development Company, L.P.
# 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... | HybridF5/tempest_debug | tempest/tests/lib/fake_auth_provider.py | Python | apache-2.0 | 1,268 |
# 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/data/experimental/kernel_tests/optimization/shuffle_and_repeat_fusion_test.py | Python | apache-2.0 | 2,195 |
"""
MessageBird platform for notify component.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/notify.message_bird/
"""
import logging
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.components.notify imp... | HydrelioxGitHub/home-assistant | homeassistant/components/notify/message_bird.py | Python | apache-2.0 | 2,062 |
""" generic tests from the Datetimelike class """
import numpy as np
import pandas as pd
from pandas.util import testing as tm
from pandas import Series, Index, DatetimeIndex, date_range
from ..datetimelike import DatetimeLike
class TestDatetimeIndex(DatetimeLike):
_holder = DatetimeIndex
def setup_method(... | NixaSoftware/CVis | venv/lib/python2.7/site-packages/pandas/tests/indexes/datetimes/test_datetimelike.py | Python | apache-2.0 | 2,661 |
#!/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 "Li... | snowflakedb/spark-snowflake | legacy/dev/merge_pr.py | Python | apache-2.0 | 18,840 |
#!/usr/bin/python
# Copyright (c) 2011 The Chromium OS 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 tests for the table module."""
import cStringIO
import os
import sys
import tempfile
sys.path.insert(0, os.path.dirname(os... | zhang0137/chromite | lib/table_unittest.py | Python | bsd-3-clause | 12,584 |
from __future__ import absolute_import
from django.core.urlresolvers import reverse
from exam import fixture
from sentry.models import Organization, OrganizationMember
from sentry.testutils import TestCase
class CreateOrganizationTest(TestCase):
@fixture
def path(self):
return reverse('sentry-create... | JamesMura/sentry | tests/sentry/web/frontend/test_create_organization.py | Python | bsd-3-clause | 1,205 |
# $Id: tns.py 23 2006-11-08 15:45:33Z dugsong $
# -*- coding: utf-8 -*-
"""Transparent Network Substrate."""
import dpkt
class TNS(dpkt.Packet):
__hdr__ = (
('length', 'H', 0),
('pktsum', 'H', 0),
('type', 'B', 0),
('rsvd', 'B', 0),
('hdrsum', 'H', 0),
('msg', '0s'... | lkash/test | dpkt/tns.py | Python | bsd-3-clause | 1,079 |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
import re
import logging
from flexget import plugin
from flexget.event import event
from flexget.plugins.internal.urlrewriting import UrlRewritingError
from flexget.utils.... | jawilson/Flexget | flexget/plugins/sites/frenchtorrentdb.py | Python | mit | 2,131 |
from __future__ import unicode_literals
import os.path
from pre_commit.commands.clean import clean
from pre_commit.util import rmtree
def test_clean(runner_with_mocked_store):
assert os.path.exists(runner_with_mocked_store.store.directory)
clean(runner_with_mocked_store)
assert not os.path.exists(runner... | Teino1978-Corp/pre-commit | tests/commands/clean_test.py | Python | mit | 711 |
#
# Autogenerated by Thrift Compiler (0.7.0)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
from thrift.Thrift import *
from ttypes import *
VERSION = "19.35.0"
| driftx/Telephus | telephus/cassandra/constants.py | Python | mit | 187 |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2007 Donald N. Allingham
# Copyright (C) 2013-2014 Vassilii Khachaturov
#
# 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; eit... | SNoiraud/gramps | gramps/gen/lib/test/date_test.py | Python | gpl-2.0 | 22,594 |
#!/usr/bin/env python
import amr
import sys
import subprocess
import smatch_modified
import os
import random
import time
#import optparse
#import argparse #argparse only works for python 2.7. If you are using older versin of Python, you can use optparse instead.
#import locale
ERROR_LOG=sys.stderr
verbose=False
isi... | VladimirVystupkin/AMRParsing1.x | smatch_v1_0/smatch-table.py | Python | gpl-2.0 | 12,971 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from email.utils import formataddr
from odoo.addons.test_mail.tests import common
class TestChannelPartnersNotification(common.MockEmails):
def _join_channel(self, channel, partners):
for partner in partner... | t3dev/odoo | addons/test_mass_mailing/tests/test_mail_channel.py | Python | gpl-3.0 | 2,012 |
#
# Copyright 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... | camradal/ansible | lib/ansible/plugins/action/ios_config.py | Python | gpl-3.0 | 926 |
"""
This file contains tasks that are designed to perform background operations on the
running state of a course.
"""
import json
from time import time
from sys import exc_info
from traceback import format_exc
from celery import current_task
from celery.utils.log import get_task_logger
from celery.signals import wor... | PepperPD/edx-pepper-platform | lms/djangoapps/instructor_task/tasks_helper.py | Python | agpl-3.0 | 18,210 |
# -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
from openerp import models, fields
class infrast... | fevxie/odoo-infrastructure | infrastructure/models/docker_image.py | Python | agpl-3.0 | 2,128 |
# Generated by Django 1.11.16 on 2018-11-14 12:15
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("zerver", "0191_realm_seat_limit"),
]
operations = [
migrations.AddField(
model_name="customprofilefieldvalue",
nam... | andersk/zulip | zerver/migrations/0192_customprofilefieldvalue_rendered_value.py | Python | apache-2.0 | 418 |
from __future__ import unicode_literals
try:
from urlparse import urlparse
except ImportError:
from urllib.parse import urlparse
from oauthlib.common import add_params_to_uri, urldecode
from oauthlib.oauth1 import SIGNATURE_HMAC, SIGNATURE_TYPE_AUTH_HEADER
import requests
from . import OAuth1
import sys
if ... | gquirozbogner/contentbox-master | third_party/requests_oauthlib/oauth1_session.py | Python | apache-2.0 | 12,076 |
# Copyright ClusterHQ Inc. See LICENSE file for details.
"""
Helper module to provide macros for logging support
for storage drivers (AWS, Cinder).
See https://clusterhq.atlassian.net/browse/FLOC-2053
for consolidation opportunities.
"""
from eliot import Field, ActionType, MessageType
# Begin: Common structures us... | achanda/flocker | flocker/node/agents/_logging.py | Python | apache-2.0 | 5,427 |
#!/usr/bin/env python
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2012 NEC Corporation.
# Based on ryu/openvswitch agents.
#
# Copyright 2012 Isaku Yamahata <yamahata at private email ne jp>
# Copyright 2011 Nicira Networks, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0... | CiscoSystems/vespa | neutron/plugins/nec/agent/nec_neutron_agent.py | Python | apache-2.0 | 8,945 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import codecs
import importlib
import os
import shutil
from django.apps import apps
from django.core.management import CommandError, call_command
from django.db import DatabaseError, connection, models
from django.db.migrations import questioner
from dja... | abhattad4/Digi-Menu | tests/migrations/test_commands.py | Python | bsd-3-clause | 37,861 |
from django.contrib import messages
from django.contrib.auth import logout
from django.shortcuts import render_to_response, render
from django.http import HttpResponseRedirect
from django.template import RequestContext
from django.forms import ValidationError
from django.core.urlresolvers import reverse
from allauth.u... | agconti/njode | env/lib/python2.7/site-packages/allauth/socialaccount/helpers.py | Python | bsd-3-clause | 5,989 |
# -*- encoding: utf-8 -*-
from pygithub3.requests.base import Request
from pygithub3.resources.git_data import Tag
class Get(Request):
uri = 'repos/{user}/{repo}/git/tags/{sha}'
resource = Tag
class Create(Request):
uri = 'repos/{user}/{repo}/git/tags'
resource = Tag
body_schema = {
'sc... | dongguangming/python-github3 | pygithub3/requests/git_data/tags.py | Python | isc | 412 |
from importlib import import_module
import math
import os
from PIL import Image, ImageDraw, ImageColor, ImageFont, ImageFilter
from misago.conf import settings
from misago.users.avatars import store
def set_avatar(user):
name_bits = settings.MISAGO_DYNAMIC_AVATAR_DRAWER.split('.')
drawer_module = '.'.join... | 390910131/Misago | misago/users/avatars/dynamic.py | Python | gpl-2.0 | 2,147 |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsSymbolLayerUtils.
.. 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.
"... | NaturalGIS/QGIS | tests/src/python/test_qgssymbollayerutils.py | Python | gpl-2.0 | 7,685 |
"""
Tests for the InstructorService
"""
import json
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory
from courseware.models import StudentModule
from instructor.services import InstructorService
from instructor.tests.test_tools import ... | jazztpt/edx-platform | lms/djangoapps/instructor/tests/test_services.py | Python | agpl-3.0 | 3,469 |
"""
Certificate HTML webview.
"""
from datetime import datetime
from uuid import uuid4
import logging
import urllib
from django.conf import settings
from django.contrib.auth.models import User
from django.http import HttpResponse
from django.template import RequestContext
from django.utils.translation import ugettext ... | don-github/edx-platform | lms/djangoapps/certificates/views/webview.py | Python | agpl-3.0 | 23,455 |
#! /usr/bin/env python
from __future__ import print_function
from openturns import *
TESTPREAMBLE()
try:
meixner = MeixnerFactory(10, 0.3)
for i in range(10):
print("meixner(", i, ")=", meixner.build(i))
roots = meixner.getRoots(10)
print("meixner(10) roots=", repr(roots))
nodes, weights ... | aurelieladier/openturns | python/test/t_MeixnerFactory_std.py | Python | lgpl-3.0 | 515 |
"""Shared OS X support functions."""
import os
import re
import sys
__all__ = [
'compiler_fixup',
'customize_config_vars',
'customize_compiler',
'get_platform_osx',
]
# configuration variables that may contain universal build flags,
# like "-arch" or "-isdkroot", that may need customization for
# the... | lfcnassif/MultiContentViewer | release/modules/ext/libreoffice/program/python-core-3.3.0/lib/_osx_support.py | Python | lgpl-3.0 | 18,472 |
#!/usr/bin/env python
# Copyright (C) 2010-2011 Hideo Hattori
# Copyright (C) 2011-2013 Hideo Hattori, Steven Myint
# Copyright (C) 2013-2015 Hideo Hattori, Steven Myint, Bill Wendling
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files... | JetChars/vim | vim/bundle/python-mode/pymode/autopep8.py | Python | apache-2.0 | 120,700 |
#!/usr/bin/python2.4
#
# Copyright 2008 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | damonkohler/statsmonkey | tests/db_test.py | Python | apache-2.0 | 2,354 |
# Copyright 2016 Pinterest, 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... | lilida/teletraan | deploy-agent/tests/unit/deploy/staging/test_helper.py | Python | apache-2.0 | 4,299 |
#!/usr/bin/env python
# Copyright 2009-2014 Eucalyptus Systems, 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 app... | nephomaniac/eucio | eucio/topology/userfacing/__init__.py | Python | apache-2.0 | 611 |