Skip to content

Commit

Permalink
Add missing type annotations in generate_qfp.py
Browse files Browse the repository at this point in the history
  • Loading branch information
rnestler committed Aug 11, 2019
1 parent 1f2246e commit 26503d4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ script:
generate_mosfet_dual.py
generate_so.py
generate_dip.py
generate_qfp.py
- mypy --check-untyped-defs --warn-return-any
test_entities.py
generate_qfp.py
#generate_dfn.py
#test_common.py
#test_generate_connectors.py
Expand Down
16 changes: 8 additions & 8 deletions generate_qfp.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def __init__(
def get_configs(self) -> List['QfpConfig']:
return [self]

def ipc_name(self):
def ipc_name(self) -> str:
return '{}{}{}P{}X{}X{}-{}'.format(
self.name_prefix,
self.name,
Expand All @@ -110,7 +110,7 @@ def ipc_name(self):
self.lead_count,
)

def description(self):
def description(self) -> str:
if self.name == 'LQFP':
full_name = 'Low Profile Quad Flat Package (LQFP)'
elif self.name == 'TQFP':
Expand Down Expand Up @@ -144,10 +144,10 @@ def excess_by_density(self, density: str) -> Excess:
except KeyError:
raise ValueError('Unhandled pitch: {}'.format(self.pitch))

def __str__(self):
def __str__(self) -> str:
return self.ipc_name()

def __repr__(self):
def __repr__(self) -> str:
return '<QfpConfig: {}>'.format(self.ipc_name())


Expand Down Expand Up @@ -328,15 +328,15 @@ def generate_pkg(
pkgcat: str,
version: str,
create_date: Optional[str],
):
) -> None:
category = 'pkg'
for config in configs:
lines = []

full_name = config.ipc_name()
full_description = config.description()

def _uuid(identifier):
def _uuid(identifier: str) -> str:
return uuid(category, full_name, identifier)

uuid_pkg = _uuid('pkg')
Expand All @@ -363,7 +363,7 @@ def add_footprint_variant(
key: str,
name: str,
density_level: str,
):
) -> None:
# UUIDs
uuid_footprint = _uuid('footprint-{}'.format(key))
uuid_silkscreen = [_uuid('polygon-silkscreen-{}-{}'.format(quadrant, key)) for quadrant in [1, 2, 3, 4]]
Expand Down Expand Up @@ -553,7 +553,7 @@ def add_footprint_variant(


if __name__ == '__main__':
def _make(dirpath: str):
def _make(dirpath: str) -> None:
if not (path.exists(dirpath) and path.isdir(dirpath)):
makedirs(dirpath)
_make('out')
Expand Down

0 comments on commit 26503d4

Please sign in to comment.