Search is not available for this dataset
identifier
stringlengths
1
155
parameters
stringlengths
2
6.09k
docstring
stringlengths
11
63.4k
docstring_summary
stringlengths
0
63.4k
function
stringlengths
29
99.8k
function_tokens
list
start_point
list
end_point
list
language
stringclasses
1 value
docstring_language
stringlengths
2
7
docstring_language_predictions
stringlengths
18
23
is_langid_reliable
stringclasses
2 values
mdecl_wrapper_t.__init__
(self, decls)
:param decls: list of declarations to operate on. :type decls: list of :class:`declaration wrappers <decl_wrapper_t>`
:param decls: list of declarations to operate on. :type decls: list of :class:`declaration wrappers <decl_wrapper_t>`
def __init__(self, decls): """:param decls: list of declarations to operate on. :type decls: list of :class:`declaration wrappers <decl_wrapper_t>` """ object.__init__(self) self.__dict__['declarations'] = decls
[ "def", "__init__", "(", "self", ",", "decls", ")", ":", "object", ".", "__init__", "(", "self", ")", "self", ".", "__dict__", "[", "'declarations'", "]", "=", "decls" ]
[ 64, 4 ]
[ 69, 45 ]
python
en
['en', 'en', 'en']
True
mdecl_wrapper_t.__len__
(self)
returns the number of declarations
returns the number of declarations
def __len__(self): """returns the number of declarations""" return len(self.declarations)
[ "def", "__len__", "(", "self", ")", ":", "return", "len", "(", "self", ".", "declarations", ")" ]
[ 74, 4 ]
[ 76, 37 ]
python
en
['en', 'en', 'en']
True
mdecl_wrapper_t.__getitem__
(self, index)
provides access to declaration
provides access to declaration
def __getitem__(self, index): """provides access to declaration""" return self.declarations[index]
[ "def", "__getitem__", "(", "self", ",", "index", ")", ":", "return", "self", ".", "declarations", "[", "index", "]" ]
[ 78, 4 ]
[ 80, 39 ]
python
en
['en', 'en', 'en']
True
mdecl_wrapper_t.__setattr__
(self, name, value)
Updates the value of attribute on all declarations. :param name: name of attribute :param value: new value of attribute
Updates the value of attribute on all declarations. :param name: name of attribute :param value: new value of attribute
def __setattr__(self, name, value): """Updates the value of attribute on all declarations. :param name: name of attribute :param value: new value of attribute """ self.__ensure_attribute(name) for d in self.declarations: setattr(d, name, value)
[ "def", "__setattr__", "(", "self", ",", "name", ",", "value", ")", ":", "self", ".", "__ensure_attribute", "(", "name", ")", "for", "d", "in", "self", ".", "declarations", ":", "setattr", "(", "d", ",", "name", ",", "value", ")" ]
[ 93, 4 ]
[ 100, 35 ]
python
en
['en', 'en', 'en']
True
mdecl_wrapper_t.__getattr__
(self, name)
:param name: name of method
:param name: name of method
def __getattr__(self, name): """:param name: name of method """ return call_redirector_t(name, self.declarations)
[ "def", "__getattr__", "(", "self", ",", "name", ")", ":", "return", "call_redirector_t", "(", "name", ",", "self", ".", "declarations", ")" ]
[ 102, 4 ]
[ 105, 57 ]
python
en
['en', 'jv', 'en']
True
FileToPathMapping.comment_out
(self,filename,remove_header)
Get rid of include lines that are redundant
Get rid of include lines that are redundant
def comment_out(self,filename,remove_header): """Get rid of include lines that are redundant""" ff=open(self.filePathBaseDirs[filename]+"/"+filename) outfile=open(self.filePathBaseDirs[filename]+"/"+filename+"_cleaned","w") for line in ff: if line.find(remove_header) != -1: ...
[ "def", "comment_out", "(", "self", ",", "filename", ",", "remove_header", ")", ":", "ff", "=", "open", "(", "self", ".", "filePathBaseDirs", "[", "filename", "]", "+", "\"/\"", "+", "filename", ")", "outfile", "=", "open", "(", "self", ".", "filePathBase...
[ 66, 4 ]
[ 77, 117 ]
python
en
['en', 'en', 'en']
True
test_test_yaml_config_usage_stats_custom_type
( mock_emit, empty_data_context_stats_enabled )
What does this test and why? We should be able to discern the GE parent class for a custom type and construct a useful usage stats event message.
What does this test and why? We should be able to discern the GE parent class for a custom type and construct a useful usage stats event message.
def test_test_yaml_config_usage_stats_custom_type( mock_emit, empty_data_context_stats_enabled ): """ What does this test and why? We should be able to discern the GE parent class for a custom type and construct a useful usage stats event message. """ data_context: DataContext = empty_data_c...
[ "def", "test_test_yaml_config_usage_stats_custom_type", "(", "mock_emit", ",", "empty_data_context_stats_enabled", ")", ":", "data_context", ":", "DataContext", "=", "empty_data_context_stats_enabled", "_", "=", "data_context", ".", "test_yaml_config", "(", "yaml_config", "="...
[ 64, 0 ]
[ 105, 5 ]
python
en
['en', 'error', 'th']
False
test_test_yaml_config_usage_stats_class_name_not_provided
( mock_emit, empty_data_context_stats_enabled )
What does this test and why? If a class_name is not provided, and we have run into an error state in test_yaml_config() (likely because of the missing class_name) then we should report descriptive diagnostic info.
What does this test and why? If a class_name is not provided, and we have run into an error state in test_yaml_config() (likely because of the missing class_name) then we should report descriptive diagnostic info.
def test_test_yaml_config_usage_stats_class_name_not_provided( mock_emit, empty_data_context_stats_enabled ): """ What does this test and why? If a class_name is not provided, and we have run into an error state in test_yaml_config() (likely because of the missing class_name) then we should report descr...
[ "def", "test_test_yaml_config_usage_stats_class_name_not_provided", "(", "mock_emit", ",", "empty_data_context_stats_enabled", ")", ":", "with", "pytest", ".", "raises", "(", "Exception", ")", ":", "# noinspection PyUnusedLocal", "my_expectation_store", "=", "empty_data_context...
[ 111, 0 ]
[ 135, 5 ]
python
en
['en', 'error', 'th']
False
test_test_yaml_config_usage_stats_custom_config_class_name_not_provided
( mock_emit, empty_data_context_stats_enabled )
What does this test and why? If a class_name is not provided, and we have run into an error state in test_yaml_config() (likely because of the missing class_name) then we should report descriptive diagnostic info. This should be the case even if we are passing in a custom config.
What does this test and why? If a class_name is not provided, and we have run into an error state in test_yaml_config() (likely because of the missing class_name) then we should report descriptive diagnostic info. This should be the case even if we are passing in a custom config.
def test_test_yaml_config_usage_stats_custom_config_class_name_not_provided( mock_emit, empty_data_context_stats_enabled ): """ What does this test and why? If a class_name is not provided, and we have run into an error state in test_yaml_config() (likely because of the missing class_name) then we shoul...
[ "def", "test_test_yaml_config_usage_stats_custom_config_class_name_not_provided", "(", "mock_emit", ",", "empty_data_context_stats_enabled", ")", ":", "data_context", ":", "DataContext", "=", "empty_data_context_stats_enabled", "with", "pytest", ".", "raises", "(", "Exception", ...
[ 141, 0 ]
[ 170, 5 ]
python
en
['en', 'error', 'th']
False
test_test_yaml_config_usage_stats_custom_type_not_ge_subclass
( mock_emit, empty_data_context_stats_enabled )
What does this test and why? We should be able to discern the GE parent class for a custom type and construct a useful usage stats event message.
What does this test and why? We should be able to discern the GE parent class for a custom type and construct a useful usage stats event message.
def test_test_yaml_config_usage_stats_custom_type_not_ge_subclass( mock_emit, empty_data_context_stats_enabled ): """ What does this test and why? We should be able to discern the GE parent class for a custom type and construct a useful usage stats event message. """ data_context: DataContex...
[ "def", "test_test_yaml_config_usage_stats_custom_type_not_ge_subclass", "(", "mock_emit", ",", "empty_data_context_stats_enabled", ")", ":", "data_context", ":", "DataContext", "=", "empty_data_context_stats_enabled", "_", "=", "data_context", ".", "test_yaml_config", "(", "yam...
[ 176, 0 ]
[ 202, 5 ]
python
en
['en', 'error', 'th']
False
test_test_yaml_config_usage_stats_simple_sqlalchemy_datasource_subclass
( mock_emit, sa, test_backends, empty_data_context_stats_enabled )
What does this test and why? We should be able to discern the GE parent class for a custom type and construct a useful usage stats event message. This should be true for SimpleSqlalchemyDatasources.
What does this test and why? We should be able to discern the GE parent class for a custom type and construct a useful usage stats event message. This should be true for SimpleSqlalchemyDatasources.
def test_test_yaml_config_usage_stats_simple_sqlalchemy_datasource_subclass( mock_emit, sa, test_backends, empty_data_context_stats_enabled ): """ What does this test and why? We should be able to discern the GE parent class for a custom type and construct a useful usage stats event message. This sh...
[ "def", "test_test_yaml_config_usage_stats_simple_sqlalchemy_datasource_subclass", "(", "mock_emit", ",", "sa", ",", "test_backends", ",", "empty_data_context_stats_enabled", ")", ":", "if", "\"postgresql\"", "not", "in", "test_backends", ":", "pytest", ".", "skip", "(", "...
[ 208, 0 ]
[ 272, 5 ]
python
en
['en', 'error', 'th']
False
InferredAssetFilesystemDataConnector.__init__
( self, name: str, datasource_name: str, base_directory: str, execution_engine: Optional[ExecutionEngine] = None, default_regex: Optional[dict] = None, glob_directive: Optional[str] = "*", sorters: Optional[list] = None, batch_spec_passthrough: Opt...
Base class for DataConnectors that connect to filesystem-like data. This class supports the configuration of default_regex and sorters for filtering and sorting data_references. Args: name (str): name of InferredAssetFilesystemDataConnector datasource_name (str): Name o...
Base class for DataConnectors that connect to filesystem-like data. This class supports the configuration of default_regex and sorters for filtering and sorting data_references.
def __init__( self, name: str, datasource_name: str, base_directory: str, execution_engine: Optional[ExecutionEngine] = None, default_regex: Optional[dict] = None, glob_directive: Optional[str] = "*", sorters: Optional[list] = None, batch_spec_pass...
[ "def", "__init__", "(", "self", ",", "name", ":", "str", ",", "datasource_name", ":", "str", ",", "base_directory", ":", "str", ",", "execution_engine", ":", "Optional", "[", "ExecutionEngine", "]", "=", "None", ",", "default_regex", ":", "Optional", "[", ...
[ 29, 4 ]
[ 65, 45 ]
python
en
['en', 'error', 'th']
False
InferredAssetFilesystemDataConnector._get_data_reference_list
( self, data_asset_name: Optional[str] = None )
List objects in the underlying data store to create a list of data_references. This method is used to refresh the cache.
List objects in the underlying data store to create a list of data_references.
def _get_data_reference_list( self, data_asset_name: Optional[str] = None ) -> List[str]: """ List objects in the underlying data store to create a list of data_references. This method is used to refresh the cache. """ path_list: List[str] = get_filesystem_one_level_...
[ "def", "_get_data_reference_list", "(", "self", ",", "data_asset_name", ":", "Optional", "[", "str", "]", "=", "None", ")", "->", "List", "[", "str", "]", ":", "path_list", ":", "List", "[", "str", "]", "=", "get_filesystem_one_level_directory_glob_path_list", ...
[ 67, 4 ]
[ 78, 32 ]
python
en
['en', 'error', 'th']
False
InferredAssetFilesystemDataConnector.base_directory
(self)
Accessor method for base_directory. If directory is a relative path, interpret it as relative to the root directory. If it is absolute, then keep as-is.
Accessor method for base_directory. If directory is a relative path, interpret it as relative to the root directory. If it is absolute, then keep as-is.
def base_directory(self): """ Accessor method for base_directory. If directory is a relative path, interpret it as relative to the root directory. If it is absolute, then keep as-is. """ return normalize_directory_path( dir_path=self._base_directory, root_...
[ "def", "base_directory", "(", "self", ")", ":", "return", "normalize_directory_path", "(", "dir_path", "=", "self", ".", "_base_directory", ",", "root_directory_path", "=", "self", ".", "data_context_root_directory", ",", ")" ]
[ 86, 4 ]
[ 94, 9 ]
python
en
['en', 'error', 'th']
False
HelloApiView.get
(self, request, format=None)
Returns a list of APIView features.
Returns a list of APIView features.
def get(self, request, format=None): """Returns a list of APIView features.""" an_apiview = [ 'Uses HTTP methods as function (get, post, patch, put, delete)', 'It is similar to a traditional Django view', 'Gives you the most control over your logic', 'Is ...
[ "def", "get", "(", "self", ",", "request", ",", "format", "=", "None", ")", ":", "an_apiview", "=", "[", "'Uses HTTP methods as function (get, post, patch, put, delete)'", ",", "'It is similar to a traditional Django view'", ",", "'Gives you the most control over your logic'", ...
[ 24, 4 ]
[ 34, 72 ]
python
en
['en', 'en', 'en']
True
HelloApiView.post
(self, request)
Create a hello message with our name.
Create a hello message with our name.
def post(self, request): """Create a hello message with our name.""" serializer = serializers.HelloSerializer(data=request.data) if serializer.is_valid(): name = serializer.data.get('name') message = 'Hello {0}'.format(name) return Response({'message': messa...
[ "def", "post", "(", "self", ",", "request", ")", ":", "serializer", "=", "serializers", ".", "HelloSerializer", "(", "data", "=", "request", ".", "data", ")", "if", "serializer", ".", "is_valid", "(", ")", ":", "name", "=", "serializer", ".", "data", "...
[ 36, 4 ]
[ 47, 70 ]
python
en
['en', 'en', 'en']
True
HelloApiView.put
(self, request, pk=None)
Handles updating an object.
Handles updating an object.
def put(self, request, pk=None): """Handles updating an object.""" return Response({'method': 'PUT'})
[ "def", "put", "(", "self", ",", "request", ",", "pk", "=", "None", ")", ":", "return", "Response", "(", "{", "'method'", ":", "'PUT'", "}", ")" ]
[ 49, 4 ]
[ 52, 42 ]
python
en
['en', 'lb', 'en']
True
HelloApiView.patch
(self, request, pk=None)
Patch request, only updates fields provided in the request.
Patch request, only updates fields provided in the request.
def patch(self, request, pk=None): """Patch request, only updates fields provided in the request.""" return Response({'method': 'PATCH'})
[ "def", "patch", "(", "self", ",", "request", ",", "pk", "=", "None", ")", ":", "return", "Response", "(", "{", "'method'", ":", "'PATCH'", "}", ")" ]
[ 54, 4 ]
[ 57, 44 ]
python
en
['en', 'en', 'en']
True
HelloApiView.delete
(self, request, pk=None)
Deletes and object.
Deletes and object.
def delete(self, request, pk=None): """Deletes and object.""" return Response({'method': 'DELETE'})
[ "def", "delete", "(", "self", ",", "request", ",", "pk", "=", "None", ")", ":", "return", "Response", "(", "{", "'method'", ":", "'DELETE'", "}", ")" ]
[ 59, 4 ]
[ 62, 45 ]
python
en
['en', 'en', 'en']
True
HelloViewSet.list
(self, request)
Return a hello message.
Return a hello message.
def list(self, request): """Return a hello message.""" a_viewset = [ 'Uses actions (list, create, retrieve, update, partial_update)', 'Automatically maps to URLs using Routers', 'Provides more functionality with less code.' ] return Response({'messag...
[ "def", "list", "(", "self", ",", "request", ")", ":", "a_viewset", "=", "[", "'Uses actions (list, create, retrieve, update, partial_update)'", ",", "'Automatically maps to URLs using Routers'", ",", "'Provides more functionality with less code.'", "]", "return", "Response", "(...
[ 70, 4 ]
[ 79, 70 ]
python
en
['it', 'en', 'en']
True
HelloViewSet.create
(self, request)
Create a new hello message.
Create a new hello message.
def create(self, request): """Create a new hello message.""" serializer = serializers.HelloSerializer(data=request.data) if serializer.is_valid(): name = serializer.data.get('name') message = 'Hello {0}'.format(name) return Response({'message': message}) ...
[ "def", "create", "(", "self", ",", "request", ")", ":", "serializer", "=", "serializers", ".", "HelloSerializer", "(", "data", "=", "request", ".", "data", ")", "if", "serializer", ".", "is_valid", "(", ")", ":", "name", "=", "serializer", ".", "data", ...
[ 81, 4 ]
[ 92, 70 ]
python
en
['it', 'en', 'en']
True
HelloViewSet.retrieve
(self, request, pk=None)
Handles getting an object by its ID.
Handles getting an object by its ID.
def retrieve(self, request, pk=None): """Handles getting an object by its ID.""" return Response({'http_method': 'GET'})
[ "def", "retrieve", "(", "self", ",", "request", ",", "pk", "=", "None", ")", ":", "return", "Response", "(", "{", "'http_method'", ":", "'GET'", "}", ")" ]
[ 94, 4 ]
[ 97, 47 ]
python
en
['en', 'en', 'en']
True
HelloViewSet.update
(self, request, pk=None)
Handles updating an object.
Handles updating an object.
def update(self, request, pk=None): """Handles updating an object.""" return Response({'http_method': 'PUT'})
[ "def", "update", "(", "self", ",", "request", ",", "pk", "=", "None", ")", ":", "return", "Response", "(", "{", "'http_method'", ":", "'PUT'", "}", ")" ]
[ 99, 4 ]
[ 102, 47 ]
python
en
['en', 'lb', 'en']
True
HelloViewSet.partial_update
(self, request, pk=None)
Handles updating part of an object.
Handles updating part of an object.
def partial_update(self, request, pk=None): """Handles updating part of an object.""" return Response({'http_method': 'PATCH'})
[ "def", "partial_update", "(", "self", ",", "request", ",", "pk", "=", "None", ")", ":", "return", "Response", "(", "{", "'http_method'", ":", "'PATCH'", "}", ")" ]
[ 104, 4 ]
[ 107, 49 ]
python
en
['en', 'en', 'en']
True
HelloViewSet.destroy
(self, request, pk=None)
Handles removing an object.
Handles removing an object.
def destroy(self, request, pk=None): """Handles removing an object.""" return Response({'http_method': 'DELETE'})
[ "def", "destroy", "(", "self", ",", "request", ",", "pk", "=", "None", ")", ":", "return", "Response", "(", "{", "'http_method'", ":", "'DELETE'", "}", ")" ]
[ 109, 4 ]
[ 112, 50 ]
python
en
['en', 'en', 'en']
True
UserProfileFeedViewSet.perform_create
(self, serializer)
Set the user profile to the logged in the user
Set the user profile to the logged in the user
def perform_create(self, serializer): """Set the user profile to the logged in the user""" serializer.save(user_profile=self.request.user)
[ "def", "perform_create", "(", "self", ",", "serializer", ")", ":", "serializer", ".", "save", "(", "user_profile", "=", "self", ".", "request", ".", "user", ")" ]
[ 142, 4 ]
[ 145, 55 ]
python
en
['en', 'en', 'en']
True
ElasticsearchRetriever.__init__
(self, document_store: ElasticsearchDocumentStore, custom_query: str = None)
:param document_store: an instance of a DocumentStore to retrieve documents from. :param custom_query: query string as per Elasticsearch DSL with a mandatory query placeholder(query). Optionally, ES `filter` clause can be added where the values of `terms` are placeholders ...
:param document_store: an instance of a DocumentStore to retrieve documents from. :param custom_query: query string as per Elasticsearch DSL with a mandatory query placeholder(query).
def __init__(self, document_store: ElasticsearchDocumentStore, custom_query: str = None): """ :param document_store: an instance of a DocumentStore to retrieve documents from. :param custom_query: query string as per Elasticsearch DSL with a mandatory query placeholder(query). ...
[ "def", "__init__", "(", "self", ",", "document_store", ":", "ElasticsearchDocumentStore", ",", "custom_query", ":", "str", "=", "None", ")", ":", "self", ".", "document_store", ":", "ElasticsearchDocumentStore", "=", "document_store", "self", ".", "custom_query", ...
[ 17, 4 ]
[ 54, 40 ]
python
en
['en', 'error', 'th']
False
ElasticsearchRetriever.retrieve
(self, query: str, filters: dict = None, top_k: int = 10, index: str = None)
Scan through documents in DocumentStore and return a small number documents that are most relevant to the query. :param query: The query :param filters: A dictionary where the keys specify a metadata field and the value is a list of accepted values for that field :param top_k: ...
Scan through documents in DocumentStore and return a small number documents that are most relevant to the query.
def retrieve(self, query: str, filters: dict = None, top_k: int = 10, index: str = None) -> List[Document]: """ Scan through documents in DocumentStore and return a small number documents that are most relevant to the query. :param query: The query :param filters: A dictionary w...
[ "def", "retrieve", "(", "self", ",", "query", ":", "str", ",", "filters", ":", "dict", "=", "None", ",", "top_k", ":", "int", "=", "10", ",", "index", ":", "str", "=", "None", ")", "->", "List", "[", "Document", "]", ":", "if", "index", "is", "...
[ 56, 4 ]
[ 70, 24 ]
python
en
['en', 'error', 'th']
False
ElasticsearchFilterOnlyRetriever.retrieve
(self, query: str, filters: dict = None, top_k: int = 10, index: str = None)
Scan through documents in DocumentStore and return a small number documents that are most relevant to the query. :param query: The query :param filters: A dictionary where the keys specify a metadata field and the value is a list of accepted values for that field :param top_k: ...
Scan through documents in DocumentStore and return a small number documents that are most relevant to the query.
def retrieve(self, query: str, filters: dict = None, top_k: int = 10, index: str = None) -> List[Document]: """ Scan through documents in DocumentStore and return a small number documents that are most relevant to the query. :param query: The query :param filters: A dictionary w...
[ "def", "retrieve", "(", "self", ",", "query", ":", "str", ",", "filters", ":", "dict", "=", "None", ",", "top_k", ":", "int", "=", "10", ",", "index", ":", "str", "=", "None", ")", "->", "List", "[", "Document", "]", ":", "if", "index", "is", "...
[ 79, 4 ]
[ 93, 24 ]
python
en
['en', 'error', 'th']
False
TfidfRetriever._get_all_paragraphs
(self)
Split the list of documents in paragraphs
Split the list of documents in paragraphs
def _get_all_paragraphs(self) -> List[Paragraph]: """ Split the list of documents in paragraphs """ documents = self.document_store.get_all_documents() paragraphs = [] p_id = 0 for doc in documents: for p in doc.text.split("\n\n"): # TODO: this assum...
[ "def", "_get_all_paragraphs", "(", "self", ")", "->", "List", "[", "Paragraph", "]", ":", "documents", "=", "self", ".", "document_store", ".", "get_all_documents", "(", ")", "paragraphs", "=", "[", "]", "p_id", "=", "0", "for", "doc", "in", "documents", ...
[ 122, 4 ]
[ 139, 25 ]
python
en
['en', 'error', 'th']
False
TfidfRetriever.retrieve
(self, query: str, filters: dict = None, top_k: int = 10, index: str = None)
Scan through documents in DocumentStore and return a small number documents that are most relevant to the query. :param query: The query :param filters: A dictionary where the keys specify a metadata field and the value is a list of accepted values for that field :param top_k: ...
Scan through documents in DocumentStore and return a small number documents that are most relevant to the query.
def retrieve(self, query: str, filters: dict = None, top_k: int = 10, index: str = None) -> List[Document]: """ Scan through documents in DocumentStore and return a small number documents that are most relevant to the query. :param query: The query :param filters: A dictionary w...
[ "def", "retrieve", "(", "self", ",", "query", ":", "str", ",", "filters", ":", "dict", "=", "None", ",", "top_k", ":", "int", "=", "10", ",", "index", ":", "str", "=", "None", ")", "->", "List", "[", "Document", "]", ":", "if", "self", ".", "df...
[ 151, 4 ]
[ 194, 24 ]
python
en
['en', 'error', 'th']
False
TfidfRetriever.fit
(self)
Performing training on this class according to the TF-IDF algorithm.
Performing training on this class according to the TF-IDF algorithm.
def fit(self): """ Performing training on this class according to the TF-IDF algorithm. """ if not self.paragraphs or len(self.paragraphs) == 0: self.paragraphs = self._get_all_paragraphs() if not self.paragraphs or len(self.paragraphs) == 0: logge...
[ "def", "fit", "(", "self", ")", ":", "if", "not", "self", ".", "paragraphs", "or", "len", "(", "self", ".", "paragraphs", ")", "==", "0", ":", "self", ".", "paragraphs", "=", "self", ".", "_get_all_paragraphs", "(", ")", "if", "not", "self", ".", "...
[ 196, 4 ]
[ 208, 74 ]
python
en
['en', 'error', 'th']
False
synthetic_data
(mode=1, n=1000, p=5, sigma=1.0, adj=0.)
Synthetic data in Nie X. and Wager S. (2018) 'Quasi-Oracle Estimation of Heterogeneous Treatment Effects' Args: mode (int, optional): mode of the simulation: \ 1 for difficult nuisance components and an easy treatment effect. \ 2 for a randomized trial. \ 3 for an easy ...
Synthetic data in Nie X. and Wager S. (2018) 'Quasi-Oracle Estimation of Heterogeneous Treatment Effects'
def synthetic_data(mode=1, n=1000, p=5, sigma=1.0, adj=0.): ''' Synthetic data in Nie X. and Wager S. (2018) 'Quasi-Oracle Estimation of Heterogeneous Treatment Effects' Args: mode (int, optional): mode of the simulation: \ 1 for difficult nuisance components and an easy treatment effect. \...
[ "def", "synthetic_data", "(", "mode", "=", "1", ",", "n", "=", "1000", ",", "p", "=", "5", ",", "sigma", "=", "1.0", ",", "adj", "=", "0.", ")", ":", "catalog", "=", "{", "1", ":", "simulate_nuisance_and_easy_treatment", ",", "2", ":", "simulate_rand...
[ 8, 0 ]
[ 42, 42 ]
python
en
['en', 'en', 'en']
True
simulate_nuisance_and_easy_treatment
(n=1000, p=5, sigma=1.0, adj=0.)
Synthetic data with a difficult nuisance components and an easy treatment effect From Setup A in Nie X. and Wager S. (2018) 'Quasi-Oracle Estimation of Heterogeneous Treatment Effects' Args: n (int, optional): number of observations p (int optional): number of covariates (>=5) sigm...
Synthetic data with a difficult nuisance components and an easy treatment effect From Setup A in Nie X. and Wager S. (2018) 'Quasi-Oracle Estimation of Heterogeneous Treatment Effects'
def simulate_nuisance_and_easy_treatment(n=1000, p=5, sigma=1.0, adj=0.): ''' Synthetic data with a difficult nuisance components and an easy treatment effect From Setup A in Nie X. and Wager S. (2018) 'Quasi-Oracle Estimation of Heterogeneous Treatment Effects' Args: n (int, optional): number ...
[ "def", "simulate_nuisance_and_easy_treatment", "(", "n", "=", "1000", ",", "p", "=", "5", ",", "sigma", "=", "1.0", ",", "adj", "=", "0.", ")", ":", "X", "=", "np", ".", "random", ".", "uniform", "(", "size", "=", "n", "*", "p", ")", ".", "reshap...
[ 45, 0 ]
[ 76, 29 ]
python
en
['en', 'en', 'en']
True
simulate_randomized_trial
(n=1000, p=5, sigma=1.0, adj=0.)
Synthetic data of a randomized trial From Setup B in Nie X. and Wager S. (2018) 'Quasi-Oracle Estimation of Heterogeneous Treatment Effects' Args: n (int, optional): number of observations p (int optional): number of covariates (>=5) sigma (float): standard deviation of the error t...
Synthetic data of a randomized trial From Setup B in Nie X. and Wager S. (2018) 'Quasi-Oracle Estimation of Heterogeneous Treatment Effects'
def simulate_randomized_trial(n=1000, p=5, sigma=1.0, adj=0.): ''' Synthetic data of a randomized trial From Setup B in Nie X. and Wager S. (2018) 'Quasi-Oracle Estimation of Heterogeneous Treatment Effects' Args: n (int, optional): number of observations p (int optional): number of cov...
[ "def", "simulate_randomized_trial", "(", "n", "=", "1000", ",", "p", "=", "5", ",", "sigma", "=", "1.0", ",", "adj", "=", "0.", ")", ":", "X", "=", "np", ".", "random", ".", "normal", "(", "size", "=", "n", "*", "p", ")", ".", "reshape", "(", ...
[ 79, 0 ]
[ 109, 29 ]
python
en
['en', 'en', 'en']
True
simulate_easy_propensity_difficult_baseline
(n=1000, p=5, sigma=1.0, adj=0.)
Synthetic data with easy propensity and a difficult baseline From Setup C in Nie X. and Wager S. (2018) 'Quasi-Oracle Estimation of Heterogeneous Treatment Effects' Args: n (int, optional): number of observations p (int optional): number of covariates (>=3) sigma (float): standard ...
Synthetic data with easy propensity and a difficult baseline From Setup C in Nie X. and Wager S. (2018) 'Quasi-Oracle Estimation of Heterogeneous Treatment Effects'
def simulate_easy_propensity_difficult_baseline(n=1000, p=5, sigma=1.0, adj=0.): ''' Synthetic data with easy propensity and a difficult baseline From Setup C in Nie X. and Wager S. (2018) 'Quasi-Oracle Estimation of Heterogeneous Treatment Effects' Args: n (int, optional): number of observatio...
[ "def", "simulate_easy_propensity_difficult_baseline", "(", "n", "=", "1000", ",", "p", "=", "5", ",", "sigma", "=", "1.0", ",", "adj", "=", "0.", ")", ":", "X", "=", "np", ".", "random", ".", "normal", "(", "size", "=", "n", "*", "p", ")", ".", "...
[ 112, 0 ]
[ 141, 29 ]
python
en
['en', 'en', 'en']
True
simulate_unrelated_treatment_control
(n=1000, p=5, sigma=1.0, adj=0.)
Synthetic data with unrelated treatment and control groups. From Setup D in Nie X. and Wager S. (2018) 'Quasi-Oracle Estimation of Heterogeneous Treatment Effects' Args: n (int, optional): number of observations p (int optional): number of covariates (>=3) sigma (float): standard d...
Synthetic data with unrelated treatment and control groups. From Setup D in Nie X. and Wager S. (2018) 'Quasi-Oracle Estimation of Heterogeneous Treatment Effects'
def simulate_unrelated_treatment_control(n=1000, p=5, sigma=1.0, adj=0.): ''' Synthetic data with unrelated treatment and control groups. From Setup D in Nie X. and Wager S. (2018) 'Quasi-Oracle Estimation of Heterogeneous Treatment Effects' Args: n (int, optional): number of observations ...
[ "def", "simulate_unrelated_treatment_control", "(", "n", "=", "1000", ",", "p", "=", "5", ",", "sigma", "=", "1.0", ",", "adj", "=", "0.", ")", ":", "X", "=", "np", ".", "random", ".", "normal", "(", "size", "=", "n", "*", "p", ")", ".", "reshape...
[ 144, 0 ]
[ 175, 29 ]
python
en
['en', 'en', 'en']
True
simulate_hidden_confounder
(n=10000, p=5, sigma=1.0, adj=0.)
Synthetic dataset with a hidden confounder biasing treatment. From Louizos et al. (2018) "Causal Effect Inference with Deep Latent-Variable Models" Args: n (int, optional): number of observations p (int optional): number of covariates (>=3) sigma (float): standard deviation of the ...
Synthetic dataset with a hidden confounder biasing treatment. From Louizos et al. (2018) "Causal Effect Inference with Deep Latent-Variable Models"
def simulate_hidden_confounder(n=10000, p=5, sigma=1.0, adj=0.): ''' Synthetic dataset with a hidden confounder biasing treatment. From Louizos et al. (2018) "Causal Effect Inference with Deep Latent-Variable Models" Args: n (int, optional): number of observations p (int optional): numb...
[ "def", "simulate_hidden_confounder", "(", "n", "=", "10000", ",", "p", "=", "5", ",", "sigma", "=", "1.0", ",", "adj", "=", "0.", ")", ":", "z", "=", "np", ".", "random", ".", "binomial", "(", "1", ",", "0.5", ",", "size", "=", "n", ")", ".", ...
[ 178, 0 ]
[ 209, 29 ]
python
en
['en', 'en', 'en']
True
test_cli_datasource_list
(caplog, empty_data_context, filesystem_csv_2)
Test an empty project and after adding a single datasource.
Test an empty project and after adding a single datasource.
def test_cli_datasource_list(caplog, empty_data_context, filesystem_csv_2): """Test an empty project and after adding a single datasource.""" project_root_dir = empty_data_context.root_directory context = DataContext(project_root_dir) runner = CliRunner(mix_stderr=False) result = runner.invoke( ...
[ "def", "test_cli_datasource_list", "(", "caplog", ",", "empty_data_context", ",", "filesystem_csv_2", ")", ":", "project_root_dir", "=", "empty_data_context", ".", "root_directory", "context", "=", "DataContext", "(", "project_root_dir", ")", "runner", "=", "CliRunner",...
[ 14, 0 ]
[ 83, 60 ]
python
en
['en', 'en', 'en']
True
TesteAvaliacaoUpdateView.form_valid
(self, form, **kwargs)
Preenchimentos dos campos após o utilizador guardar o formulário
Preenchimentos dos campos após o utilizador guardar o formulário
def form_valid(self, form, **kwargs): """ Preenchimentos dos campos após o utilizador guardar o formulário """ form.instance.utilizador = self.request.user form.instance.realizado = True return super().form_valid(form)
[ "def", "form_valid", "(", "self", ",", "form", ",", "*", "*", "kwargs", ")", ":", "form", ".", "instance", ".", "utilizador", "=", "self", ".", "request", ".", "user", "form", ".", "instance", ".", "realizado", "=", "True", "return", "super", "(", ")...
[ 326, 4 ]
[ 333, 39 ]
python
en
['en', 'ja', 'th']
False
_run_on_dask
(jobs, verbose)
Run the tasks in parallel using dask.
Run the tasks in parallel using dask.
def _run_on_dask(jobs, verbose): """Run the tasks in parallel using dask.""" try: import dask except ImportError as ie: ie.msg += ( '\n\nIt seems like `dask` is not installed.\n' 'Please install `dask` and `distributed` using:\n' '\n pip install dask di...
[ "def", "_run_on_dask", "(", "jobs", ",", "verbose", ")", ":", "try", ":", "import", "dask", "except", "ImportError", "as", "ie", ":", "ie", ".", "msg", "+=", "(", "'\\n\\nIt seems like `dask` is not installed.\\n'", "'Please install `dask` and `distributed` using:\\n'",...
[ 216, 0 ]
[ 236, 35 ]
python
en
['en', 'en', 'en']
True
benchmark
(pipelines=None, datasets=None, hyperparameters=None, metrics=METRICS, rank='f1', test_split=False, detrend=False, iterations=1, workers=1, show_progress=False, cache_dir=None, output_path=None, pipeline_dir=None)
Run pipelines on the given datasets and evaluate the performance. The pipelines are used to analyze the given signals and later on the detected anomalies are scored against the known anomalies using the indicated metrics. Finally, the scores obtained with each metric are averaged accross all the signa...
Run pipelines on the given datasets and evaluate the performance.
def benchmark(pipelines=None, datasets=None, hyperparameters=None, metrics=METRICS, rank='f1', test_split=False, detrend=False, iterations=1, workers=1, show_progress=False, cache_dir=None, output_path=None, pipeline_dir=None): """Run pipelines on the given datasets and evaluate the perf...
[ "def", "benchmark", "(", "pipelines", "=", "None", ",", "datasets", "=", "None", ",", "hyperparameters", "=", "None", ",", "metrics", "=", "METRICS", ",", "rank", "=", "'f1'", ",", "test_split", "=", "False", ",", "detrend", "=", "False", ",", "iteration...
[ 239, 0 ]
[ 375, 51 ]
python
en
['en', 'en', 'en']
True
git_add
(filename: str)
Use `git add` to stage a single file.
Use `git add` to stage a single file.
def git_add(filename: str) -> None: """ Use `git add` to stage a single file. """ run(['git', 'add', '--', filename])
[ "def", "git_add", "(", "filename", ":", "str", ")", "->", "None", ":", "run", "(", "[", "'git'", ",", "'add'", ",", "'--'", ",", "filename", "]", ")" ]
[ 20, 0 ]
[ 25, 39 ]
python
en
['en', 'error', 'th']
False
git_check_clean
(allow_staged: bool = False)
Use `git status --porcelain` to check if the working tree is dirty. If allow_staged is True, allow staged files, but no unstaged changes.
Use `git status --porcelain` to check if the working tree is dirty. If allow_staged is True, allow staged files, but no unstaged changes.
def git_check_clean(allow_staged: bool = False) -> None: """ Use `git status --porcelain` to check if the working tree is dirty. If allow_staged is True, allow staged files, but no unstaged changes. """ out = run_capture(['git', 'status', '--porcelain']) if out: # Can we allow staged ch...
[ "def", "git_check_clean", "(", "allow_staged", ":", "bool", "=", "False", ")", "->", "None", ":", "out", "=", "run_capture", "(", "[", "'git'", ",", "'status'", ",", "'--porcelain'", "]", ")", "if", "out", ":", "# Can we allow staged changes?", "if", "not", ...
[ 28, 0 ]
[ 52, 48 ]
python
en
['en', 'error', 'th']
False
create_proxy_zip
(proxy_string, proxy_user, proxy_pass)
Implementation of https://stackoverflow.com/a/35293284 for https://stackoverflow.com/questions/12848327/ (Run Selenium on a proxy server that requires authentication.) Solution involves creating & adding a Chrome extension on the fly. * CHROME-ONLY for now! *
Implementation of https://stackoverflow.com/a/35293284 for https://stackoverflow.com/questions/12848327/ (Run Selenium on a proxy server that requires authentication.) Solution involves creating & adding a Chrome extension on the fly. * CHROME-ONLY for now! *
def create_proxy_zip(proxy_string, proxy_user, proxy_pass): """ Implementation of https://stackoverflow.com/a/35293284 for https://stackoverflow.com/questions/12848327/ (Run Selenium on a proxy server that requires authentication.) Solution involves creating & adding a Chrome extension on th...
[ "def", "create_proxy_zip", "(", "proxy_string", ",", "proxy_user", ",", "proxy_pass", ")", ":", "proxy_host", "=", "proxy_string", ".", "split", "(", "':'", ")", "[", "0", "]", "proxy_port", "=", "proxy_string", ".", "split", "(", "':'", ")", "[", "1", "...
[ 11, 0 ]
[ 79, 18 ]
python
en
['en', 'en', 'en']
True
remove_proxy_zip_if_present
()
Remove Chrome extension zip file used for proxy server authentication. Used in the implementation of https://stackoverflow.com/a/35293284 for https://stackoverflow.com/questions/12848327/
Remove Chrome extension zip file used for proxy server authentication. Used in the implementation of https://stackoverflow.com/a/35293284 for https://stackoverflow.com/questions/12848327/
def remove_proxy_zip_if_present(): """ Remove Chrome extension zip file used for proxy server authentication. Used in the implementation of https://stackoverflow.com/a/35293284 for https://stackoverflow.com/questions/12848327/ """ try: if os.path.exists(PROXY_ZIP_PATH): o...
[ "def", "remove_proxy_zip_if_present", "(", ")", ":", "try", ":", "if", "os", ".", "path", ".", "exists", "(", "PROXY_ZIP_PATH", ")", ":", "os", ".", "remove", "(", "PROXY_ZIP_PATH", ")", "elif", "os", ".", "path", ".", "exists", "(", "PROXY_ZIP_PATH_2", ...
[ 82, 0 ]
[ 93, 12 ]
python
en
['en', 'en', 'en']
True
RebolLexer.analyse_text
(text)
Check if code contains REBOL header and so it probably not R code
Check if code contains REBOL header and so it probably not R code
def analyse_text(text): """ Check if code contains REBOL header and so it probably not R code """ if re.match(r'^\s*REBOL\s*\[', text, re.IGNORECASE): # The code starts with REBOL header return 1.0 elif re.search(r'\s*REBOL\s*[', text, re.IGNORECASE): ...
[ "def", "analyse_text", "(", "text", ")", ":", "if", "re", ".", "match", "(", "r'^\\s*REBOL\\s*\\['", ",", "text", ",", "re", ".", "IGNORECASE", ")", ":", "# The code starts with REBOL header", "return", "1.0", "elif", "re", ".", "search", "(", "r'\\s*REBOL\\s*...
[ 234, 4 ]
[ 243, 22 ]
python
en
['en', 'error', 'th']
False
get_index
(subjects, ra)
Usage: sort input poses by the distance to [mean pose] from train data sorted from large to small :param subjects: e.g. Test set :return: Reversed Index in the Test set
Usage: sort input poses by the distance to [mean pose] from train data sorted from large to small :param subjects: e.g. Test set :return: Reversed Index in the Test set
def get_index(subjects, ra): """ Usage: sort input poses by the distance to [mean pose] from train data sorted from large to small :param subjects: e.g. Test set :return: Reversed Index in the Test set """ train_pose_3d = [] for subject in subjects: # print('subject',subje...
[ "def", "get_index", "(", "subjects", ",", "ra", ")", ":", "train_pose_3d", "=", "[", "]", "for", "subject", "in", "subjects", ":", "# print('subject',subject)", "for", "action", "in", "dataset", "[", "subject", "]", ".", "keys", "(", ")", ":", "# print('ac...
[ 119, 0 ]
[ 165, 17 ]
python
en
['en', 'error', 'th']
False
split_data
(index)
Partition index into a list, make one more dimension :param index: a so long list :return out: splited index, type: List
Partition index into a list, make one more dimension :param index: a so long list :return out: splited index, type: List
def split_data(index): """ Partition index into a list, make one more dimension :param index: a so long list :return out: splited index, type: List """ out = [] j = 0 for i in index: if i < len(index) - 1: if index[i + 1] - index[i] > 5: print('Split i...
[ "def", "split_data", "(", "index", ")", ":", "out", "=", "[", "]", "j", "=", "0", "for", "i", "in", "index", ":", "if", "i", "<", "len", "(", "index", ")", "-", "1", ":", "if", "index", "[", "i", "+", "1", "]", "-", "index", "[", "i", "]"...
[ 187, 0 ]
[ 204, 14 ]
python
en
['en', 'error', 'th']
False
Clock.start_clock
(self)
Do any setup this clock might need. Called at the beginning of the run.
Do any setup this clock might need.
def start_clock(self): """Do any setup this clock might need. Called at the beginning of the run. """
[ "def", "start_clock", "(", "self", ")", ":" ]
[ 15, 4 ]
[ 20, 11 ]
python
en
['en', 'mg', 'en']
True
Clock.current_time
(self)
Return the current time, according to this clock. This is used to implement functions like :func:`trio.current_time` and :func:`trio.move_on_after`. Returns: float: The current time.
Return the current time, according to this clock.
def current_time(self): """Return the current time, according to this clock. This is used to implement functions like :func:`trio.current_time` and :func:`trio.move_on_after`. Returns: float: The current time. """
[ "def", "current_time", "(", "self", ")", ":" ]
[ 23, 4 ]
[ 32, 11 ]
python
en
['en', 'en', 'en']
True
Clock.deadline_to_sleep_time
(self, deadline)
Compute the real time until the given deadline. This is called before we enter a system-specific wait function like :func:`select.select`, to get the timeout to pass. For a clock using wall-time, this should be something like:: return deadline - self.current_time() but of ...
Compute the real time until the given deadline.
def deadline_to_sleep_time(self, deadline): """Compute the real time until the given deadline. This is called before we enter a system-specific wait function like :func:`select.select`, to get the timeout to pass. For a clock using wall-time, this should be something like:: ...
[ "def", "deadline_to_sleep_time", "(", "self", ",", "deadline", ")", ":" ]
[ 35, 4 ]
[ 56, 11 ]
python
en
['en', 'en', 'en']
True
Instrument.before_run
(self)
Called at the beginning of :func:`trio.run`.
Called at the beginning of :func:`trio.run`.
def before_run(self): """Called at the beginning of :func:`trio.run`."""
[ "def", "before_run", "(", "self", ")", ":" ]
[ 69, 4 ]
[ 70, 58 ]
python
en
['en', 'en', 'en']
True
Instrument.after_run
(self)
Called just before :func:`trio.run` returns.
Called just before :func:`trio.run` returns.
def after_run(self): """Called just before :func:`trio.run` returns."""
[ "def", "after_run", "(", "self", ")", ":" ]
[ 72, 4 ]
[ 73, 58 ]
python
en
['en', 'la', 'en']
True
Instrument.task_spawned
(self, task)
Called when the given task is created. Args: task (trio.lowlevel.Task): The new task.
Called when the given task is created.
def task_spawned(self, task): """Called when the given task is created. Args: task (trio.lowlevel.Task): The new task. """
[ "def", "task_spawned", "(", "self", ",", "task", ")", ":" ]
[ 75, 4 ]
[ 81, 11 ]
python
en
['en', 'en', 'en']
True
Instrument.task_scheduled
(self, task)
Called when the given task becomes runnable. It may still be some time before it actually runs, if there are other runnable tasks ahead of it. Args: task (trio.lowlevel.Task): The task that became runnable.
Called when the given task becomes runnable.
def task_scheduled(self, task): """Called when the given task becomes runnable. It may still be some time before it actually runs, if there are other runnable tasks ahead of it. Args: task (trio.lowlevel.Task): The task that became runnable. """
[ "def", "task_scheduled", "(", "self", ",", "task", ")", ":" ]
[ 83, 4 ]
[ 92, 11 ]
python
en
['en', 'en', 'en']
True
Instrument.before_task_step
(self, task)
Called immediately before we resume running the given task. Args: task (trio.lowlevel.Task): The task that is about to run.
Called immediately before we resume running the given task.
def before_task_step(self, task): """Called immediately before we resume running the given task. Args: task (trio.lowlevel.Task): The task that is about to run. """
[ "def", "before_task_step", "(", "self", ",", "task", ")", ":" ]
[ 94, 4 ]
[ 100, 11 ]
python
en
['en', 'en', 'en']
True
Instrument.after_task_step
(self, task)
Called when we return to the main run loop after a task has yielded. Args: task (trio.lowlevel.Task): The task that just ran.
Called when we return to the main run loop after a task has yielded.
def after_task_step(self, task): """Called when we return to the main run loop after a task has yielded. Args: task (trio.lowlevel.Task): The task that just ran. """
[ "def", "after_task_step", "(", "self", ",", "task", ")", ":" ]
[ 102, 4 ]
[ 108, 11 ]
python
en
['en', 'en', 'en']
True
Instrument.task_exited
(self, task)
Called when the given task exits. Args: task (trio.lowlevel.Task): The finished task.
Called when the given task exits.
def task_exited(self, task): """Called when the given task exits. Args: task (trio.lowlevel.Task): The finished task. """
[ "def", "task_exited", "(", "self", ",", "task", ")", ":" ]
[ 110, 4 ]
[ 116, 11 ]
python
en
['en', 'en', 'en']
True
Instrument.before_io_wait
(self, timeout)
Called before blocking to wait for I/O readiness. Args: timeout (float): The number of seconds we are willing to wait.
Called before blocking to wait for I/O readiness.
def before_io_wait(self, timeout): """Called before blocking to wait for I/O readiness. Args: timeout (float): The number of seconds we are willing to wait. """
[ "def", "before_io_wait", "(", "self", ",", "timeout", ")", ":" ]
[ 118, 4 ]
[ 124, 11 ]
python
en
['en', 'en', 'en']
True
Instrument.after_io_wait
(self, timeout)
Called after handling pending I/O. Args: timeout (float): The number of seconds we were willing to wait. This much time may or may not have elapsed, depending on whether any I/O was ready.
Called after handling pending I/O.
def after_io_wait(self, timeout): """Called after handling pending I/O. Args: timeout (float): The number of seconds we were willing to wait. This much time may or may not have elapsed, depending on whether any I/O was ready. """
[ "def", "after_io_wait", "(", "self", ",", "timeout", ")", ":" ]
[ 126, 4 ]
[ 134, 11 ]
python
da
['da', 'da', 'en']
True
HostnameResolver.getaddrinfo
(self, host, port, family=0, type=0, proto=0, flags=0)
A custom implementation of :func:`~trio.socket.getaddrinfo`. Called by :func:`trio.socket.getaddrinfo`. If ``host`` is given as a numeric IP address, then :func:`~trio.socket.getaddrinfo` may handle the request itself rather than calling this method. Any required IDNA encoding...
A custom implementation of :func:`~trio.socket.getaddrinfo`.
async def getaddrinfo(self, host, port, family=0, type=0, proto=0, flags=0): """A custom implementation of :func:`~trio.socket.getaddrinfo`. Called by :func:`trio.socket.getaddrinfo`. If ``host`` is given as a numeric IP address, then :func:`~trio.socket.getaddrinfo` may handle the req...
[ "async", "def", "getaddrinfo", "(", "self", ",", "host", ",", "port", ",", "family", "=", "0", ",", "type", "=", "0", ",", "proto", "=", "0", ",", "flags", "=", "0", ")", ":" ]
[ 148, 4 ]
[ 162, 11 ]
python
en
['en', 'sv', 'en']
True
HostnameResolver.getnameinfo
(self, sockaddr, flags)
A custom implementation of :func:`~trio.socket.getnameinfo`. Called by :func:`trio.socket.getnameinfo`.
A custom implementation of :func:`~trio.socket.getnameinfo`.
async def getnameinfo(self, sockaddr, flags): """A custom implementation of :func:`~trio.socket.getnameinfo`. Called by :func:`trio.socket.getnameinfo`. """
[ "async", "def", "getnameinfo", "(", "self", ",", "sockaddr", ",", "flags", ")", ":" ]
[ 165, 4 ]
[ 170, 11 ]
python
en
['en', 'en', 'en']
True
SocketFactory.socket
(self, family=None, type=None, proto=None)
Create and return a socket object. Your socket object must inherit from :class:`trio.socket.SocketType`, which is an empty class whose only purpose is to "mark" which classes should be considered valid Trio sockets. Called by :func:`trio.socket.socket`. Note that unlike :func:...
Create and return a socket object.
def socket(self, family=None, type=None, proto=None): """Create and return a socket object. Your socket object must inherit from :class:`trio.socket.SocketType`, which is an empty class whose only purpose is to "mark" which classes should be considered valid Trio sockets. Calle...
[ "def", "socket", "(", "self", ",", "family", "=", "None", ",", "type", "=", "None", ",", "proto", "=", "None", ")", ":" ]
[ 182, 4 ]
[ 196, 11 ]
python
en
['en', 'ig', 'en']
True
AsyncResource.aclose
(self)
Close this resource, possibly blocking. IMPORTANT: This method may block in order to perform a "graceful" shutdown. But, if this fails, then it still *must* close any underlying resources before returning. An error from this method indicates a failure to achieve grace, *not* a failure t...
Close this resource, possibly blocking.
async def aclose(self): """Close this resource, possibly blocking. IMPORTANT: This method may block in order to perform a "graceful" shutdown. But, if this fails, then it still *must* close any underlying resources before returning. An error from this method indicates a failure ...
[ "async", "def", "aclose", "(", "self", ")", ":" ]
[ 228, 4 ]
[ 254, 11 ]
python
en
['en', 'en', 'en']
True
SendStream.send_all
(self, data)
Sends the given data through the stream, blocking if necessary. Args: data (bytes, bytearray, or memoryview): The data to send. Raises: trio.BusyResourceError: if another task is already executing a :meth:`send_all`, :meth:`wait_send_all_might_not_block`, or ...
Sends the given data through the stream, blocking if necessary.
async def send_all(self, data): """Sends the given data through the stream, blocking if necessary. Args: data (bytes, bytearray, or memoryview): The data to send. Raises: trio.BusyResourceError: if another task is already executing a :meth:`send_all`, :meth:`w...
[ "async", "def", "send_all", "(", "self", ",", "data", ")", ":" ]
[ 282, 4 ]
[ 305, 11 ]
python
en
['en', 'en', 'en']
True
SendStream.wait_send_all_might_not_block
(self)
Block until it's possible that :meth:`send_all` might not block. This method may return early: it's possible that after it returns, :meth:`send_all` will still block. (In the worst case, if no better implementation is available, then it might always return immediately without blocking. ...
Block until it's possible that :meth:`send_all` might not block.
async def wait_send_all_might_not_block(self): """Block until it's possible that :meth:`send_all` might not block. This method may return early: it's possible that after it returns, :meth:`send_all` will still block. (In the worst case, if no better implementation is available, then it ...
[ "async", "def", "wait_send_all_might_not_block", "(", "self", ")", ":" ]
[ 308, 4 ]
[ 361, 11 ]
python
en
['en', 'en', 'en']
True
ReceiveStream.receive_some
(self, max_bytes=None)
Wait until there is data available on this stream, and then return some of it. A return value of ``b""`` (an empty bytestring) indicates that the stream has reached end-of-file. Implementations should be careful that they return ``b""`` if, and only if, the stream has reached en...
Wait until there is data available on this stream, and then return some of it.
async def receive_some(self, max_bytes=None): """Wait until there is data available on this stream, and then return some of it. A return value of ``b""`` (an empty bytestring) indicates that the stream has reached end-of-file. Implementations should be careful that they return `...
[ "async", "def", "receive_some", "(", "self", ",", "max_bytes", "=", "None", ")", ":" ]
[ 388, 4 ]
[ 414, 11 ]
python
en
['en', 'en', 'en']
True
HalfCloseableStream.send_eof
(self)
Send an end-of-file indication on this stream, if possible. The difference between :meth:`send_eof` and :meth:`~AsyncResource.aclose` is that :meth:`send_eof` is a *unidirectional* end-of-file indication. After you call this method, you shouldn't try sending any more data on this stream...
Send an end-of-file indication on this stream, if possible.
async def send_eof(self): """Send an end-of-file indication on this stream, if possible. The difference between :meth:`send_eof` and :meth:`~AsyncResource.aclose` is that :meth:`send_eof` is a *unidirectional* end-of-file indication. After you call this method, you shouldn't try...
[ "async", "def", "send_eof", "(", "self", ")", ":" ]
[ 449, 4 ]
[ 495, 11 ]
python
en
['en', 'en', 'en']
True
Listener.accept
(self)
Wait until an incoming connection arrives, and then return it. Returns: AsyncResource: An object representing the incoming connection. In practice this is generally some kind of :class:`Stream`, but in principle you could also define a :class:`Listener` that returned, sa...
Wait until an incoming connection arrives, and then return it.
async def accept(self): """Wait until an incoming connection arrives, and then return it. Returns: AsyncResource: An object representing the incoming connection. In practice this is generally some kind of :class:`Stream`, but in principle you could also define a :class:`Li...
[ "async", "def", "accept", "(", "self", ")", ":" ]
[ 528, 4 ]
[ 552, 11 ]
python
en
['en', 'en', 'en']
True
SendChannel.send
(self, value: SendType)
Attempt to send an object through the channel, blocking if necessary. Args: value (object): The object to send. Raises: trio.BrokenResourceError: if something has gone wrong, and the channel is broken. For example, you may get this if the receiver has al...
Attempt to send an object through the channel, blocking if necessary.
async def send(self, value: SendType) -> None: """Attempt to send an object through the channel, blocking if necessary. Args: value (object): The object to send. Raises: trio.BrokenResourceError: if something has gone wrong, and the channel is broken. For exam...
[ "async", "def", "send", "(", "self", ",", "value", ":", "SendType", ")", "->", "None", ":" ]
[ 570, 4 ]
[ 588, 11 ]
python
en
['en', 'en', 'en']
True
ReceiveChannel.receive
(self)
Attempt to receive an incoming object, blocking if necessary. Returns: object: Whatever object was received. Raises: trio.EndOfChannel: if the sender has been closed cleanly, and no more objects are coming. This is not an error condition. trio.ClosedResource...
Attempt to receive an incoming object, blocking if necessary.
async def receive(self) -> ReceiveType: """Attempt to receive an incoming object, blocking if necessary. Returns: object: Whatever object was received. Raises: trio.EndOfChannel: if the sender has been closed cleanly, and no more objects are coming. This is no...
[ "async", "def", "receive", "(", "self", ")", "->", "ReceiveType", ":" ]
[ 615, 4 ]
[ 633, 11 ]
python
en
['en', 'en', 'en']
True
ExpectColumnMaxToBeBetween.validate_configuration
(self, configuration: Optional[ExpectationConfiguration])
Validates that a configuration has been set, and sets a configuration if it has yet to be set. Ensures that necessary configuration arguments have been provided for the validation of the expectation. Args: configuration (OPTIONAL[ExpectationConfiguration]): \ An opt...
Validates that a configuration has been set, and sets a configuration if it has yet to be set. Ensures that necessary configuration arguments have been provided for the validation of the expectation.
def validate_configuration(self, configuration: Optional[ExpectationConfiguration]): """ Validates that a configuration has been set, and sets a configuration if it has yet to be set. Ensures that necessary configuration arguments have been provided for the validation of the expectation. ...
[ "def", "validate_configuration", "(", "self", ",", "configuration", ":", "Optional", "[", "ExpectationConfiguration", "]", ")", ":", "super", "(", ")", ".", "validate_configuration", "(", "configuration", ")", "self", ".", "validate_metric_value_between_configuration", ...
[ 119, 4 ]
[ 131, 85 ]
python
en
['en', 'error', 'th']
False
test_snowflake_user_password_credentials_exit
(empty_data_context)
Test an empty project and after adding a single datasource.
Test an empty project and after adding a single datasource.
def test_snowflake_user_password_credentials_exit(empty_data_context): """Test an empty project and after adding a single datasource.""" project_root_dir = empty_data_context.root_directory context = DataContext(project_root_dir) runner = CliRunner(mix_stderr=False) result = runner.invoke( ...
[ "def", "test_snowflake_user_password_credentials_exit", "(", "empty_data_context", ")", ":", "project_root_dir", "=", "empty_data_context", ".", "root_directory", "context", "=", "DataContext", "(", "project_root_dir", ")", "runner", "=", "CliRunner", "(", "mix_stderr", "...
[ 13, 0 ]
[ 27, 46 ]
python
en
['en', 'en', 'en']
True
_execute_integration_test
(test_configuration, tmp_path)
Prepare and environment and run integration tests from a list of tests. Note that the only required parameter for a test in the matrix is `user_flow_script` and that all other parameters are optional.
Prepare and environment and run integration tests from a list of tests.
def _execute_integration_test(test_configuration, tmp_path): """ Prepare and environment and run integration tests from a list of tests. Note that the only required parameter for a test in the matrix is `user_flow_script` and that all other parameters are optional. """ assert ( "user_fl...
[ "def", "_execute_integration_test", "(", "test_configuration", ",", "tmp_path", ")", ":", "assert", "(", "\"user_flow_script\"", "in", "test_configuration", ".", "keys", "(", ")", ")", ",", "\"a `user_flow_script` is required\"", "workdir", "=", "os", ".", "getcwd", ...
[ 238, 0 ]
[ 325, 25 ]
python
en
['en', 'error', 'th']
False
_check_for_skipped_tests
(pytest_args, test_configuration)
Enable scripts to be skipped based on pytest invocation flags.
Enable scripts to be skipped based on pytest invocation flags.
def _check_for_skipped_tests(pytest_args, test_configuration) -> None: """Enable scripts to be skipped based on pytest invocation flags.""" dependencies = test_configuration.get("extra_backend_dependencies", None) if not dependencies: return elif dependencies == BackendDependencies.POSTGRESQL an...
[ "def", "_check_for_skipped_tests", "(", "pytest_args", ",", "test_configuration", ")", "->", "None", ":", "dependencies", "=", "test_configuration", ".", "get", "(", "\"extra_backend_dependencies\"", ",", "None", ")", "if", "not", "dependencies", ":", "return", "eli...
[ 328, 0 ]
[ 352, 47 ]
python
en
['en', 'en', 'en']
True
SimpleSemanticTypeColumnDomainBuilder.__init__
( self, data_context: DataContext, batch_request: Optional[Union[BatchRequest, dict]] = None, semantic_types: Optional[ Union[str, SemanticDomainTypes, List[Union[str, SemanticDomainTypes]]] ] = None, )
Args: data_context: DataContext batch_request: specified in DomainBuilder configuration to get Batch objects for domain computation.
Args: data_context: DataContext batch_request: specified in DomainBuilder configuration to get Batch objects for domain computation.
def __init__( self, data_context: DataContext, batch_request: Optional[Union[BatchRequest, dict]] = None, semantic_types: Optional[ Union[str, SemanticDomainTypes, List[Union[str, SemanticDomainTypes]]] ] = None, ): """ Args: data_conte...
[ "def", "__init__", "(", "self", ",", "data_context", ":", "DataContext", ",", "batch_request", ":", "Optional", "[", "Union", "[", "BatchRequest", ",", "dict", "]", "]", "=", "None", ",", "semantic_types", ":", "Optional", "[", "Union", "[", "str", ",", ...
[ 22, 4 ]
[ 43, 45 ]
python
en
['en', 'error', 'th']
False
SimpleSemanticTypeColumnDomainBuilder._get_domains
( self, variables: Optional[ParameterContainer] = None, )
Find the semantic column type for each column and return all domains matching the specified type or types.
Find the semantic column type for each column and return all domains matching the specified type or types.
def _get_domains( self, variables: Optional[ParameterContainer] = None, ) -> List[Domain]: """ Find the semantic column type for each column and return all domains matching the specified type or types. """ semantic_types: List[ SemanticDomainTypes ...
[ "def", "_get_domains", "(", "self", ",", "variables", ":", "Optional", "[", "ParameterContainer", "]", "=", "None", ",", ")", "->", "List", "[", "Domain", "]", ":", "semantic_types", ":", "List", "[", "SemanticDomainTypes", "]", "=", "_parse_semantic_domain_ty...
[ 45, 4 ]
[ 123, 22 ]
python
en
['en', 'error', 'th']
False
FARMReader.__init__
( self, model_name_or_path: Union[str, Path], model_version: Optional[str] = None, context_window_size: int = 150, batch_size: int = 50, use_gpu: bool = True, no_ans_boost: float = 0.0, return_no_answer: bool = False, top_k_per_candidate: int = 3, ...
:param model_name_or_path: Directory of a saved model or the name of a public model e.g. 'bert-base-cased', 'deepset/bert-base-cased-squad2', 'deepset/bert-base-cased-squad2', 'distilbert-base-uncased-distilled-squad'. See https://huggingface.co/models for full list of available models. ...
:param model_name_or_path: Directory of a saved model or the name of a public model e.g. 'bert-base-cased', 'deepset/bert-base-cased-squad2', 'deepset/bert-base-cased-squad2', 'distilbert-base-uncased-distilled-squad'. See https://huggingface.co/models for full list of available models. ...
def __init__( self, model_name_or_path: Union[str, Path], model_version: Optional[str] = None, context_window_size: int = 150, batch_size: int = 50, use_gpu: bool = True, no_ans_boost: float = 0.0, return_no_answer: bool = False, top_k_per_candidat...
[ "def", "__init__", "(", "self", ",", "model_name_or_path", ":", "Union", "[", "str", ",", "Path", "]", ",", "model_version", ":", "Optional", "[", "str", "]", "=", "None", ",", "context_window_size", ":", "int", "=", "150", ",", "batch_size", ":", "int",...
[ 40, 4 ]
[ 108, 40 ]
python
en
['en', 'error', 'th']
False
FARMReader.train
( self, data_dir: str, train_filename: str, dev_filename: Optional[str] = None, test_filename: Optional[str] = None, use_gpu: Optional[bool] = None, batch_size: int = 10, n_epochs: int = 2, learning_rate: float = 1e-5, max_seq_len: Optional...
Fine-tune a model on a QA dataset. Options: - Take a plain language model (e.g. `bert-base-cased`) and train it for QA (e.g. on SQuAD data) - Take a QA model (e.g. `deepset/bert-base-cased-squad2`) and fine-tune it for your domain (e.g. using your labels collected via the haystack annotation t...
Fine-tune a model on a QA dataset. Options:
def train( self, data_dir: str, train_filename: str, dev_filename: Optional[str] = None, test_filename: Optional[str] = None, use_gpu: Optional[bool] = None, batch_size: int = 10, n_epochs: int = 2, learning_rate: float = 1e-5, max_seq_len:...
[ "def", "train", "(", "self", ",", "data_dir", ":", "str", ",", "train_filename", ":", "str", ",", "dev_filename", ":", "Optional", "[", "str", "]", "=", "None", ",", "test_filename", ":", "Optional", "[", "str", "]", "=", "None", ",", "use_gpu", ":", ...
[ 110, 4 ]
[ 238, 33 ]
python
en
['en', 'error', 'th']
False
FARMReader.update_parameters
( self, context_window_size: Optional[int] = None, no_ans_boost: Optional[float] = None, return_no_answer: Optional[bool] = None, max_seq_len: Optional[int] = None, doc_stride: Optional[int] = None, )
Hot update parameters of a loaded Reader. It may not to be safe when processing concurrent requests.
Hot update parameters of a loaded Reader. It may not to be safe when processing concurrent requests.
def update_parameters( self, context_window_size: Optional[int] = None, no_ans_boost: Optional[float] = None, return_no_answer: Optional[bool] = None, max_seq_len: Optional[int] = None, doc_stride: Optional[int] = None, ): """ Hot update parameters of ...
[ "def", "update_parameters", "(", "self", ",", "context_window_size", ":", "Optional", "[", "int", "]", "=", "None", ",", "no_ans_boost", ":", "Optional", "[", "float", "]", "=", "None", ",", "return_no_answer", ":", "Optional", "[", "bool", "]", "=", "None...
[ 240, 4 ]
[ 261, 42 ]
python
en
['en', 'error', 'th']
False
FARMReader.save
(self, directory: Path)
Saves the Reader model so that it can be reused at a later point in time. :param directory: Directory where the Reader model should be saved
Saves the Reader model so that it can be reused at a later point in time.
def save(self, directory: Path): """ Saves the Reader model so that it can be reused at a later point in time. :param directory: Directory where the Reader model should be saved """ logger.info(f"Saving reader model to {directory}") self.inferencer.model.save(directory) ...
[ "def", "save", "(", "self", ",", "directory", ":", "Path", ")", ":", "logger", ".", "info", "(", "f\"Saving reader model to {directory}\"", ")", "self", ".", "inferencer", ".", "model", ".", "save", "(", "directory", ")", "self", ".", "inferencer", ".", "p...
[ 263, 4 ]
[ 271, 49 ]
python
en
['en', 'error', 'th']
False
FARMReader.predict_batch
(self, query_doc_list: List[dict], top_k: int = None, batch_size: int = None)
Use loaded QA model to find answers for a list of queries in each query's supplied list of Document. Returns list of dictionaries containing answers sorted by (desc.) probability :param query_doc_list: List of dictionaries containing queries with their retrieved documents :param top_k...
Use loaded QA model to find answers for a list of queries in each query's supplied list of Document.
def predict_batch(self, query_doc_list: List[dict], top_k: int = None, batch_size: int = None): """ Use loaded QA model to find answers for a list of queries in each query's supplied list of Document. Returns list of dictionaries containing answers sorted by (desc.) probability :param ...
[ "def", "predict_batch", "(", "self", ",", "query_doc_list", ":", "List", "[", "dict", "]", ",", "top_k", ":", "int", "=", "None", ",", "batch_size", ":", "int", "=", "None", ")", ":", "# convert input to FARM format", "inputs", "=", "[", "]", "number_of_do...
[ 273, 4 ]
[ 330, 21 ]
python
en
['en', 'error', 'th']
False
FARMReader.predict
(self, query: str, documents: List[Document], top_k: Optional[int] = None)
Use loaded QA model to find answers for a query in the supplied list of Document. Returns dictionaries containing answers sorted by (desc.) probability. Example: ```python |{ | 'query': 'Who is the father of Arya Stark?', | 'answers':[ ...
Use loaded QA model to find answers for a query in the supplied list of Document.
def predict(self, query: str, documents: List[Document], top_k: Optional[int] = None): """ Use loaded QA model to find answers for a query in the supplied list of Document. Returns dictionaries containing answers sorted by (desc.) probability. Example: ```python |{ ...
[ "def", "predict", "(", "self", ",", "query", ":", "str", ",", "documents", ":", "List", "[", "Document", "]", ",", "top_k", ":", "Optional", "[", "int", "]", "=", "None", ")", ":", "# convert input to FARM format", "inputs", "=", "[", "]", "for", "doc"...
[ 332, 4 ]
[ 379, 21 ]
python
en
['en', 'error', 'th']
False
FARMReader.eval_on_file
(self, data_dir: str, test_filename: str, device: str)
Performs evaluation on a SQuAD-formatted file. Returns a dict containing the following metrics: - "EM": exact match score - "f1": F1-Score - "top_n_accuracy": Proportion of predicted answers that overlap with correct answer :param data_dir: The directory in ...
Performs evaluation on a SQuAD-formatted file. Returns a dict containing the following metrics: - "EM": exact match score - "f1": F1-Score - "top_n_accuracy": Proportion of predicted answers that overlap with correct answer
def eval_on_file(self, data_dir: str, test_filename: str, device: str): """ Performs evaluation on a SQuAD-formatted file. Returns a dict containing the following metrics: - "EM": exact match score - "f1": F1-Score - "top_n_accuracy": Proportion of predicted a...
[ "def", "eval_on_file", "(", "self", ",", "data_dir", ":", "str", ",", "test_filename", ":", "str", ",", "device", ":", "str", ")", ":", "eval_processor", "=", "SquadProcessor", "(", "tokenizer", "=", "self", ".", "inferencer", ".", "processor", ".", "token...
[ 381, 4 ]
[ 419, 22 ]
python
en
['en', 'error', 'th']
False
FARMReader.eval
( self, document_store: BaseDocumentStore, device: str, label_index: str = "label", doc_index: str = "eval_document", label_origin: str = "gold_label", )
Performs evaluation on evaluation documents in the DocumentStore. Returns a dict containing the following metrics: - "EM": Proportion of exact matches of predicted answers with their corresponding correct answers - "f1": Average overlap between predicted answers and their co...
Performs evaluation on evaluation documents in the DocumentStore. Returns a dict containing the following metrics: - "EM": Proportion of exact matches of predicted answers with their corresponding correct answers - "f1": Average overlap between predicted answers and their co...
def eval( self, document_store: BaseDocumentStore, device: str, label_index: str = "label", doc_index: str = "eval_document", label_origin: str = "gold_label", ): """ Performs evaluation on evaluation documents in the DocumentSt...
[ "def", "eval", "(", "self", ",", "document_store", ":", "BaseDocumentStore", ",", "device", ":", "str", ",", "label_index", ":", "str", "=", "\"label\"", ",", "doc_index", ":", "str", "=", "\"eval_document\"", ",", "label_origin", ":", "str", "=", "\"gold_la...
[ 421, 4 ]
[ 533, 22 ]
python
en
['en', 'error', 'th']
False
FARMReader.predict_on_texts
(self, question: str, texts: List[str], top_k: Optional[int] = None)
Use loaded QA model to find answers for a question in the supplied list of Document. Returns dictionaries containing answers sorted by (desc.) probability. Example: ```python |{ | 'question': 'Who is the father of Arya Stark?', | 'answers':[ ...
Use loaded QA model to find answers for a question in the supplied list of Document. Returns dictionaries containing answers sorted by (desc.) probability. Example: ```python |{ | 'question': 'Who is the father of Arya Stark?', | 'answers':[ ...
def predict_on_texts(self, question: str, texts: List[str], top_k: Optional[int] = None): """ Use loaded QA model to find answers for a question in the supplied list of Document. Returns dictionaries containing answers sorted by (desc.) probability. Example: ```python ...
[ "def", "predict_on_texts", "(", "self", ",", "question", ":", "str", ",", "texts", ":", "List", "[", "str", "]", ",", "top_k", ":", "Optional", "[", "int", "]", "=", "None", ")", ":", "documents", "=", "[", "]", "for", "text", "in", "texts", ":", ...
[ 597, 4 ]
[ 631, 26 ]
python
en
['en', 'error', 'th']
False
FARMReader.convert_to_onnx
( cls, model_name: str, output_path: Path, convert_to_float16: bool = False, quantize: bool = False, task_type: str = "question_answering", opset_version: int = 11 )
Convert a PyTorch BERT model to ONNX format and write to ./onnx-export dir. The converted ONNX model can be loaded with in the `FARMReader` using the export path as `model_name_or_path` param. Usage: `from haystack.reader.farm import FARMReader from pathlib import Path...
Convert a PyTorch BERT model to ONNX format and write to ./onnx-export dir. The converted ONNX model can be loaded with in the `FARMReader` using the export path as `model_name_or_path` param.
def convert_to_onnx( cls, model_name: str, output_path: Path, convert_to_float16: bool = False, quantize: bool = False, task_type: str = "question_answering", opset_version: int = 11 ): """ Convert a PyTorch BERT mod...
[ "def", "convert_to_onnx", "(", "cls", ",", "model_name", ":", "str", ",", "output_path", ":", "Path", ",", "convert_to_float16", ":", "bool", "=", "False", ",", "quantize", ":", "bool", "=", "False", ",", "task_type", ":", "str", "=", "\"question_answering\"...
[ 634, 4 ]
[ 671, 9 ]
python
en
['en', 'error', 'th']
False
ExpectColumnMeanToBeBetween.validate_configuration
(self, configuration: Optional[ExpectationConfiguration])
Validates that a configuration has been set, and sets a configuration if it has yet to be set. Ensures that necessary configuration arguments have been provided for the validation of the expectation. Args: configuration (OPTIONAL[ExpectationConfiguration]): \ An opt...
Validates that a configuration has been set, and sets a configuration if it has yet to be set. Ensures that necessary configuration arguments have been provided for the validation of the expectation.
def validate_configuration(self, configuration: Optional[ExpectationConfiguration]): """ Validates that a configuration has been set, and sets a configuration if it has yet to be set. Ensures that necessary configuration arguments have been provided for the validation of the expectation. ...
[ "def", "validate_configuration", "(", "self", ",", "configuration", ":", "Optional", "[", "ExpectationConfiguration", "]", ")", ":", "super", "(", ")", ".", "validate_configuration", "(", "configuration", ")", "self", ".", "validate_metric_value_between_configuration", ...
[ 100, 4 ]
[ 112, 85 ]
python
en
['en', 'error', 'th']
False
get_domain_url
(url)
Use this to convert a url like this: https://blog.xkcd.com/2014/07/22/what-if-book-tour/ Into this: https://blog.xkcd.com
Use this to convert a url like this: https://blog.xkcd.com/2014/07/22/what-if-book-tour/ Into this: https://blog.xkcd.com
def get_domain_url(url): """ Use this to convert a url like this: https://blog.xkcd.com/2014/07/22/what-if-book-tour/ Into this: https://blog.xkcd.com """ if not url.startswith("http://") and not url.startswith("https://"): return url url_header = url.split('://')[0] simple_u...
[ "def", "get_domain_url", "(", "url", ")", ":", "if", "not", "url", ".", "startswith", "(", "\"http://\"", ")", "and", "not", "url", ".", "startswith", "(", "\"https://\"", ")", ":", "return", "url", "url_header", "=", "url", ".", "split", "(", "'://'", ...
[ 8, 0 ]
[ 21, 21 ]
python
en
['en', 'error', 'th']
False
is_xpath_selector
(selector)
A basic method to determine if a selector is an xpath selector.
A basic method to determine if a selector is an xpath selector.
def is_xpath_selector(selector): """ A basic method to determine if a selector is an xpath selector. """ if (selector.startswith('/') or selector.startswith('./') or ( selector.startswith('('))): return True return False
[ "def", "is_xpath_selector", "(", "selector", ")", ":", "if", "(", "selector", ".", "startswith", "(", "'/'", ")", "or", "selector", ".", "startswith", "(", "'./'", ")", "or", "(", "selector", ".", "startswith", "(", "'('", ")", ")", ")", ":", "return",...
[ 24, 0 ]
[ 31, 16 ]
python
en
['en', 'error', 'th']
False
is_link_text_selector
(selector)
A basic method to determine if a selector is a link text selector.
A basic method to determine if a selector is a link text selector.
def is_link_text_selector(selector): """ A basic method to determine if a selector is a link text selector. """ if (selector.startswith('link=') or selector.startswith('link_text=') or ( selector.startswith('text='))): return True return False
[ "def", "is_link_text_selector", "(", "selector", ")", ":", "if", "(", "selector", ".", "startswith", "(", "'link='", ")", "or", "selector", ".", "startswith", "(", "'link_text='", ")", "or", "(", "selector", ".", "startswith", "(", "'text='", ")", ")", ")"...
[ 34, 0 ]
[ 41, 16 ]
python
en
['en', 'error', 'th']
False
is_partial_link_text_selector
(selector)
A basic method to determine if a selector is a partial link text selector.
A basic method to determine if a selector is a partial link text selector.
def is_partial_link_text_selector(selector): """ A basic method to determine if a selector is a partial link text selector. """ if (selector.startswith('partial_link=') or ( selector.startswith('partial_link_text=') or ( selector.startswith('partial_text=')))): return Tru...
[ "def", "is_partial_link_text_selector", "(", "selector", ")", ":", "if", "(", "selector", ".", "startswith", "(", "'partial_link='", ")", "or", "(", "selector", ".", "startswith", "(", "'partial_link_text='", ")", "or", "(", "selector", ".", "startswith", "(", ...
[ 44, 0 ]
[ 52, 16 ]
python
en
['en', 'error', 'th']
False
is_name_selector
(selector)
A basic method to determine if a selector is a name selector.
A basic method to determine if a selector is a name selector.
def is_name_selector(selector): """ A basic method to determine if a selector is a name selector. """ if selector.startswith('name='): return True return False
[ "def", "is_name_selector", "(", "selector", ")", ":", "if", "selector", ".", "startswith", "(", "'name='", ")", ":", "return", "True", "return", "False" ]
[ 55, 0 ]
[ 61, 16 ]
python
en
['en', 'error', 'th']
False
get_link_text_from_selector
(selector)
A basic method to get the link text from a link text selector.
A basic method to get the link text from a link text selector.
def get_link_text_from_selector(selector): """ A basic method to get the link text from a link text selector. """ if selector.startswith('link='): return selector.split('link=')[1] elif selector.startswith('link_text='): return selector.split('link_text=')[1] elif selector.starts...
[ "def", "get_link_text_from_selector", "(", "selector", ")", ":", "if", "selector", ".", "startswith", "(", "'link='", ")", ":", "return", "selector", ".", "split", "(", "'link='", ")", "[", "1", "]", "elif", "selector", ".", "startswith", "(", "'link_text='"...
[ 64, 0 ]
[ 74, 19 ]
python
en
['en', 'error', 'th']
False
get_partial_link_text_from_selector
(selector)
A basic method to get the partial link text from a partial link selector.
A basic method to get the partial link text from a partial link selector.
def get_partial_link_text_from_selector(selector): """ A basic method to get the partial link text from a partial link selector. """ if selector.startswith('partial_link='): return selector.split('partial_link=')[1] elif selector.startswith('partial_link_text='): return selector.spli...
[ "def", "get_partial_link_text_from_selector", "(", "selector", ")", ":", "if", "selector", ".", "startswith", "(", "'partial_link='", ")", ":", "return", "selector", ".", "split", "(", "'partial_link='", ")", "[", "1", "]", "elif", "selector", ".", "startswith",...
[ 77, 0 ]
[ 87, 19 ]
python
en
['en', 'error', 'th']
False
get_name_from_selector
(selector)
A basic method to get the name from a name selector.
A basic method to get the name from a name selector.
def get_name_from_selector(selector): """ A basic method to get the name from a name selector. """ if selector.startswith('name='): return selector.split('name=')[1] return selector
[ "def", "get_name_from_selector", "(", "selector", ")", ":", "if", "selector", ".", "startswith", "(", "'name='", ")", ":", "return", "selector", ".", "split", "(", "'name='", ")", "[", "1", "]", "return", "selector" ]
[ 90, 0 ]
[ 96, 19 ]
python
en
['en', 'error', 'th']
False
_get_unique_links
(page_url, soup)
Returns all unique links. Includes: "a"->"href", "img"->"src", "link"->"href", and "script"->"src" links.
Returns all unique links. Includes: "a"->"href", "img"->"src", "link"->"href", and "script"->"src" links.
def _get_unique_links(page_url, soup): """ Returns all unique links. Includes: "a"->"href", "img"->"src", "link"->"href", and "script"->"src" links. """ if not page_url.startswith("http://") and ( not page_url.startswith("https://")): return [] prefix = 'http:' if...
[ "def", "_get_unique_links", "(", "page_url", ",", "soup", ")", ":", "if", "not", "page_url", ".", "startswith", "(", "\"http://\"", ")", "and", "(", "not", "page_url", ".", "startswith", "(", "\"https://\"", ")", ")", ":", "return", "[", "]", "prefix", "...
[ 116, 0 ]
[ 176, 23 ]
python
en
['en', 'error', 'th']
False
_get_link_status_code
(link, allow_redirects=False, timeout=5)
Get the status code of a link. If the timeout is exceeded, will return a 404. For a list of available status codes, see: https://en.wikipedia.org/wiki/List_of_HTTP_status_codes
Get the status code of a link. If the timeout is exceeded, will return a 404. For a list of available status codes, see: https://en.wikipedia.org/wiki/List_of_HTTP_status_codes
def _get_link_status_code(link, allow_redirects=False, timeout=5): """ Get the status code of a link. If the timeout is exceeded, will return a 404. For a list of available status codes, see: https://en.wikipedia.org/wiki/List_of_HTTP_status_codes """ status_code = None try: ...
[ "def", "_get_link_status_code", "(", "link", ",", "allow_redirects", "=", "False", ",", "timeout", "=", "5", ")", ":", "status_code", "=", "None", "try", ":", "response", "=", "requests", ".", "get", "(", "link", ",", "allow_redirects", "=", "allow_redirects...
[ 179, 0 ]
[ 192, 22 ]
python
en
['en', 'en', 'en']
True
_print_unique_links_with_status_codes
(page_url, soup)
Finds all unique links in the html of the page source and then prints out those links with their status codes. Format: ["link" -> "status_code"] (per line) Page links include those obtained from: "a"->"href", "img"->"src", "link"->"href", and "script"->"src".
Finds all unique links in the html of the page source and then prints out those links with their status codes. Format: ["link" -> "status_code"] (per line) Page links include those obtained from: "a"->"href", "img"->"src", "link"->"href", and "script"->"src".
def _print_unique_links_with_status_codes(page_url, soup): """ Finds all unique links in the html of the page source and then prints out those links with their status codes. Format: ["link" -> "status_code"] (per line) Page links include those obtained from: "a"->"href", "img"->"...
[ "def", "_print_unique_links_with_status_codes", "(", "page_url", ",", "soup", ")", ":", "links", "=", "_get_unique_links", "(", "page_url", ",", "soup", ")", "for", "link", "in", "links", ":", "status_code", "=", "_get_link_status_code", "(", "link", ")", "print...
[ 195, 0 ]
[ 205, 40 ]
python
en
['en', 'en', 'en']
True