From fc652a7f4640714800caeb561a7ceb900e48f2a2 Mon Sep 17 00:00:00 2001
From: Johannes Christ Each year, we organize a Winter Code Jam and a Summer Code Jam. During these events, members of our community will work together in teams to create something amazing using a technology we picked for them. One such technology that was picked for the Winter Code Jam 2020 was Kivy, a cross-platform GUI framework. To help fuel the creative process, we provide a specific theme, like Ancient Technology or This App Hates You. At the end of the Code Jam, the projects are judged by Python Discord server staff members and guest judges from the larger Python community. The judges will consider creativity, code quality, teamwork, and adherence to the theme. If you want to read more about Code Jams, visit our Code Jam info page or watch this video showcasing the best projects created during the Winter Code Jam 2020: Ancient Technology: Twice a year we host a code jam for members of our server to participate in. The code jam is an event where we place you
+ in a team with 5 other random server members. You then have 7 days to code some sort of application or program in Python.
+ Your program must use the specified technology/framework and incorporate the theme chosen by the server.
+
+ After the 7 days is complete, your team has 2 days to finish documentation and create a video presentation showcasing
+ and walking through the program that your team has created. More details and specifics of this will be released within the next 2 weeks.
+ The Qualifier isn't released yet, but to receive the most up-to-date information and to get notified
+ when the Qualifier is released you can join the server: discord.gg/python. Below is the list of approved frameworks that you can use for the code jam. Please take note of what frameworks are available for which platform.
+ Please work with your team to choose a library that everyone can develop on, whether it's cross platform or something you can use WSL or a Virtual Machine for.
+ Your solution must use one of the approved frameworks. It is not permitted to circumvent this rule by e.g. using the approved framework as a wrapper for another framework. Your solution should be platform agnostic. For example, if you use filepaths in your submission, use
+ You must document precisely how to install and run your project.
+ This should be as easy as possible, which means you should consider using dependency managers like You must use GitHub as source control.
+ All code and assets must be compatible with the MIT license.
+ This is because we will be merging your submission into our All code must be written and committed within the time constrictions of the jam. Late commits may be reverted, so make sure you leave enough time to bug test your program.
+ Use English as the main language for your project, including names, comments, documentation, and commit messages.
+ The text displayed in your web application should also be in English,
+ although you are allowed to provide the user with options for internationalisation and translation.
+
+ Your team, once the coding portion of the code jam is complete, must create a video presentation that showcases and explains your final product.
+ This must be in a video format and must be uploaded somewhere for the judges to view (i.e. unlisted Youtube video, Vimeo, etc.)
+ The video can be as simple as a screen recording with annotated text.
+ Teams who do not submit a final video presentation may be disqualified.
+
+ The chosen technology/tech stack for this year is Text User Interfaces (TUIs).
+ Each team must create a program with one of the approved frameworks that creates a user interface that is text based.
+ For more information of TUIs and what's involved with such an interface, check out this wikipedia article.
+ The Qualifier isn't released yet, but to receive the most up-to-date information and to get notified
- when the Qualifier is released you can join the server: discord.gg/python.
+
+
--
cgit v1.2.3
From b8132bd77c32ec07134605a0f047a614ec8ce379 Mon Sep 17 00:00:00 2001
From: Janine vN
Code Jams
+ Important Dates
+
+
+ How to Join
+ Urwid
+
+
+
+
Curses
+
+
+
+
Blessed
+
+
+
+
Rich
+
+
+
+
Asciimatics
+
+
+
+
+
+
+
+pathlib to create platform agnostic Path objects instead of hardcoding the paths.pipenv or poetry.
+ We would also encourage you to use docker and docker-compose to containerize your project, but this isn't a requirement.
+ summer-code-jam-2021 repo at the end of the jam,
+ and this repo is licensed with the MIT license.
+ Projects that include assets that are incompatible with this license may be disqualified.
+
+ Please note that our regular
+ community rules and code of conduct
+ also apply during the event and that we reserve the right to make changes to these rules at any time.
+
+{% endblock %}
+
+{% block sidebar %}
+
+ {% include "events/sidebar/code-jams/8.html" %}
+
+{% endblock %}
diff --git a/pydis_site/templates/events/sidebar/code-jams/8.html b/pydis_site/templates/events/sidebar/code-jams/8.html
new file mode 100644
index 00000000..fb14d83e
--- /dev/null
+++ b/pydis_site/templates/events/sidebar/code-jams/8.html
@@ -0,0 +1,17 @@
+{% load static %}
+
+
diff --git a/pydis_site/templates/events/sidebar/code-jams/previous-code-jams.html b/pydis_site/templates/events/sidebar/code-jams/previous-code-jams.html
index 154f6ac4..9f9ecd1a 100644
--- a/pydis_site/templates/events/sidebar/code-jams/previous-code-jams.html
+++ b/pydis_site/templates/events/sidebar/code-jams/previous-code-jams.html
@@ -1,6 +1,7 @@
Important Dates
-
+
+ Technology
+ How to Join
Your solution must use one of the approved frameworks. It is not permitted to circumvent this rule by e.g. using the approved framework as a wrapper for another framework.
Your solution should be platform agnostic. For example, if you use filepaths in your submission, use pathlib to create platform agnostic Path objects instead of hardcoding the paths.
Your solution must use one of the approved frameworks.
You must document precisely how to install and run your project. @@ -41,14 +40,14 @@
Use English as the main language for your project, including names, comments, documentation, and commit messages. - The text displayed in your web application should also be in English, + The text displayed in your application should also be in English, although you are allowed to provide the user with options for internationalisation and translation.
Your team, once the coding portion of the code jam is complete, must create a video presentation that showcases and explains your final product. - This must be in a video format and must be uploaded somewhere for the judges to view (i.e. unlisted Youtube video, Vimeo, etc.) + This must be in a video format and must be uploaded somewhere for the judges to view (i.e. unlisted YouTube video, Vimeo, etc.). The video can be as simple as a screen recording with annotated text. Teams who do not submit a final video presentation may be disqualified.
diff --git a/pydis_site/templates/events/sidebar/code-jams/8.html b/pydis_site/templates/events/sidebar/code-jams/8.html index fb14d83e..fe65ae2e 100644 --- a/pydis_site/templates/events/sidebar/code-jams/8.html +++ b/pydis_site/templates/events/sidebar/code-jams/8.html @@ -8,8 +8,8 @@
+
+ + This year we'll be running a GitHub Bootcamp on Saturday, June 26th. + This bootcamp is intended to be an interactive workshop session where we help participants + get setup with git and using it in a team environment. +
++ This session will run for an hour and be focused on installing and setting up git for the first time. + We'll have helpers available to help you set up git and get it integreated with your editor of choice. + Whether it's PyCharm, VSCode, or vim, we can help you get rolling with version control. +
++ This session will run for an hour. It will be focused on using git and HitHub in a team environment. + You'll be put in a group of people with a repo to work on. +
+ + + +{% endblock %} + +{% block sidebar %} + + {% include "events/sidebar/code-jams/8.html" %} + +{% endblock %} diff --git a/pydis_site/templates/events/sidebar/code-jams/8.html b/pydis_site/templates/events/sidebar/code-jams/8.html index fe65ae2e..3d5a5447 100644 --- a/pydis_site/templates/events/sidebar/code-jams/8.html +++ b/pydis_site/templates/events/sidebar/code-jams/8.html @@ -3,6 +3,7 @@Important Links
Rules Approved Frameworks + GitHub Bootcamp+ The qualifier is a coding challenge that you are required to complete before registering for the code jam. + This is meant as a basic assessment of your skills to ensure you have enough python knowledge to effectively contribute in a team environment. +
+ + Please note the requirements for the qualifier. +The Qualifier isn't released yet, but to receive the most up-to-date information and to get notified - when the Qualifier is released you can join us on Discord at discord.gg/python.
++ To enter into the code jam you must complete The Qualifier and submit the sign-up form. + Don't forget to join us on Discord at discord.gg/python! +
+ + {% endblock %} {% block sidebar %} -- cgit v1.2.3 From ef5f4b71397886f6a208f85d88e649c13c7774ad Mon Sep 17 00:00:00 2001 From: Janine vN+ Our Code Jam Sponsors have provided prizes for the winners of the code jam. + Also, a big thank you to our Patreon patrons for supporting this server and allowing us + to provide our prizes as well. +
+ ++ Scalable compute platform with add-on storage, security, and monitoring capabilities. + We make it simple to launch in the cloud and scale up as you grow—whether you’re running one virtual machine or ten thousand. +
+Prizes
+ $250 in DigitalOcean credits to a winning team.
+ Whatever platform or language you work with, JetBrains has a development tool for you. + We help developers work faster by automating common, repetitive tasks to enable them to stay focused on code design and the big picture. + We provide tools to explore and familiarize with code bases faster. Our products make it easy for you to take care of quality during all stages of development and spend less time on maintenance tasks. +
+Prizes
+ 1-year JetBrain licenses to a winning team.
Tabnine is an AI-powered code completion tool used by millions of devs around the world every day + - Tabnine supports dozens of programming languages, in all of your favorite IDEs, saving you tons of time - so that you can type less and code more. + Tabnine comes as a plugin and has a free-forever basic plan, so you can get started with it right away! +
+Prizes
+ 1-year Pro Licenses to Tabnine to a winning team.
Prizes
- 1-year JetBrain licenses to a winning team.
Prizes
- 1-year Pro Licenses to Tabnine to a winning team.
- This year we'll be running a GitHub Bootcamp on Saturday, June 26th. + This year we'll be running a GitHub Bootcamp on Saturday, June 26th at 4PM UTC. This bootcamp is intended to be an interactive workshop session where we help participants - get setup with git and using it in a team environment. + get setup with git and using it in a team environment. If you are new to git or would like to brush up on it, + then this is the perfect event for you. +
++ The instructional parts of this bootcamp will be recorded. We'll also be providing a cheatsheet / reference guide to all attendees that will + be made available here for download.
- This session will run for an hour and be focused on installing and setting up git for the first time. - We'll have helpers available to help you set up git and get it integreated with your editor of choice. + This first session will run for an hour starting at 4PM UTC. It will be focused on installing and setting up git for the first time. + We'll have helpers available to help you set up git and integreated with your editor of choice. Whether it's PyCharm, VSCode, or vim, we can help you get rolling with version control.
- This session will run for an hour. It will be focused on using git and GitHub in a team environment. - You'll be put in a group of people with a repo to work on. + This session will run for an hour starting at 5PM UTC. It will be focused on using git and GitHub in a team environment. + You'll be put in a group with other attendees and use the common git commands for working in a repo. + You'll learn how to set-up a GitHub reposity with other contributors, how to make branches, make commits, pull down changes, and then make pull requests. + We'll also be going over different strategies for creating branches and best practices for commits and pull requests.
- - {% endblock %} {% block sidebar %} -- cgit v1.2.3 From 57a6ff40d3abbad39db1394b679c5358bfa9b274 Mon Sep 17 00:00:00 2001 From: Janine vNThis first session will run for an hour starting at 4PM UTC. It will be focused on installing and setting up git for the first time. - We'll have helpers available to help you set up git and integreated with your editor of choice. + We'll have helpers available to help you set up git and integrated with your editor of choice. Whether it's PyCharm, VSCode, or vim, we can help you get rolling with version control.
This session will run for an hour starting at 5PM UTC. It will be focused on using git and GitHub in a team environment. You'll be put in a group with other attendees and use the common git commands for working in a repo. - You'll learn how to set-up a GitHub reposity with other contributors, how to make branches, make commits, pull down changes, and then make pull requests. + You'll learn how to set-up a GitHub repository with other contributors, how to make branches, make commits, pull down changes, and then make pull requests. We'll also be going over different strategies for creating branches and best practices for commits and pull requests.
-- cgit v1.2.3 From 05730b3c55811ec2b9c7c0ff8484714a3ee498b2 Mon Sep 17 00:00:00 2001 From: bast+ For end-users, the most important parts of the software are functionality and UI/UX. + But for developers, there is one more important aspect - code style. + While ugly code can do everything that it has to do, developing it further may be a difficult task, + especially if a developer didn't write an original code. + Which one of the following do you prefer to read and work with? +
+
+
+ MyPath = '/file.txt'
+ from pathlib import *
+ import os.path,sys
+ def check(p):
+ """Uses os.path.exist """
+ return os.path.exists(p)
+
+ def getF(
+ p):
+ """Not sure what this do, this just worked.
+ """
+ return Path(p
+ )
+ result=[check(MyPath),getF(MyPath)]
+
+
+ or
+
+
+ import os.path
+ from pathlib import Path
+
+ FILE_PATH = '/file.txt'
+
+
+ def check_file_exists(path: str) -> bool:
+ """Checks does file exists in path. Uses os.path.exists."""
+ return os.path.exists(path)
+
+
+ def get_path_object(path: str) -> Path:
+ """
+ Returns Path object of the path provided in arguments.
+
+ This is here for backward compatibility, will be removed in the future.
+ """
+ return Path(path)
+
+ result = [
+ check_file_exists(FILE_PATH),
+ get_path_object(FILE_PATH),
+ ]
+
+
+
+ + The second is definitely easier to read and understand. + These scripts are small and if you read even first, you can understand what this code does pretty fast, + but what if the project has thousands and thousands of files in a really complex folder structure? + Do you want then code what looks like the first example? + You can save hours sometimes if you write beautiful code that follows style rules. +
++ The most important document of Python code style is PEP 8. + This gives the majority of all Python code style rules. This article will cover the most important rules of PEP 8. +
+ ++ But everyone makes mistakes and there are so many style rules that can be really difficult to remember and always follow. + Luckily, we have amazing tools that help us - linters. While there are many linters, + we'd like code jam participants to use flake8. + Flake8 points out to you rules what you did break in your code so you can fix them. +
+ +For indentation, you should use 4 spaces. Using tabs is not suggested, but if you do, you can't mix spaces and tabs.
++ PEP 8 defines a maximum line length of 79 characters, however, + we are not so strict - we let teams choose a maximum line length between 79 and 119 characters. +
+2 blank lines should be left before functions and classes. Single blank lines are used to split sections and make logical breaks.
+ +Module, file, function, and variable names (except type variables) should be lowercase and use underscores.
+
+
+ # File: my_module.py/mymodule.py
+
+ def my_function():
+ my_variable = "value"
+
+
+ Class and type variable names should use the camel case style.
+
+
+ from typing import List
+
+
+ class MyClass:
+ pass
+
+ ListOfMyClass = List[MyClass]
+
+
+ Constant names should be all uppercase, and words should be separated with underscores.
+
+
+ MY_CONSTANT = 1
+
+
+ + You should avoid single-character names, as these might be confusing. + But if you still do, you should avoid characters that may look like zero or one in some fonts: + "O" (uppercase o), "l" (lowercase L), and "I" (uppercase i). +
+ ++ If you have a chain of mathematic operations that you split into multiple lines, + you should put the operator at the beginning of the line and not to the end of the line. +
+
+
+ # No
+ result = (
+ 1 +
+ 2 *
+ 3
+ )
+
+ # Yes
+ result = (
+ 1
+ + 2
+ * 3
+ )
+
+
+ If you compare against None, you should use is and is not, but not compare equality.
+
+ # No
+ if variable == None:
+ print("Variable is None")
+
+ # Yes
+ if variable is None:
+ print("Variable is None")
+
+
+
+ You should prefer using over not .
+ Using second makes it harder to understand the expression.
+
+
+ # No
+ if not variable is None:
+ print("Variable is not None")
+
+ # Yes - it is much easier to read and understand this than previous
+ if variable is not None:
+ print("Variable is not None")
+
+
+
+ Imports should be at top of the file, the only things that should be before them are module comments and docstrings.
+You shouldn't import multiple modules in one line, but give each module import its own line instead.
+
+
+ # No
+ import pathlib, os
+
+ # Yes
+ import os
+ import pathlib
+
+
+ Wildcard imports should be avoided in most cases. They make unclear where what comes from.
+
+
+ # No
+ from pathlib import *
+
+ # Yes
+ from pathlib import Path
+
+
+ You should use isort imports order specification, what means:
+__future__ imports, standard library imports,
+ third-party library imports, and finally project imports.
+ import <package>
+ and after them from <package> import <items>.
+ from <package> import <items> format,
+ <items> should be ordered alphabetically, starting with bare module imports.
+ + Comments are really important because they help everyone understand, what code does. + But as important as having comments is keeping them up-to-date. + Out-to-date, wrong comments confuse readers. +
+Comments content should start with a capital letter and be a full sentence(s).
+There are three types of comments:
+# what should be followed by a single space,
+ except for text indention inside the comment. To separate paragraphs, use one line containing only #.
+
+
+ if variable is None or variable == 1:
+ # If variable is None, something went wrong previously.
+ #
+ # Here starts a new important paragraph.
+
+
+ # what should be followed by a single space.
+
+
+ # Do not use inline comments to explain things
+ # that the reader can understand even without the inline comment.
+ my_variable = "Value!" # Assign value to my_variable
+
+ # Here better variable name can be used like shown in the second line.
+ x = "Walmart" # Shop name
+ shop_name = "Walmart"
+
+ # Sometimes, if something is not obvious, then inline comments are useful.
+ # Example is from PEP 8.
+ x = x + 1 # Compensate for border
+
+
+
+
+ # This is a one-line docstring.
+ """This is one line module docstring."""
+
+
+ # This is a multiline docstring.
+ def my_function():
+ """
+ This is the summary line.
+
+ This is the description.
+ """
+
+
+ + Is all this PEP 8 rules stuff making your head exploding? We have something for you! We have a song! + We have The PEP 8 Song (featuring lemonsaurus)! + Great way to get started with writing beautiful code. +
+{% endblock %} + +{% block sidebar %} + {% include "events/sidebar/code-jams/useful-information.html" %} +{% endblock %} -- cgit v1.2.3 From 20ae1ecf415f19f422df4866a2e07359549460b2 Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Thu, 8 Jul 2021 20:17:58 +0300 Subject: Add The Code Style Guide to useful information sidebar --- pydis_site/templates/events/sidebar/code-jams/useful-information.html | 1 + 1 file changed, 1 insertion(+) diff --git a/pydis_site/templates/events/sidebar/code-jams/useful-information.html b/pydis_site/templates/events/sidebar/code-jams/useful-information.html index c4e665e6..841a533a 100644 --- a/pydis_site/templates/events/sidebar/code-jams/useful-information.html +++ b/pydis_site/templates/events/sidebar/code-jams/useful-information.html @@ -4,5 +4,6 @@Imports should be at top of the file, the only things that should be before them are module comments and docstrings.
You shouldn't import multiple modules in one line, but give each module import its own line instead.
-- cgit v1.2.3 From 23b1e46342e743cdb1ec8e0bb30e4696a3018079 Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Fri, 9 Jul 2021 00:00:15 +0300 Subject: Add missing slash at b tag ending Co-authored-by: Numerlor <25886452+Numerlor@users.noreply.github.com> --- pydis_site/templates/events/pages/code-jams/the-code-style-guide.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html b/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html index 3176babf..eb8ab9da 100644 --- a/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html +++ b/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html @@ -199,7 +199,7 @@ from pathlib import Path -You should use isort imports order specification, what means:
+You should use isort imports order specification, what means:
__future__ imports, standard library imports,
--
cgit v1.2.3
From 1ff45d2831eff3a48bd7718bb95b9e73d513713e Mon Sep 17 00:00:00 2001
From: ks129 <45097959+ks129@users.noreply.github.com>
Date: Fri, 9 Jul 2021 00:03:04 +0300
Subject: Use better wording for head explosion question
---
pydis_site/templates/events/pages/code-jams/the-code-style-guide.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html b/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html
index eb8ab9da..be022ffc 100644
--- a/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html
+++ b/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html
@@ -288,7 +288,7 @@
- Is all this PEP 8 rules stuff making your head exploding? We have something for you! We have a song! + Do all these style rules make your head explode? We have something for you! We have a song! We have The PEP 8 Song (featuring lemonsaurus)! Great way to get started with writing beautiful code.
-- cgit v1.2.3 From c1ad8468166ae7bc37d7293b7ad724a329b9f8a2 Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Fri, 9 Jul 2021 00:06:25 +0300 Subject: Add missing comma Co-authored-by: Numerlor <25886452+Numerlor@users.noreply.github.com> --- pydis_site/templates/events/pages/code-jams/the-code-style-guide.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html b/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html index be022ffc..07823f6f 100644 --- a/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html +++ b/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html @@ -220,7 +220,7 @@- Comments are really important because they help everyone understand, what code does. + Comments are really important because they help everyone understand what code does. But as important as having comments is keeping them up-to-date. Out-to-date, wrong comments confuse readers.
-- cgit v1.2.3 From 7f8e84b97ec38546bc6e1204f9fa1313955ad68d Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Fri, 9 Jul 2021 00:08:18 +0300 Subject: Way -> method --- pydis_site/templates/events/pages/code-jams/the-code-style-guide.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html b/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html index 07823f6f..fabf5444 100644 --- a/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html +++ b/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html @@ -206,11 +206,11 @@ third-party library imports, and finally project imports.import <package>
+ Group by import method: inside each group, first should come imports in format import <package>
and after them from <package> import <items>.
from <package> import <items> format,
--
cgit v1.2.3
From 761aa067d19f669e56c32dc4c24b8242cd23a668 Mon Sep 17 00:00:00 2001
From: ks129 <45097959+ks129@users.noreply.github.com>
Date: Fri, 9 Jul 2021 00:09:32 +0300
Subject: Add missing colon
Co-authored-by: Numerlor <25886452+Numerlor@users.noreply.github.com>
---
pydis_site/templates/events/pages/code-jams/the-code-style-guide.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html b/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html
index fabf5444..5e4a957e 100644
--- a/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html
+++ b/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html
@@ -202,7 +202,7 @@
You should use isort imports order specification, what means:
__future__ imports, standard library imports,
+ Group by type: order of import types should be: __future__ imports, standard library imports,
third-party library imports, and finally project imports.
# what should be followed by a single space.
+ Just like block comments, inline comments also have to start with # followed by a single space.
# Do not use inline comments to explain things
@@ -267,7 +267,7 @@
Docstrings should start and end with three quotes ("""). There are two types of docstrings: one-line docstrings and multiline docstrings.
One-line docstrings have to start and end in the same line, while multiline docstrings start and end in different lines.
Multiline docstring has two parts: summary line and a longer description, which are separated by one empty line.
- The multiline sentence starting and ending quotes should be at different lines than the content.
+ The multiline sentence start and end quotes should be at different lines than the content.
# This is a one-line docstring.
--
cgit v1.2.3
From bdc492f79880b3ebb7be6e15020142e44c8dbdd6 Mon Sep 17 00:00:00 2001
From: ks129 <45097959+ks129@users.noreply.github.com>
Date: Fri, 9 Jul 2021 00:12:35 +0300
Subject: Escape HTML in The Code Style Guide
---
pydis_site/templates/events/pages/code-jams/the-code-style-guide.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html b/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html
index a26a973c..4258cd94 100644
--- a/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html
+++ b/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html
@@ -161,7 +161,7 @@
- You should prefer using - is not
over not - is
.
+ You should prefer using <item one> is not <item two> over not <item one> is <item two>.
Using second makes it harder to understand the expression.
--
cgit v1.2.3
From dea0924f8160c5452e0c52657aeaacc488b606e2 Mon Sep 17 00:00:00 2001
From: ks129 <45097959+ks129@users.noreply.github.com>
Date: Fri, 9 Jul 2021 00:26:58 +0300
Subject: Remove leading spaces and unnecessary newlines from code blocks
HTML tag is adding indention also to result, so I had to remove these.
---
.../pages/code-jams/the-code-style-guide.html | 252 ++++++++-------------
1 file changed, 100 insertions(+), 152 deletions(-)
diff --git a/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html b/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html
index 4258cd94..d3359ebb 100644
--- a/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html
+++ b/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html
@@ -16,52 +16,44 @@
especially if a developer didn't write an original code.
Which one of the following do you prefer to read and work with?
-
-
- MyPath = '/file.txt'
- from pathlib import *
- import os.path,sys
- def check(p):
- """Uses os.path.exist """
- return os.path.exists(p)
-
- def getF(
- p):
- """Not sure what this do, this just worked.
- """
- return Path(p
- )
- result=[check(MyPath),getF(MyPath)]
-
-
+ MyPath = '/file.txt'
+from pathlib import *
+import os.path,sys
+def check(p):
+ """Uses os.path.exist """
+ return os.path.exists(p)
+
+def getF(
+ p):
+ """Not sure what this do, this just worked.
+ """
+ return Path(p
+ )
+result=[check(MyPath),getF(MyPath)]
or
-
-
- import os.path
- from pathlib import Path
+ import os.path
+from pathlib import Path
- FILE_PATH = '/file.txt'
+FILE_PATH = '/file.txt'
- def check_file_exists(path: str) -> bool:
- """Checks does file exists in path. Uses os.path.exists."""
- return os.path.exists(path)
+def check_file_exists(path: str) -> bool:
+ """Checks does file exists in path. Uses os.path.exists."""
+ return os.path.exists(path)
- def get_path_object(path: str) -> Path:
- """
- Returns Path object of the path provided in arguments.
+def get_path_object(path: str) -> Path:
+ """
+ Returns Path object of the path provided in arguments.
- This is here for backward compatibility, will be removed in the future.
- """
- return Path(path)
+ This is here for backward compatibility, will be removed in the future.
+ """
+ return Path(path)
- result = [
- check_file_exists(FILE_PATH),
- get_path_object(FILE_PATH),
- ]
-
-
+result = [
+ check_file_exists(FILE_PATH),
+ get_path_object(FILE_PATH),
+]
The second is definitely easier to read and understand.
@@ -94,32 +86,20 @@
Naming
Module, file, function, and variable names (except type variables) should be lowercase and use underscores.
-
-
- # File: my_module.py/mymodule.py
-
- def my_function():
- my_variable = "value"
-
-
+ # File: my_module.py/mymodule.py
+
+def my_function():
+ my_variable = "value"
Class and type variable names should use the camel case style.
-
-
- from typing import List
+ from typing import List
- class MyClass:
- pass
+class MyClass:
+ pass
- ListOfMyClass = List[MyClass]
-
-
+ListOfMyClass = List[MyClass]
Constant names should be all uppercase, and words should be separated with underscores.
-
-
- MY_CONSTANT = 1
-
-
+ MY_CONSTANT = 1
You should avoid single-character names, as these might be confusing.
But if you still do, you should avoid characters that may look like zero or one in some fonts:
@@ -131,74 +111,54 @@
If you have a chain of mathematic operations that you split into multiple lines,
you should put the operator at the beginning of the line and not to the end of the line.
-
-
- # No
- result = (
- 1 +
- 2 *
- 3
- )
-
- # Yes
- result = (
- 1
- + 2
- * 3
- )
-
-
+ # No
+result = (
+ 1 +
+ 2 *
+ 3
+)
+
+# Yes
+result = (
+ 1
+ + 2
+ * 3
+)
If you compare against None, you should use is and is not, but not compare equality.
-
-
- # No
- if variable == None:
- print("Variable is None")
-
- # Yes
- if variable is None:
- print("Variable is None")
-
-
+ # No
+if variable == None:
+ print("Variable is None")
+
+# Yes
+if variable is None:
+ print("Variable is None")
You should prefer using <item one> is not <item two> over not <item one> is <item two>.
Using second makes it harder to understand the expression.
-
-
- # No
- if not variable is None:
- print("Variable is not None")
-
- # Yes - it is much easier to read and understand this than previous
- if variable is not None:
- print("Variable is not None")
-
-
+ # No
+if not variable is None:
+ print("Variable is not None")
+
+# Yes - it is much easier to read and understand this than previous
+if variable is not None:
+ print("Variable is not None")
Imports
Imports should be at top of the file, the only things that should be before them are module comments and docstrings.
You shouldn't import multiple modules in one line, but give each module import its own line instead.
-
-
- # No
- import pathlib, os
-
- # Yes
- import os
- import pathlib
-
-
+ # No
+import pathlib, os
+
+# Yes
+import os
+import pathlib
Wildcard imports should be avoided in most cases. They make unclear where what comes from.
-
-
- # No
- from pathlib import *
-
- # Yes
- from pathlib import Path
-
-
+ # No
+from pathlib import *
+
+# Yes
+from pathlib import Path
You should use isort imports order specification, what means:
-
@@ -231,35 +191,27 @@
Block comments: Probably most common comment type. Should be indented to the same level as the code they describe.
Each line in the block comment has to start with
# what should be followed by a single space,
except for text indention inside the comment. To separate paragraphs, use one line containing only #.
-
-
- if variable is None or variable == 1:
- # If variable is None, something went wrong previously.
- #
- # Here starts a new important paragraph.
-
-
+ if variable is None or variable == 1:
+ # If variable is None, something went wrong previously.
+ #
+ # Here starts a new important paragraph.
-
Inline comments: You should prefer block comments over inline comments and use inline comments only where it is really necessary.
Never use inline comments to explain obvious things like what a line does. If you want to use an inline comment on a variable, think first,
maybe you can use a better variable name instead. After code and before the start of inline comments should be at least two spaces.
Just like block comments, inline comments also have to start with
# followed by a single space.
-
-
- # Do not use inline comments to explain things
- # that the reader can understand even without the inline comment.
- my_variable = "Value!" # Assign value to my_variable
-
- # Here better variable name can be used like shown in the second line.
- x = "Walmart" # Shop name
- shop_name = "Walmart"
-
- # Sometimes, if something is not obvious, then inline comments are useful.
- # Example is from PEP 8.
- x = x + 1 # Compensate for border
-
-
+ # Do not use inline comments to explain things
+# that the reader can understand even without the inline comment.
+my_variable = "Value!" # Assign value to my_variable
+
+# Here better variable name can be used like shown in the second line.
+x = "Walmart" # Shop name
+shop_name = "Walmart"
+
+# Sometimes, if something is not obvious, then inline comments are useful.
+# Example is from PEP 8.
+x = x + 1 # Compensate for border
-
Docstrings: Last, but not least important comment type is docstring, which is a short version of documentation string.
@@ -268,21 +220,17 @@
One-line docstrings have to start and end in the same line, while multiline docstrings start and end in different lines.
Multiline docstring has two parts: summary line and a longer description, which are separated by one empty line.
The multiline sentence start and end quotes should be at different lines than the content.
-
-
- # This is a one-line docstring.
- """This is one line module docstring."""
+ # This is a one-line docstring.
+"""This is one line module docstring."""
- # This is a multiline docstring.
- def my_function():
- """
- This is the summary line.
+# This is a multiline docstring.
+def my_function():
+ """
+ This is the summary line.
- This is the description.
- """
-
-
+ This is the description.
+ """
--
cgit v1.2.3
From 20962cbc7ae5b3d0a5ba53e6d3360a02e07e750c Mon Sep 17 00:00:00 2001
From: ks129 <45097959+ks129@users.noreply.github.com>
Date: Fri, 9 Jul 2021 00:31:39 +0300
Subject: Split comments paragraphs to even smaller paragraphs
---
.../pages/code-jams/the-code-style-guide.html | 30 ++++++++++++++--------
1 file changed, 20 insertions(+), 10 deletions(-)
diff --git a/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html b/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html
index d3359ebb..68423dde 100644
--- a/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html
+++ b/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html
@@ -197,10 +197,15 @@ from pathlib import Path
# Here starts a new important paragraph.
# followed by a single space.
+ + Inline comments: You should prefer block comments over inline comments and use inline comments only where it is really necessary. + Never use inline comments to explain obvious things like what a line does. +
+If you want to use an inline comment on a variable, think first, maybe you can use a better variable name instead.
+
+ After code and before the start of inline comments should be at least two spaces.
+ Just like block comments, inline comments also have to start with # followed by a single space.
+
# Do not use inline comments to explain things
# that the reader can understand even without the inline comment.
my_variable = "Value!" # Assign value to my_variable
@@ -214,12 +219,17 @@ shop_name = "Walmart"
x = x + 1 # Compensate for border
+ Docstrings: Last, but not least important comment type is docstring, which is a short version of documentation string. + Docstring rules haven't been defined by PEP 8, but by PEP 257 instead. + Docstrings should start and end with three quotes ("""). +
+There are two types of docstrings: one-line docstrings and multiline docstrings.
++ One-line docstrings have to start and end in the same line, while multiline docstrings start and end in different lines. + Multiline docstring has two parts: summary line and a longer description, which are separated by one empty line. + The multiline docstring start and end quotes should be at different lines than the content. +
# This is a one-line docstring.
"""This is one line module docstring."""
--
cgit v1.2.3
From 944343cddc573d757784027463242298511ebf6a Mon Sep 17 00:00:00 2001
From: Janine vN
Date: Thu, 8 Jul 2021 18:57:13 -0400
Subject: Update dates & times for code jam The dates and times on the main
event page have been updated to reflect the changes.
---
pydis_site/templates/events/pages/code-jams/8/_index.html | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/pydis_site/templates/events/pages/code-jams/8/_index.html b/pydis_site/templates/events/pages/code-jams/8/_index.html
index c510c250..34171969 100644
--- a/pydis_site/templates/events/pages/code-jams/8/_index.html
+++ b/pydis_site/templates/events/pages/code-jams/8/_index.html
@@ -12,12 +12,12 @@
{% block event_content %}
Twice a year we host a code jam for members of our server to participate in. The code jam is an event where we place you
- in a team with 5 other random server members. You then have 7 days to code some sort of application or program in Python.
+ in a team with 5 other random server members. You then have 8 days to code some sort of application or program in Python.
Your program must use the specified technology/framework and incorporate the theme chosen by the server.
- After the 7 days is complete, your team has 2 days to finish documentation and create a video presentation showcasing
- and walking through the program that your team has created. More details and specifics of this will be released within the next 2 weeks.
+ After the 8 days is complete, your team has 3 days to finish documentation and create a video presentation showcasing
+ and walking through the program that your team has created.
Important Dates
@@ -26,10 +26,10 @@
- Monday, June 21 - The Qualifier is released
- Friday, June 25 - Voting for the theme opens
- Saturday, June 26 @ 4PM UTC- GitHub Bootcamp
- - Wednesday, June 30 - The Qualifier closes
- - Friday, July 9 - Code Jam begins
- - Friday, July 16 - Coding portion of the jam ends
- - Sunday, July 18 - Code Jam submissions are closed
+ - Wednesday, July 1 - The Qualifier closes
+ - Friday, July 9 @ 5PM UTC - Code Jam begins and the theme is announced
+ - Saturday, July 17 @ 5PM UTC - Coding portion of the jam ends
+ - Tuesday, July 20 - Code Jam submissions are closed and video presentation must be submitted
+ For end-users, the most important parts of the software are functionality and UI/UX. + But for developers, there is one more important aspect - code style. + While ugly code can do everything that it has to do, developing it further may be a difficult task, + especially if a developer didn't write an original code. + Which one of the following do you prefer to read and work with? +
+MyPath = '/file.txt'
+from pathlib import *
+import os.path,sys
+def check(p):
+ """Uses os.path.exist """
+ return os.path.exists(p)
+
+def getF(
+ p):
+ """Not sure what this do, this just worked.
+ """
+ return Path(p
+ )
+result=[check(MyPath),getF(MyPath)]
+ or
+import os.path
+from pathlib import Path
+
+FILE_PATH = '/file.txt'
+
+
+def check_file_exists(path: str) -> bool:
+ """Checks does file exists in path. Uses os.path.exists."""
+ return os.path.exists(path)
+
+
+def get_path_object(path: str) -> Path:
+ """
+ Returns Path object of the path provided in arguments.
+
+ This is here for backward compatibility, will be removed in the future.
+ """
+ return Path(path)
+
+result = [
+ check_file_exists(FILE_PATH),
+ get_path_object(FILE_PATH),
+]
+
+ + The second is definitely easier to read and understand. + These scripts are small and if you read even first, you can understand what this code does pretty fast, + but what if the project has thousands and thousands of files in a really complex folder structure? + Do you want then code what looks like the first example? + You can save hours sometimes if you write beautiful code that follows style rules. +
++ The most important document of Python code style is PEP 8. + This gives the majority of all Python code style rules. This article will cover the most important rules of PEP 8. +
+ ++ But everyone makes mistakes and there are so many style rules that can be really difficult to remember and always follow. + Luckily, we have amazing tools that help us - linters. While there are many linters, + we'd like code jam participants to use flake8. + Flake8 points out to you rules what you did break in your code so you can fix them. +
+ +For indentation, you should use 4 spaces. Using tabs is not suggested, but if you do, you can't mix spaces and tabs.
++ PEP 8 defines a maximum line length of 79 characters, however, + we are not so strict - we let teams choose a maximum line length between 79 and 119 characters. +
+2 blank lines should be left before functions and classes. Single blank lines are used to split sections and make logical breaks.
+ +Module, file, function, and variable names (except type variables) should be lowercase and use underscores.
+# File: my_module.py/mymodule.py
+
+def my_function():
+ my_variable = "value"
+ Class and type variable names should use the camel case style.
+from typing import List
+
+
+class MyClass:
+ pass
+
+ListOfMyClass = List[MyClass]
+ Constant names should be all uppercase, and words should be separated with underscores.
+MY_CONSTANT = 1
+ + You should avoid single-character names, as these might be confusing. + But if you still do, you should avoid characters that may look like zero or one in some fonts: + "O" (uppercase o), "l" (lowercase L), and "I" (uppercase i). +
+ ++ If you have a chain of mathematic operations that you split into multiple lines, + you should put the operator at the beginning of the line and not to the end of the line. +
+# No
+result = (
+ 1 +
+ 2 *
+ 3
+)
+
+# Yes
+result = (
+ 1
+ + 2
+ * 3
+)
+ If you compare against None, you should use is and is not, but not compare equality.
# No
+if variable == None:
+ print("Variable is None")
+
+# Yes
+if variable is None:
+ print("Variable is None")
+
+ You should prefer using <item one> is not <item two> over not <item one> is <item two>.
+ Using second makes it harder to understand the expression.
+
# No
+if not variable is None:
+ print("Variable is not None")
+
+# Yes - it is much easier to read and understand this than previous
+if variable is not None:
+ print("Variable is not None")
+
+ Imports should be at top of the file, the only things that should be before them are module comments and docstrings.
+You shouldn't import multiple modules in one line, but give each module import its own line instead.
+# No
+import pathlib, os
+
+# Yes
+import os
+import pathlib
+ Wildcard imports should be avoided in most cases. They make unclear where what comes from.
+# No
+from pathlib import *
+
+# Yes
+from pathlib import Path
+ You should use isort imports order specification, what means:
+__future__ imports, standard library imports,
+ third-party library imports, and finally project imports.
+ import <package>
+ and after them from <package> import <items>.
+ from <package> import <items> format,
+ <items> should be ordered alphabetically, starting with bare module imports.
+ + Comments are really important because they help everyone understand what code does. + But as important as having comments is keeping them up-to-date. + Out-to-date, wrong comments confuse readers. +
+Comments content should start with a capital letter and be a full sentence(s).
+There are three types of comments:
+# what should be followed by a single space,
+ except for text indention inside the comment. To separate paragraphs, use one line containing only #.
+ if variable is None or variable == 1:
+ # If variable is None, something went wrong previously.
+ #
+ # Here starts a new important paragraph.
+ + Inline comments: You should prefer block comments over inline comments and use inline comments only where it is really necessary. + Never use inline comments to explain obvious things like what a line does. +
+If you want to use an inline comment on a variable, think first, maybe you can use a better variable name instead.
+
+ After code and before the start of inline comments should be at least two spaces.
+ Just like block comments, inline comments also have to start with # followed by a single space.
+
# Do not use inline comments to explain things
+# that the reader can understand even without the inline comment.
+my_variable = "Value!" # Assign value to my_variable
+
+# Here better variable name can be used like shown in the second line.
+x = "Walmart" # Shop name
+shop_name = "Walmart"
+
+# Sometimes, if something is not obvious, then inline comments are useful.
+# Example is from PEP 8.
+x = x + 1 # Compensate for border
+ + Docstrings: Last, but not least important comment type is docstring, which is a short version of documentation string. + Docstring rules haven't been defined by PEP 8, but by PEP 257 instead. + Docstrings should start and end with three quotes ("""). +
+There are two types of docstrings: one-line docstrings and multiline docstrings.
++ One-line docstrings have to start and end in the same line, while multiline docstrings start and end in different lines. + Multiline docstring has two parts: summary line and a longer description, which are separated by one empty line. + The multiline docstring start and end quotes should be at different lines than the content. +
+# This is a one-line docstring.
+"""This is one line module docstring."""
+
+
+# This is a multiline docstring.
+def my_function():
+ """
+ This is the summary line.
+
+ This is the description.
+ """
+ + Do all these style rules make your head explode? We have something for you! We have a song! + We have The PEP 8 Song (featuring lemonsaurus)! + Great way to get started with writing beautiful code. +
+{% endblock %} + +{% block sidebar %} + {% include "events/sidebar/code-jams/useful-information.html" %} +{% endblock %} diff --git a/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html b/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html deleted file mode 100644 index 68423dde..00000000 --- a/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html +++ /dev/null @@ -1,257 +0,0 @@ -{% extends "events/base_sidebar.html" %} - -{% block breadcrumb %} -- For end-users, the most important parts of the software are functionality and UI/UX. - But for developers, there is one more important aspect - code style. - While ugly code can do everything that it has to do, developing it further may be a difficult task, - especially if a developer didn't write an original code. - Which one of the following do you prefer to read and work with? -
-MyPath = '/file.txt'
-from pathlib import *
-import os.path,sys
-def check(p):
- """Uses os.path.exist """
- return os.path.exists(p)
-
-def getF(
- p):
- """Not sure what this do, this just worked.
- """
- return Path(p
- )
-result=[check(MyPath),getF(MyPath)]
- or
-import os.path
-from pathlib import Path
-
-FILE_PATH = '/file.txt'
-
-
-def check_file_exists(path: str) -> bool:
- """Checks does file exists in path. Uses os.path.exists."""
- return os.path.exists(path)
-
-
-def get_path_object(path: str) -> Path:
- """
- Returns Path object of the path provided in arguments.
-
- This is here for backward compatibility, will be removed in the future.
- """
- return Path(path)
-
-result = [
- check_file_exists(FILE_PATH),
- get_path_object(FILE_PATH),
-]
-
- - The second is definitely easier to read and understand. - These scripts are small and if you read even first, you can understand what this code does pretty fast, - but what if the project has thousands and thousands of files in a really complex folder structure? - Do you want then code what looks like the first example? - You can save hours sometimes if you write beautiful code that follows style rules. -
-- The most important document of Python code style is PEP 8. - This gives the majority of all Python code style rules. This article will cover the most important rules of PEP 8. -
- -- But everyone makes mistakes and there are so many style rules that can be really difficult to remember and always follow. - Luckily, we have amazing tools that help us - linters. While there are many linters, - we'd like code jam participants to use flake8. - Flake8 points out to you rules what you did break in your code so you can fix them. -
- -For indentation, you should use 4 spaces. Using tabs is not suggested, but if you do, you can't mix spaces and tabs.
-- PEP 8 defines a maximum line length of 79 characters, however, - we are not so strict - we let teams choose a maximum line length between 79 and 119 characters. -
-2 blank lines should be left before functions and classes. Single blank lines are used to split sections and make logical breaks.
- -Module, file, function, and variable names (except type variables) should be lowercase and use underscores.
-# File: my_module.py/mymodule.py
-
-def my_function():
- my_variable = "value"
- Class and type variable names should use the camel case style.
-from typing import List
-
-
-class MyClass:
- pass
-
-ListOfMyClass = List[MyClass]
- Constant names should be all uppercase, and words should be separated with underscores.
-MY_CONSTANT = 1
- - You should avoid single-character names, as these might be confusing. - But if you still do, you should avoid characters that may look like zero or one in some fonts: - "O" (uppercase o), "l" (lowercase L), and "I" (uppercase i). -
- -- If you have a chain of mathematic operations that you split into multiple lines, - you should put the operator at the beginning of the line and not to the end of the line. -
-# No
-result = (
- 1 +
- 2 *
- 3
-)
-
-# Yes
-result = (
- 1
- + 2
- * 3
-)
- If you compare against None, you should use is and is not, but not compare equality.
# No
-if variable == None:
- print("Variable is None")
-
-# Yes
-if variable is None:
- print("Variable is None")
-
- You should prefer using <item one> is not <item two> over not <item one> is <item two>.
- Using second makes it harder to understand the expression.
-
# No
-if not variable is None:
- print("Variable is not None")
-
-# Yes - it is much easier to read and understand this than previous
-if variable is not None:
- print("Variable is not None")
-
- Imports should be at top of the file, the only things that should be before them are module comments and docstrings.
-You shouldn't import multiple modules in one line, but give each module import its own line instead.
-# No
-import pathlib, os
-
-# Yes
-import os
-import pathlib
- Wildcard imports should be avoided in most cases. They make unclear where what comes from.
-# No
-from pathlib import *
-
-# Yes
-from pathlib import Path
- You should use isort imports order specification, what means:
-__future__ imports, standard library imports,
- third-party library imports, and finally project imports.
- import <package>
- and after them from <package> import <items>.
- from <package> import <items> format,
- <items> should be ordered alphabetically, starting with bare module imports.
- - Comments are really important because they help everyone understand what code does. - But as important as having comments is keeping them up-to-date. - Out-to-date, wrong comments confuse readers. -
-Comments content should start with a capital letter and be a full sentence(s).
-There are three types of comments:
-# what should be followed by a single space,
- except for text indention inside the comment. To separate paragraphs, use one line containing only #.
- if variable is None or variable == 1:
- # If variable is None, something went wrong previously.
- #
- # Here starts a new important paragraph.
- - Inline comments: You should prefer block comments over inline comments and use inline comments only where it is really necessary. - Never use inline comments to explain obvious things like what a line does. -
-If you want to use an inline comment on a variable, think first, maybe you can use a better variable name instead.
-
- After code and before the start of inline comments should be at least two spaces.
- Just like block comments, inline comments also have to start with # followed by a single space.
-
# Do not use inline comments to explain things
-# that the reader can understand even without the inline comment.
-my_variable = "Value!" # Assign value to my_variable
-
-# Here better variable name can be used like shown in the second line.
-x = "Walmart" # Shop name
-shop_name = "Walmart"
-
-# Sometimes, if something is not obvious, then inline comments are useful.
-# Example is from PEP 8.
-x = x + 1 # Compensate for border
- - Docstrings: Last, but not least important comment type is docstring, which is a short version of documentation string. - Docstring rules haven't been defined by PEP 8, but by PEP 257 instead. - Docstrings should start and end with three quotes ("""). -
-There are two types of docstrings: one-line docstrings and multiline docstrings.
-- One-line docstrings have to start and end in the same line, while multiline docstrings start and end in different lines. - Multiline docstring has two parts: summary line and a longer description, which are separated by one empty line. - The multiline docstring start and end quotes should be at different lines than the content. -
-# This is a one-line docstring.
-"""This is one line module docstring."""
-
-
-# This is a multiline docstring.
-def my_function():
- """
- This is the summary line.
-
- This is the description.
- """
- - Do all these style rules make your head explode? We have something for you! We have a song! - We have The PEP 8 Song (featuring lemonsaurus)! - Great way to get started with writing beautiful code. -
-{% endblock %} - -{% block sidebar %} - {% include "events/sidebar/code-jams/useful-information.html" %} -{% endblock %} -- cgit v1.2.3 From da5ba59bbe2172e7a672bdb3308427315e6ceba4 Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Fri, 9 Jul 2021 12:18:19 +0300 Subject: Drop the- prefix from CJ 8 sidebar code style guide item --- pydis_site/templates/events/sidebar/code-jams/8.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pydis_site/templates/events/sidebar/code-jams/8.html b/pydis_site/templates/events/sidebar/code-jams/8.html index e68c913d..de8c6b0b 100644 --- a/pydis_site/templates/events/sidebar/code-jams/8.html +++ b/pydis_site/templates/events/sidebar/code-jams/8.html @@ -4,7 +4,7 @@ Rules Approved Frameworks GitHub Bootcamp - The Code Style Guide + The Code Style GuideThere are three types of comments:
# what should be followed by a single space,
- except for text indention inside the comment. To separate paragraphs, use one line containing only #.
+
+ Probably most common comment type. Should be indented to the same level as the code they describe.
+ Each line in the block comment has to start with # what should be followed by a single space,
+ except for text indention inside the comment. To separate paragraphs, use one line containing only #.
+
if variable is None or variable == 1:
# If variable is None, something went wrong previously.
#
# Here starts a new important paragraph.
- Inline comments: You should prefer block comments over inline comments and use inline comments only where it is really necessary. + You should prefer block comments over inline comments and use inline comments only where it is really necessary. Never use inline comments to explain obvious things like what a line does.
If you want to use an inline comment on a variable, think first, maybe you can use a better variable name instead.
@@ -219,8 +223,9 @@ shop_name = "Walmart" x = x + 1 # Compensate for border- Docstrings: Last, but not least important comment type is docstring, which is a short version of documentation string. + Last, but not least important comment type is docstring, which is a short version of documentation string. Docstring rules haven't been defined by PEP 8, but by PEP 257 instead. Docstrings should start and end with three quotes (""").
-- cgit v1.2.3 From 3f1db69bea7a87073b1f58d7dac3e62fcb6438e8 Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Fri, 9 Jul 2021 15:01:04 +0300 Subject: List comment types beforeComments content should start with a capital letter and be a full sentence(s).
-There are three types of comments:
+There are three types of comments: block comments, inline comments, and docstrings.
MyPath = '/file.txt'
@@ -57,14 +57,15 @@ result = [
The second is definitely easier to read and understand.
- These scripts are small and if you read even first, you can understand what this code does pretty fast,
+ These scripts are small and even with the first code snippet you can understand what the code does pretty quickly,
but what if the project has thousands and thousands of files in a really complex folder structure?
- Do you want then code what looks like the first example?
- You can save hours sometimes if you write beautiful code that follows style rules.
+ Do you want to work with code that looks like the first example?
+ You can save hours sometimes if you write beautiful code that follows the style guidelines.
- The most important document of Python code style is PEP 8.
- This gives the majority of all Python code style rules. This article will cover the most important rules of PEP 8.
+ The most important code style document for Python is PEP 8.
+ This Python Enhancement Proposal lays out the majority of all Python code style guidelines.
+ This article will cover the most important aspects of PEP 8.
Linters
@@ -75,12 +76,12 @@ result = [
Flake8 points out to you rules what you did break in your code so you can fix them.
- Rules
+ Guidelines
Basics
For indentation, you should use 4 spaces. Using tabs is not suggested, but if you do, you can't mix spaces and tabs.
PEP 8 defines a maximum line length of 79 characters, however,
- we are not so strict - we let teams choose a maximum line length between 79 and 119 characters.
+ we are not so strict - teams are welcome to choose a maximum line length between 79 and 119 characters.
2 blank lines should be left before functions and classes. Single blank lines are used to split sections and make logical breaks.
@@ -109,7 +110,7 @@ ListOfMyClass = List[MyClass]
If you have a chain of mathematic operations that you split into multiple lines, - you should put the operator at the beginning of the line and not to the end of the line. + you should put the operator at the beginning of the line and not the end of the line.
# No
result = (
@@ -124,7 +125,7 @@ result = (
+ 2
* 3
)
- If you compare against None, you should use is and is not, but not compare equality.
If you ever check if something is equivalent to None, you should use is and is not instead of the == operator.
# No
if variable == None:
print("Variable is None")
@@ -134,7 +135,7 @@ if variable is None:
print("Variable is None")
You should prefer using <item one> is not <item two> over not <item one> is <item two>.
- Using second makes it harder to understand the expression.
+ Using the latter makes it harder to understand what the expression is trying to do.
# No
if not variable is None:
@@ -153,13 +154,13 @@ import pathlib, os
# Yes
import os
import pathlib
- Wildcard imports should be avoided in most cases. They make unclear where what comes from.
+Wildcard imports should be avoided in most cases. It clutters the namespace and makes it less clear where functions or classes are coming from.
# No
from pathlib import *
# Yes
from pathlib import Path
- You should use isort imports order specification, what means:
+You should use isort imports order specification, which means:
__future__ imports, standard library imports,
@@ -181,8 +182,12 @@ from pathlib import Path
Comments are really important because they help everyone understand what code does. - But as important as having comments is keeping them up-to-date. - Out-to-date, wrong comments confuse readers. + In general, comments should explain why you are doing something if it's not obvious. + You should aim to write code that makes it obvious what it is doing and you can use the comments to explain why and provide some context. +
++ Keep in mind that just as important as having comments, is making sure they stay up to date. + Out-of-date and incorrect comments confuse readers of your code (including future you).
Comments content should start with a capital letter and be a full sentence(s).
There are three types of comments: block comments, inline comments, and docstrings.
@@ -191,8 +196,8 @@ from pathlib import Path
Probably most common comment type. Should be indented to the same level as the code they describe.
- Each line in the block comment has to start with # what should be followed by a single space,
- except for text indention inside the comment. To separate paragraphs, use one line containing only #.
+ Each line in the block comment has to start with # and should be followed by a single space.
+ To separate paragraphs, use one line containing only #.
if variable is None or variable == 1:
# If variable is None, something went wrong previously.
@@ -227,13 +232,13 @@ x = x + 1 # Compensate for border
Last, but not least important comment type is docstring, which is a short version of documentation string. Docstring rules haven't been defined by PEP 8, but by PEP 257 instead. - Docstrings should start and end with three quotes (""").
+Docstrings should start and end with three quotes (""").
There are two types of docstrings: one-line docstrings and multiline docstrings.
One-line docstrings have to start and end in the same line, while multiline docstrings start and end in different lines. Multiline docstring has two parts: summary line and a longer description, which are separated by one empty line. - The multiline docstring start and end quotes should be at different lines than the content. + The multiline docstring start and end quotes should be on different lines than the content.
# This is a one-line docstring.
"""This is one line module docstring."""
--
cgit v1.2.3
From 0bfa8c16ba0bdee49403a1e67487bf9a47053f6d Mon Sep 17 00:00:00 2001
From: Matteo Bertucci
Date: Fri, 9 Jul 2021 17:42:48 +0200
Subject: Code jam: switch the right menu to ongoing
---
pydis_site/templates/events/index.html | 2 +-
pydis_site/templates/events/pages/code-jams/_index.html | 2 +-
.../templates/events/sidebar/code-jams/ongoing-code-jam.html | 8 ++++++++
.../templates/events/sidebar/code-jams/upcoming-code-jam.html | 8 --------
pydis_site/templates/events/sidebar/ongoing-event.html | 8 ++++++++
pydis_site/templates/events/sidebar/upcoming-event.html | 8 --------
6 files changed, 18 insertions(+), 18 deletions(-)
create mode 100644 pydis_site/templates/events/sidebar/code-jams/ongoing-code-jam.html
delete mode 100644 pydis_site/templates/events/sidebar/code-jams/upcoming-code-jam.html
create mode 100644 pydis_site/templates/events/sidebar/ongoing-event.html
delete mode 100644 pydis_site/templates/events/sidebar/upcoming-event.html
diff --git a/pydis_site/templates/events/index.html b/pydis_site/templates/events/index.html
index 64bf2c25..daad1c9c 100644
--- a/pydis_site/templates/events/index.html
+++ b/pydis_site/templates/events/index.html
@@ -121,6 +121,6 @@
{% endblock %}
{% block sidebar %}
- {% include "events/sidebar/upcoming-event.html" %}
+ {% include "events/sidebar/ongoing-event.html" %}
{% include "events/sidebar/events-list.html" %}
{% endblock %}
diff --git a/pydis_site/templates/events/pages/code-jams/_index.html b/pydis_site/templates/events/pages/code-jams/_index.html
index fcbfa4d9..22a86db3 100644
--- a/pydis_site/templates/events/pages/code-jams/_index.html
+++ b/pydis_site/templates/events/pages/code-jams/_index.html
@@ -66,7 +66,7 @@
{% endblock %}
{% block sidebar %}
- {% include "events/sidebar/code-jams/upcoming-code-jam.html" %}
+ {% include "events/sidebar/code-jams/ongoing-code-jam.html" %}
{% include "events/sidebar/code-jams/previous-code-jams.html" %}
{% include "events/sidebar/code-jams/useful-information.html" %}
{% endblock %}
diff --git a/pydis_site/templates/events/sidebar/code-jams/ongoing-code-jam.html b/pydis_site/templates/events/sidebar/code-jams/ongoing-code-jam.html
new file mode 100644
index 00000000..f4fa3a37
--- /dev/null
+++ b/pydis_site/templates/events/sidebar/code-jams/ongoing-code-jam.html
@@ -0,0 +1,8 @@
+{% load static %}
+
+
+ Ongoing Code Jam
+
+
+
+
diff --git a/pydis_site/templates/events/sidebar/code-jams/upcoming-code-jam.html b/pydis_site/templates/events/sidebar/code-jams/upcoming-code-jam.html
deleted file mode 100644
index 19806b4e..00000000
--- a/pydis_site/templates/events/sidebar/code-jams/upcoming-code-jam.html
+++ /dev/null
@@ -1,8 +0,0 @@
-{% load static %}
-
-
- Upcoming Code Jam
-
-
-
-
diff --git a/pydis_site/templates/events/sidebar/ongoing-event.html b/pydis_site/templates/events/sidebar/ongoing-event.html
new file mode 100644
index 00000000..37dfdf77
--- /dev/null
+++ b/pydis_site/templates/events/sidebar/ongoing-event.html
@@ -0,0 +1,8 @@
+{% load static %}
+
+
+
+
+
+
+
diff --git a/pydis_site/templates/events/sidebar/upcoming-event.html b/pydis_site/templates/events/sidebar/upcoming-event.html
deleted file mode 100644
index cfa4cf88..00000000
--- a/pydis_site/templates/events/sidebar/upcoming-event.html
+++ /dev/null
@@ -1,8 +0,0 @@
-{% load static %}
-
-
-
-
-
-
-
--
cgit v1.2.3
From 5a7ea51c39a1eab103d06b64e23f9e2840b64ccf Mon Sep 17 00:00:00 2001
From: Matteo Bertucci
Date: Fri, 9 Jul 2021 17:44:27 +0200
Subject: Code jam: switch home to use the ongoing banner
---
pydis_site/templates/home/index.html | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pydis_site/templates/home/index.html b/pydis_site/templates/home/index.html
index 2efa5b49..072e3817 100644
--- a/pydis_site/templates/home/index.html
+++ b/pydis_site/templates/home/index.html
@@ -12,7 +12,7 @@
@@ -48,7 +48,7 @@
{# Code Jam banner #}
--
cgit v1.2.3
From 877d3c219b56ad170a382e397b3f174d9ee8b948 Mon Sep 17 00:00:00 2001
From: Matteo Bertucci
Date: Fri, 9 Jul 2021 17:44:49 +0200
Subject: Code jam: use case name in code style
---
pydis_site/templates/events/pages/code-jams/code-style-guide.html | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pydis_site/templates/events/pages/code-jams/code-style-guide.html b/pydis_site/templates/events/pages/code-jams/code-style-guide.html
index 31156da2..4ff5baaf 100644
--- a/pydis_site/templates/events/pages/code-jams/code-style-guide.html
+++ b/pydis_site/templates/events/pages/code-jams/code-style-guide.html
@@ -91,7 +91,7 @@ result = [
def my_function():
my_variable = "value"
- Class and type variable names should use the camel case style.
+Class and type variable names should use the PascalCase style.
from typing import List
@@ -99,7 +99,7 @@ class MyClass:
pass
ListOfMyClass = List[MyClass]
- Constant names should be all uppercase, and words should be separated with underscores.
+Constant names should use the SCREAMING_SNAKE_CASE style.
MY_CONSTANT = 1
You should avoid single-character names, as these might be confusing.
--
cgit v1.2.3
From c114398445e11b43cb0ee3e1fe6b70158747ea26 Mon Sep 17 00:00:00 2001
From: Chris Lovering