[med-svn] [Git][python-team/packages/python-schema-salad][upstream] New upstream version 8.2.20220204150214

Michael R. Crusoe (@crusoe) gitlab at salsa.debian.org
Sun Apr 10 16:53:38 BST 2022



Michael R. Crusoe pushed to branch upstream at Debian Python Team / packages / python-schema-salad


Commits:
1554e80c by Michael R. Crusoe at 2022-04-10T17:05:17+02:00
New upstream version 8.2.20220204150214
- - - - -


23 changed files:

- PKG-INFO
- README.rst
- mypy-requirements.txt
- requirements.txt
- schema_salad.egg-info/PKG-INFO
- schema_salad.egg-info/SOURCES.txt
- schema_salad.egg-info/requires.txt
- schema_salad/codegen.py
- schema_salad/java/main_utils/LoadingOptions.java
- schema_salad/java/pom.xml
- schema_salad/java_codegen.py
- schema_salad/ref_resolver.py
- schema_salad/schema.py
- + schema_salad/tests/class_field_test.yml
- schema_salad/tests/test_cwl11.py
- + schema_salad/tests/test_real_cwl/tabs_rna_seq_workflow.cwl
- schema_salad/tests/test_typescript_codegen.py
- schema_salad/typescript/package.json
- schema_salad/typescript/tsconfig.json
- schema_salad/typescript_codegen.py
- setup.cfg
- setup.py
- typeshed/typing.pyi


Changes:

=====================================
PKG-INFO
=====================================
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: schema-salad
-Version: 8.2.20220103095339
+Version: 8.2.20220204150214
 Summary: Schema Annotations for Linked Avro Data (SALAD)
 Home-page: https://github.com/common-workflow-language/schema_salad
 Author: Common workflow language working group
@@ -32,7 +32,7 @@ Description: |Linux Build Status| |Code coverage| |Documentation Status| |CII Be
         between document and record oriented data modeling and the Semantic
         Web.
         
-        The Schema Salad library is Python 3.6+ only.
+        The Schema Salad library is Python 3.7+ only.
         
         Installation
         ------------


=====================================
README.rst
=====================================
@@ -23,7 +23,7 @@ generation, and transformation to RDF_. Salad provides a bridge
 between document and record oriented data modeling and the Semantic
 Web.
 
-The Schema Salad library is Python 3.6+ only.
+The Schema Salad library is Python 3.7+ only.
 
 Installation
 ------------


=====================================
mypy-requirements.txt
=====================================
@@ -1,5 +1,4 @@
-mypy==0.921
+mypy==0.931
 black>=19.10b0
 types-pkg_resources
 types-requests
-types-dataclasses;python_version < "3.7"


=====================================
requirements.txt
=====================================
@@ -1,7 +1,5 @@
 ruamel.yaml>= 0.12.4, != 0.16.6, < 0.18
-rdflib>= 4.2.2, < 6.0.0;python_version<='3.6'
 rdflib>= 4.2.2, < 7.0.0
-rdflib-jsonld>=0.4.0, <= 0.6.1;python_version<='3.6'
 mistune>=0.8.1,<0.9
 CacheControl==0.12.10
 lockfile==0.12.2  # needed for CacheControl's FileCache


=====================================
schema_salad.egg-info/PKG-INFO
=====================================
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: schema-salad
-Version: 8.2.20220103095339
+Version: 8.2.20220204150214
 Summary: Schema Annotations for Linked Avro Data (SALAD)
 Home-page: https://github.com/common-workflow-language/schema_salad
 Author: Common workflow language working group
@@ -32,7 +32,7 @@ Description: |Linux Build Status| |Code coverage| |Documentation Status| |CII Be
         between document and record oriented data modeling and the Semantic
         Web.
         
-        The Schema Salad library is Python 3.6+ only.
+        The Schema Salad library is Python 3.7+ only.
         
         Installation
         ------------


=====================================
schema_salad.egg-info/SOURCES.txt
=====================================
@@ -116,6 +116,7 @@ schema_salad/tests/Process.yml
 schema_salad/tests/__init__.py
 schema_salad/tests/bad_schema.yml
 schema_salad/tests/bad_schema2.yml
