- Select lines from
# Selection startto# Selection endor follow comment instruction - Perform extract method refactoring:
Refactor->Extract->Method...
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
| { | |
| "version":"1.0", | |
| "data":{ | |
| "sheets":[ | |
| { | |
| "name":"Sheet", | |
| "blocks":[ | |
| { | |
| "type":"CODE", | |
| "text":"import logging\nimport requests" |
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 | |
| from time import sleep | |
| logger1 = logging.getLogger('logger1') | |
| handler1 = logging.FileHandler('log1.txt') | |
| logger1.addHandler(handler1) | |
| logger1.setLevel(logging.INFO) | |
| logger2 = logging.getLogger('logger2') | |
| handler2 = logging.FileHandler('log2.txt') |
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 numpy as np | |
| import pandas as pd | |
| d = {'one': pd.Series([1., 2., 3.], index=['a', 'b', 'c']), | |
| 'two': pd.Series([1., 2., 3., 4.], index=['a', 'b', 'c', 'd'])} | |
| df = pd.DataFrame(d) | |
| df1 = pd.DataFrame(d, index=['d', 'b', 'a']) | |
| df2 = pd.DataFrame(d, index=['d', 'b', 'a'], columns=['two', 'three']) |
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 pytest | |
| import re | |
| from module3.find_all_domains import get_domain, URL_PATTERN | |
| URL_RECOGNITION = ( | |
| ('html', 'expected'), | |
| [ | |
| ('<p class = "hello" href= "http://dtepic.org/courses">', | |
| None), |
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/local/bin/python | |
| # -*- coding: UTF-8 -*- | |
| import argparse | |
| import sys | |
| def createNewParser(): | |
| parser = argparse.ArgumentParser() |
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 memory_summary(): | |
| from pympler import summary, muppy | |
| mem_summary = summary.summarize(muppy.get_objects()) | |
| rows = summary.format_(mem_summary) | |
| return '\n'.join(rows) | |
| # Allocate some memory | |
| my_str = 'a'*2**26 | |
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
| class Test: | |
| def __enter__(self): | |
| print("Start!") | |
| def __exit__(self, exc_type, exc_val, exc_tb): | |
| print("End!") | |
| test = Test() |
NewerOlder