« first day (3663 days earlier)      last day (1271 days later) » 

3:11 AM
Code I have so far:

def parse_measurement(input_value):
split_list = input_value.split()
try:
split_list[0] = int(split_list[0])
except ValueError:
split_list[0] = float(split_list[0])
return split_list
input_text = "3 ft, 5 ft, 8.3 ft"
output = [parse_measurement(s) for s in input_text.split(',')]
print(output)
Now with the code above, if i put input_value as:

input_value = "3 ft, 5 ft, 8.3 ft"
output = [[3,'ft'], [5, 'ft'], [8.3, 'ft']]
How can I get the function fixed, so I can put the input_ value as:
 
the next time you paste code, make sure you format it, check the sidebar for details
 
@python
@python_learnerwill do!
 
you want to pass the input as a tuple?
 
yes i do.
thanks much for helping by the wqay
 
anyone have source on how to change python pyqt codes to pyside
i'm having trouble running QThread. always quitting
most link are down. kinda hard to search for them
that's not even the worst part. the pyside2 documentation is in c++ syntax like lol
geeksforgeeks.org/migrate-pyqt5-app-to-pyside2. as this site said. changing import will solve everything is completely wrong
 
3:41 AM
@Justice sorry I had to go for a while, you can try this
def parse_measurement(input_value):
    split_list=[i.split() for i in input_value]
    for i in range(len(split_list)):
        try:
            split_list[i][0]=int(split_list[i][0])
        except ValueError:
            split_list[i][0]=float(split_list[i][0])
    return split_list



input_text = "3 ft, 5 ft, 8.3 ft"
new_input=input_text.split(',')
output = parse_measurement(new_input)
print(output)  # [[3, 'ft'], [5, 'ft'], [8.3, 'ft']]
 
@python_learner no worries. Thanks so much!
 
I am not sure I understood what you were trying to do though, is there a need to have the units ('ft') in the list?
 
yea.. it's one of the objectives for the homework
so unfortunately, I need input_values to be
 
I understand that, school restriction
 
I need to put input values like ("3ft", "5 ft", "8.3 ft"), and it won't work
 
3:48 AM
"3ft" there is no space between 3 and ft
parse_measurement(("3 ft", "5 ft", "8.3 ft"))
 
