Post-processing for HumanEval code generations not working properly
### System Info

Not system-dependent

### Who can help?


### Information

- [X]  The official example scripts
- [ ] My own modified scripts

### Tasks

- [X]  An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)
- [ ] My own task or dataset (give details below)

### Reproduction

The post-processing function for HumanEval code generation in CodeParrot doesn't work as expected, precisely this function 
https://github.com/huggingface/transformers/blob/d6eeb871706db0d64ab9ffd79f9545d95286b536/examples/research_projects/codeparrot/scripts/human_eval.py#L67
It returns an empty string if no EOF_STRING is present:
```python
EOF_STRINGS = ["\nprint"]
def remove_last_block(string):
    """Remove the last block of the code containing EOF_STRINGS"""
    string_list = re.split("(%s)" % "|".join(EOF_STRINGS), string)
    # last string should be ""
    return "".join(string_list[:-2])

example = "def somme(x,y)\n  return x+y"
print(f"example :\n{remove_last_block(example)}")
```

```
example :

```
Going to an old version of the repo, I found we had this function instead which works properly so I'm wondering why we changed it, it would also be more practical in case no stopping criteria at EOF_STRINGs was used during the generation as it only keeps the first block
```python
def first_block(string):
    """Split off first block of code by scanning for class, def etc. on newlines."""
    return re.split("|".join(EOF_STRINGS), string)[0].rstrip()

print(f"example :\n{first_block(example)}")
```
```
example :
def somme(x,y)
  return x+y
```
Update: the case I mentioned would never occur with the stoppingcriteria in codeparrot as all generation should include an eof_string so no bug https://github.com/huggingface/transformers/blob/d6eeb871706db0d64ab9ffd79f9545d95286b536/examples/research_projects/codeparrot/scripts/human_eval.py#L59