Change all Movie objects into Work objects, and their associated
    data into WorkRole and WorkSelection models, then delete the Movie.
551603
def forwards(apps, schema_editor):
    
    Movie = apps.get_model('spectator_events', 'Movie')
    Work = apps.get_model('spectator_events', 'Work')
    WorkRole = apps.get_model('spectator_events', 'WorkRole')
    WorkSelection = apps.get_model('spectator_events', 'WorkSelection')

    for m in Movie.objects.all():

        work = Work.objects.create(
            kind='movie',
            title=m.title,
            title_sort=m.title_sort,
            year=m.year,
            imdb_id=m.imdb_id
        )

        for role in m.roles.all():
            WorkRole.objects.create(
                creator=role.creator,
                work=work,
                role_name=role.role_name,
                role_order=role.role_order
            )

        for selection in m.events.all():
            WorkSelection.objects.create(
                event=selection.event,
                work=work,
                order=selection.order
            )

        m.delete()
400090
def remove(self, models):
        
        models = self._check_model_types(models)
        for model in models:
            if model in self._selected:
                self._selected.remove(model)
846575
def delete_files(self, selections) -> None:
        """"""
        try:
            currentpath = self.currentpath
            for selection in selections:
                name = str(selection)
                if name == 'complete':
                    continue
                if not name.endswith('.py'):
                    name += '.py'
                path = os.path.join(currentpath, name)
                os.remove(path)
        except BaseException:
            objecttools.augment_excmessage(
                f'While trying to remove the network files of '
                f'selections `{selections}`')
474252
def _replace_old_image(self):
        ''' 
        '''
        try:
            old_obj = self.__class__.objects.get(pk=self.pk)
            if old_obj.image.path != self.image.path:
                path = old_obj.image.path
                default_storage.delete(path)
        except self.__class__.DoesNotExist:
            pass
268122
function () {
            if (!this.props.entry.get("rename")) {
                if (this.state.clickTimer !== null) {
                    this.clearTimer();
                }
                this.props.actions.selectInWorkingSet(this.myPath());
            }
        }
1271924
def purge(datasets, reuses, organizations):
    '''
    
    '''
    purge_all = not any((datasets, reuses, organizations))

    if purge_all or datasets:
        log.info('Purging datasets')
        purge_datasets()

    if purge_all or reuses:
        log.info('Purging reuses')
        purge_reuses()

    if purge_all or organizations:
        log.info('Purging organizations')
        purge_organizations()

    success('Done')
97261
def file_remove_types(object_id, input_params={}, always_retry=True, **kwargs):
    
    return DXHTTPRequest('/%s/removeTypes' % object_id, input_params, always_retry=always_retry, **kwargs)
376887
def _convert_odict_to_classes(self,
                                  data,
                                  clean=False,
                                  merge=True,
                                  pop_schema=True,
                                  compare_to_existing=True,
                                  filter_on={}):
        """"""
        self._log.debug("_convert_odict_to_classes(): {}".format(self.name()))
        self._log.debug("This should be a temporary fix.  Dont be lazy.")

        # Setup filters. Currently only used for photometry.
        fkeys = list(filter_on.keys())

        # Handle 'name'
        name_key = self._KEYS.NAME
        if name_key in data:
            self[name_key] = data.pop(name_key)

        # Handle 'schema'
        schema_key = self._KEYS.SCHEMA
        if schema_key in data:
            # Schema should be re-added every execution (done elsewhere) so
            # just delete the old entry
            if pop_schema:
                data.pop(schema_key)
            else:
                self[schema_key] = data.pop(schema_key)

        # Cleanup 'internal' repository stuff
        if clean:
            # Add data to `self` in ways accomodating 'internal' formats and
            # leeway.  Removes each added entry from `data` so the remaining
            # stuff can be handled normally
            data = self.clean_internal(data)

        # Handle 'sources'
        # ----------------
        src_key = self._KEYS.SOURCES
        if src_key in data:
            # Remove from `data`
            sources = data.pop(src_key)
            self._log.debug("Found {} '{}' entries".format(
                len(sources), src_key))
            self._log.debug("{}: {}".format(src_key, sources))

            for src in sources:
                self.add_source(allow_alias=True, **src)

        # Handle `photometry`
        # -------------------
        photo_key = self._KEYS.PHOTOMETRY
        if photo_key in data:
            photoms = data.pop(photo_key)
            self._log.debug("Found {} '{}' entries".format(
                len(photoms), photo_key))
            phcount = 0
            for photo in photoms:
                skip = False
                for fkey in fkeys:
                    if fkey in photo and photo[fkey] not in filter_on[fkey]:
                        skip = True
                if skip:
                    continue
                self._add_cat_dict(
                    Photometry,
                    self._KEYS.PHOTOMETRY,
                    compare_to_existing=compare_to_existing,
                    **photo)
                phcount += 1
            self._log.debug("Added {} '{}' entries".format(
                phcount, photo_key))

        # Handle `spectra`
        # ---------------
        spec_key = self._KEYS.SPECTRA
        if spec_key in data:
            # When we are cleaning internal data, we don't always want to
            # require all of the normal spectrum data elements.
            spectra = data.pop(spec_key)
            self._log.debug("Found {} '{}' entries".format(
                len(spectra), spec_key))
            for spec in spectra:
                self._add_cat_dict(
                    Spectrum,
                    self._KEYS.SPECTRA,
                    compare_to_existing=compare_to_existing,
                    **spec)

        # Handle `error`
        # --------------
        err_key = self._KEYS.ERRORS
        if err_key in data:
            errors = data.pop(err_key)
            self._log.debug("Found {} '{}' entries".format(
                len(errors), err_key))
            for err in errors:
                self._add_cat_dict(Error, self._KEYS.ERRORS, **err)

        # Handle `models`
        # ---------------
        model_key = self._KEYS.MODELS
        if model_key in data:
            # When we are cleaning internal data, we don't always want to
            # require all of the normal spectrum data elements.
            model = data.pop(model_key)
            self._log.debug("Found {} '{}' entries".format(
                len(model), model_key))
            for mod in model:
                self._add_cat_dict(
                    Model,
                    self._KEYS.MODELS,
                    compare_to_existing=compare_to_existing,
                    **mod)

        # Handle everything else --- should be `Quantity`s
        # ------------------------------------------------
        if len(data):
            self._log.debug("{} remaining entries, assuming `Quantity`".format(
                len(data)))
            # Iterate over remaining keys
            for key in list(data.keys()):
                vals = data.pop(key)
                # All quantities should be in lists of that quantity
                #    E.g. `aliases` is a list of alias quantities
                if not isinstance(vals, list):
                    vals = [vals]
                self._log.debug("{}: {}".format(key, vals))
                for vv in vals:
                    self._add_cat_dict(
                        Quantity,
                        key,
                        check_for_dupes=merge,
                        compare_to_existing=compare_to_existing,
                        **vv)

        if merge and self.dupe_of:
            self.merge_dupes()

        return
1280734
def clear(self):
        
        self.mark_incomplete()
        session = client.get_client().create_session()

        movies = session.query(models.Movie)
        movies.update({'budget_inflation_adjusted': None})

        session.commit()
        session.close()
1014816
def get_cleanups(self, ):
        
        cleanups = []
        open_unit = ActionUnit(name="Open",
                               description="Open the maya scene.",
                               actionfunc=open_scene)
        cleanups.append(open_unit)
        if self._option_widget.import_references():
            import_unit = ActionUnit(name="Import references",
                                     description="Import all references in the scene.",
                                     actionfunc=import_all_references,
                                     depsuccess=[open_unit])
            cleanups.append(import_unit)
        update_scenenode_unit = ActionUnit(name="Update Scene Node",
                                           description="Change the id from the jbscene node from work to releasefile.",
                                           actionfunc=update_scenenode,
                                           depsuccess=[open_unit])
        cleanups.append(update_scenenode_unit)
        save_unit = ActionUnit(name="Save",
                               description="Save the scene.",
                               actionfunc=save_scene,
                               depsuccess=[update_scenenode_unit])
        cleanups.append(save_unit)
        return ActionCollection(cleanups)
1374136
def convert_all_videos(app_label, model_name, object_pk):
    
    # get instance
    Model = apps.get_model(app_label=app_label, model_name=model_name)
    instance = Model.objects.get(pk=object_pk)

    # search for `VideoFields`
    fields = instance._meta.fields
    for field in fields:
        if isinstance(field, VideoField):
            if not getattr(instance, field.name):
                # ignore empty fields
                continue

            # trigger conversion
            fieldfile = getattr(instance, field.name)
            convert_video(fieldfile)
380873
private StatusCode modifyMovieList(String sessionId, String listId, int movieId, MethodSub operation) throws MovieDbException {
        TmdbParameters parameters = new TmdbParameters();
        parameters.add(Param.SESSION_ID, sessionId);
        parameters.add(Param.ID, listId);

        String jsonBody = new PostTools()
                .add(PostBody.MEDIA_ID, movieId)
                .build();

        URL url = new ApiUrl(apiKey, MethodBase.LIST).subMethod(operation).buildUrl(parameters);
        String webpage = httpTools.postRequest(url, jsonBody);

        try {
            return MAPPER.readValue(webpage, StatusCode.class);
        } catch (IOException ex) {
            throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to remove item from list", url, ex);
        }
    }
202398
function selectAllMovies() {
  var movie = db.getSchema().table('Movie');
  db.select(movie.id, movie.title, movie.year).
      from(movie).exec().then(
      function(results) {
        var elapsed = Date.now() - startTime;
        $('#load_time').text(elapsed.toString() + 'ms');
        $('#master').bootstrapTable('load', results).
            on('click-row.bs.table', function(e, row, $element) {
              startTime = Date.now();
              generateDetails(row.id);
            });
      });
}
488285
public function clean()
    {
        $jobFiles = glob($this->getLocation() . '*.js');
        foreach ($jobFiles as $file) {
            unlink($file);
        }
    }
957142
def remove_obsolete_items(self):
        """"""
        self.rdata = [(filename, data) for filename, data in self.rdata
                      if is_module_or_package(filename)]
846518
def record_to_objects(self, preference=None):
        
        from ambry.orm.file import File

        for f in self.list_records():

            pref = preference if preference else f.record.preference

            if pref == File.PREFERENCE.FILE:
                self._bundle.logger.debug('   Cleaning objects for file {}'.format(f.path))
                f.clean_objects()

            if pref in (File.PREFERENCE.FILE, File.PREFERENCE.MERGE):
                self._bundle.logger.debug('   rto {}'.format(f.path))
                f.record_to_objects()
1250477
def __view_remove_actions(self):
        

        add_project_action = "Actions|Umbra|Components|addons.projects_explorer|Add Project ..."
        remove_project_action = "Actions|Umbra|Components|addons.projects_explorer|Remove Project"
        add_new_file_action = "Actions|Umbra|Components|addons.projects_explorer|Add New File ..."
        add_new_directory_action = "Actions|Umbra|Components|addons.projects_explorer|Add New Directory ..."
        rename_action = "Actions|Umbra|Components|addons.projects_explorer|Rename ..."
        # copy_action = "Actions|Umbra|Components|addons.projects_explorer|Copy ..."
        # move_action = "Actions|Umbra|Components|addons.projects_explorer|Move ..."
        delete_action = "Actions|Umbra|Components|addons.projects_explorer|Delete ..."
        find_in_files_action = "Actions|Umbra|Components|addons.projects_explorer|Find In Files ..."
        output_selected_path_action = "Actions|Umbra|Components|addons.projects_explorer|Output Selected Path"

        for action in (add_project_action,
                       remove_project_action,
                       add_new_file_action,
                       add_new_directory_action,
                       rename_action,
                       # copy_action,
                       # move_action,
                       delete_action,
                       output_selected_path_action):
            self.__view.removeAction(self.__engine.actions_manager.get_action(action))
            self.__engine.actions_manager.unregister_action(action)