<commit_before>import {
  defaults,
  compact,
  concat,
  take,
  assign,
  first,
} from 'lodash';
import { exclude } from '../../lib/helpers';
import cached from '../fields/cached';
import initials from '../fields/initials';
import markdown from '../fields/markdown';
import numeral from '../fields/numeral';
import Image from '../image';
import Article from '../article';
import Artwork from '../artwork';
import PartnerArtist from '../partner_artist';
import Meta from './meta';
import PartnerShow from '../partner_show';
import Sale from '../sale/index';
import ArtworkSorts from '../sorts/artwork_sorts';
import ArticleSorts from '../sorts/article_sorts';
import PartnerShowSorts from '../sorts/partner_show_sorts';
import SaleSorts from '../sale/sorts';
import ArtistCarousel from './carousel';
import ArtistStatuses from './statuses';
import gravity from '../../lib/loaders/gravity';
import positron from '../../lib/loaders/positron';
import total from '../../lib/loaders/total';
import {
  GraphQLObjectType,
  GraphQLBoolean,
  GraphQLString,
  GraphQLNonNull,
  GraphQLList,
  GraphQLInt,
  GraphQLEnumType,
} from 'graphql';

const ArtistType = new GraphQLObjectType({
  name: 'Artist',
  fields: () => {
    return {
      cached,
      _id: {
        type: GraphQLString,
      },
      id: {
        type: GraphQLString,
      },
      href: {
        type: GraphQLString,
        resolve: (artist) => `/artist/${artist.id}`,
      },
      sortable_id: {
        type: GraphQLString,
        description: 'Use this attribute to sort by when sorting a collection of Artists',
      },
      name: {
        type: GraphQLString,
      },
      initials: initials('name'),
      gender: {
        type: GraphQLString,
      },
      years: {
        type: GraphQLString,
      },
      is_public: {
        type: GraphQLBoolean,
        resolve: artist => artist.public,
      },
      is_consignable: {
        type: GraphQLBoolean,
        resolve: ({ consignable }) => consignable,
      },
      public: {
        type: GraphQLBoolean,
        deprecationReason: 'Favor `is_`-prefixed boolean attributes',
      },
      consignable: {
        type: GraphQLBoolean,
        deprecationReason: 'Favor `is_`-prefixed boolean attributes',
      },
      is_display_auction_link: {
        type: GraphQLBoolean,
        resolve: ({ display_auction_link }) => display_auction_link,
      },
      display_auction_link: {
        type: GraphQLBoolean,
        deprecationReason: 'Favor `is_`-prefixed boolean attributes',
      },
      has_metadata: {
        type: GraphQLBoolean,
        resolve: ({ blurb, nationality, years, hometown, location }) => {
          return !!(blurb || nationality || years || hometown || location);
        },
      },
      hometown: {
        type: GraphQLString,
      },
      location: {
        type: GraphQLString,
      },
      nationality: {
        type: GraphQLString,
      },
      birthday: {
        type: GraphQLString,
      },
      deathday: {
        type: GraphQLString,
      },
      biography: {
        type: Article.type,
        description: 'The Artist biography article written by Artsy',
        resolve: ({ _id }) => {
          return positron('articles', {
            published: true,
            biography_for_artist_id: _id,
            limit: 1,
          }).then(articles => first(articles.results));
        },
      },
      alternate_names: {
        type: new GraphQLList(GraphQLString),
      },
      meta: Meta,
      blurb: assign({}, markdown(), {
        resolve: (artist, args, ast) => {
          const blurb = markdown().resolve(artist, args, ast);
          if (!blurb.length) {
            return blurb;
          }
          return gravity(`artist/${artist.id}/partner_artists`, {
            size: 1,
          }).then(({ biography }) => biography);
        },
      }),
      is_shareable: {
        type: GraphQLBoolean,
        resolve: (artist) => artist.published_artworks_count > 0,<commit_msg>use new sort and filter<commit_after>import {
  defaults,
  compact,
  concat,
  take,
  assign,
  first,
} from 'lodash';
import { exclude } from '../../lib/helpers';
import cached from '../fields/cached';
import initials from '../fields/initials';
import markdown from '../fields/markdown';
import numeral from '../fields/numeral';
import Image from '../image';
import Article from '../article';
import Artwork from '../artwork';
import PartnerArtist from '../partner_artist';
import Meta from './meta';
import PartnerShow from '../partner_show';
import Sale from '../sale/index';
import ArtworkSorts from '../sorts/artwork_sorts';
import ArticleSorts from '../sorts/article_sorts';
import PartnerShowSorts from '../sorts/partner_show_sorts';
import SaleSorts from '../sale/sorts';
import ArtistCarousel from './carousel';
import ArtistStatuses from './statuses';
import gravity from '../../lib/loaders/gravity';
import positron from '../../lib/loaders/positron';
import total from '../../lib/loaders/total';
import {
  GraphQLObjectType,
  GraphQLBoolean,
  GraphQLString,
  GraphQLNonNull,
  GraphQLList,
  GraphQLInt,
  GraphQLEnumType,
} from 'graphql';

const ArtistType = new GraphQLObjectType({
  name: 'Artist',
  fields: () => {
    return {
      cached,
      _id: {
        type: GraphQLString,
      },
      id: {
        type: GraphQLString,
      },
      href: {
        type: GraphQLString,
        resolve: (artist) => `/artist/${artist.id}`,
      },
      sortable_id: {
        type: GraphQLString,
        description: 'Use this attribute to sort by when sorting a collection of Artists',
      },
      name: {
        type: GraphQLString,
      },
      initials: initials('name'),
      gender: {
        type: GraphQLString,
      },
      years: {
        type: GraphQLString,
      },
      is_public: {
        type: GraphQLBoolean,
        resolve: artist => artist.public,
      },
      is_consignable: {
        type: GraphQLBoolean,
        resolve: ({ consignable }) => consignable,
      },
      public: {
        type: GraphQLBoolean,
        deprecationReason: 'Favor `is_`-prefixed boolean attributes',
      },
      consignable: {
        type: GraphQLBoolean,
        deprecationReason: 'Favor `is_`-prefixed boolean attributes',
      },
      is_display_auction_link: {
        type: GraphQLBoolean,
        resolve: ({ display_auction_link }) => display_auction_link,
      },
      display_auction_link: {
        type: GraphQLBoolean,
        deprecationReason: 'Favor `is_`-prefixed boolean attributes',
      },
      has_metadata: {
        type: GraphQLBoolean,
        resolve: ({ blurb, nationality, years, hometown, location }) => {
          return !!(blurb || nationality || years || hometown || location);
        },
      },
      hometown: {
        type: GraphQLString,
      },
      location: {
        type: GraphQLString,
      },
      nationality: {
        type: GraphQLString,
      },
      birthday: {
        type: GraphQLString,
      },
      deathday: {
        type: GraphQLString,
      },
      biography: {
        type: Article.type,
        description: 'The Artist biography article written by Artsy',
        resolve: ({ _id }) => {
          return positron('articles', {
            published: true,
            biography_for_artist_id: _id,
            limit: 1,
          }).then(articles => first(articles.results));
        },
      },
      alternate_names: {
        type: new GraphQLList(GraphQLString),
      },
      meta: Meta,
      blurb: assign({}, markdown(), {
        resolve: (artist, args, ast) => {
          const blurb = markdown().resolve(artist, args, ast);
          if (blurb.length) {
            return blurb;
          }
          return gravity(`artist/${artist.id}/partner_artists`, {
            size: 1,
            sort: '-published_artworks_count',
            has_biography: true,
          }).then(({ biography }) => biography);
        },
      }),
      is_shareable: {
        type: GraphQLBoolean,
        resolve: (artist) => artist.published_artworks_count > 0,
{'fraction_non_alphanumeric': 0.13147164215989127, 'fraction_numerical': 0.0007413814407512665, 'mean_word_length': 2.209357652656622, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4516591', 'n_tokens_mistral': 2382, 'n_tokens_neox': 2357, 'n_words': 571}