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 |
|---|---|---|---|---|---|---|
from modeltranslation.translator import translator, TranslationOptions
from nsms.text.models import *
from django.utils.translation import ugettext as _
from django.utils.translation import get_language as _get_language
from modeltranslation import utils
class TextTranslationOptions(TranslationOptions):
fields = ... | eHealthAfrica/ureport | ureport/translation.py | Python | agpl-3.0 | 646 | 0.00774 |
import logging
from serial_grabber.reader import MessageVerifier
class XBeeMessageVerifier(MessageVerifier):
logger = logging.getLogger("MessageVerifier")
def verify_message(self, transaction):
try:
data = transaction.split("\n")
if int(data[-2]) == len("\n".join(data[1:-2])):... | nigelb/SerialGrabber | examples/MqttXBeeStream/MqttXBee.py | Python | gpl-2.0 | 668 | 0.007485 |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2008-2010 Craig J. Anderson
# Copyright (C) 2014 Paul Franklin
#
# 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... | Nick-Hall/gramps | gramps/plugins/lib/libtreebase.py | Python | gpl-2.0 | 34,876 | 0.004014 |
#!/usr/bin/python
#coding=utf-8
'''
@author: sheng
@license:
'''
SPELL=u'shuǐdào'
CN=u'水道'
NAME=u'shuidao34'
CHANNEL='stomach'
CHANNEL_FULLNAME='StomachChannelofFoot-Yangming'
SEQ='ST28'
if __name__ == '__main__':
pass
| sinotradition/meridian | meridian/acupoints/shuidao34.py | Python | apache-2.0 | 236 | 0.034783 |
#!/usr/bin/env python
#
# Beautiful Capi generates beautiful C API wrappers for your C++ classes
# Copyright (C) 2015 Petr Petrovich Petrov
#
# This file is part of Beautiful Capi.
#
# Beautiful Capi is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as publis... | PetrPPetrov/beautiful-capi | source/ExtensionSemantic.py | Python | gpl-3.0 | 2,815 | 0.001066 |
from django.conf.urls import include, url
from . import views
app_name = 'todo'
urlpatterns = [
url(r'^lists/$', views.todolists, name='todo_lists'),
url(r'^lists/(?P<list_id>[\w\d]+)/update/$', views.UpdateTodoList.as_view(), name='update_list'),
url(r'^lists/card/(?P<card_id>[\w\d]+)/$', views.cards, name='cards'... | giantas/elibrary | todo/urls.py | Python | mit | 885 | 0.018079 |
from __main__ import vtk, qt, ctk, slicer
#
# LengthStat
#
class FiberLengthCleaning:
def __init__(self, parent):
parent.title = "Fiber Length Cleaning"
parent.categories = ["Diffusion"]
parent.contributors = ["Jean-Baptiste Berger and Martin Styner"]
self.parent = paren... | NIRALUser/FiberViewerLight | FiberLengthCleaning.py | Python | apache-2.0 | 11,548 | 0.015674 |
"""
This package contains different `unittests <https://docs.python.org/3/library/unittest.html>`_ for the project.
Those tests help to validate difficult pieces of the software.
"""
__author__ = 'Wuersch Marcel'
__license__ = "GPLv3" | wursm1/eurobot-hauptsteuerung | eurobot/tests/__init__.py | Python | gpl-3.0 | 235 | 0.008511 |
from __future__ import absolute_import
import platform
import datetime
import sunpy
__all__ = ['system_info']
def system_info():
"""Prints system information.
Prints information about the runtime environment that SunPy lives in.
Information about the OS, architecture, Python, and all major dependen... | mjm159/sunpy | sunpy/util/sysinfo.py | Python | bsd-2-clause | 3,403 | 0.006465 |
from hitchhttp import http_request
from ruamel.yaml import dump
from ruamel.yaml.dumper import RoundTripDumper
from ruamel.yaml.comments import CommentedMap
from hitchhttp.models import Database
from os import path
import tornado.web
import tornado
import requests
import random
import json
import time
import sys
clas... | hitchtest/hitchhttp | hitchhttp/main_request_handler.py | Python | agpl-3.0 | 7,882 | 0.011799 |
#CHIPSEC: Platform Security Assessment Framework
#Copyright (c) 2010-2015, Intel Corporation
#
#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.
#
#This program is distributed in t... | naterh/chipsec | source/tool/chipsec/modules/common/secureboot/keys.py | Python | gpl-2.0 | 5,186 | 0.021597 |
"""
This example outputs a custom waveform and records the waveform on Channel A.
The output of the AWG must be connected to Channel A.
"""
import os
import numpy as np
# if matplotlib is available then plot the results
try:
import matplotlib.pyplot as plt
except ImportError:
plt = None
from msl.equipment i... | MSLNZ/msl-equipment | msl/examples/equipment/picotech/picoscope/acquire_AWG_custom.py | Python | mit | 2,306 | 0.002602 |
#!/usr/bin/python
# -*- coding:Utf-8 -*-
import pytest
from baron.parser import ParsingError
from .test_utils import parse_simple
def test_simple_power():
"a**b"
parse_simple([
('NAME', 'a'),
('DOUBLE_STAR', '**'),
('NAME', 'b')
], [
{
"type": "binary_operator",... | PyCQA/baron | tests/test_grammator_operators.py | Python | lgpl-3.0 | 293,854 | 0.000163 |
from others import sms_request
print(sms_request('15683000435', '123456')) | mrcodehang/cqut-chat-server | test/test_http.py | Python | mpl-2.0 | 75 | 0.013333 |
###############################################################################
# tetrapy.py
# Tetrapy
#
# Copyright (C) 2013 Kesara Rathnayake
#
# Tetrapy 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, eithe... | kesara/tetrapy | tetrapy.py | Python | gpl-3.0 | 3,480 | 0.005747 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Nov 15 14:09:59 2017
@author: SaintlyVi
"""
import pandas as pd
import numpy as np
from support import writeLog
def uncertaintyStats(submodel):
"""
Creates a dict with statistics for observed hourly profiles for a given year.
Use evaluati... | SaintlyVi/DLR_DB | evaluation/calibration.py | Python | mit | 5,511 | 0.01869 |
import testtools
from keystoneclient.middleware import memcache_crypt
class MemcacheCryptPositiveTests(testtools.TestCase):
def _setup_keys(self, strategy):
return memcache_crypt.derive_keys('token', 'secret', strategy)
def test_constant_time_compare(self):
# make sure it works as a compare,... | tylertian/Openstack | openstack F/python-keystoneclient/tests/test_memcache_crypt.py | Python | apache-2.0 | 3,163 | 0 |
# -*- coding: utf-8 -*-
from collections import OrderedDict
from gluon import current
from gluon.storage import Storage
def config(settings):
"""
Template settings for American Red Cross
Demo only, not in Production
"""
T = current.T
# ==============================================... | flavour/eden | modules/templates/historic/ARC/config.py | Python | mit | 84,335 | 0.008044 |
from . import Checker
class ExactChecker(Checker):
async def check(self, sandbox, task):
output = await sandbox.read("/tmp/output.txt")
task.accepted = output == task.testcase.output
task.verdict = "AC" if task.accepted else "WA"
| johnchen902/toyoj | judge/toyojjudge/checker/exact.py | Python | agpl-3.0 | 259 | 0.003861 |
""" Cardiac Arrhythmia Database
The original dataset and further information can be found here:
https://archive.ics.uci.edu/ml/datasets/Arrhythmia
Brief description
-----------------
This data contains 452 observations on 279 variables (206 linear valued
+ 73 nominal) on ECG readings. The data was collected to... | I2Cvb/data_balancing | src/data_conversion/datasets/arrhythmia.py | Python | mit | 6,789 | 0.001326 |
# 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 ... | lmazuel/azure-sdk-for-python | azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/__init__.py | Python | mit | 3,118 | 0 |
# -*- coding: utf-8 -*-
# Copyright 2017 GIG Technology NV
#
# 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... | rogerthat-platform/rogerthat-backend | src/rogerthat/models/properties/news.py | Python | apache-2.0 | 14,083 | 0.001562 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2015 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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... | iohannez/gnuradio | gr-analog/python/analog/qa_random_uniform_source.py | Python | gpl-3.0 | 2,736 | 0 |
"""
Module containing all the individual algorithms.
It would be possible to use alternative implementations
"""
import numpy as np
import theano
from theano import tensor as T
from theano.tensor import nlinalg
class algorithms_numpy():
"""
The algorithms implemented in numpy.
This should be the base cla... | ANickerson/kilosort-py | src/algorithms.py | Python | gpl-2.0 | 10,332 | 0.012195 |
def bar():
print('bar!')
| hugollm/foster | tests/frames/build/foobar/bar/bar.py | Python | mit | 29 | 0 |
#!/usr/bin/python
#coding:utf-8
print 'start to load...'
import sys
name = 42
def func(): pass
class kclass : pass
print 'done loading.' | gensmusic/test | l/python/book/learning-python/c22/module3.py | Python | gpl-2.0 | 137 | 0.043796 |
import wx
from service.fit import Fit
import gui.mainFrame
from gui import globalEvents as GE
from .calc.fitRemoveBooster import FitRemoveBoosterCommand
class GuiRemoveBoosterCommand(wx.Command):
def __init__(self, fitID, position):
wx.Command.__init__(self, True, "")
self.mainFrame = gui.mainFra... | blitzmann/Pyfa | gui/fitCommands/guiRemoveBooster.py | Python | gpl-3.0 | 1,009 | 0.000991 |
import pypm
from bl.utils import getClock
from bl.debug import debug
__all__ = ['init', 'initialize', 'getInput', 'getOutput', 'printDeviceSummary',
'ClockSender', 'MidiDispatcher', 'FUNCTIONS', 'ChordHandler',
'MonitorHandler', 'NoteEventHandler']
class PypmWrapper:
"""
Simple wrapper... | djfroofy/beatlounge | bl/midi.py | Python | mit | 11,595 | 0.000172 |
class EnvironmentNotBootstrapped(Exception):
def __init__(self, environment):
self.environment = environment
def __str__(self):
return "environment %s is not bootstrapped" % self.environment
| markramm/jujulib | juju/exceptions.py | Python | lgpl-3.0 | 219 | 0 |
# Enthought library imports
from traits.api import HasTraits, Int, Bool
from kiva.trait_defs.api import KivaFont
from enable.colors import ColorTrait
class TextFieldStyle(HasTraits):
""" This class holds style settings for rendering an EnableTextField.
fixme: See docstring on EnableBoxStyle
"""
#... | tommy-u/enable | enable/text_field_style.py | Python | bsd-3-clause | 1,133 | 0.013239 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
[tests/stdlib/test_cd.py]
Test the cd command.
"""
import unittest
import os
import tempfile
from ergonomica import ergo
class TestCd(unittest.TestCase):
"""Tests the cd command."""
def test_cd(self):
"""
Tests the cd command.
"""
... | ergonomica/ergonomica | tests/stdlib/test_cd.py | Python | gpl-2.0 | 557 | 0.003591 |
"""Django admin interface for the shopping cart models. """
from django.contrib import admin
from shoppingcart.models import (
Coupon,
CourseRegistrationCodeInvoiceItem,
DonationConfiguration,
Invoice,
InvoiceTransaction,
PaidCourseRegistrationAnnotation
)
class SoftDeleteCouponAdmin(admin.Mo... | ahmedaljazzar/edx-platform | lms/djangoapps/shoppingcart/admin.py | Python | agpl-3.0 | 5,178 | 0.000386 |
'''
This module searches the shodan data for IPs using a user-specified https certificate
'''
from common import helpers
class Analytics:
def __init__(self, cli_options):
self.cli_name = "CertSearch"
self.description = "Searches for user-provided HTTPS certificate"
self.https_cert = ''
... | ChrisTruncer/Just-Metadata | modules/analytics/cert_search.py | Python | gpl-3.0 | 1,648 | 0.003034 |
import sys
import numpy as np
import cv2
def main():
w, h = map(int, (sys.argv[1] if len(sys.argv) > 1 else '2048x1944').split('x'))
imgfile = sys.argv[2] if len(sys.argv) > 2 else r'D:\Downloads\example-navcam-imgs\navcamTests0619\rubbleML-def-14062019-25.raw'
imgout = sys.argv[3] if len(sys.ar... | oknuutti/visnav-py | visnav/iotools/read-raw-img.py | Python | mit | 811 | 0.006165 |
from .classification import Classification
from .ranking import Ranking
| faneshion/MatchZoo | matchzoo/tasks/__init__.py | Python | apache-2.0 | 72 | 0 |
from srqi.core import inquiry
import matplotlib.pyplot as plt
import numpy as np
def get_accumulation_fig(proc):
fig = plt.figure()
plt.title("Accumulation During Procedure for Patient " + str(proc.PatientID) + " on " + str(proc.StudyDate))
event_starts = [e.DateTime_Started for e in proc.get_events... | mcstrother/dicom-sr-qi | inquiries/high_cases.py | Python | bsd-2-clause | 7,573 | 0.010828 |
def _lsbStrToInt(str):
return ord(str[0]) + (ord(str[1]) << 8) + (ord(str[2]) << 16) + (ord(str[3]) << 24)
| mancoast/pycdc | tests/22_test_expressions.ref.py | Python | gpl-3.0 | 119 | 0.016807 |
"""
base IPOL demo web app
includes interaction and rendering
"""
# TODO add steps (cf amazon cart)
import shutil
from mako.lookup import TemplateLookup
import traceback
import cherrypy
import os.path
import math
import copy
import threading
import time
from mako.exceptions import RichTraceback
from . import http
fr... | kerautret/ipolDevel | ipol_demo/lib/base_app.py | Python | gpl-3.0 | 27,462 | 0.003459 |
import random
import numpy as np
import tensorflow as tf
from language_model import LM
from hparams import HParams
def get_test_hparams():
return HParams(
batch_size=21,
num_steps=12,
num_shards=2,
num_layers=1,
learning_rate=0.2,
max_grad_norm=1.0,
vocab_s... | okuchaiev/f-lm | language_model_test.py | Python | mit | 1,667 | 0.0006 |
from flask import render_template
from . import auth
@auth.app_errorhandler(403)
def page_not_found(e):
return render_template('403.html'), 403
@auth.app_errorhandler(404)
def page_not_found(e):
return render_template('404.html'), 404
@auth.app_errorhandler(500)
def internal_server_error(e):
return rend... | Leon109/IDCMS-Web | web/app/auth/errors.py | Python | apache-2.0 | 349 | 0.011461 |
#!/usr/bin/env python
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
from twisted.internet.protocol import DatagramProtocol
from twisted.internet import reactor
# Here's a UDP version of the simplest possible protocol
class EchoUDP(DatagramProtocol):
def datagramReceived(self, ... | dungeonsnd/test-code | dev_examples/twisted_test/other_echo/echoserv_udp.py | Python | gpl-3.0 | 510 | 0.009804 |
import unittest2
from unittest2 import TestCase
from rational.rational import gcd
from rational.rational import Rational
__author__ = 'Daniel Dinu'
class TestRational(TestCase):
def setUp(self):
self.known_values = [(1, 2, 1, 2),
(-1, 2, -1, 2),
... | daniel-dinu/rational-python | test_rational/test_rational.py | Python | mit | 32,468 | 0.001016 |
# Copyright (c) 2020 Bartosz Szczesny <bszcz@bszcz.org>
# This program is free software under the MIT license.
print('\n# avoid new line at the beginning')
s = """\
test
"""
print(s)
print('\n# string are immutable')
s = 'string'
try:
s[1] = 'p'
except TypeError as e:
print(e)
print('\n# enumerate() functi... | bszcz/python | tutorial_notes.py | Python | mit | 4,575 | 0.007213 |
# coding: utf-8
from setuptools import setup, find_packages
setup(
name='tc_librato',
version="0.0.1",
description='Thumbor Librato extensions',
author='Peter Schröder, Sebastian Eichner',
author_email='peter.schroeder@jimdo.com, sebastian.eichner@jimdo.com',
zip_safe=False,
include_packag... | thumbor-community/librato | setup.py | Python | mit | 441 | 0 |
# coding=utf-8
from django import http
from django.conf import settings
from django.contrib.auth import authenticate
from django.utils.cache import patch_vary_headers
from registry.exceptions import RegistryException
__author__ = 'pivstone'
class CustomHeaderMiddleware(object):
"""
增加自定头
"""
def pro... | pivstone/andromeda | registry/middleware.py | Python | mit | 797 | 0.00129 |
import os
import sys
import signal
import time
import subprocess
WHO = None
def handler(signum, frame):
global WHO
print('Signal handler', signum, WHO, frame)
print('Disable handler', signum, WHO, frame)
signal.signal(signal.SIGINT, signal.SIG_DFL)
def main(argv):
global WHO
WHO = argv[1]
... | munhyunsu/Hobby | Signal/signal_propagation_shell.py | Python | gpl-3.0 | 819 | 0.003663 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2018-12-14 12:23
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('comissoes', '0018_auto_20180924_1724'),
]
operations = [
migrations.AlterFi... | cmjatai/cmj | sapl/comissoes/migrations/0019_auto_20181214_1023.py | Python | gpl-3.0 | 509 | 0.001972 |
# Exceptions used throughout feedparser
# Copyright 2010-2021 Kurt McKee <contactme@kurtmckee.org>
# Copyright 2002-2008 Mark Pilgrim
# All rights reserved.
#
# This file is a part of feedparser.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the follo... | rembo10/headphones | lib/feedparser/exceptions.py | Python | gpl-3.0 | 1,957 | 0.000511 |
# -*- coding: utf-8 -*-
iface = None
| mhugent/Quantum-GIS | python/plugins/processing/interface.py | Python | gpl-2.0 | 38 | 0 |
# -*- coding: 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 'Flash'
db.create_table('cmsplugin_flash', (
('cmsplugin_ptr', self.gf('django.db... | mpetyx/palmdrop | venv/lib/python2.7/site-packages/cms/plugins/flash/migrations/0001_initial.py | Python | apache-2.0 | 3,244 | 0.008323 |
#!/usr/bin/python
#
# linearize.py: Construct a linear, no-fork, best version of the blockchain.
#
#
# Copyright (c) 2013 The Carboncoin developers
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
import json
import struct
i... | carboncointrust/CarboncoinCore | contrib/linearize/linearize.py | Python | mit | 3,360 | 0.034226 |
# -*- coding: utf-8 -*-
# import python libs
import os
from array import array
# import pure_pynacl libs
from saltchannel.saltlib.pure_pynacl import lt_py3, lt_py33
from saltchannel.saltlib.pure_pynacl import TypeEnum, integer, Int, IntArray
class u8(Int):
'''unsigned char'''
bits = array('B').itemsize*8
... | assaabloy-ppi/salt-channel-python | saltchannel/saltlib/pure_pynacl/tweetnacl.py | Python | mit | 25,273 | 0.005342 |
import numpy as np
class AutoParameterModel():
"""Model to hold all the necessary information to generate
auto-tests, where parameters of components are systematically
manipulated
"""
def __init__(self):
self._parameters = []
def nrows(self):
"""The number of auto-parameters
... | Joel-U/sparkle | sparkle/stim/auto_parameter_model.py | Python | gpl-3.0 | 15,413 | 0.002336 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('Alarma', '0004_auto_20151025_0206'),
]
operations = [
migrations.CreateModel(
name='DjkombuMessage',
... | Oriphiel/Python | AlarmaTecno/Alarma/migrations/0005_djkombumessage_djkombuqueue.py | Python | apache-2.0 | 1,116 | 0 |
# -*- coding: utf-8 -*-
'''
Subtitles.gr Addon
Author Twilight0
SPDX-License-Identifier: GPL-3.0-only
See LICENSES/GPL-3.0-only for more information.
'''
import re, unicodedata
from shutil import copy
from os.path import splitext, exists, split as os_split
from resources.lib import subtitlesgr, xsubs... | Twilight0/service.subtitles.subtitles.gr | resources/lib/addon.py | Python | gpl-3.0 | 12,802 | 0.002812 |
#!/usr/bin/python
__version__='0.2.1'
import argparse
import logging
import os
import os.path
import sys
import requests
import getpass
import ConfigParser
def _persist( export, rcfile ):
f = open( rcfile, 'w' )
logging.debug( "writing to {}".format( rcfile ) )
f.write( "\n".join( export ) )
f.close(... | FredHutch/swift-switch-account | sw2account/sw2account.py | Python | apache-2.0 | 11,887 | 0.025742 |
import numpy as np
from . import finiteelements as fe
from . import matrices
from math import cos
class Result:
def __init__(self):
pass
def __init__(self, freq, u1, u2, u3, mesh, geometry):
self.freq = freq
self.u1 = u1
self.u2 = u2
self.u3 = u3
self.mesh ... | tarashor/vibrations | py/fem/result.py | Python | mit | 2,014 | 0.004965 |
#!/usr/bin/env python
# Copyright (C) 2006-2016 Music Technology Group - Universitat Pompeu Fabra
#
# This file is part of Essentia
#
# Essentia is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation ... | arseneyr/essentia | test/src/unittest/spectral/test_hpcp.py | Python | agpl-3.0 | 7,101 | 0.021405 |
required_states = ['accept', 'reject', 'init']
class TuringMachine(object):
def __init__(self, sigma, gamma, delta):
self.sigma = sigma
self.gamma = gamma
self.delta = delta
self.state = None
self.tape = None
self.head_position = None
return
... | ssanderson/turing.py | turing.py | Python | mit | 2,182 | 0.007333 |
#!/usr/bin/python3
# Copyright (c) 2016-2021 Dell Inc. or its subsidiaries.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | dsp-jetpack/JetPack | src/pilot/control_overcloud.py | Python | apache-2.0 | 1,930 | 0 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from kombu.async.http.curl import READ, WRITE, CurlClient
from kombu.tests.case import (
HubCase, Mock, call, patch, case_requires, set_module_symbol,
)
@case_requires('pycurl')
class test_CurlClient(HubCase):
class Client(CurlClient):
... | rhcarvalho/kombu | kombu/tests/async/http/test_curl.py | Python | bsd-3-clause | 5,102 | 0.000196 |
# -*- coding: utf-8 -*-
"""\
This is a python port of "Goose" orignialy licensed to Gravity.com
under one or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.
Python port was written by Xavier Grangier for Recrutae
Gravity.co... | rsinger86/goose-extractor | goose/article.py | Python | apache-2.0 | 4,751 | 0.00021 |
###
# Copyright 2011 Diamond Light Source Ltd.
#
# 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 l... | erwindl0/python-rpc | org.eclipse.triquetrum.python.service/scripts/scisoftpy/plot.py | Python | epl-1.0 | 26,232 | 0.006023 |
from __future__ import print_function
import os
import sys
import fnmatch
import mmap
def clean_files(path,pattern):
all_files = os.listdir(path)
filtered = fnmatch.filter(all_files,pattern+"*")
for element in filtered:
os.remove(os.path.join(path,element))
def find_files(path,target):
matche... | burbanom/python-utils | file_utils.py | Python | gpl-3.0 | 1,260 | 0.00873 |
import serial
import time
ser = serial.Serial(
port = "/dev/ttyACM0",
baudrate = 9600,
bytesize = serial.EIGHTBITS
)
time.sleep(2)
ser.write("\x36\x20\x00")
print(hex(ord(ser.read(1))))
print(hex(ord(ser.read(1))))
print(hex(ord(ser.read(1))))
print(hex(ord(ser.read(1))))
print(hex(o... | DelusionalLogic/TAS-100 | python/test.py | Python | gpl-3.0 | 571 | 0.010508 |
# -*- coding: utf-8 -*-
'''
Exodus Add-on
Copyright (C) 2016 Exodus
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 l... | repotvsupertuga/repo | plugin.video.exodus/resources/lib/sources/newlinks_mv.py | Python | gpl-2.0 | 4,985 | 0.016048 |
"""replace.py
Tool for replacing variable names in Damon.
Copyright (c) 2009 - 2011, Mark H. Moulton for Pythias Consulting, LLC.
Purpose: This tool was developed to replace CamelCase argument
variables with all lower case equivalents across all Damon modules.
It is being retained because it is readily adaptable to ... | Sohojoe/damon | damon1/replace_it.py | Python | apache-2.0 | 14,439 | 0.019046 |
"""manager.py: Flask-Script launcher for services
using https://github.com/yabb85/ueki as prototype
"""
from os import path
from flask_script import Manager, Server
from publicAPI import create_app
import prosper.common.prosper_logging as p_logging
import prosper.common.prosper_config as p_config
HERE = path.abspa... | EVEprosper/ProsperAPI | scripts/manager.py | Python | mit | 850 | 0.001176 |
#!/usr/local/bin/python3
"""
Copyright (c) 2015-2019 Ad Schellevis <ad@opnsense.org>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain th... | opnsense/core | src/opnsense/scripts/filter/list_tables.py | Python | bsd-2-clause | 1,992 | 0.000502 |
# check that we can do certain things without allocating heap memory
import gc
def f1(a):
print(a)
def f2(a, b=2):
print(a, b)
def f3(a, b, c, d):
x1 = x2 = a
x3 = x4 = b
x5 = x6 = c
x7 = x8 = d
print(x1, x3, x5, x7, x2 + x4 + x6 + x8)
global_var = 1
def test():
global global_var
... | suda/micropython | tests/micropython/heapalloc.py | Python | mit | 891 | 0.007856 |
# Copyright 2010 OpenStack Foundation
# Copyright 2012 University Of Minho
#
# 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.... | HybridF5/jacket | jacket/tests/compute/unit/virt/libvirt/volume/test_volume.py | Python | apache-2.0 | 11,446 | 0 |
# This file is part of Static Sauce <http://github.com/jdufresne/staticsauce>.
#
# 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 ... | jdufresne/staticsauce | staticsauce/commands/build.py | Python | gpl-3.0 | 3,466 | 0 |
import os
from setuptools import find_packages
from setuptools import setup
version = '1.0'
project = 'kotti_mb'
install_requires=[
'Kotti',
],
here = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(here, 'README.rst')).read()
CHANGES = open(os.path.join(here, 'CHANGES.txt')).read(... | potzenheimer/kotti_mb | setup.py | Python | mit | 1,275 | 0.000784 |
# This file is part of Indico.
# Copyright (C) 2002 - 2019 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 __future__ import unicode_literals
def serialize_ip_network_group(group):
"""Serialize group to... | mvidalgarcia/indico | indico/modules/networks/util.py | Python | mit | 506 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from collections import deque
import SokoMove
import Helper as hlp
class SokoGoodFloors():
# Interface:
# findGoodFloors() -> good-floor-List
def __init__(self, pgs, pgdp, zfl, pp):
self.pgs=pgs
self.pgdp=pgdp
self.zfl=zfl
self.pp=pp
self.bf=[]... | dede67/sokoban | SokoGoodFloors.py | Python | gpl-3.0 | 5,693 | 0.026464 |
# -*- coding: utf-8 -*-
# Copyright (c) 2004 - 2015 Detlev Offenbach <detlev@die-offenbachs.de>
#
"""
Module implementing templates for the documentation generator (lists style).
"""
from __future__ import unicode_literals
#################################################
## Common templates for index and docu fil... | testmana2/test | DocumentationTools/TemplatesListsStyle.py | Python | gpl-3.0 | 7,017 | 0.00456 |
# Copyright 2019 Verily Life Sciences 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 appli... | verilylifesciences/analysis-py-utils | verily/query_kit/__init__.py | Python | apache-2.0 | 637 | 0 |
# -*- coding:utf-8 -*-
import mock
import pytest
import libpy
import libpy.shadow
class TestShadow(object):
def test(self):
proxy = libpy.shadow.Shadow(ShadowTarget())
assert isinstance(proxy, libpy.shadow.Shadow)
assert proxy.a == mock.sentinel.proxy_target_a
assert proxy.b == ... | surabujin/libpy | libpy/test/test_shadow.py | Python | mit | 1,664 | 0 |
#!/usr/bin/env python
# File created on 27 Sep 2011
from __future__ import division
__author__ = "Antonio Gonzalez Pena"
__copyright__ = "Copyright 2011, The QIIME Project"
__credits__ = [
"Antonio Gonzalez Pena",
"Andrew J. King",
"Michael S. Robeson",
]
__license__ = "GPL"
__version__ = "1.9.1-dev"
__mai... | zachcp/qiime | tests/test_distance_matrix_from_mapping.py | Python | gpl-2.0 | 8,329 | 0.002641 |
from django.utils.unittest.case import TestCase
from scheduler.models import ScheduleGenerator
from uni_info.models import Semester, Course
class ScheduleGeneratorTest(TestCase):
"""
Test class for schedule generator, try different courses
"""
fixtures = ['/scheduler/fixtures/initial_data.json']
... | squarebracket/star | scheduler/tests/schedule_generator_tests.py | Python | gpl-2.0 | 3,829 | 0.000522 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
import urls
from apps.blog import views
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'gigsblog.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
# url(r'^admin/', include(admin.site.urls)),
... | gusaul/gigsblog | urls/main.py | Python | mit | 683 | 0.011713 |
#!/usr/bin/env python3
#
# mmgen = Multi-Mode GENerator, a command-line cryptocurrency wallet
# Copyright (C)2013-2022 The MMGen Project <mmgen@tuta.io>
# Licensed under the GNU General Public License, Version 3:
# https://www.gnu.org/licenses
# Public project repositories:
# https://github.com/mmgen/mmgen
# http... | mmgen/mmgen | mmgen/wallet/brain.py | Python | gpl-3.0 | 1,905 | 0.026247 |
#!/usr/bin/python
#
# 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 b... | wubr2000/googleads-python-lib | examples/dfa/v1_20/create_campaign.py | Python | apache-2.0 | 2,699 | 0.004817 |
#!/usr/bin/env python
# B a r a K u d a
#
# L. Brodeau, 2017]
import sys
import numpy as nmp
from PIL import Image
import string
import os
from netCDF4 import Dataset
narg = len(sys.argv)
if narg != 2:
print 'Usage: '+sys.argv[0]+' <mesh_mask>'; sys.exit(0)
cf_mm = sys.argv[1]
cf_bmp = string.repl... | brodeau/barakuda | python/exec/orca_mesh_mask_to_bitmap.py | Python | gpl-2.0 | 842 | 0.011876 |
# -*- coding: utf-8 -*-
'''
Created on Mar 12, 2012
@author: moloch
Copyright 2012
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... | lunarca/fngrpt | models/BaseModels.py | Python | apache-2.0 | 1,637 | 0.001833 |
#!/usr/bin/env python
#
# Copyright (C) 2012 Strahinja Val Markovic <val@markovic.io>
#
# This file is part of MatchTagAlways.
#
# MatchTagAlways 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... | vim-IDE/MatchTagAlways | python/mta_core.py | Python | gpl-3.0 | 8,519 | 0.024416 |
from pymongo import MongoClient
from pymongo.collection import Collection
from pymongo.errors import AutoReconnect
from django.conf import settings
from types import FunctionType
import functools
import time
__all__ = ("connection", "connections", "db", "get_db")
"""
Goals:
* To provide a clean universal handler fo... | lang-uk/lang.org.ua | languk/corpus/mongodb.py | Python | mit | 4,932 | 0.002636 |
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2006-2010 (ita)
"""
Support for the KDE4 libraries and msgfmt
"""
import os, sys, re
from waflib import Options, TaskGen, Task, Utils
from waflib.TaskGen import feature, after_method
@feature('msgfmt')
def apply_msgfmt(self):
"""
Process all languages to creat... | tommo/gii | support/waf/waflib/Tools/kde4.py | Python | mit | 2,732 | 0.031845 |
"""
This is a comment
"""
#try: # this part to import as part of the DIRAC framework
import xml.sax
from xml.sax.handler import ContentHandler
from DIRAC.Core.Workflow.Parameter import *
from DIRAC.Core.Workflow.Module import *
from DIRAC.Core.Workflow.Step import *
from DIRAC.Core.Workflow.Workflow import Workf... | andresailer/DIRAC | Core/Workflow/WorkflowReader.py | Python | gpl-3.0 | 4,858 | 0.01832 |
#encoding:utf-8
subreddit = 'getmotivated'
t_channel = '@r_getmotivated'
def send_post(submission, r2t):
return r2t.send_simple(submission)
| Fillll/reddit2telegram | reddit2telegram/channels/~inactive/r_getmotivated/app.py | Python | mit | 147 | 0.006803 |
import unittest
from contextlib import contextmanager
from StringIO import StringIO
from rulekey_diff2 import *
@contextmanager
def captured_output():
new_out, new_err = StringIO(), StringIO()
old_out, old_err = sys.stdout, sys.stderr
try:
sys.stdout, sys.stderr = new_out, new_err
yield s... | LegNeato/buck | scripts/rulekey_diff2_test.py | Python | apache-2.0 | 11,981 | 0.001335 |
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry.page import page as page_module
from telemetry.page import page_set as page_set_module
class PathologicalMobileSitesPage(page_module.Page):
... | sgraham/nope | tools/perf/page_sets/pathological_mobile_sites.py | Python | bsd-3-clause | 1,806 | 0.002769 |
import os
import shutil
import logging
import tarfile
import tempfile
import subprocess
from threading import Thread
class TarToWebmCompressor(object):
@staticmethod
def compress(filename):
thread = Thread(target=TarToWebmCompressor._compress, args=(filename,))
thread.start()
@staticmetho... | thekot/cam_to_webm | modules/tar_to_webm_compressor.py | Python | mit | 2,578 | 0.003491 |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'Lunzhy'
import sys
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from pyshanbay.shanbay import VisitShanbay
from pyshanbay import page_parser as parser
from gui.ui_main import UIMainWidget
class MainForm(QWidget):
def __init__(self):
s... | lunzhy/PyShanbay | tests/ui_test.py | Python | mit | 2,044 | 0.000978 |
from typing import List
import click
from valohai.internals.pipeline import get_pipeline_from_source
from valohai.yaml import config_to_yaml
from valohai_yaml.objs.config import Config
from valohai_cli.ctx import get_project
from valohai_cli.exceptions import ConfigurationError
from valohai_cli.messages import error,... | valohai/valohai-cli | valohai_cli/commands/yaml/pipeline.py | Python | mit | 2,212 | 0.000452 |
import os
from pip.backwardcompat import urllib
from tests.lib.path import Path
from pip.index import package_to_requirement, HTMLPage
from pip.index import PackageFinder, Link, INSTALLED_VERSION
from tests.lib import path_to_url
from string import ascii_lowercase
from mock import patch
def test_package_name_should_b... | alquerci/pip | tests/unit/test_index.py | Python | mit | 1,950 | 0.001538 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# This file is part of box-linux-sync.
#
# Copyright (C) 2013 Vítor Brandão <noisebleed@noiselabs.org>
#
# box-linux-sync 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... | noiselabs/box-linux-sync | src/noiselabs/box/output.py | Python | lgpl-3.0 | 6,736 | 0.011435 |
"""Test config validators."""
from datetime import date, datetime, timedelta
import enum
import os
from socket import _GLOBAL_DEFAULT_TIMEOUT
from unittest.mock import Mock, patch
import uuid
import pytest
import voluptuous as vol
import homeassistant
import homeassistant.helpers.config_validation as cv
def test_bo... | joopert/home-assistant | tests/helpers/test_config_validation.py | Python | apache-2.0 | 26,925 | 0.000409 |
from __future__ import division
import numpy as np
from fatiando.gravmag.euler import Classic, ExpandingWindow, MovingWindow
from fatiando.gravmag import sphere, fourier
from fatiando.mesher import Sphere
from fatiando import utils, gridder
model = None
xp, yp, zp = None, None, None
inc, dec = None, None
struct_ind = ... | seancug/python-example | fatiando-0.2/test/test_gravmag_euler.py | Python | gpl-2.0 | 2,686 | 0.004468 |
#!/usr/bin/env python
import os, sys
try:
from Tkinter import *
except:
sys.stderr.write('Please install Tkinter!\n\n')
sys.exit(1)
root = Tk()
root.title('Wavelet Demo')
wtype = StringVar()
wtype.set('b')
type_frame = Frame(root,relief=SUNKEN,borderwidth=2)
type_frame.pack(side=TOP,fill=X)
Label(type_... | zxtstarry/src | book/rsf/rsf/gui/gui.py | Python | gpl-2.0 | 1,270 | 0.028346 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.