Skip to content

Commit

Permalink
Merge pull request #342 from citation-file-format/consistent-quotes
Browse files Browse the repository at this point in the history
Consistent quotes
  • Loading branch information
jspaaks committed Jul 20, 2023
2 parents 65701f0 + 8619164 commit 645dc46
Show file tree
Hide file tree
Showing 808 changed files with 3,729 additions and 3,725 deletions.
6 changes: 5 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,8 @@ testpaths = [

[tool.ruff]
line-length = 120
select = ["E", "F", "W", "C901"]
select = ["E", "F", "W", "C901", "Q"]

[tool.ruff.flake8-quotes]
docstring-quotes = "double"
inline-quotes = "double"
18 changes: 9 additions & 9 deletions src/cffconvert/cff_1_0_x/apalike.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,27 @@
class ApalikeObject(Shared):

supported_cff_versions = [
'1.0.1',
'1.0.2',
'1.0.3'
"1.0.1",
"1.0.2",
"1.0.3"
]

def add_author(self):
authors_cff = self.cffobj.get('authors', [])
authors_cff = self.cffobj.get("authors", [])
authors_apalike = [ApalikeAuthor(a).as_string() for a in authors_cff]
authors_apalike_filtered = [a for a in authors_apalike if a is not None]
if len(authors_apalike_filtered) > 0:
self.author = ', '.join(authors_apalike_filtered)
self.author = ", ".join(authors_apalike_filtered)
return self

def add_year(self):
if 'date-released' in self.cffobj.keys():
self.year = '(' + str(self.cffobj['date-released'].year) + ').'
if "date-released" in self.cffobj.keys():
self.year = "(" + str(self.cffobj["date-released"].year) + ")."
return self

def add_doi(self):
if 'doi' in self.cffobj.keys():
self.doi = 'DOI: ' + self.cffobj['doi']
if "doi" in self.cffobj.keys():
self.doi = "DOI: " + self.cffobj["doi"]
return self

def add_url(self):
Expand Down
22 changes: 11 additions & 11 deletions src/cffconvert/cff_1_0_x/bibtex.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,33 @@
class BibtexObject(Shared):

supported_cff_versions = [
'1.0.1',
'1.0.2',
'1.0.3'
"1.0.1",
"1.0.2",
"1.0.3"
]

def add_author(self):
authors_cff = self.cffobj.get('authors', [])
authors_cff = self.cffobj.get("authors", [])
authors_bibtex = [BibtexAuthor(a).as_string() for a in authors_cff]
authors_bibtex_filtered = [a for a in authors_bibtex if a is not None]
self.author = 'author = {' + ' and '.join(authors_bibtex_filtered) + '}'
self.author = "author = {" + " and ".join(authors_bibtex_filtered) + "}"
return self

def add_doi(self):
if 'doi' in self.cffobj.keys():
self.doi = 'doi = {' + self.cffobj['doi'] + '}'
if "doi" in self.cffobj.keys():
self.doi = "doi = {" + self.cffobj["doi"] + "}"
return self

def add_month(self):
if 'date-released' in self.cffobj.keys():
self.month = 'month = {' + str(self.cffobj['date-released'].month) + '}'
if "date-released" in self.cffobj.keys():
self.month = "month = {" + str(self.cffobj["date-released"].month) + "}"
return self

def add_url(self):
self.url = BibtexUrl(self.cffobj).as_string()
return self

def add_year(self):
if 'date-released' in self.cffobj.keys():
self.year = 'year = {' + str(self.cffobj['date-released'].year) + '}'
if "date-released" in self.cffobj.keys():
self.year = "year = {" + str(self.cffobj["date-released"].year) + "}"
return self
14 changes: 7 additions & 7 deletions src/cffconvert/cff_1_0_x/endnote.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@
class EndnoteObject(Shared):

supported_cff_versions = [
'1.0.1',
'1.0.2',
'1.0.3'
"1.0.1",
"1.0.2",
"1.0.3"
]

def add_author(self):
authors_cff = self.cffobj.get('authors', [])
authors_cff = self.cffobj.get("authors", [])
authors_endnote = [EndnoteAuthor(a).as_string() for a in authors_cff]
authors_endnote_filtered = [a for a in authors_endnote if a is not None]
self.author = ''.join(authors_endnote_filtered)
self.author = "".join(authors_endnote_filtered)
return self

def add_doi(self):
if 'doi' in self.cffobj.keys():
if "doi" in self.cffobj.keys():
self.doi = f"%R {self.cffobj['doi']}\n"
return self

Expand All @@ -28,6 +28,6 @@ def add_url(self):
return self

def add_year(self):
if 'date-released' in self.cffobj.keys():
if "date-released" in self.cffobj.keys():
self.year = f"%D {self.cffobj['date-released'].year}\n"
return self
22 changes: 11 additions & 11 deletions src/cffconvert/cff_1_0_x/ris.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,28 @@
class RisObject(Shared):

supported_cff_versions = [
'1.0.1',
'1.0.2',
'1.0.3'
"1.0.1",
"1.0.2",
"1.0.3"
]

def add_author(self):
authors_cff = self.cffobj.get('authors', [])
authors_cff = self.cffobj.get("authors", [])
authors_bibtex = [RisAuthor(a).as_string() for a in authors_cff]
authors_bibtex_filtered = [a for a in authors_bibtex if a is not None]
self.author = ''.join(authors_bibtex_filtered)
self.author = "".join(authors_bibtex_filtered)
return self

def add_date(self):
if 'date-released' in self.cffobj.keys():
year = self.cffobj['date-released'].year
month = self.cffobj['date-released'].month
day = self.cffobj['date-released'].day
if "date-released" in self.cffobj.keys():
year = self.cffobj["date-released"].year
month = self.cffobj["date-released"].month
day = self.cffobj["date-released"].day
self.date = f"DA - {year:d}-{month:02d}-{day:02d}\n"
return self

def add_doi(self):
if 'doi' in self.cffobj.keys():
if "doi" in self.cffobj.keys():
self.doi = f"DO - {self.cffobj['doi']}\n"
return self

Expand All @@ -36,6 +36,6 @@ def add_url(self):
return self

def add_year(self):
if 'date-released' in self.cffobj.keys():
if "date-released" in self.cffobj.keys():
self.year = f"PY - {self.cffobj['date-released'].year}\n"
return self
22 changes: 11 additions & 11 deletions src/cffconvert/cff_1_1_x/apalike.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,30 @@
class ApalikeObject(Shared):

supported_cff_versions = [
'1.1.0'
"1.1.0"
]

def add_author(self):
authors_cff = self.cffobj.get('authors', [])
authors_cff = self.cffobj.get("authors", [])
authors_apalike = [ApalikeAuthor(a).as_string() for a in authors_cff]
authors_apalike_filtered = [a for a in authors_apalike if a is not None]
if len(authors_apalike_filtered) > 0:
self.author = ', '.join(authors_apalike_filtered)
self.author = ", ".join(authors_apalike_filtered)
return self

def add_year(self):
if 'date-released' in self.cffobj.keys():
self.year = '(' + str(self.cffobj['date-released'].year) + ').'
if "date-released" in self.cffobj.keys():
self.year = "(" + str(self.cffobj["date-released"].year) + ")."
return self

def add_doi(self):
if 'doi' in self.cffobj.keys():
self.doi = 'DOI: ' + self.cffobj['doi']
if 'identifiers' in self.cffobj.keys():
identifiers = self.cffobj['identifiers']
if "doi" in self.cffobj.keys():
self.doi = "DOI: " + self.cffobj["doi"]
if "identifiers" in self.cffobj.keys():
identifiers = self.cffobj["identifiers"]
for identifier in identifiers:
if identifier['type'] == 'doi':
self.doi = 'DOI: ' + identifier['value']
if identifier["type"] == "doi":
self.doi = "DOI: " + identifier["value"]
break
return self

Expand Down
26 changes: 13 additions & 13 deletions src/cffconvert/cff_1_1_x/bibtex.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,37 @@
class BibtexObject(Shared):

supported_cff_versions = [
'1.1.0'
"1.1.0"
]

def add_author(self):
authors_cff = self.cffobj.get('authors', [])
authors_cff = self.cffobj.get("authors", [])
authors_bibtex = [BibtexAuthor(a).as_string() for a in authors_cff]
authors_bibtex_filtered = [a for a in authors_bibtex if a is not None]
self.author = 'author = {' + ' and '.join(authors_bibtex_filtered) + '}'
self.author = "author = {" + " and ".join(authors_bibtex_filtered) + "}"
return self

def add_doi(self):
if 'doi' in self.cffobj.keys():
self.doi = 'doi = {' + self.cffobj['doi'] + '}'
if 'identifiers' in self.cffobj.keys():
identifiers = self.cffobj['identifiers']
if "doi" in self.cffobj.keys():
self.doi = "doi = {" + self.cffobj["doi"] + "}"
if "identifiers" in self.cffobj.keys():
identifiers = self.cffobj["identifiers"]
for identifier in identifiers:
if identifier['type'] == 'doi':
self.doi = 'doi = {' + identifier['value'] + '}'
if identifier["type"] == "doi":
self.doi = "doi = {" + identifier["value"] + "}"
break
return self

def add_month(self):
if 'date-released' in self.cffobj.keys():
self.month = 'month = {' + str(self.cffobj['date-released'].month) + '}'
if "date-released" in self.cffobj.keys():
self.month = "month = {" + str(self.cffobj["date-released"].month) + "}"
return self

def add_url(self):
self.url = BibtexUrl(self.cffobj).as_string()
return self

def add_year(self):
if 'date-released' in self.cffobj.keys():
self.year = 'year = {' + str(self.cffobj['date-released'].year) + '}'
if "date-released" in self.cffobj.keys():
self.year = "year = {" + str(self.cffobj["date-released"].year) + "}"
return self
16 changes: 8 additions & 8 deletions src/cffconvert/cff_1_1_x/endnote.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,23 @@
class EndnoteObject(Shared):

supported_cff_versions = [
'1.1.0'
"1.1.0"
]

def add_author(self):
authors_cff = self.cffobj.get('authors', [])
authors_cff = self.cffobj.get("authors", [])
authors_endnote = [EndnoteAuthor(a).as_string() for a in authors_cff]
authors_endnote_filtered = [a for a in authors_endnote if a is not None]
self.author = ''.join(authors_endnote_filtered)
self.author = "".join(authors_endnote_filtered)
return self

def add_doi(self):
if 'doi' in self.cffobj.keys():
if "doi" in self.cffobj.keys():
self.doi = f"%R {self.cffobj['doi']}\n"
if 'identifiers' in self.cffobj.keys():
identifiers = self.cffobj['identifiers']
if "identifiers" in self.cffobj.keys():
identifiers = self.cffobj["identifiers"]
for identifier in identifiers:
if identifier['type'] == 'doi':
if identifier["type"] == "doi":
self.doi = f"%R {identifier['value']}\n"
break
return self
Expand All @@ -32,6 +32,6 @@ def add_url(self):
return self

def add_year(self):
if 'date-released' in self.cffobj.keys():
if "date-released" in self.cffobj.keys():
self.year = f"%D {self.cffobj['date-released'].year}\n"
return self
24 changes: 12 additions & 12 deletions src/cffconvert/cff_1_1_x/ris.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,31 @@
class RisObject(Shared):

supported_cff_versions = [
'1.1.0'
"1.1.0"
]

def add_author(self):
authors_cff = self.cffobj.get('authors', [])
authors_cff = self.cffobj.get("authors", [])
authors_bibtex = [RisAuthor(a).as_string() for a in authors_cff]
authors_bibtex_filtered = [a for a in authors_bibtex if a is not None]
self.author = ''.join(authors_bibtex_filtered)
self.author = "".join(authors_bibtex_filtered)
return self

def add_date(self):
if 'date-released' in self.cffobj.keys():
year = self.cffobj['date-released'].year
month = self.cffobj['date-released'].month
day = self.cffobj['date-released'].day
if "date-released" in self.cffobj.keys():
year = self.cffobj["date-released"].year
month = self.cffobj["date-released"].month
day = self.cffobj["date-released"].day
self.date = f"DA - {year:d}-{month:02d}-{day:02d}\n"
return self

def add_doi(self):
if 'doi' in self.cffobj.keys():
if "doi" in self.cffobj.keys():
self.doi = f"DO - {self.cffobj['doi']}\n"
if 'identifiers' in self.cffobj.keys():
identifiers = self.cffobj['identifiers']
if "identifiers" in self.cffobj.keys():
identifiers = self.cffobj["identifiers"]
for identifier in identifiers:
if identifier['type'] == 'doi':
if identifier["type"] == "doi":
self.doi = f"DO - {identifier['value']}\n"
break
return self
Expand All @@ -40,6 +40,6 @@ def add_url(self):
return self

def add_year(self):
if 'date-released' in self.cffobj.keys():
if "date-released" in self.cffobj.keys():
self.year = f"PY - {self.cffobj['date-released'].year}\n"
return self
22 changes: 11 additions & 11 deletions src/cffconvert/cff_1_2_x/apalike.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,30 @@
class ApalikeObject(Shared):

supported_cff_versions = [
'1.2.0'
"1.2.0"
]

def add_author(self):
authors_cff = self.cffobj.get('authors', [])
authors_cff = self.cffobj.get("authors", [])
authors_apalike = [ApalikeAuthor(a).as_string() for a in authors_cff]
authors_apalike_filtered = [a for a in authors_apalike if a is not None]
if len(authors_apalike_filtered) > 0:
self.author = ', '.join(authors_apalike_filtered)
self.author = ", ".join(authors_apalike_filtered)
return self

def add_year(self):
if 'date-released' in self.cffobj.keys():
self.year = '(' + self.cffobj['date-released'].split('-')[0] + ').'
if "date-released" in self.cffobj.keys():
self.year = "(" + self.cffobj["date-released"].split("-")[0] + ")."
return self

def add_doi(self):
if 'doi' in self.cffobj.keys():
self.doi = 'DOI: ' + self.cffobj['doi']
if 'identifiers' in self.cffobj.keys():
identifiers = self.cffobj['identifiers']
if "doi" in self.cffobj.keys():
self.doi = "DOI: " + self.cffobj["doi"]
if "identifiers" in self.cffobj.keys():
identifiers = self.cffobj["identifiers"]
for identifier in identifiers:
if identifier['type'] == 'doi':
self.doi = 'DOI: ' + identifier['value']
if identifier["type"] == "doi":
self.doi = "DOI: " + identifier["value"]
break
return self

Expand Down
Loading

0 comments on commit 645dc46

Please sign in to comment.