repository_name stringlengths 7 55 | func_path_in_repository stringlengths 4 223 | func_name stringlengths 1 134 | whole_func_string stringlengths 75 104k | language stringclasses 1
value | func_code_string stringlengths 75 104k | func_code_tokens listlengths 19 28.4k | func_documentation_string stringlengths 1 46.9k | func_documentation_tokens listlengths 1 1.97k | split_name stringclasses 1
value | func_code_url stringlengths 87 315 |
|---|---|---|---|---|---|---|---|---|---|---|
ManiacalLabs/BiblioPixelAnimations | BiblioPixelAnimations/strip/Emitter/__init__.py | Emitter.make_bd | def make_bd(self):
"Make a set of 'shaped' random #'s for particle brightness deltas (bd)"
self.bd = concatenate((
# These values will dim the particles
random.normal(
self.bd_mean - self.bd_mu, self.bd_sigma, 16).astype(int),
# These values will brigh... | python | def make_bd(self):
"Make a set of 'shaped' random #'s for particle brightness deltas (bd)"
self.bd = concatenate((
# These values will dim the particles
random.normal(
self.bd_mean - self.bd_mu, self.bd_sigma, 16).astype(int),
# These values will brigh... | [
"def",
"make_bd",
"(",
"self",
")",
":",
"self",
".",
"bd",
"=",
"concatenate",
"(",
"(",
"# These values will dim the particles",
"random",
".",
"normal",
"(",
"self",
".",
"bd_mean",
"-",
"self",
".",
"bd_mu",
",",
"self",
".",
"bd_sigma",
",",
"16",
"... | Make a set of 'shaped' random #'s for particle brightness deltas (bd) | [
"Make",
"a",
"set",
"of",
"shaped",
"random",
"#",
"s",
"for",
"particle",
"brightness",
"deltas",
"(",
"bd",
")"
] | train | https://github.com/ManiacalLabs/BiblioPixelAnimations/blob/fba81f6b94f5265272a53f462ef013df1ccdb426/BiblioPixelAnimations/strip/Emitter/__init__.py#L69-L78 |
ManiacalLabs/BiblioPixelAnimations | BiblioPixelAnimations/strip/Emitter/__init__.py | Emitter.make_vel | def make_vel(self):
"Make a set of velocities to be randomly chosen for emitted particles"
self.vel = random.normal(self.vel_mu, self.vel_sigma, 16)
# Make sure nothing's slower than 1/8 pixel / step
for i, vel in enumerate(self.vel):
if abs(vel) < 0.125 / self._size:
... | python | def make_vel(self):
"Make a set of velocities to be randomly chosen for emitted particles"
self.vel = random.normal(self.vel_mu, self.vel_sigma, 16)
# Make sure nothing's slower than 1/8 pixel / step
for i, vel in enumerate(self.vel):
if abs(vel) < 0.125 / self._size:
... | [
"def",
"make_vel",
"(",
"self",
")",
":",
"self",
".",
"vel",
"=",
"random",
".",
"normal",
"(",
"self",
".",
"vel_mu",
",",
"self",
".",
"vel_sigma",
",",
"16",
")",
"# Make sure nothing's slower than 1/8 pixel / step",
"for",
"i",
",",
"vel",
"in",
"enum... | Make a set of velocities to be randomly chosen for emitted particles | [
"Make",
"a",
"set",
"of",
"velocities",
"to",
"be",
"randomly",
"chosen",
"for",
"emitted",
"particles"
] | train | https://github.com/ManiacalLabs/BiblioPixelAnimations/blob/fba81f6b94f5265272a53f462ef013df1ccdb426/BiblioPixelAnimations/strip/Emitter/__init__.py#L80-L89 |
ManiacalLabs/BiblioPixelAnimations | BiblioPixelAnimations/strip/Emitter/__init__.py | Emitter.move_particles | def move_particles(self):
"""
Move each particle by it's velocity, adjusting brightness as we go.
Particles that have moved beyond their range (steps to live), and
those that move off the ends and are not wrapped get sacked.
Particles can stay between _end and up to but not inclu... | python | def move_particles(self):
"""
Move each particle by it's velocity, adjusting brightness as we go.
Particles that have moved beyond their range (steps to live), and
those that move off the ends and are not wrapped get sacked.
Particles can stay between _end and up to but not inclu... | [
"def",
"move_particles",
"(",
"self",
")",
":",
"moved_particles",
"=",
"[",
"]",
"for",
"vel",
",",
"pos",
",",
"stl",
",",
"color",
",",
"bright",
"in",
"self",
".",
"particles",
":",
"stl",
"-=",
"1",
"# steps to live",
"if",
"stl",
">",
"0",
":",... | Move each particle by it's velocity, adjusting brightness as we go.
Particles that have moved beyond their range (steps to live), and
those that move off the ends and are not wrapped get sacked.
Particles can stay between _end and up to but not including _end+1
No particles can exitst be... | [
"Move",
"each",
"particle",
"by",
"it",
"s",
"velocity",
"adjusting",
"brightness",
"as",
"we",
"go",
".",
"Particles",
"that",
"have",
"moved",
"beyond",
"their",
"range",
"(",
"steps",
"to",
"live",
")",
"and",
"those",
"that",
"move",
"off",
"the",
"e... | train | https://github.com/ManiacalLabs/BiblioPixelAnimations/blob/fba81f6b94f5265272a53f462ef013df1ccdb426/BiblioPixelAnimations/strip/Emitter/__init__.py#L176-L216 |
ManiacalLabs/BiblioPixelAnimations | BiblioPixelAnimations/strip/Emitter/__init__.py | Emitter.move_emitters | def move_emitters(self):
"""
Move each emitter by it's velocity. Emmitters that move off the ends
and are not wrapped get sacked.
"""
moved_emitters = []
for e_pos, e_dir, e_vel, e_range, e_color, e_pal in self.emitters:
e_pos = e_pos + e_vel
if e... | python | def move_emitters(self):
"""
Move each emitter by it's velocity. Emmitters that move off the ends
and are not wrapped get sacked.
"""
moved_emitters = []
for e_pos, e_dir, e_vel, e_range, e_color, e_pal in self.emitters:
e_pos = e_pos + e_vel
if e... | [
"def",
"move_emitters",
"(",
"self",
")",
":",
"moved_emitters",
"=",
"[",
"]",
"for",
"e_pos",
",",
"e_dir",
",",
"e_vel",
",",
"e_range",
",",
"e_color",
",",
"e_pal",
"in",
"self",
".",
"emitters",
":",
"e_pos",
"=",
"e_pos",
"+",
"e_vel",
"if",
"... | Move each emitter by it's velocity. Emmitters that move off the ends
and are not wrapped get sacked. | [
"Move",
"each",
"emitter",
"by",
"it",
"s",
"velocity",
".",
"Emmitters",
"that",
"move",
"off",
"the",
"ends",
"and",
"are",
"not",
"wrapped",
"get",
"sacked",
"."
] | train | https://github.com/ManiacalLabs/BiblioPixelAnimations/blob/fba81f6b94f5265272a53f462ef013df1ccdb426/BiblioPixelAnimations/strip/Emitter/__init__.py#L218-L243 |
ManiacalLabs/BiblioPixelAnimations | BiblioPixelAnimations/strip/Emitter/__init__.py | Emitter.start_new_particles | def start_new_particles(self):
"""
Start some new particles from the emitters. We roll the dice
starts_at_once times, seeing if we can start each particle based
on starts_prob. If we start, the particle gets a color form
the palette and a velocity from the vel list.
"""
... | python | def start_new_particles(self):
"""
Start some new particles from the emitters. We roll the dice
starts_at_once times, seeing if we can start each particle based
on starts_prob. If we start, the particle gets a color form
the palette and a velocity from the vel list.
"""
... | [
"def",
"start_new_particles",
"(",
"self",
")",
":",
"for",
"e_pos",
",",
"e_dir",
",",
"e_vel",
",",
"e_range",
",",
"e_color",
",",
"e_pal",
"in",
"self",
".",
"emitters",
":",
"for",
"roll",
"in",
"range",
"(",
"self",
".",
"starts_at_once",
")",
":... | Start some new particles from the emitters. We roll the dice
starts_at_once times, seeing if we can start each particle based
on starts_prob. If we start, the particle gets a color form
the palette and a velocity from the vel list. | [
"Start",
"some",
"new",
"particles",
"from",
"the",
"emitters",
".",
"We",
"roll",
"the",
"dice",
"starts_at_once",
"times",
"seeing",
"if",
"we",
"can",
"start",
"each",
"particle",
"based",
"on",
"starts_prob",
".",
"If",
"we",
"start",
"the",
"particle",
... | train | https://github.com/ManiacalLabs/BiblioPixelAnimations/blob/fba81f6b94f5265272a53f462ef013df1ccdb426/BiblioPixelAnimations/strip/Emitter/__init__.py#L245-L264 |
ManiacalLabs/BiblioPixelAnimations | BiblioPixelAnimations/strip/Emitter/__init__.py | Emitter.visibility | def visibility(self, strip_pos, particle_pos):
"""
Compute particle visibility based on distance between current
strip position being rendered and particle position. A value
of 0.0 is returned if they are >= one aperture away, values
between 0.0 and 1.0 are returned if they are l... | python | def visibility(self, strip_pos, particle_pos):
"""
Compute particle visibility based on distance between current
strip position being rendered and particle position. A value
of 0.0 is returned if they are >= one aperture away, values
between 0.0 and 1.0 are returned if they are l... | [
"def",
"visibility",
"(",
"self",
",",
"strip_pos",
",",
"particle_pos",
")",
":",
"dist",
"=",
"abs",
"(",
"particle_pos",
"-",
"strip_pos",
")",
"if",
"dist",
">",
"self",
".",
"half_size",
":",
"dist",
"=",
"self",
".",
"_size",
"-",
"dist",
"if",
... | Compute particle visibility based on distance between current
strip position being rendered and particle position. A value
of 0.0 is returned if they are >= one aperture away, values
between 0.0 and 1.0 are returned if they are less than one
aperature apart. | [
"Compute",
"particle",
"visibility",
"based",
"on",
"distance",
"between",
"current",
"strip",
"position",
"being",
"rendered",
"and",
"particle",
"position",
".",
"A",
"value",
"of",
"0",
".",
"0",
"is",
"returned",
"if",
"they",
"are",
">",
"=",
"one",
"... | train | https://github.com/ManiacalLabs/BiblioPixelAnimations/blob/fba81f6b94f5265272a53f462ef013df1ccdb426/BiblioPixelAnimations/strip/Emitter/__init__.py#L266-L280 |
ManiacalLabs/BiblioPixelAnimations | BiblioPixelAnimations/strip/Emitter/__init__.py | Emitter.render_particles | def render_particles(self):
"""
Render visible particles at each strip position, by modifying
the strip's color list.
"""
for strip_pos in range(self._start, self._end + 1):
blended = COLORS.black
# Render visible emitters
if self.has_e_color... | python | def render_particles(self):
"""
Render visible particles at each strip position, by modifying
the strip's color list.
"""
for strip_pos in range(self._start, self._end + 1):
blended = COLORS.black
# Render visible emitters
if self.has_e_color... | [
"def",
"render_particles",
"(",
"self",
")",
":",
"for",
"strip_pos",
"in",
"range",
"(",
"self",
".",
"_start",
",",
"self",
".",
"_end",
"+",
"1",
")",
":",
"blended",
"=",
"COLORS",
".",
"black",
"# Render visible emitters",
"if",
"self",
".",
"has_e_... | Render visible particles at each strip position, by modifying
the strip's color list. | [
"Render",
"visible",
"particles",
"at",
"each",
"strip",
"position",
"by",
"modifying",
"the",
"strip",
"s",
"color",
"list",
"."
] | train | https://github.com/ManiacalLabs/BiblioPixelAnimations/blob/fba81f6b94f5265272a53f462ef013df1ccdb426/BiblioPixelAnimations/strip/Emitter/__init__.py#L282-L314 |
ManiacalLabs/BiblioPixelAnimations | BiblioPixelAnimations/strip/Emitter/__init__.py | Emitter.step | def step(self, amt=1):
"Make a frame of the animation"
self.move_particles()
if self.has_moving_emitters:
self.move_emitters()
self.start_new_particles()
self.render_particles()
if self.emitters == [] and self.particles == []:
self.completed = True | python | def step(self, amt=1):
"Make a frame of the animation"
self.move_particles()
if self.has_moving_emitters:
self.move_emitters()
self.start_new_particles()
self.render_particles()
if self.emitters == [] and self.particles == []:
self.completed = True | [
"def",
"step",
"(",
"self",
",",
"amt",
"=",
"1",
")",
":",
"self",
".",
"move_particles",
"(",
")",
"if",
"self",
".",
"has_moving_emitters",
":",
"self",
".",
"move_emitters",
"(",
")",
"self",
".",
"start_new_particles",
"(",
")",
"self",
".",
"rend... | Make a frame of the animation | [
"Make",
"a",
"frame",
"of",
"the",
"animation"
] | train | https://github.com/ManiacalLabs/BiblioPixelAnimations/blob/fba81f6b94f5265272a53f462ef013df1ccdb426/BiblioPixelAnimations/strip/Emitter/__init__.py#L316-L324 |
ManiacalLabs/BiblioPixelAnimations | BiblioPixelAnimations/matrix/TicTacToe.py | Tic.complete | def complete(self):
"""is the game over?"""
if None not in [v for v in self.squares]:
return True
if self.winner() is not None:
return True
return False | python | def complete(self):
"""is the game over?"""
if None not in [v for v in self.squares]:
return True
if self.winner() is not None:
return True
return False | [
"def",
"complete",
"(",
"self",
")",
":",
"if",
"None",
"not",
"in",
"[",
"v",
"for",
"v",
"in",
"self",
".",
"squares",
"]",
":",
"return",
"True",
"if",
"self",
".",
"winner",
"(",
")",
"is",
"not",
"None",
":",
"return",
"True",
"return",
"Fal... | is the game over? | [
"is",
"the",
"game",
"over?"
] | train | https://github.com/ManiacalLabs/BiblioPixelAnimations/blob/fba81f6b94f5265272a53f462ef013df1ccdb426/BiblioPixelAnimations/matrix/TicTacToe.py#L32-L38 |
ManiacalLabs/BiblioPixelAnimations | BiblioPixelAnimations/matrix/TicTacToe.py | Tic.get_squares | def get_squares(self, player=None):
"""squares that belong to a player"""
if player:
return [k for k, v in enumerate(self.squares) if v == player]
else:
return self.squares | python | def get_squares(self, player=None):
"""squares that belong to a player"""
if player:
return [k for k, v in enumerate(self.squares) if v == player]
else:
return self.squares | [
"def",
"get_squares",
"(",
"self",
",",
"player",
"=",
"None",
")",
":",
"if",
"player",
":",
"return",
"[",
"k",
"for",
"k",
",",
"v",
"in",
"enumerate",
"(",
"self",
".",
"squares",
")",
"if",
"v",
"==",
"player",
"]",
"else",
":",
"return",
"s... | squares that belong to a player | [
"squares",
"that",
"belong",
"to",
"a",
"player"
] | train | https://github.com/ManiacalLabs/BiblioPixelAnimations/blob/fba81f6b94f5265272a53f462ef013df1ccdb426/BiblioPixelAnimations/matrix/TicTacToe.py#L77-L82 |
ManiacalLabs/BiblioPixelAnimations | BiblioPixelAnimations/matrix/GameOfLife.py | Table.liveNeighbours | def liveNeighbours(self, y, x):
"""Returns the number of live neighbours."""
count = 0
if y > 0:
if self.table[y - 1][x]:
count = count + 1
if x > 0:
if self.table[y - 1][x - 1]:
count = count + 1
if self.wid... | python | def liveNeighbours(self, y, x):
"""Returns the number of live neighbours."""
count = 0
if y > 0:
if self.table[y - 1][x]:
count = count + 1
if x > 0:
if self.table[y - 1][x - 1]:
count = count + 1
if self.wid... | [
"def",
"liveNeighbours",
"(",
"self",
",",
"y",
",",
"x",
")",
":",
"count",
"=",
"0",
"if",
"y",
">",
"0",
":",
"if",
"self",
".",
"table",
"[",
"y",
"-",
"1",
"]",
"[",
"x",
"]",
":",
"count",
"=",
"count",
"+",
"1",
"if",
"x",
">",
"0"... | Returns the number of live neighbours. | [
"Returns",
"the",
"number",
"of",
"live",
"neighbours",
"."
] | train | https://github.com/ManiacalLabs/BiblioPixelAnimations/blob/fba81f6b94f5265272a53f462ef013df1ccdb426/BiblioPixelAnimations/matrix/GameOfLife.py#L40-L84 |
mtien/PeptideBuilder | PeptideBuilder/PeptideBuilder.py | makeGly | def makeGly(segID, N, CA, C, O, geo):
'''Creates a Glycine residue'''
##Create Residue Data Structure
res= Residue((' ', segID, ' '), "GLY", ' ')
res.add(N)
res.add(CA)
res.add(C)
res.add(O)
##print(res)
return res | python | def makeGly(segID, N, CA, C, O, geo):
'''Creates a Glycine residue'''
##Create Residue Data Structure
res= Residue((' ', segID, ' '), "GLY", ' ')
res.add(N)
res.add(CA)
res.add(C)
res.add(O)
##print(res)
return res | [
"def",
"makeGly",
"(",
"segID",
",",
"N",
",",
"CA",
",",
"C",
",",
"O",
",",
"geo",
")",
":",
"##Create Residue Data Structure",
"res",
"=",
"Residue",
"(",
"(",
"' '",
",",
"segID",
",",
"' '",
")",
",",
"\"GLY\"",
",",
"' '",
")",
"res",
".",... | Creates a Glycine residue | [
"Creates",
"a",
"Glycine",
"residue"
] | train | https://github.com/mtien/PeptideBuilder/blob/7b1ddab5199432c1aabc371a34ec42dd386dfa6f/PeptideBuilder/PeptideBuilder.py#L99-L110 |
mtien/PeptideBuilder | PeptideBuilder/PeptideBuilder.py | makeAla | def makeAla(segID, N, CA, C, O, geo):
'''Creates an Alanine residue'''
##R-Group
CA_CB_length=geo.CA_CB_length
C_CA_CB_angle=geo.C_CA_CB_angle
N_C_CA_CB_diangle=geo.N_C_CA_CB_diangle
carbon_b= calculateCoordinates(N, C, CA, CA_CB_length, C_CA_CB_angle, N_C_CA_CB_diangle)
CB= Atom("CB", carb... | python | def makeAla(segID, N, CA, C, O, geo):
'''Creates an Alanine residue'''
##R-Group
CA_CB_length=geo.CA_CB_length
C_CA_CB_angle=geo.C_CA_CB_angle
N_C_CA_CB_diangle=geo.N_C_CA_CB_diangle
carbon_b= calculateCoordinates(N, C, CA, CA_CB_length, C_CA_CB_angle, N_C_CA_CB_diangle)
CB= Atom("CB", carb... | [
"def",
"makeAla",
"(",
"segID",
",",
"N",
",",
"CA",
",",
"C",
",",
"O",
",",
"geo",
")",
":",
"##R-Group",
"CA_CB_length",
"=",
"geo",
".",
"CA_CB_length",
"C_CA_CB_angle",
"=",
"geo",
".",
"C_CA_CB_angle",
"N_C_CA_CB_diangle",
"=",
"geo",
".",
"N_C_CA_... | Creates an Alanine residue | [
"Creates",
"an",
"Alanine",
"residue"
] | train | https://github.com/mtien/PeptideBuilder/blob/7b1ddab5199432c1aabc371a34ec42dd386dfa6f/PeptideBuilder/PeptideBuilder.py#L112-L129 |
mtien/PeptideBuilder | PeptideBuilder/PeptideBuilder.py | makeSer | def makeSer(segID, N, CA, C, O, geo):
'''Creates a Serine residue'''
##R-Group
CA_CB_length=geo.CA_CB_length
C_CA_CB_angle=geo.C_CA_CB_angle
N_C_CA_CB_diangle=geo.N_C_CA_CB_diangle
CB_OG_length=geo.CB_OG_length
CA_CB_OG_angle=geo.CA_CB_OG_angle
N_CA_CB_OG_diangle=geo.N_CA_CB_OG_diangle
... | python | def makeSer(segID, N, CA, C, O, geo):
'''Creates a Serine residue'''
##R-Group
CA_CB_length=geo.CA_CB_length
C_CA_CB_angle=geo.C_CA_CB_angle
N_C_CA_CB_diangle=geo.N_C_CA_CB_diangle
CB_OG_length=geo.CB_OG_length
CA_CB_OG_angle=geo.CA_CB_OG_angle
N_CA_CB_OG_diangle=geo.N_CA_CB_OG_diangle
... | [
"def",
"makeSer",
"(",
"segID",
",",
"N",
",",
"CA",
",",
"C",
",",
"O",
",",
"geo",
")",
":",
"##R-Group",
"CA_CB_length",
"=",
"geo",
".",
"CA_CB_length",
"C_CA_CB_angle",
"=",
"geo",
".",
"C_CA_CB_angle",
"N_C_CA_CB_diangle",
"=",
"geo",
".",
"N_C_CA_... | Creates a Serine residue | [
"Creates",
"a",
"Serine",
"residue"
] | train | https://github.com/mtien/PeptideBuilder/blob/7b1ddab5199432c1aabc371a34ec42dd386dfa6f/PeptideBuilder/PeptideBuilder.py#L131-L157 |
mtien/PeptideBuilder | PeptideBuilder/PeptideBuilder.py | makeCys | def makeCys(segID, N, CA, C, O, geo):
'''Creates a Cysteine residue'''
##R-Group
CA_CB_length=geo.CA_CB_length
C_CA_CB_angle=geo.C_CA_CB_angle
N_C_CA_CB_diangle=geo.N_C_CA_CB_diangle
CB_SG_length= geo.CB_SG_length
CA_CB_SG_angle= geo.CA_CB_SG_angle
N_CA_CB_SG_diangle= geo.N_CA_CB_SG... | python | def makeCys(segID, N, CA, C, O, geo):
'''Creates a Cysteine residue'''
##R-Group
CA_CB_length=geo.CA_CB_length
C_CA_CB_angle=geo.C_CA_CB_angle
N_C_CA_CB_diangle=geo.N_C_CA_CB_diangle
CB_SG_length= geo.CB_SG_length
CA_CB_SG_angle= geo.CA_CB_SG_angle
N_CA_CB_SG_diangle= geo.N_CA_CB_SG... | [
"def",
"makeCys",
"(",
"segID",
",",
"N",
",",
"CA",
",",
"C",
",",
"O",
",",
"geo",
")",
":",
"##R-Group",
"CA_CB_length",
"=",
"geo",
".",
"CA_CB_length",
"C_CA_CB_angle",
"=",
"geo",
".",
"C_CA_CB_angle",
"N_C_CA_CB_diangle",
"=",
"geo",
".",
"N_C_CA_... | Creates a Cysteine residue | [
"Creates",
"a",
"Cysteine",
"residue"
] | train | https://github.com/mtien/PeptideBuilder/blob/7b1ddab5199432c1aabc371a34ec42dd386dfa6f/PeptideBuilder/PeptideBuilder.py#L159-L183 |
mtien/PeptideBuilder | PeptideBuilder/PeptideBuilder.py | makeVal | def makeVal(segID, N, CA, C, O, geo):
'''Creates a Valine residue'''
##R-Group
CA_CB_length=geo.CA_CB_length
C_CA_CB_angle=geo.C_CA_CB_angle
N_C_CA_CB_diangle=geo.N_C_CA_CB_diangle
CB_CG1_length=geo.CB_CG1_length
CA_CB_CG1_angle=geo.CA_CB_CG1_angle
N_CA_CB_CG1_diangle=geo.N_CA_CB_CG... | python | def makeVal(segID, N, CA, C, O, geo):
'''Creates a Valine residue'''
##R-Group
CA_CB_length=geo.CA_CB_length
C_CA_CB_angle=geo.C_CA_CB_angle
N_C_CA_CB_diangle=geo.N_C_CA_CB_diangle
CB_CG1_length=geo.CB_CG1_length
CA_CB_CG1_angle=geo.CA_CB_CG1_angle
N_CA_CB_CG1_diangle=geo.N_CA_CB_CG... | [
"def",
"makeVal",
"(",
"segID",
",",
"N",
",",
"CA",
",",
"C",
",",
"O",
",",
"geo",
")",
":",
"##R-Group",
"CA_CB_length",
"=",
"geo",
".",
"CA_CB_length",
"C_CA_CB_angle",
"=",
"geo",
".",
"C_CA_CB_angle",
"N_C_CA_CB_diangle",
"=",
"geo",
".",
"N_C_CA_... | Creates a Valine residue | [
"Creates",
"a",
"Valine",
"residue"
] | train | https://github.com/mtien/PeptideBuilder/blob/7b1ddab5199432c1aabc371a34ec42dd386dfa6f/PeptideBuilder/PeptideBuilder.py#L185-L216 |
mtien/PeptideBuilder | PeptideBuilder/PeptideBuilder.py | makeIle | def makeIle(segID, N, CA, C, O, geo):
'''Creates an Isoleucine residue'''
##R-group
CA_CB_length=geo.CA_CB_length
C_CA_CB_angle=geo.C_CA_CB_angle
N_C_CA_CB_diangle=geo.N_C_CA_CB_diangle
CB_CG1_length=geo.CB_CG1_length
CA_CB_CG1_angle=geo.CA_CB_CG1_angle
N_CA_CB_CG1_diangle=geo.N_CA_... | python | def makeIle(segID, N, CA, C, O, geo):
'''Creates an Isoleucine residue'''
##R-group
CA_CB_length=geo.CA_CB_length
C_CA_CB_angle=geo.C_CA_CB_angle
N_C_CA_CB_diangle=geo.N_C_CA_CB_diangle
CB_CG1_length=geo.CB_CG1_length
CA_CB_CG1_angle=geo.CA_CB_CG1_angle
N_CA_CB_CG1_diangle=geo.N_CA_... | [
"def",
"makeIle",
"(",
"segID",
",",
"N",
",",
"CA",
",",
"C",
",",
"O",
",",
"geo",
")",
":",
"##R-group",
"CA_CB_length",
"=",
"geo",
".",
"CA_CB_length",
"C_CA_CB_angle",
"=",
"geo",
".",
"C_CA_CB_angle",
"N_C_CA_CB_diangle",
"=",
"geo",
".",
"N_C_CA_... | Creates an Isoleucine residue | [
"Creates",
"an",
"Isoleucine",
"residue"
] | train | https://github.com/mtien/PeptideBuilder/blob/7b1ddab5199432c1aabc371a34ec42dd386dfa6f/PeptideBuilder/PeptideBuilder.py#L218-L256 |
mtien/PeptideBuilder | PeptideBuilder/PeptideBuilder.py | makeLeu | def makeLeu(segID, N, CA, C, O, geo):
'''Creates a Leucine residue'''
##R-Group
CA_CB_length=geo.CA_CB_length
C_CA_CB_angle=geo.C_CA_CB_angle
N_C_CA_CB_diangle=geo.N_C_CA_CB_diangle
CB_CG_length=geo.CB_CG_length
CA_CB_CG_angle= geo.CA_CB_CG_angle
N_CA_CB_CG_diangle=geo.N_CA_CB_CG_diangl... | python | def makeLeu(segID, N, CA, C, O, geo):
'''Creates a Leucine residue'''
##R-Group
CA_CB_length=geo.CA_CB_length
C_CA_CB_angle=geo.C_CA_CB_angle
N_C_CA_CB_diangle=geo.N_C_CA_CB_diangle
CB_CG_length=geo.CB_CG_length
CA_CB_CG_angle= geo.CA_CB_CG_angle
N_CA_CB_CG_diangle=geo.N_CA_CB_CG_diangl... | [
"def",
"makeLeu",
"(",
"segID",
",",
"N",
",",
"CA",
",",
"C",
",",
"O",
",",
"geo",
")",
":",
"##R-Group",
"CA_CB_length",
"=",
"geo",
".",
"CA_CB_length",
"C_CA_CB_angle",
"=",
"geo",
".",
"C_CA_CB_angle",
"N_C_CA_CB_diangle",
"=",
"geo",
".",
"N_C_CA_... | Creates a Leucine residue | [
"Creates",
"a",
"Leucine",
"residue"
] | train | https://github.com/mtien/PeptideBuilder/blob/7b1ddab5199432c1aabc371a34ec42dd386dfa6f/PeptideBuilder/PeptideBuilder.py#L258-L296 |
mtien/PeptideBuilder | PeptideBuilder/PeptideBuilder.py | makeThr | def makeThr(segID, N, CA, C, O, geo):
'''Creates a Threonine residue'''
##R-Group
CA_CB_length=geo.CA_CB_length
C_CA_CB_angle=geo.C_CA_CB_angle
N_C_CA_CB_diangle=geo.N_C_CA_CB_diangle
CB_OG1_length=geo.CB_OG1_length
CA_CB_OG1_angle=geo.CA_CB_OG1_angle
N_CA_CB_OG1_diangle=geo.N_CA_CB... | python | def makeThr(segID, N, CA, C, O, geo):
'''Creates a Threonine residue'''
##R-Group
CA_CB_length=geo.CA_CB_length
C_CA_CB_angle=geo.C_CA_CB_angle
N_C_CA_CB_diangle=geo.N_C_CA_CB_diangle
CB_OG1_length=geo.CB_OG1_length
CA_CB_OG1_angle=geo.CA_CB_OG1_angle
N_CA_CB_OG1_diangle=geo.N_CA_CB... | [
"def",
"makeThr",
"(",
"segID",
",",
"N",
",",
"CA",
",",
"C",
",",
"O",
",",
"geo",
")",
":",
"##R-Group",
"CA_CB_length",
"=",
"geo",
".",
"CA_CB_length",
"C_CA_CB_angle",
"=",
"geo",
".",
"C_CA_CB_angle",
"N_C_CA_CB_diangle",
"=",
"geo",
".",
"N_C_CA_... | Creates a Threonine residue | [
"Creates",
"a",
"Threonine",
"residue"
] | train | https://github.com/mtien/PeptideBuilder/blob/7b1ddab5199432c1aabc371a34ec42dd386dfa6f/PeptideBuilder/PeptideBuilder.py#L298-L329 |
mtien/PeptideBuilder | PeptideBuilder/PeptideBuilder.py | makeArg | def makeArg(segID, N, CA, C, O, geo):
'''Creates an Arginie residue'''
##R-Group
CA_CB_length=geo.CA_CB_length
C_CA_CB_angle=geo.C_CA_CB_angle
N_C_CA_CB_diangle=geo.N_C_CA_CB_diangle
CB_CG_length=geo.CB_CG_length
CA_CB_CG_angle= geo.CA_CB_CG_angle
N_CA_CB_CG_diangle=geo.N_CA_CB_CG_diang... | python | def makeArg(segID, N, CA, C, O, geo):
'''Creates an Arginie residue'''
##R-Group
CA_CB_length=geo.CA_CB_length
C_CA_CB_angle=geo.C_CA_CB_angle
N_C_CA_CB_diangle=geo.N_C_CA_CB_diangle
CB_CG_length=geo.CB_CG_length
CA_CB_CG_angle= geo.CA_CB_CG_angle
N_CA_CB_CG_diangle=geo.N_CA_CB_CG_diang... | [
"def",
"makeArg",
"(",
"segID",
",",
"N",
",",
"CA",
",",
"C",
",",
"O",
",",
"geo",
")",
":",
"##R-Group",
"CA_CB_length",
"=",
"geo",
".",
"CA_CB_length",
"C_CA_CB_angle",
"=",
"geo",
".",
"C_CA_CB_angle",
"N_C_CA_CB_diangle",
"=",
"geo",
".",
"N_C_CA_... | Creates an Arginie residue | [
"Creates",
"an",
"Arginie",
"residue"
] | train | https://github.com/mtien/PeptideBuilder/blob/7b1ddab5199432c1aabc371a34ec42dd386dfa6f/PeptideBuilder/PeptideBuilder.py#L331-L390 |
mtien/PeptideBuilder | PeptideBuilder/PeptideBuilder.py | makeLys | def makeLys(segID, N, CA, C, O, geo):
'''Creates a Lysine residue'''
##R-Group
CA_CB_length=geo.CA_CB_length
C_CA_CB_angle=geo.C_CA_CB_angle
N_C_CA_CB_diangle=geo.N_C_CA_CB_diangle
CB_CG_length=geo.CB_CG_length
CA_CB_CG_angle=geo.CA_CB_CG_angle
N_CA_CB_CG_diangle=geo.N_CA_CB_CG_diangle
... | python | def makeLys(segID, N, CA, C, O, geo):
'''Creates a Lysine residue'''
##R-Group
CA_CB_length=geo.CA_CB_length
C_CA_CB_angle=geo.C_CA_CB_angle
N_C_CA_CB_diangle=geo.N_C_CA_CB_diangle
CB_CG_length=geo.CB_CG_length
CA_CB_CG_angle=geo.CA_CB_CG_angle
N_CA_CB_CG_diangle=geo.N_CA_CB_CG_diangle
... | [
"def",
"makeLys",
"(",
"segID",
",",
"N",
",",
"CA",
",",
"C",
",",
"O",
",",
"geo",
")",
":",
"##R-Group",
"CA_CB_length",
"=",
"geo",
".",
"CA_CB_length",
"C_CA_CB_angle",
"=",
"geo",
".",
"C_CA_CB_angle",
"N_C_CA_CB_diangle",
"=",
"geo",
".",
"N_C_CA_... | Creates a Lysine residue | [
"Creates",
"a",
"Lysine",
"residue"
] | train | https://github.com/mtien/PeptideBuilder/blob/7b1ddab5199432c1aabc371a34ec42dd386dfa6f/PeptideBuilder/PeptideBuilder.py#L392-L437 |
mtien/PeptideBuilder | PeptideBuilder/PeptideBuilder.py | makeAsp | def makeAsp(segID, N, CA, C, O, geo):
'''Creates an Aspartic Acid residue'''
##R-Group
CA_CB_length=geo.CA_CB_length
C_CA_CB_angle=geo.C_CA_CB_angle
N_C_CA_CB_diangle=geo.N_C_CA_CB_diangle
CB_CG_length=geo.CB_CG_length
CA_CB_CG_angle=geo.CA_CB_CG_angle
N_CA_CB_CG_diangle=geo.N_CA_CB_CG_... | python | def makeAsp(segID, N, CA, C, O, geo):
'''Creates an Aspartic Acid residue'''
##R-Group
CA_CB_length=geo.CA_CB_length
C_CA_CB_angle=geo.C_CA_CB_angle
N_C_CA_CB_diangle=geo.N_C_CA_CB_diangle
CB_CG_length=geo.CB_CG_length
CA_CB_CG_angle=geo.CA_CB_CG_angle
N_CA_CB_CG_diangle=geo.N_CA_CB_CG_... | [
"def",
"makeAsp",
"(",
"segID",
",",
"N",
",",
"CA",
",",
"C",
",",
"O",
",",
"geo",
")",
":",
"##R-Group",
"CA_CB_length",
"=",
"geo",
".",
"CA_CB_length",
"C_CA_CB_angle",
"=",
"geo",
".",
"C_CA_CB_angle",
"N_C_CA_CB_diangle",
"=",
"geo",
".",
"N_C_CA_... | Creates an Aspartic Acid residue | [
"Creates",
"an",
"Aspartic",
"Acid",
"residue"
] | train | https://github.com/mtien/PeptideBuilder/blob/7b1ddab5199432c1aabc371a34ec42dd386dfa6f/PeptideBuilder/PeptideBuilder.py#L439-L477 |
mtien/PeptideBuilder | PeptideBuilder/PeptideBuilder.py | makeAsn | def makeAsn(segID,N, CA, C, O, geo):
'''Creates an Asparagine residue'''
##R-Group
CA_CB_length=geo.CA_CB_length
C_CA_CB_angle=geo.C_CA_CB_angle
N_C_CA_CB_diangle=geo.N_C_CA_CB_diangle
CB_CG_length=geo.CB_CG_length
CA_CB_CG_angle=geo.CA_CB_CG_angle
N_CA_CB_CG_diangle=geo.N_CA_CB_CG_... | python | def makeAsn(segID,N, CA, C, O, geo):
'''Creates an Asparagine residue'''
##R-Group
CA_CB_length=geo.CA_CB_length
C_CA_CB_angle=geo.C_CA_CB_angle
N_C_CA_CB_diangle=geo.N_C_CA_CB_diangle
CB_CG_length=geo.CB_CG_length
CA_CB_CG_angle=geo.CA_CB_CG_angle
N_CA_CB_CG_diangle=geo.N_CA_CB_CG_... | [
"def",
"makeAsn",
"(",
"segID",
",",
"N",
",",
"CA",
",",
"C",
",",
"O",
",",
"geo",
")",
":",
"##R-Group",
"CA_CB_length",
"=",
"geo",
".",
"CA_CB_length",
"C_CA_CB_angle",
"=",
"geo",
".",
"C_CA_CB_angle",
"N_C_CA_CB_diangle",
"=",
"geo",
".",
"N_C_CA_... | Creates an Asparagine residue | [
"Creates",
"an",
"Asparagine",
"residue"
] | train | https://github.com/mtien/PeptideBuilder/blob/7b1ddab5199432c1aabc371a34ec42dd386dfa6f/PeptideBuilder/PeptideBuilder.py#L479-L517 |
mtien/PeptideBuilder | PeptideBuilder/PeptideBuilder.py | makeGlu | def makeGlu(segID, N, CA, C, O, geo):
'''Creates a Glutamic Acid residue'''
##R-Group
CA_CB_length=geo.CA_CB_length
C_CA_CB_angle = geo.C_CA_CB_angle
N_C_CA_CB_diangle=geo.N_C_CA_CB_diangle
CB_CG_length=geo.CB_CG_length
CA_CB_CG_angle=geo.CA_CB_CG_angle
N_CA_CB_CG_diangle=geo.N_CA_C... | python | def makeGlu(segID, N, CA, C, O, geo):
'''Creates a Glutamic Acid residue'''
##R-Group
CA_CB_length=geo.CA_CB_length
C_CA_CB_angle = geo.C_CA_CB_angle
N_C_CA_CB_diangle=geo.N_C_CA_CB_diangle
CB_CG_length=geo.CB_CG_length
CA_CB_CG_angle=geo.CA_CB_CG_angle
N_CA_CB_CG_diangle=geo.N_CA_C... | [
"def",
"makeGlu",
"(",
"segID",
",",
"N",
",",
"CA",
",",
"C",
",",
"O",
",",
"geo",
")",
":",
"##R-Group",
"CA_CB_length",
"=",
"geo",
".",
"CA_CB_length",
"C_CA_CB_angle",
"=",
"geo",
".",
"C_CA_CB_angle",
"N_C_CA_CB_diangle",
"=",
"geo",
".",
"N_C_CA_... | Creates a Glutamic Acid residue | [
"Creates",
"a",
"Glutamic",
"Acid",
"residue"
] | train | https://github.com/mtien/PeptideBuilder/blob/7b1ddab5199432c1aabc371a34ec42dd386dfa6f/PeptideBuilder/PeptideBuilder.py#L519-L565 |
mtien/PeptideBuilder | PeptideBuilder/PeptideBuilder.py | makeGln | def makeGln(segID, N, CA, C, O, geo):
'''Creates a Glutamine residue'''
##R-Group
CA_CB_length=geo.CA_CB_length
C_CA_CB_angle=geo.C_CA_CB_angle
N_C_CA_CB_diangle=geo.N_C_CA_CB_diangle
CB_CG_length=geo.CB_CG_length
CA_CB_CG_angle=geo.CA_CB_CG_angle
N_CA_CB_CG_diangle=geo.N_CA_CB_CG_d... | python | def makeGln(segID, N, CA, C, O, geo):
'''Creates a Glutamine residue'''
##R-Group
CA_CB_length=geo.CA_CB_length
C_CA_CB_angle=geo.C_CA_CB_angle
N_C_CA_CB_diangle=geo.N_C_CA_CB_diangle
CB_CG_length=geo.CB_CG_length
CA_CB_CG_angle=geo.CA_CB_CG_angle
N_CA_CB_CG_diangle=geo.N_CA_CB_CG_d... | [
"def",
"makeGln",
"(",
"segID",
",",
"N",
",",
"CA",
",",
"C",
",",
"O",
",",
"geo",
")",
":",
"##R-Group",
"CA_CB_length",
"=",
"geo",
".",
"CA_CB_length",
"C_CA_CB_angle",
"=",
"geo",
".",
"C_CA_CB_angle",
"N_C_CA_CB_diangle",
"=",
"geo",
".",
"N_C_CA_... | Creates a Glutamine residue | [
"Creates",
"a",
"Glutamine",
"residue"
] | train | https://github.com/mtien/PeptideBuilder/blob/7b1ddab5199432c1aabc371a34ec42dd386dfa6f/PeptideBuilder/PeptideBuilder.py#L567-L614 |
mtien/PeptideBuilder | PeptideBuilder/PeptideBuilder.py | makeMet | def makeMet(segID, N, CA, C, O, geo):
'''Creates a Methionine residue'''
##R-Group
CA_CB_length=geo.CA_CB_length
C_CA_CB_angle=geo.C_CA_CB_angle
N_C_CA_CB_diangle=geo.N_C_CA_CB_diangle
CB_CG_length=geo.CB_CG_length
CA_CB_CG_angle=geo.CA_CB_CG_angle
N_CA_CB_CG_diangle=geo.N_CA_CB_CG_dian... | python | def makeMet(segID, N, CA, C, O, geo):
'''Creates a Methionine residue'''
##R-Group
CA_CB_length=geo.CA_CB_length
C_CA_CB_angle=geo.C_CA_CB_angle
N_C_CA_CB_diangle=geo.N_C_CA_CB_diangle
CB_CG_length=geo.CB_CG_length
CA_CB_CG_angle=geo.CA_CB_CG_angle
N_CA_CB_CG_diangle=geo.N_CA_CB_CG_dian... | [
"def",
"makeMet",
"(",
"segID",
",",
"N",
",",
"CA",
",",
"C",
",",
"O",
",",
"geo",
")",
":",
"##R-Group",
"CA_CB_length",
"=",
"geo",
".",
"CA_CB_length",
"C_CA_CB_angle",
"=",
"geo",
".",
"C_CA_CB_angle",
"N_C_CA_CB_diangle",
"=",
"geo",
".",
"N_C_CA_... | Creates a Methionine residue | [
"Creates",
"a",
"Methionine",
"residue"
] | train | https://github.com/mtien/PeptideBuilder/blob/7b1ddab5199432c1aabc371a34ec42dd386dfa6f/PeptideBuilder/PeptideBuilder.py#L616-L654 |
mtien/PeptideBuilder | PeptideBuilder/PeptideBuilder.py | makeHis | def makeHis(segID, N, CA, C, O, geo):
'''Creates a Histidine residue'''
##R-Group
CA_CB_length=geo.CA_CB_length
C_CA_CB_angle=geo.C_CA_CB_angle
N_C_CA_CB_diangle=geo.N_C_CA_CB_diangle
CB_CG_length=geo.CB_CG_length
CA_CB_CG_angle=geo.CA_CB_CG_angle
N_CA_CB_CG_diangle=geo.N_CA_CB_CG_diang... | python | def makeHis(segID, N, CA, C, O, geo):
'''Creates a Histidine residue'''
##R-Group
CA_CB_length=geo.CA_CB_length
C_CA_CB_angle=geo.C_CA_CB_angle
N_C_CA_CB_diangle=geo.N_C_CA_CB_diangle
CB_CG_length=geo.CB_CG_length
CA_CB_CG_angle=geo.CA_CB_CG_angle
N_CA_CB_CG_diangle=geo.N_CA_CB_CG_diang... | [
"def",
"makeHis",
"(",
"segID",
",",
"N",
",",
"CA",
",",
"C",
",",
"O",
",",
"geo",
")",
":",
"##R-Group",
"CA_CB_length",
"=",
"geo",
".",
"CA_CB_length",
"C_CA_CB_angle",
"=",
"geo",
".",
"C_CA_CB_angle",
"N_C_CA_CB_diangle",
"=",
"geo",
".",
"N_C_CA_... | Creates a Histidine residue | [
"Creates",
"a",
"Histidine",
"residue"
] | train | https://github.com/mtien/PeptideBuilder/blob/7b1ddab5199432c1aabc371a34ec42dd386dfa6f/PeptideBuilder/PeptideBuilder.py#L656-L708 |
mtien/PeptideBuilder | PeptideBuilder/PeptideBuilder.py | makePro | def makePro(segID, N, CA, C, O, geo):
'''Creates a Proline residue'''
##R-Group
CA_CB_length=geo.CA_CB_length
C_CA_CB_angle=geo.C_CA_CB_angle
N_C_CA_CB_diangle=geo.N_C_CA_CB_diangle
CB_CG_length=geo.CB_CG_length
CA_CB_CG_angle=geo.CA_CB_CG_angle
N_CA_CB_CG_diangle=geo.N_CA_CB_CG_dia... | python | def makePro(segID, N, CA, C, O, geo):
'''Creates a Proline residue'''
##R-Group
CA_CB_length=geo.CA_CB_length
C_CA_CB_angle=geo.C_CA_CB_angle
N_C_CA_CB_diangle=geo.N_C_CA_CB_diangle
CB_CG_length=geo.CB_CG_length
CA_CB_CG_angle=geo.CA_CB_CG_angle
N_CA_CB_CG_diangle=geo.N_CA_CB_CG_dia... | [
"def",
"makePro",
"(",
"segID",
",",
"N",
",",
"CA",
",",
"C",
",",
"O",
",",
"geo",
")",
":",
"##R-Group",
"CA_CB_length",
"=",
"geo",
".",
"CA_CB_length",
"C_CA_CB_angle",
"=",
"geo",
".",
"C_CA_CB_angle",
"N_C_CA_CB_diangle",
"=",
"geo",
".",
"N_C_CA_... | Creates a Proline residue | [
"Creates",
"a",
"Proline",
"residue"
] | train | https://github.com/mtien/PeptideBuilder/blob/7b1ddab5199432c1aabc371a34ec42dd386dfa6f/PeptideBuilder/PeptideBuilder.py#L710-L743 |
mtien/PeptideBuilder | PeptideBuilder/PeptideBuilder.py | makePhe | def makePhe(segID, N, CA, C, O, geo):
'''Creates a Phenylalanine residue'''
##R-Group
CA_CB_length=geo.CA_CB_length
C_CA_CB_angle=geo.C_CA_CB_angle
N_C_CA_CB_diangle=geo.N_C_CA_CB_diangle
CB_CG_length=geo.CB_CG_length
CA_CB_CG_angle=geo.CA_CB_CG_angle
N_CA_CB_CG_diangle=geo.N_CA_CB_... | python | def makePhe(segID, N, CA, C, O, geo):
'''Creates a Phenylalanine residue'''
##R-Group
CA_CB_length=geo.CA_CB_length
C_CA_CB_angle=geo.C_CA_CB_angle
N_C_CA_CB_diangle=geo.N_C_CA_CB_diangle
CB_CG_length=geo.CB_CG_length
CA_CB_CG_angle=geo.CA_CB_CG_angle
N_CA_CB_CG_diangle=geo.N_CA_CB_... | [
"def",
"makePhe",
"(",
"segID",
",",
"N",
",",
"CA",
",",
"C",
",",
"O",
",",
"geo",
")",
":",
"##R-Group",
"CA_CB_length",
"=",
"geo",
".",
"CA_CB_length",
"C_CA_CB_angle",
"=",
"geo",
".",
"C_CA_CB_angle",
"N_C_CA_CB_diangle",
"=",
"geo",
".",
"N_C_CA_... | Creates a Phenylalanine residue | [
"Creates",
"a",
"Phenylalanine",
"residue"
] | train | https://github.com/mtien/PeptideBuilder/blob/7b1ddab5199432c1aabc371a34ec42dd386dfa6f/PeptideBuilder/PeptideBuilder.py#L745-L804 |
mtien/PeptideBuilder | PeptideBuilder/PeptideBuilder.py | makeTrp | def makeTrp(segID, N, CA, C, O, geo):
'''Creates a Tryptophan residue'''
##R-Group
CA_CB_length=geo.CA_CB_length
C_CA_CB_angle=geo.C_CA_CB_angle
N_C_CA_CB_diangle=geo.N_C_CA_CB_diangle
CB_CG_length=geo.CB_CG_length
CA_CB_CG_angle=geo.CA_CB_CG_angle
N_CA_CB_CG_diangle=geo.N_CA_CB_CG_dian... | python | def makeTrp(segID, N, CA, C, O, geo):
'''Creates a Tryptophan residue'''
##R-Group
CA_CB_length=geo.CA_CB_length
C_CA_CB_angle=geo.C_CA_CB_angle
N_C_CA_CB_diangle=geo.N_C_CA_CB_diangle
CB_CG_length=geo.CB_CG_length
CA_CB_CG_angle=geo.CA_CB_CG_angle
N_CA_CB_CG_diangle=geo.N_CA_CB_CG_dian... | [
"def",
"makeTrp",
"(",
"segID",
",",
"N",
",",
"CA",
",",
"C",
",",
"O",
",",
"geo",
")",
":",
"##R-Group",
"CA_CB_length",
"=",
"geo",
".",
"CA_CB_length",
"C_CA_CB_angle",
"=",
"geo",
".",
"C_CA_CB_angle",
"N_C_CA_CB_diangle",
"=",
"geo",
".",
"N_C_CA_... | Creates a Tryptophan residue | [
"Creates",
"a",
"Tryptophan",
"residue"
] | train | https://github.com/mtien/PeptideBuilder/blob/7b1ddab5199432c1aabc371a34ec42dd386dfa6f/PeptideBuilder/PeptideBuilder.py#L874-L960 |
mtien/PeptideBuilder | PeptideBuilder/PeptideBuilder.py | initialize_res | def initialize_res(residue):
'''Creates a new structure containing a single amino acid. The type and
geometry of the amino acid are determined by the argument, which has to be
either a geometry object or a single-letter amino acid code.
The amino acid will be placed into chain A of model 0.'''
... | python | def initialize_res(residue):
'''Creates a new structure containing a single amino acid. The type and
geometry of the amino acid are determined by the argument, which has to be
either a geometry object or a single-letter amino acid code.
The amino acid will be placed into chain A of model 0.'''
... | [
"def",
"initialize_res",
"(",
"residue",
")",
":",
"if",
"isinstance",
"(",
"residue",
",",
"Geo",
")",
":",
"geo",
"=",
"residue",
"else",
":",
"geo",
"=",
"geometry",
"(",
"residue",
")",
"segID",
"=",
"1",
"AA",
"=",
"geo",
".",
"residue_name",
"C... | Creates a new structure containing a single amino acid. The type and
geometry of the amino acid are determined by the argument, which has to be
either a geometry object or a single-letter amino acid code.
The amino acid will be placed into chain A of model 0. | [
"Creates",
"a",
"new",
"structure",
"containing",
"a",
"single",
"amino",
"acid",
".",
"The",
"type",
"and",
"geometry",
"of",
"the",
"amino",
"acid",
"are",
"determined",
"by",
"the",
"argument",
"which",
"has",
"to",
"be",
"either",
"a",
"geometry",
"obj... | train | https://github.com/mtien/PeptideBuilder/blob/7b1ddab5199432c1aabc371a34ec42dd386dfa6f/PeptideBuilder/PeptideBuilder.py#L962-L1046 |
mtien/PeptideBuilder | PeptideBuilder/PeptideBuilder.py | add_residue_from_geo | def add_residue_from_geo(structure, geo):
'''Adds a residue to chain A model 0 of the given structure, and
returns the new structure. The residue to be added is determined by
the geometry object given as second argument.
This function is a helper function and should not normally be called
direc... | python | def add_residue_from_geo(structure, geo):
'''Adds a residue to chain A model 0 of the given structure, and
returns the new structure. The residue to be added is determined by
the geometry object given as second argument.
This function is a helper function and should not normally be called
direc... | [
"def",
"add_residue_from_geo",
"(",
"structure",
",",
"geo",
")",
":",
"resRef",
"=",
"getReferenceResidue",
"(",
"structure",
")",
"AA",
"=",
"geo",
".",
"residue_name",
"segID",
"=",
"resRef",
".",
"get_id",
"(",
")",
"[",
"1",
"]",
"segID",
"+=",
"1",... | Adds a residue to chain A model 0 of the given structure, and
returns the new structure. The residue to be added is determined by
the geometry object given as second argument.
This function is a helper function and should not normally be called
directly. Call add_residue() instead. | [
"Adds",
"a",
"residue",
"to",
"chain",
"A",
"model",
"0",
"of",
"the",
"given",
"structure",
"and",
"returns",
"the",
"new",
"structure",
".",
"The",
"residue",
"to",
"be",
"added",
"is",
"determined",
"by",
"the",
"geometry",
"object",
"given",
"as",
"s... | train | https://github.com/mtien/PeptideBuilder/blob/7b1ddab5199432c1aabc371a34ec42dd386dfa6f/PeptideBuilder/PeptideBuilder.py#L1066-L1157 |
mtien/PeptideBuilder | PeptideBuilder/PeptideBuilder.py | make_extended_structure | def make_extended_structure(AA_chain):
'''Place a sequence of amino acids into a peptide in the extended
conformation. The argument AA_chain holds the sequence of amino
acids to be used.'''
geo = geometry(AA_chain[0])
struc=initialize_res(geo)
for i in range(1,len(AA_chain)):
AA = ... | python | def make_extended_structure(AA_chain):
'''Place a sequence of amino acids into a peptide in the extended
conformation. The argument AA_chain holds the sequence of amino
acids to be used.'''
geo = geometry(AA_chain[0])
struc=initialize_res(geo)
for i in range(1,len(AA_chain)):
AA = ... | [
"def",
"make_extended_structure",
"(",
"AA_chain",
")",
":",
"geo",
"=",
"geometry",
"(",
"AA_chain",
"[",
"0",
"]",
")",
"struc",
"=",
"initialize_res",
"(",
"geo",
")",
"for",
"i",
"in",
"range",
"(",
"1",
",",
"len",
"(",
"AA_chain",
")",
")",
":"... | Place a sequence of amino acids into a peptide in the extended
conformation. The argument AA_chain holds the sequence of amino
acids to be used. | [
"Place",
"a",
"sequence",
"of",
"amino",
"acids",
"into",
"a",
"peptide",
"in",
"the",
"extended",
"conformation",
".",
"The",
"argument",
"AA_chain",
"holds",
"the",
"sequence",
"of",
"amino",
"acids",
"to",
"be",
"used",
"."
] | train | https://github.com/mtien/PeptideBuilder/blob/7b1ddab5199432c1aabc371a34ec42dd386dfa6f/PeptideBuilder/PeptideBuilder.py#L1160-L1172 |
mtien/PeptideBuilder | PeptideBuilder/PeptideBuilder.py | add_residue | def add_residue(structure, residue, phi=-120, psi_im1=140, omega=-370):
'''Adds a residue to chain A model 0 of the given structure, and
returns the new structure. The residue to be added can be specified
in two ways: either as a geometry object (in which case
the remaining arguments phi, psi_im1, and o... | python | def add_residue(structure, residue, phi=-120, psi_im1=140, omega=-370):
'''Adds a residue to chain A model 0 of the given structure, and
returns the new structure. The residue to be added can be specified
in two ways: either as a geometry object (in which case
the remaining arguments phi, psi_im1, and o... | [
"def",
"add_residue",
"(",
"structure",
",",
"residue",
",",
"phi",
"=",
"-",
"120",
",",
"psi_im1",
"=",
"140",
",",
"omega",
"=",
"-",
"370",
")",
":",
"if",
"isinstance",
"(",
"residue",
",",
"Geo",
")",
":",
"geo",
"=",
"residue",
"else",
":",
... | Adds a residue to chain A model 0 of the given structure, and
returns the new structure. The residue to be added can be specified
in two ways: either as a geometry object (in which case
the remaining arguments phi, psi_im1, and omega are ignored) or as a
single-letter amino-acid code. In the latter case... | [
"Adds",
"a",
"residue",
"to",
"chain",
"A",
"model",
"0",
"of",
"the",
"given",
"structure",
"and",
"returns",
"the",
"new",
"structure",
".",
"The",
"residue",
"to",
"be",
"added",
"can",
"be",
"specified",
"in",
"two",
"ways",
":",
"either",
"as",
"a... | train | https://github.com/mtien/PeptideBuilder/blob/7b1ddab5199432c1aabc371a34ec42dd386dfa6f/PeptideBuilder/PeptideBuilder.py#L1175-L1197 |
mtien/PeptideBuilder | PeptideBuilder/PeptideBuilder.py | make_structure | def make_structure(AA_chain,phi,psi_im1,omega=[]):
'''Place a sequence of amino acids into a peptide with specified
backbone dihedral angles. The argument AA_chain holds the
sequence of amino acids to be used. The arguments phi and psi_im1 hold
lists of backbone angles, one for each amino acid, *startin... | python | def make_structure(AA_chain,phi,psi_im1,omega=[]):
'''Place a sequence of amino acids into a peptide with specified
backbone dihedral angles. The argument AA_chain holds the
sequence of amino acids to be used. The arguments phi and psi_im1 hold
lists of backbone angles, one for each amino acid, *startin... | [
"def",
"make_structure",
"(",
"AA_chain",
",",
"phi",
",",
"psi_im1",
",",
"omega",
"=",
"[",
"]",
")",
":",
"geo",
"=",
"geometry",
"(",
"AA_chain",
"[",
"0",
"]",
")",
"struc",
"=",
"initialize_res",
"(",
"geo",
")",
"if",
"len",
"(",
"omega",
")... | Place a sequence of amino acids into a peptide with specified
backbone dihedral angles. The argument AA_chain holds the
sequence of amino acids to be used. The arguments phi and psi_im1 hold
lists of backbone angles, one for each amino acid, *starting from
the second amino acid in the chain*. The argume... | [
"Place",
"a",
"sequence",
"of",
"amino",
"acids",
"into",
"a",
"peptide",
"with",
"specified",
"backbone",
"dihedral",
"angles",
".",
"The",
"argument",
"AA_chain",
"holds",
"the",
"sequence",
"of",
"amino",
"acids",
"to",
"be",
"used",
".",
"The",
"argument... | train | https://github.com/mtien/PeptideBuilder/blob/7b1ddab5199432c1aabc371a34ec42dd386dfa6f/PeptideBuilder/PeptideBuilder.py#L1201-L1221 |
mtien/PeptideBuilder | PeptideBuilder/PeptideBuilder.py | make_structure_from_geos | def make_structure_from_geos(geos):
'''Creates a structure out of a list of geometry objects.'''
model_structure=initialize_res(geos[0])
for i in range(1,len(geos)):
model_structure=add_residue(model_structure, geos[i])
return model_structure | python | def make_structure_from_geos(geos):
'''Creates a structure out of a list of geometry objects.'''
model_structure=initialize_res(geos[0])
for i in range(1,len(geos)):
model_structure=add_residue(model_structure, geos[i])
return model_structure | [
"def",
"make_structure_from_geos",
"(",
"geos",
")",
":",
"model_structure",
"=",
"initialize_res",
"(",
"geos",
"[",
"0",
"]",
")",
"for",
"i",
"in",
"range",
"(",
"1",
",",
"len",
"(",
"geos",
")",
")",
":",
"model_structure",
"=",
"add_residue",
"(",
... | Creates a structure out of a list of geometry objects. | [
"Creates",
"a",
"structure",
"out",
"of",
"a",
"list",
"of",
"geometry",
"objects",
"."
] | train | https://github.com/mtien/PeptideBuilder/blob/7b1ddab5199432c1aabc371a34ec42dd386dfa6f/PeptideBuilder/PeptideBuilder.py#L1224-L1230 |
mtien/PeptideBuilder | PeptideBuilder/Geometry.py | geometry | def geometry(AA):
'''Generates the geometry of the requested amino acid.
The amino acid needs to be specified by its single-letter
code. If an invalid code is specified, the function
returns the geometry of Glycine.'''
if(AA=='G'):
return GlyGeo()
elif(AA=='A'):
return AlaGeo()
... | python | def geometry(AA):
'''Generates the geometry of the requested amino acid.
The amino acid needs to be specified by its single-letter
code. If an invalid code is specified, the function
returns the geometry of Glycine.'''
if(AA=='G'):
return GlyGeo()
elif(AA=='A'):
return AlaGeo()
... | [
"def",
"geometry",
"(",
"AA",
")",
":",
"if",
"(",
"AA",
"==",
"'G'",
")",
":",
"return",
"GlyGeo",
"(",
")",
"elif",
"(",
"AA",
"==",
"'A'",
")",
":",
"return",
"AlaGeo",
"(",
")",
"elif",
"(",
"AA",
"==",
"'S'",
")",
":",
"return",
"SerGeo",
... | Generates the geometry of the requested amino acid.
The amino acid needs to be specified by its single-letter
code. If an invalid code is specified, the function
returns the geometry of Glycine. | [
"Generates",
"the",
"geometry",
"of",
"the",
"requested",
"amino",
"acid",
".",
"The",
"amino",
"acid",
"needs",
"to",
"be",
"specified",
"by",
"its",
"single",
"-",
"letter",
"code",
".",
"If",
"an",
"invalid",
"code",
"is",
"specified",
"the",
"function"... | train | https://github.com/mtien/PeptideBuilder/blob/7b1ddab5199432c1aabc371a34ec42dd386dfa6f/PeptideBuilder/Geometry.py#L1046-L1092 |
twisted/vertex | vertex/q2qclient.py | enregister | def enregister(svc, newAddress, password):
"""
Register a new account and return a Deferred that fires if it worked.
@param svc: a Q2QService
@param newAddress: a Q2QAddress object
@param password: a shared secret (str)
"""
return svc.connectQ2Q(q2q.Q2QAddress("",""),
... | python | def enregister(svc, newAddress, password):
"""
Register a new account and return a Deferred that fires if it worked.
@param svc: a Q2QService
@param newAddress: a Q2QAddress object
@param password: a shared secret (str)
"""
return svc.connectQ2Q(q2q.Q2QAddress("",""),
... | [
"def",
"enregister",
"(",
"svc",
",",
"newAddress",
",",
"password",
")",
":",
"return",
"svc",
".",
"connectQ2Q",
"(",
"q2q",
".",
"Q2QAddress",
"(",
"\"\"",
",",
"\"\"",
")",
",",
"q2q",
".",
"Q2QAddress",
"(",
"newAddress",
".",
"domain",
",",
"\"ac... | Register a new account and return a Deferred that fires if it worked.
@param svc: a Q2QService
@param newAddress: a Q2QAddress object
@param password: a shared secret (str) | [
"Register",
"a",
"new",
"account",
"and",
"return",
"a",
"Deferred",
"that",
"fires",
"if",
"it",
"worked",
"."
] | train | https://github.com/twisted/vertex/blob/feb591aa1b9a3b2b8fdcf53e4962dad2a0bc38ca/vertex/q2qclient.py#L321-L343 |
twisted/vertex | vertex/conncache.py | ConnectionCache.connectCached | def connectCached(self, endpoint, protocolFactory,
extraWork=lambda x: x,
extraHash=None):
"""
See module docstring
@param endpoint:
@param protocolFactory:
@param extraWork:
@param extraHash:
@return: the D
""... | python | def connectCached(self, endpoint, protocolFactory,
extraWork=lambda x: x,
extraHash=None):
"""
See module docstring
@param endpoint:
@param protocolFactory:
@param extraWork:
@param extraHash:
@return: the D
""... | [
"def",
"connectCached",
"(",
"self",
",",
"endpoint",
",",
"protocolFactory",
",",
"extraWork",
"=",
"lambda",
"x",
":",
"x",
",",
"extraHash",
"=",
"None",
")",
":",
"key",
"=",
"endpoint",
",",
"extraHash",
"D",
"=",
"Deferred",
"(",
")",
"if",
"key"... | See module docstring
@param endpoint:
@param protocolFactory:
@param extraWork:
@param extraHash:
@return: the D | [
"See",
"module",
"docstring"
] | train | https://github.com/twisted/vertex/blob/feb591aa1b9a3b2b8fdcf53e4962dad2a0bc38ca/vertex/conncache.py#L44-L69 |
twisted/vertex | vertex/conncache.py | ConnectionCache.connectionLostForKey | def connectionLostForKey(self, key):
"""
Remove lost connection from cache.
@param key: key of connection that was lost
@type key: L{tuple} of L{IAddress} and C{extraHash}
"""
if key in self.cachedConnections:
del self.cachedConnections[key]
if self._... | python | def connectionLostForKey(self, key):
"""
Remove lost connection from cache.
@param key: key of connection that was lost
@type key: L{tuple} of L{IAddress} and C{extraHash}
"""
if key in self.cachedConnections:
del self.cachedConnections[key]
if self._... | [
"def",
"connectionLostForKey",
"(",
"self",
",",
"key",
")",
":",
"if",
"key",
"in",
"self",
".",
"cachedConnections",
":",
"del",
"self",
".",
"cachedConnections",
"[",
"key",
"]",
"if",
"self",
".",
"_shuttingDown",
"and",
"self",
".",
"_shuttingDown",
"... | Remove lost connection from cache.
@param key: key of connection that was lost
@type key: L{tuple} of L{IAddress} and C{extraHash} | [
"Remove",
"lost",
"connection",
"from",
"cache",
"."
] | train | https://github.com/twisted/vertex/blob/feb591aa1b9a3b2b8fdcf53e4962dad2a0bc38ca/vertex/conncache.py#L83-L94 |
twisted/vertex | vertex/conncache.py | ConnectionCache.shutdown | def shutdown(self):
"""
Disconnect all cached connections.
@returns: a deferred that fires once all connection are disconnected.
@rtype: L{Deferred}
"""
self._shuttingDown = {key: Deferred()
for key in self.cachedConnections.keys()}
... | python | def shutdown(self):
"""
Disconnect all cached connections.
@returns: a deferred that fires once all connection are disconnected.
@rtype: L{Deferred}
"""
self._shuttingDown = {key: Deferred()
for key in self.cachedConnections.keys()}
... | [
"def",
"shutdown",
"(",
"self",
")",
":",
"self",
".",
"_shuttingDown",
"=",
"{",
"key",
":",
"Deferred",
"(",
")",
"for",
"key",
"in",
"self",
".",
"cachedConnections",
".",
"keys",
"(",
")",
"}",
"return",
"DeferredList",
"(",
"[",
"maybeDeferred",
"... | Disconnect all cached connections.
@returns: a deferred that fires once all connection are disconnected.
@rtype: L{Deferred} | [
"Disconnect",
"all",
"cached",
"connections",
"."
] | train | https://github.com/twisted/vertex/blob/feb591aa1b9a3b2b8fdcf53e4962dad2a0bc38ca/vertex/conncache.py#L103-L115 |
mikeboers/Flask-ACL | flask_acl/state.py | parse_state | def parse_state(state):
"""Convert a bool, or string, into a bool.
The string pairs we respond to (case insensitively) are:
- ALLOW & DENY
- GRANT & REJECT
:returns bool: ``True`` or ``False``.
:raises ValueError: when not a ``bool`` or one of the above strings.
E.g.::
>>> p... | python | def parse_state(state):
"""Convert a bool, or string, into a bool.
The string pairs we respond to (case insensitively) are:
- ALLOW & DENY
- GRANT & REJECT
:returns bool: ``True`` or ``False``.
:raises ValueError: when not a ``bool`` or one of the above strings.
E.g.::
>>> p... | [
"def",
"parse_state",
"(",
"state",
")",
":",
"if",
"isinstance",
"(",
"state",
",",
"bool",
")",
":",
"return",
"state",
"if",
"not",
"isinstance",
"(",
"state",
",",
"basestring",
")",
":",
"raise",
"TypeError",
"(",
"'ACL state must be bool or string'",
"... | Convert a bool, or string, into a bool.
The string pairs we respond to (case insensitively) are:
- ALLOW & DENY
- GRANT & REJECT
:returns bool: ``True`` or ``False``.
:raises ValueError: when not a ``bool`` or one of the above strings.
E.g.::
>>> parse_state('Allow')
Tru... | [
"Convert",
"a",
"bool",
"or",
"string",
"into",
"a",
"bool",
"."
] | train | https://github.com/mikeboers/Flask-ACL/blob/7339b89f96ad8686d1526e25c138244ad912e12d/flask_acl/state.py#L7-L31 |
Yelp/pyramid_zipkin | pyramid_zipkin/tween.py | _getattr_path | def _getattr_path(obj, path):
"""
getattr for a dot separated path
If an AttributeError is raised, it will return None.
"""
if not path:
return None
for attr in path.split('.'):
obj = getattr(obj, attr, None)
return obj | python | def _getattr_path(obj, path):
"""
getattr for a dot separated path
If an AttributeError is raised, it will return None.
"""
if not path:
return None
for attr in path.split('.'):
obj = getattr(obj, attr, None)
return obj | [
"def",
"_getattr_path",
"(",
"obj",
",",
"path",
")",
":",
"if",
"not",
"path",
":",
"return",
"None",
"for",
"attr",
"in",
"path",
".",
"split",
"(",
"'.'",
")",
":",
"obj",
"=",
"getattr",
"(",
"obj",
",",
"attr",
",",
"None",
")",
"return",
"o... | getattr for a dot separated path
If an AttributeError is raised, it will return None. | [
"getattr",
"for",
"a",
"dot",
"separated",
"path"
] | train | https://github.com/Yelp/pyramid_zipkin/blob/ed8581b4466e9ce93d6cf3ecfbdde5369932a80b/pyramid_zipkin/tween.py#L16-L27 |
Yelp/pyramid_zipkin | pyramid_zipkin/tween.py | _get_settings_from_request | def _get_settings_from_request(request):
"""Extracts Zipkin attributes and configuration from request attributes.
See the `zipkin_span` context in py-zipkin for more detaied information on
all the settings.
Here are the supported Pyramid registry settings:
zipkin.create_zipkin_attr: allows the ser... | python | def _get_settings_from_request(request):
"""Extracts Zipkin attributes and configuration from request attributes.
See the `zipkin_span` context in py-zipkin for more detaied information on
all the settings.
Here are the supported Pyramid registry settings:
zipkin.create_zipkin_attr: allows the ser... | [
"def",
"_get_settings_from_request",
"(",
"request",
")",
":",
"settings",
"=",
"request",
".",
"registry",
".",
"settings",
"# Creates zipkin_attrs and attaches a zipkin_trace_id attr to the request",
"if",
"'zipkin.create_zipkin_attr'",
"in",
"settings",
":",
"zipkin_attrs",
... | Extracts Zipkin attributes and configuration from request attributes.
See the `zipkin_span` context in py-zipkin for more detaied information on
all the settings.
Here are the supported Pyramid registry settings:
zipkin.create_zipkin_attr: allows the service to override the creation of
Zipkin ... | [
"Extracts",
"Zipkin",
"attributes",
"and",
"configuration",
"from",
"request",
"attributes",
".",
"See",
"the",
"zipkin_span",
"context",
"in",
"py",
"-",
"zipkin",
"for",
"more",
"detaied",
"information",
"on",
"all",
"the",
"settings",
"."
] | train | https://github.com/Yelp/pyramid_zipkin/blob/ed8581b4466e9ce93d6cf3ecfbdde5369932a80b/pyramid_zipkin/tween.py#L48-L140 |
Yelp/pyramid_zipkin | pyramid_zipkin/tween.py | zipkin_tween | def zipkin_tween(handler, registry):
"""
Factory for pyramid tween to handle zipkin server logging. Note that even
if the request isn't sampled, Zipkin attributes are generated and pushed
into threadlocal storage, so `create_http_headers_for_new_span` and
`zipkin_span` will have access to the proper... | python | def zipkin_tween(handler, registry):
"""
Factory for pyramid tween to handle zipkin server logging. Note that even
if the request isn't sampled, Zipkin attributes are generated and pushed
into threadlocal storage, so `create_http_headers_for_new_span` and
`zipkin_span` will have access to the proper... | [
"def",
"zipkin_tween",
"(",
"handler",
",",
"registry",
")",
":",
"def",
"tween",
"(",
"request",
")",
":",
"zipkin_settings",
"=",
"_get_settings_from_request",
"(",
"request",
")",
"tracer",
"=",
"get_default_tracer",
"(",
")",
"tween_kwargs",
"=",
"dict",
"... | Factory for pyramid tween to handle zipkin server logging. Note that even
if the request isn't sampled, Zipkin attributes are generated and pushed
into threadlocal storage, so `create_http_headers_for_new_span` and
`zipkin_span` will have access to the proper Zipkin state.
Consumes custom create_zipkin... | [
"Factory",
"for",
"pyramid",
"tween",
"to",
"handle",
"zipkin",
"server",
"logging",
".",
"Note",
"that",
"even",
"if",
"the",
"request",
"isn",
"t",
"sampled",
"Zipkin",
"attributes",
"are",
"generated",
"and",
"pushed",
"into",
"threadlocal",
"storage",
"so"... | train | https://github.com/Yelp/pyramid_zipkin/blob/ed8581b4466e9ce93d6cf3ecfbdde5369932a80b/pyramid_zipkin/tween.py#L143-L196 |
MycroftAI/mycroft-skills-manager | msm/skill_repo.py | SkillRepo.get_skill_data | def get_skill_data(self):
""" generates tuples of name, path, url, sha """
path_to_sha = {
folder: sha for folder, sha in self.get_shas()
}
modules = self.read_file('.gitmodules').split('[submodule "')
for i, module in enumerate(modules):
if not module:
... | python | def get_skill_data(self):
""" generates tuples of name, path, url, sha """
path_to_sha = {
folder: sha for folder, sha in self.get_shas()
}
modules = self.read_file('.gitmodules').split('[submodule "')
for i, module in enumerate(modules):
if not module:
... | [
"def",
"get_skill_data",
"(",
"self",
")",
":",
"path_to_sha",
"=",
"{",
"folder",
":",
"sha",
"for",
"folder",
",",
"sha",
"in",
"self",
".",
"get_shas",
"(",
")",
"}",
"modules",
"=",
"self",
".",
"read_file",
"(",
"'.gitmodules'",
")",
".",
"split",... | generates tuples of name, path, url, sha | [
"generates",
"tuples",
"of",
"name",
"path",
"url",
"sha"
] | train | https://github.com/MycroftAI/mycroft-skills-manager/blob/5acef240de42e8ceae2e82bc7492ffee33288b00/msm/skill_repo.py#L95-L113 |
twisted/vertex | vertex/tcpdfa.py | TCP.expectAck | def expectAck(self):
"""
When the most recent packet produced as an output of this state machine
is acknowledged by our peer, generate a single 'ack' input.
"""
last = self.lastTransmitted
self.ackPredicate = lambda ackPacket: (
ackPacket.relativeAck() >= last... | python | def expectAck(self):
"""
When the most recent packet produced as an output of this state machine
is acknowledged by our peer, generate a single 'ack' input.
"""
last = self.lastTransmitted
self.ackPredicate = lambda ackPacket: (
ackPacket.relativeAck() >= last... | [
"def",
"expectAck",
"(",
"self",
")",
":",
"last",
"=",
"self",
".",
"lastTransmitted",
"self",
".",
"ackPredicate",
"=",
"lambda",
"ackPacket",
":",
"(",
"ackPacket",
".",
"relativeAck",
"(",
")",
">=",
"last",
".",
"relativeSeq",
"(",
")",
")"
] | When the most recent packet produced as an output of this state machine
is acknowledged by our peer, generate a single 'ack' input. | [
"When",
"the",
"most",
"recent",
"packet",
"produced",
"as",
"an",
"output",
"of",
"this",
"state",
"machine",
"is",
"acknowledged",
"by",
"our",
"peer",
"generate",
"a",
"single",
"ack",
"input",
"."
] | train | https://github.com/twisted/vertex/blob/feb591aa1b9a3b2b8fdcf53e4962dad2a0bc38ca/vertex/tcpdfa.py#L172-L180 |
twisted/vertex | vertex/tcpdfa.py | TCP.maybeReceiveAck | def maybeReceiveAck(self, ackPacket):
"""
Receive an L{ack} or L{synAck} input from the given packet.
"""
ackPredicate = self.ackPredicate
self.ackPredicate = lambda packet: False
if ackPacket.syn:
# New SYN packets are always news.
self.synAck()
... | python | def maybeReceiveAck(self, ackPacket):
"""
Receive an L{ack} or L{synAck} input from the given packet.
"""
ackPredicate = self.ackPredicate
self.ackPredicate = lambda packet: False
if ackPacket.syn:
# New SYN packets are always news.
self.synAck()
... | [
"def",
"maybeReceiveAck",
"(",
"self",
",",
"ackPacket",
")",
":",
"ackPredicate",
"=",
"self",
".",
"ackPredicate",
"self",
".",
"ackPredicate",
"=",
"lambda",
"packet",
":",
"False",
"if",
"ackPacket",
".",
"syn",
":",
"# New SYN packets are always news.",
"se... | Receive an L{ack} or L{synAck} input from the given packet. | [
"Receive",
"an",
"L",
"{",
"ack",
"}",
"or",
"L",
"{",
"synAck",
"}",
"input",
"from",
"the",
"given",
"packet",
"."
] | train | https://github.com/twisted/vertex/blob/feb591aa1b9a3b2b8fdcf53e4962dad2a0bc38ca/vertex/tcpdfa.py#L241-L252 |
dave-shawley/setupext-janitor | setupext/janitor.py | _set_options | def _set_options():
"""
Set the options for CleanCommand.
There are a number of reasons that this has to be done in an
external function instead of inline in the class. First of all,
the setuptools machinery really wants the options to be defined
in a class attribute - otherwise, the help comm... | python | def _set_options():
"""
Set the options for CleanCommand.
There are a number of reasons that this has to be done in an
external function instead of inline in the class. First of all,
the setuptools machinery really wants the options to be defined
in a class attribute - otherwise, the help comm... | [
"def",
"_set_options",
"(",
")",
":",
"CleanCommand",
".",
"user_options",
"=",
"_CleanCommand",
".",
"user_options",
"[",
":",
"]",
"CleanCommand",
".",
"user_options",
".",
"extend",
"(",
"[",
"(",
"'dist'",
",",
"'d'",
",",
"'remove distribution directory'",
... | Set the options for CleanCommand.
There are a number of reasons that this has to be done in an
external function instead of inline in the class. First of all,
the setuptools machinery really wants the options to be defined
in a class attribute - otherwise, the help command doesn't work
so we need ... | [
"Set",
"the",
"options",
"for",
"CleanCommand",
"."
] | train | https://github.com/dave-shawley/setupext-janitor/blob/801d4e51b10c8880be16c99fd6316051808141fa/setupext/janitor.py#L102-L134 |
Hundemeier/sacn | sacn/sender.py | sACNsender.activate_output | def activate_output(self, universe: int) -> None:
"""
Activates a universe that's then starting to sending every second.
See http://tsp.esta.org/tsp/documents/docs/E1-31-2016.pdf for more information
:param universe: the universe to activate
"""
check_universe(universe)
... | python | def activate_output(self, universe: int) -> None:
"""
Activates a universe that's then starting to sending every second.
See http://tsp.esta.org/tsp/documents/docs/E1-31-2016.pdf for more information
:param universe: the universe to activate
"""
check_universe(universe)
... | [
"def",
"activate_output",
"(",
"self",
",",
"universe",
":",
"int",
")",
"->",
"None",
":",
"check_universe",
"(",
"universe",
")",
"# check, if the universe already exists in the list:",
"if",
"universe",
"in",
"self",
".",
"_outputs",
":",
"return",
"# add new sen... | Activates a universe that's then starting to sending every second.
See http://tsp.esta.org/tsp/documents/docs/E1-31-2016.pdf for more information
:param universe: the universe to activate | [
"Activates",
"a",
"universe",
"that",
"s",
"then",
"starting",
"to",
"sending",
"every",
"second",
".",
"See",
"http",
":",
"//",
"tsp",
".",
"esta",
".",
"org",
"/",
"tsp",
"/",
"documents",
"/",
"docs",
"/",
"E1",
"-",
"31",
"-",
"2016",
".",
"pd... | train | https://github.com/Hundemeier/sacn/blob/f08bf3d7554a1ed2870f23a9e0e7b89a4a509231/sacn/sender.py#L56-L68 |
Hundemeier/sacn | sacn/sender.py | sACNsender.deactivate_output | def deactivate_output(self, universe: int) -> None:
"""
Deactivates an existing sending. Every data from the existing sending output will be lost.
(TTL, Multicast, DMX data, ..)
:param universe: the universe to deactivate. If the universe was not activated before, no error is raised
... | python | def deactivate_output(self, universe: int) -> None:
"""
Deactivates an existing sending. Every data from the existing sending output will be lost.
(TTL, Multicast, DMX data, ..)
:param universe: the universe to deactivate. If the universe was not activated before, no error is raised
... | [
"def",
"deactivate_output",
"(",
"self",
",",
"universe",
":",
"int",
")",
"->",
"None",
":",
"check_universe",
"(",
"universe",
")",
"try",
":",
"# try to send out three messages with stream_termination bit set to 1",
"self",
".",
"_outputs",
"[",
"universe",
"]",
... | Deactivates an existing sending. Every data from the existing sending output will be lost.
(TTL, Multicast, DMX data, ..)
:param universe: the universe to deactivate. If the universe was not activated before, no error is raised | [
"Deactivates",
"an",
"existing",
"sending",
".",
"Every",
"data",
"from",
"the",
"existing",
"sending",
"output",
"will",
"be",
"lost",
".",
"(",
"TTL",
"Multicast",
"DMX",
"data",
"..",
")",
":",
"param",
"universe",
":",
"the",
"universe",
"to",
"deactiv... | train | https://github.com/Hundemeier/sacn/blob/f08bf3d7554a1ed2870f23a9e0e7b89a4a509231/sacn/sender.py#L70-L86 |
Hundemeier/sacn | sacn/sender.py | sACNsender.move_universe | def move_universe(self, universe_from: int, universe_to: int) -> None:
"""
Moves an sending from one universe to another. All settings are being restored and only the universe changes
:param universe_from: the universe that should be moved
:param universe_to: the target universe. An exis... | python | def move_universe(self, universe_from: int, universe_to: int) -> None:
"""
Moves an sending from one universe to another. All settings are being restored and only the universe changes
:param universe_from: the universe that should be moved
:param universe_to: the target universe. An exis... | [
"def",
"move_universe",
"(",
"self",
",",
"universe_from",
":",
"int",
",",
"universe_to",
":",
"int",
")",
"->",
"None",
":",
"check_universe",
"(",
"universe_from",
")",
"check_universe",
"(",
"universe_to",
")",
"# store the sending object and change the universe i... | Moves an sending from one universe to another. All settings are being restored and only the universe changes
:param universe_from: the universe that should be moved
:param universe_to: the target universe. An existing universe will be overwritten | [
"Moves",
"an",
"sending",
"from",
"one",
"universe",
"to",
"another",
".",
"All",
"settings",
"are",
"being",
"restored",
"and",
"only",
"the",
"universe",
"changes",
":",
"param",
"universe_from",
":",
"the",
"universe",
"that",
"should",
"be",
"moved",
":"... | train | https://github.com/Hundemeier/sacn/blob/f08bf3d7554a1ed2870f23a9e0e7b89a4a509231/sacn/sender.py#L95-L109 |
Hundemeier/sacn | sacn/sender.py | sACNsender.start | def start(self, bind_address=None, bind_port: int = None, fps: int = None) -> None:
"""
Starts or restarts a new Thread with the parameters given in the constructor or
the parameters given in this function.
The parameters in this function do not override the class specific values!
... | python | def start(self, bind_address=None, bind_port: int = None, fps: int = None) -> None:
"""
Starts or restarts a new Thread with the parameters given in the constructor or
the parameters given in this function.
The parameters in this function do not override the class specific values!
... | [
"def",
"start",
"(",
"self",
",",
"bind_address",
"=",
"None",
",",
"bind_port",
":",
"int",
"=",
"None",
",",
"fps",
":",
"int",
"=",
"None",
")",
"->",
"None",
":",
"if",
"bind_address",
"is",
"None",
":",
"bind_address",
"=",
"self",
".",
"bindAdd... | Starts or restarts a new Thread with the parameters given in the constructor or
the parameters given in this function.
The parameters in this function do not override the class specific values!
:param bind_address: the IP-Address to bind to
:param bind_port: the port to bind to
:... | [
"Starts",
"or",
"restarts",
"a",
"new",
"Thread",
"with",
"the",
"parameters",
"given",
"in",
"the",
"constructor",
"or",
"the",
"parameters",
"given",
"in",
"this",
"function",
".",
"The",
"parameters",
"in",
"this",
"function",
"do",
"not",
"override",
"th... | train | https://github.com/Hundemeier/sacn/blob/f08bf3d7554a1ed2870f23a9e0e7b89a4a509231/sacn/sender.py#L117-L136 |
twisted/vertex | vertex/sigma.py | openReadWrite | def openReadWrite(filename):
"""
Return a 2-tuple of: (whether the file existed before, open file object)
"""
try:
os.makedirs(os.path.dirname(filename))
except OSError:
pass
try:
return file(filename, 'rb+')
except IOError:
return file(filename, 'wb+') | python | def openReadWrite(filename):
"""
Return a 2-tuple of: (whether the file existed before, open file object)
"""
try:
os.makedirs(os.path.dirname(filename))
except OSError:
pass
try:
return file(filename, 'rb+')
except IOError:
return file(filename, 'wb+') | [
"def",
"openReadWrite",
"(",
"filename",
")",
":",
"try",
":",
"os",
".",
"makedirs",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"filename",
")",
")",
"except",
"OSError",
":",
"pass",
"try",
":",
"return",
"file",
"(",
"filename",
",",
"'rb+'",
")... | Return a 2-tuple of: (whether the file existed before, open file object) | [
"Return",
"a",
"2",
"-",
"tuple",
"of",
":",
"(",
"whether",
"the",
"file",
"existed",
"before",
"open",
"file",
"object",
")"
] | train | https://github.com/twisted/vertex/blob/feb591aa1b9a3b2b8fdcf53e4962dad2a0bc38ca/vertex/sigma.py#L579-L590 |
twisted/vertex | vertex/sigma.py | openMaskFile | def openMaskFile(filename):
"""
Open the bitmask file sitting next to a file in the filesystem.
"""
dirname, basename = os.path.split(filename)
newbasename = '_%s_.sbm' % (basename,)
maskfname = os.path.join(dirname, newbasename)
maskfile = openReadWrite(maskfname)
return maskfile | python | def openMaskFile(filename):
"""
Open the bitmask file sitting next to a file in the filesystem.
"""
dirname, basename = os.path.split(filename)
newbasename = '_%s_.sbm' % (basename,)
maskfname = os.path.join(dirname, newbasename)
maskfile = openReadWrite(maskfname)
return maskfile | [
"def",
"openMaskFile",
"(",
"filename",
")",
":",
"dirname",
",",
"basename",
"=",
"os",
".",
"path",
".",
"split",
"(",
"filename",
")",
"newbasename",
"=",
"'_%s_.sbm'",
"%",
"(",
"basename",
",",
")",
"maskfname",
"=",
"os",
".",
"path",
".",
"join"... | Open the bitmask file sitting next to a file in the filesystem. | [
"Open",
"the",
"bitmask",
"file",
"sitting",
"next",
"to",
"a",
"file",
"in",
"the",
"filesystem",
"."
] | train | https://github.com/twisted/vertex/blob/feb591aa1b9a3b2b8fdcf53e4962dad2a0bc38ca/vertex/sigma.py#L599-L607 |
twisted/vertex | vertex/sigma.py | SigmaProtocol.data | def data(self, name, chunk, body):
"""
Issue a DATA command
return None
Sends a chunk of data to a peer.
"""
self.callRemote(Data, name=name, chunk=chunk, body=body) | python | def data(self, name, chunk, body):
"""
Issue a DATA command
return None
Sends a chunk of data to a peer.
"""
self.callRemote(Data, name=name, chunk=chunk, body=body) | [
"def",
"data",
"(",
"self",
",",
"name",
",",
"chunk",
",",
"body",
")",
":",
"self",
".",
"callRemote",
"(",
"Data",
",",
"name",
"=",
"name",
",",
"chunk",
"=",
"chunk",
",",
"body",
"=",
"body",
")"
] | Issue a DATA command
return None
Sends a chunk of data to a peer. | [
"Issue",
"a",
"DATA",
"command"
] | train | https://github.com/twisted/vertex/blob/feb591aa1b9a3b2b8fdcf53e4962dad2a0bc38ca/vertex/sigma.py#L168-L176 |
twisted/vertex | vertex/sigma.py | SigmaProtocol.get | def get(self, name, mask=None):
"""
Issue a GET command
Return a Deferred which fires with the size of the name being requested
"""
mypeer = self.transport.getQ2QPeer()
tl = self.nexus.transloads[name]
peerz = tl.peers
if mypeer in peerz:
peer... | python | def get(self, name, mask=None):
"""
Issue a GET command
Return a Deferred which fires with the size of the name being requested
"""
mypeer = self.transport.getQ2QPeer()
tl = self.nexus.transloads[name]
peerz = tl.peers
if mypeer in peerz:
peer... | [
"def",
"get",
"(",
"self",
",",
"name",
",",
"mask",
"=",
"None",
")",
":",
"mypeer",
"=",
"self",
".",
"transport",
".",
"getQ2QPeer",
"(",
")",
"tl",
"=",
"self",
".",
"nexus",
".",
"transloads",
"[",
"name",
"]",
"peerz",
"=",
"tl",
".",
"peer... | Issue a GET command
Return a Deferred which fires with the size of the name being requested | [
"Issue",
"a",
"GET",
"command"
] | train | https://github.com/twisted/vertex/blob/feb591aa1b9a3b2b8fdcf53e4962dad2a0bc38ca/vertex/sigma.py#L204-L221 |
twisted/vertex | vertex/sigma.py | SigmaProtocol.connectionLost | def connectionLost(self, reason):
"""
Inform the associated L{conncache.ConnectionCache} that this
protocol has been disconnected.
"""
self.nexus.conns.connectionLostForKey((endpoint.Q2QEndpoint(
self.nexus.svc,
self.nexus.addr,
sel... | python | def connectionLost(self, reason):
"""
Inform the associated L{conncache.ConnectionCache} that this
protocol has been disconnected.
"""
self.nexus.conns.connectionLostForKey((endpoint.Q2QEndpoint(
self.nexus.svc,
self.nexus.addr,
sel... | [
"def",
"connectionLost",
"(",
"self",
",",
"reason",
")",
":",
"self",
".",
"nexus",
".",
"conns",
".",
"connectionLostForKey",
"(",
"(",
"endpoint",
".",
"Q2QEndpoint",
"(",
"self",
".",
"nexus",
".",
"svc",
",",
"self",
".",
"nexus",
".",
"addr",
","... | Inform the associated L{conncache.ConnectionCache} that this
protocol has been disconnected. | [
"Inform",
"the",
"associated",
"L",
"{",
"conncache",
".",
"ConnectionCache",
"}",
"that",
"this",
"protocol",
"has",
"been",
"disconnected",
"."
] | train | https://github.com/twisted/vertex/blob/feb591aa1b9a3b2b8fdcf53e4962dad2a0bc38ca/vertex/sigma.py#L238-L248 |
twisted/vertex | vertex/sigma.py | SigmaProtocol.sendSomeData | def sendSomeData(self, howMany):
"""
Send some DATA commands to my peer(s) to relay some data.
@param howMany: an int, the number of chunks to send out.
"""
# print 'sending some data', howMany
if self.transport is None:
return
peer = self.transport.g... | python | def sendSomeData(self, howMany):
"""
Send some DATA commands to my peer(s) to relay some data.
@param howMany: an int, the number of chunks to send out.
"""
# print 'sending some data', howMany
if self.transport is None:
return
peer = self.transport.g... | [
"def",
"sendSomeData",
"(",
"self",
",",
"howMany",
")",
":",
"# print 'sending some data', howMany",
"if",
"self",
".",
"transport",
"is",
"None",
":",
"return",
"peer",
"=",
"self",
".",
"transport",
".",
"getQ2QPeer",
"(",
")",
"while",
"howMany",
">",
"0... | Send some DATA commands to my peer(s) to relay some data.
@param howMany: an int, the number of chunks to send out. | [
"Send",
"some",
"DATA",
"commands",
"to",
"my",
"peer",
"(",
"s",
")",
"to",
"relay",
"some",
"data",
"."
] | train | https://github.com/twisted/vertex/blob/feb591aa1b9a3b2b8fdcf53e4962dad2a0bc38ca/vertex/sigma.py#L268-L320 |
twisted/vertex | vertex/sigma.py | PeerKnowledge.selectPeerToIntroduce | def selectPeerToIntroduce(self, otherPeers):
"""
Choose a peer to introduce. Return a q2q address or None, if there are
no suitable peers to introduce at this time.
"""
for peer in otherPeers:
if peer not in self.otherPeers:
self.otherPeers.append(pee... | python | def selectPeerToIntroduce(self, otherPeers):
"""
Choose a peer to introduce. Return a q2q address or None, if there are
no suitable peers to introduce at this time.
"""
for peer in otherPeers:
if peer not in self.otherPeers:
self.otherPeers.append(pee... | [
"def",
"selectPeerToIntroduce",
"(",
"self",
",",
"otherPeers",
")",
":",
"for",
"peer",
"in",
"otherPeers",
":",
"if",
"peer",
"not",
"in",
"self",
".",
"otherPeers",
":",
"self",
".",
"otherPeers",
".",
"append",
"(",
"peer",
")",
"return",
"peer"
] | Choose a peer to introduce. Return a q2q address or None, if there are
no suitable peers to introduce at this time. | [
"Choose",
"a",
"peer",
"to",
"introduce",
".",
"Return",
"a",
"q2q",
"address",
"or",
"None",
"if",
"there",
"are",
"no",
"suitable",
"peers",
"to",
"introduce",
"at",
"this",
"time",
"."
] | train | https://github.com/twisted/vertex/blob/feb591aa1b9a3b2b8fdcf53e4962dad2a0bc38ca/vertex/sigma.py#L344-L352 |
twisted/vertex | vertex/sigma.py | Transload.chunkReceived | def chunkReceived(self, who, chunkNumber, chunkData):
"""
A chunk was received from the peer.
"""
def verifyError(error):
error.trap(VerifyError)
self.nexus.decreaseScore(who, self.authorities)
return self.nexus.verifyChunk(self.name,
... | python | def chunkReceived(self, who, chunkNumber, chunkData):
"""
A chunk was received from the peer.
"""
def verifyError(error):
error.trap(VerifyError)
self.nexus.decreaseScore(who, self.authorities)
return self.nexus.verifyChunk(self.name,
... | [
"def",
"chunkReceived",
"(",
"self",
",",
"who",
",",
"chunkNumber",
",",
"chunkData",
")",
":",
"def",
"verifyError",
"(",
"error",
")",
":",
"error",
".",
"trap",
"(",
"VerifyError",
")",
"self",
".",
"nexus",
".",
"decreaseScore",
"(",
"who",
",",
"... | A chunk was received from the peer. | [
"A",
"chunk",
"was",
"received",
"from",
"the",
"peer",
"."
] | train | https://github.com/twisted/vertex/blob/feb591aa1b9a3b2b8fdcf53e4962dad2a0bc38ca/vertex/sigma.py#L458-L471 |
twisted/vertex | vertex/sigma.py | Transload.chunkVerified | def chunkVerified(self, who, chunkNumber, chunkData):
"""A chunk (#chunkNumber) containing the data C{chunkData} was verified, sent
to us by the Q2QAddress C{who}.
"""
if self.mask[chunkNumber]:
# already received that chunk.
return
self.file.seek(chunkNum... | python | def chunkVerified(self, who, chunkNumber, chunkData):
"""A chunk (#chunkNumber) containing the data C{chunkData} was verified, sent
to us by the Q2QAddress C{who}.
"""
if self.mask[chunkNumber]:
# already received that chunk.
return
self.file.seek(chunkNum... | [
"def",
"chunkVerified",
"(",
"self",
",",
"who",
",",
"chunkNumber",
",",
"chunkData",
")",
":",
"if",
"self",
".",
"mask",
"[",
"chunkNumber",
"]",
":",
"# already received that chunk.",
"return",
"self",
".",
"file",
".",
"seek",
"(",
"chunkNumber",
"*",
... | A chunk (#chunkNumber) containing the data C{chunkData} was verified, sent
to us by the Q2QAddress C{who}. | [
"A",
"chunk",
"(",
"#chunkNumber",
")",
"containing",
"the",
"data",
"C",
"{",
"chunkData",
"}",
"was",
"verified",
"sent",
"to",
"us",
"by",
"the",
"Q2QAddress",
"C",
"{",
"who",
"}",
"."
] | train | https://github.com/twisted/vertex/blob/feb591aa1b9a3b2b8fdcf53e4962dad2a0bc38ca/vertex/sigma.py#L473-L507 |
twisted/vertex | vertex/sigma.py | Transload.selectOptimalChunk | def selectOptimalChunk(self, peer):
"""
select an optimal chunk to send to a peer.
@return: int(chunkNumber), str(chunkData) if there is data to be sent,
otherwise None, None
"""
# stuff I have
have = sets.Set(self.mask.positions(1))
# stuff that this pe... | python | def selectOptimalChunk(self, peer):
"""
select an optimal chunk to send to a peer.
@return: int(chunkNumber), str(chunkData) if there is data to be sent,
otherwise None, None
"""
# stuff I have
have = sets.Set(self.mask.positions(1))
# stuff that this pe... | [
"def",
"selectOptimalChunk",
"(",
"self",
",",
"peer",
")",
":",
"# stuff I have",
"have",
"=",
"sets",
".",
"Set",
"(",
"self",
".",
"mask",
".",
"positions",
"(",
"1",
")",
")",
"# stuff that this peer wants",
"want",
"=",
"sets",
".",
"Set",
"(",
"sel... | select an optimal chunk to send to a peer.
@return: int(chunkNumber), str(chunkData) if there is data to be sent,
otherwise None, None | [
"select",
"an",
"optimal",
"chunk",
"to",
"send",
"to",
"a",
"peer",
"."
] | train | https://github.com/twisted/vertex/blob/feb591aa1b9a3b2b8fdcf53e4962dad2a0bc38ca/vertex/sigma.py#L518-L551 |
twisted/vertex | vertex/sigma.py | BaseNexusUI.allocateFile | def allocateFile(self, sharename, peer):
"""
return a 2-tuple of incompletePath, fullPath
"""
peerDir = self.basepath.child(str(peer))
if not peerDir.isdir():
peerDir.makedirs()
return (peerDir.child(sharename+'.incomplete'),
peerDir.child(shar... | python | def allocateFile(self, sharename, peer):
"""
return a 2-tuple of incompletePath, fullPath
"""
peerDir = self.basepath.child(str(peer))
if not peerDir.isdir():
peerDir.makedirs()
return (peerDir.child(sharename+'.incomplete'),
peerDir.child(shar... | [
"def",
"allocateFile",
"(",
"self",
",",
"sharename",
",",
"peer",
")",
":",
"peerDir",
"=",
"self",
".",
"basepath",
".",
"child",
"(",
"str",
"(",
"peer",
")",
")",
"if",
"not",
"peerDir",
".",
"isdir",
"(",
")",
":",
"peerDir",
".",
"makedirs",
... | return a 2-tuple of incompletePath, fullPath | [
"return",
"a",
"2",
"-",
"tuple",
"of",
"incompletePath",
"fullPath"
] | train | https://github.com/twisted/vertex/blob/feb591aa1b9a3b2b8fdcf53e4962dad2a0bc38ca/vertex/sigma.py#L646-L654 |
twisted/vertex | vertex/sigma.py | Nexus.transloadsForPeer | def transloadsForPeer(self, peer):
"""
Returns an iterator of transloads that apply to a particular peer.
"""
for tl in self.transloads.itervalues():
if peer in tl.peers:
yield tl | python | def transloadsForPeer(self, peer):
"""
Returns an iterator of transloads that apply to a particular peer.
"""
for tl in self.transloads.itervalues():
if peer in tl.peers:
yield tl | [
"def",
"transloadsForPeer",
"(",
"self",
",",
"peer",
")",
":",
"for",
"tl",
"in",
"self",
".",
"transloads",
".",
"itervalues",
"(",
")",
":",
"if",
"peer",
"in",
"tl",
".",
"peers",
":",
"yield",
"tl"
] | Returns an iterator of transloads that apply to a particular peer. | [
"Returns",
"an",
"iterator",
"of",
"transloads",
"that",
"apply",
"to",
"a",
"particular",
"peer",
"."
] | train | https://github.com/twisted/vertex/blob/feb591aa1b9a3b2b8fdcf53e4962dad2a0bc38ca/vertex/sigma.py#L705-L711 |
twisted/vertex | vertex/sigma.py | Nexus.seed | def seed(self, path, name):
"""Create a transload from an existing file that is complete.
"""
t = self.transloads[name] = Transload(self.addr, self, name,
None, path,
self.ui.startTransload(name,
... | python | def seed(self, path, name):
"""Create a transload from an existing file that is complete.
"""
t = self.transloads[name] = Transload(self.addr, self, name,
None, path,
self.ui.startTransload(name,
... | [
"def",
"seed",
"(",
"self",
",",
"path",
",",
"name",
")",
":",
"t",
"=",
"self",
".",
"transloads",
"[",
"name",
"]",
"=",
"Transload",
"(",
"self",
".",
"addr",
",",
"self",
",",
"name",
",",
"None",
",",
"path",
",",
"self",
".",
"ui",
".",
... | Create a transload from an existing file that is complete. | [
"Create",
"a",
"transload",
"from",
"an",
"existing",
"file",
"that",
"is",
"complete",
"."
] | train | https://github.com/twisted/vertex/blob/feb591aa1b9a3b2b8fdcf53e4962dad2a0bc38ca/vertex/sigma.py#L713-L721 |
twisted/vertex | vertex/sigma.py | Nexus.connectPeer | def connectPeer(self, peer):
"""Establish a SIGMA connection to the given peer.
@param peer: a Q2QAddress of a peer which has a file that I want
@return: a Deferred which fires a SigmaProtocol.
"""
return self.conns.connectCached(endpoint.Q2QEndpoint(self.svc,
... | python | def connectPeer(self, peer):
"""Establish a SIGMA connection to the given peer.
@param peer: a Q2QAddress of a peer which has a file that I want
@return: a Deferred which fires a SigmaProtocol.
"""
return self.conns.connectCached(endpoint.Q2QEndpoint(self.svc,
... | [
"def",
"connectPeer",
"(",
"self",
",",
"peer",
")",
":",
"return",
"self",
".",
"conns",
".",
"connectCached",
"(",
"endpoint",
".",
"Q2QEndpoint",
"(",
"self",
".",
"svc",
",",
"self",
".",
"addr",
",",
"peer",
",",
"PROTOCOL_NAME",
")",
",",
"self",... | Establish a SIGMA connection to the given peer.
@param peer: a Q2QAddress of a peer which has a file that I want
@return: a Deferred which fires a SigmaProtocol. | [
"Establish",
"a",
"SIGMA",
"connection",
"to",
"the",
"given",
"peer",
"."
] | train | https://github.com/twisted/vertex/blob/feb591aa1b9a3b2b8fdcf53e4962dad2a0bc38ca/vertex/sigma.py#L723-L734 |
twisted/vertex | vertex/sigma.py | Nexus.increaseScore | def increaseScore(self, participant):
"""
The participant successfully transferred a chunk to me.
"""
if participant not in self.scores:
self.scores[participant] = 0
self.scores[participant] += 1 | python | def increaseScore(self, participant):
"""
The participant successfully transferred a chunk to me.
"""
if participant not in self.scores:
self.scores[participant] = 0
self.scores[participant] += 1 | [
"def",
"increaseScore",
"(",
"self",
",",
"participant",
")",
":",
"if",
"participant",
"not",
"in",
"self",
".",
"scores",
":",
"self",
".",
"scores",
"[",
"participant",
"]",
"=",
"0",
"self",
".",
"scores",
"[",
"participant",
"]",
"+=",
"1"
] | The participant successfully transferred a chunk to me. | [
"The",
"participant",
"successfully",
"transferred",
"a",
"chunk",
"to",
"me",
"."
] | train | https://github.com/twisted/vertex/blob/feb591aa1b9a3b2b8fdcf53e4962dad2a0bc38ca/vertex/sigma.py#L749-L755 |
Hundemeier/sacn | sacn/receiver.py | sACNreceiver.listen_on | def listen_on(self, trigger: str, **kwargs) -> callable:
"""
This is a simple decorator for registering a callback for an event. You can also use 'register_listener'.
A list with all possible options is available via LISTEN_ON_OPTIONS.
:param trigger: Currently supported options: 'univer... | python | def listen_on(self, trigger: str, **kwargs) -> callable:
"""
This is a simple decorator for registering a callback for an event. You can also use 'register_listener'.
A list with all possible options is available via LISTEN_ON_OPTIONS.
:param trigger: Currently supported options: 'univer... | [
"def",
"listen_on",
"(",
"self",
",",
"trigger",
":",
"str",
",",
"*",
"*",
"kwargs",
")",
"->",
"callable",
":",
"def",
"decorator",
"(",
"f",
")",
":",
"self",
".",
"register_listener",
"(",
"trigger",
",",
"f",
",",
"*",
"*",
"kwargs",
")",
"ret... | This is a simple decorator for registering a callback for an event. You can also use 'register_listener'.
A list with all possible options is available via LISTEN_ON_OPTIONS.
:param trigger: Currently supported options: 'universe availability change', 'universe' | [
"This",
"is",
"a",
"simple",
"decorator",
"for",
"registering",
"a",
"callback",
"for",
"an",
"event",
".",
"You",
"can",
"also",
"use",
"register_listener",
".",
"A",
"list",
"with",
"all",
"possible",
"options",
"is",
"available",
"via",
"LISTEN_ON_OPTIONS",... | train | https://github.com/Hundemeier/sacn/blob/f08bf3d7554a1ed2870f23a9e0e7b89a4a509231/sacn/receiver.py#L36-L45 |
Hundemeier/sacn | sacn/receiver.py | sACNreceiver.register_listener | def register_listener(self, trigger: str, func: callable, **kwargs) -> None:
"""
Register a listener for the given trigger. Raises an TypeError when the trigger is not a valid one.
To get a list with all valid triggers, use LISTEN_ON_OPTIONS.
:param trigger: the trigger on which the give... | python | def register_listener(self, trigger: str, func: callable, **kwargs) -> None:
"""
Register a listener for the given trigger. Raises an TypeError when the trigger is not a valid one.
To get a list with all valid triggers, use LISTEN_ON_OPTIONS.
:param trigger: the trigger on which the give... | [
"def",
"register_listener",
"(",
"self",
",",
"trigger",
":",
"str",
",",
"func",
":",
"callable",
",",
"*",
"*",
"kwargs",
")",
"->",
"None",
":",
"if",
"trigger",
"in",
"LISTEN_ON_OPTIONS",
":",
"if",
"trigger",
"==",
"LISTEN_ON_OPTIONS",
"[",
"1",
"]"... | Register a listener for the given trigger. Raises an TypeError when the trigger is not a valid one.
To get a list with all valid triggers, use LISTEN_ON_OPTIONS.
:param trigger: the trigger on which the given callback should be used.
Currently supported: 'universe availability change', 'univers... | [
"Register",
"a",
"listener",
"for",
"the",
"given",
"trigger",
".",
"Raises",
"an",
"TypeError",
"when",
"the",
"trigger",
"is",
"not",
"a",
"valid",
"one",
".",
"To",
"get",
"a",
"list",
"with",
"all",
"valid",
"triggers",
"use",
"LISTEN_ON_OPTIONS",
".",... | train | https://github.com/Hundemeier/sacn/blob/f08bf3d7554a1ed2870f23a9e0e7b89a4a509231/sacn/receiver.py#L47-L66 |
Hundemeier/sacn | sacn/receiver.py | sACNreceiver.join_multicast | def join_multicast(self, universe: int) -> None:
"""
Joins the multicast address that is used for the given universe. Note: If you are on Windows you must have given
a bind IP-Address for this feature to function properly. On the other hand you are not allowed to set a bind
address if yo... | python | def join_multicast(self, universe: int) -> None:
"""
Joins the multicast address that is used for the given universe. Note: If you are on Windows you must have given
a bind IP-Address for this feature to function properly. On the other hand you are not allowed to set a bind
address if yo... | [
"def",
"join_multicast",
"(",
"self",
",",
"universe",
":",
"int",
")",
"->",
"None",
":",
"self",
".",
"sock",
".",
"setsockopt",
"(",
"socket",
".",
"SOL_IP",
",",
"socket",
".",
"IP_ADD_MEMBERSHIP",
",",
"socket",
".",
"inet_aton",
"(",
"calculate_multi... | Joins the multicast address that is used for the given universe. Note: If you are on Windows you must have given
a bind IP-Address for this feature to function properly. On the other hand you are not allowed to set a bind
address if you are on any other OS.
:param universe: the universe to join ... | [
"Joins",
"the",
"multicast",
"address",
"that",
"is",
"used",
"for",
"the",
"given",
"universe",
".",
"Note",
":",
"If",
"you",
"are",
"on",
"Windows",
"you",
"must",
"have",
"given",
"a",
"bind",
"IP",
"-",
"Address",
"for",
"this",
"feature",
"to",
"... | train | https://github.com/Hundemeier/sacn/blob/f08bf3d7554a1ed2870f23a9e0e7b89a4a509231/sacn/receiver.py#L68-L78 |
Hundemeier/sacn | sacn/receiver.py | sACNreceiver.leave_multicast | def leave_multicast(self, universe: int) -> None:
"""
Try to leave the multicast group with the specified universe. This does not throw any exception if the group
could not be leaved.
:param universe: the universe to leave the multicast group.
The network hardware has to support ... | python | def leave_multicast(self, universe: int) -> None:
"""
Try to leave the multicast group with the specified universe. This does not throw any exception if the group
could not be leaved.
:param universe: the universe to leave the multicast group.
The network hardware has to support ... | [
"def",
"leave_multicast",
"(",
"self",
",",
"universe",
":",
"int",
")",
"->",
"None",
":",
"try",
":",
"self",
".",
"sock",
".",
"setsockopt",
"(",
"socket",
".",
"SOL_IP",
",",
"socket",
".",
"IP_DROP_MEMBERSHIP",
",",
"socket",
".",
"inet_aton",
"(",
... | Try to leave the multicast group with the specified universe. This does not throw any exception if the group
could not be leaved.
:param universe: the universe to leave the multicast group.
The network hardware has to support the multicast feature! | [
"Try",
"to",
"leave",
"the",
"multicast",
"group",
"with",
"the",
"specified",
"universe",
".",
"This",
"does",
"not",
"throw",
"any",
"exception",
"if",
"the",
"group",
"could",
"not",
"be",
"leaved",
".",
":",
"param",
"universe",
":",
"the",
"universe",... | train | https://github.com/Hundemeier/sacn/blob/f08bf3d7554a1ed2870f23a9e0e7b89a4a509231/sacn/receiver.py#L80-L92 |
Hundemeier/sacn | sacn/receiver.py | sACNreceiver.start | def start(self) -> None:
"""
Starts a new thread that handles the input. If a thread is already running, the thread will be restarted.
"""
self.stop() # stop an existing thread
self._thread = receiverThread(socket=self.sock, callbacks=self._callbacks)
self._thread.start(... | python | def start(self) -> None:
"""
Starts a new thread that handles the input. If a thread is already running, the thread will be restarted.
"""
self.stop() # stop an existing thread
self._thread = receiverThread(socket=self.sock, callbacks=self._callbacks)
self._thread.start(... | [
"def",
"start",
"(",
"self",
")",
"->",
"None",
":",
"self",
".",
"stop",
"(",
")",
"# stop an existing thread",
"self",
".",
"_thread",
"=",
"receiverThread",
"(",
"socket",
"=",
"self",
".",
"sock",
",",
"callbacks",
"=",
"self",
".",
"_callbacks",
")"... | Starts a new thread that handles the input. If a thread is already running, the thread will be restarted. | [
"Starts",
"a",
"new",
"thread",
"that",
"handles",
"the",
"input",
".",
"If",
"a",
"thread",
"is",
"already",
"running",
"the",
"thread",
"will",
"be",
"restarted",
"."
] | train | https://github.com/Hundemeier/sacn/blob/f08bf3d7554a1ed2870f23a9e0e7b89a4a509231/sacn/receiver.py#L94-L100 |
mikeboers/Flask-ACL | flask_acl/extension.py | ACLManager.predicate | def predicate(self, name, func=None):
"""Define a new predicate (directly, or as a decorator).
E.g.::
@authz.predicate('ROOT')
def is_root(user, **ctx):
# return True of user is in group "wheel".
"""
if func is None:
return functools... | python | def predicate(self, name, func=None):
"""Define a new predicate (directly, or as a decorator).
E.g.::
@authz.predicate('ROOT')
def is_root(user, **ctx):
# return True of user is in group "wheel".
"""
if func is None:
return functools... | [
"def",
"predicate",
"(",
"self",
",",
"name",
",",
"func",
"=",
"None",
")",
":",
"if",
"func",
"is",
"None",
":",
"return",
"functools",
".",
"partial",
"(",
"self",
".",
"predicate",
",",
"name",
")",
"self",
".",
"predicates",
"[",
"name",
"]",
... | Define a new predicate (directly, or as a decorator).
E.g.::
@authz.predicate('ROOT')
def is_root(user, **ctx):
# return True of user is in group "wheel". | [
"Define",
"a",
"new",
"predicate",
"(",
"directly",
"or",
"as",
"a",
"decorator",
")",
"."
] | train | https://github.com/mikeboers/Flask-ACL/blob/7339b89f96ad8686d1526e25c138244ad912e12d/flask_acl/extension.py#L86-L99 |
mikeboers/Flask-ACL | flask_acl/extension.py | ACLManager.permission_set | def permission_set(self, name, func=None):
"""Define a new permission set (directly, or as a decorator).
E.g.::
@authz.permission_set('HTTP')
def is_http_perm(perm):
return perm.startswith('http.')
"""
if func is None:
return functoo... | python | def permission_set(self, name, func=None):
"""Define a new permission set (directly, or as a decorator).
E.g.::
@authz.permission_set('HTTP')
def is_http_perm(perm):
return perm.startswith('http.')
"""
if func is None:
return functoo... | [
"def",
"permission_set",
"(",
"self",
",",
"name",
",",
"func",
"=",
"None",
")",
":",
"if",
"func",
"is",
"None",
":",
"return",
"functools",
".",
"partial",
"(",
"self",
".",
"predicate",
",",
"name",
")",
"self",
".",
"permission_sets",
"[",
"name",... | Define a new permission set (directly, or as a decorator).
E.g.::
@authz.permission_set('HTTP')
def is_http_perm(perm):
return perm.startswith('http.') | [
"Define",
"a",
"new",
"permission",
"set",
"(",
"directly",
"or",
"as",
"a",
"decorator",
")",
"."
] | train | https://github.com/mikeboers/Flask-ACL/blob/7339b89f96ad8686d1526e25c138244ad912e12d/flask_acl/extension.py#L101-L114 |
mikeboers/Flask-ACL | flask_acl/extension.py | ACLManager.route_acl | def route_acl(self, *acl, **options):
"""Decorator to attach an ACL to a route.
E.g::
@app.route('/url/to/view')
@authz.route_acl('''
ALLOW WHEEL ALL
DENY ANY ALL
''')
def my_admin_function():
pa... | python | def route_acl(self, *acl, **options):
"""Decorator to attach an ACL to a route.
E.g::
@app.route('/url/to/view')
@authz.route_acl('''
ALLOW WHEEL ALL
DENY ANY ALL
''')
def my_admin_function():
pa... | [
"def",
"route_acl",
"(",
"self",
",",
"*",
"acl",
",",
"*",
"*",
"options",
")",
":",
"def",
"_route_acl",
"(",
"func",
")",
":",
"func",
".",
"__acl__",
"=",
"acl",
"@",
"functools",
".",
"wraps",
"(",
"func",
")",
"def",
"wrapped",
"(",
"*",
"a... | Decorator to attach an ACL to a route.
E.g::
@app.route('/url/to/view')
@authz.route_acl('''
ALLOW WHEEL ALL
DENY ANY ALL
''')
def my_admin_function():
pass | [
"Decorator",
"to",
"attach",
"an",
"ACL",
"to",
"a",
"route",
"."
] | train | https://github.com/mikeboers/Flask-ACL/blob/7339b89f96ad8686d1526e25c138244ad912e12d/flask_acl/extension.py#L116-L144 |
mikeboers/Flask-ACL | flask_acl/extension.py | ACLManager.can | def can(self, permission, obj, **kwargs):
"""Check if we can do something with an object.
:param permission: The permission to look for.
:param obj: The object to check the ACL of.
:param **kwargs: The context to pass to predicates.
>>> auth.can('read', some_object)
>>>... | python | def can(self, permission, obj, **kwargs):
"""Check if we can do something with an object.
:param permission: The permission to look for.
:param obj: The object to check the ACL of.
:param **kwargs: The context to pass to predicates.
>>> auth.can('read', some_object)
>>>... | [
"def",
"can",
"(",
"self",
",",
"permission",
",",
"obj",
",",
"*",
"*",
"kwargs",
")",
":",
"context",
"=",
"{",
"'user'",
":",
"current_user",
"}",
"for",
"func",
"in",
"self",
".",
"context_processors",
":",
"context",
".",
"update",
"(",
"func",
... | Check if we can do something with an object.
:param permission: The permission to look for.
:param obj: The object to check the ACL of.
:param **kwargs: The context to pass to predicates.
>>> auth.can('read', some_object)
>>> auth.can('write', another_object, group=some_group) | [
"Check",
"if",
"we",
"can",
"do",
"something",
"with",
"an",
"object",
"."
] | train | https://github.com/mikeboers/Flask-ACL/blob/7339b89f96ad8686d1526e25c138244ad912e12d/flask_acl/extension.py#L146-L163 |
mikeboers/Flask-ACL | flask_acl/extension.py | ACLManager.assert_can | def assert_can(self, permission, obj, **kwargs):
"""Make sure we have a permission, or abort the request.
:param permission: The permission to look for.
:param obj: The object to check the ACL of.
:param flash: The message to flask if denied (keyword only).
:param stealth: Abort... | python | def assert_can(self, permission, obj, **kwargs):
"""Make sure we have a permission, or abort the request.
:param permission: The permission to look for.
:param obj: The object to check the ACL of.
:param flash: The message to flask if denied (keyword only).
:param stealth: Abort... | [
"def",
"assert_can",
"(",
"self",
",",
"permission",
",",
"obj",
",",
"*",
"*",
"kwargs",
")",
":",
"flash_message",
"=",
"kwargs",
".",
"pop",
"(",
"'flash'",
",",
"None",
")",
"stealth",
"=",
"kwargs",
".",
"pop",
"(",
"'stealth'",
",",
"False",
")... | Make sure we have a permission, or abort the request.
:param permission: The permission to look for.
:param obj: The object to check the ACL of.
:param flash: The message to flask if denied (keyword only).
:param stealth: Abort with a 404? (keyword only).
:param **kwargs: The co... | [
"Make",
"sure",
"we",
"have",
"a",
"permission",
"or",
"abort",
"the",
"request",
"."
] | train | https://github.com/mikeboers/Flask-ACL/blob/7339b89f96ad8686d1526e25c138244ad912e12d/flask_acl/extension.py#L165-L196 |
mikeboers/Flask-ACL | flask_acl/extension.py | ACLManager.can_route | def can_route(self, endpoint, method=None, **kwargs):
"""Make sure we can route to the given endpoint or url.
This checks for `http.get` permission (or other methods) on the ACL of
route functions, attached via the `ACL` decorator.
:param endpoint: A URL or endpoint to check for permis... | python | def can_route(self, endpoint, method=None, **kwargs):
"""Make sure we can route to the given endpoint or url.
This checks for `http.get` permission (or other methods) on the ACL of
route functions, attached via the `ACL` decorator.
:param endpoint: A URL or endpoint to check for permis... | [
"def",
"can_route",
"(",
"self",
",",
"endpoint",
",",
"method",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"view",
"=",
"flask",
".",
"current_app",
".",
"view_functions",
".",
"get",
"(",
"endpoint",
")",
"if",
"not",
"view",
":",
"endpoint",
... | Make sure we can route to the given endpoint or url.
This checks for `http.get` permission (or other methods) on the ACL of
route functions, attached via the `ACL` decorator.
:param endpoint: A URL or endpoint to check for permission to access.
:param method: The HTTP method to check; ... | [
"Make",
"sure",
"we",
"can",
"route",
"to",
"the",
"given",
"endpoint",
"or",
"url",
"."
] | train | https://github.com/mikeboers/Flask-ACL/blob/7339b89f96ad8686d1526e25c138244ad912e12d/flask_acl/extension.py#L198-L217 |
twisted/vertex | vertex/command.py | ConnectionStartBox._sendTo | def _sendTo(self, proto):
"""
When sent, call the C{startProtocol} method on the virtual transport
object.
@see: L{vertex.ptcp.PTCP.startProtocol}
@see: L{vertex.q2q.VirtualTransport.startProtocol}
@param proto: the AMP protocol that this is being sent on.
"""
... | python | def _sendTo(self, proto):
"""
When sent, call the C{startProtocol} method on the virtual transport
object.
@see: L{vertex.ptcp.PTCP.startProtocol}
@see: L{vertex.q2q.VirtualTransport.startProtocol}
@param proto: the AMP protocol that this is being sent on.
"""
... | [
"def",
"_sendTo",
"(",
"self",
",",
"proto",
")",
":",
"# XXX This is overriding a private interface",
"super",
"(",
"ConnectionStartBox",
",",
"self",
")",
".",
"_sendTo",
"(",
"proto",
")",
"self",
".",
"virtualTransport",
".",
"startProtocol",
"(",
")"
] | When sent, call the C{startProtocol} method on the virtual transport
object.
@see: L{vertex.ptcp.PTCP.startProtocol}
@see: L{vertex.q2q.VirtualTransport.startProtocol}
@param proto: the AMP protocol that this is being sent on. | [
"When",
"sent",
"call",
"the",
"C",
"{",
"startProtocol",
"}",
"method",
"on",
"the",
"virtual",
"transport",
"object",
"."
] | train | https://github.com/twisted/vertex/blob/feb591aa1b9a3b2b8fdcf53e4962dad2a0bc38ca/vertex/command.py#L35-L48 |
twisted/vertex | vertex/command.py | Virtual.makeResponse | def makeResponse(cls, objects, proto):
"""
Create a response dictionary using this L{Virtual} command's schema; do
the same thing as L{Command.makeResponse}, but additionally do
addition.
@param objects: The dictionary of strings mapped to Python objects.
@param proto: ... | python | def makeResponse(cls, objects, proto):
"""
Create a response dictionary using this L{Virtual} command's schema; do
the same thing as L{Command.makeResponse}, but additionally do
addition.
@param objects: The dictionary of strings mapped to Python objects.
@param proto: ... | [
"def",
"makeResponse",
"(",
"cls",
",",
"objects",
",",
"proto",
")",
":",
"tpt",
"=",
"objects",
".",
"pop",
"(",
"'__transport__'",
")",
"# XXX Using a private API",
"return",
"_objectsToStrings",
"(",
"objects",
",",
"cls",
".",
"response",
",",
"Connection... | Create a response dictionary using this L{Virtual} command's schema; do
the same thing as L{Command.makeResponse}, but additionally do
addition.
@param objects: The dictionary of strings mapped to Python objects.
@param proto: The AMP protocol that this command is serialized to.
... | [
"Create",
"a",
"response",
"dictionary",
"using",
"this",
"L",
"{",
"Virtual",
"}",
"command",
"s",
"schema",
";",
"do",
"the",
"same",
"thing",
"as",
"L",
"{",
"Command",
".",
"makeResponse",
"}",
"but",
"additionally",
"do",
"addition",
"."
] | train | https://github.com/twisted/vertex/blob/feb591aa1b9a3b2b8fdcf53e4962dad2a0bc38ca/vertex/command.py#L90-L108 |
Yelp/pyramid_zipkin | pyramid_zipkin/request_helper.py | get_trace_id | def get_trace_id(request):
"""Gets the trace id based on a request. If not present with the request,
create a custom (depending on config: `zipkin.trace_id_generator`) or a
completely random trace id.
:param: current active pyramid request
:returns: a 64-bit hex string
"""
if 'X-B3-TraceId'... | python | def get_trace_id(request):
"""Gets the trace id based on a request. If not present with the request,
create a custom (depending on config: `zipkin.trace_id_generator`) or a
completely random trace id.
:param: current active pyramid request
:returns: a 64-bit hex string
"""
if 'X-B3-TraceId'... | [
"def",
"get_trace_id",
"(",
"request",
")",
":",
"if",
"'X-B3-TraceId'",
"in",
"request",
".",
"headers",
":",
"trace_id",
"=",
"_convert_signed_hex",
"(",
"request",
".",
"headers",
"[",
"'X-B3-TraceId'",
"]",
")",
"# Tolerates 128 bit X-B3-TraceId by reading the rig... | Gets the trace id based on a request. If not present with the request,
create a custom (depending on config: `zipkin.trace_id_generator`) or a
completely random trace id.
:param: current active pyramid request
:returns: a 64-bit hex string | [
"Gets",
"the",
"trace",
"id",
"based",
"on",
"a",
"request",
".",
"If",
"not",
"present",
"with",
"the",
"request",
"create",
"a",
"custom",
"(",
"depending",
"on",
"config",
":",
"zipkin",
".",
"trace_id_generator",
")",
"or",
"a",
"completely",
"random",... | train | https://github.com/Yelp/pyramid_zipkin/blob/ed8581b4466e9ce93d6cf3ecfbdde5369932a80b/pyramid_zipkin/request_helper.py#L15-L34 |
Yelp/pyramid_zipkin | pyramid_zipkin/request_helper.py | _convert_signed_hex | def _convert_signed_hex(s):
"""Takes a signed hex string that begins with '0x' and converts it to
a 16-character string representing an unsigned hex value.
Examples:
'0xd68adf75f4cfd13' => 'd68adf75f4cfd13'
'-0x3ab5151d76fb85e1' => 'c54aeae289047a1f'
"""
if s.startswith('0x') or s.st... | python | def _convert_signed_hex(s):
"""Takes a signed hex string that begins with '0x' and converts it to
a 16-character string representing an unsigned hex value.
Examples:
'0xd68adf75f4cfd13' => 'd68adf75f4cfd13'
'-0x3ab5151d76fb85e1' => 'c54aeae289047a1f'
"""
if s.startswith('0x') or s.st... | [
"def",
"_convert_signed_hex",
"(",
"s",
")",
":",
"if",
"s",
".",
"startswith",
"(",
"'0x'",
")",
"or",
"s",
".",
"startswith",
"(",
"'-0x'",
")",
":",
"s",
"=",
"'{0:x}'",
".",
"format",
"(",
"struct",
".",
"unpack",
"(",
"'Q'",
",",
"struct",
"."... | Takes a signed hex string that begins with '0x' and converts it to
a 16-character string representing an unsigned hex value.
Examples:
'0xd68adf75f4cfd13' => 'd68adf75f4cfd13'
'-0x3ab5151d76fb85e1' => 'c54aeae289047a1f' | [
"Takes",
"a",
"signed",
"hex",
"string",
"that",
"begins",
"with",
"0x",
"and",
"converts",
"it",
"to",
"a",
"16",
"-",
"character",
"string",
"representing",
"an",
"unsigned",
"hex",
"value",
".",
"Examples",
":",
"0xd68adf75f4cfd13",
"=",
">",
"d68adf75f4c... | train | https://github.com/Yelp/pyramid_zipkin/blob/ed8581b4466e9ce93d6cf3ecfbdde5369932a80b/pyramid_zipkin/request_helper.py#L37-L46 |
Yelp/pyramid_zipkin | pyramid_zipkin/request_helper.py | should_not_sample_path | def should_not_sample_path(request):
"""Decided whether current request path should be sampled or not. This is
checked previous to `should_not_sample_route` and takes precedence.
:param: current active pyramid request
:returns: boolean whether current request path is blacklisted.
"""
blackliste... | python | def should_not_sample_path(request):
"""Decided whether current request path should be sampled or not. This is
checked previous to `should_not_sample_route` and takes precedence.
:param: current active pyramid request
:returns: boolean whether current request path is blacklisted.
"""
blackliste... | [
"def",
"should_not_sample_path",
"(",
"request",
")",
":",
"blacklisted_paths",
"=",
"request",
".",
"registry",
".",
"settings",
".",
"get",
"(",
"'zipkin.blacklisted_paths'",
",",
"[",
"]",
")",
"# Only compile strings, since even recompiling existing",
"# compiled rege... | Decided whether current request path should be sampled or not. This is
checked previous to `should_not_sample_route` and takes precedence.
:param: current active pyramid request
:returns: boolean whether current request path is blacklisted. | [
"Decided",
"whether",
"current",
"request",
"path",
"should",
"be",
"sampled",
"or",
"not",
".",
"This",
"is",
"checked",
"previous",
"to",
"should_not_sample_route",
"and",
"takes",
"precedence",
"."
] | train | https://github.com/Yelp/pyramid_zipkin/blob/ed8581b4466e9ce93d6cf3ecfbdde5369932a80b/pyramid_zipkin/request_helper.py#L49-L64 |
Yelp/pyramid_zipkin | pyramid_zipkin/request_helper.py | should_not_sample_route | def should_not_sample_route(request):
"""Decided whether current request route should be sampled or not.
:param: current active pyramid request
:returns: boolean whether current request route is blacklisted.
"""
blacklisted_routes = request.registry.settings.get(
'zipkin.blacklisted_routes'... | python | def should_not_sample_route(request):
"""Decided whether current request route should be sampled or not.
:param: current active pyramid request
:returns: boolean whether current request route is blacklisted.
"""
blacklisted_routes = request.registry.settings.get(
'zipkin.blacklisted_routes'... | [
"def",
"should_not_sample_route",
"(",
"request",
")",
":",
"blacklisted_routes",
"=",
"request",
".",
"registry",
".",
"settings",
".",
"get",
"(",
"'zipkin.blacklisted_routes'",
",",
"[",
"]",
")",
"if",
"not",
"blacklisted_routes",
":",
"return",
"False",
"ro... | Decided whether current request route should be sampled or not.
:param: current active pyramid request
:returns: boolean whether current request route is blacklisted. | [
"Decided",
"whether",
"current",
"request",
"route",
"should",
"be",
"sampled",
"or",
"not",
"."
] | train | https://github.com/Yelp/pyramid_zipkin/blob/ed8581b4466e9ce93d6cf3ecfbdde5369932a80b/pyramid_zipkin/request_helper.py#L67-L80 |
Yelp/pyramid_zipkin | pyramid_zipkin/request_helper.py | is_tracing | def is_tracing(request):
"""Determine if zipkin should be tracing
1) Check whether the current request path is blacklisted.
2) If not, check whether the current request route is blacklisted.
3) If not, check if specific sampled header is present in the request.
4) If not, Use a tracing percent (defa... | python | def is_tracing(request):
"""Determine if zipkin should be tracing
1) Check whether the current request path is blacklisted.
2) If not, check whether the current request route is blacklisted.
3) If not, check if specific sampled header is present in the request.
4) If not, Use a tracing percent (defa... | [
"def",
"is_tracing",
"(",
"request",
")",
":",
"if",
"should_not_sample_path",
"(",
"request",
")",
":",
"return",
"False",
"elif",
"should_not_sample_route",
"(",
"request",
")",
":",
"return",
"False",
"elif",
"'X-B3-Sampled'",
"in",
"request",
".",
"headers",... | Determine if zipkin should be tracing
1) Check whether the current request path is blacklisted.
2) If not, check whether the current request route is blacklisted.
3) If not, check if specific sampled header is present in the request.
4) If not, Use a tracing percent (default: 0.5%) to decide.
:para... | [
"Determine",
"if",
"zipkin",
"should",
"be",
"tracing",
"1",
")",
"Check",
"whether",
"the",
"current",
"request",
"path",
"is",
"blacklisted",
".",
"2",
")",
"If",
"not",
"check",
"whether",
"the",
"current",
"request",
"route",
"is",
"blacklisted",
".",
... | train | https://github.com/Yelp/pyramid_zipkin/blob/ed8581b4466e9ce93d6cf3ecfbdde5369932a80b/pyramid_zipkin/request_helper.py#L93-L114 |
Yelp/pyramid_zipkin | pyramid_zipkin/request_helper.py | create_zipkin_attr | def create_zipkin_attr(request):
"""Create ZipkinAttrs object from a request with sampled flag as True.
Attaches lazy attribute `zipkin_trace_id` with request which is then used
throughout the tween.
Consumes custom is_tracing function to determine if the request is traced
if one is set in the pyra... | python | def create_zipkin_attr(request):
"""Create ZipkinAttrs object from a request with sampled flag as True.
Attaches lazy attribute `zipkin_trace_id` with request which is then used
throughout the tween.
Consumes custom is_tracing function to determine if the request is traced
if one is set in the pyra... | [
"def",
"create_zipkin_attr",
"(",
"request",
")",
":",
"settings",
"=",
"request",
".",
"registry",
".",
"settings",
"if",
"'zipkin.is_tracing'",
"in",
"settings",
":",
"is_sampled",
"=",
"settings",
"[",
"'zipkin.is_tracing'",
"]",
"(",
"request",
")",
"else",
... | Create ZipkinAttrs object from a request with sampled flag as True.
Attaches lazy attribute `zipkin_trace_id` with request which is then used
throughout the tween.
Consumes custom is_tracing function to determine if the request is traced
if one is set in the pyramid registry.
:param request: pyram... | [
"Create",
"ZipkinAttrs",
"object",
"from",
"a",
"request",
"with",
"sampled",
"flag",
"as",
"True",
".",
"Attaches",
"lazy",
"attribute",
"zipkin_trace_id",
"with",
"request",
"which",
"is",
"then",
"used",
"throughout",
"the",
"tween",
"."
] | train | https://github.com/Yelp/pyramid_zipkin/blob/ed8581b4466e9ce93d6cf3ecfbdde5369932a80b/pyramid_zipkin/request_helper.py#L117-L147 |
Yelp/pyramid_zipkin | pyramid_zipkin/request_helper.py | get_binary_annotations | def get_binary_annotations(request, response):
"""Helper method for getting all binary annotations from the request.
:param request: the Pyramid request object
:param response: the Pyramid response object
:returns: binary annotation dict of {str: str}
"""
route = request.matched_route.pattern i... | python | def get_binary_annotations(request, response):
"""Helper method for getting all binary annotations from the request.
:param request: the Pyramid request object
:param response: the Pyramid response object
:returns: binary annotation dict of {str: str}
"""
route = request.matched_route.pattern i... | [
"def",
"get_binary_annotations",
"(",
"request",
",",
"response",
")",
":",
"route",
"=",
"request",
".",
"matched_route",
".",
"pattern",
"if",
"request",
".",
"matched_route",
"else",
"''",
"annotations",
"=",
"{",
"'http.uri'",
":",
"request",
".",
"path",
... | Helper method for getting all binary annotations from the request.
:param request: the Pyramid request object
:param response: the Pyramid response object
:returns: binary annotation dict of {str: str} | [
"Helper",
"method",
"for",
"getting",
"all",
"binary",
"annotations",
"from",
"the",
"request",
"."
] | train | https://github.com/Yelp/pyramid_zipkin/blob/ed8581b4466e9ce93d6cf3ecfbdde5369932a80b/pyramid_zipkin/request_helper.py#L150-L170 |
Hundemeier/sacn | sacn/messages/data_packet.py | DataPacket.dmxData | def dmxData(self, data: tuple):
"""
For legacy devices and to prevent errors, the length of the DMX data is normalized to 512
"""
newData = [0]*512
for i in range(0, min(len(data), 512)):
newData[i] = data[i]
self._dmxData = tuple(newData)
# in theory ... | python | def dmxData(self, data: tuple):
"""
For legacy devices and to prevent errors, the length of the DMX data is normalized to 512
"""
newData = [0]*512
for i in range(0, min(len(data), 512)):
newData[i] = data[i]
self._dmxData = tuple(newData)
# in theory ... | [
"def",
"dmxData",
"(",
"self",
",",
"data",
":",
"tuple",
")",
":",
"newData",
"=",
"[",
"0",
"]",
"*",
"512",
"for",
"i",
"in",
"range",
"(",
"0",
",",
"min",
"(",
"len",
"(",
"data",
")",
",",
"512",
")",
")",
":",
"newData",
"[",
"i",
"]... | For legacy devices and to prevent errors, the length of the DMX data is normalized to 512 | [
"For",
"legacy",
"devices",
"and",
"to",
"prevent",
"errors",
"the",
"length",
"of",
"the",
"DMX",
"data",
"is",
"normalized",
"to",
"512"
] | train | https://github.com/Hundemeier/sacn/blob/f08bf3d7554a1ed2870f23a9e0e7b89a4a509231/sacn/messages/data_packet.py#L69-L78 |
Hundemeier/sacn | sacn/messages/data_packet.py | DataPacket.make_data_packet | def make_data_packet(raw_data) -> 'DataPacket':
"""
Converts raw byte data to a sACN DataPacket. Note that the raw bytes have to come from a 2016 sACN Message.
This does not support Sync Addresses, Force_Sync option and DMX Start code!
:param raw_data: raw bytes as tuple or list
... | python | def make_data_packet(raw_data) -> 'DataPacket':
"""
Converts raw byte data to a sACN DataPacket. Note that the raw bytes have to come from a 2016 sACN Message.
This does not support Sync Addresses, Force_Sync option and DMX Start code!
:param raw_data: raw bytes as tuple or list
... | [
"def",
"make_data_packet",
"(",
"raw_data",
")",
"->",
"'DataPacket'",
":",
"# Check if the length is sufficient",
"if",
"len",
"(",
"raw_data",
")",
"<",
"126",
":",
"raise",
"TypeError",
"(",
"'The length of the provided data is not long enough! Min length is 126!'",
")",... | Converts raw byte data to a sACN DataPacket. Note that the raw bytes have to come from a 2016 sACN Message.
This does not support Sync Addresses, Force_Sync option and DMX Start code!
:param raw_data: raw bytes as tuple or list
:return: a DataPacket with the properties set like the raw bytes | [
"Converts",
"raw",
"byte",
"data",
"to",
"a",
"sACN",
"DataPacket",
".",
"Note",
"that",
"the",
"raw",
"bytes",
"have",
"to",
"come",
"from",
"a",
"2016",
"sACN",
"Message",
".",
"This",
"does",
"not",
"support",
"Sync",
"Addresses",
"Force_Sync",
"option"... | train | https://github.com/Hundemeier/sacn/blob/f08bf3d7554a1ed2870f23a9e0e7b89a4a509231/sacn/messages/data_packet.py#L124-L148 |
Hundemeier/sacn | sacn/messages/root_layer.py | RootLayer.getBytes | def getBytes(self) -> list:
'''Returns the Root layer as list with bytes'''
tmpList = []
tmpList.extend(_FIRST_INDEX)
# first append the high byte from the Flags and Length
# high 4 bit: 0x7 then the bits 8-11(indexes) from _length
length = self.length - 16
tmpLis... | python | def getBytes(self) -> list:
'''Returns the Root layer as list with bytes'''
tmpList = []
tmpList.extend(_FIRST_INDEX)
# first append the high byte from the Flags and Length
# high 4 bit: 0x7 then the bits 8-11(indexes) from _length
length = self.length - 16
tmpLis... | [
"def",
"getBytes",
"(",
"self",
")",
"->",
"list",
":",
"tmpList",
"=",
"[",
"]",
"tmpList",
".",
"extend",
"(",
"_FIRST_INDEX",
")",
"# first append the high byte from the Flags and Length",
"# high 4 bit: 0x7 then the bits 8-11(indexes) from _length",
"length",
"=",
"se... | Returns the Root layer as list with bytes | [
"Returns",
"the",
"Root",
"layer",
"as",
"list",
"with",
"bytes"
] | train | https://github.com/Hundemeier/sacn/blob/f08bf3d7554a1ed2870f23a9e0e7b89a4a509231/sacn/messages/root_layer.py#L33-L46 |
MycroftAI/mycroft-skills-manager | msm/mycroft_skills_manager.py | MycroftSkillsManager.curate_skills_data | def curate_skills_data(self, skills_data):
""" Sync skills_data with actual skills on disk. """
local_skills = [s for s in self.list() if s.is_local]
default_skills = [s.name for s in self.list_defaults()]
local_skill_names = [s.name for s in local_skills]
skills_data_skills = [s... | python | def curate_skills_data(self, skills_data):
""" Sync skills_data with actual skills on disk. """
local_skills = [s for s in self.list() if s.is_local]
default_skills = [s.name for s in self.list_defaults()]
local_skill_names = [s.name for s in local_skills]
skills_data_skills = [s... | [
"def",
"curate_skills_data",
"(",
"self",
",",
"skills_data",
")",
":",
"local_skills",
"=",
"[",
"s",
"for",
"s",
"in",
"self",
".",
"list",
"(",
")",
"if",
"s",
".",
"is_local",
"]",
"default_skills",
"=",
"[",
"s",
".",
"name",
"for",
"s",
"in",
... | Sync skills_data with actual skills on disk. | [
"Sync",
"skills_data",
"with",
"actual",
"skills",
"on",
"disk",
"."
] | train | https://github.com/MycroftAI/mycroft-skills-manager/blob/5acef240de42e8ceae2e82bc7492ffee33288b00/msm/mycroft_skills_manager.py#L118-L145 |
MycroftAI/mycroft-skills-manager | msm/mycroft_skills_manager.py | MycroftSkillsManager.sync_skills_data | def sync_skills_data(self):
""" Update internal skill_data_structure from disk. """
self.skills_data = self.load_skills_data()
if 'upgraded' in self.skills_data:
self.skills_data.pop('upgraded')
else:
self.skills_data_hash = skills_data_hash(self.skills_data) | python | def sync_skills_data(self):
""" Update internal skill_data_structure from disk. """
self.skills_data = self.load_skills_data()
if 'upgraded' in self.skills_data:
self.skills_data.pop('upgraded')
else:
self.skills_data_hash = skills_data_hash(self.skills_data) | [
"def",
"sync_skills_data",
"(",
"self",
")",
":",
"self",
".",
"skills_data",
"=",
"self",
".",
"load_skills_data",
"(",
")",
"if",
"'upgraded'",
"in",
"self",
".",
"skills_data",
":",
"self",
".",
"skills_data",
".",
"pop",
"(",
"'upgraded'",
")",
"else",... | Update internal skill_data_structure from disk. | [
"Update",
"internal",
"skill_data_structure",
"from",
"disk",
"."
] | train | https://github.com/MycroftAI/mycroft-skills-manager/blob/5acef240de42e8ceae2e82bc7492ffee33288b00/msm/mycroft_skills_manager.py#L155-L161 |
MycroftAI/mycroft-skills-manager | msm/mycroft_skills_manager.py | MycroftSkillsManager.write_skills_data | def write_skills_data(self, data=None):
""" Write skills data hash if it has been modified. """
data = data or self.skills_data
if skills_data_hash(data) != self.skills_data_hash:
write_skills_data(data)
self.skills_data_hash = skills_data_hash(data) | python | def write_skills_data(self, data=None):
""" Write skills data hash if it has been modified. """
data = data or self.skills_data
if skills_data_hash(data) != self.skills_data_hash:
write_skills_data(data)
self.skills_data_hash = skills_data_hash(data) | [
"def",
"write_skills_data",
"(",
"self",
",",
"data",
"=",
"None",
")",
":",
"data",
"=",
"data",
"or",
"self",
".",
"skills_data",
"if",
"skills_data_hash",
"(",
"data",
")",
"!=",
"self",
".",
"skills_data_hash",
":",
"write_skills_data",
"(",
"data",
")... | Write skills data hash if it has been modified. | [
"Write",
"skills",
"data",
"hash",
"if",
"it",
"has",
"been",
"modified",
"."
] | train | https://github.com/MycroftAI/mycroft-skills-manager/blob/5acef240de42e8ceae2e82bc7492ffee33288b00/msm/mycroft_skills_manager.py#L163-L168 |
MycroftAI/mycroft-skills-manager | msm/mycroft_skills_manager.py | MycroftSkillsManager.install | def install(self, param, author=None, constraints=None, origin=''):
"""Install by url or name"""
if isinstance(param, SkillEntry):
skill = param
else:
skill = self.find_skill(param, author)
entry = build_skill_entry(skill.name, origin, skill.is_beta)
try:
... | python | def install(self, param, author=None, constraints=None, origin=''):
"""Install by url or name"""
if isinstance(param, SkillEntry):
skill = param
else:
skill = self.find_skill(param, author)
entry = build_skill_entry(skill.name, origin, skill.is_beta)
try:
... | [
"def",
"install",
"(",
"self",
",",
"param",
",",
"author",
"=",
"None",
",",
"constraints",
"=",
"None",
",",
"origin",
"=",
"''",
")",
":",
"if",
"isinstance",
"(",
"param",
",",
"SkillEntry",
")",
":",
"skill",
"=",
"param",
"else",
":",
"skill",
... | Install by url or name | [
"Install",
"by",
"url",
"or",
"name"
] | train | https://github.com/MycroftAI/mycroft-skills-manager/blob/5acef240de42e8ceae2e82bc7492ffee33288b00/msm/mycroft_skills_manager.py#L171-L195 |
MycroftAI/mycroft-skills-manager | msm/mycroft_skills_manager.py | MycroftSkillsManager.remove | def remove(self, param, author=None):
"""Remove by url or name"""
if isinstance(param, SkillEntry):
skill = param
else:
skill = self.find_skill(param, author)
skill.remove()
skills = [s for s in self.skills_data['skills']
if s['name'] != ... | python | def remove(self, param, author=None):
"""Remove by url or name"""
if isinstance(param, SkillEntry):
skill = param
else:
skill = self.find_skill(param, author)
skill.remove()
skills = [s for s in self.skills_data['skills']
if s['name'] != ... | [
"def",
"remove",
"(",
"self",
",",
"param",
",",
"author",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"param",
",",
"SkillEntry",
")",
":",
"skill",
"=",
"param",
"else",
":",
"skill",
"=",
"self",
".",
"find_skill",
"(",
"param",
",",
"author",... | Remove by url or name | [
"Remove",
"by",
"url",
"or",
"name"
] | train | https://github.com/MycroftAI/mycroft-skills-manager/blob/5acef240de42e8ceae2e82bc7492ffee33288b00/msm/mycroft_skills_manager.py#L198-L208 |
MycroftAI/mycroft-skills-manager | msm/mycroft_skills_manager.py | MycroftSkillsManager.update | def update(self, skill=None, author=None):
"""Update all downloaded skills or one specified skill."""
if skill is None:
return self.update_all()
else:
if isinstance(skill, str):
skill = self.find_skill(skill, author)
entry = get_skill_entry(ski... | python | def update(self, skill=None, author=None):
"""Update all downloaded skills or one specified skill."""
if skill is None:
return self.update_all()
else:
if isinstance(skill, str):
skill = self.find_skill(skill, author)
entry = get_skill_entry(ski... | [
"def",
"update",
"(",
"self",
",",
"skill",
"=",
"None",
",",
"author",
"=",
"None",
")",
":",
"if",
"skill",
"is",
"None",
":",
"return",
"self",
".",
"update_all",
"(",
")",
"else",
":",
"if",
"isinstance",
"(",
"skill",
",",
"str",
")",
":",
"... | Update all downloaded skills or one specified skill. | [
"Update",
"all",
"downloaded",
"skills",
"or",
"one",
"specified",
"skill",
"."
] | train | https://github.com/MycroftAI/mycroft-skills-manager/blob/5acef240de42e8ceae2e82bc7492ffee33288b00/msm/mycroft_skills_manager.py#L224-L237 |
MycroftAI/mycroft-skills-manager | msm/mycroft_skills_manager.py | MycroftSkillsManager.apply | def apply(self, func, skills):
"""Run a function on all skills in parallel"""
def run_item(skill):
try:
func(skill)
return True
except MsmException as e:
LOG.error('Error running {} on {}: {}'.format(
func.__nam... | python | def apply(self, func, skills):
"""Run a function on all skills in parallel"""
def run_item(skill):
try:
func(skill)
return True
except MsmException as e:
LOG.error('Error running {} on {}: {}'.format(
func.__nam... | [
"def",
"apply",
"(",
"self",
",",
"func",
",",
"skills",
")",
":",
"def",
"run_item",
"(",
"skill",
")",
":",
"try",
":",
"func",
"(",
"skill",
")",
"return",
"True",
"except",
"MsmException",
"as",
"e",
":",
"LOG",
".",
"error",
"(",
"'Error running... | Run a function on all skills in parallel | [
"Run",
"a",
"function",
"on",
"all",
"skills",
"in",
"parallel"
] | train | https://github.com/MycroftAI/mycroft-skills-manager/blob/5acef240de42e8ceae2e82bc7492ffee33288b00/msm/mycroft_skills_manager.py#L240-L258 |
MycroftAI/mycroft-skills-manager | msm/mycroft_skills_manager.py | MycroftSkillsManager.install_defaults | def install_defaults(self):
"""Installs the default skills, updates all others"""
def install_or_update_skill(skill):
if skill.is_local:
self.update(skill)
else:
self.install(skill, origin='default')
return self.apply(install_or_update_sk... | python | def install_defaults(self):
"""Installs the default skills, updates all others"""
def install_or_update_skill(skill):
if skill.is_local:
self.update(skill)
else:
self.install(skill, origin='default')
return self.apply(install_or_update_sk... | [
"def",
"install_defaults",
"(",
"self",
")",
":",
"def",
"install_or_update_skill",
"(",
"skill",
")",
":",
"if",
"skill",
".",
"is_local",
":",
"self",
".",
"update",
"(",
"skill",
")",
"else",
":",
"self",
".",
"install",
"(",
"skill",
",",
"origin",
... | Installs the default skills, updates all others | [
"Installs",
"the",
"default",
"skills",
"updates",
"all",
"others"
] | train | https://github.com/MycroftAI/mycroft-skills-manager/blob/5acef240de42e8ceae2e82bc7492ffee33288b00/msm/mycroft_skills_manager.py#L261-L270 |
MycroftAI/mycroft-skills-manager | msm/mycroft_skills_manager.py | MycroftSkillsManager.list_all_defaults | def list_all_defaults(self): # type: () -> Dict[str, List[SkillEntry]]
"""Returns {'skill_group': [SkillEntry('name')]}"""
skills = self.list()
name_to_skill = {skill.name: skill for skill in skills}
defaults = {group: [] for group in self.SKILL_GROUPS}
for section_name, skill_... | python | def list_all_defaults(self): # type: () -> Dict[str, List[SkillEntry]]
"""Returns {'skill_group': [SkillEntry('name')]}"""
skills = self.list()
name_to_skill = {skill.name: skill for skill in skills}
defaults = {group: [] for group in self.SKILL_GROUPS}
for section_name, skill_... | [
"def",
"list_all_defaults",
"(",
"self",
")",
":",
"# type: () -> Dict[str, List[SkillEntry]]",
"skills",
"=",
"self",
".",
"list",
"(",
")",
"name_to_skill",
"=",
"{",
"skill",
".",
"name",
":",
"skill",
"for",
"skill",
"in",
"skills",
"}",
"defaults",
"=",
... | Returns {'skill_group': [SkillEntry('name')]} | [
"Returns",
"{",
"skill_group",
":",
"[",
"SkillEntry",
"(",
"name",
")",
"]",
"}"
] | train | https://github.com/MycroftAI/mycroft-skills-manager/blob/5acef240de42e8ceae2e82bc7492ffee33288b00/msm/mycroft_skills_manager.py#L272-L287 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.