Package name update: erepublik_script → eRepublik
This commit is contained in:
parent
dc106cc87d
commit
de4b059b7d
8
Makefile
8
Makefile
@ -51,7 +51,7 @@ clean-test: ## remove test and coverage artifacts
|
||||
rm -fr .pytest_cache
|
||||
|
||||
lint: ## check style with flake8
|
||||
flake8 erepublik_script tests
|
||||
flake8 erepublik tests
|
||||
|
||||
test: ## run tests quickly with the default Python
|
||||
python setup.py test
|
||||
@ -60,15 +60,15 @@ test-all: ## run tests on every Python version with tox
|
||||
tox
|
||||
|
||||
coverage: ## check code coverage quickly with the default Python
|
||||
coverage run --source erepublik_script setup.py test
|
||||
coverage run --source erepublik setup.py test
|
||||
coverage report -m
|
||||
coverage html
|
||||
$(BROWSER) htmlcov/index.html
|
||||
|
||||
docs: ## generate Sphinx HTML documentation, including API docs
|
||||
rm -f docs/erepublik_script.rst
|
||||
rm -f docs/erepublik.rst
|
||||
rm -f docs/modules.rst
|
||||
sphinx-apidoc -o docs/ erepublik_script
|
||||
sphinx-apidoc -o docs/ erepublik
|
||||
$(MAKE) -C docs clean
|
||||
$(MAKE) -C docs html
|
||||
$(BROWSER) docs/_build/html/index.html
|
||||
|
@ -4,7 +4,7 @@
|
||||
# You can set these variables from the command line.
|
||||
SPHINXOPTS =
|
||||
SPHINXBUILD = python -msphinx
|
||||
SPHINXPROJ = erepublik_script
|
||||
SPHINXPROJ = erepublik
|
||||
SOURCEDIR = .
|
||||
BUILDDIR = _build
|
||||
|
||||
|
16
docs/conf.py
16
docs/conf.py
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# erepublik_script documentation build configuration file, created by
|
||||
# erepublik documentation build configuration file, created by
|
||||
# sphinx-quickstart on Fri Jun 9 13:47:02 2017.
|
||||
#
|
||||
# This file is execfile()d with the current directory set to its
|
||||
@ -22,7 +22,7 @@ import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.abspath('..'))
|
||||
|
||||
import erepublik_script
|
||||
import erepublik
|
||||
|
||||
# -- General configuration ---------------------------------------------
|
||||
|
||||
@ -56,9 +56,9 @@ author = u"Eriks Karls"
|
||||
# the built documents.
|
||||
#
|
||||
# The short X.Y version.
|
||||
version = erepublik_script.__version__
|
||||
version = erepublik.__version__
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = erepublik_script.__version__
|
||||
release = erepublik.__version__
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
@ -128,7 +128,7 @@ latex_elements = {
|
||||
# (source start file, target name, title, author, documentclass
|
||||
# [howto, manual, or own class]).
|
||||
latex_documents = [
|
||||
(master_doc, 'erepublik_script.tex',
|
||||
(master_doc, 'erepublik.tex',
|
||||
u'eRepublik script Documentation',
|
||||
u'Eriks Karls', 'manual'),
|
||||
]
|
||||
@ -139,7 +139,7 @@ latex_documents = [
|
||||
# One entry per manual page. List of tuples
|
||||
# (source start file, name, description, authors, manual section).
|
||||
man_pages = [
|
||||
(master_doc, 'erepublik_script',
|
||||
(master_doc, 'erepublik',
|
||||
u'eRepublik script Documentation',
|
||||
[author], 1)
|
||||
]
|
||||
@ -151,10 +151,10 @@ man_pages = [
|
||||
# (source start file, target name, title, author,
|
||||
# dir menu entry, description, category)
|
||||
texinfo_documents = [
|
||||
(master_doc, 'erepublik_script',
|
||||
(master_doc, 'erepublik',
|
||||
u'eRepublik script Documentation',
|
||||
author,
|
||||
'erepublik_script',
|
||||
'erepublik',
|
||||
'One line description of project.',
|
||||
'Miscellaneous'),
|
||||
]
|
||||
|
@ -12,7 +12,7 @@ To install eRepublik script, run this command in your terminal:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
$ pip install erepublik_script
|
||||
$ pip install erepublik
|
||||
|
||||
This is the preferred method to install eRepublik script, as it will always install the most recent stable release.
|
||||
|
||||
|
@ -4,4 +4,4 @@ Usage
|
||||
|
||||
To use eRepublik script in a project::
|
||||
|
||||
import erepublik_script
|
||||
import erepublik
|
||||
|
@ -6,6 +6,5 @@ __author__ = """Eriks Karls"""
|
||||
__email__ = 'eriks@72.lv'
|
||||
__version__ = '0.14.4'
|
||||
|
||||
from erepublik_script import classes, utils
|
||||
from erepublik_script.citizen import Citizen
|
||||
|
||||
from erepublik import classes, utils
|
||||
from erepublik.citizen import Citizen
|
@ -9,7 +9,7 @@ from typing import Dict, List, Tuple, Any, Union
|
||||
import requests
|
||||
from requests import Response, RequestException
|
||||
|
||||
from erepublik_script import classes, utils
|
||||
from erepublik import classes, utils
|
||||
|
||||
|
||||
class Citizen(classes.CitizenAPI):
|
||||
@ -622,10 +622,8 @@ class Citizen(classes.CitizenAPI):
|
||||
battle_id = r.get("citizen_contribution")[0].get("battle_id", 0)
|
||||
ret_battles.append(battle_id)
|
||||
|
||||
ret_battles += (cs_battles_air + cs_battles_ground +
|
||||
deployed_battles_air + deployed_battles_ground +
|
||||
ally_battles_air + ally_battles_ground +
|
||||
other_battles_air + other_battles_ground)
|
||||
ret_battles += cs_battles_air + cs_battles_ground + deployed_battles_air + deployed_battles_ground + \
|
||||
ally_battles_air + ally_battles_ground + other_battles_air + other_battles_ground
|
||||
return ret_battles
|
||||
|
||||
@property
|
||||
@ -646,8 +644,8 @@ class Citizen(classes.CitizenAPI):
|
||||
if battle.is_rw:
|
||||
side_id = battle.defender.id if self.config.rw_def_side else battle.invader.id
|
||||
else:
|
||||
side_id = battle.defender.id if (self.details.current_country in battle.defender.allies +
|
||||
[battle.defender.id, ]) else battle.invader.id
|
||||
side = self.details.current_country in battle.defender.allies + [battle.defender.id, ]
|
||||
side_id = battle.defender.id if side else battle.invader.id
|
||||
try:
|
||||
def_points = battle.div.get(div).dom_pts.get('def')
|
||||
inv_points = battle.div.get(div).dom_pts.get('inv')
|
||||
@ -1449,11 +1447,12 @@ class Citizen(classes.CitizenAPI):
|
||||
raw = wrm
|
||||
else:
|
||||
continue
|
||||
effective_bonus = cdata["effective_bonus"]
|
||||
base_prod = float(cdata["base_production"])
|
||||
if cdata["is_raw"]:
|
||||
raw += float(cdata["base_production"]) * cdata["effective_bonus"] / 100
|
||||
raw += base_prod * effective_bonus / 100
|
||||
else:
|
||||
raw -= cdata["effective_bonus"] / 100 * cdata["base_production"] * \
|
||||
cdata["upgrades"][str(cdata["quality"])]["raw_usage"]
|
||||
raw -= effective_bonus / 100 * base_prod * cdata["upgrades"][str(cdata["quality"])]["raw_usage"]
|
||||
if cdata["industry_token"] == "FOOD":
|
||||
frm = raw
|
||||
elif cdata["industry_token"] == "WEAPON":
|
@ -11,7 +11,7 @@ from typing import Any, Dict, List, Union
|
||||
from requests import Response, Session
|
||||
from slugify import slugify
|
||||
|
||||
from erepublik_script import utils
|
||||
from erepublik import utils
|
||||
|
||||
|
||||
class ErepublikException(Exception):
|
||||
@ -228,7 +228,7 @@ class SlowRequests(Session):
|
||||
file.write(body.encode("UTF-8"))
|
||||
|
||||
def _log_response(self, url, resp, redirect: bool = False):
|
||||
from erepublik_script import Citizen
|
||||
from erepublik import Citizen
|
||||
if self.debug:
|
||||
if resp.history and not redirect:
|
||||
for hist_resp in resp.history:
|
@ -214,7 +214,7 @@ def write_file(filename: str, content: str) -> int:
|
||||
|
||||
|
||||
def write_request(response: requests.Response, is_error: bool = False):
|
||||
from erepublik_script import Citizen
|
||||
from erepublik import Citizen
|
||||
# Remove GET args from url name
|
||||
url = response.url
|
||||
last_index = url.index("?") if "?" in url else len(response.url)
|
||||
@ -238,7 +238,7 @@ def write_request(response: requests.Response, is_error: bool = False):
|
||||
|
||||
|
||||
def send_email(name, content: list, player=None, local_vars=dict, promo: bool = False, captcha: bool = False):
|
||||
from erepublik_script import Citizen
|
||||
from erepublik import Citizen
|
||||
|
||||
file_content_template = "<html><head><title>{title}</title></head><body>{body}</body></html>"
|
||||
if isinstance(player, Citizen):
|
@ -17,7 +17,7 @@ universal = 1
|
||||
[flake8]
|
||||
exclude = docs
|
||||
max-line-length = 120
|
||||
ignore = E722
|
||||
ignore = E722 F401
|
||||
|
||||
[aliases]
|
||||
|
||||
|
10
setup.py
10
setup.py
@ -28,19 +28,19 @@ setup(
|
||||
'Programming Language :: Python :: 3',
|
||||
'Programming Language :: Python :: 3.7',
|
||||
],
|
||||
description="Python package for eRepublik automated playing",
|
||||
description="Python package for automated eRepublik playing",
|
||||
entry_points={},
|
||||
install_requires=requirements,
|
||||
license="MIT license",
|
||||
long_description=readme + '\n\n' + history,
|
||||
include_package_data=True,
|
||||
keywords='erepublik_script',
|
||||
name='erepublik_script',
|
||||
packages=find_packages(include=['erepublik_script']),
|
||||
keywords='erepublik',
|
||||
name='eRepublik',
|
||||
packages=find_packages(include=['erepublik']),
|
||||
setup_requires=setup_requirements,
|
||||
test_suite='tests',
|
||||
tests_require=test_requirements,
|
||||
url='https://github.com/eeriks/erepublik_script',
|
||||
url='https://github.com/eeriks/erepublik',
|
||||
version='0.14.4',
|
||||
zip_safe=False,
|
||||
)
|
||||
|
@ -1,3 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""Unit test package for erepublik_script."""
|
||||
"""Unit test package for erepublik."""
|
||||
|
@ -1,18 +1,18 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""Tests for `erepublik_script` package."""
|
||||
"""Tests for `erepublik` package."""
|
||||
|
||||
|
||||
import unittest
|
||||
from click.testing import CliRunner
|
||||
|
||||
from erepublik_script import Citizen
|
||||
from erepublik_script import cli
|
||||
from erepublik import Citizen
|
||||
from erepublik import cli
|
||||
|
||||
|
||||
class TestErepublik_script(unittest.TestCase):
|
||||
"""Tests for `erepublik_script` package."""
|
||||
"""Tests for `erepublik` package."""
|
||||
|
||||
def setUp(self):
|
||||
"""Set up test fixtures, if any."""
|
||||
@ -28,7 +28,7 @@ class TestErepublik_script(unittest.TestCase):
|
||||
runner = CliRunner()
|
||||
result = runner.invoke(cli.main)
|
||||
assert result.exit_code == 0
|
||||
assert 'erepublik_script.cli.main' in result.output
|
||||
assert 'erepublik.cli.main' in result.output
|
||||
help_result = runner.invoke(cli.main, ['--help'])
|
||||
assert help_result.exit_code == 0
|
||||
assert '--help Show this message and exit.' in help_result.output
|
||||
|
Loading…
x
Reference in New Issue
Block a user