PyCharm Flashcards

(89 cards)

1
Q

Effective PyCharm 9 topics

A
  1. Projects
  2. Editor
  3. Git
  4. Refactoring
  5. Databases
  6. Debugging
  7. Profiling
  8. Testing
  9. Packaging
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Projects: 4 kinds of roots

A
  1. Source roots: for resolving imports
  2. Resource roots: images, style sheets
  3. Excluded: ignored by PyCharm
  4. Template folder: templates
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Projects: Add installed package to requirements.txt

A

Right click on the import > Add imported packages to requirements.txt

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Projects: search everywhere

A

Double Shift:
1. Search classes
2. IDE actions
3. files
4. Git

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Projects: search show_leaderboard()

A

Double shift > s_l

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Editor: create a function in module by simply calling the function

A

alt+enter

mymodule.new_func()
# Create function new_func() in module mymodule.py
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Editor: install a package by simply calling the package’s function

A
resp = requests.get(url)
# alt+enter
# 'Install and import package 'requests'
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Editor > Live Templates

A

main turns into ‘if __name__ == ‘__main__’
Search settings for ‘Live Templates’ to edit templates

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Hot key for arguments tooltip

A

Ctrl + P

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Turn regular string into f-string

A
print('{e')
# autocompletion pop-up with available variables
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

To enhance autocomplete…

A

provide type hints

def my_func(arg) -> Optional[User]
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How to discover new features?

A

Open action palette and search for stuff:

Ctrl + Shift + A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Find usages

A

F7

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Pre-commit settings

A

You can optimize imports and reformat the code in the commit window

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Select only certain changes for a commit

A

In the git palette on the left click ‘diff’ icon and press checkmarks next to the changes you want to include

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Create label in local history

A

Right click - Local history - Put label…

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

‘Refactor this’ hotkey

A

Ctrl + Alt + Shift + T
^ T (Mac)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

5 Main Refactor tools

A
1. Extract/introduce Variable/Constant/Parameter Object/Method/Field/Superclass
2. Inline is the opposite of extract/introduce
3. Pull class members up/down
4. Move (a class) to another file (or drag and drop them)
5. Move to a package
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Visualize only specific tables

A

Select tables and click visualization

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

Debug: conditional breakpoint

A

Add Condition checkmark
or click More on the breakpoint pop-up

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

Profiling the app

A

Click Profile icon (3rd from the Run)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

Enable custom config .ideavimrc

A

Click on the IdeaVim icon > Enable .ideavimrc

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

My Custom IdeaVim enable/disable hotkey

A

Alt+v
Settings > Keymap > search ‘vim’ > Tools - Alt+v

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

My Custom VCS Next/Previous Change

A

Alt + PgUp
Alt + PgDn

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
My Custom Git Blame hotkey
CTRL+SHIFT+ALT+A
26
Show autocomplete
CTRL+Space
27
Add annotations
ALT+Enter Choose annotation
28
Change selection CASE
Select Shift x2 type 'case'
29
PyCharm Actions
CTRL+SHIFT+A (show line numbers)
30
Select a word or a keyword (if)
CTRL+W
31
Select the whole string or the whole keyword statement (if)
CTRL+W+W
32
Select the whole string with quote marks
CTR+W+W+W
33
Select the whole call within brackets
CTR+W+W+W+W
34
Shrink the selection
CTRL+SHIFT+W
35
Move line down
Action Palette: CTRL+SHIFT+A Move Line Down (mld)
36
Surround code with boilerplate (try/except etc)
CTRL+ALT+T (Ubuntu terminal) CTRL+SHIFT+A > 'surround'
37
Return to the previous wrap state (unwrap)
CTRL+SHIFT+DELETE
38
Multiple Selection
ALT+J at the caret ALT+J again to the next occurence (put cursor at 'th' Text)
39
Deselect previous occurrence (remove second cursor)
ALT+SHIFT+J
40
Select all occurrences in a file
CTRL+ALT+SHIFT+J
41
Recent (edited) locations pop-up
CTRL+SHIFT+E
42
Navigate between errors or warnings
F2 Shift+F2
43
Browse through methods
Alt ↓ Alt ↑
44
Go to a line in code or a column in a database
CTRL+G CTRL+G :column_name
45
Plugin for hotkey learning
Key Promoter X: shows hotkeys for actions. Suggests creating hotkeys for actions without default hotkeys
46
Custom hotkey for opening database window
ALT+D
47
Custom hotkey for Refactoring menu
Default: CTRL+SHIFT+ALT+T Custom: ALT+T
48
Open Services window
ALT+8
49
Replace and not insert autocompletion
CTRL+SPACE Select autocompletion Tab
50
Postfix 'if is not none' completion movies_dict.get('year')
Type .if Select .ifnn for 'if is not None'
51
Type-matching completion
CTRL+SHIFT+SPACE
52
F-string completion
{my Select popped up Autosuggestion
53
Quickly select item from Refactoring Menu
Invoke Refactoring Menu: ALT+T Type ip for 'Introduce Parameter'
54
Refactor - Rename - Exclude item from renaming
SHIFT+F6 Refactoring Preview window at the bottm Select item to remove Delete
55
Refactor: Extract Variable
CTRL+ALT+V
56
Refactor: Extract Method
CTRL+ALT+M
57
Settings: disable code drag-n-drop
search for "Move code fragments with drag-and-drop"
58
Recover parts of code from Local History
Local history - click on a chevrone
59
Reformat selection/whole file
CTRL+ALT+L selection or whole file
60
Reformat settings
CTRL+ALT+SHIFT+L
61
Method's signature
Caret in (): CTRL+P
62
Quick documentation
CTRL+Q
63
Pop-up definition at caret
CTRL+SHIFT+I
64
Go to the next highlighted error
F2
65
Expand warning description
CTRL+F1
66
Highlight all usages within a file
CTRL+SHIFT+F7
67
Search only for classes
CTRL+N
68
Search only files
CTRL+SHIFT+N
69
Look for a method or global variable
CTRL+ALT+SHIFT+N
70
Search for a whole word in Files window (CTRL+SHIFT+F)
CTRL+W
71
Replace in Files window
CTRL+SHIFT+R
72
Jump to declaration of method/its usages
CTRL+B
73
Detailed view of usages
ALT+SHIFT+7
74
Pin the search in Find tab
Right Click > Pin
75
Find tab
ALT+3
76
See file structure
CTRL+F12
77
Recent files window
CTRL+E
78
Delete files from recent history
DEL
79
Discover your code in recently visited files
CTRL+SHIFT+E
80
Set a break point on a line
CTRL+F8
81
Run a debugger
SHIFT+F9
82
Quick Evaluate a variable in debugger
CTRL+ALT+8
83
View type hierarchy
`CTRL+H`
84
View call hierarchy
``` CTRL+ALT+H ```
85
Using RegEx find ext...Select in 'Find in files' window
``` CTRL+SHIFT+F #enable regex search via ALT+X ext.*Select ```
86
Last Edit Location
``` Ctrl+Shift+Backspace ```
87
Toggle inline hints for codeium
`ALT+H`
88
Disable codeium
`ALT+C`
89
Codeium chat
`ALT+B`