_id
stringlengths
2
7
title
stringlengths
1
88
partition
stringclasses
3 values
text
stringlengths
31
13.1k
language
stringclasses
1 value
meta_information
dict
q29800
get_market_gainers
train
def get_market_gainers(*args, **kwargs): """ MOVED to iexfinance.stocks.get_market_gainers """ import warnings
python
{ "resource": "" }
q29801
get_market_losers
train
def get_market_losers(*args, **kwargs): """ MOVED to iexfinance.stocks.get_market_losers """ import warnings
python
{ "resource": "" }
q29802
get_market_most_active
train
def get_market_most_active(*args, **kwargs): """ MOVED to iexfinance.stocks.get_market_most_active """ import warnings
python
{ "resource": "" }
q29803
get_market_iex_volume
train
def get_market_iex_volume(*args, **kwargs): """ MOVED to iexfinance.stocks.get_market_iex_volume """ import warnings
python
{ "resource": "" }
q29804
get_market_iex_percent
train
def get_market_iex_percent(*args, **kwargs): """ MOVED to iexfinance.stocks.get_market_iex_percent """ import warnings
python
{ "resource": "" }
q29805
get_available_symbols
train
def get_available_symbols(**kwargs): """ MOVED to iexfinance.refdata.get_symbols """ import warnings warnings.warn(WNG_MSG % ("get_available_symbols", "refdata.get_symbols")) _ALL_SYMBOLS_URL = "https://api.iextrading.com/1.0/ref-data/symbols" handler = _IEXBase(**kwargs)
python
{ "resource": "" }
q29806
get_iex_corporate_actions
train
def get_iex_corporate_actions(start=None, **kwargs): """ MOVED to iexfinance.refdata.get_iex_corporate_actions """ import warnings
python
{ "resource": "" }
q29807
get_iex_dividends
train
def get_iex_dividends(start=None, **kwargs): """ MOVED to iexfinance.refdata.get_iex_dividends
python
{ "resource": "" }
q29808
get_iex_next_day_ex_date
train
def get_iex_next_day_ex_date(start=None, **kwargs): """ MOVED to iexfinance.refdata.get_iex_next_day_ex_date """
python
{ "resource": "" }
q29809
get_iex_listed_symbol_dir
train
def get_iex_listed_symbol_dir(start=None, **kwargs): """ MOVED to iexfinance.refdata.get_listed_symbol_dir """ import warnings warnings.warn(WNG_MSG % ("get_iex_listed_symbol_dir",
python
{ "resource": "" }
q29810
get_market_tops
train
def get_market_tops(symbols=None, **kwargs): """ MOVED to iexfinance.iexdata.get_tops
python
{ "resource": "" }
q29811
get_market_last
train
def get_market_last(symbols=None, **kwargs): """ MOVED to iexfinance.iexdata.get_last
python
{ "resource": "" }
q29812
get_market_deep
train
def get_market_deep(symbols=None, **kwargs): """ MOVED to iexfinance.iexdata.get_deep
python
{ "resource": "" }
q29813
get_market_book
train
def get_market_book(symbols=None, **kwargs): """ MOVED to iexfinance.iexdata.get_deep_book
python
{ "resource": "" }
q29814
get_stats_daily
train
def get_stats_daily(start=None, end=None, last=None, **kwargs): """ MOVED to iexfinance.iexdata.get_stats_daily """ import warnings warnings.warn(WNG_MSG % ("get_stats_daily", "iexdata.get_stats_daily"))
python
{ "resource": "" }
q29815
get_stats_monthly
train
def get_stats_monthly(start=None, end=None, **kwargs): """ MOVED to iexfinance.iexdata.get_stats_summary """ import warnings
python
{ "resource": "" }
q29816
_IEXBase._handle_error
train
def _handle_error(self, response): """ Handles all responses which return an error status code """ auth_msg = "The query could not be completed. Invalid auth token." status_code = response.status_code if 400 <= status_code < 500: if status_code == 400...
python
{ "resource": "" }
q29817
_IEXBase._output_format
train
def _output_format(self, out, fmt_j=None, fmt_p=None): """ Output formatting handler """ if self.output_format == 'pandas': if fmt_p is not None: return fmt_p(out)
python
{ "resource": "" }
q29818
get_historical_data
train
def get_historical_data(symbols, start=None, end=None, **kwargs): """ Function to obtain historical date for a symbol or list of symbols. Return an instance of HistoricalReader Parameters ---------- symbols: str or list A symbol or list of symbols start: datetime.datetime, default N...
python
{ "resource": "" }
q29819
LazySettings.get
train
def get(self, key): """ This function is here only to provide backwards compatibility in case anyone uses old settings interface. It is strongly encouraged to use dot notation. """ warnings.warn(
python
{ "resource": "" }
q29820
Connection._pack
train
def _pack(self, msg_type, payload): """ Packs the given message type and payload. Turns the resulting message into a byte string. """ pb = payload.encode('utf-8') s
python
{ "resource": "" }
q29821
Connection._unpack
train
def _unpack(self, data): """ Unpacks the given byte string and parses the result from JSON. Returns None on failure and saves data into "self.buffer". """
python
{ "resource": "" }
q29822
Connection._unpack_header
train
def _unpack_header(self, data): """ Unpacks the header of given byte string. """ return
python
{ "resource": "" }
q29823
Connection.get_bar_config_list
train
def get_bar_config_list(self): """ Get list of bar IDs as active in the connected i3 session. :rtype: List of
python
{ "resource": "" }
q29824
Connection.get_workspaces
train
def get_workspaces(self): """ Get a list of workspaces. Returns JSON-like data, not a Con instance. You might want to try the :meth:`Con.workspaces` instead if the info contained here is too little. :rtype: List of :class:`WorkspaceReply`.
python
{ "resource": "" }
q29825
Connection.get_marks
train
def get_marks(self): """ Get a list of the names of all currently set marks.
python
{ "resource": "" }
q29826
Connection.get_binding_modes
train
def get_binding_modes(self): """ Returns all currently configured binding modes. :rtype: list
python
{ "resource": "" }
q29827
Connection.get_config
train
def get_config(self): """ Currently only contains the "config" member, which is a string containing the config file as loaded by i3 most recently. :rtype: ConfigReply """ data
python
{ "resource": "" }
q29828
Connection.send_tick
train
def send_tick(self, payload=""): """ Sends a tick event with the specified payload. After the reply was received, the tick event has been written to all IPC connections which subscribe to tick events. :rtype: TickReply
python
{ "resource": "" }
q29829
Con.root
train
def root(self): """ Retrieves the root container. :rtype: :class:`Con`. """ if not self.parent: return self con
python
{ "resource": "" }
q29830
Con.leaves
train
def leaves(self): """ Retrieve a list of windows that delineate from the currently selected container. Only lists client windows, no intermediate
python
{ "resource": "" }
q29831
Con.command
train
def command(self, command): """ Run a command on the currently active container. :rtype: CommandReply
python
{ "resource": "" }
q29832
Con.command_children
train
def command_children(self, command): """ Run a command on the direct children of the currently selected container. :rtype: List of CommandReply???? """ if not len(self.nodes): return
python
{ "resource": "" }
q29833
Con.workspaces
train
def workspaces(self): """ Retrieve a list of currently active workspaces. :rtype: List of :class:`Con`. """ workspaces = [] def collect_workspaces(con): if con.type == "workspace" and not con.name.startswith('__'): workspaces.append(con)
python
{ "resource": "" }
q29834
_parse_json
train
def _parse_json(s): ''' Parse json string into JsonDict. >>> r = _parse_json(r'{"name":"Michael","score":95}') >>> r.name u'Michael' >>> r['score']
python
{ "resource": "" }
q29835
_encode_params
train
def _encode_params(**kw): ''' Do url-encode parameters >>> _encode_params(a=1, b='R&D') 'a=1&b=R%26D' >>> _encode_params(a=u'\u4e2d\u6587', b=['A', 'B', 123]) 'a=%E4%B8%AD%E6%96%87&b=A&b=B&b=123' ''' def _encode(L, k, v): if isinstance(v, unicode):
python
{ "resource": "" }
q29836
_guess_content_type
train
def _guess_content_type(url): ''' Guess content type by url. >>> _guess_content_type('http://test/A.HTML') 'text/html' >>> _guess_content_type('http://test/a.jpg') 'image/jpeg' >>> _guess_content_type('/path.txt/aaa') 'application/octet-stream'
python
{ "resource": "" }
q29837
_http
train
def _http(method, url, headers=None, **kw): ''' Send http request and return response text. ''' params = None boundary = None if method == 'UPLOAD': params, boundary = _encode_multipart(**kw) else: params = _encode_params(**kw) http_url = '%s?%s' % (url, params) if method...
python
{ "resource": "" }
q29838
SinaWeiboMixin._prepare_api
train
def _prepare_api(self, method, path, access_token, **kw): ''' Get api url. ''' headers = None if access_token: headers = {'Authorization': 'OAuth2 %s' % access_token} if '/remind/' in path: # sina remind api url is different: return met...
python
{ "resource": "" }
q29839
SinaWeiboMixin.parse_signed_request
train
def parse_signed_request(self, signed_request): ''' parse signed request when using in-site app. Returns: dict object like { 'uid': 12345, 'access_token': 'ABC123XYZ', 'expires': unix-timestamp }, or None if parse failed. ''' def _b64_normalize(s): ...
python
{ "resource": "" }
q29840
QQMixin.refresh_access_token
train
def refresh_access_token(self, refresh_token, redirect_uri=None): ''' Refresh access token. ''' redirect = redirect_uri or self._redirect_uri resp_text = _http('POST', 'https://graph.qq.com/oauth2.0/token', refresh_token=refresh_token,
python
{ "resource": "" }
q29841
QQMixin._parse_access_token
train
def _parse_access_token(self, resp_text): ' parse access token from urlencoded str like access_token=abcxyz&expires_in=123000&other=true '
python
{ "resource": "" }
q29842
_parse_json
train
def _parse_json(s): ' parse str into JsonDict ' def _obj_hook(pairs): ' convert json object to python object '
python
{ "resource": "" }
q29843
_encode_params
train
def _encode_params(**kw): ''' do url-encode parameters >>> _encode_params(a=1, b='R&D') 'a=1&b=R%26D' >>> _encode_params(a=u'\u4e2d\u6587', b=['A', 'B', 123]) 'a=%E4%B8%AD%E6%96%87&b=A&b=B&b=123' ''' args = [] for k, v in kw.iteritems(): if isinstance(v, basestring): ...
python
{ "resource": "" }
q29844
_http_call
train
def _http_call(the_url, method, authorization, **kw): ''' send an http request and return a json object if no error occurred. ''' params = None boundary = None if method == _HTTP_UPLOAD: # fix sina upload url: the_url = the_url.replace('https://api.', 'https://upload.api.') ...
python
{ "resource": "" }
q29845
proto_files
train
def proto_files(root): """Yields the path of all .proto files under the root.""" for (dirpath, _, filenames) in os.walk(root): for filename in filenames:
python
{ "resource": "" }
q29846
compile_proto
train
def compile_proto(source, python_out, proto_path): """Invoke Protocol Compiler to generate python from given source .proto.""" if not protoc: sys.exit('protoc not found. Is the protobuf-compiler installed?\n') protoc_command = [ protoc, '--proto_path', proto_path, '--python_out', python_out...
python
{ "resource": "" }
q29847
ProjectFiles.add_folder
train
def add_folder(self, path, parent=None, excludes=None, recursive=True, create_groups=True, target_name=None, file_options=FileOptions()): """ Given a directory, it will create the equivalent group structure and add all files in the process. If groups matching the logical path ...
python
{ "resource": "" }
q29848
ProjectFlags.add_code_sign
train
def add_code_sign(self, code_sign_identity, development_team, provisioning_profile_uuid, provisioning_profile_specifier, target_name=None, configuration_name=None): """ Adds the code sign information to the project and creates the appropriate flags in the configuration. In ...
python
{ "resource": "" }
q29849
notify_handler
train
def notify_handler(verb, **kwargs): """ Handler function to create Notification instance upon action signal call. """ # Pull the options out of kwargs kwargs.pop('signal', None) recipient = kwargs.pop('recipient') actor = kwargs.pop('sender') optional_objs = [ (kwargs.pop(opt, N...
python
{ "resource": "" }
q29850
NotificationQuerySet.unread
train
def unread(self, include_deleted=False): """Return only unread items in the current queryset""" if is_soft_delete() and not include_deleted: return self.filter(unread=True, deleted=False) # When SOFT_DELETE=False, developers are supposed NOT
python
{ "resource": "" }
q29851
NotificationQuerySet.read
train
def read(self, include_deleted=False): """Return only read items in the current queryset""" if is_soft_delete() and not include_deleted: return self.filter(unread=False, deleted=False) # When SOFT_DELETE=False, developers are supposed NOT
python
{ "resource": "" }
q29852
NotificationQuerySet.mark_all_as_read
train
def mark_all_as_read(self, recipient=None): """Mark as read any unread messages in the current queryset. Optionally, filter these by recipient first. """ # We want to filter out read ones, as later we will store # the time they were marked as
python
{ "resource": "" }
q29853
NotificationQuerySet.mark_all_as_unread
train
def mark_all_as_unread(self, recipient=None): """Mark as unread any read messages in the current queryset. Optionally, filter these
python
{ "resource": "" }
q29854
NotificationQuerySet.mark_all_as_deleted
train
def mark_all_as_deleted(self, recipient=None): """Mark current queryset as deleted. Optionally, filter by recipient first. """ assert_soft_delete() qset = self.active()
python
{ "resource": "" }
q29855
live_unread_notification_list
train
def live_unread_notification_list(request): ''' Return a json with a unread notification list ''' try: user_is_authenticated = request.user.is_authenticated() except TypeError: # Django >= 1.11 user_is_authenticated = request.user.is_authenticated if not user_is_authenticated: ...
python
{ "resource": "" }
q29856
uni_char_code
train
def uni_char_code(a: str, b: str, c: str, d: str): """Convert unicode characters to integers. Converts four hexadecimal chars to the integer that the string represents. For example, uni_char_code('0','0','0','f') will return 15, and uni_char_code('0','0','f','f') returns 255. Returns a negative nu...
python
{ "resource": "" }
q29857
char2hex
train
def char2hex(a: str): """Convert a hex character to its integer value. '0' becomes 0, '9' becomes 9 'A' becomes 10, 'F' becomes 15 'a' becomes 10, 'f' becomes 15 Returns -1 on error. """ if "0" <= a <= "9":
python
{ "resource": "" }
q29858
Token.desc
train
def desc(self) -> str: """A helper property to describe a token as a string for debugging"""
python
{ "resource": "" }
q29859
Lexer.read_token
train
def read_token(self, prev: Token) -> Token: """Get the next token from the source starting at the given position. This skips over whitespace until it finds the next lexable token, then lexes punctuators immediately or calls the appropriate helper function for more complicated tokens. ...
python
{ "resource": "" }
q29860
Lexer.position_after_whitespace
train
def position_after_whitespace(self, body: str, start_position: int) -> int: """Go to next position after a whitespace. Reads from body starting at start_position until it finds a non-whitespace character, then returns the position of that character for lexing. """ body_length = ...
python
{ "resource": "" }
q29861
Lexer.read_comment
train
def read_comment(self, start: int, line: int, col: int, prev: Token) -> Token: """Read a comment token from the source file.""" body = self.source.body body_length = len(body) position = start while True: position += 1 if position > body_length: ...
python
{ "resource": "" }
q29862
Lexer.read_number
train
def read_number( self, start: int, char: str, line: int, col: int, prev: Token ) -> Token: """Reads a number token from the source file. Either a float or an int depending on whether a decimal point appears. """ source = self.source body = source.body positio...
python
{ "resource": "" }
q29863
Lexer.read_digits
train
def read_digits(self, start: int, char: str) -> int: """Return the new position in the source after reading digits.""" source = self.source body = source.body position = start while "0" <= char <=
python
{ "resource": "" }
q29864
Lexer.read_string
train
def read_string(self, start: int, line: int, col: int, prev: Token) -> Token: """Read a string token from the source file.""" source = self.source body = source.body body_length = len(body) position = start + 1 chunk_start = position value: List[str] = [] ...
python
{ "resource": "" }
q29865
Lexer.read_name
train
def read_name(self, start: int, line: int, col: int, prev: Token) -> Token: """Read an alphanumeric + underscore name from the source.""" body = self.source.body body_length = len(body) position = start + 1 while position < body_length: char = body[position] ...
python
{ "resource": "" }
q29866
execute
train
def execute( schema: GraphQLSchema, document: DocumentNode, root_value: Any = None, context_value: Any = None, variable_values: Dict[str, Any] = None, operation_name: str = None, field_resolver: GraphQLFieldResolver = None, type_resolver: GraphQLTypeResolver = None, middleware: Middl...
python
{ "resource": "" }
q29867
assert_valid_execution_arguments
train
def assert_valid_execution_arguments( schema: GraphQLSchema, document: DocumentNode, raw_variable_values: Dict[str, Any] = None, ) -> None: """Check that the arguments are acceptable. Essential assertions before executing to provide developer feedback for improper use of the GraphQL library. ...
python
{ "resource": "" }
q29868
response_path_as_list
train
def response_path_as_list(path: ResponsePath) -> List[Union[str, int]]: """Get response path as a list. Given a ResponsePath (found in the `path` entry in the information provided as the last argument to a field resolver), return a list of the path keys. """ flattened: List[Union[str, int]] = [] ...
python
{ "resource": "" }
q29869
add_path
train
def add_path(prev: Optional[ResponsePath], key: Union[str, int]) -> ResponsePath: """Add a key to a
python
{ "resource": "" }
q29870
invalid_return_type_error
train
def invalid_return_type_error( return_type: GraphQLObjectType, result: Any, field_nodes: List[FieldNode] ) -> GraphQLError: """Create a GraphQLError for an invalid return type.""" return GraphQLError(
python
{ "resource": "" }
q29871
default_type_resolver
train
def default_type_resolver( value: Any, info: GraphQLResolveInfo, abstract_type: GraphQLAbstractType ) -> AwaitableOrValue[Optional[Union[GraphQLObjectType, str]]]: """Default type resolver function. If a resolve_type function is not given, then a default resolve behavior is used which attempts two stra...
python
{ "resource": "" }
q29872
default_field_resolver
train
def default_field_resolver(source, info, **args): """Default field resolver. If a resolve function is not given, then a default resolve behavior is used which takes the property of the source object of the same name as the field and returns it as the result, or if it's a function, returns the result of...
python
{ "resource": "" }
q29873
ExecutionContext.build
train
def build( cls, schema: GraphQLSchema, document: DocumentNode, root_value: Any = None, context_value: Any = None, raw_variable_values: Dict[str, Any] = None, operation_name: str = None, field_resolver: GraphQLFieldResolver = None, type_resolver: Gr...
python
{ "resource": "" }
q29874
ExecutionContext.build_response
train
def build_response( self, data: AwaitableOrValue[Optional[Dict[str, Any]]] ) -> AwaitableOrValue[ExecutionResult]: """Build response. Given a completed execution context and data, build the (data, errors) response defined by the "Response" section of the GraphQL spec. """ ...
python
{ "resource": "" }
q29875
ExecutionContext.execute_operation
train
def execute_operation( self, operation: OperationDefinitionNode, root_value: Any ) -> Optional[AwaitableOrValue[Any]]: """Execute an operation. Implements the "Evaluating operations" section of the spec. """ type_ = get_operation_root_type(self.schema, operation) fie...
python
{ "resource": "" }
q29876
ExecutionContext.execute_fields_serially
train
def execute_fields_serially( self, parent_type: GraphQLObjectType, source_value: Any, path: Optional[ResponsePath], fields: Dict[str, List[FieldNode]], ) -> AwaitableOrValue[Dict[str, Any]]: """Execute the given fields serially. Implements the "Evaluating sel...
python
{ "resource": "" }
q29877
ExecutionContext.execute_fields
train
def execute_fields( self, parent_type: GraphQLObjectType, source_value: Any, path: Optional[ResponsePath], fields: Dict[str, List[FieldNode]], ) -> AwaitableOrValue[Dict[str, Any]]: """Execute the given fields concurrently. Implements the "Evaluating selectio...
python
{ "resource": "" }
q29878
ExecutionContext.collect_fields
train
def collect_fields( self, runtime_type: GraphQLObjectType, selection_set: SelectionSetNode, fields: Dict[str, List[FieldNode]], visited_fragment_names: Set[str], ) -> Dict[str, List[FieldNode]]: """Collect fields. Given a selection_set, adds all of the fields...
python
{ "resource": "" }
q29879
ExecutionContext.should_include_node
train
def should_include_node( self, node: Union[FragmentSpreadNode, FieldNode, InlineFragmentNode] ) -> bool: """Check if node should be included Determines if a field should be included based on the @include and @skip directives, where @skip has higher precedence than @include. ...
python
{ "resource": "" }
q29880
ExecutionContext.does_fragment_condition_match
train
def does_fragment_condition_match( self, fragment: Union[FragmentDefinitionNode, InlineFragmentNode], type_: GraphQLObjectType, ) -> bool: """Determine if a fragment is applicable to the given type.""" type_condition_node = fragment.type_condition if not type_conditio...
python
{ "resource": "" }
q29881
ExecutionContext.resolve_field
train
def resolve_field( self, parent_type: GraphQLObjectType, source: Any, field_nodes: List[FieldNode], path: ResponsePath, ) -> AwaitableOrValue[Any]: """Resolve the field on the given source object. In particular, this figures out the value that the field retur...
python
{ "resource": "" }
q29882
ExecutionContext.complete_value_catching_error
train
def complete_value_catching_error( self, return_type: GraphQLOutputType, field_nodes: List[FieldNode], info: GraphQLResolveInfo, path: ResponsePath, result: Any, ) -> AwaitableOrValue[Any]: """Complete a value while catching an error. This is a small ...
python
{ "resource": "" }
q29883
ExecutionContext.complete_value
train
def complete_value( self, return_type: GraphQLOutputType, field_nodes: List[FieldNode], info: GraphQLResolveInfo, path: ResponsePath, result: Any, ) -> AwaitableOrValue[Any]: """Complete a value. Implements the instructions for completeValue as define...
python
{ "resource": "" }
q29884
ExecutionContext.complete_list_value
train
def complete_list_value( self, return_type: GraphQLList[GraphQLOutputType], field_nodes: List[FieldNode], info: GraphQLResolveInfo, path: ResponsePath, result: Iterable[Any], ) -> AwaitableOrValue[Any]: """Complete a list value. Complete a list value ...
python
{ "resource": "" }
q29885
ExecutionContext.complete_leaf_value
train
def complete_leaf_value(return_type: GraphQLLeafType, result: Any) -> Any: """Complete a leaf value. Complete a Scalar or Enum by serializing to a valid value, returning null if serialization is not possible. """ serialized_result = return_type.serialize(result) if is_in...
python
{ "resource": "" }
q29886
ExecutionContext.complete_abstract_value
train
def complete_abstract_value( self, return_type: GraphQLAbstractType, field_nodes: List[FieldNode], info: GraphQLResolveInfo, path: ResponsePath, result: Any, ) -> AwaitableOrValue[Any]: """Complete an abstract value. Complete a value of an abstract ty...
python
{ "resource": "" }
q29887
ExecutionContext.complete_object_value
train
def complete_object_value( self, return_type: GraphQLObjectType, field_nodes: List[FieldNode], info: GraphQLResolveInfo, path: ResponsePath, result: Any, ) -> AwaitableOrValue[Dict[str, Any]]: """Complete an Object value by executing all sub-selections.""" ...
python
{ "resource": "" }
q29888
ExecutionContext.collect_and_execute_subfields
train
def collect_and_execute_subfields( self, return_type: GraphQLObjectType, field_nodes: List[FieldNode], path: ResponsePath, result: Any,
python
{ "resource": "" }
q29889
ExecutionContext.collect_subfields
train
def collect_subfields( self, return_type: GraphQLObjectType, field_nodes: List[FieldNode] ) -> Dict[str, List[FieldNode]]: """Collect subfields. A cached collection of relevant subfields with regard to the return type is kept in the execution context as `_subfields_cache`. This ensu...
python
{ "resource": "" }
q29890
get_operation_root_type
train
def get_operation_root_type( schema: GraphQLSchema, operation: Union[OperationDefinitionNode, OperationTypeDefinitionNode], ) -> GraphQLObjectType: """Extract the root type of the operation from the schema.""" operation_type = operation.operation if operation_type == OperationType.QUERY: que...
python
{ "resource": "" }
q29891
is_specified_directive
train
def is_specified_directive(directive: GraphQLDirective): """Check whether the given directive is one of the specified directives."""
python
{ "resource": "" }
q29892
print_error
train
def print_error(error: "GraphQLError") -> str: """Print a GraphQLError to a string. The printed string will contain useful location information about the error's position in the source. """ printed_locations: List[str] = [] print_location = printed_locations.append if error.nodes: f...
python
{ "resource": "" }
q29893
highlight_source_at_location
train
def highlight_source_at_location(source: "Source", location: "SourceLocation") -> str: """Highlight source at given location. This renders a helpful description of the location of the error in the GraphQL Source document. """ first_line_column_offset = source.location_offset.column - 1 body = "...
python
{ "resource": "" }
q29894
trunc_str
train
def trunc_str(s: str) -> str: """Truncate strings to maximum length.""" if len(s) > max_str_size: i = max(0, (max_str_size - 3) // 2)
python
{ "resource": "" }
q29895
trunc_list
train
def trunc_list(s: List) -> List: """Truncate lists to maximum length.""" if len(s) > max_list_size: i = max_list_size // 2
python
{ "resource": "" }
q29896
dedent_block_string_value
train
def dedent_block_string_value(raw_string: str) -> str: """Produce the value of a block string from its parsed raw value. Similar to CoffeeScript's block string, Python's docstring trim or Ruby's strip_heredoc. This implements the GraphQL spec's BlockStringValue() static algorithm. """ lines = ...
python
{ "resource": "" }
q29897
print_block_string
train
def print_block_string( value: str, indentation: str = "", prefer_multiple_lines: bool = False ) -> str: """Print a block string in the indented block form. Prints a block string in the indented block form by adding a leading and trailing blank line. However, if a block string starts with whitespace an...
python
{ "resource": "" }
q29898
is_equal_type
train
def is_equal_type(type_a: GraphQLType, type_b: GraphQLType): """Check whether two types are equal. Provided two types, return true if the types are equal (invariant).""" # Equivalent types are equal. if type_a is type_b: return True # If either type is non-null, the other must also be non-...
python
{ "resource": "" }
q29899
is_type_sub_type_of
train
def is_type_sub_type_of( schema: GraphQLSchema, maybe_subtype: GraphQLType, super_type: GraphQLType ) -> bool: """Check whether a type is subtype of another type in a given schema. Provided a type and a super type, return true if the first type is either equal or a subset of the second super type (cova...
python
{ "resource": "" }