Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Python2 print commands left in comments and docs #2128

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions Pythonwin/pywin/Demos/fontdemo.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,12 @@ def FontDemo():
template = docview.DocTemplate(win32ui.IDR_PYTHONTYPE, None, None, FontView)
doc = template.OpenDocumentFile(None)
doc.SetTitle("Font Demo")
# print "template is ", template, "obj is", template._obj_
# print("template is ", template, "obj is", template._obj_)
template.close()
# print("closed")
# del template


# print "closed"
# del template

if __name__ == "__main__":
import demoutils

Expand Down
2 changes: 1 addition & 1 deletion Pythonwin/pywin/Demos/ocx/webbrowser.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def OnBeforeNavigate2(
self, pDisp, URL, Flags, TargetFrameName, PostData, Headers, Cancel
):
self.GetParent().OnNavigate(URL)
# print "BeforeNavigate2", pDisp, URL, Flags, TargetFrameName, PostData, Headers, Cancel
# print("BeforeNavigate2", pDisp, URL, Flags, TargetFrameName, PostData, Headers, Cancel)


class BrowserFrame(window.MDIChildWnd):
Expand Down
4 changes: 2 additions & 2 deletions Pythonwin/pywin/Demos/splittst.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ def __init__(self):
)

def InitialUpdateFrame(self, frame, doc, makeVisible):
# print "frame is ", frame, frame._obj_
# print "doc is ", doc, doc._obj_
# print("frame is ", frame, frame._obj_)
# print("doc is ", doc, doc._obj_)
self._obj_.InitialUpdateFrame(frame, doc, makeVisible) # call default handler.
frame.InitialUpdateFrame(doc, makeVisible)

Expand Down
2 changes: 1 addition & 1 deletion Pythonwin/pywin/Demos/threadedgui.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def OnTimer(self, id, timeVal):
self.InvalidateRect()

def OnPaint(self):
# print "Paint message from thread", win32api.GetCurrentThreadId()
# print("Paint message from thread", win32api.GetCurrentThreadId())
dc, paintStruct = self.BeginPaint()
self.OnPrepareDC(dc, None)

Expand Down
6 changes: 3 additions & 3 deletions Pythonwin/pywin/debugger/debugger.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,11 @@ def __init__(self, debugger):
HierListItem.__init__(self, debugger, None)
self.last_stack = []

## def __del__(self):
## print "HierStackRoot dieing"
# def __del__(self):
# print("HierStackRoot dieing")
def GetSubList(self):
debugger = self.myobject
# print self.debugger.stack, self.debugger.curframe
# print(self.debugger.stack, self.debugger.curframe)
ret = []
if debugger.debuggerState == DBGSTATE_BREAK:
stackUse = debugger.stack[:]
Expand Down
2 changes: 1 addition & 1 deletion Pythonwin/pywin/framework/editor/ModuleBrowser.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def DestroyBrowser(self):
self.DestroyList()

