Strip out a namespace from a data set.

@param object $post WP_Post object to modify
@param string $namespace The namespace to remove
@return Ultra\Mutator\Mutator The mutated data object
347169
public function removeNamespace($post, $namespaces)
    {
        foreach($post as $key => $value)
        {
            $splitKey = explode('_', $key);

            if(in_array($splitKey[0], $namespaces))
            {
                unset($post->$key);

                $newKey = implode(array_slice($splitKey, 1), '_');

                $post->$newKey = $value;
            }
        }

        return $this;
    }
753977
protected static function formatNamespaceGroup(array $namespace, $group)
    {
        $group = static::checkGroup($group);

        if ('any' === $group) {
            $namespace = ['*'];
        } else {
            foreach ($namespace as &$value) {
                $value = static::checkNamespace($value);
                if ('path' === $group) {
                    $value .= '\\*';
                }
            }
        }

        return $namespace;
    }
1137765
protected function dataForPrefix($namespace, $prefix)
    {
        if (!isset($this->cachedData[$namespace][$prefix])) {
            $this->loadDataForPrefix($namespace, $prefix);

        }

        // If no custom data was setted using offsetSet() just return that
        if (!isset($this->customData[$namespace][$prefix])) {
            return $this->cachedData[$namespace][$prefix];
        }

        $data = $this->cachedData[$namespace][$prefix];

        array_unshift($data, $this->customData[$namespace][$prefix]);

        return $data;

    }
1171414
def remove_namespace(self, ns_uri):
        """"""
        if not self.contains_namespace(ns_uri):
            return

        ni = self.__ns_uri_map.pop(ns_uri)
        for prefix in ni.prefixes:
            del self.__prefix_map[prefix]
391439
public function clearNamespace($namespace)
    {
        $paths = $this->getNamespaceDefaultPaths($namespace);
        foreach ($paths as $path) {
            if ($this->files->isDirectory($path)) {
                $this->files->deleteDirectory($path);
            }
        }
    }
526715
public function findByNamespace($namespace)
    {
        if (!$this->hasPlugin($namespace)) {
            return null;
        }

        $classId = $this->getIdentifier($namespace);

        return $this->plugins[$classId];
    }
715322
public function RemoveConstant($name, $namespace="", $header="")
    {
        if($header)
        {
            if($namespace)
            {
                unset($this->headers[$header]->namespaces[$namespace]->constants[$name]);
            }
            else
            {
                foreach($this->headers[$header]->namespaces as $namespace_object)
                {
                    unset($namespace_object->constants[$name]);
                }
            }
        }
        elseif($namespace)
        {
            foreach($this->headers as $header_object)
            {
                unset($header_object->namespaces[$namespace]->constants[$name]);
            }
        }
        else
        {
            foreach($this->headers as $header_object)
            {
                foreach($header_object->namespaces as $namespace_object)
                {
                    unset($namespace_object->constants[$name]);
                }
            }
        }
    }
1099012
static function deleteConfigByName($namespace, $name) 
    {
        $result = CommonConfigModel::where('namespace', $namespace)
                                    ->where('name', $name)
                                    ->delete();
        self::setCache($namespace);
        return $result;
    }
982737
protected function filterByNamespace($namespace)
    {
        return function ($file) use ($namespace) {
            $content = file_get_contents($file);
            $tokens = token_get_all($content);

            $count = count($tokens);
            $token_namespace = null;

            for ($i = 0; $i < $count; ++$i) {
                $token = $tokens[$i];

                if (is_array($token) && $token[0] === T_NAMESPACE) {
                    $token_namespace .= '\\';
                    while (++$i < $count) {
                        if ($tokens[$i] === ';') {
                            $namespace = trim($namespace);
                            break;
                        }
                        $token_namespace .= is_array($tokens[$i]) ? trim($tokens[$i][1]) : '';
                    }

                    if ($token_namespace !== $namespace) {
                        return false;
                    }

                    break;
                }
            }

            if (!isset($token_namespace)) {
                return false;
            }
        };
    }
763369
def remove_namespace(self, namespace):
        """"""
        params = (namespace, )
        execute = self.cursor.execute
        execute('DELETE FROM gauged_data WHERE namespace = %s', params)
        execute('DELETE FROM gauged_statistics WHERE namespace = %s', params)
        execute('DELETE FROM gauged_keys WHERE namespace = %s', params)
        self.remove_cache(namespace)
949632
public static function getNamespace($namespaceClass)
    {
        if (is_object($namespaceClass) === true) {
            $namespaceClass = get_class($namespaceClass);
        }
    
        $lastSlashPosition = mb_strrpos($namespaceClass, '\\');
    
        if ($lastSlashPosition !== false) {
            return mb_substr($namespaceClass, 0, $lastSlashPosition);
        }
    
        return "";
    }
