Skip to content

Commit

Permalink
Type skymarshal.syntax_tree
Browse files Browse the repository at this point in the history
GitHub Copilot is surprisingly good at this.

Topic: type-skymarshal
GitOrigin-RevId: aab21c2a8d10eb129bc4e14dd74994140601dbf6
  • Loading branch information
danny-skydio authored and aaron-skydio committed Oct 17, 2023
1 parent 3616a56 commit 85f47cb
Show file tree
Hide file tree
Showing 2 changed files with 107 additions and 18 deletions.
6 changes: 3 additions & 3 deletions third_party/skymarshal/skymarshal/emit_python.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
# mypy: allow-untyped-defs
from __future__ import absolute_import

import argparse # pylint: disable=unused-import
import argparse
import copy
import os
import typing as T
import zipfile
from io import BytesIO

from skymarshal import syntax_tree # pylint: disable=unused-import
from skymarshal import syntax_tree
from skymarshal.emit_helpers import Code, EnumBuilder, StructBuilder, render
from skymarshal.language_plugin import SkymarshalLanguage

Expand Down Expand Up @@ -568,7 +568,7 @@ def hashable(self):


class PyEnum(EnumBuilder):
# TODO: Add unpacker support for enums, which should be pretty easy.
# TODO(nikhilm): Add unpacker support for enums, which should be pretty easy.
def decode_value(self):
info = TYPE_MAP[self.storage_type.name]
return "struct.unpack('{}', buf.read({}))[0]".format(info.pack_format, info.size)
Expand Down
Loading

0 comments on commit 85f47cb

Please sign in to comment.