JupyterLab 3.0.14 How to disable code style highlights (pycodestyle) - jupyter-lab

I just installed WPy64-3940 that comes with JupyterLab 3.0.14 .
To my surprise, now my code comes decorated with things called "pycodestyle".
As you can see below, the code is underlined in orange and a popup can appear.
I do not like that at all, it perturbs my reading.
Would you know where this comes from and how I can disable this?
Thanks
Michel

This is not a built-in feature of JupyterLab, but an extension called jupyterlab-lsp. As one of the authors I am surprised to see it included by default on the WPy64 distribution, and sorry you don't like it. Here are three potential solutions:
Ignore this specific diagnostic message (recommended). Right click to bring up context menu and select "Show diagnostics panel"; hover mouse over the row with diagnostic message that you do not like, right click, select "Ignore diagnostics like this".
Disable pycodestyle diagnostic provider completely in setting of the language server. Click on "Settings" menu (top menu bar) → "Advanced Settings Editor" and choose "Language Servers" tab. Copy paste the following settings ("pyls" is the old server, "pylsp" is the new one - only one is needed but I do not know which one you are using); you can also disable other sources of diagnostics for this language server here:
{
"language_servers": {
"pyls": {
"serverSettings": {
"pyls": {
"plugins": {
"pydocstyle": {
"enabled": false
},
"pyflakes": {
"enabled": true
},
"flake8": {
"enabled": false
}
}
},
"pylsp": {
"plugins": {
"pydocstyle": {
"enabled": false
},
"pyflakes": {
"enabled": true
},
"flake8": {
"enabled": false
}
}
}
}
}
}
}
Disable all diagnostics by going to "Diagnostics" tab and adding a catch-all regular-expression rule like this:
{
"ignoreMessagesPatterns": [".*"]
}
Disable the LSP extension altogether. It is probably best to consult whoever creates WPy64-3940 on how to do this.

Related

Android Management API - Single App in Kiosk Mode - How to hide status and navigation bar?

What I would like to achieve?
For internal purposes only / within our enterprise only, I would like to have Android tablets, which run only one single app (made with Ionic/Angular) which even appears after restarting the tablet and the user is not able to leave it.
I think the technical description of what I would like to achieve is called a dedicated devices (formerly called corporate-owned single-use, or COSU).
How would I like to achieve it?
I would like to achieve this with Android Management API, which looks like a great choice for a MDM (Mobile Device Management) solution.
Here Google shows how to achieve this with an Android Management API policy.
The Problem?
I am not able to get rid of the status and navigation bar.
For testing purposes I tried to achieve this with the regular YouTube app. With "statusBarDisabled": true, I was able to disable the status bar, so the user can not interact with it, but it is still visible.
And same goes for the navigation bar with
"persistentPreferredActivities":[
{
"receiverActivity":"com.google.android.youtube",
"actions":[
"android.intent.action.MAIN"
],
"categories":[
"android.intent.category.HOME",
"android.intent.category.DEFAULT"
]
}
]
I was able to hide the home and recents buttons, but the back button is still there and the whole navigation bar is visible.
The following image visualises the problem:
Anyone an idea how I can get rid of the status and navigation bar completely?
This is how my whole policy looks like:
import json
policy_name = enterprise_name + '/policies/policy1'
policy_json = '''
{
"safeBootDisabled": true,
"statusBarDisabled": true,
"keyguardDisabled": true,
"screenCaptureDisabled": true,
"factoryResetDisabled": true,
"cameraDisabled": true,
"blockApplicationsEnabled": true,
"systemUpdate": {
"type": "WINDOWED",
"startMinutes": 120,
"endMinutes": 240
},
"policyEnforcementRules": [{
"settingName": "persistentPreferredActivities",
"blockAction": {
"blockAfterDays": 0
},
"wipeAction": {
"wipeAfterDays": 3,
"preserveFrp": true
}
}],
"applications": [
{
"packageName": "com.google.android.youtube",
"installType": "FORCE_INSTALLED",
"lockTaskAllowed": true,
"defaultPermissionPolicy": "GRANT"
}
],
"persistentPreferredActivities": [
{
"receiverActivity": "com.google.android.youtube",
"actions": [
"android.intent.action.MAIN"
],
"categories": [
"android.intent.category.HOME",
"android.intent.category.DEFAULT"
]
}
]
}
'''
androidmanagement.enterprises().policies().patch(
name=policy_name,
body=json.loads(policy_json)
).execute()
The two bars you've highlight are actually part of the youtube app NOT part of the android OS/UI. So you can't hide those using the device management API.

