Skip to content

Commit

Permalink
get working again; do not show file extension
Browse files Browse the repository at this point in the history
  • Loading branch information
interrogator committed Mar 21, 2020
1 parent 4c99b50 commit 5f6bda6
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 25 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
*.feather

do-the-right-thing-norm.txt
unparsed.txt
dist/
Expand Down
2 changes: 0 additions & 2 deletions explorer/parts/chart.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import numpy as np
import plotly.express as px
import plotly.figure_factory as ff
import plotly.graph_objects as go

Expand Down
2 changes: 2 additions & 0 deletions explorer/parts/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ def _update_conll(df, deletable, drop_govs):
df = _drop_cols_for_datatable(df, drop_govs)
col_order = ["file", "s", "i"] + list(df.columns)
df = df.reset_index()
# do not show file extension
df["file"] = df["file"].str.replace(".txt.conll", "", regex=False)
df = df[[i for i in col_order if i is not None]]
cannot_delete = {"s", "i"}
columns = [
Expand Down
1 change: 0 additions & 1 deletion explorer/parts/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from .configure import configure_buzzword
from .helpers import (_get_corpora_meta, _get_corpus, _get_initial_table,
_preprocess_corpus, register_callbacks)
from .strings import _slug_from_name
from .tabs import make_explore_page

app = DjangoDash("buzzword", suppress_callback_exceptions=True)
Expand Down
4 changes: 3 additions & 1 deletion explorer/parts/tabs.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ def _build_dataset_space(df, config):
cols = extra + cols
df = _drop_cols_for_datatable(df, config["add_governor"])
df = df.reset_index()
# no file extensions
df["file"] = df["file"].str.replace(".txt.conll", "", regex=False)
max_row, max_col = config["table_size"]
df = df.iloc[:max_row, :max_col]
pieces = [
Expand Down Expand Up @@ -85,7 +87,7 @@ def _build_dataset_space(df, config):
id="input-box",
type="text",
placeholder="Enter regular expression search query...",
size="80",
size="60",
style=style.MARGIN_5_MONO,
),
dcc.Dropdown(
Expand Down
12 changes: 6 additions & 6 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
django==3.0.3
django==3.0.4
#django-guardian==2.1.0
git+git://github.com/l0rb/django-guardian@devel#egg=django-guardian
django-plotly-dash==1.1.3
django-plotly-dash==1.1.5
dpd-static-support==0.0.4
dash_bootstrap_components==0.7.2
whitenoise==4.1.4
buzz>=3.0.10
flask==1.1.1
dash==1.7.0
dash-core-components==1.6.0
dash==1.9.1
dash-core-components==1.8.1
dash-html-components==1.0.2
dash-daq==0.1.7
dash-renderer==1.2.2
dash-table==4.5.1
dash-renderer==1.2.4
dash-table==4.6.1
python-dotenv==0.10.3
# Tests and CI
pre-commit
Expand Down
8 changes: 4 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read().strip()


ASSETS = "buzzword/parts/assets"
ASSETS = "buzzword/static"
DOCS = "docs"

assets = [os.path.join(ASSETS, i) for i in os.listdir(ASSETS)]
Expand All @@ -26,11 +26,11 @@ def read(fname):
author="Danny McDonald",
include_package_data=True,
zip_safe=False,
packages=["buzzword", "docs", "buzzword/parts"],
package_dir={"buzzword/parts/assets": "buzzword/parts/assets", "docs": "docs"},
packages=["buzzword", "docs", "explorer/parts"],
package_dir={"explorer/parts/assets": "explorer/parts/assets", "docs": "docs"},
scripts=["bin/buzzword", "bin/buzzword-create"],
package_data={"buzzword/parts": assets, "docs": docs},
data_files=[("buzzword/parts/assets", assets), ("docs", docs)],
data_files=[("explorer/parts/assets", assets), ("docs", docs)],
author_email="daniel.mcdonald@uzh.ch",
license="MIT",
keywords=[],
Expand Down
14 changes: 6 additions & 8 deletions start/management/commands/reload.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import os

from django.contrib.staticfiles.management.commands.runserver import Command as RunServerCommand
import explorer.parts.main


from importlib import import_module

import explorer.parts.main
from django.apps import apps
from django.contrib.staticfiles.management.commands.runserver import \
Command as RunServerCommand
from django.core.management.base import BaseCommand, CommandError
from django.core.management.color import no_style
from django.core.management.sql import emit_post_migrate_signal, sql_flush
Expand All @@ -15,9 +13,9 @@

class Command(RunServerCommand):

#def __init__(self, *args, **kwargs):
# super().__init__(self, *args, **kwargs)
# def __init__(self, *args, **kwargs):
# super().__init__(self, *args, **kwargs)

def run(self, **options):

database = options.get('database', DEFAULT_DB_ALIAS)
Expand Down
8 changes: 5 additions & 3 deletions start/management/commands/runserver.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import os

from django.contrib.staticfiles.management.commands.runserver import Command as RunServerCommand
import explorer.parts.main
from django.contrib.staticfiles.management.commands.runserver import \
Command as RunServerCommand


class Command(RunServerCommand):

def run(self, **options):
if os.environ.get('RUN_MAIN', False): # https://code.djangoproject.com/ticket/8085
if os.environ.get('RUN_MAIN', False): # https://code.djangoproject.com/ticket/8085
explorer.parts.main.load_corpora()
super().run(**options)

0 comments on commit 5f6bda6

Please sign in to comment.