text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
# Author: Ovidiu Predescu
# Date: July 2011
#
# 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 ... | tao12345666333/tornado-zh | tornado/test/twisted_test.py | Python | mit | 27,525 | 0.000327 |
#!/usr/bin/python
# -*- encoding: utf-8 -*-
import os
import marshal
import cPickle
import array
class HuffmanNode(object):
recurPrint = False
def __init__(self, ch=None, fq=None, lnode=None, rnode=None, parent=None):
self.L = lnode
self.R = rnode
self.p = parent
self.c = ch
... | fepe55/RAMB0 | python/huffman2.py | Python | mit | 6,447 | 0.005119 |
from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver
import libcloud.security
# This assumes you don't have SSL set up.
# Note: Code like this poses a security risk (MITM attack) and
# that's the reason why you should never use it for anything else
# besides testing. You have ... | Jc2k/libcloud | docs/examples/compute/openstack_simple.py | Python | apache-2.0 | 610 | 0 |
# Copyright 2017 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.
from __future__ import absolute_import
from telemetry.core import os_version as os_version_module
# TODO(rnephew): Since TestConditions are being used for ... | catapult-project/catapult | telemetry/telemetry/story/expectations.py | Python | bsd-3-clause | 9,428 | 0.005834 |
# (c) 2018, NetApp, Inc
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
''' unit test template for ONTAP Ansible module '''
from __future__ import print_function
import json
import pytest
from units.compat import unittest
from units.compat.mock import patch, Mock
from ans... | andmos/ansible | test/units/modules/storage/netapp/test_na_ontap_lun_copy.py | Python | gpl-3.0 | 5,814 | 0.00172 |
"""Base UptimeRobot entity."""
from __future__ import annotations
from pyuptimerobot import UptimeRobotMonitor
from homeassistant.helpers.entity import DeviceInfo, EntityDescription
from homeassistant.helpers.update_coordinator import (
CoordinatorEntity,
DataUpdateCoordinator,
)
from .const import ATTR_TARG... | aronsky/home-assistant | homeassistant/components/uptimerobot/entity.py | Python | apache-2.0 | 1,942 | 0.000515 |
# coding: utf-8
""" General utilities. """
from __future__ import division, print_function
__author__ = "adrn <adrn@astro.columbia.edu>"
# Standard library
import collections
import sys
import logging
import multiprocessing
# Third-party
import numpy as np
__all__ = ['get_pool']
# Create logger
logger = logging.... | abonaca/gary | gary/util.py | Python | mit | 3,607 | 0.001941 |
from statistics import median
import numpy as np
from PyQt5.QtCore import QRegExp, pyqtSlot, pyqtSignal
from PyQt5.QtGui import QRegExpValidator, QIcon
from PyQt5.QtWidgets import QWidget, QSpinBox, QLabel, QComboBox, QSlider
from urh import settings
from urh.dev import config
from urh.dev.BackendHandler import Backe... | jopohl/urh | src/urh/controller/widgets/DeviceSettingsWidget.py | Python | gpl-3.0 | 24,781 | 0.00339 |
#!/usr/bin/env python
# Copyright 2014-2019 The PySCF Developers. 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
#
# U... | gkc1000/pyscf | pyscf/shciscf/examples/03_c2_diffsymm.py | Python | apache-2.0 | 1,773 | 0.002256 |
# #
# Copyright 2013-2014 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://vscentrum.be/nl/en),
# the Hercules foundation (ht... | geimer/easybuild-framework | test/framework/toy_build.py | Python | gpl-2.0 | 33,739 | 0.004742 |
# -*- coding: utf-8 -*-
'''
flixnet Add-on
Copyright (C) 2016 flixnet
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... | repotvsupertuga/repo | script.module.stream.tvsupertuga.addon/resources/lib/indexers/episodes.py | Python | gpl-2.0 | 65,914 | 0.011909 |
# 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 later version.
#
# This program is distributed i... | Erethon/synnefo | snf-astakos-app/astakos/im/views/target/redirect.py | Python | gpl-3.0 | 4,711 | 0 |
"""Entity and System Managers."""
import six
from ecs.exceptions import (
NonexistentComponentTypeForEntity, DuplicateSystemTypeError,
SystemAlreadyAddedToManagerError)
from ecs.models import Entity
class EntityManager(object):
"""Provide database-like access to components based on an entity key."""
... | seanfisk/ecs | ecs/managers.py | Python | mit | 8,344 | 0 |
# -*- coding: utf-8 -*-
"""
eve.methods.post
~~~~~~~~~~~~~~~~
This module imlements the POST method, supported by the resources
endopints.
:copyright: (c) 2015 by Nicola Iarocci.
:license: BSD, see LICENSE for more details.
"""
from datetime import datetime
from flask import current_app as a... | Hearen/OnceServer | Server/Eve/post.py | Python | mit | 12,002 | 0.000167 |
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from django.template import RequestContext
from django.shortcuts import render_to_response
from django.utils.translation import ugettext
from django.contrib.auth.decorators import login_required
from django.contrib.admin.views.dec... | hzlf/openbroadcast | website/apps/invitation/views.py | Python | gpl-3.0 | 7,841 | 0.000893 |
from haystack import indexes
from photolib.models import Photo
class PhotoIndex(indexes.SearchIndex, indexes.Indexable):
text = indexes.CharField(document=True, use_template=True)
alt = indexes.CharField(model_attr='alt', indexed=False)
uuid = indexes.CharField(model_attr='uuid', indexed=False)
thumb... | sunlightlabs/horseradish | photolib/search_indexes.py | Python | bsd-3-clause | 592 | 0.001689 |
# -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
from openerp.osv import osv, fields
class users(o... | HBEE/odoo-addons | account_journal_security/res_users.py | Python | agpl-3.0 | 741 | 0.008097 |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distrib... | Microvellum/Fluid-Designer | win64-vc/2.78/scripts/addons/io_scene_ms3d/ms3d_utils.py | Python | gpl-3.0 | 5,817 | 0.002235 |
"""
Django-Datamaps provides helper functions compatible with datamaps.js.
"""
__version__ = '0.2.2'
| rochapps/django-datamaps | datamaps/__init__.py | Python | bsd-2-clause | 103 | 0 |
from build import evaluate_callables
class WhenEvaluatingADictWithNoCallables:
def when_i_evaluate_the_dict(self):
self.result = evaluate_callables({"abc": 123, "def": 456, "xyz": 789})
def it_should_return_the_same_dict(self):
assert self.result == {"abc": 123, "def": 456, "xyz": 789}
clas... | benjamin-hodgson/build | test/evaluate_callables_tests.py | Python | mit | 2,020 | 0.001485 |
"""
Default settings for the ``mezzanine.core`` app. Each of these can be
overridden in your project's settings module, just like regular
Django settings. The ``editable`` argument for each controls whether
the setting is editable via Django's admin.
Thought should be given to how a setting is actually used before
mak... | guibernardino/mezzanine | mezzanine/core/defaults.py | Python | bsd-2-clause | 18,350 | 0.004741 |
'''
Camera
======
Core class for acquiring the camera and converting its input into a
:class:`~kivy.graphics.texture.Texture`.
.. versionchanged:: 1.10.0
The pygst and videocapture providers have been removed.
.. versionchanged:: 1.8.0
There is now 2 distinct Gstreamer implementation: one using Gi/Gst
wo... | LogicalDash/kivy | kivy/core/camera/__init__.py | Python | mit | 4,415 | 0 |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Getting Things GNOME! - a personal organizer for the GNOME desktop
# Copyright (c) 2008-2013 - Lionel Dricot & Bertrand Rousseau
#
# This program is free software: you can redistribute it and/or modify it under
# t... | shtrom/gtg | GTG/core/plugins/api.py | Python | gpl-3.0 | 8,572 | 0.00035 |
# -*- coding: utf-8 -*-
class RomanianHelper(object):
@staticmethod
def englishize_romanian(string):
symbols = (u"țţȚŢșşȘŞăǎĂîÎâÂ",
u"ttTTssSSaaAiIaA")
tr = {ord(a):ord(b) for a, b in zip(*symbols)}
return string.translate(tr)
@staticmethod
def beautify_rom... | costibleotu/czl-scrape | sanatate/scrapy_proj/helpers/romanian.py | Python | mpl-2.0 | 509 | 0.004132 |
#
# The Python Imaging Library.
# $Id$
#
# PCX file handling
#
# This format was originally used by ZSoft's popular PaintBrush
# program for the IBM PC. It is also supported by many MS-DOS and
# Windows applications, including the Windows PaintBrush program in
# Windows 3.
#
# history:
# 1995-09-01 fl Cr... | robiame/AndroidGeodata | pil/PcxImagePlugin.py | Python | mit | 4,834 | 0.005379 |
# http://remotescripts.blogspot.com
"""
Track Control User Modes component originally designed for use with the APC40.
Copyright (C) 2010 Hanz Petrov <hanz.petrov@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Fre... | jim-cooley/abletonremotescripts | remote-scripts/samples/APC_64_40_r1b/APC_64_40/EncoderUserModesComponent.py | Python | apache-2.0 | 6,872 | 0.005675 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import io
import uuid
import os.path
import socket
import optparse
import cgi
docvert_root = os.path.dirname(os.path.abspath(__file__))
inbuilt_bottle_path = os.path.join(docvert_root, 'lib/bottle')
try:
import bottle
if not hasattr(bottle, 'static_file'... | holloway/docvert-python3 | docvert-web.py | Python | gpl-3.0 | 12,330 | 0.007218 |
# © 2014-2015 Tecnativa S.L. - Jairo Llopis
# © 2016 Tecnativa S.L. - Vicent Cubells
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import fields, models
class ResPartner(models.Model):
_inherit = "res.partner"
department_id = fields.Many2one("res.partner.department", "Depar... | OCA/partner-contact | partner_contact_department/models/res_partner.py | Python | agpl-3.0 | 839 | 0 |
"""
Copyright (c) 2012-2020 RockStor, Inc. <http://rockstor.com>
This file is part of RockStor.
RockStor 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 la... | phillxnet/rockstor-core | src/rockstor/scripts/qgroup_clean.py | Python | gpl-3.0 | 2,273 | 0.0022 |
#
# Copyright (c) 2013-2016 NORDUnet A/S
# Copyright (c) 2019 SUNET
# 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 copyrigh... | SUNET/eduid-common | src/eduid_common/config/workers.py | Python | bsd-3-clause | 3,033 | 0.00033 |
"""
Models from Godley & Lavoie text.
[G&L 2012] "Monetary Economics: An Integrated Approach to credit, Money, Income, Production
and Wealth; Second Edition", by Wynne Godley and Marc Lavoie, Palgrave Macmillan, 2012.
ISBN 978-0-230-30184-9
Copyright 2016 Brian Romanchuk
Licensed under the Apache License, Version 2.... | brianr747/SFC_models | sfc_models/gl_book/__init__.py | Python | apache-2.0 | 2,795 | 0.003936 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-05-12 16:09
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
import model_utils.fields
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
... | IQSS/geoconnect | gc_apps/content_pages/migrations/0001_initial.py | Python | apache-2.0 | 1,770 | 0.003955 |
"""Replacement for ``django.template.loader`` that uses Jinja 2.
The module provides a generic way to load templates from an arbitrary
backend storage (e.g. filesystem, database).
"""
from coffin.template import Template as CoffinTemplate
from jinja2 import TemplateNotFound
def find_template_source(name, dirs=None)... | AbleCoder/pyjade_coffin | pyjade_coffin/template/loader.py | Python | mit | 2,320 | 0 |
#!/home/software/SACLA_tool/bin/python2.7
import numpy as np
import h5py
import matplotlib
import matplotlib.pyplot as plt
import argparse
import time
#import pandas as pd
import sys
from argparse import ArgumentParser
parser = ArgumentParser()
parser = ArgumentParser(description="Plot intense ice shots")
parser.... | sellberg/SACLA2016A8015 | scripts/09_make_dark.py | Python | bsd-2-clause | 3,025 | 0.018182 |
# -*- coding: utf-8 -*-
import sys
import os
# Import the common config file
# Note that paths in the common config are interpreted as if they were
# in the location of this file
sys.path.insert(0, os.path.abspath('../../_common'))
from common_conf import *
# Override the common config
html_short_title_toc = man... | chtyim/cdap | cdap-docs/faqs/source/conf.py | Python | apache-2.0 | 603 | 0.008292 |
# -*- coding: utf-8 -*-
__license__ = 'GPL 3'
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
__docformat__ = 'restructuredtext en'
'''
Transform OEB content into RB compatible markup.
'''
import re
from calibre import prepare_string_for_xml
from calibre.ebooks.rb import unique_name
TAGS = [
'b',
... | Eksmo/calibre | src/calibre/ebooks/rb/rbml.py | Python | gpl-3.0 | 7,383 | 0.002844 |
# coding: utf-8
import os
import sys
import time
import tihldelib.userlib as lib
__author__ = 'Harald Floor Wilhelmsen'
def get_useramount():
formatstring = 'Format: python lan_users.py useramount'
# Checking if there are sufficient arguments, if not exit
if len(sys.argv) != 2:
sys.exit('Invail... | tihlde/TIHLDEscripts | userscripts/lan_users_ipa.py | Python | apache-2.0 | 1,614 | 0.001239 |
"""
Support for the myStrom buttons.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/binary_sensor.mystrom/
"""
import asyncio
import logging
from homeassistant.components.binary_sensor import (BinarySensorDevice, DOMAIN)
from homeassistant.components.ht... | ct-23/home-assistant | homeassistant/components/binary_sensor/mystrom.py | Python | apache-2.0 | 3,028 | 0 |
import gettext
import socket
import sys
import logging
_ = lambda x: gettext.ldgettext("rhsm", x)
import gtk
gtk.gdk.threads_init()
import rhsm
sys.path.append("/usr/share/rhsm")
# enable logging for firstboot
from subscription_manager import logutil
logutil.init_logger()
log = logging.getLogger("rhsm-app." + _... | vritant/subscription-manager | src/subscription_manager/gui/firstboot/rhsm_login.py | Python | gpl-2.0 | 19,013 | 0.001788 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2017, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCU... | ATIX-AG/ansible | lib/ansible/modules/cloud/ovirt/ovirt_vms.py | Python | gpl-3.0 | 93,016 | 0.002795 |
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2015 Dan Falck <ddfalck@gmail.com> *
# * ... | bblacey/FreeCAD-MacOS-CI | src/Mod/Path/PathScripts/PathStop.py | Python | lgpl-2.1 | 5,748 | 0.00174 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | v-iam/azure-sdk-for-python | azure-servicefabric/azure/servicefabric/models/deployed_stateful_service_replica_info.py | Python | mit | 3,502 | 0.001142 |
# -*- coding: utf-8 -*-
# ***************************************************************************
# * Copyright (c) 2014 Yorik van Havre <yorik@uncreated.net> *
# * *
# * This program is free software; you can redistribute it a... | sanguinariojoe/FreeCAD | src/Mod/Path/PathScripts/PathHop.py | Python | lgpl-2.1 | 5,422 | 0.001844 |
# Copyright (c) 2015 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 agreed to in writin... | NaohiroTamura/python-ironicclient | ironicclient/tests/functional/test_help_msg.py | Python | apache-2.0 | 2,193 | 0 |
from bitmovin.utils import Serializable
class AutoRestartConfiguration(Serializable):
def __init__(self, segments_written_timeout: float = None, bytes_written_timeout: float = None,
frames_written_timeout: float = None, hls_manifests_update_timeout: float = None,
dash_manifests_u... | bitmovin/bitmovin-python | bitmovin/resources/models/encodings/live/auto_restart_configuration.py | Python | unlicense | 785 | 0.003822 |
import numpy as np
from Other_samples.testCases import *
from Other_samples.Gradient_check.gc_utils import sigmoid, relu, dictionary_to_vector, vector_to_dictionary, \
gradients_to_vector
def forward_propagation(x, theta):
"""
Implement the linear forward propagation (compute J) presented in Figure 1 (J(... | adexin/Python-Machine-Learning-Samples | Other_samples/Gradient_check/gradient_check.py | Python | mit | 7,033 | 0.002702 |
import random, time, pygame, sys
from pygame.locals import *
FPS = 25
WINDOWWIDTH = 640
WINDOWHEIGHT = 480
BOXSIZE = 20
BOARDWIDTH = 10
BOARDHEIGHT = 20
BLANK = '.'
MOVESIDEWAYSFREQ = 0.15
MOVEDOWNFREQ = 0.1
XMARGIN = int((WINDOWWIDTH - BOARDWIDTH * BOXSIZE) / 2)
TOPMARGIN = WINDOWHEIGHT - (BOARDHEIGHT * BOXSIZE) -... | saintdragon2/python-3-lecture-2015 | civil_mid_final/알았조/tetris a.py | Python | mit | 15,222 | 0.004222 |
from django.conf.urls import url
from django.contrib.auth.decorators import permission_required
from . import views
urlpatterns = [
url (r'^file/select/$', views.FileSelect.as_view(), name='file-select'),
# raise_exception=True => 403 Forbidden instead of redirect to /admin
url (r'^page/(?P<pk>\d+)/updat... | normalnorway/normal.no | django/apps/cms/urls.py | Python | gpl-3.0 | 831 | 0.009627 |
import pytest
from click.testing import CliRunner
from parkour import cli
import md5
def file_checksums_equal(file1, file2):
with open(file1) as f:
checksum1 = md5.new(f.read()).digest()
with open(file2) as f:
checksum2 = md5.new(f.read()).digest()
return checksum1==checksum2
def test_t... | buenrostrolab/proatac | tests/test_cli.py | Python | mit | 575 | 0.015652 |
#!/usr/bin/python3
# gather.py
lookup_terms = [
{'program' :'email_outlook.py',
'known_as':['email', 'mail', 'outlook', 'messages',
'sent items', 'inbox', 'spam']
},
{'program' :'sys_PC_usage.py',
'known_as':['PC usage', 'Application logging']
},
{'program' :'sys_process_windo... | acutesoftware/rawdata | rawdata/gather.py | Python | mit | 1,024 | 0.027344 |
#!/usr/bin/env python
"""
APM automatic test suite
Andrew Tridgell, October 2011
"""
from __future__ import print_function
import atexit
import fnmatch
import glob
import optparse
import os
import shutil
import signal
import sys
import time
import traceback
import apmrover2
import arducopter
import arduplane
import ... | dgrat/ardupilot | Tools/autotest/autotest.py | Python | gpl-3.0 | 18,627 | 0.004832 |
"""
This file is part of the TheLMA (THe Laboratory Management Application) project.
See LICENSE.txt for licensing, CONTRIBUTORS.txt for contributor information.
MoleculeType entity classes.
"""
from everest.entities.base import Entity
from everest.entities.utils import slug_from_string
__docformat__ = "reStructured... | helixyte/TheLMA | thelma/entities/moleculetype.py | Python | mit | 2,617 | 0.001146 |
import os
def main():
import sys
# Separate the nose params and the pydev params.
pydev_params = []
other_test_framework_params = []
found_other_test_framework_param = None
NOSE_PARAMS = '--nose-params'
PY_TEST_PARAMS = '--py-test-params'
for arg in sys.argv[1:]:
if not found... | dannyperry571/theapprentice | script.module.pydevd/lib/runfiles.py | Python | gpl-2.0 | 11,560 | 0.004325 |
"""
Contains utilities used during testing
"""
import os
import stat
import shutil
def remove_tree(tree):
"""
reset the permission of a file and directory tree and remove it
"""
os.chmod(tree, 0o777)
shutil.rmtree(tree)
def remove_file(file_name):
"""
reset the permission of a file and ... | arecarn/dploy | tests/utils.py | Python | mit | 2,296 | 0 |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
import logging
from flexget import plugin
from flexget.event import event
log = logging.getLogger('spy_headers')
class PluginSpyHeaders(object):
"""
Logs al... | jawilson/Flexget | flexget/plugins/operate/spy_headers.py | Python | mit | 1,536 | 0.000651 |
import os
import re
import logging
from packaging.version import parse
from .scm.git import Git
from .scm.base import DEFAULT_TAG_VERSION
from .exception import VersionerError
from .version_string import make_string_pep440_compatible
SCM_TYPES = [Git]
LOG = logging.getLogger(__name__)
RELEASE_FORMAT = "{main_version}"... | toumorokoshi/vcver-python | vcver/version.py | Python | mit | 2,963 | 0.000337 |
import json
import logging
import re
from html.parser import HTMLParser
import jsonschema
from django.conf import settings
logger = logging.getLogger(__name__)
class ParserBase:
"""
Base class for all parsers.
"""
def __init__(self, name):
"""Setup the artifact to hold the extracted data.""... | edmorley/treeherder | treeherder/log_parser/parsers.py | Python | mpl-2.0 | 20,165 | 0.002628 |
# ybrowserauth installation script
#
from distutils.core import setup
setup(name='ybrowserauth',
version='1.2',
py_modules=['ybrowserauth'],
license='http://www.opensource.org/licenses/bsd-license.php',
url='http://developer.yahoo.com/auth',
description='Lets you add Yahoo! Brows... | pombreda/django-hotclub | libs/external_libs/ybrowserauth/setup.py | Python | mit | 455 | 0.004396 |
from typing import List, Tuple, Sequence
import logging
logger = logging.getLogger(__name__)
from .lock_tables import lock_tables
from .uiformatters import UIFormatter, get_uiformatters, AutonumberOverflowException
def autonumber_and_save(collection, user, obj) -> None:
uiformatters = get_uiformatters(collectio... | specify/specify7 | specifyweb/specify/autonumbering.py | Python | gpl-2.0 | 1,532 | 0.004569 |
"""
Test compiling and executing using the dmd tool.
"""
#
# __COPYRIGHT__
#
# 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... | timj/scons | test/D/HSTeoh/sconstest-singleStringCannotBeMultipleOptions_dmd.py | Python | mit | 1,396 | 0 |
# Copyright 2016 Facundo Batista, Nicolás Demarchi
#
# 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.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ... | jcabdala/fades | tests/test_file_options.py | Python | gpl-3.0 | 6,427 | 0.000778 |
import copy
import unittest
from pyrake.utils.datatypes import CaselessDict
__doctests__ = ['pyrake.utils.datatypes']
class CaselessDictTest(unittest.TestCase):
def test_init(self):
seq = {'red': 1, 'black': 3}
d = CaselessDict(seq)
self.assertEqual(d['red'], 1)
self.assertEqual(... | elkingtowa/pyrake | tests/test_utils_datatypes.py | Python | mit | 3,592 | 0.000557 |
'''
offsets = [[[originalx,originaly], [511,709],[498,707]],\
[[522,711], [508,709],[493,706]],\
[[522,714], [503,708],[488,705]]]
'''
def offsetter(length,dim,dx,dy,sx,sy,fx,fy):
x = x0 = sx
y = y0 = sy
arr = []
for i in range(dim):
... | luciencd/astrophotograpython | library/offsetter.py | Python | mit | 667 | 0.014993 |
"""Generate config flow file."""
import json
from typing import Dict
from .model import Config, Integration
BASE = """
\"\"\"Automatically generated by hassfest.
To update, run python3 -m script.hassfest
\"\"\"
# fmt: off
FLOWS = {}
""".strip()
def validate_integration(integration: Integration):
"""Validate ... | leppa/home-assistant | script/hassfest/config_flow.py | Python | apache-2.0 | 2,621 | 0.000382 |
from test_base import BaseTest, load_msg
from mock import patch
from smtplib import SMTP
from deliver.send import Sender
class SendTest(BaseTest):
def setUp(self):
super(SendTest,self).setUp()
self.sender = Sender(self.config)
@patch('smtplib.SMTP')
@patch.object(SMTP, 'sendmail')
d... | sirech/deliver | deliver/tests/test_send.py | Python | mit | 852 | 0.004695 |
import os
import logging
from django.core.management.base import BaseCommand
from django.core.mail import send_mail
from django.template.loader import get_template
from workshops.models import Badge, Person, Role
logger = logging.getLogger()
class Command(BaseCommand):
help = 'Report instructors activity.'
... | swcarpentry/amy | amy/workshops/management/commands/instructors_activity.py | Python | mit | 5,305 | 0 |
#! /usr/bin/env python
# encoding: utf-8
# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
import os
import json
import shutil
from.error import Error
class StoreLockVersionResolver(object):
def __init__(self,resolver,lock_cache,dependency):
self.resolver=resolver
self.lock_cache=lock... | looopTools/sw9-source | .waf-1.9.8-6657823688b736c1d1a4e2c4e8e198b4/waflib/extras/wurf/store_lock_version_resolver.py | Python | mit | 719 | 0.038943 |
# -*- coding: utf-8 -*-
'''
Tests for the Git state
'''
# Import python libs
from __future__ import absolute_import
import os
import shutil
import socket
import subprocess
import tempfile
# Import Salt Testing libs
from salttesting.helpers import ensure_in_syspath, skip_if_binaries_missing
ensure_in_syspath('../../')... | stephane-martin/salt-debian-packaging | salt-2016.3.2/tests/integration/states/git.py | Python | apache-2.0 | 8,866 | 0.001241 |
""" Run tests on photo models. """
| brianmay/spud | spud/tests/a_unit/photos/test_models.py | Python | gpl-3.0 | 35 | 0 |
import soco
from collections import namedtuple
SonosTrack = namedtuple('SonosTrack', [
'title', 'artist', 'album', 'album_art_uri', 'position',
'playlist_position', 'duration', 'uri', 'resources', 'album_art',
'metadata'
])
SonosTrack.__new__.__defaults__ = (None,) * len(SonosTrack._fields)
class Track(S... | andpe/minos | minos/sonos/__init__.py | Python | bsd-3-clause | 3,903 | 0.003587 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from github3.models import GitHubCore
from github3.repos import Repository
class CodeSearchResult(GitHubCore):
def __init__(self, data, session=None):
super(CodeSearchResult, self).__init__(data, session)
self._api = data.get('url')
... | liresearchgroup/submtr | submtr/lib/github3/search/code.py | Python | mit | 1,087 | 0 |
#
# This file is part of Dragonfly.
# (c) Copyright 2007, 2008 by Christo Butcher
# Licensed under the LGPL.
#
# Dragonfly 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 L... | Versatilus/dragonfly | dragonfly/test/test_log.py | Python | lgpl-3.0 | 4,558 | 0.000658 |
# encoding: utf-8
"""
Core trade api for simulated and live trading.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from .trade_api import TradeApi
__all__ = ['TradeApi']
| mumuwoyou/vnpy-master | vnpy/trader/gateway/tkproGateway/TradeApi/__init__.py | Python | mit | 279 | 0 |
# -*- coding: utf-8 -*-
"""
flask.cli
~~~~~~~~~
A simple command line application to run flask apps.
:copyright: (c) 2015 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import os
import sys
from threading import Lock, Thread
from functools import update_wrapper
import click
... | adrianmoisey/cptdevops | flask/cli.py | Python | bsd-3-clause | 18,141 | 0.00022 |
"""Utils for time travel testings."""
def _t(rel=0.0):
"""Return an absolute time from the relative time given.
The minimal allowed time in windows is 86400 seconds, for some reason. In
stead of doing the arithmetic in the tests themselves, this function should
be used.
The value `86400` is expo... | snudler6/time-travel | src/tests/utils.py | Python | mit | 492 | 0 |
#!/usr/bin/python
import argparse
from vmipl_communication.network_connection import NetworkConnection
def main():
parser = setup_options_parser()
# parse given arguments
args = parser.parse_args()
validate_input(parser, args)
port = args.port
script_content = args.vmipl_script.read()
args.vmipl_script.clos... | FlorianWestphal/VMI-PL | front_end/client.py | Python | mit | 2,163 | 0.039297 |
import unittest
from hamlpy.parser.core import (
ParseException,
Stream,
peek_indentation,
read_line,
read_number,
read_quoted_string,
read_symbol,
read_whitespace,
read_word,
)
from hamlpy.parser.utils import html_escape
class ParserTest(unittest.TestCase):
def test_read_whit... | nyaruka/django-hamlpy | hamlpy/test/test_parser.py | Python | mit | 4,020 | 0.004764 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'P3Talk.sub_community'
db.alter_column(u'p3_p3talk', 's... | leriomaggio/pycon_site | p3/migrations/0004_auto__chg_field_p3talk_sub_community.py | Python | bsd-2-clause | 21,667 | 0.008123 |
from itertools import repeat
from xmodule.course_module import CourseDescriptor
from .exceptions import (ItemNotFoundError, NoPathToItem)
from . import Location
def path_to_location(modulestore, course_id, location):
'''
Try to find a course_id/chapter/section[/position] path to location in
modulestore.... | abhinavp13/IITBX-edx-platform-dev | common/lib/xmodule/xmodule/modulestore/search.py | Python | agpl-3.0 | 4,563 | 0.001096 |
from __future__ import absolute_import, print_function, division
from netlib.http import decoded
from .connections import ClientConnection, ServerConnection
from .flow import Flow, Error
from .http import (
HTTPFlow, HTTPRequest, HTTPResponse, Headers,
make_error_response, make_connect_request, make_con... | x2Ident/x2Ident_test | mitmproxy/mitmproxy/models/__init__.py | Python | gpl-3.0 | 753 | 0.001328 |
# Copyright 2015 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... | ecliu110/SpotifyApp | welcome.py | Python | apache-2.0 | 8,683 | 0.004607 |
from gps import *
import time
import threading
import math
class GpsController(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
self.gpsd = gps(mode=WATCH_ENABLE) #starting the stream of info
self.running = False
def run(self):
self.running = True
... | linusluotsinen/RPiAntiTheft | util/gps_handler/gps_controller.py | Python | mit | 1,812 | 0.007174 |
# Copyright 2014 ARM Limited
#
# Licensed under the Apache License, Version 2.0
# See LICENSE file for details.
# standard library modules, , ,
import logging
import os
import threading
from collections import OrderedDict
# fsutils, , misc filesystem utils, internal
import fsutils
# Ordered JSON, , read & write json,... | BlackstoneEngineering/yotta | yotta/lib/settings.py | Python | apache-2.0 | 5,218 | 0.003066 |
# coding=utf-8
import logging
import rarfile
import os
from subliminal.exceptions import ConfigurationError
from subliminal.providers.legendastv import LegendasTVSubtitle as _LegendasTVSubtitle, \
LegendasTVProvider as _LegendasTVProvider, Episode, Movie, guess_matches, guessit, sanitize, region, type_map, \
r... | dantebarba/docker-media-server | plex/Sub-Zero.bundle/Contents/Libraries/Shared/subliminal_patch/providers/legendastv.py | Python | gpl-3.0 | 10,819 | 0.003697 |
#
# Copyright 2016 Red Hat, 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 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in th... | oVirt/vdsm | lib/vdsm/storage/volumemetadata.py | Python | gpl-2.0 | 11,350 | 0 |
# This function runs a .bat file that job handles multiple GridLAB-D files
import subprocess
#C:\Projects\GridLAB-D_Builds\trunk\test\input\batch test\13_node_fault2.glm
def create_batch_file(glm_folder,batch_name):
batch_file = open('{:s}'.format(batch_name),'w')
batch_file.write('gridlabd.exe -T 0 --job\n')
#batc... | NREL/glmgen | glmgen/run_gridlabd_batch_file.py | Python | gpl-2.0 | 850 | 0.04 |
# -*- coding: utf-8 -*-
# #START_LICENSE###########################################################
#
#
# This file is part of the Environment for Tree Exploration program
# (ETE). http://ete.cgenomics.org
#
# ETE is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public ... | csc8630Spring2014/Clusterizer | ete2/treeview/_open_newick.py | Python | mit | 2,493 | 0.006418 |
# coding: utf-8
"""
DocuSign REST API
The DocuSign REST API provides you with a powerful, convenient, and simple Web services API for interacting with DocuSign. # noqa: E501
OpenAPI spec version: v2.1
Contact: devcenter@docusign.com
Generated by: https://github.com/swagger-api/swagger-codegen.gi... | docusign/docusign-python-client | docusign_esign/models/document_html_collapsible_display_settings.py | Python | mit | 11,943 | 0.000084 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
import json
import os
from libmozdata import utils as lmdutils
from auto_nag import utils
class Cache(object):
d... | mozilla/relman-auto-nag | auto_nag/cache.py | Python | bsd-3-clause | 1,902 | 0.000526 |
"""
Provides functionality for mailboxes.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/mailbox/
"""
import asyncio
import logging
from contextlib import suppress
from datetime import timedelta
import async_timeout
from aiohttp import web
from aioht... | MungoRae/home-assistant | homeassistant/components/mailbox/__init__.py | Python | apache-2.0 | 7,809 | 0 |
#!/usr/bin/env python
'''Batch several changes to Pocket'''
__author__ = 'Felipe Borges'
import sys
sys.path.append("..")
import getopt
import pocket
USAGE = '''Usage: batch_actions [options] array_of_actions
This script adds an Item to Pocket.
Options:
-h --help: print this help
--consumer_key : th... | felipecorrea/python-pocket | examples/batch_actions.py | Python | apache-2.0 | 1,253 | 0.03352 |
import binascii
import socket
import struct
import sys
def ten_digit_to_comma_format(badge):
"""Returns the comma-format RFID number (without the comma) from the
10-digit RFID number.
Explanation:
*On an EM4100/4001 spec RFID card, there will generally be two sets of
numbers like this: 0015362878... | pawl/Chinese-RFID-Access-Control-Library | rfid.py | Python | mit | 9,417 | 0.000212 |
"""
rohmu - google cloud object store interface
Copyright (c) 2016 Ohmu Ltd
See LICENSE for details
"""
# pylint: disable=import-error, no-name-in-module
# NOTE: this import is not needed per-se, but it's imported here first to point the
# user to the most important possible missing dependency
import googleapiclient ... | saaros/pghoard | pghoard/rohmu/object_storage/google.py | Python | apache-2.0 | 11,184 | 0.002414 |
import os
config = {
# mozconfig file to use, it depends on branch and platform names
"platform": "macosx64",
"update_platform": "Darwin_x86_64-gcc3",
"mozconfig": "%(branch)s/browser/config/mozconfigs/macosx-universal/l10n-mozconfig",
"bootstrap_env": {
"SHELL": '/bin/bash',
"MOZ_O... | armenzg/build-mozharness | configs/single_locale/macosx64.py | Python | mpl-2.0 | 2,942 | 0.00136 |
#!/usr/bin/env python
'''
Lucas-Kanade tracker
====================
Lucas-Kanade sparse optical flow demo. Uses goodFeaturesToTrack
for track initialization and back-tracking for match verification
between frames.
Usage
-----
lk_track.py [<video_source>]
Keys
----
ESC - exit
'''
# Python 2/3 compatibility
from __... | lkumar93/Deep_Learning_Crazyflie | src/deep_learning_crazyflie/src/lk_track.py | Python | mit | 5,660 | 0.030035 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
#-------------------------------------------------------------------------------
"""pyzombie HTTP RESTful handler test cases."""
__author__ = ('Lance Finn Helsten',)
__version__ = '1.0.1'
__copyright__ = """Copyright 2009 Lance Finn Helsten (helsten@acm.org)"""
__license__ ... | lanhel/pyzombie | test/pyzombie/handlers/HandlerInstanceStdoutTestCase.py | Python | apache-2.0 | 2,987 | 0.005022 |
# coding: utf-8
from sqlalchemy.testing import eq_, assert_raises
from sqlalchemy import *
from sqlalchemy import sql, exc, schema
from sqlalchemy.util import u
from sqlalchemy import util
from sqlalchemy.dialects.mysql import base as mysql
from sqlalchemy.testing import fixtures, AssertsCompiledSQL, AssertsExecutionR... | Abi1ity/uniclust2.0 | SQLAlchemy-0.9.9/test/dialect/mysql/test_types.py | Python | bsd-3-clause | 32,246 | 0.004626 |
#Kunal Gautam
#Codewars : @Kunalpod
#Problem name: Dubstep
#Problem level: 6 kyu
def song_decoder(song):
return " ".join(" ".join(song.split('WUB')).split())
| Kunalpod/codewars | dubstep.py | Python | mit | 163 | 0.02454 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Prueba',
fields=[
('id', models.AutoField(verbo... | HenryGBC/landing_company | landing/migrations/0001_initial.py | Python | mit | 556 | 0.001799 |
import wpilib
from wpilib.command.commandgroup import CommandGroup
class Autonomous(CommandGroup):
def __init__(self, drive, grabber_lift):
super().__init__()
self.drive = drive
self.grabber_lift = grabber_lift
self.addSequential(ClawGrab(grabber_lift))
self.ad... | frc2423/2015 | recycle_rush/commands/autonomous.py | Python | gpl-2.0 | 485 | 0.010309 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.