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 |
|---|---|---|---|---|---|
"""
Unit tests for instructor_dashboard.py.
"""
import datetime
import re
import ddt
import six
from django.conf import settings
from django.contrib.sites.models import Site
from django.test.utils import override_settings
from django.urls import reverse
from mock import patch
from pyquery import PyQuery as pq
from p... | edx-solutions/edx-platform | lms/djangoapps/instructor/tests/views/test_instructor_dashboard.py | Python | agpl-3.0 | 27,999 |
"""luigi target for writing data into an HP Vertica database"""
import logging
import luigi
logger = logging.getLogger('luigi-interface') # pylint: disable-msg=C0103
try:
import vertica_python
except ImportError:
logger.warning("Attempted to load Vertica interface tools without the vertica_python package; w... | sssllliang/edx-analytics-pipeline | edx/analytics/tasks/util/vertica_target.py | Python | agpl-3.0 | 5,187 |
# -*- coding: utf-8 -*-
# Copyright (C) 2014-2016 Andrey Antukh <niwi@niwi.nz>
# Copyright (C) 2014-2016 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014-2016 David Barragán <bameda@dbarragan.com>
# Copyright (C) 2014-2016 Alejandro Alonso <alejandro.alonso@kaleidos.net>
# This program is free software: you can r... | xdevelsistemas/taiga-back-community | taiga/projects/issues/apps.py | Python | agpl-3.0 | 3,000 |
"""
Unit tests for course import and export Celery tasks
"""
import copy
import json
from unittest import mock
from uuid import uuid4
from django.conf import settings
from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user
from django.test.utils import override_settings
from o... | eduNEXT/edunext-platform | cms/djangoapps/contentstore/tests/test_tasks.py | Python | agpl-3.0 | 6,906 |
class WrongKeyError(Exception):
pass
| zerodb/zerodb | zerodb/crypto/exceptions.py | Python | agpl-3.0 | 41 |
# GUI Application automation and testing library
# Copyright (C) 2015 Intel Corporation
# Copyright (C) 2006 Mark Mc Mahon
#
# 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 Foundation; either version... | gagoncal/Selenium | pywinauto/examples/windowmediaplayer.py | Python | lgpl-2.1 | 2,572 |
#!/usr/bin/env python2
#
# Yapps 2 - yet another python parser system
# Copyright 1999-2003 by Amit J. Patel <amitp@cs.stanford.edu>
#
# This version of Yapps 2 can be distributed under the
# terms of the MIT open source license, either found in the LICENSE file
# included with the Yapps distribution
# <http://theory.... | swesterfeld/beast | yapps2_deb/yapps2.py | Python | lgpl-2.1 | 4,135 |
#!/usr/bin/env python
###
### This file is generated automatically by SALOME v9.7.0 with dump python functionality
###
import sys
import salome
salome.salome_init()
import salome_notebook
notebook = salome_notebook.NoteBook()
sys.path.insert(0, r'/home/student/software/femus/applications/2021_fall/hdongamm/input')
... | giorgiobornia/femus | applications/2021_fall/hdongamm/input/parametric_squre_himali2.py | Python | lgpl-2.1 | 2,834 |
#!/usr/bin/env python
from PyQt5.QtWidgets import QTextEdit, QMenu, QFileDialog, QSizePolicy
import mooseutils
class TerminalTextEdit(QTextEdit):
"""
A readonly text edit that replaces terminal codes with appropiate html codes.
Also uses fixed font.
"""
def __init__(self, **kwds):
super(Ter... | backmari/moose | python/peacock/Execute/TerminalTextEdit.py | Python | lgpl-2.1 | 1,846 |
import sys
def setup(core, object):
return
#Painting of the Lucky Despot Wreckage | agry/NGECore2 | scripts/object/tangible/painting/painting_bestine_lucky_despot.py | Python | lgpl-3.0 | 86 |
#!/usr/bin/env python3
print('ping/__init__.py')
import ping
| errror/SlackRTMBot | slott/plugins/ping/__init__.py | Python | lgpl-3.0 | 63 |
# coding: utf-8
"""
mistune
~~~~~~~
The fastest markdown parser in pure Python with renderer feature.
:copyright: (c) 2014 by Hsiaoming Yang.
"""
import re
import inspect
__version__ = '0.4.1'
__author__ = 'Hsiaoming Yang <me@lepture.com>'
__all__ = [
'BlockGrammar', 'BlockLexer',
'InlineGra... | neuroo/equip | examples/sample-test-program/test_module/mistune.py | Python | apache-2.0 | 31,391 |
# 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 t... | blueboxgroup/keystone | keystone/tests/test_revoke.py | Python | apache-2.0 | 24,633 |
# -*- coding: utf-8 -*-
import os
import logging
import datetime
import sys
from django.utils import timezone
from website import settings
def format_now():
return timezone.now().isoformat()
def add_file_logger(logger, script_name, suffix=None):
_, name = os.path.split(script_name)
name = name.rstrip... | caneruguz/osf.io | scripts/utils.py | Python | apache-2.0 | 1,318 |
# Copyright 2021 Google 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | googleapis/python-aiplatform | samples/model-builder/create_training_pipeline_custom_job_sample.py | Python | apache-2.0 | 2,513 |
# Kubeflow Pipeline with Katib component.
# In this example you will create Katib Experiment using Bayesian optimization algorithm.
# As a Trial template you will use Kubeflow MPIJob with Horovod MNIST training container.
# After that, you will compile a Kubeflow Pipeline with your Katib Experiment.
# Use Kubeflow Pip... | kubeflow/pipelines | samples/contrib/kubeflow-katib/mpi-job-horovod.py | Python | apache-2.0 | 8,891 |
# -*- coding: utf-8 -*-
# Copyright 2020 Google 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... | googleads/google-ads-python | google/ads/googleads/v9/services/services/change_status_service/transports/__init__.py | Python | apache-2.0 | 1,057 |
# -*- coding: utf-8 -*-
# Copyright (c) 2015-2018, Exa Analytics Development Team
# Distributed under the terms of the Apache License 2.0
"""
Tests for Strong Typing
########################
See :mod:`~exa.typed` for more details on how typing works.
"""
import six
import pytest
from itertools import product
from exa.t... | alexvmarch/exa | exa/tests/test_typed.py | Python | apache-2.0 | 3,864 |
from vpp_interface import VppInterface
import socket
class VppGreInterface(VppInterface):
"""
VPP GRE interface
"""
def __init__(self, test, src_ip, dst_ip, outer_fib_id=0, is_teb=0):
""" Create VPP loopback interface """
self._sw_if_index = 0
super(VppGreInterface, self).__i... | milanlenco/vpp | test/vpp_gre_interface.py | Python | apache-2.0 | 2,595 |
#
# 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... | airbnb/airflow | airflow/providers/google/cloud/example_dags/example_cloud_memorystore.py | Python | apache-2.0 | 13,040 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from subprocess import Popen, PIPE
from cmdb.models import Host, HostGroup
from django.shortcuts import render
from django.http import HttpResponse
import os
from config.views import get_dir
from django.contrib.auth.decorators import login_required
from accounts.permissio... | cindywang0728/adminset | setup/ansible.py | Python | apache-2.0 | 8,413 |
from __future__ import print_function
import qt
# Importing vtk initializes vtkPythonMap owned by vtkPythonUtil and prevent
# call to vtkPythonUtil::GetObjectFromPointer() from segfaulting.
# PythonQt internally uses vtkPythonUtil to properly wrap/unwrap VTK objects
from vtk import *
t = _testWrappedVTKQInvokableIns... | SINTEFMedtek/CTK | Applications/ctkSimplePythonShell/Testing/Python/wrappedVTKQInvokableTest.py | Python | apache-2.0 | 531 |
import sys,re,os
import os.path as path
fname_regex = re.compile('diff --git a/(.*) b/')
not_a_line_regex = re.compile('^-')
fname = None
bad_files = []
for line in sys.stdin:
if not_a_line_regex.match(line):
continue
if fname and (not fname in bad_files) and line.find('\r') != -1:
found_bad_newlines = True
b... | marshall/titanium | site_scons/pre-commit.py | Python | apache-2.0 | 1,022 |
#
# 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
# ... | mahak/cinder | cinder/tests/unit/image/test_accelerator.py | Python | apache-2.0 | 3,676 |
# Copyright 2015 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... | waltBB/neutron_read | neutron/agent/metadata_agent.py | Python | apache-2.0 | 1,584 |
from Burst import Burst
import numpy as np
class SB(Burst):
def __init__(self):
self.syncbits = [
0x01, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01,
0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,
0x00, 0x00, 0x01... | ruishihan/R7-with-notes | src/host/python/GSM/SB.py | Python | apache-2.0 | 1,203 |
from proboscis import *
class BeforeAndAfter(object):
def getName(self):
return str(type(self))
def println(self, msg):
print("%s : %s" % (self.getName(), msg))
class BeforeAndAfterSuccess(BeforeAndAfter):
@before_class
def beforeEverything(self):
self.println("@BeforeClass... | rackerlabs/python-proboscis | tests/compatability/testng/before_and_after/src/python/BeforeAndAfter.py | Python | apache-2.0 | 701 |
# Copyright 2013 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.0
#
# Unless required by applicable law or agree... | nttcom/eclcli | eclcli/compute/v2/host.py | Python | apache-2.0 | 2,150 |
# 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... | tqchen/tvm | python/tvm/tir/buffer.py | Python | apache-2.0 | 9,009 |
#coding:UTF-8
"""
API模块,用于对外调用
2015-04-25
"""
from flask import Blueprint,request,jsonify
from lib.db import db,sqlDeal,objToDict
from lib import client
app=Blueprint("api",__name__)
def getAppFromToken(apiKey,secretKey):
"获取应用信息"
sql="select aid from paas_app_token where apiKey = '%s' AND secretKey = '%s'"... | linjinxin/paas | app/api.py | Python | apache-2.0 | 1,134 |
"""Support for deCONZ devices."""
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.const import (
CONF_API_KEY, CONF_HOST, CONF_PORT, EVENT_HOMEASSISTANT_STOP)
from homeassistant.helpers import config_validation as cv
# Loading the config flow file will register the flow
from .... | aequitas/home-assistant | homeassistant/components/deconz/__init__.py | Python | apache-2.0 | 6,477 |
import sys
import os
import random
sys.path.insert(1, os.path.join("..", "..", ".."))
import h2o
from tests import pyunit_utils
from h2o.grid.grid_search import H2OGridSearch
from h2o.estimators.gbm import H2OGradientBoostingEstimator
def grid_parallel():
train = h2o.import_file(path=pyunit_utils.locate("smallda... | michalkurka/h2o-3 | h2o-py/tests/testdir_algos/grid/pyunit_grid_parallel_cv_error.py | Python | apache-2.0 | 1,164 |
#!/usr/bin/env python
# Copyright 2016 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | deepaklukose/grpc | tools/run_tests/artifacts/package_targets.py | Python | apache-2.0 | 4,688 |
# Copyright (c) 2018 PaddlePaddle 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 app... | PaddlePaddle/Paddle | python/paddle/fluid/tests/book/test_recommender_system.py | Python | apache-2.0 | 12,089 |
#!/usr/bin/env python
#
# $Id: _osx.py 1498 2012-07-24 21:41:28Z g.rodola $
#
# Copyright (c) 2009, Jay Loden, Giampaolo Rodola'. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""OSX specific tests. These are implicitly run by test_psutil.py... | sergecodd/FireFox-OS | B2G/gecko/python/psutil/test/_osx.py | Python | apache-2.0 | 4,978 |
#!/usr/bin/env python
from __future__ import absolute_import, division, print_function
import contextlib
import errno
import os
import random
import signal
import socket
import subprocess
import sys
import time
import urllib2
try:
xrange
except NameError:
xrange = range
if __name__ == "__main__":
tornado... | Lancher/tornado | maint/test/appengine/common/runtests.py | Python | apache-2.0 | 1,918 |
# Copyright (c) 2019 PaddlePaddle 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 appli... | PaddlePaddle/Paddle | python/paddle/fluid/tests/unittests/seresnext_test_base.py | Python | apache-2.0 | 2,516 |
from indy import IndyError
from indy import payment
from indy.error import ErrorCode
from tests.payment.constants import *
import pytest
@pytest.mark.asyncio
async def test_build_get_payment_sources_request_works_for_unknown_payment_method(wallet_handle, did_trustee):
with pytest.raises(IndyError) as e:
... | srottem/indy-sdk | wrappers/python/tests/payment/test_build_get_payment_sources_request.py | Python | apache-2.0 | 828 |
# Copyright 2015 Google 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 writing, s... | dhermes/google-cloud-python | dns/tests/unit/test__http.py | Python | apache-2.0 | 2,719 |
import os
PROJECT_ROOT = os.path.normpath(os.path.dirname(os.path.abspath(__file__)))
ROOT_URLCONF = 'smkcpanel.urls'
LOGIN_REDIRECT_URL = '/server'
TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don'... | samukasmk/smkcpanel | smkcpanel_django/smkcpanel/local_settings.py | Python | apache-2.0 | 882 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 Justin Santa Barbara
# 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.apach... | rcbops/nova-buildpackage | nova/image/fake.py | Python | apache-2.0 | 9,011 |
import glob
from subprocess import call
test_failures = {}
test_successes = {}
files = [file for file in glob.glob('../**/build.gradle', recursive=True)]
for f in files:
if f.startswith('../test'):
continue
# clean all projects in the platform before executing build
print("Cleaning all projects f... | IBMStreams/streamsx.health | test/test-builds.py | Python | apache-2.0 | 792 |
from drf_yasg.inspectors import PaginatorInspector
from drf_yasg import openapi
from collections import OrderedDict
class PageNumberPaginatorInspectorClass(PaginatorInspector):
def get_paginated_response(self, paginator, response_schema):
paged_schema = openapi.Schema(
type=openapi.TYPE_OBJECT... | swcurran/TheOrgBook | tob-api/tob_api/inspector.py | Python | apache-2.0 | 1,086 |
from setuptools import setup, find_packages
try:
import pypandoc
long_description = pypandoc.convert('README.md', 'rst')
except (IOError, ImportError):
long_description = ''
setup(
name="pyk",
version="0.3.2",
description="A simple, yet useful Kubernetes toolkit in Python",
long_description=l... | kubernauts/pyk | setup.py | Python | apache-2.0 | 962 |
#!/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
"License");... | alexryndin/ambari | ambari-server/src/main/resources/stacks/BigInsights/4.2/services/HIVE/package/scripts/hcat.py | Python | apache-2.0 | 2,284 |
# Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | davidzchen/tensorflow | tensorflow/python/keras/layers/dense_attention_test.py | Python | apache-2.0 | 34,547 |
# 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... | nathanbjenx/cairis | cairis/test/test_RiskLevelAPI.py | Python | apache-2.0 | 5,044 |
import csv
from spacq.tool.box import flatten
"""
Pulse program helpers.
"""
def find_location(s, loc):
"""
Find where loc (linear index) in s.
Returns:
line number
column number
line itself
Note: Tabs are not handled specially.
"""
if loc < 0 or loc > len(s):
raise ValueError('Location given ({0})... | 0/SpanishAcquisition | spacq/interface/pulse/tool/box.py | Python | bsd-2-clause | 1,290 |
# -*- coding: utf-8 -*-
# Copyright 2016-2017 Rumma & Ko Ltd
# License: BSD (see file COPYING for details)
"""Runs some tests about the notification framework.
You can run only these tests by issuing::
$ go team
$ python manage.py test tests.test_notify
Or::
$ go noi
$ python setup.py test -s tests.Project... | lino-framework/book | lino_book/projects/eric/tests/test_notify.py | Python | bsd-2-clause | 5,765 |
"""Conversion tool from SQD to FIF
RawKIT class is adapted from Denis Engemann et al.'s mne_bti2fiff.py
"""
# Author: Teon Brooks <teon@nyu.edu>
#
# License: BSD (3-clause)
import os
from os import SEEK_CUR
from struct import unpack
import time
import numpy as np
from scipy import linalg
from ..pick import pick_t... | jaeilepp/eggie | mne/io/kit/kit.py | Python | bsd-2-clause | 28,437 |
# pylint: disable=W0511
# 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.
#
# This program is distributed in the hope that... | isohybrid/dotfile | vim/bundle/git:--github.com-klen-python-mode/pylibs/pylint/checkers/misc.py | Python | bsd-2-clause | 2,594 |
# -*- coding: utf-8 -*-
import math
import random
def average(data):
return sum(data) * 1.0 / len(data)
def variance(data):
avg = average(data)
var = map(lambda x: (x - avg)**2, data)
return average(var)
def standard_deviation(data):
return math.sqrt(variance(data))
def get_variance_range(... | emotrix/Emotrix | emotrix/helpers.py | Python | bsd-2-clause | 934 |
from challonge import api
def index(tournament, **params):
"""Retrieve a tournament's match list."""
return api.fetch_and_parse(
"GET",
"tournaments/%s/matches" % tournament,
**params)
def show(tournament, match_id):
"""Retrieve a single match record for a tournament."""
retu... | AJAnderson/pychallonge | challonge/matches.py | Python | bsd-2-clause | 662 |
import calendar
from flask_appbuilder import ModelView
from flask_appbuilder.charts.views import GroupByChartView
from flask_appbuilder.models.group import aggregate_count
from flask_appbuilder.models.sqla.interface import SQLAInterface
from . import appbuilder, db
from .models import Contact, ContactGroup
class C... | dpgaspar/Flask-AppBuilder | examples/enums/app/views.py | Python | bsd-3-clause | 3,436 |
from jinja2 import Markup
from canvas.templatetags.jinja_base import (global_tag, filter_tag, render_jinja_to_string,
jinja_context_tag, update_context)
@jinja_context_tag
def post_thread_form(context, show_start_options=True):
ctx = {
'show_start_options': bool(... | canvasnetworks/canvas | website/apps/post_thread/jinja_tags.py | Python | bsd-3-clause | 458 |
# -*- coding:utf-8 -*-
import unittest
import mock
from ...haystack.utils import get_indexes
class GetIndexesTestCase(unittest.TestCase):
@mock.patch('libs.haystack.utils.connections')
@mock.patch('libs.haystack.utils.connection_router.for_write')
def test_get_indexes_should_yield_get_index(
... | hellhovnd/dentexchange | dentexchange/apps/libs/tests/haystack/test_get_indexes.py | Python | bsd-3-clause | 1,159 |
''' Constants and classes for matlab 5 read and write
See also mio5_utils.pyx where these same constants arise as c enums.
If you make changes in this file, don't forget to change mio5_utils.pyx
'''
from __future__ import division, print_function, absolute_import
import numpy as np
from .miobase import convert_dtyp... | jamestwebber/scipy | scipy/io/matlab/mio5_params.py | Python | bsd-3-clause | 7,077 |
import time
from PIL import Image
from . import test_image, test_black_image, angle_to_page
from tomviz.acquisition.utility import tobytes
img = Image.open(test_image())
black = test_black_image().read()
connected = False
current_frame = None
def connect():
global connected
connected = True
return conne... | mathturtle/tomviz | acquisition/tests/mock/mock_api.py | Python | bsd-3-clause | 1,036 |
# -*- coding: utf-8 -*-
from ionyweb.website.rendering.utils import render_view
def index_view(request, plugin):
return render_view(
plugin.get_templates('plugin_text/index.html'),
{'object': plugin})
| makinacorpus/ionyweb | ionyweb/plugin_app/plugin_text/views.py | Python | bsd-3-clause | 222 |
# -*- coding: utf-8 -*-
from os.path import dirname, relpath, join
from nose.tools import assert_equals, assert_is_instance, \
assert_raises_regexp, with_setup
from diylang.interpreter import interpret, interpret_file
from diylang.types import Environment, String, DiyLangError, Closure
from diylang.parser import... | kvalle/diy-lisp | tests/test_8_final_touches.py | Python | bsd-3-clause | 10,487 |
"""
The managers for the custom Account object and permissions.
"""
import datetime
from django.utils import timezone
from django.contrib.auth.models import UserManager
from evennia.typeclasses.managers import TypedObjectManager, TypeclassManager
__all__ = ("AccountManager",)
#
# Account Manager
#
class AccountDB... | jamesbeebop/evennia | evennia/accounts/manager.py | Python | bsd-3-clause | 5,390 |
from django.core.exceptions import ValidationError, ObjectDoesNotExist
from django.db import models
# pylint: disable-msg=E0611
from hashlib import md5
from metashare.settings import LOG_HANDLER
from metashare import settings
from os import mkdir
from os.path import exists
import os.path
from uuid import uuid1... | MiltosD/CEF-ELRC | metashare/storage/models.py | Python | bsd-3-clause | 28,959 |
from lib.common import helpers
class Module:
def __init__(self, mainMenu, params=[]):
self.info = {
'Name': 'Get-NetLocalGroup',
'Author': ['@harmj0y'],
'Description': ('Returns a list of all current users in a specified local group '
'on ... | Hackplayers/Empire-mod-Hpys-tests | lib/modules/powershell/situational_awareness/network/powerview/get_localgroup.py | Python | bsd-3-clause | 4,013 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" erppeek.py -- Odoo / OpenERP client library and command line tool
Author: Florent Xicluna
(derived from a script by Alan Bell)
"""
import _ast
import atexit
import collections
import csv
import functools
import optparse
import os
from pprint import pprint
import re
imp... | raycarnes/erppeek | erppeek.py | Python | bsd-3-clause | 64,722 |
from __future__ import absolute_import
from enum import Enum
from django.db import models
from django.utils import timezone
from sentry.db.models import FlexibleForeignKey, Model
class QueryAggregations(Enum):
TOTAL = 0
UNIQUE_USERS = 1
class QueryDatasets(Enum):
EVENTS = "events"
class QuerySubscr... | mvaled/sentry | src/sentry/snuba/models.py | Python | bsd-3-clause | 903 |
"""Core connection objects"""
import ast
import sys
import collections
import copy
import logging
import math
import numbers
import platform
import warnings
if sys.version_info > (3,):
import urllib.parse as urlparse # pylint: disable=E0611,F0401
else:
import urlparse
from pika import __version__
from pika i... | zixiliuyue/pika | pika/connection.py | Python | bsd-3-clause | 82,517 |
"""Example views. Feel free to delete this app."""
from django import http
import jingo
def home(request):
data = {}
return jingo.render(request, 'examples/home.html', data)
| haoqili/MozSecWorld | apps/examples/views.py | Python | bsd-3-clause | 186 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2015-12-22 09:34
from django.db import migrations, models
import wagtail.core.models
class Migration(migrations.Migration):
dependencies = [
("wagtailcore", "0023_alter_page_revision_on_delete_behaviour"),
]
operations = [
migrations.... | rsalmaso/wagtail | wagtail/core/migrations/0024_alter_page_content_type_on_delete_behaviour.py | Python | bsd-3-clause | 684 |
#!/usr/bin/env python
import os
import sys
import argparse
import json
# tempate2json.py -k SYSTEM=lonestar.tacc.utexas.edu
# PATH=/home/vaughn/apps -i template.jsonx -o file.json
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument("-k", dest='keys', help='Spac... | iPlantCollaborativeOpenSource/cyverse-sdk | src/scripts/template2json.py | Python | bsd-3-clause | 1,718 |
from nose.tools import eq_, ok_
from django.test import TestCase
from airmozilla.comments.templatetags.jinja_helpers import (
gravatar_src,
obscure_email,
)
class TestHelpers(TestCase):
def test_gravatar_src_http(self):
email = 'peterbe@mozilla.com'
result = gravatar_src(email, False)
... | blossomica/airmozilla | airmozilla/comments/tests/test_jinja_helpers.py | Python | bsd-3-clause | 1,016 |
from __future__ import division
import numpy as np
import pytest
from pandas import Interval, Timedelta, Timestamp
import pandas.core.common as com
@pytest.fixture
def interval():
return Interval(0, 1)
class TestInterval(object):
def test_properties(self, interval):
assert interval.closed == 'rig... | GuessWhoSamFoo/pandas | pandas/tests/scalar/interval/test_interval.py | Python | bsd-3-clause | 7,179 |
""" ListCompToMap transforms list comprehension into intrinsics. """
from pythran.analyses import OptimizableComprehension
from pythran.passmanager import Transformation
from pythran.transformations import NormalizeTuples
import ast
class ListCompToMap(Transformation):
'''
Transforms list comprehension int... | hainm/pythran | pythran/optimizations/list_comp_to_map.py | Python | bsd-3-clause | 2,611 |
#!/usr/bin/python
import logging
class NullHandler(logging.Handler):
def emit(self, record):
pass
log = logging.getLogger('PersistenceEngine')
log.setLevel(logging.ERROR)
log.addHandler(NullHandler())
import time
import threading
import traceback
class PersistenceEngine(threading.Thread):
... | dustcloud/dustlink | DustLinkData/PersistenceEngine.py | Python | bsd-3-clause | 4,768 |
from rpython.rlib import jit
from topaz.module import ClassDef
from topaz.objects.objectobject import W_Object
def create_owner(classdef):
@classdef.method("owner")
def method_owner(self, space):
return self.w_owner
return method_owner
def create_to_s(classdef):
@classdef.method("to_s")
... | topazproject/topaz | topaz/objects/methodobject.py | Python | bsd-3-clause | 3,725 |
#!/usr/bin/env python
"""
Service Subpackage
"""
from . import test
from . import detect
from . import device
from . import object
from . import cov
from . import file
| JoelBender/bacpypes | py34/bacpypes/service/__init__.py | Python | mit | 171 |
# Put your tests in this directory.
| joeatwork/python-lzw | tests/__init__.py | Python | mit | 36 |
# https://www.hackerrank.com/challenges/ctci-balanced-brackets
def is_matched(expression):
stack = []
symbols = {
"}" : "{",
")" : "(",
"]" : "["
}
for c in expression:
# If its an opening symbol, put it in the stack.
if c == "{" or c == "(" or c == "[":
... | zubie7a/Algorithms | HackerRank/Cracking_The_Coding_Interview/Data_Structures/05_Balanced_Brackets.py | Python | mit | 1,286 |
__version__ = "0.1.dev0"
| igordejanovic/textx-tools | txtools/templates/lang/copy/pack_name/__init__.py | Python | mit | 25 |
"""
Gateways connect to Announcer daemons, sending zlib compressed JSON
representations of market data. From here, the Announcer PUBs the messages
out to anyone SUBscribing. This could be Relays, or end-users.
"""
import logging
logger = logging.getLogger(__name__)
import gevent
import zmq.green as zmq
from emdr.conf ... | gtaylor/EVE-Market-Data-Relay | emdr/daemons/announcer/main.py | Python | mit | 1,274 |
import py
import re
from testing.test_interpreter import BaseTestInterpreter
from testing.test_main import TestMain
from hippy.main import entry_point
class TestOptionsMain(TestMain):
def test_version_compare(self, capfd):
output = self.run('''<?php
$versions = array(
'1',
'1.0',
... | xhava/hippyvm | testing/test_options.py | Python | mit | 3,254 |
#!/usr/bin/env python
#
# Copyright 2007-2013 The Python-Twitter Developers
#
# 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 requi... | MosheBerman/brisket-mashup | source/libraries/python-twitter-1.1/setup.py | Python | mit | 2,426 |
# coding=utf-8
"""
Diamond handler that check if values are too high or too low, if so send an
alert to a Sentry server
This handler requires the Python module Raven:
http://raven.readthedocs.org/en/latest/index.html
To work this handler need a similar configuration:
[[SentryHandler]]
# Create a new project in Sen... | datacratic/Diamond-old | src/diamond/handler/sentry.py | Python | mit | 10,698 |
from dxr.testing import DxrInstanceTestCase
class TestEmptyTree(DxrInstanceTestCase):
"""Tests for empty source tree"""
def test_empty(self):
"""Test empty"""
self.found_nothing('path:*.*', is_case_sensitive=False)
| nrc/dxr | tests/test_empty_tree/test_empty_tree.py | Python | mit | 241 |
class Molecule(object):
"""An abstract molecule object. """
def __init__(self, name=None):
"""Initialize the molecule
Args:
name (str): name of the molecule
"""
if not name:
name = "MOL"
self.name = name
self._atoms = list()
def add_... | shirtsgroup/InterMol | intermol/molecule.py | Python | mit | 823 |
# -*-coding:iso-8859-1 -*
try: #If needed, the _path module must add the path to the Narro directory to sys.path so that the Narro Engine can be imported as a package
import _path
except:
pass
from constantes import *
from narro.main import *
from narro.constantes import *
from gestionnaireEvenements import *
... | Rastagong/A-Scholar-In-The-Woods | Releases/Post Compo/Windows build/play.py | Python | mit | 507 |
#!/usr/bin/env python
"""
Demonstrate how to use major and minor tickers.
The two relevant userland classes are Locators and Formatters.
Locators determine where the ticks are and formatters control the
formatting of ticks.
Minor ticks are off by default (NullLocator and NullFormatter). You
can turn minor ticks on w... | lthurlow/Network-Grapher | proj/external/matplotlib-1.2.1/lib/mpl_examples/pylab_examples/major_minor_demo1.py | Python | mit | 1,660 |
from ganeti_webmgr.muddle.tests.apps.load_app_plugin.test_plugin import (
TestPlugin)
class TestPluginFoo(TestPlugin):
pass
class TestPluginBar(TestPlugin):
pass
class NotAPlugin(object):
pass
class NotAPluginEither(NotAPlugin):
pass
AN_INTEGER = 1
A_STRING = 'abc'
| dannyman/ganeti_webmgr | ganeti_webmgr/muddle/tests/apps/load_app_plugin/file_for_testing_load_app_plugin.py | Python | gpl-2.0 | 296 |
# -*- coding: utf-8 -*-
#
# This file is part of Zenodo.
# Copyright (C) 2016 CERN.
#
# Zenodo 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 v... | zenodo/zenodo-migrator | zenodo_migrator/serializers/schemas/__init__.py | Python | gpl-2.0 | 1,061 |
# Copyright (C) 2008 Dirk Vanden Boer <dirk.vdb@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
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later versi... | mayconvm/phonetooth | phonetooth/sms.py | Python | gpl-2.0 | 7,919 |
# 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... | cmouse/buildbot | master/buildbot/test/unit/process/test_buildrequest.py | Python | gpl-2.0 | 28,617 |
# gui_term.py
#
# openipmi GUI terminal handling for SoL
#
# Author: MontaVista Software, Inc.
# Corey Minyard <minyard@mvista.com>
# source@mvista.com
#
# Copyright 2006 MontaVista Software Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU L... | ystk/debian-openipmi | swig/python/openipmigui/gui_term.py | Python | gpl-2.0 | 9,780 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('core_group', '0001_initial'),
('import_google', '0007_googledirectorygroup_identity'),
]
operations = [
migrations.A... | cnbird1999/ava | ava/import_google/migrations/0008_googledirectorygroup_group.py | Python | gpl-2.0 | 502 |
#!/usr/bin/env python2.7
# Copyright 2014, VIXL authors
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this l... | MerryMage/dynarmic | externals/vixl/vixl/tools/printer.py | Python | gpl-2.0 | 4,754 |
# -*- coding: utf-8 -*-
# Copyright (c) 2010 - Luca Invernizzi <invernizzi.l@gmail.com>
# 2012 - Izidor Matušov <izidor.matusov@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 the Free Software
# Fou... | partp/gtg-services | GTG/plugins/export/templates.py | Python | gpl-3.0 | 6,174 |
"""
Wraps various asyncio functions
"""
import asyncio
import sys
from functools import partial
from cloudbot.util.func_utils import call_with_args
def wrap_future(fut, *, loop=None):
"""
Wraps asyncio.async()/asyncio.ensure_future() depending on the python version
:param fut: The awaitable, future, or ... | weylin/CloudBot | cloudbot/util/async_util.py | Python | gpl-3.0 | 2,026 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) Pootle contributors.
#
# This file is a part of the Pootle project. It is distributed under the GPL3
# or later license. See the LICENSE file for a copy of the license and the
# AUTHORS file for copyright and authorship information.
import pytest
from co... | r-o-b-b-i-e/pootle | tests/core/management/subcommands.py | Python | gpl-3.0 | 6,653 |
""" This is a test of the chain
DataStoreClient -> DataStoreHandler -> AccountingDB
It supposes that the DB is present, and that the service is running
this is pytest!
"""
# pylint: disable=invalid-name,wrong-import-position
from DIRAC.Core.Base.Script import parseCommandLine
parseCommandLine()
from DI... | fstagni/DIRAC | tests/Integration/AccountingSystem/Test_DataStoreClient.py | Python | gpl-3.0 | 1,561 |
# coding=utf-8
# Author: Nic Wolfe <nic@wolfeden.ca>
# URL: https://sickrage.github.io/
# Git: https://github.com/SickRage/SickRage.git
#
# This file is part of SickRage.
#
# SickRage is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Fre... | pkoutsias/SickRage | sickbeard/browser.py | Python | gpl-3.0 | 4,389 |
#!/usr/bin/python
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distribut... | fernandezcuesta/ansible | lib/ansible/modules/network/junos/junos_netconf.py | Python | gpl-3.0 | 6,106 |
# #START_LICENSE###########################################################
#
#
# This file is part of the Environment for Tree Exploration program
# (ETE). http://etetoolkit.org
#
# ETE is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the... | Unode/ete | ete3/tools/ete_build_lib/configcheck.py | Python | gpl-3.0 | 18,183 |