Skip to content

Commit 3c658d1

Browse files
committed
Remove trailing whitespaces
This commit contains following fixes: - Trailing whitespace Usually, we don't want to have trailing whitespaces at end of line. It makes diff uglier and maintenance of code harder. - No newline at end of file Historically, POSIX standard requires to have a newline at the end of non-empty file, which shouldn't proceeds by a backslash[1]. [1]: https://gcc.gnu.org/legacy-ml/gcc/2003-11/msg01568.html
1 parent c74f8f2 commit 3c658d1

14 files changed

+36
-36
lines changed

docs/classes.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ The output:
469469

470470
::
471471

472-
$ python3 code/lenexample.py
472+
$ python3 code/lenexample.py
473473
Length of the f object is 5
474474

475475
__contains__ method
@@ -587,7 +587,7 @@ Let us look at it in details in the following example.
587587

588588
def can_sudo(self):
589589
return self.sudo
590-
590+
591591
u = User("kdas", 1000, 1000, "/home/kdas", True)
592592
pprint(u.__dict__)
593593

docs/click.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ is optional).
7171

7272
::
7373

74-
$ myhello
74+
$ myhello
7575
Hello World
7676
$ myhello --help
7777
Usage: myhello [OPTIONS]
@@ -160,7 +160,7 @@ option which will take a string as input.
160160
--help Show this message and exit.
161161
$ myhello
162162
Hello World
163-
Bye
163+
Bye
164164
$ myhello --name kushal
165165
Hello World
166166
Bye kushal
@@ -260,8 +260,8 @@ The output looks like below:
260260
--password TEXT
261261
--help Show this message and exit.
262262
$ myhello
263-
Password:
264-
Repeat for confirmation:
263+
Password:
264+
Repeat for confirmation:
265265
Hello World
266266
We received hello as password.
267267

@@ -305,4 +305,4 @@ The output looks like:
305305

306306
Click has many other useful features, like *yes parameter*, *file path input*.
307307
I am not going to write about all of those here, but you can always from the
308-
`upstream documentation <http://click.pocoo.org/>`_.
308+
`upstream documentation <http://click.pocoo.org/>`_.

docs/datastructure.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ We can store anything in the list, so first we are going to add another list *b
7878

7979
.. index:: sort
8080

81-
Above you can see how we used the *a.extend()* method to extend the list. To sort any list we have *sort()* method. The *sort()* method will only work if elements in the list are comparable. We will remove the list b from the list and then sort.
81+
Above you can see how we used the *a.extend()* method to extend the list. To sort any list we have *sort()* method. The *sort()* method will only work if elements in the list are comparable. We will remove the list b from the list and then sort.
8282

8383
::
8484

@@ -525,7 +525,7 @@ changes the variable outside of the function.
525525

526526
def modify(numbers):
527527
numbers.append(42)
528-
528+
529529
modify(numbers)
530530
print(numbers)
531531
[1, 2, 4, 42]

docs/flask.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,9 @@ Put the following code in this file
117117
filename='hello.css')}}" />
118118
</head>
119119
<body>
120-
120+
121121
It works!
122-
122+
123123
</body>
124124
</html>
125125

docs/functions.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ From Python3.8, we can also mark any function to have only positional arguments.
244244

245245
>>> def add(a, b, /):
246246
... return a + b
247-
...
247+
...
248248
>>> add(2, 3)
249249
5
250250
>>> add(a=2, b=3)
@@ -351,7 +351,7 @@ number, we can do it easily like this.
351351

352352
.. note:: To know more read `this link <http://docs.python.org/3/faq/programming.html#how-do-you-make-a-higher-order-function-in-python>`_.
353353

354-
map
354+
map
355355
====
356356

