Load patches which override values in the CLDR data. Use this to restore
certain cases to our preferred form.
482880
private void loadPatches() throws IOException {
    List<Path> paths = Utils.listResources(PATCHES);
    for (Path path : paths) {
      String fileName = path.getFileName().toString();
      if (fileName.endsWith(".json")) {
        JsonObject root = load(path);
        patches.put(fileName, root);
      }
    }
  }
903575
function resetResolvedData(matcher) {
        matcher.resolvedMatches = null;
        matcher.resolvedMatchesObj = null;
        matcher.resolvedMatchesById = null;
        matcher.assignedIds = null;
        matcher.assignedIdsMap = null;
    }
448977
protected function prepareModelOverrides()
    {
        $this->overrides = $this->getOverrideConfigForModel($this->moduleId);

        // determine name to use, handle pluralization and check database table override
        if (array_key_exists('name', $this->overrides)) {

            $name = $this->overrides['name'];

        } else {

            $name = array_get($this->module, 'prefixed_name') ?: $this->model['name'];

            if (config('pxlcms.generator.models.model_name.singularize_model_names')) {

                if ($this->context->dutchMode) {
                    $name = $this->dutchSingularize($name);
                } else {
                    $name = str_singular($name);
                }
            }
        }

        // make sure we force set a table name if it does not follow convention
        $tableOverride = null;

        if (str_plural($this->normalizeDb($name)) != $this->normalizeDb($this->module['name'])) {

            $tableOverride = $this->getModuleTablePrefix($this->moduleId)
                           . $this->normalizeDb($this->module['name']);
        }

        // force listified?
        $listified = array_key_exists('listify', $this->overrides)
                   ?    (bool) $this->overrides['listify']
                   :    $this->model['is_listified'];


        // override hidden attributes?
        $this->overrideHidden = [];

        if (    ! is_null(array_get($this->overrides, 'attributes.hidden'))
            &&  ! array_get($this->overrides, 'attributes.hidden-empty')
        ) {
            $this->overrideHidden = array_get($this->overrides, 'attributes.hidden');

            if ( ! is_array($this->overrideHidden)) $this->overrideHidden = [ (string) $this->overrideHidden ];
        }


        // apply overrides to model data
        $this->model['name']         = $name;
        $this->model['table']        = $tableOverride;
        $this->model['is_listified'] = $listified;
        $this->model['hidden']       = $this->overrideHidden;
        $this->model['casts']        = array_get($this->overrides, 'attributes.casts', []);
    }
726476
function applyPatches (versions) {
    versions = sortVersions(versions, 'ASC')

    let state = []
    // iterate patches to the final one => get previous commit state
    versions.forEach((v) => {
      v.changes.forEach((c) => {
        if (c.operation === 'insert') {
          return state.push({
            entityId: c.entityId,
            entitySet: c.entitySet,
            entity: parse(c.serializedDoc),
            path: c.path
          })
        }

        if (c.operation === 'remove') {
          state = state.filter((e) => e.entityId !== c.entityId)
          return
        }

        const entityState = state.find((e) => e.entityId === c.entityId)
        applyPatch(entityState.entity, parse(c.serializedPatch), c.entitySet, documentModel)
      })
    })
    return state
  }
1301135
def p_struct_patch(self, p):
        """"""
        p[0] = AstStructPatch(
            path=self.path,
            lineno=p.lineno(1),
            lexpos=p.lexpos(1),
            name=p[3],
            fields=p[6],
            examples=p[7])
883575
public static synchronized void reload() {
    map = new HashMap<Class<?>, Object>();
    customProperties = loadFile(CUSTOM_TUNING_FILE_NAME);
    defaultProperties = loadFile(DEFAULT_TUNING_FILE_NAME);
  }
844185
def patch_view_model(view_cls, model_cls):
    
    original_model = view_cls.Model
    view_cls.Model = model_cls

    try:
        yield
    finally:
        view_cls.Model = original_model
859370
def _patch_original_class(self):
        
        cls = self._cls
        base_names = self._base_names

        # Clean class of attribute definitions (`attr.ib()`s).
        if self._delete_attribs:
            for name in self._attr_names:
                if (
                    name not in base_names
                    and getattr(cls, name, None) is not None
                ):
                    try:
                        delattr(cls, name)
                    except AttributeError:
                        # This can happen if a base class defines a class
                        # variable and we want to set an attribute with the
                        # same name by using only a type annotation.
                        pass

        # Attach our dunder methods.
        for name, value in self._cls_dict.items():
            setattr(cls, name, value)

        # Attach __setstate__. This is necessary to clear the hash code
        # cache on deserialization. See issue
        # https://github.com/python-attrs/attrs/issues/482 .
        # Note that this code only handles setstate for dict classes.
        # For slotted classes, see similar code in _create_slots_class .
        if self._cache_hash:
            existing_set_state_method = getattr(cls, "__setstate__", None)
            if existing_set_state_method:
                raise NotImplementedError(
                    "Currently you cannot use hash caching if "
                    "you specify your own __setstate__ method."
                    "See https://github.com/python-attrs/attrs/issues/494 ."
                )

            def cache_hash_set_state(chss_self, _):
                # clear hash code cache
                setattr(chss_self, _hash_cache_field, None)

            setattr(cls, "__setstate__", cache_hash_set_state)

        return cls