Sublime Text 3 FileBrowser plugin: how to open in new tab by default

I am using the Sublime Text 3 FileBrowser for file navigation on keyboard.
While usually I open files in new tabs, with FileBrowser, it opens
On the official documentation (https://packagecontrol.io/packages/FileBrowser), it says:
Open all marked items in new tabs ⌘+enter / ctrl+enter
So when I open a file on 'Enter', it will open in the same split pane as the
I want to change this behavior
So I go to Preferences -> Package Settings -> FileBrowser ->
Settings - Default
Key Bindings - Default (Common)
to look for options I can override in user settings. However, nothing seems right.
Somehow found an answer while posting the question, so I throw it out first and look for any better ways from the community.
By setting an open directory command in the Key Bindings, it reverts to opening in a new tab as by default.(I set it as a user setting for easier management: Preferences -> Package Settings -> FileBrowser -> Key Bindings - User)
(from the official package page: https://packagecontrol.io/packages/FileBrowser)
[
{
"keys": ["f1"],
"command": "dired",
"args": {
"immediate": true,
"single_pane": true,
"other_group": "left",
}
}
]
Of course, you can bind the "dired" command to any other suitable key, and tweak other behaviors such as putting it left or right.
One thing to note is that this must not be used with
{
"keys": ["enter"],
"command": "dired_select", "args": {"and_close": true},
"context": [
{ "key": "selector", "operator": "equal", "operand": "text.dired" },
{ "key": "setting.dired_rename_mode", "operand": false }
]
}
Maybe there are ways to tweak around, so I can both open in new tab on "Enter", and let the browser close automatically after selection. For now, I'm settled for closing it with F1.

Function highlighting with monokai in VS Code / Atom and Sublime

While running Sublime Text 3 and VS Code (or Atom) with the Monokai color theme, the Sublime Text syntax highlighting uses blue for function calls, such as in the example below
However, when I open the same code in VS Code using the monokai theme, functions are not painted blue
I would really like to change that, the code looks much better with function calls highlighted. However, I looked around the web and couldn't find how to change this behavior. Does anyone have any tips for that?
Thanks!
SEE UPDATE BELOW!
Seems like I've found a temporary solution. Go to this folder (if you are on Mac) /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/theme-monokai/themes and put this code in monokai-color-theme.json file:
{
"name": "Function call",
"scope": "meta.function-call.generic",
"settings": {
"foreground": "#66d9efff"
}
},
Here is an example how it can look like:
screenshot
But keep in mind, that after theme update this changes may disappear!
UPDATE:
After having a couple more troubles with highlighting, I decided to upload the file with theme to GitHub and keep it up to date. So, if you don't want to dive into the code, just look in my repository: https://github.com/spyker77/monokai-theme-extended
UPDATE (April 2021)
It turns out that the previous solution is not sustainable. Therefore at the moment a better one could be:
In you Visual Studio Code go to "Code" => "Preferences" => "Color Theme" and pick Monokai;
Open settings.json file (how-to);
There will probably already be a bunch of settings in there, so all you need to do is just add the following customisations at the end and before the closing brace (don't forget a trailing comma after the last setting you continue):
"editor.tokenColorCustomizations": {
"[Monokai]": {
"textMateRules": [
{
"name": "Decorator definition decorator",
"scope": "punctuation.definition.decorator.python",
"settings": {
"foreground": "#F92672"
}
},
{
"name": "Meta function-call",
"scope": "meta.function-call.generic.python",
"settings": {
"foreground": "#66D9EF"
}
},
{
"name": "Storage type function async",
"scope": "storage.type.function.async.python",
"settings": {
"foreground": "#F92672",
}
},
{
"name": "Punctuation separator period",
"scope": "punctuation.separator.period.python",
"settings": {
"foreground": "#F8F8F2",
}
},
{
"name": "Entity name function decorator",
"scope": "entity.name.function.decorator.python",
"settings": {
"foreground": "#66D9EF",
}
},
{
"name": "Entity name type class",
"scope": "entity.name.type.class.python",
"settings": {
"fontStyle": ""
}
},
{
"name": "Entity other inherited-class",
"scope": "entity.other.inherited-class.python",
"settings": {
"fontStyle": "italic"
}
},
{
"name": "Support type python",
"scope": "support.type.python",
"settings": {
"fontStyle": ""
}
},
{
"name": "String quoted docstring multi python",
"scope": "string.quoted.docstring.multi.python",
"settings": {
"foreground": "#88846F",
}
}
]
}
}
after trying for server hours finally found a solution and I came back to you to share the solution since I tried the answer above and couldn't make it work.
it turns out that the problem I with VScode extensions (python for Vscode), so disable that first,extension
then go to your setting.json file like that how to open setting
add this to the top of your file
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": "meta.function-call.generic",
"settings": {
"foreground":"#19D1E5"
}
}
]
},
and restart VScode and this should work, btw I am using monokai vibrent, and I am sure it will work in any theme you like.
setting.json
like this here
In settings.json:
"editor.tokenColorCustomizations": {
"[Monokai]": {
{
"scope": "entity.name.function",
"settings": {
"foreground": "#fdc306d0", // use your desired color
"fontStyle": "underline" // I like this, foreground color has some reduced opacity
}
}
}
}
might do the trick.

