code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
# Copyright The Cloud Custodian Authors.
# SPDX-License-Identifier: Apache-2.0
from .azure_common import BaseTest, DEFAULT_SUBSCRIPTION_ID
from mock import patch
from c7n_azure.provider import Azure
from c7n.config import Config
from msrestazure.azure_cloud import (AZURE_CHINA_CLOUD, AZURE_GERMAN_CLOUD,
... | thisisshi/cloud-custodian | tools/c7n_azure/tests_azure/test_provider.py | Python | apache-2.0 | 3,227 |
from __future__ import absolute_import, unicode_literals
from mopidy.mpd import exceptions, protocol
@protocol.commands.add('close', auth_required=False)
def close(context):
"""
*musicpd.org, connection section:*
``close``
Closes the connection to MPD.
"""
context.session.close()
... | dbrgn/mopidy | mopidy/mpd/protocol/connection.py | Python | apache-2.0 | 1,186 |
# Eidolon Biomedical Framework
# Copyright (C) 2016-8 Eric Kerfoot, King's College London, all rights reserved
#
# This file is part of Eidolon.
#
# Eidolon is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, eit... | ericspod/Eidolon | tests/unittests/testrotator.py | Python | gpl-3.0 | 4,097 |
#!/Users/Niraj/Documents/DataSci/FogOrNot/code/production/FogOrNot/flask/bin/python
import sys
import json
import argparse
from pprint import pformat
import jmespath
from jmespath import exceptions
def main():
parser = argparse.ArgumentParser()
parser.add_argument('expression')
parser.add_argument('-f',... | webmasterraj/FogOrNot | flask/bin/jp.py | Python | gpl-2.0 | 1,740 |
"""Utilities that may be distributed as separate packages."""
| novafloss/django-anysign | django_anysign/utils/__init__.py | Python | bsd-3-clause | 62 |
__author__ = 'Georgios Rizos (georgerizos@iti.gr)'
from setuptools import setup
def readme():
with open("README.md") as f:
return f.read()
setup(
name='news-popularity-prediction',
version='0.1.2',
author='Georgios Rizos',
author_email='georgerizos@iti.gr',
packages=['news_popularity... | MKLab-ITI/news-popularity-prediction | setup.py | Python | apache-2.0 | 1,783 |
#!/usr/bin/python3
# Copyright (c) 2018-2021 Dell Inc. or its subsidiaries.
#
# 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... | dsp-jetpack/JetPack | src/pilot/dell_nfv_edge.py | Python | apache-2.0 | 6,869 |
# Copyright 2017 Bridgewater Associates
#
# 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... | Netflix/security_monkey | security_monkey/tests/watchers/vpc/test_subnet.py | Python | apache-2.0 | 1,556 |
"""Add badge support to elections
Revision ID: 5ecdd55b4af4
Revises: 2b8f5a6f10a4
Create Date: 2019-03-18 12:21:59.536380
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "5ecdd55b4af4"
down_revision = "2b8f5a6f10a4"
def upgrade():
""" Add the url_badge co... | fedora-infra/elections | alembic/versions/5ecdd55b4af4_add_badge_support_to_elections.py | Python | gpl-2.0 | 568 |
import pytz
from django.apps import apps
from django.contrib.auth.models import Group
from django.core.exceptions import ObjectDoesNotExist
from django.db import models, transaction
from django.utils import timezone
from django.utils.functional import cached_property
from guardian.shortcuts import assign_perm
from gua... | erinspace/osf.io | osf/models/mixins.py | Python | apache-2.0 | 27,697 |
import numpy as np
import pandas as pd
from astropy import constants as c
from cachelib import SimpleCache
cache = SimpleCache()
colors = {
'Blue': '#1f77b4',
'Orange': '#ff7f0e',
'Green': '#2ca02c',
'Red': '#d62728',
'Purple': '#9467bd',
}
def readExoplanetEU():
"""Read the exoplanet.eu data... | DanielAndreasen/SWEETer-Cat | sweetercat/utils.py | Python | mit | 10,496 |
import click
from cenotes import create_app, db, models
@click.command()
@click.option('--cleanup', is_flag=True, default=False,
help="Cleanup expired notes")
@click.option('--settings', show_default=True, type=click.Choice(
["Production", "Development", "Testing"]), default="Production")
@click.opt... | ioparaskev/cenotes | cenotes/cli.py | Python | gpl-3.0 | 798 |
# -*- coding: utf-8 -*-
"""
@Author: Alistair Magee
Adds ability to specify custom urls for different categories
(or subcategories if using subcategory plugin) of article
using a dictionary stored in pelican settings file as
{category: {article_url_structure: stirng, article_save_as: string}}
"""
from pelican import ... | BenoitDherin/data-analysis-with-R | website/plugins/custom_article_urls/custom_article_urls.py | Python | mit | 1,778 |
from __future__ import absolute_import
import gevent
def wait_many(*args, **kwargs):
def _async():
for awaitable in args:
awaitable.wait()
gevent.spawn(_async).get(timeout=kwargs.get('timeout', None))
if kwargs.get('track_exceptions', True):
from rowboat import raven_client
... | b1naryth1ef/rowboat | rowboat/util/gevent.py | Python | mit | 462 |
#!/usr/bin/python
#-- Content-Encoding: UTF-8 --
"""
Component C.
:author: Bassem Debbabi
:copyright: Copyright 2013, isandlaTech
:license: Apache Software License 2.0
"""
from pelix.ipopo.decorators import ComponentFactory, Provides
@ComponentFactory("hello_spanish_factory")
@Provides("java:/cohorte.demos.hello.He... | isandlaTech/cohorte-demos | hello/step3/node2/repo/hello/hello_spanish.py | Python | apache-2.0 | 480 |
# uncompyle6 version 2.9.10
# Python bytecode 2.7 (62211)
# Decompiled from: Python 3.6.0b2 (default, Oct 11 2016, 05:27:10)
# [GCC 6.2.0 20161005]
# Embedded file name: ascii.py
""" Python 'ascii' Codec
Written by Marc-Andre Lemburg (mal@lemburg.com).
(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
"""
impo... | DarthMaulware/EquationGroupLeaks | Leak #5 - Lost In Translation/windows/Resources/Python/Core/Lib/encodings/ascii.py | Python | unlicense | 1,209 |
def order_word(s):
return ''.join(sorted(s)) if s else 'Invalid String!'
| the-zebulan/CodeWars | katas/kyu_7/ordering_the_words.py | Python | mit | 77 |
"""Program used to create, train, and evaluate "text correcting" models.
Defines utilities that allow for:
1. Creating a TextCorrectorModel
2. Training a TextCorrectorModel using a given DataReader (i.e. a data source)
3. Decoding predictions from a trained TextCorrectorModel
The program is best run from the command ... | Raja-VP/dl-text-corrector | correct_text.py | Python | apache-2.0 | 17,564 |
# encoding: utf-8
# module _codecs
# from (built-in)
# by generator 1.130
# no doc
# no imports
# functions
def ascii_decode(*args, **kwargs): # real signature unknown
pass
def ascii_encode(*args, **kwargs): # real signature unknown
pass
def charbuffer_encode(*args, **kwargs): # real signature unknown
p... | akiokio/centralfitestoque | src/.pycharm_helpers/python_stubs/-1807332816/_codecs.py | Python | bsd-2-clause | 5,216 |
## To be done!
from rekall_agent import crypto
class EncryptedGCSServerPolicy(agent.ServerPolicy):
"""A server deployment policy which stored files in Google Cloud Storage."""
schema = [
dict(name="server_private_key", type=crypto.RSAPrivateKey,
doc="The client's private key"),
... | dsweet04/rekall | rekall-agent/rekall_agent/policies/encrypted_gcs.py | Python | gpl-2.0 | 1,070 |
#!usr/bin/env python
#
# Copyright 2013 Matthew Wall
# See the file LICENSE.txt for your full rights.
#
# Thanks to Kenneth Lavrsen for the Open2300 implementation:
# http://www.lavrsen.dk/foswiki/bin/view/Open2300/WebHome
# description of the station communication interface:
# http://www.lavrsen.dk/foswiki/bin/vie... | garretlh/nimbus-drivers | src/main/python/nimbusdrivers/ws23xx.py | Python | gpl-3.0 | 72,031 |
#!/usr/bin/env python
import string
import sys
import re
import os
import time
from optparse import OptionParser
import lsc
import numpy as np
description = "> Fast astrometry of lsc and sofi images "
usage = "%prog listfile"
if __name__ == "__main__":
parser = OptionParser(usage=usage, description=description... | svalenti/lcogtsnpipe | trunk/bin/lscastro.py | Python | mit | 9,389 |
# Copyright 2013 Mirantis, 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 agr... | JioCloud/oslo.config | oslo_config/types.py | Python | apache-2.0 | 11,675 |
#!/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... | jcftang/ansible | lib/ansible/modules/network/eos/eos_config.py | Python | gpl-3.0 | 12,989 |
from django.contrib import admin
from currencies.models import Currency
class CurrencyAdmin(admin.ModelAdmin):
list_display = ("name", "is_active", "is_base", "is_default", "code", "symbol", "factor")
list_filter = ("is_active", )
search_fields = ("name", "code")
admin.site.register(Currency, CurrencyAdm... | ydaniv/django-currencies | currencies/admin.py | Python | bsd-3-clause | 324 |
# -*- coding: utf-8 -*-
# Copyright (C) 2011-2012 Vodafone España, S.A.
# Author: Andrew Bird
#
# 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 o... | andrewbird/wader | plugins/devices/zte_mf180.py | Python | gpl-2.0 | 1,826 |
"""
Test objconfig.reader.Json
"""
import pytest
from objconfig.exception import RuntimeException
from objconfig.reader import Json
import os
def test_emptyinstantiation_json():
conf = Json()
assert isinstance(conf, Json), "Empty Instantiation Failed"
def test_readfromfile_json():
conf = Json()
conf... | asherwunk/objconfig | tests/reader/test_json_reader.py | Python | mit | 1,694 |
# -*- coding: utf-8 -*-
#
# (c) Copyright 2001-2007 Hewlett-Packard Development Company, L.P.
#
# 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 opt... | matrumz/RPi_Custom_Files | Printing/hplip-3.15.2/ui/setupsettings.py | Python | gpl-2.0 | 3,819 |
from __future__ import print_function, unicode_literals
import six, os, sys, shutil, errno, time, signal
from io import StringIO
from twisted.python import usage
from twisted.internet import defer
from twisted.scripts import twistd
# does "flappserver start" need us to refrain from importing the reactor here?
# A: pro... | warner/foolscap | src/foolscap/appserver/cli.py | Python | mit | 16,178 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright: (c) 2019, F5 Networks Inc.
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | rosmo/ansible | lib/ansible/modules/network/f5/bigiq_device_discovery.py | Python | gpl-3.0 | 39,256 |
from pressgang.utils.pages import Page
def access_denied(request):
"""Shown to alert a user that access was denied to a particular page."""
page = Page(request)
return page.render('pressgang/accounts/denied.html')
| oberlin/pressgang | pressgang/accounts/views.py | Python | bsd-3-clause | 219 |
from __future__ import absolute_import, print_function, division
from __future__ import print_function
import sys
import time
from six import iteritems
from theano.compile.pfunc import pfunc
from theano import tensor
import numpy
from six.moves import xrange
import theano.sandbox.cuda as tcn
def compare_fns(fns, in... | JazzeYoung/VeryDeepAutoEncoder | theano/sandbox/cuda/tests/walltime.py | Python | bsd-3-clause | 2,324 |
# Copyright (C) 2013-2014 eNovance SAS <licensing@enovance.com>
#
# 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 appl... | redhat-cip/hardware | hardware/tests/test_hpacucli.py | Python | apache-2.0 | 21,748 |
from django.forms.widgets import Widget, HiddenInput, TextInput
from django.utils.safestring import mark_safe
class AutoCompleteWidget(Widget):
"""
Widget that presents an <input> field that can be used to search for
objects instead of a giant <select> field
You will need to include jQuery Autocomple... | sedden/django-basic-apps | basic/tools/forms/fields.py | Python | bsd-3-clause | 2,592 |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | yugangw-msft/azure-cli | src/azure-cli/azure/cli/command_modules/consumption/commands.py | Python | mit | 3,867 |
# -*- coding: utf-8 -*-
"""
Copyright (C) 2017 IBM Corporation
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... | open-power-sdk/source-code-advisor | sca/controller.py | Python | apache-2.0 | 3,147 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-05-05 11:02
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('diary', '0003_auto_20160504_1443'),
]
operations = [
migrations.AlterField(
... | araksin/leandiary | diary/migrations/0004_auto_20160505_1102.py | Python | mit | 465 |
import asyncio
import pip
import pickle
import os.path
try:
import discord
except:
pip.main(['install', 'git+https://github.com/Rapptz/discord.py@async#egg=discord.py'])
try:
import win_unicode_console
except:
0
try:
from lxml import html
except ImportError:
pip.main(['install', 'lxml'])
t... | Wicloz/AnimeNotifierBot | bot.py | Python | mit | 8,060 |
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... | google/tangent | tests/test_comments.py | Python | apache-2.0 | 1,306 |
import sys, os
sys.path.append(os.getcwd())
import numpy as np
import brica1
def test_autostep():
agent = brica1.Agent()
scheduler = brica1.VirtualTimeScheduler(agent)
zero = np.zeros(3, dtype=np.short)
data = np.array([1, 2, 3], dtype=np.short)
CompA = brica1.ConstantComponent()
CompB = br... | wbap/BriCA1 | tests/virtual_time/test_async.py | Python | apache-2.0 | 5,365 |
import asyncio
import datetime as dt
import io
import json
import logging
import re
import time
import urllib.parse
from calendar import timegm
from contextlib import closing
from html.parser import HTMLParser
from logging.handlers import TimedRotatingFileHandler
from typing import List, Union, Dict, Option... | Tschis/NabBot | utils/tibia.py | Python | apache-2.0 | 49,295 |
from __future__ import print_function
import digdag
def generate():
with open("result.csv", "w") as f:
f.write("ok")
def check_generated():
with open("result.csv", "r") as f:
data = f.read()
if len(data) < 2:
raise Exception("Output data is too small")
print("ok.")
class Gene... | treasure-data/digdag | examples/tasks/check_task.py | Python | apache-2.0 | 701 |
import numpy as np
from bregman.suite import *
from cjade import cjade
from scipy.optimize import curve_fit
from numpy.linalg.linalg import svd
def cseparate(x, M=None, N=4096, H =1024, W=4096, max_iter=200, pre_emphasis=True, magnitude_only=False, svd_only=False, transpose_spectrum=False):
"""
complex-valued freque... | bregmanstudio/cseparate | cseparate.py | Python | mit | 2,850 |
# -*- coding: ISO-8859-1 -*-
from .MidiOutStream import MidiOutStream
class MidiToText(MidiOutStream):
"""
This class renders a midi file as text. It is mostly used for debugging
"""
#############################
# channel events
def channel_message(self, message_type, channel, dat... | JonathanRaiman/Dali | data/score_informed_transcription/midi/MidiToText.py | Python | mit | 4,176 |
# Copyright 2004-2005 Joe Wreschnig, Michael Urman
#
# 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.
from typing import... | Mellthas/quodlibet | quodlibet/formats/remote.py | Python | gpl-2.0 | 1,429 |
# -*- test-case-name: twisted.words.test.test_jabberxmppstringprep -*-
#
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
from encodings import idna
from itertools import chain
import stringprep
# We require Unicode version 3.2.
from unicodedata import ucd_3_2_0 as unicodedata
from twisted.pyt... | EricMuller/mynotes-backend | requirements/twisted/Twisted-17.1.0/src/twisted/words/protocols/jabber/xmpp_stringprep.py | Python | mit | 7,221 |
'''
This file is used to allow the skrf vi docs to be build without having
a working visa module
'''
class Dummy(object):
def __init__(self, *args, **kwargs):
pass
def __getattr__(self,name):
print('tried to get %s'%name)
return Dummy1()
class Dummy1(object):
def __init__(self, *args, **kwargs):
pass ... | willhaines/scikit-rf | doc/sphinxext/visa.py | Python | bsd-3-clause | 983 |
# -*- coding: utf-8 -*-
# This file is part of AYAB.
#
# AYAB 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.
#
# AYAB i... | fashiontec/knitlib | src/knitlib/plugins/ayab_plugin/ayab_control.py | Python | lgpl-3.0 | 18,095 |
def extractAnneAndCindy(item):
"""
# 'Anne And Cindy'
"""
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol or frag) or 'preview' in item['title'].lower():
return None
return False
| fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractAnneAndCindy.py | Python | bsd-3-clause | 232 |
#-------------------------------------------------------------------------------
# Colorado West Region Data Integration Group
# Name: config_roads.py
# Purpose: Write configuration file for road centerlines
# Author: Heather Widlund, San Miguel County, CO
# heatherw@sanmiguelcountyco.gov
#... | hwidlund/integration | scripts/configroads.py | Python | gpl-3.0 | 7,067 |
#
# 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... | wooga/airflow | airflow/ti_deps/dep_context.py | Python | apache-2.0 | 4,785 |
try: # pragma: no cover (pyramid 1.0.X)
# "pyramid.paster.paste_script_template_renderer" doesn't exist past 1.0.X
from pyramid.paster import paste_script_template_renderer
from pyramid.paster import PyramidTemplate
except ImportError: # pragma: no cover
try: # pragma: no cover (pyramid 1.1.X, 1.2.X)
... | binarydud/pyramid_spine | pyramid_spine/scaffolds/__init__.py | Python | bsd-3-clause | 858 |
import os
import shutil
import zipfile
import fnmatch
import uuid
def main():
kits = findAll(".")
for kit in kits:
print("* ", kit, " -> ", kits[kit])
print()
print()
print("Starting extraction:")
print("------------------------------------------")
extractKits(kits)
def findAll(dir... | joewashear007/ScrappyDoo | copy.py | Python | mit | 3,382 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, division, unicode_literals
##
## This file is part of MoaT, the Master of all Things.
##
## MoaT is Copyright © 2007-2016 by Matthias Urlichs <matthias@urlichs.de>,
## it is licensed under the GPLv3. See the file `README.rst` for details... | smurfix/MoaT | irrigation/rainman/models/controller.py | Python | gpl-3.0 | 3,042 |
# Copyright (C) 2010-2011 Richard Lincoln
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish... | rwl/PyCIM | CIM15/IEC61970/Informative/InfERPSupport/ErpReqLineItem.py | Python | mit | 5,689 |
# Copyright (c) 2012 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 inspect
import time
class TimeoutException(Exception):
pass
def WaitFor(condition,
timeout, poll_interval=0.1,
pass_tim... | junmin-zhu/chromium-rivertrail | tools/chrome_remote_control/chrome_remote_control/util.py | Python | bsd-3-clause | 1,051 |
# -*- coding: utf-8
# pylint: disable=line-too-long
"""The library to split merged profiles into smaller profiles.
The default client of this library is under bin/anvi-split"""
import os
import sys
import copy
import argparse
from collections import Counter
import anvio
import anvio.db as db
import anvio.tables as... | meren/anvio | anvio/splitter.py | Python | gpl-3.0 | 66,297 |
# Copyright 2019 Fortinet, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the... | thaim/ansible | test/units/modules/network/fortios/test_fortios_router_multicast.py | Python | mit | 6,178 |
#!/bin/python
# This script will upload the data from @mlungren's project, including basic reports and labels
# (see README.md for full instructions). In the long run we want a standard data format for importing.
# AllowedAnnotation objects store a label name and allowed value, and an Annotation combines one of these ... | radinformatics/whatisit | scripts/upload_demo.py | Python | mit | 5,956 |
# 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... | strint/tensorflow | tensorflow/contrib/distributions/python/kernel_tests/mixture_test.py | Python | apache-2.0 | 25,926 |
# -*- coding: utf-8 -*-
#
# gPodder - A media aggregator and podcast client
# Copyright (c) 2005-2018 The gPodder Team
#
# gPodder 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 Licens... | gpodder/gpodder | src/gpodder/gtkui/config.py | Python | gpl-3.0 | 7,786 |
# Copyright 2015 ETH Zurich
#
# 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, sof... | dmpiergiacomo/scion | python/test/lib/packet/path_test.py | Python | apache-2.0 | 14,297 |
"""
slackd.commands
~~~~~~~~~~~~~~~
:copyright: (c) 2016 David M. Westerhoff
:license: All rights reserved
"""
| dmwesterhoff/slackd | slackd/commands/__init__.py | Python | mit | 113 |
"""App Engine configuration file."""
import json
import os
import re
import sys
from mimic.__mimic import common
from mimic.__mimic import datastore_tree
from __pg import appids
from __pg import caching_urlfetch_tree
from __pg import settings
from google.appengine.api import app_identity
def _FixupSysPath():
"... | jackpunt/playground | appengine_config.py | Python | apache-2.0 | 1,847 |
import datetime
from nose.tools import assert_almost_equals
from vacation import transactions as trans
def test_validate_setup_empty():
assert trans.validate_setup([]) is True
def test_validate_setup_missing_rate():
transactions = ['2015-11-01: days 0']
assert trans.validate_setup(transactions[:1]) is... | pulseenergy/vacation | vacation/tests/test_transactions.py | Python | gpl-2.0 | 1,950 |
#!/usr/bin/env python
# Copyright (C) 2015 Swift Navigation Inc.
# Contact: Bhaskar Mookerji <mookerji@swiftnav.com>
#
# This source is subject to the license found in the file 'LICENSE' which must
# be be distributed together with this source. All other rights reserved.
#
# THIS CODE AND INFORMATION IS PROVIDED "AS IS... | paparazzi/libsbp | python/bench/memory.py | Python | lgpl-3.0 | 1,036 |
#
# Quru Image Server
#
# Document: template_attrs.py
# Date started: 12 May 2011
# By: Matt Fozard
# Purpose: Wrapper for an image template definition
# Requires:
# Copyright: Quru Ltd (www.quru.com)
# Licence:
#
# This program is free software: you can redistribute it and/or modify
# it... | quru/qis | src/imageserver/template_attrs.py | Python | agpl-3.0 | 7,874 |
# -*-coding:Utf-8 -*
# Copyright (c) 2010-2017 LE GOFF Vincent
# 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
... | vlegoff/tsunami | src/primaires/joueur/commandes/groupe/__init__.py | Python | bsd-3-clause | 3,565 |
__author__ = 'pwidqssg'
from base import CaddiesObject
class ResponseDomainAll(CaddiesObject):
def __init__(self, id, response_domain_type_id = None, domain_id = None, domain_type = ''):
self.id = id
self.response_domain_type_id = response_domain_type_id
self.domain_id = domain_id
... | CLOSER-Cohorts/us2caddies | us2caddies/caddies/objects/response_domain_all.py | Python | gpl-2.0 | 350 |
#
# 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... | bravo-zhang/spark | python/pyspark/ml/base.py | Python | apache-2.0 | 8,051 |
'''
Created on Apr 25, 2012
@author: h87966
'''
import unittest
from unit6.user.user_data import UserData
from unit6.validation import UserSignupValidation, LoginValidation
from unit6.validation import VERIFICATION_MESSAGES
from unit6.validation import VERIFICATION_MESSAGES_KEYS
from unit6.validation import MISMATCHED... | cdoremus/udacity-python_web_development-cs253 | test/unit6/validation_test.py | Python | apache-2.0 | 8,121 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2015, Joseph Callen <jcallen () csc.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the Li... | slank/ansible | lib/ansible/modules/cloud/vmware/vmware_vm_vss_dvs_migrate.py | Python | gpl-3.0 | 5,553 |
from __future__ import unicode_literals, print_function, division
import os
import zipfile
import re
def create_or_append_to_zip(file_handle, zip_path, arc_name=None):
"""
Append file_handle to given zip_path with name arc_name if given, else file_handle. zip_path will be created.
:param file_handle: pat... | henzk/django-productline | django_productline/utils.py | Python | mit | 1,600 |
import os, logging, re
from autotest.client.shared import error
from autotest.client.virt import virt_test_utils
@error.context_aware
def run_cpu_hotplug(test, params, env):
"""
Runs CPU hotplug test:
1) Pick up a living guest
2) Send the monitor command cpu_set [cpu id] for each cpu we wish to have
... | nacc/autotest | client/tests/kvm/tests/cpu_hotplug.py | Python | gpl-2.0 | 4,606 |
# -*- coding: utf-8 -*-
import logging
from operator import methodcaller
from typing import List
from django.core.exceptions import ObjectDoesNotExist
from kobo.django.xmlrpc.decorators import user_passes_test
from tcms.issuetracker.models import Issue
from tcms.management.models import TCMSEnvValue, TestTag
from tc... | Nitrate/Nitrate | src/tcms/xmlrpc/api/testrun.py | Python | gpl-2.0 | 23,617 |
# coding: utf-8
from django import forms
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
from registration import forms as registration_forms
from kobo.static_lists import SECTORS, COUNTRIES
USERNAME_REGEX = r'^[a-z][a-z0-9_]+$'
USERNAME_MAX_LENGTH = 30
USERNAME_INV... | onaio/kpi | kpi/forms.py | Python | agpl-3.0 | 1,879 |
class State:
def __init__(self, state_checker):
self.state_checker = state_checker
self.state = None
self.previous_state = None
def get_current_state(self):
return self.state
def update_state(self):
self.state_checker.update_builders_status()
self.previous_s... | michalkaptur/buildbot_indicator | state.py | Python | gpl-3.0 | 479 |
# Copyright 2008 Dan Smith <dsmith@danplanet.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 3 of the License, or
# (at your option) any later version.
#
# This program is ... | mach327/chirp_fork | chirp/drivers/icf.py | Python | gpl-3.0 | 19,757 |
#!/usr/bin/env python
"""
Created on Jun 19, 2012
"""
from __future__ import division
__author__ = "Shyue Ping Ong"
__copyright__ = "Copyright 2012, The Materials Project"
__version__ = "0.1"
__maintainer__ = "Shyue Ping Ong"
__email__ = "shyue@mit.edu"
__date__ = "Jun 19, 2012"
import unittest
import os
import war... | migueldiascosta/pymatgen-db | matgendb/tests/test_creator_and_query_engine.py | Python | mit | 6,787 |
import sqlite3
import win32crypt
import sys, os, platform
from config.constant import *
from config.write_output import print_output, print_debug
from config.header import Header
from config.moduleInfo import ModuleInfo
class Chrome(ModuleInfo):
def __init__(self):
options = {'command': '-c', 'action': 'store_true'... | theoneandonly-vector/LaZagne | Windows/src/LaZagne/softwares/browsers/chrome.py | Python | lgpl-3.0 | 2,201 |
# -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license
from enum im... | petrjasek/superdesk-core | apps/concept_items/enums.py | Python | agpl-3.0 | 762 |
# coding=utf-8
# Copyright 2022 The Google Research 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 applicab... | google-research/google-research | representation_batch_rl/batch_rl/ddpg.py | Python | apache-2.0 | 3,731 |
from django.contrib import admin
from apps.categories.models import Category
class CategoryAdminOption(admin.ModelAdmin):
list_display = ("get_repr", "get_tree")
ordering = ("url",)
search_fields = ('name', )
admin.site.register(Category, CategoryAdminOption)
| Ajeetlakhani/django-mptt-autocomplete | treewidget/apps/categories/admin.py | Python | bsd-2-clause | 276 |
# -*- coding: utf-8 -*-
##
## This file is part of INSPIRE.
## Copyright (C) 2015 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 2 of the
## License, or (at your option) a... | ioannistsanaktsidis/inspire-next | inspire/base/format_elements/bfe_inspire_conferences_date.py | Python | gpl-2.0 | 2,924 |
###############################################################################
# Copyright (C) 2007, 2008, 2009 The Molecular Sciences Institute
# Original Author:
# Nathan Addy, Scientific Programmer Email: addy@molsci.org
# The Molecular Sciences Institute
#
##################################################... | ecell/libmoleculizer | python-src/language_parser/moleculizer/moleculizerrules.py | Python | gpl-2.0 | 21,379 |
# 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 th... | mtreinish/stestr | stestr/tests/repository/test_sql.py | Python | apache-2.0 | 5,843 |
"""
"""
from __future__ import absolute_import
import subprocess
import sys
from os import makedirs, listdir
from os.path import exists, join, basename
from abc import ABCMeta, abstractmethod
try:
from urllib.parse import urlparse
except ImportError:
from urlparse import urlparse
import requests
import yaml
... | galaxyproject/starforge | starforge/cache.py | Python | mit | 9,293 |
from __future__ import absolute_import
from sentry.models import Activity
from .mail import ActivityMailDebugView
class DebugUnassignedEmailView(ActivityMailDebugView):
def get_activity(self, request, event):
return {"type": Activity.UNASSIGNED, "user": request.user}
| mvaled/sentry | src/sentry/web/frontend/debug/debug_unassigned_email.py | Python | bsd-3-clause | 284 |
def calculate_weight(weight, increase):
for year in range(1, 16):
weight = weight + increase
moon_weight = weight * 0.165
print('Year %s is %s' % (year, moon_weight))
calculate_weight(40, 0.5) | amosnier/python_for_kids | book_code/appendixb/ch7-moon-weight.py | Python | gpl-3.0 | 221 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-11-07 09:39
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Sugges... | renoc/django-suggestion-box | suggestionbox/migrations/0001_initial.py | Python | mit | 1,089 |
import logging
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.shortcuts import redirect, render
from django.utils.translation import ugettext as _
from django.views.generic import TemplateView
from django.contrib.auth.views import password_change, password_re... | BryceLohr/authentic | authentic2/registration_backend/views.py | Python | agpl-3.0 | 1,518 |
import logging
from collections import defaultdict
from django.utils import dateparse
from rest_framework.exceptions import ValidationError
from waldur_client import WaldurClient, WaldurClientException
from waldur_core.structure import models as structure_models
from waldur_mastermind.marketplace import models as mar... | opennode/nodeconductor-assembly-waldur | src/waldur_mastermind/marketplace_remote/utils.py | Python | mit | 7,736 |
from machikoro.constant import CardExpansion, CardSymbol, CardType
def test_colors():
assert CardType.PRIMARY_INDUSTRY == CardType.BLUE
assert CardType.SECONDARY_INDUSTRY == CardType.GREEN
assert CardType.RESTAURANT == CardType.RED
assert CardType.MAJOR_ESTABLISHMENT == CardType.PURPLE
def test_enum... | NimVek/machi_koro | tests/test_constants.py | Python | gpl-3.0 | 424 |
"""
A collection of Random Forest type classifier models.
.. autoclass:: revscoring.scorer_models.RF
:members:
:member-order:
"""
import logging
from sklearn.ensemble import RandomForestClassifier
from .sklearn_classifier import ScikitLearnClassifier
logger = logging.getLogger(__name__)
class RF(ScikitLea... | yafeunteun/wikipedia-spam-classifier | revscoring/revscoring/scorer_models/rf.py | Python | mit | 428 |
import sys
def setup(core, actor, buff):
return
def run(core, actor, target, commandString):
core.buffService.addBuffToCreature(target, 'fs_force_run', actor)
return
| agry/NGECore2 | scripts/commands/forcerun.py | Python | lgpl-3.0 | 173 |
# all the constants
import numpy as np
import re
from os import listdir
from collections import defaultdict
# flags
# TODO using gflag
FLAG_COREF=False
FLAG_PROP=False
FLAG_RNE=False
FLAG_VERB=False
FLAG_DEPPARSER='stanford'
FLAG_ONTO='wsj'
# constants
NOT_APPLY='_NOT_APPLY_'
EMPTY = None
NOT_ASSIGNED = None
NULL_E... | c-amr/camr | constants.py | Python | gpl-2.0 | 7,607 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('storage', '0002_workspace_is_move_enabled'),
('ingest', '0002_auto_20160414_0937'),
]
operations = [
migrations.Remo... | ngageoint/scale | scale/ingest/migrations/0003_auto_20160711_1044.py | Python | apache-2.0 | 1,424 |
#!/usr/bin/python
#
# Copyright 2008 Dan Smith <dsmith@danplanet.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 3 of the License, or
# (at your option) any later version.
... | coddingtonbear/d-rats | d_rats/station_status.py | Python | gpl-3.0 | 1,609 |
'''Monkeypatch s3 boto library for unittesting.'''
import boto.s3.bucket
import boto.s3.connection
import boto.s3.key
import mock_dict
import utils
Bucket__init__ = boto.s3.bucket.Bucket.__init__
class MultiPartUpload(boto.s3.multipart.MultiPartUpload):
__metaclass__ = utils.monkeypatch_class
def upload_p... | catalyst-zero/docker-registry | test/utils/mock_boto_s3.py | Python | apache-2.0 | 3,337 |
# -*- coding:utf-8 -*-
import matplotlib.pyplot as plt
from process_data import *
from BPnetwork import *
train_x,train_y,train_query = loadDataSet('train.txt')
#val_x,val_y,val_query = loadDataSet('dataSet/vali.txt')
#test_x,test_y,test_query = loadDataSet('dataSet/test.txt')
train_pairs = extractPairs(train_y,train_... | wang-jinghui/learn-to-rank | RankNet/trainRankNet.py | Python | mit | 689 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.