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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
log2timeline/dftimewolf | 18b4d0760d6a6ca378ac06c2242d04a0d8caf072 | dftimewolf/lib/processors/workspace_audit_timesketch.py | python | WorkspaceAuditTimesketch._ExtractActorInformation | (
self, actor_dict: Dict[str, str]) | return {
'actor_email': actor_dict.get('email'),
'actor_profileId': actor_dict.get('profileId'),
'actor_callerType': actor_dict.get('callerType'),
'actor_key': actor_dict.get('key')} | Extracts actor information from a Workspace log record.
Args:
actor_dict (dict): contents of the 'actor' dict in a Workspace log record
Returns:
dict[str, str]: a dictionary containing actor information suitable for
adding to a Timesketch record. | Extracts actor information from a Workspace log record. | [
"Extracts",
"actor",
"information",
"from",
"a",
"Workspace",
"log",
"record",
"."
] | def _ExtractActorInformation(
self, actor_dict: Dict[str, str]) -> Dict[str, Optional[str]]:
"""Extracts actor information from a Workspace log record.
Args:
actor_dict (dict): contents of the 'actor' dict in a Workspace log record
Returns:
dict[str, str]: a dictionary containing actor i... | [
"def",
"_ExtractActorInformation",
"(",
"self",
",",
"actor_dict",
":",
"Dict",
"[",
"str",
",",
"str",
"]",
")",
"->",
"Dict",
"[",
"str",
",",
"Optional",
"[",
"str",
"]",
"]",
":",
"return",
"{",
"'actor_email'",
":",
"actor_dict",
".",
"get",
"(",
... | https://github.com/log2timeline/dftimewolf/blob/18b4d0760d6a6ca378ac06c2242d04a0d8caf072/dftimewolf/lib/processors/workspace_audit_timesketch.py#L42-L57 | |
tendenci/tendenci | 0f2c348cc0e7d41bc56f50b00ce05544b083bf1d | tendenci/apps/memberships/admin.py | python | NoticeAdmin.clone | (self, request, pk) | return redirect(reverse(
'admin:memberships_notice_change',
args=[notice_clone.pk],
)) | Make a clone of this notice. | Make a clone of this notice. | [
"Make",
"a",
"clone",
"of",
"this",
"notice",
"."
] | def clone(self, request, pk):
"""
Make a clone of this notice.
"""
notice = get_object_or_404(Notice, pk=pk)
notice_clone = Notice()
ignore_fields = ['guid', 'id', 'create_dt', 'update_dt',
'creator', 'creator_username',
... | [
"def",
"clone",
"(",
"self",
",",
"request",
",",
"pk",
")",
":",
"notice",
"=",
"get_object_or_404",
"(",
"Notice",
",",
"pk",
"=",
"pk",
")",
"notice_clone",
"=",
"Notice",
"(",
")",
"ignore_fields",
"=",
"[",
"'guid'",
",",
"'id'",
",",
"'create_dt'... | https://github.com/tendenci/tendenci/blob/0f2c348cc0e7d41bc56f50b00ce05544b083bf1d/tendenci/apps/memberships/admin.py#L876-L903 | |
OpenZWave/python-openzwave | 8be4c070294348f3fc268bc1d7ad2c535f352f5a | src-api/openzwave/node.py | python | ZWaveNode.is_beaming_device | (self) | return self._network.manager.isNodeBeamingDevice(self.home_id, self.object_id) | Is this node a beaming device.
:rtype: bool | Is this node a beaming device. | [
"Is",
"this",
"node",
"a",
"beaming",
"device",
"."
] | def is_beaming_device(self):
"""
Is this node a beaming device.
:rtype: bool
"""
return self._network.manager.isNodeBeamingDevice(self.home_id, self.object_id) | [
"def",
"is_beaming_device",
"(",
"self",
")",
":",
"return",
"self",
".",
"_network",
".",
"manager",
".",
"isNodeBeamingDevice",
"(",
"self",
".",
"home_id",
",",
"self",
".",
"object_id",
")"
] | https://github.com/OpenZWave/python-openzwave/blob/8be4c070294348f3fc268bc1d7ad2c535f352f5a/src-api/openzwave/node.py#L657-L664 | |
csparpa/pyowm | 0474b61cc67fa3c95f9e572b96d3248031828fce | pyowm/airpollutionapi30/ozone.py | python | Ozone.reception_time | (self, timeformat='unix') | return formatting.timeformat(self.rec_time, timeformat) | Returns the GMT time telling when the O3 observation
has been received from the OWM Weather API
:param timeformat: the format for the time value. May be:
'*unix*' (default) for UNIX time
'*iso*' for ISO8601-formatted string in the format ``YYYY-MM-DD HH:MM:SS+00:00``
... | Returns the GMT time telling when the O3 observation
has been received from the OWM Weather API | [
"Returns",
"the",
"GMT",
"time",
"telling",
"when",
"the",
"O3",
"observation",
"has",
"been",
"received",
"from",
"the",
"OWM",
"Weather",
"API"
] | def reception_time(self, timeformat='unix'):
"""
Returns the GMT time telling when the O3 observation
has been received from the OWM Weather API
:param timeformat: the format for the time value. May be:
'*unix*' (default) for UNIX time
'*iso*' for ISO8601-formatt... | [
"def",
"reception_time",
"(",
"self",
",",
"timeformat",
"=",
"'unix'",
")",
":",
"return",
"formatting",
".",
"timeformat",
"(",
"self",
".",
"rec_time",
",",
"timeformat",
")"
] | https://github.com/csparpa/pyowm/blob/0474b61cc67fa3c95f9e572b96d3248031828fce/pyowm/airpollutionapi30/ozone.py#L60-L74 | |
mthbernardes/ARTLAS | e5fdd8d6b01fb36adada8a79687597053b6b8332 | artlas_datadog.py | python | display_logs | (self,
query: str,
start: datetime,
end: datetime,
limit: int = 1000,
cli: bool = True) | [] | def display_logs(self,
query: str,
start: datetime,
end: datetime,
limit: int = 1000,
cli: bool = True):
logs = list_logs(self,query, start, end, limit)
if cli:
for log in logs:
print(json.dumps(log))
else:
sent_log=[]
for log in lo... | [
"def",
"display_logs",
"(",
"self",
",",
"query",
":",
"str",
",",
"start",
":",
"datetime",
",",
"end",
":",
"datetime",
",",
"limit",
":",
"int",
"=",
"1000",
",",
"cli",
":",
"bool",
"=",
"True",
")",
":",
"logs",
"=",
"list_logs",
"(",
"self",
... | https://github.com/mthbernardes/ARTLAS/blob/e5fdd8d6b01fb36adada8a79687597053b6b8332/artlas_datadog.py#L99-L116 | ||||
microsoft/nlp-recipes | 7db6d204e5116da07bb3c549df546e49cb7ab5a5 | utils_nlp/models/transformers/extractive_summarization.py | python | ExtractiveSummarizer.__init__ | (
self,
processor,
model_name="distilbert-base-uncased",
encoder="transformer",
max_pos_length=512,
cache_dir=".",
) | Initialize a ExtractiveSummarizer.
Args:
model_name (str, optional): Transformer model name used in preprocessing.
check MODEL_CLASS for supported models.
Defaults to "distilbert-base-uncased".
encoder (str, optional): Encoder algorithm used by summarizat... | Initialize a ExtractiveSummarizer. | [
"Initialize",
"a",
"ExtractiveSummarizer",
"."
] | def __init__(
self,
processor,
model_name="distilbert-base-uncased",
encoder="transformer",
max_pos_length=512,
cache_dir=".",
):
"""Initialize a ExtractiveSummarizer.
Args:
model_name (str, optional): Transformer model name used in prepro... | [
"def",
"__init__",
"(",
"self",
",",
"processor",
",",
"model_name",
"=",
"\"distilbert-base-uncased\"",
",",
"encoder",
"=",
"\"transformer\"",
",",
"max_pos_length",
"=",
"512",
",",
"cache_dir",
"=",
"\".\"",
",",
")",
":",
"model",
"=",
"MODEL_CLASS",
"[",... | https://github.com/microsoft/nlp-recipes/blob/7db6d204e5116da07bb3c549df546e49cb7ab5a5/utils_nlp/models/transformers/extractive_summarization.py#L560-L617 | ||
nladuo/taobao_bra_crawler | 99b13b893b467c7c58ff5fd7367d197ccdfd7a44 | lib/model.py | python | Item.dict | (self) | return {
'item_id': self.item_id,
'seller_id': self.seller_id,
'title': self.title,
'is_crawled': self.is_crawled
} | 将数据转化为字典 | 将数据转化为字典 | [
"将数据转化为字典"
] | def dict(self):
""" 将数据转化为字典 """
return {
'item_id': self.item_id,
'seller_id': self.seller_id,
'title': self.title,
'is_crawled': self.is_crawled
} | [
"def",
"dict",
"(",
"self",
")",
":",
"return",
"{",
"'item_id'",
":",
"self",
".",
"item_id",
",",
"'seller_id'",
":",
"self",
".",
"seller_id",
",",
"'title'",
":",
"self",
".",
"title",
",",
"'is_crawled'",
":",
"self",
".",
"is_crawled",
"}"
] | https://github.com/nladuo/taobao_bra_crawler/blob/99b13b893b467c7c58ff5fd7367d197ccdfd7a44/lib/model.py#L12-L19 | |
maxbbraun/trump2cash | 0733b6cd2982cb626e0e69fd699eba539c1a35b4 | trading.py | python | Trading.utc_to_market_time | (self, timestamp) | return market_time | Converts a UTC timestamp to local market time. | Converts a UTC timestamp to local market time. | [
"Converts",
"a",
"UTC",
"timestamp",
"to",
"local",
"market",
"time",
"."
] | def utc_to_market_time(self, timestamp):
"""Converts a UTC timestamp to local market time."""
utc_time = utc.localize(timestamp)
market_time = utc_time.astimezone(MARKET_TIMEZONE)
return market_time | [
"def",
"utc_to_market_time",
"(",
"self",
",",
"timestamp",
")",
":",
"utc_time",
"=",
"utc",
".",
"localize",
"(",
"timestamp",
")",
"market_time",
"=",
"utc_time",
".",
"astimezone",
"(",
"MARKET_TIMEZONE",
")",
"return",
"market_time"
] | https://github.com/maxbbraun/trump2cash/blob/0733b6cd2982cb626e0e69fd699eba539c1a35b4/trading.py#L328-L334 | |
epi052/recon-pipeline | 7659658ec706ff7a523231ca5bf04ec464b5ae49 | pipeline/recon-pipeline.py | python | cluge_package_imports | (name, package) | project's module imports; need to cluge the package to handle relative imports at this level
putting into a function for testability | project's module imports; need to cluge the package to handle relative imports at this level | [
"project",
"s",
"module",
"imports",
";",
"need",
"to",
"cluge",
"the",
"package",
"to",
"handle",
"relative",
"imports",
"at",
"this",
"level"
] | def cluge_package_imports(name, package):
""" project's module imports; need to cluge the package to handle relative imports at this level
putting into a function for testability
"""
if name == "__main__" and package is None:
file = Path(__file__).expanduser().resolve()
parent, top ... | [
"def",
"cluge_package_imports",
"(",
"name",
",",
"package",
")",
":",
"if",
"name",
"==",
"\"__main__\"",
"and",
"package",
"is",
"None",
":",
"file",
"=",
"Path",
"(",
"__file__",
")",
".",
"expanduser",
"(",
")",
".",
"resolve",
"(",
")",
"parent",
... | https://github.com/epi052/recon-pipeline/blob/7659658ec706ff7a523231ca5bf04ec464b5ae49/pipeline/recon-pipeline.py#L34-L51 | ||
zllrunning/video-object-removal | 121f0b8359a534bae6afcd31fd0f486d10ee712a | get_mask/utils/bbox_helper.py | python | corner2center | (corner) | :param corner: Corner or np.array 4*N
:return: Center or 4 np.array N | :param corner: Corner or np.array 4*N
:return: Center or 4 np.array N | [
":",
"param",
"corner",
":",
"Corner",
"or",
"np",
".",
"array",
"4",
"*",
"N",
":",
"return",
":",
"Center",
"or",
"4",
"np",
".",
"array",
"N"
] | def corner2center(corner):
"""
:param corner: Corner or np.array 4*N
:return: Center or 4 np.array N
"""
if isinstance(corner, Corner):
x1, y1, x2, y2 = corner
return Center((x1 + x2) * 0.5, (y1 + y2) * 0.5, (x2 - x1), (y2 - y1))
else:
x1, y1, x2, y2 = corner[0], corner[1... | [
"def",
"corner2center",
"(",
"corner",
")",
":",
"if",
"isinstance",
"(",
"corner",
",",
"Corner",
")",
":",
"x1",
",",
"y1",
",",
"x2",
",",
"y2",
"=",
"corner",
"return",
"Center",
"(",
"(",
"x1",
"+",
"x2",
")",
"*",
"0.5",
",",
"(",
"y1",
"... | https://github.com/zllrunning/video-object-removal/blob/121f0b8359a534bae6afcd31fd0f486d10ee712a/get_mask/utils/bbox_helper.py#L14-L28 | ||
alpacahq/pylivetrader | 2d9bf97103814409ba8b56a4291f2655c59514ee | pylivetrader/protocol.py | python | _DeprecatedSidLookupPosition.__init__ | (self, sid) | [] | def __init__(self, sid):
self.sid = sid
self.amount = 0
self.cost_basis = 0.0 # per share
self.last_sale_price = 0.0
self.last_sale_date = None | [
"def",
"__init__",
"(",
"self",
",",
"sid",
")",
":",
"self",
".",
"sid",
"=",
"sid",
"self",
".",
"amount",
"=",
"0",
"self",
".",
"cost_basis",
"=",
"0.0",
"# per share",
"self",
".",
"last_sale_price",
"=",
"0.0",
"self",
".",
"last_sale_date",
"=",... | https://github.com/alpacahq/pylivetrader/blob/2d9bf97103814409ba8b56a4291f2655c59514ee/pylivetrader/protocol.py#L264-L269 | ||||
zzzeek/sqlalchemy | fc5c54fcd4d868c2a4c7ac19668d72f506fe821e | examples/performance/short_selects.py | python | test_orm_query_new_style | (n) | new style ORM select() of the full entity. | new style ORM select() of the full entity. | [
"new",
"style",
"ORM",
"select",
"()",
"of",
"the",
"full",
"entity",
"."
] | def test_orm_query_new_style(n):
"""new style ORM select() of the full entity."""
session = Session(bind=engine)
for id_ in random.sample(ids, n):
stmt = future_select(Customer).where(Customer.id == id_)
session.execute(stmt).scalar_one() | [
"def",
"test_orm_query_new_style",
"(",
"n",
")",
":",
"session",
"=",
"Session",
"(",
"bind",
"=",
"engine",
")",
"for",
"id_",
"in",
"random",
".",
"sample",
"(",
"ids",
",",
"n",
")",
":",
"stmt",
"=",
"future_select",
"(",
"Customer",
")",
".",
"... | https://github.com/zzzeek/sqlalchemy/blob/fc5c54fcd4d868c2a4c7ac19668d72f506fe821e/examples/performance/short_selects.py#L77-L83 | ||
sosreport/sos | 900e8bea7f3cd36c1dd48f3cbb351ab92f766654 | sos/policies/runtimes/__init__.py | python | ContainerRuntime.fmt_container_cmd | (self, container, cmd, quotecmd) | return "%s %s %s" % (self.run_cmd, container, quoted_cmd) | Format a command to run inside a container using the runtime
:param container: The name or ID of the container in which to run
:type container: ``str``
:param cmd: The command to run inside `container`
:type cmd: ``str``
:param quotecmd: Whether the cmd should be quoted.
... | Format a command to run inside a container using the runtime | [
"Format",
"a",
"command",
"to",
"run",
"inside",
"a",
"container",
"using",
"the",
"runtime"
] | def fmt_container_cmd(self, container, cmd, quotecmd):
"""Format a command to run inside a container using the runtime
:param container: The name or ID of the container in which to run
:type container: ``str``
:param cmd: The command to run inside `container`
:type cmd: ``str``... | [
"def",
"fmt_container_cmd",
"(",
"self",
",",
"container",
",",
"cmd",
",",
"quotecmd",
")",
":",
"if",
"quotecmd",
":",
"quoted_cmd",
"=",
"quote",
"(",
"cmd",
")",
"else",
":",
"quoted_cmd",
"=",
"cmd",
"return",
"\"%s %s %s\"",
"%",
"(",
"self",
".",
... | https://github.com/sosreport/sos/blob/900e8bea7f3cd36c1dd48f3cbb351ab92f766654/sos/policies/runtimes/__init__.py#L144-L163 | |
garywiz/chaperone | 9ff2c3a5b9c6820f8750320a564ea214042df06f | chaperone/cutil/syslog.py | python | SyslogServer.__init__ | (self, logsock = "/dev/log", datagram = True, **kwargs) | [] | def __init__(self, logsock = "/dev/log", datagram = True, **kwargs):
super().__init__(**kwargs)
self._datagram = datagram
self._log_socket = logsock
try:
os.remove(logsock)
except Exception:
pass | [
"def",
"__init__",
"(",
"self",
",",
"logsock",
"=",
"\"/dev/log\"",
",",
"datagram",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"*",
"*",
"kwargs",
")",
"self",
".",
"_datagram",
"=",
"datagram",
"self",... | https://github.com/garywiz/chaperone/blob/9ff2c3a5b9c6820f8750320a564ea214042df06f/chaperone/cutil/syslog.py#L210-L219 | ||||
CedricGuillemet/Imogen | ee417b42747ed5b46cb11b02ef0c3630000085b3 | bin/Lib/email/iterators.py | python | walk | (self) | Walk over the message tree, yielding each subpart.
The walk is performed in depth-first order. This method is a
generator. | Walk over the message tree, yielding each subpart. | [
"Walk",
"over",
"the",
"message",
"tree",
"yielding",
"each",
"subpart",
"."
] | def walk(self):
"""Walk over the message tree, yielding each subpart.
The walk is performed in depth-first order. This method is a
generator.
"""
yield self
if self.is_multipart():
for subpart in self.get_payload():
yield from subpart.walk() | [
"def",
"walk",
"(",
"self",
")",
":",
"yield",
"self",
"if",
"self",
".",
"is_multipart",
"(",
")",
":",
"for",
"subpart",
"in",
"self",
".",
"get_payload",
"(",
")",
":",
"yield",
"from",
"subpart",
".",
"walk",
"(",
")"
] | https://github.com/CedricGuillemet/Imogen/blob/ee417b42747ed5b46cb11b02ef0c3630000085b3/bin/Lib/email/iterators.py#L20-L29 | ||
allenai/allennlp | a3d71254fcc0f3615910e9c3d48874515edf53e0 | allennlp/data/instance.py | python | Instance.add_field | (self, field_name: str, field: Field, vocab: Vocabulary = None) | Add the field to the existing fields mapping.
If we have already indexed the Instance, then we also index `field`, so
it is necessary to supply the vocab. | Add the field to the existing fields mapping.
If we have already indexed the Instance, then we also index `field`, so
it is necessary to supply the vocab. | [
"Add",
"the",
"field",
"to",
"the",
"existing",
"fields",
"mapping",
".",
"If",
"we",
"have",
"already",
"indexed",
"the",
"Instance",
"then",
"we",
"also",
"index",
"field",
"so",
"it",
"is",
"necessary",
"to",
"supply",
"the",
"vocab",
"."
] | def add_field(self, field_name: str, field: Field, vocab: Vocabulary = None) -> None:
"""
Add the field to the existing fields mapping.
If we have already indexed the Instance, then we also index `field`, so
it is necessary to supply the vocab.
"""
self.fields[field_name]... | [
"def",
"add_field",
"(",
"self",
",",
"field_name",
":",
"str",
",",
"field",
":",
"Field",
",",
"vocab",
":",
"Vocabulary",
"=",
"None",
")",
"->",
"None",
":",
"self",
".",
"fields",
"[",
"field_name",
"]",
"=",
"field",
"if",
"self",
".",
"indexed... | https://github.com/allenai/allennlp/blob/a3d71254fcc0f3615910e9c3d48874515edf53e0/allennlp/data/instance.py#L45-L53 | ||
dipy/dipy | be956a529465b28085f8fc435a756947ddee1c89 | dipy/align/metrics.py | python | SimilarityMetric.__init__ | (self, dim) | r""" Similarity Metric abstract class
A similarity metric is in charge of keeping track of the numerical
value of the similarity (or distance) between the two given images. It
also computes the update field for the forward and inverse displacement
fields to be used in a gradient-based o... | r""" Similarity Metric abstract class | [
"r",
"Similarity",
"Metric",
"abstract",
"class"
] | def __init__(self, dim):
r""" Similarity Metric abstract class
A similarity metric is in charge of keeping track of the numerical
value of the similarity (or distance) between the two given images. It
also computes the update field for the forward and inverse displacement
fields... | [
"def",
"__init__",
"(",
"self",
",",
"dim",
")",
":",
"self",
".",
"dim",
"=",
"dim",
"self",
".",
"levels_above",
"=",
"None",
"self",
".",
"levels_below",
"=",
"None",
"self",
".",
"static_image",
"=",
"None",
"self",
".",
"static_affine",
"=",
"None... | https://github.com/dipy/dipy/blob/be956a529465b28085f8fc435a756947ddee1c89/dipy/align/metrics.py#L16-L45 | ||
trakt/Plex-Trakt-Scrobbler | aeb0bfbe62fad4b06c164f1b95581da7f35dce0b | Trakttv.bundle/Contents/Libraries/MacOSX/x86_64/ucs4/cryptography/x509/base.py | python | CertificateBuilder.add_extension | (self, extension, critical) | return CertificateBuilder(
self._issuer_name, self._subject_name,
self._public_key, self._serial_number, self._not_valid_before,
self._not_valid_after, self._extensions + [extension]
) | Adds an X.509 extension to the certificate. | Adds an X.509 extension to the certificate. | [
"Adds",
"an",
"X",
".",
"509",
"extension",
"to",
"the",
"certificate",
"."
] | def add_extension(self, extension, critical):
"""
Adds an X.509 extension to the certificate.
"""
if not isinstance(extension, ExtensionType):
raise TypeError("extension must be an ExtensionType")
extension = Extension(extension.oid, critical, extension)
# T... | [
"def",
"add_extension",
"(",
"self",
",",
"extension",
",",
"critical",
")",
":",
"if",
"not",
"isinstance",
"(",
"extension",
",",
"ExtensionType",
")",
":",
"raise",
"TypeError",
"(",
"\"extension must be an ExtensionType\"",
")",
"extension",
"=",
"Extension",
... | https://github.com/trakt/Plex-Trakt-Scrobbler/blob/aeb0bfbe62fad4b06c164f1b95581da7f35dce0b/Trakttv.bundle/Contents/Libraries/MacOSX/x86_64/ucs4/cryptography/x509/base.py#L503-L521 | |
google/python-adb | f4e597fe55900651a8a91fccc1e09061fd96b5e9 | adb/adb_protocol.py | python | AdbMessage.Open | (cls, usb, destination, timeout_ms=None) | return _AdbConnection(usb, local_id, remote_id, timeout_ms) | Opens a new connection to the device via an OPEN message.
Not the same as the posix 'open' or any other google3 Open methods.
Args:
usb: USB device handle with BulkRead and BulkWrite methods.
destination: The service:command string.
timeout_ms: Timeout in milliseconds for... | Opens a new connection to the device via an OPEN message. | [
"Opens",
"a",
"new",
"connection",
"to",
"the",
"device",
"via",
"an",
"OPEN",
"message",
"."
] | def Open(cls, usb, destination, timeout_ms=None):
"""Opens a new connection to the device via an OPEN message.
Not the same as the posix 'open' or any other google3 Open methods.
Args:
usb: USB device handle with BulkRead and BulkWrite methods.
destination: The service:comm... | [
"def",
"Open",
"(",
"cls",
",",
"usb",
",",
"destination",
",",
"timeout_ms",
"=",
"None",
")",
":",
"local_id",
"=",
"1",
"msg",
"=",
"cls",
"(",
"command",
"=",
"b'OPEN'",
",",
"arg0",
"=",
"local_id",
",",
"arg1",
"=",
"0",
",",
"data",
"=",
"... | https://github.com/google/python-adb/blob/f4e597fe55900651a8a91fccc1e09061fd96b5e9/adb/adb_protocol.py#L351-L388 | |
Confusezius/Deep-Metric-Learning-Baselines | 60772745e28bc90077831bb4c9f07a233e602797 | losses.py | python | TupleSampler.distanceweightedsampling | (self, batch, labels, lower_cutoff=0.5, upper_cutoff=1.4) | return sampled_triplets | This methods finds all available triplets in a batch given by the classes provided in labels, and select
triplets based on distance sampling introduced in 'Sampling Matters in Deep Embedding Learning'.
Args:
batch: np.ndarray or torch.Tensor, batch-wise embedded training samples.
... | This methods finds all available triplets in a batch given by the classes provided in labels, and select
triplets based on distance sampling introduced in 'Sampling Matters in Deep Embedding Learning'. | [
"This",
"methods",
"finds",
"all",
"available",
"triplets",
"in",
"a",
"batch",
"given",
"by",
"the",
"classes",
"provided",
"in",
"labels",
"and",
"select",
"triplets",
"based",
"on",
"distance",
"sampling",
"introduced",
"in",
"Sampling",
"Matters",
"in",
"D... | def distanceweightedsampling(self, batch, labels, lower_cutoff=0.5, upper_cutoff=1.4):
"""
This methods finds all available triplets in a batch given by the classes provided in labels, and select
triplets based on distance sampling introduced in 'Sampling Matters in Deep Embedding Learning'.
... | [
"def",
"distanceweightedsampling",
"(",
"self",
",",
"batch",
",",
"labels",
",",
"lower_cutoff",
"=",
"0.5",
",",
"upper_cutoff",
"=",
"1.4",
")",
":",
"if",
"isinstance",
"(",
"labels",
",",
"torch",
".",
"Tensor",
")",
":",
"labels",
"=",
"labels",
".... | https://github.com/Confusezius/Deep-Metric-Learning-Baselines/blob/60772745e28bc90077831bb4c9f07a233e602797/losses.py#L199-L233 | |
numba/numba | bf480b9e0da858a65508c2b17759a72ee6a44c51 | numba/cuda/cudadecl.py | python | _gen | (l_key, supported_types) | return Cuda_atomic | [] | def _gen(l_key, supported_types):
@register
class Cuda_atomic(AbstractTemplate):
key = l_key
def generic(self, args, kws):
assert not kws
ary, idx, val = args
if ary.dtype not in supported_types:
return
if ary.ndim == 1:
... | [
"def",
"_gen",
"(",
"l_key",
",",
"supported_types",
")",
":",
"@",
"register",
"class",
"Cuda_atomic",
"(",
"AbstractTemplate",
")",
":",
"key",
"=",
"l_key",
"def",
"generic",
"(",
"self",
",",
"args",
",",
"kws",
")",
":",
"assert",
"not",
"kws",
"a... | https://github.com/numba/numba/blob/bf480b9e0da858a65508c2b17759a72ee6a44c51/numba/cuda/cudadecl.py#L366-L382 | |||
AstroPrint/AstroBox | e7e3b8a7d33ea85fcb6b2696869c0d719ceb8b75 | src/ext/makerbot_pyserial/serialutil.py | python | SerialBase.getInterCharTimeout | (self) | return self._interCharTimeout | Get the current inter-character timeout setting. | Get the current inter-character timeout setting. | [
"Get",
"the",
"current",
"inter",
"-",
"character",
"timeout",
"setting",
"."
] | def getInterCharTimeout(self):
"""Get the current inter-character timeout setting."""
return self._interCharTimeout | [
"def",
"getInterCharTimeout",
"(",
"self",
")",
":",
"return",
"self",
".",
"_interCharTimeout"
] | https://github.com/AstroPrint/AstroBox/blob/e7e3b8a7d33ea85fcb6b2696869c0d719ceb8b75/src/ext/makerbot_pyserial/serialutil.py#L456-L458 | |
CedricGuillemet/Imogen | ee417b42747ed5b46cb11b02ef0c3630000085b3 | bin/Lib/pickletools.py | python | read_unicodestring1 | (f) | r"""
>>> import io
>>> s = 'abcd\uabcd'
>>> enc = s.encode('utf-8')
>>> enc
b'abcd\xea\xaf\x8d'
>>> n = bytes([len(enc)]) # little-endian 1-byte length
>>> t = read_unicodestring1(io.BytesIO(n + enc + b'junk'))
>>> s == t
True
>>> read_unicodestring1(io.BytesIO(n + enc[:-1]))
... | r"""
>>> import io
>>> s = 'abcd\uabcd'
>>> enc = s.encode('utf-8')
>>> enc
b'abcd\xea\xaf\x8d'
>>> n = bytes([len(enc)]) # little-endian 1-byte length
>>> t = read_unicodestring1(io.BytesIO(n + enc + b'junk'))
>>> s == t
True | [
"r",
">>>",
"import",
"io",
">>>",
"s",
"=",
"abcd",
"\\",
"uabcd",
">>>",
"enc",
"=",
"s",
".",
"encode",
"(",
"utf",
"-",
"8",
")",
">>>",
"enc",
"b",
"abcd",
"\\",
"xea",
"\\",
"xaf",
"\\",
"x8d",
">>>",
"n",
"=",
"bytes",
"(",
"[",
"len",... | def read_unicodestring1(f):
r"""
>>> import io
>>> s = 'abcd\uabcd'
>>> enc = s.encode('utf-8')
>>> enc
b'abcd\xea\xaf\x8d'
>>> n = bytes([len(enc)]) # little-endian 1-byte length
>>> t = read_unicodestring1(io.BytesIO(n + enc + b'junk'))
>>> s == t
True
>>> read_unicodestr... | [
"def",
"read_unicodestring1",
"(",
"f",
")",
":",
"n",
"=",
"read_uint1",
"(",
"f",
")",
"assert",
"n",
">=",
"0",
"data",
"=",
"f",
".",
"read",
"(",
"n",
")",
"if",
"len",
"(",
"data",
")",
"==",
"n",
":",
"return",
"str",
"(",
"data",
",",
... | https://github.com/CedricGuillemet/Imogen/blob/ee417b42747ed5b46cb11b02ef0c3630000085b3/bin/Lib/pickletools.py#L594-L618 | ||
lad1337/XDM | 0c1b7009fe00f06f102a6f67c793478f515e7efe | site-packages/logilab/common/configuration.py | python | OptionsProviderMixIn.get_option_def | (self, opt) | return the dictionary defining an option given it's name | return the dictionary defining an option given it's name | [
"return",
"the",
"dictionary",
"defining",
"an",
"option",
"given",
"it",
"s",
"name"
] | def get_option_def(self, opt):
"""return the dictionary defining an option given it's name"""
assert self.options
for option in self.options:
if option[0] == opt:
return option[1]
raise OptionError('no such option %s in section %r'
% ... | [
"def",
"get_option_def",
"(",
"self",
",",
"opt",
")",
":",
"assert",
"self",
".",
"options",
"for",
"option",
"in",
"self",
".",
"options",
":",
"if",
"option",
"[",
"0",
"]",
"==",
"opt",
":",
"return",
"option",
"[",
"1",
"]",
"raise",
"OptionErro... | https://github.com/lad1337/XDM/blob/0c1b7009fe00f06f102a6f67c793478f515e7efe/site-packages/logilab/common/configuration.py#L853-L860 | ||
omz/PythonistaAppTemplate | f560f93f8876d82a21d108977f90583df08d55af | PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/numpy/oldnumeric/ma.py | python | _minimum_operation.reduce | (self, target, axis=0) | Reduce target along the given axis. | Reduce target along the given axis. | [
"Reduce",
"target",
"along",
"the",
"given",
"axis",
"."
] | def reduce (self, target, axis=0):
"""Reduce target along the given axis."""
m = getmask(target)
if m is nomask:
t = filled(target)
return masked_array (umath.minimum.reduce (t, axis))
else:
t = umath.minimum.reduce(filled(target, minimum_fill_value(ta... | [
"def",
"reduce",
"(",
"self",
",",
"target",
",",
"axis",
"=",
"0",
")",
":",
"m",
"=",
"getmask",
"(",
"target",
")",
"if",
"m",
"is",
"nomask",
":",
"t",
"=",
"filled",
"(",
"target",
")",
"return",
"masked_array",
"(",
"umath",
".",
"minimum",
... | https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/numpy/oldnumeric/ma.py#L2000-L2009 | ||
materialsproject/pymatgen | 8128f3062a334a2edd240e4062b5b9bdd1ae6f58 | pymatgen/vis/structure_vtk.py | python | MultiStructuresVis.display_warning | (self, warning) | Args:
warning (str): Warning | Args:
warning (str): Warning | [
"Args",
":",
"warning",
"(",
"str",
")",
":",
"Warning"
] | def display_warning(self, warning):
"""
Args:
warning (str): Warning
"""
self.warningtxt_mapper = vtk.vtkTextMapper()
tprops = self.warningtxt_mapper.GetTextProperty()
tprops.SetFontSize(14)
tprops.SetFontFamilyToTimes()
tprops.SetColor(1, 0, 0... | [
"def",
"display_warning",
"(",
"self",
",",
"warning",
")",
":",
"self",
".",
"warningtxt_mapper",
"=",
"vtk",
".",
"vtkTextMapper",
"(",
")",
"tprops",
"=",
"self",
".",
"warningtxt_mapper",
".",
"GetTextProperty",
"(",
")",
"tprops",
".",
"SetFontSize",
"(... | https://github.com/materialsproject/pymatgen/blob/8128f3062a334a2edd240e4062b5b9bdd1ae6f58/pymatgen/vis/structure_vtk.py#L1151-L1171 | ||
wrobstory/vincent | c5a06e50179015fbb788a7a42e4570ff4467a9e9 | vincent/scales.py | python | Scale.points | (value) | boolean : If True, distribute ordinal values over evenly spaced
points between ``range_min`` and ``range_max``
Ignored for non-ordinal scales. | boolean : If True, distribute ordinal values over evenly spaced
points between ``range_min`` and ``range_max`` | [
"boolean",
":",
"If",
"True",
"distribute",
"ordinal",
"values",
"over",
"evenly",
"spaced",
"points",
"between",
"range_min",
"and",
"range_max"
] | def points(value):
"""boolean : If True, distribute ordinal values over evenly spaced
points between ``range_min`` and ``range_max``
Ignored for non-ordinal scales.
""" | [
"def",
"points",
"(",
"value",
")",
":"
] | https://github.com/wrobstory/vincent/blob/c5a06e50179015fbb788a7a42e4570ff4467a9e9/vincent/scales.py#L128-L133 | ||
triaquae/triaquae | bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9 | TriAquae/models/Ubuntu_12/paramiko/rsakey.py | python | RSAKey.get_bits | (self) | return self.size | [] | def get_bits(self):
return self.size | [
"def",
"get_bits",
"(",
"self",
")",
":",
"return",
"self",
".",
"size"
] | https://github.com/triaquae/triaquae/blob/bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9/TriAquae/models/Ubuntu_12/paramiko/rsakey.py#L82-L83 | |||
Chaffelson/nipyapi | d3b186fd701ce308c2812746d98af9120955e810 | nipyapi/nifi/models/node_event_dto.py | python | NodeEventDTO.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 iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(
lambda x: x.to... | [
"def",
"to_dict",
"(",
"self",
")",
":",
"result",
"=",
"{",
"}",
"for",
"attr",
",",
"_",
"in",
"iteritems",
"(",
"self",
".",
"swagger_types",
")",
":",
"value",
"=",
"getattr",
"(",
"self",
",",
"attr",
")",
"if",
"isinstance",
"(",
"value",
","... | https://github.com/Chaffelson/nipyapi/blob/d3b186fd701ce308c2812746d98af9120955e810/nipyapi/nifi/models/node_event_dto.py#L130-L154 | |
asyml/texar | a23f021dae289a3d768dc099b220952111da04fd | examples/seq2seq_exposure_bias/interpolation_helper.py | python | calc_reward | (refs, hypo, unk_id, metric) | calculate the reward given hypo and refs and will return
bleu score if metric is 'bleu' or return
sum of (Rouge-1, Rouge-2, Rouge-L) if metric is 'rouge' | calculate the reward given hypo and refs and will return
bleu score if metric is 'bleu' or return
sum of (Rouge-1, Rouge-2, Rouge-L) if metric is 'rouge' | [
"calculate",
"the",
"reward",
"given",
"hypo",
"and",
"refs",
"and",
"will",
"return",
"bleu",
"score",
"if",
"metric",
"is",
"bleu",
"or",
"return",
"sum",
"of",
"(",
"Rouge",
"-",
"1",
"Rouge",
"-",
"2",
"Rouge",
"-",
"L",
")",
"if",
"metric",
"is"... | def calc_reward(refs, hypo, unk_id, metric):
"""
calculate the reward given hypo and refs and will return
bleu score if metric is 'bleu' or return
sum of (Rouge-1, Rouge-2, Rouge-L) if metric is 'rouge'
"""
if len(hypo) == 0 or len(refs[0]) == 0:
return 0.
for i in range(len(hypo)):... | [
"def",
"calc_reward",
"(",
"refs",
",",
"hypo",
",",
"unk_id",
",",
"metric",
")",
":",
"if",
"len",
"(",
"hypo",
")",
"==",
"0",
"or",
"len",
"(",
"refs",
"[",
"0",
"]",
")",
"==",
"0",
":",
"return",
"0.",
"for",
"i",
"in",
"range",
"(",
"l... | https://github.com/asyml/texar/blob/a23f021dae289a3d768dc099b220952111da04fd/examples/seq2seq_exposure_bias/interpolation_helper.py#L30-L52 | ||
eg4000/SKU110K_CVPR19 | 1fb83d6d0e5fd0fef8d53d25940ebd6f8d027020 | object_detector_retinanet/keras_retinanet/utils/EmMerger.py | python | DuplicateMerger.get_contour_indexes | (self, contour, contour_bbox, x, y) | return original_indexes | [] | def get_contour_indexes(self, contour, contour_bbox, x, y):
original_indexes = (contour_bbox[BOX.X1] <= x) & (x <= contour_bbox[BOX.X2]) & (
contour_bbox[BOX.Y1] <= y) & (y <= contour_bbox[BOX.Y2])
return original_indexes | [
"def",
"get_contour_indexes",
"(",
"self",
",",
"contour",
",",
"contour_bbox",
",",
"x",
",",
"y",
")",
":",
"original_indexes",
"=",
"(",
"contour_bbox",
"[",
"BOX",
".",
"X1",
"]",
"<=",
"x",
")",
"&",
"(",
"x",
"<=",
"contour_bbox",
"[",
"BOX",
"... | https://github.com/eg4000/SKU110K_CVPR19/blob/1fb83d6d0e5fd0fef8d53d25940ebd6f8d027020/object_detector_retinanet/keras_retinanet/utils/EmMerger.py#L263-L266 | |||
enthought/mayavi | 2103a273568b8f0bd62328801aafbd6252543ae8 | mayavi/core/engine.py | python | Engine.add_scene | (self, scene, name=None) | Add given `scene` (a `pyface.tvtk.scene.Scene` instance) to
the mayavi engine so that mayavi can manage the scene. This
is used when the user creates a scene. Note that for the
`EnvisageEngine` this is automatically taken care of when you
create a new scene using the TVTK scene plugin.... | Add given `scene` (a `pyface.tvtk.scene.Scene` instance) to
the mayavi engine so that mayavi can manage the scene. This
is used when the user creates a scene. Note that for the
`EnvisageEngine` this is automatically taken care of when you
create a new scene using the TVTK scene plugin. | [
"Add",
"given",
"scene",
"(",
"a",
"pyface",
".",
"tvtk",
".",
"scene",
".",
"Scene",
"instance",
")",
"to",
"the",
"mayavi",
"engine",
"so",
"that",
"mayavi",
"can",
"manage",
"the",
"scene",
".",
"This",
"is",
"used",
"when",
"the",
"user",
"creates"... | def add_scene(self, scene, name=None):
"""Add given `scene` (a `pyface.tvtk.scene.Scene` instance) to
the mayavi engine so that mayavi can manage the scene. This
is used when the user creates a scene. Note that for the
`EnvisageEngine` this is automatically taken care of when you
... | [
"def",
"add_scene",
"(",
"self",
",",
"scene",
",",
"name",
"=",
"None",
")",
":",
"if",
"name",
"is",
"None",
":",
"if",
"hasattr",
"(",
"scene",
",",
"'name'",
")",
":",
"name",
"=",
"scene",
".",
"name",
"else",
":",
"name",
"=",
"'Mayavi Scene ... | https://github.com/enthought/mayavi/blob/2103a273568b8f0bd62328801aafbd6252543ae8/mayavi/core/engine.py#L346-L379 | ||
numba/numba | bf480b9e0da858a65508c2b17759a72ee6a44c51 | numba/core/analysis.py | python | compute_dead_maps | (cfg, blocks, live_map, var_def_map) | return _dead_maps_result(internal=internal_dead_map,
escaping=escaping_dead_map,
combined=combined) | Compute the end-of-live information for variables.
`live_map` contains a mapping of block offset to all the living
variables at the ENTRY of the block. | Compute the end-of-live information for variables.
`live_map` contains a mapping of block offset to all the living
variables at the ENTRY of the block. | [
"Compute",
"the",
"end",
"-",
"of",
"-",
"live",
"information",
"for",
"variables",
".",
"live_map",
"contains",
"a",
"mapping",
"of",
"block",
"offset",
"to",
"all",
"the",
"living",
"variables",
"at",
"the",
"ENTRY",
"of",
"the",
"block",
"."
] | def compute_dead_maps(cfg, blocks, live_map, var_def_map):
"""
Compute the end-of-live information for variables.
`live_map` contains a mapping of block offset to all the living
variables at the ENTRY of the block.
"""
# The following three dictionaries will be
# { block offset -> set of var... | [
"def",
"compute_dead_maps",
"(",
"cfg",
",",
"blocks",
",",
"live_map",
",",
"var_def_map",
")",
":",
"# The following three dictionaries will be",
"# { block offset -> set of variables to delete }",
"# all vars that should be deleted at the start of the successors",
"escaping_dead_map... | https://github.com/numba/numba/blob/bf480b9e0da858a65508c2b17759a72ee6a44c51/numba/core/analysis.py#L118-L187 | |
FeiSun/BERT4Rec | 615eaf2004abecda487a38d5b0c72f3dcfcae5b3 | modeling.py | python | BertModel.__init__ | (self,
config,
is_training,
input_ids,
input_mask=None,
token_type_ids=None,
use_one_hot_embeddings=True,
scope=None) | Constructor for BertModel.
Args:
config: `BertConfig` instance.
is_training: bool. rue for training model, false for eval model. Controls
whether dropout will be applied.
input_ids: int32 Tensor of shape [batch_size, seq_length].
input_mask: (optional) int32 Tensor o... | Constructor for BertModel. | [
"Constructor",
"for",
"BertModel",
"."
] | def __init__(self,
config,
is_training,
input_ids,
input_mask=None,
token_type_ids=None,
use_one_hot_embeddings=True,
scope=None):
"""Constructor for BertModel.
Args:
config: `... | [
"def",
"__init__",
"(",
"self",
",",
"config",
",",
"is_training",
",",
"input_ids",
",",
"input_mask",
"=",
"None",
",",
"token_type_ids",
"=",
"None",
",",
"use_one_hot_embeddings",
"=",
"True",
",",
"scope",
"=",
"None",
")",
":",
"config",
"=",
"copy",... | https://github.com/FeiSun/BERT4Rec/blob/615eaf2004abecda487a38d5b0c72f3dcfcae5b3/modeling.py#L116-L209 | ||
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.10.0-0.29.0/roles/lib_openshift/library/oc_adm_manage_node.py | python | Yedit.get_entry | (data, key, sep='.') | return data | Get an item from a dictionary with key notation a.b.c
d = {'a': {'b': 'c'}}}
key = a.b
return c | Get an item from a dictionary with key notation a.b.c
d = {'a': {'b': 'c'}}}
key = a.b
return c | [
"Get",
"an",
"item",
"from",
"a",
"dictionary",
"with",
"key",
"notation",
"a",
".",
"b",
".",
"c",
"d",
"=",
"{",
"a",
":",
"{",
"b",
":",
"c",
"}}}",
"key",
"=",
"a",
".",
"b",
"return",
"c"
] | def get_entry(data, key, sep='.'):
''' Get an item from a dictionary with key notation a.b.c
d = {'a': {'b': 'c'}}}
key = a.b
return c
'''
if key == '':
pass
elif (not (key and Yedit.valid_key(key, sep)) and
isinstance(data, (... | [
"def",
"get_entry",
"(",
"data",
",",
"key",
",",
"sep",
"=",
"'.'",
")",
":",
"if",
"key",
"==",
"''",
":",
"pass",
"elif",
"(",
"not",
"(",
"key",
"and",
"Yedit",
".",
"valid_key",
"(",
"key",
",",
"sep",
")",
")",
"and",
"isinstance",
"(",
"... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.10.0-0.29.0/roles/lib_openshift/library/oc_adm_manage_node.py#L330-L352 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_hxb2/lib/python3.5/site-packages/chardet/jpcntx.py | python | JapaneseContextAnalysis.got_enough_data | (self) | return self._total_rel > self.ENOUGH_REL_THRESHOLD | [] | def got_enough_data(self):
return self._total_rel > self.ENOUGH_REL_THRESHOLD | [
"def",
"got_enough_data",
"(",
"self",
")",
":",
"return",
"self",
".",
"_total_rel",
">",
"self",
".",
"ENOUGH_REL_THRESHOLD"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/chardet/jpcntx.py#L170-L171 | |||
JimmXinu/FanFicFare | bc149a2deb2636320fe50a3e374af6eef8f61889 | fanficfare/adapters/adapter_fictionlive.py | python | FictionLiveAdapter.add_chapters | (self, data) | [] | def add_chapters(self, data):
## chapter urls are for the api. they return json and aren't user-navigatable, or the same as on the website
chunkrange_url = "https://fiction.live/api/anonkun/chapters/{s_id}/{start}/{end}/"
## api url to get content of a multi route chapter. requires only the ro... | [
"def",
"add_chapters",
"(",
"self",
",",
"data",
")",
":",
"## chapter urls are for the api. they return json and aren't user-navigatable, or the same as on the website",
"chunkrange_url",
"=",
"\"https://fiction.live/api/anonkun/chapters/{s_id}/{start}/{end}/\"",
"## api url to get content ... | https://github.com/JimmXinu/FanFicFare/blob/bc149a2deb2636320fe50a3e374af6eef8f61889/fanficfare/adapters/adapter_fictionlive.py#L197-L260 | ||||
mchristopher/PokemonGo-DesktopMap | ec37575f2776ee7d64456e2a1f6b6b78830b4fe0 | app/pylibs/osx64/gevent/_socket3.py | python | socket.makefile | (self, mode="r", buffering=None, *,
encoding=None, errors=None, newline=None) | return text | Return an I/O stream connected to the socket
The arguments are as for io.open() after the filename,
except the only mode characters supported are 'r', 'w' and 'b'.
The semantics are similar too. | Return an I/O stream connected to the socket | [
"Return",
"an",
"I",
"/",
"O",
"stream",
"connected",
"to",
"the",
"socket"
] | def makefile(self, mode="r", buffering=None, *,
encoding=None, errors=None, newline=None):
"""Return an I/O stream connected to the socket
The arguments are as for io.open() after the filename,
except the only mode characters supported are 'r', 'w' and 'b'.
The semantic... | [
"def",
"makefile",
"(",
"self",
",",
"mode",
"=",
"\"r\"",
",",
"buffering",
"=",
"None",
",",
"*",
",",
"encoding",
"=",
"None",
",",
"errors",
"=",
"None",
",",
"newline",
"=",
"None",
")",
":",
"# (XXX refactor to share code?)",
"for",
"c",
"in",
"m... | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/ec37575f2776ee7d64456e2a1f6b6b78830b4fe0/app/pylibs/osx64/gevent/_socket3.py#L183-L225 | |
JiYou/openstack | 8607dd488bde0905044b303eb6e52bdea6806923 | chap19/monitor/monitor/monitor/api/openstack/wsgi.py | python | XMLDeserializer.__init__ | (self, metadata=None) | :param metadata: information needed to deserialize xml into
a dictionary. | :param metadata: information needed to deserialize xml into
a dictionary. | [
":",
"param",
"metadata",
":",
"information",
"needed",
"to",
"deserialize",
"xml",
"into",
"a",
"dictionary",
"."
] | def __init__(self, metadata=None):
"""
:param metadata: information needed to deserialize xml into
a dictionary.
"""
super(XMLDeserializer, self).__init__()
self.metadata = metadata or {} | [
"def",
"__init__",
"(",
"self",
",",
"metadata",
"=",
"None",
")",
":",
"super",
"(",
"XMLDeserializer",
",",
"self",
")",
".",
"__init__",
"(",
")",
"self",
".",
"metadata",
"=",
"metadata",
"or",
"{",
"}"
] | https://github.com/JiYou/openstack/blob/8607dd488bde0905044b303eb6e52bdea6806923/chap19/monitor/monitor/monitor/api/openstack/wsgi.py#L143-L149 | ||
m-labs/artiq | eaa1505c947c7987cdbd31c24056823c740e84e0 | artiq/coredevice/urukul.py | python | CPLD.cfg_switches | (self, state: TInt32) | Configure all four RF switches through the configuration register.
:param state: RF switch state as a 4 bit integer. | Configure all four RF switches through the configuration register. | [
"Configure",
"all",
"four",
"RF",
"switches",
"through",
"the",
"configuration",
"register",
"."
] | def cfg_switches(self, state: TInt32):
"""Configure all four RF switches through the configuration register.
:param state: RF switch state as a 4 bit integer.
"""
self.cfg_write((self.cfg_reg & ~0xf) | state) | [
"def",
"cfg_switches",
"(",
"self",
",",
"state",
":",
"TInt32",
")",
":",
"self",
".",
"cfg_write",
"(",
"(",
"self",
".",
"cfg_reg",
"&",
"~",
"0xf",
")",
"|",
"state",
")"
] | https://github.com/m-labs/artiq/blob/eaa1505c947c7987cdbd31c24056823c740e84e0/artiq/coredevice/urukul.py#L280-L285 | ||
WPO-Foundation/wptagent | 94470f007294213f900dcd9a207678b5b9fce5d3 | internal/firefox_webdriver.py | python | FirefoxWebDriver.execute_js | (self, script) | return ret | Run JavaScript | Run JavaScript | [
"Run",
"JavaScript"
] | def execute_js(self, script):
"""Run JavaScript"""
if self.must_exit:
return
ret = None
if self.driver is not None:
try:
self.driver.set_script_timeout(30)
ret = self.driver.execute_script(script)
except Exception:
... | [
"def",
"execute_js",
"(",
"self",
",",
"script",
")",
":",
"if",
"self",
".",
"must_exit",
":",
"return",
"ret",
"=",
"None",
"if",
"self",
".",
"driver",
"is",
"not",
"None",
":",
"try",
":",
"self",
".",
"driver",
".",
"set_script_timeout",
"(",
"3... | https://github.com/WPO-Foundation/wptagent/blob/94470f007294213f900dcd9a207678b5b9fce5d3/internal/firefox_webdriver.py#L126-L137 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_hxb2/lib/python3.5/site-packages/wagtail_bak/wagtailimages/wagtail_hooks.py | python | construct_admin_api | (router) | [] | def construct_admin_api(router):
router.register_endpoint('images', ImagesAdminAPIEndpoint) | [
"def",
"construct_admin_api",
"(",
"router",
")",
":",
"router",
".",
"register_endpoint",
"(",
"'images'",
",",
"ImagesAdminAPIEndpoint",
")"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/wagtail_bak/wagtailimages/wagtail_hooks.py#L30-L31 | ||||
hugsy/gef | 2975d5fc0307bdb4318d4d1c5e84f1d53246717e | gef.py | python | exit_handler | (event) | return | GDB event handler for exit cases. | GDB event handler for exit cases. | [
"GDB",
"event",
"handler",
"for",
"exit",
"cases",
"."
] | def exit_handler(event):
"""GDB event handler for exit cases."""
global __gef_remote__, __gef_qemu_mode__
reset_all_caches()
__gef_qemu_mode__ = False
if __gef_remote__ and get_gef_setting("gef-remote.clean_on_exit") is True:
shutil.rmtree("/tmp/gef/{:d}".format(__gef_remote__))
__g... | [
"def",
"exit_handler",
"(",
"event",
")",
":",
"global",
"__gef_remote__",
",",
"__gef_qemu_mode__",
"reset_all_caches",
"(",
")",
"__gef_qemu_mode__",
"=",
"False",
"if",
"__gef_remote__",
"and",
"get_gef_setting",
"(",
"\"gef-remote.clean_on_exit\"",
")",
"is",
"Tru... | https://github.com/hugsy/gef/blob/2975d5fc0307bdb4318d4d1c5e84f1d53246717e/gef.py#L3470-L3479 | |
lisa-lab/pylearn2 | af81e5c362f0df4df85c3e54e23b2adeec026055 | pylearn2/models/dbm/layer.py | python | GaussianVisLayer.expected_energy_term | (self, state, average, state_below = None, average_below = None) | return rval | .. todo::
WRITEME | .. todo:: | [
"..",
"todo",
"::"
] | def expected_energy_term(self, state, average, state_below = None, average_below = None):
"""
.. todo::
WRITEME
"""
assert state_below is None
assert average_below is None
self.space.validate(state)
if average:
raise NotImplementedError(st... | [
"def",
"expected_energy_term",
"(",
"self",
",",
"state",
",",
"average",
",",
"state_below",
"=",
"None",
",",
"average_below",
"=",
"None",
")",
":",
"assert",
"state_below",
"is",
"None",
"assert",
"average_below",
"is",
"None",
"self",
".",
"space",
".",... | https://github.com/lisa-lab/pylearn2/blob/af81e5c362f0df4df85c3e54e23b2adeec026055/pylearn2/models/dbm/layer.py#L2286-L2300 | |
4shadoww/hakkuframework | 409a11fc3819d251f86faa3473439f8c19066a21 | lib/scapy/contrib/lldp.py | python | LLDPDUPortID._check | (self) | run layer specific checks | run layer specific checks | [
"run",
"layer",
"specific",
"checks"
] | def _check(self):
"""
run layer specific checks
"""
if conf.contribs['LLDP'].strict_mode() and not self.id:
raise LLDPInvalidLengthField('id must be >= 1 characters long') | [
"def",
"_check",
"(",
"self",
")",
":",
"if",
"conf",
".",
"contribs",
"[",
"'LLDP'",
"]",
".",
"strict_mode",
"(",
")",
"and",
"not",
"self",
".",
"id",
":",
"raise",
"LLDPInvalidLengthField",
"(",
"'id must be >= 1 characters long'",
")"
] | https://github.com/4shadoww/hakkuframework/blob/409a11fc3819d251f86faa3473439f8c19066a21/lib/scapy/contrib/lldp.py#L396-L401 | ||
krintoxi/NoobSec-Toolkit | 38738541cbc03cedb9a3b3ed13b629f781ad64f6 | NoobSecToolkit /scripts/sshbackdoors/backdoors/shell/pupy/pupy/packages/windows/amd64/psutil/_psbsd.py | python | Process.exe | (self) | return cext.proc_exe(self.pid) | [] | def exe(self):
return cext.proc_exe(self.pid) | [
"def",
"exe",
"(",
"self",
")",
":",
"return",
"cext",
".",
"proc_exe",
"(",
"self",
".",
"pid",
")"
] | https://github.com/krintoxi/NoobSec-Toolkit/blob/38738541cbc03cedb9a3b3ed13b629f781ad64f6/NoobSecToolkit /scripts/sshbackdoors/backdoors/shell/pupy/pupy/packages/windows/amd64/psutil/_psbsd.py#L276-L277 | |||
caiiiac/Machine-Learning-with-Python | 1a26c4467da41ca4ebc3d5bd789ea942ef79422f | MachineLearning/venv/lib/python3.5/site-packages/pandas/plotting/_converter.py | python | TimeSeries_DateLocator.autoscale | (self) | return nonsingular(vmin, vmax) | Sets the view limits to the nearest multiples of base that contain the
data. | Sets the view limits to the nearest multiples of base that contain the
data. | [
"Sets",
"the",
"view",
"limits",
"to",
"the",
"nearest",
"multiples",
"of",
"base",
"that",
"contain",
"the",
"data",
"."
] | def autoscale(self):
"""
Sets the view limits to the nearest multiples of base that contain the
data.
"""
# requires matplotlib >= 0.98.0
(vmin, vmax) = self.axis.get_data_interval()
locs = self._get_default_locs(vmin, vmax)
(vmin, vmax) = locs[[0, -1]]
... | [
"def",
"autoscale",
"(",
"self",
")",
":",
"# requires matplotlib >= 0.98.0",
"(",
"vmin",
",",
"vmax",
")",
"=",
"self",
".",
"axis",
".",
"get_data_interval",
"(",
")",
"locs",
"=",
"self",
".",
"_get_default_locs",
"(",
"vmin",
",",
"vmax",
")",
"(",
... | https://github.com/caiiiac/Machine-Learning-with-Python/blob/1a26c4467da41ca4ebc3d5bd789ea942ef79422f/MachineLearning/venv/lib/python3.5/site-packages/pandas/plotting/_converter.py#L933-L946 | |
spotify/luigi | c3b66f4a5fa7eaa52f9a72eb6704b1049035c789 | luigi/scheduler.py | python | OrderedSet.peek | (self, last=True) | return key | [] | def peek(self, last=True):
if not self:
raise KeyError('set is empty')
key = self.end[1][0] if last else self.end[2][0]
return key | [
"def",
"peek",
"(",
"self",
",",
"last",
"=",
"True",
")",
":",
"if",
"not",
"self",
":",
"raise",
"KeyError",
"(",
"'set is empty'",
")",
"key",
"=",
"self",
".",
"end",
"[",
"1",
"]",
"[",
"0",
"]",
"if",
"last",
"else",
"self",
".",
"end",
"... | https://github.com/spotify/luigi/blob/c3b66f4a5fa7eaa52f9a72eb6704b1049035c789/luigi/scheduler.py#L212-L216 | |||
log2timeline/plaso | fe2e316b8c76a0141760c0f2f181d84acb83abc2 | plaso/parsers/plist_plugins/bluetooth.py | python | BluetoothPlugin._ParsePlist | (self, parser_mediator, match=None, **unused_kwargs) | Extracts relevant BT entries.
Args:
parser_mediator (ParserMediator): mediates interactions between parsers
and other components, such as storage and dfvfs.
match (Optional[dict[str: object]]): keys extracted from PLIST_KEYS. | Extracts relevant BT entries. | [
"Extracts",
"relevant",
"BT",
"entries",
"."
] | def _ParsePlist(self, parser_mediator, match=None, **unused_kwargs):
"""Extracts relevant BT entries.
Args:
parser_mediator (ParserMediator): mediates interactions between parsers
and other components, such as storage and dfvfs.
match (Optional[dict[str: object]]): keys extracted from PLI... | [
"def",
"_ParsePlist",
"(",
"self",
",",
"parser_mediator",
",",
"match",
"=",
"None",
",",
"*",
"*",
"unused_kwargs",
")",
":",
"device_cache",
"=",
"match",
".",
"get",
"(",
"'DeviceCache'",
",",
"{",
"}",
")",
"for",
"device",
",",
"value",
"in",
"de... | https://github.com/log2timeline/plaso/blob/fe2e316b8c76a0141760c0f2f181d84acb83abc2/plaso/parsers/plist_plugins/bluetooth.py#L41-L104 | ||
aestrivex/bctpy | 32c7fe7345b281c2d4e184f5379c425c36f3bbc7 | bct/algorithms/modularity.py | python | ci2ls | (ci) | return ls | Convert from a community index vector to a 2D python list of modules
The list is a pure python list, not requiring numpy.
Parameters
----------
ci : Nx1 np.ndarray
the community index vector
zeroindexed : bool
If True, ci uses zero-indexing (lowest value is 0). Defaults to False.
... | Convert from a community index vector to a 2D python list of modules
The list is a pure python list, not requiring numpy. | [
"Convert",
"from",
"a",
"community",
"index",
"vector",
"to",
"a",
"2D",
"python",
"list",
"of",
"modules",
"The",
"list",
"is",
"a",
"pure",
"python",
"list",
"not",
"requiring",
"numpy",
"."
] | def ci2ls(ci):
'''
Convert from a community index vector to a 2D python list of modules
The list is a pure python list, not requiring numpy.
Parameters
----------
ci : Nx1 np.ndarray
the community index vector
zeroindexed : bool
If True, ci uses zero-indexing (lowest value i... | [
"def",
"ci2ls",
"(",
"ci",
")",
":",
"if",
"not",
"np",
".",
"size",
"(",
"ci",
")",
":",
"return",
"ci",
"# list is empty",
"_",
",",
"ci",
"=",
"np",
".",
"unique",
"(",
"ci",
",",
"return_inverse",
"=",
"True",
")",
"ci",
"+=",
"1",
"nr_indice... | https://github.com/aestrivex/bctpy/blob/32c7fe7345b281c2d4e184f5379c425c36f3bbc7/bct/algorithms/modularity.py#L11-L39 | |
omriher/CapTipper | 3fb2836c0afe60eb6bd5902b4214f564268e9b4d | jsbeautifier/unpackers/packer.py | python | detect | (source) | return source.replace(' ', '').startswith('eval(function(p,a,c,k,e,r') | Detects whether `source` is P.A.C.K.E.R. coded. | Detects whether `source` is P.A.C.K.E.R. coded. | [
"Detects",
"whether",
"source",
"is",
"P",
".",
"A",
".",
"C",
".",
"K",
".",
"E",
".",
"R",
".",
"coded",
"."
] | def detect(source):
"""Detects whether `source` is P.A.C.K.E.R. coded."""
return source.replace(' ', '').startswith('eval(function(p,a,c,k,e,r') | [
"def",
"detect",
"(",
"source",
")",
":",
"return",
"source",
".",
"replace",
"(",
"' '",
",",
"''",
")",
".",
"startswith",
"(",
"'eval(function(p,a,c,k,e,r'",
")"
] | https://github.com/omriher/CapTipper/blob/3fb2836c0afe60eb6bd5902b4214f564268e9b4d/jsbeautifier/unpackers/packer.py#L21-L23 | |
lozuwa/impy | ddfaedf764c1cb2ced7f644a3a065715758874a5 | impy/ImagePreprocess.py | python | ImagePreprocess.divideIntoPatches | (self, imageWidth = None, imageHeight = None, slideWindowSize = None, strideSize = None, padding = None, numberPatches = None) | Divides the image into NxM patches depending on the stride size,
the sliding window size and the type of padding.
Args:
imageWidth: An int that represents the width of the image.
imageHeight: An int that represents the height of the image.
slideWindowSize: A tuple (width, height) that represents the size
... | Divides the image into NxM patches depending on the stride size,
the sliding window size and the type of padding.
Args:
imageWidth: An int that represents the width of the image.
imageHeight: An int that represents the height of the image.
slideWindowSize: A tuple (width, height) that represents the size
... | [
"Divides",
"the",
"image",
"into",
"NxM",
"patches",
"depending",
"on",
"the",
"stride",
"size",
"the",
"sliding",
"window",
"size",
"and",
"the",
"type",
"of",
"padding",
".",
"Args",
":",
"imageWidth",
":",
"An",
"int",
"that",
"represents",
"the",
"widt... | def divideIntoPatches(self, imageWidth = None, imageHeight = None, slideWindowSize = None, strideSize = None, padding = None, numberPatches = None):
"""
Divides the image into NxM patches depending on the stride size,
the sliding window size and the type of padding.
Args:
imageWidth: An int that represents t... | [
"def",
"divideIntoPatches",
"(",
"self",
",",
"imageWidth",
"=",
"None",
",",
"imageHeight",
"=",
"None",
",",
"slideWindowSize",
"=",
"None",
",",
"strideSize",
"=",
"None",
",",
"padding",
"=",
"None",
",",
"numberPatches",
"=",
"None",
")",
":",
"# Asse... | https://github.com/lozuwa/impy/blob/ddfaedf764c1cb2ced7f644a3a065715758874a5/impy/ImagePreprocess.py#L294-L463 | ||
GOATmessi7/RFBNet | 88d5850761c0cc7ec5ca08ae67b1d4c3e3630f0f | data/coco.py | python | COCODetection.pull_tensor | (self, index) | return torch.Tensor(self.pull_image(index)).unsqueeze_(0) | Returns the original image at an index in tensor form
Note: not using self.__getitem__(), as any transformations passed in
could mess up this functionality.
Argument:
index (int): index of img to show
Return:
tensorized version of img, squeezed | Returns the original image at an index in tensor form | [
"Returns",
"the",
"original",
"image",
"at",
"an",
"index",
"in",
"tensor",
"form"
] | def pull_tensor(self, index):
'''Returns the original image at an index in tensor form
Note: not using self.__getitem__(), as any transformations passed in
could mess up this functionality.
Argument:
index (int): index of img to show
Return:
tensorized v... | [
"def",
"pull_tensor",
"(",
"self",
",",
"index",
")",
":",
"to_tensor",
"=",
"transforms",
".",
"ToTensor",
"(",
")",
"return",
"torch",
".",
"Tensor",
"(",
"self",
".",
"pull_image",
"(",
"index",
")",
")",
".",
"unsqueeze_",
"(",
"0",
")"
] | https://github.com/GOATmessi7/RFBNet/blob/88d5850761c0cc7ec5ca08ae67b1d4c3e3630f0f/data/coco.py#L201-L213 | |
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | bin/x86/Debug/scripting_engine/Lib/mhlib.py | python | Folder.listallsubfolders | (self) | return self.mh.listallsubfolders(self.name) | Return list of all subfolders. | Return list of all subfolders. | [
"Return",
"list",
"of",
"all",
"subfolders",
"."
] | def listallsubfolders(self):
"""Return list of all subfolders."""
return self.mh.listallsubfolders(self.name) | [
"def",
"listallsubfolders",
"(",
"self",
")",
":",
"return",
"self",
".",
"mh",
".",
"listallsubfolders",
"(",
"self",
".",
"name",
")"
] | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/bin/x86/Debug/scripting_engine/Lib/mhlib.py#L276-L278 | |
slackapi/python-slack-sdk | 2dee6656ffacb7de0c29bb2a6c2b51ec6b5dbce7 | slack_sdk/web/client.py | python | WebClient.channels_info | (
self,
*,
channel: str,
**kwargs,
) | return self.api_call("channels.info", http_verb="GET", params=kwargs) | Gets information about a channel. | Gets information about a channel. | [
"Gets",
"information",
"about",
"a",
"channel",
"."
] | def channels_info(
self,
*,
channel: str,
**kwargs,
) -> SlackResponse:
"""Gets information about a channel."""
kwargs.update({"channel": channel})
return self.api_call("channels.info", http_verb="GET", params=kwargs) | [
"def",
"channels_info",
"(",
"self",
",",
"*",
",",
"channel",
":",
"str",
",",
"*",
"*",
"kwargs",
",",
")",
"->",
"SlackResponse",
":",
"kwargs",
".",
"update",
"(",
"{",
"\"channel\"",
":",
"channel",
"}",
")",
"return",
"self",
".",
"api_call",
"... | https://github.com/slackapi/python-slack-sdk/blob/2dee6656ffacb7de0c29bb2a6c2b51ec6b5dbce7/slack_sdk/web/client.py#L1697-L1705 | |
ztosec/hunter | 4ee5cca8dc5fc5d7e631e935517bd0f493c30a37 | HunterAdminApi/parser/chrome_traffic_parser.py | python | ChromeTrafficParser.get_parameter | (url, data, http_method, content_type) | get和BaseTrafficParser一致, post不一致
:param url:
:param data:
:param http_method:
:param content_type:
:return: | get和BaseTrafficParser一致, post不一致
:param url:
:param data:
:param http_method:
:param content_type:
:return: | [
"get和BaseTrafficParser一致",
"post不一致",
":",
"param",
"url",
":",
":",
"param",
"data",
":",
":",
"param",
"http_method",
":",
":",
"param",
"content_type",
":",
":",
"return",
":"
] | def get_parameter(url, data, http_method, content_type):
"""
get和BaseTrafficParser一致, post不一致
:param url:
:param data:
:param http_method:
:param content_type:
:return:
"""
if (http_method and http_method.lower() == HttpMethod.GET) or content_... | [
"def",
"get_parameter",
"(",
"url",
",",
"data",
",",
"http_method",
",",
"content_type",
")",
":",
"if",
"(",
"http_method",
"and",
"http_method",
".",
"lower",
"(",
")",
"==",
"HttpMethod",
".",
"GET",
")",
"or",
"content_type",
"is",
"None",
":",
"ret... | https://github.com/ztosec/hunter/blob/4ee5cca8dc5fc5d7e631e935517bd0f493c30a37/HunterAdminApi/parser/chrome_traffic_parser.py#L191-L204 | ||
osmr/imgclsmob | f2993d3ce73a2f7ddba05da3891defb08547d504 | pytorch/pytorchcv/models/dicenet.py | python | dicenet_wd5 | (**kwargs) | return get_dicenet(width_scale=0.2, model_name="dicenet_wd5", **kwargs) | DiCENet x0.2 model from 'DiCENet: Dimension-wise Convolutions for Efficient Networks,'
https://arxiv.org/abs/1906.03516.
Parameters:
----------
pretrained : bool, default False
Whether to load the pretrained weights for model.
root : str, default '~/.torch/models'
Location for keepi... | DiCENet x0.2 model from 'DiCENet: Dimension-wise Convolutions for Efficient Networks,'
https://arxiv.org/abs/1906.03516. | [
"DiCENet",
"x0",
".",
"2",
"model",
"from",
"DiCENet",
":",
"Dimension",
"-",
"wise",
"Convolutions",
"for",
"Efficient",
"Networks",
"https",
":",
"//",
"arxiv",
".",
"org",
"/",
"abs",
"/",
"1906",
".",
"03516",
"."
] | def dicenet_wd5(**kwargs):
"""
DiCENet x0.2 model from 'DiCENet: Dimension-wise Convolutions for Efficient Networks,'
https://arxiv.org/abs/1906.03516.
Parameters:
----------
pretrained : bool, default False
Whether to load the pretrained weights for model.
root : str, default '~/.t... | [
"def",
"dicenet_wd5",
"(",
"*",
"*",
"kwargs",
")",
":",
"return",
"get_dicenet",
"(",
"width_scale",
"=",
"0.2",
",",
"model_name",
"=",
"\"dicenet_wd5\"",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/osmr/imgclsmob/blob/f2993d3ce73a2f7ddba05da3891defb08547d504/pytorch/pytorchcv/models/dicenet.py#L600-L612 | |
GoogleCloudPlatform/PerfKitBenchmarker | 6e3412d7d5e414b8ca30ed5eaf970cef1d919a67 | perfkitbenchmarker/providers/gcp/gcp_tpu.py | python | GcpTpu._Exists | (self) | return retcode == 0 | Returns true if the cloud TPU exists. | Returns true if the cloud TPU exists. | [
"Returns",
"true",
"if",
"the",
"cloud",
"TPU",
"exists",
"."
] | def _Exists(self):
"""Returns true if the cloud TPU exists."""
_, retcode = self._GetTpuDescription()
return retcode == 0 | [
"def",
"_Exists",
"(",
"self",
")",
":",
"_",
",",
"retcode",
"=",
"self",
".",
"_GetTpuDescription",
"(",
")",
"return",
"retcode",
"==",
"0"
] | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/6e3412d7d5e414b8ca30ed5eaf970cef1d919a67/perfkitbenchmarker/providers/gcp/gcp_tpu.py#L107-L110 | |
sxjscience/HKO-7 | adeb05a366d4b57f94a5ddb814af57cc62ffe3c5 | nowcasting/ops.py | python | fc_layer_bn_act | (data, num_hidden, no_bias=False, act_type="relu",
momentum=0.9, eps=1e-5 + 1e-12, fix_gamma=True, name=None,
use_global_stats=False, **kwargs) | return act | [] | def fc_layer_bn_act(data, num_hidden, no_bias=False, act_type="relu",
momentum=0.9, eps=1e-5 + 1e-12, fix_gamma=True, name=None,
use_global_stats=False, **kwargs):
fc = fc_layer(data=data, num_hidden=num_hidden, no_bias=no_bias, name=name, **kwargs)
assert name is not Non... | [
"def",
"fc_layer_bn_act",
"(",
"data",
",",
"num_hidden",
",",
"no_bias",
"=",
"False",
",",
"act_type",
"=",
"\"relu\"",
",",
"momentum",
"=",
"0.9",
",",
"eps",
"=",
"1e-5",
"+",
"1e-12",
",",
"fix_gamma",
"=",
"True",
",",
"name",
"=",
"None",
",",
... | https://github.com/sxjscience/HKO-7/blob/adeb05a366d4b57f94a5ddb814af57cc62ffe3c5/nowcasting/ops.py#L321-L354 | |||
captainhammy/Houdini-Toolbox | a4e61c3c0296b3a3a153a8dd42297c316be1b0f3 | python/houdini_toolbox/ui/aovs/widgets.py | python | AOVSelectTreeWidget.expand_selected | (self) | Expand selected folders and groups. | Expand selected folders and groups. | [
"Expand",
"selected",
"folders",
"and",
"groups",
"."
] | def expand_selected(self):
"""Expand selected folders and groups."""
indexes = self.selectedIndexes()
for index in reversed(indexes):
self.expand(index) | [
"def",
"expand_selected",
"(",
"self",
")",
":",
"indexes",
"=",
"self",
".",
"selectedIndexes",
"(",
")",
"for",
"index",
"in",
"reversed",
"(",
"indexes",
")",
":",
"self",
".",
"expand",
"(",
"index",
")"
] | https://github.com/captainhammy/Houdini-Toolbox/blob/a4e61c3c0296b3a3a153a8dd42297c316be1b0f3/python/houdini_toolbox/ui/aovs/widgets.py#L340-L345 | ||
cocrawler/cocrawler | a9be74308fe666130cb9ca3dd64e18f4c30d2894 | cocrawler/datalayer.py | python | Datalayer.add_seen | (self, url) | A "seen" url is one that we've done something with, such as having
queued it or already crawled it. | A "seen" url is one that we've done something with, such as having
queued it or already crawled it. | [
"A",
"seen",
"url",
"is",
"one",
"that",
"we",
"ve",
"done",
"something",
"with",
"such",
"as",
"having",
"queued",
"it",
"or",
"already",
"crawled",
"it",
"."
] | def add_seen(self, url):
'''A "seen" url is one that we've done something with, such as having
queued it or already crawled it.'''
self.seen_set.add(url.surt) | [
"def",
"add_seen",
"(",
"self",
",",
"url",
")",
":",
"self",
".",
"seen_set",
".",
"add",
"(",
"url",
".",
"surt",
")"
] | https://github.com/cocrawler/cocrawler/blob/a9be74308fe666130cb9ca3dd64e18f4c30d2894/cocrawler/datalayer.py#L22-L25 | ||
mozman/ezdxf | 59d0fc2ea63f5cf82293428f5931da7e9f9718e9 | src/ezdxf/math/construct2d.py | python | ellipse_param_span | (start_param: float, end_param: float) | return arc_angle_span_rad(float(start_param), float(end_param)) | Returns the counter clockwise params span of an elliptic arc from start-
to end param.
Returns the param span in the range [0, 2π], 2π is a full ellipse.
Full ellipse handling is a special case, because normalization of params
which describe a full ellipse would return 0 if treated as regular params.
... | Returns the counter clockwise params span of an elliptic arc from start-
to end param. | [
"Returns",
"the",
"counter",
"clockwise",
"params",
"span",
"of",
"an",
"elliptic",
"arc",
"from",
"start",
"-",
"to",
"end",
"param",
"."
] | def ellipse_param_span(start_param: float, end_param: float) -> float:
"""Returns the counter clockwise params span of an elliptic arc from start-
to end param.
Returns the param span in the range [0, 2π], 2π is a full ellipse.
Full ellipse handling is a special case, because normalization of params
... | [
"def",
"ellipse_param_span",
"(",
"start_param",
":",
"float",
",",
"end_param",
":",
"float",
")",
"->",
"float",
":",
"return",
"arc_angle_span_rad",
"(",
"float",
"(",
"start_param",
")",
",",
"float",
"(",
"end_param",
")",
")"
] | https://github.com/mozman/ezdxf/blob/59d0fc2ea63f5cf82293428f5931da7e9f9718e9/src/ezdxf/math/construct2d.py#L113-L127 | |
JiYou/openstack | 8607dd488bde0905044b303eb6e52bdea6806923 | packages/source/glance/glance/api/policy.py | python | Enforcer._check | (self, context, rule, target, *args, **kwargs) | return policy.check(rule, target, credentials, *args, **kwargs) | Verifies that the action is valid on the target in this context.
:param context: Glance request context
:param rule: String representing the action to be checked
:param object: Dictionary representing the object of the action.
:raises: `glance.common.exception.Forbidden`
... | Verifies that the action is valid on the target in this context. | [
"Verifies",
"that",
"the",
"action",
"is",
"valid",
"on",
"the",
"target",
"in",
"this",
"context",
"."
] | def _check(self, context, rule, target, *args, **kwargs):
"""Verifies that the action is valid on the target in this context.
:param context: Glance request context
:param rule: String representing the action to be checked
:param object: Dictionary representing the object of th... | [
"def",
"_check",
"(",
"self",
",",
"context",
",",
"rule",
",",
"target",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"load_rules",
"(",
")",
"credentials",
"=",
"{",
"'roles'",
":",
"context",
".",
"roles",
",",
"'user'",
":"... | https://github.com/JiYou/openstack/blob/8607dd488bde0905044b303eb6e52bdea6806923/packages/source/glance/glance/api/policy.py#L103-L120 | |
WZMIAOMIAO/deep-learning-for-image-processing | a4502c284958d4bf78fb77b089a90e7688ddc196 | others_project/draw_dilated_conv/main.py | python | dilated_conv_all_map | (dilated_map: np.ndarray,
k: int = 3,
r: int = 1) | return new_map | 根据输出特征矩阵中哪些像素被使用以及使用次数,
配合膨胀卷积k和r计算输入特征矩阵哪些像素被使用以及使用次数
Args:
dilated_map: 记录输出特征矩阵中每个像素被使用次数的特征图
k: 膨胀卷积核的kernel大小
r: 膨胀卷积的dilation rate | 根据输出特征矩阵中哪些像素被使用以及使用次数,
配合膨胀卷积k和r计算输入特征矩阵哪些像素被使用以及使用次数
Args:
dilated_map: 记录输出特征矩阵中每个像素被使用次数的特征图
k: 膨胀卷积核的kernel大小
r: 膨胀卷积的dilation rate | [
"根据输出特征矩阵中哪些像素被使用以及使用次数,",
"配合膨胀卷积k和r计算输入特征矩阵哪些像素被使用以及使用次数",
"Args",
":",
"dilated_map",
":",
"记录输出特征矩阵中每个像素被使用次数的特征图",
"k",
":",
"膨胀卷积核的kernel大小",
"r",
":",
"膨胀卷积的dilation",
"rate"
] | def dilated_conv_all_map(dilated_map: np.ndarray,
k: int = 3,
r: int = 1):
"""
根据输出特征矩阵中哪些像素被使用以及使用次数,
配合膨胀卷积k和r计算输入特征矩阵哪些像素被使用以及使用次数
Args:
dilated_map: 记录输出特征矩阵中每个像素被使用次数的特征图
k: 膨胀卷积核的kernel大小
r: 膨胀卷积的dilation rate
"""
ne... | [
"def",
"dilated_conv_all_map",
"(",
"dilated_map",
":",
"np",
".",
"ndarray",
",",
"k",
":",
"int",
"=",
"3",
",",
"r",
":",
"int",
"=",
"1",
")",
":",
"new_map",
"=",
"np",
".",
"zeros_like",
"(",
"dilated_map",
")",
"for",
"i",
"in",
"range",
"("... | https://github.com/WZMIAOMIAO/deep-learning-for-image-processing/blob/a4502c284958d4bf78fb77b089a90e7688ddc196/others_project/draw_dilated_conv/main.py#L30-L47 | |
FriedAppleTeam/FRAPL | 89c14d57e0cc77b915fe1e95f60e9e1847699103 | Framework/FridaLink/FridaLink/UI/PopupMenus.py | python | IdaPopupMenuActionHandler.__init__ | (self, handler, action) | [] | def __init__(self, handler, action):
action_handler_t.__init__(self)
self.actionHandler = handler
self.actionType = action | [
"def",
"__init__",
"(",
"self",
",",
"handler",
",",
"action",
")",
":",
"action_handler_t",
".",
"__init__",
"(",
"self",
")",
"self",
".",
"actionHandler",
"=",
"handler",
"self",
".",
"actionType",
"=",
"action"
] | https://github.com/FriedAppleTeam/FRAPL/blob/89c14d57e0cc77b915fe1e95f60e9e1847699103/Framework/FridaLink/FridaLink/UI/PopupMenus.py#L123-L126 | ||||
fmilthaler/FinQuant | 38a2884663eea228540abd094b5c163f96c55aff | finquant/portfolio.py | python | Portfolio.ef_plot_efrontier | (self) | Interface to
``finquant.efficient_frontier.EfficientFrontier.plot_efrontier``.
Plots the Efficient Frontier. | Interface to
``finquant.efficient_frontier.EfficientFrontier.plot_efrontier``. | [
"Interface",
"to",
"finquant",
".",
"efficient_frontier",
".",
"EfficientFrontier",
".",
"plot_efrontier",
"."
] | def ef_plot_efrontier(self):
"""Interface to
``finquant.efficient_frontier.EfficientFrontier.plot_efrontier``.
Plots the Efficient Frontier."""
# let EfficientFrontier.efficient_frontier handle input arguments
# get/create instance of EfficientFrontier
ef = self._get_ef(... | [
"def",
"ef_plot_efrontier",
"(",
"self",
")",
":",
"# let EfficientFrontier.efficient_frontier handle input arguments",
"# get/create instance of EfficientFrontier",
"ef",
"=",
"self",
".",
"_get_ef",
"(",
")",
"# plot efficient frontier",
"ef",
".",
"plot_efrontier",
"(",
")... | https://github.com/fmilthaler/FinQuant/blob/38a2884663eea228540abd094b5c163f96c55aff/finquant/portfolio.py#L573-L582 | ||
Xen0ph0n/YaraGenerator | 48f529f0d85e7fff62405d9367901487e29aa28f | modules/pefile.py | python | Structure.sizeof | (self) | return self.__format_length__ | Return size of the structure. | Return size of the structure. | [
"Return",
"size",
"of",
"the",
"structure",
"."
] | def sizeof(self):
"""Return size of the structure."""
return self.__format_length__ | [
"def",
"sizeof",
"(",
"self",
")",
":",
"return",
"self",
".",
"__format_length__"
] | https://github.com/Xen0ph0n/YaraGenerator/blob/48f529f0d85e7fff62405d9367901487e29aa28f/modules/pefile.py#L856-L859 | |
blue-oil/blueoil | 0c9160b524b17482d59ae48a0c11384f1d26dccc | blueoil/post_processor.py | python | FormatYoloV2._offset_boxes | (self, batch_size, num_cell_y, num_cell_x) | return offset_x, offset_y, offset_w, offset_h | Numpy implementing of offset_boxes.
Return yolo space offset of x and y and w and h.
Args:
batch_size (int): batch size
num_cell_y: Number of cell y. The spatial dimension of the final convolutional features.
num_cell_x: Number of cell x. The spatial dimension of the... | Numpy implementing of offset_boxes.
Return yolo space offset of x and y and w and h. | [
"Numpy",
"implementing",
"of",
"offset_boxes",
".",
"Return",
"yolo",
"space",
"offset",
"of",
"x",
"and",
"y",
"and",
"w",
"and",
"h",
"."
] | def _offset_boxes(self, batch_size, num_cell_y, num_cell_x):
"""Numpy implementing of offset_boxes.
Return yolo space offset of x and y and w and h.
Args:
batch_size (int): batch size
num_cell_y: Number of cell y. The spatial dimension of the final convolutional features... | [
"def",
"_offset_boxes",
"(",
"self",
",",
"batch_size",
",",
"num_cell_y",
",",
"num_cell_x",
")",
":",
"offset_y",
"=",
"np",
".",
"arange",
"(",
"num_cell_y",
")",
"offset_y",
"=",
"np",
".",
"reshape",
"(",
"offset_y",
",",
"(",
"1",
",",
"num_cell_y"... | https://github.com/blue-oil/blueoil/blob/0c9160b524b17482d59ae48a0c11384f1d26dccc/blueoil/post_processor.py#L74-L101 | |
ProgVal/Limnoria | 181e34baf90a8cabc281e8349da6e36e1e558608 | src/irclib.py | python | ChannelState.isOp | (self, nick) | return nick in self.ops | Returns whether the given nick is an op. | Returns whether the given nick is an op. | [
"Returns",
"whether",
"the",
"given",
"nick",
"is",
"an",
"op",
"."
] | def isOp(self, nick):
"""Returns whether the given nick is an op."""
return nick in self.ops | [
"def",
"isOp",
"(",
"self",
",",
"nick",
")",
":",
"return",
"nick",
"in",
"self",
".",
"ops"
] | https://github.com/ProgVal/Limnoria/blob/181e34baf90a8cabc281e8349da6e36e1e558608/src/irclib.py#L369-L371 | |
microsoft/azure-devops-python-api | 451cade4c475482792cbe9e522c1fee32393139e | azure-devops/azure/devops/released/policy/policy_client.py | python | PolicyClient.get_policy_configuration | (self, project, configuration_id) | return self._deserialize('PolicyConfiguration', response) | GetPolicyConfiguration.
Get a policy configuration by its ID.
:param str project: Project ID or project name
:param int configuration_id: ID of the policy configuration
:rtype: :class:`<PolicyConfiguration> <azure.devops.v5_1.policy.models.PolicyConfiguration>` | GetPolicyConfiguration.
Get a policy configuration by its ID.
:param str project: Project ID or project name
:param int configuration_id: ID of the policy configuration
:rtype: :class:`<PolicyConfiguration> <azure.devops.v5_1.policy.models.PolicyConfiguration>` | [
"GetPolicyConfiguration",
".",
"Get",
"a",
"policy",
"configuration",
"by",
"its",
"ID",
".",
":",
"param",
"str",
"project",
":",
"Project",
"ID",
"or",
"project",
"name",
":",
"param",
"int",
"configuration_id",
":",
"ID",
"of",
"the",
"policy",
"configura... | def get_policy_configuration(self, project, configuration_id):
"""GetPolicyConfiguration.
Get a policy configuration by its ID.
:param str project: Project ID or project name
:param int configuration_id: ID of the policy configuration
:rtype: :class:`<PolicyConfiguration> <azure.... | [
"def",
"get_policy_configuration",
"(",
"self",
",",
"project",
",",
"configuration_id",
")",
":",
"route_values",
"=",
"{",
"}",
"if",
"project",
"is",
"not",
"None",
":",
"route_values",
"[",
"'project'",
"]",
"=",
"self",
".",
"_serialize",
".",
"url",
... | https://github.com/microsoft/azure-devops-python-api/blob/451cade4c475482792cbe9e522c1fee32393139e/azure-devops/azure/devops/released/policy/policy_client.py#L65-L81 | |
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/bmlb/v20180625/models.py | python | ModifyLoadBalancerChargeModeResponse.__init__ | (self) | r"""
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str | r"""
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str | [
"r",
":",
"param",
"RequestId",
":",
"唯一请求",
"ID,每次请求都会返回。定位问题时需要提供该次请求的",
"RequestId。",
":",
"type",
"RequestId",
":",
"str"
] | def __init__(self):
r"""
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.RequestId = None | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"RequestId",
"=",
"None"
] | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/bmlb/v20180625/models.py#L4472-L4477 | ||
n1nj4sec/pupy | a5d766ea81fdfe3bc2c38c9bdaf10e9b75af3b39 | pupy/packages/all/pupyutils/safepopen.py | python | SafePopen.write | (self, data) | [] | def write(self, data):
if self.returncode or not self._pipe or not self._interactive:
return
self._pipe.stdin.write(data)
self._pipe.stdin.flush() | [
"def",
"write",
"(",
"self",
",",
"data",
")",
":",
"if",
"self",
".",
"returncode",
"or",
"not",
"self",
".",
"_pipe",
"or",
"not",
"self",
".",
"_interactive",
":",
"return",
"self",
".",
"_pipe",
".",
"stdin",
".",
"write",
"(",
"data",
")",
"se... | https://github.com/n1nj4sec/pupy/blob/a5d766ea81fdfe3bc2c38c9bdaf10e9b75af3b39/pupy/packages/all/pupyutils/safepopen.py#L299-L304 | ||||
IronLanguages/ironpython3 | 7a7bb2a872eeab0d1009fc8a6e24dca43f65b693 | Src/StdLib/Lib/bz2.py | python | BZ2File.closed | (self) | return self._mode == _MODE_CLOSED | True if this file is closed. | True if this file is closed. | [
"True",
"if",
"this",
"file",
"is",
"closed",
"."
] | def closed(self):
"""True if this file is closed."""
return self._mode == _MODE_CLOSED | [
"def",
"closed",
"(",
"self",
")",
":",
"return",
"self",
".",
"_mode",
"==",
"_MODE_CLOSED"
] | https://github.com/IronLanguages/ironpython3/blob/7a7bb2a872eeab0d1009fc8a6e24dca43f65b693/Src/StdLib/Lib/bz2.py#L137-L139 | |
google/prettytensor | 75daa0b11252590f548da5647addc0ea610c4c45 | prettytensor/bookkeeper.py | python | apply_optimizer | (optimizer,
losses,
regularize=True,
include_marked=True,
clip_gradients_by_norm=None,
**kwargs) | return books.with_update_ops(train_op) | Apply an optimizer to the graph and returns a train_op.
The resulting operation will minimize the specified losses, plus the
regularization losses that have been collected during graph construction and
the losses that were marked by calling `mark_as_required`.
It will also apply any updates that have been col... | Apply an optimizer to the graph and returns a train_op. | [
"Apply",
"an",
"optimizer",
"to",
"the",
"graph",
"and",
"returns",
"a",
"train_op",
"."
] | def apply_optimizer(optimizer,
losses,
regularize=True,
include_marked=True,
clip_gradients_by_norm=None,
**kwargs):
"""Apply an optimizer to the graph and returns a train_op.
The resulting operation will minimize t... | [
"def",
"apply_optimizer",
"(",
"optimizer",
",",
"losses",
",",
"regularize",
"=",
"True",
",",
"include_marked",
"=",
"True",
",",
"clip_gradients_by_norm",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"books",
"=",
"for_default_graph",
"(",
")",
"g_step... | https://github.com/google/prettytensor/blob/75daa0b11252590f548da5647addc0ea610c4c45/prettytensor/bookkeeper.py#L586-L649 | |
IJDykeman/wangTiles | 7c1ee2095ebdf7f72bce07d94c6484915d5cae8b | experimental_code/tiles_3d/venv_mac/lib/python2.7/site-packages/pip/_vendor/pyparsing.py | python | ParserElement.parseWithTabs | ( self ) | return self | Overrides default behavior to expand C{<TAB>}s to spaces before parsing the input string.
Must be called before C{parseString} when the input grammar contains elements that
match C{<TAB>} characters. | Overrides default behavior to expand C{<TAB>}s to spaces before parsing the input string.
Must be called before C{parseString} when the input grammar contains elements that
match C{<TAB>} characters. | [
"Overrides",
"default",
"behavior",
"to",
"expand",
"C",
"{",
"<TAB",
">",
"}",
"s",
"to",
"spaces",
"before",
"parsing",
"the",
"input",
"string",
".",
"Must",
"be",
"called",
"before",
"C",
"{",
"parseString",
"}",
"when",
"the",
"input",
"grammar",
"c... | def parseWithTabs( self ):
"""
Overrides default behavior to expand C{<TAB>}s to spaces before parsing the input string.
Must be called before C{parseString} when the input grammar contains elements that
match C{<TAB>} characters.
"""
self.keepTabs = True
return s... | [
"def",
"parseWithTabs",
"(",
"self",
")",
":",
"self",
".",
"keepTabs",
"=",
"True",
"return",
"self"
] | https://github.com/IJDykeman/wangTiles/blob/7c1ee2095ebdf7f72bce07d94c6484915d5cae8b/experimental_code/tiles_3d/venv_mac/lib/python2.7/site-packages/pip/_vendor/pyparsing.py#L2029-L2036 | |
sxjscience/HKO-7 | adeb05a366d4b57f94a5ddb814af57cc62ffe3c5 | nowcasting/operators/conv_rnn.py | python | ConvRNN.state_info | (self) | return [{'shape': (self._batch_size, self._num_filter,
self._state_height, self._state_width),
'__layout__': "NCHW"}] | [] | def state_info(self):
return [{'shape': (self._batch_size, self._num_filter,
self._state_height, self._state_width),
'__layout__': "NCHW"}] | [
"def",
"state_info",
"(",
"self",
")",
":",
"return",
"[",
"{",
"'shape'",
":",
"(",
"self",
".",
"_batch_size",
",",
"self",
".",
"_num_filter",
",",
"self",
".",
"_state_height",
",",
"self",
".",
"_state_width",
")",
",",
"'__layout__'",
":",
"\"NCHW\... | https://github.com/sxjscience/HKO-7/blob/adeb05a366d4b57f94a5ddb814af57cc62ffe3c5/nowcasting/operators/conv_rnn.py#L67-L70 | |||
har07/PySastrawi | 01afc81c579bde14dcb41c33686b26af8afab121 | src/Sastrawi/Stemmer/Context/Context.py | python | Context.is_suffix_removal | (self, removal) | return removal.get_affix_type() == 'DS' \
or removal.get_affix_type() == 'PP' \
or removal.get_affix_type() == 'P' | Check wether the removed part is a suffix | Check wether the removed part is a suffix | [
"Check",
"wether",
"the",
"removed",
"part",
"is",
"a",
"suffix"
] | def is_suffix_removal(self, removal):
"""Check wether the removed part is a suffix"""
return removal.get_affix_type() == 'DS' \
or removal.get_affix_type() == 'PP' \
or removal.get_affix_type() == 'P' | [
"def",
"is_suffix_removal",
"(",
"self",
",",
"removal",
")",
":",
"return",
"removal",
".",
"get_affix_type",
"(",
")",
"==",
"'DS'",
"or",
"removal",
".",
"get_affix_type",
"(",
")",
"==",
"'PP'",
"or",
"removal",
".",
"get_affix_type",
"(",
")",
"==",
... | https://github.com/har07/PySastrawi/blob/01afc81c579bde14dcb41c33686b26af8afab121/src/Sastrawi/Stemmer/Context/Context.py#L148-L152 | |
nextcloud/appstore | bd7682d3e176b904e0e5dfc31a09650ddac5cdf0 | nextcloudappstore/core/models.py | python | AppManager.search | (self, terms, lang) | return queryset.filter(query) | [] | def search(self, terms, lang):
queryset = self.get_queryset().active_translations(lang).language(
lang).distinct()
predicates = map(lambda t: (Q(translations__name__icontains=t) |
Q(translations__summary__icontains=t) |
... | [
"def",
"search",
"(",
"self",
",",
"terms",
",",
"lang",
")",
":",
"queryset",
"=",
"self",
".",
"get_queryset",
"(",
")",
".",
"active_translations",
"(",
"lang",
")",
".",
"language",
"(",
"lang",
")",
".",
"distinct",
"(",
")",
"predicates",
"=",
... | https://github.com/nextcloud/appstore/blob/bd7682d3e176b904e0e5dfc31a09650ddac5cdf0/nextcloudappstore/core/models.py#L28-L36 | |||
sony/nnabla | 5b022f309bf2fa3ade0b6cb9bf05da9ddc67f104 | python/src/nnabla/backward_function/rand_binomial.py | python | rand_binomial_backward | (inputs, n=1, p=0.5, shape=[], seed=-1) | return [None] * len(inputs) | Args:
inputs (list of nn.Variable): Incomming grads/inputs to/of the forward function.
kwargs (dict of arguments): Dictionary of the corresponding function arguments.
Return:
list of Variable: Return the gradients wrt inputs of the corresponding function. | Args:
inputs (list of nn.Variable): Incomming grads/inputs to/of the forward function.
kwargs (dict of arguments): Dictionary of the corresponding function arguments. | [
"Args",
":",
"inputs",
"(",
"list",
"of",
"nn",
".",
"Variable",
")",
":",
"Incomming",
"grads",
"/",
"inputs",
"to",
"/",
"of",
"the",
"forward",
"function",
".",
"kwargs",
"(",
"dict",
"of",
"arguments",
")",
":",
"Dictionary",
"of",
"the",
"correspo... | def rand_binomial_backward(inputs, n=1, p=0.5, shape=[], seed=-1):
"""
Args:
inputs (list of nn.Variable): Incomming grads/inputs to/of the forward function.
kwargs (dict of arguments): Dictionary of the corresponding function arguments.
Return:
list of Variable: Return the gradients wrt ... | [
"def",
"rand_binomial_backward",
"(",
"inputs",
",",
"n",
"=",
"1",
",",
"p",
"=",
"0.5",
",",
"shape",
"=",
"[",
"]",
",",
"seed",
"=",
"-",
"1",
")",
":",
"return",
"[",
"None",
"]",
"*",
"len",
"(",
"inputs",
")"
] | https://github.com/sony/nnabla/blob/5b022f309bf2fa3ade0b6cb9bf05da9ddc67f104/python/src/nnabla/backward_function/rand_binomial.py#L16-L25 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | check_server/check.py | python | write_score | (scores) | [] | def write_score(scores):
scores = '|'.join(scores)
res = http('get',flag_server,8080,'/score.php?key=%s&write=1&score=%s'%(key,scores),'',headers)
if res == "success":
return True
else:
print res
raise ValueError | [
"def",
"write_score",
"(",
"scores",
")",
":",
"scores",
"=",
"'|'",
".",
"join",
"(",
"scores",
")",
"res",
"=",
"http",
"(",
"'get'",
",",
"flag_server",
",",
"8080",
",",
"'/score.php?key=%s&write=1&score=%s'",
"%",
"(",
"key",
",",
"scores",
")",
","... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/check_server/check.py#L67-L74 | ||||
mozilla/elasticutils | b880cc5d51fb1079b0581255ec664c1ec934656e | elasticutils/__init__.py | python | Indexable.refresh_index | (cls, es=None, index=None) | Refreshes the index.
Elasticsearch will update the index periodically
automatically. If you need to see the documents you just
indexed in your search results right now, you should call
`refresh_index` as soon as you're done indexing. This is
particularly helpful for unit tests.
... | Refreshes the index. | [
"Refreshes",
"the",
"index",
"."
] | def refresh_index(cls, es=None, index=None):
"""Refreshes the index.
Elasticsearch will update the index periodically
automatically. If you need to see the documents you just
indexed in your search results right now, you should call
`refresh_index` as soon as you're done indexin... | [
"def",
"refresh_index",
"(",
"cls",
",",
"es",
"=",
"None",
",",
"index",
"=",
"None",
")",
":",
"if",
"es",
"is",
"None",
":",
"es",
"=",
"cls",
".",
"get_es",
"(",
")",
"if",
"index",
"is",
"None",
":",
"index",
"=",
"cls",
".",
"get_index",
... | https://github.com/mozilla/elasticutils/blob/b880cc5d51fb1079b0581255ec664c1ec934656e/elasticutils/__init__.py#L2295-L2317 | ||
aws-quickstart/quickstart-git2s3 | 1d6ccea93889d8f105a2deb5a34cc2c6a7ca41c9 | functions/source/GitPullS3/ipaddress.py | python | _split_optional_netmask | (address) | return addr | Helper to split the netmask and raise AddressValueError if needed | Helper to split the netmask and raise AddressValueError if needed | [
"Helper",
"to",
"split",
"the",
"netmask",
"and",
"raise",
"AddressValueError",
"if",
"needed"
] | def _split_optional_netmask(address):
"""Helper to split the netmask and raise AddressValueError if needed"""
addr = _compat_str(address).split('/')
if len(addr) > 2:
raise AddressValueError("Only one '/' permitted in %r" % address)
return addr | [
"def",
"_split_optional_netmask",
"(",
"address",
")",
":",
"addr",
"=",
"_compat_str",
"(",
"address",
")",
".",
"split",
"(",
"'/'",
")",
"if",
"len",
"(",
"addr",
")",
">",
"2",
":",
"raise",
"AddressValueError",
"(",
"\"Only one '/' permitted in %r\"",
"... | https://github.com/aws-quickstart/quickstart-git2s3/blob/1d6ccea93889d8f105a2deb5a34cc2c6a7ca41c9/functions/source/GitPullS3/ipaddress.py#L276-L281 | |
zbyte64/django-hyperadmin | 9ac2ae284b76efb3c50a1c2899f383a27154cb54 | hyperadmin/endpoints.py | python | BaseEndpoint.create_link_collection | (self) | return LinkCollection(endpoint=self) | Returns an instantiated LinkCollection object
:rtype: LinkCollection | Returns an instantiated LinkCollection object | [
"Returns",
"an",
"instantiated",
"LinkCollection",
"object"
] | def create_link_collection(self):
"""
Returns an instantiated LinkCollection object
:rtype: LinkCollection
"""
return LinkCollection(endpoint=self) | [
"def",
"create_link_collection",
"(",
"self",
")",
":",
"return",
"LinkCollection",
"(",
"endpoint",
"=",
"self",
")"
] | https://github.com/zbyte64/django-hyperadmin/blob/9ac2ae284b76efb3c50a1c2899f383a27154cb54/hyperadmin/endpoints.py#L239-L245 | |
tuckerbalch/QSTK | 4981506c37227a72404229d5e1e0887f797a5d57 | epydoc-3.0.1/epydoc/markup/restructuredtext.py | python | _construct_classtree | (docindex, context, linker, arguments, options) | return class_tree_graph(bases, linker, context, **options) | Graph generator for L{classtree_directive} | Graph generator for L{classtree_directive} | [
"Graph",
"generator",
"for",
"L",
"{",
"classtree_directive",
"}"
] | def _construct_classtree(docindex, context, linker, arguments, options):
"""Graph generator for L{classtree_directive}"""
if len(arguments) == 1:
bases = [docindex.find(name, context) for name in
arguments[0].replace(',',' ').split()]
bases = [d for d in bases if isinstance(d, C... | [
"def",
"_construct_classtree",
"(",
"docindex",
",",
"context",
",",
"linker",
",",
"arguments",
",",
"options",
")",
":",
"if",
"len",
"(",
"arguments",
")",
"==",
"1",
":",
"bases",
"=",
"[",
"docindex",
".",
"find",
"(",
"name",
",",
"context",
")",... | https://github.com/tuckerbalch/QSTK/blob/4981506c37227a72404229d5e1e0887f797a5d57/epydoc-3.0.1/epydoc/markup/restructuredtext.py#L815-L828 | |
brainiak/brainiak | ee093597c6c11597b0a59e95b48d2118e40394a5 | brainiak/reprsimil/brsa.py | python | BRSA._initial_fit_singpara | (self, XTX, XTDX, XTFX,
YTY_diag, YTDY_diag, YTFY_diag,
XTY, XTDY, XTFY, X0TX0, X0TDX0, X0TFX0,
XTX0, XTDX0, XTFX0, X0TY, X0TDY, X0TFY,
X, Y, X0, idx_param_sing, l_idx,
n... | return current_vec_U_chlsk_l, current_a1, log_sigma2 | Perform initial fitting of a simplified model, which assumes
that all voxels share exactly the same temporal covariance
matrix for their noise (the same noise variance and
auto-correlation). The SNR is implicitly assumed to be 1
for all voxels. | Perform initial fitting of a simplified model, which assumes
that all voxels share exactly the same temporal covariance
matrix for their noise (the same noise variance and
auto-correlation). The SNR is implicitly assumed to be 1
for all voxels. | [
"Perform",
"initial",
"fitting",
"of",
"a",
"simplified",
"model",
"which",
"assumes",
"that",
"all",
"voxels",
"share",
"exactly",
"the",
"same",
"temporal",
"covariance",
"matrix",
"for",
"their",
"noise",
"(",
"the",
"same",
"noise",
"variance",
"and",
"aut... | def _initial_fit_singpara(self, XTX, XTDX, XTFX,
YTY_diag, YTDY_diag, YTFY_diag,
XTY, XTDY, XTFY, X0TX0, X0TDX0, X0TFX0,
XTX0, XTDX0, XTFX0, X0TY, X0TDY, X0TFY,
X, Y, X0, idx_param_sing, l_idx,
... | [
"def",
"_initial_fit_singpara",
"(",
"self",
",",
"XTX",
",",
"XTDX",
",",
"XTFX",
",",
"YTY_diag",
",",
"YTDY_diag",
",",
"YTFY_diag",
",",
"XTY",
",",
"XTDY",
",",
"XTFY",
",",
"X0TX0",
",",
"X0TDX0",
",",
"X0TFX0",
",",
"XTX0",
",",
"XTDX0",
",",
... | https://github.com/brainiak/brainiak/blob/ee093597c6c11597b0a59e95b48d2118e40394a5/brainiak/reprsimil/brsa.py#L1772-L1847 | |
PacktPublishing/Deep-Reinforcement-Learning-Hands-On | baa9d013596ea8ea8ed6826b9de6679d98b897ca | Chapter07/lib/common.py | python | distr_projection | (next_distr, rewards, dones, Vmin, Vmax, n_atoms, gamma) | return proj_distr | Perform distribution projection aka Catergorical Algorithm from the
"A Distributional Perspective on RL" paper | Perform distribution projection aka Catergorical Algorithm from the
"A Distributional Perspective on RL" paper | [
"Perform",
"distribution",
"projection",
"aka",
"Catergorical",
"Algorithm",
"from",
"the",
"A",
"Distributional",
"Perspective",
"on",
"RL",
"paper"
] | def distr_projection(next_distr, rewards, dones, Vmin, Vmax, n_atoms, gamma):
"""
Perform distribution projection aka Catergorical Algorithm from the
"A Distributional Perspective on RL" paper
"""
batch_size = len(rewards)
proj_distr = np.zeros((batch_size, n_atoms), dtype=np.float32)
delta_... | [
"def",
"distr_projection",
"(",
"next_distr",
",",
"rewards",
",",
"dones",
",",
"Vmin",
",",
"Vmax",
",",
"n_atoms",
",",
"gamma",
")",
":",
"batch_size",
"=",
"len",
"(",
"rewards",
")",
"proj_distr",
"=",
"np",
".",
"zeros",
"(",
"(",
"batch_size",
... | https://github.com/PacktPublishing/Deep-Reinforcement-Learning-Hands-On/blob/baa9d013596ea8ea8ed6826b9de6679d98b897ca/Chapter07/lib/common.py#L150-L185 | |
playframework/play1 | 0ecac3bc2421ae2dbec27a368bf671eda1c9cba5 | python/Lib/fnmatch.py | python | _purge | () | Clear the pattern cache | Clear the pattern cache | [
"Clear",
"the",
"pattern",
"cache"
] | def _purge():
"""Clear the pattern cache"""
_cache.clear() | [
"def",
"_purge",
"(",
")",
":",
"_cache",
".",
"clear",
"(",
")"
] | https://github.com/playframework/play1/blob/0ecac3bc2421ae2dbec27a368bf671eda1c9cba5/python/Lib/fnmatch.py#L20-L22 | ||
mlcommons/ck | 558a22c5970eb0d6708d0edc080e62a92566bab0 | ck/repo/module/program/module.py | python | copy_file_to_remote | (i) | return {'return':0} | Input: {
host_os_dict
target_os_dict
device_id
file1
(file1s)
file2
}
Output: {
return - return code = 0, if successful
> 0, if error
(error)... | Input: {
host_os_dict
target_os_dict
device_id
file1
(file1s)
file2
} | [
"Input",
":",
"{",
"host_os_dict",
"target_os_dict",
"device_id",
"file1",
"(",
"file1s",
")",
"file2",
"}"
] | def copy_file_to_remote(i):
"""
Input: {
host_os_dict
target_os_dict
device_id
file1
(file1s)
file2
}
Output: {
return - return code = 0, if successful
... | [
"def",
"copy_file_to_remote",
"(",
"i",
")",
":",
"import",
"os",
"o",
"=",
"i",
".",
"get",
"(",
"'out'",
",",
"''",
")",
"hosd",
"=",
"i",
"[",
"'host_os_dict'",
"]",
"host_hash_cmd",
"=",
"hosd",
".",
"get",
"(",
"'md5sum'",
",",
"'md5sum'",
")",
... | https://github.com/mlcommons/ck/blob/558a22c5970eb0d6708d0edc080e62a92566bab0/ck/repo/module/program/module.py#L6918-L7014 | |
cgre-aachen/gempy | 6ad16c46fc6616c9f452fba85d31ce32decd8b10 | gempy/utils/input_manipulation.py | python | VanMisesFisher._sample_weight | (self) | Who likes documentation anyways. This is totally intuitive and trivial. | Who likes documentation anyways. This is totally intuitive and trivial. | [
"Who",
"likes",
"documentation",
"anyways",
".",
"This",
"is",
"totally",
"intuitive",
"and",
"trivial",
"."
] | def _sample_weight(self):
"""Who likes documentation anyways. This is totally intuitive and trivial."""
dim = self.dim - 1 # since S^{n-1}
b = dim / (np.sqrt(4. * self.kappa ** 2 + dim ** 2) + 2 * self.kappa)
x = (1. - b) / (1. + b)
c = self.kappa * x + dim * np.log(1 - x ** 2)
... | [
"def",
"_sample_weight",
"(",
"self",
")",
":",
"dim",
"=",
"self",
".",
"dim",
"-",
"1",
"# since S^{n-1}",
"b",
"=",
"dim",
"/",
"(",
"np",
".",
"sqrt",
"(",
"4.",
"*",
"self",
".",
"kappa",
"**",
"2",
"+",
"dim",
"**",
"2",
")",
"+",
"2",
... | https://github.com/cgre-aachen/gempy/blob/6ad16c46fc6616c9f452fba85d31ce32decd8b10/gempy/utils/input_manipulation.py#L166-L178 | ||
jython/frozen-mirror | b8d7aa4cee50c0c0fe2f4b235dd62922dd0f3f99 | lib-python/2.7/httplib.py | python | HTTP.connect | (self, host=None, port=None) | Accept arguments to set the host/port, since the superclass doesn't. | Accept arguments to set the host/port, since the superclass doesn't. | [
"Accept",
"arguments",
"to",
"set",
"the",
"host",
"/",
"port",
"since",
"the",
"superclass",
"doesn",
"t",
"."
] | def connect(self, host=None, port=None):
"Accept arguments to set the host/port, since the superclass doesn't."
if host is not None:
(self._conn.host, self._conn.port) = self._conn._get_hostport(host, port)
self._conn.connect() | [
"def",
"connect",
"(",
"self",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
")",
":",
"if",
"host",
"is",
"not",
"None",
":",
"(",
"self",
".",
"_conn",
".",
"host",
",",
"self",
".",
"_conn",
".",
"port",
")",
"=",
"self",
".",
"_conn",... | https://github.com/jython/frozen-mirror/blob/b8d7aa4cee50c0c0fe2f4b235dd62922dd0f3f99/lib-python/2.7/httplib.py#L1175-L1180 | ||
khanhnamle1994/natural-language-processing | 01d450d5ac002b0156ef4cf93a07cb508c1bcdc5 | assignment1/.env/lib/python2.7/site-packages/IPython/nbformat/v2/rwbase.py | python | NotebookWriter.writes | (self, nb, **kwargs) | Write a notebook to a string. | Write a notebook to a string. | [
"Write",
"a",
"notebook",
"to",
"a",
"string",
"."
] | def writes(self, nb, **kwargs):
"""Write a notebook to a string."""
raise NotImplementedError("loads must be implemented in a subclass") | [
"def",
"writes",
"(",
"self",
",",
"nb",
",",
"*",
"*",
"kwargs",
")",
":",
"raise",
"NotImplementedError",
"(",
"\"loads must be implemented in a subclass\"",
")"
] | https://github.com/khanhnamle1994/natural-language-processing/blob/01d450d5ac002b0156ef4cf93a07cb508c1bcdc5/assignment1/.env/lib/python2.7/site-packages/IPython/nbformat/v2/rwbase.py#L156-L158 | ||
raiden-network/raiden | 76c68b426a6f81f173b9a2c09bd88a610502c38b | raiden/network/proxies/token_network.py | python | TokenNetwork.channel_is_settled | (
self,
participant1: Address,
participant2: Address,
block_identifier: BlockIdentifier,
channel_identifier: ChannelID,
) | return channel_data.state >= ChannelState.SETTLED | Returns true if the channel is in a settled state, false otherwise. | Returns true if the channel is in a settled state, false otherwise. | [
"Returns",
"true",
"if",
"the",
"channel",
"is",
"in",
"a",
"settled",
"state",
"false",
"otherwise",
"."
] | def channel_is_settled(
self,
participant1: Address,
participant2: Address,
block_identifier: BlockIdentifier,
channel_identifier: ChannelID,
) -> bool:
"""Returns true if the channel is in a settled state, false otherwise."""
try:
channel_data = s... | [
"def",
"channel_is_settled",
"(",
"self",
",",
"participant1",
":",
"Address",
",",
"participant2",
":",
"Address",
",",
"block_identifier",
":",
"BlockIdentifier",
",",
"channel_identifier",
":",
"ChannelID",
",",
")",
"->",
"bool",
":",
"try",
":",
"channel_da... | https://github.com/raiden-network/raiden/blob/76c68b426a6f81f173b9a2c09bd88a610502c38b/raiden/network/proxies/token_network.py#L633-L650 | |
albertz/music-player | d23586f5bf657cbaea8147223be7814d117ae73d | mac/pyobjc-core/Lib/objc/_descriptors.py | python | accessor | (func, typeSignature=b'@') | Return an Objective-C method object that is conformant with key-value coding
and key-value observing. | Return an Objective-C method object that is conformant with key-value coding
and key-value observing. | [
"Return",
"an",
"Objective",
"-",
"C",
"method",
"object",
"that",
"is",
"conformant",
"with",
"key",
"-",
"value",
"coding",
"and",
"key",
"-",
"value",
"observing",
"."
] | def accessor(func, typeSignature=b'@'):
"""
Return an Objective-C method object that is conformant with key-value coding
and key-value observing.
"""
args, varargs, varkw, defaults = getargspec(func)
funcName = func.__name__
maxArgs = len(args)
minArgs = maxArgs - len(defaults or ())
... | [
"def",
"accessor",
"(",
"func",
",",
"typeSignature",
"=",
"b'@'",
")",
":",
"args",
",",
"varargs",
",",
"varkw",
",",
"defaults",
"=",
"getargspec",
"(",
"func",
")",
"funcName",
"=",
"func",
".",
"__name__",
"maxArgs",
"=",
"len",
"(",
"args",
")",
... | https://github.com/albertz/music-player/blob/d23586f5bf657cbaea8147223be7814d117ae73d/mac/pyobjc-core/Lib/objc/_descriptors.py#L43-L112 | ||
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/isy994/binary_sensor.py | python | ISYBinarySensorHeartbeat.async_on_update | (self, event: object) | Ignore node status updates.
We listen directly to the Control events for this device. | Ignore node status updates. | [
"Ignore",
"node",
"status",
"updates",
"."
] | def async_on_update(self, event: object) -> None:
"""Ignore node status updates.
We listen directly to the Control events for this device.
""" | [
"def",
"async_on_update",
"(",
"self",
",",
"event",
":",
"object",
")",
"->",
"None",
":"
] | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/isy994/binary_sensor.py#L438-L442 | ||
ZKeeer/WeChatAssistant | 6e9b597b94f92f23366de69279e6e14df32ea2e3 | WebVersion/weixin/revo/signin.py | python | SignInMPS.IsSigned | (self) | return (last_date == str(time.localtime().tm_mday)) | 获取上次签到日期,并进行判断当天是否签到了
:return: True:两次日期相同,已经签到了 | 获取上次签到日期,并进行判断当天是否签到了
:return: True:两次日期相同,已经签到了 | [
"获取上次签到日期",
"并进行判断当天是否签到了",
":",
"return",
":",
"True",
":",
"两次日期相同,已经签到了"
] | def IsSigned(self):
"""
获取上次签到日期,并进行判断当天是否签到了
:return: True:两次日期相同,已经签到了
"""
if not os.path.exists(self.Date_path):
with open(self.Date_path, "w") as fw:
fw.write(str(time.localtime().tm_mday))
last_date = str((time.localtime().tm_mday - 1)... | [
"def",
"IsSigned",
"(",
"self",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"self",
".",
"Date_path",
")",
":",
"with",
"open",
"(",
"self",
".",
"Date_path",
",",
"\"w\"",
")",
"as",
"fw",
":",
"fw",
".",
"write",
"(",
"str",
... | https://github.com/ZKeeer/WeChatAssistant/blob/6e9b597b94f92f23366de69279e6e14df32ea2e3/WebVersion/weixin/revo/signin.py#L52-L65 | |
hkust-vgd/scanobjectnn | fe60aeade9ceb8882bc3f1bc40612e65469d7e77 | pointnet/models/transform_nets.py | python | input_transform_net | (point_cloud, is_training, bn_decay=None, K=3) | return transform | Input (XYZ) Transform Net, input is BxNx3 gray image
Return:
Transformation matrix of size 3xK | Input (XYZ) Transform Net, input is BxNx3 gray image
Return:
Transformation matrix of size 3xK | [
"Input",
"(",
"XYZ",
")",
"Transform",
"Net",
"input",
"is",
"BxNx3",
"gray",
"image",
"Return",
":",
"Transformation",
"matrix",
"of",
"size",
"3xK"
] | def input_transform_net(point_cloud, is_training, bn_decay=None, K=3):
""" Input (XYZ) Transform Net, input is BxNx3 gray image
Return:
Transformation matrix of size 3xK """
batch_size = point_cloud.get_shape()[0].value
num_point = point_cloud.get_shape()[1].value
input_image = tf.e... | [
"def",
"input_transform_net",
"(",
"point_cloud",
",",
"is_training",
",",
"bn_decay",
"=",
"None",
",",
"K",
"=",
"3",
")",
":",
"batch_size",
"=",
"point_cloud",
".",
"get_shape",
"(",
")",
"[",
"0",
"]",
".",
"value",
"num_point",
"=",
"point_cloud",
... | https://github.com/hkust-vgd/scanobjectnn/blob/fe60aeade9ceb8882bc3f1bc40612e65469d7e77/pointnet/models/transform_nets.py#L10-L52 | |
edgewall/trac | beb3e4eaf1e0a456d801a50a8614ecab06de29fc | trac/core.py | python | Component.__repr__ | (self) | return '<Component %s.%s>' % (self.__class__.__module__,
self.__class__.__name__) | Return a textual representation of the component. | Return a textual representation of the component. | [
"Return",
"a",
"textual",
"representation",
"of",
"the",
"component",
"."
] | def __repr__(self):
"""Return a textual representation of the component."""
return '<Component %s.%s>' % (self.__class__.__module__,
self.__class__.__name__) | [
"def",
"__repr__",
"(",
"self",
")",
":",
"return",
"'<Component %s.%s>'",
"%",
"(",
"self",
".",
"__class__",
".",
"__module__",
",",
"self",
".",
"__class__",
".",
"__name__",
")"
] | https://github.com/edgewall/trac/blob/beb3e4eaf1e0a456d801a50a8614ecab06de29fc/trac/core.py#L200-L203 | |
unknown-horizons/unknown-horizons | 7397fb333006d26c3d9fe796c7bd9cb8c3b43a49 | horizons/savegamemanager.py | python | SavegameManager.get_available_scenarios | (cls, include_displaynames=True, locales=False) | return translated_scenarios | Returns available scenarios. | Returns available scenarios. | [
"Returns",
"available",
"scenarios",
"."
] | def get_available_scenarios(cls, include_displaynames=True, locales=False):
"""Returns available scenarios."""
translated_scenarios = defaultdict(list)
scenarios = list(zip(*cls.get_scenarios(include_displaynames=True)))
for filename, scenario in scenarios:
if not os.path.exists(filename):
continue
if... | [
"def",
"get_available_scenarios",
"(",
"cls",
",",
"include_displaynames",
"=",
"True",
",",
"locales",
"=",
"False",
")",
":",
"translated_scenarios",
"=",
"defaultdict",
"(",
"list",
")",
"scenarios",
"=",
"list",
"(",
"zip",
"(",
"*",
"cls",
".",
"get_sce... | https://github.com/unknown-horizons/unknown-horizons/blob/7397fb333006d26c3d9fe796c7bd9cb8c3b43a49/horizons/savegamemanager.py#L362-L376 | |
radlab/sparrow | afb8efadeb88524f1394d1abe4ea66c6fd2ac744 | src/main/python/third_party/stats.py | python | lkendalltau | (x,y) | return tau, prob | Calculates Kendall's tau ... correlation of ordinal data. Adapted
from function kendl1 in Numerical Recipies. Needs good test-routine.@@@
Usage: lkendalltau(x,y)
Returns: Kendall's tau, two-tailed p-value | Calculates Kendall's tau ... correlation of ordinal data. Adapted
from function kendl1 in Numerical Recipies. Needs good test-routine.@@@ | [
"Calculates",
"Kendall",
"s",
"tau",
"...",
"correlation",
"of",
"ordinal",
"data",
".",
"Adapted",
"from",
"function",
"kendl1",
"in",
"Numerical",
"Recipies",
".",
"Needs",
"good",
"test",
"-",
"routine",
".",
"@@@"
] | def lkendalltau(x,y):
"""
Calculates Kendall's tau ... correlation of ordinal data. Adapted
from function kendl1 in Numerical Recipies. Needs good test-routine.@@@
Usage: lkendalltau(x,y)
Returns: Kendall's tau, two-tailed p-value
"""
n1 = 0
n2 = 0
iss = 0
for j in range(len(x)-1):
for ... | [
"def",
"lkendalltau",
"(",
"x",
",",
"y",
")",
":",
"n1",
"=",
"0",
"n2",
"=",
"0",
"iss",
"=",
"0",
"for",
"j",
"in",
"range",
"(",
"len",
"(",
"x",
")",
"-",
"1",
")",
":",
"for",
"k",
"in",
"range",
"(",
"j",
",",
"len",
"(",
"y",
")... | https://github.com/radlab/sparrow/blob/afb8efadeb88524f1394d1abe4ea66c6fd2ac744/src/main/python/third_party/stats.py#L930-L962 | |
presslabs/gitfs | 12886ec5b9c7e103bfcab0cd37a8333873382fae | gitfs/repository.py | python | Repository.get_git_object_type | (self, tree, path) | Returns the filemode of the git object with the relative path <path>.
:param tree: a `pygit2.Tree` instance
:param path: the relative path of the object
:type entry_name: str
:returns: the filemode for the entry in case of success
(which can be one of the following) or None ... | Returns the filemode of the git object with the relative path <path>. | [
"Returns",
"the",
"filemode",
"of",
"the",
"git",
"object",
"with",
"the",
"relative",
"path",
"<path",
">",
"."
] | def get_git_object_type(self, tree, path):
"""
Returns the filemode of the git object with the relative path <path>.
:param tree: a `pygit2.Tree` instance
:param path: the relative path of the object
:type entry_name: str
:returns: the filemode for the entry in case of s... | [
"def",
"get_git_object_type",
"(",
"self",
",",
"tree",
",",
"path",
")",
":",
"path_components",
"=",
"split_path_into_components",
"(",
"path",
")",
"try",
":",
"return",
"self",
".",
"_get_git_object",
"(",
"tree",
",",
"path_components",
"[",
"-",
"1",
"... | https://github.com/presslabs/gitfs/blob/12886ec5b9c7e103bfcab0cd37a8333873382fae/gitfs/repository.py#L264-L288 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.