idx
int64
0
63k
question
stringlengths
61
4.03k
target
stringlengths
6
1.23k
17,100
def doc_browse ( self , args , range = None ) : self . log . debug ( 'browse: in' ) self . call_options [ self . call_id ] = { "browse" : True } self . send_at_position ( "DocUri" , False , "point" )
Browse doc of whatever at cursor .
17,101
def rename ( self , new_name , range = None ) : self . log . debug ( 'rename: in' ) if not new_name : new_name = self . editor . ask_input ( "Rename to:" ) self . editor . write ( noautocmd = True ) b , e = self . editor . word_under_cursor_pos ( ) current_file = self . editor . path ( ) self . editor . raw_message ( c...
Request a rename to the server .
17,102
def symbol_search ( self , search_terms ) : self . log . debug ( 'symbol_search: in' ) if not search_terms : self . editor . message ( 'symbol_search_symbol_required' ) return req = { "typehint" : "PublicSymbolSearchReq" , "keywords" : search_terms , "maxResults" : 25 } self . send_request ( req )
Search for symbols matching a set of keywords
17,103
def send_refactor_request ( self , ref_type , ref_params , ref_options ) : request = { "typehint" : ref_type , "procId" : self . refactor_id , "params" : ref_params } f = ref_params [ "file" ] self . refactorings [ self . refactor_id ] = f self . refactor_id += 1 request . update ( ref_options ) self . send_request ( r...
Send a refactor request to the Ensime server .
17,104
def apply_refactor ( self , call_id , payload ) : supported_refactorings = [ "Rename" , "InlineLocal" , "AddImport" , "OrganizeImports" ] if payload [ "refactorType" ] [ "typehint" ] in supported_refactorings : diff_filepath = payload [ "diff" ] path = self . editor . path ( ) bname = os . path . basename ( path ) targ...
Apply a refactor depending on its type .
17,105
def buffer_leave ( self , filename ) : self . log . debug ( 'buffer_leave: %s' , filename ) self . editor . clean_errors ( )
User is changing of buffer .
17,106
def type_check ( self , filename ) : self . log . debug ( 'type_check: in' ) self . editor . clean_errors ( ) self . send_request ( { "typehint" : "TypecheckFilesReq" , "files" : [ self . editor . path ( ) ] } )
Update type checking when user saves buffer .
17,107
def unqueue ( self , timeout = 10 , should_wait = False ) : start , now = time . time ( ) , time . time ( ) wait = self . queue . empty ( ) and should_wait while ( not self . queue . empty ( ) or wait ) and ( now - start ) < timeout : if wait and self . queue . empty ( ) : time . sleep ( 0.25 ) now = time . time ( ) el...
Unqueue all the received ensime responses for a given file .
17,108
def tick ( self , filename ) : if self . connection_attempts < 10 : self . setup ( True , False ) self . connection_attempts += 1 self . unqueue_and_display ( filename )
Try to connect and display messages in queue .
17,109
def vim_enter ( self , filename ) : success = self . setup ( True , False ) if success : self . editor . message ( "start_message" )
Set up EnsimeClient when vim enters .
17,110
def complete_func ( self , findstart , base ) : self . log . debug ( 'complete_func: in %s %s' , findstart , base ) def detect_row_column_start ( ) : row , col = self . editor . cursor ( ) start = col line = self . editor . getline ( ) while start > 0 and line [ start - 1 ] not in " .,([{" : start -= 1 return row , col...
Handle omni completion .
17,111
def handle_debug_break ( self , call_id , payload ) : line = payload [ 'line' ] config = self . launcher . config path = os . path . relpath ( payload [ 'file' ] , config [ 'root-dir' ] ) self . editor . raw_message ( feedback [ 'notify_break' ] . format ( line , path ) ) self . debug_thread_id = payload [ "threadId" ]
Handle responses DebugBreakEvent .
17,112
def handle_debug_backtrace ( self , call_id , payload ) : frames = payload [ "frames" ] fd , path = tempfile . mkstemp ( '.json' , text = True , dir = self . tmp_diff_folder ) tmpfile = os . fdopen ( fd , 'w' ) tmpfile . write ( json . dumps ( frames , indent = 2 ) ) opts = { 'readonly' : True , 'bufhidden' : 'wipe' , ...
Handle responses DebugBacktrace .
17,113
def _remove_legacy_bootstrap ( ) : home = os . environ [ 'HOME' ] old_base_dir = os . path . join ( home , '.config' , 'classpath_project_ensime' ) if os . path . isdir ( old_base_dir ) : shutil . rmtree ( old_base_dir , ignore_errors = True )
Remove bootstrap projects from old path they d be really stale by now .
17,114
def _start_process ( self , classpath ) : cache_dir = self . config [ 'cache-dir' ] java_flags = self . config [ 'java-flags' ] iswindows = os . name == 'nt' Util . mkdir_p ( cache_dir ) log_path = os . path . join ( cache_dir , "server.log" ) log = open ( log_path , "w" ) null = open ( os . devnull , "r" ) java = os ....
Given a classpath prepared for running ENSIME spawns a server process in a way that is otherwise agnostic to how the strategy installs ENSIME .
17,115
def install ( self ) : project_dir = os . path . dirname ( self . classpath_file ) sbt_plugin = Util . mkdir_p ( project_dir ) Util . mkdir_p ( os . path . join ( project_dir , "project" ) ) Util . write_file ( os . path . join ( project_dir , "build.sbt" ) , self . build_sbt ( ) ) Util . write_file ( os . path . join ...
Installs ENSIME server with a bootstrap sbt project and generates its classpath .
17,116
def reorder_classpath ( self , classpath_file ) : success = False with catch ( ( IOError , OSError ) ) : with open ( classpath_file , "r" ) as f : classpath = f . readline ( ) if classpath : units = classpath . split ( ":" ) reordered_units = [ ] for unit in units : if "monkeys" in unit : reordered_units . insert ( 0 ,...
Reorder classpath and put monkeys - jar in the first place .
17,117
def find_from ( path ) : realpath = os . path . realpath ( path ) config_path = os . path . join ( realpath , '.ensime' ) if os . path . isfile ( config_path ) : return config_path elif realpath == os . path . abspath ( '/' ) : return None else : dirname = os . path . dirname ( realpath ) return ProjectConfig . find_fr...
Find path of an . ensime config searching recursively upward from path .
17,118
def parse ( path ) : def paired ( iterable ) : cursor = iter ( iterable ) return zip ( cursor , cursor ) def unwrap_if_sexp_symbol ( datum ) : return datum . value ( ) if isinstance ( datum , sexpdata . Symbol ) else datum def sexp2dict ( sexps ) : newdict = { } for key , value in paired ( sexps ) : key = str ( unwrap_...
Parse an . ensime config file from S - expressions .
17,119
def from_acl_response ( acl_response ) : if 'read' in acl_response : read_acl = AclType . from_acl_response ( acl_response [ 'read' ] ) return Acl ( read_acl ) else : raise ValueError ( 'Response does not contain read ACL' )
Takes JSON response from API and converts to ACL object
17,120
def create ( self , acl = None ) : parent , name = getParentAndBase ( self . path ) json = { 'name' : name } if acl is not None : json [ 'acl' ] = acl . to_api_param ( ) response = self . client . postJsonHelper ( DataDirectory . _getUrl ( parent ) , json , False ) if ( response . status_code != 200 ) : raise DataApiEr...
Creates a directory optionally include Acl argument to set permissions
17,121
def get_permissions ( self ) : response = self . client . getHelper ( self . url , acl = 'true' ) if response . status_code != 200 : raise DataApiError ( 'Unable to get permissions:' + str ( response . content ) ) content = response . json ( ) if 'acl' in content : return Acl . from_acl_response ( content [ 'acl' ] ) e...
Returns permissions for this directory or None if it s a special collection such as . session or . algo
17,122
def _eight_byte_real ( value ) : if value == 0 : return b'\x00\x00\x00\x00\x00\x00\x00\x00' if value < 0 : byte1 = 0x80 value = - value else : byte1 = 0x00 fexp = numpy . log2 ( value ) / 4 exponent = int ( numpy . ceil ( fexp ) ) if fexp == exponent : exponent += 1 mantissa = int ( value * 16. ** ( 14 - exponent ) ) b...
Convert a number into the GDSII 8 byte real format .
17,123
def _eight_byte_real_to_float ( value ) : short1 , short2 , long3 = struct . unpack ( '>HHL' , value ) exponent = ( short1 & 0x7f00 ) // 256 - 64 mantissa = ( ( ( short1 & 0x00ff ) * 65536 + short2 ) * 4294967296 + long3 ) / 72057594037927936.0 if short1 & 0x8000 : return - mantissa * 16. ** exponent return mantissa * ...
Convert a number from GDSII 8 byte real format to float .
17,124
def slice ( objects , position , axis , precision = 1e-3 , layer = 0 , datatype = 0 ) : if not isinstance ( layer , list ) : layer = [ layer ] if not isinstance ( objects , list ) : objects = [ objects ] if not isinstance ( position , list ) : pos = [ position ] else : pos = sorted ( position ) result = [ [ ] for _ in ...
Slice polygons and polygon sets at given positions along an axis .
17,125
def offset ( polygons , distance , join = 'miter' , tolerance = 2 , precision = 0.001 , join_first = False , max_points = 199 , layer = 0 , datatype = 0 ) : poly = [ ] if isinstance ( polygons , PolygonSet ) : poly . extend ( polygons . polygons ) elif isinstance ( polygons , CellReference ) or isinstance ( polygons , ...
Shrink or expand a polygon or polygon set .
17,126
def fast_boolean ( operandA , operandB , operation , precision = 0.001 , max_points = 199 , layer = 0 , datatype = 0 ) : polyA = [ ] polyB = [ ] for poly , obj in zip ( ( polyA , polyB ) , ( operandA , operandB ) ) : if isinstance ( obj , PolygonSet ) : poly . extend ( obj . polygons ) elif isinstance ( obj , CellRefer...
Execute any boolean operation between 2 polygons or polygon sets .
17,127
def inside ( points , polygons , short_circuit = 'any' , precision = 0.001 ) : poly = [ ] if isinstance ( polygons , PolygonSet ) : poly . extend ( polygons . polygons ) elif isinstance ( polygons , CellReference ) or isinstance ( polygons , CellArray ) : poly . extend ( polygons . get_polygons ( ) ) else : for obj in ...
Test whether each of the points is within the given set of polygons .
17,128
def copy ( obj , dx , dy ) : newObj = libCopy . deepcopy ( obj ) newObj . translate ( dx , dy ) return newObj
Creates a copy of obj and translates the new object to a new location .
17,129
def write_gds ( outfile , cells = None , name = 'library' , unit = 1.0e-6 , precision = 1.0e-9 ) : current_library . name = name current_library . unit = unit current_library . precision = precision current_library . write_gds ( outfile , cells )
Write the current GDSII library to a file .
17,130
def gdsii_hash ( filename , engine = None ) : with open ( filename , 'rb' ) as fin : data = fin . read ( ) contents = [ ] start = pos = 0 while pos < len ( data ) : size , rec = struct . unpack ( '>HH' , data [ pos : pos + 4 ] ) if rec == 0x0502 : start = pos + 28 elif rec == 0x0700 : contents . append ( data [ start :...
Calculate the a hash value for a GDSII file .
17,131
def get_bounding_box ( self ) : if len ( self . polygons ) == 0 : return None return numpy . array ( ( ( min ( pts [ : , 0 ] . min ( ) for pts in self . polygons ) , min ( pts [ : , 1 ] . min ( ) for pts in self . polygons ) ) , ( max ( pts [ : , 0 ] . max ( ) for pts in self . polygons ) , max ( pts [ : , 1 ] . max ( ...
Returns the bounding box of the polygons .
17,132
def scale ( self , scalex , scaley = None , center = ( 0 , 0 ) ) : c0 = numpy . array ( center ) s = scalex if scaley is None else numpy . array ( ( scalex , scaley ) ) self . polygons = [ ( points - c0 ) * s + c0 for points in self . polygons ] return self
Scale this object .
17,133
def to_gds ( self , multiplier ) : data = [ ] for ii in range ( len ( self . polygons ) ) : if len ( self . polygons [ ii ] ) > 4094 : raise ValueError ( "[GDSPY] Polygons with more than 4094 are " "not supported by the GDSII format." ) data . append ( struct . pack ( '>10h' , 4 , 0x0800 , 6 , 0x0D02 , self . layers [ ...
Convert this object to a series of GDSII elements .
17,134
def fracture ( self , max_points = 199 , precision = 1e-3 ) : if max_points > 4 : ii = 0 while ii < len ( self . polygons ) : if len ( self . polygons [ ii ] ) > max_points : pts0 = sorted ( self . polygons [ ii ] [ : , 0 ] ) pts1 = sorted ( self . polygons [ ii ] [ : , 1 ] ) ncuts = len ( pts0 ) // max_points if pts0 ...
Slice these polygons in the horizontal and vertical directions so that each resulting piece has at most max_points . This operation occurs in place .
17,135
def translate ( self , dx , dy ) : vec = numpy . array ( ( dx , dy ) ) self . polygons = [ points + vec for points in self . polygons ] return self
Move the polygons from one place to another
17,136
def to_gds ( self , multiplier ) : text = self . text if len ( text ) % 2 != 0 : text = text + '\0' data = struct . pack ( '>11h' , 4 , 0x0C00 , 6 , 0x0D02 , self . layer , 6 , 0x1602 , self . texttype , 6 , 0x1701 , self . anchor ) if ( self . rotation is not None ) or ( self . magnification is not None ) or self . x_...
Convert this label to a GDSII structure .
17,137
def translate ( self , dx , dy ) : self . position = numpy . array ( ( dx + self . position [ 0 ] , dy + self . position [ 1 ] ) ) return self
Move the text from one place to another
17,138
def to_gds ( self , multiplier , timestamp = None ) : now = datetime . datetime . today ( ) if timestamp is None else timestamp name = self . name if len ( name ) % 2 != 0 : name = name + '\0' return struct . pack ( '>16h' , 28 , 0x0502 , now . year , now . month , now . day , now . hour , now . minute , now . second ,...
Convert this cell to a GDSII structure .
17,139
def copy ( self , name , exclude_from_current = False , deep_copy = False ) : new_cell = Cell ( name , exclude_from_current ) if deep_copy : new_cell . elements = libCopy . deepcopy ( self . elements ) new_cell . labels = libCopy . deepcopy ( self . labels ) for ref in new_cell . get_dependencies ( True ) : if ref . _b...
Creates a copy of this cell .
17,140
def add ( self , element ) : if isinstance ( element , list ) : for e in element : if isinstance ( e , Label ) : self . labels . append ( e ) else : self . elements . append ( e ) else : if isinstance ( element , Label ) : self . labels . append ( element ) else : self . elements . append ( element ) self . _bb_valid =...
Add a new element or list of elements to this cell .
17,141
def remove_polygons ( self , test ) : empty = [ ] for element in self . elements : if isinstance ( element , PolygonSet ) : ii = 0 while ii < len ( element . polygons ) : if test ( element . polygons [ ii ] , element . layers [ ii ] , element . datatypes [ ii ] ) : element . polygons . pop ( ii ) element . layers . pop...
Remove polygons from this cell .
17,142
def remove_labels ( self , test ) : ii = 0 while ii < len ( self . labels ) : if test ( self . labels [ ii ] ) : self . labels . pop ( ii ) else : ii += 1 return self
Remove labels from this cell .
17,143
def area ( self , by_spec = False ) : if by_spec : cell_area = { } for element in self . elements : element_area = element . area ( True ) for ll in element_area . keys ( ) : if ll in cell_area : cell_area [ ll ] += element_area [ ll ] else : cell_area [ ll ] = element_area [ ll ] else : cell_area = 0 for element in se...
Calculate the total area of the elements on this cell including cell references and arrays .
17,144
def get_layers ( self ) : layers = set ( ) for element in self . elements : if isinstance ( element , PolygonSet ) : layers . update ( element . layers ) elif isinstance ( element , CellReference ) or isinstance ( element , CellArray ) : layers . update ( element . ref_cell . get_layers ( ) ) for label in self . labels...
Returns a set of layers in this cell .
17,145
def get_datatypes ( self ) : datatypes = set ( ) for element in self . elements : if isinstance ( element , PolygonSet ) : datatypes . update ( element . datatypes ) elif isinstance ( element , CellReference ) or isinstance ( element , CellArray ) : datatypes . update ( element . ref_cell . get_datatypes ( ) ) return d...
Returns a set of datatypes in this cell .
17,146
def get_bounding_box ( self ) : if len ( self . elements ) == 0 : return None if not ( self . _bb_valid and all ( ref . _bb_valid for ref in self . get_dependencies ( True ) ) ) : bb = numpy . array ( ( ( 1e300 , 1e300 ) , ( - 1e300 , - 1e300 ) ) ) all_polygons = [ ] for element in self . elements : if isinstance ( ele...
Returns the bounding box for this cell .
17,147
def get_polygons ( self , by_spec = False , depth = None ) : if depth is not None and depth < 0 : bb = self . get_bounding_box ( ) if bb is None : return { } if by_spec else [ ] pts = [ numpy . array ( [ ( bb [ 0 , 0 ] , bb [ 0 , 1 ] ) , ( bb [ 0 , 0 ] , bb [ 1 , 1 ] ) , ( bb [ 1 , 0 ] , bb [ 1 , 1 ] ) , ( bb [ 1 , 0 ]...
Returns a list of polygons in this cell .
17,148
def get_labels ( self , depth = None ) : labels = libCopy . deepcopy ( self . labels ) if depth is None or depth > 0 : for element in self . elements : if isinstance ( element , CellReference ) : labels . extend ( element . get_labels ( None if depth is None else depth - 1 ) ) elif isinstance ( element , CellArray ) : ...
Returns a list with a copy of the labels in this cell .
17,149
def get_dependencies ( self , recursive = False ) : dependencies = set ( ) for element in self . elements : if isinstance ( element , CellReference ) or isinstance ( element , CellArray ) : if recursive : dependencies . update ( element . ref_cell . get_dependencies ( True ) ) dependencies . add ( element . ref_cell ) ...
Returns a list of the cells included in this cell as references .
17,150
def flatten ( self , single_layer = None , single_datatype = None , single_texttype = None ) : self . labels = self . get_labels ( ) if single_layer is not None : for lbl in self . labels : lbl . layer = single_layer if single_texttype is not None : for lbl in self . labels : lbl . texttype = single_texttype if single_...
Flatten all CellReference and CellArray elements in this cell into real polygons and labels instead of references .
17,151
def area ( self , by_spec = False ) : if not isinstance ( self . ref_cell , Cell ) : return dict ( ) if by_spec else 0 if self . magnification is None : return self . ref_cell . area ( by_spec ) else : if by_spec : factor = self . magnification ** 2 cell_area = self . ref_cell . area ( True ) for kk in cell_area . keys...
Calculate the total area of the referenced cell with the magnification factor included .
17,152
def get_bounding_box ( self ) : if not isinstance ( self . ref_cell , Cell ) : return None if ( self . rotation is None and self . magnification is None and self . x_reflection is None ) : key = self else : key = ( self . ref_cell , self . rotation , self . magnification , self . x_reflection ) deps = self . ref_cell ....
Returns the bounding box for this reference .
17,153
def translate ( self , dx , dy ) : self . origin = ( self . origin [ 0 ] + dx , self . origin [ 1 ] + dy ) return self
Move the reference from one place to another
17,154
def add ( self , cell , overwrite_duplicate = False ) : if isinstance ( cell , Cell ) : if ( not overwrite_duplicate and cell . name in self . cell_dict and self . cell_dict [ cell . name ] is not cell ) : raise ValueError ( "[GDSPY] cell named {0} already present in " "library." . format ( cell . name ) ) self . cell_...
Add one or more cells to the library .
17,155
def write_gds ( self , outfile , cells = None , timestamp = None ) : if isinstance ( outfile , basestring ) : outfile = open ( outfile , 'wb' ) close = True else : close = False now = datetime . datetime . today ( ) if timestamp is None else timestamp name = self . name if len ( self . name ) % 2 == 0 else ( self . nam...
Write the GDSII library to a file .
17,156
def _read_record ( self , stream ) : header = stream . read ( 4 ) if len ( header ) < 4 : return None size , rec_type = struct . unpack ( '>HH' , header ) data_type = ( rec_type & 0x00ff ) rec_type = rec_type // 256 data = None if size > 4 : if data_type == 0x01 : data = numpy . array ( struct . unpack ( '>{0}H' . form...
Read a complete record from a GDSII stream file .
17,157
def extract ( self , cell ) : cell = self . cell_dict . get ( cell , cell ) current_library . add ( cell ) current_library . add ( cell . get_dependencies ( True ) ) return cell
Extract a cell from the this GDSII file and include it in the current global library including referenced dependencies .
17,158
def top_level ( self ) : top = list ( self . cell_dict . values ( ) ) for cell in self . cell_dict . values ( ) : for dependency in cell . get_dependencies ( ) : if dependency in top : top . remove ( dependency ) return top
Output the top level cells from the GDSII data .
17,159
def write_cell ( self , cell ) : self . _outfile . write ( cell . to_gds ( self . _res ) ) return self
Write the specified cell to the file .
17,160
def close ( self ) : self . _outfile . write ( struct . pack ( '>2h' , 4 , 0x0400 ) ) if self . _close : self . _outfile . close ( )
Finalize the GDSII stream library .
17,161
def waveguide ( path , points , finish , bend_radius , number_of_points = 0.01 , direction = None , layer = 0 , datatype = 0 ) : if direction is not None : path . direction = direction axis = 0 if path . direction [ 1 ] == 'x' else 1 points . append ( finish [ ( axis + len ( points ) ) % 2 ] ) n = len ( points ) if poi...
Easy waveguide creation tool with absolute positioning .
17,162
def taper ( path , length , final_width , final_distance , direction = None , layer = 0 , datatype = 0 ) : if layer . __class__ == datatype . __class__ == [ ] . __class__ : assert len ( layer ) == len ( datatype ) elif isinstance ( layer , int ) and isinstance ( datatype , int ) : layer = [ layer ] datatype = [ datatyp...
Linear tapers for the lazy .
17,163
def grating ( period , number_of_teeth , fill_frac , width , position , direction , lda = 1 , sin_theta = 0 , focus_distance = - 1 , focus_width = - 1 , evaluations = 99 , layer = 0 , datatype = 0 ) : if focus_distance < 0 : path = gdspy . L1Path ( ( position [ 0 ] - 0.5 * width , position [ 1 ] + 0.5 * ( number_of_tee...
Straight or focusing grating .
17,164
def render_pdf ( html , stylesheets = None , download_filename = None , automatic_download = True ) : if not hasattr ( html , 'write_pdf' ) : html = HTML ( html ) pdf = html . write_pdf ( stylesheets = stylesheets ) response = current_app . response_class ( pdf , mimetype = 'application/pdf' ) if download_filename : if...
Render a PDF to a response with the correct Content - Type header .
17,165
def _inject_args ( sig , types ) : if '(' in sig : parts = sig . split ( '(' ) sig = '%s(%s%s%s' % ( parts [ 0 ] , ', ' . join ( types ) , ( ', ' if parts [ 1 ] . index ( ')' ) > 0 else '' ) , parts [ 1 ] ) else : sig = '%s(%s)' % ( sig , ', ' . join ( types ) ) return sig
A function to inject arguments manually into a method signature before it s been parsed . If using keyword arguments use kw = type instead in the types array .
17,166
def jsonrpc_method ( name , authenticated = False , authentication_arguments = [ 'username' , 'password' ] , safe = False , validate = False , site = default_site ) : def decorator ( func ) : arg_names = getargspec ( func ) [ 0 ] [ 1 : ] X = { 'name' : name , 'arg_names' : arg_names } if authenticated : if authenticate...
Wraps a function turns it into a json - rpc method . Adds several attributes to the function specific to the JSON - RPC machinery and adds it to the default jsonrpc_site if one isn t provided . You must import the module containing these functions in your urls . py .
17,167
def send_payload ( self , params ) : data = dumps ( { 'jsonrpc' : self . version , 'method' : self . service_name , 'params' : params , 'id' : str ( uuid . uuid1 ( ) ) } ) . encode ( 'utf-8' ) headers = { 'Content-Type' : 'application/json-rpc' , 'Accept' : 'application/json-rpc' , 'Content-Length' : len ( data ) } try...
Performs the actual sending action and returns the result
17,168
def json_rpc_format ( self ) : error = { 'name' : smart_text ( self . __class__ . __name__ ) , 'code' : self . code , 'message' : "%s: %s" % ( smart_text ( self . __class__ . __name__ ) , smart_text ( self . message ) ) , 'data' : self . data } from django . conf import settings if settings . DEBUG : import sys , trace...
return the Exception data in a format for JSON - RPC
17,169
def directory ( self , query , ** kwargs ) : if isinstance ( query , dict ) : query = str ( query ) . replace ( "'" , '"' ) return self . __call_api_get ( 'directory' , query = query , kwargs = kwargs )
Search by users or channels on all server .
17,170
def spotlight ( self , query , ** kwargs ) : return self . __call_api_get ( 'spotlight' , query = query , kwargs = kwargs )
Searches for users or rooms that are visible to the user .
17,171
def users_get_presence ( self , user_id = None , username = None , ** kwargs ) : if user_id : return self . __call_api_get ( 'users.getPresence' , userId = user_id , kwargs = kwargs ) elif username : return self . __call_api_get ( 'users.getPresence' , username = username , kwargs = kwargs ) else : raise RocketMissingP...
Gets the online presence of the a user .
17,172
def users_create ( self , email , name , password , username , ** kwargs ) : return self . __call_api_post ( 'users.create' , email = email , name = name , password = password , username = username , kwargs = kwargs )
Creates a user
17,173
def users_create_token ( self , user_id = None , username = None , ** kwargs ) : if user_id : return self . __call_api_post ( 'users.createToken' , userId = user_id , kwargs = kwargs ) elif username : return self . __call_api_post ( 'users.createToken' , username = username , kwargs = kwargs ) else : raise RocketMissin...
Create a user authentication token .
17,174
def users_forgot_password ( self , email , ** kwargs ) : return self . __call_api_post ( 'users.forgotPassword' , email = email , data = kwargs )
Send email to reset your password .
17,175
def chat_post_message ( self , text , room_id = None , channel = None , ** kwargs ) : if room_id : return self . __call_api_post ( 'chat.postMessage' , roomId = room_id , text = text , kwargs = kwargs ) elif channel : return self . __call_api_post ( 'chat.postMessage' , channel = channel , text = text , kwargs = kwargs...
Posts a new chat message .
17,176
def chat_delete ( self , room_id , msg_id , ** kwargs ) : return self . __call_api_post ( 'chat.delete' , roomId = room_id , msgId = msg_id , kwargs = kwargs )
Deletes a chat message .
17,177
def chat_search ( self , room_id , search_text , ** kwargs ) : return self . __call_api_get ( 'chat.search' , roomId = room_id , searchText = search_text , kwargs = kwargs )
Search for messages in a channel by id and text message .
17,178
def chat_get_message_read_receipts ( self , message_id , ** kwargs ) : return self . __call_api_get ( 'chat.getMessageReadReceipts' , messageId = message_id , kwargs = kwargs )
Get Message Read Receipts
17,179
def channels_history ( self , room_id , ** kwargs ) : return self . __call_api_get ( 'channels.history' , roomId = room_id , kwargs = kwargs )
Retrieves the messages from a channel .
17,180
def channels_add_all ( self , room_id , ** kwargs ) : return self . __call_api_post ( 'channels.addAll' , roomId = room_id , kwargs = kwargs )
Adds all of the users of the Rocket . Chat server to the channel .
17,181
def channels_add_moderator ( self , room_id , user_id , ** kwargs ) : return self . __call_api_post ( 'channels.addModerator' , roomId = room_id , userId = user_id , kwargs = kwargs )
Gives the role of moderator for a user in the current channel .
17,182
def channels_remove_moderator ( self , room_id , user_id , ** kwargs ) : return self . __call_api_post ( 'channels.removeModerator' , roomId = room_id , userId = user_id , kwargs = kwargs )
Removes the role of moderator from a user in the current channel .
17,183
def channels_add_owner ( self , room_id , user_id = None , username = None , ** kwargs ) : if user_id : return self . __call_api_post ( 'channels.addOwner' , roomId = room_id , userId = user_id , kwargs = kwargs ) elif username : return self . __call_api_post ( 'channels.addOwner' , roomId = room_id , username = userna...
Gives the role of owner for a user in the current channel .
17,184
def channels_remove_owner ( self , room_id , user_id , ** kwargs ) : return self . __call_api_post ( 'channels.removeOwner' , roomId = room_id , userId = user_id , kwargs = kwargs )
Removes the role of owner from a user in the current channel .
17,185
def channels_archive ( self , room_id , ** kwargs ) : return self . __call_api_post ( 'channels.archive' , roomId = room_id , kwargs = kwargs )
Archives a channel .
17,186
def channels_create ( self , name , ** kwargs ) : return self . __call_api_post ( 'channels.create' , name = name , kwargs = kwargs )
Creates a new public channel optionally including users .
17,187
def channels_get_integrations ( self , room_id , ** kwargs ) : return self . __call_api_get ( 'channels.getIntegrations' , roomId = room_id , kwargs = kwargs )
Retrieves the integrations which the channel has
17,188
def channels_kick ( self , room_id , user_id , ** kwargs ) : return self . __call_api_post ( 'channels.kick' , roomId = room_id , userId = user_id , kwargs = kwargs )
Removes a user from the channel .
17,189
def channels_leave ( self , room_id , ** kwargs ) : return self . __call_api_post ( 'channels.leave' , roomId = room_id , kwargs = kwargs )
Causes the callee to be removed from the channel .
17,190
def channels_rename ( self , room_id , name , ** kwargs ) : return self . __call_api_post ( 'channels.rename' , roomId = room_id , name = name , kwargs = kwargs )
Changes the name of the channel .
17,191
def channels_set_description ( self , room_id , description , ** kwargs ) : return self . __call_api_post ( 'channels.setDescription' , roomId = room_id , description = description , kwargs = kwargs )
Sets the description for the channel .
17,192
def channels_set_join_code ( self , room_id , join_code , ** kwargs ) : return self . __call_api_post ( 'channels.setJoinCode' , roomId = room_id , joinCode = join_code , kwargs = kwargs )
Sets the code required to join the channel .
17,193
def channels_set_topic ( self , room_id , topic , ** kwargs ) : return self . __call_api_post ( 'channels.setTopic' , roomId = room_id , topic = topic , kwargs = kwargs )
Sets the topic for the channel .
17,194
def channels_set_type ( self , room_id , a_type , ** kwargs ) : return self . __call_api_post ( 'channels.setType' , roomId = room_id , type = a_type , kwargs = kwargs )
Sets the type of room this channel should be . The type of room this channel should be either c or p .
17,195
def channels_set_announcement ( self , room_id , announce , ** kwargs ) : return self . __call_api_post ( 'channels.setAnnouncement' , roomId = room_id , announcement = announce , kwargs = kwargs )
Sets the announcement for the channel .
17,196
def channels_set_custom_fields ( self , rid , custom_fields ) : return self . __call_api_post ( 'channels.setCustomFields' , roomId = rid , customFields = custom_fields )
Sets the custom fields for the channel .
17,197
def channels_delete ( self , room_id = None , channel = None , ** kwargs ) : if room_id : return self . __call_api_post ( 'channels.delete' , roomId = room_id , kwargs = kwargs ) elif channel : return self . __call_api_post ( 'channels.delete' , roomName = channel , kwargs = kwargs ) else : raise RocketMissingParamExce...
Delete a public channel .
17,198
def channels_get_all_user_mentions_by_channel ( self , room_id , ** kwargs ) : return self . __call_api_get ( 'channels.getAllUserMentionsByChannel' , roomId = room_id , kwargs = kwargs )
Gets all the mentions of a channel .
17,199
def groups_history ( self , room_id , ** kwargs ) : return self . __call_api_get ( 'groups.history' , roomId = room_id , kwargs = kwargs )
Retrieves the messages from a private group .