Skip to content

Commit

Permalink
Switch farg_flags to farg.flags to fix bug in batch mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew D committed Feb 9, 2017
1 parent 61ae4b0 commit 88caad2
Show file tree
Hide file tree
Showing 27 changed files with 29 additions and 30 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ seqsee.main
*~
build
*.egg-info
.vscode/
2 changes: 1 addition & 1 deletion data/pyseqsee_app_template/batch_ui.py_tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ order to automatically answer questions such as the one above.).
from farg.core.ui.batch_ui import BatchUI

# If you need access to flags, you need:
# import farg_flags
# import farg.flags as farg_flags
# # The flag --foo is available at farg_flags.FargFlags.foo

class {application_class}BatchUI(BatchUI):
Expand Down
2 changes: 1 addition & 1 deletion data/pyseqsee_app_template/controller.py_tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ from farg.core.ltm.manager import LTMManager
import sys

# If you need access to flags, you need:
# import farg_flags
# import farg.flags as farg_flags
# # The flag --foo is available at farg_flags.FargFlags.foo

kLTMName = '{application_name}.main'
Expand Down
2 changes: 1 addition & 1 deletion data/pyseqsee_app_template/run_{application_name}.py_tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ from farg.apps.{application_name}.read_input_spec import {application_class}Read
from farg.apps.{application_name}.stopping_conditions import {application_class}StoppingConditions
from farg.core.main import Main
import sys
import farg_flags
import farg.flags as farg_flags

{application_name}_parser = argparse.ArgumentParser(parents=[farg_flags.core_parser])
# Flags for specifying the input and, for use in testing, expected output.
Expand Down
6 changes: 3 additions & 3 deletions docs/howto/flags.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Where the flags are defined
Core flags are defined in 'farg_flags.py', which defines the flags parser called 'core_parser'. The
entry point for each app extends this. Currently, in Seqsee (run_seqsee.py), we see::

import farg_flags
import farg.flags as farg_flags
seqsee_parser = argparse.ArgumentParser(parents=[farg_flags.core_parser])
seqsee_parser.add_argument('--sequence', type=int, nargs='*')

Expand Down Expand Up @@ -39,7 +39,7 @@ The entry point of apps
To summerize, here are the relevant bits of the Seqsee app's entry point::

import argparse
import farg_flags
import farg.flags as farg_flags
from farg.core.main import Main
seqsee_parser = argparse.ArgumentParser(parents=[farg_flags.core_parser])
Expand All @@ -64,7 +64,7 @@ Where the flags get stored
Flags, after processing, end up both in Main.flags and farg_flags.FargFlags. Other modules will use
this latter route for accessing. A module may say::

import farg_flags
import farg.flags as farg_flags
if farg_flags.FargFlags.use_stored_ltm:
Do something

2 changes: 1 addition & 1 deletion docs/new_app/add_input_flags.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Accessing flags from other files
These flags will be needed in other parts of the app. In any file needing them, add the following
lines::

import farg_flags
import farg.flags as farg_flags

# later...
farg_flags.FargFlags.left
2 changes: 1 addition & 1 deletion docs/new_app/update_workspace.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ This is how the BongardController class currently looks::
We will make a couple of changes for now. First, we will make the flags accessible from this file::

import farg_flags
import farg.flags as farg_flags
And we will update the workspace with the relevant inputs::

Expand Down
2 changes: 1 addition & 1 deletion farg/apps/bongard/batch_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from farg.core.ui.batch_ui import BatchUI

# If you need access to flags, you need:
# import farg_flags
# import farg.flags as farg_flags
# # The flag --foo is available at farg_flags.FargFlags.foo

class BongardBatchUI(BatchUI):
Expand Down
2 changes: 1 addition & 1 deletion farg/apps/bongard/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from farg.core.ltm.manager import LTMManager
import sys

import farg_flags
import farg.flags as farg_flags

kLTMName = 'bongard.main'

Expand Down
2 changes: 1 addition & 1 deletion farg/apps/bongard/run_bongard.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from farg.apps.bongard.stopping_conditions import BongardStoppingConditions
from farg.core.main import Main
import sys
import farg_flags
import farg.flags as farg_flags

bongard_parser = argparse.ArgumentParser(parents=[farg_flags.core_parser])
# Flags for specifying the input and, for use in testing, expected output.
Expand Down
2 changes: 1 addition & 1 deletion farg/apps/seqsee/batch_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from farg.core.exceptions import SuccessfulCompletion
from farg.core.ui.batch_ui import BatchUI
import sys
import farg_flags
import farg.flags as farg_flags

def HasAsPrefix(longer_list, shorter_list):
return longer_list[:len(shorter_list)] == shorter_list
Expand Down
2 changes: 1 addition & 1 deletion farg/apps/seqsee/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import logging
import sys

import farg_flags
import farg.flags as farg_flags

kLTMName = 'seqsee.main'

