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 2018 DeepMind Technologies Limited. 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 ... | deepmind/acme | acme/datasets/tfds.py | Python | apache-2.0 | 7,201 |
# -*- coding: utf-8 -*-
#
# Picard, the next-generation MusicBrainz tagger
#
# Copyright (C) 2004 Robert Kaye
# Copyright (C) 2006-2009, 2011-2013, 2017 Lukáš Lalinský
# Copyright (C) 2007-2011, 2015, 2018-2020 Philipp Wolfer
# Copyright (C) 2008 Gary van der Merwe
# Copyright (C) 2008-2009 Nikolai Prokoschenko
# Copyr... | Sophist-UK/Sophist_picard | picard/file.py | Python | gpl-2.0 | 33,726 |
'''
Modulo Movimiento Nanometros
@author: P1R0
import ObjSerial, sys;
ObjSer = ObjSerial.ObjSerial(0,9600)
ObjSer.cts = True
ObjSer.dtr = True
ObjSer.bytesize = 8
'''
SxN = 59.71 #Constante de Calibracion del Motor
#Funcion para inicializar Monocromador
def init(ObjSer,A):
ObjSer.flushOutput()
ObjSe... | P1R/freeMonoCrom | MM.py | Python | gpl-2.0 | 5,424 |
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redi... | cherrishes/weilai | xingxing/protobuf/python/lib/Python3.4/google/protobuf/text_encoding.py | Python | apache-2.0 | 4,685 |
"""SCons.Tool.sgicc
Tool-specific initialization for MIPSPro cc on SGI.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 The SCons Foundation
#... | makinacorpus/mapnik2 | scons/scons-local-1.2.0/SCons/Tool/sgicc.py | Python | lgpl-2.1 | 1,749 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (C) 2015-2016 Simone Donadello
#
# 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) an... | simondona/exp-control-bec-tn | gui/constants.py | Python | gpl-3.0 | 835 |
"""The Netio switch component."""
from collections import namedtuple
from datetime import timedelta
import logging
from pynetio import Netio
import voluptuous as vol
from homeassistant import util
from homeassistant.components.http import HomeAssistantView
from homeassistant.components.switch import PLATFORM_SCHEMA, ... | nkgilley/home-assistant | homeassistant/components/netio/switch.py | Python | apache-2.0 | 5,406 |
"""
Django Generic Settings
"""
from GenSettingDict import GenSettingDict
DEFAULTSETTINGS = GenSettingDict()
__title__ = 'Django Generic Settings'
__version__ = '0.2.0'
__author__ = 'Paul Gueltekin'
__license__ = 'LGPL 2'
__copyright__ = 'Copyright 2015 Paul Gueltekin'
# Version synonym
VERSION = __version__
# Hea... | paulgueltekin/django-gen-settings | django_gen_settings/__init__.py | Python | lgpl-3.0 | 486 |
#!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2017
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as publis... | rogerscristo/BotFWD | env/lib/python3.6/site-packages/pytests/test_labeledprice.py | Python | mit | 1,631 |
#!/usr/bin/env python
# Taken and modified from:
# http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/
import atexit
import os
import signal
import sys
import time
if (hasattr(os, "devnull")):
DEVNULL = os.devnull
else:
DEVNULL = "/dev/null"
class Daemon(object):
"""
A gene... | Nvizible/shotgunEvents | src/daemonizer.py | Python | mit | 5,101 |
"""Implementation of scheduler reports API.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import fnmatch
import logging
import time
import kazoo.exceptions
from treadmill import context
from treadmill import e... | Morgan-Stanley/treadmill | lib/python/treadmill/api/scheduler.py | Python | apache-2.0 | 3,769 |
"""
Union-Find:
1. Given a set of numbers, Do Random Joins as tuples or sets;
2. Given a set of Unions, Find Connections;
Quick Weighted Union:
- Array arr contains all numbers as indexes, the size of arr is noted;
- Sub Module Get_Root finds the root of the current key. if cur_key root is not set to this root, sets i... | codecakes/algorithms | algorithms/week1/union_find.py | Python | mit | 6,494 |
from __future__ import absolute_import
import logging
from opentracing.ext import tags
from tornado.stack_context import wrap as keep_stack_context
from opentracing_instrumentation import utils
from ..request_context import get_current_span, span_in_stack_context
from ._patcher import Patcher
try:
from boto3.re... | uber-common/opentracing-python-instrumentation | opentracing_instrumentation/client_hooks/boto3.py | Python | mit | 5,428 |
import scipy.io
from sklearn import svm
from sklearn import cross_validation
from sklearn.metrics import accuracy_score
from skfeature.function.sparse_learning_based import RFS
from skfeature.utility.sparse_learning import construct_label_matrix, feature_ranking
def main():
# load data
mat = scipy.io.loadmat(... | jundongl/scikit-feast | skfeature/example/test_RFS.py | Python | gpl-2.0 | 1,688 |
#
# Copyright 2001 - 2006 Ludek Smid [http://www.ospace.net/]
#
# This file is part of IGE - Outer Space.
#
# IGE - Outer Space 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 Lice... | OuterDeepSpace/OuterDeepSpace | libs/server/ige/ospace/IUniverse.py | Python | gpl-2.0 | 20,112 |
#!/usr/bin/env python
################################################################################
##
## substructure_generate_fulltable.py
## Author: Satoshi Takahama (satoshi.takahama@epfl.ch)
## Nov. 2014
##
## -----------------------------------------------------------------------------
##
## This file is part... | stakahama/aprl-ssp | substructure_adjacent_atoms.py | Python | gpl-3.0 | 3,237 |
#!/usr/bin/env python
import os
import subprocess
from staticbuilder import StaticBuilder
def test():
"""
Test harness for static builder.
Checks SB both as imported object and command line utility.
Test paths must be set up correctly:
(TODO: create setup function to automate d... | coding4kicks/staticbuilder | test/staticbuilder_test.py | Python | mit | 11,842 |
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import abc
import six
# SPEC: Any plotting lib must implement these functions
@six.add_metaclass(abc.ABCMeta)
class PlottingBase():
#__metaclass__ = abc.ABCMeta
####################################... | zutshi/S3CAMR | src/plot/plotting_abstract.py | Python | bsd-2-clause | 1,336 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from rest_framework import serializers
from maintenance.models import RecreateSlave
from api.maintenance_base import MaintennanceBaseApi
class RecreateSlaveSerializer(serializers.ModelSerializer):
class Meta:
model = Recreate... | globocom/database-as-a-service | dbaas/api/recreate_slave.py | Python | bsd-3-clause | 770 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-10-10 09:25
import django.contrib.postgres.fields
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('stein', '0027_auto_20171010_1049'),
]
operations = [
migrations.CreateModel(... | GeoMatDigital/django-geomat | geomat/stein/migrations/0028_glossaryentry.py | Python | bsd-3-clause | 1,003 |
import os
import subprocess
import tempfile
from conans.util.env_reader import get_env
from conans.util.files import load, mkdir, rmdir, save
from conans.util.log import logger
from conans.util.sha import sha256
CONAN_LINK = ".conan_link"
CONAN_REAL_PATH = "real_path.txt"
def conan_expand_user(path):
""" wrappe... | memsharded/conan | conans/util/windows.py | Python | mit | 4,269 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
import unittest
test_ignore = ["Leave Block List"]
class TestDepartment(unittest.TestCase):
def test_remove_department_data(self):
... | Zlash65/erpnext | erpnext/hr/doctype/department/test_department.py | Python | gpl-3.0 | 801 |
class Solution(object):
def maxProfit(self, prices):
"""
:type prices: List[int]
:rtype: int
"""
lowestPrice = 1000000
maxProfit = 0
for p in prices:
if p < lowestPrice:
lowestPrice = p
maxProfit = p - lowestPrice if p-l... | scream7/leetcode | algorithms/python/121.py | Python | apache-2.0 | 383 |
"""
Toggles for courseware in-course experience.
"""
from edx_toggles.toggles import LegacyWaffleFlagNamespace, SettingToggle
from opaque_keys.edx.keys import CourseKey
from openedx.core.djangoapps.waffle_utils import CourseWaffleFlag
# Namespace for courseware waffle flags.
WAFFLE_FLAG_NAMESPACE = LegacyWaffleFlagN... | edx/edx-platform | lms/djangoapps/courseware/toggles.py | Python | agpl-3.0 | 10,426 |
"""Apache Configuration based off of Augeas Configurator."""
# pylint: disable=too-many-lines
import itertools
import logging
import os
import re
import shutil
import socket
import subprocess
import zope.interface
from acme import challenges
from letsencrypt import achallenges
from letsencrypt import errors
from let... | jmhodges/letsencrypt | letsencrypt-apache/letsencrypt_apache/configurator.py | Python | apache-2.0 | 46,264 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
StatisticsByCategories.py
---------------------
Date : September 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
*************... | fritsvanveen/QGIS | python/plugins/processing/algs/qgis/StatisticsByCategories.py | Python | gpl-2.0 | 4,207 |
# -*- coding: utf-8 -*-
import numbers
import numpy as np
from ..constants import BOLTZMANN_IN_MEV_K
from ..energy import Energy
class Analysis(object):
r"""Class containing methods for the Data class
Attributes
----------
detailed_balance_factor
Methods
-------
integrate
position
... | neutronpy/neutronpy | neutronpy/data/analysis.py | Python | mit | 8,726 |
import unittest
from slack_sdk.http_retry.builtin_async_handlers import AsyncRateLimitErrorRetryHandler
from slack_sdk.scim.v1.async_client import AsyncSCIMClient
from tests.helpers import async_test
from tests.slack_sdk.scim.mock_web_api_server import (
setup_mock_web_api_server,
cleanup_mock_web_api_server,
... | slackapi/python-slackclient | tests/slack_sdk_async/scim/test_async_client_http_retry.py | Python | mit | 1,508 |
import sys
from subprocess import check_output
def get_changed_files(sha='HEAD~1'):
return check_output(['git', 'diff', '--name-only', 'HEAD', sha]).splitlines()
def get_changed_mxds(sha='HEAD~1'):
return [f for (f) in get_changed_files(sha) if str(f).lower().endswith('mxd')]
| gisinc/slap | slap/git.py | Python | mit | 289 |
#!/usr/bin/python
from __future__ import absolute_import, division, print_function
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.urls import fetch_url
from ansible.module_utils._text import to_native
from inspect import cleandoc
import tempfile
import os
import shutil
BUFSIZE = 6553... | clustervision/trinityX | site/library/trix_repos.py | Python | gpl-2.0 | 8,238 |
# encoding: 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):
# Adding model 'Rating'
db.create_table('project_rating', (
('id', self.gf('django.db.models.f... | openplans/streetscore | street_score/project/migrations/0001_initial.py | Python | mit | 3,124 |
import threading
from contextlib import contextmanager
import os
from os.path import dirname, abspath, join as pjoin
import shutil
from subprocess import check_call, check_output, STDOUT
import sys
from tempfile import mkdtemp
from . import compat
__all__ = [
'BackendUnavailable',
'BackendInvalid',
'HookM... | foobarbazblarg/stayclean | stayclean-2020-december/venv/lib/python3.8/site-packages/pip/_vendor/pep517/wrappers.py | Python | mit | 11,290 |
import openpnm as op
class CubicDualTest:
def setup_class(self):
pass
def teardown_class(self):
pass
def test_generation_3D(self):
net = op.network.CubicDual(shape=[5, 5, 5], label_1='primary',
label_2='secondary')
assert net.Np == 285
... | TomTranter/OpenPNM | tests/unit/network/CubicDualTest.py | Python | mit | 3,436 |
"""
正規表現のサンプルです。
絶対最大量指定子 (possessive quantifier) について
(絶対最大量指定子は、強欲な量指定子ともいう)
REFERENCES:: http://bit.ly/2NW2TAq
http://bit.ly/2NXU6Ow
http://bit.ly/2NXUcFS
http://bit.ly/2NZDm9v
http://bit.ly/2NXxyNQ
"""
import re
import regex
from trypython.common.commoncls imp... | devlights/try-python | trypython/stdlib/re_/re05.py | Python | mit | 2,745 |
#!/usr/bin/python2.4
# vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab
#
# $Id$
#
# Copyright (C) 1999-2006 Keith Dart <keith@kdart.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software... | xiangke/pycopia | net/pycopia/ping.py | Python | lgpl-2.1 | 5,969 |
# Copyright 2016 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... | cg31/tensorflow | tensorflow/contrib/learn/python/learn/utils/export_test.py | Python | apache-2.0 | 5,206 |
#!/usr/bin/env python
# Copyright 2002 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required... | jeremydw/google-apputils-python | tests/datelib_unittest.py | Python | apache-2.0 | 8,310 |
# coding: utf-8
from quokka.core.app import QuokkaModule
from .views import CommentView
module = QuokkaModule("comments", __name__, template_folder="templates")
module.add_url_rule('/comment/<path:path>/',
view_func=CommentView.as_view('comment'))
| maurobaraldi/quokka | quokka/modules/comments/__init__.py | Python | mit | 270 |
from django.conf.urls import patterns, include, url
from django.conf.urls.static import static
from django.conf import settings
import django.views
from OMRS import views
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'openMRScap.views.home', name='h... | omiltoro/softbrew | openMRScap/urls.py | Python | apache-2.0 | 1,624 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# All Rights Reserved.
#
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use t... | windskyer/k_cinder | paxes_cinder/volume/manager.py | Python | apache-2.0 | 73,959 |
# encoding: utf-8
#
#
# 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/.
#
# Author: Kyle Lahnakoski (kyle@lahnakoski.com)
#
from __future__ import division
from __future_... | maggienj/ActiveData | tests/test_jx/test_edge_time.py | Python | mpl-2.0 | 4,700 |
#!/usr/bin/env python3
#-------------------------------------------------------------------
# tarfile.py
#-------------------------------------------------------------------
# Copyright (C) 2002 Lars Gustaebel <lars@gustaebel.de>
# All rights reserved.
#
# Permission is hereby granted, free of charge, to any pers... | wdv4758h/ZipPy | lib-python/3/tarfile.py | Python | bsd-3-clause | 92,256 |
import contextlib
import gzip
import hashlib
import io
import mmap
from builtins import (
map as imap,
)
def gzip_compress(data, compresslevel=6):
compressed = io.BytesIO()
with gzip.GzipFile(fileobj=compressed,
mode="wb",
compresslevel=compresslevel) as comp... | nanshe-org/nanshe_workflow | nanshe_workflow/util.py | Python | apache-2.0 | 733 |
###############################################################################
# #
# 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 ... | dparks1134/UniteM | unitem/common.py | Python | gpl-3.0 | 6,131 |
"""Tests for the Nest integration API glue library.
There are two interesting cases to exercise that have different strategies
for token refresh and for testing:
- API based requests, tested using aioclient_mock
- Pub/sub subcriber initialization, intercepted with patch()
The tests below exercise both cases during in... | rohitranjan1991/home-assistant | tests/components/nest/test_api.py | Python | mit | 5,461 |
# 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... | openstack/keystone | keystone/common/sql/migrations/versions/yoga/contract/e25ffa003242_initial.py | Python | apache-2.0 | 835 |
#########################################################################
#
# Copyright (C) 2012 OpenPlans
#
# 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
#... | AnnalisaS/migration_geonode | geonode/search/search.py | Python | gpl-3.0 | 12,257 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1)
#
# (1) Kamaelia Contributors are listed in the AUTHORS file and at
# http://www.kamaelia.org/AUTHORS - please extend this file,
# not this notice.
#
# Licensed under the Apache License... | sparkslabs/kamaelia_ | Sketches/MH/pymedia/Audio/Input.py | Python | apache-2.0 | 1,047 |
#!/usr/bin/env python
#
# Copyright 2013 Hannes Juutilainen
#
# 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 applicabl... | autopkg/hjuutilainen-recipes | AlfredApp/AlfredURLProvider.py | Python | mit | 4,480 |
# -*- coding: utf-8 -*-
# © 2016 Ainara Galdona - AvanzOSC
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from . import test_stock_valuation_extension
| esthermm/odoo-addons | stock_valuation_extension/tests/__init__.py | Python | agpl-3.0 | 171 |
#!/usr/bin/env python
'''
This module contais some common routines used by other samples.
'''
import numpy as np
import cv2
import os
from contextlib import contextmanager
import itertools as it
image_extensions = ['.bmp', '.jpg', '.jpeg', '.png', '.tif', '.tiff', '.pbm', '.pgm', '.ppm']
class Bunch(object):
de... | dbadb/2016-Stronghold | src/org/usfirst/frc/team4915/stronghold/vision/jetson/imgExplore2/common.py | Python | mit | 6,318 |
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import annotations
import dataclasses
import importlib.resources
import itertools
import json
import logging
import os
from collections import defaultdict
from dataclasses... | pantsbuild/pants | src/python/pants/jvm/resolve/coursier_fetch.py | Python | apache-2.0 | 30,567 |
#
# CORE
# Copyright (c)2012 the Boeing Company.
# See the LICENSE file included in this distribution.
#
# authors: Jeff Ahrenholz <jeffrey.m.ahrenholz@boeing.com>
#
#
# Copyright (c) 2014 Benocs GmbH
#
# author: Robert Wuttke <robert@benocs.com>
#
# See the LICENSE file included in this distribution.
#
'''
conf.py: c... | Benocs/core | src/daemon/core/conf.py | Python | bsd-3-clause | 14,235 |
import workflow
"""
PublishPerfectArticle workflow
"""
class workflow_PublishPerfectArticle(workflow.workflow):
def __init__(self, settings, logger, conn=None, token=None, decision=None,
maximum_page_size=100):
workflow.workflow.__init__(self, settings, logger, conn, token, decision, max... | jhroot/elife-bot | workflow/workflow_PublishPerfectArticle.py | Python | mit | 5,903 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Models that have physical origins.
"""
import warnings
import numpy as np
from .core import Fittable1DModel
from .parameters import Parameter, InputParameterError
from astropy import constants as const
from astropy import units as u
from astropy.uti... | stargaser/astropy | astropy/modeling/physical_models.py | Python | bsd-3-clause | 9,673 |
# Copyright (c) 2015 EMC Corporation.
# 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... | JioCloud/cinder | cinder/volume/drivers/emc/emc_vmax_fc.py | Python | apache-2.0 | 13,846 |
#-*- coding:utf-8 -*-
import httplib2
import urllib
import json
import traceback
import bs4
from bs4 import BeautifulSoup
from bussiness import *
from orm import *
mainpage_url = 'http://news.yahoo.com/us/most-popular/'
comment_base_url = 'http://news.yahoo.com/_xhr/contentcomments/get_all/?'
reply_base_url = 'http://... | shibei00/yahoo_news_crawler | crawler.py | Python | gpl-3.0 | 7,619 |
from .integrator_template import IntegratorTemplate
from .. import backend as D
__all__ = [
'ExplicitRungeKuttaIntegrator',
'ExplicitSymplecticIntegrator'
]
class ExplicitRungeKuttaIntegrator(IntegratorTemplate):
"""
A base class for all explicit Runge-Kutta methods with a lower triangular Butcher Tab... | Microno95/DESolver | desolver/integrators/integrator_types.py | Python | mit | 8,340 |
import operator
import numpy as np
import pytest
from pandas.compat.numpy import _np_version_under1p20
import pandas as pd
import pandas._testing as tm
from pandas.core import ops
from pandas.core.arrays.sparse import SparseArray, SparseDtype
@pytest.fixture(params=["integer", "block"])
def kind(request):
"""k... | jreback/pandas | pandas/tests/arrays/sparse/test_arithmetics.py | Python | bsd-3-clause | 20,217 |
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# ------------------------------------------------------... | crossroadchurch/paul | openlp/core/ui/generaltab.py | Python | gpl-2.0 | 20,811 |
from LOTlib import break_ctrlc
from LOTlib.Inference.Samplers.MetropolisHastings import MHSampler
from LOTlib.Examples.RationalRules.Model.Grammar import grammar
from LOTlib.Examples.RationalRules.Model.Data import data
from LOTlib.Miscellaneous import q
from Hypothesis import *
def run():
"""A version that cares... | ebigelow/LOTlib | LOTlib/Examples/RationalRules/MemoryDecay/Run.py | Python | gpl-3.0 | 1,652 |
#encoding=utf-8
from app.proto.common.data_parse import hex_to_dec, dec_to_hex
from app.proto.common.hachi.core import XBee
from app.proto.frames.RFIDFrames import rfid_frame
class RFIDController:
def __init__(self, escaped=True):
# self.xbee = XBee()
pass
def parse_pkgs(self, byte... | kooksee/TIOT | test/project/src/app/proto/controller/RFIDController.py | Python | gpl-2.0 | 4,692 |
#!/usr/bin/env python
import logging
from pdb import set_trace
import requests
import simplejson
from time import time
import os
import facebook
# MY_API_URL
# MY_SITE_MSG
# MY_GROUP_NAME
# POST_TO_ID = None
def run():
data = get_from_cal_json()
msg = create_msg(data)
post(msg)
def get_from_cal_json... | OpenACalendar/OpenACalendar-Tools-Social | example-facebook-post-weekly/facebook-post-weekly.py | Python | bsd-3-clause | 2,695 |
from ..generic import ToStrMixin, file_get_content
from itertools import ifilter, izip
from functools import wraps
import collections
import os
import os.path
def reverse_enumerate(lst):
return izip(xrange(len(lst)-1, -1, -1), reversed(lst))
def filter_predicate(file_name, file_path):
full_file = os.path.join... | bacher09/gentoo-packages | gpackages/libs/package_info/generic_metadata/license_text.py | Python | gpl-2.0 | 5,138 |
from xml.dom import minidom
from .oauth import BaseOAuth2
class NaverOAuth2(BaseOAuth2):
"""Naver OAuth authentication backend"""
name = 'naver'
AUTHORIZATION_URL = 'https://nid.naver.com/oauth2.0/authorize'
ACCESS_TOKEN_URL = 'https://nid.naver.com/oauth2.0/token'
ACCESS_TOKEN_METHOD = 'POST'
... | IKholopov/HackUPC2017 | hackupc/env/lib/python3.5/site-packages/social_core/backends/naver.py | Python | apache-2.0 | 2,000 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
PyCOMPSs Testbench
========================
"""
# Imports
from pycompss.api.task import task
from pycompss.api.mpi import mpi
from pycompss.api.constraint import constraint
from pycompss.api.api import compss_wait_on
from pycompss.api.parameter import *
@constraint(com... | mF2C/COMPSs | tests/sources/python/9_python_mpi_collection/src/python_mpi_collection.py | Python | apache-2.0 | 2,343 |
# Copyright 2015 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 by... | NetApp/manila | manila_tempest_tests/tests/api/admin/test_share_manage.py | Python | apache-2.0 | 9,833 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
import json
import random
import math
import time
from Library import toolClass
class ChaseLetv :
def __init__ (self) :
self.videoLink = ''
self.fileUrlPrefix = 'http://api.letv.com/mms/out/video/playJson?platid=1&splatid=104&tss=no&domain=www.letv.com'... | EvilCult/Video-Downloader | Module/letvClass.py | Python | gpl-2.0 | 2,698 |
# Copyright (c) 2014-2016, NVIDIA CORPORATION. All rights reserved.
from __future__ import absolute_import
import os
import tempfile
# Find the best implementation available
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
import mock
from nose.tools import assert_raises... | gheinrich/DIGITS-GAN | digits/utils/test_image.py | Python | bsd-3-clause | 6,578 |
# Copyright 2010 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... | openstack/glance_store | glance_store/_drivers/s3.py | Python | apache-2.0 | 36,786 |
#!/usr/bin/env python
"""
@package mi.dataset.parser.test.test_adcpt_acfgm
@fid marine-integrations/mi/dataset/parser/test/test_adcpt_acfgm.py
@author Ronald Ronquillo
@brief Test code for a Adcpt_Acfgm_Dcl data parser
"""
from nose.plugins.attrib import attr
import os
from mi.core.log import get_logger
from mi.data... | janeen666/mi-instrument | mi/dataset/parser/test/test_adcpt_acfgm_dcl_pd8.py | Python | bsd-2-clause | 7,347 |
#!/usr/bin/env python
import sys
sys.path.append('..')
sys.path.append('.')
from jumper.blueprints.backends.modules.ctypes.ffi_ctypes import FFICTypes
t = FFICTypes()
t.example_world()
| tristanfisher/ffi4wd | tests/test_ctypes.py | Python | agpl-3.0 | 188 |
# -*- coding: utf-8 -*-
# Copyright (c), 2011, the txievery authors. See the LICENSE file for details.
"""
Paypal Express Checkout support.
"""
| lvh/txievery | txievery/expresscheckout/__init__.py | Python | isc | 144 |
# -*- coding: utf-8 -*-
# Akvo Reporting is covered by the GNU Affero General Public License.
# See more details in the license.txt file located at the root folder of the Akvo RSR module.
# For additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >.
from django.contrib.auth import ... | akvo/akvo-rsr | akvo/rsr/tests/models/test_partner_site.py | Python | agpl-3.0 | 5,096 |
#!/usr/bin/env python
import sys
import csv
import os
import decimal
os.environ['DJANGO_SETTINGS_MODULE'] = 'pombola.settings'
sys.path.append('../../../')
sys.path.append('../../')
from django.utils.text import slugify
from pombola.core.models import Place
from pombola.place_data.models import Entry
place_kind_sl... | hzj123/56th | pombola/place_data/bin/import_place_data.py | Python | agpl-3.0 | 3,048 |
#! /usr/bin/env python
# -*- coding: UTF-8 -*- #
from table import ParquetTable
__all__ = ['ParquetPool']
class BasePool(dict):
def __setitem__(self, key, item):
self.validate(item)
super(BasePool, self).__setitem__(key, item)
def validate(self, tem):
raise NotImplementedError()
c... | globocom/MicroDrill | microdrill/pool.py | Python | apache-2.0 | 474 |
############################################################################
# #
# 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 ... | digidotcom/transport_examples | enable_drm/enable_drm.py | Python | mpl-2.0 | 9,155 |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""
Computation of parcellations using a hierarchical approach.
Author: Bertrand Thirion, 2008
"""
from __future__ import print_function, absolute_import
from warnings import warn
import numpy as np
from... | alexis-roche/nipy | nipy/labs/spatial_models/hierarchical_parcellation.py | Python | bsd-3-clause | 16,558 |
# -*- test-case-name: buildbot_UnrealEngine.test.test_Build -*-
from ..UnrealCommand import BaseUnrealCommand
from buildbot import config
from twisted.internet import defer
class Build(BaseUnrealCommand):
"""Runs the UnrealBuildTool (UBT)"""
name = "UEBuild"
supported_build_types = ["Build", "Rebuild"... | pampersrocker/buildbot-UnrealEngine | buildbot_UnrealEngine/BuildTool/Build.py | Python | mit | 3,514 |
"""This module contains all necessary views to power up shopping list web application"""
import time
import main
from flask import flash, redirect, render_template, request, session, url_for
from flask.views import View
from .db.shopping_list.shopping import ShoppingList
from .forms import (CreateShoppingItemForm, Cr... | gr1d99/shopping-list | shopping_app/views.py | Python | mit | 12,925 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import
"""Endpoints for the photo albums."""
from flask import Blueprint, g, request, redirect, url_for, flash
import rophako.model.user as User
import rophako.model.photo as Photo
from rophako.utils import (template, pretty_time, render_markd... | kirsle/rophako | rophako/modules/photo/__init__.py | Python | gpl-2.0 | 11,484 |
from flask import Flask
from flask.ext.bootstrap import Bootstrap
from flask.ext.mail import Mail
from flask.ext.moment import Moment
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.login import LoginManager
from flask.ext.pagedown import PageDown
from config import config
bootstrap = Bootstrap()
mail = Mai... | fakdora/flaksy-upto-login | app/__init__.py | Python | mit | 1,012 |
import Image, ImageFilter, ImageChops, ImageStat
import time
def estimate(file, s=5):
"""Estimates the amount of focus of an image file.
Returns a real number: lower values indicate better focus.
"""
im = Image.open(file).convert("L")
w,h = im.size
box = (w/2 - 50, h/2 - 50, w/2 + 50, h/2 + 50)... | cgart/photobooth | piggyphoto/focus.py | Python | mit | 584 |
import argparse
import os.path
import read
import analyze
import numpy as np
if __name__ == '__main__':
argparser = argparse.ArgumentParser()
argparser.add_argument("state", help="2-letter code for the US state, or 'US' for all states")
argparser.add_argument("--online", dest='online', const=True, default=... | OneStone2/mcmc_growth | update.py | Python | mit | 1,008 |
#!/usr/bin/env python
# Copyright 2016 Stanford University
#
# 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 applicabl... | chuckatkins/legion | language/travis.py | Python | apache-2.0 | 1,989 |
from django.conf.urls import url
from apps.followers.api.followers import AddFollowerView, RemoveFollowerView, ProfileView, \
FollowedByListView, FollowingListView
urlpatterns = \
[
url(r'^profile/(?P<pk>[0-9]+)/$', ProfileView.as_view(), name="profile"),
url(r'^follow/(?P<follower_id>[0-9]+)/... | kamilgregorczyk/instalike | apps/followers/urls/followers.py | Python | mit | 698 |
# -*- coding: utf-8 -*-
#
# doto documentation build configuration file, created by
# sphinx-quickstart on Sat Jan 11 16:24:07 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All ... | waytai/doto | doc/conf.py | Python | mit | 8,681 |
# encoding: utf-8
import ckan.model as model
import ckan.lib.create_test_data as ctd
CreateTestData = ctd.CreateTestData
class FollowerClassesTests(object):
@classmethod
def teardown_class(cls):
model.repo.rebuild_db()
def test_get(self):
following = self.FOLLOWER_CLASS.get(self.followe... | NicoVarg99/daf-recipes | ckan/ckan/ckan/ckan/tests/legacy/models/test_follower.py | Python | gpl-3.0 | 4,502 |
# Search for lines that have an at sign between characters
# The characters must be a letter or number
import re
hand = open('mbox-short.txt')
for line in hand:
line = line.rstrip()
x = re.findall('[a-zA-Z0-9]\S+@\S+[a-zA-Z]', line)
if len(x) > 0 :
print(x)
| mkhuthir/learnPython | Book_pythonlearn_com/18_regex/re07.py | Python | mit | 279 |
from learn_theano.utils.s3_download import S3
import subprocess
import os
import glob
def get_nottingham_midi_folder():
s3 = S3()
resulting_folder = os.path.join(s3.cache_folder(), "Nottingham")
if os.path.isdir(resulting_folder):
return resulting_folder
print("Unzipping Nottingham midi datas... | consciousnesss/learn_theano | learn_theano/utils/midi_nottingham_dataset.py | Python | apache-2.0 | 814 |
import contextlib
import sys
from django.db import models, connection
from django.utils import formats
class GoProjectReview(models.Model):
#
email = models.CharField(max_length = 200)
text = models.TextField()
date = models.DateTimeField()
notes = models.TextField()
resolve... | fridex/gofed-web | goview/models.py | Python | gpl-2.0 | 3,482 |
# Copyright 2021 IBM Corp. All Rights Reserved.
# (C) Copyright 2021 Inova Development 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
#... | pywbem/pywbemtools | tests/unit/pywbemcli/testmock/wbemserver_mock_class.py | Python | apache-2.0 | 27,276 |
#!/usr/bin/env python
"""
@package mi.dataset.parser
@file marine-integrations/mi/dataset/parser/phsen_abcdef_dclpy
@author Nick Almonte
@brief Parser for the phsen_abcdef_dcl dataset driver
Release notes:
initial release
"""
import re
from mi.core.log import get_logger
from mi.core.common import BaseEnum
from mi.c... | janeen666/mi-instrument | mi/dataset/parser/phsen_abcdef_dcl.py | Python | bsd-2-clause | 31,949 |
import math
"""
Project Euler - Problem 9
"""
def triplet_product(triplet):
for x in range(1, 300):
temp = []
temp.append(x * triplet[0])
temp.append(x * triplet[1])
temp.append(x * triplet[2])
if sum(temp) == 1000:
return temp[0] * temp[1] * temp[2]
print triplet_product(... | kkorekk/ProjectEuler | Problem_9/pythagorean_triplet.py | Python | mit | 469 |
import os, socket, sys, threading, time, pdb
from collections import OrderedDict as OD
from queue import Queue
from .server import proxy
class SocketIO:
def __init__(self, ip_addr, port, fname, fsz=0, send=True):
#self.DEV_TX_PORT = 8888
#self.DEV_RX_PORT = 8889
self.fsz = fsz
self... | ivanovev/start | util/socketio.py | Python | gpl-3.0 | 4,348 |
import numpy as np
from rampwf.score_types.soft_accuracy import SoftAccuracy
score_matrix_1 = np.array([
[1, 0, 0],
[0, 1, 0],
[0, 0, 1],
])
score_matrix_2 = np.array([
[1, 0.5, 0],
[0.3, 1, 0.3],
[0, 0.5, 1],
])
y_true_proba_1 = np.array([1, 0, 0])
y_true_proba_2 = np.array([0, 1, 0])
y_tr... | paris-saclay-cds/ramp-workflow | rampwf/score_types/tests/test_soft_accuracy.py | Python | bsd-3-clause | 3,379 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'MainWindow.ui'
#
# Created by: PyQt5 UI code generator 5.6
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWind... | laserkelvin/FTSpecViewer | python/qtmain.py | Python | gpl-3.0 | 38,680 |
import os
from urllib import parse as urlparse
def fix_catalog_url(url):
"""
Replace .html with .xml extension
"""
from os.path import splitext, join
u = urlparse.urlsplit(url)
name, ext = splitext(u.path)
if ext == ".html":
u = urlparse.urlsplit(url.replace(".html", ".xml"))
... | bird-house/threddsclient | threddsclient/utils.py | Python | apache-2.0 | 1,127 |
'''
Defines the preferences dialog.
@author: Eitan Isaacson
@organization: Mozilla Foundation
@copyright: Copyright (c) 2006, 2007 Mozilla Foundation
@license: BSD
All rights reserved. This program and the accompanying materials are made
available under the terms of the BSD which accompanies this distribution, and
... | javihernandez/accerciser-mirror | src/lib/accerciser/prefs_dialog.py | Python | bsd-3-clause | 6,660 |
# Copyright (c) 2015 Jose David Fernandez Rodriguez
#
# This file is distributed under the terms of the
# GNU Affero General Public License, version 3
# as published by the Free Software Foundation.
#
# This file is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied ... | jdfr/pyslic3r | pyclipper/all.py | Python | agpl-3.0 | 698 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.