commit stringlengths 40 40 | subject stringlengths 4 1.73k | repos stringlengths 5 127k | old_file stringlengths 2 751 | new_file stringlengths 2 751 | new_contents stringlengths 1 8.98k | old_contents stringlengths 0 6.59k | license stringclasses 13
values | lang stringclasses 23
values |
|---|---|---|---|---|---|---|---|---|
836b524ada89976723779497038e220758ec8b70 | Update OrthoVSPerspective.py | mashrin/processing.py,jdf/processing.py,tildebyte/processing.py,mashrin/processing.py,jdf/processing.py,tildebyte/processing.py,tildebyte/processing.py,mashrin/processing.py,jdf/processing.py | examples.py/3D/Camera/OrthoVSPerspective.py | examples.py/3D/Camera/OrthoVSPerspective.py | """
Ortho vs Perspective.
Click to see the difference between orthographic projection
and perspective projection as applied to a simple box.
The ortho() function sets an orthographic projection and
defines a parallel clipping volume. All objects with the
same dimension appear to be the same size, regardless of whether... | """
* Ortho vs Perspective.
*
* Click to see the difference between orthographic projection
* and perspective projection as applied to a simple box.
* The ortho() function sets an orthographic projection and
* defines a parallel clipping volume. All objects with the
* same dimension appear the same size, regardl... | apache-2.0 | Python |
397e7f2f7bb4e69a3432b9bf7a3feabe779733f0 | add osd_recovery task to test divergent osd logs | zhouyuan/teuthology,SUSE/teuthology,dmick/teuthology,robbat2/teuthology,caibo2014/teuthology,tchaikov/teuthology,ceph/teuthology,dmick/teuthology,ktdreyer/teuthology,ceph/teuthology,yghannam/teuthology,michaelsevilla/teuthology,SUSE/teuthology,dreamhost/teuthology,t-miyamae/teuthology,caibo2014/teuthology,ktdreyer/teut... | teuthology/task/osd_recovery.py | teuthology/task/osd_recovery.py | import logging
import ceph_manager
import time
from teuthology import misc as teuthology
log = logging.getLogger(__name__)
def rados_start(remote, cmd):
log.info("rados %s" % ' '.join(cmd))
pre = [
'LD_LIBRARY_PATH=/tmp/cephtest/binary/usr/local/lib',
'/tmp/cephtest/enable-coredump',
... | mit | Python | |
42cc7b5c68282170374148697725aa8d8c131f77 | add script to measure boot time | christoff-buerger/reat,christoff-buerger/reat,2bt/haec,2bt/haec,2bt/haec,christoff-buerger/reat,2bt/haec,2bt/haec,christoff-buerger/reat,christoff-buerger/reat | communication/measure.py | communication/measure.py | #!/usr/bin/env python
import sys, os, time, socket, select, serial
# args: 192.168.1.21 2001
def get_tty_name(c):
if c == 0:
if os.path.exists("/sys/devices/platform/sw-ohci.1/usb2/2-1/2-1:1.0/ttyUSB0"):
return "/dev/ttyUSB0"
if os.path.exists("/sys/devices/platform/sw-ohci.1/usb2/2-1/2-1:1.0/ttyUSB1"):
... | mit | Python | |
cf160d8259fb98ef4003283063529be8c4c087fb | Add a script to compile all binary modules in test data directory | allotria/intellij-community,allotria/intellij-community,allotria/intellij-community,allotria/intellij-community,allotria/intellij-community,allotria/intellij-community,allotria/intellij-community,allotria/intellij-community,allotria/intellij-community,allotria/intellij-community,allotria/intellij-community,allotria/int... | python/helpers/pycharm_generator_utils/test/data/SkeletonCaching/binaries/compile_binaries.py | python/helpers/pycharm_generator_utils/test/data/SkeletonCaching/binaries/compile_binaries.py | import os
from Cython.Build.Cythonize import main as cythonize
_binaries_dir = os.path.dirname(os.path.abspath(__file__))
_cythonize_options = ['--inplace']
def main():
for dir_path, _, file_names in os.walk(_binaries_dir):
for file_name in file_names:
mod_name, ext = os.path.splitext(file_n... | apache-2.0 | Python | |
2c3bad9f97f171aa169f7593372eaa8ec766a64d | Create test.py | wannaphongcom/code-python3-blog | module/plue/test.py | module/plue/test.py | __author__ = 'วรรณพงษ์'
import firstmod
print (firstmod.cal1(5,6))
| mit | Python | |
671505729484d04b692bec523089c02825df4876 | Add a mapper function to convert old survey schema to the new schema. | rhyolight/nupic.son,rhyolight/nupic.son,rhyolight/nupic.son | app/soc/mapreduce/convert_survey_schema.py | app/soc/mapreduce/convert_survey_schema.py | #!/usr/bin/python2.5
#
# Copyright 2011 the Melange authors.
#
# 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... | apache-2.0 | Python | |
2c1689b1e27d224307af26764c2105be006eb0fb | Add tests (final) | Nakrez/RePy,Nakrez/RePy | tests/final/input/hello.py | tests/final/input/hello.py | def hello(name):
print("Hello", name)
hello("Repy")
hello("Baptiste")
hello("John")
| mit | Python | |
237a7a8e8ca8166c2b3a638431d73b0d130e17db | add .list() to metaclasses | jck/pymtl,jck/pymtl,jjffryan/pymtl,Glyfina-Fernando/pymtl,cfelton/pymtl,12yujim/pymtl,12yujim/pymtl,jjffryan/pymtl,cfelton/pymtl,Glyfina-Fernando/pymtl,cornell-brg/pymtl,Glyfina-Fernando/pymtl,jck/pymtl,cornell-brg/pymtl,tj93/pymtl,tj93/pymtl,tj93/pymtl,cornell-brg/pymtl,12yujim/pymtl,jjffryan/pymtl,cfelton/pymtl | new_pymtl/metaclasses.py | new_pymtl/metaclasses.py | #=========================================================================
# metaclasses.py
#=========================================================================
# Collection of metaclasses to implement python magic.
#
#=========================================================================
# __metaclass__
#===... | #=========================================================================
# metaclasses.py
#=========================================================================
# Collection of metaclasses to implement python magic.
#
#=========================================================================
# __metaclass__
#===... | bsd-3-clause | Python |
24a8bc430426fd4ca4abfaa39be82e8453458b73 | Add xml_addon (addons/res2dict) | tadashi-aikawa/gemini | addons/res2dict/xml_addon/__init__.py | addons/res2dict/xml_addon/__init__.py | # -*- coding:utf-8 -*-
import xmltodict
from typing import Optional
from owlmixin import OwlMixin
from modules.models import Res2DictAddOnPayload
class Config(OwlMixin):
def __init__(self, force=False, force_encoding=None):
self.force: bool = force
self.force_encoding: Optional[str] = force_encod... | mit | Python | |
0e0bcb12b535fca79399b1bc6ebaf33392f95eb7 | Revert "Delete search_sites.py" | rustymyers/OpenEats,rustymyers/OpenEats,RyanNoelk/OpenEats,RyanNoelk/OpenEats,rustymyers/OpenEats,RyanNoelk/OpenEats,RyanNoelk/OpenEats,rustymyers/OpenEats | search_sites.py | search_sites.py | import haystack
haystack.autodiscover() | mit | Python | |
1871c38f407f26940304fa0e130307fa6149efe2 | add a dynamic module for example #11 #12 | Sixdsn/CppAnalyzer | services/six.py | services/six.py | def init():
return { "six": [ echo, " [Message]\t=> Print Message" ]}
def echo(mess):
print("Six: %s"% mess)
| mpl-2.0 | Python | |
5141bc83aadfd0b7ada0fba04d20264b30fb9872 | upgrade for sponsors | biviosoftware/publicprize,biviosoftware/publicprize,biviosoftware/publicprize | next-up-sponsors.py | next-up-sponsors.py | #!/usr/bin/env python
for x in [
{
"display_name": "Bivio Software",
"website": "http://www.bivio.biz",
"logo_filename": "data/bdsc/bivio.gif"
},
{
"display_name": "Market Creation Group",
"website": "http://marketcreationgroup.com",
"logo_filename": "data/bdsc/mcg.gif"
... | apache-2.0 | Python | |
195a43c622a4f729de9e4b0229c46072ee164e81 | Add support for SASS/SCSS | jreese/nib | nib/plugins/sass.py | nib/plugins/sass.py | from __future__ import absolute_import, division, print_function, unicode_literals
from os import path
import sh
from nib import Processor, resource
@resource(['.sass', '.scss'])
class SassProcessor(Processor):
def resource(self, resource):
filepath = path.join(self.options['resource_path'],
... | mit | Python | |
8f95430f5f79de7d5d6df959e4e80d3b19d11ab6 | Add simple smoke tests | kennethreitz/legit,kennethreitz/legit | legit/tests/test_commands.py | legit/tests/test_commands.py | from click.testing import CliRunner
import pytest
from legit.cli import cli
from legit.core import __version__
class TestLegit(object):
@pytest.mark.cli
def test_cli(self):
runner = CliRunner()
result = runner.invoke(cli, ['--version'])
assert result.exit_code == 0
assert __ve... | bsd-3-clause | Python | |
d2ef9598224409e17cc360481e2044bff7ffe50b | add local cmd interface to Thorium | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/thorium/local.py | salt/thorium/local.py | '''
Run remote execution commands via the local client
'''
# Import python libs
# Import salt libs
import salt.client
def cmd(
name,
tgt,
fun,
arg=(),
tgt_type='glob',
ret='',
kwargs=None,
**kwargs):
'''
Execute a remote execution command
'... | apache-2.0 | Python | |
2c74662e579318add0becc9fd9a3d280b1473a4b | Add skeleton statistics script | jni/useful-histories | malaria-skeleton.py | malaria-skeleton.py | # IPython log file
import os
import matplotlib.pyplot as plt
import pandas as pd
import re # regular expressions, for text matching
import seaborn.apionly as sns
data = pd.read_excel('/Users/jni/Dropbox/data1/malaria/adam-oli-schizont-30sec-output/skeleton.xlsx')
def infection_status(filename):
if 'Uninf' in fil... | bsd-3-clause | Python | |
c33ea1bf48f345f2f6152bd7485f35566791dfed | Create profile.py | repopreeth/trep | profile.py | profile.py | import tweepy
import access
auth = tweepy.OAuthHandler(access.consumer_key, access.consumer_secret)
auth.set_access_token(access.access_token, access.access_token_secret)
class Profile:
def __init__(self, user):
self.user = user
def getTweets(self):
twitter = tweepy.API(auth)
user... | apache-2.0 | Python | |
42d55472bebad110cc1b2065694f0628a67978c1 | Create print-error-thai.py | wannaphongcom/code-python3-blog | nlp/print-error-thai.py | nlp/print-error-thai.py | # เขียนโดย วรรณพงษ์ ภัททิยไพบูลย์
# https://python3.wannaphong.com/2016/07/ทำ-nlp-ในภาษา-python-แก้ไขการลืม.html
dictdata={'Z':'(','z':'ผ','X':')','x':'ป','C':'ฉ','c':'แ','V':'ฮ','v':'อ','B':'ฺ','b':'ิ','N':'์','n':'ื','M':'?','m':'ท','<':'ฒ',',':'ม','>':'ฬ','.':'ใ','?':'ฦ','/':'ฝ',
'A':'ฤ','a':'ฟ','S':'ฆ','s':'ห','D'... | mit | Python | |
bd821c88158db0a992be985b1e251a3722da12bd | add find cycles | joequant/cycle-detector,joequant/cycle-detector,joequant/cycle-detector,joequant/cycle-detector | find-cycles.py | find-cycles.py | #!/usr/bin/python3
graph = [[1, 2], [1, 3], [1, 4], [2, 3], [3, 4], [2, 6], [4, 6], [8, 7], [8, 9], [9, 7]]
cycles = []
def main():
global graph
global cycles
for edge in graph:
for node in edge:
findNewCycles([node])
for cy in cycles:
path = [str(node) for node in cy]
... | bsd-2-clause | Python | |
e4efa5a447e85c11723991870bd6fc632bc97ed5 | Add template tag to render ``markdown``. | us-ignite/us_ignite,us-ignite/us_ignite,us-ignite/us_ignite,us-ignite/us_ignite,us-ignite/us_ignite | us_ignite/common/templatetags/common_markdown.py | us_ignite/common/templatetags/common_markdown.py | from django import template
from django.template.defaultfilters import stringfilter
from django.utils.safestring import mark_safe
from us_ignite.common import output
register = template.Library()
@register.filter(is_safe=True)
@stringfilter
def markdown(value):
return mark_safe(output.to_html(value))
| bsd-3-clause | Python | |
2bc5516a956fc9fac8ad3a6699955d4ab276ad08 | add new package (#20398) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/cli11/package.py | var/spack/repos/builtin/packages/cli11/package.py | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Cli11(CMakePackage):
"""CLI11 is a command line parser for C++11 and beyond that provides ... | lgpl-2.1 | Python | |
a0a681bd08fd706241066fffe884470ee64663c7 | Create __init__.py | pertxas/OMSTD-lefito-dev | omstd_lefito/__init__.py | omstd_lefito/__init__.py | # -*- coding: utf-8 -*-
__author__ = 'pertxas - partxas<-at->gmail.com (@pertxas)'
| mit | Python | |
2cdc649d810e49c3879ec055741b1bdd909c55e0 | Add a command to rebuild the mptt tree. | mjl/feincms,matthiask/django-content-editor,michaelkuty/feincms,matthiask/feincms2-content,nickburlett/feincms,matthiask/feincms2-content,michaelkuty/feincms,joshuajonah/feincms,joshuajonah/feincms,hgrimelid/feincms,hgrimelid/feincms,michaelkuty/feincms,feincms/feincms,pjdelport/feincms,nickburlett/feincms,matthiask/dj... | feincms/management/commands/rebuild_mptt.py | feincms/management/commands/rebuild_mptt.py | # ------------------------------------------------------------------------
# coding=utf-8
# $Id$
# ------------------------------------------------------------------------
from django.core.management.base import NoArgsCommand
from django.db import transaction
from feincms.module.page.models import Page
class Command... | bsd-3-clause | Python | |
a0fee13c00829ba6fd9ecd6618858b83c5977aeb | Update TFRT dependency to use revision http://github.com/tensorflow/runtime/commit/af2213b972c9f736109d4249089c9398c09a8add. | Intel-tensorflow/tensorflow,Intel-tensorflow/tensorflow,tensorflow/tensorflow,tensorflow/tensorflow-pywrap_saved_model,tensorflow/tensorflow-pywrap_saved_model,Intel-tensorflow/tensorflow,karllessard/tensorflow,yongtang/tensorflow,karllessard/tensorflow,tensorflow/tensorflow,tensorflow/tensorflow-experimental_link_stat... | third_party/tf_runtime/workspace.bzl | third_party/tf_runtime/workspace.bzl | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "af2213b972c9f736109d4249089c9398c09a8add"
TFRT_SHA256 = "ce588cd5aa843316c6b759315cbc... | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "695811ce9834ba33fb9eb46f88e19267505f3899"
TFRT_SHA256 = "9039de550bce3d82473bed477399... | apache-2.0 | Python |
05d57bf489347ead9ee662d7ea06a1c268975ff3 | Update TFRT dependency to use revision http://github.com/tensorflow/runtime/commit/0d4e8381d86d506aa0ff5b959166832e6cb0c0a3. | tensorflow/tensorflow,Intel-tensorflow/tensorflow,Intel-tensorflow/tensorflow,tensorflow/tensorflow,karllessard/tensorflow,yongtang/tensorflow,tensorflow/tensorflow-pywrap_saved_model,paolodedios/tensorflow,paolodedios/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,paolodedios/tensorflow,tenso... | third_party/tf_runtime/workspace.bzl | third_party/tf_runtime/workspace.bzl | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "0d4e8381d86d506aa0ff5b959166832e6cb0c0a3"
TFRT_SHA256 = "407f75757f223ec793e1c0c62823... | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "4b3ad09f29c617c021e42c1c792972692acdbc16"
TFRT_SHA256 = "8fbb7c19c08131365c48421ac9ba... | apache-2.0 | Python |
4044c8012c30b19afafd4e8665005615c71248d3 | Update TFRT dependency to use revision http://github.com/tensorflow/runtime/commit/6eb182749cce0b0d8287822082deed40aaf5f8f7. | tensorflow/tensorflow-pywrap_saved_model,tensorflow/tensorflow,Intel-tensorflow/tensorflow,paolodedios/tensorflow,tensorflow/tensorflow-pywrap_saved_model,tensorflow/tensorflow,tensorflow/tensorflow,yongtang/tensorflow,Intel-tensorflow/tensorflow,tensorflow/tensorflow,tensorflow/tensorflow,paolodedios/tensorflow,tensor... | third_party/tf_runtime/workspace.bzl | third_party/tf_runtime/workspace.bzl | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "6eb182749cce0b0d8287822082deed40aaf5f8f7"
TFRT_SHA256 = "850d3b308261aa1f51c261f38f04... | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "16769f3b754ba51b4985b2e5e5c25485416d0bab"
TFRT_SHA256 = "d6dc101dec16f9471e583f829277... | apache-2.0 | Python |
3cda567ac1cae720a9fa1cdb0443f4e2e22bfd5d | Update TFRT dependency to use revision http://github.com/tensorflow/runtime/commit/5028c1289fbbf3133392036d6ad6ade6dae4ab0f. | tensorflow/tensorflow-pywrap_tf_optimizer,tensorflow/tensorflow-pywrap_saved_model,paolodedios/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,yongtang/tensorflow,yongtang/tensorflow,Intel-tensorflow/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,tensorflow/tensorflow-... | third_party/tf_runtime/workspace.bzl | third_party/tf_runtime/workspace.bzl | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "5028c1289fbbf3133392036d6ad6ade6dae4ab0f"
TFRT_SHA256 = "ff1e15302db43dc23302466e7974... | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "039cef36705e93539aaa34e544268b835ce2ab14"
TFRT_SHA256 = "aebb55d3b65217e04906bf9aba2e... | apache-2.0 | Python |
9ab28ecac89a354dee2903bf368edcd2d1b49a6c | Update TFRT dependency to use revision http://github.com/tensorflow/runtime/commit/0ce26aaafae68a07f9d90b72f9e50dcabd6f6310. | karllessard/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,tensorflow/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,Intel-tensorflow/tensorflow,karllessard/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,tensorflow/tensorflow-experimental_link_static_libraries_o... | third_party/tf_runtime/workspace.bzl | third_party/tf_runtime/workspace.bzl | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "0ce26aaafae68a07f9d90b72f9e50dcabd6f6310"
TFRT_SHA256 = "07a12bed18c84519ddbf4383b867... | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "fadfd9e466e083863592ee1bad373edc47f66a36"
TFRT_SHA256 = "66647190457c269ca3f6dab13df2... | apache-2.0 | Python |
f1b4630e63e540f9eef576683e7031bdbbfca316 | Simplify Path | ChuanleiGuo/AlgorithmsPlayground,ChuanleiGuo/AlgorithmsPlayground,ChuanleiGuo/AlgorithmsPlayground,ChuanleiGuo/AlgorithmsPlayground | src/71_Simplify_Path.py | src/71_Simplify_Path.py | class Solution(object):
def simplifyPath(self, path):
"""
:type path: str
:rtype: str
"""
coms = path.split('/')
stack = []
for com in coms:
if com == '.' or com == '/' or com == '':
continue
elif com == '..':
... | mit | Python | |
92fd6c4785523a6891aa02eed460451552fb186e | Add a little script to create test files with lyrics. | Distrotech/mpg123,Distrotech/mpg123,Distrotech/mpg123,Distrotech/mpg123,Distrotech/mpg123,Distrotech/mpg123,Distrotech/mpg123 | scripts/tag_lyrics.py | scripts/tag_lyrics.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# needs mutagen
# grabbed from: http://code.activestate.com/recipes/577138-embed-lyrics-into-mp3-files-using-mutagen-uslt-tag/
# simplified to only work on one file and get lyrics from stdin
import os
import sys
import codecs
from mutagen.mp3 import MP3
from mutagen.id3 ... | lgpl-2.1 | Python | |
15b84bdde63f26df4d85ca69963fb0f57bbec35b | add module to patch mako config. | thruflo/pyramid_weblayer | src/pyramid_weblayer/patch.py | src/pyramid_weblayer/patch.py | # -*- coding: utf-8 -*-
"""Library patches."""
import logging
logger = logging.getLogger(__name__)
import sys
from beaker import cache
from beaker.util import coerce_cache_params
from pyramid import mako_templating
def templateLookupFactory(settings):
"""Use the ``settings`` to return a patched ``TemplateLooku... | unlicense | Python | |
2137220e2cafe53d8779f357a49bc51f5efad53b | Create GoogleAddressSerializer | OpenVolunteeringPlatform/django-ovp-core,OpenVolunteeringPlatform/django-ovp-core | ovp_core/serializers.py | ovp_core/serializers.py | from ovp_core import models
from rest_framework import serializers
class GoogleAddressSerializer(serializers.ModelSerializer):
class Meta:
model = models.GoogleAddress
fields = ['typed_address', 'typed_address2', 'address_line', 'city_state']
read_only_fields = ['address_line', 'city_state']
| agpl-3.0 | Python | |
ac3ef2ed9d8fd5418a5f7365dde78afc7a9ae29c | Add script for soil moisture sensors. | TomasBedrnik/Meteo-Backend,TomasBedrnik/Meteo-Backend,TomasBedrnik/Meteo-Backend | getMoisture.py | getMoisture.py | #!/usr/bin/python
import spidev
import time
import RPi.GPIO as GPIO
import datetime
import time
#je potreba nastavit SPI na raspberry
#GPIO
GPIO.setmode(GPIO.BOARD)
pin = 11
GPIO.setup(pin,GPIO.OUT)
GPIO.output(pin,True)
# Open SPI bus
spi = spidev.SpiDev()
spi.open(0,0)
# Function to read SPI data from MCP3008 ... | lgpl-2.1 | Python | |
6abdfdd5f33aaaf05df4821ae14f594cb5b826a7 | Add python test for swarm optimisation | samueljackson92/optima,samueljackson92/metaopt,samueljackson92/optima,samueljackson92/metaopt | src/test/swarm_test.py | src/test/swarm_test.py | import unittest
import pyoptima as opt
class SwarmTest(unittest.TestCase):
def test_swarm_with_parabola(self):
hyper_params = {'phi_local': 1, 'phi_global': 1, 'omega': 0.01}
params = {'x0': (-1, 1), 'x1': (-1, 1)}
num_particles = 100
s = opt.Swarm(params, hyper_params, num_parti... | mit | Python | |
acb56d5b3ec4b24f6a6f0f9c2495586a9a902d15 | Create RespostaListar.py | AEDA-Solutions/matweb,AEDA-Solutions/matweb,AEDA-Solutions/matweb,AEDA-Solutions/matweb,AEDA-Solutions/matweb | backend/Models/Grau/RespostaListar.py | backend/Models/Grau/RespostaListar.py | from Framework.Resposta import Resposta
from Models.Grau.Grau import Grau as ModelGrau
class RespostaListar(Resposta):
def __init__(self,graus):
self.corpo = []
for grau in graus:
self.corpo.append(ModelGrau(grau))
| mit | Python | |
c35733f27feb5299c126c5d399f14747ba8f5a1c | Fix import. | mbrukman/flocker,1d4Nf6/flocker,Azulinho/flocker,agonzalezro/flocker,lukemarsden/flocker,moypray/flocker,agonzalezro/flocker,adamtheturtle/flocker,AndyHuu/flocker,LaynePeng/flocker,beni55/flocker,Azulinho/flocker,w4ngyi/flocker,hackday-profilers/flocker,mbrukman/flocker,lukemarsden/flocker,adamtheturtle/flocker,LaynePe... | flocker/node/functional/test_deploy.py | flocker/node/functional/test_deploy.py | # Copyright Hybrid Logic Ltd. See LICENSE file for details.
"""
Functional tests for ``flocker.node._deploy``.
"""
from subprocess import check_call
from twisted.trial.unittest import TestCase
from .. import Deployer, Deployment, Application, DockerImage, Node
from ..route import make_memory_network
from ..gear im... | # Copyright Hybrid Logic Ltd. See LICENSE file for details.
"""
Functional tests for ``flocker.node._deploy``.
"""
from subprocess import check_call
from twisted.trial.unittest import TestCase
from .. import Deployer, Deployment, Application, DockerImage, Node
from ..routes import make_memory_network
from ..gear i... | apache-2.0 | Python |
0a6472655c4b46686abe916008fd33a582b26139 | Create mailagent.py | sgleilei/mailagent | mailagent.py | mailagent.py | #!/usr/bin/env python
# coding=utf-8
import sys, os, time, datetime, smtplib, setting
from email.MIMEMultipart import MIMEMultipart
from email.MIMEBase import MIMEBase
from email.MIMEText import MIMEText
from email.Utils import COMMASPACE, formatdate
from email import Encoders
from email.Header import Header
g_codin... | bsd-2-clause | Python | |
453ea332acef13d066d1807b9894ffee6820b9aa | Rename main lib file | bpetering/ragaman | ranamag.py | ranamag.py |
def strip_boring(x):
"""Remove any characters which have no meaning for the purposes of
an anagram"""
import string
# XXX specious subsumption: is str
x = x.lower()
return [y for y in x if y in string.ascii_lowercase]
# TODO s->seq
def make_converter(s):
"""Returns a callabl... | mit | Python | |
7fd54df428a727879bb508bf5fef971a2fffa36b | Add initial roster parser version | leaffan/pynhldb | parsers/roster_parser.py | parsers/roster_parser.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
import uuid
from db.common import session_scope
# from db.player import Player
from db.player_game import PlayerGame
logger = logging.getLogger(__name__)
class RosterParser():
def __init__(self, raw_data):
# receiving structured raw data
... | mit | Python | |
00f33e732aa18f5124104f37868aca49eb5e6cc2 | Add xml support | abhijithanilkumar/ns-3-AppStore,abhijithanilkumar/ns-3-AppStore,abhijithanilkumar/ns-3-AppStore | src/util/parse_bake.py | src/util/parse_bake.py | import xml.etree.ElementTree as ET
def parse_xml(f):
tree = ET.parse(f)
root = tree.getroot()
for child in root:
print(child.tag, child.attrib)
| mit | Python | |
b0c8a5b114837ae9b6f4d7e81fc587ac0d1fc3a4 | Test the HPACK reference structure. | fredthomsen/hyper,jdecuyper/hyper,plucury/hyper,jdecuyper/hyper,lawnmowerlatte/hyper,plucury/hyper,fredthomsen/hyper,irvind/hyper,masaori335/hyper,masaori335/hyper,Lukasa/hyper,lawnmowerlatte/hyper,irvind/hyper,Lukasa/hyper | test/test_hpack_structures.py | test/test_hpack_structures.py | # -*- coding: utf-8 -*-
from hyper.http20.hpack_structures import Reference
class TestReference(object):
"""
Tests of the HPACK reference structure.
"""
def test_references_can_be_created(self):
r = Reference(None)
assert r
def test_two_references_to_the_same_object_compare_equal(s... | mit | Python | |
4f6f427a87292f826b203c01d9f4e59d6c3ea9fd | Create hesap.py | omergulen/brainhack17,omergulen/brainhack17,omergulen/brainhack17 | hesap/hesap.py | hesap/hesap.py | mealCost= float(input())
tipPercent = int(input())
taxPercent = int(input())
finalPrice = mealCost + mealCost *tipPercent/100 + mealCost *taxPercent/100
print("The total meal cost is {} dollars.".format(int(round(finalPrice,0))))
| mit | Python | |
090248743406eb8403b3989f980db3aa59a0858d | convert csv to txt | ab93/Depression-Identification | src/feature_extract/convert_CSV_to_txt.py | src/feature_extract/convert_CSV_to_txt.py | import os
import fnmatch
import sys
def renameCSVToTxt(dir):
rootdir = dir
for root, dirnames, filenames in os.walk(rootdir):
for filename in fnmatch.filter(filenames, '*CLM*.csv'):
#print(os.path.join(rootdir+'/'+filename))
os.rename(os.path.join(root+'/'+filename), root+'/'+... | mit | Python | |
f7d94846e0dc76d9a569e7f7ec6c49abcc55eda0 | add companies migrations | teamworkquality/twq-app,tassolom/twq-app,tassolom/twq-app,tassolom/twq-app,tassolom/twq-app,teamworkquality/twq-app,teamworkquality/twq-app,teamworkquality/twq-app | api/companies/migrations/0002_team.py | api/companies/migrations/0002_team.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-10-25 12:37
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('companies', '0001_initial'),
]
operations = [
migrations.CreateModel(
... | mit | Python | |
fc2deb1328359209665cbaf1906ab7e97e274896 | Create link-title.py | ishan-marikar/hexchat-scripts,Poorchop/hexchat-scripts,ishan-marikar/hexchat-scripts | link-title.py | link-title.py | from urllib2 import Request, urlopen, HTTPError
import glob
import mimetypes
import re
import sys
import hexchat
try:
from BeautifulSoup import BeautifulSoup
except ImportError:
hexchat.prnt("\002Link Title\002: Please install python-BeautifulSoup")
__module_name__ = "Link Title"
__module_author__ = "PDog"
__m... | mit | Python | |
0b448919e5dbff240b4ed1c15912ed2851ad5647 | create preql module and move batch predict (not working | fritzo/loom,posterior/loom,fritzo/loom,priorknowledge/loom,posterior/loom,fritzo/loom,priorknowledge/loom,posterior/loom,priorknowledge/loom | loom/preql.py | loom/preql.py | def parse_response(message):
response = Query.Response()
response.ParseFromString(message)
return response
def batch_predict(
config_in,
model_in,
groups_in,
requests,
debug=False,
profile=None):
root = os.getcwd()
with tempdir(cleanup_on_error=(not d... | bsd-3-clause | Python | |
8efd3ab0fad3a24f3db840ece1146b8d894249ef | add subclass elements | UWPCE-PythonCert/IntroPython2016,UWPCE-PythonCert/IntroPython2016,weidnem/IntroPython2016,weidnem/IntroPython2016,Baumelbi/IntroPython2016,Baumelbi/IntroPython2016,UWPCE-PythonCert/IntroPython2016,weidnem/IntroPython2016 | students/crobison/session07/html_render.py | students/crobison/session07/html_render.py | #!/usr/bin/env python3
class Element:
def __init__(self, content=None):
self.content = []
self.tag = "html"
if content is not None:
self.content.append(content)
def append(self, content):
self.content.append(content)
def render(self, out_file, indent=""):
... | #!/usr/bin/env python3
class Element:
def __init__(self, content=None):
self.content = []
self.tag = "html"
if content is not None:
self.content.append(content)
def append(self, content):
self.content.append(content)
# def render(self, out_file, indent=""):
... | unlicense | Python |
4b2fc4ec66bb1f1bea4a2899ef87cf03d6cdd312 | Add windows firewall execution modules integration tests | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | tests/integration/modules/test_firewall.py | tests/integration/modules/test_firewall.py | # -*- coding: utf-8 -*-
# Import Python libs
from __future__ import absolute_import
# Import Salt Testing libs
from tests.support.case import ModuleCase
from tests.support.unit import skipIf
from tests.support.helpers import destructiveTest
# Import Salt Libs
import salt.utils
@skipIf(not salt.utils.is_windows(), ... | apache-2.0 | Python | |
a233f685f6cb514420fd534388d51ee92459d886 | Remove duplicate imports and remove entirly unused string | szibis/Diamond,russss/Diamond,TAKEALOT/Diamond,szibis/Diamond,signalfx/Diamond,dcsquared13/Diamond,python-diamond/Diamond,eMerzh/Diamond-1,jumping/Diamond,codepython/Diamond,socialwareinc/Diamond,actmd/Diamond,cannium/Diamond,Slach/Diamond,eMerzh/Diamond-1,saucelabs/Diamond,zoidbergwill/Diamond,disqus/Diamond,bmhatfiel... | src/diamond/__init__.py | src/diamond/__init__.py | # coding=utf-8
"""
Diamond module init code
"""
import os
import sys
import logging
import time
import traceback
import configobj
import socket
import re
import datetime
import random
import urllib2
import base64
import csv
import platform
from urlparse import urlparse
| # coding=utf-8
import os
import sys
import string
import logging
import time
import traceback
import configobj
import socket
import re
import os
import sys
import re
import logging
import time
import datetime
import random
import urllib2
import base64
import csv
import platform
import string
import traceback
import co... | mit | Python |
c7eb6c7887467a6c1f044dd6828f4e6e8c07d2f6 | Replace Skript | the-it/WS_THEbotIT,the-it/WS_THEbotIT | scripts/online_scripts/160516_replace_cats_Hilbert.py | scripts/online_scripts/160516_replace_cats_Hilbert.py | # -*- coding: utf-8 -*-
__author__ = 'eso'
import sys
sys.path.append('../../')
import re
import pywikibot
from pywikibot import proofreadpage
from tools.catscan.catscan import CatScan
searcher_index = CatScan()
searcher_index.add_namespace(0)
searcher_index.add_positive_category('Fertig')
searcher_index.add_positive_... | mit | Python | |
3df44c842e802f0d758d320d1e2d51296c0e7e7a | add FilterDataTest | GregorCH/ipet,GregorCH/ipet | test/FilterDataTest.py | test/FilterDataTest.py | '''
Created on 03.09.2017
@author: Gregor Hendel
'''
import unittest
from ipet.evaluation import IPETEvaluation, IPETEvaluationColumn, IPETFilter, IPETFilterGroup
import pandas as pd
from ipet import Experiment, Key
class HelperExperiment(Experiment):
"""Special Experiment as minimal working example
"""
... | mit | Python | |
3715a06a77e1458851f6809041d0f622e2af60cf | add tests | dharhas/terrapin | test/flow_directions_test.py | test/flow_directions_test.py | import numpy as np
from numpy.testing import assert_equal
from terrapin.flow_direction import d8, convert_directions
def test_convert_directions():
test_sets = [
('esri',
np.array([0, 1, 2, 3, 4, 5, 6, 7]),
np.array([1, 128, 64, 32, 16, 8, 4, 2])
),
('taudem',
np.array([0, 1, 2, 3, 4, 5, 6, 7]),
np.a... | bsd-2-clause | Python | |
ce1f05c9943b365e35758502a38122ffe02c0d85 | Add min avg slice solution. | isendel/algorithms | prefix_sums/min_slice.py | prefix_sums/min_slice.py | # It is required to find the position of a slice with min avg in the
# numerical sequence. There is a mathematical proof for such problem
# where only slices of 2 and 3 elements are taken into account.
# Having that, solution become really simple.
def get_prefix_sum(A):
result = [0] * (len(A) + 1)
for i in xr... | apache-2.0 | Python | |
35f68d1f968f9f4083f8d23666049e64ee513870 | Add module for handing metadata | nhsengland/publish-o-matic | publish/lib/metadata.py | publish/lib/metadata.py |
import os
def get_resource_path(resource_name):
"""
Given a relative path, such as data/indicators.json will return the full path
to the resource in the metadata directory.
"""
root = os.path.dirname(__file__)
f = os.path.join(root, os.path.pardir, os.path.pardir, "metadata", resource_name)
... | mit | Python | |
05864894b876a679726f1063832f70cfecb4325e | Add py solution for 655. Print Binary Tree | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | py/print-binary-tree.py | py/print-binary-tree.py | # Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def printTree(self, root):
"""
:type root: TreeNode
:rtype: List[List[str]]
"""
q... | apache-2.0 | Python | |
9645b58b73e689efafd50ee2681beb813f3e410d | Add test of complex types | brendan-ward/rasterio,brendan-ward/rasterio,brendan-ward/rasterio | tests/test_complex_dtypes.py | tests/test_complex_dtypes.py | import logging
import sys
import uuid
import numpy as np
import pytest
import rasterio
logging.basicConfig(stream=sys.stderr, level=logging.DEBUG)
@pytest.fixture(scope='function')
def tempfile():
"""A temporary filename in the GDAL '/vsimem' filesystem"""
return '/vsimem/{}'.format(uuid.uuid4())
def co... | bsd-3-clause | Python | |
70fcf1fce6e77f36075a28881d6a48a60638a101 | fix lx config error when config file doesn't exist | windygu/xunlei-lixian,iambus/xunlei-lixian,GeassDB/xunlei-lixian,xieyanhao/xunlei-lixian,sdgdsffdsfff/xunlei-lixian,liujianpc/xunlei-lixian,wangjun/xunlei-lixian,wogong/xunlei-lixian,ccagg/xunlei,sndnvaps/xunlei-lixian,myself659/xunlei-lixian,davies/xunlei-lixian | lixian_config.py | lixian_config.py |
import os
LIXIAN_DEFAULT_CONFIG = os.path.join(os.getenv('USERPROFILE') or os.getenv('HOME'), '.xunlei.lixian.config')
LIXIAN_DEFAULT_COOKIES = os.path.join(os.getenv('USERPROFILE') or os.getenv('HOME'), '.xunlei.lixian.cookies')
def load_config(path):
values = {}
if os.path.exists(path):
with open(path) as x:
... |
import os
LIXIAN_DEFAULT_CONFIG = os.path.join(os.getenv('USERPROFILE') or os.getenv('HOME'), '.xunlei.lixian.config')
LIXIAN_DEFAULT_COOKIES = os.path.join(os.getenv('USERPROFILE') or os.getenv('HOME'), '.xunlei.lixian.cookies')
def load_config(path):
values = {}
if os.path.exists(path):
with open(path) as x:
... | mit | Python |
9b14b1939b97101c51696e32843e3cd54f83db0c | Move test_core up | arcticfoxnv/slackminion,arcticfoxnv/slackminion | tests/test_core/test_core.py | tests/test_core/test_core.py | from slackminion.plugins.core.core import Core
from slackminion.utils.test_helpers import *
class TestCorePlugin(BasicPluginTest):
PLUGIN_CLASS = Core
ADMIN_COMMANDS = [
'save',
'shutdown',
'wake',
]
def test_help(self):
assert self.object.help(get_test_event(), []) ==... | mit | Python | |
c40f531bc2d4a3c8a122499534b8b4431d34e151 | Fix case handling | KitwareMedical/ITKTubeTK,KitwareMedical/ITKTubeTK,aylward/ITKTubeTK,KitwareMedical/TubeTK,aylward/ITKTubeTK,KitwareMedical/ITKTubeTK,thewtex/TubeTK,KitwareMedical/TubeTK,thewtex/TubeTK,aylward/ITKTubeTK,thewtex/TubeTK,thewtex/TubeTK,KitwareMedical/ITKTubeTK,KitwareMedical/TubeTK,KitwareMedical/TubeTK,aylward/ITKTubeTK | PythonModules/tubetk/vseg/cnn/SegmentVesselsNN.py | PythonModules/tubetk/vseg/cnn/SegmentVesselsNN.py | #!/usr/bin/env python
import os.path
import ctk_cli
import keras.models as M
from . import deploy
from . import utils
from .utils import script_params
def main(args):
utils.set_params_path(args.params)
if (args.resampled is None) ^ (script_params['RESAMPLE_SPACING'] is None or args.preprocessed is None):
... | #!/usr/bin/env python
import os.path
import ctk_cli
import keras.models as M
from . import deploy
from . import utils
from .utils import script_params
def main(args):
utils.set_params_path(args.params)
if (args.resampled is None) ^ (script_params['RESAMPLE_SPACING'] is None or args.preprocessed is None):
... | apache-2.0 | Python |
c402326e196c4957db5d543522138f5e1bc9a5bf | Create md_test.py | ickc/pantable | tests/files/md_test.py | tests/files/md_test.py | from pathlib import Path
import sys
import inspect
from typing import Tuple
from panflute import convert_text
from pantable.util import parse_markdown_codeblock
# use the function exactly used by the cli
from pantable.cli.pantable2csv import table_to_csv
EXT = 'md'
PWD = Path(__file__).parent
DIRS = (PWD / 'md', PWD ... | bsd-3-clause | Python | |
f888799f4c88952f3ee77578fc1aface8eb4b067 | Add solution for problem C1 | fabianm/olympiad,fabianm/olympiad,fabianm/olympiad | olympiad/bestfit.py | olympiad/bestfit.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2014 Fabian M.
#
# 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... | apache-2.0 | Python | |
913cf8aa1837d5b4c24967ca649155f36211898a | Add missing test file | rick446/MongoTools | mongotools/tests/test_pubsub/test_oplog.py | mongotools/tests/test_pubsub/test_oplog.py | from unittest import TestCase
import pymongo
from mongotools import pubsub
class TestOplog(TestCase):
def setUp(self):
self.bind = pymongo.MongoClient()
self.tail = pubsub.OplogTail(self.bind)
def test_cursor_explain(self):
cur = self.tail.cursor(await=False)
plan = cur.expla... | mit | Python | |
6db57f5adf49f683176e826f21bbf5f0f6a6caea | Add restart magic | Calysto/metakernel | jupyter_kernel/magics/restart_magic.py | jupyter_kernel/magics/restart_magic.py | # Copyright (c) Calico Development Team.
# Distributed under the terms of the Modified BSD License.
# http://calicoproject.org/
from jupyter_kernel import Magic
class RestartMagic(Magic):
def line_restart(self):
"""%restart - restart session"""
self.kernel.do_shutdown(True)
def register_magics... | bsd-3-clause | Python | |
a823777082d182b6b4a8e86faa4b1e7b529016c2 | add simple_parser.py back... (sorry for messing things up) | dstufft/html5lib-python,ordbogen/html5lib-python,mgilson/html5lib-python,dstufft/html5lib-python,gsnedders/html5lib-python,ordbogen/html5lib-python,html5lib/html5lib-python,mindw/html5lib-python,mindw/html5lib-python,mgilson/html5lib-python,mindw/html5lib-python,dstufft/html5lib-python,ordbogen/html5lib-python,html5lib... | tests/simple_parser.py | tests/simple_parser.py | import sys
import os
from test_parser import *
os.chdir(os.path.split(os.path.abspath(__file__))[0])
sys.path.insert(0, os.path.abspath(os.path.join(os.pardir, "src")))
import parser
if __name__ == "__main__":
p = parser.HTMLParser()
if len(sys.argv) > 1:
x = sys.argv[1]
if len(sys.argv) > 2:... | mit | Python | |
119a1c9db81b45c8a8d54d4487f7faacc03c6d14 | add multi_small_files.py | demonkit/toolbox | multi_small_files.py | multi_small_files.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Split files to multiple small ones when writing large files.
Usage: write a new class inherits the `MultiFileWriter` class,
invoke get_file_path to get file path to write to.
"""
import os
import re
class MultiFileWriter(object):
def __init__(self, file_pat... | apache-2.0 | Python | |
7092c72c8d6173a8df8eb46b2c5e306552595e7f | Create button4.py | pyreflos/RasPi-Rattle | button4.py | button4.py | ## External Module import
import RPi.GPIO as GPIO
import time
import atexit
## Pin Definition:
#ledPinA = 17 ## Physical (BCM) 37; GPIO 26
ledPinB = 18 ##
ledPinC = 27 ##
ledPinD = 22 ##
#BtnPinA = 5 ## Physical (BCM) 35; GPIO 19
BtnPinB = 6 ##
BtnPinC = 13 ##
BtnPinD = 19 ##
## Pin Setup:
GPIO.setmode(G... | mit | Python | |
726cae5bfbb4a53ba979babc87e681b19562112e | Add a simple implementation of functionality like g_markup_printf_escaped() | rschroll/reinteract,johnrizzo1/reinteract,jbaayen/reinteract,alexey4petrov/reinteract,alexey4petrov/reinteract,rschroll/reinteract,alexey4petrov/reinteract,jbaayen/reinteract,rschroll/reinteract,jbaayen/reinteract,johnrizzo1/reinteract,johnrizzo1/reinteract | lib/reinteract/format_escaped.py | lib/reinteract/format_escaped.py | #
# Very, very partial implementation of g_markup_printf_escaped(). Doesn't
# handling things like a %c with an integer argument that evaluates to
# a markup special character, or special characters in the repr() or str()
# of an object. It also doesn't handle %(name)s type arguments with
# keyword arguments.
#
# To do... | bsd-2-clause | Python | |
1a36ba4f7069491a281e143385e6fec3bf2315f6 | add var.py | pezy/python_test | var.py | var.py | # cars number
cars = 100
# a car have 4 space
space_in_a_car = 4.0
# drivers number
drivers = 30
# passengers number
passengers = 90
# the number which car haven't driver
cars_not_driven = cars - drivers
# the number which car have driver
cars_driven = drivers
# the number that total cars can pass people
carpool_capaci... | bsd-3-clause | Python | |
5af6c133306330567b0b5c8916cbd3826efcbac0 | add simple test for font info absence | silnrsi/sldr,silnrsi/sldr,silnrsi/sldr,silnrsi/sldr | tests/test_fontinfo.py | tests/test_fontinfo.py | ### based on test_autonym.py
### not sure all these imports are needed
#import unittest
#import pytest
#import logging, re, unicodedata
#from lxml.etree import RelaxNG, parse, DocumentInvalid
#import sldr.UnicodeSets as usets
import os
def iscldr(ldml):
i = ldml.ldml.root.find(".//identity/special/sil:identity", {... | mit | Python | |
b938b6e8d28dbbbe7d4e37c1566f42ffee234732 | Fix permission for groups | PanDAWMS/panda-bigmon-atlas,PanDAWMS/panda-bigmon-atlas,PanDAWMS/panda-bigmon-atlas,PanDAWMS/panda-bigmon-atlas | atlas/prodtask/management/commands/datacarousel.py | atlas/prodtask/management/commands/datacarousel.py | from django.core.management.base import BaseCommand, CommandError
import time
from atlas.prestage.views import submit_all_tapes
class Command(BaseCommand):
args = 'None'
help = 'Submit request for all tapes '
def handle(self, *args, **options):
self.stdout.write('Start submit tape rules %s'%time... | apache-2.0 | Python | |
fa905619c95aee9d8e75671cf7ffd95f98aad2d6 | Add merge migration | HalcyonChimera/osf.io,pattisdr/osf.io,sloria/osf.io,aaxelb/osf.io,brianjgeiger/osf.io,pattisdr/osf.io,CenterForOpenScience/osf.io,CenterForOpenScience/osf.io,HalcyonChimera/osf.io,sloria/osf.io,aaxelb/osf.io,sloria/osf.io,pattisdr/osf.io,Johnetordoff/osf.io,caseyrollins/osf.io,baylee-d/osf.io,aaxelb/osf.io,icereval/osf... | osf/migrations/0114_merge_20180628_1234.py | osf/migrations/0114_merge_20180628_1234.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2018-06-28 17:34
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('osf', '0113_auto_20180615_1308'),
('osf', '0112_ensure_schemas'),
]
operations = [... | apache-2.0 | Python | |
1a527df19c54f52d80e9f9e7b267de8318b82291 | Add a nice plotting util class. Makes publication quality plots. | migueldiascosta/pymatgen,Bismarrck/pymatgen,yanikou19/pymatgen,sonium0/pymatgen,rousseab/pymatgen,Dioptas/pymatgen,Bismarrck/pymatgen,Dioptas/pymatgen,Bismarrck/pymatgen,sonium0/pymatgen,migueldiascosta/pymatgen,ctoher/pymatgen,ctoher/pymatgen,sonium0/pymatgen,ctoher/pymatgen,rousseab/pymatgen,yanikou19/pymatgen,rousse... | pymatgen/util/plotting.py | pymatgen/util/plotting.py | #!/usr/bin/env python
'''
Created on Mar 13, 2012
'''
from __future__ import division
__author__ = "Shyue Ping Ong"
__copyright__ = "Copyright 2012, The Materials Project"
__version__ = "0.1"
__maintainer__ = "Shyue Ping Ong"
__email__ = "shyue@mit.edu"
__date__ = "Mar 13, 2012"
import matplotlib.pyplot as plt
imp... | mit | Python | |
fbace843f6febaea28f35511035c8c997ba0fdab | Add priority queue implementation using lists | keon/algorithms,amaozhao/algorithms | queues/priority_queue.py | queues/priority_queue.py | """
Implementation of priority queue
"""
class PriorityQueueNode:
def __init__(self, data, priority):
self.data = data
self.priority = priority
def __repr__(self):
return str(self.data) + ": " + str(self.priority)
class PriorityQueue:
def __init__(self):
self.priority_queue_list = []
def size(self):
... | mit | Python | |
26a6db1bfc447a25b58a0ebb7e7566605ba8a8a3 | Create stereo_short.py | johnowhitaker/turtle-frac | stereo_short.py | stereo_short.py | import turtle
def mandel(zx, zy):
z = zx + zy * 1j
c = z
for i in xrange(400): #max_iterations
if abs(z) > 2.0: break
z = z * z + c
return i
def gen_strip_mandel(width, height):
xstart, ystart, xsize, ysize, xa, xb, ya, yb = 0, 0, 800, 640, -0.2034, -0.1995, -0.8163, -0.8127
img = []
for y in range(height):
... | mit | Python | |
7a7d75e49f7a6e4f01ef2a42b3cf712190b6bcab | Test subsets method | asaini/Apriori,gst-group/apriori_demo | test_apriori.py | test_apriori.py | import unittest
from itertools import chain
from apriori import subsets
class AprioriTest(unittest.TestCase):
def test_subsets_should_return_empty_subsets_if_input_empty_set(self):
result = tuple(subsets(set([])))
self.assertEqual(result, ())
def test_subsets_should_return_non_empty_subsets... | mit | Python | |
e561ec808a46c51aa5d5379f115a9e45709fa731 | add sequence expression | ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study | compiler/eLisp/eLisp/expr/sequence.py | compiler/eLisp/eLisp/expr/sequence.py | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
#
# Copyright (c) 2015 ASMlover. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyrig... | bsd-2-clause | Python | |
1850c5fa5d2b11c492a414024c2ba63a10429fa6 | add negative test cases for create snapshots: | Juraci/tempest,vmahuli/tempest,vedujoshi/os_tempest,Tesora/tesora-tempest,pandeyop/tempest,hayderimran7/tempest,vedujoshi/tempest,Juniper/tempest,cloudbase/lis-tempest,neerja28/Tempest,Mirantis/tempest,varunarya10/tempest,openstack/tempest,rzarzynski/tempest,ntymtsiv/tempest,openstack/tempest,eggmaster/tempest,manasi24... | tempest/api/volume/test_volumes_snapshots_negative.py | tempest/api/volume/test_volumes_snapshots_negative.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# 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... | apache-2.0 | Python | |
d662bf8ddcdd78b6cc75ea7b6731f5ac2379645d | Test python script to get data from Rflink. | matt2005/pyrflink | rflink1.py | rflink1.py | import serial
import time
import logging
import re
logging.basicConfig(filename='debug.log',level=logging.DEBUG)
def readlineCR(port):
rv = ""
while True:
ch = port.read().decode()
rv += ch
if ch=='\r':
rv = rv.strip('\r').strip('\n')
return rv
def sendData(data,p... | apache-2.0 | Python | |
b01c684cf27e623fe84dc9aee3c17b76e828cdb2 | Create 0003.py | reage/pp | 0003.py | 0003.py | from uuid import uuid1
import redis
i = 0
sn = set()
while i < 200:
i+=1
tmp = uuid1()
sn.add(tmp)
try:
r = redis.StrictRedis(host='localhost', port=6379, db=0)
r.set('sn', sn)
print r.get('sn')
r.delete('sn')
except:
print 'Error'
| mit | Python | |
81bddefc3fc8d66b0ddda3f86d60d09548eea8a7 | Add a mitmproxy script | passy/hls-proxy | mitm_redirect.py | mitm_redirect.py | from mitmproxy.models import HTTPResponse
from netlib.http import Headers
def request(context, flow):
if flow.request.pretty_host.endswith('myhost.com'):
flow.request.host = 'localhost'
flow.request.port = 8080
flow.request.scheme = 'http'
| bsd-3-clause | Python | |
b12d66e504b576e239a4dadbdf09bff91c4adab0 | Break out patterns into a top-level constants file | hach-que/readthedocs.org,rtfd/readthedocs.org,singingwolfboy/readthedocs.org,techtonik/readthedocs.org,wijerasa/readthedocs.org,LukasBoersma/readthedocs.org,stevepiercy/readthedocs.org,kenshinthebattosai/readthedocs.org,espdev/readthedocs.org,mhils/readthedocs.org,michaelmcandrew/readthedocs.org,rtfd/readthedocs.org,at... | readthedocs/constants.py | readthedocs/constants.py | from readthedocs.builds.version_slug import VERSION_SLUG_REGEX
from readthedocs.projects.constants import LANGUAGES_REGEX, PROJECT_SLUG_REGEX
pattern_opts = {
'project_slug': PROJECT_SLUG_REGEX,
'lang_slug': LANGUAGES_REGEX,
'version_slug': VERSION_SLUG_REGEX,
'filename_slug': '(?:.*)',
}
| mit | Python | |
7368153ef1aa317c314222acd59d82354ec57094 | Create MQTT.py | craigknott/CEIT_Sensors_Server,craigknott/CEIT_Sensors_Server,craigknott/CEIT_Sensors_Server | MQTT.py | MQTT.py | '''
Created on Nov 22, 2012
@author: Buddhika De Seram
'''
class MQTT:
database5 = None
threed_pub = None
client_cosm = "LIB_cosm"
client_ts = "LIB_ts"
client_3d = "LIB_3d"
client_sense = "LIB_sense"
client_3bpub = "3dPub"
server = "winter.ceit.uq.edu.au"
client = "LIB_temp"
clie... | mit | Python | |
1e849d6e34638716a985c6a011bbea109ce57171 | Add test file | keras-team/keras,keras-team/keras | keras/saving/pickle_utils_test.py | keras/saving/pickle_utils_test.py | # Copyright 2021 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | apache-2.0 | Python | |
4e0af69b8803e798fe1a90ea8c261cbcd85d149d | Add talking clock via Chromecast. | sergev/vak-opensource,sergev/vak-opensource,sergev/vak-opensource,sergev/vak-opensource,sergev/vak-opensource,sergev/vak-opensource,sergev/vak-opensource,sergev/vak-opensource,sergev/vak-opensource,sergev/vak-opensource,sergev/vak-opensource,sergev/vak-opensource,sergev/vak-opensource,sergev/vak-opensource,sergev/vak-o... | languages/python/talking-clock.py | languages/python/talking-clock.py | #!/usr/bin/env python3
#
# Talking clock, using my Google Home device as a media player.
#
import pychromecast, uuid, time, datetime
#
# Get list of all Chromecast devices.
# The local computer must be in the same Wi-Fi network.
#
def print_all_chromecasts():
all_cast_devices = pychromecast.get_chromecasts()
p... | apache-2.0 | Python | |
64e139adb1476354be520d695fa99e50b58375fe | add initial support for Cisco NXAPI | thaim/ansible,thaim/ansible | lib/ansible/module_utils/nxapi.py | lib/ansible/module_utils/nxapi.py | #
# (c) 2015 Peter Sprygada, <psprygada@ansible.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 published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any late... | mit | Python | |
10bc54a0e229adf3700c9a7ae525e65472470bf4 | Add script for analyzing the results of loading_measurement. | Pluto-tv/chromium-crosswalk,bright-sparks/chromium-spacewalk,PeterWangIntel/chromium-crosswalk,littlstar/chromium.src,dednal/chromium.src,anirudhSK/chromium,anirudhSK/chromium,ChromiumWebApps/chromium,crosswalk-project/chromium-crosswalk-efl,ltilve/chromium,mogoweb/chromium-crosswalk,Pluto-tv/chromium-crosswalk,Chromiu... | tools/perf/perf_tools/loading_measurement_analyzer.py | tools/perf/perf_tools/loading_measurement_analyzer.py | #!/usr/bin/env python
# Copyright 2013 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.
"""Parses CSV output from the loading_measurement and outputs interesting stats.
Example usage:
$ tools/perf/run_measurement --browser... | bsd-3-clause | Python | |
69978f33eb1b7fb7c24d06da33cec1ee48667bef | Add CentOS config for acp-workshop | curtisz/train,curtisz/train,anokun7/train,kizbitz/train,kizbitz/train,danielpalstra/train,danielpalstra/train,anokun7/train | train/labs/acp-workshop/scripts/centos.py | train/labs/acp-workshop/scripts/centos.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
PRIMARY_OS = 'CENTOS-7.0'
CS_ENGINE = '''#!/bin/sh
#
FQDN="{fqdn}"
export DEBIAN_FRONTEND=noninteractive
# locale
sudo locale-gen en_US.UTF-8
# /etc/hostname - /etc/hosts
sed -i "1 c\\127.0.0.1 $FQDN localhost" /etc/hosts
echo $FQDN > /etc/hostname
service hostname rest... | apache-2.0 | Python | |
fc52daab77fe8f3cc8ebdce2b5ad9b700dd3fd40 | Add boot.py | kajogi/iot-sample | boot.py | boot.py | # Connect to wireless network as client
import network
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
wlan.connect("itcollege")
# Synchronize clock
import ntptime
ntptime.settime()
# Create a variable for hostname based on MAC address:
import ubinascii as binascii
name = "esp-%s" % binascii.hexlify(wlan.config... | mit | Python | |
d03d4bf0ca7ec4d66868f384d6864c9fb456cb84 | Test for rudimentary io tests added | baumartig/vpn_switcher,baumartig/vpn_switcher | src/test_io.py | src/test_io.py | import RPi.GPIO as GPIO
import time
# This test is made for a quick check of the gpios
# List of the in channels to test. When pressed they output a message.
in_chanels = []
# A list of output channels to test. These whill be switched on and off in a pattern.
out_chanels = []
def switch_called(channel):
print 'Edg... | apache-2.0 | Python | |
b92cb6aa69e2646f4ee4a531f78f150be0143029 | rename .torrent file for `lx get-torrent` | GeassDB/xunlei-lixian,xieyanhao/xunlei-lixian,sdgdsffdsfff/xunlei-lixian,liujianpc/xunlei-lixian,myself659/xunlei-lixian,sndnvaps/xunlei-lixian,wangjun/xunlei-lixian,iambus/xunlei-lixian,wogong/xunlei-lixian,windygu/xunlei-lixian | lixian_plugins/commands/get_torrent.py | lixian_plugins/commands/get_torrent.py |
from lixian_plugins.api import command
from lixian_cli_parser import command_line_parser, command_line_option
from lixian_cli_parser import with_parser
from lixian_cli import parse_login
from lixian_commands.util import create_client
@command(name='get-torrent', usage='get .torrent by task id or info hash')
@command... |
from lixian_plugins.api import command
from lixian_cli_parser import command_line_parser
from lixian_cli_parser import with_parser
from lixian_cli import parse_login
from lixian_commands.util import create_client
@command(name='get-torrent', usage='get .torrent by task id or info hash')
@command_line_parser()
@with_... | mit | Python |
ae07720a6d6713078cc273a8c069b1eb67a35ffa | add c_emscripten tool | hlange/LogSoCR,hlange/LogSoCR,hlange/LogSoCR,hlange/LogSoCR,hlange/LogSoCR,hlange/LogSoCR,hlange/LogSoCR,hlange/LogSoCR,hlange/LogSoCR,hlange/LogSoCR,hlange/LogSoCR,hlange/LogSoCR,hlange/LogSoCR | waflib/extras/c_emscripten.py | waflib/extras/c_emscripten.py | #!/usr/bin/env python
# -*- coding: utf-8 vi:ts=4:noexpandtab
import os, subprocess, shlex
from waflib import Logs
from waflib.Tools import ccroot, ar, gcc, gxx
from waflib.Configure import conf
from waflib.TaskGen import after_method, feature
from waflib.Tools.compiler_c import c_compiler
from waflib.Tools.compiler... | agpl-3.0 | Python | |
85838f0771dff67d6422abcb4552cc19f32ca40f | Create grep.py | shahsaifi/handystuff | grep.py | grep.py | import sys
def grep(pat, filename):
lines = open(filename).readlines()
list = []
for i in lines:
if pat in i:
list.append(i)
return "".join(list)
def main():
pat = sys.argv[1]
filename = sys.argv[2]
print grep(pat,filename)
if __name__ == "__main__":
main()
| unlicense | Python | |
f199a79e990b7d1192661522cc2be116d6f1f9d6 | Create wamp.py | voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts | wamp.py | wamp.py | # Autobahn client with auto-reconnect capability
# Totally based on https://github.com/tavendo/AutobahnPython/blob/master/examples/twisted/wamp/beginner/client.py
import sys
from twisted.python import log
from twisted.internet import reactor
from twisted.internet.defer import inlineCallbacks
from twisted.internet.prot... | mit | Python | |
e510af28c2d894415fdeb4dbbba9238250e2b0ac | add permission mixin | barseghyanartur/rest_condition | rest_condition/mixins.py | rest_condition/mixins.py | __all__ = ('UpdatedPermissionChecksMixin',)
class UpdatedPermissionChecksMixin(object):
"""
Updated permission checks mixin.
"""
def check_permissions(self, request):
"""
Check if the request should be permitted.
Raises an appropriate exception if the request is not permitted.
... | mit | Python | |
d9b07320d6be25751d3a58afa2442638d8561a8e | Update the fabfile for the upcoming sparks (1.13) release, and clean useless values. | 1flow/1flow,1flow/1flow,1flow/1flow,WillianPaiva/1flow,WillianPaiva/1flow,WillianPaiva/1flow,WillianPaiva/1flow,WillianPaiva/1flow,1flow/1flow,1flow/1flow | fabfile.py | fabfile.py | # -*- coding: utf-8 -*-
import os
# Use this in case paramiko seems to go crazy. Trust me, it can do, especially
# when using the multiprocessing module.
#
# import logging
# logging.basicConfig(format=
# '%(asctime)s - %(name)s - %(levelname)s - %(message)s',
# level=logging.IN... | # -*- coding: utf-8 -*-
import os
# Use this in case paramiko seems to go crazy. Trust me, it can do, especially
# when using the multiprocessing module.
#
# import logging
# logging.basicConfig(format=
# '%(asctime)s - %(name)s - %(levelname)s - %(message)s',
# level=logging.DE... | agpl-3.0 | Python |
089208e4cb85da5b85c20242097cbe7f0c0e0ece | Add fab file with two tasks: test_all, run_test | malirod/pylua,malirod/pylua | fabfile.py | fabfile.py | #!/usr/bin/env python2
#-*- coding: utf-8 -*-
import os
from fabric.api import local, task
from pylua.settings import LOG_CONFIG
ROOT_DIR = os.path.dirname(os.path.realpath(__file__))
SRC_DIR = 'pylua'
TESTS_DIR = os.path.join(SRC_DIR, 'test')
LOG_CONFIG_PATH = os.path.join(ROOT_DIR, SRC_DIR, LOG_CONFIG)
@task
def ... | mit | Python | |
49a5ab31aa71a86b11e2cd3f787942f0d4a6bd5f | use fabric for deployment. Yay | chhantyal/py3readiness,chhantyal/py3readiness | fabfile.py | fabfile.py | import os
from contextlib import contextmanager
from fabric.api import env, run, local, prefix, sudo
def live():
"""Connects to the server."""
env.hosts = [os.environ.get('py3_hosts')]
env.user = os.environ.get('py3_user')
env.cwd = '/var/www/py3readiness.org'
env.connect_to = '{0}@{1}:{2}'.format... | bsd-2-clause | Python | |
a3c4aaf974faf55150d168905a4054d383ccd7cf | create migrations | slava-sh/messenger,slava-sh/messenger,slava-sh/messenger,slava-sh/messenger | web/accounts/migrations/0003_logincode.py | web/accounts/migrations/0003_logincode.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('accounts', '0002_auto_20150828_1427'),
]
operations = [
migrations.CreateModel(
name='LoginCode',
fi... | mit | Python | |
65ea663fd4b507923ad419d587deae6deb1ca79c | Add new package: setserial (#18929) | LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack | var/spack/repos/builtin/packages/setserial/package.py | var/spack/repos/builtin/packages/setserial/package.py | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Setserial(AutotoolsPackage):
"""A utility for configuring serial ports."""
homepage =... | lgpl-2.1 | Python | |
d7b492de9e33eda95992d449f2e0ed2ca18eaf8b | add install-remote.py script | nodepy/nodepy-pm | scripts/install-remote.py | scripts/install-remote.py | """
This script is linked from the nodepy/nodepy-pm@master branch under
`https://nodepy.org/install-pm` and can be used to install PM from the
internet.
If you want to install PM directly from source, use the `install.py`
script instead.
"""
if require.main != module:
raise RuntimeError('must not be required')
imp... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.