PyCharm Flashcards

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 + 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
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

My Custom Git Blame hotkey

A

CTRL+SHIFT+ALT+A

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

Show autocomplete

A

CTRL+Space

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

Add annotations

A

ALT+Enter
Choose annotation

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

Change selection CASE

A

Select
Shift x2
type ‘case’

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

PyCharm Actions

A

CTRL+SHIFT+A
(show line numbers)

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

Select a word or a keyword (if)

A

CTRL+W

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

Select the whole string or the whole keyword statement (if)

A

CTRL+W+W

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

Select the whole string with quote marks

A

CTR+W+W+W

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

Select the whole call within brackets

A

CTR+W+W+W+W

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

Shrink the selection

A

CTRL+SHIFT+W

36
Q

Move line down

A

Action Palette: CTRL+SHIFT+A
Move Line Down (mld)

37
Q

Surround code with boilerplate (try/except etc)

A

CTRL+ALT+T (Ubuntu terminal)
CTRL+SHIFT+A > ‘surround’

38
Q

Return to the previous wrap state (unwrap)

A

CTRL+SHIFT+DELETE

39
Q

Multiple Selection

A

ALT+J at the caret
ALT+J again to the next occurence
(put cursor at ‘th’ <th>Text</th>)

40
Q

Deselect previous occurrence (remove second cursor)

A

ALT+SHIFT+J

41
Q

Select all occurrences in a file

A

CTRL+ALT+SHIFT+J

42
Q

Recent locations

A

CTRL+SHIFT+E

43
Q

Navigate between errors or warnings

A

F2
Shift+F2

44
Q

Browse through methods

A

Alt ↓
Alt ↑

45
Q

Go to a line in code
or
a column in a database

A

CTRL+G
CTRL+G :column_name

46
Q

Plugin for hotkey learning

A

Key Promoter X: shows hotkeys for actions.
Suggests creating hotkeys for actions without default hotkeys

47
Q

Custom hotkey for opening database window

A

ALT+D

48
Q

Custom hotkey for Refactoring menu

A

Default: CTRL+SHIFT+ALT+T
Custom: ALT+T

49
Q

Open Services window

A

ALT+8

50
Q

Replace and not insert autocompletion

A

CTRL+SPACE
Select autocompletion
Tab

51
Q

Postfix completion
movies_dict.get(‘year’)

A

Type .if
Select .ifnn for ‘if is not None’

52
Q

Type-matching completion

A

CTRL+SHIFT+SPACE

53
Q

F-string completion

A

{my
Select popped up Autosuggestion

54
Q

Quickly select item from Refactoring Menu

A

Invoke Refactoring Menu: ALT+T
Type ip for ‘Introduce Parameter’

55
Q

Refactor - Rename - Exclude item from renaming

A

SHIFT+F6
Refactoring Preview window at the bottm
Select item to remove
Delete

56
Q

Refactor: Extract Variable

A

CTRL+ALT+V

57
Q

Refactor: Extract Method

A

CTRL+ALT+M

58
Q

Quick-Fix refactoring

A
59
Q

Settings: disable code drag-n-drop

A

search for “Move code fragments with drag-and-drop”

60
Q

Recover parts of code from Local History

A

Local history - click on a chevrone

61
Q

Reformat selection/whole file

A

CTRL+ALT+L selection or whole file

62
Q

Reformat settings

A

CTRL+ALT+SHIFT+L

63
Q

Method’s signature

A

Caret in ():
CTRL+P

64
Q

Quick documentation

A

CTRL+Q

65
Q

Pop-up definition at caret

A

CTRL+SHIFT+I

66
Q

Go to the next highlighted error

A

F2

67
Q

Expand warning description

A

CTRL+F1

68
Q

Highlight all usages within a file

A

CTRL+SHIFT+F7

69
Q

Search only for classes

A

CTRL+N

70
Q

Search only files

A

CTRL+SHIFT+N

71
Q

Look for a method or global variable

A

CTRL+ALT+SHIFT+N

72
Q

Search for a whole word in Files window (CTRL+SHIFT+F)

A

CTRL+W

73
Q

Replace in Files window

A

CTRL+SHIFT+R

74
Q

Jump to declaration of method/its usages

A

CTRL+B

75
Q

Detailed view of usages

A

ALT+SHIFT+7

76
Q

Pin the search in Find tab

A

Right Click > Pin

77
Q

Find tab

A

ALT+3

78
Q

See file structure

A

CTRL+F12

79
Q

Recent files window

A

CTRL+E

80
Q

Delete files from recent history

A

DEL

81
Q

Discover your code in recently visited files

A

CTRL+SHIFT+E

82
Q

Set a break point on a line

A

CTRL+F8

83
Q

Run a debugger

A

SHIFT+F9

84
Q

Quick Evaluate a variable in debugger

A

CTRL+ALT+8

85
Q

View type hierarchy

A

CTRL+H

86
Q

View call hierarchy

A
CTRL+ALT+H
87
Q

Using RegEx find ext…Select in ‘Find in files’ window

A
CTRL+SHIFT+F
#enable regex search via ALT+X
ext.*Select