O365 PATCH method.
334079
def patch_resource(self, path, body=None, json=None):
        
        url = '%s%s' % (path, self._param_list())
        headers = {
            'Accept': 'application/json;odata=minimalmetadata'
        }

        if json:
            headers['Content-Type'] = 'application/json'
            body = json_dumps(json)

        response = O365_DAO().patchURL(self._url(url), headers, body)

        if not (response.status == 200 or response.status == 201 or
                response.status == 204):
            raise DataFailureException(url, response.status, response.data)

        return json_loads(response.data) if len(response.data) else {}
888096
def patch(self, *args, **kwargs):
        """"""
        json_data = request.get_json() or {}

        relationship_field, model_relationship_field, related_type_, related_id_field = self._get_relationship_data()

        if 'data' not in json_data:
            raise BadRequest('You must provide data with a "data" route node', source={'pointer': '/data'})
        if isinstance(json_data['data'], dict):
            if 'type' not in json_data['data']:
                raise BadRequest('Missing type in "data" node', source={'pointer': '/data/type'})
            if 'id' not in json_data['data']:
                raise BadRequest('Missing id in "data" node', source={'pointer': '/data/id'})
            if json_data['data']['type'] != related_type_:
                raise InvalidType('The type field does not match the resource type', source={'pointer': '/data/type'})
        if isinstance(json_data['data'], list):
            for obj in json_data['data']:
                if 'type' not in obj:
                    raise BadRequest('Missing type in "data" node', source={'pointer': '/data/type'})
                if 'id' not in obj:
                    raise BadRequest('Missing id in "data" node', source={'pointer': '/data/id'})
                if obj['type'] != related_type_:
                    raise InvalidType('The type provided does not match the resource type',
                                      source={'pointer': '/data/type'})

        self.before_patch(args, kwargs, json_data=json_data)

        obj_, updated = self._data_layer.update_relationship(json_data,
                                                             model_relationship_field,
                                                             related_id_field,
                                                             kwargs)

        status_code = 200
        result = {'meta': {'message': 'Relationship successfully updated'}}

        if updated is False:
            result = ''
            status_code = 204

        final_result = self.after_patch(result, status_code)

        return final_result
1251871
def apply(cls, fs):
        
        logger.debug(
            'Patching %s with %s.', fs.__class__.__name__, cls.__name__)
        fs._patch = cls
        for method_name in cls.patch_methods:
            # if fs hasn't method, raise AttributeError.
            origin = getattr(fs, method_name)
            method = getattr(cls, method_name)
            bound_method = method.__get__(fs, fs.__class__)
            setattr(fs, method_name, bound_method)
            setattr(fs, '_origin_' + method_name, origin)
727432
def apply_patch(document, patch):
  """"""
  # pylint: disable=too-many-return-statements
  op = patch.op
  parent, idx = resolve_path(document, patch.path)
  if op == "add":
    return add(parent, idx, patch.value)
  elif op == "remove":
    return remove(parent, idx)
  elif op == "replace":
    return replace(parent, idx, patch.value, patch.src)
  elif op == "merge":
    return merge(parent, idx, patch.value)
  elif op == "copy":
    sparent, sidx = resolve_path(document, patch.src)
    return copy(sparent, sidx, parent, idx)
  elif op == "move":
    sparent, sidx = resolve_path(document, patch.src)
    return move(sparent, sidx, parent, idx)
  elif op == "test":
    return test(parent, idx, patch.value)
  elif op == "setremove":
    return set_remove(parent, idx, patch.value)
  elif op == "setadd":
    return set_add(parent, idx, patch.value)
  else:
    raise JSONPatchError("Invalid operator")
323742
def patch_sys(self, inherit_path):
    """"""
    def patch_dict(old_value, new_value):
      old_value.clear()
      old_value.update(new_value)

    def patch_all(path, path_importer_cache, modules):
      sys.path[:] = path
      patch_dict(sys.path_importer_cache, path_importer_cache)
      patch_dict(sys.modules, modules)

    new_sys_path, new_sys_path_importer_cache, new_sys_modules = self.minimum_sys(inherit_path)

    new_sys_path.extend(merge_split(self._pex_info.pex_path, self._vars.PEX_PATH))

    patch_all(new_sys_path, new_sys_path_importer_cache, new_sys_modules)
25887
def patch(self, url, data=None, params=None):
        
        return self.request("patch", url, data, params)
1153911
def patched(f):
    """"""

    def wrapped(*args, **kwargs):

        kwargs['return_response'] = False
        kwargs['prefetch'] = True

        return f(*args, **kwargs)

    return wrapped
139704
def patched(attrs, updates):
    """"""
    orig = patch(attrs, updates.items())
    try:
        yield orig
    finally:
        patch(attrs, orig.items())
612807
def patch():
    """"""
    import pynamodb

    if hasattr(botocore.vendored.requests.sessions, '_xray_enabled'):
        return
    setattr(botocore.vendored.requests.sessions, '_xray_enabled', True)

    wrapt.wrap_function_wrapper(
        'botocore.vendored.requests.sessions',
        'Session.send',
        _xray_traced_pynamodb,
    )
265319
def patch(self, url: StrOrURL,
              *, data: Any=None, **kwargs: Any) -> '_RequestContextManager':
        """"""
        return _RequestContextManager(
            self._request(hdrs.METH_PATCH, url,
                          data=data,
                          **kwargs))
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
323192
def _patch(self, opt={}):
        
        opt_netloc = opt.pop(Request.opt_url_netloc, None)
        opt_scheme = opt.pop(Request.opt_url_scheme, None)
        if opt_netloc or opt_scheme:
            scheme, netloc, path, params, query, fragment = six.moves.urllib.parse.urlparse(self.__url)
            self.__url = six.moves.urllib.parse.urlunparse((
                opt_scheme or scheme,
                opt_netloc or netloc,
                path,
                params,
                query,
                fragment
            ))

            logger.info('patching url: [{0}]'.format(self.__url))
1328413
def _patched_pep257():
    """"""
    import pep257

    if getattr(pep257, "log", None):
        def _dummy(*args, **kwargs):
            del args
            del kwargs

        old_log_info = pep257.log.info
        pep257.log.info = _dummy  # suppress(unused-attribute)
    try:
        yield
    finally:
        if getattr(pep257, "log", None):
            pep257.log.info = old_log_info
710839
def patches
      patch = {}
      loaded_headers.each do |header|
        header.patches.each do |key, val|
          patch[key + header.offset] = val
        end
      end
      patch
    end
811866
def patch(query_url,
              headers: {},
              parameters: {})
      HttpRequest.new(HttpMethodEnum::PATCH,
                      query_url,
                      headers: headers,
                      parameters: parameters)
    end
374241
def patch_file(actions, tree):
    """"""
    tree = etree.parse(tree)

    if isinstance(actions, six.string_types):
        # It's a string, so it's a filename
        with open(actions) as f:
            actions = f.read()
    else:
        # We assume it's a stream
        actions = actions.read()

    actions = patch.DiffParser().parse(actions)
    tree = patch_tree(actions, tree)
    return etree.tounicode(tree)
537729
def patch(self, url, data=None, **kwargs):
        """"""
        return requests.patch(url, data=data, headers=self.add_headers(**kwargs))