code stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 226 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k |
|---|---|---|---|---|---|
"""
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 use this ... | sekikn/ambari | ambari-common/src/main/python/ambari_commons/repo_manager/apt_manager.py | Python | apache-2.0 | 13,082 |
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import errno
import logging
import os
import posix
from functools import reduce
from typing import Optional, Set
logger = logging.getLogger(__name__)
OS_ALIASES = {
"darwin": {"maco... | benjyw/pants | src/python/pants/util/osutil.py | Python | apache-2.0 | 2,336 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed unde... | pratikmallya/heat | heat/tests/engine/service/test_stack_resources.py | Python | apache-2.0 | 21,657 |
# Copyright 2009-2014 MongoDB, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | llvtt/mongo-python-driver | tools/fail_if_no_c.py | Python | apache-2.0 | 842 |
from share.transform.chain.exceptions import * # noqa
from share.transform.chain.links import * # noqa
from share.transform.chain.parsers import * # noqa
from share.transform.chain.transformer import ChainTransformer # noqa
from share.transform.chain.links import Context
# Context singleton to be used for parser ... | CenterForOpenScience/SHARE | share/transform/chain/__init__.py | Python | apache-2.0 | 484 |
# Copyright 2011 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | viggates/nova | nova/tests/api/openstack/compute/plugins/v3/test_extended_status.py | Python | apache-2.0 | 4,622 |
# pyOCD debugger
# Copyright (c) 2016-2020 Arm Limited
# SPDX-License-Identifier: Apache-2.0
#
# 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... | pyocd/pyOCD | pyocd/cache/register.py | Python | apache-2.0 | 7,288 |
# 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... | zhreshold/mxnet | tests/python/unittest/common.py | Python | apache-2.0 | 13,748 |
from rdflib import Literal
from classes import ldp
from namespaces import dcterms, oa, rdf
# alias the RDFlib Namespace
ns = oa
# Annotation resources
class Annotation(ldp.Resource):
def __init__(self):
super(Annotation, self).__init__()
self.motivation = None
def add_body(self, body):
... | peichman-umd/newspaper-batchload | classes/oa.py | Python | apache-2.0 | 2,919 |
# 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 use ... | atsaki/libcloud | libcloud/compute/types.py | Python | apache-2.0 | 9,475 |
# 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/unittests/test_affine_channel_op.py | Python | apache-2.0 | 4,621 |
#!/usr/bin/env python
#
# Copyright (c) 2017 Hewlett Packard Enterprise, L.P.
# Copyright (c) 2013 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.apach... | dtroyer/dwarf | tests/clients/test_nova.py | Python | apache-2.0 | 4,430 |
# Copyright 2013: Mirantis 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... | vishnu-kumar/PeformanceFramework | tests/unit/plugins/openstack/scenarios/cinder/test_utils.py | Python | apache-2.0 | 15,937 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-06-13 03:20
from __future__ import unicode_literals
import django.contrib.postgres.fields.ranges
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('climate_data',... | qubs/data-centre | climate_data/migrations/0020_annotation.py | Python | apache-2.0 | 1,145 |
"""
This sample shows how to update the
large thumbnail of an item
Python 2.x
ArcREST 3.0.1
"""
import arcrest
from arcresthelper import securityhandlerhelper
from arcresthelper import common
def trace():
"""
trace finds the line, the filename
and error message and returns it
to ... | DShokes/ArcREST | samples/update_largethumbnail.py | Python | apache-2.0 | 2,476 |
# -*- coding: utf-8 -*-
'''
:codeauthor: :email:`Mike Place <mp@saltstack.com>`
'''
# Import python libs
from __future__ import absolute_import
import os
import logging
import tornado.gen
import tornado.ioloop
import tornado.testing
import salt.utils
import salt.config
import salt.exceptions
import salt.transpor... | stephane-martin/salt-debian-packaging | salt-2016.3.3/tests/unit/transport/ipc_test.py | Python | apache-2.0 | 3,969 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | dmlc/tvm | tests/python/contrib/test_ethosn/test_mean.py | Python | apache-2.0 | 2,066 |
"""Test configuration for the ZHA component."""
from unittest.mock import AsyncMock, MagicMock, PropertyMock, patch
import pytest
import zigpy
from zigpy.application import ControllerApplication
import zigpy.config
import zigpy.group
import zigpy.types
from homeassistant.components.zha import DOMAIN
import homeassist... | turbokongen/home-assistant | tests/components/zha/conftest.py | Python | apache-2.0 | 6,990 |
import json
import pytest
from indy import crypto, did, error
@pytest.mark.asyncio
async def test_auth_crypt_works_for_created_key(wallet_handle, seed_my1, verkey_my2, message):
verkey = await did.create_key(wallet_handle, json.dumps({'seed': seed_my1}))
await crypto.auth_crypt(wallet_handle, verkey, verkey... | peacekeeper/indy-sdk | wrappers/python/tests/crypto/test_auth_crypt.py | Python | apache-2.0 | 1,227 |
# Copyright 2012 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless req... | Akrog/cinder | cinder/tests/test_coraid.py | Python | apache-2.0 | 33,873 |
"""The tests for the Tasmota sensor platform."""
import copy
import datetime
from datetime import timedelta
import json
from unittest.mock import Mock, patch
import hatasmota
from hatasmota.utils import (
get_topic_stat_status,
get_topic_tele_sensor,
get_topic_tele_will,
)
import pytest
from homeassistant... | aronsky/home-assistant | tests/components/tasmota/test_sensor.py | Python | apache-2.0 | 33,360 |
# Minimal support for git commands on an hg repository
#
# Copyright 2005, 2006 Chris Mason <mason@suse.com>
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
'''browse the repository in a graphical way
The hgk extension allows bro... | joewalnes/idea-community | plugins/hg4idea/testData/bin/hgext/hgk.py | Python | apache-2.0 | 11,681 |
# Copyright 2017 Battelle Energy Alliance, 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 ... | idaholab/raven | framework/CodeInterfaces/Saphire/SaphireData.py | Python | apache-2.0 | 4,508 |
"""Support for BMW car locks with BMW ConnectedDrive."""
import logging
from homeassistant.components.bmw_connected_drive import DOMAIN as BMW_DOMAIN
from homeassistant.components.lock import LockDevice
from homeassistant.const import STATE_LOCKED, STATE_UNLOCKED
DEPENDENCIES = ['bmw_connected_drive']
_LOGGER = logg... | nugget/home-assistant | homeassistant/components/bmw_connected_drive/lock.py | Python | apache-2.0 | 3,775 |
# Copyright 2020 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... | frreiss/tensorflow-fred | tensorflow/python/ops/numpy_ops/np_array_ops.py | Python | apache-2.0 | 60,984 |
from SubjectNodes import SubjectNode
class MultiClassSubjectNode(SubjectNode):
def __init__(self):
SubjectNode.__init__(numClasses=1)
def __changeClassificationAttributes__(self,attributesList):
pass
| camallen/aggregation | experimental/graphicalClassification/MultiClassSubjectNode.py | Python | apache-2.0 | 227 |
'''Tests for helpers_views'''
from mysite import settings
from mysite.helpers.db_access import DBAccess
from mysite.helpers import testhelpers as th
from heatmap.helpers.table_view import (TableForm, QueryForm)
from heatmap.helpers import test_helpers_views as thv
from django.test import TestCase # Provides mocks for... | ScienceStacks/JViz | mysite/heatmap/helpers/test_table_view.py | Python | apache-2.0 | 2,324 |
from __future__ import unicode_literals
from .service import Service # noqa:flake8
__version__ = '1.0.1'
| bcicen/fig | fig/__init__.py | Python | apache-2.0 | 107 |
# -*- coding: utf-8 -*-
#
# Copyright 2012-2015 Spotify AB
#
# 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... | 17zuoye/luigi | test/parameter_test.py | Python | apache-2.0 | 25,868 |
import copy
from threading import Lock
from .metrics_core import Metric
class CollectorRegistry(object):
"""Metric collector registry.
Collectors must have a no-argument method 'collect' that returns a list of
Metric objects. The returned metrics should be consistent with the Prometheus
exposition f... | cloudera/hue | desktop/core/ext-py/prometheus_client-0.7.1/prometheus_client/registry.py | Python | apache-2.0 | 4,226 |
"""Auto-generated file, do not edit by hand. 882 metadata"""
from phonenumbers.phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata
PHONE_METADATA_882 = PhoneMetadata(id='001', country_code=882, international_prefix=None,
general_desc=PhoneNumberDesc(national_number_pattern='\\d{9}', possible_length=(... | gencer/python-phonenumbers | python/tests/testdata/region_882.py | Python | apache-2.0 | 527 |
import os
from setuptools import setup, find_packages
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name = "my-django-skeleton",
version = "0.1",
url = 'http://github.com/lemonad/my-django-skeleton',
license = 'BSD',
description = "A skeleton setup ... | lemonad/my-django-skeleton | setup.py | Python | bsd-2-clause | 930 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime
from django.utils import timezone
from django.test import TestCase
from django.contrib.auth.models import User
from django.test.utils import override_settings
import six
from happenings.models import Event
@override_settings(CALENDAR_... | imposeren/django-happenings | tests/integration_tests/event_factory.py | Python | bsd-2-clause | 3,323 |
#
# This file is part of pyasn1-modules software.
#
# Created by Russ Housley
# Copyright (c) 2019, Vigil Security, LLC
# License: http://snmplabs.com/pyasn1/license.html
#
import sys
import unittest
from pyasn1.codec.der.decoder import decode as der_decoder
from pyasn1.codec.der.encoder import encode as der_encoder
f... | etingof/pyasn1-modules | tests/test_rfc6402.py | Python | bsd-2-clause | 6,395 |
#!/usr/bin/env python
from __future__ import print_function
from builtins import input
import sys
import scipy
import numpy
import pmagpy.pmagplotlib as pmagplotlib
def main():
"""
NAME
plot_2cdfs.py
DESCRIPTION
makes plots of cdfs of data in input file
SYNTAX
plot_2cdfs.py... | lfairchild/PmagPy | programs/plot_2cdfs.py | Python | bsd-3-clause | 1,652 |
import unittest
from distutils.errors import CompileError
from pythran.tests import TestFromDir
import os
import pythran
from pythran.syntax import PythranSyntaxError
from pythran.spec import Spec
class TestOpenMP(TestFromDir):
path = os.path.join(os.path.dirname(__file__), "openmp")
class TestOpenMP4(TestFromDir... | serge-sans-paille/pythran | pythran/tests/test_openmp.py | Python | bsd-3-clause | 1,597 |
import csv
import os
from datetime import datetime
import logging
import re
from dipper.sources.PostgreSQLSource import PostgreSQLSource
from dipper.models.assoc.Association import Assoc
from dipper.models.assoc.G2PAssoc import G2PAssoc
from dipper.models.Genotype import Genotype
from dipper.models.Reference import Ref... | TomConlin/dipper | dipper/sources/MGI.py | Python | bsd-3-clause | 99,120 |
from pygraz_website import filters
class TestFilters(object):
def test_url_detection(self):
"""
Test that urls are found correctly.
"""
no_urls_string = '''This is a test without any urls in it.'''
urls_string = '''This string has one link in it: http://pygraz.org . But it a... | pygraz/old-flask-website | pygraz_website/tests/test_filters.py | Python | bsd-3-clause | 1,577 |
#!/usr/bin/env python
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
""" Script example of tissue classification
"""
from __future__ import print_function # Python 2/3 compatibility
import numpy as np
from nipy import load_image, save_image
from nipy.... | bthirion/nipy | examples/tissue_classification.py | Python | bsd-3-clause | 3,308 |
>>> import random
>>> random.sample(range(10), 5)
[7, 6, 3, 5, 1]
>>> all(a < b for a, b in zip(_,_[1:]))
False
>>>
| gusyussh/learntosolveit | languages/python/algorithm_is_sorted.py | Python | bsd-3-clause | 116 |
import logging
import sys
import traceback
from collections import namedtuple
import numpy as np
import pandas as pd
from scipy.stats import chisquare
from . import categorizer as cat
from . import draw
from .ipf.ipf import calculate_constraints
from .ipu.ipu import household_weights
logger = logging.getLogger("synt... | sfcta/synthpop | synthpop/synthesizer.py | Python | bsd-3-clause | 6,015 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django.conf.urls import url, include
from rest_framework.routers import DefaultRouter
from rest_framework.urlpatterns import format_suffix_patterns
from . import views
router = DefaultRouter()
router.register(r'minion', views.Min... | Farforr/overlord | overlord/minions/api/v1/urls.py | Python | bsd-3-clause | 478 |
# -*- coding: utf-8 -*-
import httplib
import pprint
import json
import sys
import logging
import datetime
import os
import os.path
import codecs
class cmdb( object ):
def __init__( self, args , info=None ):
self.res = {}
self.result = {}
self.info = info
self.args = args
... | hackshel/metaCollecter | src/metaManager/modules/cmdbServer.py | Python | bsd-3-clause | 3,610 |
# -*- coding: utf-8 -*-
from django.core.files.storage import FileSystemStorage
import os
from datetime import datetime
from django.db import models
from django.contrib.contenttypes.models import ContentType
from django.utils.timezone import utc
from autofixture.compat import get_GenericForeignKey
from autofixture.com... | gregmuellegger/django-autofixture | autofixture_tests/models.py | Python | bsd-3-clause | 6,350 |
from __future__ import absolute_import, print_function
__all__ = ['DummyProvider']
from django.http import HttpResponse
from sentry.identity.base import Provider
from sentry.pipeline import PipelineView
class AskEmail(PipelineView):
def dispatch(self, request, pipeline):
if 'email' in request.POST:
... | looker/sentry | src/sentry/identity/providers/dummy.py | Python | bsd-3-clause | 857 |
from eventkit_cloud.settings.prod import * # NOQA
# Override settings here for test purposes.
TESTING = True
CELERY_ALWAYS_EAGER = True
BROKER_BACKEND = "memory"
PASSWORD_HASHERS = ("django.contrib.auth.hashers.MD5PasswordHasher",)
| venicegeo/eventkit-cloud | eventkit_cloud/settings/tests.py | Python | bsd-3-clause | 235 |
#!/usr/bin/env python
"""
Let's say we play a game where I keep flipping a coin until I get
heads. If the first time I get heads is on the nth coin, then I pay
you 2n-1 dollars. How much would you pay me to play this game?
You should end up with a sequence that you need to find the closed
form of. If you don't know ho... | ajrichards/bayesian-examples | hypothesis-testing/binomial_prob.py | Python | bsd-3-clause | 1,308 |
# -*- coding: utf-8 -*-
try:
import json
except ImportError:
import simplejson as json
import calendar
import datetime
import decimal
from functools import partial
import locale
import math
import re
import time
import dateutil
import numpy as np
import pytest
import pytz
import pandas._libs.json as ujson
fr... | GuessWhoSamFoo/pandas | pandas/tests/io/json/test_ujson.py | Python | bsd-3-clause | 38,511 |
import numpy as np
from parakeet import jit, testing_helpers
@jit
def true_divided(x):
return True / x
def test_true_divided_bool():
testing_helpers.expect(true_divided, [True], True)
def test_true_divided_int():
testing_helpers.expect(true_divided, [1], 1)
testing_helpers.expect(true_divided, [2]... | pombredanne/parakeet | test/core_language/test_div_bool.py | Python | bsd-3-clause | 679 |
# coding: utf-8
from __future__ import absolute_import
from django.apps import apps
from django.conf import settings
from sentry.models import Organization, Project, ProjectKey, Team, User
from sentry.receivers.core import create_default_projects, DEFAULT_SENTRY_PROJECT_ID
from sentry.testutils import TestCase
cla... | beeftornado/sentry | tests/sentry/receivers/test_core.py | Python | bsd-3-clause | 2,858 |
# coding=utf-8
"""
Tests for wham_rad.
"""
import unittest
import os
from md_utils.md_common import silent_remove, diff_lines
from md_utils.press_dups import avg_rows, compress_dups, main
__author__ = 'mayes'
DATA_DIR = os.path.join(os.path.dirname(__file__), 'test_data')
DUPS_DIR = os.path.join(DATA_DIR, 'press_du... | cmayes/md_utils | tests/test_press_dups.py | Python | bsd-3-clause | 1,638 |
#!/usr/bin/env python
from __future__ import unicode_literals
from prompt_toolkit import prompt
if __name__ == '__main__':
print('If you press meta-! or esc-! at the following prompt, you can enter system commands.')
answer = prompt('Give me some input: ', enable_system_bindings=True)
print('You said: %s'... | niklasf/python-prompt-toolkit | examples/system-prompt.py | Python | bsd-3-clause | 331 |
# -*- coding: utf-8 -*-
"""
Bit Writing Request/Response
------------------------------
TODO write mask request/response
"""
import struct
from pymodbus3.constants import ModbusStatus
from pymodbus3.pdu import ModbusRequest
from pymodbus3.pdu import ModbusResponse
from pymodbus3.pdu import ModbusExceptions
from pymod... | uzumaxy/pymodbus3 | pymodbus3/bit_write_message.py | Python | bsd-3-clause | 8,708 |
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)
def softmax():
# Model variables
x = tf.placeholder(tf.float32, shape=[None, 784])
y_ = tf.placeholder(tf.float32, shape=[None, 10])
W = tf.Variable(tf.zer... | jonkrohn/study-group | weekly-work/week1/softmax_vs_convolutional_nn.py | Python | mit | 3,870 |
import collections
from mock import MagicMock
from mock import call
from mock import patch
from honcho.test.helpers import TestCase
from honcho.export.upstart import Export
FakeProcess = collections.namedtuple('FakeProcess', 'name')
FIX_1PROC = [FakeProcess('web.1')]
FIX_NPROC = [FakeProcess('web.1'),
... | janusnic/honcho | honcho/test/unit/export/test_upstart.py | Python | mit | 4,088 |
from __future__ import unicode_literals
import os
import paramiko
from django.utils import six
from reviewboard.ssh.client import SSHClient
from reviewboard.ssh.errors import (BadHostKeyError, SSHAuthenticationError,
SSHError)
from reviewboard.ssh.policy import RaiseUnknownHostKey... | KnowNo/reviewboard | reviewboard/ssh/utils.py | Python | mit | 3,229 |
import socket
try:
import requests
httplib2 = None
except ImportError:
requests = None
try:
import httplib2
except ImportError:
raise ImportError('No module named requests or httplib2')
ConnectionError = requests.exceptions.ConnectionError if requests else socket.error
def wrap_... | tow/sunburnt | sunburnt/http.py | Python | mit | 1,389 |
# Copyright (c) 2013-2014 Will Thames <will@thames.id.au>
#
# 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... | schlueter/ansible-lint | lib/ansiblelint/__init__.py | Python | mit | 6,392 |
import re
from django.core.management.base import BaseCommand
from django.contrib.auth.models import User
from apps.rss_feeds.models import Feed
from apps.reader.models import UserSubscription
from optparse import make_option
class Command(BaseCommand):
option_list = BaseCommand.option_list + (
make_option... | slava-sh/NewsBlur | apps/search/management/commands/index_stories.py | Python | mit | 993 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
db.rename_column('django_mailbox_message', 'from_address', 'address')
db.rename_column('django_mailbox_messa... | leifurhauks/django-mailbox | django_mailbox/south_migrations/0005_rename_fields.py | Python | mit | 1,958 |
"""
Script used to publish GitHub release notes extracted from CHANGELOG.rst.
This script is meant to be executed after a successful deployment in GitHub actions.
Uses the following environment variables:
* GIT_TAG: the name of the tag of the current commit.
* GH_RELEASE_NOTES_TOKEN: a personal access token with 're... | pytest-dev/pytest | scripts/publish-gh-release-notes.py | Python | mit | 3,049 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2011 Sebastien Helleu <flashcode@flashtux.org>
#
# 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) ... | posquit0/dotfiles | weechat/.weechat/python/theme.py | Python | mit | 43,544 |
from django.conf import settings
from django.core.validators import MinValueValidator
from openslides.core.config import ConfigVariable
from openslides.motions.models import MotionPoll
from .models import Workflow
def get_workflow_choices():
"""
Returns a list of all workflows to be used as choices for the ... | FinnStutzenstein/OpenSlides | server/openslides/motions/config_variables.py | Python | mit | 13,984 |
# SPDX-License-Identifier: MIT
"""
Commonly useful filters for `attr.asdict`.
"""
from __future__ import absolute_import, division, print_function
from ._compat import isclass
from ._make import Attribute
def _split_what(what):
"""
Returns a tuple of `frozenset`s of classes and attributes.
"""
retu... | python-attrs/attrs | src/attr/filters.py | Python | mit | 1,124 |
import beaglebone_pru_adc as adc
import time
numsamples = 10000 # how many samples to capture
capture = adc.Capture()
capture.oscilloscope_init(adc.OFF_VALUES, numsamples) # captures AIN0 - the first elt in AIN array
#capture.oscilloscope_init(adc.OFF_VALUES+8, numsamples) # captures AIN2 - the third elt in AIN arra... | thegmarlow/TagTrack- | examples/oscilloscope.py | Python | mit | 678 |
#!/usr/bin/env python3
# Copyright (c) 2014-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the listtransactions API."""
from test_framework.test_framework import BitcoinTestFramework
from ... | daliwangi/bitcoin | test/functional/listtransactions.py | Python | mit | 10,471 |
class Solution(object):
def removeKdigits(self, num, k):
"""
:type num: str
:type k: int
:rtype: str
"""
stack = []
length = len(num) - k
for c in num:
while k and stack and stack[-1] > c:
stack.pop()
k -= 1
... | Mlieou/leetcode_python | leetcode/python/ex_402.py | Python | mit | 405 |
#Program to find the LCM of two numbers
#Function to find GCD
def gcd(num1, num2):
if num1 == num2:
return num1
if num1 > num2:
return gcd(num1-num2, num2)
return gcd(num1, num2-num1)
#Function to find LCM
def lcm(num1, num2):
return (num1*num2) // gcd(num1, num2)
#Driv... | Deepak345/al-go-rithms | math/LCM/Python/LCM.py | Python | mit | 469 |
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
# ++ single anchor added to individual output file
# ++ two anchors added to individual output file
# ++ anchors added to individual output files
# ++ entry added to index
# ++ index entry pointing to correct file and anchor
# ++ multiple entries ... | engdan77/edoAutoHomeMobile | twisted/lore/test/test_lore.py | Python | mit | 42,212 |
#!/usr/bin/python
import os
import json
def main():
print("Sample Post Script")
files = json.loads(os.environ.get('MH_FILES'))
for filename in files:
print(filename)
if __name__ == "__main__":
main()
| Collisionc/sickbeard_mp4_automator | post_process/sample.py | Python | mit | 214 |
# -*- coding: utf-8 -*-
#
# This file is part of INSPIRE.
# Copyright (C) 2014, 2015, 2016 CERN.
#
# INSPIRE 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 optio... | Panos512/inspire-next | inspirehep/dojson/experiments/model.py | Python | gpl-2.0 | 1,040 |
from flask_admin import expose
from listenbrainz.webserver.admin import AdminIndexView
class HomeView(AdminIndexView):
@expose('/')
def index(self):
return self.render('admin/home.html')
| Freso/listenbrainz-server | listenbrainz/webserver/admin/views.py | Python | gpl-2.0 | 206 |
# -*- coding: utf-8 -*-
# Copyright (C) 2013-2014 Avencall
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This p... | eallovon/xivo-provd-plugins | plugins/xivo-cisco-sccp/9.0.3/entry.py | Python | gpl-3.0 | 989 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import frappe
from frappe import _
def execute(filters=None):
if not filters: filters = {}
columns = get_columns()
data = get_employees(filters)
return columns, data
def get_columns(... | mhbu50/erpnext | erpnext/hr/report/employee_birthday/employee_birthday.py | Python | gpl-3.0 | 1,261 |
# -*- coding: utf-8 -*-
from outwiker.gui.baseaction import BaseAction
from outwiker.core.commands import createNewWiki
class NewAction (BaseAction):
"""
Создание нового дерева заметок
"""
stringId = u"NewTree"
def __init__(self, application):
self._application = application
@proper... | unreal666/outwiker | src/outwiker/actions/new.py | Python | gpl-3.0 | 566 |
# -*- coding: utf-8 -*-
# HORTON: Helpful Open-source Research TOol for N-fermion systems.
# Copyright (C) 2011-2017 The HORTON Development Team
#
# This file is part of HORTON.
#
# HORTON is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by th... | QuantumElephant/horton | horton/io/xyz.py | Python | gpl-3.0 | 2,419 |
from frappe import _
def get_data():
return {
'fieldname': 'delivery_note',
'non_standard_fieldnames': {
'Stock Entry': 'delivery_note_no',
'Quality Inspection': 'reference_name',
'Auto Repeat': 'reference_document',
},
'internal_links': {
'Sales Order': ['items', 'against_sales_order'],
},
't... | ESS-LLP/erpnext-medical | erpnext/stock/doctype/delivery_note/delivery_note_dashboard.py | Python | gpl-3.0 | 674 |
"""
Copyright (C) <2010> Autin L. TSRI
This file git_upy/blender/v271/__init__.py is part of upy.
upy 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... | corredD/upy | blender/v280/__init__.py | Python | gpl-3.0 | 755 |
from jx_elasticsearch.es52.painless._utils import Painless, LIST_TO_PIPE
from jx_elasticsearch.es52.painless.add_op import AddOp
from jx_elasticsearch.es52.painless.and_op import AndOp
from jx_elasticsearch.es52.painless.basic_add_op import BasicAddOp
from jx_elasticsearch.es52.painless.basic_eq_op import BasicEqOp
fro... | klahnakoski/SpotManager | vendor/jx_elasticsearch/es52/painless/__init__.py | Python | mpl-2.0 | 3,355 |
# This file is part of Booktype.
# Copyright (c) 2012 Douglas Bagnall
#
# Booktype is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later versio... | btat/Booktype | lib/booki/bookizip.py | Python | agpl-3.0 | 5,243 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'Tests flow of API keys',
'category': 'Tools',
'depends': ['web_tour'],
'data': ['views/assets.xml'],
}
| rven/odoo | odoo/addons/test_apikeys/__manifest__.py | Python | agpl-3.0 | 229 |
import bountyfunding
from bountyfunding.core.const import *
from bountyfunding.core.data import clean_database
from test import to_object
from nose.tools import *
USER = "bountyfunding"
class Email_Test:
def setup(self):
self.app = bountyfunding.app.test_client()
clean_database()
def ... | bountyfunding/bountyfunding | test/integration_test/email_test.py | Python | agpl-3.0 | 1,266 |
# -*- coding: utf-8 -*-
# Copyright(C) 2013 Julien Veyssier
#
# 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 your op... | yannrouillard/weboob | modules/imdb/browser.py | Python | agpl-3.0 | 8,535 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2015 Compassion CH (http://www.compassion.ch)
# Releasing children from poverty in Jesus' name
# @author: Emanuel Cino <ecino@compassion.ch>
#
# The licence is in the file __manifest__.py... | eicher31/compassion-modules | sbc_compassion/controllers/__init__.py | Python | agpl-3.0 | 426 |
"""Deprecated import support. Auto-generated by import_shims/generate_shims.sh."""
# pylint: disable=redefined-builtin,wrong-import-position,wildcard-import,useless-suppression,line-too-long
from import_shims.warn import warn_deprecated_import
warn_deprecated_import('instructor_task.tests.test_base', 'lms.djangoapps.... | eduNEXT/edunext-platform | import_shims/lms/instructor_task/tests/test_base.py | Python | agpl-3.0 | 416 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (c) 2013 jmesteve All Rights Reserved
# https://github.com/jmesteve
# <jmesteve@me.com>
#
# This program is... | jmesteve/openerpseda | openerp/addons_extra/partner_sequence_unify/partner_sequence_unify.py | Python | agpl-3.0 | 2,771 |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Pngwriter(CMakePackage):
"""PNGwriter is a very easy to use open source graphics library t... | iulian787/spack | var/spack/repos/builtin/packages/pngwriter/package.py | Python | lgpl-2.1 | 1,625 |
##############################################################################
# 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 | lib/spack/spack/cmd/use.py | Python | lgpl-2.1 | 1,713 |
##############################################################################
# Copyright (c) 2013-2017, 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... | TheTimmy/spack | var/spack/repos/builtin/packages/r-modelmetrics/package.py | Python | lgpl-2.1 | 1,657 |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class RDoparallel(RPackage):
"""Provides a parallel backend for the %dopar% function using the p... | rspavel/spack | var/spack/repos/builtin/packages/r-doparallel/package.py | Python | lgpl-2.1 | 1,029 |
# -*- coding: utf8 -*-
from unittest import TestCase
from . import formattest
from .. import nbpy
from .nbexamples import nb0, nb0_py
class TestPy(formattest.NBFormatTest, TestCase):
nb0_ref = nb0_py
ext = 'py'
mod = nbpy
ignored_keys = ['collapsed', 'outputs', 'prompt_number', 'metadata']
de... | cloud9ers/gurumate | environment/lib/python2.7/site-packages/IPython/nbformat/v3/tests/test_nbpy.py | Python | lgpl-3.0 | 1,441 |
#
# 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... | apache/incubator-airflow | airflow/example_dags/example_complex.py | Python | apache-2.0 | 7,913 |
#!/usr/bin/python
import sys
import urlparse
import os
import requests
def chunkedFetchUrl(url, local_filename=None, **kwargs):
"""Adapted from http://stackoverflow.com/q/16694907"""
if not local_filename:
local_filename = url.split('/')[-1]
# NOTE the stream=True parameter
r = requests.get(u... | usc-isi-i2/dig-alignment | versions/1.0/datasets/atf/bin/minicurl.py | Python | apache-2.0 | 973 |
import distutils.dir_util
import glob
import os
import shutil
import subprocess
import time
from cassandra.concurrent import execute_concurrent_with_args
from dtest import (Tester, cleanup_cluster, create_ccm_cluster, create_ks,
debug, get_test_path)
from tools.assertions import assert_one
from too... | snazy/cassandra-dtest | snapshot_test.py | Python | apache-2.0 | 23,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 us... | bavardage/spark | python/pyspark/context.py | Python | apache-2.0 | 11,827 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Tests for Apple System Log file parser."""
import unittest
from plaso.formatters import asl as _ # pylint: disable=unused-import
from plaso.lib import timelib
from plaso.parsers import asl
from tests.parsers import test_lib
class AslParserTest(test_lib.ParserTestCase):... | ostree/plaso | tests/parsers/asl.py | Python | apache-2.0 | 2,820 |
"""Support for SCSGate switches."""
import logging
import voluptuous as vol
from homeassistant.components import scsgate
from homeassistant.components.switch import SwitchDevice, PLATFORM_SCHEMA
from homeassistant.const import ATTR_ENTITY_ID, ATTR_STATE, CONF_NAME, CONF_DEVICES
import homeassistant.helpers.config_val... | Cinntax/home-assistant | homeassistant/components/scsgate/switch.py | Python | apache-2.0 | 5,491 |
import unittest
import imp
import os
import errno
import sys
import glob
import re
from distutils.errors import *
def unlink(path):
try:
os.unlink(path)
except OSError, exc:
if exc.errno != errno.ENOENT:
raise
class BrokenTest(unittest.TestCase.failureException):
def __repr__... | sshrdp/mclab | lib/antlr-3.0.1/runtime/Python/tests/testbase.py | Python | apache-2.0 | 9,623 |
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the 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... | ChameleonCloud/horizon | horizon/tables/__init__.py | Python | apache-2.0 | 1,788 |
# Copyright 2016 IBM Corp.
# 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... | eonpatapon/rally | rally/plugins/openstack/scenarios/nova/services.py | Python | apache-2.0 | 1,390 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.