prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Truncate column name is too verbose
  Do we have to have a unique name for the result of such operations?
  
  How about having it renamed to the unit, i.e. instead of `when_datetimetruncate` we use `when_day` or `when_week`, etc?
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `blaze/expr/datetime.py`
  Content:
  ```
  1 from __future__ import absolute_import, division, print_function
  2 
  3 from .expressions import Expr, ElemWise
  4 from datashape import dshape, Record, DataShape, Unit, Option, date_, datetime_
  5 import datashape
  6 
  7 __all__ = ['DateTime', 'Date', 'date', 'Year', 'year', 'Month', 'month', 'Day',
  8         'day', 'Hour', 'hour', 'Second', 'second', 'Millisecond',
  9         'millisecond', 'Microsecond', 'microsecond', 'Date', 'date', 'Time',
  10         'time', 'UTCFromTimestamp', 'DateTimeTruncate']
  11 
  12 class DateTime(ElemWise):
  13     """ Superclass for datetime accessors """
  14     __slots__ = '_hash', '_child',
  15 
  16     def __str__(self):
  17         return '%s.%s' % (str(self._child), type(self).__name__.lower())
  18 
  19     @property
  20     def schema(self):
  21         return dshape(self._dtype)
  22 
  23     @property
  24     def _name(self):
  25         return '%s_%s' % (self._child._name, self.attr)
  26 
  27     @property
  28     def attr(self):
  29         return type(self).__name__.lower()
  30 
  31 
  32 class Date(DateTime):
  33     _dtype = datashape.date_
  34 
  35 def date(expr):
  36     return Date(expr)
  37 
  38 class Year(DateTime):
  39     _dtype = datashape.int32
  40 
  41 def year(expr):
  42     return Year(expr)
  43 
  44 class Month(DateTime):
  45     _dtype = datashape.int32
  46 
  47 def month(expr):
  48     return Month(expr)
  49 
  50 class Day(DateTime):
  51     _dtype = datashape.int32
  52 
  53 def day(expr):
  54     return Day(expr)
  55 
  56 class Time(DateTime):
  57     _dtype = datashape.time_
  58 
  59 def time(expr):
  60     return Time(Expr)
  61 
  62 class Hour(DateTime):
  63     _dtype = datashape.int32
  64 
  65 def hour(expr):
  66     return Hour(expr)
  67 
  68 class Minute(DateTime):
  69     _dtype = datashape.int32
  70 
  71 def minute(expr):
  72     return Minute(expr)
  73 
  74 class Second(DateTime):
  75     _dtype = datashape.int32
  76 
  77 def second(expr):
  78     return Second(expr)
  79 
  80 class Millisecond(DateTime):
  81     _dtype = datashape.int64
  82 
  83 def millisecond(expr):
  84     return Millisecond(expr)
  85 
  86 class Microsecond(DateTime):
  87     _dtype = datashape.int64
  88 
  89 def microsecond(expr):
  90     return Microsecond(expr)
  91 
  92 class UTCFromTimestamp(DateTime):
  93     _dtype = datashape.datetime_
  94 
  95 def utcfromtimestamp(expr):
  96     return UTCFromTimestamp(expr)
  97 
  98 units = ['year', 'month', 'week', 'day', 'hour', 'minute', 'second',
  99 'millisecond', 'microsecond', 'nanosecond']
  100 
  101 
  102 _unit_aliases = {'y': 'year', 'w': 'week', 'd': 'day', 'date': 'day',
  103     'h': 'hour', 's': 'second', 'ms': 'millisecond', 'us': 'microsecond',
  104     'ns': 'nanosecond'}
  105 
  106 def normalize_time_unit(s):
  107     """ Normalize time input to one of 'year', 'second', 'millisecond', etc..
  108 
  109     Example
  110     -------
  111 
  112     >>> normalize_time_unit('milliseconds')
  113     'millisecond'
  114     >>> normalize_time_unit('ms')
  115     'millisecond'
  116     """
  117     s = s.lower().strip()
  118     if s in units:
  119         return s
  120     if s in _unit_aliases:
  121         return _unit_aliases[s]
  122     if s[-1] == 's':
  123         return normalize_time_unit(s.rstrip('s'))
  124 
  125     raise ValueError("Do not understand time unit %s" % s)
  126 
  127 
  128 class DateTimeTruncate(DateTime):
  129     __slots__ = '_hash', '_child', 'measure', 'unit'
  130 
  131     @property
  132     def _dtype(self):
  133         if units.index('day') >= units.index(self.unit):
  134             return datashape.date_
  135         else:
  136             return datashape.datetime_
  137 
  138 
  139 def truncate(expr, *args, **kwargs):
  140     """ Truncate datetime expression
  141 
  142     Example
  143     -------
  144 
  145     >>> from blaze import symbol, compute
  146     >>> from datetime import datetime
  147     >>> s = symbol('s', 'datetime')
  148 
  149     >>> expr = s.truncate(10, 'minutes')
  150     >>> compute(expr, datetime(2000, 6, 25, 12, 35, 10))
  151     datetime.datetime(2000, 6, 25, 12, 30)
  152 
  153     >>> expr = s.truncate(1, 'week')
  154     >>> compute(expr, datetime(2000, 6, 25, 12, 35, 10))
  155     datetime.date(2000, 6, 25)
  156 
  157     Alternatively use keyword arguments to specify unit and measure
  158 
  159     >>> # expr = s.truncate(2, 'weeks')
  160     >>> expr = s.truncate(weeks=2)
  161     """
  162     if args:
  163         assert not kwargs
  164         measure, unit = args
  165     if kwargs:
  166         assert not args
  167         [(unit, measure)] = kwargs.items()
  168     return DateTimeTruncate(expr, measure, normalize_time_unit(unit))
  169 
  170 
  171 from .expressions import schema_method_list, method_properties
  172 from datashape.predicates import isdatelike, isnumeric
  173 
  174 schema_method_list.extend([
  175     (isdatelike, set([year, month, day, hour, minute, date, time, second,
  176                       millisecond, microsecond, truncate])),
  177     (isnumeric, set([utcfromtimestamp]))
  178     ])
  179 
  180 method_properties |= set([year, month, day, hour, minute, second, millisecond,
  181                           microsecond, date, time, utcfromtimestamp])
  182
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/blaze/expr/datetime.py b/blaze/expr/datetime.py
  --- a/blaze/expr/datetime.py
  +++ b/blaze/expr/datetime.py
  @@ -135,6 +135,10 @@
           else:
               return datashape.datetime_
   
  +    @property
  +    def _name(self):
  +        return self._child._name
  +
   
   def truncate(expr, *args, **kwargs):
       """ Truncate datetime expression
  
verification_info: {"golden_diff": "diff --git a/blaze/expr/datetime.py b/blaze/expr/datetime.py\n--- a/blaze/expr/datetime.py\n+++ b/blaze/expr/datetime.py\n@@ -135,6 +135,10 @@\n         else:\n             return datashape.datetime_\n \n+    @property\n+    def _name(self):\n+        return self._child._name\n+\n \n def truncate(expr, *args, **kwargs):\n     \"\"\" Truncate datetime expression\n", "issue": "Truncate column name is too verbose\nDo we have to have a unique name for the result of such operations?\n\nHow about having it renamed to the unit, i.e. instead of `when_datetimetruncate` we use `when_day` or `when_week`, etc?\n\n", "before_files": [{"content": "from __future__ import absolute_import, division, print_function\n\nfrom .expressions import Expr, ElemWise\nfrom datashape import dshape, Record, DataShape, Unit, Option, date_, datetime_\nimport datashape\n\n__all__ = ['DateTime', 'Date', 'date', 'Year', 'year', 'Month', 'month', 'Day',\n        'day', 'Hour', 'hour', 'Second', 'second', 'Millisecond',\n        'millisecond', 'Microsecond', 'microsecond', 'Date', 'date', 'Time',\n        'time', 'UTCFromTimestamp', 'DateTimeTruncate']\n\nclass DateTime(ElemWise):\n    \"\"\" Superclass for datetime accessors \"\"\"\n    __slots__ = '_hash', '_child',\n\n    def __str__(self):\n        return '%s.%s' % (str(self._child), type(self).__name__.lower())\n\n    @property\n    def schema(self):\n        return dshape(self._dtype)\n\n    @property\n    def _name(self):\n        return '%s_%s' % (self._child._name, self.attr)\n\n    @property\n    def attr(self):\n        return type(self).__name__.lower()\n\n\nclass Date(DateTime):\n    _dtype = datashape.date_\n\ndef date(expr):\n    return Date(expr)\n\nclass Year(DateTime):\n    _dtype = datashape.int32\n\ndef year(expr):\n    return Year(expr)\n\nclass Month(DateTime):\n    _dtype = datashape.int32\n\ndef month(expr):\n    return Month(expr)\n\nclass Day(DateTime):\n    _dtype = datashape.int32\n\ndef day(expr):\n    return Day(expr)\n\nclass Time(DateTime):\n    _dtype = datashape.time_\n\ndef time(expr):\n    return Time(Expr)\n\nclass Hour(DateTime):\n    _dtype = datashape.int32\n\ndef hour(expr):\n    return Hour(expr)\n\nclass Minute(DateTime):\n    _dtype = datashape.int32\n\ndef minute(expr):\n    return Minute(expr)\n\nclass Second(DateTime):\n    _dtype = datashape.int32\n\ndef second(expr):\n    return Second(expr)\n\nclass Millisecond(DateTime):\n    _dtype = datashape.int64\n\ndef millisecond(expr):\n    return Millisecond(expr)\n\nclass Microsecond(DateTime):\n    _dtype = datashape.int64\n\ndef microsecond(expr):\n    return Microsecond(expr)\n\nclass UTCFromTimestamp(DateTime):\n    _dtype = datashape.datetime_\n\ndef utcfromtimestamp(expr):\n    return UTCFromTimestamp(expr)\n\nunits = ['year', 'month', 'week', 'day', 'hour', 'minute', 'second',\n'millisecond', 'microsecond', 'nanosecond']\n\n\n_unit_aliases = {'y': 'year', 'w': 'week', 'd': 'day', 'date': 'day',\n    'h': 'hour', 's': 'second', 'ms': 'millisecond', 'us': 'microsecond',\n    'ns': 'nanosecond'}\n\ndef normalize_time_unit(s):\n    \"\"\" Normalize time input to one of 'year', 'second', 'millisecond', etc..\n\n    Example\n    -------\n\n    >>> normalize_time_unit('milliseconds')\n    'millisecond'\n    >>> normalize_time_unit('ms')\n    'millisecond'\n    \"\"\"\n    s = s.lower().strip()\n    if s in units:\n        return s\n    if s in _unit_aliases:\n        return _unit_aliases[s]\n    if s[-1] == 's':\n        return normalize_time_unit(s.rstrip('s'))\n\n    raise ValueError(\"Do not understand time unit %s\" % s)\n\n\nclass DateTimeTruncate(DateTime):\n    __slots__ = '_hash', '_child', 'measure', 'unit'\n\n    @property\n    def _dtype(self):\n        if units.index('day') >= units.index(self.unit):\n            return datashape.date_\n        else:\n            return datashape.datetime_\n\n\ndef truncate(expr, *args, **kwargs):\n    \"\"\" Truncate datetime expression\n\n    Example\n    -------\n\n    >>> from blaze import symbol, compute\n    >>> from datetime import datetime\n    >>> s = symbol('s', 'datetime')\n\n    >>> expr = s.truncate(10, 'minutes')\n    >>> compute(expr, datetime(2000, 6, 25, 12, 35, 10))\n    datetime.datetime(2000, 6, 25, 12, 30)\n\n    >>> expr = s.truncate(1, 'week')\n    >>> compute(expr, datetime(2000, 6, 25, 12, 35, 10))\n    datetime.date(2000, 6, 25)\n\n    Alternatively use keyword arguments to specify unit and measure\n\n    >>> # expr = s.truncate(2, 'weeks')\n    >>> expr = s.truncate(weeks=2)\n    \"\"\"\n    if args:\n        assert not kwargs\n        measure, unit = args\n    if kwargs:\n        assert not args\n        [(unit, measure)] = kwargs.items()\n    return DateTimeTruncate(expr, measure, normalize_time_unit(unit))\n\n\nfrom .expressions import schema_method_list, method_properties\nfrom datashape.predicates import isdatelike, isnumeric\n\nschema_method_list.extend([\n    (isdatelike, set([year, month, day, hour, minute, date, time, second,\n                      millisecond, microsecond, truncate])),\n    (isnumeric, set([utcfromtimestamp]))\n    ])\n\nmethod_properties |= set([year, month, day, hour, minute, second, millisecond,\n                          microsecond, date, time, utcfromtimestamp])\n", "path": "blaze/expr/datetime.py"}], "after_files": [{"content": "from __future__ import absolute_import, division, print_function\n\nfrom .expressions import Expr, ElemWise\nfrom datashape import dshape, Record, DataShape, Unit, Option, date_, datetime_\nimport datashape\n\n__all__ = ['DateTime', 'Date', 'date', 'Year', 'year', 'Month', 'month', 'Day',\n        'day', 'Hour', 'hour', 'Second', 'second', 'Millisecond',\n        'millisecond', 'Microsecond', 'microsecond', 'Date', 'date', 'Time',\n        'time', 'UTCFromTimestamp', 'DateTimeTruncate']\n\nclass DateTime(ElemWise):\n    \"\"\" Superclass for datetime accessors \"\"\"\n    __slots__ = '_hash', '_child',\n\n    def __str__(self):\n        return '%s.%s' % (str(self._child), type(self).__name__.lower())\n\n    @property\n    def schema(self):\n        return dshape(self._dtype)\n\n    @property\n    def _name(self):\n        return '%s_%s' % (self._child._name, self.attr)\n\n    @property\n    def attr(self):\n        return type(self).__name__.lower()\n\n\nclass Date(DateTime):\n    _dtype = datashape.date_\n\ndef date(expr):\n    return Date(expr)\n\nclass Year(DateTime):\n    _dtype = datashape.int32\n\ndef year(expr):\n    return Year(expr)\n\nclass Month(DateTime):\n    _dtype = datashape.int32\n\ndef month(expr):\n    return Month(expr)\n\nclass Day(DateTime):\n    _dtype = datashape.int32\n\ndef day(expr):\n    return Day(expr)\n\nclass Time(DateTime):\n    _dtype = datashape.time_\n\ndef time(expr):\n    return Time(Expr)\n\nclass Hour(DateTime):\n    _dtype = datashape.int32\n\ndef hour(expr):\n    return Hour(expr)\n\nclass Minute(DateTime):\n    _dtype = datashape.int32\n\ndef minute(expr):\n    return Minute(expr)\n\nclass Second(DateTime):\n    _dtype = datashape.int32\n\ndef second(expr):\n    return Second(expr)\n\nclass Millisecond(DateTime):\n    _dtype = datashape.int64\n\ndef millisecond(expr):\n    return Millisecond(expr)\n\nclass Microsecond(DateTime):\n    _dtype = datashape.int64\n\ndef microsecond(expr):\n    return Microsecond(expr)\n\nclass UTCFromTimestamp(DateTime):\n    _dtype = datashape.datetime_\n\ndef utcfromtimestamp(expr):\n    return UTCFromTimestamp(expr)\n\nunits = ['year', 'month', 'week', 'day', 'hour', 'minute', 'second',\n'millisecond', 'microsecond', 'nanosecond']\n\n\n_unit_aliases = {'y': 'year', 'w': 'week', 'd': 'day', 'date': 'day',\n    'h': 'hour', 's': 'second', 'ms': 'millisecond', 'us': 'microsecond',\n    'ns': 'nanosecond'}\n\ndef normalize_time_unit(s):\n    \"\"\" Normalize time input to one of 'year', 'second', 'millisecond', etc..\n\n    Example\n    -------\n\n    >>> normalize_time_unit('milliseconds')\n    'millisecond'\n    >>> normalize_time_unit('ms')\n    'millisecond'\n    \"\"\"\n    s = s.lower().strip()\n    if s in units:\n        return s\n    if s in _unit_aliases:\n        return _unit_aliases[s]\n    if s[-1] == 's':\n        return normalize_time_unit(s.rstrip('s'))\n\n    raise ValueError(\"Do not understand time unit %s\" % s)\n\n\nclass DateTimeTruncate(DateTime):\n    __slots__ = '_hash', '_child', 'measure', 'unit'\n\n    @property\n    def _dtype(self):\n        if units.index('day') >= units.index(self.unit):\n            return datashape.date_\n        else:\n            return datashape.datetime_\n\n    @property\n    def _name(self):\n        return self._child._name\n\n\ndef truncate(expr, *args, **kwargs):\n    \"\"\" Truncate datetime expression\n\n    Example\n    -------\n\n    >>> from blaze import symbol, compute\n    >>> from datetime import datetime\n    >>> s = symbol('s', 'datetime')\n\n    >>> expr = s.truncate(10, 'minutes')\n    >>> compute(expr, datetime(2000, 6, 25, 12, 35, 10))\n    datetime.datetime(2000, 6, 25, 12, 30)\n\n    >>> expr = s.truncate(1, 'week')\n    >>> compute(expr, datetime(2000, 6, 25, 12, 35, 10))\n    datetime.date(2000, 6, 25)\n\n    Alternatively use keyword arguments to specify unit and measure\n\n    >>> # expr = s.truncate(2, 'weeks')\n    >>> expr = s.truncate(weeks=2)\n    \"\"\"\n    if args:\n        assert not kwargs\n        measure, unit = args\n    if kwargs:\n        assert not args\n        [(unit, measure)] = kwargs.items()\n    return DateTimeTruncate(expr, measure, normalize_time_unit(unit))\n\n\nfrom .expressions import schema_method_list, method_properties\nfrom datashape.predicates import isdatelike, isnumeric\n\nschema_method_list.extend([\n    (isdatelike, set([year, month, day, hour, minute, date, time, second,\n                      millisecond, microsecond, truncate])),\n    (isnumeric, set([utcfromtimestamp]))\n    ])\n\nmethod_properties |= set([year, month, day, hour, minute, second, millisecond,\n                          microsecond, date, time, utcfromtimestamp])\n", "path": "blaze/expr/datetime.py"}]}