Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

Undefined names in Python code #2

Open
cclauss opened this issue Nov 24, 2022 · 4 comments
Open

Undefined names in Python code #2

cclauss opened this issue Nov 24, 2022 · 4 comments
Assignees

Comments

@cclauss
Copy link

cclauss commented Nov 24, 2022

% flake8 . --count --select=E9,F63,F7,F82,Y --show-source --statistics

./dipcc/python/datc/parse_datc.py:124:32: F821 undefined name 'test_strs'
            print(f"{i} / {len(test_strs)}\tavg={stats_t/(stats_count+.0001)}")
                               ^
./dipcc/python/datc/parse_datc.py:125:19: F821 undefined name 's'
            print(s, pformat(orders), result_str, sep="\n\n")
                  ^
./fairdiplomacy/agents/__init__.py:11:82: F821 undefined name 'BaseAgent'
def build_agent_from_cfg(agent_stanza: "conf.agents_cfgs.Agent", **redefines) -> "BaseAgent":
                                                                                 ^
./fairdiplomacy/selfplay/pg/data_loader.py:327:49: F821 undefined name 'conf'
    def __init__(self, model_path, rollout_cfg: "conf.conf_cfgs.ExploitTask.Rollout"):
                                                ^
./fairdiplomacy/selfplay/search/rollout.py:360:29: F821 undefined name 'observations'
            if right >= len(observations):
                            ^
./fairdiplomacy/selfplay/search/rollout.py:363:28: F821 undefined name 'scores'
            final_scores = scores[-1]
                           ^
./fairdiplomacy/selfplay/search/rollout.py:365:17: F821 undefined name 'observations'
            del observations[right:]
                ^
./fairdiplomacy/selfplay/search/rollout.py:366:17: F821 undefined name 'is_explore'
            del is_explore[right:]
                ^
./fairdiplomacy/selfplay/search/rollout.py:367:17: F821 undefined name 'scores'
            del scores[right:]
                ^
./fairdiplomacy/selfplay/search/rollout.py:379:13: F821 undefined name 'scores'
            scores[-1] = final_scores
            ^
./heyhi/bin/patch_protos.py:127:38: F821 undefined name 'NestedDictList'
    NestedDictList = Union[Dict[str, "NestedDictList"], List["NestedDictList"], Scalar]
                                     ^
./heyhi/bin/patch_protos.py:127:62: F821 undefined name 'NestedDictList'
    NestedDictList = Union[Dict[str, "NestedDictList"], List["NestedDictList"], Scalar]
                                                             ^
./heyhi/bin/patch_protos.py:195:16: F821 undefined name 'FROZEN_SYM_BD'
        return FROZEN_SYM_BD[descriptor.full_name](ret, self)
               ^
13    F821 undefined name 'test_strs'
13
@adamlerer
Copy link
Contributor

I think some of these are intentional (e.g. the string type names).

The ones in rollout.py look like real bugs, I'll assign to @akhti to fix. Thanks!

@dbl001
Copy link

dbl001 commented Jan 9, 2023

Where is 'FROZEN_SYM_BD' supposed to be declared?

@c-flaherty
Copy link
Contributor

Screen Shot 2023-01-19 at 12 26 55 PM

I see that the rollout.py variable names are defined right above this function. I think we can fix by using nonlocal on these so flake8 knows where to look?

@c-flaherty
Copy link
Contributor

Where is 'FROZEN_SYM_BD' supposed to be declared?

See @lightvector 's comment in #20.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants