diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 000000000..4e0106439 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,2 @@ +# Generated by CODEOWNERS.com + diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 000000000..dd84ea782 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,38 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: '' +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Desktop (please complete the following information):** + - OS: [e.g. iOS] + - Browser [e.g. chrome, safari] + - Version [e.g. 22] + +**Smartphone (please complete the following information):** + - Device: [e.g. iPhone6] + - OS: [e.g. iOS8.1] + - Browser [e.g. stock browser, safari] + - Version [e.g. 22] + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 000000000..bbcbbe7d6 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: '' +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 000000000..eb0b95e8e --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,74 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL" + +on: + push: + branches: [ "master" ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ "master" ] + schedule: + - cron: '23 8 * * 1' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'python' ] + # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] + # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + + # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality + + + # Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v2 + + # ℹī¸ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + + # If the Autobuild fails above, remove it and uncomment the following three lines. + # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. + + # - run: | + # echo "Run, Build Application using script" + # ./location_of_script_within_repo/buildscript.sh + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 + with: + category: "/language:${{matrix.language}}" diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 000000000..3f0070113 --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,27 @@ +# This workflow warns and then closes issues and PRs that have had no activity for a specified amount of time. +# +# You can adjust the behavior by modifying this file. +# For more information, see: +# https://github.com/actions/stale +name: Mark stale issues and pull requests + +on: + schedule: + - cron: '45 0 * * *' + +jobs: + stale: + + runs-on: ubuntu-latest + permissions: + issues: write + pull-requests: write + + steps: + - uses: actions/stale@v5 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + stale-issue-message: 'Stale issue message' + stale-pr-message: 'Stale pull request message' + stale-issue-label: 'no-issue-activity' + stale-pr-label: 'no-pr-activity' diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 430948d6b..000000000 --- a/.travis.yml +++ /dev/null @@ -1,22 +0,0 @@ -env: - - ARCH=x86 -language: python -sudo: false -python: - - "2.7" -cache: - directories: - - "$HOME/.pip-cache/" - - "/home/travis/virtualenv/python2.7" -install: - - "pip install -r client/requirements.txt --download-cache $HOME/.pip-cache" - - "pip install python-coveralls --download-cache $HOME/.pip-cache" - - "pip install coverage --download-cache $HOME/.pip-cache" - - "pip install flake8 --download-cache $HOME/.pip-cache" -before_script: - - "flake8 jasper.py client tests" -script: - - "coverage run -m unittest discover" -after_success: - - "coverage report" - - "coveralls" diff --git a/README.md b/README.md index aa0a45cf8..1db24eef6 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,9 @@ jasper-client ============= -[![Build Status](https://travis-ci.org/jasperproject/jasper-client.svg?branch=master)](https://travis-ci.org/jasperproject/jasper-client) [![Coverage Status](https://img.shields.io/coveralls/jasperproject/jasper-client.svg)](https://coveralls.io/r/jasperproject/jasper-client) [![Codacy Badge](https://www.codacy.com/project/badge/3a50e1bc2261419894d76b7e2c1ac694)](https://www.codacy.com/app/jasperproject/jasper-client) +***NOTE: THIS IS A WORK IN PROGRESS, PLEASE MAKE A PULL REQUEST IF YOU THINK YOU CAN HELP.*** + +I just found a project that has much more support and a much bigger community that continues the jasper project. See link here: https://github.com/NaomiProject/Naomi Client code for the Jasper voice computing platform. Jasper is an open source platform for developing always-on, voice-controlled applications. diff --git a/boot/boot.py b/boot/boot.py deleted file mode 100755 index 6ec7137c0..000000000 --- a/boot/boot.py +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env python2 -# -*- coding: utf-8-*- -# This file exists for backwards compatibility with older versions of jasper. -# It might be removed in future versions. -import os -import sys -import runpy -script_path = os.path.join(os.path.dirname(__file__), os.pardir, "jasper.py") -sys.path.remove(os.path.dirname(__file__)) -sys.path.insert(0, os.path.dirname(script_path)) -runpy.run_path(script_path, run_name="__main__") diff --git a/boot/boot.sh b/boot/boot.sh deleted file mode 100755 index 240a7f794..000000000 --- a/boot/boot.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -# This file exists for backwards compatibility with older versions of Jasper. -# It might be removed in future versions. -"${0%/*}/../jasper.py" diff --git a/client/__init__.py b/client/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/client/alteration.py b/client/alteration.py index 91e0ad3e3..0ddfe49d7 100644 --- a/client/alteration.py +++ b/client/alteration.py @@ -1,18 +1,16 @@ # -*- coding: utf-8-*- import re - def detectYears(input): YEAR_REGEX = re.compile(r'(\b)(\d\d)([1-9]\d)(\b)') return YEAR_REGEX.sub('\g<1>\g<2> \g<3>\g<4>', input) - def clean(input): """ Manually adjust output text before it's translated into - actual speech by the TTS system. This is to fix minior + actual speech by the TTS system. This is to fix minor idiomatic issues, for example, that 1901 is pronounced - "one thousand, ninehundred and one" rather than + "one thousand, nine hundred and one" rather than "nineteen oh one". Arguments: diff --git a/client/app_utils.py b/client/app_utils.py index edc8467ae..df52a0151 100644 --- a/client/app_utils.py +++ b/client/app_utils.py @@ -1,7 +1,7 @@ # -*- coding: utf-8-*- import smtplib from email.MIMEText import MIMEText -import urllib2 +import urllib.request, urllib.error, urllib.parse import re from pytz import timezone @@ -103,7 +103,7 @@ def generateTinyURL(URL): URL -- the original URL to-be compressed """ target = "http://tinyurl.com/api-create.php?url=" + URL - response = urllib2.urlopen(target) + response = urllib.request.urlopen(target) return response.read() @@ -126,3 +126,4 @@ def isPositive(phrase): phrase -- the input phrase to-be evaluated """ return bool(re.search(r'\b(sure|yes|yeah|go)\b', phrase, re.IGNORECASE)) + diff --git a/client/brain.py b/client/brain.py index 64f6cb039..21788fec5 100644 --- a/client/brain.py +++ b/client/brain.py @@ -1,7 +1,7 @@ # -*- coding: utf-8-*- import logging import pkgutil -import jasperpath +from client.utils import jasperpath class Brain(object): diff --git a/client/diagnose.py b/client/diagnose.py index 06ed9ea2e..9b59972fb 100644 --- a/client/diagnose.py +++ b/client/diagnose.py @@ -7,7 +7,7 @@ import pkgutil import logging import pip.req -import jasperpath +from client.utils import jasperpath if sys.version_info < (3, 3): from distutils.spawn import find_executable else: diff --git a/client/g2p.py b/client/g2p.py index 7b8022636..8c27efca2 100644 --- a/client/g2p.py +++ b/client/g2p.py @@ -8,7 +8,7 @@ import yaml import diagnose -import jasperpath +from client.utils import jasperpath class PhonetisaurusG2P(object): diff --git a/client/local_mic.py b/client/local_mic.py index 5c0fed294..efe8ac0e2 100644 --- a/client/local_mic.py +++ b/client/local_mic.py @@ -5,7 +5,6 @@ implementation, Jasper is always active listening with local_mic. """ - class Mic: prev = None diff --git a/client/main.py b/client/main.py deleted file mode 100755 index 629d75f21..000000000 --- a/client/main.py +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env python2 -# -*- coding: utf-8-*- -# This file exists for backwards compatibility with older versions of jasper. -# It might be removed in future versions. -import os -import sys -import runpy -script_path = os.path.join(os.path.dirname(__file__), os.pardir, "jasper.py") -sys.path.insert(0, os.path.dirname(script_path)) -runpy.run_path(script_path, run_name="__main__") diff --git a/client/mic.py b/client/mic.py index 401cddbd6..0cad7d4c6 100644 --- a/client/mic.py +++ b/client/mic.py @@ -8,7 +8,7 @@ import audioop import pyaudio import alteration -import jasperpath +from client.utils import jasperpath class Mic: diff --git a/client/modules/Joke.py b/client/modules/Joke.py index a260e5a0d..c40c11e4d 100644 --- a/client/modules/Joke.py +++ b/client/modules/Joke.py @@ -1,7 +1,7 @@ # -*- coding: utf-8-*- import random import re -from client import jasperpath +from client.utils import jasperpath WORDS = ["JOKE", "KNOCK KNOCK"] diff --git a/client/populate.py b/client/populate.py index 756297b1a..928033303 100644 --- a/client/populate.py +++ b/client/populate.py @@ -5,7 +5,7 @@ import yaml from pytz import timezone import feedparser -import jasperpath +from client.utils import jasperpath def run(): @@ -16,7 +16,7 @@ def run(): "blank field to continue.") def simple_request(var, cleanVar, cleanInput=None): - input = raw_input(cleanVar + ": ") + input = input(cleanVar + ": ") if input: if cleanInput: input = cleanInput(input) @@ -39,7 +39,7 @@ def simple_request(var, cleanVar, cleanInput=None): def clean_number(s): return re.sub(r'[^0-9]', '', s) - phone_number = clean_number(raw_input("\nPhone number (no country " + + phone_number = clean_number(input("\nPhone number (no country " + "code). Any dashes or spaces will " + "be removed for you: ")) profile['phone_number'] = phone_number diff --git a/client/start.sh b/client/start.sh deleted file mode 100755 index 240a7f794..000000000 --- a/client/start.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -# This file exists for backwards compatibility with older versions of Jasper. -# It might be removed in future versions. -"${0%/*}/../jasper.py" diff --git a/client/stt.py b/client/stt.py index a48696099..5e45d02ef 100644 --- a/client/stt.py +++ b/client/stt.py @@ -12,7 +12,7 @@ from abc import ABCMeta, abstractmethod import requests import yaml -import jasperpath +from client.utils import jasperpath import diagnose import vocabcompiler diff --git a/client/tts.py b/client/tts.py index dd3327f69..96b7f789a 100644 --- a/client/tts.py +++ b/client/tts.py @@ -39,7 +39,7 @@ pass import diagnose -import jasperpath +from client.utils import jasperpath class AbstractTTSEngine(object): diff --git a/client/jasperpath.py b/client/utils/jasperpath.py similarity index 100% rename from client/jasperpath.py rename to client/utils/jasperpath.py diff --git a/client/vocabcompiler.py b/client/vocabcompiler.py index 0f8a648a5..21e3e75ff 100644 --- a/client/vocabcompiler.py +++ b/client/vocabcompiler.py @@ -17,7 +17,7 @@ import yaml import brain -import jasperpath +from client.utils import jasperpath from g2p import PhonetisaurusG2P try: diff --git a/jasper.py b/jasper.py index 5056e3eeb..ec219802f 100755 --- a/jasper.py +++ b/jasper.py @@ -1,6 +1,3 @@ -#!/usr/bin/env python2 -# -*- coding: utf-8-*- - import os import sys import shutil @@ -11,7 +8,7 @@ from client import tts from client import stt -from client import jasperpath +from client.utils import jasperpath from client import diagnose from client.conversation import Conversation diff --git a/client/requirements.txt b/requirements.txt similarity index 100% rename from client/requirements.txt rename to requirements.txt diff --git a/tests/test_stt.py b/tests/test_stt.py index cb33ff6c2..60178082f 100644 --- a/tests/test_stt.py +++ b/tests/test_stt.py @@ -2,8 +2,8 @@ # -*- coding: utf-8-*- import unittest import imp -from client import stt, jasperpath - +from client import stt +from client.utils import jasperpath def cmuclmtk_installed(): try: