repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens listlengths 20 707 | docstring stringlengths 3 17.3k | docstring_tokens listlengths 3 222 | sha stringlengths 40 40 | url stringlengths 87 242 | partition stringclasses 1
value | idx int64 0 252k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
jsommers/switchyard | switchyard/lib/topo/topobuild.py | Topology.addNodeLabelPrefix | def addNodeLabelPrefix(self, prefix=None, copy=False):
'''
Rename all nodes in the network from x to prefix_x. If no prefix
is given, use the name of the graph as the prefix.
The purpose of this method is to make node names unique so that
composing two graphs is well-de... | python | def addNodeLabelPrefix(self, prefix=None, copy=False):
'''
Rename all nodes in the network from x to prefix_x. If no prefix
is given, use the name of the graph as the prefix.
The purpose of this method is to make node names unique so that
composing two graphs is well-de... | [
"def",
"addNodeLabelPrefix",
"(",
"self",
",",
"prefix",
"=",
"None",
",",
"copy",
"=",
"False",
")",
":",
"nxgraph",
"=",
"Topology",
".",
"__relabel_graph",
"(",
"self",
".",
"__nxgraph",
",",
"prefix",
")",
"if",
"copy",
":",
"newtopo",
"=",
"copy",
... | Rename all nodes in the network from x to prefix_x. If no prefix
is given, use the name of the graph as the prefix.
The purpose of this method is to make node names unique so that
composing two graphs is well-defined. | [
"Rename",
"all",
"nodes",
"in",
"the",
"network",
"from",
"x",
"to",
"prefix_x",
".",
"If",
"no",
"prefix",
"is",
"given",
"use",
"the",
"name",
"of",
"the",
"graph",
"as",
"the",
"prefix",
".",
"The",
"purpose",
"of",
"this",
"method",
"is",
"to",
"... | fdcb3869c937dcedbd6ea7a7822ebd412bf1e2b0 | https://github.com/jsommers/switchyard/blob/fdcb3869c937dcedbd6ea7a7822ebd412bf1e2b0/switchyard/lib/topo/topobuild.py#L376-L391 | train | 60,500 |
jsommers/switchyard | switchyard/lib/packet/null.py | Null.from_bytes | def from_bytes(self, raw):
'''Return a Null header object reconstructed from raw bytes, or an
Exception if we can't resurrect the packet.'''
if len(raw) < 4:
raise NotEnoughDataError("Not enough bytes ({}) to reconstruct a Null object".format(len(raw)))
fields = struct.unpack... | python | def from_bytes(self, raw):
'''Return a Null header object reconstructed from raw bytes, or an
Exception if we can't resurrect the packet.'''
if len(raw) < 4:
raise NotEnoughDataError("Not enough bytes ({}) to reconstruct a Null object".format(len(raw)))
fields = struct.unpack... | [
"def",
"from_bytes",
"(",
"self",
",",
"raw",
")",
":",
"if",
"len",
"(",
"raw",
")",
"<",
"4",
":",
"raise",
"NotEnoughDataError",
"(",
"\"Not enough bytes ({}) to reconstruct a Null object\"",
".",
"format",
"(",
"len",
"(",
"raw",
")",
")",
")",
"fields",... | Return a Null header object reconstructed from raw bytes, or an
Exception if we can't resurrect the packet. | [
"Return",
"a",
"Null",
"header",
"object",
"reconstructed",
"from",
"raw",
"bytes",
"or",
"an",
"Exception",
"if",
"we",
"can",
"t",
"resurrect",
"the",
"packet",
"."
] | fdcb3869c937dcedbd6ea7a7822ebd412bf1e2b0 | https://github.com/jsommers/switchyard/blob/fdcb3869c937dcedbd6ea7a7822ebd412bf1e2b0/switchyard/lib/packet/null.py#L43-L50 | train | 60,501 |
jsommers/switchyard | switchyard/lib/packet/packet.py | Packet.add_header | def add_header(self, ph):
'''
Add a PacketHeaderBase derived class object, or a raw bytes object
as the next "header" item in this packet. Note that 'header'
may be a slight misnomer since the last portion of a packet is
considered application payload and not a header per se.
... | python | def add_header(self, ph):
'''
Add a PacketHeaderBase derived class object, or a raw bytes object
as the next "header" item in this packet. Note that 'header'
may be a slight misnomer since the last portion of a packet is
considered application payload and not a header per se.
... | [
"def",
"add_header",
"(",
"self",
",",
"ph",
")",
":",
"if",
"isinstance",
"(",
"ph",
",",
"bytes",
")",
":",
"ph",
"=",
"RawPacketContents",
"(",
"ph",
")",
"if",
"isinstance",
"(",
"ph",
",",
"PacketHeaderBase",
")",
":",
"self",
".",
"_headers",
"... | Add a PacketHeaderBase derived class object, or a raw bytes object
as the next "header" item in this packet. Note that 'header'
may be a slight misnomer since the last portion of a packet is
considered application payload and not a header per se. | [
"Add",
"a",
"PacketHeaderBase",
"derived",
"class",
"object",
"or",
"a",
"raw",
"bytes",
"object",
"as",
"the",
"next",
"header",
"item",
"in",
"this",
"packet",
".",
"Note",
"that",
"header",
"may",
"be",
"a",
"slight",
"misnomer",
"since",
"the",
"last",... | fdcb3869c937dcedbd6ea7a7822ebd412bf1e2b0 | https://github.com/jsommers/switchyard/blob/fdcb3869c937dcedbd6ea7a7822ebd412bf1e2b0/switchyard/lib/packet/packet.py#L109-L121 | train | 60,502 |
jsommers/switchyard | switchyard/lib/packet/packet.py | Packet.has_header | def has_header(self, hdrclass):
'''
Return True if the packet has a header of the given hdrclass,
False otherwise.
'''
if isinstance(hdrclass, str):
return self.get_header_by_name(hdrclass) is not None
return self.get_header(hdrclass) is not None | python | def has_header(self, hdrclass):
'''
Return True if the packet has a header of the given hdrclass,
False otherwise.
'''
if isinstance(hdrclass, str):
return self.get_header_by_name(hdrclass) is not None
return self.get_header(hdrclass) is not None | [
"def",
"has_header",
"(",
"self",
",",
"hdrclass",
")",
":",
"if",
"isinstance",
"(",
"hdrclass",
",",
"str",
")",
":",
"return",
"self",
".",
"get_header_by_name",
"(",
"hdrclass",
")",
"is",
"not",
"None",
"return",
"self",
".",
"get_header",
"(",
"hdr... | Return True if the packet has a header of the given hdrclass,
False otherwise. | [
"Return",
"True",
"if",
"the",
"packet",
"has",
"a",
"header",
"of",
"the",
"given",
"hdrclass",
"False",
"otherwise",
"."
] | fdcb3869c937dcedbd6ea7a7822ebd412bf1e2b0 | https://github.com/jsommers/switchyard/blob/fdcb3869c937dcedbd6ea7a7822ebd412bf1e2b0/switchyard/lib/packet/packet.py#L135-L142 | train | 60,503 |
jsommers/switchyard | switchyard/lib/packet/packet.py | Packet.get_header | def get_header(self, hdrclass, returnval=None):
'''
Return the first header object that is of
class hdrclass, or None if the header class isn't
found.
'''
if isinstance(hdrclass, str):
return self.get_header_by_name(hdrclass)
for hdr in self._headers:... | python | def get_header(self, hdrclass, returnval=None):
'''
Return the first header object that is of
class hdrclass, or None if the header class isn't
found.
'''
if isinstance(hdrclass, str):
return self.get_header_by_name(hdrclass)
for hdr in self._headers:... | [
"def",
"get_header",
"(",
"self",
",",
"hdrclass",
",",
"returnval",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"hdrclass",
",",
"str",
")",
":",
"return",
"self",
".",
"get_header_by_name",
"(",
"hdrclass",
")",
"for",
"hdr",
"in",
"self",
".",
"... | Return the first header object that is of
class hdrclass, or None if the header class isn't
found. | [
"Return",
"the",
"first",
"header",
"object",
"that",
"is",
"of",
"class",
"hdrclass",
"or",
"None",
"if",
"the",
"header",
"class",
"isn",
"t",
"found",
"."
] | fdcb3869c937dcedbd6ea7a7822ebd412bf1e2b0 | https://github.com/jsommers/switchyard/blob/fdcb3869c937dcedbd6ea7a7822ebd412bf1e2b0/switchyard/lib/packet/packet.py#L154-L166 | train | 60,504 |
jsommers/switchyard | switchyard/lib/packet/packet.py | PacketHeaderBase.next_header_class | def next_header_class(self):
'''Return class of next header, if known.'''
if self._next_header_class_key == '':
return None
key = getattr(self, self._next_header_class_key)
rv = self._next_header_map.get(key, None)
if rv is None:
log_warn("No class exists ... | python | def next_header_class(self):
'''Return class of next header, if known.'''
if self._next_header_class_key == '':
return None
key = getattr(self, self._next_header_class_key)
rv = self._next_header_map.get(key, None)
if rv is None:
log_warn("No class exists ... | [
"def",
"next_header_class",
"(",
"self",
")",
":",
"if",
"self",
".",
"_next_header_class_key",
"==",
"''",
":",
"return",
"None",
"key",
"=",
"getattr",
"(",
"self",
",",
"self",
".",
"_next_header_class_key",
")",
"rv",
"=",
"self",
".",
"_next_header_map"... | Return class of next header, if known. | [
"Return",
"class",
"of",
"next",
"header",
"if",
"known",
"."
] | fdcb3869c937dcedbd6ea7a7822ebd412bf1e2b0 | https://github.com/jsommers/switchyard/blob/fdcb3869c937dcedbd6ea7a7822ebd412bf1e2b0/switchyard/lib/packet/packet.py#L285-L293 | train | 60,505 |
jlmadurga/permabots | permabots/views/hooks/messenger_hook.py | MessengerHookView.get | def get(self, request, hook_id):
"""
Verify token when configuring webhook from facebook dev.
MessengerBot.id is used for verification
"""
try:
bot = caching.get_or_set(MessengerBot, hook_id)
except MessengerBot.DoesNotExist:
logger.warnin... | python | def get(self, request, hook_id):
"""
Verify token when configuring webhook from facebook dev.
MessengerBot.id is used for verification
"""
try:
bot = caching.get_or_set(MessengerBot, hook_id)
except MessengerBot.DoesNotExist:
logger.warnin... | [
"def",
"get",
"(",
"self",
",",
"request",
",",
"hook_id",
")",
":",
"try",
":",
"bot",
"=",
"caching",
".",
"get_or_set",
"(",
"MessengerBot",
",",
"hook_id",
")",
"except",
"MessengerBot",
".",
"DoesNotExist",
":",
"logger",
".",
"warning",
"(",
"\"Hoo... | Verify token when configuring webhook from facebook dev.
MessengerBot.id is used for verification | [
"Verify",
"token",
"when",
"configuring",
"webhook",
"from",
"facebook",
"dev",
".",
"MessengerBot",
".",
"id",
"is",
"used",
"for",
"verification"
] | 781a91702529a23fe7bc2aa84c5d88e961412466 | https://github.com/jlmadurga/permabots/blob/781a91702529a23fe7bc2aa84c5d88e961412466/permabots/views/hooks/messenger_hook.py#L183-L196 | train | 60,506 |
tutorcruncher/django-bootstrap3-datetimepicker | bootstrap3_datetime/widgets.py | DateTimePicker._format_value | def _format_value(self, value):
"""This function name was changed in Django 1.10 and removed in 2.0."""
# Use renamed format_name() for Django versions >= 1.10.
if hasattr(self, 'format_value'):
return super(DateTimePicker, self).format_value(value)
# Use old _format_name() f... | python | def _format_value(self, value):
"""This function name was changed in Django 1.10 and removed in 2.0."""
# Use renamed format_name() for Django versions >= 1.10.
if hasattr(self, 'format_value'):
return super(DateTimePicker, self).format_value(value)
# Use old _format_name() f... | [
"def",
"_format_value",
"(",
"self",
",",
"value",
")",
":",
"# Use renamed format_name() for Django versions >= 1.10.",
"if",
"hasattr",
"(",
"self",
",",
"'format_value'",
")",
":",
"return",
"super",
"(",
"DateTimePicker",
",",
"self",
")",
".",
"format_value",
... | This function name was changed in Django 1.10 and removed in 2.0. | [
"This",
"function",
"name",
"was",
"changed",
"in",
"Django",
"1",
".",
"10",
"and",
"removed",
"in",
"2",
".",
"0",
"."
] | 21ee9245116e1a3424e8d9d751446b5651cb6441 | https://github.com/tutorcruncher/django-bootstrap3-datetimepicker/blob/21ee9245116e1a3424e8d9d751446b5651cb6441/bootstrap3_datetime/widgets.py#L84-L91 | train | 60,507 |
campaignmonitor/createsend-python | lib/createsend/createsend.py | CreateSendBase.authorize_url | def authorize_url(self, client_id, redirect_uri, scope, state=None):
"""Get the authorization URL for your application, given the application's
client_id, redirect_uri, scope, and optional state data."""
params = [
('client_id', client_id),
('redirect_uri', redirect_uri),... | python | def authorize_url(self, client_id, redirect_uri, scope, state=None):
"""Get the authorization URL for your application, given the application's
client_id, redirect_uri, scope, and optional state data."""
params = [
('client_id', client_id),
('redirect_uri', redirect_uri),... | [
"def",
"authorize_url",
"(",
"self",
",",
"client_id",
",",
"redirect_uri",
",",
"scope",
",",
"state",
"=",
"None",
")",
":",
"params",
"=",
"[",
"(",
"'client_id'",
",",
"client_id",
")",
",",
"(",
"'redirect_uri'",
",",
"redirect_uri",
")",
",",
"(",
... | Get the authorization URL for your application, given the application's
client_id, redirect_uri, scope, and optional state data. | [
"Get",
"the",
"authorization",
"URL",
"for",
"your",
"application",
"given",
"the",
"application",
"s",
"client_id",
"redirect_uri",
"scope",
"and",
"optional",
"state",
"data",
"."
] | 4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426 | https://github.com/campaignmonitor/createsend-python/blob/4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426/lib/createsend/createsend.py#L70-L80 | train | 60,508 |
campaignmonitor/createsend-python | lib/createsend/createsend.py | CreateSendBase.exchange_token | def exchange_token(self, client_id, client_secret, redirect_uri, code):
"""Exchange a provided OAuth code for an OAuth access token, 'expires in'
value and refresh token."""
params = [
('grant_type', 'authorization_code'),
('client_id', client_id),
('client_se... | python | def exchange_token(self, client_id, client_secret, redirect_uri, code):
"""Exchange a provided OAuth code for an OAuth access token, 'expires in'
value and refresh token."""
params = [
('grant_type', 'authorization_code'),
('client_id', client_id),
('client_se... | [
"def",
"exchange_token",
"(",
"self",
",",
"client_id",
",",
"client_secret",
",",
"redirect_uri",
",",
"code",
")",
":",
"params",
"=",
"[",
"(",
"'grant_type'",
",",
"'authorization_code'",
")",
",",
"(",
"'client_id'",
",",
"client_id",
")",
",",
"(",
"... | Exchange a provided OAuth code for an OAuth access token, 'expires in'
value and refresh token. | [
"Exchange",
"a",
"provided",
"OAuth",
"code",
"for",
"an",
"OAuth",
"access",
"token",
"expires",
"in",
"value",
"and",
"refresh",
"token",
"."
] | 4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426 | https://github.com/campaignmonitor/createsend-python/blob/4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426/lib/createsend/createsend.py#L82-L101 | train | 60,509 |
campaignmonitor/createsend-python | lib/createsend/createsend.py | CreateSendBase.refresh_token | def refresh_token(self):
"""Refresh an OAuth token given a refresh token."""
if (not self.auth_details or
not 'refresh_token' in self.auth_details or
not self.auth_details['refresh_token']):
raise Exception(
"auth_details['refresh_token'] does ... | python | def refresh_token(self):
"""Refresh an OAuth token given a refresh token."""
if (not self.auth_details or
not 'refresh_token' in self.auth_details or
not self.auth_details['refresh_token']):
raise Exception(
"auth_details['refresh_token'] does ... | [
"def",
"refresh_token",
"(",
"self",
")",
":",
"if",
"(",
"not",
"self",
".",
"auth_details",
"or",
"not",
"'refresh_token'",
"in",
"self",
".",
"auth_details",
"or",
"not",
"self",
".",
"auth_details",
"[",
"'refresh_token'",
"]",
")",
":",
"raise",
"Exce... | Refresh an OAuth token given a refresh token. | [
"Refresh",
"an",
"OAuth",
"token",
"given",
"a",
"refresh",
"token",
"."
] | 4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426 | https://github.com/campaignmonitor/createsend-python/blob/4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426/lib/createsend/createsend.py#L116-L137 | train | 60,510 |
campaignmonitor/createsend-python | lib/createsend/createsend.py | CreateSendBase.stub_request | def stub_request(self, expected_url, filename, status=None, body=None):
"""Stub a web request for testing."""
self.fake_web = True
self.faker = get_faker(expected_url, filename, status, body) | python | def stub_request(self, expected_url, filename, status=None, body=None):
"""Stub a web request for testing."""
self.fake_web = True
self.faker = get_faker(expected_url, filename, status, body) | [
"def",
"stub_request",
"(",
"self",
",",
"expected_url",
",",
"filename",
",",
"status",
"=",
"None",
",",
"body",
"=",
"None",
")",
":",
"self",
".",
"fake_web",
"=",
"True",
"self",
".",
"faker",
"=",
"get_faker",
"(",
"expected_url",
",",
"filename",
... | Stub a web request for testing. | [
"Stub",
"a",
"web",
"request",
"for",
"testing",
"."
] | 4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426 | https://github.com/campaignmonitor/createsend-python/blob/4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426/lib/createsend/createsend.py#L139-L142 | train | 60,511 |
campaignmonitor/createsend-python | lib/createsend/person.py | Person.get | def get(self, client_id=None, email_address=None):
"""Gets a person by client ID and email address."""
params = {"email": email_address or self.email_address}
response = self._get("/clients/%s/people.json" %
(client_id or self.client_id), params=params)
retur... | python | def get(self, client_id=None, email_address=None):
"""Gets a person by client ID and email address."""
params = {"email": email_address or self.email_address}
response = self._get("/clients/%s/people.json" %
(client_id or self.client_id), params=params)
retur... | [
"def",
"get",
"(",
"self",
",",
"client_id",
"=",
"None",
",",
"email_address",
"=",
"None",
")",
":",
"params",
"=",
"{",
"\"email\"",
":",
"email_address",
"or",
"self",
".",
"email_address",
"}",
"response",
"=",
"self",
".",
"_get",
"(",
"\"/clients/... | Gets a person by client ID and email address. | [
"Gets",
"a",
"person",
"by",
"client",
"ID",
"and",
"email",
"address",
"."
] | 4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426 | https://github.com/campaignmonitor/createsend-python/blob/4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426/lib/createsend/person.py#L17-L22 | train | 60,512 |
campaignmonitor/createsend-python | lib/createsend/person.py | Person.add | def add(self, client_id, email_address, name, access_level, password):
"""Adds a person to a client. Password is optional and if not supplied, an invitation will be emailed to the person"""
body = {
"EmailAddress": email_address,
"Name": name,
"AccessLevel": access_le... | python | def add(self, client_id, email_address, name, access_level, password):
"""Adds a person to a client. Password is optional and if not supplied, an invitation will be emailed to the person"""
body = {
"EmailAddress": email_address,
"Name": name,
"AccessLevel": access_le... | [
"def",
"add",
"(",
"self",
",",
"client_id",
",",
"email_address",
",",
"name",
",",
"access_level",
",",
"password",
")",
":",
"body",
"=",
"{",
"\"EmailAddress\"",
":",
"email_address",
",",
"\"Name\"",
":",
"name",
",",
"\"AccessLevel\"",
":",
"access_lev... | Adds a person to a client. Password is optional and if not supplied, an invitation will be emailed to the person | [
"Adds",
"a",
"person",
"to",
"a",
"client",
".",
"Password",
"is",
"optional",
"and",
"if",
"not",
"supplied",
"an",
"invitation",
"will",
"be",
"emailed",
"to",
"the",
"person"
] | 4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426 | https://github.com/campaignmonitor/createsend-python/blob/4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426/lib/createsend/person.py#L24-L33 | train | 60,513 |
campaignmonitor/createsend-python | lib/createsend/person.py | Person.update | def update(self, new_email_address, name, access_level, password=None):
"""Updates the details for a person. Password is optional and is only updated if supplied."""
params = {"email": self.email_address}
body = {
"EmailAddress": new_email_address,
"Name": name,
... | python | def update(self, new_email_address, name, access_level, password=None):
"""Updates the details for a person. Password is optional and is only updated if supplied."""
params = {"email": self.email_address}
body = {
"EmailAddress": new_email_address,
"Name": name,
... | [
"def",
"update",
"(",
"self",
",",
"new_email_address",
",",
"name",
",",
"access_level",
",",
"password",
"=",
"None",
")",
":",
"params",
"=",
"{",
"\"email\"",
":",
"self",
".",
"email_address",
"}",
"body",
"=",
"{",
"\"EmailAddress\"",
":",
"new_email... | Updates the details for a person. Password is optional and is only updated if supplied. | [
"Updates",
"the",
"details",
"for",
"a",
"person",
".",
"Password",
"is",
"optional",
"and",
"is",
"only",
"updated",
"if",
"supplied",
"."
] | 4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426 | https://github.com/campaignmonitor/createsend-python/blob/4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426/lib/createsend/person.py#L35-L47 | train | 60,514 |
campaignmonitor/createsend-python | lib/createsend/campaign.py | Campaign.create | def create(self, client_id, subject, name, from_name, from_email, reply_to, html_url,
text_url, list_ids, segment_ids):
"""Creates a new campaign for a client.
:param client_id: String representing the ID of the client for whom the
campaign will be created.
:param subje... | python | def create(self, client_id, subject, name, from_name, from_email, reply_to, html_url,
text_url, list_ids, segment_ids):
"""Creates a new campaign for a client.
:param client_id: String representing the ID of the client for whom the
campaign will be created.
:param subje... | [
"def",
"create",
"(",
"self",
",",
"client_id",
",",
"subject",
",",
"name",
",",
"from_name",
",",
"from_email",
",",
"reply_to",
",",
"html_url",
",",
"text_url",
",",
"list_ids",
",",
"segment_ids",
")",
":",
"body",
"=",
"{",
"\"Subject\"",
":",
"sub... | Creates a new campaign for a client.
:param client_id: String representing the ID of the client for whom the
campaign will be created.
:param subject: String representing the subject of the campaign.
:param name: String representing the name of the campaign.
:param from_name: ... | [
"Creates",
"a",
"new",
"campaign",
"for",
"a",
"client",
"."
] | 4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426 | https://github.com/campaignmonitor/createsend-python/blob/4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426/lib/createsend/campaign.py#L16-L50 | train | 60,515 |
campaignmonitor/createsend-python | lib/createsend/campaign.py | Campaign.create_from_template | def create_from_template(self, client_id, subject, name, from_name,
from_email, reply_to, list_ids, segment_ids, template_id, template_content):
"""Creates a new campaign for a client, from a template.
:param client_id: String representing the ID of the client for whom the
... | python | def create_from_template(self, client_id, subject, name, from_name,
from_email, reply_to, list_ids, segment_ids, template_id, template_content):
"""Creates a new campaign for a client, from a template.
:param client_id: String representing the ID of the client for whom the
... | [
"def",
"create_from_template",
"(",
"self",
",",
"client_id",
",",
"subject",
",",
"name",
",",
"from_name",
",",
"from_email",
",",
"reply_to",
",",
"list_ids",
",",
"segment_ids",
",",
"template_id",
",",
"template_content",
")",
":",
"body",
"=",
"{",
"\"... | Creates a new campaign for a client, from a template.
:param client_id: String representing the ID of the client for whom the
campaign will be created.
:param subject: String representing the subject of the campaign.
:param name: String representing the name of the campaign.
:... | [
"Creates",
"a",
"new",
"campaign",
"for",
"a",
"client",
"from",
"a",
"template",
"."
] | 4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426 | https://github.com/campaignmonitor/createsend-python/blob/4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426/lib/createsend/campaign.py#L52-L88 | train | 60,516 |
campaignmonitor/createsend-python | lib/createsend/campaign.py | Campaign.send_preview | def send_preview(self, recipients, personalize="fallback"):
"""Sends a preview of this campaign."""
body = {
"PreviewRecipients": [recipients] if isinstance(recipients, str) else recipients,
"Personalize": personalize}
response = self._post(self.uri_for("sendpreview"), js... | python | def send_preview(self, recipients, personalize="fallback"):
"""Sends a preview of this campaign."""
body = {
"PreviewRecipients": [recipients] if isinstance(recipients, str) else recipients,
"Personalize": personalize}
response = self._post(self.uri_for("sendpreview"), js... | [
"def",
"send_preview",
"(",
"self",
",",
"recipients",
",",
"personalize",
"=",
"\"fallback\"",
")",
":",
"body",
"=",
"{",
"\"PreviewRecipients\"",
":",
"[",
"recipients",
"]",
"if",
"isinstance",
"(",
"recipients",
",",
"str",
")",
"else",
"recipients",
",... | Sends a preview of this campaign. | [
"Sends",
"a",
"preview",
"of",
"this",
"campaign",
"."
] | 4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426 | https://github.com/campaignmonitor/createsend-python/blob/4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426/lib/createsend/campaign.py#L90-L95 | train | 60,517 |
campaignmonitor/createsend-python | lib/createsend/campaign.py | Campaign.send | def send(self, confirmation_email, send_date="immediately"):
"""Sends this campaign."""
body = {
"ConfirmationEmail": confirmation_email,
"SendDate": send_date}
response = self._post(self.uri_for("send"), json.dumps(body)) | python | def send(self, confirmation_email, send_date="immediately"):
"""Sends this campaign."""
body = {
"ConfirmationEmail": confirmation_email,
"SendDate": send_date}
response = self._post(self.uri_for("send"), json.dumps(body)) | [
"def",
"send",
"(",
"self",
",",
"confirmation_email",
",",
"send_date",
"=",
"\"immediately\"",
")",
":",
"body",
"=",
"{",
"\"ConfirmationEmail\"",
":",
"confirmation_email",
",",
"\"SendDate\"",
":",
"send_date",
"}",
"response",
"=",
"self",
".",
"_post",
... | Sends this campaign. | [
"Sends",
"this",
"campaign",
"."
] | 4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426 | https://github.com/campaignmonitor/createsend-python/blob/4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426/lib/createsend/campaign.py#L97-L102 | train | 60,518 |
campaignmonitor/createsend-python | lib/createsend/campaign.py | Campaign.opens | def opens(self, date="", page=1, page_size=1000, order_field="date", order_direction="asc"):
"""Retrieves the opens for this campaign."""
params = {
"date": date,
"page": page,
"pagesize": page_size,
"orderfield": order_field,
"orderdirection":... | python | def opens(self, date="", page=1, page_size=1000, order_field="date", order_direction="asc"):
"""Retrieves the opens for this campaign."""
params = {
"date": date,
"page": page,
"pagesize": page_size,
"orderfield": order_field,
"orderdirection":... | [
"def",
"opens",
"(",
"self",
",",
"date",
"=",
"\"\"",
",",
"page",
"=",
"1",
",",
"page_size",
"=",
"1000",
",",
"order_field",
"=",
"\"date\"",
",",
"order_direction",
"=",
"\"asc\"",
")",
":",
"params",
"=",
"{",
"\"date\"",
":",
"date",
",",
"\"p... | Retrieves the opens for this campaign. | [
"Retrieves",
"the",
"opens",
"for",
"this",
"campaign",
"."
] | 4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426 | https://github.com/campaignmonitor/createsend-python/blob/4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426/lib/createsend/campaign.py#L137-L146 | train | 60,519 |
campaignmonitor/createsend-python | lib/createsend/client.py | Client.create | def create(self, company, timezone, country):
"""Creates a client."""
body = {
"CompanyName": company,
"TimeZone": timezone,
"Country": country}
response = self._post("/clients.json", json.dumps(body))
self.client_id = json_to_py(response)
ret... | python | def create(self, company, timezone, country):
"""Creates a client."""
body = {
"CompanyName": company,
"TimeZone": timezone,
"Country": country}
response = self._post("/clients.json", json.dumps(body))
self.client_id = json_to_py(response)
ret... | [
"def",
"create",
"(",
"self",
",",
"company",
",",
"timezone",
",",
"country",
")",
":",
"body",
"=",
"{",
"\"CompanyName\"",
":",
"company",
",",
"\"TimeZone\"",
":",
"timezone",
",",
"\"Country\"",
":",
"country",
"}",
"response",
"=",
"self",
".",
"_p... | Creates a client. | [
"Creates",
"a",
"client",
"."
] | 4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426 | https://github.com/campaignmonitor/createsend-python/blob/4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426/lib/createsend/client.py#L16-L25 | train | 60,520 |
campaignmonitor/createsend-python | lib/createsend/client.py | Client.lists_for_email | def lists_for_email(self, email_address):
"""Gets the lists across a client to which a subscriber with a particular
email address belongs."""
params = {"email": email_address}
response = self._get(self.uri_for("listsforemail"), params=params)
return json_to_py(response) | python | def lists_for_email(self, email_address):
"""Gets the lists across a client to which a subscriber with a particular
email address belongs."""
params = {"email": email_address}
response = self._get(self.uri_for("listsforemail"), params=params)
return json_to_py(response) | [
"def",
"lists_for_email",
"(",
"self",
",",
"email_address",
")",
":",
"params",
"=",
"{",
"\"email\"",
":",
"email_address",
"}",
"response",
"=",
"self",
".",
"_get",
"(",
"self",
".",
"uri_for",
"(",
"\"listsforemail\"",
")",
",",
"params",
"=",
"params... | Gets the lists across a client to which a subscriber with a particular
email address belongs. | [
"Gets",
"the",
"lists",
"across",
"a",
"client",
"to",
"which",
"a",
"subscriber",
"with",
"a",
"particular",
"email",
"address",
"belongs",
"."
] | 4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426 | https://github.com/campaignmonitor/createsend-python/blob/4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426/lib/createsend/client.py#L52-L57 | train | 60,521 |
campaignmonitor/createsend-python | lib/createsend/client.py | Client.suppressionlist | def suppressionlist(self, page=1, page_size=1000, order_field="email", order_direction="asc"):
"""Gets this client's suppression list."""
params = {
"page": page,
"pagesize": page_size,
"orderfield": order_field,
"orderdirection": order_direction}
... | python | def suppressionlist(self, page=1, page_size=1000, order_field="email", order_direction="asc"):
"""Gets this client's suppression list."""
params = {
"page": page,
"pagesize": page_size,
"orderfield": order_field,
"orderdirection": order_direction}
... | [
"def",
"suppressionlist",
"(",
"self",
",",
"page",
"=",
"1",
",",
"page_size",
"=",
"1000",
",",
"order_field",
"=",
"\"email\"",
",",
"order_direction",
"=",
"\"asc\"",
")",
":",
"params",
"=",
"{",
"\"page\"",
":",
"page",
",",
"\"pagesize\"",
":",
"p... | Gets this client's suppression list. | [
"Gets",
"this",
"client",
"s",
"suppression",
"list",
"."
] | 4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426 | https://github.com/campaignmonitor/createsend-python/blob/4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426/lib/createsend/client.py#L64-L72 | train | 60,522 |
campaignmonitor/createsend-python | lib/createsend/client.py | Client.suppress | def suppress(self, email):
"""Adds email addresses to a client's suppression list"""
body = {
"EmailAddresses": [email] if isinstance(email, str) else email}
response = self._post(self.uri_for("suppress"), json.dumps(body)) | python | def suppress(self, email):
"""Adds email addresses to a client's suppression list"""
body = {
"EmailAddresses": [email] if isinstance(email, str) else email}
response = self._post(self.uri_for("suppress"), json.dumps(body)) | [
"def",
"suppress",
"(",
"self",
",",
"email",
")",
":",
"body",
"=",
"{",
"\"EmailAddresses\"",
":",
"[",
"email",
"]",
"if",
"isinstance",
"(",
"email",
",",
"str",
")",
"else",
"email",
"}",
"response",
"=",
"self",
".",
"_post",
"(",
"self",
".",
... | Adds email addresses to a client's suppression list | [
"Adds",
"email",
"addresses",
"to",
"a",
"client",
"s",
"suppression",
"list"
] | 4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426 | https://github.com/campaignmonitor/createsend-python/blob/4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426/lib/createsend/client.py#L74-L78 | train | 60,523 |
campaignmonitor/createsend-python | lib/createsend/client.py | Client.unsuppress | def unsuppress(self, email):
"""Unsuppresses an email address by removing it from the the client's
suppression list"""
params = {"email": email}
response = self._put(self.uri_for("unsuppress"),
body=" ", params=params) | python | def unsuppress(self, email):
"""Unsuppresses an email address by removing it from the the client's
suppression list"""
params = {"email": email}
response = self._put(self.uri_for("unsuppress"),
body=" ", params=params) | [
"def",
"unsuppress",
"(",
"self",
",",
"email",
")",
":",
"params",
"=",
"{",
"\"email\"",
":",
"email",
"}",
"response",
"=",
"self",
".",
"_put",
"(",
"self",
".",
"uri_for",
"(",
"\"unsuppress\"",
")",
",",
"body",
"=",
"\" \"",
",",
"params",
"="... | Unsuppresses an email address by removing it from the the client's
suppression list | [
"Unsuppresses",
"an",
"email",
"address",
"by",
"removing",
"it",
"from",
"the",
"the",
"client",
"s",
"suppression",
"list"
] | 4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426 | https://github.com/campaignmonitor/createsend-python/blob/4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426/lib/createsend/client.py#L80-L85 | train | 60,524 |
campaignmonitor/createsend-python | lib/createsend/client.py | Client.set_payg_billing | def set_payg_billing(self, currency, can_purchase_credits, client_pays, markup_percentage,
markup_on_delivery=0, markup_per_recipient=0, markup_on_design_spam_test=0):
"""Sets the PAYG billing settings for this client."""
body = {
"Currency": currency,
"C... | python | def set_payg_billing(self, currency, can_purchase_credits, client_pays, markup_percentage,
markup_on_delivery=0, markup_per_recipient=0, markup_on_design_spam_test=0):
"""Sets the PAYG billing settings for this client."""
body = {
"Currency": currency,
"C... | [
"def",
"set_payg_billing",
"(",
"self",
",",
"currency",
",",
"can_purchase_credits",
",",
"client_pays",
",",
"markup_percentage",
",",
"markup_on_delivery",
"=",
"0",
",",
"markup_per_recipient",
"=",
"0",
",",
"markup_on_design_spam_test",
"=",
"0",
")",
":",
"... | Sets the PAYG billing settings for this client. | [
"Sets",
"the",
"PAYG",
"billing",
"settings",
"for",
"this",
"client",
"."
] | 4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426 | https://github.com/campaignmonitor/createsend-python/blob/4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426/lib/createsend/client.py#L99-L110 | train | 60,525 |
campaignmonitor/createsend-python | lib/createsend/client.py | Client.set_monthly_billing | def set_monthly_billing(self, currency, client_pays, markup_percentage, monthly_scheme=None):
"""Sets the monthly billing settings for this client."""
body = {
"Currency": currency,
"ClientPays": client_pays,
"MarkupPercentage": markup_percentage}
if monthly_... | python | def set_monthly_billing(self, currency, client_pays, markup_percentage, monthly_scheme=None):
"""Sets the monthly billing settings for this client."""
body = {
"Currency": currency,
"ClientPays": client_pays,
"MarkupPercentage": markup_percentage}
if monthly_... | [
"def",
"set_monthly_billing",
"(",
"self",
",",
"currency",
",",
"client_pays",
",",
"markup_percentage",
",",
"monthly_scheme",
"=",
"None",
")",
":",
"body",
"=",
"{",
"\"Currency\"",
":",
"currency",
",",
"\"ClientPays\"",
":",
"client_pays",
",",
"\"MarkupPe... | Sets the monthly billing settings for this client. | [
"Sets",
"the",
"monthly",
"billing",
"settings",
"for",
"this",
"client",
"."
] | 4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426 | https://github.com/campaignmonitor/createsend-python/blob/4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426/lib/createsend/client.py#L112-L123 | train | 60,526 |
campaignmonitor/createsend-python | lib/createsend/client.py | Client.transfer_credits | def transfer_credits(self, credits, can_use_my_credits_when_they_run_out):
"""Transfer credits to or from this client.
:param credits: An Integer representing the number of credits to transfer.
This value may be either positive if you want to allocate credits from
your account to th... | python | def transfer_credits(self, credits, can_use_my_credits_when_they_run_out):
"""Transfer credits to or from this client.
:param credits: An Integer representing the number of credits to transfer.
This value may be either positive if you want to allocate credits from
your account to th... | [
"def",
"transfer_credits",
"(",
"self",
",",
"credits",
",",
"can_use_my_credits_when_they_run_out",
")",
":",
"body",
"=",
"{",
"\"Credits\"",
":",
"credits",
",",
"\"CanUseMyCreditsWhenTheyRunOut\"",
":",
"can_use_my_credits_when_they_run_out",
"}",
"response",
"=",
"... | Transfer credits to or from this client.
:param credits: An Integer representing the number of credits to transfer.
This value may be either positive if you want to allocate credits from
your account to the client, or negative if you want to deduct credits
from the client back int... | [
"Transfer",
"credits",
"to",
"or",
"from",
"this",
"client",
"."
] | 4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426 | https://github.com/campaignmonitor/createsend-python/blob/4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426/lib/createsend/client.py#L125-L148 | train | 60,527 |
campaignmonitor/createsend-python | lib/createsend/client.py | Client.set_primary_contact | def set_primary_contact(self, email):
"""assigns the primary contact for this client"""
params = {"email": email}
response = self._put(self.uri_for('primarycontact'), params=params)
return json_to_py(response) | python | def set_primary_contact(self, email):
"""assigns the primary contact for this client"""
params = {"email": email}
response = self._put(self.uri_for('primarycontact'), params=params)
return json_to_py(response) | [
"def",
"set_primary_contact",
"(",
"self",
",",
"email",
")",
":",
"params",
"=",
"{",
"\"email\"",
":",
"email",
"}",
"response",
"=",
"self",
".",
"_put",
"(",
"self",
".",
"uri_for",
"(",
"'primarycontact'",
")",
",",
"params",
"=",
"params",
")",
"... | assigns the primary contact for this client | [
"assigns",
"the",
"primary",
"contact",
"for",
"this",
"client"
] | 4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426 | https://github.com/campaignmonitor/createsend-python/blob/4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426/lib/createsend/client.py#L160-L164 | train | 60,528 |
campaignmonitor/createsend-python | lib/createsend/transactional.py | Transactional.smart_email_list | def smart_email_list(self, status="all", client_id=None):
"""Gets the smart email list."""
if client_id is None:
response = self._get(
"/transactional/smartEmail?status=%s" % status)
else:
response = self._get(
"/transactional/smartEmail?st... | python | def smart_email_list(self, status="all", client_id=None):
"""Gets the smart email list."""
if client_id is None:
response = self._get(
"/transactional/smartEmail?status=%s" % status)
else:
response = self._get(
"/transactional/smartEmail?st... | [
"def",
"smart_email_list",
"(",
"self",
",",
"status",
"=",
"\"all\"",
",",
"client_id",
"=",
"None",
")",
":",
"if",
"client_id",
"is",
"None",
":",
"response",
"=",
"self",
".",
"_get",
"(",
"\"/transactional/smartEmail?status=%s\"",
"%",
"status",
")",
"e... | Gets the smart email list. | [
"Gets",
"the",
"smart",
"email",
"list",
"."
] | 4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426 | https://github.com/campaignmonitor/createsend-python/blob/4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426/lib/createsend/transactional.py#L16-L24 | train | 60,529 |
campaignmonitor/createsend-python | lib/createsend/transactional.py | Transactional.smart_email_send | def smart_email_send(self, smart_email_id, to, consent_to_track, cc=None, bcc=None, attachments=None, data=None, add_recipients_to_list=None):
"""Sends the smart email."""
validate_consent_to_track(consent_to_track)
body = {
"To": to,
"CC": cc,
"BCC": bcc,
... | python | def smart_email_send(self, smart_email_id, to, consent_to_track, cc=None, bcc=None, attachments=None, data=None, add_recipients_to_list=None):
"""Sends the smart email."""
validate_consent_to_track(consent_to_track)
body = {
"To": to,
"CC": cc,
"BCC": bcc,
... | [
"def",
"smart_email_send",
"(",
"self",
",",
"smart_email_id",
",",
"to",
",",
"consent_to_track",
",",
"cc",
"=",
"None",
",",
"bcc",
"=",
"None",
",",
"attachments",
"=",
"None",
",",
"data",
"=",
"None",
",",
"add_recipients_to_list",
"=",
"None",
")",
... | Sends the smart email. | [
"Sends",
"the",
"smart",
"email",
"."
] | 4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426 | https://github.com/campaignmonitor/createsend-python/blob/4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426/lib/createsend/transactional.py#L31-L45 | train | 60,530 |
campaignmonitor/createsend-python | lib/createsend/transactional.py | Transactional.classic_email_send | def classic_email_send(self, subject, from_address, to, consent_to_track, client_id=None, cc=None, bcc=None, html=None, text=None, attachments=None, track_opens=True, track_clicks=True, inline_css=True, group=None, add_recipients_to_list=None):
"""Sends a classic email."""
validate_consent_to_track(cons... | python | def classic_email_send(self, subject, from_address, to, consent_to_track, client_id=None, cc=None, bcc=None, html=None, text=None, attachments=None, track_opens=True, track_clicks=True, inline_css=True, group=None, add_recipients_to_list=None):
"""Sends a classic email."""
validate_consent_to_track(cons... | [
"def",
"classic_email_send",
"(",
"self",
",",
"subject",
",",
"from_address",
",",
"to",
",",
"consent_to_track",
",",
"client_id",
"=",
"None",
",",
"cc",
"=",
"None",
",",
"bcc",
"=",
"None",
",",
"html",
"=",
"None",
",",
"text",
"=",
"None",
",",
... | Sends a classic email. | [
"Sends",
"a",
"classic",
"email",
"."
] | 4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426 | https://github.com/campaignmonitor/createsend-python/blob/4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426/lib/createsend/transactional.py#L47-L72 | train | 60,531 |
campaignmonitor/createsend-python | lib/createsend/transactional.py | Transactional.classic_email_groups | def classic_email_groups(self, client_id=None):
"""Gets the list of classic email groups."""
if client_id is None:
response = self._get("/transactional/classicEmail/groups")
else:
response = self._get(
"/transactional/classicEmail/groups?clientID=%s" % cli... | python | def classic_email_groups(self, client_id=None):
"""Gets the list of classic email groups."""
if client_id is None:
response = self._get("/transactional/classicEmail/groups")
else:
response = self._get(
"/transactional/classicEmail/groups?clientID=%s" % cli... | [
"def",
"classic_email_groups",
"(",
"self",
",",
"client_id",
"=",
"None",
")",
":",
"if",
"client_id",
"is",
"None",
":",
"response",
"=",
"self",
".",
"_get",
"(",
"\"/transactional/classicEmail/groups\"",
")",
"else",
":",
"response",
"=",
"self",
".",
"_... | Gets the list of classic email groups. | [
"Gets",
"the",
"list",
"of",
"classic",
"email",
"groups",
"."
] | 4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426 | https://github.com/campaignmonitor/createsend-python/blob/4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426/lib/createsend/transactional.py#L74-L81 | train | 60,532 |
campaignmonitor/createsend-python | lib/createsend/transactional.py | Transactional.message_details | def message_details(self, message_id, statistics=False):
"""Gets the details of this message."""
response = self._get(
"/transactional/messages/%s?statistics=%s" % (message_id, statistics))
return json_to_py(response) | python | def message_details(self, message_id, statistics=False):
"""Gets the details of this message."""
response = self._get(
"/transactional/messages/%s?statistics=%s" % (message_id, statistics))
return json_to_py(response) | [
"def",
"message_details",
"(",
"self",
",",
"message_id",
",",
"statistics",
"=",
"False",
")",
":",
"response",
"=",
"self",
".",
"_get",
"(",
"\"/transactional/messages/%s?statistics=%s\"",
"%",
"(",
"message_id",
",",
"statistics",
")",
")",
"return",
"json_t... | Gets the details of this message. | [
"Gets",
"the",
"details",
"of",
"this",
"message",
"."
] | 4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426 | https://github.com/campaignmonitor/createsend-python/blob/4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426/lib/createsend/transactional.py#L93-L97 | train | 60,533 |
campaignmonitor/createsend-python | lib/createsend/segment.py | Segment.create | def create(self, list_id, title, rulegroups):
"""Creates a new segment."""
body = {
"Title": title,
"RuleGroups": rulegroups}
response = self._post("/segments/%s.json" % list_id, json.dumps(body))
self.segment_id = json_to_py(response)
return self.segment_... | python | def create(self, list_id, title, rulegroups):
"""Creates a new segment."""
body = {
"Title": title,
"RuleGroups": rulegroups}
response = self._post("/segments/%s.json" % list_id, json.dumps(body))
self.segment_id = json_to_py(response)
return self.segment_... | [
"def",
"create",
"(",
"self",
",",
"list_id",
",",
"title",
",",
"rulegroups",
")",
":",
"body",
"=",
"{",
"\"Title\"",
":",
"title",
",",
"\"RuleGroups\"",
":",
"rulegroups",
"}",
"response",
"=",
"self",
".",
"_post",
"(",
"\"/segments/%s.json\"",
"%",
... | Creates a new segment. | [
"Creates",
"a",
"new",
"segment",
"."
] | 4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426 | https://github.com/campaignmonitor/createsend-python/blob/4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426/lib/createsend/segment.py#L16-L23 | train | 60,534 |
campaignmonitor/createsend-python | lib/createsend/segment.py | Segment.update | def update(self, title, rulegroups):
"""Updates this segment."""
body = {
"Title": title,
"RuleGroups": rulegroups}
response = self._put("/segments/%s.json" %
self.segment_id, json.dumps(body)) | python | def update(self, title, rulegroups):
"""Updates this segment."""
body = {
"Title": title,
"RuleGroups": rulegroups}
response = self._put("/segments/%s.json" %
self.segment_id, json.dumps(body)) | [
"def",
"update",
"(",
"self",
",",
"title",
",",
"rulegroups",
")",
":",
"body",
"=",
"{",
"\"Title\"",
":",
"title",
",",
"\"RuleGroups\"",
":",
"rulegroups",
"}",
"response",
"=",
"self",
".",
"_put",
"(",
"\"/segments/%s.json\"",
"%",
"self",
".",
"se... | Updates this segment. | [
"Updates",
"this",
"segment",
"."
] | 4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426 | https://github.com/campaignmonitor/createsend-python/blob/4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426/lib/createsend/segment.py#L25-L31 | train | 60,535 |
campaignmonitor/createsend-python | lib/createsend/segment.py | Segment.add_rulegroup | def add_rulegroup(self, rulegroup):
"""Adds a rulegroup to this segment."""
body = rulegroup
response = self._post("/segments/%s/rules.json" %
self.segment_id, json.dumps(body)) | python | def add_rulegroup(self, rulegroup):
"""Adds a rulegroup to this segment."""
body = rulegroup
response = self._post("/segments/%s/rules.json" %
self.segment_id, json.dumps(body)) | [
"def",
"add_rulegroup",
"(",
"self",
",",
"rulegroup",
")",
":",
"body",
"=",
"rulegroup",
"response",
"=",
"self",
".",
"_post",
"(",
"\"/segments/%s/rules.json\"",
"%",
"self",
".",
"segment_id",
",",
"json",
".",
"dumps",
"(",
"body",
")",
")"
] | Adds a rulegroup to this segment. | [
"Adds",
"a",
"rulegroup",
"to",
"this",
"segment",
"."
] | 4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426 | https://github.com/campaignmonitor/createsend-python/blob/4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426/lib/createsend/segment.py#L33-L37 | train | 60,536 |
campaignmonitor/createsend-python | lib/createsend/segment.py | Segment.subscribers | def subscribers(self, date="", page=1, page_size=1000, order_field="email", order_direction="asc", include_tracking_information=False):
"""Gets the active subscribers in this segment."""
params = {
"date": date,
"page": page,
"pagesize": page_size,
"orderf... | python | def subscribers(self, date="", page=1, page_size=1000, order_field="email", order_direction="asc", include_tracking_information=False):
"""Gets the active subscribers in this segment."""
params = {
"date": date,
"page": page,
"pagesize": page_size,
"orderf... | [
"def",
"subscribers",
"(",
"self",
",",
"date",
"=",
"\"\"",
",",
"page",
"=",
"1",
",",
"page_size",
"=",
"1000",
",",
"order_field",
"=",
"\"email\"",
",",
"order_direction",
"=",
"\"asc\"",
",",
"include_tracking_information",
"=",
"False",
")",
":",
"p... | Gets the active subscribers in this segment. | [
"Gets",
"the",
"active",
"subscribers",
"in",
"this",
"segment",
"."
] | 4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426 | https://github.com/campaignmonitor/createsend-python/blob/4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426/lib/createsend/segment.py#L39-L50 | train | 60,537 |
campaignmonitor/createsend-python | lib/createsend/template.py | Template.create | def create(self, client_id, name, html_url, zip_url):
"""Creates a new email template."""
body = {
"Name": name,
"HtmlPageURL": html_url,
"ZipFileURL": zip_url}
response = self._post("/templates/%s.json" %
client_id, json.dumps(bo... | python | def create(self, client_id, name, html_url, zip_url):
"""Creates a new email template."""
body = {
"Name": name,
"HtmlPageURL": html_url,
"ZipFileURL": zip_url}
response = self._post("/templates/%s.json" %
client_id, json.dumps(bo... | [
"def",
"create",
"(",
"self",
",",
"client_id",
",",
"name",
",",
"html_url",
",",
"zip_url",
")",
":",
"body",
"=",
"{",
"\"Name\"",
":",
"name",
",",
"\"HtmlPageURL\"",
":",
"html_url",
",",
"\"ZipFileURL\"",
":",
"zip_url",
"}",
"response",
"=",
"self... | Creates a new email template. | [
"Creates",
"a",
"new",
"email",
"template",
"."
] | 4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426 | https://github.com/campaignmonitor/createsend-python/blob/4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426/lib/createsend/template.py#L16-L25 | train | 60,538 |
campaignmonitor/createsend-python | lib/createsend/template.py | Template.update | def update(self, name, html_url, zip_url):
"""Updates this email template."""
body = {
"Name": name,
"HtmlPageURL": html_url,
"ZipFileURL": zip_url}
response = self._put("/templates/%s.json" %
self.template_id, json.dumps(body)) | python | def update(self, name, html_url, zip_url):
"""Updates this email template."""
body = {
"Name": name,
"HtmlPageURL": html_url,
"ZipFileURL": zip_url}
response = self._put("/templates/%s.json" %
self.template_id, json.dumps(body)) | [
"def",
"update",
"(",
"self",
",",
"name",
",",
"html_url",
",",
"zip_url",
")",
":",
"body",
"=",
"{",
"\"Name\"",
":",
"name",
",",
"\"HtmlPageURL\"",
":",
"html_url",
",",
"\"ZipFileURL\"",
":",
"zip_url",
"}",
"response",
"=",
"self",
".",
"_put",
... | Updates this email template. | [
"Updates",
"this",
"email",
"template",
"."
] | 4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426 | https://github.com/campaignmonitor/createsend-python/blob/4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426/lib/createsend/template.py#L32-L39 | train | 60,539 |
campaignmonitor/createsend-python | lib/createsend/administrator.py | Administrator.add | def add(self, email_address, name):
"""Adds an administrator to an account."""
body = {
"EmailAddress": email_address,
"Name": name}
response = self._post("/admins.json", json.dumps(body))
return json_to_py(response) | python | def add(self, email_address, name):
"""Adds an administrator to an account."""
body = {
"EmailAddress": email_address,
"Name": name}
response = self._post("/admins.json", json.dumps(body))
return json_to_py(response) | [
"def",
"add",
"(",
"self",
",",
"email_address",
",",
"name",
")",
":",
"body",
"=",
"{",
"\"EmailAddress\"",
":",
"email_address",
",",
"\"Name\"",
":",
"name",
"}",
"response",
"=",
"self",
".",
"_post",
"(",
"\"/admins.json\"",
",",
"json",
".",
"dump... | Adds an administrator to an account. | [
"Adds",
"an",
"administrator",
"to",
"an",
"account",
"."
] | 4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426 | https://github.com/campaignmonitor/createsend-python/blob/4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426/lib/createsend/administrator.py#L22-L28 | train | 60,540 |
campaignmonitor/createsend-python | lib/createsend/administrator.py | Administrator.update | def update(self, new_email_address, name):
"""Updates the details for an administrator."""
params = {"email": self.email_address}
body = {
"EmailAddress": new_email_address,
"Name": name}
response = self._put("/admins.json",
body=json.... | python | def update(self, new_email_address, name):
"""Updates the details for an administrator."""
params = {"email": self.email_address}
body = {
"EmailAddress": new_email_address,
"Name": name}
response = self._put("/admins.json",
body=json.... | [
"def",
"update",
"(",
"self",
",",
"new_email_address",
",",
"name",
")",
":",
"params",
"=",
"{",
"\"email\"",
":",
"self",
".",
"email_address",
"}",
"body",
"=",
"{",
"\"EmailAddress\"",
":",
"new_email_address",
",",
"\"Name\"",
":",
"name",
"}",
"resp... | Updates the details for an administrator. | [
"Updates",
"the",
"details",
"for",
"an",
"administrator",
"."
] | 4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426 | https://github.com/campaignmonitor/createsend-python/blob/4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426/lib/createsend/administrator.py#L30-L40 | train | 60,541 |
campaignmonitor/createsend-python | lib/createsend/administrator.py | Administrator.delete | def delete(self):
"""Deletes the administrator from the account."""
params = {"email": self.email_address}
response = self._delete("/admins.json", params=params) | python | def delete(self):
"""Deletes the administrator from the account."""
params = {"email": self.email_address}
response = self._delete("/admins.json", params=params) | [
"def",
"delete",
"(",
"self",
")",
":",
"params",
"=",
"{",
"\"email\"",
":",
"self",
".",
"email_address",
"}",
"response",
"=",
"self",
".",
"_delete",
"(",
"\"/admins.json\"",
",",
"params",
"=",
"params",
")"
] | Deletes the administrator from the account. | [
"Deletes",
"the",
"administrator",
"from",
"the",
"account",
"."
] | 4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426 | https://github.com/campaignmonitor/createsend-python/blob/4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426/lib/createsend/administrator.py#L42-L45 | train | 60,542 |
campaignmonitor/createsend-python | lib/createsend/list.py | List.create | def create(self, client_id, title, unsubscribe_page, confirmed_opt_in,
confirmation_success_page, unsubscribe_setting="AllClientLists"):
"""Creates a new list for a client."""
body = {
"Title": title,
"UnsubscribePage": unsubscribe_page,
"ConfirmedOptIn... | python | def create(self, client_id, title, unsubscribe_page, confirmed_opt_in,
confirmation_success_page, unsubscribe_setting="AllClientLists"):
"""Creates a new list for a client."""
body = {
"Title": title,
"UnsubscribePage": unsubscribe_page,
"ConfirmedOptIn... | [
"def",
"create",
"(",
"self",
",",
"client_id",
",",
"title",
",",
"unsubscribe_page",
",",
"confirmed_opt_in",
",",
"confirmation_success_page",
",",
"unsubscribe_setting",
"=",
"\"AllClientLists\"",
")",
":",
"body",
"=",
"{",
"\"Title\"",
":",
"title",
",",
"... | Creates a new list for a client. | [
"Creates",
"a",
"new",
"list",
"for",
"a",
"client",
"."
] | 4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426 | https://github.com/campaignmonitor/createsend-python/blob/4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426/lib/createsend/list.py#L17-L28 | train | 60,543 |
campaignmonitor/createsend-python | lib/createsend/list.py | List.create_custom_field | def create_custom_field(self, field_name, data_type, options=[],
visible_in_preference_center=True):
"""Creates a new custom field for this list."""
body = {
"FieldName": field_name,
"DataType": data_type,
"Options": options,
"V... | python | def create_custom_field(self, field_name, data_type, options=[],
visible_in_preference_center=True):
"""Creates a new custom field for this list."""
body = {
"FieldName": field_name,
"DataType": data_type,
"Options": options,
"V... | [
"def",
"create_custom_field",
"(",
"self",
",",
"field_name",
",",
"data_type",
",",
"options",
"=",
"[",
"]",
",",
"visible_in_preference_center",
"=",
"True",
")",
":",
"body",
"=",
"{",
"\"FieldName\"",
":",
"field_name",
",",
"\"DataType\"",
":",
"data_typ... | Creates a new custom field for this list. | [
"Creates",
"a",
"new",
"custom",
"field",
"for",
"this",
"list",
"."
] | 4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426 | https://github.com/campaignmonitor/createsend-python/blob/4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426/lib/createsend/list.py#L34-L43 | train | 60,544 |
campaignmonitor/createsend-python | lib/createsend/list.py | List.update_custom_field | def update_custom_field(self, custom_field_key, field_name,
visible_in_preference_center):
"""Updates a custom field belonging to this list."""
custom_field_key = quote(custom_field_key, '')
body = {
"FieldName": field_name,
"VisibleInPreferenc... | python | def update_custom_field(self, custom_field_key, field_name,
visible_in_preference_center):
"""Updates a custom field belonging to this list."""
custom_field_key = quote(custom_field_key, '')
body = {
"FieldName": field_name,
"VisibleInPreferenc... | [
"def",
"update_custom_field",
"(",
"self",
",",
"custom_field_key",
",",
"field_name",
",",
"visible_in_preference_center",
")",
":",
"custom_field_key",
"=",
"quote",
"(",
"custom_field_key",
",",
"''",
")",
"body",
"=",
"{",
"\"FieldName\"",
":",
"field_name",
"... | Updates a custom field belonging to this list. | [
"Updates",
"a",
"custom",
"field",
"belonging",
"to",
"this",
"list",
"."
] | 4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426 | https://github.com/campaignmonitor/createsend-python/blob/4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426/lib/createsend/list.py#L45-L54 | train | 60,545 |
campaignmonitor/createsend-python | lib/createsend/list.py | List.delete_custom_field | def delete_custom_field(self, custom_field_key):
"""Deletes a custom field associated with this list."""
custom_field_key = quote(custom_field_key, '')
response = self._delete("/lists/%s/customfields/%s.json" %
(self.list_id, custom_field_key)) | python | def delete_custom_field(self, custom_field_key):
"""Deletes a custom field associated with this list."""
custom_field_key = quote(custom_field_key, '')
response = self._delete("/lists/%s/customfields/%s.json" %
(self.list_id, custom_field_key)) | [
"def",
"delete_custom_field",
"(",
"self",
",",
"custom_field_key",
")",
":",
"custom_field_key",
"=",
"quote",
"(",
"custom_field_key",
",",
"''",
")",
"response",
"=",
"self",
".",
"_delete",
"(",
"\"/lists/%s/customfields/%s.json\"",
"%",
"(",
"self",
".",
"l... | Deletes a custom field associated with this list. | [
"Deletes",
"a",
"custom",
"field",
"associated",
"with",
"this",
"list",
"."
] | 4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426 | https://github.com/campaignmonitor/createsend-python/blob/4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426/lib/createsend/list.py#L56-L60 | train | 60,546 |
campaignmonitor/createsend-python | lib/createsend/list.py | List.update_custom_field_options | def update_custom_field_options(self, custom_field_key, new_options,
keep_existing_options):
"""Updates the options of a multi-optioned custom field on this list."""
custom_field_key = quote(custom_field_key, '')
body = {
"Options": new_options,
... | python | def update_custom_field_options(self, custom_field_key, new_options,
keep_existing_options):
"""Updates the options of a multi-optioned custom field on this list."""
custom_field_key = quote(custom_field_key, '')
body = {
"Options": new_options,
... | [
"def",
"update_custom_field_options",
"(",
"self",
",",
"custom_field_key",
",",
"new_options",
",",
"keep_existing_options",
")",
":",
"custom_field_key",
"=",
"quote",
"(",
"custom_field_key",
",",
"''",
")",
"body",
"=",
"{",
"\"Options\"",
":",
"new_options",
... | Updates the options of a multi-optioned custom field on this list. | [
"Updates",
"the",
"options",
"of",
"a",
"multi",
"-",
"optioned",
"custom",
"field",
"on",
"this",
"list",
"."
] | 4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426 | https://github.com/campaignmonitor/createsend-python/blob/4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426/lib/createsend/list.py#L62-L70 | train | 60,547 |
campaignmonitor/createsend-python | lib/createsend/list.py | List.active | def active(self, date="", page=1, page_size=1000, order_field="email", order_direction="asc", include_tracking_preference=False):
"""Gets the active subscribers for this list."""
params = {
"date": date,
"page": page,
"pagesize": page_size,
"orderfield": o... | python | def active(self, date="", page=1, page_size=1000, order_field="email", order_direction="asc", include_tracking_preference=False):
"""Gets the active subscribers for this list."""
params = {
"date": date,
"page": page,
"pagesize": page_size,
"orderfield": o... | [
"def",
"active",
"(",
"self",
",",
"date",
"=",
"\"\"",
",",
"page",
"=",
"1",
",",
"page_size",
"=",
"1000",
",",
"order_field",
"=",
"\"email\"",
",",
"order_direction",
"=",
"\"asc\"",
",",
"include_tracking_preference",
"=",
"False",
")",
":",
"params"... | Gets the active subscribers for this list. | [
"Gets",
"the",
"active",
"subscribers",
"for",
"this",
"list",
"."
] | 4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426 | https://github.com/campaignmonitor/createsend-python/blob/4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426/lib/createsend/list.py#L92-L103 | train | 60,548 |
campaignmonitor/createsend-python | lib/createsend/list.py | List.update | def update(self, title, unsubscribe_page, confirmed_opt_in,
confirmation_success_page, unsubscribe_setting="AllClientLists",
add_unsubscribes_to_supp_list=False, scrub_active_with_supp_list=False):
"""Updates this list."""
body = {
"Title": title,
"U... | python | def update(self, title, unsubscribe_page, confirmed_opt_in,
confirmation_success_page, unsubscribe_setting="AllClientLists",
add_unsubscribes_to_supp_list=False, scrub_active_with_supp_list=False):
"""Updates this list."""
body = {
"Title": title,
"U... | [
"def",
"update",
"(",
"self",
",",
"title",
",",
"unsubscribe_page",
",",
"confirmed_opt_in",
",",
"confirmation_success_page",
",",
"unsubscribe_setting",
"=",
"\"AllClientLists\"",
",",
"add_unsubscribes_to_supp_list",
"=",
"False",
",",
"scrub_active_with_supp_list",
"... | Updates this list. | [
"Updates",
"this",
"list",
"."
] | 4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426 | https://github.com/campaignmonitor/createsend-python/blob/4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426/lib/createsend/list.py#L157-L169 | train | 60,549 |
campaignmonitor/createsend-python | lib/createsend/subscriber.py | Subscriber.get | def get(self, list_id=None, email_address=None, include_tracking_preference=False):
"""Gets a subscriber by list ID and email address."""
params = {
"email": email_address or self.email_address,
"includetrackingpreference": include_tracking_preference,
}
response ... | python | def get(self, list_id=None, email_address=None, include_tracking_preference=False):
"""Gets a subscriber by list ID and email address."""
params = {
"email": email_address or self.email_address,
"includetrackingpreference": include_tracking_preference,
}
response ... | [
"def",
"get",
"(",
"self",
",",
"list_id",
"=",
"None",
",",
"email_address",
"=",
"None",
",",
"include_tracking_preference",
"=",
"False",
")",
":",
"params",
"=",
"{",
"\"email\"",
":",
"email_address",
"or",
"self",
".",
"email_address",
",",
"\"includet... | Gets a subscriber by list ID and email address. | [
"Gets",
"a",
"subscriber",
"by",
"list",
"ID",
"and",
"email",
"address",
"."
] | 4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426 | https://github.com/campaignmonitor/createsend-python/blob/4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426/lib/createsend/subscriber.py#L17-L25 | train | 60,550 |
campaignmonitor/createsend-python | lib/createsend/subscriber.py | Subscriber.add | def add(self, list_id, email_address, name, custom_fields, resubscribe, consent_to_track, restart_subscription_based_autoresponders=False):
"""Adds a subscriber to a subscriber list."""
validate_consent_to_track(consent_to_track)
body = {
"EmailAddress": email_address,
"N... | python | def add(self, list_id, email_address, name, custom_fields, resubscribe, consent_to_track, restart_subscription_based_autoresponders=False):
"""Adds a subscriber to a subscriber list."""
validate_consent_to_track(consent_to_track)
body = {
"EmailAddress": email_address,
"N... | [
"def",
"add",
"(",
"self",
",",
"list_id",
",",
"email_address",
",",
"name",
",",
"custom_fields",
",",
"resubscribe",
",",
"consent_to_track",
",",
"restart_subscription_based_autoresponders",
"=",
"False",
")",
":",
"validate_consent_to_track",
"(",
"consent_to_tra... | Adds a subscriber to a subscriber list. | [
"Adds",
"a",
"subscriber",
"to",
"a",
"subscriber",
"list",
"."
] | 4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426 | https://github.com/campaignmonitor/createsend-python/blob/4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426/lib/createsend/subscriber.py#L27-L39 | train | 60,551 |
campaignmonitor/createsend-python | lib/createsend/subscriber.py | Subscriber.update | def update(self, new_email_address, name, custom_fields, resubscribe, consent_to_track, restart_subscription_based_autoresponders=False):
"""Updates any aspect of a subscriber, including email address, name, and
custom field data if supplied."""
validate_consent_to_track(consent_to_track)
... | python | def update(self, new_email_address, name, custom_fields, resubscribe, consent_to_track, restart_subscription_based_autoresponders=False):
"""Updates any aspect of a subscriber, including email address, name, and
custom field data if supplied."""
validate_consent_to_track(consent_to_track)
... | [
"def",
"update",
"(",
"self",
",",
"new_email_address",
",",
"name",
",",
"custom_fields",
",",
"resubscribe",
",",
"consent_to_track",
",",
"restart_subscription_based_autoresponders",
"=",
"False",
")",
":",
"validate_consent_to_track",
"(",
"consent_to_track",
")",
... | Updates any aspect of a subscriber, including email address, name, and
custom field data if supplied. | [
"Updates",
"any",
"aspect",
"of",
"a",
"subscriber",
"including",
"email",
"address",
"name",
"and",
"custom",
"field",
"data",
"if",
"supplied",
"."
] | 4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426 | https://github.com/campaignmonitor/createsend-python/blob/4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426/lib/createsend/subscriber.py#L41-L57 | train | 60,552 |
campaignmonitor/createsend-python | lib/createsend/subscriber.py | Subscriber.import_subscribers | def import_subscribers(self, list_id, subscribers, resubscribe, queue_subscription_based_autoresponders=False, restart_subscription_based_autoresponders=False):
"""Imports subscribers into a subscriber list."""
body = {
"Subscribers": subscribers,
"Resubscribe": resubscribe,
... | python | def import_subscribers(self, list_id, subscribers, resubscribe, queue_subscription_based_autoresponders=False, restart_subscription_based_autoresponders=False):
"""Imports subscribers into a subscriber list."""
body = {
"Subscribers": subscribers,
"Resubscribe": resubscribe,
... | [
"def",
"import_subscribers",
"(",
"self",
",",
"list_id",
",",
"subscribers",
",",
"resubscribe",
",",
"queue_subscription_based_autoresponders",
"=",
"False",
",",
"restart_subscription_based_autoresponders",
"=",
"False",
")",
":",
"body",
"=",
"{",
"\"Subscribers\"",... | Imports subscribers into a subscriber list. | [
"Imports",
"subscribers",
"into",
"a",
"subscriber",
"list",
"."
] | 4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426 | https://github.com/campaignmonitor/createsend-python/blob/4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426/lib/createsend/subscriber.py#L59-L78 | train | 60,553 |
campaignmonitor/createsend-python | lib/createsend/subscriber.py | Subscriber.unsubscribe | def unsubscribe(self):
"""Unsubscribes this subscriber from the associated list."""
body = {
"EmailAddress": self.email_address}
response = self._post("/subscribers/%s/unsubscribe.json" %
self.list_id, json.dumps(body)) | python | def unsubscribe(self):
"""Unsubscribes this subscriber from the associated list."""
body = {
"EmailAddress": self.email_address}
response = self._post("/subscribers/%s/unsubscribe.json" %
self.list_id, json.dumps(body)) | [
"def",
"unsubscribe",
"(",
"self",
")",
":",
"body",
"=",
"{",
"\"EmailAddress\"",
":",
"self",
".",
"email_address",
"}",
"response",
"=",
"self",
".",
"_post",
"(",
"\"/subscribers/%s/unsubscribe.json\"",
"%",
"self",
".",
"list_id",
",",
"json",
".",
"dum... | Unsubscribes this subscriber from the associated list. | [
"Unsubscribes",
"this",
"subscriber",
"from",
"the",
"associated",
"list",
"."
] | 4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426 | https://github.com/campaignmonitor/createsend-python/blob/4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426/lib/createsend/subscriber.py#L80-L85 | train | 60,554 |
campaignmonitor/createsend-python | lib/createsend/subscriber.py | Subscriber.history | def history(self):
"""Gets the historical record of this subscriber's trackable actions."""
params = {"email": self.email_address}
response = self._get("/subscribers/%s/history.json" %
self.list_id, params=params)
return json_to_py(response) | python | def history(self):
"""Gets the historical record of this subscriber's trackable actions."""
params = {"email": self.email_address}
response = self._get("/subscribers/%s/history.json" %
self.list_id, params=params)
return json_to_py(response) | [
"def",
"history",
"(",
"self",
")",
":",
"params",
"=",
"{",
"\"email\"",
":",
"self",
".",
"email_address",
"}",
"response",
"=",
"self",
".",
"_get",
"(",
"\"/subscribers/%s/history.json\"",
"%",
"self",
".",
"list_id",
",",
"params",
"=",
"params",
")",... | Gets the historical record of this subscriber's trackable actions. | [
"Gets",
"the",
"historical",
"record",
"of",
"this",
"subscriber",
"s",
"trackable",
"actions",
"."
] | 4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426 | https://github.com/campaignmonitor/createsend-python/blob/4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426/lib/createsend/subscriber.py#L87-L92 | train | 60,555 |
thetarkus/django-semanticui-forms | semanticuiforms/templatetags/semanticui.py | Field.set_input | def set_input(self):
"""Returns form input field of Field.
"""
name = self.attrs.get("_override", self.widget.__class__.__name__)
self.values["field"] = str(FIELDS.get(name, FIELDS.get(None))(self.field, self.attrs)) | python | def set_input(self):
"""Returns form input field of Field.
"""
name = self.attrs.get("_override", self.widget.__class__.__name__)
self.values["field"] = str(FIELDS.get(name, FIELDS.get(None))(self.field, self.attrs)) | [
"def",
"set_input",
"(",
"self",
")",
":",
"name",
"=",
"self",
".",
"attrs",
".",
"get",
"(",
"\"_override\"",
",",
"self",
".",
"widget",
".",
"__class__",
".",
"__name__",
")",
"self",
".",
"values",
"[",
"\"field\"",
"]",
"=",
"str",
"(",
"FIELDS... | Returns form input field of Field. | [
"Returns",
"form",
"input",
"field",
"of",
"Field",
"."
] | 9664c6f01621568c3fa39b36439178586649eafe | https://github.com/thetarkus/django-semanticui-forms/blob/9664c6f01621568c3fa39b36439178586649eafe/semanticuiforms/templatetags/semanticui.py#L36-L40 | train | 60,556 |
thetarkus/django-semanticui-forms | semanticuiforms/templatetags/semanticui.py | Field.set_label | def set_label(self):
"""Set label markup.
"""
if not self.field.label or self.attrs.get("_no_label"):
return
self.values["label"] = format_html(
LABEL_TEMPLATE, self.field.html_name, mark_safe(self.field.label)
) | python | def set_label(self):
"""Set label markup.
"""
if not self.field.label or self.attrs.get("_no_label"):
return
self.values["label"] = format_html(
LABEL_TEMPLATE, self.field.html_name, mark_safe(self.field.label)
) | [
"def",
"set_label",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"field",
".",
"label",
"or",
"self",
".",
"attrs",
".",
"get",
"(",
"\"_no_label\"",
")",
":",
"return",
"self",
".",
"values",
"[",
"\"label\"",
"]",
"=",
"format_html",
"(",
"LABE... | Set label markup. | [
"Set",
"label",
"markup",
"."
] | 9664c6f01621568c3fa39b36439178586649eafe | https://github.com/thetarkus/django-semanticui-forms/blob/9664c6f01621568c3fa39b36439178586649eafe/semanticuiforms/templatetags/semanticui.py#L43-L51 | train | 60,557 |
thetarkus/django-semanticui-forms | semanticuiforms/templatetags/semanticui.py | Field.set_help | def set_help(self):
"""Set help text markup.
"""
if not (self.field.help_text and self.attrs.get("_help")):
return
self.values["help"] = HELP_TEMPLATE.format(self.field.help_text) | python | def set_help(self):
"""Set help text markup.
"""
if not (self.field.help_text and self.attrs.get("_help")):
return
self.values["help"] = HELP_TEMPLATE.format(self.field.help_text) | [
"def",
"set_help",
"(",
"self",
")",
":",
"if",
"not",
"(",
"self",
".",
"field",
".",
"help_text",
"and",
"self",
".",
"attrs",
".",
"get",
"(",
"\"_help\"",
")",
")",
":",
"return",
"self",
".",
"values",
"[",
"\"help\"",
"]",
"=",
"HELP_TEMPLATE",... | Set help text markup. | [
"Set",
"help",
"text",
"markup",
"."
] | 9664c6f01621568c3fa39b36439178586649eafe | https://github.com/thetarkus/django-semanticui-forms/blob/9664c6f01621568c3fa39b36439178586649eafe/semanticuiforms/templatetags/semanticui.py#L54-L60 | train | 60,558 |
thetarkus/django-semanticui-forms | semanticuiforms/templatetags/semanticui.py | Field.set_errors | def set_errors(self):
"""Set errors markup.
"""
if not self.field.errors or self.attrs.get("_no_errors"):
return
self.values["class"].append("error")
for error in self.field.errors:
self.values["errors"] += ERROR_WRAPPER % {"message": error} | python | def set_errors(self):
"""Set errors markup.
"""
if not self.field.errors or self.attrs.get("_no_errors"):
return
self.values["class"].append("error")
for error in self.field.errors:
self.values["errors"] += ERROR_WRAPPER % {"message": error} | [
"def",
"set_errors",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"field",
".",
"errors",
"or",
"self",
".",
"attrs",
".",
"get",
"(",
"\"_no_errors\"",
")",
":",
"return",
"self",
".",
"values",
"[",
"\"class\"",
"]",
".",
"append",
"(",
"\"erro... | Set errors markup. | [
"Set",
"errors",
"markup",
"."
] | 9664c6f01621568c3fa39b36439178586649eafe | https://github.com/thetarkus/django-semanticui-forms/blob/9664c6f01621568c3fa39b36439178586649eafe/semanticuiforms/templatetags/semanticui.py#L63-L72 | train | 60,559 |
thetarkus/django-semanticui-forms | semanticuiforms/templatetags/semanticui.py | Field.set_icon | def set_icon(self):
"""Wrap current field with icon wrapper.
This setter must be the last setter called.
"""
if not self.attrs.get("_icon"):
return
if "Date" in self.field.field.__class__.__name__:
return
self.values["field"] = INPUT_WRAPPER % {
"field": self.values["field"],
"help... | python | def set_icon(self):
"""Wrap current field with icon wrapper.
This setter must be the last setter called.
"""
if not self.attrs.get("_icon"):
return
if "Date" in self.field.field.__class__.__name__:
return
self.values["field"] = INPUT_WRAPPER % {
"field": self.values["field"],
"help... | [
"def",
"set_icon",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"attrs",
".",
"get",
"(",
"\"_icon\"",
")",
":",
"return",
"if",
"\"Date\"",
"in",
"self",
".",
"field",
".",
"field",
".",
"__class__",
".",
"__name__",
":",
"return",
"self",
".",
... | Wrap current field with icon wrapper.
This setter must be the last setter called. | [
"Wrap",
"current",
"field",
"with",
"icon",
"wrapper",
".",
"This",
"setter",
"must",
"be",
"the",
"last",
"setter",
"called",
"."
] | 9664c6f01621568c3fa39b36439178586649eafe | https://github.com/thetarkus/django-semanticui-forms/blob/9664c6f01621568c3fa39b36439178586649eafe/semanticuiforms/templatetags/semanticui.py#L75-L90 | train | 60,560 |
thetarkus/django-semanticui-forms | semanticuiforms/templatetags/semanticui.py | Field.set_classes | def set_classes(self):
"""Set field properties and custom classes.
"""
# Custom field classes on field wrapper
if self.attrs.get("_field_class"):
self.values["class"].append(escape(self.attrs.get("_field_class")))
# Inline class
if self.attrs.get("_inline"):
self.values["class"].append("inli... | python | def set_classes(self):
"""Set field properties and custom classes.
"""
# Custom field classes on field wrapper
if self.attrs.get("_field_class"):
self.values["class"].append(escape(self.attrs.get("_field_class")))
# Inline class
if self.attrs.get("_inline"):
self.values["class"].append("inli... | [
"def",
"set_classes",
"(",
"self",
")",
":",
"# Custom field classes on field wrapper\r",
"if",
"self",
".",
"attrs",
".",
"get",
"(",
"\"_field_class\"",
")",
":",
"self",
".",
"values",
"[",
"\"class\"",
"]",
".",
"append",
"(",
"escape",
"(",
"self",
".",... | Set field properties and custom classes. | [
"Set",
"field",
"properties",
"and",
"custom",
"classes",
"."
] | 9664c6f01621568c3fa39b36439178586649eafe | https://github.com/thetarkus/django-semanticui-forms/blob/9664c6f01621568c3fa39b36439178586649eafe/semanticuiforms/templatetags/semanticui.py#L93-L112 | train | 60,561 |
thetarkus/django-semanticui-forms | semanticuiforms/templatetags/semanticui.py | Field.render | def render(self):
"""Render field as HTML.
"""
self.widget.attrs = {
k: v for k, v in self.attrs.items() if k[0] != "_"
}
self.set_input()
if not self.attrs.get("_no_wrapper"):
self.set_label()
self.set_help()
self.set_errors()
self.set_classes()
self.set_icon() # Must be th... | python | def render(self):
"""Render field as HTML.
"""
self.widget.attrs = {
k: v for k, v in self.attrs.items() if k[0] != "_"
}
self.set_input()
if not self.attrs.get("_no_wrapper"):
self.set_label()
self.set_help()
self.set_errors()
self.set_classes()
self.set_icon() # Must be th... | [
"def",
"render",
"(",
"self",
")",
":",
"self",
".",
"widget",
".",
"attrs",
"=",
"{",
"k",
":",
"v",
"for",
"k",
",",
"v",
"in",
"self",
".",
"attrs",
".",
"items",
"(",
")",
"if",
"k",
"[",
"0",
"]",
"!=",
"\"_\"",
"}",
"self",
".",
"set_... | Render field as HTML. | [
"Render",
"field",
"as",
"HTML",
"."
] | 9664c6f01621568c3fa39b36439178586649eafe | https://github.com/thetarkus/django-semanticui-forms/blob/9664c6f01621568c3fa39b36439178586649eafe/semanticuiforms/templatetags/semanticui.py#L115-L133 | train | 60,562 |
thetarkus/django-semanticui-forms | example/app/apps.py | ExampleAppConfig.ready | def ready(self):
"""
Create test friends for displaying.
"""
from .models import Friend
# Requires migrations, not necessary
try:
Friend.objects.get_or_create(first_name="Michael", last_name="1", age=22)
Friend.objects.get_or_create(first_name="Joe", last_name="2", age=21)
Friend.objects.get_or_cr... | python | def ready(self):
"""
Create test friends for displaying.
"""
from .models import Friend
# Requires migrations, not necessary
try:
Friend.objects.get_or_create(first_name="Michael", last_name="1", age=22)
Friend.objects.get_or_create(first_name="Joe", last_name="2", age=21)
Friend.objects.get_or_cr... | [
"def",
"ready",
"(",
"self",
")",
":",
"from",
".",
"models",
"import",
"Friend",
"# Requires migrations, not necessary",
"try",
":",
"Friend",
".",
"objects",
".",
"get_or_create",
"(",
"first_name",
"=",
"\"Michael\"",
",",
"last_name",
"=",
"\"1\"",
",",
"a... | Create test friends for displaying. | [
"Create",
"test",
"friends",
"for",
"displaying",
"."
] | 9664c6f01621568c3fa39b36439178586649eafe | https://github.com/thetarkus/django-semanticui-forms/blob/9664c6f01621568c3fa39b36439178586649eafe/example/app/apps.py#L12-L24 | train | 60,563 |
thetarkus/django-semanticui-forms | semanticuiforms/fields.py | render_booleanfield | def render_booleanfield(field, attrs):
"""
Render BooleanField with label next to instead of above.
"""
attrs.setdefault("_no_label", True) # No normal label for booleanfields
attrs.setdefault("_inline", True) # Checkbox should be inline
field.field.widget.attrs["style"] = "display:hidden" # Hidden field
ret... | python | def render_booleanfield(field, attrs):
"""
Render BooleanField with label next to instead of above.
"""
attrs.setdefault("_no_label", True) # No normal label for booleanfields
attrs.setdefault("_inline", True) # Checkbox should be inline
field.field.widget.attrs["style"] = "display:hidden" # Hidden field
ret... | [
"def",
"render_booleanfield",
"(",
"field",
",",
"attrs",
")",
":",
"attrs",
".",
"setdefault",
"(",
"\"_no_label\"",
",",
"True",
")",
"# No normal label for booleanfields",
"attrs",
".",
"setdefault",
"(",
"\"_inline\"",
",",
"True",
")",
"# Checkbox should be inl... | Render BooleanField with label next to instead of above. | [
"Render",
"BooleanField",
"with",
"label",
"next",
"to",
"instead",
"of",
"above",
"."
] | 9664c6f01621568c3fa39b36439178586649eafe | https://github.com/thetarkus/django-semanticui-forms/blob/9664c6f01621568c3fa39b36439178586649eafe/semanticuiforms/fields.py#L33-L47 | train | 60,564 |
thetarkus/django-semanticui-forms | semanticuiforms/fields.py | render_choicefield | def render_choicefield(field, attrs, choices=None):
"""
Render ChoiceField as 'div' dropdown rather than select for more
customization.
"""
# Allow custom choice list, but if no custom choice list then wrap all
# choices into the `wrappers.CHOICE_TEMPLATE`
if not choices:
choices = format_html_join("", wrapper... | python | def render_choicefield(field, attrs, choices=None):
"""
Render ChoiceField as 'div' dropdown rather than select for more
customization.
"""
# Allow custom choice list, but if no custom choice list then wrap all
# choices into the `wrappers.CHOICE_TEMPLATE`
if not choices:
choices = format_html_join("", wrapper... | [
"def",
"render_choicefield",
"(",
"field",
",",
"attrs",
",",
"choices",
"=",
"None",
")",
":",
"# Allow custom choice list, but if no custom choice list then wrap all",
"# choices into the `wrappers.CHOICE_TEMPLATE`",
"if",
"not",
"choices",
":",
"choices",
"=",
"format_html... | Render ChoiceField as 'div' dropdown rather than select for more
customization. | [
"Render",
"ChoiceField",
"as",
"div",
"dropdown",
"rather",
"than",
"select",
"for",
"more",
"customization",
"."
] | 9664c6f01621568c3fa39b36439178586649eafe | https://github.com/thetarkus/django-semanticui-forms/blob/9664c6f01621568c3fa39b36439178586649eafe/semanticuiforms/fields.py#L50-L71 | train | 60,565 |
thetarkus/django-semanticui-forms | semanticuiforms/fields.py | render_countryfield | def render_countryfield(field, attrs):
"""
Render a custom ChoiceField specific for CountryFields.
"""
choices = ((k, k.lower(), v)
for k, v in field.field._choices[1:])
# Render a `ChoiceField` with all countries
return render_choicefield(
field, attrs, format_html_join("", wrappers.COUNTRY_TEMPLATE, choice... | python | def render_countryfield(field, attrs):
"""
Render a custom ChoiceField specific for CountryFields.
"""
choices = ((k, k.lower(), v)
for k, v in field.field._choices[1:])
# Render a `ChoiceField` with all countries
return render_choicefield(
field, attrs, format_html_join("", wrappers.COUNTRY_TEMPLATE, choice... | [
"def",
"render_countryfield",
"(",
"field",
",",
"attrs",
")",
":",
"choices",
"=",
"(",
"(",
"k",
",",
"k",
".",
"lower",
"(",
")",
",",
"v",
")",
"for",
"k",
",",
"v",
"in",
"field",
".",
"field",
".",
"_choices",
"[",
"1",
":",
"]",
")",
"... | Render a custom ChoiceField specific for CountryFields. | [
"Render",
"a",
"custom",
"ChoiceField",
"specific",
"for",
"CountryFields",
"."
] | 9664c6f01621568c3fa39b36439178586649eafe | https://github.com/thetarkus/django-semanticui-forms/blob/9664c6f01621568c3fa39b36439178586649eafe/semanticuiforms/fields.py#L99-L109 | train | 60,566 |
thetarkus/django-semanticui-forms | semanticuiforms/fields.py | render_multiplechoicefield | def render_multiplechoicefield(field, attrs, choices=None):
"""
MultipleChoiceField uses its own field, but also uses a queryset.
"""
choices = format_html_join("", wrappers.CHOICE_TEMPLATE, get_choices(field))
return wrappers.MULTIPLE_DROPDOWN_WRAPPER % {
"name": field.html_name,
"field": field,
"choices": ... | python | def render_multiplechoicefield(field, attrs, choices=None):
"""
MultipleChoiceField uses its own field, but also uses a queryset.
"""
choices = format_html_join("", wrappers.CHOICE_TEMPLATE, get_choices(field))
return wrappers.MULTIPLE_DROPDOWN_WRAPPER % {
"name": field.html_name,
"field": field,
"choices": ... | [
"def",
"render_multiplechoicefield",
"(",
"field",
",",
"attrs",
",",
"choices",
"=",
"None",
")",
":",
"choices",
"=",
"format_html_join",
"(",
"\"\"",
",",
"wrappers",
".",
"CHOICE_TEMPLATE",
",",
"get_choices",
"(",
"field",
")",
")",
"return",
"wrappers",
... | MultipleChoiceField uses its own field, but also uses a queryset. | [
"MultipleChoiceField",
"uses",
"its",
"own",
"field",
"but",
"also",
"uses",
"a",
"queryset",
"."
] | 9664c6f01621568c3fa39b36439178586649eafe | https://github.com/thetarkus/django-semanticui-forms/blob/9664c6f01621568c3fa39b36439178586649eafe/semanticuiforms/fields.py#L112-L124 | train | 60,567 |
thetarkus/django-semanticui-forms | semanticuiforms/fields.py | render_datefield | def render_datefield(field, attrs, style="date"):
"""
DateField that uses wrappers.CALENDAR_WRAPPER.
"""
return wrappers.CALENDAR_WRAPPER % {
"field": field,
"style": pad(style),
"align": pad(attrs.get("_align", "")),
"icon": format_html(wrappers.ICON_TEMPLATE, attrs.get("_icon")),
} | python | def render_datefield(field, attrs, style="date"):
"""
DateField that uses wrappers.CALENDAR_WRAPPER.
"""
return wrappers.CALENDAR_WRAPPER % {
"field": field,
"style": pad(style),
"align": pad(attrs.get("_align", "")),
"icon": format_html(wrappers.ICON_TEMPLATE, attrs.get("_icon")),
} | [
"def",
"render_datefield",
"(",
"field",
",",
"attrs",
",",
"style",
"=",
"\"date\"",
")",
":",
"return",
"wrappers",
".",
"CALENDAR_WRAPPER",
"%",
"{",
"\"field\"",
":",
"field",
",",
"\"style\"",
":",
"pad",
"(",
"style",
")",
",",
"\"align\"",
":",
"p... | DateField that uses wrappers.CALENDAR_WRAPPER. | [
"DateField",
"that",
"uses",
"wrappers",
".",
"CALENDAR_WRAPPER",
"."
] | 9664c6f01621568c3fa39b36439178586649eafe | https://github.com/thetarkus/django-semanticui-forms/blob/9664c6f01621568c3fa39b36439178586649eafe/semanticuiforms/fields.py#L127-L136 | train | 60,568 |
thetarkus/django-semanticui-forms | semanticuiforms/fields.py | render_filefield | def render_filefield(field, attrs):
"""
Render a typical File Field.
"""
field.field.widget.attrs["style"] = "display:none"
if not "_no_label" in attrs:
attrs["_no_label"] = True
return wrappers.FILE_WRAPPER % {
"field": field,
"id": "id_" + field.name,
"style": pad(attrs.get("_style", "")),
"text": e... | python | def render_filefield(field, attrs):
"""
Render a typical File Field.
"""
field.field.widget.attrs["style"] = "display:none"
if not "_no_label" in attrs:
attrs["_no_label"] = True
return wrappers.FILE_WRAPPER % {
"field": field,
"id": "id_" + field.name,
"style": pad(attrs.get("_style", "")),
"text": e... | [
"def",
"render_filefield",
"(",
"field",
",",
"attrs",
")",
":",
"field",
".",
"field",
".",
"widget",
".",
"attrs",
"[",
"\"style\"",
"]",
"=",
"\"display:none\"",
"if",
"not",
"\"_no_label\"",
"in",
"attrs",
":",
"attrs",
"[",
"\"_no_label\"",
"]",
"=",
... | Render a typical File Field. | [
"Render",
"a",
"typical",
"File",
"Field",
"."
] | 9664c6f01621568c3fa39b36439178586649eafe | https://github.com/thetarkus/django-semanticui-forms/blob/9664c6f01621568c3fa39b36439178586649eafe/semanticuiforms/fields.py#L153-L168 | train | 60,569 |
cmcqueen/simplerandom | python/python2/simplerandom/iterators/_iterators_py.py | _repeat_iter | def _repeat_iter(input_iter):
"""Iterate over the input iter values. Then repeat the last value
indefinitely. This is useful to repeat seed values when an insufficient
number of seeds are provided.
E.g. KISS(1) effectively becomes KISS(1, 1, 1, 1), rather than (if we just
used default values) KISS(... | python | def _repeat_iter(input_iter):
"""Iterate over the input iter values. Then repeat the last value
indefinitely. This is useful to repeat seed values when an insufficient
number of seeds are provided.
E.g. KISS(1) effectively becomes KISS(1, 1, 1, 1), rather than (if we just
used default values) KISS(... | [
"def",
"_repeat_iter",
"(",
"input_iter",
")",
":",
"last_value",
"=",
"None",
"for",
"value",
"in",
"input_iter",
":",
"last_value",
"=",
"value",
"yield",
"value",
"if",
"last_value",
"is",
"not",
"None",
":",
"while",
"True",
":",
"yield",
"last_value"
] | Iterate over the input iter values. Then repeat the last value
indefinitely. This is useful to repeat seed values when an insufficient
number of seeds are provided.
E.g. KISS(1) effectively becomes KISS(1, 1, 1, 1), rather than (if we just
used default values) KISS(1, default-value, default-value, defa... | [
"Iterate",
"over",
"the",
"input",
"iter",
"values",
".",
"Then",
"repeat",
"the",
"last",
"value",
"indefinitely",
".",
"This",
"is",
"useful",
"to",
"repeat",
"seed",
"values",
"when",
"an",
"insufficient",
"number",
"of",
"seeds",
"are",
"provided",
"."
] | 3f19ffdfeaa8256986adf7173f08c1c719164d01 | https://github.com/cmcqueen/simplerandom/blob/3f19ffdfeaa8256986adf7173f08c1c719164d01/python/python2/simplerandom/iterators/_iterators_py.py#L40-L59 | train | 60,570 |
cmcqueen/simplerandom | python/python2/simplerandom/random/_random_py.py | _StandardRandomTemplate.seed | def seed(self, x=None, *args):
"""For consistent cross-platform seeding, provide an integer seed.
"""
if x is None:
# Use same random seed code copied from Python's random.Random
try:
x = long(_hexlify(_urandom(16)), 16)
except NotImplementedEr... | python | def seed(self, x=None, *args):
"""For consistent cross-platform seeding, provide an integer seed.
"""
if x is None:
# Use same random seed code copied from Python's random.Random
try:
x = long(_hexlify(_urandom(16)), 16)
except NotImplementedEr... | [
"def",
"seed",
"(",
"self",
",",
"x",
"=",
"None",
",",
"*",
"args",
")",
":",
"if",
"x",
"is",
"None",
":",
"# Use same random seed code copied from Python's random.Random",
"try",
":",
"x",
"=",
"long",
"(",
"_hexlify",
"(",
"_urandom",
"(",
"16",
")",
... | For consistent cross-platform seeding, provide an integer seed. | [
"For",
"consistent",
"cross",
"-",
"platform",
"seeding",
"provide",
"an",
"integer",
"seed",
"."
] | 3f19ffdfeaa8256986adf7173f08c1c719164d01 | https://github.com/cmcqueen/simplerandom/blob/3f19ffdfeaa8256986adf7173f08c1c719164d01/python/python2/simplerandom/random/_random_py.py#L44-L59 | train | 60,571 |
cmcqueen/simplerandom | python/python2/simplerandom/random/_random_py.py | _StandardRandomTemplate.setbpf | def setbpf(self, bpf):
"""Set number of bits per float output"""
self._bpf = min(bpf, self.BPF)
self._rng_n = int((self._bpf + self.RNG_RANGE_BITS - 1) / self.RNG_RANGE_BITS) | python | def setbpf(self, bpf):
"""Set number of bits per float output"""
self._bpf = min(bpf, self.BPF)
self._rng_n = int((self._bpf + self.RNG_RANGE_BITS - 1) / self.RNG_RANGE_BITS) | [
"def",
"setbpf",
"(",
"self",
",",
"bpf",
")",
":",
"self",
".",
"_bpf",
"=",
"min",
"(",
"bpf",
",",
"self",
".",
"BPF",
")",
"self",
".",
"_rng_n",
"=",
"int",
"(",
"(",
"self",
".",
"_bpf",
"+",
"self",
".",
"RNG_RANGE_BITS",
"-",
"1",
")",
... | Set number of bits per float output | [
"Set",
"number",
"of",
"bits",
"per",
"float",
"output"
] | 3f19ffdfeaa8256986adf7173f08c1c719164d01 | https://github.com/cmcqueen/simplerandom/blob/3f19ffdfeaa8256986adf7173f08c1c719164d01/python/python2/simplerandom/random/_random_py.py#L65-L68 | train | 60,572 |
mbr/flask-appconfig | flask_appconfig/server_backends.py | ServerBackend.get_info | def get_info(cls):
"""Return information about backend and its availability.
:return: A BackendInfo tuple if the import worked, none otherwise.
"""
mod = try_import(cls.mod_name)
if not mod:
return None
version = getattr(mod, '__version__', None) or getattr(m... | python | def get_info(cls):
"""Return information about backend and its availability.
:return: A BackendInfo tuple if the import worked, none otherwise.
"""
mod = try_import(cls.mod_name)
if not mod:
return None
version = getattr(mod, '__version__', None) or getattr(m... | [
"def",
"get_info",
"(",
"cls",
")",
":",
"mod",
"=",
"try_import",
"(",
"cls",
".",
"mod_name",
")",
"if",
"not",
"mod",
":",
"return",
"None",
"version",
"=",
"getattr",
"(",
"mod",
",",
"'__version__'",
",",
"None",
")",
"or",
"getattr",
"(",
"mod"... | Return information about backend and its availability.
:return: A BackendInfo tuple if the import worked, none otherwise. | [
"Return",
"information",
"about",
"backend",
"and",
"its",
"availability",
"."
] | 5264719ac9229339070b219a4358a3203ffd05b0 | https://github.com/mbr/flask-appconfig/blob/5264719ac9229339070b219a4358a3203ffd05b0/flask_appconfig/server_backends.py#L42-L52 | train | 60,573 |
thetarkus/django-semanticui-forms | semanticuiforms/utils.py | get_choices | def get_choices(field):
"""
Find choices of a field, whether it has choices or has a queryset.
Args:
field (BoundField): Django form boundfield
Returns:
list: List of choices
"""
empty_label = getattr(field.field, "empty_label", False)
needs_empty_value = False
choices = []
# Data is the choices
if ha... | python | def get_choices(field):
"""
Find choices of a field, whether it has choices or has a queryset.
Args:
field (BoundField): Django form boundfield
Returns:
list: List of choices
"""
empty_label = getattr(field.field, "empty_label", False)
needs_empty_value = False
choices = []
# Data is the choices
if ha... | [
"def",
"get_choices",
"(",
"field",
")",
":",
"empty_label",
"=",
"getattr",
"(",
"field",
".",
"field",
",",
"\"empty_label\"",
",",
"False",
")",
"needs_empty_value",
"=",
"False",
"choices",
"=",
"[",
"]",
"# Data is the choices",
"if",
"hasattr",
"(",
"f... | Find choices of a field, whether it has choices or has a queryset.
Args:
field (BoundField): Django form boundfield
Returns:
list: List of choices | [
"Find",
"choices",
"of",
"a",
"field",
"whether",
"it",
"has",
"choices",
"or",
"has",
"a",
"queryset",
"."
] | 9664c6f01621568c3fa39b36439178586649eafe | https://github.com/thetarkus/django-semanticui-forms/blob/9664c6f01621568c3fa39b36439178586649eafe/semanticuiforms/utils.py#L25-L66 | train | 60,574 |
miyakogi/wdom | wdom/web_node.py | WdomElement.get_class_list | def get_class_list(cls) -> DOMTokenList:
"""Get class-level class list, including all super class's."""
cl = []
cl.append(DOMTokenList(cls, cls.class_))
if cls.inherit_class:
for base_cls in cls.__bases__:
if issubclass(base_cls, WdomElement):
... | python | def get_class_list(cls) -> DOMTokenList:
"""Get class-level class list, including all super class's."""
cl = []
cl.append(DOMTokenList(cls, cls.class_))
if cls.inherit_class:
for base_cls in cls.__bases__:
if issubclass(base_cls, WdomElement):
... | [
"def",
"get_class_list",
"(",
"cls",
")",
"->",
"DOMTokenList",
":",
"cl",
"=",
"[",
"]",
"cl",
".",
"append",
"(",
"DOMTokenList",
"(",
"cls",
",",
"cls",
".",
"class_",
")",
")",
"if",
"cls",
".",
"inherit_class",
":",
"for",
"base_cls",
"in",
"cls... | Get class-level class list, including all super class's. | [
"Get",
"class",
"-",
"level",
"class",
"list",
"including",
"all",
"super",
"class",
"s",
"."
] | a21bcd23e94baceee71161829f6897bee3fd39c1 | https://github.com/miyakogi/wdom/blob/a21bcd23e94baceee71161829f6897bee3fd39c1/wdom/web_node.py#L137-L147 | train | 60,575 |
miyakogi/wdom | wdom/web_node.py | WdomElement.appendChild | def appendChild(self, child: 'WdomElement') -> Node:
"""Append child node at the last of child nodes.
If this instance is connected to the node on browser, the child node is
also added to it.
"""
if self.connected:
self._append_child_web(child)
return self._a... | python | def appendChild(self, child: 'WdomElement') -> Node:
"""Append child node at the last of child nodes.
If this instance is connected to the node on browser, the child node is
also added to it.
"""
if self.connected:
self._append_child_web(child)
return self._a... | [
"def",
"appendChild",
"(",
"self",
",",
"child",
":",
"'WdomElement'",
")",
"->",
"Node",
":",
"if",
"self",
".",
"connected",
":",
"self",
".",
"_append_child_web",
"(",
"child",
")",
"return",
"self",
".",
"_append_child",
"(",
"child",
")"
] | Append child node at the last of child nodes.
If this instance is connected to the node on browser, the child node is
also added to it. | [
"Append",
"child",
"node",
"at",
"the",
"last",
"of",
"child",
"nodes",
"."
] | a21bcd23e94baceee71161829f6897bee3fd39c1 | https://github.com/miyakogi/wdom/blob/a21bcd23e94baceee71161829f6897bee3fd39c1/wdom/web_node.py#L221-L229 | train | 60,576 |
miyakogi/wdom | wdom/web_node.py | WdomElement.insertBefore | def insertBefore(self, child: Node, ref_node: Node) -> Node:
"""Insert new child node before the reference child node.
If the reference node is not a child of this node, raise ValueError. If
this instance is connected to the node on browser, the child node is
also added to it.
"... | python | def insertBefore(self, child: Node, ref_node: Node) -> Node:
"""Insert new child node before the reference child node.
If the reference node is not a child of this node, raise ValueError. If
this instance is connected to the node on browser, the child node is
also added to it.
"... | [
"def",
"insertBefore",
"(",
"self",
",",
"child",
":",
"Node",
",",
"ref_node",
":",
"Node",
")",
"->",
"Node",
":",
"if",
"self",
".",
"connected",
":",
"self",
".",
"_insert_before_web",
"(",
"child",
",",
"ref_node",
")",
"return",
"self",
".",
"_in... | Insert new child node before the reference child node.
If the reference node is not a child of this node, raise ValueError. If
this instance is connected to the node on browser, the child node is
also added to it. | [
"Insert",
"new",
"child",
"node",
"before",
"the",
"reference",
"child",
"node",
"."
] | a21bcd23e94baceee71161829f6897bee3fd39c1 | https://github.com/miyakogi/wdom/blob/a21bcd23e94baceee71161829f6897bee3fd39c1/wdom/web_node.py#L240-L249 | train | 60,577 |
miyakogi/wdom | wdom/web_node.py | WdomElement.removeChild | def removeChild(self, child: Node) -> Node:
"""Remove the child node from this node.
If the node is not a child of this node, raise ValueError.
"""
if self.connected:
self._remove_child_web(child)
return self._remove_child(child) | python | def removeChild(self, child: Node) -> Node:
"""Remove the child node from this node.
If the node is not a child of this node, raise ValueError.
"""
if self.connected:
self._remove_child_web(child)
return self._remove_child(child) | [
"def",
"removeChild",
"(",
"self",
",",
"child",
":",
"Node",
")",
"->",
"Node",
":",
"if",
"self",
".",
"connected",
":",
"self",
".",
"_remove_child_web",
"(",
"child",
")",
"return",
"self",
".",
"_remove_child",
"(",
"child",
")"
] | Remove the child node from this node.
If the node is not a child of this node, raise ValueError. | [
"Remove",
"the",
"child",
"node",
"from",
"this",
"node",
"."
] | a21bcd23e94baceee71161829f6897bee3fd39c1 | https://github.com/miyakogi/wdom/blob/a21bcd23e94baceee71161829f6897bee3fd39c1/wdom/web_node.py#L259-L266 | train | 60,578 |
miyakogi/wdom | wdom/web_node.py | WdomElement.replaceChild | def replaceChild(self, new_child: 'WdomElement', old_child: 'WdomElement'
) -> Node:
"""Replace child nodes."""
if self.connected:
self._replace_child_web(new_child, old_child)
return self._replace_child(new_child, old_child) | python | def replaceChild(self, new_child: 'WdomElement', old_child: 'WdomElement'
) -> Node:
"""Replace child nodes."""
if self.connected:
self._replace_child_web(new_child, old_child)
return self._replace_child(new_child, old_child) | [
"def",
"replaceChild",
"(",
"self",
",",
"new_child",
":",
"'WdomElement'",
",",
"old_child",
":",
"'WdomElement'",
")",
"->",
"Node",
":",
"if",
"self",
".",
"connected",
":",
"self",
".",
"_replace_child_web",
"(",
"new_child",
",",
"old_child",
")",
"retu... | Replace child nodes. | [
"Replace",
"child",
"nodes",
"."
] | a21bcd23e94baceee71161829f6897bee3fd39c1 | https://github.com/miyakogi/wdom/blob/a21bcd23e94baceee71161829f6897bee3fd39c1/wdom/web_node.py#L279-L284 | train | 60,579 |
miyakogi/wdom | wdom/web_node.py | WdomElement.textContent | def textContent(self, text: str) -> None: # type: ignore
"""Set textContent both on this node and related browser node."""
self._set_text_content(text)
if self.connected:
self._set_text_content_web(text) | python | def textContent(self, text: str) -> None: # type: ignore
"""Set textContent both on this node and related browser node."""
self._set_text_content(text)
if self.connected:
self._set_text_content_web(text) | [
"def",
"textContent",
"(",
"self",
",",
"text",
":",
"str",
")",
"->",
"None",
":",
"# type: ignore",
"self",
".",
"_set_text_content",
"(",
"text",
")",
"if",
"self",
".",
"connected",
":",
"self",
".",
"_set_text_content_web",
"(",
"text",
")"
] | Set textContent both on this node and related browser node. | [
"Set",
"textContent",
"both",
"on",
"this",
"node",
"and",
"related",
"browser",
"node",
"."
] | a21bcd23e94baceee71161829f6897bee3fd39c1 | https://github.com/miyakogi/wdom/blob/a21bcd23e94baceee71161829f6897bee3fd39c1/wdom/web_node.py#L295-L299 | train | 60,580 |
miyakogi/wdom | wdom/web_node.py | WdomElement.innerHTML | def innerHTML(self, html: str) -> None: # type: ignore
"""Set innerHTML both on this node and related browser node."""
df = self._parse_html(html)
if self.connected:
self._set_inner_html_web(df.html)
self._empty()
self._append_child(df) | python | def innerHTML(self, html: str) -> None: # type: ignore
"""Set innerHTML both on this node and related browser node."""
df = self._parse_html(html)
if self.connected:
self._set_inner_html_web(df.html)
self._empty()
self._append_child(df) | [
"def",
"innerHTML",
"(",
"self",
",",
"html",
":",
"str",
")",
"->",
"None",
":",
"# type: ignore",
"df",
"=",
"self",
".",
"_parse_html",
"(",
"html",
")",
"if",
"self",
".",
"connected",
":",
"self",
".",
"_set_inner_html_web",
"(",
"df",
".",
"html"... | Set innerHTML both on this node and related browser node. | [
"Set",
"innerHTML",
"both",
"on",
"this",
"node",
"and",
"related",
"browser",
"node",
"."
] | a21bcd23e94baceee71161829f6897bee3fd39c1 | https://github.com/miyakogi/wdom/blob/a21bcd23e94baceee71161829f6897bee3fd39c1/wdom/web_node.py#L305-L311 | train | 60,581 |
miyakogi/wdom | wdom/web_node.py | WdomElement.click | def click(self) -> None:
"""Send click event."""
if self.connected:
self.js_exec('click')
else:
# Web上に表示されてれば勝手にブラウザ側からクリックイベント発生する
# のでローカルのクリックイベント不要
msg = {'proto': '', 'type': 'click',
'currentTarget': {'id': self.wdom_id},
... | python | def click(self) -> None:
"""Send click event."""
if self.connected:
self.js_exec('click')
else:
# Web上に表示されてれば勝手にブラウザ側からクリックイベント発生する
# のでローカルのクリックイベント不要
msg = {'proto': '', 'type': 'click',
'currentTarget': {'id': self.wdom_id},
... | [
"def",
"click",
"(",
"self",
")",
"->",
"None",
":",
"if",
"self",
".",
"connected",
":",
"self",
".",
"js_exec",
"(",
"'click'",
")",
"else",
":",
"# Web上に表示されてれば勝手にブラウザ側からクリックイベント発生する",
"# のでローカルのクリックイベント不要",
"msg",
"=",
"{",
"'proto'",
":",
"''",
",",
"... | Send click event. | [
"Send",
"click",
"event",
"."
] | a21bcd23e94baceee71161829f6897bee3fd39c1 | https://github.com/miyakogi/wdom/blob/a21bcd23e94baceee71161829f6897bee3fd39c1/wdom/web_node.py#L318-L329 | train | 60,582 |
miyakogi/wdom | wdom/document.py | getElementById | def getElementById(id: str) -> Optional[Node]:
"""Get element with ``id``."""
elm = Element._elements_with_id.get(id)
return elm | python | def getElementById(id: str) -> Optional[Node]:
"""Get element with ``id``."""
elm = Element._elements_with_id.get(id)
return elm | [
"def",
"getElementById",
"(",
"id",
":",
"str",
")",
"->",
"Optional",
"[",
"Node",
"]",
":",
"elm",
"=",
"Element",
".",
"_elements_with_id",
".",
"get",
"(",
"id",
")",
"return",
"elm"
] | Get element with ``id``. | [
"Get",
"element",
"with",
"id",
"."
] | a21bcd23e94baceee71161829f6897bee3fd39c1 | https://github.com/miyakogi/wdom/blob/a21bcd23e94baceee71161829f6897bee3fd39c1/wdom/document.py#L31-L34 | train | 60,583 |
miyakogi/wdom | wdom/document.py | getElementByWdomId | def getElementByWdomId(id: str) -> Optional[WebEventTarget]:
"""Get element with ``wdom_id``."""
if not id:
return None
elif id == 'document':
return get_document()
elif id == 'window':
return get_document().defaultView
elm = WdomElement._elements_with_wdom_id.get(id)
ret... | python | def getElementByWdomId(id: str) -> Optional[WebEventTarget]:
"""Get element with ``wdom_id``."""
if not id:
return None
elif id == 'document':
return get_document()
elif id == 'window':
return get_document().defaultView
elm = WdomElement._elements_with_wdom_id.get(id)
ret... | [
"def",
"getElementByWdomId",
"(",
"id",
":",
"str",
")",
"->",
"Optional",
"[",
"WebEventTarget",
"]",
":",
"if",
"not",
"id",
":",
"return",
"None",
"elif",
"id",
"==",
"'document'",
":",
"return",
"get_document",
"(",
")",
"elif",
"id",
"==",
"'window'... | Get element with ``wdom_id``. | [
"Get",
"element",
"with",
"wdom_id",
"."
] | a21bcd23e94baceee71161829f6897bee3fd39c1 | https://github.com/miyakogi/wdom/blob/a21bcd23e94baceee71161829f6897bee3fd39c1/wdom/document.py#L37-L46 | train | 60,584 |
miyakogi/wdom | wdom/document.py | _cleanup | def _cleanup(path: str) -> None:
"""Cleanup temporary directory."""
if os.path.isdir(path):
shutil.rmtree(path) | python | def _cleanup(path: str) -> None:
"""Cleanup temporary directory."""
if os.path.isdir(path):
shutil.rmtree(path) | [
"def",
"_cleanup",
"(",
"path",
":",
"str",
")",
"->",
"None",
":",
"if",
"os",
".",
"path",
".",
"isdir",
"(",
"path",
")",
":",
"shutil",
".",
"rmtree",
"(",
"path",
")"
] | Cleanup temporary directory. | [
"Cleanup",
"temporary",
"directory",
"."
] | a21bcd23e94baceee71161829f6897bee3fd39c1 | https://github.com/miyakogi/wdom/blob/a21bcd23e94baceee71161829f6897bee3fd39c1/wdom/document.py#L49-L52 | train | 60,585 |
miyakogi/wdom | wdom/document.py | create_element | def create_element(tag: str, name: str = None, base: type = None,
attr: dict = None) -> Node:
"""Create element with a tag of ``name``.
:arg str name: html tag.
:arg type base: Base class of the created element
(defatlt: ``WdomElement``)
:arg dict attr: Attribu... | python | def create_element(tag: str, name: str = None, base: type = None,
attr: dict = None) -> Node:
"""Create element with a tag of ``name``.
:arg str name: html tag.
:arg type base: Base class of the created element
(defatlt: ``WdomElement``)
:arg dict attr: Attribu... | [
"def",
"create_element",
"(",
"tag",
":",
"str",
",",
"name",
":",
"str",
"=",
"None",
",",
"base",
":",
"type",
"=",
"None",
",",
"attr",
":",
"dict",
"=",
"None",
")",
"->",
"Node",
":",
"from",
"wdom",
".",
"web_node",
"import",
"WdomElement",
"... | Create element with a tag of ``name``.
:arg str name: html tag.
:arg type base: Base class of the created element
(defatlt: ``WdomElement``)
:arg dict attr: Attributes (key-value pairs dict) of the new element. | [
"Create",
"element",
"with",
"a",
"tag",
"of",
"name",
"."
] | a21bcd23e94baceee71161829f6897bee3fd39c1 | https://github.com/miyakogi/wdom/blob/a21bcd23e94baceee71161829f6897bee3fd39c1/wdom/document.py#L55-L78 | train | 60,586 |
miyakogi/wdom | wdom/document.py | Document.characterSet | def characterSet(self, charset: str) -> None:
"""Set character set of this document."""
charset_node = self._find_charset_node() or Meta(parent=self.head)
charset_node.setAttribute('charset', charset) | python | def characterSet(self, charset: str) -> None:
"""Set character set of this document."""
charset_node = self._find_charset_node() or Meta(parent=self.head)
charset_node.setAttribute('charset', charset) | [
"def",
"characterSet",
"(",
"self",
",",
"charset",
":",
"str",
")",
"->",
"None",
":",
"charset_node",
"=",
"self",
".",
"_find_charset_node",
"(",
")",
"or",
"Meta",
"(",
"parent",
"=",
"self",
".",
"head",
")",
"charset_node",
".",
"setAttribute",
"("... | Set character set of this document. | [
"Set",
"character",
"set",
"of",
"this",
"document",
"."
] | a21bcd23e94baceee71161829f6897bee3fd39c1 | https://github.com/miyakogi/wdom/blob/a21bcd23e94baceee71161829f6897bee3fd39c1/wdom/document.py#L149-L152 | train | 60,587 |
miyakogi/wdom | wdom/document.py | Document.getElementsBy | def getElementsBy(self, cond: Callable[[Element], bool]) -> NodeList:
"""Get elements in this document which matches condition."""
return getElementsBy(self, cond) | python | def getElementsBy(self, cond: Callable[[Element], bool]) -> NodeList:
"""Get elements in this document which matches condition."""
return getElementsBy(self, cond) | [
"def",
"getElementsBy",
"(",
"self",
",",
"cond",
":",
"Callable",
"[",
"[",
"Element",
"]",
",",
"bool",
"]",
")",
"->",
"NodeList",
":",
"return",
"getElementsBy",
"(",
"self",
",",
"cond",
")"
] | Get elements in this document which matches condition. | [
"Get",
"elements",
"in",
"this",
"document",
"which",
"matches",
"condition",
"."
] | a21bcd23e94baceee71161829f6897bee3fd39c1 | https://github.com/miyakogi/wdom/blob/a21bcd23e94baceee71161829f6897bee3fd39c1/wdom/document.py#L173-L175 | train | 60,588 |
miyakogi/wdom | wdom/document.py | Document.getElementById | def getElementById(self, id: str) -> Optional[Node]:
"""Get element by ``id``.
If this document does not have the element with the id, return None.
"""
elm = getElementById(id)
if elm and elm.ownerDocument is self:
return elm
return None | python | def getElementById(self, id: str) -> Optional[Node]:
"""Get element by ``id``.
If this document does not have the element with the id, return None.
"""
elm = getElementById(id)
if elm and elm.ownerDocument is self:
return elm
return None | [
"def",
"getElementById",
"(",
"self",
",",
"id",
":",
"str",
")",
"->",
"Optional",
"[",
"Node",
"]",
":",
"elm",
"=",
"getElementById",
"(",
"id",
")",
"if",
"elm",
"and",
"elm",
".",
"ownerDocument",
"is",
"self",
":",
"return",
"elm",
"return",
"N... | Get element by ``id``.
If this document does not have the element with the id, return None. | [
"Get",
"element",
"by",
"id",
"."
] | a21bcd23e94baceee71161829f6897bee3fd39c1 | https://github.com/miyakogi/wdom/blob/a21bcd23e94baceee71161829f6897bee3fd39c1/wdom/document.py#L185-L193 | train | 60,589 |
miyakogi/wdom | wdom/document.py | Document.createElement | def createElement(self, tag: str) -> Node:
"""Create new element whose tag name is ``tag``."""
return create_element(tag, base=self._default_class) | python | def createElement(self, tag: str) -> Node:
"""Create new element whose tag name is ``tag``."""
return create_element(tag, base=self._default_class) | [
"def",
"createElement",
"(",
"self",
",",
"tag",
":",
"str",
")",
"->",
"Node",
":",
"return",
"create_element",
"(",
"tag",
",",
"base",
"=",
"self",
".",
"_default_class",
")"
] | Create new element whose tag name is ``tag``. | [
"Create",
"new",
"element",
"whose",
"tag",
"name",
"is",
"tag",
"."
] | a21bcd23e94baceee71161829f6897bee3fd39c1 | https://github.com/miyakogi/wdom/blob/a21bcd23e94baceee71161829f6897bee3fd39c1/wdom/document.py#L207-L209 | train | 60,590 |
miyakogi/wdom | wdom/document.py | WdomDocument.getElementByWdomId | def getElementByWdomId(self, id: Union[str]) -> Optional[WebEventTarget]:
"""Get an element node with ``wdom_id``.
If this document does not have the element with the id, return None.
"""
elm = getElementByWdomId(id)
if elm and elm.ownerDocument is self:
return elm
... | python | def getElementByWdomId(self, id: Union[str]) -> Optional[WebEventTarget]:
"""Get an element node with ``wdom_id``.
If this document does not have the element with the id, return None.
"""
elm = getElementByWdomId(id)
if elm and elm.ownerDocument is self:
return elm
... | [
"def",
"getElementByWdomId",
"(",
"self",
",",
"id",
":",
"Union",
"[",
"str",
"]",
")",
"->",
"Optional",
"[",
"WebEventTarget",
"]",
":",
"elm",
"=",
"getElementByWdomId",
"(",
"id",
")",
"if",
"elm",
"and",
"elm",
".",
"ownerDocument",
"is",
"self",
... | Get an element node with ``wdom_id``.
If this document does not have the element with the id, return None. | [
"Get",
"an",
"element",
"node",
"with",
"wdom_id",
"."
] | a21bcd23e94baceee71161829f6897bee3fd39c1 | https://github.com/miyakogi/wdom/blob/a21bcd23e94baceee71161829f6897bee3fd39c1/wdom/document.py#L297-L305 | train | 60,591 |
miyakogi/wdom | wdom/document.py | WdomDocument.add_jsfile | def add_jsfile(self, src: str) -> None:
"""Add JS file to load at this document's bottom of the body."""
self.body.appendChild(Script(src=src)) | python | def add_jsfile(self, src: str) -> None:
"""Add JS file to load at this document's bottom of the body."""
self.body.appendChild(Script(src=src)) | [
"def",
"add_jsfile",
"(",
"self",
",",
"src",
":",
"str",
")",
"->",
"None",
":",
"self",
".",
"body",
".",
"appendChild",
"(",
"Script",
"(",
"src",
"=",
"src",
")",
")"
] | Add JS file to load at this document's bottom of the body. | [
"Add",
"JS",
"file",
"to",
"load",
"at",
"this",
"document",
"s",
"bottom",
"of",
"the",
"body",
"."
] | a21bcd23e94baceee71161829f6897bee3fd39c1 | https://github.com/miyakogi/wdom/blob/a21bcd23e94baceee71161829f6897bee3fd39c1/wdom/document.py#L307-L309 | train | 60,592 |
miyakogi/wdom | wdom/document.py | WdomDocument.add_jsfile_head | def add_jsfile_head(self, src: str) -> None:
"""Add JS file to load at this document's header."""
self.head.appendChild(Script(src=src)) | python | def add_jsfile_head(self, src: str) -> None:
"""Add JS file to load at this document's header."""
self.head.appendChild(Script(src=src)) | [
"def",
"add_jsfile_head",
"(",
"self",
",",
"src",
":",
"str",
")",
"->",
"None",
":",
"self",
".",
"head",
".",
"appendChild",
"(",
"Script",
"(",
"src",
"=",
"src",
")",
")"
] | Add JS file to load at this document's header. | [
"Add",
"JS",
"file",
"to",
"load",
"at",
"this",
"document",
"s",
"header",
"."
] | a21bcd23e94baceee71161829f6897bee3fd39c1 | https://github.com/miyakogi/wdom/blob/a21bcd23e94baceee71161829f6897bee3fd39c1/wdom/document.py#L311-L313 | train | 60,593 |
miyakogi/wdom | wdom/document.py | WdomDocument.add_cssfile | def add_cssfile(self, src: str) -> None:
"""Add CSS file to load at this document's header."""
self.head.appendChild(Link(rel='stylesheet', href=src)) | python | def add_cssfile(self, src: str) -> None:
"""Add CSS file to load at this document's header."""
self.head.appendChild(Link(rel='stylesheet', href=src)) | [
"def",
"add_cssfile",
"(",
"self",
",",
"src",
":",
"str",
")",
"->",
"None",
":",
"self",
".",
"head",
".",
"appendChild",
"(",
"Link",
"(",
"rel",
"=",
"'stylesheet'",
",",
"href",
"=",
"src",
")",
")"
] | Add CSS file to load at this document's header. | [
"Add",
"CSS",
"file",
"to",
"load",
"at",
"this",
"document",
"s",
"header",
"."
] | a21bcd23e94baceee71161829f6897bee3fd39c1 | https://github.com/miyakogi/wdom/blob/a21bcd23e94baceee71161829f6897bee3fd39c1/wdom/document.py#L315-L317 | train | 60,594 |
miyakogi/wdom | wdom/document.py | WdomDocument.register_theme | def register_theme(self, theme: ModuleType) -> None:
"""Set theme for this docuemnt.
This method sets theme's js/css files and headers on this document.
:arg ModuleType theme: a module which has ``js_files``, ``css_files``,
``headers``, and ``extended_classes``. see ``wdom.themes``... | python | def register_theme(self, theme: ModuleType) -> None:
"""Set theme for this docuemnt.
This method sets theme's js/css files and headers on this document.
:arg ModuleType theme: a module which has ``js_files``, ``css_files``,
``headers``, and ``extended_classes``. see ``wdom.themes``... | [
"def",
"register_theme",
"(",
"self",
",",
"theme",
":",
"ModuleType",
")",
"->",
"None",
":",
"if",
"not",
"hasattr",
"(",
"theme",
",",
"'css_files'",
")",
":",
"raise",
"ValueError",
"(",
"'theme module must include `css_files`.'",
")",
"for",
"css",
"in",
... | Set theme for this docuemnt.
This method sets theme's js/css files and headers on this document.
:arg ModuleType theme: a module which has ``js_files``, ``css_files``,
``headers``, and ``extended_classes``. see ``wdom.themes``
directory actual theme module structures. | [
"Set",
"theme",
"for",
"this",
"docuemnt",
"."
] | a21bcd23e94baceee71161829f6897bee3fd39c1 | https://github.com/miyakogi/wdom/blob/a21bcd23e94baceee71161829f6897bee3fd39c1/wdom/document.py#L326-L344 | train | 60,595 |
miyakogi/wdom | wdom/document.py | WdomDocument.build | def build(self) -> str:
"""Return HTML representation of this document."""
self._set_autoreload()
return ''.join(child.html for child in self.childNodes) | python | def build(self) -> str:
"""Return HTML representation of this document."""
self._set_autoreload()
return ''.join(child.html for child in self.childNodes) | [
"def",
"build",
"(",
"self",
")",
"->",
"str",
":",
"self",
".",
"_set_autoreload",
"(",
")",
"return",
"''",
".",
"join",
"(",
"child",
".",
"html",
"for",
"child",
"in",
"self",
".",
"childNodes",
")"
] | Return HTML representation of this document. | [
"Return",
"HTML",
"representation",
"of",
"this",
"document",
"."
] | a21bcd23e94baceee71161829f6897bee3fd39c1 | https://github.com/miyakogi/wdom/blob/a21bcd23e94baceee71161829f6897bee3fd39c1/wdom/document.py#L346-L349 | train | 60,596 |
miyakogi/wdom | wdom/server/__init__.py | send_message | def send_message() -> None:
"""Send message via WS to all client connections."""
if not _msg_queue:
return
msg = json.dumps(_msg_queue)
_msg_queue.clear()
for conn in module.connections:
conn.write_message(msg) | python | def send_message() -> None:
"""Send message via WS to all client connections."""
if not _msg_queue:
return
msg = json.dumps(_msg_queue)
_msg_queue.clear()
for conn in module.connections:
conn.write_message(msg) | [
"def",
"send_message",
"(",
")",
"->",
"None",
":",
"if",
"not",
"_msg_queue",
":",
"return",
"msg",
"=",
"json",
".",
"dumps",
"(",
"_msg_queue",
")",
"_msg_queue",
".",
"clear",
"(",
")",
"for",
"conn",
"in",
"module",
".",
"connections",
":",
"conn"... | Send message via WS to all client connections. | [
"Send",
"message",
"via",
"WS",
"to",
"all",
"client",
"connections",
"."
] | a21bcd23e94baceee71161829f6897bee3fd39c1 | https://github.com/miyakogi/wdom/blob/a21bcd23e94baceee71161829f6897bee3fd39c1/wdom/server/__init__.py#L43-L50 | train | 60,597 |
miyakogi/wdom | wdom/server/__init__.py | add_static_path | def add_static_path(prefix: str, path: str, no_watch: bool = False) -> None:
"""Add directory to serve static files.
First argument ``prefix`` is a URL prefix for the ``path``. ``path`` must
be a directory. If ``no_watch`` is True, any change of the files in the
path do not trigger restart if ``--autor... | python | def add_static_path(prefix: str, path: str, no_watch: bool = False) -> None:
"""Add directory to serve static files.
First argument ``prefix`` is a URL prefix for the ``path``. ``path`` must
be a directory. If ``no_watch`` is True, any change of the files in the
path do not trigger restart if ``--autor... | [
"def",
"add_static_path",
"(",
"prefix",
":",
"str",
",",
"path",
":",
"str",
",",
"no_watch",
":",
"bool",
"=",
"False",
")",
"->",
"None",
":",
"app",
"=",
"get_app",
"(",
")",
"app",
".",
"add_static_path",
"(",
"prefix",
",",
"path",
")",
"if",
... | Add directory to serve static files.
First argument ``prefix`` is a URL prefix for the ``path``. ``path`` must
be a directory. If ``no_watch`` is True, any change of the files in the
path do not trigger restart if ``--autoreload`` is enabled. | [
"Add",
"directory",
"to",
"serve",
"static",
"files",
"."
] | a21bcd23e94baceee71161829f6897bee3fd39c1 | https://github.com/miyakogi/wdom/blob/a21bcd23e94baceee71161829f6897bee3fd39c1/wdom/server/__init__.py#L53-L63 | train | 60,598 |
miyakogi/wdom | wdom/server/__init__.py | start | def start(**kwargs: Any) -> None:
"""Start web server.
Run until ``Ctrl-c`` pressed, or if auto-shutdown is enabled, until when
all browser windows are closed.
This function accepts keyword areguments same as :func:`start_server` and
all arguments passed to it.
"""
start_server(**kwargs)
... | python | def start(**kwargs: Any) -> None:
"""Start web server.
Run until ``Ctrl-c`` pressed, or if auto-shutdown is enabled, until when
all browser windows are closed.
This function accepts keyword areguments same as :func:`start_server` and
all arguments passed to it.
"""
start_server(**kwargs)
... | [
"def",
"start",
"(",
"*",
"*",
"kwargs",
":",
"Any",
")",
"->",
"None",
":",
"start_server",
"(",
"*",
"*",
"kwargs",
")",
"try",
":",
"asyncio",
".",
"get_event_loop",
"(",
")",
".",
"run_forever",
"(",
")",
"except",
"KeyboardInterrupt",
":",
"stop_s... | Start web server.
Run until ``Ctrl-c`` pressed, or if auto-shutdown is enabled, until when
all browser windows are closed.
This function accepts keyword areguments same as :func:`start_server` and
all arguments passed to it. | [
"Start",
"web",
"server",
"."
] | a21bcd23e94baceee71161829f6897bee3fd39c1 | https://github.com/miyakogi/wdom/blob/a21bcd23e94baceee71161829f6897bee3fd39c1/wdom/server/__init__.py#L116-L129 | train | 60,599 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.