Calling contentItem->taxonomyKey() (post->categories())
should return the taxonomy with a key of 'categories'
given the ContentItem has a term belonging to that taxonomy.
431710
function it_returns_a_taxonomy_if_you_access_a_property_matching_the_taxonomy_key()
    {
        $term = $this->getTestTerm();

        $this->addTerm($term);

        $this->categories()->shouldHaveType(Taxonomy::class);
    }
970297
private function getCategoryCollection()
    {
        $categoryCollection = null;

        $suggestedTerms = $this->getSuggestedTerms();
        $terms          = [$this->queryFactory->get()->getQueryText()];

        if (!empty($suggestedTerms)) {
            $terms = array_merge($terms, $suggestedTerms);
        }

        $categoryCollection = $this->categoryCollectionFactory->create();
        $categoryCollection->addAttributeToSelect("is_active");
        $categoryCollection->setSearchQuery($terms);
        $categoryCollection->setPageSize($this->getResultsPageSize());

        return $categoryCollection;
    }
169843
private <T> CategoryRegistry<T> getRegistry(final Class<T> pCategory) {
        @SuppressWarnings({"unchecked"})
        CategoryRegistry<T> registry = categoryMap.get(pCategory);
        if (registry == null) {
            throw new IllegalArgumentException("No such category: " + pCategory.getName());
        }
        return registry;
    }
321297
def get_category(category_string, model=Category):
    
    model_class = get_cat_model(model)
    category = str(category_string).strip("'\"")
    category = category.strip('/')

    cat_list = category.split('/')
    if len(cat_list) == 0:
        return None
    try:
        categories = model_class.objects.filter(name=cat_list[-1], level=len(cat_list) - 1)
        if len(cat_list) == 1 and len(categories) > 1:
            return None
        # If there is only one, use it. If there is more than one, check
        # if the parent matches the parent passed in the string
        if len(categories) == 1:
            return categories[0]
        else:
            for item in categories:
                if item.parent.name == cat_list[-2]:
                    return item
    except model_class.DoesNotExist:
        return None
1128769
public function getTaxonomyKey()
    {
        $called_class_segments = explode('\\', get_called_class());
        $class_name = end($called_class_segments);
        return (is_null($this->taxonomy_key))
            ? Str::machine(Str::camelToHuman($class_name), Base::SEPARATOR)
            : $this->taxonomy_key;
    }
963883
def getCategoryContent(self, category, excludeRead=False, continuation=None, loadLimit=20, since=None, until=None):
        
        return self._getFeedContent(category.fetchUrl, excludeRead, continuation, loadLimit, since, until)
370230
public function getTaxonomyKey($key, $taxonomy = array())
    {
        if (is_string($key)) {
            return $key;
        }
        if (is_array($taxonomy) && array_key_exists('label', $taxonomy)) {
            return Str::machine($taxonomy['label'], Base::SEPARATOR);
        }
        return $key;
    }
922891
def get_new_category(self, api_category):
        
        return Category(site_id=self.site_id,
                        wp_id=api_category["ID"],
                        **self.api_object_data("category", api_category))
370529
public function get_category($key = 0)
	{
		$categories = $this->get_categories();
		if (isset($categories[$key]))
		{
			return $categories[$key];
		}
		else
		{
			return null;
		}
	}
681030
protected function set_items() {
		$taxonomy         = get_query_var( 'taxonomy' );
		$term             = get_term_by( 'slug', get_query_var( 'term' ), $taxonomy );
		$taxonomy_objects = get_taxonomy( $taxonomy );
		$post_types       = $taxonomy_objects->object_type;
		$post_type        = array_shift( $post_types );

		if ( $post_type ) {
			$post_type_object = get_post_type_object( $post_type );
			$label = $post_type_object->label;
			if ( $post_type_object->has_archive ) {
				$this->set( $label, $this->get_post_type_archive_link( $post_type ) );
			}
		}

		if ( is_taxonomy_hierarchical( $taxonomy ) && $term->parent ) {
			$this->set_ancestors( $term->term_id, $taxonomy );
		}

		$this->set( $this->get_the_archive_title() );
	}
124401
public PostBuilder withCategories(Term... terms) {
        return withCategories(Arrays.stream(terms).map(Term::getId).collect(toList()));
    }
903970
public function get($category, $key = null, $default = null)
    {
        $this->load($category);

        if ($key === null) {
            return isset($this->items[$category]) && !empty($this->items[$category]) ? $this->items[$category] : $default;
        }

        if (is_string($key)) {
            return isset($this->items[$category][$key]) ? $this->items[$category][$key] : $default;
        }

        if (is_array($key)) {
            $result = [];
            foreach ($key as $val) {
                $result[$val] = isset($this->items[$category][$val]) ? $this->items[$category][$val] : (is_array($default) && isset($default[$val]) ? $default[$val] : null);
            }
            return $result;
        }

        return $default;
    }
221649
public function getCategory($key)
    {
        return array_key_exists($key, $this->_categories) ? $this->_categories[$key] : null;
    }
988927
public function getCategory()
    {
        try {
            $category = $this->coreRegistry->registry('current_category');
            if ($category instanceof CategoryModel) {
                $categoryList = [];

                $categoryIds = $this->removeDefaultCategories($category->getPathIds());

                $linkField = 'entity_id';
                if (class_exists('Magento\Framework\EntityManager\MetadataPool')) {
                    // @codingStandardsIgnoreLine
                    $metadataPool = $this->objectManager->create(
                        'Magento\Framework\EntityManager\MetadataPool'
                    );
                    $linkField = $metadataPool->getMetadata(CategoryInterface::class)->getLinkField();
                }

                /** @var \Magento\Catalog\Model\ResourceModel\Category\Collection $categoryCollection */
                $categoryCollection = $this->categoryCollectionFactory->create()
                    ->setStore($this->storeManager->getStore())
                    ->addAttributeToSelect('name')
                    ->addFieldToFilter($linkField, ['in' => $categoryIds]);

                /** @var Category $category */
                foreach ($categoryCollection as $categoryItem) {
                    $categoryList[] = $categoryItem->getName();
                }

                return [
                    'names' => $categoryList,
                    'ids'   => $categoryIds,
                ];
            }
        } catch (\Exception $e) {
            throw $e;
        }
        return false;
    }
174493
def update_catagory(netid, category_code, status):
    
    url = "{0}/category".format(url_version())
    body = {
        "categoryCode": category_code,
        "status": status,
        "categoryList": [{"netid": netid}]
    }

    response = post_resource(url, json.dumps(body))
    return json.loads(response)
993146
function ( ) {
				_PinCategories = _PinCategories.sort ( 
					function ( a, b ) {
						return a.CategoryName.localeCompare 
						( 
							b.CategoryName,
							_Translator.UserLanguage
						);
					} 
				);
			}
49204
def _category_slugs(self, category):
        """"""
        key = self._category_key(category)
        slugs = self.r.smembers(key)
        return slugs