there is meant to be space
sorry about that
been a long day trying to solve these codes
 
 
2 hours later…
5:31 AM
stackoverflow.com/questions/64531794/… if anyone would kindly help my day :(. if you can't it's okay :(
 
 
2 hours later…
7:39 AM
@arielma As far as I understand it, coverage xml converts existing coverage reports to XML. It does not actually create coverage reports. You need a separate coverage run for that.
 
 
1 hour later…
9:24 AM
@lone_coder please don't ask for help here with fresh questions on the main site as per our rules
 
Although I see you asked here first
 
Is it good form to include the csrf token on the login request page as a hidden input in django like this? {% csrf_token %}
nvm it is
 
hi I am trying to add a dictionary into a list for python
however when I change the value of the dictionary, the list changes
I did not append the value but I merely change my dictionary
this is my dictionary
[{'type': 'trolley2', 'temperature': '15,15.1,15.2,15.5,15.7,15.9,16,16.5,17,19,25,28,29,29.1,29.2,29.3,29.4,29.5,29.6,29.7,29.8,29.9,30,'}
so I have got trolley1 and trolley 2
after the for loop, I am trying to update new dictionary into the new list but my old dictionary gets overwritten as well
is there anyone that can help
 
9:49 AM
@AndrasDeak sorry, I will not do it next time. I'm really frustrated right now
I felt like I do encounter a bug for the first time. there's no solution what so ever :/.
 
@GoodJeans I can't read your unformatted code but it's probably sopython.com/canon/128/…, see also linked questions there
You need to use copies
 
10:16 AM
@GoodJeans I'll move this large block of unindented code. You can post it again but first please read our code formatting guide and practice in the sandbox if necessary.
 
 
1 hour later…
11:36 AM
I have a class with a self.session = requests.Session() object. When the close goes out of scope I get the warning ResourceWarning: unclosed <socket.socket blabla>. Shouldn't the garbagecollector close open sockets when destroying the object? Because right now I am doing myobject.session.close(), which seems very unpythonic
and then the warning goes away
Hmmm ok, weird it does not happen if I create the object in a normal file, but the warning does happen when running it in a unittest. Do unittests somehow change the gc behaviour or do they increase the logging level?
 
did you already try putting the session.close() into that objec's __del__?
 
12:04 PM
@MisterMiyagi are you sure about this?
Does coverage run + coverage xml command actually replace this command: python -m xmlrunner discover ?
 
@GoodJeans You must put a copy of the dictionary into the lists. Python has objects, not values, and putting an object (in this case a dict) into the list means later modifications to this object are visible in the list as well.
@arielma A quick search gave me barely any info on xmlrunner, other than that it is tied to unittest. So the answer is "I guess".
Really, you should just try.
@Hakaishin The GC does close the socket, and it is warning you that it did.
 
@MisterMiyagi I see, lol why would it warn me that it's doing it's job?
 
@Hakaishin ResourceWarnings are off by default. The default test runner turns them on.
@Hakaishin Because its job is memory reclamation, not general resource handling.
Sockets are usually used with some protocol that include graceful shutdown. Just severing the connection is usually not desirable, even if it works.
 
12:20 PM
Wow, thanks for those specific links :) So is there a problem in letting the gc close the socket instead of me adding the close statement to the del?
so I guess it does not call close, but kills it somehow more abruptly? And putting that close statement there is a good idea?
Neat, warning gone :)
thanks
 
@Hakaishin The GC will properly close the socket, so there's no bug there per se. But since the GC can defer this to arbitrary times, including never, relying on it is... risqué.
Note that this also applies to closing the socket in __del__.
 
wait how do you mean to never? Isn't it well defined and objects get deleted if there are no references to them?
 
why not?
 
Because the language spec does not define maximum object lifetimes.
It only guarantees not to clean up objects while you can still use them. That's about it.
 
12:26 PM
is that an oversight or on purpose?
 
On purpose. Other implementations rely on this to have more performant garbage collection
Consider also that even CPython's cyclic garbage collector explicittly allows to be turned off.
 
I don't get it, what is the problem in gc this for example?
def foo():
	bar = Bar()
	print(bar)
	# delete bar here???

foo()
 
Why there? Why not wait until you have some more bars to delete and then purge them all?
 
@Hakaishin usually they get deleted instantly
 
Ah I see. So it kinda makes continuos chunks of memory for similar things possibly sharing header for the similar objects and then delete the whole chunk for all the objects?
 
12:30 PM
Consider another case: Let's say we compile this function and inline it into the main scope. Why delete bar at all when the program is going to end anyways?
 
but to come back to the original does putting self.session.close in __del__ actually only make the warning go away but there still might be a problem or does it solve the problem that the warning is warning about?
 
It doesn't make the problem go away, but you very, very likely do not (have to) care about the problem.
 
Ok, then the warning is kinda odd. It's like yeah this problem exists, you can do something to make me go away, but not the problem I am trying to warn you about. So why have the warning there at all?
This would make only sense to me of doing something would be explicit silencing, not code change which makes the warning go but not the problem
 
It is the problem it is trying to warn you about, but again, you likely do not care about this problem.
 
But shouldn't it warn me of the problem until it is fixed?
 
12:33 PM
"Please press enter before we quit the program"
 
Putting session.close there and the warning leaving kinda implies to me that the problem is fixed? no?
@AndrasDeak ?
 
I may have misunderstood your penultimate message, nevermind
 
@Hakaishin Determining whether the problem is fixed is probably equivalent to solving the halting problem. Determining whether the problem is not fixed is much easier.
Plus, again, it is likely not a problem that is relevant to you. Like any regular exception, you are free to ignore it.
 
I read it as "like any regular expression" and it still kind of made sense
 
@AndrasDeak totally
@MisterMiyagi So is it along the lines, doing close in del fixes it for 99% of the cases and not having the close in del might be a risk for some circumstances, but you can never be really sure, but that would be stupid to warn about.
 
12:38 PM
can I tell the command coverage report -m to run just on specific files/folder and not the entire python files?
 
It's along the lines of "the GC checks whether the close bit is set on a socket and otherwise doesn't care to find out". By closing the socket in del, you are merely hiding the "socket has not been closed" from the GC.
@arielma coverage run runs applications, not files or folders. Do you want to ignore some parts in the output?
the coverage homepage has some extensive documentation on configuring what is reported.
 
Yes
 
@MisterMiyagi By closing the socket I'm hiding that the socket has not been closed? I'm confused by your message.
 
@Hakaishin What you are hiding is that the socket is closed as part of finalisation. The ResourceWarning only knows about the emergency-close when finalising the socket. Doing so in your own, custom __del__ is functionally equivalent but not "visible" to the warning code.
The check whether to emit the ResourceWarning is rather simple.
 
12:55 PM
Depending on your use case it may make sense to implement a custom with rather than __del__, so you can do e.g.
def foo():
    with Bar() as bar:
        print(bar)
 
not really I need self.session in a bunch of different methods which can be called from outside the class.
@MisterMiyagi I'm kinda confused, the way I read that snippet is, check if it is closed, if yes go on, if not warn about it and then close it. So if I close it, it should be fine, right? And if I don't close it, it will be closed and also fine, right? So I still don't see the need for the warning.
 
Presumably you would call those bunch of methods from inside the with block
The same way you'd call file.write inside the open() call's with block
 
Closing in the your socket via the GC is like closing the hatch on your space shuttle on launch. There's a good chance that this indicates your crew did not board, because they should have made sure the hatch is closed.
 
no the class is to control something using the session object and I have methods setX, doY, I can't use a with statement like this
 
If you're in the unmanned space flight business, launching your space shuttle without crew is fine of course.
 
1:01 PM
I don't see the problem?
def control_thing():
    with MyCoolSession() as s:
        s.setX(23)
        s.doY(42)
 
@MisterMiyagi haha nice analogy. So the problem is really that sockets are stateful, and the gc will not tell the other side anything, that's why it warns you, but if it finds it closed it assumes you warned the other side and dooesn't issue a warning. Ok now it makes sense
@Kevin The problem is that I than have to create a new session for every function call. And they are getting called quite frequently
and the idea of a session is exactly to have it persist, compared to a normal http request
 
But surely you would have to create a new session for every function call if you're creating the object in the function and then letting __del__ close the session when the function ends. So you're doomed either way.
 
No on the calling side I create the control object once and then use it
 
Ok, so wherever you're creating the object now, switch out s = MyCoolSession for with MyCoolSession() as s:, and you're good
Now, that being said, let me backtrack a bit...
 
I have approximately this:
class Control():
    self.session = requests.Session()
	self.session.get(get_session_url)

	def doX():
		self.session(doX_url)

	def doY():
		self.session(doY_url)


# calling side
c = Control
while True:
	foo = c.doX()
	if foo:
		c.doY()
and I don't see how I could use the with statement in this setup
 
1:08 PM
with Control as c:
    while True:
        ...
 
I don't necessarily think that with can be shoehorned into all possible use cases. I'm being unusually insistent here, not because I think it's a slam dunk fit, but because it's a fun Socratic exercise if you can convince me that I'm giving you advice that's not useful in your scenario
If you can explain why it won't work to me, your clueless grandma, then you know your requirements are rock solid
 
@MisterMiyagi I think your misunderstanding, he was talking about using the with statement for the session
 
Yes and no. I imagined MyCoolSession as the class that you wrote that controls the session object. In other words, it's equivalent to your Control class.
 
@Kevin I don't know how to explain you that it doesn't work, besides that I don't know how to make it work
 
Kevin's classes are always 20% cooler
 
1:13 PM
Well, it looks like control owns the session. So it should manage the session lifetime as well.
 
@MisterMiyagi it does now. I added __del__(self): self.session.close(). And I don't see how I could get the control class to use a with statement
 
you are aware of __enter__ and __exit__?
 
Isn't the question whether there are multiple entries into the session?
 
You may be thinking, "... But if you want me to implement the context manager interface on my own class, then I'm still doing resource cleanup manually, just inside __exit__ instead of in __del__. How is that any better?" Granted, you're not saving yourself any lines of code. You're just allowing the user of the class to use with instead of del, which IMO is a bit more pythonic
 
@Kevin also the __exit__ is guaranteed to be called when leaving the context manager, right?
in contrast with the "it will be called, or not, whatever" of __del__
 
1:16 PM
As far as I know, only an abrupt termination of the Python process can let you escape from a with block without calling __exit__
 
i.e. zombies tripping on your power cord
 
Guys you are all misunderstanding. I could make Control be usable with a with statement. That is no problem. But how would I get the session, which right now I have as a self.session usable as a with session? And not have it recreated in different functions? I think that doesn't work
 
The Control enters the Session inside Control.__enter__, end exits the session inside Control.__exit__.
 
At worst with c.session as sess: should work, right?
But I imagine a custom __enter__/__exit__ can make this nicer (and leaving control with Control)
 
@Kevin or not del at all, because the program ends once the control object goes out of scope
I agree if the calling side had to call del instead of being able to use a with statement, it would be nicer. But since the program ends it will call del on control which in turn will close the session. So no need for a custom context manager interface
 
1:23 PM
Not sure what we're discussing here. The premise is "the session gets closed automatically on termination". So if that's OK for you there's no need to be debating any of this. If you don't want it to be auto-closed, you need what we've been talking about.
 
Anyone know when ["a", "list", *extended] syntax was added? Having trouble remembering the right term to search for.
 
3.5, I believe
 
I have no problem letting the end of the program handle my resource cleanup for me :-) I'm just discussing alternatives.
I may compose a mockup in a second...
 
