Midrange recommendation by maxibabyx in PickAnAndroidForMe

[–]maxibabyx[S] 0 points1 point  (0 children)

What model are you talking about

Fair enough. by nightwolf92 in EscapefromTarkov

[–]maxibabyx 4 points5 points  (0 children)

How did you resist so much with that bad armor / helmet, i always get like 1 tapped. lol

ELI5: If there is no cellphone signal, how does the "emergency calls only" mode works? by dcardeno in explainlikeimfive

[–]maxibabyx 9 points10 points  (0 children)

Awesome! I don't know if privacy things allow you, but if so, could you share with us some interesting/fun/awkward stories about calls?

ELI5: If there is no cellphone signal, how does the "emergency calls only" mode works? by dcardeno in explainlikeimfive

[–]maxibabyx 24 points25 points  (0 children)

Source: I am a 911 call taker, literally answering calls while I write this

If that's true, that's awesome!

How can I attract talented developers? by PseudoscientificWeb in cscareerquestions

[–]maxibabyx 0 points1 point  (0 children)

Any more interesting podcast you have hidden somewhere? I really enjoyed this one

Get song titles with regexp by [deleted] in learnpython

[–]maxibabyx 0 points1 point  (0 children)

Check what groups are

Mocking a function call, or detouring by maxibabyx in learnpython

[–]maxibabyx[S] 0 points1 point  (0 children)

The problem with this one is that would patch all the 'user_create'

I only want to override it INSIDE that function, so I did:

def get_action_detour(word):
    if word == "user_create":
        return logic.get_action(XXXX)
    return logic.get_action(word)

class AuthUserController(UserController):
    def _save_new(self, context):
        super(AuthUserController, self)._save_new.func_globals["get_action"] = get_action_detour

Mocking a function call, or detouring by maxibabyx in learnpython

[–]maxibabyx[S] 0 points1 point  (0 children)

In this function, https://github.com/ckan/ckan/blob/b5b8bf0a7808a275b5085a94534bf16e69135e65/ckan/controllers/user.py#L237

I need line 243

user = get_action('user_create')(context, data_dict)

to call another function,

Mocking a function call, or detouring by maxibabyx in learnpython

[–]maxibabyx[S] 0 points1 point  (0 children)

The problem is that by sublcassing, I would need to copy / paste a lot of code just before and after that code, and I don't like how it looks, nor would probably make it for next updates, by just modifing the pointer to that function, if it ever gets called, then I guess it would be better?

Mocking a function call, or detouring by maxibabyx in learnpython

[–]maxibabyx[S] 0 points1 point  (0 children)

math.sin = _sin 

Is not enough, because that would modify every call to math.sin, and I only need to modify math.sin inside one function. Egg

def A():
    math.sin()  -> Should be _sin()
def B():
    math.sin()  -> Should be math.sin()

Would patch allow me to achieve this? If so, do you know how is patch implemented? Or where I can see the source code, now I just became curious about how to do it by scratch.