Skip to content

Commit 5634ccb

Browse files
committed
Format pythoengine changes.
1 parent 46b1ba1 commit 5634ccb

1 file changed

Lines changed: 18 additions & 16 deletions

File tree

src/runtime/pythonengine.cs

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -407,13 +407,13 @@ public static PyObject ModuleFromString(string name, string code)
407407

408408
public static PyObject Eval(string code, IntPtr? globals = null, IntPtr? locals = null)
409409
{
410-
var result = RunString(code, globals, locals, RunFlagType.Eval);
410+
PyObject result = RunString(code, globals, locals, RunFlagType.Eval);
411411
return result;
412412
}
413413

414414
public static void Exec(string code, IntPtr? globals = null, IntPtr? locals = null)
415415
{
416-
var result = RunString(code, globals, locals, RunFlagType.File);
416+
PyObject result = RunString(code, globals, locals, RunFlagType.File);
417417
if (result.obj != Runtime.PyNone)
418418
{
419419
throw new PythonException();
@@ -483,7 +483,7 @@ public static PyObject RunString(
483483
public enum RunFlagType
484484
{
485485
Single = 256,
486-
File = 257, /* Py_file_input */
486+
File = 257, /* Py_file_input */
487487
Eval = 258
488488
}
489489

@@ -493,11 +493,12 @@ public class PyScope : IDisposable
493493
/// the dict for global variables
494494
/// </summary>
495495
private IntPtr globals;
496+
496497
/// <summary>
497498
/// the dict for local variables
498499
/// </summary>
499500
private IntPtr locals;
500-
501+
501502
public PyScope()
502503
{
503504
globals = Runtime.PyDict_New();
@@ -526,8 +527,8 @@ public PyScope()
526527
/// </remarks>
527528
public PyObject Import(string name)
528529
{
529-
var module = PythonEngine.ImportModule(name);
530-
this.SetGlobal(name, module);
530+
PyObject module = PythonEngine.ImportModule(name);
531+
SetGlobal(name, module);
531532
return module;
532533
}
533534

@@ -542,8 +543,8 @@ public PyObject Eval(string code)
542543
{
543544
var flag = (IntPtr)RunFlagType.Eval;
544545
IntPtr ptr = Runtime.PyRun_String(
545-
code, flag, globals, locals
546-
);
546+
code, flag, globals, locals
547+
);
547548
Py.Throw();
548549
return new PyObject(ptr);
549550
}
@@ -558,8 +559,8 @@ public void ExecIn(string code)
558559
{
559560
var flag = (IntPtr)RunFlagType.File;
560561
IntPtr ptr = Runtime.PyRun_String(
561-
code, flag, globals, locals
562-
);
562+
code, flag, globals, locals
563+
);
563564
Py.Throw();
564565
if (ptr != Runtime.PyNone)
565566
{
@@ -575,7 +576,7 @@ public void ExecIn(string code)
575576
/// </remarks>
576577
public void Exec(string code)
577578
{
578-
var _locals = Runtime.PyDict_New();
579+
IntPtr _locals = Runtime.PyDict_New();
579580
if (_locals == IntPtr.Zero)
580581
{
581582
throw new PythonException();
@@ -587,8 +588,8 @@ public void Exec(string code)
587588
}
588589
var flag = (IntPtr)RunFlagType.File;
589590
IntPtr ptr = Runtime.PyRun_String(
590-
code, flag, globals, _locals
591-
);
591+
code, flag, globals, _locals
592+
);
592593
Py.Throw();
593594
if (ptr != Runtime.PyNone)
594595
{
@@ -601,7 +602,7 @@ public void Exec(string code)
601602
/// SetGlobal Method
602603
/// </summary>
603604
/// <remarks>
604-
/// Add a new variable to global variable dict if it not exists
605+
/// Add a new variable to global variable dict if it not exists
605606
/// or set the value of the global variable if it exists.
606607
/// </remarks>
607608
public void SetGlobal(string name, object value)
@@ -639,7 +640,7 @@ public void DelGlobal(string name)
639640
/// SetLocal Method
640641
/// </summary>
641642
/// <remarks>
642-
/// Add a new variable to local variable dict if it not exists
643+
/// Add a new variable to local variable dict if it not exists
643644
/// or set the value of the local variable if it exists.
644645
/// </remarks>
645646
public void SetLocal(string name, object value)
@@ -683,7 +684,7 @@ public bool Exists(string name)
683684
{
684685
using (var pyKey = new PyString(name))
685686
{
686-
if(Runtime.PyMapping_HasKey(locals, pyKey.obj) != 0)
687+
if (Runtime.PyMapping_HasKey(locals, pyKey.obj) != 0)
687688
{
688689
return true;
689690
}
@@ -792,6 +793,7 @@ public static GILState GIL()
792793

793794
return new GILState();
794795
}
796+
795797
public static PySession Session()
796798
{
797799
if (!PythonEngine.IsInitialized)

0 commit comments

Comments
 (0)