leetcode-cli icon indicating copy to clipboard operation
leetcode-cli copied to clipboard

leetcode list -p plan1 filtering not working

Open eleijonmarck opened this issue 3 years ago • 5 comments

Hey, followed the example from

# ~/.leetcode/scripts/plan1.py
import json;

def plan(sps, stags):
    ##
    # `print` in python is supported, 
    # if you want to know the data structures of these two args, 
    # just print them
    ##
    problems = json.loads(sps)
    tags = json.loads(stags)
	
    ret = []
    tm = {}
    for tag in tags:
        tm[tag["tag"]] = tag["refs"];

    for i in problems:
        if i["level"] == 1 and str(i["id"]) in tm["linked-list"]:
            ret.append(str(i["id"]))

    # return is `List[string]`
    return ret
$ ls ~/.leetcode/scripts
blind75.py plan1.py
leetcode list -p plan1

...
  🔒    [2282] Number of People That Can Be Seen in a Grid                  Medium (50.67 %)
  🔒    [2291] Maximum Profit From Trading Stocks                           Medium (48.73 %)
  🔒    [2292] Products With Three or More Orders in Two Consecutive Years  Medium (36.96 %)
  🔒    [2298] Tasks Count in the Weekend                                   Medium (87.84 %)
  🔒    [2308] Arrange Table by Gender                                      Medium (78.74 %)
  🔒    [2314] The First Day of the Maximum Recorded Degree in Each City    Medium (79.27 %)
  🔒    [2324] Product Sales Analysis IV                                    Medium (87.50 %)
  🔒    [2329] Product Sales Analysis V                                     Medium (82.71 %)
  🔒    [2323] Find Minimum Time to Finish All Jobs II                      Medium (78.78 %)
  🔒    [2330] Valid Palindrome IV                                          Medium (78.99 %)
 ...

Still getting all of the problems

eleijonmarck avatar Jul 11 '22 09:07 eleijonmarck

https://github.com/clearloop/leetcode-cli/blob/c6873f0194ba5b8d9d4b3c21b08c0ef61daefde8/Cargo.toml#L50

Hey @eleijonmarck , try reinstall leetcode-cli with cargo install leetcode-cli --features pym !

clearloop avatar Jul 11 '22 14:07 clearloop

thats okay, i just do not want to download the nightly or dev builds.

$ cargo install leetcode-cli --features pym

...
error: failed to run custom build command for `pyo3 v0.8.5`

Caused by:
  process didn't exit successfully: `/var/folders/tf/md89rf0x6l10l39lmd7r3rn00000gn/T/cargo-installeyxep6/release/build/pyo3-0019e4bb55db8eca/build-script-build` (exit status: 101)
  --- stderr
  thread 'main' panicked at 'Error: pyo3 requires a nightly or dev version of Rust.', /Users/eleijonmarck/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.8.5/build.rs:542:9
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: failed to compile `leetcode-cli v0.3.11`, intermediate artifacts can be found at `/var/folders/tf/md89rf0x6l10l39lmd7r3rn00000gn/T/cargo-installeyxep6`

eleijonmarck avatar Jul 12 '22 05:07 eleijonmarck

sry

cargo +nightly install leetcode-cli --features pym

this feature requires nightly toolchain

clearloop avatar Jul 12 '22 06:07 clearloop

1 % cargo +nightly install leetcode-cli --features pym

error: toolchain 'nightly-aarch64-apple-darwin' is not installed
(base)

on m1 unfortunately so it does not work :(

even following: https://www.reddit.com/r/rust/comments/lleh8v/having_trouble_compiling_on_apple_m1/

Current installation options:


   default host triple: nightly-aarch64-apple-darwin
     default toolchain: stable
               profile: default
  modify PATH variable: yes

eleijonmarck avatar Jul 14 '22 13:07 eleijonmarck

I'll try to upgrade the deps of that feature and see if pyo3 have stable feature releases

clearloop avatar Jul 14 '22 14:07 clearloop