SHARE
TWEET

Untitled

a guest Mar 24th, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. diff --git a/requirements-dev.txt b/requirements-dev.txt
  2. index 8e1f5ad..fa101df 100644
  3. --- a/requirements-dev.txt
  4. +++ b/requirements-dev.txt
  5. @@ -1 +1,3 @@
  6. +bpython
  7.  pytest==4.3.1
  8. +yapf
  9. diff --git a/tools/scrapd-merger.py b/tools/scrapd-merger.py
  10. index 222a82e..03e0838 100644
  11. --- a/tools/scrapd-merger.py
  12. +++ b/tools/scrapd-merger.py
  13. @@ -12,8 +12,9 @@ $ cat new.json | python scrapd-merger.py old.json -
  14.  """
  15.  
  16.  import argparse
  17. -import logging
  18.  import json
  19. +import logging
  20. +from pathlib import Path
  21.  import pprint
  22.  import sys
  23.  
  24. @@ -27,14 +28,19 @@ def main():
  25.      # Merge the data.
  26.      results = merge(json.loads(args.old.read()), json.loads(args.infile.read()))
  27.  
  28. +    # Write the data.
  29. +    s_results = json.dumps(results, sort_keys=True, indent=2)
  30. +    args.old.seek(0)
  31. +    args.old.write(s_results)
  32. +
  33.      # Display the results.
  34. -    print(json.dumps(results, sort_keys=True, indent=2), file=sys.stdout)
  35. +    print(s_results)
  36.  
  37.  
  38. -def get_cli_parser(): # pragma: no cover
  39. +def get_cli_parser():  # pragma: no cover
  40.      """Get the CLI parser."""
  41.      parser = argparse.ArgumentParser(description='Create beautiful releases on GitHub.')
  42. -    parser.add_argument('old', type=argparse.FileType('rt'))
  43. +    parser.add_argument('old', type=argparse.FileType('r+t'))
  44.      parser.add_argument('infile', type=argparse.FileType('rt'), default=sys.stdin)
  45.  
  46.      return parser
  47. @@ -186,4 +192,3 @@ FINAL = """
  48.      }
  49.  ]
  50.  """
  51. -
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top