Code Monkey home page Code Monkey logo

Comments (3)

janosh avatar janosh commented on June 12, 2024

Are you sure you're running the latest code? It should prompt you to download that file on the fly if it doesn't exist yet. Maybe this answer = "" if sys.stdin.isatty() else "y" doesn't work as I expect...

class DataFiles(Files):
"""Data files provided by Matbench Discovery.
See https://janosh.github.io/matbench-discovery/contribute for data descriptions.
"""
def _on_not_found(self, key: str, msg: str) -> None: # type: ignore[override]
msg += (
" Would you like to download it now using matbench_discovery."
f"data.load_train_test({key!r}). This will cache the file for future use."
)
# default to 'y' if not in interactive session, and user can't answer
answer = "" if sys.stdin.isatty() else "y"
while answer not in ("y", "n", "\x1b", ""):
answer = input(f"{msg} [y/n] ").lower().strip()
if answer == "y":
load_train_test(key) # download and cache data file

from matbench-discovery.

pbenner avatar pbenner commented on June 12, 2024

The isatty() check is ok. The error is one line below:

while answer not in ("y", "n", "\x1b", ""):

Instead of

        while answer not in ("y", "n", "\x1b", ""):
            answer = input(f"{msg} [y/n] ").lower().strip()

You should use

        while answer not in ("y", "n", "\x1b"):
            answer = input(f"{msg} [y/n] ").lower().strip()

With this fix, the query appears and when answering yes the file is downloaded and cached.

from matbench-discovery.

janosh avatar janosh commented on June 12, 2024

while answer not in ("y", "n", "\x1b"):

Oops, that was committed by accident. I'd briefly considered trying to support ESCAPE to answer "no" but then decided against and forgot to remove this.

from matbench-discovery.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.