Skip to content

Commit

Permalink
Merge 29f9262 into f11f905
Browse files Browse the repository at this point in the history
  • Loading branch information
brnsnt committed Jan 27, 2020
2 parents f11f905 + 29f9262 commit 8cd2be2
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 11 deletions.
7 changes: 2 additions & 5 deletions .travis.yml
Expand Up @@ -5,12 +5,9 @@ python:
- "3.4"
- "3.5"
- "3.6"
- "3.7"
- "3.8"
- "pypy3.5"
matrix:
include:
- python: 3.7
dist: xenial
sudo: true
install:
- pip install .
- pip install -r test_requirements.txt
Expand Down
8 changes: 5 additions & 3 deletions radon/visitors.py
Expand Up @@ -288,9 +288,9 @@ class HalsteadVisitor(CodeVisitor):
Halstead metrics (see :func:`radon.metrics.h_visit`).
'''

types = {ast.Num: 'n',
ast.Name: 'id',
ast.Attribute: 'attr'}
# As of Python 3.8 Num/Str/Bytes/NameConstat
# are now in a common node Constant.
types = {"Num": "n", "Name": "id", "Attribute": "attr", "Constant": "value"}

def __init__(self, context=None):
'''*context* is a string used to keep track the analysis' context.'''
Expand Down Expand Up @@ -333,6 +333,8 @@ def aux(self, node):
new_operand = getattr(operand,
self.types.get(type(operand), ''),
operand)
name = self.get_name(operand)
new_operand = getattr(operand, self.types.get(name, ""), operand)

self.operands_seen.add((self.context, new_operand))
# Now dispatch to children
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
@@ -1,4 +1,4 @@
mando>=0.6,<0.7
colorama>=0.4,<0.5
colorama==0.4.2
flake8_polyfill
future
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -20,7 +20,7 @@
tests_require=['tox'],
install_requires=[
'mando>=0.6,<0.7',
'colorama>=0.4,<0.5',
'colorama==0.4.2',
'flake8-polyfill',
'future',
],
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
@@ -1,5 +1,5 @@
[tox]
envlist = py27,py33,py34,py35,py36,pypy
envlist = py27,py33,py34,py35,py36,py37,py38,pypy

[testenv]
deps = -r{toxinidir}/test_requirements.txt
Expand Down

0 comments on commit 8cd2be2

Please sign in to comment.