コード例 #1
0
ファイル: tree_manager.py プロジェクト: LeslieHor/woof-tile
    def initialise_workspaces(self):
        for workspace_config in config.get_config('workspace_config'):
            (name, geometry) = workspace_config
            if geometry is not None:
                new_workspace = Workspace(name=name,
                                          geometry=geometry,
                                          state=SCREEN_STATE.ACTIVE)
                self.viewable_screen_count += 1
            else:
                new_workspace = Workspace(name=name)

            self.add_child(new_workspace)

        self.update_active_workspaces_statuses()
コード例 #2
0
    def run(self):
        config = self._decode_config()
        self._print_debug('[cppcheck] config: {}'.format(config))

        workspace = Workspace(config.get('include_paths'))
        workspace_files = workspace.calculate()

        if not len(workspace_files) > 0:
            return

        self._print_debug('[cppcheck] analyzing {} files'.format(
            len(workspace_files)))

        file_list_path = self._build_file_list(workspace_files)
        plugin_config = config.get('config', {})
        command = Command(plugin_config, file_list_path).build()

        self._print_debug('[cppcheck] command: {}'.format(command))

        results = self._run_command(command)
        issues = self._parse_results(results)

        for issue in issues:
            # cppcheck will emit issues for files outside of the workspace,
            # like header files. This ensures that we only emit issues for
            # files in the workspace.
            if issue and workspace.should_include(issue["location"]["path"]):
                print('{}\0'.format(json.dumps(issue)))
コード例 #3
0
ファイル: server.py プロジェクト: tinlun/flangd
    def on_initialize(self, params):
        self.root_uri = params['rootUri']
        self.workspace = Workspace(self.root_uri, self.f18_path, self.f18_args)
        return {
            'capabilities': {
                'textDocumentSync': {
                    'openClose': True,
                    'change': 1,
                    'save': {
                        'includeText': True
                    },
                },
                'definitionProvider': True,
                'documentSymbolProvider': True,
                # 'completionProvider': {
                #    'resolveProvider': False,
                #    'triggerCharacters': ['%']
                # },

                # 'referencesProvider': True,
                # 'hoverProvider': True,
                # 'implementationProvider': True,
                # 'renameProvider': True,
                # 'workspaceSymbolProvider': True,
            }
        }
コード例 #4
0
def test_add_project_to_workspace_oneProject():
    project = Project("New project",
                      JSON={
                          'name': "New project in JSON",
                          'created': "10/31/2019",
                          'edited': "10/31/2019",
                          'description':
                          "filler description for testing purposes",
                          'protocol': "UDP",
                          'change_protocol': "TCP",
                          'src_port': "1234",
                          'dst_port': "8080",
                          'author': "author1",
                          'path': "",
                          'dissector': ""
                      })

    workspace = Workspace("New Workspace",
                          JSON={
                              'name': "New Workspace",
                              'projects': {},
                              'created': "10/31/2019",
                              'edited': "10/31/2019",
                              'path': 'path'
                          })

    workspace.add_project_to_workspace(project)
    test_json = workspace.get_json()

    assert test_json['projects'][0] == project
    assert workspace.projects[0] == project
コード例 #5
0
ファイル: tree_manager.py プロジェクト: LeslieHor/woof-tile
    def add_workspace(self, name=None):
        if name is None:
            name = self.get_new_index()

        new_workspace = Workspace(name=name)
        self.add_child(new_workspace)
        return new_workspace
コード例 #6
0
ファイル: case.py プロジェクト: evaseemefly/gsconfig
def create_nc_coverage_merage_resource():
    '''
        # NOTE: 尝试将创建 nc coverage 使用 -> resource.py -> Coverage 的方式实现
        # TODO:[-] 20-03-23
    '''
    coverage_title = 'ceshi_coverage_01'
    # TODO:[*] 20-03-24 注意此处会引发严重bug,在指定 工作区 下若不存在指定的 store 会出现 错误
    store_name = 'nmefc_2016072112_opdr'
    coverage_store = 'nmefc_wind'
    layer_name = 'ceshi_coverage_01'
    work_space = 'my_test_2'
    cat: Catalog = Catalog("http://localhost:8082/geoserver/rest",
                           username="******",
                           password="******")
    ws = Workspace(cat, work_space)
    store = CoverageStore(cat, ws, 'nmefc_wind_dir_xy')

    # layer = CoverageLayer(cat, 'ceshi_name', 'ceshi_native_name', 'ceshi_tile', 'ceshi_native_coveragename')
    # coverage = Coverage(cat, ws, store, 'view_nmefc_wind')

    # TODO:[-] 20-03-24 使用 -> customer_layer -> CoverageLayer
    # coverage = CoverageLayer(cat, WORK_SPACE)
    # coverage.create_layer(coverage_title, store_name, [dict(name='x_wind_10m'), dict(name='y_wind_10m')])
    bands = [dict(name='x_wind_10m'), dict(name='y_wind_10m')]
    coverage_layer = CoverageLayer(cat, work_space, store_name)
    # TODO:[*] 20-03-24 此处若使用 layer_name:ceshi_coverage_01 而不使用 coverage_store:nmefc_wind 则会引发 msg 的bug
    coverage_layer.publish(layer_name, bands)
    pass
