« first day (3497 days earlier)      last day (1450 days later) » 

wim
12:02 AM
if not response.ok: notify(...) would probably be less rube-goldberg style.
 
12:20 AM
ok checks raise_for_status, lol
so maybe I check ok and status == 200
because I don't expect anything else
 
Hey guys,

Any reason why the `datefmt='%Y-%m-%d %H:%M:%S.%f %Z'` when set in `logging.basicConfig(...)` displays a literal `%f` instead of microseconds, as per docs? (https://docs.python.org/3/library/datetime.html#strftime-and-strptime-format-codes)

Not sure what I'm missing.
 
I think I like the exception handling because if any code fails I get zero notification...
@code_dredd I think logging has its own formatting rules
 
@AaronHall Could be... how do I show microseconds then?
 
although the doc specifically mentioned %f: docs.python.org/3/howto/logging.html#loggers
 
If `logging` has its own rules, I'm not sure it's obvious or visibly/consistently documented --or maybe I'm just missing it...

The logging docs do say "The message is actually a format string, which may contain the standard string substitution syntax of %s, %d, %f, and so on"
 
12:30 AM
@code_dredd I think you have one shot to set basicConfig, if you do it again in an interactive shell it won't take...
 
I set it only once. I don't change it afterwards.
 
that might be the source of your confusion
oh
 
I know what you mean; I noticed that while testing in the REPL.
 
oh yeah, it's showing a %f literally...
paste an example?
 
Yeah, and I'm in 3.7.5, if it helps.
Sample output or code?
(Why not both? One sec)
 
12:33 AM
output, not too many lines (< 12)
 
Sample Output: "2020-05-12 18:18:54.%f MDT" (only timestamp from earlier)
Code that sets it:
logging.basicConfig(
filename=opts.logfile,
level=LOG_LEVEL_CHOICES[opts.loglevel.lower()],
filemode='w',
format='[%(asctime)s] [%(levelname)s,PID=%(process)d] %(name)s.%(funcName)s:%(lineno)d: %(message)s',
datefmt='%Y-%m-%d %H:%M:%S.%f %Z'
)
So, my loggers are working fine. It's only the timestamp that's the issue.
 
pass to time.strftime in a shell?
 
Same result:
>>> import time
>>> time.strftime('%Y-%m-%d %H:%M:%S.%f %Z')
'2020-05-12 18:47:15.%f MDT'
>>>
 
time.strftime(datefmt, time.time())
hmmm...
maybe %f is wrong?
 
12:49 AM
Sure about that line above?
>>> time.strftime('%Y-%m-%d %H:%M:%S.%f %Z', time.time())
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: Tuple or struct_time argument required
>>>
 
one sec
 
> %f is an extension to the set of format characters in the C standard (but implemented separately in datetime objects, and therefore always available)
Perhaps that's less true? What system are you on?
 
Ubuntu Linux 18.10
 
Does datetime.strftime differ?
 
yes, looks like it
and logging uses time.strftime, not datetime... so it doesn't get that information
 
yeah
it takes a timetuple which doesn't get subsecond granularity
 
@AndrasDeak %f does show up in docs.python.org/3/library/…
 
Yes. That's not what you're using.
 
@code_dredd you could give cpython a pull request for the mistaken logging docs: docs.python.org/3/howto/logging.html#loggers
 
@AndrasDeak No, but the logger docs (docs.python.org/3/howto/logging.html#loggers) show that it should be recognized.
@AaronHall How would I go about doing something like that? o.O
Or looking maybe looking at the logging code to maybe fix it? (Assuming it can be done.)
 
12:58 AM
@code_dredd it's a howto page, not a library reference. It says time.strftime is used, so time.strftime's ref should be considered
 
just go to github.com/python/cpython, browse to the doc, and edit it there, it will fork it for you and you can save/commit it on the site and send them a pull request right there too
 
The howto is buggy
@code_dredd you can also check the dev guide
 
@AaronHall I'll check. I have a GitLab account, not GitHub (due to licensing disagreements). Given that, before I dive into it, is it possible to get milliseconds for the logger?
 
Yeah, just put it in the string you're logging
make sense?
embed it in the message
 
I was trying to avoid doing that :c
I can use `%(msecs)d` in the `format=` arg, but it gets placed after the timezone data. I'll see what else I can do, or just pass on it at this point.
But I do appreciate your help, @AndrasDeak and @AaronHall
So thanks.
 
1:07 AM
no problem
 
logging calls time.time() so just call datetime.datetime.now().strftime(...%f...) and embed it in the string. You could subclass the object and change the functionality too...
it's a lot of finagling just to get information nobody seems to want or use.
 
wim
1:19 AM
@AndrasDeak the howto is correct
that part says that you can use %f in the log event
> The message is actually a format string
it does not say you can use %f in the datefmt (which, as you already discovered, uses time.strftime)
there was actually similar issue using %z (see point 3 in the FAQ here)
 
@wim could be. I just skimmed it after Aaron said it is given as an example
 
wim
and the %f there is referring to float.
it's basically saying this works:
 
Aaah
 
wim
>>> logging.warning("%f", 123)
WARNING:root:123.000000
 
Makes sense
 
wim
1:26 AM
Which is exactly your issue, IIUC. The accepted answer is, err, acceptable.
 
 
5 hours later…
6:14 AM
I have a df with 2 columns and 3 rows first I checked with if df['group_name'].str.contains("specific string").any(): now I wanto to check if the value on the same row but on the other column contains a specific value
I tryed it with df.loc[df['group_name'].str.contains('specific string').any(), 'is_active']
but it gives me an error
 
6:35 AM
I got a question that I was unable to answer.
In git, what information does the git commit contains

SHA1
SSH-key
Message
Changes made in previous commit
A reference to previous commit
Author of the commit

Which of the following options are correct?
 
7:18 AM
@JaakkoSeppälä not a Python question, and also not clear at all; also, looks like a homework dump
 
Okay. Where can I get help for git questions?
 
I don't think there's a chat room on Stack Overflow where that would be suitable, though some of the rooms have descriptions like "general chat"
 
8:03 AM
Hi
Are symlinks in windows created using os.symlink(src, dir) broken? I see the symlink created, but when checking the properties tab, I see that target is empty
Could somebody if you got windows maybe just create a dummy symlink and tell me if it works for you?
 
wim
@Hakaishin read the docstring. it answers this question.
 
Ah, right this is a new pc. I forgot, because I had dev mode on, so I was confused. Hehe thanks
Turns on dev mode The power is flowing trough my veins :D
 
8:35 AM
Hi there, I'm struggling with this error "Instance of 'socket' has no 'error' member" using socket in Pyrthon 3.8.
 
Hmm, I turned on dev mode, but I still can't create symlinks
 
I'm writing a TCP client script to test a server but when exception in caught I get "Instance of 'socket' has no 'error' member"
 
I also restarted my pc just to be sure
 
Can anyone help me? I tried evrything
 
@Federico did you try debugging with the debugger?
 
8:36 AM
@Hakaishin yes
I debugged the code and evrything works until an exception is rised
 
with the debugger?
 
The stranger thing is with a basic tcp client also the exception is handled, but with my script the contains loops no
I used VS code and PyCharm
 
github.com/fishtown-analytics/dbt/issues/766 this issue claims that symlink on windows is broken even in dev mode. Any ideas?
ah, nvm my b: Changed in version 3.8: Added support for unelevated symlinks on Windows with Developer Mode.
I am running 3.6
time to update
 
user11702787
what does ./config.ini"in configfilename = "./config.ini" mean ? can I rename the file how I want, first time seeing it
 
Does somebody know: can I run a tensorflow model trained in version 2.2 in version 2.1
 
8:44 AM
 
Because I want symlinks so I got to use python 3.8, but I need tf 2.1, because my nano jetson only supports tf 2.1. But tf 2.1 only has pip rep for python 3.7. So I'm kinda in a stupid dependency bind. I hope I could just train my model with tf2.2 and the still run it on 2.1 on the jetson, but I'm not sure and was wondering if somebody tried that maybe, before I go trough the hassle
 
@Federico You probably have a socket.socket instance called sock. The exception type is socket.error, not sock.error.
 
Ok, I'm a step further. I can now create broken symlinks with a normal user, no admin rights. But the links are still broken and have nor target....
 
well, does the target exist?
an MCVE might be helpful
 
@MisterMiyagi Oh right. Let me check
@MisterMiyagi Thank you
 
8:52 AM
@We..are..one "./config.ini" means a file called config.ini in the current working directory
 
@MisterMiyagi this is how I create the socket: sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# Set Socket Timeout
sock.settimeout(5)
logging.debug("Socket Connect")
try:
# Connect to the server
sock.connect((hostIp, hostPort))
 
argh, windows, it was the old / vs \\ problem. thanks @MisterMiyagi
 
user6568562
9:08 AM
Cbg, everyone
 
9:23 AM
How do I find the source code for os.symlink? In the docs there is no link and looking at the os.py file here: github.com/python/cpython/blob/master/Lib/os.py there is no mention of symlink. So how can I find the source code?
Because I have the feeling I am on to a bug and would like to confirm it.
Because this doesn't work:
src = os.path.join(base_data_label_dir, file)
dst = os.path.join("data", label_dir, data_dir + "_" + file)
os.symlink(src, dst)
but this works:
cwd = os.getcwd()
src = os.path.join(cwd, base_data_label_dir, file)
dst = os.path.join(cwd, "data", label_dir, data_dir + "_" + file)
os.symlink(src, dst)
which seems like a bug no?
 
I don't think it's a bug. As far as I know, symlinks can be relative (in which case they're resolved based on the location of the symlink). So python can't resolve your relative path based on the cwd, because you might be trying to create a relative symlink
 
At least on MacOS/Linux, symlinks can be relative. e.g. foo -> ../bar would make qux/foo point to qux/bar, allowing to rename qux without breaking the link.
 
also you can create symlinks on a mounted partition that will still work even if you change the mount point
 
So in your example, I'd expect the first link to point to base_data_label_dir \ file \ "data" \ label_dir \ data_dir + "_" + file, not to "data" \ label_dir \ data_dir + "_" + file
 
ah I see. Ok yes, that makes sense. Ofc. Thanks guys :) Always amazed at the excellent help
 
9:36 AM
I'm only 75% sure of this at the moment, though.
 
but still, how do I find the source of some python code? Like it's not in os.py in the cypthon repo, then where is it?
 
Not sure which parts Python treats as relative to cwd and which parts as relative to the link.
@Hakaishin syscalls are compiled, you have to look into the C source
 
What package is it here? I can only see cpython
 
in there, in the C parts
 
I see thanks
oh while we're at it. I read: blog.filippo.io/the-sad-state-of-smtp-encryption and was thinking about security. Am I right, that in the end all security boils down to trust? Like I have to trust the pc manufacturer, that the root CA are correct, such that if I would want to get the public key of somebody to be able to later send them messages only they can read, that I really am talking to them?
Like do I see this correct, that the only way to have a complete "secure"/no trust needed system is to build everything yourself or review everything?
 
10:01 AM
yes. Even then you would have to establish whether you can trust yourself, e.g. is all your knowledge from trusted sources?
 
that's a pretty deep topic already, but also, why would you trust even your own code? you need assurances
 
@Hakaishin the problem with communication is that there's always another party. Even if you do everything right the other side might actually be a spy and not your friend. So yeah, trust.
 
also, threat modeling -- secure against what?
for example you could have a system which is extremely resilient against intrusion but completely hapless once somebody is on the inside and exfiltrates all your secrets
 
plus there's always the "is it mossad?" aspect
 
Hmmm. Ok, that's very interesting. I didn't realize what big role trust plays then in general.
haha, is it mossad xD
 
10:08 AM
increasingly there is also a requirement for social responsibility, do you deserve the trust of your users? think about how police dispatch systems in the US tend to have built-in biases against non-white neighborhoods
or how it is increasingly hard to try to forgive Facebook for all the ways in they compromise the security, integrity, and privacy of their victi^Wusers
 
Mossad is separate from Israel's democratic institutions. Because no law defines its purpose, objectives, roles, missions, powers or budget and because it is exempt from the constitutional laws of the State of Israel Mossad has been described as a deep state.[1] Its director answers directly and only to the Prime Minister. Its annual budget is estimated to be around 10 billion shekels (US$2.73 billion)
Damn, I never saw such a clear description of this. I always felt like Secrect agencies are above the law. But wiki says it clearly. So weird, that they are funded by the people, but don't have to obey to any laws.
 
cbg-ning
 
cbg
 
quick question: let's say you want to do a menu with something like that if key ==1: print("menu one") elif key == 2 print('menu 2') etc
 
10:17 AM
A few years ago I would opt for a if elif kind of menu
now I know dictionaries
I did something like that
def menu(inpt_value):
    menu = {1:"menu 1", 2: "menu 2", 3:"menu 3"}
    for key,value in menu.items():
        if inpt_value == key:
            print(value)

menu(1)
 
@AndyK looping like that defeats half the purpose of a dict
 
Design question: I have a wrapper to "borrow" something, preventing it from being closed/released. Would you expect the wrapper to have a __wrapped__ attribute to allow inspecting the protected thing? Seems to defeat the purpose.
 
thing is I need to loop into the dictionnary. Is there an even simplier way to do that, without looping?
 
if key in menu
 
def menu(inpt_value):
    menu = ...
    if key in menu:
        print(menu[key])
    else:
        raise ValueError(...)
 
10:19 AM
or simply try: menu[key]
 
or some other variants of the same thing
 
@AndrasDeak thanks
much much easier indeed
 
@AndrasDeak Omg, I had a great laugh reading this :D
 
@MisterMiyagi I think allowing access to the wrapped object is a good idea. If it's a file, for example, you might want to access its name attribute, or you might want to check if it's an instance of TextIO, etc
...although, that __wrapped__ attribute would only be useful if the code knows that it's operating on a borrowed object. And if it knows that, then it could simply not close the object in the first place (instead of relying on the wrapper to prevent it). So it does seem kind of pointless
 
10:34 AM
@AndrasDeak Thanks you so much for that great link. I have not laughed so hard in a long time and last time was when I for the first time watched a person with touretts live. Man that was so funny. And this is also just perfect XD
Also, SANTA CLAUS ISN’T REAL. When it rains, it pours.
xD
 
@Aran-Fey Hm, my working assumption is that people should always default to closing what they get (it's an async resource thingy situation). Borrowing then allows people to always-do-the-right-thing (closing), while allowing someone else to do the more-right-thing-explicitily (delaying closing). So people inspecting __wrapped__ would be some super-enlightened kind of people that are in full forth-wall-breackage mode (knowing they are being delayed in closing).
There is a non-negligible chance I might be overthinking this.
 
Ok. I say add the __wrapped__ attribute for those who can benefit from it, and if anyone does something stupid with it then it's their own fault for not being a responsible adult
 
@tripleee that one is core simple
Ty.
 
maybe also search for "seek forgiveness rather than permission"
 
@tripleee the anti pattern ?
 
10:45 AM
62
Q: "Ask forgiveness not permission" - explain

hikaruI'm not asking for personal "religious" opinions about this philosophy, rather something a bit more technical. I understand this phrase is one of several litmus tests to see if your code is "pythonic". But to me, pythonic means clean, simple and intuitive, not loaded with exception handlers for...

 
@tripleee oh ty. this is brilliant. I'm going to go further into it. I was referring to this when I talked about anti patterns.
 
EAFP vs LBYL is almost always a style choice. Volatile resources such as files are one typical exception.
Another advantage of asking forgiveness is that it can sometimes avoid bugs that permission simply can't, when you're dealing with dynamic states out of your control. I think the canonical example is os.path.exists, which tells you only that the file existed or didn't exist at some point. Probably 90%+ of if os.path.exists(filename): do_something_to(filename) usages are technically buggy. — DSM Sep 4 '12 at 14:43
 
@AndrasDeak I will put that in my tool list. I have a much better appreciation now for EAFP than when I read it recently. Thank you.
 
 
1 hour later…
12:10 PM
Just seen another Q in which x.update({a:b}) was used instead of just x[a] = b. Are there any tutorials out there recommending such a thing?
 
12:22 PM
functional programming
 
That's not the term I would have associated with that question... ;)
 
@AndrasDeak as you taught me, I've googled it so no worries. ;) I found this earlier
 
okay, great :)
 
12:52 PM
@AndrasDeak oh boy did I mess that up. EAFP = "Easier to Ask for Forgiveness than Permission". Ugh.
 
1:24 PM
@MisterMiyagi closed
 
1:36 PM
@Aran-Fey TY for reminding me of responsible adults. I've realised there are other cases where doing-the-safe-thing-by-default is practically never wrong, and __wrapped__ is an escape hatch for the few that know how to do-it-right even better.
 
1:53 PM
Is there a way to wait for dynamic javascript content to load without using selenium or scrapy?
I just need html page source of a full page
But the requests package cant wait for that i think
 
2:17 PM
You are correct that requests can't evaluate javascript
This is typical of html-fetching libraries that don't explicitly advertise otherwise
I'm not prepared to say that selenium and scrapy are the only ways to do it... But I suspect alternatives are pretty scarce
 
Yeah theres not a lot of options
 
Anything that mentions a "headless browser" is probably worth looking into
 
I have used selenium but having a lot of trouble using it while its deployed on heroku
I can get content to load locally, but as soon as its deployed it get empty html pages basically html opening and closing tags
 
Do you get more than <html></html> if you use requests in your deployed script?
 
is there some way to find out if a generator was created by a specific generator function?
 
2:30 PM
Yes but like only a part of the page
THe rest seems to be loaded in not instantly
 
Are you using the same web driver in your local selenium script and the deployed one?
 
Yea
ChromeDriver
 
Hmm
Does the deployed selenium script return <html></html> for all websites, including ones with little-to-no dynamic content, such as www.example.com?
 
Ill have to give that a quick check
 
I'm trying to narrow down where the html is getting mangled. It's probably not "the heroku machine is mangling all http packets because you didn't give it http permission", because requests can get (some) html. It's probably not "the web server refuses to give html to users that look like chrome-powered selenium" because your local selenium script works.
 
2:39 PM
Deploying takes a while sorry
Probably wont matter that its also run from a flask webapp right? As it still gets part of the page
 
Some other possibilities are "the web server refuses to give html to users that look like heroku machines", "heroku machines specifically mangle http packets that were requested by a browser", "the heroku machine's chrome driver is broken"
I don't think it matters if flask is involved. That goes for either the heroku machine or the web server you're trying to scrape
 
I could still try the phantomjs or firefox drivers
Holy crap ive got something working
Let me check what changed
Oh i switched the proxy option off
 
2:58 PM
I hope that's a "moment of realization that fixes everything" oh and not a "disappointment at finding the reason things worked temporarily, but didn't give insight into completely solving the problem" oh
 
3:08 PM
@MisterMiyagi the_generator.gi_code is the_generator_function.__code__ is "works on my machine" certified
version and distribution compatibility problems abound, of course
 
@Kevin Works on Py2.7 – portable enough for me
 
I wonder if something using __qualname__ would be more stable... I'd be worried about false positives though
module_a.some_function.__qualname__ == module_b.some_function.__qualname__ so there'd be ambiguity if you were testing against functions from more than one module
Oh I think __qualname__ is 3.X exclusive anyway, so nevermind
Incidentally I'm mildly annoyed that docs.python.org/3/library/… says that __qualname__ is implemented by "class, function, method, descriptor, [and] generator instance", while docs.python.org/3/glossary.html#term-qualified-name only mentions "class, function or method"
 
 
2 hours later…
5:05 PM
@Kevin oh, my 2.7 test was just to be sure. It's async stuff...
 
wim
5:34 PM
as per usual, all the curly questions answered by user2357112 ...
 
But if it has a copy of the code that might be good enough to identify it. Potentially different use case.
 
wim
5:53 PM
serial dv did not revert 😒
 
@wim then flag for mod
That cluster of 5 is pretty obvious, the remaining few might stick around. You never know.
 
wim
I flag all 5 or just 1?
 
Just one of your own posts explaining the streak. Mod will probably have to escalate for an employee, but eventually at least some of the votes should be reverted.
Sometimes one or two is left and the claim is that "one downvote is fine, multiple downvotes are fishy". Which might or might not just be an excuse :P
 
@wim just 1 and try outline a pattern. On my first flag I was told to flag again if I saw a pattern continue. On the second day after the first flag, I got about 80% of the DVs overturned
 
wim
6:11 PM
I get 2 simultaneous downvotes a day for pretty much the whole of April
gonna make bank if they are all reverted LOL
 
experienced serial downvoter
Might not get them all reverted in one sitting. Streak of 5+2 is a different pattern.
 
@wim That was my pattern. I just explained that in the first flag, got another 2 DVs on 2 of my other questions the next day, flagged again and they mostly got reverted
 
brief cbg - long long day yawns....
 
No way was I wrong in my bet (is it because I stated I had a bet?)
For example, did you try using the csv module and use the datetime module to parse the dates? Someone (I'd almost put money on it) is about to suggest pandas.read_csv and it's not helpful in understanding anything — roganjosh 22 hours ago
 
6:28 PM
@JonClements cbg, should I not interest you in a synonym request then? :P
I can leave a mod flag for someone else to handle
 
what was it again lol
broadcasting array thingy wotsit
 
meta, plan is to make point to
i.e. to make numpy-broadcasting a synonym of array-broadcasting (this is what I messed up the other day, trying to do it the other way around)
 
Anyone have recommendations for test coverage tools?
 
@JonClements thank you! I'll make sure to put a box of scooby snacks on our next grocery list
 
Think that's done pending any caching stuff
 
6:36 PM
Yeah, I think so too :)
I'll wait until the cache is cleared to notify the julia people
and it's cleared!
@JonClements should I credit you in the meta post?
 
No need
 
OK :) Thanks again.
 
talk about easily pleased :p
 
gotta appreciate the small stuff :P
 
6:51 PM
@wim luckily, I already know the generator to compare to. It's basically a stripped-down wrapper(thing) if not isinstance(thing, wrapper) else thing, using a generator-function instead if a class.
@Aran-Fey I use coverage with codecov.io
 
ty
 
7:10 PM
@MisterMiyagi: You can do this mostly-reliably by comparing the code objects. geniter.gi_code == genfunc.__code__.
 
If we're doing recommendations, does anyone have a book(-like) recommendation on advanced Tkinter? I'm especially interested in idiomatic OO use of StringVars and callbacks.
 
This assumes only one function uses that code object, which may not be the case if the function is defined inside another function, or if any code calls the function constructor manually or reassigns __code__.
It also doesn't interact well with decorators.
 
@Mast "advanced Tkinter" just sounds funny to me, since the original Tk dates back to 1988 (tcl.tk/about/history.html) So much of Tkinter is just a thin Python wrapper around the original C library, you may be better off finding references to Tcl/Tk instead.
 
@PaulMcG Well, if anyone knows a decent piece on Tcl with a hint of Python wrapper, that's fine too. But the only experience I have with Tcl is from years back and none of that was graphical.
But I've done the basic things and I'm trying to get something of the ground that's solid. And the books and tutorials I've found so far are simply too basic.
I don't mind putting in some effort before it works.
But what I got so far is either incomplete, or insufficient for doing it right.
So all my Tkinter code looks like crap.
 
Think I've only dabbed with actual Tcl when working with eggdrop
 
7:22 PM
I think we used it for configuration.
For HDL.
Went well with ModelSim.
 
@user2357112supportsMonica TY. The generator is buried in some library, so comparing the code seems reasonably reliable for me.
 
Anyway, if anyone remembers a good resource, paid or otherwise, feel free to ping me.
I'm tired of writing crap.
It's time for the real thing to start.
 
wim
@Aran-Fey I use pytest-cov plugin with coveralls.io
here is an example of what the reporting looks like coveralls.io/builds/18502484/source?filename=oyaml.py
 
I'm not really sure what the websites bring to the table tbh. Why do I need a CI and a 3rd-party website just to see my code coverage?
 
it's very useful if you are not the only contributor
 
wim
7:36 PM
1. it's just easier 2. their web reports are better than any UI I've seen locally 3. you can integrate with pull request builder
 
and once you have the setup, might as well throw it at all repos.
 
wim
compare with when someone makes a PR and you don't have CI - you'd have to pull down their branch, run it all locally, make sure their tests are actually testing what code they've added etc ...
 
Ok, fair enough. I don't have CI set up yet, so I'll just take this one step at a time
 
@wim Does it have GH integration?
 
wim
yes
 
8:27 PM
@roganjosh That's just short for Python Forever, right?
 
@Mast you could read it that way :P
I hate trashing messages from regular contributors, even if they're to something off-topic, but I didn't think they'd be constructive there :(
 
it's fine
no point in leaving dangling replies here
 
@AndrasDeak once bitten :P
Are you back to classrooms yet, @AndrasDeak
 
nah, not until next semester (i.e. September) and maybe not even then, nobody knows
 
8:43 PM
Seems a similar state with unis here but some of the depts. in University of Nottingham have been running their manufacturing facilities. I don't have any contacts to ask re: how classes are delivered, but they definitely have people on-site
 
for us it's easy, all-theory classes so it was easy-ish (considering) to move to remote
 
That's true. I'm curious whether you have any rigs or practical demos that you would normally use for your topics at all, if things were normal? Or is it literally all just black/white-board stuff?
 
for my broader environment it's 100% blackboard
 
wim
9:38 PM
such a great invention. remarkable.
 
stackoverflow.com/questions/61784856/… needs clarity. They even edited and ignored the half-hour discussion in comments
 
10:16 PM
I'm surprised, there doesn't seem to be a way to get detailed coverage information without going through all the trouble of setting up a CI and 3rd-party website. There isn't even an IntelliJ plugin or anything
 
You can run coverage within PyCharm, it takes a little setup
 
wim
I was just about to say the same thing, but then I remembered coverage in PyCharm might be professional edition only not community edition..
 
I do have a "run with coverage" button, but it's greyed out
 
feature baiting
 
10:22 PM
lame
 
wim
HTTP 402 beeyatch
if you're happy with a terminal ascii report (or a html report that you can then open in a browser window) coverage.py supports that ..
 
need snakeviz for coverage
 
checking out the HTML report atm
hmm, this isn't too bad if I write a dark theme and a little wrapper that does the pytest --cov -> coverage html -> webbrowser.open dance for me
 
wim
s/pants/coveralls/
dude just buy pycharm
its worth it, to have the coverage in the editor gutter
 
I don't even like pycharm though
 
wim
10:32 PM
I used to be one of those "I don't need no stinkin' PyCharm" guys
"I'll be just fine with vim.." What a fool I was ... :D
 
Is it the best IDE I know? Yes. Am I happy with it? No.
 
10:50 PM
Time to write your own IDE. With blackjack. And git hooks. And forget the blackjack!
 
Tkinter
 
Ha! My own IDE was one of the first things I tried my hand at when I first started coding. I can't help but admire the optimism I had back then
I got as far as a tkinter window with a textbox that you could drag around, if I remember correctly
 
wim
Write an IDE that inserts subtle corruption into the bytecode if it detects the user writing too many one-liners or otherwise being overly clever
Call it PycHarm
 
floordiv instead of truediv
looking up names from the wrong scope?
replacing 4 with 5
 
wim
replace "a" with "а"
 
11:02 PM
randomly replace spaces with tabs
 
11:13 PM
@roganjosh I expect you know about the school of thought some people subscribe to about not spending much effort on OPs with <100 rep, certainly not if they behave like that.
@roganjosh Was his name Mr Sardine?
Has anyone here used yellowbrick, it's an ML visualization add-on package intended to supplement scikit? It seems very useful but deserves to be better known.
 
So my coverage report is telling me I have an untested __repr__ method. Should I ignore that? And if not, what's the correct way to test a __repr__?
 
wim
11:29 PM
call repr on it
 
And throw the result away? So the test only exists for the sake of coverage?
 
wim
no
assert on what it is expected to be, obvs.
 
Well, ok then. I can't shake the feeling that I'll be wasting time testing unimportant things though
 
wim
It's 100% possible to write a buggy repr that crashes logging. Have done it myself.
 
ok, that's a good point
 
11:40 PM
@wim If the __repr__ was something simple with only string formatting and references to attributes which were know to exist, and no method calls, would it be worth testing? How did yours crash?
 
wim
1. Yes 2. Something with mixing unicode and str accidentally
IMO the only thing that shouldn't bother to be tested is the line if __name__ == "__main__":
it can actually be tested, using runpy, but it's a huge hassle for very little gain
 

« first day (3497 days earlier)      last day (1450 days later) »