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 |
|---|---|---|---|---|---|
from __future__ import absolute_import, unicode_literals
from . import abase
class Source(abase.CreatableResource, abase.ListableResource, abase.UpdatableResource):
RESOURCE = "source"
RESOURCE_PATH = "sources"
| reincubate/ricloud | ricloud/resources/sources.py | Python | lgpl-3.0 | 222 |
def fill_config_dict_with_defaults(config_dict: dict, defaults_dict: dict) -> dict:
"""
>>> fill_config_dict_with_defaults({a:2}, {b:3})
"""
## Substitute in default values from config_dict where missing from defaults_dict
## Works at multiple levels
default_keys = list(defaults_dict.keys())
... | robcarver17/pysystemtrade | sysdata/config/fill_config_dict_with_defaults.py | Python | gpl-3.0 | 979 |
"""distutils.command.clean
Implements the Distutils 'clean' command."""
# contributed by Bastian Kleineidam <calvin@cs.uni-sb.de>, added 2000-03-18
# This module should be kept compatible with Python 2.1.
__revision__ = "$Id: clean.py 38532 2005-03-03 08:12:27Z loewis $"
import os
from distutils.core import Comman... | zephyrplugins/zephyr | zephyr.plugin.jython/jython2.5.2rc3/Lib/distutils/command/clean.py | Python | epl-1.0 | 2,918 |
from setuptools import setup, find_packages
from captcha import pillow_required, get_version as get_captcha_version
install_requires = [
'setuptools',
'six >=1.2.0',
'Django >= 1.4'
]
if pillow_required():
install_requires.append('Pillow >=2.2.2')
setup(
name='django-simple-captcha',
version=... | 171767313/django-simple-captcha | setup.py | Python | mit | 1,219 |
"""
Test for tooltree
"""
from AnyQt.QtWidgets import QAction
from AnyQt.QtGui import QStandardItemModel, QStandardItem
from AnyQt.QtCore import Qt
from ..tooltree import ToolTree, FlattenedTreeItemModel
from ...registry.qt import QtWidgetRegistry
from ...registry.tests import small_testing_registry
from ..test imp... | ales-erjavec/orange-canvas | orangecanvas/gui/tests/test_tooltree.py | Python | gpl-3.0 | 2,600 |
from Screens.Screen import Screen
from Components.ConfigList import ConfigListScreen
from Components.Sources.StaticText import StaticText
from Components.config import config, ConfigSubsection, ConfigBoolean, getConfigListEntry, ConfigSelection, ConfigYesNo, ConfigIP
from Components.Network import iNetwork
from Compone... | Open-Plus/opgui | lib/python/Screens/InstallWizard.py | Python | gpl-2.0 | 5,747 |
# -*- coding: utf-8 -*-
##############################################################################
# 2011 E2OpenPlugins #
# #
# This file is open source software; you can redistribute... | MOA-2011/enigma2-plugin-extensions-openwebif | .pc/openwebif.patch/plugin/controllers/ajax.py | Python | gpl-2.0 | 6,808 |
#!/usr/bin/env python
"""bless_client
A sample client to invoke the BLESS Host SSH Cert Lambda function and save the signed SSH Certificate.
Usage:
bless_client_host.py region lambda_function_name hostnames <id_rsa.pub to sign> <output id_rsa-cert.pub>
region: AWS region where your lambda is deployed.
lam... | ikben/bless | bless_client/bless_client_host.py | Python | apache-2.0 | 2,653 |
# coding: utf-8
from __future__ import absolute_import
from datetime import date, datetime # noqa: F401
from typing import List, Dict # noqa: F401
from nwrsc.api.models.base_model_ import Model
from nwrsc.api.models.champ_entry_events import ChampEntryEvents # noqa: F401,E501
from nwrsc.api import util
class Ch... | drytoastman/scorekeeperbackend | web/nwrsc/api/models/champ_entry.py | Python | gpl-3.0 | 8,639 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""Utility routines for workflow graphs
"""
from future import standard_library
standard_library.install_aliases()
from builtins import map
from builtins impo... | dgellis90/nipype | nipype/pipeline/engine/utils.py | Python | bsd-3-clause | 50,966 |
import os
import urllib
from google.appengine.ext import ndb
from webapp2_extras import sessions
from webapp2_extras import auth
from google.appengine.api import users
import webapp2
import jinja2
TEMPLATE_DIR = os.path.join(os.path.dirname(__file__), 'views')
jinja_environment = \
jinja2.Environment(autoescape... | PhilMProctor/Challange-The-Parents | main.py | Python | mit | 2,477 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
from __future__ import print_function
from ..cnf import CNF, disj
from ..cmdline import register_cnf_transformation_subcommand,BipartiteGraphHelper
from ..transformations import register_cnf_transformation
from itertools import combinations,product,permutations
from cnf... | marcvinyals/cnfgen | cnfformula/transformations/substitutions.py | Python | gpl-3.0 | 21,050 |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from pants_test.pant... | pgroudas/pants | contrib/scrooge/tests/python/pants_test/contrib/scrooge/tasks/test_thrift_linter_integration.py | Python | apache-2.0 | 4,069 |
#!/usr/bin/env python
# Copyright 2014-2018 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/fci/fci_slow.py | Python | apache-2.0 | 9,063 |
#
# Copyright 2013 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | rh-s/heat | heat/tests/test_auth_password.py | Python | apache-2.0 | 6,286 |
import unittest
import ctypes
class TestBranch(unittest.TestCase):
def setUpClass(cls):
cls.obj = ctypes.CDLL("obj/fringe_13.o")
def test_object(self):
self.assertIsNotNone(self.obj)
| jwg4/fringe_search | tests/test_fringe.py | Python | mit | 225 |
python2.py | DinoV/PTVS | Python/Tests/TestData/MultiPaste/python2.py | Python | apache-2.0 | 10 |
try:
import ubinascii as binascii
except ImportError:
import binascii
try:
binascii.crc32
except AttributeError:
print("SKIP")
import sys
sys.exit()
print(hex(binascii.crc32(b'The quick brown fox jumps over the lazy dog')))
print(hex(binascii.crc32(b'\x00' * 32)))
print(hex(binascii.crc32(b'\xf... | mhoffma/micropython | tests/extmod/ubinascii_crc32.py | Python | mit | 698 |
from __future__ import unicode_literals
from django.db import models
from django.shortcuts import get_object_or_404
from django.test import TestCase
from rest_framework import generics, renderers, serializers, status
from rest_framework.test import APIRequestFactory
from rest_framework.tests.models import BasicModel, C... | justinpotts/mozillians | vendor-local/lib/python/rest_framework/tests/test_generics.py | Python | bsd-3-clause | 22,347 |
# --------------------------------------------------------------------------------------------
# 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/redis/_client_factory.py | Python | mit | 1,339 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-02-28 05:34
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('pootle_store', '0039_set_suggestion_tmp_state'),
]
operations = [
migrations.Remove... | claudep/pootle | pootle/apps/pootle_store/migrations/0040_remove_suggestion_state.py | Python | gpl-3.0 | 407 |
from flask.ext.restful import Resource, abort, fields, marshal_with, reqparse
from ..models import HealthCalories
from ..models import db
# Documentation for this endpoint: http://docs.apithyself.apiary.io
resource_fields = {
'date': fields.String,
'calories': fields.Integer
}
class Calories(Resource):
... | thinkingserious/apithyself | app/api_1_0/endpoints/calories.py | Python | mit | 1,811 |
"""
The dao for pymatgen.
"""
print(
"""
The 道 of Pymatgen
1. Great code enables great materials science.
2. Comprehensive tests ensure robustness.
3. Clear documentation leads to more usage.
4. More usage improves code quality (and increases citations).
5. Even complex scientific ideas can be broken down in... | vorwerkc/pymatgen | pymatgen/dao.py | Python | mit | 715 |
#
# Copyright (C) 2016-2017 University of Oxford
#
# This file is part of msprime.
#
# msprime 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 v... | jeromekelleher/msprime | msprime/provenance.py | Python | gpl-3.0 | 8,947 |
"""Script to download or update SIMBAD-related databases"""
__author__ = "Felix Simkovic & Adam Simpkin"
__date__ = "17 May 2017"
__version__ = "1.0"
import argparse
import collections
import datetime
import glob
import json
import numpy as np
import pandas as pd
import morda
import os
import shutil
import ssl
import... | rigdenlab/SIMBAD | simbad/command_line/simbad_database.py | Python | bsd-3-clause | 33,539 |
# This file is part of Trackma.
#
# 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... | molkoback/trackma | trackma/lib/libvndb.py | Python | gpl-3.0 | 13,309 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Onset detection
===============
.. autosummary::
:toctree: generated/
onset_detect
onset_backtrack
onset_strength
onset_strength_multi
"""
import numpy as np
import scipy
from ._cache import cache
from . import core
from . import util
from .util.e... | librosa/librosa | librosa/onset.py | Python | isc | 19,666 |
class Solution(object):
def missingNumber(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
result = len(nums)
i = 0
for num in nums:
result ^= num
result ^= i
i += 1
return result
test = Solution()
print(test.... | rx2130/Leetcode | python/268 Missing Number.py | Python | apache-2.0 | 343 |
# coding=utf-8
from django.db import models
from django.utils.translation import ugettext_lazy as _
from positions.fields import PositionField
from .utils import slugify
class SlugNameMixin(object):
def get_slug_name(self):
return slugify(self.name or 'xxx')
class BaseModel(models.Model):
id = m... | BlackWizard/django-misc-base | misc_base/models.py | Python | bsd-2-clause | 2,618 |
import sys
import time
import subprocess
import threading
import config
import gameengine
import playerstate as PlayerState
import json
from options import parseOptions
import importlib
import io
class Unbuffered:
''' Unbuffered output wrapper '''
def __init__(self, stream):
self.stream = stream
de... | amatveyakin/underworld | underworld.py | Python | gpl-2.0 | 10,186 |
import json
import os
from flask import (
Blueprint,
abort,
current_app,
flash,
redirect,
render_template,
url_for,
)
from flask_login import current_user, login_required
from librectf.decorators import block_before_competition, team_required, no_cache
from librectf.forms.chals import Prob... | EasyCTF/OpenCTF | server-old/librectf/views/chals.py | Python | mit | 5,923 |
#!/usr/bin/python
import bluetooth
print("performing inquiry...")
nearby_devices = bluetooth.discover_devices(lookup_names = True)
print("found %d devices" % len(nearby_devices))
for addr, name in nearby_devices:
print(" %s - %s" % (addr, name))
| fabienroyer/Bluetooth | inquiry.py | Python | lgpl-3.0 | 255 |
"""
This module implements modified nodal analysis (MNA).
Copyright 2014--2022 Michael Hayes, UCECE
"""
from __future__ import division
from .assumptions import Assumptions
from .vector import Vector
from .matrix import Matrix, matrix_inverse
from .sym import symsimplify
from .expr import ExprDict, expr
from .voltage... | mph-/lcapy | lcapy/mna.py | Python | lgpl-2.1 | 10,744 |
#!/usr/bin/python
# Copyright (c) <year> Intel 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 ... | VictorRodriguez/autofdo_tutorial | tools/gcov_generator.py | Python | apache-2.0 | 6,065 |
from __future__ import print_function
import numpy as np
import cntk
def LoadData(fn,is_training):
n=".\\Data\\"+fn
datainp=cntk.io.StreamDef("features",45)
dataout=cntk.io.StreamDef("labels",3)
dataall=cntk.io.StreamDefs(features=datainp,labels=dataout)
st=cntk.io.CTFDeserializer(n,dataall)
mb... | RandomKori/Forex | ForexNN2/ForexNN2/ForexNN2.py | Python | gpl-3.0 | 2,803 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: Eduard Trott
# @Date: 2015-09-10 13:10:29
# @Email: etrott@redhat.com
# @Last modified by: etrott
# @Last Modified time: 2015-09-10 14:40:21
from __future__ import unicode_literals
def test_global_import():
from clicktrack import piwik
def test_get_... | maybelinot/clicktrack | tests/test_piwik.py | Python | gpl-3.0 | 1,893 |
from i3pystatus import IntervalModule
from json import loads
from dateutil.parser import parse
from dateutil.relativedelta import relativedelta
from datetime import datetime, timezone
import subprocess
class Timewarrior(IntervalModule):
"""
Show current Timewarrior tracking
Requires `json` `dateutil`
... | yang-ling/i3pystatus | i3pystatus/timewarrior.py | Python | mit | 2,480 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes
from webnotes import msgprint, _
from webnotes.utils import load_json, cstr, flt, now_datetime, cint
from webnotes.model.doc import addchild
from con... | Yellowen/Owrang | utilities/transaction_base.py | Python | agpl-3.0 | 17,824 |
from tornado.web import RequestHandler
_pages = {}
def add_page(page):
_pages[page.page_id] = page
class LspHandler(RequestHandler):
def get(self, page_id):
try:
page = _pages[page_id]
self.set_header("Content-Type", "{}; charset=UTF-8".format(page.content_type))
... | genzgd/lampost_lib | lampost/server/pages.py | Python | mit | 713 |
from typing import overload
class A:
@overload
def foo(self, value: None) -> None:
pass
@overload
def foo(self, value: int) -> str:
pass
@overload
def foo(self, value: str) -> str:
pass
def foo(self, value):
return None
A().foo(None)
A().foo(5)
A().foo(... | paplorinc/intellij-community | python/testData/inspections/PyTypeCheckerInspection/OverloadsAndImplementationInClass.py | Python | apache-2.0 | 418 |
# AsteriskLint -- an Asterisk PBX config syntax checker
# Copyright (C) 2015-2016 Walter Doekes, OSSO B.V.
#
# 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
... | ossobv/asterisklint | asterisklint/func/vall/func_odbc.py | Python | gpl-3.0 | 991 |
import glob
from os.path import join
import numpy as n
import astropy.io.fits as fits
import lib_functions_1pt as lib
import os
import sys
# data modules
import glob
import sys
import astropy.io.fits as fits
import os
from os.path import join
import cPickle
# numerical modules
import numpy as n
from scipy.interpolate... | JohanComparat/nbody-npt-functions | bin/bin_onePT/extra/mvir-2-plotCovariance.py | Python | cc0-1.0 | 37,139 |
import numpy as np
def data_concat(result_a):
return np.concatenate(result_a, axis=0)
def data_mean(result_a):
return np.mean(result_a)
def data_identity(result_a):
return result_a
def data_stack(result_a):
return np.stack(result_a)
def data_single(result_a):
return result_a[0]
def data_... | haihabi/simpy | simpy/core/result/base_function.py | Python | mit | 391 |
import new
import traceback
import __builtin__
import sys
class PrintHook(object):
def __init__(self):
sys.stdout.flush()
sys.stderr.flush()
sys.stdout = self
sys.stderr = self
def write(self,t):
self.text = t
sys.stdout = sys.__stdout__
sys.stderr = sys.__stderr__
def getText(self):
return self.tex... | zedoul/shellpy | shell.py | Python | mit | 844 |
# -*- coding: utf-8 -*-
import re
import xml.etree.ElementTree as etree
from module.plugins.internal.Hoster import Hoster
# Based on zdfm by Roland Beermann (http://github.com/enkore/zdfm/)
class ZDF(Hoster):
__name__ = "ZDF Mediathek"
__type__ = "hoster"
__version__ = "0.84"
__status__ = "te... | fayf/pyload | module/plugins/hoster/ZDF.py | Python | gpl-3.0 | 1,707 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "syncsub.settings.dev")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| inorichi/syncsub | manage.py | Python | mpl-2.0 | 254 |
# This file is part of Checkbox.
#
# Copyright 2012 Canonical Ltd.
# Written by:
# Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
#
# Checkbox 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 versio... | zyga/debian.plainbox | plainbox/impl/test_job.py | Python | gpl-3.0 | 17,182 |
#!/usr/bin/python
#
# Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
#
import json
import copy
from netaddr import IPNetwork
from pprint import pformat
from vnc_api.vnc_api import *
from vnc_admin_api import VncApiAdmin
def get_ip(ip_w_pfx):
return str(IPNetwork(ip_w_pfx).ip)
# end get_ip
clas... | nischalsheth/contrail-controller | src/config/utils/provision_bgp.py | Python | apache-2.0 | 7,230 |
from scrapy.log import INFO
from ..common_spider import CommonSpider
class Spider2(CommonSpider):
name = 'spider2'
# must add "kwargs", otherwise can't run in scrapyd
def __init__(self, settings, **kwargs):
super(Spider2, self).__init__(settings, **kwargs)
self._title_path = settings.get... | lnxpgn/scrapy_multiple_spiders | tutorial/tutorial/spiders/spider2.py | Python | mit | 621 |
# TODO.TXT-CLI-python test script
# Copyright (C) 2011-2012 Sigmavirus24, Jeff Stein
#
# 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... | MinchinWeb/wm_todo | tests/test_depri.py | Python | gpl-3.0 | 1,416 |
#!/usr/bin/env python
# -*- coding: iso-8859-15 -*-
"""---------------------------------------------------------------------
Pinguino Boards List
author: Regis Blanchot
contact: rblanchot@gmail.com
first release: 2011-10-23
last release: 2014-09-05
This library is free software; you can re... | PinguinoIDE/pinguino-multilanguage | files/pinguino_api/boards.py | Python | gpl-2.0 | 10,070 |
from flask import Blueprint, render_template
# 這裡設定的 template_folder 為 template 搜尋目錄, 表示位於 user/g1/templates 目錄中
# 但是若 wcmw14/templates 目錄中有相同名稱的 template file, 則優先取外部的檔案
# 這樣的設計希望可以在統整各藍圖時, 可以隨時根據需要改寫 template 配置
b40123235_1 = Blueprint('b40123235_1', __name__, url_prefix='/b40123235_1', template_folder='templates')
... | 2015fallhw/cdw11 | users/b/g2/bg2_40123235_cdw14.py | Python | agpl-3.0 | 7,282 |
from __future__ import unicode_literals
from io import BytesIO
from django.test import TestCase
from mock import patch
from dbbackup.db.mysql import MysqlDumpConnector
@patch('dbbackup.db.mysql.MysqlDumpConnector.run_command',
return_value=(BytesIO(b'foo'), BytesIO()))
class MysqlDumpConnectorTest(TestCase)... | django-dbbackup/django-dbbackup | dbbackup/tests/test_connectors/test_mysql.py | Python | bsd-3-clause | 5,797 |
# Copyright 2016 Capital One Services, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | siddartha1992/cloud-custodian | c7n/resources/elasticache.py | Python | apache-2.0 | 21,910 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2011, 2012 Pablo Barenbaum <foones@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 Free Software Foundation, either version 3 of the License, or
# (at your option) a... | gobstones/PyGobstones-Lang | pygobstoneslang/lang/gbs_lint.py | Python | gpl-3.0 | 40,480 |
# -*- coding: utf-8 -*-
#
# Gramps documentation build configuration file, created by
# sphinx-quickstart on Sat Dec 1 14:38:29 2012.
#
# 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 ... | pmghalvorsen/gramps_branch | data/man/pt_BR/conf.py | Python | gpl-2.0 | 7,714 |
class Song(object):
def __init__(self, lyrics):
self.lyrics = lyrics
def sing_me_a_song(self):
for line in self.lyrics:
print line
happy_bday = Song(["Happy birthday to you",
"I don't want to get sued",
"So I'll stop right here"])
bulls_on_pa... | mshcruz/LearnPythonTheHardWay | ex40.py | Python | gpl-2.0 | 484 |
import math
import sys
# class Button(QToolButton):
# def __init__(self, text, parent=None):
# super(Button, self).__init__(parent)
# self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred)
# self.setText(text)
# def sizeHint(self):
# size = super(Button, self).sizeHi... | gregrtw/PythonProjects | Numbers/Calculator.py | Python | gpl-2.0 | 1,235 |
from django.conf.urls import patterns, include, url
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
url(r'^$', 'brbappl.views.index', name='index'),
url(r'^done$', 'brbappl.views.done', name='done'),
url(r... | thijsdezoete/BrBaFinals | poolgame/poolgame/urls.py | Python | gpl-2.0 | 816 |
# 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 field 'News.slug'
db.add_column('news', 'slug', self.gf('django.db.models.fields.SlugField')(max_length=25... | pyropeter/archweb | news/migrations/0004_auto__add_field_news_slug.py | Python | gpl-2.0 | 4,549 |
#!/usr/bin/env python
# Copyright (C) 2013 Statoil ASA, Norway.
#
# The file 'test_rft_cell.py' is part of ERT - Ensemble based Reservoir Tool.
#
# ERT 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... | iLoop2/ResInsight | ThirdParty/Ert/devel/python/test/ert_tests/ecl/test_legacy_ecl.py | Python | gpl-3.0 | 3,352 |
# -*- coding: utf-8 -*-
"""
Created on Nov 30, 2015
@author: jakob
"""
from django.dispatch.dispatcher import receiver
from cms.models.titlemodels import Title
from cms.signals import post_publish, post_unpublish
from .signals import add_to_index, remove_from_index
@receiver(post_publish, dispatch_uid='publish_cms_... | aldryn/aldryn-search | aldryn_search/receivers.py | Python | bsd-3-clause | 797 |
import setuptools
# /!\ update before a release
MoSQITo_VERSION = "0.3.7"
# MoSQITo description
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
python_requires = ">= 3.5"
# MoSQITo dependencies
with open("requirements.txt", "r") as file:
requirements = file.readlines()
... | Eomys/MoSQITo | setup.py | Python | apache-2.0 | 1,722 |
import os
import rospy, rospkg
import sys
import math
import yaml
from itertools import izip_longest
from operator import add, sub
from qt_gui.plugin import Plugin
from python_qt_binding import loadUi
from python_qt_binding.QtWidgets import QWidget
from PyQt5 import QtGui, QtWidgets, QtCore
from rqt_plot.rosplot impo... | Georacer/last_letter | rqt_dashboard/src/rqt_dashboard/dashboard.py | Python | gpl-3.0 | 16,075 |
# Problem: Climbing Stairs
# Difficulty: Easy
# Category: Array/DP
# Leetcode 70: https://leetcode.com/problems/climbing-stairs/description/
# Description:
"""
You are climbing a stair case. It takes n steps to reach to the top.
Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the... | rush2catch/algorithms-leetcode | Dynamic Programming/leet_070_ClimbingStairs.py | Python | mit | 643 |
import re
import numpy as np
import scipy.sparse as sp
from scipy import linalg
from sklearn.decomposition import NMF, non_negative_factorization
from sklearn.decomposition import _nmf as nmf # For testing internals
from scipy.sparse import csc_matrix
import pytest
from sklearn.utils._testing import assert_array_e... | kevin-intel/scikit-learn | sklearn/decomposition/tests/test_nmf.py | Python | bsd-3-clause | 23,822 |
__author__ = 'dsheoran'
"""
A setuptools based setup module.
See:
https://packaging.python.org/en/latest/distributing.html
https://github.com/pypa/sampleproject
Deepak Sheoran: Customized for the need of this project
"""
from os import path
from setuptools import find_packages, setup
here = path.abspath(path.dirnam... | sheoran/drsync | setup.py | Python | mit | 1,246 |
import sys
import os
sys.path.insert(0, os.path.abspath('..'))
from octopy import octopy
| mbad0la/octoAPy | tests/test.py | Python | mit | 91 |
# -*- coding: utf-8 -*-
# Resource object code
#
# Created: Sat May 11 12:28:54 2013
# by: The Resource Compiler for PyQt (Qt v4.8.4)
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore
qt_resource_data = b"\
\x00\x00\x04\x58\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\... | haskelladdict/sconcho | sconcho/gui/icons_rc.py | Python | gpl-3.0 | 575,342 |
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import python_2_unicode_compatible
from django.contrib.auth.models import User
from authors.models import Author
@python_2_unicode_compatible
class CdCategory(models.Model):
name = models.CharField(_(... | nwaxiomatic/django-wpadmin | test_project/apps/cds/models.py | Python | mit | 1,088 |
# imageGaussianSmooth copyright (c) 2003 by Charl P. Botha cpbotha@ieee.org
# $Id$
# performs image smoothing by convolving with a Gaussian
import gen_utils
from module_base import ModuleBase
from module_mixins import IntrospectModuleMixin
import module_utils
import vtk
class imageGaussianSmooth(IntrospectModuleMixin... | nagyistoce/devide | modules/filters/imageGaussianSmooth.py | Python | bsd-3-clause | 4,371 |
from PyQt4 import QtGui, QtCore, QtSvg
from PyQt4.QtCore import QMimeData
from PyQt4.QtGui import QGraphicsScene, QGraphicsView, QWidget, QApplication
from Orange.data.io import FileFormat
class ImgFormat(FileFormat):
@staticmethod
def _get_buffer(size, filename):
raise NotImplementedError
@stat... | qPCR4vir/orange3 | Orange/widgets/io.py | Python | bsd-2-clause | 4,645 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# ... | Havate/havate-openstack | proto-build/gui/horizon/Horizon_GUI/horizon/base.py | Python | apache-2.0 | 29,556 |
UPDATE_INTERVAL = 3600
TWITTER_CONSUMER_KEY = 'IJNfPGXqcC2Kb47BQ5XxQLzLL'
TWITTER_CONSUMER_SECRET = 'gFmynTCzHS2tFX6xGGVC2LwxVjfv9p5iUxzrzcCPhNdgoDG6E2'
TWITTER_ACCESS_TOKEN = '751748957227724802-UzGC1cPjjywAHoGxuYLkvc9ECkts41O'
TWITTER_ACCESS_TOKEN_SECRET = 'vcNqRXHLUSSmDWc5YiLFiH1d37mhiypQxmF7ramRn4Vif'
| arunkreddy/hackrnews | config.py | Python | mit | 307 |
from __future__ import (absolute_import, division,
print_function, unicode_literals)
import os
import numpy as np
import scipy.linalg
if os.environ.get("USE_FAST_FAKELU", "0") == "1":
print("Using C++ extension for FakeLU")
from fakelu import fast_FakeLU as FakeLU
else:
from fakelu... | chemreac/block_diag_ilu | python_prototype/tests/test_fakelu.py | Python | bsd-2-clause | 8,673 |
# -*- coding: utf-8 -*-
"""
flypy calling convention.
"""
from __future__ import print_function, division, absolute_import
import ctypes
from pykit.ir import Op, Const, FuncArg, Function
def is_flypy_cc(op):
return isinstance(op, (Function, FuncArg, Op))
# TODO: Move byref and stack_allocate here from runtime/... | flypy/flypy | flypy/compiler/callingconv.py | Python | bsd-2-clause | 335 |
# GemRB - Infinity Engine Emulator
# Copyright (C) 2014 The GemRB Project
#
# 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 versi... | gemrb/gemrb | gemrb/GUIScripts/iwd2/Spells.py | Python | gpl-2.0 | 2,996 |
import unittest
from lc204_count_primes import Solution
class TestCountPrimes(unittest.TestCase):
def setUp(self):
self.soln = Solution()
self.test_primes = [
(0, 0),
(1, 0),
(2, 0),
(3, 1),
(4, 2),
(5, 2),
(6, 3),
(7, 3),
(8... | totoro72/pt1 | lc/tests/test_lc204_count_primes.py | Python | mit | 1,015 |
from __future__ import print_function, division, absolute_import
from contextlib import contextmanager
from tornado import gen
from toolz import keymap, valmap, merge
import uuid
import uuid
from dask.base import tokenize
from tornado import gen
from .client import Client, Future, pack_data, unpack_remotedata
from .... | amosonn/distributed | distributed/worker_client.py | Python | bsd-3-clause | 6,278 |
# -*- coding: utf-8 -*-
from tensor_analysis.arraypy import Arraypy, TensorArray, list2arraypy, \
list2tensor, matrix2arraypy, matrix2tensor
from tensor_analysis.tensor_methods import symmetric, asymmetric
from sympy import Symbol, symbols
arr = list2arraypy(list(range(9)), (3, 3))
# 0 1 2
# 3 4 5
# 6 7 8
def t... | AunShiLord/Tensor-analysis | tensor_analysis/tests/test_tensor_methods.py | Python | mit | 1,704 |
#!/usr/bin/env python
# File created on 21 Feb 2010
from __future__ import division
__author__ = "Greg Caporaso"
__copyright__ = "Copyright 2011, The QIIME Project"
__credits__ = ["Greg Caporaso", "Jose Antonio Navas Molina"]
__license__ = "GPL"
__version__ = "1.9.1-dev"
__maintainer__ = "Greg Caporaso"
__email__ = "g... | josenavas/qiime | tests/test_transform_coordinate_matrices.py | Python | gpl-2.0 | 14,669 |
from behave import given, when, then
from genosdb.models import User
from genosdb.exceptions import UserNotFound
# 'mongodb://localhost:27017/')
@given('a valid user with values {username}, {password}, {email}, {first_name}, {last_name}')
def step_impl(context, username, password, email, first_name, last_name):
... | jonrf93/genos | dbservices/tests/functional_tests/steps/user_service_steps.py | Python | mit | 1,685 |
"""
Support for Unifi WAP controllers.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/device_tracker.unifi/
"""
import logging
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
import homeassistant.loader as loader
from homea... | alexmogavero/home-assistant | homeassistant/components/device_tracker/unifi.py | Python | apache-2.0 | 3,400 |
#encoding=utf-8
# ---------------------------------------------------------Libraries--------------------------------------------------------
# Standard Libraries
# Third-party Libraries
# User Define Modules
# --------------------------------------------------------Global Strings------------------------------------... | dengliangshi/pynnlms | nnlm/word.py | Python | mit | 947 |
import logging
import subprocess
import threading
from kalliope.core.NeuronModule import NeuronModule, MissingParameterException
logging.basicConfig()
logger = logging.getLogger("kalliope")
class AsyncSearch(threading.Thread):
"""
Class used to run an asynchrone Shell command
.. notes:: Impossible to ge... | mrdev023/KALLIOPE_FRENCH_PERSONALISATION | resources/neurons/search/search.py | Python | gpl-3.0 | 2,548 |
from sklearn.cross_validation import LeaveOneOut
import numpy as np
from seizures.evaluation.performance_measures import auc
from seizures.helper.data_structures import stack_matrices, stack_vectors
class XValidation():
"""
Class to provide basic cross-validation for a generic supervised prediction
metho... | vincentadam87/gatsby-hackathon-seizure | code/python/seizures/evaluation/XValidation.py | Python | bsd-2-clause | 4,659 |
# copyright 2011,2013 Michael Telahun Makonnen <mmakonnen@gmail.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "HR Contract Reference",
"version": "14.0.1.0.0",
"category": "Generic Modules/Human Resources",
"author": "Michael Telahun Makonnen, "
"Fekete Mihai (F... | OCA/hr | hr_contract_reference/__manifest__.py | Python | agpl-3.0 | 574 |
from lib.plugins.BasePlugin import BasePlugin
class BaseDataReader(BasePlugin):
#
# Path to file being read
#
filepath = None
#
# File being read
#
input_file = None
#
#
#
headers = []
#
#
#
def __init__(self, filepath=None):
super(BaseDataRead... | inquisite/Inquisite-Core | lib/plugins/dataReaders/BaseDataReader.py | Python | gpl-3.0 | 776 |
from django.db import models
class TastingCategory(models.Model):
title = models.CharField(max_length=128)
singularTitle = models.CharField(max_length=128)
slug = models.SlugField(max_length=128)
def __unicode__(self):
return self.title
class Tasting(models.Model):
category = models.For... | aroquemaurel/Cuis-In | cuisin/tasting/models.py | Python | gpl-2.0 | 1,752 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Ansible module to manage PaloAltoNetworks Firewall
# (c) 2016, techbizdev <techbizdev@paloaltonetworks.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 publish... | bearstech/ansible | lib/ansible/modules/network/panos/panos_loadcfg.py | Python | gpl-3.0 | 3,560 |
from .models import events_backends
from ..core.models import base_decorator
events_backend = events_backends["us-east-1"]
mock_events = base_decorator(events_backends)
| spulec/moto | moto/events/__init__.py | Python | apache-2.0 | 170 |
#!/usr/bin/python
input_legth = 8 # input length of the S-Box in bits
output_length = 8 # output length of the S-Box in bits
#function implementing an sbox, inp should be an input (plaintext), and it should return the result of passing it through the sbox
def SBOX(inp):
s_box = ((0x63 , 0x7c , 0x7b , 0x77 , ... | yurifw/CryptoTestSuit | DifferentialResisance.py | Python | gpl-2.0 | 3,605 |
# Copyright 2014 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | clarko1/Cramd | appengine/standard/ndb/modeling/keyproperty_models.py | Python | apache-2.0 | 2,072 |
"""Basic thermodynamic calculations for pickaxe."""
from typing import Union
import pint
from equilibrator_api import (
Q_,
ComponentContribution,
Reaction,
default_physiological_ionic_strength,
default_physiological_p_h,
default_physiological_p_mg,
default_physiological_temperature,
)
fro... | JamesJeffryes/MINE-Database | minedatabase/thermodynamics.py | Python | mit | 11,041 |
# 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 logging
import os
import bs4
import click
import dateutil.parser
import math
import matplotlib
import matplotlib... | alnkpa/fillbass | fillbass/parsedata.py | Python | mpl-2.0 | 9,946 |
#---------- Forematters---------------------------------------------
import numpy as np
#-------------------------------------------------------------------
def outer_scaling(u, y, U, Y):
'''
Compute the dimensionless velocity profile based on outer-scaling parameters
Inputs:
u - velocity of the profi... | hujc91/uw-ffpg | pivTools/outer_scaling.py | Python | mit | 731 |
#!/usr/bin/env python
# coding: utf-8
from oslo_config import cfg
import oslo_messaging as messaging
import oslo_messaging.rpc as rpc
import logging
import time
import sys
import eventlet
eventlet.monkey_patch()
logging.basicConfig()
log = logging.getLogger()
log.addHandler(logging.StreamHandler())
log.setLevel(lo... | muroi/sample-rpc | server.py | Python | apache-2.0 | 1,588 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ui_SOUL_Main.ui'
#
# Created: Sat Oct 3 11:28:45 2015
# by: PyQt4 UI code generator 4.10.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except A... | Khilo84/Stack-Exchange-User-Linker | ui_SOUL.py | Python | gpl-2.0 | 128,354 |
import pytest
from landlab import RasterModelGrid
from landlab.components import LandslideProbability
@pytest.fixture
def ls_prob():
grid = RasterModelGrid((20, 20), xy_spacing=10e0)
grid.add_zeros("topographic__slope", at="node", dtype=float)
grid.add_zeros("topographic__specific_contributing_area", at=... | landlab/landlab | tests/components/landslides/conftest.py | Python | mit | 835 |
# coding: utf-8
import os
from collections import OrderedDict
import logging
import argparse
import random
import netCDF4 as nc4
import pandas as pd
import numpy as np
import pvlib as pv
import scipy.io
from satoi import oi
DROP_SENSORS = []#[410, 424, 432, 446]
def suny_ghi(lats, lons, raw, terrain_elevation):... | alorenzo175/satellite_irradiance_optimal_interpolation | satoi/input_data.py | Python | mit | 13,392 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.