def OnActivateView(self, activate, av, dv):
# print "AV", self.bDirty, activate
# print("AV", self.bDirty, activate)
if activate:
self.CheckRefreshList()
return self._obj_.OnActivateView(activate, av, dv)
Expand Down
2 changes: 1 addition & 1 deletion Pythonwin/pywin/framework/editor/color/coloreditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ def FoldTopLevelEvent(self, event=None):
- scintillacon.SC_FOLDLEVELBASE
)
is_header = level & scintillacon.SC_FOLDLEVELHEADERFLAG
# print lineSeek, level_no, is_header
# print(lineSeek, level_no, is_header)
if level_no == 0 and is_header:
if (expanding and not self.SCIGetFoldExpanded(lineSeek)) or (
not expanding and self.SCIGetFoldExpanded(lineSeek)
Expand Down
2 changes: 1 addition & 1 deletion Pythonwin/pywin/framework/editor/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ def Indent(self):
else:
curCol = curCol + 1
nextColumn = ((curCol / self.indentSize) + 1) * self.indentSize
# print "curCol is", curCol, "nextColumn is", nextColumn
# print("curCol is", curCol, "nextColumn is", nextColumn)
ins = None
if self.bSmartTabs:
# Look for some context.
Expand Down
22 changes: 11 additions & 11 deletions Pythonwin/pywin/framework/editor/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ def OnCreateClient(self, cp, context):
splitter.CreateView(browserView, 0, 0, (0, 0))
sub_splitter.CreateView(view2, 0, 0, (0, 0))

## print "First view is", context.doc.GetFirstView()
## print "Views are", view, view2, browserView
## print "Parents are", view.GetParent(), view2.GetParent(), browserView.GetParent()
## print "Splitter is", splitter
## print "sub splitter is", sub_splitter
## Old
## splitter.CreateStatic (self, 1, 2)
## splitter.CreateView(view, 0, 1, (0,0)) # size ignored.
## splitter.CreateView (browserView, 0, 0, (0, 0))
# print("First view is", context.doc.GetFirstView())
# print("Views are", view, view2, browserView)
# print("Parents are", view.GetParent(), view2.GetParent(), browserView.GetParent())
# print("Splitter is", splitter)
# print("sub splitter is", sub_splitter)
# Old
# splitter.CreateStatic (self, 1, 2)
# splitter.CreateView(view, 0, 1, (0,0)) # size ignored.
# splitter.CreateView (browserView, 0, 0, (0, 0))

# Restrict the size of the browser splitter (and we can avoid filling
# it until it is shown)
Expand Down Expand Up @@ -62,8 +62,8 @@ def GetBrowserView(self):
def OnClose(self):
doc = self.GetActiveDocument()
if not doc.SaveModified():
## Cancel button selected from Save dialog, do not actually close
## print 'close cancelled'
# Cancel button selected from Save dialog, do not actually close
# print("close cancelled")
return 0
## So the 'Save' dialog doesn't come up twice
doc._obj_.SetModifiedFlag(False)
Expand Down
6 changes: 3 additions & 3 deletions Pythonwin/pywin/framework/editor/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ def OpenDocumentFile(self, filename, bMakeVisible=1):
if filename is not None:
try:
path = os.path.split(filename)[0]
# print "The editor is translating", `filename`,"to",
# print("The editor is translating", "filename", "to")
filename = win32api.FindFiles(filename)[0][8]
filename = os.path.join(path, filename)
# print `filename`
# print("filename")
except (win32api.error, IndexError) as details:
# print("Couldnt get the full filename!", details)
pass
# print "Couldnt get the full filename!", details
return self._obj_.OpenDocumentFile(filename, bMakeVisible)
2 changes: 1 addition & 1 deletion Pythonwin/pywin/framework/intpydde.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def __init__(self, app):

def Exec(self, data):
try:
# print "Executing", cmd
# print("Executing", cmd)
self.app.OnDDECommand(data)
except:
t, v, tb = sys.exc_info()
Expand Down
4 changes: 2 additions & 2 deletions Pythonwin/pywin/framework/mdi_pychecker.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,10 +431,10 @@ def GetParams(self):
)

def OnSaveDocument(self, filename):
# print 'OnSaveDocument() filename=',filename
# print("OnSaveDocument() filename=",filename)
savefile = open(filename, "wb")
txt = self.GetParams() + "\n"
# print 'writing',txt
# print("writing",txt)
savefile.write(txt)
savefile.close()
self.SetModifiedFlag(0)
Expand Down
4 changes: 2 additions & 2 deletions Pythonwin/pywin/framework/sgrepmdi.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,10 +344,10 @@ def GetParams(self):
)

def OnSaveDocument(self, filename):
# print 'OnSaveDocument() filename=',filename
# print("OnSaveDocument() filename=", filename)
savefile = open(filename, "wb")
txt = self.GetParams() + "\n"
# print 'writing',txt
# print("writing", txt)
savefile.write(txt)
savefile.close()
self.SetModifiedFlag(0)
Expand Down
4 changes: 2 additions & 2 deletions Pythonwin/pywin/framework/toolmenu.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def OnOK(self):
return self._obj_.OnOK()

def OnCommandEditControls(self, id, cmd):
# print "OnEditControls", id, cmd
# print("OnEditControls", id, cmd)
if cmd == win32con.EN_CHANGE and not self.bImChangingEditControls:
itemNo = self.listControl.GetNextItem(-1, commctrl.LVNI_SELECTED)
newText = self.editMenuCommand.GetWindowText()
Expand All @@ -228,7 +228,7 @@ def OnNotifyListControlEndLabelEdit(self, id, cmd):
self.listControl.SetItemText(itemNo, 0, newText)

def OnNotifyListControl(self, id, cmd):
# print id, cmd
# print(id, cmd)
try:
itemNo = self.listControl.GetNextItem(-1, commctrl.LVNI_SELECTED)
except win32ui.error: # No selection!
Expand Down
2 changes: 1 addition & 1 deletion Pythonwin/pywin/mfc/object.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def __getattr__(
raise AttributeError(attr)

def OnAttachedObjectDeath(self):
# print "object", self.__class__.__name__, "dieing"
# print("object", self.__class__.__name__, "dieing")
self._obj_ = None

def close(self):
Expand Down
2 changes: 1 addition & 1 deletion Pythonwin/pywin/scintilla/IDLEenvironment.py
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ def test():
TestCheck("2.0", e, 13)
try:
TestCheck("sel.first", e, 0)
print "*** sel.first worked with an empty selection"
print("*** sel.first worked with an empty selection")
except TextError:
pass
e.SetSel((4,5))
Expand Down
2 changes: 1 addition & 1 deletion Pythonwin/pywin/scintilla/configui.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ def UpdateUIForStyle(self, style):
sel = 0
for c in paletteVGA:
if format[4] == c[1]:
# print "Style", style.name, "is", c[0]
# print("Style", style.name, "is", c[0])
break
sel = sel + 1
else:
Expand Down
2 changes: 1 addition & 1 deletion Pythonwin/pywin/scintilla/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def DeleteContents(self):

def OnOpenDocument(self, filename):
# init data members
# print "Opening", filename
# print("Opening", filename)
self.SetPathName(filename) # Must set this early!
try:
# load the text as binary we can get smart
Expand Down
13 changes: 11 additions & 2 deletions Pythonwin/pywin/scintilla/formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def _ReformatStyle(self, style):
return

assert style.stylenum is not None, "Unregistered style."
# print "Reformat style", style.name, style.stylenum
# print("Reformat style", style.name, style.stylenum)
scintilla = self.scintilla
stylenum = style.stylenum
# Now we have the style number, indirect for the actual style.
Expand Down Expand Up @@ -252,7 +252,16 @@ def OnStyleNeeded(self, std, extra):
endStyledChar = self.scintilla.SendScintilla(scintillacon.SCI_GETENDSTYLED)
lineEndStyled = self.scintilla.LineFromChar(endStyledChar)
endStyled = self.scintilla.LineIndex(lineEndStyled)
# print "enPosPaint %d endStyledChar %d lineEndStyled %d endStyled %d" % (endPosPaint, endStyledChar, lineEndStyled, endStyled)
# print(
# "endPosPaint",
# endPosPaint,
# "endStyledChar",
# endStyledChar,
# "lineEndStyled",
# lineEndStyled,
# "endStyled",
# endStyled,
# )
self.Colorize(endStyled, notify.position)

def ColorSeg(self, start, end, styleName):
Expand Down
13 changes: 11 additions & 2 deletions Pythonwin/pywin/scintilla/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,16 @@ def _GetWordSplit(self, pos=-1, bAllowCalls=0):
return "".join(before), "".join(after)

def OnPrepareDC(self, dc, pInfo):
# print "OnPrepareDC for page", pInfo.GetCurPage(), "of", pInfo.GetFromPage(), "to", pInfo.GetToPage(), ", starts=", self.starts
# print(
# "OnPrepareDC for page",
# pInfo.GetCurPage(),
# "of",
# pInfo.GetFromPage(),
# "to",
# pInfo.GetToPage(),
# ", starts=",
# self.starts,
# )
if dc.IsPrinting():
# Check if we are beyond the end.
# (only do this when actually printing, else messes up print preview!)
Expand Down Expand Up @@ -778,7 +787,7 @@ def FormatRange(self, dc, pageStart, lengthDoc, rc, draw):

def OnPrint(self, dc, pInfo):
metrics = dc.GetTextMetrics()
# print "dev", w, h, l, metrics['tmAscent'], metrics['tmDescent']
# print("dev", w, h, l, metrics["tmAscent"], metrics["tmDescent"])
if self.starts is None:
self.CalculatePageRanges(dc, pInfo)
pageNum = pInfo.GetCurPage() - 1
Expand Down
8 changes: 4 additions & 4 deletions Pythonwin/pywin/tools/hierlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,9 @@ def Refresh(self, hparent=None):
inewlook = inewlook + 1
if matched:
# Insert the new items.
# print "Inserting after", old_items[iold], old_handles[iold]
# print("Inserting after", old_items[iold], old_handles[iold])
for i in range(inew, inewlook):
# print "Inserting index %d (%s)" % (i, new_items[i])
# print(f"Inserting index {i} ({new_items[i]})")
hAfter = self.AddItem(hparent, new_items[i], hAfter)

inew = inewlook + 1
Expand All @@ -233,7 +233,7 @@ def Refresh(self, hparent=None):
self.Refresh(hold)
else:
# Remove the deleted items.
# print "Deleting %d (%s)" % (iold, old_items[iold])
# print(f"Deleting {iold} ({old_items[iold]})")
hdelete = old_handles[iold]
# First recurse and remove the children from the map.
for hchild in self._GetChildHandles(hdelete):
Expand All @@ -244,7 +244,7 @@ def Refresh(self, hparent=None):
hAfter = old_handles[iold]
# Fill any remaining new items:
for newItem in new_items[inew:]:
# print "Inserting new item", newItem
# print("Inserting new item", newItem)
self.AddItem(hparent, newItem)

def AcceptRoot(self, root):
Expand Down
4 changes: 2 additions & 2 deletions Pythonwin/pywin/tools/regedit.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,9 @@ def SelectedItem(self):
def SearchSelectedItem(self):
handle = self.hierList.GetChildItem(0)
while 1:
# print "State is", self.hierList.GetItemState(handle, -1)
# print("State is", self.hierList.GetItemState(handle, -1))
if self.hierList.GetItemState(handle, commctrl.TVIS_SELECTED):
# print "Item is ", self.hierList.ItemFromHandle(handle)
# print("Item is ", self.hierList.ItemFromHandle(handle))
return self.hierList.ItemFromHandle(handle)
handle = self.hierList.GetNextSiblingItem(handle)

Expand Down
2 changes: 1 addition & 1 deletion Pythonwin/win32util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -933,7 +933,7 @@ BOOL ParseCharFormatTuple(PyObject *args, CHARFORMAT *pFmt)
// @tupleitem 6|int|bPitchAndFamily|The charset. See the LOGFONT structure for details.
// @tupleitem 7|string|faceName|The font name.

// @comm Executing d=win32ui.CreateFontDialog(); d.DoModal(); print d.GetCharFormat()
// @comm Executing d=win32ui.CreateFontDialog(); d.DoModal(); print(d.GetCharFormat())
// will print a valid CHARFORMAT tuple.
}

