balder
Advanced tools
@@ -10,4 +10,4 @@ from pathlib import Path | ||
| class AutodiscoverApps: | ||
| def __init__(self, glob, exclude=[]) -> None: | ||
@@ -18,15 +18,15 @@ self.apps = settings.INSTALLED_APPS | ||
| self.app_paths = [] | ||
| def __normalize_module_name(self, module): | ||
| return '.'.join(module.parts).replace('.py', '') | ||
| return ".".join(module.parts).replace(".py", "") | ||
| def __call__(self): | ||
| for app in self.apps: | ||
| try: | ||
| paths = import_module(app).__path__ # Path can be actually in multiple directors so is a list | ||
| paths = import_module( | ||
| app | ||
| ).__path__ # Path can be actually in multiple directors so is a list | ||
| except AttributeError as e: | ||
| logger.error(f"Couldn't import app {app}: {e}") | ||
| continue # We continue here and skip the rest | ||
| logger.error(f"Balder couldn't import app {app}: {e}") | ||
| continue # We continue here and skip the rest | ||
@@ -38,7 +38,9 @@ for path in paths: | ||
| for file in matched_files: | ||
| module_name = self.__normalize_module_name(file.relative_to(self.base_path)) | ||
| module_name = self.__normalize_module_name( | ||
| file.relative_to(self.base_path) | ||
| ) | ||
| print(module_name) | ||
| import_module(module_name) | ||
| autodiscover = AutodiscoverApps(glob="**/balder.py") |
@@ -10,17 +10,18 @@ <!-- | ||
| <html> | ||
| <head> | ||
| <style> | ||
| body { | ||
| height: 100%; | ||
| margin: 0; | ||
| width: 100%; | ||
| overflow: hidden; | ||
| } | ||
| #graphiql { | ||
| height: 100vh; | ||
| } | ||
| </style> | ||
| <head> | ||
| <style> | ||
| body { | ||
| height: 100%; | ||
| margin: 0; | ||
| width: 100%; | ||
| overflow: hidden; | ||
| } | ||
| <!-- | ||
| #graphiql { | ||
| height: 100vh; | ||
| } | ||
| </style> | ||
| <!-- | ||
| This GraphiQL example depends on Promise and fetch, which are available in | ||
@@ -32,12 +33,6 @@ modern browsers, but can be "polyfilled" for older browsers. | ||
| --> | ||
| <script | ||
| crossorigin | ||
| src="https://unpkg.com/react@16/umd/react.development.js" | ||
| ></script> | ||
| <script | ||
| crossorigin | ||
| src="https://unpkg.com/react-dom@16/umd/react-dom.development.js" | ||
| ></script> | ||
| <script crossorigin src="https://unpkg.com/react@16/umd/react.development.js"></script> | ||
| <script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script> | ||
| <!-- | ||
| <!-- | ||
| These two files can be found in the npm module, however you may wish to | ||
@@ -47,54 +42,51 @@ copy them directly into your environment, or perhaps include them in your | ||
| --> | ||
| <link rel="stylesheet" href="https://unpkg.com/graphiql/graphiql.min.css" /> | ||
| <script src="//cdn.jsdelivr.net/npm/graphql-transport-ws@0.8.3/browser/client.js"></script> | ||
| </head> | ||
| <link rel="stylesheet" href="https://unpkg.com/graphiql/graphiql.min.css" /> | ||
| <script src="//cdn.jsdelivr.net/npm/graphql-transport-ws@0.8.3/browser/client.js"></script> | ||
| </head> | ||
| <body> | ||
| <div id="graphiql">Loading...</div> | ||
| <script | ||
| src="https://unpkg.com/graphiql/graphiql.min.js" | ||
| type="application/javascript" | ||
| ></script> | ||
| <script src="/renderExample.js" type="application/javascript"></script> | ||
| <script> | ||
| const GRAPHQL_ENDPOINT = (location.protocol === 'https' ? 'https' : 'http') | ||
| + '://' + location.host + "{% url 'graphql' %}" | ||
| <body> | ||
| <div id="graphiql">Loading...</div> | ||
| <script src="https://unpkg.com/graphiql/graphiql.min.js" type="application/javascript"></script> | ||
| <script> | ||
| const GRAPHQL_ENDPOINT = (location.protocol === 'https:' ? 'https:' : 'http:') | ||
| + '//' + location.host + "{% url 'graphql' %}" | ||
| let subClient = new window.SubscriptionsTransportWs.SubscriptionClient( | ||
| (location.protocol === 'https' ? 'wss' : 'ws') | ||
| + '://' + location.host + "{% url 'graphql' %}" | ||
| , | ||
| { reconnect: true } | ||
| ); | ||
| let subClient = new window.SubscriptionsTransportWs.SubscriptionClient( | ||
| (location.protocol === 'https:' ? 'wss:' : 'ws:') | ||
| + '//' + location.host + "{% url 'graphql' %}" | ||
| , | ||
| { reconnect: true } | ||
| ); | ||
| subFetcher = subClient.request.bind(subClient) | ||
| function graphQLFetcher(graphQLParams) { | ||
| return fetch( | ||
| GRAPHQL_ENDPOINT, | ||
| { | ||
| method: 'post', | ||
| headers: { | ||
| Accept: 'application/json', | ||
| 'Content-Type': 'application/json', | ||
| }, | ||
| body: JSON.stringify(graphQLParams), | ||
| credentials: 'omit', | ||
| function graphQLFetcher(graphQLParams) { | ||
| return fetch( | ||
| GRAPHQL_ENDPOINT, | ||
| { | ||
| method: 'post', | ||
| headers: { | ||
| Accept: 'application/json', | ||
| 'Content-Type': 'application/json', | ||
| }, | ||
| ).then(function (response) { | ||
| return response.json().catch(function () { | ||
| return response.text(); | ||
| }); | ||
| body: JSON.stringify(graphQLParams), | ||
| credentials: 'omit', | ||
| }, | ||
| ).then(function (response) { | ||
| return response.json().catch(function () { | ||
| return response.text(); | ||
| }); | ||
| } | ||
| }); | ||
| } | ||
| ReactDOM.render( | ||
| React.createElement(GraphiQL, { | ||
| fetcher: subFetcher, | ||
| defaultVariableEditorOpen: true, | ||
| }), | ||
| document.getElementById('graphiql'), | ||
| ); | ||
| </script> | ||
| </body> | ||
| ReactDOM.render( | ||
| React.createElement(GraphiQL, { | ||
| fetcher: subFetcher, | ||
| defaultVariableEditorOpen: true, | ||
| }), | ||
| document.getElementById('graphiql'), | ||
| ); | ||
| </script> | ||
| </body> | ||
| </html> |
@@ -54,6 +54,5 @@ <!-- | ||
| ></script> | ||
| <script src="/renderExample.js" type="application/javascript"></script> | ||
| <script> | ||
| const GRAPHQL_ENDPOINT = (location.protocol === 'https' ? 'https' : 'http') | ||
| + '://' + location.host + "{% url 'graphql' %}" | ||
| const GRAPHQL_ENDPOINT = (location.protocol === 'https:' ? 'https:' : 'http:') | ||
| + '//' + location.host + "{% url 'graphql' %}" | ||
@@ -60,0 +59,0 @@ |
+2
-1
| Metadata-Version: 2.1 | ||
| Name: balder | ||
| Version: 0.1.21 | ||
| Version: 0.1.22 | ||
| Summary: | ||
@@ -11,2 +11,3 @@ Author: jhnnsrs | ||
| Classifier: Programming Language :: Python :: 3.9 | ||
| Classifier: Programming Language :: Python :: 3.10 | ||
| Provides-Extra: subscription | ||
@@ -13,0 +14,0 @@ Requires-Dist: Django (>=3.1,<4.0) |
+1
-1
| [tool.poetry] | ||
| name = "balder" | ||
| version = "0.1.21" | ||
| version = "0.1.22" | ||
| description = "" | ||
@@ -5,0 +5,0 @@ authors = ["jhnnsrs <jhnnsrs@gmail.com>"] |
+5
-5
@@ -28,10 +28,10 @@ # -*- coding: utf-8 -*- | ||
| 'name': 'balder', | ||
| 'version': '0.1.21', | ||
| 'version': '0.1.22', | ||
| 'description': '', | ||
| 'long_description': None, | ||
| 'long_description': 'None', | ||
| 'author': 'jhnnsrs', | ||
| 'author_email': 'jhnnsrs@gmail.com', | ||
| 'maintainer': None, | ||
| 'maintainer_email': None, | ||
| 'url': None, | ||
| 'maintainer': 'None', | ||
| 'maintainer_email': 'None', | ||
| 'url': 'None', | ||
| 'packages': packages, | ||
@@ -38,0 +38,0 @@ 'package_data': package_data, |
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
815
0.49%41771
-0.46%