zulip/examples: Remove sys.path modifications.
With the new repo, doing a `pip install -e ./zulip` will be a part of the core workflow. This mitigates the risk of developers accidentally testing their changes against an installed copy of the zulip package rather than the copy in their checkout. Therefore, we can now get rid of the various `sys.path.inserts` in the examples.
This commit is contained in:
parent
de23a1b32f
commit
61d84cd649
|
@ -22,8 +22,6 @@
|
||||||
# THE SOFTWARE.
|
# THE SOFTWARE.
|
||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
import sys
|
|
||||||
from os import path
|
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
usage = """create-user --new-email=<email address> --new-password=<password> --new-full-name=<full name> --new-short-name=<short name> [options]
|
usage = """create-user --new-email=<email address> --new-password=<password> --new-full-name=<full name> --new-short-name=<short name> [options]
|
||||||
|
@ -34,7 +32,6 @@ will be created in your realm.
|
||||||
Example: create-user --site=http://localhost:9991 --user=rwbarton@example.com --new-email=jarthur@example.com --new-password=random17 --new-full-name 'J. Arthur Random' --new-short-name='jarthur'
|
Example: create-user --site=http://localhost:9991 --user=rwbarton@example.com --new-email=jarthur@example.com --new-password=random17 --new-full-name 'J. Arthur Random' --new-short-name='jarthur'
|
||||||
"""
|
"""
|
||||||
|
|
||||||
sys.path.append(path.join(path.dirname(__file__), '..'))
|
|
||||||
import zulip
|
import zulip
|
||||||
|
|
||||||
parser = zulip.add_default_arguments(argparse.ArgumentParser(usage=usage))
|
parser = zulip.add_default_arguments(argparse.ArgumentParser(usage=usage))
|
||||||
|
|
|
@ -22,8 +22,6 @@
|
||||||
# THE SOFTWARE.
|
# THE SOFTWARE.
|
||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
import sys
|
|
||||||
import os
|
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
usage = """edit-message [options] --message=<msg_id> --subject=<new subject> --content=<new content> --user=<sender's email address> --api-key=<sender's api key>
|
usage = """edit-message [options] --message=<msg_id> --subject=<new subject> --content=<new content> --user=<sender's email address> --api-key=<sender's api key>
|
||||||
|
@ -35,7 +33,6 @@ Example: edit-message --message-id="348135" --subject="my subject" --content="te
|
||||||
You can omit --user and --api-key arguments if you have a properly set up ~/.zuliprc
|
You can omit --user and --api-key arguments if you have a properly set up ~/.zuliprc
|
||||||
"""
|
"""
|
||||||
|
|
||||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
|
|
||||||
import zulip
|
import zulip
|
||||||
|
|
||||||
parser = zulip.add_default_arguments(argparse.ArgumentParser(usage=usage))
|
parser = zulip.add_default_arguments(argparse.ArgumentParser(usage=usage))
|
||||||
|
|
|
@ -22,8 +22,6 @@
|
||||||
# THE SOFTWARE.
|
# THE SOFTWARE.
|
||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
import sys
|
|
||||||
from os import path
|
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
usage = """get-presence --email=<email address> [options]
|
usage = """get-presence --email=<email address> [options]
|
||||||
|
@ -31,7 +29,6 @@ usage = """get-presence --email=<email address> [options]
|
||||||
Get presence data for another user.
|
Get presence data for another user.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
sys.path.append(path.join(path.dirname(__file__), '..'))
|
|
||||||
import zulip
|
import zulip
|
||||||
|
|
||||||
parser = zulip.add_default_arguments(argparse.ArgumentParser(usage=usage))
|
parser = zulip.add_default_arguments(argparse.ArgumentParser(usage=usage))
|
||||||
|
|
|
@ -22,8 +22,6 @@
|
||||||
# THE SOFTWARE.
|
# THE SOFTWARE.
|
||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
import sys
|
|
||||||
import os
|
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
usage = """get-public-streams --user=<bot's email address> --api-key=<bot's api key> [options]
|
usage = """get-public-streams --user=<bot's email address> --api-key=<bot's api key> [options]
|
||||||
|
@ -35,7 +33,6 @@ Example: get-public-streams --user=othello-bot@example.com --api-key=a0b1c2d3e4f
|
||||||
You can omit --user and --api-key arguments if you have a properly set up ~/.zuliprc
|
You can omit --user and --api-key arguments if you have a properly set up ~/.zuliprc
|
||||||
"""
|
"""
|
||||||
|
|
||||||
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
|
|
||||||
import zulip
|
import zulip
|
||||||
|
|
||||||
parser = zulip.add_default_arguments(argparse.ArgumentParser(usage=usage))
|
parser = zulip.add_default_arguments(argparse.ArgumentParser(usage=usage))
|
||||||
|
|
|
@ -22,8 +22,6 @@
|
||||||
# THE SOFTWARE.
|
# THE SOFTWARE.
|
||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
import sys
|
|
||||||
import os
|
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
usage = """list-members --user=<bot's email address> --api-key=<bot's api key> [options]
|
usage = """list-members --user=<bot's email address> --api-key=<bot's api key> [options]
|
||||||
|
@ -33,7 +31,6 @@ List the names and e-mail addresses of the people in your realm.
|
||||||
You can omit --user and --api-key arguments if you have a properly set up ~/.zuliprc
|
You can omit --user and --api-key arguments if you have a properly set up ~/.zuliprc
|
||||||
"""
|
"""
|
||||||
|
|
||||||
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
|
|
||||||
import zulip
|
import zulip
|
||||||
|
|
||||||
parser = zulip.add_default_arguments(argparse.ArgumentParser(usage=usage))
|
parser = zulip.add_default_arguments(argparse.ArgumentParser(usage=usage))
|
||||||
|
|
|
@ -22,8 +22,6 @@
|
||||||
# THE SOFTWARE.
|
# THE SOFTWARE.
|
||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
import sys
|
|
||||||
import os
|
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
usage = """list-subscriptions --user=<bot's email address> --api-key=<bot's api key> [options]
|
usage = """list-subscriptions --user=<bot's email address> --api-key=<bot's api key> [options]
|
||||||
|
@ -34,7 +32,7 @@ Example: list-subscriptions --user=username@example.com --api-key=a0b1c2d3e4f5a6
|
||||||
|
|
||||||
You can omit --user and --api-key arguments if you have a properly set up ~/.zuliprc
|
You can omit --user and --api-key arguments if you have a properly set up ~/.zuliprc
|
||||||
"""
|
"""
|
||||||
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
|
|
||||||
import zulip
|
import zulip
|
||||||
|
|
||||||
parser = zulip.add_default_arguments(argparse.ArgumentParser(usage=usage))
|
parser = zulip.add_default_arguments(argparse.ArgumentParser(usage=usage))
|
||||||
|
|
|
@ -22,8 +22,6 @@
|
||||||
# THE SOFTWARE.
|
# THE SOFTWARE.
|
||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
import sys
|
|
||||||
import os
|
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
from typing import Any, Dict
|
from typing import Any, Dict
|
||||||
|
@ -36,7 +34,7 @@ Example: print-events --user=username@example.com --api-key=a0b1c2d3e4f5a6b7c8d9
|
||||||
|
|
||||||
You can omit --user and --api-key arguments if you have a properly set up ~/.zuliprc
|
You can omit --user and --api-key arguments if you have a properly set up ~/.zuliprc
|
||||||
"""
|
"""
|
||||||
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
|
|
||||||
import zulip
|
import zulip
|
||||||
|
|
||||||
parser = zulip.add_default_arguments(argparse.ArgumentParser(usage=usage))
|
parser = zulip.add_default_arguments(argparse.ArgumentParser(usage=usage))
|
||||||
|
|
|
@ -22,8 +22,6 @@
|
||||||
# THE SOFTWARE.
|
# THE SOFTWARE.
|
||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
import sys
|
|
||||||
import os
|
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
from typing import Any, Dict
|
from typing import Any, Dict
|
||||||
|
@ -36,7 +34,7 @@ Example: print-messages --user=username@example.com --api-key=a0b1c2d3e4f5a6b7c8
|
||||||
|
|
||||||
You can omit --user and --api-key arguments if you have a properly set up ~/.zuliprc
|
You can omit --user and --api-key arguments if you have a properly set up ~/.zuliprc
|
||||||
"""
|
"""
|
||||||
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
|
|
||||||
import zulip
|
import zulip
|
||||||
|
|
||||||
parser = zulip.add_default_arguments(argparse.ArgumentParser(usage=usage))
|
parser = zulip.add_default_arguments(argparse.ArgumentParser(usage=usage))
|
||||||
|
|
|
@ -22,8 +22,6 @@
|
||||||
# THE SOFTWARE.
|
# THE SOFTWARE.
|
||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
import sys
|
|
||||||
import os
|
|
||||||
import json
|
import json
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
|
@ -35,7 +33,7 @@ Example: recent-messages --count=101 --user=username@example.com --api-key=a0b1c
|
||||||
|
|
||||||
You can omit --user and --api-key arguments if you have a properly set up ~/.zuliprc
|
You can omit --user and --api-key arguments if you have a properly set up ~/.zuliprc
|
||||||
"""
|
"""
|
||||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
|
|
||||||
import zulip
|
import zulip
|
||||||
|
|
||||||
parser = zulip.add_default_arguments(argparse.ArgumentParser(usage=usage))
|
parser = zulip.add_default_arguments(argparse.ArgumentParser(usage=usage))
|
||||||
|
|
|
@ -22,9 +22,6 @@
|
||||||
# THE SOFTWARE.
|
# THE SOFTWARE.
|
||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
import sys
|
|
||||||
import os
|
|
||||||
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
|
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
import zulip
|
import zulip
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
import sys
|
import sys
|
||||||
import os
|
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
usage = """subscribe --user=<bot's email address> --api-key=<bot's api key> [options] --streams=<streams>
|
usage = """subscribe --user=<bot's email address> --api-key=<bot's api key> [options] --streams=<streams>
|
||||||
|
@ -35,7 +34,7 @@ Examples: subscribe --user=username@example.com --api-key=a0b1c2d3e4f5a6b7c8d9e0
|
||||||
|
|
||||||
You can omit --user and --api-key arguments if you have a properly set up ~/.zuliprc
|
You can omit --user and --api-key arguments if you have a properly set up ~/.zuliprc
|
||||||
"""
|
"""
|
||||||
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
|
|
||||||
import zulip
|
import zulip
|
||||||
|
|
||||||
parser = zulip.add_default_arguments(argparse.ArgumentParser(usage=usage))
|
parser = zulip.add_default_arguments(argparse.ArgumentParser(usage=usage))
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
import sys
|
import sys
|
||||||
import os
|
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
usage = """unsubscribe --user=<bot's email address> --api-key=<bot's api key> [options] --streams=<streams>
|
usage = """unsubscribe --user=<bot's email address> --api-key=<bot's api key> [options] --streams=<streams>
|
||||||
|
@ -35,7 +34,7 @@ Examples: unsubscribe --user=username@example.com --api-key=a0b1c2d3e4f5a6b7c8d9
|
||||||
|
|
||||||
You can omit --user and --api-key arguments if you have a properly set up ~/.zuliprc
|
You can omit --user and --api-key arguments if you have a properly set up ~/.zuliprc
|
||||||
"""
|
"""
|
||||||
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
|
|
||||||
import zulip
|
import zulip
|
||||||
|
|
||||||
parser = zulip.add_default_arguments(argparse.ArgumentParser(usage=usage))
|
parser = zulip.add_default_arguments(argparse.ArgumentParser(usage=usage))
|
||||||
|
|
|
@ -22,12 +22,9 @@
|
||||||
# THE SOFTWARE.
|
# THE SOFTWARE.
|
||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
import importlib
|
|
||||||
import sys
|
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
from six.moves import StringIO as _StringIO
|
from six.moves import StringIO as _StringIO
|
||||||
sys.path.insert(0, './api')
|
|
||||||
from typing import IO
|
from typing import IO
|
||||||
import zulip
|
import zulip
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue