prompt
large_stringlengths
72
9.34k
completion
large_stringlengths
0
7.61k
<|file_name|>bootloader_advanced_gui.py<|end_file_name|><|fim▁begin|># # bootloader_advanced.py: gui advanced bootloader configuration dialog # # Jeremy Katz <[email protected]> # # Copyright 2001-2002 Red Hat, Inc. # # This software may be freely redistributed under the terms of the GNU # library public license. # # You should have received a copy of the GNU Library Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # import gtk import gobject import iutil import partedUtils import gui from iw_gui import * from rhpl.translate import _, N_ from bootlocwidget import BootloaderLocationWidget class AdvancedBootloaderWindow(InstallWindow): windowTitle = N_("Advanced Boot Loader Configuration") def __init__(self, ics): InstallWindow.__init__(self, ics) self.parent = ics.getICW().window def getPrev(self): pass def getNext(self): # forcing lba32 can be a bad idea.. make sure they really want to <|fim_middle|> # set up the vbox with force lba32 and kernel append def setupOptionsVbox(self): self.options_vbox = gtk.VBox(False, 5) self.options_vbox.set_border_width(5) self.forceLBA = gtk.CheckButton(_("_Force LBA32 (not normally required)")) self.options_vbox.pack_start(self.forceLBA, False) self.forceLBA.set_active(self.bl.forceLBA32) label = gui.WrappingLabel(_("If you wish to add default options to the " "boot command, enter them into " "the 'General kernel parameters' field.")) label.set_alignment(0.0, 0.0) self.options_vbox.pack_start(label, False) label = gui.MnemonicLabel(_("_General kernel parameters")) self.appendEntry = gtk.Entry() label.set_mnemonic_widget(self.appendEntry) args = self.bl.args.get() if args: self.appendEntry.set_text(args) box = gtk.HBox(False, 0) box.pack_start(label) box.pack_start(self.appendEntry) al = gtk.Alignment(0.0, 0.0) al.add(box) self.options_vbox.pack_start(al, False) def getScreen(self, anaconda): self.dispatch = anaconda.dispatch self.bl = anaconda.id.bootloader self.intf = anaconda.intf thebox = gtk.VBox (False, 10) # boot loader location bits (mbr vs boot, drive order) self.blloc = BootloaderLocationWidget(anaconda, self.parent) thebox.pack_start(self.blloc.getWidget(), False) thebox.pack_start (gtk.HSeparator(), False) # some optional things self.setupOptionsVbox() thebox.pack_start(self.options_vbox, False) return thebox <|fim▁end|>
if (self.forceLBA.get_active() and not self.bl.forceLBA32): rc = self.intf.messageWindow(_("Warning"), _("Forcing the use of LBA32 for your bootloader when " "not supported by the BIOS can cause your machine " "to be unable to boot.\n\n" "Would you like to continue and force LBA32 mode?"), type = "custom", custom_buttons = [_("Cancel"), _("Force LBA32")]) if rc != 1: raise gui.StayOnScreen # set forcelba self.bl.setForceLBA(self.forceLBA.get_active()) # set kernel args self.bl.args.set(self.appendEntry.get_text()) # set the boot device self.bl.setDevice(self.blloc.getBootDevice()) # set the drive order self.bl.drivelist = self.blloc.getDriveOrder()
<|file_name|>bootloader_advanced_gui.py<|end_file_name|><|fim▁begin|># # bootloader_advanced.py: gui advanced bootloader configuration dialog # # Jeremy Katz <[email protected]> # # Copyright 2001-2002 Red Hat, Inc. # # This software may be freely redistributed under the terms of the GNU # library public license. # # You should have received a copy of the GNU Library Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # import gtk import gobject import iutil import partedUtils import gui from iw_gui import * from rhpl.translate import _, N_ from bootlocwidget import BootloaderLocationWidget class AdvancedBootloaderWindow(InstallWindow): windowTitle = N_("Advanced Boot Loader Configuration") def __init__(self, ics): InstallWindow.__init__(self, ics) self.parent = ics.getICW().window def getPrev(self): pass def getNext(self): # forcing lba32 can be a bad idea.. make sure they really want to if (self.forceLBA.get_active() and not self.bl.forceLBA32): rc = self.intf.messageWindow(_("Warning"), _("Forcing the use of LBA32 for your bootloader when " "not supported by the BIOS can cause your machine " "to be unable to boot.\n\n" "Would you like to continue and force LBA32 mode?"), type = "custom", custom_buttons = [_("Cancel"), _("Force LBA32")]) if rc != 1: raise gui.StayOnScreen # set forcelba self.bl.setForceLBA(self.forceLBA.get_active()) # set kernel args self.bl.args.set(self.appendEntry.get_text()) # set the boot device self.bl.setDevice(self.blloc.getBootDevice()) # set the drive order self.bl.drivelist = self.blloc.getDriveOrder() # set up the vbox with force lba32 and kernel append def setupOptionsVbox(self): <|fim_middle|> def getScreen(self, anaconda): self.dispatch = anaconda.dispatch self.bl = anaconda.id.bootloader self.intf = anaconda.intf thebox = gtk.VBox (False, 10) # boot loader location bits (mbr vs boot, drive order) self.blloc = BootloaderLocationWidget(anaconda, self.parent) thebox.pack_start(self.blloc.getWidget(), False) thebox.pack_start (gtk.HSeparator(), False) # some optional things self.setupOptionsVbox() thebox.pack_start(self.options_vbox, False) return thebox <|fim▁end|>
self.options_vbox = gtk.VBox(False, 5) self.options_vbox.set_border_width(5) self.forceLBA = gtk.CheckButton(_("_Force LBA32 (not normally required)")) self.options_vbox.pack_start(self.forceLBA, False) self.forceLBA.set_active(self.bl.forceLBA32) label = gui.WrappingLabel(_("If you wish to add default options to the " "boot command, enter them into " "the 'General kernel parameters' field.")) label.set_alignment(0.0, 0.0) self.options_vbox.pack_start(label, False) label = gui.MnemonicLabel(_("_General kernel parameters")) self.appendEntry = gtk.Entry() label.set_mnemonic_widget(self.appendEntry) args = self.bl.args.get() if args: self.appendEntry.set_text(args) box = gtk.HBox(False, 0) box.pack_start(label) box.pack_start(self.appendEntry) al = gtk.Alignment(0.0, 0.0) al.add(box) self.options_vbox.pack_start(al, False)
<|file_name|>bootloader_advanced_gui.py<|end_file_name|><|fim▁begin|># # bootloader_advanced.py: gui advanced bootloader configuration dialog # # Jeremy Katz <[email protected]> # # Copyright 2001-2002 Red Hat, Inc. # # This software may be freely redistributed under the terms of the GNU # library public license. # # You should have received a copy of the GNU Library Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # import gtk import gobject import iutil import partedUtils import gui from iw_gui import * from rhpl.translate import _, N_ from bootlocwidget import BootloaderLocationWidget class AdvancedBootloaderWindow(InstallWindow): windowTitle = N_("Advanced Boot Loader Configuration") def __init__(self, ics): InstallWindow.__init__(self, ics) self.parent = ics.getICW().window def getPrev(self): pass def getNext(self): # forcing lba32 can be a bad idea.. make sure they really want to if (self.forceLBA.get_active() and not self.bl.forceLBA32): rc = self.intf.messageWindow(_("Warning"), _("Forcing the use of LBA32 for your bootloader when " "not supported by the BIOS can cause your machine " "to be unable to boot.\n\n" "Would you like to continue and force LBA32 mode?"), type = "custom", custom_buttons = [_("Cancel"), _("Force LBA32")]) if rc != 1: raise gui.StayOnScreen # set forcelba self.bl.setForceLBA(self.forceLBA.get_active()) # set kernel args self.bl.args.set(self.appendEntry.get_text()) # set the boot device self.bl.setDevice(self.blloc.getBootDevice()) # set the drive order self.bl.drivelist = self.blloc.getDriveOrder() # set up the vbox with force lba32 and kernel append def setupOptionsVbox(self): self.options_vbox = gtk.VBox(False, 5) self.options_vbox.set_border_width(5) self.forceLBA = gtk.CheckButton(_("_Force LBA32 (not normally required)")) self.options_vbox.pack_start(self.forceLBA, False) self.forceLBA.set_active(self.bl.forceLBA32) label = gui.WrappingLabel(_("If you wish to add default options to the " "boot command, enter them into " "the 'General kernel parameters' field.")) label.set_alignment(0.0, 0.0) self.options_vbox.pack_start(label, False) label = gui.MnemonicLabel(_("_General kernel parameters")) self.appendEntry = gtk.Entry() label.set_mnemonic_widget(self.appendEntry) args = self.bl.args.get() if args: self.appendEntry.set_text(args) box = gtk.HBox(False, 0) box.pack_start(label) box.pack_start(self.appendEntry) al = gtk.Alignment(0.0, 0.0) al.add(box) self.options_vbox.pack_start(al, False) def getScreen(self, anaconda): <|fim_middle|> <|fim▁end|>
self.dispatch = anaconda.dispatch self.bl = anaconda.id.bootloader self.intf = anaconda.intf thebox = gtk.VBox (False, 10) # boot loader location bits (mbr vs boot, drive order) self.blloc = BootloaderLocationWidget(anaconda, self.parent) thebox.pack_start(self.blloc.getWidget(), False) thebox.pack_start (gtk.HSeparator(), False) # some optional things self.setupOptionsVbox() thebox.pack_start(self.options_vbox, False) return thebox
<|file_name|>bootloader_advanced_gui.py<|end_file_name|><|fim▁begin|># # bootloader_advanced.py: gui advanced bootloader configuration dialog # # Jeremy Katz <[email protected]> # # Copyright 2001-2002 Red Hat, Inc. # # This software may be freely redistributed under the terms of the GNU # library public license. # # You should have received a copy of the GNU Library Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # import gtk import gobject import iutil import partedUtils import gui from iw_gui import * from rhpl.translate import _, N_ from bootlocwidget import BootloaderLocationWidget class AdvancedBootloaderWindow(InstallWindow): windowTitle = N_("Advanced Boot Loader Configuration") def __init__(self, ics): InstallWindow.__init__(self, ics) self.parent = ics.getICW().window def getPrev(self): pass def getNext(self): # forcing lba32 can be a bad idea.. make sure they really want to if (self.forceLBA.get_active() and not self.bl.forceLBA32): <|fim_middle|> # set forcelba self.bl.setForceLBA(self.forceLBA.get_active()) # set kernel args self.bl.args.set(self.appendEntry.get_text()) # set the boot device self.bl.setDevice(self.blloc.getBootDevice()) # set the drive order self.bl.drivelist = self.blloc.getDriveOrder() # set up the vbox with force lba32 and kernel append def setupOptionsVbox(self): self.options_vbox = gtk.VBox(False, 5) self.options_vbox.set_border_width(5) self.forceLBA = gtk.CheckButton(_("_Force LBA32 (not normally required)")) self.options_vbox.pack_start(self.forceLBA, False) self.forceLBA.set_active(self.bl.forceLBA32) label = gui.WrappingLabel(_("If you wish to add default options to the " "boot command, enter them into " "the 'General kernel parameters' field.")) label.set_alignment(0.0, 0.0) self.options_vbox.pack_start(label, False) label = gui.MnemonicLabel(_("_General kernel parameters")) self.appendEntry = gtk.Entry() label.set_mnemonic_widget(self.appendEntry) args = self.bl.args.get() if args: self.appendEntry.set_text(args) box = gtk.HBox(False, 0) box.pack_start(label) box.pack_start(self.appendEntry) al = gtk.Alignment(0.0, 0.0) al.add(box) self.options_vbox.pack_start(al, False) def getScreen(self, anaconda): self.dispatch = anaconda.dispatch self.bl = anaconda.id.bootloader self.intf = anaconda.intf thebox = gtk.VBox (False, 10) # boot loader location bits (mbr vs boot, drive order) self.blloc = BootloaderLocationWidget(anaconda, self.parent) thebox.pack_start(self.blloc.getWidget(), False) thebox.pack_start (gtk.HSeparator(), False) # some optional things self.setupOptionsVbox() thebox.pack_start(self.options_vbox, False) return thebox <|fim▁end|>
rc = self.intf.messageWindow(_("Warning"), _("Forcing the use of LBA32 for your bootloader when " "not supported by the BIOS can cause your machine " "to be unable to boot.\n\n" "Would you like to continue and force LBA32 mode?"), type = "custom", custom_buttons = [_("Cancel"), _("Force LBA32")]) if rc != 1: raise gui.StayOnScreen
<|file_name|>bootloader_advanced_gui.py<|end_file_name|><|fim▁begin|># # bootloader_advanced.py: gui advanced bootloader configuration dialog # # Jeremy Katz <[email protected]> # # Copyright 2001-2002 Red Hat, Inc. # # This software may be freely redistributed under the terms of the GNU # library public license. # # You should have received a copy of the GNU Library Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # import gtk import gobject import iutil import partedUtils import gui from iw_gui import * from rhpl.translate import _, N_ from bootlocwidget import BootloaderLocationWidget class AdvancedBootloaderWindow(InstallWindow): windowTitle = N_("Advanced Boot Loader Configuration") def __init__(self, ics): InstallWindow.__init__(self, ics) self.parent = ics.getICW().window def getPrev(self): pass def getNext(self): # forcing lba32 can be a bad idea.. make sure they really want to if (self.forceLBA.get_active() and not self.bl.forceLBA32): rc = self.intf.messageWindow(_("Warning"), _("Forcing the use of LBA32 for your bootloader when " "not supported by the BIOS can cause your machine " "to be unable to boot.\n\n" "Would you like to continue and force LBA32 mode?"), type = "custom", custom_buttons = [_("Cancel"), _("Force LBA32")]) if rc != 1: <|fim_middle|> # set forcelba self.bl.setForceLBA(self.forceLBA.get_active()) # set kernel args self.bl.args.set(self.appendEntry.get_text()) # set the boot device self.bl.setDevice(self.blloc.getBootDevice()) # set the drive order self.bl.drivelist = self.blloc.getDriveOrder() # set up the vbox with force lba32 and kernel append def setupOptionsVbox(self): self.options_vbox = gtk.VBox(False, 5) self.options_vbox.set_border_width(5) self.forceLBA = gtk.CheckButton(_("_Force LBA32 (not normally required)")) self.options_vbox.pack_start(self.forceLBA, False) self.forceLBA.set_active(self.bl.forceLBA32) label = gui.WrappingLabel(_("If you wish to add default options to the " "boot command, enter them into " "the 'General kernel parameters' field.")) label.set_alignment(0.0, 0.0) self.options_vbox.pack_start(label, False) label = gui.MnemonicLabel(_("_General kernel parameters")) self.appendEntry = gtk.Entry() label.set_mnemonic_widget(self.appendEntry) args = self.bl.args.get() if args: self.appendEntry.set_text(args) box = gtk.HBox(False, 0) box.pack_start(label) box.pack_start(self.appendEntry) al = gtk.Alignment(0.0, 0.0) al.add(box) self.options_vbox.pack_start(al, False) def getScreen(self, anaconda): self.dispatch = anaconda.dispatch self.bl = anaconda.id.bootloader self.intf = anaconda.intf thebox = gtk.VBox (False, 10) # boot loader location bits (mbr vs boot, drive order) self.blloc = BootloaderLocationWidget(anaconda, self.parent) thebox.pack_start(self.blloc.getWidget(), False) thebox.pack_start (gtk.HSeparator(), False) # some optional things self.setupOptionsVbox() thebox.pack_start(self.options_vbox, False) return thebox <|fim▁end|>
raise gui.StayOnScreen
<|file_name|>bootloader_advanced_gui.py<|end_file_name|><|fim▁begin|># # bootloader_advanced.py: gui advanced bootloader configuration dialog # # Jeremy Katz <[email protected]> # # Copyright 2001-2002 Red Hat, Inc. # # This software may be freely redistributed under the terms of the GNU # library public license. # # You should have received a copy of the GNU Library Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # import gtk import gobject import iutil import partedUtils import gui from iw_gui import * from rhpl.translate import _, N_ from bootlocwidget import BootloaderLocationWidget class AdvancedBootloaderWindow(InstallWindow): windowTitle = N_("Advanced Boot Loader Configuration") def __init__(self, ics): InstallWindow.__init__(self, ics) self.parent = ics.getICW().window def getPrev(self): pass def getNext(self): # forcing lba32 can be a bad idea.. make sure they really want to if (self.forceLBA.get_active() and not self.bl.forceLBA32): rc = self.intf.messageWindow(_("Warning"), _("Forcing the use of LBA32 for your bootloader when " "not supported by the BIOS can cause your machine " "to be unable to boot.\n\n" "Would you like to continue and force LBA32 mode?"), type = "custom", custom_buttons = [_("Cancel"), _("Force LBA32")]) if rc != 1: raise gui.StayOnScreen # set forcelba self.bl.setForceLBA(self.forceLBA.get_active()) # set kernel args self.bl.args.set(self.appendEntry.get_text()) # set the boot device self.bl.setDevice(self.blloc.getBootDevice()) # set the drive order self.bl.drivelist = self.blloc.getDriveOrder() # set up the vbox with force lba32 and kernel append def setupOptionsVbox(self): self.options_vbox = gtk.VBox(False, 5) self.options_vbox.set_border_width(5) self.forceLBA = gtk.CheckButton(_("_Force LBA32 (not normally required)")) self.options_vbox.pack_start(self.forceLBA, False) self.forceLBA.set_active(self.bl.forceLBA32) label = gui.WrappingLabel(_("If you wish to add default options to the " "boot command, enter them into " "the 'General kernel parameters' field.")) label.set_alignment(0.0, 0.0) self.options_vbox.pack_start(label, False) label = gui.MnemonicLabel(_("_General kernel parameters")) self.appendEntry = gtk.Entry() label.set_mnemonic_widget(self.appendEntry) args = self.bl.args.get() if args: <|fim_middle|> box = gtk.HBox(False, 0) box.pack_start(label) box.pack_start(self.appendEntry) al = gtk.Alignment(0.0, 0.0) al.add(box) self.options_vbox.pack_start(al, False) def getScreen(self, anaconda): self.dispatch = anaconda.dispatch self.bl = anaconda.id.bootloader self.intf = anaconda.intf thebox = gtk.VBox (False, 10) # boot loader location bits (mbr vs boot, drive order) self.blloc = BootloaderLocationWidget(anaconda, self.parent) thebox.pack_start(self.blloc.getWidget(), False) thebox.pack_start (gtk.HSeparator(), False) # some optional things self.setupOptionsVbox() thebox.pack_start(self.options_vbox, False) return thebox <|fim▁end|>
self.appendEntry.set_text(args)
<|file_name|>bootloader_advanced_gui.py<|end_file_name|><|fim▁begin|># # bootloader_advanced.py: gui advanced bootloader configuration dialog # # Jeremy Katz <[email protected]> # # Copyright 2001-2002 Red Hat, Inc. # # This software may be freely redistributed under the terms of the GNU # library public license. # # You should have received a copy of the GNU Library Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # import gtk import gobject import iutil import partedUtils import gui from iw_gui import * from rhpl.translate import _, N_ from bootlocwidget import BootloaderLocationWidget class AdvancedBootloaderWindow(InstallWindow): windowTitle = N_("Advanced Boot Loader Configuration") def <|fim_middle|>(self, ics): InstallWindow.__init__(self, ics) self.parent = ics.getICW().window def getPrev(self): pass def getNext(self): # forcing lba32 can be a bad idea.. make sure they really want to if (self.forceLBA.get_active() and not self.bl.forceLBA32): rc = self.intf.messageWindow(_("Warning"), _("Forcing the use of LBA32 for your bootloader when " "not supported by the BIOS can cause your machine " "to be unable to boot.\n\n" "Would you like to continue and force LBA32 mode?"), type = "custom", custom_buttons = [_("Cancel"), _("Force LBA32")]) if rc != 1: raise gui.StayOnScreen # set forcelba self.bl.setForceLBA(self.forceLBA.get_active()) # set kernel args self.bl.args.set(self.appendEntry.get_text()) # set the boot device self.bl.setDevice(self.blloc.getBootDevice()) # set the drive order self.bl.drivelist = self.blloc.getDriveOrder() # set up the vbox with force lba32 and kernel append def setupOptionsVbox(self): self.options_vbox = gtk.VBox(False, 5) self.options_vbox.set_border_width(5) self.forceLBA = gtk.CheckButton(_("_Force LBA32 (not normally required)")) self.options_vbox.pack_start(self.forceLBA, False) self.forceLBA.set_active(self.bl.forceLBA32) label = gui.WrappingLabel(_("If you wish to add default options to the " "boot command, enter them into " "the 'General kernel parameters' field.")) label.set_alignment(0.0, 0.0) self.options_vbox.pack_start(label, False) label = gui.MnemonicLabel(_("_General kernel parameters")) self.appendEntry = gtk.Entry() label.set_mnemonic_widget(self.appendEntry) args = self.bl.args.get() if args: self.appendEntry.set_text(args) box = gtk.HBox(False, 0) box.pack_start(label) box.pack_start(self.appendEntry) al = gtk.Alignment(0.0, 0.0) al.add(box) self.options_vbox.pack_start(al, False) def getScreen(self, anaconda): self.dispatch = anaconda.dispatch self.bl = anaconda.id.bootloader self.intf = anaconda.intf thebox = gtk.VBox (False, 10) # boot loader location bits (mbr vs boot, drive order) self.blloc = BootloaderLocationWidget(anaconda, self.parent) thebox.pack_start(self.blloc.getWidget(), False) thebox.pack_start (gtk.HSeparator(), False) # some optional things self.setupOptionsVbox() thebox.pack_start(self.options_vbox, False) return thebox <|fim▁end|>
__init__
<|file_name|>bootloader_advanced_gui.py<|end_file_name|><|fim▁begin|># # bootloader_advanced.py: gui advanced bootloader configuration dialog # # Jeremy Katz <[email protected]> # # Copyright 2001-2002 Red Hat, Inc. # # This software may be freely redistributed under the terms of the GNU # library public license. # # You should have received a copy of the GNU Library Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # import gtk import gobject import iutil import partedUtils import gui from iw_gui import * from rhpl.translate import _, N_ from bootlocwidget import BootloaderLocationWidget class AdvancedBootloaderWindow(InstallWindow): windowTitle = N_("Advanced Boot Loader Configuration") def __init__(self, ics): InstallWindow.__init__(self, ics) self.parent = ics.getICW().window def <|fim_middle|>(self): pass def getNext(self): # forcing lba32 can be a bad idea.. make sure they really want to if (self.forceLBA.get_active() and not self.bl.forceLBA32): rc = self.intf.messageWindow(_("Warning"), _("Forcing the use of LBA32 for your bootloader when " "not supported by the BIOS can cause your machine " "to be unable to boot.\n\n" "Would you like to continue and force LBA32 mode?"), type = "custom", custom_buttons = [_("Cancel"), _("Force LBA32")]) if rc != 1: raise gui.StayOnScreen # set forcelba self.bl.setForceLBA(self.forceLBA.get_active()) # set kernel args self.bl.args.set(self.appendEntry.get_text()) # set the boot device self.bl.setDevice(self.blloc.getBootDevice()) # set the drive order self.bl.drivelist = self.blloc.getDriveOrder() # set up the vbox with force lba32 and kernel append def setupOptionsVbox(self): self.options_vbox = gtk.VBox(False, 5) self.options_vbox.set_border_width(5) self.forceLBA = gtk.CheckButton(_("_Force LBA32 (not normally required)")) self.options_vbox.pack_start(self.forceLBA, False) self.forceLBA.set_active(self.bl.forceLBA32) label = gui.WrappingLabel(_("If you wish to add default options to the " "boot command, enter them into " "the 'General kernel parameters' field.")) label.set_alignment(0.0, 0.0) self.options_vbox.pack_start(label, False) label = gui.MnemonicLabel(_("_General kernel parameters")) self.appendEntry = gtk.Entry() label.set_mnemonic_widget(self.appendEntry) args = self.bl.args.get() if args: self.appendEntry.set_text(args) box = gtk.HBox(False, 0) box.pack_start(label) box.pack_start(self.appendEntry) al = gtk.Alignment(0.0, 0.0) al.add(box) self.options_vbox.pack_start(al, False) def getScreen(self, anaconda): self.dispatch = anaconda.dispatch self.bl = anaconda.id.bootloader self.intf = anaconda.intf thebox = gtk.VBox (False, 10) # boot loader location bits (mbr vs boot, drive order) self.blloc = BootloaderLocationWidget(anaconda, self.parent) thebox.pack_start(self.blloc.getWidget(), False) thebox.pack_start (gtk.HSeparator(), False) # some optional things self.setupOptionsVbox() thebox.pack_start(self.options_vbox, False) return thebox <|fim▁end|>
getPrev
<|file_name|>bootloader_advanced_gui.py<|end_file_name|><|fim▁begin|># # bootloader_advanced.py: gui advanced bootloader configuration dialog # # Jeremy Katz <[email protected]> # # Copyright 2001-2002 Red Hat, Inc. # # This software may be freely redistributed under the terms of the GNU # library public license. # # You should have received a copy of the GNU Library Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # import gtk import gobject import iutil import partedUtils import gui from iw_gui import * from rhpl.translate import _, N_ from bootlocwidget import BootloaderLocationWidget class AdvancedBootloaderWindow(InstallWindow): windowTitle = N_("Advanced Boot Loader Configuration") def __init__(self, ics): InstallWindow.__init__(self, ics) self.parent = ics.getICW().window def getPrev(self): pass def <|fim_middle|>(self): # forcing lba32 can be a bad idea.. make sure they really want to if (self.forceLBA.get_active() and not self.bl.forceLBA32): rc = self.intf.messageWindow(_("Warning"), _("Forcing the use of LBA32 for your bootloader when " "not supported by the BIOS can cause your machine " "to be unable to boot.\n\n" "Would you like to continue and force LBA32 mode?"), type = "custom", custom_buttons = [_("Cancel"), _("Force LBA32")]) if rc != 1: raise gui.StayOnScreen # set forcelba self.bl.setForceLBA(self.forceLBA.get_active()) # set kernel args self.bl.args.set(self.appendEntry.get_text()) # set the boot device self.bl.setDevice(self.blloc.getBootDevice()) # set the drive order self.bl.drivelist = self.blloc.getDriveOrder() # set up the vbox with force lba32 and kernel append def setupOptionsVbox(self): self.options_vbox = gtk.VBox(False, 5) self.options_vbox.set_border_width(5) self.forceLBA = gtk.CheckButton(_("_Force LBA32 (not normally required)")) self.options_vbox.pack_start(self.forceLBA, False) self.forceLBA.set_active(self.bl.forceLBA32) label = gui.WrappingLabel(_("If you wish to add default options to the " "boot command, enter them into " "the 'General kernel parameters' field.")) label.set_alignment(0.0, 0.0) self.options_vbox.pack_start(label, False) label = gui.MnemonicLabel(_("_General kernel parameters")) self.appendEntry = gtk.Entry() label.set_mnemonic_widget(self.appendEntry) args = self.bl.args.get() if args: self.appendEntry.set_text(args) box = gtk.HBox(False, 0) box.pack_start(label) box.pack_start(self.appendEntry) al = gtk.Alignment(0.0, 0.0) al.add(box) self.options_vbox.pack_start(al, False) def getScreen(self, anaconda): self.dispatch = anaconda.dispatch self.bl = anaconda.id.bootloader self.intf = anaconda.intf thebox = gtk.VBox (False, 10) # boot loader location bits (mbr vs boot, drive order) self.blloc = BootloaderLocationWidget(anaconda, self.parent) thebox.pack_start(self.blloc.getWidget(), False) thebox.pack_start (gtk.HSeparator(), False) # some optional things self.setupOptionsVbox() thebox.pack_start(self.options_vbox, False) return thebox <|fim▁end|>
getNext
<|file_name|>bootloader_advanced_gui.py<|end_file_name|><|fim▁begin|># # bootloader_advanced.py: gui advanced bootloader configuration dialog # # Jeremy Katz <[email protected]> # # Copyright 2001-2002 Red Hat, Inc. # # This software may be freely redistributed under the terms of the GNU # library public license. # # You should have received a copy of the GNU Library Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # import gtk import gobject import iutil import partedUtils import gui from iw_gui import * from rhpl.translate import _, N_ from bootlocwidget import BootloaderLocationWidget class AdvancedBootloaderWindow(InstallWindow): windowTitle = N_("Advanced Boot Loader Configuration") def __init__(self, ics): InstallWindow.__init__(self, ics) self.parent = ics.getICW().window def getPrev(self): pass def getNext(self): # forcing lba32 can be a bad idea.. make sure they really want to if (self.forceLBA.get_active() and not self.bl.forceLBA32): rc = self.intf.messageWindow(_("Warning"), _("Forcing the use of LBA32 for your bootloader when " "not supported by the BIOS can cause your machine " "to be unable to boot.\n\n" "Would you like to continue and force LBA32 mode?"), type = "custom", custom_buttons = [_("Cancel"), _("Force LBA32")]) if rc != 1: raise gui.StayOnScreen # set forcelba self.bl.setForceLBA(self.forceLBA.get_active()) # set kernel args self.bl.args.set(self.appendEntry.get_text()) # set the boot device self.bl.setDevice(self.blloc.getBootDevice()) # set the drive order self.bl.drivelist = self.blloc.getDriveOrder() # set up the vbox with force lba32 and kernel append def <|fim_middle|>(self): self.options_vbox = gtk.VBox(False, 5) self.options_vbox.set_border_width(5) self.forceLBA = gtk.CheckButton(_("_Force LBA32 (not normally required)")) self.options_vbox.pack_start(self.forceLBA, False) self.forceLBA.set_active(self.bl.forceLBA32) label = gui.WrappingLabel(_("If you wish to add default options to the " "boot command, enter them into " "the 'General kernel parameters' field.")) label.set_alignment(0.0, 0.0) self.options_vbox.pack_start(label, False) label = gui.MnemonicLabel(_("_General kernel parameters")) self.appendEntry = gtk.Entry() label.set_mnemonic_widget(self.appendEntry) args = self.bl.args.get() if args: self.appendEntry.set_text(args) box = gtk.HBox(False, 0) box.pack_start(label) box.pack_start(self.appendEntry) al = gtk.Alignment(0.0, 0.0) al.add(box) self.options_vbox.pack_start(al, False) def getScreen(self, anaconda): self.dispatch = anaconda.dispatch self.bl = anaconda.id.bootloader self.intf = anaconda.intf thebox = gtk.VBox (False, 10) # boot loader location bits (mbr vs boot, drive order) self.blloc = BootloaderLocationWidget(anaconda, self.parent) thebox.pack_start(self.blloc.getWidget(), False) thebox.pack_start (gtk.HSeparator(), False) # some optional things self.setupOptionsVbox() thebox.pack_start(self.options_vbox, False) return thebox <|fim▁end|>
setupOptionsVbox
<|file_name|>bootloader_advanced_gui.py<|end_file_name|><|fim▁begin|># # bootloader_advanced.py: gui advanced bootloader configuration dialog # # Jeremy Katz <[email protected]> # # Copyright 2001-2002 Red Hat, Inc. # # This software may be freely redistributed under the terms of the GNU # library public license. # # You should have received a copy of the GNU Library Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # import gtk import gobject import iutil import partedUtils import gui from iw_gui import * from rhpl.translate import _, N_ from bootlocwidget import BootloaderLocationWidget class AdvancedBootloaderWindow(InstallWindow): windowTitle = N_("Advanced Boot Loader Configuration") def __init__(self, ics): InstallWindow.__init__(self, ics) self.parent = ics.getICW().window def getPrev(self): pass def getNext(self): # forcing lba32 can be a bad idea.. make sure they really want to if (self.forceLBA.get_active() and not self.bl.forceLBA32): rc = self.intf.messageWindow(_("Warning"), _("Forcing the use of LBA32 for your bootloader when " "not supported by the BIOS can cause your machine " "to be unable to boot.\n\n" "Would you like to continue and force LBA32 mode?"), type = "custom", custom_buttons = [_("Cancel"), _("Force LBA32")]) if rc != 1: raise gui.StayOnScreen # set forcelba self.bl.setForceLBA(self.forceLBA.get_active()) # set kernel args self.bl.args.set(self.appendEntry.get_text()) # set the boot device self.bl.setDevice(self.blloc.getBootDevice()) # set the drive order self.bl.drivelist = self.blloc.getDriveOrder() # set up the vbox with force lba32 and kernel append def setupOptionsVbox(self): self.options_vbox = gtk.VBox(False, 5) self.options_vbox.set_border_width(5) self.forceLBA = gtk.CheckButton(_("_Force LBA32 (not normally required)")) self.options_vbox.pack_start(self.forceLBA, False) self.forceLBA.set_active(self.bl.forceLBA32) label = gui.WrappingLabel(_("If you wish to add default options to the " "boot command, enter them into " "the 'General kernel parameters' field.")) label.set_alignment(0.0, 0.0) self.options_vbox.pack_start(label, False) label = gui.MnemonicLabel(_("_General kernel parameters")) self.appendEntry = gtk.Entry() label.set_mnemonic_widget(self.appendEntry) args = self.bl.args.get() if args: self.appendEntry.set_text(args) box = gtk.HBox(False, 0) box.pack_start(label) box.pack_start(self.appendEntry) al = gtk.Alignment(0.0, 0.0) al.add(box) self.options_vbox.pack_start(al, False) def <|fim_middle|>(self, anaconda): self.dispatch = anaconda.dispatch self.bl = anaconda.id.bootloader self.intf = anaconda.intf thebox = gtk.VBox (False, 10) # boot loader location bits (mbr vs boot, drive order) self.blloc = BootloaderLocationWidget(anaconda, self.parent) thebox.pack_start(self.blloc.getWidget(), False) thebox.pack_start (gtk.HSeparator(), False) # some optional things self.setupOptionsVbox() thebox.pack_start(self.options_vbox, False) return thebox <|fim▁end|>
getScreen
<|file_name|>toolset_requirements.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python # Copyright 2014 Steven Watanabe # Distributed under the Boost Software License, Version 1.0. # (See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt) # Test the handling of toolset.add-requirements import BoostBuild t = BoostBuild.Tester(pass_toolset=0, ignore_toolset_requirements=False) t.write('jamroot.jam', ''' import toolset ; import errors ; rule test-rule ( properties * )<|fim▁hole|>toolset.add-requirements <define>TEST_MACRO <conditional>@test-rule <link>shared:<define>TEST_CONDITIONAL ; rule check-requirements ( target : sources * : properties * ) { local macros = TEST_MACRO TEST_CONDITIONAL TEST_INDIRECT_CONDITIONAL ; for local m in $(macros) { if ! <define>$(m) in $(properties) { errors.error $(m) not defined ; } } } make test : : @check-requirements ; ''') t.run_build_system() t.cleanup()<|fim▁end|>
{ return <define>TEST_INDIRECT_CONDITIONAL ; }
<|file_name|>glyph_test.py<|end_file_name|><|fim▁begin|>import numpy as np from math import sin, pi, cos from banti.glyph import Glyph halfsize = 40 size = 2*halfsize + 1 picture = np.zeros((size, size)) for t in range(-135, 135): x = round(halfsize + halfsize * cos(pi * t / 180)) y = round(halfsize + halfsize * sin(pi * t / 180)) picture[x][y] = 1 zoomsz = 1 * halfsize b = Glyph(['O', 0, 0, size, size, 0, 0, 0, 0, None]) b.set_pix(picture) c = Glyph() for t in range(0, 360, 15):<|fim▁hole|> b.set_xy_wh((x, y, size, size)) c = c + b print(b) print(c)<|fim▁end|>
x = round(zoomsz + zoomsz * cos(pi * t / 180)) y = round(zoomsz + zoomsz * sin(pi * t / 180))
<|file_name|>abook2pdf.py<|end_file_name|><|fim▁begin|>from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle, PageBreak from reportlab.lib.styles import getSampleStyleSheet from reportlab.rl_config import defaultPageSize from reportlab.lib.units import cm import operator import os import ConfigParser import string config = ConfigParser.ConfigParser() config.read(os.environ["HOME"] + "/.abook/addressbook") config.remove_section('format') PAGE_HEIGHT=defaultPageSize[1]; PAGE_WIDTH=defaultPageSize[0] styles = getSampleStyleSheet() buchstabe = "A" Title = "Hello world" pageinfo = "platypus example" def Pages(canvas, doc): canvas.saveState() canvas.restoreState() <|fim▁hole|> Story = [] style = styles["Normal"] addresses=[] for s in config.sections(): nb="" ub="" mb="" if config.has_option(s,'name'): nb = "<b>" + config.get(s,'name') + "</b><br/>" worte=config.get(s,'name').split() print len(worte) if len(worte)<2: nachname=worte[0] else: nachname=worte[1] anfangsbuchstabe=nachname[0:1] if anfangsbuchstabe!=buchstabe: buchstabe=anfangsbuchstabe print buchstabe p = Table(addresses) p.setStyle(TableStyle([('VALIGN',(0,0),(-1,-1),"TOP"), ('ALIGN',(0,-1),(0,-1),'RIGHT')])) Story.append(p) Story.append(PageBreak()) addresses=[] if config.has_option(s,'address'): nb = nb + config.get(s,'address') + "<br/>" if config.has_option(s,'zip'): nb = nb + config.get(s,'zip') + " " if config.has_option(s,'city'): nb = nb + config.get(s,'city') + "<br/>" if config.has_option(s,'state'): nb = nb + config.get(s,'state') + " - " if config.has_option(s,'country'): nb = nb + config.get(s,'country') + "<br/>" nb = nb +"<br/>" if config.has_option(s,'phone'): ub= "Fon: " + config.get(s,'phone') + "<br/>" if config.has_option(s,'mobile'): ub= ub + "Mobi: " + config.get(s,'mobile') + "<br/>" if config.has_option(s,'email'): ub= ub + config.get(s,'email').replace(',','<br/>') + "<br/>" ub=ub+"<br/>" if config.has_option(s,'custom3'): mb= config.get(s,'custom3') + "<br/>" mb=mb+"<br/>" nameblock = Paragraph(nb,style) numberblock = Paragraph(ub,style) middleblock = Paragraph(mb,style) addresses.append([nameblock,middleblock,numberblock]) p = Table(addresses) p.setStyle(TableStyle([('VALIGN',(0,0),(-1,-1),"TOP"), ('ALIGN',(0,-1),(0,-1),'RIGHT')])) Story.append(p) doc.build(Story, onFirstPage=Pages, onLaterPages=Pages) go(buchstabe)<|fim▁end|>
def go(buchstabe): doc = SimpleDocTemplate("phello.pdf")
<|file_name|>abook2pdf.py<|end_file_name|><|fim▁begin|>from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle, PageBreak from reportlab.lib.styles import getSampleStyleSheet from reportlab.rl_config import defaultPageSize from reportlab.lib.units import cm import operator import os import ConfigParser import string config = ConfigParser.ConfigParser() config.read(os.environ["HOME"] + "/.abook/addressbook") config.remove_section('format') PAGE_HEIGHT=defaultPageSize[1]; PAGE_WIDTH=defaultPageSize[0] styles = getSampleStyleSheet() buchstabe = "A" Title = "Hello world" pageinfo = "platypus example" def Pages(canvas, doc): <|fim_middle|> def go(buchstabe): doc = SimpleDocTemplate("phello.pdf") Story = [] style = styles["Normal"] addresses=[] for s in config.sections(): nb="" ub="" mb="" if config.has_option(s,'name'): nb = "<b>" + config.get(s,'name') + "</b><br/>" worte=config.get(s,'name').split() print len(worte) if len(worte)<2: nachname=worte[0] else: nachname=worte[1] anfangsbuchstabe=nachname[0:1] if anfangsbuchstabe!=buchstabe: buchstabe=anfangsbuchstabe print buchstabe p = Table(addresses) p.setStyle(TableStyle([('VALIGN',(0,0),(-1,-1),"TOP"), ('ALIGN',(0,-1),(0,-1),'RIGHT')])) Story.append(p) Story.append(PageBreak()) addresses=[] if config.has_option(s,'address'): nb = nb + config.get(s,'address') + "<br/>" if config.has_option(s,'zip'): nb = nb + config.get(s,'zip') + " " if config.has_option(s,'city'): nb = nb + config.get(s,'city') + "<br/>" if config.has_option(s,'state'): nb = nb + config.get(s,'state') + " - " if config.has_option(s,'country'): nb = nb + config.get(s,'country') + "<br/>" nb = nb +"<br/>" if config.has_option(s,'phone'): ub= "Fon: " + config.get(s,'phone') + "<br/>" if config.has_option(s,'mobile'): ub= ub + "Mobi: " + config.get(s,'mobile') + "<br/>" if config.has_option(s,'email'): ub= ub + config.get(s,'email').replace(',','<br/>') + "<br/>" ub=ub+"<br/>" if config.has_option(s,'custom3'): mb= config.get(s,'custom3') + "<br/>" mb=mb+"<br/>" nameblock = Paragraph(nb,style) numberblock = Paragraph(ub,style) middleblock = Paragraph(mb,style) addresses.append([nameblock,middleblock,numberblock]) p = Table(addresses) p.setStyle(TableStyle([('VALIGN',(0,0),(-1,-1),"TOP"), ('ALIGN',(0,-1),(0,-1),'RIGHT')])) Story.append(p) doc.build(Story, onFirstPage=Pages, onLaterPages=Pages) go(buchstabe) <|fim▁end|>
canvas.saveState() canvas.restoreState()
<|file_name|>abook2pdf.py<|end_file_name|><|fim▁begin|>from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle, PageBreak from reportlab.lib.styles import getSampleStyleSheet from reportlab.rl_config import defaultPageSize from reportlab.lib.units import cm import operator import os import ConfigParser import string config = ConfigParser.ConfigParser() config.read(os.environ["HOME"] + "/.abook/addressbook") config.remove_section('format') PAGE_HEIGHT=defaultPageSize[1]; PAGE_WIDTH=defaultPageSize[0] styles = getSampleStyleSheet() buchstabe = "A" Title = "Hello world" pageinfo = "platypus example" def Pages(canvas, doc): canvas.saveState() canvas.restoreState() def go(buchstabe): <|fim_middle|> go(buchstabe) <|fim▁end|>
doc = SimpleDocTemplate("phello.pdf") Story = [] style = styles["Normal"] addresses=[] for s in config.sections(): nb="" ub="" mb="" if config.has_option(s,'name'): nb = "<b>" + config.get(s,'name') + "</b><br/>" worte=config.get(s,'name').split() print len(worte) if len(worte)<2: nachname=worte[0] else: nachname=worte[1] anfangsbuchstabe=nachname[0:1] if anfangsbuchstabe!=buchstabe: buchstabe=anfangsbuchstabe print buchstabe p = Table(addresses) p.setStyle(TableStyle([('VALIGN',(0,0),(-1,-1),"TOP"), ('ALIGN',(0,-1),(0,-1),'RIGHT')])) Story.append(p) Story.append(PageBreak()) addresses=[] if config.has_option(s,'address'): nb = nb + config.get(s,'address') + "<br/>" if config.has_option(s,'zip'): nb = nb + config.get(s,'zip') + " " if config.has_option(s,'city'): nb = nb + config.get(s,'city') + "<br/>" if config.has_option(s,'state'): nb = nb + config.get(s,'state') + " - " if config.has_option(s,'country'): nb = nb + config.get(s,'country') + "<br/>" nb = nb +"<br/>" if config.has_option(s,'phone'): ub= "Fon: " + config.get(s,'phone') + "<br/>" if config.has_option(s,'mobile'): ub= ub + "Mobi: " + config.get(s,'mobile') + "<br/>" if config.has_option(s,'email'): ub= ub + config.get(s,'email').replace(',','<br/>') + "<br/>" ub=ub+"<br/>" if config.has_option(s,'custom3'): mb= config.get(s,'custom3') + "<br/>" mb=mb+"<br/>" nameblock = Paragraph(nb,style) numberblock = Paragraph(ub,style) middleblock = Paragraph(mb,style) addresses.append([nameblock,middleblock,numberblock]) p = Table(addresses) p.setStyle(TableStyle([('VALIGN',(0,0),(-1,-1),"TOP"), ('ALIGN',(0,-1),(0,-1),'RIGHT')])) Story.append(p) doc.build(Story, onFirstPage=Pages, onLaterPages=Pages)
<|file_name|>abook2pdf.py<|end_file_name|><|fim▁begin|>from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle, PageBreak from reportlab.lib.styles import getSampleStyleSheet from reportlab.rl_config import defaultPageSize from reportlab.lib.units import cm import operator import os import ConfigParser import string config = ConfigParser.ConfigParser() config.read(os.environ["HOME"] + "/.abook/addressbook") config.remove_section('format') PAGE_HEIGHT=defaultPageSize[1]; PAGE_WIDTH=defaultPageSize[0] styles = getSampleStyleSheet() buchstabe = "A" Title = "Hello world" pageinfo = "platypus example" def Pages(canvas, doc): canvas.saveState() canvas.restoreState() def go(buchstabe): doc = SimpleDocTemplate("phello.pdf") Story = [] style = styles["Normal"] addresses=[] for s in config.sections(): nb="" ub="" mb="" if config.has_option(s,'name'): <|fim_middle|> if config.has_option(s,'address'): nb = nb + config.get(s,'address') + "<br/>" if config.has_option(s,'zip'): nb = nb + config.get(s,'zip') + " " if config.has_option(s,'city'): nb = nb + config.get(s,'city') + "<br/>" if config.has_option(s,'state'): nb = nb + config.get(s,'state') + " - " if config.has_option(s,'country'): nb = nb + config.get(s,'country') + "<br/>" nb = nb +"<br/>" if config.has_option(s,'phone'): ub= "Fon: " + config.get(s,'phone') + "<br/>" if config.has_option(s,'mobile'): ub= ub + "Mobi: " + config.get(s,'mobile') + "<br/>" if config.has_option(s,'email'): ub= ub + config.get(s,'email').replace(',','<br/>') + "<br/>" ub=ub+"<br/>" if config.has_option(s,'custom3'): mb= config.get(s,'custom3') + "<br/>" mb=mb+"<br/>" nameblock = Paragraph(nb,style) numberblock = Paragraph(ub,style) middleblock = Paragraph(mb,style) addresses.append([nameblock,middleblock,numberblock]) p = Table(addresses) p.setStyle(TableStyle([('VALIGN',(0,0),(-1,-1),"TOP"), ('ALIGN',(0,-1),(0,-1),'RIGHT')])) Story.append(p) doc.build(Story, onFirstPage=Pages, onLaterPages=Pages) go(buchstabe) <|fim▁end|>
nb = "<b>" + config.get(s,'name') + "</b><br/>" worte=config.get(s,'name').split() print len(worte) if len(worte)<2: nachname=worte[0] else: nachname=worte[1] anfangsbuchstabe=nachname[0:1] if anfangsbuchstabe!=buchstabe: buchstabe=anfangsbuchstabe print buchstabe p = Table(addresses) p.setStyle(TableStyle([('VALIGN',(0,0),(-1,-1),"TOP"), ('ALIGN',(0,-1),(0,-1),'RIGHT')])) Story.append(p) Story.append(PageBreak()) addresses=[]
<|file_name|>abook2pdf.py<|end_file_name|><|fim▁begin|>from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle, PageBreak from reportlab.lib.styles import getSampleStyleSheet from reportlab.rl_config import defaultPageSize from reportlab.lib.units import cm import operator import os import ConfigParser import string config = ConfigParser.ConfigParser() config.read(os.environ["HOME"] + "/.abook/addressbook") config.remove_section('format') PAGE_HEIGHT=defaultPageSize[1]; PAGE_WIDTH=defaultPageSize[0] styles = getSampleStyleSheet() buchstabe = "A" Title = "Hello world" pageinfo = "platypus example" def Pages(canvas, doc): canvas.saveState() canvas.restoreState() def go(buchstabe): doc = SimpleDocTemplate("phello.pdf") Story = [] style = styles["Normal"] addresses=[] for s in config.sections(): nb="" ub="" mb="" if config.has_option(s,'name'): nb = "<b>" + config.get(s,'name') + "</b><br/>" worte=config.get(s,'name').split() print len(worte) if len(worte)<2: <|fim_middle|> else: nachname=worte[1] anfangsbuchstabe=nachname[0:1] if anfangsbuchstabe!=buchstabe: buchstabe=anfangsbuchstabe print buchstabe p = Table(addresses) p.setStyle(TableStyle([('VALIGN',(0,0),(-1,-1),"TOP"), ('ALIGN',(0,-1),(0,-1),'RIGHT')])) Story.append(p) Story.append(PageBreak()) addresses=[] if config.has_option(s,'address'): nb = nb + config.get(s,'address') + "<br/>" if config.has_option(s,'zip'): nb = nb + config.get(s,'zip') + " " if config.has_option(s,'city'): nb = nb + config.get(s,'city') + "<br/>" if config.has_option(s,'state'): nb = nb + config.get(s,'state') + " - " if config.has_option(s,'country'): nb = nb + config.get(s,'country') + "<br/>" nb = nb +"<br/>" if config.has_option(s,'phone'): ub= "Fon: " + config.get(s,'phone') + "<br/>" if config.has_option(s,'mobile'): ub= ub + "Mobi: " + config.get(s,'mobile') + "<br/>" if config.has_option(s,'email'): ub= ub + config.get(s,'email').replace(',','<br/>') + "<br/>" ub=ub+"<br/>" if config.has_option(s,'custom3'): mb= config.get(s,'custom3') + "<br/>" mb=mb+"<br/>" nameblock = Paragraph(nb,style) numberblock = Paragraph(ub,style) middleblock = Paragraph(mb,style) addresses.append([nameblock,middleblock,numberblock]) p = Table(addresses) p.setStyle(TableStyle([('VALIGN',(0,0),(-1,-1),"TOP"), ('ALIGN',(0,-1),(0,-1),'RIGHT')])) Story.append(p) doc.build(Story, onFirstPage=Pages, onLaterPages=Pages) go(buchstabe) <|fim▁end|>
nachname=worte[0]
<|file_name|>abook2pdf.py<|end_file_name|><|fim▁begin|>from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle, PageBreak from reportlab.lib.styles import getSampleStyleSheet from reportlab.rl_config import defaultPageSize from reportlab.lib.units import cm import operator import os import ConfigParser import string config = ConfigParser.ConfigParser() config.read(os.environ["HOME"] + "/.abook/addressbook") config.remove_section('format') PAGE_HEIGHT=defaultPageSize[1]; PAGE_WIDTH=defaultPageSize[0] styles = getSampleStyleSheet() buchstabe = "A" Title = "Hello world" pageinfo = "platypus example" def Pages(canvas, doc): canvas.saveState() canvas.restoreState() def go(buchstabe): doc = SimpleDocTemplate("phello.pdf") Story = [] style = styles["Normal"] addresses=[] for s in config.sections(): nb="" ub="" mb="" if config.has_option(s,'name'): nb = "<b>" + config.get(s,'name') + "</b><br/>" worte=config.get(s,'name').split() print len(worte) if len(worte)<2: nachname=worte[0] else: <|fim_middle|> anfangsbuchstabe=nachname[0:1] if anfangsbuchstabe!=buchstabe: buchstabe=anfangsbuchstabe print buchstabe p = Table(addresses) p.setStyle(TableStyle([('VALIGN',(0,0),(-1,-1),"TOP"), ('ALIGN',(0,-1),(0,-1),'RIGHT')])) Story.append(p) Story.append(PageBreak()) addresses=[] if config.has_option(s,'address'): nb = nb + config.get(s,'address') + "<br/>" if config.has_option(s,'zip'): nb = nb + config.get(s,'zip') + " " if config.has_option(s,'city'): nb = nb + config.get(s,'city') + "<br/>" if config.has_option(s,'state'): nb = nb + config.get(s,'state') + " - " if config.has_option(s,'country'): nb = nb + config.get(s,'country') + "<br/>" nb = nb +"<br/>" if config.has_option(s,'phone'): ub= "Fon: " + config.get(s,'phone') + "<br/>" if config.has_option(s,'mobile'): ub= ub + "Mobi: " + config.get(s,'mobile') + "<br/>" if config.has_option(s,'email'): ub= ub + config.get(s,'email').replace(',','<br/>') + "<br/>" ub=ub+"<br/>" if config.has_option(s,'custom3'): mb= config.get(s,'custom3') + "<br/>" mb=mb+"<br/>" nameblock = Paragraph(nb,style) numberblock = Paragraph(ub,style) middleblock = Paragraph(mb,style) addresses.append([nameblock,middleblock,numberblock]) p = Table(addresses) p.setStyle(TableStyle([('VALIGN',(0,0),(-1,-1),"TOP"), ('ALIGN',(0,-1),(0,-1),'RIGHT')])) Story.append(p) doc.build(Story, onFirstPage=Pages, onLaterPages=Pages) go(buchstabe) <|fim▁end|>
nachname=worte[1]
<|file_name|>abook2pdf.py<|end_file_name|><|fim▁begin|>from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle, PageBreak from reportlab.lib.styles import getSampleStyleSheet from reportlab.rl_config import defaultPageSize from reportlab.lib.units import cm import operator import os import ConfigParser import string config = ConfigParser.ConfigParser() config.read(os.environ["HOME"] + "/.abook/addressbook") config.remove_section('format') PAGE_HEIGHT=defaultPageSize[1]; PAGE_WIDTH=defaultPageSize[0] styles = getSampleStyleSheet() buchstabe = "A" Title = "Hello world" pageinfo = "platypus example" def Pages(canvas, doc): canvas.saveState() canvas.restoreState() def go(buchstabe): doc = SimpleDocTemplate("phello.pdf") Story = [] style = styles["Normal"] addresses=[] for s in config.sections(): nb="" ub="" mb="" if config.has_option(s,'name'): nb = "<b>" + config.get(s,'name') + "</b><br/>" worte=config.get(s,'name').split() print len(worte) if len(worte)<2: nachname=worte[0] else: nachname=worte[1] anfangsbuchstabe=nachname[0:1] if anfangsbuchstabe!=buchstabe: <|fim_middle|> if config.has_option(s,'address'): nb = nb + config.get(s,'address') + "<br/>" if config.has_option(s,'zip'): nb = nb + config.get(s,'zip') + " " if config.has_option(s,'city'): nb = nb + config.get(s,'city') + "<br/>" if config.has_option(s,'state'): nb = nb + config.get(s,'state') + " - " if config.has_option(s,'country'): nb = nb + config.get(s,'country') + "<br/>" nb = nb +"<br/>" if config.has_option(s,'phone'): ub= "Fon: " + config.get(s,'phone') + "<br/>" if config.has_option(s,'mobile'): ub= ub + "Mobi: " + config.get(s,'mobile') + "<br/>" if config.has_option(s,'email'): ub= ub + config.get(s,'email').replace(',','<br/>') + "<br/>" ub=ub+"<br/>" if config.has_option(s,'custom3'): mb= config.get(s,'custom3') + "<br/>" mb=mb+"<br/>" nameblock = Paragraph(nb,style) numberblock = Paragraph(ub,style) middleblock = Paragraph(mb,style) addresses.append([nameblock,middleblock,numberblock]) p = Table(addresses) p.setStyle(TableStyle([('VALIGN',(0,0),(-1,-1),"TOP"), ('ALIGN',(0,-1),(0,-1),'RIGHT')])) Story.append(p) doc.build(Story, onFirstPage=Pages, onLaterPages=Pages) go(buchstabe) <|fim▁end|>
buchstabe=anfangsbuchstabe print buchstabe p = Table(addresses) p.setStyle(TableStyle([('VALIGN',(0,0),(-1,-1),"TOP"), ('ALIGN',(0,-1),(0,-1),'RIGHT')])) Story.append(p) Story.append(PageBreak()) addresses=[]
<|file_name|>abook2pdf.py<|end_file_name|><|fim▁begin|>from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle, PageBreak from reportlab.lib.styles import getSampleStyleSheet from reportlab.rl_config import defaultPageSize from reportlab.lib.units import cm import operator import os import ConfigParser import string config = ConfigParser.ConfigParser() config.read(os.environ["HOME"] + "/.abook/addressbook") config.remove_section('format') PAGE_HEIGHT=defaultPageSize[1]; PAGE_WIDTH=defaultPageSize[0] styles = getSampleStyleSheet() buchstabe = "A" Title = "Hello world" pageinfo = "platypus example" def Pages(canvas, doc): canvas.saveState() canvas.restoreState() def go(buchstabe): doc = SimpleDocTemplate("phello.pdf") Story = [] style = styles["Normal"] addresses=[] for s in config.sections(): nb="" ub="" mb="" if config.has_option(s,'name'): nb = "<b>" + config.get(s,'name') + "</b><br/>" worte=config.get(s,'name').split() print len(worte) if len(worte)<2: nachname=worte[0] else: nachname=worte[1] anfangsbuchstabe=nachname[0:1] if anfangsbuchstabe!=buchstabe: buchstabe=anfangsbuchstabe print buchstabe p = Table(addresses) p.setStyle(TableStyle([('VALIGN',(0,0),(-1,-1),"TOP"), ('ALIGN',(0,-1),(0,-1),'RIGHT')])) Story.append(p) Story.append(PageBreak()) addresses=[] if config.has_option(s,'address'): <|fim_middle|> if config.has_option(s,'zip'): nb = nb + config.get(s,'zip') + " " if config.has_option(s,'city'): nb = nb + config.get(s,'city') + "<br/>" if config.has_option(s,'state'): nb = nb + config.get(s,'state') + " - " if config.has_option(s,'country'): nb = nb + config.get(s,'country') + "<br/>" nb = nb +"<br/>" if config.has_option(s,'phone'): ub= "Fon: " + config.get(s,'phone') + "<br/>" if config.has_option(s,'mobile'): ub= ub + "Mobi: " + config.get(s,'mobile') + "<br/>" if config.has_option(s,'email'): ub= ub + config.get(s,'email').replace(',','<br/>') + "<br/>" ub=ub+"<br/>" if config.has_option(s,'custom3'): mb= config.get(s,'custom3') + "<br/>" mb=mb+"<br/>" nameblock = Paragraph(nb,style) numberblock = Paragraph(ub,style) middleblock = Paragraph(mb,style) addresses.append([nameblock,middleblock,numberblock]) p = Table(addresses) p.setStyle(TableStyle([('VALIGN',(0,0),(-1,-1),"TOP"), ('ALIGN',(0,-1),(0,-1),'RIGHT')])) Story.append(p) doc.build(Story, onFirstPage=Pages, onLaterPages=Pages) go(buchstabe) <|fim▁end|>
nb = nb + config.get(s,'address') + "<br/>"
<|file_name|>abook2pdf.py<|end_file_name|><|fim▁begin|>from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle, PageBreak from reportlab.lib.styles import getSampleStyleSheet from reportlab.rl_config import defaultPageSize from reportlab.lib.units import cm import operator import os import ConfigParser import string config = ConfigParser.ConfigParser() config.read(os.environ["HOME"] + "/.abook/addressbook") config.remove_section('format') PAGE_HEIGHT=defaultPageSize[1]; PAGE_WIDTH=defaultPageSize[0] styles = getSampleStyleSheet() buchstabe = "A" Title = "Hello world" pageinfo = "platypus example" def Pages(canvas, doc): canvas.saveState() canvas.restoreState() def go(buchstabe): doc = SimpleDocTemplate("phello.pdf") Story = [] style = styles["Normal"] addresses=[] for s in config.sections(): nb="" ub="" mb="" if config.has_option(s,'name'): nb = "<b>" + config.get(s,'name') + "</b><br/>" worte=config.get(s,'name').split() print len(worte) if len(worte)<2: nachname=worte[0] else: nachname=worte[1] anfangsbuchstabe=nachname[0:1] if anfangsbuchstabe!=buchstabe: buchstabe=anfangsbuchstabe print buchstabe p = Table(addresses) p.setStyle(TableStyle([('VALIGN',(0,0),(-1,-1),"TOP"), ('ALIGN',(0,-1),(0,-1),'RIGHT')])) Story.append(p) Story.append(PageBreak()) addresses=[] if config.has_option(s,'address'): nb = nb + config.get(s,'address') + "<br/>" if config.has_option(s,'zip'): <|fim_middle|> if config.has_option(s,'city'): nb = nb + config.get(s,'city') + "<br/>" if config.has_option(s,'state'): nb = nb + config.get(s,'state') + " - " if config.has_option(s,'country'): nb = nb + config.get(s,'country') + "<br/>" nb = nb +"<br/>" if config.has_option(s,'phone'): ub= "Fon: " + config.get(s,'phone') + "<br/>" if config.has_option(s,'mobile'): ub= ub + "Mobi: " + config.get(s,'mobile') + "<br/>" if config.has_option(s,'email'): ub= ub + config.get(s,'email').replace(',','<br/>') + "<br/>" ub=ub+"<br/>" if config.has_option(s,'custom3'): mb= config.get(s,'custom3') + "<br/>" mb=mb+"<br/>" nameblock = Paragraph(nb,style) numberblock = Paragraph(ub,style) middleblock = Paragraph(mb,style) addresses.append([nameblock,middleblock,numberblock]) p = Table(addresses) p.setStyle(TableStyle([('VALIGN',(0,0),(-1,-1),"TOP"), ('ALIGN',(0,-1),(0,-1),'RIGHT')])) Story.append(p) doc.build(Story, onFirstPage=Pages, onLaterPages=Pages) go(buchstabe) <|fim▁end|>
nb = nb + config.get(s,'zip') + " "
<|file_name|>abook2pdf.py<|end_file_name|><|fim▁begin|>from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle, PageBreak from reportlab.lib.styles import getSampleStyleSheet from reportlab.rl_config import defaultPageSize from reportlab.lib.units import cm import operator import os import ConfigParser import string config = ConfigParser.ConfigParser() config.read(os.environ["HOME"] + "/.abook/addressbook") config.remove_section('format') PAGE_HEIGHT=defaultPageSize[1]; PAGE_WIDTH=defaultPageSize[0] styles = getSampleStyleSheet() buchstabe = "A" Title = "Hello world" pageinfo = "platypus example" def Pages(canvas, doc): canvas.saveState() canvas.restoreState() def go(buchstabe): doc = SimpleDocTemplate("phello.pdf") Story = [] style = styles["Normal"] addresses=[] for s in config.sections(): nb="" ub="" mb="" if config.has_option(s,'name'): nb = "<b>" + config.get(s,'name') + "</b><br/>" worte=config.get(s,'name').split() print len(worte) if len(worte)<2: nachname=worte[0] else: nachname=worte[1] anfangsbuchstabe=nachname[0:1] if anfangsbuchstabe!=buchstabe: buchstabe=anfangsbuchstabe print buchstabe p = Table(addresses) p.setStyle(TableStyle([('VALIGN',(0,0),(-1,-1),"TOP"), ('ALIGN',(0,-1),(0,-1),'RIGHT')])) Story.append(p) Story.append(PageBreak()) addresses=[] if config.has_option(s,'address'): nb = nb + config.get(s,'address') + "<br/>" if config.has_option(s,'zip'): nb = nb + config.get(s,'zip') + " " if config.has_option(s,'city'): <|fim_middle|> if config.has_option(s,'state'): nb = nb + config.get(s,'state') + " - " if config.has_option(s,'country'): nb = nb + config.get(s,'country') + "<br/>" nb = nb +"<br/>" if config.has_option(s,'phone'): ub= "Fon: " + config.get(s,'phone') + "<br/>" if config.has_option(s,'mobile'): ub= ub + "Mobi: " + config.get(s,'mobile') + "<br/>" if config.has_option(s,'email'): ub= ub + config.get(s,'email').replace(',','<br/>') + "<br/>" ub=ub+"<br/>" if config.has_option(s,'custom3'): mb= config.get(s,'custom3') + "<br/>" mb=mb+"<br/>" nameblock = Paragraph(nb,style) numberblock = Paragraph(ub,style) middleblock = Paragraph(mb,style) addresses.append([nameblock,middleblock,numberblock]) p = Table(addresses) p.setStyle(TableStyle([('VALIGN',(0,0),(-1,-1),"TOP"), ('ALIGN',(0,-1),(0,-1),'RIGHT')])) Story.append(p) doc.build(Story, onFirstPage=Pages, onLaterPages=Pages) go(buchstabe) <|fim▁end|>
nb = nb + config.get(s,'city') + "<br/>"
<|file_name|>abook2pdf.py<|end_file_name|><|fim▁begin|>from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle, PageBreak from reportlab.lib.styles import getSampleStyleSheet from reportlab.rl_config import defaultPageSize from reportlab.lib.units import cm import operator import os import ConfigParser import string config = ConfigParser.ConfigParser() config.read(os.environ["HOME"] + "/.abook/addressbook") config.remove_section('format') PAGE_HEIGHT=defaultPageSize[1]; PAGE_WIDTH=defaultPageSize[0] styles = getSampleStyleSheet() buchstabe = "A" Title = "Hello world" pageinfo = "platypus example" def Pages(canvas, doc): canvas.saveState() canvas.restoreState() def go(buchstabe): doc = SimpleDocTemplate("phello.pdf") Story = [] style = styles["Normal"] addresses=[] for s in config.sections(): nb="" ub="" mb="" if config.has_option(s,'name'): nb = "<b>" + config.get(s,'name') + "</b><br/>" worte=config.get(s,'name').split() print len(worte) if len(worte)<2: nachname=worte[0] else: nachname=worte[1] anfangsbuchstabe=nachname[0:1] if anfangsbuchstabe!=buchstabe: buchstabe=anfangsbuchstabe print buchstabe p = Table(addresses) p.setStyle(TableStyle([('VALIGN',(0,0),(-1,-1),"TOP"), ('ALIGN',(0,-1),(0,-1),'RIGHT')])) Story.append(p) Story.append(PageBreak()) addresses=[] if config.has_option(s,'address'): nb = nb + config.get(s,'address') + "<br/>" if config.has_option(s,'zip'): nb = nb + config.get(s,'zip') + " " if config.has_option(s,'city'): nb = nb + config.get(s,'city') + "<br/>" if config.has_option(s,'state'): <|fim_middle|> if config.has_option(s,'country'): nb = nb + config.get(s,'country') + "<br/>" nb = nb +"<br/>" if config.has_option(s,'phone'): ub= "Fon: " + config.get(s,'phone') + "<br/>" if config.has_option(s,'mobile'): ub= ub + "Mobi: " + config.get(s,'mobile') + "<br/>" if config.has_option(s,'email'): ub= ub + config.get(s,'email').replace(',','<br/>') + "<br/>" ub=ub+"<br/>" if config.has_option(s,'custom3'): mb= config.get(s,'custom3') + "<br/>" mb=mb+"<br/>" nameblock = Paragraph(nb,style) numberblock = Paragraph(ub,style) middleblock = Paragraph(mb,style) addresses.append([nameblock,middleblock,numberblock]) p = Table(addresses) p.setStyle(TableStyle([('VALIGN',(0,0),(-1,-1),"TOP"), ('ALIGN',(0,-1),(0,-1),'RIGHT')])) Story.append(p) doc.build(Story, onFirstPage=Pages, onLaterPages=Pages) go(buchstabe) <|fim▁end|>
nb = nb + config.get(s,'state') + " - "
<|file_name|>abook2pdf.py<|end_file_name|><|fim▁begin|>from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle, PageBreak from reportlab.lib.styles import getSampleStyleSheet from reportlab.rl_config import defaultPageSize from reportlab.lib.units import cm import operator import os import ConfigParser import string config = ConfigParser.ConfigParser() config.read(os.environ["HOME"] + "/.abook/addressbook") config.remove_section('format') PAGE_HEIGHT=defaultPageSize[1]; PAGE_WIDTH=defaultPageSize[0] styles = getSampleStyleSheet() buchstabe = "A" Title = "Hello world" pageinfo = "platypus example" def Pages(canvas, doc): canvas.saveState() canvas.restoreState() def go(buchstabe): doc = SimpleDocTemplate("phello.pdf") Story = [] style = styles["Normal"] addresses=[] for s in config.sections(): nb="" ub="" mb="" if config.has_option(s,'name'): nb = "<b>" + config.get(s,'name') + "</b><br/>" worte=config.get(s,'name').split() print len(worte) if len(worte)<2: nachname=worte[0] else: nachname=worte[1] anfangsbuchstabe=nachname[0:1] if anfangsbuchstabe!=buchstabe: buchstabe=anfangsbuchstabe print buchstabe p = Table(addresses) p.setStyle(TableStyle([('VALIGN',(0,0),(-1,-1),"TOP"), ('ALIGN',(0,-1),(0,-1),'RIGHT')])) Story.append(p) Story.append(PageBreak()) addresses=[] if config.has_option(s,'address'): nb = nb + config.get(s,'address') + "<br/>" if config.has_option(s,'zip'): nb = nb + config.get(s,'zip') + " " if config.has_option(s,'city'): nb = nb + config.get(s,'city') + "<br/>" if config.has_option(s,'state'): nb = nb + config.get(s,'state') + " - " if config.has_option(s,'country'): <|fim_middle|> nb = nb +"<br/>" if config.has_option(s,'phone'): ub= "Fon: " + config.get(s,'phone') + "<br/>" if config.has_option(s,'mobile'): ub= ub + "Mobi: " + config.get(s,'mobile') + "<br/>" if config.has_option(s,'email'): ub= ub + config.get(s,'email').replace(',','<br/>') + "<br/>" ub=ub+"<br/>" if config.has_option(s,'custom3'): mb= config.get(s,'custom3') + "<br/>" mb=mb+"<br/>" nameblock = Paragraph(nb,style) numberblock = Paragraph(ub,style) middleblock = Paragraph(mb,style) addresses.append([nameblock,middleblock,numberblock]) p = Table(addresses) p.setStyle(TableStyle([('VALIGN',(0,0),(-1,-1),"TOP"), ('ALIGN',(0,-1),(0,-1),'RIGHT')])) Story.append(p) doc.build(Story, onFirstPage=Pages, onLaterPages=Pages) go(buchstabe) <|fim▁end|>
nb = nb + config.get(s,'country') + "<br/>"
<|file_name|>abook2pdf.py<|end_file_name|><|fim▁begin|>from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle, PageBreak from reportlab.lib.styles import getSampleStyleSheet from reportlab.rl_config import defaultPageSize from reportlab.lib.units import cm import operator import os import ConfigParser import string config = ConfigParser.ConfigParser() config.read(os.environ["HOME"] + "/.abook/addressbook") config.remove_section('format') PAGE_HEIGHT=defaultPageSize[1]; PAGE_WIDTH=defaultPageSize[0] styles = getSampleStyleSheet() buchstabe = "A" Title = "Hello world" pageinfo = "platypus example" def Pages(canvas, doc): canvas.saveState() canvas.restoreState() def go(buchstabe): doc = SimpleDocTemplate("phello.pdf") Story = [] style = styles["Normal"] addresses=[] for s in config.sections(): nb="" ub="" mb="" if config.has_option(s,'name'): nb = "<b>" + config.get(s,'name') + "</b><br/>" worte=config.get(s,'name').split() print len(worte) if len(worte)<2: nachname=worte[0] else: nachname=worte[1] anfangsbuchstabe=nachname[0:1] if anfangsbuchstabe!=buchstabe: buchstabe=anfangsbuchstabe print buchstabe p = Table(addresses) p.setStyle(TableStyle([('VALIGN',(0,0),(-1,-1),"TOP"), ('ALIGN',(0,-1),(0,-1),'RIGHT')])) Story.append(p) Story.append(PageBreak()) addresses=[] if config.has_option(s,'address'): nb = nb + config.get(s,'address') + "<br/>" if config.has_option(s,'zip'): nb = nb + config.get(s,'zip') + " " if config.has_option(s,'city'): nb = nb + config.get(s,'city') + "<br/>" if config.has_option(s,'state'): nb = nb + config.get(s,'state') + " - " if config.has_option(s,'country'): nb = nb + config.get(s,'country') + "<br/>" nb = nb +"<br/>" if config.has_option(s,'phone'): <|fim_middle|> if config.has_option(s,'mobile'): ub= ub + "Mobi: " + config.get(s,'mobile') + "<br/>" if config.has_option(s,'email'): ub= ub + config.get(s,'email').replace(',','<br/>') + "<br/>" ub=ub+"<br/>" if config.has_option(s,'custom3'): mb= config.get(s,'custom3') + "<br/>" mb=mb+"<br/>" nameblock = Paragraph(nb,style) numberblock = Paragraph(ub,style) middleblock = Paragraph(mb,style) addresses.append([nameblock,middleblock,numberblock]) p = Table(addresses) p.setStyle(TableStyle([('VALIGN',(0,0),(-1,-1),"TOP"), ('ALIGN',(0,-1),(0,-1),'RIGHT')])) Story.append(p) doc.build(Story, onFirstPage=Pages, onLaterPages=Pages) go(buchstabe) <|fim▁end|>
ub= "Fon: " + config.get(s,'phone') + "<br/>"
<|file_name|>abook2pdf.py<|end_file_name|><|fim▁begin|>from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle, PageBreak from reportlab.lib.styles import getSampleStyleSheet from reportlab.rl_config import defaultPageSize from reportlab.lib.units import cm import operator import os import ConfigParser import string config = ConfigParser.ConfigParser() config.read(os.environ["HOME"] + "/.abook/addressbook") config.remove_section('format') PAGE_HEIGHT=defaultPageSize[1]; PAGE_WIDTH=defaultPageSize[0] styles = getSampleStyleSheet() buchstabe = "A" Title = "Hello world" pageinfo = "platypus example" def Pages(canvas, doc): canvas.saveState() canvas.restoreState() def go(buchstabe): doc = SimpleDocTemplate("phello.pdf") Story = [] style = styles["Normal"] addresses=[] for s in config.sections(): nb="" ub="" mb="" if config.has_option(s,'name'): nb = "<b>" + config.get(s,'name') + "</b><br/>" worte=config.get(s,'name').split() print len(worte) if len(worte)<2: nachname=worte[0] else: nachname=worte[1] anfangsbuchstabe=nachname[0:1] if anfangsbuchstabe!=buchstabe: buchstabe=anfangsbuchstabe print buchstabe p = Table(addresses) p.setStyle(TableStyle([('VALIGN',(0,0),(-1,-1),"TOP"), ('ALIGN',(0,-1),(0,-1),'RIGHT')])) Story.append(p) Story.append(PageBreak()) addresses=[] if config.has_option(s,'address'): nb = nb + config.get(s,'address') + "<br/>" if config.has_option(s,'zip'): nb = nb + config.get(s,'zip') + " " if config.has_option(s,'city'): nb = nb + config.get(s,'city') + "<br/>" if config.has_option(s,'state'): nb = nb + config.get(s,'state') + " - " if config.has_option(s,'country'): nb = nb + config.get(s,'country') + "<br/>" nb = nb +"<br/>" if config.has_option(s,'phone'): ub= "Fon: " + config.get(s,'phone') + "<br/>" if config.has_option(s,'mobile'): <|fim_middle|> if config.has_option(s,'email'): ub= ub + config.get(s,'email').replace(',','<br/>') + "<br/>" ub=ub+"<br/>" if config.has_option(s,'custom3'): mb= config.get(s,'custom3') + "<br/>" mb=mb+"<br/>" nameblock = Paragraph(nb,style) numberblock = Paragraph(ub,style) middleblock = Paragraph(mb,style) addresses.append([nameblock,middleblock,numberblock]) p = Table(addresses) p.setStyle(TableStyle([('VALIGN',(0,0),(-1,-1),"TOP"), ('ALIGN',(0,-1),(0,-1),'RIGHT')])) Story.append(p) doc.build(Story, onFirstPage=Pages, onLaterPages=Pages) go(buchstabe) <|fim▁end|>
ub= ub + "Mobi: " + config.get(s,'mobile') + "<br/>"
<|file_name|>abook2pdf.py<|end_file_name|><|fim▁begin|>from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle, PageBreak from reportlab.lib.styles import getSampleStyleSheet from reportlab.rl_config import defaultPageSize from reportlab.lib.units import cm import operator import os import ConfigParser import string config = ConfigParser.ConfigParser() config.read(os.environ["HOME"] + "/.abook/addressbook") config.remove_section('format') PAGE_HEIGHT=defaultPageSize[1]; PAGE_WIDTH=defaultPageSize[0] styles = getSampleStyleSheet() buchstabe = "A" Title = "Hello world" pageinfo = "platypus example" def Pages(canvas, doc): canvas.saveState() canvas.restoreState() def go(buchstabe): doc = SimpleDocTemplate("phello.pdf") Story = [] style = styles["Normal"] addresses=[] for s in config.sections(): nb="" ub="" mb="" if config.has_option(s,'name'): nb = "<b>" + config.get(s,'name') + "</b><br/>" worte=config.get(s,'name').split() print len(worte) if len(worte)<2: nachname=worte[0] else: nachname=worte[1] anfangsbuchstabe=nachname[0:1] if anfangsbuchstabe!=buchstabe: buchstabe=anfangsbuchstabe print buchstabe p = Table(addresses) p.setStyle(TableStyle([('VALIGN',(0,0),(-1,-1),"TOP"), ('ALIGN',(0,-1),(0,-1),'RIGHT')])) Story.append(p) Story.append(PageBreak()) addresses=[] if config.has_option(s,'address'): nb = nb + config.get(s,'address') + "<br/>" if config.has_option(s,'zip'): nb = nb + config.get(s,'zip') + " " if config.has_option(s,'city'): nb = nb + config.get(s,'city') + "<br/>" if config.has_option(s,'state'): nb = nb + config.get(s,'state') + " - " if config.has_option(s,'country'): nb = nb + config.get(s,'country') + "<br/>" nb = nb +"<br/>" if config.has_option(s,'phone'): ub= "Fon: " + config.get(s,'phone') + "<br/>" if config.has_option(s,'mobile'): ub= ub + "Mobi: " + config.get(s,'mobile') + "<br/>" if config.has_option(s,'email'): <|fim_middle|> ub=ub+"<br/>" if config.has_option(s,'custom3'): mb= config.get(s,'custom3') + "<br/>" mb=mb+"<br/>" nameblock = Paragraph(nb,style) numberblock = Paragraph(ub,style) middleblock = Paragraph(mb,style) addresses.append([nameblock,middleblock,numberblock]) p = Table(addresses) p.setStyle(TableStyle([('VALIGN',(0,0),(-1,-1),"TOP"), ('ALIGN',(0,-1),(0,-1),'RIGHT')])) Story.append(p) doc.build(Story, onFirstPage=Pages, onLaterPages=Pages) go(buchstabe) <|fim▁end|>
ub= ub + config.get(s,'email').replace(',','<br/>') + "<br/>"
<|file_name|>abook2pdf.py<|end_file_name|><|fim▁begin|>from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle, PageBreak from reportlab.lib.styles import getSampleStyleSheet from reportlab.rl_config import defaultPageSize from reportlab.lib.units import cm import operator import os import ConfigParser import string config = ConfigParser.ConfigParser() config.read(os.environ["HOME"] + "/.abook/addressbook") config.remove_section('format') PAGE_HEIGHT=defaultPageSize[1]; PAGE_WIDTH=defaultPageSize[0] styles = getSampleStyleSheet() buchstabe = "A" Title = "Hello world" pageinfo = "platypus example" def Pages(canvas, doc): canvas.saveState() canvas.restoreState() def go(buchstabe): doc = SimpleDocTemplate("phello.pdf") Story = [] style = styles["Normal"] addresses=[] for s in config.sections(): nb="" ub="" mb="" if config.has_option(s,'name'): nb = "<b>" + config.get(s,'name') + "</b><br/>" worte=config.get(s,'name').split() print len(worte) if len(worte)<2: nachname=worte[0] else: nachname=worte[1] anfangsbuchstabe=nachname[0:1] if anfangsbuchstabe!=buchstabe: buchstabe=anfangsbuchstabe print buchstabe p = Table(addresses) p.setStyle(TableStyle([('VALIGN',(0,0),(-1,-1),"TOP"), ('ALIGN',(0,-1),(0,-1),'RIGHT')])) Story.append(p) Story.append(PageBreak()) addresses=[] if config.has_option(s,'address'): nb = nb + config.get(s,'address') + "<br/>" if config.has_option(s,'zip'): nb = nb + config.get(s,'zip') + " " if config.has_option(s,'city'): nb = nb + config.get(s,'city') + "<br/>" if config.has_option(s,'state'): nb = nb + config.get(s,'state') + " - " if config.has_option(s,'country'): nb = nb + config.get(s,'country') + "<br/>" nb = nb +"<br/>" if config.has_option(s,'phone'): ub= "Fon: " + config.get(s,'phone') + "<br/>" if config.has_option(s,'mobile'): ub= ub + "Mobi: " + config.get(s,'mobile') + "<br/>" if config.has_option(s,'email'): ub= ub + config.get(s,'email').replace(',','<br/>') + "<br/>" ub=ub+"<br/>" if config.has_option(s,'custom3'): <|fim_middle|> mb=mb+"<br/>" nameblock = Paragraph(nb,style) numberblock = Paragraph(ub,style) middleblock = Paragraph(mb,style) addresses.append([nameblock,middleblock,numberblock]) p = Table(addresses) p.setStyle(TableStyle([('VALIGN',(0,0),(-1,-1),"TOP"), ('ALIGN',(0,-1),(0,-1),'RIGHT')])) Story.append(p) doc.build(Story, onFirstPage=Pages, onLaterPages=Pages) go(buchstabe) <|fim▁end|>
mb= config.get(s,'custom3') + "<br/>"
<|file_name|>abook2pdf.py<|end_file_name|><|fim▁begin|>from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle, PageBreak from reportlab.lib.styles import getSampleStyleSheet from reportlab.rl_config import defaultPageSize from reportlab.lib.units import cm import operator import os import ConfigParser import string config = ConfigParser.ConfigParser() config.read(os.environ["HOME"] + "/.abook/addressbook") config.remove_section('format') PAGE_HEIGHT=defaultPageSize[1]; PAGE_WIDTH=defaultPageSize[0] styles = getSampleStyleSheet() buchstabe = "A" Title = "Hello world" pageinfo = "platypus example" def <|fim_middle|>(canvas, doc): canvas.saveState() canvas.restoreState() def go(buchstabe): doc = SimpleDocTemplate("phello.pdf") Story = [] style = styles["Normal"] addresses=[] for s in config.sections(): nb="" ub="" mb="" if config.has_option(s,'name'): nb = "<b>" + config.get(s,'name') + "</b><br/>" worte=config.get(s,'name').split() print len(worte) if len(worte)<2: nachname=worte[0] else: nachname=worte[1] anfangsbuchstabe=nachname[0:1] if anfangsbuchstabe!=buchstabe: buchstabe=anfangsbuchstabe print buchstabe p = Table(addresses) p.setStyle(TableStyle([('VALIGN',(0,0),(-1,-1),"TOP"), ('ALIGN',(0,-1),(0,-1),'RIGHT')])) Story.append(p) Story.append(PageBreak()) addresses=[] if config.has_option(s,'address'): nb = nb + config.get(s,'address') + "<br/>" if config.has_option(s,'zip'): nb = nb + config.get(s,'zip') + " " if config.has_option(s,'city'): nb = nb + config.get(s,'city') + "<br/>" if config.has_option(s,'state'): nb = nb + config.get(s,'state') + " - " if config.has_option(s,'country'): nb = nb + config.get(s,'country') + "<br/>" nb = nb +"<br/>" if config.has_option(s,'phone'): ub= "Fon: " + config.get(s,'phone') + "<br/>" if config.has_option(s,'mobile'): ub= ub + "Mobi: " + config.get(s,'mobile') + "<br/>" if config.has_option(s,'email'): ub= ub + config.get(s,'email').replace(',','<br/>') + "<br/>" ub=ub+"<br/>" if config.has_option(s,'custom3'): mb= config.get(s,'custom3') + "<br/>" mb=mb+"<br/>" nameblock = Paragraph(nb,style) numberblock = Paragraph(ub,style) middleblock = Paragraph(mb,style) addresses.append([nameblock,middleblock,numberblock]) p = Table(addresses) p.setStyle(TableStyle([('VALIGN',(0,0),(-1,-1),"TOP"), ('ALIGN',(0,-1),(0,-1),'RIGHT')])) Story.append(p) doc.build(Story, onFirstPage=Pages, onLaterPages=Pages) go(buchstabe) <|fim▁end|>
Pages
<|file_name|>abook2pdf.py<|end_file_name|><|fim▁begin|>from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle, PageBreak from reportlab.lib.styles import getSampleStyleSheet from reportlab.rl_config import defaultPageSize from reportlab.lib.units import cm import operator import os import ConfigParser import string config = ConfigParser.ConfigParser() config.read(os.environ["HOME"] + "/.abook/addressbook") config.remove_section('format') PAGE_HEIGHT=defaultPageSize[1]; PAGE_WIDTH=defaultPageSize[0] styles = getSampleStyleSheet() buchstabe = "A" Title = "Hello world" pageinfo = "platypus example" def Pages(canvas, doc): canvas.saveState() canvas.restoreState() def <|fim_middle|>(buchstabe): doc = SimpleDocTemplate("phello.pdf") Story = [] style = styles["Normal"] addresses=[] for s in config.sections(): nb="" ub="" mb="" if config.has_option(s,'name'): nb = "<b>" + config.get(s,'name') + "</b><br/>" worte=config.get(s,'name').split() print len(worte) if len(worte)<2: nachname=worte[0] else: nachname=worte[1] anfangsbuchstabe=nachname[0:1] if anfangsbuchstabe!=buchstabe: buchstabe=anfangsbuchstabe print buchstabe p = Table(addresses) p.setStyle(TableStyle([('VALIGN',(0,0),(-1,-1),"TOP"), ('ALIGN',(0,-1),(0,-1),'RIGHT')])) Story.append(p) Story.append(PageBreak()) addresses=[] if config.has_option(s,'address'): nb = nb + config.get(s,'address') + "<br/>" if config.has_option(s,'zip'): nb = nb + config.get(s,'zip') + " " if config.has_option(s,'city'): nb = nb + config.get(s,'city') + "<br/>" if config.has_option(s,'state'): nb = nb + config.get(s,'state') + " - " if config.has_option(s,'country'): nb = nb + config.get(s,'country') + "<br/>" nb = nb +"<br/>" if config.has_option(s,'phone'): ub= "Fon: " + config.get(s,'phone') + "<br/>" if config.has_option(s,'mobile'): ub= ub + "Mobi: " + config.get(s,'mobile') + "<br/>" if config.has_option(s,'email'): ub= ub + config.get(s,'email').replace(',','<br/>') + "<br/>" ub=ub+"<br/>" if config.has_option(s,'custom3'): mb= config.get(s,'custom3') + "<br/>" mb=mb+"<br/>" nameblock = Paragraph(nb,style) numberblock = Paragraph(ub,style) middleblock = Paragraph(mb,style) addresses.append([nameblock,middleblock,numberblock]) p = Table(addresses) p.setStyle(TableStyle([('VALIGN',(0,0),(-1,-1),"TOP"), ('ALIGN',(0,-1),(0,-1),'RIGHT')])) Story.append(p) doc.build(Story, onFirstPage=Pages, onLaterPages=Pages) go(buchstabe) <|fim▁end|>
go
<|file_name|>gindex.py<|end_file_name|><|fim▁begin|>__author__ = 'Javier' class Project(object): def __init__(self, forks, stars, watchs): self._forks = int(forks) self._stars = int(stars) self._watchs = int(watchs) @property def forks(self): return self._forks @property def stars(self): return self._stars @property def watchs(self): return self._watchs class GIndex(object): def calculate(self, project): return project.forks * 3 + project.stars + project.watchs class ProjectRepositoryService(object): def __init__(self, conector): self.conector = conector self.project_factory = ProjectFactory() def find(self, user, repo_name): raw_json = self._read_repo(user, repo_name) return self.project_factory.build_from(raw_json) def _read_repo(self, user, repo_name): repos = self.conector.read_all(user) for repo in repos: if repo['name'] == repo_name: return repo return None class ProjectFactory(object): def build_from(self, json_project): return Project(json_project['forks_count'], json_project['watchers_count'],<|fim▁hole|><|fim▁end|>
json_project['stargazers_count'])
<|file_name|>gindex.py<|end_file_name|><|fim▁begin|>__author__ = 'Javier' class Project(object): <|fim_middle|> class GIndex(object): def calculate(self, project): return project.forks * 3 + project.stars + project.watchs class ProjectRepositoryService(object): def __init__(self, conector): self.conector = conector self.project_factory = ProjectFactory() def find(self, user, repo_name): raw_json = self._read_repo(user, repo_name) return self.project_factory.build_from(raw_json) def _read_repo(self, user, repo_name): repos = self.conector.read_all(user) for repo in repos: if repo['name'] == repo_name: return repo return None class ProjectFactory(object): def build_from(self, json_project): return Project(json_project['forks_count'], json_project['watchers_count'], json_project['stargazers_count'])<|fim▁end|>
def __init__(self, forks, stars, watchs): self._forks = int(forks) self._stars = int(stars) self._watchs = int(watchs) @property def forks(self): return self._forks @property def stars(self): return self._stars @property def watchs(self): return self._watchs
<|file_name|>gindex.py<|end_file_name|><|fim▁begin|>__author__ = 'Javier' class Project(object): def __init__(self, forks, stars, watchs): <|fim_middle|> @property def forks(self): return self._forks @property def stars(self): return self._stars @property def watchs(self): return self._watchs class GIndex(object): def calculate(self, project): return project.forks * 3 + project.stars + project.watchs class ProjectRepositoryService(object): def __init__(self, conector): self.conector = conector self.project_factory = ProjectFactory() def find(self, user, repo_name): raw_json = self._read_repo(user, repo_name) return self.project_factory.build_from(raw_json) def _read_repo(self, user, repo_name): repos = self.conector.read_all(user) for repo in repos: if repo['name'] == repo_name: return repo return None class ProjectFactory(object): def build_from(self, json_project): return Project(json_project['forks_count'], json_project['watchers_count'], json_project['stargazers_count'])<|fim▁end|>
self._forks = int(forks) self._stars = int(stars) self._watchs = int(watchs)
<|file_name|>gindex.py<|end_file_name|><|fim▁begin|>__author__ = 'Javier' class Project(object): def __init__(self, forks, stars, watchs): self._forks = int(forks) self._stars = int(stars) self._watchs = int(watchs) @property def forks(self): <|fim_middle|> @property def stars(self): return self._stars @property def watchs(self): return self._watchs class GIndex(object): def calculate(self, project): return project.forks * 3 + project.stars + project.watchs class ProjectRepositoryService(object): def __init__(self, conector): self.conector = conector self.project_factory = ProjectFactory() def find(self, user, repo_name): raw_json = self._read_repo(user, repo_name) return self.project_factory.build_from(raw_json) def _read_repo(self, user, repo_name): repos = self.conector.read_all(user) for repo in repos: if repo['name'] == repo_name: return repo return None class ProjectFactory(object): def build_from(self, json_project): return Project(json_project['forks_count'], json_project['watchers_count'], json_project['stargazers_count'])<|fim▁end|>
return self._forks
<|file_name|>gindex.py<|end_file_name|><|fim▁begin|>__author__ = 'Javier' class Project(object): def __init__(self, forks, stars, watchs): self._forks = int(forks) self._stars = int(stars) self._watchs = int(watchs) @property def forks(self): return self._forks @property def stars(self): <|fim_middle|> @property def watchs(self): return self._watchs class GIndex(object): def calculate(self, project): return project.forks * 3 + project.stars + project.watchs class ProjectRepositoryService(object): def __init__(self, conector): self.conector = conector self.project_factory = ProjectFactory() def find(self, user, repo_name): raw_json = self._read_repo(user, repo_name) return self.project_factory.build_from(raw_json) def _read_repo(self, user, repo_name): repos = self.conector.read_all(user) for repo in repos: if repo['name'] == repo_name: return repo return None class ProjectFactory(object): def build_from(self, json_project): return Project(json_project['forks_count'], json_project['watchers_count'], json_project['stargazers_count'])<|fim▁end|>
return self._stars
<|file_name|>gindex.py<|end_file_name|><|fim▁begin|>__author__ = 'Javier' class Project(object): def __init__(self, forks, stars, watchs): self._forks = int(forks) self._stars = int(stars) self._watchs = int(watchs) @property def forks(self): return self._forks @property def stars(self): return self._stars @property def watchs(self): <|fim_middle|> class GIndex(object): def calculate(self, project): return project.forks * 3 + project.stars + project.watchs class ProjectRepositoryService(object): def __init__(self, conector): self.conector = conector self.project_factory = ProjectFactory() def find(self, user, repo_name): raw_json = self._read_repo(user, repo_name) return self.project_factory.build_from(raw_json) def _read_repo(self, user, repo_name): repos = self.conector.read_all(user) for repo in repos: if repo['name'] == repo_name: return repo return None class ProjectFactory(object): def build_from(self, json_project): return Project(json_project['forks_count'], json_project['watchers_count'], json_project['stargazers_count'])<|fim▁end|>
return self._watchs
<|file_name|>gindex.py<|end_file_name|><|fim▁begin|>__author__ = 'Javier' class Project(object): def __init__(self, forks, stars, watchs): self._forks = int(forks) self._stars = int(stars) self._watchs = int(watchs) @property def forks(self): return self._forks @property def stars(self): return self._stars @property def watchs(self): return self._watchs class GIndex(object): <|fim_middle|> class ProjectRepositoryService(object): def __init__(self, conector): self.conector = conector self.project_factory = ProjectFactory() def find(self, user, repo_name): raw_json = self._read_repo(user, repo_name) return self.project_factory.build_from(raw_json) def _read_repo(self, user, repo_name): repos = self.conector.read_all(user) for repo in repos: if repo['name'] == repo_name: return repo return None class ProjectFactory(object): def build_from(self, json_project): return Project(json_project['forks_count'], json_project['watchers_count'], json_project['stargazers_count'])<|fim▁end|>
def calculate(self, project): return project.forks * 3 + project.stars + project.watchs
<|file_name|>gindex.py<|end_file_name|><|fim▁begin|>__author__ = 'Javier' class Project(object): def __init__(self, forks, stars, watchs): self._forks = int(forks) self._stars = int(stars) self._watchs = int(watchs) @property def forks(self): return self._forks @property def stars(self): return self._stars @property def watchs(self): return self._watchs class GIndex(object): def calculate(self, project): <|fim_middle|> class ProjectRepositoryService(object): def __init__(self, conector): self.conector = conector self.project_factory = ProjectFactory() def find(self, user, repo_name): raw_json = self._read_repo(user, repo_name) return self.project_factory.build_from(raw_json) def _read_repo(self, user, repo_name): repos = self.conector.read_all(user) for repo in repos: if repo['name'] == repo_name: return repo return None class ProjectFactory(object): def build_from(self, json_project): return Project(json_project['forks_count'], json_project['watchers_count'], json_project['stargazers_count'])<|fim▁end|>
return project.forks * 3 + project.stars + project.watchs
<|file_name|>gindex.py<|end_file_name|><|fim▁begin|>__author__ = 'Javier' class Project(object): def __init__(self, forks, stars, watchs): self._forks = int(forks) self._stars = int(stars) self._watchs = int(watchs) @property def forks(self): return self._forks @property def stars(self): return self._stars @property def watchs(self): return self._watchs class GIndex(object): def calculate(self, project): return project.forks * 3 + project.stars + project.watchs class ProjectRepositoryService(object): <|fim_middle|> class ProjectFactory(object): def build_from(self, json_project): return Project(json_project['forks_count'], json_project['watchers_count'], json_project['stargazers_count'])<|fim▁end|>
def __init__(self, conector): self.conector = conector self.project_factory = ProjectFactory() def find(self, user, repo_name): raw_json = self._read_repo(user, repo_name) return self.project_factory.build_from(raw_json) def _read_repo(self, user, repo_name): repos = self.conector.read_all(user) for repo in repos: if repo['name'] == repo_name: return repo return None
<|file_name|>gindex.py<|end_file_name|><|fim▁begin|>__author__ = 'Javier' class Project(object): def __init__(self, forks, stars, watchs): self._forks = int(forks) self._stars = int(stars) self._watchs = int(watchs) @property def forks(self): return self._forks @property def stars(self): return self._stars @property def watchs(self): return self._watchs class GIndex(object): def calculate(self, project): return project.forks * 3 + project.stars + project.watchs class ProjectRepositoryService(object): def __init__(self, conector): <|fim_middle|> def find(self, user, repo_name): raw_json = self._read_repo(user, repo_name) return self.project_factory.build_from(raw_json) def _read_repo(self, user, repo_name): repos = self.conector.read_all(user) for repo in repos: if repo['name'] == repo_name: return repo return None class ProjectFactory(object): def build_from(self, json_project): return Project(json_project['forks_count'], json_project['watchers_count'], json_project['stargazers_count'])<|fim▁end|>
self.conector = conector self.project_factory = ProjectFactory()
<|file_name|>gindex.py<|end_file_name|><|fim▁begin|>__author__ = 'Javier' class Project(object): def __init__(self, forks, stars, watchs): self._forks = int(forks) self._stars = int(stars) self._watchs = int(watchs) @property def forks(self): return self._forks @property def stars(self): return self._stars @property def watchs(self): return self._watchs class GIndex(object): def calculate(self, project): return project.forks * 3 + project.stars + project.watchs class ProjectRepositoryService(object): def __init__(self, conector): self.conector = conector self.project_factory = ProjectFactory() def find(self, user, repo_name): <|fim_middle|> def _read_repo(self, user, repo_name): repos = self.conector.read_all(user) for repo in repos: if repo['name'] == repo_name: return repo return None class ProjectFactory(object): def build_from(self, json_project): return Project(json_project['forks_count'], json_project['watchers_count'], json_project['stargazers_count'])<|fim▁end|>
raw_json = self._read_repo(user, repo_name) return self.project_factory.build_from(raw_json)
<|file_name|>gindex.py<|end_file_name|><|fim▁begin|>__author__ = 'Javier' class Project(object): def __init__(self, forks, stars, watchs): self._forks = int(forks) self._stars = int(stars) self._watchs = int(watchs) @property def forks(self): return self._forks @property def stars(self): return self._stars @property def watchs(self): return self._watchs class GIndex(object): def calculate(self, project): return project.forks * 3 + project.stars + project.watchs class ProjectRepositoryService(object): def __init__(self, conector): self.conector = conector self.project_factory = ProjectFactory() def find(self, user, repo_name): raw_json = self._read_repo(user, repo_name) return self.project_factory.build_from(raw_json) def _read_repo(self, user, repo_name): <|fim_middle|> class ProjectFactory(object): def build_from(self, json_project): return Project(json_project['forks_count'], json_project['watchers_count'], json_project['stargazers_count'])<|fim▁end|>
repos = self.conector.read_all(user) for repo in repos: if repo['name'] == repo_name: return repo return None
<|file_name|>gindex.py<|end_file_name|><|fim▁begin|>__author__ = 'Javier' class Project(object): def __init__(self, forks, stars, watchs): self._forks = int(forks) self._stars = int(stars) self._watchs = int(watchs) @property def forks(self): return self._forks @property def stars(self): return self._stars @property def watchs(self): return self._watchs class GIndex(object): def calculate(self, project): return project.forks * 3 + project.stars + project.watchs class ProjectRepositoryService(object): def __init__(self, conector): self.conector = conector self.project_factory = ProjectFactory() def find(self, user, repo_name): raw_json = self._read_repo(user, repo_name) return self.project_factory.build_from(raw_json) def _read_repo(self, user, repo_name): repos = self.conector.read_all(user) for repo in repos: if repo['name'] == repo_name: return repo return None class ProjectFactory(object): <|fim_middle|> <|fim▁end|>
def build_from(self, json_project): return Project(json_project['forks_count'], json_project['watchers_count'], json_project['stargazers_count'])
<|file_name|>gindex.py<|end_file_name|><|fim▁begin|>__author__ = 'Javier' class Project(object): def __init__(self, forks, stars, watchs): self._forks = int(forks) self._stars = int(stars) self._watchs = int(watchs) @property def forks(self): return self._forks @property def stars(self): return self._stars @property def watchs(self): return self._watchs class GIndex(object): def calculate(self, project): return project.forks * 3 + project.stars + project.watchs class ProjectRepositoryService(object): def __init__(self, conector): self.conector = conector self.project_factory = ProjectFactory() def find(self, user, repo_name): raw_json = self._read_repo(user, repo_name) return self.project_factory.build_from(raw_json) def _read_repo(self, user, repo_name): repos = self.conector.read_all(user) for repo in repos: if repo['name'] == repo_name: return repo return None class ProjectFactory(object): def build_from(self, json_project): <|fim_middle|> <|fim▁end|>
return Project(json_project['forks_count'], json_project['watchers_count'], json_project['stargazers_count'])
<|file_name|>gindex.py<|end_file_name|><|fim▁begin|>__author__ = 'Javier' class Project(object): def __init__(self, forks, stars, watchs): self._forks = int(forks) self._stars = int(stars) self._watchs = int(watchs) @property def forks(self): return self._forks @property def stars(self): return self._stars @property def watchs(self): return self._watchs class GIndex(object): def calculate(self, project): return project.forks * 3 + project.stars + project.watchs class ProjectRepositoryService(object): def __init__(self, conector): self.conector = conector self.project_factory = ProjectFactory() def find(self, user, repo_name): raw_json = self._read_repo(user, repo_name) return self.project_factory.build_from(raw_json) def _read_repo(self, user, repo_name): repos = self.conector.read_all(user) for repo in repos: if repo['name'] == repo_name: <|fim_middle|> return None class ProjectFactory(object): def build_from(self, json_project): return Project(json_project['forks_count'], json_project['watchers_count'], json_project['stargazers_count'])<|fim▁end|>
return repo
<|file_name|>gindex.py<|end_file_name|><|fim▁begin|>__author__ = 'Javier' class Project(object): def <|fim_middle|>(self, forks, stars, watchs): self._forks = int(forks) self._stars = int(stars) self._watchs = int(watchs) @property def forks(self): return self._forks @property def stars(self): return self._stars @property def watchs(self): return self._watchs class GIndex(object): def calculate(self, project): return project.forks * 3 + project.stars + project.watchs class ProjectRepositoryService(object): def __init__(self, conector): self.conector = conector self.project_factory = ProjectFactory() def find(self, user, repo_name): raw_json = self._read_repo(user, repo_name) return self.project_factory.build_from(raw_json) def _read_repo(self, user, repo_name): repos = self.conector.read_all(user) for repo in repos: if repo['name'] == repo_name: return repo return None class ProjectFactory(object): def build_from(self, json_project): return Project(json_project['forks_count'], json_project['watchers_count'], json_project['stargazers_count'])<|fim▁end|>
__init__
<|file_name|>gindex.py<|end_file_name|><|fim▁begin|>__author__ = 'Javier' class Project(object): def __init__(self, forks, stars, watchs): self._forks = int(forks) self._stars = int(stars) self._watchs = int(watchs) @property def <|fim_middle|>(self): return self._forks @property def stars(self): return self._stars @property def watchs(self): return self._watchs class GIndex(object): def calculate(self, project): return project.forks * 3 + project.stars + project.watchs class ProjectRepositoryService(object): def __init__(self, conector): self.conector = conector self.project_factory = ProjectFactory() def find(self, user, repo_name): raw_json = self._read_repo(user, repo_name) return self.project_factory.build_from(raw_json) def _read_repo(self, user, repo_name): repos = self.conector.read_all(user) for repo in repos: if repo['name'] == repo_name: return repo return None class ProjectFactory(object): def build_from(self, json_project): return Project(json_project['forks_count'], json_project['watchers_count'], json_project['stargazers_count'])<|fim▁end|>
forks
<|file_name|>gindex.py<|end_file_name|><|fim▁begin|>__author__ = 'Javier' class Project(object): def __init__(self, forks, stars, watchs): self._forks = int(forks) self._stars = int(stars) self._watchs = int(watchs) @property def forks(self): return self._forks @property def <|fim_middle|>(self): return self._stars @property def watchs(self): return self._watchs class GIndex(object): def calculate(self, project): return project.forks * 3 + project.stars + project.watchs class ProjectRepositoryService(object): def __init__(self, conector): self.conector = conector self.project_factory = ProjectFactory() def find(self, user, repo_name): raw_json = self._read_repo(user, repo_name) return self.project_factory.build_from(raw_json) def _read_repo(self, user, repo_name): repos = self.conector.read_all(user) for repo in repos: if repo['name'] == repo_name: return repo return None class ProjectFactory(object): def build_from(self, json_project): return Project(json_project['forks_count'], json_project['watchers_count'], json_project['stargazers_count'])<|fim▁end|>
stars
<|file_name|>gindex.py<|end_file_name|><|fim▁begin|>__author__ = 'Javier' class Project(object): def __init__(self, forks, stars, watchs): self._forks = int(forks) self._stars = int(stars) self._watchs = int(watchs) @property def forks(self): return self._forks @property def stars(self): return self._stars @property def <|fim_middle|>(self): return self._watchs class GIndex(object): def calculate(self, project): return project.forks * 3 + project.stars + project.watchs class ProjectRepositoryService(object): def __init__(self, conector): self.conector = conector self.project_factory = ProjectFactory() def find(self, user, repo_name): raw_json = self._read_repo(user, repo_name) return self.project_factory.build_from(raw_json) def _read_repo(self, user, repo_name): repos = self.conector.read_all(user) for repo in repos: if repo['name'] == repo_name: return repo return None class ProjectFactory(object): def build_from(self, json_project): return Project(json_project['forks_count'], json_project['watchers_count'], json_project['stargazers_count'])<|fim▁end|>
watchs
<|file_name|>gindex.py<|end_file_name|><|fim▁begin|>__author__ = 'Javier' class Project(object): def __init__(self, forks, stars, watchs): self._forks = int(forks) self._stars = int(stars) self._watchs = int(watchs) @property def forks(self): return self._forks @property def stars(self): return self._stars @property def watchs(self): return self._watchs class GIndex(object): def <|fim_middle|>(self, project): return project.forks * 3 + project.stars + project.watchs class ProjectRepositoryService(object): def __init__(self, conector): self.conector = conector self.project_factory = ProjectFactory() def find(self, user, repo_name): raw_json = self._read_repo(user, repo_name) return self.project_factory.build_from(raw_json) def _read_repo(self, user, repo_name): repos = self.conector.read_all(user) for repo in repos: if repo['name'] == repo_name: return repo return None class ProjectFactory(object): def build_from(self, json_project): return Project(json_project['forks_count'], json_project['watchers_count'], json_project['stargazers_count'])<|fim▁end|>
calculate
<|file_name|>gindex.py<|end_file_name|><|fim▁begin|>__author__ = 'Javier' class Project(object): def __init__(self, forks, stars, watchs): self._forks = int(forks) self._stars = int(stars) self._watchs = int(watchs) @property def forks(self): return self._forks @property def stars(self): return self._stars @property def watchs(self): return self._watchs class GIndex(object): def calculate(self, project): return project.forks * 3 + project.stars + project.watchs class ProjectRepositoryService(object): def <|fim_middle|>(self, conector): self.conector = conector self.project_factory = ProjectFactory() def find(self, user, repo_name): raw_json = self._read_repo(user, repo_name) return self.project_factory.build_from(raw_json) def _read_repo(self, user, repo_name): repos = self.conector.read_all(user) for repo in repos: if repo['name'] == repo_name: return repo return None class ProjectFactory(object): def build_from(self, json_project): return Project(json_project['forks_count'], json_project['watchers_count'], json_project['stargazers_count'])<|fim▁end|>
__init__
<|file_name|>gindex.py<|end_file_name|><|fim▁begin|>__author__ = 'Javier' class Project(object): def __init__(self, forks, stars, watchs): self._forks = int(forks) self._stars = int(stars) self._watchs = int(watchs) @property def forks(self): return self._forks @property def stars(self): return self._stars @property def watchs(self): return self._watchs class GIndex(object): def calculate(self, project): return project.forks * 3 + project.stars + project.watchs class ProjectRepositoryService(object): def __init__(self, conector): self.conector = conector self.project_factory = ProjectFactory() def <|fim_middle|>(self, user, repo_name): raw_json = self._read_repo(user, repo_name) return self.project_factory.build_from(raw_json) def _read_repo(self, user, repo_name): repos = self.conector.read_all(user) for repo in repos: if repo['name'] == repo_name: return repo return None class ProjectFactory(object): def build_from(self, json_project): return Project(json_project['forks_count'], json_project['watchers_count'], json_project['stargazers_count'])<|fim▁end|>
find
<|file_name|>gindex.py<|end_file_name|><|fim▁begin|>__author__ = 'Javier' class Project(object): def __init__(self, forks, stars, watchs): self._forks = int(forks) self._stars = int(stars) self._watchs = int(watchs) @property def forks(self): return self._forks @property def stars(self): return self._stars @property def watchs(self): return self._watchs class GIndex(object): def calculate(self, project): return project.forks * 3 + project.stars + project.watchs class ProjectRepositoryService(object): def __init__(self, conector): self.conector = conector self.project_factory = ProjectFactory() def find(self, user, repo_name): raw_json = self._read_repo(user, repo_name) return self.project_factory.build_from(raw_json) def <|fim_middle|>(self, user, repo_name): repos = self.conector.read_all(user) for repo in repos: if repo['name'] == repo_name: return repo return None class ProjectFactory(object): def build_from(self, json_project): return Project(json_project['forks_count'], json_project['watchers_count'], json_project['stargazers_count'])<|fim▁end|>
_read_repo
<|file_name|>gindex.py<|end_file_name|><|fim▁begin|>__author__ = 'Javier' class Project(object): def __init__(self, forks, stars, watchs): self._forks = int(forks) self._stars = int(stars) self._watchs = int(watchs) @property def forks(self): return self._forks @property def stars(self): return self._stars @property def watchs(self): return self._watchs class GIndex(object): def calculate(self, project): return project.forks * 3 + project.stars + project.watchs class ProjectRepositoryService(object): def __init__(self, conector): self.conector = conector self.project_factory = ProjectFactory() def find(self, user, repo_name): raw_json = self._read_repo(user, repo_name) return self.project_factory.build_from(raw_json) def _read_repo(self, user, repo_name): repos = self.conector.read_all(user) for repo in repos: if repo['name'] == repo_name: return repo return None class ProjectFactory(object): def <|fim_middle|>(self, json_project): return Project(json_project['forks_count'], json_project['watchers_count'], json_project['stargazers_count'])<|fim▁end|>
build_from
<|file_name|>sale.py<|end_file_name|><|fim▁begin|>from api_request import Api from util import Util from twocheckout import Twocheckout class Sale(Twocheckout): def __init__(self, dict_): super(self.__class__, self).__init__(dict_) @classmethod def find(cls, params=None): if params is None: params = dict() response = cls(Api.call('sales/detail_sale', params)) return response.sale @classmethod def list(cls, params=None): if params is None: params = dict() response = cls(Api.call('sales/list_sales', params)) return response.sale_summary def refund(self, params=None): if params is None: params = dict() if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id url = 'sales/refund_lineitem' elif hasattr(self, 'invoice_id'): params['invoice_id'] = self.invoice_id url = 'sales/refund_invoice' else: params['sale_id'] = self.sale_id url = 'sales/refund_invoice' return Sale(Api.call(url, params)) def stop(self, params=None): if params is None: params = dict() if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id return Api.call('sales/stop_lineitem_recurring', params) elif hasattr(self, 'sale_id'): active_lineitems = Util.active(self) if dict(active_lineitems): result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v params = {'lineitem_id': lineitem_id} result[i] = Api.call('sales/stop_lineitem_recurring', params) i += 1 response = { "response_code": "OK", "response_message": str(len(result)) + " lineitems stopped successfully" } else: response = { "response_code": "NOTICE", "response_message": "No active recurring lineitems" } else: response = { "response_code": "NOTICE", "response_message": "This method can only be called on a sale or lineitem" } return Sale(response) def active(self): active_lineitems = Util.active(self) if dict(active_lineitems): result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v result[i] = lineitem_id i += 1 response = { "response_code": "ACTIVE", "response_message": str(len(result)) + " active recurring lineitems" } else: response = { "response_code": "NOTICE","response_message": "No active recurring lineitems" } return Sale(response) def comment(self, params=None): if params is None: params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/create_comment', params)) def ship(self, params=None): if params is None: params = dict()<|fim▁hole|><|fim▁end|>
params['sale_id'] = self.sale_id return Sale(Api.call('sales/mark_shipped', params))
<|file_name|>sale.py<|end_file_name|><|fim▁begin|>from api_request import Api from util import Util from twocheckout import Twocheckout class Sale(Twocheckout): <|fim_middle|> <|fim▁end|>
def __init__(self, dict_): super(self.__class__, self).__init__(dict_) @classmethod def find(cls, params=None): if params is None: params = dict() response = cls(Api.call('sales/detail_sale', params)) return response.sale @classmethod def list(cls, params=None): if params is None: params = dict() response = cls(Api.call('sales/list_sales', params)) return response.sale_summary def refund(self, params=None): if params is None: params = dict() if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id url = 'sales/refund_lineitem' elif hasattr(self, 'invoice_id'): params['invoice_id'] = self.invoice_id url = 'sales/refund_invoice' else: params['sale_id'] = self.sale_id url = 'sales/refund_invoice' return Sale(Api.call(url, params)) def stop(self, params=None): if params is None: params = dict() if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id return Api.call('sales/stop_lineitem_recurring', params) elif hasattr(self, 'sale_id'): active_lineitems = Util.active(self) if dict(active_lineitems): result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v params = {'lineitem_id': lineitem_id} result[i] = Api.call('sales/stop_lineitem_recurring', params) i += 1 response = { "response_code": "OK", "response_message": str(len(result)) + " lineitems stopped successfully" } else: response = { "response_code": "NOTICE", "response_message": "No active recurring lineitems" } else: response = { "response_code": "NOTICE", "response_message": "This method can only be called on a sale or lineitem" } return Sale(response) def active(self): active_lineitems = Util.active(self) if dict(active_lineitems): result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v result[i] = lineitem_id i += 1 response = { "response_code": "ACTIVE", "response_message": str(len(result)) + " active recurring lineitems" } else: response = { "response_code": "NOTICE","response_message": "No active recurring lineitems" } return Sale(response) def comment(self, params=None): if params is None: params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/create_comment', params)) def ship(self, params=None): if params is None: params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/mark_shipped', params))
<|file_name|>sale.py<|end_file_name|><|fim▁begin|>from api_request import Api from util import Util from twocheckout import Twocheckout class Sale(Twocheckout): def __init__(self, dict_): <|fim_middle|> @classmethod def find(cls, params=None): if params is None: params = dict() response = cls(Api.call('sales/detail_sale', params)) return response.sale @classmethod def list(cls, params=None): if params is None: params = dict() response = cls(Api.call('sales/list_sales', params)) return response.sale_summary def refund(self, params=None): if params is None: params = dict() if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id url = 'sales/refund_lineitem' elif hasattr(self, 'invoice_id'): params['invoice_id'] = self.invoice_id url = 'sales/refund_invoice' else: params['sale_id'] = self.sale_id url = 'sales/refund_invoice' return Sale(Api.call(url, params)) def stop(self, params=None): if params is None: params = dict() if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id return Api.call('sales/stop_lineitem_recurring', params) elif hasattr(self, 'sale_id'): active_lineitems = Util.active(self) if dict(active_lineitems): result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v params = {'lineitem_id': lineitem_id} result[i] = Api.call('sales/stop_lineitem_recurring', params) i += 1 response = { "response_code": "OK", "response_message": str(len(result)) + " lineitems stopped successfully" } else: response = { "response_code": "NOTICE", "response_message": "No active recurring lineitems" } else: response = { "response_code": "NOTICE", "response_message": "This method can only be called on a sale or lineitem" } return Sale(response) def active(self): active_lineitems = Util.active(self) if dict(active_lineitems): result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v result[i] = lineitem_id i += 1 response = { "response_code": "ACTIVE", "response_message": str(len(result)) + " active recurring lineitems" } else: response = { "response_code": "NOTICE","response_message": "No active recurring lineitems" } return Sale(response) def comment(self, params=None): if params is None: params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/create_comment', params)) def ship(self, params=None): if params is None: params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/mark_shipped', params)) <|fim▁end|>
super(self.__class__, self).__init__(dict_)
<|file_name|>sale.py<|end_file_name|><|fim▁begin|>from api_request import Api from util import Util from twocheckout import Twocheckout class Sale(Twocheckout): def __init__(self, dict_): super(self.__class__, self).__init__(dict_) @classmethod def find(cls, params=None): <|fim_middle|> @classmethod def list(cls, params=None): if params is None: params = dict() response = cls(Api.call('sales/list_sales', params)) return response.sale_summary def refund(self, params=None): if params is None: params = dict() if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id url = 'sales/refund_lineitem' elif hasattr(self, 'invoice_id'): params['invoice_id'] = self.invoice_id url = 'sales/refund_invoice' else: params['sale_id'] = self.sale_id url = 'sales/refund_invoice' return Sale(Api.call(url, params)) def stop(self, params=None): if params is None: params = dict() if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id return Api.call('sales/stop_lineitem_recurring', params) elif hasattr(self, 'sale_id'): active_lineitems = Util.active(self) if dict(active_lineitems): result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v params = {'lineitem_id': lineitem_id} result[i] = Api.call('sales/stop_lineitem_recurring', params) i += 1 response = { "response_code": "OK", "response_message": str(len(result)) + " lineitems stopped successfully" } else: response = { "response_code": "NOTICE", "response_message": "No active recurring lineitems" } else: response = { "response_code": "NOTICE", "response_message": "This method can only be called on a sale or lineitem" } return Sale(response) def active(self): active_lineitems = Util.active(self) if dict(active_lineitems): result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v result[i] = lineitem_id i += 1 response = { "response_code": "ACTIVE", "response_message": str(len(result)) + " active recurring lineitems" } else: response = { "response_code": "NOTICE","response_message": "No active recurring lineitems" } return Sale(response) def comment(self, params=None): if params is None: params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/create_comment', params)) def ship(self, params=None): if params is None: params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/mark_shipped', params)) <|fim▁end|>
if params is None: params = dict() response = cls(Api.call('sales/detail_sale', params)) return response.sale
<|file_name|>sale.py<|end_file_name|><|fim▁begin|>from api_request import Api from util import Util from twocheckout import Twocheckout class Sale(Twocheckout): def __init__(self, dict_): super(self.__class__, self).__init__(dict_) @classmethod def find(cls, params=None): if params is None: params = dict() response = cls(Api.call('sales/detail_sale', params)) return response.sale @classmethod def list(cls, params=None): <|fim_middle|> def refund(self, params=None): if params is None: params = dict() if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id url = 'sales/refund_lineitem' elif hasattr(self, 'invoice_id'): params['invoice_id'] = self.invoice_id url = 'sales/refund_invoice' else: params['sale_id'] = self.sale_id url = 'sales/refund_invoice' return Sale(Api.call(url, params)) def stop(self, params=None): if params is None: params = dict() if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id return Api.call('sales/stop_lineitem_recurring', params) elif hasattr(self, 'sale_id'): active_lineitems = Util.active(self) if dict(active_lineitems): result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v params = {'lineitem_id': lineitem_id} result[i] = Api.call('sales/stop_lineitem_recurring', params) i += 1 response = { "response_code": "OK", "response_message": str(len(result)) + " lineitems stopped successfully" } else: response = { "response_code": "NOTICE", "response_message": "No active recurring lineitems" } else: response = { "response_code": "NOTICE", "response_message": "This method can only be called on a sale or lineitem" } return Sale(response) def active(self): active_lineitems = Util.active(self) if dict(active_lineitems): result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v result[i] = lineitem_id i += 1 response = { "response_code": "ACTIVE", "response_message": str(len(result)) + " active recurring lineitems" } else: response = { "response_code": "NOTICE","response_message": "No active recurring lineitems" } return Sale(response) def comment(self, params=None): if params is None: params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/create_comment', params)) def ship(self, params=None): if params is None: params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/mark_shipped', params)) <|fim▁end|>
if params is None: params = dict() response = cls(Api.call('sales/list_sales', params)) return response.sale_summary
<|file_name|>sale.py<|end_file_name|><|fim▁begin|>from api_request import Api from util import Util from twocheckout import Twocheckout class Sale(Twocheckout): def __init__(self, dict_): super(self.__class__, self).__init__(dict_) @classmethod def find(cls, params=None): if params is None: params = dict() response = cls(Api.call('sales/detail_sale', params)) return response.sale @classmethod def list(cls, params=None): if params is None: params = dict() response = cls(Api.call('sales/list_sales', params)) return response.sale_summary def refund(self, params=None): <|fim_middle|> def stop(self, params=None): if params is None: params = dict() if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id return Api.call('sales/stop_lineitem_recurring', params) elif hasattr(self, 'sale_id'): active_lineitems = Util.active(self) if dict(active_lineitems): result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v params = {'lineitem_id': lineitem_id} result[i] = Api.call('sales/stop_lineitem_recurring', params) i += 1 response = { "response_code": "OK", "response_message": str(len(result)) + " lineitems stopped successfully" } else: response = { "response_code": "NOTICE", "response_message": "No active recurring lineitems" } else: response = { "response_code": "NOTICE", "response_message": "This method can only be called on a sale or lineitem" } return Sale(response) def active(self): active_lineitems = Util.active(self) if dict(active_lineitems): result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v result[i] = lineitem_id i += 1 response = { "response_code": "ACTIVE", "response_message": str(len(result)) + " active recurring lineitems" } else: response = { "response_code": "NOTICE","response_message": "No active recurring lineitems" } return Sale(response) def comment(self, params=None): if params is None: params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/create_comment', params)) def ship(self, params=None): if params is None: params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/mark_shipped', params)) <|fim▁end|>
if params is None: params = dict() if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id url = 'sales/refund_lineitem' elif hasattr(self, 'invoice_id'): params['invoice_id'] = self.invoice_id url = 'sales/refund_invoice' else: params['sale_id'] = self.sale_id url = 'sales/refund_invoice' return Sale(Api.call(url, params))
<|file_name|>sale.py<|end_file_name|><|fim▁begin|>from api_request import Api from util import Util from twocheckout import Twocheckout class Sale(Twocheckout): def __init__(self, dict_): super(self.__class__, self).__init__(dict_) @classmethod def find(cls, params=None): if params is None: params = dict() response = cls(Api.call('sales/detail_sale', params)) return response.sale @classmethod def list(cls, params=None): if params is None: params = dict() response = cls(Api.call('sales/list_sales', params)) return response.sale_summary def refund(self, params=None): if params is None: params = dict() if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id url = 'sales/refund_lineitem' elif hasattr(self, 'invoice_id'): params['invoice_id'] = self.invoice_id url = 'sales/refund_invoice' else: params['sale_id'] = self.sale_id url = 'sales/refund_invoice' return Sale(Api.call(url, params)) def stop(self, params=None): <|fim_middle|> def active(self): active_lineitems = Util.active(self) if dict(active_lineitems): result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v result[i] = lineitem_id i += 1 response = { "response_code": "ACTIVE", "response_message": str(len(result)) + " active recurring lineitems" } else: response = { "response_code": "NOTICE","response_message": "No active recurring lineitems" } return Sale(response) def comment(self, params=None): if params is None: params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/create_comment', params)) def ship(self, params=None): if params is None: params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/mark_shipped', params)) <|fim▁end|>
if params is None: params = dict() if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id return Api.call('sales/stop_lineitem_recurring', params) elif hasattr(self, 'sale_id'): active_lineitems = Util.active(self) if dict(active_lineitems): result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v params = {'lineitem_id': lineitem_id} result[i] = Api.call('sales/stop_lineitem_recurring', params) i += 1 response = { "response_code": "OK", "response_message": str(len(result)) + " lineitems stopped successfully" } else: response = { "response_code": "NOTICE", "response_message": "No active recurring lineitems" } else: response = { "response_code": "NOTICE", "response_message": "This method can only be called on a sale or lineitem" } return Sale(response)
<|file_name|>sale.py<|end_file_name|><|fim▁begin|>from api_request import Api from util import Util from twocheckout import Twocheckout class Sale(Twocheckout): def __init__(self, dict_): super(self.__class__, self).__init__(dict_) @classmethod def find(cls, params=None): if params is None: params = dict() response = cls(Api.call('sales/detail_sale', params)) return response.sale @classmethod def list(cls, params=None): if params is None: params = dict() response = cls(Api.call('sales/list_sales', params)) return response.sale_summary def refund(self, params=None): if params is None: params = dict() if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id url = 'sales/refund_lineitem' elif hasattr(self, 'invoice_id'): params['invoice_id'] = self.invoice_id url = 'sales/refund_invoice' else: params['sale_id'] = self.sale_id url = 'sales/refund_invoice' return Sale(Api.call(url, params)) def stop(self, params=None): if params is None: params = dict() if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id return Api.call('sales/stop_lineitem_recurring', params) elif hasattr(self, 'sale_id'): active_lineitems = Util.active(self) if dict(active_lineitems): result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v params = {'lineitem_id': lineitem_id} result[i] = Api.call('sales/stop_lineitem_recurring', params) i += 1 response = { "response_code": "OK", "response_message": str(len(result)) + " lineitems stopped successfully" } else: response = { "response_code": "NOTICE", "response_message": "No active recurring lineitems" } else: response = { "response_code": "NOTICE", "response_message": "This method can only be called on a sale or lineitem" } return Sale(response) def active(self): <|fim_middle|> def comment(self, params=None): if params is None: params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/create_comment', params)) def ship(self, params=None): if params is None: params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/mark_shipped', params)) <|fim▁end|>
active_lineitems = Util.active(self) if dict(active_lineitems): result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v result[i] = lineitem_id i += 1 response = { "response_code": "ACTIVE", "response_message": str(len(result)) + " active recurring lineitems" } else: response = { "response_code": "NOTICE","response_message": "No active recurring lineitems" } return Sale(response)
<|file_name|>sale.py<|end_file_name|><|fim▁begin|>from api_request import Api from util import Util from twocheckout import Twocheckout class Sale(Twocheckout): def __init__(self, dict_): super(self.__class__, self).__init__(dict_) @classmethod def find(cls, params=None): if params is None: params = dict() response = cls(Api.call('sales/detail_sale', params)) return response.sale @classmethod def list(cls, params=None): if params is None: params = dict() response = cls(Api.call('sales/list_sales', params)) return response.sale_summary def refund(self, params=None): if params is None: params = dict() if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id url = 'sales/refund_lineitem' elif hasattr(self, 'invoice_id'): params['invoice_id'] = self.invoice_id url = 'sales/refund_invoice' else: params['sale_id'] = self.sale_id url = 'sales/refund_invoice' return Sale(Api.call(url, params)) def stop(self, params=None): if params is None: params = dict() if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id return Api.call('sales/stop_lineitem_recurring', params) elif hasattr(self, 'sale_id'): active_lineitems = Util.active(self) if dict(active_lineitems): result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v params = {'lineitem_id': lineitem_id} result[i] = Api.call('sales/stop_lineitem_recurring', params) i += 1 response = { "response_code": "OK", "response_message": str(len(result)) + " lineitems stopped successfully" } else: response = { "response_code": "NOTICE", "response_message": "No active recurring lineitems" } else: response = { "response_code": "NOTICE", "response_message": "This method can only be called on a sale or lineitem" } return Sale(response) def active(self): active_lineitems = Util.active(self) if dict(active_lineitems): result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v result[i] = lineitem_id i += 1 response = { "response_code": "ACTIVE", "response_message": str(len(result)) + " active recurring lineitems" } else: response = { "response_code": "NOTICE","response_message": "No active recurring lineitems" } return Sale(response) def comment(self, params=None): <|fim_middle|> def ship(self, params=None): if params is None: params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/mark_shipped', params)) <|fim▁end|>
if params is None: params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/create_comment', params))
<|file_name|>sale.py<|end_file_name|><|fim▁begin|>from api_request import Api from util import Util from twocheckout import Twocheckout class Sale(Twocheckout): def __init__(self, dict_): super(self.__class__, self).__init__(dict_) @classmethod def find(cls, params=None): if params is None: params = dict() response = cls(Api.call('sales/detail_sale', params)) return response.sale @classmethod def list(cls, params=None): if params is None: params = dict() response = cls(Api.call('sales/list_sales', params)) return response.sale_summary def refund(self, params=None): if params is None: params = dict() if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id url = 'sales/refund_lineitem' elif hasattr(self, 'invoice_id'): params['invoice_id'] = self.invoice_id url = 'sales/refund_invoice' else: params['sale_id'] = self.sale_id url = 'sales/refund_invoice' return Sale(Api.call(url, params)) def stop(self, params=None): if params is None: params = dict() if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id return Api.call('sales/stop_lineitem_recurring', params) elif hasattr(self, 'sale_id'): active_lineitems = Util.active(self) if dict(active_lineitems): result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v params = {'lineitem_id': lineitem_id} result[i] = Api.call('sales/stop_lineitem_recurring', params) i += 1 response = { "response_code": "OK", "response_message": str(len(result)) + " lineitems stopped successfully" } else: response = { "response_code": "NOTICE", "response_message": "No active recurring lineitems" } else: response = { "response_code": "NOTICE", "response_message": "This method can only be called on a sale or lineitem" } return Sale(response) def active(self): active_lineitems = Util.active(self) if dict(active_lineitems): result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v result[i] = lineitem_id i += 1 response = { "response_code": "ACTIVE", "response_message": str(len(result)) + " active recurring lineitems" } else: response = { "response_code": "NOTICE","response_message": "No active recurring lineitems" } return Sale(response) def comment(self, params=None): if params is None: params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/create_comment', params)) def ship(self, params=None): <|fim_middle|> <|fim▁end|>
if params is None: params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/mark_shipped', params))
<|file_name|>sale.py<|end_file_name|><|fim▁begin|>from api_request import Api from util import Util from twocheckout import Twocheckout class Sale(Twocheckout): def __init__(self, dict_): super(self.__class__, self).__init__(dict_) @classmethod def find(cls, params=None): if params is None: <|fim_middle|> response = cls(Api.call('sales/detail_sale', params)) return response.sale @classmethod def list(cls, params=None): if params is None: params = dict() response = cls(Api.call('sales/list_sales', params)) return response.sale_summary def refund(self, params=None): if params is None: params = dict() if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id url = 'sales/refund_lineitem' elif hasattr(self, 'invoice_id'): params['invoice_id'] = self.invoice_id url = 'sales/refund_invoice' else: params['sale_id'] = self.sale_id url = 'sales/refund_invoice' return Sale(Api.call(url, params)) def stop(self, params=None): if params is None: params = dict() if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id return Api.call('sales/stop_lineitem_recurring', params) elif hasattr(self, 'sale_id'): active_lineitems = Util.active(self) if dict(active_lineitems): result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v params = {'lineitem_id': lineitem_id} result[i] = Api.call('sales/stop_lineitem_recurring', params) i += 1 response = { "response_code": "OK", "response_message": str(len(result)) + " lineitems stopped successfully" } else: response = { "response_code": "NOTICE", "response_message": "No active recurring lineitems" } else: response = { "response_code": "NOTICE", "response_message": "This method can only be called on a sale or lineitem" } return Sale(response) def active(self): active_lineitems = Util.active(self) if dict(active_lineitems): result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v result[i] = lineitem_id i += 1 response = { "response_code": "ACTIVE", "response_message": str(len(result)) + " active recurring lineitems" } else: response = { "response_code": "NOTICE","response_message": "No active recurring lineitems" } return Sale(response) def comment(self, params=None): if params is None: params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/create_comment', params)) def ship(self, params=None): if params is None: params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/mark_shipped', params)) <|fim▁end|>
params = dict()
<|file_name|>sale.py<|end_file_name|><|fim▁begin|>from api_request import Api from util import Util from twocheckout import Twocheckout class Sale(Twocheckout): def __init__(self, dict_): super(self.__class__, self).__init__(dict_) @classmethod def find(cls, params=None): if params is None: params = dict() response = cls(Api.call('sales/detail_sale', params)) return response.sale @classmethod def list(cls, params=None): if params is None: <|fim_middle|> response = cls(Api.call('sales/list_sales', params)) return response.sale_summary def refund(self, params=None): if params is None: params = dict() if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id url = 'sales/refund_lineitem' elif hasattr(self, 'invoice_id'): params['invoice_id'] = self.invoice_id url = 'sales/refund_invoice' else: params['sale_id'] = self.sale_id url = 'sales/refund_invoice' return Sale(Api.call(url, params)) def stop(self, params=None): if params is None: params = dict() if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id return Api.call('sales/stop_lineitem_recurring', params) elif hasattr(self, 'sale_id'): active_lineitems = Util.active(self) if dict(active_lineitems): result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v params = {'lineitem_id': lineitem_id} result[i] = Api.call('sales/stop_lineitem_recurring', params) i += 1 response = { "response_code": "OK", "response_message": str(len(result)) + " lineitems stopped successfully" } else: response = { "response_code": "NOTICE", "response_message": "No active recurring lineitems" } else: response = { "response_code": "NOTICE", "response_message": "This method can only be called on a sale or lineitem" } return Sale(response) def active(self): active_lineitems = Util.active(self) if dict(active_lineitems): result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v result[i] = lineitem_id i += 1 response = { "response_code": "ACTIVE", "response_message": str(len(result)) + " active recurring lineitems" } else: response = { "response_code": "NOTICE","response_message": "No active recurring lineitems" } return Sale(response) def comment(self, params=None): if params is None: params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/create_comment', params)) def ship(self, params=None): if params is None: params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/mark_shipped', params)) <|fim▁end|>
params = dict()
<|file_name|>sale.py<|end_file_name|><|fim▁begin|>from api_request import Api from util import Util from twocheckout import Twocheckout class Sale(Twocheckout): def __init__(self, dict_): super(self.__class__, self).__init__(dict_) @classmethod def find(cls, params=None): if params is None: params = dict() response = cls(Api.call('sales/detail_sale', params)) return response.sale @classmethod def list(cls, params=None): if params is None: params = dict() response = cls(Api.call('sales/list_sales', params)) return response.sale_summary def refund(self, params=None): if params is None: <|fim_middle|> if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id url = 'sales/refund_lineitem' elif hasattr(self, 'invoice_id'): params['invoice_id'] = self.invoice_id url = 'sales/refund_invoice' else: params['sale_id'] = self.sale_id url = 'sales/refund_invoice' return Sale(Api.call(url, params)) def stop(self, params=None): if params is None: params = dict() if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id return Api.call('sales/stop_lineitem_recurring', params) elif hasattr(self, 'sale_id'): active_lineitems = Util.active(self) if dict(active_lineitems): result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v params = {'lineitem_id': lineitem_id} result[i] = Api.call('sales/stop_lineitem_recurring', params) i += 1 response = { "response_code": "OK", "response_message": str(len(result)) + " lineitems stopped successfully" } else: response = { "response_code": "NOTICE", "response_message": "No active recurring lineitems" } else: response = { "response_code": "NOTICE", "response_message": "This method can only be called on a sale or lineitem" } return Sale(response) def active(self): active_lineitems = Util.active(self) if dict(active_lineitems): result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v result[i] = lineitem_id i += 1 response = { "response_code": "ACTIVE", "response_message": str(len(result)) + " active recurring lineitems" } else: response = { "response_code": "NOTICE","response_message": "No active recurring lineitems" } return Sale(response) def comment(self, params=None): if params is None: params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/create_comment', params)) def ship(self, params=None): if params is None: params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/mark_shipped', params)) <|fim▁end|>
params = dict()
<|file_name|>sale.py<|end_file_name|><|fim▁begin|>from api_request import Api from util import Util from twocheckout import Twocheckout class Sale(Twocheckout): def __init__(self, dict_): super(self.__class__, self).__init__(dict_) @classmethod def find(cls, params=None): if params is None: params = dict() response = cls(Api.call('sales/detail_sale', params)) return response.sale @classmethod def list(cls, params=None): if params is None: params = dict() response = cls(Api.call('sales/list_sales', params)) return response.sale_summary def refund(self, params=None): if params is None: params = dict() if hasattr(self, 'lineitem_id'): <|fim_middle|> elif hasattr(self, 'invoice_id'): params['invoice_id'] = self.invoice_id url = 'sales/refund_invoice' else: params['sale_id'] = self.sale_id url = 'sales/refund_invoice' return Sale(Api.call(url, params)) def stop(self, params=None): if params is None: params = dict() if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id return Api.call('sales/stop_lineitem_recurring', params) elif hasattr(self, 'sale_id'): active_lineitems = Util.active(self) if dict(active_lineitems): result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v params = {'lineitem_id': lineitem_id} result[i] = Api.call('sales/stop_lineitem_recurring', params) i += 1 response = { "response_code": "OK", "response_message": str(len(result)) + " lineitems stopped successfully" } else: response = { "response_code": "NOTICE", "response_message": "No active recurring lineitems" } else: response = { "response_code": "NOTICE", "response_message": "This method can only be called on a sale or lineitem" } return Sale(response) def active(self): active_lineitems = Util.active(self) if dict(active_lineitems): result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v result[i] = lineitem_id i += 1 response = { "response_code": "ACTIVE", "response_message": str(len(result)) + " active recurring lineitems" } else: response = { "response_code": "NOTICE","response_message": "No active recurring lineitems" } return Sale(response) def comment(self, params=None): if params is None: params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/create_comment', params)) def ship(self, params=None): if params is None: params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/mark_shipped', params)) <|fim▁end|>
params['lineitem_id'] = self.lineitem_id url = 'sales/refund_lineitem'
<|file_name|>sale.py<|end_file_name|><|fim▁begin|>from api_request import Api from util import Util from twocheckout import Twocheckout class Sale(Twocheckout): def __init__(self, dict_): super(self.__class__, self).__init__(dict_) @classmethod def find(cls, params=None): if params is None: params = dict() response = cls(Api.call('sales/detail_sale', params)) return response.sale @classmethod def list(cls, params=None): if params is None: params = dict() response = cls(Api.call('sales/list_sales', params)) return response.sale_summary def refund(self, params=None): if params is None: params = dict() if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id url = 'sales/refund_lineitem' elif hasattr(self, 'invoice_id'): <|fim_middle|> else: params['sale_id'] = self.sale_id url = 'sales/refund_invoice' return Sale(Api.call(url, params)) def stop(self, params=None): if params is None: params = dict() if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id return Api.call('sales/stop_lineitem_recurring', params) elif hasattr(self, 'sale_id'): active_lineitems = Util.active(self) if dict(active_lineitems): result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v params = {'lineitem_id': lineitem_id} result[i] = Api.call('sales/stop_lineitem_recurring', params) i += 1 response = { "response_code": "OK", "response_message": str(len(result)) + " lineitems stopped successfully" } else: response = { "response_code": "NOTICE", "response_message": "No active recurring lineitems" } else: response = { "response_code": "NOTICE", "response_message": "This method can only be called on a sale or lineitem" } return Sale(response) def active(self): active_lineitems = Util.active(self) if dict(active_lineitems): result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v result[i] = lineitem_id i += 1 response = { "response_code": "ACTIVE", "response_message": str(len(result)) + " active recurring lineitems" } else: response = { "response_code": "NOTICE","response_message": "No active recurring lineitems" } return Sale(response) def comment(self, params=None): if params is None: params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/create_comment', params)) def ship(self, params=None): if params is None: params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/mark_shipped', params)) <|fim▁end|>
params['invoice_id'] = self.invoice_id url = 'sales/refund_invoice'
<|file_name|>sale.py<|end_file_name|><|fim▁begin|>from api_request import Api from util import Util from twocheckout import Twocheckout class Sale(Twocheckout): def __init__(self, dict_): super(self.__class__, self).__init__(dict_) @classmethod def find(cls, params=None): if params is None: params = dict() response = cls(Api.call('sales/detail_sale', params)) return response.sale @classmethod def list(cls, params=None): if params is None: params = dict() response = cls(Api.call('sales/list_sales', params)) return response.sale_summary def refund(self, params=None): if params is None: params = dict() if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id url = 'sales/refund_lineitem' elif hasattr(self, 'invoice_id'): params['invoice_id'] = self.invoice_id url = 'sales/refund_invoice' else: <|fim_middle|> return Sale(Api.call(url, params)) def stop(self, params=None): if params is None: params = dict() if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id return Api.call('sales/stop_lineitem_recurring', params) elif hasattr(self, 'sale_id'): active_lineitems = Util.active(self) if dict(active_lineitems): result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v params = {'lineitem_id': lineitem_id} result[i] = Api.call('sales/stop_lineitem_recurring', params) i += 1 response = { "response_code": "OK", "response_message": str(len(result)) + " lineitems stopped successfully" } else: response = { "response_code": "NOTICE", "response_message": "No active recurring lineitems" } else: response = { "response_code": "NOTICE", "response_message": "This method can only be called on a sale or lineitem" } return Sale(response) def active(self): active_lineitems = Util.active(self) if dict(active_lineitems): result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v result[i] = lineitem_id i += 1 response = { "response_code": "ACTIVE", "response_message": str(len(result)) + " active recurring lineitems" } else: response = { "response_code": "NOTICE","response_message": "No active recurring lineitems" } return Sale(response) def comment(self, params=None): if params is None: params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/create_comment', params)) def ship(self, params=None): if params is None: params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/mark_shipped', params)) <|fim▁end|>
params['sale_id'] = self.sale_id url = 'sales/refund_invoice'
<|file_name|>sale.py<|end_file_name|><|fim▁begin|>from api_request import Api from util import Util from twocheckout import Twocheckout class Sale(Twocheckout): def __init__(self, dict_): super(self.__class__, self).__init__(dict_) @classmethod def find(cls, params=None): if params is None: params = dict() response = cls(Api.call('sales/detail_sale', params)) return response.sale @classmethod def list(cls, params=None): if params is None: params = dict() response = cls(Api.call('sales/list_sales', params)) return response.sale_summary def refund(self, params=None): if params is None: params = dict() if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id url = 'sales/refund_lineitem' elif hasattr(self, 'invoice_id'): params['invoice_id'] = self.invoice_id url = 'sales/refund_invoice' else: params['sale_id'] = self.sale_id url = 'sales/refund_invoice' return Sale(Api.call(url, params)) def stop(self, params=None): if params is None: <|fim_middle|> if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id return Api.call('sales/stop_lineitem_recurring', params) elif hasattr(self, 'sale_id'): active_lineitems = Util.active(self) if dict(active_lineitems): result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v params = {'lineitem_id': lineitem_id} result[i] = Api.call('sales/stop_lineitem_recurring', params) i += 1 response = { "response_code": "OK", "response_message": str(len(result)) + " lineitems stopped successfully" } else: response = { "response_code": "NOTICE", "response_message": "No active recurring lineitems" } else: response = { "response_code": "NOTICE", "response_message": "This method can only be called on a sale or lineitem" } return Sale(response) def active(self): active_lineitems = Util.active(self) if dict(active_lineitems): result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v result[i] = lineitem_id i += 1 response = { "response_code": "ACTIVE", "response_message": str(len(result)) + " active recurring lineitems" } else: response = { "response_code": "NOTICE","response_message": "No active recurring lineitems" } return Sale(response) def comment(self, params=None): if params is None: params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/create_comment', params)) def ship(self, params=None): if params is None: params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/mark_shipped', params)) <|fim▁end|>
params = dict()
<|file_name|>sale.py<|end_file_name|><|fim▁begin|>from api_request import Api from util import Util from twocheckout import Twocheckout class Sale(Twocheckout): def __init__(self, dict_): super(self.__class__, self).__init__(dict_) @classmethod def find(cls, params=None): if params is None: params = dict() response = cls(Api.call('sales/detail_sale', params)) return response.sale @classmethod def list(cls, params=None): if params is None: params = dict() response = cls(Api.call('sales/list_sales', params)) return response.sale_summary def refund(self, params=None): if params is None: params = dict() if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id url = 'sales/refund_lineitem' elif hasattr(self, 'invoice_id'): params['invoice_id'] = self.invoice_id url = 'sales/refund_invoice' else: params['sale_id'] = self.sale_id url = 'sales/refund_invoice' return Sale(Api.call(url, params)) def stop(self, params=None): if params is None: params = dict() if hasattr(self, 'lineitem_id'): <|fim_middle|> elif hasattr(self, 'sale_id'): active_lineitems = Util.active(self) if dict(active_lineitems): result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v params = {'lineitem_id': lineitem_id} result[i] = Api.call('sales/stop_lineitem_recurring', params) i += 1 response = { "response_code": "OK", "response_message": str(len(result)) + " lineitems stopped successfully" } else: response = { "response_code": "NOTICE", "response_message": "No active recurring lineitems" } else: response = { "response_code": "NOTICE", "response_message": "This method can only be called on a sale or lineitem" } return Sale(response) def active(self): active_lineitems = Util.active(self) if dict(active_lineitems): result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v result[i] = lineitem_id i += 1 response = { "response_code": "ACTIVE", "response_message": str(len(result)) + " active recurring lineitems" } else: response = { "response_code": "NOTICE","response_message": "No active recurring lineitems" } return Sale(response) def comment(self, params=None): if params is None: params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/create_comment', params)) def ship(self, params=None): if params is None: params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/mark_shipped', params)) <|fim▁end|>
params['lineitem_id'] = self.lineitem_id return Api.call('sales/stop_lineitem_recurring', params)
<|file_name|>sale.py<|end_file_name|><|fim▁begin|>from api_request import Api from util import Util from twocheckout import Twocheckout class Sale(Twocheckout): def __init__(self, dict_): super(self.__class__, self).__init__(dict_) @classmethod def find(cls, params=None): if params is None: params = dict() response = cls(Api.call('sales/detail_sale', params)) return response.sale @classmethod def list(cls, params=None): if params is None: params = dict() response = cls(Api.call('sales/list_sales', params)) return response.sale_summary def refund(self, params=None): if params is None: params = dict() if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id url = 'sales/refund_lineitem' elif hasattr(self, 'invoice_id'): params['invoice_id'] = self.invoice_id url = 'sales/refund_invoice' else: params['sale_id'] = self.sale_id url = 'sales/refund_invoice' return Sale(Api.call(url, params)) def stop(self, params=None): if params is None: params = dict() if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id return Api.call('sales/stop_lineitem_recurring', params) elif hasattr(self, 'sale_id'): <|fim_middle|> else: response = { "response_code": "NOTICE", "response_message": "This method can only be called on a sale or lineitem" } return Sale(response) def active(self): active_lineitems = Util.active(self) if dict(active_lineitems): result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v result[i] = lineitem_id i += 1 response = { "response_code": "ACTIVE", "response_message": str(len(result)) + " active recurring lineitems" } else: response = { "response_code": "NOTICE","response_message": "No active recurring lineitems" } return Sale(response) def comment(self, params=None): if params is None: params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/create_comment', params)) def ship(self, params=None): if params is None: params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/mark_shipped', params)) <|fim▁end|>
active_lineitems = Util.active(self) if dict(active_lineitems): result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v params = {'lineitem_id': lineitem_id} result[i] = Api.call('sales/stop_lineitem_recurring', params) i += 1 response = { "response_code": "OK", "response_message": str(len(result)) + " lineitems stopped successfully" } else: response = { "response_code": "NOTICE", "response_message": "No active recurring lineitems" }
<|file_name|>sale.py<|end_file_name|><|fim▁begin|>from api_request import Api from util import Util from twocheckout import Twocheckout class Sale(Twocheckout): def __init__(self, dict_): super(self.__class__, self).__init__(dict_) @classmethod def find(cls, params=None): if params is None: params = dict() response = cls(Api.call('sales/detail_sale', params)) return response.sale @classmethod def list(cls, params=None): if params is None: params = dict() response = cls(Api.call('sales/list_sales', params)) return response.sale_summary def refund(self, params=None): if params is None: params = dict() if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id url = 'sales/refund_lineitem' elif hasattr(self, 'invoice_id'): params['invoice_id'] = self.invoice_id url = 'sales/refund_invoice' else: params['sale_id'] = self.sale_id url = 'sales/refund_invoice' return Sale(Api.call(url, params)) def stop(self, params=None): if params is None: params = dict() if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id return Api.call('sales/stop_lineitem_recurring', params) elif hasattr(self, 'sale_id'): active_lineitems = Util.active(self) if dict(active_lineitems): <|fim_middle|> else: response = { "response_code": "NOTICE", "response_message": "No active recurring lineitems" } else: response = { "response_code": "NOTICE", "response_message": "This method can only be called on a sale or lineitem" } return Sale(response) def active(self): active_lineitems = Util.active(self) if dict(active_lineitems): result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v result[i] = lineitem_id i += 1 response = { "response_code": "ACTIVE", "response_message": str(len(result)) + " active recurring lineitems" } else: response = { "response_code": "NOTICE","response_message": "No active recurring lineitems" } return Sale(response) def comment(self, params=None): if params is None: params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/create_comment', params)) def ship(self, params=None): if params is None: params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/mark_shipped', params)) <|fim▁end|>
result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v params = {'lineitem_id': lineitem_id} result[i] = Api.call('sales/stop_lineitem_recurring', params) i += 1 response = { "response_code": "OK", "response_message": str(len(result)) + " lineitems stopped successfully" }
<|file_name|>sale.py<|end_file_name|><|fim▁begin|>from api_request import Api from util import Util from twocheckout import Twocheckout class Sale(Twocheckout): def __init__(self, dict_): super(self.__class__, self).__init__(dict_) @classmethod def find(cls, params=None): if params is None: params = dict() response = cls(Api.call('sales/detail_sale', params)) return response.sale @classmethod def list(cls, params=None): if params is None: params = dict() response = cls(Api.call('sales/list_sales', params)) return response.sale_summary def refund(self, params=None): if params is None: params = dict() if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id url = 'sales/refund_lineitem' elif hasattr(self, 'invoice_id'): params['invoice_id'] = self.invoice_id url = 'sales/refund_invoice' else: params['sale_id'] = self.sale_id url = 'sales/refund_invoice' return Sale(Api.call(url, params)) def stop(self, params=None): if params is None: params = dict() if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id return Api.call('sales/stop_lineitem_recurring', params) elif hasattr(self, 'sale_id'): active_lineitems = Util.active(self) if dict(active_lineitems): result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v params = {'lineitem_id': lineitem_id} result[i] = Api.call('sales/stop_lineitem_recurring', params) i += 1 response = { "response_code": "OK", "response_message": str(len(result)) + " lineitems stopped successfully" } else: <|fim_middle|> else: response = { "response_code": "NOTICE", "response_message": "This method can only be called on a sale or lineitem" } return Sale(response) def active(self): active_lineitems = Util.active(self) if dict(active_lineitems): result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v result[i] = lineitem_id i += 1 response = { "response_code": "ACTIVE", "response_message": str(len(result)) + " active recurring lineitems" } else: response = { "response_code": "NOTICE","response_message": "No active recurring lineitems" } return Sale(response) def comment(self, params=None): if params is None: params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/create_comment', params)) def ship(self, params=None): if params is None: params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/mark_shipped', params)) <|fim▁end|>
response = { "response_code": "NOTICE", "response_message": "No active recurring lineitems" }
<|file_name|>sale.py<|end_file_name|><|fim▁begin|>from api_request import Api from util import Util from twocheckout import Twocheckout class Sale(Twocheckout): def __init__(self, dict_): super(self.__class__, self).__init__(dict_) @classmethod def find(cls, params=None): if params is None: params = dict() response = cls(Api.call('sales/detail_sale', params)) return response.sale @classmethod def list(cls, params=None): if params is None: params = dict() response = cls(Api.call('sales/list_sales', params)) return response.sale_summary def refund(self, params=None): if params is None: params = dict() if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id url = 'sales/refund_lineitem' elif hasattr(self, 'invoice_id'): params['invoice_id'] = self.invoice_id url = 'sales/refund_invoice' else: params['sale_id'] = self.sale_id url = 'sales/refund_invoice' return Sale(Api.call(url, params)) def stop(self, params=None): if params is None: params = dict() if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id return Api.call('sales/stop_lineitem_recurring', params) elif hasattr(self, 'sale_id'): active_lineitems = Util.active(self) if dict(active_lineitems): result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v params = {'lineitem_id': lineitem_id} result[i] = Api.call('sales/stop_lineitem_recurring', params) i += 1 response = { "response_code": "OK", "response_message": str(len(result)) + " lineitems stopped successfully" } else: response = { "response_code": "NOTICE", "response_message": "No active recurring lineitems" } else: <|fim_middle|> return Sale(response) def active(self): active_lineitems = Util.active(self) if dict(active_lineitems): result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v result[i] = lineitem_id i += 1 response = { "response_code": "ACTIVE", "response_message": str(len(result)) + " active recurring lineitems" } else: response = { "response_code": "NOTICE","response_message": "No active recurring lineitems" } return Sale(response) def comment(self, params=None): if params is None: params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/create_comment', params)) def ship(self, params=None): if params is None: params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/mark_shipped', params)) <|fim▁end|>
response = { "response_code": "NOTICE", "response_message": "This method can only be called on a sale or lineitem" }
<|file_name|>sale.py<|end_file_name|><|fim▁begin|>from api_request import Api from util import Util from twocheckout import Twocheckout class Sale(Twocheckout): def __init__(self, dict_): super(self.__class__, self).__init__(dict_) @classmethod def find(cls, params=None): if params is None: params = dict() response = cls(Api.call('sales/detail_sale', params)) return response.sale @classmethod def list(cls, params=None): if params is None: params = dict() response = cls(Api.call('sales/list_sales', params)) return response.sale_summary def refund(self, params=None): if params is None: params = dict() if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id url = 'sales/refund_lineitem' elif hasattr(self, 'invoice_id'): params['invoice_id'] = self.invoice_id url = 'sales/refund_invoice' else: params['sale_id'] = self.sale_id url = 'sales/refund_invoice' return Sale(Api.call(url, params)) def stop(self, params=None): if params is None: params = dict() if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id return Api.call('sales/stop_lineitem_recurring', params) elif hasattr(self, 'sale_id'): active_lineitems = Util.active(self) if dict(active_lineitems): result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v params = {'lineitem_id': lineitem_id} result[i] = Api.call('sales/stop_lineitem_recurring', params) i += 1 response = { "response_code": "OK", "response_message": str(len(result)) + " lineitems stopped successfully" } else: response = { "response_code": "NOTICE", "response_message": "No active recurring lineitems" } else: response = { "response_code": "NOTICE", "response_message": "This method can only be called on a sale or lineitem" } return Sale(response) def active(self): active_lineitems = Util.active(self) if dict(active_lineitems): <|fim_middle|> else: response = { "response_code": "NOTICE","response_message": "No active recurring lineitems" } return Sale(response) def comment(self, params=None): if params is None: params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/create_comment', params)) def ship(self, params=None): if params is None: params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/mark_shipped', params)) <|fim▁end|>
result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v result[i] = lineitem_id i += 1 response = { "response_code": "ACTIVE", "response_message": str(len(result)) + " active recurring lineitems" }
<|file_name|>sale.py<|end_file_name|><|fim▁begin|>from api_request import Api from util import Util from twocheckout import Twocheckout class Sale(Twocheckout): def __init__(self, dict_): super(self.__class__, self).__init__(dict_) @classmethod def find(cls, params=None): if params is None: params = dict() response = cls(Api.call('sales/detail_sale', params)) return response.sale @classmethod def list(cls, params=None): if params is None: params = dict() response = cls(Api.call('sales/list_sales', params)) return response.sale_summary def refund(self, params=None): if params is None: params = dict() if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id url = 'sales/refund_lineitem' elif hasattr(self, 'invoice_id'): params['invoice_id'] = self.invoice_id url = 'sales/refund_invoice' else: params['sale_id'] = self.sale_id url = 'sales/refund_invoice' return Sale(Api.call(url, params)) def stop(self, params=None): if params is None: params = dict() if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id return Api.call('sales/stop_lineitem_recurring', params) elif hasattr(self, 'sale_id'): active_lineitems = Util.active(self) if dict(active_lineitems): result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v params = {'lineitem_id': lineitem_id} result[i] = Api.call('sales/stop_lineitem_recurring', params) i += 1 response = { "response_code": "OK", "response_message": str(len(result)) + " lineitems stopped successfully" } else: response = { "response_code": "NOTICE", "response_message": "No active recurring lineitems" } else: response = { "response_code": "NOTICE", "response_message": "This method can only be called on a sale or lineitem" } return Sale(response) def active(self): active_lineitems = Util.active(self) if dict(active_lineitems): result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v result[i] = lineitem_id i += 1 response = { "response_code": "ACTIVE", "response_message": str(len(result)) + " active recurring lineitems" } else: <|fim_middle|> return Sale(response) def comment(self, params=None): if params is None: params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/create_comment', params)) def ship(self, params=None): if params is None: params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/mark_shipped', params)) <|fim▁end|>
response = { "response_code": "NOTICE","response_message": "No active recurring lineitems" }
<|file_name|>sale.py<|end_file_name|><|fim▁begin|>from api_request import Api from util import Util from twocheckout import Twocheckout class Sale(Twocheckout): def __init__(self, dict_): super(self.__class__, self).__init__(dict_) @classmethod def find(cls, params=None): if params is None: params = dict() response = cls(Api.call('sales/detail_sale', params)) return response.sale @classmethod def list(cls, params=None): if params is None: params = dict() response = cls(Api.call('sales/list_sales', params)) return response.sale_summary def refund(self, params=None): if params is None: params = dict() if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id url = 'sales/refund_lineitem' elif hasattr(self, 'invoice_id'): params['invoice_id'] = self.invoice_id url = 'sales/refund_invoice' else: params['sale_id'] = self.sale_id url = 'sales/refund_invoice' return Sale(Api.call(url, params)) def stop(self, params=None): if params is None: params = dict() if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id return Api.call('sales/stop_lineitem_recurring', params) elif hasattr(self, 'sale_id'): active_lineitems = Util.active(self) if dict(active_lineitems): result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v params = {'lineitem_id': lineitem_id} result[i] = Api.call('sales/stop_lineitem_recurring', params) i += 1 response = { "response_code": "OK", "response_message": str(len(result)) + " lineitems stopped successfully" } else: response = { "response_code": "NOTICE", "response_message": "No active recurring lineitems" } else: response = { "response_code": "NOTICE", "response_message": "This method can only be called on a sale or lineitem" } return Sale(response) def active(self): active_lineitems = Util.active(self) if dict(active_lineitems): result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v result[i] = lineitem_id i += 1 response = { "response_code": "ACTIVE", "response_message": str(len(result)) + " active recurring lineitems" } else: response = { "response_code": "NOTICE","response_message": "No active recurring lineitems" } return Sale(response) def comment(self, params=None): if params is None: <|fim_middle|> params['sale_id'] = self.sale_id return Sale(Api.call('sales/create_comment', params)) def ship(self, params=None): if params is None: params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/mark_shipped', params)) <|fim▁end|>
params = dict()
<|file_name|>sale.py<|end_file_name|><|fim▁begin|>from api_request import Api from util import Util from twocheckout import Twocheckout class Sale(Twocheckout): def __init__(self, dict_): super(self.__class__, self).__init__(dict_) @classmethod def find(cls, params=None): if params is None: params = dict() response = cls(Api.call('sales/detail_sale', params)) return response.sale @classmethod def list(cls, params=None): if params is None: params = dict() response = cls(Api.call('sales/list_sales', params)) return response.sale_summary def refund(self, params=None): if params is None: params = dict() if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id url = 'sales/refund_lineitem' elif hasattr(self, 'invoice_id'): params['invoice_id'] = self.invoice_id url = 'sales/refund_invoice' else: params['sale_id'] = self.sale_id url = 'sales/refund_invoice' return Sale(Api.call(url, params)) def stop(self, params=None): if params is None: params = dict() if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id return Api.call('sales/stop_lineitem_recurring', params) elif hasattr(self, 'sale_id'): active_lineitems = Util.active(self) if dict(active_lineitems): result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v params = {'lineitem_id': lineitem_id} result[i] = Api.call('sales/stop_lineitem_recurring', params) i += 1 response = { "response_code": "OK", "response_message": str(len(result)) + " lineitems stopped successfully" } else: response = { "response_code": "NOTICE", "response_message": "No active recurring lineitems" } else: response = { "response_code": "NOTICE", "response_message": "This method can only be called on a sale or lineitem" } return Sale(response) def active(self): active_lineitems = Util.active(self) if dict(active_lineitems): result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v result[i] = lineitem_id i += 1 response = { "response_code": "ACTIVE", "response_message": str(len(result)) + " active recurring lineitems" } else: response = { "response_code": "NOTICE","response_message": "No active recurring lineitems" } return Sale(response) def comment(self, params=None): if params is None: params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/create_comment', params)) def ship(self, params=None): if params is None: <|fim_middle|> params['sale_id'] = self.sale_id return Sale(Api.call('sales/mark_shipped', params)) <|fim▁end|>
params = dict()
<|file_name|>sale.py<|end_file_name|><|fim▁begin|>from api_request import Api from util import Util from twocheckout import Twocheckout class Sale(Twocheckout): def <|fim_middle|>(self, dict_): super(self.__class__, self).__init__(dict_) @classmethod def find(cls, params=None): if params is None: params = dict() response = cls(Api.call('sales/detail_sale', params)) return response.sale @classmethod def list(cls, params=None): if params is None: params = dict() response = cls(Api.call('sales/list_sales', params)) return response.sale_summary def refund(self, params=None): if params is None: params = dict() if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id url = 'sales/refund_lineitem' elif hasattr(self, 'invoice_id'): params['invoice_id'] = self.invoice_id url = 'sales/refund_invoice' else: params['sale_id'] = self.sale_id url = 'sales/refund_invoice' return Sale(Api.call(url, params)) def stop(self, params=None): if params is None: params = dict() if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id return Api.call('sales/stop_lineitem_recurring', params) elif hasattr(self, 'sale_id'): active_lineitems = Util.active(self) if dict(active_lineitems): result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v params = {'lineitem_id': lineitem_id} result[i] = Api.call('sales/stop_lineitem_recurring', params) i += 1 response = { "response_code": "OK", "response_message": str(len(result)) + " lineitems stopped successfully" } else: response = { "response_code": "NOTICE", "response_message": "No active recurring lineitems" } else: response = { "response_code": "NOTICE", "response_message": "This method can only be called on a sale or lineitem" } return Sale(response) def active(self): active_lineitems = Util.active(self) if dict(active_lineitems): result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v result[i] = lineitem_id i += 1 response = { "response_code": "ACTIVE", "response_message": str(len(result)) + " active recurring lineitems" } else: response = { "response_code": "NOTICE","response_message": "No active recurring lineitems" } return Sale(response) def comment(self, params=None): if params is None: params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/create_comment', params)) def ship(self, params=None): if params is None: params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/mark_shipped', params)) <|fim▁end|>
__init__
<|file_name|>sale.py<|end_file_name|><|fim▁begin|>from api_request import Api from util import Util from twocheckout import Twocheckout class Sale(Twocheckout): def __init__(self, dict_): super(self.__class__, self).__init__(dict_) @classmethod def <|fim_middle|>(cls, params=None): if params is None: params = dict() response = cls(Api.call('sales/detail_sale', params)) return response.sale @classmethod def list(cls, params=None): if params is None: params = dict() response = cls(Api.call('sales/list_sales', params)) return response.sale_summary def refund(self, params=None): if params is None: params = dict() if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id url = 'sales/refund_lineitem' elif hasattr(self, 'invoice_id'): params['invoice_id'] = self.invoice_id url = 'sales/refund_invoice' else: params['sale_id'] = self.sale_id url = 'sales/refund_invoice' return Sale(Api.call(url, params)) def stop(self, params=None): if params is None: params = dict() if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id return Api.call('sales/stop_lineitem_recurring', params) elif hasattr(self, 'sale_id'): active_lineitems = Util.active(self) if dict(active_lineitems): result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v params = {'lineitem_id': lineitem_id} result[i] = Api.call('sales/stop_lineitem_recurring', params) i += 1 response = { "response_code": "OK", "response_message": str(len(result)) + " lineitems stopped successfully" } else: response = { "response_code": "NOTICE", "response_message": "No active recurring lineitems" } else: response = { "response_code": "NOTICE", "response_message": "This method can only be called on a sale or lineitem" } return Sale(response) def active(self): active_lineitems = Util.active(self) if dict(active_lineitems): result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v result[i] = lineitem_id i += 1 response = { "response_code": "ACTIVE", "response_message": str(len(result)) + " active recurring lineitems" } else: response = { "response_code": "NOTICE","response_message": "No active recurring lineitems" } return Sale(response) def comment(self, params=None): if params is None: params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/create_comment', params)) def ship(self, params=None): if params is None: params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/mark_shipped', params)) <|fim▁end|>
find
<|file_name|>sale.py<|end_file_name|><|fim▁begin|>from api_request import Api from util import Util from twocheckout import Twocheckout class Sale(Twocheckout): def __init__(self, dict_): super(self.__class__, self).__init__(dict_) @classmethod def find(cls, params=None): if params is None: params = dict() response = cls(Api.call('sales/detail_sale', params)) return response.sale @classmethod def <|fim_middle|>(cls, params=None): if params is None: params = dict() response = cls(Api.call('sales/list_sales', params)) return response.sale_summary def refund(self, params=None): if params is None: params = dict() if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id url = 'sales/refund_lineitem' elif hasattr(self, 'invoice_id'): params['invoice_id'] = self.invoice_id url = 'sales/refund_invoice' else: params['sale_id'] = self.sale_id url = 'sales/refund_invoice' return Sale(Api.call(url, params)) def stop(self, params=None): if params is None: params = dict() if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id return Api.call('sales/stop_lineitem_recurring', params) elif hasattr(self, 'sale_id'): active_lineitems = Util.active(self) if dict(active_lineitems): result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v params = {'lineitem_id': lineitem_id} result[i] = Api.call('sales/stop_lineitem_recurring', params) i += 1 response = { "response_code": "OK", "response_message": str(len(result)) + " lineitems stopped successfully" } else: response = { "response_code": "NOTICE", "response_message": "No active recurring lineitems" } else: response = { "response_code": "NOTICE", "response_message": "This method can only be called on a sale or lineitem" } return Sale(response) def active(self): active_lineitems = Util.active(self) if dict(active_lineitems): result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v result[i] = lineitem_id i += 1 response = { "response_code": "ACTIVE", "response_message": str(len(result)) + " active recurring lineitems" } else: response = { "response_code": "NOTICE","response_message": "No active recurring lineitems" } return Sale(response) def comment(self, params=None): if params is None: params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/create_comment', params)) def ship(self, params=None): if params is None: params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/mark_shipped', params)) <|fim▁end|>
list
<|file_name|>sale.py<|end_file_name|><|fim▁begin|>from api_request import Api from util import Util from twocheckout import Twocheckout class Sale(Twocheckout): def __init__(self, dict_): super(self.__class__, self).__init__(dict_) @classmethod def find(cls, params=None): if params is None: params = dict() response = cls(Api.call('sales/detail_sale', params)) return response.sale @classmethod def list(cls, params=None): if params is None: params = dict() response = cls(Api.call('sales/list_sales', params)) return response.sale_summary def <|fim_middle|>(self, params=None): if params is None: params = dict() if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id url = 'sales/refund_lineitem' elif hasattr(self, 'invoice_id'): params['invoice_id'] = self.invoice_id url = 'sales/refund_invoice' else: params['sale_id'] = self.sale_id url = 'sales/refund_invoice' return Sale(Api.call(url, params)) def stop(self, params=None): if params is None: params = dict() if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id return Api.call('sales/stop_lineitem_recurring', params) elif hasattr(self, 'sale_id'): active_lineitems = Util.active(self) if dict(active_lineitems): result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v params = {'lineitem_id': lineitem_id} result[i] = Api.call('sales/stop_lineitem_recurring', params) i += 1 response = { "response_code": "OK", "response_message": str(len(result)) + " lineitems stopped successfully" } else: response = { "response_code": "NOTICE", "response_message": "No active recurring lineitems" } else: response = { "response_code": "NOTICE", "response_message": "This method can only be called on a sale or lineitem" } return Sale(response) def active(self): active_lineitems = Util.active(self) if dict(active_lineitems): result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v result[i] = lineitem_id i += 1 response = { "response_code": "ACTIVE", "response_message": str(len(result)) + " active recurring lineitems" } else: response = { "response_code": "NOTICE","response_message": "No active recurring lineitems" } return Sale(response) def comment(self, params=None): if params is None: params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/create_comment', params)) def ship(self, params=None): if params is None: params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/mark_shipped', params)) <|fim▁end|>
refund
<|file_name|>sale.py<|end_file_name|><|fim▁begin|>from api_request import Api from util import Util from twocheckout import Twocheckout class Sale(Twocheckout): def __init__(self, dict_): super(self.__class__, self).__init__(dict_) @classmethod def find(cls, params=None): if params is None: params = dict() response = cls(Api.call('sales/detail_sale', params)) return response.sale @classmethod def list(cls, params=None): if params is None: params = dict() response = cls(Api.call('sales/list_sales', params)) return response.sale_summary def refund(self, params=None): if params is None: params = dict() if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id url = 'sales/refund_lineitem' elif hasattr(self, 'invoice_id'): params['invoice_id'] = self.invoice_id url = 'sales/refund_invoice' else: params['sale_id'] = self.sale_id url = 'sales/refund_invoice' return Sale(Api.call(url, params)) def <|fim_middle|>(self, params=None): if params is None: params = dict() if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id return Api.call('sales/stop_lineitem_recurring', params) elif hasattr(self, 'sale_id'): active_lineitems = Util.active(self) if dict(active_lineitems): result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v params = {'lineitem_id': lineitem_id} result[i] = Api.call('sales/stop_lineitem_recurring', params) i += 1 response = { "response_code": "OK", "response_message": str(len(result)) + " lineitems stopped successfully" } else: response = { "response_code": "NOTICE", "response_message": "No active recurring lineitems" } else: response = { "response_code": "NOTICE", "response_message": "This method can only be called on a sale or lineitem" } return Sale(response) def active(self): active_lineitems = Util.active(self) if dict(active_lineitems): result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v result[i] = lineitem_id i += 1 response = { "response_code": "ACTIVE", "response_message": str(len(result)) + " active recurring lineitems" } else: response = { "response_code": "NOTICE","response_message": "No active recurring lineitems" } return Sale(response) def comment(self, params=None): if params is None: params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/create_comment', params)) def ship(self, params=None): if params is None: params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/mark_shipped', params)) <|fim▁end|>
stop
<|file_name|>sale.py<|end_file_name|><|fim▁begin|>from api_request import Api from util import Util from twocheckout import Twocheckout class Sale(Twocheckout): def __init__(self, dict_): super(self.__class__, self).__init__(dict_) @classmethod def find(cls, params=None): if params is None: params = dict() response = cls(Api.call('sales/detail_sale', params)) return response.sale @classmethod def list(cls, params=None): if params is None: params = dict() response = cls(Api.call('sales/list_sales', params)) return response.sale_summary def refund(self, params=None): if params is None: params = dict() if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id url = 'sales/refund_lineitem' elif hasattr(self, 'invoice_id'): params['invoice_id'] = self.invoice_id url = 'sales/refund_invoice' else: params['sale_id'] = self.sale_id url = 'sales/refund_invoice' return Sale(Api.call(url, params)) def stop(self, params=None): if params is None: params = dict() if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id return Api.call('sales/stop_lineitem_recurring', params) elif hasattr(self, 'sale_id'): active_lineitems = Util.active(self) if dict(active_lineitems): result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v params = {'lineitem_id': lineitem_id} result[i] = Api.call('sales/stop_lineitem_recurring', params) i += 1 response = { "response_code": "OK", "response_message": str(len(result)) + " lineitems stopped successfully" } else: response = { "response_code": "NOTICE", "response_message": "No active recurring lineitems" } else: response = { "response_code": "NOTICE", "response_message": "This method can only be called on a sale or lineitem" } return Sale(response) def <|fim_middle|>(self): active_lineitems = Util.active(self) if dict(active_lineitems): result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v result[i] = lineitem_id i += 1 response = { "response_code": "ACTIVE", "response_message": str(len(result)) + " active recurring lineitems" } else: response = { "response_code": "NOTICE","response_message": "No active recurring lineitems" } return Sale(response) def comment(self, params=None): if params is None: params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/create_comment', params)) def ship(self, params=None): if params is None: params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/mark_shipped', params)) <|fim▁end|>
active
<|file_name|>sale.py<|end_file_name|><|fim▁begin|>from api_request import Api from util import Util from twocheckout import Twocheckout class Sale(Twocheckout): def __init__(self, dict_): super(self.__class__, self).__init__(dict_) @classmethod def find(cls, params=None): if params is None: params = dict() response = cls(Api.call('sales/detail_sale', params)) return response.sale @classmethod def list(cls, params=None): if params is None: params = dict() response = cls(Api.call('sales/list_sales', params)) return response.sale_summary def refund(self, params=None): if params is None: params = dict() if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id url = 'sales/refund_lineitem' elif hasattr(self, 'invoice_id'): params['invoice_id'] = self.invoice_id url = 'sales/refund_invoice' else: params['sale_id'] = self.sale_id url = 'sales/refund_invoice' return Sale(Api.call(url, params)) def stop(self, params=None): if params is None: params = dict() if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id return Api.call('sales/stop_lineitem_recurring', params) elif hasattr(self, 'sale_id'): active_lineitems = Util.active(self) if dict(active_lineitems): result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v params = {'lineitem_id': lineitem_id} result[i] = Api.call('sales/stop_lineitem_recurring', params) i += 1 response = { "response_code": "OK", "response_message": str(len(result)) + " lineitems stopped successfully" } else: response = { "response_code": "NOTICE", "response_message": "No active recurring lineitems" } else: response = { "response_code": "NOTICE", "response_message": "This method can only be called on a sale or lineitem" } return Sale(response) def active(self): active_lineitems = Util.active(self) if dict(active_lineitems): result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v result[i] = lineitem_id i += 1 response = { "response_code": "ACTIVE", "response_message": str(len(result)) + " active recurring lineitems" } else: response = { "response_code": "NOTICE","response_message": "No active recurring lineitems" } return Sale(response) def <|fim_middle|>(self, params=None): if params is None: params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/create_comment', params)) def ship(self, params=None): if params is None: params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/mark_shipped', params)) <|fim▁end|>
comment
<|file_name|>sale.py<|end_file_name|><|fim▁begin|>from api_request import Api from util import Util from twocheckout import Twocheckout class Sale(Twocheckout): def __init__(self, dict_): super(self.__class__, self).__init__(dict_) @classmethod def find(cls, params=None): if params is None: params = dict() response = cls(Api.call('sales/detail_sale', params)) return response.sale @classmethod def list(cls, params=None): if params is None: params = dict() response = cls(Api.call('sales/list_sales', params)) return response.sale_summary def refund(self, params=None): if params is None: params = dict() if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id url = 'sales/refund_lineitem' elif hasattr(self, 'invoice_id'): params['invoice_id'] = self.invoice_id url = 'sales/refund_invoice' else: params['sale_id'] = self.sale_id url = 'sales/refund_invoice' return Sale(Api.call(url, params)) def stop(self, params=None): if params is None: params = dict() if hasattr(self, 'lineitem_id'): params['lineitem_id'] = self.lineitem_id return Api.call('sales/stop_lineitem_recurring', params) elif hasattr(self, 'sale_id'): active_lineitems = Util.active(self) if dict(active_lineitems): result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v params = {'lineitem_id': lineitem_id} result[i] = Api.call('sales/stop_lineitem_recurring', params) i += 1 response = { "response_code": "OK", "response_message": str(len(result)) + " lineitems stopped successfully" } else: response = { "response_code": "NOTICE", "response_message": "No active recurring lineitems" } else: response = { "response_code": "NOTICE", "response_message": "This method can only be called on a sale or lineitem" } return Sale(response) def active(self): active_lineitems = Util.active(self) if dict(active_lineitems): result = dict() i = 0 for k, v in active_lineitems.items(): lineitem_id = v result[i] = lineitem_id i += 1 response = { "response_code": "ACTIVE", "response_message": str(len(result)) + " active recurring lineitems" } else: response = { "response_code": "NOTICE","response_message": "No active recurring lineitems" } return Sale(response) def comment(self, params=None): if params is None: params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/create_comment', params)) def <|fim_middle|>(self, params=None): if params is None: params = dict() params['sale_id'] = self.sale_id return Sale(Api.call('sales/mark_shipped', params)) <|fim▁end|>
ship
<|file_name|>urls.py<|end_file_name|><|fim▁begin|>''' Copyright 2015 This file is part of Orbach. Orbach is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Orbach is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Orbach. If not, see <http://www.gnu.org/licenses/>. ''' from django.conf.urls import url, include from rest_framework.routers import DefaultRouter from orbach.core import views router = DefaultRouter() router.register(r'galleries', views.GalleryViewSet) router.register(r'image_files', views.ImageFileViewSet) router.register(r'users', views.UserViewSet) <|fim▁hole|>]<|fim▁end|>
urlpatterns = [ url(r'^', include(router.urls)),
<|file_name|>res_config_settings.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-<|fim▁hole|>from odoo import api, fields, models class ResConfigSettings(models.TransientModel): _inherit = "res.config.settings" google_drive_authorization_code = fields.Char(string='Authorization Code') google_drive_uri = fields.Char(compute='_compute_drive_uri', string='URI', help="The URL to generate the authorization code from Google") @api.depends('google_drive_authorization_code') def _compute_drive_uri(self): google_drive_uri = self.env['google.service']._get_google_token_uri('drive', scope=self.env['google.drive.config'].get_google_scope()) for config in self: config.google_drive_uri = google_drive_uri @api.model def get_values(self): res = super(ResConfigSettings, self).get_values() res.update( google_drive_authorization_code=self.env['ir.config_parameter'].sudo().get_param('google_drive_authorization_code'), ) return res def set_values(self): super(ResConfigSettings, self).set_values() params = self.env['ir.config_parameter'].sudo() authorization_code = self.google_drive_authorization_code refresh_token = False if authorization_code and authorization_code != params.get_param('google_drive_authorization_code'): refresh_token = self.env['google.service'].generate_refresh_token('drive', authorization_code) params.set_param('google_drive_authorization_code', authorization_code) params.set_param('google_drive_refresh_token', refresh_token)<|fim▁end|>
# Part of Odoo. See LICENSE file for full copyright and licensing details.
<|file_name|>res_config_settings.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. from odoo import api, fields, models class ResConfigSettings(models.TransientModel): <|fim_middle|> <|fim▁end|>
_inherit = "res.config.settings" google_drive_authorization_code = fields.Char(string='Authorization Code') google_drive_uri = fields.Char(compute='_compute_drive_uri', string='URI', help="The URL to generate the authorization code from Google") @api.depends('google_drive_authorization_code') def _compute_drive_uri(self): google_drive_uri = self.env['google.service']._get_google_token_uri('drive', scope=self.env['google.drive.config'].get_google_scope()) for config in self: config.google_drive_uri = google_drive_uri @api.model def get_values(self): res = super(ResConfigSettings, self).get_values() res.update( google_drive_authorization_code=self.env['ir.config_parameter'].sudo().get_param('google_drive_authorization_code'), ) return res def set_values(self): super(ResConfigSettings, self).set_values() params = self.env['ir.config_parameter'].sudo() authorization_code = self.google_drive_authorization_code refresh_token = False if authorization_code and authorization_code != params.get_param('google_drive_authorization_code'): refresh_token = self.env['google.service'].generate_refresh_token('drive', authorization_code) params.set_param('google_drive_authorization_code', authorization_code) params.set_param('google_drive_refresh_token', refresh_token)
<|file_name|>res_config_settings.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. from odoo import api, fields, models class ResConfigSettings(models.TransientModel): _inherit = "res.config.settings" google_drive_authorization_code = fields.Char(string='Authorization Code') google_drive_uri = fields.Char(compute='_compute_drive_uri', string='URI', help="The URL to generate the authorization code from Google") @api.depends('google_drive_authorization_code') def _compute_drive_uri(self): <|fim_middle|> @api.model def get_values(self): res = super(ResConfigSettings, self).get_values() res.update( google_drive_authorization_code=self.env['ir.config_parameter'].sudo().get_param('google_drive_authorization_code'), ) return res def set_values(self): super(ResConfigSettings, self).set_values() params = self.env['ir.config_parameter'].sudo() authorization_code = self.google_drive_authorization_code refresh_token = False if authorization_code and authorization_code != params.get_param('google_drive_authorization_code'): refresh_token = self.env['google.service'].generate_refresh_token('drive', authorization_code) params.set_param('google_drive_authorization_code', authorization_code) params.set_param('google_drive_refresh_token', refresh_token) <|fim▁end|>
google_drive_uri = self.env['google.service']._get_google_token_uri('drive', scope=self.env['google.drive.config'].get_google_scope()) for config in self: config.google_drive_uri = google_drive_uri
<|file_name|>res_config_settings.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. from odoo import api, fields, models class ResConfigSettings(models.TransientModel): _inherit = "res.config.settings" google_drive_authorization_code = fields.Char(string='Authorization Code') google_drive_uri = fields.Char(compute='_compute_drive_uri', string='URI', help="The URL to generate the authorization code from Google") @api.depends('google_drive_authorization_code') def _compute_drive_uri(self): google_drive_uri = self.env['google.service']._get_google_token_uri('drive', scope=self.env['google.drive.config'].get_google_scope()) for config in self: config.google_drive_uri = google_drive_uri @api.model def get_values(self): <|fim_middle|> def set_values(self): super(ResConfigSettings, self).set_values() params = self.env['ir.config_parameter'].sudo() authorization_code = self.google_drive_authorization_code refresh_token = False if authorization_code and authorization_code != params.get_param('google_drive_authorization_code'): refresh_token = self.env['google.service'].generate_refresh_token('drive', authorization_code) params.set_param('google_drive_authorization_code', authorization_code) params.set_param('google_drive_refresh_token', refresh_token) <|fim▁end|>
res = super(ResConfigSettings, self).get_values() res.update( google_drive_authorization_code=self.env['ir.config_parameter'].sudo().get_param('google_drive_authorization_code'), ) return res
<|file_name|>res_config_settings.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. from odoo import api, fields, models class ResConfigSettings(models.TransientModel): _inherit = "res.config.settings" google_drive_authorization_code = fields.Char(string='Authorization Code') google_drive_uri = fields.Char(compute='_compute_drive_uri', string='URI', help="The URL to generate the authorization code from Google") @api.depends('google_drive_authorization_code') def _compute_drive_uri(self): google_drive_uri = self.env['google.service']._get_google_token_uri('drive', scope=self.env['google.drive.config'].get_google_scope()) for config in self: config.google_drive_uri = google_drive_uri @api.model def get_values(self): res = super(ResConfigSettings, self).get_values() res.update( google_drive_authorization_code=self.env['ir.config_parameter'].sudo().get_param('google_drive_authorization_code'), ) return res def set_values(self): <|fim_middle|> <|fim▁end|>
super(ResConfigSettings, self).set_values() params = self.env['ir.config_parameter'].sudo() authorization_code = self.google_drive_authorization_code refresh_token = False if authorization_code and authorization_code != params.get_param('google_drive_authorization_code'): refresh_token = self.env['google.service'].generate_refresh_token('drive', authorization_code) params.set_param('google_drive_authorization_code', authorization_code) params.set_param('google_drive_refresh_token', refresh_token)
<|file_name|>res_config_settings.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. from odoo import api, fields, models class ResConfigSettings(models.TransientModel): _inherit = "res.config.settings" google_drive_authorization_code = fields.Char(string='Authorization Code') google_drive_uri = fields.Char(compute='_compute_drive_uri', string='URI', help="The URL to generate the authorization code from Google") @api.depends('google_drive_authorization_code') def _compute_drive_uri(self): google_drive_uri = self.env['google.service']._get_google_token_uri('drive', scope=self.env['google.drive.config'].get_google_scope()) for config in self: config.google_drive_uri = google_drive_uri @api.model def get_values(self): res = super(ResConfigSettings, self).get_values() res.update( google_drive_authorization_code=self.env['ir.config_parameter'].sudo().get_param('google_drive_authorization_code'), ) return res def set_values(self): super(ResConfigSettings, self).set_values() params = self.env['ir.config_parameter'].sudo() authorization_code = self.google_drive_authorization_code refresh_token = False if authorization_code and authorization_code != params.get_param('google_drive_authorization_code'): <|fim_middle|> params.set_param('google_drive_authorization_code', authorization_code) params.set_param('google_drive_refresh_token', refresh_token) <|fim▁end|>
refresh_token = self.env['google.service'].generate_refresh_token('drive', authorization_code)
<|file_name|>res_config_settings.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. from odoo import api, fields, models class ResConfigSettings(models.TransientModel): _inherit = "res.config.settings" google_drive_authorization_code = fields.Char(string='Authorization Code') google_drive_uri = fields.Char(compute='_compute_drive_uri', string='URI', help="The URL to generate the authorization code from Google") @api.depends('google_drive_authorization_code') def <|fim_middle|>(self): google_drive_uri = self.env['google.service']._get_google_token_uri('drive', scope=self.env['google.drive.config'].get_google_scope()) for config in self: config.google_drive_uri = google_drive_uri @api.model def get_values(self): res = super(ResConfigSettings, self).get_values() res.update( google_drive_authorization_code=self.env['ir.config_parameter'].sudo().get_param('google_drive_authorization_code'), ) return res def set_values(self): super(ResConfigSettings, self).set_values() params = self.env['ir.config_parameter'].sudo() authorization_code = self.google_drive_authorization_code refresh_token = False if authorization_code and authorization_code != params.get_param('google_drive_authorization_code'): refresh_token = self.env['google.service'].generate_refresh_token('drive', authorization_code) params.set_param('google_drive_authorization_code', authorization_code) params.set_param('google_drive_refresh_token', refresh_token) <|fim▁end|>
_compute_drive_uri
<|file_name|>res_config_settings.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. from odoo import api, fields, models class ResConfigSettings(models.TransientModel): _inherit = "res.config.settings" google_drive_authorization_code = fields.Char(string='Authorization Code') google_drive_uri = fields.Char(compute='_compute_drive_uri', string='URI', help="The URL to generate the authorization code from Google") @api.depends('google_drive_authorization_code') def _compute_drive_uri(self): google_drive_uri = self.env['google.service']._get_google_token_uri('drive', scope=self.env['google.drive.config'].get_google_scope()) for config in self: config.google_drive_uri = google_drive_uri @api.model def <|fim_middle|>(self): res = super(ResConfigSettings, self).get_values() res.update( google_drive_authorization_code=self.env['ir.config_parameter'].sudo().get_param('google_drive_authorization_code'), ) return res def set_values(self): super(ResConfigSettings, self).set_values() params = self.env['ir.config_parameter'].sudo() authorization_code = self.google_drive_authorization_code refresh_token = False if authorization_code and authorization_code != params.get_param('google_drive_authorization_code'): refresh_token = self.env['google.service'].generate_refresh_token('drive', authorization_code) params.set_param('google_drive_authorization_code', authorization_code) params.set_param('google_drive_refresh_token', refresh_token) <|fim▁end|>
get_values
<|file_name|>res_config_settings.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. from odoo import api, fields, models class ResConfigSettings(models.TransientModel): _inherit = "res.config.settings" google_drive_authorization_code = fields.Char(string='Authorization Code') google_drive_uri = fields.Char(compute='_compute_drive_uri', string='URI', help="The URL to generate the authorization code from Google") @api.depends('google_drive_authorization_code') def _compute_drive_uri(self): google_drive_uri = self.env['google.service']._get_google_token_uri('drive', scope=self.env['google.drive.config'].get_google_scope()) for config in self: config.google_drive_uri = google_drive_uri @api.model def get_values(self): res = super(ResConfigSettings, self).get_values() res.update( google_drive_authorization_code=self.env['ir.config_parameter'].sudo().get_param('google_drive_authorization_code'), ) return res def <|fim_middle|>(self): super(ResConfigSettings, self).set_values() params = self.env['ir.config_parameter'].sudo() authorization_code = self.google_drive_authorization_code refresh_token = False if authorization_code and authorization_code != params.get_param('google_drive_authorization_code'): refresh_token = self.env['google.service'].generate_refresh_token('drive', authorization_code) params.set_param('google_drive_authorization_code', authorization_code) params.set_param('google_drive_refresh_token', refresh_token) <|fim▁end|>
set_values
<|file_name|>compute_user_popularity.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # compute the times of action(rec|click|msg) for each user from math import sqrt def getActionScore(action): if action == "rec": return 0 elif action == "click" : return 1 else: return 2 def compute_interaction(data): interaction = {} for line in data: (userA,userB,times,action) = line.split(' ') <|fim▁hole|> action = action[:-1] key = userB + " " + action interaction.setdefault(key, 0) interaction[key] += 1 return interaction def compute_user_history_interaction(trainFile): records = [] lineList = [] lineNum = 1 result = [] lineList = [line for line in file(trainFile)] for line in lineList: if lineNum == 1: #ignore the title in first line lineNum += 1 continue records.append(line) lineNum += 1 interaction = compute_interaction(records) out = file('user_interaction.txt', 'w') for (key, times) in interaction.items(): out.write('%s %d' % (key, times)) out.write('\n') for (key, times) in interaction.items(): user, action = key.split(' '); result.append((user, action, times)) return result #get the weight for each type of action def get_action_weight(action): pop = 0; if action == "rec": pop = 1 elif action == "click": pop = 10 elif action == "msg": pop = 100 return pop; #trainFile line like: [userA, userB, action_times, action_type(rec|click|msg)] def compute_user_popularity(trainFile, user_popularity_file): popDict = {} rankedscores = [] result = [] print "-----compute_user_history_interaction ... " interaction = compute_user_history_interaction(trainFile) print "-----compute_user_popularity ... " for (user, action, times) in interaction[0:len(interaction)]: popDict.setdefault(user, 0) popDict[user] += get_action_weight(action) * times ranked_popularity = [(popularity, user) for (user, popularity) in popDict.items()] ranked_popularity.sort() ranked_popularity.reverse() print "-----ranking_user_popularity ... " result = [(user, popularity) for (popularity, user) in ranked_popularity[0:len(ranked_popularity)]] print "-----output user_popularity ... " out = file(user_popularity_file, 'w') for (user, popularity) in result[0:len(result)]: out.write('%s %d\n' % (user, popularity)) print "-----Ending ... " return result<|fim▁end|>