Add with ... as ... usage#1117
Add with ... as ... usage#1117JianzhengLuo wants to merge 34 commits intopy-pdf:mainfrom JianzhengLuo:add-with-as-usage-#1108
with ... as ... usage#1117Conversation
Co-authored-by: Matthew Peveler <matt.peveler@gmail.com>
…ebackType` is from `typing` but from `types`.
|
Already modified according to @MasterOdin requested changes, but why can't this request merge? |
MasterOdin
left a comment
There was a problem hiding this comment.
If you click "Details" for any of the failed test runs, you will see the error that's happening:
PyPDF2/_writer.py:169: error: Function is missing a type annotation [no-untyped-def]
PyPDF2/_writer.py:173: error: Function is missing a return type annotation [no-untyped-def]
PyPDF2/_writer.py:821: error: Argument 1 to "write_stream" of "PdfWriter" has incompatible type "Union[str, BytesIO, BufferedReader, BufferedWriter, FileIO]"; expected "Union[BytesIO, BufferedReader, BufferedWriter, FileIO]" [arg-type]
PyPDF2/_writer.py:824: error: Item "str" of "Union[str, BytesIO, BufferedReader, BufferedWriter, FileIO]" has no attribute "close" [union-attr]
PyPDF2/_merger.py:101: error: Function is missing a return type annotation [no-untyped-def]
We currently don't have a dedicated contributors page / document. I was thinking about adding it though :-) #798 |
Currently several tests fail because they are missing type annotations: @MasterOdin has already added change requests that would fix those. You just need to merge them :-) |
Co-authored-by: Matthew Peveler <matt.peveler@gmail.com>
Co-authored-by: Matthew Peveler <matt.peveler@gmail.com>
Co-authored-by: Matthew Peveler <matt.peveler@gmail.com>
Co-authored-by: Matthew Peveler <matt.peveler@gmail.com>
…gLuo/PyPDF2 into add-with-as-usage-#1108
Codecov Report
@@ Coverage Diff @@
## main #1117 +/- ##
==========================================
- Coverage 92.10% 91.82% -0.28%
==========================================
Files 24 24
Lines 4913 4699 -214
Branches 1017 968 -49
==========================================
- Hits 4525 4315 -210
+ Misses 244 237 -7
- Partials 144 147 +3
Continue to review full report at Codecov.
|
|
What's the problem again? |
|
@MartinThoma @MasterOdin Are you busy these days? I requested a review two days ago, but I didn't get a response till now, what happened? |
|
@JianzhengLuo Please be patient - we probably all have full-time jobs and other things going on in our lives. For me, I say that there is currently a heat wave in Germany which means my appartment is at 32°C and more all the time - that makes pretty much anything where I need to think really hard. |
MartinThoma
left a comment
There was a problem hiding this comment.
Could you please add a unit test? If you need help with that, just let me know :-)
I'm sorry for making you angry, I knew that clearly - it's a volunteer job. You know, language is interesting, I just wanted to see what can I do for you, since adults are much busier than children. But when you read this, you might feel angry that I was not patiently and not considerate of you. Maybe next time I can add a emoji so the atmosphere will be more relaxing. |
|
Hmm... The problems caused by |
|
Some |
|
The encryption issue is weird, but let's first focus on the problem where I know how to fix it:
This one should fix several issues: def merger_operate(merger):
pdf_path = os.path.join(RESOURCE_ROOT, "crazyones.pdf")
outline = os.path.join(RESOURCE_ROOT, "pdflatex-outline.pdf")
merger.append(pdf_path)
merger.append(outline) |
In that way, how could we test the other features in the original code? Do you mean we do this first to see where the problem is? After I did what you said, and removed the uncorrelated test files such as FAILED tests/test_merger.py::test_trim_outline_list - PyPDF2.errors.PdfReadError: Cannot read an empty file
FAILED tests/test_merger.py::test_sweep_recursion2[https://corpora.tika.apache.org/base/docs/govdocs1/924/924794.pdf-tika-924794.pdf] - PyPDF2.errors.PdfReadError: Cannot read an empty file
FAILED tests/test_writer.py::test_encrypt[True] - SystemError: more argument specifiers than keyword list entries (remaining format:'s#')
FAILED tests/test_writer.py::test_encrypt[False] - SystemError: more argument specifiers than keyword list entries (remaining format:'s#')And then? @MartinThoma By the way, why can't I re-request review to you? |
Co-authored-by: Martin Thoma <info@martin-thoma.de>
… workflow Co-authored-by: Martin Thoma <info@martin-thoma.de>
… the existing workflow Co-authored-by: Matthew Peveler <matt.peveler@gmail.com>
MartinThoma
left a comment
There was a problem hiding this comment.
Could you please take care of those issues?
./PyPDF2/_writer.py:820:12: F821 undefined name 'fileobj'
./PyPDF2/_writer.py:821:48: F821 undefined name 'fileobj'
./PyPDF2/_writer.py:823:23: F821 undefined name 'fileobj'
./PyPDF2/_writer.py:824:30: F821 undefined name 'fileobj'
Very, very sorry for that! That wasn't an error before the commit a7346ef. I will fix that immediately. |
|
No problem - don't worry :-) |
|
I'm happy that you're working on this improvement - there isn't much missing to finish it. I realize that it becomes frustrating when the PR is not merged for so long. If you want, I can finish it. Just let me know :-) |
It seems that I am annoying you, sorry for that! As the errors are too wired, since I didn't even change anything, than finish it if you like! Thank you. |
No - everything is good 🤗 Don't worry :-) |
with ... as ... usage (#1108)with ... as ... usage
|
@JianzhengLuo Your PR (now #1193 ) will be merged this week :-) Thank you for all the effort you put into it 🤗 I've added you to the CONTRIBUTORS.md file - if you want another text / a link to some profile, just let me know |
Check the code, please?
By the way, would you like to add me into the Contributors of this project?