442818
def reload_solver(self, constraints=None):
        

        if constraints is None:
            constraints = self._solver.constraints
        self._stored_solver = None
        self._solver.add(constraints)
521101
public function reloadFixtures()
    {
        if ( ! $this->useBackup) {
            $this->loadFixtures();

            return;
        }

        if ($this->hasBackup()) {
            $this->restoreBackup();

            $this->getReferenceRepository()
                 ->load($this->getBackupFile());

            return;
        }

        if ($this->migrations === null) {
            $this->dropDatabase();
            $this->createDatabase();
        }

        $this->loadFixtures();
        $this->createBackup();

        $this->getReferenceRepository()
             ->save($this->getBackupFile());
    }
914094
def prepare_site_db_and_overrides():
    '''
    '''
    _SITE_DB.clear()
    _SITE_DB[_MAIN_LANG] = _MAIN_SITEURL
    # make sure it works for both root-relative and absolute
    main_siteurl = '/' if _MAIN_SITEURL == '' else _MAIN_SITEURL
    for lang, overrides in _SUBSITE_QUEUE.items():
        if 'SITEURL' not in overrides:
            overrides['SITEURL'] = posixpath.join(main_siteurl, lang)
        _SITE_DB[lang] = overrides['SITEURL']
        # default subsite hierarchy
        if 'OUTPUT_PATH' not in overrides:
            overrides['OUTPUT_PATH'] = os.path.join(
                _MAIN_SETTINGS['OUTPUT_PATH'], lang)
        if 'CACHE_PATH' not in overrides:
            overrides['CACHE_PATH'] = os.path.join(
                _MAIN_SETTINGS['CACHE_PATH'], lang)
        if 'STATIC_PATHS' not in overrides:
            overrides['STATIC_PATHS'] = []
        if ('THEME' not in overrides and 'THEME_STATIC_DIR' not in overrides and
                'THEME_STATIC_PATHS' not in overrides):
            relpath = relpath_to_site(lang, _MAIN_LANG)
            overrides['THEME_STATIC_DIR'] = posixpath.join(
                relpath, _MAIN_SETTINGS['THEME_STATIC_DIR'])
            overrides['THEME_STATIC_PATHS'] = []
        # to change what is perceived as translations
        overrides['DEFAULT_LANG'] = lang
520355
private static void applyOverrides() {
        // Get the appropriate InputStream to read overrides from, if any.
        InputStream stream = getContentTypesPropertiesStream();
        if (stream == null) {
            return;
        }

        try {
            try {
                // Read the properties file...
                Properties overrides = new Properties();
                overrides.load(stream);
                // And translate its mapping to ours...
                for (Map.Entry<Object, Object> entry : overrides.entrySet()) {
                    String extension = (String) entry.getKey();
                    String mimeType = (String) entry.getValue();
                    add(mimeType, extension);
                }
            } finally {
                stream.close();
            }
        } catch (IOException ignored) {
        }
    }
630579
def _apply_cn_keys_patch():
    
    import sys
    if sys.version_info[:2] == (3, 5):
        import http.client as hc
        old_parse = hc.parse_headers

        def parse_header(*args, **kwargs):
            fp = args[0]
            old_readline = fp.readline

            def new_readline(*args, **kwargs):
                ret = old_readline(*args, **kwargs)
                if ret.lower().startswith(b'x-log-query-info'):
                    return b'x-log-query-info: \r\n'
                return ret

            fp.readline = new_readline

            ret = old_parse(*args, **kwargs)
            return ret

        hc.parse_headers = parse_header
47425
function patch(element, previous, dataset) {
  if (!previous && !dataset) {
    return dataset;
  }
  var name;
  previous = previous || {};
  dataset = dataset || {};

  for (name in previous) {
    if (dataset[name] === undefined) {
      delete element.dataset[name];
    }
  }

  for (name in dataset) {
    if (previous[name] === dataset[name]) {
      continue;
    }
    element.dataset[name] = dataset[name];
  }

  return dataset;
}
1267924
def load(self, data):
        
        self.clear()
        self.update(data)
        self.enhance()
1130580
private function loadAll(): void
  {
    $this->findSourceFiles();
    $this->detectNameConflicts();
    $this->getColumnTypes();
    $this->readStoredRoutineMetadata();
    $this->getConstants();
    $this->getOldStoredRoutinesInfo();
    $this->getCorrectSqlMode();

    $this->loadStoredRoutines();

    // Drop obsolete stored routines.
    $this->dropObsoleteRoutines();

    // Remove metadata of stored routines that have been removed.
    $this->removeObsoleteMetadata();

    $this->io->writeln('');

    // Write the metadata to file.
    $this->writeStoredRoutineMetadata();
  }
290993
def apply_patch(diffs):
    
    pass

    if isinstance(diffs, patch.diff):
        diffs = [diffs]

    for diff in diffs:
        if diff.header.old_path == '/dev/null':
            text = []
        else:
            with open(diff.header.old_path) as f:
                text = f.read()

        new_text = apply_diff(diff, text)
        with open(diff.header.new_path, 'w') as f:
            f.write(new_text)