repo
stringclasses
85 values
path
stringlengths
8
121
func_name
stringlengths
1
82
original_string
stringlengths
112
65.5k
language
stringclasses
1 value
code
stringlengths
112
65.5k
code_tokens
listlengths
20
4.09k
docstring
stringlengths
3
46.3k
docstring_tokens
listlengths
1
564
sha
stringclasses
85 values
url
stringlengths
93
218
partition
stringclasses
1 value
bokeh/bokeh
scripts/issues.py
closed_issues
def closed_issues(issues, after): """Yields closed issues (closed after a given datetime) given a list of issues.""" logging.info('finding closed issues after {}...'.format(after)) seen = set() for issue in issues: if closed_issue(issue, after) and issue['title'] not in seen: seen.ad...
python
def closed_issues(issues, after): """Yields closed issues (closed after a given datetime) given a list of issues.""" logging.info('finding closed issues after {}...'.format(after)) seen = set() for issue in issues: if closed_issue(issue, after) and issue['title'] not in seen: seen.ad...
[ "def", "closed_issues", "(", "issues", ",", "after", ")", ":", "logging", ".", "info", "(", "'finding closed issues after {}...'", ".", "format", "(", "after", ")", ")", "seen", "=", "set", "(", ")", "for", "issue", "in", "issues", ":", "if", "closed_issue...
Yields closed issues (closed after a given datetime) given a list of issues.
[ "Yields", "closed", "issues", "(", "closed", "after", "a", "given", "datetime", ")", "given", "a", "list", "of", "issues", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/scripts/issues.py#L140-L147
train
bokeh/bokeh
scripts/issues.py
all_issues
def all_issues(issues): """Yields unique set of issues given a list of issues.""" logging.info('finding issues...') seen = set() for issue in issues: if issue['title'] not in seen: seen.add(issue['title']) yield issue
python
def all_issues(issues): """Yields unique set of issues given a list of issues.""" logging.info('finding issues...') seen = set() for issue in issues: if issue['title'] not in seen: seen.add(issue['title']) yield issue
[ "def", "all_issues", "(", "issues", ")", ":", "logging", ".", "info", "(", "'finding issues...'", ")", "seen", "=", "set", "(", ")", "for", "issue", "in", "issues", ":", "if", "issue", "[", "'title'", "]", "not", "in", "seen", ":", "seen", ".", "add"...
Yields unique set of issues given a list of issues.
[ "Yields", "unique", "set", "of", "issues", "given", "a", "list", "of", "issues", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/scripts/issues.py#L150-L157
train
bokeh/bokeh
scripts/issues.py
get_issues_url
def get_issues_url(page, after): """Returns github API URL for querying tags.""" template = '{base_url}/{owner}/{repo}/issues?state=closed&per_page=100&page={page}&since={after}' return template.format(page=page, after=after.isoformat(), **API_PARAMS)
python
def get_issues_url(page, after): """Returns github API URL for querying tags.""" template = '{base_url}/{owner}/{repo}/issues?state=closed&per_page=100&page={page}&since={after}' return template.format(page=page, after=after.isoformat(), **API_PARAMS)
[ "def", "get_issues_url", "(", "page", ",", "after", ")", ":", "template", "=", "'{base_url}/{owner}/{repo}/issues?state=closed&per_page=100&page={page}&since={after}'", "return", "template", ".", "format", "(", "page", "=", "page", ",", "after", "=", "after", ".", "is...
Returns github API URL for querying tags.
[ "Returns", "github", "API", "URL", "for", "querying", "tags", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/scripts/issues.py#L168-L171
train
bokeh/bokeh
scripts/issues.py
parse_timestamp
def parse_timestamp(timestamp): """Parse ISO8601 timestamps given by github API.""" dt = dateutil.parser.parse(timestamp) return dt.astimezone(dateutil.tz.tzutc())
python
def parse_timestamp(timestamp): """Parse ISO8601 timestamps given by github API.""" dt = dateutil.parser.parse(timestamp) return dt.astimezone(dateutil.tz.tzutc())
[ "def", "parse_timestamp", "(", "timestamp", ")", ":", "dt", "=", "dateutil", ".", "parser", ".", "parse", "(", "timestamp", ")", "return", "dt", ".", "astimezone", "(", "dateutil", ".", "tz", ".", "tzutc", "(", ")", ")" ]
Parse ISO8601 timestamps given by github API.
[ "Parse", "ISO8601", "timestamps", "given", "by", "github", "API", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/scripts/issues.py#L179-L182
train
bokeh/bokeh
scripts/issues.py
read_url
def read_url(url): """Reads given URL as JSON and returns data as loaded python object.""" logging.debug('reading {url} ...'.format(url=url)) token = os.environ.get("BOKEH_GITHUB_API_TOKEN") headers = {} if token: headers['Authorization'] = 'token %s' % token request = Request(url, heade...
python
def read_url(url): """Reads given URL as JSON and returns data as loaded python object.""" logging.debug('reading {url} ...'.format(url=url)) token = os.environ.get("BOKEH_GITHUB_API_TOKEN") headers = {} if token: headers['Authorization'] = 'token %s' % token request = Request(url, heade...
[ "def", "read_url", "(", "url", ")", ":", "logging", ".", "debug", "(", "'reading {url} ...'", ".", "format", "(", "url", "=", "url", ")", ")", "token", "=", "os", ".", "environ", ".", "get", "(", "\"BOKEH_GITHUB_API_TOKEN\"", ")", "headers", "=", "{", ...
Reads given URL as JSON and returns data as loaded python object.
[ "Reads", "given", "URL", "as", "JSON", "and", "returns", "data", "as", "loaded", "python", "object", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/scripts/issues.py#L185-L194
train
bokeh/bokeh
scripts/issues.py
query_all_issues
def query_all_issues(after): """Hits the github API for all closed issues after the given date, returns the data.""" page = count(1) data = [] while True: page_data = query_issues(next(page), after) if not page_data: break data.extend(page_data) return data
python
def query_all_issues(after): """Hits the github API for all closed issues after the given date, returns the data.""" page = count(1) data = [] while True: page_data = query_issues(next(page), after) if not page_data: break data.extend(page_data) return data
[ "def", "query_all_issues", "(", "after", ")", ":", "page", "=", "count", "(", "1", ")", "data", "=", "[", "]", "while", "True", ":", "page_data", "=", "query_issues", "(", "next", "(", "page", ")", ",", "after", ")", "if", "not", "page_data", ":", ...
Hits the github API for all closed issues after the given date, returns the data.
[ "Hits", "the", "github", "API", "for", "all", "closed", "issues", "after", "the", "given", "date", "returns", "the", "data", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/scripts/issues.py#L207-L216
train
bokeh/bokeh
scripts/issues.py
dateof
def dateof(tag_name, tags): """Given a list of tags, returns the datetime of the tag with the given name; Otherwise None.""" for tag in tags: if tag['name'] == tag_name: commit = read_url(tag['commit']['url']) return parse_timestamp(commit['commit']['committer']['date']) retu...
python
def dateof(tag_name, tags): """Given a list of tags, returns the datetime of the tag with the given name; Otherwise None.""" for tag in tags: if tag['name'] == tag_name: commit = read_url(tag['commit']['url']) return parse_timestamp(commit['commit']['committer']['date']) retu...
[ "def", "dateof", "(", "tag_name", ",", "tags", ")", ":", "for", "tag", "in", "tags", ":", "if", "tag", "[", "'name'", "]", "==", "tag_name", ":", "commit", "=", "read_url", "(", "tag", "[", "'commit'", "]", "[", "'url'", "]", ")", "return", "parse_...
Given a list of tags, returns the datetime of the tag with the given name; Otherwise None.
[ "Given", "a", "list", "of", "tags", "returns", "the", "datetime", "of", "the", "tag", "with", "the", "given", "name", ";", "Otherwise", "None", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/scripts/issues.py#L219-L225
train
bokeh/bokeh
scripts/issues.py
get_data
def get_data(query_func, load_data=False, save_data=False): """Gets data from query_func, optionally saving that data to a file; or loads data from a file.""" if hasattr(query_func, '__name__'): func_name = query_func.__name__ elif hasattr(query_func, 'func'): func_name = query_func.func.__n...
python
def get_data(query_func, load_data=False, save_data=False): """Gets data from query_func, optionally saving that data to a file; or loads data from a file.""" if hasattr(query_func, '__name__'): func_name = query_func.__name__ elif hasattr(query_func, 'func'): func_name = query_func.func.__n...
[ "def", "get_data", "(", "query_func", ",", "load_data", "=", "False", ",", "save_data", "=", "False", ")", ":", "if", "hasattr", "(", "query_func", ",", "'__name__'", ")", ":", "func_name", "=", "query_func", ".", "__name__", "elif", "hasattr", "(", "query...
Gets data from query_func, optionally saving that data to a file; or loads data from a file.
[ "Gets", "data", "from", "query_func", "optionally", "saving", "that", "data", "to", "a", "file", ";", "or", "loads", "data", "from", "a", "file", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/scripts/issues.py#L228-L243
train
bokeh/bokeh
scripts/issues.py
check_issues
def check_issues(issues, after=None): """Checks issues for BEP 1 compliance.""" issues = closed_issues(issues, after) if after else all_issues(issues) issues = sorted(issues, key=ISSUES_SORT_KEY) have_warnings = False for section, issue_group in groupby(issues, key=ISSUES_BY_SECTION): for ...
python
def check_issues(issues, after=None): """Checks issues for BEP 1 compliance.""" issues = closed_issues(issues, after) if after else all_issues(issues) issues = sorted(issues, key=ISSUES_SORT_KEY) have_warnings = False for section, issue_group in groupby(issues, key=ISSUES_BY_SECTION): for ...
[ "def", "check_issues", "(", "issues", ",", "after", "=", "None", ")", ":", "issues", "=", "closed_issues", "(", "issues", ",", "after", ")", "if", "after", "else", "all_issues", "(", "issues", ")", "issues", "=", "sorted", "(", "issues", ",", "key", "=...
Checks issues for BEP 1 compliance.
[ "Checks", "issues", "for", "BEP", "1", "compliance", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/scripts/issues.py#L270-L281
train
bokeh/bokeh
scripts/issues.py
issue_line
def issue_line(issue): """Returns log line for given issue.""" template = '#{number} {tags}{title}' tags = issue_tags(issue) params = { 'title': issue['title'].capitalize().rstrip('.'), 'number': issue['number'], 'tags': ' '.join('[{}]'.format(tag) for tag in tags) + (' ' if tags...
python
def issue_line(issue): """Returns log line for given issue.""" template = '#{number} {tags}{title}' tags = issue_tags(issue) params = { 'title': issue['title'].capitalize().rstrip('.'), 'number': issue['number'], 'tags': ' '.join('[{}]'.format(tag) for tag in tags) + (' ' if tags...
[ "def", "issue_line", "(", "issue", ")", ":", "template", "=", "'#{number} {tags}{title}'", "tags", "=", "issue_tags", "(", "issue", ")", "params", "=", "{", "'title'", ":", "issue", "[", "'title'", "]", ".", "capitalize", "(", ")", ".", "rstrip", "(", "'...
Returns log line for given issue.
[ "Returns", "log", "line", "for", "given", "issue", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/scripts/issues.py#L286-L295
train
bokeh/bokeh
scripts/issues.py
generate_changelog
def generate_changelog(issues, after, heading, rtag=False): """Prints out changelog.""" relevent = relevant_issues(issues, after) relevent = sorted(relevent, key=ISSUES_BY_SECTION) def write(func, endofline="", append=""): func(heading + '\n' + '-' * 20 + endofline) for section, issue_g...
python
def generate_changelog(issues, after, heading, rtag=False): """Prints out changelog.""" relevent = relevant_issues(issues, after) relevent = sorted(relevent, key=ISSUES_BY_SECTION) def write(func, endofline="", append=""): func(heading + '\n' + '-' * 20 + endofline) for section, issue_g...
[ "def", "generate_changelog", "(", "issues", ",", "after", ",", "heading", ",", "rtag", "=", "False", ")", ":", "relevent", "=", "relevant_issues", "(", "issues", ",", "after", ")", "relevent", "=", "sorted", "(", "relevent", ",", "key", "=", "ISSUES_BY_SEC...
Prints out changelog.
[ "Prints", "out", "changelog", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/scripts/issues.py#L298-L317
train
bokeh/bokeh
bokeh/colors/rgb.py
RGB.copy
def copy(self): ''' Return a copy of this color value. Returns: :class:`~bokeh.colors.rgb.RGB` ''' return RGB(self.r, self.g, self.b, self.a)
python
def copy(self): ''' Return a copy of this color value. Returns: :class:`~bokeh.colors.rgb.RGB` ''' return RGB(self.r, self.g, self.b, self.a)
[ "def", "copy", "(", "self", ")", ":", "return", "RGB", "(", "self", ".", "r", ",", "self", ".", "g", ",", "self", ".", "b", ",", "self", ".", "a", ")" ]
Return a copy of this color value. Returns: :class:`~bokeh.colors.rgb.RGB`
[ "Return", "a", "copy", "of", "this", "color", "value", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/colors/rgb.py#L73-L80
train
bokeh/bokeh
bokeh/colors/rgb.py
RGB.to_css
def to_css(self): ''' Generate the CSS representation of this RGB color. Returns: str, ``"rgb(...)"`` or ``"rgba(...)"`` ''' if self.a == 1.0: return "rgb(%d, %d, %d)" % (self.r, self.g, self.b) else: return "rgba(%d, %d, %d, %s)" % (self.r, ...
python
def to_css(self): ''' Generate the CSS representation of this RGB color. Returns: str, ``"rgb(...)"`` or ``"rgba(...)"`` ''' if self.a == 1.0: return "rgb(%d, %d, %d)" % (self.r, self.g, self.b) else: return "rgba(%d, %d, %d, %s)" % (self.r, ...
[ "def", "to_css", "(", "self", ")", ":", "if", "self", ".", "a", "==", "1.0", ":", "return", "\"rgb(%d, %d, %d)\"", "%", "(", "self", ".", "r", ",", "self", ".", "g", ",", "self", ".", "b", ")", "else", ":", "return", "\"rgba(%d, %d, %d, %s)\"", "%", ...
Generate the CSS representation of this RGB color. Returns: str, ``"rgb(...)"`` or ``"rgba(...)"``
[ "Generate", "the", "CSS", "representation", "of", "this", "RGB", "color", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/colors/rgb.py#L110-L120
train
bokeh/bokeh
bokeh/colors/rgb.py
RGB.to_hsl
def to_hsl(self): ''' Return a corresponding HSL color for this RGB color. Returns: :class:`~bokeh.colors.rgb.RGB` ''' from .hsl import HSL # prevent circular import h, l, s = colorsys.rgb_to_hls(float(self.r)/255, float(self.g)/255, float(self.b)/255) retur...
python
def to_hsl(self): ''' Return a corresponding HSL color for this RGB color. Returns: :class:`~bokeh.colors.rgb.RGB` ''' from .hsl import HSL # prevent circular import h, l, s = colorsys.rgb_to_hls(float(self.r)/255, float(self.g)/255, float(self.b)/255) retur...
[ "def", "to_hsl", "(", "self", ")", ":", "from", ".", "hsl", "import", "HSL", "# prevent circular import", "h", ",", "l", ",", "s", "=", "colorsys", ".", "rgb_to_hls", "(", "float", "(", "self", ".", "r", ")", "/", "255", ",", "float", "(", "self", ...
Return a corresponding HSL color for this RGB color. Returns: :class:`~bokeh.colors.rgb.RGB`
[ "Return", "a", "corresponding", "HSL", "color", "for", "this", "RGB", "color", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/colors/rgb.py#L134-L143
train
bokeh/bokeh
bokeh/util/tornado.py
yield_for_all_futures
def yield_for_all_futures(result): """ Converts result into a Future by collapsing any futures inside result. If result is a Future we yield until it's done, then if the value inside the Future is another Future we yield until it's done as well, and so on. """ while True: # This is needed ...
python
def yield_for_all_futures(result): """ Converts result into a Future by collapsing any futures inside result. If result is a Future we yield until it's done, then if the value inside the Future is another Future we yield until it's done as well, and so on. """ while True: # This is needed ...
[ "def", "yield_for_all_futures", "(", "result", ")", ":", "while", "True", ":", "# This is needed for Tornado >= 4.5 where convert_yielded will no", "# longer raise BadYieldError on None", "if", "result", "is", "None", ":", "break", "try", ":", "future", "=", "gen", ".", ...
Converts result into a Future by collapsing any futures inside result. If result is a Future we yield until it's done, then if the value inside the Future is another Future we yield until it's done as well, and so on.
[ "Converts", "result", "into", "a", "Future", "by", "collapsing", "any", "futures", "inside", "result", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/util/tornado.py#L49-L70
train
bokeh/bokeh
bokeh/util/tornado.py
_CallbackGroup.remove_all_callbacks
def remove_all_callbacks(self): """ Removes all registered callbacks.""" for cb_id in list(self._next_tick_callback_removers.keys()): self.remove_next_tick_callback(cb_id) for cb_id in list(self._timeout_callback_removers.keys()): self.remove_timeout_callback(cb_id) ...
python
def remove_all_callbacks(self): """ Removes all registered callbacks.""" for cb_id in list(self._next_tick_callback_removers.keys()): self.remove_next_tick_callback(cb_id) for cb_id in list(self._timeout_callback_removers.keys()): self.remove_timeout_callback(cb_id) ...
[ "def", "remove_all_callbacks", "(", "self", ")", ":", "for", "cb_id", "in", "list", "(", "self", ".", "_next_tick_callback_removers", ".", "keys", "(", ")", ")", ":", "self", ".", "remove_next_tick_callback", "(", "cb_id", ")", "for", "cb_id", "in", "list", ...
Removes all registered callbacks.
[ "Removes", "all", "registered", "callbacks", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/util/tornado.py#L164-L171
train
bokeh/bokeh
bokeh/util/tornado.py
_CallbackGroup.add_next_tick_callback
def add_next_tick_callback(self, callback, callback_id=None): """ Adds a callback to be run on the next tick. Returns an ID that can be used with remove_next_tick_callback.""" def wrapper(*args, **kwargs): # this 'removed' flag is a hack because Tornado has no way # to re...
python
def add_next_tick_callback(self, callback, callback_id=None): """ Adds a callback to be run on the next tick. Returns an ID that can be used with remove_next_tick_callback.""" def wrapper(*args, **kwargs): # this 'removed' flag is a hack because Tornado has no way # to re...
[ "def", "add_next_tick_callback", "(", "self", ",", "callback", ",", "callback_id", "=", "None", ")", ":", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# this 'removed' flag is a hack because Tornado has no way", "# to remove a \"next tick\" ...
Adds a callback to be run on the next tick. Returns an ID that can be used with remove_next_tick_callback.
[ "Adds", "a", "callback", "to", "be", "run", "on", "the", "next", "tick", ".", "Returns", "an", "ID", "that", "can", "be", "used", "with", "remove_next_tick_callback", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/util/tornado.py#L207-L228
train
bokeh/bokeh
bokeh/util/tornado.py
_CallbackGroup.add_timeout_callback
def add_timeout_callback(self, callback, timeout_milliseconds, callback_id=None): """ Adds a callback to be run once after timeout_milliseconds. Returns an ID that can be used with remove_timeout_callback.""" def wrapper(*args, **kwargs): self.remove_timeout_callback(callback_id) ...
python
def add_timeout_callback(self, callback, timeout_milliseconds, callback_id=None): """ Adds a callback to be run once after timeout_milliseconds. Returns an ID that can be used with remove_timeout_callback.""" def wrapper(*args, **kwargs): self.remove_timeout_callback(callback_id) ...
[ "def", "add_timeout_callback", "(", "self", ",", "callback", ",", "timeout_milliseconds", ",", "callback_id", "=", "None", ")", ":", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "remove_timeout_callback", "(", "callback...
Adds a callback to be run once after timeout_milliseconds. Returns an ID that can be used with remove_timeout_callback.
[ "Adds", "a", "callback", "to", "be", "run", "once", "after", "timeout_milliseconds", ".", "Returns", "an", "ID", "that", "can", "be", "used", "with", "remove_timeout_callback", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/util/tornado.py#L234-L249
train
bokeh/bokeh
bokeh/util/tornado.py
_CallbackGroup.add_periodic_callback
def add_periodic_callback(self, callback, period_milliseconds, callback_id=None): """ Adds a callback to be run every period_milliseconds until it is removed. Returns an ID that can be used with remove_periodic_callback.""" cb = _AsyncPeriodic(callback, period_milliseconds, io_loop=self._loop) ...
python
def add_periodic_callback(self, callback, period_milliseconds, callback_id=None): """ Adds a callback to be run every period_milliseconds until it is removed. Returns an ID that can be used with remove_periodic_callback.""" cb = _AsyncPeriodic(callback, period_milliseconds, io_loop=self._loop) ...
[ "def", "add_periodic_callback", "(", "self", ",", "callback", ",", "period_milliseconds", ",", "callback_id", "=", "None", ")", ":", "cb", "=", "_AsyncPeriodic", "(", "callback", ",", "period_milliseconds", ",", "io_loop", "=", "self", ".", "_loop", ")", "call...
Adds a callback to be run every period_milliseconds until it is removed. Returns an ID that can be used with remove_periodic_callback.
[ "Adds", "a", "callback", "to", "be", "run", "every", "period_milliseconds", "until", "it", "is", "removed", ".", "Returns", "an", "ID", "that", "can", "be", "used", "with", "remove_periodic_callback", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/util/tornado.py#L255-L262
train
bokeh/bokeh
bokeh/sphinxext/bokeh_github.py
bokeh_commit
def bokeh_commit(name, rawtext, text, lineno, inliner, options=None, content=None): ''' Link to a Bokeh Github issue. Returns 2 part tuple containing list of nodes to insert into the document and a list of system messages. Both are allowed to be empty. ''' app = inliner.document.settings.env....
python
def bokeh_commit(name, rawtext, text, lineno, inliner, options=None, content=None): ''' Link to a Bokeh Github issue. Returns 2 part tuple containing list of nodes to insert into the document and a list of system messages. Both are allowed to be empty. ''' app = inliner.document.settings.env....
[ "def", "bokeh_commit", "(", "name", ",", "rawtext", ",", "text", ",", "lineno", ",", "inliner", ",", "options", "=", "None", ",", "content", "=", "None", ")", ":", "app", "=", "inliner", ".", "document", ".", "settings", ".", "env", ".", "app", "node...
Link to a Bokeh Github issue. Returns 2 part tuple containing list of nodes to insert into the document and a list of system messages. Both are allowed to be empty.
[ "Link", "to", "a", "Bokeh", "Github", "issue", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/sphinxext/bokeh_github.py#L79-L89
train
bokeh/bokeh
bokeh/sphinxext/bokeh_github.py
bokeh_issue
def bokeh_issue(name, rawtext, text, lineno, inliner, options=None, content=None): ''' Link to a Bokeh Github issue. Returns 2 part tuple containing list of nodes to insert into the document and a list of system messages. Both are allowed to be empty. ''' app = inliner.document.settings.env.a...
python
def bokeh_issue(name, rawtext, text, lineno, inliner, options=None, content=None): ''' Link to a Bokeh Github issue. Returns 2 part tuple containing list of nodes to insert into the document and a list of system messages. Both are allowed to be empty. ''' app = inliner.document.settings.env.a...
[ "def", "bokeh_issue", "(", "name", ",", "rawtext", ",", "text", ",", "lineno", ",", "inliner", ",", "options", "=", "None", ",", "content", "=", "None", ")", ":", "app", "=", "inliner", ".", "document", ".", "settings", ".", "env", ".", "app", "try",...
Link to a Bokeh Github issue. Returns 2 part tuple containing list of nodes to insert into the document and a list of system messages. Both are allowed to be empty.
[ "Link", "to", "a", "Bokeh", "Github", "issue", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/sphinxext/bokeh_github.py#L91-L111
train
bokeh/bokeh
bokeh/sphinxext/bokeh_github.py
bokeh_tree
def bokeh_tree(name, rawtext, text, lineno, inliner, options=None, content=None): ''' Link to a URL in the Bokeh GitHub tree, pointing to appropriate tags for releases, or to master otherwise. The link text is simply the URL path supplied, so typical usage might look like: .. code-block:: none ...
python
def bokeh_tree(name, rawtext, text, lineno, inliner, options=None, content=None): ''' Link to a URL in the Bokeh GitHub tree, pointing to appropriate tags for releases, or to master otherwise. The link text is simply the URL path supplied, so typical usage might look like: .. code-block:: none ...
[ "def", "bokeh_tree", "(", "name", ",", "rawtext", ",", "text", ",", "lineno", ",", "inliner", ",", "options", "=", "None", ",", "content", "=", "None", ")", ":", "app", "=", "inliner", ".", "document", ".", "settings", ".", "env", ".", "app", "tag", ...
Link to a URL in the Bokeh GitHub tree, pointing to appropriate tags for releases, or to master otherwise. The link text is simply the URL path supplied, so typical usage might look like: .. code-block:: none All of the examples are located in the :bokeh-tree:`examples` subdirectory o...
[ "Link", "to", "a", "URL", "in", "the", "Bokeh", "GitHub", "tree", "pointing", "to", "appropriate", "tags", "for", "releases", "or", "to", "master", "otherwise", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/sphinxext/bokeh_github.py#L135-L162
train
bokeh/bokeh
bokeh/sphinxext/bokeh_github.py
setup
def setup(app): ''' Required Sphinx extension setup function. ''' app.add_role('bokeh-commit', bokeh_commit) app.add_role('bokeh-issue', bokeh_issue) app.add_role('bokeh-pull', bokeh_pull) app.add_role('bokeh-tree', bokeh_tree)
python
def setup(app): ''' Required Sphinx extension setup function. ''' app.add_role('bokeh-commit', bokeh_commit) app.add_role('bokeh-issue', bokeh_issue) app.add_role('bokeh-pull', bokeh_pull) app.add_role('bokeh-tree', bokeh_tree)
[ "def", "setup", "(", "app", ")", ":", "app", ".", "add_role", "(", "'bokeh-commit'", ",", "bokeh_commit", ")", "app", ".", "add_role", "(", "'bokeh-issue'", ",", "bokeh_issue", ")", "app", ".", "add_role", "(", "'bokeh-pull'", ",", "bokeh_pull", ")", "app"...
Required Sphinx extension setup function.
[ "Required", "Sphinx", "extension", "setup", "function", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/sphinxext/bokeh_github.py#L164-L169
train
bokeh/bokeh
bokeh/sphinxext/bokeh_github.py
_make_gh_link_node
def _make_gh_link_node(app, rawtext, role, kind, api_type, id, options=None): ''' Return a link to a Bokeh Github resource. Args: app (Sphinx app) : current app rawtext (str) : text being replaced with link node. role (str) : role name kind (str) : resource type (issue, pull, et...
python
def _make_gh_link_node(app, rawtext, role, kind, api_type, id, options=None): ''' Return a link to a Bokeh Github resource. Args: app (Sphinx app) : current app rawtext (str) : text being replaced with link node. role (str) : role name kind (str) : resource type (issue, pull, et...
[ "def", "_make_gh_link_node", "(", "app", ",", "rawtext", ",", "role", ",", "kind", ",", "api_type", ",", "id", ",", "options", "=", "None", ")", ":", "url", "=", "\"%s/%s/%s\"", "%", "(", "_BOKEH_GH", ",", "api_type", ",", "id", ")", "options", "=", ...
Return a link to a Bokeh Github resource. Args: app (Sphinx app) : current app rawtext (str) : text being replaced with link node. role (str) : role name kind (str) : resource type (issue, pull, etc.) api_type (str) : type for api link id : (str) : id of the resource...
[ "Return", "a", "link", "to", "a", "Bokeh", "Github", "resource", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/sphinxext/bokeh_github.py#L177-L195
train
bokeh/bokeh
bokeh/document/events.py
DocumentPatchedEvent.dispatch
def dispatch(self, receiver): ''' Dispatch handling of this event to a receiver. This method will invoke ``receiver._document_patched`` if it exists. ''' super(DocumentPatchedEvent, self).dispatch(receiver) if hasattr(receiver, '_document_patched'): receiver._docume...
python
def dispatch(self, receiver): ''' Dispatch handling of this event to a receiver. This method will invoke ``receiver._document_patched`` if it exists. ''' super(DocumentPatchedEvent, self).dispatch(receiver) if hasattr(receiver, '_document_patched'): receiver._docume...
[ "def", "dispatch", "(", "self", ",", "receiver", ")", ":", "super", "(", "DocumentPatchedEvent", ",", "self", ")", ".", "dispatch", "(", "receiver", ")", "if", "hasattr", "(", "receiver", ",", "'_document_patched'", ")", ":", "receiver", ".", "_document_patc...
Dispatch handling of this event to a receiver. This method will invoke ``receiver._document_patched`` if it exists.
[ "Dispatch", "handling", "of", "this", "event", "to", "a", "receiver", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/document/events.py#L118-L126
train
bokeh/bokeh
bokeh/document/events.py
ModelChangedEvent.dispatch
def dispatch(self, receiver): ''' Dispatch handling of this event to a receiver. This method will invoke ``receiver._document_model_dhanged`` if it exists. ''' super(ModelChangedEvent, self).dispatch(receiver) if hasattr(receiver, '_document_model_changed'): ...
python
def dispatch(self, receiver): ''' Dispatch handling of this event to a receiver. This method will invoke ``receiver._document_model_dhanged`` if it exists. ''' super(ModelChangedEvent, self).dispatch(receiver) if hasattr(receiver, '_document_model_changed'): ...
[ "def", "dispatch", "(", "self", ",", "receiver", ")", ":", "super", "(", "ModelChangedEvent", ",", "self", ")", ".", "dispatch", "(", "receiver", ")", "if", "hasattr", "(", "receiver", ",", "'_document_model_changed'", ")", ":", "receiver", ".", "_document_m...
Dispatch handling of this event to a receiver. This method will invoke ``receiver._document_model_dhanged`` if it exists.
[ "Dispatch", "handling", "of", "this", "event", "to", "a", "receiver", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/document/events.py#L237-L246
train
bokeh/bokeh
bokeh/document/events.py
ModelChangedEvent.generate
def generate(self, references, buffers): ''' Create a JSON representation of this event suitable for sending to clients. Args: references (dict[str, Model]) : If the event requires references to certain models in order to function, they may be collect...
python
def generate(self, references, buffers): ''' Create a JSON representation of this event suitable for sending to clients. Args: references (dict[str, Model]) : If the event requires references to certain models in order to function, they may be collect...
[ "def", "generate", "(", "self", ",", "references", ",", "buffers", ")", ":", "from", ".", ".", "model", "import", "collect_models", "if", "self", ".", "hint", "is", "not", "None", ":", "return", "self", ".", "hint", ".", "generate", "(", "references", ...
Create a JSON representation of this event suitable for sending to clients. Args: references (dict[str, Model]) : If the event requires references to certain models in order to function, they may be collected here. **This is an "out" paramete...
[ "Create", "a", "JSON", "representation", "of", "this", "event", "suitable", "for", "sending", "to", "clients", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/document/events.py#L248-L298
train
bokeh/bokeh
bokeh/document/events.py
ColumnDataChangedEvent.dispatch
def dispatch(self, receiver): ''' Dispatch handling of this event to a receiver. This method will invoke ``receiver._column_data_changed`` if it exists. ''' super(ColumnDataChangedEvent, self).dispatch(receiver) if hasattr(receiver, '_column_data_changed'): receiver...
python
def dispatch(self, receiver): ''' Dispatch handling of this event to a receiver. This method will invoke ``receiver._column_data_changed`` if it exists. ''' super(ColumnDataChangedEvent, self).dispatch(receiver) if hasattr(receiver, '_column_data_changed'): receiver...
[ "def", "dispatch", "(", "self", ",", "receiver", ")", ":", "super", "(", "ColumnDataChangedEvent", ",", "self", ")", ".", "dispatch", "(", "receiver", ")", "if", "hasattr", "(", "receiver", ",", "'_column_data_changed'", ")", ":", "receiver", ".", "_column_d...
Dispatch handling of this event to a receiver. This method will invoke ``receiver._column_data_changed`` if it exists.
[ "Dispatch", "handling", "of", "this", "event", "to", "a", "receiver", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/document/events.py#L337-L345
train
bokeh/bokeh
bokeh/document/events.py
ColumnDataChangedEvent.generate
def generate(self, references, buffers): ''' Create a JSON representation of this event suitable for sending to clients. .. code-block:: python { 'kind' : 'ColumnDataChanged' 'column_source' : <reference to a CDS> 'new' ...
python
def generate(self, references, buffers): ''' Create a JSON representation of this event suitable for sending to clients. .. code-block:: python { 'kind' : 'ColumnDataChanged' 'column_source' : <reference to a CDS> 'new' ...
[ "def", "generate", "(", "self", ",", "references", ",", "buffers", ")", ":", "from", ".", ".", "util", ".", "serialization", "import", "transform_column_source_data", "data_dict", "=", "transform_column_source_data", "(", "self", ".", "column_source", ".", "data",...
Create a JSON representation of this event suitable for sending to clients. .. code-block:: python { 'kind' : 'ColumnDataChanged' 'column_source' : <reference to a CDS> 'new' : <new data to steam to column_source> ...
[ "Create", "a", "JSON", "representation", "of", "this", "event", "suitable", "for", "sending", "to", "clients", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/document/events.py#L347-L384
train
bokeh/bokeh
bokeh/document/events.py
ColumnsStreamedEvent.dispatch
def dispatch(self, receiver): ''' Dispatch handling of this event to a receiver. This method will invoke ``receiver._columns_streamed`` if it exists. ''' super(ColumnsStreamedEvent, self).dispatch(receiver) if hasattr(receiver, '_columns_streamed'): receiver._column...
python
def dispatch(self, receiver): ''' Dispatch handling of this event to a receiver. This method will invoke ``receiver._columns_streamed`` if it exists. ''' super(ColumnsStreamedEvent, self).dispatch(receiver) if hasattr(receiver, '_columns_streamed'): receiver._column...
[ "def", "dispatch", "(", "self", ",", "receiver", ")", ":", "super", "(", "ColumnsStreamedEvent", ",", "self", ")", ".", "dispatch", "(", "receiver", ")", "if", "hasattr", "(", "receiver", ",", "'_columns_streamed'", ")", ":", "receiver", ".", "_columns_strea...
Dispatch handling of this event to a receiver. This method will invoke ``receiver._columns_streamed`` if it exists.
[ "Dispatch", "handling", "of", "this", "event", "to", "a", "receiver", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/document/events.py#L434-L442
train
bokeh/bokeh
bokeh/document/events.py
ColumnsStreamedEvent.generate
def generate(self, references, buffers): ''' Create a JSON representation of this event suitable for sending to clients. .. code-block:: python { 'kind' : 'ColumnsStreamed' 'column_source' : <reference to a CDS> 'data' ...
python
def generate(self, references, buffers): ''' Create a JSON representation of this event suitable for sending to clients. .. code-block:: python { 'kind' : 'ColumnsStreamed' 'column_source' : <reference to a CDS> 'data' ...
[ "def", "generate", "(", "self", ",", "references", ",", "buffers", ")", ":", "return", "{", "'kind'", ":", "'ColumnsStreamed'", ",", "'column_source'", ":", "self", ".", "column_source", ".", "ref", ",", "'data'", ":", "self", ".", "data", ",", "'rollover'...
Create a JSON representation of this event suitable for sending to clients. .. code-block:: python { 'kind' : 'ColumnsStreamed' 'column_source' : <reference to a CDS> 'data' : <new data to steam to column_source> ...
[ "Create", "a", "JSON", "representation", "of", "this", "event", "suitable", "for", "sending", "to", "clients", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/document/events.py#L444-L476
train
bokeh/bokeh
bokeh/document/events.py
ColumnsPatchedEvent.dispatch
def dispatch(self, receiver): ''' Dispatch handling of this event to a receiver. This method will invoke ``receiver._columns_patched`` if it exists. ''' super(ColumnsPatchedEvent, self).dispatch(receiver) if hasattr(receiver, '_columns_patched'): receiver._columns_p...
python
def dispatch(self, receiver): ''' Dispatch handling of this event to a receiver. This method will invoke ``receiver._columns_patched`` if it exists. ''' super(ColumnsPatchedEvent, self).dispatch(receiver) if hasattr(receiver, '_columns_patched'): receiver._columns_p...
[ "def", "dispatch", "(", "self", ",", "receiver", ")", ":", "super", "(", "ColumnsPatchedEvent", ",", "self", ")", ".", "dispatch", "(", "receiver", ")", "if", "hasattr", "(", "receiver", ",", "'_columns_patched'", ")", ":", "receiver", ".", "_columns_patched...
Dispatch handling of this event to a receiver. This method will invoke ``receiver._columns_patched`` if it exists.
[ "Dispatch", "handling", "of", "this", "event", "to", "a", "receiver", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/document/events.py#L513-L521
train
bokeh/bokeh
bokeh/document/events.py
RootAddedEvent.generate
def generate(self, references, buffers): ''' Create a JSON representation of this event suitable for sending to clients. .. code-block:: python { 'kind' : 'RootAdded' 'title' : <reference to a Model> } Args: referenc...
python
def generate(self, references, buffers): ''' Create a JSON representation of this event suitable for sending to clients. .. code-block:: python { 'kind' : 'RootAdded' 'title' : <reference to a Model> } Args: referenc...
[ "def", "generate", "(", "self", ",", "references", ",", "buffers", ")", ":", "references", ".", "update", "(", "self", ".", "model", ".", "references", "(", ")", ")", "return", "{", "'kind'", ":", "'RootAdded'", ",", "'model'", ":", "self", ".", "model...
Create a JSON representation of this event suitable for sending to clients. .. code-block:: python { 'kind' : 'RootAdded' 'title' : <reference to a Model> } Args: references (dict[str, Model]) : If the event ...
[ "Create", "a", "JSON", "representation", "of", "this", "event", "suitable", "for", "sending", "to", "clients", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/document/events.py#L665-L694
train
bokeh/bokeh
bokeh/document/events.py
SessionCallbackAdded.dispatch
def dispatch(self, receiver): ''' Dispatch handling of this event to a receiver. This method will invoke ``receiver._session_callback_added`` if it exists. ''' super(SessionCallbackAdded, self).dispatch(receiver) if hasattr(receiver, '_session_callback_added'): ...
python
def dispatch(self, receiver): ''' Dispatch handling of this event to a receiver. This method will invoke ``receiver._session_callback_added`` if it exists. ''' super(SessionCallbackAdded, self).dispatch(receiver) if hasattr(receiver, '_session_callback_added'): ...
[ "def", "dispatch", "(", "self", ",", "receiver", ")", ":", "super", "(", "SessionCallbackAdded", ",", "self", ")", ".", "dispatch", "(", "receiver", ")", "if", "hasattr", "(", "receiver", ",", "'_session_callback_added'", ")", ":", "receiver", ".", "_session...
Dispatch handling of this event to a receiver. This method will invoke ``receiver._session_callback_added`` if it exists.
[ "Dispatch", "handling", "of", "this", "event", "to", "a", "receiver", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/document/events.py#L779-L788
train
bokeh/bokeh
bokeh/document/events.py
SessionCallbackRemoved.dispatch
def dispatch(self, receiver): ''' Dispatch handling of this event to a receiver. This method will invoke ``receiver._session_callback_removed`` if it exists. ''' super(SessionCallbackRemoved, self).dispatch(receiver) if hasattr(receiver, '_session_callback_removed'): ...
python
def dispatch(self, receiver): ''' Dispatch handling of this event to a receiver. This method will invoke ``receiver._session_callback_removed`` if it exists. ''' super(SessionCallbackRemoved, self).dispatch(receiver) if hasattr(receiver, '_session_callback_removed'): ...
[ "def", "dispatch", "(", "self", ",", "receiver", ")", ":", "super", "(", "SessionCallbackRemoved", ",", "self", ")", ".", "dispatch", "(", "receiver", ")", "if", "hasattr", "(", "receiver", ",", "'_session_callback_removed'", ")", ":", "receiver", ".", "_ses...
Dispatch handling of this event to a receiver. This method will invoke ``receiver._session_callback_removed`` if it exists.
[ "Dispatch", "handling", "of", "this", "event", "to", "a", "receiver", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/document/events.py#L811-L820
train
bokeh/bokeh
_setup_support.py
show_bokehjs
def show_bokehjs(bokehjs_action, develop=False): ''' Print a useful report after setuptools output describing where and how BokehJS is installed. Args: bokehjs_action (str) : one of 'built', 'installed', or 'packaged' how (or if) BokehJS was installed into the python source tree ...
python
def show_bokehjs(bokehjs_action, develop=False): ''' Print a useful report after setuptools output describing where and how BokehJS is installed. Args: bokehjs_action (str) : one of 'built', 'installed', or 'packaged' how (or if) BokehJS was installed into the python source tree ...
[ "def", "show_bokehjs", "(", "bokehjs_action", ",", "develop", "=", "False", ")", ":", "print", "(", ")", "if", "develop", ":", "print", "(", "\"Installed Bokeh for DEVELOPMENT:\"", ")", "else", ":", "print", "(", "\"Installed Bokeh:\"", ")", "if", "bokehjs_actio...
Print a useful report after setuptools output describing where and how BokehJS is installed. Args: bokehjs_action (str) : one of 'built', 'installed', or 'packaged' how (or if) BokehJS was installed into the python source tree develop (bool, optional) : whether the comm...
[ "Print", "a", "useful", "report", "after", "setuptools", "output", "describing", "where", "and", "how", "BokehJS", "is", "installed", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/_setup_support.py#L50-L74
train
bokeh/bokeh
_setup_support.py
show_help
def show_help(bokehjs_action): ''' Print information about extra Bokeh-specific command line options. Args: bokehjs_action (str) : one of 'built', 'installed', or 'packaged' how (or if) BokehJS was installed into the python source tree Returns: None ''' print() if ...
python
def show_help(bokehjs_action): ''' Print information about extra Bokeh-specific command line options. Args: bokehjs_action (str) : one of 'built', 'installed', or 'packaged' how (or if) BokehJS was installed into the python source tree Returns: None ''' print() if ...
[ "def", "show_help", "(", "bokehjs_action", ")", ":", "print", "(", ")", "if", "bokehjs_action", "in", "[", "'built'", ",", "'installed'", "]", ":", "print", "(", "\"Bokeh-specific options available with 'install' or 'develop':\"", ")", "print", "(", ")", "print", ...
Print information about extra Bokeh-specific command line options. Args: bokehjs_action (str) : one of 'built', 'installed', or 'packaged' how (or if) BokehJS was installed into the python source tree Returns: None
[ "Print", "information", "about", "extra", "Bokeh", "-", "specific", "command", "line", "options", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/_setup_support.py#L76-L97
train
bokeh/bokeh
_setup_support.py
build_or_install_bokehjs
def build_or_install_bokehjs(): ''' Build a new BokehJS (and install it) or install a previously build BokehJS. If no options ``--build-js`` or ``--install-js`` are detected, the user is prompted for what to do. If ``--existing-js`` is detected, then this setup.py is being run from a packaged ...
python
def build_or_install_bokehjs(): ''' Build a new BokehJS (and install it) or install a previously build BokehJS. If no options ``--build-js`` or ``--install-js`` are detected, the user is prompted for what to do. If ``--existing-js`` is detected, then this setup.py is being run from a packaged ...
[ "def", "build_or_install_bokehjs", "(", ")", ":", "# This happens when building from inside a published, pre-packaged sdist", "# The --existing-js option is not otherwise documented", "if", "'--existing-js'", "in", "sys", ".", "argv", ":", "sys", ".", "argv", ".", "remove", "("...
Build a new BokehJS (and install it) or install a previously build BokehJS. If no options ``--build-js`` or ``--install-js`` are detected, the user is prompted for what to do. If ``--existing-js`` is detected, then this setup.py is being run from a packaged sdist, no action is taken. Note tha...
[ "Build", "a", "new", "BokehJS", "(", "and", "install", "it", ")", "or", "install", "a", "previously", "build", "BokehJS", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/_setup_support.py#L103-L151
train
bokeh/bokeh
_setup_support.py
fixup_building_sdist
def fixup_building_sdist(): ''' Check for 'sdist' and ensure we always build BokehJS when packaging Source distributions do not ship with BokehJS source code, but must ship with a pre-built BokehJS library. This function modifies ``sys.argv`` as necessary so that ``--build-js`` IS present, and ``--inst...
python
def fixup_building_sdist(): ''' Check for 'sdist' and ensure we always build BokehJS when packaging Source distributions do not ship with BokehJS source code, but must ship with a pre-built BokehJS library. This function modifies ``sys.argv`` as necessary so that ``--build-js`` IS present, and ``--inst...
[ "def", "fixup_building_sdist", "(", ")", ":", "if", "\"sdist\"", "in", "sys", ".", "argv", ":", "if", "\"--install-js\"", "in", "sys", ".", "argv", ":", "print", "(", "\"Removing '--install-js' incompatible with 'sdist'\"", ")", "sys", ".", "argv", ".", "remove"...
Check for 'sdist' and ensure we always build BokehJS when packaging Source distributions do not ship with BokehJS source code, but must ship with a pre-built BokehJS library. This function modifies ``sys.argv`` as necessary so that ``--build-js`` IS present, and ``--install-js` is NOT. Returns: ...
[ "Check", "for", "sdist", "and", "ensure", "we", "always", "build", "BokehJS", "when", "packaging" ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/_setup_support.py#L157-L174
train
bokeh/bokeh
_setup_support.py
fixup_for_packaged
def fixup_for_packaged(): ''' If we are installing FROM an sdist, then a pre-built BokehJS is already installed in the python source tree. The command line options ``--build-js`` or ``--install-js`` are removed from ``sys.argv``, with a warning. Also adds ``--existing-js`` to ``sys.argv`` to signa...
python
def fixup_for_packaged(): ''' If we are installing FROM an sdist, then a pre-built BokehJS is already installed in the python source tree. The command line options ``--build-js`` or ``--install-js`` are removed from ``sys.argv``, with a warning. Also adds ``--existing-js`` to ``sys.argv`` to signa...
[ "def", "fixup_for_packaged", "(", ")", ":", "if", "exists", "(", "join", "(", "ROOT", ",", "'PKG-INFO'", ")", ")", ":", "if", "\"--build-js\"", "in", "sys", ".", "argv", "or", "\"--install-js\"", "in", "sys", ".", "argv", ":", "print", "(", "SDIST_BUILD_...
If we are installing FROM an sdist, then a pre-built BokehJS is already installed in the python source tree. The command line options ``--build-js`` or ``--install-js`` are removed from ``sys.argv``, with a warning. Also adds ``--existing-js`` to ``sys.argv`` to signal that BokehJS is already pack...
[ "If", "we", "are", "installing", "FROM", "an", "sdist", "then", "a", "pre", "-", "built", "BokehJS", "is", "already", "installed", "in", "the", "python", "source", "tree", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/_setup_support.py#L176-L198
train
bokeh/bokeh
_setup_support.py
get_cmdclass
def get_cmdclass(): ''' A ``cmdclass`` that works around a setuptools deficiency. There is no need to build wheels when installing a package, however some versions of setuptools seem to mandate this. This is a hacky workaround that modifies the ``cmdclass`` returned by versioneer so that not having ...
python
def get_cmdclass(): ''' A ``cmdclass`` that works around a setuptools deficiency. There is no need to build wheels when installing a package, however some versions of setuptools seem to mandate this. This is a hacky workaround that modifies the ``cmdclass`` returned by versioneer so that not having ...
[ "def", "get_cmdclass", "(", ")", ":", "cmdclass", "=", "versioneer", ".", "get_cmdclass", "(", ")", "try", ":", "from", "wheel", ".", "bdist_wheel", "import", "bdist_wheel", "except", "ImportError", ":", "# pip is not claiming for bdist_wheel when wheel is not installed...
A ``cmdclass`` that works around a setuptools deficiency. There is no need to build wheels when installing a package, however some versions of setuptools seem to mandate this. This is a hacky workaround that modifies the ``cmdclass`` returned by versioneer so that not having wheel installed is not a fa...
[ "A", "cmdclass", "that", "works", "around", "a", "setuptools", "deficiency", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/_setup_support.py#L203-L223
train
bokeh/bokeh
_setup_support.py
jsbuild_prompt
def jsbuild_prompt(): ''' Prompt users whether to build a new BokehJS or install an existing one. Returns: bool : True, if a new build is requested, False otherwise ''' print(BOKEHJS_BUILD_PROMPT) mapping = {"1": True, "2": False} value = input("Choice? ") while value not in mappin...
python
def jsbuild_prompt(): ''' Prompt users whether to build a new BokehJS or install an existing one. Returns: bool : True, if a new build is requested, False otherwise ''' print(BOKEHJS_BUILD_PROMPT) mapping = {"1": True, "2": False} value = input("Choice? ") while value not in mappin...
[ "def", "jsbuild_prompt", "(", ")", ":", "print", "(", "BOKEHJS_BUILD_PROMPT", ")", "mapping", "=", "{", "\"1\"", ":", "True", ",", "\"2\"", ":", "False", "}", "value", "=", "input", "(", "\"Choice? \"", ")", "while", "value", "not", "in", "mapping", ":",...
Prompt users whether to build a new BokehJS or install an existing one. Returns: bool : True, if a new build is requested, False otherwise
[ "Prompt", "users", "whether", "to", "build", "a", "new", "BokehJS", "or", "install", "an", "existing", "one", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/_setup_support.py#L245-L258
train
bokeh/bokeh
_setup_support.py
build_js
def build_js(): ''' Build BokehJS files (CSS, JS, etc) under the ``bokehjs`` source subdirectory. Also prints a table of statistics about the generated assets (file sizes, etc.) or any error messages if the build fails. Note this function only builds BokehJS assets, it does not install them in...
python
def build_js(): ''' Build BokehJS files (CSS, JS, etc) under the ``bokehjs`` source subdirectory. Also prints a table of statistics about the generated assets (file sizes, etc.) or any error messages if the build fails. Note this function only builds BokehJS assets, it does not install them in...
[ "def", "build_js", "(", ")", ":", "print", "(", "\"Building BokehJS... \"", ",", "end", "=", "\"\"", ")", "sys", ".", "stdout", ".", "flush", "(", ")", "os", ".", "chdir", "(", "'bokehjs'", ")", "cmd", "=", "[", "\"node\"", ",", "\"make\"", ",", "'bu...
Build BokehJS files (CSS, JS, etc) under the ``bokehjs`` source subdirectory. Also prints a table of statistics about the generated assets (file sizes, etc.) or any error messages if the build fails. Note this function only builds BokehJS assets, it does not install them into the python source tre...
[ "Build", "BokehJS", "files", "(", "CSS", "JS", "etc", ")", "under", "the", "bokehjs", "source", "subdirectory", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/_setup_support.py#L264-L338
train
bokeh/bokeh
_setup_support.py
install_js
def install_js(): ''' Copy built BokehJS files into the Python source tree. Returns: None ''' target_jsdir = join(SERVER, 'static', 'js') target_cssdir = join(SERVER, 'static', 'css') target_tslibdir = join(SERVER, 'static', 'lib') STATIC_ASSETS = [ join(JS, 'bokeh.js'), ...
python
def install_js(): ''' Copy built BokehJS files into the Python source tree. Returns: None ''' target_jsdir = join(SERVER, 'static', 'js') target_cssdir = join(SERVER, 'static', 'css') target_tslibdir = join(SERVER, 'static', 'lib') STATIC_ASSETS = [ join(JS, 'bokeh.js'), ...
[ "def", "install_js", "(", ")", ":", "target_jsdir", "=", "join", "(", "SERVER", ",", "'static'", ",", "'js'", ")", "target_cssdir", "=", "join", "(", "SERVER", ",", "'static'", ",", "'css'", ")", "target_tslibdir", "=", "join", "(", "SERVER", ",", "'stat...
Copy built BokehJS files into the Python source tree. Returns: None
[ "Copy", "built", "BokehJS", "files", "into", "the", "Python", "source", "tree", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/_setup_support.py#L340-L381
train
bokeh/bokeh
bokeh/util/hex.py
axial_to_cartesian
def axial_to_cartesian(q, r, size, orientation, aspect_scale=1): ''' Map axial *(q,r)* coordinates to cartesian *(x,y)* coordinates of tiles centers. This function can be useful for positioning other Bokeh glyphs with cartesian coordinates in relation to a hex tiling. This function was adapted fro...
python
def axial_to_cartesian(q, r, size, orientation, aspect_scale=1): ''' Map axial *(q,r)* coordinates to cartesian *(x,y)* coordinates of tiles centers. This function can be useful for positioning other Bokeh glyphs with cartesian coordinates in relation to a hex tiling. This function was adapted fro...
[ "def", "axial_to_cartesian", "(", "q", ",", "r", ",", "size", ",", "orientation", ",", "aspect_scale", "=", "1", ")", ":", "if", "orientation", "==", "\"pointytop\"", ":", "x", "=", "size", "*", "np", ".", "sqrt", "(", "3", ")", "*", "(", "q", "+",...
Map axial *(q,r)* coordinates to cartesian *(x,y)* coordinates of tiles centers. This function can be useful for positioning other Bokeh glyphs with cartesian coordinates in relation to a hex tiling. This function was adapted from: https://www.redblobgames.com/grids/hexagons/#hex-to-pixel ...
[ "Map", "axial", "*", "(", "q", "r", ")", "*", "coordinates", "to", "cartesian", "*", "(", "x", "y", ")", "*", "coordinates", "of", "tiles", "centers", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/util/hex.py#L49-L98
train
bokeh/bokeh
bokeh/util/hex.py
cartesian_to_axial
def cartesian_to_axial(x, y, size, orientation, aspect_scale=1): ''' Map Cartesion *(x,y)* points to axial *(q,r)* coordinates of enclosing tiles. This function was adapted from: https://www.redblobgames.com/grids/hexagons/#pixel-to-hex Args: x (array[float]) : A NumPy arr...
python
def cartesian_to_axial(x, y, size, orientation, aspect_scale=1): ''' Map Cartesion *(x,y)* points to axial *(q,r)* coordinates of enclosing tiles. This function was adapted from: https://www.redblobgames.com/grids/hexagons/#pixel-to-hex Args: x (array[float]) : A NumPy arr...
[ "def", "cartesian_to_axial", "(", "x", ",", "y", ",", "size", ",", "orientation", ",", "aspect_scale", "=", "1", ")", ":", "HEX_FLAT", "=", "[", "2.0", "/", "3.0", ",", "0.0", ",", "-", "1.0", "/", "3.0", ",", "np", ".", "sqrt", "(", "3.0", ")", ...
Map Cartesion *(x,y)* points to axial *(q,r)* coordinates of enclosing tiles. This function was adapted from: https://www.redblobgames.com/grids/hexagons/#pixel-to-hex Args: x (array[float]) : A NumPy array of x-coordinates to convert y (array[float]) : A ...
[ "Map", "Cartesion", "*", "(", "x", "y", ")", "*", "points", "to", "axial", "*", "(", "q", "r", ")", "*", "coordinates", "of", "enclosing", "tiles", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/util/hex.py#L100-L150
train
bokeh/bokeh
bokeh/util/hex.py
hexbin
def hexbin(x, y, size, orientation="pointytop", aspect_scale=1): ''' Perform an equal-weight binning of data points into hexagonal tiles. For more sophisticated use cases, e.g. weighted binning or scaling individual tiles proportional to some other quantity, consider using HoloViews. Args: ...
python
def hexbin(x, y, size, orientation="pointytop", aspect_scale=1): ''' Perform an equal-weight binning of data points into hexagonal tiles. For more sophisticated use cases, e.g. weighted binning or scaling individual tiles proportional to some other quantity, consider using HoloViews. Args: ...
[ "def", "hexbin", "(", "x", ",", "y", ",", "size", ",", "orientation", "=", "\"pointytop\"", ",", "aspect_scale", "=", "1", ")", ":", "pd", "=", "import_required", "(", "'pandas'", ",", "'hexbin requires pandas to be installed'", ")", "q", ",", "r", "=", "c...
Perform an equal-weight binning of data points into hexagonal tiles. For more sophisticated use cases, e.g. weighted binning or scaling individual tiles proportional to some other quantity, consider using HoloViews. Args: x (array[float]) : A NumPy array of x-coordinates for binnin...
[ "Perform", "an", "equal", "-", "weight", "binning", "of", "data", "points", "into", "hexagonal", "tiles", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/util/hex.py#L152-L204
train
bokeh/bokeh
bokeh/util/hex.py
_round_hex
def _round_hex(q, r): ''' Round floating point axial hex coordinates to integer *(q,r)* coordinates. This code was adapted from: https://www.redblobgames.com/grids/hexagons/#rounding Args: q (array[float]) : NumPy array of Floating point axial *q* coordinates to round ...
python
def _round_hex(q, r): ''' Round floating point axial hex coordinates to integer *(q,r)* coordinates. This code was adapted from: https://www.redblobgames.com/grids/hexagons/#rounding Args: q (array[float]) : NumPy array of Floating point axial *q* coordinates to round ...
[ "def", "_round_hex", "(", "q", ",", "r", ")", ":", "x", "=", "q", "z", "=", "r", "y", "=", "-", "x", "-", "z", "rx", "=", "np", ".", "round", "(", "x", ")", "ry", "=", "np", ".", "round", "(", "y", ")", "rz", "=", "np", ".", "round", ...
Round floating point axial hex coordinates to integer *(q,r)* coordinates. This code was adapted from: https://www.redblobgames.com/grids/hexagons/#rounding Args: q (array[float]) : NumPy array of Floating point axial *q* coordinates to round r (array[float]) : ...
[ "Round", "floating", "point", "axial", "hex", "coordinates", "to", "integer", "*", "(", "q", "r", ")", "*", "coordinates", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/util/hex.py#L214-L249
train
bokeh/bokeh
versioneer.py
versions_from_parentdir
def versions_from_parentdir(parentdir_prefix, root, verbose): """Try to determine the version from the parent directory name. Source tarballs conventionally unpack into a directory that includes both the project name and a version string. We will also support searching up two directory levels for an ap...
python
def versions_from_parentdir(parentdir_prefix, root, verbose): """Try to determine the version from the parent directory name. Source tarballs conventionally unpack into a directory that includes both the project name and a version string. We will also support searching up two directory levels for an ap...
[ "def", "versions_from_parentdir", "(", "parentdir_prefix", ",", "root", ",", "verbose", ")", ":", "rootdirs", "=", "[", "]", "for", "i", "in", "range", "(", "3", ")", ":", "dirname", "=", "os", ".", "path", ".", "basename", "(", "root", ")", "if", "d...
Try to determine the version from the parent directory name. Source tarballs conventionally unpack into a directory that includes both the project name and a version string. We will also support searching up two directory levels for an appropriately named parent directory
[ "Try", "to", "determine", "the", "version", "from", "the", "parent", "directory", "name", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/versioneer.py#L1166-L1188
train
bokeh/bokeh
versioneer.py
render_pep440_pre
def render_pep440_pre(pieces): """TAG[.post.devDISTANCE] -- No -dirty. Exceptions: 1: no tags. 0.post.devDISTANCE """ if pieces["closest-tag"]: rendered = pieces["closest-tag"] if pieces["distance"]: rendered += ".post.dev%d" % pieces["distance"] else: # exce...
python
def render_pep440_pre(pieces): """TAG[.post.devDISTANCE] -- No -dirty. Exceptions: 1: no tags. 0.post.devDISTANCE """ if pieces["closest-tag"]: rendered = pieces["closest-tag"] if pieces["distance"]: rendered += ".post.dev%d" % pieces["distance"] else: # exce...
[ "def", "render_pep440_pre", "(", "pieces", ")", ":", "if", "pieces", "[", "\"closest-tag\"", "]", ":", "rendered", "=", "pieces", "[", "\"closest-tag\"", "]", "if", "pieces", "[", "\"distance\"", "]", ":", "rendered", "+=", "\".post.dev%d\"", "%", "pieces", ...
TAG[.post.devDISTANCE] -- No -dirty. Exceptions: 1: no tags. 0.post.devDISTANCE
[ "TAG", "[", ".", "post", ".", "devDISTANCE", "]", "--", "No", "-", "dirty", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/versioneer.py#L1268-L1281
train
bokeh/bokeh
bokeh/core/property/container.py
List.wrap
def wrap(cls, value): ''' Some property types need to wrap their values in special containers, etc. ''' if isinstance(value, list): if isinstance(value, PropertyValueList): return value else: return PropertyValueList(value) else: ...
python
def wrap(cls, value): ''' Some property types need to wrap their values in special containers, etc. ''' if isinstance(value, list): if isinstance(value, PropertyValueList): return value else: return PropertyValueList(value) else: ...
[ "def", "wrap", "(", "cls", ",", "value", ")", ":", "if", "isinstance", "(", "value", ",", "list", ")", ":", "if", "isinstance", "(", "value", ",", "PropertyValueList", ")", ":", "return", "value", "else", ":", "return", "PropertyValueList", "(", "value",...
Some property types need to wrap their values in special containers, etc.
[ "Some", "property", "types", "need", "to", "wrap", "their", "values", "in", "special", "containers", "etc", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/core/property/container.py#L124-L134
train
bokeh/bokeh
bokeh/core/property/container.py
Dict.wrap
def wrap(cls, value): ''' Some property types need to wrap their values in special containers, etc. ''' if isinstance(value, dict): if isinstance(value, PropertyValueDict): return value else: return PropertyValueDict(value) else: ...
python
def wrap(cls, value): ''' Some property types need to wrap their values in special containers, etc. ''' if isinstance(value, dict): if isinstance(value, PropertyValueDict): return value else: return PropertyValueDict(value) else: ...
[ "def", "wrap", "(", "cls", ",", "value", ")", ":", "if", "isinstance", "(", "value", ",", "dict", ")", ":", "if", "isinstance", "(", "value", ",", "PropertyValueDict", ")", ":", "return", "value", "else", ":", "return", "PropertyValueDict", "(", "value",...
Some property types need to wrap their values in special containers, etc.
[ "Some", "property", "types", "need", "to", "wrap", "their", "values", "in", "special", "containers", "etc", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/core/property/container.py#L193-L203
train
bokeh/bokeh
bokeh/core/property/container.py
ColumnData.from_json
def from_json(self, json, models=None): ''' Decodes column source data encoded as lists or base64 strings. ''' if json is None: return None elif not isinstance(json, dict): raise DeserializationError("%s expected a dict or None, got %s" % (self, json)) new...
python
def from_json(self, json, models=None): ''' Decodes column source data encoded as lists or base64 strings. ''' if json is None: return None elif not isinstance(json, dict): raise DeserializationError("%s expected a dict or None, got %s" % (self, json)) new...
[ "def", "from_json", "(", "self", ",", "json", ",", "models", "=", "None", ")", ":", "if", "json", "is", "None", ":", "return", "None", "elif", "not", "isinstance", "(", "json", ",", "dict", ")", ":", "raise", "DeserializationError", "(", "\"%s expected a...
Decodes column source data encoded as lists or base64 strings.
[ "Decodes", "column", "source", "data", "encoded", "as", "lists", "or", "base64", "strings", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/core/property/container.py#L234-L257
train
bokeh/bokeh
bokeh/core/property/container.py
ColumnData.wrap
def wrap(cls, value): ''' Some property types need to wrap their values in special containers, etc. ''' if isinstance(value, dict): if isinstance(value, PropertyValueColumnData): return value else: return PropertyValueColumnData(value) ...
python
def wrap(cls, value): ''' Some property types need to wrap their values in special containers, etc. ''' if isinstance(value, dict): if isinstance(value, PropertyValueColumnData): return value else: return PropertyValueColumnData(value) ...
[ "def", "wrap", "(", "cls", ",", "value", ")", ":", "if", "isinstance", "(", "value", ",", "dict", ")", ":", "if", "isinstance", "(", "value", ",", "PropertyValueColumnData", ")", ":", "return", "value", "else", ":", "return", "PropertyValueColumnData", "("...
Some property types need to wrap their values in special containers, etc.
[ "Some", "property", "types", "need", "to", "wrap", "their", "values", "in", "special", "containers", "etc", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/core/property/container.py#L263-L273
train
bokeh/bokeh
bokeh/util/serialization.py
convert_timedelta_type
def convert_timedelta_type(obj): ''' Convert any recognized timedelta value to floating point absolute milliseconds. Arg: obj (object) : the object to convert Returns: float : milliseconds ''' if isinstance(obj, dt.timedelta): return obj.total_seconds() * 1000. eli...
python
def convert_timedelta_type(obj): ''' Convert any recognized timedelta value to floating point absolute milliseconds. Arg: obj (object) : the object to convert Returns: float : milliseconds ''' if isinstance(obj, dt.timedelta): return obj.total_seconds() * 1000. eli...
[ "def", "convert_timedelta_type", "(", "obj", ")", ":", "if", "isinstance", "(", "obj", ",", "dt", ".", "timedelta", ")", ":", "return", "obj", ".", "total_seconds", "(", ")", "*", "1000.", "elif", "isinstance", "(", "obj", ",", "np", ".", "timedelta64", ...
Convert any recognized timedelta value to floating point absolute milliseconds. Arg: obj (object) : the object to convert Returns: float : milliseconds
[ "Convert", "any", "recognized", "timedelta", "value", "to", "floating", "point", "absolute", "milliseconds", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/util/serialization.py#L136-L150
train
bokeh/bokeh
bokeh/util/serialization.py
convert_datetime_type
def convert_datetime_type(obj): ''' Convert any recognized date, time, or datetime value to floating point milliseconds since epoch. Arg: obj (object) : the object to convert Returns: float : milliseconds ''' # Pandas NaT if pd and obj is pd.NaT: return np.nan ...
python
def convert_datetime_type(obj): ''' Convert any recognized date, time, or datetime value to floating point milliseconds since epoch. Arg: obj (object) : the object to convert Returns: float : milliseconds ''' # Pandas NaT if pd and obj is pd.NaT: return np.nan ...
[ "def", "convert_datetime_type", "(", "obj", ")", ":", "# Pandas NaT", "if", "pd", "and", "obj", "is", "pd", ".", "NaT", ":", "return", "np", ".", "nan", "# Pandas Period", "if", "pd", "and", "isinstance", "(", "obj", ",", "pd", ".", "Period", ")", ":",...
Convert any recognized date, time, or datetime value to floating point milliseconds since epoch. Arg: obj (object) : the object to convert Returns: float : milliseconds
[ "Convert", "any", "recognized", "date", "time", "or", "datetime", "value", "to", "floating", "point", "milliseconds", "since", "epoch", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/util/serialization.py#L152-L193
train
bokeh/bokeh
bokeh/util/serialization.py
convert_datetime_array
def convert_datetime_array(array): ''' Convert NumPy datetime arrays to arrays to milliseconds since epoch. Args: array : (obj) A NumPy array of datetime to convert If the value passed in is not a NumPy array, it will be returned as-is. Returns: array ''' ...
python
def convert_datetime_array(array): ''' Convert NumPy datetime arrays to arrays to milliseconds since epoch. Args: array : (obj) A NumPy array of datetime to convert If the value passed in is not a NumPy array, it will be returned as-is. Returns: array ''' ...
[ "def", "convert_datetime_array", "(", "array", ")", ":", "if", "not", "isinstance", "(", "array", ",", "np", ".", "ndarray", ")", ":", "return", "array", "try", ":", "dt2001", "=", "np", ".", "datetime64", "(", "'2001'", ")", "legacy_datetime64", "=", "(...
Convert NumPy datetime arrays to arrays to milliseconds since epoch. Args: array : (obj) A NumPy array of datetime to convert If the value passed in is not a NumPy array, it will be returned as-is. Returns: array
[ "Convert", "NumPy", "datetime", "arrays", "to", "arrays", "to", "milliseconds", "since", "epoch", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/util/serialization.py#L195-L238
train
bokeh/bokeh
bokeh/util/serialization.py
make_id
def make_id(): ''' Return a new unique ID for a Bokeh object. Normally this function will return simple monotonically increasing integer IDs (as strings) for identifying Bokeh objects within a Document. However, if it is desirable to have globally unique for every object, this behavior can be overr...
python
def make_id(): ''' Return a new unique ID for a Bokeh object. Normally this function will return simple monotonically increasing integer IDs (as strings) for identifying Bokeh objects within a Document. However, if it is desirable to have globally unique for every object, this behavior can be overr...
[ "def", "make_id", "(", ")", ":", "global", "_simple_id", "if", "settings", ".", "simple_ids", "(", "True", ")", ":", "with", "_simple_id_lock", ":", "_simple_id", "+=", "1", "return", "str", "(", "_simple_id", ")", "else", ":", "return", "make_globally_uniqu...
Return a new unique ID for a Bokeh object. Normally this function will return simple monotonically increasing integer IDs (as strings) for identifying Bokeh objects within a Document. However, if it is desirable to have globally unique for every object, this behavior can be overridden by setting the en...
[ "Return", "a", "new", "unique", "ID", "for", "a", "Bokeh", "object", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/util/serialization.py#L240-L259
train
bokeh/bokeh
bokeh/util/serialization.py
transform_array
def transform_array(array, force_list=False, buffers=None): ''' Transform a NumPy arrays into serialized format Converts un-serializable dtypes and returns JSON serializable format Args: array (np.ndarray) : a NumPy array to be transformed force_list (bool, optional) : whether to only ...
python
def transform_array(array, force_list=False, buffers=None): ''' Transform a NumPy arrays into serialized format Converts un-serializable dtypes and returns JSON serializable format Args: array (np.ndarray) : a NumPy array to be transformed force_list (bool, optional) : whether to only ...
[ "def", "transform_array", "(", "array", ",", "force_list", "=", "False", ",", "buffers", "=", "None", ")", ":", "array", "=", "convert_datetime_array", "(", "array", ")", "return", "serialize_array", "(", "array", ",", "force_list", "=", "force_list", ",", "...
Transform a NumPy arrays into serialized format Converts un-serializable dtypes and returns JSON serializable format Args: array (np.ndarray) : a NumPy array to be transformed force_list (bool, optional) : whether to only output to standard lists This function can encode some d...
[ "Transform", "a", "NumPy", "arrays", "into", "serialized", "format" ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/util/serialization.py#L295-L328
train
bokeh/bokeh
bokeh/util/serialization.py
transform_array_to_list
def transform_array_to_list(array): ''' Transforms a NumPy array into a list of values Args: array (np.nadarray) : the NumPy array series to transform Returns: list or dict ''' if (array.dtype.kind in ('u', 'i', 'f') and (~np.isfinite(array)).any()): transformed = array.as...
python
def transform_array_to_list(array): ''' Transforms a NumPy array into a list of values Args: array (np.nadarray) : the NumPy array series to transform Returns: list or dict ''' if (array.dtype.kind in ('u', 'i', 'f') and (~np.isfinite(array)).any()): transformed = array.as...
[ "def", "transform_array_to_list", "(", "array", ")", ":", "if", "(", "array", ".", "dtype", ".", "kind", "in", "(", "'u'", ",", "'i'", ",", "'f'", ")", "and", "(", "~", "np", ".", "isfinite", "(", "array", ")", ")", ".", "any", "(", ")", ")", "...
Transforms a NumPy array into a list of values Args: array (np.nadarray) : the NumPy array series to transform Returns: list or dict
[ "Transforms", "a", "NumPy", "array", "into", "a", "list", "of", "values" ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/util/serialization.py#L330-L350
train
bokeh/bokeh
bokeh/util/serialization.py
transform_series
def transform_series(series, force_list=False, buffers=None): ''' Transforms a Pandas series into serialized form Args: series (pd.Series) : the Pandas series to transform force_list (bool, optional) : whether to only output to standard lists This function can encode some dtypes usi...
python
def transform_series(series, force_list=False, buffers=None): ''' Transforms a Pandas series into serialized form Args: series (pd.Series) : the Pandas series to transform force_list (bool, optional) : whether to only output to standard lists This function can encode some dtypes usi...
[ "def", "transform_series", "(", "series", ",", "force_list", "=", "False", ",", "buffers", "=", "None", ")", ":", "# not checking for pd here, this function should only be called if it", "# is already known that series is a Pandas Series type", "if", "isinstance", "(", "series"...
Transforms a Pandas series into serialized form Args: series (pd.Series) : the Pandas series to transform force_list (bool, optional) : whether to only output to standard lists This function can encode some dtypes using a binary encoding, but setting this argument to True wi...
[ "Transforms", "a", "Pandas", "series", "into", "serialized", "form" ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/util/serialization.py#L352-L384
train
bokeh/bokeh
bokeh/util/serialization.py
serialize_array
def serialize_array(array, force_list=False, buffers=None): ''' Transforms a NumPy array into serialized form. Args: array (np.ndarray) : the NumPy array to transform force_list (bool, optional) : whether to only output to standard lists This function can encode some dtypes using a ...
python
def serialize_array(array, force_list=False, buffers=None): ''' Transforms a NumPy array into serialized form. Args: array (np.ndarray) : the NumPy array to transform force_list (bool, optional) : whether to only output to standard lists This function can encode some dtypes using a ...
[ "def", "serialize_array", "(", "array", ",", "force_list", "=", "False", ",", "buffers", "=", "None", ")", ":", "if", "isinstance", "(", "array", ",", "np", ".", "ma", ".", "MaskedArray", ")", ":", "array", "=", "array", ".", "filled", "(", "np", "."...
Transforms a NumPy array into serialized form. Args: array (np.ndarray) : the NumPy array to transform force_list (bool, optional) : whether to only output to standard lists This function can encode some dtypes using a binary encoding, but setting this argument to True will ...
[ "Transforms", "a", "NumPy", "array", "into", "serialized", "form", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/util/serialization.py#L386-L421
train
bokeh/bokeh
bokeh/util/serialization.py
traverse_data
def traverse_data(obj, use_numpy=True, buffers=None): ''' Recursively traverse an object until a flat list is found. If NumPy is available, the flat list is converted to a numpy array and passed to transform_array() to handle ``nan``, ``inf``, and ``-inf``. Otherwise, iterate through all items, co...
python
def traverse_data(obj, use_numpy=True, buffers=None): ''' Recursively traverse an object until a flat list is found. If NumPy is available, the flat list is converted to a numpy array and passed to transform_array() to handle ``nan``, ``inf``, and ``-inf``. Otherwise, iterate through all items, co...
[ "def", "traverse_data", "(", "obj", ",", "use_numpy", "=", "True", ",", "buffers", "=", "None", ")", ":", "if", "use_numpy", "and", "all", "(", "isinstance", "(", "el", ",", "np", ".", "ndarray", ")", "for", "el", "in", "obj", ")", ":", "return", "...
Recursively traverse an object until a flat list is found. If NumPy is available, the flat list is converted to a numpy array and passed to transform_array() to handle ``nan``, ``inf``, and ``-inf``. Otherwise, iterate through all items, converting non-JSON items Args: obj (list) : a list...
[ "Recursively", "traverse", "an", "object", "until", "a", "flat", "list", "is", "found", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/util/serialization.py#L423-L456
train
bokeh/bokeh
bokeh/util/serialization.py
transform_column_source_data
def transform_column_source_data(data, buffers=None, cols=None): ''' Transform ``ColumnSourceData`` data to a serialized format Args: data (dict) : the mapping of names to data columns to transform buffers (set, optional) : If binary buffers are desired, the buffers parameter may b...
python
def transform_column_source_data(data, buffers=None, cols=None): ''' Transform ``ColumnSourceData`` data to a serialized format Args: data (dict) : the mapping of names to data columns to transform buffers (set, optional) : If binary buffers are desired, the buffers parameter may b...
[ "def", "transform_column_source_data", "(", "data", ",", "buffers", "=", "None", ",", "cols", "=", "None", ")", ":", "to_transform", "=", "set", "(", "data", ")", "if", "cols", "is", "None", "else", "set", "(", "cols", ")", "data_copy", "=", "{", "}", ...
Transform ``ColumnSourceData`` data to a serialized format Args: data (dict) : the mapping of names to data columns to transform buffers (set, optional) : If binary buffers are desired, the buffers parameter may be provided, and any columns that may be sent as binary buffer...
[ "Transform", "ColumnSourceData", "data", "to", "a", "serialized", "format" ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/util/serialization.py#L458-L492
train
bokeh/bokeh
bokeh/util/serialization.py
encode_binary_dict
def encode_binary_dict(array, buffers): ''' Send a numpy array as an unencoded binary buffer The encoded format is a dict with the following structure: .. code:: python { '__buffer__' : << an ID to locate the buffer >>, 'shape' : << array shape >>, 'dtype...
python
def encode_binary_dict(array, buffers): ''' Send a numpy array as an unencoded binary buffer The encoded format is a dict with the following structure: .. code:: python { '__buffer__' : << an ID to locate the buffer >>, 'shape' : << array shape >>, 'dtype...
[ "def", "encode_binary_dict", "(", "array", ",", "buffers", ")", ":", "buffer_id", "=", "make_id", "(", ")", "buf", "=", "(", "dict", "(", "id", "=", "buffer_id", ")", ",", "array", ".", "tobytes", "(", ")", ")", "buffers", ".", "append", "(", "buf", ...
Send a numpy array as an unencoded binary buffer The encoded format is a dict with the following structure: .. code:: python { '__buffer__' : << an ID to locate the buffer >>, 'shape' : << array shape >>, 'dtype' : << dtype name >>, 'order' ...
[ "Send", "a", "numpy", "array", "as", "an", "unencoded", "binary", "buffer" ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/util/serialization.py#L494-L530
train
bokeh/bokeh
bokeh/util/serialization.py
decode_base64_dict
def decode_base64_dict(data): ''' Decode a base64 encoded array into a NumPy array. Args: data (dict) : encoded array data to decode Data should have the format encoded by :func:`encode_base64_dict`. Returns: np.ndarray ''' b64 = base64.b64decode(data['__ndarray__']) arra...
python
def decode_base64_dict(data): ''' Decode a base64 encoded array into a NumPy array. Args: data (dict) : encoded array data to decode Data should have the format encoded by :func:`encode_base64_dict`. Returns: np.ndarray ''' b64 = base64.b64decode(data['__ndarray__']) arra...
[ "def", "decode_base64_dict", "(", "data", ")", ":", "b64", "=", "base64", ".", "b64decode", "(", "data", "[", "'__ndarray__'", "]", ")", "array", "=", "np", ".", "copy", "(", "np", ".", "frombuffer", "(", "b64", ",", "dtype", "=", "data", "[", "'dtyp...
Decode a base64 encoded array into a NumPy array. Args: data (dict) : encoded array data to decode Data should have the format encoded by :func:`encode_base64_dict`. Returns: np.ndarray
[ "Decode", "a", "base64", "encoded", "array", "into", "a", "NumPy", "array", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/util/serialization.py#L559-L575
train
bokeh/bokeh
bokeh/models/tools.py
CustomJSHover.from_py_func
def from_py_func(cls, code): ''' Create a ``CustomJSHover`` instance from a Python functions. The function is translated to JavaScript using PScript. The python functions must have no positional arguments. It is possible to pass Bokeh models (e.g. a ``ColumnDataSource``) as keyword ...
python
def from_py_func(cls, code): ''' Create a ``CustomJSHover`` instance from a Python functions. The function is translated to JavaScript using PScript. The python functions must have no positional arguments. It is possible to pass Bokeh models (e.g. a ``ColumnDataSource``) as keyword ...
[ "def", "from_py_func", "(", "cls", ",", "code", ")", ":", "from", "bokeh", ".", "util", ".", "deprecation", "import", "deprecated", "deprecated", "(", "\"'from_py_func' is deprecated and will be removed in an eventual 2.0 release. \"", "\"Use CustomJSHover directly instead.\"",...
Create a ``CustomJSHover`` instance from a Python functions. The function is translated to JavaScript using PScript. The python functions must have no positional arguments. It is possible to pass Bokeh models (e.g. a ``ColumnDataSource``) as keyword arguments to the functions. ...
[ "Create", "a", "CustomJSHover", "instance", "from", "a", "Python", "functions", ".", "The", "function", "is", "translated", "to", "JavaScript", "using", "PScript", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/models/tools.py#L882-L932
train
bokeh/bokeh
bokeh/models/tools.py
CustomJSHover.from_coffeescript
def from_coffeescript(cls, code, args={}): ''' Create a CustomJSHover instance from a CoffeeScript snippet. The function bodies are translated to JavaScript functions using node and therefore require return statements. The ``code`` snippet namespace will contain the variable ``value`` (...
python
def from_coffeescript(cls, code, args={}): ''' Create a CustomJSHover instance from a CoffeeScript snippet. The function bodies are translated to JavaScript functions using node and therefore require return statements. The ``code`` snippet namespace will contain the variable ``value`` (...
[ "def", "from_coffeescript", "(", "cls", ",", "code", ",", "args", "=", "{", "}", ")", ":", "compiled", "=", "nodejs_compile", "(", "code", ",", "lang", "=", "\"coffeescript\"", ",", "file", "=", "\"???\"", ")", "if", "\"error\"", "in", "compiled", ":", ...
Create a CustomJSHover instance from a CoffeeScript snippet. The function bodies are translated to JavaScript functions using node and therefore require return statements. The ``code`` snippet namespace will contain the variable ``value`` (the untransformed value) at render time as well...
[ "Create", "a", "CustomJSHover", "instance", "from", "a", "CoffeeScript", "snippet", ".", "The", "function", "bodies", "are", "translated", "to", "JavaScript", "functions", "using", "node", "and", "therefore", "require", "return", "statements", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/models/tools.py#L935-L962
train
bokeh/bokeh
bokeh/sphinxext/bokehjs_content.py
setup
def setup(app): ''' Required Sphinx extension setup function. ''' app.add_node( bokehjs_content, html=( html_visit_bokehjs_content, html_depart_bokehjs_content ) ) app.add_directive('bokehjs-content', BokehJSContent)
python
def setup(app): ''' Required Sphinx extension setup function. ''' app.add_node( bokehjs_content, html=( html_visit_bokehjs_content, html_depart_bokehjs_content ) ) app.add_directive('bokehjs-content', BokehJSContent)
[ "def", "setup", "(", "app", ")", ":", "app", ".", "add_node", "(", "bokehjs_content", ",", "html", "=", "(", "html_visit_bokehjs_content", ",", "html_depart_bokehjs_content", ")", ")", "app", ".", "add_directive", "(", "'bokehjs-content'", ",", "BokehJSContent", ...
Required Sphinx extension setup function.
[ "Required", "Sphinx", "extension", "setup", "function", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/sphinxext/bokehjs_content.py#L268-L277
train
bokeh/bokeh
bokeh/sphinxext/bokehjs_content.py
BokehJSContent.get_codeblock_node
def get_codeblock_node(self, code, language): """this is copied from sphinx.directives.code.CodeBlock.run it has been changed to accept code and language as an arguments instead of reading from self """ # type: () -> List[nodes.Node] document = self.state.document ...
python
def get_codeblock_node(self, code, language): """this is copied from sphinx.directives.code.CodeBlock.run it has been changed to accept code and language as an arguments instead of reading from self """ # type: () -> List[nodes.Node] document = self.state.document ...
[ "def", "get_codeblock_node", "(", "self", ",", "code", ",", "language", ")", ":", "# type: () -> List[nodes.Node]", "document", "=", "self", ".", "state", ".", "document", "location", "=", "self", ".", "state_machine", ".", "get_source_and_line", "(", "self", "....
this is copied from sphinx.directives.code.CodeBlock.run it has been changed to accept code and language as an arguments instead of reading from self
[ "this", "is", "copied", "from", "sphinx", ".", "directives", ".", "code", ".", "CodeBlock", ".", "run" ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/sphinxext/bokehjs_content.py#L117-L174
train
bokeh/bokeh
bokeh/sphinxext/bokehjs_content.py
BokehJSContent.get_code_language
def get_code_language(self): """ This is largely copied from bokeh.sphinxext.bokeh_plot.run """ js_source = self.get_js_source() if self.options.get("include_html", False): resources = get_sphinx_resources(include_bokehjs_api=True) html_source = BJS_HTML.r...
python
def get_code_language(self): """ This is largely copied from bokeh.sphinxext.bokeh_plot.run """ js_source = self.get_js_source() if self.options.get("include_html", False): resources = get_sphinx_resources(include_bokehjs_api=True) html_source = BJS_HTML.r...
[ "def", "get_code_language", "(", "self", ")", ":", "js_source", "=", "self", ".", "get_js_source", "(", ")", "if", "self", ".", "options", ".", "get", "(", "\"include_html\"", ",", "False", ")", ":", "resources", "=", "get_sphinx_resources", "(", "include_bo...
This is largely copied from bokeh.sphinxext.bokeh_plot.run
[ "This", "is", "largely", "copied", "from", "bokeh", ".", "sphinxext", ".", "bokeh_plot", ".", "run" ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/sphinxext/bokehjs_content.py#L196-L209
train
bokeh/bokeh
bokeh/embed/standalone.py
autoload_static
def autoload_static(model, resources, script_path): ''' Return JavaScript code and a script tag that can be used to embed Bokeh Plots. The data for the plot is stored directly in the returned JavaScript code. Args: model (Model or Document) : resources (Resources) : script_pa...
python
def autoload_static(model, resources, script_path): ''' Return JavaScript code and a script tag that can be used to embed Bokeh Plots. The data for the plot is stored directly in the returned JavaScript code. Args: model (Model or Document) : resources (Resources) : script_pa...
[ "def", "autoload_static", "(", "model", ",", "resources", ",", "script_path", ")", ":", "# TODO: maybe warn that it's not exactly useful, but technically possible", "# if resources.mode == 'inline':", "# raise ValueError(\"autoload_static() requires non-inline resources\")", "if", "i...
Return JavaScript code and a script tag that can be used to embed Bokeh Plots. The data for the plot is stored directly in the returned JavaScript code. Args: model (Model or Document) : resources (Resources) : script_path (str) : Returns: (js, tag) : Jav...
[ "Return", "JavaScript", "code", "and", "a", "script", "tag", "that", "can", "be", "used", "to", "embed", "Bokeh", "Plots", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/embed/standalone.py#L55-L109
train
bokeh/bokeh
bokeh/embed/standalone.py
components
def components(models, wrap_script=True, wrap_plot_info=True, theme=FromCurdoc): ''' Return HTML components to embed a Bokeh plot. The data for the plot is stored directly in the returned HTML. An example can be found in examples/embed/embed_multiple.py The returned components assume that BokehJS reso...
python
def components(models, wrap_script=True, wrap_plot_info=True, theme=FromCurdoc): ''' Return HTML components to embed a Bokeh plot. The data for the plot is stored directly in the returned HTML. An example can be found in examples/embed/embed_multiple.py The returned components assume that BokehJS reso...
[ "def", "components", "(", "models", ",", "wrap_script", "=", "True", ",", "wrap_plot_info", "=", "True", ",", "theme", "=", "FromCurdoc", ")", ":", "# 1) Convert single items and dicts into list", "was_single_object", "=", "isinstance", "(", "models", ",", "Model", ...
Return HTML components to embed a Bokeh plot. The data for the plot is stored directly in the returned HTML. An example can be found in examples/embed/embed_multiple.py The returned components assume that BokehJS resources are **already loaded**. The html template in which they will be embedded needs ...
[ "Return", "HTML", "components", "to", "embed", "a", "Bokeh", "plot", ".", "The", "data", "for", "the", "plot", "is", "stored", "directly", "in", "the", "returned", "HTML", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/embed/standalone.py#L111-L248
train
bokeh/bokeh
bokeh/embed/standalone.py
file_html
def file_html(models, resources, title=None, template=FILE, template_variables={}, theme=FromCurdoc, suppress_callback_warning=False, _always_new=False): ''' Return an HTML document that embeds Bokeh Model or Document ...
python
def file_html(models, resources, title=None, template=FILE, template_variables={}, theme=FromCurdoc, suppress_callback_warning=False, _always_new=False): ''' Return an HTML document that embeds Bokeh Model or Document ...
[ "def", "file_html", "(", "models", ",", "resources", ",", "title", "=", "None", ",", "template", "=", "FILE", ",", "template_variables", "=", "{", "}", ",", "theme", "=", "FromCurdoc", ",", "suppress_callback_warning", "=", "False", ",", "_always_new", "=", ...
Return an HTML document that embeds Bokeh Model or Document objects. The data for the plot is stored directly in the returned HTML, with support for customizing the JS/CSS resources independently and customizing the jinja2 template. Args: models (Model or Document or seq[Model]) : Bokeh object...
[ "Return", "an", "HTML", "document", "that", "embeds", "Bokeh", "Model", "or", "Document", "objects", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/embed/standalone.py#L250-L312
train
bokeh/bokeh
bokeh/embed/standalone.py
json_item
def json_item(model, target=None, theme=FromCurdoc): ''' Return a JSON block that can be used to embed standalone Bokeh content. Args: model (Model) : The Bokeh object to embed target (string, optional) A div id to embed the model into. If None, the target id must ...
python
def json_item(model, target=None, theme=FromCurdoc): ''' Return a JSON block that can be used to embed standalone Bokeh content. Args: model (Model) : The Bokeh object to embed target (string, optional) A div id to embed the model into. If None, the target id must ...
[ "def", "json_item", "(", "model", ",", "target", "=", "None", ",", "theme", "=", "FromCurdoc", ")", ":", "with", "OutputDocumentFor", "(", "[", "model", "]", ",", "apply_theme", "=", "theme", ")", "as", "doc", ":", "doc", ".", "title", "=", "\"\"", "...
Return a JSON block that can be used to embed standalone Bokeh content. Args: model (Model) : The Bokeh object to embed target (string, optional) A div id to embed the model into. If None, the target id must be supplied in the JavaScript call. theme (Th...
[ "Return", "a", "JSON", "block", "that", "can", "be", "used", "to", "embed", "standalone", "Bokeh", "content", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/embed/standalone.py#L314-L383
train
bokeh/bokeh
bokeh/protocol/messages/patch_doc.py
process_document_events
def process_document_events(events, use_buffers=True): ''' Create a JSON string describing a patch to be applied as well as any optional buffers. Args: events : list of events to be translated into patches Returns: str, list : JSON string which can be applied to make the given upda...
python
def process_document_events(events, use_buffers=True): ''' Create a JSON string describing a patch to be applied as well as any optional buffers. Args: events : list of events to be translated into patches Returns: str, list : JSON string which can be applied to make the given upda...
[ "def", "process_document_events", "(", "events", ",", "use_buffers", "=", "True", ")", ":", "json_events", "=", "[", "]", "references", "=", "set", "(", ")", "buffers", "=", "[", "]", "if", "use_buffers", "else", "None", "for", "event", "in", "events", "...
Create a JSON string describing a patch to be applied as well as any optional buffers. Args: events : list of events to be translated into patches Returns: str, list : JSON string which can be applied to make the given updates to obj as well as any optional buffers
[ "Create", "a", "JSON", "string", "describing", "a", "patch", "to", "be", "applied", "as", "well", "as", "any", "optional", "buffers", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/protocol/messages/patch_doc.py#L109-L136
train
bokeh/bokeh
bokeh/server/callbacks.py
PeriodicCallback._copy_with_changed_callback
def _copy_with_changed_callback(self, new_callback): ''' Dev API used to wrap the callback with decorators. ''' return PeriodicCallback(self._document, new_callback, self._period, self._id)
python
def _copy_with_changed_callback(self, new_callback): ''' Dev API used to wrap the callback with decorators. ''' return PeriodicCallback(self._document, new_callback, self._period, self._id)
[ "def", "_copy_with_changed_callback", "(", "self", ",", "new_callback", ")", ":", "return", "PeriodicCallback", "(", "self", ".", "_document", ",", "new_callback", ",", "self", ".", "_period", ",", "self", ".", "_id", ")" ]
Dev API used to wrap the callback with decorators.
[ "Dev", "API", "used", "to", "wrap", "the", "callback", "with", "decorators", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/server/callbacks.py#L139-L141
train
bokeh/bokeh
bokeh/server/callbacks.py
TimeoutCallback._copy_with_changed_callback
def _copy_with_changed_callback(self, new_callback): ''' Dev API used to wrap the callback with decorators. ''' return TimeoutCallback(self._document, new_callback, self._timeout, self._id)
python
def _copy_with_changed_callback(self, new_callback): ''' Dev API used to wrap the callback with decorators. ''' return TimeoutCallback(self._document, new_callback, self._timeout, self._id)
[ "def", "_copy_with_changed_callback", "(", "self", ",", "new_callback", ")", ":", "return", "TimeoutCallback", "(", "self", ".", "_document", ",", "new_callback", ",", "self", ".", "_timeout", ",", "self", ".", "_id", ")" ]
Dev API used to wrap the callback with decorators.
[ "Dev", "API", "used", "to", "wrap", "the", "callback", "with", "decorators", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/server/callbacks.py#L171-L173
train
bokeh/bokeh
bokeh/util/compiler.py
calc_cache_key
def calc_cache_key(custom_models): ''' Generate a key to cache a custom extension implementation with. There is no metadata other than the Model classes, so this is the only base to generate a cache key. We build the model keys from the list of ``model.full_name``. This is not ideal but possibly a...
python
def calc_cache_key(custom_models): ''' Generate a key to cache a custom extension implementation with. There is no metadata other than the Model classes, so this is the only base to generate a cache key. We build the model keys from the list of ``model.full_name``. This is not ideal but possibly a...
[ "def", "calc_cache_key", "(", "custom_models", ")", ":", "model_names", "=", "{", "model", ".", "full_name", "for", "model", "in", "custom_models", ".", "values", "(", ")", "}", "encoded_names", "=", "\",\"", ".", "join", "(", "sorted", "(", "model_names", ...
Generate a key to cache a custom extension implementation with. There is no metadata other than the Model classes, so this is the only base to generate a cache key. We build the model keys from the list of ``model.full_name``. This is not ideal but possibly a better solution can be found found later.
[ "Generate", "a", "key", "to", "cache", "a", "custom", "extension", "implementation", "with", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/util/compiler.py#L312-L324
train
bokeh/bokeh
bokeh/util/compiler.py
bundle_models
def bundle_models(models): """Create a bundle of selected `models`. """ custom_models = _get_custom_models(models) if custom_models is None: return None key = calc_cache_key(custom_models) bundle = _bundle_cache.get(key, None) if bundle is None: try: _bundle_cache[ke...
python
def bundle_models(models): """Create a bundle of selected `models`. """ custom_models = _get_custom_models(models) if custom_models is None: return None key = calc_cache_key(custom_models) bundle = _bundle_cache.get(key, None) if bundle is None: try: _bundle_cache[ke...
[ "def", "bundle_models", "(", "models", ")", ":", "custom_models", "=", "_get_custom_models", "(", "models", ")", "if", "custom_models", "is", "None", ":", "return", "None", "key", "=", "calc_cache_key", "(", "custom_models", ")", "bundle", "=", "_bundle_cache", ...
Create a bundle of selected `models`.
[ "Create", "a", "bundle", "of", "selected", "models", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/util/compiler.py#L328-L343
train
bokeh/bokeh
bokeh/util/compiler.py
_get_custom_models
def _get_custom_models(models): """Returns CustomModels for models with a custom `__implementation__`""" if models is None: models = Model.model_class_reverse_map.values() custom_models = OrderedDict() for cls in models: impl = getattr(cls, "__implementation__", None) if impl i...
python
def _get_custom_models(models): """Returns CustomModels for models with a custom `__implementation__`""" if models is None: models = Model.model_class_reverse_map.values() custom_models = OrderedDict() for cls in models: impl = getattr(cls, "__implementation__", None) if impl i...
[ "def", "_get_custom_models", "(", "models", ")", ":", "if", "models", "is", "None", ":", "models", "=", "Model", ".", "model_class_reverse_map", ".", "values", "(", ")", "custom_models", "=", "OrderedDict", "(", ")", "for", "cls", "in", "models", ":", "imp...
Returns CustomModels for models with a custom `__implementation__`
[ "Returns", "CustomModels", "for", "models", "with", "a", "custom", "__implementation__" ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/util/compiler.py#L501-L516
train
bokeh/bokeh
bokeh/util/compiler.py
_compile_models
def _compile_models(custom_models): """Returns the compiled implementation of supplied `models`. """ ordered_models = sorted(custom_models.values(), key=lambda model: model.full_name) custom_impls = {} dependencies = [] for model in ordered_models: dependencies.extend(list(model.dependencie...
python
def _compile_models(custom_models): """Returns the compiled implementation of supplied `models`. """ ordered_models = sorted(custom_models.values(), key=lambda model: model.full_name) custom_impls = {} dependencies = [] for model in ordered_models: dependencies.extend(list(model.dependencie...
[ "def", "_compile_models", "(", "custom_models", ")", ":", "ordered_models", "=", "sorted", "(", "custom_models", ".", "values", "(", ")", ",", "key", "=", "lambda", "model", ":", "model", ".", "full_name", ")", "custom_impls", "=", "{", "}", "dependencies", ...
Returns the compiled implementation of supplied `models`.
[ "Returns", "the", "compiled", "implementation", "of", "supplied", "models", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/util/compiler.py#L518-L542
train
bokeh/bokeh
bokeh/util/compiler.py
_bundle_models
def _bundle_models(custom_models): """ Create a JavaScript bundle with selected `models`. """ exports = [] modules = [] def read_json(name): with io.open(join(bokehjs_dir, "js", name + ".json"), encoding="utf-8") as f: return json.loads(f.read()) bundles = ["bokeh", "bokeh-api"...
python
def _bundle_models(custom_models): """ Create a JavaScript bundle with selected `models`. """ exports = [] modules = [] def read_json(name): with io.open(join(bokehjs_dir, "js", name + ".json"), encoding="utf-8") as f: return json.loads(f.read()) bundles = ["bokeh", "bokeh-api"...
[ "def", "_bundle_models", "(", "custom_models", ")", ":", "exports", "=", "[", "]", "modules", "=", "[", "]", "def", "read_json", "(", "name", ")", ":", "with", "io", ".", "open", "(", "join", "(", "bokehjs_dir", ",", "\"js\"", ",", "name", "+", "\".j...
Create a JavaScript bundle with selected `models`.
[ "Create", "a", "JavaScript", "bundle", "with", "selected", "models", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/util/compiler.py#L544-L634
train
bokeh/bokeh
bokeh/command/util.py
die
def die(message, status=1): ''' Print an error message and exit. This function will call ``sys.exit`` with the given ``status`` and the process will terminate. Args: message (str) : error message to print status (int) : the exit status to pass to ``sys.exit`` ''' print(messag...
python
def die(message, status=1): ''' Print an error message and exit. This function will call ``sys.exit`` with the given ``status`` and the process will terminate. Args: message (str) : error message to print status (int) : the exit status to pass to ``sys.exit`` ''' print(messag...
[ "def", "die", "(", "message", ",", "status", "=", "1", ")", ":", "print", "(", "message", ",", "file", "=", "sys", ".", "stderr", ")", "sys", ".", "exit", "(", "status", ")" ]
Print an error message and exit. This function will call ``sys.exit`` with the given ``status`` and the process will terminate. Args: message (str) : error message to print status (int) : the exit status to pass to ``sys.exit``
[ "Print", "an", "error", "message", "and", "exit", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/command/util.py#L52-L65
train
bokeh/bokeh
bokeh/command/util.py
build_single_handler_application
def build_single_handler_application(path, argv=None): ''' Return a Bokeh application built using a single handler for a script, notebook, or directory. In general a Bokeh :class:`~bokeh.application.application.Application` may have any number of handlers to initialize :class:`~bokeh.document.Document`...
python
def build_single_handler_application(path, argv=None): ''' Return a Bokeh application built using a single handler for a script, notebook, or directory. In general a Bokeh :class:`~bokeh.application.application.Application` may have any number of handlers to initialize :class:`~bokeh.document.Document`...
[ "def", "build_single_handler_application", "(", "path", ",", "argv", "=", "None", ")", ":", "argv", "=", "argv", "or", "[", "]", "path", "=", "os", ".", "path", ".", "abspath", "(", "path", ")", "# There are certainly race conditions here if the file/directory is ...
Return a Bokeh application built using a single handler for a script, notebook, or directory. In general a Bokeh :class:`~bokeh.application.application.Application` may have any number of handlers to initialize :class:`~bokeh.document.Document` objects for new client sessions. However, in many cases on...
[ "Return", "a", "Bokeh", "application", "built", "using", "a", "single", "handler", "for", "a", "script", "notebook", "or", "directory", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/command/util.py#L77-L139
train
bokeh/bokeh
bokeh/command/util.py
build_single_handler_applications
def build_single_handler_applications(paths, argvs=None): ''' Return a dictionary mapping routes to Bokeh applications built using single handlers, for specified files or directories. This function iterates over ``paths`` and ``argvs`` and calls :func:`~bokeh.command.util.build_single_handler_applicati...
python
def build_single_handler_applications(paths, argvs=None): ''' Return a dictionary mapping routes to Bokeh applications built using single handlers, for specified files or directories. This function iterates over ``paths`` and ``argvs`` and calls :func:`~bokeh.command.util.build_single_handler_applicati...
[ "def", "build_single_handler_applications", "(", "paths", ",", "argvs", "=", "None", ")", ":", "applications", "=", "{", "}", "argvs", "=", "{", "}", "or", "argvs", "for", "path", "in", "paths", ":", "application", "=", "build_single_handler_application", "(",...
Return a dictionary mapping routes to Bokeh applications built using single handlers, for specified files or directories. This function iterates over ``paths`` and ``argvs`` and calls :func:`~bokeh.command.util.build_single_handler_application` on each to generate the mapping. Args: path (...
[ "Return", "a", "dictionary", "mapping", "routes", "to", "Bokeh", "applications", "built", "using", "single", "handlers", "for", "specified", "files", "or", "directories", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/command/util.py#L141-L177
train
bokeh/bokeh
bokeh/command/util.py
report_server_init_errors
def report_server_init_errors(address=None, port=None, **kwargs): ''' A context manager to help print more informative error messages when a ``Server`` cannot be started due to a network problem. Args: address (str) : network address that the server will be listening on port (int) : networ...
python
def report_server_init_errors(address=None, port=None, **kwargs): ''' A context manager to help print more informative error messages when a ``Server`` cannot be started due to a network problem. Args: address (str) : network address that the server will be listening on port (int) : networ...
[ "def", "report_server_init_errors", "(", "address", "=", "None", ",", "port", "=", "None", ",", "*", "*", "kwargs", ")", ":", "try", ":", "yield", "except", "EnvironmentError", "as", "e", ":", "if", "e", ".", "errno", "==", "errno", ".", "EADDRINUSE", ...
A context manager to help print more informative error messages when a ``Server`` cannot be started due to a network problem. Args: address (str) : network address that the server will be listening on port (int) : network address that the server will be listening on Example: .. c...
[ "A", "context", "manager", "to", "help", "print", "more", "informative", "error", "messages", "when", "a", "Server", "cannot", "be", "started", "due", "to", "a", "network", "problem", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/command/util.py#L181-L212
train
bokeh/bokeh
examples/models/file/trail.py
distance
def distance(p1, p2): """Distance between (lat1, lon1) and (lat2, lon2). """ R = 6371 lat1, lon1 = p1 lat2, lon2 = p2 phi1 = radians(lat1) phi2 = radians(lat2) delta_lat = radians(lat2 - lat1) delta_lon = radians(lon2 - lon1) a = haversin(delta_lat) + cos(phi1) * cos(phi2) * haver...
python
def distance(p1, p2): """Distance between (lat1, lon1) and (lat2, lon2). """ R = 6371 lat1, lon1 = p1 lat2, lon2 = p2 phi1 = radians(lat1) phi2 = radians(lat2) delta_lat = radians(lat2 - lat1) delta_lon = radians(lon2 - lon1) a = haversin(delta_lat) + cos(phi1) * cos(phi2) * haver...
[ "def", "distance", "(", "p1", ",", "p2", ")", ":", "R", "=", "6371", "lat1", ",", "lon1", "=", "p1", "lat2", ",", "lon2", "=", "p2", "phi1", "=", "radians", "(", "lat1", ")", "phi2", "=", "radians", "(", "lat2", ")", "delta_lat", "=", "radians", ...
Distance between (lat1, lon1) and (lat2, lon2).
[ "Distance", "between", "(", "lat1", "lon1", ")", "and", "(", "lat2", "lon2", ")", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/examples/models/file/trail.py#L29-L42
train
bokeh/bokeh
bokeh/sphinxext/bokeh_plot.py
setup
def setup(app): ''' Required Sphinx extension setup function. ''' # These two are deprecated and no longer have any effect, to be removed 2.0 app.add_config_value('bokeh_plot_pyfile_include_dirs', [], 'html') app.add_config_value('bokeh_plot_use_relative_paths', False, 'html') app.add_directive('b...
python
def setup(app): ''' Required Sphinx extension setup function. ''' # These two are deprecated and no longer have any effect, to be removed 2.0 app.add_config_value('bokeh_plot_pyfile_include_dirs', [], 'html') app.add_config_value('bokeh_plot_use_relative_paths', False, 'html') app.add_directive('b...
[ "def", "setup", "(", "app", ")", ":", "# These two are deprecated and no longer have any effect, to be removed 2.0", "app", ".", "add_config_value", "(", "'bokeh_plot_pyfile_include_dirs'", ",", "[", "]", ",", "'html'", ")", "app", ".", "add_config_value", "(", "'bokeh_pl...
Required Sphinx extension setup function.
[ "Required", "Sphinx", "extension", "setup", "function", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/sphinxext/bokeh_plot.py#L212-L222
train
bokeh/bokeh
bokeh/server/util.py
bind_sockets
def bind_sockets(address, port): ''' Bind a socket to a port on an address. Args: address (str) : An address to bind a port on, e.g. ``"localhost"`` port (int) : A port number to bind. Pass 0 to have the OS automatically choose a free port. This functi...
python
def bind_sockets(address, port): ''' Bind a socket to a port on an address. Args: address (str) : An address to bind a port on, e.g. ``"localhost"`` port (int) : A port number to bind. Pass 0 to have the OS automatically choose a free port. This functi...
[ "def", "bind_sockets", "(", "address", ",", "port", ")", ":", "ss", "=", "netutil", ".", "bind_sockets", "(", "port", "=", "port", "or", "0", ",", "address", "=", "address", ")", "assert", "len", "(", "ss", ")", "ports", "=", "{", "s", ".", "getsoc...
Bind a socket to a port on an address. Args: address (str) : An address to bind a port on, e.g. ``"localhost"`` port (int) : A port number to bind. Pass 0 to have the OS automatically choose a free port. This function returns a 2-tuple with the new socket ...
[ "Bind", "a", "socket", "to", "a", "port", "on", "an", "address", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/server/util.py#L46-L73
train
bokeh/bokeh
bokeh/server/util.py
check_whitelist
def check_whitelist(host, whitelist): ''' Check a given request host against a whitelist. Args: host (str) : A host string to compare against a whitelist. If the host does not specify a port, then ``":80"`` is implicitly assumed. whitelist (seq[str]) : ...
python
def check_whitelist(host, whitelist): ''' Check a given request host against a whitelist. Args: host (str) : A host string to compare against a whitelist. If the host does not specify a port, then ``":80"`` is implicitly assumed. whitelist (seq[str]) : ...
[ "def", "check_whitelist", "(", "host", ",", "whitelist", ")", ":", "if", "':'", "not", "in", "host", ":", "host", "=", "host", "+", "':80'", "if", "host", "in", "whitelist", ":", "return", "True", "return", "any", "(", "match_host", "(", "host", ",", ...
Check a given request host against a whitelist. Args: host (str) : A host string to compare against a whitelist. If the host does not specify a port, then ``":80"`` is implicitly assumed. whitelist (seq[str]) : A list of host patterns to match again...
[ "Check", "a", "given", "request", "host", "against", "a", "whitelist", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/server/util.py#L75-L99
train
bokeh/bokeh
bokeh/server/util.py
match_host
def match_host(host, pattern): ''' Match a host string against a pattern Args: host (str) A hostname to compare to the given pattern pattern (str) A string representing a hostname pattern, possibly including wildcards for ip address octets or ports. Thi...
python
def match_host(host, pattern): ''' Match a host string against a pattern Args: host (str) A hostname to compare to the given pattern pattern (str) A string representing a hostname pattern, possibly including wildcards for ip address octets or ports. Thi...
[ "def", "match_host", "(", "host", ",", "pattern", ")", ":", "if", "':'", "in", "host", ":", "host", ",", "host_port", "=", "host", ".", "rsplit", "(", "':'", ",", "1", ")", "else", ":", "host_port", "=", "None", "if", "':'", "in", "pattern", ":", ...
Match a host string against a pattern Args: host (str) A hostname to compare to the given pattern pattern (str) A string representing a hostname pattern, possibly including wildcards for ip address octets or ports. This function will return ``True`` if the ...
[ "Match", "a", "host", "string", "against", "a", "pattern" ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/server/util.py#L164-L240
train
bokeh/bokeh
bokeh/io/state.py
State.notebook_type
def notebook_type(self, notebook_type): ''' Notebook type, acceptable values are 'jupyter' as well as any names defined by external notebook hooks that have been installed. ''' if notebook_type is None or not isinstance(notebook_type, string_types): raise ValueError("Noteboo...
python
def notebook_type(self, notebook_type): ''' Notebook type, acceptable values are 'jupyter' as well as any names defined by external notebook hooks that have been installed. ''' if notebook_type is None or not isinstance(notebook_type, string_types): raise ValueError("Noteboo...
[ "def", "notebook_type", "(", "self", ",", "notebook_type", ")", ":", "if", "notebook_type", "is", "None", "or", "not", "isinstance", "(", "notebook_type", ",", "string_types", ")", ":", "raise", "ValueError", "(", "\"Notebook type must be a string\"", ")", "self",...
Notebook type, acceptable values are 'jupyter' as well as any names defined by external notebook hooks that have been installed.
[ "Notebook", "type", "acceptable", "values", "are", "jupyter", "as", "well", "as", "any", "names", "defined", "by", "external", "notebook", "hooks", "that", "have", "been", "installed", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/io/state.py#L124-L131
train
bokeh/bokeh
bokeh/io/state.py
State.output_file
def output_file(self, filename, title="Bokeh Plot", mode="cdn", root_dir=None): ''' Configure output to a standalone HTML file. Calling ``output_file`` not clear the effects of any other calls to ``output_notebook``, etc. It adds an additional output destination (publishing to HTML file...
python
def output_file(self, filename, title="Bokeh Plot", mode="cdn", root_dir=None): ''' Configure output to a standalone HTML file. Calling ``output_file`` not clear the effects of any other calls to ``output_notebook``, etc. It adds an additional output destination (publishing to HTML file...
[ "def", "output_file", "(", "self", ",", "filename", ",", "title", "=", "\"Bokeh Plot\"", ",", "mode", "=", "\"cdn\"", ",", "root_dir", "=", "None", ")", ":", "self", ".", "_file", "=", "{", "'filename'", ":", "filename", ",", "'resources'", ":", "Resourc...
Configure output to a standalone HTML file. Calling ``output_file`` not clear the effects of any other calls to ``output_notebook``, etc. It adds an additional output destination (publishing to HTML files). Any other active output modes continue to be active. Args: ...
[ "Configure", "output", "to", "a", "standalone", "HTML", "file", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/io/state.py#L135-L171
train
bokeh/bokeh
bokeh/io/saving.py
save
def save(obj, filename=None, resources=None, title=None, template=None, state=None, **kwargs): ''' Save an HTML file with the data for the current document. Will fall back to the default output state (or an explicitly provided :class:`State` object) for ``filename``, ``resources``, or ``title`` if they ...
python
def save(obj, filename=None, resources=None, title=None, template=None, state=None, **kwargs): ''' Save an HTML file with the data for the current document. Will fall back to the default output state (or an explicitly provided :class:`State` object) for ``filename``, ``resources``, or ``title`` if they ...
[ "def", "save", "(", "obj", ",", "filename", "=", "None", ",", "resources", "=", "None", ",", "title", "=", "None", ",", "template", "=", "None", ",", "state", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "state", "is", "None", ":", "stat...
Save an HTML file with the data for the current document. Will fall back to the default output state (or an explicitly provided :class:`State` object) for ``filename``, ``resources``, or ``title`` if they are not provided. If the filename is not given and not provided via output state, it is derived fr...
[ "Save", "an", "HTML", "file", "with", "the", "data", "for", "the", "current", "document", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/io/saving.py#L50-L87
train
bokeh/bokeh
bokeh/sphinxext/bokeh_sitemap.py
html_page_context
def html_page_context(app, pagename, templatename, context, doctree): ''' Collect page names for the sitemap as HTML pages are built. ''' site = context['SITEMAP_BASE_URL'] version = context['version'] app.sitemap_links.add(site + version + '/' + pagename + ".html")
python
def html_page_context(app, pagename, templatename, context, doctree): ''' Collect page names for the sitemap as HTML pages are built. ''' site = context['SITEMAP_BASE_URL'] version = context['version'] app.sitemap_links.add(site + version + '/' + pagename + ".html")
[ "def", "html_page_context", "(", "app", ",", "pagename", ",", "templatename", ",", "context", ",", "doctree", ")", ":", "site", "=", "context", "[", "'SITEMAP_BASE_URL'", "]", "version", "=", "context", "[", "'version'", "]", "app", ".", "sitemap_links", "."...
Collect page names for the sitemap as HTML pages are built.
[ "Collect", "page", "names", "for", "the", "sitemap", "as", "HTML", "pages", "are", "built", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/sphinxext/bokeh_sitemap.py#L58-L64
train
bokeh/bokeh
bokeh/sphinxext/bokeh_sitemap.py
build_finished
def build_finished(app, exception): ''' Generate a ``sitemap.txt`` from the collected HTML page links. ''' filename = join(app.outdir, "sitemap.txt") links_iter = status_iterator(sorted(app.sitemap_links), 'adding links to sitemap... ', ...
python
def build_finished(app, exception): ''' Generate a ``sitemap.txt`` from the collected HTML page links. ''' filename = join(app.outdir, "sitemap.txt") links_iter = status_iterator(sorted(app.sitemap_links), 'adding links to sitemap... ', ...
[ "def", "build_finished", "(", "app", ",", "exception", ")", ":", "filename", "=", "join", "(", "app", ".", "outdir", ",", "\"sitemap.txt\"", ")", "links_iter", "=", "status_iterator", "(", "sorted", "(", "app", ".", "sitemap_links", ")", ",", "'adding links ...
Generate a ``sitemap.txt`` from the collected HTML page links.
[ "Generate", "a", "sitemap", ".", "txt", "from", "the", "collected", "HTML", "page", "links", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/sphinxext/bokeh_sitemap.py#L66-L83
train
bokeh/bokeh
bokeh/sphinxext/bokeh_sitemap.py
setup
def setup(app): ''' Required Sphinx extension setup function. ''' app.connect('html-page-context', html_page_context) app.connect('build-finished', build_finished) app.sitemap_links = set()
python
def setup(app): ''' Required Sphinx extension setup function. ''' app.connect('html-page-context', html_page_context) app.connect('build-finished', build_finished) app.sitemap_links = set()
[ "def", "setup", "(", "app", ")", ":", "app", ".", "connect", "(", "'html-page-context'", ",", "html_page_context", ")", "app", ".", "connect", "(", "'build-finished'", ",", "build_finished", ")", "app", ".", "sitemap_links", "=", "set", "(", ")" ]
Required Sphinx extension setup function.
[ "Required", "Sphinx", "extension", "setup", "function", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/sphinxext/bokeh_sitemap.py#L85-L89
train
bokeh/bokeh
bokeh/server/tornado.py
BokehTornado.initialize
def initialize(self, io_loop): ''' Start a Bokeh Server Tornado Application on a given Tornado IOLoop. ''' self._loop = io_loop for app_context in self._applications.values(): app_context._loop = self._loop self._clients = set() self._stats_job = PeriodicC...
python
def initialize(self, io_loop): ''' Start a Bokeh Server Tornado Application on a given Tornado IOLoop. ''' self._loop = io_loop for app_context in self._applications.values(): app_context._loop = self._loop self._clients = set() self._stats_job = PeriodicC...
[ "def", "initialize", "(", "self", ",", "io_loop", ")", ":", "self", ".", "_loop", "=", "io_loop", "for", "app_context", "in", "self", ".", "_applications", ".", "values", "(", ")", ":", "app_context", ".", "_loop", "=", "self", ".", "_loop", "self", "....
Start a Bokeh Server Tornado Application on a given Tornado IOLoop.
[ "Start", "a", "Bokeh", "Server", "Tornado", "Application", "on", "a", "given", "Tornado", "IOLoop", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/server/tornado.py#L319-L346
train
bokeh/bokeh
bokeh/server/tornado.py
BokehTornado.resources
def resources(self, absolute_url=None): ''' Provide a :class:`~bokeh.resources.Resources` that specifies where Bokeh application sessions should load BokehJS resources from. Args: absolute_url (bool): An absolute URL prefix to use for locating resources. If None, ...
python
def resources(self, absolute_url=None): ''' Provide a :class:`~bokeh.resources.Resources` that specifies where Bokeh application sessions should load BokehJS resources from. Args: absolute_url (bool): An absolute URL prefix to use for locating resources. If None, ...
[ "def", "resources", "(", "self", ",", "absolute_url", "=", "None", ")", ":", "if", "absolute_url", ":", "return", "Resources", "(", "mode", "=", "\"server\"", ",", "root_url", "=", "absolute_url", "+", "self", ".", "_prefix", ",", "path_versioner", "=", "S...
Provide a :class:`~bokeh.resources.Resources` that specifies where Bokeh application sessions should load BokehJS resources from. Args: absolute_url (bool): An absolute URL prefix to use for locating resources. If None, relative URLs are used (default: None)
[ "Provide", "a", ":", "class", ":", "~bokeh", ".", "resources", ".", "Resources", "that", "specifies", "where", "Bokeh", "application", "sessions", "should", "load", "BokehJS", "resources", "from", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/server/tornado.py#L411-L423
train