-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
80 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
from . import BaseFile | ||
import json | ||
|
||
class JsonFile(BaseFile): | ||
|
||
class JsonFile(BaseFile): | ||
def __init__(self, github_file, repo): | ||
super().__init__(github_file, repo) | ||
|
||
def _load_objects(self): | ||
return json.loads(self.file_contents) | ||
|
||
def _dump(self): | ||
return json.dumps(self.objects, indent=4) | ||
def _dump(self, serialize_options={}): | ||
indent = serialize_options.get("indent", 4) | ||
return json.dumps(self.objects, indent=indent) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
from . import BaseFile | ||
|
||
class MarkdownFile(BaseFile): | ||
|
||
class MarkdownFile(BaseFile): | ||
def __init__(self, github_file, repo): | ||
super().__init__(github_file, repo) | ||
|
||
def _load_objects(self): | ||
return self.file_contents.split(b'\n') | ||
return self.file_contents.split(b"\n") | ||
|
||
def _dump(self): | ||
return b'\n'.join(self.file_contents) | ||
def _dump(self, serialize_options={}): | ||
return b"\n".join(self.file_contents) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
from . import BaseFile | ||
|
||
class PlainTextFile(BaseFile): | ||
|
||
class PlainTextFile(BaseFile): | ||
def __init__(self, github_file, repo): | ||
super().__init__(github_file, repo) | ||
|
||
def _load_objects(self): | ||
return self.file_contents | ||
|
||
def _dump(self): | ||
def _dump(self, serialize_options={}): | ||
return self.file_contents |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,26 @@ | ||
from . import BaseFile | ||
import yaml | ||
|
||
class YamlFile(BaseFile): | ||
|
||
class YamlFile(BaseFile): | ||
def __init__(self, github_file, repo): | ||
super().__init__(github_file, repo) | ||
yaml.add_representer(type(None), represent_none) | ||
|
||
def _load_objects(self): | ||
return list(yaml.safe_load_all(self.file_contents)) | ||
|
||
def _dump(self): | ||
return yaml.dump_all(self.objects, default_flow_style=False, explicit_start=True) | ||
def _dump(self, serialize_options={}): | ||
default_flow_style = serialize_options.get("default_flow_style", False) | ||
explicit_start = serialize_options.get("explicit_start", True) | ||
return yaml.dump_all( | ||
self.objects, | ||
default_flow_style=default_flow_style, | ||
explicit_start=explicit_start, | ||
) | ||
|
||
|
||
def represent_none(self, _): | ||
# Disable dumping 'null' string for null values | ||
# Taken from here: https://stackoverflow.com/a/41786451 | ||
return self.represent_scalar('tag:yaml.org,2002:null', '') | ||
return self.represent_scalar("tag:yaml.org,2002:null", "") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,22 @@ | ||
import setuptools | ||
|
||
setup_reqs = ['pytest', 'pytest-cov', 'pytest-runner', 'flake8'] | ||
setup_reqs = ["pytest", "pytest-cov", "pytest-runner", "flake8"] | ||
setuptools.setup( | ||
name="gordian", | ||
version="3.2.0", | ||
version="3.3.0", | ||
author="Intuit", | ||
author_email="cg-sre@intuit.com", | ||
description="A tool to search and replace files in a Git repo", | ||
url="https://github.com/argoproj-labs/gordian", | ||
install_requires=['pygithub', 'pyyaml', 'jsonpatch', 'deepdiff', 'retry'], | ||
install_requires=["pygithub", "pyyaml", "jsonpatch", "deepdiff", "retry"], | ||
setup_requires=setup_reqs, | ||
extras_require={ | ||
'test': setup_reqs | ||
}, | ||
extras_require={"test": setup_reqs}, | ||
tests_require=setup_reqs, | ||
packages=['gordian', 'gordian.files'], | ||
packages=["gordian", "gordian.files"], | ||
entry_points={ | ||
'console_scripts': [ | ||
'gordian = gordian.gordian:main', | ||
'pulpo = gordian.pulpo:main', | ||
"console_scripts": [ | ||
"gordian = gordian.gordian:main", | ||
"pulpo = gordian.pulpo:main", | ||
], | ||
}, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters