Run the given patch to update the datamodel

        :return: the list of post-scriptum returned by the fixes
172937
def apply(self, manifest, db, force=False):
        
        fixes_pss = []
        if not force:
            self.can_be_applied(manifest, db)
        for fix in self.fixes:
            print('\t%s...' % fix.__name__, flush=True, end='')
            ps = fix(db)
            if ps:
                fixes_pss.append("%s: %s" % (fix.__name__, ps))
            print(' Done !')
        manifest.update(self.target_version,
                        reason='Upgrade from %s' % self.base_version)
        return fixes_pss
192662
def patch_thread(threading=True, _threading_local=True, Queue=True, Event=False):
    
    monkey.patch_module('thread')
    if threading:
        monkey.patch_module('threading')
        threading = __import__('threading')
        if Event:
            from gevent.event import Event
            threading.Event = Event
        if Queue:
            from gevent import queue
            threading.queue = queue
    if _threading_local:
        _threading_local = __import__('_threading_local')
        from gevent.local import local
        _threading_local.local = local
304174
def update(self, context):
        
        #Get a list of all the operations that need to be performed and then
        #execute them.
        self._operations = self._get_operations(context)

        for i in range(len(self._operations)):
            self._operations[i].handle()
            self.update_extent(self._operations[i])

        #Last of all, we update the string content of the cached version of
        #the module to have the latest source code.
        if len(self._operations) > 0:
            context.module.update_refstring(context.refstring)
1086731
def _patch_awx_callback():
    
    # AWX uses sitecustomize.py to force-load this package. If it exists, we're
    # running under AWX.
    try:
        from awx_display_callback.events import EventContext
        from awx_display_callback.events import event_context
    except ImportError:
        return

    if hasattr(EventContext(), '_local'):
        # Patched version.
        return

    def patch_add_local(self, **kwargs):
        tls = vars(self._local)
        ctx = tls.setdefault('_ctx', {})
        ctx.update(kwargs)

    EventContext._local = threading.local()
    EventContext.add_local = patch_add_local
673254
def _update_metadata(self):
        
        self._pystratum_metadata['routine_name'] = self._routine_name
        self._pystratum_metadata['designation'] = self._designation_type
        self._pystratum_metadata['table_name'] = self._table_name
        self._pystratum_metadata['parameters'] = self._parameters
        self._pystratum_metadata['columns'] = self._columns
        self._pystratum_metadata['fields'] = self._fields
        self._pystratum_metadata['column_types'] = self._columns_types
        self._pystratum_metadata['timestamp'] = self._m_time
        self._pystratum_metadata['replace'] = self._replace
        self._pystratum_metadata['pydoc'] = self._doc_block_parts_wrapper
1347643
def patched_function(self, *args, **kwargs):
        
        result = self.function(*args, **kwargs)
        self.validate(result)
        return result
617425
def patch(patch_inspect=True):
    
    PATCHED['collections.abc.Generator'] = _collections_abc.Generator = Generator
    PATCHED['collections.abc.Coroutine'] = _collections_abc.Coroutine = Coroutine
    PATCHED['collections.abc.Awaitable'] = _collections_abc.Awaitable = Awaitable

    if patch_inspect:
        import inspect
        PATCHED['inspect.isawaitable'] = inspect.isawaitable = isawaitable
1106122
function update (req, res, next) {
    for (var key in req.body) {
      req.body[key] = utils.toNative(req.body[key])
    }

    var id = utils.toNative(req.params.id)
    var chain = db.get(name)

    chain = req.method === 'PATCH'
      ? chain.updateById(id, req.body)
      : chain.replaceById(id, req.body)

    var resource = chain.value()

    if (resource) {
      res.locals.data = resource
    }

    next()
  }
591033
def _patch():
	
	
	if not __debug__:  # pragma: no cover
		import warnings
		warnings.warn("A catgirl has died.", ImportWarning)
	
	from pymongo.collection import Collection
	Collection.tail = tail
275769
def update(self, **kwargs):
        ""
        kw = dict(index=self.name, doc_type=self.doc_type, ignore=[404])
        kw.update(**kwargs)
        return self._client.update(**kw)
188846
def generate_patches(self):
        
        start_pos = self.start_position or Position(None, None)
        end_pos = self.end_position or Position(None, None)

        path_list = Query._walk_directory(self.root_directory)
        path_list = Query._sublist(path_list, start_pos.path, end_pos.path)
        path_list = (
            path for path in path_list if
            Query._path_looks_like_code(path) and
            (self.path_filter(path)) or
            (self.inc_extensionless and helpers.is_extensionless(path))
        )
        for path in path_list:
            try:
                lines = list(open(path))
            except (IOError, UnicodeDecodeError):
                # If we can't open the file--perhaps it's a symlink whose
                # destination no loner exists--then short-circuit.
                continue

            for patch in self.suggestor(lines):
                if path == start_pos.path:
                    if patch.start_line_number < start_pos.line_number:
                        continue  # suggestion is pre-start_pos
                if path == end_pos.path:
                    if patch.end_line_number >= end_pos.line_number:
                        break  # suggestion is post-end_pos

                old_lines = lines[
                    patch.start_line_number:patch.end_line_number]
                if patch.new_lines is None or patch.new_lines != old_lines:
                    patch.path = path
                    yield patch
                    # re-open file, in case contents changed
                    lines[:] = list(open(path))
1143243
def monkey_patch(cls):
        """"""
        on_read_the_docs = os.environ.get('READTHEDOCS', False)
        if on_read_the_docs:
            sys.modules['zbarlight._zbarlight'] = cls
540436
def patch(*args, **kwargs):
    
    from caliendo.patch import patch as p
    return p(*args, **kwargs)
610611
def _rest_patch(self, suburi, request_headers, request_body):
        
        return self._rest_op('PATCH', suburi, request_headers, request_body)
1000915
def on_patch(resc, req, resp, rid):
    

    signals.pre_req.send(resc.model)
    signals.pre_req_update.send(resc.model)

    props = req.deserialize()
    model = find(resc.model, rid)

    from_rest(model, props)
    goldman.sess.store.update(model)

    props = to_rest_model(model, includes=req.includes)
    resp.last_modified = model.updated
    resp.serialize(props)

    signals.post_req.send(resc.model)
    signals.post_req_update.send(resc.model)
226136
def apply_and_save(self):
        """"""
        patches = self.patches

        content = None
        with open(self.IN_PATH) as f_in:
            # As setup.py.in file size is 2.4 KByte.
            # it's fine to read entire content.
            content = f_in.read()

        # Replace words.
        for key in self.replaced_word_dict:
            content = content.replace(key, self.replaced_word_dict[key])

        # Apply patches.
        out_patches = []
        for patch in patches:
            pattern = re.compile(patch['src'], re.MULTILINE)
            (content, subs_num) = re.subn(pattern, patch['dest'],
                                          content)
            if subs_num > 0:
                patch['applied'] = True
            out_patches.append(patch)

        for patch in out_patches:
            if patch.get('required') and not patch.get('applied'):
                Log.warn('Patch not applied {0}'.format(patch['src']))

        with open(self.OUT_PATH, 'w') as f_out:
            f_out.write(content)

        self.pathces = out_patches
        # Release content data to make it released by GC quickly.
        content = None
180999
def update(self):
        

        if not self._track_changes:
            return True  # there's nothing to update

        data = self.to_api_data(restrict_keys=self._track_changes)
        response = self.session.patch(self.build_url(''), data=data)
        if not response:
            return False

        data = response.json()

        for field in self._track_changes:
            setattr(self, snakecase(field), data.get(field))
        self._track_changes.clear()

        return True