Expand Down
2 changes: 1 addition & 1 deletion farg/apps/seqsee/relation.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from farg.core.util import SelectWeightedByActivation
from farg.core.codelet import Codelet
from farg.core.focusable_mixin import FocusableMixin
import farg_flags
import farg.flags as farg_flags
from farg.core.history import History, ObjectType

"""A relation is a specific instance of a mapping."""
Expand Down
2 changes: 1 addition & 1 deletion farg/apps/seqsee/run_seqsee.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from farg.apps.seqsee.read_input_spec import SeqseeReadInputSpec
from farg.apps.seqsee.stopping_conditions import SeqseeStoppingConditions
from farg.core.main import Main
import farg_flags
import farg.flags as farg_flags
import sys

seqsee_parser = argparse.ArgumentParser(parents=[farg_flags.core_parser])
Expand Down
2 changes: 1 addition & 1 deletion farg/apps/seqsee/subspaces/are_we_done.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# You should have received a copy of the GNU General Public License along with this
# program. If not, see <http://www.gnu.org/licenses/>
from farg.core.subspace import Subspace, QuickReconnResults
import farg_flags
import farg.flags as farg_flags

class SubspaceAreWeDone(Subspace):
"""Checks if we should stop because we have found or explained the answer.
Expand Down
2 changes: 1 addition & 1 deletion farg/apps/seqsee/subspaces/get_mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

from farg.apps.seqsee.sobject import SGroup
import sys
import farg_flags
import farg.flags as farg_flags

# TODO(#53 --- Dec 29, 2011): Needs big fat documentation.

Expand Down
2 changes: 1 addition & 1 deletion farg/core/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from farg.core.stream import Stream
from farg.core.util import Toss

import farg_flags
import farg.flags as farg_flags

class Controller:
"""Purely mechanical (read "dumb") loop to control entire app or individual subspaces.
Expand Down
6 changes: 2 additions & 4 deletions farg/core/ltm/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,10 @@
"""Manages the set of LTMs."""

import logging

from farg.core.ltm.graph import LTMGraph
import os.path
import sys

import farg_flags
from farg.core.ltm.graph import LTMGraph
import farg.flags as farg_flags

kLogger = logging.getLogger("LTM")

Expand Down
2 changes: 1 addition & 1 deletion farg/core/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import logging.config
import os.path
import sys
import farg_flags
import farg.flags as farg_flags

class Main:
"""The Base class for the Main class of an application.
Expand Down
2 changes: 1 addition & 1 deletion farg/core/run_mode/batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# program. If not, see <http://www.gnu.org/licenses/>

from collections import defaultdict
import farg_flags
import farg.flags as farg_flags
from farg.core.run_mode.non_interactive import RunModeNonInteractive, RunMultipleTimes, MultipleRunGUI
from farg.core.run_stats import RunStats
import os.path
Expand Down
2 changes: 1 addition & 1 deletion farg/core/run_mode/non_interactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import subprocess
import sys
import threading
import farg_flags
import farg.flags as farg_flags

class RunMultipleTimes(threading.Thread, metaclass=ABCMeta):
"""Class to run the application several times on a set of inputs.
Expand Down
2 changes: 1 addition & 1 deletion farg/core/run_mode/single.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from farg.core.run_mode.non_interactive import RunModeNonInteractive
from io import StringIO
import sys
import farg_flags
import farg.flags as farg_flags


class RunModeSingle(RunModeNonInteractive):
Expand Down
2 changes: 1 addition & 1 deletion farg/core/run_mode/sxs.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from farg.core.run_mode.non_interactive import (RunModeNonInteractive, RunMultipleTimes,
MultipleRunGUI)
import sys
import farg_flags
import farg.flags as farg_flags

class SxSRunMultipleTimes(RunMultipleTimes):
"""Multiple-runner specialized for SxS."""
Expand Down
2 changes: 1 addition & 1 deletion farg/core/ui/batch_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# program. If not, see <http://www.gnu.org/licenses/>

from farg.core.ltm.manager import LTMManager
import farg_flags
import farg.flags as farg_flags

class BatchUI:
def __init__(self, *, controller_class, stopping_condition_fn=None):
Expand Down
2 changes: 1 addition & 1 deletion farg/core/ui/gui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from tkinter.messagebox import askyesno, showinfo
import logging
import threading
import farg_flags
import farg.flags as farg_flags

class RunForNSteps(threading.Thread):
"""Runs controller for up to n steps.
Expand Down
2 changes: 1 addition & 1 deletion farg/core/ui/gui/central_pane.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
Each view is an instance of a subclass of :py:class:`~farg.core.ui.gui.views.viewport.ViewPort`.
"""
import farg_flags
import farg.flags as farg_flags
import sys
from tkinter import ALL, Canvas, Menu

Expand Down
File renamed without changes.

0 comments on commit 88caad2

Please sign in to comment.