本文整理汇总了Python中MOSES.getLastWorkingDate方法的典型用法代码示例。如果您正苦于以下问题:Python MOSES.getLastWorkingDate方法的具体用法?Python MOSES.getLastWorkingDate怎么用?Python MOSES.getLastWorkingDate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MOSES
的用法示例。
在下文中一共展示了MOSES.getLastWorkingDate方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import MOSES [as 别名]
# 或者: from MOSES import getLastWorkingDate [as 别名]
def __init__(self, user_id, password, category_tree, employees_list, brand_list):
super(Bacon, self).__init__()
self.user_id = user_id
self.password = password
self.category_tree = category_tree
self.employees_list = employees_list
self.brand_list = brand_list
self.current_processing_date = MOSES.getLastWorkingDate(self.user_id, self.password,datetime.date.today(),"All")
self.createUI()
self.mapEvents()
示例2: getWriterStatsForDate
# 需要导入模块: import MOSES [as 别名]
# 或者: from MOSES import getLastWorkingDate [as 别名]
def getWriterStatsForDate(self, query_date):
lwd = MOSES.getLastWorkingDate(self.user_id, self.password, query_date)
lwd_efficiency = None
lwd_cfm, lwd_gseo, lwd_fatals = None, None, None
previous_dictionary = self.result_dictionary.get(lwd)
if lwd in self.getProcessedDates():
lwd_efficiency = previous_dictionary.get("Efficiency")
lwd_cfm = previous_dictionary.get("CFM")
lwd_gseo = previous_dictionary.get("GSEO")
lwd_fatals = previous_dictionary.get("Fatals")
if lwd_efficiency is None or lwd_cfm is None or lwd_gseo is None or lwd_fatals is None:
self.updateResultsDictionaryForDate(lwd)
previous_dictionary = self.result_dictionary.get(lwd)
lwd_efficiency = previous_dictionary.get("Efficiency")
previous_dictionary = self.result_dictionary.get(lwd)
lwd_cfm = previous_dictionary.get("CFM")
lwd_gseo = previous_dictionary.get("GSEO")
lwd_fatals = previous_dictionary.get("Fatals")
stats_keys = ["Time Frame", "Efficiency", "CFM", "GSEO"]
lwd_stats = [lwd, lwd_efficiency, lwd_cfm, lwd_gseo]
first_date_of_week = MOSES.getFirstDayOfWeek(lwd)
if first_date_of_week == lwd:
cw_stats = ["Week#%d"%lwd.isocalendar()[1]] + lwd_stats[1:]
else:
cw_efficiency = MOSES.getEfficiencyForWeek(self.user_id, self.password, lwd, category_tree=self.category_tree)
cw_cfm, cw_gseo, cw_fatals = MOSES.getCFMGSEOForWeek(self.user_id, self.password, lwd)
cw_stats = ["Week#%d"%lwd.isocalendar()[1], cw_efficiency, cw_cfm, cw_gseo]
cm_efficiency = MOSES.getEfficiencyForMonth(self.user_id, self.password, lwd, category_tree=self.category_tree)
cm_cfm, cm_gseo, cm_fatals = MOSES.getCFMGSEOForMonth(self.user_id, self.password, lwd)
current_month = lwd.strftime("%b") if (len(lwd.strftime("%B"))>6) else lwd.strftime("%B")
cm_stats = [current_month, cm_efficiency, cm_cfm, cm_gseo]
stats = [lwd_stats, cw_stats, cm_stats]
formatted_stats = []
for row in stats:
formatted_row = [row[0]]
for item in row[1:]:
if (type(item) is str) or (item is None):
item = "-"
elif math.isnan(item) :
item = "-"
else:
item = "%6.3f%%"%(item*100)
formatted_row.append(item)
formatted_stats.append(formatted_row)
return pd.DataFrame(formatted_stats, columns=stats_keys)
示例3: createUI
# 需要导入模块: import MOSES [as 别名]
# 或者: from MOSES import getLastWorkingDate [as 别名]
def createUI(self):
self.start_date_label = QtGui.QLabel("<b>Date:</b>")
self.start_date_edit = QtGui.QDateTimeEdit()
self.start_date_edit.setToolTip("Set the date for which you want to generate the report.")
lwd = MOSES.getLastWorkingDate(self.user_id, self.password, queryUser="All")
self.start_date_edit.setDate(lwd)
self.start_date_edit.setDisplayFormat("MMMM dd, yyyy")
self.start_date_edit.setMinimumDate(QtCore.QDate(2015,1,1))
self.start_date_edit.setCalendarPopup(True)
self.end_date_edit = QtGui.QDateTimeEdit()
self.end_date_edit.setToolTip("Select an end date. Only working days will be considered for the calculation.\nThis field will be disabled if the checkbox isn't marked to calculate the average statistics between dates.")
self.end_date_edit.setDate(self.start_date_edit.date())
self.end_date_edit.setDisplayFormat("MMMM dd, yyyy")
self.end_date_edit.setMinimumDate(self.start_date_edit.date())
self.end_date_edit.setCalendarPopup(True)
self.writers_combobox = CheckableComboBox("Writers")
self.writers_combobox.setToolTip("Select a group of writers if you want to check their performance for some time frame.")
report_names = ["Article Count","Efficiency","Audit Count","CFM","GSEO","Stack Rank Index","Efficiency KRA","CFM KRA","GSEO KRA"]#,"Audit Percentage"]
self.parameters_combobox = CheckableComboBox("Report Values")
self.parameters_combobox.addItems(report_names)
self.parameters_combobox.select(["Efficiency","CFM","GSEO", "Article Count", "Audit Count"])
self.report_time_frames_combobox = CheckableComboBox("Timeframe")
self.report_time_frames_combobox.addItems(["Daily","Weekly","Monthly","Quarterly","Half-Yearly"])
self.report_time_frames_combobox.select(["Daily","Weekly"])
self.sorting_filter_label = QtGui.QLabel("<b>Sort By:</b>")
self.sorting_filter_combobox = QtGui.QComboBox()
self.sorting_filter_combobox.setToolTip("Select the parameter you want to sort the generated reports by.")
self.build_button = QtGui.QPushButton("Build Daily Team Performance Report")
self.build_button.setToolTip("Click this button to start building the report")
self.plot_button = QtGui.QPushButton("Plot")
self.plot_button.setToolTip("Check this if you want to automatically plot the graphs.")
self.build_dbr_button = QtGui.QPushButton("Build DBR Report")
self.build_dbr_button.setToolTip("Check this if you want to automatically plot the graphs.")
self.build_wbr_button = QtGui.QPushButton("Build WBR Report")
self.build_wbr_button.setToolTip("Check this if you want to automatically plot the graphs.")
self.progress_bar = ProgressBar()
self.export_graphs_button = QtGui.QPushButton("Save")
self.export_graphs_button.setToolTip("Click this button to save the generated reports and graphs in a desired folder location.")
self.report = CopiableQTableWidget(0, 0)
self.t_report = CopiableQTableWidget(0, 0)
self.dbr_report = CopiableQTableWidget(0, 0)
self.wbr_report = CopiableQTableWidget(0, 0)
self.graphs = DailyGraphView()
self.t_graphs = DailyGraphView()
self.reports_tab = QtGui.QTabWidget()
self.reports_tab.addTab(self.report,"Writers' Report")
#self.reports_tab.addTab(self.graphs, "Writers' Graphs")
#self.reports_tab.addTab(self.t_report,"Team Report")
#self.reports_tab.addTab(self.t_graphs, "Team Graphs")
self.reports_tab.addTab(self.dbr_report, "DBR Report")
self.reports_tab.addTab(self.wbr_report, "WBR Report")
self.status = QtGui.QLabel("I'm a Porkitzer Prize Winning Reporter.")
options_layout_row_1 = QtGui.QHBoxLayout()
options_layout_row_1.addWidget(self.start_date_label,0)
options_layout_row_1.addWidget(self.start_date_edit,1)
options_layout_row_1.addWidget(self.end_date_edit,1)
options_layout_row_1.addWidget(self.writers_combobox,1)
options_layout_row_1.addWidget(self.parameters_combobox,1)
options_layout_row_1.addWidget(self.report_time_frames_combobox,1)
options_layout_row_1.addStretch(2)
options_layout_row_2 = QtGui.QHBoxLayout()
options_layout_row_2.addWidget(self.sorting_filter_label,0)
options_layout_row_2.addWidget(self.sorting_filter_combobox,1)
options_layout_row_2.addWidget(self.build_button,0)
#options_layout_row_2.addWidget(self.plot_button,0)
options_layout_row_2.addWidget(self.build_dbr_button,0)
options_layout_row_2.addWidget(self.build_wbr_button,0)
options_layout_row_2.addStretch(2)
options_layout = QtGui.QVBoxLayout()
options_layout.addLayout(options_layout_row_1,0)
options_layout.addLayout(options_layout_row_2,0)
self.daily_porker_logo = ImageButton(
os.path.join(MOSES.getPathToImages(),"newspaper.png"),
100,
100,
os.path.join(MOSES.getPathToImages(),"newspaper_mouseover.png")
)
self.daily_porker_logo.setFlat(True)
options = QtGui.QGroupBox("Report Options")
options.setLayout(options_layout)
options_with_logo = QtGui.QHBoxLayout()
options_with_logo.addWidget(self.daily_porker_logo, 0, QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
#.........这里部分代码省略.........
示例4: createUI
# 需要导入模块: import MOSES [as 别名]
# 或者: from MOSES import getLastWorkingDate [as 别名]
def createUI(self):
self.instruction_label = QtGui.QLabel("<b>Select filters from the following:</b>")
self.writers_filter_box = CheckableComboBox("Writers")
self.writers_filter_box.setToolTip("Select the writers whose data you'd like to extract.")
self.category_selector = CategorySelector(self.category_tree)
self.brands_filter_box = CheckableComboBox("Brands")
self.brands_filter_box.setToolTip("Select the Brands you'd like to extract.")
self.start_date_edit = QtGui.QDateTimeEdit()
self.start_date_edit.setToolTip("Select the start date for the data set you'd like to extract.")
self.start_date_edit.setCalendarPopup(True)
self.start_date_edit.setDisplayFormat("MMMM dd, yyyy")
self.start_date_edit.setMinimumDate(QtCore.QDate(2015,1,1))
lwd = MOSES.getLastWorkingDate(self.user_id, self.password, queryUser="All")
self.start_date_edit.setDate(lwd)
self.end_date_edit = QtGui.QDateTimeEdit()
self.end_date_edit.setToolTip("Select the End Date for the data set you'd like to extract.")
self.end_date_edit.setDate(QtCore.QDate(datetime.date.today()))
self.end_date_edit.setCalendarPopup(True)
self.end_date_edit.setDisplayFormat("MMMM dd, yyyy")
self.end_date_edit.setMinimumDate(self.start_date_edit.date().toPyDate())
self.end_date_edit.setMaximumDate(datetime.date.today())
self.end_date_edit.setDate(lwd)
self.all_time_dates = QtGui.QCheckBox("Pull All Time Data")
self.all_time_dates.setToolTip("Check this box to pull data for the selected filter from all available data.")
self.piggybank_summarizer = PiggyBankSummarizer()
self.piggybank_summarizer.setToolTip("This widget can be used to summarize the piggybank in various ways.")
self.piggybank_summarizer.setEnabled(False)
self.piggybank = CopiableQTableWidget(0,0)
self.piggybank.setToolTip("This table shows all available data for the selected filters.")
self.piggybank.setStyleSheet("gridline-color: rgb(0, 0, 0)")
self.piggybank_summary_widget = QtGui.QWidget()
self.piggybank_summary_column_chooser_label = QtGui.QLabel("Select Column(s):")
self.piggybank_summary_column_chooser = CheckableComboBox("Columns")
self.piggybank_summary_column_chooser.setToolTip("Select the piggy bank columns you'd like to summarize.")
self.piggybank_summary_column_chooser.addItems(["Writer Name","Source", "Description Type", "BU","Super-Category", "Category", "Sub-Category", "Vertical", "Brand"])
self.piggybank_summary_refresh_button = QtGui.QPushButton("Refresh Summary Table")
self.piggybank_summary_refresh_button.setToolTip("Click this button to recalculate the audit plan and break up for the selected parameters.")
self.piggybank_summary = CopiableQTableWidget(0,0)
self.piggybank_summary.setToolTip("This table displays a break up of all the available data between the selected dates, for the chosen filters,\nbased on the summarization columns you've picked.")
self.piggybank_summary.setStyleSheet("gridline-color: rgb(0, 0, 0)")
self.piggybank_summary_random_fsns = CopiableQTableWidget(0,0)
self.piggybank_summary_random_fsns.setToolTip("This table displays a list of random FSNs each editor must audit to satisfy his or her requirements for the selected duration.")
self.piggybank_summary_random_fsns.setStyleSheet("gridline-color: rgb(0, 0, 0)")
self.piggybank_summary_editor_summary = CopiableQTableWidget(0,0)
self.piggybank_summary_editor_summary.setStyleSheet("gridline-color: rgb(0, 0, 0)")
self.piggybank_summary_audit_percentage_label = QtGui.QLabel("Audit Percentage:")
self.piggybank_summary_audit_percentage = QtGui.QSpinBox()
self.piggybank_summary_audit_percentage.setToolTip("This shows the audit percentage for the selected editor(s).")
self.piggybank_summary_audit_percentage.setRange(0,100)
self.piggybank_summary_audit_percentage.setSuffix("%")
self.piggybank_summary_editors_label = QtGui.QLabel("Editor:")
self.piggybank_summary_editors_list = QtGui.QComboBox()
self.piggybank_summary_editors_list.setToolTip("Select an editor to display his or her constraints for the chosen time frame.")
self.piggybank_summary_editors_list.setToolTip("Select an editor to view his or her constraints.")
self.resetEditorConstraints()
editors_list = self.editor_audit_constraints.keys()
editors_list.sort()
self.piggybank_summary_editors_list.addItems(editors_list)
self.piggybank_summary_editors_equality_checkbox = QtGui.QCheckBox("Use Equal Targets For All Editors")
self.piggybank_summary_editors_equality_checkbox.setToolTip("When checked, this nullifies all the personal constraints for editors and treats them equally.\nThis is enabled by default when you purposely remove writer names' from the columns filter.\nUse this when calibrating.")
self.piggybank_summary_editors_equality_checkbox.setCheckState(False)
self.piggybank_summary_editor_utilization_label = QtGui.QLabel("Editor Utilization:")
self.piggybank_summary_editor_utilization = QtGui.QDoubleSpinBox()
self.piggybank_summary_editor_utilization.setToolTip("Set a utilization factor here.\n1.0 indicates 100%% for a duration of 1 day. If there are multiple working dates selected, then the utilization changes accordingly.\nNote: This doesn't accomodate for leaves taken by editors as of this version.")
self.piggybank_summary_editor_utilization.setRange(0,3000.0)
self.piggybank_summary_editor_utilization.setSingleStep(0.05)
self.piggybank_summary_editor_minimum_wc_label = QtGui.QLabel("Minimum Word Count:")
self.piggybank_summary_editor_minimum_wc = QtGui.QSpinBox()
self.piggybank_summary_editor_minimum_wc.setRange(0,5000)
self.piggybank_summary_editor_minimum_wc.setSingleStep(100)
self.piggybank_summary_editor_minimum_wc.setToolTip("Set the selected editors(s) minimum word count for a single day.\nNote: this will reinforce a rule that makes the maximum word count at least 1000 words more than itself.")
self.piggybank_summary_editor_maximum_wc_label = QtGui.QLabel("Maximum Word Count:")
self.piggybank_summary_editor_maximum_wc = QtGui.QSpinBox()
self.piggybank_summary_editor_maximum_wc.setRange(0,5000)
self.piggybank_summary_editor_maximum_wc.setSingleStep(100)
self.piggybank_summary_editor_maximum_wc.setToolTip("Set the selected editors(s) maximum word count for a single day.\nNote: When changed, it will change the minimum word count so as to satisfy a range of at least 1000 words.")
self.piggybank_summary_editor_total_wc_label = QtGui.QLabel("Total Word Count (Auto):")
self.piggybank_summary_editor_total_wc = QtGui.QSpinBox()
self.piggybank_summary_editor_total_wc.setValue(0)
self.piggybank_summary_editor_total_wc.setRange(0,3000000)
self.piggybank_summary_editor_total_wc.setEnabled(False)
self.piggybank_summary_editor_total_wc.setToolTip("This is an auto-generated field which shows the optimum word count calculated by the system.")
self.piggybank_summary_reset_stats = QtGui.QPushButton("Reset Editor Stats")
self.piggybank_summary_tables = QtGui.QTabWidget()
tab_style = """
#.........这里部分代码省略.........