Code Monkey home page Code Monkey logo

parsel's People

Contributors

ezelikman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

parsel's Issues

Crash on "no tests no args" input

On the following input (calc_no_tests_no_args.ss):

given a string containing numbers and operators in reverse polish notation, calculate the result. The expression is given as a list of numbers and operators. Each number may be one of the following: integer, float. You can assume that the expression is always valid.

I get the following backtrace:

python3 parsel.py ./programs/calc_no_tests_no_args.ss  -g -n
python3 parsel.py ./programs/calc_no_tests_no_args.ss  -g -n
Added args: ['rpn_calculator(expression)', 'stack = []', 'for item in expression:', 'if is_number(item):', 'stack.append(item)', 'else:', 'stack.append(apply_operator(item, stack.pop(), stack.pop()))', 'return stack.pop()']
Added args: ['calculate_rpn(expression)', 'stack = []', 'for item in expression:', "if item in '+-*/':", 'b = stack.pop()', 'a = stack.pop()', 'stack.append(eval(a + item + b))', 'else:', 'stack.append(item)', 'return stack[0]']
Added args: ['rpn_calculator(expression)', 'stack = []', 'for item in expression:', 'if is_number(item):', 'stack.append(item)', 'else:', 'stack.append(apply_operator(item, stack.pop(), stack.pop()))', 'return stack.pop()']
Added args: ['rpn(expression)', 'stack = []', 'for item in expression:', "if item in ['+', '-', '*', '/']:", 'a = stack.pop()', 'b = stack.pop()', "if item == '+':", 'stack.append(a + b)', "elif item == '-':", 'stack.append(a - b)', "elif item == '*':", 'stack.append(a * b)', "elif item == '/':", 'stack.append(a / b)', 'else:', 'stack.append(item)', 'return stack.pop()']
Added args: ['rpn_calculator(expression)', 'stack = []', 'for i in expression:', "if i in ['+', '-', '*', '/']:", 'a = stack.pop()', 'b = stack.pop()', "if i == '+':", 'stack.append(a + b)', "elif i == '-':", 'stack.append(b - a)', "elif i == '*':", 'stack.append(a * b)', "elif i == '/':", 'stack.append(b / a)', 'else:', 'stack.append(i)', 'return stack.pop()']
Added args: ['rpn_calculator(expression)', 'stack = []', 'for i in expression:', "if i in ['+', '-', '*', '/']:", 'a = stack.pop()', 'b = stack.pop()', "if i == '+':", 'stack.append(a + b)', "elif i == '-':", 'stack.append(a - b)', "elif i == '*':", 'stack.append(a * b)', "elif i == '/':", 'stack.append(a / b)', 'else:', 'stack.append(i)', 'return stack.pop()']
Added args: ['rpn_calculator(expression)', 'stack = []', 'for element in expression:', "if element in ['+', '-', '*', '/']:", 'a = stack.pop()', 'b = stack.pop()', "if element == '+':", 'stack.append(a + b)', "elif element == '-':", 'stack.append(a - b)', "elif element == '*':", 'stack.append(a * b)', "elif element == '/':", 'stack.append(a / b)', 'else:', 'stack.append(element)', 'return stack.pop()']
Added args: ['rpn_calculator(expression)', 'stack = []', 'for element in expression:', 'if is_number(element):', 'stack.append(element)', 'else:', 'b = stack.pop()', 'a = stack.pop()', 'stack.append(apply_operator(element, a, b))', 'return stack.pop()']
Traceback (most recent call last):
  File "/Users/haldar/parsel/parsel.py", line 650, in <module>
    parsel(codegen, args.source_file, allow_autofill=args.allow_autofill, should_expand=args.allow_expand, debug=debug, add_name_and_args=args.add_name_and_args)
  File "/Users/haldar/parsel/parsel.py", line 617, in parsel
    _, defined_fns = get_graph(program)
  File "/Users/haldar/parsel/graph.py", line 42, in get_graph
    for cur_line in program:
TypeError: 'NoneType' object is not iterable

