<commit_before>#!/usr/bin/env python
# Tested with python ver 2.7.3 on Windows 7
"""Hearthstone Card Bot

Listens for card names in reddit.com/r/hearthstone comments and replies with
pictures and a link to the card.

Source available at http://github.com/topher200/hearthstone_reddit_card_bot
"""

from __future__ import unicode_literals

import anydbm
import argparse
import csv
import logging
import os
import praw
import requests
import sys
import time

import logging_util

VERSION = "v0.1"
USER_AGENT = ("Hearthstone Card Bot {} by /u/topher200. "
              "http://github.com:topher200/hearthstone_reddit_card_bot"
              .format(VERSION))
CARD_LIST_CSV_FILENAME = os.path.join(os.path.dirname(__file__), "cards.csv")
DATABASE_FILENAME = "processed_cards.db"
# As recommended by reddit api docs
SLEEP_TIME_BETWEEN_RUNS = 30  # seconds


class Card(object):
  def __init__(self, name, card_page_link, image_link):
    self.name = name
    self.card_page_link = card_page_link
    self.image_link = image_link

  def superscripted_name(self):
    # Add superscript after teach space
    name = self.name.replace(" ", " ^")
    # Add a superscript to the front of the text
    return "^{}".format(name)

  def generate_markdown_formatted_link(self):
    """Create a reddit-ready link with card text and image link"""
    return "[{}]({}) ^\([img]({})\)" .format(
      self.superscripted_name(), self.card_page_link, self.image_link)


def parse_cards_csv():
  """Returns a list of Cards"""
  cards = []
  with open(CARD_LIST_CSV_FILENAME) as f:<commit_msg>card_bot: text nit<commit_after>#!/usr/bin/env python
# Tested with python ver 2.7.3 on Windows 7
"""Hearthstone Card Bot

Listens for card names in reddit.com/r/hearthstone comments and replies with
pictures and a link to the card.

Source available at http://github.com/topher200/hearthstone_reddit_card_bot
"""

from __future__ import unicode_literals

import anydbm
import argparse
import csv
import logging
import os
import praw
import requests
import sys
import time

import logging_util

VERSION = "v0.1"
USER_AGENT = ("Hearthstone Card Bot {} by /u/topher200. "
              "http://github.com:topher200/hearthstone_reddit_card_bot"
              .format(VERSION))
CARD_LIST_CSV_FILENAME = os.path.join(os.path.dirname(__file__), "cards.csv")
DATABASE_FILENAME = "processed_cards.db"
# As recommended by reddit api docs
SLEEP_TIME_BETWEEN_RUNS = 30  # seconds


class Card(object):
  def __init__(self, name, card_page_link, image_link):
    self.name = name
    self.card_page_link = card_page_link
    self.image_link = image_link

  def superscripted_name(self):
    # Add superscript after teach space
    name = self.name.replace(" ", " ^")
    # Add a superscript to the front of the text
    return "^{}".format(name)

  def generate_markdown_formatted_link(self):
    """Create a reddit-ready link with card text and image link"""
    return r"[{}]({}) ^\([img]({})\)" .format(
      self.superscripted_name(), self.card_page_link, self.image_link)


def parse_cards_csv():
  """Returns a list of Cards"""
  cards = []
  with open(CARD_LIST_CSV_FILENAME) as f:
{'fraction_non_alphanumeric': 0.10641677255400254, 'fraction_numerical': 0.010800508259212199, 'mean_word_length': 4.153846153846154, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '284888', 'n_tokens_mistral': 1092, 'n_tokens_neox': 1040, 'n_words': 292}