<commit_before># Change the directionality of a block of CSS code from right-to-left to left-to-right. This includes not only
# altering the <tt>direction</tt> attribute but also altering the 4-argument version of things like <tt>padding</tt>
# to correctly reflect the change. CSS is also minified, in part to make the processing easier.
#
# Author::    <NAME>  (mailto:<EMAIL>)
# Copyright:: Copyright (c) 2011 Twitter, Inc.
# License::   Licensed under the Apache License, Version 2.0
module R2

  # Short cut method for providing a one-time CSS change
  def self.r2(css)
    ::R2::Swapper.new.r2(css)
  end

  # Reuable class for CSS alterations
  class Swapper
    PROPERTY_MAP = {
      'margin-left' => 'margin-right',
      'margin-right' => 'margin-left',

      'padding-left' => 'padding-right',
      'padding-right' => 'padding-left',

      'border-left' => 'border-right',
      'border-right' => 'border-left',

      'border-left-width' => 'border-right-width',
      'border-right-width' => 'border-left-width',

      'border-radius-bottomleft' => 'border-radius-bottomright',
      'border-radius-bottomright' => 'border-radius-bottomleft',
      'border-radius-topleft' => 'border-radius-topright',
      'border-radius-topright' => 'border-radius-topleft',

      '-moz-border-radius-bottomright' => '-moz-border-radius-bottomleft',
      '-moz-border-radius-bottomleft' => '-moz-border-radius-bottomright',
      '-moz-border-radius-topright' => '-moz-border-radius-topleft',
      '-moz-border-radius-topleft' => '-moz-border-radius-topright',

      '-webkit-border-top-right-radius' => '-webkit-border-top-left-radius',
      '-webkit-border-top-left-radius' => '-webkit-border-top-right-radius',
      '-webkit-border-bottom-right-radius' => '-webkit-border-bottom-left-radius',
      '-webkit-border-bottom-left-radius' => '-webkit-border-bottom-right-radius',

      'left' => 'right',
      'right' => 'left'
    }

    VALUE_PROCS = {
      'padding'    => lambda {|obj,val| obj.quad_swap(val) },
      'margin'     => lambda {|obj,val| obj.quad_swap(val) },
      'text-align' => lambda {|obj,val| obj.side_swap(val) },
      'float'      => lambda {|obj,val| obj.side_swap(val) },
      'box-shadow' => lambda {|obj,val| obj.quad_swap(val) },
      '-webkit-box-shadow' => lambda {|obj,val| obj.quad_swap(val) },
      '-moz-box-shadow' => lambda {|obj,val| obj.quad_swap(val) },
      'direction'  => lambda {|obj,val| obj.direction_swap(val) },
      'clear' => lambda {|obj,val| obj.side_swap(val) }
    }

    # Given a String of CSS perform the full directionality change
    def r2(original_css)
      css = minimize(original_css)
<commit_msg>Added border-radius to properties<commit_after># Change the directionality of a block of CSS code from right-to-left to left-to-right. This includes not only
# altering the <tt>direction</tt> attribute but also altering the 4-argument version of things like <tt>padding</tt>
# to correctly reflect the change. CSS is also minified, in part to make the processing easier.
#
# Author::    <NAME>  (mailto:<EMAIL>)
# Copyright:: Copyright (c) 2011 Twitter, Inc.
# License::   Licensed under the Apache License, Version 2.0
module R2

  # Short cut method for providing a one-time CSS change
  def self.r2(css)
    ::R2::Swapper.new.r2(css)
  end

  # Reuable class for CSS alterations
  class Swapper
    PROPERTY_MAP = {
      'margin-left' => 'margin-right',
      'margin-right' => 'margin-left',

      'padding-left' => 'padding-right',
      'padding-right' => 'padding-left',

      'border-left' => 'border-right',
      'border-right' => 'border-left',

      'border-left-width' => 'border-right-width',
      'border-right-width' => 'border-left-width',

      'border-radius-bottomleft' => 'border-radius-bottomright',
      'border-radius-bottomright' => 'border-radius-bottomleft',
      'border-radius-topleft' => 'border-radius-topright',
      'border-radius-topright' => 'border-radius-topleft',

      '-moz-border-radius-bottomright' => '-moz-border-radius-bottomleft',
      '-moz-border-radius-bottomleft' => '-moz-border-radius-bottomright',
      '-moz-border-radius-topright' => '-moz-border-radius-topleft',
      '-moz-border-radius-topleft' => '-moz-border-radius-topright',

      '-webkit-border-top-right-radius' => '-webkit-border-top-left-radius',
      '-webkit-border-top-left-radius' => '-webkit-border-top-right-radius',
      '-webkit-border-bottom-right-radius' => '-webkit-border-bottom-left-radius',
      '-webkit-border-bottom-left-radius' => '-webkit-border-bottom-right-radius',

      'left' => 'right',
      'right' => 'left'
    }

    VALUE_PROCS = {
      'padding'    => lambda {|obj,val| obj.quad_swap(val) },
      'margin'     => lambda {|obj,val| obj.quad_swap(val) },
      'border-radius' => lambda {|obj,val| obj.quad_swap(val) },
      '-moz-border-radius' => lambda {|obj,val| obj.quad_swap(val) },
      '-webkit-border-radius' => lambda {|obj,val| obj.quad_swap(val) },
      'text-align' => lambda {|obj,val| obj.side_swap(val) },
      'float'      => lambda {|obj,val| obj.side_swap(val) },
      'box-shadow' => lambda {|obj,val| obj.quad_swap(val) },
      '-webkit-box-shadow' => lambda {|obj,val| obj.quad_swap(val) },
      '-moz-box-shadow' => lambda {|obj,val| obj.quad_swap(val) },
      'direction'  => lambda {|obj,val| obj.direction_swap(val) },
      'clear' => lambda {|obj,val| obj.side_swap(val) }
    }

    # Given a String of CSS perform the full directionality change
    def r2(original_css)
      css = minimize(original_css)

{'fraction_non_alphanumeric': 0.17256795422031473, 'fraction_numerical': 0.004291845493562232, 'mean_word_length': 3.2021036814425243, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 80, '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': '279244', 'n_tokens_mistral': 1885, 'n_tokens_neox': 1821, 'n_words': 381}