nwo
stringlengths
5
106
sha
stringlengths
40
40
path
stringlengths
4
174
language
stringclasses
1 value
identifier
stringlengths
1
140
parameters
stringlengths
0
87.7k
argument_list
stringclasses
1 value
return_statement
stringlengths
0
426k
docstring
stringlengths
0
64.3k
docstring_summary
stringlengths
0
26.3k
docstring_tokens
list
function
stringlengths
18
4.83M
function_tokens
list
url
stringlengths
83
304
NifTK/NiftyNet
935bf4334cd00fa9f9d50f6a95ddcbfdde4031e0
demos/Learning_Rate_Decay/Demo_applications/no_decay_lr_comparison_application.py
python
DecayLearningRateApplication.set_iteration_update
(self, iteration_message)
This function will be called by the application engine at each iteration.
This function will be called by the application engine at each iteration.
[ "This", "function", "will", "be", "called", "by", "the", "application", "engine", "at", "each", "iteration", "." ]
def set_iteration_update(self, iteration_message): """ This function will be called by the application engine at each iteration. """ current_iter = iteration_message.current_iter if iteration_message.is_training: iteration_message.data_feed_dict[self.is_valida...
[ "def", "set_iteration_update", "(", "self", ",", "iteration_message", ")", ":", "current_iter", "=", "iteration_message", ".", "current_iter", "if", "iteration_message", ".", "is_training", ":", "iteration_message", ".", "data_feed_dict", "[", "self", ".", "is_validat...
https://github.com/NifTK/NiftyNet/blob/935bf4334cd00fa9f9d50f6a95ddcbfdde4031e0/demos/Learning_Rate_Decay/Demo_applications/no_decay_lr_comparison_application.py#L75-L85
oracle/graalpython
577e02da9755d916056184ec441c26e00b70145c
graalpython/lib-python/3/asyncio/events.py
python
Handle.__repr__
(self)
return '<{}>'.format(' '.join(info))
[]
def __repr__(self): if self._repr is not None: return self._repr info = self._repr_info() return '<{}>'.format(' '.join(info))
[ "def", "__repr__", "(", "self", ")", ":", "if", "self", ".", "_repr", "is", "not", "None", ":", "return", "self", ".", "_repr", "info", "=", "self", ".", "_repr_info", "(", ")", "return", "'<{}>'", ".", "format", "(", "' '", ".", "join", "(", "info...
https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/asyncio/events.py#L59-L63
hhursev/recipe-scrapers
478b9ddb0dda02b17b14f299eea729bef8131aa9
recipe_scrapers/timesofindia.py
python
TimesOfIndia.language
(self)
return normalize_string(meta_language.get("content"))
[]
def language(self): meta_language = self.soup.find("meta", attrs={"http-equiv": "content-language"}) return normalize_string(meta_language.get("content"))
[ "def", "language", "(", "self", ")", ":", "meta_language", "=", "self", ".", "soup", ".", "find", "(", "\"meta\"", ",", "attrs", "=", "{", "\"http-equiv\"", ":", "\"content-language\"", "}", ")", "return", "normalize_string", "(", "meta_language", ".", "get"...
https://github.com/hhursev/recipe-scrapers/blob/478b9ddb0dda02b17b14f299eea729bef8131aa9/recipe_scrapers/timesofindia.py#L36-L39
Nextdoor/ndscheduler
d31016aaca480e38a69d75a66a9978a937c6a0b0
ndscheduler/server/server.py
python
SchedulerServer.__init__
(self, scheduler_instance)
[]
def __init__(self, scheduler_instance): # Start scheduler self.scheduler_manager = scheduler_instance self.tornado_settings = dict( debug=settings.DEBUG, static_path=settings.STATIC_DIR_PATH, template_path=settings.TEMPLATE_DIR_PATH, scheduler_man...
[ "def", "__init__", "(", "self", ",", "scheduler_instance", ")", ":", "# Start scheduler", "self", ".", "scheduler_manager", "=", "scheduler_instance", "self", ".", "tornado_settings", "=", "dict", "(", "debug", "=", "settings", ".", "DEBUG", ",", "static_path", ...
https://github.com/Nextdoor/ndscheduler/blob/d31016aaca480e38a69d75a66a9978a937c6a0b0/ndscheduler/server/server.py#L30-L53
invesalius/invesalius3
0616d3e73bfe0baf7525877dbf6acab697395eb9
invesalius/gui/frame.py
python
HistoryToolBar.__bind_events_wx
(self)
Bind normal events from wx (except pubsub related).
Bind normal events from wx (except pubsub related).
[ "Bind", "normal", "events", "from", "wx", "(", "except", "pubsub", "related", ")", "." ]
def __bind_events_wx(self): """ Bind normal events from wx (except pubsub related). """ #self.Bind(wx.EVT_TOOL, self.OnToggle) self.Bind(wx.EVT_TOOL, self.OnUndo, id=wx.ID_UNDO) self.Bind(wx.EVT_TOOL, self.OnRedo, id=wx.ID_REDO)
[ "def", "__bind_events_wx", "(", "self", ")", ":", "#self.Bind(wx.EVT_TOOL, self.OnToggle)", "self", ".", "Bind", "(", "wx", ".", "EVT_TOOL", ",", "self", ".", "OnUndo", ",", "id", "=", "wx", ".", "ID_UNDO", ")", "self", ".", "Bind", "(", "wx", ".", "EVT_...
https://github.com/invesalius/invesalius3/blob/0616d3e73bfe0baf7525877dbf6acab697395eb9/invesalius/gui/frame.py#L2185-L2191
dimagi/commcare-hq
d67ff1d3b4c51fa050c19e60c3253a79d3452a39
corehq/apps/export/views/utils.py
python
DailySavedExportMixin.create_new_export_instance
(self, schema, export_settings=None)
return instance
[]
def create_new_export_instance(self, schema, export_settings=None): instance = super(DailySavedExportMixin, self).create_new_export_instance( schema, export_settings=export_settings ) instance.is_daily_saved_export = True span = datespan_from_beginning(self.domai...
[ "def", "create_new_export_instance", "(", "self", ",", "schema", ",", "export_settings", "=", "None", ")", ":", "instance", "=", "super", "(", "DailySavedExportMixin", ",", "self", ")", ".", "create_new_export_instance", "(", "schema", ",", "export_settings", "=",...
https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/export/views/utils.py#L152-L173
YU-Zhiyang/opencv_transforms_torchvision
eb76cdbfb302396a36a69bacbe6e353eb421633e
cvtorchvision/cvtransforms/cvtransforms.py
python
ColorJitter.__call__
(self, img)
return transform(img)
Args: img (np.ndarray): Input image. Returns: np.ndarray: Color jittered image.
Args: img (np.ndarray): Input image.
[ "Args", ":", "img", "(", "np", ".", "ndarray", ")", ":", "Input", "image", "." ]
def __call__(self, img): """ Args: img (np.ndarray): Input image. Returns: np.ndarray: Color jittered image. """ transform = self.get_params(self.brightness, self.contrast, self.saturation, self.hue) return tran...
[ "def", "__call__", "(", "self", ",", "img", ")", ":", "transform", "=", "self", ".", "get_params", "(", "self", ".", "brightness", ",", "self", ".", "contrast", ",", "self", ".", "saturation", ",", "self", ".", "hue", ")", "return", "transform", "(", ...
https://github.com/YU-Zhiyang/opencv_transforms_torchvision/blob/eb76cdbfb302396a36a69bacbe6e353eb421633e/cvtorchvision/cvtransforms/cvtransforms.py#L743-L753
persephone-tools/persephone
ef7cbf169b1fd7ad6eb880dbda6357f0e7393fba
persephone/datasets/na.py
python
prepare_untran
(feat_type, tgt_dir, untran_dir)
Preprocesses untranscribed audio.
Preprocesses untranscribed audio.
[ "Preprocesses", "untranscribed", "audio", "." ]
def prepare_untran(feat_type, tgt_dir, untran_dir): """ Preprocesses untranscribed audio.""" org_dir = str(untran_dir) wav_dir = os.path.join(str(tgt_dir), "wav", "untranscribed") feat_dir = os.path.join(str(tgt_dir), "feat", "untranscribed") if not os.path.isdir(wav_dir): os.makedirs(wav_di...
[ "def", "prepare_untran", "(", "feat_type", ",", "tgt_dir", ",", "untran_dir", ")", ":", "org_dir", "=", "str", "(", "untran_dir", ")", "wav_dir", "=", "os", ".", "path", ".", "join", "(", "str", "(", "tgt_dir", ")", ",", "\"wav\"", ",", "\"untranscribed\...
https://github.com/persephone-tools/persephone/blob/ef7cbf169b1fd7ad6eb880dbda6357f0e7393fba/persephone/datasets/na.py#L292-L337
scikit-video/scikit-video
87c7113a84b50679d9853ba81ba34b557f516b05
skvideo/motion/block.py
python
blockMotion
(videodata, method='DS', mbSize=8, p=2, **plugin_args)
return motionData
Block-based motion estimation Given a sequence of frames, this function returns motion vectors between frames. Parameters ---------- videodata : ndarray, shape (numFrames, height, width, channel) A sequence of frames method : string "ES" --> exhaustive search "3SS...
Block-based motion estimation Given a sequence of frames, this function returns motion vectors between frames.
[ "Block", "-", "based", "motion", "estimation", "Given", "a", "sequence", "of", "frames", "this", "function", "returns", "motion", "vectors", "between", "frames", "." ]
def blockMotion(videodata, method='DS', mbSize=8, p=2, **plugin_args): """Block-based motion estimation Given a sequence of frames, this function returns motion vectors between frames. Parameters ---------- videodata : ndarray, shape (numFrames, height, width, channel) A sequence o...
[ "def", "blockMotion", "(", "videodata", ",", "method", "=", "'DS'", ",", "mbSize", "=", "8", ",", "p", "=", "2", ",", "*", "*", "plugin_args", ")", ":", "videodata", "=", "vshape", "(", "videodata", ")", "# grayscale", "luminancedata", "=", "rgb2gray", ...
https://github.com/scikit-video/scikit-video/blob/87c7113a84b50679d9853ba81ba34b557f516b05/skvideo/motion/block.py#L888-L983
and3rson/clay
c271cecf6b6ea6465abcdd2444171b1a565a60a3
clay/vlc.py
python
MediaPlayer.set_nsobject
(self, drawable)
return libvlc_media_player_set_nsobject(self, drawable)
Set the NSView handler where the media player should render its video output. Use the vout called "macosx". The drawable is an NSObject that follow the VLCOpenGLVideoViewEmbedding protocol: @begincode \@protocol VLCOpenGLVideoViewEmbedding <NSObject> - (void)addVoutSubvie...
Set the NSView handler where the media player should render its video output. Use the vout called "macosx". The drawable is an NSObject that follow the VLCOpenGLVideoViewEmbedding protocol: @begincode \@protocol VLCOpenGLVideoViewEmbedding <NSObject> - (void)addVoutSubvie...
[ "Set", "the", "NSView", "handler", "where", "the", "media", "player", "should", "render", "its", "video", "output", ".", "Use", "the", "vout", "called", "macosx", ".", "The", "drawable", "is", "an", "NSObject", "that", "follow", "the", "VLCOpenGLVideoViewEmbed...
def set_nsobject(self, drawable): '''Set the NSView handler where the media player should render its video output. Use the vout called "macosx". The drawable is an NSObject that follow the VLCOpenGLVideoViewEmbedding protocol: @begincode \@protocol VLCOpenGLVideoViewEmbed...
[ "def", "set_nsobject", "(", "self", ",", "drawable", ")", ":", "return", "libvlc_media_player_set_nsobject", "(", "self", ",", "drawable", ")" ]
https://github.com/and3rson/clay/blob/c271cecf6b6ea6465abcdd2444171b1a565a60a3/clay/vlc.py#L2943-L2968
fossasia/x-mario-center
fe67afe28d995dcf4e2498e305825a4859566172
build/lib.linux-i686-2.7/softwarecenter/ui/gtk3/panes/softwarepane.py
python
SoftwarePane.init_atk_name
(self, widget, name)
init the atk name for a given gtk widget based on parent-pane and variable name (used for the mago tests)
init the atk name for a given gtk widget based on parent-pane and variable name (used for the mago tests)
[ "init", "the", "atk", "name", "for", "a", "given", "gtk", "widget", "based", "on", "parent", "-", "pane", "and", "variable", "name", "(", "used", "for", "the", "mago", "tests", ")" ]
def init_atk_name(self, widget, name): """ init the atk name for a given gtk widget based on parent-pane and variable name (used for the mago tests) """ name = self.__class__.__name__ + "." + name Atk.Object.set_name(widget.get_accessible(), name)
[ "def", "init_atk_name", "(", "self", ",", "widget", ",", "name", ")", ":", "name", "=", "self", ".", "__class__", ".", "__name__", "+", "\".\"", "+", "name", "Atk", ".", "Object", ".", "set_name", "(", "widget", ".", "get_accessible", "(", ")", ",", ...
https://github.com/fossasia/x-mario-center/blob/fe67afe28d995dcf4e2498e305825a4859566172/build/lib.linux-i686-2.7/softwarecenter/ui/gtk3/panes/softwarepane.py#L250-L255
tenable/pyTenable
1ccab9fc6f6e4c9f1cfe5128f694388ea112719d
tenable/io/exports/api.py
python
ExportsAPI.status
(self, export_type: Literal['vulns', 'assets', 'compliance'], export_uuid: UUID, )
return self._api.get(f'{export_type}/export/{export_uuid}/status', box=True, )
Gets the status of the export job. API Documentation for the status of an export job for the :devportal:`assets <exports-assets-export-status>`, :devportal:`compliance <io-exports-compliance-status>`, and :devportal:`vulnerabilities <exports-vulns-export-status>` datatypes. Arg...
Gets the status of the export job.
[ "Gets", "the", "status", "of", "the", "export", "job", "." ]
def status(self, export_type: Literal['vulns', 'assets', 'compliance'], export_uuid: UUID, ) -> Dict: ''' Gets the status of the export job. API Documentation for the status of an export job for the :devportal:`assets <exports-assets-export-s...
[ "def", "status", "(", "self", ",", "export_type", ":", "Literal", "[", "'vulns'", ",", "'assets'", ",", "'compliance'", "]", ",", "export_uuid", ":", "UUID", ",", ")", "->", "Dict", ":", "return", "self", ".", "_api", ".", "get", "(", "f'{export_type}/ex...
https://github.com/tenable/pyTenable/blob/1ccab9fc6f6e4c9f1cfe5128f694388ea112719d/tenable/io/exports/api.py#L112-L136
matrix-org/synapse
8e57584a5859a9002759963eb546d523d2498a01
synapse/push/mailer.py
python
safe_markup
(raw_html: str)
return jinja2.Markup( bleach.linkify( bleach.clean( raw_html, tags=ALLOWED_TAGS, attributes=ALLOWED_ATTRS, # bleach master has this, but it isn't released yet # protocols=ALLOWED_SCHEMES, strip=True, ...
Sanitise a raw HTML string to a set of allowed tags and attributes, and linkify any bare URLs. Args raw_html: Unsafe HTML. Returns: A Markup object ready to safely use in a Jinja template.
Sanitise a raw HTML string to a set of allowed tags and attributes, and linkify any bare URLs.
[ "Sanitise", "a", "raw", "HTML", "string", "to", "a", "set", "of", "allowed", "tags", "and", "attributes", "and", "linkify", "any", "bare", "URLs", "." ]
def safe_markup(raw_html: str) -> jinja2.Markup: """ Sanitise a raw HTML string to a set of allowed tags and attributes, and linkify any bare URLs. Args raw_html: Unsafe HTML. Returns: A Markup object ready to safely use in a Jinja template. """ return jinja2.Markup( bl...
[ "def", "safe_markup", "(", "raw_html", ":", "str", ")", "->", "jinja2", ".", "Markup", ":", "return", "jinja2", ".", "Markup", "(", "bleach", ".", "linkify", "(", "bleach", ".", "clean", "(", "raw_html", ",", "tags", "=", "ALLOWED_TAGS", ",", "attributes...
https://github.com/matrix-org/synapse/blob/8e57584a5859a9002759963eb546d523d2498a01/synapse/push/mailer.py#L870-L891
longcw/yolo2-pytorch
f046769ea157e6d57579c67dcef62fdd3b71111e
layers/reorg/reorg_layer.py
python
ReorgFunction.backward
(self, grad_top)
return grad_bottom
[]
def backward(self, grad_top): stride = self.stride bsize, c, h, w = grad_top.size() out_w, out_h, out_c = w * stride, h * stride, c / (stride * stride) grad_bottom = torch.FloatTensor(bsize, int(out_c), out_h, out_w) # rev_stride = 1. / stride # reverse if grad_top.i...
[ "def", "backward", "(", "self", ",", "grad_top", ")", ":", "stride", "=", "self", ".", "stride", "bsize", ",", "c", ",", "h", ",", "w", "=", "grad_top", ".", "size", "(", ")", "out_w", ",", "out_h", ",", "out_c", "=", "w", "*", "stride", ",", "...
https://github.com/longcw/yolo2-pytorch/blob/f046769ea157e6d57579c67dcef62fdd3b71111e/layers/reorg/reorg_layer.py#L27-L43
plotly/plotly.py
cfad7862594b35965c0e000813bd7805e8494a5b
packages/python/plotly/plotly/graph_objs/layout/polar/radialaxis/_tickfont.py
python
Tickfont.color
(self)
return self["color"]
The 'color' property is a color and may be specified as: - A hex string (e.g. '#ff0000') - An rgb/rgba string (e.g. 'rgb(255,0,0)') - An hsl/hsla string (e.g. 'hsl(0,100%,50%)') - An hsv/hsva string (e.g. 'hsv(0,100%,100%)') - A named CSS color: aliceblu...
The 'color' property is a color and may be specified as: - A hex string (e.g. '#ff0000') - An rgb/rgba string (e.g. 'rgb(255,0,0)') - An hsl/hsla string (e.g. 'hsl(0,100%,50%)') - An hsv/hsva string (e.g. 'hsv(0,100%,100%)') - A named CSS color: aliceblu...
[ "The", "color", "property", "is", "a", "color", "and", "may", "be", "specified", "as", ":", "-", "A", "hex", "string", "(", "e", ".", "g", ".", "#ff0000", ")", "-", "An", "rgb", "/", "rgba", "string", "(", "e", ".", "g", ".", "rgb", "(", "255",...
def color(self): """ The 'color' property is a color and may be specified as: - A hex string (e.g. '#ff0000') - An rgb/rgba string (e.g. 'rgb(255,0,0)') - An hsl/hsla string (e.g. 'hsl(0,100%,50%)') - An hsv/hsva string (e.g. 'hsv(0,100%,100%)') - A name...
[ "def", "color", "(", "self", ")", ":", "return", "self", "[", "\"color\"", "]" ]
https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/layout/polar/radialaxis/_tickfont.py#L16-L64
chengzhengxin/groupsoftmax-simpledet
3f63a00998c57fee25241cf43a2e8600893ea462
config/dcn/faster_dcn_r50v1bc4_c5_512roi_1x.py
python
get_config
(is_train)
return General, KvstoreParam, RpnParam, RoiParam, BboxParam, DatasetParam, \ ModelParam, OptimizeParam, TestParam, \ transform, data_name, label_name, metric_list
[]
def get_config(is_train): class General: log_frequency = 10 name = __name__.rsplit("/")[-1].rsplit(".")[-1] batch_image = 2 if is_train else 1 fp16 = False class KvstoreParam: kvstore = "local" batch_image = General.batch_image gpus = [0, 1, 2...
[ "def", "get_config", "(", "is_train", ")", ":", "class", "General", ":", "log_frequency", "=", "10", "name", "=", "__name__", ".", "rsplit", "(", "\"/\"", ")", "[", "-", "1", "]", ".", "rsplit", "(", "\".\"", ")", "[", "-", "1", "]", "batch_image", ...
https://github.com/chengzhengxin/groupsoftmax-simpledet/blob/3f63a00998c57fee25241cf43a2e8600893ea462/config/dcn/faster_dcn_r50v1bc4_c5_512roi_1x.py#L10-L273
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/parso/python/tree.py
python
ImportName.level
(self)
return 0
The level parameter of ``__import__``.
The level parameter of ``__import__``.
[ "The", "level", "parameter", "of", "__import__", "." ]
def level(self): """The level parameter of ``__import__``.""" return 0
[ "def", "level", "(", "self", ")", ":", "return", "0" ]
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/parso/python/tree.py#L919-L921
SheffieldML/GPy
bb1bc5088671f9316bc92a46d356734e34c2d5c0
GPy/kern/src/eq_ode1.py
python
EQ_ODE1._Kdiag
(self, X)
return kdiag
[]
def _Kdiag(self, X): #This way is not working, indexes are lost after using k._slice_X #index = np.asarray(X, dtype=np.int) #index = index.reshape(index.size,) if hasattr(X, 'values'): X = X.values index = np.int_(X[:, 1]) index = index.reshape(index.size,) ...
[ "def", "_Kdiag", "(", "self", ",", "X", ")", ":", "#This way is not working, indexes are lost after using k._slice_X", "#index = np.asarray(X, dtype=np.int)", "#index = index.reshape(index.size,)", "if", "hasattr", "(", "X", ",", "'values'", ")", ":", "X", "=", "X", ".", ...
https://github.com/SheffieldML/GPy/blob/bb1bc5088671f9316bc92a46d356734e34c2d5c0/GPy/kern/src/eq_ode1.py#L138-L190
mdiazcl/fuzzbunch-debian
2b76c2249ade83a389ae3badb12a1bd09901fd2c
windows/fuzzbunch/pyreadline/lineeditor/history.py
python
LineHistory.history_search_forward
(self,partial)
return q
Search forward through the history for the string of characters between the start of the current line and the point. This is a non-incremental search. By default, this command is unbound.
Search forward through the history for the string of characters between the start of the current line and the point. This is a non-incremental search. By default, this command is unbound.
[ "Search", "forward", "through", "the", "history", "for", "the", "string", "of", "characters", "between", "the", "start", "of", "the", "current", "line", "and", "the", "point", ".", "This", "is", "a", "non", "-", "incremental", "search", ".", "By", "default...
def history_search_forward(self,partial): # () '''Search forward through the history for the string of characters between the start of the current line and the point. This is a non-incremental search. By default, this command is unbound.''' q= self._search(1,partial) return q
[ "def", "history_search_forward", "(", "self", ",", "partial", ")", ":", "# ()", "q", "=", "self", ".", "_search", "(", "1", ",", "partial", ")", "return", "q" ]
https://github.com/mdiazcl/fuzzbunch-debian/blob/2b76c2249ade83a389ae3badb12a1bd09901fd2c/windows/fuzzbunch/pyreadline/lineeditor/history.py#L220-L225
humiaozuzu/YaH3C
c0d873c6ca998aa6d04fa89d3034c4d18981d26b
yah3c/colorama/ansitowin32.py
python
AnsiToWin32.write
(self, text)
[]
def write(self, text): if self.strip or self.convert: self.write_and_convert(text) else: self.wrapped.write(text) self.wrapped.flush() if self.autoreset: self.reset_all()
[ "def", "write", "(", "self", ",", "text", ")", ":", "if", "self", ".", "strip", "or", "self", ".", "convert", ":", "self", ".", "write_and_convert", "(", "text", ")", "else", ":", "self", ".", "wrapped", ".", "write", "(", "text", ")", "self", ".",...
https://github.com/humiaozuzu/YaH3C/blob/c0d873c6ca998aa6d04fa89d3034c4d18981d26b/yah3c/colorama/ansitowin32.py#L113-L120
pika/pika
12dcdf15d0932c388790e0fa990810bfd21b1a32
pika/adapters/blocking_connection.py
python
BlockingChannel.confirm_delivery
(self)
Turn on RabbitMQ-proprietary Confirm mode in the channel. For more information see: https://www.rabbitmq.com/confirms.html
Turn on RabbitMQ-proprietary Confirm mode in the channel.
[ "Turn", "on", "RabbitMQ", "-", "proprietary", "Confirm", "mode", "in", "the", "channel", "." ]
def confirm_delivery(self): """Turn on RabbitMQ-proprietary Confirm mode in the channel. For more information see: https://www.rabbitmq.com/confirms.html """ if self._delivery_confirmation: LOGGER.error( 'confirm_delivery: confirmation was already...
[ "def", "confirm_delivery", "(", "self", ")", ":", "if", "self", ".", "_delivery_confirmation", ":", "LOGGER", ".", "error", "(", "'confirm_delivery: confirmation was already enabled '", "'on channel=%s'", ",", "self", ".", "channel_number", ")", "return", "with", "_Ca...
https://github.com/pika/pika/blob/12dcdf15d0932c388790e0fa990810bfd21b1a32/pika/adapters/blocking_connection.py#L2317-L2341
openedx/edx-platform
68dd185a0ab45862a2a61e0f803d7e03d2be71b5
common/djangoapps/third_party_auth/admin.py
python
SAMLProviderConfigAdmin.archive_provider_configuration
(self, request, queryset)
Archived the selected provider configurations.
Archived the selected provider configurations.
[ "Archived", "the", "selected", "provider", "configurations", "." ]
def archive_provider_configuration(self, request, queryset): """ Archived the selected provider configurations. """ with transaction.atomic(): for obj in queryset: self.model.objects.filter(pk=obj.pk).update(archived=True, enabled=False) self.message_u...
[ "def", "archive_provider_configuration", "(", "self", ",", "request", ",", "queryset", ")", ":", "with", "transaction", ".", "atomic", "(", ")", ":", "for", "obj", "in", "queryset", ":", "self", ".", "model", ".", "objects", ".", "filter", "(", "pk", "="...
https://github.com/openedx/edx-platform/blob/68dd185a0ab45862a2a61e0f803d7e03d2be71b5/common/djangoapps/third_party_auth/admin.py#L61-L68
dimagi/commcare-hq
d67ff1d3b4c51fa050c19e60c3253a79d3452a39
corehq/apps/userreports/data_source_providers.py
python
MockDataSourceProvider.__init__
(self, data_sources_by_domain=None, referenced_doc_type=None)
[]
def __init__(self, data_sources_by_domain=None, referenced_doc_type=None): self.referenced_doc_type = referenced_doc_type self.data_sources_by_domain = data_sources_by_domain or {}
[ "def", "__init__", "(", "self", ",", "data_sources_by_domain", "=", "None", ",", "referenced_doc_type", "=", "None", ")", ":", "self", ".", "referenced_doc_type", "=", "referenced_doc_type", "self", ".", "data_sources_by_domain", "=", "data_sources_by_domain", "or", ...
https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/userreports/data_source_providers.py#L73-L75
mesalock-linux/mesapy
ed546d59a21b36feb93e2309d5c6b75aa0ad95c9
lib-python/2.7/lib-tk/Tkinter.py
python
Misc.clipboard_append
(self, string, **kw)
Append STRING to the Tk clipboard. A widget specified at the optional displayof keyword argument specifies the target display. The clipboard can be retrieved with selection_get.
Append STRING to the Tk clipboard.
[ "Append", "STRING", "to", "the", "Tk", "clipboard", "." ]
def clipboard_append(self, string, **kw): """Append STRING to the Tk clipboard. A widget specified at the optional displayof keyword argument specifies the target display. The clipboard can be retrieved with selection_get.""" if 'displayof' not in kw: kw['displayof'] = self._w ...
[ "def", "clipboard_append", "(", "self", ",", "string", ",", "*", "*", "kw", ")", ":", "if", "'displayof'", "not", "in", "kw", ":", "kw", "[", "'displayof'", "]", "=", "self", ".", "_w", "self", ".", "tk", ".", "call", "(", "(", "'clipboard'", ",", ...
https://github.com/mesalock-linux/mesapy/blob/ed546d59a21b36feb93e2309d5c6b75aa0ad95c9/lib-python/2.7/lib-tk/Tkinter.py#L657-L665
NeuroTechX/moabb
c60881e5da05e533cdca6dfdae56e10e34e816aa
moabb/paradigms/ssvep.py
python
BaseSSVEP.datasets
(self)
return utils.dataset_search( paradigm="ssvep", events=self.events, # total_classes=self.n_classes, interval=interval, has_all_events=True, )
[]
def datasets(self): if self.tmax is None: interval = None else: interval = self.tmax - self.tmin return utils.dataset_search( paradigm="ssvep", events=self.events, # total_classes=self.n_classes, interval=interval, ...
[ "def", "datasets", "(", "self", ")", ":", "if", "self", ".", "tmax", "is", "None", ":", "interval", "=", "None", "else", ":", "interval", "=", "self", ".", "tmax", "-", "self", ".", "tmin", "return", "utils", ".", "dataset_search", "(", "paradigm", "...
https://github.com/NeuroTechX/moabb/blob/c60881e5da05e533cdca6dfdae56e10e34e816aa/moabb/paradigms/ssvep.py#L135-L146
SciTools/iris
a12d0b15bab3377b23a148e891270b13a0419c38
lib/iris/fileformats/nimrod_load_rules.py
python
units
(cube, field)
Set the cube's units from the field. Takes into account nimrod unit strings of the form unit*?? where the data needs to converted by dividing by ??. Also converts units we know Iris can't handle into appropriate units Iris can handle. This is mostly when there is an inappropriate capital letter in the ...
Set the cube's units from the field.
[ "Set", "the", "cube", "s", "units", "from", "the", "field", "." ]
def units(cube, field): """ Set the cube's units from the field. Takes into account nimrod unit strings of the form unit*?? where the data needs to converted by dividing by ??. Also converts units we know Iris can't handle into appropriate units Iris can handle. This is mostly when there is an ...
[ "def", "units", "(", "cube", ",", "field", ")", ":", "unit_exception_dictionary", "=", "{", "\"Knts\"", ":", "\"knots\"", ",", "\"knts\"", ":", "\"knots\"", ",", "\"J/Kg\"", ":", "\"J/kg\"", ",", "\"logical\"", ":", "\"1\"", ",", "\"Code\"", ":", "\"1\"", ...
https://github.com/SciTools/iris/blob/a12d0b15bab3377b23a148e891270b13a0419c38/lib/iris/fileformats/nimrod_load_rules.py#L96-L185
largelymfs/topical_word_embeddings
1ae3d15d0afcd3fcd39cc81eec4ad9463413a9f6
TWE-2/gensim/models/lsimodel.py
python
clip_spectrum
(s, k, discard=0.001)
return k
Given eigenvalues `s`, return how many factors should be kept to avoid storing spurious (tiny, numerically instable) values. This will ignore the tail of the spectrum with relative combined mass < min(`discard`, 1/k). The returned value is clipped against `k` (= never return more than `k`).
Given eigenvalues `s`, return how many factors should be kept to avoid storing spurious (tiny, numerically instable) values.
[ "Given", "eigenvalues", "s", "return", "how", "many", "factors", "should", "be", "kept", "to", "avoid", "storing", "spurious", "(", "tiny", "numerically", "instable", ")", "values", "." ]
def clip_spectrum(s, k, discard=0.001): """ Given eigenvalues `s`, return how many factors should be kept to avoid storing spurious (tiny, numerically instable) values. This will ignore the tail of the spectrum with relative combined mass < min(`discard`, 1/k). The returned value is clipped agains...
[ "def", "clip_spectrum", "(", "s", ",", "k", ",", "discard", "=", "0.001", ")", ":", "# compute relative contribution of eigenvalues towards the energy spectrum", "rel_spectrum", "=", "numpy", ".", "abs", "(", "1.0", "-", "numpy", ".", "cumsum", "(", "s", "/", "n...
https://github.com/largelymfs/topical_word_embeddings/blob/1ae3d15d0afcd3fcd39cc81eec4ad9463413a9f6/TWE-2/gensim/models/lsimodel.py#L74-L90
mesalock-linux/mesapy
ed546d59a21b36feb93e2309d5c6b75aa0ad95c9
lib-python/2.7/cookielib.py
python
CookieJar.add_cookie_header
(self, request)
Add correct Cookie: header to request (urllib2.Request object). The Cookie2 header is also added unless policy.hide_cookie2 is true.
Add correct Cookie: header to request (urllib2.Request object).
[ "Add", "correct", "Cookie", ":", "header", "to", "request", "(", "urllib2", ".", "Request", "object", ")", "." ]
def add_cookie_header(self, request): """Add correct Cookie: header to request (urllib2.Request object). The Cookie2 header is also added unless policy.hide_cookie2 is true. """ _debug("add_cookie_header") self._cookies_lock.acquire() try: self._policy._now...
[ "def", "add_cookie_header", "(", "self", ",", "request", ")", ":", "_debug", "(", "\"add_cookie_header\"", ")", "self", ".", "_cookies_lock", ".", "acquire", "(", ")", "try", ":", "self", ".", "_policy", ".", "_now", "=", "self", ".", "_now", "=", "int",...
https://github.com/mesalock-linux/mesapy/blob/ed546d59a21b36feb93e2309d5c6b75aa0ad95c9/lib-python/2.7/cookielib.py#L1328-L1359
edfungus/Crouton
ada98b3930192938a48909072b45cb84b945f875
clients/python_clients/venv/lib/python2.7/site-packages/pip/vcs/__init__.py
python
VersionControl.get_src_requirement
(self, dist, location, find_tags=False)
Return a string representing the requirement needed to redownload the files currently present in location, something like: {repository_url}@{revision}#egg={project_name}-{version_identifier} If find_tags is True, try to find a tag matching the revision
Return a string representing the requirement needed to redownload the files currently present in location, something like: {repository_url}
[ "Return", "a", "string", "representing", "the", "requirement", "needed", "to", "redownload", "the", "files", "currently", "present", "in", "location", "something", "like", ":", "{", "repository_url", "}" ]
def get_src_requirement(self, dist, location, find_tags=False): """ Return a string representing the requirement needed to redownload the files currently present in location, something like: {repository_url}@{revision}#egg={project_name}-{version_identifier} If find_tag...
[ "def", "get_src_requirement", "(", "self", ",", "dist", ",", "location", ",", "find_tags", "=", "False", ")", ":", "raise", "NotImplementedError" ]
https://github.com/edfungus/Crouton/blob/ada98b3930192938a48909072b45cb84b945f875/clients/python_clients/venv/lib/python2.7/site-packages/pip/vcs/__init__.py#L277-L285
caktus/django-timepiece
52515dec027664890efbc535429e1ba1ee152f40
timepiece/templatetags/timepiece_tags.py
python
add_timezone
(date, tz=None)
return utils.add_timezone(date, tz)
Return the given date with timezone added.
Return the given date with timezone added.
[ "Return", "the", "given", "date", "with", "timezone", "added", "." ]
def add_timezone(date, tz=None): """Return the given date with timezone added.""" return utils.add_timezone(date, tz)
[ "def", "add_timezone", "(", "date", ",", "tz", "=", "None", ")", ":", "return", "utils", ".", "add_timezone", "(", "date", ",", "tz", ")" ]
https://github.com/caktus/django-timepiece/blob/52515dec027664890efbc535429e1ba1ee152f40/timepiece/templatetags/timepiece_tags.py#L45-L47
n1nj4sec/pupy
a5d766ea81fdfe3bc2c38c9bdaf10e9b75af3b39
pupy/packages/linux/all/linux_stealth.py
python
run
(port=None)
[]
def run(port=None): if port is None: raise Exception("pupy connect back port couldn't be found, please precise it manually") print "hidding port %s ..."%port a=subprocess.check_output(["netstat", "-tn"]) if port in a: def cmd_exists(cmd): return subprocess.call("type " + cm...
[ "def", "run", "(", "port", "=", "None", ")", ":", "if", "port", "is", "None", ":", "raise", "Exception", "(", "\"pupy connect back port couldn't be found, please precise it manually\"", ")", "print", "\"hidding port %s ...\"", "%", "port", "a", "=", "subprocess", "....
https://github.com/n1nj4sec/pupy/blob/a5d766ea81fdfe3bc2c38c9bdaf10e9b75af3b39/pupy/packages/linux/all/linux_stealth.py#L8-L45
bstriner/keras-adversarial
6651cfad771f72521c78a5cc3a23a2313efeaa88
keras_adversarial/adversarial_utils.py
python
gan_targets_hinge
(n)
return [generator_fake, generator_real, discriminator_fake, discriminator_real]
Standard training targets for hinge loss [generator_fake, generator_real, discriminator_fake, discriminator_real] = [1, -1, -1, 1] :param n: number of samples :return: array of targets
Standard training targets for hinge loss [generator_fake, generator_real, discriminator_fake, discriminator_real] = [1, -1, -1, 1] :param n: number of samples :return: array of targets
[ "Standard", "training", "targets", "for", "hinge", "loss", "[", "generator_fake", "generator_real", "discriminator_fake", "discriminator_real", "]", "=", "[", "1", "-", "1", "-", "1", "1", "]", ":", "param", "n", ":", "number", "of", "samples", ":", "return"...
def gan_targets_hinge(n): """ Standard training targets for hinge loss [generator_fake, generator_real, discriminator_fake, discriminator_real] = [1, -1, -1, 1] :param n: number of samples :return: array of targets """ generator_fake = np.ones((n, 1)) generator_real = np.ones((n, 1)) * -...
[ "def", "gan_targets_hinge", "(", "n", ")", ":", "generator_fake", "=", "np", ".", "ones", "(", "(", "n", ",", "1", ")", ")", "generator_real", "=", "np", ".", "ones", "(", "(", "n", ",", "1", ")", ")", "*", "-", "1", "discriminator_fake", "=", "n...
https://github.com/bstriner/keras-adversarial/blob/6651cfad771f72521c78a5cc3a23a2313efeaa88/keras_adversarial/adversarial_utils.py#L94-L105
mwouts/jupytext
f8e8352859cc22e17b11154d0770fd946c4a430a
jupytext/myst.py
python
myst_version
()
return 0.13
The version of myst.
The version of myst.
[ "The", "version", "of", "myst", "." ]
def myst_version(): """The version of myst.""" return 0.13
[ "def", "myst_version", "(", ")", ":", "return", "0.13" ]
https://github.com/mwouts/jupytext/blob/f8e8352859cc22e17b11154d0770fd946c4a430a/jupytext/myst.py#L40-L42
1040003585/WebScrapingWithPython
a770fa5b03894076c8c9539b1ffff34424ffc016
portia_examle/lib/python2.7/site-packages/pip/_vendor/distlib/markers.py
python
Evaluator.evaluate
(self, node, filename=None)
return handler(node)
Evaluate a source string or node, using ``filename`` when displaying errors.
Evaluate a source string or node, using ``filename`` when displaying errors.
[ "Evaluate", "a", "source", "string", "or", "node", "using", "filename", "when", "displaying", "errors", "." ]
def evaluate(self, node, filename=None): """ Evaluate a source string or node, using ``filename`` when displaying errors. """ if isinstance(node, string_types): self.source = node kwargs = {'mode': 'eval'} if filename: kwargs['f...
[ "def", "evaluate", "(", "self", ",", "node", ",", "filename", "=", "None", ")", ":", "if", "isinstance", "(", "node", ",", "string_types", ")", ":", "self", ".", "source", "=", "node", "kwargs", "=", "{", "'mode'", ":", "'eval'", "}", "if", "filename...
https://github.com/1040003585/WebScrapingWithPython/blob/a770fa5b03894076c8c9539b1ffff34424ffc016/portia_examle/lib/python2.7/site-packages/pip/_vendor/distlib/markers.py#L76-L100
lbryio/lbry-sdk
f78e3825ca0f130834d3876a824f9d380501ced8
lbry/wallet/server/daemon.py
python
Daemon.broadcast_transaction
(self, raw_tx)
return await self._send_single('sendrawtransaction', (raw_tx, ))
Broadcast a transaction to the network.
Broadcast a transaction to the network.
[ "Broadcast", "a", "transaction", "to", "the", "network", "." ]
async def broadcast_transaction(self, raw_tx): """Broadcast a transaction to the network.""" return await self._send_single('sendrawtransaction', (raw_tx, ))
[ "async", "def", "broadcast_transaction", "(", "self", ",", "raw_tx", ")", ":", "return", "await", "self", ".", "_send_single", "(", "'sendrawtransaction'", ",", "(", "raw_tx", ",", ")", ")" ]
https://github.com/lbryio/lbry-sdk/blob/f78e3825ca0f130834d3876a824f9d380501ced8/lbry/wallet/server/daemon.py#L306-L308
fonttools/fonttools
892322aaff6a89bea5927379ec06bc0da3dfb7df
Lib/fontTools/ttLib/tables/otBase.py
python
OTTableWriter.writeCountReference
(self, table, name, size=2, value=None)
return ref
[]
def writeCountReference(self, table, name, size=2, value=None): ref = CountReference(table, name, size=size, value=value) self.items.append(ref) return ref
[ "def", "writeCountReference", "(", "self", ",", "table", ",", "name", ",", "size", "=", "2", ",", "value", "=", "None", ")", ":", "ref", "=", "CountReference", "(", "table", ",", "name", ",", "size", "=", "size", ",", "value", "=", "value", ")", "s...
https://github.com/fonttools/fonttools/blob/892322aaff6a89bea5927379ec06bc0da3dfb7df/Lib/fontTools/ttLib/tables/otBase.py#L500-L503
MenglinLu/Chinese-clinical-NER
9614593ee2e1ba38d0985c44e957d316e178b93c
word2vec_bilstm_crf/predict_bilstm_crf.py
python
get_entity_index
(X_data, y_data, file_path)
return entity_list
:param X_data: 以character_level text列表为元素的列表 :param y_data: 以entity列表为元素的列表 :return: [{'entity': [phrase or word], ....}, ...]
:param X_data: 以character_level text列表为元素的列表 :param y_data: 以entity列表为元素的列表 :return: [{'entity': [phrase or word], ....}, ...]
[ ":", "param", "X_data", ":", "以character_level", "text列表为元素的列表", ":", "param", "y_data", ":", "以entity列表为元素的列表", ":", "return", ":", "[", "{", "entity", ":", "[", "phrase", "or", "word", "]", "....", "}", "...", "]" ]
def get_entity_index(X_data, y_data, file_path): """ :param X_data: 以character_level text列表为元素的列表 :param y_data: 以entity列表为元素的列表 :return: [{'entity': [phrase or word], ....}, ...] """ n_example = len(X_data) entity_list = [] entity_name = '' # for i in range(n_example): d...
[ "def", "get_entity_index", "(", "X_data", ",", "y_data", ",", "file_path", ")", ":", "n_example", "=", "len", "(", "X_data", ")", "entity_list", "=", "[", "]", "entity_name", "=", "''", "# ", "for", "i", "in", "range", "(", "n_example", ")", ":", "d...
https://github.com/MenglinLu/Chinese-clinical-NER/blob/9614593ee2e1ba38d0985c44e957d316e178b93c/word2vec_bilstm_crf/predict_bilstm_crf.py#L41-L89
linxid/Machine_Learning_Study_Path
558e82d13237114bbb8152483977806fc0c222af
Machine Learning In Action/Chapter4-NaiveBayes/venv/Lib/collections/__init__.py
python
Counter.__and__
(self, other)
return result
Intersection is the minimum of corresponding counts. >>> Counter('abbb') & Counter('bcc') Counter({'b': 1})
Intersection is the minimum of corresponding counts.
[ "Intersection", "is", "the", "minimum", "of", "corresponding", "counts", "." ]
def __and__(self, other): ''' Intersection is the minimum of corresponding counts. >>> Counter('abbb') & Counter('bcc') Counter({'b': 1}) ''' if not isinstance(other, Counter): return NotImplemented result = Counter() for elem, count in self.items():...
[ "def", "__and__", "(", "self", ",", "other", ")", ":", "if", "not", "isinstance", "(", "other", ",", "Counter", ")", ":", "return", "NotImplemented", "result", "=", "Counter", "(", ")", "for", "elem", ",", "count", "in", "self", ".", "items", "(", ")...
https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter4-NaiveBayes/venv/Lib/collections/__init__.py#L749-L764
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
openshift/installer/vendored/openshift-ansible-3.10.0-0.29.0/roles/lib_openshift/library/oc_pvc.py
python
PersistentVolumeClaim.__init__
(self, content)
PersistentVolumeClaim constructor
PersistentVolumeClaim constructor
[ "PersistentVolumeClaim", "constructor" ]
def __init__(self, content): '''PersistentVolumeClaim constructor''' super(PersistentVolumeClaim, self).__init__(content=content) self._access_modes = None self._volume_capacity = None self._volume_name = None self._selector = None self._storage_class_name = None
[ "def", "__init__", "(", "self", ",", "content", ")", ":", "super", "(", "PersistentVolumeClaim", ",", "self", ")", ".", "__init__", "(", "content", "=", "content", ")", "self", ".", "_access_modes", "=", "None", "self", ".", "_volume_capacity", "=", "None"...
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.10.0-0.29.0/roles/lib_openshift/library/oc_pvc.py#L1542-L1549
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
openshift/installer/vendored/openshift-ansible-3.11.28-1/roles/lib_vendored_deps/library/oc_adm_policy_group.py
python
SecurityContextConstraints.get_users
(self)
return self.get(SecurityContextConstraints.users_path) or []
get scc users
get scc users
[ "get", "scc", "users" ]
def get_users(self): '''get scc users''' return self.get(SecurityContextConstraints.users_path) or []
[ "def", "get_users", "(", "self", ")", ":", "return", "self", ".", "get", "(", "SecurityContextConstraints", ".", "users_path", ")", "or", "[", "]" ]
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.11.28-1/roles/lib_vendored_deps/library/oc_adm_policy_group.py#L1894-L1896
gramps-project/gramps
04d4651a43eb210192f40a9f8c2bad8ee8fa3753
gramps/gen/sort.py
python
Sort.by_sorted_name_key
(self, first_id)
return glocale.sort_key(name1)
Sort routine for comparing two displayed names.
Sort routine for comparing two displayed names.
[ "Sort", "routine", "for", "comparing", "two", "displayed", "names", "." ]
def by_sorted_name_key(self, first_id): """ Sort routine for comparing two displayed names. """ first = self.database.get_person_from_handle(first_id) name1 = _nd.sorted(first) return glocale.sort_key(name1)
[ "def", "by_sorted_name_key", "(", "self", ",", "first_id", ")", ":", "first", "=", "self", ".", "database", ".", "get_person_from_handle", "(", "first_id", ")", "name1", "=", "_nd", ".", "sorted", "(", "first", ")", "return", "glocale", ".", "sort_key", "(...
https://github.com/gramps-project/gramps/blob/04d4651a43eb210192f40a9f8c2bad8ee8fa3753/gramps/gen/sort.py#L105-L114
unkn0wnh4ckr/hackers-tool-kit
34dbabf3e94825684fd1a684f522d3dc3565eb2d
plugins/discovery/IPy.py
python
IPint.strHex
(self, wantprefixlen=None)
return x + self._printPrefix(wantprefixlen)
Return a string representation in hex format. >>> print IP('127.0.0.1').strHex() 0x7F000001 >>> print IP('2001:0658:022a:cafe:0200::1').strHex() 0x20010658022ACAFE0200000000000001
Return a string representation in hex format.
[ "Return", "a", "string", "representation", "in", "hex", "format", "." ]
def strHex(self, wantprefixlen=None): """Return a string representation in hex format. >>> print IP('127.0.0.1').strHex() 0x7F000001 >>> print IP('2001:0658:022a:cafe:0200::1').strHex() 0x20010658022ACAFE0200000000000001 """ if self.WantPrefixLen is None and wan...
[ "def", "strHex", "(", "self", ",", "wantprefixlen", "=", "None", ")", ":", "if", "self", ".", "WantPrefixLen", "is", "None", "and", "wantprefixlen", "is", "None", ":", "wantprefixlen", "=", "0", "x", "=", "hex", "(", "self", ".", "ip", ")", "if", "x"...
https://github.com/unkn0wnh4ckr/hackers-tool-kit/blob/34dbabf3e94825684fd1a684f522d3dc3565eb2d/plugins/discovery/IPy.py#L495-L510
romanz/trezor-agent
23f8ef09a5b8eda2187b6883487d7ce0d9bd0b5e
libagent/util.py
python
crc24
(blob)
return crc_bytes[1:]
See https://tools.ietf.org/html/rfc4880#section-6.1 for details.
See https://tools.ietf.org/html/rfc4880#section-6.1 for details.
[ "See", "https", ":", "//", "tools", ".", "ietf", ".", "org", "/", "html", "/", "rfc4880#section", "-", "6", ".", "1", "for", "details", "." ]
def crc24(blob): """See https://tools.ietf.org/html/rfc4880#section-6.1 for details.""" CRC24_INIT = 0x0B704CE CRC24_POLY = 0x1864CFB crc = CRC24_INIT for octet in bytearray(blob): crc ^= (octet << 16) for _ in range(8): crc <<= 1 if crc & 0x1000000: ...
[ "def", "crc24", "(", "blob", ")", ":", "CRC24_INIT", "=", "0x0B704CE", "CRC24_POLY", "=", "0x1864CFB", "crc", "=", "CRC24_INIT", "for", "octet", "in", "bytearray", "(", "blob", ")", ":", "crc", "^=", "(", "octet", "<<", "16", ")", "for", "_", "in", "...
https://github.com/romanz/trezor-agent/blob/23f8ef09a5b8eda2187b6883487d7ce0d9bd0b5e/libagent/util.py#L87-L102
carlio/django-flows
326baa3e216a15bd7a8d13b2a09ba9752e250dbb
flows/handler.py
python
FlowPositionInstance.position_instance_for
(self, component_class_or_name)
return new_position.create_instance(self._state, self.state_store, self._url_args, self._url_kwargs)
[]
def position_instance_for(self, component_class_or_name): # figure out where we're being sent to FC = get_by_class_or_name(component_class_or_name) # it should be a sibling of one of the current items # for example, if we are in position [A,B,E]: # # A ...
[ "def", "position_instance_for", "(", "self", ",", "component_class_or_name", ")", ":", "# figure out where we're being sent to", "FC", "=", "get_by_class_or_name", "(", "component_class_or_name", ")", "# it should be a sibling of one of the current items", "# for example, if we are i...
https://github.com/carlio/django-flows/blob/326baa3e216a15bd7a8d13b2a09ba9752e250dbb/flows/handler.py#L422-L462
dgorissen/pycel
6ce2bc2418b9b1d9127ca0a4495d5bb303d2dbb4
src/pycel/excelwrapper.py
python
ExcelOpxWrapper.table
(self, table_name)
return self._tables.get(table_name.lower(), self._tables[None])
Return the table and the sheet it was found on :param table_name: name of table to retrieve :return: table, sheet_name
Return the table and the sheet it was found on
[ "Return", "the", "table", "and", "the", "sheet", "it", "was", "found", "on" ]
def table(self, table_name): """ Return the table and the sheet it was found on :param table_name: name of table to retrieve :return: table, sheet_name """ # table names are case insensitive if self._tables is None: TableAndSheet = collections.namedtuple( ...
[ "def", "table", "(", "self", ",", "table_name", ")", ":", "# table names are case insensitive", "if", "self", ".", "_tables", "is", "None", ":", "TableAndSheet", "=", "collections", ".", "namedtuple", "(", "'TableAndSheet'", ",", "'table, sheet_name'", ")", "self"...
https://github.com/dgorissen/pycel/blob/6ce2bc2418b9b1d9127ca0a4495d5bb303d2dbb4/src/pycel/excelwrapper.py#L180-L194
deepmind/dm-haiku
c7fa5908f61dec1df3b8e25031987a6dcc07ee9f
haiku/_src/nets/mlp.py
python
MLP.__init__
( self, output_sizes: Iterable[int], w_init: Optional[hk.initializers.Initializer] = None, b_init: Optional[hk.initializers.Initializer] = None, with_bias: bool = True, activation: Callable[[jnp.ndarray], jnp.ndarray] = jax.nn.relu, activate_final: bool = False, name: Opt...
Constructs an MLP. Args: output_sizes: Sequence of layer sizes. w_init: Initializer for :class:`~haiku.Linear` weights. b_init: Initializer for :class:`~haiku.Linear` bias. Must be ``None`` if ``with_bias=False``. with_bias: Whether or not to apply a bias in each layer. activa...
Constructs an MLP.
[ "Constructs", "an", "MLP", "." ]
def __init__( self, output_sizes: Iterable[int], w_init: Optional[hk.initializers.Initializer] = None, b_init: Optional[hk.initializers.Initializer] = None, with_bias: bool = True, activation: Callable[[jnp.ndarray], jnp.ndarray] = jax.nn.relu, activate_final: bool = False, ...
[ "def", "__init__", "(", "self", ",", "output_sizes", ":", "Iterable", "[", "int", "]", ",", "w_init", ":", "Optional", "[", "hk", ".", "initializers", ".", "Initializer", "]", "=", "None", ",", "b_init", ":", "Optional", "[", "hk", ".", "initializers", ...
https://github.com/deepmind/dm-haiku/blob/c7fa5908f61dec1df3b8e25031987a6dcc07ee9f/haiku/_src/nets/mlp.py#L41-L85
LiuXingMing/Scrapy_Redis_Bloomfilter
6608c9188f7a1738e2b4265324079898d61f8447
scrapyWithBloomfilter_demo/scrapyWithBloomfilter_demo/scrapy_redis/pipelines.py
python
RedisPipeline.from_crawler
(cls, crawler)
return cls.from_settings(crawler.settings)
[]
def from_crawler(cls, crawler): return cls.from_settings(crawler.settings)
[ "def", "from_crawler", "(", "cls", ",", "crawler", ")", ":", "return", "cls", ".", "from_settings", "(", "crawler", ".", "settings", ")" ]
https://github.com/LiuXingMing/Scrapy_Redis_Bloomfilter/blob/6608c9188f7a1738e2b4265324079898d61f8447/scrapyWithBloomfilter_demo/scrapyWithBloomfilter_demo/scrapy_redis/pipelines.py#L20-L21
msracver/Deep-Feature-Flow
297293cbe728f817b62c82d3abfbd226300086ef
dff_rfcn/core/module.py
python
Module.borrow_optimizer
(self, shared_module)
Borrow optimizer from a shared module. Used in bucketing, where exactly the same optimizer (esp. kvstore) is used. Parameters ---------- shared_module : Module
Borrow optimizer from a shared module. Used in bucketing, where exactly the same optimizer (esp. kvstore) is used.
[ "Borrow", "optimizer", "from", "a", "shared", "module", ".", "Used", "in", "bucketing", "where", "exactly", "the", "same", "optimizer", "(", "esp", ".", "kvstore", ")", "is", "used", "." ]
def borrow_optimizer(self, shared_module): """Borrow optimizer from a shared module. Used in bucketing, where exactly the same optimizer (esp. kvstore) is used. Parameters ---------- shared_module : Module """ assert shared_module.optimizer_initialized se...
[ "def", "borrow_optimizer", "(", "self", ",", "shared_module", ")", ":", "assert", "shared_module", ".", "optimizer_initialized", "self", ".", "_optimizer", "=", "shared_module", ".", "_optimizer", "self", ".", "_kvstore", "=", "shared_module", ".", "_kvstore", "se...
https://github.com/msracver/Deep-Feature-Flow/blob/297293cbe728f817b62c82d3abfbd226300086ef/dff_rfcn/core/module.py#L527-L540
beeware/ouroboros
a29123c6fab6a807caffbb7587cf548e0c370296
ouroboros/lib2to3/pytree.py
python
Node.set_child
(self, i, child)
Equivalent to 'node.children[i] = child'. This method also sets the child's parent attribute appropriately.
Equivalent to 'node.children[i] = child'. This method also sets the child's parent attribute appropriately.
[ "Equivalent", "to", "node", ".", "children", "[", "i", "]", "=", "child", ".", "This", "method", "also", "sets", "the", "child", "s", "parent", "attribute", "appropriately", "." ]
def set_child(self, i, child): """ Equivalent to 'node.children[i] = child'. This method also sets the child's parent attribute appropriately. """ child.parent = self self.children[i].parent = None self.children[i] = child self.changed()
[ "def", "set_child", "(", "self", ",", "i", ",", "child", ")", ":", "child", ".", "parent", "=", "self", "self", ".", "children", "[", "i", "]", ".", "parent", "=", "None", "self", ".", "children", "[", "i", "]", "=", "child", "self", ".", "change...
https://github.com/beeware/ouroboros/blob/a29123c6fab6a807caffbb7587cf548e0c370296/ouroboros/lib2to3/pytree.py#L289-L297
WerWolv/EdiZon_CheatsConfigsAndScripts
d16d36c7509c01dca770f402babd83ff2e9ae6e7
Scripts/lib/python3.5/imaplib.py
python
IMAP4.getquota
(self, root)
return self._untagged_response(typ, dat, 'QUOTA')
Get the quota root's resource usage and limits. Part of the IMAP4 QUOTA extension defined in rfc2087. (typ, [data]) = <instance>.getquota(root)
Get the quota root's resource usage and limits.
[ "Get", "the", "quota", "root", "s", "resource", "usage", "and", "limits", "." ]
def getquota(self, root): """Get the quota root's resource usage and limits. Part of the IMAP4 QUOTA extension defined in rfc2087. (typ, [data]) = <instance>.getquota(root) """ typ, dat = self._simple_command('GETQUOTA', root) return self._untagged_response(typ, dat, 'Q...
[ "def", "getquota", "(", "self", ",", "root", ")", ":", "typ", ",", "dat", "=", "self", ".", "_simple_command", "(", "'GETQUOTA'", ",", "root", ")", "return", "self", ".", "_untagged_response", "(", "typ", ",", "dat", ",", "'QUOTA'", ")" ]
https://github.com/WerWolv/EdiZon_CheatsConfigsAndScripts/blob/d16d36c7509c01dca770f402babd83ff2e9ae6e7/Scripts/lib/python3.5/imaplib.py#L539-L547
neozhaoliang/pywonderland
4fc110ba2e7db7db0a0d89369f02c479282239db
src/misc/coupling_from_the_past_lozenge.py
python
LozengeTiling.new_random_update
(self)
return ( random.randint(1, c), # a random path random.randint(1, a + b - 1), # a random position in this path random.randint(0, 1), )
Return a new update operation.
Return a new update operation.
[ "Return", "a", "new", "update", "operation", "." ]
def new_random_update(self): """ Return a new update operation. """ a, b, c = self.size return ( random.randint(1, c), # a random path random.randint(1, a + b - 1), # a random position in this path random.randint(0, 1), )
[ "def", "new_random_update", "(", "self", ")", ":", "a", ",", "b", ",", "c", "=", "self", ".", "size", "return", "(", "random", ".", "randint", "(", "1", ",", "c", ")", ",", "# a random path", "random", ".", "randint", "(", "1", ",", "a", "+", "b"...
https://github.com/neozhaoliang/pywonderland/blob/4fc110ba2e7db7db0a0d89369f02c479282239db/src/misc/coupling_from_the_past_lozenge.py#L147-L156
uwdata/termite-data-server
1085571407c627bdbbd21c352e793fed65d09599
web2py/gluon/contrib/fpdf/fpdf.py
python
FPDF.add_font
(self, family, style='', fname='', uni=False)
Add a TrueType or Type1 font
Add a TrueType or Type1 font
[ "Add", "a", "TrueType", "or", "Type1", "font" ]
def add_font(self, family, style='', fname='', uni=False): "Add a TrueType or Type1 font" family = family.lower() if (fname == ''): fname = family.replace(' ','') + style.lower() + '.pkl' if (family == 'arial'): family = 'helvetica' style = style.upper() ...
[ "def", "add_font", "(", "self", ",", "family", ",", "style", "=", "''", ",", "fname", "=", "''", ",", "uni", "=", "False", ")", ":", "family", "=", "family", ".", "lower", "(", ")", "if", "(", "fname", "==", "''", ")", ":", "fname", "=", "famil...
https://github.com/uwdata/termite-data-server/blob/1085571407c627bdbbd21c352e793fed65d09599/web2py/gluon/contrib/fpdf/fpdf.py#L401-L513
bruderstein/PythonScript
df9f7071ddf3a079e3a301b9b53a6dc78cf1208f
PythonLib/min/ssl.py
python
SSLContext._encode_hostname
(self, hostname)
[]
def _encode_hostname(self, hostname): if hostname is None: return None elif isinstance(hostname, str): return hostname.encode('idna').decode('ascii') else: return hostname.decode('ascii')
[ "def", "_encode_hostname", "(", "self", ",", "hostname", ")", ":", "if", "hostname", "is", "None", ":", "return", "None", "elif", "isinstance", "(", "hostname", ",", "str", ")", ":", "return", "hostname", ".", "encode", "(", "'idna'", ")", ".", "decode",...
https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/min/ssl.py#L498-L504
numba/numba
bf480b9e0da858a65508c2b17759a72ee6a44c51
versioneer.py
python
get_versions
(default=DEFAULT, verbose=False)
return default
[]
def get_versions(default=DEFAULT, verbose=False): # returns dict with two keys: 'version' and 'full' assert versionfile_source is not None, \ "please set versioneer.versionfile_source" assert tag_prefix is not None, "please set versioneer.tag_prefix" assert parentdir_prefix is not None, \ ...
[ "def", "get_versions", "(", "default", "=", "DEFAULT", ",", "verbose", "=", "False", ")", ":", "# returns dict with two keys: 'version' and 'full'", "assert", "versionfile_source", "is", "not", "None", ",", "\"please set versioneer.versionfile_source\"", "assert", "tag_pref...
https://github.com/numba/numba/blob/bf480b9e0da858a65508c2b17759a72ee6a44c51/versioneer.py#L817-L872
pyg-team/pytorch_geometric
b920e9a3a64e22c8356be55301c88444ff051cae
torch_geometric/nn/conv/sage_conv.py
python
SAGEConv.message
(self, x_j: Tensor)
return x_j
[]
def message(self, x_j: Tensor) -> Tensor: return x_j
[ "def", "message", "(", "self", ",", "x_j", ":", "Tensor", ")", "->", "Tensor", ":", "return", "x_j" ]
https://github.com/pyg-team/pytorch_geometric/blob/b920e9a3a64e22c8356be55301c88444ff051cae/torch_geometric/nn/conv/sage_conv.py#L82-L83
krintoxi/NoobSec-Toolkit
38738541cbc03cedb9a3b3ed13b629f781ad64f6
NoobSecToolkit /tools/sqli/thirdparty/bottle/bottle.py
python
ServerAdapter.__init__
(self, host='127.0.0.1', port=8080, **config)
[]
def __init__(self, host='127.0.0.1', port=8080, **config): self.options = config self.host = host self.port = int(port)
[ "def", "__init__", "(", "self", ",", "host", "=", "'127.0.0.1'", ",", "port", "=", "8080", ",", "*", "*", "config", ")", ":", "self", ".", "options", "=", "config", "self", ".", "host", "=", "host", "self", ".", "port", "=", "int", "(", "port", "...
https://github.com/krintoxi/NoobSec-Toolkit/blob/38738541cbc03cedb9a3b3ed13b629f781ad64f6/NoobSecToolkit /tools/sqli/thirdparty/bottle/bottle.py#L2352-L2355
citronneur/rdpy
cef16a9f64d836a3221a344ca7d571644280d829
rdpy/protocol/rdp/sec.py
python
SecLayer.getGCCServerSettings
(self)
return self._transport.getGCCServerSettings()
@return: {gcc.Settings} mcs layer gcc server settings @see: mcs.IGCCConfig
[]
def getGCCServerSettings(self): """ @return: {gcc.Settings} mcs layer gcc server settings @see: mcs.IGCCConfig """ return self._transport.getGCCServerSettings()
[ "def", "getGCCServerSettings", "(", "self", ")", ":", "return", "self", ".", "_transport", ".", "getGCCServerSettings", "(", ")" ]
https://github.com/citronneur/rdpy/blob/cef16a9f64d836a3221a344ca7d571644280d829/rdpy/protocol/rdp/sec.py#L561-L566
pierluigiferrari/ssd_keras
3ac9adaf3889f1020d74b0eeefea281d5e82f353
eval_utils/average_precision_evaluator.py
python
Evaluator.__call__
(self, img_height, img_width, batch_size, data_generator_mode='resize', round_confidences=False, matching_iou_threshold=0.5, border_pixels='include', sorting_algorithm='quicksort', ...
Computes the mean average precision of the given Keras SSD model on the given dataset. Optionally also returns the averages precisions, precisions, and recalls. All the individual steps of the overall evaluation algorithm can also be called separately (check out the other methods of this class...
Computes the mean average precision of the given Keras SSD model on the given dataset.
[ "Computes", "the", "mean", "average", "precision", "of", "the", "given", "Keras", "SSD", "model", "on", "the", "given", "dataset", "." ]
def __call__(self, img_height, img_width, batch_size, data_generator_mode='resize', round_confidences=False, matching_iou_threshold=0.5, border_pixels='include', sorting_algorithm='qui...
[ "def", "__call__", "(", "self", ",", "img_height", ",", "img_width", ",", "batch_size", ",", "data_generator_mode", "=", "'resize'", ",", "round_confidences", "=", "False", ",", "matching_iou_threshold", "=", "0.5", ",", "border_pixels", "=", "'include'", ",", "...
https://github.com/pierluigiferrari/ssd_keras/blob/3ac9adaf3889f1020d74b0eeefea281d5e82f353/eval_utils/average_precision_evaluator.py#L94-L256
buke/GreenOdoo
3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df
runtime/python/lib/python2.7/curses/textpad.py
python
Textbox.edit
(self, validate=None)
return self.gather()
Edit in the widget window and collect the results.
Edit in the widget window and collect the results.
[ "Edit", "in", "the", "widget", "window", "and", "collect", "the", "results", "." ]
def edit(self, validate=None): "Edit in the widget window and collect the results." while 1: ch = self.win.getch() if validate: ch = validate(ch) if not ch: continue if not self.do_command(ch): break ...
[ "def", "edit", "(", "self", ",", "validate", "=", "None", ")", ":", "while", "1", ":", "ch", "=", "self", ".", "win", ".", "getch", "(", ")", "if", "validate", ":", "ch", "=", "validate", "(", "ch", ")", "if", "not", "ch", ":", "continue", "if"...
https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/runtime/python/lib/python2.7/curses/textpad.py#L164-L175
pymc-devs/pymc
38867dd19e96afb0ceccc8ccd74a9795f118dfe3
pymc/model.py
python
Model.logp_dlogp_function
(self, grad_vars=None, tempered=False, **kwargs)
return ValueGradFunction(costs, grad_vars, extra_vars_and_values, **kwargs)
Compile an Aesara function that computes logp and gradient. Parameters ---------- grad_vars: list of random variables, optional Compute the gradient with respect to those variables. If None, use all free random variables of this model. tempered: bool ...
Compile an Aesara function that computes logp and gradient.
[ "Compile", "an", "Aesara", "function", "that", "computes", "logp", "and", "gradient", "." ]
def logp_dlogp_function(self, grad_vars=None, tempered=False, **kwargs): """Compile an Aesara function that computes logp and gradient. Parameters ---------- grad_vars: list of random variables, optional Compute the gradient with respect to those variables. If None, ...
[ "def", "logp_dlogp_function", "(", "self", ",", "grad_vars", "=", "None", ",", "tempered", "=", "False", ",", "*", "*", "kwargs", ")", ":", "if", "grad_vars", "is", "None", ":", "grad_vars", "=", "[", "self", ".", "rvs_to_values", "[", "v", "]", "for",...
https://github.com/pymc-devs/pymc/blob/38867dd19e96afb0ceccc8ccd74a9795f118dfe3/pymc/model.py#L614-L646
andresriancho/w3af
cd22e5252243a87aaa6d0ddea47cf58dacfe00a9
w3af/core/data/db/url_tree.py
python
URLNode.set_is_leaf
(self, is_leaf)
[]
def set_is_leaf(self, is_leaf): self.is_leaf = 1 if is_leaf else 0
[ "def", "set_is_leaf", "(", "self", ",", "is_leaf", ")", ":", "self", ".", "is_leaf", "=", "1", "if", "is_leaf", "else", "0" ]
https://github.com/andresriancho/w3af/blob/cd22e5252243a87aaa6d0ddea47cf58dacfe00a9/w3af/core/data/db/url_tree.py#L51-L52
jgagneastro/coffeegrindsize
22661ebd21831dba4cf32bfc6ba59fe3d49f879c
App/venv/lib/python3.7/site-packages/pip/_vendor/requests/models.py
python
Response.next
(self)
return self._next
Returns a PreparedRequest for the next request in a redirect chain, if there is one.
Returns a PreparedRequest for the next request in a redirect chain, if there is one.
[ "Returns", "a", "PreparedRequest", "for", "the", "next", "request", "in", "a", "redirect", "chain", "if", "there", "is", "one", "." ]
def next(self): """Returns a PreparedRequest for the next request in a redirect chain, if there is one.""" return self._next
[ "def", "next", "(", "self", ")", ":", "return", "self", ".", "_next" ]
https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/venv/lib/python3.7/site-packages/pip/_vendor/requests/models.py#L720-L722
fluentpython/notebooks
0f6e1e8d1686743dacd9281df7c5b5921812010a
attic/sequences/sentence_slice.py
python
SentenceSlice.__init__
(self, text)
[]
def __init__(self, text): self.text = text self.tokens = RE_TOKEN.findall(text) self.words = [t for t in self.tokens if RE_WORD.match(t)] self.word_index = [i for i, t in enumerate(self.tokens) if RE_WORD.match(t)]
[ "def", "__init__", "(", "self", ",", "text", ")", ":", "self", ".", "text", "=", "text", "self", ".", "tokens", "=", "RE_TOKEN", ".", "findall", "(", "text", ")", "self", ".", "words", "=", "[", "t", "for", "t", "in", "self", ".", "tokens", "if",...
https://github.com/fluentpython/notebooks/blob/0f6e1e8d1686743dacd9281df7c5b5921812010a/attic/sequences/sentence_slice.py#L16-L21
sametmax/Django--an-app-at-a-time
99eddf12ead76e6dfbeb09ce0bae61e282e22f8a
ignore_this_directory/django/core/management/color.py
python
no_style
()
return make_style('nocolor')
Return a Style object with no color scheme.
Return a Style object with no color scheme.
[ "Return", "a", "Style", "object", "with", "no", "color", "scheme", "." ]
def no_style(): """ Return a Style object with no color scheme. """ return make_style('nocolor')
[ "def", "no_style", "(", ")", ":", "return", "make_style", "(", "'nocolor'", ")" ]
https://github.com/sametmax/Django--an-app-at-a-time/blob/99eddf12ead76e6dfbeb09ce0bae61e282e22f8a/ignore_this_directory/django/core/management/color.py#L60-L64
inkandswitch/livebook
93c8d467734787366ad084fc3566bf5cbe249c51
public/pypyjs/modules/urllib.py
python
URLopener.addheader
(self, *args)
Add a header to be used by the HTTP interface only e.g. u.addheader('Accept', 'sound/basic')
Add a header to be used by the HTTP interface only e.g. u.addheader('Accept', 'sound/basic')
[ "Add", "a", "header", "to", "be", "used", "by", "the", "HTTP", "interface", "only", "e", ".", "g", ".", "u", ".", "addheader", "(", "Accept", "sound", "/", "basic", ")" ]
def addheader(self, *args): """Add a header to be used by the HTTP interface only e.g. u.addheader('Accept', 'sound/basic')""" self.addheaders.append(args)
[ "def", "addheader", "(", "self", ",", "*", "args", ")", ":", "self", ".", "addheaders", ".", "append", "(", "args", ")" ]
https://github.com/inkandswitch/livebook/blob/93c8d467734787366ad084fc3566bf5cbe249c51/public/pypyjs/modules/urllib.py#L177-L180
gwastro/pycbc
1e1c85534b9dba8488ce42df693230317ca63dea
pycbc/population/scale_injections.py
python
inj_distance_pdf
(key, distance, low_dist, high_dist, mchirp = 1)
Estimate the probability density of the injections for the distance distribution. Parameters ---------- key: string Injections strategy distance: array Array of distances low_dist: float Lower value of distance used in the injection strategy...
Estimate the probability density of the injections for the distance distribution.
[ "Estimate", "the", "probability", "density", "of", "the", "injections", "for", "the", "distance", "distribution", "." ]
def inj_distance_pdf(key, distance, low_dist, high_dist, mchirp = 1): ''' Estimate the probability density of the injections for the distance distribution. Parameters ---------- key: string Injections strategy distance: array Array of distances lo...
[ "def", "inj_distance_pdf", "(", "key", ",", "distance", ",", "low_dist", ",", "high_dist", ",", "mchirp", "=", "1", ")", ":", "distance", "=", "np", ".", "array", "(", "distance", ")", "if", "key", "==", "'uniform'", ":", "# Returns the PDF at a distance whe...
https://github.com/gwastro/pycbc/blob/1e1c85534b9dba8488ce42df693230317ca63dea/pycbc/population/scale_injections.py#L470-L507
iopsgroup/imoocc
de810eb6d4c1697b7139305925a5b0ba21225f3f
scanhosts/modules/paramiko2_1_2/transport.py
python
SecurityOptions.kex
(self)
return self._transport._preferred_kex
Key exchange algorithms
Key exchange algorithms
[ "Key", "exchange", "algorithms" ]
def kex(self): """Key exchange algorithms""" return self._transport._preferred_kex
[ "def", "kex", "(", "self", ")", ":", "return", "self", ".", "_transport", ".", "_preferred_kex" ]
https://github.com/iopsgroup/imoocc/blob/de810eb6d4c1697b7139305925a5b0ba21225f3f/scanhosts/modules/paramiko2_1_2/transport.py#L2456-L2458
hydroshare/hydroshare
7ba563b55412f283047fb3ef6da367d41dec58c6
hs_modelinstance/models.py
python
ExecutedBy.update
(cls, element_id, **kwargs)
[]
def update(cls, element_id, **kwargs): # get the shortid of the selected model program (passed in from javascript) shortid = kwargs['model_name'] # get the MP object that matches. Returns None if nothing is found obj = ModelProgramResource.objects.filter(short_id=shortid).first() ...
[ "def", "update", "(", "cls", ",", "element_id", ",", "*", "*", "kwargs", ")", ":", "# get the shortid of the selected model program (passed in from javascript)", "shortid", "=", "kwargs", "[", "'model_name'", "]", "# get the MP object that matches. Returns None if nothing is f...
https://github.com/hydroshare/hydroshare/blob/7ba563b55412f283047fb3ef6da367d41dec58c6/hs_modelinstance/models.py#L93-L107
CellProfiler/CellProfiler
a90e17e4d258c6f3900238be0f828e0b4bd1b293
cellprofiler/gui/utilities/module_view.py
python
image_control_name
(v)
return "%s_image" % (str(v.key()))
For measurements, return the control that sets the image name v - the setting
For measurements, return the control that sets the image name
[ "For", "measurements", "return", "the", "control", "that", "sets", "the", "image", "name" ]
def image_control_name(v): """For measurements, return the control that sets the image name v - the setting """ return "%s_image" % (str(v.key()))
[ "def", "image_control_name", "(", "v", ")", ":", "return", "\"%s_image\"", "%", "(", "str", "(", "v", ".", "key", "(", ")", ")", ")" ]
https://github.com/CellProfiler/CellProfiler/blob/a90e17e4d258c6f3900238be0f828e0b4bd1b293/cellprofiler/gui/utilities/module_view.py#L104-L109
flasgger/flasgger
beb9fa781fc6b063fe3f3081b9677dd70184a2da
examples/restful.py
python
Todo.put
(self, todo_id)
return task, 201
This is an example --- tags: - restful parameters: - in: body name: body schema: $ref: '#/definitions/Task' - in: path name: todo_id required: true description: The ID of the task, try 42! ...
This is an example --- tags: - restful parameters: - in: body name: body schema: $ref: '#/definitions/Task' - in: path name: todo_id required: true description: The ID of the task, try 42! ...
[ "This", "is", "an", "example", "---", "tags", ":", "-", "restful", "parameters", ":", "-", "in", ":", "body", "name", ":", "body", "schema", ":", "$ref", ":", "#", "/", "definitions", "/", "Task", "-", "in", ":", "path", "name", ":", "todo_id", "re...
def put(self, todo_id): """ This is an example --- tags: - restful parameters: - in: body name: body schema: $ref: '#/definitions/Task' - in: path name: todo_id required: true ...
[ "def", "put", "(", "self", ",", "todo_id", ")", ":", "args", "=", "parser", ".", "parse_args", "(", ")", "task", "=", "{", "'task'", ":", "args", "[", "'task'", "]", "}", "TODOS", "[", "todo_id", "]", "=", "task", "return", "task", ",", "201" ]
https://github.com/flasgger/flasgger/blob/beb9fa781fc6b063fe3f3081b9677dd70184a2da/examples/restful.py#L84-L109
pm4py/pm4py-core
7807b09a088b02199cd0149d724d0e28793971bf
pm4py/visualization/graphs/variants/attributes.py
python
apply_semilogx
(x: List[float], y: List[float], parameters: Optional[Dict[Union[str, Parameters], Any]] = None)
return filename
Plot (semi-logarithmic way) the graph with axis values contained in x and y Parameters ------------ x Values for x-axis y Values for y-axis parameters Parameters of the algorithm, including: Parameters.FORMAT -> Format of the target image Parameters.T...
Plot (semi-logarithmic way) the graph with axis values contained in x and y
[ "Plot", "(", "semi", "-", "logarithmic", "way", ")", "the", "graph", "with", "axis", "values", "contained", "in", "x", "and", "y" ]
def apply_semilogx(x: List[float], y: List[float], parameters: Optional[Dict[Union[str, Parameters], Any]] = None) -> str: """ Plot (semi-logarithmic way) the graph with axis values contained in x and y Parameters ------------ x Values for x-axis y Values for y-axis paramete...
[ "def", "apply_semilogx", "(", "x", ":", "List", "[", "float", "]", ",", "y", ":", "List", "[", "float", "]", ",", "parameters", ":", "Optional", "[", "Dict", "[", "Union", "[", "str", ",", "Parameters", "]", ",", "Any", "]", "]", "=", "None", ")"...
https://github.com/pm4py/pm4py-core/blob/7807b09a088b02199cd0149d724d0e28793971bf/pm4py/visualization/graphs/variants/attributes.py#L85-L127
gramps-project/gramps
04d4651a43eb210192f40a9f8c2bad8ee8fa3753
gramps/gen/plug/docgen/paragraphstyle.py
python
ParagraphStyle.set_right_margin
(self, value)
sets the right indent in centimeters
sets the right indent in centimeters
[ "sets", "the", "right", "indent", "in", "centimeters" ]
def set_right_margin(self, value): "sets the right indent in centimeters" self.rmargin = value
[ "def", "set_right_margin", "(", "self", ",", "value", ")", ":", "self", ".", "rmargin", "=", "value" ]
https://github.com/gramps-project/gramps/blob/04d4651a43eb210192f40a9f8c2bad8ee8fa3753/gramps/gen/plug/docgen/paragraphstyle.py#L307-L309
taomujian/linbing
fe772a58f41e3b046b51a866bdb7e4655abaf51a
python/app/thirdparty/dirsearch/thirdparty/jinja2/compiler.py
python
CodeGenerator._output_child_post
( self, node: nodes.Expr, frame: Frame, finalize: _FinalizeInfo )
Output extra source code after visiting a child of an ``Output`` node.
Output extra source code after visiting a child of an ``Output`` node.
[ "Output", "extra", "source", "code", "after", "visiting", "a", "child", "of", "an", "Output", "node", "." ]
def _output_child_post( self, node: nodes.Expr, frame: Frame, finalize: _FinalizeInfo ) -> None: """Output extra source code after visiting a child of an ``Output`` node. """ self.write(")") if finalize.src is not None: self.write(")")
[ "def", "_output_child_post", "(", "self", ",", "node", ":", "nodes", ".", "Expr", ",", "frame", ":", "Frame", ",", "finalize", ":", "_FinalizeInfo", ")", "->", "None", ":", "self", ".", "write", "(", "\")\"", ")", "if", "finalize", ".", "src", "is", ...
https://github.com/taomujian/linbing/blob/fe772a58f41e3b046b51a866bdb7e4655abaf51a/python/app/thirdparty/dirsearch/thirdparty/jinja2/compiler.py#L1465-L1474
bcbio/bcbio-nextgen
c80f9b6b1be3267d1f981b7035e3b72441d258f2
bcbio/srna/group.py
python
_guess_header
(info)
return value
Add the first group to get report with some factor
Add the first group to get report with some factor
[ "Add", "the", "first", "group", "to", "get", "report", "with", "some", "factor" ]
def _guess_header(info): """Add the first group to get report with some factor""" value = "group" if "metadata" in info: if info["metadata"]: return ",".join(map(str, info["metadata"].keys())) return value
[ "def", "_guess_header", "(", "info", ")", ":", "value", "=", "\"group\"", "if", "\"metadata\"", "in", "info", ":", "if", "info", "[", "\"metadata\"", "]", ":", "return", "\",\"", ".", "join", "(", "map", "(", "str", ",", "info", "[", "\"metadata\"", "]...
https://github.com/bcbio/bcbio-nextgen/blob/c80f9b6b1be3267d1f981b7035e3b72441d258f2/bcbio/srna/group.py#L167-L173
coursera/dataduct
83aea17c1b1abd376270bc8fd4a180ce09181cc5
dataduct/utils/hook.py
python
default_after_hook
(result)
return result
The default after hook, will act like it's not even there
The default after hook, will act like it's not even there
[ "The", "default", "after", "hook", "will", "act", "like", "it", "s", "not", "even", "there" ]
def default_after_hook(result): """The default after hook, will act like it's not even there """ return result
[ "def", "default_after_hook", "(", "result", ")", ":", "return", "result" ]
https://github.com/coursera/dataduct/blob/83aea17c1b1abd376270bc8fd4a180ce09181cc5/dataduct/utils/hook.py#L22-L25
mcw0/PoC
ef712a507a7330f78331997f190717fac9029a9c
Dahua-3DES-IMOU-PoC.py
python
triple_des.setKey
(self, key)
Will set the crypting key for this object. Either 16 or 24 bytes long.
Will set the crypting key for this object. Either 16 or 24 bytes long.
[ "Will", "set", "the", "crypting", "key", "for", "this", "object", ".", "Either", "16", "or", "24", "bytes", "long", "." ]
def setKey(self, key): """Will set the crypting key for this object. Either 16 or 24 bytes long.""" self.key_size = 24 # Use DES-EDE3 mode if len(key) != self.key_size: if len(key) == 16: # Use DES-EDE2 mode self.key_size = 16 self.__key1 = des(key[:8]) self.__key2 = des(key[8:16]) if self.key_size...
[ "def", "setKey", "(", "self", ",", "key", ")", ":", "self", ".", "key_size", "=", "24", "# Use DES-EDE3 mode", "if", "len", "(", "key", ")", "!=", "self", ".", "key_size", ":", "if", "len", "(", "key", ")", "==", "16", ":", "# Use DES-EDE2 mode", "se...
https://github.com/mcw0/PoC/blob/ef712a507a7330f78331997f190717fac9029a9c/Dahua-3DES-IMOU-PoC.py#L1284-L1298
wistbean/learn_python3_spider
73c873f4845f4385f097e5057407d03dd37a117b
stackoverflow/venv/lib/python3.6/site-packages/twisted/mail/interfaces.py
python
IMessageIMAPPart.getSize
()
Retrieve the total size, in octets, of this message. @rtype: L{int}
Retrieve the total size, in octets, of this message.
[ "Retrieve", "the", "total", "size", "in", "octets", "of", "this", "message", "." ]
def getSize(): """ Retrieve the total size, in octets, of this message. @rtype: L{int} """
[ "def", "getSize", "(", ")", ":" ]
https://github.com/wistbean/learn_python3_spider/blob/73c873f4845f4385f097e5057407d03dd37a117b/stackoverflow/venv/lib/python3.6/site-packages/twisted/mail/interfaces.py#L456-L461
selfteaching/selfteaching-python-camp
9982ee964b984595e7d664b07c389cddaf158f1e
19100205/Ceasar1978/pip-19.0.3/src/pip/_internal/req/req_install.py
python
InstallRequirement.hashes
(self, trust_internet=True)
return Hashes(good_hashes)
Return a hash-comparer that considers my option- and URL-based hashes to be known-good. Hashes in URLs--ones embedded in the requirements file, not ones downloaded from an index server--are almost peers with ones from flags. They satisfy --require-hashes (whether it was implicitly or ...
Return a hash-comparer that considers my option- and URL-based hashes to be known-good.
[ "Return", "a", "hash", "-", "comparer", "that", "considers", "my", "option", "-", "and", "URL", "-", "based", "hashes", "to", "be", "known", "-", "good", "." ]
def hashes(self, trust_internet=True): # type: (bool) -> Hashes """Return a hash-comparer that considers my option- and URL-based hashes to be known-good. Hashes in URLs--ones embedded in the requirements file, not ones downloaded from an index server--are almost peers with ones...
[ "def", "hashes", "(", "self", ",", "trust_internet", "=", "True", ")", ":", "# type: (bool) -> Hashes", "good_hashes", "=", "self", ".", "options", ".", "get", "(", "'hashes'", ",", "{", "}", ")", ".", "copy", "(", ")", "link", "=", "self", ".", "link"...
https://github.com/selfteaching/selfteaching-python-camp/blob/9982ee964b984595e7d664b07c389cddaf158f1e/19100205/Ceasar1978/pip-19.0.3/src/pip/_internal/req/req_install.py#L255-L275
Pymol-Scripts/Pymol-script-repo
bcd7bb7812dc6db1595953dfa4471fa15fb68c77
modules/pdb2pqr/contrib/ZSI-2.1-a1/ZSI/wstools/XMLSchema.py
python
XMLSchemaComponent.getSchemaItem
(self, collection, namespace, name)
return obj
returns object instance representing namespace, name, or if does not exist return None if built-in, else raise SchemaError. namespace -- namespace item defined in. name -- name of item. collection -- collection in parent Schema instance to search.
returns object instance representing namespace, name, or if does not exist return None if built-in, else raise SchemaError. namespace -- namespace item defined in. name -- name of item. collection -- collection in parent Schema instance to search.
[ "returns", "object", "instance", "representing", "namespace", "name", "or", "if", "does", "not", "exist", "return", "None", "if", "built", "-", "in", "else", "raise", "SchemaError", ".", "namespace", "--", "namespace", "item", "defined", "in", ".", "name", "...
def getSchemaItem(self, collection, namespace, name): """returns object instance representing namespace, name, or if does not exist return None if built-in, else raise SchemaError. namespace -- namespace item defined in. name -- name of item. co...
[ "def", "getSchemaItem", "(", "self", ",", "collection", ",", "namespace", ",", "name", ")", ":", "parent", "=", "GetSchema", "(", "self", ")", "if", "parent", ".", "targetNamespace", "==", "namespace", ":", "try", ":", "obj", "=", "getattr", "(", "parent...
https://github.com/Pymol-Scripts/Pymol-script-repo/blob/bcd7bb7812dc6db1595953dfa4471fa15fb68c77/modules/pdb2pqr/contrib/ZSI-2.1-a1/ZSI/wstools/XMLSchema.py#L594-L646
USEPA/WNTR
2f92bab5736da6ef3591fc4b0229ec1ac6cd6fcc
wntr/network/elements.py
python
Tank.vol_curve_name
(self)
return self._vol_curve_name
Name of the volume curve to use, or None
Name of the volume curve to use, or None
[ "Name", "of", "the", "volume", "curve", "to", "use", "or", "None" ]
def vol_curve_name(self): """Name of the volume curve to use, or None""" return self._vol_curve_name
[ "def", "vol_curve_name", "(", "self", ")", ":", "return", "self", ".", "_vol_curve_name" ]
https://github.com/USEPA/WNTR/blob/2f92bab5736da6ef3591fc4b0229ec1ac6cd6fcc/wntr/network/elements.py#L548-L550
pythonarcade/arcade
1ee3eb1900683213e8e8df93943327c2ea784564
doc/tutorials/framebuffer/step_02.py
python
main
()
Main function
Main function
[ "Main", "function" ]
def main(): """ Main function """ MyGame(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_TITLE) arcade.run()
[ "def", "main", "(", ")", ":", "MyGame", "(", "SCREEN_WIDTH", ",", "SCREEN_HEIGHT", ",", "SCREEN_TITLE", ")", "arcade", ".", "run", "(", ")" ]
https://github.com/pythonarcade/arcade/blob/1ee3eb1900683213e8e8df93943327c2ea784564/doc/tutorials/framebuffer/step_02.py#L68-L71
007gzs/dingtalk-sdk
7979da2e259fdbc571728cae2425a04dbc65850a
dingtalk/client/api/taobao.py
python
TbJiuDianZaiXianYuDing.taobao_xhotel_commoninvoice_update
( self, common_invoice_info_param=None )
return self._top_request( "taobao.xhotel.commoninvoice.update", { "common_invoice_info_param": common_invoice_info_param } )
常用发票信息更新接口 常用发票信息更新接口(根据用户id,发票抬头和发票属性或发票id进行更新,没有则添加) 文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=29569 :param common_invoice_info_param: 无
常用发票信息更新接口 常用发票信息更新接口(根据用户id,发票抬头和发票属性或发票id进行更新,没有则添加) 文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=29569
[ "常用发票信息更新接口", "常用发票信息更新接口", "(", "根据用户id", "发票抬头和发票属性或发票id进行更新", "没有则添加", ")", "文档地址:https", ":", "//", "open", "-", "doc", ".", "dingtalk", ".", "com", "/", "docs", "/", "api", ".", "htm?apiId", "=", "29569" ]
def taobao_xhotel_commoninvoice_update( self, common_invoice_info_param=None ): """ 常用发票信息更新接口 常用发票信息更新接口(根据用户id,发票抬头和发票属性或发票id进行更新,没有则添加) 文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=29569 :param common_invoice_info_param: 无 """ ...
[ "def", "taobao_xhotel_commoninvoice_update", "(", "self", ",", "common_invoice_info_param", "=", "None", ")", ":", "return", "self", ".", "_top_request", "(", "\"taobao.xhotel.commoninvoice.update\"", ",", "{", "\"common_invoice_info_param\"", ":", "common_invoice_info_param"...
https://github.com/007gzs/dingtalk-sdk/blob/7979da2e259fdbc571728cae2425a04dbc65850a/dingtalk/client/api/taobao.py#L73396-L73412
hak5/nano-tetra-modules
aa43cb5e2338b8dbd12a75314104a34ba608263b
PortalAuth/includes/scripts/libs/requests/utils.py
python
from_key_val_list
(value)
return OrderedDict(value)
Take an object and test to see if it can be represented as a dictionary. Unless it can not be represented as such, return an OrderedDict, e.g., :: >>> from_key_val_list([('key', 'val')]) OrderedDict([('key', 'val')]) >>> from_key_val_list('string') ValueError: need more tha...
Take an object and test to see if it can be represented as a dictionary. Unless it can not be represented as such, return an OrderedDict, e.g.,
[ "Take", "an", "object", "and", "test", "to", "see", "if", "it", "can", "be", "represented", "as", "a", "dictionary", ".", "Unless", "it", "can", "not", "be", "represented", "as", "such", "return", "an", "OrderedDict", "e", ".", "g", "." ]
def from_key_val_list(value): """Take an object and test to see if it can be represented as a dictionary. Unless it can not be represented as such, return an OrderedDict, e.g., :: >>> from_key_val_list([('key', 'val')]) OrderedDict([('key', 'val')]) >>> from_key_val_list('strin...
[ "def", "from_key_val_list", "(", "value", ")", ":", "if", "value", "is", "None", ":", "return", "None", "if", "isinstance", "(", "value", ",", "(", "str", ",", "bytes", ",", "bool", ",", "int", ")", ")", ":", "raise", "ValueError", "(", "'cannot encode...
https://github.com/hak5/nano-tetra-modules/blob/aa43cb5e2338b8dbd12a75314104a34ba608263b/PortalAuth/includes/scripts/libs/requests/utils.py#L122-L142
mrlesmithjr/Ansible
d44f0dc0d942bdf3bf7334b307e6048f0ee16e36
roles/ansible-vsphere-management/scripts/pdns/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.py
python
Node.reparentChildren
(self, newParent)
Move all the children of the current node to newParent. This is needed so that trees that don't store text as nodes move the text in the correct way
Move all the children of the current node to newParent. This is needed so that trees that don't store text as nodes move the text in the correct way
[ "Move", "all", "the", "children", "of", "the", "current", "node", "to", "newParent", ".", "This", "is", "needed", "so", "that", "trees", "that", "don", "t", "store", "text", "as", "nodes", "move", "the", "text", "in", "the", "correct", "way" ]
def reparentChildren(self, newParent): """Move all the children of the current node to newParent. This is needed so that trees that don't store text as nodes move the text in the correct way """ # XXX - should this method be made more general? for child in self.childNodes...
[ "def", "reparentChildren", "(", "self", ",", "newParent", ")", ":", "# XXX - should this method be made more general?", "for", "child", "in", "self", ".", "childNodes", ":", "newParent", ".", "appendChild", "(", "child", ")", "self", ".", "childNodes", "=", "[", ...
https://github.com/mrlesmithjr/Ansible/blob/d44f0dc0d942bdf3bf7334b307e6048f0ee16e36/roles/ansible-vsphere-management/scripts/pdns/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.py#L76-L84
stratosphereips/StratosphereLinuxIPS
985ac0f141dd71fe9c6faa8307bcf95a3754951d
slips_files/core/database.py
python
Database.getProfileIdFromIP
(self, daddr_as_obj)
Receive an IP and we want the profileid
Receive an IP and we want the profileid
[ "Receive", "an", "IP", "and", "we", "want", "the", "profileid" ]
def getProfileIdFromIP(self, daddr_as_obj): """ Receive an IP and we want the profileid""" try: temp_id = 'profile' + self.separator + str(daddr_as_obj) data = self.r.sismember('profiles', temp_id) if data: return temp_id return False ...
[ "def", "getProfileIdFromIP", "(", "self", ",", "daddr_as_obj", ")", ":", "try", ":", "temp_id", "=", "'profile'", "+", "self", ".", "separator", "+", "str", "(", "daddr_as_obj", ")", "data", "=", "self", ".", "r", ".", "sismember", "(", "'profiles'", ","...
https://github.com/stratosphereips/StratosphereLinuxIPS/blob/985ac0f141dd71fe9c6faa8307bcf95a3754951d/slips_files/core/database.py#L248-L259
JaniceWuo/MovieRecommend
4c86db64ca45598917d304f535413df3bc9fea65
movierecommend/venv1/Lib/site-packages/django/contrib/gis/geos/polygon.py
python
Polygon._get_ext_ring
(self)
return self[0]
Gets the exterior ring of the Polygon.
Gets the exterior ring of the Polygon.
[ "Gets", "the", "exterior", "ring", "of", "the", "Polygon", "." ]
def _get_ext_ring(self): "Gets the exterior ring of the Polygon." return self[0]
[ "def", "_get_ext_ring", "(", "self", ")", ":", "return", "self", "[", "0", "]" ]
https://github.com/JaniceWuo/MovieRecommend/blob/4c86db64ca45598917d304f535413df3bc9fea65/movierecommend/venv1/Lib/site-packages/django/contrib/gis/geos/polygon.py#L158-L160
zatosource/zato
2a9d273f06f9d776fbfeb53e73855af6e40fa208
code/zato-server/src/zato/server/ext/outbox.py
python
Outbox.send
(self, email, attachments=(), from_=None)
Send an email. Connect/Disconnect if not already connected. Arguments: email: Email instance to send. attachments: iterable containing Attachment instances
Send an email. Connect/Disconnect if not already connected. Arguments: email: Email instance to send. attachments: iterable containing Attachment instances
[ "Send", "an", "email", ".", "Connect", "/", "Disconnect", "if", "not", "already", "connected", ".", "Arguments", ":", "email", ":", "Email", "instance", "to", "send", ".", "attachments", ":", "iterable", "containing", "Attachment", "instances" ]
def send(self, email, attachments=(), from_=None): """ Send an email. Connect/Disconnect if not already connected. Arguments: email: Email instance to send. attachments: iterable containing Attachment instances """ msg = email.as_mime(attachments) if 'Fr...
[ "def", "send", "(", "self", ",", "email", ",", "attachments", "=", "(", ")", ",", "from_", "=", "None", ")", ":", "msg", "=", "email", ".", "as_mime", "(", "attachments", ")", "if", "'From'", "not", "in", "msg", ":", "msg", "[", "'From'", "]", "=...
https://github.com/zatosource/zato/blob/2a9d273f06f9d776fbfeb53e73855af6e40fa208/code/zato-server/src/zato/server/ext/outbox.py#L198-L229
okfn/bibserver
96ab295e9f11a2d29ffabd60b0058ca7a1ec0f7c
bibserver/dao.py
python
Note.about
(cls, id_)
return [i.values() for i in res]
Retrieve notes by id of record they are about
Retrieve notes by id of record they are about
[ "Retrieve", "notes", "by", "id", "of", "record", "they", "are", "about" ]
def about(cls, id_): '''Retrieve notes by id of record they are about''' if id_ is None: return None conn, db = get_conn() res = Note.query(terms={"about":id_}) return [i.values() for i in res]
[ "def", "about", "(", "cls", ",", "id_", ")", ":", "if", "id_", "is", "None", ":", "return", "None", "conn", ",", "db", "=", "get_conn", "(", ")", "res", "=", "Note", ".", "query", "(", "terms", "=", "{", "\"about\"", ":", "id_", "}", ")", "retu...
https://github.com/okfn/bibserver/blob/96ab295e9f11a2d29ffabd60b0058ca7a1ec0f7c/bibserver/dao.py#L233-L239
deepmind/dm_control
806a10e896e7c887635328bfa8352604ad0fedae
dm_control/mjcf/attribute.py
python
Array._check_shape
(self, array)
return array
[]
def _check_shape(self, array): actual_length = array.shape[0] if len(array.shape) > 1: raise ValueError('Expect one-dimensional array: got {}'.format(array)) if self._length and actual_length > self._length: raise ValueError('Expect array with no more than {} entries: got {}' ...
[ "def", "_check_shape", "(", "self", ",", "array", ")", ":", "actual_length", "=", "array", ".", "shape", "[", "0", "]", "if", "len", "(", "array", ".", "shape", ")", ">", "1", ":", "raise", "ValueError", "(", "'Expect one-dimensional array: got {}'", ".", ...
https://github.com/deepmind/dm_control/blob/806a10e896e7c887635328bfa8352604ad0fedae/dm_control/mjcf/attribute.py#L212-L219
beeware/ouroboros
a29123c6fab6a807caffbb7587cf548e0c370296
ouroboros/distutils/text_file.py
python
TextFile.readlines
(self)
Read and return the list of all logical lines remaining in the current file.
Read and return the list of all logical lines remaining in the current file.
[ "Read", "and", "return", "the", "list", "of", "all", "logical", "lines", "remaining", "in", "the", "current", "file", "." ]
def readlines(self): """Read and return the list of all logical lines remaining in the current file.""" lines = [] while True: line = self.readline() if line is None: return lines lines.append(line)
[ "def", "readlines", "(", "self", ")", ":", "lines", "=", "[", "]", "while", "True", ":", "line", "=", "self", ".", "readline", "(", ")", "if", "line", "is", "None", ":", "return", "lines", "lines", ".", "append", "(", "line", ")" ]
https://github.com/beeware/ouroboros/blob/a29123c6fab6a807caffbb7587cf548e0c370296/ouroboros/distutils/text_file.py#L272-L280
tp4a/teleport
1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad
server/www/packages/packages-windows/x86/tornado/ioloop.py
python
_Timeout.__le__
(self, other: "_Timeout")
return self.tdeadline <= other.tdeadline
[]
def __le__(self, other: "_Timeout") -> bool: return self.tdeadline <= other.tdeadline
[ "def", "__le__", "(", "self", ",", "other", ":", "\"_Timeout\"", ")", "->", "bool", ":", "return", "self", ".", "tdeadline", "<=", "other", ".", "tdeadline" ]
https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-windows/x86/tornado/ioloop.py#L837-L838
tjweir/liftbook
e977a7face13ade1a4558e1909a6951d2f8928dd
elyxer.py
python
FileTemplate.read
(self)
return self
Read the file, separate header and footer.
Read the file, separate header and footer.
[ "Read", "the", "file", "separate", "header", "and", "footer", "." ]
def read(self): "Read the file, separate header and footer." self.header = [] lines = [] for line in self.templatelines(): if FileTemplate.divider == line: self.header = lines lines = [] else: lines.append(line) if self.header == []: Trace.error('No ' + File...
[ "def", "read", "(", "self", ")", ":", "self", ".", "header", "=", "[", "]", "lines", "=", "[", "]", "for", "line", "in", "self", ".", "templatelines", "(", ")", ":", "if", "FileTemplate", ".", "divider", "==", "line", ":", "self", ".", "header", ...
https://github.com/tjweir/liftbook/blob/e977a7face13ade1a4558e1909a6951d2f8928dd/elyxer.py#L3420-L3435
bitcraze/crazyflie-lib-python
876f0dc003b91ba5e4de05daae9d0b79cf600f81
cflib/crazyflie/mem/__init__.py
python
Memory._disconnected
(self, uri)
The link to the Crazyflie has been broken. Reset state
The link to the Crazyflie has been broken. Reset state
[ "The", "link", "to", "the", "Crazyflie", "has", "been", "broken", ".", "Reset", "state" ]
def _disconnected(self, uri): """The link to the Crazyflie has been broken. Reset state""" self._clear_state()
[ "def", "_disconnected", "(", "self", ",", "uri", ")", ":", "self", ".", "_clear_state", "(", ")" ]
https://github.com/bitcraze/crazyflie-lib-python/blob/876f0dc003b91ba5e4de05daae9d0b79cf600f81/cflib/crazyflie/mem/__init__.py#L375-L377
jessevdk/cldoc
fc7f59405c4a891b8367c80a700f5aa3c5c9230c
cldoc/clang/cindex.py
python
Config.set_library_path
(path)
Set the path in which to search for libclang
Set the path in which to search for libclang
[ "Set", "the", "path", "in", "which", "to", "search", "for", "libclang" ]
def set_library_path(path): """Set the path in which to search for libclang""" if Config.loaded: raise Exception("library path must be set before before using " \ "any other functionalities in libclang.") Config.library_path = path
[ "def", "set_library_path", "(", "path", ")", ":", "if", "Config", ".", "loaded", ":", "raise", "Exception", "(", "\"library path must be set before before using \"", "\"any other functionalities in libclang.\"", ")", "Config", ".", "library_path", "=", "path" ]
https://github.com/jessevdk/cldoc/blob/fc7f59405c4a891b8367c80a700f5aa3c5c9230c/cldoc/clang/cindex.py#L4071-L4077
tomplus/kubernetes_asyncio
f028cc793e3a2c519be6a52a49fb77ff0b014c9b
kubernetes_asyncio/client/models/v1_lease_list.py
python
V1LeaseList.to_dict
(self)
return result
Returns the model properties as a dict
Returns the model properties as a dict
[ "Returns", "the", "model", "properties", "as", "a", "dict" ]
def to_dict(self): """Returns the model properties as a dict""" result = {} for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): result[attr] = list(map( lambda x: x.to_dict() if has...
[ "def", "to_dict", "(", "self", ")", ":", "result", "=", "{", "}", "for", "attr", ",", "_", "in", "six", ".", "iteritems", "(", "self", ".", "openapi_types", ")", ":", "value", "=", "getattr", "(", "self", ",", "attr", ")", "if", "isinstance", "(", ...
https://github.com/tomplus/kubernetes_asyncio/blob/f028cc793e3a2c519be6a52a49fb77ff0b014c9b/kubernetes_asyncio/client/models/v1_lease_list.py#L161-L183
pm4py/pm4py-core
7807b09a088b02199cd0149d724d0e28793971bf
pm4py/filtering.py
python
filter_eventually_follows_relation
(log: Union[EventLog, pd.DataFrame], relations: List[str], retain: bool = True)
Retain traces that contain any of the specified 'eventually follows' relations. For example, if relations == [('a','b'),('a','c')] and log [<a,b,c>,<a,c,b>,<a,d,b>] the resulting log will contain traces describing [<a,b,c>,<a,c,b>,<a,d,b>]. Parameters --------------- log Log object rela...
Retain traces that contain any of the specified 'eventually follows' relations. For example, if relations == [('a','b'),('a','c')] and log [<a,b,c>,<a,c,b>,<a,d,b>] the resulting log will contain traces describing [<a,b,c>,<a,c,b>,<a,d,b>].
[ "Retain", "traces", "that", "contain", "any", "of", "the", "specified", "eventually", "follows", "relations", ".", "For", "example", "if", "relations", "==", "[", "(", "a", "b", ")", "(", "a", "c", ")", "]", "and", "log", "[", "<a", "b", "c", ">", ...
def filter_eventually_follows_relation(log: Union[EventLog, pd.DataFrame], relations: List[str], retain: bool = True) -> \ Union[EventLog, pd.DataFrame]: """ Retain traces that contain any of the specified 'eventually follows' relations. For example, if relations == [('a','b'),('a','c')] and log [<a...
[ "def", "filter_eventually_follows_relation", "(", "log", ":", "Union", "[", "EventLog", ",", "pd", ".", "DataFrame", "]", ",", "relations", ":", "List", "[", "str", "]", ",", "retain", ":", "bool", "=", "True", ")", "->", "Union", "[", "EventLog", ",", ...
https://github.com/pm4py/pm4py-core/blob/7807b09a088b02199cd0149d724d0e28793971bf/pm4py/filtering.py#L344-L405
Tautulli/Tautulli
2410eb33805aaac4bd1c5dad0f71e4f15afaf742
plexpy/webauth.py
python
AuthController.signin
(self, username=None, password=None, token=None, remember_me='0', admin_login='0', *args, **kwargs)
[]
def signin(self, username=None, password=None, token=None, remember_me='0', admin_login='0', *args, **kwargs): if cherrypy.request.method != 'POST': cherrypy.response.status = 405 return {'status': 'error', 'message': 'Sign in using POST.'} ip_address = cherrypy.request.remote.i...
[ "def", "signin", "(", "self", ",", "username", "=", "None", ",", "password", "=", "None", ",", "token", "=", "None", ",", "remember_me", "=", "'0'", ",", "admin_login", "=", "'0'", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "cherryp...
https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/plexpy/webauth.py#L356-L427
Thinklab-SJTU/ThinkMatch
9d33c1516a9a13e7d4a111133ec4e0e2af798d50
src/utils/sparse.py
python
sssbmm_diag
(m1, m2)
return sss_bmm_diag_spp(m1, m2)
Perform bmm and diagonal for sparse x sparse -> sparse. This is a wrapper function and does not support gradient.
Perform bmm and diagonal for sparse x sparse -> sparse. This is a wrapper function and does not support gradient.
[ "Perform", "bmm", "and", "diagonal", "for", "sparse", "x", "sparse", "-", ">", "sparse", ".", "This", "is", "a", "wrapper", "function", "and", "does", "not", "support", "gradient", "." ]
def sssbmm_diag(m1, m2): """ Perform bmm and diagonal for sparse x sparse -> sparse. This is a wrapper function and does not support gradient. """ if (type(m1) == list and type(m1[0]) == torch.Tensor) or type(m1) == torch.Tensor: m1 = torch2ssp(m1) if (type(m2) == list and type(m2[0]) ==...
[ "def", "sssbmm_diag", "(", "m1", ",", "m2", ")", ":", "if", "(", "type", "(", "m1", ")", "==", "list", "and", "type", "(", "m1", "[", "0", "]", ")", "==", "torch", ".", "Tensor", ")", "or", "type", "(", "m1", ")", "==", "torch", ".", "Tensor"...
https://github.com/Thinklab-SJTU/ThinkMatch/blob/9d33c1516a9a13e7d4a111133ec4e0e2af798d50/src/utils/sparse.py#L62-L71
webpy/webpy
62245f7da4aab8f8607c192b98d5ef93873f995b
web/wsgi.py
python
runscgi
(func, addr=("localhost", 4000))
return flups.WSGIServer(func, bindAddress=addr, debug=False).run()
Runs a WSGI function as an SCGI server.
Runs a WSGI function as an SCGI server.
[ "Runs", "a", "WSGI", "function", "as", "an", "SCGI", "server", "." ]
def runscgi(func, addr=("localhost", 4000)): """Runs a WSGI function as an SCGI server.""" import flup.server.scgi as flups return flups.WSGIServer(func, bindAddress=addr, debug=False).run()
[ "def", "runscgi", "(", "func", ",", "addr", "=", "(", "\"localhost\"", ",", "4000", ")", ")", ":", "import", "flup", ".", "server", ".", "scgi", "as", "flups", "return", "flups", ".", "WSGIServer", "(", "func", ",", "bindAddress", "=", "addr", ",", "...
https://github.com/webpy/webpy/blob/62245f7da4aab8f8607c192b98d5ef93873f995b/web/wsgi.py#L22-L26
makerbot/ReplicatorG
d6f2b07785a5a5f1e172fb87cb4303b17c575d5d
skein_engines/skeinforge-47/skeinforge_application/skeinforge_plugins/analyze_plugins/skeinlayer.py
python
SkeinWindow.createVerticalLine
( self, begin, xPixel )
Create a vertical line for the horizontal ruler.
Create a vertical line for the horizontal ruler.
[ "Create", "a", "vertical", "line", "for", "the", "horizontal", "ruler", "." ]
def createVerticalLine( self, begin, xPixel ): "Create a vertical line for the horizontal ruler." self.horizontalRulerCanvas.create_line( xPixel, begin, xPixel, self.rulingExtent, fill = 'black')
[ "def", "createVerticalLine", "(", "self", ",", "begin", ",", "xPixel", ")", ":", "self", ".", "horizontalRulerCanvas", ".", "create_line", "(", "xPixel", ",", "begin", ",", "xPixel", ",", "self", ".", "rulingExtent", ",", "fill", "=", "'black'", ")" ]
https://github.com/makerbot/ReplicatorG/blob/d6f2b07785a5a5f1e172fb87cb4303b17c575d5d/skein_engines/skeinforge-47/skeinforge_application/skeinforge_plugins/analyze_plugins/skeinlayer.py#L460-L462