seri/gettc

Method signature parsing error resulted in template failure

Closed this issue · 6 comments

When method signature is not present, stderr is printed and the erb is failing to convert the template to file.

Example problem method signature:

Definition
--
  | Class:ChessMetricMethod:howManyParameters:int, int[], int[], intReturns:longMethod signature:long howMany(int size, int[] start, int[] end, int numMoves)(be sure your method is public) | Class: | ChessMetric | Method: | howMany | Parameters: | int, int[], int[], int | Returns: | long | Method signature: | long howMany(int size, int[] start, int[] end, int numMoves) | (be sure your method is public)
Class: | ChessMetric
Method: | howMany
Parameters: | int, int[], int[], int
Returns: | long
Method signature: | long howMany(int size, int[] start, int[] end, int numMoves)
(be sure your method is public)

Sample error output:

gettc 1592
ChessMetric was used for TopCoder Collegiate Challenge Round 4 - Division I, Level One.
[Warning] No definition for method signature found
Template error ($HOME/.gettc/template/solve/go/{name}Solver.go)
undefined method `map' for nil:NilClass

Another problem which causes the same issue:

Definition
--
  | Class:JewelryMethod:howManyParameters:int[]Returns:longMethod signature:long howMany(int[] values)(be sure your method is public) | Class: | Jewelry | Method: | howMany | Parameters: | int[] | Returns: | long | Method signature: | long howMany(int[] values) | (be sure your method is public)
Class: | Jewelry
Method: | howMany
Parameters: | int[]
Returns: | long
Method signature: | long howMany(int[] values)
(be sure your method is public)
seri commented

@yangchenyun when i access this page with my topcoder account https://community.topcoder.com/stat?c=problem_statement&pm=1592, i see an empty problem statement, so it looks like gettc couldn't get access to this problem statement and hence the errors

Hey @seri, thanks for debugging this. This is what it looks like when I get that URL:

Screen Shot 2019-03-08 at 5 49 10 PM

The problem name is parsed correctly, so I assume the page content is there. For a method signature parsing, when it failed, is it reasonable to provide some default signature?

seri commented

@yangchenyun i just checked again and this time i was able to access the same problem statement in the screenshot. i then ran gettc 1592 and it works! i was able to run the Go solution as well.

can you maybe try in a different machine? and also make sure that you are running the latest version of gettc.

Uhm, it could be different result from the web page itself.
I am running the latest gettc:

> gettc version
2.1

I will try running on a different machine or different user account.

seri commented

hmm yeah the TopCoder server itself returning a different html is a possibility, fyi i just checked again. gettc 1592 is still working on my end.

I tried this morning and now both problems worked; it could be a temporary issue with TopCoder. (From time to time I also get the empty html you have received as well)
Let's close the ticket for now and I will keep an eye on future problems.