_id stringlengths 2 7 | title stringlengths 1 88 | partition stringclasses 3
values | text stringlengths 31 13.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q246600 | Client.transform_external | train | def transform_external(self, external_url):
"""
Turns an external URL into a Filestack Transform object
*returns* [Filestack.Transform]
```python
from filestack import Client, Filelink
client = Client("API_KEY")
| python | {
"resource": ""
} |
q246601 | Client.urlscreenshot | train | def urlscreenshot(self, external_url, agent=None, mode=None, width=None, height=None, delay=None):
"""
Takes a 'screenshot' of the given URL
*returns* [Filestack.Transform]
```python
from filestack import Client
client = Client("API_KEY")
# returns a Transform ... | python | {
"resource": ""
} |
q246602 | Client.zip | train | def zip(self, destination_path, files):
"""
Takes array of files and downloads a compressed ZIP archive
to provided path
*returns* [requests.response]
```python
from filestack import Client
client = Client("<API_KEY>")
client.zip('/path/to/file/destinat... | python | {
"resource": ""
} |
q246603 | Transform.url | train | def url(self):
"""
Returns the URL for the current transformation, which can be used
to retrieve the file. If security is enabled, signature and policy parameters will
be included
*returns* [String]
```python
transform = client.upload(filepath='/path/to/file')
... | python | {
"resource": ""
} |
q246604 | Transform.store | train | def store(self, filename=None, location=None, path=None, container=None, region=None, access=None, base64decode=None):
"""
Uploads and stores the current transformation as a Fileink
*returns* [Filestack.Filelink]
```python
filelink = transform.store()
```
"""
... | python | {
"resource": ""
} |
q246605 | Transform.debug | train | def debug(self):
"""
Returns a JSON object with inforamtion regarding the current transformation
*returns* [Dict]
"""
| python | {
"resource": ""
} |
q246606 | real_python3 | train | def real_python3(python, version_dict):
"""
Determine the path of the real python executable, which is then used for
venv creation. This is necessary, because an active virtualenv environment
will cause venv creation to malfunction. By getting the path of the real
executable, this issue is bypassed.... | python | {
"resource": ""
} |
q246607 | today | train | def today(year=None):
"""this day, last year"""
return | python | {
"resource": ""
} |
q246608 | tomorrow | train | def tomorrow(date=None):
"""tomorrow is another day"""
if not date:
return _date + datetime.timedelta(days=1)
else:
current_date = | python | {
"resource": ""
} |
q246609 | yesterday | train | def yesterday(date=None):
"""yesterday once more"""
if not date:
return _date - | python | {
"resource": ""
} |
q246610 | days_range | train | def days_range(first=None, second=None, wipe=False):
"""
get all days between first and second
:param first: datetime, date or string
:param second: datetime, date or string
:param wipe: boolean, excludes first and last date from range when True. Default is False.
:return: list
"""
_fir... | python | {
"resource": ""
} |
q246611 | BugManager.is_installed | train | def is_installed(self, bug: Bug) -> bool:
"""
Determines whether the Docker image for a given bug has been installed
on the server.
"""
r = self.__api.get('bugs/{}/installed'.format(bug.name))
| python | {
"resource": ""
} |
q246612 | BugManager.uninstall | train | def uninstall(self, bug: Bug) -> bool:
"""
Uninstalls the Docker image associated with a given bug.
"""
| python | {
"resource": ""
} |
q246613 | BugManager.build | train | def build(self, bug: Bug):
"""
Instructs the server to build the Docker image associated with a given
bug.
"""
r = self.__api.post('bugs/{}/build'.format(bug.name))
if r.status_code == 204:
return
if r.status_code == 200:
raise Exception("... | python | {
"resource": ""
} |
q246614 | SourceManager.refresh | train | def refresh(self) -> None:
"""
Reloads all sources that are registered with this server.
"""
logger.info('refreshing sources')
for source in list(self):
self.unload(source)
if not os.path.exists(self.__registry_fn):
| python | {
"resource": ""
} |
q246615 | SourceManager.update | train | def update(self) -> None:
"""
Ensures that all remote sources are up-to-date.
"""
for source_old in self:
if isinstance(source_old, RemoteSource):
repo = git.Repo(source_old.location)
origin = repo.remotes.origin
origin.pull()
... | python | {
"resource": ""
} |
q246616 | SourceManager.save | train | def save(self) -> None:
"""
Saves the contents of the source manager to disk.
"""
logger.info('saving registry to: %s', self.__registry_fn)
| python | {
"resource": ""
} |
q246617 | SourceManager.unload | train | def unload(self, source: Source) -> None:
"""
Unloads a registered source, causing all of its associated bugs, tools,
and blueprints to also be unloaded. If the given source is not loaded,
this function will do nothing.
"""
logger.info('unloading source: %s', source.name)... | python | {
"resource": ""
} |
q246618 | SourceManager.add | train | def add(self, name: str, path_or_url: str) -> Source:
"""
Attempts to register a source provided by a given URL or local path
under a given name.
Returns:
a description of the registered source.
Raises:
NameInUseError: if an existing source is already re... | python | {
"resource": ""
} |
q246619 | SourceManager.remove | train | def remove(self, source: Source) -> None:
"""
Unregisters a given source with this server. If the given source is a
remote source, then its local copy will be removed from disk.
Raises:
KeyError: if the given source is not registered with this server.
| python | {
"resource": ""
} |
q246620 | BugManager.is_installed | train | def is_installed(self, bug: Bug) -> bool:
"""
Determines whether or not the Docker image for a given bug has been
installed onto this server.
| python | {
"resource": ""
} |
q246621 | BugManager.build | train | def build(self,
bug: Bug,
force: bool = True,
quiet: bool = False
) -> None:
"""
Builds the Docker image | python | {
"resource": ""
} |
q246622 | BugManager.uninstall | train | def uninstall(self,
bug: Bug,
force: bool = False,
noprune: bool = False
) -> None:
"""
Uninstalls all Docker | python | {
"resource": ""
} |
q246623 | BugManager.validate | train | def validate(self, bug: Bug, verbose: bool = True) -> bool:
"""
Checks that a given bug successfully builds, and that it produces an
expected set of test suite outcomes.
Parameters:
verbose: toggles verbosity of output. If set to `True`, the
outcomes of each ... | python | {
"resource": ""
} |
q246624 | BugManager.coverage | train | def coverage(self, bug: Bug) -> TestSuiteCoverage:
"""
Provides coverage information for each test within the test suite
for the program associated with this bug.
Parameters:
bug: the bug for which to compute coverage.
Returns:
a test suite coverage repo... | python | {
"resource": ""
} |
q246625 | ContainerManager.clear | train | def clear(self) -> None:
"""
Closes all running containers.
"""
logger.debug("clearing all running containers")
all_uids = [uid for uid in self.__containers.keys()]
for uid in all_uids:
try:
| python | {
"resource": ""
} |
q246626 | ContainerManager.bug | train | def bug(self, container: Container) -> Bug:
"""
Returns a description of the bug inside a given container.
"""
| python | {
"resource": ""
} |
q246627 | ContainerManager.mktemp | train | def mktemp(self, container: Container) -> str:
"""
Creates a named temporary file within a given container.
Returns:
the absolute path to the created temporary file.
"""
logger.debug("creating a temporary file inside container %s",
container.uid)... | python | {
"resource": ""
} |
q246628 | ContainerManager.is_alive | train | def is_alive(self, container: Container) -> bool:
"""
Determines whether a given container is still alive.
Returns:
`True` if the underlying Docker container for the given BugZoo
container is still alive, otherwise `False`.
"""
| python | {
"resource": ""
} |
q246629 | ContainerManager.coverage_extractor | train | def coverage_extractor(self, container: Container) -> CoverageExtractor:
"""
Retrieves the coverage extractor for a given container.
"""
| python | {
"resource": ""
} |
q246630 | ContainerManager.coverage | train | def coverage(self,
container: Container,
tests: Optional[Iterable[TestCase]] = None,
*,
instrument: bool = True
) -> TestSuiteCoverage:
"""
Computes line coverage information over a provided set of tests for
the... | python | {
"resource": ""
} |
q246631 | ContainerManager.execute | train | def execute(self,
container: Container,
test: TestCase,
verbose: bool = False
) -> TestOutcome:
"""
Runs a specified test inside a given container.
Returns:
the outcome of the test execution.
"""
bug = s... | python | {
"resource": ""
} |
q246632 | ContainerManager.compile_with_instrumentation | train | def compile_with_instrumentation(self,
container: Container,
verbose: bool = False
) -> CompilationOutcome:
"""
Attempts to compile the program inside a given container with
| python | {
"resource": ""
} |
q246633 | ContainerManager.copy_to | train | def copy_to(self,
container: Container,
fn_host: str,
fn_container: str
) -> None:
"""
Copies a file from the host machine to a specified location inside a
container.
Raises:
FileNotFound: if the host file wasn'... | python | {
"resource": ""
} |
q246634 | ContainerManager.copy_from | train | def copy_from(self,
container: Container,
fn_container: str,
fn_host: str
) -> None:
"""
Copies a given file from the container to a specified location on the
host machine.
"""
logger.debug("Copying file from... | python | {
"resource": ""
} |
q246635 | ContainerManager.command | train | def command(self,
container: Container,
cmd: str,
context: Optional[str] = None,
stdout: bool = True,
stderr: bool = False,
block: bool = True,
verbose: bool = False,
time_limit: Optional[int]... | python | {
"resource": ""
} |
q246636 | ContainerManager.persist | train | def persist(self, container: Container, image: str) -> None:
"""
Persists the state of a given container to a BugZoo image on this
server.
Parameters:
container: the container to persist.
image: the name of the Docker image that should be created.
Raises... | python | {
"resource": ""
} |
q246637 | ephemeral | train | def ephemeral(*,
port: int = 6060,
timeout_connection: int = 30,
verbose: bool = False
) -> Iterator[Client]:
"""
Launches an ephemeral server instance that will be immediately
close when no longer in context.
Parameters:
port: the port th... | python | {
"resource": ""
} |
q246638 | register | train | def register(name: str):
"""
Registers a coverage extractor class under a given name.
.. code: python
from bugzoo.mgr.coverage import CoverageExtractor, register
@register('mycov')
class MyCoverageExtractor(CoverageExtractor):
...
| python | {
"resource": ""
} |
q246639 | register_as_default | train | def register_as_default(language: Language):
"""
Registers a coverage extractor class as the default coverage extractor
for a given language. Requires that the coverage extractor class has
already been registered with a given name.
.. code: python
from bugzoo.core import Language
f... | python | {
"resource": ""
} |
q246640 | CoverageExtractor.build | train | def build(installation: 'BugZoo',
container: Container
) -> 'CoverageExtractor':
"""
Constructs a CoverageExtractor for a given container using the coverage
instructions provided by its accompanying bug description.
"""
bug = installation.bugs[containe... | python | {
"resource": ""
} |
q246641 | CoverageExtractor.run | train | def run(self,
tests: Iterable[TestCase],
*,
instrument: bool = True
) -> TestSuiteCoverage:
"""
Computes line coverage information for a given set of tests.
Parameters:
tests: the tests for which coverage should be computed.
... | python | {
"resource": ""
} |
q246642 | BugZooException.from_dict | train | def from_dict(d: Dict[str, Any]) -> 'BugZooException':
"""
Reconstructs a BugZoo exception from a dictionary-based description.
"""
assert 'error' in d
d = d['error']
cls = getattr(sys.modules[__name__], d['kind'])
assert | python | {
"resource": ""
} |
q246643 | BugZooException.from_message_and_data | train | def from_message_and_data(cls,
message: str,
data: Dict[str, Any]
) -> 'BugZooException':
"""
| python | {
"resource": ""
} |
q246644 | BugZooException.to_dict | train | def to_dict(self) -> Dict[str, Any]:
"""
Creates a dictionary-based description of this exception, ready to be
serialised as JSON or YAML.
"""
jsn = {
'kind': self.__class__.__name__,
| python | {
"resource": ""
} |
q246645 | Hunk._read_next | train | def _read_next(cls, lines: List[str]) -> 'Hunk':
"""
Constructs a hunk from a supplied fragment of a unified format diff.
"""
header = lines[0]
assert header.startswith('@@ -')
# sometimes the first line can occur on the same line as the header.
# in that case, w... | python | {
"resource": ""
} |
q246646 | FilePatch._read_next | train | def _read_next(cls, lines: List[str]) -> 'FilePatch':
"""
Destructively extracts the next file patch from the line buffer.
"""
# keep munching lines until we hit one starting with '---'
while True:
if not lines:
raise Exception("illegal file patch form... | python | {
"resource": ""
} |
q246647 | Patch.from_unidiff | train | def from_unidiff(cls, diff: str) -> 'Patch':
"""
Constructs a Patch from a provided unified format diff.
"""
lines = diff.split('\n')
file_patches = []
while lines:
if lines[0] == '' | python | {
"resource": ""
} |
q246648 | ContainerManager.clear | train | def clear(self) -> None:
"""
Destroys all running containers.
"""
r = self.__api.delete('containers')
| python | {
"resource": ""
} |
q246649 | ContainerManager.provision | train | def provision(self,
bug: Bug,
*,
plugins: Optional[List[Tool]] = None
) -> Container:
"""
Provisions a container for a given bug.
"""
if plugins is None:
plugins = []
logger.info("provisioning co... | python | {
"resource": ""
} |
q246650 | ContainerManager.mktemp | train | def mktemp(self, container: Container) -> str:
"""
Generates a temporary file for a given container.
Returns:
the path to the temporary file inside the given container.
"""
| python | {
"resource": ""
} |
q246651 | ContainerManager.is_alive | train | def is_alive(self, container: Container) -> bool:
"""
Determines whether or not a given container is still alive.
"""
uid = container.uid
r = self.__api.get('containers/{}/alive'.format(uid))
if r.status_code == 200:
return r.json()
| python | {
"resource": ""
} |
q246652 | ContainerManager.extract_coverage | train | def extract_coverage(self, container: Container) -> FileLineSet:
"""
Extracts a report of the lines that have been executed since the last
time that a coverage report was | python | {
"resource": ""
} |
q246653 | ContainerManager.instrument | train | def instrument(self,
container: Container
) -> None:
"""
Instruments the program inside the container for computing test suite
coverage.
Params:
container: the container that should be instrumented.
"""
path = "containers... | python | {
"resource": ""
} |
q246654 | ContainerManager.coverage | train | def coverage(self,
container: Container,
*,
instrument: bool = True
) -> TestSuiteCoverage:
"""
Computes complete test suite coverage for a given container.
Parameters:
container: the container for which coverage sh... | python | {
"resource": ""
} |
q246655 | ContainerManager.exec | train | def exec(self,
container: Container,
command: str,
context: Optional[str] = None,
stdout: bool = True,
stderr: bool = False,
time_limit: Optional[int] = None
) -> ExecResponse:
"""
Executes a given command inside ... | python | {
"resource": ""
} |
q246656 | ContainerManager.persist | train | def persist(self, container: Container, image_name: str) -> None:
"""
Persists the state of a given container as a Docker image on the
server.
Parameters:
container: the container that should be persisted.
image_name: the name of the Docker image that should be c... | python | {
"resource": ""
} |
q246657 | SimpleCompiler.from_dict | train | def from_dict(d: dict) -> 'SimpleCompiler':
"""
Loads a SimpleCompiler from its dictionary-based description.
"""
cmd = d['command']
cmd_with_instrumentation = d.get('command_with_instrumentation', None)
time_limit = d['time-limit']
| python | {
"resource": ""
} |
q246658 | get_tags | train | def get_tags(doc):
'''
Get tags from a DOM tree
:param doc: lxml parsed object
:return:
'''
tags = list()
for el in doc.getroot().iter():
if isinstance(el, lxml.html.HtmlElement):
tags.append(el.tag)
elif isinstance(el, lxml.html.HtmlComment):
| python | {
"resource": ""
} |
q246659 | APIClient._url | train | def _url(self, path: str) -> str:
"""
Computes the URL for a resource located at a given path on the server.
"""
| python | {
"resource": ""
} |
q246660 | APIClient.handle_erroneous_response | train | def handle_erroneous_response(self,
response: requests.Response
) -> NoReturn:
"""
Attempts to decode an erroneous response into an exception, and to
subsequently throw that exception.
Raises:
BugZooExceptio... | python | {
"resource": ""
} |
q246661 | DockerManager.has_image | train | def has_image(self, name: str) -> bool:
"""
Determines whether the server has a Docker image with a given name.
"""
path = "docker/images/{}".format(name)
r = self.__api.head(path)
if r.status_code == 204:
| python | {
"resource": ""
} |
q246662 | DockerManager.delete_image | train | def delete_image(self, name: str) -> None:
"""
Deletes a Docker image with a given name.
Parameters:
name: the name of the Docker image.
"""
logger.debug("deleting Docker image: %s", name)
path = "docker/images/{}".format(name)
response = self.__api.d... | python | {
"resource": ""
} |
q246663 | FileManager._file_path | train | def _file_path(self, container: Container, fn: str) -> str:
"""
Computes the base path for a given file.
"""
fn = self.resolve(container, fn)
assert fn[0] == '/'
| python | {
"resource": ""
} |
q246664 | FileManager.write | train | def write(self,
container: Container,
filepath: str,
contents: str
) -> None:
"""
Dumps the contents of a given string into a file at a specified
location inside the container.
Parameters:
container: the container to wh... | python | {
"resource": ""
} |
q246665 | FileManager.read | train | def read(self, container: Container, filepath: str) -> str:
"""
Attempts to retrieve the contents of a given file in a running
container.
Parameters:
container: the container from which the file should be fetched.
filepath: the path to the file. If a relative pat... | python | {
"resource": ""
} |
q246666 | style_similarity | train | def style_similarity(page1, page2):
"""
Computes CSS style Similarity between two DOM trees
A = classes(Document_1)
B = classes(Document_2)
style_similarity = |A & B| / (|A| + |B| - |A & B|)
:param page1: html of the page1
:param page2: html of the page2
:return: Number between 0 and ... | python | {
"resource": ""
} |
q246667 | Spectra.restricted_to_files | train | def restricted_to_files(self,
filenames: List[str]
) -> 'Spectra':
"""
Returns a variant of this spectra that only contains entries for
lines that appear in any of the files whose name appear in the
given list.
"""
t... | python | {
"resource": ""
} |
q246668 | FileLineSet.filter | train | def filter(self,
predicate: Callable[[FileLine], 'FileLineSet']
) -> 'FileLineSet':
"""
Returns a subset of the file lines within this set that satisfy a given
filtering criterion.
"""
| python | {
"resource": ""
} |
q246669 | FileLineSet.union | train | def union(self, other: 'FileLineSet') -> 'FileLineSet':
"""
Returns a set of file lines that contains the union of the lines within
this set and a given set.
"""
# this isn't the most efficient implementation, but frankly, it doesn't
# need to be.
| python | {
"resource": ""
} |
q246670 | FileLineSet.intersection | train | def intersection(self, other: 'FileLineSet') -> 'FileLineSet':
"""
Returns a set of file lines that contains the intersection of the lines
within this set and a given set.
"""
assert isinstance(other, FileLineSet)
set_self = | python | {
"resource": ""
} |
q246671 | ToolManager.provision | train | def provision(self, tool: Tool) -> docker.models.containers.Container:
"""
Provisions a mountable Docker container for a given tool.
"""
if not self.is_installed(tool):
raise Exception("tool is not | python | {
"resource": ""
} |
q246672 | ToolManager.is_installed | train | def is_installed(self, tool: Tool) -> bool:
"""
Determines whether or not the Docker image for a given tool has been
installed onto this server.
| python | {
"resource": ""
} |
q246673 | ToolManager.build | train | def build(self,
tool: Tool,
force: bool = False,
quiet: bool = False
) -> None:
"""
Builds the Docker image | python | {
"resource": ""
} |
q246674 | ToolManager.uninstall | train | def uninstall(self,
tool: Tool,
force: bool = False,
noprune: bool = False
) -> None:
"""
Uninstalls all Docker | python | {
"resource": ""
} |
q246675 | RemoteSource.to_dict | train | def to_dict(self) -> Dict[str, str]:
"""
Produces a dictionary-based description of this source.
"""
return {
'type': 'remote',
'name': self.name, | python | {
"resource": ""
} |
q246676 | BuildManager.is_installed | train | def is_installed(self, name: str) -> bool:
"""
Indicates a given Docker image is installed on this server.
Parameters:
name: the name of the Docker image.
Returns:
`True` if installed; `False` if not.
| python | {
"resource": ""
} |
q246677 | BuildManager.build | train | def build(self,
name: str,
force: bool = False,
quiet: bool = False
) -> None:
"""
Constructs a Docker image, given by its name, using the set of build
instructions associated with that image.
Parameters:
name: the name... | python | {
"resource": ""
} |
q246678 | BuildManager.uninstall | train | def uninstall(self,
name: str,
force: bool = False,
noprune: bool = False
) -> None:
"""
Attempts to uninstall a given Docker image.
Parameters:
name: the name of the Docker image.
force: a flag indi... | python | {
"resource": ""
} |
q246679 | BuildManager.upload | train | def upload(self, name: str) -> bool:
"""
Attempts to upload a given Docker image from this server to DockerHub.
Parameters:
name: the name of the Docker image.
Returns:
`True` if successfully uploaded, otherwise `False`.
"""
try:
out ... | python | {
"resource": ""
} |
q246680 | printflush | train | def printflush(s: str, end: str = '\n') -> None:
"""
Prints a given | python | {
"resource": ""
} |
q246681 | CoverageInstructions.from_dict | train | def from_dict(d: Dict[str, Any]) -> 'CoverageInstructions':
"""
Loads a set of coverage instructions from a given dictionary.
Raises:
BadCoverageInstructions: if the given coverage instructions are
illegal. | python | {
"resource": ""
} |
q246682 | object_deserializer | train | def object_deserializer(obj):
"""Helper to deserialize a raw result dict into a proper dict.
:param obj: The dict.
"""
for key, val in obj.items():
if isinstance(val, six.string_types) and DATETIME_REGEX.search(val):
try:
| python | {
"resource": ""
} |
q246683 | login | train | def login(session, user, password, database=None, server=None):
"""Logs into a MyGeotab server and stores the returned credentials.
:param session: The current Session object.
:param user: The username used for MyGeotab servers. Usually an email address.
:param password: The password associated with th... | python | {
"resource": ""
} |
q246684 | sessions | train | def sessions(session):
"""Shows the current logged in sessions.
:param session: The current Session object.
"""
active_sessions = session.get_sessions()
if not active_sessions:
click.echo('(No | python | {
"resource": ""
} |
q246685 | console | train | def console(session, database=None, user=None, password=None, server=None):
"""An interactive Python API console for MyGeotab
If IPython is installed, it will launch an interactive IPython console instead of the built-in Python console. The
IPython console has numerous advantages over the stock Python cons... | python | {
"resource": ""
} |
q246686 | run | train | def run(*tasks: Awaitable, loop: asyncio.AbstractEventLoop=asyncio.get_event_loop()):
"""Helper to run tasks in the event loop
:param tasks: Tasks to run in the event loop.
:param loop: The event loop.
| python | {
"resource": ""
} |
q246687 | server_call_async | train | async def server_call_async(method, server, loop: asyncio.AbstractEventLoop=asyncio.get_event_loop(), timeout=DEFAULT_TIMEOUT,
verify_ssl=True, **parameters):
"""Makes an asynchronous call to an un-authenticated method on a server.
:param method: The method name.
:param server: The My... | python | {
"resource": ""
} |
q246688 | _query | train | async def _query(server, method, parameters, timeout=DEFAULT_TIMEOUT, verify_ssl=True,
loop: asyncio.AbstractEventLoop=None):
"""Formats and performs the asynchronous query against the API
:param server: The server to query.
:param method: The method name.
:param parameters: A dict of ... | python | {
"resource": ""
} |
q246689 | API.call_async | train | async def call_async(self, method, **parameters):
"""Makes an async call to the API.
:param method: The method name.
:param params: Additional parameters to send (for example, search=dict(id='b123') )
:return: The JSON result (decoded into a dict) from the server.abs
:raise MyGe... | python | {
"resource": ""
} |
q246690 | API.multi_call_async | train | async def multi_call_async(self, calls):
"""Performs an async multi-call to the API
:param calls: A list of call 2-tuples with method name and params (for example, ('Get', dict(typeName='Trip')) )
:return: The JSON result (decoded into a dict) from the server
:raise MyGeotabException: R... | python | {
"resource": ""
} |
q246691 | API.from_credentials | train | def from_credentials(credentials, loop: asyncio.AbstractEventLoop=asyncio.get_event_loop()):
"""Returns a new async API object from an existing Credentials object.
:param credentials: The existing saved credentials.
:param loop: The asyncio loop.
:return: A new API object populated with... | python | {
"resource": ""
} |
q246692 | format_iso_datetime | train | def format_iso_datetime(datetime_obj):
"""Formats the given datetime as a UTC-zoned ISO 8601 date string.
:param datetime_obj: The datetime object.
:type datetime_obj: datetime
:return: The datetime object in 8601 string form.
:rtype: datetime
"""
datetime_obj = localize_datetime(datetime_o... | python | {
"resource": ""
} |
q246693 | localize_datetime | train | def localize_datetime(datetime_obj, tz=pytz.utc):
"""Converts a naive or UTC-localized date into the provided timezone.
:param datetime_obj: The datetime object.
:type datetime_obj: datetime
:param tz: The timezone. If blank or None, UTC is used.
:type tz: datetime.tzinfo
| python | {
"resource": ""
} |
q246694 | DataFeed._run | train | def _run(self):
"""Runner for the Data Feed.
"""
while self.running:
try:
result = self.client_api.call('GetFeed', type_name=self.type_name, search=self.search,
from_version=self._version, results_limit=self.results_limit)... | python | {
"resource": ""
} |
q246695 | DataFeed.start | train | def start(self, threaded=True):
"""Start the data feed.
:param threaded: If True, run in a separate thread.
"""
self.running = True
if threaded:
| python | {
"resource": ""
} |
q246696 | _query | train | def _query(server, method, parameters, timeout=DEFAULT_TIMEOUT, verify_ssl=True):
"""Formats and performs the query against the API.
:param server: The MyGeotab server.
:type server: str
:param method: The method name.
:type method: str
:param parameters: The parameters to send with the query.
... | python | {
"resource": ""
} |
q246697 | server_call | train | def server_call(method, server, timeout=DEFAULT_TIMEOUT, verify_ssl=True, **parameters):
"""Makes a call to an un-authenticated method on a server
:param method: The method name.
:type method: str
:param server: The MyGeotab server.
:type server: str
:param timeout: The timeout to make the call... | python | {
"resource": ""
} |
q246698 | process_parameters | train | def process_parameters(parameters):
"""Allows the use of Pythonic-style parameters with underscores instead of camel-case.
:param parameters: The parameters object.
:type parameters: dict
:return: The processed parameters.
:rtype: dict
"""
if not parameters:
return {}
params = c... | python | {
"resource": ""
} |
q246699 | get_api_url | train | def get_api_url(server):
"""Formats the server URL properly in order to query the API.
:return: A valid MyGeotab API request URL.
:rtype: str
"""
parsed = | python | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.