"code-davinci-002" does not exist error on colab

Implementing SCC 0 {'select_airport_cities'}
Implementing SCC 1 {'sky_city_cost'}
Trying 8 completions
Calling Codex!
8 completions 500 tokens each
Error The model: `code-davinci-002` does not exist
Trying 16 completions
Calling Codex!
8 completions 500 tokens each
Error The model: `code-davinci-002` does not exist
Trying 32 completions
Calling Codex!
8 completions 500 tokens each
Error The model: `code-davinci-002` does not exist
Trying 64 completions
Calling Codex!
8 completions 500 tokens each
Error The model: `code-davinci-002` does not exist
Traceback (most recent call last):
  File "/content/parsel/parsel.py", line 650, in <module>
    parsel(codegen, args.source_file, allow_autofill=args.allow_autofill, should_expand=args.allow_expand, debug=debug, add_name_and_args=args.add_name_and_args)
  File "/content/parsel/parsel.py", line 622, in parsel
    defined_fns = parsel_graph(defined_fns, codegen, allow_autofill, should_expand, debug)
  File "/content/parsel/parsel.py", line 590, in parsel_graph
    implement_scc(scc_idx, sccs, implemented_sccs, scc_edges, defined_fns, codegen, allow_autofill, should_expand, debug, sample_only)
  File "/content/parsel/parsel.py", line 496, in implement_scc
    dependencies_str += implement_scc(edge, sccs, implemented_sccs, scc_edges, defined_fns, codegen, allow_autofill, should_expand, debug)
  File "/content/parsel/parsel.py", line 537, in implement_scc
    raise error
  File "/content/parsel/parsel.py", line 506, in implement_scc
    fn.implement(codegen, num_completions=num_completions)
  File "/content/parsel/fn.py", line 103, in implement
    self.implementations = codex.generate(
  File "/content/parsel/codex.py", line 70, in generate
    completions = openai.Completion.create(
  File "/usr/local/lib/python3.10/dist-packages/openai/api_resources/completion.py", line 25, in create
    return super().create(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/openai/api_resources/abstract/engine_api_resource.py", line 153, in create
    response, _, api_key = requestor.request(
  File "/usr/local/lib/python3.10/dist-packages/openai/api_requestor.py", line 230, in request
    resp, got_stream = self._interpret_response(result, stream)
  File "/usr/local/lib/python3.10/dist-packages/openai/api_requestor.py", line 624, in _interpret_response
    self._interpret_response_line(
  File "/usr/local/lib/python3.10/dist-packages/openai/api_requestor.py", line 687, in _interpret_response_line
    raise self.handle_error_response(
openai.error.InvalidRequestError: The model: `code-davinci-002` does not exist

I logged in and tried to run the cell with command !python3 parsel.py programs/problem_solving.ss

rate limit issues

image

running into some rate limit issues with OAI

is this expected behavior -- i.e. should i ask support to raise my limits?

How to make a virtual environment for this?

I did something like:

cleanLines = []
with open('requirements.txt', 'r') as req_file:
    for line in req_file:
        cline = line.split('==')[0].strip()
        print(line.split('==')[0].strip())
        cleanLines.append(cline)
        
with open('requirements_clean.txt', 'w') as newFile:
    for line in cleanLines:
        newFile.write(f'{line}\n')

but deleted the 3 anaconda packages since I have miniconda they seemed redundant and now get stuck on colorama

Collecting colorama
  Downloading colorama-0.4.6-py2.py3-none-any.whl (25 kB)
ERROR: Could not find a version that satisfies the requirement conda (from versions: 3.0.6, 3.5.0, 3.7.0, 3.17.0, 4.0.0, 4.0.1, 4.0.2, 4.0.3, 4.0.4, 4.0.5, 4.0.7, 4.0.8, 4.0.9, 4.1.2, 4.1.6, 4.2.6, 4.2.7, 4.3.13, 4.3.16)
ERROR: No matching distribution found for conda

Could you push a more "generic" requirements.txt with the minimal packages needed?

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.