« first day (3818 days earlier)      last day (1145 days later) » 
07:00 - 20:0020:00 - 00:00

8:00 PM
only 64 /-: I didn't want to spend that much
 
that's so 2019
 
@Kwsswart I'm glad we agree in the end, but you know that you know better than me how to make this work, so I'm just gonna pester you :P
 
@AndrasDeak laurel 3600 mhz though and RGB!!!
 
RGB? Please tell me your RAM doesn't have lights on it
 
/nodshead... of course not
 
You don't expect me to paly civ6 like a heathen do you
 
Just so we're talking about the same thing... these are sticks you put in the box to make the programs faster, right?
 
hmmm....I'm in the market for computer parts
@AndrasDeak are those LEDs or just paint?
 
> Overall Review: Nothing much to say, RGB lighting on these sticks is simply fantastic and super bright.
LEDs, obviously
 
I had one pair of these before and just bought a second pair.
 
8:05 PM
Although looking at some of the code you write I'm not terribly surprised, piR :P
 
To be fair, it was close to the cheapest memory I could get at that speed at the time. This time, I just wanted to match the exact memory
LOL! Exactly
 
@AndrasDeak I didn't get that far.
 
> Limit 10 per customer.
Excuse me, what
Who buys more than 10 of those?!
 
@roganjosh Lol Had to learn the hard way... still plan to look into it a bit more and see how it could be used in different ways but overall much simpler going without
 
@Aran-Fey how else do you decorate your christmas tree?
 
8:07 PM
... good point
 
rbrb, have to get lights to pulse with music.
 
as John von Neumann intended
 
I found out why the command .loc didn't work... It didn't do what I thought it would do. Instead of df.loc["EEG"] it is just sumple df["EEG"]...
Only spent +1 hour on this
 
@TDuncker loc[indexthings, columnthing] is more consistent. df[this] does different things depending on what this is.
 
@TDuncker Sorry, I did post an example about using loc to index columns but I didn't realise you didn't know how that worked
 
8:15 PM
I did use it like two semesters ago. Definitely my own fault I scrambled the meaning of the things :p
 
Yeah, it's the [: part I was missing to get all of it.
 
yup
 
I need to rant. Dev just asked me for a PR review and merged without approval after disagreeing with my feedback </rant>. I'm gonna go eat a taco now
 
That's not nice. Nor helpful. (Not the taco. Embrace the taco.)
Even if you were just bikeshedding it's bad form
 
8:24 PM
yup. They named a custom error code "GENERIC_..." when it wasn't used generically. I said "either use it generically to justify the name or rename it to reflect its specificity, because it is otherwise misleading". I got back "Is this really the most productive use of our time? I'm managing our sprints, issues, ... <merge />"
 
Tell them "you asked for review, not approval" :P
 
fair, I was being pretty specific, but I really don't like being told on a PR conversation "can you please approve this so I can move on?"
@AndrasDeak whoa! I wish I had the cojones to do that. If we had a larger dev team, I certainly would have. But it seems that everyone else is pretty naive about version control and software dev and wouldn't even know the right answer when they saw it
 
To be fair that's a sure way to escalate the tension. Even if it's smooth.
actually solving people problems is often less gratifying in the short run, because one should keep their sense of superiority to themself
 
no kidding. Also, "certainly" was used figuratively there
<back with a taco>
I actually enjoy solving those problems (I guess that's why I'm here). I even remember a time when some OP got super mad at me for asking clarifying questions in the comments. Others had to "come to my rescue", but I'd disappeared by the time OP calmed down
 
8:55 PM
@inspectorG4dget my previous team was pretty open to really nitpicky reviews. For the most part, egos didn't get involved and we had mostly constructive conversations (either on the PR or through other channels) about such things as names and other minutiae.
 
@Code-Apprentice thanks. Really appreciate that empathy
 
@Code-Apprentice it helps if both (all) parties are assertive
 
@AndrasDeak good point. And if there's a relationship that fosters discussion when parties disagree.
 
9:11 PM
I'm a bit confused why a Series look like this: https://i.imgur.com/VSut0TH.png
It's like it adds its own index to these values. When I look up the documentation, I see that there's a lot of sorting commands and alike to manipulate using the index, though I'm not really sure if it's something I should think about. I don't need the index. Should I just let it be? It confused me, because I expected the format to just be (0, 1, 4, 2, 3, 0) while it to me looks two-dimensional. But .shape says (6,), so it's one-dimensional?
 
@TDuncker series have an index
>>> import pandas as pd
>>> df = pd.DataFrame({'a': [2, 3], 'b': [4, 6]})
>>> df
   a  b
0  2  4
1  3  6
>>> df.shape
(2, 2)
 
But just to be sure, that doesn't mess with my code later, right? It doesn't think the Series is like... two-dimensional?
 
so do dataframes
@TDuncker think of how it could mess with it, and confirm that it doesn't
>>> pd.Series([2, 3, 4]).index
RangeIndex(start=0, stop=3, step=1)
>>> pd.Series([2, 3, 4], index=[5, 6, 7])
5    2
6    3
7    4
dtype: int64
>>> pd.Series([2, 3, 4])
0    2
1    3
2    4
dtype: int64
>>> pd.Series([2, 3, 4]).sum(0)
9
If it thought that it's 2d then you'd get 2 values in the sum
@TDuncker seems like you're still learning the basics of pandas. So have you read a tutorial yet?
There even seems to be a "view as series" link in your screenshot. What does that do?
 
@TDuncker A pandas.Series is like a glorified dictionary. It has an index which are like its keys and it has values. A pandas.DataFrame is a Series of Series where all the Series share the same index. When you assign a list to a DataFrame column it automatically inherits the shared index.
 
Here's how my debugger represents a series:
s: Series [pub]
| 5: 2 (int64)
| 6: 3 (int64)
| 7: 4 (int64)
 
9:17 PM
I didn't do a tutorial. I went right into it and do a bit of checking out StackOverflow/online tutorials/checking official documentation when something is needed.
The top right in the screenshot is "View as Series"
 
@TDuncker considering how you've had to pause for the second fundamental thing within a few hours it might be a good investment of your time. I'm sure there's an official tutorial.
 
I'll hop to that first thing in the morning then.
 
Often times you don't care about the index But the benefits are numerous.
I though itertools had a combinations where order matters thing.
 
@piRSquared you mean permutations? :P
(I know you don't)
 
@AndrasDeak ... no, I do mean that /facepalm
 
9:29 PM
ah...
 
I thought I looked at the signature before and didn't see the choose r parameter. Now I see it (because I looked after your comment).
 
I feel so ill prepared for actual work, when I'm done with university in summer...
It'll probably be fine, I guess. Lots of stuff to learn at the workplace, but I definitely don't feel like I can just get a job and start working just like that.
 
I don't think anyone can start working just like that (but I never had a real job)
 
9:45 PM
I don't know what I'm doing wrong here...
 
Does "something you're doing wrong" exist?
 
foo = Mock()
foo.bar(data).return_value = False
if foo.bar(data):
  print("True")
it prints True for me
 
@CarlAnderson baz.return_value affects how baz() behaves docs.python.org/3/library/…
that would be foo.bar(data)() in your case
 
in this case, foo is meant to mock a Class that I've defined elsewhere
oh I didn't see the extra parens
 
I don't know unittest so I don't know how you should do what you want to do, but I see why it doesn't do what you want to do.
 
9:50 PM
let me try adding them
 
seems like you want the mocked method to return a given value
I'd naively think that you should be messing with foo.bar.return_value, but again I don't know unittest at all so don't take this seriously
 
hrm, no changing it to foo.bar(data)().return_value = False doesn't work either
and yes, that's what I'm aiming for, is for any subsequent calls to foo.bar() with that data to return False
 
@CarlAnderson yes, no. I meant that foo.bar(data).return_value = False should make foo.bar(data)() evaluate to False
 
ok, so how do I make foo.bar(data) evaluate to False instead of foo.bar(data)() ?
 
5 mins ago, by Andras Deak
I don't know unittest so I don't know how you should do what you want to do, but I see why it doesn't do what you want to do.
I'd start with googling "python unittest mock return value for given input"
 
9:57 PM
ok
 
Anyways, bedtime. Thanks for the help, you guys rock. Gonna read the linked tutorial and keep going tomorrow.
 
rhubarb
 
@CarlAnderson did you take a wrong turn at Albequerque?
@CarlAnderson foo.bar.return_value = False will return False no matter the parameters passed to foo.bar().
The only way I know to return a value for specific input is to write a function with that logic:
def returnFalse(data):
    if data == expectedData:
        return False
    return True

foo.bar = returnFalse
 
ok, I had thought I had tried without the argument passed in and it still didn't work
 
Personally, I don't like this kind of thing in my unit tests, though, since a test should test exactly one thing. Meaning that the mocked foo.bar() should behave one way for a single test. Tests for different scenarios should just create their own specific return values for foo.bar().
 
10:10 PM
@Code-Apprentice returnFalse(). Plot twist: return True ;)
 
I'm trying to unit test whether or not another class that has a Foo will do the right thing when Foo.bar() returns false for anything passed in
 
@CarlAnderson In my experience, mocking the right thing is tricky and takes some experimenting. For the situation where foo.bar() returns a specific value, then setting foo.bar.return_value is the way to go. But maybe you need to mock package.foo.bar() instead or something else to inject exactly where you need it.
 
@CarlAnderson "for anything passed in", so just mock foo.bar entirely as Code-Apprentice said?
 
yeah trying that now
I thought I had tried it and it didn't work
but trying again
 
I see
 
10:12 PM
@CarlAnderson what's your @mock.patch look like? Are you sure it is patching the correct class in the correct place?
 
I don't have a @mock.patch
 
How are you creating a mock?
 
foo = Mock()
 
oic...
and then passing it into the function you are testing?
 
10:14 PM
okay, let me know how it works out for ya.
 
so now I have this:
foo = Mock()
foo.bar().return_value = False
if foo.bar()
  print("True")
 
@CarlAnderson no
in python functions are first-class objects
 
and it's printing True
 
if you put () after a function's name it will call the function
you want to act on the function itself!
foo.bar.return_value = False
26 mins ago, by Andras Deak
@CarlAnderson baz.return_value affects how baz() behaves https://docs.python.org/3/library/unittest.mock.html#unittest.mock.Mock.return_value
follow the pattern ^
foo.bar().return_value would affect foo.bar()()
 
ah ha
ok
 
10:16 PM
you also had a syntax error in that last snippet
And this was your second example where you had a single space for indentation. I hope in your real code you're using 4 spaces everywhere.
 
yes, I'm translating it from my actual production code
and then I didn't know how well the code formatter would work
it's now returning false, thanks!
 
Chat markdown is pretty crap. Specifically for formatting multiline code you can read our guide and practice in the sandbox linked from there
 
ah, thanks
 
Don't you need code markdown for Android? :)
 
in Android our rule is that if the snippet is more than 4 lines we require you use Pastebin
 
10:20 PM
Yeah, makes sense.
 
and inevitably everything is more than 4 lines so I never use the multiline code feature
 
Hehe, yes :D
 
@CarlAnderson replit.com/@codeguru/NoisyTruthfulMonotone since I made this example, I'll still share it. Sounds like you figured it out already anyway.
 
...
So inside my unit test method if I call foo.bar() it's returning False as expected, but inside of the method I'm testing it's returning True
 
10:29 PM
and I'm not passing it in directly but rather storing it in a punq Container
starting to wonder if maybe it's not the same object at that point
 
are you sure foo.bar() is called on the object you pass in?
what is punq?
 
yes, it's a rather simple method
@Code-Apprentice pypi.org/project/punq
 
sounds like there's an extra layer of complexity. Can you give an example that illustrates how punq is involved here.
I'm reading some documentation and it looks like punq instantiates instances of the class.
 
yeah that's my impression at this point and I might have to take an entirely different approach if that's the case
 
@CarlAnderson Where is the real deps.register(types.Action.CREDIT, Foo) called? Does this execute at any point in your test?
 
10:38 PM
yeah, printing the objects indicates that the object created in the test code doesn't have the same memory ID as the one in the actual method we're testing
so this isn't going to work with punq
 
@CarlAnderson Alternatively, you could mock deps.resolve() to return something that works with your test. But that seems really hacky since it circumvents the whole DI thing.
 
yeah
Figured it out! if I set instance=my_mock in the container.register call it saves that specific instance and the test passes
 
hey, quick question.
I sent an ajax to a route with a formData

    let x = new FormData();
    x.append("q", JSON.stringify(jsonList));
    x.append("a",file.files[0]);
----> ajaxed


# python side
    if request.method == 'POST':
        data = request.form
        print(f"data : {data}")
        print(f"data[q] : {data.get('q')}")
        print(f"data[a] : {data.get('a')}")
        return jsonify("sucess","YES IT WORKED!") # this is printed on the js console
for some reason data.get('q') & data.get('a') are both None...
am I pulling the data from the form the wrong way?
 
10:54 PM
@CarlAnderson oh...here's another option: foo.return_value.bar.return_value = False. At least I think this should work. Since foo is actually a class that you are registering with punq, foo.return_value mocks the object that is returned when you instantiate an instance of that class with foo().
another pythonism here: classes are themselves first-order objects.
 
yeah it's going to take some getting used to
 
@LoopingDev I'm not a webdev, so this might not mean anything, but everything there looks correct to me. How are you sending that form data?
 
@CarlAnderson python? yah, it's an interesting language with some gotchyas
 
yeah
anyway, time to get a PR up before the end of the day
thanks again for the help
same to you @AndrasDeak
 
no prob
@LoopingDev what do you mean by "ajaxed"? And what is the output of data on the backend?
 
11:00 PM
function testAjax(data , link){

         var xhttp = new XMLHttpRequest();
        xhttp.onreadystatechange = function() {
      if (this.readyState == 4 && this.status == 200) {
        var response = JSON.parse(this.responseText)
            console.log(' success ')
            var response = JSON.parse(this.responseText);
            console.log("response: " , response) // this is being printed , that means its working as it should
       }
       else{
        //error
            console.log(' Error ')
well i just pass in the data and the link to this test function
let me try to console.log the properties of the data, because it looks suspicious .
false alarm, i added console log right before the ajax and call xhttp.send(data); and everything is legit
on the server side that is what i get
werkzeug.exceptions.BadRequestKeyError: 400 Bad Request: The browser (or proxy) sent a request that this server could not understand.
KeyError:'a'
also tried request.form.get('a') it prints out None
 
07:00 - 20:0020:00 - 00:00

« first day (3818 days earlier)      last day (1145 days later) »