prompt
large_stringlengths
72
9.34k
completion
large_stringlengths
0
7.61k
<|file_name|>grep.py<|end_file_name|><|fim▁begin|># coding=utf-8 import os.path import sys import types import getopt from getopt import GetoptError import text_file import regex_utils import string_utils as str_utils def grep(target, pattern, number = False, model = 'e'): ''' grep: print lines matching a...
def show_help(): pass
<|file_name|>grep.py<|end_file_name|><|fim▁begin|># coding=utf-8 import os.path import sys import types import getopt from getopt import GetoptError import text_file import regex_utils import string_utils as str_utils def grep(target, pattern, number = False, model = 'e'): <|fim_middle|> __match(line_num, lin...
''' grep: print lines matching a pattern @param target:string list or text file name @param pattern: regex pattern or line number pattern or reduce function: bool=action(str) @param number: with line number @param model: s: substring model, e: regex model, n: line number model, a: action mo...
<|file_name|>grep.py<|end_file_name|><|fim▁begin|># coding=utf-8 import os.path import sys import types import getopt from getopt import GetoptError import text_file import regex_utils import string_utils as str_utils def grep(target, pattern, number = False, model = 'e'): ''' grep: print lines matching a...
_utils.is_blank(line_text): return False if str_utils.is_blank(pattern): return True patterns = [] if type(pattern) == types.ListType: patterns = pattern elif type(pattern) == types.FunctionType: patterns = [pattern] else: patterns = [str(pattern...
<|file_name|>grep.py<|end_file_name|><|fim▁begin|># coding=utf-8 import os.path import sys import types import getopt from getopt import GetoptError import text_file import regex_utils import string_utils as str_utils def grep(target, pattern, number = False, model = 'e'): ''' grep: print lines matching a...
tern.startswith('[') and pattern.endswith(']') and ',' in pattern: region = pattern[1: len(pattern) - 1].split(',') if region != None and len(region) == 2: _min = int(region[0].strip()) _max = int(region[1].strip()) return _min, _max return 0, 0 def
<|file_name|>grep.py<|end_file_name|><|fim▁begin|># coding=utf-8 import os.path import sys import types import getopt from getopt import GetoptError import text_file import regex_utils import string_utils as str_utils def grep(target, pattern, number = False, model = 'e'): ''' grep: print lines matching a...
ber: return str(line) + ':' + text.strip() else: return text.strip() de
<|file_name|>grep.py<|end_file_name|><|fim▁begin|># coding=utf-8 import os.path import sys import types import getopt from getopt import GetoptError import text_file import regex_utils import string_utils as str_utils def grep(target, pattern, number = False, model = 'e'): ''' grep: print lines matching a...
filename = None pattern = None number = False model = 'e' if len(argv) > 2: opts, _ = getopt.getopt(argv[2:],'hf:p:nm:', ['help', '--file', '--pattern', '--number', '--model']) for name, value in opts: if name in ('-h', '--help'...
<|file_name|>grep.py<|end_file_name|><|fim▁begin|># coding=utf-8 import os.path import sys import types import getopt from getopt import GetoptError import text_file import regex_utils import string_utils as str_utils def grep(target, pattern, number = False, model = 'e'): ''' grep: print lines matching a...
<|file_name|>grep.py<|end_file_name|><|fim▁begin|># coding=utf-8 import os.path import sys import types import getopt from getopt import GetoptError import text_file import regex_utils import string_utils as str_utils def grep(target, pattern, number = False, model = 'e'): ''' grep: print lines matching a...
text_file.read_file(target) e
<|file_name|>grep.py<|end_file_name|><|fim▁begin|># coding=utf-8 import os.path import sys import types import getopt from getopt import GetoptError import text_file import regex_utils import string_utils as str_utils def grep(target, pattern, number = False, model = 'e'): ''' grep: print lines matching a...
target e
<|file_name|>grep.py<|end_file_name|><|fim▁begin|># coding=utf-8 import os.path import sys import types import getopt from getopt import GetoptError import text_file import regex_utils import string_utils as str_utils def grep(target, pattern, number = False, model = 'e'): ''' grep: print lines matching a...
None
<|file_name|>grep.py<|end_file_name|><|fim▁begin|># coding=utf-8 import os.path import sys import types import getopt from getopt import GetoptError import text_file import regex_utils import string_utils as str_utils def grep(target, pattern, number = False, model = 'e'): ''' grep: print lines matching a...
None
<|file_name|>grep.py<|end_file_name|><|fim▁begin|># coding=utf-8 import os.path import sys import types import getopt from getopt import GetoptError import text_file import regex_utils import string_utils as str_utils def grep(target, pattern, number = False, model = 'e'): ''' grep: print lines matching a...
ext = __print(line_num, line_text, number) if line_text != None: result.append(line_text)
<|file_name|>grep.py<|end_file_name|><|fim▁begin|># coding=utf-8 import os.path import sys import types import getopt from getopt import GetoptError import text_file import regex_utils import string_utils as str_utils def grep(target, pattern, number = False, model = 'e'): ''' grep: print lines matching a...
.append(line_text)
<|file_name|>grep.py<|end_file_name|><|fim▁begin|># coding=utf-8 import os.path import sys import types import getopt from getopt import GetoptError import text_file import regex_utils import string_utils as str_utils def grep(target, pattern, number = False, model = 'e'): ''' grep: print lines matching a...
False
<|file_name|>grep.py<|end_file_name|><|fim▁begin|># coding=utf-8 import os.path import sys import types import getopt from getopt import GetoptError import text_file import regex_utils import string_utils as str_utils def grep(target, pattern, number = False, model = 'e'): ''' grep: print lines matching a...
True
<|file_name|>grep.py<|end_file_name|><|fim▁begin|># coding=utf-8 import os.path import sys import types import getopt from getopt import GetoptError import text_file import regex_utils import string_utils as str_utils def grep(target, pattern, number = False, model = 'e'): ''' grep: print lines matching a...
ns = pattern e
<|file_name|>grep.py<|end_file_name|><|fim▁begin|># coding=utf-8 import os.path import sys import types import getopt from getopt import GetoptError import text_file import regex_utils import string_utils as str_utils def grep(target, pattern, number = False, model = 'e'): ''' grep: print lines matching a...
ns = [pattern] e
<|file_name|>grep.py<|end_file_name|><|fim▁begin|># coding=utf-8 import os.path import sys import types import getopt from getopt import GetoptError import text_file import regex_utils import string_utils as str_utils def grep(target, pattern, number = False, model = 'e'): ''' grep: print lines matching a...
ns = [str(pattern)]
<|file_name|>grep.py<|end_file_name|><|fim▁begin|># coding=utf-8 import os.path import sys import types import getopt from getopt import GetoptError import text_file import regex_utils import string_utils as str_utils def grep(target, pattern, number = False, model = 'e'): ''' grep: print lines matching a...
= 's' m
<|file_name|>grep.py<|end_file_name|><|fim▁begin|># coding=utf-8 import os.path import sys import types import getopt from getopt import GetoptError import text_file import regex_utils import string_utils as str_utils def grep(target, pattern, number = False, model = 'e'): ''' grep: print lines matching a...
ch_pattern in line_text: return True
<|file_name|>grep.py<|end_file_name|><|fim▁begin|># coding=utf-8 import os.path import sys import types import getopt from getopt import GetoptError import text_file import regex_utils import string_utils as str_utils def grep(target, pattern, number = False, model = 'e'): ''' grep: print lines matching a...
True
<|file_name|>grep.py<|end_file_name|><|fim▁begin|># coding=utf-8 import os.path import sys import types import getopt from getopt import GetoptError import text_file import regex_utils import string_utils as str_utils def grep(target, pattern, number = False, model = 'e'): ''' grep: print lines matching a...
_max = __split_region(match_pattern) if line_num >= _min and line_num <= _max: return True
<|file_name|>grep.py<|end_file_name|><|fim▁begin|># coding=utf-8 import os.path import sys import types import getopt from getopt import GetoptError import text_file import regex_utils import string_utils as str_utils def grep(target, pattern, number = False, model = 'e'): ''' grep: print lines matching a...
True
<|file_name|>grep.py<|end_file_name|><|fim▁begin|># coding=utf-8 import os.path import sys import types import getopt from getopt import GetoptError import text_file import regex_utils import string_utils as str_utils def grep(target, pattern, number = False, model = 'e'): ''' grep: print lines matching a...
ex_utils.check_line(match_pattern, line_text): return True
<|file_name|>grep.py<|end_file_name|><|fim▁begin|># coding=utf-8 import os.path import sys import types import getopt from getopt import GetoptError import text_file import regex_utils import string_utils as str_utils def grep(target, pattern, number = False, model = 'e'): ''' grep: print lines matching a...
True
<|file_name|>grep.py<|end_file_name|><|fim▁begin|># coding=utf-8 import os.path import sys import types import getopt from getopt import GetoptError import text_file import regex_utils import string_utils as str_utils def grep(target, pattern, number = False, model = 'e'): ''' grep: print lines matching a...
e(pattern) == types.FunctionType: if pattern(line_text): return True
<|file_name|>grep.py<|end_file_name|><|fim▁begin|># coding=utf-8 import os.path import sys import types import getopt from getopt import GetoptError import text_file import regex_utils import string_utils as str_utils def grep(target, pattern, number = False, model = 'e'): ''' grep: print lines matching a...
tern(line_text): return True
<|file_name|>grep.py<|end_file_name|><|fim▁begin|># coding=utf-8 import os.path import sys import types import getopt from getopt import GetoptError import text_file import regex_utils import string_utils as str_utils def grep(target, pattern, number = False, model = 'e'): ''' grep: print lines matching a...
True
<|file_name|>grep.py<|end_file_name|><|fim▁begin|># coding=utf-8 import os.path import sys import types import getopt from getopt import GetoptError import text_file import regex_utils import string_utils as str_utils def grep(target, pattern, number = False, model = 'e'): ''' grep: print lines matching a...
= pattern[1: len(pattern) - 1].split(',') if region != None and len(region) == 2: _min = int(region[0].strip()) _max = int(region[1].strip()) return _min, _max r
<|file_name|>grep.py<|end_file_name|><|fim▁begin|># coding=utf-8 import os.path import sys import types import getopt from getopt import GetoptError import text_file import regex_utils import string_utils as str_utils def grep(target, pattern, number = False, model = 'e'): ''' grep: print lines matching a...
int(region[0].strip()) _max = int(region[1].strip())
<|file_name|>grep.py<|end_file_name|><|fim▁begin|># coding=utf-8 import os.path import sys import types import getopt from getopt import GetoptError import text_file import regex_utils import string_utils as str_utils def grep(target, pattern, number = False, model = 'e'): ''' grep: print lines matching a...
str(line) + ':' + text.strip() e
<|file_name|>grep.py<|end_file_name|><|fim▁begin|># coding=utf-8 import os.path import sys import types import getopt from getopt import GetoptError import text_file import regex_utils import string_utils as str_utils def grep(target, pattern, number = False, model = 'e'): ''' grep: print lines matching a...
text.strip() de
<|file_name|>grep.py<|end_file_name|><|fim▁begin|># coding=utf-8 import os.path import sys import types import getopt from getopt import GetoptError import text_file import regex_utils import string_utils as str_utils def grep(target, pattern, number = False, model = 'e'): ''' grep: print lines matching a...
_ = getopt.getopt(argv[2:],'hf:p:nm:', ['help', '--file', '--pattern', '--number', '--model']) for name, value in opts: if name in ('-h', '--help'): show_help() if name in ('-f', '--file'): filename = value i...
<|file_name|>grep.py<|end_file_name|><|fim▁begin|># coding=utf-8 import os.path import sys import types import getopt from getopt import GetoptError import text_file import regex_utils import string_utils as str_utils def grep(target, pattern, number = False, model = 'e'): ''' grep: print lines matching a...
elp()
<|file_name|>grep.py<|end_file_name|><|fim▁begin|># coding=utf-8 import os.path import sys import types import getopt from getopt import GetoptError import text_file import regex_utils import string_utils as str_utils def grep(target, pattern, number = False, model = 'e'): ''' grep: print lines matching a...
me = value
<|file_name|>grep.py<|end_file_name|><|fim▁begin|># coding=utf-8 import os.path import sys import types import getopt from getopt import GetoptError import text_file import regex_utils import string_utils as str_utils def grep(target, pattern, number = False, model = 'e'): ''' grep: print lines matching a...
n = value
<|file_name|>grep.py<|end_file_name|><|fim▁begin|># coding=utf-8 import os.path import sys import types import getopt from getopt import GetoptError import text_file import regex_utils import string_utils as str_utils def grep(target, pattern, number = False, model = 'e'): ''' grep: print lines matching a...
= True
<|file_name|>grep.py<|end_file_name|><|fim▁begin|># coding=utf-8 import os.path import sys import types import getopt from getopt import GetoptError import text_file import regex_utils import string_utils as str_utils def grep(target, pattern, number = False, model = 'e'): ''' grep: print lines matching a...
= value
<|file_name|>grep.py<|end_file_name|><|fim▁begin|># coding=utf-8 import os.path import sys import types import getopt from getopt import GetoptError import text_file import regex_utils import string_utils as str_utils def grep(target, pattern, number = False, model = 'e'): ''' grep: print lines matching a...
'error : could not find file : ' + filename sys.exit()
<|file_name|>grep.py<|end_file_name|><|fim▁begin|># coding=utf-8 import os.path import sys import types import getopt from getopt import GetoptError import text_file import regex_utils import string_utils as str_utils def grep(target, pattern, number = False, model = 'e'): ''' grep: print lines matching a...
'error : pattern is empty' sys.exit()
<|file_name|>grep.py<|end_file_name|><|fim▁begin|># coding=utf-8 import os.path import sys import types import getopt from getopt import GetoptError import text_file import regex_utils import string_utils as str_utils def grep(target, pattern, number = False, model = 'e'): ''' grep: print lines matching a...
ne in result: print line
<|file_name|>grep.py<|end_file_name|><|fim▁begin|># coding=utf-8 import os.path import sys import types import getopt from getopt import GetoptError import text_file import regex_utils import string_utils as str_utils def grep(target, pattern, number = False, model = 'e'): ''' grep: print lines matching a...
elp() e
<|file_name|>grep.py<|end_file_name|><|fim▁begin|># coding=utf-8 import os.path import sys import types import getopt from getopt import GetoptError import text_file import regex_utils import string_utils as str_utils def <|fim_middle|>(target, pattern, number = False, model = 'e'): ''' grep: print lines ...
grep
<|file_name|>grep.py<|end_file_name|><|fim▁begin|># coding=utf-8 import os.path import sys import types import getopt from getopt import GetoptError import text_file import regex_utils import string_utils as str_utils def grep(target, pattern, number = False, model = 'e'): ''' grep: print lines matching a...
h(line_
<|file_name|>grep.py<|end_file_name|><|fim▁begin|># coding=utf-8 import os.path import sys import types import getopt from getopt import GetoptError import text_file import regex_utils import string_utils as str_utils def grep(target, pattern, number = False, model = 'e'): ''' grep: print lines matching a...
t_region(patte
<|file_name|>grep.py<|end_file_name|><|fim▁begin|># coding=utf-8 import os.path import sys import types import getopt from getopt import GetoptError import text_file import regex_utils import string_utils as str_utils def grep(target, pattern, number = False, model = 'e'): ''' grep: print lines matching a...
t(line,
<|file_name|>grep.py<|end_file_name|><|fim▁begin|># coding=utf-8 import os.path import sys import types import getopt from getopt import GetoptError import text_file import regex_utils import string_utils as str_utils def grep(target, pattern, number = False, model = 'e'): ''' grep: print lines matching a...
md(argv)
<|file_name|>grep.py<|end_file_name|><|fim▁begin|># coding=utf-8 import os.path import sys import types import getopt from getopt import GetoptError import text_file import regex_utils import string_utils as str_utils def grep(target, pattern, number = False, model = 'e'): ''' grep: print lines matching a...
elp():
<|file_name|>test_mockdata.py<|end_file_name|><|fim▁begin|>import unittest from src.data_structures.mockdata import MockData class TestMockData (unittest.TestCase): <|fim▁hole|> self.data = MockData() def test_random_data(self): data = MockData() a_set = data.get_random_elements(10) ...
def setUp(self):
<|file_name|>test_mockdata.py<|end_file_name|><|fim▁begin|>import unittest from src.data_structures.mockdata import MockData class TestMockData (unittest.TestCase): <|fim_middle|> <|fim▁end|>
def setUp(self): self.data = MockData() def test_random_data(self): data = MockData() a_set = data.get_random_elements(10) self.assertTrue(len(a_set) == 10, "the data should have 10 elements!") if __name__ == '__main__': unittest.main()
<|file_name|>test_mockdata.py<|end_file_name|><|fim▁begin|>import unittest from src.data_structures.mockdata import MockData class TestMockData (unittest.TestCase): def setUp(self): <|fim_middle|> def test_random_data(self): data = MockData() a_set = data.get_random_elements(10) ...
self.data = MockData()
<|file_name|>test_mockdata.py<|end_file_name|><|fim▁begin|>import unittest from src.data_structures.mockdata import MockData class TestMockData (unittest.TestCase): def setUp(self): self.data = MockData() def test_random_data(self): <|fim_middle|> if __name__ == '__main__': un...
data = MockData() a_set = data.get_random_elements(10) self.assertTrue(len(a_set) == 10, "the data should have 10 elements!")
<|file_name|>test_mockdata.py<|end_file_name|><|fim▁begin|>import unittest from src.data_structures.mockdata import MockData class TestMockData (unittest.TestCase): def setUp(self): self.data = MockData() def test_random_data(self): data = MockData() a_set = data.get_random_elements...
unittest.main()
<|file_name|>test_mockdata.py<|end_file_name|><|fim▁begin|>import unittest from src.data_structures.mockdata import MockData class TestMockData (unittest.TestCase): def <|fim_middle|>(self): self.data = MockData() def test_random_data(self): data = MockData() a_set = data.get_random...
setUp
<|file_name|>test_mockdata.py<|end_file_name|><|fim▁begin|>import unittest from src.data_structures.mockdata import MockData class TestMockData (unittest.TestCase): def setUp(self): self.data = MockData() def <|fim_middle|>(self): data = MockData() a_set = data.get_random_elements(1...
test_random_data
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>"""The ReCollect Waste integration.""" from __future__ import annotations from datetime import date, timedelta from aiorecollect.client import Client, PickupEvent from aiorecollect.errors import RecollectError from homeassistant.config_entries import ConfigEntry ...
coordinator = DataUpdateCoordinator(
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>"""The ReCollect Waste integration.""" from __future__ import annotations from datetime import date, timedelta from aiorecollect.client import Client, PickupEvent from aiorecollect.errors import RecollectError from homeassistant.config_entries import ConfigEntry ...
"""Set up RainMachine as config entry.""" session = aiohttp_client.async_get_clientsession(hass) client = Client( entry.data[CONF_PLACE_ID], entry.data[CONF_SERVICE_ID], session=session ) async def async_get_pickup_events() -> list[PickupEvent]: """Get the next pickup.""" tr...
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>"""The ReCollect Waste integration.""" from __future__ import annotations from datetime import date, timedelta from aiorecollect.client import Client, PickupEvent from aiorecollect.errors import RecollectError from homeassistant.config_entries import ConfigEntry ...
"""Get the next pickup.""" try: return await client.async_get_pickup_events( start_date=date.today(), end_date=date.today() + timedelta(weeks=4) ) except RecollectError as err: raise UpdateFailed( f"Error while requesting data f...
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>"""The ReCollect Waste integration.""" from __future__ import annotations from datetime import date, timedelta from aiorecollect.client import Client, PickupEvent from aiorecollect.errors import RecollectError from homeassistant.config_entries import ConfigEntry ...
"""Handle an options update.""" await hass.config_entries.async_reload(entry.entry_id)
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>"""The ReCollect Waste integration.""" from __future__ import annotations from datetime import date, timedelta from aiorecollect.client import Client, PickupEvent from aiorecollect.errors import RecollectError from homeassistant.config_entries import ConfigEntry ...
"""Unload an RainMachine config entry.""" unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS) if unload_ok: hass.data[DOMAIN].pop(entry.entry_id) return unload_ok
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>"""The ReCollect Waste integration.""" from __future__ import annotations from datetime import date, timedelta from aiorecollect.client import Client, PickupEvent from aiorecollect.errors import RecollectError from homeassistant.config_entries import ConfigEntry ...
hass.data[DOMAIN].pop(entry.entry_id)
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>"""The ReCollect Waste integration.""" from __future__ import annotations from datetime import date, timedelta from aiorecollect.client import Client, PickupEvent from aiorecollect.errors import RecollectError from homeassistant.config_entries import ConfigEntry ...
async_setup_entry
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>"""The ReCollect Waste integration.""" from __future__ import annotations from datetime import date, timedelta from aiorecollect.client import Client, PickupEvent from aiorecollect.errors import RecollectError from homeassistant.config_entries import ConfigEntry ...
async_get_pickup_events
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>"""The ReCollect Waste integration.""" from __future__ import annotations from datetime import date, timedelta from aiorecollect.client import Client, PickupEvent from aiorecollect.errors import RecollectError from homeassistant.config_entries import ConfigEntry ...
async_reload_entry
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>"""The ReCollect Waste integration.""" from __future__ import annotations from datetime import date, timedelta from aiorecollect.client import Client, PickupEvent from aiorecollect.errors import RecollectError from homeassistant.config_entries import ConfigEntry ...
async_unload_entry
<|file_name|>test.py<|end_file_name|><|fim▁begin|><|fim▁hole|>ghcnpy.intro() # Print Latest Version ghcnpy.get_ghcnd_version() # Testing Search Capabilities print("\nTESTING SEARCH CAPABILITIES") ghcnpy.find_station("Asheville") # Testing Search Capabilities print("\nTESTING PULL CAPABILITIES") outfile=ghcnpy.get_da...
import ghcnpy # Provide introduction
<|file_name|>apps.py<|end_file_name|><|fim▁begin|>from django.apps import AppConfig<|fim▁hole|> class CirculoConfig(AppConfig): name = 'circulo'<|fim▁end|>
<|file_name|>apps.py<|end_file_name|><|fim▁begin|>from django.apps import AppConfig class CirculoConfig(AppConfig): <|fim_middle|> <|fim▁end|>
name = 'circulo'
<|file_name|>doc_view_list.py<|end_file_name|><|fim▁begin|># -*- coding: utf8 -*- SQL = """select SQL_CALC_FOUND_ROWS * FROM doc_view order by `name` asc limit %(offset)d,%(limit)d ;""" FOUND_ROWS = True ROOT = "doc_view_list" ROOT_PREFIX = "<doc_view_edit />" ROOT_POSTFIX= None XSL_TEMPLATE = "data/af-web.xsl" EVENT =...
<|file_name|>check.py<|end_file_name|><|fim▁begin|>from importlib import import_module from inspect import getdoc def attribs(name): mod = import_module(name) print name print 'Has __all__?', hasattr(mod, '__all__') print 'Has __doc__?', hasattr(mod, '__doc__') print 'doc: ', getdoc(mod) if __...
'/home/ali/ws-pydev/apidocfilter/A/B/C', opt) print(a)
<|file_name|>check.py<|end_file_name|><|fim▁begin|>from importlib import import_module from inspect import getdoc def attribs(name): <|fim_middle|> if __name__=='__main__': attribs('cairo') attribs('zope') attribs('A.B.C') import hacked class Object(object): pass opt = O...
mod = import_module(name) print name print 'Has __all__?', hasattr(mod, '__all__') print 'Has __doc__?', hasattr(mod, '__doc__') print 'doc: ', getdoc(mod)
<|file_name|>check.py<|end_file_name|><|fim▁begin|>from importlib import import_module from inspect import getdoc def attribs(name): mod = import_module(name) print name print 'Has __all__?', hasattr(mod, '__all__') print 'Has __doc__?', hasattr(mod, '__doc__') print 'doc: ', getdoc(mod) if __...
pass
<|file_name|>check.py<|end_file_name|><|fim▁begin|>from importlib import import_module from inspect import getdoc def attribs(name): mod = import_module(name) print name print 'Has __all__?', hasattr(mod, '__all__') print 'Has __doc__?', hasattr(mod, '__doc__') print 'doc: ', getdoc(mod) if __...
attribs('cairo') attribs('zope') attribs('A.B.C') import hacked class Object(object): pass opt = Object() opt.ignore_errors = False a, d = hacked.get_all_attr_has_docstr('/home/ali/ws-pydev/apidocfilter/A/B', '/home/ali/ws-pydev...
<|file_name|>check.py<|end_file_name|><|fim▁begin|>from importlib import import_module from inspect import getdoc def <|fim_middle|>(name): mod = import_module(name) print name print 'Has __all__?', hasattr(mod, '__all__') print 'Has __doc__?', hasattr(mod, '__doc__') print 'doc: ', getdoc(mod)...
attribs
<|file_name|>xorg_driver.py<|end_file_name|><|fim▁begin|><|fim▁hole|><|fim▁end|>
../../../../share/pyshared/jockey/xorg_driver.py
<|file_name|>wwan_status.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ Display current network and ip address for newer Huwei modems. It is tested for Huawei E3276 (usb-id 12d1:1506) aka Telekom Speed Stick LTE III but may work on other devices, too. DEPENDENCIES: - netifaces - pyserial Configu...
<|file_name|>wwan_status.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ Display current network and ip address for newer Huwei modems. It is tested for Huawei E3276 (usb-id 12d1:1506) aka Telekom Speed Stick LTE III but may work on other devices, too. DEPENDENCIES: - netifaces - pyserial Configu...
baudrate = 115200 cache_timeout = 5 consider_3G_degraded = False format_down = 'WWAN: down' format_error = 'WWAN: {error}' format_no_service = 'WWAN: {status} {ip}' format_up = 'WWAN: {status} ({netgen}) {ip}' interface = "ppp0" modem = "/dev/ttyUSB1" modem_timeout = 0.4 def...
<|file_name|>wwan_status.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ Display current network and ip address for newer Huwei modems. It is tested for Huawei E3276 (usb-id 12d1:1506) aka Telekom Speed Stick LTE III but may work on other devices, too. DEPENDENCIES: - netifaces - pyserial Configu...
query = "AT^SYSINFOEX" target_line = "^SYSINFOEX" # Set up the highest network generation to display as degraded if self.consider_3G_degraded: degraded_netgen = 3 else: degraded_netgen = 2 response = {} response['cached_until'] = time() +...
<|file_name|>wwan_status.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ Display current network and ip address for newer Huwei modems. It is tested for Huawei E3276 (usb-id 12d1:1506) aka Telekom Speed Stick LTE III but may work on other devices, too. DEPENDENCIES: - netifaces - pyserial Configu...
""" Returns the interface's IPv4 address if device exists and has a valid ip address. Otherwise, returns an empty string """ if interface in ni.interfaces(): addresses = ni.ifaddresses(interface) if ni.AF_INET in addresses: return addresses...
<|file_name|>wwan_status.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ Display current network and ip address for newer Huwei modems. It is tested for Huawei E3276 (usb-id 12d1:1506) aka Telekom Speed Stick LTE III but may work on other devices, too. DEPENDENCIES: - netifaces - pyserial Configu...
degraded_netgen = 3
<|file_name|>wwan_status.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ Display current network and ip address for newer Huwei modems. It is tested for Huawei E3276 (usb-id 12d1:1506) aka Telekom Speed Stick LTE III but may work on other devices, too. DEPENDENCIES: - netifaces - pyserial Configu...
degraded_netgen = 2
<|file_name|>wwan_status.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ Display current network and ip address for newer Huwei modems. It is tested for Huawei E3276 (usb-id 12d1:1506) aka Telekom Speed Stick LTE III but may work on other devices, too. DEPENDENCIES: - netifaces - pyserial Configu...
print("Found modem " + self.modem) try: ser = serial.Serial( port=self.modem, baudrate=self.baudrate, # Values below work for my modem. Not sure if # they neccessarily work for all modems ...
<|file_name|>wwan_status.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ Display current network and ip address for newer Huwei modems. It is tested for Huawei E3276 (usb-id 12d1:1506) aka Telekom Speed Stick LTE III but may work on other devices, too. DEPENDENCIES: - netifaces - pyserial Configu...
ser.close()
<|file_name|>wwan_status.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ Display current network and ip address for newer Huwei modems. It is tested for Huawei E3276 (usb-id 12d1:1506) aka Telekom Speed Stick LTE III but may work on other devices, too. DEPENDENCIES: - netifaces - pyserial Configu...
ip = self._get_ip(self.interface) if not ip: ip = "no ip" modem_answer = line.split(',') netgen = len(modem_answer[-2]) + 1 netmode = modem_answer[-1].rstrip()[1:-1] if netmode...
<|file_name|>wwan_status.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ Display current network and ip address for newer Huwei modems. It is tested for Huawei E3276 (usb-id 12d1:1506) aka Telekom Speed Stick LTE III but may work on other devices, too. DEPENDENCIES: - netifaces - pyserial Configu...
ip = "no ip"
<|file_name|>wwan_status.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ Display current network and ip address for newer Huwei modems. It is tested for Huawei E3276 (usb-id 12d1:1506) aka Telekom Speed Stick LTE III but may work on other devices, too. DEPENDENCIES: - netifaces - pyserial Configu...
response['full_text'] = self.format_no_service.format( status=netmode, ip=ip) response['color'] = i3s_config['color_bad']
<|file_name|>wwan_status.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ Display current network and ip address for newer Huwei modems. It is tested for Huawei E3276 (usb-id 12d1:1506) aka Telekom Speed Stick LTE III but may work on other devices, too. DEPENDENCIES: - netifaces - pyserial Configu...
response['full_text'] = self.format_up.format( status=netmode, netgen=str(netgen) + "G", ip=ip) if netgen <= degraded_netgen: response['color'] = i3s_config['co...
<|file_name|>wwan_status.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ Display current network and ip address for newer Huwei modems. It is tested for Huawei E3276 (usb-id 12d1:1506) aka Telekom Speed Stick LTE III but may work on other devices, too. DEPENDENCIES: - netifaces - pyserial Configu...
response['color'] = i3s_config['color_degraded']
<|file_name|>wwan_status.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ Display current network and ip address for newer Huwei modems. It is tested for Huawei E3276 (usb-id 12d1:1506) aka Telekom Speed Stick LTE III but may work on other devices, too. DEPENDENCIES: - netifaces - pyserial Configu...
response['color'] = i3s_config['color_good']
<|file_name|>wwan_status.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ Display current network and ip address for newer Huwei modems. It is tested for Huawei E3276 (usb-id 12d1:1506) aka Telekom Speed Stick LTE III but may work on other devices, too. DEPENDENCIES: - netifaces - pyserial Configu...
response['color'] = i3s_config['color_bad'] response['full_text'] = self.format_error.format( error="unsupported modem")
<|file_name|>wwan_status.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ Display current network and ip address for newer Huwei modems. It is tested for Huawei E3276 (usb-id 12d1:1506) aka Telekom Speed Stick LTE III but may work on other devices, too. DEPENDENCIES: - netifaces - pyserial Configu...
pass
<|file_name|>wwan_status.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ Display current network and ip address for newer Huwei modems. It is tested for Huawei E3276 (usb-id 12d1:1506) aka Telekom Speed Stick LTE III but may work on other devices, too. DEPENDENCIES: - netifaces - pyserial Configu...
print(self.modem + " not found") response['color'] = i3s_config['color_bad'] response['full_text'] = self.format_down
<|file_name|>wwan_status.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ Display current network and ip address for newer Huwei modems. It is tested for Huawei E3276 (usb-id 12d1:1506) aka Telekom Speed Stick LTE III but may work on other devices, too. DEPENDENCIES: - netifaces - pyserial Configu...
addresses = ni.ifaddresses(interface) if ni.AF_INET in addresses: return addresses[ni.AF_INET][0]['addr']
<|file_name|>wwan_status.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ Display current network and ip address for newer Huwei modems. It is tested for Huawei E3276 (usb-id 12d1:1506) aka Telekom Speed Stick LTE III but may work on other devices, too. DEPENDENCIES: - netifaces - pyserial Configu...
return addresses[ni.AF_INET][0]['addr']
<|file_name|>wwan_status.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ Display current network and ip address for newer Huwei modems. It is tested for Huawei E3276 (usb-id 12d1:1506) aka Telekom Speed Stick LTE III but may work on other devices, too. DEPENDENCIES: - netifaces - pyserial Configu...
from time import sleep x = Py3status() config = { 'color_good': '#00FF00', 'color_bad': '#FF0000', 'color_degraded': '#FFFF00', } while True: print(x.wwan_status([], config)) sleep(1)
<|file_name|>wwan_status.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ Display current network and ip address for newer Huwei modems. It is tested for Huawei E3276 (usb-id 12d1:1506) aka Telekom Speed Stick LTE III but may work on other devices, too. DEPENDENCIES: - netifaces - pyserial Configu...
wwan_status
<|file_name|>wwan_status.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ Display current network and ip address for newer Huwei modems. It is tested for Huawei E3276 (usb-id 12d1:1506) aka Telekom Speed Stick LTE III but may work on other devices, too. DEPENDENCIES: - netifaces - pyserial Configu...
_get_ip
<|file_name|>config.py<|end_file_name|><|fim▁begin|>import os class Config(object): DEBUG = False TESTING = False CSRF_ENABLED = True SECRET_KEY = "super_secret_key" SQLALCHEMY_DATABASE_URI = os.environ['DATABASE_URL'] class ProductionConfig(Config): DEBUG = False SECRET_KEY = os.environ['...
class DevelopmentConfig(Config): DEVELOPMENT = True
<|file_name|>config.py<|end_file_name|><|fim▁begin|>import os class Config(object): <|fim_middle|> class ProductionConfig(Config): DEBUG = False SECRET_KEY = os.environ['SECRET_KEY'] class DevelopmentConfig(Config): DEVELOPMENT = True DEBUG = True class TestingConfig(Config): TESTING = True...
DEBUG = False TESTING = False CSRF_ENABLED = True SECRET_KEY = "super_secret_key" SQLALCHEMY_DATABASE_URI = os.environ['DATABASE_URL']
<|file_name|>config.py<|end_file_name|><|fim▁begin|>import os class Config(object): DEBUG = False TESTING = False CSRF_ENABLED = True SECRET_KEY = "super_secret_key" SQLALCHEMY_DATABASE_URI = os.environ['DATABASE_URL'] class ProductionConfig(Config): <|fim_middle|> class DevelopmentConfig(Co...
DEBUG = False SECRET_KEY = os.environ['SECRET_KEY']