Skip to content

Instantly share code, notes, and snippets.

@davea
davea / argh.py
Created January 31, 2017 14:02 — forked from dracos/argh.py
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('args', nargs='*') # from __init__.py execute()
parser.add_argument('args', nargs='+') # from base.py LabelCommand add_arguments
print(parser.parse_args(['foo1', 'foo2', 'foo3', 'foo4']))
# Outputs Namespace(args=['foo4'])
@davea
davea / ssdp.py
Last active December 15, 2015 23:01 — forked from dankrause/ssdp.py
Tiny python SSDP discovery library with no external dependencies - Python 2 & 3 compatible
# Copyright 2014 Dan Krause
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,