<commit_before>import * as React from 'react';
import { Layout } from '@shopify/polaris';
import WatcherInput from './WatcherInput';
import WatcherCard from './WatcherCard';

export interface Props {
  readonly watcherIds: string[];
}

class Watchers extends React.PureComponent<Props, never> {
  private generateColumn = (number: number): JSX.Element[] => {
    if (this.props.watcherIds.length === 0) {
      return [];
    }

    let column: JSX.Element[] = [];

    for (let i = number; i < this.props.watcherIds.length; i += 3) {
      const id = this.props.watcherIds[i];
      column.push(<WatcherCard watcher={id} key={id} />);
    }

    return column;
  };

  public render() {
    return (
      <Layout>
        <Layout.AnnotatedSection
          title="Add a watcher"
          description="Enter a groupID or a pandA link."
        >
          <WatcherInput />
        </Layout.AnnotatedSection>
        <Layout.Section secondary>{this.generateColumn(0)}</Layout.Section>
        <Layout.Section secondary>{this.generateColumn(1)}</Layout.Section>
        <Layout.Section secondary>{this.generateColumn(2)}</Layout.Section>
      </Layout>
    );
  }
}

export default Watchers;<commit_msg>Generate columns is now a static class method.<commit_after>import * as React from 'react';
import { Layout } from '@shopify/polaris';
import WatcherInput from './WatcherInput';
import WatcherCard from './WatcherCard';

export interface Props {
  readonly watcherIds: string[];
}

class Watchers extends React.PureComponent<Props, never> {
  static generateColumn = (number: number) => (
    watcherIds: string[]
  ): JSX.Element[] => {
    if (watcherIds.length === 0) {
      return [];
    }

    let column: JSX.Element[] = [];

    for (let i = number; i < watcherIds.length; i += 3) {
      const id = watcherIds[i];
      column.push(<WatcherCard watcher={id} key={id} />);
    }

    return column;
  };

  public render() {
    const { watcherIds } = this.props;

    return (
      <Layout>
        <Layout.AnnotatedSection
          title="Add a watcher"
          description="Enter a groupID or a pandA link."
        >
          <WatcherInput />
        </Layout.AnnotatedSection>
        <Layout.Section secondary>
          {Watchers.generateColumn(0)(watcherIds)}
        </Layout.Section>
        <Layout.Section secondary>
          {Watchers.generateColumn(1)(watcherIds)}
        </Layout.Section>
        <Layout.Section secondary>
          {Watchers.generateColumn(2)(watcherIds)}
        </Layout.Section>
      </Layout>
    );
  }
}

export default Watchers;
{'fraction_non_alphanumeric': 0.13557358053302435, 'fraction_numerical': 0.003862495171881035, 'mean_word_length': 2.721264367816092, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 32, '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': '1541826', 'n_tokens_mistral': 785, 'n_tokens_neox': 770, 'n_words': 183}