| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 163b64f commit 39e75dc
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -53,8 +53,8 @@ def __init__(self, config, locals_, banner, interp=None): | |||
| 53 | 53 | pass # temp hack to get .original_stty | |
| 54 | 54 | ||
| 55 | 55 | super().__init__( | |
| 56 | + config, | ||
| 56 | 57 | locals_=locals_, | |
| 57 | - config=config, | ||
| 58 | 58 | banner=banner, | |
| 59 | 59 | interp=interp, | |
| 60 | 60 | orig_tcattrs=self.input_generator.original_stty, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -27,12 +27,7 @@ | |||
| 27 | 27 | import bpython | |
| 28 | 28 | from bpython.repl import Repl as BpythonRepl, SourceNotFound | |
| 29 | 29 | from bpython.repl import LineTypeTranslator as LineType | |
| 30 | - from bpython.config import ( | ||
| 31 | - Struct, | ||
| 32 | - loadini, | ||
| 33 | - default_config_path, | ||
| 34 | - getpreferredencoding, | ||
| 35 | - ) | ||
| 30 | + from bpython.config import getpreferredencoding, default_config_path | ||
| 36 | 31 | from bpython.formatter import BPythonFormatter | |
| 37 | 32 | from bpython import autocomplete | |
| 38 | 33 | from bpython.translations import _ | |
@@ -310,8 +305,8 @@ class BaseRepl(BpythonRepl): | |||
| 310 | 305 | ||
| 311 | 306 | def __init__( | |
| 312 | 307 | self, | |
| 308 | + config, | ||
| 313 | 309 | locals_=None, | |
| 314 | - config=None, | ||
| 315 | 310 | banner=None, | |
| 316 | 311 | interp=None, | |
| 317 | 312 | orig_tcattrs=None, | |
@@ -326,10 +321,6 @@ def __init__( | |||
| 326 | 321 | ||
| 327 | 322 | logger.debug("starting init") | |
| 328 | 323 | ||
| 329 | - if config is None: | ||
| 330 | - config = Struct() | ||
| 331 | - loadini(config, default_config_path()) | ||
| 332 | - | ||
| 333 | 324 | # If creating a new interpreter on undo would be unsafe because initial | |
| 334 | 325 | # state was passed in | |
| 335 | 326 | self.weak_rewind = bool(locals_ or interp) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -233,7 +233,7 @@ def captured_output(): | |||
| 233 | 233 | ||
| 234 | 234 | def create_repl(**kwargs): | |
| 235 | 235 | config = setup_config({"editor": "true"}) | |
| 236 | - repl = curtsiesrepl.BaseRepl(config=config, **kwargs) | ||
| 236 | + repl = curtsiesrepl.BaseRepl(config, **kwargs) | ||
| 237 | 237 | os.environ["PAGER"] = "true" | |
| 238 | 238 | os.environ.pop("PYTHONSTARTUP", None) | |
| 239 | 239 | repl.width = 50 | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -27,10 +27,11 @@ | |||
| 27 | 27 | import time | |
| 28 | 28 | import logging | |
| 29 | 29 | ||
| 30 | - from . import translations | ||
| 31 | - from .curtsiesfrontend import events as bpythonevents | ||
| 32 | - from .curtsiesfrontend.repl import BaseRepl | ||
| 33 | - from .importcompletion import ModuleGatherer | ||
| 30 | + from bpython import translations | ||
| 31 | + from bpython.config import Struct, loadini, default_config_path | ||
| 32 | + from bpython.curtsiesfrontend import events as bpythonevents | ||
| 33 | + from bpython.curtsiesfrontend.repl import BaseRepl | ||
| 34 | + from bpython.importcompletion import ModuleGatherer | ||
| 34 | 35 | ||
| 35 | 36 | from curtsies.configfile_keynames import keymap as key_dispatch | |
| 36 | 37 | ||
@@ -39,9 +40,9 @@ | |||
| 39 | 40 | ||
| 40 | 41 | ||
| 41 | 42 | class SimpleRepl(BaseRepl): | |
| 42 | - def __init__(self): | ||
| 43 | + def __init__(self, config): | ||
| 43 | 44 | self.requested_events = [] | |
| 44 | - BaseRepl.__init__(self) | ||
| 45 | + BaseRepl.__init__(self, config) | ||
| 45 | 46 | ||
| 46 | 47 | def _request_refresh(self): | |
| 47 | 48 | self.requested_events.append(bpythonevents.RefreshRequestEvent()) | |
@@ -116,10 +117,12 @@ def get_input(self): | |||
| 116 | 117 | ||
| 117 | 118 | def main(args=None, locals_=None, banner=None): | |
| 118 | 119 | translations.init() | |
| 120 | + config = Struct() | ||
| 121 | + loadini(config, default_config_path()) | ||
| 119 | 122 | module_gatherer = ModuleGatherer() | |
| 120 | 123 | while module_gatherer.find_coroutine(): | |
| 121 | 124 | pass | |
| 122 | - with SimpleRepl() as r: | ||
| 125 | + with SimpleRepl(config) as r: | ||
| 123 | 126 | r.width = 50 | |
| 124 | 127 | r.height = 10 | |
| 125 | 128 | while True: | |
| Back | FazBrowse Home | New Git URL |
0 commit comments