Module Import alias calendar ImportFrom collections alias defaultdict alias namedtuple ImportFrom datetime alias datetime Import alias functools Import alias json Import alias logging ImportFrom urllib alias urlencode ImportFrom django.http alias Http404 ImportFrom django.utils alias html ImportFrom django.utils.safestring alias mark_safe ImportFrom django.conf alias settings ImportFrom django.core.validators alias validate_email ImportFrom django.utils.translation alias ugettext identifier _ ImportFrom django.utils.translation alias ugettext_noop ImportFrom sqlalchemy.util alias immutabledict ImportFrom corehq.apps.app_manager.dbaccessors alias get_app ImportFrom corehq.apps.app_manager.models alias Form alias RemoteApp ImportFrom corehq.apps.app_manager.util alias get_case_properties ImportFrom corehq.apps.cachehq.mixins alias CachedCouchDocumentMixin alias QuickCachedDocumentMixin ImportFrom corehq.apps.domain.middleware alias CCHQPRBACMiddleware ImportFrom corehq.apps.domain.models alias Domain ImportFrom corehq.apps.hqwebapp.tasks alias send_html_email_async ImportFrom corehq.apps.reports.daterange alias get_daterange_start_end_dates alias get_all_daterange_slugs ImportFrom corehq.apps.reports.dbaccessors alias hq_group_export_configs_by_domain alias stale_get_exports_json ImportFrom corehq.apps.reports.dispatcher alias ProjectReportDispatcher alias CustomProjectReportDispatcher ImportFrom corehq.apps.reports.display alias xmlns_to_name ImportFrom corehq.apps.reports.exceptions alias InvalidDaterangeException alias UnsupportedSavedReportError alias UnsupportedScheduledReportError ImportFrom corehq.apps.reports.exportfilters alias default_case_filter alias default_form_filter alias form_matches_users alias is_commconnect_form ImportFrom corehq.apps.userreports.util alias default_language identifier ucr_default_language alias localize identifier ucr_localize ImportFrom corehq.apps.users.dbaccessors alias get_user_docs_by_username ImportFrom corehq.apps.users.models alias WebUser alias CommCareUser alias CouchUser ImportFrom corehq.util.quickcache alias quickcache ImportFrom corehq.util.translation alias localize ImportFrom corehq.util.view_utils alias absolute_reverse ImportFrom couchexport.models alias SavedExportSchema alias GroupExportConfiguration alias DefaultExportSchema alias SplitColumn ImportFrom couchexport.transforms alias couch_to_excel_datetime alias identity ImportFrom couchexport.util alias SerializableFunction ImportFrom couchforms.filters alias instances ImportFrom dimagi.ext.couchdbkit alias * ImportFrom dimagi.utils.couch.cache alias cache_core ImportFrom dimagi.utils.decorators.memoized alias memoized ImportFrom dimagi.utils.logging alias notify_exception ImportFrom django_prbac.exceptions alias PermissionDenied ClassDef HQUserType bases NameLoad object body Assign NameStore REGISTERED Num 0 Assign NameStore DEMO_USER Num 1 Assign NameStore ADMIN Num 2 Assign NameStore UNKNOWN Num 3 Assign NameStore COMMTRACK Num 4 Assign NameStore human_readable ListLoad AttributeLoad NameLoad settings attr COMMCARE_USER_TERM Call NameLoad ugettext_noop Str demo_user Call NameLoad ugettext_noop Str admin Call NameLoad ugettext_noop Str Unknown-Users Call NameLoad ugettext_noop Str CommCare-Supply Assign NameStore toggle_defaults TupleLoad NameLoad True NameLoad False NameLoad False NameLoad False NameLoad False Assign NameStore count Call NameLoad len NameLoad human_readable Assign NameStore included_defaults TupleLoad NameLoad True NameLoad True NameLoad True NameLoad True NameLoad False FunctionDef use_defaults arguments args NameParam cls defaults body Return Call AttributeLoad NameLoad cls attr _get_manual_filterset AttributeLoad NameLoad cls attr included_defaults AttributeLoad NameLoad cls attr toggle_defaults decorator_list NameLoad classmethod FunctionDef all_but_users arguments args NameParam cls defaults body Assign NameStore no_users BinOpMult ListLoad NameLoad True AttributeLoad NameLoad cls attr count Assign SubscriptStore NameLoad no_users Index AttributeLoad NameLoad cls attr REGISTERED NameLoad False Return Call AttributeLoad NameLoad cls attr _get_manual_filterset AttributeLoad NameLoad cls attr included_defaults NameLoad no_users decorator_list NameLoad classmethod FunctionDef commtrack_defaults arguments args NameParam cls defaults body Return Call AttributeLoad NameLoad cls attr all decorator_list NameLoad classmethod FunctionDef all arguments args NameParam cls defaults body Assign NameStore defaults BinOpMult TupleLoad NameLoad True AttributeLoad NameLoad cls attr count Return Call AttributeLoad NameLoad cls attr _get_manual_filterset NameLoad defaults AttributeLoad NameLoad cls attr toggle_defaults decorator_list NameLoad classmethod FunctionDef _get_manual_filterset arguments args NameParam cls NameParam included NameParam defaults defaults body Expr Str manually-construct-a-filter-set.-included-and-defaults-should-both-be--------arrays-of-booleans-mapping-to-values-in-human_readable-and-whether-they-should-be--------included-and-defaulted,-respectively. Return ListComp Call NameLoad HQUserToggle NameLoad i SubscriptLoad NameLoad defaults Index NameLoad i comprehension NameStore i Call NameLoad range AttributeLoad NameLoad cls attr count SubscriptLoad NameLoad included Index NameLoad i decorator_list NameLoad classmethod FunctionDef use_filter arguments args NameParam cls NameParam ufilter defaults body Return ListComp Call NameLoad HQUserToggle NameLoad i CompareIn Call NameLoad unicode NameLoad i NameLoad ufilter comprehension NameStore i Call NameLoad range AttributeLoad NameLoad cls attr count decorator_list NameLoad classmethod decorator_list ClassDef HQToggle bases NameLoad object body Assign NameStore type NameLoad None Assign NameStore show NameLoad False Assign NameStore name NameLoad None FunctionDef __init__ arguments args NameParam self NameParam type NameParam show NameParam name defaults body Assign AttributeStore NameLoad self attr type NameLoad type Assign AttributeStore NameLoad self attr name NameLoad name Assign AttributeStore NameLoad self attr show NameLoad show decorator_list FunctionDef __repr__ arguments args NameParam self defaults body Return BinOpMod Str %(klass)s[%(type)s:%(show)s:%(name)s] Call NameLoad dict keyword klass AttributeLoad AttributeLoad NameLoad self attr __class__ attr __name__ keyword type AttributeLoad NameLoad self attr type keyword name AttributeLoad NameLoad self attr name keyword show AttributeLoad NameLoad self attr show decorator_list decorator_list ClassDef HQUserToggle bases NameLoad HQToggle body FunctionDef __init__ arguments args NameParam self NameParam type NameParam show defaults body Assign NameStore name Call NameLoad _ SubscriptLoad AttributeLoad NameLoad HQUserType attr human_readable Index NameLoad type Expr Call AttributeLoad Call NameLoad super NameLoad HQUserToggle NameLoad self attr __init__ NameLoad type NameLoad show NameLoad name decorator_list decorator_list ClassDef TempCommCareUser bases NameLoad CommCareUser body Assign NameStore filter_flag Call NameLoad IntegerProperty FunctionDef __init__ arguments args NameParam self NameParam domain NameParam username NameParam uuid defaults body If CompareEq NameLoad username SubscriptLoad AttributeLoad NameLoad HQUserType attr human_readable Index AttributeLoad NameLoad HQUserType attr DEMO_USER body Assign NameStore filter_flag AttributeLoad NameLoad HQUserType attr DEMO_USER orelse If CompareEq NameLoad username SubscriptLoad AttributeLoad NameLoad HQUserType attr human_readable Index AttributeLoad NameLoad HQUserType attr ADMIN body Assign NameStore filter_flag AttributeLoad NameLoad HQUserType attr ADMIN orelse Assign NameStore filter_flag AttributeLoad NameLoad HQUserType attr UNKNOWN Expr Call AttributeLoad Call NameLoad super NameLoad TempCommCareUser NameLoad self attr __init__ keyword domain NameLoad domain keyword username NameLoad username keyword _id NameLoad uuid keyword date_joined Call AttributeLoad NameLoad datetime attr utcnow keyword is_active NameLoad False keyword user_data Dict keyword first_name Str null keyword last_name Str null keyword filter_flag NameLoad filter_flag decorator_list FunctionDef save arguments args NameParam self defaults kwarg params body Raise NameLoad NotImplementedError decorator_list FunctionDef userID arguments args NameParam self defaults body Return AttributeLoad NameLoad self attr _id decorator_list NameLoad property FunctionDef username_in_report arguments args NameParam self defaults body If CompareEq AttributeLoad NameLoad self attr filter_flag AttributeLoad NameLoad HQUserType attr UNKNOWN body Assign NameStore final Call NameLoad mark_safe BinOpMod Str %s-<strong>[unregistered]</strong> Call AttributeLoad NameLoad html attr escape AttributeLoad NameLoad self attr username orelse If CompareEq AttributeLoad NameLoad self attr filter_flag AttributeLoad NameLoad HQUserType attr DEMO_USER body Assign NameStore final Call NameLoad mark_safe BinOpMod Str <strong>%s</strong> Call AttributeLoad NameLoad html attr escape AttributeLoad NameLoad self attr username orelse Assign NameStore final Call NameLoad mark_safe BinOpMod Str <strong>%s</strong>-(%s) Call NameLoad tuple Call NameLoad map AttributeLoad NameLoad html attr escape ListLoad AttributeLoad NameLoad self attr username AttributeLoad NameLoad self attr user_id Return NameLoad final decorator_list NameLoad property FunctionDef raw_username arguments args NameParam self defaults body Return AttributeLoad NameLoad self attr username decorator_list NameLoad property ClassDef Meta bases body Assign NameStore app_label Str reports decorator_list decorator_list Assign NameStore ReportContent Call NameLoad namedtuple Str ReportContent ListLoad Str text Str attachment ClassDef ReportConfig bases NameLoad CachedCouchDocumentMixin NameLoad Document body Assign NameStore domain Call NameLoad StringProperty Assign NameStore report_type Call NameLoad StringProperty Assign NameStore report_slug Call NameLoad StringProperty Assign NameStore subreport_slug Call NameLoad StringProperty keyword default NameLoad None Assign NameStore name Call NameLoad StringProperty Assign NameStore description Call NameLoad StringProperty Assign NameStore owner_id Call NameLoad StringProperty Assign NameStore filters Call NameLoad DictProperty Assign NameStore date_range Call NameLoad StringProperty keyword choices Call NameLoad get_all_daterange_slugs Assign NameStore days Call NameLoad IntegerProperty keyword default NameLoad None Assign NameStore start_date Call NameLoad DateProperty keyword default NameLoad None Assign NameStore end_date Call NameLoad DateProperty keyword default NameLoad None Assign NameStore datespan_slug Call NameLoad StringProperty keyword default NameLoad None FunctionDef delete arguments args NameParam self defaults vararg args kwarg kwargs body Assign NameStore notifications Call AttributeLoad Call AttributeLoad NameLoad self attr view Str reportconfig/notifications_by_config keyword reduce NameLoad False keyword include_docs NameLoad True keyword key AttributeLoad NameLoad self attr _id attr all For NameStore n NameLoad notifications body Expr Call AttributeLoad AttributeLoad NameLoad n attr config_ids attr remove AttributeLoad NameLoad self attr _id If AttributeLoad NameLoad n attr config_ids body Expr Call AttributeLoad NameLoad n attr save orelse Expr Call AttributeLoad NameLoad n attr delete Return Call AttributeLoad Call NameLoad super NameLoad ReportConfig NameLoad self attr delete NameLoad args NameLoad kwargs decorator_list FunctionDef by_domain_and_owner arguments args NameParam cls NameParam domain NameParam owner_id NameParam report_slug NameParam stale NameParam skip NameParam limit defaults NameLoad None NameLoad True NameLoad None NameLoad None body Assign NameStore kwargs Dict If NameLoad stale body Assign SubscriptStore NameLoad kwargs Index Str stale AttributeLoad NameLoad settings attr COUCH_STALE_QUERY Pass If CompareIsNot NameLoad report_slug NameLoad None body Assign NameStore key ListLoad Str name-slug NameLoad domain NameLoad owner_id NameLoad report_slug orelse Assign NameStore key ListLoad Str name NameLoad domain NameLoad owner_id Assign NameStore db Call AttributeLoad NameLoad cls attr get_db If CompareIsNot NameLoad skip NameLoad None body Assign SubscriptStore NameLoad kwargs Index Str skip NameLoad skip If CompareIsNot NameLoad limit NameLoad None body Assign SubscriptStore NameLoad kwargs Index Str limit NameLoad limit Assign NameStore result Call AttributeLoad NameLoad cache_core attr cached_view NameLoad db Str reportconfig/configs_by_domain keyword reduce NameLoad False keyword include_docs NameLoad True keyword startkey NameLoad key keyword endkey BinOpAdd NameLoad key ListLoad Dict keyword wrapper AttributeLoad NameLoad cls attr wrap NameLoad kwargs Return NameLoad result decorator_list NameLoad classmethod FunctionDef default arguments args NameParam self defaults body Return Dict Str name Str description Str days Str start_date Str end_date Str filters Str null Str null NameLoad None NameLoad None NameLoad None Dict decorator_list NameLoad classmethod FunctionDef to_complete_json arguments args NameParam self NameParam lang defaults NameLoad None body Assign NameStore result Call AttributeLoad Call NameLoad super NameLoad ReportConfig NameLoad self attr to_json Expr Call AttributeLoad NameLoad result attr update Dict Str url Str report_name Str date_description Str datespan_filters Str has_ucr_datespan AttributeLoad NameLoad self attr url AttributeLoad NameLoad self attr report_name AttributeLoad NameLoad self attr date_description Call AttributeLoad NameLoad self attr datespan_filter_choices AttributeLoad NameLoad self attr datespan_filters BoolOpOr NameLoad lang Call NameLoad ucr_default_language AttributeLoad NameLoad self attr has_ucr_datespan Return NameLoad result decorator_list FunctionDef _dispatcher arguments args NameParam self defaults body ImportFrom corehq.apps.userreports.models alias CUSTOM_REPORT_PREFIX ImportFrom corehq.apps.userreports.reports.view alias ConfigurableReport alias CustomConfigurableReportDispatcher Assign NameStore dispatchers ListLoad NameLoad ProjectReportDispatcher NameLoad CustomProjectReportDispatcher For NameStore dispatcher NameLoad dispatchers body If CompareEq AttributeLoad NameLoad dispatcher attr prefix AttributeLoad NameLoad self attr report_type body Return Call NameLoad dispatcher If CompareEq AttributeLoad NameLoad self attr report_type Str configurable body If Call AttributeLoad AttributeLoad NameLoad self attr subreport_slug attr startswith NameLoad CUSTOM_REPORT_PREFIX body Return Call NameLoad CustomConfigurableReportDispatcher orelse Return Call NameLoad ConfigurableReport If CompareNotEq AttributeLoad NameLoad self attr doc_type Str ReportConfig-Deleted body AugAssignAdd AttributeStore NameLoad self attr doc_type Str -Deleted Expr Call AttributeLoad NameLoad self attr save Expr Call NameLoad notify_exception NameLoad None BinOpMod Str This-saved-report-(id:-%s)-is-unknown-(report_type:-%s)-and-so-we-have-archived-it TupleLoad AttributeLoad NameLoad self attr _id AttributeLoad NameLoad self attr report_type Raise Call NameLoad UnsupportedSavedReportError BinOpMod Str Unknown-dispatcher:-%s AttributeLoad NameLoad self attr report_type decorator_list NameLoad property NameLoad memoized FunctionDef get_date_range arguments args NameParam self defaults body Expr Str Duplicated-in-reports.config.js Assign NameStore date_range AttributeLoad NameLoad self attr date_range If UnaryOpNot NameLoad date_range body Return Dict TryExcept body Assign TupleStore NameStore start_date NameStore end_date Call NameLoad get_daterange_start_end_dates NameLoad date_range keyword start_date AttributeLoad NameLoad self attr start_date keyword end_date AttributeLoad NameLoad self attr end_date keyword days AttributeLoad NameLoad self attr days handlers ExceptHandler type NameLoad InvalidDaterangeException body Expr Call AttributeLoad NameLoad logging attr error BinOpMod Str saved-report-%s-is-in-a-bad-state---date-range-is-misconfigured AttributeLoad NameLoad self attr _id Return Dict Assign NameStore dates Dict Str startdate Str enddate Call AttributeLoad NameLoad start_date attr isoformat Call AttributeLoad NameLoad end_date attr isoformat If AttributeLoad NameLoad self attr is_configurable_report body Assign NameStore filter_slug AttributeLoad NameLoad self attr datespan_slug If NameLoad filter_slug body Return Dict BinOpMod Str %s-start NameLoad filter_slug BinOpMod Str %s-end NameLoad filter_slug NameLoad filter_slug Call AttributeLoad NameLoad start_date attr isoformat Call AttributeLoad NameLoad end_date attr isoformat BinOpMod Str %(startdate)s-to-%(enddate)s NameLoad dates Return NameLoad dates decorator_list FunctionDef query_string arguments args NameParam self defaults body Assign NameStore params Dict If CompareNotEq AttributeLoad NameLoad self attr _id Str dummy body Assign SubscriptStore NameLoad params Index Str config_id AttributeLoad NameLoad self attr _id If UnaryOpNot AttributeLoad NameLoad self attr is_configurable_report body Expr Call AttributeLoad NameLoad params attr update AttributeLoad NameLoad self attr filters Expr Call AttributeLoad NameLoad params attr update Call AttributeLoad NameLoad self attr get_date_range Return Call NameLoad urlencode NameLoad params NameLoad True decorator_list NameLoad property NameLoad memoized FunctionDef url_kwargs arguments args NameParam self defaults body Assign NameStore kwargs Dict Str domain Str report_slug AttributeLoad NameLoad self attr domain AttributeLoad NameLoad self attr report_slug If AttributeLoad NameLoad self attr subreport_slug body Assign SubscriptStore NameLoad kwargs Index Str subreport_slug AttributeLoad NameLoad self attr subreport_slug Return Call NameLoad immutabledict NameLoad kwargs decorator_list NameLoad property NameLoad memoized FunctionDef view_kwargs arguments args NameParam self defaults body If UnaryOpNot AttributeLoad NameLoad self attr is_configurable_report body Return Call AttributeLoad AttributeLoad NameLoad self attr url_kwargs attr union Dict Str permissions_check AttributeLoad AttributeLoad NameLoad self attr _dispatcher attr permissions_check Return AttributeLoad NameLoad self attr url_kwargs decorator_list NameLoad property NameLoad memoized FunctionDef url arguments args NameParam self defaults body TryExcept body ImportFrom corehq.apps.userreports.reports.view alias ConfigurableReport If AttributeLoad NameLoad self attr is_configurable_report body Assign NameStore url_base Call NameLoad absolute_reverse AttributeLoad NameLoad self attr report_slug keyword args ListLoad AttributeLoad NameLoad self attr domain AttributeLoad NameLoad self attr subreport_slug orelse Assign NameStore url_base Call NameLoad absolute_reverse Call AttributeLoad AttributeLoad NameLoad self attr _dispatcher attr name keyword kwargs AttributeLoad NameLoad self attr url_kwargs Return BinOpAdd BinOpAdd NameLoad url_base Str ? AttributeLoad NameLoad self attr query_string handlers ExceptHandler type NameLoad UnsupportedSavedReportError body Return Str # ExceptHandler type NameLoad Exception name NameStore e body Expr Call AttributeLoad NameLoad logging attr exception AttributeLoad NameLoad e attr message Return Str # decorator_list NameLoad property NameLoad memoized FunctionDef report arguments args NameParam self defaults body Expr Str Returns-None-if-no-report-is-found-for-that-report-slug,-which-happens--------when-a-report-is-no-longer-available.--All-callers-should-handle-this--------case. TryExcept body Return Call AttributeLoad AttributeLoad NameLoad self attr _dispatcher attr get_report AttributeLoad NameLoad self attr domain AttributeLoad NameLoad self attr report_slug AttributeLoad NameLoad self attr subreport_slug handlers ExceptHandler type NameLoad UnsupportedSavedReportError body Return NameLoad None decorator_list NameLoad property NameLoad memoized FunctionDef report_name arguments args NameParam self defaults body TryExcept body If CompareIs AttributeLoad NameLoad self attr report NameLoad None body Return Call NameLoad _ Str Deleted-Report orelse Return Call NameLoad _ AttributeLoad AttributeLoad NameLoad self attr report attr name handlers ExceptHandler type NameLoad Exception body Return Call NameLoad _ Str Unsupported-Report decorator_list NameLoad property FunctionDef full_name arguments args NameParam self defaults body If AttributeLoad NameLoad self attr name body Return BinOpMod Str %s-(%s) TupleLoad AttributeLoad NameLoad self attr name AttributeLoad NameLoad self attr report_name orelse Return AttributeLoad NameLoad self attr report_name decorator_list NameLoad property FunctionDef date_description arguments args NameParam self defaults body If CompareEq AttributeLoad NameLoad self attr date_range Str lastmonth body Return Str Last-Month orelse If BoolOpAnd AttributeLoad NameLoad self attr days UnaryOpNot AttributeLoad NameLoad self attr start_date body Assign NameStore day IfExp CompareEq AttributeLoad NameLoad self attr days Num 1 Str day Str days Return BinOpMod Str Last-%d-%s TupleLoad AttributeLoad NameLoad self attr days NameLoad day orelse If AttributeLoad NameLoad self attr end_date body Return BinOpMod Str From-%s-to-%s TupleLoad AttributeLoad NameLoad self attr start_date AttributeLoad NameLoad self attr end_date orelse If AttributeLoad NameLoad self attr start_date body Return BinOpMod Str Since-%s AttributeLoad NameLoad self attr start_date orelse Return Str null decorator_list NameLoad property FunctionDef owner arguments args NameParam self defaults body Return Call AttributeLoad NameLoad CouchUser attr get_by_user_id AttributeLoad NameLoad self attr owner_id decorator_list NameLoad property NameLoad memoized FunctionDef get_report_content arguments args NameParam self NameParam lang NameParam attach_excel defaults NameLoad False body Expr Str Get-the-report's-HTML-content-as-rendered-by-the-static-view-format. TryExcept body If CompareIs AttributeLoad NameLoad self attr report NameLoad None body Return Call NameLoad ReportContent Call NameLoad _ Str The-report-used-to-create-this-scheduled-report-is-no-longer-available-on-CommCare-HQ.--Please-delete-this-scheduled-report-and-create-a-new-one-using-an-available-report. NameLoad None handlers ExceptHandler type NameLoad Exception body Pass ImportFrom django.http alias HttpRequest alias QueryDict Assign NameStore mock_request Call NameLoad HttpRequest Assign AttributeStore NameLoad mock_request attr couch_user AttributeLoad NameLoad self attr owner Assign AttributeStore NameLoad mock_request attr user Call AttributeLoad AttributeLoad NameLoad self attr owner attr get_django_user Assign AttributeStore NameLoad mock_request attr domain AttributeLoad NameLoad self attr domain Assign AttributeStore AttributeLoad NameLoad mock_request attr couch_user attr current_domain AttributeLoad NameLoad self attr domain Assign AttributeStore AttributeLoad NameLoad mock_request attr couch_user attr language NameLoad lang Assign AttributeStore NameLoad mock_request attr method Str GET Assign NameStore mock_query_string_parts ListLoad AttributeLoad NameLoad self attr query_string Str filterSet=true If AttributeLoad NameLoad self attr is_configurable_report body Expr Call AttributeLoad NameLoad mock_query_string_parts attr append Call NameLoad urlencode AttributeLoad NameLoad self attr filters NameLoad True Expr Call AttributeLoad NameLoad mock_query_string_parts attr append Call NameLoad urlencode Call AttributeLoad NameLoad self attr get_date_range NameLoad True Assign AttributeStore NameLoad mock_request attr GET Call NameLoad QueryDict Call AttributeLoad Str & attr join NameLoad mock_query_string_parts Expr Call AttributeLoad NameLoad CCHQPRBACMiddleware attr apply_prbac NameLoad mock_request TryExcept body Assign NameStore dispatch_func Call AttributeLoad NameLoad functools attr partial Call AttributeLoad AttributeLoad AttributeLoad NameLoad self attr _dispatcher attr __class__ attr as_view NameLoad mock_request AttributeLoad NameLoad self attr view_kwargs Assign NameStore email_response Call NameLoad dispatch_func keyword render_as Str email If CompareEq AttributeLoad NameLoad email_response attr status_code Num 302 body Return Call NameLoad ReportContent BinOpMod Call NameLoad _ Str We-are-sorry,-but-your-saved-report-'%(config_name)s'-is-no-longer-accessible-because-the-owner-%(username)s-is-no-longer-active. Dict Str config_name Str username AttributeLoad NameLoad self attr name AttributeLoad AttributeLoad NameLoad self attr owner attr username NameLoad None Return Call NameLoad ReportContent SubscriptLoad Call AttributeLoad NameLoad json attr loads AttributeLoad NameLoad email_response attr content Index Str report IfExp NameLoad attach_excel Call NameLoad dispatch_func keyword render_as Str excel NameLoad None handlers ExceptHandler type NameLoad PermissionDenied body Return Call NameLoad ReportContent BinOpMod Call NameLoad _ Str We-are-sorry,-but-your-saved-report-'%(config_name)s'-is-no-longer-accessible-because-your-subscription-does-not-allow-Custom-Reporting.-Please-talk-to-your-Project-Administrator-about-enabling-Custom-Reports.-If-you-want-CommCare-HQ-to-stop-sending-this-message,-please-visit-%(saved_reports_url)s-to-remove-this-Emailed-Report. Dict Str config_name Str saved_reports_url AttributeLoad NameLoad self attr name Call NameLoad absolute_reverse Str saved_reports keyword args ListLoad AttributeLoad NameLoad mock_request attr domain NameLoad None ExceptHandler type NameLoad Http404 body Return Call NameLoad ReportContent BinOpMod Call NameLoad _ Str We-are-sorry,-but-your-saved-report-'%(config_name)s'-can-not-be-generated-since-you-do-not-have-the-correct-permissions.-Please-talk-to-your-Project-Administrator-about-getting-permissions-for-thisreport. Dict Str config_name AttributeLoad NameLoad self attr name NameLoad None ExceptHandler type NameLoad UnsupportedSavedReportError body Return Call NameLoad ReportContent BinOpMod Call NameLoad _ Str We-are-sorry,-but-your-saved-report-'%(config_name)s'-is-no-longer-available.-If-you-think-this-is-a-mistake,-please-report-an-issue. Dict Str config_name AttributeLoad NameLoad self attr name NameLoad None ExceptHandler type NameLoad Exception body Expr Call NameLoad notify_exception NameLoad None Call AttributeLoad Str Error-generating-report:-\ \ attr format AttributeLoad NameLoad self attr report_slug keyword details Dict Str domain Str user Str report Str report-config AttributeLoad NameLoad self attr domain AttributeLoad AttributeLoad NameLoad self attr owner attr username AttributeLoad NameLoad self attr report_slug AttributeLoad NameLoad self attr get_id Return Call NameLoad ReportContent Call NameLoad _ Str An-error-occurred-while-generating-this-report. NameLoad None decorator_list FunctionDef is_configurable_report arguments args NameParam self defaults body ImportFrom corehq.apps.userreports.reports.view alias ConfigurableReport Return CompareEq AttributeLoad NameLoad self attr report_type AttributeLoad NameLoad ConfigurableReport attr prefix decorator_list NameLoad property FunctionDef languages arguments args NameParam self defaults body If AttributeLoad NameLoad self attr is_configurable_report body Return Call NameLoad frozenset Call AttributeLoad AttributeLoad AttributeLoad NameLoad self attr report attr spec attr get_languages Return Call NameLoad frozenset decorator_list NameLoad property NameLoad memoized FunctionDef configurable_report arguments args NameParam self defaults body ImportFrom corehq.apps.userreports.reports.view alias ConfigurableReport Return Call AttributeLoad NameLoad ConfigurableReport attr get_report AttributeLoad NameLoad self attr domain AttributeLoad NameLoad self attr report_slug AttributeLoad NameLoad self attr subreport_slug decorator_list NameLoad property NameLoad memoized FunctionDef datespan_filters arguments args NameParam self defaults body Return IfExp AttributeLoad NameLoad self attr is_configurable_report AttributeLoad AttributeLoad NameLoad self attr configurable_report attr datespan_filters ListLoad decorator_list NameLoad property FunctionDef has_ucr_datespan arguments args NameParam self defaults body Return BoolOpAnd AttributeLoad NameLoad self attr is_configurable_report AttributeLoad NameLoad self attr datespan_filters decorator_list NameLoad property FunctionDef datespan_filter_choices arguments args NameParam datespan_filters NameParam lang defaults body Assign NameStore localized_datespan_filters ListLoad For NameStore f NameLoad datespan_filters body Assign NameStore copy Call NameLoad dict NameLoad f Assign SubscriptStore NameLoad copy Index Str display Call NameLoad ucr_localize SubscriptLoad NameLoad copy Index Str display NameLoad lang Expr Call AttributeLoad NameLoad localized_datespan_filters attr append NameLoad copy With Call NameLoad localize NameLoad lang body Return BinOpAdd ListLoad Dict Str display Str slug Call NameLoad _ Str Choose-a-date-filter... NameLoad None NameLoad localized_datespan_filters decorator_list NameLoad staticmethod decorator_list Assign NameStore DEFAULT_REPORT_NOTIF_SUBJECT Str Scheduled-report-from-CommCare-HQ ClassDef ReportNotification bases NameLoad CachedCouchDocumentMixin NameLoad Document body Assign NameStore domain Call NameLoad StringProperty Assign NameStore owner_id Call NameLoad StringProperty Assign NameStore recipient_emails Call NameLoad StringListProperty Assign NameStore config_ids Call NameLoad StringListProperty Assign NameStore send_to_owner Call NameLoad BooleanProperty Assign NameStore attach_excel Call NameLoad BooleanProperty Assign NameStore language Call NameLoad StringProperty Assign NameStore email_subject Call NameLoad StringProperty keyword default NameLoad DEFAULT_REPORT_NOTIF_SUBJECT Assign NameStore hour Call NameLoad IntegerProperty keyword default Num 8 Assign NameStore minute Call NameLoad IntegerProperty keyword default Num 0 Assign NameStore day Call NameLoad IntegerProperty keyword default Num 1 Assign NameStore interval Call NameLoad StringProperty keyword choices ListLoad Str daily Str weekly Str monthly FunctionDef is_editable arguments args NameParam self defaults body TryExcept body Expr AttributeLoad NameLoad self attr report_slug Return NameLoad False handlers ExceptHandler type NameLoad AttributeError body Return NameLoad True decorator_list NameLoad property FunctionDef by_domain_and_owner arguments args NameParam cls NameParam domain NameParam owner_id NameParam stale defaults NameLoad True kwarg kwargs body If NameLoad stale body Assign SubscriptStore NameLoad kwargs Index Str stale AttributeLoad NameLoad settings attr COUCH_STALE_QUERY Assign NameStore key ListLoad NameLoad domain NameLoad owner_id Assign NameStore db Call AttributeLoad NameLoad cls attr get_db Assign NameStore result Call AttributeLoad NameLoad cache_core attr cached_view NameLoad db Str reportconfig/user_notifications keyword reduce NameLoad False keyword include_docs NameLoad True keyword startkey NameLoad key keyword endkey BinOpAdd NameLoad key ListLoad Dict keyword wrapper AttributeLoad NameLoad cls attr wrap NameLoad kwargs Return NameLoad result decorator_list NameLoad classmethod FunctionDef all_recipient_emails arguments args NameParam self defaults body If UnaryOpNot AttributeLoad NameLoad self attr owner_id body Return Call NameLoad frozenset ListLoad Call AttributeLoad AttributeLoad NameLoad self attr owner attr get_email Assign NameStore emails Call NameLoad frozenset AttributeLoad NameLoad self attr recipient_emails If BoolOpAnd AttributeLoad NameLoad self attr send_to_owner AttributeLoad NameLoad self attr owner_email body AugAssignBitOr NameStore emails Set AttributeLoad NameLoad self attr owner_email Return NameLoad emails decorator_list NameLoad property NameLoad memoized FunctionDef owner_email arguments args NameParam self defaults body If Call AttributeLoad AttributeLoad NameLoad self attr owner attr is_web_user body Return AttributeLoad AttributeLoad NameLoad self attr owner attr username Assign NameStore email Call AttributeLoad AttributeLoad NameLoad self attr owner attr get_email TryExcept body Expr Call NameLoad validate_email NameLoad email Return NameLoad email handlers ExceptHandler type NameLoad Exception body Pass decorator_list NameLoad property NameLoad memoized FunctionDef owner arguments args NameParam self defaults body Assign NameStore id AttributeLoad NameLoad self attr owner_id Return Call AttributeLoad NameLoad CouchUser attr get_by_user_id NameLoad id decorator_list NameLoad property NameLoad memoized FunctionDef configs arguments args NameParam self defaults body Expr Str Access-the-notification's-associated-configs-as-a-list,-transparently--------returning-an-appropriate-dummy-for-old-notifications-which-have--------`report_slug`-instead-of-`config_ids`. If AttributeLoad NameLoad self attr config_ids body Assign NameStore configs Call AttributeLoad Call AttributeLoad NameLoad ReportConfig attr view Str _all_docs keyword keys AttributeLoad NameLoad self attr config_ids keyword include_docs NameLoad True attr all Assign NameStore configs ListComp NameLoad c comprehension NameStore c NameLoad configs UnaryOpNot Call NameLoad hasattr NameLoad c Str deleted FunctionDef _sort_key arguments args NameParam config_id defaults body If CompareIn NameLoad config_id AttributeLoad NameLoad self attr config_ids body Return Call AttributeLoad AttributeLoad NameLoad self attr config_ids attr index NameLoad config_id orelse Return Call NameLoad len AttributeLoad NameLoad self attr config_ids decorator_list Assign NameStore configs Call NameLoad sorted NameLoad configs keyword key NameLoad _sort_key orelse If CompareEq AttributeLoad NameLoad self attr report_slug Str admin_domains body Raise Call NameLoad UnsupportedScheduledReportError Str admin_domains-is-no-longer-supported-as-a-schedulable-report-for-the-time-being orelse ClassDef ReadonlyReportConfig bases NameLoad ReportConfig body FunctionDef save arguments args NameParam self defaults vararg args kwarg kwargs body Pass decorator_list decorator_list Assign NameStore config Call NameLoad ReadonlyReportConfig Expr Call AttributeLoad NameLoad object attr __setattr__ NameLoad config Str _id Str dummy Assign AttributeStore NameLoad config attr report_type AttributeLoad NameLoad ProjectReportDispatcher attr prefix Assign AttributeStore NameLoad config attr report_slug AttributeLoad NameLoad self attr report_slug Assign AttributeStore NameLoad config attr domain AttributeLoad NameLoad self attr domain Assign AttributeStore NameLoad config attr owner_id AttributeLoad NameLoad self attr owner_id Assign NameStore configs ListLoad NameLoad config Return Call NameLoad tuple NameLoad configs decorator_list NameLoad property NameLoad memoized FunctionDef day_name arguments args NameParam self defaults body If CompareEq AttributeLoad NameLoad self attr interval Str weekly body Return SubscriptLoad AttributeLoad NameLoad calendar attr day_name Index AttributeLoad NameLoad self attr day Return SubscriptLoad Dict Str daily Str monthly Call NameLoad _ Str Every-day Call NameLoad _ BinOpMod Str Day-%s-of-every-month AttributeLoad NameLoad self attr day Index AttributeLoad NameLoad self attr interval decorator_list NameLoad property FunctionDef day_choices arguments args NameParam cls defaults body Expr Str Tuples-for-day-of-week-number-and-human-readable-day-of-week Return Call NameLoad tuple ListComp TupleLoad NameLoad val SubscriptLoad AttributeLoad NameLoad calendar attr day_name Index NameLoad val comprehension NameStore val Call NameLoad range Num 7 decorator_list NameLoad classmethod FunctionDef hour_choices arguments args NameParam cls defaults body Expr Str Tuples-for-hour-number-and-human-readable-hour Return Call NameLoad tuple ListComp TupleLoad NameLoad val BinOpMod Str %s:00 NameLoad val comprehension NameStore val Call NameLoad range Num 24 decorator_list NameLoad classmethod FunctionDef recipients_by_language arguments args NameParam self defaults body Assign NameStore user_languages DictComp SubscriptLoad NameLoad user Index Str username SubscriptLoad NameLoad user Index Str language comprehension NameStore user Call NameLoad get_user_docs_by_username AttributeLoad NameLoad self attr all_recipient_emails BoolOpAnd CompareIn Str username NameLoad user CompareIn Str language NameLoad user Assign NameStore fallback_language Call AttributeLoad NameLoad user_languages attr get AttributeLoad NameLoad self attr owner_email Str en Assign NameStore recipients Call NameLoad defaultdict NameLoad list For NameStore email AttributeLoad NameLoad self attr all_recipient_emails body Assign NameStore language Call AttributeLoad NameLoad user_languages attr get NameLoad email NameLoad fallback_language Expr Call AttributeLoad SubscriptLoad NameLoad recipients Index NameLoad language attr append NameLoad email Return Call NameLoad immutabledict NameLoad recipients decorator_list NameLoad property NameLoad memoized FunctionDef send arguments args NameParam self defaults body If UnaryOpNot Call AttributeLoad AttributeLoad NameLoad self attr owner attr is_member_of AttributeLoad NameLoad self attr domain body Expr Call AttributeLoad NameLoad self attr delete Return If Call AttributeLoad AttributeLoad NameLoad self attr owner attr is_deleted body Expr Call AttributeLoad NameLoad self attr delete Return If AttributeLoad NameLoad self attr recipients_by_language body For TupleStore NameStore language NameStore emails Call AttributeLoad AttributeLoad NameLoad self attr recipients_by_language attr items body Expr Call AttributeLoad NameLoad self attr _get_and_send_report NameLoad language NameLoad emails decorator_list FunctionDef _get_and_send_report arguments args NameParam self NameParam language NameParam emails defaults body ImportFrom corehq.apps.reports.views alias get_scheduled_report_response With Call NameLoad localize NameLoad language body Assign NameStore title IfExp CompareEq AttributeLoad NameLoad self attr email_subject NameLoad DEFAULT_REPORT_NOTIF_SUBJECT Call NameLoad _ NameLoad DEFAULT_REPORT_NOTIF_SUBJECT AttributeLoad NameLoad self attr email_subject Assign NameStore attach_excel Call NameLoad getattr NameLoad self Str attach_excel NameLoad False Assign TupleStore NameStore body NameStore excel_files Call NameLoad get_scheduled_report_response AttributeLoad NameLoad self attr owner AttributeLoad NameLoad self attr domain AttributeLoad NameLoad self attr _id keyword attach_excel NameLoad attach_excel For NameStore email NameLoad emails body Expr Call AttributeLoad NameLoad send_html_email_async attr delay NameLoad title NameLoad email AttributeLoad NameLoad body attr content keyword email_from AttributeLoad NameLoad settings attr DEFAULT_FROM_EMAIL keyword file_attachments NameLoad excel_files keyword ga_track NameLoad True keyword ga_tracking_info Dict Str project_space_id AttributeLoad NameLoad self attr domain decorator_list decorator_list ClassDef AppNotFound bases NameLoad Exception body Pass decorator_list ClassDef HQExportSchema bases NameLoad SavedExportSchema body Assign NameStore doc_type Str SavedExportSchema Assign NameStore domain Call NameLoad StringProperty Assign NameStore transform_dates Call NameLoad BooleanProperty keyword default NameLoad True FunctionDef global_transform_function arguments args NameParam self defaults body If AttributeLoad NameLoad self attr transform_dates body Return NameLoad couch_to_excel_datetime orelse Return NameLoad identity decorator_list NameLoad property FunctionDef wrap arguments args NameParam cls NameParam data defaults body If CompareNotIn Str transform_dates NameLoad data body Assign SubscriptStore NameLoad data Index Str transform_dates NameLoad False Assign NameStore self Call AttributeLoad Call NameLoad super NameLoad HQExportSchema NameLoad cls attr wrap NameLoad data If UnaryOpNot AttributeLoad NameLoad self attr domain body Assign AttributeStore NameLoad self attr domain SubscriptLoad AttributeLoad NameLoad self attr index Index Num 0 Return NameLoad self decorator_list NameLoad classmethod FunctionDef get_stale_exports arguments args NameParam cls NameParam domain defaults body Return ListComp Call AttributeLoad NameLoad cls attr wrap NameLoad export comprehension NameStore export Call NameLoad stale_get_exports_json NameLoad domain CompareEq SubscriptLoad NameLoad export Index Str type AttributeLoad NameLoad cls attr _default_type decorator_list NameLoad classmethod decorator_list ClassDef FormExportSchema bases NameLoad HQExportSchema body Assign NameStore doc_type Str SavedExportSchema Assign NameStore app_id Call NameLoad StringProperty Assign NameStore include_errors Call NameLoad BooleanProperty keyword default NameLoad False Assign NameStore split_multiselects Call NameLoad BooleanProperty keyword default NameLoad False Assign NameStore _default_type Str form FunctionDef update_schema arguments args NameParam self defaults body Expr Call AttributeLoad Call NameLoad super NameLoad FormExportSchema NameLoad self attr update_schema If AttributeLoad NameLoad self attr split_multiselects body Expr Call AttributeLoad NameLoad self attr update_question_schema For NameStore column ListComp NameLoad column comprehension NameStore table AttributeLoad NameLoad self attr tables comprehension NameStore column AttributeLoad NameLoad table attr columns body If Call NameLoad isinstance NameLoad column NameLoad SplitColumn body Assign NameStore question Call AttributeLoad AttributeLoad AttributeLoad NameLoad self attr question_schema attr question_schema attr get AttributeLoad NameLoad column attr index If NameLoad question body Assign AttributeStore NameLoad column attr options AttributeLoad NameLoad question attr options Assign AttributeStore NameLoad column attr ignore_extras NameLoad True decorator_list FunctionDef update_question_schema arguments args NameParam self defaults body Assign NameStore schema AttributeLoad NameLoad self attr question_schema Expr Call AttributeLoad NameLoad schema attr update_schema decorator_list FunctionDef question_schema arguments args NameParam self defaults body ImportFrom corehq.apps.export.models alias FormQuestionSchema Return Call AttributeLoad NameLoad FormQuestionSchema attr get_or_create AttributeLoad NameLoad self attr domain AttributeLoad NameLoad self attr app_id AttributeLoad NameLoad self attr xmlns decorator_list NameLoad property FunctionDef app arguments args NameParam self defaults body If AttributeLoad NameLoad self attr app_id body TryExcept body Return Call NameLoad get_app AttributeLoad NameLoad self attr domain AttributeLoad NameLoad self attr app_id keyword latest NameLoad True handlers ExceptHandler type NameLoad Http404 body Expr Call AttributeLoad NameLoad logging attr error BinOpMod Str App-%s-in-domain-%s-not-found-for-export-%s TupleLoad AttributeLoad NameLoad self attr app_id AttributeLoad NameLoad self attr domain AttributeLoad NameLoad self attr get_id Raise Call NameLoad AppNotFound orelse Return NameLoad None decorator_list NameLoad property NameLoad memoized FunctionDef wrap arguments args NameParam cls NameParam data defaults body Assign NameStore self Call AttributeLoad Call NameLoad super NameLoad FormExportSchema NameLoad cls attr wrap NameLoad data If CompareEq AttributeLoad NameLoad self attr filter_function Str couchforms.filters.instances body Assign AttributeStore NameLoad self attr include_errors NameLoad False Assign AttributeStore NameLoad self attr filter_function NameLoad None Return NameLoad self decorator_list NameLoad classmethod FunctionDef filter arguments args NameParam self defaults body Assign NameStore user_ids Call NameLoad set Call AttributeLoad NameLoad CouchUser attr ids_by_domain AttributeLoad NameLoad self attr domain Expr Call AttributeLoad NameLoad user_ids attr update Call AttributeLoad NameLoad CouchUser attr ids_by_domain AttributeLoad NameLoad self attr domain keyword is_active NameLoad False Expr Call AttributeLoad NameLoad user_ids attr add Str demo_user FunctionDef _top_level_filter arguments args NameParam form defaults body Return BoolOpOr Call NameLoad form_matches_users NameLoad form NameLoad user_ids Call NameLoad is_commconnect_form NameLoad form decorator_list Assign NameStore f Call NameLoad SerializableFunction NameLoad _top_level_filter If CompareIsNot AttributeLoad NameLoad self attr app_id NameLoad None body ImportFrom corehq.apps.reports alias util identifier reports_util Expr Call AttributeLoad NameLoad f attr add AttributeLoad NameLoad reports_util attr app_export_filter keyword app_id AttributeLoad NameLoad self attr app_id If UnaryOpNot AttributeLoad NameLoad self attr include_errors body Expr Call AttributeLoad NameLoad f attr add NameLoad instances Assign NameStore actual Call NameLoad SerializableFunction NameLoad default_form_filter keyword filter NameLoad f Return NameLoad actual decorator_list NameLoad property FunctionDef domain arguments args NameParam self defaults body Return SubscriptLoad AttributeLoad NameLoad self attr index Index Num 0 decorator_list NameLoad property FunctionDef xmlns arguments args NameParam self defaults body Return SubscriptLoad AttributeLoad NameLoad self attr index Index Num 1 decorator_list NameLoad property FunctionDef formname arguments args NameParam self defaults body Return Call NameLoad xmlns_to_name AttributeLoad NameLoad self attr domain AttributeLoad NameLoad self attr xmlns keyword app_id AttributeLoad NameLoad self attr app_id decorator_list NameLoad property FunctionDef question_order arguments args NameParam self defaults body TryExcept body If UnaryOpNot AttributeLoad NameLoad self attr app body Return ListLoad handlers ExceptHandler type NameLoad AppNotFound body If AttributeLoad NameLoad settings attr DEBUG body Return ListLoad Raise orelse Assign NameStore questions Call AttributeLoad AttributeLoad NameLoad self attr app attr get_questions AttributeLoad NameLoad self attr xmlns Assign NameStore order ListLoad For NameStore question NameLoad questions body If UnaryOpNot SubscriptLoad NameLoad question Index Str value body Continue Assign NameStore index_parts Call AttributeLoad SubscriptLoad NameLoad question Index Str value attr split Str / Assert CompareEq SubscriptLoad NameLoad index_parts Index Num 0 Str null Assign SubscriptStore NameLoad index_parts Index Num 1 Str form Assign NameStore index Call AttributeLoad Str . attr join SubscriptLoad NameLoad index_parts Slice Num 1 Expr Call AttributeLoad NameLoad order attr append NameLoad index Return NameLoad order decorator_list NameLoad property NameLoad memoized FunctionDef get_default_order arguments args NameParam self defaults body Return Dict Str # AttributeLoad NameLoad self attr question_order decorator_list FunctionDef uses_cases arguments args NameParam self defaults body If BoolOpOr UnaryOpNot AttributeLoad NameLoad self attr app Call NameLoad isinstance AttributeLoad NameLoad self attr app NameLoad RemoteApp body Return NameLoad False Assign NameStore form Call AttributeLoad AttributeLoad NameLoad self attr app attr get_form_by_xmlns AttributeLoad NameLoad self attr xmlns If BoolOpAnd NameLoad form Call NameLoad isinstance NameLoad form NameLoad Form body Return Call NameLoad bool Call AttributeLoad NameLoad form attr active_actions Return NameLoad False decorator_list decorator_list ClassDef CaseExportSchema bases NameLoad HQExportSchema body Assign NameStore doc_type Str SavedExportSchema Assign NameStore _default_type Str case FunctionDef filter arguments args NameParam self defaults body Return Call NameLoad SerializableFunction NameLoad default_case_filter decorator_list NameLoad property FunctionDef domain arguments args NameParam self defaults body Return SubscriptLoad AttributeLoad NameLoad self attr index Index Num 0 decorator_list NameLoad property FunctionDef domain_obj arguments args NameParam self defaults body Return Call AttributeLoad NameLoad Domain attr get_by_name AttributeLoad NameLoad self attr domain decorator_list NameLoad property FunctionDef case_type arguments args NameParam self defaults body Return SubscriptLoad AttributeLoad NameLoad self attr index Index Num 1 decorator_list NameLoad property FunctionDef applications arguments args NameParam self defaults body Return Call AttributeLoad AttributeLoad NameLoad self attr domain_obj attr full_applications keyword include_builds NameLoad False decorator_list NameLoad property FunctionDef case_properties arguments args NameParam self defaults body Assign NameStore props Call NameLoad set ListLoad For NameStore app AttributeLoad NameLoad self attr applications body Assign NameStore prop_map Call NameLoad get_case_properties NameLoad app ListLoad AttributeLoad NameLoad self attr case_type keyword defaults TupleLoad Str name AugAssignBitOr NameStore props Call NameLoad set SubscriptLoad NameLoad prop_map Index AttributeLoad NameLoad self attr case_type Return NameLoad props decorator_list NameLoad property decorator_list ClassDef DefaultFormExportSchema bases NameLoad DefaultExportSchema body FunctionDef remap_tables arguments args NameParam self NameParam tables defaults body Assign NameStore tables Call NameLoad _apply_removal NameLoad tables TupleLoad Str #|#export_tag|# Str #|location_|# Str #|history|# Return Call NameLoad _apply_mapping NameLoad tables Dict Str # Str Forms decorator_list decorator_list FunctionDef _apply_mapping arguments args NameParam export_tables NameParam mapping_dict defaults body FunctionDef _clean arguments args NameParam tabledata defaults body FunctionDef _clean_tablename arguments args NameParam tablename defaults body Return Call AttributeLoad NameLoad mapping_dict attr get NameLoad tablename NameLoad tablename decorator_list Return TupleLoad Call NameLoad _clean_tablename SubscriptLoad NameLoad tabledata Index Num 0 SubscriptLoad NameLoad tabledata Index Num 1 decorator_list Return Call NameLoad map NameLoad _clean NameLoad export_tables decorator_list FunctionDef _apply_removal arguments args NameParam export_tables NameParam removal_list defaults body Return ListComp NameLoad tabledata comprehension NameStore tabledata NameLoad export_tables UnaryOpNot CompareIn SubscriptLoad NameLoad tabledata Index Num 0 NameLoad removal_list decorator_list ClassDef HQGroupExportConfiguration bases NameLoad QuickCachedDocumentMixin NameLoad GroupExportConfiguration body Expr Str HQ's-version-of-a-group-export,-tagged-with-a-domain Assign NameStore domain Call NameLoad StringProperty FunctionDef get_custom_exports arguments args NameParam self defaults body FunctionDef _rewrap arguments args NameParam export defaults body TryExcept body Return Call AttributeLoad SubscriptLoad Dict Str form Str case NameLoad FormExportSchema NameLoad CaseExportSchema Index AttributeLoad NameLoad export attr type attr wrap AttributeLoad NameLoad export attr _doc handlers ExceptHandler type NameLoad KeyError body Return NameLoad export decorator_list For NameStore custom Call NameLoad list AttributeLoad NameLoad self attr custom_export_ids body Assign NameStore custom_export Call AttributeLoad NameLoad self attr _get_custom NameLoad custom If NameLoad custom_export body Expr Yield Call NameLoad _rewrap NameLoad custom_export decorator_list FunctionDef exports_of_type arguments args NameParam self NameParam type defaults body Return Call AttributeLoad NameLoad self attr _saved_exports_from_configs ListComp NameLoad config comprehension TupleStore NameStore config NameStore schema AttributeLoad NameLoad self attr all_exports CompareEq AttributeLoad NameLoad schema attr type NameLoad type decorator_list FunctionDef form_exports arguments args NameParam self defaults body Return Call AttributeLoad NameLoad self attr exports_of_type Str form decorator_list NameLoad property NameLoad memoized FunctionDef case_exports arguments args NameParam self defaults body Return Call AttributeLoad NameLoad self attr exports_of_type Str case decorator_list NameLoad property NameLoad memoized FunctionDef by_domain arguments args NameParam cls NameParam domain defaults body Return Call NameLoad hq_group_export_configs_by_domain NameLoad domain decorator_list NameLoad classmethod Call NameLoad quickcache ListLoad Str cls.__name__ Str domain FunctionDef get_for_domain arguments args NameParam cls NameParam domain defaults body Expr Str For-when-we-only-expect-there-to-be-one-of-these-per-domain,--------which-right-now-is-always. Assign NameStore groups Call AttributeLoad NameLoad cls attr by_domain NameLoad domain If NameLoad groups body If CompareGt Call NameLoad len NameLoad groups Num 1 body Expr Call AttributeLoad NameLoad logging attr error BinOpMod Str Domain-%s-has-more-than-one-group-export-config!-This-is-weird. NameLoad domain Return SubscriptLoad NameLoad groups Index Num 0 Return Call NameLoad HQGroupExportConfiguration keyword domain NameLoad domain decorator_list NameLoad classmethod FunctionDef add_custom_export arguments args NameParam cls NameParam domain NameParam export_id defaults body Assign NameStore group Call AttributeLoad NameLoad cls attr get_for_domain NameLoad domain If CompareNotIn NameLoad export_id AttributeLoad NameLoad group attr custom_export_ids body Expr Call AttributeLoad AttributeLoad NameLoad group attr custom_export_ids attr append NameLoad export_id Expr Call AttributeLoad NameLoad group attr save Return NameLoad group decorator_list NameLoad classmethod FunctionDef remove_custom_export arguments args NameParam cls NameParam domain NameParam export_id defaults body Assign NameStore group Call AttributeLoad NameLoad cls attr get_for_domain NameLoad domain Assign NameStore updated NameLoad False While CompareIn NameLoad export_id AttributeLoad NameLoad group attr custom_export_ids body Expr Call AttributeLoad AttributeLoad NameLoad group attr custom_export_ids attr remove NameLoad export_id Assign NameStore updated NameLoad True If NameLoad updated body Expr Call AttributeLoad NameLoad group attr save Return NameLoad group decorator_list NameLoad classmethod FunctionDef clear_caches arguments args NameParam self defaults body Expr Call AttributeLoad Call NameLoad super NameLoad HQGroupExportConfiguration NameLoad self attr clear_caches Expr Call AttributeLoad AttributeLoad NameLoad self attr by_domain attr clear AttributeLoad NameLoad self attr __class__ AttributeLoad NameLoad self attr domain decorator_list decorator_list 
Module Expr Str IOTools---tools-for-I/O-operations==================================This-module-contains-utility-functions-for-reading/writing-from-files.These-include-methods-for*-inspecting-files,-such-as-:func:`getFirstLine`,-:func:`getLastLine`--and-:func:`isEmpty`,*-working-with-filenames,-such-as-:func:`which`-and-:func:`snip`,--:func:`checkPresenceOfFiles`*-manipulating-file,-such-as-:func:`openFile`,-:func:`zapFile`,--:func:`cloneFile`,-:func:`touchFile`,-:func:`shadowFile`.*-converting-values-for-input/output,-such-as-:func:`val2str`,--:func:`str2val`,-:func:`prettyPercent`,-:func:`human2bytes`,--:func:`convertDictionary`.*-iterating-over-file-contents,-such-as-:func:`iterate`,--:func:`iterator_split`,*-creating-lists/dictionaries-from-files,-such-as-:func:`readMap`-and--:func:`readList`,-and*-working-with-file-collections-(see-:class:`FilePool`).Reference--------- Import alias string Import alias re Import alias os Import alias collections Import alias glob Import alias stat Import alias gzip Import alias subprocess Import alias itertools Import alias numpy Import alias numpy.ma Import alias shutil FunctionDef getFirstLine arguments args NameParam filename NameParam nlines defaults Num 1 body Expr Str return-the-first-line-of-a-file.----Arguments-----------------filename-:-string-------The-name-of-the-file-to-be-opened.----nlines-:-int-------Number-of-lines-to-return.----Returns---------------string-------The-first-line(s)-of-the-file. With Call NameLoad open NameLoad filename Str rU NameStore f body Assign NameStore line Call AttributeLoad Str null attr join ListComp Call AttributeLoad NameLoad f attr readline comprehension NameStore x Call NameLoad range NameLoad nlines Return NameLoad line decorator_list FunctionDef getLastLine arguments args NameParam filename NameParam nlines NameParam read_size defaults Num 1 Num 1024 body Expr Str return-the-last-line-of-a-file.----This-method-works-by-working-back-in-blocks-of-`read_size`-until----the-beginning-of-the-last-line-is-reached.----Arguments-----------------filename-:-string-------Name-of-the-file-to-be-opened.----nlines-:-int-------Number-of-lines-to-return.----read_size-:-int-------Number-of-bytes-to-read.----Returns---------------string-------The-last-line(s)-of-the-file. Assign NameStore f Call NameLoad open NameLoad filename Str rU Assign NameStore offset NameLoad read_size Expr Call AttributeLoad NameLoad f attr seek Num 0 Num 2 Assign NameStore file_size Call AttributeLoad NameLoad f attr tell If CompareEq NameLoad file_size Num 0 body Return Str null While Num 1 body If CompareLt NameLoad file_size NameLoad offset body Assign NameStore offset NameLoad file_size Expr Call AttributeLoad NameLoad f attr seek BinOpMult Num -1 NameLoad offset Num 2 Assign NameStore read_str Call AttributeLoad NameLoad f attr read NameLoad offset If CompareEq SubscriptLoad NameLoad read_str Index BinOpSub NameLoad offset Num 1 Str null body Assign NameStore read_str SubscriptLoad NameLoad read_str Slice Num -1 Assign NameStore lines Call AttributeLoad NameLoad read_str attr split Str null If CompareGtE Call NameLoad len NameLoad lines BinOpAdd NameLoad nlines Num 1 body Return Call AttributeLoad Str null attr join SubscriptLoad NameLoad lines Slice UnaryOpUSub NameLoad nlines If CompareEq NameLoad offset NameLoad file_size body Return NameLoad read_str AugAssignAdd NameStore offset NameLoad read_size Expr Call AttributeLoad NameLoad f attr close decorator_list FunctionDef getNumLines arguments args NameParam filename NameParam ignore_comments defaults NameLoad True body Expr Str count-number-of-lines-in-filename.----Arguments-----------------filename-:-string-------Name-of-the-file-to-be-opened.----ignore_comments-:-bool-------If-true,-ignore-lines-starting-with-``#``.----Returns---------------int-------The-number-of-line(s)-in-the-file. If NameLoad ignore_comments body Assign NameStore filter_cmd Str |-grep--v-"#" orelse Assign NameStore filter_cmd Str null If Call AttributeLoad NameLoad filename attr endswith Str .gz body Assign NameStore cmd BinOpMod Str zcat-%(filename)s-%(filter_cmd)s-|-wc--l Call NameLoad locals orelse Assign NameStore cmd BinOpMod Str cat-%(filename)s-%(filter_cmd)s-|-wc--l Call NameLoad locals Assign NameStore out SubscriptLoad Call AttributeLoad Call AttributeLoad NameLoad subprocess attr Popen NameLoad cmd keyword shell NameLoad True keyword stdout AttributeLoad NameLoad subprocess attr PIPE keyword stderr AttributeLoad NameLoad subprocess attr STDOUT attr communicate Index Num 0 Return Call NameLoad int SubscriptLoad Call AttributeLoad NameLoad out attr partition Str null Index Num 0 decorator_list FunctionDef isEmpty arguments args NameParam filename defaults body Expr Str return-True-if-file-exists-and-is-empty.----Raises--------------OSError-------If-file-does-not-exist If CompareEq NameLoad filename Str - body Return NameLoad False Return CompareEq SubscriptLoad Call AttributeLoad NameLoad os attr stat NameLoad filename Index AttributeLoad NameLoad stat attr ST_SIZE Num 0 decorator_list FunctionDef isComplete arguments args NameParam filename defaults body Expr Str return-True-if-file-exists-and-is-complete.----A-file-is-complete-if-its-last-line-starts----with-``#-job-finished``. If Call AttributeLoad NameLoad filename attr endswith Str .gz body Raise Call NameLoad NotImplementedError Str isComplete-not-implemented-for-compressed-files If Call NameLoad isEmpty NameLoad filename body Return NameLoad False Assign NameStore lastline Call NameLoad getLastLine NameLoad filename Return Call AttributeLoad NameLoad lastline attr startswith Str #-job-finished decorator_list FunctionDef touchFile arguments args NameParam filename NameParam times defaults NameLoad None body Expr Str update/create-a-sentinel-file.----Compressed-files-(ending-in-.gz)-are-created----as-empty-'gzip'-files,-i.e.,-with-a-header. Assign NameStore existed Call AttributeLoad AttributeLoad NameLoad os attr path attr exists NameLoad filename Assign NameStore fhandle Call NameLoad file NameLoad filename Str a If BoolOpAnd Call AttributeLoad NameLoad filename attr endswith Str .gz UnaryOpNot NameLoad existed body Assign NameStore fhandle Call AttributeLoad NameLoad gzip attr GzipFile NameLoad filename keyword fileobj NameLoad fhandle TryFinally body Expr Call AttributeLoad NameLoad os attr utime NameLoad filename NameLoad times finalbody Expr Call AttributeLoad NameLoad fhandle attr close decorator_list FunctionDef openFile arguments args NameParam filename NameParam mode NameParam create_dir defaults Str r NameLoad False body Expr Str open-file-called-*filename*-with-mode-*mode*.----gzip---compressed-files-are-recognized-by-the----suffix-``.gz``-and-opened-transparently.----Note-that-there-are-differences-in-the-file----like-objects-returned,-for-example-in-the----ability-to-seek.----Arguments-----------------filename-:-string----mode-:-string-------File-opening-mode----create_dir-:-bool-------If-True,-the-directory-containing-filename-------will-be-created-if-it-does-not-exist.----Returns---------------File-or-file-like-object-in-case-of-gzip-compressed-files. Assign TupleStore NameStore _ NameStore ext Call AttributeLoad AttributeLoad NameLoad os attr path attr splitext NameLoad filename If NameLoad create_dir body Assign NameStore dirname Call AttributeLoad AttributeLoad NameLoad os attr path attr dirname NameLoad filename If BoolOpAnd NameLoad dirname UnaryOpNot Call AttributeLoad AttributeLoad NameLoad os attr path attr exists NameLoad dirname body Expr Call AttributeLoad NameLoad os attr makedirs NameLoad dirname If CompareIn Call AttributeLoad NameLoad ext attr lower TupleLoad Str .gz Str .z body Return Call AttributeLoad NameLoad gzip attr open NameLoad filename NameLoad mode orelse Return Call NameLoad open NameLoad filename NameLoad mode decorator_list FunctionDef zapFile arguments args NameParam filename NameParam outfile defaults NameLoad None body Expr Str replace-*filename*-with-empty-file.----File-attributes-such-as-accession-times-are-preserved.----If-the-file-is-a-link,-the-link-will-be-broken-and-replaced-with----an-empty-file-having-the-same-attributes-as-the-file-linked-to.----It-also-takes-an-optional-outfile.-If-the-outfile-has-zero-byte,--------it-usually-means-there's-an-error-in-generating-the-outfile,--------and-it-will-throw-an-error-and-stop.----Returns---------------stat_object-------A-stat-object-of-the-file-cleaned.----link_destination-:-string-------If-the-file-was-a-link,-the-file-being-linked-to. If BoolOpAnd NameLoad outfile CompareEq Call AttributeLoad AttributeLoad NameLoad os attr path attr getsize NameLoad outfile Num 0 body Raise Call NameLoad ValueError BinOpMod Str %s-has-size-zero! NameLoad outfile Assign NameStore original Call AttributeLoad NameLoad os attr stat NameLoad filename If CompareEq AttributeLoad NameLoad original attr st_size Num 0 body Return TupleLoad NameLoad None NameLoad None If Call AttributeLoad AttributeLoad NameLoad os attr path attr islink NameLoad filename body Assign NameStore linkdest Call AttributeLoad NameLoad os attr readlink NameLoad filename Expr Call AttributeLoad NameLoad os attr unlink NameLoad filename Assign NameStore f Call NameLoad open NameLoad filename Str w Expr Call AttributeLoad NameLoad f attr close orelse Assign NameStore linkdest NameLoad None Assign NameStore f Call NameLoad open NameLoad filename Str w Expr Call AttributeLoad NameLoad f attr truncate Expr Call AttributeLoad NameLoad f attr close Expr Call AttributeLoad NameLoad os attr utime NameLoad filename TupleLoad AttributeLoad NameLoad original attr st_atime AttributeLoad NameLoad original attr st_mtime Expr Call AttributeLoad NameLoad os attr chmod NameLoad filename AttributeLoad NameLoad original attr st_mode Return TupleLoad NameLoad original NameLoad linkdest decorator_list FunctionDef cloneFile arguments args NameParam infile NameParam outfile defaults body Expr Str create-a-clone-of-``infile``-named-``outfile``----by-creating-a-soft-link. If CompareNotEq Call AttributeLoad AttributeLoad NameLoad os attr path attr dirname NameLoad infile Call AttributeLoad AttributeLoad NameLoad os attr path attr dirname NameLoad outfile body Assign NameStore relpath Call AttributeLoad AttributeLoad NameLoad os attr path attr relpath Call AttributeLoad AttributeLoad NameLoad os attr path attr dirname NameLoad infile Call AttributeLoad AttributeLoad NameLoad os attr path attr dirname NameLoad outfile orelse Assign NameStore relpath Str . Assign NameStore target Call AttributeLoad AttributeLoad NameLoad os attr path attr join NameLoad relpath Call AttributeLoad AttributeLoad NameLoad os attr path attr basename NameLoad infile TryExcept body Expr Call AttributeLoad NameLoad os attr symlink NameLoad target NameLoad outfile handlers ExceptHandler type NameLoad OSError body Pass decorator_list FunctionDef shadowFile arguments args NameParam infile NameParam outfile defaults body Expr Str move-```infile```-as-```outfile```,-and----touch-```infile```.----This-could-be-useful-when-one-wants-to-skip----some-steps-in-a-pipeline.----Note-that-zapFile-is-not-needed-when-shadowFile----is-used If CompareNotEq NameLoad outfile NameLoad infile body Expr Call AttributeLoad NameLoad shutil attr move NameLoad infile NameLoad outfile Expr Call NameLoad touchFile NameLoad infile orelse Raise Call NameLoad ValueError Str Panic:-infile-and-outfile-names-cannot-be-the-same decorator_list FunctionDef val2str arguments args NameParam val NameParam format NameParam na defaults Str %5.2f Str na body Expr Str return-a-formatted-value.----If-value-does-not-fit-format-string,-return-"na" If CompareEq Call NameLoad type NameLoad val NameLoad int body Return BinOpMod NameLoad format NameLoad val orelse If CompareEq Call NameLoad type NameLoad val NameLoad float body Return BinOpMod NameLoad format NameLoad val TryExcept body Assign NameStore x BinOpMod NameLoad format NameLoad val handlers ExceptHandler type TupleLoad NameLoad ValueError NameLoad TypeError body Assign NameStore x NameLoad na Return NameLoad x decorator_list FunctionDef str2val arguments args NameParam val NameParam format NameParam na NameParam list_detection defaults Str %5.2f Str na NameLoad False body Expr Str guess-type-(int,-float)-of-value.----If-`val`-is-neither-int-nor-float,-the-value----itself-is-returned. If CompareIs NameLoad val NameLoad None body Return NameLoad val FunctionDef _convert arguments args NameParam v defaults body TryExcept body Assign NameStore x Call NameLoad int NameLoad v handlers ExceptHandler type NameLoad ValueError body TryExcept body Assign NameStore x Call NameLoad float NameLoad v handlers ExceptHandler type NameLoad ValueError body Return NameLoad v Return NameLoad x decorator_list If BoolOpAnd NameLoad list_detection CompareIn Str , NameLoad val body Return ListComp Call NameLoad _convert NameLoad v comprehension NameStore v Call AttributeLoad NameLoad val attr split Str , orelse Return Call NameLoad _convert NameLoad val decorator_list FunctionDef prettyPercent arguments args NameParam numerator NameParam denominator NameParam format NameParam na defaults Str %5.2f Str na body Expr Str output-a-percent-value-or-"na"-if-not-defined TryExcept body Assign NameStore x BinOpMod NameLoad format BinOpDiv BinOpMult Num 100.0 NameLoad numerator NameLoad denominator handlers ExceptHandler type TupleLoad NameLoad ValueError NameLoad ZeroDivisionError body Assign NameStore x Str na Return NameLoad x decorator_list FunctionDef prettyString arguments args NameParam val defaults body Expr Str output-val-or-na-if-val-is-None If CompareIsNot NameLoad val NameLoad None body Return NameLoad val orelse Return Str na decorator_list FunctionDef which arguments args NameParam program defaults body Expr Str check-if-`program`-is-in-PATH-and-is-executable.----Returns---------------string-------The-full-path-to-the-program.-Returns-None-if-not-found. FunctionDef is_exe arguments args NameParam fpath defaults body Return BoolOpAnd Call AttributeLoad AttributeLoad NameLoad os attr path attr exists NameLoad fpath Call AttributeLoad NameLoad os attr access NameLoad fpath AttributeLoad NameLoad os attr X_OK decorator_list Assign TupleStore NameStore fpath NameStore fname Call AttributeLoad AttributeLoad NameLoad os attr path attr split NameLoad program If NameLoad fpath body If Call NameLoad is_exe NameLoad program body Return NameLoad program orelse For NameStore path Call AttributeLoad SubscriptLoad AttributeLoad NameLoad os attr environ Index Str PATH attr split AttributeLoad NameLoad os attr pathsep body Assign NameStore exe_file Call AttributeLoad AttributeLoad NameLoad os attr path attr join NameLoad path NameLoad program If Call NameLoad is_exe NameLoad exe_file body Return NameLoad exe_file Return NameLoad None decorator_list FunctionDef iterate arguments args NameParam infile defaults body Expr Str iterate-over-infile-and-return-a-:py:class:`collections.namedtuple`----according-to-a-header-in-the-first-row.----Lines-starting-with-``#``-are-skipped. Assign NameStore n Num 0 For NameStore line NameLoad infile body If Call AttributeLoad NameLoad line attr startswith Str # body Continue AugAssignAdd NameStore n Num 1 If CompareEq NameLoad n Num 1 body Assign NameStore header Call AttributeLoad Call AttributeLoad NameLoad re attr sub Str [^a-zA-Z0-9_\\s] Str _ SubscriptLoad NameLoad line Slice Num -1 attr split Assign NameStore DATA Call AttributeLoad NameLoad collections attr namedtuple Str DATA NameLoad header Continue Assign NameStore result Call NameLoad DATA Call AttributeLoad SubscriptLoad NameLoad line Slice Num -1 attr split Expr Yield NameLoad result decorator_list FunctionDef iterate_tabular arguments args NameParam infile NameParam sep defaults Str null body Expr Str iterate-over-file-`infile`-skipping-lines-starting-with----``#``.----Within-a-line,-records-are-separated-by-`sep`.----Yields--------------tuple--------Records-within-a-line For NameStore line NameLoad infile body If Call AttributeLoad NameLoad line attr startswith Str # body Continue Expr Yield Call AttributeLoad SubscriptLoad NameLoad line Slice Num -1 attr split NameLoad sep decorator_list FunctionDef iterator_split arguments args NameParam infile NameParam regex defaults body Expr Str Return-an-iterator-of-file-chunks-based-on-a-known-logical-start----point-`regex`-that-splits-the-file-into-intuitive-chunks.--This----assumes-the-file-is-structured-in-some-fashion.--For-arbitrary----number-of-bytes-use-file.read(`bytes`).--If-a-header-is-present-it----is-returned-as-the-first-file-chunk.----infile-must-be-either-an-open-file-handle-or-an-iterable. Assign NameStore chunk_list ListLoad Assign NameStore regex Call AttributeLoad NameLoad re attr compile NameLoad regex For NameStore x NameLoad infile body If Call AttributeLoad NameLoad regex attr search NameLoad x body If Call NameLoad len NameLoad chunk_list body Expr Yield NameLoad chunk_list Assign NameStore chunk_list ListLoad Expr Call AttributeLoad NameLoad chunk_list attr append NameLoad x orelse Expr Call AttributeLoad NameLoad chunk_list attr append NameLoad x Expr Yield NameLoad chunk_list decorator_list FunctionDef snip arguments args NameParam filename NameParam extension NameParam alt_extension NameParam strip_path defaults NameLoad None NameLoad None NameLoad False body Expr Str return-prefix-of-`filename`,-that-is-the-part-without-the----extension.----If-`extension`-is-given,-make-sure-that-filename-has-the----extension-(or-`alt_extension`).----If-`strip_path`-is-set-to-true,-the-path-is-stripped-from-the-file----name. If NameLoad extension body If Call AttributeLoad NameLoad filename attr endswith NameLoad extension body Assign NameStore root SubscriptLoad NameLoad filename Slice UnaryOpUSub Call NameLoad len NameLoad extension orelse If BoolOpAnd NameLoad alt_extension Call AttributeLoad NameLoad filename attr endswith NameLoad alt_extension body Assign NameStore root SubscriptLoad NameLoad filename Slice UnaryOpUSub Call NameLoad len NameLoad alt_extension orelse Raise Call NameLoad ValueError BinOpMod Str '%s'-expected-to-end-in-'%s' TupleLoad NameLoad filename NameLoad extension orelse Assign TupleStore NameStore root NameStore ext Call AttributeLoad AttributeLoad NameLoad os attr path attr splitext NameLoad filename If NameLoad strip_path body Assign NameStore snipped Call AttributeLoad AttributeLoad NameLoad os attr path attr basename NameLoad root orelse Assign NameStore snipped NameLoad root Return NameLoad snipped decorator_list FunctionDef checkPresenceOfFiles arguments args NameParam filenames defaults body Expr Str check-for-the-presence/absence-of-files----Parameters------------------filenames-:-list--------Filenames-to-check-for-presence.----Returns---------------missing-:-list--------List-of-missing-filenames Assign NameStore missing ListLoad For NameStore filename NameLoad filenames body If UnaryOpNot Call AttributeLoad AttributeLoad NameLoad os attr path attr exists NameLoad filename body Expr Call AttributeLoad NameLoad missing attr append NameLoad filename Return NameLoad missing decorator_list FunctionDef human2bytes arguments args NameParam s defaults body Expr Str Attempts-to-guess-the-string-format-based-on-default-symbols----set-and-return-the-corresponding-bytes-as-an-integer.----When-unable-to-recognize-the-format-ValueError-is-raised.------>>>-human2bytes('0-B')------0------>>>-human2bytes('1-K')------1024------>>>-human2bytes('1-M')------1048576------>>>-human2bytes('1-Gi')------1073741824------>>>-human2bytes('1-tera')------1099511627776------>>>-human2bytes('0.5kilo')------512------>>>-human2bytes('0.1--byte')------0------>>>-human2bytes('1-k')--#-k-is-an-alias-for-K------1024------>>>-human2bytes('12-foo')------Traceback-(most-recent-call-last):----------...------ValueError:-can't-interpret-'12-foo'----Author:-Giampaolo-Rodola'-<g.rodola-[AT]-gmail-[DOT]-com>----License:-MIT----https://gist.github.com/leepro/9694638 Assign NameStore SYMBOLS Dict Str customary Str customary_ext Str iec Str iec_ext TupleLoad Str B Str K Str M Str G Str T Str P Str E Str Z Str Y TupleLoad Str byte Str kilo Str mega Str giga Str tera Str peta Str exa Str zetta Str iotta TupleLoad Str Bi Str Ki Str Mi Str Gi Str Ti Str Pi Str Ei Str Zi Str Yi TupleLoad Str byte Str kibi Str mebi Str gibi Str tebi Str pebi Str exbi Str zebi Str yobi Assign NameStore init NameLoad s Assign NameStore num Str null While BoolOpOr BoolOpAnd NameLoad s Call AttributeLoad SubscriptLoad NameLoad s Slice Num 0 Num 1 attr isdigit CompareEq SubscriptLoad NameLoad s Slice Num 0 Num 1 Str . body AugAssignAdd NameStore num SubscriptLoad NameLoad s Index Num 0 Assign NameStore s SubscriptLoad NameLoad s Slice Num 1 Assign NameStore num Call NameLoad float NameLoad num Assign NameStore letter Call AttributeLoad NameLoad s attr strip For TupleStore NameStore name NameStore sset Call AttributeLoad NameLoad SYMBOLS attr items body If CompareIn NameLoad letter NameLoad sset body Break orelse If CompareEq NameLoad letter Str k body Assign NameStore sset SubscriptLoad NameLoad SYMBOLS Index Str customary Assign NameStore letter Call AttributeLoad NameLoad letter attr upper orelse Raise Call NameLoad ValueError BinOpMod Str can't-interpret-%r NameLoad init Assign NameStore prefix Dict SubscriptLoad NameLoad sset Index Num 0 Num 1 For TupleStore NameStore i NameStore s Call NameLoad enumerate SubscriptLoad NameLoad sset Slice Num 1 body Assign SubscriptStore NameLoad prefix Index NameLoad s BinOpLShift Num 1 BinOpMult BinOpAdd NameLoad i Num 1 Num 10 Return Call NameLoad int BinOpMult NameLoad num SubscriptLoad NameLoad prefix Index NameLoad letter decorator_list FunctionDef convertDictionary arguments args NameParam d NameParam map defaults Dict body Expr Str convert-string-values-in-a-dictionary-to-numeric-types.----Arguments----d-:-dict-------The-dictionary-to-convert----map-:-dict-------If-map-contains-'default',-a-default-conversion-is-enforced.-------For-example,-to-force-int-for-every-column-but-column-``id``,-------supply-map-=-\ 'default'-:-"int",-"id"-:-"str"-\ Assign NameStore rx_int Call AttributeLoad NameLoad re attr compile Str ^\\s*[+-]*[0-9]+\\s*$ Assign NameStore rx_float Call AttributeLoad NameLoad re attr compile Str ^[-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?$ If CompareIn Str default NameLoad map body Assign NameStore k Str default If CompareEq SubscriptLoad NameLoad map Index NameLoad k Str int body Assign NameStore default NameLoad int orelse If CompareEq SubscriptLoad NameLoad map Index NameLoad k Str float body Assign NameStore default NameLoad float orelse If CompareEq SubscriptLoad NameLoad map Index NameLoad k Str string body Assign NameStore default NameLoad str orelse Assign NameStore default NameLoad False For TupleStore NameStore k NameStore vv Call AttributeLoad NameLoad d attr items body If CompareIs NameLoad vv NameLoad None body Continue Assign NameStore v Call AttributeLoad NameLoad vv attr strip TryExcept body If CompareIn NameLoad k NameLoad map body If CompareEq SubscriptLoad NameLoad map Index NameLoad k Str int body Assign SubscriptStore NameLoad d Index NameLoad k Call NameLoad int NameLoad v orelse If CompareEq SubscriptLoad NameLoad map Index NameLoad k Str float body Assign SubscriptStore NameLoad d Index NameLoad k Call NameLoad float NameLoad v orelse If CompareEq SubscriptLoad NameLoad map Index NameLoad k Str string body Pass Continue orelse If NameLoad default body If CompareNotEq NameLoad v Str null body Assign SubscriptStore NameLoad d Index NameLoad k Call NameLoad default NameLoad v orelse Assign SubscriptStore NameLoad d Index NameLoad k NameLoad v Continue handlers ExceptHandler type NameLoad TypeError name NameStore msg body Raise Call NameLoad TypeError BinOpMod Str conversion-in-field:-%s,-%s TupleLoad NameLoad k NameLoad msg TryExcept body If Call AttributeLoad NameLoad rx_int attr match NameLoad v body Assign SubscriptStore NameLoad d Index NameLoad k Call NameLoad int NameLoad v orelse If Call AttributeLoad NameLoad rx_float attr match NameLoad v body Assign SubscriptStore NameLoad d Index NameLoad k Call NameLoad float NameLoad v handlers ExceptHandler type NameLoad TypeError name NameStore msg body Raise Call NameLoad TypeError BinOpMod Str expected-string-or-buffer:-offending-value-=-'%s' Call NameLoad str NameLoad v ExceptHandler type NameLoad ValueError name NameStore msg body Raise Call NameLoad ValueError BinOpMod Str conversion-error:-%s,-%s TupleLoad NameLoad msg Call NameLoad str NameLoad d Return NameLoad d decorator_list ClassDef nested_dict bases AttributeLoad NameLoad collections attr defaultdict body Expr Str Auto-vivifying-nested-dictionaries.----For-example::------nd=-nested_dict()------nd["mouse"]["chr1"]["+"]-=-311 FunctionDef __init__ arguments args NameParam self defaults body Expr Call AttributeLoad AttributeLoad NameLoad collections attr defaultdict attr __init__ NameLoad self NameLoad nested_dict decorator_list FunctionDef iterflattened arguments args NameParam self defaults body Expr Str iterate-through-values-with-nested-keys-flattened-into-a-tuple For TupleStore NameStore key NameStore value Call AttributeLoad NameLoad self attr iteritems body If Call NameLoad isinstance NameLoad value NameLoad nested_dict body For TupleStore NameStore keykey NameStore value Call AttributeLoad NameLoad value attr iterflattened body Expr Yield TupleLoad BinOpAdd TupleLoad NameLoad key NameLoad keykey NameLoad value orelse Expr Yield TupleLoad TupleLoad NameLoad key NameLoad value decorator_list decorator_list FunctionDef flatten arguments args NameParam l NameParam ltypes defaults TupleLoad NameLoad list NameLoad tuple body Expr Str flatten-a-nested-list.----This-method-works-with-any-list-like-container----such-as-tuples.----Arguments-----------------l-:-list--------A-nested-list.----ltypes-:-list--------A-list-of-valid-container-types.----Returns---------------list-:-list--------A-flattened-list. Assign NameStore ltype Call NameLoad type NameLoad l Assign NameStore l Call NameLoad list NameLoad l Assign NameStore i Num 0 While CompareLt NameLoad i Call NameLoad len NameLoad l body While Call NameLoad isinstance SubscriptLoad NameLoad l Index NameLoad i NameLoad ltypes body If UnaryOpNot SubscriptLoad NameLoad l Index NameLoad i body Expr Call AttributeLoad NameLoad l attr pop NameLoad i AugAssignSub NameStore i Num 1 Break orelse Assign SubscriptStore NameLoad l Slice NameLoad i BinOpAdd NameLoad i Num 1 SubscriptLoad NameLoad l Index NameLoad i AugAssignAdd NameStore i Num 1 Return Call NameLoad ltype NameLoad l decorator_list FunctionDef invert_dictionary arguments args NameParam dict NameParam make_unique defaults NameLoad False body Expr Str returns-an-inverted-dictionary-with-keys-and-values-swapped. Assign NameStore inv Dict If NameLoad make_unique body For TupleStore NameStore k NameStore v Call AttributeLoad NameLoad dict attr iteritems body Assign SubscriptStore NameLoad inv Index NameLoad v NameLoad k orelse For TupleStore NameStore k NameStore v Call AttributeLoad NameLoad dict attr iteritems body Expr Call AttributeLoad Call AttributeLoad NameLoad inv attr setdefault NameLoad v ListLoad attr append NameLoad k Return NameLoad inv decorator_list ClassDef FilePool bases body Expr Str manage-a-pool-of-output-files.----This-class-will-keep-a-large-number-of-files-open.-To----see-if-you-can-handle-this,-check-the-limit-within-the-shell::-------ulimit--n----The-number-of-currently-open-and-maximum-open-files-in-the-system:------cat-/proc/sys/fs/file-nr----Changing-these-limits-might-not-be-easy-without-root-privileges.----The-maximum-number-of-files-opened-is-given-by-:attr:`maxopen`.----This-class-is-inefficient-if-the-number-of-files-is-larger-than----:attr:`maxopen`-and-calls-to-`write`-do-not-group-keys-together.----To-use-this-class,-create-a-FilePool-and-write-to-it-as-if-it-was----a-single-file,-specifying-a-section-for-each-write::--------pool-=-FilePool("%s.tsv")--------for-value-in-range(100):------------for-section-in-("file1",-"file2",-"file3"):-----------------pool.write(section,-str(value)-+-",")----This-will-create-three-files-called-``file1.tsv``,-``file2.tsv``,----``file3.tsv``,-each-containing-the-numbers-from-0-to-99.----The-FilePool-acts-otherwise-as-a-dictionary-providing-access-to----the-number-of-times-an-item-has-been-written-to-each-file::--------print-pool["file1]--------print-pool.items()----Parameters------------------output_pattern-:-string-------output-pattern-to-use.-Should-contain-a-"%s".-If-set-to-None,-the-------pattern-"%s"-will-be-used.----header-:-string-------optional-header-to-write-when-writing-to-a-file-the-first-time.----force-:-bool-------overwrite-existing-files.-All-files-matching-the-pattern-will-be-------deleted. Assign NameStore maxopen Num 5000 FunctionDef __init__ arguments args NameParam self NameParam output_pattern NameParam header NameParam force defaults NameLoad None NameLoad None NameLoad True body Assign AttributeStore NameLoad self attr mFiles Dict Assign AttributeStore NameLoad self attr mOutputPattern NameLoad output_pattern Assign AttributeStore NameLoad self attr open NameLoad open If NameLoad output_pattern body Assign TupleStore NameStore _ NameStore ext Call AttributeLoad AttributeLoad NameLoad os attr path attr splitext NameLoad output_pattern If CompareIn Call AttributeLoad NameLoad ext attr lower TupleLoad Str .gz Str .z body Assign AttributeStore NameLoad self attr open AttributeLoad NameLoad gzip attr open Assign AttributeStore NameLoad self attr mCounts Call AttributeLoad NameLoad collections attr defaultdict NameLoad int Assign AttributeStore NameLoad self attr mHeader NameLoad header If BoolOpAnd NameLoad force NameLoad output_pattern body For NameStore f Call AttributeLoad NameLoad glob attr glob Call AttributeLoad NameLoad re attr sub Str %s Str * NameLoad output_pattern body Expr Call AttributeLoad NameLoad os attr remove NameLoad f decorator_list FunctionDef __del__ arguments args NameParam self defaults body Expr Str close-all-open-files. For NameStore file Call AttributeLoad AttributeLoad NameLoad self attr mFiles attr values body Expr Call AttributeLoad NameLoad file attr close decorator_list FunctionDef __len__ arguments args NameParam self defaults body Return Call NameLoad len AttributeLoad NameLoad self attr mCounts decorator_list FunctionDef close arguments args NameParam self defaults body Expr Str close-all-open-files. For NameStore file Call AttributeLoad AttributeLoad NameLoad self attr mFiles attr values body Expr Call AttributeLoad NameLoad file attr close decorator_list FunctionDef values arguments args NameParam self defaults body Return Call AttributeLoad AttributeLoad NameLoad self attr mCounts attr values decorator_list FunctionDef keys arguments args NameParam self defaults body Return Call AttributeLoad AttributeLoad NameLoad self attr mCounts attr keys decorator_list FunctionDef iteritems arguments args NameParam self defaults body Return Call AttributeLoad AttributeLoad NameLoad self attr mCounts attr iteritems decorator_list FunctionDef items arguments args NameParam self defaults body Return Call AttributeLoad AttributeLoad NameLoad self attr mCounts attr items decorator_list FunctionDef __iter__ arguments args NameParam self defaults body Return Call AttributeLoad AttributeLoad NameLoad self attr mCounts attr __iter__ decorator_list FunctionDef getFile arguments args NameParam self NameParam identifier defaults body Return NameLoad identifier decorator_list FunctionDef getFilename arguments args NameParam self NameParam identifier defaults body Expr Str get-filename-for-an-identifier. If AttributeLoad NameLoad self attr mOutputPattern body Return Call AttributeLoad NameLoad re attr sub Str %s Call NameLoad str NameLoad identifier AttributeLoad NameLoad self attr mOutputPattern orelse Return NameLoad identifier decorator_list FunctionDef setHeader arguments args NameParam self NameParam header defaults body Expr Str set-the-header-to-be-written-to-each-file-when-opening--------for-the-first-time. Assign AttributeStore NameLoad self attr mHeader NameLoad header decorator_list FunctionDef openFile arguments args NameParam self NameParam filename NameParam mode defaults Str w body Expr Str open-file.--------If-file-is-in-a-new-directory,-create-directories. If CompareIn NameLoad mode TupleLoad Str w Str a body Assign NameStore dirname Call AttributeLoad AttributeLoad NameLoad os attr path attr dirname NameLoad filename If BoolOpAnd NameLoad dirname UnaryOpNot Call AttributeLoad AttributeLoad NameLoad os attr path attr exists NameLoad dirname body Expr Call AttributeLoad NameLoad os attr makedirs NameLoad dirname Return Call AttributeLoad NameLoad self attr open NameLoad filename NameLoad mode decorator_list FunctionDef write arguments args NameParam self NameParam identifier NameParam line defaults body Expr Str write-`line`-to-file-specified-by-`identifier` Assign NameStore filename Call AttributeLoad NameLoad self attr getFilename NameLoad identifier If CompareNotIn NameLoad filename AttributeLoad NameLoad self attr mFiles body If BoolOpAnd AttributeLoad NameLoad self attr maxopen CompareGt Call NameLoad len AttributeLoad NameLoad self attr mFiles AttributeLoad NameLoad self attr maxopen body For NameStore f Call AttributeLoad AttributeLoad NameLoad self attr mFiles attr values body Expr Call AttributeLoad NameLoad f attr close Assign AttributeStore NameLoad self attr mFiles Dict Assign SubscriptStore AttributeLoad NameLoad self attr mFiles Index NameLoad filename Call AttributeLoad NameLoad self attr openFile NameLoad filename Str a If AttributeLoad NameLoad self attr mHeader body Expr Call AttributeLoad SubscriptLoad AttributeLoad NameLoad self attr mFiles Index NameLoad filename attr write AttributeLoad NameLoad self attr mHeader TryExcept body Expr Call AttributeLoad SubscriptLoad AttributeLoad NameLoad self attr mFiles Index NameLoad filename attr write NameLoad line handlers ExceptHandler type NameLoad ValueError name NameStore msg body Raise Call NameLoad ValueError BinOpMod Str error-while-writing-to-%s:-msg=%s TupleLoad NameLoad filename NameLoad msg AugAssignAdd SubscriptStore AttributeLoad NameLoad self attr mCounts Index NameLoad filename Num 1 decorator_list FunctionDef deleteFiles arguments args NameParam self NameParam min_size defaults Num 0 body Expr Str delete-all-files-below-a-minimum-size-`min_size`-bytes. Assign NameStore ndeleted Num 0 For TupleStore NameStore filename NameStore counts Call AttributeLoad AttributeLoad NameLoad self attr mCounts attr items body If CompareLt NameLoad counts NameLoad min_size body Expr Call AttributeLoad NameLoad os attr remove NameLoad filename AugAssignAdd NameStore ndeleted Num 1 Return NameLoad ndeleted decorator_list decorator_list ClassDef FilePoolMemory bases NameLoad FilePool body Expr Str manage-a-pool-of-output-files-in-memory.----The-usage-is-the-same-as-:class:`FilePool`-but-the-data-is-cached----in-memory-before-writing-to-disk. Assign NameStore maxopen Num 5000 FunctionDef __init__ arguments args NameParam self defaults vararg args kwarg kwargs body Expr Call AttributeLoad NameLoad FilePool attr __init__ NameLoad self NameLoad args NameLoad kwargs Assign AttributeStore NameLoad self attr data Call AttributeLoad NameLoad collections attr defaultdict NameLoad list Assign AttributeStore NameLoad self attr isClosed NameLoad False decorator_list FunctionDef __del__ arguments args NameParam self defaults body Expr Str close-all-open-files. If UnaryOpNot AttributeLoad NameLoad self attr isClosed body Expr Call AttributeLoad NameLoad self attr close decorator_list FunctionDef close arguments args NameParam self defaults body Expr Str close-all-open-files.--------writes-the-data-to-disk. If AttributeLoad NameLoad self attr isClosed body Raise Call NameLoad IOError Str write-on-closed-FilePool-in-close() For TupleStore NameStore filename NameStore data Call AttributeLoad AttributeLoad NameLoad self attr data attr iteritems body Assign NameStore f Call AttributeLoad NameLoad self attr openFile NameLoad filename Str a If AttributeLoad NameLoad self attr mHeader body Expr Call AttributeLoad NameLoad f attr write AttributeLoad NameLoad self attr mHeader Expr Call AttributeLoad NameLoad f attr write Call AttributeLoad Str null attr join NameLoad data Expr Call AttributeLoad NameLoad f attr close Assign AttributeStore NameLoad self attr isClosed NameLoad True decorator_list FunctionDef write arguments args NameParam self NameParam identifier NameParam line defaults body Assign NameStore filename Call AttributeLoad NameLoad self attr getFilename NameLoad identifier Expr Call AttributeLoad SubscriptLoad AttributeLoad NameLoad self attr data Index NameLoad filename attr append NameLoad line AugAssignAdd SubscriptStore AttributeLoad NameLoad self attr mCounts Index NameLoad filename Num 1 decorator_list decorator_list FunctionDef readMap arguments args NameParam infile NameParam columns NameParam map_functions NameParam both_directions NameParam has_header NameParam dtype defaults TupleLoad Num 0 Num 1 TupleLoad NameLoad str NameLoad str NameLoad False NameLoad False NameLoad dict body Expr Str read-a-map-(key,-value-pairs)-from-infile.----If-there-are-multiple-entries-for-the-same-key,-only-the----last-entry-will-be-recorded.----Arguments-----------------infile-:-File-------File-object-to-read-from----columns-:-tuple-------Columns-(A,-B)-to-take-from-the-file-to-create-the-mapping-from-------A-to-B.----map_functions-:-tuple-------Functions-to-convert-the-values-in-the-rows-to-the-desired-------object-types-such-as-int-or-float.----both_directions-:-bool-------If-true,-both-mapping-directions-are-returned.----has_header-:-bool-------If-true,-ignore-first-line-with-header.----dtype-:-function-------datatype-to-use-for-the-dictionaries.----Returns---------------map-:-dict-------A-dictionary-containing-the-mapping.-If-`both_directions`-is-true,-------two-dictionaries-will-be-returned. Assign NameStore m Call NameLoad dtype Assign NameStore r Call NameLoad dtype Assign NameStore n Num 0 If CompareEq NameLoad columns Str all body Assign NameStore key_column Num 0 Assign NameStore value_column NameLoad None orelse Assign TupleStore NameStore key_column NameStore value_column NameLoad columns Assign TupleStore NameStore key_function NameStore value_function NameLoad map_functions Assign NameStore datatype NameLoad None For NameStore l NameLoad infile body If CompareEq SubscriptLoad NameLoad l Index Num 0 Str # body Continue AugAssignAdd NameStore n Num 1 If BoolOpAnd NameLoad has_header CompareEq NameLoad n Num 1 body If CompareEq NameLoad columns Str all body Assign NameStore header Call AttributeLoad SubscriptLoad NameLoad l Slice Num -1 attr split Str null Assign NameStore datatype Call AttributeLoad NameLoad collections attr namedtuple Str DATA SubscriptLoad NameLoad header Slice Num 1 Continue Assign NameStore d Call AttributeLoad SubscriptLoad NameLoad l Slice Num -1 attr split Str null If CompareLt Call NameLoad len NameLoad d Num 2 body Continue Assign NameStore key Call NameLoad key_function SubscriptLoad NameLoad d Index NameLoad key_column If NameLoad value_column body Assign NameStore val Call NameLoad value_function SubscriptLoad NameLoad d Index NameLoad value_column orelse If NameLoad datatype body Assign NameStore val Call AttributeLoad NameLoad datatype attr _make ListComp SubscriptLoad NameLoad d Index NameLoad x comprehension NameStore x Call NameLoad range Num 1 Call NameLoad len NameLoad d orelse Assign NameStore val Call NameLoad tuple Call NameLoad map NameLoad value_function ListComp SubscriptLoad NameLoad d Index NameLoad x comprehension NameStore x Call NameLoad range Num 1 Call NameLoad len NameLoad d Assign SubscriptStore NameLoad m Index NameLoad key NameLoad val If CompareNotIn NameLoad val NameLoad r body Assign SubscriptStore NameLoad r Index NameLoad val ListLoad Expr Call AttributeLoad SubscriptLoad NameLoad r Index NameLoad val attr append NameLoad key If NameLoad both_directions body Return TupleLoad NameLoad m NameLoad r orelse Return NameLoad m decorator_list FunctionDef readList arguments args NameParam infile NameParam column NameParam map_function NameParam map_category NameParam with_title defaults Num 0 NameLoad str Dict NameLoad False body Expr Str read-a-list-of-values-from-infile.----Arguments-----------------infile-:-File-------File-object-to-read-from----columns-:-int-------Column-to-take-from-the-file.----map_function-:-function-------Function-to-convert-the-values-in-the-rows-to-the-desired-------object-types-such-as-int-or-float.----map_category-:-dict-------When-given,-automatically-transform/map-the-values-given-------this-dictionary.----with_title-:-bool-------If-true,-first-line-of-file-is-title-and-will-be-ignored.----Returns---------------list-:-list-------A-list-with-the-values. Assign NameStore m ListLoad Assign NameStore title NameLoad None For NameStore l NameLoad infile body If CompareEq SubscriptLoad NameLoad l Index Num 0 Str # body Continue If BoolOpAnd NameLoad with_title UnaryOpNot NameLoad title body Assign NameStore title SubscriptLoad Call AttributeLoad SubscriptLoad NameLoad l Slice Num -1 attr split Str null Index NameLoad column Continue TryExcept body Assign NameStore d Call NameLoad map_function SubscriptLoad Call AttributeLoad SubscriptLoad NameLoad l Slice Num -1 attr split Str null Index NameLoad column handlers ExceptHandler type NameLoad ValueError body Continue If NameLoad map_category body Assign NameStore d SubscriptLoad NameLoad map_category Index NameLoad d Expr Call AttributeLoad NameLoad m attr append NameLoad d Return NameLoad m decorator_list FunctionDef readMultiMap arguments args NameParam infile NameParam columns NameParam map_functions NameParam both_directions NameParam has_header NameParam dtype defaults TupleLoad Num 0 Num 1 TupleLoad NameLoad str NameLoad str NameLoad False NameLoad False NameLoad dict body Expr Str read-a-map-(pairs-of-values)-from-infile.----In-contrast-to-:func:`readMap`,-this-method-permits-multiple----entries-for-the-same-key.----Arguments-----------------infile-:-File-------File-object-to-read-from----columns-:-tuple-------Columns-(A,-B)-to-take-from-the-file-to-create-the-mapping-from-------A-to-B.----map_functions-:-tuple-------Functions-to-convert-the-values-in-the-rows-to-the-desired-------object-types-such-as-int-or-float.----both_directions-:-bool-------If-true,-both-mapping-directions-are-returned-in-a-tuple,-i.e.,-------A->B-and-B->A.----has_header-:-bool-------If-true,-ignore-first-line-with-header.----dtype-:-function-------datatype-to-use-for-the-dictionaries.----Returns---------------map-:-dict-------A-dictionary-containing-the-mapping.-If-`both_directions`-is-true,-------two-dictionaries-will-be-returned. Assign NameStore m Call NameLoad dtype Assign NameStore r Call NameLoad dtype Assign NameStore n Num 0 For NameStore l NameLoad infile body If CompareEq SubscriptLoad NameLoad l Index Num 0 Str # body Continue AugAssignAdd NameStore n Num 1 If BoolOpAnd NameLoad has_header CompareEq NameLoad n Num 1 body Continue Assign NameStore d Call AttributeLoad SubscriptLoad NameLoad l Slice Num -1 attr split Str null TryExcept body Assign NameStore key Call SubscriptLoad NameLoad map_functions Index Num 0 SubscriptLoad NameLoad d Index SubscriptLoad NameLoad columns Index Num 0 Assign NameStore val Call SubscriptLoad NameLoad map_functions Index Num 1 SubscriptLoad NameLoad d Index SubscriptLoad NameLoad columns Index Num 1 handlers ExceptHandler type TupleLoad NameLoad ValueError NameLoad IndexError name NameStore msg body Raise Call NameLoad ValueError BinOpMod Str parsing-error-in-line-%s:-%s TupleLoad SubscriptLoad NameLoad l Slice Num -1 NameLoad msg If CompareNotIn NameLoad key NameLoad m body Assign SubscriptStore NameLoad m Index NameLoad key ListLoad Expr Call AttributeLoad SubscriptLoad NameLoad m Index NameLoad key attr append NameLoad val If CompareNotIn NameLoad val NameLoad r body Assign SubscriptStore NameLoad r Index NameLoad val ListLoad Expr Call AttributeLoad SubscriptLoad NameLoad r Index NameLoad val attr append NameLoad key If NameLoad both_directions body Return TupleLoad NameLoad m NameLoad r orelse Return NameLoad m decorator_list FunctionDef readMatrix arguments args NameParam infile NameParam dtype defaults AttributeLoad NameLoad numpy attr float body Expr Str read-a-numpy-matrix-from-infile.----return-tuple-of-matrix,-row_headers,-col_headers Assign NameStore lines ListComp NameLoad l comprehension NameStore l Call AttributeLoad NameLoad infile attr readlines UnaryOpNot Call AttributeLoad NameLoad l attr startswith Str # Assign NameStore nrows BinOpSub Call NameLoad len NameLoad lines Num 1 Assign NameStore col_headers SubscriptLoad Call AttributeLoad SubscriptLoad SubscriptLoad NameLoad lines Index Num 0 Slice Num -1 attr split Str null Slice Num 1 Assign NameStore ncols Call NameLoad len NameLoad col_headers Assign NameStore matrix Call AttributeLoad NameLoad numpy attr zeros TupleLoad NameLoad nrows NameLoad ncols keyword dtype NameLoad dtype Assign NameStore row_headers ListLoad For TupleStore NameStore row NameStore l Call NameLoad enumerate SubscriptLoad NameLoad lines Slice Num 1 body Assign NameStore data Call AttributeLoad SubscriptLoad NameLoad l Slice Num -1 attr split Str null Expr Call AttributeLoad NameLoad row_headers attr append SubscriptLoad NameLoad data Index Num 0 Assign SubscriptStore NameLoad matrix Index NameLoad row Call AttributeLoad NameLoad numpy attr array SubscriptLoad NameLoad data Slice Num 1 keyword dtype NameLoad dtype Return TupleLoad NameLoad matrix NameLoad row_headers NameLoad col_headers decorator_list FunctionDef writeMatrix arguments args NameParam outfile NameParam matrix NameParam row_headers NameParam col_headers NameParam row_header defaults Str null body Expr Str write-a-numpy-matrix-to-outfile.----*row_header*-gives-the-title-of-the-rows Expr Call AttributeLoad NameLoad outfile attr write BinOpMod Str %s%s TupleLoad NameLoad row_header Call AttributeLoad Str null attr join NameLoad col_headers For TupleStore NameStore x NameStore row Call NameLoad enumerate NameLoad matrix body Assert CompareEq Call NameLoad len NameLoad row Call NameLoad len NameLoad col_headers Expr Call AttributeLoad NameLoad outfile attr write BinOpMod Str %s%s TupleLoad SubscriptLoad NameLoad row_headers Index NameLoad x Call AttributeLoad Str null attr join Call NameLoad map NameLoad str NameLoad row decorator_list FunctionDef readTable arguments args NameParam file NameParam separator NameParam numeric_type NameParam take NameParam headers NameParam truncate NameParam cumulate_out_of_range defaults Str null AttributeLoad NameLoad numpy attr float Str all NameLoad True NameLoad None NameLoad True body Expr Str read-a-table-of-values.----If-cumulate_out_of_range-is-set-to-true,-the-terminal-bins-will----contain-the-cumulative-values-of-bins-out-of-range.----..-note::-Deprecated-------use-pandas-dataframes-instead Assign NameStore lines Call NameLoad filter Lambda arguments args NameParam x defaults CompareNotEq SubscriptLoad NameLoad x Index Num 0 Str # Call AttributeLoad NameLoad file attr readlines If CompareEq Call NameLoad len NameLoad lines Num 0 body Return TupleLoad NameLoad None ListLoad If CompareEq NameLoad take Str all body Assign NameStore num_cols Call NameLoad len Call AttributeLoad NameLoad string attr split SubscriptLoad SubscriptLoad NameLoad lines Index Num 0 Slice Num -1 Str null Assign NameStore take Call NameLoad range Num 0 NameLoad num_cols orelse Assign NameStore num_cols Call NameLoad len NameLoad take If NameLoad headers body Assign NameStore headers Call AttributeLoad SubscriptLoad SubscriptLoad NameLoad lines Index Num 0 Slice Num -1 attr split Str null Assign NameStore headers Call NameLoad map Lambda arguments args NameParam x defaults SubscriptLoad NameLoad headers Index NameLoad x NameLoad take Delete SubscriptDel NameLoad lines Index Num 0 Assign NameStore num_rows Call NameLoad len NameLoad lines Assign NameStore matrix Call AttributeLoad AttributeLoad NameLoad numpy attr ma attr masked_array Call AttributeLoad NameLoad numpy attr zeros TupleLoad NameLoad num_rows NameLoad num_cols NameLoad numeric_type If NameLoad truncate body Assign TupleStore NameStore min_row NameStore max_row NameLoad truncate Assign NameStore nrow Num 0 Assign NameStore min_data BinOpMult ListLoad Num 0 NameLoad num_cols Assign NameStore max_data NameLoad None For NameStore l NameLoad lines body Assign NameStore data Call AttributeLoad SubscriptLoad NameLoad l Slice Num -1 attr split Str null Assign NameStore data Call NameLoad map Lambda arguments args NameParam x defaults SubscriptLoad NameLoad data Index NameLoad x NameLoad take For NameStore x Call NameLoad range Call NameLoad len NameLoad data body TryExcept body Assign SubscriptStore NameLoad data Index NameLoad x Call NameLoad float SubscriptLoad NameLoad data Index NameLoad x handlers ExceptHandler type NameLoad ValueError body Assign SubscriptStore NameLoad data Index NameLoad x AttributeLoad AttributeLoad NameLoad numpy attr ma attr masked If CompareIsNot NameLoad truncate NameLoad None body If CompareLt SubscriptLoad NameLoad data Index Num 0 NameLoad min_row body If NameLoad cumulate_out_of_range body For NameStore x Call NameLoad range Num 1 NameLoad num_cols body AugAssignAdd SubscriptStore NameLoad min_data Index NameLoad x SubscriptLoad NameLoad data Index NameLoad x Continue orelse If CompareGtE SubscriptLoad NameLoad data Index Num 0 NameLoad max_row body If CompareIs NameLoad max_data NameLoad None body Assign NameStore max_data BinOpMult ListLoad Num 0 NameLoad num_cols Assign SubscriptStore NameLoad max_data Index Num 0 NameLoad max_row For NameStore x Call NameLoad range Num 1 NameLoad num_cols body TryExcept body AugAssignAdd SubscriptStore NameLoad max_data Index NameLoad x SubscriptLoad NameLoad data Index NameLoad x handlers ExceptHandler type NameLoad TypeError body Continue Continue orelse If CompareIsNot NameLoad min_row NameLoad None body If NameLoad cumulate_out_of_range body For NameStore x Call NameLoad range Num 0 NameLoad num_cols body TryExcept body AugAssignAdd SubscriptStore NameLoad min_data Index NameLoad x SubscriptLoad NameLoad data Index NameLoad x handlers ExceptHandler type NameLoad TypeError body Continue orelse Assign NameStore min_data NameLoad data Assign NameStore data NameLoad min_data Assign NameStore min_row NameLoad None For NameStore x Call NameLoad range Call NameLoad len NameLoad data body Assign SubscriptStore NameLoad matrix Index TupleLoad NameLoad nrow NameLoad x SubscriptLoad NameLoad data Index NameLoad x AugAssignAdd NameStore nrow Num 1 If CompareIsNot NameLoad truncate NameLoad None body If NameLoad cumulate_out_of_range body If CompareIsNot NameLoad max_data NameLoad None body Assign SubscriptStore NameLoad matrix Index NameLoad nrow NameLoad max_data Assign NameStore matrix SubscriptLoad NameLoad matrix ExtSlice Slice Num 0 BinOpAdd NameLoad nrow Num 1 Slice Num 0 NameLoad num_cols Return TupleLoad NameLoad matrix NameLoad headers decorator_list FunctionDef writeTable arguments args NameParam outfile NameParam table NameParam columns NameParam fillvalue defaults NameLoad None Str null body Expr Str write-a-table-to-outfile.----If-table-is-a-dictionary,-output-columnwise.-If-*columns*-is-a-list,----only-output-columns-in-columns-in-the-specified-order.----..-note::-Deprecated-------use-pandas-dataframes-instead If CompareEq Call NameLoad type NameLoad table NameLoad dict body If CompareIs NameLoad columns NameLoad None body Assign NameStore columns Call AttributeLoad NameLoad table attr keys Expr Call AttributeLoad NameLoad outfile attr write BinOpAdd Call AttributeLoad Str null attr join NameLoad columns Str null Assign NameStore data ListComp SubscriptLoad NameLoad table Index NameLoad x comprehension NameStore x NameLoad columns Assign NameStore data Call NameLoad list Call AttributeLoad NameLoad itertools attr izip_longest keyword fillvalue NameLoad fillvalue NameLoad data For NameStore d NameLoad data body Expr Call AttributeLoad NameLoad outfile attr write BinOpAdd Call AttributeLoad Str null attr join Call NameLoad map NameLoad str NameLoad d Str null orelse Raise NameLoad NotImplementedError decorator_list FunctionDef ReadMap arguments args defaults vararg args kwarg kwargs body Expr Str deprecated,-use-readMap. Return Call NameLoad readMap NameLoad args NameLoad kwargs decorator_list FunctionDef ReadList arguments args defaults vararg args kwarg kwargs body Expr Str deprecated,-use-readList() Return Call NameLoad readList NameLoad args NameLoad kwargs decorator_list FunctionDef writeLines arguments args NameParam outfile NameParam lines NameParam header defaults NameLoad False body Expr Str expects-[[[line1-field1],[line1-field2-]-],...-] Assign NameStore handle Call NameLoad openFile NameLoad outfile Str w If NameLoad header body Expr Call AttributeLoad NameLoad handle attr write BinOpAdd Call AttributeLoad Str null attr join ListComp Call NameLoad str NameLoad title comprehension NameStore title NameLoad header Str null For NameStore line NameLoad lines body Expr Call AttributeLoad NameLoad handle attr write BinOpAdd Call AttributeLoad Str null attr join ListComp Call NameLoad str NameLoad field comprehension NameStore field NameLoad line Str null Expr Call AttributeLoad NameLoad handle attr close decorator_list FunctionDef txtToDict arguments args NameParam filename NameParam key NameParam sep defaults NameLoad None Str null body Expr Str make-a-dictionary-from-a-text-file-keyed----on-the-specified-column. Assign NameStore count Num 0 Assign NameStore result Dict Assign TupleStore NameStore valueidx NameStore keyidx TupleLoad NameLoad False NameLoad False Assign NameStore field_names ListLoad With Call NameLoad open NameLoad filename Str r NameStore fh body For NameStore line NameLoad fh body If Call AttributeLoad NameLoad line attr startswith Str # body Continue If CompareEq NameLoad count Num 0 body Assign NameStore fieldn Num 0 For NameStore rawfield Call AttributeLoad NameLoad line attr split NameLoad sep body Assign NameStore field Call AttributeLoad NameLoad rawfield attr strip If CompareEq NameLoad field NameLoad key body Assign NameStore keyidx NameLoad fieldn Expr Call AttributeLoad NameLoad field_names attr append NameLoad field AugAssignAdd NameStore fieldn Num 1 If UnaryOpNot NameLoad keyidx body Raise Call NameLoad ValueError Str key-name-not-found-in-header orelse Assign NameStore fields ListComp Call AttributeLoad NameLoad x attr strip comprehension NameStore x Call AttributeLoad NameLoad line attr split NameLoad sep Assign NameStore fieldn Num 0 Assign NameStore thiskey SubscriptLoad NameLoad fields Index NameLoad keyidx Assign SubscriptStore NameLoad result Index NameLoad thiskey Dict For NameStore field NameLoad fields body If CompareEq NameLoad fieldn NameLoad keyidx body Pass orelse Assign NameStore colkey SubscriptLoad NameLoad field_names Index NameLoad fieldn Assign SubscriptStore SubscriptLoad NameLoad result Index NameLoad thiskey Index NameLoad colkey NameLoad field AugAssignAdd NameStore fieldn Num 1 AugAssignAdd NameStore count Num 1 Return NameLoad result decorator_list FunctionDef pickle arguments args NameParam file_name NameParam obj defaults body Expr Str dump-a-python-object-to-a-file-using-pickle With Call NameLoad open NameLoad file_name Str wb NameStore pkl_file body Expr Call AttributeLoad NameLoad pickle attr dump NameLoad obj NameLoad pkl_file Return decorator_list FunctionDef unpickle arguments args NameParam file_name defaults body Expr Str retrieve-a-pickled-python-object-from-a-file With Call NameLoad open NameLoad file_name Str r NameStore pkl_file body Assign NameStore data Call AttributeLoad NameLoad pickle attr load NameLoad pkl_file Return NameLoad data decorator_list 
