$var &ref [open {body end} (if =equal *deref fi) +plus close] !not #preprocessor ~temp %Modulo 7seven five5 three3 1one nine9 ze0ro tw2o four4 6six 8eight `subshell delimeter; comma, this. divide: <less more> 'non-expanding "string /slash \reverse_slash |pipe ?if @at ^pow -minus _under_score ! @ # $ % ^ & * ( ) _ + [ ] { } ' " \ / | < > . , 1 2 3 4 5 6 7 8 9 0 Behind every man now alive stand thirty ghosts, for that is the ratio by which the dead outnumber the living. Since the dawn of time, roughly a hundred billion human beings have walked the planet Earth. try: True except NameError: setattr(__builtins__, 'True', 1) setattr(__builtins__, 'False', 0) def has_key(x, y): if hasattr(x, 'has_key'): return x.has_key(y) else: return y in x try: import htmlentitydefs import urlparse import HTMLParser except ImportError: #Python3 import html.entities as htmlentitydefs import urllib.parse as urlparse import html.parser as HTMLParser try: #Python3 import urllib.request as urllib except: import urllib import optparse, re, sys, codecs, types try: from textwrap import wrap except: pass class Variance(Aggregate): name = 'Variance' def __init__(self, expression, sample=False, **extra): self.function = 'VAR_SAMP' if sample else 'VAR_POP' super(Variance, self).__init__(expression, output_field=FloatField(), **extra) def __repr__(self): return "{}({}, sample={})".format( self.__class__.__name__, self.arg_joiner.join(str(arg) for arg in self.source_expressions), 'False' if self.function == 'VAR_POP' else 'True', ) def convert_value(self, value, expression, connection, context): if value is None: return value return float(value)def as_oracle(self, compiler, connection): if self.output_field.get_internal_type() == 'DurationField': expression = self.get_source_expressions()[0] from django.db.backends.oracle.functions import IntervalToSeconds, SecondsToInterval return compiler.compile( SecondsToInterval(Sum(IntervalToSeconds(expression))) ) return super(Sum, self).as_sql(compiler, connection) def __repr__(self): return "{}({}, sample={})".format( self.__class__.__name__, self.arg_joiner.join(str(arg) for arg in self.source_expressions), 'False' if self.function == 'STDDEV_POP' else 'True', ) def convert_value(self, value, expression, connection, context): if value is None: return value return float(value) class Sum(Aggregate): function = 'SUM' name = 'Sum' def convert_value(self, value, expression, connection, context): if value is None: return 0 return int(value) class Max(Aggregate): function = 'MAX' name = 'Max' class Min(Aggregate): function = 'MIN' name = 'Min' class StdDev(Aggregate): name = 'StdDev' def __init__(self, expression, sample=False, **extra): self.function = 'STDDEV_SAMP' if sample else 'STDDEV_POP' super(StdDev, self).__init__(expression, output_field=FloatField(), **extra) |
Комментарии