_id stringlengths 2 7 | title stringlengths 1 88 | partition stringclasses 3
values | text stringlengths 31 13.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q250900 | SymbolTable.add_symbol | train | def add_symbol(self, symbol_name, namespace_stack, node, module):
"""Adds symbol_name defined in namespace_stack to the symbol table.
Args:
symbol_name: 'name of the symbol to lookup'
namespace_stack: None or ['namespaces', 'symbol', 'defined', 'in']
node: ast.Node that de... | python | {
"resource": ""
} |
q250901 | SymbolTable.get_namespace | train | def get_namespace(self, name_seq):
"""Returns the prefix of names from name_seq that are known namespaces.
Args:
name_seq: ['names', 'of', 'possible', 'namespace', 'to', 'find']
Returns:
['names', 'that', 'are', 'namespaces', 'possibly', 'empty', 'list']
"""
... | python | {
"resource": ""
} |
q250902 | WarningHunter._verify_forward_declarations_used | train | def _verify_forward_declarations_used(self, forward_declarations,
decl_uses, file_uses):
"""Find all the forward declarations that are not used."""
for cls in forward_declarations:
if cls in file_uses:
if not decl_uses[cls] & USES_DEC... | python | {
"resource": ""
} |
q250903 | WarningHunter._check_public_functions | train | def _check_public_functions(self, primary_header, all_headers):
"""Verify all the public functions are also declared in a header
file."""
public_symbols = {}
declared_only_symbols = {}
if primary_header:
for name, symbol in primary_header.public_symbols.items():
... | python | {
"resource": ""
} |
q250904 | _find_unused_static_warnings | train | def _find_unused_static_warnings(filename, lines, ast_list):
"""Warn about unused static variables."""
static_declarations = dict(_get_static_declarations(ast_list))
def find_variables_use(body):
for child in body:
if child.name in static_declarations:
static_use_counts[... | python | {
"resource": ""
} |
q250905 | read_file | train | def read_file(filename, print_error=True):
"""Returns the contents of a file."""
try:
for encoding in ['utf-8', 'latin1']:
try:
with io.open(filename, encoding=encoding) as fp:
return fp.read()
| python | {
"resource": ""
} |
q250906 | Reader.map | train | def map(self, fn: Callable[[Any], Any]) -> 'Reader':
r"""Map a function over the Reader.
Haskell:
fmap f m = Reader $ \r -> f (runReader m r).
fmap f g = | python | {
"resource": ""
} |
q250907 | Reader.bind | train | def bind(self, fn: "Callable[[Any], Reader]") -> 'Reader':
r"""Bind a monadic function to the Reader.
Haskell:
| python | {
"resource": ""
} |
q250908 | Reader.run | train | def run(self, *args, **kwargs) -> Callable:
"""Return wrapped function.
Haskell: runReader :: Reader r a -> r -> a
This is the | python | {
"resource": ""
} |
q250909 | MonadReader.asks | train | def asks(cls, fn: Callable) -> Reader:
"""
Given a function it returns a Reader which evaluates that
function and returns the result.
| python | {
"resource": ""
} |
q250910 | compose | train | def compose(f: Callable[[Any], Monad], g: Callable[[Any], Monad]) -> Callable[[Any], Monad]:
r"""Monadic compose function.
Right-to-left Kleisli composition of two monadic functions.
(<=<) :: Monad m => | python | {
"resource": ""
} |
q250911 | compose | train | def compose(*funcs: Callable) -> Callable:
"""Compose multiple functions right to left.
Composes zero or more functions into a functional composition. The
functions are composed right to left. A composition of zero
functions gives back the identity function.
compose()(x) == x
compose(f)(x) == ... | python | {
"resource": ""
} |
q250912 | State.run | train | def run(self, state: Any) -> Tuple[Any, Any]:
"""Return wrapped state computation.
This is the inverse of unit and returns the | python | {
"resource": ""
} |
q250913 | Writer.map | train | def map(self, func: Callable[[Tuple[Any, Log]], Tuple[Any, Log]]) -> 'Writer':
"""Map a function func over the Writer value.
Haskell:
fmap f m = Writer $ let (a, w) = runWriter m in (f a, w)
Keyword arguments:
| python | {
"resource": ""
} |
q250914 | Writer.bind | train | def bind(self, func: Callable[[Any], 'Writer']) -> 'Writer':
"""Flat is better than nested.
Haskell:
(Writer (x, v)) >>= f = let
(Writer (y, v')) = f x in Writer (y, v `append` v')
"""
a, w = self.run()
| python | {
"resource": ""
} |
q250915 | Writer.apply_log | train | def apply_log(a: tuple, func: Callable[[Any], Tuple[Any, Log]]) -> Tuple[Any, Log]:
"""Apply a function to a value with a log. | python | {
"resource": ""
} |
q250916 | Writer.create | train | def create(cls, class_name: str, monoid_type=Union[Monoid, str]):
"""Create Writer subclass using specified monoid type.
lets us create a Writer that uses a different monoid than str for
| python | {
"resource": ""
} |
q250917 | Identity.map | train | def map(self, mapper: Callable[[Any], Any]) -> 'Identity':
"""Map a function over wrapped values."""
value = self._value
try:
result = mapper(value)
| python | {
"resource": ""
} |
q250918 | Put.run | train | def run(self, world: int) -> IO:
"""Run IO action"""
text, action = self._value
| python | {
"resource": ""
} |
q250919 | Monad.lift | train | def lift(self, func):
"""Map function over monadic value.
Takes a function and a monadic value and maps the function over the
monadic value
Haskell: liftM :: (Monad m) => (a -> b) -> m a -> m b
This is really the same function as Functor.fmap, but is instead
| python | {
"resource": ""
} |
q250920 | Observable.map | train | def map(self, mapper: Callable[[Any], Any]) -> 'Observable':
r"""Map a function over an observable.
| python | {
"resource": ""
} |
q250921 | Observable.filter | train | def filter(self, predicate) -> 'Observable':
"""Filter the on_next continuation functions"""
source = self
def subscribe(on_next):
def _next(x):
if predicate(x):
| python | {
"resource": ""
} |
q250922 | Just.bind | train | def bind(self, func: Callable[[Any], Maybe]) -> Maybe:
"""Just x >>= f = f x."""
| python | {
"resource": ""
} |
q250923 | List.cons | train | def cons(self, element: Any) -> 'List':
"""Add element to front of | python | {
"resource": ""
} |
q250924 | List.head | train | def head(self) -> Any:
"""Retrive first element in List."""
| python | {
"resource": ""
} |
q250925 | List.tail | train | def tail(self) -> 'List':
"""Return tail of List."""
lambda_list = self._get_value()
| python | {
"resource": ""
} |
q250926 | List.map | train | def map(self, mapper: Callable[[Any], Any]) -> 'List':
"""Map a function over a List."""
try:
ret = List.from_iterable([mapper(x) for x in self])
| python | {
"resource": ""
} |
q250927 | List.append | train | def append(self, other: 'List') -> 'List':
"""Append other list to this list."""
if self.null():
| python | {
"resource": ""
} |
q250928 | List.bind | train | def bind(self, fn: Callable[[Any], 'List']) -> 'List':
"""Flatten and map the List.
Haskell: xs >>= f = concat | python | {
"resource": ""
} |
q250929 | List.from_iterable | train | def from_iterable(cls, iterable: Iterable) -> 'List':
"""Create list from iterable."""
iterator = iter(iterable)
def recurse() -> List:
| python | {
"resource": ""
} |
q250930 | Cont.map | train | def map(self, fn: Callable[[Any], Any]) -> 'Cont':
r"""Map a function over a continuation.
Haskell: fmap f m = Cont $ \c -> | python | {
"resource": ""
} |
q250931 | compress | train | def compress(func):
"""
Compress route return data with gzip compression
"""
@wraps(func)
def wrapper(*args, **kwargs):
result = func(*args, **kwargs)
if ('gzip' in bottle.request.headers.get('Accept-Encoding', '') and
isinstance(result, string_type) and
... | python | {
"resource": ""
} |
q250932 | set_trace | train | def set_trace(host='', port=5555, patch_stdstreams=False):
"""
Start the debugger
This method suspends execution of the current script
and starts a PDB debugging session. The web-interface is opened
on the specified port (default: ``5555``).
Example::
import web_pdb;web_pdb.set_trace(... | python | {
"resource": ""
} |
q250933 | post_mortem | train | def post_mortem(tb=None, host='', port=5555, patch_stdstreams=False):
"""
Start post-mortem debugging for the provided traceback object
If no traceback is provided the debugger tries to obtain a traceback
for the last unhandled exception.
Example::
try:
# Some error-prone code... | python | {
"resource": ""
} |
q250934 | catch_post_mortem | train | def catch_post_mortem(host='', port=5555, patch_stdstreams=False):
"""
A context manager for tracking potentially error-prone code
If an unhandled exception is raised inside context manager's code block,
the post-mortem debugger is started automatically.
Example::
with web_pdb.catch_post_... | python | {
"resource": ""
} |
q250935 | WebPdb.do_quit | train | def do_quit(self, arg):
"""
quit || exit || q
Stop and quit the current debugging session
"""
for name, fh in self._backup:
| python | {
"resource": ""
} |
q250936 | WebPdb._get_repr | train | def _get_repr(obj, pretty=False, indent=1):
"""
Get string representation of an object
:param obj: object
:type obj: object
:param pretty: use pretty formatting
:type pretty: bool
:param indent: indentation for pretty formatting
:type indent: int
... | python | {
"resource": ""
} |
q250937 | WebPdb.get_current_frame_data | train | def get_current_frame_data(self):
"""
Get all date about the current execution frame
:return: current frame data
:rtype: dict
:raises AttributeError: if the debugger does hold any execution frame.
:raises IOError: if source code for the current execution frame is not acc... | python | {
"resource": ""
} |
q250938 | WebPdb.remove_trace | train | def remove_trace(self, frame=None):
"""
Detach the debugger from the execution stack
:param frame: the lowest frame to detach the debugger from.
:type frame: types.FrameType
"""
sys.settrace(None)
| python | {
"resource": ""
} |
q250939 | WebConsole.flush | train | def flush(self):
"""
Wait until history is read but no more than 10 cycles
in case a browser | python | {
"resource": ""
} |
q250940 | solve_spectral | train | def solve_spectral(prob, *args, **kwargs):
"""Solve the spectral relaxation with lambda = 1.
"""
# TODO: do this efficiently without SDP lifting
# lifted variables and semidefinite constraint
X = cvx.Semidef(prob.n + 1)
W = prob.f0.homogeneous_form()
rel_obj = cvx.Minimize(cvx.sum_entries... | python | {
"resource": ""
} |
q250941 | solve_sdr | train | def solve_sdr(prob, *args, **kwargs):
"""Solve the SDP relaxation.
"""
# lifted variables and semidefinite constraint
X = cvx.Semidef(prob.n + 1)
W = prob.f0.homogeneous_form()
rel_obj = cvx.Minimize(cvx.sum_entries(cvx.mul_elemwise(W, X)))
rel_constr = [X[-1, -1] == 1]
for f in prob.... | python | {
"resource": ""
} |
q250942 | get_qcqp_form | train | def get_qcqp_form(prob):
"""Returns the problem metadata in QCQP class
"""
# Check quadraticity
if not prob.objective.args[0].is_quadratic():
raise Exception("Objective is not quadratic.")
if not all([constr._expr.is_quadratic() for constr in prob.constraints]):
raise Exception("Not ... | python | {
"resource": ""
} |
q250943 | BTLEConnection.make_request | train | def make_request(self, handle, value, timeout=DEFAULT_TIMEOUT, with_response=True):
"""Write a GATT Command without callback - not utf-8."""
try:
with self:
_LOGGER.debug("Writing %s to %s with with_response=%s", codecs.encode(value, 'hex'), handle, with_response)
| python | {
"resource": ""
} |
q250944 | cli | train | def cli(ctx, mac, debug):
""" Tool to query and modify the state of EQ3 BT smart thermostat. """
if debug:
logging.basicConfig(level=logging.DEBUG)
else:
logging.basicConfig(level=logging.INFO)
| python | {
"resource": ""
} |
q250945 | temp | train | def temp(dev, target):
""" Gets or sets the target temperature."""
click.echo("Current target temp: %s" % dev.target_temperature)
if target:
| python | {
"resource": ""
} |
q250946 | mode | train | def mode(dev, target):
""" Gets or sets the active mode. """
click.echo("Current mode: %s" % dev.mode_readable)
if target:
| python | {
"resource": ""
} |
q250947 | boost | train | def boost(dev, target):
""" Gets or sets the boost mode. """
click.echo("Boost: %s" % dev.boost)
if target is not None:
| python | {
"resource": ""
} |
q250948 | locked | train | def locked(dev, target):
""" Gets or sets the lock. """
click.echo("Locked: %s" % dev.locked)
if target is not None:
| python | {
"resource": ""
} |
q250949 | window_open | train | def window_open(dev, temp, duration):
""" Gets and sets the window open settings. """
click.echo("Window open: %s" % dev.window_open)
if temp and duration:
| python | {
"resource": ""
} |
q250950 | presets | train | def presets(dev, comfort, eco):
""" Sets the preset temperatures for auto mode. """
click.echo("Setting presets: comfort %s, | python | {
"resource": ""
} |
q250951 | schedule | train | def schedule(dev):
""" Gets the schedule from the thermostat. """
# TODO: expose setting the schedule somehow?
for d in range(7):
dev.query_schedule(d)
for day in dev.schedule.values():
click.echo("Day %s, base temp: %s" % (day.day, day.base_temp))
current_hour = day.next_change_... | python | {
"resource": ""
} |
q250952 | away | train | def away(dev, away_end, temperature):
""" Enables or disables the away mode. """
if away_end:
click.echo("Setting away until %s, temperature: %s" % (away_end, temperature))
| python | {
"resource": ""
} |
q250953 | state | train | def state(ctx):
""" Prints out all available information. """
dev = ctx.obj
click.echo(dev)
ctx.forward(locked)
ctx.forward(low_battery)
ctx.forward(window_open)
ctx.forward(boost)
| python | {
"resource": ""
} |
q250954 | Thermostat.parse_schedule | train | def parse_schedule(self, data):
"""Parses the device sent schedule."""
| python | {
"resource": ""
} |
q250955 | Thermostat.update | train | def update(self):
"""Update the data from the thermostat. Always sets the current time."""
_LOGGER.debug("Querying the device..")
time = datetime.now()
value = struct.pack('BBBBBBB', PROP_INFO_QUERY,
| python | {
"resource": ""
} |
q250956 | Thermostat.set_schedule | train | def set_schedule(self, data):
"""Sets the schedule for the given day. """
value = Schedule.build(data)
| python | {
"resource": ""
} |
q250957 | Thermostat.target_temperature | train | def target_temperature(self, temperature):
"""Set new target temperature."""
dev_temp = int(temperature * 2)
if temperature == EQ3BT_OFF_TEMP or temperature == EQ3BT_ON_TEMP:
dev_temp |= 0x40
value = struct.pack('BB', PROP_MODE_WRITE, dev_temp)
| python | {
"resource": ""
} |
q250958 | Thermostat.mode | train | def mode(self, mode):
"""Set the operation mode."""
_LOGGER.debug("Setting new mode: %s", mode)
if self.mode == Mode.Boost and mode != Mode.Boost:
self.boost = False
if mode == Mode.Boost:
self.boost = True
return
elif mode == Mode.Away:
... | python | {
"resource": ""
} |
q250959 | Thermostat.set_away | train | def set_away(self, away_end=None, temperature=EQ3BT_AWAY_TEMP):
""" Sets away mode with target temperature.
When called without parameters disables away mode."""
if not away_end:
_LOGGER.debug("Disabling away, going to auto mode.")
return self.set_mode(0x00)
... | python | {
"resource": ""
} |
q250960 | Thermostat.mode_readable | train | def mode_readable(self):
"""Return a readable representation of the mode.."""
ret = ""
mode = self._raw_mode
if mode.MANUAL:
ret = "manual"
if self.target_temperature < self.min_temp:
ret += " off"
elif self.target_temperature >= self.... | python | {
"resource": ""
} |
q250961 | Thermostat.boost | train | def boost(self, boost):
"""Sets boost mode."""
_LOGGER.debug("Setting boost mode: | python | {
"resource": ""
} |
q250962 | Thermostat.window_open_config | train | def window_open_config(self, temperature, duration):
"""Configures the window open behavior. The duration is specified in
5 minute increments."""
_LOGGER.debug("Window open config, temperature: %s duration: %s", temperature, duration)
self._verify_temperature(temperature)
if dura... | python | {
"resource": ""
} |
q250963 | Thermostat.locked | train | def locked(self, lock):
"""Locks or unlocks the thermostat."""
_LOGGER.debug("Setting the | python | {
"resource": ""
} |
q250964 | Thermostat.temperature_offset | train | def temperature_offset(self, offset):
"""Sets the thermostat's temperature offset."""
_LOGGER.debug("Setting offset: %s", offset)
# [-3,5 .. 0 .. 3,5 ]
# [00 .. 07 .. 0e ]
if offset < -3.5 or offset > 3.5: | python | {
"resource": ""
} |
q250965 | QConnection._init_socket | train | def _init_socket(self):
'''Initialises the socket used for communicating with a q service,'''
try:
self._connection = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self._connection.connect((self.host, self.port))
self._connection.settimeout(self.timeout)
| python | {
"resource": ""
} |
q250966 | QConnection.close | train | def close(self):
'''Closes connection with the q service.'''
if self._connection:
self._connection_file.close()
| python | {
"resource": ""
} |
q250967 | QConnection._initialize | train | def _initialize(self):
'''Performs a IPC protocol handshake.'''
credentials = (self.username if self.username else '') + ':' + (self.password if self.password else '')
credentials = credentials.encode(self._encoding)
self._connection.send(credentials + b'\3\0')
response = self._c... | python | {
"resource": ""
} |
q250968 | qlist | train | def qlist(array, adjust_dtype = True, **meta):
'''Converts an input array to q vector and enriches object instance with
meta data.
Returns a :class:`.QList` instance for non-datetime vectors. For datetime
vectors :class:`.QTemporalList` is returned instead.
If parameter `adjust_dtype` is `True` ... | python | {
"resource": ""
} |
q250969 | parse_url | train | def parse_url(url, warning=True):
"""Parse URLs especially for Google Drive links.
file_id: ID of file on Google Drive.
is_download_link: Flag if it is download link of Google Drive.
"""
parsed = urllib_parse.urlparse(url)
query = urllib_parse.parse_qs(parsed.query)
is_gdrive = parsed.hostn... | python | {
"resource": ""
} |
q250970 | extractall | train | def extractall(path, to=None):
"""Extract archive file.
Parameters
----------
path: str
Path of archive file to be extracted.
to: str, optional
Directory to which the archive file will be extracted.
If None, it will be set to the parent directory of the archive file.
"""... | python | {
"resource": ""
} |
q250971 | _add_word | train | def _add_word(completer):
"""
Used to add words to the completors
| python | {
"resource": ""
} |
q250972 | _remove_word | train | def _remove_word(completer):
"""
Used to remove words from the completors
"""
def inner(word: str):
try:
| python | {
"resource": ""
} |
q250973 | set_info | train | def set_info(self, *args, **kwargs) -> None:
"""
Sets the log level to `INFO`
"""
| python | {
"resource": ""
} |
q250974 | CommandObserver.do_REMOTE | train | def do_REMOTE(self,
target: str,
remote_command: str,
source: list,
*args,
**kwargs) -> None:
"""
Send a remote command to a service. Used
Args:
target: The service that the command gets set t... | python | {
"resource": ""
} |
q250975 | CommandObserver.do_IDENT | train | def do_IDENT(self, service_name: str, source: list, *args, **kwargs) -> None:
"""
Perform identification of a service to a binary representation.
Args:
service_name: human readable name for service
source: zmq representation for the socket | python | {
"resource": ""
} |
q250976 | _name_helper | train | def _name_helper(name: str):
"""
default to returning a name with `.service`
"""
name = name.rstrip()
| python | {
"resource": ""
} |
q250977 | get_vexbot_certificate_filepath | train | def get_vexbot_certificate_filepath() -> (str, bool):
"""
Returns the vexbot certificate filepath and the whether it is the private
filepath or not
"""
public_filepath, secret_filepath = _certificate_helper('vexbot.key','vexbot.key_secret')
if path.isfile(secret_filepath):
return secret_... | python | {
"resource": ""
} |
q250978 | get_code | train | def get_code(self, *args, **kwargs):
"""
get the python source code from callback
"""
# FIXME: Honestly should allow multiple commands
callback = self._commands[args[0]]
# TODO: syntax color would be nice
source = _inspect.getsourcelines(callback)[0] | python | {
"resource": ""
} |
q250979 | _HeartbeatReciever._get_state | train | def _get_state(self) -> None:
"""
Internal method that accomplishes checking to make sure that the UUID
has not changed
"""
# Don't need to go any further if we don't have a message
if self.last_message is None:
return
# get the latest message UUID
... | python | {
"resource": ""
} |
q250980 | _HeartbeatReciever.send_identity | train | def send_identity(self):
"""
Send the identity of the service.
"""
service_name = {'service_name': self.messaging._service_name}
service_name = _json.dumps(service_name).encode('utf8')
identify_frame = (b'',
b'IDENT',
_... | python | {
"resource": ""
} |
q250981 | Messaging._config_convert_to_address_helper | train | def _config_convert_to_address_helper(self) -> None:
"""
converts the config from ports to zmq ip addresses
Operates on `self.config` using `self._socket_factory.to_address`
"""
to_address = self._socket_factory.to_address
for k, v in self.config.items():
| python | {
"resource": ""
} |
q250982 | Messaging.add_callback | train | def add_callback(self, callback: _Callable, *args, **kwargs) -> None:
"""
Add a callback to the event loop
| python | {
"resource": ""
} |
q250983 | Messaging.start | train | def start(self) -> None:
"""
Start the internal control loop. Potentially blocking, depending on
the value of `_run_control_loop` set by the initializer.
"""
self._setup()
if self._run_control_loop:
asyncio.set_event_loop(asyncio.new_event_loop())
| python | {
"resource": ""
} |
q250984 | Messaging.send_command | train | def send_command(self, command: str, *args, **kwargs):
"""
For request bot to perform some action
"""
info = 'send command `%s` to bot. Args: %s | Kwargs: %s'
self._messaging_logger.command.info(info, command, args, kwargs)
command = command.encode('utf8')
# targ... | python | {
"resource": ""
} |
q250985 | SocketFactory.to_address | train | def to_address(self, port: str):
"""
transforms the ports into addresses.
Will fall through if the port looks like an address
"""
# check to see if user passed in a string
# if they did, they want to use that instead
if isinstance(port, str) and len(port) > 6:
| python | {
"resource": ""
} |
q250986 | SocketFactory.iterate_multiple_addresses | train | def iterate_multiple_addresses(self, ports: (str, list, tuple)):
"""
transforms an iterable, or the expectation of an iterable
into zmq addresses
"""
if isinstance(ports, (str, int)):
# TODO: verify | python | {
"resource": ""
} |
q250987 | Shell.is_command | train | def is_command(self, text: str) -> bool:
"""
checks for presence of shebang in the first character of the text
"""
| python | {
"resource": ""
} |
q250988 | Shell._handle_text | train | def _handle_text(self, text: str):
"""
Check to see if text is a command. Otherwise, check to see if the
second word is a command.
Commands get handeled by the `_handle_command` method
If not command, check to see if first word is a service or an author.
Default program... | python | {
"resource": ""
} |
q250989 | Shell._first_word_not_cmd | train | def _first_word_not_cmd(self,
first_word: str,
command: str,
args: tuple,
kwargs: dict) -> None:
"""
check to see if this is an author or service.
This method does high level control h... | python | {
"resource": ""
} |
q250990 | EntityExtraction._sentence_to_features | train | def _sentence_to_features(self, sentence: list):
# type: (List[Tuple[Text, Text, Text, Text]]) -> List[Dict[Text, Any]]
"""Convert a word into discrete features in self.crf_features,
including word before and word after."""
sentence_features = []
prefixes = ('-1', '0', '+1')
... | python | {
"resource": ""
} |
q250991 | find_template_companion | train | def find_template_companion(template, extension='', check=True):
"""
Returns the first found template companion file
"""
if check and not os.path.isfile(template):
yield ''
return # May be '<stdin>' (click)
template = os.path.abspath(template)
template_dirname = os.path.dirname... | python | {
"resource": ""
} |
q250992 | SvdElement.from_element | train | def from_element(self, element, defaults={}):
"""Populate object variables from SVD element"""
if isinstance(defaults, SvdElement):
defaults = vars(defaults)
for key in self.props:
try:
value = element.find(key).text
except AttributeError: # M... | python | {
"resource": ""
} |
q250993 | SvdRegister.fold | train | def fold(self):
"""Folds the Register in accordance with it's dimensions.
If the register is dimensionless, the returned list just
contains the register itself unchanged. In case the register
name looks like a C array, the returned list contains the register
itself, where nothin... | python | {
"resource": ""
} |
q250994 | TrafficControl.get_tc_device | train | def get_tc_device(self):
"""
Return a device name that associated network communication direction.
"""
if self.direction == TrafficDirection.OUTGOING:
return self.device
if self.direction == TrafficDirection.INCOMING:
| python | {
"resource": ""
} |
q250995 | TrafficControl.delete_tc | train | def delete_tc(self):
"""
Delete a specific shaping rule.
"""
rule_finder = TcShapingRuleFinder(logger=logger, tc=self)
filter_param = rule_finder.find_filter_param()
if not filter_param:
message = "shaping rule not found ({}).".format(rule_finder.get_filter_... | python | {
"resource": ""
} |
q250996 | request | train | def request(identifier, namespace='cid', domain='compound', operation=None, output='JSON', searchtype=None, **kwargs):
"""
Construct API request from parameters and return the response.
Full specification at http://pubchem.ncbi.nlm.nih.gov/pug_rest/PUG_REST.html
"""
if not identifier:
raise... | python | {
"resource": ""
} |
q250997 | get | train | def get(identifier, namespace='cid', domain='compound', operation=None, output='JSON', searchtype=None, **kwargs):
"""Request wrapper that automatically handles async requests."""
if (searchtype and searchtype != 'xref') or namespace in ['formula']:
response = request(identifier, namespace, domain, None... | python | {
"resource": ""
} |
q250998 | get_json | train | def get_json(identifier, namespace='cid', domain='compound', operation=None, searchtype=None, **kwargs):
"""Request wrapper that automatically parses JSON response and supresses NotFoundError."""
try:
return | python | {
"resource": ""
} |
q250999 | get_sdf | train | def get_sdf(identifier, namespace='cid', domain='compound',operation=None, searchtype=None, **kwargs):
"""Request wrapper that automatically parses SDF response and supresses NotFoundError."""
try:
| python | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.