partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
Interactive.run
Run the interactive window until the user quits
retro/examples/interactive.py
def run(self): """ Run the interactive window until the user quits """ # pyglet.app.run() has issues like https://bitbucket.org/pyglet/pyglet/issues/199/attempting-to-resize-or-close-pyglet # and also involves inverting your code to run inside the pyglet framework # avoid...
def run(self): """ Run the interactive window until the user quits """ # pyglet.app.run() has issues like https://bitbucket.org/pyglet/pyglet/issues/199/attempting-to-resize-or-close-pyglet # and also involves inverting your code to run inside the pyglet framework # avoid...
[ "Run", "the", "interactive", "window", "until", "the", "user", "quits" ]
openai/retro
python
https://github.com/openai/retro/blob/29dc84fef6d7076fd11a3847d2877fe59e705d36/retro/examples/interactive.py#L179-L194
[ "def", "run", "(", "self", ")", ":", "# pyglet.app.run() has issues like https://bitbucket.org/pyglet/pyglet/issues/199/attempting-to-resize-or-close-pyglet", "# and also involves inverting your code to run inside the pyglet framework", "# avoid both by using a while loop", "prev_frame_time", "=...
29dc84fef6d7076fd11a3847d2877fe59e705d36
train
get_file_path
Return the path to a given game's directory
retro/data/__init__.py
def get_file_path(game, file, inttype=Integrations.DEFAULT): """ Return the path to a given game's directory """ base = path() for t in inttype.paths: possible_path = os.path.join(base, t, game, file) if os.path.exists(possible_path): return possible_path return None
def get_file_path(game, file, inttype=Integrations.DEFAULT): """ Return the path to a given game's directory """ base = path() for t in inttype.paths: possible_path = os.path.join(base, t, game, file) if os.path.exists(possible_path): return possible_path return None
[ "Return", "the", "path", "to", "a", "given", "game", "s", "directory" ]
openai/retro
python
https://github.com/openai/retro/blob/29dc84fef6d7076fd11a3847d2877fe59e705d36/retro/data/__init__.py#L266-L276
[ "def", "get_file_path", "(", "game", ",", "file", ",", "inttype", "=", "Integrations", ".", "DEFAULT", ")", ":", "base", "=", "path", "(", ")", "for", "t", "in", "inttype", ".", "paths", ":", "possible_path", "=", "os", ".", "path", ".", "join", "(",...
29dc84fef6d7076fd11a3847d2877fe59e705d36
train
get_romfile_path
Return the path to a given game's romfile
retro/data/__init__.py
def get_romfile_path(game, inttype=Integrations.DEFAULT): """ Return the path to a given game's romfile """ for extension in EMU_EXTENSIONS.keys(): possible_path = get_file_path(game, "rom" + extension, inttype) if possible_path: return possible_path raise FileNotFoundEr...
def get_romfile_path(game, inttype=Integrations.DEFAULT): """ Return the path to a given game's romfile """ for extension in EMU_EXTENSIONS.keys(): possible_path = get_file_path(game, "rom" + extension, inttype) if possible_path: return possible_path raise FileNotFoundEr...
[ "Return", "the", "path", "to", "a", "given", "game", "s", "romfile" ]
openai/retro
python
https://github.com/openai/retro/blob/29dc84fef6d7076fd11a3847d2877fe59e705d36/retro/data/__init__.py#L279-L288
[ "def", "get_romfile_path", "(", "game", ",", "inttype", "=", "Integrations", ".", "DEFAULT", ")", ":", "for", "extension", "in", "EMU_EXTENSIONS", ".", "keys", "(", ")", ":", "possible_path", "=", "get_file_path", "(", "game", ",", "\"rom\"", "+", "extension...
29dc84fef6d7076fd11a3847d2877fe59e705d36
train
make
Create a Gym environment for the specified game
retro/__init__.py
def make(game, state=State.DEFAULT, inttype=retro.data.Integrations.DEFAULT, **kwargs): """ Create a Gym environment for the specified game """ try: retro.data.get_romfile_path(game, inttype) except FileNotFoundError: if not retro.data.get_file_path(game, "rom.sha", inttype): ...
def make(game, state=State.DEFAULT, inttype=retro.data.Integrations.DEFAULT, **kwargs): """ Create a Gym environment for the specified game """ try: retro.data.get_romfile_path(game, inttype) except FileNotFoundError: if not retro.data.get_file_path(game, "rom.sha", inttype): ...
[ "Create", "a", "Gym", "environment", "for", "the", "specified", "game" ]
openai/retro
python
https://github.com/openai/retro/blob/29dc84fef6d7076fd11a3847d2877fe59e705d36/retro/__init__.py#L44-L55
[ "def", "make", "(", "game", ",", "state", "=", "State", ".", "DEFAULT", ",", "inttype", "=", "retro", ".", "data", ".", "Integrations", ".", "DEFAULT", ",", "*", "*", "kwargs", ")", ":", "try", ":", "retro", ".", "data", ".", "get_romfile_path", "(",...
29dc84fef6d7076fd11a3847d2877fe59e705d36
train
select_actions
Select actions from the tree Normally we select the greedy action that has the highest reward associated with that subtree. We have a small chance to select a random action based on the exploration param and visit count of the current node at each step. We select actions for the longest possible ...
retro/examples/brute.py
def select_actions(root, action_space, max_episode_steps): """ Select actions from the tree Normally we select the greedy action that has the highest reward associated with that subtree. We have a small chance to select a random action based on the exploration param and visit count of the curr...
def select_actions(root, action_space, max_episode_steps): """ Select actions from the tree Normally we select the greedy action that has the highest reward associated with that subtree. We have a small chance to select a random action based on the exploration param and visit count of the curr...
[ "Select", "actions", "from", "the", "tree" ]
openai/retro
python
https://github.com/openai/retro/blob/29dc84fef6d7076fd11a3847d2877fe59e705d36/retro/examples/brute.py#L76-L124
[ "def", "select_actions", "(", "root", ",", "action_space", ",", "max_episode_steps", ")", ":", "node", "=", "root", "acts", "=", "[", "]", "steps", "=", "0", "while", "steps", "<", "max_episode_steps", ":", "if", "node", "is", "None", ":", "# we've fallen ...
29dc84fef6d7076fd11a3847d2877fe59e705d36
train
rollout
Perform a rollout using a preset collection of actions
retro/examples/brute.py
def rollout(env, acts): """ Perform a rollout using a preset collection of actions """ total_rew = 0 env.reset() steps = 0 for act in acts: _obs, rew, done, _info = env.step(act) steps += 1 total_rew += rew if done: break return steps, total_r...
def rollout(env, acts): """ Perform a rollout using a preset collection of actions """ total_rew = 0 env.reset() steps = 0 for act in acts: _obs, rew, done, _info = env.step(act) steps += 1 total_rew += rew if done: break return steps, total_r...
[ "Perform", "a", "rollout", "using", "a", "preset", "collection", "of", "actions" ]
openai/retro
python
https://github.com/openai/retro/blob/29dc84fef6d7076fd11a3847d2877fe59e705d36/retro/examples/brute.py#L127-L141
[ "def", "rollout", "(", "env", ",", "acts", ")", ":", "total_rew", "=", "0", "env", ".", "reset", "(", ")", "steps", "=", "0", "for", "act", "in", "acts", ":", "_obs", ",", "rew", ",", "done", ",", "_info", "=", "env", ".", "step", "(", "act", ...
29dc84fef6d7076fd11a3847d2877fe59e705d36
train
update_tree
Given the tree, a list of actions that were executed before the game ended, and a reward, update the tree so that the path formed by the executed actions are all updated to the new reward.
retro/examples/brute.py
def update_tree(root, executed_acts, total_rew): """ Given the tree, a list of actions that were executed before the game ended, and a reward, update the tree so that the path formed by the executed actions are all updated to the new reward. """ root.value = max(total_rew, root.value) root.visit...
def update_tree(root, executed_acts, total_rew): """ Given the tree, a list of actions that were executed before the game ended, and a reward, update the tree so that the path formed by the executed actions are all updated to the new reward. """ root.value = max(total_rew, root.value) root.visit...
[ "Given", "the", "tree", "a", "list", "of", "actions", "that", "were", "executed", "before", "the", "game", "ended", "and", "a", "reward", "update", "the", "tree", "so", "that", "the", "path", "formed", "by", "the", "executed", "actions", "are", "all", "u...
openai/retro
python
https://github.com/openai/retro/blob/29dc84fef6d7076fd11a3847d2877fe59e705d36/retro/examples/brute.py#L144-L162
[ "def", "update_tree", "(", "root", ",", "executed_acts", ",", "total_rew", ")", ":", "root", ".", "value", "=", "max", "(", "total_rew", ",", "root", ".", "value", ")", "root", ".", "visits", "+=", "1", "new_nodes", "=", "0", "node", "=", "root", "fo...
29dc84fef6d7076fd11a3847d2877fe59e705d36
train
OAuthHandler.get_authorization_url
Get the authorization URL to redirect the user
tweepy/auth.py
def get_authorization_url(self, signin_with_twitter=False, access_type=None): """Get the authorization URL to redirect the user""" try: if signin_with_twitter: url = self._get_oauth_url('authenticate') ...
def get_authorization_url(self, signin_with_twitter=False, access_type=None): """Get the authorization URL to redirect the user""" try: if signin_with_twitter: url = self._get_oauth_url('authenticate') ...
[ "Get", "the", "authorization", "URL", "to", "redirect", "the", "user" ]
tweepy/tweepy
python
https://github.com/tweepy/tweepy/blob/cc3894073905811c4d9fd816202f93454ed932da/tweepy/auth.py#L75-L89
[ "def", "get_authorization_url", "(", "self", ",", "signin_with_twitter", "=", "False", ",", "access_type", "=", "None", ")", ":", "try", ":", "if", "signin_with_twitter", ":", "url", "=", "self", ".", "_get_oauth_url", "(", "'authenticate'", ")", "if", "access...
cc3894073905811c4d9fd816202f93454ed932da
train
OAuthHandler.get_access_token
After user has authorized the request token, get access token with user supplied verifier.
tweepy/auth.py
def get_access_token(self, verifier=None): """ After user has authorized the request token, get access token with user supplied verifier. """ try: url = self._get_oauth_url('access_token') self.oauth = OAuth1Session(self.consumer_key, ...
def get_access_token(self, verifier=None): """ After user has authorized the request token, get access token with user supplied verifier. """ try: url = self._get_oauth_url('access_token') self.oauth = OAuth1Session(self.consumer_key, ...
[ "After", "user", "has", "authorized", "the", "request", "token", "get", "access", "token", "with", "user", "supplied", "verifier", "." ]
tweepy/tweepy
python
https://github.com/tweepy/tweepy/blob/cc3894073905811c4d9fd816202f93454ed932da/tweepy/auth.py#L91-L108
[ "def", "get_access_token", "(", "self", ",", "verifier", "=", "None", ")", ":", "try", ":", "url", "=", "self", ".", "_get_oauth_url", "(", "'access_token'", ")", "self", ".", "oauth", "=", "OAuth1Session", "(", "self", ".", "consumer_key", ",", "client_se...
cc3894073905811c4d9fd816202f93454ed932da
train
OAuthHandler.get_xauth_access_token
Get an access token from an username and password combination. In order to get this working you need to create an app at http://twitter.com/apps, after that send a mail to api@twitter.com and request activation of xAuth for it.
tweepy/auth.py
def get_xauth_access_token(self, username, password): """ Get an access token from an username and password combination. In order to get this working you need to create an app at http://twitter.com/apps, after that send a mail to api@twitter.com and request activation of xAuth fo...
def get_xauth_access_token(self, username, password): """ Get an access token from an username and password combination. In order to get this working you need to create an app at http://twitter.com/apps, after that send a mail to api@twitter.com and request activation of xAuth fo...
[ "Get", "an", "access", "token", "from", "an", "username", "and", "password", "combination", ".", "In", "order", "to", "get", "this", "working", "you", "need", "to", "create", "an", "app", "at", "http", ":", "//", "twitter", ".", "com", "/", "apps", "af...
tweepy/tweepy
python
https://github.com/tweepy/tweepy/blob/cc3894073905811c4d9fd816202f93454ed932da/tweepy/auth.py#L110-L130
[ "def", "get_xauth_access_token", "(", "self", ",", "username", ",", "password", ")", ":", "try", ":", "url", "=", "self", ".", "_get_oauth_url", "(", "'access_token'", ")", "oauth", "=", "OAuth1", "(", "self", ".", "consumer_key", ",", "client_secret", "=", ...
cc3894073905811c4d9fd816202f93454ed932da
train
MemCacheCache.store
Add new record to cache key: entry key value: data of entry
tweepy/cache.py
def store(self, key, value): """Add new record to cache key: entry key value: data of entry """ self.client.set(key, value, time=self.timeout)
def store(self, key, value): """Add new record to cache key: entry key value: data of entry """ self.client.set(key, value, time=self.timeout)
[ "Add", "new", "record", "to", "cache", "key", ":", "entry", "key", "value", ":", "data", "of", "entry" ]
tweepy/tweepy
python
https://github.com/tweepy/tweepy/blob/cc3894073905811c4d9fd816202f93454ed932da/tweepy/cache.py#L282-L287
[ "def", "store", "(", "self", ",", "key", ",", "value", ")", ":", "self", ".", "client", ".", "set", "(", "key", ",", "value", ",", "time", "=", "self", ".", "timeout", ")" ]
cc3894073905811c4d9fd816202f93454ed932da
train
RedisCache.store
Store the key, value pair in our redis server
tweepy/cache.py
def store(self, key, value): """Store the key, value pair in our redis server""" # Prepend tweepy to our key, # this makes it easier to identify tweepy keys in our redis server key = self.pre_identifier + key # Get a pipe (to execute several redis commands in one step) pi...
def store(self, key, value): """Store the key, value pair in our redis server""" # Prepend tweepy to our key, # this makes it easier to identify tweepy keys in our redis server key = self.pre_identifier + key # Get a pipe (to execute several redis commands in one step) pi...
[ "Store", "the", "key", "value", "pair", "in", "our", "redis", "server" ]
tweepy/tweepy
python
https://github.com/tweepy/tweepy/blob/cc3894073905811c4d9fd816202f93454ed932da/tweepy/cache.py#L326-L340
[ "def", "store", "(", "self", ",", "key", ",", "value", ")", ":", "# Prepend tweepy to our key,", "# this makes it easier to identify tweepy keys in our redis server", "key", "=", "self", ".", "pre_identifier", "+", "key", "# Get a pipe (to execute several redis commands in one ...
cc3894073905811c4d9fd816202f93454ed932da
train
RedisCache.get
Given a key, returns an element from the redis table
tweepy/cache.py
def get(self, key, timeout=None): """Given a key, returns an element from the redis table""" key = self.pre_identifier + key # Check to see if we have this key unpickled_entry = self.client.get(key) if not unpickled_entry: # No hit, return nothing return N...
def get(self, key, timeout=None): """Given a key, returns an element from the redis table""" key = self.pre_identifier + key # Check to see if we have this key unpickled_entry = self.client.get(key) if not unpickled_entry: # No hit, return nothing return N...
[ "Given", "a", "key", "returns", "an", "element", "from", "the", "redis", "table" ]
tweepy/tweepy
python
https://github.com/tweepy/tweepy/blob/cc3894073905811c4d9fd816202f93454ed932da/tweepy/cache.py#L342-L363
[ "def", "get", "(", "self", ",", "key", ",", "timeout", "=", "None", ")", ":", "key", "=", "self", ".", "pre_identifier", "+", "key", "# Check to see if we have this key", "unpickled_entry", "=", "self", ".", "client", ".", "get", "(", "key", ")", "if", "...
cc3894073905811c4d9fd816202f93454ed932da
train
RedisCache.delete_entry
Delete an object from the redis table
tweepy/cache.py
def delete_entry(self, key): """Delete an object from the redis table""" pipe = self.client.pipeline() pipe.srem(self.keys_container, key) pipe.delete(key) pipe.execute()
def delete_entry(self, key): """Delete an object from the redis table""" pipe = self.client.pipeline() pipe.srem(self.keys_container, key) pipe.delete(key) pipe.execute()
[ "Delete", "an", "object", "from", "the", "redis", "table" ]
tweepy/tweepy
python
https://github.com/tweepy/tweepy/blob/cc3894073905811c4d9fd816202f93454ed932da/tweepy/cache.py#L371-L376
[ "def", "delete_entry", "(", "self", ",", "key", ")", ":", "pipe", "=", "self", ".", "client", ".", "pipeline", "(", ")", "pipe", ".", "srem", "(", "self", ".", "keys_container", ",", "key", ")", "pipe", ".", "delete", "(", "key", ")", "pipe", ".", ...
cc3894073905811c4d9fd816202f93454ed932da
train
RedisCache.cleanup
Cleanup all the expired keys
tweepy/cache.py
def cleanup(self): """Cleanup all the expired keys""" keys = self.client.smembers(self.keys_container) for key in keys: entry = self.client.get(key) if entry: entry = pickle.loads(entry) if self._is_expired(entry, self.timeout): ...
def cleanup(self): """Cleanup all the expired keys""" keys = self.client.smembers(self.keys_container) for key in keys: entry = self.client.get(key) if entry: entry = pickle.loads(entry) if self._is_expired(entry, self.timeout): ...
[ "Cleanup", "all", "the", "expired", "keys" ]
tweepy/tweepy
python
https://github.com/tweepy/tweepy/blob/cc3894073905811c4d9fd816202f93454ed932da/tweepy/cache.py#L378-L386
[ "def", "cleanup", "(", "self", ")", ":", "keys", "=", "self", ".", "client", ".", "smembers", "(", "self", ".", "keys_container", ")", "for", "key", "in", "keys", ":", "entry", "=", "self", ".", "client", ".", "get", "(", "key", ")", "if", "entry",...
cc3894073905811c4d9fd816202f93454ed932da
train
RedisCache.flush
Delete all entries from the cache
tweepy/cache.py
def flush(self): """Delete all entries from the cache""" keys = self.client.smembers(self.keys_container) for key in keys: self.delete_entry(key)
def flush(self): """Delete all entries from the cache""" keys = self.client.smembers(self.keys_container) for key in keys: self.delete_entry(key)
[ "Delete", "all", "entries", "from", "the", "cache" ]
tweepy/tweepy
python
https://github.com/tweepy/tweepy/blob/cc3894073905811c4d9fd816202f93454ed932da/tweepy/cache.py#L388-L392
[ "def", "flush", "(", "self", ")", ":", "keys", "=", "self", ".", "client", ".", "smembers", "(", "self", ".", "keys_container", ")", "for", "key", "in", "keys", ":", "self", ".", "delete_entry", "(", "key", ")" ]
cc3894073905811c4d9fd816202f93454ed932da
train
API.related_results
:reference: https://dev.twitter.com/docs/api/1.1/get/related_results/show/%3id.format :allowed_param:'id'
tweepy/api.py
def related_results(self): """ :reference: https://dev.twitter.com/docs/api/1.1/get/related_results/show/%3id.format :allowed_param:'id' """ return bind_api( api=self, path='/related_results/show/{id}.json', payload_type='relation', payload_list=Tr...
def related_results(self): """ :reference: https://dev.twitter.com/docs/api/1.1/get/related_results/show/%3id.format :allowed_param:'id' """ return bind_api( api=self, path='/related_results/show/{id}.json', payload_type='relation', payload_list=Tr...
[ ":", "reference", ":", "https", ":", "//", "dev", ".", "twitter", ".", "com", "/", "docs", "/", "api", "/", "1", ".", "1", "/", "get", "/", "related_results", "/", "show", "/", "%3id", ".", "format", ":", "allowed_param", ":", "id" ]
tweepy/tweepy
python
https://github.com/tweepy/tweepy/blob/cc3894073905811c4d9fd816202f93454ed932da/tweepy/api.py#L142-L152
[ "def", "related_results", "(", "self", ")", ":", "return", "bind_api", "(", "api", "=", "self", ",", "path", "=", "'/related_results/show/{id}.json'", ",", "payload_type", "=", "'relation'", ",", "payload_list", "=", "True", ",", "allowed_param", "=", "[", "'i...
cc3894073905811c4d9fd816202f93454ed932da
train
API.media_upload
:reference: https://developer.twitter.com/en/docs/media/upload-media/api-reference/post-media-upload :allowed_param:
tweepy/api.py
def media_upload(self, filename, *args, **kwargs): """ :reference: https://developer.twitter.com/en/docs/media/upload-media/api-reference/post-media-upload :allowed_param: """ f = kwargs.pop('file', None) headers, post_data = API._pack_image(filename, 4883, form_field='media'...
def media_upload(self, filename, *args, **kwargs): """ :reference: https://developer.twitter.com/en/docs/media/upload-media/api-reference/post-media-upload :allowed_param: """ f = kwargs.pop('file', None) headers, post_data = API._pack_image(filename, 4883, form_field='media'...
[ ":", "reference", ":", "https", ":", "//", "developer", ".", "twitter", ".", "com", "/", "en", "/", "docs", "/", "media", "/", "upload", "-", "media", "/", "api", "-", "reference", "/", "post", "-", "media", "-", "upload", ":", "allowed_param", ":" ]
tweepy/tweepy
python
https://github.com/tweepy/tweepy/blob/cc3894073905811c4d9fd816202f93454ed932da/tweepy/api.py#L197-L213
[ "def", "media_upload", "(", "self", ",", "filename", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "f", "=", "kwargs", ".", "pop", "(", "'file'", ",", "None", ")", "headers", ",", "post_data", "=", "API", ".", "_pack_image", "(", "filename", ...
cc3894073905811c4d9fd816202f93454ed932da
train
API.destroy_status
:reference: https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/post-statuses-destroy-id :allowed_param:'id'
tweepy/api.py
def destroy_status(self): """ :reference: https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/post-statuses-destroy-id :allowed_param:'id' """ return bind_api( api=self, path='/statuses/destroy/{id}.json', method='POST', ...
def destroy_status(self): """ :reference: https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/post-statuses-destroy-id :allowed_param:'id' """ return bind_api( api=self, path='/statuses/destroy/{id}.json', method='POST', ...
[ ":", "reference", ":", "https", ":", "//", "developer", ".", "twitter", ".", "com", "/", "en", "/", "docs", "/", "tweets", "/", "post", "-", "and", "-", "engage", "/", "api", "-", "reference", "/", "post", "-", "statuses", "-", "destroy", "-", "id"...
tweepy/tweepy
python
https://github.com/tweepy/tweepy/blob/cc3894073905811c4d9fd816202f93454ed932da/tweepy/api.py#L236-L247
[ "def", "destroy_status", "(", "self", ")", ":", "return", "bind_api", "(", "api", "=", "self", ",", "path", "=", "'/statuses/destroy/{id}.json'", ",", "method", "=", "'POST'", ",", "payload_type", "=", "'status'", ",", "allowed_param", "=", "[", "'id'", "]",...
cc3894073905811c4d9fd816202f93454ed932da
train
API.lookup_users
Perform bulk look up of users from user ID or screen_name
tweepy/api.py
def lookup_users(self, user_ids=None, screen_names=None, include_entities=None, tweet_mode=None): """ Perform bulk look up of users from user ID or screen_name """ post_data = {} if include_entities is not None: include_entities = 'true' if include_entities else 'false' p...
def lookup_users(self, user_ids=None, screen_names=None, include_entities=None, tweet_mode=None): """ Perform bulk look up of users from user ID or screen_name """ post_data = {} if include_entities is not None: include_entities = 'true' if include_entities else 'false' p...
[ "Perform", "bulk", "look", "up", "of", "users", "from", "user", "ID", "or", "screen_name" ]
tweepy/tweepy
python
https://github.com/tweepy/tweepy/blob/cc3894073905811c4d9fd816202f93454ed932da/tweepy/api.py#L326-L339
[ "def", "lookup_users", "(", "self", ",", "user_ids", "=", "None", ",", "screen_names", "=", "None", ",", "include_entities", "=", "None", ",", "tweet_mode", "=", "None", ")", ":", "post_data", "=", "{", "}", "if", "include_entities", "is", "not", "None", ...
cc3894073905811c4d9fd816202f93454ed932da
train
API._lookup_users
:reference: https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-users-lookup allowed_param='user_id', 'screen_name', 'include_entities', 'tweet_mode'
tweepy/api.py
def _lookup_users(self): """ :reference: https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-users-lookup allowed_param='user_id', 'screen_name', 'include_entities', 'tweet_mode' """ return bind_api( api=self, pat...
def _lookup_users(self): """ :reference: https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-users-lookup allowed_param='user_id', 'screen_name', 'include_entities', 'tweet_mode' """ return bind_api( api=self, pat...
[ ":", "reference", ":", "https", ":", "//", "developer", ".", "twitter", ".", "com", "/", "en", "/", "docs", "/", "accounts", "-", "and", "-", "users", "/", "follow", "-", "search", "-", "get", "-", "users", "/", "api", "-", "reference", "/", "get",...
tweepy/tweepy
python
https://github.com/tweepy/tweepy/blob/cc3894073905811c4d9fd816202f93454ed932da/tweepy/api.py#L342-L352
[ "def", "_lookup_users", "(", "self", ")", ":", "return", "bind_api", "(", "api", "=", "self", ",", "path", "=", "'/users/lookup.json'", ",", "payload_type", "=", "'user'", ",", "payload_list", "=", "True", ",", "method", "=", "'POST'", ",", "allowed_param", ...
cc3894073905811c4d9fd816202f93454ed932da
train
API.search_users
:reference: https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-users-search :allowed_param:'q', 'count', 'page'
tweepy/api.py
def search_users(self): """ :reference: https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-users-search :allowed_param:'q', 'count', 'page' """ return bind_api( api=self, path='/users/search.json', pa...
def search_users(self): """ :reference: https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-users-search :allowed_param:'q', 'count', 'page' """ return bind_api( api=self, path='/users/search.json', pa...
[ ":", "reference", ":", "https", ":", "//", "developer", ".", "twitter", ".", "com", "/", "en", "/", "docs", "/", "accounts", "-", "and", "-", "users", "/", "follow", "-", "search", "-", "get", "-", "users", "/", "api", "-", "reference", "/", "get",...
tweepy/tweepy
python
https://github.com/tweepy/tweepy/blob/cc3894073905811c4d9fd816202f93454ed932da/tweepy/api.py#L359-L369
[ "def", "search_users", "(", "self", ")", ":", "return", "bind_api", "(", "api", "=", "self", ",", "path", "=", "'/users/search.json'", ",", "payload_type", "=", "'user'", ",", "payload_list", "=", "True", ",", "require_auth", "=", "True", ",", "allowed_param...
cc3894073905811c4d9fd816202f93454ed932da
train
API.get_direct_message
:reference: https://developer.twitter.com/en/docs/direct-messages/sending-and-receiving/api-reference/get-message :allowed_param:'id', 'full_text'
tweepy/api.py
def get_direct_message(self): """ :reference: https://developer.twitter.com/en/docs/direct-messages/sending-and-receiving/api-reference/get-message :allowed_param:'id', 'full_text' """ return bind_api( api=self, path='/direct_messages/show/{id}.json', ...
def get_direct_message(self): """ :reference: https://developer.twitter.com/en/docs/direct-messages/sending-and-receiving/api-reference/get-message :allowed_param:'id', 'full_text' """ return bind_api( api=self, path='/direct_messages/show/{id}.json', ...
[ ":", "reference", ":", "https", ":", "//", "developer", ".", "twitter", ".", "com", "/", "en", "/", "docs", "/", "direct", "-", "messages", "/", "sending", "-", "and", "-", "receiving", "/", "api", "-", "reference", "/", "get", "-", "message", ":", ...
tweepy/tweepy
python
https://github.com/tweepy/tweepy/blob/cc3894073905811c4d9fd816202f93454ed932da/tweepy/api.py#L424-L434
[ "def", "get_direct_message", "(", "self", ")", ":", "return", "bind_api", "(", "api", "=", "self", ",", "path", "=", "'/direct_messages/show/{id}.json'", ",", "payload_type", "=", "'direct_message'", ",", "allowed_param", "=", "[", "'id'", ",", "'full_text'", "]...
cc3894073905811c4d9fd816202f93454ed932da
train
API.lookup_friendships
Perform bulk look up of friendships from user ID or screenname
tweepy/api.py
def lookup_friendships(self, user_ids=None, screen_names=None): """ Perform bulk look up of friendships from user ID or screenname """ return self._lookup_friendships(list_to_csv(user_ids), list_to_csv(screen_names))
def lookup_friendships(self, user_ids=None, screen_names=None): """ Perform bulk look up of friendships from user ID or screenname """ return self._lookup_friendships(list_to_csv(user_ids), list_to_csv(screen_names))
[ "Perform", "bulk", "look", "up", "of", "friendships", "from", "user", "ID", "or", "screenname" ]
tweepy/tweepy
python
https://github.com/tweepy/tweepy/blob/cc3894073905811c4d9fd816202f93454ed932da/tweepy/api.py#L518-L520
[ "def", "lookup_friendships", "(", "self", ",", "user_ids", "=", "None", ",", "screen_names", "=", "None", ")", ":", "return", "self", ".", "_lookup_friendships", "(", "list_to_csv", "(", "user_ids", ")", ",", "list_to_csv", "(", "screen_names", ")", ")" ]
cc3894073905811c4d9fd816202f93454ed932da
train
API.set_settings
:reference: https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/post-account-settings :allowed_param:'sleep_time_enabled', 'start_sleep_time', 'end_sleep_time', 'time_zone', 'trend_location_woeid', 'allow_contributor_request', 'lang'
tweepy/api.py
def set_settings(self): """ :reference: https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/post-account-settings :allowed_param:'sleep_time_enabled', 'start_sleep_time', 'end_sleep_time', 'time_zone', 'trend_location_woeid', 'allow_...
def set_settings(self): """ :reference: https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/post-account-settings :allowed_param:'sleep_time_enabled', 'start_sleep_time', 'end_sleep_time', 'time_zone', 'trend_location_woeid', 'allow_...
[ ":", "reference", ":", "https", ":", "//", "developer", ".", "twitter", ".", "com", "/", "en", "/", "docs", "/", "accounts", "-", "and", "-", "users", "/", "manage", "-", "account", "-", "settings", "/", "api", "-", "reference", "/", "post", "-", "...
tweepy/tweepy
python
https://github.com/tweepy/tweepy/blob/cc3894073905811c4d9fd816202f93454ed932da/tweepy/api.py#L619-L635
[ "def", "set_settings", "(", "self", ")", ":", "return", "bind_api", "(", "api", "=", "self", ",", "path", "=", "'/account/settings.json'", ",", "method", "=", "'POST'", ",", "payload_type", "=", "'json'", ",", "allowed_param", "=", "[", "'sleep_time_enabled'",...
cc3894073905811c4d9fd816202f93454ed932da
train
API.verify_credentials
:reference: https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/get-account-verify_credentials :allowed_param:'include_entities', 'skip_status', 'include_email'
tweepy/api.py
def verify_credentials(self, **kargs): """ :reference: https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/get-account-verify_credentials :allowed_param:'include_entities', 'skip_status', 'include_email' """ try: return bind_api(...
def verify_credentials(self, **kargs): """ :reference: https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/get-account-verify_credentials :allowed_param:'include_entities', 'skip_status', 'include_email' """ try: return bind_api(...
[ ":", "reference", ":", "https", ":", "//", "developer", ".", "twitter", ".", "com", "/", "en", "/", "docs", "/", "accounts", "-", "and", "-", "users", "/", "manage", "-", "account", "-", "settings", "/", "api", "-", "reference", "/", "get", "-", "a...
tweepy/tweepy
python
https://github.com/tweepy/tweepy/blob/cc3894073905811c4d9fd816202f93454ed932da/tweepy/api.py#L637-L652
[ "def", "verify_credentials", "(", "self", ",", "*", "*", "kargs", ")", ":", "try", ":", "return", "bind_api", "(", "api", "=", "self", ",", "path", "=", "'/account/verify_credentials.json'", ",", "payload_type", "=", "'user'", ",", "require_auth", "=", "True...
cc3894073905811c4d9fd816202f93454ed932da
train
API.rate_limit_status
:reference: https://developer.twitter.com/en/docs/developer-utilities/rate-limit-status/api-reference/get-application-rate_limit_status :allowed_param:'resources'
tweepy/api.py
def rate_limit_status(self): """ :reference: https://developer.twitter.com/en/docs/developer-utilities/rate-limit-status/api-reference/get-application-rate_limit_status :allowed_param:'resources' """ return bind_api( api=self, path='/application/rate_limit_sta...
def rate_limit_status(self): """ :reference: https://developer.twitter.com/en/docs/developer-utilities/rate-limit-status/api-reference/get-application-rate_limit_status :allowed_param:'resources' """ return bind_api( api=self, path='/application/rate_limit_sta...
[ ":", "reference", ":", "https", ":", "//", "developer", ".", "twitter", ".", "com", "/", "en", "/", "docs", "/", "developer", "-", "utilities", "/", "rate", "-", "limit", "-", "status", "/", "api", "-", "reference", "/", "get", "-", "application", "-...
tweepy/tweepy
python
https://github.com/tweepy/tweepy/blob/cc3894073905811c4d9fd816202f93454ed932da/tweepy/api.py#L655-L665
[ "def", "rate_limit_status", "(", "self", ")", ":", "return", "bind_api", "(", "api", "=", "self", ",", "path", "=", "'/application/rate_limit_status.json'", ",", "payload_type", "=", "'json'", ",", "allowed_param", "=", "[", "'resources'", "]", ",", "use_cache",...
cc3894073905811c4d9fd816202f93454ed932da
train
API.update_profile_image
:reference: https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/post-account-update_profile_image :allowed_param:'include_entities', 'skip_status'
tweepy/api.py
def update_profile_image(self, filename, file_=None): """ :reference: https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/post-account-update_profile_image :allowed_param:'include_entities', 'skip_status' """ headers, post_data = API._pack_i...
def update_profile_image(self, filename, file_=None): """ :reference: https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/post-account-update_profile_image :allowed_param:'include_entities', 'skip_status' """ headers, post_data = API._pack_i...
[ ":", "reference", ":", "https", ":", "//", "developer", ".", "twitter", ".", "com", "/", "en", "/", "docs", "/", "accounts", "-", "and", "-", "users", "/", "manage", "-", "account", "-", "settings", "/", "api", "-", "reference", "/", "post", "-", "...
tweepy/tweepy
python
https://github.com/tweepy/tweepy/blob/cc3894073905811c4d9fd816202f93454ed932da/tweepy/api.py#L681-L693
[ "def", "update_profile_image", "(", "self", ",", "filename", ",", "file_", "=", "None", ")", ":", "headers", ",", "post_data", "=", "API", ".", "_pack_image", "(", "filename", ",", "700", ",", "f", "=", "file_", ")", "return", "bind_api", "(", "api", "...
cc3894073905811c4d9fd816202f93454ed932da
train
API.favorites
:reference: https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/get-favorites-list :allowed_param:'screen_name', 'user_id', 'max_id', 'count', 'since_id', 'max_id'
tweepy/api.py
def favorites(self): """ :reference: https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/get-favorites-list :allowed_param:'screen_name', 'user_id', 'max_id', 'count', 'since_id', 'max_id' """ return bind_api( api=self, path='/favorites/...
def favorites(self): """ :reference: https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/get-favorites-list :allowed_param:'screen_name', 'user_id', 'max_id', 'count', 'since_id', 'max_id' """ return bind_api( api=self, path='/favorites/...
[ ":", "reference", ":", "https", ":", "//", "developer", ".", "twitter", ".", "com", "/", "en", "/", "docs", "/", "tweets", "/", "post", "-", "and", "-", "engage", "/", "api", "-", "reference", "/", "get", "-", "favorites", "-", "list", ":", "allowe...
tweepy/tweepy
python
https://github.com/tweepy/tweepy/blob/cc3894073905811c4d9fd816202f93454ed932da/tweepy/api.py#L739-L748
[ "def", "favorites", "(", "self", ")", ":", "return", "bind_api", "(", "api", "=", "self", ",", "path", "=", "'/favorites/list.json'", ",", "payload_type", "=", "'status'", ",", "payload_list", "=", "True", ",", "allowed_param", "=", "[", "'screen_name'", ","...
cc3894073905811c4d9fd816202f93454ed932da
train
API.saved_searches
:reference: https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/get-saved_searches-list
tweepy/api.py
def saved_searches(self): """ :reference: https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/get-saved_searches-list """ return bind_api( api=self, path='/saved_searches/list.json', payload_type='saved_search', payload_list=...
def saved_searches(self): """ :reference: https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/get-saved_searches-list """ return bind_api( api=self, path='/saved_searches/list.json', payload_type='saved_search', payload_list=...
[ ":", "reference", ":", "https", ":", "//", "developer", ".", "twitter", ".", "com", "/", "en", "/", "docs", "/", "accounts", "-", "and", "-", "users", "/", "manage", "-", "account", "-", "settings", "/", "api", "-", "reference", "/", "get", "-", "s...
tweepy/tweepy
python
https://github.com/tweepy/tweepy/blob/cc3894073905811c4d9fd816202f93454ed932da/tweepy/api.py#L882-L889
[ "def", "saved_searches", "(", "self", ")", ":", "return", "bind_api", "(", "api", "=", "self", ",", "path", "=", "'/saved_searches/list.json'", ",", "payload_type", "=", "'saved_search'", ",", "payload_list", "=", "True", ",", "require_auth", "=", "True", ")" ...
cc3894073905811c4d9fd816202f93454ed932da
train
API.add_list_members
Perform bulk add of list members from user ID or screenname
tweepy/api.py
def add_list_members(self, screen_name=None, user_id=None, slug=None, list_id=None, owner_id=None, owner_screen_name=None): """ Perform bulk add of list members from user ID or screenname """ return self._add_list_members(list_to_csv(screen_name), ...
def add_list_members(self, screen_name=None, user_id=None, slug=None, list_id=None, owner_id=None, owner_screen_name=None): """ Perform bulk add of list members from user ID or screenname """ return self._add_list_members(list_to_csv(screen_name), ...
[ "Perform", "bulk", "add", "of", "list", "members", "from", "user", "ID", "or", "screenname" ]
tweepy/tweepy
python
https://github.com/tweepy/tweepy/blob/cc3894073905811c4d9fd816202f93454ed932da/tweepy/api.py#L1072-L1078
[ "def", "add_list_members", "(", "self", ",", "screen_name", "=", "None", ",", "user_id", "=", "None", ",", "slug", "=", "None", ",", "list_id", "=", "None", ",", "owner_id", "=", "None", ",", "owner_screen_name", "=", "None", ")", ":", "return", "self", ...
cc3894073905811c4d9fd816202f93454ed932da
train
API.remove_list_members
Perform bulk remove of list members from user ID or screenname
tweepy/api.py
def remove_list_members(self, screen_name=None, user_id=None, slug=None, list_id=None, owner_id=None, owner_screen_name=None): """ Perform bulk remove of list members from user ID or screenname """ return self._remove_list_members(list_to_csv(screen_name), ...
def remove_list_members(self, screen_name=None, user_id=None, slug=None, list_id=None, owner_id=None, owner_screen_name=None): """ Perform bulk remove of list members from user ID or screenname """ return self._remove_list_members(list_to_csv(screen_name), ...
[ "Perform", "bulk", "remove", "of", "list", "members", "from", "user", "ID", "or", "screenname" ]
tweepy/tweepy
python
https://github.com/tweepy/tweepy/blob/cc3894073905811c4d9fd816202f93454ed932da/tweepy/api.py#L1097-L1103
[ "def", "remove_list_members", "(", "self", ",", "screen_name", "=", "None", ",", "user_id", "=", "None", ",", "slug", "=", "None", ",", "list_id", "=", "None", ",", "owner_id", "=", "None", ",", "owner_screen_name", "=", "None", ")", ":", "return", "self...
cc3894073905811c4d9fd816202f93454ed932da
train
StreamListener.on_data
Called when raw data is received from connection. Override this method if you wish to manually handle the stream data. Return False to stop stream and close connection.
tweepy/streaming.py
def on_data(self, raw_data): """Called when raw data is received from connection. Override this method if you wish to manually handle the stream data. Return False to stop stream and close connection. """ data = json.loads(raw_data) if 'in_reply_to_status_id' in data: ...
def on_data(self, raw_data): """Called when raw data is received from connection. Override this method if you wish to manually handle the stream data. Return False to stop stream and close connection. """ data = json.loads(raw_data) if 'in_reply_to_status_id' in data: ...
[ "Called", "when", "raw", "data", "is", "received", "from", "connection", "." ]
tweepy/tweepy
python
https://github.com/tweepy/tweepy/blob/cc3894073905811c4d9fd816202f93454ed932da/tweepy/streaming.py#L45-L82
[ "def", "on_data", "(", "self", ",", "raw_data", ")", ":", "data", "=", "json", ".", "loads", "(", "raw_data", ")", "if", "'in_reply_to_status_id'", "in", "data", ":", "status", "=", "Status", ".", "parse", "(", "self", ".", "api", ",", "data", ")", "...
cc3894073905811c4d9fd816202f93454ed932da
train
ReadBuffer.read_line
Read the data stream until a given separator is found (default \n) :param sep: Separator to read until. Must by of the bytes type (str in python 2, bytes in python 3) :return: The str of the data read until sep
tweepy/streaming.py
def read_line(self, sep=six.b('\n')): """Read the data stream until a given separator is found (default \n) :param sep: Separator to read until. Must by of the bytes type (str in python 2, bytes in python 3) :return: The str of the data read until sep """ start = 0 ...
def read_line(self, sep=six.b('\n')): """Read the data stream until a given separator is found (default \n) :param sep: Separator to read until. Must by of the bytes type (str in python 2, bytes in python 3) :return: The str of the data read until sep """ start = 0 ...
[ "Read", "the", "data", "stream", "until", "a", "given", "separator", "is", "found", "(", "default", "\\", "n", ")" ]
tweepy/tweepy
python
https://github.com/tweepy/tweepy/blob/cc3894073905811c4d9fd816202f93454ed932da/tweepy/streaming.py#L167-L182
[ "def", "read_line", "(", "self", ",", "sep", "=", "six", ".", "b", "(", "'\\n'", ")", ")", ":", "start", "=", "0", "while", "not", "self", ".", "_stream", ".", "closed", ":", "loc", "=", "self", ".", "_buffer", ".", "find", "(", "sep", ",", "st...
cc3894073905811c4d9fd816202f93454ed932da
train
Cursor.pages
Return iterator for pages
tweepy/cursor.py
def pages(self, limit=0): """Return iterator for pages""" if limit > 0: self.iterator.limit = limit return self.iterator
def pages(self, limit=0): """Return iterator for pages""" if limit > 0: self.iterator.limit = limit return self.iterator
[ "Return", "iterator", "for", "pages" ]
tweepy/tweepy
python
https://github.com/tweepy/tweepy/blob/cc3894073905811c4d9fd816202f93454ed932da/tweepy/cursor.py#L27-L31
[ "def", "pages", "(", "self", ",", "limit", "=", "0", ")", ":", "if", "limit", ">", "0", ":", "self", ".", "iterator", ".", "limit", "=", "limit", "return", "self", ".", "iterator" ]
cc3894073905811c4d9fd816202f93454ed932da
train
Cursor.items
Return iterator for items in each page
tweepy/cursor.py
def items(self, limit=0): """Return iterator for items in each page""" i = ItemIterator(self.iterator) i.limit = limit return i
def items(self, limit=0): """Return iterator for items in each page""" i = ItemIterator(self.iterator) i.limit = limit return i
[ "Return", "iterator", "for", "items", "in", "each", "page" ]
tweepy/tweepy
python
https://github.com/tweepy/tweepy/blob/cc3894073905811c4d9fd816202f93454ed932da/tweepy/cursor.py#L33-L37
[ "def", "items", "(", "self", ",", "limit", "=", "0", ")", ":", "i", "=", "ItemIterator", "(", "self", ".", "iterator", ")", "i", ".", "limit", "=", "limit", "return", "i" ]
cc3894073905811c4d9fd816202f93454ed932da
train
IdIterator.next
Fetch a set of items with IDs less than current set.
tweepy/cursor.py
def next(self): """Fetch a set of items with IDs less than current set.""" if self.limit and self.limit == self.num_tweets: raise StopIteration if self.index >= len(self.results) - 1: data = self.method(max_id=self.max_id, parser=RawParser(), *self.args, **self.kargs) ...
def next(self): """Fetch a set of items with IDs less than current set.""" if self.limit and self.limit == self.num_tweets: raise StopIteration if self.index >= len(self.results) - 1: data = self.method(max_id=self.max_id, parser=RawParser(), *self.args, **self.kargs) ...
[ "Fetch", "a", "set", "of", "items", "with", "IDs", "less", "than", "current", "set", "." ]
tweepy/tweepy
python
https://github.com/tweepy/tweepy/blob/cc3894073905811c4d9fd816202f93454ed932da/tweepy/cursor.py#L102-L139
[ "def", "next", "(", "self", ")", ":", "if", "self", ".", "limit", "and", "self", ".", "limit", "==", "self", ".", "num_tweets", ":", "raise", "StopIteration", "if", "self", ".", "index", ">=", "len", "(", "self", ".", "results", ")", "-", "1", ":",...
cc3894073905811c4d9fd816202f93454ed932da
train
IdIterator.prev
Fetch a set of items with IDs greater than current set.
tweepy/cursor.py
def prev(self): """Fetch a set of items with IDs greater than current set.""" if self.limit and self.limit == self.num_tweets: raise StopIteration self.index -= 1 if self.index < 0: # There's no way to fetch a set of tweets directly 'above' the # curr...
def prev(self): """Fetch a set of items with IDs greater than current set.""" if self.limit and self.limit == self.num_tweets: raise StopIteration self.index -= 1 if self.index < 0: # There's no way to fetch a set of tweets directly 'above' the # curr...
[ "Fetch", "a", "set", "of", "items", "with", "IDs", "greater", "than", "current", "set", "." ]
tweepy/tweepy
python
https://github.com/tweepy/tweepy/blob/cc3894073905811c4d9fd816202f93454ed932da/tweepy/cursor.py#L141-L155
[ "def", "prev", "(", "self", ")", ":", "if", "self", ".", "limit", "and", "self", ".", "limit", "==", "self", ".", "num_tweets", ":", "raise", "StopIteration", "self", ".", "index", "-=", "1", "if", "self", ".", "index", "<", "0", ":", "# There's no w...
cc3894073905811c4d9fd816202f93454ed932da
train
DepthCache.add_bid
Add a bid to the cache :param bid: :return:
binance/depthcache.py
def add_bid(self, bid): """Add a bid to the cache :param bid: :return: """ self._bids[bid[0]] = float(bid[1]) if bid[1] == "0.00000000": del self._bids[bid[0]]
def add_bid(self, bid): """Add a bid to the cache :param bid: :return: """ self._bids[bid[0]] = float(bid[1]) if bid[1] == "0.00000000": del self._bids[bid[0]]
[ "Add", "a", "bid", "to", "the", "cache" ]
sammchardy/python-binance
python
https://github.com/sammchardy/python-binance/blob/31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc/binance/depthcache.py#L23-L32
[ "def", "add_bid", "(", "self", ",", "bid", ")", ":", "self", ".", "_bids", "[", "bid", "[", "0", "]", "]", "=", "float", "(", "bid", "[", "1", "]", ")", "if", "bid", "[", "1", "]", "==", "\"0.00000000\"", ":", "del", "self", ".", "_bids", "["...
31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc
train
DepthCache.add_ask
Add an ask to the cache :param ask: :return:
binance/depthcache.py
def add_ask(self, ask): """Add an ask to the cache :param ask: :return: """ self._asks[ask[0]] = float(ask[1]) if ask[1] == "0.00000000": del self._asks[ask[0]]
def add_ask(self, ask): """Add an ask to the cache :param ask: :return: """ self._asks[ask[0]] = float(ask[1]) if ask[1] == "0.00000000": del self._asks[ask[0]]
[ "Add", "an", "ask", "to", "the", "cache" ]
sammchardy/python-binance
python
https://github.com/sammchardy/python-binance/blob/31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc/binance/depthcache.py#L34-L43
[ "def", "add_ask", "(", "self", ",", "ask", ")", ":", "self", ".", "_asks", "[", "ask", "[", "0", "]", "]", "=", "float", "(", "ask", "[", "1", "]", ")", "if", "ask", "[", "1", "]", "==", "\"0.00000000\"", ":", "del", "self", ".", "_asks", "["...
31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc
train
DepthCache.sort_depth
Sort bids or asks by price
binance/depthcache.py
def sort_depth(vals, reverse=False): """Sort bids or asks by price """ lst = [[float(price), quantity] for price, quantity in vals.items()] lst = sorted(lst, key=itemgetter(0), reverse=reverse) return lst
def sort_depth(vals, reverse=False): """Sort bids or asks by price """ lst = [[float(price), quantity] for price, quantity in vals.items()] lst = sorted(lst, key=itemgetter(0), reverse=reverse) return lst
[ "Sort", "bids", "or", "asks", "by", "price" ]
sammchardy/python-binance
python
https://github.com/sammchardy/python-binance/blob/31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc/binance/depthcache.py#L112-L117
[ "def", "sort_depth", "(", "vals", ",", "reverse", "=", "False", ")", ":", "lst", "=", "[", "[", "float", "(", "price", ")", ",", "quantity", "]", "for", "price", ",", "quantity", "in", "vals", ".", "items", "(", ")", "]", "lst", "=", "sorted", "(...
31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc
train
DepthCacheManager._init_cache
Initialise the depth cache calling REST endpoint :return:
binance/depthcache.py
def _init_cache(self): """Initialise the depth cache calling REST endpoint :return: """ self._last_update_id = None self._depth_message_buffer = [] res = self._client.get_order_book(symbol=self._symbol, limit=self._limit) # process bid and asks from the order b...
def _init_cache(self): """Initialise the depth cache calling REST endpoint :return: """ self._last_update_id = None self._depth_message_buffer = [] res = self._client.get_order_book(symbol=self._symbol, limit=self._limit) # process bid and asks from the order b...
[ "Initialise", "the", "depth", "cache", "calling", "REST", "endpoint" ]
sammchardy/python-binance
python
https://github.com/sammchardy/python-binance/blob/31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc/binance/depthcache.py#L153-L181
[ "def", "_init_cache", "(", "self", ")", ":", "self", ".", "_last_update_id", "=", "None", "self", ".", "_depth_message_buffer", "=", "[", "]", "res", "=", "self", ".", "_client", ".", "get_order_book", "(", "symbol", "=", "self", ".", "_symbol", ",", "li...
31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc
train
DepthCacheManager._start_socket
Start the depth cache socket :return:
binance/depthcache.py
def _start_socket(self): """Start the depth cache socket :return: """ if self._bm is None: self._bm = BinanceSocketManager(self._client) self._conn_key = self._bm.start_depth_socket(self._symbol, self._depth_event) if not self._bm.is_alive(): sel...
def _start_socket(self): """Start the depth cache socket :return: """ if self._bm is None: self._bm = BinanceSocketManager(self._client) self._conn_key = self._bm.start_depth_socket(self._symbol, self._depth_event) if not self._bm.is_alive(): sel...
[ "Start", "the", "depth", "cache", "socket" ]
sammchardy/python-binance
python
https://github.com/sammchardy/python-binance/blob/31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc/binance/depthcache.py#L183-L197
[ "def", "_start_socket", "(", "self", ")", ":", "if", "self", ".", "_bm", "is", "None", ":", "self", ".", "_bm", "=", "BinanceSocketManager", "(", "self", ".", "_client", ")", "self", ".", "_conn_key", "=", "self", ".", "_bm", ".", "start_depth_socket", ...
31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc
train
DepthCacheManager._depth_event
Handle a depth event :param msg: :return:
binance/depthcache.py
def _depth_event(self, msg): """Handle a depth event :param msg: :return: """ if 'e' in msg and msg['e'] == 'error': # close the socket self.close() # notify the user by returning a None value if self._callback: ...
def _depth_event(self, msg): """Handle a depth event :param msg: :return: """ if 'e' in msg and msg['e'] == 'error': # close the socket self.close() # notify the user by returning a None value if self._callback: ...
[ "Handle", "a", "depth", "event" ]
sammchardy/python-binance
python
https://github.com/sammchardy/python-binance/blob/31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc/binance/depthcache.py#L199-L219
[ "def", "_depth_event", "(", "self", ",", "msg", ")", ":", "if", "'e'", "in", "msg", "and", "msg", "[", "'e'", "]", "==", "'error'", ":", "# close the socket", "self", ".", "close", "(", ")", "# notify the user by returning a None value", "if", "self", ".", ...
31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc
train
DepthCacheManager._process_depth_message
Process a depth event message. :param msg: Depth event message. :return:
binance/depthcache.py
def _process_depth_message(self, msg, buffer=False): """Process a depth event message. :param msg: Depth event message. :return: """ if buffer and msg['u'] <= self._last_update_id: # ignore any updates before the initial update id return elif ms...
def _process_depth_message(self, msg, buffer=False): """Process a depth event message. :param msg: Depth event message. :return: """ if buffer and msg['u'] <= self._last_update_id: # ignore any updates before the initial update id return elif ms...
[ "Process", "a", "depth", "event", "message", "." ]
sammchardy/python-binance
python
https://github.com/sammchardy/python-binance/blob/31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc/binance/depthcache.py#L221-L254
[ "def", "_process_depth_message", "(", "self", ",", "msg", ",", "buffer", "=", "False", ")", ":", "if", "buffer", "and", "msg", "[", "'u'", "]", "<=", "self", ".", "_last_update_id", ":", "# ignore any updates before the initial update id", "return", "elif", "msg...
31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc
train
DepthCacheManager.close
Close the open socket for this manager :return:
binance/depthcache.py
def close(self, close_socket=False): """Close the open socket for this manager :return: """ self._bm.stop_socket(self._conn_key) if close_socket: self._bm.close() time.sleep(1) self._depth_cache = None
def close(self, close_socket=False): """Close the open socket for this manager :return: """ self._bm.stop_socket(self._conn_key) if close_socket: self._bm.close() time.sleep(1) self._depth_cache = None
[ "Close", "the", "open", "socket", "for", "this", "manager" ]
sammchardy/python-binance
python
https://github.com/sammchardy/python-binance/blob/31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc/binance/depthcache.py#L264-L273
[ "def", "close", "(", "self", ",", "close_socket", "=", "False", ")", ":", "self", ".", "_bm", ".", "stop_socket", "(", "self", ".", "_conn_key", ")", "if", "close_socket", ":", "self", ".", "_bm", ".", "close", "(", ")", "time", ".", "sleep", "(", ...
31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc
train
date_to_milliseconds
Convert UTC date to milliseconds If using offset strings add "UTC" to date string e.g. "now UTC", "11 hours ago UTC" See dateparse docs for formats http://dateparser.readthedocs.io/en/latest/ :param date_str: date in readable format, i.e. "January 01, 2018", "11 hours ago UTC", "now UTC" :type date_s...
examples/save_historical_data.py
def date_to_milliseconds(date_str): """Convert UTC date to milliseconds If using offset strings add "UTC" to date string e.g. "now UTC", "11 hours ago UTC" See dateparse docs for formats http://dateparser.readthedocs.io/en/latest/ :param date_str: date in readable format, i.e. "January 01, 2018", "11...
def date_to_milliseconds(date_str): """Convert UTC date to milliseconds If using offset strings add "UTC" to date string e.g. "now UTC", "11 hours ago UTC" See dateparse docs for formats http://dateparser.readthedocs.io/en/latest/ :param date_str: date in readable format, i.e. "January 01, 2018", "11...
[ "Convert", "UTC", "date", "to", "milliseconds" ]
sammchardy/python-binance
python
https://github.com/sammchardy/python-binance/blob/31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc/examples/save_historical_data.py#L10-L29
[ "def", "date_to_milliseconds", "(", "date_str", ")", ":", "# get epoch value in UTC", "epoch", "=", "datetime", ".", "utcfromtimestamp", "(", "0", ")", ".", "replace", "(", "tzinfo", "=", "pytz", ".", "utc", ")", "# parse our date string", "d", "=", "dateparser"...
31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc
train
interval_to_milliseconds
Convert a Binance interval string to milliseconds :param interval: Binance interval string 1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 8h, 12h, 1d, 3d, 1w :type interval: str :return: None if unit not one of m, h, d or w None if string not in correct format int value of interval in mi...
examples/save_historical_data.py
def interval_to_milliseconds(interval): """Convert a Binance interval string to milliseconds :param interval: Binance interval string 1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 8h, 12h, 1d, 3d, 1w :type interval: str :return: None if unit not one of m, h, d or w None if string not in corr...
def interval_to_milliseconds(interval): """Convert a Binance interval string to milliseconds :param interval: Binance interval string 1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 8h, 12h, 1d, 3d, 1w :type interval: str :return: None if unit not one of m, h, d or w None if string not in corr...
[ "Convert", "a", "Binance", "interval", "string", "to", "milliseconds" ]
sammchardy/python-binance
python
https://github.com/sammchardy/python-binance/blob/31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc/examples/save_historical_data.py#L32-L57
[ "def", "interval_to_milliseconds", "(", "interval", ")", ":", "ms", "=", "None", "seconds_per_unit", "=", "{", "\"m\"", ":", "60", ",", "\"h\"", ":", "60", "*", "60", ",", "\"d\"", ":", "24", "*", "60", "*", "60", ",", "\"w\"", ":", "7", "*", "24",...
31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc
train
get_historical_klines
Get Historical Klines from Binance See dateparse docs for valid start and end string formats http://dateparser.readthedocs.io/en/latest/ If using offset strings for dates add "UTC" to date string e.g. "now UTC", "11 hours ago UTC" :param symbol: Name of symbol pair e.g BNBBTC :type symbol: str :p...
examples/save_historical_data.py
def get_historical_klines(symbol, interval, start_str, end_str=None): """Get Historical Klines from Binance See dateparse docs for valid start and end string formats http://dateparser.readthedocs.io/en/latest/ If using offset strings for dates add "UTC" to date string e.g. "now UTC", "11 hours ago UTC" ...
def get_historical_klines(symbol, interval, start_str, end_str=None): """Get Historical Klines from Binance See dateparse docs for valid start and end string formats http://dateparser.readthedocs.io/en/latest/ If using offset strings for dates add "UTC" to date string e.g. "now UTC", "11 hours ago UTC" ...
[ "Get", "Historical", "Klines", "from", "Binance" ]
sammchardy/python-binance
python
https://github.com/sammchardy/python-binance/blob/31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc/examples/save_historical_data.py#L60-L136
[ "def", "get_historical_klines", "(", "symbol", ",", "interval", ",", "start_str", ",", "end_str", "=", "None", ")", ":", "# create the Binance client, no need for api key", "client", "=", "Client", "(", "\"\"", ",", "\"\"", ")", "# init our list", "output_data", "="...
31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc
train
Client._order_params
Convert params to list with signature as last element :param data: :return:
binance/client.py
def _order_params(self, data): """Convert params to list with signature as last element :param data: :return: """ has_signature = False params = [] for key, value in data.items(): if key == 'signature': has_signature = True ...
def _order_params(self, data): """Convert params to list with signature as last element :param data: :return: """ has_signature = False params = [] for key, value in data.items(): if key == 'signature': has_signature = True ...
[ "Convert", "params", "to", "list", "with", "signature", "as", "last", "element" ]
sammchardy/python-binance
python
https://github.com/sammchardy/python-binance/blob/31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc/binance/client.py#L121-L139
[ "def", "_order_params", "(", "self", ",", "data", ")", ":", "has_signature", "=", "False", "params", "=", "[", "]", "for", "key", ",", "value", "in", "data", ".", "items", "(", ")", ":", "if", "key", "==", "'signature'", ":", "has_signature", "=", "T...
31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc
train
Client._handle_response
Internal helper for handling API responses from the Binance server. Raises the appropriate exceptions when necessary; otherwise, returns the response.
binance/client.py
def _handle_response(self, response): """Internal helper for handling API responses from the Binance server. Raises the appropriate exceptions when necessary; otherwise, returns the response. """ if not str(response.status_code).startswith('2'): raise BinanceAPIExcept...
def _handle_response(self, response): """Internal helper for handling API responses from the Binance server. Raises the appropriate exceptions when necessary; otherwise, returns the response. """ if not str(response.status_code).startswith('2'): raise BinanceAPIExcept...
[ "Internal", "helper", "for", "handling", "API", "responses", "from", "the", "Binance", "server", ".", "Raises", "the", "appropriate", "exceptions", "when", "necessary", ";", "otherwise", "returns", "the", "response", "." ]
sammchardy/python-binance
python
https://github.com/sammchardy/python-binance/blob/31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc/binance/client.py#L194-L204
[ "def", "_handle_response", "(", "self", ",", "response", ")", ":", "if", "not", "str", "(", "response", ".", "status_code", ")", ".", "startswith", "(", "'2'", ")", ":", "raise", "BinanceAPIException", "(", "response", ")", "try", ":", "return", "response"...
31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc
train
Client.get_symbol_info
Return information about a symbol :param symbol: required e.g BNBBTC :type symbol: str :returns: Dict if found, None if not .. code-block:: python { "symbol": "ETHBTC", "status": "TRADING", "baseAsset": "ETH", ...
binance/client.py
def get_symbol_info(self, symbol): """Return information about a symbol :param symbol: required e.g BNBBTC :type symbol: str :returns: Dict if found, None if not .. code-block:: python { "symbol": "ETHBTC", "status": "TRADING", ...
def get_symbol_info(self, symbol): """Return information about a symbol :param symbol: required e.g BNBBTC :type symbol: str :returns: Dict if found, None if not .. code-block:: python { "symbol": "ETHBTC", "status": "TRADING", ...
[ "Return", "information", "about", "a", "symbol" ]
sammchardy/python-binance
python
https://github.com/sammchardy/python-binance/blob/31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc/binance/client.py#L298-L345
[ "def", "get_symbol_info", "(", "self", ",", "symbol", ")", ":", "res", "=", "self", ".", "_get", "(", "'exchangeInfo'", ")", "for", "item", "in", "res", "[", "'symbols'", "]", ":", "if", "item", "[", "'symbol'", "]", "==", "symbol", ".", "upper", "("...
31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc
train
Client.aggregate_trade_iter
Iterate over aggregate trade data from (start_time or last_id) to the end of the history so far. If start_time is specified, start with the first trade after start_time. Meant to initialise a local cache of trade data. If last_id is specified, start with the trade after it. This is mea...
binance/client.py
def aggregate_trade_iter(self, symbol, start_str=None, last_id=None): """Iterate over aggregate trade data from (start_time or last_id) to the end of the history so far. If start_time is specified, start with the first trade after start_time. Meant to initialise a local cache of trade d...
def aggregate_trade_iter(self, symbol, start_str=None, last_id=None): """Iterate over aggregate trade data from (start_time or last_id) to the end of the history so far. If start_time is specified, start with the first trade after start_time. Meant to initialise a local cache of trade d...
[ "Iterate", "over", "aggregate", "trade", "data", "from", "(", "start_time", "or", "last_id", ")", "to", "the", "end", "of", "the", "history", "so", "far", "." ]
sammchardy/python-binance
python
https://github.com/sammchardy/python-binance/blob/31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc/binance/client.py#L579-L663
[ "def", "aggregate_trade_iter", "(", "self", ",", "symbol", ",", "start_str", "=", "None", ",", "last_id", "=", "None", ")", ":", "if", "start_str", "is", "not", "None", "and", "last_id", "is", "not", "None", ":", "raise", "ValueError", "(", "'start_time an...
31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc
train
Client._get_earliest_valid_timestamp
Get earliest valid open timestamp from Binance :param symbol: Name of symbol pair e.g BNBBTC :type symbol: str :param interval: Binance Kline interval :type interval: str :return: first valid timestamp
binance/client.py
def _get_earliest_valid_timestamp(self, symbol, interval): """Get earliest valid open timestamp from Binance :param symbol: Name of symbol pair e.g BNBBTC :type symbol: str :param interval: Binance Kline interval :type interval: str :return: first valid timestamp ...
def _get_earliest_valid_timestamp(self, symbol, interval): """Get earliest valid open timestamp from Binance :param symbol: Name of symbol pair e.g BNBBTC :type symbol: str :param interval: Binance Kline interval :type interval: str :return: first valid timestamp ...
[ "Get", "earliest", "valid", "open", "timestamp", "from", "Binance" ]
sammchardy/python-binance
python
https://github.com/sammchardy/python-binance/blob/31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc/binance/client.py#L707-L725
[ "def", "_get_earliest_valid_timestamp", "(", "self", ",", "symbol", ",", "interval", ")", ":", "kline", "=", "self", ".", "get_klines", "(", "symbol", "=", "symbol", ",", "interval", "=", "interval", ",", "limit", "=", "1", ",", "startTime", "=", "0", ",...
31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc
train
Client.get_historical_klines
Get Historical Klines from Binance See dateparser docs for valid start and end string formats http://dateparser.readthedocs.io/en/latest/ If using offset strings for dates add "UTC" to date string e.g. "now UTC", "11 hours ago UTC" :param symbol: Name of symbol pair e.g BNBBTC :type s...
binance/client.py
def get_historical_klines(self, symbol, interval, start_str, end_str=None, limit=500): """Get Historical Klines from Binance See dateparser docs for valid start and end string formats http://dateparser.readthedocs.io/en/latest/ If using offset strings for dates ad...
def get_historical_klines(self, symbol, interval, start_str, end_str=None, limit=500): """Get Historical Klines from Binance See dateparser docs for valid start and end string formats http://dateparser.readthedocs.io/en/latest/ If using offset strings for dates ad...
[ "Get", "Historical", "Klines", "from", "Binance" ]
sammchardy/python-binance
python
https://github.com/sammchardy/python-binance/blob/31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc/binance/client.py#L727-L810
[ "def", "get_historical_klines", "(", "self", ",", "symbol", ",", "interval", ",", "start_str", ",", "end_str", "=", "None", ",", "limit", "=", "500", ")", ":", "# init our list", "output_data", "=", "[", "]", "# setup the max limit", "limit", "=", "limit", "...
31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc
train
Client.get_symbol_ticker
Latest price for a symbol or symbols. https://github.com/binance-exchange/binance-official-api-docs/blob/master/rest-api.md#24hr-ticker-price-change-statistics :param symbol: :type symbol: str :returns: API response .. code-block:: python { "symbo...
binance/client.py
def get_symbol_ticker(self, **params): """Latest price for a symbol or symbols. https://github.com/binance-exchange/binance-official-api-docs/blob/master/rest-api.md#24hr-ticker-price-change-statistics :param symbol: :type symbol: str :returns: API response .. code-bl...
def get_symbol_ticker(self, **params): """Latest price for a symbol or symbols. https://github.com/binance-exchange/binance-official-api-docs/blob/master/rest-api.md#24hr-ticker-price-change-statistics :param symbol: :type symbol: str :returns: API response .. code-bl...
[ "Latest", "price", "for", "a", "symbol", "or", "symbols", "." ]
sammchardy/python-binance
python
https://github.com/sammchardy/python-binance/blob/31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc/binance/client.py#L952-L987
[ "def", "get_symbol_ticker", "(", "self", ",", "*", "*", "params", ")", ":", "return", "self", ".", "_get", "(", "'ticker/price'", ",", "data", "=", "params", ",", "version", "=", "self", ".", "PRIVATE_API_VERSION", ")" ]
31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc
train
Client.get_orderbook_ticker
Latest price for a symbol or symbols. https://github.com/binance-exchange/binance-official-api-docs/blob/master/rest-api.md#symbol-order-book-ticker :param symbol: :type symbol: str :returns: API response .. code-block:: python { "symbol": "LTCBTC...
binance/client.py
def get_orderbook_ticker(self, **params): """Latest price for a symbol or symbols. https://github.com/binance-exchange/binance-official-api-docs/blob/master/rest-api.md#symbol-order-book-ticker :param symbol: :type symbol: str :returns: API response .. code-block:: py...
def get_orderbook_ticker(self, **params): """Latest price for a symbol or symbols. https://github.com/binance-exchange/binance-official-api-docs/blob/master/rest-api.md#symbol-order-book-ticker :param symbol: :type symbol: str :returns: API response .. code-block:: py...
[ "Latest", "price", "for", "a", "symbol", "or", "symbols", "." ]
sammchardy/python-binance
python
https://github.com/sammchardy/python-binance/blob/31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc/binance/client.py#L989-L1033
[ "def", "get_orderbook_ticker", "(", "self", ",", "*", "*", "params", ")", ":", "return", "self", ".", "_get", "(", "'ticker/bookTicker'", ",", "data", "=", "params", ",", "version", "=", "self", ".", "PRIVATE_API_VERSION", ")" ]
31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc
train
Client.order_limit
Send in a new limit order Any order with an icebergQty MUST have timeInForce set to GTC. :param symbol: required :type symbol: str :param side: required :type side: str :param quantity: required :type quantity: decimal :param price: required :typ...
binance/client.py
def order_limit(self, timeInForce=TIME_IN_FORCE_GTC, **params): """Send in a new limit order Any order with an icebergQty MUST have timeInForce set to GTC. :param symbol: required :type symbol: str :param side: required :type side: str :param quantity: required ...
def order_limit(self, timeInForce=TIME_IN_FORCE_GTC, **params): """Send in a new limit order Any order with an icebergQty MUST have timeInForce set to GTC. :param symbol: required :type symbol: str :param side: required :type side: str :param quantity: required ...
[ "Send", "in", "a", "new", "limit", "order" ]
sammchardy/python-binance
python
https://github.com/sammchardy/python-binance/blob/31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc/binance/client.py#L1151-L1186
[ "def", "order_limit", "(", "self", ",", "timeInForce", "=", "TIME_IN_FORCE_GTC", ",", "*", "*", "params", ")", ":", "params", ".", "update", "(", "{", "'type'", ":", "self", ".", "ORDER_TYPE_LIMIT", ",", "'timeInForce'", ":", "timeInForce", "}", ")", "retu...
31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc
train
Client.order_limit_buy
Send in a new limit buy order Any order with an icebergQty MUST have timeInForce set to GTC. :param symbol: required :type symbol: str :param quantity: required :type quantity: decimal :param price: required :type price: str :param timeInForce: default G...
binance/client.py
def order_limit_buy(self, timeInForce=TIME_IN_FORCE_GTC, **params): """Send in a new limit buy order Any order with an icebergQty MUST have timeInForce set to GTC. :param symbol: required :type symbol: str :param quantity: required :type quantity: decimal :param...
def order_limit_buy(self, timeInForce=TIME_IN_FORCE_GTC, **params): """Send in a new limit buy order Any order with an icebergQty MUST have timeInForce set to GTC. :param symbol: required :type symbol: str :param quantity: required :type quantity: decimal :param...
[ "Send", "in", "a", "new", "limit", "buy", "order" ]
sammchardy/python-binance
python
https://github.com/sammchardy/python-binance/blob/31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc/binance/client.py#L1188-L1222
[ "def", "order_limit_buy", "(", "self", ",", "timeInForce", "=", "TIME_IN_FORCE_GTC", ",", "*", "*", "params", ")", ":", "params", ".", "update", "(", "{", "'side'", ":", "self", ".", "SIDE_BUY", ",", "}", ")", "return", "self", ".", "order_limit", "(", ...
31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc
train
Client.order_limit_sell
Send in a new limit sell order :param symbol: required :type symbol: str :param quantity: required :type quantity: decimal :param price: required :type price: str :param timeInForce: default Good till cancelled :type timeInForce: str :param newCli...
binance/client.py
def order_limit_sell(self, timeInForce=TIME_IN_FORCE_GTC, **params): """Send in a new limit sell order :param symbol: required :type symbol: str :param quantity: required :type quantity: decimal :param price: required :type price: str :param timeInForce: ...
def order_limit_sell(self, timeInForce=TIME_IN_FORCE_GTC, **params): """Send in a new limit sell order :param symbol: required :type symbol: str :param quantity: required :type quantity: decimal :param price: required :type price: str :param timeInForce: ...
[ "Send", "in", "a", "new", "limit", "sell", "order" ]
sammchardy/python-binance
python
https://github.com/sammchardy/python-binance/blob/31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc/binance/client.py#L1224-L1256
[ "def", "order_limit_sell", "(", "self", ",", "timeInForce", "=", "TIME_IN_FORCE_GTC", ",", "*", "*", "params", ")", ":", "params", ".", "update", "(", "{", "'side'", ":", "self", ".", "SIDE_SELL", "}", ")", "return", "self", ".", "order_limit", "(", "tim...
31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc
train
Client.order_market
Send in a new market order :param symbol: required :type symbol: str :param side: required :type side: str :param quantity: required :type quantity: decimal :param newClientOrderId: A unique id for the order. Automatically generated if not sent. :type new...
binance/client.py
def order_market(self, **params): """Send in a new market order :param symbol: required :type symbol: str :param side: required :type side: str :param quantity: required :type quantity: decimal :param newClientOrderId: A unique id for the order. Automatic...
def order_market(self, **params): """Send in a new market order :param symbol: required :type symbol: str :param side: required :type side: str :param quantity: required :type quantity: decimal :param newClientOrderId: A unique id for the order. Automatic...
[ "Send", "in", "a", "new", "market", "order" ]
sammchardy/python-binance
python
https://github.com/sammchardy/python-binance/blob/31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc/binance/client.py#L1258-L1284
[ "def", "order_market", "(", "self", ",", "*", "*", "params", ")", ":", "params", ".", "update", "(", "{", "'type'", ":", "self", ".", "ORDER_TYPE_MARKET", "}", ")", "return", "self", ".", "create_order", "(", "*", "*", "params", ")" ]
31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc
train
Client.order_market_buy
Send in a new market buy order :param symbol: required :type symbol: str :param quantity: required :type quantity: decimal :param newClientOrderId: A unique id for the order. Automatically generated if not sent. :type newClientOrderId: str :param newOrderRespType...
binance/client.py
def order_market_buy(self, **params): """Send in a new market buy order :param symbol: required :type symbol: str :param quantity: required :type quantity: decimal :param newClientOrderId: A unique id for the order. Automatically generated if not sent. :type newC...
def order_market_buy(self, **params): """Send in a new market buy order :param symbol: required :type symbol: str :param quantity: required :type quantity: decimal :param newClientOrderId: A unique id for the order. Automatically generated if not sent. :type newC...
[ "Send", "in", "a", "new", "market", "buy", "order" ]
sammchardy/python-binance
python
https://github.com/sammchardy/python-binance/blob/31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc/binance/client.py#L1286-L1310
[ "def", "order_market_buy", "(", "self", ",", "*", "*", "params", ")", ":", "params", ".", "update", "(", "{", "'side'", ":", "self", ".", "SIDE_BUY", "}", ")", "return", "self", ".", "order_market", "(", "*", "*", "params", ")" ]
31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc
train
Client.order_market_sell
Send in a new market sell order :param symbol: required :type symbol: str :param quantity: required :type quantity: decimal :param newClientOrderId: A unique id for the order. Automatically generated if not sent. :type newClientOrderId: str :param newOrderRespTyp...
binance/client.py
def order_market_sell(self, **params): """Send in a new market sell order :param symbol: required :type symbol: str :param quantity: required :type quantity: decimal :param newClientOrderId: A unique id for the order. Automatically generated if not sent. :type ne...
def order_market_sell(self, **params): """Send in a new market sell order :param symbol: required :type symbol: str :param quantity: required :type quantity: decimal :param newClientOrderId: A unique id for the order. Automatically generated if not sent. :type ne...
[ "Send", "in", "a", "new", "market", "sell", "order" ]
sammchardy/python-binance
python
https://github.com/sammchardy/python-binance/blob/31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc/binance/client.py#L1312-L1336
[ "def", "order_market_sell", "(", "self", ",", "*", "*", "params", ")", ":", "params", ".", "update", "(", "{", "'side'", ":", "self", ".", "SIDE_SELL", "}", ")", "return", "self", ".", "order_market", "(", "*", "*", "params", ")" ]
31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc
train
Client.get_asset_balance
Get current asset balance. https://github.com/binance-exchange/binance-official-api-docs/blob/master/rest-api.md#account-information-user_data :param asset: required :type asset: str :param recvWindow: the number of milliseconds the request is valid for :type recvWindow: int ...
binance/client.py
def get_asset_balance(self, asset, **params): """Get current asset balance. https://github.com/binance-exchange/binance-official-api-docs/blob/master/rest-api.md#account-information-user_data :param asset: required :type asset: str :param recvWindow: the number of milliseconds ...
def get_asset_balance(self, asset, **params): """Get current asset balance. https://github.com/binance-exchange/binance-official-api-docs/blob/master/rest-api.md#account-information-user_data :param asset: required :type asset: str :param recvWindow: the number of milliseconds ...
[ "Get", "current", "asset", "balance", "." ]
sammchardy/python-binance
python
https://github.com/sammchardy/python-binance/blob/31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc/binance/client.py#L1565-L1594
[ "def", "get_asset_balance", "(", "self", ",", "asset", ",", "*", "*", "params", ")", ":", "res", "=", "self", ".", "get_account", "(", "*", "*", "params", ")", "# find asset balance in list of balances", "if", "\"balances\"", "in", "res", ":", "for", "bal", ...
31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc
train
Client.get_account_status
Get account status detail. https://github.com/binance-exchange/binance-official-api-docs/blob/master/wapi-api.md#account-status-user_data :param recvWindow: the number of milliseconds the request is valid for :type recvWindow: int :returns: API response .. code-block:: python...
binance/client.py
def get_account_status(self, **params): """Get account status detail. https://github.com/binance-exchange/binance-official-api-docs/blob/master/wapi-api.md#account-status-user_data :param recvWindow: the number of milliseconds the request is valid for :type recvWindow: int :re...
def get_account_status(self, **params): """Get account status detail. https://github.com/binance-exchange/binance-official-api-docs/blob/master/wapi-api.md#account-status-user_data :param recvWindow: the number of milliseconds the request is valid for :type recvWindow: int :re...
[ "Get", "account", "status", "detail", "." ]
sammchardy/python-binance
python
https://github.com/sammchardy/python-binance/blob/31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc/binance/client.py#L1652-L1678
[ "def", "get_account_status", "(", "self", ",", "*", "*", "params", ")", ":", "res", "=", "self", ".", "_request_withdraw_api", "(", "'get'", ",", "'accountStatus.html'", ",", "True", ",", "data", "=", "params", ")", "if", "not", "res", "[", "'success'", ...
31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc
train
Client.get_dust_log
Get log of small amounts exchanged for BNB. https://github.com/binance-exchange/binance-official-api-docs/blob/master/wapi-api.md#dustlog-user_data :param recvWindow: the number of milliseconds the request is valid for :type recvWindow: int :returns: API response .. code-bloc...
binance/client.py
def get_dust_log(self, **params): """Get log of small amounts exchanged for BNB. https://github.com/binance-exchange/binance-official-api-docs/blob/master/wapi-api.md#dustlog-user_data :param recvWindow: the number of milliseconds the request is valid for :type recvWindow: int ...
def get_dust_log(self, **params): """Get log of small amounts exchanged for BNB. https://github.com/binance-exchange/binance-official-api-docs/blob/master/wapi-api.md#dustlog-user_data :param recvWindow: the number of milliseconds the request is valid for :type recvWindow: int ...
[ "Get", "log", "of", "small", "amounts", "exchanged", "for", "BNB", "." ]
sammchardy/python-binance
python
https://github.com/sammchardy/python-binance/blob/31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc/binance/client.py#L1680-L1759
[ "def", "get_dust_log", "(", "self", ",", "*", "*", "params", ")", ":", "res", "=", "self", ".", "_request_withdraw_api", "(", "'get'", ",", "'userAssetDribbletLog.html'", ",", "True", ",", "data", "=", "params", ")", "if", "not", "res", "[", "'success'", ...
31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc
train
Client.get_trade_fee
Get trade fee. https://github.com/binance-exchange/binance-official-api-docs/blob/master/wapi-api.md#trade-fee-user_data :param symbol: optional :type symbol: str :param recvWindow: the number of milliseconds the request is valid for :type recvWindow: int :returns: API...
binance/client.py
def get_trade_fee(self, **params): """Get trade fee. https://github.com/binance-exchange/binance-official-api-docs/blob/master/wapi-api.md#trade-fee-user_data :param symbol: optional :type symbol: str :param recvWindow: the number of milliseconds the request is valid for ...
def get_trade_fee(self, **params): """Get trade fee. https://github.com/binance-exchange/binance-official-api-docs/blob/master/wapi-api.md#trade-fee-user_data :param symbol: optional :type symbol: str :param recvWindow: the number of milliseconds the request is valid for ...
[ "Get", "trade", "fee", "." ]
sammchardy/python-binance
python
https://github.com/sammchardy/python-binance/blob/31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc/binance/client.py#L1761-L1796
[ "def", "get_trade_fee", "(", "self", ",", "*", "*", "params", ")", ":", "res", "=", "self", ".", "_request_withdraw_api", "(", "'get'", ",", "'tradeFee.html'", ",", "True", ",", "data", "=", "params", ")", "if", "not", "res", "[", "'success'", "]", ":"...
31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc
train
Client.get_asset_details
Fetch details on assets. https://github.com/binance-exchange/binance-official-api-docs/blob/master/wapi-api.md#asset-detail-user_data :param recvWindow: the number of milliseconds the request is valid for :type recvWindow: int :returns: API response .. code-block:: python ...
binance/client.py
def get_asset_details(self, **params): """Fetch details on assets. https://github.com/binance-exchange/binance-official-api-docs/blob/master/wapi-api.md#asset-detail-user_data :param recvWindow: the number of milliseconds the request is valid for :type recvWindow: int :returns...
def get_asset_details(self, **params): """Fetch details on assets. https://github.com/binance-exchange/binance-official-api-docs/blob/master/wapi-api.md#asset-detail-user_data :param recvWindow: the number of milliseconds the request is valid for :type recvWindow: int :returns...
[ "Fetch", "details", "on", "assets", "." ]
sammchardy/python-binance
python
https://github.com/sammchardy/python-binance/blob/31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc/binance/client.py#L1798-L1835
[ "def", "get_asset_details", "(", "self", ",", "*", "*", "params", ")", ":", "res", "=", "self", ".", "_request_withdraw_api", "(", "'get'", ",", "'assetDetail.html'", ",", "True", ",", "data", "=", "params", ")", "if", "not", "res", "[", "'success'", "]"...
31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc
train
Client.withdraw
Submit a withdraw request. https://www.binance.com/restapipub.html Assumptions: - You must have Withdraw permissions enabled on your API key - You must have withdrawn to the address specified through the website and approved the transaction via email :param asset: required ...
binance/client.py
def withdraw(self, **params): """Submit a withdraw request. https://www.binance.com/restapipub.html Assumptions: - You must have Withdraw permissions enabled on your API key - You must have withdrawn to the address specified through the website and approved the transaction via...
def withdraw(self, **params): """Submit a withdraw request. https://www.binance.com/restapipub.html Assumptions: - You must have Withdraw permissions enabled on your API key - You must have withdrawn to the address specified through the website and approved the transaction via...
[ "Submit", "a", "withdraw", "request", "." ]
sammchardy/python-binance
python
https://github.com/sammchardy/python-binance/blob/31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc/binance/client.py#L1839-L1881
[ "def", "withdraw", "(", "self", ",", "*", "*", "params", ")", ":", "# force a name for the withdrawal if one not set", "if", "'asset'", "in", "params", "and", "'name'", "not", "in", "params", ":", "params", "[", "'name'", "]", "=", "params", "[", "'asset'", ...
31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc
train
Client.stream_keepalive
PING a user data stream to prevent a time out. https://github.com/binance-exchange/binance-official-api-docs/blob/master/rest-api.md#keepalive-user-data-stream-user_stream :param listenKey: required :type listenKey: str :returns: API response .. code-block:: python ...
binance/client.py
def stream_keepalive(self, listenKey): """PING a user data stream to prevent a time out. https://github.com/binance-exchange/binance-official-api-docs/blob/master/rest-api.md#keepalive-user-data-stream-user_stream :param listenKey: required :type listenKey: str :returns: API r...
def stream_keepalive(self, listenKey): """PING a user data stream to prevent a time out. https://github.com/binance-exchange/binance-official-api-docs/blob/master/rest-api.md#keepalive-user-data-stream-user_stream :param listenKey: required :type listenKey: str :returns: API r...
[ "PING", "a", "user", "data", "stream", "to", "prevent", "a", "time", "out", "." ]
sammchardy/python-binance
python
https://github.com/sammchardy/python-binance/blob/31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc/binance/client.py#L2039-L2059
[ "def", "stream_keepalive", "(", "self", ",", "listenKey", ")", ":", "params", "=", "{", "'listenKey'", ":", "listenKey", "}", "return", "self", ".", "_put", "(", "'userDataStream'", ",", "False", ",", "data", "=", "params", ")" ]
31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc
train
Client.stream_close
Close out a user data stream. https://github.com/binance-exchange/binance-official-api-docs/blob/master/rest-api.md#close-user-data-stream-user_stream :param listenKey: required :type listenKey: str :returns: API response .. code-block:: python {} :raise...
binance/client.py
def stream_close(self, listenKey): """Close out a user data stream. https://github.com/binance-exchange/binance-official-api-docs/blob/master/rest-api.md#close-user-data-stream-user_stream :param listenKey: required :type listenKey: str :returns: API response .. code-...
def stream_close(self, listenKey): """Close out a user data stream. https://github.com/binance-exchange/binance-official-api-docs/blob/master/rest-api.md#close-user-data-stream-user_stream :param listenKey: required :type listenKey: str :returns: API response .. code-...
[ "Close", "out", "a", "user", "data", "stream", "." ]
sammchardy/python-binance
python
https://github.com/sammchardy/python-binance/blob/31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc/binance/client.py#L2061-L2081
[ "def", "stream_close", "(", "self", ",", "listenKey", ")", ":", "params", "=", "{", "'listenKey'", ":", "listenKey", "}", "return", "self", ".", "_delete", "(", "'userDataStream'", ",", "False", ",", "data", "=", "params", ")" ]
31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc
train
BinanceSocketManager.start_depth_socket
Start a websocket for symbol market depth returning either a diff or a partial book https://github.com/binance-exchange/binance-official-api-docs/blob/master/web-socket-streams.md#partial-book-depth-streams :param symbol: required :type symbol: str :param callback: callback function to...
binance/websockets.py
def start_depth_socket(self, symbol, callback, depth=None): """Start a websocket for symbol market depth returning either a diff or a partial book https://github.com/binance-exchange/binance-official-api-docs/blob/master/web-socket-streams.md#partial-book-depth-streams :param symbol: required ...
def start_depth_socket(self, symbol, callback, depth=None): """Start a websocket for symbol market depth returning either a diff or a partial book https://github.com/binance-exchange/binance-official-api-docs/blob/master/web-socket-streams.md#partial-book-depth-streams :param symbol: required ...
[ "Start", "a", "websocket", "for", "symbol", "market", "depth", "returning", "either", "a", "diff", "or", "a", "partial", "book" ]
sammchardy/python-binance
python
https://github.com/sammchardy/python-binance/blob/31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc/binance/websockets.py#L105-L172
[ "def", "start_depth_socket", "(", "self", ",", "symbol", ",", "callback", ",", "depth", "=", "None", ")", ":", "socket_name", "=", "symbol", ".", "lower", "(", ")", "+", "'@depth'", "if", "depth", "and", "depth", "!=", "'1'", ":", "socket_name", "=", "...
31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc
train
BinanceSocketManager.start_kline_socket
Start a websocket for symbol kline data https://github.com/binance-exchange/binance-official-api-docs/blob/master/web-socket-streams.md#klinecandlestick-streams :param symbol: required :type symbol: str :param callback: callback function to handle messages :type callback: funct...
binance/websockets.py
def start_kline_socket(self, symbol, callback, interval=Client.KLINE_INTERVAL_1MINUTE): """Start a websocket for symbol kline data https://github.com/binance-exchange/binance-official-api-docs/blob/master/web-socket-streams.md#klinecandlestick-streams :param symbol: required :type symb...
def start_kline_socket(self, symbol, callback, interval=Client.KLINE_INTERVAL_1MINUTE): """Start a websocket for symbol kline data https://github.com/binance-exchange/binance-official-api-docs/blob/master/web-socket-streams.md#klinecandlestick-streams :param symbol: required :type symb...
[ "Start", "a", "websocket", "for", "symbol", "kline", "data" ]
sammchardy/python-binance
python
https://github.com/sammchardy/python-binance/blob/31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc/binance/websockets.py#L174-L218
[ "def", "start_kline_socket", "(", "self", ",", "symbol", ",", "callback", ",", "interval", "=", "Client", ".", "KLINE_INTERVAL_1MINUTE", ")", ":", "socket_name", "=", "'{}@kline_{}'", ".", "format", "(", "symbol", ".", "lower", "(", ")", ",", "interval", ")"...
31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc
train
BinanceSocketManager.start_multiplex_socket
Start a multiplexed socket using a list of socket names. User stream sockets can not be included. Symbols in socket name must be lowercase i.e bnbbtc@aggTrade, neobtc@ticker Combined stream events are wrapped as follows: {"stream":"<streamName>","data":<rawPayload>} https://github.com...
binance/websockets.py
def start_multiplex_socket(self, streams, callback): """Start a multiplexed socket using a list of socket names. User stream sockets can not be included. Symbols in socket name must be lowercase i.e bnbbtc@aggTrade, neobtc@ticker Combined stream events are wrapped as follows: {"stream"...
def start_multiplex_socket(self, streams, callback): """Start a multiplexed socket using a list of socket names. User stream sockets can not be included. Symbols in socket name must be lowercase i.e bnbbtc@aggTrade, neobtc@ticker Combined stream events are wrapped as follows: {"stream"...
[ "Start", "a", "multiplexed", "socket", "using", "a", "list", "of", "socket", "names", ".", "User", "stream", "sockets", "can", "not", "be", "included", "." ]
sammchardy/python-binance
python
https://github.com/sammchardy/python-binance/blob/31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc/binance/websockets.py#L409-L430
[ "def", "start_multiplex_socket", "(", "self", ",", "streams", ",", "callback", ")", ":", "stream_path", "=", "'streams={}'", ".", "format", "(", "'/'", ".", "join", "(", "streams", ")", ")", "return", "self", ".", "_start_socket", "(", "stream_path", ",", ...
31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc
train
BinanceSocketManager.start_user_socket
Start a websocket for user data https://github.com/binance-exchange/binance-official-api-docs/blob/master/user-data-stream.md :param callback: callback function to handle messages :type callback: function :returns: connection key string if successful, False otherwise Message ...
binance/websockets.py
def start_user_socket(self, callback): """Start a websocket for user data https://github.com/binance-exchange/binance-official-api-docs/blob/master/user-data-stream.md :param callback: callback function to handle messages :type callback: function :returns: connection key strin...
def start_user_socket(self, callback): """Start a websocket for user data https://github.com/binance-exchange/binance-official-api-docs/blob/master/user-data-stream.md :param callback: callback function to handle messages :type callback: function :returns: connection key strin...
[ "Start", "a", "websocket", "for", "user", "data" ]
sammchardy/python-binance
python
https://github.com/sammchardy/python-binance/blob/31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc/binance/websockets.py#L432-L448
[ "def", "start_user_socket", "(", "self", ",", "callback", ")", ":", "# Get the user listen key", "user_listen_key", "=", "self", ".", "_client", ".", "stream_get_listen_key", "(", ")", "# and start the socket with this specific key", "conn_key", "=", "self", ".", "_star...
31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc
train
BinanceSocketManager.stop_socket
Stop a websocket given the connection key :param conn_key: Socket connection key :type conn_key: string :returns: connection key string if successful, False otherwise
binance/websockets.py
def stop_socket(self, conn_key): """Stop a websocket given the connection key :param conn_key: Socket connection key :type conn_key: string :returns: connection key string if successful, False otherwise """ if conn_key not in self._conns: return # d...
def stop_socket(self, conn_key): """Stop a websocket given the connection key :param conn_key: Socket connection key :type conn_key: string :returns: connection key string if successful, False otherwise """ if conn_key not in self._conns: return # d...
[ "Stop", "a", "websocket", "given", "the", "connection", "key" ]
sammchardy/python-binance
python
https://github.com/sammchardy/python-binance/blob/31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc/binance/websockets.py#L484-L502
[ "def", "stop_socket", "(", "self", ",", "conn_key", ")", ":", "if", "conn_key", "not", "in", "self", ".", "_conns", ":", "return", "# disable reconnecting if we are closing", "self", ".", "_conns", "[", "conn_key", "]", ".", "factory", "=", "WebSocketClientFacto...
31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc
train
BinanceSocketManager.close
Close all connections
binance/websockets.py
def close(self): """Close all connections """ keys = set(self._conns.keys()) for key in keys: self.stop_socket(key) self._conns = {}
def close(self): """Close all connections """ keys = set(self._conns.keys()) for key in keys: self.stop_socket(key) self._conns = {}
[ "Close", "all", "connections" ]
sammchardy/python-binance
python
https://github.com/sammchardy/python-binance/blob/31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc/binance/websockets.py#L519-L527
[ "def", "close", "(", "self", ")", ":", "keys", "=", "set", "(", "self", ".", "_conns", ".", "keys", "(", ")", ")", "for", "key", "in", "keys", ":", "self", ".", "stop_socket", "(", "key", ")", "self", ".", "_conns", "=", "{", "}" ]
31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc
train
HeatMapWithTime._get_self_bounds
Computes the bounds of the object itself (not including it's children) in the form [[lat_min, lon_min], [lat_max, lon_max]].
folium/plugins/heat_map_withtime.py
def _get_self_bounds(self): """ Computes the bounds of the object itself (not including it's children) in the form [[lat_min, lon_min], [lat_max, lon_max]]. """ bounds = [[None, None], [None, None]] for point in self.data: bounds = [ [ ...
def _get_self_bounds(self): """ Computes the bounds of the object itself (not including it's children) in the form [[lat_min, lon_min], [lat_max, lon_max]]. """ bounds = [[None, None], [None, None]] for point in self.data: bounds = [ [ ...
[ "Computes", "the", "bounds", "of", "the", "object", "itself", "(", "not", "including", "it", "s", "children", ")", "in", "the", "form", "[[", "lat_min", "lon_min", "]", "[", "lat_max", "lon_max", "]]", "." ]
python-visualization/folium
python
https://github.com/python-visualization/folium/blob/8595240517135d1637ca4cf7cc624045f1d911b3/folium/plugins/heat_map_withtime.py#L267-L285
[ "def", "_get_self_bounds", "(", "self", ")", ":", "bounds", "=", "[", "[", "None", ",", "None", "]", ",", "[", "None", ",", "None", "]", "]", "for", "point", "in", "self", ".", "data", ":", "bounds", "=", "[", "[", "none_min", "(", "bounds", "[",...
8595240517135d1637ca4cf7cc624045f1d911b3
train
path_options
Contains options and constants shared between vector overlays (Polygon, Polyline, Circle, CircleMarker, and Rectangle). Parameters ---------- stroke: Bool, True Whether to draw stroke along the path. Set it to false to disable borders on polygons or circles. color: str, '#3388ff' ...
folium/vector_layers.py
def path_options(line=False, radius=False, **kwargs): """ Contains options and constants shared between vector overlays (Polygon, Polyline, Circle, CircleMarker, and Rectangle). Parameters ---------- stroke: Bool, True Whether to draw stroke along the path. Set it to false to di...
def path_options(line=False, radius=False, **kwargs): """ Contains options and constants shared between vector overlays (Polygon, Polyline, Circle, CircleMarker, and Rectangle). Parameters ---------- stroke: Bool, True Whether to draw stroke along the path. Set it to false to di...
[ "Contains", "options", "and", "constants", "shared", "between", "vector", "overlays", "(", "Polygon", "Polyline", "Circle", "CircleMarker", "and", "Rectangle", ")", "." ]
python-visualization/folium
python
https://github.com/python-visualization/folium/blob/8595240517135d1637ca4cf7cc624045f1d911b3/folium/vector_layers.py#L16-L99
[ "def", "path_options", "(", "line", "=", "False", ",", "radius", "=", "False", ",", "*", "*", "kwargs", ")", ":", "extra_options", "=", "{", "}", "if", "line", ":", "extra_options", "=", "{", "'smoothFactor'", ":", "kwargs", ".", "pop", "(", "'smooth_f...
8595240517135d1637ca4cf7cc624045f1d911b3
train
Vega.render
Renders the HTML representation of the element.
folium/features.py
def render(self, **kwargs): """Renders the HTML representation of the element.""" self.json = json.dumps(self.data) self._parent.html.add_child(Element(Template(""" <div id="{{this.get_name()}}"></div> """).render(this=self, kwargs=kwargs)), name=self.get_name()) ...
def render(self, **kwargs): """Renders the HTML representation of the element.""" self.json = json.dumps(self.data) self._parent.html.add_child(Element(Template(""" <div id="{{this.get_name()}}"></div> """).render(this=self, kwargs=kwargs)), name=self.get_name()) ...
[ "Renders", "the", "HTML", "representation", "of", "the", "element", "." ]
python-visualization/folium
python
https://github.com/python-visualization/folium/blob/8595240517135d1637ca4cf7cc624045f1d911b3/folium/features.py#L147-L188
[ "def", "render", "(", "self", ",", "*", "*", "kwargs", ")", ":", "self", ".", "json", "=", "json", ".", "dumps", "(", "self", ".", "data", ")", "self", ".", "_parent", ".", "html", ".", "add_child", "(", "Element", "(", "Template", "(", "\"\"\"\n ...
8595240517135d1637ca4cf7cc624045f1d911b3
train
VegaLite.render
Renders the HTML representation of the element.
folium/features.py
def render(self, **kwargs): """Renders the HTML representation of the element.""" vegalite_major_version = self._get_vegalite_major_versions(self.data) self._parent.html.add_child(Element(Template(""" <div id="{{this.get_name()}}"></div> """).render(this=self, kwargs=kwa...
def render(self, **kwargs): """Renders the HTML representation of the element.""" vegalite_major_version = self._get_vegalite_major_versions(self.data) self._parent.html.add_child(Element(Template(""" <div id="{{this.get_name()}}"></div> """).render(this=self, kwargs=kwa...
[ "Renders", "the", "HTML", "representation", "of", "the", "element", "." ]
python-visualization/folium
python
https://github.com/python-visualization/folium/blob/8595240517135d1637ca4cf7cc624045f1d911b3/folium/features.py#L241-L271
[ "def", "render", "(", "self", ",", "*", "*", "kwargs", ")", ":", "vegalite_major_version", "=", "self", ".", "_get_vegalite_major_versions", "(", "self", ".", "data", ")", "self", ".", "_parent", ".", "html", ".", "add_child", "(", "Element", "(", "Templat...
8595240517135d1637ca4cf7cc624045f1d911b3
train
GeoJson.process_data
Convert an unknown data input into a geojson dictionary.
folium/features.py
def process_data(self, data): """Convert an unknown data input into a geojson dictionary.""" if isinstance(data, dict): self.embed = True return data elif isinstance(data, str): if data.lower().startswith(('http:', 'ftp:', 'https:')): if not se...
def process_data(self, data): """Convert an unknown data input into a geojson dictionary.""" if isinstance(data, dict): self.embed = True return data elif isinstance(data, str): if data.lower().startswith(('http:', 'ftp:', 'https:')): if not se...
[ "Convert", "an", "unknown", "data", "input", "into", "a", "geojson", "dictionary", "." ]
python-visualization/folium
python
https://github.com/python-visualization/folium/blob/8595240517135d1637ca4cf7cc624045f1d911b3/folium/features.py#L469-L494
[ "def", "process_data", "(", "self", ",", "data", ")", ":", "if", "isinstance", "(", "data", ",", "dict", ")", ":", "self", ".", "embed", "=", "True", "return", "data", "elif", "isinstance", "(", "data", ",", "str", ")", ":", "if", "data", ".", "low...
8595240517135d1637ca4cf7cc624045f1d911b3
train
GeoJson.convert_to_feature_collection
Convert data into a FeatureCollection if it is not already.
folium/features.py
def convert_to_feature_collection(self): """Convert data into a FeatureCollection if it is not already.""" if self.data['type'] == 'FeatureCollection': return if not self.embed: raise ValueError( 'Data is not a FeatureCollection, but it should be to apply ...
def convert_to_feature_collection(self): """Convert data into a FeatureCollection if it is not already.""" if self.data['type'] == 'FeatureCollection': return if not self.embed: raise ValueError( 'Data is not a FeatureCollection, but it should be to apply ...
[ "Convert", "data", "into", "a", "FeatureCollection", "if", "it", "is", "not", "already", "." ]
python-visualization/folium
python
https://github.com/python-visualization/folium/blob/8595240517135d1637ca4cf7cc624045f1d911b3/folium/features.py#L496-L510
[ "def", "convert_to_feature_collection", "(", "self", ")", ":", "if", "self", ".", "data", "[", "'type'", "]", "==", "'FeatureCollection'", ":", "return", "if", "not", "self", ".", "embed", ":", "raise", "ValueError", "(", "'Data is not a FeatureCollection, but it ...
8595240517135d1637ca4cf7cc624045f1d911b3
train
GeoJson._validate_function
Tests `self.style_function` and `self.highlight_function` to ensure they are functions returning dictionaries.
folium/features.py
def _validate_function(self, func, name): """ Tests `self.style_function` and `self.highlight_function` to ensure they are functions returning dictionaries. """ test_feature = self.data['features'][0] if not callable(func) or not isinstance(func(test_feature), dict): ...
def _validate_function(self, func, name): """ Tests `self.style_function` and `self.highlight_function` to ensure they are functions returning dictionaries. """ test_feature = self.data['features'][0] if not callable(func) or not isinstance(func(test_feature), dict): ...
[ "Tests", "self", ".", "style_function", "and", "self", ".", "highlight_function", "to", "ensure", "they", "are", "functions", "returning", "dictionaries", "." ]
python-visualization/folium
python
https://github.com/python-visualization/folium/blob/8595240517135d1637ca4cf7cc624045f1d911b3/folium/features.py#L512-L521
[ "def", "_validate_function", "(", "self", ",", "func", ",", "name", ")", ":", "test_feature", "=", "self", ".", "data", "[", "'features'", "]", "[", "0", "]", "if", "not", "callable", "(", "func", ")", "or", "not", "isinstance", "(", "func", "(", "te...
8595240517135d1637ca4cf7cc624045f1d911b3
train
GeoJson.find_identifier
Find a unique identifier for each feature, create it if needed.
folium/features.py
def find_identifier(self): """Find a unique identifier for each feature, create it if needed.""" features = self.data['features'] n = len(features) feature = features[0] if 'id' in feature and len(set(feat['id'] for feat in features)) == n: return 'feature.id' ...
def find_identifier(self): """Find a unique identifier for each feature, create it if needed.""" features = self.data['features'] n = len(features) feature = features[0] if 'id' in feature and len(set(feat['id'] for feat in features)) == n: return 'feature.id' ...
[ "Find", "a", "unique", "identifier", "for", "each", "feature", "create", "it", "if", "needed", "." ]
python-visualization/folium
python
https://github.com/python-visualization/folium/blob/8595240517135d1637ca4cf7cc624045f1d911b3/folium/features.py#L523-L541
[ "def", "find_identifier", "(", "self", ")", ":", "features", "=", "self", ".", "data", "[", "'features'", "]", "n", "=", "len", "(", "features", ")", "feature", "=", "features", "[", "0", "]", "if", "'id'", "in", "feature", "and", "len", "(", "set", ...
8595240517135d1637ca4cf7cc624045f1d911b3
train
GeoJsonStyleMapper._create_mapping
Internal function to create the mapping.
folium/features.py
def _create_mapping(self, func, switch): """Internal function to create the mapping.""" mapping = {} for feature in self.data['features']: content = func(feature) if switch == 'style': for key, value in content.items(): if isinstance(va...
def _create_mapping(self, func, switch): """Internal function to create the mapping.""" mapping = {} for feature in self.data['features']: content = func(feature) if switch == 'style': for key, value in content.items(): if isinstance(va...
[ "Internal", "function", "to", "create", "the", "mapping", "." ]
python-visualization/folium
python
https://github.com/python-visualization/folium/blob/8595240517135d1637ca4cf7cc624045f1d911b3/folium/features.py#L583-L600
[ "def", "_create_mapping", "(", "self", ",", "func", ",", "switch", ")", ":", "mapping", "=", "{", "}", "for", "feature", "in", "self", ".", "data", "[", "'features'", "]", ":", "content", "=", "func", "(", "feature", ")", "if", "switch", "==", "'styl...
8595240517135d1637ca4cf7cc624045f1d911b3
train
GeoJsonStyleMapper.get_feature_id
Return a value identifying the feature.
folium/features.py
def get_feature_id(self, feature): """Return a value identifying the feature.""" fields = self.feature_identifier.split('.')[1:] return functools.reduce(operator.getitem, fields, feature)
def get_feature_id(self, feature): """Return a value identifying the feature.""" fields = self.feature_identifier.split('.')[1:] return functools.reduce(operator.getitem, fields, feature)
[ "Return", "a", "value", "identifying", "the", "feature", "." ]
python-visualization/folium
python
https://github.com/python-visualization/folium/blob/8595240517135d1637ca4cf7cc624045f1d911b3/folium/features.py#L602-L605
[ "def", "get_feature_id", "(", "self", ",", "feature", ")", ":", "fields", "=", "self", ".", "feature_identifier", ".", "split", "(", "'.'", ")", "[", "1", ":", "]", "return", "functools", ".", "reduce", "(", "operator", ".", "getitem", ",", "fields", "...
8595240517135d1637ca4cf7cc624045f1d911b3
train
GeoJsonStyleMapper._to_key
Convert dict to str and enable Jinja2 template syntax.
folium/features.py
def _to_key(d): """Convert dict to str and enable Jinja2 template syntax.""" as_str = json.dumps(d, sort_keys=True) return as_str.replace('"{{', '{{').replace('}}"', '}}')
def _to_key(d): """Convert dict to str and enable Jinja2 template syntax.""" as_str = json.dumps(d, sort_keys=True) return as_str.replace('"{{', '{{').replace('}}"', '}}')
[ "Convert", "dict", "to", "str", "and", "enable", "Jinja2", "template", "syntax", "." ]
python-visualization/folium
python
https://github.com/python-visualization/folium/blob/8595240517135d1637ca4cf7cc624045f1d911b3/folium/features.py#L608-L611
[ "def", "_to_key", "(", "d", ")", ":", "as_str", "=", "json", ".", "dumps", "(", "d", ",", "sort_keys", "=", "True", ")", "return", "as_str", ".", "replace", "(", "'\"{{'", ",", "'{{'", ")", ".", "replace", "(", "'}}\"'", ",", "'}}'", ")" ]
8595240517135d1637ca4cf7cc624045f1d911b3
train
GeoJsonStyleMapper._set_default_key
Replace the field with the most features with a 'default' field.
folium/features.py
def _set_default_key(mapping): """Replace the field with the most features with a 'default' field.""" key_longest = sorted([(len(v), k) for k, v in mapping.items()], reverse=True)[0][1] mapping['default'] = key_longest del (mapping[key_longest])
def _set_default_key(mapping): """Replace the field with the most features with a 'default' field.""" key_longest = sorted([(len(v), k) for k, v in mapping.items()], reverse=True)[0][1] mapping['default'] = key_longest del (mapping[key_longest])
[ "Replace", "the", "field", "with", "the", "most", "features", "with", "a", "default", "field", "." ]
python-visualization/folium
python
https://github.com/python-visualization/folium/blob/8595240517135d1637ca4cf7cc624045f1d911b3/folium/features.py#L614-L619
[ "def", "_set_default_key", "(", "mapping", ")", ":", "key_longest", "=", "sorted", "(", "[", "(", "len", "(", "v", ")", ",", "k", ")", "for", "k", ",", "v", "in", "mapping", ".", "items", "(", ")", "]", ",", "reverse", "=", "True", ")", "[", "0...
8595240517135d1637ca4cf7cc624045f1d911b3
train
TopoJson.style_data
Applies self.style_function to each feature of self.data.
folium/features.py
def style_data(self): """Applies self.style_function to each feature of self.data.""" def recursive_get(data, keys): if len(keys): return recursive_get(data.get(keys[0]), keys[1:]) else: return data geometries = recursive_get(self.data, s...
def style_data(self): """Applies self.style_function to each feature of self.data.""" def recursive_get(data, keys): if len(keys): return recursive_get(data.get(keys[0]), keys[1:]) else: return data geometries = recursive_get(self.data, s...
[ "Applies", "self", ".", "style_function", "to", "each", "feature", "of", "self", ".", "data", "." ]
python-visualization/folium
python
https://github.com/python-visualization/folium/blob/8595240517135d1637ca4cf7cc624045f1d911b3/folium/features.py#L725-L736
[ "def", "style_data", "(", "self", ")", ":", "def", "recursive_get", "(", "data", ",", "keys", ")", ":", "if", "len", "(", "keys", ")", ":", "return", "recursive_get", "(", "data", ".", "get", "(", "keys", "[", "0", "]", ")", ",", "keys", "[", "1"...
8595240517135d1637ca4cf7cc624045f1d911b3
train
TopoJson.get_bounds
Computes the bounds of the object itself (not including it's children) in the form [[lat_min, lon_min], [lat_max, lon_max]]
folium/features.py
def get_bounds(self): """ Computes the bounds of the object itself (not including it's children) in the form [[lat_min, lon_min], [lat_max, lon_max]] """ if not self.embed: raise ValueError('Cannot compute bounds of non-embedded TopoJSON.') xmin, xmax, ymin,...
def get_bounds(self): """ Computes the bounds of the object itself (not including it's children) in the form [[lat_min, lon_min], [lat_max, lon_max]] """ if not self.embed: raise ValueError('Cannot compute bounds of non-embedded TopoJSON.') xmin, xmax, ymin,...
[ "Computes", "the", "bounds", "of", "the", "object", "itself", "(", "not", "including", "it", "s", "children", ")", "in", "the", "form", "[[", "lat_min", "lon_min", "]", "[", "lat_max", "lon_max", "]]" ]
python-visualization/folium
python
https://github.com/python-visualization/folium/blob/8595240517135d1637ca4cf7cc624045f1d911b3/folium/features.py#L751-L780
[ "def", "get_bounds", "(", "self", ")", ":", "if", "not", "self", ".", "embed", ":", "raise", "ValueError", "(", "'Cannot compute bounds of non-embedded TopoJSON.'", ")", "xmin", ",", "xmax", ",", "ymin", ",", "ymax", "=", "None", ",", "None", ",", "None", ...
8595240517135d1637ca4cf7cc624045f1d911b3
train
GeoJsonTooltip.warn_for_geometry_collections
Checks for GeoJson GeometryCollection features to warn user about incompatibility.
folium/features.py
def warn_for_geometry_collections(self): """Checks for GeoJson GeometryCollection features to warn user about incompatibility.""" geom_collections = [ feature.get('properties') if feature.get('properties') is not None else key for key, feature in enumerate(self._parent.data['feat...
def warn_for_geometry_collections(self): """Checks for GeoJson GeometryCollection features to warn user about incompatibility.""" geom_collections = [ feature.get('properties') if feature.get('properties') is not None else key for key, feature in enumerate(self._parent.data['feat...
[ "Checks", "for", "GeoJson", "GeometryCollection", "features", "to", "warn", "user", "about", "incompatibility", "." ]
python-visualization/folium
python
https://github.com/python-visualization/folium/blob/8595240517135d1637ca4cf7cc624045f1d911b3/folium/features.py#L883-L894
[ "def", "warn_for_geometry_collections", "(", "self", ")", ":", "geom_collections", "=", "[", "feature", ".", "get", "(", "'properties'", ")", "if", "feature", ".", "get", "(", "'properties'", ")", "is", "not", "None", "else", "key", "for", "key", ",", "fea...
8595240517135d1637ca4cf7cc624045f1d911b3
train
GeoJsonTooltip.render
Renders the HTML representation of the element.
folium/features.py
def render(self, **kwargs): """Renders the HTML representation of the element.""" if isinstance(self._parent, GeoJson): keys = tuple(self._parent.data['features'][0]['properties'].keys()) self.warn_for_geometry_collections() elif isinstance(self._parent, TopoJson): ...
def render(self, **kwargs): """Renders the HTML representation of the element.""" if isinstance(self._parent, GeoJson): keys = tuple(self._parent.data['features'][0]['properties'].keys()) self.warn_for_geometry_collections() elif isinstance(self._parent, TopoJson): ...
[ "Renders", "the", "HTML", "representation", "of", "the", "element", "." ]
python-visualization/folium
python
https://github.com/python-visualization/folium/blob/8595240517135d1637ca4cf7cc624045f1d911b3/folium/features.py#L896-L912
[ "def", "render", "(", "self", ",", "*", "*", "kwargs", ")", ":", "if", "isinstance", "(", "self", ".", "_parent", ",", "GeoJson", ")", ":", "keys", "=", "tuple", "(", "self", ".", "_parent", ".", "data", "[", "'features'", "]", "[", "0", "]", "["...
8595240517135d1637ca4cf7cc624045f1d911b3
train
Choropleth.render
Render the GeoJson/TopoJson and color scale objects.
folium/features.py
def render(self, **kwargs): """Render the GeoJson/TopoJson and color scale objects.""" if self.color_scale: # ColorMap needs Map as its parent assert isinstance(self._parent, Map), ('Choropleth must be added' ' to a Map object.')...
def render(self, **kwargs): """Render the GeoJson/TopoJson and color scale objects.""" if self.color_scale: # ColorMap needs Map as its parent assert isinstance(self._parent, Map), ('Choropleth must be added' ' to a Map object.')...
[ "Render", "the", "GeoJson", "/", "TopoJson", "and", "color", "scale", "objects", "." ]
python-visualization/folium
python
https://github.com/python-visualization/folium/blob/8595240517135d1637ca4cf7cc624045f1d911b3/folium/features.py#L1146-L1154
[ "def", "render", "(", "self", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "color_scale", ":", "# ColorMap needs Map as its parent", "assert", "isinstance", "(", "self", ".", "_parent", ",", "Map", ")", ",", "(", "'Choropleth must be added'", "' to a ...
8595240517135d1637ca4cf7cc624045f1d911b3
train
validate_location
Validate a single lat/lon coordinate pair and convert to a list Validate that location: * is a sized variable * with size 2 * allows indexing (i.e. has an ordering) * where both values are floats (or convertible to float) * and both values are not NaN Returns ------- list[float, fl...
folium/utilities.py
def validate_location(location): # noqa: C901 """Validate a single lat/lon coordinate pair and convert to a list Validate that location: * is a sized variable * with size 2 * allows indexing (i.e. has an ordering) * where both values are floats (or convertible to float) * and both values a...
def validate_location(location): # noqa: C901 """Validate a single lat/lon coordinate pair and convert to a list Validate that location: * is a sized variable * with size 2 * allows indexing (i.e. has an ordering) * where both values are floats (or convertible to float) * and both values a...
[ "Validate", "a", "single", "lat", "/", "lon", "coordinate", "pair", "and", "convert", "to", "a", "list" ]
python-visualization/folium
python
https://github.com/python-visualization/folium/blob/8595240517135d1637ca4cf7cc624045f1d911b3/folium/utilities.py#L26-L66
[ "def", "validate_location", "(", "location", ")", ":", "# noqa: C901", "if", "isinstance", "(", "location", ",", "np", ".", "ndarray", ")", "or", "(", "pd", "is", "not", "None", "and", "isinstance", "(", "location", ",", "pd", ".", "DataFrame", ")", ")",...
8595240517135d1637ca4cf7cc624045f1d911b3
train
validate_locations
Validate an iterable with multiple lat/lon coordinate pairs. Returns ------- list[list[float, float]] or list[list[list[float, float]]]
folium/utilities.py
def validate_locations(locations): """Validate an iterable with multiple lat/lon coordinate pairs. Returns ------- list[list[float, float]] or list[list[list[float, float]]] """ locations = if_pandas_df_convert_to_numpy(locations) try: iter(locations) except TypeError: ...
def validate_locations(locations): """Validate an iterable with multiple lat/lon coordinate pairs. Returns ------- list[list[float, float]] or list[list[list[float, float]]] """ locations = if_pandas_df_convert_to_numpy(locations) try: iter(locations) except TypeError: ...
[ "Validate", "an", "iterable", "with", "multiple", "lat", "/", "lon", "coordinate", "pairs", "." ]
python-visualization/folium
python
https://github.com/python-visualization/folium/blob/8595240517135d1637ca4cf7cc624045f1d911b3/folium/utilities.py#L69-L94
[ "def", "validate_locations", "(", "locations", ")", ":", "locations", "=", "if_pandas_df_convert_to_numpy", "(", "locations", ")", "try", ":", "iter", "(", "locations", ")", "except", "TypeError", ":", "raise", "TypeError", "(", "'Locations should be an iterable with ...
8595240517135d1637ca4cf7cc624045f1d911b3
train
if_pandas_df_convert_to_numpy
Return a Numpy array from a Pandas dataframe. Iterating over a DataFrame has weird side effects, such as the first row being the column names. Converting to Numpy is more safe.
folium/utilities.py
def if_pandas_df_convert_to_numpy(obj): """Return a Numpy array from a Pandas dataframe. Iterating over a DataFrame has weird side effects, such as the first row being the column names. Converting to Numpy is more safe. """ if pd is not None and isinstance(obj, pd.DataFrame): return obj.val...
def if_pandas_df_convert_to_numpy(obj): """Return a Numpy array from a Pandas dataframe. Iterating over a DataFrame has weird side effects, such as the first row being the column names. Converting to Numpy is more safe. """ if pd is not None and isinstance(obj, pd.DataFrame): return obj.val...
[ "Return", "a", "Numpy", "array", "from", "a", "Pandas", "dataframe", "." ]
python-visualization/folium
python
https://github.com/python-visualization/folium/blob/8595240517135d1637ca4cf7cc624045f1d911b3/folium/utilities.py#L97-L106
[ "def", "if_pandas_df_convert_to_numpy", "(", "obj", ")", ":", "if", "pd", "is", "not", "None", "and", "isinstance", "(", "obj", ",", "pd", ".", "DataFrame", ")", ":", "return", "obj", ".", "values", "else", ":", "return", "obj" ]
8595240517135d1637ca4cf7cc624045f1d911b3
train
image_to_url
Infers the type of an image argument and transforms it into a URL. Parameters ---------- image: string, file or array-like object * If string, it will be written directly in the output file. * If file, it's content will be converted as embedded in the output file. * If arr...
folium/utilities.py
def image_to_url(image, colormap=None, origin='upper'): """ Infers the type of an image argument and transforms it into a URL. Parameters ---------- image: string, file or array-like object * If string, it will be written directly in the output file. * If file, it's content will be ...
def image_to_url(image, colormap=None, origin='upper'): """ Infers the type of an image argument and transforms it into a URL. Parameters ---------- image: string, file or array-like object * If string, it will be written directly in the output file. * If file, it's content will be ...
[ "Infers", "the", "type", "of", "an", "image", "argument", "and", "transforms", "it", "into", "a", "URL", "." ]
python-visualization/folium
python
https://github.com/python-visualization/folium/blob/8595240517135d1637ca4cf7cc624045f1d911b3/folium/utilities.py#L109-L144
[ "def", "image_to_url", "(", "image", ",", "colormap", "=", "None", ",", "origin", "=", "'upper'", ")", ":", "if", "isinstance", "(", "image", ",", "str", ")", "and", "not", "_is_url", "(", "image", ")", ":", "fileformat", "=", "os", ".", "path", ".",...
8595240517135d1637ca4cf7cc624045f1d911b3
train
write_png
Transform an array of data into a PNG string. This can be written to disk using binary I/O, or encoded using base64 for an inline PNG like this: >>> png_str = write_png(array) >>> "data:image/png;base64,"+png_str.encode('base64') Inspired from https://stackoverflow.com/questions/902761/saving-...
folium/utilities.py
def write_png(data, origin='upper', colormap=None): """ Transform an array of data into a PNG string. This can be written to disk using binary I/O, or encoded using base64 for an inline PNG like this: >>> png_str = write_png(array) >>> "data:image/png;base64,"+png_str.encode('base64') Insp...
def write_png(data, origin='upper', colormap=None): """ Transform an array of data into a PNG string. This can be written to disk using binary I/O, or encoded using base64 for an inline PNG like this: >>> png_str = write_png(array) >>> "data:image/png;base64,"+png_str.encode('base64') Insp...
[ "Transform", "an", "array", "of", "data", "into", "a", "PNG", "string", ".", "This", "can", "be", "written", "to", "disk", "using", "binary", "I", "/", "O", "or", "encoded", "using", "base64", "for", "an", "inline", "PNG", "like", "this", ":" ]
python-visualization/folium
python
https://github.com/python-visualization/folium/blob/8595240517135d1637ca4cf7cc624045f1d911b3/folium/utilities.py#L155-L239
[ "def", "write_png", "(", "data", ",", "origin", "=", "'upper'", ",", "colormap", "=", "None", ")", ":", "if", "colormap", "is", "None", ":", "def", "colormap", "(", "x", ")", ":", "return", "(", "x", ",", "x", ",", "x", ",", "1", ")", "arr", "=...
8595240517135d1637ca4cf7cc624045f1d911b3
train
mercator_transform
Transforms an image computed in (longitude,latitude) coordinates into the a Mercator projection image. Parameters ---------- data: numpy array or equivalent list-like object. Must be NxM (mono), NxMx3 (RGB) or NxMx4 (RGBA) lat_bounds : length 2 tuple Minimal and maximal value of t...
folium/utilities.py
def mercator_transform(data, lat_bounds, origin='upper', height_out=None): """ Transforms an image computed in (longitude,latitude) coordinates into the a Mercator projection image. Parameters ---------- data: numpy array or equivalent list-like object. Must be NxM (mono), NxMx3 (RGB) ...
def mercator_transform(data, lat_bounds, origin='upper', height_out=None): """ Transforms an image computed in (longitude,latitude) coordinates into the a Mercator projection image. Parameters ---------- data: numpy array or equivalent list-like object. Must be NxM (mono), NxMx3 (RGB) ...
[ "Transforms", "an", "image", "computed", "in", "(", "longitude", "latitude", ")", "coordinates", "into", "the", "a", "Mercator", "projection", "image", "." ]
python-visualization/folium
python
https://github.com/python-visualization/folium/blob/8595240517135d1637ca4cf7cc624045f1d911b3/folium/utilities.py#L242-L300
[ "def", "mercator_transform", "(", "data", ",", "lat_bounds", ",", "origin", "=", "'upper'", ",", "height_out", "=", "None", ")", ":", "import", "numpy", "as", "np", "def", "mercator", "(", "x", ")", ":", "return", "np", ".", "arcsinh", "(", "np", ".", ...
8595240517135d1637ca4cf7cc624045f1d911b3