Skip to content

Commit

Permalink
Merge pull request #136 from fabianegli/pyupgrade-36-plus
Browse files Browse the repository at this point in the history
changes by pyupgrade --py36-plus
  • Loading branch information
ypriverol authored Aug 17, 2022
2 parents 2585419 + 41d8935 commit 884c89f
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 19 deletions.
1 change: 0 additions & 1 deletion sdrf_pipelines/maxquant/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@

5 changes: 2 additions & 3 deletions sdrf_pipelines/maxquant/maxquant.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""
Created on Sun Apr 19 09:46:14 2020
Expand Down Expand Up @@ -993,7 +992,7 @@ def maxquant_convert(
for j in range(arr.shape[1]):
arr[i][j] = sorted(arr[i])[j]

label_arr = np.array(list(set([tuple(t) for t in arr])))
label_arr = np.array(list({tuple(t) for t in arr}))
file2silac_shape[raw] = label_arr.shape
label_arr.sort()
if label_arr.shape[0] == 2: # Support two or three silac labels
Expand Down Expand Up @@ -1100,7 +1099,7 @@ def maxquant_convert(
fastaFilePath_node = doc.createElement("fastaFilePath")
fastaFilePath_node.appendChild(doc.createTextNode(fastaFilePath))
identifierParseRule = doc.createElement("identifierParseRule")
identifierParseRule.appendChild(doc.createTextNode(">([^\s]*)"))
identifierParseRule.appendChild(doc.createTextNode(r">([^\s]*)"))
descriptionParseRule = doc.createElement("descriptionParseRule")
descriptionParseRule.appendChild(doc.createTextNode(">(.*)"))
taxonomyParseRule = doc.createElement("taxonomyParseRule")
Expand Down
3 changes: 0 additions & 3 deletions sdrf_pipelines/msstats/msstats.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-


import re

import pandas as pd
Expand Down
6 changes: 3 additions & 3 deletions sdrf_pipelines/openms/unimod.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ def search_mods_by_keyword(self, keyword: str = None):
return found_list

def _get_elements(self, node):
for e in node.findall("%selements/%selem" % (self.xmlns, self.xmlns)):
for e in node.findall(f"{self.xmlns}elements/{self.xmlns}elem"):
ea = e.attrib
self.elements[ea["title"]] = ea
if re.match(r"[A-Z]", ea["title"][:1]):
self.elements["%s%s" % (int(round(float(ea["mono_mass"]))), ea["title"])] = ea
self.elements["{}{}".format(int(round(float(ea["mono_mass"]))), ea["title"])] = ea

def _get_modifications(self, node):
for e in node.findall("%smodifications/%smod" % (self.xmlns, self.xmlns)):
for e in node.findall(f"{self.xmlns}modifications/{self.xmlns}mod"):
ma = e.attrib
d = e.findall("%sdelta" % self.xmlns)[0]
for k in d.attrib.keys():
Expand Down
4 changes: 2 additions & 2 deletions sdrf_pipelines/sdrf/sdrf_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def default_message(self):
Return a message for the validation of the Ontology Term
:return:
"""
return "the term name or title can't be found in the ontology -- {}".format(self._ontology_name)
return f"the term name or title can't be found in the ontology -- {self._ontology_name}"

@staticmethod
def validate_ontology_terms(cell_value, labels):
Expand Down Expand Up @@ -285,7 +285,7 @@ def _get_column_pairs(self, panda_sdrf):

for column in columns_to_pair:
if column.name not in panda_sdrf and column._optional is False:
message = "The column {} is not present in the SDRF".format(column.name)
message = f"The column {column.name} is not present in the SDRF"
errors.append(LogicError(message, error_type=logging.ERROR))
elif column.name in panda_sdrf:
column_pairs.append((panda_sdrf[column.name], column))
Expand Down
4 changes: 2 additions & 2 deletions sdrf_pipelines/utils/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ def __str__(self) -> str:
self.row, self.column, self.value, self.message, logging.getLevelName(self._error_type)
)
else:
return "{} -- {}".format(self.message, logging.getLevelName(self._error_type))
return f"{self.message} -- {logging.getLevelName(self._error_type)}"


class AppConfigException(AppException):
def __init__(self, value):
super(AppConfigException, self).__init__(value)
super().__init__(value)


class ConfigManagerException(Exception):
Expand Down
2 changes: 0 additions & 2 deletions sdrf_pipelines/zooma/ols.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

"""
OLS API wrapper
Expand Down
4 changes: 1 addition & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
from __future__ import print_function

import codecs
import os.path

from setuptools import find_packages
from setuptools import setup

with open("README.md", "r", encoding="UTF-8") as fh:
with open("README.md", encoding="UTF-8") as fh:
long_description = fh.read()


Expand Down

0 comments on commit 884c89f

Please sign in to comment.