@davidism PEP 448 perhaps? python.org/dev/peps/pep-0448/#abstract
that would confirm 3.5
 
thanks
 
1:26 PM
@Kevin but then again we prefer with statements to just f = open(file)
exact same thing
 
@AndrasDeak Why would I want to do something manually, instead leaving it automatic? I just don't get what you guys think the advantage is. I added the close call to del because of the warning, but otherwise why would I call del at the end of the program instead of just letting python itself close everything in the end? I just don't see the benefit
 
I guess just not leaving loose ends around. I don't even know what a session really is so you'd find it hard to extort a rationale from me. It just might be good practice (but maybe not fitting your use case).
 
Hey guys, do you know how Python packages handle resource files? For instance, if package X refers to a TXT file in one of its subdirectories, does it use a relative path to refer to that file?
 
@davidism having a read of that now. Thanks!
 
1:30 PM
@AndrasDeak but python closes everything when the program ends automatically, how can there be a lose end? I all for not leaving loose ends around, but as I understand python this is not needed, because once the program ends it will call del on all the objects and thus close the tcp socket. In my mind basically at the end of the program python goes trough all the objects and calls del and you are advocating going manually trough the objects and calling del by hand, which just seems senseless.
 
Use case: your boss comes into the room and says "your Control prototype works perfectly. Now we just need to scale it up so we can run a million of them per execution, in groups of fifty parallel instances". You implement his desired ControlPool design, and test it. It dies 0.1% of the way through because windows says all 1,000 session objects are currently allocated
 
@Hakaishin we're talking about specific kinds of resources
Assuming a session is that :P
 
@Kevin Ah I see that makes sense. But if I'm gonna need that I'm gonna implement the context manager interface.
 
morning cabbages, folks
 
If you're thinking "that's some serious YAGNI, if I need to scale this class up into the millions, I'll review it for resource leaks at that time and no sooner", that's fine with me
 
1:34 PM
@Hakaishin The point is that just closing is often not enough. If it is enough in your use-case, there's no practical problem having Python do just that for you.
 
@Kevin haha basically. I mean right now I have 1 instance and the program closes once that instance is not used anymore. Yeah, now I get what you meant. With my approach I have to watch out in case I have many, yours would be safe for any use case. That was a really illuminating example :)
 
I do like to think academically rather than pragmatically. My advice applies best to perfectly spherical programmers in a vacuum.
5
 
@davidism the article seems to be talking about some low-level stuff though. My question is simpler: If we import package X from script Y, and package X has a function that uses some files that reside in package X, then how are these files paths referred to within X? If X is using relative paths for those files, then there would be a file not found error since the active directory would be the directory where Y is. Anyone know?
 
they're referred to with the API I linked, you don't use filesystem paths, you use paths as defined by that API (although they will match in the common case)
 
I like that too :) But if I can leave something to auto I will and if I can write less code I will, even though I wrote so much in here, still better than writing a little bit of code :P
 