357357
`map` is a very useful class in python. It takes one function
@@ -388,7 +388,7 @@ In the above example, `name` and `age` are the parameters of the `hello`, and `k
388388
the arguments passed to the function.
389389

390390

391-
*args and **kwargs in function definition
391+
*args and **kwargs in function definition
392392
=========================================
393393
394394
There are times when we don't know the number of arguments before hand. There
@@ -406,12 +406,12 @@ This is where we use `*args` and `**kwargs` in the function.
406406
print(f"We received {len(kwargs)} keyword arguments. And they are:")
407407
for k, v in kwargs.items():
408408
print(f"key={k} and value={v}")
409-
410-
409+
410+
411411
unknown(30, 90, "kushal", lang="python", editor="vim")
412412

413413
We received 3 positional arguments. And they are:
414-
30 90 kushal
414+
30 90 kushal
415415
We received 2 keyword arguments. And they are:
416416
key=lang and value=python
417417
key=editor and value=vim

docs/hardwaresimulation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Learning using hardware simulation
44
==================================
55

66
From this section and in the future chapters, there will be examples and problems
7-
which is using a special device simulation in VS Code editor.
7+
which is using a special device simulation in VS Code editor.
88

99
We will use the simulation to have a `Circuit Playground Express device <https://adafruit.com/product/3333>`_,
1010
and learn to interact with the device. We will be able to turn on lights of different

docs/ifelse.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ The elegant way to test Truth values is like
8181
pass
8282

8383
.. warning:: Don't do this
84-
84+
8585
::
86-
86+
8787
if x == True:
8888
pass
8989

docs/loopingonhardware.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ One NeoPixel at a time
1212

1313
.. figure:: img/oneneoatatime.gif
1414

15-
The `cpx.pixels` can be accessed by index numbers, from 0 to 9. This way, we can turn on
15+
The `cpx.pixels` can be accessed by index numbers, from 0 to 9. This way, we can turn on
1616
one NeoPixel at a time.
1717

1818
.. code-block:: python

docs/modules.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Now we are going to see how modules work. Create a file called bars.py. Content
5656
Prints a bar with -
5757

5858
:arg num: Length of the bar
59-
59+
6060
"""
6161
print("-" * num)
6262

@@ -136,7 +136,7 @@ a single function from the module. Look at the following updated `bars.py` examp
136136
Prints a bar with -
137137

138138
:arg num: Length of the bar
139-
139+
140140
"""
141141
print("-" * num)
142142

@@ -164,7 +164,7 @@ the module from there. All imported modules are of type `module`.
164164
['ANSWER', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', 'hashbar', 'simplebar', 'starbar']
165165
>>> type(bars)
166166
<class 'module'>
167-
>>> bars.__name__
167+
>>> bars.__name__
168168
'bars'
169169
>>> bars.__file__
170170
'/home/kdas/code/pym/code/bars.py'
@@ -317,7 +317,7 @@ Using the *view_dir* example.
317317
::
318318

319319
>>> view_dir('/')
320-
.readahead bin boot dev etc home junk lib lib64 lost+found media mnt opt
320+
.readahead bin boot dev etc home junk lib lib64 lost+found media mnt opt
321321
proc root run sbin srv sys tmp usr var
322322

323323

@@ -355,7 +355,7 @@ The *text* attribute holds the HTML returned by the server.
355355
Using this knowledge, let us write a command which can download a given file (URL) from Internet.
356356

357357

358-
.. code:: python
358+
.. code:: python
359359
360360
#!/usr/bin/env python3
361361
import os
@@ -383,7 +383,7 @@ Using this knowledge, let us write a command which can download a given file (UR
383383
384384
385385
Here we used something new, when the module name is *__main__*, then only
386-
ask for a user input and then download the given URL. This also prevents
386+
ask for a user input and then download the given URL. This also prevents
387387
the same when some other Python code imports this file as a Python module.
388388

389389
To learn more about requests module, go to their `wonderful documentation <http://docs.python-requests.org>`_.

docs/mu.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ working on actual projects. In this chapter we will learn about **mu editor**,
77
which is a very simple and beginner friendly editor for anyone starting with
88
Python. It is developed by Nicholas Tollervey.
99

10-
If you already have an editor of your choice, you can skip this chapter.
10+
If you already have an editor of your choice, you can skip this chapter.
1111

1212
Installation
1313
=============

0 commit comments

Comments
 (0)