+schema_salad/tests/class_field_test.yml
 schema_salad/tests/cwl-pre.yml
 schema_salad/tests/formattest2.cwl
 schema_salad/tests/frag.yml
@@ -159,6 +160,7 @@ schema_salad/tests/foreign/foreign_prop4.cwl
 schema_salad/tests/foreign/foreign_prop5.cwl
 schema_salad/tests/foreign/foreign_prop6.cwl
 schema_salad/tests/foreign/foreign_prop7.cwl
+schema_salad/tests/test_real_cwl/tabs_rna_seq_workflow.cwl
 schema_salad/tests/test_real_cwl/ICGC-TCGA-PanCancer/PreprocessedFilesType.yaml
 schema_salad/tests/test_real_cwl/ICGC-TCGA-PanCancer/preprocess_util.js
 schema_salad/tests/test_real_cwl/ICGC-TCGA-PanCancer/preprocess_vcf.cwl


=====================================
schema_salad.egg-info/requires.txt
=====================================
@@ -6,10 +6,6 @@ mistune<0.9,>=0.8.1
 CacheControl<0.13,>=0.11.7
 lockfile>=0.9
 
-[:python_version <= "3.6"]
-rdflib<6.0.0,>=4.2.2
-rdflib-jsonld<=0.6.1,>=0.3.0
-
 [docs]
 sphinx>=2.2
 sphinx-rtd-theme


=====================================
schema_salad/codegen.py
=====================================
@@ -13,15 +13,14 @@ from typing import (
 )
 from urllib.parse import urlsplit
 
-
 from . import schema
 from .codegen_base import CodeGenBase
 from .exceptions import SchemaSaladException
 from .java_codegen import JavaCodeGen
 from .python_codegen import PythonCodeGen
-from .typescript_codegen import TypeScriptCodeGen
 from .ref_resolver import Loader
 from .schema import shortname
+from .typescript_codegen import TypeScriptCodeGen
 from .utils import aslist
 
 FIELD_SORT_ORDER = ["id", "class", "name"]