1:38 PM
recbg
 
so if the package you installed is called "ham", and you want to read "data/eggs.txt" within it as text, you use eggs = importlib.resources.read_text("ham", "data/eggs.txt")
The reason you use the API is because it's portable to packages installed in different ways and on different systems. As long as the package is importable, its resources are accessible without knowing those details.
 
Damn, had no idea importlib.resources existed. It seems so necessary, but I haven't seen people do that. I needed to make a Flask webapp interface for a small program. I put the files of the small program into the Flask app root directory, but when I imported the files from the Flask app, I started getting all those FileNotFoundErrors.
 
Hi, can someone tell me difference between pylint to pycharm code inspection?
 
@Hakaishin basically this is what I had in mind
 
and also, which tool can be used for Anaconda?
 
1:47 PM
Not pictured: safeguards against silly users that try to enter the same Control instance more than once
file objects crash with ValueError if you try that with them, so if you follow their example you don't have to get too fancy
 
@Kevin Thanks, I perfectly understood you before. But it's nice to have a verification like this :) And I can now with peace of mind use my simple approach :)
 
Excellent.
 
@multigoodverse Flask was written before importlib existed, so it has app.open_resource which is a similar API to importlib.resources.open_binary. I'd use importlib for anything new though
 
Explaining to people things they already know is unironically one of my favorite activities
All aboard the garbage truck to the InfoDump
 
It's a good match with "I could google it but I prefer you explaining it to me"
Which I can now see can be read both in a "friends talking about stuff they like" and in a "garlic" sense :P
 
1:51 PM
@Kevin wow that's crazy. I find this super annoying when people to that to me. But the previous discussion wasn't such. Because I didn't have a clear picture so it wasn't in vain. But my gf will sometimes explain me super obvious stuff or ask me obvious stuff. Lately she asked me if I know what puma is. Like no I never heard of the animal puma. Like cmon :D
@AndrasDeak sado masso programmer edition :D
The questions is which is which :P
 
@Hakaishin perhaps you're only familiar with the cougar or the mountain lion or ...
 
@davidism I see someone has explained app.open_resource here: stackoverflow.com/a/46076458/1585017
 
@AndrasDeak lol ofc
 
@multigoodverse "someone" :)
 
Sometimes when my friends are backseat gaming they'll say "you should do a spin jump there" and I'll say "good idea :-)" and I'll quietly think "... And I know it's a good idea because I thought of it ten seconds ago :^)"
 
1:53 PM
not speaking thoughts makes the world go round
 
@AndrasDeak or just delay the inevitable doom. But then again, that is life so maybe you are right
 
Had to check again, the first version of the importlib_resources backport wasn't released until December 2017, so yeah that answer was before the new API was usable. And it didn't become completely useful to me until last year.
 
I don't actually know what a puma looks like. Big cat with... spots???
 
cmon, it's the black one :P
 
yo red dead drm got bypassed
 
1:55 PM
did it get bypassed by Python?
 
yasss
 
... I was about to direct you to the arqade chat, didn't expect a "yes this has to do with Python"
 
lol, ok my gf might be right to question me on animal things. I was thinking of panthers when she said puma xD
 
"big cat with black fur" was my second guess
 
classic dunning kruger effect
 
1:58 PM
I'd be interested to see a technical breakdown of the drm bypass, provided it's legal to lay my eyes upon it
 
@shubhamprashar just to be clear: this is the python room and we'd prefer if you dialled down on the goofiness. If you look around you'll see everyone communicating in clear (enough) and calm English.
 
@Kevin you have viewed the forbidden knowledge, your eyeballs are now the property of Rockstar
 
