Skip to content

Commit

Permalink
Fixing assorted cython obstacles
Browse files Browse the repository at this point in the history
  • Loading branch information
kfsone committed Jan 6, 2015
1 parent 65a3fad commit d48e376
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 26 deletions.
23 changes: 8 additions & 15 deletions TradeDangerous.pyproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<LaunchProvider>Standard Python launcher</LaunchProvider>
<InterpreterId />
<InterpreterVersion />
<CommandLineArguments>run -vv --ly 10.38 --empty 11.16 --cap 18 --jumps 6 --cr 131366 --from "aritimi" -s 3</CommandLineArguments>
<CommandLineArguments>buildcache -f -i</CommandLineArguments>
<EnableNativeCodeDebugging>False</EnableNativeCodeDebugging>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Debug'" />
Expand All @@ -32,23 +32,26 @@
<Compile Include="commands\import_cmd.py" />
<Compile Include="commands\local_cmd.py" />
<Compile Include="commands\nav_cmd.py" />
<Compile Include="commands\olddata_cmd.py" />
<Compile Include="commands\parsing.py" />
<Compile Include="commands\rares_cmd.py" />
<Compile Include="commands\run_cmd.py" />
<Compile Include="commands\sell_cmd.py" />
<Compile Include="commands\station_cmd.py" />
<Compile Include="commands\test_commands.py" />
<Compile Include="commands\update_cmd.py" />
<Compile Include="commands\update_gui.py" />
<Compile Include="commands\__init__.py" />
<Compile Include="corrections.py" />
<Compile Include="csvexport.py" />
<Compile Include="formatting.py" />
<Compile Include="mfd\saitek\directoutput.py" />
<Compile Include="mfd\saitek\x52pro.py" />
<Compile Include="mfd\saitek\__init__.py" />
<Compile Include="mfd\__init__.py" />
<Compile Include="misc\coord64.py" />
<Compile Include="misc\diff-system-csvs.py" />
<Compile Include="misc\edstarquery.py" />
<Compile Include="mkstats.py" />
<Compile Include="plugins\maddavo_plug.py" />
<Compile Include="plugins\__init__.py" />
<Compile Include="prices.py" />
<Compile Include="pygui.py" />
<Compile Include="trade.py" />
Expand All @@ -57,7 +60,6 @@
<Compile Include="tradeenv.py" />
<Compile Include="tradeexcept.py" />
<Compile Include="trading.py" />
<Compile Include="xfer.py" />
</ItemGroup>
<ItemGroup>
<Content Include="CHANGES.txt" />
Expand All @@ -71,22 +73,13 @@
<Content Include="data\System.csv" />
<Content Include="data\TradeDangerous.sql" />
<Content Include="README.txt" />
<Content Include="scripts\config.sh" />
<Content Include="scripts\README.txt" />
<Content Include="scripts\tdbuyfrom" />
<Content Include="scripts\tdimad" />
<Content Include="scripts\tdloc" />
<Content Include="scripts\tdnav" />
<Content Include="scripts\tdrun" />
<Content Include="scripts\tdupd" />
</ItemGroup>
<ItemGroup>
<Folder Include="commands" />
<Folder Include="data" />
<Folder Include="mfd" />
<Folder Include="mfd\saitek" />
<Folder Include="misc" />
<Folder Include="scripts" />
<Folder Include="plugins\" />
</ItemGroup>
<Import Project="$(PtvsTargetsFile)" Condition="Exists($(PtvsTargetsFile))" />
<Import Project="$(MSBuildToolsPath)\Microsoft.Common.targets" Condition="!Exists($(PtvsTargetsFile))" />
Expand Down
9 changes: 6 additions & 3 deletions commands/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import pathlib
import sys

import commands.exceptions
import commands.parsing
import commands.exceptions as exceptions
import commands.parsing as parsing

import commands.buildcache_cmd
import commands.buy_cmd
Expand Down Expand Up @@ -38,7 +38,10 @@ class HelpAction(argparse.Action):
because Python 3.4's argparse is ever-so subtly very broken.
"""
def __call__(self, parser, namespace, values, option_string=None):
raise exceptions.UsageError("TradeDangerous help", parser.format_help())
raise exceptions.UsageError(
"TradeDangerous help",
parser.format_help()
)


def addArguments(group, options, required, topGroup=None):
Expand Down
5 changes: 2 additions & 3 deletions commands/export_cmd.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import absolute_import, with_statement, print_function, division, unicode_literals

from csvexport import exportTableToFile
from commands.parsing import MutuallyExclusiveGroup, ParseArgument
from commands.exceptions import CommandLineError
from pathlib import Path
Expand Down Expand Up @@ -64,11 +65,9 @@
# Perform query and populate result set

def run(results, cmdenv, tdb):
from csvexport import exportTableToFile

# check database exists
if not tdb.dbPath.is_file():
raise CommandLineError("Database '{}' not found.".format(dbFilename))
raise CommandLineError("Database '{}' not found.".format(tdb.dbPath))

# check export path exists
if cmdenv.path:
Expand Down
6 changes: 3 additions & 3 deletions commands/run_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def note(self, str, addBreak=True):
print("(i) {} (i){}".format(str, "\n" if addBreak else ""))


def run(self, route, credits):
def run(self, route, cr):
tdb, mfd = self.tdb, self.mfd
stations, hops, jumps = route.route, route.hops, route.jumps
lastHopIdx = len(stations) - 1
Expand Down Expand Up @@ -207,15 +207,15 @@ def run(self, route, credits):
gainCr += hop[1]
if cmdenv.detail and gainCr > 0:
self.note("GAINED: {:n}cr, CREDITS: {:n}cr".format(
gainCr, credits + gainCr))
gainCr, cr + gainCr))

if hopNo < lastHopIdx:
print("\n--------------------------------------\n")

if mfd:
mfd.display('FINISHED',
"+{:n}cr".format(gainCr),
"={:n}cr".format(credits + gainCr))
"={:n}cr".format(cr + gainCr))
mfd.attention(3)
from time import sleep
sleep(1.5)
Expand Down
1 change: 1 addition & 0 deletions tradedb.py
Original file line number Diff line number Diff line change
Expand Up @@ -1395,6 +1395,7 @@ def loadDirectTrades(self, fromStation, toStation):
self.cur.execute(stmt, [ fromStation.ID, toStation.ID ])

trading = []
items = self.itemByID
for (
itemID,
srcPriceCr, profit,
Expand Down
2 changes: 0 additions & 2 deletions tradeexcept.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import absolute_import, with_statement, print_function, division, unicode_literals

class TradeException(Exception):
"""
Distinguishes runtime logical errors (such as no data for what you
Expand Down

0 comments on commit d48e376

Please sign in to comment.