=====================================
schema_salad/java/main_utils/LoadingOptions.java
=====================================
@@ -94,7 +94,7 @@ public class LoadingOptions {
       final ArrayList<String> sp = new ArrayList(Arrays.asList(splitbase.fragment.split("/")));
       int n = scopedRef;
       while (n > 0 && sp.size() > 0) {
-        sp.remove(0);
+        sp.remove(sp.size()-1);
         n -= 1;
       }
       sp.add(url);


=====================================
schema_salad/java/pom.xml
=====================================
@@ -8,7 +8,7 @@
   <description><![CDATA[${project_description}]]></description>
   <version>${version}</version>
   <properties>
-    <commonslang.version>3.7</commonslang.version>
+    <commonslang.version>3.12.0</commonslang.version>
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
     <maven.compiler.source>8</maven.compiler.source>
@@ -31,7 +31,7 @@
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-compiler-plugin</artifactId>
-          <version>3.8.0</version>
+          <version>3.8.1</version>
           <configuration>
             <release>11</release>
             <showDeprecation>true</showDeprecation>
@@ -53,18 +53,19 @@
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-surefire-plugin</artifactId>
-        <version>2.21.0</version>
+        <version>2.22.2</version>
       </plugin>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-javadoc-plugin</artifactId>
-        <version>3.1.1</version>
+        <version>3.3.1</version>
         <configuration>
                 </configuration>
       </plugin>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-jar-plugin</artifactId>
+        <version>3.2.0</version>
         <configuration>
           <archive>
             <manifestFile>src/main/resources/META-INF/MANIFEST.MF</manifestFile>
@@ -111,12 +112,22 @@
     <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
-      <version>4.13.1</version>
+      <version>4.13.2</version>
     </dependency>
     <dependency>
       <groupId>org.snakeyaml</groupId>
       <artifactId>snakeyaml-engine</artifactId>
-      <version>2.2.1</version>
+      <version>2.3</version>
+    </dependency>
+    <dependency>
+      <groupId>com.fasterxml.jackson.core</groupId>
+      <artifactId>jackson-databind</artifactId>
+      <version>2.12.6</version>
+    </dependency>
+    <dependency>
+      <groupId>com.fasterxml.jackson.dataformat</groupId>
+      <artifactId>jackson-dataformat-yaml</artifactId>
+      <version>2.10.4</version>
     </dependency>
   </dependencies>
   <profiles>


=====================================
schema_salad/java_codegen.py
=====================================
@@ -446,11 +446,16 @@ public class {cls}Impl extends SavableImpl implements {cls} {{
                 "https://w3id.org/cwl/salad#array",
             ):
                 i = self.type_loader(type_declaration["items"])
+                instance_type = (
+                    "java.util.List<String>"
+                    if i.instance_type == "String"
+                    else "java.util.List<Object>"
+                )
                 return self.declare_type(
                     TypeDef(
                         # special doesn't work out with subclassing, gotta be more clever
                         # instance_type="List<{}>".format(i.instance_type),
-                        instance_type="java.util.List<Object>",
+                        instance_type=instance_type,
                         name=f"array_of_{i.name}",
                         init=f"new ArrayLoader({i.name})",
                         loader_type="Loader<java.util.List<{}>>".format(


=====================================
schema_salad/ref_resolver.py
=====================================
@@ -91,9 +91,10 @@ def to_validation_exception(e: MarkedYAMLError) -> ValidationException:
 
     if e.context:
         parent = ValidationException(e.context)
-        mark = e.context_mark
-        parent.file = re.sub(fname_regex, "", mark.name)
-        parent.start = (mark.line + 1, mark.column + 1)
+        context_mark = e.context_mark
+        if context_mark:
+            parent.file = re.sub(fname_regex, "", context_mark.name)
+            parent.start = (context_mark.line + 1, context_mark.column + 1)
         parent.end = None
         parent.children = [exc]
         return parent


=====================================
schema_salad/schema.py
=====================================
@@ -562,7 +562,7 @@ def make_valid_avro(
         if "symbols" in avro:
             avro["symbols"] = [avro_field_name(sym) for sym in avro["symbols"]]
         return avro
-    if isinstance(items, MutableSequence):
+    if items and isinstance(items, MutableSequence):
         ret = []
         for i in items:
             ret.append(


=====================================
schema_salad/tests/class_field_test.yml
=====================================
@@ -0,0 +1,29 @@
+$base: "https://example.com/classFieldTest#"
+
+$namespaces:
+  classFieldTest: "https://example.com/classFieldTest#"
+
+$graph:
+- name: ClassFieldString
+  type: record
+  documentRoot: true
+  fields:
+    - name: "class"
+      jsonldPredicate:
+        "_id": "@type"
+        "_type": "@vocab"
+      type: string
+
+- name: ClassFieldEnum
+  type: record
+  documentRoot: true
+  fields:
+    - name: class
+      jsonldPredicate:
+        "_id": "@type"
+        "_type": "@vocab"
+      type:
+        type: enum
+        name: ClassFieldEnum_class
+        symbols:
+          - classFieldTest:ClassFieldEnum
\ No newline at end of file


=====================================
schema_salad/tests/test_cwl11.py
=====================================
@@ -14,6 +14,7 @@ import requests
 from _pytest.tmpdir import TempPathFactory
 
 from schema_salad.avro.schema import Names, SchemaParseException
+from schema_salad.exceptions import ValidationException
 from schema_salad.ref_resolver import Loader
 from schema_salad.schema import load_and_validate, load_schema
 
@@ -64,3 +65,13 @@ def test_outputBinding(cwl_v1_2_schema: SchemaType) -> None:
         cwl_v1_2_schema, src="test_real_cwl/bio-cwl-tools/bamtools_stats.cwl"
     )
     print(f"the res:{res}")
+
+
+def test_yaml_tab_error(cwl_v1_2_schema: SchemaType) -> None:
+    """Tabs in the file."""
+    with pytest.raises(
+        ValidationException,
+        match=r".+found\s+character\s+'\\t'\s+that\s+cannot\s+start\s+any\s+token$",
+    ):
+        res = load_cwl(cwl_v1_2_schema, src="test_real_cwl/tabs_rna_seq_workflow.cwl")
+        print(res)


=====================================
schema_salad/tests/test_real_cwl/tabs_rna_seq_workflow.cwl
=====================================
@@ -0,0 +1,56 @@
+cwlVersion: v1.2
+class: Workflow
+
+inputs:
+        rna_reads_human: File
+	ref_genome: Directory
+        annotations: File
+
+steps:
+ quality_control:
+ run: bio-cwl-tools/fastqc/fastqc_2.cwl
+ in:
+ reads_file: rna_reads_human
+ out: [html_file]
+
+mapping_reads:
+ requirements:
+ ResourceRequirement:
+ ramMin: 9000
+ run: bio-cwl-tools/STAR/STAR-Align.cwl
+ in:
+ RunThreadN: {default: 4}
+ GenomeDir: ref_genome
+ ForwardReads: rna_reads_human
+ OutSAMtype: {default: BAM}
+ SortedByCoordinate: {default: true}
+ OutSAMunmapped: {default: Within}
+ out: [alignment]
+
+index_alignment:
+ run: bio-cwl-tools/samtools/samtools_index.cwl
+ in:
+ bam_sorted: mapping_reads/alignment
+ out: [bam_sorted_indexed]
+
+count_reads:
+ requirements:
+ ResourceRequirement:
+ ramMin: 500
+ run: bio-cwl-tools/subread/featureCounts.cwl
+ in:
+ mapped_reads: index_alignment/bam_sorted_indexed
+ annotations: annotations
+ out: [featurecounts]
+
+outputs:
+qc_html:
+ type: File
+ outputSource: quality_control/html_file
+ bam_sorted_indexed:
+ type: File
+ outputSource: index_alignment/bam_sorted_indexed
+ featurecounts:
+ type: File
+ outputSource: count_reads/featurecounts
+


=====================================
schema_salad/tests/test_typescript_codegen.py
=====================================
@@ -46,6 +46,35 @@ def test_meta_schema_gen(tmp_path: Path) -> None:
         )
 
 
+def test_class_field(tmp_path: Path) -> None:
+    schema_path = get_data_uri("tests/class_field_test.yml")
+    assert schema_path
+    target_dir = tmp_path / "target"
+
+    target_dir.mkdir()
+    typescript_codegen(schema_path, target_dir)
+
+    package_json_path = target_dir / "package.json"
+    assert package_json_path.exists
+
+    tests_dir = target_dir / "src" / "test"
+    assert tests_dir.exists()
+
+    with open(target_dir / "src" / "ClassFieldString.ts") as f:
+        assert (
+            "  constructor ({loadingOptions, extensionFields, class_ = 'ClassFieldString'} :"
+            + " {loadingOptions?: LoadingOptions} & Internal.ClassFieldStringProperties) {\n"
+            in f.read()
+        )
+    with open(target_dir / "src" / "ClassFieldEnum.ts") as f:
+        assert (
+            "  constructor ({loadingOptions, extensionFields, class_ = "
+            + "Internal.ClassFieldEnum_class.CLASSFIELDENUM} :"
+            + " {loadingOptions?: LoadingOptions} & Internal.ClassFieldEnumProperties) {\n"
+            in f.read()
+        )
+
+
 def get_data_uri(resource_path: str) -> str:
     path = get_data(resource_path)
     assert path


=====================================
schema_salad/typescript/package.json
=====================================
@@ -2,9 +2,12 @@
   "name": "${project_name}",
   "version": "${version}",
   "description": "${project_description}",
-  "main": "index.js",
+  "main": "dist/index.js",
+  "types": "dist/index.d.ts",
   "scripts": {
-    "test": "nyc --reporter=lcov mocha --require ts-node/register src/test/**/*.ts"
+    "build": "rimraf ./dist && tsc",
+    "test": "nyc --reporter=lcov mocha --require ts-node/register src/test/**/*.ts",
+    "doc": "rimraf ./docs && typedoc src/index.ts"
   },
   "license": "${license_name}",
   "devDependencies": {
@@ -22,13 +25,18 @@
     "nyc": "^15.1.0",
     "sinon": "^12.0.1",
     "ts-node": "^10.4.0",
+    "typedoc": "^0.22.10",
     "typescript": "^4.4.4",
-    "codecov.io": "^0.1.6"
+    "codecov.io": "^0.1.6",
+    "rimraf": "^3.0.2"
   },
   "dependencies": {
     "js-yaml": "^4.1.0",
     "node-fetch": "^2.6.6",
     "uri-js": "^4.4.1",
     "uuid": "^8.3.2"
-  }
+  },
+  "files": [
+    "/dist"
+  ]
 }


=====================================
schema_salad/typescript/tsconfig.json
=====================================
@@ -12,6 +12,7 @@
   },
   "include": ["./src/**/*"],
   "exclude": [
-    "node_modules"
+    "node_modules",
+    "./src/test"
   ]
 }
\ No newline at end of file


=====================================
schema_salad/typescript_codegen.py
=====================================
@@ -17,11 +17,11 @@ from typing import (
 
 import pkg_resources
 
-from . import schema, _logger
+from . import _logger, schema
 from .codegen_base import CodeGenBase, TypeDef
 from .exceptions import SchemaException
-from .schema import shortname
 from .java_codegen import _ensure_directory_and_write, _safe_makedirs
+from .schema import shortname
 
 
 def doc_to_doc_string(doc: Optional[str], indent_level: int = 0) -> str:
@@ -495,14 +495,22 @@ export enum {enum_name} {{
                         doc_str=doc_to_doc_string(doc, indent_level=1)
                     )
                 )
-            f.write(
-                "  {safename}{optionalstring}: {type}\n".format(
-                    safename=safename,
-                    type=fieldtype.instance_type,
-                    optionalstring=optionalstring,
+            if fieldname == "class":
+                f.write(
+                    "  {safename}{optionalstring}: {type}\n".format(
+                        safename=safename,
+                        type=fieldtype.instance_type,
+                        optionalstring="?",
+                    )
+                )
+            else:
+                f.write(
+                    "  {safename}{optionalstring}: {type}\n".format(
+                        safename=safename,
+                        type=fieldtype.instance_type,
+                        optionalstring=optionalstring,
+                    )
                 )
-            )
-
         if self.current_class_is_abstract:
             return
 
@@ -525,13 +533,22 @@ export enum {enum_name} {{
                 )
             )
         if fieldname == "class":
-            self.current_constructor_signature.write(
-                ", {safename} = {type}.{val}".format(
-                    safename=safename,
-                    type=fieldtype.instance_type,
-                    val=self.current_class.replace("-", "_").replace(".", "_").upper(),
+            if fieldtype.instance_type == "string":
+                self.current_constructor_signature.write(
+                    ", {safename} = '{val}'".format(
+                        safename=safename, val=self.current_class
+                    )
+                )
+            else:
+                self.current_constructor_signature.write(
+                    ", {safename} = {type}.{val}".format(
+                        safename=safename,
+                        type=fieldtype.instance_type,
+                        val=self.current_class.replace("-", "_")
+                        .replace(".", "_")
+                        .upper(),
+                    )
                 )
-            )
         else:
             self.current_constructor_signature.write(
                 ", {safename}".format(
@@ -720,13 +737,16 @@ export enum {enum_name} {{
         )
 
     def epilogue(self, root_loader: TypeDef) -> None:
+
         """Trigger to generate the epilouge code."""
         pd = "This project contains TypeScript objects and utilities "
         pd = pd + ' auto-generated by <a href=\\"https://github.com/'
         pd = pd + 'common-workflow-language/schema_salad\\">Schema Salad</a>'
         pd = pd + " for parsing documents corresponding to the "
         pd = pd + str(self.base_uri) + " schema."
-        generated_class_imports = ",\n  ".join(self.record_types)
+
+        sorted_record_types = sorted(self.record_types)
+        generated_class_imports = ",\n  ".join(sorted_record_types)
         template_vars: MutableMapping[str, str] = dict(
             project_name=self.package,
             version="0.0.1-SNAPSHOT",
@@ -767,8 +787,9 @@ export enum {enum_name} {{
                     collected_type.name, collected_type.init
                 )
 
+        sorted_modules = sorted(self.modules)
         internal_module_exports = "\n".join(
-            f"export * from '../{f}'" for f in self.modules
+            f"export * from '../{f}'" for f in sorted_modules
         )
 
         example_tests = ""


=====================================
setup.cfg
=====================================
@@ -14,6 +14,6 @@ use_parentheses = True
 line_length = 88
 
 [egg_info]
-tag_build = .20220103095339
+tag_build = .20220204150214
 tag_date = 0
 


=====================================
setup.py
=====================================
@@ -77,9 +77,7 @@ install_requires = [
     "ruamel.yaml >= 0.12.4, != 0.16.6, < 0.18",
     # once the minimum version for ruamel.yaml >= 0.15.99
     # then please update the mypy targets in the Makefile
-    "rdflib >= 4.2.2, < 6.0.0;python_version<='3.6'",
     "rdflib >= 4.2.2, < 7.0.0",
-    "rdflib-jsonld >= 0.3.0, <= 0.6.1;python_version<='3.6'",
     "mistune >= 0.8.1, < 0.9",
     "CacheControl >= 0.11.7, < 0.13",
     "lockfile >= 0.9",  # needed for CacheControl's FileCache


=====================================
typeshed/typing.pyi
=====================================
@@ -402,6 +402,7 @@ class ItemsView(
     def __iter__(self) -> Iterator[Tuple[_KT_co, _VT_co]]: ...
     if sys.version_info >= (3, 8):
         def __reversed__(self) -> Iterator[Tuple[_KT_co, _VT_co]]: ...
+
     def __or__(self, o: Iterable[_T]) -> Set[Union[Tuple[_KT_co, _VT_co], _T]]: ...
     def __ror__(self, o: Iterable[_T]) -> Set[Union[Tuple[_KT_co, _VT_co], _T]]: ...
     def __sub__(self, o: Iterable[Any]) -> Set[Tuple[_KT_co, _VT_co]]: ...
@@ -417,6 +418,7 @@ class KeysView(MappingView, AbstractSet[_KT_co], Generic[_KT_co]):
     def __iter__(self) -> Iterator[_KT_co]: ...
     if sys.version_info >= (3, 8):
         def __reversed__(self) -> Iterator[_KT_co]: ...
+
     def __or__(self, o: Iterable[_T]) -> Set[Union[_KT_co, _T]]: ...
     def __ror__(self, o: Iterable[_T]) -> Set[Union[_KT_co, _T]]: ...
     def __sub__(self, o: Iterable[Any]) -> Set[_KT_co]: ...
@@ -691,6 +693,7 @@ class NamedTuple(Tuple[Any, ...]):
         def _asdict(self) -> Dict[str, Any]: ...
     else:
         def _asdict(self) -> collections.OrderedDict[str, Any]: ...
+
     def _replace(self: _T, **kwargs: Any) -> _T: ...
 
 # Internal mypy fallback type for all typed dicts (does not exist at runtime)
@@ -714,6 +717,7 @@ def type_check_only(func_or_cls: _C) -> _C: ...
 
 if sys.version_info >= (3, 7):
     from types import CodeType
+
     class ForwardRef:
         __forward_arg__: str
         __forward_code__: CodeType



View it on GitLab: https://salsa.debian.org/python-team/packages/python-schema-salad/-/commit/1554e80c2bf6c0452457117bdb3dbb8634c48b11

-- 
View it on GitLab: https://salsa.debian.org/python-team/packages/python-schema-salad/-/commit/1554e80c2bf6c0452457117bdb3dbb8634c48b11
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20220410/e3840bd6/attachment-0001.htm>


More information about the debian-med-commit mailing list