Skip to content

Commit

Permalink
Flake8
Browse files Browse the repository at this point in the history
  • Loading branch information
bsmartradio committed Nov 22, 2023
1 parent ec8b6c6 commit fb85dd6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@

schema = packet.SchemaRegistry.from_filesystem(schema_root="lsst.v6_0.alert").get_by_version("6.0")
with open("fakeAlert.avro", "wb") as f:
schema.store_alerts(f, [data])
schema.store_alerts(f, [data])
11 changes: 8 additions & 3 deletions python/lsst/alert/packet/updateSchema.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@

__all__ = ['update_schema']


def write_schema(schema, version, path):

updated_schema_loc=path[0:-3] + version[0]+'/'+version[2]
updated_schema_loc = path[0:-3] + version[0]+'/'+version[2]

if not os.path.exists(updated_schema_loc):
if not os.path.exists(updated_schema_loc[0:-2]):
Expand All @@ -42,7 +43,8 @@ def write_schema(schema, version, path):
updated_schema_name = schema['namespace'] + '.' + schema['name'] + '.avsc'

with open(updated_schema_loc + '/' + updated_schema_name, "w") as f:
json.dump(schema, f, indent=2)
json.dump(schema, f, indent=2)


def add_namespace(schema):

Expand Down Expand Up @@ -81,7 +83,7 @@ def populate_fields(apdb):

# Check if a column is nullable. If it is, it needs a default.
if 'nullable' in column:
if column['nullable'] == False:
if column['nullable'] is False:
# Check if a column has a description, if so, include "doc"
if 'description' in column:
field = {"name": column['name'],
Expand Down Expand Up @@ -117,6 +119,7 @@ def populate_fields(apdb):

return field_dictionary_array


def create_schema(name, field_dictionary_array, version):
""" Create a schema using the field dictionary. fastavro will automatically
take the name and namespace and put them as one, so the name should just be
Expand Down Expand Up @@ -150,6 +153,8 @@ def create_schema(name, field_dictionary_array, version):
schema = dict(sorted(schema.items(), reverse=True))

return schema


def update_schema(apdb_filepath, update_version=None):
"""Compare an avro schemas docstrings with the apdb.yaml file.
Expand Down

0 comments on commit fb85dd6

Please sign in to comment.