Skip to content

Commit 0a4915a

Browse files
committed
create an app to detect licenses from input text
Signed-off-by: Akhil Raj <lf32.dev@gmail.com>
1 parent 08d7b16 commit 0a4915a

File tree

16 files changed

+759
-1
lines changed

16 files changed

+759
-1
lines changed

scancodeio/settings.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
ALLOWED_HOSTS = env.list("ALLOWED_HOSTS", default=[".localhost", "127.0.0.1", "[::1]"])
4646

4747
# SECURITY WARNING: don't run with debug turned on in production
48-
DEBUG = env.bool("SCANCODEIO_DEBUG", default=False)
48+
DEBUG = env.bool("SCANCODEIO_DEBUG", default=True)
4949

5050
SCANCODEIO_REQUIRE_AUTHENTICATION = env.bool(
5151
"SCANCODEIO_REQUIRE_AUTHENTICATION", default=False
@@ -78,6 +78,7 @@
7878
# Local apps
7979
# Must come before Third-party apps for proper templates override
8080
"scanpipe",
81+
"scantext",
8182
# Django built-in
8283
"django.contrib.auth",
8384
"django.contrib.contenttypes",

scancodeio/static/favicon.ico

15 KB
Binary file not shown.

scancodeio/urls.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
path("admin/", admin.site.urls),
5353
path("api/", include(api_router.urls)),
5454
path("license/", include(licenses.urls)),
55+
path("scan/", include("scantext.urls")),
5556
path("", include("scanpipe.urls")),
5657
path("", RedirectView.as_view(url="project/")),
5758
]

scanpipe/templates/scanpipe/base.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<meta charset="utf-8">
66
<meta name="viewport" content="width=device-width, initial-scale=1">
77
<title>{% block title %}ScanCode.io{% endblock %}</title>
8+
<link rel="icon" href="{% static 'favicon.ico' %}" type="image/x-icon"/>
89
<link rel="stylesheet" href="{% static 'bulma-0.9.2.min.css' %}" crossorigin="anonymous">
910
<link rel="stylesheet" href="{% static 'highlight-10.6.0.css' %}" crossorigin="anonymous">
1011
<style>

scantext/__init__.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
#
3+
# http://nexb.com and https://github.com/nexB/scancode.io
4+
# The ScanCode.io software is licensed under the Apache License version 2.0.
5+
# Data generated with ScanCode.io is provided as-is without warranties.
6+
# ScanCode is a trademark of nexB Inc.
7+
#
8+
# You may not use this software except in compliance with the License.
9+
# You may obtain a copy of the License at: http://apache.org/licenses/LICENSE-2.0
10+
# Unless required by applicable law or agreed to in writing, software distributed
11+
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12+
# CONDITIONS OF ANY KIND, either express or implied. See the License for the
13+
# specific language governing permissions and limitations under the License.
14+
#
15+
# Data Generated with ScanCode.io is provided on an "AS IS" BASIS, WITHOUT WARRANTIES
16+
# OR CONDITIONS OF ANY KIND, either express or implied. No content created from
17+
# ScanCode.io should be considered or used as legal advice. Consult an Attorney
18+
# for any legal advice.
19+
#
20+
# ScanCode.io is a free software code scanning tool from nexB Inc. and others.
21+
# Visit https://github.com/nexB/scancode.io for support and download.

scantext/admin.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
#
3+
# http://nexb.com and https://github.com/nexB/scancode.io
4+
# The ScanCode.io software is licensed under the Apache License version 2.0.
5+
# Data generated with ScanCode.io is provided as-is without warranties.
6+
# ScanCode is a trademark of nexB Inc.
7+
#
8+
# You may not use this software except in compliance with the License.
9+
# You may obtain a copy of the License at: http://apache.org/licenses/LICENSE-2.0
10+
# Unless required by applicable law or agreed to in writing, software distributed
11+
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12+
# CONDITIONS OF ANY KIND, either express or implied. See the License for the
13+
# specific language governing permissions and limitations under the License.
14+
#
15+
# Data Generated with ScanCode.io is provided on an "AS IS" BASIS, WITHOUT WARRANTIES
16+
# OR CONDITIONS OF ANY KIND, either express or implied. No content created from
17+
# ScanCode.io should be considered or used as legal advice. Consult an Attorney
18+
# for any legal advice.
19+
#
20+
# ScanCode.io is a free software code scanning tool from nexB Inc. and others.
21+
# Visit https://github.com/nexB/scancode.io for support and download.
22+
23+
from django.contrib import admin
24+
25+
# Register your models here.

scantext/apps.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
#
3+
# http://nexb.com and https://github.com/nexB/scancode.io
4+
# The ScanCode.io software is licensed under the Apache License version 2.0.
5+
# Data generated with ScanCode.io is provided as-is without warranties.
6+
# ScanCode is a trademark of nexB Inc.
7+
#
8+
# You may not use this software except in compliance with the License.
9+
# You may obtain a copy of the License at: http://apache.org/licenses/LICENSE-2.0
10+
# Unless required by applicable law or agreed to in writing, software distributed
11+
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12+
# CONDITIONS OF ANY KIND, either express or implied. See the License for the
13+
# specific language governing permissions and limitations under the License.
14+
#
15+
# Data Generated with ScanCode.io is provided on an "AS IS" BASIS, WITHOUT WARRANTIES
16+
# OR CONDITIONS OF ANY KIND, either express or implied. No content created from
17+
# ScanCode.io should be considered or used as legal advice. Consult an Attorney
18+
# for any legal advice.
19+
#
20+
# ScanCode.io is a free software code scanning tool from nexB Inc. and others.
21+
# Visit https://github.com/nexB/scancode.io for support and download.
22+
23+
from django.apps import AppConfig
24+
25+
26+
class ScantextConfig(AppConfig):
27+
default_auto_field = "django.db.models.BigAutoField"
28+
name = "scantext"

scantext/forms.py

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
#
3+
# http://nexb.com and https://github.com/nexB/scancode.io
4+
# The ScanCode.io software is licensed under the Apache License version 2.0.
5+
# Data generated with ScanCode.io is provided as-is without warranties.
6+
# ScanCode is a trademark of nexB Inc.
7+
#
8+
# You may not use this software except in compliance with the License.
9+
# You may obtain a copy of the License at: http://apache.org/licenses/LICENSE-2.0
10+
# Unless required by applicable law or agreed to in writing, software distributed
11+
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12+
# CONDITIONS OF ANY KIND, either express or implied. See the License for the
13+
# specific language governing permissions and limitations under the License.
14+
#
15+
# Data Generated with ScanCode.io is provided on an "AS IS" BASIS, WITHOUT WARRANTIES
16+
# OR CONDITIONS OF ANY KIND, either express or implied. No content created from
17+
# ScanCode.io should be considered or used as legal advice. Consult an Attorney
18+
# for any legal advice.
19+
#
20+
# ScanCode.io is a free software code scanning tool from nexB Inc. and others.
21+
# Visit https://github.com/nexB/scancode.io for support and download.
22+
23+
from django import forms
24+
25+
26+
class EditorForm(forms.Form):
27+
input_text = forms.CharField(
28+
widget=forms.Textarea(
29+
attrs={
30+
"rows": 30,
31+
"class": "textarea has-fixed-size",
32+
"placeholder": "Paste your license text here.",
33+
}
34+
),
35+
required=True,
36+
)
37+
38+
# def clean_input_text(self):
39+
# input_text = self.cleaned_data.get("input_text")
40+
# return " ".join(input_text.split())
41+
42+
# def save(self, *args, **kwargs):
43+
# license = super().save(*args, **kwargs)
44+
# self.handle_input(license)
45+
# return license
46+
47+
# class Media:
48+
# js = ("add-inputs.js",)
49+
50+
# def handle_inputs(self, project):
51+
# input_file = self.files.getlist("input_files")
52+
# input_text = self.cleaned_data.get("input_text")
53+
# print(input_text)
54+
# if input_file:
55+
# license.add_uploads(input_file)
56+
# elif input_text:
57+
# license.add_license(input_text)
58+
59+
# input_files = forms.FileField(
60+
# required=False,
61+
# widget=forms.ClearableFileInput(
62+
# attrs={"class": "file-input", "multiple": False},
63+
# ),
64+
# )

scantext/migrations/__init__.py

Whitespace-only changes.

scantext/models.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
#
3+
# http://nexb.com and https://github.com/nexB/scancode.io
4+
# The ScanCode.io software is licensed under the Apache License version 2.0.
5+
# Data generated with ScanCode.io is provided as-is without warranties.
6+
# ScanCode is a trademark of nexB Inc.
7+
#
8+
# You may not use this software except in compliance with the License.
9+
# You may obtain a copy of the License at: http://apache.org/licenses/LICENSE-2.0
10+
# Unless required by applicable law or agreed to in writing, software distributed
11+
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12+
# CONDITIONS OF ANY KIND, either express or implied. See the License for the
13+
# specific language governing permissions and limitations under the License.
14+
#
15+
# Data Generated with ScanCode.io is provided on an "AS IS" BASIS, WITHOUT WARRANTIES
16+
# OR CONDITIONS OF ANY KIND, either express or implied. No content created from
17+
# ScanCode.io should be considered or used as legal advice. Consult an Attorney
18+
# for any legal advice.
19+
#
20+
# ScanCode.io is a free software code scanning tool from nexB Inc. and others.
21+
# Visit https://github.com/nexB/scancode.io for support and download.
22+
23+
from django.db import models
24+
25+
# Create your models here.

0 commit comments

Comments
 (0)