コード例 #7
0
 def init_workspace_and_projects(self):
     """Initializes Workspace and ProjectsManager."""
     assert self._projects is None
     assert self._workspace is None
     self._workspace = Workspace(factory=self)
     self._projects = ProjectsManager(factory=self)
     self._projects.init_workspace()
コード例 #8
0
def test_create_workspace_firstparam():
    workspace = Workspace("New Workspace")
    assert workspace.name == "New Workspace"
    assert workspace.JSON['name'] == None
    assert workspace.JSON['projects'] == {}
    assert workspace.JSON['created'] == None
    assert workspace.JSON['edited'] == None
    assert workspace.JSON['path'] == None
コード例 #9
0
ファイル: server.py プロジェクト: Kramin42/Corespec
async def set_workspace(ws, workspace_name):
    global workspace
    workspace = Workspace(workspace_name)
    await ws.send(
        json.dumps({
            'type': 'message',
            'message': 'Switched to workspace %s.' % workspace.name
        }))
コード例 #10
0
    def __init__(self):
        self.viewable_screen_count = 0
        self.last_active_window_id = None
        self.workspaces = []

        for workspace_config in config.WORKSPACE_CONFIG:
            (name, geometry) = workspace_config
            if geometry is not None:
                new_workspace = Workspace(self, name, geometry,
                                          SCREEN_STATE.ACTIVE)
                self.viewable_screen_count += 1
            else:
                new_workspace = Workspace(self, name)

            self.workspaces.append(new_workspace)

        self.update_active_workspaces_statuses()
コード例 #11
0
def test_create_workspace_without_params():
    workspace = Workspace()
    assert workspace.name == None
    assert workspace.JSON['name'] == None
    assert workspace.JSON['projects'] == {}
    assert workspace.JSON['created'] == None
    assert workspace.JSON['edited'] == None
    assert workspace.JSON['path'] == None
コード例 #12
0
ファイル: executor.py プロジェクト: johnjohnsp1/manticore
    def __init__(self,
                 initial=None,
                 workspace='',
                 policy='random',
                 context=None,
                 **options):
        # Signals / Callbacks handlers will be invoked potentially at different
        # worker processes. State provides a local context to save data.

        #Executor signals
        self.will_start_run = Signal()
        self.will_finish_run = Signal()
        self.will_fork_state = Signal()
        self.will_store_state = Signal()
        self.will_load_state = Signal()
        self.will_terminate_state = Signal()
        self.will_generate_testcase = Signal()

        #Be sure every state will forward us their signals
        self.will_load_state += self._register_state_callbacks

        #The main executor lock. Acquire this for accessing shared objects
        self._lock = manager.Condition(manager.RLock())

        #Shutdown Event
        self._shutdown = manager.Event()

        #States on storage. Shared dict state name ->  state stats
        self._states = manager.list()

        #Number of currently running workers. Initially no runnign workers
        self._running = manager.Value('i', 0)

        self._workspace = Workspace(self._lock, workspace)

        #Executor wide shared context
        if context is None:
            context = {}
        self._shared_context = manager.dict(context)

        #scheduling priority policy (wip)
        self.policy = Random()

        if self.load_workspace():
            if initial is not None:
                logger.error("Ignoring initial state")
            # We loaded state ids, now load the actual state

            current_state_id = self.get()
            initial = self._workspace.load_state(current_state_id)
            self._register_state_callbacks(initial, current_state_id)

        self.add(initial)
        ##FIXME PUBSUB  We need to forward signals here so they get declared
        ##forward signals from initial state so they are declared here
        self._register_state_callbacks(initial, 0)  # id param unused
コード例 #13
0
def test_add_project_to_workspace_float():
    workspace = Workspace("New Workspace",
                          JSON={
                              'name': "New Workspace",
                              'projects': {},
                              'created': "10/31/2019",
                              'edited': "10/31/2019",
                              'path': 'path'
                          })

    assert workspace.add_project_to_workspace(1.0) == None
コード例 #14
0
ファイル: capricorn.py プロジェクト: oliverjakobs/capricorn
 def load_workspace(self, location) -> bool:
     try:
         self.workspace = Workspace(self, location, self.token, style=self.style, orient=tk.HORIZONTAL)
         self.workspace.grid(row=0, column=0, sticky=tk.NSEW)
         return True
     except FileNotFoundError:
         print("Directory: {0} does not exist".format(location))
     except NotADirectoryError:
         print("{0} is not a directory".format(location))
     except PermissionError:
         print("You do not have permissions to change to {0}".format(location))
コード例 #15
0
def test_add_project_to_workspace_string():
    workspace = Workspace("New Workspace",
                          JSON={
                              'name': "New Workspace",
                              'projects': {},
                              'created': "10/31/2019",
                              'edited': "10/31/2019",
                              'path': 'path'
                          })

    assert workspace.add_project_to_workspace("random string") == None
コード例 #16
0
def demo():
    root = tkinter.Tk()
    root.title("Motion Planning")
    universal_height = 1000

    nb = ttk.Notebook(root)
    page1 = ttk.Frame(nb, width= 1080,height = universal_height)
    page2 = ttk.Frame(nb,width = 1080,height = universal_height)

    nb.add(page1, text='Workspace')
    nb.add(page2, text='Configspace')
    nb.grid(column=0)
 
    workspace = Workspace("./resources/robot_BW_small.bmp", "./resources/Room_BW_small.bmp", page1)
    configspace = Configspace(page2)
    controller = Controller(workspace,configspace)


    workspace.drawAll(workspace.currentPos[0],workspace.currentPos[1])
    def callback(event):
        # print ("clicked at", event.x, event.y)
        controller.drawMouseOffSet(event.x, event.y)
        if controller.isInCollision(): setBackgroundColor(page1,"red")
        else: setBackgroundColor(page1,"green")

    workspace.label.bind("<Button-1>", callback)

    def moveRobotOnPath(val):
        if controller.isAllInitialized():
            controller.setSolutionPathOnCurrentPos(int(val))
            controller.drawCurrentPos()
            if controller.isInCollision(): setBackgroundColor(page1,"red")
            else: setBackgroundColor(page1,"green")

    slider = Scale(page1, from_=0, to=200, orient=HORIZONTAL, command=moveRobotOnPath)
    slider.config(length=600)
    
    def set_goal():
        controller.setCurrentPosAsGoal()
        slider['from_'] = 0
        slider['to_'] = len(configspace.solutionPath)-1

    setGoalButton = ttk.Button(page1, text = 'Set Goal',command = set_goal)
    setGoalButton.pack(side=tkinter.RIGHT)

    def set_init():
        controller.setCurrentPosAsInit()
    setInitButton = ttk.Button(page1, text = 'Set Init',command = set_init)
    setInitButton.pack(side=tkinter.RIGHT)

    slider.pack()

    root.mainloop()
コード例 #17
0
 def workspace_report(self, args):
     """
     Reports the relevant information for the iRODS workspace.  Export and event history can be limited by
     start and end dates.  The end date is extended 1 day since the end date alone is not inclusive.
     :param args: optional start and end dates
     """
     start_date = args.start_date
     end_date = args.end_date + datetime.timedelta(days=1)
     show_dataset_owners = args.show_dataset_owners
     workspace = Workspace(dashboard=self,
                           start_date=start_date,
                           end_date=end_date)
     workspace.display(show_dataset_owners)
コード例 #18
0
ファイル: compose.py プロジェクト: ZoomFoundry/pub-charms
    def __init__(self, workspace, strict=True):
        '''
        Object to manage working with Docker-Compose on the CLI. exposes
        a natural language for performing common tasks with docker in
        juju charms.

        @param workspace - Define the CWD for docker-compose execution

        @param strict - Enable/disable workspace validation
        '''
        self.workspace = Workspace(workspace)
        if strict:
            self.workspace.validate()
コード例 #19
0
    def _move(self, direction, value):
        """ Moves object into direction by value. """

        for view in Workspace().get3DView():
            offset = Vector((0.0, 0.0, 0.0))
            if direction == "horizontal":
                offset.x = value
            elif direction == "vertical":
                offset.y = value
            elif direction == "straightforward":
                offset.z = value

            bpy.context.scene.objects.active.location \
             = view.view_rotation*offset + bpy.context.scene.objects.active.location
コード例 #20
0
def test_create_workspace_allparams():
    workspace = Workspace("New Workspace",
                          JSON={
                              'name': "New Workspace",
                              'projects': {},
                              'created': "10/31/2019",
                              'edited': "10/31/2019",
                              'path': 'path'
                          })
    assert workspace.name == "New Workspace"
    assert workspace.JSON['projects'] == {}
    assert workspace.JSON['created'] == "10/31/2019"
    assert workspace.JSON['edited'] == "10/31/2019"
    assert workspace.JSON['path'] == 'path'
コード例 #21
0
def test_create_workspace_secondparam():
    workspace = Workspace(None,
                          JSON={
                              'name': "New Workspace in JSON",
                              'projects': {},
                              'created': "10/31/2019",
                              'edited': "10/31/2019",
                              'path': 'path'
                          })
    assert workspace.name == "New Workspace in JSON"
    assert workspace.JSON['name'] == "New Workspace in JSON"
    assert workspace.JSON['projects'] == {}
    assert workspace.JSON['created'] == "10/31/2019"
    assert workspace.JSON['edited'] == "10/31/2019"
    assert workspace.JSON['path'] == 'path'
コード例 #22
0
    def __init__(self,
                 initial=None,
                 workspace=None,
                 policy='random',
                 context=None,
                 **kwargs):
        super(Executor, self).__init__(**kwargs)

        # Signals / Callbacks handlers will be invoked potentially at different
        # worker processes. State provides a local context to save data.

        self.subscribe('did_load_state', self._register_state_callbacks)

        # The main executor lock. Acquire this for accessing shared objects
        self._lock = manager.Condition(manager.RLock())

        # Shutdown Event
        self._shutdown = manager.Event()

        # States on storage. Shared dict state name ->  state stats
        self._states = manager.list()

        # Number of currently running workers. Initially no running workers
        self._running = manager.Value('i', 0)

        self._workspace = Workspace(self._lock, workspace)

        # Executor wide shared context
        if context is None:
            context = {}
        self._shared_context = manager.dict(context)

        #scheduling priority policy (wip)
        #Set policy
        policies = {
            'random': Random,
            'uncovered': Uncovered,
            'branchlimited': BranchLimited,
        }
        self._policy = policies[policy](self)
        assert isinstance(self._policy, Policy)

        if self.load_workspace():
            if initial is not None:
                logger.error("Ignoring initial state")
        else:
            if initial is not None:
                self.add(initial)
コード例 #23
0
    def explore(self, path):
        try:
            os.chdir(path)
        except IOError:
            print "There is no such directory"

        for root, dirnames, filenames in os.walk(os.getcwd()):
            for dirname in fnmatch.filter(dirnames, "*.xcworkspace"):
                os.chdir(dirname)
                path = os.path.abspath("contents.xcworkspacedata")
                w = Workspace(path)
                projects = w.projects
                self.workspaces.append(w)

        if self.workspaces.count == 0:
            pass
コード例 #24
0
    def on_click_launch(self):
        dir = self.entry_path.get()

        # Create workspace
        name = os.path.basename(dir)
        workspace = Workspace(name)

        # Read all the projects
        for filename in os.listdir(dir):
            if filename.endswith(".xml"):
                # Open XML and create a project
                xml = None
                p = Project.load_from_xml(xml)
                if p is not None:
                    workspace.projects.append(p)

        Workspace.current = workspace
コード例 #25
0
def test_get_json():
    workspace = Workspace(None,
                          JSON={
                              'name': "New Workspace in JSON",
                              'projects': {},
                              'created': "10/31/2019",
                              'edited': "10/31/2019",
                              'path': 'path'
                          })
    assert workspace.name == "New Workspace in JSON"

    test_json = workspace.get_json()
    assert test_json['name'] == "New Workspace in JSON"
    assert test_json['projects'] == {}
    assert test_json['created'] == "10/31/2019"
    assert test_json['edited'] == "10/31/2019"
    assert test_json['path'] == 'path'
コード例 #26
0
ファイル: user.py プロジェクト: VEuPathDB/ApiCommonModel
 def display_properites(self):
     """
     Convenience method to handle a key : value display of user properties.  The iRODS system contains only user
     wdk ids.  Full names and email addresses are gleaned from the account db.
     """
     print("\nPROPERTIES")
     properties_table = PrettyTable(["Property", "Value"])
     properties_table.align = "l"
     properties_table.add_row(["User Info", self.formatted_user()])
     if self.datasets:
         total_size = reduce(lambda acc, value: acc + value, [dataset.size for dataset in self.datasets])/1E6
     else:
         total_size = 0
     properties_table.add_row(["Usage", str(total_size) + " Mb"])
     quota = float(Workspace(dashboard=self.dashboard).get_default_quota())
     properties_table.add_row(["% Quota Used", round(100 * total_size/quota, 1)])
     print(properties_table)
コード例 #27
0
ファイル: polyengine.py プロジェクト: alfonmga/polyengine
    def start(self):
        # Script statup steps
        logger.info('PolyEngine v1.0')
        config = Config('config.ini')

        project_name = config.check_setting('PolyEngine', 'Name')
        logger.info('Starting project {}', project_name)

        message = config.check_setting('PolyEngine', 'Message')
        logger.info(message)

        # Source directory of project based on config file
        source_directory = config.check_setting('Compile', 'SourceDirectory')

        # Create the temporary code modification workspace
        workspace = Workspace(source_directory)
        workspace.create_workspace()

        # Process the files
        for f in workspace.source_files:
            if f is not None:
                processor = Processing(f)
                processor.process()

        for f in workspace.header_files:
            if f is not None:
                processor = Processing(f)
                processor.process()

        # Initialize the compiler once information has been loaded
        output_file = config.check_setting('Compile', 'Output')
        commands = config.check_setting('Compile', 'Commands')
        compiler_option = config.check_setting('Compile', 'Compiler')

        if compiler_option == 'gcc' or compiler_option == 'g++':
            compiler = Compile(compiler_option, workspace.source_files,
                               commands, output_file)
            compiler.compile()
        else:
            logger.error('Invalid compiler option selected.')
            exit('Invalid compiler.')

        # Cleanup workspace and exit
        print()
        Cleanup.clean_exit(workspace.work_path)
コード例 #28
0
ファイル: __init__.py プロジェクト: codeaudit/copycat
    def __init__(self, run):
        super(Window, self).__init__(1024, 600, caption="Copycat", vsync=False)
        glEnable(GL_BLEND)
        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)

        self.clock = pyglet.clock.ClockDisplay()
        self.show_fps = False

        self.done = False
        self.time = 0
        self.speed = 15
        self.playing = False

        self.run = run

        background = pyglet.resource.image("blackboard.png")
        self.background = pyglet.sprite.Sprite(background)
        self.saved_temp = 0
        self.batch = pyglet.graphics.Batch()

        self.play = pyglet.resource.image("play.png")
        self.pause = pyglet.resource.image("pause.png")
        self.play.anchor_x = self.play.width / 2.0
        self.play.anchor_y = self.play.height / 2.0
        self.pause.anchor_x = self.pause.width / 2.0
        self.pause.anchor_y = self.pause.height / 2.0
        self.button = Button(self.play, 30, 580,
                             self.on_play_button, self.batch)

        self.timer = pyglet.text.Label("0", "EraserDust", 18, x=512, y=574,
                                       color=(255,255,255, 125), batch=self.batch,
                                       halign="center", anchor_x="center")

        self.rule = pyglet.text.Label("", "EraserDust", 16, x=512, y=445,
                                      color=(255,255,255, 190), batch=self.batch,
                                      halign="center", anchor_x="center")

        self.slipnet = Slipnet(self.run.slipnet, 0, 0, 512, 300, self.batch)
        self.coderack = Coderack(self.run.coderack, 512, 0, 512, 300, self.batch)
        self.workspace = Workspace(self.run.workspace, 0, 300, 1024, 300, self.batch)

        pyglet.clock.schedule(self.update)
コード例 #29
0
ファイル: rccomp.py プロジェクト: vkrm1612/robocomp
def main():
    parser = argparse.ArgumentParser(
        description="provides various info about components/workspaces")
    parser.add_argument('argument', nargs='?', choices=['list', 'listws'])

    argcomplete.autocomplete(parser)
    args = parser.parse_args()
    ws = Workspace()

    if args.argument == 'list':
        try:
            ws.list_workspaces()
        except KeyboardInterrupt:
            print("\nCanceled")

    elif args.argument == 'listws':

        print("Registered workspaces are :")
        for workspace in ws.workspace_paths:
            print(f"\t{workspace}")
    else:
        parser.error("sorry no such option is available ")
コード例 #30
0
def post_install():
    auth_code = request.args['code']    

    sc = SlackClient("")

    auth_response = sc.api_call(
        "oauth.access", 
        client_id=client_id,
        client_secret=client_secret,
        code=auth_code
    )
    
    workspace_access_token = auth_response['access_token']
    workspace_bot_token = auth_response['bot']['bot_access_token']

    # Add team to database   
    workspace = Workspace(name =auth_response['team_name'], url = 'slack.com', access_token = workspace_access_token, bot_token = workspace_bot_token, team_id = auth_response['team_id'])
    workspace.save()

    # Disable reload for now
    # Reload listeners
    # andrew.loadRtm(workspace)
    return 'success', 200