I wonder if DRM cracking groups ever add their own DRM to their cracks to ensure that the original software developers can't easily decompile the crack and discover where the original DRM's weakness is
... Although I guess not all cracks work by disabling the DRM in-place, some of them just strip it out entirely. In which case decompiling the crack doesn't give the original devs much useful data
 
@davidism this is the setup for a funny rick and morty short episode :P
 
2:05 PM
Too late, I already sold the rights to Black Mirror
 
Today seems to take forever, time really goes slower in homeoffice
 
@davidism there have been 3 time periods: before importlib.resources existed, before importlib.resources started working and after it started working.
 
@davidism that was very helpful. Do you use importlib_resources (or even Path(file).parent) with any file path in your programs or only when you're planning to make that program a package? I am asking because I didn't plan to make my program a package, but now I am using it as a package, and I wished I used importlib_resourecs when I was writing that program as opposed to going back now and editing it.
 
@multigoodverse if your program is more than 1 file that is also being copied around in ad-hoc manner, yes, you should use a package anyway :P
 
2:29 PM
anyone know how to get altair to make a grouped bar chart with different yaxis limits for each grouped chart? (so that smaller bars will still be visible)
 
Have we got a decent sorted vs list.sort that'd be applicable to this Q ?
 
2:51 PM
Python devs, please redesign the naming system so we can have in-place list.sorted! and non-mutating list.sorted
and you can resolve the syntactic ambiguity of list.sorted!=23 by <mumble>
I'm not saying you have to bring back the <> operator, but...
Old and busted: <>
On its last legs: !=
New hotness: ≠
 
3:11 PM
@Kevin Someone's been reading PEP 638, I see.
 
@Kevin that's \ne for you, dear sir or madame or orb
 
3:47 PM
Proposal: =/= for "is not equal to", ≠ for "don't assign"
a ≠ 2
print(a == 2) #guaranteed to be False
print(a) #implementation-specific behavior
 
xD Kevins on a roll today
 
lazy implemenation: a ≠ None assigns 1 to a, and a ≠ <anything other than None> assigns None to a
a ≠ <a custom class instance that compares equal to any value> is a segfault
@holdenweb Yes, and also a smattering of ruby docs. Since they allow identifiers ending with exclamation points, I wonder how they resolve the ambiguity?
Maybe <expr1>!=<expr2> is flat-out a syntax error whenever there's no whitespace between expr1 and the "!"
Even for otherwise unambiguous cases like 1!=2
 
@Hakaishin @Kevin's on something for sure... have you gone near the energy drinks again Kevin? :p
 
@Kevin perhaps they don't have first-class functions?
 
I can really taste the taurine in this batch
 
3:58 PM
@Kevin jinja2 actualy has some bugs where whitespacing matters
 
@AndrasDeak Maybe. tutorialspoint.com/ruby/ruby_syntax.htm seems to indicate that regular old variable names can only be alphanumeric-and-underscore, so maybe exclamation points belong only to non-first-class objects.
 
@Kevin isn't an ending exclamation some special meaning, just like an ending ? is "boolean"?
 
@MisterMiyagi the ending ! indicates it's an inplace operation... so some_string.to_upper is a new string... and some_string.to_upper! changes some_string in place
 
the question is whether you can say some_string.to_upper != some_other_method
 
@JonClements oh, one of those purely-conventional indicators as in Julia?
 
4:06 PM
It indicates a "bang method" which I'm 65% sure is purely conventional
 
@MisterMiyagi yeah... afaik it's just a convention
 
Once this Ruby installer finishes downloading, maybe I'll find out for sure
 
4:21 PM
can I have a virtual hug?... it's one of those days
 
 
No >:|
@Kevin needs more masks :P
 
Man it's raining the whole day and they didn't have oat milk on saturday so it's my second day without breakfast or any proper food. Stupid rain :( And ofc it's gonna stop around 8 when the shops close.
 
My preliminary research suggests that ruby does not have attribute assignment, so when it sees an expression starting with "FOO".downcase, it knows with complete certainty that any equals sign following it can't possibly be an assignment
 
@Hakaishin "vegan milk"
 