411960
public function clear($namespace='default')
    {
        $cleared = false;

        if (isset($this->addedData[$namespace])) {
            $this->addedData[$namespace] = [];
            $cleared = true;
        }

        if (isset($this->cachedData[$namespace])) {
            $this->cachedData[$namespace] = [];
            $cleared = true;
        }

        if ($cleared) {
            $this->queryHits = [];
        }
    }
195485
def delete_namespace(self, namespace):
        

        # if not self.has_namespace(namespace):
        #     return "Namespace does not exists"

        # log = logging.getLogger("%s.%s" % (self.log_name,
        #                                    inspect.stack()[0][3]))
        # log.setLevel(self.log_level)

        url = self._make_url(namespace).replace("/sparql", "")
        result = requests.delete(url=url)
        if result.status_code == 200:
            log.critical(result.text)
            return result.text
        raise RuntimeError(result.text)
1286613
public function findNamespace($namespace)
    {
        $allNamespaces = $this->getNamespaces();
        $expr = preg_replace_callback('{([^:]+|)}', function ($matches) { return preg_quote($matches[1]).'[^:]*'; }, $namespace);
        $namespaces = preg_grep('{^'.$expr.'}', $allNamespaces);

        if (empty($namespaces)) {
            $message = sprintf('There are no commands defined in the "%s" namespace.', $namespace);

            if ($alternatives = $this->findAlternatives($namespace, $allNamespaces)) {
                if (1 == count($alternatives)) {
                    $message .= "\n\nDid you mean this?\n    ";
                } else {
                    $message .= "\n\nDid you mean one of these?\n    ";
                }

                $message .= implode("\n    ", $alternatives);
            }

            throw new CommandNotFoundException($message, $alternatives);
        }

        $exact = in_array($namespace, $namespaces, true);
        if (count($namespaces) > 1 && !$exact) {
            throw new CommandNotFoundException(sprintf("The namespace \"%s\" is ambiguous.\nDid you mean one of these?\n%s", $namespace, $this->getAbbreviationSuggestions(array_values($namespaces))), array_values($namespaces));
        }

        return $exact ? $namespace : reset($namespaces);
    }
527286
private function writeNamespace($namespace, $files)
    {
        // Initialise:
        
        $result = true;
        
        // Check Namespace Change:
        
        if ($namespace == $this->getConfig('default-app-namespace')) {
            return $result;
        }
        
        // Check Parameters:
        
        if ($namespace && is_array($files)) {
            
            // Iterate Files:
            
            foreach ($files as $file => $escape) {
                
                // Attempt to Process File:
                
                try {
                    
                    // Read File Contents:
                    
                    $contents = file_get_contents($file);
                    
                    // Replace Namespace in Contents:
                    
                    $contents = $this->replaceNamespace($contents, $namespace, $escape);
                    
                    // Write File Contents:
                    
                    file_put_contents($file, $contents);
                    
                    // Define Status:
                    
                    $status = 'success';
                    
                } catch (ErrorException $e) {
                    
                    // Write Debug Info:
                    
                    $this->io()->writeError(
                        sprintf(
                            '<warning>Exception: %s</warning>',
                            $e->getMessage()
                        ),
                        true,
                        IOInterface::DEBUG
                    );
                    
                    // Define Result:
                    
                    $result = false;
                    
                    // Define Status:
                    
                    $status = 'failure';
                    
                }
                
                // Output Status:
                
                $this->io()->write(
                    sprintf(
                        '[%s] %s',
                        $this->color($this->getConfig("text-file-{$status}"), $this->getConfig("fg-{$status}")),
                        $this->color("Writing namespace to '{$file}'...", $this->getConfig('fg-writing'))
                    )
                );
                
            }
            
        }
        
        // Answer Result:
        
        return $result;
    }
155079
public static function cleanClassNamespace($classNamespace)
    {
        if (strpos($classNamespace, '\\'.preg_quote(ClassUtils::MARKER).'\\')) {
            $classNamespace = preg_replace('#^[^\\\\]+\\\\[^\\\\]+\\\\(.*)$#', '$1', $classNamespace);
        }

        return $classNamespace;
    }
1154700
public function findNamespace(string $namespace): string
	{
		$allNamespaces = $this->getNamespaces();

		$expr = preg_replace_callback(
			'{([^:]+|)}',
			function ($matches)
			{
				return preg_quote($matches[1]) . '[^:]*';
			},
			$namespace
		);

		$namespaces = preg_grep('{^' . $expr . '}', $allNamespaces);

		if (empty($namespaces))
		{
			throw new NamespaceNotFoundException(sprintf('There are no commands defined in the "%s" namespace.', $namespace));
		}

		$exact = \in_array($namespace, $namespaces, true);

		if (\count($namespaces) > 1 && !$exact)
		{
			throw new NamespaceNotFoundException(sprintf('The namespace "%s" is ambiguous.', $namespace));
		}

		return $exact ? $namespace : reset($namespaces);
	}