This file contains 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
# -*- coding: utf-8 -*- | |
import urllib3 | |
import bs4 | |
import requests | |
from lxml import html | |
import argparse | |
source_url = 'http://python.org' | |
def get_python_events_bysoup(url): |
This file contains 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
customers_balance_true = [25, 25, 25, 100] | |
customers_balance_false = [25, 25, 50, 100, 100] | |
def having_odd_money(money): | |
cinema_balance = 0 | |
for banknote in money: | |
if banknote == 25: | |
cinema_balance += banknote | |
elif banknote == 50: | |
cinema_balance += banknote/2 |
This file contains 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Джанго</title> | |
<link rel="stylesheet" type="text/css" href="/static/css/bootstrap.min.css"> | |
<script src="/static/js/bootstrap.min.js"></script> | |
</head> |
This file contains 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 selenium import webdriver | |
from selenium.webdriver.common.by import By | |
from selenium.webdriver.support.ui import WebDriverWait | |
from selenium.webdriver.support import expected_conditions as EC | |
import datetime | |
import time | |
while True: | |
# opening_browser |
This file contains 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
func multiparseText() string { | |
collectedTexts := "" | |
ch := make(chan string, parseThreadsNum) | |
defer close(ch) | |
for i := 0; i < parseThreadsNum; i++ { | |
go parseText(&ch) | |
} | |
for { | |
unreadData := len(ch) | |
if unreadData == parseThreadsNum { |
This file contains 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
testmodules = [ | |
'cogapp.test_makefiles', | |
'cogapp.test_whiteutils', | |
'cogapp.test_cogapp', | |
] | |
suite = unittest.TestSuite() | |
for t in testmodules: | |
try: |
This file contains 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 regroup_response(self): | |
""" | |
Groups elements of request by keys and references on keys. | |
NOTE that those keys and references actually have meaning of primary and foreign key | |
in the terms of SQL. | |
:param data: json like request (actually dicts with lists and strings) | |
:return: None | |
""" | |
keys = {} |
This file contains 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 contains(self, element, list_wrap=False): | |
""" | |
Recursively seeks for requested keyword or list of keywords | |
:param data: json-type dict | |
:param element: str or list | |
:return: list or None | |
""" | |
collected_elements = [] | |
def _recursively_seek(data): |
This file contains 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 asyncio | |
class _AsyncObject(object): | |
"""Inheriting this class allows you to define an async __init__. | |
So you can create objects by doing something like `await MyClass(params)` | |
""" | |
@asyncio.coroutine | |
def __new__(cls, *a, **kw): |
This file contains 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 decor(func): | |
def wrapped(a, b): | |
a = 'deco' | |
b = 'rated' | |
return func(a, b) | |
return wrapped # not calling yet | |
@decor # init decor here |
OlderNewer