Closed cclauss closed 5 years ago
Thanks! Please note that anything in /jsuarez is mainly just for me to speed up dev -- wasn't expecting people to dig into it
Just fyi on undefined names... often missing imports, etc.
flake8 testing of https://github.com/openai/neural-mmo on Python 3.7.1
$ flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics
./forge/blade/action/tree.py:62:13: F821 undefined name 'np'
ind = np.random.randint(0, len(nodes))
^
./forge/blade/lib/multiset.py:53:17: F821 undefined name 'isIn'
if not isIn(e, other[e]):
^
./forge/blade/lib/utils.py:57:13: F821 undefined name 'pos1'
r1, c1 = pos1
^
./forge/blade/lib/utils.py:58:13: F821 undefined name 'pos2'
r2, c2 = pos2
^
./forge/blade/lib/utils.py:62:13: F821 undefined name 'pos1'
r1, c1 = pos1
^
./forge/blade/lib/utils.py:63:13: F821 undefined name 'pos2'
r2, c2 = pos2
^
./forge/blade/lib/enums.py:151:21: F821 undefined name 'color12'
twelveColor = color12()
^
./forge/blade/lib/log.py:119:31: F821 undefined name 'Utils'
self.benchmarks[func] = Utils.BenchmarkTimer()
^
./forge/blade/entity/npc/npc.py:16:24: F821 undefined name 'Actions'
if type(args) == Actions.EmptyArgs:
^
./forge/blade/entity/npc/npc.py:30:14: F821 undefined name 'Actions'
return Actions.move4(), EmptyArgs
^
./forge/blade/entity/npc/npc.py:30:31: F821 undefined name 'EmptyArgs'
return Actions.move4(), EmptyArgs
^
./forge/blade/entity/npc/npc.py:41:17: F821 undefined name 'Actions'
return Actions.move4(), EmptyArgs
^
./forge/blade/entity/npc/npc.py:41:34: F821 undefined name 'EmptyArgs'
return Actions.move4(), EmptyArgs
^
./forge/blade/systems/inventory.py:11:20: F821 undefined name 'Armor'
self.armor = Armor.Base()
^
./forge/blade/systems/inventory.py:14:20: F821 undefined name 'Item'
self.melee = Item.Base()
^
./forge/blade/systems/inventory.py:17:21: F821 undefined name 'Item'
self.ranged = Item.Base()
^
./forge/blade/systems/exchange.py:92:13: F821 undefined name 'buyOffers'
buyOffers.buy(buyOffer.quantLeft, itemPrice)
^
./forge/blade/systems/ai.py:13:20: F821 undefined name 'Actions'
tree = Actions.ActionTree(world, entity, rootVersion=Actions.MeleeV2)
^
./forge/blade/systems/ai.py:13:66: F821 undefined name 'Actions'
tree = Actions.ActionTree(world, entity, rootVersion=Actions.MeleeV2)
^
./forge/blade/systems/ai.py:18:20: F821 undefined name 'Actions'
tree = Actions.ActionTree(world, entity, rootVersion=Actions.MoveV2)
^
./forge/blade/systems/ai.py:18:66: F821 undefined name 'Actions'
tree = Actions.ActionTree(world, entity, rootVersion=Actions.MoveV2)
^
./forge/blade/systems/ai.py:24:11: F821 undefined name 'Actions'
tree = Actions.ActionTree(world, entity, rootVersion=Actions.MoveV2)
^
./forge/blade/systems/ai.py:24:57: F821 undefined name 'Actions'
tree = Actions.ActionTree(world, entity, rootVersion=Actions.MoveV2)
^
./forge/blade/systems/ai.py:31:31: F821 undefined name 'Actions'
if len(moves) == 0: return Actions.Pass(), Actions.EmptyArgs()
^
./forge/blade/systems/ai.py:31:47: F821 undefined name 'Actions'
if len(moves) == 0: return Actions.Pass(), Actions.EmptyArgs()
^
./forge/blade/systems/ai.py:34:11: F821 undefined name 'Actions'
tree = Actions.ActionTree(world, entity, rootVersion=Actions.MoveV2)
^
./forge/blade/systems/ai.py:34:57: F821 undefined name 'Actions'
tree = Actions.ActionTree(world, entity, rootVersion=Actions.MoveV2)
^
./forge/blade/systems/ai.py:149:10: F821 undefined name 'cs'
if cs - c < targ:
^
./forge/blade/systems/ai.py:153:14: F821 undefined name 'cs'
if c - cs < targ:
^
./forge/ethyr/torch/utils.py:67:13: F821 undefined name 'init'
init.orthogonal(e)
^
./forge/ethyr/torch/utils.py:69:10: F821 undefined name 'init'
init.normal(e, std=1e-2)
^
./forge/ethyr/torch/utils.py:71:10: F821 undefined name 'init'
init.xavier_normal(e)
^
./forge/ethyr/torch/policy.py:79:16: F821 undefined name 'classify'
argIdx = classify(arg)
^
./forge/ethyr/torch/policy.py:80:22: F821 undefined name 'argd'
return argIdx, argd
^
./forge/ethyr/torch/loss.py:59:64: F821 undefined name 'piOld'
prob, probOld, logProb = F.softmax(pi, dim=1), F.softmax(piOld, dim=1), F.log_softmax(pi, dim=1)
^
==============================
./jsuarez/Color256.py:2:14: F821 undefined name 'colorsys'
r, g, b = colorsys.hsv_to_rgb(h, s, v)
^
./jsuarez/Color256.py:5:11: F821 undefined name 'Color'
return Color(str(idx), hexval)
^
./jsuarez/Color256.py:9:20: F821 undefined name 'np'
parh, parv = np.meshgrid(np.linspace(0.075, 1, 16), np.linspace(0.25, 1, 16)[::-1])
^
./jsuarez/Color256.py:9:32: F821 undefined name 'np'
parh, parv = np.meshgrid(np.linspace(0.075, 1, 16), np.linspace(0.25, 1, 16)[::-1])
^
./jsuarez/Color256.py:9:59: F821 undefined name 'np'
parh, parv = np.meshgrid(np.linspace(0.075, 1, 16), np.linspace(0.25, 1, 16)[::-1])
^
./jsuarez/Color256.py:11:14: F821 undefined name 'np'
idxs = np.arange(256)
^
./jsuarez/Desciple.py:3:21: F821 undefined name 'pc'
self.packet = pc.Packet(entID, config, color)
^
./jsuarez/Desciple.py:4:21: F821 undefined name 'pc'
self.client = pc.Client(self.packet)
^
./jsuarez/Desciple.py:5:21: F821 undefined name 'pc'
self.server = pc.Server(config)
^
./jsuarez/Curiosity.py:2:14: F821 undefined name 'nn'
class PhiNet(nn.Module):
^
./jsuarez/Curiosity.py:5:20: F821 undefined name 'Conv2d'
self.conv1 = Conv2d(8, int(h/2), 3, stride=2)
^
./jsuarez/Curiosity.py:6:20: F821 undefined name 'Conv2d'
self.conv2 = Conv2d(int(h/2), h, 3, stride=2)
^
./jsuarez/Curiosity.py:7:18: F821 undefined name 'torch'
self.fc1 = torch.nn.Linear(5+4*4*h, h)
^
./jsuarez/Curiosity.py:8:18: F821 undefined name 'torch'
self.fc2 = torch.nn.Linear(h, h)
^
./jsuarez/Curiosity.py:11:11: F821 undefined name 'torch'
x = torch.nn.functional.relu(self.conv1(conv))
^
./jsuarez/Curiosity.py:12:11: F821 undefined name 'torch'
x = torch.nn.functional.relu(self.conv2(x))
^
./jsuarez/Curiosity.py:15:11: F821 undefined name 'torch'
x = torch.cat((x, flat))
^
./jsuarez/Curiosity.py:16:11: F821 undefined name 'torch'
x = torch.nn.functional.relu(self.fc1(x))
^
./jsuarez/Curiosity.py:21:19: F821 undefined name 'nn'
class ForwardsNet(nn.Module):
^
./jsuarez/Curiosity.py:24:19: F821 undefined name 'torch'
self.loss = torch.nn.MSELoss()
^
./jsuarez/Curiosity.py:26:18: F821 undefined name 'torch'
self.fc1 = torch.nn.Linear(NATN+h, h)
^
./jsuarez/Curiosity.py:26:34: F821 undefined name 'NATN'
self.fc1 = torch.nn.Linear(NATN+h, h)
^
./jsuarez/Curiosity.py:27:18: F821 undefined name 'torch'
self.fc2 = torch.nn.Linear(h, h)
^
./jsuarez/Curiosity.py:30:16: F821 undefined name 'torch'
atnHot = torch.zeros(NATN)
^
./jsuarez/Curiosity.py:30:28: F821 undefined name 'NATN'
atnHot = torch.zeros(NATN)
^
./jsuarez/Curiosity.py:34:11: F821 undefined name 'torch'
x = torch.cat((atnHot, phiPrev), 1)
^
./jsuarez/Curiosity.py:35:11: F821 undefined name 'torch'
x = torch.nn.functional.relu(self.fc1(x))
^
./jsuarez/Curiosity.py:42:20: F821 undefined name 'nn'
class BackwardsNet(nn.Module):
^
./jsuarez/Curiosity.py:45:19: F821 undefined name 'torch'
self.loss = torch.nn.CrossEntropyLoss()
^
./jsuarez/Curiosity.py:47:18: F821 undefined name 'torch'
self.fc1 = torch.nn.Linear(2*h, h)
^
./jsuarez/Curiosity.py:48:18: F821 undefined name 'torch'
self.fc2 = torch.nn.Linear(h, ydim)
^
./jsuarez/Curiosity.py:51:11: F821 undefined name 'torch'
x = torch.cat((phiPrev, phi), 1)
^
./jsuarez/Curiosity.py:52:11: F821 undefined name 'torch'
x = torch.nn.functional.relu(self.fc1(x))
^
./jsuarez/Curiosity.py:58:14: F821 undefined name 'nn'
class CurNet(nn.Module):
^
./jsuarez/Curiosity.py:83:22: F821 undefined name 'torch'
ri, li = 0, torch.tensor(0.0)
^
./jsuarez/Baselines.py:23:37: F821 undefined name 'Actions'
if type(actionTree.action) == Actions.Reproduce:
^
./jsuarez/Baselines.py:45:14: F821 undefined name 'Actions'
return Actions.Pass(), []
^
./jsuarez/BatchSnippets.py:15:17: F821 undefined name 'nn'
class CosineNet(nn.Module):
^
./jsuarez/BatchSnippets.py:18:20: F821 undefined name 'FeatNet'
self.feats = FeatNet(xdim, h, ydim)
^
./jsuarez/BatchSnippets.py:19:18: F821 undefined name 'torch'
self.fc1 = torch.nn.Linear(h, h)
^
./jsuarez/BatchSnippets.py:20:19: F821 undefined name 'torch'
self.ent1 = torch.nn.Linear(5, h)
^
./jsuarez/BatchSnippets.py:26:14: F821 undefined name 'torch'
ents = torch.tensor(np.array([e.stim for
^
./jsuarez/BatchSnippets.py:26:27: F821 undefined name 'np'
ents = torch.tensor(np.array([e.stim for
^
./jsuarez/BatchSnippets.py:35:10: F821 undefined name 'torch'
ret = torch.sum(x*a, dim=1).view(1, -1)
^
./jsuarez/BatchSnippets.py:36:16: F821 undefined name 'classify'
return ret, classify(ret)
^
./jsuarez/BatchSnippets.py:38:14: F821 undefined name 'nn'
class AtnNet(nn.Module):
^
./jsuarez/BatchSnippets.py:41:20: F821 undefined name 'FeatNet'
self.feats = FeatNet(xdim, h, ydim)
^
./jsuarez/BatchSnippets.py:42:19: F821 undefined name 'torch'
self.atn1 = torch.nn.Linear(h, 2)
^
./jsuarez/BatchSnippets.py:47:17: F821 undefined name 'classify'
atnIdx = classify(atn)
^
./jsuarez/BatchSnippets.py:50:19: F821 undefined name 'nn'
class ActionEmbed(nn.Module):
^
./jsuarez/BatchSnippets.py:53:20: F821 undefined name 'torch'
self.embed = torch.nn.Embedding(nEmbed, dim)
^
./jsuarez/BatchSnippets.py:62:14: F821 undefined name 'torch'
idxs = torch.tensor(idxs)
^
./jsuarez/BatchSnippets.py:74:11: F821 undefined name 'np'
return np.stack(args)
^
./jsuarez/BatchSnippets.py:78:11: F821 undefined name 'np'
return np.concatenate(args)
^
./jsuarez/BatchSnippets.py:81:10: F821 undefined name 'Arg'
arg = Arg(arg)
^
./jsuarez/BatchSnippets.py:82:10: F821 undefined name 'oneHot'
arg = oneHot(arg.val - arg.min, arg.n)
^
./jsuarez/BatchSnippets.py:87:8: F821 undefined name 'np'
x = np.zeros((r, c, dim))
^
./jsuarez/BatchSnippets.py:103:17: F821 undefined name 'torch'
atnArgsIdx = torch.stack(atnArgIdxList)
^
./jsuarez/BatchSnippets.py:104:17: F821 undefined name 'torch'
vals = torch.stack(valList).view(-1, 1)
^
./jsuarez/BatchSnippets.py:105:17: F821 undefined name 'torch'
rews = torch.tensor(rewList).view(-1, 1).float()
^
./jsuarez/CPUUtils.py:42:13: F821 undefined name 'np'
nan = np.isnan(sum([t.sum(e) for e in net.state_dict().values()]))
^
./jsuarez/CPUUtils.py:42:27: F821 undefined name 't'
nan = np.isnan(sum([t.sum(e) for e in net.state_dict().values()]))
^
./jsuarez/CPUUtils.py:48:36: F821 undefined name 'np'
if self.epoch() == 1 or vl < np.min(self.vl):
^
./jsuarez/CPUUtils.py:50:10: F821 undefined name 't'
t.save(net.state_dict(), self.root+'weights')
^
./jsuarez/CPUUtils.py:55:7: F821 undefined name 'np'
np.save(self.root + 'tl.npy', self.tl)
^
./jsuarez/CPUUtils.py:56:7: F821 undefined name 'np'
np.save(self.root + 'ta.npy', self.ta)
^
./jsuarez/CPUUtils.py:57:7: F821 undefined name 'np'
np.save(self.root + 'vl.npy', self.vl)
^
./jsuarez/CPUUtils.py:58:7: F821 undefined name 'np'
np.save(self.root + 'va.npy', self.va)
^
./jsuarez/CPUUtils.py:61:19: F821 undefined name 't'
stateDict = t.load(self.root+'weights')
^
./jsuarez/CPUUtils.py:65:17: F821 undefined name 'np'
self.tl = np.load(self.root + 'tl.npy').tolist()
^
./jsuarez/CPUUtils.py:66:17: F821 undefined name 'np'
self.ta = np.load(self.root + 'ta.npy').tolist()
^
./jsuarez/CPUUtils.py:67:17: F821 undefined name 'np'
self.vl = np.load(self.root + 'vl.npy').tolist()
^
./jsuarez/CPUUtils.py:68:17: F821 undefined name 'np'
self.va = np.load(self.root + 'va.npy').tolist()
^
./jsuarez/SkillActions.py:43:14: F821 undefined name 'Args'
return Args()
^
./jsuarez/SkillActions.py:47:15: F821 undefined name 'MeleeV2'
return [MeleeV2, Ranged]
^
./jsuarez/SkillActions.py:55:14: F821 undefined name 'SetArgs'
args = SetArgs()
^
./jsuarez/SkillActions.py:76:20: F821 undefined name 'EmptyArgs'
return EmptyArgs()
^
./jsuarez/SkillActions.py:85:14: F821 undefined name 'SetArgs'
args = SetArgs()
^
./jsuarez/SkillActions.py:105:14: F821 undefined name 'DiscreteArgs'
args = DiscreteArgs()
^
./jsuarez/SkillActions.py:108:22: F821 undefined name 'Args'
args.add(Args([itm]))
^
./jsuarez/SkillActions.py:116:14: F821 undefined name 'DiscreteArgs'
args = DiscreteArgs()
^
./jsuarez/SkillActions.py:119:22: F821 undefined name 'enums'
args.add(enums.args([itm]))
^
./jsuarez/tools/kiv.py:56:32: F821 undefined name 'sz'
tex = Texture.create(size=sz, colorfmt="rgb")
^
./jsuarez/tools/kiv.py:108:29: F821 undefined name 'Surface'
if type(container) == Surface:
^
./jsuarez/tools/RenderTest.py:65:40: F821 undefined name 'Color'
pygame.draw.rect(self.canvas, Color.RED, coords)
^
./jsuarez/tools/RenderTest.py:68:25: F821 undefined name 'Color'
self.canvas.fill((Color.BLACK))
^
./jsuarez/extra/embyr_deprecated/embyr/oldnewapi.py:166:8: F821 undefined name 'orig'
orig._mesh = cube._mesh
^
./jsuarez/extra/embyr_deprecated/embyr/oldnewapi.py:167:8: F821 undefined name 'orig'
orig.material = mat
^
./jsuarez/extra/embyr_deprecated/embyr/oldnewapi.py:168:15: F821 undefined name 'orig'
cube = orig
^
./jsuarez/extra/embyr_deprecated/embyr/modules.py:220:23: F821 undefined name 'env'
self.renderVals(env, vals, update=update)
^
./jsuarez/extra/embyr_deprecated/embyr/modules.py:225:23: F821 undefined name 'env'
self.renderVals(env, vals, update=update)
^
./jsuarez/extra/embyr_deprecated/embyr/modules.py:230:23: F821 undefined name 'env'
self.renderVals(env, vals, update=update)
^
./jsuarez/extra/embyr_deprecated/embyr/modules.py:251:21: F821 undefined name 'valF'
self.val = valF(0, 36)
^
./jsuarez/extra/embyr_deprecated/embyr/modules.py:252:23: F821 undefined name 'env'
self.renderVals(env, self.val, update)
^
./jsuarez/extra/embyr_deprecated/embyr/modules.py:256:21: F821 undefined name 'valF'
self.val = valF(36, 0)
^
./jsuarez/extra/embyr_deprecated/embyr/modules.py:257:23: F821 undefined name 'env'
self.renderVals(env, self.val, update)
^
./jsuarez/extra/embyr_deprecated/embyr/modules.py:261:21: F821 undefined name 'valF'
self.val = valF(18, 18)
^
./jsuarez/extra/embyr_deprecated/embyr/modules.py:262:23: F821 undefined name 'env'
self.renderVals(env, self.val, update)
^
./jsuarez/extra/embyr_deprecated/embyr/modules.py:266:21: F821 undefined name 'valF'
self.val = valF(0, 0)
^
./jsuarez/extra/embyr_deprecated/embyr/modules.py:267:23: F821 undefined name 'env'
self.renderVals(env, self.val, update)
^
./jsuarez/extra/embyr_deprecated/embyr/embyr.py:295:21: F821 undefined name 'color12'
twelveColor = color12()
^
./jsuarez/extra/embyr_deprecated/embyr/render.py:39:19: F821 undefined name 'cartCoords'
ww, hh = cartCoords(w, h, key)
^
./jsuarez/extra/embyr_deprecated/embyr/render.py:206:48: F821 undefined name 'w'
renderHist(screen, fonts, timesAlive, 0, H, w, h)
^
./jsuarez/extra/embyr_deprecated/embyr/render.py:206:51: F821 undefined name 'h'
renderHist(screen, fonts, timesAlive, 0, H, w, h)
^
./jsuarez/extra/embyr_deprecated/embyr/enums.py:58:24: F821 undefined name 'systems'
self.dropTable = systems.DropTable()
^
./jsuarez/extra/embyr_deprecated/embyr/enums.py:59:26: F821 undefined name 'ore'
self.dropTable.add(ore.Copper, 1)
^
./jsuarez/extra/embyr_deprecated/embyr/enums.py:153:21: F821 undefined name 'color12'
twelveColor = color12()
^
./jsuarez/extra/embyr_deprecated/embyr2d/modules.py:222:23: F821 undefined name 'env'
self.renderVals(env, vals, update=update)
^
./jsuarez/extra/embyr_deprecated/embyr2d/modules.py:227:23: F821 undefined name 'env'
self.renderVals(env, vals, update=update)
^
./jsuarez/extra/embyr_deprecated/embyr2d/modules.py:232:23: F821 undefined name 'env'
self.renderVals(env, vals, update=update)
^
./jsuarez/extra/embyr_deprecated/embyr2d/modules.py:253:21: F821 undefined name 'valF'
self.val = valF(0, 36)
^
./jsuarez/extra/embyr_deprecated/embyr2d/modules.py:254:23: F821 undefined name 'env'
self.renderVals(env, self.val, update)
^
./jsuarez/extra/embyr_deprecated/embyr2d/modules.py:258:21: F821 undefined name 'valF'
self.val = valF(36, 0)
^
./jsuarez/extra/embyr_deprecated/embyr2d/modules.py:259:23: F821 undefined name 'env'
self.renderVals(env, self.val, update)
^
./jsuarez/extra/embyr_deprecated/embyr2d/modules.py:263:21: F821 undefined name 'valF'
self.val = valF(18, 18)
^
./jsuarez/extra/embyr_deprecated/embyr2d/modules.py:264:23: F821 undefined name 'env'
self.renderVals(env, self.val, update)
^
./jsuarez/extra/embyr_deprecated/embyr2d/modules.py:268:21: F821 undefined name 'valF'
self.val = valF(0, 0)
^
./jsuarez/extra/embyr_deprecated/embyr2d/modules.py:269:23: F821 undefined name 'env'
self.renderVals(env, self.val, update)
^
./jsuarez/extra/embyr_deprecated/embyr2d/embyr.py:279:21: F821 undefined name 'color12'
twelveColor = color12()
^
./jsuarez/extra/embyr_deprecated/embyr2d/render.py:39:19: F821 undefined name 'cartCoords'
ww, hh = cartCoords(w, h, key)
^
./jsuarez/extra/embyr_deprecated/embyr2d/render.py:206:48: F821 undefined name 'w'
renderHist(screen, fonts, timesAlive, 0, H, w, h)
^
./jsuarez/extra/embyr_deprecated/embyr2d/render.py:206:51: F821 undefined name 'h'
renderHist(screen, fonts, timesAlive, 0, H, w, h)
^
157 F821 undefined name 'np'
157
E901,E999,F821,F822,F823 are the "showstopper" flake8 issues that can halt the runtime with a SyntaxError, NameError, etc. These 5 are different from most other flake8 issues which are merely "style violations" -- useful for readability but they do not effect runtime safety.
name
name
in __all__
$ flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics