What is the dunder method for 'or' operator? - python-3.7

I am looking through the internet and I don't seem to find the right answer. In PyCharm it highlights the dunder methods when you define one. So I tried __or__ and it highlighted it purple. Then I thought "maybe this is the one", but with a lot of thinking I faced the hard way that __or__ is for |. So how do I override the or operator?

Related

VSCode built-in snippets fail to to show when consecutive letters are typed

If I type one letter of the trigger/prefix, the snippet suggestion works to show the built-in snippets from extensions. But, once I type the next letter in the trigger/prefix...the built-in snippet from the extension is gone. Meaning, it is no longer found anywhere in the dropdown list (you won't find it by scrolling). .
Here is a snapshot confirming that the trigger/prefix is removed from the list
I found that with some built-in snippets from extensions, if I type out the entire word, it will reappear. For example, if I want: 'trycatch', it will be populated in the list when I type 't', disappear when I have typed 'tr', but then reappear when the entire trigger/prefix is typed.
How can i get a built-in snippet from an extension to show in snippet search when 2 or more letters of the trigger/prefix are typed? I am using version 1.75.0
I tried looking at the docs of VSCode, but it's too simple to help. I tried looking at my settings (keyword: snippets) and play around with any possibilities, but nothing seemed to fix it. Any google search comes up empty as well.

How to auto-uppercase MySQL after typing keywords?

I type pretty fast so I want MySQL Workbench to auto-capitalize keywords after I type them. I've seen a solution to a similar question which is MySQLWorkbench-> Preferences-> Query Editor-> Change keywords to UPPER CASE. However this only provides uppercase for autofill. The problem is that the dropdown menu takes a second to load and hinders my work flow.
Is there any solution to this problem? Could I create a trigger for this or is that not helpful?
Not an automatic solution but something useful: look in the Edit -> Format menu. It has entries to upcase + downcase keywords, as well as other formatting commands.

editor.wordWrap wraps text at weird locations

I am using vscode as a Latex editor, and I have noticed the UI, when word wrap is enabled, performs some pretty odd word wraps. For example, in the following sentence
Something is wrong here. And another sentence.
It has no problems in performing this type of wrapping (column:23):
Something is wrong here
. And another sentence.
While one would expect either of these to happen instead:
1) a one/two-character "forgiving" wrap
Something is wrong here.
And another sentence.
2) a "treat space as tokenizer" wrap
Something is wrong
here. And another
sentence.
Is there any way to tweak the current behavior?

CodeMirror highlighting on find

I want to recreate the find function in CodeMirror for highlight each occurrence like showed in this demo.
I have created an example using marks, but highlight only the first occurrence.
http://jsfiddle.net/oxmgm4sd/
Changing your if (cursor.findNext()) to while (cursor.findNext()) might already get you somewhere. It is more efficient (though also a little more complicated) to use an overlay instead, which is what the built-in search functionality does.

Eclipse - custom quick fix - Add some text before and after selection

I could use a dummy guide or directions how to add a custom quick fix or if it is even possible.
Let's say I select a text inside code - "foo foo". Now I want to add something before that text and something after. The content before and after remains the same across many files and it has to be done manually.
Is there a way I could write my own quick fix in eclipse, which would add this text automatically.
Ctrl + 1 -> "Add ... before and ... after" -> And get the desired output?
This seems somewhat useful if not the correct thing, but I can't exactly read out how to accomplish this: FAQ How do I implement Quick Fixes for my own language?
Any easier explanations and guides are appreciated. Or what other ways would I have to accomplish this desired behavior without typing/copying repetitive things
Edit: Found this little macro thing which is one way to solve my problem. start with cut, write, paste and end macro. But I'm not sure if this is the best way. Practically Macro
I suggest this solution that allow you to get the result using Eclipse search.
CTRL+H to do a search and choose Files Search
Fill Containing text with "foo foo". Tweak other parameters to get the files you want
Check Regular expression
Click on Replace
Fill With: <prefix>$0<suffix>. For example if you want to substitute "foo foo" with "this is a foo foo example" write this is $0 example
Check Regular expression (if unchecked).
Done. I think that this solution is quite flexible (as long as you are familiar with regexp to get desidered strings) and easy to apply.