« first day (3843 days earlier)      last day (1330 days later) » 
02:00 - 19:0019:00 - 00:00

19:02
@Kevin I believe it's not inherently part of the builtins module, but added there retroactively by site.py or something
And before anyone asks: No, I have no idea what site.py is
whatever is loaded without -S, I bet
$ python -S
>>> exit
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'exit' is not defined
... what is that?
now you're forever trapped inside the python REPL with no way out
(not-so?) interestingly import site manually doesn't pull in the exit name, nor does it put it into builtins
634 lines of /path/to/python/Lib/site.py
first 70 are a module docstring so that might tell us something :P
Note that bletch is omitted because it doesn't exist; bar precedes foo
because bar.pth comes alphabetically before foo.pth; and spam is
omitted because it is not mentioned in either path configuration file.
I see.
Very enlightening indeed
19:14
@PSSolanki You can access the full chat room in the browser from your phone, though I'd have to remind myself how. a) the app is garbage and b) the default mobile view is also awful. I view it as the full chat site even in mobile, but it does limit me a bit
no, scratch that
def setquit():
    """Define new builtins 'quit' and 'exit'.

    These are objects which make the interpreter exit when called.
    The repr of each object contains a hint at how it works.

    """
    if os.sep == '\\':
        eof = 'Ctrl-Z plus Return'
    else:
        eof = 'Ctrl-D (i.e. EOF)'

    builtins.quit = _sitebuiltins.Quitter('quit', eof)
    builtins.exit = _sitebuiltins.Quitter('exit', eof)
things like copyright are also set here
I can also see some blatant PEP 8 violations in the module
It's the stdlib, what did you expect
@roganjosh Was talking about this @roganjosh
Good code? Ha! Get outta here
PEP8? ha, that's for python, not for us!..o wait
19:17
stdlib: We don't do that here
Ah, and import site intentionally doesn't do most of its things when -S is passed
@CoolCloud Sure. I know what you were referring to, but not the context of the chat you were having :P
# Prevent extending of sys.path when python was started with -S and
# site is imported later.
if not sys.flags.no_site:
    main()
