This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| class Struct(): pass | |
| def toObject(dictionnaire): | |
| object = Struct() | |
| for nom, element in dictionnaire.items(): | |
| if isinstance(element, dict): | |
| setattr(object, nom, toObject(element)) | |
| else: | |
| setattr(object, nom, element) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| import random | |
| class Carte(): | |
| couleurs = {'carreau': '♦', 'coeur': '♥', 'pique': '♠', 'trefle': '♣'} | |
| noms = {"2" : 1, "3" : 2, "4" : 3, "5" : 4, "6" : 5, "7" : 6, | |
| "8" : 7, "9" : 8, "10" : 9, "valet" : 10, "dame" : 11, | |
| "roi" : 12, "as" : 13} | |
| def __init__(self, nom, couleur): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| import os | |
| import re | |
| entree = os.path.join('chemin', 'vers le', '.md') | |
| sortie = os.path.join('chemin', 'vers le', '.toc.md') | |
| with open(entree) as md, open(sortie, 'w') as out: | |
| for ligne in md: | |
| if ligne[0] == '#': |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| """ | |
| Brangelina | |
| The task of combining first names of celebrities into | |
| a short catchy name for media consumption turns out | |
| to be surprisingly simple to automate. Start by counting | |
| how many groups of consecutive vowels (aeiou) there are | |
| inside the first name. For example, "brad" and "ben" have |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| from typing import NoReturn, Dict, Any, Optional, List | |
| import requests | |
| import json | |
| class QwantData: | |
| def __init__(self, json_str: bytes, wished_data: str) -> NoReturn: | |
| parsed_json: Dict = json.loads(json_str) | |
| if wished_data == 'artist': |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- ENTITIES | |
| CREATE TABLE address ( | |
| id SERIAL PRIMARY KEY, | |
| street_name TEXT NOT NULL, | |
| home_number TEXT NOT NULL, | |
| zip_code TEXT NOT NULL, | |
| country TEXT | |
| ); | |
| CREATE TABLE role ( | |
| id SERIAL PRIMARY KEY, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| import time | |
| import pytest | |
| from app.Simple import Simple | |
| @pytest.fixture() | |
| def var() -> None: | |
| return Simple(azerty=1, uiop=2) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [[source]] | |
| name = "pypi" | |
| url = "https://pypi.org/simple" | |
| verify_ssl = true | |
| [dev-packages] | |
| mypy = "*" | |
| flake8 = "*" | |
| ipython = "*" | |
| django-stubs = "*" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| document.querySelector('form.save').addEventListener('submit', () => { | |
| let data = FormData(); | |
| data.append('substitute', this.querySelector('input[name=substitute]')); | |
| data.append('substituted', this.querySelector('input[name=substituted]')); | |
| let xhr = new XmlHttpRequest(); | |
| xhr.open('POST', '{% url "favorite:save" %}'); | |
| xhr.addEventListener('load', () => { | |
| const answer = JSON.parse(xhr.responseText); | |
| if (xhr.status == 200) { | |
| let status = answer.status; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| from typing import Callable | |
| class Converter: | |
| def __init__(self, lang: str = 'en') -> None: | |
| self.lang: str = lang | |
| if self.lang == 'fr': | |
| self.part: str = 'vers' | |
| elif self.lang == 'en': |