Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean commit - added metadatat files to clean MAIN #27

Closed
wants to merge 1 commit into from

Conversation

jgrethe
Copy link
Contributor

@jgrethe jgrethe commented Nov 30, 2023

New pull request with clean addition to latest MAIN

self.connect()

def connect(self) -> str:
""" Not needed as metadata services are REST service calls """
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[blackfmt] reported by reviewdog 🐶

Suggested change
""" Not needed as metadata services are REST service calls """
"""Not needed as metadata services are REST service calls"""

Comment on lines +118 to +119
#####################################################################
# Supporting Functions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[blackfmt] reported by reviewdog 🐶

Suggested change
#####################################################################
# Supporting Functions
#####################################################################
# Supporting Functions

Comment on lines +121 to +122
#####################################################################
# Function to GET content from URL with retries
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[blackfmt] reported by reviewdog 🐶

Suggested change
#####################################################################
# Function to GET content from URL with retries
#####################################################################
# Function to GET content from URL with retries

#####################################################################
# Function to GET content from URL with retries
def getURL(self, url, headers="NONE"):

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[blackfmt] reported by reviewdog 🐶

Suggested change

Comment on lines +128 to +130
retries = Retry(total=6,
backoff_factor=1,
status_forcelist=[403, 404, 413, 429, 500, 502, 503, 504])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[blackfmt] reported by reviewdog 🐶

Suggested change
retries = Retry(total=6,
backoff_factor=1,
status_forcelist=[403, 404, 413, 429, 500, 502, 503, 504])
retries = Retry(
total=6, backoff_factor=1, status_forcelist=[403, 404, 413, 429, 500, 502, 503, 504]
)

Comment on lines +230 to +234
def list_datasets(
self,
limit: int = 10,
offset: int = 0
) -> list:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[blackfmt] reported by reviewdog 🐶

Suggested change
def list_datasets(
self,
limit: int = 10,
offset: int = 0
) -> list:
def list_datasets(self, limit: int = 10, offset: int = 0) -> list:

"""
self.host_api = "https://scicrunch.org/api/1/elastic/SPARC_Algolia_pr/_search"

list_url = self.host_api + "?" + "from=" + str(offset) + "&size=" + str(limit) + "&key=" + self.scicrunch_api_key
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[blackfmt] reported by reviewdog 🐶

Suggested change
list_url = self.host_api + "?" + "from=" + str(offset) + "&size=" + str(limit) + "&key=" + self.scicrunch_api_key
list_url = (
self.host_api
+ "?"
+ "from="
+ str(offset)
+ "&size="
+ str(limit)
+ "&key="
+ self.scicrunch_api_key
)

list_results = self.getURL(list_url, headers=self.default_headers)
return list_results


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[blackfmt] reported by reviewdog 🐶

Suggested change
def search_datasets(self, query: str = '{"query": { "match_all": {}}}') -> list:
"""Gets datasets matching specified query.

Comment on lines +257 to +263
def search_datasets(
self,
query: str = "{\"query\": { \"match_all\": {}}}"
) -> list:
"""Gets datasets matching specified query.

This function provides
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[blackfmt] reported by reviewdog 🐶

Suggested change
def search_datasets(
self,
query: str = "{\"query\": { \"match_all\": {}}}"
) -> list:
"""Gets datasets matching specified query.
This function provides
This function provides


list_url = self.host_api + "?" + "key=" + self.scicrunch_api_key

list_results = self.postURL(list_url, body = query, headers=self.default_headers)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[blackfmt] reported by reviewdog 🐶

Suggested change
list_results = self.postURL(list_url, body = query, headers=self.default_headers)
list_results = self.postURL(list_url, body=query, headers=self.default_headers)

# Instructions for getting an API key can be found at: https://fdilab.gitbook.io/api-handbook/sparc-k-core-api-overview/getting-started-with-sparc-apis

import json
from sparc.client import SparcClient
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[formatters] reported by reviewdog 🐶

Suggested change
from sparc.client import SparcClient
from sparc.client import SparcClient

@@ -0,0 +1,281 @@
import logging
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[formatters] reported by reviewdog 🐶

Suggested change
import logging

@@ -0,0 +1,281 @@
import logging
import json

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[formatters] reported by reviewdog 🐶

Suggested change
import logging
from configparser import SectionProxy
from typing import List, Optional, Union

Comment on lines +7 to +8
from configparser import SectionProxy
from typing import List, Optional, Union
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[formatters] reported by reviewdog 🐶

Suggested change
from configparser import SectionProxy
from typing import List, Optional, Union

self.connect()

def connect(self) -> str:
""" Not needed as metadata services are REST service calls """
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[formatters] reported by reviewdog 🐶

Suggested change
""" Not needed as metadata services are REST service calls """
"""Not needed as metadata services are REST service calls"""

Comment on lines +230 to +234
def list_datasets(
self,
limit: int = 10,
offset: int = 0
) -> list:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[formatters] reported by reviewdog 🐶

Suggested change
def list_datasets(
self,
limit: int = 10,
offset: int = 0
) -> list:
def list_datasets(self, limit: int = 10, offset: int = 0) -> list:

"""
self.host_api = "https://scicrunch.org/api/1/elastic/SPARC_Algolia_pr/_search"

list_url = self.host_api + "?" + "from=" + str(offset) + "&size=" + str(limit) + "&key=" + self.scicrunch_api_key
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[formatters] reported by reviewdog 🐶

Suggested change
list_url = self.host_api + "?" + "from=" + str(offset) + "&size=" + str(limit) + "&key=" + self.scicrunch_api_key
list_url = (
self.host_api
+ "?"
+ "from="
+ str(offset)
+ "&size="
+ str(limit)
+ "&key="
+ self.scicrunch_api_key
)

list_results = self.getURL(list_url, headers=self.default_headers)
return list_results


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[formatters] reported by reviewdog 🐶

Suggested change
def search_datasets(self, query: str = '{"query": { "match_all": {}}}') -> list:
"""Gets datasets matching specified query.

Comment on lines +257 to +263
def search_datasets(
self,
query: str = "{\"query\": { \"match_all\": {}}}"
) -> list:
"""Gets datasets matching specified query.

This function provides
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[formatters] reported by reviewdog 🐶

Suggested change
def search_datasets(
self,
query: str = "{\"query\": { \"match_all\": {}}}"
) -> list:
"""Gets datasets matching specified query.
This function provides
This function provides


list_url = self.host_api + "?" + "key=" + self.scicrunch_api_key

list_results = self.postURL(list_url, body = query, headers=self.default_headers)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[formatters] reported by reviewdog 🐶

Suggested change
list_results = self.postURL(list_url, body = query, headers=self.default_headers)
list_results = self.postURL(list_url, body=query, headers=self.default_headers)

@jgrethe jgrethe requested a review from athril November 30, 2023 18:32
@jgrethe
Copy link
Contributor Author

jgrethe commented Nov 30, 2023

@athril The CI build is failing on a file we haven't touched and is not part of this pull request.

@jgrethe jgrethe closed this Nov 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant