Memorizes module encoding
778888
def _onEncoding(self, encString, line, pos, absPosition):
        """"""
        self.encoding = Encoding(encString, line, pos, absPosition)
418075
function Memori(options) {
  var _options = _.merge({adapter: "memory"}, options);
  var _module = path.join(__dirname, "lib", "adapters", _options.adapter);
  var _adapterImpl = require(_module);
  var _adapter = new _adapterImpl(_options);

  Object.defineProperty(this, "_adapter", {
    get: function() {
      return _adapter;
    }
  });
  Object.defineProperty(this, "adapter", {
    get: function() {
      return _adapter.name;
    }
  });
  Object.defineProperty(this, "identity", {
    get: function() {
      return _adapter.identity;
    }
  });
}
570536
def rem_encoding(code):
    """"""
    old_lines = code.splitlines()
    new_lines = []
    for i in range(min(2, len(old_lines))):
        line = old_lines[i]
        if not (line.lstrip().startswith("#") and "coding" in line):
            new_lines.append(line)
    new_lines += old_lines[2:]
    return "\n".join(new_lines)
362957
def readmodule(module, path=None):
    ''''''

    res = {}
    for key, value in _readmodule(module, path or []).items():
        if isinstance(value, Class):
            res[key] = value
    return res
1200743
def uri2module(self, uri):
        """"""
        # uri is the source code of the module
        compressed = zlib.compress(uri)
        encoded = base64.b64encode(compressed, b'+&')
        encoded_str = encoded.decode('ASCII')
        return super(EncodedModuleLoader, self).uri2module(encoded_str)
857104
def get_encoding(headers, content):
    """"""
    encoding = None

    content_type = headers.get('content-type')
    if content_type:
        _, params = cgi.parse_header(content_type)
        if 'charset' in params:
            encoding = params['charset'].strip("'\"")

    if not encoding:
        content = utils.pretty_unicode(content[:1000]) if six.PY3 else content

        charset_re = re.compile(r'<meta.*?charset=["\']*(.+?)["\'>]',
                                flags=re.I)
        pragma_re = re.compile(r'<meta.*?content=["\']*;?charset=(.+?)["\'>]',
                               flags=re.I)
        xml_re = re.compile(r'^<\?xml.*?encoding=["\']*(.+?)["\'>]')
        encoding = (charset_re.findall(content) +
                    pragma_re.findall(content) +
                    xml_re.findall(content))
        encoding = encoding and encoding[0] or None

    return encoding
1109776
def memoized_property(fget):
    """"""
    attr_name = '_{}'.format(fget.__name__)

    @functools.wraps(fget)
    def fget_memoized(self):
        if not hasattr(self, attr_name):
            setattr(self, attr_name, fget(self))
        return getattr(self, attr_name)
    return property(fget_memoized)
260490
function (module) {

            var moduleObj;

            if (typeof module !== "string") {
                throw new Error("Missing or invalid argument");
            }

            if (!_initialized) {
                throw new Error("The Browser History Manager is not initialized");
            }

            moduleObj = _modules[module];
            if (!moduleObj) {
                throw new Error("No such registered module: " + module);
            }

            return unescape(moduleObj.currentState);
        }
1367913
def process_value(self, name, value, module_name):
        
        # if we have a colon in the name of a setting then it
        # indicates that it has been encoded.
        if ":" in name:

            if module_name.split(" ")[0] in I3S_MODULE_NAMES + ["general"]:
                self.error("Only py3status modules can use obfuscated")

            if type(value).__name__ not in ["str", "unicode"]:
                self.error("Only strings can be obfuscated")

            (name, scheme) = name.split(":")
            if scheme == "base64":
                value = PrivateBase64(value, module_name)
            elif scheme == "hide":
                value = PrivateHide(value, module_name)
            else:
                self.error("Unknown scheme {} for data".format(scheme))

        return name, value
301094
def memoize(function):
    """"""
    _cache = {}
    @wraps(function)
    def wrapper(*args, **kwargs):
        key = str(args) + str(kwargs)
        if key not in _cache:
            _cache[key] = function(*args, **kwargs)
        return _cache[key]
    return wrapper
620961
function normalizeModuleIdentifiers(ast, load, options) {
	visitRequireArgument(ast, function(argument) {
		var normalized = optionsNormalize(
			options,
			argument.value,
			load.name,
			load.address
		);

		argument.value = normalized;
		argument.raw = `"${normalized}"`;
	});
}
1151755
def write_module_code(self, module_code):
        """"""
        for n in module_code:
            self.printer.start_source(n.lineno)
            self.printer.write_indented_block(n.text)
201029
def module_to_dict(module):
    

    lot = [(key, module.__getattribute__(key)) for key in module.__all__]
    ret = dict(lot)
    return ret
170615
def _encode_mapping(name, value, check_keys, opts):
    """"""
    data = b"".join([_element_to_bson(key, val, check_keys, opts)
                     for key, val in iteritems(value)])
    return b"\x03" + name + _PACK_INT(len(data) + 5) + data + b"\x00"
392636
def detectEncodingMeta(self):
        
        buffer = self.rawStream.read(self.numBytesMeta)
        assert isinstance(buffer, bytes)
        parser = EncodingParser(buffer)
        self.rawStream.seek(0)
        encoding = parser.getEncoding()

        if encoding is not None and encoding.name in ("utf-16be", "utf-16le"):
            encoding = lookupEncoding("utf-8")

        return encoding
776690
def memoize(f):
    """"""
    @wraps(f)
    def w(*args, **kw):
        memoize.mem[f] = v = f(*args, **kw)
        return v
    return w
603560
private function getEncodingTypeMiddleware()
    {
        return static function (callable $handler) {
            return function (Command $command, $request = null) use ($handler) {
                $autoSet = false;
                if ($command->getName() === 'ListObjects'
                    && empty($command['EncodingType'])
                ) {
                    $command['EncodingType'] = 'url';
                    $autoSet = true;
                }

                return $handler($command, $request)
                    ->then(function (ResultInterface $result) use ($autoSet) {
                        if ($result['EncodingType'] === 'url' && $autoSet) {
                            static $topLevel = [
                                'Delimiter',
                                'Marker',
                                'NextMarker',
                                'Prefix',
                            ];
                            static $nested = [
                                ['Contents', 'Key'],
                                ['CommonPrefixes', 'Prefix'],
                            ];

                            foreach ($topLevel as $key) {
                                if (isset($result[$key])) {
                                    $result[$key] = urldecode($result[$key]);
                                }
                            }
                            foreach ($nested as $steps) {
                                if (isset($result[$steps[0]])) {
                                    foreach ($result[$steps[0]] as &$part) {
                                        if (isset($part[$steps[1]])) {
                                            $part[$steps[1]]
                                                = urldecode($part[$steps[1]]);
                                        }
                                    }
                                }
                            }

                        }

                        return $result;
                    });
            };
        };
    }