Sublime Text 3: how to show line numbers and bookmarks in distraction free mode?

It's quite easy to show/hide tabs or minimap in distruction free mode using View menu (Alt+V) or Ctr+Shift+P. Is it possible to do the same for line numbers and bookmark arrows?
Or maybe center whole text in a fullscreen mode? It would have the same effect.
It is not default behavior (keybinding). You can get line numbers, centering etc. only by modifying user config (Preferences -> Settings-More -> Distraction Free-User).
Add for example this:
{
"gutter": true,
"line_numbers": true
}
to get line numbers.
P.S. I was also looking for some shortcut for this. No luck. This is the only way I found for now.
Following the comment on the question by Keith Hall, you can do it by creating a custom keybinding. Open Key Bindings from the Preferences menu and add the following to your user keymap.
[
{
"keys": [ "ctrl+k", "ctrl+l" ],
"command": "toggle_setting",
"args": { "setting": "line_numbers" }
}
]
I chose ctrl-k, ctrl+l as the binding to match with the existing binding that hides the sidebar (ctrl-k, ctrl+b), but obviously it can be whatever you like. Search through the list of existing bindings to avoid a clash.
for line and column number open the setting file: (Preferences -> Settings-More -> Distraction Free-User)
{
"line_numbers": true,
"gutter": true,
"column_number": true,
}
OK, here is a solution ( ~/.config/sublime-text-3/Packages/User/Preferences.sublime-settings ):
{
"always_show_minimap_viewport": true,
"draw_centered": true,
"word_wrap": true,
"wrap_width": 80,
"font_size": 10,
"rulers":
[
80
]
}

«Invalid value» error while brackets in chrome.commands

I need hotkeys Alt + ] and Alt + [. I have manifest.json like:
{
...
"commands": {
"nextTrack": {
"suggested_key": {
"default": "Alt+]"
},
"description": "Next track"
},
"previousTrack": {
"suggested_key": {
"default": "Alt+["
},
"description": "Previous track"
},
"toggle": {
"suggested_key": {
"default": "Alt+P"
},
"description": "Toggle pause"
}
},
...
}
When I enable my extension I get:
Could not load extension from '~/project'.
Invalid value for 'commands[1].default': Alt+].
What is way to use that hotkeys?
Only uppercase letters (A-Z) and digits (0-9) are valid values, as you can see by looking at the source code of the chrome.commands API.
If you want to use other characters, inject a content script in every page which binds a keydown event:
document.addEventListener('keydown', function(event) {
if (!event.ctrlKey && event.altKey && event.which === 80/*P*/) {
// Dispatch a custom message, handled by your extension
chrome.runtime.sendMessage('Alt+P');
}
}, true); // <-- True is important
Disadvantages of this method
Keyboard focus must be within a page where the content script is activated. The shortcut will fail if you're inside the Developer tools, omnibar, etc.
Even if you use <all_urls> as a match pattern, it won't work on non http(s) / file / ftp(s) schemes like chrome:, data:, chrome-extension:, about: or the Chrome Web store.
You can run into problems with detecting the [ character, if the keyboard layout does not support it, or uses a different key code.
There's no built-in support for customizing this shortcut (as a user, visit chrome://extensions/, scroll to the bottom and click on "Configure commands" to change the extension's shortcut).
I suggest to pick a different shortcut, or change the way how your extension is controlled (through a page / browser action popup, for instance).

Resources