And it's main() that calls setquit() and friends.
something something defaultdict something roganjosh
$ python -S
>>> exit
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'exit' is not defined
>>> import site
>>> exit
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'exit' is not defined
>>> site.setquit()
>>> exit
Use exit() or Ctrl-D (i.e. EOF) to exit
19:19
@roganjosh Like to me, what you guys mostly talk is gibberish :p
I feel infinitesimally enlightened. Not sure about the return on investment on these 20 minutes.
We appreciate your contribution to science
I mean, I feel smarter for adding -S to my list of things to research
IgNobel material right there
I wanted to study alot more about programming once my high school is done. Its not getting over, the exams are getting postponed always (ugh). Initially it was on feb, got changed to may, now to june and potential to be postponed more!
19:26
Hey guys- Anyone know how to export the first page of a PDF as a JPG or PNG without a module (or dependency of the module) licensed under a copyleft license? (examples include Wand, which uses ImageMagick which uses Ghostscript which is under AGPL, or pdf2image with Poppler, also under GNU GPL)
@CoolCloud I'm really sorry for you guys :(
@roganjosh Its because Indian education system solely depends on exams, without it, there is no evaluation AT ALL. So its a must, but the situations is impossible.
Hopefully things get better :D
At least it's only for a few months. You'll make up for it once you're out of High School
@bobtho'-' just so I understand correctly, you're saying that those examples are copyleft, right? But you're looking for a python library without dependencies... somehow?
Yes; that is correct (looked forever xD)
19:29
already "create a JPG" doesn't sound easy "without dependencies"
Well, without dependencies licensed under GPL
Ah, got it
python's ecosystem is too liberal for your purposes
@roganjosh probably to use and distribute it without opensourcing
It's part of a much larger project that we plan to distribute; part of that project means OCR-ing some PDFs, which means using pytesseract which means converting to an image
19:31
There are plenty of licenses for opensource libraries where you don't have to post the code you're using to make money from them
If that's the case, any other OCR engines (also licensed non-copyleft)?
I don't think I understand this at all
Actually, ok, I do. I didn't think I've hit a single library that forces me to publish the source, but apparently now I have
Technically you only have to give the source to your users, but that's mostly a technical distinction.
Wait, it's on an Apache 2 license?
What is?
19:38
I'm back to not understanding this at all
pytesseract
Licensing is very confusing
And I think you've got confused. Apache 2.0 is extremely liberal
TLDRLegal doesn't say "must...distribute source" tldrlegal.com/license/apache-license-2.0-(apache-2.0)
let me check what GPL looks like
"must...disclose source"
My understanding of GPL is that you must distribute the source code and license it under equivalent terms...
19:41
> All code linked with GPL 3.0 source code must be disclosed under a GPL 3.0 compatible license.
> The GPL prohibits sublicensing, yet each user that receives the software automatically has the right to run, modify and distribute the work.
looks like it
I think that's one of the criticisms against GPL, that it spreads on whatever it touches.
The Apache licence doesn't require you to disclose the source. Why are we talking about GPL?
Ugh, another license mess
Because pytesseract requires you to translate to PNG before parsing it
@roganjosh because I wanted to know what it looks like when you do have to disclose the source. You suggested that "apache 2.0 is extremely liberal" which sounded like you were saying "apache 2.0 won't work for you because it will also make you open-source your code". I looked up that it did not.
In fact, I wonder now how many libraries just slap a licence on their code that is invalid for the libraries they rely on
@roganjosh probably a lot
19:46
HI, can someone please help me I am stuck in this for 2 hours ...
what is Regular Expression for math just \n in this string:
a = "aosdlfsf\r\nAndHow\nHello"
i mean don't math \r\n ..just math \n... THANSK
@AndrasDeak Sorry, I realised after posting that I wasn't clear. I'm both a contributor to an Apache 2.0 library and I make other people money using it. At some point I'll get some win from this setup...
@Mostafa What do you mean "for math"...
Match.
@Mostafa look up "negative lookbehind" in the re docs
@bobtho'-'Match
Oh yeah...
19:49
@roganjosh Yea I hope so :D
@AndrasDeak ok thanks
@Mostafa let me know if you need help afterward
@AndrasDeak yes please help... my mind is blowing from coding for 8 hours now..
@Mostafa well, did you find it in the docs?
(?<!...)
Matches if the current position in the string is not preceded by a match for .... This is called a negative lookbehind assertion. Similar to positive lookbehind assertions, the contained pattern must only match strings of some fixed length. Patterns which start with negative lookbehind assertions may match at the beginning of the string being searched.
@AndrasDeak no
19:58
@Mostafa how hard did you look?
"ok thanks" was so promising :(
You need a negative lookbehind for \r and then \n. You can figure this out using the docs docs.python.org/3/library/re.html
Good luck
@AndrasDeak ok thanks...going to read it more..
20:15
@PaulMcG I am on Docker but I hate it tbh. But, wow, you're efficient with your utilities! Thanks for linking that; going through it now
In fact, the queue looks like it might be 100% aligned to what my colleague needs, so I might start stress testing it tomorrow
@AndrasDeak
You finished my day well:)))) Very Thanks.
Given my track record with git, I limit my PRs where possible. I don't think you want requirements.txt in src. It's a thin wrapper, but I suspect we can make good use of this, thanks @PaulMcG
@AndrasDeak t = re.sub("(?<!\r)\n", "", a)that's it/
@Mostafa Glad to hear that. Next time if you're stuck, try to be more constructive. I asked you to look at the docs. So look it up. If you can't find the docs, ask me where to find it. If you can't find what you need in the docs, ask me where exactly it is in the docs. If you've found it but you don't understand what it says, read it 3 more times, and then ask me to explain.
@Mostafa you might want to turn that pattern string into a raw string literal using r"" for good style, but yeah, I think that should work.
20:34
@roganjosh requirements.txt is there for the purposes of the Docker container. I know what you mean though, I had to go looking for it myself earlier today. I think I can move it up to the parent dir, and change the Dockerfile accordingly (is there even a setup.py file? I don't think so.). NB: this queue does NOT persist its items, so if the queue manager exits, all the queued items are gone >poof<, so be very careful in using this in any kind of production.
Persistence is what we're debating internally
We have redshift, which is great for querying, but I suspect it's gonna suck for an API that might get hammered. A queue of some kind is needed to aggregate requests and vectorize a model over multiple requests (I don't know the full details)
Docker can grow on you. I had to set up a multi-shard multi-server MongoDB, and found the perfect article complete with Docker setup instructions so that I could fire it up all in just one Linux VM, instead of a mess of VMs and network junk. I am going to start using it more for demos of things like my pyparsing adventure game or plusminus expression evaluator - both hosted in little bottle web servers.
If by "grow" you mean "Just continually claim more of your RAM" then we're in agreement :P
P.S. I know I can "limit" it
 
1 hour later…
22:05
Hey guys, is there any c++ code to python converter?
52060431 PyPDF and PyPDF2 and BSD licensed. The following snippet is extracted from a flask page that takes a PDF stream and creates a zip file containing the individual pages.
        inputpdf = PdfFileReader(my_file.stream)
        outfiles = []
        outzip = BytesIO()
        container = ZipFile(outzip, 'w')
        #
        # We now have a PDF input file and a BytesIO-based  zipfile.
        #
        # Parse the extraction specifications and send
        # the necessary outputs to the zipfile.
        #
        for i in range(inputpdf.numPages):
            output = PdfFileWriter()
            file_name = f"{file_prefix}_{i+1:03}.pdf"
            output.addPage(inputpdf.getPage(i))
I found a possible solution to the question mentioned here, but its on c++
@bobtho'-' Sorry, mangled the above message so it wasn't a reference.
22:33
@CoolCloud I don't understand. If, as the name suggests, the hackathon is just about having fun then "I found a solution in C++" is a weird solution. And if instead the hackathon is an actual competition with stakes then you shouldn't be working on it with other people.
bot made with python randomly tried to restart and failed
now nothing works
anyway
i fixed it
random typo
ill be adding economy soon
@Jerry heads-up: for a brand new user you're making a lot of noise so be aware that I'm not crazy about that. Try to increase your signal-to-noise ratio if you want to stick around here. And keep your bot out.
👍 (ps. i forgot my account username and password I made a few years ago)
22:43
@AndrasDeak The competition is done already
@CoolCloud OK, thanks
23:12
i created pyto (package), and used variables to make a working bot in stack

(only 33 lines of code 😎)
using variables is a really pro move
be niceee
Assume I have reasons?
bad day? :(
that would not be a very good reason
23:28
true
@cs95 not an excuse doe
i like SE's initiative on outdated accepted answers
it's long overdue
wait until they actually implement something, and implement it well
02:00 - 19:0019:00 - 00:00

« first day (3843 days earlier)      last day (1330 days later) »