repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
listlengths
20
707
docstring
stringlengths
3
17.3k
docstring_tokens
listlengths
3
222
sha
stringlengths
40
40
url
stringlengths
87
242
partition
stringclasses
1 value
idx
int64
0
252k
woolfson-group/isambard
isambard/ampal/specifications/assembly_specs/nucleic_acid_duplex.py
DNADuplex.from_sequence
def from_sequence(cls, sequence, phos_3_prime=False): """Creates a DNA duplex from a nucleotide sequence. Parameters ---------- sequence: str Nucleotide sequence. phos_3_prime: bool, optional If false the 5' and the 3' phosphor will be omitted. ""...
python
def from_sequence(cls, sequence, phos_3_prime=False): """Creates a DNA duplex from a nucleotide sequence. Parameters ---------- sequence: str Nucleotide sequence. phos_3_prime: bool, optional If false the 5' and the 3' phosphor will be omitted. ""...
[ "def", "from_sequence", "(", "cls", ",", "sequence", ",", "phos_3_prime", "=", "False", ")", ":", "strand1", "=", "NucleicAcidStrand", "(", "sequence", ",", "phos_3_prime", "=", "phos_3_prime", ")", "duplex", "=", "cls", "(", "strand1", ")", "return", "duple...
Creates a DNA duplex from a nucleotide sequence. Parameters ---------- sequence: str Nucleotide sequence. phos_3_prime: bool, optional If false the 5' and the 3' phosphor will be omitted.
[ "Creates", "a", "DNA", "duplex", "from", "a", "nucleotide", "sequence", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/specifications/assembly_specs/nucleic_acid_duplex.py#L34-L46
train
60,000
woolfson-group/isambard
isambard/ampal/specifications/assembly_specs/nucleic_acid_duplex.py
DNADuplex.from_start_and_end
def from_start_and_end(cls, start, end, sequence, phos_3_prime=False): """Creates a DNA duplex from a start and end point. Parameters ---------- start: [float, float, float] Start of the build axis. end: [float, float, float] End o...
python
def from_start_and_end(cls, start, end, sequence, phos_3_prime=False): """Creates a DNA duplex from a start and end point. Parameters ---------- start: [float, float, float] Start of the build axis. end: [float, float, float] End o...
[ "def", "from_start_and_end", "(", "cls", ",", "start", ",", "end", ",", "sequence", ",", "phos_3_prime", "=", "False", ")", ":", "strand1", "=", "NucleicAcidStrand", ".", "from_start_and_end", "(", "start", ",", "end", ",", "sequence", ",", "phos_3_prime", "...
Creates a DNA duplex from a start and end point. Parameters ---------- start: [float, float, float] Start of the build axis. end: [float, float, float] End of build axis. sequence: str Nucleotide sequence. ...
[ "Creates", "a", "DNA", "duplex", "from", "a", "start", "and", "end", "point", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/specifications/assembly_specs/nucleic_acid_duplex.py#L49-L65
train
60,001
woolfson-group/isambard
isambard/ampal/specifications/assembly_specs/nucleic_acid_duplex.py
DNADuplex.generate_complementary_strand
def generate_complementary_strand(strand1): """Takes a SingleStrandHelix and creates the antisense strand.""" rise_adjust = ( strand1.rise_per_nucleotide * strand1.axis.unit_tangent) * 2 strand2 = NucleicAcidStrand.from_start_and_end( strand1.helix_end - rise_adjust, stra...
python
def generate_complementary_strand(strand1): """Takes a SingleStrandHelix and creates the antisense strand.""" rise_adjust = ( strand1.rise_per_nucleotide * strand1.axis.unit_tangent) * 2 strand2 = NucleicAcidStrand.from_start_and_end( strand1.helix_end - rise_adjust, stra...
[ "def", "generate_complementary_strand", "(", "strand1", ")", ":", "rise_adjust", "=", "(", "strand1", ".", "rise_per_nucleotide", "*", "strand1", ".", "axis", ".", "unit_tangent", ")", "*", "2", "strand2", "=", "NucleicAcidStrand", ".", "from_start_and_end", "(", ...
Takes a SingleStrandHelix and creates the antisense strand.
[ "Takes", "a", "SingleStrandHelix", "and", "creates", "the", "antisense", "strand", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/specifications/assembly_specs/nucleic_acid_duplex.py#L68-L82
train
60,002
woolfson-group/isambard
isambard/external_programs/naccess.py
total_accessibility
def total_accessibility(in_rsa, path=True): """Parses rsa file for the total surface accessibility data. Parameters ---------- in_rsa : str Path to naccess rsa file. path : bool Indicates if in_rsa is a path or a string. Returns ------- dssp_residues : 5-tuple(float) ...
python
def total_accessibility(in_rsa, path=True): """Parses rsa file for the total surface accessibility data. Parameters ---------- in_rsa : str Path to naccess rsa file. path : bool Indicates if in_rsa is a path or a string. Returns ------- dssp_residues : 5-tuple(float) ...
[ "def", "total_accessibility", "(", "in_rsa", ",", "path", "=", "True", ")", ":", "if", "path", ":", "with", "open", "(", "in_rsa", ",", "'r'", ")", "as", "inf", ":", "rsa", "=", "inf", ".", "read", "(", ")", "else", ":", "rsa", "=", "in_rsa", "["...
Parses rsa file for the total surface accessibility data. Parameters ---------- in_rsa : str Path to naccess rsa file. path : bool Indicates if in_rsa is a path or a string. Returns ------- dssp_residues : 5-tuple(float) Total accessibility values for: [0] a...
[ "Parses", "rsa", "file", "for", "the", "total", "surface", "accessibility", "data", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/external_programs/naccess.py#L77-L105
train
60,003
woolfson-group/isambard
isambard/tools/amino_acids.py
get_aa_code
def get_aa_code(aa_letter): """ Get three-letter aa code if possible. If not, return None. If three-letter code is None, will have to find this later from the filesystem. Parameters ---------- aa_letter : str One-letter amino acid code. Returns ------- aa_code : str, or None ...
python
def get_aa_code(aa_letter): """ Get three-letter aa code if possible. If not, return None. If three-letter code is None, will have to find this later from the filesystem. Parameters ---------- aa_letter : str One-letter amino acid code. Returns ------- aa_code : str, or None ...
[ "def", "get_aa_code", "(", "aa_letter", ")", ":", "aa_code", "=", "None", "if", "aa_letter", "!=", "'X'", ":", "for", "key", ",", "val", "in", "standard_amino_acids", ".", "items", "(", ")", ":", "if", "key", "==", "aa_letter", ":", "aa_code", "=", "va...
Get three-letter aa code if possible. If not, return None. If three-letter code is None, will have to find this later from the filesystem. Parameters ---------- aa_letter : str One-letter amino acid code. Returns ------- aa_code : str, or None Three-letter aa code.
[ "Get", "three", "-", "letter", "aa", "code", "if", "possible", ".", "If", "not", "return", "None", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/tools/amino_acids.py#L308-L328
train
60,004
woolfson-group/isambard
isambard/tools/amino_acids.py
get_aa_letter
def get_aa_letter(aa_code): """ Get one-letter version of aa_code if possible. If not, return 'X'. Parameters ---------- aa_code : str Three-letter amino acid code. Returns ------- aa_letter : str One-letter aa code. Default value is 'X'. """ aa_letter = 'X'...
python
def get_aa_letter(aa_code): """ Get one-letter version of aa_code if possible. If not, return 'X'. Parameters ---------- aa_code : str Three-letter amino acid code. Returns ------- aa_letter : str One-letter aa code. Default value is 'X'. """ aa_letter = 'X'...
[ "def", "get_aa_letter", "(", "aa_code", ")", ":", "aa_letter", "=", "'X'", "for", "key", ",", "val", "in", "standard_amino_acids", ".", "items", "(", ")", ":", "if", "val", "==", "aa_code", ":", "aa_letter", "=", "key", "return", "aa_letter" ]
Get one-letter version of aa_code if possible. If not, return 'X'. Parameters ---------- aa_code : str Three-letter amino acid code. Returns ------- aa_letter : str One-letter aa code. Default value is 'X'.
[ "Get", "one", "-", "letter", "version", "of", "aa_code", "if", "possible", ".", "If", "not", "return", "X", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/tools/amino_acids.py#L331-L350
train
60,005
woolfson-group/isambard
isambard/tools/amino_acids.py
get_aa_info
def get_aa_info(code): """Get dictionary of information relating to a new amino acid code not currently in the database. Notes ----- Use this function to get a dictionary that is then to be sent to the function add_amino_acid_to_json(). use to fill in rows of amino_acid table for new amino acid cod...
python
def get_aa_info(code): """Get dictionary of information relating to a new amino acid code not currently in the database. Notes ----- Use this function to get a dictionary that is then to be sent to the function add_amino_acid_to_json(). use to fill in rows of amino_acid table for new amino acid cod...
[ "def", "get_aa_info", "(", "code", ")", ":", "letter", "=", "'X'", "# Try to get content from PDBE.", "url_string", "=", "'http://www.ebi.ac.uk/pdbe-srv/pdbechem/chemicalCompound/show/{0}'", ".", "format", "(", "code", ")", "r", "=", "requests", ".", "get", "(", "url_...
Get dictionary of information relating to a new amino acid code not currently in the database. Notes ----- Use this function to get a dictionary that is then to be sent to the function add_amino_acid_to_json(). use to fill in rows of amino_acid table for new amino acid code. Parameters -------...
[ "Get", "dictionary", "of", "information", "relating", "to", "a", "new", "amino", "acid", "code", "not", "currently", "in", "the", "database", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/tools/amino_acids.py#L353-L394
train
60,006
woolfson-group/isambard
isambard/tools/amino_acids.py
add_amino_acid_to_json
def add_amino_acid_to_json(code, description, letter='X', modified=None, force_add=False): """ Add an amino acid to the amino_acids.json file used to populate the amino_acid table. Parameters ---------- code : str New code to be added to amino acid table. description : str Descripti...
python
def add_amino_acid_to_json(code, description, letter='X', modified=None, force_add=False): """ Add an amino acid to the amino_acids.json file used to populate the amino_acid table. Parameters ---------- code : str New code to be added to amino acid table. description : str Descripti...
[ "def", "add_amino_acid_to_json", "(", "code", ",", "description", ",", "letter", "=", "'X'", ",", "modified", "=", "None", ",", "force_add", "=", "False", ")", ":", "# If code is already in the dictionary, raise an error", "if", "(", "not", "force_add", ")", "and"...
Add an amino acid to the amino_acids.json file used to populate the amino_acid table. Parameters ---------- code : str New code to be added to amino acid table. description : str Description of the amino acid, e.g. 'amidated terminal carboxy group'. letter : str, optional On...
[ "Add", "an", "amino", "acid", "to", "the", "amino_acids", ".", "json", "file", "used", "to", "populate", "the", "amino_acid", "table", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/tools/amino_acids.py#L397-L442
train
60,007
woolfson-group/isambard
isambard/ampal/specifications/assembly_specs/coiledcoil.py
CoiledCoil.from_polymers
def from_polymers(cls, polymers): """Creates a `CoiledCoil` from a list of `HelicalHelices`. Parameters ---------- polymers : [HelicalHelix] List of `HelicalHelices`. """ n = len(polymers) instance = cls(n=n, auto_build=False) instance.major_r...
python
def from_polymers(cls, polymers): """Creates a `CoiledCoil` from a list of `HelicalHelices`. Parameters ---------- polymers : [HelicalHelix] List of `HelicalHelices`. """ n = len(polymers) instance = cls(n=n, auto_build=False) instance.major_r...
[ "def", "from_polymers", "(", "cls", ",", "polymers", ")", ":", "n", "=", "len", "(", "polymers", ")", "instance", "=", "cls", "(", "n", "=", "n", ",", "auto_build", "=", "False", ")", "instance", ".", "major_radii", "=", "[", "x", ".", "major_radius"...
Creates a `CoiledCoil` from a list of `HelicalHelices`. Parameters ---------- polymers : [HelicalHelix] List of `HelicalHelices`.
[ "Creates", "a", "CoiledCoil", "from", "a", "list", "of", "HelicalHelices", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/specifications/assembly_specs/coiledcoil.py#L109-L128
train
60,008
woolfson-group/isambard
isambard/ampal/specifications/assembly_specs/coiledcoil.py
CoiledCoil.from_parameters
def from_parameters(cls, n, aa=28, major_radius=None, major_pitch=None, phi_c_alpha=26.42, minor_helix_type='alpha', auto_build=True): """Creates a `CoiledCoil` from defined super-helical parameters. Parameters ---------- n : int ...
python
def from_parameters(cls, n, aa=28, major_radius=None, major_pitch=None, phi_c_alpha=26.42, minor_helix_type='alpha', auto_build=True): """Creates a `CoiledCoil` from defined super-helical parameters. Parameters ---------- n : int ...
[ "def", "from_parameters", "(", "cls", ",", "n", ",", "aa", "=", "28", ",", "major_radius", "=", "None", ",", "major_pitch", "=", "None", ",", "phi_c_alpha", "=", "26.42", ",", "minor_helix_type", "=", "'alpha'", ",", "auto_build", "=", "True", ")", ":", ...
Creates a `CoiledCoil` from defined super-helical parameters. Parameters ---------- n : int Oligomeric state aa : int, optional Number of amino acids per minor helix. major_radius : float, optional Radius of super helix. major_pitch : ...
[ "Creates", "a", "CoiledCoil", "from", "defined", "super", "-", "helical", "parameters", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/specifications/assembly_specs/coiledcoil.py#L131-L165
train
60,009
woolfson-group/isambard
isambard/ampal/specifications/assembly_specs/coiledcoil.py
CoiledCoil.tropocollagen
def tropocollagen( cls, aa=28, major_radius=5.0, major_pitch=85.0, auto_build=True): """Creates a model of a collagen triple helix. Parameters ---------- aa : int, optional Number of amino acids per minor helix. major_radius : float, optional ...
python
def tropocollagen( cls, aa=28, major_radius=5.0, major_pitch=85.0, auto_build=True): """Creates a model of a collagen triple helix. Parameters ---------- aa : int, optional Number of amino acids per minor helix. major_radius : float, optional ...
[ "def", "tropocollagen", "(", "cls", ",", "aa", "=", "28", ",", "major_radius", "=", "5.0", ",", "major_pitch", "=", "85.0", ",", "auto_build", "=", "True", ")", ":", "instance", "=", "cls", ".", "from_parameters", "(", "n", "=", "3", ",", "aa", "=", ...
Creates a model of a collagen triple helix. Parameters ---------- aa : int, optional Number of amino acids per minor helix. major_radius : float, optional Radius of super helix. major_pitch : float, optional Pitch of super helix. auto_...
[ "Creates", "a", "model", "of", "a", "collagen", "triple", "helix", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/specifications/assembly_specs/coiledcoil.py#L168-L193
train
60,010
woolfson-group/isambard
isambard/ampal/specifications/assembly_specs/coiledcoil.py
CoiledCoil.build
def build(self): """Builds a model of a coiled coil protein using input parameters.""" monomers = [HelicalHelix(major_pitch=self.major_pitches[i], major_radius=self.major_radii[i], major_handedness=self.major_handedness[i], ...
python
def build(self): """Builds a model of a coiled coil protein using input parameters.""" monomers = [HelicalHelix(major_pitch=self.major_pitches[i], major_radius=self.major_radii[i], major_handedness=self.major_handedness[i], ...
[ "def", "build", "(", "self", ")", ":", "monomers", "=", "[", "HelicalHelix", "(", "major_pitch", "=", "self", ".", "major_pitches", "[", "i", "]", ",", "major_radius", "=", "self", ".", "major_radii", "[", "i", "]", ",", "major_handedness", "=", "self", ...
Builds a model of a coiled coil protein using input parameters.
[ "Builds", "a", "model", "of", "a", "coiled", "coil", "protein", "using", "input", "parameters", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/specifications/assembly_specs/coiledcoil.py#L195-L215
train
60,011
woolfson-group/isambard
isambard/buff/force_field.py
BuffForceField.find_max_rad_npnp
def find_max_rad_npnp(self): """Finds the maximum radius and npnp in the force field. Returns ------- (max_rad, max_npnp): (float, float) Maximum radius and npnp distance in the loaded force field. """ max_rad = 0 max_npnp = 0 for res, atoms i...
python
def find_max_rad_npnp(self): """Finds the maximum radius and npnp in the force field. Returns ------- (max_rad, max_npnp): (float, float) Maximum radius and npnp distance in the loaded force field. """ max_rad = 0 max_npnp = 0 for res, atoms i...
[ "def", "find_max_rad_npnp", "(", "self", ")", ":", "max_rad", "=", "0", "max_npnp", "=", "0", "for", "res", ",", "atoms", "in", "self", ".", "items", "(", ")", ":", "if", "res", "!=", "'KEY'", ":", "for", "atom", ",", "ff_params", "in", "self", "["...
Finds the maximum radius and npnp in the force field. Returns ------- (max_rad, max_npnp): (float, float) Maximum radius and npnp distance in the loaded force field.
[ "Finds", "the", "maximum", "radius", "and", "npnp", "in", "the", "force", "field", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/buff/force_field.py#L70-L87
train
60,012
woolfson-group/isambard
isambard/buff/force_field.py
BuffForceField.parameter_struct_dict
def parameter_struct_dict(self): """Dictionary containing PyAtomData structs for the force field.""" if self._parameter_struct_dict is None: self._parameter_struct_dict = self._make_ff_params_dict() elif self.auto_update_f_params: new_hash = hash( tuple([t...
python
def parameter_struct_dict(self): """Dictionary containing PyAtomData structs for the force field.""" if self._parameter_struct_dict is None: self._parameter_struct_dict = self._make_ff_params_dict() elif self.auto_update_f_params: new_hash = hash( tuple([t...
[ "def", "parameter_struct_dict", "(", "self", ")", ":", "if", "self", ".", "_parameter_struct_dict", "is", "None", ":", "self", ".", "_parameter_struct_dict", "=", "self", ".", "_make_ff_params_dict", "(", ")", "elif", "self", ".", "auto_update_f_params", ":", "n...
Dictionary containing PyAtomData structs for the force field.
[ "Dictionary", "containing", "PyAtomData", "structs", "for", "the", "force", "field", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/buff/force_field.py#L90-L102
train
60,013
woolfson-group/isambard
isambard/external_programs/reduce.py
run_reduce
def run_reduce(input_file, path=True): """ Runs reduce on a pdb or mmol file at the specified path. Notes ----- Runs Reduce programme to add missing protons to a PDB file. Parameters ---------- input_file : str Path to file to add protons to or structure in mmol/pdb format. pat...
python
def run_reduce(input_file, path=True): """ Runs reduce on a pdb or mmol file at the specified path. Notes ----- Runs Reduce programme to add missing protons to a PDB file. Parameters ---------- input_file : str Path to file to add protons to or structure in mmol/pdb format. pat...
[ "def", "run_reduce", "(", "input_file", ",", "path", "=", "True", ")", ":", "if", "path", ":", "input_path", "=", "Path", "(", "input_file", ")", "if", "not", "input_path", ".", "exists", "(", ")", ":", "print", "(", "'No file found at'", ",", "path", ...
Runs reduce on a pdb or mmol file at the specified path. Notes ----- Runs Reduce programme to add missing protons to a PDB file. Parameters ---------- input_file : str Path to file to add protons to or structure in mmol/pdb format. path : bool, optional True if input_file i...
[ "Runs", "reduce", "on", "a", "pdb", "or", "mmol", "file", "at", "the", "specified", "path", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/external_programs/reduce.py#L23-L86
train
60,014
woolfson-group/isambard
isambard/external_programs/reduce.py
reduce_output_path
def reduce_output_path(path=None, pdb_name=None): """Defines location of Reduce output files relative to input files.""" if not path: if not pdb_name: raise NameError( "Cannot save an output for a temporary file without a PDB" "code specified") pdb_nam...
python
def reduce_output_path(path=None, pdb_name=None): """Defines location of Reduce output files relative to input files.""" if not path: if not pdb_name: raise NameError( "Cannot save an output for a temporary file without a PDB" "code specified") pdb_nam...
[ "def", "reduce_output_path", "(", "path", "=", "None", ",", "pdb_name", "=", "None", ")", ":", "if", "not", "path", ":", "if", "not", "pdb_name", ":", "raise", "NameError", "(", "\"Cannot save an output for a temporary file without a PDB\"", "\"code specified\"", ")...
Defines location of Reduce output files relative to input files.
[ "Defines", "location", "of", "Reduce", "output", "files", "relative", "to", "input", "files", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/external_programs/reduce.py#L89-L108
train
60,015
woolfson-group/isambard
isambard/external_programs/reduce.py
output_reduce
def output_reduce(input_file, path=True, pdb_name=None, force=False): """Runs Reduce on a pdb or mmol file and creates a new file with the output. Parameters ---------- input_file : str or pathlib.Path Path to file to run Reduce on. path : bool True if input_file is a path. pdb_n...
python
def output_reduce(input_file, path=True, pdb_name=None, force=False): """Runs Reduce on a pdb or mmol file and creates a new file with the output. Parameters ---------- input_file : str or pathlib.Path Path to file to run Reduce on. path : bool True if input_file is a path. pdb_n...
[ "def", "output_reduce", "(", "input_file", ",", "path", "=", "True", ",", "pdb_name", "=", "None", ",", "force", "=", "False", ")", ":", "if", "path", ":", "output_path", "=", "reduce_output_path", "(", "path", "=", "input_file", ")", "else", ":", "outpu...
Runs Reduce on a pdb or mmol file and creates a new file with the output. Parameters ---------- input_file : str or pathlib.Path Path to file to run Reduce on. path : bool True if input_file is a path. pdb_name : str PDB ID of protein. Required if providing string not path. ...
[ "Runs", "Reduce", "on", "a", "pdb", "or", "mmol", "file", "and", "creates", "a", "new", "file", "with", "the", "output", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/external_programs/reduce.py#L111-L141
train
60,016
woolfson-group/isambard
isambard/external_programs/reduce.py
output_reduce_list
def output_reduce_list(path_list, force=False): """Generates structure file with protons from a list of structure files.""" output_paths = [] for path in path_list: output_path = output_reduce(path, force=force) if output_path: output_paths.append(output_path) return output_p...
python
def output_reduce_list(path_list, force=False): """Generates structure file with protons from a list of structure files.""" output_paths = [] for path in path_list: output_path = output_reduce(path, force=force) if output_path: output_paths.append(output_path) return output_p...
[ "def", "output_reduce_list", "(", "path_list", ",", "force", "=", "False", ")", ":", "output_paths", "=", "[", "]", "for", "path", "in", "path_list", ":", "output_path", "=", "output_reduce", "(", "path", ",", "force", "=", "force", ")", "if", "output_path...
Generates structure file with protons from a list of structure files.
[ "Generates", "structure", "file", "with", "protons", "from", "a", "list", "of", "structure", "files", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/external_programs/reduce.py#L144-L151
train
60,017
woolfson-group/isambard
isambard/external_programs/reduce.py
assembly_plus_protons
def assembly_plus_protons(input_file, path=True, pdb_name=None, save_output=False, force_save=False): """Returns an Assembly with protons added by Reduce. Notes ----- Looks for a pre-existing Reduce output in the standard location before running Reduce. If the protein cont...
python
def assembly_plus_protons(input_file, path=True, pdb_name=None, save_output=False, force_save=False): """Returns an Assembly with protons added by Reduce. Notes ----- Looks for a pre-existing Reduce output in the standard location before running Reduce. If the protein cont...
[ "def", "assembly_plus_protons", "(", "input_file", ",", "path", "=", "True", ",", "pdb_name", "=", "None", ",", "save_output", "=", "False", ",", "force_save", "=", "False", ")", ":", "from", "ampal", ".", "pdb_parser", "import", "convert_pdb_to_ampal", "if", ...
Returns an Assembly with protons added by Reduce. Notes ----- Looks for a pre-existing Reduce output in the standard location before running Reduce. If the protein contains oligosaccharides or glycans, use reduce_correct_carbohydrates. Parameters ---------- input_file : str or pathlib....
[ "Returns", "an", "Assembly", "with", "protons", "added", "by", "Reduce", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/external_programs/reduce.py#L154-L203
train
60,018
woolfson-group/isambard
isambard/ampal/specifications/polymer_specs/helix.py
Helix.from_start_and_end
def from_start_and_end(cls, start, end, aa=None, helix_type='alpha'): """Creates a `Helix` between `start` and `end`. Parameters ---------- start : 3D Vector (tuple or list or numpy.array) The coordinate of the start of the helix primitive. end : 3D Vector (tuple or ...
python
def from_start_and_end(cls, start, end, aa=None, helix_type='alpha'): """Creates a `Helix` between `start` and `end`. Parameters ---------- start : 3D Vector (tuple or list or numpy.array) The coordinate of the start of the helix primitive. end : 3D Vector (tuple or ...
[ "def", "from_start_and_end", "(", "cls", ",", "start", ",", "end", ",", "aa", "=", "None", ",", "helix_type", "=", "'alpha'", ")", ":", "start", "=", "numpy", ".", "array", "(", "start", ")", "end", "=", "numpy", ".", "array", "(", "end", ")", "if"...
Creates a `Helix` between `start` and `end`. Parameters ---------- start : 3D Vector (tuple or list or numpy.array) The coordinate of the start of the helix primitive. end : 3D Vector (tuple or list or numpy.array) The coordinate of the end of the helix primitive...
[ "Creates", "a", "Helix", "between", "start", "and", "end", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/specifications/polymer_specs/helix.py#L123-L146
train
60,019
woolfson-group/isambard
isambard/ampal/specifications/polymer_specs/helix.py
Helix.build
def build(self): """Build straight helix along z-axis, starting with CA1 on x-axis""" ang_per_res = (2 * numpy.pi) / self.residues_per_turn atom_offsets = _atom_offsets[self.helix_type] if self.handedness == 'l': handedness = -1 else: handedness = 1 ...
python
def build(self): """Build straight helix along z-axis, starting with CA1 on x-axis""" ang_per_res = (2 * numpy.pi) / self.residues_per_turn atom_offsets = _atom_offsets[self.helix_type] if self.handedness == 'l': handedness = -1 else: handedness = 1 ...
[ "def", "build", "(", "self", ")", ":", "ang_per_res", "=", "(", "2", "*", "numpy", ".", "pi", ")", "/", "self", ".", "residues_per_turn", "atom_offsets", "=", "_atom_offsets", "[", "self", ".", "helix_type", "]", "if", "self", ".", "handedness", "==", ...
Build straight helix along z-axis, starting with CA1 on x-axis
[ "Build", "straight", "helix", "along", "z", "-", "axis", "starting", "with", "CA1", "on", "x", "-", "axis" ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/specifications/polymer_specs/helix.py#L189-L223
train
60,020
woolfson-group/isambard
isambard/ampal/specifications/polymer_specs/helix.py
HelicalHelix.from_start_and_end
def from_start_and_end(cls, start, end, aa=None, major_pitch=225.8, major_radius=5.07, major_handedness='l', minor_helix_type='alpha', orientation=1, phi_c_alpha=0.0, minor_repeat=None): """Creates a `HelicalHelix` between a `start...
python
def from_start_and_end(cls, start, end, aa=None, major_pitch=225.8, major_radius=5.07, major_handedness='l', minor_helix_type='alpha', orientation=1, phi_c_alpha=0.0, minor_repeat=None): """Creates a `HelicalHelix` between a `start...
[ "def", "from_start_and_end", "(", "cls", ",", "start", ",", "end", ",", "aa", "=", "None", ",", "major_pitch", "=", "225.8", ",", "major_radius", "=", "5.07", ",", "major_handedness", "=", "'l'", ",", "minor_helix_type", "=", "'alpha'", ",", "orientation", ...
Creates a `HelicalHelix` between a `start` and `end` point.
[ "Creates", "a", "HelicalHelix", "between", "a", "start", "and", "end", "point", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/specifications/polymer_specs/helix.py#L340-L357
train
60,021
woolfson-group/isambard
isambard/ampal/specifications/polymer_specs/helix.py
HelicalHelix.curve
def curve(self): """Curve of the super helix.""" return HelicalCurve.pitch_and_radius( self.major_pitch, self.major_radius, handedness=self.major_handedness)
python
def curve(self): """Curve of the super helix.""" return HelicalCurve.pitch_and_radius( self.major_pitch, self.major_radius, handedness=self.major_handedness)
[ "def", "curve", "(", "self", ")", ":", "return", "HelicalCurve", ".", "pitch_and_radius", "(", "self", ".", "major_pitch", ",", "self", ".", "major_radius", ",", "handedness", "=", "self", ".", "major_handedness", ")" ]
Curve of the super helix.
[ "Curve", "of", "the", "super", "helix", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/specifications/polymer_specs/helix.py#L370-L374
train
60,022
woolfson-group/isambard
isambard/ampal/specifications/polymer_specs/helix.py
HelicalHelix.curve_primitive
def curve_primitive(self): """`Primitive` of the super-helical curve.""" curve = self.curve curve.axis_start = self.helix_start curve.axis_end = self.helix_end coords = curve.get_coords( n_points=(self.num_monomers + 1), spacing=self.minor_rise_per_residue) if...
python
def curve_primitive(self): """`Primitive` of the super-helical curve.""" curve = self.curve curve.axis_start = self.helix_start curve.axis_end = self.helix_end coords = curve.get_coords( n_points=(self.num_monomers + 1), spacing=self.minor_rise_per_residue) if...
[ "def", "curve_primitive", "(", "self", ")", ":", "curve", "=", "self", ".", "curve", "curve", ".", "axis_start", "=", "self", ".", "helix_start", "curve", ".", "axis_end", "=", "self", ".", "helix_end", "coords", "=", "curve", ".", "get_coords", "(", "n_...
`Primitive` of the super-helical curve.
[ "Primitive", "of", "the", "super", "-", "helical", "curve", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/specifications/polymer_specs/helix.py#L377-L386
train
60,023
woolfson-group/isambard
isambard/ampal/specifications/polymer_specs/helix.py
HelicalHelix.major_rise_per_monomer
def major_rise_per_monomer(self): """Rise along super-helical axis per monomer.""" return numpy.cos(numpy.deg2rad(self.curve.alpha)) * self.minor_rise_per_residue
python
def major_rise_per_monomer(self): """Rise along super-helical axis per monomer.""" return numpy.cos(numpy.deg2rad(self.curve.alpha)) * self.minor_rise_per_residue
[ "def", "major_rise_per_monomer", "(", "self", ")", ":", "return", "numpy", ".", "cos", "(", "numpy", ".", "deg2rad", "(", "self", ".", "curve", ".", "alpha", ")", ")", "*", "self", ".", "minor_rise_per_residue" ]
Rise along super-helical axis per monomer.
[ "Rise", "along", "super", "-", "helical", "axis", "per", "monomer", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/specifications/polymer_specs/helix.py#L389-L391
train
60,024
woolfson-group/isambard
isambard/ampal/specifications/polymer_specs/helix.py
HelicalHelix.minor_residues_per_turn
def minor_residues_per_turn(self, minor_repeat=None): """Calculates the number of residues per turn of the minor helix. Parameters ---------- minor_repeat : float, optional Hydrophobic repeat of the minor helix. Returns ------- minor_rpt : float ...
python
def minor_residues_per_turn(self, minor_repeat=None): """Calculates the number of residues per turn of the minor helix. Parameters ---------- minor_repeat : float, optional Hydrophobic repeat of the minor helix. Returns ------- minor_rpt : float ...
[ "def", "minor_residues_per_turn", "(", "self", ",", "minor_repeat", "=", "None", ")", ":", "if", "minor_repeat", "is", "None", ":", "minor_rpt", "=", "_helix_parameters", "[", "self", ".", "minor_helix_type", "]", "[", "0", "]", "else", ":", "# precession angl...
Calculates the number of residues per turn of the minor helix. Parameters ---------- minor_repeat : float, optional Hydrophobic repeat of the minor helix. Returns ------- minor_rpt : float Residues per turn of the minor helix.
[ "Calculates", "the", "number", "of", "residues", "per", "turn", "of", "the", "minor", "helix", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/specifications/polymer_specs/helix.py#L393-L418
train
60,025
woolfson-group/isambard
isambard/ampal/specifications/polymer_specs/helix.py
HelicalHelix.build
def build(self): """Builds the `HelicalHelix`.""" helical_helix = Polypeptide() primitive_coords = self.curve_primitive.coordinates helices = [Helix.from_start_and_end(start=primitive_coords[i], end=primitive_coords[i + 1], ...
python
def build(self): """Builds the `HelicalHelix`.""" helical_helix = Polypeptide() primitive_coords = self.curve_primitive.coordinates helices = [Helix.from_start_and_end(start=primitive_coords[i], end=primitive_coords[i + 1], ...
[ "def", "build", "(", "self", ")", ":", "helical_helix", "=", "Polypeptide", "(", ")", "primitive_coords", "=", "self", ".", "curve_primitive", ".", "coordinates", "helices", "=", "[", "Helix", ".", "from_start_and_end", "(", "start", "=", "primitive_coords", "...
Builds the `HelicalHelix`.
[ "Builds", "the", "HelicalHelix", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/specifications/polymer_specs/helix.py#L420-L459
train
60,026
woolfson-group/isambard
isambard/ampal/specifications/polymer_specs/helix.py
HelicalHelix.rotate_monomers
def rotate_monomers(self, angle, radians=False): """ Rotates each Residue in the Polypeptide. Notes ----- Each monomer is rotated about the axis formed between its corresponding primitive `PseudoAtom` and that of the subsequent `Monomer`. Parameters ---...
python
def rotate_monomers(self, angle, radians=False): """ Rotates each Residue in the Polypeptide. Notes ----- Each monomer is rotated about the axis formed between its corresponding primitive `PseudoAtom` and that of the subsequent `Monomer`. Parameters ---...
[ "def", "rotate_monomers", "(", "self", ",", "angle", ",", "radians", "=", "False", ")", ":", "if", "radians", ":", "angle", "=", "numpy", ".", "rad2deg", "(", "angle", ")", "for", "i", "in", "range", "(", "len", "(", "self", ".", "primitive", ")", ...
Rotates each Residue in the Polypeptide. Notes ----- Each monomer is rotated about the axis formed between its corresponding primitive `PseudoAtom` and that of the subsequent `Monomer`. Parameters ---------- angle : float Angle by which to r...
[ "Rotates", "each", "Residue", "in", "the", "Polypeptide", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/specifications/polymer_specs/helix.py#L538-L560
train
60,027
woolfson-group/isambard
isambard/add_ons/knobs_into_holes.py
side_chain_centres
def side_chain_centres(assembly, masses=False): """ PseudoGroup containing side_chain centres of each Residue in each Polypeptide in Assembly. Notes ----- Each PseudoAtom is a side-chain centre. There is one PseudoMonomer per chain in ampal (each containing len(chain) PseudoAtoms). The PseudoGr...
python
def side_chain_centres(assembly, masses=False): """ PseudoGroup containing side_chain centres of each Residue in each Polypeptide in Assembly. Notes ----- Each PseudoAtom is a side-chain centre. There is one PseudoMonomer per chain in ampal (each containing len(chain) PseudoAtoms). The PseudoGr...
[ "def", "side_chain_centres", "(", "assembly", ",", "masses", "=", "False", ")", ":", "if", "masses", ":", "elts", "=", "set", "(", "[", "x", ".", "element", "for", "x", "in", "assembly", ".", "get_atoms", "(", ")", "]", ")", "masses_dict", "=", "{", ...
PseudoGroup containing side_chain centres of each Residue in each Polypeptide in Assembly. Notes ----- Each PseudoAtom is a side-chain centre. There is one PseudoMonomer per chain in ampal (each containing len(chain) PseudoAtoms). The PseudoGroup has len(ampal) PseudoMonomers. Parameters -...
[ "PseudoGroup", "containing", "side_chain", "centres", "of", "each", "Residue", "in", "each", "Polypeptide", "in", "Assembly", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/add_ons/knobs_into_holes.py#L30-L71
train
60,028
woolfson-group/isambard
isambard/add_ons/knobs_into_holes.py
cluster_helices
def cluster_helices(helices, cluster_distance=12.0): """ Clusters helices according to the minimum distance between the line segments representing their backbone. Notes ----- Each helix is represented as a line segement joining the CA of its first Residue to the CA if its final Residue. The minimal...
python
def cluster_helices(helices, cluster_distance=12.0): """ Clusters helices according to the minimum distance between the line segments representing their backbone. Notes ----- Each helix is represented as a line segement joining the CA of its first Residue to the CA if its final Residue. The minimal...
[ "def", "cluster_helices", "(", "helices", ",", "cluster_distance", "=", "12.0", ")", ":", "condensed_distance_matrix", "=", "[", "]", "for", "h1", ",", "h2", "in", "itertools", ".", "combinations", "(", "helices", ",", "2", ")", ":", "md", "=", "minimal_di...
Clusters helices according to the minimum distance between the line segments representing their backbone. Notes ----- Each helix is represented as a line segement joining the CA of its first Residue to the CA if its final Residue. The minimal distance between pairwise line segments is calculated and st...
[ "Clusters", "helices", "according", "to", "the", "minimum", "distance", "between", "the", "line", "segments", "representing", "their", "backbone", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/add_ons/knobs_into_holes.py#L74-L111
train
60,029
woolfson-group/isambard
isambard/add_ons/knobs_into_holes.py
find_kihs
def find_kihs(assembly, hole_size=4, cutoff=7.0): """ KnobIntoHoles between residues of different chains in assembly. Notes ----- A KnobIntoHole is a found when the side-chain centre of a Residue a chain is close than (cutoff) Angstroms from at least (hole_size) side-chain centres of Residues of a ...
python
def find_kihs(assembly, hole_size=4, cutoff=7.0): """ KnobIntoHoles between residues of different chains in assembly. Notes ----- A KnobIntoHole is a found when the side-chain centre of a Residue a chain is close than (cutoff) Angstroms from at least (hole_size) side-chain centres of Residues of a ...
[ "def", "find_kihs", "(", "assembly", ",", "hole_size", "=", "4", ",", "cutoff", "=", "7.0", ")", ":", "pseudo_group", "=", "side_chain_centres", "(", "assembly", "=", "assembly", ",", "masses", "=", "False", ")", "pairs", "=", "itertools", ".", "permutatio...
KnobIntoHoles between residues of different chains in assembly. Notes ----- A KnobIntoHole is a found when the side-chain centre of a Residue a chain is close than (cutoff) Angstroms from at least (hole_size) side-chain centres of Residues of a different chain. Parameters ---------- assemb...
[ "KnobIntoHoles", "between", "residues", "of", "different", "chains", "in", "assembly", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/add_ons/knobs_into_holes.py#L114-L151
train
60,030
woolfson-group/isambard
isambard/add_ons/knobs_into_holes.py
find_contiguous_packing_segments
def find_contiguous_packing_segments(polypeptide, residues, max_dist=10.0): """ Assembly containing segments of polypeptide, divided according to separation of contiguous residues. Parameters ---------- polypeptide : Polypeptide residues : iterable containing Residues max_dist : float S...
python
def find_contiguous_packing_segments(polypeptide, residues, max_dist=10.0): """ Assembly containing segments of polypeptide, divided according to separation of contiguous residues. Parameters ---------- polypeptide : Polypeptide residues : iterable containing Residues max_dist : float S...
[ "def", "find_contiguous_packing_segments", "(", "polypeptide", ",", "residues", ",", "max_dist", "=", "10.0", ")", ":", "segments", "=", "Assembly", "(", "assembly_id", "=", "polypeptide", ".", "ampal_parent", ".", "id", ")", "residues_in_polypeptide", "=", "list"...
Assembly containing segments of polypeptide, divided according to separation of contiguous residues. Parameters ---------- polypeptide : Polypeptide residues : iterable containing Residues max_dist : float Separation beyond which splitting of Polymer occurs. Returns ------- seg...
[ "Assembly", "containing", "segments", "of", "polypeptide", "divided", "according", "to", "separation", "of", "contiguous", "residues", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/add_ons/knobs_into_holes.py#L154-L190
train
60,031
woolfson-group/isambard
isambard/add_ons/knobs_into_holes.py
gen_reference_primitive
def gen_reference_primitive(polypeptide, start, end): """ Generates a reference Primitive for a Polypeptide given start and end coordinates. Notes ----- Uses the rise_per_residue of the Polypeptide primitive to define the separation of points on the line joining start and end. Parameters -...
python
def gen_reference_primitive(polypeptide, start, end): """ Generates a reference Primitive for a Polypeptide given start and end coordinates. Notes ----- Uses the rise_per_residue of the Polypeptide primitive to define the separation of points on the line joining start and end. Parameters -...
[ "def", "gen_reference_primitive", "(", "polypeptide", ",", "start", ",", "end", ")", ":", "prim", "=", "polypeptide", ".", "primitive", "q", "=", "find_foot", "(", "a", "=", "start", ",", "b", "=", "end", ",", "p", "=", "prim", ".", "coordinates", "[",...
Generates a reference Primitive for a Polypeptide given start and end coordinates. Notes ----- Uses the rise_per_residue of the Polypeptide primitive to define the separation of points on the line joining start and end. Parameters ---------- polypeptide : Polypeptide start : numpy.arra...
[ "Generates", "a", "reference", "Primitive", "for", "a", "Polypeptide", "given", "start", "and", "end", "coordinates", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/add_ons/knobs_into_holes.py#L618-L652
train
60,032
woolfson-group/isambard
isambard/add_ons/knobs_into_holes.py
KnobGroup.from_helices
def from_helices(cls, assembly, cutoff=7.0, min_helix_length=8): """ Generate KnobGroup from the helices in the assembly - classic socket functionality. Notes ----- Socket identifies knobs-into-holes (KIHs) packing motifs in protein structures. The following resources can provid...
python
def from_helices(cls, assembly, cutoff=7.0, min_helix_length=8): """ Generate KnobGroup from the helices in the assembly - classic socket functionality. Notes ----- Socket identifies knobs-into-holes (KIHs) packing motifs in protein structures. The following resources can provid...
[ "def", "from_helices", "(", "cls", ",", "assembly", ",", "cutoff", "=", "7.0", ",", "min_helix_length", "=", "8", ")", ":", "cutoff", "=", "float", "(", "cutoff", ")", "helices", "=", "Assembly", "(", "[", "x", "for", "x", "in", "assembly", ".", "hel...
Generate KnobGroup from the helices in the assembly - classic socket functionality. Notes ----- Socket identifies knobs-into-holes (KIHs) packing motifs in protein structures. The following resources can provide more information: The socket webserver: http://coiledcoils.chm.bris...
[ "Generate", "KnobGroup", "from", "the", "helices", "in", "the", "assembly", "-", "classic", "socket", "functionality", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/add_ons/knobs_into_holes.py#L206-L255
train
60,033
woolfson-group/isambard
isambard/add_ons/knobs_into_holes.py
KnobGroup.knob_subgroup
def knob_subgroup(self, cutoff=7.0): """ KnobGroup where all KnobsIntoHoles have max_kh_distance <= cutoff. """ if cutoff > self.cutoff: raise ValueError("cutoff supplied ({0}) cannot be greater than self.cutoff ({1})".format(cutoff, ...
python
def knob_subgroup(self, cutoff=7.0): """ KnobGroup where all KnobsIntoHoles have max_kh_distance <= cutoff. """ if cutoff > self.cutoff: raise ValueError("cutoff supplied ({0}) cannot be greater than self.cutoff ({1})".format(cutoff, ...
[ "def", "knob_subgroup", "(", "self", ",", "cutoff", "=", "7.0", ")", ":", "if", "cutoff", ">", "self", ".", "cutoff", ":", "raise", "ValueError", "(", "\"cutoff supplied ({0}) cannot be greater than self.cutoff ({1})\"", ".", "format", "(", "cutoff", ",", "self", ...
KnobGroup where all KnobsIntoHoles have max_kh_distance <= cutoff.
[ "KnobGroup", "where", "all", "KnobsIntoHoles", "have", "max_kh_distance", "<", "=", "cutoff", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/add_ons/knobs_into_holes.py#L257-L263
train
60,034
woolfson-group/isambard
isambard/add_ons/knobs_into_holes.py
KnobGroup.graph
def graph(self): """ Returns MultiDiGraph from kihs. Nodes are helices and edges are kihs. """ g = networkx.MultiDiGraph() edge_list = [(x.knob_helix, x.hole_helix, x.id, {'kih': x}) for x in self.get_monomers()] g.add_edges_from(edge_list) return g
python
def graph(self): """ Returns MultiDiGraph from kihs. Nodes are helices and edges are kihs. """ g = networkx.MultiDiGraph() edge_list = [(x.knob_helix, x.hole_helix, x.id, {'kih': x}) for x in self.get_monomers()] g.add_edges_from(edge_list) return g
[ "def", "graph", "(", "self", ")", ":", "g", "=", "networkx", ".", "MultiDiGraph", "(", ")", "edge_list", "=", "[", "(", "x", ".", "knob_helix", ",", "x", ".", "hole_helix", ",", "x", ".", "id", ",", "{", "'kih'", ":", "x", "}", ")", "for", "x",...
Returns MultiDiGraph from kihs. Nodes are helices and edges are kihs.
[ "Returns", "MultiDiGraph", "from", "kihs", ".", "Nodes", "are", "helices", "and", "edges", "are", "kihs", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/add_ons/knobs_into_holes.py#L270-L275
train
60,035
woolfson-group/isambard
isambard/add_ons/knobs_into_holes.py
KnobGroup.filter_graph
def filter_graph(g, cutoff=7.0, min_kihs=2): """ Get subgraph formed from edges that have max_kh_distance < cutoff. Parameters ---------- g : MultiDiGraph representing KIHs g is the output from graph_from_protein cutoff : float Socket cutoff in Angstroms....
python
def filter_graph(g, cutoff=7.0, min_kihs=2): """ Get subgraph formed from edges that have max_kh_distance < cutoff. Parameters ---------- g : MultiDiGraph representing KIHs g is the output from graph_from_protein cutoff : float Socket cutoff in Angstroms....
[ "def", "filter_graph", "(", "g", ",", "cutoff", "=", "7.0", ",", "min_kihs", "=", "2", ")", ":", "edge_list", "=", "[", "e", "for", "e", "in", "g", ".", "edges", "(", "keys", "=", "True", ",", "data", "=", "True", ")", "if", "e", "[", "3", "]...
Get subgraph formed from edges that have max_kh_distance < cutoff. Parameters ---------- g : MultiDiGraph representing KIHs g is the output from graph_from_protein cutoff : float Socket cutoff in Angstroms. Default is 7.0. min_kihs : int ...
[ "Get", "subgraph", "formed", "from", "edges", "that", "have", "max_kh_distance", "<", "cutoff", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/add_ons/knobs_into_holes.py#L278-L302
train
60,036
woolfson-group/isambard
isambard/add_ons/knobs_into_holes.py
KnobGroup.get_coiledcoil_region
def get_coiledcoil_region(self, cc_number=0, cutoff=7.0, min_kihs=2): """ Assembly containing only assigned regions (i.e. regions with contiguous KnobsIntoHoles. """ g = self.filter_graph(self.graph, cutoff=cutoff, min_kihs=min_kihs) ccs = sorted(networkx.connected_component_subgraphs(g, copy=Tr...
python
def get_coiledcoil_region(self, cc_number=0, cutoff=7.0, min_kihs=2): """ Assembly containing only assigned regions (i.e. regions with contiguous KnobsIntoHoles. """ g = self.filter_graph(self.graph, cutoff=cutoff, min_kihs=min_kihs) ccs = sorted(networkx.connected_component_subgraphs(g, copy=Tr...
[ "def", "get_coiledcoil_region", "(", "self", ",", "cc_number", "=", "0", ",", "cutoff", "=", "7.0", ",", "min_kihs", "=", "2", ")", ":", "g", "=", "self", ".", "filter_graph", "(", "self", ".", "graph", ",", "cutoff", "=", "cutoff", ",", "min_kihs", ...
Assembly containing only assigned regions (i.e. regions with contiguous KnobsIntoHoles.
[ "Assembly", "containing", "only", "assigned", "regions", "(", "i", ".", "e", ".", "regions", "with", "contiguous", "KnobsIntoHoles", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/add_ons/knobs_into_holes.py#L304-L313
train
60,037
woolfson-group/isambard
isambard/add_ons/knobs_into_holes.py
KnobGroup.daisy_chain_graph
def daisy_chain_graph(self): """ Directed graph with edges from knob residue to each hole residue for each KnobIntoHole in self. """ g = networkx.DiGraph() for x in self.get_monomers(): for h in x.hole: g.add_edge(x.knob, h) return g
python
def daisy_chain_graph(self): """ Directed graph with edges from knob residue to each hole residue for each KnobIntoHole in self. """ g = networkx.DiGraph() for x in self.get_monomers(): for h in x.hole: g.add_edge(x.knob, h) return g
[ "def", "daisy_chain_graph", "(", "self", ")", ":", "g", "=", "networkx", ".", "DiGraph", "(", ")", "for", "x", "in", "self", ".", "get_monomers", "(", ")", ":", "for", "h", "in", "x", ".", "hole", ":", "g", ".", "add_edge", "(", "x", ".", "knob",...
Directed graph with edges from knob residue to each hole residue for each KnobIntoHole in self.
[ "Directed", "graph", "with", "edges", "from", "knob", "residue", "to", "each", "hole", "residue", "for", "each", "KnobIntoHole", "in", "self", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/add_ons/knobs_into_holes.py#L316-L322
train
60,038
woolfson-group/isambard
isambard/add_ons/knobs_into_holes.py
KnobIntoHole.knob_end
def knob_end(self): """ Coordinates of the end of the knob residue (atom in side-chain furthest from CB atom. Returns CA coordinates for GLY. """ side_chain_atoms = self.knob_residue.side_chain if not side_chain_atoms: return self.knob_residue['CA'] distances ...
python
def knob_end(self): """ Coordinates of the end of the knob residue (atom in side-chain furthest from CB atom. Returns CA coordinates for GLY. """ side_chain_atoms = self.knob_residue.side_chain if not side_chain_atoms: return self.knob_residue['CA'] distances ...
[ "def", "knob_end", "(", "self", ")", ":", "side_chain_atoms", "=", "self", ".", "knob_residue", ".", "side_chain", "if", "not", "side_chain_atoms", ":", "return", "self", ".", "knob_residue", "[", "'CA'", "]", "distances", "=", "[", "distance", "(", "self", ...
Coordinates of the end of the knob residue (atom in side-chain furthest from CB atom. Returns CA coordinates for GLY.
[ "Coordinates", "of", "the", "end", "of", "the", "knob", "residue", "(", "atom", "in", "side", "-", "chain", "furthest", "from", "CB", "atom", ".", "Returns", "CA", "coordinates", "for", "GLY", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/add_ons/knobs_into_holes.py#L440-L453
train
60,039
woolfson-group/isambard
isambard/add_ons/knobs_into_holes.py
KnobIntoHole.max_knob_end_distance
def max_knob_end_distance(self): """ Maximum distance between knob_end and each of the hole side-chain centres. """ return max([distance(self.knob_end, h) for h in self.hole])
python
def max_knob_end_distance(self): """ Maximum distance between knob_end and each of the hole side-chain centres. """ return max([distance(self.knob_end, h) for h in self.hole])
[ "def", "max_knob_end_distance", "(", "self", ")", ":", "return", "max", "(", "[", "distance", "(", "self", ".", "knob_end", ",", "h", ")", "for", "h", "in", "self", ".", "hole", "]", ")" ]
Maximum distance between knob_end and each of the hole side-chain centres.
[ "Maximum", "distance", "between", "knob_end", "and", "each", "of", "the", "hole", "side", "-", "chain", "centres", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/add_ons/knobs_into_holes.py#L471-L473
train
60,040
woolfson-group/isambard
isambard/configure.py
base_install
def base_install(): """Generates configuration setting for required functionality of ISAMBARD.""" # scwrl scwrl = {} print('{BOLD}{HEADER}Generating configuration files for ISAMBARD.{END_C}\n' 'All required input can use tab completion for paths.\n' '{BOLD}Setting up SCWRL 4.0 (Recom...
python
def base_install(): """Generates configuration setting for required functionality of ISAMBARD.""" # scwrl scwrl = {} print('{BOLD}{HEADER}Generating configuration files for ISAMBARD.{END_C}\n' 'All required input can use tab completion for paths.\n' '{BOLD}Setting up SCWRL 4.0 (Recom...
[ "def", "base_install", "(", ")", ":", "# scwrl", "scwrl", "=", "{", "}", "print", "(", "'{BOLD}{HEADER}Generating configuration files for ISAMBARD.{END_C}\\n'", "'All required input can use tab completion for paths.\\n'", "'{BOLD}Setting up SCWRL 4.0 (Recommended){END_C}'", ".", "for...
Generates configuration setting for required functionality of ISAMBARD.
[ "Generates", "configuration", "setting", "for", "required", "functionality", "of", "ISAMBARD", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/configure.py#L60-L98
train
60,041
woolfson-group/isambard
isambard/configure.py
optional_install
def optional_install(): """Generates configuration settings for optional functionality of ISAMBARD.""" # reduce print('{BOLD}Setting up Reduce (optional){END_C}'.format(**text_colours)) reduce = {} reduce_path = get_user_path('Please provide a path to your reduce executable.', required=False) re...
python
def optional_install(): """Generates configuration settings for optional functionality of ISAMBARD.""" # reduce print('{BOLD}Setting up Reduce (optional){END_C}'.format(**text_colours)) reduce = {} reduce_path = get_user_path('Please provide a path to your reduce executable.', required=False) re...
[ "def", "optional_install", "(", ")", ":", "# reduce", "print", "(", "'{BOLD}Setting up Reduce (optional){END_C}'", ".", "format", "(", "*", "*", "text_colours", ")", ")", "reduce", "=", "{", "}", "reduce_path", "=", "get_user_path", "(", "'Please provide a path to y...
Generates configuration settings for optional functionality of ISAMBARD.
[ "Generates", "configuration", "settings", "for", "optional", "functionality", "of", "ISAMBARD", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/configure.py#L101-L124
train
60,042
woolfson-group/isambard
isambard/ampal/pseudo_atoms.py
PseudoMonomer.pdb
def pdb(self): """Generates a PDB string for the `PseudoMonomer`.""" pdb_str = write_pdb( [self], ' ' if not self.tags['chain_id'] else self.tags['chain_id']) return pdb_str
python
def pdb(self): """Generates a PDB string for the `PseudoMonomer`.""" pdb_str = write_pdb( [self], ' ' if not self.tags['chain_id'] else self.tags['chain_id']) return pdb_str
[ "def", "pdb", "(", "self", ")", ":", "pdb_str", "=", "write_pdb", "(", "[", "self", "]", ",", "' '", "if", "not", "self", ".", "tags", "[", "'chain_id'", "]", "else", "self", ".", "tags", "[", "'chain_id'", "]", ")", "return", "pdb_str" ]
Generates a PDB string for the `PseudoMonomer`.
[ "Generates", "a", "PDB", "string", "for", "the", "PseudoMonomer", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/pseudo_atoms.py#L129-L133
train
60,043
woolfson-group/isambard
isambard/ampal/pseudo_atoms.py
Primitive.from_coordinates
def from_coordinates(cls, coordinates): """Creates a `Primitive` from a list of coordinates.""" prim = cls() for coord in coordinates: pm = PseudoMonomer(ampal_parent=prim) pa = PseudoAtom(coord, ampal_parent=pm) pm.atoms = OrderedDict([('CA', pa)]) ...
python
def from_coordinates(cls, coordinates): """Creates a `Primitive` from a list of coordinates.""" prim = cls() for coord in coordinates: pm = PseudoMonomer(ampal_parent=prim) pa = PseudoAtom(coord, ampal_parent=pm) pm.atoms = OrderedDict([('CA', pa)]) ...
[ "def", "from_coordinates", "(", "cls", ",", "coordinates", ")", ":", "prim", "=", "cls", "(", ")", "for", "coord", "in", "coordinates", ":", "pm", "=", "PseudoMonomer", "(", "ampal_parent", "=", "prim", ")", "pa", "=", "PseudoAtom", "(", "coord", ",", ...
Creates a `Primitive` from a list of coordinates.
[ "Creates", "a", "Primitive", "from", "a", "list", "of", "coordinates", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/pseudo_atoms.py#L259-L268
train
60,044
woolfson-group/isambard
isambard/ampal/pseudo_atoms.py
Primitive.rise_per_residue
def rise_per_residue(self): """The rise per residue at each point on the Primitive. Notes ----- Each element of the returned list is the rise per residue, at a point on the Primitive. Element i is the distance between primitive[i] and primitive[i + 1]. The final value ...
python
def rise_per_residue(self): """The rise per residue at each point on the Primitive. Notes ----- Each element of the returned list is the rise per residue, at a point on the Primitive. Element i is the distance between primitive[i] and primitive[i + 1]. The final value ...
[ "def", "rise_per_residue", "(", "self", ")", ":", "rprs", "=", "[", "distance", "(", "self", "[", "i", "]", "[", "'CA'", "]", ",", "self", "[", "i", "+", "1", "]", "[", "'CA'", "]", ")", "for", "i", "in", "range", "(", "len", "(", "self", ")"...
The rise per residue at each point on the Primitive. Notes ----- Each element of the returned list is the rise per residue, at a point on the Primitive. Element i is the distance between primitive[i] and primitive[i + 1]. The final value is None.
[ "The", "rise", "per", "residue", "at", "each", "point", "on", "the", "Primitive", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/pseudo_atoms.py#L275-L288
train
60,045
woolfson-group/isambard
isambard/ampal/nucleic_acid.py
Polynucleotide.sequence
def sequence(self): """Returns the sequence of the `Polynucleotide` as a string. Returns ------- sequence : str String of the monomer sequence of the `Polynucleotide`. """ seq = [x.mol_code for x in self._monomers] return ' '.join(seq)
python
def sequence(self): """Returns the sequence of the `Polynucleotide` as a string. Returns ------- sequence : str String of the monomer sequence of the `Polynucleotide`. """ seq = [x.mol_code for x in self._monomers] return ' '.join(seq)
[ "def", "sequence", "(", "self", ")", ":", "seq", "=", "[", "x", ".", "mol_code", "for", "x", "in", "self", ".", "_monomers", "]", "return", "' '", ".", "join", "(", "seq", ")" ]
Returns the sequence of the `Polynucleotide` as a string. Returns ------- sequence : str String of the monomer sequence of the `Polynucleotide`.
[ "Returns", "the", "sequence", "of", "the", "Polynucleotide", "as", "a", "string", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/nucleic_acid.py#L56-L65
train
60,046
woolfson-group/isambard
isambard/external_programs/dssp.py
run_dssp
def run_dssp(pdb, path=True, outfile=None): """Uses DSSP to find helices and extracts helices from a pdb file or string. Parameters ---------- pdb : str Path to pdb file or string. path : bool, optional Indicates if pdb is a path or a string. outfile : str, optional File...
python
def run_dssp(pdb, path=True, outfile=None): """Uses DSSP to find helices and extracts helices from a pdb file or string. Parameters ---------- pdb : str Path to pdb file or string. path : bool, optional Indicates if pdb is a path or a string. outfile : str, optional File...
[ "def", "run_dssp", "(", "pdb", ",", "path", "=", "True", ",", "outfile", "=", "None", ")", ":", "if", "not", "path", ":", "if", "type", "(", "pdb", ")", "==", "str", ":", "pdb", "=", "pdb", ".", "encode", "(", ")", "try", ":", "temp_pdb", "=", ...
Uses DSSP to find helices and extracts helices from a pdb file or string. Parameters ---------- pdb : str Path to pdb file or string. path : bool, optional Indicates if pdb is a path or a string. outfile : str, optional Filepath for storing the dssp output. Returns ...
[ "Uses", "DSSP", "to", "find", "helices", "and", "extracts", "helices", "from", "a", "pdb", "file", "or", "string", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/external_programs/dssp.py#L37-L76
train
60,047
woolfson-group/isambard
isambard/external_programs/dssp.py
extract_solvent_accessibility_dssp
def extract_solvent_accessibility_dssp(in_dssp, path=True): """Uses DSSP to extract solvent accessibilty information on every residue. Notes ----- For more information on the solvent accessibility metrics used in dssp, see: http://swift.cmbi.ru.nl/gv/dssp/HTML/descrip.html#ACC In the dssp files...
python
def extract_solvent_accessibility_dssp(in_dssp, path=True): """Uses DSSP to extract solvent accessibilty information on every residue. Notes ----- For more information on the solvent accessibility metrics used in dssp, see: http://swift.cmbi.ru.nl/gv/dssp/HTML/descrip.html#ACC In the dssp files...
[ "def", "extract_solvent_accessibility_dssp", "(", "in_dssp", ",", "path", "=", "True", ")", ":", "if", "path", ":", "with", "open", "(", "in_dssp", ",", "'r'", ")", "as", "inf", ":", "dssp_out", "=", "inf", ".", "read", "(", ")", "else", ":", "dssp_out...
Uses DSSP to extract solvent accessibilty information on every residue. Notes ----- For more information on the solvent accessibility metrics used in dssp, see: http://swift.cmbi.ru.nl/gv/dssp/HTML/descrip.html#ACC In the dssp files value is labeled 'ACC'. Parameters ---------- in_dssp...
[ "Uses", "DSSP", "to", "extract", "solvent", "accessibilty", "information", "on", "every", "residue", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/external_programs/dssp.py#L128-L177
train
60,048
woolfson-group/isambard
isambard/external_programs/dssp.py
extract_helices_dssp
def extract_helices_dssp(in_pdb): """Uses DSSP to find alpha-helices and extracts helices from a pdb file. Returns a length 3 list with a helix id, the chain id and a dict containing the coordinates of each residues CA. Parameters ---------- in_pdb : string Path to a PDB file. """ ...
python
def extract_helices_dssp(in_pdb): """Uses DSSP to find alpha-helices and extracts helices from a pdb file. Returns a length 3 list with a helix id, the chain id and a dict containing the coordinates of each residues CA. Parameters ---------- in_pdb : string Path to a PDB file. """ ...
[ "def", "extract_helices_dssp", "(", "in_pdb", ")", ":", "from", "ampal", ".", "pdb_parser", "import", "split_pdb_lines", "dssp_out", "=", "subprocess", ".", "check_output", "(", "[", "global_settings", "[", "'dssp'", "]", "[", "'path'", "]", ",", "in_pdb", "]"...
Uses DSSP to find alpha-helices and extracts helices from a pdb file. Returns a length 3 list with a helix id, the chain id and a dict containing the coordinates of each residues CA. Parameters ---------- in_pdb : string Path to a PDB file.
[ "Uses", "DSSP", "to", "find", "alpha", "-", "helices", "and", "extracts", "helices", "from", "a", "pdb", "file", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/external_programs/dssp.py#L180-L220
train
60,049
woolfson-group/isambard
isambard/external_programs/dssp.py
extract_pp_helices
def extract_pp_helices(in_pdb): """Uses DSSP to find polyproline helices in a pdb file. Returns a length 3 list with a helix id, the chain id and a dict containing the coordinates of each residues CA. Parameters ---------- in_pdb : string Path to a PDB file. """ t_phi = -75.0 ...
python
def extract_pp_helices(in_pdb): """Uses DSSP to find polyproline helices in a pdb file. Returns a length 3 list with a helix id, the chain id and a dict containing the coordinates of each residues CA. Parameters ---------- in_pdb : string Path to a PDB file. """ t_phi = -75.0 ...
[ "def", "extract_pp_helices", "(", "in_pdb", ")", ":", "t_phi", "=", "-", "75.0", "t_phi_d", "=", "29.0", "t_psi", "=", "145.0", "t_psi_d", "=", "29.0", "pph_dssp", "=", "subprocess", ".", "check_output", "(", "[", "global_settings", "[", "'dssp'", "]", "["...
Uses DSSP to find polyproline helices in a pdb file. Returns a length 3 list with a helix id, the chain id and a dict containing the coordinates of each residues CA. Parameters ---------- in_pdb : string Path to a PDB file.
[ "Uses", "DSSP", "to", "find", "polyproline", "helices", "in", "a", "pdb", "file", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/external_programs/dssp.py#L223-L283
train
60,050
travispavek/testrail-python
examples/end_to_end_example.py
main
def main(): """ This will offer a step by step guide to create a new run in TestRail, update tests in the run with results, and close the run """ # Parse command line arguments args = get_args() # Instantiate the TestRail client # Use the CLI argument to identify which project to work w...
python
def main(): """ This will offer a step by step guide to create a new run in TestRail, update tests in the run with results, and close the run """ # Parse command line arguments args = get_args() # Instantiate the TestRail client # Use the CLI argument to identify which project to work w...
[ "def", "main", "(", ")", ":", "# Parse command line arguments", "args", "=", "get_args", "(", ")", "# Instantiate the TestRail client", "# Use the CLI argument to identify which project to work with", "tr", "=", "TestRail", "(", "project_dict", "[", "args", ".", "project", ...
This will offer a step by step guide to create a new run in TestRail, update tests in the run with results, and close the run
[ "This", "will", "offer", "a", "step", "by", "step", "guide", "to", "create", "a", "new", "run", "in", "TestRail", "update", "tests", "in", "the", "run", "with", "results", "and", "close", "the", "run" ]
3064432e913c27218078aa7831b9bac7422dd2cb
https://github.com/travispavek/testrail-python/blob/3064432e913c27218078aa7831b9bac7422dd2cb/examples/end_to_end_example.py#L27-L85
train
60,051
GGiecold/DBSCAN_multiplex
DBSCAN_multiplex.py
memory
def memory(): """Determine the machine's memory specifications. Returns ------- mem_info : dictonary Holds the current values for the total, free and used memory of the system. """ mem_info = {} if platform.linux_distribution()[0]: with open('/proc/meminfo') as file: ...
python
def memory(): """Determine the machine's memory specifications. Returns ------- mem_info : dictonary Holds the current values for the total, free and used memory of the system. """ mem_info = {} if platform.linux_distribution()[0]: with open('/proc/meminfo') as file: ...
[ "def", "memory", "(", ")", ":", "mem_info", "=", "{", "}", "if", "platform", ".", "linux_distribution", "(", ")", "[", "0", "]", ":", "with", "open", "(", "'/proc/meminfo'", ")", "as", "file", ":", "c", "=", "0", "for", "line", "in", "file", ":", ...
Determine the machine's memory specifications. Returns ------- mem_info : dictonary Holds the current values for the total, free and used memory of the system.
[ "Determine", "the", "machine", "s", "memory", "specifications", "." ]
075b1eec86d0e75166a9378d7d9a8974fc0a5e2e
https://github.com/GGiecold/DBSCAN_multiplex/blob/075b1eec86d0e75166a9378d7d9a8974fc0a5e2e/DBSCAN_multiplex.py#L92-L148
train
60,052
GGiecold/DBSCAN_multiplex
DBSCAN_multiplex.py
get_chunk_size
def get_chunk_size(N, n): """Given a dimension of size 'N', determine the number of rows or columns that can fit into memory. Parameters ---------- N : int The size of one of the dimension of a two-dimensional array. n : int The number of times an 'N' by 'chunks_size' arr...
python
def get_chunk_size(N, n): """Given a dimension of size 'N', determine the number of rows or columns that can fit into memory. Parameters ---------- N : int The size of one of the dimension of a two-dimensional array. n : int The number of times an 'N' by 'chunks_size' arr...
[ "def", "get_chunk_size", "(", "N", ",", "n", ")", ":", "mem_free", "=", "memory", "(", ")", "[", "'free'", "]", "if", "mem_free", ">", "60000000", ":", "chunks_size", "=", "int", "(", "(", "(", "mem_free", "-", "10000000", ")", "*", "1000", ")", "/...
Given a dimension of size 'N', determine the number of rows or columns that can fit into memory. Parameters ---------- N : int The size of one of the dimension of a two-dimensional array. n : int The number of times an 'N' by 'chunks_size' array can fit in memory. Return...
[ "Given", "a", "dimension", "of", "size", "N", "determine", "the", "number", "of", "rows", "or", "columns", "that", "can", "fit", "into", "memory", "." ]
075b1eec86d0e75166a9378d7d9a8974fc0a5e2e
https://github.com/GGiecold/DBSCAN_multiplex/blob/075b1eec86d0e75166a9378d7d9a8974fc0a5e2e/DBSCAN_multiplex.py#L151-L191
train
60,053
Wiredcraft/dopy
dopy/manager.py
DoManager.all_floating_ips
def all_floating_ips(self): """ Lists all of the Floating IPs available on the account. """ if self.api_version == 2: json = self.request('/floating_ips') return json['floating_ips'] else: raise DoError(v2_api_required_str)
python
def all_floating_ips(self): """ Lists all of the Floating IPs available on the account. """ if self.api_version == 2: json = self.request('/floating_ips') return json['floating_ips'] else: raise DoError(v2_api_required_str)
[ "def", "all_floating_ips", "(", "self", ")", ":", "if", "self", ".", "api_version", "==", "2", ":", "json", "=", "self", ".", "request", "(", "'/floating_ips'", ")", "return", "json", "[", "'floating_ips'", "]", "else", ":", "raise", "DoError", "(", "v2_...
Lists all of the Floating IPs available on the account.
[ "Lists", "all", "of", "the", "Floating", "IPs", "available", "on", "the", "account", "." ]
8b7bcbc85ef27ec4ae2fb46eae9bac827c4c3df0
https://github.com/Wiredcraft/dopy/blob/8b7bcbc85ef27ec4ae2fb46eae9bac827c4c3df0/dopy/manager.py#L462-L470
train
60,054
Wiredcraft/dopy
dopy/manager.py
DoManager.new_floating_ip
def new_floating_ip(self, **kwargs): """ Creates a Floating IP and assigns it to a Droplet or reserves it to a region. """ droplet_id = kwargs.get('droplet_id') region = kwargs.get('region') if self.api_version == 2: if droplet_id is not None and region is no...
python
def new_floating_ip(self, **kwargs): """ Creates a Floating IP and assigns it to a Droplet or reserves it to a region. """ droplet_id = kwargs.get('droplet_id') region = kwargs.get('region') if self.api_version == 2: if droplet_id is not None and region is no...
[ "def", "new_floating_ip", "(", "self", ",", "*", "*", "kwargs", ")", ":", "droplet_id", "=", "kwargs", ".", "get", "(", "'droplet_id'", ")", "region", "=", "kwargs", ".", "get", "(", "'region'", ")", "if", "self", ".", "api_version", "==", "2", ":", ...
Creates a Floating IP and assigns it to a Droplet or reserves it to a region.
[ "Creates", "a", "Floating", "IP", "and", "assigns", "it", "to", "a", "Droplet", "or", "reserves", "it", "to", "a", "region", "." ]
8b7bcbc85ef27ec4ae2fb46eae9bac827c4c3df0
https://github.com/Wiredcraft/dopy/blob/8b7bcbc85ef27ec4ae2fb46eae9bac827c4c3df0/dopy/manager.py#L472-L495
train
60,055
Wiredcraft/dopy
dopy/manager.py
DoManager.destroy_floating_ip
def destroy_floating_ip(self, ip_addr): """ Deletes a Floating IP and removes it from the account. """ if self.api_version == 2: self.request('/floating_ips/' + ip_addr, method='DELETE') else: raise DoError(v2_api_required_str)
python
def destroy_floating_ip(self, ip_addr): """ Deletes a Floating IP and removes it from the account. """ if self.api_version == 2: self.request('/floating_ips/' + ip_addr, method='DELETE') else: raise DoError(v2_api_required_str)
[ "def", "destroy_floating_ip", "(", "self", ",", "ip_addr", ")", ":", "if", "self", ".", "api_version", "==", "2", ":", "self", ".", "request", "(", "'/floating_ips/'", "+", "ip_addr", ",", "method", "=", "'DELETE'", ")", "else", ":", "raise", "DoError", ...
Deletes a Floating IP and removes it from the account.
[ "Deletes", "a", "Floating", "IP", "and", "removes", "it", "from", "the", "account", "." ]
8b7bcbc85ef27ec4ae2fb46eae9bac827c4c3df0
https://github.com/Wiredcraft/dopy/blob/8b7bcbc85ef27ec4ae2fb46eae9bac827c4c3df0/dopy/manager.py#L497-L504
train
60,056
Wiredcraft/dopy
dopy/manager.py
DoManager.assign_floating_ip
def assign_floating_ip(self, ip_addr, droplet_id): """ Assigns a Floating IP to a Droplet. """ if self.api_version == 2: params = {'type': 'assign','droplet_id': droplet_id} json = self.request('/floating_ips/' + ip_addr + '/actions', params=params, method='POST'...
python
def assign_floating_ip(self, ip_addr, droplet_id): """ Assigns a Floating IP to a Droplet. """ if self.api_version == 2: params = {'type': 'assign','droplet_id': droplet_id} json = self.request('/floating_ips/' + ip_addr + '/actions', params=params, method='POST'...
[ "def", "assign_floating_ip", "(", "self", ",", "ip_addr", ",", "droplet_id", ")", ":", "if", "self", ".", "api_version", "==", "2", ":", "params", "=", "{", "'type'", ":", "'assign'", ",", "'droplet_id'", ":", "droplet_id", "}", "json", "=", "self", ".",...
Assigns a Floating IP to a Droplet.
[ "Assigns", "a", "Floating", "IP", "to", "a", "Droplet", "." ]
8b7bcbc85ef27ec4ae2fb46eae9bac827c4c3df0
https://github.com/Wiredcraft/dopy/blob/8b7bcbc85ef27ec4ae2fb46eae9bac827c4c3df0/dopy/manager.py#L506-L516
train
60,057
Wiredcraft/dopy
dopy/manager.py
DoManager.unassign_floating_ip
def unassign_floating_ip(self, ip_addr): """ Unassign a Floating IP from a Droplet. The Floating IP will be reserved in the region but not assigned to a Droplet. """ if self.api_version == 2: params = {'type': 'unassign'} json = self.request('/floating_ip...
python
def unassign_floating_ip(self, ip_addr): """ Unassign a Floating IP from a Droplet. The Floating IP will be reserved in the region but not assigned to a Droplet. """ if self.api_version == 2: params = {'type': 'unassign'} json = self.request('/floating_ip...
[ "def", "unassign_floating_ip", "(", "self", ",", "ip_addr", ")", ":", "if", "self", ".", "api_version", "==", "2", ":", "params", "=", "{", "'type'", ":", "'unassign'", "}", "json", "=", "self", ".", "request", "(", "'/floating_ips/'", "+", "ip_addr", "+...
Unassign a Floating IP from a Droplet. The Floating IP will be reserved in the region but not assigned to a Droplet.
[ "Unassign", "a", "Floating", "IP", "from", "a", "Droplet", ".", "The", "Floating", "IP", "will", "be", "reserved", "in", "the", "region", "but", "not", "assigned", "to", "a", "Droplet", "." ]
8b7bcbc85ef27ec4ae2fb46eae9bac827c4c3df0
https://github.com/Wiredcraft/dopy/blob/8b7bcbc85ef27ec4ae2fb46eae9bac827c4c3df0/dopy/manager.py#L518-L529
train
60,058
Wiredcraft/dopy
dopy/manager.py
DoManager.list_floating_ip_actions
def list_floating_ip_actions(self, ip_addr): """ Retrieve a list of all actions that have been executed on a Floating IP. """ if self.api_version == 2: json = self.request('/floating_ips/' + ip_addr + '/actions') return json['actions'] else: ra...
python
def list_floating_ip_actions(self, ip_addr): """ Retrieve a list of all actions that have been executed on a Floating IP. """ if self.api_version == 2: json = self.request('/floating_ips/' + ip_addr + '/actions') return json['actions'] else: ra...
[ "def", "list_floating_ip_actions", "(", "self", ",", "ip_addr", ")", ":", "if", "self", ".", "api_version", "==", "2", ":", "json", "=", "self", ".", "request", "(", "'/floating_ips/'", "+", "ip_addr", "+", "'/actions'", ")", "return", "json", "[", "'actio...
Retrieve a list of all actions that have been executed on a Floating IP.
[ "Retrieve", "a", "list", "of", "all", "actions", "that", "have", "been", "executed", "on", "a", "Floating", "IP", "." ]
8b7bcbc85ef27ec4ae2fb46eae9bac827c4c3df0
https://github.com/Wiredcraft/dopy/blob/8b7bcbc85ef27ec4ae2fb46eae9bac827c4c3df0/dopy/manager.py#L531-L539
train
60,059
Wiredcraft/dopy
dopy/manager.py
DoManager.get_floating_ip_action
def get_floating_ip_action(self, ip_addr, action_id): """ Retrieve the status of a Floating IP action. """ if self.api_version == 2: json = self.request('/floating_ips/' + ip_addr + '/actions/' + action_id) return json['action'] else: raise DoE...
python
def get_floating_ip_action(self, ip_addr, action_id): """ Retrieve the status of a Floating IP action. """ if self.api_version == 2: json = self.request('/floating_ips/' + ip_addr + '/actions/' + action_id) return json['action'] else: raise DoE...
[ "def", "get_floating_ip_action", "(", "self", ",", "ip_addr", ",", "action_id", ")", ":", "if", "self", ".", "api_version", "==", "2", ":", "json", "=", "self", ".", "request", "(", "'/floating_ips/'", "+", "ip_addr", "+", "'/actions/'", "+", "action_id", ...
Retrieve the status of a Floating IP action.
[ "Retrieve", "the", "status", "of", "a", "Floating", "IP", "action", "." ]
8b7bcbc85ef27ec4ae2fb46eae9bac827c4c3df0
https://github.com/Wiredcraft/dopy/blob/8b7bcbc85ef27ec4ae2fb46eae9bac827c4c3df0/dopy/manager.py#L541-L549
train
60,060
etoccalino/django-rest-framework-httpsignature
utils/sign3.py
raw_sign
def raw_sign(message, secret): """Sign a message.""" digest = hmac.new(secret, message, hashlib.sha256).digest() return base64.b64encode(digest)
python
def raw_sign(message, secret): """Sign a message.""" digest = hmac.new(secret, message, hashlib.sha256).digest() return base64.b64encode(digest)
[ "def", "raw_sign", "(", "message", ",", "secret", ")", ":", "digest", "=", "hmac", ".", "new", "(", "secret", ",", "message", ",", "hashlib", ".", "sha256", ")", ".", "digest", "(", ")", "return", "base64", ".", "b64encode", "(", "digest", ")" ]
Sign a message.
[ "Sign", "a", "message", "." ]
03ac3c213153ae6084c84b8ff61e101798b342a4
https://github.com/etoccalino/django-rest-framework-httpsignature/blob/03ac3c213153ae6084c84b8ff61e101798b342a4/utils/sign3.py#L23-L26
train
60,061
etoccalino/django-rest-framework-httpsignature
rest_framework_httpsignature/authentication.py
SignatureAuthentication.get_signature_from_signature_string
def get_signature_from_signature_string(self, signature): """Return the signature from the signature header or None.""" match = self.SIGNATURE_RE.search(signature) if not match: return None return match.group(1)
python
def get_signature_from_signature_string(self, signature): """Return the signature from the signature header or None.""" match = self.SIGNATURE_RE.search(signature) if not match: return None return match.group(1)
[ "def", "get_signature_from_signature_string", "(", "self", ",", "signature", ")", ":", "match", "=", "self", ".", "SIGNATURE_RE", ".", "search", "(", "signature", ")", "if", "not", "match", ":", "return", "None", "return", "match", ".", "group", "(", "1", ...
Return the signature from the signature header or None.
[ "Return", "the", "signature", "from", "the", "signature", "header", "or", "None", "." ]
03ac3c213153ae6084c84b8ff61e101798b342a4
https://github.com/etoccalino/django-rest-framework-httpsignature/blob/03ac3c213153ae6084c84b8ff61e101798b342a4/rest_framework_httpsignature/authentication.py#L15-L20
train
60,062
etoccalino/django-rest-framework-httpsignature
rest_framework_httpsignature/authentication.py
SignatureAuthentication.get_headers_from_signature
def get_headers_from_signature(self, signature): """Returns a list of headers fields to sign. According to http://tools.ietf.org/html/draft-cavage-http-signatures-03 section 2.1.3, the headers are optional. If not specified, the single value of "Date" must be used. """ m...
python
def get_headers_from_signature(self, signature): """Returns a list of headers fields to sign. According to http://tools.ietf.org/html/draft-cavage-http-signatures-03 section 2.1.3, the headers are optional. If not specified, the single value of "Date" must be used. """ m...
[ "def", "get_headers_from_signature", "(", "self", ",", "signature", ")", ":", "match", "=", "self", ".", "SIGNATURE_HEADERS_RE", ".", "search", "(", "signature", ")", "if", "not", "match", ":", "return", "[", "'date'", "]", "headers_string", "=", "match", "....
Returns a list of headers fields to sign. According to http://tools.ietf.org/html/draft-cavage-http-signatures-03 section 2.1.3, the headers are optional. If not specified, the single value of "Date" must be used.
[ "Returns", "a", "list", "of", "headers", "fields", "to", "sign", "." ]
03ac3c213153ae6084c84b8ff61e101798b342a4
https://github.com/etoccalino/django-rest-framework-httpsignature/blob/03ac3c213153ae6084c84b8ff61e101798b342a4/rest_framework_httpsignature/authentication.py#L22-L33
train
60,063
etoccalino/django-rest-framework-httpsignature
rest_framework_httpsignature/authentication.py
SignatureAuthentication.header_canonical
def header_canonical(self, header_name): """Translate HTTP headers to Django header names.""" # Translate as stated in the docs: # https://docs.djangoproject.com/en/1.6/ref/request-response/#django.http.HttpRequest.META header_name = header_name.lower() if header_name == 'content...
python
def header_canonical(self, header_name): """Translate HTTP headers to Django header names.""" # Translate as stated in the docs: # https://docs.djangoproject.com/en/1.6/ref/request-response/#django.http.HttpRequest.META header_name = header_name.lower() if header_name == 'content...
[ "def", "header_canonical", "(", "self", ",", "header_name", ")", ":", "# Translate as stated in the docs:", "# https://docs.djangoproject.com/en/1.6/ref/request-response/#django.http.HttpRequest.META", "header_name", "=", "header_name", ".", "lower", "(", ")", "if", "header_name"...
Translate HTTP headers to Django header names.
[ "Translate", "HTTP", "headers", "to", "Django", "header", "names", "." ]
03ac3c213153ae6084c84b8ff61e101798b342a4
https://github.com/etoccalino/django-rest-framework-httpsignature/blob/03ac3c213153ae6084c84b8ff61e101798b342a4/rest_framework_httpsignature/authentication.py#L35-L44
train
60,064
etoccalino/django-rest-framework-httpsignature
rest_framework_httpsignature/authentication.py
SignatureAuthentication.build_dict_to_sign
def build_dict_to_sign(self, request, signature_headers): """Build a dict with headers and values used in the signature. "signature_headers" is a list of lowercase header names. """ d = {} for header in signature_headers: if header == '(request-target)': ...
python
def build_dict_to_sign(self, request, signature_headers): """Build a dict with headers and values used in the signature. "signature_headers" is a list of lowercase header names. """ d = {} for header in signature_headers: if header == '(request-target)': ...
[ "def", "build_dict_to_sign", "(", "self", ",", "request", ",", "signature_headers", ")", ":", "d", "=", "{", "}", "for", "header", "in", "signature_headers", ":", "if", "header", "==", "'(request-target)'", ":", "continue", "d", "[", "header", "]", "=", "r...
Build a dict with headers and values used in the signature. "signature_headers" is a list of lowercase header names.
[ "Build", "a", "dict", "with", "headers", "and", "values", "used", "in", "the", "signature", "." ]
03ac3c213153ae6084c84b8ff61e101798b342a4
https://github.com/etoccalino/django-rest-framework-httpsignature/blob/03ac3c213153ae6084c84b8ff61e101798b342a4/rest_framework_httpsignature/authentication.py#L46-L56
train
60,065
etoccalino/django-rest-framework-httpsignature
rest_framework_httpsignature/authentication.py
SignatureAuthentication.build_signature
def build_signature(self, user_api_key, user_secret, request): """Return the signature for the request.""" path = request.get_full_path() sent_signature = request.META.get( self.header_canonical('Authorization')) signature_headers = self.get_headers_from_signature(sent_signat...
python
def build_signature(self, user_api_key, user_secret, request): """Return the signature for the request.""" path = request.get_full_path() sent_signature = request.META.get( self.header_canonical('Authorization')) signature_headers = self.get_headers_from_signature(sent_signat...
[ "def", "build_signature", "(", "self", ",", "user_api_key", ",", "user_secret", ",", "request", ")", ":", "path", "=", "request", ".", "get_full_path", "(", ")", "sent_signature", "=", "request", ".", "META", ".", "get", "(", "self", ".", "header_canonical",...
Return the signature for the request.
[ "Return", "the", "signature", "for", "the", "request", "." ]
03ac3c213153ae6084c84b8ff61e101798b342a4
https://github.com/etoccalino/django-rest-framework-httpsignature/blob/03ac3c213153ae6084c84b8ff61e101798b342a4/rest_framework_httpsignature/authentication.py#L58-L71
train
60,066
ivankliuk/duckduckpy
duckduckpy/utils.py
camel_to_snake_case
def camel_to_snake_case(string): """Converts 'string' presented in camel case to snake case. e.g.: CamelCase => snake_case """ s = _1.sub(r'\1_\2', string) return _2.sub(r'\1_\2', s).lower()
python
def camel_to_snake_case(string): """Converts 'string' presented in camel case to snake case. e.g.: CamelCase => snake_case """ s = _1.sub(r'\1_\2', string) return _2.sub(r'\1_\2', s).lower()
[ "def", "camel_to_snake_case", "(", "string", ")", ":", "s", "=", "_1", ".", "sub", "(", "r'\\1_\\2'", ",", "string", ")", "return", "_2", ".", "sub", "(", "r'\\1_\\2'", ",", "s", ")", ".", "lower", "(", ")" ]
Converts 'string' presented in camel case to snake case. e.g.: CamelCase => snake_case
[ "Converts", "string", "presented", "in", "camel", "case", "to", "snake", "case", "." ]
4114d8555a1752ab5170f6a8e71cbe377aa86f4d
https://github.com/ivankliuk/duckduckpy/blob/4114d8555a1752ab5170f6a8e71cbe377aa86f4d/duckduckpy/utils.py#L38-L44
train
60,067
ivankliuk/duckduckpy
duckduckpy/core.py
url_assembler
def url_assembler(query_string, no_redirect=0, no_html=0, skip_disambig=0): """Assembler of parameters for building request query. Args: query_string: Query to be passed to DuckDuckGo API. no_redirect: Skip HTTP redirects (for !bang commands). Default - False. no_html: Remove HTML from ...
python
def url_assembler(query_string, no_redirect=0, no_html=0, skip_disambig=0): """Assembler of parameters for building request query. Args: query_string: Query to be passed to DuckDuckGo API. no_redirect: Skip HTTP redirects (for !bang commands). Default - False. no_html: Remove HTML from ...
[ "def", "url_assembler", "(", "query_string", ",", "no_redirect", "=", "0", ",", "no_html", "=", "0", ",", "skip_disambig", "=", "0", ")", ":", "params", "=", "[", "(", "'q'", ",", "query_string", ".", "encode", "(", "\"utf-8\"", ")", ")", ",", "(", "...
Assembler of parameters for building request query. Args: query_string: Query to be passed to DuckDuckGo API. no_redirect: Skip HTTP redirects (for !bang commands). Default - False. no_html: Remove HTML from text, e.g. bold and italics. Default - False. skip_disambig: Skip disambigu...
[ "Assembler", "of", "parameters", "for", "building", "request", "query", "." ]
4114d8555a1752ab5170f6a8e71cbe377aa86f4d
https://github.com/ivankliuk/duckduckpy/blob/4114d8555a1752ab5170f6a8e71cbe377aa86f4d/duckduckpy/core.py#L98-L119
train
60,068
ivankliuk/duckduckpy
duckduckpy/core.py
query
def query(query_string, secure=False, container='namedtuple', verbose=False, user_agent=api.USER_AGENT, no_redirect=False, no_html=False, skip_disambig=False): """ Generates and sends a query to DuckDuckGo API. Args: query_string: Query to be passed to DuckDuckGo API. se...
python
def query(query_string, secure=False, container='namedtuple', verbose=False, user_agent=api.USER_AGENT, no_redirect=False, no_html=False, skip_disambig=False): """ Generates and sends a query to DuckDuckGo API. Args: query_string: Query to be passed to DuckDuckGo API. se...
[ "def", "query", "(", "query_string", ",", "secure", "=", "False", ",", "container", "=", "'namedtuple'", ",", "verbose", "=", "False", ",", "user_agent", "=", "api", ".", "USER_AGENT", ",", "no_redirect", "=", "False", ",", "no_html", "=", "False", ",", ...
Generates and sends a query to DuckDuckGo API. Args: query_string: Query to be passed to DuckDuckGo API. secure: Use secure SSL/TLS connection. Default - False. Syntactic sugar is secure_query function which is passed the same parameters. container: Indicates how dic...
[ "Generates", "and", "sends", "a", "query", "to", "DuckDuckGo", "API", "." ]
4114d8555a1752ab5170f6a8e71cbe377aa86f4d
https://github.com/ivankliuk/duckduckpy/blob/4114d8555a1752ab5170f6a8e71cbe377aa86f4d/duckduckpy/core.py#L122-L214
train
60,069
wickman/pystachio
pystachio/container.py
ListFactory.create
def create(type_dict, *type_parameters): """ Construct a List containing type 'klazz'. """ assert len(type_parameters) == 1 klazz = TypeFactory.new(type_dict, *type_parameters[0]) assert isclass(klazz) assert issubclass(klazz, Object) return TypeMetaclass('%sList' % klazz.__name__, (Li...
python
def create(type_dict, *type_parameters): """ Construct a List containing type 'klazz'. """ assert len(type_parameters) == 1 klazz = TypeFactory.new(type_dict, *type_parameters[0]) assert isclass(klazz) assert issubclass(klazz, Object) return TypeMetaclass('%sList' % klazz.__name__, (Li...
[ "def", "create", "(", "type_dict", ",", "*", "type_parameters", ")", ":", "assert", "len", "(", "type_parameters", ")", "==", "1", "klazz", "=", "TypeFactory", ".", "new", "(", "type_dict", ",", "*", "type_parameters", "[", "0", "]", ")", "assert", "iscl...
Construct a List containing type 'klazz'.
[ "Construct", "a", "List", "containing", "type", "klazz", "." ]
601a2c36d7d67efa8f917e7cbf0ab8dc66c7827f
https://github.com/wickman/pystachio/blob/601a2c36d7d67efa8f917e7cbf0ab8dc66c7827f/pystachio/container.py#L15-L23
train
60,070
jeffh/sniffer
sniffer/scent_picker.py
load_file
def load_file(filename): "Runs the given scent.py file." mod_name = '.'.join(os.path.basename(filename).split('.')[:-1]) mod_path = os.path.dirname(filename) if mod_name in sys.modules: del sys.modules[mod_name] if mod_path not in set(sys.modules.keys()): sys.path.insert(0, mod_path...
python
def load_file(filename): "Runs the given scent.py file." mod_name = '.'.join(os.path.basename(filename).split('.')[:-1]) mod_path = os.path.dirname(filename) if mod_name in sys.modules: del sys.modules[mod_name] if mod_path not in set(sys.modules.keys()): sys.path.insert(0, mod_path...
[ "def", "load_file", "(", "filename", ")", ":", "mod_name", "=", "'.'", ".", "join", "(", "os", ".", "path", ".", "basename", "(", "filename", ")", ".", "split", "(", "'.'", ")", "[", ":", "-", "1", "]", ")", "mod_path", "=", "os", ".", "path", ...
Runs the given scent.py file.
[ "Runs", "the", "given", "scent", ".", "py", "file", "." ]
8e4c3e77743aef08109ea0225b4a6536d4e60270
https://github.com/jeffh/sniffer/blob/8e4c3e77743aef08109ea0225b4a6536d4e60270/sniffer/scent_picker.py#L82-L91
train
60,071
wickman/pystachio
pystachio/typing.py
TypeFactory.new
def new(type_dict, type_factory, *type_parameters): """ Create a fully reified type from a type schema. """ type_tuple = (type_factory,) + type_parameters if type_tuple not in type_dict: factory = TypeFactory.get_factory(type_factory) reified_type = factory.create(type_dict, *type_para...
python
def new(type_dict, type_factory, *type_parameters): """ Create a fully reified type from a type schema. """ type_tuple = (type_factory,) + type_parameters if type_tuple not in type_dict: factory = TypeFactory.get_factory(type_factory) reified_type = factory.create(type_dict, *type_para...
[ "def", "new", "(", "type_dict", ",", "type_factory", ",", "*", "type_parameters", ")", ":", "type_tuple", "=", "(", "type_factory", ",", ")", "+", "type_parameters", "if", "type_tuple", "not", "in", "type_dict", ":", "factory", "=", "TypeFactory", ".", "get_...
Create a fully reified type from a type schema.
[ "Create", "a", "fully", "reified", "type", "from", "a", "type", "schema", "." ]
601a2c36d7d67efa8f917e7cbf0ab8dc66c7827f
https://github.com/wickman/pystachio/blob/601a2c36d7d67efa8f917e7cbf0ab8dc66c7827f/pystachio/typing.py#L77-L86
train
60,072
wickman/pystachio
pystachio/composite.py
TypeSignature.wrap
def wrap(sig): """Convert a Python class into a type signature.""" if isclass(sig) and issubclass(sig, Object): return TypeSignature(sig) elif isinstance(sig, TypeSignature): return sig
python
def wrap(sig): """Convert a Python class into a type signature.""" if isclass(sig) and issubclass(sig, Object): return TypeSignature(sig) elif isinstance(sig, TypeSignature): return sig
[ "def", "wrap", "(", "sig", ")", ":", "if", "isclass", "(", "sig", ")", "and", "issubclass", "(", "sig", ",", "Object", ")", ":", "return", "TypeSignature", "(", "sig", ")", "elif", "isinstance", "(", "sig", ",", "TypeSignature", ")", ":", "return", "...
Convert a Python class into a type signature.
[ "Convert", "a", "Python", "class", "into", "a", "type", "signature", "." ]
601a2c36d7d67efa8f917e7cbf0ab8dc66c7827f
https://github.com/wickman/pystachio/blob/601a2c36d7d67efa8f917e7cbf0ab8dc66c7827f/pystachio/composite.py#L90-L95
train
60,073
jeffh/sniffer
sniffer/scanner/base.py
BaseScanner.trigger_modified
def trigger_modified(self, filepath): """Triggers modified event if the given filepath mod time is newer.""" mod_time = self._get_modified_time(filepath) if mod_time > self._watched_files.get(filepath, 0): self._trigger('modified', filepath) self._watched_files[filepath] ...
python
def trigger_modified(self, filepath): """Triggers modified event if the given filepath mod time is newer.""" mod_time = self._get_modified_time(filepath) if mod_time > self._watched_files.get(filepath, 0): self._trigger('modified', filepath) self._watched_files[filepath] ...
[ "def", "trigger_modified", "(", "self", ",", "filepath", ")", ":", "mod_time", "=", "self", ".", "_get_modified_time", "(", "filepath", ")", "if", "mod_time", ">", "self", ".", "_watched_files", ".", "get", "(", "filepath", ",", "0", ")", ":", "self", "....
Triggers modified event if the given filepath mod time is newer.
[ "Triggers", "modified", "event", "if", "the", "given", "filepath", "mod", "time", "is", "newer", "." ]
8e4c3e77743aef08109ea0225b4a6536d4e60270
https://github.com/jeffh/sniffer/blob/8e4c3e77743aef08109ea0225b4a6536d4e60270/sniffer/scanner/base.py#L39-L44
train
60,074
jeffh/sniffer
sniffer/scanner/base.py
BaseScanner.trigger_created
def trigger_created(self, filepath): """Triggers created event if file exists.""" if os.path.exists(filepath): self._trigger('created', filepath)
python
def trigger_created(self, filepath): """Triggers created event if file exists.""" if os.path.exists(filepath): self._trigger('created', filepath)
[ "def", "trigger_created", "(", "self", ",", "filepath", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "filepath", ")", ":", "self", ".", "_trigger", "(", "'created'", ",", "filepath", ")" ]
Triggers created event if file exists.
[ "Triggers", "created", "event", "if", "file", "exists", "." ]
8e4c3e77743aef08109ea0225b4a6536d4e60270
https://github.com/jeffh/sniffer/blob/8e4c3e77743aef08109ea0225b4a6536d4e60270/sniffer/scanner/base.py#L46-L49
train
60,075
jeffh/sniffer
sniffer/scanner/base.py
BaseScanner.trigger_deleted
def trigger_deleted(self, filepath): """Triggers deleted event if the flie doesn't exist.""" if not os.path.exists(filepath): self._trigger('deleted', filepath)
python
def trigger_deleted(self, filepath): """Triggers deleted event if the flie doesn't exist.""" if not os.path.exists(filepath): self._trigger('deleted', filepath)
[ "def", "trigger_deleted", "(", "self", ",", "filepath", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "filepath", ")", ":", "self", ".", "_trigger", "(", "'deleted'", ",", "filepath", ")" ]
Triggers deleted event if the flie doesn't exist.
[ "Triggers", "deleted", "event", "if", "the", "flie", "doesn", "t", "exist", "." ]
8e4c3e77743aef08109ea0225b4a6536d4e60270
https://github.com/jeffh/sniffer/blob/8e4c3e77743aef08109ea0225b4a6536d4e60270/sniffer/scanner/base.py#L51-L54
train
60,076
jeffh/sniffer
sniffer/scanner/base.py
BaseScanner.log
def log(self, *message): """ Logs a messate to a defined io stream if available. """ if self._logger is None: return s = " ".join([str(m) for m in message]) self._logger.write(s+'\n') self._logger.flush()
python
def log(self, *message): """ Logs a messate to a defined io stream if available. """ if self._logger is None: return s = " ".join([str(m) for m in message]) self._logger.write(s+'\n') self._logger.flush()
[ "def", "log", "(", "self", ",", "*", "message", ")", ":", "if", "self", ".", "_logger", "is", "None", ":", "return", "s", "=", "\" \"", ".", "join", "(", "[", "str", "(", "m", ")", "for", "m", "in", "message", "]", ")", "self", ".", "_logger", ...
Logs a messate to a defined io stream if available.
[ "Logs", "a", "messate", "to", "a", "defined", "io", "stream", "if", "available", "." ]
8e4c3e77743aef08109ea0225b4a6536d4e60270
https://github.com/jeffh/sniffer/blob/8e4c3e77743aef08109ea0225b4a6536d4e60270/sniffer/scanner/base.py#L102-L110
train
60,077
jeffh/sniffer
sniffer/scanner/base.py
BaseScanner.in_repo
def in_repo(self, filepath): """ This excludes repository directories because they cause some exceptions occationally. """ filepath = set(filepath.replace('\\', '/').split('/')) for p in ('.git', '.hg', '.svn', '.cvs', '.bzr'): if p in filepath: ...
python
def in_repo(self, filepath): """ This excludes repository directories because they cause some exceptions occationally. """ filepath = set(filepath.replace('\\', '/').split('/')) for p in ('.git', '.hg', '.svn', '.cvs', '.bzr'): if p in filepath: ...
[ "def", "in_repo", "(", "self", ",", "filepath", ")", ":", "filepath", "=", "set", "(", "filepath", ".", "replace", "(", "'\\\\'", ",", "'/'", ")", ".", "split", "(", "'/'", ")", ")", "for", "p", "in", "(", "'.git'", ",", "'.hg'", ",", "'.svn'", "...
This excludes repository directories because they cause some exceptions occationally.
[ "This", "excludes", "repository", "directories", "because", "they", "cause", "some", "exceptions", "occationally", "." ]
8e4c3e77743aef08109ea0225b4a6536d4e60270
https://github.com/jeffh/sniffer/blob/8e4c3e77743aef08109ea0225b4a6536d4e60270/sniffer/scanner/base.py#L129-L138
train
60,078
jeffh/sniffer
sniffer/scanner/base.py
BaseScanner._modify_event
def _modify_event(self, event_name, method, func): """ Wrapper to call a list's method from one of the events """ if event_name not in self.ALL_EVENTS: raise TypeError(('event_name ("%s") can only be one of the ' 'following: %s') % (event_name, ...
python
def _modify_event(self, event_name, method, func): """ Wrapper to call a list's method from one of the events """ if event_name not in self.ALL_EVENTS: raise TypeError(('event_name ("%s") can only be one of the ' 'following: %s') % (event_name, ...
[ "def", "_modify_event", "(", "self", ",", "event_name", ",", "method", ",", "func", ")", ":", "if", "event_name", "not", "in", "self", ".", "ALL_EVENTS", ":", "raise", "TypeError", "(", "(", "'event_name (\"%s\") can only be one of the '", "'following: %s'", ")", ...
Wrapper to call a list's method from one of the events
[ "Wrapper", "to", "call", "a", "list", "s", "method", "from", "one", "of", "the", "events" ]
8e4c3e77743aef08109ea0225b4a6536d4e60270
https://github.com/jeffh/sniffer/blob/8e4c3e77743aef08109ea0225b4a6536d4e60270/sniffer/scanner/base.py#L166-L177
train
60,079
jeffh/sniffer
sniffer/scanner/base.py
PollingScanner._watch_file
def _watch_file(self, filepath, trigger_event=True): """Adds the file's modified time into its internal watchlist.""" is_new = filepath not in self._watched_files if trigger_event: if is_new: self.trigger_created(filepath) else: self.trigge...
python
def _watch_file(self, filepath, trigger_event=True): """Adds the file's modified time into its internal watchlist.""" is_new = filepath not in self._watched_files if trigger_event: if is_new: self.trigger_created(filepath) else: self.trigge...
[ "def", "_watch_file", "(", "self", ",", "filepath", ",", "trigger_event", "=", "True", ")", ":", "is_new", "=", "filepath", "not", "in", "self", ".", "_watched_files", "if", "trigger_event", ":", "if", "is_new", ":", "self", ".", "trigger_created", "(", "f...
Adds the file's modified time into its internal watchlist.
[ "Adds", "the", "file", "s", "modified", "time", "into", "its", "internal", "watchlist", "." ]
8e4c3e77743aef08109ea0225b4a6536d4e60270
https://github.com/jeffh/sniffer/blob/8e4c3e77743aef08109ea0225b4a6536d4e60270/sniffer/scanner/base.py#L219-L230
train
60,080
jeffh/sniffer
sniffer/scanner/base.py
PollingScanner._unwatch_file
def _unwatch_file(self, filepath, trigger_event=True): """ Removes the file from the internal watchlist if exists. """ if filepath not in self._watched_files: return if trigger_event: self.trigger_deleted(filepath) del self._watched_files[filepath]
python
def _unwatch_file(self, filepath, trigger_event=True): """ Removes the file from the internal watchlist if exists. """ if filepath not in self._watched_files: return if trigger_event: self.trigger_deleted(filepath) del self._watched_files[filepath]
[ "def", "_unwatch_file", "(", "self", ",", "filepath", ",", "trigger_event", "=", "True", ")", ":", "if", "filepath", "not", "in", "self", ".", "_watched_files", ":", "return", "if", "trigger_event", ":", "self", ".", "trigger_deleted", "(", "filepath", ")", ...
Removes the file from the internal watchlist if exists.
[ "Removes", "the", "file", "from", "the", "internal", "watchlist", "if", "exists", "." ]
8e4c3e77743aef08109ea0225b4a6536d4e60270
https://github.com/jeffh/sniffer/blob/8e4c3e77743aef08109ea0225b4a6536d4e60270/sniffer/scanner/base.py#L232-L240
train
60,081
jeffh/sniffer
sniffer/scanner/base.py
PollingScanner._is_modified
def _is_modified(self, filepath): """ Returns True if the file has been modified since last seen. Will return False if the file has not been seen before. """ if self._is_new(filepath): return False mtime = self._get_modified_time(filepath) return self....
python
def _is_modified(self, filepath): """ Returns True if the file has been modified since last seen. Will return False if the file has not been seen before. """ if self._is_new(filepath): return False mtime = self._get_modified_time(filepath) return self....
[ "def", "_is_modified", "(", "self", ",", "filepath", ")", ":", "if", "self", ".", "_is_new", "(", "filepath", ")", ":", "return", "False", "mtime", "=", "self", ".", "_get_modified_time", "(", "filepath", ")", "return", "self", ".", "_watched_files", "[", ...
Returns True if the file has been modified since last seen. Will return False if the file has not been seen before.
[ "Returns", "True", "if", "the", "file", "has", "been", "modified", "since", "last", "seen", ".", "Will", "return", "False", "if", "the", "file", "has", "not", "been", "seen", "before", "." ]
8e4c3e77743aef08109ea0225b4a6536d4e60270
https://github.com/jeffh/sniffer/blob/8e4c3e77743aef08109ea0225b4a6536d4e60270/sniffer/scanner/base.py#L242-L250
train
60,082
jeffh/sniffer
sniffer/scanner/base.py
PollingScanner.loop
def loop(self, sleep_time=1, callback=None): """ Goes into a blocking IO loop. If polling is used, the sleep_time is the interval, in seconds, between polls. """ self.log("No supported libraries found: using polling-method.") self._running = True self.trigger_ini...
python
def loop(self, sleep_time=1, callback=None): """ Goes into a blocking IO loop. If polling is used, the sleep_time is the interval, in seconds, between polls. """ self.log("No supported libraries found: using polling-method.") self._running = True self.trigger_ini...
[ "def", "loop", "(", "self", ",", "sleep_time", "=", "1", ",", "callback", "=", "None", ")", ":", "self", ".", "log", "(", "\"No supported libraries found: using polling-method.\"", ")", "self", ".", "_running", "=", "True", "self", ".", "trigger_init", "(", ...
Goes into a blocking IO loop. If polling is used, the sleep_time is the interval, in seconds, between polls.
[ "Goes", "into", "a", "blocking", "IO", "loop", ".", "If", "polling", "is", "used", "the", "sleep_time", "is", "the", "interval", "in", "seconds", "between", "polls", "." ]
8e4c3e77743aef08109ea0225b4a6536d4e60270
https://github.com/jeffh/sniffer/blob/8e4c3e77743aef08109ea0225b4a6536d4e60270/sniffer/scanner/base.py#L260-L284
train
60,083
jeffh/sniffer
sniffer/main.py
run
def run(sniffer_instance=None, wait_time=0.5, clear=True, args=(), debug=False): """ Runs the auto tester loop. Internally, the runner instanciates the sniffer_cls and scanner class. ``sniffer_instance`` The class to run. Usually this is set to but a subclass of scanner. Def...
python
def run(sniffer_instance=None, wait_time=0.5, clear=True, args=(), debug=False): """ Runs the auto tester loop. Internally, the runner instanciates the sniffer_cls and scanner class. ``sniffer_instance`` The class to run. Usually this is set to but a subclass of scanner. Def...
[ "def", "run", "(", "sniffer_instance", "=", "None", ",", "wait_time", "=", "0.5", ",", "clear", "=", "True", ",", "args", "=", "(", ")", ",", "debug", "=", "False", ")", ":", "if", "sniffer_instance", "is", "None", ":", "sniffer_instance", "=", "ScentS...
Runs the auto tester loop. Internally, the runner instanciates the sniffer_cls and scanner class. ``sniffer_instance`` The class to run. Usually this is set to but a subclass of scanner. Defaults to Sniffer. Sniffer class documentation for more information. ``wait_time`` The time, in ...
[ "Runs", "the", "auto", "tester", "loop", ".", "Internally", "the", "runner", "instanciates", "the", "sniffer_cls", "and", "scanner", "class", "." ]
8e4c3e77743aef08109ea0225b4a6536d4e60270
https://github.com/jeffh/sniffer/blob/8e4c3e77743aef08109ea0225b4a6536d4e60270/sniffer/main.py#L17-L48
train
60,084
jeffh/sniffer
sniffer/main.py
main
def main(sniffer_instance=None, test_args=(), progname=sys.argv[0], args=sys.argv[1:]): """ Runs the program. This is used when you want to run this program standalone. ``sniffer_instance`` A class (usually subclassed of Sniffer) that hooks into the scanner and handles running ...
python
def main(sniffer_instance=None, test_args=(), progname=sys.argv[0], args=sys.argv[1:]): """ Runs the program. This is used when you want to run this program standalone. ``sniffer_instance`` A class (usually subclassed of Sniffer) that hooks into the scanner and handles running ...
[ "def", "main", "(", "sniffer_instance", "=", "None", ",", "test_args", "=", "(", ")", ",", "progname", "=", "sys", ".", "argv", "[", "0", "]", ",", "args", "=", "sys", ".", "argv", "[", "1", ":", "]", ")", ":", "parser", "=", "OptionParser", "(",...
Runs the program. This is used when you want to run this program standalone. ``sniffer_instance`` A class (usually subclassed of Sniffer) that hooks into the scanner and handles running the test framework. Defaults to Sniffer instance. ``test_args`` This function norma...
[ "Runs", "the", "program", ".", "This", "is", "used", "when", "you", "want", "to", "run", "this", "program", "standalone", "." ]
8e4c3e77743aef08109ea0225b4a6536d4e60270
https://github.com/jeffh/sniffer/blob/8e4c3e77743aef08109ea0225b4a6536d4e60270/sniffer/main.py#L50-L94
train
60,085
jeffh/sniffer
sniffer/runner.py
Sniffer.set_up
def set_up(self, test_args=(), clear=True, debug=False): """ Sets properties right before calling run. ``test_args`` The arguments to pass to the test runner. ``clear`` Boolean. Set to True if we should clear console before running the tests. ``...
python
def set_up(self, test_args=(), clear=True, debug=False): """ Sets properties right before calling run. ``test_args`` The arguments to pass to the test runner. ``clear`` Boolean. Set to True if we should clear console before running the tests. ``...
[ "def", "set_up", "(", "self", ",", "test_args", "=", "(", ")", ",", "clear", "=", "True", ",", "debug", "=", "False", ")", ":", "self", ".", "test_args", "=", "test_args", "self", ".", "debug", ",", "self", ".", "clear", "=", "debug", ",", "clear" ...
Sets properties right before calling run. ``test_args`` The arguments to pass to the test runner. ``clear`` Boolean. Set to True if we should clear console before running the tests. ``debug`` Boolean. Set to True if we want to print debugging ...
[ "Sets", "properties", "right", "before", "calling", "run", "." ]
8e4c3e77743aef08109ea0225b4a6536d4e60270
https://github.com/jeffh/sniffer/blob/8e4c3e77743aef08109ea0225b4a6536d4e60270/sniffer/runner.py#L55-L66
train
60,086
jeffh/sniffer
sniffer/runner.py
Sniffer.observe_scanner
def observe_scanner(self, scanner): """ Hooks into multiple events of a scanner. """ scanner.observe(scanner.ALL_EVENTS, self.absorb_args(self.modules.restore)) if self.clear: scanner.observe(scanner.ALL_EVENTS, self...
python
def observe_scanner(self, scanner): """ Hooks into multiple events of a scanner. """ scanner.observe(scanner.ALL_EVENTS, self.absorb_args(self.modules.restore)) if self.clear: scanner.observe(scanner.ALL_EVENTS, self...
[ "def", "observe_scanner", "(", "self", ",", "scanner", ")", ":", "scanner", ".", "observe", "(", "scanner", ".", "ALL_EVENTS", ",", "self", ".", "absorb_args", "(", "self", ".", "modules", ".", "restore", ")", ")", "if", "self", ".", "clear", ":", "sca...
Hooks into multiple events of a scanner.
[ "Hooks", "into", "multiple", "events", "of", "a", "scanner", "." ]
8e4c3e77743aef08109ea0225b4a6536d4e60270
https://github.com/jeffh/sniffer/blob/8e4c3e77743aef08109ea0225b4a6536d4e60270/sniffer/runner.py#L78-L92
train
60,087
jeffh/sniffer
sniffer/runner.py
Sniffer.clear_on_run
def clear_on_run(self, prefix="Running Tests:"): """Clears console before running the tests.""" if platform.system() == 'Windows': os.system('cls') else: os.system('clear') if prefix: print(prefix)
python
def clear_on_run(self, prefix="Running Tests:"): """Clears console before running the tests.""" if platform.system() == 'Windows': os.system('cls') else: os.system('clear') if prefix: print(prefix)
[ "def", "clear_on_run", "(", "self", ",", "prefix", "=", "\"Running Tests:\"", ")", ":", "if", "platform", ".", "system", "(", ")", "==", "'Windows'", ":", "os", ".", "system", "(", "'cls'", ")", "else", ":", "os", ".", "system", "(", "'clear'", ")", ...
Clears console before running the tests.
[ "Clears", "console", "before", "running", "the", "tests", "." ]
8e4c3e77743aef08109ea0225b4a6536d4e60270
https://github.com/jeffh/sniffer/blob/8e4c3e77743aef08109ea0225b4a6536d4e60270/sniffer/runner.py#L94-L101
train
60,088
jeffh/sniffer
sniffer/runner.py
Sniffer.run
def run(self): """ Runs the unit test framework. Can be overridden to run anything. Returns True on passing and False on failure. """ try: import nose arguments = [sys.argv[0]] + list(self.test_args) return nose.run(argv=arguments) exce...
python
def run(self): """ Runs the unit test framework. Can be overridden to run anything. Returns True on passing and False on failure. """ try: import nose arguments = [sys.argv[0]] + list(self.test_args) return nose.run(argv=arguments) exce...
[ "def", "run", "(", "self", ")", ":", "try", ":", "import", "nose", "arguments", "=", "[", "sys", ".", "argv", "[", "0", "]", "]", "+", "list", "(", "self", ".", "test_args", ")", "return", "nose", ".", "run", "(", "argv", "=", "arguments", ")", ...
Runs the unit test framework. Can be overridden to run anything. Returns True on passing and False on failure.
[ "Runs", "the", "unit", "test", "framework", ".", "Can", "be", "overridden", "to", "run", "anything", ".", "Returns", "True", "on", "passing", "and", "False", "on", "failure", "." ]
8e4c3e77743aef08109ea0225b4a6536d4e60270
https://github.com/jeffh/sniffer/blob/8e4c3e77743aef08109ea0225b4a6536d4e60270/sniffer/runner.py#L125-L138
train
60,089
jeffh/sniffer
sniffer/runner.py
ScentSniffer.run
def run(self): """ Runs the CWD's scent file. """ if not self.scent or len(self.scent.runners) == 0: print("Did not find 'scent.py', running nose:") return super(ScentSniffer, self).run() else: print("Using scent:") arguments = [sys...
python
def run(self): """ Runs the CWD's scent file. """ if not self.scent or len(self.scent.runners) == 0: print("Did not find 'scent.py', running nose:") return super(ScentSniffer, self).run() else: print("Using scent:") arguments = [sys...
[ "def", "run", "(", "self", ")", ":", "if", "not", "self", ".", "scent", "or", "len", "(", "self", ".", "scent", ".", "runners", ")", "==", "0", ":", "print", "(", "\"Did not find 'scent.py', running nose:\"", ")", "return", "super", "(", "ScentSniffer", ...
Runs the CWD's scent file.
[ "Runs", "the", "CWD", "s", "scent", "file", "." ]
8e4c3e77743aef08109ea0225b4a6536d4e60270
https://github.com/jeffh/sniffer/blob/8e4c3e77743aef08109ea0225b4a6536d4e60270/sniffer/runner.py#L189-L200
train
60,090
wickman/pystachio
pystachio/base.py
Object.copy
def copy(self): """ Return a copy of this object. """ self_copy = self.dup() self_copy._scopes = copy.copy(self._scopes) return self_copy
python
def copy(self): """ Return a copy of this object. """ self_copy = self.dup() self_copy._scopes = copy.copy(self._scopes) return self_copy
[ "def", "copy", "(", "self", ")", ":", "self_copy", "=", "self", ".", "dup", "(", ")", "self_copy", ".", "_scopes", "=", "copy", ".", "copy", "(", "self", ".", "_scopes", ")", "return", "self_copy" ]
Return a copy of this object.
[ "Return", "a", "copy", "of", "this", "object", "." ]
601a2c36d7d67efa8f917e7cbf0ab8dc66c7827f
https://github.com/wickman/pystachio/blob/601a2c36d7d67efa8f917e7cbf0ab8dc66c7827f/pystachio/base.py#L106-L112
train
60,091
wickman/pystachio
pystachio/base.py
Object.bind
def bind(self, *args, **kw): """ Bind environment variables into this object's scope. """ new_self = self.copy() new_scopes = Object.translate_to_scopes(*args, **kw) new_self._scopes = tuple(reversed(new_scopes)) + new_self._scopes return new_self
python
def bind(self, *args, **kw): """ Bind environment variables into this object's scope. """ new_self = self.copy() new_scopes = Object.translate_to_scopes(*args, **kw) new_self._scopes = tuple(reversed(new_scopes)) + new_self._scopes return new_self
[ "def", "bind", "(", "self", ",", "*", "args", ",", "*", "*", "kw", ")", ":", "new_self", "=", "self", ".", "copy", "(", ")", "new_scopes", "=", "Object", ".", "translate_to_scopes", "(", "*", "args", ",", "*", "*", "kw", ")", "new_self", ".", "_s...
Bind environment variables into this object's scope.
[ "Bind", "environment", "variables", "into", "this", "object", "s", "scope", "." ]
601a2c36d7d67efa8f917e7cbf0ab8dc66c7827f
https://github.com/wickman/pystachio/blob/601a2c36d7d67efa8f917e7cbf0ab8dc66c7827f/pystachio/base.py#L122-L129
train
60,092
wickman/pystachio
pystachio/base.py
Object.check
def check(self): """ Type check this object. """ try: si, uninterp = self.interpolate() # TODO(wickman) This should probably be pushed out to the interpolate leaves. except (Object.CoercionError, MustacheParser.Uninterpolatable) as e: return TypeCheck(False, "Unable to interpolate:...
python
def check(self): """ Type check this object. """ try: si, uninterp = self.interpolate() # TODO(wickman) This should probably be pushed out to the interpolate leaves. except (Object.CoercionError, MustacheParser.Uninterpolatable) as e: return TypeCheck(False, "Unable to interpolate:...
[ "def", "check", "(", "self", ")", ":", "try", ":", "si", ",", "uninterp", "=", "self", ".", "interpolate", "(", ")", "# TODO(wickman) This should probably be pushed out to the interpolate leaves.", "except", "(", "Object", ".", "CoercionError", ",", "MustacheParser", ...
Type check this object.
[ "Type", "check", "this", "object", "." ]
601a2c36d7d67efa8f917e7cbf0ab8dc66c7827f
https://github.com/wickman/pystachio/blob/601a2c36d7d67efa8f917e7cbf0ab8dc66c7827f/pystachio/base.py#L143-L152
train
60,093
jeffh/sniffer
sniffer/modules_restore_point.py
ModulesRestorePoint.restore
def restore(self): """ Unloads all modules that weren't loaded when save_modules was called. """ sys = set(self._sys_modules.keys()) for mod_name in sys.difference(self._saved_modules): del self._sys_modules[mod_name]
python
def restore(self): """ Unloads all modules that weren't loaded when save_modules was called. """ sys = set(self._sys_modules.keys()) for mod_name in sys.difference(self._saved_modules): del self._sys_modules[mod_name]
[ "def", "restore", "(", "self", ")", ":", "sys", "=", "set", "(", "self", ".", "_sys_modules", ".", "keys", "(", ")", ")", "for", "mod_name", "in", "sys", ".", "difference", "(", "self", ".", "_saved_modules", ")", ":", "del", "self", ".", "_sys_modul...
Unloads all modules that weren't loaded when save_modules was called.
[ "Unloads", "all", "modules", "that", "weren", "t", "loaded", "when", "save_modules", "was", "called", "." ]
8e4c3e77743aef08109ea0225b4a6536d4e60270
https://github.com/jeffh/sniffer/blob/8e4c3e77743aef08109ea0225b4a6536d4e60270/sniffer/modules_restore_point.py#L19-L25
train
60,094
wickman/pystachio
pystachio/parsing.py
MustacheParser.join
def join(cls, splits, *namables): """ Interpolate strings. :params splits: The output of Parser.split(string) :params namables: A sequence of Namable objects in which the interpolation should take place. Returns 2-tuple containing: joined string, list of unbound object ids (potenti...
python
def join(cls, splits, *namables): """ Interpolate strings. :params splits: The output of Parser.split(string) :params namables: A sequence of Namable objects in which the interpolation should take place. Returns 2-tuple containing: joined string, list of unbound object ids (potenti...
[ "def", "join", "(", "cls", ",", "splits", ",", "*", "namables", ")", ":", "isplits", "=", "[", "]", "unbound", "=", "[", "]", "for", "ref", "in", "splits", ":", "if", "isinstance", "(", "ref", ",", "Ref", ")", ":", "resolved", "=", "False", "for"...
Interpolate strings. :params splits: The output of Parser.split(string) :params namables: A sequence of Namable objects in which the interpolation should take place. Returns 2-tuple containing: joined string, list of unbound object ids (potentially empty)
[ "Interpolate", "strings", "." ]
601a2c36d7d67efa8f917e7cbf0ab8dc66c7827f
https://github.com/wickman/pystachio/blob/601a2c36d7d67efa8f917e7cbf0ab8dc66c7827f/pystachio/parsing.py#L45-L74
train
60,095
numirias/firefed
firefed/output.py
outitem
def outitem(title, elems, indent=4): """Output formatted as list item.""" out(title) max_key_len = max(len(key) for key, _ in elems) + 1 for key, val in elems: key_spaced = ('%s:' % key).ljust(max_key_len) out('%s%s %s' % (indent * ' ', key_spaced, val)) out()
python
def outitem(title, elems, indent=4): """Output formatted as list item.""" out(title) max_key_len = max(len(key) for key, _ in elems) + 1 for key, val in elems: key_spaced = ('%s:' % key).ljust(max_key_len) out('%s%s %s' % (indent * ' ', key_spaced, val)) out()
[ "def", "outitem", "(", "title", ",", "elems", ",", "indent", "=", "4", ")", ":", "out", "(", "title", ")", "max_key_len", "=", "max", "(", "len", "(", "key", ")", "for", "key", ",", "_", "in", "elems", ")", "+", "1", "for", "key", ",", "val", ...
Output formatted as list item.
[ "Output", "formatted", "as", "list", "item", "." ]
908114fe3a1506dcaafb23ce49e99f171e5e329d
https://github.com/numirias/firefed/blob/908114fe3a1506dcaafb23ce49e99f171e5e329d/firefed/output.py#L36-L43
train
60,096
numirias/firefed
firefed/util.py
profile_dir
def profile_dir(name): """Return path to FF profile for a given profile name or path.""" if name: possible_path = Path(name) if possible_path.exists(): return possible_path profiles = list(read_profiles()) try: if name: profile = next(p for p in profiles i...
python
def profile_dir(name): """Return path to FF profile for a given profile name or path.""" if name: possible_path = Path(name) if possible_path.exists(): return possible_path profiles = list(read_profiles()) try: if name: profile = next(p for p in profiles i...
[ "def", "profile_dir", "(", "name", ")", ":", "if", "name", ":", "possible_path", "=", "Path", "(", "name", ")", "if", "possible_path", ".", "exists", "(", ")", ":", "return", "possible_path", "profiles", "=", "list", "(", "read_profiles", "(", ")", ")", ...
Return path to FF profile for a given profile name or path.
[ "Return", "path", "to", "FF", "profile", "for", "a", "given", "profile", "name", "or", "path", "." ]
908114fe3a1506dcaafb23ce49e99f171e5e329d
https://github.com/numirias/firefed/blob/908114fe3a1506dcaafb23ce49e99f171e5e329d/firefed/util.py#L70-L84
train
60,097
numirias/firefed
firefed/feature/feature.py
formatter
def formatter(name, default=False): """Decorate a Feature method to register it as an output formatter. All formatters are picked up by the argument parser so that they can be listed and selected on the CLI via the -f, --format argument. """ def decorator(func): func._output_format = dict(n...
python
def formatter(name, default=False): """Decorate a Feature method to register it as an output formatter. All formatters are picked up by the argument parser so that they can be listed and selected on the CLI via the -f, --format argument. """ def decorator(func): func._output_format = dict(n...
[ "def", "formatter", "(", "name", ",", "default", "=", "False", ")", ":", "def", "decorator", "(", "func", ")", ":", "func", ".", "_output_format", "=", "dict", "(", "name", "=", "name", ",", "default", "=", "default", ")", "return", "func", "return", ...
Decorate a Feature method to register it as an output formatter. All formatters are picked up by the argument parser so that they can be listed and selected on the CLI via the -f, --format argument.
[ "Decorate", "a", "Feature", "method", "to", "register", "it", "as", "an", "output", "formatter", "." ]
908114fe3a1506dcaafb23ce49e99f171e5e329d
https://github.com/numirias/firefed/blob/908114fe3a1506dcaafb23ce49e99f171e5e329d/firefed/feature/feature.py#L53-L62
train
60,098
numirias/firefed
firefed/feature/feature.py
FeatureHelpersMixin.load_sqlite
def load_sqlite(self, db, query=None, table=None, cls=None, column_map=None): """Load data from sqlite db and return as list of specified objects.""" if column_map is None: column_map = {} db_path = self.profile_path(db, must_exist=True) def obj_factory(c...
python
def load_sqlite(self, db, query=None, table=None, cls=None, column_map=None): """Load data from sqlite db and return as list of specified objects.""" if column_map is None: column_map = {} db_path = self.profile_path(db, must_exist=True) def obj_factory(c...
[ "def", "load_sqlite", "(", "self", ",", "db", ",", "query", "=", "None", ",", "table", "=", "None", ",", "cls", "=", "None", ",", "column_map", "=", "None", ")", ":", "if", "column_map", "is", "None", ":", "column_map", "=", "{", "}", "db_path", "=...
Load data from sqlite db and return as list of specified objects.
[ "Load", "data", "from", "sqlite", "db", "and", "return", "as", "list", "of", "specified", "objects", "." ]
908114fe3a1506dcaafb23ce49e99f171e5e329d
https://github.com/numirias/firefed/blob/908114fe3a1506dcaafb23ce49e99f171e5e329d/firefed/feature/feature.py#L72-L100
train
60,099