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 |
|---|---|---|---|---|---|---|
import sys
import os
import Pyro5
import logging
sys.path.extend(['..', '../..'])
import mupif as mp
import time as timemod
import uuid
import pbs_tool
log = logging.getLogger()
@Pyro5.api.expose
class Application10(mp.Model):
"""
Simple application which sums given time values times 2
"""
def __init... | mupif/mupif | examples/Example10-jobMan-distrib-PBS/application10.py | Python | lgpl-3.0 | 5,189 | 0.003469 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tqdm import tqdm
def wrap_iterator(iterator, progressbar):
if progressbar:
iterator = tqdm(iterator)
return iterator
def wrap_generator(g... | hirofumi0810/tensorflow_end2end_speech_recognition | utils/progressbar.py | Python | mit | 441 | 0 |
from feeluown.utils.dispatch import Signal
from feeluown.gui.widgets.my_music import MyMusicModel
class MyMusicItem(object):
def __init__(self, text):
self.text = text
self.clicked = Signal()
class MyMusicUiManager:
"""
.. note::
目前,我们用数组的数据结构来保存 items,只提供 add_item 和 clear 方法。
... | cosven/FeelUOwn | feeluown/gui/uimodels/my_music.py | Python | gpl-3.0 | 980 | 0 |
# This file is part of Indico.
# Copyright (C) 2002 - 2022 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from marshmallow import fields
from indico.core.marshmallow import mm
from indico.modules.events.sessions... | indico/indico | indico/modules/events/sessions/schemas.py | Python | mit | 937 | 0.002134 |
# !/usr/bin/env python
# -*-coding:utf-8-*-
# by huangjiangbo
# 部署服务
# deploy.py
from ConfigParser import ConfigParser
ConfigFile = r'config.ini' # 读取配置文件
config = ConfigParser()
config.read(ConfigFile)
de_infos = config.items(r'deploy_server') # 远程部署服务器信息
redeploy_server_info = {}
appinfo = {}
print de_infos
for (... | cherry-hyx/hjb-test | 脚本/deploy/t.py | Python | artistic-2.0 | 449 | 0 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('neuroelectro', '0023_auto_20160604_1620'),
]
operations = [
migrations.AlterField(
model_name='datatablestat',
... | neuroelectro/neuroelectro_org | neuroelectro/migrations/0024_auto_20160604_1750.py | Python | gpl-2.0 | 423 | 0 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from rest_framework import generics, permissions
from core.models import User
from core.serializers import UserSerializer
class UserListAPIView(generics.ListAPIView):
"""
Read-only API View to list all users.
"""
querys... | wbg-optronix-lab/emergence-lab | core/api/user.py | Python | mit | 460 | 0 |
import urllib, cgi
from decorator import decorator
from pylons.controllers.util import redirect
from pylons.controllers.util import Response, Request
from columns.lib import helpers
#from columns.lib import oauthtwitter
import oauthtwitter
from columns.lib import json
from columns.lib.exc import NoResultFound
from open... | yoshrote/Columns | columns/lib/authentication.py | Python | bsd-3-clause | 21,673 | 0.036635 |
#!/usr/bin/python
"""nrvr.xml.etree - Utilities for xml.etree.ElementTree
The main class provided by this module is ElementTreeUtil.
To be expanded as needed.
Idea and first implementation - Leo Baschy <srguiwiz12 AT nrvr DOT com>
Public repository - https://github.com/srguiwiz/nrvr-commander
Copyright (c) Nirvan... | srguiwiz/nrvr-commander | src/nrvr/xml/etree.py | Python | bsd-2-clause | 4,914 | 0.004274 |
# -*- coding: utf-8 -*-
import fixed_size_text as ft
nu = ft.Num()
it = ft.Int()
ymd = ft.DatYYYMMDD()
ah1 = [ft.col(8), # Ονομα Αρχείου
ft.col(8, 0, ' ', ymd), # Ημερομηνία δημιουργίας
ft.col(4), # Αρ.Κύκλου τρεξίματος
ft.col(127) # Filler
]
h1 = ft.row(0, ah1)
ah2 = [ft.col(4), # ... | tedlaz/pyted | pykoinoxrista/koinoxrista/fmy2015.py | Python | gpl-3.0 | 3,312 | 0.000367 |
import ply.lex as lex
from ast import Node
reserved = {
'or' : 'LOR',
'and' : 'LAND',
'neg' : 'NEG',
'exists' : 'EXISTS',
'forall' : 'FORALL',
'implies': 'IMPLIES',
'iff' : 'IFF'
}
tokens = tuple(
[
'WORD',
'VARIABLE',
'CONSTANT',
'FUNCTION',
'PREDICATE',
'COMMA',
'LPA... | arity-r/MiniLogic | lex.py | Python | mit | 1,410 | 0.055319 |
# 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 ... | yaqiyang/autorest | src/generator/AutoRest.Python.Tests/Expected/AcceptanceTests/BodyDuration/autorestdurationtestservice/auto_rest_duration_test_service.py | Python | mit | 2,204 | 0.001361 |
#!/usr/bin/env python
from os.path import join, dirname
from cloudify import ctx
ctx.download_resource(
join('components', 'utils.py'),
join(dirname(__file__), 'utils.py'))
import utils # NOQA
runtime_props = ctx.instance.runtime_properties
if utils.is_upgrade:
SERVICE_NAME = runtime_props['service_n... | Cloudify-PS/cloudify-manager-blueprints | components/nginx/scripts/creation_validation.py | Python | apache-2.0 | 445 | 0 |
from __future__ import absolute_import, unicode_literals
from django.contrib.admin.utils import quote
from django.utils.encoding import force_text
from django.utils.translation import ugettext as _
class ButtonHelper(object):
default_button_classnames = ['button']
add_button_classnames = ['bicolor', 'icon',... | iansprice/wagtail | wagtail/contrib/modeladmin/helpers/button.py | Python | bsd-3-clause | 7,291 | 0.000137 |
"""
For simplicity this module should be a stand-alone package, i.e., it should not use any
non-standard python packages such as mooseutils.
"""
import copy
from . import search
class Node(object):
"""
Base class for tree nodes that accepts arbitrary attributes.
Create a new node in the tree that is a chi... | harterj/moose | python/moosetree/Node.py | Python | lgpl-2.1 | 6,708 | 0.002534 |
import sys
import json
def test_parameter(name, value):
assert value is not None
print("Tested parameter '{0}' is {1}".format(name, value))
if __name__ == '__main__':
with open("{0}/input.json".format(sys.argv[1]), 'r') as fh:
data = json.load(fh)
parameters = data.get('kwargs', {})
exp... | cloudify-cosmo/cloudify-manager | tests/integration_tests/resources/dsl/scripts/workflows/test_deployment_id_parameters.py | Python | apache-2.0 | 664 | 0 |
#!/usr/bin/python
import unittest, os
try:
import autotest.common as common
except ImportError:
import common
from autotest_lib.client.common_lib.test_utils import mock
from autotest_lib.client.bin import package, os_dep, utils
class TestPackage(unittest.TestCase):
def setUp(self):
self.god = mo... | libvirt/autotest | client/bin/package_unittest.py | Python | gpl-2.0 | 5,565 | 0.001617 |
from subprocess import PIPE, Popen
from sqlalchemy import create_engine
def run(p):
try:
p["log"].info(p["action"]['query'])
proc = Popen(p["action"]['query'], shell=True,
stdin=PIPE, stdout=PIPE, stderr=PIPE)
result = proc.communicate()
message = ''
for... | unkyulee/elastic-cms | src/task/modules/CMD.py | Python | mit | 530 | 0.00566 |
from nltk import *
from nltk.corpus import brown
class ParallelismFinder:
def __init__(self):
self.f = ""
self.counter = 0
self.para = [] #array to hold instances of parallelism
self.tokenizer = RegexpTokenizer('\w+') #remove punctuation which could mess up finding parallelism
... | benglard/Rhetorical-Analysis | ParallelismFinder.py | Python | mit | 2,891 | 0.012452 |
import unittest
import numpy as np
import ndhist
class Test(unittest.TestCase):
def test_log10_axis_1D(self):
"""Tests if the log10_axis works with the ndhist object for 1D
histograms.
"""
axis_0 = ndhist.axes.log10(0.1, 100, 0.1)
self.assertTrue(axis_0.nbins == 32)
... | martwo/ndhist | test/ndhist/log10_axis_test.py | Python | bsd-2-clause | 788 | 0.005076 |
from .settings import Settings
from .logger import Logger
from .detection_result_recorder import DetectionResultRecorder
from .color_operations import ColorOperations
from .target_analyzer import TargetAnalyzer
from .background_color_nullifier import BackgroundColorNullifier
from .target_detectors import TargetDetector... | FlintHill/SUAS-Competition | UpdatedImageProcessing/UpdatedImageProcessing/TargetDetection/__init__.py | Python | mit | 668 | 0.002994 |
"""
Copyright (c) 2010 cmiVFX.com <info@cmivfx.com>
This file is part of AtomSplitter.
AtomSplitter 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... | justinfx/AtomSplitter | ui/__init__.py | Python | gpl-3.0 | 776 | 0.005155 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# how to transform with pandas
from pandas import Series
from pandas import DataFrame
from scipy.stats import boxcox
from matplotlib import pyplot
series = Series.from_csv( "airline-passengers.csv" , header=0)
dataframe = DataFrame(series.values)
dataframe.columns = ['passeng... | KrisCheng/ML-Learning | archive/Model/sequence/time_series/transform.py | Python | mit | 938 | 0.00533 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe, json
from frappe.desk.form.load import run_onload
@frappe.whitelist()
def savedocs(doc, action):
"""save / submit / update doclist"""
try:
doc = frappe.get_doc... | ESS-LLP/frappe | frappe/desk/form/save.py | Python | mit | 1,963 | 0.030056 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-03-18 21:22
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('draw', '0006_auto_20160314_1817'),
]
operations = [
migrations.AlterField(
... | hozblok/biodraw | draw/migrations/0007_auto_20160318_2122.py | Python | gpl-3.0 | 475 | 0 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
import logging
import lazy
from ..exceptions import InvalidOutputError, SubprocessError, WhitespaceError
from .base import BaseCommand
__logger__ = logging.getLogger('pybsd')
class EzjailAdmin(BaseCommand):
"""Pro... | rebost/pybsd | src/pybsd/commands/ezjail_admin.py | Python | bsd-3-clause | 5,154 | 0.000582 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# res_partner
# Copyright (c) 2013 Codeback Software S.L. (http://codeback.es)
# @author: Miguel García <miguel@codeback.es>
# @author: Javier Fuentes <javier@codeback.es>
#
# This program is fr... | codeback/openerp-cbk_company_web_discount | res_company.py | Python | agpl-3.0 | 1,385 | 0.003615 |
from openflow.optin_manager.sfa.rspecs.elements.element import Element
class PLTag(Element):
fields = [
'tagname',
'value',
]
| dana-i2cat/felix | optin_manager/src/python/openflow/optin_manager/sfa/rspecs/elements/pltag.py | Python | apache-2.0 | 161 | 0.012422 |
# -*- coding: utf-8 -*-
from operator import attrgetter
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType
from pyangbind.lib.yangtypes import RestrictedClassType
from pyangbind.lib.yangtypes import TypedListType
from pyangbind.lib.yangtypes import YANGBool
from pyangbind.lib.yangtypes import YANGListTy... | napalm-automation/napalm-yang | napalm_yang/models/openconfig/network_instances/network_instance/protocols/protocol/isis/global_/igp_shortcuts/afi/__init__.py | Python | apache-2.0 | 25,266 | 0.001583 |
# 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
# d... | gotostack/iSwift | iswift/privatefiles/models.py | Python | apache-2.0 | 1,365 | 0 |
#!/usr/bin/python
#======================================================================
#
# Project : hpp_IOStressTest
# File : Libs/IOST_WMain/IOST_WMainSATA.py
# Date : Oct 20, 2016
# Author : HuuHoang Nguyen
# Contact : hhnguyen@apm.com
# : hoangnh.hpp@gmail.com
# License : MIT License
# Copy... | HPPTECH/hpp_IOSTressTest | Refer/IOST_OLD_SRC/IOST_0.20/Libs/IOST_WMain/IOST_WMain_SATA.py | Python | mit | 7,573 | 0.007659 |
import pandas as pd
import numpy
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.naive_bayes import MultinomialNB
content = []
data = []
common = []
def remove_non_ascii(text):
return ''.join([i if ord(i) < 128 else ' ' for i in text])
def remove_words(array):
final = []
words = []
for... | yrahul3910/chatting-style-recognizer | classify.py | Python | mit | 2,888 | 0.009349 |
import os
import unittest
import synapse
import synapse.lib.datfile as s_datfile
from synapse.tests.common import *
syndir = os.path.dirname(synapse.__file__)
class DatFileTest(SynTest):
def test_datfile_basic(self):
with s_datfile.openDatFile('synapse.tests/test.dat') as fd:
self.nn(fd)
... | vivisect/synapse | synapse/tests/test_lib_datfile.py | Python | apache-2.0 | 360 | 0.002778 |
import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
def test_basic():
s = pd.Series([[0, 1, 2], np.nan, [], (3, 4)], index=list("abcd"), name="foo")
result = s.explode()
expected = pd.Series(
[0, 1, 2, np.nan, np.nan, 3, 4], index=list("aaabcdd"), dtype=object, name=... | dsm054/pandas | pandas/tests/series/methods/test_explode.py | Python | bsd-3-clause | 4,090 | 0.001467 |
# coding=utf-8
r"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from twilio.base import deserialize
from twilio.base import serialize
from twilio.base import values
from twilio.base.instance_context import InstanceContext
from twilio.base.instance_resource import... | twilio/twilio-python | twilio/rest/taskrouter/v1/workspace/task/reservation.py | Python | mit | 38,257 | 0.0046 |
import sys
import urllib
import urllib2
import urlparse
import xbmcgui
import xbmcplugin
import xbmcaddon
import xbmcvfs
import json
import base64
addonID = 'plugin.audio.radiobrowser'
addon = xbmcaddon.Addon(id=addonID)
base_url = sys.argv[0]
addon_handle = int(sys.argv[1])
args = urlparse.parse_qs(sys.argv[2][1:])
... | segler-alex/kodi-radio-browser | main.py | Python | gpl-3.0 | 10,729 | 0.005313 |
#!/usr/bin/env python
import os, sys
def touch(path):
with open(path, 'a'):
os.utime(path, None)
fout = open('sample.fileids', 'wb')
fout2 = open('sample.transcription', 'wb')
for fn in sorted(os.listdir('.')):
if not fn.endswith('.wav'):
continue
base_fn = os.path.splitext(fn)[0]
txt_... | chrisspen/homebot | src/test/detect_voice/sphinxtrain_test/samples/make_fileids.py | Python | mit | 559 | 0.005367 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import unittest
from cron_status import *
class TestChangeDetection(unittest.TestCase):
"""Test if the change detection is operational."""
# Please note that status_history_list is backwards,
# i.e., newest entry first.
def test_all_okay(self):
... | fau-fablab/kastenwesen | test_cron.py | Python | gpl-3.0 | 4,191 | 0.000954 |
# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""GYP backend that generates Eclipse CDT settings files.
This backend DOES NOT generate Eclipse CDT projects. Instead, it generates XML
files that can be importe... | wiltonlazary/arangodb | 3rdParty/V8/gyp/generator/eclipse.py | Python | apache-2.0 | 16,471 | 0.010685 |
import time
import threading
import subprocess
import pygame.locals
vlc_path = 'C:\\Program Files (x86)\\VideoLAN\\VLC\\vlc.exe'
class Scene(threading.Thread):
def __init__(self, screen, games, games_manager):
threading.Thread.__init__(self)
self.screen = screen
self.games = games
... | flowersteam/SESM | SESM/scene.py | Python | gpl-3.0 | 953 | 0.005247 |
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = 'fake-key'
INSTALLED_APPS = [
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'analytics',
'tests'
]
ROO... | Baguage/django-google-analytics-id | tests/test_settings.py | Python | mit | 612 | 0.001634 |
'''
Generate all permutations of a given string
'''
def permutations(str):
if(len(str)==1):
return str[0]
permutation = permutations(str[1:])
word = str[0]
result = []
for perm in permutation:
for i in range(len(perm)+1): # note: len+1
result.append(perm[:i]+word+p... | jenniferwx/Programming_Practice | Permutations.py | Python | bsd-3-clause | 365 | 0.016438 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('lists', '0002_auto_20150301_1937'),
]
operations = [
migrations.AlterModelOptions(
... | imxiaohui/django-todolist-1 | lists/migrations/0003_auto_20150308_2120.py | Python | mit | 1,229 | 0.001627 |
from collections import Counter
import numpy as np
def run(word_gen, index, window_size, out_file):
context = []
pair_counts = Counter()
for word in word_gen:
context.append(index[word])
if len(context) > window_size * 2 + 1:
context.pop(0)
pair_counts = _process_context... | williamleif/histwords | representations/cooccurgen.py | Python | apache-2.0 | 944 | 0.002119 |
# vi:si:et:sw=4:sts=4:ts=4
# Flumotion - a streaming media server
# Copyright (C) 2004,2005,2006,2007,2008,2009 Fluendo, S.L.
# Copyright (C) 2010,2011 Flumotion Services, S.A.
# All rights reserved.
#
# This file may be distributed and/or modified under the terms of
# the GNU Lesser General Public License version 2.1... | osiloke/Flumotion-Transcoder | flumotion/transcoder/admin/transbalancer.py | Python | lgpl-2.1 | 4,755 | 0.001682 |
import unittest
import pythran
import os.path
#pythran export a((float,(int,uintp),str list) list list)
#pythran export a(str)
#pythran export a( (str,str), int, intp list list)
#pythran export a( float set )
#pythran export a( bool:str dict )
#pythran export a( float )
#pythran export a( int8[] )
#pythran export a( i... | pombredanne/pythran | pythran/tests/test_spec_parser.py | Python | bsd-3-clause | 3,994 | 0.008763 |
# vi: ts=4 expandtab
#
# Copyright (C) 2009-2010 Canonical Ltd.
# Copyright (C) 2012 Hewlett-Packard Development Company, L.P.
#
# Author: Scott Moser <scott.moser@canonical.com>
# Author: Juerg Haefliger <juerg.haefliger@hp.com>
#
# This program is free software: you can redistribute it and/or modify
# ... | racker/cloud-init-debian-pkg | cloudinit/config/cc_puppet.py | Python | gpl-3.0 | 5,166 | 0.000387 |
from jinja2 import Markup, contextfunction
from canvas.templatetags.jinja_base import (global_tag, filter_tag, render_jinja_to_string,
jinja_context_tag, update_context)
@global_tag
def activity_stream_item(activity, viewer):
ctx = {
'activity': activity,
... | canvasnetworks/canvas | website/apps/activity/jinja_tags.py | Python | bsd-3-clause | 444 | 0.009009 |
"""The auto-tuning module of tvm
This module includes:
* Tuning space definition API
* Efficient auto-tuners
* Tuning result and database support
* Distributed measurement to scale up tuning
"""
from . import database
from . import feature
from . import measure
from . import record
from . import task
from . impor... | mlperf/training_results_v0.6 | Fujitsu/benchmarks/resnet/implementations/mxnet/3rdparty/tvm/python/tvm/autotvm/__init__.py | Python | apache-2.0 | 794 | 0.001259 |
#!/usr/bin/env python
from runtest import TestBase
class TestCase(TestBase):
def __init__(self):
TestBase.__init__(self, 'longjmp3', """
# DURATION TID FUNCTION
1.164 us [ 4107] | __monstartup();
0.657 us [ 4107] | __cxa_atexit();
[ 4107] | main() {
0.705 us [ 4107] | _setjmp... | JIMyungSik/uftrace | tests/t145_longjmp3.py | Python | gpl-2.0 | 1,447 | 0.001382 |
# -*- coding: utf-8 -*-
"""
Testing WordProcessingDocument
"""
# $Id: test_wordprocessing.py 6355 2007-09-20 17:16:21Z glenfant $
import unittest
import os
from fixures import *
import openxmllib
class WordProcessingTest(unittest.TestCase):
"""Testing querying properties from a document"""
def setUp(self):
... | hltbra/openxmllib | tests/test_wordprocessing.py | Python | gpl-2.0 | 1,363 | 0.003679 |
import sys
import math
# Don't let the machines win. You are humanity's last hope...
width = int(input()) # the number of cells on the X axis
height = int(input()) # the number of cells on the Y axis
Matrix = [[0 for x in range(height)] for x in range(width)]
# Creating the matrix
for i in range(height):
l... | zeke8402/codingame-puzzles | medium/apu-init-phase/solution.py | Python | mit | 1,508 | 0.002653 |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2007 Donald N. Allingham
# 2009 Gary Burton
# Copyright (C) 2011 Tim G L Lyons
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published ... | Forage/Gramps | gramps/gui/editors/editpersonref.py | Python | gpl-2.0 | 6,336 | 0.004735 |
from __future__ import unicode_literals
from memory.mem import _Memory
class Windows2012ServerR2Memory(_Memory):
def __init__(self, params):
super(Windows2012ServerR2Memory, self).__init__(params)
def csv_all_modules_dll(self):
super(Windows2012ServerR2Memory, self)._csv_all_modules_dll()
... | SeungGiJeong/SK_FastIR | memory/windows2012ServerR2Memory.py | Python | gpl-3.0 | 440 | 0.002273 |
#
# GeoCoon - GIS data analysis library based on Pandas and Shapely
#
# Copyright (C) 2014 by Artur Wroblewski <wrobell@pld-linux.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either ve... | wrobell/geocoon | geocoon/tests/test_core.py | Python | gpl-3.0 | 9,461 | 0.003065 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
SplitRGBBands.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
*************************... | camptocamp/QGIS | python/plugins/processing/saga/SplitRGBBands.py | Python | gpl-2.0 | 3,715 | 0.005922 |
import subprocess
from subprocess import Popen, PIPE
import os
import re
def compiler_preprocessor_verbose(compiler, extraflags):
"""Capture the compiler preprocessor stage in verbose mode
"""
lines = []
with open(os.devnull, 'r') as devnull:
cmd = [compiler, '-E']
cmd += extraflags
... | AndrewWalker/ccsyspath | ccsyspath/paths.py | Python | mit | 1,112 | 0.005396 |
# coding: utf-8
"""Client program.
How to collect data:
1. Positions received as a list of points
2. Interpolate function (probably unstructured grid, see scipy.interpolate.griddata)
3. Evaluate function on points coming from the FEniCS mesh
4. Restore the values onto the array of a FEniCS function in the proper orde... | Juanlu001/pfc | demo/aquaclient.py | Python | gpl-3.0 | 883 | 0.002265 |
from allauth.socialaccount.tests import OAuth2TestsMixin
from allauth.tests import MockedResponse, TestCase
from .provider import PaypalProvider
class PaypalTests(OAuth2TestsMixin, TestCase):
provider_id = PaypalProvider.id
def get_mocked_response(self):
return MockedResponse(
200,
... | rsalmaso/django-allauth | allauth/socialaccount/providers/paypal/tests.py | Python | mit | 613 | 0 |
import mock
import json
import pytest
import prf.exc
def fake_resp(code):
return mock.MagicMock(
code = str(code),
status_code = code,
headers = [],
title = 'title',
detail = 'detail',
explanation = 'explanation'
)
class TestExc(object):
@mock.patch('prf.e... | vahana/prf | prf/tests/test_exc.py | Python | mit | 2,450 | 0.015102 |
# -*- coding: utf-8 -*-
import logging
from pprint import pformat
from time import clock, sleep
try:
import unittest2 as unittest
except ImportError:
import unittest
import config
from event_stack import TimeOutReached
from database_reception import Database_Reception
from static_ag... | AdaHeads/Coverage_Tests | disabled_tests/incoming_calls.py | Python | gpl-3.0 | 9,794 | 0.027159 |
"""
WSGI config for puuch project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` se... | ricrdo/puuch | puuch/wsgi.py | Python | mit | 1,416 | 0.000706 |
# -*- coding: utf-8 -*-
"""
Copyright (C) 2016, Zato Source s.r.o. https://zato.io
Licensed under LGPLv3, see LICENSE.txt for terms and conditions.
"""
| alirizakeles/zato | code/zato-server/src/zato/server/service/internal/security/vault/policy.py | Python | gpl-3.0 | 154 | 0 |
#!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | Kazade/NeHe-Website | google_appengine/google/appengine/api/memcache/__init__.py | Python | bsd-3-clause | 52,152 | 0.004429 |
# coding: utf8
# Copyright 2015 Vincent Jacques <vincent@vincent-jacques.net>
import unittest
import MockMockMock
from ..bus import Bus
from .ping import Ping
from .read_data import ReadData
from .write_data import WriteData
from .reg_write import RegWrite
from .action import Action
from .reset import Reset
from .s... | jacquev6/Pynamixel | Pynamixel/instructions/bus_tests.py | Python | mit | 3,416 | 0.001464 |
# coding: utf-8
from unittest import TestCase
#import os
#import sys
#root = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
#sys.path.insert(0, root)
from test.util import GRAB_TRANSPORT, ignore_transport, only_transport
from test.server import SERVER
from grab.selector import KitSelector
from grab impo... | subeax/grab | test/case/selector_kit.py | Python | mit | 3,668 | 0.004635 |
# syft absolute
import syft as sy
from syft.lib.python.string import String
from syft.proto.lib.python.string_pb2 import String as String_PB
def test_string_serde() -> None:
syft_string = String("Hello OpenMined")
serialized = syft_string._object2proto()
assert isinstance(serialized, String_PB)
des... | OpenMined/PySyft | packages/syft/tests/syft/lib/python/string/string_serde_test.py | Python | apache-2.0 | 780 | 0 |
#!/usr/bin/env python
# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Verifies that app bundles are built correctly.
"""
from __future__ import print_function
import TestGyp
import TestMac
import os
impo... | ibc/MediaSoup | worker/deps/gyp/test/mac/gyptest-app-assets-catalog.py | Python | isc | 4,164 | 0.010567 |
import threading
import Queue
from random import random
theVar = 0
class MyThread ( threading.Thread ):
def run ( self ):
global theVar
while True:
client=myPool.get()
print '- iniciando thread-'
if client=='stop':
print 'Thread terminou <-'
... | haphaeu/yoshimi | mth/MultiThread_ClientPool.py | Python | lgpl-3.0 | 1,065 | 0.019718 |
# coding: utf-8
"""
Talon.One API
The Talon.One API is used to manage applications and campaigns, as well as to integrate with your application. The operations in the _Integration API_ section are used to integrate with our platform, while the other operations are used to manage applications and campaigns. #... | talon-one/talon_one.py | test/test_attributes_mandatory.py | Python | mit | 2,093 | 0.0043 |
"""The tests for sensor recorder platform."""
# pylint: disable=protected-access,invalid-name
from datetime import timedelta
from unittest.mock import patch, sentinel
import pytest
from pytest import approx
from homeassistant.components.recorder import history
from homeassistant.components.recorder.const import DATA_... | jawilson/home-assistant | tests/components/recorder/test_statistics.py | Python | apache-2.0 | 24,602 | 0.001179 |
# Copyright (C) 2011-2016 Codethink Limited
#
# 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; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but... | perryl/morph | morphlib/git.py | Python | gpl-2.0 | 10,923 | 0.000275 |
from __future__ import print_function
import time
import numpy as np
from mpi4py import MPI
from python_compat import range
comm = MPI.COMM_WORLD
def r_print(*args):
"""
print message on the root node (rank 0)
:param args:
:return:
"""
if comm.rank == 0:
print('ROOT:', end=' ')
... | yishayv/lyacorr | mpi_helper.py | Python | mit | 2,068 | 0 |
from __future__ import division
from multiprocessing import Pool
from collections import defaultdict
from skimage import io
from scipy import ndimage
from shutil import Error, move, rmtree
import numpy as np
import glob, os, codecs, sys, json
'''
## Processing notes
The Alto XML structure is as follows:
Each `root_d... | YaleDHLab/image-segmentation | yale_daily_news/segment_ydn_images.py | Python | mit | 24,116 | 0.011403 |
# django imports
from django.contrib.sites.models import Site
from django.template import Library
from django.utils.safestring import mark_safe
from lfs_downloadable_products import views
register = Library()
@register.simple_tag(takes_context=True)
def manage_attachments(context, product):
request = context.get... | diefenbach-fz/lfs-downloadable-products | lfs_downloadable_products/templatetags/lfs_downloadable_products_tags.py | Python | bsd-3-clause | 954 | 0.002096 |
import json
import logging
import xml.sax.saxutils as saxutils
from django.contrib.auth.decorators import login_required
from django.http import Http404
from django.core.context_processors import csrf
from django.contrib.auth.models import User
from django.utils.translation import ugettext as _
from django.views.decor... | morenopc/edx-platform | lms/djangoapps/django_comment_client/forum/views.py | Python | agpl-3.0 | 18,118 | 0.004029 |
import numpy
from matplotlib import pyplot as plot
import matplotlib.cm as cm
def iter_count(C, max_iter):
X = C
for n in range(max_iter):
if abs(X) > 2.:
return n
X = X ** 2 + C
return max_iter
N = 512
max_iter = 64
xmin, xmax, ymin, ymax = -0.32, -0.22, 0.8, 0.9
X = numpy.linspace(xmin, xmax, N)
Y = numpy... | moonbury/notebooks | github/MatplotlibCookbook/Chapter 6/06.py | Python | gpl-3.0 | 748 | 0.025401 |
# -*- coding: utf-8 -*-
"""
Display vnstat statistics.
Coloring rules.
If value is bigger that dict key, status string will turn to color, specified
in the value.
Example:
coloring = {
800: "#dddd00",
900: "#dd0000",
}
(0 - 800: white, 800-900: yellow, >900 - red)
Format of s... | Spirotot/py3status | py3status/modules/vnstat.py | Python | bsd-3-clause | 4,225 | 0.000237 |
import re
import os
import itertools
import time
from string import upper
import ete3
import copy
import subprocess
from collections import defaultdict
from sys import platform
from scipy import stats
from ete3 import Tree
from natsort import natsorted
from Bio import AlignIO
"""
Functions:
~
Chabrielle Allen
Travis... | chilleo/ALPHA | CommandLineFiles/RunDGEN.py | Python | mit | 100,444 | 0.004888 |
"""
This module has the mock object definitions used to hold reference geometry
for the GEOS and GDAL tests.
"""
import json
import os
from django.utils.functional import cached_property
# Path where reference test data is located.
TEST_DATA = os.path.join(os.path.dirname(__file__), 'data')
def tuplize(seq):
"T... | camilonova/django | tests/gis_tests/test_data.py | Python | bsd-3-clause | 2,588 | 0.000386 |
""" A location-aware script to manage ringer volume """
__author__ = 'Marco Bonifacio <bonifacio.marco@gmail.com>'
__license__ = 'MIT License'
import android
import time
# Parameters
SSID = {'bonix-lan': 'casa',
'ZENIT SECURED WPA': 'lavoro'}
RINGER = {'casa': 5,
'lavoro': 2,
'sconosciuto... | mbonix/yapr | android/PyLocale.py | Python | mit | 2,023 | 0.002472 |
from fitbit import Fitbit
from datetime import date, datetime, time, timedelta
import json
# '''merges two response dicts based on the keys'''
# def combine(a, b):
# c = {}
# for key in a.keys():
# if (key.endswith('-intraday')):
# c[key] = a[key]
# c[key]['dataset'].extend(b[ke... | sociam/indx | apps/fitbit/bin/fitbit/fitbit_intraday.py | Python | agpl-3.0 | 3,324 | 0.007822 |
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
def register_types(module):
root_module = module.get_root()
## device-energy-model-container.h: ns3::DeviceEnergyModelContainer [class]
module.add_class('DeviceEnergyModelContainer')
## energy-model-helper.h: ns3::De... | joelagnel/ns-3 | bindings/python/apidefs/gcc-LP64/ns3_module_energy.py | Python | gpl-2.0 | 54,425 | 0.016628 |
###############################################################################
##
## Copyright (C) 2011-2014, NYU-Poly.
## Copyright (C) 2006-2011, University of Utah.
## All rights reserved.
## Contact: contact@vistrails.org
##
## This file is part of VisTrails.
##
## "Redistribution and use in source and binary for... | Nikea/VisTrails | vistrails/db/versions/v0_9_3/persistence/xml/auto_gen.py | Python | bsd-3-clause | 66,772 | 0.005571 |
import collections
class Solution:
def arrangeWords(self, text: str) -> str:
words = text.split()
table = collections.defaultdict(list)
for word in words:
table[len(word)].append(word)
result = []
for key in sorted(table):
result.extend(table[key])
... | jiadaizhao/LeetCode | 1401-1500/1451-Rearrange Words in a Sentence/1451-Rearrange Words in a Sentence.py | Python | mit | 513 | 0.001949 |
# EMU code from https://github.com/rainforestautomation/Emu-Serial-API
from emu import *
import sys
import json
import msgpack
from xbos import get_client
from bw2python.bwtypes import PayloadObject
import time
with open("params.json") as f:
try:
params = json.loads(f.read())
except ValueError as e:
... | SoftwareDefinedBuildings/bw2-contrib | driver/emu2/driver.py | Python | gpl-3.0 | 2,380 | 0.007143 |
"""
Contains methods for accessing weekly course highlights. Weekly highlights is a
schedule experience built on the Schedules app.
"""
from __future__ import absolute_import
import logging
from courseware.model_data import FieldDataCache
from courseware.module_render import get_module_for_descriptor
from openedx.cor... | jolyonb/edx-platform | openedx/core/djangoapps/schedules/content_highlights.py | Python | agpl-3.0 | 4,066 | 0.000492 |
#!/usr/bin/env python
from ansible.module_utils.hashivault import hashivault_argspec
from ansible.module_utils.hashivault import hashivault_auth_client
from ansible.module_utils.hashivault import hashivault_init
from ansible.module_utils.hashivault import hashiwrapper
ANSIBLE_METADATA = {'status': ['stableinterface'],... | TerryHowe/ansible-modules-hashivault | ansible/modules/hashivault/hashivault_approle_role_get.py | Python | mit | 1,659 | 0.001206 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Entity',
fields=[
('id', models.AutoField(verbo... | mattwaite/CanvasStoryArchive | stories/migrations/0001_initial.py | Python | mit | 1,746 | 0.001718 |
#! /usr/bin/python
class A1(object):
def method(*argv): return argv
a = A1()
print 'Call a.method() ->', a.method()
print 'Call a.method(1,2,3) ->', a.method(1,2,3)
print '''
!! Note that the \'a\' instance is passed (implicitely) as the first
!! function parameter (something like <__main__.A1 ob... | xanthospap/chaos-ngpt | mipy/class-static-mths.py | Python | gpl-3.0 | 2,368 | 0.010557 |
import mfr
import json
from tests import utils
from tornado import testing
class TestRenderHandler(utils.HandlerTestCase):
@testing.gen_test
def test_options_skips_prepare(self):
# Would crash b/c lack of mocks
yield self.http_client.fetch(
self.get_url('/render'),
met... | haoyuchen1992/modular-file-renderer | tests/server/handlers/test_render.py | Python | apache-2.0 | 344 | 0 |
"""Views for bootcamp applications"""
from collections import OrderedDict
import re
from django.db.models import Count, Subquery, OuterRef, IntegerField, Prefetch, Q
from django.shortcuts import get_object_or_404
from django.views.generic import TemplateView
from django_filters.rest_framework import DjangoFilterBacken... | mitodl/bootcamp-ecommerce | applications/views.py | Python | bsd-3-clause | 9,919 | 0.001109 |
# -*- coding: utf-8 -*-
# --------------------------------------------------------------------
# The MIT License (MIT)
#
# Copyright (c) 2014 Jonathan Labéjof <jonathan.labejof@gmail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation fi... | b3j0f/utils | b3j0f/utils/ut.py | Python | mit | 5,685 | 0.000176 |
# -*- coding: utf-8 -*-
#
# javauserguide documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 21 21:46:23 2015.
#
# 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.... | BiuroCo/mega | bindings/doc/java/sphinx/source/conf.py | Python | bsd-2-clause | 11,589 | 0.006385 |
# -*- coding: utf8 -*-
# Copyright (c) 2017-2021 THL A29 Limited, a Tencent company. 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... | tzpBingo/github-trending | codespace/python/tencentcloud/tcm/v20210413/tcm_client.py | Python | mit | 3,255 | 0.002476 |
from __future__ import division
import myhdl
from myhdl import instance, delay
ClockList = []
class Clock(myhdl.SignalType):
def __init__(self, val, frequency=1, timescale='1ns'):
self._frequency = frequency
self._period = 1/frequency
self._timescale = timescale
self._htick... | cfelton/myhdl_exercises | support/mysigs.py | Python | mit | 2,461 | 0.002438 |
"""
model.py
by Ted Morin
contains a function to predict 10-year Atrial Fibrilation risks using beta coefficients from
10.1016:S0140-6736(09)60443-8
2010 Development of a Risk Score for Atrial Fibrillation in the Community
Framingham Heart Study
translated and optimized from FHS online risk calculator's javascript
... | doirisks/dori | models/10.1016:S0140-6736(09)60443-8/model.py | Python | gpl-3.0 | 3,494 | 0.010876 |
import xml.etree.ElementTree as ET
import numpy as np
import openmc
import pytest
from tests.unit_tests import assert_unbounded
def test_basic():
c1 = openmc.Cell()
c2 = openmc.Cell()
c3 = openmc.Cell()
u = openmc.Universe(name='cool', cells=(c1, c2, c3))
assert u.name == 'cool'
cells = set... | wbinventor/openmc | tests/unit_tests/test_universe.py | Python | mit | 2,900 | 0 |
"""
.. _ex-inverse-source-power:
==========================================
Compute source power using DICS beamformer
==========================================
Compute a Dynamic Imaging of Coherent Sources (DICS) :footcite:`GrossEtAl2001`
filter from single-trial activity to estimate source power across a frequency... | mne-tools/mne-tools.github.io | stable/_downloads/3d312e85f6ffa492419d3828dd31227d/dics_source_power.py | Python | bsd-3-clause | 3,552 | 0 |
"""
This is for taking a json file and putting it into a shapefile.
It uses the generic functions written by mfoley.
"""
from geo_utils import get_data_from_geoserver
import json
import six
from fiona import collection
import pyproj
from shapely.geometry import Point, mapping
op_file = "museums.shp"
server = "mf2.d... | d15123601/geotinkering | make_shpfile.py | Python | mit | 1,216 | 0.005757 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.