4:24 PM
@Kevin thanks K.
 
You made me google the english word :)
 
irb(main):011:0> "FOO".downcase!=1
=> true
irb(main):012:0> "FOO".downcase=1
Traceback (most recent call last):
        4: from C:/Programming/Ruby27-x64/bin/irb.cmd:31:in `<main>'
        3: from C:/Programming/Ruby27-x64/bin/irb.cmd:31:in `load'
        2: from C:/programming/Ruby27-x64/lib/ruby/gems/2.7.0/gems/irb-1.2.6/exe/irb:11:in `<top (required)>'
        1: from (irb):12
NoMethodError (undefined method `downcase=' for "FOO":String)
Did you mean?  downcase
               downcase!
This implies that "FOO".downcase=1 means "find the method named 'downcase=' on the object "FOO", and call it with argument 1"
Which begs the question*, how does it know that "FOO".downcase!=1 means "compare whether the object "FOO".downcase is equal to the object 1" and not "find the method named downcase!= on the object "FOO" and call it with argument 1"?
(*I know, that's not what begging the question is. I'm changing what it is.)
Ah, I think you can only have one of !?= at the end of a method name, so downcase!= is not a legal name
downcase= is though, and apparently is the idiomatic approach for defining property setters
Thus endeth my very off topic tangent about syntactic ambiguity
 
umm... not sure why that didn't do the reply-to in the first place, but oh well
 
yay! puppyhugs!
my day is significantly better now :)
Thanks you guys
 
4:42 PM
is there any forum other than stackoverflow to ask about PySide2 related question. i really need it. my question hasn't been answered here. I've tried sentdex discord channel, asking directly on Qt page but I can't login idk why, also I don't have programming fellow near my location
 
it hasn't even been 12 hours
 
uh tkinter alternative, sounds hot. sadly I'm not able to help, but thanks for bringing it to my attention :)
@AndrasDeak Half the time some vc startups last :P
 
Anyone else with me to wipe regex off this planet?
 
i was migrating from tkinter lol, then I decided to use Qt since it handles lot of things. i actually like pyqt5 a lot. and haven't got any problem with it. but PySide is really buggy i think. i hope i'm wrong
 
Just burned 75k CPUh due to one missing \ in a regex...
 
4:49 PM
@MisterMiyagi sounds like good utilization to me
 
5:20 PM
I like regex. Correction -- I like my own regexes but not anyone else's. Correction -- I like writing my own regexes, but not reading them.
9
But seriously, they do occasionally solve problems that no other tool would satisfy. For example, when I want to do a find-replace in Notepad++ for all lines starting with "//", I can use the regex ^//.*?$. If regexes did not exist, I'd have to save the file to disk and run a script on it.
 
@Kevin Exactly!
 
whoever upvoted my question. thanks!
 
Any question that uses full sentences and has code that even looks like an MCVE is automatically in the top 5% of questions, IMO
 
I see, i have an urge to make it even longer but i'm afraid it will be TL;DR
english is hard
 
Extremely true
 
5:40 PM
Hi, do you know if Anaconda has some code coverage like pylint or code inspection?
like pycharm has
 
unknown
 
@arielma pytest and coverage work well together under conda, if that helps.
 
@Kevin it's not so much their capabilities, it is their interface. Or better to say the complete lack thereof. Putting stuff in a string, with no way to tell errors from intention, seems a tad more disco than I like.
 
@holdenweb there is nothing like pylint for conda?
 
did anyone know about QtPy? could it be used freely in a commercial product? i couldn't find any further information. what I knew from this pypi.org/project/QtPy It provides support for PyQt5, PyQt4, PySide2 and PySide. so othere's a mixed up there between LGPL and GPL
OMG. my code works on QtPy!. so its basically pyside2 bug all along
i knew it
so. back to the question. which license do I get if there's a mixed up like this, both LGPL and GPL?
 
6:00 PM
@arielma I'm unclear why you keep mentioning conda which is just a distribution of python and not an IDE like Pycharm
Are you actually talking about Spyder, the IDE distributed with conda or a jupyter notebook or something?
 
I guess it's Spyder
 
