id int32 0 252k | 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 list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
42,000 | SteveMcGrath/pySecurityCenter | securitycenter/sc4.py | SecurityCenter4.asset_create | def asset_create(self, name, items, tag='', description='', atype='static'):
'''asset_create_static name, ips, tags, description
Create a new asset list with the defined information.
UN-DOCUMENTED CALL: This function is not considered stable.
:param name: asset list name (must be uniqu... | python | def asset_create(self, name, items, tag='', description='', atype='static'):
'''asset_create_static name, ips, tags, description
Create a new asset list with the defined information.
UN-DOCUMENTED CALL: This function is not considered stable.
:param name: asset list name (must be uniqu... | [
"def",
"asset_create",
"(",
"self",
",",
"name",
",",
"items",
",",
"tag",
"=",
"''",
",",
"description",
"=",
"''",
",",
"atype",
"=",
"'static'",
")",
":",
"data",
"=",
"{",
"'name'",
":",
"name",
",",
"'description'",
":",
"description",
",",
"'ty... | asset_create_static name, ips, tags, description
Create a new asset list with the defined information.
UN-DOCUMENTED CALL: This function is not considered stable.
:param name: asset list name (must be unique)
:type name: string
:param items: list of IP Addresses, CIDR, and Netw... | [
"asset_create_static",
"name",
"ips",
"tags",
"description",
"Create",
"a",
"new",
"asset",
"list",
"with",
"the",
"defined",
"information",
"."
] | f0b10b1bcd4fd23a8d4d09ca6774cdf5e1cfd880 | https://github.com/SteveMcGrath/pySecurityCenter/blob/f0b10b1bcd4fd23a8d4d09ca6774cdf5e1cfd880/securitycenter/sc4.py#L837-L863 |
42,001 | SteveMcGrath/pySecurityCenter | securitycenter/sc4.py | SecurityCenter4.asset_create_combo | def asset_create_combo(self, name, combo, tag='', description=''):
'''asset_create_combo name, combination, tag, description
Creates a new combination asset list. Operands can be either asset list
IDs or be a nested combination asset list.
UN-DOCUMENTED CALL: This function is not consi... | python | def asset_create_combo(self, name, combo, tag='', description=''):
'''asset_create_combo name, combination, tag, description
Creates a new combination asset list. Operands can be either asset list
IDs or be a nested combination asset list.
UN-DOCUMENTED CALL: This function is not consi... | [
"def",
"asset_create_combo",
"(",
"self",
",",
"name",
",",
"combo",
",",
"tag",
"=",
"''",
",",
"description",
"=",
"''",
")",
":",
"return",
"self",
".",
"raw_query",
"(",
"'asset'",
",",
"'add'",
",",
"data",
"=",
"{",
"'name'",
":",
"name",
",",
... | asset_create_combo name, combination, tag, description
Creates a new combination asset list. Operands can be either asset list
IDs or be a nested combination asset list.
UN-DOCUMENTED CALL: This function is not considered stable.
AND = intersection
OR = union
operand =... | [
"asset_create_combo",
"name",
"combination",
"tag",
"description",
"Creates",
"a",
"new",
"combination",
"asset",
"list",
".",
"Operands",
"can",
"be",
"either",
"asset",
"list",
"IDs",
"or",
"be",
"a",
"nested",
"combination",
"asset",
"list",
"."
] | f0b10b1bcd4fd23a8d4d09ca6774cdf5e1cfd880 | https://github.com/SteveMcGrath/pySecurityCenter/blob/f0b10b1bcd4fd23a8d4d09ca6774cdf5e1cfd880/securitycenter/sc4.py#L866-L904 |
42,002 | SteveMcGrath/pySecurityCenter | securitycenter/sc4.py | SecurityCenter4.risk_rule | def risk_rule(self, rule_type, rule_value, port, proto, plugin_id,
repo_ids, comment='', expires='-1', severity=None):
'''accept_risk rule_type, rule_value, port, proto, plugin_id, comment
Creates an accept rick rule based on information provided.
UN-DOCUMENTED CALL: This func... | python | def risk_rule(self, rule_type, rule_value, port, proto, plugin_id,
repo_ids, comment='', expires='-1', severity=None):
'''accept_risk rule_type, rule_value, port, proto, plugin_id, comment
Creates an accept rick rule based on information provided.
UN-DOCUMENTED CALL: This func... | [
"def",
"risk_rule",
"(",
"self",
",",
"rule_type",
",",
"rule_value",
",",
"port",
",",
"proto",
",",
"plugin_id",
",",
"repo_ids",
",",
"comment",
"=",
"''",
",",
"expires",
"=",
"'-1'",
",",
"severity",
"=",
"None",
")",
":",
"data",
"=",
"{",
"'ho... | accept_risk rule_type, rule_value, port, proto, plugin_id, comment
Creates an accept rick rule based on information provided.
UN-DOCUMENTED CALL: This function is not considered stable.
:param rule_type: Valid options: ip, asset, all.
:type rule_type: string
:param rule_value: ... | [
"accept_risk",
"rule_type",
"rule_value",
"port",
"proto",
"plugin_id",
"comment",
"Creates",
"an",
"accept",
"rick",
"rule",
"based",
"on",
"information",
"provided",
"."
] | f0b10b1bcd4fd23a8d4d09ca6774cdf5e1cfd880 | https://github.com/SteveMcGrath/pySecurityCenter/blob/f0b10b1bcd4fd23a8d4d09ca6774cdf5e1cfd880/securitycenter/sc4.py#L907-L948 |
42,003 | SteveMcGrath/pySecurityCenter | securitycenter/sc4.py | SecurityCenter4.group_add | def group_add(self, name, restrict, repos, lces=[], assets=[], queries=[],
policies=[], dashboards=[], credentials=[], description=''):
'''group_add name, restrict, repos
'''
return self.raw_query('group', 'add', data={
'lces': [{'id': i} for i in lces],
... | python | def group_add(self, name, restrict, repos, lces=[], assets=[], queries=[],
policies=[], dashboards=[], credentials=[], description=''):
'''group_add name, restrict, repos
'''
return self.raw_query('group', 'add', data={
'lces': [{'id': i} for i in lces],
... | [
"def",
"group_add",
"(",
"self",
",",
"name",
",",
"restrict",
",",
"repos",
",",
"lces",
"=",
"[",
"]",
",",
"assets",
"=",
"[",
"]",
",",
"queries",
"=",
"[",
"]",
",",
"policies",
"=",
"[",
"]",
",",
"dashboards",
"=",
"[",
"]",
",",
"creden... | group_add name, restrict, repos | [
"group_add",
"name",
"restrict",
"repos"
] | f0b10b1bcd4fd23a8d4d09ca6774cdf5e1cfd880 | https://github.com/SteveMcGrath/pySecurityCenter/blob/f0b10b1bcd4fd23a8d4d09ca6774cdf5e1cfd880/securitycenter/sc4.py#L951-L968 |
42,004 | ozak/georasters | georasters/georasters.py | get_geo_info | def get_geo_info(filename, band=1):
''' Gets information from a Raster data set
'''
sourceds = gdal.Open(filename, GA_ReadOnly)
ndv = sourceds.GetRasterBand(band).GetNoDataValue()
xsize = sourceds.RasterXSize
ysize = sourceds.RasterYSize
geot = sourceds.GetGeoTransform()
projection = osr... | python | def get_geo_info(filename, band=1):
''' Gets information from a Raster data set
'''
sourceds = gdal.Open(filename, GA_ReadOnly)
ndv = sourceds.GetRasterBand(band).GetNoDataValue()
xsize = sourceds.RasterXSize
ysize = sourceds.RasterYSize
geot = sourceds.GetGeoTransform()
projection = osr... | [
"def",
"get_geo_info",
"(",
"filename",
",",
"band",
"=",
"1",
")",
":",
"sourceds",
"=",
"gdal",
".",
"Open",
"(",
"filename",
",",
"GA_ReadOnly",
")",
"ndv",
"=",
"sourceds",
".",
"GetRasterBand",
"(",
"band",
")",
".",
"GetNoDataValue",
"(",
")",
"x... | Gets information from a Raster data set | [
"Gets",
"information",
"from",
"a",
"Raster",
"data",
"set"
] | 0612bd91bb2a2cb2f1d59ba89c1ff131dae27d70 | https://github.com/ozak/georasters/blob/0612bd91bb2a2cb2f1d59ba89c1ff131dae27d70/georasters/georasters.py#L48-L60 |
42,005 | ozak/georasters | georasters/georasters.py | create_geotiff | def create_geotiff(name, Array, driver, ndv, xsize, ysize, geot, projection, datatype, band=1):
'''
Creates new geotiff from array
'''
if isinstance(datatype, np.int) == False:
if datatype.startswith('gdal.GDT_') == False:
datatype = eval('gdal.GDT_'+datatype)
newfilename = name+... | python | def create_geotiff(name, Array, driver, ndv, xsize, ysize, geot, projection, datatype, band=1):
'''
Creates new geotiff from array
'''
if isinstance(datatype, np.int) == False:
if datatype.startswith('gdal.GDT_') == False:
datatype = eval('gdal.GDT_'+datatype)
newfilename = name+... | [
"def",
"create_geotiff",
"(",
"name",
",",
"Array",
",",
"driver",
",",
"ndv",
",",
"xsize",
",",
"ysize",
",",
"geot",
",",
"projection",
",",
"datatype",
",",
"band",
"=",
"1",
")",
":",
"if",
"isinstance",
"(",
"datatype",
",",
"np",
".",
"int",
... | Creates new geotiff from array | [
"Creates",
"new",
"geotiff",
"from",
"array"
] | 0612bd91bb2a2cb2f1d59ba89c1ff131dae27d70 | https://github.com/ozak/georasters/blob/0612bd91bb2a2cb2f1d59ba89c1ff131dae27d70/georasters/georasters.py#L137-L155 |
42,006 | ozak/georasters | georasters/georasters.py | load_tiff | def load_tiff(file):
"""
Load a geotiff raster keeping ndv values using a masked array
Usage:
data = load_tiff(file)
"""
ndv, xsize, ysize, geot, projection, datatype = get_geo_info(file)
data = gdalnumeric.LoadFile(file)
data = np.ma.masked_array(data, mask=data == ndv, fill_va... | python | def load_tiff(file):
"""
Load a geotiff raster keeping ndv values using a masked array
Usage:
data = load_tiff(file)
"""
ndv, xsize, ysize, geot, projection, datatype = get_geo_info(file)
data = gdalnumeric.LoadFile(file)
data = np.ma.masked_array(data, mask=data == ndv, fill_va... | [
"def",
"load_tiff",
"(",
"file",
")",
":",
"ndv",
",",
"xsize",
",",
"ysize",
",",
"geot",
",",
"projection",
",",
"datatype",
"=",
"get_geo_info",
"(",
"file",
")",
"data",
"=",
"gdalnumeric",
".",
"LoadFile",
"(",
"file",
")",
"data",
"=",
"np",
".... | Load a geotiff raster keeping ndv values using a masked array
Usage:
data = load_tiff(file) | [
"Load",
"a",
"geotiff",
"raster",
"keeping",
"ndv",
"values",
"using",
"a",
"masked",
"array"
] | 0612bd91bb2a2cb2f1d59ba89c1ff131dae27d70 | https://github.com/ozak/georasters/blob/0612bd91bb2a2cb2f1d59ba89c1ff131dae27d70/georasters/georasters.py#L231-L241 |
42,007 | ozak/georasters | georasters/georasters.py | from_file | def from_file(filename, **kwargs):
"""
Create a GeoRaster object from a file
"""
ndv, xsize, ysize, geot, projection, datatype = get_geo_info(filename, **kwargs)
data = gdalnumeric.LoadFile(filename, **kwargs)
data = np.ma.masked_array(data, mask=data == ndv, fill_value=ndv)
return GeoRaster... | python | def from_file(filename, **kwargs):
"""
Create a GeoRaster object from a file
"""
ndv, xsize, ysize, geot, projection, datatype = get_geo_info(filename, **kwargs)
data = gdalnumeric.LoadFile(filename, **kwargs)
data = np.ma.masked_array(data, mask=data == ndv, fill_value=ndv)
return GeoRaster... | [
"def",
"from_file",
"(",
"filename",
",",
"*",
"*",
"kwargs",
")",
":",
"ndv",
",",
"xsize",
",",
"ysize",
",",
"geot",
",",
"projection",
",",
"datatype",
"=",
"get_geo_info",
"(",
"filename",
",",
"*",
"*",
"kwargs",
")",
"data",
"=",
"gdalnumeric",
... | Create a GeoRaster object from a file | [
"Create",
"a",
"GeoRaster",
"object",
"from",
"a",
"file"
] | 0612bd91bb2a2cb2f1d59ba89c1ff131dae27d70 | https://github.com/ozak/georasters/blob/0612bd91bb2a2cb2f1d59ba89c1ff131dae27d70/georasters/georasters.py#L1250-L1257 |
42,008 | ozak/georasters | georasters/georasters.py | GeoRaster.copy | def copy(self):
"""Returns copy of itself"""
return GeoRaster(self.raster.copy(), self.geot, nodata_value=self.nodata_value,
projection=self.projection, datatype=self.datatype) | python | def copy(self):
"""Returns copy of itself"""
return GeoRaster(self.raster.copy(), self.geot, nodata_value=self.nodata_value,
projection=self.projection, datatype=self.datatype) | [
"def",
"copy",
"(",
"self",
")",
":",
"return",
"GeoRaster",
"(",
"self",
".",
"raster",
".",
"copy",
"(",
")",
",",
"self",
".",
"geot",
",",
"nodata_value",
"=",
"self",
".",
"nodata_value",
",",
"projection",
"=",
"self",
".",
"projection",
",",
"... | Returns copy of itself | [
"Returns",
"copy",
"of",
"itself"
] | 0612bd91bb2a2cb2f1d59ba89c1ff131dae27d70 | https://github.com/ozak/georasters/blob/0612bd91bb2a2cb2f1d59ba89c1ff131dae27d70/georasters/georasters.py#L477-L480 |
42,009 | ozak/georasters | georasters/georasters.py | GeoRaster.clip | def clip(self, shp, keep=False, *args, **kwargs):
'''
Clip raster using shape, where shape is either a GeoPandas DataFrame, shapefile,
or some other geometry format used by python-raster-stats
Returns list of GeoRasters or Pandas DataFrame with GeoRasters and additional information
... | python | def clip(self, shp, keep=False, *args, **kwargs):
'''
Clip raster using shape, where shape is either a GeoPandas DataFrame, shapefile,
or some other geometry format used by python-raster-stats
Returns list of GeoRasters or Pandas DataFrame with GeoRasters and additional information
... | [
"def",
"clip",
"(",
"self",
",",
"shp",
",",
"keep",
"=",
"False",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"df",
"=",
"pd",
".",
"DataFrame",
"(",
"zonal_stats",
"(",
"shp",
",",
"self",
".",
"raster",
",",
"nodata",
"=",
"self",
"... | Clip raster using shape, where shape is either a GeoPandas DataFrame, shapefile,
or some other geometry format used by python-raster-stats
Returns list of GeoRasters or Pandas DataFrame with GeoRasters and additional information
Usage:
clipped = geo.clip(shape, keep=False)
wh... | [
"Clip",
"raster",
"using",
"shape",
"where",
"shape",
"is",
"either",
"a",
"GeoPandas",
"DataFrame",
"shapefile",
"or",
"some",
"other",
"geometry",
"format",
"used",
"by",
"python",
"-",
"raster",
"-",
"stats"
] | 0612bd91bb2a2cb2f1d59ba89c1ff131dae27d70 | https://github.com/ozak/georasters/blob/0612bd91bb2a2cb2f1d59ba89c1ff131dae27d70/georasters/georasters.py#L706-L742 |
42,010 | ozak/georasters | georasters/georasters.py | GeoRaster.pysal_Gamma | def pysal_Gamma(self, **kwargs):
"""
Compute Gamma Index of Spatial Autocorrelation for GeoRaster
Usage:
geo.pysal_Gamma(permutations = 1000, rook=True, operation='c')
arguments passed to raster_weights() and pysal.Gamma
See help(gr.raster_weights), help(pysal.Gamma) fo... | python | def pysal_Gamma(self, **kwargs):
"""
Compute Gamma Index of Spatial Autocorrelation for GeoRaster
Usage:
geo.pysal_Gamma(permutations = 1000, rook=True, operation='c')
arguments passed to raster_weights() and pysal.Gamma
See help(gr.raster_weights), help(pysal.Gamma) fo... | [
"def",
"pysal_Gamma",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"weights",
"is",
"None",
":",
"self",
".",
"raster_weights",
"(",
"*",
"*",
"kwargs",
")",
"rasterf",
"=",
"self",
".",
"raster",
".",
"flatten",
"(",
")",
"ra... | Compute Gamma Index of Spatial Autocorrelation for GeoRaster
Usage:
geo.pysal_Gamma(permutations = 1000, rook=True, operation='c')
arguments passed to raster_weights() and pysal.Gamma
See help(gr.raster_weights), help(pysal.Gamma) for options | [
"Compute",
"Gamma",
"Index",
"of",
"Spatial",
"Autocorrelation",
"for",
"GeoRaster"
] | 0612bd91bb2a2cb2f1d59ba89c1ff131dae27d70 | https://github.com/ozak/georasters/blob/0612bd91bb2a2cb2f1d59ba89c1ff131dae27d70/georasters/georasters.py#L973-L987 |
42,011 | ozak/georasters | georasters/georasters.py | GeoRaster.pysal_Join_Counts | def pysal_Join_Counts(self, **kwargs):
"""
Compute join count statistics for GeoRaster
Usage:
geo.pysal_Join_Counts(permutations = 1000, rook=True)
arguments passed to raster_weights() and pysal.Join_Counts
See help(gr.raster_weights), help(pysal.Join_Counts) for option... | python | def pysal_Join_Counts(self, **kwargs):
"""
Compute join count statistics for GeoRaster
Usage:
geo.pysal_Join_Counts(permutations = 1000, rook=True)
arguments passed to raster_weights() and pysal.Join_Counts
See help(gr.raster_weights), help(pysal.Join_Counts) for option... | [
"def",
"pysal_Join_Counts",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"weights",
"is",
"None",
":",
"self",
".",
"raster_weights",
"(",
"*",
"*",
"kwargs",
")",
"rasterf",
"=",
"self",
".",
"raster",
".",
"flatten",
"(",
")",... | Compute join count statistics for GeoRaster
Usage:
geo.pysal_Join_Counts(permutations = 1000, rook=True)
arguments passed to raster_weights() and pysal.Join_Counts
See help(gr.raster_weights), help(pysal.Join_Counts) for options | [
"Compute",
"join",
"count",
"statistics",
"for",
"GeoRaster"
] | 0612bd91bb2a2cb2f1d59ba89c1ff131dae27d70 | https://github.com/ozak/georasters/blob/0612bd91bb2a2cb2f1d59ba89c1ff131dae27d70/georasters/georasters.py#L990-L1004 |
42,012 | ozak/georasters | georasters/georasters.py | GeoRaster.pysal_Moran | def pysal_Moran(self, **kwargs):
"""
Compute Moran's I measure of global spatial autocorrelation for GeoRaster
Usage:
geo.pysal_Moran(permutations = 1000, rook=True)
arguments passed to raster_weights() and pysal.Moran
See help(gr.raster_weights), help(pysal.Moran) for ... | python | def pysal_Moran(self, **kwargs):
"""
Compute Moran's I measure of global spatial autocorrelation for GeoRaster
Usage:
geo.pysal_Moran(permutations = 1000, rook=True)
arguments passed to raster_weights() and pysal.Moran
See help(gr.raster_weights), help(pysal.Moran) for ... | [
"def",
"pysal_Moran",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"weights",
"is",
"None",
":",
"self",
".",
"raster_weights",
"(",
"*",
"*",
"kwargs",
")",
"rasterf",
"=",
"self",
".",
"raster",
".",
"flatten",
"(",
")",
"ra... | Compute Moran's I measure of global spatial autocorrelation for GeoRaster
Usage:
geo.pysal_Moran(permutations = 1000, rook=True)
arguments passed to raster_weights() and pysal.Moran
See help(gr.raster_weights), help(pysal.Moran) for options | [
"Compute",
"Moran",
"s",
"I",
"measure",
"of",
"global",
"spatial",
"autocorrelation",
"for",
"GeoRaster"
] | 0612bd91bb2a2cb2f1d59ba89c1ff131dae27d70 | https://github.com/ozak/georasters/blob/0612bd91bb2a2cb2f1d59ba89c1ff131dae27d70/georasters/georasters.py#L1007-L1021 |
42,013 | ozak/georasters | georasters/georasters.py | GeoRaster.pysal_Moran_Local | def pysal_Moran_Local(self, **kwargs):
"""
Compute Local Moran's I measure of local spatial autocorrelation for GeoRaster
Usage:
geo.pysal_Moran_Local(permutations = 1000, rook=True)
arguments passed to raster_weights() and pysal.Moran_Local
See help(gr.raster_weights),... | python | def pysal_Moran_Local(self, **kwargs):
"""
Compute Local Moran's I measure of local spatial autocorrelation for GeoRaster
Usage:
geo.pysal_Moran_Local(permutations = 1000, rook=True)
arguments passed to raster_weights() and pysal.Moran_Local
See help(gr.raster_weights),... | [
"def",
"pysal_Moran_Local",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"weights",
"is",
"None",
":",
"self",
".",
"raster_weights",
"(",
"*",
"*",
"kwargs",
")",
"rasterf",
"=",
"self",
".",
"raster",
".",
"flatten",
"(",
")",... | Compute Local Moran's I measure of local spatial autocorrelation for GeoRaster
Usage:
geo.pysal_Moran_Local(permutations = 1000, rook=True)
arguments passed to raster_weights() and pysal.Moran_Local
See help(gr.raster_weights), help(pysal.Moran_Local) for options | [
"Compute",
"Local",
"Moran",
"s",
"I",
"measure",
"of",
"local",
"spatial",
"autocorrelation",
"for",
"GeoRaster"
] | 0612bd91bb2a2cb2f1d59ba89c1ff131dae27d70 | https://github.com/ozak/georasters/blob/0612bd91bb2a2cb2f1d59ba89c1ff131dae27d70/georasters/georasters.py#L1041-L1060 |
42,014 | ozak/georasters | georasters/georasters.py | GeoRaster.mcp | def mcp(self, *args, **kwargs):
"""
Setup MCP_Geometric object from skimage for optimal travel time computations
"""
# Create Cost surface to work on
self.mcp_cost = graph.MCP_Geometric(self.raster, *args, **kwargs) | python | def mcp(self, *args, **kwargs):
"""
Setup MCP_Geometric object from skimage for optimal travel time computations
"""
# Create Cost surface to work on
self.mcp_cost = graph.MCP_Geometric(self.raster, *args, **kwargs) | [
"def",
"mcp",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# Create Cost surface to work on",
"self",
".",
"mcp_cost",
"=",
"graph",
".",
"MCP_Geometric",
"(",
"self",
".",
"raster",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
... | Setup MCP_Geometric object from skimage for optimal travel time computations | [
"Setup",
"MCP_Geometric",
"object",
"from",
"skimage",
"for",
"optimal",
"travel",
"time",
"computations"
] | 0612bd91bb2a2cb2f1d59ba89c1ff131dae27d70 | https://github.com/ozak/georasters/blob/0612bd91bb2a2cb2f1d59ba89c1ff131dae27d70/georasters/georasters.py#L1101-L1106 |
42,015 | palantir/python-jsonrpc-server | pyls_jsonrpc/endpoint.py | Endpoint.notify | def notify(self, method, params=None):
"""Send a JSON RPC notification to the client.
Args:
method (str): The method name of the notification to send
params (any): The payload of the notification
"""
log.debug('Sending notification: %s %s', method, params)
... | python | def notify(self, method, params=None):
"""Send a JSON RPC notification to the client.
Args:
method (str): The method name of the notification to send
params (any): The payload of the notification
"""
log.debug('Sending notification: %s %s', method, params)
... | [
"def",
"notify",
"(",
"self",
",",
"method",
",",
"params",
"=",
"None",
")",
":",
"log",
".",
"debug",
"(",
"'Sending notification: %s %s'",
",",
"method",
",",
"params",
")",
"message",
"=",
"{",
"'jsonrpc'",
":",
"JSONRPC_VERSION",
",",
"'method'",
":",... | Send a JSON RPC notification to the client.
Args:
method (str): The method name of the notification to send
params (any): The payload of the notification | [
"Send",
"a",
"JSON",
"RPC",
"notification",
"to",
"the",
"client",
"."
] | 7021d849901705ab53c141e483a71d0779aff3d2 | https://github.com/palantir/python-jsonrpc-server/blob/7021d849901705ab53c141e483a71d0779aff3d2/pyls_jsonrpc/endpoint.py#L39-L55 |
42,016 | palantir/python-jsonrpc-server | pyls_jsonrpc/endpoint.py | Endpoint.request | def request(self, method, params=None):
"""Send a JSON RPC request to the client.
Args:
method (str): The method name of the message to send
params (any): The payload of the message
Returns:
Future that will resolve once a response has been received
... | python | def request(self, method, params=None):
"""Send a JSON RPC request to the client.
Args:
method (str): The method name of the message to send
params (any): The payload of the message
Returns:
Future that will resolve once a response has been received
... | [
"def",
"request",
"(",
"self",
",",
"method",
",",
"params",
"=",
"None",
")",
":",
"msg_id",
"=",
"self",
".",
"_id_generator",
"(",
")",
"log",
".",
"debug",
"(",
"'Sending request with id %s: %s %s'",
",",
"msg_id",
",",
"method",
",",
"params",
")",
... | Send a JSON RPC request to the client.
Args:
method (str): The method name of the message to send
params (any): The payload of the message
Returns:
Future that will resolve once a response has been received | [
"Send",
"a",
"JSON",
"RPC",
"request",
"to",
"the",
"client",
"."
] | 7021d849901705ab53c141e483a71d0779aff3d2 | https://github.com/palantir/python-jsonrpc-server/blob/7021d849901705ab53c141e483a71d0779aff3d2/pyls_jsonrpc/endpoint.py#L57-L84 |
42,017 | palantir/python-jsonrpc-server | pyls_jsonrpc/endpoint.py | Endpoint._cancel_callback | def _cancel_callback(self, request_id):
"""Construct a cancellation callback for the given request ID."""
def callback(future):
if future.cancelled():
self.notify(CANCEL_METHOD, {'id': request_id})
future.set_exception(JsonRpcRequestCancelled())
return... | python | def _cancel_callback(self, request_id):
"""Construct a cancellation callback for the given request ID."""
def callback(future):
if future.cancelled():
self.notify(CANCEL_METHOD, {'id': request_id})
future.set_exception(JsonRpcRequestCancelled())
return... | [
"def",
"_cancel_callback",
"(",
"self",
",",
"request_id",
")",
":",
"def",
"callback",
"(",
"future",
")",
":",
"if",
"future",
".",
"cancelled",
"(",
")",
":",
"self",
".",
"notify",
"(",
"CANCEL_METHOD",
",",
"{",
"'id'",
":",
"request_id",
"}",
")"... | Construct a cancellation callback for the given request ID. | [
"Construct",
"a",
"cancellation",
"callback",
"for",
"the",
"given",
"request",
"ID",
"."
] | 7021d849901705ab53c141e483a71d0779aff3d2 | https://github.com/palantir/python-jsonrpc-server/blob/7021d849901705ab53c141e483a71d0779aff3d2/pyls_jsonrpc/endpoint.py#L86-L92 |
42,018 | palantir/python-jsonrpc-server | pyls_jsonrpc/endpoint.py | Endpoint.consume | def consume(self, message):
"""Consume a JSON RPC message from the client.
Args:
message (dict): The JSON RPC message sent by the client
"""
if 'jsonrpc' not in message or message['jsonrpc'] != JSONRPC_VERSION:
log.warn("Unknown message type %s", message)
... | python | def consume(self, message):
"""Consume a JSON RPC message from the client.
Args:
message (dict): The JSON RPC message sent by the client
"""
if 'jsonrpc' not in message or message['jsonrpc'] != JSONRPC_VERSION:
log.warn("Unknown message type %s", message)
... | [
"def",
"consume",
"(",
"self",
",",
"message",
")",
":",
"if",
"'jsonrpc'",
"not",
"in",
"message",
"or",
"message",
"[",
"'jsonrpc'",
"]",
"!=",
"JSONRPC_VERSION",
":",
"log",
".",
"warn",
"(",
"\"Unknown message type %s\"",
",",
"message",
")",
"return",
... | Consume a JSON RPC message from the client.
Args:
message (dict): The JSON RPC message sent by the client | [
"Consume",
"a",
"JSON",
"RPC",
"message",
"from",
"the",
"client",
"."
] | 7021d849901705ab53c141e483a71d0779aff3d2 | https://github.com/palantir/python-jsonrpc-server/blob/7021d849901705ab53c141e483a71d0779aff3d2/pyls_jsonrpc/endpoint.py#L94-L127 |
42,019 | palantir/python-jsonrpc-server | pyls_jsonrpc/endpoint.py | Endpoint._handle_notification | def _handle_notification(self, method, params):
"""Handle a notification from the client."""
if method == CANCEL_METHOD:
self._handle_cancel_notification(params['id'])
return
try:
handler = self._dispatcher[method]
except KeyError:
log.war... | python | def _handle_notification(self, method, params):
"""Handle a notification from the client."""
if method == CANCEL_METHOD:
self._handle_cancel_notification(params['id'])
return
try:
handler = self._dispatcher[method]
except KeyError:
log.war... | [
"def",
"_handle_notification",
"(",
"self",
",",
"method",
",",
"params",
")",
":",
"if",
"method",
"==",
"CANCEL_METHOD",
":",
"self",
".",
"_handle_cancel_notification",
"(",
"params",
"[",
"'id'",
"]",
")",
"return",
"try",
":",
"handler",
"=",
"self",
... | Handle a notification from the client. | [
"Handle",
"a",
"notification",
"from",
"the",
"client",
"."
] | 7021d849901705ab53c141e483a71d0779aff3d2 | https://github.com/palantir/python-jsonrpc-server/blob/7021d849901705ab53c141e483a71d0779aff3d2/pyls_jsonrpc/endpoint.py#L129-L150 |
42,020 | palantir/python-jsonrpc-server | pyls_jsonrpc/endpoint.py | Endpoint._notification_callback | def _notification_callback(method, params):
"""Construct a notification callback for the given request ID."""
def callback(future):
try:
future.result()
log.debug("Successfully handled async notification %s %s", method, params)
except Exception: #... | python | def _notification_callback(method, params):
"""Construct a notification callback for the given request ID."""
def callback(future):
try:
future.result()
log.debug("Successfully handled async notification %s %s", method, params)
except Exception: #... | [
"def",
"_notification_callback",
"(",
"method",
",",
"params",
")",
":",
"def",
"callback",
"(",
"future",
")",
":",
"try",
":",
"future",
".",
"result",
"(",
")",
"log",
".",
"debug",
"(",
"\"Successfully handled async notification %s %s\"",
",",
"method",
",... | Construct a notification callback for the given request ID. | [
"Construct",
"a",
"notification",
"callback",
"for",
"the",
"given",
"request",
"ID",
"."
] | 7021d849901705ab53c141e483a71d0779aff3d2 | https://github.com/palantir/python-jsonrpc-server/blob/7021d849901705ab53c141e483a71d0779aff3d2/pyls_jsonrpc/endpoint.py#L153-L161 |
42,021 | palantir/python-jsonrpc-server | pyls_jsonrpc/endpoint.py | Endpoint._handle_cancel_notification | def _handle_cancel_notification(self, msg_id):
"""Handle a cancel notification from the client."""
request_future = self._client_request_futures.pop(msg_id, None)
if not request_future:
log.warn("Received cancel notification for unknown message id %s", msg_id)
return
... | python | def _handle_cancel_notification(self, msg_id):
"""Handle a cancel notification from the client."""
request_future = self._client_request_futures.pop(msg_id, None)
if not request_future:
log.warn("Received cancel notification for unknown message id %s", msg_id)
return
... | [
"def",
"_handle_cancel_notification",
"(",
"self",
",",
"msg_id",
")",
":",
"request_future",
"=",
"self",
".",
"_client_request_futures",
".",
"pop",
"(",
"msg_id",
",",
"None",
")",
"if",
"not",
"request_future",
":",
"log",
".",
"warn",
"(",
"\"Received can... | Handle a cancel notification from the client. | [
"Handle",
"a",
"cancel",
"notification",
"from",
"the",
"client",
"."
] | 7021d849901705ab53c141e483a71d0779aff3d2 | https://github.com/palantir/python-jsonrpc-server/blob/7021d849901705ab53c141e483a71d0779aff3d2/pyls_jsonrpc/endpoint.py#L163-L173 |
42,022 | palantir/python-jsonrpc-server | pyls_jsonrpc/endpoint.py | Endpoint._handle_request | def _handle_request(self, msg_id, method, params):
"""Handle a request from the client."""
try:
handler = self._dispatcher[method]
except KeyError:
raise JsonRpcMethodNotFound.of(method)
handler_result = handler(params)
if callable(handler_result):
... | python | def _handle_request(self, msg_id, method, params):
"""Handle a request from the client."""
try:
handler = self._dispatcher[method]
except KeyError:
raise JsonRpcMethodNotFound.of(method)
handler_result = handler(params)
if callable(handler_result):
... | [
"def",
"_handle_request",
"(",
"self",
",",
"msg_id",
",",
"method",
",",
"params",
")",
":",
"try",
":",
"handler",
"=",
"self",
".",
"_dispatcher",
"[",
"method",
"]",
"except",
"KeyError",
":",
"raise",
"JsonRpcMethodNotFound",
".",
"of",
"(",
"method",... | Handle a request from the client. | [
"Handle",
"a",
"request",
"from",
"the",
"client",
"."
] | 7021d849901705ab53c141e483a71d0779aff3d2 | https://github.com/palantir/python-jsonrpc-server/blob/7021d849901705ab53c141e483a71d0779aff3d2/pyls_jsonrpc/endpoint.py#L175-L195 |
42,023 | palantir/python-jsonrpc-server | pyls_jsonrpc/endpoint.py | Endpoint._request_callback | def _request_callback(self, request_id):
"""Construct a request callback for the given request ID."""
def callback(future):
# Remove the future from the client requests map
self._client_request_futures.pop(request_id, None)
if future.cancelled():
futu... | python | def _request_callback(self, request_id):
"""Construct a request callback for the given request ID."""
def callback(future):
# Remove the future from the client requests map
self._client_request_futures.pop(request_id, None)
if future.cancelled():
futu... | [
"def",
"_request_callback",
"(",
"self",
",",
"request_id",
")",
":",
"def",
"callback",
"(",
"future",
")",
":",
"# Remove the future from the client requests map",
"self",
".",
"_client_request_futures",
".",
"pop",
"(",
"request_id",
",",
"None",
")",
"if",
"fu... | Construct a request callback for the given request ID. | [
"Construct",
"a",
"request",
"callback",
"for",
"the",
"given",
"request",
"ID",
"."
] | 7021d849901705ab53c141e483a71d0779aff3d2 | https://github.com/palantir/python-jsonrpc-server/blob/7021d849901705ab53c141e483a71d0779aff3d2/pyls_jsonrpc/endpoint.py#L197-L222 |
42,024 | palantir/python-jsonrpc-server | pyls_jsonrpc/endpoint.py | Endpoint._handle_response | def _handle_response(self, msg_id, result=None, error=None):
"""Handle a response from the client."""
request_future = self._server_request_futures.pop(msg_id, None)
if not request_future:
log.warn("Received response to unknown message id %s", msg_id)
return
if ... | python | def _handle_response(self, msg_id, result=None, error=None):
"""Handle a response from the client."""
request_future = self._server_request_futures.pop(msg_id, None)
if not request_future:
log.warn("Received response to unknown message id %s", msg_id)
return
if ... | [
"def",
"_handle_response",
"(",
"self",
",",
"msg_id",
",",
"result",
"=",
"None",
",",
"error",
"=",
"None",
")",
":",
"request_future",
"=",
"self",
".",
"_server_request_futures",
".",
"pop",
"(",
"msg_id",
",",
"None",
")",
"if",
"not",
"request_future... | Handle a response from the client. | [
"Handle",
"a",
"response",
"from",
"the",
"client",
"."
] | 7021d849901705ab53c141e483a71d0779aff3d2 | https://github.com/palantir/python-jsonrpc-server/blob/7021d849901705ab53c141e483a71d0779aff3d2/pyls_jsonrpc/endpoint.py#L224-L237 |
42,025 | palantir/python-jsonrpc-server | pyls_jsonrpc/streams.py | JsonRpcStreamReader.listen | def listen(self, message_consumer):
"""Blocking call to listen for messages on the rfile.
Args:
message_consumer (fn): function that is passed each message as it is read off the socket.
"""
while not self._rfile.closed:
request_str = self._read_message()
... | python | def listen(self, message_consumer):
"""Blocking call to listen for messages on the rfile.
Args:
message_consumer (fn): function that is passed each message as it is read off the socket.
"""
while not self._rfile.closed:
request_str = self._read_message()
... | [
"def",
"listen",
"(",
"self",
",",
"message_consumer",
")",
":",
"while",
"not",
"self",
".",
"_rfile",
".",
"closed",
":",
"request_str",
"=",
"self",
".",
"_read_message",
"(",
")",
"if",
"request_str",
"is",
"None",
":",
"break",
"try",
":",
"message_... | Blocking call to listen for messages on the rfile.
Args:
message_consumer (fn): function that is passed each message as it is read off the socket. | [
"Blocking",
"call",
"to",
"listen",
"for",
"messages",
"on",
"the",
"rfile",
"."
] | 7021d849901705ab53c141e483a71d0779aff3d2 | https://github.com/palantir/python-jsonrpc-server/blob/7021d849901705ab53c141e483a71d0779aff3d2/pyls_jsonrpc/streams.py#L17-L33 |
42,026 | palantir/python-jsonrpc-server | pyls_jsonrpc/streams.py | JsonRpcStreamReader._read_message | def _read_message(self):
"""Reads the contents of a message.
Returns:
body of message if parsable else None
"""
line = self._rfile.readline()
if not line:
return None
content_length = self._content_length(line)
# Blindly consume all hea... | python | def _read_message(self):
"""Reads the contents of a message.
Returns:
body of message if parsable else None
"""
line = self._rfile.readline()
if not line:
return None
content_length = self._content_length(line)
# Blindly consume all hea... | [
"def",
"_read_message",
"(",
"self",
")",
":",
"line",
"=",
"self",
".",
"_rfile",
".",
"readline",
"(",
")",
"if",
"not",
"line",
":",
"return",
"None",
"content_length",
"=",
"self",
".",
"_content_length",
"(",
"line",
")",
"# Blindly consume all header l... | Reads the contents of a message.
Returns:
body of message if parsable else None | [
"Reads",
"the",
"contents",
"of",
"a",
"message",
"."
] | 7021d849901705ab53c141e483a71d0779aff3d2 | https://github.com/palantir/python-jsonrpc-server/blob/7021d849901705ab53c141e483a71d0779aff3d2/pyls_jsonrpc/streams.py#L35-L56 |
42,027 | palantir/python-jsonrpc-server | pyls_jsonrpc/streams.py | JsonRpcStreamReader._content_length | def _content_length(line):
"""Extract the content length from an input line."""
if line.startswith(b'Content-Length: '):
_, value = line.split(b'Content-Length: ')
value = value.strip()
try:
return int(value)
except ValueError:
... | python | def _content_length(line):
"""Extract the content length from an input line."""
if line.startswith(b'Content-Length: '):
_, value = line.split(b'Content-Length: ')
value = value.strip()
try:
return int(value)
except ValueError:
... | [
"def",
"_content_length",
"(",
"line",
")",
":",
"if",
"line",
".",
"startswith",
"(",
"b'Content-Length: '",
")",
":",
"_",
",",
"value",
"=",
"line",
".",
"split",
"(",
"b'Content-Length: '",
")",
"value",
"=",
"value",
".",
"strip",
"(",
")",
"try",
... | Extract the content length from an input line. | [
"Extract",
"the",
"content",
"length",
"from",
"an",
"input",
"line",
"."
] | 7021d849901705ab53c141e483a71d0779aff3d2 | https://github.com/palantir/python-jsonrpc-server/blob/7021d849901705ab53c141e483a71d0779aff3d2/pyls_jsonrpc/streams.py#L59-L69 |
42,028 | bastibe/PySoundCard | pysoundcard.py | hostapi_info | def hostapi_info(index=None):
"""Return a generator with information about each host API.
If index is given, only one dictionary for the given host API is
returned.
"""
if index is None:
return (hostapi_info(i) for i in range(_pa.Pa_GetHostApiCount()))
else:
info = _pa.Pa_GetHo... | python | def hostapi_info(index=None):
"""Return a generator with information about each host API.
If index is given, only one dictionary for the given host API is
returned.
"""
if index is None:
return (hostapi_info(i) for i in range(_pa.Pa_GetHostApiCount()))
else:
info = _pa.Pa_GetHo... | [
"def",
"hostapi_info",
"(",
"index",
"=",
"None",
")",
":",
"if",
"index",
"is",
"None",
":",
"return",
"(",
"hostapi_info",
"(",
"i",
")",
"for",
"i",
"in",
"range",
"(",
"_pa",
".",
"Pa_GetHostApiCount",
"(",
")",
")",
")",
"else",
":",
"info",
"... | Return a generator with information about each host API.
If index is given, only one dictionary for the given host API is
returned. | [
"Return",
"a",
"generator",
"with",
"information",
"about",
"each",
"host",
"API",
"."
] | fb16460b75a1bb416089ebecdf700fa954faa5b7 | https://github.com/bastibe/PySoundCard/blob/fb16460b75a1bb416089ebecdf700fa954faa5b7/pysoundcard.py#L254-L270 |
42,029 | bastibe/PySoundCard | pysoundcard.py | device_info | def device_info(index=None):
"""Return a generator with information about each device.
If index is given, only one dictionary for the given device is
returned.
"""
if index is None:
return (device_info(i) for i in range(_pa.Pa_GetDeviceCount()))
else:
info = _pa.Pa_GetDeviceInf... | python | def device_info(index=None):
"""Return a generator with information about each device.
If index is given, only one dictionary for the given device is
returned.
"""
if index is None:
return (device_info(i) for i in range(_pa.Pa_GetDeviceCount()))
else:
info = _pa.Pa_GetDeviceInf... | [
"def",
"device_info",
"(",
"index",
"=",
"None",
")",
":",
"if",
"index",
"is",
"None",
":",
"return",
"(",
"device_info",
"(",
"i",
")",
"for",
"i",
"in",
"range",
"(",
"_pa",
".",
"Pa_GetDeviceCount",
"(",
")",
")",
")",
"else",
":",
"info",
"=",... | Return a generator with information about each device.
If index is given, only one dictionary for the given device is
returned. | [
"Return",
"a",
"generator",
"with",
"information",
"about",
"each",
"device",
"."
] | fb16460b75a1bb416089ebecdf700fa954faa5b7 | https://github.com/bastibe/PySoundCard/blob/fb16460b75a1bb416089ebecdf700fa954faa5b7/pysoundcard.py#L273-L302 |
42,030 | bastibe/PySoundCard | pysoundcard.py | _get_stream_parameters | def _get_stream_parameters(kind, device, channels, dtype, latency, samplerate):
"""Generate PaStreamParameters struct."""
if device is None:
if kind == 'input':
device = _pa.Pa_GetDefaultInputDevice()
elif kind == 'output':
device = _pa.Pa_GetDefaultOutputDevice()
in... | python | def _get_stream_parameters(kind, device, channels, dtype, latency, samplerate):
"""Generate PaStreamParameters struct."""
if device is None:
if kind == 'input':
device = _pa.Pa_GetDefaultInputDevice()
elif kind == 'output':
device = _pa.Pa_GetDefaultOutputDevice()
in... | [
"def",
"_get_stream_parameters",
"(",
"kind",
",",
"device",
",",
"channels",
",",
"dtype",
",",
"latency",
",",
"samplerate",
")",
":",
"if",
"device",
"is",
"None",
":",
"if",
"kind",
"==",
"'input'",
":",
"device",
"=",
"_pa",
".",
"Pa_GetDefaultInputDe... | Generate PaStreamParameters struct. | [
"Generate",
"PaStreamParameters",
"struct",
"."
] | fb16460b75a1bb416089ebecdf700fa954faa5b7 | https://github.com/bastibe/PySoundCard/blob/fb16460b75a1bb416089ebecdf700fa954faa5b7/pysoundcard.py#L710-L731 |
42,031 | bastibe/PySoundCard | pysoundcard.py | _frombuffer | def _frombuffer(ptr, frames, channels, dtype):
"""Create NumPy array from a pointer to some memory."""
framesize = channels * dtype.itemsize
data = np.frombuffer(ffi.buffer(ptr, frames * framesize), dtype=dtype)
data.shape = -1, channels
return data | python | def _frombuffer(ptr, frames, channels, dtype):
"""Create NumPy array from a pointer to some memory."""
framesize = channels * dtype.itemsize
data = np.frombuffer(ffi.buffer(ptr, frames * framesize), dtype=dtype)
data.shape = -1, channels
return data | [
"def",
"_frombuffer",
"(",
"ptr",
",",
"frames",
",",
"channels",
",",
"dtype",
")",
":",
"framesize",
"=",
"channels",
"*",
"dtype",
".",
"itemsize",
"data",
"=",
"np",
".",
"frombuffer",
"(",
"ffi",
".",
"buffer",
"(",
"ptr",
",",
"frames",
"*",
"f... | Create NumPy array from a pointer to some memory. | [
"Create",
"NumPy",
"array",
"from",
"a",
"pointer",
"to",
"some",
"memory",
"."
] | fb16460b75a1bb416089ebecdf700fa954faa5b7 | https://github.com/bastibe/PySoundCard/blob/fb16460b75a1bb416089ebecdf700fa954faa5b7/pysoundcard.py#L734-L739 |
42,032 | bastibe/PySoundCard | pysoundcard.py | _StreamBase.start | def start(self):
"""Commence audio processing.
If successful, the stream is considered active.
"""
err = _pa.Pa_StartStream(self._stream)
if err == _pa.paStreamIsNotStopped:
return
self._handle_error(err) | python | def start(self):
"""Commence audio processing.
If successful, the stream is considered active.
"""
err = _pa.Pa_StartStream(self._stream)
if err == _pa.paStreamIsNotStopped:
return
self._handle_error(err) | [
"def",
"start",
"(",
"self",
")",
":",
"err",
"=",
"_pa",
".",
"Pa_StartStream",
"(",
"self",
".",
"_stream",
")",
"if",
"err",
"==",
"_pa",
".",
"paStreamIsNotStopped",
":",
"return",
"self",
".",
"_handle_error",
"(",
"err",
")"
] | Commence audio processing.
If successful, the stream is considered active. | [
"Commence",
"audio",
"processing",
"."
] | fb16460b75a1bb416089ebecdf700fa954faa5b7 | https://github.com/bastibe/PySoundCard/blob/fb16460b75a1bb416089ebecdf700fa954faa5b7/pysoundcard.py#L416-L425 |
42,033 | bastibe/PySoundCard | pysoundcard.py | _StreamBase.stop | def stop(self):
"""Terminate audio processing.
This waits until all pending audio buffers have been played
before it returns. If successful, the stream is considered
inactive.
"""
err = _pa.Pa_StopStream(self._stream)
if err == _pa.paStreamIsStopped:
... | python | def stop(self):
"""Terminate audio processing.
This waits until all pending audio buffers have been played
before it returns. If successful, the stream is considered
inactive.
"""
err = _pa.Pa_StopStream(self._stream)
if err == _pa.paStreamIsStopped:
... | [
"def",
"stop",
"(",
"self",
")",
":",
"err",
"=",
"_pa",
".",
"Pa_StopStream",
"(",
"self",
".",
"_stream",
")",
"if",
"err",
"==",
"_pa",
".",
"paStreamIsStopped",
":",
"return",
"self",
".",
"_handle_error",
"(",
"err",
")"
] | Terminate audio processing.
This waits until all pending audio buffers have been played
before it returns. If successful, the stream is considered
inactive. | [
"Terminate",
"audio",
"processing",
"."
] | fb16460b75a1bb416089ebecdf700fa954faa5b7 | https://github.com/bastibe/PySoundCard/blob/fb16460b75a1bb416089ebecdf700fa954faa5b7/pysoundcard.py#L427-L438 |
42,034 | bastibe/PySoundCard | pysoundcard.py | _StreamBase.abort | def abort(self):
"""Terminate audio processing immediately.
This does not wait for pending audio buffers. If successful,
the stream is considered inactive.
"""
err = _pa.Pa_AbortStream(self._stream)
if err == _pa.paStreamIsStopped:
return
self._handl... | python | def abort(self):
"""Terminate audio processing immediately.
This does not wait for pending audio buffers. If successful,
the stream is considered inactive.
"""
err = _pa.Pa_AbortStream(self._stream)
if err == _pa.paStreamIsStopped:
return
self._handl... | [
"def",
"abort",
"(",
"self",
")",
":",
"err",
"=",
"_pa",
".",
"Pa_AbortStream",
"(",
"self",
".",
"_stream",
")",
"if",
"err",
"==",
"_pa",
".",
"paStreamIsStopped",
":",
"return",
"self",
".",
"_handle_error",
"(",
"err",
")"
] | Terminate audio processing immediately.
This does not wait for pending audio buffers. If successful,
the stream is considered inactive. | [
"Terminate",
"audio",
"processing",
"immediately",
"."
] | fb16460b75a1bb416089ebecdf700fa954faa5b7 | https://github.com/bastibe/PySoundCard/blob/fb16460b75a1bb416089ebecdf700fa954faa5b7/pysoundcard.py#L440-L450 |
42,035 | bastibe/PySoundCard | pysoundcard.py | InputStream.read | def read(self, frames, raw=False):
"""Read samples from an input stream.
The function does not return until the required number of
frames has been read. This may involve waiting for the
operating system to supply the data.
If raw data is requested, the raw cffi data buffer is
... | python | def read(self, frames, raw=False):
"""Read samples from an input stream.
The function does not return until the required number of
frames has been read. This may involve waiting for the
operating system to supply the data.
If raw data is requested, the raw cffi data buffer is
... | [
"def",
"read",
"(",
"self",
",",
"frames",
",",
"raw",
"=",
"False",
")",
":",
"channels",
",",
"_",
"=",
"_split",
"(",
"self",
".",
"channels",
")",
"dtype",
",",
"_",
"=",
"_split",
"(",
"self",
".",
"dtype",
")",
"data",
"=",
"ffi",
".",
"n... | Read samples from an input stream.
The function does not return until the required number of
frames has been read. This may involve waiting for the
operating system to supply the data.
If raw data is requested, the raw cffi data buffer is
returned. Otherwise, a numpy array of t... | [
"Read",
"samples",
"from",
"an",
"input",
"stream",
"."
] | fb16460b75a1bb416089ebecdf700fa954faa5b7 | https://github.com/bastibe/PySoundCard/blob/fb16460b75a1bb416089ebecdf700fa954faa5b7/pysoundcard.py#L534-L553 |
42,036 | bastibe/PySoundCard | pysoundcard.py | OutputStream.write | def write(self, data):
"""Write samples to an output stream.
As much as one blocksize of audio data will be played
without blocking. If more than one blocksize was provided,
the function will only return when all but one blocksize
has been played.
Data will be converted... | python | def write(self, data):
"""Write samples to an output stream.
As much as one blocksize of audio data will be played
without blocking. If more than one blocksize was provided,
the function will only return when all but one blocksize
has been played.
Data will be converted... | [
"def",
"write",
"(",
"self",
",",
"data",
")",
":",
"frames",
"=",
"len",
"(",
"data",
")",
"_",
",",
"channels",
"=",
"_split",
"(",
"self",
".",
"channels",
")",
"_",
",",
"dtype",
"=",
"_split",
"(",
"self",
".",
"dtype",
")",
"if",
"(",
"no... | Write samples to an output stream.
As much as one blocksize of audio data will be played
without blocking. If more than one blocksize was provided,
the function will only return when all but one blocksize
has been played.
Data will be converted to a numpy matrix. Multichannel d... | [
"Write",
"samples",
"to",
"an",
"output",
"stream",
"."
] | fb16460b75a1bb416089ebecdf700fa954faa5b7 | https://github.com/bastibe/PySoundCard/blob/fb16460b75a1bb416089ebecdf700fa954faa5b7/pysoundcard.py#L580-L617 |
42,037 | rfk/django-supervisor | djsupervisor/management/commands/supervisor.py | Command._handle_shell | def _handle_shell(self,cfg_file,*args,**options):
"""Command 'supervisord shell' runs the interactive command shell."""
args = ("--interactive",) + args
return supervisorctl.main(("-c",cfg_file) + args) | python | def _handle_shell(self,cfg_file,*args,**options):
"""Command 'supervisord shell' runs the interactive command shell."""
args = ("--interactive",) + args
return supervisorctl.main(("-c",cfg_file) + args) | [
"def",
"_handle_shell",
"(",
"self",
",",
"cfg_file",
",",
"*",
"args",
",",
"*",
"*",
"options",
")",
":",
"args",
"=",
"(",
"\"--interactive\"",
",",
")",
"+",
"args",
"return",
"supervisorctl",
".",
"main",
"(",
"(",
"\"-c\"",
",",
"cfg_file",
")",
... | Command 'supervisord shell' runs the interactive command shell. | [
"Command",
"supervisord",
"shell",
"runs",
"the",
"interactive",
"command",
"shell",
"."
] | 545a379d4a73ed2ae21c4aee6b8009ded8aeedc6 | https://github.com/rfk/django-supervisor/blob/545a379d4a73ed2ae21c4aee6b8009ded8aeedc6/djsupervisor/management/commands/supervisor.py#L210-L213 |
42,038 | rfk/django-supervisor | djsupervisor/management/commands/supervisor.py | Command._handle_getconfig | def _handle_getconfig(self,cfg_file,*args,**options):
"""Command 'supervisor getconfig' prints merged config to stdout."""
if args:
raise CommandError("supervisor getconfig takes no arguments")
print cfg_file.read()
return 0 | python | def _handle_getconfig(self,cfg_file,*args,**options):
"""Command 'supervisor getconfig' prints merged config to stdout."""
if args:
raise CommandError("supervisor getconfig takes no arguments")
print cfg_file.read()
return 0 | [
"def",
"_handle_getconfig",
"(",
"self",
",",
"cfg_file",
",",
"*",
"args",
",",
"*",
"*",
"options",
")",
":",
"if",
"args",
":",
"raise",
"CommandError",
"(",
"\"supervisor getconfig takes no arguments\"",
")",
"print",
"cfg_file",
".",
"read",
"(",
")",
"... | Command 'supervisor getconfig' prints merged config to stdout. | [
"Command",
"supervisor",
"getconfig",
"prints",
"merged",
"config",
"to",
"stdout",
"."
] | 545a379d4a73ed2ae21c4aee6b8009ded8aeedc6 | https://github.com/rfk/django-supervisor/blob/545a379d4a73ed2ae21c4aee6b8009ded8aeedc6/djsupervisor/management/commands/supervisor.py#L215-L220 |
42,039 | rfk/django-supervisor | djsupervisor/management/commands/supervisor.py | Command._handle_autoreload | def _handle_autoreload(self,cfg_file,*args,**options):
"""Command 'supervisor autoreload' watches for code changes.
This command provides a simulation of the Django dev server's
auto-reloading mechanism that will restart all supervised processes.
It's not quite as accurate as Django's ... | python | def _handle_autoreload(self,cfg_file,*args,**options):
"""Command 'supervisor autoreload' watches for code changes.
This command provides a simulation of the Django dev server's
auto-reloading mechanism that will restart all supervised processes.
It's not quite as accurate as Django's ... | [
"def",
"_handle_autoreload",
"(",
"self",
",",
"cfg_file",
",",
"*",
"args",
",",
"*",
"*",
"options",
")",
":",
"if",
"args",
":",
"raise",
"CommandError",
"(",
"\"supervisor autoreload takes no arguments\"",
")",
"live_dirs",
"=",
"self",
".",
"_find_live_code... | Command 'supervisor autoreload' watches for code changes.
This command provides a simulation of the Django dev server's
auto-reloading mechanism that will restart all supervised processes.
It's not quite as accurate as Django's autoreloader because it runs
in a separate process, so it ... | [
"Command",
"supervisor",
"autoreload",
"watches",
"for",
"code",
"changes",
"."
] | 545a379d4a73ed2ae21c4aee6b8009ded8aeedc6 | https://github.com/rfk/django-supervisor/blob/545a379d4a73ed2ae21c4aee6b8009ded8aeedc6/djsupervisor/management/commands/supervisor.py#L222-L289 |
42,040 | rfk/django-supervisor | djsupervisor/management/commands/supervisor.py | Command._get_autoreload_programs | def _get_autoreload_programs(self,cfg_file):
"""Get the set of programs to auto-reload when code changes.
Such programs will have autoreload=true in their config section.
This can be affected by config file sections or command-line
arguments, so we need to read it out of the merged conf... | python | def _get_autoreload_programs(self,cfg_file):
"""Get the set of programs to auto-reload when code changes.
Such programs will have autoreload=true in their config section.
This can be affected by config file sections or command-line
arguments, so we need to read it out of the merged conf... | [
"def",
"_get_autoreload_programs",
"(",
"self",
",",
"cfg_file",
")",
":",
"cfg",
"=",
"RawConfigParser",
"(",
")",
"cfg",
".",
"readfp",
"(",
"cfg_file",
")",
"reload_progs",
"=",
"[",
"]",
"for",
"section",
"in",
"cfg",
".",
"sections",
"(",
")",
":",
... | Get the set of programs to auto-reload when code changes.
Such programs will have autoreload=true in their config section.
This can be affected by config file sections or command-line
arguments, so we need to read it out of the merged config. | [
"Get",
"the",
"set",
"of",
"programs",
"to",
"auto",
"-",
"reload",
"when",
"code",
"changes",
"."
] | 545a379d4a73ed2ae21c4aee6b8009ded8aeedc6 | https://github.com/rfk/django-supervisor/blob/545a379d4a73ed2ae21c4aee6b8009ded8aeedc6/djsupervisor/management/commands/supervisor.py#L291-L308 |
42,041 | rfk/django-supervisor | djsupervisor/management/commands/supervisor.py | Command._find_live_code_dirs | def _find_live_code_dirs(self):
"""Find all directories in which we might have live python code.
This walks all of the currently-imported modules and adds their
containing directory to the list of live dirs. After normalization
and de-duplication, we get a pretty good approximation of ... | python | def _find_live_code_dirs(self):
"""Find all directories in which we might have live python code.
This walks all of the currently-imported modules and adds their
containing directory to the list of live dirs. After normalization
and de-duplication, we get a pretty good approximation of ... | [
"def",
"_find_live_code_dirs",
"(",
"self",
")",
":",
"live_dirs",
"=",
"[",
"]",
"for",
"mod",
"in",
"sys",
".",
"modules",
".",
"values",
"(",
")",
":",
"# Get the directory containing that module.",
"# This is deliberately casting a wide net.",
"try",
":",
"dir... | Find all directories in which we might have live python code.
This walks all of the currently-imported modules and adds their
containing directory to the list of live dirs. After normalization
and de-duplication, we get a pretty good approximation of the
directories on sys.path that ar... | [
"Find",
"all",
"directories",
"in",
"which",
"we",
"might",
"have",
"live",
"python",
"code",
"."
] | 545a379d4a73ed2ae21c4aee6b8009ded8aeedc6 | https://github.com/rfk/django-supervisor/blob/545a379d4a73ed2ae21c4aee6b8009ded8aeedc6/djsupervisor/management/commands/supervisor.py#L310-L342 |
42,042 | rfk/django-supervisor | djsupervisor/config.py | render_config | def render_config(data,ctx):
"""Render the given config data using Django's template system.
This function takes a config data string and a dict of context variables,
renders the data through Django's template system, and returns the result.
"""
djsupervisor_tags.current_context = ctx
data = "{... | python | def render_config(data,ctx):
"""Render the given config data using Django's template system.
This function takes a config data string and a dict of context variables,
renders the data through Django's template system, and returns the result.
"""
djsupervisor_tags.current_context = ctx
data = "{... | [
"def",
"render_config",
"(",
"data",
",",
"ctx",
")",
":",
"djsupervisor_tags",
".",
"current_context",
"=",
"ctx",
"data",
"=",
"\"{% load djsupervisor_tags %}\"",
"+",
"data",
"t",
"=",
"template",
".",
"Template",
"(",
"data",
")",
"c",
"=",
"template",
"... | Render the given config data using Django's template system.
This function takes a config data string and a dict of context variables,
renders the data through Django's template system, and returns the result. | [
"Render",
"the",
"given",
"config",
"data",
"using",
"Django",
"s",
"template",
"system",
"."
] | 545a379d4a73ed2ae21c4aee6b8009ded8aeedc6 | https://github.com/rfk/django-supervisor/blob/545a379d4a73ed2ae21c4aee6b8009ded8aeedc6/djsupervisor/config.py#L141-L151 |
42,043 | rfk/django-supervisor | djsupervisor/config.py | get_config_from_options | def get_config_from_options(**options):
"""Get config file fragment reflecting command-line options."""
data = []
# Set whether or not to daemonize.
# Unlike supervisord, our default is to stay in the foreground.
data.append("[supervisord]\n")
if options.get("daemonize",False):
data.ap... | python | def get_config_from_options(**options):
"""Get config file fragment reflecting command-line options."""
data = []
# Set whether or not to daemonize.
# Unlike supervisord, our default is to stay in the foreground.
data.append("[supervisord]\n")
if options.get("daemonize",False):
data.ap... | [
"def",
"get_config_from_options",
"(",
"*",
"*",
"options",
")",
":",
"data",
"=",
"[",
"]",
"# Set whether or not to daemonize.",
"# Unlike supervisord, our default is to stay in the foreground.",
"data",
".",
"append",
"(",
"\"[supervisord]\\n\"",
")",
"if",
"options",
... | Get config file fragment reflecting command-line options. | [
"Get",
"config",
"file",
"fragment",
"reflecting",
"command",
"-",
"line",
"options",
"."
] | 545a379d4a73ed2ae21c4aee6b8009ded8aeedc6 | https://github.com/rfk/django-supervisor/blob/545a379d4a73ed2ae21c4aee6b8009ded8aeedc6/djsupervisor/config.py#L154-L189 |
42,044 | rfk/django-supervisor | djsupervisor/config.py | guess_project_dir | def guess_project_dir():
"""Find the top-level Django project directory.
This function guesses the top-level Django project directory based on
the current environment. It looks for module containing the currently-
active settings module, in both pre-1.4 and post-1.4 layours.
"""
projname = set... | python | def guess_project_dir():
"""Find the top-level Django project directory.
This function guesses the top-level Django project directory based on
the current environment. It looks for module containing the currently-
active settings module, in both pre-1.4 and post-1.4 layours.
"""
projname = set... | [
"def",
"guess_project_dir",
"(",
")",
":",
"projname",
"=",
"settings",
".",
"SETTINGS_MODULE",
".",
"split",
"(",
"\".\"",
",",
"1",
")",
"[",
"0",
"]",
"projmod",
"=",
"import_module",
"(",
"projname",
")",
"projdir",
"=",
"os",
".",
"path",
".",
"di... | Find the top-level Django project directory.
This function guesses the top-level Django project directory based on
the current environment. It looks for module containing the currently-
active settings module, in both pre-1.4 and post-1.4 layours. | [
"Find",
"the",
"top",
"-",
"level",
"Django",
"project",
"directory",
"."
] | 545a379d4a73ed2ae21c4aee6b8009ded8aeedc6 | https://github.com/rfk/django-supervisor/blob/545a379d4a73ed2ae21c4aee6b8009ded8aeedc6/djsupervisor/config.py#L192-L216 |
42,045 | rfk/django-supervisor | djsupervisor/config.py | set_if_missing | def set_if_missing(cfg,section,option,value):
"""If the given option is missing, set to the given value."""
try:
cfg.get(section,option)
except NoSectionError:
cfg.add_section(section)
cfg.set(section,option,value)
except NoOptionError:
cfg.set(section,option,value) | python | def set_if_missing(cfg,section,option,value):
"""If the given option is missing, set to the given value."""
try:
cfg.get(section,option)
except NoSectionError:
cfg.add_section(section)
cfg.set(section,option,value)
except NoOptionError:
cfg.set(section,option,value) | [
"def",
"set_if_missing",
"(",
"cfg",
",",
"section",
",",
"option",
",",
"value",
")",
":",
"try",
":",
"cfg",
".",
"get",
"(",
"section",
",",
"option",
")",
"except",
"NoSectionError",
":",
"cfg",
".",
"add_section",
"(",
"section",
")",
"cfg",
".",
... | If the given option is missing, set to the given value. | [
"If",
"the",
"given",
"option",
"is",
"missing",
"set",
"to",
"the",
"given",
"value",
"."
] | 545a379d4a73ed2ae21c4aee6b8009ded8aeedc6 | https://github.com/rfk/django-supervisor/blob/545a379d4a73ed2ae21c4aee6b8009ded8aeedc6/djsupervisor/config.py#L219-L227 |
42,046 | rfk/django-supervisor | djsupervisor/config.py | rerender_options | def rerender_options(options):
"""Helper function to re-render command-line options.
This assumes that command-line options use the same name as their
key in the options dictionary.
"""
args = []
for name,value in options.iteritems():
name = name.replace("_","-")
if value is Non... | python | def rerender_options(options):
"""Helper function to re-render command-line options.
This assumes that command-line options use the same name as their
key in the options dictionary.
"""
args = []
for name,value in options.iteritems():
name = name.replace("_","-")
if value is Non... | [
"def",
"rerender_options",
"(",
"options",
")",
":",
"args",
"=",
"[",
"]",
"for",
"name",
",",
"value",
"in",
"options",
".",
"iteritems",
"(",
")",
":",
"name",
"=",
"name",
".",
"replace",
"(",
"\"_\"",
",",
"\"-\"",
")",
"if",
"value",
"is",
"N... | Helper function to re-render command-line options.
This assumes that command-line options use the same name as their
key in the options dictionary. | [
"Helper",
"function",
"to",
"re",
"-",
"render",
"command",
"-",
"line",
"options",
"."
] | 545a379d4a73ed2ae21c4aee6b8009ded8aeedc6 | https://github.com/rfk/django-supervisor/blob/545a379d4a73ed2ae21c4aee6b8009ded8aeedc6/djsupervisor/config.py#L230-L249 |
42,047 | pyapi-gitlab/pyapi-gitlab | gitlab/session.py | Session.login | def login(self, email=None, password=None, user=None):
"""
Logs the user in and setups the header with the private token
:param email: Gitlab user Email
:param user: Gitlab username
:param password: Gitlab user password
:return: True if login successful
:raise: H... | python | def login(self, email=None, password=None, user=None):
"""
Logs the user in and setups the header with the private token
:param email: Gitlab user Email
:param user: Gitlab username
:param password: Gitlab user password
:return: True if login successful
:raise: H... | [
"def",
"login",
"(",
"self",
",",
"email",
"=",
"None",
",",
"password",
"=",
"None",
",",
"user",
"=",
"None",
")",
":",
"if",
"user",
"is",
"not",
"None",
":",
"data",
"=",
"{",
"'login'",
":",
"user",
",",
"'password'",
":",
"password",
"}",
"... | Logs the user in and setups the header with the private token
:param email: Gitlab user Email
:param user: Gitlab username
:param password: Gitlab user password
:return: True if login successful
:raise: HttpError
:raise: ValueError | [
"Logs",
"the",
"user",
"in",
"and",
"setups",
"the",
"header",
"with",
"the",
"private",
"token"
] | f74b6fb5c13cecae9524997847e928905cc60acf | https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/session.py#L5-L29 |
42,048 | pyapi-gitlab/pyapi-gitlab | gitlab/users.py | Users.getuser | def getuser(self, user_id):
"""
Get info for a user identified by id
:param user_id: id of the user
:return: False if not found, a dictionary if found
"""
request = requests.get(
'{0}/{1}'.format(self.users_url, user_id),
headers=self.headers, ver... | python | def getuser(self, user_id):
"""
Get info for a user identified by id
:param user_id: id of the user
:return: False if not found, a dictionary if found
"""
request = requests.get(
'{0}/{1}'.format(self.users_url, user_id),
headers=self.headers, ver... | [
"def",
"getuser",
"(",
"self",
",",
"user_id",
")",
":",
"request",
"=",
"requests",
".",
"get",
"(",
"'{0}/{1}'",
".",
"format",
"(",
"self",
".",
"users_url",
",",
"user_id",
")",
",",
"headers",
"=",
"self",
".",
"headers",
",",
"verify",
"=",
"se... | Get info for a user identified by id
:param user_id: id of the user
:return: False if not found, a dictionary if found | [
"Get",
"info",
"for",
"a",
"user",
"identified",
"by",
"id"
] | f74b6fb5c13cecae9524997847e928905cc60acf | https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/users.py#L38-L52 |
42,049 | pyapi-gitlab/pyapi-gitlab | gitlab/users.py | Users.deleteuser | def deleteuser(self, user_id):
"""
Deletes a user. Available only for administrators.
This is an idempotent function, calling this function for a non-existent user id
still returns a status code 200 OK.
The JSON response differs if the user was actually deleted or not.
In... | python | def deleteuser(self, user_id):
"""
Deletes a user. Available only for administrators.
This is an idempotent function, calling this function for a non-existent user id
still returns a status code 200 OK.
The JSON response differs if the user was actually deleted or not.
In... | [
"def",
"deleteuser",
"(",
"self",
",",
"user_id",
")",
":",
"deleted",
"=",
"self",
".",
"delete_user",
"(",
"user_id",
")",
"if",
"deleted",
"is",
"False",
":",
"return",
"False",
"else",
":",
"return",
"True"
] | Deletes a user. Available only for administrators.
This is an idempotent function, calling this function for a non-existent user id
still returns a status code 200 OK.
The JSON response differs if the user was actually deleted or not.
In the former the user is returned and in the latter ... | [
"Deletes",
"a",
"user",
".",
"Available",
"only",
"for",
"administrators",
".",
"This",
"is",
"an",
"idempotent",
"function",
"calling",
"this",
"function",
"for",
"a",
"non",
"-",
"existent",
"user",
"id",
"still",
"returns",
"a",
"status",
"code",
"200",
... | f74b6fb5c13cecae9524997847e928905cc60acf | https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/users.py#L94-L112 |
42,050 | pyapi-gitlab/pyapi-gitlab | gitlab/users.py | Users.currentuser | def currentuser(self):
"""
Returns the current user parameters. The current user is linked to the secret token
:return: a list with the current user properties
"""
request = requests.get(
'{0}/api/v3/user'.format(self.host),
headers=self.headers, verify=s... | python | def currentuser(self):
"""
Returns the current user parameters. The current user is linked to the secret token
:return: a list with the current user properties
"""
request = requests.get(
'{0}/api/v3/user'.format(self.host),
headers=self.headers, verify=s... | [
"def",
"currentuser",
"(",
"self",
")",
":",
"request",
"=",
"requests",
".",
"get",
"(",
"'{0}/api/v3/user'",
".",
"format",
"(",
"self",
".",
"host",
")",
",",
"headers",
"=",
"self",
".",
"headers",
",",
"verify",
"=",
"self",
".",
"verify_ssl",
","... | Returns the current user parameters. The current user is linked to the secret token
:return: a list with the current user properties | [
"Returns",
"the",
"current",
"user",
"parameters",
".",
"The",
"current",
"user",
"is",
"linked",
"to",
"the",
"secret",
"token"
] | f74b6fb5c13cecae9524997847e928905cc60acf | https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/users.py#L114-L124 |
42,051 | pyapi-gitlab/pyapi-gitlab | gitlab/users.py | Users.edituser | def edituser(self, user_id, **kwargs):
"""
Edits an user data.
:param user_id: id of the user to change
:param kwargs: Any param the the Gitlab API supports
:return: Dict of the user
"""
data = {}
if kwargs:
data.update(kwargs)
reque... | python | def edituser(self, user_id, **kwargs):
"""
Edits an user data.
:param user_id: id of the user to change
:param kwargs: Any param the the Gitlab API supports
:return: Dict of the user
"""
data = {}
if kwargs:
data.update(kwargs)
reque... | [
"def",
"edituser",
"(",
"self",
",",
"user_id",
",",
"*",
"*",
"kwargs",
")",
":",
"data",
"=",
"{",
"}",
"if",
"kwargs",
":",
"data",
".",
"update",
"(",
"kwargs",
")",
"request",
"=",
"requests",
".",
"put",
"(",
"'{0}/{1}'",
".",
"format",
"(",
... | Edits an user data.
:param user_id: id of the user to change
:param kwargs: Any param the the Gitlab API supports
:return: Dict of the user | [
"Edits",
"an",
"user",
"data",
"."
] | f74b6fb5c13cecae9524997847e928905cc60acf | https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/users.py#L126-L146 |
42,052 | pyapi-gitlab/pyapi-gitlab | gitlab/users.py | Users.getsshkeys | def getsshkeys(self):
"""
Gets all the ssh keys for the current user
:return: a dictionary with the lists
"""
request = requests.get(
self.keys_url, headers=self.headers, verify=self.verify_ssl, auth=self.auth, timeout=self.timeout)
if request.status_code ==... | python | def getsshkeys(self):
"""
Gets all the ssh keys for the current user
:return: a dictionary with the lists
"""
request = requests.get(
self.keys_url, headers=self.headers, verify=self.verify_ssl, auth=self.auth, timeout=self.timeout)
if request.status_code ==... | [
"def",
"getsshkeys",
"(",
"self",
")",
":",
"request",
"=",
"requests",
".",
"get",
"(",
"self",
".",
"keys_url",
",",
"headers",
"=",
"self",
".",
"headers",
",",
"verify",
"=",
"self",
".",
"verify_ssl",
",",
"auth",
"=",
"self",
".",
"auth",
",",
... | Gets all the ssh keys for the current user
:return: a dictionary with the lists | [
"Gets",
"all",
"the",
"ssh",
"keys",
"for",
"the",
"current",
"user"
] | f74b6fb5c13cecae9524997847e928905cc60acf | https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/users.py#L170-L182 |
42,053 | pyapi-gitlab/pyapi-gitlab | gitlab/users.py | Users.addsshkey | def addsshkey(self, title, key):
"""
Add a new ssh key for the current user
:param title: title of the new key
:param key: the key itself
:return: true if added, false if it didn't add it (it could be because the name or key already exists)
"""
data = {'title': t... | python | def addsshkey(self, title, key):
"""
Add a new ssh key for the current user
:param title: title of the new key
:param key: the key itself
:return: true if added, false if it didn't add it (it could be because the name or key already exists)
"""
data = {'title': t... | [
"def",
"addsshkey",
"(",
"self",
",",
"title",
",",
"key",
")",
":",
"data",
"=",
"{",
"'title'",
":",
"title",
",",
"'key'",
":",
"key",
"}",
"request",
"=",
"requests",
".",
"post",
"(",
"self",
".",
"keys_url",
",",
"headers",
"=",
"self",
".",
... | Add a new ssh key for the current user
:param title: title of the new key
:param key: the key itself
:return: true if added, false if it didn't add it (it could be because the name or key already exists) | [
"Add",
"a",
"new",
"ssh",
"key",
"for",
"the",
"current",
"user"
] | f74b6fb5c13cecae9524997847e928905cc60acf | https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/users.py#L184-L201 |
42,054 | pyapi-gitlab/pyapi-gitlab | gitlab/users.py | Users.addsshkeyuser | def addsshkeyuser(self, user_id, title, key):
"""
Add a new ssh key for the user identified by id
:param user_id: id of the user to add the key to
:param title: title of the new key
:param key: the key itself
:return: true if added, false if it didn't add it (it could be... | python | def addsshkeyuser(self, user_id, title, key):
"""
Add a new ssh key for the user identified by id
:param user_id: id of the user to add the key to
:param title: title of the new key
:param key: the key itself
:return: true if added, false if it didn't add it (it could be... | [
"def",
"addsshkeyuser",
"(",
"self",
",",
"user_id",
",",
"title",
",",
"key",
")",
":",
"data",
"=",
"{",
"'title'",
":",
"title",
",",
"'key'",
":",
"key",
"}",
"request",
"=",
"requests",
".",
"post",
"(",
"'{0}/{1}/keys'",
".",
"format",
"(",
"se... | Add a new ssh key for the user identified by id
:param user_id: id of the user to add the key to
:param title: title of the new key
:param key: the key itself
:return: true if added, false if it didn't add it (it could be because the name or key already exists) | [
"Add",
"a",
"new",
"ssh",
"key",
"for",
"the",
"user",
"identified",
"by",
"id"
] | f74b6fb5c13cecae9524997847e928905cc60acf | https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/users.py#L203-L221 |
42,055 | pyapi-gitlab/pyapi-gitlab | gitlab/users.py | Users.deletesshkey | def deletesshkey(self, key_id):
"""
Deletes an sshkey for the current user identified by id
:param key_id: the id of the key
:return: False if it didn't delete it, True if it was deleted
"""
request = requests.delete(
'{0}/{1}'.format(self.keys_url, key_id), ... | python | def deletesshkey(self, key_id):
"""
Deletes an sshkey for the current user identified by id
:param key_id: the id of the key
:return: False if it didn't delete it, True if it was deleted
"""
request = requests.delete(
'{0}/{1}'.format(self.keys_url, key_id), ... | [
"def",
"deletesshkey",
"(",
"self",
",",
"key_id",
")",
":",
"request",
"=",
"requests",
".",
"delete",
"(",
"'{0}/{1}'",
".",
"format",
"(",
"self",
".",
"keys_url",
",",
"key_id",
")",
",",
"headers",
"=",
"self",
".",
"headers",
",",
"verify",
"=",
... | Deletes an sshkey for the current user identified by id
:param key_id: the id of the key
:return: False if it didn't delete it, True if it was deleted | [
"Deletes",
"an",
"sshkey",
"for",
"the",
"current",
"user",
"identified",
"by",
"id"
] | f74b6fb5c13cecae9524997847e928905cc60acf | https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/users.py#L223-L237 |
42,056 | pyapi-gitlab/pyapi-gitlab | gitlab/base.py | Base.get | def get(self, uri, default_response=None, **kwargs):
"""
Call GET on the Gitlab server
>>> gitlab = Gitlab(host='http://localhost:10080', verify_ssl=False)
>>> gitlab.login(user='root', password='5iveL!fe')
>>> gitlab.get('/users/5')
:param uri: String with the URI for ... | python | def get(self, uri, default_response=None, **kwargs):
"""
Call GET on the Gitlab server
>>> gitlab = Gitlab(host='http://localhost:10080', verify_ssl=False)
>>> gitlab.login(user='root', password='5iveL!fe')
>>> gitlab.get('/users/5')
:param uri: String with the URI for ... | [
"def",
"get",
"(",
"self",
",",
"uri",
",",
"default_response",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"url",
"=",
"self",
".",
"api_url",
"+",
"uri",
"response",
"=",
"requests",
".",
"get",
"(",
"url",
",",
"params",
"=",
"kwargs",
",",
... | Call GET on the Gitlab server
>>> gitlab = Gitlab(host='http://localhost:10080', verify_ssl=False)
>>> gitlab.login(user='root', password='5iveL!fe')
>>> gitlab.get('/users/5')
:param uri: String with the URI for the endpoint to GET from
:param default_response: Return value if... | [
"Call",
"GET",
"on",
"the",
"Gitlab",
"server"
] | f74b6fb5c13cecae9524997847e928905cc60acf | https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/base.py#L55-L74 |
42,057 | pyapi-gitlab/pyapi-gitlab | gitlab/base.py | Base.post | def post(self, uri, default_response=None, **kwargs):
"""
Call POST on the Gitlab server
>>> gitlab = Gitlab(host='http://localhost:10080', verify_ssl=False)
>>> gitlab.login(user='root', password='5iveL!fe')
>>> password = 'MyTestPassword1'
>>> email = 'example@example.... | python | def post(self, uri, default_response=None, **kwargs):
"""
Call POST on the Gitlab server
>>> gitlab = Gitlab(host='http://localhost:10080', verify_ssl=False)
>>> gitlab.login(user='root', password='5iveL!fe')
>>> password = 'MyTestPassword1'
>>> email = 'example@example.... | [
"def",
"post",
"(",
"self",
",",
"uri",
",",
"default_response",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"url",
"=",
"self",
".",
"api_url",
"+",
"uri",
"response",
"=",
"requests",
".",
"post",
"(",
"url",
",",
"headers",
"=",
"self",
".",... | Call POST on the Gitlab server
>>> gitlab = Gitlab(host='http://localhost:10080', verify_ssl=False)
>>> gitlab.login(user='root', password='5iveL!fe')
>>> password = 'MyTestPassword1'
>>> email = 'example@example.com'
>>> data = {'name': 'test', 'username': 'test1', 'password': ... | [
"Call",
"POST",
"on",
"the",
"Gitlab",
"server"
] | f74b6fb5c13cecae9524997847e928905cc60acf | https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/base.py#L76-L99 |
42,058 | pyapi-gitlab/pyapi-gitlab | gitlab/base.py | Base.delete | def delete(self, uri, default_response=None):
"""
Call DELETE on the Gitlab server
>>> gitlab = Gitlab(host='http://localhost:10080', verify_ssl=False)
>>> gitlab.login(user='root', password='5iveL!fe')
>>> gitlab.delete('/users/5')
:param uri: String with the URI you w... | python | def delete(self, uri, default_response=None):
"""
Call DELETE on the Gitlab server
>>> gitlab = Gitlab(host='http://localhost:10080', verify_ssl=False)
>>> gitlab.login(user='root', password='5iveL!fe')
>>> gitlab.delete('/users/5')
:param uri: String with the URI you w... | [
"def",
"delete",
"(",
"self",
",",
"uri",
",",
"default_response",
"=",
"None",
")",
":",
"url",
"=",
"self",
".",
"api_url",
"+",
"uri",
"response",
"=",
"requests",
".",
"delete",
"(",
"url",
",",
"headers",
"=",
"self",
".",
"headers",
",",
"verif... | Call DELETE on the Gitlab server
>>> gitlab = Gitlab(host='http://localhost:10080', verify_ssl=False)
>>> gitlab.login(user='root', password='5iveL!fe')
>>> gitlab.delete('/users/5')
:param uri: String with the URI you wish to delete
:param default_response: Return value if JSO... | [
"Call",
"DELETE",
"on",
"the",
"Gitlab",
"server"
] | f74b6fb5c13cecae9524997847e928905cc60acf | https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/base.py#L101-L119 |
42,059 | pyapi-gitlab/pyapi-gitlab | gitlab/base.py | Base.success_or_raise | def success_or_raise(self, response, default_response=None):
"""
Check if request was successful or raises an HttpError
:param response: Response Object to check
:param default_response: Return value if JSONDecodeError
:returns dict: Dictionary containing response data
:... | python | def success_or_raise(self, response, default_response=None):
"""
Check if request was successful or raises an HttpError
:param response: Response Object to check
:param default_response: Return value if JSONDecodeError
:returns dict: Dictionary containing response data
:... | [
"def",
"success_or_raise",
"(",
"self",
",",
"response",
",",
"default_response",
"=",
"None",
")",
":",
"if",
"self",
".",
"suppress_http_error",
"and",
"not",
"response",
".",
"ok",
":",
"return",
"False",
"response_json",
"=",
"default_response",
"if",
"res... | Check if request was successful or raises an HttpError
:param response: Response Object to check
:param default_response: Return value if JSONDecodeError
:returns dict: Dictionary containing response data
:returns bool: :obj:`False` on failure when exceptions are suppressed
:rai... | [
"Check",
"if",
"request",
"was",
"successful",
"or",
"raises",
"an",
"HttpError"
] | f74b6fb5c13cecae9524997847e928905cc60acf | https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/base.py#L121-L145 |
42,060 | pyapi-gitlab/pyapi-gitlab | gitlab/base.py | Base.getall | def getall(fn, page=None, *args, **kwargs):
"""
Auto-iterate over the paginated results of various methods of the API.
Pass the GitLabAPI method as the first argument, followed by the
other parameters as normal. Include `page` to determine first page to poll.
Remaining kwargs are... | python | def getall(fn, page=None, *args, **kwargs):
"""
Auto-iterate over the paginated results of various methods of the API.
Pass the GitLabAPI method as the first argument, followed by the
other parameters as normal. Include `page` to determine first page to poll.
Remaining kwargs are... | [
"def",
"getall",
"(",
"fn",
",",
"page",
"=",
"None",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"page",
":",
"page",
"=",
"1",
"while",
"True",
":",
"results",
"=",
"fn",
"(",
"*",
"args",
",",
"page",
"=",
"page",
","... | Auto-iterate over the paginated results of various methods of the API.
Pass the GitLabAPI method as the first argument, followed by the
other parameters as normal. Include `page` to determine first page to poll.
Remaining kwargs are passed on to the called method, including `per_page`.
... | [
"Auto",
"-",
"iterate",
"over",
"the",
"paginated",
"results",
"of",
"various",
"methods",
"of",
"the",
"API",
".",
"Pass",
"the",
"GitLabAPI",
"method",
"as",
"the",
"first",
"argument",
"followed",
"by",
"the",
"other",
"parameters",
"as",
"normal",
".",
... | f74b6fb5c13cecae9524997847e928905cc60acf | https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/base.py#L148-L172 |
42,061 | pyapi-gitlab/pyapi-gitlab | gitlab/__init__.py | Gitlab.setsudo | def setsudo(self, user=None):
"""
Set the subsequent API calls to the user provided
:param user: User id or username to change to, None to return to the logged user
:return: Nothing
"""
if user is None:
try:
self.headers.pop('SUDO')
... | python | def setsudo(self, user=None):
"""
Set the subsequent API calls to the user provided
:param user: User id or username to change to, None to return to the logged user
:return: Nothing
"""
if user is None:
try:
self.headers.pop('SUDO')
... | [
"def",
"setsudo",
"(",
"self",
",",
"user",
"=",
"None",
")",
":",
"if",
"user",
"is",
"None",
":",
"try",
":",
"self",
".",
"headers",
".",
"pop",
"(",
"'SUDO'",
")",
"except",
"KeyError",
":",
"pass",
"else",
":",
"self",
".",
"headers",
"[",
"... | Set the subsequent API calls to the user provided
:param user: User id or username to change to, None to return to the logged user
:return: Nothing | [
"Set",
"the",
"subsequent",
"API",
"calls",
"to",
"the",
"user",
"provided"
] | f74b6fb5c13cecae9524997847e928905cc60acf | https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L31-L44 |
42,062 | pyapi-gitlab/pyapi-gitlab | gitlab/__init__.py | Gitlab.createproject | def createproject(self, name, **kwargs):
"""
Creates a new project owned by the authenticated user.
:param name: new project name
:param path: custom repository name for new project. By default generated based on name
:param namespace_id: namespace for the new project (defaults ... | python | def createproject(self, name, **kwargs):
"""
Creates a new project owned by the authenticated user.
:param name: new project name
:param path: custom repository name for new project. By default generated based on name
:param namespace_id: namespace for the new project (defaults ... | [
"def",
"createproject",
"(",
"self",
",",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"data",
"=",
"{",
"'name'",
":",
"name",
"}",
"if",
"kwargs",
":",
"data",
".",
"update",
"(",
"kwargs",
")",
"request",
"=",
"requests",
".",
"post",
"(",
"self",... | Creates a new project owned by the authenticated user.
:param name: new project name
:param path: custom repository name for new project. By default generated based on name
:param namespace_id: namespace for the new project (defaults to user)
:param description: short project descriptio... | [
"Creates",
"a",
"new",
"project",
"owned",
"by",
"the",
"authenticated",
"user",
"."
] | f74b6fb5c13cecae9524997847e928905cc60acf | https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L101-L135 |
42,063 | pyapi-gitlab/pyapi-gitlab | gitlab/__init__.py | Gitlab.editproject | def editproject(self, project_id, **kwargs):
"""
Edit an existing project.
:param name: new project name
:param path: custom repository name for new project. By default generated based on name
:param default_branch: they default branch
:param description: short project d... | python | def editproject(self, project_id, **kwargs):
"""
Edit an existing project.
:param name: new project name
:param path: custom repository name for new project. By default generated based on name
:param default_branch: they default branch
:param description: short project d... | [
"def",
"editproject",
"(",
"self",
",",
"project_id",
",",
"*",
"*",
"kwargs",
")",
":",
"data",
"=",
"{",
"\"id\"",
":",
"project_id",
"}",
"if",
"kwargs",
":",
"data",
".",
"update",
"(",
"kwargs",
")",
"request",
"=",
"requests",
".",
"put",
"(",
... | Edit an existing project.
:param name: new project name
:param path: custom repository name for new project. By default generated based on name
:param default_branch: they default branch
:param description: short project description
:param issues_enabled:
:param merge_re... | [
"Edit",
"an",
"existing",
"project",
"."
] | f74b6fb5c13cecae9524997847e928905cc60acf | https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L137-L169 |
42,064 | pyapi-gitlab/pyapi-gitlab | gitlab/__init__.py | Gitlab.shareproject | def shareproject(self, project_id, group_id, group_access):
"""
Allow to share project with group.
:param project_id: The ID of a project
:param group_id: The ID of a group
:param group_access: Level of permissions for sharing
:return: True is success
"""
... | python | def shareproject(self, project_id, group_id, group_access):
"""
Allow to share project with group.
:param project_id: The ID of a project
:param group_id: The ID of a group
:param group_access: Level of permissions for sharing
:return: True is success
"""
... | [
"def",
"shareproject",
"(",
"self",
",",
"project_id",
",",
"group_id",
",",
"group_access",
")",
":",
"data",
"=",
"{",
"'id'",
":",
"project_id",
",",
"'group_id'",
":",
"group_id",
",",
"'group_access'",
":",
"group_access",
"}",
"request",
"=",
"requests... | Allow to share project with group.
:param project_id: The ID of a project
:param group_id: The ID of a group
:param group_access: Level of permissions for sharing
:return: True is success | [
"Allow",
"to",
"share",
"project",
"with",
"group",
"."
] | f74b6fb5c13cecae9524997847e928905cc60acf | https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L171-L186 |
42,065 | pyapi-gitlab/pyapi-gitlab | gitlab/__init__.py | Gitlab.delete_project | def delete_project(self, id):
"""
Delete a project from the Gitlab server
Gitlab currently returns a Boolean True if the deleted and as such we return an
empty Dictionary
:param id: The ID of the project or NAMESPACE/PROJECT_NAME
:return: Dictionary
:raise: Http... | python | def delete_project(self, id):
"""
Delete a project from the Gitlab server
Gitlab currently returns a Boolean True if the deleted and as such we return an
empty Dictionary
:param id: The ID of the project or NAMESPACE/PROJECT_NAME
:return: Dictionary
:raise: Http... | [
"def",
"delete_project",
"(",
"self",
",",
"id",
")",
":",
"url",
"=",
"'/projects/{id}'",
".",
"format",
"(",
"id",
"=",
"id",
")",
"response",
"=",
"self",
".",
"delete",
"(",
"url",
")",
"if",
"response",
"is",
"True",
":",
"return",
"{",
"}",
"... | Delete a project from the Gitlab server
Gitlab currently returns a Boolean True if the deleted and as such we return an
empty Dictionary
:param id: The ID of the project or NAMESPACE/PROJECT_NAME
:return: Dictionary
:raise: HttpError: If invalid response returned | [
"Delete",
"a",
"project",
"from",
"the",
"Gitlab",
"server"
] | f74b6fb5c13cecae9524997847e928905cc60acf | https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L188-L205 |
42,066 | pyapi-gitlab/pyapi-gitlab | gitlab/__init__.py | Gitlab.createprojectuser | def createprojectuser(self, user_id, name, **kwargs):
"""
Creates a new project owned by the specified user. Available only for admins.
:param user_id: user_id of owner
:param name: new project name
:param description: short project description
:param default_branch: 'ma... | python | def createprojectuser(self, user_id, name, **kwargs):
"""
Creates a new project owned by the specified user. Available only for admins.
:param user_id: user_id of owner
:param name: new project name
:param description: short project description
:param default_branch: 'ma... | [
"def",
"createprojectuser",
"(",
"self",
",",
"user_id",
",",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"data",
"=",
"{",
"'name'",
":",
"name",
"}",
"if",
"kwargs",
":",
"data",
".",
"update",
"(",
"kwargs",
")",
"request",
"=",
"requests",
".",
... | Creates a new project owned by the specified user. Available only for admins.
:param user_id: user_id of owner
:param name: new project name
:param description: short project description
:param default_branch: 'master' by default
:param issues_enabled:
:param merge_reque... | [
"Creates",
"a",
"new",
"project",
"owned",
"by",
"the",
"specified",
"user",
".",
"Available",
"only",
"for",
"admins",
"."
] | f74b6fb5c13cecae9524997847e928905cc60acf | https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L221-L252 |
42,067 | pyapi-gitlab/pyapi-gitlab | gitlab/__init__.py | Gitlab.deleteprojectmember | def deleteprojectmember(self, project_id, user_id):
"""Delete a project member
:param project_id: project id
:param user_id: user id
:return: always true
"""
request = requests.delete(
'{0}/{1}/members/{2}'.format(self.projects_url, project_id, user_id),
... | python | def deleteprojectmember(self, project_id, user_id):
"""Delete a project member
:param project_id: project id
:param user_id: user id
:return: always true
"""
request = requests.delete(
'{0}/{1}/members/{2}'.format(self.projects_url, project_id, user_id),
... | [
"def",
"deleteprojectmember",
"(",
"self",
",",
"project_id",
",",
"user_id",
")",
":",
"request",
"=",
"requests",
".",
"delete",
"(",
"'{0}/{1}/members/{2}'",
".",
"format",
"(",
"self",
".",
"projects_url",
",",
"project_id",
",",
"user_id",
")",
",",
"he... | Delete a project member
:param project_id: project id
:param user_id: user id
:return: always true | [
"Delete",
"a",
"project",
"member"
] | f74b6fb5c13cecae9524997847e928905cc60acf | https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L334-L346 |
42,068 | pyapi-gitlab/pyapi-gitlab | gitlab/__init__.py | Gitlab.addprojecthook | def addprojecthook(self, project_id, url, push=False, issues=False, merge_requests=False, tag_push=False):
"""
add a hook to a project
:param project_id: project id
:param url: url of the hook
:return: True if success
"""
data = {
'id': project_id,
... | python | def addprojecthook(self, project_id, url, push=False, issues=False, merge_requests=False, tag_push=False):
"""
add a hook to a project
:param project_id: project id
:param url: url of the hook
:return: True if success
"""
data = {
'id': project_id,
... | [
"def",
"addprojecthook",
"(",
"self",
",",
"project_id",
",",
"url",
",",
"push",
"=",
"False",
",",
"issues",
"=",
"False",
",",
"merge_requests",
"=",
"False",
",",
"tag_push",
"=",
"False",
")",
":",
"data",
"=",
"{",
"'id'",
":",
"project_id",
",",... | add a hook to a project
:param project_id: project id
:param url: url of the hook
:return: True if success | [
"add",
"a",
"hook",
"to",
"a",
"project"
] | f74b6fb5c13cecae9524997847e928905cc60acf | https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L382-L406 |
42,069 | pyapi-gitlab/pyapi-gitlab | gitlab/__init__.py | Gitlab.editprojecthook | def editprojecthook(self, project_id, hook_id, url, push=False, issues=False, merge_requests=False, tag_push=False):
"""
edit an existing hook from a project
:param id_: project id
:param hook_id: hook id
:param url: the new url
:return: True if success
"""
... | python | def editprojecthook(self, project_id, hook_id, url, push=False, issues=False, merge_requests=False, tag_push=False):
"""
edit an existing hook from a project
:param id_: project id
:param hook_id: hook id
:param url: the new url
:return: True if success
"""
... | [
"def",
"editprojecthook",
"(",
"self",
",",
"project_id",
",",
"hook_id",
",",
"url",
",",
"push",
"=",
"False",
",",
"issues",
"=",
"False",
",",
"merge_requests",
"=",
"False",
",",
"tag_push",
"=",
"False",
")",
":",
"data",
"=",
"{",
"\"id\"",
":",... | edit an existing hook from a project
:param id_: project id
:param hook_id: hook id
:param url: the new url
:return: True if success | [
"edit",
"an",
"existing",
"hook",
"from",
"a",
"project"
] | f74b6fb5c13cecae9524997847e928905cc60acf | https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L408-L434 |
42,070 | pyapi-gitlab/pyapi-gitlab | gitlab/__init__.py | Gitlab.getsystemhooks | def getsystemhooks(self, page=1, per_page=20):
"""
Get all system hooks
:param page: Page number
:param per_page: Records per page
:return: list of hooks
"""
data = {'page': page, 'per_page': per_page}
request = requests.get(
self.hook_url, p... | python | def getsystemhooks(self, page=1, per_page=20):
"""
Get all system hooks
:param page: Page number
:param per_page: Records per page
:return: list of hooks
"""
data = {'page': page, 'per_page': per_page}
request = requests.get(
self.hook_url, p... | [
"def",
"getsystemhooks",
"(",
"self",
",",
"page",
"=",
"1",
",",
"per_page",
"=",
"20",
")",
":",
"data",
"=",
"{",
"'page'",
":",
"page",
",",
"'per_page'",
":",
"per_page",
"}",
"request",
"=",
"requests",
".",
"get",
"(",
"self",
".",
"hook_url",... | Get all system hooks
:param page: Page number
:param per_page: Records per page
:return: list of hooks | [
"Get",
"all",
"system",
"hooks"
] | f74b6fb5c13cecae9524997847e928905cc60acf | https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L453-L470 |
42,071 | pyapi-gitlab/pyapi-gitlab | gitlab/__init__.py | Gitlab.addsystemhook | def addsystemhook(self, url):
"""
Add a system hook
:param url: url of the hook
:return: True if success
"""
data = {"url": url}
request = requests.post(
self.hook_url, headers=self.headers, data=data,
verify=self.verify_ssl, auth=self.au... | python | def addsystemhook(self, url):
"""
Add a system hook
:param url: url of the hook
:return: True if success
"""
data = {"url": url}
request = requests.post(
self.hook_url, headers=self.headers, data=data,
verify=self.verify_ssl, auth=self.au... | [
"def",
"addsystemhook",
"(",
"self",
",",
"url",
")",
":",
"data",
"=",
"{",
"\"url\"",
":",
"url",
"}",
"request",
"=",
"requests",
".",
"post",
"(",
"self",
".",
"hook_url",
",",
"headers",
"=",
"self",
".",
"headers",
",",
"data",
"=",
"data",
"... | Add a system hook
:param url: url of the hook
:return: True if success | [
"Add",
"a",
"system",
"hook"
] | f74b6fb5c13cecae9524997847e928905cc60acf | https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L472-L488 |
42,072 | pyapi-gitlab/pyapi-gitlab | gitlab/__init__.py | Gitlab.deletesystemhook | def deletesystemhook(self, hook_id):
"""
Delete a project hook
:param hook_id: hook id
:return: True if success
"""
data = {"id": hook_id}
request = requests.delete(
'{0}/{1}'.format(self.hook_url, hook_id), data=data,
headers=self.header... | python | def deletesystemhook(self, hook_id):
"""
Delete a project hook
:param hook_id: hook id
:return: True if success
"""
data = {"id": hook_id}
request = requests.delete(
'{0}/{1}'.format(self.hook_url, hook_id), data=data,
headers=self.header... | [
"def",
"deletesystemhook",
"(",
"self",
",",
"hook_id",
")",
":",
"data",
"=",
"{",
"\"id\"",
":",
"hook_id",
"}",
"request",
"=",
"requests",
".",
"delete",
"(",
"'{0}/{1}'",
".",
"format",
"(",
"self",
".",
"hook_url",
",",
"hook_id",
")",
",",
"data... | Delete a project hook
:param hook_id: hook id
:return: True if success | [
"Delete",
"a",
"project",
"hook"
] | f74b6fb5c13cecae9524997847e928905cc60acf | https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L508-L524 |
42,073 | pyapi-gitlab/pyapi-gitlab | gitlab/__init__.py | Gitlab.createbranch | def createbranch(self, project_id, branch, ref):
"""
Create branch from commit SHA or existing branch
:param project_id: The ID of a project
:param branch: The name of the branch
:param ref: Create branch from commit SHA or existing branch
:return: True if success, Fals... | python | def createbranch(self, project_id, branch, ref):
"""
Create branch from commit SHA or existing branch
:param project_id: The ID of a project
:param branch: The name of the branch
:param ref: Create branch from commit SHA or existing branch
:return: True if success, Fals... | [
"def",
"createbranch",
"(",
"self",
",",
"project_id",
",",
"branch",
",",
"ref",
")",
":",
"data",
"=",
"{",
"\"id\"",
":",
"project_id",
",",
"\"branch_name\"",
":",
"branch",
",",
"\"ref\"",
":",
"ref",
"}",
"request",
"=",
"requests",
".",
"post",
... | Create branch from commit SHA or existing branch
:param project_id: The ID of a project
:param branch: The name of the branch
:param ref: Create branch from commit SHA or existing branch
:return: True if success, False if not | [
"Create",
"branch",
"from",
"commit",
"SHA",
"or",
"existing",
"branch"
] | f74b6fb5c13cecae9524997847e928905cc60acf | https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L561-L579 |
42,074 | pyapi-gitlab/pyapi-gitlab | gitlab/__init__.py | Gitlab.protectbranch | def protectbranch(self, project_id, branch):
"""
Protect a branch from changes
:param project_id: project id
:param branch: branch id
:return: True if success
"""
request = requests.put(
'{0}/{1}/repository/branches/{2}/protect'.format(self.projects_u... | python | def protectbranch(self, project_id, branch):
"""
Protect a branch from changes
:param project_id: project id
:param branch: branch id
:return: True if success
"""
request = requests.put(
'{0}/{1}/repository/branches/{2}/protect'.format(self.projects_u... | [
"def",
"protectbranch",
"(",
"self",
",",
"project_id",
",",
"branch",
")",
":",
"request",
"=",
"requests",
".",
"put",
"(",
"'{0}/{1}/repository/branches/{2}/protect'",
".",
"format",
"(",
"self",
".",
"projects_url",
",",
"project_id",
",",
"branch",
")",
"... | Protect a branch from changes
:param project_id: project id
:param branch: branch id
:return: True if success | [
"Protect",
"a",
"branch",
"from",
"changes"
] | f74b6fb5c13cecae9524997847e928905cc60acf | https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L599-L614 |
42,075 | pyapi-gitlab/pyapi-gitlab | gitlab/__init__.py | Gitlab.createforkrelation | def createforkrelation(self, project_id, from_project_id):
"""
Create a fork relation.
This DO NOT create a fork but only adds a link as fork the relation between 2 repositories
:param project_id: project id
:param from_project_id: from id
:return: true if success
... | python | def createforkrelation(self, project_id, from_project_id):
"""
Create a fork relation.
This DO NOT create a fork but only adds a link as fork the relation between 2 repositories
:param project_id: project id
:param from_project_id: from id
:return: true if success
... | [
"def",
"createforkrelation",
"(",
"self",
",",
"project_id",
",",
"from_project_id",
")",
":",
"data",
"=",
"{",
"'id'",
":",
"project_id",
",",
"'forked_from_id'",
":",
"from_project_id",
"}",
"request",
"=",
"requests",
".",
"post",
"(",
"'{0}/{1}/fork/{2}'",
... | Create a fork relation.
This DO NOT create a fork but only adds a link as fork the relation between 2 repositories
:param project_id: project id
:param from_project_id: from id
:return: true if success | [
"Create",
"a",
"fork",
"relation",
"."
] | f74b6fb5c13cecae9524997847e928905cc60acf | https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L633-L653 |
42,076 | pyapi-gitlab/pyapi-gitlab | gitlab/__init__.py | Gitlab.removeforkrelation | def removeforkrelation(self, project_id):
"""
Remove an existing fork relation. this DO NOT remove the fork,only the relation between them
:param project_id: project id
:return: true if success
"""
request = requests.delete(
'{0}/{1}/fork'.format(self.project... | python | def removeforkrelation(self, project_id):
"""
Remove an existing fork relation. this DO NOT remove the fork,only the relation between them
:param project_id: project id
:return: true if success
"""
request = requests.delete(
'{0}/{1}/fork'.format(self.project... | [
"def",
"removeforkrelation",
"(",
"self",
",",
"project_id",
")",
":",
"request",
"=",
"requests",
".",
"delete",
"(",
"'{0}/{1}/fork'",
".",
"format",
"(",
"self",
".",
"projects_url",
",",
"project_id",
")",
",",
"headers",
"=",
"self",
".",
"headers",
"... | Remove an existing fork relation. this DO NOT remove the fork,only the relation between them
:param project_id: project id
:return: true if success | [
"Remove",
"an",
"existing",
"fork",
"relation",
".",
"this",
"DO",
"NOT",
"remove",
"the",
"fork",
"only",
"the",
"relation",
"between",
"them"
] | f74b6fb5c13cecae9524997847e928905cc60acf | https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L655-L670 |
42,077 | pyapi-gitlab/pyapi-gitlab | gitlab/__init__.py | Gitlab.createfork | def createfork(self, project_id):
"""
Forks a project into the user namespace of the authenticated user.
:param project_id: Project ID to fork
:return: True if succeed
"""
request = requests.post(
'{0}/fork/{1}'.format(self.projects_url, project_id),
... | python | def createfork(self, project_id):
"""
Forks a project into the user namespace of the authenticated user.
:param project_id: Project ID to fork
:return: True if succeed
"""
request = requests.post(
'{0}/fork/{1}'.format(self.projects_url, project_id),
... | [
"def",
"createfork",
"(",
"self",
",",
"project_id",
")",
":",
"request",
"=",
"requests",
".",
"post",
"(",
"'{0}/fork/{1}'",
".",
"format",
"(",
"self",
".",
"projects_url",
",",
"project_id",
")",
",",
"timeout",
"=",
"self",
".",
"timeout",
",",
"ver... | Forks a project into the user namespace of the authenticated user.
:param project_id: Project ID to fork
:return: True if succeed | [
"Forks",
"a",
"project",
"into",
"the",
"user",
"namespace",
"of",
"the",
"authenticated",
"user",
"."
] | f74b6fb5c13cecae9524997847e928905cc60acf | https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L672-L687 |
42,078 | pyapi-gitlab/pyapi-gitlab | gitlab/__init__.py | Gitlab.createissue | def createissue(self, project_id, title, **kwargs):
"""
Create a new issue
:param project_id: project id
:param title: title of the issue
:return: dict with the issue created
"""
data = {'id': id, 'title': title}
if kwargs:
data.update(kwargs)... | python | def createissue(self, project_id, title, **kwargs):
"""
Create a new issue
:param project_id: project id
:param title: title of the issue
:return: dict with the issue created
"""
data = {'id': id, 'title': title}
if kwargs:
data.update(kwargs)... | [
"def",
"createissue",
"(",
"self",
",",
"project_id",
",",
"title",
",",
"*",
"*",
"kwargs",
")",
":",
"data",
"=",
"{",
"'id'",
":",
"id",
",",
"'title'",
":",
"title",
"}",
"if",
"kwargs",
":",
"data",
".",
"update",
"(",
"kwargs",
")",
"request"... | Create a new issue
:param project_id: project id
:param title: title of the issue
:return: dict with the issue created | [
"Create",
"a",
"new",
"issue"
] | f74b6fb5c13cecae9524997847e928905cc60acf | https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L748-L766 |
42,079 | pyapi-gitlab/pyapi-gitlab | gitlab/__init__.py | Gitlab.editissue | def editissue(self, project_id, issue_id, **kwargs):
"""
Edit an existing issue data
:param project_id: project id
:param issue_id: issue id
:return: true if success
"""
data = {'id': project_id, 'issue_id': issue_id}
if kwargs:
data.update(kw... | python | def editissue(self, project_id, issue_id, **kwargs):
"""
Edit an existing issue data
:param project_id: project id
:param issue_id: issue id
:return: true if success
"""
data = {'id': project_id, 'issue_id': issue_id}
if kwargs:
data.update(kw... | [
"def",
"editissue",
"(",
"self",
",",
"project_id",
",",
"issue_id",
",",
"*",
"*",
"kwargs",
")",
":",
"data",
"=",
"{",
"'id'",
":",
"project_id",
",",
"'issue_id'",
":",
"issue_id",
"}",
"if",
"kwargs",
":",
"data",
".",
"update",
"(",
"kwargs",
"... | Edit an existing issue data
:param project_id: project id
:param issue_id: issue id
:return: true if success | [
"Edit",
"an",
"existing",
"issue",
"data"
] | f74b6fb5c13cecae9524997847e928905cc60acf | https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L768-L786 |
42,080 | pyapi-gitlab/pyapi-gitlab | gitlab/__init__.py | Gitlab.enable_deploy_key | def enable_deploy_key(self, project, key_id):
"""
Enables a deploy key for a project.
>>> gitlab = Gitlab(host='http://localhost:10080', verify_ssl=False)
>>> gitlab.login(user='root', password='5iveL!fe')
>>> gitlab.enable_deploy_key(15, 5)
:param project: The ID or UR... | python | def enable_deploy_key(self, project, key_id):
"""
Enables a deploy key for a project.
>>> gitlab = Gitlab(host='http://localhost:10080', verify_ssl=False)
>>> gitlab.login(user='root', password='5iveL!fe')
>>> gitlab.enable_deploy_key(15, 5)
:param project: The ID or UR... | [
"def",
"enable_deploy_key",
"(",
"self",
",",
"project",
",",
"key_id",
")",
":",
"url",
"=",
"'/projects/{project}/deploy_keys/{key_id}/enable'",
".",
"format",
"(",
"project",
"=",
"project",
",",
"key_id",
"=",
"key_id",
")",
"return",
"self",
".",
"post",
... | Enables a deploy key for a project.
>>> gitlab = Gitlab(host='http://localhost:10080', verify_ssl=False)
>>> gitlab.login(user='root', password='5iveL!fe')
>>> gitlab.enable_deploy_key(15, 5)
:param project: The ID or URL-encoded path of the project owned by the authenticated user
... | [
"Enables",
"a",
"deploy",
"key",
"for",
"a",
"project",
"."
] | f74b6fb5c13cecae9524997847e928905cc60acf | https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L909-L924 |
42,081 | pyapi-gitlab/pyapi-gitlab | gitlab/__init__.py | Gitlab.adddeploykey | def adddeploykey(self, project_id, title, key):
"""
Creates a new deploy key for a project.
:param project_id: project id
:param title: title of the key
:param key: the key itself
:return: true if success, false if not
"""
data = {'id': project_id, 'title... | python | def adddeploykey(self, project_id, title, key):
"""
Creates a new deploy key for a project.
:param project_id: project id
:param title: title of the key
:param key: the key itself
:return: true if success, false if not
"""
data = {'id': project_id, 'title... | [
"def",
"adddeploykey",
"(",
"self",
",",
"project_id",
",",
"title",
",",
"key",
")",
":",
"data",
"=",
"{",
"'id'",
":",
"project_id",
",",
"'title'",
":",
"title",
",",
"'key'",
":",
"key",
"}",
"request",
"=",
"requests",
".",
"post",
"(",
"'{0}/{... | Creates a new deploy key for a project.
:param project_id: project id
:param title: title of the key
:param key: the key itself
:return: true if success, false if not | [
"Creates",
"a",
"new",
"deploy",
"key",
"for",
"a",
"project",
"."
] | f74b6fb5c13cecae9524997847e928905cc60acf | https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L960-L978 |
42,082 | pyapi-gitlab/pyapi-gitlab | gitlab/__init__.py | Gitlab.moveproject | def moveproject(self, group_id, project_id):
"""
Move a given project into a given group
:param group_id: ID of the destination group
:param project_id: ID of the project to be moved
:return: dict of the updated project
"""
request = requests.post(
'{... | python | def moveproject(self, group_id, project_id):
"""
Move a given project into a given group
:param group_id: ID of the destination group
:param project_id: ID of the project to be moved
:return: dict of the updated project
"""
request = requests.post(
'{... | [
"def",
"moveproject",
"(",
"self",
",",
"group_id",
",",
"project_id",
")",
":",
"request",
"=",
"requests",
".",
"post",
"(",
"'{0}/{1}/projects/{2}'",
".",
"format",
"(",
"self",
".",
"groups_url",
",",
"group_id",
",",
"project_id",
")",
",",
"headers",
... | Move a given project into a given group
:param group_id: ID of the destination group
:param project_id: ID of the project to be moved
:return: dict of the updated project | [
"Move",
"a",
"given",
"project",
"into",
"a",
"given",
"group"
] | f74b6fb5c13cecae9524997847e928905cc60acf | https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L1041-L1056 |
42,083 | pyapi-gitlab/pyapi-gitlab | gitlab/__init__.py | Gitlab.getmergerequests | def getmergerequests(self, project_id, page=1, per_page=20, state=None):
"""
Get all the merge requests for a project.
:param project_id: ID of the project to retrieve merge requests for
:param page: Page Number
:param per_page: Records per page
:param state: Passes merg... | python | def getmergerequests(self, project_id, page=1, per_page=20, state=None):
"""
Get all the merge requests for a project.
:param project_id: ID of the project to retrieve merge requests for
:param page: Page Number
:param per_page: Records per page
:param state: Passes merg... | [
"def",
"getmergerequests",
"(",
"self",
",",
"project_id",
",",
"page",
"=",
"1",
",",
"per_page",
"=",
"20",
",",
"state",
"=",
"None",
")",
":",
"data",
"=",
"{",
"'page'",
":",
"page",
",",
"'per_page'",
":",
"per_page",
",",
"'state'",
":",
"stat... | Get all the merge requests for a project.
:param project_id: ID of the project to retrieve merge requests for
:param page: Page Number
:param per_page: Records per page
:param state: Passes merge request state to filter them by it
:return: list with all the merge requests | [
"Get",
"all",
"the",
"merge",
"requests",
"for",
"a",
"project",
"."
] | f74b6fb5c13cecae9524997847e928905cc60acf | https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L1058-L1077 |
42,084 | pyapi-gitlab/pyapi-gitlab | gitlab/__init__.py | Gitlab.getmergerequest | def getmergerequest(self, project_id, mergerequest_id):
"""
Get information about a specific merge request.
:param project_id: ID of the project
:param mergerequest_id: ID of the merge request
:return: dict of the merge request
"""
request = requests.get(
... | python | def getmergerequest(self, project_id, mergerequest_id):
"""
Get information about a specific merge request.
:param project_id: ID of the project
:param mergerequest_id: ID of the merge request
:return: dict of the merge request
"""
request = requests.get(
... | [
"def",
"getmergerequest",
"(",
"self",
",",
"project_id",
",",
"mergerequest_id",
")",
":",
"request",
"=",
"requests",
".",
"get",
"(",
"'{0}/{1}/merge_request/{2}'",
".",
"format",
"(",
"self",
".",
"projects_url",
",",
"project_id",
",",
"mergerequest_id",
")... | Get information about a specific merge request.
:param project_id: ID of the project
:param mergerequest_id: ID of the merge request
:return: dict of the merge request | [
"Get",
"information",
"about",
"a",
"specific",
"merge",
"request",
"."
] | f74b6fb5c13cecae9524997847e928905cc60acf | https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L1079-L1094 |
42,085 | pyapi-gitlab/pyapi-gitlab | gitlab/__init__.py | Gitlab.createmergerequest | def createmergerequest(self, project_id, sourcebranch, targetbranch,
title, target_project_id=None, assignee_id=None):
"""
Create a new merge request.
:param project_id: ID of the project originating the merge request
:param sourcebranch: name of the branch to... | python | def createmergerequest(self, project_id, sourcebranch, targetbranch,
title, target_project_id=None, assignee_id=None):
"""
Create a new merge request.
:param project_id: ID of the project originating the merge request
:param sourcebranch: name of the branch to... | [
"def",
"createmergerequest",
"(",
"self",
",",
"project_id",
",",
"sourcebranch",
",",
"targetbranch",
",",
"title",
",",
"target_project_id",
"=",
"None",
",",
"assignee_id",
"=",
"None",
")",
":",
"data",
"=",
"{",
"'source_branch'",
":",
"sourcebranch",
","... | Create a new merge request.
:param project_id: ID of the project originating the merge request
:param sourcebranch: name of the branch to merge from
:param targetbranch: name of the branch to merge to
:param title: Title of the merge request
:param assignee_id: Assignee user ID
... | [
"Create",
"a",
"new",
"merge",
"request",
"."
] | f74b6fb5c13cecae9524997847e928905cc60acf | https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L1134-L1161 |
42,086 | pyapi-gitlab/pyapi-gitlab | gitlab/__init__.py | Gitlab.acceptmergerequest | def acceptmergerequest(self, project_id, mergerequest_id, merge_commit_message=None):
"""
Update an existing merge request.
:param project_id: ID of the project originating the merge request
:param mergerequest_id: ID of the merge request to accept
:param merge_commit_message: C... | python | def acceptmergerequest(self, project_id, mergerequest_id, merge_commit_message=None):
"""
Update an existing merge request.
:param project_id: ID of the project originating the merge request
:param mergerequest_id: ID of the merge request to accept
:param merge_commit_message: C... | [
"def",
"acceptmergerequest",
"(",
"self",
",",
"project_id",
",",
"mergerequest_id",
",",
"merge_commit_message",
"=",
"None",
")",
":",
"data",
"=",
"{",
"'merge_commit_message'",
":",
"merge_commit_message",
"}",
"request",
"=",
"requests",
".",
"put",
"(",
"'... | Update an existing merge request.
:param project_id: ID of the project originating the merge request
:param mergerequest_id: ID of the merge request to accept
:param merge_commit_message: Custom merge commit message
:return: dict of the modified merge request | [
"Update",
"an",
"existing",
"merge",
"request",
"."
] | f74b6fb5c13cecae9524997847e928905cc60acf | https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L1190-L1209 |
42,087 | pyapi-gitlab/pyapi-gitlab | gitlab/__init__.py | Gitlab.addcommenttomergerequest | def addcommenttomergerequest(self, project_id, mergerequest_id, note):
"""
Add a comment to a merge request.
:param project_id: ID of the project originating the merge request
:param mergerequest_id: ID of the merge request to comment on
:param note: Text of comment
:ret... | python | def addcommenttomergerequest(self, project_id, mergerequest_id, note):
"""
Add a comment to a merge request.
:param project_id: ID of the project originating the merge request
:param mergerequest_id: ID of the merge request to comment on
:param note: Text of comment
:ret... | [
"def",
"addcommenttomergerequest",
"(",
"self",
",",
"project_id",
",",
"mergerequest_id",
",",
"note",
")",
":",
"request",
"=",
"requests",
".",
"post",
"(",
"'{0}/{1}/merge_request/{2}/comments'",
".",
"format",
"(",
"self",
".",
"projects_url",
",",
"project_i... | Add a comment to a merge request.
:param project_id: ID of the project originating the merge request
:param mergerequest_id: ID of the merge request to comment on
:param note: Text of comment
:return: True if success | [
"Add",
"a",
"comment",
"to",
"a",
"merge",
"request",
"."
] | f74b6fb5c13cecae9524997847e928905cc60acf | https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L1211-L1224 |
42,088 | pyapi-gitlab/pyapi-gitlab | gitlab/__init__.py | Gitlab.createsnippet | def createsnippet(self, project_id, title, file_name, code, visibility_level=0):
"""
Creates an snippet
:param project_id: project id to create the snippet under
:param title: title of the snippet
:param file_name: filename for the snippet
:param code: content of the sni... | python | def createsnippet(self, project_id, title, file_name, code, visibility_level=0):
"""
Creates an snippet
:param project_id: project id to create the snippet under
:param title: title of the snippet
:param file_name: filename for the snippet
:param code: content of the sni... | [
"def",
"createsnippet",
"(",
"self",
",",
"project_id",
",",
"title",
",",
"file_name",
",",
"code",
",",
"visibility_level",
"=",
"0",
")",
":",
"data",
"=",
"{",
"'id'",
":",
"project_id",
",",
"'title'",
":",
"title",
",",
"'file_name'",
":",
"file_na... | Creates an snippet
:param project_id: project id to create the snippet under
:param title: title of the snippet
:param file_name: filename for the snippet
:param code: content of the snippet
:param visibility_level: snippets can be either private (0), internal(10) or public(20)
... | [
"Creates",
"an",
"snippet"
] | f74b6fb5c13cecae9524997847e928905cc60acf | https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L1261-L1284 |
42,089 | pyapi-gitlab/pyapi-gitlab | gitlab/__init__.py | Gitlab.deletesnippet | def deletesnippet(self, project_id, snippet_id):
"""Deletes a given snippet
:param project_id: project_id
:param snippet_id: snippet id
:return: True if success
"""
request = requests.delete(
'{0}/{1}/snippets/{2}'.format(self.projects_url, project_id, snippe... | python | def deletesnippet(self, project_id, snippet_id):
"""Deletes a given snippet
:param project_id: project_id
:param snippet_id: snippet id
:return: True if success
"""
request = requests.delete(
'{0}/{1}/snippets/{2}'.format(self.projects_url, project_id, snippe... | [
"def",
"deletesnippet",
"(",
"self",
",",
"project_id",
",",
"snippet_id",
")",
":",
"request",
"=",
"requests",
".",
"delete",
"(",
"'{0}/{1}/snippets/{2}'",
".",
"format",
"(",
"self",
".",
"projects_url",
",",
"project_id",
",",
"snippet_id",
")",
",",
"h... | Deletes a given snippet
:param project_id: project_id
:param snippet_id: snippet id
:return: True if success | [
"Deletes",
"a",
"given",
"snippet"
] | f74b6fb5c13cecae9524997847e928905cc60acf | https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L1303-L1314 |
42,090 | pyapi-gitlab/pyapi-gitlab | gitlab/__init__.py | Gitlab.unprotectrepositorybranch | def unprotectrepositorybranch(self, project_id, branch):
"""
Unprotects a single project repository branch. This is an idempotent function,
unprotecting an already unprotected repository branch still returns a 200 OK status code.
:param project_id: project id
:param branch: bran... | python | def unprotectrepositorybranch(self, project_id, branch):
"""
Unprotects a single project repository branch. This is an idempotent function,
unprotecting an already unprotected repository branch still returns a 200 OK status code.
:param project_id: project id
:param branch: bran... | [
"def",
"unprotectrepositorybranch",
"(",
"self",
",",
"project_id",
",",
"branch",
")",
":",
"request",
"=",
"requests",
".",
"put",
"(",
"'{0}/{1}/repository/branches/{2}/unprotect'",
".",
"format",
"(",
"self",
".",
"projects_url",
",",
"project_id",
",",
"branc... | Unprotects a single project repository branch. This is an idempotent function,
unprotecting an already unprotected repository branch still returns a 200 OK status code.
:param project_id: project id
:param branch: branch to unprotect
:return: dict with the branch | [
"Unprotects",
"a",
"single",
"project",
"repository",
"branch",
".",
"This",
"is",
"an",
"idempotent",
"function",
"unprotecting",
"an",
"already",
"unprotected",
"repository",
"branch",
"still",
"returns",
"a",
"200",
"OK",
"status",
"code",
"."
] | f74b6fb5c13cecae9524997847e928905cc60acf | https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L1375-L1391 |
42,091 | pyapi-gitlab/pyapi-gitlab | gitlab/__init__.py | Gitlab.createrepositorytag | def createrepositorytag(self, project_id, tag_name, ref, message=None):
"""
Creates new tag in the repository that points to the supplied ref
:param project_id: project id
:param tag_name: tag
:param ref: sha1 of the commit or branch to tag
:param message: message
... | python | def createrepositorytag(self, project_id, tag_name, ref, message=None):
"""
Creates new tag in the repository that points to the supplied ref
:param project_id: project id
:param tag_name: tag
:param ref: sha1 of the commit or branch to tag
:param message: message
... | [
"def",
"createrepositorytag",
"(",
"self",
",",
"project_id",
",",
"tag_name",
",",
"ref",
",",
"message",
"=",
"None",
")",
":",
"data",
"=",
"{",
"'id'",
":",
"project_id",
",",
"'tag_name'",
":",
"tag_name",
",",
"'ref'",
":",
"ref",
",",
"'message'",... | Creates new tag in the repository that points to the supplied ref
:param project_id: project id
:param tag_name: tag
:param ref: sha1 of the commit or branch to tag
:param message: message
:return: dict | [
"Creates",
"new",
"tag",
"in",
"the",
"repository",
"that",
"points",
"to",
"the",
"supplied",
"ref"
] | f74b6fb5c13cecae9524997847e928905cc60acf | https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L1412-L1431 |
42,092 | pyapi-gitlab/pyapi-gitlab | gitlab/__init__.py | Gitlab.delete_repository_tag | def delete_repository_tag(self, project_id, tag_name):
"""
Deletes a tag of a repository with given name.
:param project_id: The ID of a project
:param tag_name: The name of a tag
:return: Dictionary containing delete tag
:raise: HttpError: If invalid response returned
... | python | def delete_repository_tag(self, project_id, tag_name):
"""
Deletes a tag of a repository with given name.
:param project_id: The ID of a project
:param tag_name: The name of a tag
:return: Dictionary containing delete tag
:raise: HttpError: If invalid response returned
... | [
"def",
"delete_repository_tag",
"(",
"self",
",",
"project_id",
",",
"tag_name",
")",
":",
"return",
"self",
".",
"delete",
"(",
"'/projects/{project_id}/repository/tags/{tag_name}'",
".",
"format",
"(",
"project_id",
"=",
"project_id",
",",
"tag_name",
"=",
"tag_na... | Deletes a tag of a repository with given name.
:param project_id: The ID of a project
:param tag_name: The name of a tag
:return: Dictionary containing delete tag
:raise: HttpError: If invalid response returned | [
"Deletes",
"a",
"tag",
"of",
"a",
"repository",
"with",
"given",
"name",
"."
] | f74b6fb5c13cecae9524997847e928905cc60acf | https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L1433-L1443 |
42,093 | pyapi-gitlab/pyapi-gitlab | gitlab/__init__.py | Gitlab.addcommenttocommit | def addcommenttocommit(self, project_id, author, sha, path, line, note):
"""
Adds an inline comment to a specific commit
:param project_id: project id
:param author: The author info as returned by create mergerequest
:param sha: The name of a repository branch or tag or if not g... | python | def addcommenttocommit(self, project_id, author, sha, path, line, note):
"""
Adds an inline comment to a specific commit
:param project_id: project id
:param author: The author info as returned by create mergerequest
:param sha: The name of a repository branch or tag or if not g... | [
"def",
"addcommenttocommit",
"(",
"self",
",",
"project_id",
",",
"author",
",",
"sha",
",",
"path",
",",
"line",
",",
"note",
")",
":",
"data",
"=",
"{",
"'author'",
":",
"author",
",",
"'note'",
":",
"note",
",",
"'path'",
":",
"path",
",",
"'line'... | Adds an inline comment to a specific commit
:param project_id: project id
:param author: The author info as returned by create mergerequest
:param sha: The name of a repository branch or tag or if not given the default branch
:param path: The file path
:param line: The line numb... | [
"Adds",
"an",
"inline",
"comment",
"to",
"a",
"specific",
"commit"
] | f74b6fb5c13cecae9524997847e928905cc60acf | https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L1445-L1473 |
42,094 | pyapi-gitlab/pyapi-gitlab | gitlab/__init__.py | Gitlab.getrepositorytree | def getrepositorytree(self, project_id, **kwargs):
"""
Get a list of repository files and directories in a project.
:param project_id: The ID of a project
:param path: The path inside repository. Used to get contend of subdirectories
:param ref_name: The name of a repository bra... | python | def getrepositorytree(self, project_id, **kwargs):
"""
Get a list of repository files and directories in a project.
:param project_id: The ID of a project
:param path: The path inside repository. Used to get contend of subdirectories
:param ref_name: The name of a repository bra... | [
"def",
"getrepositorytree",
"(",
"self",
",",
"project_id",
",",
"*",
"*",
"kwargs",
")",
":",
"data",
"=",
"{",
"}",
"if",
"kwargs",
":",
"data",
".",
"update",
"(",
"kwargs",
")",
"request",
"=",
"requests",
".",
"get",
"(",
"'{0}/{1}/repository/tree'"... | Get a list of repository files and directories in a project.
:param project_id: The ID of a project
:param path: The path inside repository. Used to get contend of subdirectories
:param ref_name: The name of a repository branch or tag or if not given the default branch
:return: dict wit... | [
"Get",
"a",
"list",
"of",
"repository",
"files",
"and",
"directories",
"in",
"a",
"project",
"."
] | f74b6fb5c13cecae9524997847e928905cc60acf | https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L1534-L1555 |
42,095 | pyapi-gitlab/pyapi-gitlab | gitlab/__init__.py | Gitlab.getrawfile | def getrawfile(self, project_id, sha1, filepath):
"""
Get the raw file contents for a file by commit SHA and path.
:param project_id: The ID of a project
:param sha1: The commit or branch name
:param filepath: The path the file
:return: raw file contents
"""
... | python | def getrawfile(self, project_id, sha1, filepath):
"""
Get the raw file contents for a file by commit SHA and path.
:param project_id: The ID of a project
:param sha1: The commit or branch name
:param filepath: The path the file
:return: raw file contents
"""
... | [
"def",
"getrawfile",
"(",
"self",
",",
"project_id",
",",
"sha1",
",",
"filepath",
")",
":",
"data",
"=",
"{",
"'filepath'",
":",
"filepath",
"}",
"request",
"=",
"requests",
".",
"get",
"(",
"'{0}/{1}/repository/blobs/{2}'",
".",
"format",
"(",
"self",
".... | Get the raw file contents for a file by commit SHA and path.
:param project_id: The ID of a project
:param sha1: The commit or branch name
:param filepath: The path the file
:return: raw file contents | [
"Get",
"the",
"raw",
"file",
"contents",
"for",
"a",
"file",
"by",
"commit",
"SHA",
"and",
"path",
"."
] | f74b6fb5c13cecae9524997847e928905cc60acf | https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L1557-L1576 |
42,096 | pyapi-gitlab/pyapi-gitlab | gitlab/__init__.py | Gitlab.getrawblob | def getrawblob(self, project_id, sha1):
"""
Get the raw file contents for a blob by blob SHA.
:param project_id: The ID of a project
:param sha1: the commit sha
:return: raw blob
"""
request = requests.get(
'{0}/{1}/repository/raw_blobs/{2}'.format(se... | python | def getrawblob(self, project_id, sha1):
"""
Get the raw file contents for a blob by blob SHA.
:param project_id: The ID of a project
:param sha1: the commit sha
:return: raw blob
"""
request = requests.get(
'{0}/{1}/repository/raw_blobs/{2}'.format(se... | [
"def",
"getrawblob",
"(",
"self",
",",
"project_id",
",",
"sha1",
")",
":",
"request",
"=",
"requests",
".",
"get",
"(",
"'{0}/{1}/repository/raw_blobs/{2}'",
".",
"format",
"(",
"self",
".",
"projects_url",
",",
"project_id",
",",
"sha1",
")",
",",
"verify"... | Get the raw file contents for a blob by blob SHA.
:param project_id: The ID of a project
:param sha1: the commit sha
:return: raw blob | [
"Get",
"the",
"raw",
"file",
"contents",
"for",
"a",
"blob",
"by",
"blob",
"SHA",
"."
] | f74b6fb5c13cecae9524997847e928905cc60acf | https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L1578-L1593 |
42,097 | pyapi-gitlab/pyapi-gitlab | gitlab/__init__.py | Gitlab.compare_branches_tags_commits | def compare_branches_tags_commits(self, project_id, from_id, to_id):
"""
Compare branches, tags or commits
:param project_id: The ID of a project
:param from_id: the commit sha or branch name
:param to_id: the commit sha or branch name
:return: commit list and diff betwe... | python | def compare_branches_tags_commits(self, project_id, from_id, to_id):
"""
Compare branches, tags or commits
:param project_id: The ID of a project
:param from_id: the commit sha or branch name
:param to_id: the commit sha or branch name
:return: commit list and diff betwe... | [
"def",
"compare_branches_tags_commits",
"(",
"self",
",",
"project_id",
",",
"from_id",
",",
"to_id",
")",
":",
"data",
"=",
"{",
"'from'",
":",
"from_id",
",",
"'to'",
":",
"to_id",
"}",
"request",
"=",
"requests",
".",
"get",
"(",
"'{0}/{1}/repository/comp... | Compare branches, tags or commits
:param project_id: The ID of a project
:param from_id: the commit sha or branch name
:param to_id: the commit sha or branch name
:return: commit list and diff between two branches tags or commits provided by name
:raise: HttpError: If invalid re... | [
"Compare",
"branches",
"tags",
"or",
"commits"
] | f74b6fb5c13cecae9524997847e928905cc60acf | https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L1615-L1635 |
42,098 | pyapi-gitlab/pyapi-gitlab | gitlab/__init__.py | Gitlab.searchproject | def searchproject(self, search, page=1, per_page=20):
"""
Search for projects by name which are accessible to the authenticated user
:param search: Query to search for
:param page: Page number
:param per_page: Records per page
:return: list of results
"""
... | python | def searchproject(self, search, page=1, per_page=20):
"""
Search for projects by name which are accessible to the authenticated user
:param search: Query to search for
:param page: Page number
:param per_page: Records per page
:return: list of results
"""
... | [
"def",
"searchproject",
"(",
"self",
",",
"search",
",",
"page",
"=",
"1",
",",
"per_page",
"=",
"20",
")",
":",
"data",
"=",
"{",
"'page'",
":",
"page",
",",
"'per_page'",
":",
"per_page",
"}",
"request",
"=",
"requests",
".",
"get",
"(",
"\"{0}/{1}... | Search for projects by name which are accessible to the authenticated user
:param search: Query to search for
:param page: Page number
:param per_page: Records per page
:return: list of results | [
"Search",
"for",
"projects",
"by",
"name",
"which",
"are",
"accessible",
"to",
"the",
"authenticated",
"user"
] | f74b6fb5c13cecae9524997847e928905cc60acf | https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L1637-L1653 |
42,099 | pyapi-gitlab/pyapi-gitlab | gitlab/__init__.py | Gitlab.getfilearchive | def getfilearchive(self, project_id, filepath=None):
"""
Get an archive of the repository
:param project_id: project id
:param filepath: path to save the file to
:return: True if the file was saved to the filepath
"""
if not filepath:
filepath = ''
... | python | def getfilearchive(self, project_id, filepath=None):
"""
Get an archive of the repository
:param project_id: project id
:param filepath: path to save the file to
:return: True if the file was saved to the filepath
"""
if not filepath:
filepath = ''
... | [
"def",
"getfilearchive",
"(",
"self",
",",
"project_id",
",",
"filepath",
"=",
"None",
")",
":",
"if",
"not",
"filepath",
":",
"filepath",
"=",
"''",
"request",
"=",
"requests",
".",
"get",
"(",
"'{0}/{1}/repository/archive'",
".",
"format",
"(",
"self",
"... | Get an archive of the repository
:param project_id: project id
:param filepath: path to save the file to
:return: True if the file was saved to the filepath | [
"Get",
"an",
"archive",
"of",
"the",
"repository"
] | f74b6fb5c13cecae9524997847e928905cc60acf | https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L1655-L1680 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.