Register a regex for processing HTTP POST
        requests.  If the callback is None, any
        existing registration is removed.

        The callback will be called as:

            callback(path, postmap)
177583
def register_post(self, regex, callback):
        
        if callback is None:                                                                    # pragma: no cover
            if regex in self.post_registrations:
                del self.post_registrations[regex]
        else:
            self.post_registrations[regex] = (re.compile(regex), callback)
1246087
def post(self, route: str(), callback: object()):
        
        self.__set_route('post', {route: callback})
        return RouteMapping
345408
def _construct_error_handling(self):
        
        # Both path and method not present
        self._app.register_error_handler(404, ServiceErrorResponses.route_not_found)
        # Path is present, but method not allowed
        self._app.register_error_handler(405, ServiceErrorResponses.route_not_found)
        # Something went wrong
        self._app.register_error_handler(500, ServiceErrorResponses.lambda_failure_response)
701598
function(url, callback) {
        var parsedUrl = urlparse(url, true);
        var method = this._normalizeSpecMethod(this.spec, {
            base_url: parsedUrl.protocol +'//' + parsedUrl.hostname,
            headers: {},
            method: 'GET',
            path: parsedUrl.pathname + parsedUrl.search
        });
        var request = this._createRequest(method, {}, null);
        this._callRequestMiddlewares(this.middlewares.slice(0), method, request, [], callback);
    }
644818
function strategyForRegEx(regex) {
      // Ensure the 'global' flag is set.
      if (regex instanceof RegExp) {
        regex = regex.source;
      }
      regex = new RegExp(regex, "g");

      return function(contentBlock, callback) {
        var text = contentBlock.getText();
        var matchArr = null;
        while ((matchArr = regex.exec(text)) !== null) {
          var start = matchArr.index;
          callback(start, start + matchArr[0].length);
        }
      };
    }
110454
def register(self, *paths, methods=None, name=None):
        """"""
        if isinstance(methods, str):
            methods = [methods]

        def wrapper(handler):

            if isinstance(handler, (FunctionType, MethodType)):
                handler = RESTHandler.from_view(handler, *(methods or ['GET']))

            if handler.name in self.handlers:
                raise muffin.MuffinException('Handler is already registered: %s' % handler.name)

            self.handlers[tuple(paths or ["/{0}/{{{0}}}".format(handler.name)])] = handler

            handler.bind(self.app, *paths, methods=methods, name=name or handler.name)
            return handler

        # Support for @app.register(func)
        if len(paths) == 1 and callable(paths[0]):
            view = paths[0]
            paths = []
            return wrapper(view)

        return wrapper
579003
def _handleCallInitiated(self, regexMatch, callId=None, callType=1):
        
        if self._dialEvent:
            if regexMatch:
                groups = regexMatch.groups()
                # Set self._dialReponse to (callId, callType)
                if len(groups) >= 2:
                    self._dialResponse = (int(groups[0]) , int(groups[1]))
                else:
                    self._dialResponse = (int(groups[0]), 1) # assume call type: VOICE
            else:
                self._dialResponse = callId, callType
            self._dialEvent.set()
773087
def should_not_sample_path(request):
    
    blacklisted_paths = request.registry.settings.get(
        'zipkin.blacklisted_paths', [])
    # Only compile strings, since even recompiling existing
    # compiled regexes takes time.
    regexes = [
        re.compile(r) if isinstance(r, six.string_types) else r
        for r in blacklisted_paths
    ]
    return any(r.match(request.path) for r in regexes)
1315259
def add_url(self, name: str, pattern: str, application: Callable) -> None:
        
        self.urlmapper.add(name, self.prefix + pattern)
        self.register_app(name, application)
494964
function (domain, path, callback) {
        var pofile = fs.readFileSync(path, 'utf8');
        var icuObject = this.poStringToICUSync(domain, pofile);
        callback(null, icuObject);
    }
1016735
function (callback) {
    var self = this;

    self._request({
      path: urlJoin(_urlPrefix, 'alloweddomains')
    }, function (err, body) {
      return callback(err, body.allowedDomains);
    });
  }
265911
def register_token(self, token_class, regexp=None):
        
        if regexp is None:
            regexp = token_class.regexp

        self.tokens.register(token_class, regexp)
1239538
def parse_http_scheme(uri):
    
    regex = re.compile(
        r'^(?:http)s?://',
        flags=re.IGNORECASE
    )
    match = regex.match(uri)

    return match.group(0) if match else 'http://'
848751
function RouteRule_toRegex(re) {
        var matches = core.match(PATTERN_CAPTURE_REGEX, re), newRegex = re;

        if (matches.length) {
            matches = matches.map(this.toObject);
            matches.forEach(function (item, mIndex) {
                var index = Object.keys(item).length - 3;
                item.isNamed = IS_NAMED.test(item[1]);
                if (item.isNamed) {
                    if (IS_GROUP.test(item[index])) {
                        item.pattern = item[index];
                    } else {
                        item.pattern = '(' + item[index] + ')';
                    }

                    item.key = item[2];
                    newRegex = newRegex.replace(item[0], item.pattern);
                } else {
                    if (IS_GROUP.test(item[index])) {
                        item.pattern = item[index];
                    } else {
                        item.pattern = '(' + item[index] + ')';
                    }
                    item.key = null;
                }
                item.index = mIndex;
            });
            return {
                group: matches,
                regex: core.createRegex(newRegex)
            };
        }
        return {
            group: false,
            regex: core.createRegex(re)
        };
    }
1244096
function validateUrl(url) {
        var validate = appOptions.validate,
            type = Object.prototype.toString.call(validate);

        if (type === "[object RegExp]") {
            return validate.test(url);
        } else if (type === "[object Function]") {
            return validate(url);
        } else {
            return true;
        }
    }
269046
def registration(uri):
    

    # add the stack-in-a-box specific response codes to
    # http's status information
    status_data = {
        595: 'StackInABoxService - Unknown Route',
        596: 'StackInABox - Exception in Service Handler',
        597: 'StackInABox - Unknown Service'
    }
    for k, v in six.iteritems(status_data):
        if k not in httpretty.http.STATUSES:
            httpretty.http.STATUSES[k] = v

    # log the uri that is used to access the stack-in-a-box services
    logger.debug('Registering Stack-In-A-Box at {0} under Python HTTPretty'
                 .format(uri))
    # tell stack-in-a-box what uri to match with
    StackInABox.update_uri(uri)

    # build the regex for the uri and register all http verbs
    # with httpretty
    regex = re.compile('(http)?s?(://)?{0}:?(\d+)?/'.format(uri),
                       re.I)
    for method in HttpBaseClass.METHODS:
        register_uri(method, regex, body=httpretty_callback)
1299091
def convert_regex_to_flask_path(url_path):
    
    for token in ["$"]:
        url_path = url_path.replace(token, "")

    def caller(reg):
        match_name, match_pattern = reg.groups()
        return '<regex("{0}"):{1}>'.format(match_pattern, match_name)

    url_path = re.sub("\(\?P<(.*?)>(.*?)\)", caller, url_path)

    if url_path.endswith("/?"):
        # Flask does own handling of trailing slashes
        url_path = url_path.rstrip("/?")
    return url_path