text stringlengths 0 828 |
|---|
"""""" The button for expanded detailed options. This |
also happens to be a good indicator as to wheter |
all content is loaded. |
"""""" |
# Wait for a content element, and 3 extra seconds just in case |
WebDriverWait(self.browser, PAGELOAD_TIMEOUT)\ |
.until(EC.presence_of_element_located((By.CLASS_NAME, |
detailed_cls))) |
self.browser.implicitly_wait(3) |
self.browser\ |
.find_element_by_class_name(detailed_cls)\ |
.find_element_by_tag_name(""td"")\ |
.click() |
# Wait for a content element, and 3 extra seconds just in case |
WebDriverWait(self.browser, PAGELOAD_TIMEOUT)\ |
.until(EC.presence_of_element_located((By.CLASS_NAME, |
detailed_cls))) |
self.browser.implicitly_wait(3)" |
1878,"def _fetch_dimensions(self, dataset): |
"""""" Declaring available dimensions like this is not mandatory, |
but nice, especially if they differ from dataset to dataset. |
If you are using a built in datatype, you can specify the dialect |
you are expecting, to have values normalized. This scraper will |
look for Swedish month names (e.g. 'Januari'), but return them |
according to the Statscraper standard ('january'). |
"""""" |
yield Dimension(u""region"", |
label=""municipality or county"", |
datatype=""region"", |
dialect=""arbetsmiljoverket"") |
yield Dimension(u""period"", |
label=""Year or month"")" |
1879,"def _fetch_itemslist(self, item): |
"""""" We define two collection: |
- Number of work injuries (""Arbetsolycka"") |
- Number of workrelated diseases (""Arbetssjukdom"") |
Each contains four datasets: |
- Per municipality and year |
- Per county and year |
- Per municipality and month |
- Per municipality and year |
"""""" |
if item.is_root: |
for c in [""Arbetsolycka"", ""Arbetssjukdom""]: |
yield Collection(c, blob=(c, None, None)) |
else: |
c = item.id |
for r in [u""kommun"", u""län""]: |
for p in [u""år"", u""månad""]: |
yield Dataset(u""%s-%s-%s"" % (c, r, p), |
blob=(c, r, p), |
label=u""%s, antal per %s och %s"" % (c, r, p))" |
1880,"def make_log_record_output(category, level, message, |
format=None, datefmt=None, **kwargs): |
"""""" |
Create the output for a log record, like performed by :mod:`logging` module. |
:param category: Name of the logger (as string or None). |
:param level: Log level (as number). |
:param message: Log message to use. |
:returns: Log record output (as string) |
"""""" |
if not category or (category == ""__ROOT__""): |
category = ""root"" |
levelname = logging.getLevelName(level) |
record_data = dict(name=category, levelname=levelname, msg=message) |
record_data.update(kwargs) |
record = logging.makeLogRecord(record_data) |
formatter = logging.Formatter(format, datefmt=datefmt) |
return formatter.format(record)" |
1881,"def step_I_create_logrecords_with_table(context): |
"""""" |
Step definition that creates one more log records by using a table. |
.. code-block: gherkin |
When I create log records with: |
| category | level | message | |
| foo | ERROR | Hello Foo | |
| foo.bar | WARN | Hello Foo.Bar | |
Table description |
------------------ |
| Column | Type | Required | Description | |
| category | string | yes | Category (or logger) to use. | |
| level | LogLevel | yes | Log level to use. | |
| message | string | yes | Log message to use. | |
.. code-block: python |
import logging |
from behave.configuration import LogLevel |
for row in table.rows: |
logger = logging.getLogger(row.category) |
level = LogLevel.parse_type(row.level) |
logger.log(level, row.message) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.