Expand Down
2 changes: 1 addition & 1 deletion SWIG/swig_lib/timers.i
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ performance. To use a timer, simply use code like this :
timer_start(0)
... a bunch of Python code ...
timer_stop(0)
print timer_elapsed(0)," seconds of CPU time"
print(timer_elapsed(0), " seconds of CPU time")
%}
#endif

Expand Down
8 changes: 4 additions & 4 deletions adodbapi/quick_reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -643,22 +643,22 @@ This is the PEP standard method:
row = crsr.fetchone()
while row:
value = row[1] * row[2]
print('Your {:10s} is worth {:10.2f}'.format(row[0], value))
print("Your {:10s} is worth {:10.2f}".format(row[0], value))
row = crsr.fetchone() # returns None when no data remains

As an extension, a Row object can also be indexed by column name:

crsr.execute("SELECT prodname, price, qtyonhand FROM cheese")
for row in crsr: # note extension: using crsr as an iterator
value = row['price'] * row['qtyonhand']
print('Your {:10s} is worth {:10.2f}'.format(row['prodname'], value))
value = row["price"] * row["qtyonhand"]
print("Your {:10s} is worth {:10.2f}".format(row["prodname"], value))

But, _really_ lazy programmers, like me, use the column names as attributes:

crsr.execute("SELECT prodname, price, qtyonhand FROM cheese")
for row in crsr:
value = row.price * row.qtyonhand
print('Your {:10s} is worth {:10.2f}'.format(row.prodname, value))
print("Your {:10s} is worth {:10.2f}".format(row.prodname, value))

Now, isn't that easier to read and understand?

Expand Down
Loading