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
| import logging | |
| logging.basicConfig(level=logging.INFO, format='%(asctime)s [%(levelname)s] %(name)s: %(message)s') |
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
| # Load Excel files in a folder and load content to simple class | |
| # Using first row as a header | |
| from typing import Tuple, Generator | |
| from types import SimpleNamespace | |
| import os | |
| from openpyxl import load_workbook | |
| INPUT_BASE_FOLDER = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'TheKnotResults_250cities') |
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
| def check_setting(param_name): | |
| """ | |
| Simple decorator to disable pipeline for spiders with some attributes | |
| ``` | |
| class A: | |
| f_enabled = True | |
| @check_setting('f_enabled') | |
| def f(self, times): | |
| print(' '.join(['hey!'] * times)) |
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
| package main | |
| import ( | |
| "fmt" | |
| "math/rand" | |
| "errors" | |
| ) | |
| func Sort(list []int) ([]int, error) { | |
| if len(list) < 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
| from time import time, sleep | |
| _128k = 128 * 1024 | |
| _256k = 256 * 1024 | |
| _512k = 512 * 1024 | |
| _1024k = 1024 * 1024 | |
| class TokenBucket(object): |
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
| import datetime | |
| class Throttle(object): | |
| def __init__(self, domain, max_hits, period): | |
| self.domain = domain | |
| self.max_hits = max_hits | |
| self.hits = 0 | |
| self.period = datetime.timedelta(seconds=period) |
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
| beautifulsoup4 | |
| et-xmlfile | |
| flake8 | |
| importmagic | |
| jdcal | |
| jedi | |
| lxml | |
| mccabe | |
| openpyxl | |
| pep8 |
NewerOlder