I'm not sure how we're guessing that and not being sure?
 
Is dict.values() guaranteed to return values in the same order as the correspoding keys from dict.keys()?
 
yes
 
6:17 PM
what is the difference between pylint to pycharm code inspection
 
6:37 PM
Do you know if the coverage run command has option of skip/ignore failures?
 
7:09 PM
Hey, I want suggestion from people, I have a website to scrape that some parts are not in the HTML code unless you click on a javascript button which adds that to part of the code. I wonder how may I capture that part WITHOUT using selenium because it is too heavy and slow and... I appreciate any help
 
@Dead_Light it's probably slow because it renders JS ;)
 
7:30 PM
@AndrasDeak Well, js is what I want.
 
8:11 PM
@MisterMiyagi There writes a man who's never maintained 4K lines of assembler code on paper tape. You wussy wood-chippers have got it easy!
How come I only just noticed the unfortunate effects of hitting escape in this chat's input window? For me it just blanks the input field without undo capability!
@arielma Generally speaking it's easier to run your tests in a test framework, which is designed to control which tests get run, and use coverage integration features to measure the results. If that's what you wanted to know.
 
8:36 PM
can anyone point me in the right direction here? How do I connect to an AWS redshift database with an SSH tunnel? I've got the tunnel working with sshtunnel, but I'm unable to psycopg my way into the database. Meanwhile, I'm able to SSH into the tunnel host and psql into the DB from there, so I know it's up and sane
 
not sure what ssltunnel is? The ssh client should be able to do that by itself
what's your AWS setup like @inspectorG4dget?
 
localhost --(SSH, private key)--> AWS host --(psycopg?)--> RedshiftHost
RedshiftHost is not accessible from localhost and must be accessed via AWS host (and that's where I'm running into trouble)
 
oh okay... you should be able to go into some stuff and create a service key for redshift access
 
Does anyone knows why the coverage run command doesn't have option of skip/ignore failures?
 
@arielma I'd imagine because if it allowed you to do that - it wouldn't have any point running? Or do you mean specific errors etc...?/
@inspectorG4dget I don't have one handy to check right now, but basically, look at service accounts/service keys and permissions and all that
 
8:48 PM
coverage is not a unit testing framework... there are no flags to ignore failed tests because it doesn't run tests
 
coverage report command has this option
 
@JonClements so here's the weird thing. I can do this from the command line: SSH into AWS host, psql -h REdShiftHost -U username -d databasename. And that works exactly right. So I doubt it's a RedShift permissions issue
 
I just don't understand why coverage runcan't have it. assuming you don't want the jenkins pipeline to fail coz of it
meanwhile I used WA to put @unittest.skip in my test files
 
@inspectorG4dget you'd need to look at the permissions at the redshift side... if it's set up as an internal part of the host network, then of course it's going to be weird
does it have external access or just part of a subnetwork?
 
You indirectly execute your test suite through the coverage command. If your test suite has flags to ignore failed tests, just pass them in as you usually would
 
8:52 PM
it does not have external access
 
so you won't be able to directly connect to it then
 
hence the SSH tunnel, no?
 
yup... lemme re-read what you said - sorry - tired eyes
 
all good. I'm very much a n00b to this. So I could be overly confident and entirely wrong
 
@Aran-Fey not sure I got you
 
8:57 PM
What's the exact command you're running? It's not just coverage run, it's something like coverage run -m pytest
coverage executes a test runner, and that test runner must have flags to ignore failed tests. Not coverage itself.
 
coverage run -m unittest
 
Okay, so you have to find out whether unittest can ignore failed tests
 
it does have @unittest.skip
which I put in my test files
 
Then what's the problem? I don't understand
 
how can I combine it with the coverage run command
 
9:07 PM
@arielma Read the unittest command line documentation to get more idea of what you're doing.
 
ok
 
Pretty sure all you have to do is run coverage run -m unittest
 
I guess you are right
tnx
 
 
1 hour later…
10:39 PM
Sure, but if you want to skip tests, only run specific tests, &c then you should understand unittest's command line.
 

« first day (3663 days earlier)      last day (1271 days later) »