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 -*-
# Copyright(C) 2010-2011 Christophe Benz
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at yo... | yannrouillard/weboob | modules/ina/backend.py | Python | agpl-3.0 | 1,901 |
import re
from coalib.bearlib.abstractions.Lint import Lint
from coalib.bears.LocalBear import LocalBear
from coalib.results.RESULT_SEVERITY import RESULT_SEVERITY
class InferBear(LocalBear, Lint):
executable = 'infer'
arguments = '-npb -- javac {filename}'
output_regex = re.compile(
r'(.+):'
... | chriscoyfish/coala-bears | bears/java/InferBear.py | Python | agpl-3.0 | 896 |
import cgi
import datetime
import hashlib
import json
import logging
import os
import traceback
import struct
import sys
from pkg_resources import resource_string
from capa.capa_problem import LoncapaProblem
from capa.responsetypes import StudentInputError, \
ResponseError, LoncapaProblemError
from capa.util impo... | pdehaye/theming-edx-platform | common/lib/xmodule/xmodule/capa_module.py | Python | agpl-3.0 | 44,840 |
# coding=utf-8
from __future__ import absolute_import
__author__ = "Gina Häußge <osd@foosel.net>"
__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
__copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms of the AGPLv3 License"
def can_perform_update(targ... | chriskoz/OctoPrint | src/octoprint/plugins/softwareupdate/updaters/python_updater.py | Python | agpl-3.0 | 565 |
# -*- coding: utf8 -*-
# This file is part of PyBossa.
#
# Copyright (C) 2013 SF Isle of Man Limited
#
# PyBossa is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at... | stitchfix/pybossa | test/test_authorization/__init__.py | Python | agpl-3.0 | 1,072 |
from datetime import datetime, timedelta
import logging
import traceback
from openerp import api, models, fields, tools, SUPERUSER_ID
from openerp.addons.booking_calendar.models import SLOT_START_DELAY_MINS, SLOT_DURATION_MINS
_logger = logging.getLogger(__name__)
class pitch_booking_venue(models.Model):
_name =... | ufaks/addons-yelizariev | pitch_booking/models.py | Python | lgpl-3.0 | 6,779 |
# -*- coding: utf-8 -*-
import unittest
class TestItemFieldComparison(unittest.TestCase):
def test_eq(self):
from ddbmock.database.comparison import eq
self.assertTrue(eq({u'S': u'waldo'}, {u'S': u'waldo'}))
self.assertFalse(eq({u'S': u'waldo'}, {u'S': u'on-time'}))
self.assertFa... | sendgridlabs/ddbmock | tests/unit/test_item_field_comparison.py | Python | lgpl-3.0 | 6,663 |
'''
Window GLUT: windowing provider based on GLUT
'''
__all__ = ('MTWindowGlut', )
import sys
import os
from pymt.ui.window import BaseWindow
from pymt.logger import pymt_logger
from pymt.base import stopTouchApp, getEventLoop
from OpenGL.GLUT import GLUT_RGBA, GLUT_DOUBLE, GLUT_ALPHA, GLUT_DEPTH, \
GLUT_MULT... | nuigroup/pymt-widgets | pymt/ui/window/win_glut.py | Python | lgpl-3.0 | 4,290 |
# -*- coding: utf-8 -*-
# Copyright(C) 2017 Jean Walrave
#
# This file is part of a weboob module.
#
# This weboob module 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 Li... | laurentb/weboob | modules/humanis/__init__.py | Python | lgpl-3.0 | 885 |
from __future__ import print_function
from functools import partial
import sys
from threading import Lock
try:
import colorful
except ImportError:
class colorful:
def __getattr__(self, attr):
return lambda st: st
colorful = colorful()
from .utils import make_unicode
__print = print
def ... | luogu-dev/cyaron | cyaron/log.py | Python | lgpl-3.0 | 3,103 |
import re
import json
import itertools
from .common import InfoExtractor
from .subtitles import SubtitlesInfoExtractor
from ..utils import (
compat_urllib_request,
compat_str,
get_element_by_attribute,
get_element_by_id,
orderedSet,
ExtractorError,
)
class DailymotionBaseInfoExtractor(InfoEx... | ashutosh-mishra/youtube-dl | youtube_dl/extractor/dailymotion.py | Python | unlicense | 8,993 |
# Copyright 2015-2016 ARM Limited
#
# 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 w... | JaviMerino/trappy | trappy/devfreq_power.py | Python | apache-2.0 | 2,302 |
'''
New Integration Test for vip qos.
@author: Legion
'''
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.test_state as test_state
test_stub = test_lib.lib_get_test_stub()
test_obj_dict = test_state.TestStateDict()
qos = test_stub.VIPQOS()
def test... | zstackorg/zstack-woodpecker | integrationtest/vm/virtualrouter/vip_qos/test_vrouter_vip_port_qos_multi_crt.py | Python | apache-2.0 | 1,199 |
import sys
import subprocess
result=subprocess.check_output("grep -or 'is_[A-Z]\w*' .", shell=True)
lines=[ l for l in str(result).splitlines() if l.find('.fst') != -1]
for l in lines:
content = l.split(':')
constr=content[1].strip()[0:-1]
print("sed -i -e 's/%s[.]/%s?./g' %s" % (constr, constr, content[0]... | A-Manning/FStar | src/tools/updateDiscriminators.py | Python | apache-2.0 | 419 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2018 João Pedro Rodrigues
#
# 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
#
# Unl... | JoaoRodrigues/pdb-tools | tests/test_pdb_intersect.py | Python | apache-2.0 | 5,216 |
# python3
# ==============================================================================
# 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.or... | CloudVLab/professional-services | examples/dialogflow-entities-example/main.py | Python | apache-2.0 | 4,374 |
# coding: utf-8
"""
OpenAPI spec version:
Generated by: https://github.com/swagger-api/swagger-codegen.git
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
... | detiber/lib_openshift | test/test_v1_user.py | Python | apache-2.0 | 1,212 |
# Copyright 2019 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... | GoogleCloudPlatform/professional-services | examples/kubeflow-pipelines-sentiment-analysis/pipeline/build_sentiment_analysis.py | Python | apache-2.0 | 3,173 |
#!/usr/bin/env python3
from common import utils
utils.init_logging("webserver")
import common.time
import common.url
import www.utils
from common.config import config
from www.server import app
import www.index
import www.help
import www.notifications
import www.login
import www.archive
import www.commands
import ww... | andreasots/lrrbot | webserver.py | Python | apache-2.0 | 1,216 |
#
# 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... | nathanielvarona/airflow | airflow/providers/google/cloud/operators/datastore.py | Python | apache-2.0 | 27,825 |
from common_fixtures import * # NOQA
from test_shared_volumes import add_storage_pool
def test_inactive_agent(super_client, new_context):
host = super_client.reload(new_context.host)
agent = host.agent()
c = new_context.create_container()
assert c.state == 'running'
agent = super_client.wait_su... | wlan0/cattle | tests/integration/cattletest/core/test_allocation.py | Python | apache-2.0 | 17,207 |
#!/usr/bin/python
#
# Copyright 2012 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | krux/adspygoogle | examples/adspygoogle/dfp/v201204/get_user.py | Python | apache-2.0 | 1,504 |
import pickle
# This dictionary was taken from link :
# https://www.kaggle.com/steubk/home-depot-product-search-relevance/fixing-typos/comments
# on 30/4/2016
spell_check_dict={
'steele stake': 'steel stake',
'gas mowe': 'gas mower',
'metal plate cover gcfi': 'metal plate cover gfci',
'lawn sprkinler': 'lawn sprinkler'... | Iolaum/Phi1337 | scripts/preprocessing/replacing_mistypo.py | Python | apache-2.0 | 170,961 |
# Copyright 2015, Kay Hayen, mailto:kay.hayen@gmail.com
#
# Part of "Nuitka", an optimizing Python compiler that is compatible and
# integrates with CPython, but also works on its own.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complianc... | wfxiang08/Nuitka | nuitka/codegen/templates/CodeTemplatesFrames.py | Python | apache-2.0 | 8,340 |
#!/usr/bin/env python
#
# Copyright 2017 The Chromium OS 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
#
# ... | google/walt | server/main.py | Python | apache-2.0 | 1,813 |
# ===============================================================================
# Copyright 2015 Jake Ross
#
# 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... | USGSDenverPychron/pychron | pychron/pipeline/nodes/filter.py | Python | apache-2.0 | 11,866 |
#!/usr/bin/env python
import argparse
import sys
from util import add_common_args, init_protocol
from local_thrift import thrift
from thrift.Thrift import TMessageType, TType
# TODO: generate from ThriftTest.thrift
def test_string(proto, value):
method_name = 'testString'
ttype = TType.STRING
proto.writ... | Jimdo/thrift | test/features/string_limit.py | Python | apache-2.0 | 1,665 |
import asyncio
import jinja2
import aiohttp_debugtoolbar
import aiohttp_jinja2
from aiohttp import web
@aiohttp_jinja2.template('index.html')
def basic_handler(request):
return {'title': 'example aiohttp_debugtoolbar!',
'text': 'Hello aiohttp_debugtoolbar!',
'app': request.app}
@asyncio... | realer01/aiohttp-debugtoolbar | examples/simple.py | Python | apache-2.0 | 1,624 |
# 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... | zycdragonball/tensorflow | tensorflow/python/kernel_tests/cwise_ops_test.py | Python | apache-2.0 | 79,648 |
"""Helper methods for common tasks."""
from __future__ import annotations
from collections.abc import Callable
import functools as ft
import logging
from typing import Any
from soco.exceptions import SoCoException, SoCoUPnPException
from homeassistant.exceptions import HomeAssistantError
UID_PREFIX = "RINCON_"
UID_... | lukas-hetzenecker/home-assistant | homeassistant/components/sonos/helpers.py | Python | apache-2.0 | 1,540 |
#!/usr/bin/env python
from itertools import groupby, tee
import json, os
assemblies = ['hg38', 'hg19', 'hg18']
chroms = ['chr' + str(i + 1) for i in range(22)] + ['chrX', 'chrY']
Kchrom = 0
def parseLine(line):
[chrom, start, end, id, _] = line
return [int(start), int(end), id]
def write(name):
with o... | acthp/ucsc-xena-client | js/data/getCentromere.py | Python | apache-2.0 | 820 |
# Copyright 2008-2015 Nokia Solutions and Networks
#
# 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... | moto-timo/robotframework | src/robot/utils/error.py | Python | apache-2.0 | 7,024 |
# 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... | cshallue/models | research/object_detection/metrics/oid_od_challenge_evaluation_utils.py | Python | apache-2.0 | 4,148 |
# 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... | AnishShah/tensorflow | tensorflow/python/training/session_manager_test.py | Python | apache-2.0 | 32,877 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Tests for the Windows EventLog (EVT) parser."""
import unittest
from plaso.lib import definitions
from plaso.parsers import winevt
from tests.parsers import test_lib
class WinEvtParserTest(test_lib.ParserTestCase):
"""Tests for the Windows EventLog (EVT) parser."... | log2timeline/plaso | tests/parsers/winevt.py | Python | apache-2.0 | 2,807 |
from django.test import TestCase
import mock
from mail.mails import create_mailgun_conference_route
class TestMail(TestCase):
@mock.patch('mail.mails.requests.post')
def test_create_mailgun_conference_route_poster(self, mock_post):
create_mailgun_conference_route('this', 'poster')
mock_post.a... | jnayak1/osf-meetings | meetings/mail/tests.py | Python | apache-2.0 | 1,412 |
import commands
from dataservice.DDM import ddm
#print ddm.DQ2ProductionClient.generateUUID()
#print ddm.DQ2.getFilesFromCatalog('aho.xml')
#print ddm.DQ2ProductionClient.dq2_makeblocks('input.data')
ids=['pandatest.000003.dd.input._00047.junk','09801b0a-9fd0-4237-8caf-a37932c26e39',
'pandatest.000003.dd.input._... | RRCKI/panda-server | pandaserver/test/testDQ.py | Python | apache-2.0 | 6,730 |
import unittest
from op_test_util import OpTestMeta
from gradient_checker import GradientChecker, create_op
import numpy as np
from paddle.v2.framework.op import Operator
class IdentityTest(unittest.TestCase):
__metaclass__ = OpTestMeta
def setUp(self):
self.type = "identity"
self.inputs = {'... | lispc/Paddle | python/paddle/v2/framework/tests/test_scale_and_identity_op.py | Python | apache-2.0 | 1,273 |
"""MQTT component mixins and helpers."""
from __future__ import annotations
from abc import abstractmethod
from collections.abc import Callable
import json
import logging
import voluptuous as vol
from homeassistant.const import (
ATTR_CONFIGURATION_URL,
ATTR_MANUFACTURER,
ATTR_MODEL,
ATTR_NAME,
A... | jawilson/home-assistant | homeassistant/components/mqtt/mixins.py | Python | apache-2.0 | 26,086 |
# 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/nets.py | Python | apache-2.0 | 27,095 |
class KEY(object):
def __init__(self, internal_name, external_name):
self.internalName = internal_name
self.externalName = external_name
class REQUEST(object):
def __init__(self, internal_name, external_name):
self.internalName = internal_name
self.externalName = external_name
... | tjw/swift | utils/gyb_sourcekit_support/UIDs.py | Python | apache-2.0 | 20,369 |
#!/usr/bin/env python
# encoding: utf-8
import sys
import subprocess
from flask_script import Manager
from flask_script.commands import ShowUrls
from flask_migrate import MigrateCommand
from application import create_app
from application.extensions import db
from utils.commands import GEventServer, ProfileServer
ma... | luke0922/celery_learning | manage.py | Python | apache-2.0 | 1,290 |
# Copyright (c) 2020 NTT DATA
#
# 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, ... | openstack/tacker | tacker/tests/unit/vnflcm/test_utils.py | Python | apache-2.0 | 2,800 |
###############################################################################
# Copyright (c) 2013-2020 Contributors to the Eclipse Foundation
#
# See the NOTICE file distributed with this work for additional
# information regarding copyright ownership.
# All rights reserved. This program and the accompanying m... | locationtech/geowave | analytics/pyspark/src/main/python/geowave_pyspark/__init__.py | Python | apache-2.0 | 603 |
# -*- coding: utf-8 -*-
"""
Abstract: Creates RDF for earthquake objects.
Gets an Array of Python Earthquake objects and turns them to RDF using RDFlib.
The RDF can either be outputted or written to a file.
This class does not inherit from RDFWriter!
"""
__author__ = "Marc Tim Thiemann"
__copyright__ = "Copyright ... | liangcun/ConceptsOfSpatialInformation | CoreConceptsPy/GdalPy/examples/events/earthquake/EarthquakeRdfWriter2.py | Python | apache-2.0 | 3,451 |
# 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... | tensor-tang/Paddle | python/paddle/fluid/tests/unittests/test_parallel_executor_seresnext_base_cpu.py | Python | apache-2.0 | 1,446 |
from inspect import signature
from mycroft.messagebus import Message
from mycroft.metrics import Stopwatch, report_timing
from mycroft.util.log import LOG
from ..skill_data import to_alnum
def unmunge_message(message, skill_id):
"""Restore message keywords by removing the Letterified skill ID.
Args:
... | forslund/mycroft-core | mycroft/skills/mycroft_skill/event_container.py | Python | apache-2.0 | 6,352 |
# Copyright 2014 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | JioCloud/oslo.config | tests/test_cfgfilter.py | Python | apache-2.0 | 9,272 |
import unittest
import mock
from artefact.utils.consume_parser import ConsumeParser, UnconsumedDataException, ConsumeParseException, ConsumeTimeoutException
class MultiRuleTestParser(ConsumeParser):
rules = [
(r'^(?P<left>[^,]+),', False),
(r'^(?P<right>[^,]+)', False)
]
class RepeatingRule... | sittingbull/artefact.connectors | artefact/utils/tests/test_consume_parser.py | Python | apache-2.0 | 3,880 |
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2008,2009,2010,2011,2012,2013,2014,2016 Contributor
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obt... | quattor/aquilon | lib/aquilon/worker/commands/show_organization_all.py | Python | apache-2.0 | 1,272 |
# 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 appli... | reyoung/Paddle | benchmark/fluid/models/se_resnext.py | Python | apache-2.0 | 10,123 |
#
#
# Copyright (C) 2010, 2011, 2012, 2013 Google 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:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list ... | onponomarev/ganeti | lib/query.py | Python | bsd-2-clause | 92,353 |
# -*- coding: utf-8 -*-
# Author: Eric Larson <larson.eric.d@gmail.com>
#
# License: BSD (3-clause)
from distutils.version import LooseVersion
import gc
import os
import os.path as op
from pathlib import Path
import shutil
import sys
import warnings
import pytest
# For some unknown reason, on Travis-xenial there are s... | olafhauk/mne-python | mne/conftest.py | Python | bsd-3-clause | 20,946 |
###############################################################################
##
## Copyright (C) 2011-2014, NYU-Poly.
## Copyright (C) 2006-2011, University of Utah.
## All rights reserved.
## Contact: contact@vistrails.org
##
## This file is part of VisTrails.
##
## "Redistribution and use in source and binary for... | Nikea/VisTrails | vistrails/core/vistrail/module_function.py | Python | bsd-3-clause | 10,589 |
"""Decorators for labeling test objects
Decorators that merely return a modified version of the original
function object are straightforward. Decorators that return a new
function object need to use
nose.tools.make_decorator(original_function)(decorator) in returning
the decorator, in order to preserve metadata such ... | illume/numpy3k | numpy/testing/decorators.py | Python | bsd-3-clause | 9,735 |
import csv
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
UCSD = 'UCSD'
BUCKETS = [0.1, 0.2, 1.0, 10.0, 60.0 ] # range(500, 3001, 500)
#COLORS=['#90B0D4', '#90D492', '#D4B490', '#D490D2']
COLORS=['#8dd3c7','#bebada','#ffffb3','#fb8072','#80b1d3','#fdb462']
COLORS_E=['#8dd3c7','#bebada','#80b1d3'... | ucsd-progsys/ml2 | paper/oopsla17-cameraready/plots.py | Python | bsd-3-clause | 4,957 |
# -*- test-case-name: twisted.test.test_threadpool -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
twisted.python.threadpool: a pool of threads to which we dispatch tasks.
In most cases you can just use C{reactor.callInThread} and friends
instead of creating a thread pool direc... | hlzz/dotfiles | graphics/VTK-7.0.0/ThirdParty/Twisted/twisted/python/threadpool.py | Python | bsd-3-clause | 8,392 |
from __future__ import absolute_import
from datetime import timedelta
from django.core.urlresolvers import reverse
from django.utils import timezone
from mock import patch
from sentry.models import Group, GroupBookmark, GroupSeen, GroupStatus
from sentry.testutils import APITestCase
from sentry.testutils.helpers impo... | argonemyth/sentry | tests/sentry/api/endpoints/test_project_group_index.py | Python | bsd-3-clause | 12,617 |
"""
You can enable picking by setting the "picker" property of an artist
(for example, a matplotlib Line2D, Text, Patch, Polygon, AxesImage,
etc...)
There are a variety of meanings of the picker property
None - picking is disabled for this artist (default)
boolean - if True then picking will be enabled and... | ajrichards/notebook | visualization/mpl-simple-pick-event.py | Python | bsd-3-clause | 6,330 |
# Copyright (c) 2014, Salesforce.com, Inc. All rights reserved.
# Copyright (c) 2015, Google, Inc.
#
# 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
... | fritzo/loom | loom/gridding.py | Python | bsd-3-clause | 3,080 |
import sys
import numpy as np
from scipy.linalg import block_diag
from scipy.sparse import csr_matrix
from scipy.special import psi
import pytest
from sklearn.decomposition import LatentDirichletAllocation
from sklearn.decomposition._online_lda import (_dirichlet_expectation_1d,
... | chrsrds/scikit-learn | sklearn/decomposition/tests/test_online_lda.py | Python | bsd-3-clause | 15,351 |
# -*- coding: utf-8 -*-
from django.core import urlresolvers
def custom_processor(request):
proc_data = dict()
resolver = urlresolvers.get_resolver(None)
patterns = sorted(
(key, val[0][0][0]) for key, val in resolver.reverse_dict.iteritems() if isinstance(key, basestring))
proc_data['pat'] ... | codeboy/coddy-sitetools | sitetools/coddy_site/procesors.py | Python | bsd-3-clause | 486 |
"""Test that adding, deleting and modifying watchpoints sends the appropriate events."""
from __future__ import print_function
import os
import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class TestWatchpointEvents (TestBase):
... | youtube/cobalt | third_party/llvm-project/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_events/TestWatchpointEvents.py | Python | bsd-3-clause | 4,479 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf.urls import url, include
from rest_framework import routers
from shop.views.cart import CartViewSet, WatchViewSet
from shop.views.checkout import CheckoutViewSet
from shop.views.catalog import ProductSelectView
router = routers.DefaultRou... | khchine5/django-shop | shop/urls/rest_api.py | Python | bsd-3-clause | 688 |
import json
import uuid
from django.core.management import call_command
from unittest.mock import ANY, patch
from six import StringIO
from olympia.amo.tests import TestCase
from olympia.users.management.commands.createsuperuser import (
Command as CreateSuperUser)
from olympia.users.models import UserProfile
@... | kumar303/addons-server | src/olympia/users/tests/test_commands.py | Python | bsd-3-clause | 2,353 |
__author__ = 'aakilomar'
import requests, json, time
requests.packages.urllib3.disable_warnings()
host = "https://localhost:8443"
#from rest_requests import add_user
def add_user(phone):
post_url = host + "/api/user/add/" + str(phone)
return requests.post(post_url,None, verify=False).json()
def add_group(use... | PaballoDitshego/grassroot-platform | docs/tests/vote_requests.py | Python | bsd-3-clause | 2,148 |
# Copyright 2015, Google 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:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... | vsco/grpc | src/python/grpcio/grpc_core_dependencies.py | Python | bsd-3-clause | 33,262 |
from nose.tools import *
import numpy as np
import causalinference.utils.tools as t
def test_convert_to_formatting():
entry_types = ['string', 'float', 'integer', 'float']
ans = ['s', '.3f', '.0f', '.3f']
assert_equal(list(t.convert_to_formatting(entry_types)), ans)
def test_add_row():
entries1 = ('Variable... | laurencium/CausalInference | tests/test_tools.py | Python | bsd-3-clause | 1,433 |
#!/usr/bin/python
# Diamanda Application Set
# myghtyboard forum
from django.shortcuts import render_to_response
from django.http import HttpResponseRedirect
from django.template import RequestContext
from django.utils.translation import ugettext as _
from django.views.generic.list_detail import object_list
from django... | bailey-ann/diamanda-fork | diamandas/myghtyboard/views.py | Python | bsd-3-clause | 6,485 |
# vim:ts=4:sw=4:noexpandtab
from __future__ import print_function, absolute_import
import itertools
import re
import random
import pmxbot
from . import storage
from .core import command
class SameName(ValueError): pass
class AlreadyLinked(ValueError): pass
class Karma(storage.SelectableStorage):
@classmethod
de... | jamwt/diesel-pmxbot | pmxbot/karma.py | Python | bsd-3-clause | 9,256 |
from flask import render_template, flash, redirect, session, url_for, request, g
from flask.ext.login import login_user, logout_user, current_user, login_required
from app import app, db, lm, oid
from forms import LoginForm, EditForm, PostForm, SearchForm
from models import User, ROLE_USER, ROLE_ADMIN, Post
from dateti... | SuperMarioBean/microblog | app/views.py | Python | bsd-3-clause | 6,281 |
#!/usr/bin/env python
# Copyright 2013 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
from document_renderer import DocumentRenderer
from server_instance import ServerInstance
from test_file_system import... | chromium2014/src | chrome/common/extensions/docs/server2/document_renderer_test.py | Python | bsd-3-clause | 6,119 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import unittest
from caffe2.proto import caffe2_pb2
import caffe2.python.cnn as cnn
import caffe2.python.core as core
import caffe2.contrib.tensorboard.tensorboard_expor... | ryfeus/lambda-packs | pytorch/source/caffe2/contrib/tensorboard/tensorboard_exporter_test.py | Python | mit | 13,996 |
# -*- coding: utf-8 -*-
#
# bpython documentation build configuration file, created by
# sphinx-quickstart on Mon Jun 8 11:58:16 2009.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All... | kdart/bpython | doc/sphinx/source/conf.py | Python | mit | 7,072 |
## -*- coding: utf-8 -*-
# (C) 2013 Muthiah Annamalai
#
# Implementation of Azhagi rules - தமிழ் எழுத்துக்கள்
# Ref: B. Viswanathan, http://www.mazhalaigal.com/tamil/learn/keys.php
#
class Transliteration:
table = {}
# not implemented - many-to-one table
# Azhagi has a many-to-one mapping - using a Tamil... | atvKumar/open-tamil | transliterate/azhagi.py | Python | mit | 30,836 |
# encoding: utf-8
"""Definition of supported languages"""
ENGLISH = 'english'
FRENCH = 'french'
DEFAULT = 'english'
| brouberol/pynlg | pynlg/lexicon/lang.py | Python | mit | 118 |
import AnimatedProp
from direct.actor import Actor
from direct.interval.IntervalGlobal import *
from toontown.effects.Splash import *
from toontown.effects.Ripples import *
import random
class FishAnimatedProp(AnimatedProp.AnimatedProp):
def __init__(self, node):
AnimatedProp.AnimatedProp.__init__(self, n... | Spiderlover/Toontown | toontown/hood/FishAnimatedProp.py | Python | mit | 2,348 |
from ..charts import Chart
class MG(Chart):
def __init__(self, chart_id, url, params, api_route):
opts = {
"url": url,
"chart_id": chart_id,
"params": params
}
super(MG, self).__init__("MetricsGraphics", opts, api_route)
class OptionHelper(object):
d... | MKridler/pyxley | pyxley/charts/mg/mg.py | Python | mit | 1,107 |
from __future__ import absolute_import
import pygame
import sappho.layers
from .common import compare_surfaces
class TestSurfaceLayers(object):
"""
Do not need to test create_surface_layers(), because
it's inherent to SurfaceLayers' initialization and
everything else tested.
"""
NUMBER_OF... | lillian-gardenia-seabreeze/sappho | tests/test_layers.py | Python | mit | 2,612 |
# Autoreloading launcher.
# Borrowed from Peter Hunt and the CherryPy project (http://www.cherrypy.org).
# Some taken from Ian Bicking's Paste (http://pythonpaste.org/).
# Adjustments made by Michael Elsdoerfer (michael@elsdoerfer.com).
#
# Portions copyright (c) 2004, CherryPy Team (team@cherrypy.org)
# All rights res... | gregarmer/trunserver | trunserv/autoreload.py | Python | mit | 5,239 |
"""
Generate a Unicode prop table for Python narrow and wide builds.
Narrow builds will stop at `0xffff`.
"""
from __future__ import unicode_literals
import sys
import struct
import unicodedata
import codecs
import os
import re
__version__ = '4.2.0'
UNIVERSION = unicodedata.unidata_version
UNIVERSION_INFO = tuple([i... | archifix/settings | sublime/Packages/backrefs/tools/unipropgen.py | Python | mit | 44,164 |
__author__ = 'ing'
| LowerSilesians/geo-squizzy | tests/gs_socket/__init__.py | Python | mit | 19 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function
from __future__ import absolute_import
from django.db import migrations
from django.db import transaction
def migrate_canonical(apps, schema_editor):
Project = apps.get_model("projects", "Project")
for project in Project.objects.... | safwanrahman/readthedocs.org | readthedocs/projects/migrations/0007_migrate_canonical_data.py | Python | mit | 1,093 |
# -*- Mode: Python; test-case-name: flumotion.test.test_ui_fgtk -*-
# vi:si:et:sw=4:sts=4:ts=4
#
# Flumotion - a streaming media server
# Copyright (C) 2004,2005,2006,2007 Fluendo, S.L. (www.fluendo.com).
# All rights reserved.
# This file may be distributed and/or modified under the terms of
# the GNU General Public ... | ylatuya/Flumotion | flumotion/ui/fgtk.py | Python | gpl-2.0 | 2,667 |
import sys
import unittest
from rope.base import exceptions
from rope.base.pycore import _TextChangeDetector
from rope.base.pyobjects import get_base_type, AbstractFunction
from ropetest import testutils
class PyCoreTest(unittest.TestCase):
def setUp(self):
super(PyCoreTest, self).setUp()
self.p... | vedang/Rope | ropetest/pycoretest.py | Python | gpl-2.0 | 50,538 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2012 Red Hat, Inc.
#
# Authors:
# Thomas Woerner <twoerner@redhat.com>
# Jiri Popelka <jpopelka@redhat.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 Fr... | jpopelka/firewalld | src/tests/python/firewalld_direct.py | Python | gpl-2.0 | 6,360 |
# -*- coding: utf-8 -*- vim:fileencoding=utf-8:
# Copyright (C) 2010-2014 GRNET S.A.
#
# 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 ... | sunweaver/ganetimgr | context/pending_notifications.py | Python | gpl-3.0 | 1,458 |
import sys
import os
import socket
import tempfile
import subprocess
import shutil
import email
import threading
import gobject
import struct
import time
import re
sys.path.insert(0, "..")
if __name__=="__main__":
import gettext
gettext.install("D-RATS")
from d_rats import version
from d_rats import platform... | maurizioandreotti/D-Rats-0.3.ev | d_rats/wl2k.py | Python | gpl-3.0 | 16,452 |
# ------------------------------------------------------------------
# Copyright (c) 2020 PyInstaller Development Team.
#
# This file is distributed under the terms of the GNU General Public
# License (version 2.0 or later).
#
# The full license is available in LICENSE.GPL.txt, distributed with
# this software.
#
# SPD... | etherkit/OpenBeacon2 | macos/venv/lib/python3.8/site-packages/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-umap.py | Python | gpl-3.0 | 517 |
#!/usr/bin/python
# -*- coding: latin-1 -*-
# 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, or (at your option) any later
# version.
#
# This program is distributed in t... | guduchango/pyafipws | wsbfev1.py | Python | gpl-3.0 | 25,642 |
import discord
from discord.ext import commands
from .utils.dataIO import fileIO
from .utils import checks
from __main__ import user_allowed, send_cmd_help
import os
class CustomCommands:
"""Custom commands."""
def __init__(self, bot):
self.bot = bot
self.c_commands = fileIO("data/customcom/co... | Ckrisirkc/Red-DiscordBot | cogs/customcom.py | Python | gpl-3.0 | 5,602 |
# Copyright (C) 2009-2012 by the Free Software Foundation, Inc.
#
# This file is part of GNU Mailman.
#
# GNU Mailman 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 you... | hcs/mailman | src/mailman/commands/cli_control.py | Python | gpl-3.0 | 7,366 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Menu manager.
A dictionary of menu instance() functions (see MenuFactory)
"""
class MenuManager:
menus = { }
def register(menuName, menuFactory):
MenuManager.menus[menuName] = menuFactory
register = staticmethod(register)
def get(menuName):
return Me... | non-official-SD/base | src/tools/ceguidemo/menumanager.py | Python | gpl-3.0 | 375 |
# -*- coding: utf-8; tab-width: 4; indent-tabs-mode: nil; -*-
### BEGIN LICENSE
# Copyright (C) 2010-2012 Kevin Mehall <km@kevinmehall.net>
#This program is free software: you can redistribute it and/or modify it
#under the terms of the GNU General Public License version 3, as published
#by the Free Software Foundation... | xenoxaos/pithos | pithos/pithosconfig.py | Python | gpl-3.0 | 2,682 |
# -*- coding: utf-8 -*-
from datetime import date, datetime
from dateutil.relativedelta import relativedelta
from odoo import api, fields, models, tools, SUPERUSER_ID, _
from odoo.exceptions import AccessDenied, AccessError, UserError, ValidationError
from odoo.tools import DEFAULT_SERVER_DATE_FORMAT as DF
from odoo... | albertosalmeronunefa/tuconsejocomunal | addons/tcc_communal_council/models/family.py | Python | gpl-3.0 | 24,178 |
"""
Imports all submodules
"""
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
from deepchem.dock.pose_generation import PoseGenerator
from deepchem.dock.pose_generation import VinaPoseGenerator
from deepchem.dock.pose_scoring import PoseScorer
from deepch... | bowenliu16/deepchem | deepchem/dock/__init__.py | Python | gpl-3.0 | 637 |
# 2016 Red Hat Inc.
#
# 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 distrib... | qrkourier/ansible | lib/ansible/plugins/action/dellos6.py | Python | gpl-3.0 | 4,351 |
# -*- coding: utf-8 -*-
from openerp import api, fields, models, _
from openerp.osv import expression
from openerp.tools import float_is_zero
from openerp.tools import float_compare, float_round
from openerp.tools.misc import formatLang
from openerp.exceptions import UserError, ValidationError
import time
import math... | angelapper/odoo | addons/account/models/account_bank_statement.py | Python | agpl-3.0 | 47,237 |
import ssl
import json
import smtpd
import asyncore
import datetime
import pytest
import gevent
from tests.util.base import default_account
from tests.api.base import api_client, new_api_client
from tests.api_legacy.base import api_client as api_legacy_client
__all__ = ['api_client', 'api_legacy_client', 'default_ac... | Eagles2F/sync-engine | tests/security/test_smtp_ssl.py | Python | agpl-3.0 | 3,497 |
"""
HTTP end-points for the Bookmarks API.
For more information, see:
https://openedx.atlassian.net/wiki/display/TNL/Bookmarks+API
"""
import logging
import eventtracking
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from django.utils.translation import gettext as _
from dja... | arbrandes/edx-platform | openedx/core/djangoapps/bookmarks/views.py | Python | agpl-3.0 | 13,259 |