blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
6.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
438
7.52k
id
stringlengths
40
40
length_bytes
int64
506
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.25k
prompted_full_text
stringlengths
645
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.34k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
302
7.33k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
50fc075c8b03b337eda35200a954205dbf5df24a
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')" ]
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
定义算术服务
ArithServicer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ArithServicer: """定义算术服务""" def XiangJia(self, request, context): """定义相加方法""" <|body_0|> def XiangJian(self, request, context): """定义相减方法""" <|body_1|> <|end_skeleton|> <|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) co...
stack_v2_sparse_classes_36k_train_002000
3,524
no_license
[ { "docstring": "定义相加方法", "name": "XiangJia", "signature": "def XiangJia(self, request, context)" }, { "docstring": "定义相减方法", "name": "XiangJian", "signature": "def XiangJian(self, request, context)" } ]
2
stack_v2_sparse_classes_30k_train_004725
Implement the Python class `ArithServicer` described below. Class description: 定义算术服务 Method signatures and docstrings: - def XiangJia(self, request, context): 定义相加方法 - def XiangJian(self, request, context): 定义相减方法
Implement the Python class `ArithServicer` described below. Class description: 定义算术服务 Method signatures and docstrings: - def XiangJia(self, request, context): 定义相加方法 - def XiangJian(self, request, context): 定义相减方法 <|skeleton|> class ArithServicer: """定义算术服务""" def XiangJia(self, request, context): ...
c2389b6d9c47d9a1a2e63c8e0dc3fc132943b444
<|skeleton|> class ArithServicer: """定义算术服务""" def XiangJia(self, request, context): """定义相加方法""" <|body_0|> def XiangJian(self, request, context): """定义相减方法""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ArithServicer: """定义算术服务""" def XiangJia(self, request, context): """定义相加方法""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') def XiangJian(self, request, context): ...
the_stack_v2_python_sparse
micro/proto/grpc/arith_pb2_grpc.py
jstang9527/buoy
train
2
15bebe7cd93e6e69a86ed91f5cd43a7889e3ca15
[ "self.longitude = round(longitude, 4)\nself.latitude = round(latitude, 4)\nself.center = 'center=' + str(latitude) + ',' + str(longitude)\nself.zoom = 'zoom=%d' % zoom_level\nself.google_query = '&'.join([GMapQuery.beginning, self.center, self.zoom, GMapQuery.format, GMapQuery.map_type, GMapQuery.size, GMapQuery.ke...
<|body_start_0|> self.longitude = round(longitude, 4) self.latitude = round(latitude, 4) self.center = 'center=' + str(latitude) + ',' + str(longitude) self.zoom = 'zoom=%d' % zoom_level self.google_query = '&'.join([GMapQuery.beginning, self.center, self.zoom, GMapQuery.format, ...
A GMapQuery object is an instance of google map query. It can be used to fetch and download static images through the GoogleMaps API
GMapQuery
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GMapQuery: """A GMapQuery object is an instance of google map query. It can be used to fetch and download static images through the GoogleMaps API""" def __init__(self, latitude, longitude, zoom_level=18): """Provide a float pair of latitude/longitude and a zoom level to create a new...
stack_v2_sparse_classes_36k_train_002001
15,201
no_license
[ { "docstring": "Provide a float pair of latitude/longitude and a zoom level to create a new GMapQuery object. This object will then be used to access the GMaps API. :rtype : GMapQuery :param latitude: latitude of the center point :param longitude: longitude of the center point :param zoom_level: level of zoom t...
4
stack_v2_sparse_classes_30k_train_018406
Implement the Python class `GMapQuery` described below. Class description: A GMapQuery object is an instance of google map query. It can be used to fetch and download static images through the GoogleMaps API Method signatures and docstrings: - def __init__(self, latitude, longitude, zoom_level=18): Provide a float pa...
Implement the Python class `GMapQuery` described below. Class description: A GMapQuery object is an instance of google map query. It can be used to fetch and download static images through the GoogleMaps API Method signatures and docstrings: - def __init__(self, latitude, longitude, zoom_level=18): Provide a float pa...
bdde340d3c9de483f19749a4b59a24ed80e61047
<|skeleton|> class GMapQuery: """A GMapQuery object is an instance of google map query. It can be used to fetch and download static images through the GoogleMaps API""" def __init__(self, latitude, longitude, zoom_level=18): """Provide a float pair of latitude/longitude and a zoom level to create a new...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GMapQuery: """A GMapQuery object is an instance of google map query. It can be used to fetch and download static images through the GoogleMaps API""" def __init__(self, latitude, longitude, zoom_level=18): """Provide a float pair of latitude/longitude and a zoom level to create a new GMapQuery ob...
the_stack_v2_python_sparse
get_data/download_GMapQuery.py
1va/caravan
train
0
2d57e31e6c305401117a2256525f793e28fd296a
[ "sez = niz.split()\nself.x = int(sez[0])\nself.y = int(sez[1])", "razd_krajišči = math.sqrt((krajišče1.x - krajišče2.x) ** 2 + (krajišče1.y - krajišče2.y) ** 2)\nrazd1 = math.sqrt((self.y - krajišče1.y) ** 2 + (self.x - krajišče1.x) ** 2)\nrazd2 = math.sqrt((self.y - krajišče2.y) ** 2 + (self.x - krajišče2.x) ** ...
<|body_start_0|> sez = niz.split() self.x = int(sez[0]) self.y = int(sez[1]) <|end_body_0|> <|body_start_1|> razd_krajišči = math.sqrt((krajišče1.x - krajišče2.x) ** 2 + (krajišče1.y - krajišče2.y) ** 2) razd1 = math.sqrt((self.y - krajišče1.y) ** 2 + (self.x - krajišče1.x) ** 2...
Predstavlja točko s koordinatama x in y.
Točka
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Točka: """Predstavlja točko s koordinatama x in y.""" def __init__(self, niz): """Dobi niz oblike 'x y' in iz njega razbere točkini koordinati.""" <|body_0|> def je_na_črti(self, krajišče1, krajišče2): """Preveri ali točka 'točka' leži na daljici med krajišče1 in...
stack_v2_sparse_classes_36k_train_002002
2,501
no_license
[ { "docstring": "Dobi niz oblike 'x y' in iz njega razbere točkini koordinati.", "name": "__init__", "signature": "def __init__(self, niz)" }, { "docstring": "Preveri ali točka 'točka' leži na daljici med krajišče1 in krajišče2.", "name": "je_na_črti", "signature": "def je_na_črti(self, k...
2
stack_v2_sparse_classes_30k_train_016042
Implement the Python class `Točka` described below. Class description: Predstavlja točko s koordinatama x in y. Method signatures and docstrings: - def __init__(self, niz): Dobi niz oblike 'x y' in iz njega razbere točkini koordinati. - def je_na_črti(self, krajišče1, krajišče2): Preveri ali točka 'točka' leži na dal...
Implement the Python class `Točka` described below. Class description: Predstavlja točko s koordinatama x in y. Method signatures and docstrings: - def __init__(self, niz): Dobi niz oblike 'x y' in iz njega razbere točkini koordinati. - def je_na_črti(self, krajišče1, krajišče2): Preveri ali točka 'točka' leži na dal...
32fd8fde84fa5c1e2d2b366d9d97bb9835a61ec4
<|skeleton|> class Točka: """Predstavlja točko s koordinatama x in y.""" def __init__(self, niz): """Dobi niz oblike 'x y' in iz njega razbere točkini koordinati.""" <|body_0|> def je_na_črti(self, krajišče1, krajišče2): """Preveri ali točka 'točka' leži na daljici med krajišče1 in...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Točka: """Predstavlja točko s koordinatama x in y.""" def __init__(self, niz): """Dobi niz oblike 'x y' in iz njega razbere točkini koordinati.""" sez = niz.split() self.x = int(sez[0]) self.y = int(sez[1]) def je_na_črti(self, krajišče1, krajišče2): """Prever...
the_stack_v2_python_sparse
poininpolygon.py
EminaMerlakSusman/kattis-solutions
train
0
c07584d731116917c651a973040025ecdb7ddc50
[ "super(AttnDecoderRNN, self).__init__()\nself.hidden_size = hidden_size\nself.output_voc_size = output_voc_size\nself.dropout_p = dropout_p\nself.max_length = max_length\nself.encoder_bidirectional = encoder_bidirectional\nself.embedding = nn.Embedding(self.output_voc_size, self.hidden_size)\nif self.encoder_bidire...
<|body_start_0|> super(AttnDecoderRNN, self).__init__() self.hidden_size = hidden_size self.output_voc_size = output_voc_size self.dropout_p = dropout_p self.max_length = max_length self.encoder_bidirectional = encoder_bidirectional self.embedding = nn.Embedding(s...
GRU Attention Decoder for Encoder-Decoder.
AttnDecoderRNN
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AttnDecoderRNN: """GRU Attention Decoder for Encoder-Decoder.""" def __init__(self, hidden_size, output_voc_size, dropout_p=0.1, max_length=10, encoder_bidirectional=True): """Initializes an Decoder network based on a Gated Recurrent Unit. :param hidden_size: length of embedding vect...
stack_v2_sparse_classes_36k_train_002003
7,831
permissive
[ { "docstring": "Initializes an Decoder network based on a Gated Recurrent Unit. :param hidden_size: length of embedding vectors. :param output_voc_size: size of the vocabulary set to be embedded by the Embedding layer. :param dropout_p: probability of an element to be zeroed for the Dropout layer. :param max_le...
2
stack_v2_sparse_classes_30k_train_004324
Implement the Python class `AttnDecoderRNN` described below. Class description: GRU Attention Decoder for Encoder-Decoder. Method signatures and docstrings: - def __init__(self, hidden_size, output_voc_size, dropout_p=0.1, max_length=10, encoder_bidirectional=True): Initializes an Decoder network based on a Gated Rec...
Implement the Python class `AttnDecoderRNN` described below. Class description: GRU Attention Decoder for Encoder-Decoder. Method signatures and docstrings: - def __init__(self, hidden_size, output_voc_size, dropout_p=0.1, max_length=10, encoder_bidirectional=True): Initializes an Decoder network based on a Gated Rec...
c655c88cc6aec4d0724c19ea95209f1c2dd6770d
<|skeleton|> class AttnDecoderRNN: """GRU Attention Decoder for Encoder-Decoder.""" def __init__(self, hidden_size, output_voc_size, dropout_p=0.1, max_length=10, encoder_bidirectional=True): """Initializes an Decoder network based on a Gated Recurrent Unit. :param hidden_size: length of embedding vect...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AttnDecoderRNN: """GRU Attention Decoder for Encoder-Decoder.""" def __init__(self, hidden_size, output_voc_size, dropout_p=0.1, max_length=10, encoder_bidirectional=True): """Initializes an Decoder network based on a Gated Recurrent Unit. :param hidden_size: length of embedding vectors. :param o...
the_stack_v2_python_sparse
models/text2text/attn_decoder.py
aasseman/mi-prometheus
train
0
14389efd7fda65ba1509874e2a475b05e4376c93
[ "self.wait_for_click((By.CSS_SELECTOR, '.index_service_cnt_itemWrap:nth-child(1)'))\nself._driver.find_element(By.CSS_SELECTOR, '.index_service_cnt_itemWrap:nth-child(1)').send_keys(Keys.ENTER)\nprint('点击添加按钮')\nreturn AddMember()", "self.wait_for_click((By.ID, 'menu_contacts'))\nself._driver.execute_script('docu...
<|body_start_0|> self.wait_for_click((By.CSS_SELECTOR, '.index_service_cnt_itemWrap:nth-child(1)')) self._driver.find_element(By.CSS_SELECTOR, '.index_service_cnt_itemWrap:nth-child(1)').send_keys(Keys.ENTER) print('点击添加按钮') return AddMember() <|end_body_0|> <|body_start_1|> sel...
Main
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Main: def goto_add_member(self): """实现点击添加成员按钮的方法""" <|body_0|> def goto_address_list(self): """实现点击通讯录按钮的方法""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.wait_for_click((By.CSS_SELECTOR, '.index_service_cnt_itemWrap:nth-child(1)')) s...
stack_v2_sparse_classes_36k_train_002004
1,083
no_license
[ { "docstring": "实现点击添加成员按钮的方法", "name": "goto_add_member", "signature": "def goto_add_member(self)" }, { "docstring": "实现点击通讯录按钮的方法", "name": "goto_address_list", "signature": "def goto_address_list(self)" } ]
2
stack_v2_sparse_classes_30k_train_002137
Implement the Python class `Main` described below. Class description: Implement the Main class. Method signatures and docstrings: - def goto_add_member(self): 实现点击添加成员按钮的方法 - def goto_address_list(self): 实现点击通讯录按钮的方法
Implement the Python class `Main` described below. Class description: Implement the Main class. Method signatures and docstrings: - def goto_add_member(self): 实现点击添加成员按钮的方法 - def goto_address_list(self): 实现点击通讯录按钮的方法 <|skeleton|> class Main: def goto_add_member(self): """实现点击添加成员按钮的方法""" <|body_...
fdf51704b5e23b5269df0e1e9371f2a2e837b7c0
<|skeleton|> class Main: def goto_add_member(self): """实现点击添加成员按钮的方法""" <|body_0|> def goto_address_list(self): """实现点击通讯录按钮的方法""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Main: def goto_add_member(self): """实现点击添加成员按钮的方法""" self.wait_for_click((By.CSS_SELECTOR, '.index_service_cnt_itemWrap:nth-child(1)')) self._driver.find_element(By.CSS_SELECTOR, '.index_service_cnt_itemWrap:nth-child(1)').send_keys(Keys.ENTER) print('点击添加按钮') return Ad...
the_stack_v2_python_sparse
web/page_workwx_main/page/page_main.py
ouyi-github/cskf
train
0
09540f4af46d2a8848aec6d8673a78f6fb26a421
[ "helper = self._getHelper(model)\nmetadata = helper.getMetadata(model)\nidentifier = helper.getIdentifier(model)\nprovider = helper.getProvider(model)\nconfig = TableViewSessionConfig(identifier + '_session', provider, identifier=identifier)\nreturn config.getValue()", "helper = self._getHelper(model)\nidentifier...
<|body_start_0|> helper = self._getHelper(model) metadata = helper.getMetadata(model) identifier = helper.getIdentifier(model) provider = helper.getProvider(model) config = TableViewSessionConfig(identifier + '_session', provider, identifier=identifier) return config.getV...
DataFetcher
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataFetcher: def getTableValue(self, model, offset=None, limit=None, foreignKeyFieldLabels={}): """getTableValue(model) --> SQLAlchemy result rows gets a set of results for a given model xxx: limit and offset are currently not employed Arguments: name type Description model class sqlalch...
stack_v2_sparse_classes_36k_train_002005
21,675
no_license
[ { "docstring": "getTableValue(model) --> SQLAlchemy result rows gets a set of results for a given model xxx: limit and offset are currently not employed Arguments: name type Description model class sqlalchemy mapped class definition", "name": "getTableValue", "signature": "def getTableValue(self, model,...
2
null
Implement the Python class `DataFetcher` described below. Class description: Implement the DataFetcher class. Method signatures and docstrings: - def getTableValue(self, model, offset=None, limit=None, foreignKeyFieldLabels={}): getTableValue(model) --> SQLAlchemy result rows gets a set of results for a given model x...
Implement the Python class `DataFetcher` described below. Class description: Implement the DataFetcher class. Method signatures and docstrings: - def getTableValue(self, model, offset=None, limit=None, foreignKeyFieldLabels={}): getTableValue(model) --> SQLAlchemy result rows gets a set of results for a given model x...
971b9c3eb8ca941d1797bb4b458f275bdca5a2cb
<|skeleton|> class DataFetcher: def getTableValue(self, model, offset=None, limit=None, foreignKeyFieldLabels={}): """getTableValue(model) --> SQLAlchemy result rows gets a set of results for a given model xxx: limit and offset are currently not employed Arguments: name type Description model class sqlalch...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DataFetcher: def getTableValue(self, model, offset=None, limit=None, foreignKeyFieldLabels={}): """getTableValue(model) --> SQLAlchemy result rows gets a set of results for a given model xxx: limit and offset are currently not employed Arguments: name type Description model class sqlalchemy mapped cla...
the_stack_v2_python_sparse
dbsprockets/dbsprockets/primitives.py
arianepaola/tg2jython
train
1
10a26751cc45b639cc93191ec65dceb456dc96fa
[ "ComponentWrapper.__init__(self, tag, xmldoc, tarsqi_instance)\nself.component_name = GUTIME\nself.btime = BTime()\nself.DIR_GUTIME = TTK_ROOT + os.sep + 'components' + os.sep + 'gutime'\nself.CREATION_EXTENSION = 'gut.i.xml'\nself.TMP1_EXTENSION = 'gut.t1.xml'\nself.TMP2_EXTENSION = 'gut.t2.xml'\nself.RETRIEVAL_EX...
<|body_start_0|> ComponentWrapper.__init__(self, tag, xmldoc, tarsqi_instance) self.component_name = GUTIME self.btime = BTime() self.DIR_GUTIME = TTK_ROOT + os.sep + 'components' + os.sep + 'gutime' self.CREATION_EXTENSION = 'gut.i.xml' self.TMP1_EXTENSION = 'gut.t1.xml'...
Wrapper for GUTime. See ComponentWrapper for more details on how component wrappers work. Instance variables DIR_GUTIME - directry where the GUTime code lives see ComponentWrapper for other variables.
GUTimeWrapper
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GUTimeWrapper: """Wrapper for GUTime. See ComponentWrapper for more details on how component wrappers work. Instance variables DIR_GUTIME - directry where the GUTime code lives see ComponentWrapper for other variables.""" def __init__(self, tag, xmldoc, tarsqi_instance): """Calls __i...
stack_v2_sparse_classes_36k_train_002006
2,288
no_license
[ { "docstring": "Calls __init__ of the base class and sets component_name, DIR_GUTIME, CREATION_EXTENSION and RETRIEVAL_EXTENSION.", "name": "__init__", "signature": "def __init__(self, tag, xmldoc, tarsqi_instance)" }, { "docstring": "Calls, for each fragment, the Perl scripts that implement GUT...
2
null
Implement the Python class `GUTimeWrapper` described below. Class description: Wrapper for GUTime. See ComponentWrapper for more details on how component wrappers work. Instance variables DIR_GUTIME - directry where the GUTime code lives see ComponentWrapper for other variables. Method signatures and docstrings: - de...
Implement the Python class `GUTimeWrapper` described below. Class description: Wrapper for GUTime. See ComponentWrapper for more details on how component wrappers work. Instance variables DIR_GUTIME - directry where the GUTime code lives see ComponentWrapper for other variables. Method signatures and docstrings: - de...
efb55fa054e2313fd710939330a4fbda5634cb41
<|skeleton|> class GUTimeWrapper: """Wrapper for GUTime. See ComponentWrapper for more details on how component wrappers work. Instance variables DIR_GUTIME - directry where the GUTime code lives see ComponentWrapper for other variables.""" def __init__(self, tag, xmldoc, tarsqi_instance): """Calls __i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GUTimeWrapper: """Wrapper for GUTime. See ComponentWrapper for more details on how component wrappers work. Instance variables DIR_GUTIME - directry where the GUTime code lives see ComponentWrapper for other variables.""" def __init__(self, tag, xmldoc, tarsqi_instance): """Calls __init__ of the ...
the_stack_v2_python_sparse
code/components/gutime/wrapper.py
tankle/TARSQI
train
1
5233f8f4300c916a7730fd5d82b380c62cabd9bb
[ "portal_types = getToolByName(self.context, 'portal_types')\ntransaction = self.context\nentries = transaction.entries()\nif not transaction.canUndoOrReverse():\n raise AccessControl_Unauthorized('No permission to create transactionentries, or there are no entries to reverse')\ntransaction_folder = transaction.g...
<|body_start_0|> portal_types = getToolByName(self.context, 'portal_types') transaction = self.context entries = transaction.entries() if not transaction.canUndoOrReverse(): raise AccessControl_Unauthorized('No permission to create transactionentries, or there are no entries ...
Transaction
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Transaction: def reverse_transaction(self): """Reverse a transaction - create a debit for a credit and a credit for a debit for each transaction entry""" <|body_0|> def undo_transaction(self): """Undo a transaction - remove the reference to the transaction, and do a ...
stack_v2_sparse_classes_36k_train_002007
2,892
no_license
[ { "docstring": "Reverse a transaction - create a debit for a credit and a credit for a debit for each transaction entry", "name": "reverse_transaction", "signature": "def reverse_transaction(self)" }, { "docstring": "Undo a transaction - remove the reference to the transaction, and do a debit/cr...
2
stack_v2_sparse_classes_30k_test_000730
Implement the Python class `Transaction` described below. Class description: Implement the Transaction class. Method signatures and docstrings: - def reverse_transaction(self): Reverse a transaction - create a debit for a credit and a credit for a debit for each transaction entry - def undo_transaction(self): Undo a ...
Implement the Python class `Transaction` described below. Class description: Implement the Transaction class. Method signatures and docstrings: - def reverse_transaction(self): Reverse a transaction - create a debit for a credit and a credit for a debit for each transaction entry - def undo_transaction(self): Undo a ...
77abccb6f7454f09a11e17841ba2049d4f11915c
<|skeleton|> class Transaction: def reverse_transaction(self): """Reverse a transaction - create a debit for a credit and a credit for a debit for each transaction entry""" <|body_0|> def undo_transaction(self): """Undo a transaction - remove the reference to the transaction, and do a ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Transaction: def reverse_transaction(self): """Reverse a transaction - create a debit for a credit and a credit for a debit for each transaction entry""" portal_types = getToolByName(self.context, 'portal_types') transaction = self.context entries = transaction.entries() ...
the_stack_v2_python_sparse
Products/UpfrontAccounting/browser/transaction.py
rochecompaan/Products.UpfrontAccounting
train
0
329c87cb4e874d5aaa281b7afd07ba72a0709dee
[ "header('Content-Type', 'application/json')\ntry:\n attribs = list_account_attributes(account, vo=ctx.env.get('vo'))\nexcept AccountNotFound as error:\n raise generate_http_error(404, 'AccountNotFound', error.args[0])\nexcept RucioException as error:\n raise generate_http_error(500, error.__class__.__name_...
<|body_start_0|> header('Content-Type', 'application/json') try: attribs = list_account_attributes(account, vo=ctx.env.get('vo')) except AccountNotFound as error: raise generate_http_error(404, 'AccountNotFound', error.args[0]) except RucioException as error: ...
Attributes
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Attributes: def GET(self, account): """list all attributes for an account. HTTP Success: 200 OK HTTP Error: 401 Unauthorized 404 Not Found 406 Not Acceptable 500 InternalError :param Rucio-Account: Account identifier. :param Rucio-Auth-Token: as an 32 character hex string. :returns: JSON...
stack_v2_sparse_classes_36k_train_002008
27,871
permissive
[ { "docstring": "list all attributes for an account. HTTP Success: 200 OK HTTP Error: 401 Unauthorized 404 Not Found 406 Not Acceptable 500 InternalError :param Rucio-Account: Account identifier. :param Rucio-Auth-Token: as an 32 character hex string. :returns: JSON dict containing informations about the request...
3
null
Implement the Python class `Attributes` described below. Class description: Implement the Attributes class. Method signatures and docstrings: - def GET(self, account): list all attributes for an account. HTTP Success: 200 OK HTTP Error: 401 Unauthorized 404 Not Found 406 Not Acceptable 500 InternalError :param Rucio-...
Implement the Python class `Attributes` described below. Class description: Implement the Attributes class. Method signatures and docstrings: - def GET(self, account): list all attributes for an account. HTTP Success: 200 OK HTTP Error: 401 Unauthorized 404 Not Found 406 Not Acceptable 500 InternalError :param Rucio-...
bf33d9441d3b4ff160a392eed56724f635a03fe6
<|skeleton|> class Attributes: def GET(self, account): """list all attributes for an account. HTTP Success: 200 OK HTTP Error: 401 Unauthorized 404 Not Found 406 Not Acceptable 500 InternalError :param Rucio-Account: Account identifier. :param Rucio-Auth-Token: as an 32 character hex string. :returns: JSON...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Attributes: def GET(self, account): """list all attributes for an account. HTTP Success: 200 OK HTTP Error: 401 Unauthorized 404 Not Found 406 Not Acceptable 500 InternalError :param Rucio-Account: Account identifier. :param Rucio-Auth-Token: as an 32 character hex string. :returns: JSON dict containi...
the_stack_v2_python_sparse
lib/rucio/web/rest/webpy/v1/account.py
viveknigam3003/rucio
train
1
57c970e2a82aaaaff91bf95c5fd01279f12e18fe
[ "res = []\nfor each in A:\n tem = []\n for each_char in each[::-1]:\n if each_char == 1:\n tem.append(0)\n else:\n tem.append(1)\n res.append(tem)\nreturn res", "res = []\nfor each in A:\n tem = []\n for each_char in each[::-1]:\n tem.append(1 - each_char)...
<|body_start_0|> res = [] for each in A: tem = [] for each_char in each[::-1]: if each_char == 1: tem.append(0) else: tem.append(1) res.append(tem) return res <|end_body_0|> <|body_start_...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def flipAndInvertImage(self, A): """:type A: List[List[int]] :rtype: List[List[int]]""" <|body_0|> def flipAndInvertImage2(self, A): """:type A: List[List[int]] :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|> <|body_start_0|> res = ...
stack_v2_sparse_classes_36k_train_002009
804
no_license
[ { "docstring": ":type A: List[List[int]] :rtype: List[List[int]]", "name": "flipAndInvertImage", "signature": "def flipAndInvertImage(self, A)" }, { "docstring": ":type A: List[List[int]] :rtype: List[List[int]]", "name": "flipAndInvertImage2", "signature": "def flipAndInvertImage2(self,...
2
stack_v2_sparse_classes_30k_train_020656
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def flipAndInvertImage(self, A): :type A: List[List[int]] :rtype: List[List[int]] - def flipAndInvertImage2(self, A): :type A: List[List[int]] :rtype: List[List[int]]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def flipAndInvertImage(self, A): :type A: List[List[int]] :rtype: List[List[int]] - def flipAndInvertImage2(self, A): :type A: List[List[int]] :rtype: List[List[int]] <|skeleton...
4105e18050b15fc0409c75353ad31be17187dd34
<|skeleton|> class Solution: def flipAndInvertImage(self, A): """:type A: List[List[int]] :rtype: List[List[int]]""" <|body_0|> def flipAndInvertImage2(self, A): """:type A: List[List[int]] :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def flipAndInvertImage(self, A): """:type A: List[List[int]] :rtype: List[List[int]]""" res = [] for each in A: tem = [] for each_char in each[::-1]: if each_char == 1: tem.append(0) else: ...
the_stack_v2_python_sparse
flipAndInvertImage.py
NeilWangziyu/Leetcode_py
train
2
6efb806b9601b23d2f453ec8c499bc54667f950d
[ "super().__init__()\nstate_dim = descript.get('state_dim')\naction_dim = descript.get('action_dim')\nself.back_bone = ImpalaCnnBackBone(**descript)\nself.fc2 = Sequential(Linear(256, action_dim), Lambda(lambda x: softmax(x)))\nself.fc3 = Sequential(Linear(256, 1))", "outputs = []\nback_bone_output = self.back_bon...
<|body_start_0|> super().__init__() state_dim = descript.get('state_dim') action_dim = descript.get('action_dim') self.back_bone = ImpalaCnnBackBone(**descript) self.fc2 = Sequential(Linear(256, action_dim), Lambda(lambda x: softmax(x))) self.fc3 = Sequential(Linear(256, ...
Create DQN net with FineGrainedSpace.
ImpalaCnnNet
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImpalaCnnNet: """Create DQN net with FineGrainedSpace.""" def __init__(self, **descript): """Create layers.""" <|body_0|> def __call__(self, inputs): """Override compile function, conect models into a seq.""" <|body_1|> <|end_skeleton|> <|body_start_0|>...
stack_v2_sparse_classes_36k_train_002010
4,926
permissive
[ { "docstring": "Create layers.", "name": "__init__", "signature": "def __init__(self, **descript)" }, { "docstring": "Override compile function, conect models into a seq.", "name": "__call__", "signature": "def __call__(self, inputs)" } ]
2
null
Implement the Python class `ImpalaCnnNet` described below. Class description: Create DQN net with FineGrainedSpace. Method signatures and docstrings: - def __init__(self, **descript): Create layers. - def __call__(self, inputs): Override compile function, conect models into a seq.
Implement the Python class `ImpalaCnnNet` described below. Class description: Create DQN net with FineGrainedSpace. Method signatures and docstrings: - def __init__(self, **descript): Create layers. - def __call__(self, inputs): Override compile function, conect models into a seq. <|skeleton|> class ImpalaCnnNet: ...
e4ef3a1c92d19d1d08c3ef0e2156b6fecefdbe04
<|skeleton|> class ImpalaCnnNet: """Create DQN net with FineGrainedSpace.""" def __init__(self, **descript): """Create layers.""" <|body_0|> def __call__(self, inputs): """Override compile function, conect models into a seq.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ImpalaCnnNet: """Create DQN net with FineGrainedSpace.""" def __init__(self, **descript): """Create layers.""" super().__init__() state_dim = descript.get('state_dim') action_dim = descript.get('action_dim') self.back_bone = ImpalaCnnBackBone(**descript) se...
the_stack_v2_python_sparse
xt/model/impala/impala_cnn_zeus.py
huawei-noah/xingtian
train
308
93fcea611e99e3137b1b6047c362ac72cb988275
[ "row = g.db.query(Machine).get(machine_id)\nif not row:\n log.warning('Requested a non-existant machine: %s', machine_id)\n abort(http_client.NOT_FOUND, description='Machine not found')\nrecord = row.as_dict()\nrecord['url'] = url_for('machines.entry', machine_id=machine_id, _external=True)\nrecord['servers_u...
<|body_start_0|> row = g.db.query(Machine).get(machine_id) if not row: log.warning('Requested a non-existant machine: %s', machine_id) abort(http_client.NOT_FOUND, description='Machine not found') record = row.as_dict() record['url'] = url_for('machines.entry', ma...
Information about specific machines
MachineAPI
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MachineAPI: """Information about specific machines""" def get(self, machine_id): """Find machine by ID Get information about a single battle server machine. Just dumps out the DB row as json""" <|body_0|> def put(self, machine_id): """Update machine Heartbeat and...
stack_v2_sparse_classes_36k_train_002011
8,672
permissive
[ { "docstring": "Find machine by ID Get information about a single battle server machine. Just dumps out the DB row as json", "name": "get", "signature": "def get(self, machine_id)" }, { "docstring": "Update machine Heartbeat and update the machine reference", "name": "put", "signature": ...
2
stack_v2_sparse_classes_30k_train_019996
Implement the Python class `MachineAPI` described below. Class description: Information about specific machines Method signatures and docstrings: - def get(self, machine_id): Find machine by ID Get information about a single battle server machine. Just dumps out the DB row as json - def put(self, machine_id): Update ...
Implement the Python class `MachineAPI` described below. Class description: Information about specific machines Method signatures and docstrings: - def get(self, machine_id): Find machine by ID Get information about a single battle server machine. Just dumps out the DB row as json - def put(self, machine_id): Update ...
9825cb22b26b577b715f2ce95453363bf90ecc7e
<|skeleton|> class MachineAPI: """Information about specific machines""" def get(self, machine_id): """Find machine by ID Get information about a single battle server machine. Just dumps out the DB row as json""" <|body_0|> def put(self, machine_id): """Update machine Heartbeat and...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MachineAPI: """Information about specific machines""" def get(self, machine_id): """Find machine by ID Get information about a single battle server machine. Just dumps out the DB row as json""" row = g.db.query(Machine).get(machine_id) if not row: log.warning('Requeste...
the_stack_v2_python_sparse
driftbase/api/machines.py
dgnorth/drift-base
train
1
6699e3211bd2c2abd756e6fad07c9eaf6847f2c5
[ "if instance.author is None:\n return None\nif 'users' in self.context:\n return self.context['users'].get(instance.author.name)\nelse:\n return User.objects.filter(username=instance.author.name).select_related('profile').first()", "try:\n return self._get_user(instance).profile\nexcept (AttributeErro...
<|body_start_0|> if instance.author is None: return None if 'users' in self.context: return self.context['users'].get(instance.author.name) else: return User.objects.filter(username=instance.author.name).select_related('profile').first() <|end_body_0|> <|body...
Serializer class for reddit objects (posts, comments)
RedditObjectSerializer
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RedditObjectSerializer: """Serializer class for reddit objects (posts, comments)""" def _get_user(self, instance): """Look up user in the context from the post author Args: instance (praw.models.Submission): The post to look up the user for""" <|body_0|> def _get_profile...
stack_v2_sparse_classes_36k_train_002012
1,314
permissive
[ { "docstring": "Look up user in the context from the post author Args: instance (praw.models.Submission): The post to look up the user for", "name": "_get_user", "signature": "def _get_user(self, instance)" }, { "docstring": "Return a user profile if it exists, else None Args: instance (praw.mod...
2
null
Implement the Python class `RedditObjectSerializer` described below. Class description: Serializer class for reddit objects (posts, comments) Method signatures and docstrings: - def _get_user(self, instance): Look up user in the context from the post author Args: instance (praw.models.Submission): The post to look up...
Implement the Python class `RedditObjectSerializer` described below. Class description: Serializer class for reddit objects (posts, comments) Method signatures and docstrings: - def _get_user(self, instance): Look up user in the context from the post author Args: instance (praw.models.Submission): The post to look up...
ba7442482da97d463302658c0aac989567ee1241
<|skeleton|> class RedditObjectSerializer: """Serializer class for reddit objects (posts, comments)""" def _get_user(self, instance): """Look up user in the context from the post author Args: instance (praw.models.Submission): The post to look up the user for""" <|body_0|> def _get_profile...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RedditObjectSerializer: """Serializer class for reddit objects (posts, comments)""" def _get_user(self, instance): """Look up user in the context from the post author Args: instance (praw.models.Submission): The post to look up the user for""" if instance.author is None: retur...
the_stack_v2_python_sparse
channels/serializers/base.py
mitodl/open-discussions
train
13
1f61e0ed43d06a9ba910a30e0ad30565dac62fc1
[ "if namespace is None:\n self.use_main_ns = 1\nelse:\n self.use_main_ns = 0\n self.namespace = namespace\nif global_namespace is None:\n self.global_namespace = {}\nelse:\n self.global_namespace = global_namespace\nsuper(Completer, self).__init__(**kwargs)", "if self.use_main_ns:\n self.namespac...
<|body_start_0|> if namespace is None: self.use_main_ns = 1 else: self.use_main_ns = 0 self.namespace = namespace if global_namespace is None: self.global_namespace = {} else: self.global_namespace = global_namespace sup...
Completer
[ "BSD-3-Clause", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Completer: def __init__(self, namespace=None, global_namespace=None, **kwargs): """Create a new completer for the command line. Completer(namespace=ns, global_namespace=ns2) -> completer instance. If unspecified, the default namespace where completions are performed is __main__ (technica...
stack_v2_sparse_classes_36k_train_002013
42,482
permissive
[ { "docstring": "Create a new completer for the command line. Completer(namespace=ns, global_namespace=ns2) -> completer instance. If unspecified, the default namespace where completions are performed is __main__ (technically, __main__.__dict__). Namespaces should be given as dictionaries. An optional second nam...
4
null
Implement the Python class `Completer` described below. Class description: Implement the Completer class. Method signatures and docstrings: - def __init__(self, namespace=None, global_namespace=None, **kwargs): Create a new completer for the command line. Completer(namespace=ns, global_namespace=ns2) -> completer ins...
Implement the Python class `Completer` described below. Class description: Implement the Completer class. Method signatures and docstrings: - def __init__(self, namespace=None, global_namespace=None, **kwargs): Create a new completer for the command line. Completer(namespace=ns, global_namespace=ns2) -> completer ins...
f5042e35b945aded77b23470ead62d7eacefde92
<|skeleton|> class Completer: def __init__(self, namespace=None, global_namespace=None, **kwargs): """Create a new completer for the command line. Completer(namespace=ns, global_namespace=ns2) -> completer instance. If unspecified, the default namespace where completions are performed is __main__ (technica...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Completer: def __init__(self, namespace=None, global_namespace=None, **kwargs): """Create a new completer for the command line. Completer(namespace=ns, global_namespace=ns2) -> completer instance. If unspecified, the default namespace where completions are performed is __main__ (technically, __main__....
the_stack_v2_python_sparse
contrib/python/ipython/py2/IPython/core/completer.py
catboost/catboost
train
8,012
7c7471a52f98172edc9172da3e1782b9bfa80fc9
[ "if not root:\n return []\ndata = []\nqueue = deque()\nqueue.append(root)\nwhile queue:\n node = queue.popleft()\n if not node:\n data.append('#')\n continue\n data.append(node.val)\n queue.append(node.left)\n queue.append(node.right)\nwhile data[-1] == '#':\n data.pop()\nreturn d...
<|body_start_0|> if not root: return [] data = [] queue = deque() queue.append(root) while queue: node = queue.popleft() if not node: data.append('#') continue data.append(node.val) queue....
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_002014
1,914
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_train_015530
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
b75b06fa1551f5e4d8a559ef64e1ac29db79c083
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" if not root: return [] data = [] queue = deque() queue.append(root) while queue: node = queue.popleft() if not node: ...
the_stack_v2_python_sparse
Python/297.py
arnabs542/Leetcode-38
train
0
83f48c6325f84d5f3ee91a6ce30059010c9c5402
[ "if count_tag in self.tagnames and self.length:\n return float(self.get(count_tag)) / (self.length - unit_length + 1)\nelse:\n return None", "c = self.coverage(count_tag=count_tag, unit_length=unit_length)\nif c is None:\n self.try_get_length()\n raise gfapy.NotFoundError('Tag {} undefined for segment...
<|body_start_0|> if count_tag in self.tagnames and self.length: return float(self.get(count_tag)) / (self.length - unit_length + 1) else: return None <|end_body_0|> <|body_start_1|> c = self.coverage(count_tag=count_tag, unit_length=unit_length) if c is None: ...
Coverage
[ "ISC" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Coverage: def coverage(self, count_tag='RC', unit_length=1): """Compute the coverage from the value a count_tag (RC, KC or FC). If unit_length is provided then: count/(length-unit_length+1), otherwise: count/length. The latter is a good approximation if length >>> unit_length. Parameters...
stack_v2_sparse_classes_36k_train_002015
1,226
permissive
[ { "docstring": "Compute the coverage from the value a count_tag (RC, KC or FC). If unit_length is provided then: count/(length-unit_length+1), otherwise: count/length. The latter is a good approximation if length >>> unit_length. Parameters: count_tag (str): integer tag from which the count shall be taken (defa...
2
stack_v2_sparse_classes_30k_train_016126
Implement the Python class `Coverage` described below. Class description: Implement the Coverage class. Method signatures and docstrings: - def coverage(self, count_tag='RC', unit_length=1): Compute the coverage from the value a count_tag (RC, KC or FC). If unit_length is provided then: count/(length-unit_length+1), ...
Implement the Python class `Coverage` described below. Class description: Implement the Coverage class. Method signatures and docstrings: - def coverage(self, count_tag='RC', unit_length=1): Compute the coverage from the value a count_tag (RC, KC or FC). If unit_length is provided then: count/(length-unit_length+1), ...
12b31daac26ab137b6ee4a29b4f14554ba962dcb
<|skeleton|> class Coverage: def coverage(self, count_tag='RC', unit_length=1): """Compute the coverage from the value a count_tag (RC, KC or FC). If unit_length is provided then: count/(length-unit_length+1), otherwise: count/length. The latter is a good approximation if length >>> unit_length. Parameters...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Coverage: def coverage(self, count_tag='RC', unit_length=1): """Compute the coverage from the value a count_tag (RC, KC or FC). If unit_length is provided then: count/(length-unit_length+1), otherwise: count/length. The latter is a good approximation if length >>> unit_length. Parameters: count_tag (s...
the_stack_v2_python_sparse
gfapy/line/segment/coverage.py
ggonnella/gfapy
train
63
03d427f92bf9b5b55d19e59fd55729241db995a1
[ "excluded_ports = set(['TruePort', 'FalsePort', 'TrueOutputPorts', 'FalseOutputPorts'])\nfor port_name, connector_list in self.inputPorts.iteritems():\n if port_name not in excluded_ports:\n for connector in connector_list:\n connector.obj.update()\nfor port_name, connectorList in copy.copy(sel...
<|body_start_0|> excluded_ports = set(['TruePort', 'FalsePort', 'TrueOutputPorts', 'FalseOutputPorts']) for port_name, connector_list in self.inputPorts.iteritems(): if port_name not in excluded_ports: for connector in connector_list: connector.obj.update(...
The If Module alows the user to choose the part of the workflow to be executed through the use of a condition.
If
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class If: """The If Module alows the user to choose the part of the workflow to be executed through the use of a condition.""" def update_upstream(self): """A modified version of the update_upstream method.""" <|body_0|> def compute(self): """The compute method for the...
stack_v2_sparse_classes_36k_train_002016
7,772
permissive
[ { "docstring": "A modified version of the update_upstream method.", "name": "update_upstream", "signature": "def update_upstream(self)" }, { "docstring": "The compute method for the If module.", "name": "compute", "signature": "def compute(self)" } ]
2
stack_v2_sparse_classes_30k_train_007030
Implement the Python class `If` described below. Class description: The If Module alows the user to choose the part of the workflow to be executed through the use of a condition. Method signatures and docstrings: - def update_upstream(self): A modified version of the update_upstream method. - def compute(self): The c...
Implement the Python class `If` described below. Class description: The If Module alows the user to choose the part of the workflow to be executed through the use of a condition. Method signatures and docstrings: - def update_upstream(self): A modified version of the update_upstream method. - def compute(self): The c...
93f1e5d375ee1e870f9bad699a22c9aafb954090
<|skeleton|> class If: """The If Module alows the user to choose the part of the workflow to be executed through the use of a condition.""" def update_upstream(self): """A modified version of the update_upstream method.""" <|body_0|> def compute(self): """The compute method for the...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class If: """The If Module alows the user to choose the part of the workflow to be executed through the use of a condition.""" def update_upstream(self): """A modified version of the update_upstream method.""" excluded_ports = set(['TruePort', 'FalsePort', 'TrueOutputPorts', 'FalseOutputPorts']...
the_stack_v2_python_sparse
vistrails/packages/controlflow/conditional.py
alexmavr/VisTrails
train
1
3f52819330afb8b9673a77a64adad90e525075a2
[ "super().__init__()\nstate_dim = descript.get('state_dim')\naction_dim = descript.get('action_dim')\nself.fc2 = Sequential(Linear(state_dim, HIDDEN_SIZE), Linear(HIDDEN_SIZE, action_dim), Lambda(lambda x: softmax(x)))\nself.fc3 = Sequential(Linear(state_dim, HIDDEN_SIZE), Linear(HIDDEN_SIZE, 1))", "outputs = []\n...
<|body_start_0|> super().__init__() state_dim = descript.get('state_dim') action_dim = descript.get('action_dim') self.fc2 = Sequential(Linear(state_dim, HIDDEN_SIZE), Linear(HIDDEN_SIZE, action_dim), Lambda(lambda x: softmax(x))) self.fc3 = Sequential(Linear(state_dim, HIDDEN_SI...
Create DQN net with FineGrainedSpace.
ImpalaMlpNet
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImpalaMlpNet: """Create DQN net with FineGrainedSpace.""" def __init__(self, **descript): """Create layers.""" <|body_0|> def __call__(self, inputs): """Override compile function, conect models into a seq.""" <|body_1|> <|end_skeleton|> <|body_start_0|>...
stack_v2_sparse_classes_36k_train_002017
5,106
permissive
[ { "docstring": "Create layers.", "name": "__init__", "signature": "def __init__(self, **descript)" }, { "docstring": "Override compile function, conect models into a seq.", "name": "__call__", "signature": "def __call__(self, inputs)" } ]
2
stack_v2_sparse_classes_30k_train_011872
Implement the Python class `ImpalaMlpNet` described below. Class description: Create DQN net with FineGrainedSpace. Method signatures and docstrings: - def __init__(self, **descript): Create layers. - def __call__(self, inputs): Override compile function, conect models into a seq.
Implement the Python class `ImpalaMlpNet` described below. Class description: Create DQN net with FineGrainedSpace. Method signatures and docstrings: - def __init__(self, **descript): Create layers. - def __call__(self, inputs): Override compile function, conect models into a seq. <|skeleton|> class ImpalaMlpNet: ...
e4ef3a1c92d19d1d08c3ef0e2156b6fecefdbe04
<|skeleton|> class ImpalaMlpNet: """Create DQN net with FineGrainedSpace.""" def __init__(self, **descript): """Create layers.""" <|body_0|> def __call__(self, inputs): """Override compile function, conect models into a seq.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ImpalaMlpNet: """Create DQN net with FineGrainedSpace.""" def __init__(self, **descript): """Create layers.""" super().__init__() state_dim = descript.get('state_dim') action_dim = descript.get('action_dim') self.fc2 = Sequential(Linear(state_dim, HIDDEN_SIZE), Lin...
the_stack_v2_python_sparse
xt/model/impala/impala_mlp_zeus.py
huawei-noah/xingtian
train
308
62b9c5a4aee2982a60f53f8d0ae5a22d75dfcd97
[ "if target < nums[0]:\n return 0\nelif target > nums[-1]:\n return len(nums)\nelse:\n for index, num in enumerate(nums):\n if target == num:\n return index\n elif num < target < nums[index + 1]:\n return index + 1", "left = 0\nright = len(nums)\nif target > nums[-1]:\n...
<|body_start_0|> if target < nums[0]: return 0 elif target > nums[-1]: return len(nums) else: for index, num in enumerate(nums): if target == num: return index elif num < target < nums[index + 1]: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def searchInsert_1(self, nums, target): """暴力法查找,一个一个比对 :param nums: 排序数组 :param target: 目标值 :return: 目标值插入排序数组的索引位置""" <|body_0|> def searchInsert_2(self, nums, target): """看到已知数组是排序数组时,要立刻想到使用二分查找来解决。 首先确定搜索空间,返回的索引取值范围为[0, len(nums)] 因此left = 0, right = ...
stack_v2_sparse_classes_36k_train_002018
2,156
no_license
[ { "docstring": "暴力法查找,一个一个比对 :param nums: 排序数组 :param target: 目标值 :return: 目标值插入排序数组的索引位置", "name": "searchInsert_1", "signature": "def searchInsert_1(self, nums, target)" }, { "docstring": "看到已知数组是排序数组时,要立刻想到使用二分查找来解决。 首先确定搜索空间,返回的索引取值范围为[0, len(nums)] 因此left = 0, right = len(nums) 再看空间收缩,因为当 n...
2
stack_v2_sparse_classes_30k_train_005474
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def searchInsert_1(self, nums, target): 暴力法查找,一个一个比对 :param nums: 排序数组 :param target: 目标值 :return: 目标值插入排序数组的索引位置 - def searchInsert_2(self, nums, target): 看到已知数组是排序数组时,要立刻想到使用二分...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def searchInsert_1(self, nums, target): 暴力法查找,一个一个比对 :param nums: 排序数组 :param target: 目标值 :return: 目标值插入排序数组的索引位置 - def searchInsert_2(self, nums, target): 看到已知数组是排序数组时,要立刻想到使用二分...
746d77e9bfbcb3877fefae9a915004b3bfbcc612
<|skeleton|> class Solution: def searchInsert_1(self, nums, target): """暴力法查找,一个一个比对 :param nums: 排序数组 :param target: 目标值 :return: 目标值插入排序数组的索引位置""" <|body_0|> def searchInsert_2(self, nums, target): """看到已知数组是排序数组时,要立刻想到使用二分查找来解决。 首先确定搜索空间,返回的索引取值范围为[0, len(nums)] 因此left = 0, right = ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def searchInsert_1(self, nums, target): """暴力法查找,一个一个比对 :param nums: 排序数组 :param target: 目标值 :return: 目标值插入排序数组的索引位置""" if target < nums[0]: return 0 elif target > nums[-1]: return len(nums) else: for index, num in enumerate(nums): ...
the_stack_v2_python_sparse
LeetCode/Array/035.搜索插入位置.py
leilalu/algorithm
train
0
13a255bc4b33d9542506d49d00c577abeb81950c
[ "self.wan_enabled = wan_enabled\nself.using_static_ip = using_static_ip\nself.static_ip = static_ip\nself.static_gateway_ip = static_gateway_ip\nself.static_subnet_mask = static_subnet_mask\nself.static_dns = static_dns\nself.vlan = vlan", "if dictionary is None:\n return None\nwan_enabled = dictionary.get('wa...
<|body_start_0|> self.wan_enabled = wan_enabled self.using_static_ip = using_static_ip self.static_ip = static_ip self.static_gateway_ip = static_gateway_ip self.static_subnet_mask = static_subnet_mask self.static_dns = static_dns self.vlan = vlan <|end_body_0|> ...
Implementation of the 'Wan2' model. WAN 2 settings (only for MX devices) Attributes: wan_enabled (WanEnabledEnum): Enable or disable the interface (only for MX devices). Valid values are 'enabled', 'disabled', and 'not configured'. using_static_ip (bool): Configue the interface to have static IP settings or use DHCP. s...
Wan2Model
[ "MIT", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Wan2Model: """Implementation of the 'Wan2' model. WAN 2 settings (only for MX devices) Attributes: wan_enabled (WanEnabledEnum): Enable or disable the interface (only for MX devices). Valid values are 'enabled', 'disabled', and 'not configured'. using_static_ip (bool): Configue the interface to h...
stack_v2_sparse_classes_36k_train_002019
3,300
permissive
[ { "docstring": "Constructor for the Wan2Model class", "name": "__init__", "signature": "def __init__(self, wan_enabled=None, using_static_ip=None, static_ip=None, static_gateway_ip=None, static_subnet_mask=None, static_dns=None, vlan=None)" }, { "docstring": "Creates an instance of this model fr...
2
stack_v2_sparse_classes_30k_train_020137
Implement the Python class `Wan2Model` described below. Class description: Implementation of the 'Wan2' model. WAN 2 settings (only for MX devices) Attributes: wan_enabled (WanEnabledEnum): Enable or disable the interface (only for MX devices). Valid values are 'enabled', 'disabled', and 'not configured'. using_static...
Implement the Python class `Wan2Model` described below. Class description: Implementation of the 'Wan2' model. WAN 2 settings (only for MX devices) Attributes: wan_enabled (WanEnabledEnum): Enable or disable the interface (only for MX devices). Valid values are 'enabled', 'disabled', and 'not configured'. using_static...
9894089eb013318243ae48869cc5130eb37f80c0
<|skeleton|> class Wan2Model: """Implementation of the 'Wan2' model. WAN 2 settings (only for MX devices) Attributes: wan_enabled (WanEnabledEnum): Enable or disable the interface (only for MX devices). Valid values are 'enabled', 'disabled', and 'not configured'. using_static_ip (bool): Configue the interface to h...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Wan2Model: """Implementation of the 'Wan2' model. WAN 2 settings (only for MX devices) Attributes: wan_enabled (WanEnabledEnum): Enable or disable the interface (only for MX devices). Valid values are 'enabled', 'disabled', and 'not configured'. using_static_ip (bool): Configue the interface to have static IP...
the_stack_v2_python_sparse
meraki_sdk/models/wan_2_model.py
RaulCatalano/meraki-python-sdk
train
1
05c5fe1fe2b74159c6c4a1de8c0207c866e8d42c
[ "if self.request.method in ['POST', 'PUT', 'DELETE', 'PATCH']:\n self.permission_classes = [Isauthenticatedstaff]\nelse:\n self.permission_classes = [IsAuthenticated]\nreturn super(InventoryViewset, self).get_permissions()", "depth = self.request.query_params.get('depth', '')\nif depth != '' and depth != 'n...
<|body_start_0|> if self.request.method in ['POST', 'PUT', 'DELETE', 'PATCH']: self.permission_classes = [Isauthenticatedstaff] else: self.permission_classes = [IsAuthenticated] return super(InventoryViewset, self).get_permissions() <|end_body_0|> <|body_start_1|> ...
InventoryViewset
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InventoryViewset: def get_permissions(self): """permissions based on the user logged-in :return: permission class""" <|body_0|> def list(self, request, *args, **kwargs): """Select the serealizer class used based on the depth query parameter provided in api call. :par...
stack_v2_sparse_classes_36k_train_002020
3,781
no_license
[ { "docstring": "permissions based on the user logged-in :return: permission class", "name": "get_permissions", "signature": "def get_permissions(self)" }, { "docstring": "Select the serealizer class used based on the depth query parameter provided in api call. :param request: :param args: :param...
2
stack_v2_sparse_classes_30k_train_018541
Implement the Python class `InventoryViewset` described below. Class description: Implement the InventoryViewset class. Method signatures and docstrings: - def get_permissions(self): permissions based on the user logged-in :return: permission class - def list(self, request, *args, **kwargs): Select the serealizer cla...
Implement the Python class `InventoryViewset` described below. Class description: Implement the InventoryViewset class. Method signatures and docstrings: - def get_permissions(self): permissions based on the user logged-in :return: permission class - def list(self, request, *args, **kwargs): Select the serealizer cla...
3d44394c69ae623a4a36ca8b11b6af2b0599dce7
<|skeleton|> class InventoryViewset: def get_permissions(self): """permissions based on the user logged-in :return: permission class""" <|body_0|> def list(self, request, *args, **kwargs): """Select the serealizer class used based on the depth query parameter provided in api call. :par...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InventoryViewset: def get_permissions(self): """permissions based on the user logged-in :return: permission class""" if self.request.method in ['POST', 'PUT', 'DELETE', 'PATCH']: self.permission_classes = [Isauthenticatedstaff] else: self.permission_classes = [I...
the_stack_v2_python_sparse
api/viewsets.py
sandeep-kaushik/bakery
train
0
666eae0f22e37a21f98c9589783fb151f5bfc436
[ "self.batch_size = batch_size\nself.optimizer = optimizer\nself.loss = loss\nself.validation_split = validation_split\nself.max_sequence_length = max_sequence_length\nself.max_nb_words = max_nb_words\nself.embedding_dim = embedding_dim\nself.activation = activation\nModelNN.__init__(self, loss=loss, optimizer=optim...
<|body_start_0|> self.batch_size = batch_size self.optimizer = optimizer self.loss = loss self.validation_split = validation_split self.max_sequence_length = max_sequence_length self.max_nb_words = max_nb_words self.embedding_dim = embedding_dim self.activ...
BidirectionalLSTM
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BidirectionalLSTM: def __init__(self, loss='categorical_crossentropy', epochs=10, decay=1e-06, momentum=0.9, max_sequence_length=1000, max_nb_words=20000, embedding_dim=100, validation_split=0.2, optimizer='rmsprop', batch_size=32, activation='softmax', learning_rate=0.001, kernel_regularization...
stack_v2_sparse_classes_36k_train_002021
12,388
no_license
[ { "docstring": ":param loss: str, the name of the loss function :param epochs: int, the number of epochs :param decay: float, the decay :param momentum: float, momentum :param max_sequence_length: :param max_nb_words: :param embedding_dim: :param validation_split: float, the percentage of the validation split :...
2
stack_v2_sparse_classes_30k_val_001161
Implement the Python class `BidirectionalLSTM` described below. Class description: Implement the BidirectionalLSTM class. Method signatures and docstrings: - def __init__(self, loss='categorical_crossentropy', epochs=10, decay=1e-06, momentum=0.9, max_sequence_length=1000, max_nb_words=20000, embedding_dim=100, valid...
Implement the Python class `BidirectionalLSTM` described below. Class description: Implement the BidirectionalLSTM class. Method signatures and docstrings: - def __init__(self, loss='categorical_crossentropy', epochs=10, decay=1e-06, momentum=0.9, max_sequence_length=1000, max_nb_words=20000, embedding_dim=100, valid...
bb2f1e350140c9d34865ed77f50d4475b515ea7b
<|skeleton|> class BidirectionalLSTM: def __init__(self, loss='categorical_crossentropy', epochs=10, decay=1e-06, momentum=0.9, max_sequence_length=1000, max_nb_words=20000, embedding_dim=100, validation_split=0.2, optimizer='rmsprop', batch_size=32, activation='softmax', learning_rate=0.001, kernel_regularization...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BidirectionalLSTM: def __init__(self, loss='categorical_crossentropy', epochs=10, decay=1e-06, momentum=0.9, max_sequence_length=1000, max_nb_words=20000, embedding_dim=100, validation_split=0.2, optimizer='rmsprop', batch_size=32, activation='softmax', learning_rate=0.001, kernel_regularization_params=('l2',...
the_stack_v2_python_sparse
app/lstm.py
agromanou/text-classification-with-nn
train
0
fbea40680de29349759c2331af73f633b42a45b0
[ "try:\n self.UDPlist = UDPlist_p\n self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n self.sock.bind(('', UDP_PORT))\n hasUDP = True\nexcept socket.error:\n hasUDP = False\n print('AHF_UDPTrig failed to create a socket.')", "try:\n for address in self.UDPlist:\n self.sock.s...
<|body_start_0|> try: self.UDPlist = UDPlist_p self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) self.sock.bind(('', UDP_PORT)) hasUDP = True except socket.error: hasUDP = False print('AHF_UDPTrig failed to create a socke...
Sends/receives UDP signals as to another pi to start/stop recording AHF_UDPTrig uses the socket module to do the UDP stuff, but it should be part of the default install
AHF_UDPTrig
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AHF_UDPTrig: """Sends/receives UDP signals as to another pi to start/stop recording AHF_UDPTrig uses the socket module to do the UDP stuff, but it should be part of the default install""" def __init__(self, UDPlist_p): """Makes a new AHF_UDPtrig object using passed in list of ip addr...
stack_v2_sparse_classes_36k_train_002022
1,743
no_license
[ { "docstring": "Makes a new AHF_UDPtrig object using passed in list of ip addresses. stores UDPlist in the new object sets hasUDP to false if object creation fails because of network error, else True", "name": "__init__", "signature": "def __init__(self, UDPlist_p)" }, { "docstring": "Sends a UD...
3
stack_v2_sparse_classes_30k_train_021481
Implement the Python class `AHF_UDPTrig` described below. Class description: Sends/receives UDP signals as to another pi to start/stop recording AHF_UDPTrig uses the socket module to do the UDP stuff, but it should be part of the default install Method signatures and docstrings: - def __init__(self, UDPlist_p): Makes...
Implement the Python class `AHF_UDPTrig` described below. Class description: Sends/receives UDP signals as to another pi to start/stop recording AHF_UDPTrig uses the socket module to do the UDP stuff, but it should be part of the default install Method signatures and docstrings: - def __init__(self, UDPlist_p): Makes...
a7fa58f47cfbb92de1f6c33d003bc290f1f37d86
<|skeleton|> class AHF_UDPTrig: """Sends/receives UDP signals as to another pi to start/stop recording AHF_UDPTrig uses the socket module to do the UDP stuff, but it should be part of the default install""" def __init__(self, UDPlist_p): """Makes a new AHF_UDPtrig object using passed in list of ip addr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AHF_UDPTrig: """Sends/receives UDP signals as to another pi to start/stop recording AHF_UDPTrig uses the socket module to do the UDP stuff, but it should be part of the default install""" def __init__(self, UDPlist_p): """Makes a new AHF_UDPtrig object using passed in list of ip addresses. stores...
the_stack_v2_python_sparse
moreModules/AutoHeadFix/AHF_UDPTrig.py
ilangold/AutoHeadFix
train
0
5c1013e627c60ad40ecce004b01713bd9fa2ac39
[ "self.container = container\nself.dt = 0.001\nself.delta = 0.0\nself.sampling_period = sampling_period * self.dt\nself.previous_time = -self.sampling_period\nself.container.add(self, [0] * size_in)\nsuper(Servo, self).__init__(output=self.servo_output, size_in=1 if not size_in else size_in, label=label)", "if tim...
<|body_start_0|> self.container = container self.dt = 0.001 self.delta = 0.0 self.sampling_period = sampling_period * self.dt self.previous_time = -self.sampling_period self.container.add(self, [0] * size_in) super(Servo, self).__init__(output=self.servo_output, s...
Servo
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Servo: def __init__(self, container, size_in=None, label=None, sampling_period=15): """A motor is a type of node that sends live information back for processing. :param container: The object that receives information from the motor :type container: Container :param sampling_period: The p...
stack_v2_sparse_classes_36k_train_002023
2,039
no_license
[ { "docstring": "A motor is a type of node that sends live information back for processing. :param container: The object that receives information from the motor :type container: Container :param sampling_period: The period with which the motor sends information :type sampling_period: float or int :param dt: The...
2
stack_v2_sparse_classes_30k_train_004492
Implement the Python class `Servo` described below. Class description: Implement the Servo class. Method signatures and docstrings: - def __init__(self, container, size_in=None, label=None, sampling_period=15): A motor is a type of node that sends live information back for processing. :param container: The object tha...
Implement the Python class `Servo` described below. Class description: Implement the Servo class. Method signatures and docstrings: - def __init__(self, container, size_in=None, label=None, sampling_period=15): A motor is a type of node that sends live information back for processing. :param container: The object tha...
26e351308affcc9545562a4c9af1e2196a2b8739
<|skeleton|> class Servo: def __init__(self, container, size_in=None, label=None, sampling_period=15): """A motor is a type of node that sends live information back for processing. :param container: The object that receives information from the motor :type container: Container :param sampling_period: The p...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Servo: def __init__(self, container, size_in=None, label=None, sampling_period=15): """A motor is a type of node that sends live information back for processing. :param container: The object that receives information from the motor :type container: Container :param sampling_period: The period with whi...
the_stack_v2_python_sparse
robot_models/servo.py
mahmoodalmansooei/AlanProject
train
2
9490492a4d93aa166c741ecd31c12a35e983daa0
[ "seq = []\nif not root:\n return seq\nqueue = collections.deque([root])\nwhile queue:\n node = queue.popleft()\n if node:\n seq.append(node.val)\n queue.append(node.left)\n queue.append(node.right)\n else:\n seq.append(None)\nwhile seq[-1] is None:\n seq.pop()\nreturn seq"...
<|body_start_0|> seq = [] if not root: return seq queue = collections.deque([root]) while queue: node = queue.popleft() if node: seq.append(node.val) queue.append(node.left) queue.append(node.right) ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_002024
3,028
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_val_001144
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
2acc25fd51ccd9bee6665ada2cd78613a2283cb5
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" seq = [] if not root: return seq queue = collections.deque([root]) while queue: node = queue.popleft() if node: ...
the_stack_v2_python_sparse
serialize.py
Anewnoob/Leetcode
train
1
b8f78be36e80b18f38ff260de07d9748cec55b2b
[ "super().__init__()\nself.mode = mode\nif not isinstance(self.mode, FilterMode):\n raise ValueError(f'mode must be an instance of FilterMode: mode={mode}')\nself.py_name_set = set(py_name_set)\nself.exact_match = exact_match", "if self.mode == FilterMode.INCLUDE:\n return py_name not in self.py_name_set\nel...
<|body_start_0|> super().__init__() self.mode = mode if not isinstance(self.mode, FilterMode): raise ValueError(f'mode must be an instance of FilterMode: mode={mode}') self.py_name_set = set(py_name_set) self.exact_match = exact_match <|end_body_0|> <|body_start_1|> ...
A filter class for filtering based on property type py_names Example: .. code-block:: python filter = PropertyTypeFilter(include=['ge_freq', 'qscale'], exact_match=False)
PropertyTypeFilter
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PropertyTypeFilter: """A filter class for filtering based on property type py_names Example: .. code-block:: python filter = PropertyTypeFilter(include=['ge_freq', 'qscale'], exact_match=False)""" def __init__(self, mode: FilterMode=FilterMode.EXCLUDE, py_name_set=None, exact_match=False): ...
stack_v2_sparse_classes_36k_train_002025
7,968
permissive
[ { "docstring": "Creates a `PropertyTypeFilter` instance Args: mode (FilterMode): the mode (include/exclude) for the filter instance. Defaults to EXCLUDE. py_name_set (set, optional): the default set of py_names to include or exclude. Defaults to None. exact_match (bool, optional): whether to use exact matching ...
5
null
Implement the Python class `PropertyTypeFilter` described below. Class description: A filter class for filtering based on property type py_names Example: .. code-block:: python filter = PropertyTypeFilter(include=['ge_freq', 'qscale'], exact_match=False) Method signatures and docstrings: - def __init__(self, mode: Fi...
Implement the Python class `PropertyTypeFilter` described below. Class description: A filter class for filtering based on property type py_names Example: .. code-block:: python filter = PropertyTypeFilter(include=['ge_freq', 'qscale'], exact_match=False) Method signatures and docstrings: - def __init__(self, mode: Fi...
bc6733d774fe31a23f4c7e73e5eb0beed8d30e7d
<|skeleton|> class PropertyTypeFilter: """A filter class for filtering based on property type py_names Example: .. code-block:: python filter = PropertyTypeFilter(include=['ge_freq', 'qscale'], exact_match=False)""" def __init__(self, mode: FilterMode=FilterMode.EXCLUDE, py_name_set=None, exact_match=False): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PropertyTypeFilter: """A filter class for filtering based on property type py_names Example: .. code-block:: python filter = PropertyTypeFilter(include=['ge_freq', 'qscale'], exact_match=False)""" def __init__(self, mode: FilterMode=FilterMode.EXCLUDE, py_name_set=None, exact_match=False): """Cre...
the_stack_v2_python_sparse
pycqed/utilities/devicedb/filters.py
QudevETH/PycQED_py3
train
8
78c75e530d06f1fa39c9474a4ea7f5e23c05278f
[ "super(Folder, self).__init__(resource_id=folder_id, resource_type=resource.ResourceType.FOLDER, name=name, display_name=display_name, parent=parent, lifecycle_state=lifecycle_state)\nself.full_name = full_name\nself.data = data", "folder_dict = json.loads(json_string)\nname = folder_dict['name']\nfolder_id = nam...
<|body_start_0|> super(Folder, self).__init__(resource_id=folder_id, resource_type=resource.ResourceType.FOLDER, name=name, display_name=display_name, parent=parent, lifecycle_state=lifecycle_state) self.full_name = full_name self.data = data <|end_body_0|> <|body_start_1|> folder_dict ...
Folder Resource.
Folder
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Folder: """Folder Resource.""" def __init__(self, folder_id, full_name=None, data=None, name=None, display_name=None, parent=None, lifecycle_state=FolderLifecycleState.UNSPECIFIED): """Initialize. Args: folder_id (str): The folder id number. full_name (str): The full resource name an...
stack_v2_sparse_classes_36k_train_002026
2,960
permissive
[ { "docstring": "Initialize. Args: folder_id (str): The folder id number. full_name (str): The full resource name and ancestory. data (str): Resource representation of the folder. name (str): The folder unique GCP name, i.e. \"folders/{id}\". display_name (str): The folder display name. parent (Resource): The pa...
2
stack_v2_sparse_classes_30k_train_007531
Implement the Python class `Folder` described below. Class description: Folder Resource. Method signatures and docstrings: - def __init__(self, folder_id, full_name=None, data=None, name=None, display_name=None, parent=None, lifecycle_state=FolderLifecycleState.UNSPECIFIED): Initialize. Args: folder_id (str): The fol...
Implement the Python class `Folder` described below. Class description: Folder Resource. Method signatures and docstrings: - def __init__(self, folder_id, full_name=None, data=None, name=None, display_name=None, parent=None, lifecycle_state=FolderLifecycleState.UNSPECIFIED): Initialize. Args: folder_id (str): The fol...
d4421afa50a17ed47cbebe942044ebab3720e0f5
<|skeleton|> class Folder: """Folder Resource.""" def __init__(self, folder_id, full_name=None, data=None, name=None, display_name=None, parent=None, lifecycle_state=FolderLifecycleState.UNSPECIFIED): """Initialize. Args: folder_id (str): The folder id number. full_name (str): The full resource name an...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Folder: """Folder Resource.""" def __init__(self, folder_id, full_name=None, data=None, name=None, display_name=None, parent=None, lifecycle_state=FolderLifecycleState.UNSPECIFIED): """Initialize. Args: folder_id (str): The folder id number. full_name (str): The full resource name and ancestory. ...
the_stack_v2_python_sparse
google/cloud/forseti/common/gcp_type/folder.py
kevensen/forseti-security
train
1
406a695068149c4bc87f611bf748e9c2fcabd7cc
[ "tmp = self.head.next\nself.head.next = node\nnode.prev = self.head\nnode.next = tmp\ntmp.prev = node", "node.prev.next = node.next\nnode.next.prev = node.prev\nnode.prev = node.next = None", "self.cap = capacity\nself.cnt = 0\nself.key_to_node = {}\nself.head = Node(None, None)\nself.tail = Node(None, None)\ns...
<|body_start_0|> tmp = self.head.next self.head.next = node node.prev = self.head node.next = tmp tmp.prev = node <|end_body_0|> <|body_start_1|> node.prev.next = node.next node.next.prev = node.prev node.prev = node.next = None <|end_body_1|> <|body_sta...
Wrong.
LRUCache
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LRUCache: """Wrong.""" def addNode(self, node): """Add a node after head of the list""" <|body_0|> def removeNode(self, node): """Remove a node from the list""" <|body_1|> def __init__(self, capacity): """:type capacity: int""" <|body...
stack_v2_sparse_classes_36k_train_002027
9,208
no_license
[ { "docstring": "Add a node after head of the list", "name": "addNode", "signature": "def addNode(self, node)" }, { "docstring": "Remove a node from the list", "name": "removeNode", "signature": "def removeNode(self, node)" }, { "docstring": ":type capacity: int", "name": "__i...
5
stack_v2_sparse_classes_30k_train_015125
Implement the Python class `LRUCache` described below. Class description: Wrong. Method signatures and docstrings: - def addNode(self, node): Add a node after head of the list - def removeNode(self, node): Remove a node from the list - def __init__(self, capacity): :type capacity: int - def get(self, key): :rtype: in...
Implement the Python class `LRUCache` described below. Class description: Wrong. Method signatures and docstrings: - def addNode(self, node): Add a node after head of the list - def removeNode(self, node): Remove a node from the list - def __init__(self, capacity): :type capacity: int - def get(self, key): :rtype: in...
d634941087bc51869f43c0d8044db09b7bdbaf58
<|skeleton|> class LRUCache: """Wrong.""" def addNode(self, node): """Add a node after head of the list""" <|body_0|> def removeNode(self, node): """Remove a node from the list""" <|body_1|> def __init__(self, capacity): """:type capacity: int""" <|body...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LRUCache: """Wrong.""" def addNode(self, node): """Add a node after head of the list""" tmp = self.head.next self.head.next = node node.prev = self.head node.next = tmp tmp.prev = node def removeNode(self, node): """Remove a node from the list"...
the_stack_v2_python_sparse
146_LRU_Cache.py
susunini/leetcode
train
1
31a4a54a697d9c5e417451437c460ba6f668ded2
[ "concept_parsers.ConceptParser.ForResource('TRIGGER', resource_args.GetTriggerResourceSpec(), 'Build Trigger.', required=True).AddToParser(parser)\nflag_config = trigger_utils.AddTriggerArgs(parser, add_region_flag=False, add_name=False)\nflag_config.add_argument('--secret', help=textwrap.dedent('\\n The...
<|body_start_0|> concept_parsers.ConceptParser.ForResource('TRIGGER', resource_args.GetTriggerResourceSpec(), 'Build Trigger.', required=True).AddToParser(parser) flag_config = trigger_utils.AddTriggerArgs(parser, add_region_flag=False, add_name=False) flag_config.add_argument('--secret', help=t...
Update a Webhook trigger used by Google Cloud Build.
UpdateWebhook
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UpdateWebhook: """Update a Webhook trigger used by Google Cloud Build.""" def Args(parser): """Register flags for this command. Args: parser: An argparse.ArgumentParser-like object. It is mocked out in order to capture some information, but behaves like an ArgumentParser.""" ...
stack_v2_sparse_classes_36k_train_002028
5,691
permissive
[ { "docstring": "Register flags for this command. Args: parser: An argparse.ArgumentParser-like object. It is mocked out in order to capture some information, but behaves like an ArgumentParser.", "name": "Args", "signature": "def Args(parser)" }, { "docstring": "Parses arguments into a build tri...
3
stack_v2_sparse_classes_30k_train_006684
Implement the Python class `UpdateWebhook` described below. Class description: Update a Webhook trigger used by Google Cloud Build. Method signatures and docstrings: - def Args(parser): Register flags for this command. Args: parser: An argparse.ArgumentParser-like object. It is mocked out in order to capture some inf...
Implement the Python class `UpdateWebhook` described below. Class description: Update a Webhook trigger used by Google Cloud Build. Method signatures and docstrings: - def Args(parser): Register flags for this command. Args: parser: An argparse.ArgumentParser-like object. It is mocked out in order to capture some inf...
392abf004b16203030e6efd2f0af24db7c8d669e
<|skeleton|> class UpdateWebhook: """Update a Webhook trigger used by Google Cloud Build.""" def Args(parser): """Register flags for this command. Args: parser: An argparse.ArgumentParser-like object. It is mocked out in order to capture some information, but behaves like an ArgumentParser.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UpdateWebhook: """Update a Webhook trigger used by Google Cloud Build.""" def Args(parser): """Register flags for this command. Args: parser: An argparse.ArgumentParser-like object. It is mocked out in order to capture some information, but behaves like an ArgumentParser.""" concept_parse...
the_stack_v2_python_sparse
lib/surface/builds/triggers/update/webhook.py
google-cloud-sdk-unofficial/google-cloud-sdk
train
9
9ad570bb3049eee54587fea56159524348a5dad5
[ "if k >= len(nums):\n k %= len(nums)\nif k == 0:\n return\nloop = -1\ni = 0\nbefore = nums[0]\ncount = 1\nbound = len(nums) - k\nwhile count <= len(nums):\n if loop == -1:\n loop = i\n elif i == loop:\n i += 1\n before = nums[i]\n loop = -1\n continue\n to = i - bou...
<|body_start_0|> if k >= len(nums): k %= len(nums) if k == 0: return loop = -1 i = 0 before = nums[0] count = 1 bound = len(nums) - k while count <= len(nums): if loop == -1: loop = i elif i =...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def rotates(self, nums, k): """:type nums: List[int] :type k: int :rtype: void Do not return anything, modify nums in-place instead.""" <|body_0|> def rotate(self, nums, k): """:type nums: List[int] :type k: int :rtype: void Do not return anything, modify n...
stack_v2_sparse_classes_36k_train_002029
2,166
no_license
[ { "docstring": ":type nums: List[int] :type k: int :rtype: void Do not return anything, modify nums in-place instead.", "name": "rotates", "signature": "def rotates(self, nums, k)" }, { "docstring": ":type nums: List[int] :type k: int :rtype: void Do not return anything, modify nums in-place ins...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rotates(self, nums, k): :type nums: List[int] :type k: int :rtype: void Do not return anything, modify nums in-place instead. - def rotate(self, nums, k): :type nums: List[in...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rotates(self, nums, k): :type nums: List[int] :type k: int :rtype: void Do not return anything, modify nums in-place instead. - def rotate(self, nums, k): :type nums: List[in...
0743cbeb0e9aa4a8a25f4520a1e3f92793fae1ee
<|skeleton|> class Solution: def rotates(self, nums, k): """:type nums: List[int] :type k: int :rtype: void Do not return anything, modify nums in-place instead.""" <|body_0|> def rotate(self, nums, k): """:type nums: List[int] :type k: int :rtype: void Do not return anything, modify n...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def rotates(self, nums, k): """:type nums: List[int] :type k: int :rtype: void Do not return anything, modify nums in-place instead.""" if k >= len(nums): k %= len(nums) if k == 0: return loop = -1 i = 0 before = nums[0] ...
the_stack_v2_python_sparse
practice/leetcode/algorithm/189_RotateArray.py
aliceayres/leetcode-practice
train
0
a52af499ea9b595160cdbfeee615c6064df45520
[ "assert isinstance(cookie_jar, CookieJar)\ncookie_jar.__class__ = cls\nassert isinstance(cookie_jar, PickleableCookieJar)\nreturn cookie_jar", "state = self.__dict__.copy()\nstate.pop('_cookies_lock')\nreturn state", "self.__dict__.update(state)\nif '_cookies_lock' not in self.__dict__:\n self._cookies_lock ...
<|body_start_0|> assert isinstance(cookie_jar, CookieJar) cookie_jar.__class__ = cls assert isinstance(cookie_jar, PickleableCookieJar) return cookie_jar <|end_body_0|> <|body_start_1|> state = self.__dict__.copy() state.pop('_cookies_lock') return state <|end_bo...
A pickleable CookieJar class
PickleableCookieJar
[ "LicenseRef-scancode-warranty-disclaimer", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PickleableCookieJar: """A pickleable CookieJar class""" def cast(cls, cookie_jar: CookieJar): """Make a kind of cast to convert the class from CookieJar to PickleableCookieJar""" <|body_0|> def __getstate__(self): """Unlike a normal CookieJar, this class is pickl...
stack_v2_sparse_classes_36k_train_002030
4,220
permissive
[ { "docstring": "Make a kind of cast to convert the class from CookieJar to PickleableCookieJar", "name": "cast", "signature": "def cast(cls, cookie_jar: CookieJar)" }, { "docstring": "Unlike a normal CookieJar, this class is pickleable.", "name": "__getstate__", "signature": "def __getst...
3
stack_v2_sparse_classes_30k_train_000978
Implement the Python class `PickleableCookieJar` described below. Class description: A pickleable CookieJar class Method signatures and docstrings: - def cast(cls, cookie_jar: CookieJar): Make a kind of cast to convert the class from CookieJar to PickleableCookieJar - def __getstate__(self): Unlike a normal CookieJar...
Implement the Python class `PickleableCookieJar` described below. Class description: A pickleable CookieJar class Method signatures and docstrings: - def cast(cls, cookie_jar: CookieJar): Make a kind of cast to convert the class from CookieJar to PickleableCookieJar - def __getstate__(self): Unlike a normal CookieJar...
ece10d24449faaccd7d65a4093c6b5679ee0b383
<|skeleton|> class PickleableCookieJar: """A pickleable CookieJar class""" def cast(cls, cookie_jar: CookieJar): """Make a kind of cast to convert the class from CookieJar to PickleableCookieJar""" <|body_0|> def __getstate__(self): """Unlike a normal CookieJar, this class is pickl...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PickleableCookieJar: """A pickleable CookieJar class""" def cast(cls, cookie_jar: CookieJar): """Make a kind of cast to convert the class from CookieJar to PickleableCookieJar""" assert isinstance(cookie_jar, CookieJar) cookie_jar.__class__ = cls assert isinstance(cookie_j...
the_stack_v2_python_sparse
resources/lib/utils/cookies.py
CastagnaIT/plugin.video.netflix
train
2,019
70cd8bfedc35afc1d79db5e2748d10e634c70261
[ "if self.get_argument('type', None) == 'province':\n ret = {'status': True, 'rows': '', 'summary': ''}\n try:\n province_id = self.get_argument('province_id', None)\n if not province_id:\n ret['status'] = False\n ret['summary'] = '请指定省份ID'\n else:\n region...
<|body_start_0|> if self.get_argument('type', None) == 'province': ret = {'status': True, 'rows': '', 'summary': ''} try: province_id = self.get_argument('province_id', None) if not province_id: ret['status'] = False ...
CityHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CityHandler: def get(self, *args, **kwargs): """获取 :param args: :param kwargs: :return:""" <|body_0|> def post(self, *args, **kwargs): """添加 :param args: :param kwargs: :return:""" <|body_1|> def put(self, *args, **kwargs): """更新 :param args: :pa...
stack_v2_sparse_classes_36k_train_002031
13,334
no_license
[ { "docstring": "获取 :param args: :param kwargs: :return:", "name": "get", "signature": "def get(self, *args, **kwargs)" }, { "docstring": "添加 :param args: :param kwargs: :return:", "name": "post", "signature": "def post(self, *args, **kwargs)" }, { "docstring": "更新 :param args: :p...
4
stack_v2_sparse_classes_30k_train_016186
Implement the Python class `CityHandler` described below. Class description: Implement the CityHandler class. Method signatures and docstrings: - def get(self, *args, **kwargs): 获取 :param args: :param kwargs: :return: - def post(self, *args, **kwargs): 添加 :param args: :param kwargs: :return: - def put(self, *args, **...
Implement the Python class `CityHandler` described below. Class description: Implement the CityHandler class. Method signatures and docstrings: - def get(self, *args, **kwargs): 获取 :param args: :param kwargs: :return: - def post(self, *args, **kwargs): 添加 :param args: :param kwargs: :return: - def put(self, *args, **...
0056d8edb9b8912e28b0332b3202e8a8d50f7157
<|skeleton|> class CityHandler: def get(self, *args, **kwargs): """获取 :param args: :param kwargs: :return:""" <|body_0|> def post(self, *args, **kwargs): """添加 :param args: :param kwargs: :return:""" <|body_1|> def put(self, *args, **kwargs): """更新 :param args: :pa...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CityHandler: def get(self, *args, **kwargs): """获取 :param args: :param kwargs: :return:""" if self.get_argument('type', None) == 'province': ret = {'status': True, 'rows': '', 'summary': ''} try: province_id = self.get_argument('province_id', None) ...
the_stack_v2_python_sparse
UIAdmin/Controllers/Region.py
kevin-light/Jd-shop
train
0
7efa5bb83fd69ad14e01cb8b6c9da0685b879b3c
[ "self.maxiter = maxiter\nself.minimize = minimize\nself.n_window = n_window\nself.rel_tol = rel_tol\nself.iter = 0\nweights = torch.exp(torch.linspace(-eta, 0, self.n_window))\nself.weights = weights / weights.sum()\nself._prev_fvals = None", "self.iter += 1\nif self.iter == self.maxiter:\n return True\nif sel...
<|body_start_0|> self.maxiter = maxiter self.minimize = minimize self.n_window = n_window self.rel_tol = rel_tol self.iter = 0 weights = torch.exp(torch.linspace(-eta, 0, self.n_window)) self.weights = weights / weights.sum() self._prev_fvals = None <|end_...
Exponential moving average stopping criterion. Computes an exponentially weighted moving average over window length `n_window` and checks whether the relative decrease in this moving average between steps is less than a provided tolerance level. That is, in iteration `i`, it computes v[i,j] := fvals[i - n_window + j] *...
ExpMAStoppingCriterion
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExpMAStoppingCriterion: """Exponential moving average stopping criterion. Computes an exponentially weighted moving average over window length `n_window` and checks whether the relative decrease in this moving average between steps is less than a provided tolerance level. That is, in iteration `i...
stack_v2_sparse_classes_36k_train_002032
4,405
permissive
[ { "docstring": "Exponential moving average stopping criterion. Args: maxiter: Maximum number of iterations. minimize: If True, assume minimization. n_window: The size of the exponential moving average window. eta: The exponential decay factor in the weights. rel_tol: Relative tolerance for termination.", "n...
2
stack_v2_sparse_classes_30k_train_006990
Implement the Python class `ExpMAStoppingCriterion` described below. Class description: Exponential moving average stopping criterion. Computes an exponentially weighted moving average over window length `n_window` and checks whether the relative decrease in this moving average between steps is less than a provided to...
Implement the Python class `ExpMAStoppingCriterion` described below. Class description: Exponential moving average stopping criterion. Computes an exponentially weighted moving average over window length `n_window` and checks whether the relative decrease in this moving average between steps is less than a provided to...
4cc5ed59b2e8a9c780f786830c548e05cc74d53c
<|skeleton|> class ExpMAStoppingCriterion: """Exponential moving average stopping criterion. Computes an exponentially weighted moving average over window length `n_window` and checks whether the relative decrease in this moving average between steps is less than a provided tolerance level. That is, in iteration `i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ExpMAStoppingCriterion: """Exponential moving average stopping criterion. Computes an exponentially weighted moving average over window length `n_window` and checks whether the relative decrease in this moving average between steps is less than a provided tolerance level. That is, in iteration `i`, it compute...
the_stack_v2_python_sparse
botorch/optim/stopping.py
pytorch/botorch
train
2,891
d04f8c7567ed1fa112a167716d8d904bf523f6d8
[ "for audio in self.audio_providers:\n if audio.play(word, language, repeat):\n return True\nreturn False", "for audio in self.audio_providers:\n if audio.has(word, language):\n return True\nreturn False" ]
<|body_start_0|> for audio in self.audio_providers: if audio.play(word, language, repeat): return True return False <|end_body_0|> <|body_start_1|> for audio in self.audio_providers: if audio.has(word, language): return True return...
Collection of audio providers.
AudioCollection
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AudioCollection: """Collection of audio providers.""" def play(self, word: str, language: Language, repeat: int=1) -> bool: """Voice the word.""" <|body_0|> def has(self, word: str, language: Language) -> bool: """Voice the word.""" <|body_1|> <|end_skel...
stack_v2_sparse_classes_36k_train_002033
5,555
permissive
[ { "docstring": "Voice the word.", "name": "play", "signature": "def play(self, word: str, language: Language, repeat: int=1) -> bool" }, { "docstring": "Voice the word.", "name": "has", "signature": "def has(self, word: str, language: Language) -> bool" } ]
2
stack_v2_sparse_classes_30k_train_015457
Implement the Python class `AudioCollection` described below. Class description: Collection of audio providers. Method signatures and docstrings: - def play(self, word: str, language: Language, repeat: int=1) -> bool: Voice the word. - def has(self, word: str, language: Language) -> bool: Voice the word.
Implement the Python class `AudioCollection` described below. Class description: Collection of audio providers. Method signatures and docstrings: - def play(self, word: str, language: Language, repeat: int=1) -> bool: Voice the word. - def has(self, word: str, language: Language) -> bool: Voice the word. <|skeleton|...
4c840c0745d31eceb5b916101358d5207c0a1823
<|skeleton|> class AudioCollection: """Collection of audio providers.""" def play(self, word: str, language: Language, repeat: int=1) -> bool: """Voice the word.""" <|body_0|> def has(self, word: str, language: Language) -> bool: """Voice the word.""" <|body_1|> <|end_skel...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AudioCollection: """Collection of audio providers.""" def play(self, word: str, language: Language, repeat: int=1) -> bool: """Voice the word.""" for audio in self.audio_providers: if audio.play(word, language, repeat): return True return False def...
the_stack_v2_python_sparse
emmio/audio/core.py
enzet/Emmio
train
8
9b92c65a94e83060a3c9d507e8a1ac682f0c1289
[ "LDC_Info.__init__(self)\nself.setTitle(self.name)\nself.status = compat_res[0]\nui = Ui_WebcamFrame()\nui.setupUi(self.frame)\nself.__fill_frame(ui, info_res, compat_res, diag_res)", "ui.productLineEdit.setText(QtGui.QApplication.translate('WebcamFrame', info_res.product, None, QtGui.QApplication.UnicodeUTF8))\n...
<|body_start_0|> LDC_Info.__init__(self) self.setTitle(self.name) self.status = compat_res[0] ui = Ui_WebcamFrame() ui.setupUi(self.frame) self.__fill_frame(ui, info_res, compat_res, diag_res) <|end_body_0|> <|body_start_1|> ui.productLineEdit.setText(QtGui.QAppl...
Estende a classe 'LDC_Info'. Classe que define a interface gráfica com os resultados para o teste de rede.
GUIWebcam
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GUIWebcam: """Estende a classe 'LDC_Info'. Classe que define a interface gráfica com os resultados para o teste de rede.""" def __init__(self, info_res, compat_res, diag_res): """Construtor Parâmetros: info_res -- lista com os resultados informativos (lista de 'InfoResWebcam) compat_...
stack_v2_sparse_classes_36k_train_002034
2,304
no_license
[ { "docstring": "Construtor Parâmetros: info_res -- lista com os resultados informativos (lista de 'InfoResWebcam) compat_res -- Lista com as tuples de resultados de compatibilidade [(True, msg)] diag_res -- Lista com os resultados do diagn�stico (lista de 'DaigResWebcam')", "name": "__init__", "signatur...
2
null
Implement the Python class `GUIWebcam` described below. Class description: Estende a classe 'LDC_Info'. Classe que define a interface gráfica com os resultados para o teste de rede. Method signatures and docstrings: - def __init__(self, info_res, compat_res, diag_res): Construtor Parâmetros: info_res -- lista com os ...
Implement the Python class `GUIWebcam` described below. Class description: Estende a classe 'LDC_Info'. Classe que define a interface gráfica com os resultados para o teste de rede. Method signatures and docstrings: - def __init__(self, info_res, compat_res, diag_res): Construtor Parâmetros: info_res -- lista com os ...
bda0c2c8977dd1246339f1f0f4718d29e8795f21
<|skeleton|> class GUIWebcam: """Estende a classe 'LDC_Info'. Classe que define a interface gráfica com os resultados para o teste de rede.""" def __init__(self, info_res, compat_res, diag_res): """Construtor Parâmetros: info_res -- lista com os resultados informativos (lista de 'InfoResWebcam) compat_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GUIWebcam: """Estende a classe 'LDC_Info'. Classe que define a interface gráfica com os resultados para o teste de rede.""" def __init__(self, info_res, compat_res, diag_res): """Construtor Parâmetros: info_res -- lista com os resultados informativos (lista de 'InfoResWebcam) compat_res -- Lista ...
the_stack_v2_python_sparse
src/libs/webcam/gui_webcam.py
adrianomelo/ldc-desktop
train
1
dd505beeab289a88129187e103c67ad510c5a85f
[ "if path is None:\n outpath = os.path.dirname(os.path.abspath(configfile))\nelse:\n outpath = path\nself.config = Configuration(configfile, outpath=path)\nself.pixel = pixel\nself.nside = nside", "if not self.config.galfile_pixelized:\n raise ValueError('Code only runs with pixelized galfile.')\nself.con...
<|body_start_0|> if path is None: outpath = os.path.dirname(os.path.abspath(configfile)) else: outpath = path self.config = Configuration(configfile, outpath=path) self.pixel = pixel self.nside = nside <|end_body_0|> <|body_start_1|> if not self.c...
Class to run richness computation (runcat) on a single healpix pixel, for distributed runs.
RuncatPixelTask
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RuncatPixelTask: """Class to run richness computation (runcat) on a single healpix pixel, for distributed runs.""" def __init__(self, configfile, pixel, nside, path=None): """Instantiate a RuncatPixelTask. Parameters ---------- configfile: `str` Configuration yaml filename. pixel: `i...
stack_v2_sparse_classes_36k_train_002035
10,033
permissive
[ { "docstring": "Instantiate a RuncatPixelTask. Parameters ---------- configfile: `str` Configuration yaml filename. pixel: `int` Healpix pixel to run on. nside: `int` Healpix nside associated with pixel. path: `str`, optional Output path. Default is None, use same absolute path as configfile. percolation_maskin...
2
stack_v2_sparse_classes_30k_train_019038
Implement the Python class `RuncatPixelTask` described below. Class description: Class to run richness computation (runcat) on a single healpix pixel, for distributed runs. Method signatures and docstrings: - def __init__(self, configfile, pixel, nside, path=None): Instantiate a RuncatPixelTask. Parameters ----------...
Implement the Python class `RuncatPixelTask` described below. Class description: Class to run richness computation (runcat) on a single healpix pixel, for distributed runs. Method signatures and docstrings: - def __init__(self, configfile, pixel, nside, path=None): Instantiate a RuncatPixelTask. Parameters ----------...
d3a8b432c2f3a20aa518a7781c0f2aa315624855
<|skeleton|> class RuncatPixelTask: """Class to run richness computation (runcat) on a single healpix pixel, for distributed runs.""" def __init__(self, configfile, pixel, nside, path=None): """Instantiate a RuncatPixelTask. Parameters ---------- configfile: `str` Configuration yaml filename. pixel: `i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RuncatPixelTask: """Class to run richness computation (runcat) on a single healpix pixel, for distributed runs.""" def __init__(self, configfile, pixel, nside, path=None): """Instantiate a RuncatPixelTask. Parameters ---------- configfile: `str` Configuration yaml filename. pixel: `int` Healpix p...
the_stack_v2_python_sparse
redmapper/pipeline/redmappertask.py
erykoff/redmapper
train
20
a7e9bccb4b45d7b4798815cece15639e206a52cd
[ "PeakDetector.__init__(self, recording, return_output=return_output)\nself.peak_detector_node = peak_detector_node\nself.waveform_extraction_node = waveform_extraction_node\nself.waveform_denoising_node = waveform_denoising_node\nself.num_iterations = num_iterations\nself.tresholds = tresholds", "internal_pipelin...
<|body_start_0|> PeakDetector.__init__(self, recording, return_output=return_output) self.peak_detector_node = peak_detector_node self.waveform_extraction_node = waveform_extraction_node self.waveform_denoising_node = waveform_denoising_node self.num_iterations = num_iterations ...
A class that iteratively detects peaks in the recording by applying a peak detector, waveform extraction, and waveform denoising node. The algorithm runs for a specified number of iterations or until no peaks are found.
IterativePeakDetector
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IterativePeakDetector: """A class that iteratively detects peaks in the recording by applying a peak detector, waveform extraction, and waveform denoising node. The algorithm runs for a specified number of iterations or until no peaks are found.""" def __init__(self, recording: BaseRecording...
stack_v2_sparse_classes_36k_train_002036
40,308
permissive
[ { "docstring": "Initialize the iterative peak detector. Parameters ---------- recording : BaseRecording The recording to process. peak_detector_node : PeakDetector The peak detector node to use. waveform_extraction_node : WaveformsNode The waveform extraction node to use. waveform_denoising_node The waveform de...
5
stack_v2_sparse_classes_30k_train_002913
Implement the Python class `IterativePeakDetector` described below. Class description: A class that iteratively detects peaks in the recording by applying a peak detector, waveform extraction, and waveform denoising node. The algorithm runs for a specified number of iterations or until no peaks are found. Method sign...
Implement the Python class `IterativePeakDetector` described below. Class description: A class that iteratively detects peaks in the recording by applying a peak detector, waveform extraction, and waveform denoising node. The algorithm runs for a specified number of iterations or until no peaks are found. Method sign...
ee2237b3f5ce2347b2ec9df90e97b0ee6c738dcf
<|skeleton|> class IterativePeakDetector: """A class that iteratively detects peaks in the recording by applying a peak detector, waveform extraction, and waveform denoising node. The algorithm runs for a specified number of iterations or until no peaks are found.""" def __init__(self, recording: BaseRecording...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IterativePeakDetector: """A class that iteratively detects peaks in the recording by applying a peak detector, waveform extraction, and waveform denoising node. The algorithm runs for a specified number of iterations or until no peaks are found.""" def __init__(self, recording: BaseRecording, peak_detect...
the_stack_v2_python_sparse
src/spikeinterface/sortingcomponents/peak_detection.py
SpikeInterface/spikeinterface
train
295
b22618703aba4b31e3d62597b3628b4c49479e23
[ "pg.ModellingBase.__init__(self, verbose)\nself.f_ = f\nself.setMesh(pg.createMesh1D(1, 6))", "spec1 = ColeCole(self.f_, 1.0, par[0], par[1], par[2])\nspec2 = ColeCole(self.f_, 1.0, par[3], par[4], par[5])\nreturn -np.angle(spec1 * spec2)" ]
<|body_start_0|> pg.ModellingBase.__init__(self, verbose) self.f_ = f self.setMesh(pg.createMesh1D(1, 6)) <|end_body_0|> <|body_start_1|> spec1 = ColeCole(self.f_, 1.0, par[0], par[1], par[2]) spec2 = ColeCole(self.f_, 1.0, par[3], par[4], par[5]) return -np.angle(spec1 ...
Double Cole-Cole model with EM term after Pelton et al. (1978) Modelling operator for the Frequency Domain :py:mod:`Cole-Cole <pygimli.physics.SIP.ColeColeRho>` impedance model using :py:mod:`pygimli.physics.SIP.ColeColeRho` after Pelton et al. (1978) :cite:`PeltonWarHal1978` * :math:`\\textbf{m} =\\{ m_1, \\tau_1, c_1...
DoubleColeColePhi
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DoubleColeColePhi: """Double Cole-Cole model with EM term after Pelton et al. (1978) Modelling operator for the Frequency Domain :py:mod:`Cole-Cole <pygimli.physics.SIP.ColeColeRho>` impedance model using :py:mod:`pygimli.physics.SIP.ColeColeRho` after Pelton et al. (1978) :cite:`PeltonWarHal1978...
stack_v2_sparse_classes_36k_train_002037
11,407
permissive
[ { "docstring": "Setup class by specifying the frequency.", "name": "__init__", "signature": "def __init__(self, f, verbose=False)" }, { "docstring": "phase angle of the model", "name": "response", "signature": "def response(self, par)" } ]
2
stack_v2_sparse_classes_30k_train_021351
Implement the Python class `DoubleColeColePhi` described below. Class description: Double Cole-Cole model with EM term after Pelton et al. (1978) Modelling operator for the Frequency Domain :py:mod:`Cole-Cole <pygimli.physics.SIP.ColeColeRho>` impedance model using :py:mod:`pygimli.physics.SIP.ColeColeRho` after Pelto...
Implement the Python class `DoubleColeColePhi` described below. Class description: Double Cole-Cole model with EM term after Pelton et al. (1978) Modelling operator for the Frequency Domain :py:mod:`Cole-Cole <pygimli.physics.SIP.ColeColeRho>` impedance model using :py:mod:`pygimli.physics.SIP.ColeColeRho` after Pelto...
9962fe882fad284e52858ba3aa5e87b2395d791d
<|skeleton|> class DoubleColeColePhi: """Double Cole-Cole model with EM term after Pelton et al. (1978) Modelling operator for the Frequency Domain :py:mod:`Cole-Cole <pygimli.physics.SIP.ColeColeRho>` impedance model using :py:mod:`pygimli.physics.SIP.ColeColeRho` after Pelton et al. (1978) :cite:`PeltonWarHal1978...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DoubleColeColePhi: """Double Cole-Cole model with EM term after Pelton et al. (1978) Modelling operator for the Frequency Domain :py:mod:`Cole-Cole <pygimli.physics.SIP.ColeColeRho>` impedance model using :py:mod:`pygimli.physics.SIP.ColeColeRho` after Pelton et al. (1978) :cite:`PeltonWarHal1978` * :math:`\\...
the_stack_v2_python_sparse
python/pygimli/physics/SIP/models.py
Geophysics-OpenSource/gimli
train
0
912c977ab1136937807f5b515b80fb20c42ac2ce
[ "self.filename = filename\ninput_file = open(self.filename, 'r')\nself.data = input_file.readlines()\ninput_file.close()\nself.line_no = 0", "line = self.data[self.line_no]\nself.line_no += 1\nwhile line.startswith('#') or line.startswith('%'):\n line = self.data[self.line_no]\n self.line_no += 1\ncomment_m...
<|body_start_0|> self.filename = filename input_file = open(self.filename, 'r') self.data = input_file.readlines() input_file.close() self.line_no = 0 <|end_body_0|> <|body_start_1|> line = self.data[self.line_no] self.line_no += 1 while line.startswith('...
This class is used to open and read an option file. It stores the information locally and returns each option individually, after each call to its get_next_option method.
OptFile
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OptFile: """This class is used to open and read an option file. It stores the information locally and returns each option individually, after each call to its get_next_option method.""" def __init__(self, filename): """This function reads the option file pointed by filename.""" ...
stack_v2_sparse_classes_36k_train_002038
1,306
permissive
[ { "docstring": "This function reads the option file pointed by filename.", "name": "__init__", "signature": "def __init__(self, filename)" }, { "docstring": "This function returns the next option we read from the option file.", "name": "get_next_option", "signature": "def get_next_option...
2
stack_v2_sparse_classes_30k_train_006022
Implement the Python class `OptFile` described below. Class description: This class is used to open and read an option file. It stores the information locally and returns each option individually, after each call to its get_next_option method. Method signatures and docstrings: - def __init__(self, filename): This fun...
Implement the Python class `OptFile` described below. Class description: This class is used to open and read an option file. It stores the information locally and returns each option individually, after each call to its get_next_option method. Method signatures and docstrings: - def __init__(self, filename): This fun...
bc0cce2378aa071a5537d25c1a738e58ef610561
<|skeleton|> class OptFile: """This class is used to open and read an option file. It stores the information locally and returns each option individually, after each call to its get_next_option method.""" def __init__(self, filename): """This function reads the option file pointed by filename.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OptFile: """This class is used to open and read an option file. It stores the information locally and returns each option individually, after each call to its get_next_option method.""" def __init__(self, filename): """This function reads the option file pointed by filename.""" self.filen...
the_stack_v2_python_sparse
bbp/comps/optfile.py
alborzgh/bbp
train
0
a982cbd211dae5a7d528a9748bebafcaeaa9e6a1
[ "self.debug = debug\nself.rs_pin = rs_pin\nself.en_pin = en_pin\nself.pins = pins\nGPIO.setmode(GPIO.BCM)\nif not self.debug:\n GPIO.setwarnings(False)\nGPIO.setup(self.en_pin, GPIO.OUT)\nGPIO.setup(self.rs_pin, GPIO.OUT)\nfor pin in self.pins:\n GPIO.setup(pin, GPIO.OUT)\nHD44780.__init__(self, debug=self.de...
<|body_start_0|> self.debug = debug self.rs_pin = rs_pin self.en_pin = en_pin self.pins = pins GPIO.setmode(GPIO.BCM) if not self.debug: GPIO.setwarnings(False) GPIO.setup(self.en_pin, GPIO.OUT) GPIO.setup(self.rs_pin, GPIO.OUT) for pin...
Driver for using HD44780 displays connected to Raspberry Pi GPIO. Presumes the R/W line is tied to ground. Also, doesn't yet control backlight.
Screen
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Screen: """Driver for using HD44780 displays connected to Raspberry Pi GPIO. Presumes the R/W line is tied to ground. Also, doesn't yet control backlight.""" def __init__(self, pins=[], rs_pin=None, en_pin=None, debug=False, **kwargs): """Initializes the GPIO-driven HD44780 display A...
stack_v2_sparse_classes_36k_train_002039
3,397
permissive
[ { "docstring": "Initializes the GPIO-driven HD44780 display All GPIOs passed as arguments will be used with BCM mapping. Kwargs: * ``pins``: list of GPIO pins for driving display data bits in format [DB4, DB5, DB6, DB7] * ``en_pin``: EN pin GPIO number. Please, make sure it's pulled down to GND (10K is OK). Oth...
3
stack_v2_sparse_classes_30k_train_014692
Implement the Python class `Screen` described below. Class description: Driver for using HD44780 displays connected to Raspberry Pi GPIO. Presumes the R/W line is tied to ground. Also, doesn't yet control backlight. Method signatures and docstrings: - def __init__(self, pins=[], rs_pin=None, en_pin=None, debug=False,...
Implement the Python class `Screen` described below. Class description: Driver for using HD44780 displays connected to Raspberry Pi GPIO. Presumes the R/W line is tied to ground. Also, doesn't yet control backlight. Method signatures and docstrings: - def __init__(self, pins=[], rs_pin=None, en_pin=None, debug=False,...
47f24116ebe3d9f7336431c20bde880d2e86793e
<|skeleton|> class Screen: """Driver for using HD44780 displays connected to Raspberry Pi GPIO. Presumes the R/W line is tied to ground. Also, doesn't yet control backlight.""" def __init__(self, pins=[], rs_pin=None, en_pin=None, debug=False, **kwargs): """Initializes the GPIO-driven HD44780 display A...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Screen: """Driver for using HD44780 displays connected to Raspberry Pi GPIO. Presumes the R/W line is tied to ground. Also, doesn't yet control backlight.""" def __init__(self, pins=[], rs_pin=None, en_pin=None, debug=False, **kwargs): """Initializes the GPIO-driven HD44780 display All GPIOs pass...
the_stack_v2_python_sparse
output/drivers/pi_gpio.py
samkaufman01/pyLCI
train
1
9560df8d682e74236f2be5d7fe56ba6b9721ef22
[ "self.shipping_addr = shipping_addr\nif not shipping_addr:\n self.name = '{} (rated after address entered)'.format(self.name)", "if not self.shipping_addr or not basket.all_lines():\n return prices.Price(currency=basket.currency, excl_tax=D(0), incl_tax=D(0))\nups_settings = models.UPSSettings.get_settings(...
<|body_start_0|> self.shipping_addr = shipping_addr if not shipping_addr: self.name = '{} (rated after address entered)'.format(self.name) <|end_body_0|> <|body_start_1|> if not self.shipping_addr or not basket.all_lines(): return prices.Price(currency=basket.currency, e...
Provide a method of standard UPS ground shipping
DomesticShipping
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DomesticShipping: """Provide a method of standard UPS ground shipping""" def __init__(self, shipping_addr=None): """Quickly init the default box, and save the shipping address""" <|body_0|> def calculate(self, basket): """Get a rate for this package from UPS""" ...
stack_v2_sparse_classes_36k_train_002040
3,718
no_license
[ { "docstring": "Quickly init the default box, and save the shipping address", "name": "__init__", "signature": "def __init__(self, shipping_addr=None)" }, { "docstring": "Get a rate for this package from UPS", "name": "calculate", "signature": "def calculate(self, basket)" } ]
2
stack_v2_sparse_classes_30k_train_007402
Implement the Python class `DomesticShipping` described below. Class description: Provide a method of standard UPS ground shipping Method signatures and docstrings: - def __init__(self, shipping_addr=None): Quickly init the default box, and save the shipping address - def calculate(self, basket): Get a rate for this ...
Implement the Python class `DomesticShipping` described below. Class description: Provide a method of standard UPS ground shipping Method signatures and docstrings: - def __init__(self, shipping_addr=None): Quickly init the default box, and save the shipping address - def calculate(self, basket): Get a rate for this ...
f7bf3c61407da53d2c2d0142790dce4ccb94ee33
<|skeleton|> class DomesticShipping: """Provide a method of standard UPS ground shipping""" def __init__(self, shipping_addr=None): """Quickly init the default box, and save the shipping address""" <|body_0|> def calculate(self, basket): """Get a rate for this package from UPS""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DomesticShipping: """Provide a method of standard UPS ground shipping""" def __init__(self, shipping_addr=None): """Quickly init the default box, and save the shipping address""" self.shipping_addr = shipping_addr if not shipping_addr: self.name = '{} (rated after addr...
the_stack_v2_python_sparse
cart/shipping/methods.py
lo-windigo/duxdekes.com
train
0
a4a8eff88cca940af60e459f2fcd1b5fad2ada5d
[ "self.file_extensions_list = file_extensions_list\nself.is_enabled = is_enabled\nself.mode = mode", "if dictionary is None:\n return None\nfile_extensions_list = dictionary.get('fileExtensionsList')\nis_enabled = dictionary.get('isEnabled')\nmode = dictionary.get('mode')\nreturn cls(file_extensions_list, is_en...
<|body_start_0|> self.file_extensions_list = file_extensions_list self.is_enabled = is_enabled self.mode = mode <|end_body_0|> <|body_start_1|> if dictionary is None: return None file_extensions_list = dictionary.get('fileExtensionsList') is_enabled = diction...
Implementation of the 'FileExtensionFilter' model. TODO: type description here. Attributes: file_extensions_list (list of string): The list of file extensions to apply is_enabled (bool): If set, it enables the file extension filter mode (ModeFileExtensionFilterEnum): The mode applied to the list of file extensions 'kWh...
FileExtensionFilter
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FileExtensionFilter: """Implementation of the 'FileExtensionFilter' model. TODO: type description here. Attributes: file_extensions_list (list of string): The list of file extensions to apply is_enabled (bool): If set, it enables the file extension filter mode (ModeFileExtensionFilterEnum): The m...
stack_v2_sparse_classes_36k_train_002041
2,043
permissive
[ { "docstring": "Constructor for the FileExtensionFilter class", "name": "__init__", "signature": "def __init__(self, file_extensions_list=None, is_enabled=None, mode=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary represen...
2
null
Implement the Python class `FileExtensionFilter` described below. Class description: Implementation of the 'FileExtensionFilter' model. TODO: type description here. Attributes: file_extensions_list (list of string): The list of file extensions to apply is_enabled (bool): If set, it enables the file extension filter mo...
Implement the Python class `FileExtensionFilter` described below. Class description: Implementation of the 'FileExtensionFilter' model. TODO: type description here. Attributes: file_extensions_list (list of string): The list of file extensions to apply is_enabled (bool): If set, it enables the file extension filter mo...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class FileExtensionFilter: """Implementation of the 'FileExtensionFilter' model. TODO: type description here. Attributes: file_extensions_list (list of string): The list of file extensions to apply is_enabled (bool): If set, it enables the file extension filter mode (ModeFileExtensionFilterEnum): The m...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FileExtensionFilter: """Implementation of the 'FileExtensionFilter' model. TODO: type description here. Attributes: file_extensions_list (list of string): The list of file extensions to apply is_enabled (bool): If set, it enables the file extension filter mode (ModeFileExtensionFilterEnum): The mode applied t...
the_stack_v2_python_sparse
cohesity_management_sdk/models/file_extension_filter.py
cohesity/management-sdk-python
train
24
bc403fcdd9722d84dd2b72e1f64e8c21370e268f
[ "self.graph = graph\nself.point_dict = dict()\nself.radius = 1", "if root is None:\n algorithm = TreeCenter(self.graph)\n algorithm.run()\n root = algorithm.tree_center[0]\nself.plot(root, 0, 6, level=0)", "assert isinstance(left, (int, Fraction))\nassert isinstance(right, (int, Fraction))\nangle = Fra...
<|body_start_0|> self.graph = graph self.point_dict = dict() self.radius = 1 <|end_body_0|> <|body_start_1|> if root is None: algorithm = TreeCenter(self.graph) algorithm.run() root = algorithm.tree_center[0] self.plot(root, 0, 6, level=0) <|e...
Finding the positions of tree nodes in the plane (radius, angle).
TreePlotRadiusAngle
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TreePlotRadiusAngle: """Finding the positions of tree nodes in the plane (radius, angle).""" def __init__(self, graph): """The algorithm initialization.""" <|body_0|> def run(self, root=None): """Executable pseudocode.""" <|body_1|> def plot(self, so...
stack_v2_sparse_classes_36k_train_002042
3,663
permissive
[ { "docstring": "The algorithm initialization.", "name": "__init__", "signature": "def __init__(self, graph)" }, { "docstring": "Executable pseudocode.", "name": "run", "signature": "def run(self, root=None)" }, { "docstring": "Find node positions (radius, angle). Parameters -----...
3
stack_v2_sparse_classes_30k_val_000236
Implement the Python class `TreePlotRadiusAngle` described below. Class description: Finding the positions of tree nodes in the plane (radius, angle). Method signatures and docstrings: - def __init__(self, graph): The algorithm initialization. - def run(self, root=None): Executable pseudocode. - def plot(self, source...
Implement the Python class `TreePlotRadiusAngle` described below. Class description: Finding the positions of tree nodes in the plane (radius, angle). Method signatures and docstrings: - def __init__(self, graph): The algorithm initialization. - def run(self, root=None): Executable pseudocode. - def plot(self, source...
0ff4ae303e8824e6bb8474d23b29a7b3e5ed8e60
<|skeleton|> class TreePlotRadiusAngle: """Finding the positions of tree nodes in the plane (radius, angle).""" def __init__(self, graph): """The algorithm initialization.""" <|body_0|> def run(self, root=None): """Executable pseudocode.""" <|body_1|> def plot(self, so...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TreePlotRadiusAngle: """Finding the positions of tree nodes in the plane (radius, angle).""" def __init__(self, graph): """The algorithm initialization.""" self.graph = graph self.point_dict = dict() self.radius = 1 def run(self, root=None): """Executable pseu...
the_stack_v2_python_sparse
graphtheory/forests/treeplot.py
kgashok/graphs-dict
train
0
256cdebf8b50468f9ff1f9269b87676f543600eb
[ "if not root:\n return None\nP = self.ancestor(root, p)\nQ = self.ancestor(root, q)\nh = min(len(P), len(Q))\nfor i in xrange(h):\n if P[i] is Q[i]:\n result = P[i]\n else:\n break\nreturn result", "if not root:\n return []\nif root is dis:\n return [dis]\nl = self.ancestor(root.left,...
<|body_start_0|> if not root: return None P = self.ancestor(root, p) Q = self.ancestor(root, q) h = min(len(P), len(Q)) for i in xrange(h): if P[i] is Q[i]: result = P[i] else: break return result <|end_b...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def lowestCommonAncestor(self, root, p, q): """:type root: TreeNode :type p: TreeNode :type q: TreeNode :rtype: TreeNode""" <|body_0|> def ancestor(self, root, dis): """根据祖先找到目标节点""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not root...
stack_v2_sparse_classes_36k_train_002043
1,738
no_license
[ { "docstring": ":type root: TreeNode :type p: TreeNode :type q: TreeNode :rtype: TreeNode", "name": "lowestCommonAncestor", "signature": "def lowestCommonAncestor(self, root, p, q)" }, { "docstring": "根据祖先找到目标节点", "name": "ancestor", "signature": "def ancestor(self, root, dis)" } ]
2
stack_v2_sparse_classes_30k_train_016335
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lowestCommonAncestor(self, root, p, q): :type root: TreeNode :type p: TreeNode :type q: TreeNode :rtype: TreeNode - def ancestor(self, root, dis): 根据祖先找到目标节点
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lowestCommonAncestor(self, root, p, q): :type root: TreeNode :type p: TreeNode :type q: TreeNode :rtype: TreeNode - def ancestor(self, root, dis): 根据祖先找到目标节点 <|skeleton|> cl...
9687f8e743a8b6396fff192f22b5256d1025f86b
<|skeleton|> class Solution: def lowestCommonAncestor(self, root, p, q): """:type root: TreeNode :type p: TreeNode :type q: TreeNode :rtype: TreeNode""" <|body_0|> def ancestor(self, root, dis): """根据祖先找到目标节点""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def lowestCommonAncestor(self, root, p, q): """:type root: TreeNode :type p: TreeNode :type q: TreeNode :rtype: TreeNode""" if not root: return None P = self.ancestor(root, p) Q = self.ancestor(root, q) h = min(len(P), len(Q)) for i in xran...
the_stack_v2_python_sparse
2017/tree/Lowest_Common_Ancestor_of_a_Binary_Tree.py
buhuipao/LeetCode
train
5
eb25d567e7d7e5cad66ecabbfd34512f96383a31
[ "if root.val >= val:\n if root.left:\n self.insertIntoBST(root.left, val)\n else:\n node = TreeNode(val)\n root.left = node\nelif root.right:\n self.insertIntoBST(root.right, val)\nelse:\n node = TreeNode(val)\n root.right = node\nreturn root", "if not root:\n return TreeNod...
<|body_start_0|> if root.val >= val: if root.left: self.insertIntoBST(root.left, val) else: node = TreeNode(val) root.left = node elif root.right: self.insertIntoBST(root.right, val) else: node = Tree...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def _insertIntoBST(self, root, val): """:type root: TreeNode :type val: int :rtype: TreeNode""" <|body_0|> def __insertIntoBST(self, root, val): """:type root: TreeNode :type val: int :rtype: TreeNode""" <|body_1|> def ___insertIntoBST(self, ro...
stack_v2_sparse_classes_36k_train_002044
4,559
permissive
[ { "docstring": ":type root: TreeNode :type val: int :rtype: TreeNode", "name": "_insertIntoBST", "signature": "def _insertIntoBST(self, root, val)" }, { "docstring": ":type root: TreeNode :type val: int :rtype: TreeNode", "name": "__insertIntoBST", "signature": "def __insertIntoBST(self,...
5
stack_v2_sparse_classes_30k_val_000288
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def _insertIntoBST(self, root, val): :type root: TreeNode :type val: int :rtype: TreeNode - def __insertIntoBST(self, root, val): :type root: TreeNode :type val: int :rtype: Tree...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def _insertIntoBST(self, root, val): :type root: TreeNode :type val: int :rtype: TreeNode - def __insertIntoBST(self, root, val): :type root: TreeNode :type val: int :rtype: Tree...
0dd67edca4e0b0323cb5a7239f02ea46383cd15a
<|skeleton|> class Solution: def _insertIntoBST(self, root, val): """:type root: TreeNode :type val: int :rtype: TreeNode""" <|body_0|> def __insertIntoBST(self, root, val): """:type root: TreeNode :type val: int :rtype: TreeNode""" <|body_1|> def ___insertIntoBST(self, ro...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def _insertIntoBST(self, root, val): """:type root: TreeNode :type val: int :rtype: TreeNode""" if root.val >= val: if root.left: self.insertIntoBST(root.left, val) else: node = TreeNode(val) root.left = node ...
the_stack_v2_python_sparse
701.insert-into-a-binary-search-tree.py
windard/leeeeee
train
0
462db16007ab5dca10b5b6043d85e46b16de3ffa
[ "result = {}\ntesting_mode = PyFunceble.cli.utils.testing.get_testing_mode()\nif testing_mode not in self.SUPPORTED_TEST_MODES:\n raise ValueError('<testing_mode> ({testing_mode!r}) is not supported.')\nfor registrar, value in self.dataset['counter'].items():\n if registrar == 'total':\n continue\n ...
<|body_start_0|> result = {} testing_mode = PyFunceble.cli.utils.testing.get_testing_mode() if testing_mode not in self.SUPPORTED_TEST_MODES: raise ValueError('<testing_mode> ({testing_mode!r}) is not supported.') for registrar, value in self.dataset['counter'].items(): ...
Provides our registrar stats counter.
RegistrarCounter
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RegistrarCounter: """Provides our registrar stats counter.""" def get_dataset_for_printer(self, *, limit: Optional[int]=15) -> List[Dict[str, Union[str, int]]]: """Provides the dataset that the printer may understand. :param limit: Maximum number of registrars to display. .. warning:...
stack_v2_sparse_classes_36k_train_002045
5,731
permissive
[ { "docstring": "Provides the dataset that the printer may understand. :param limit: Maximum number of registrars to display. .. warning:: If set to :code:`None`, all registrars will be displayed. :raise ValueError: When the current testing mode is not supported (yet?).", "name": "get_dataset_for_printer", ...
2
stack_v2_sparse_classes_30k_train_008609
Implement the Python class `RegistrarCounter` described below. Class description: Provides our registrar stats counter. Method signatures and docstrings: - def get_dataset_for_printer(self, *, limit: Optional[int]=15) -> List[Dict[str, Union[str, int]]]: Provides the dataset that the printer may understand. :param li...
Implement the Python class `RegistrarCounter` described below. Class description: Provides our registrar stats counter. Method signatures and docstrings: - def get_dataset_for_printer(self, *, limit: Optional[int]=15) -> List[Dict[str, Union[str, int]]]: Provides the dataset that the printer may understand. :param li...
214a57d0eca3df7c4ed3421937aaff9998452ba6
<|skeleton|> class RegistrarCounter: """Provides our registrar stats counter.""" def get_dataset_for_printer(self, *, limit: Optional[int]=15) -> List[Dict[str, Union[str, int]]]: """Provides the dataset that the printer may understand. :param limit: Maximum number of registrars to display. .. warning:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RegistrarCounter: """Provides our registrar stats counter.""" def get_dataset_for_printer(self, *, limit: Optional[int]=15) -> List[Dict[str, Union[str, int]]]: """Provides the dataset that the printer may understand. :param limit: Maximum number of registrars to display. .. warning:: If set to :...
the_stack_v2_python_sparse
PyFunceble/cli/filesystem/registrar_counter.py
funilrys/PyFunceble
train
267
b6c9b93c5f37b81f09f14ed995acbaa3151081e4
[ "self.is_file_like = is_file_like(path)\nif not self.is_file_like:\n self.lock_path = path + '.lock'\n self._fhandle = None", "if self.is_file_like:\n return\nself._fhandle = open(self.lock_path, 'wb+')\nif sys.platform.startswith('win'):\n locked = False\n while not locked:\n try:\n ...
<|body_start_0|> self.is_file_like = is_file_like(path) if not self.is_file_like: self.lock_path = path + '.lock' self._fhandle = None <|end_body_0|> <|body_start_1|> if self.is_file_like: return self._fhandle = open(self.lock_path, 'wb+') if ...
Context manager that locks a file for exclusive access. Has no effect for file-like objects.
LockFile
[ "Apache-2.0", "BSD-3-Clause", "MIT", "ISC", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LockFile: """Context manager that locks a file for exclusive access. Has no effect for file-like objects.""" def __init__(self, path): """Args: path (str): The path to the file.""" <|body_0|> def __enter__(self): """Locks the file by creating a temporary `.lock` ...
stack_v2_sparse_classes_36k_train_002046
32,552
permissive
[ { "docstring": "Args: path (str): The path to the file.", "name": "__init__", "signature": "def __init__(self, path)" }, { "docstring": "Locks the file by creating a temporary `.lock` file and acquiring exclusive access to it. Returns: file-like: The open file object.", "name": "__enter__", ...
3
null
Implement the Python class `LockFile` described below. Class description: Context manager that locks a file for exclusive access. Has no effect for file-like objects. Method signatures and docstrings: - def __init__(self, path): Args: path (str): The path to the file. - def __enter__(self): Locks the file by creating...
Implement the Python class `LockFile` described below. Class description: Context manager that locks a file for exclusive access. Has no effect for file-like objects. Method signatures and docstrings: - def __init__(self, path): Args: path (str): The path to the file. - def __enter__(self): Locks the file by creating...
a167852705d74bcc619d8fad0af4b9e4d84472fc
<|skeleton|> class LockFile: """Context manager that locks a file for exclusive access. Has no effect for file-like objects.""" def __init__(self, path): """Args: path (str): The path to the file.""" <|body_0|> def __enter__(self): """Locks the file by creating a temporary `.lock` ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LockFile: """Context manager that locks a file for exclusive access. Has no effect for file-like objects.""" def __init__(self, path): """Args: path (str): The path to the file.""" self.is_file_like = is_file_like(path) if not self.is_file_like: self.lock_path = path +...
the_stack_v2_python_sparse
tools/Polygraphy/polygraphy/util/util.py
NVIDIA/TensorRT
train
8,026
6067b81e6ccab6b69e1aeef871c46e5840f13c7d
[ "self.id = None\nself.original = False\nself.save()\nreturn self", "title = self.title.encode('utf-8')\ndescription = self.description.encode('utf-8')\nattribution = self.attribution.encode('utf-8')\nif self.type == 'ImageAsset' or self.type == 'DocumentAsset':\n link = 'NA'\nelse:\n link = self.link\nasset...
<|body_start_0|> self.id = None self.original = False self.save() return self <|end_body_0|> <|body_start_1|> title = self.title.encode('utf-8') description = self.description.encode('utf-8') attribution = self.attribution.encode('utf-8') if self.type == ...
Base class for facet-attaching asset metadata. Used for asset types that are attached to facets.
BaseAssetMetadata
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseAssetMetadata: """Base class for facet-attaching asset metadata. Used for asset types that are attached to facets.""" def copy(self): """Create a copy of an asset for a partner organization in a network. Copied assets keep all associated information. Organization is set to the co...
stack_v2_sparse_classes_36k_train_002047
16,062
permissive
[ { "docstring": "Create a copy of an asset for a partner organization in a network. Copied assets keep all associated information. Organization is set to the copier's organization and the original flag is set to false. Triggering a copy also triggers the creation of an asset copy detail record.", "name": "co...
2
null
Implement the Python class `BaseAssetMetadata` described below. Class description: Base class for facet-attaching asset metadata. Used for asset types that are attached to facets. Method signatures and docstrings: - def copy(self): Create a copy of an asset for a partner organization in a network. Copied assets keep ...
Implement the Python class `BaseAssetMetadata` described below. Class description: Base class for facet-attaching asset metadata. Used for asset types that are attached to facets. Method signatures and docstrings: - def copy(self): Create a copy of an asset for a partner organization in a network. Copied assets keep ...
dc6bc79d450f7e2bdf59cfbcd306d05a736e4db9
<|skeleton|> class BaseAssetMetadata: """Base class for facet-attaching asset metadata. Used for asset types that are attached to facets.""" def copy(self): """Create a copy of an asset for a partner organization in a network. Copied assets keep all associated information. Organization is set to the co...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BaseAssetMetadata: """Base class for facet-attaching asset metadata. Used for asset types that are attached to facets.""" def copy(self): """Create a copy of an asset for a partner organization in a network. Copied assets keep all associated information. Organization is set to the copier's organi...
the_stack_v2_python_sparse
project/editorial/models/assets.py
ProjectFacet/facet
train
25
88e0c9d9ca285bac4f8f2bf240699cbefa642988
[ "super(GapminderOperator, self).__init__(*args, **kwargs)\nself.aws_credentials_id = aws_credentials_id\nself.s3_bucket = s3_bucket\nself.origin_s3_folder = origin_s3_folder\nself.destination_s3_folder = destination_s3_folder", "aws_hook = AwsHook(self.aws_credentials_id)\ncredentials = aws_hook.get_credentials()...
<|body_start_0|> super(GapminderOperator, self).__init__(*args, **kwargs) self.aws_credentials_id = aws_credentials_id self.s3_bucket = s3_bucket self.origin_s3_folder = origin_s3_folder self.destination_s3_folder = destination_s3_folder <|end_body_0|> <|body_start_1|> a...
GapminderOperator
[ "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GapminderOperator: def __init__(self, aws_credentials_id, s3_bucket, origin_s3_folder, destination_s3_folder, *args, **kwargs): """init method args: self: origin_s3_folder: destination_s3_folder: *args: **kwargs:""" <|body_0|> def execute(self, context): """Read gapm...
stack_v2_sparse_classes_36k_train_002048
2,611
permissive
[ { "docstring": "init method args: self: origin_s3_folder: destination_s3_folder: *args: **kwargs:", "name": "__init__", "signature": "def __init__(self, aws_credentials_id, s3_bucket, origin_s3_folder, destination_s3_folder, *args, **kwargs)" }, { "docstring": "Read gapminder source files and jo...
2
stack_v2_sparse_classes_30k_train_005826
Implement the Python class `GapminderOperator` described below. Class description: Implement the GapminderOperator class. Method signatures and docstrings: - def __init__(self, aws_credentials_id, s3_bucket, origin_s3_folder, destination_s3_folder, *args, **kwargs): init method args: self: origin_s3_folder: destinati...
Implement the Python class `GapminderOperator` described below. Class description: Implement the GapminderOperator class. Method signatures and docstrings: - def __init__(self, aws_credentials_id, s3_bucket, origin_s3_folder, destination_s3_folder, *args, **kwargs): init method args: self: origin_s3_folder: destinati...
ee67a63dfccb671097f1343ce5b80a0a7a76646c
<|skeleton|> class GapminderOperator: def __init__(self, aws_credentials_id, s3_bucket, origin_s3_folder, destination_s3_folder, *args, **kwargs): """init method args: self: origin_s3_folder: destination_s3_folder: *args: **kwargs:""" <|body_0|> def execute(self, context): """Read gapm...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GapminderOperator: def __init__(self, aws_credentials_id, s3_bucket, origin_s3_folder, destination_s3_folder, *args, **kwargs): """init method args: self: origin_s3_folder: destination_s3_folder: *args: **kwargs:""" super(GapminderOperator, self).__init__(*args, **kwargs) self.aws_cred...
the_stack_v2_python_sparse
airflow/plugins/operators/gapminder.py
mwalbers1/DEND-Capstone-Project
train
0
c22612ba9a20e5bf9210ea82855f030e48f166bf
[ "self.disk_file_name = disk_file_name\nself.length = length\nself.lvm_data_offset = lvm_data_offset\nself.offset = offset\nself.partition_number = partition_number", "if dictionary is None:\n return None\ndisk_file_name = dictionary.get('diskFileName')\nlength = dictionary.get('length')\nlvm_data_offset = dict...
<|body_start_0|> self.disk_file_name = disk_file_name self.length = length self.lvm_data_offset = lvm_data_offset self.offset = offset self.partition_number = partition_number <|end_body_0|> <|body_start_1|> if dictionary is None: return None disk_fil...
Implementation of the 'DeviceTree_PartitionSlice' model. TODO: type description here. Attributes: disk_file_name (string): The disk to use. length (long|int): The length of data for the LVM volume (for which this device tree is being built) in bytes. It does not include size of the LVM meta data. lvm_data_offset (long|...
DeviceTree_PartitionSlice
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeviceTree_PartitionSlice: """Implementation of the 'DeviceTree_PartitionSlice' model. TODO: type description here. Attributes: disk_file_name (string): The disk to use. length (long|int): The length of data for the LVM volume (for which this device tree is being built) in bytes. It does not incl...
stack_v2_sparse_classes_36k_train_002049
3,020
permissive
[ { "docstring": "Constructor for the DeviceTree_PartitionSlice class", "name": "__init__", "signature": "def __init__(self, disk_file_name=None, length=None, lvm_data_offset=None, offset=None, partition_number=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dic...
2
stack_v2_sparse_classes_30k_train_015810
Implement the Python class `DeviceTree_PartitionSlice` described below. Class description: Implementation of the 'DeviceTree_PartitionSlice' model. TODO: type description here. Attributes: disk_file_name (string): The disk to use. length (long|int): The length of data for the LVM volume (for which this device tree is ...
Implement the Python class `DeviceTree_PartitionSlice` described below. Class description: Implementation of the 'DeviceTree_PartitionSlice' model. TODO: type description here. Attributes: disk_file_name (string): The disk to use. length (long|int): The length of data for the LVM volume (for which this device tree is ...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class DeviceTree_PartitionSlice: """Implementation of the 'DeviceTree_PartitionSlice' model. TODO: type description here. Attributes: disk_file_name (string): The disk to use. length (long|int): The length of data for the LVM volume (for which this device tree is being built) in bytes. It does not incl...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DeviceTree_PartitionSlice: """Implementation of the 'DeviceTree_PartitionSlice' model. TODO: type description here. Attributes: disk_file_name (string): The disk to use. length (long|int): The length of data for the LVM volume (for which this device tree is being built) in bytes. It does not include size of t...
the_stack_v2_python_sparse
cohesity_management_sdk/models/device_tree_partition_slice.py
cohesity/management-sdk-python
train
24
7e62e6c49f8f2778fee55552069eed9614fe3032
[ "def postorder(root):\n return postorder(root.left) + postorder(root.right) + [root.val] if root else []\nreturn ' '.join(map(str, postorder(root)))", "def helper(lower=float('-inf'), upper=float('inf')):\n if not data or data[-1] < lower or data[-1] > upper:\n return None\n val = data.pop()\n ...
<|body_start_0|> def postorder(root): return postorder(root.left) + postorder(root.right) + [root.val] if root else [] return ' '.join(map(str, postorder(root))) <|end_body_0|> <|body_start_1|> def helper(lower=float('-inf'), upper=float('inf')): if not data or data[-1] ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string.""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree.""" <|body_1|> <|end_skeleton|> <|body_start_0|> def postorder(root): return postorde...
stack_v2_sparse_classes_36k_train_002050
4,762
no_license
[ { "docstring": "Encodes a tree to a single string.", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree.", "name": "deserialize", "signature": "def deserialize(self, data)" } ]
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. - def deserialize(self, data): Decodes your encoded data to tree.
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. - def deserialize(self, data): Decodes your encoded data to tree. <|skeleton|> class Codec: def serialize(self, root...
59f70dc4466e15df591ba285317e4a1fe808ed60
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string.""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string.""" def postorder(root): return postorder(root.left) + postorder(root.right) + [root.val] if root else [] return ' '.join(map(str, postorder(root))) def deserialize(self, data): """Decodes y...
the_stack_v2_python_sparse
leet/amazon/trees_and_graphs/449_serialize_and_deserialize_BST.py
arsamigullin/problem_solving_python
train
0
a461012fb8541aad5ab4a128e2fbd183565633cb
[ "input_json, output_json = (request.data['APIParams'], {})\noutput_json['AuthenticationDetails'] = request.data['AuthenticationDetails']\nfetch_all_state = self.fetch_states(input_json)\nif fetch_all_state.data['Status'] == 'Success':\n payload_details = {'states_details': fetch_all_state.data['States']}\n ou...
<|body_start_0|> input_json, output_json = (request.data['APIParams'], {}) output_json['AuthenticationDetails'] = request.data['AuthenticationDetails'] fetch_all_state = self.fetch_states(input_json) if fetch_all_state.data['Status'] == 'Success': payload_details = {'states_d...
This API cover for fetch all states.
GetAllStatesAPI
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GetAllStatesAPI: """This API cover for fetch all states.""" def post(self, request): """This API cover for fetch all states.""" <|body_0|> def fetch_states(self, request): """Function to fetch states into database.""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_002051
1,702
no_license
[ { "docstring": "This API cover for fetch all states.", "name": "post", "signature": "def post(self, request)" }, { "docstring": "Function to fetch states into database.", "name": "fetch_states", "signature": "def fetch_states(self, request)" } ]
2
null
Implement the Python class `GetAllStatesAPI` described below. Class description: This API cover for fetch all states. Method signatures and docstrings: - def post(self, request): This API cover for fetch all states. - def fetch_states(self, request): Function to fetch states into database.
Implement the Python class `GetAllStatesAPI` described below. Class description: This API cover for fetch all states. Method signatures and docstrings: - def post(self, request): This API cover for fetch all states. - def fetch_states(self, request): Function to fetch states into database. <|skeleton|> class GetAllS...
36eb9931f330e64902354c6fc471be2adf4b7049
<|skeleton|> class GetAllStatesAPI: """This API cover for fetch all states.""" def post(self, request): """This API cover for fetch all states.""" <|body_0|> def fetch_states(self, request): """Function to fetch states into database.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GetAllStatesAPI: """This API cover for fetch all states.""" def post(self, request): """This API cover for fetch all states.""" input_json, output_json = (request.data['APIParams'], {}) output_json['AuthenticationDetails'] = request.data['AuthenticationDetails'] fetch_all_...
the_stack_v2_python_sparse
Generic/common/location/api/getallstatesdetails/views_getallstatesdetails.py
archiemb303/common_backend_django
train
0
fc819d780b30cede16ea0532aa49d0e80ae36b0d
[ "if commit_message is None:\n if 'Model' in self.__class__.__name__:\n commit_message = 'Upload model'\n elif 'Scheduler' in self.__class__.__name__:\n commit_message = 'Upload scheduler'\n else:\n commit_message = f'Upload {self.__class__.__name__}'\nlogger.info(f'Uploading the files ...
<|body_start_0|> if commit_message is None: if 'Model' in self.__class__.__name__: commit_message = 'Upload model' elif 'Scheduler' in self.__class__.__name__: commit_message = 'Upload scheduler' else: commit_message = f'Upload ...
A Mixin to push a model, scheduler, or pipeline to the Hugging Face Hub.
PushToHubMixin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PushToHubMixin: """A Mixin to push a model, scheduler, or pipeline to the Hugging Face Hub.""" def _upload_folder(self, working_dir: Union[str, os.PathLike], repo_id: str, token: Optional[str]=None, commit_message: Optional[str]=None, create_pr: bool=False): """Uploads all files in `...
stack_v2_sparse_classes_36k_train_002052
19,582
permissive
[ { "docstring": "Uploads all files in `working_dir` to `repo_id`.", "name": "_upload_folder", "signature": "def _upload_folder(self, working_dir: Union[str, os.PathLike], repo_id: str, token: Optional[str]=None, commit_message: Optional[str]=None, create_pr: bool=False)" }, { "docstring": "Upload...
2
null
Implement the Python class `PushToHubMixin` described below. Class description: A Mixin to push a model, scheduler, or pipeline to the Hugging Face Hub. Method signatures and docstrings: - def _upload_folder(self, working_dir: Union[str, os.PathLike], repo_id: str, token: Optional[str]=None, commit_message: Optional[...
Implement the Python class `PushToHubMixin` described below. Class description: A Mixin to push a model, scheduler, or pipeline to the Hugging Face Hub. Method signatures and docstrings: - def _upload_folder(self, working_dir: Union[str, os.PathLike], repo_id: str, token: Optional[str]=None, commit_message: Optional[...
5eeedd9e3336882d598091e191559f67433b6427
<|skeleton|> class PushToHubMixin: """A Mixin to push a model, scheduler, or pipeline to the Hugging Face Hub.""" def _upload_folder(self, working_dir: Union[str, os.PathLike], repo_id: str, token: Optional[str]=None, commit_message: Optional[str]=None, create_pr: bool=False): """Uploads all files in `...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PushToHubMixin: """A Mixin to push a model, scheduler, or pipeline to the Hugging Face Hub.""" def _upload_folder(self, working_dir: Union[str, os.PathLike], repo_id: str, token: Optional[str]=None, commit_message: Optional[str]=None, create_pr: bool=False): """Uploads all files in `working_dir` ...
the_stack_v2_python_sparse
src/diffusers/utils/hub_utils.py
huggingface/diffusers
train
17,308
5cff84b7117c41c348f0ef325cdf2951fdf99b78
[ "try:\n return get_cultural_object_json(get_cultural_object(culturalobject_id))\nexcept ObjectNotFoundException as c:\n return ('Error:{0}'.format(c), 404)\nexcept Exception as e:\n return ('Error:{0}'.format(e), 500)", "json_data = request.json\ntry:\n culturalobject_update(culturalobject_id, json_da...
<|body_start_0|> try: return get_cultural_object_json(get_cultural_object(culturalobject_id)) except ObjectNotFoundException as c: return ('Error:{0}'.format(c), 404) except Exception as e: return ('Error:{0}'.format(e), 500) <|end_body_0|> <|body_start_1|> ...
Collection
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Collection: def get(self, culturalobject_id): """Fetch a given Cultural Object""" <|body_0|> def post(self, culturalobject_id): """Update a given Cultural Object""" <|body_1|> def delete(self, culturalobject_id): """Delete a given Cultural Object...
stack_v2_sparse_classes_36k_train_002053
3,320
no_license
[ { "docstring": "Fetch a given Cultural Object", "name": "get", "signature": "def get(self, culturalobject_id)" }, { "docstring": "Update a given Cultural Object", "name": "post", "signature": "def post(self, culturalobject_id)" }, { "docstring": "Delete a given Cultural Object", ...
3
stack_v2_sparse_classes_30k_train_019286
Implement the Python class `Collection` described below. Class description: Implement the Collection class. Method signatures and docstrings: - def get(self, culturalobject_id): Fetch a given Cultural Object - def post(self, culturalobject_id): Update a given Cultural Object - def delete(self, culturalobject_id): Del...
Implement the Python class `Collection` described below. Class description: Implement the Collection class. Method signatures and docstrings: - def get(self, culturalobject_id): Fetch a given Cultural Object - def post(self, culturalobject_id): Update a given Cultural Object - def delete(self, culturalobject_id): Del...
a7a5f86fb7617f8c8d11526a6213f3d958a4a65d
<|skeleton|> class Collection: def get(self, culturalobject_id): """Fetch a given Cultural Object""" <|body_0|> def post(self, culturalobject_id): """Update a given Cultural Object""" <|body_1|> def delete(self, culturalobject_id): """Delete a given Cultural Object...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Collection: def get(self, culturalobject_id): """Fetch a given Cultural Object""" try: return get_cultural_object_json(get_cultural_object(culturalobject_id)) except ObjectNotFoundException as c: return ('Error:{0}'.format(c), 404) except Exception as e:...
the_stack_v2_python_sparse
controller/CulturalObjectController.py
monica-gatti/Vasari
train
1
f72a5dc52dd5d6d089341b9ff7d54c93685556d4
[ "form = super().get_form(request, obj=obj, change=change, **kwargs)\nplaceholder_id = request.GET.get('placeholder_id')\nif not placeholder_id and (not obj):\n return form\nif placeholder_id:\n placeholder = Placeholder.objects.only('slot').get(id=placeholder_id)\nelse:\n placeholder = obj.placeholder\nfor...
<|body_start_0|> form = super().get_form(request, obj=obj, change=change, **kwargs) placeholder_id = request.GET.get('placeholder_id') if not placeholder_id and (not obj): return form if placeholder_id: placeholder = Placeholder.objects.only('slot').get(id=placeho...
A plugin to add text with CKEditor widget.
CKEditorPlugin
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CKEditorPlugin: """A plugin to add text with CKEditor widget.""" def get_form(self, request, obj=None, change=False, **kwargs): """Add an HTML max length validator and/or a CKEditor configuration based on what is configured in settings for the current placeholder.""" <|body_0...
stack_v2_sparse_classes_36k_train_002054
2,489
permissive
[ { "docstring": "Add an HTML max length validator and/or a CKEditor configuration based on what is configured in settings for the current placeholder.", "name": "get_form", "signature": "def get_form(self, request, obj=None, change=False, **kwargs)" }, { "docstring": "Build plugin context passed ...
2
stack_v2_sparse_classes_30k_train_021111
Implement the Python class `CKEditorPlugin` described below. Class description: A plugin to add text with CKEditor widget. Method signatures and docstrings: - def get_form(self, request, obj=None, change=False, **kwargs): Add an HTML max length validator and/or a CKEditor configuration based on what is configured in ...
Implement the Python class `CKEditorPlugin` described below. Class description: A plugin to add text with CKEditor widget. Method signatures and docstrings: - def get_form(self, request, obj=None, change=False, **kwargs): Add an HTML max length validator and/or a CKEditor configuration based on what is configured in ...
f2d46fc46b271eb3b4d565039a29c15ba15f027c
<|skeleton|> class CKEditorPlugin: """A plugin to add text with CKEditor widget.""" def get_form(self, request, obj=None, change=False, **kwargs): """Add an HTML max length validator and/or a CKEditor configuration based on what is configured in settings for the current placeholder.""" <|body_0...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CKEditorPlugin: """A plugin to add text with CKEditor widget.""" def get_form(self, request, obj=None, change=False, **kwargs): """Add an HTML max length validator and/or a CKEditor configuration based on what is configured in settings for the current placeholder.""" form = super().get_fo...
the_stack_v2_python_sparse
src/richie/plugins/simple_text_ckeditor/cms_plugins.py
openfun/richie
train
238
b4d78528fb80f06763b588157ee35e7f3a4ca7df
[ "external_temp_dir = tempfile.mkdtemp()\ntry:\n external_temp_file = os.path.join(external_temp_dir, 'test.txt')\n with open(external_temp_file, 'w', encoding='utf-8') as fd:\n fd.write('HI')\n link_dir = os.path.join(self.tmp_dir, 'foo', 'link_dir')\n MakeSymLink(external_temp_file, link_dir)\n ...
<|body_start_0|> external_temp_dir = tempfile.mkdtemp() try: external_temp_file = os.path.join(external_temp_dir, 'test.txt') with open(external_temp_file, 'w', encoding='utf-8') as fd: fd.write('HI') link_dir = os.path.join(self.tmp_dir, 'foo', 'link_...
WinSymlinkTest
[ "Apache-2.0", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WinSymlinkTest: def testRmtreeOsWalkDoesNotFollowSymlinks(self): """_RmtreeOsWalk(...) will delete the symlink and not the target.""" <|body_0|> def testRmtreeCmdShellDoesNotFollowSymlinks(self): """_RmtreeShellCmd(...) will delete the symlink and not the target.""" ...
stack_v2_sparse_classes_36k_train_002055
3,426
permissive
[ { "docstring": "_RmtreeOsWalk(...) will delete the symlink and not the target.", "name": "testRmtreeOsWalkDoesNotFollowSymlinks", "signature": "def testRmtreeOsWalkDoesNotFollowSymlinks(self)" }, { "docstring": "_RmtreeShellCmd(...) will delete the symlink and not the target.", "name": "test...
2
null
Implement the Python class `WinSymlinkTest` described below. Class description: Implement the WinSymlinkTest class. Method signatures and docstrings: - def testRmtreeOsWalkDoesNotFollowSymlinks(self): _RmtreeOsWalk(...) will delete the symlink and not the target. - def testRmtreeCmdShellDoesNotFollowSymlinks(self): _...
Implement the Python class `WinSymlinkTest` described below. Class description: Implement the WinSymlinkTest class. Method signatures and docstrings: - def testRmtreeOsWalkDoesNotFollowSymlinks(self): _RmtreeOsWalk(...) will delete the symlink and not the target. - def testRmtreeCmdShellDoesNotFollowSymlinks(self): _...
acefdaaadd3ef46f10f63d1acae2259e4024d383
<|skeleton|> class WinSymlinkTest: def testRmtreeOsWalkDoesNotFollowSymlinks(self): """_RmtreeOsWalk(...) will delete the symlink and not the target.""" <|body_0|> def testRmtreeCmdShellDoesNotFollowSymlinks(self): """_RmtreeShellCmd(...) will delete the symlink and not the target.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WinSymlinkTest: def testRmtreeOsWalkDoesNotFollowSymlinks(self): """_RmtreeOsWalk(...) will delete the symlink and not the target.""" external_temp_dir = tempfile.mkdtemp() try: external_temp_file = os.path.join(external_temp_dir, 'test.txt') with open(external_...
the_stack_v2_python_sparse
starboard/tools/win_symlink_test.py
youtube/cobalt
train
169
1ebceb2fdd906911c4612106a12f4a899d3a51ec
[ "ctx = super().get_context_data(**kwargs)\nsquare_settings = SquareSettings.get_settings()\nctx['square_form'] = kwargs.get('square_form', forms.SquareNonceForm())\nctx['square_app'] = square_settings.application_id\nreturn ctx", "submission = self.build_submission()\nif submission['payment_kwargs']['nonce']:\n ...
<|body_start_0|> ctx = super().get_context_data(**kwargs) square_settings = SquareSettings.get_settings() ctx['square_form'] = kwargs.get('square_form', forms.SquareNonceForm()) ctx['square_app'] = square_settings.application_id return ctx <|end_body_0|> <|body_start_1|> ...
Enable our site to accept payments
PaymentDetailsView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PaymentDetailsView: """Enable our site to accept payments""" def get_context_data(self, **kwargs): """Provide the square nonce form in context""" <|body_0|> def handle_place_order_submission(self, request): """Handle Square payment form submission""" <|bo...
stack_v2_sparse_classes_36k_train_002056
2,490
no_license
[ { "docstring": "Provide the square nonce form in context", "name": "get_context_data", "signature": "def get_context_data(self, **kwargs)" }, { "docstring": "Handle Square payment form submission", "name": "handle_place_order_submission", "signature": "def handle_place_order_submission(s...
3
stack_v2_sparse_classes_30k_train_002523
Implement the Python class `PaymentDetailsView` described below. Class description: Enable our site to accept payments Method signatures and docstrings: - def get_context_data(self, **kwargs): Provide the square nonce form in context - def handle_place_order_submission(self, request): Handle Square payment form submi...
Implement the Python class `PaymentDetailsView` described below. Class description: Enable our site to accept payments Method signatures and docstrings: - def get_context_data(self, **kwargs): Provide the square nonce form in context - def handle_place_order_submission(self, request): Handle Square payment form submi...
f7bf3c61407da53d2c2d0142790dce4ccb94ee33
<|skeleton|> class PaymentDetailsView: """Enable our site to accept payments""" def get_context_data(self, **kwargs): """Provide the square nonce form in context""" <|body_0|> def handle_place_order_submission(self, request): """Handle Square payment form submission""" <|bo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PaymentDetailsView: """Enable our site to accept payments""" def get_context_data(self, **kwargs): """Provide the square nonce form in context""" ctx = super().get_context_data(**kwargs) square_settings = SquareSettings.get_settings() ctx['square_form'] = kwargs.get('squar...
the_stack_v2_python_sparse
cart/checkout/views.py
lo-windigo/duxdekes.com
train
0
c79bbf7ec731182ace441f1be630a3d4b9cbbc35
[ "self.win = win\nself.data = {}\nwith open('level.json', 'r') as _input:\n self.data = json.load(_input)\nself.level = 0\nself.kills = 0\nself.maxlvl = maxlvl\nself.sourceFileDir = os.path.dirname(os.path.abspath(__file__))\nself.godmode = godmode", "pygame.mixer.music.stop()\npygame.mouse.set_cursor(*pygame.c...
<|body_start_0|> self.win = win self.data = {} with open('level.json', 'r') as _input: self.data = json.load(_input) self.level = 0 self.kills = 0 self.maxlvl = maxlvl self.sourceFileDir = os.path.dirname(os.path.abspath(__file__)) self.godmode...
Run
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Run: def __init__(self, win, maxlvl=14, godmode=False): """Konstruktor Run Objekt Args: win (pygame.window): Das Fenster maxlvl (int, optional): Maximales Level. Defaults to 14. godmode (bool, optional): Soll der Godmode aktiviert sein. Defaults to False.""" <|body_0|> def r...
stack_v2_sparse_classes_36k_train_002057
3,257
no_license
[ { "docstring": "Konstruktor Run Objekt Args: win (pygame.window): Das Fenster maxlvl (int, optional): Maximales Level. Defaults to 14. godmode (bool, optional): Soll der Godmode aktiviert sein. Defaults to False.", "name": "__init__", "signature": "def __init__(self, win, maxlvl=14, godmode=False)" },...
2
stack_v2_sparse_classes_30k_train_019688
Implement the Python class `Run` described below. Class description: Implement the Run class. Method signatures and docstrings: - def __init__(self, win, maxlvl=14, godmode=False): Konstruktor Run Objekt Args: win (pygame.window): Das Fenster maxlvl (int, optional): Maximales Level. Defaults to 14. godmode (bool, opt...
Implement the Python class `Run` described below. Class description: Implement the Run class. Method signatures and docstrings: - def __init__(self, win, maxlvl=14, godmode=False): Konstruktor Run Objekt Args: win (pygame.window): Das Fenster maxlvl (int, optional): Maximales Level. Defaults to 14. godmode (bool, opt...
e7a922563413618920a5087033cf1a87af7bb420
<|skeleton|> class Run: def __init__(self, win, maxlvl=14, godmode=False): """Konstruktor Run Objekt Args: win (pygame.window): Das Fenster maxlvl (int, optional): Maximales Level. Defaults to 14. godmode (bool, optional): Soll der Godmode aktiviert sein. Defaults to False.""" <|body_0|> def r...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Run: def __init__(self, win, maxlvl=14, godmode=False): """Konstruktor Run Objekt Args: win (pygame.window): Das Fenster maxlvl (int, optional): Maximales Level. Defaults to 14. godmode (bool, optional): Soll der Godmode aktiviert sein. Defaults to False.""" self.win = win self.data = ...
the_stack_v2_python_sparse
Run.py
JNYscript/Neon_Rush
train
0
1c5dbc3157d316e4c59177ed1004b4d71e1ed12d
[ "if not head or not head.next:\n return head\nfastNode, slowNode = (head.next, head)\nwhile fastNode and fastNode.next:\n fastNode = fastNode.next.next\n slowNode = slowNode.next\nsecondHalf = slowNode.next\nslowNode.next = None\nleftHalf = self.sortList(head)\nrightHalf = self.sortList(secondHalf)\nreturn...
<|body_start_0|> if not head or not head.next: return head fastNode, slowNode = (head.next, head) while fastNode and fastNode.next: fastNode = fastNode.next.next slowNode = slowNode.next secondHalf = slowNode.next slowNode.next = None l...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def sortList(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def mergeTwoLists(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not head or not ...
stack_v2_sparse_classes_36k_train_002058
1,616
permissive
[ { "docstring": ":type head: ListNode :rtype: ListNode", "name": "sortList", "signature": "def sortList(self, head)" }, { "docstring": ":type l1: ListNode :type l2: ListNode :rtype: ListNode", "name": "mergeTwoLists", "signature": "def mergeTwoLists(self, l1, l2)" } ]
2
stack_v2_sparse_classes_30k_train_021084
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def sortList(self, head): :type head: ListNode :rtype: ListNode - def mergeTwoLists(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def sortList(self, head): :type head: ListNode :rtype: ListNode - def mergeTwoLists(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode <|skeleton|> class Solu...
20ae1a048eddbc9a32c819cf61258e2b57572f05
<|skeleton|> class Solution: def sortList(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def mergeTwoLists(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def sortList(self, head): """:type head: ListNode :rtype: ListNode""" if not head or not head.next: return head fastNode, slowNode = (head.next, head) while fastNode and fastNode.next: fastNode = fastNode.next.next slowNode = slowNo...
the_stack_v2_python_sparse
leetcode.com/python/148_Sort_List.py
partho-maple/coding-interview-gym
train
862
b0590c699b913ada5ada8d0325d30990cf8e32d8
[ "cliente = get_cliente_id(id_cliente)\nif not cliente:\n api.abort(404)\nelse:\n return cliente", "data = request.json\ncliente = update_cliente(id_cliente, data)\nif not cliente:\n api.abort(404)\nelse:\n return cliente", "cliente = delete_cliente(id_cliente)\nif not cliente:\n api.abort(404)\ne...
<|body_start_0|> cliente = get_cliente_id(id_cliente) if not cliente: api.abort(404) else: return cliente <|end_body_0|> <|body_start_1|> data = request.json cliente = update_cliente(id_cliente, data) if not cliente: api.abort(404) ...
Cliente
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Cliente: def get(self, id_cliente): """get a cliente given its identifier""" <|body_0|> def put(self, id_cliente): """update a cliente given its identifier""" <|body_1|> def delete(self, id_cliente): """delete a cliente given its identifier""" ...
stack_v2_sparse_classes_36k_train_002059
1,821
no_license
[ { "docstring": "get a cliente given its identifier", "name": "get", "signature": "def get(self, id_cliente)" }, { "docstring": "update a cliente given its identifier", "name": "put", "signature": "def put(self, id_cliente)" }, { "docstring": "delete a cliente given its identifier...
3
stack_v2_sparse_classes_30k_val_000704
Implement the Python class `Cliente` described below. Class description: Implement the Cliente class. Method signatures and docstrings: - def get(self, id_cliente): get a cliente given its identifier - def put(self, id_cliente): update a cliente given its identifier - def delete(self, id_cliente): delete a cliente gi...
Implement the Python class `Cliente` described below. Class description: Implement the Cliente class. Method signatures and docstrings: - def get(self, id_cliente): get a cliente given its identifier - def put(self, id_cliente): update a cliente given its identifier - def delete(self, id_cliente): delete a cliente gi...
e3e6d716102280e73932e5eba65b2ff27eec45e0
<|skeleton|> class Cliente: def get(self, id_cliente): """get a cliente given its identifier""" <|body_0|> def put(self, id_cliente): """update a cliente given its identifier""" <|body_1|> def delete(self, id_cliente): """delete a cliente given its identifier""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Cliente: def get(self, id_cliente): """get a cliente given its identifier""" cliente = get_cliente_id(id_cliente) if not cliente: api.abort(404) else: return cliente def put(self, id_cliente): """update a cliente given its identifier""" ...
the_stack_v2_python_sparse
app/main/controller/cliente_controller.py
Team-3-TCS/api-my-store
train
1
bfa8ff75a81fe185ad97c1e2198655eb6d31e7d4
[ "if not root:\n return\nso = [root]\nss = []\nwhile any(so):\n for i in xrange(len(so)):\n if so[i] is not None:\n ss.append(so[i].left)\n ss.append(so[i].right)\n if i < len(so) - 1:\n so[i].next = so[i + 1]\n else:\n so[i].next...
<|body_start_0|> if not root: return so = [root] ss = [] while any(so): for i in xrange(len(so)): if so[i] is not None: ss.append(so[i].left) ss.append(so[i].right) if i < len(so) - 1: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def connect(self, root): """:type root: TreeLinkNode :rtype: nothing""" <|body_0|> def connect(self, root): """:type root: TreeLinkNode :rtype: nothing""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not root: return ...
stack_v2_sparse_classes_36k_train_002060
2,232
no_license
[ { "docstring": ":type root: TreeLinkNode :rtype: nothing", "name": "connect", "signature": "def connect(self, root)" }, { "docstring": ":type root: TreeLinkNode :rtype: nothing", "name": "connect", "signature": "def connect(self, root)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def connect(self, root): :type root: TreeLinkNode :rtype: nothing - def connect(self, root): :type root: TreeLinkNode :rtype: nothing
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def connect(self, root): :type root: TreeLinkNode :rtype: nothing - def connect(self, root): :type root: TreeLinkNode :rtype: nothing <|skeleton|> class Solution: def conne...
c658b78c920aa94c25b3d932cd7e46c0df82b19a
<|skeleton|> class Solution: def connect(self, root): """:type root: TreeLinkNode :rtype: nothing""" <|body_0|> def connect(self, root): """:type root: TreeLinkNode :rtype: nothing""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def connect(self, root): """:type root: TreeLinkNode :rtype: nothing""" if not root: return so = [root] ss = [] while any(so): for i in xrange(len(so)): if so[i] is not None: ss.append(so[i].left) ...
the_stack_v2_python_sparse
LeetCode/populateNextRightPterInEachNode.py
armsky/OnlineJudge
train
0
8ec52b2269eec9661f871743bdd444339ee242f0
[ "self.valid = valid\nself.building = None\nself.playerID = None", "if self.playerID == None and building == 'Settlement':\n self.building = building\n self.playerID = playerID\n return True\nelif self.playerID == playerID and self.building == 'Settlement' and (building == 'City'):\n self.building = bu...
<|body_start_0|> self.valid = valid self.building = None self.playerID = None <|end_body_0|> <|body_start_1|> if self.playerID == None and building == 'Settlement': self.building = building self.playerID = playerID return True elif self.player...
This class contains all attributes regarding game vertices and methods for altering them To Do: - Change building parameter from string to enum. Better practice
GameVertex
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GameVertex: """This class contains all attributes regarding game vertices and methods for altering them To Do: - Change building parameter from string to enum. Better practice""" def __init__(self, valid): """GameVertex.__init__() method Args: valid(bool): vertex is valid if at least...
stack_v2_sparse_classes_36k_train_002061
1,431
no_license
[ { "docstring": "GameVertex.__init__() method Args: valid(bool): vertex is valid if at least one adjacent tile is land Returns: {no return}", "name": "__init__", "signature": "def __init__(self, valid)" }, { "docstring": "Handles building of a settlement or city Args: building(str): the desired b...
2
stack_v2_sparse_classes_30k_train_006932
Implement the Python class `GameVertex` described below. Class description: This class contains all attributes regarding game vertices and methods for altering them To Do: - Change building parameter from string to enum. Better practice Method signatures and docstrings: - def __init__(self, valid): GameVertex.__init_...
Implement the Python class `GameVertex` described below. Class description: This class contains all attributes regarding game vertices and methods for altering them To Do: - Change building parameter from string to enum. Better practice Method signatures and docstrings: - def __init__(self, valid): GameVertex.__init_...
9a52fec06d166ee7d9446f1a401ec7653d199aa8
<|skeleton|> class GameVertex: """This class contains all attributes regarding game vertices and methods for altering them To Do: - Change building parameter from string to enum. Better practice""" def __init__(self, valid): """GameVertex.__init__() method Args: valid(bool): vertex is valid if at least...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GameVertex: """This class contains all attributes regarding game vertices and methods for altering them To Do: - Change building parameter from string to enum. Better practice""" def __init__(self, valid): """GameVertex.__init__() method Args: valid(bool): vertex is valid if at least one adjacent...
the_stack_v2_python_sparse
Source/gamevertex.py
qtmiller/Coders-of-Catan
train
1
f7b0421086d9db59862ad259ba0e696a74819f1e
[ "if coins == []:\n return 1 if amount == 0 else 0\nmemory = {}\n\ndef dfs(cur_amount, i):\n if (cur_amount, i) in memory:\n return memory[cur_amount, i]\n if cur_amount == amount:\n return 1\n if i == len(coins) - 1:\n if (amount - cur_amount) % coins[i] == 0:\n return 1\...
<|body_start_0|> if coins == []: return 1 if amount == 0 else 0 memory = {} def dfs(cur_amount, i): if (cur_amount, i) in memory: return memory[cur_amount, i] if cur_amount == amount: return 1 if i == len(coins) - 1...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def change(self, amount, coins): """:type amount: int :type coins: List[int] :rtype: int""" <|body_0|> def change_1(self, amount, coins): """:type amount: int :type coins: List[int] :rtype: int 280 ms""" <|body_1|> def change_2(self, amount, co...
stack_v2_sparse_classes_36k_train_002062
2,727
no_license
[ { "docstring": ":type amount: int :type coins: List[int] :rtype: int", "name": "change", "signature": "def change(self, amount, coins)" }, { "docstring": ":type amount: int :type coins: List[int] :rtype: int 280 ms", "name": "change_1", "signature": "def change_1(self, amount, coins)" ...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def change(self, amount, coins): :type amount: int :type coins: List[int] :rtype: int - def change_1(self, amount, coins): :type amount: int :type coins: List[int] :rtype: int 28...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def change(self, amount, coins): :type amount: int :type coins: List[int] :rtype: int - def change_1(self, amount, coins): :type amount: int :type coins: List[int] :rtype: int 28...
679a2b246b8b6bb7fc55ed1c8096d3047d6d4461
<|skeleton|> class Solution: def change(self, amount, coins): """:type amount: int :type coins: List[int] :rtype: int""" <|body_0|> def change_1(self, amount, coins): """:type amount: int :type coins: List[int] :rtype: int 280 ms""" <|body_1|> def change_2(self, amount, co...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def change(self, amount, coins): """:type amount: int :type coins: List[int] :rtype: int""" if coins == []: return 1 if amount == 0 else 0 memory = {} def dfs(cur_amount, i): if (cur_amount, i) in memory: return memory[cur_amou...
the_stack_v2_python_sparse
CoinChange2_MID_518.py
953250587/leetcode-python
train
2
bc8a2517aab5e48fec6888834d29d716ecc8e937
[ "if not a:\n return 0\nn = len(a)\nm = len(a[0])\nfor i in range(0, n, 1):\n for j in range(0, m, 1):\n if a[i][j] != 0:\n a = self.update_element(i, j, n, m, a)\nreturn a", "p = (i, j)\nv = set([p])\nq = deque([p])\nd = 0\nc = 0\nt = len(q)\nwhile q:\n x, y = q.popleft()\n if a[x][y...
<|body_start_0|> if not a: return 0 n = len(a) m = len(a[0]) for i in range(0, n, 1): for j in range(0, m, 1): if a[i][j] != 0: a = self.update_element(i, j, n, m, a) return a <|end_body_0|> <|body_start_1|> p =...
Iterative breadth first search (BFS) across all elements in 2D array. Time complexity: O(n * m) - Amortized iterate over all rows and columns Space complexity: O(n * m) - Amortized store all values in queue
Solution
[ "Unlicense" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """Iterative breadth first search (BFS) across all elements in 2D array. Time complexity: O(n * m) - Amortized iterate over all rows and columns Space complexity: O(n * m) - Amortized store all values in queue""" def update_matrix(self, a): """Determines minimum distance to...
stack_v2_sparse_classes_36k_train_002063
4,312
permissive
[ { "docstring": "Determines minimum distance to value \"0\" for all elements in 2D array. :param list[list[int]] a: input 2D array with elements :return: updated 2D array containing minimum distances from value \"0\" :rtype: list[list[int]]", "name": "update_matrix", "signature": "def update_matrix(self,...
3
stack_v2_sparse_classes_30k_train_001429
Implement the Python class `Solution` described below. Class description: Iterative breadth first search (BFS) across all elements in 2D array. Time complexity: O(n * m) - Amortized iterate over all rows and columns Space complexity: O(n * m) - Amortized store all values in queue Method signatures and docstrings: - d...
Implement the Python class `Solution` described below. Class description: Iterative breadth first search (BFS) across all elements in 2D array. Time complexity: O(n * m) - Amortized iterate over all rows and columns Space complexity: O(n * m) - Amortized store all values in queue Method signatures and docstrings: - d...
69f90877c5466927e8b081c4268cbcda074813ec
<|skeleton|> class Solution: """Iterative breadth first search (BFS) across all elements in 2D array. Time complexity: O(n * m) - Amortized iterate over all rows and columns Space complexity: O(n * m) - Amortized store all values in queue""" def update_matrix(self, a): """Determines minimum distance to...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: """Iterative breadth first search (BFS) across all elements in 2D array. Time complexity: O(n * m) - Amortized iterate over all rows and columns Space complexity: O(n * m) - Amortized store all values in queue""" def update_matrix(self, a): """Determines minimum distance to value "0" fo...
the_stack_v2_python_sparse
0542_01_matrix/python_source.py
arthurdysart/LeetCode
train
0
5b35020d867bf112d6fca90d753216f8bbb72769
[ "super().__init__(trainloader, valloader, model, num_classes, linear_layer, loss, device, logger)\nself.eta = eta\nself.device = device\nself.init_out = list()\nself.init_l1 = list()\nself.selection_type = selection_type\nself.valid = valid\nself.ss_indices = ss_indices", "omp_start_time = time.time()\nself.updat...
<|body_start_0|> super().__init__(trainloader, valloader, model, num_classes, linear_layer, loss, device, logger) self.eta = eta self.device = device self.init_out = list() self.init_l1 = list() self.selection_type = selection_type self.valid = valid self....
Implementation of GradMatch Strategy from the paper :footcite:`sivasubramanian2020gradmatch` for supervised learning frameworks. GradMatch strategy tries to solve the optimization problem given below: .. math:: \\min_{\\mathbf{w}, S: |S| \\leq k} \\Vert \\sum_{i \\in S} w_i \\nabla_{\\theta}L_T^i(\\theta) - \\nabla_{\\...
AdapWeightsStrategy
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdapWeightsStrategy: """Implementation of GradMatch Strategy from the paper :footcite:`sivasubramanian2020gradmatch` for supervised learning frameworks. GradMatch strategy tries to solve the optimization problem given below: .. math:: \\min_{\\mathbf{w}, S: |S| \\leq k} \\Vert \\sum_{i \\in S} w_...
stack_v2_sparse_classes_36k_train_002064
5,115
permissive
[ { "docstring": "Constructor method", "name": "__init__", "signature": "def __init__(self, trainloader, valloader, model, loss, eta, device, num_classes, linear_layer, selection_type, logger, ss_indices, valid=False)" }, { "docstring": "Apply OMP Algorithm for data selection Parameters ----------...
2
null
Implement the Python class `AdapWeightsStrategy` described below. Class description: Implementation of GradMatch Strategy from the paper :footcite:`sivasubramanian2020gradmatch` for supervised learning frameworks. GradMatch strategy tries to solve the optimization problem given below: .. math:: \\min_{\\mathbf{w}, S: ...
Implement the Python class `AdapWeightsStrategy` described below. Class description: Implementation of GradMatch Strategy from the paper :footcite:`sivasubramanian2020gradmatch` for supervised learning frameworks. GradMatch strategy tries to solve the optimization problem given below: .. math:: \\min_{\\mathbf{w}, S: ...
8d10c7f5d96e071f98c20e4e9ff4c41c2c4ea2af
<|skeleton|> class AdapWeightsStrategy: """Implementation of GradMatch Strategy from the paper :footcite:`sivasubramanian2020gradmatch` for supervised learning frameworks. GradMatch strategy tries to solve the optimization problem given below: .. math:: \\min_{\\mathbf{w}, S: |S| \\leq k} \\Vert \\sum_{i \\in S} w_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AdapWeightsStrategy: """Implementation of GradMatch Strategy from the paper :footcite:`sivasubramanian2020gradmatch` for supervised learning frameworks. GradMatch strategy tries to solve the optimization problem given below: .. math:: \\min_{\\mathbf{w}, S: |S| \\leq k} \\Vert \\sum_{i \\in S} w_i \\nabla_{\\...
the_stack_v2_python_sparse
cords/selectionstrategies/SL/adapweightsstrategy.py
decile-team/cords
train
289
d1e816ae2201f112f22607de404a53ca968d9ca1
[ "self.name = name\nself.new_parent_id = new_parent_id\nself.objects = objects\nself.target = target", "if dictionary is None:\n return None\nname = dictionary.get('name')\nnew_parent_id = dictionary.get('newParentId')\nobjects = None\nif dictionary.get('objects') != None:\n objects = list()\n for structu...
<|body_start_0|> self.name = name self.new_parent_id = new_parent_id self.objects = objects self.target = target <|end_body_0|> <|body_start_1|> if dictionary is None: return None name = dictionary.get('name') new_parent_id = dictionary.get('newParent...
Implementation of the 'DeployTaskRequest' model. Specifies the settings for a Deploy Task that deploys VMs on cloud. Attributes: name (string, required): Specifies the name of the Deploy Task. This field must be set and must be a unique name. new_parent_id (long|int): Specifies a new registered parent Protection Source...
DeployTaskRequest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeployTaskRequest: """Implementation of the 'DeployTaskRequest' model. Specifies the settings for a Deploy Task that deploys VMs on cloud. Attributes: name (string, required): Specifies the name of the Deploy Task. This field must be set and must be a unique name. new_parent_id (long|int): Specif...
stack_v2_sparse_classes_36k_train_002065
3,108
permissive
[ { "docstring": "Constructor for the DeployTaskRequest class", "name": "__init__", "signature": "def __init__(self, name=None, new_parent_id=None, objects=None, target=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary represe...
2
null
Implement the Python class `DeployTaskRequest` described below. Class description: Implementation of the 'DeployTaskRequest' model. Specifies the settings for a Deploy Task that deploys VMs on cloud. Attributes: name (string, required): Specifies the name of the Deploy Task. This field must be set and must be a unique...
Implement the Python class `DeployTaskRequest` described below. Class description: Implementation of the 'DeployTaskRequest' model. Specifies the settings for a Deploy Task that deploys VMs on cloud. Attributes: name (string, required): Specifies the name of the Deploy Task. This field must be set and must be a unique...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class DeployTaskRequest: """Implementation of the 'DeployTaskRequest' model. Specifies the settings for a Deploy Task that deploys VMs on cloud. Attributes: name (string, required): Specifies the name of the Deploy Task. This field must be set and must be a unique name. new_parent_id (long|int): Specif...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DeployTaskRequest: """Implementation of the 'DeployTaskRequest' model. Specifies the settings for a Deploy Task that deploys VMs on cloud. Attributes: name (string, required): Specifies the name of the Deploy Task. This field must be set and must be a unique name. new_parent_id (long|int): Specifies a new reg...
the_stack_v2_python_sparse
cohesity_management_sdk/models/deploy_task_request.py
cohesity/management-sdk-python
train
24
178bf1529054b61326d8129953cf53bf71a4d3a4
[ "self.history = defaultdict(lambda: 0)\nfor i in xrange(len(sentences)):\n self.history[sentences[i]] += times[i]\nself.cur = ''\nself.last_result = list(self.history.iterkeys())\nself.store = {}", "if c == '#':\n self.history[self.cur] += 1\n self.cur = ''\n self.last_result = list(self.history.iterk...
<|body_start_0|> self.history = defaultdict(lambda: 0) for i in xrange(len(sentences)): self.history[sentences[i]] += times[i] self.cur = '' self.last_result = list(self.history.iterkeys()) self.store = {} <|end_body_0|> <|body_start_1|> if c == '#': ...
AutocompleteSystem
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AutocompleteSystem: def __init__(self, sentences, times): """:type sentences: List[str] :type times: List[int]""" <|body_0|> def input(self, c): """:type c: str :rtype: List[str]""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.history = default...
stack_v2_sparse_classes_36k_train_002066
1,409
no_license
[ { "docstring": ":type sentences: List[str] :type times: List[int]", "name": "__init__", "signature": "def __init__(self, sentences, times)" }, { "docstring": ":type c: str :rtype: List[str]", "name": "input", "signature": "def input(self, c)" } ]
2
null
Implement the Python class `AutocompleteSystem` described below. Class description: Implement the AutocompleteSystem class. Method signatures and docstrings: - def __init__(self, sentences, times): :type sentences: List[str] :type times: List[int] - def input(self, c): :type c: str :rtype: List[str]
Implement the Python class `AutocompleteSystem` described below. Class description: Implement the AutocompleteSystem class. Method signatures and docstrings: - def __init__(self, sentences, times): :type sentences: List[str] :type times: List[int] - def input(self, c): :type c: str :rtype: List[str] <|skeleton|> cla...
db64a67869aae4f0e55e78b65a7e04f5bc2e671c
<|skeleton|> class AutocompleteSystem: def __init__(self, sentences, times): """:type sentences: List[str] :type times: List[int]""" <|body_0|> def input(self, c): """:type c: str :rtype: List[str]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AutocompleteSystem: def __init__(self, sentences, times): """:type sentences: List[str] :type times: List[int]""" self.history = defaultdict(lambda: 0) for i in xrange(len(sentences)): self.history[sentences[i]] += times[i] self.cur = '' self.last_result = l...
the_stack_v2_python_sparse
Questiondir/642.design-search-autocomplete-system/642.design-search-autocomplete-system_109796647.py
cczhong11/Leetcode-contest-code-downloader
train
0
ae246a68495cdff4c232a4db074f2f035e99addf
[ "self.data = None\nself._config = config\nself._hass = hass\nself.devices = []\nself.initialize(utcnow())", "if self.data is None:\n self.initialize(utcnow())\nelse:\n self.refresh()", "data_url = f'http://{self._config.get(CONF_HOST)}:{self._config.get(CONF_PORT)}/data.json'\ntry:\n response = request...
<|body_start_0|> self.data = None self._config = config self._hass = hass self.devices = [] self.initialize(utcnow()) <|end_body_0|> <|body_start_1|> if self.data is None: self.initialize(utcnow()) else: self.refresh() <|end_body_1|> <|bo...
Class used to pull data from OHM and create sensors.
OpenHardwareMonitorData
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OpenHardwareMonitorData: """Class used to pull data from OHM and create sensors.""" def __init__(self, config, hass): """Initialize the Open Hardware Monitor data-handler.""" <|body_0|> def update(self): """Hit by the timer with the configured interval.""" ...
stack_v2_sparse_classes_36k_train_002067
6,124
permissive
[ { "docstring": "Initialize the Open Hardware Monitor data-handler.", "name": "__init__", "signature": "def __init__(self, config, hass)" }, { "docstring": "Hit by the timer with the configured interval.", "name": "update", "signature": "def update(self)" }, { "docstring": "Downlo...
5
null
Implement the Python class `OpenHardwareMonitorData` described below. Class description: Class used to pull data from OHM and create sensors. Method signatures and docstrings: - def __init__(self, config, hass): Initialize the Open Hardware Monitor data-handler. - def update(self): Hit by the timer with the configure...
Implement the Python class `OpenHardwareMonitorData` described below. Class description: Class used to pull data from OHM and create sensors. Method signatures and docstrings: - def __init__(self, config, hass): Initialize the Open Hardware Monitor data-handler. - def update(self): Hit by the timer with the configure...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class OpenHardwareMonitorData: """Class used to pull data from OHM and create sensors.""" def __init__(self, config, hass): """Initialize the Open Hardware Monitor data-handler.""" <|body_0|> def update(self): """Hit by the timer with the configured interval.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OpenHardwareMonitorData: """Class used to pull data from OHM and create sensors.""" def __init__(self, config, hass): """Initialize the Open Hardware Monitor data-handler.""" self.data = None self._config = config self._hass = hass self.devices = [] self.in...
the_stack_v2_python_sparse
homeassistant/components/openhardwaremonitor/sensor.py
home-assistant/core
train
35,501
259eb3ad5497a300701b7b84f5c372a9ce61641f
[ "super().__init__()\nself._logger = logging.getLogger('ConnectionDialog')\nself._logger.setLevel(LOG_LEVEL_PRINT)\nself._logger.info('Connection dialog initializing …')\nself.setWindowTitle('Connection Settings')\nself.resize(360, 240)\nself.setModal(True)\nself.initUI()\nself._logger.info('Connection dialog initia...
<|body_start_0|> super().__init__() self._logger = logging.getLogger('ConnectionDialog') self._logger.setLevel(LOG_LEVEL_PRINT) self._logger.info('Connection dialog initializing …') self.setWindowTitle('Connection Settings') self.resize(360, 240) self.setModal(Tru...
Connection Dialog. A dialog to enter the IP of the board
ConnectionDialog
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConnectionDialog: """Connection Dialog. A dialog to enter the IP of the board""" def __init__(self): """Initialize the connection dialog.""" <|body_0|> def initUI(self): """Initialize the ui of the connection dialog.""" <|body_1|> def setValues(self,...
stack_v2_sparse_classes_36k_train_002068
3,950
permissive
[ { "docstring": "Initialize the connection dialog.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Initialize the ui of the connection dialog.", "name": "initUI", "signature": "def initUI(self)" }, { "docstring": "Set the values. Values: ip, port, …", ...
4
stack_v2_sparse_classes_30k_train_003478
Implement the Python class `ConnectionDialog` described below. Class description: Connection Dialog. A dialog to enter the IP of the board Method signatures and docstrings: - def __init__(self): Initialize the connection dialog. - def initUI(self): Initialize the ui of the connection dialog. - def setValues(self, ip,...
Implement the Python class `ConnectionDialog` described below. Class description: Connection Dialog. A dialog to enter the IP of the board Method signatures and docstrings: - def __init__(self): Initialize the connection dialog. - def initUI(self): Initialize the ui of the connection dialog. - def setValues(self, ip,...
e69f0c48f32ea122dec3a84db058a33786c666c5
<|skeleton|> class ConnectionDialog: """Connection Dialog. A dialog to enter the IP of the board""" def __init__(self): """Initialize the connection dialog.""" <|body_0|> def initUI(self): """Initialize the ui of the connection dialog.""" <|body_1|> def setValues(self,...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ConnectionDialog: """Connection Dialog. A dialog to enter the IP of the board""" def __init__(self): """Initialize the connection dialog.""" super().__init__() self._logger = logging.getLogger('ConnectionDialog') self._logger.setLevel(LOG_LEVEL_PRINT) self._logger....
the_stack_v2_python_sparse
Bidirectional_interface/Haptics/Interface/src/connectionDialog.py
medioman22/Bidirectional_Interface
train
0
e98ece502c8d3a7c028760254aa435727ca16cd3
[ "boxes_scores.sort(key=lambda x: self._size_box(x[0], dataclass), reverse=True)\nidx_to_del = []\nfor idx1, (box1, score1) in enumerate(boxes_scores):\n contains = []\n for idx2, (box2, score2) in enumerate(boxes_scores):\n if box1 == box2:\n continue\n if box_in_box_dataclass(box2, b...
<|body_start_0|> boxes_scores.sort(key=lambda x: self._size_box(x[0], dataclass), reverse=True) idx_to_del = [] for idx1, (box1, score1) in enumerate(boxes_scores): contains = [] for idx2, (box2, score2) in enumerate(boxes_scores): if box1 == box2: ...
ResolveNested
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResolveNested: def resolve_nested(self, boxes_scores, dataclass): """Sort boxes_scores from biggest to smallest box. If a given box contain other boxes and among them there is at least one that has higher confidence than the given box delete the given box, otherwise delete all nested box...
stack_v2_sparse_classes_36k_train_002069
20,599
no_license
[ { "docstring": "Sort boxes_scores from biggest to smallest box. If a given box contain other boxes and among them there is at least one that has higher confidence than the given box delete the given box, otherwise delete all nested boxes Args: boxes_scores: a list of (box, score) dataclass: row/column/cell Retu...
2
stack_v2_sparse_classes_30k_train_019177
Implement the Python class `ResolveNested` described below. Class description: Implement the ResolveNested class. Method signatures and docstrings: - def resolve_nested(self, boxes_scores, dataclass): Sort boxes_scores from biggest to smallest box. If a given box contain other boxes and among them there is at least o...
Implement the Python class `ResolveNested` described below. Class description: Implement the ResolveNested class. Method signatures and docstrings: - def resolve_nested(self, boxes_scores, dataclass): Sort boxes_scores from biggest to smallest box. If a given box contain other boxes and among them there is at least o...
4c9970151294006fdafaba3c2ca84b7c04da97e7
<|skeleton|> class ResolveNested: def resolve_nested(self, boxes_scores, dataclass): """Sort boxes_scores from biggest to smallest box. If a given box contain other boxes and among them there is at least one that has higher confidence than the given box delete the given box, otherwise delete all nested box...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ResolveNested: def resolve_nested(self, boxes_scores, dataclass): """Sort boxes_scores from biggest to smallest box. If a given box contain other boxes and among them there is at least one that has higher confidence than the given box delete the given box, otherwise delete all nested boxes Args: boxes...
the_stack_v2_python_sparse
detectron2_tables/postproc_maskrcnn.py
akmaral-yes/table_structure_recognition_using_detectron2
train
4
42912a1b4d876e863cae4b560b54ba3ec39ab1b9
[ "super().__init__(*args, **kwargs)\nself._aug_numberofoptions = aug_numberofoptions\nself._aug_degreeofrotation = aug_degreeofrotation\nself._aug_linethickness = aug_linethickness\nself._aug_diameter = aug_diameter\nself._aug_amountpoints = aug_amountpoints\nself._augmentation_to_text = augmentation_to_text", "if...
<|body_start_0|> super().__init__(*args, **kwargs) self._aug_numberofoptions = aug_numberofoptions self._aug_degreeofrotation = aug_degreeofrotation self._aug_linethickness = aug_linethickness self._aug_diameter = aug_diameter self._aug_amountpoints = aug_amountpoints ...
Algorithm for full iteration: -> Backgrounds -> Texts -> Fonts and fonts sized -> Colors -> Augmentations
BTFCA
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BTFCA: """Algorithm for full iteration: -> Backgrounds -> Texts -> Fonts and fonts sized -> Colors -> Augmentations""" def __init__(self, aug_degreeofrotation: int, aug_linethickness: int, aug_numberofoptions: int, aug_diameter: int, aug_amountpoints: int, augmentation_to_text: bool=False, *...
stack_v2_sparse_classes_36k_train_002070
4,703
no_license
[ { "docstring": "Algorithm for full iteration: -> Backgrounds -> Texts -> Fonts and fonts sized -> Colors -> Augmentations :param int aug_degreeofrotation: Max text rotate :param int aug_linethickness: Thickness Augmentation Patterns :param int aug_numberofoptions: Count drw augmentation :param int aug_diameter:...
4
stack_v2_sparse_classes_30k_train_017239
Implement the Python class `BTFCA` described below. Class description: Algorithm for full iteration: -> Backgrounds -> Texts -> Fonts and fonts sized -> Colors -> Augmentations Method signatures and docstrings: - def __init__(self, aug_degreeofrotation: int, aug_linethickness: int, aug_numberofoptions: int, aug_diame...
Implement the Python class `BTFCA` described below. Class description: Algorithm for full iteration: -> Backgrounds -> Texts -> Fonts and fonts sized -> Colors -> Augmentations Method signatures and docstrings: - def __init__(self, aug_degreeofrotation: int, aug_linethickness: int, aug_numberofoptions: int, aug_diame...
368097c53053470bf6d165606c0dffd7f6256eae
<|skeleton|> class BTFCA: """Algorithm for full iteration: -> Backgrounds -> Texts -> Fonts and fonts sized -> Colors -> Augmentations""" def __init__(self, aug_degreeofrotation: int, aug_linethickness: int, aug_numberofoptions: int, aug_diameter: int, aug_amountpoints: int, augmentation_to_text: bool=False, *...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BTFCA: """Algorithm for full iteration: -> Backgrounds -> Texts -> Fonts and fonts sized -> Colors -> Augmentations""" def __init__(self, aug_degreeofrotation: int, aug_linethickness: int, aug_numberofoptions: int, aug_diameter: int, aug_amountpoints: int, augmentation_to_text: bool=False, *args, **kwarg...
the_stack_v2_python_sparse
mnist_generator/algorithms/btfca.py
nxexox/mnist-generator
train
0
7110959be2ee5ceedacd118b62ca50d7e73f81ab
[ "for base in [b for b in bases if b != object]:\n derived = cls\n attribute = '_%s__implementors' % base.__name__\n if hasattr(base, attribute):\n getattr(base, attribute).append(derived)\n else:\n setattr(base, attribute, [derived])\ncls._logger = logger.getLogger('{}.{}'.format(cls.__mod...
<|body_start_0|> for base in [b for b in bases if b != object]: derived = cls attribute = '_%s__implementors' % base.__name__ if hasattr(base, attribute): getattr(base, attribute).append(derived) else: setattr(base, attribute, [deri...
UberMeta
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UberMeta: def __init__(cls, name, bases, namespace): """Metaclass of :class:`BasicInterface`. I tell base classes when I derive a new class from them. I create a logger for each class I create. I add an `init_args` attribute to the class.""" <|body_0|> def __new__(cls, class...
stack_v2_sparse_classes_36k_train_002071
22,889
permissive
[ { "docstring": "Metaclass of :class:`BasicInterface`. I tell base classes when I derive a new class from them. I create a logger for each class I create. I add an `init_args` attribute to the class.", "name": "__init__", "signature": "def __init__(cls, name, bases, namespace)" }, { "docstring": ...
2
null
Implement the Python class `UberMeta` described below. Class description: Implement the UberMeta class. Method signatures and docstrings: - def __init__(cls, name, bases, namespace): Metaclass of :class:`BasicInterface`. I tell base classes when I derive a new class from them. I create a logger for each class I creat...
Implement the Python class `UberMeta` described below. Class description: Implement the UberMeta class. Method signatures and docstrings: - def __init__(cls, name, bases, namespace): Metaclass of :class:`BasicInterface`. I tell base classes when I derive a new class from them. I create a logger for each class I creat...
ee2806b4c93748e716294c42454d611415da7b5e
<|skeleton|> class UberMeta: def __init__(cls, name, bases, namespace): """Metaclass of :class:`BasicInterface`. I tell base classes when I derive a new class from them. I create a logger for each class I create. I add an `init_args` attribute to the class.""" <|body_0|> def __new__(cls, class...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UberMeta: def __init__(cls, name, bases, namespace): """Metaclass of :class:`BasicInterface`. I tell base classes when I derive a new class from them. I create a logger for each class I create. I add an `init_args` attribute to the class.""" for base in [b for b in bases if b != object]: ...
the_stack_v2_python_sparse
src/pymor/core/interfaces.py
mahgadalla/pymor
train
1
5a14ea8a60638680f440c7251be330c65f5a09d9
[ "self._check_workout_permissions(workout_fk)\nworkoutset_queryset = WorkoutSet.objects.filter(workout_fk=workout_fk).select_related('workout_fk', 'exercise_fk')\nserializer = WorkoutSetGetSerializer(workoutset_queryset, many=True)\nreturn Response(serializer.data)", "serializer = WorkoutSetBaseSerializer(data=req...
<|body_start_0|> self._check_workout_permissions(workout_fk) workoutset_queryset = WorkoutSet.objects.filter(workout_fk=workout_fk).select_related('workout_fk', 'exercise_fk') serializer = WorkoutSetGetSerializer(workoutset_queryset, many=True) return Response(serializer.data) <|end_body...
GET and POST using a Workout. GET - List all the WorkoutSet records for a Workout. Result includes serialized Workout and Exercise foreign key relationships POST - Create a new WorkoutSet for a Workout. Input - has special logic for weight. Result includes serialized Workout and Exercise foreign key relationships See n...
WorkoutSetList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WorkoutSetList: """GET and POST using a Workout. GET - List all the WorkoutSet records for a Workout. Result includes serialized Workout and Exercise foreign key relationships POST - Create a new WorkoutSet for a Workout. Input - has special logic for weight. Result includes serialized Workout an...
stack_v2_sparse_classes_36k_train_002072
4,956
no_license
[ { "docstring": "Retrieve all the WorkoutSet records for a given Workout.", "name": "get", "signature": "def get(self, request, workout_fk, format=None)" }, { "docstring": "Create a new WorkoutSet for a given Workout.", "name": "post", "signature": "def post(self, request, workout_fk, for...
3
stack_v2_sparse_classes_30k_train_015490
Implement the Python class `WorkoutSetList` described below. Class description: GET and POST using a Workout. GET - List all the WorkoutSet records for a Workout. Result includes serialized Workout and Exercise foreign key relationships POST - Create a new WorkoutSet for a Workout. Input - has special logic for weight...
Implement the Python class `WorkoutSetList` described below. Class description: GET and POST using a Workout. GET - List all the WorkoutSet records for a Workout. Result includes serialized Workout and Exercise foreign key relationships POST - Create a new WorkoutSet for a Workout. Input - has special logic for weight...
829e1a721e2382489f2cf0f730b2c462ecc54722
<|skeleton|> class WorkoutSetList: """GET and POST using a Workout. GET - List all the WorkoutSet records for a Workout. Result includes serialized Workout and Exercise foreign key relationships POST - Create a new WorkoutSet for a Workout. Input - has special logic for weight. Result includes serialized Workout an...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WorkoutSetList: """GET and POST using a Workout. GET - List all the WorkoutSet records for a Workout. Result includes serialized Workout and Exercise foreign key relationships POST - Create a new WorkoutSet for a Workout. Input - has special logic for weight. Result includes serialized Workout and Exercise fo...
the_stack_v2_python_sparse
bigfitnessgains/apps/mainapp/rest_api/workoutset.py
AnthonyHonstain/bigfitnessgains
train
0
e35a7ffd743fc620b43e37d34c88bbef9f7c9237
[ "np.seterr(all='ignore')\nself.debug = debug\nself.a, self.b, self.n, self.m = map(int, input().split())\nif self.n > self.m:\n self.big = self.n\nelse:\n self.big = self.m\nself.B = [0 for i in range(self.big + 1)]\nself.B[0] = 0\nself.B[1] = 1\nif self.debug:\n print('a b n m : ', self.a, self.b, self.n,...
<|body_start_0|> np.seterr(all='ignore') self.debug = debug self.a, self.b, self.n, self.m = map(int, input().split()) if self.n > self.m: self.big = self.n else: self.big = self.m self.B = [0 for i in range(self.big + 1)] self.B[0] = 0 ...
GCD and Permutatin Match url : https://codeup.kr/problem.php?id=2127 a , b, n ,m Bn = a*Bn-1 + b*Bn-2 gcd(Bn,Bm) Match Number : 998244353 Attributes ---------- n : int n>2 < 10^18 m : int m>2 < 10^18 a : int coprime < 10^18 b : int coprime < 10^18 debug : int debug mode Methods ------- __init__() input getB() compute B...
PermuMatch
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PermuMatch: """GCD and Permutatin Match url : https://codeup.kr/problem.php?id=2127 a , b, n ,m Bn = a*Bn-1 + b*Bn-2 gcd(Bn,Bm) Match Number : 998244353 Attributes ---------- n : int n>2 < 10^18 m : int m>2 < 10^18 a : int coprime < 10^18 b : int coprime < 10^18 debug : int debug mode Methods ---...
stack_v2_sparse_classes_36k_train_002073
2,020
no_license
[ { "docstring": "input", "name": "__init__", "signature": "def __init__(self, debug=0)" }, { "docstring": "Bn = a*Bn-1 + b*Bn-2", "name": "getB", "signature": "def getB(self)" }, { "docstring": "GCD GCD : 유클리드 호제법", "name": "gcd", "signature": "def gcd(self)" } ]
3
null
Implement the Python class `PermuMatch` described below. Class description: GCD and Permutatin Match url : https://codeup.kr/problem.php?id=2127 a , b, n ,m Bn = a*Bn-1 + b*Bn-2 gcd(Bn,Bm) Match Number : 998244353 Attributes ---------- n : int n>2 < 10^18 m : int m>2 < 10^18 a : int coprime < 10^18 b : int coprime < 1...
Implement the Python class `PermuMatch` described below. Class description: GCD and Permutatin Match url : https://codeup.kr/problem.php?id=2127 a , b, n ,m Bn = a*Bn-1 + b*Bn-2 gcd(Bn,Bm) Match Number : 998244353 Attributes ---------- n : int n>2 < 10^18 m : int m>2 < 10^18 a : int coprime < 10^18 b : int coprime < 1...
2fb6246be3bf48eb8ad626217300a1a9328f541a
<|skeleton|> class PermuMatch: """GCD and Permutatin Match url : https://codeup.kr/problem.php?id=2127 a , b, n ,m Bn = a*Bn-1 + b*Bn-2 gcd(Bn,Bm) Match Number : 998244353 Attributes ---------- n : int n>2 < 10^18 m : int m>2 < 10^18 a : int coprime < 10^18 b : int coprime < 10^18 debug : int debug mode Methods ---...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PermuMatch: """GCD and Permutatin Match url : https://codeup.kr/problem.php?id=2127 a , b, n ,m Bn = a*Bn-1 + b*Bn-2 gcd(Bn,Bm) Match Number : 998244353 Attributes ---------- n : int n>2 < 10^18 m : int m>2 < 10^18 a : int coprime < 10^18 b : int coprime < 10^18 debug : int debug mode Methods ------- __init__...
the_stack_v2_python_sparse
2022/4.py
cheoljoo/problemSolving
train
1
2c6417f9dd08156cca5825a6d3dd184d08658860
[ "if isinstance(block, FormFieldBlockMixin):\n return [BlockField(block, value)]\nelse:\n raise Exception('Block does not inherit from FormFieldBlockMixin.')", "form_fields = []\nfor key in block.child_blocks:\n form_fields += self.find_form_fields(block.child_blocks[key], value[key])\nreturn form_fields"...
<|body_start_0|> if isinstance(block, FormFieldBlockMixin): return [BlockField(block, value)] else: raise Exception('Block does not inherit from FormFieldBlockMixin.') <|end_body_0|> <|body_start_1|> form_fields = [] for key in block.child_blocks: for...
Class that handles finding all nested form fields recursively. Adding to this class requires adding new handle methods and overriding the find_form_fields function. If you have a special form field that needs special handling: class SpecialFormFieldFinder(FormFieldFinder): def handle_special_form_field_block(self, bloc...
FormFieldFinder
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FormFieldFinder: """Class that handles finding all nested form fields recursively. Adding to this class requires adding new handle methods and overriding the find_form_fields function. If you have a special form field that needs special handling: class SpecialFormFieldFinder(FormFieldFinder): def...
stack_v2_sparse_classes_36k_train_002074
7,905
permissive
[ { "docstring": "This is the base case and allows the recursion to stop.", "name": "handle_form_field_block", "signature": "def handle_form_field_block(self, block, value)" }, { "docstring": "Handles looping through StructBlock fields.", "name": "handle_struct_block", "signature": "def ha...
5
stack_v2_sparse_classes_30k_val_000647
Implement the Python class `FormFieldFinder` described below. Class description: Class that handles finding all nested form fields recursively. Adding to this class requires adding new handle methods and overriding the find_form_fields function. If you have a special form field that needs special handling: class Speci...
Implement the Python class `FormFieldFinder` described below. Class description: Class that handles finding all nested form fields recursively. Adding to this class requires adding new handle methods and overriding the find_form_fields function. If you have a special form field that needs special handling: class Speci...
70cd0f594860f5561a8afd90397aa30db69c76b4
<|skeleton|> class FormFieldFinder: """Class that handles finding all nested form fields recursively. Adding to this class requires adding new handle methods and overriding the find_form_fields function. If you have a special form field that needs special handling: class SpecialFormFieldFinder(FormFieldFinder): def...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FormFieldFinder: """Class that handles finding all nested form fields recursively. Adding to this class requires adding new handle methods and overriding the find_form_fields function. If you have a special form field that needs special handling: class SpecialFormFieldFinder(FormFieldFinder): def handle_speci...
the_stack_v2_python_sparse
wagtailstreamfieldforms/models.py
didorothy/wagtailstreamfieldforms
train
0
bcf1b9c13fa954c345b9ae9778b1cea8e402d049
[ "super(Expmap0, self).__init__()\nself.clamp_min = ClampMin()\nself.min_norm = min_norm\nself.clamp_tanh = ClampTanh()\nself.norm_k = Norm(axis=-1, keep_dims=True)", "sqrt_c = c ** 0.5\nu_norm = self.clamp_min(self.norm_k(u), self.min_norm)\ngamma_1 = self.clamp_tanh(sqrt_c * u_norm) * u / (sqrt_c * u_norm)\nretu...
<|body_start_0|> super(Expmap0, self).__init__() self.clamp_min = ClampMin() self.min_norm = min_norm self.clamp_tanh = ClampTanh() self.norm_k = Norm(axis=-1, keep_dims=True) <|end_body_0|> <|body_start_1|> sqrt_c = c ** 0.5 u_norm = self.clamp_min(self.norm_k(u...
expmap0 class
Expmap0
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Expmap0: """expmap0 class""" def __init__(self, min_norm): """init fun""" <|body_0|> def construct(self, u, c): """constructfun""" <|body_1|> <|end_skeleton|> <|body_start_0|> super(Expmap0, self).__init__() self.clamp_min = ClampMin() ...
stack_v2_sparse_classes_36k_train_002075
8,596
permissive
[ { "docstring": "init fun", "name": "__init__", "signature": "def __init__(self, min_norm)" }, { "docstring": "constructfun", "name": "construct", "signature": "def construct(self, u, c)" } ]
2
null
Implement the Python class `Expmap0` described below. Class description: expmap0 class Method signatures and docstrings: - def __init__(self, min_norm): init fun - def construct(self, u, c): constructfun
Implement the Python class `Expmap0` described below. Class description: expmap0 class Method signatures and docstrings: - def __init__(self, min_norm): init fun - def construct(self, u, c): constructfun <|skeleton|> class Expmap0: """expmap0 class""" def __init__(self, min_norm): """init fun""" ...
eab643f51336dbf7d711f02d27e6516e5affee59
<|skeleton|> class Expmap0: """expmap0 class""" def __init__(self, min_norm): """init fun""" <|body_0|> def construct(self, u, c): """constructfun""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Expmap0: """expmap0 class""" def __init__(self, min_norm): """init fun""" super(Expmap0, self).__init__() self.clamp_min = ClampMin() self.min_norm = min_norm self.clamp_tanh = ClampTanh() self.norm_k = Norm(axis=-1, keep_dims=True) def construct(self,...
the_stack_v2_python_sparse
research/nlp/hypertext/src/poincare.py
mindspore-ai/models
train
301
87e44abc995ea8c2fe2c240163e13407defd6ee4
[ "counter_1 = Counter(nums1)\ncounter_2 = Counter(nums2)\nsmaller = counter_1 if len(counter_1) <= len(counter_2) else counter_2\nbigger = counter_1 if len(counter_1) > len(counter_2) else counter_2\nprint(smaller, bigger)\nprint(f'counter 1: {counter_1}, size: {len(counter_1)}')\nprint(f'counter 2: {counter_2}, siz...
<|body_start_0|> counter_1 = Counter(nums1) counter_2 = Counter(nums2) smaller = counter_1 if len(counter_1) <= len(counter_2) else counter_2 bigger = counter_1 if len(counter_1) > len(counter_2) else counter_2 print(smaller, bigger) print(f'counter 1: {counter_1}, size: ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def intersect_v1(self, nums1, nums2): """Function to compute their intersection of given two arrays Note: - Each element in the result should appear as many times as it shows in both arrays. - The result can be in any order. :type nums1: List[int] :type nums2: List[int] :rtype:...
stack_v2_sparse_classes_36k_train_002076
2,192
permissive
[ { "docstring": "Function to compute their intersection of given two arrays Note: - Each element in the result should appear as many times as it shows in both arrays. - The result can be in any order. :type nums1: List[int] :type nums2: List[int] :rtype: List[int]", "name": "intersect_v1", "signature": "...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def intersect_v1(self, nums1, nums2): Function to compute their intersection of given two arrays Note: - Each element in the result should appear as many times as it shows in bot...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def intersect_v1(self, nums1, nums2): Function to compute their intersection of given two arrays Note: - Each element in the result should appear as many times as it shows in bot...
547c200b627c774535bc22880b16d5390183aeba
<|skeleton|> class Solution: def intersect_v1(self, nums1, nums2): """Function to compute their intersection of given two arrays Note: - Each element in the result should appear as many times as it shows in both arrays. - The result can be in any order. :type nums1: List[int] :type nums2: List[int] :rtype:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def intersect_v1(self, nums1, nums2): """Function to compute their intersection of given two arrays Note: - Each element in the result should appear as many times as it shows in both arrays. - The result can be in any order. :type nums1: List[int] :type nums2: List[int] :rtype: List[int]""" ...
the_stack_v2_python_sparse
easy/350_two_array_intersection_II.py
Sukhrobjon/leetcode
train
0
da7843c77aa939dccf390f3401d857bba2556c3c
[ "ds, _ = tfds.load('ted_hrlr_translate/pt_to_en', with_info=True, as_supervised=True)\nself.data_train = ds['train']\nself.data_valid = ds['validation']\ntokenizer_pt, tokenizer_en = self.tokenize_dataset(self.data_train)\nself.tokenizer_pt = tokenizer_pt\nself.tokenizer_en = tokenizer_en\nself.data_train = self.da...
<|body_start_0|> ds, _ = tfds.load('ted_hrlr_translate/pt_to_en', with_info=True, as_supervised=True) self.data_train = ds['train'] self.data_valid = ds['validation'] tokenizer_pt, tokenizer_en = self.tokenize_dataset(self.data_train) self.tokenizer_pt = tokenizer_pt self...
Loads and preps a dataset for machine translation
Dataset
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Dataset: """Loads and preps a dataset for machine translation""" def __init__(self): """Constructor""" <|body_0|> def tokenize_dataset(self, data): """Function that creates sub-word tokenizers for our dataset""" <|body_1|> def encode(self, pt, en): ...
stack_v2_sparse_classes_36k_train_002077
2,043
no_license
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Function that creates sub-word tokenizers for our dataset", "name": "tokenize_dataset", "signature": "def tokenize_dataset(self, data)" }, { "docstring": "Method that encodes a ...
4
stack_v2_sparse_classes_30k_train_002599
Implement the Python class `Dataset` described below. Class description: Loads and preps a dataset for machine translation Method signatures and docstrings: - def __init__(self): Constructor - def tokenize_dataset(self, data): Function that creates sub-word tokenizers for our dataset - def encode(self, pt, en): Metho...
Implement the Python class `Dataset` described below. Class description: Loads and preps a dataset for machine translation Method signatures and docstrings: - def __init__(self): Constructor - def tokenize_dataset(self, data): Function that creates sub-word tokenizers for our dataset - def encode(self, pt, en): Metho...
c7b6ea4c37b7c5dc41e63cdb8142b3cdfb3e1d23
<|skeleton|> class Dataset: """Loads and preps a dataset for machine translation""" def __init__(self): """Constructor""" <|body_0|> def tokenize_dataset(self, data): """Function that creates sub-word tokenizers for our dataset""" <|body_1|> def encode(self, pt, en): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Dataset: """Loads and preps a dataset for machine translation""" def __init__(self): """Constructor""" ds, _ = tfds.load('ted_hrlr_translate/pt_to_en', with_info=True, as_supervised=True) self.data_train = ds['train'] self.data_valid = ds['validation'] tokenizer_pt...
the_stack_v2_python_sparse
supervised_learning/0x12-transformer_apps/2-dataset.py
linkjavier/holbertonschool-machine_learning
train
0
28e3fc66345dc7b141a2e1659141703a38e8c9b5
[ "def inorder(root):\n if root:\n inorder(root.left)\n res.append(root)\n inorder(root.right)\nres = []\ninorder(root)\nvalue = [node.val for node in res]\nvalue.sort()\nfor i in range(len(res)):\n res[i].val = value[i]", "def inorder(root):\n if root:\n inorder(root.left)\n ...
<|body_start_0|> def inorder(root): if root: inorder(root.left) res.append(root) inorder(root.right) res = [] inorder(root) value = [node.val for node in res] value.sort() for i in range(len(res)): re...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def recoverTree1(self, root: TreeNode) -> None: """思路:二叉搜索树中序遍历的结果应该是从小到大排好序的 1. 中序遍历获取每个节点root 2. 将节点的值排序 3. 将节点的对象和值一一对应 @param root: @return:""" <|body_0|> def recoverTree2(self, root: TreeNode) -> None: """关键点:两个交换的元素会构成两个(或一个)逆序对 @param root: @return:"...
stack_v2_sparse_classes_36k_train_002078
4,014
no_license
[ { "docstring": "思路:二叉搜索树中序遍历的结果应该是从小到大排好序的 1. 中序遍历获取每个节点root 2. 将节点的值排序 3. 将节点的对象和值一一对应 @param root: @return:", "name": "recoverTree1", "signature": "def recoverTree1(self, root: TreeNode) -> None" }, { "docstring": "关键点:两个交换的元素会构成两个(或一个)逆序对 @param root: @return:", "name": "recoverTree2", ...
4
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def recoverTree1(self, root: TreeNode) -> None: 思路:二叉搜索树中序遍历的结果应该是从小到大排好序的 1. 中序遍历获取每个节点root 2. 将节点的值排序 3. 将节点的对象和值一一对应 @param root: @return: - def recoverTree2(self, root: TreeN...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def recoverTree1(self, root: TreeNode) -> None: 思路:二叉搜索树中序遍历的结果应该是从小到大排好序的 1. 中序遍历获取每个节点root 2. 将节点的值排序 3. 将节点的对象和值一一对应 @param root: @return: - def recoverTree2(self, root: TreeN...
e43ee86c5a8cdb808da09b4b6138e10275abadb5
<|skeleton|> class Solution: def recoverTree1(self, root: TreeNode) -> None: """思路:二叉搜索树中序遍历的结果应该是从小到大排好序的 1. 中序遍历获取每个节点root 2. 将节点的值排序 3. 将节点的对象和值一一对应 @param root: @return:""" <|body_0|> def recoverTree2(self, root: TreeNode) -> None: """关键点:两个交换的元素会构成两个(或一个)逆序对 @param root: @return:"...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def recoverTree1(self, root: TreeNode) -> None: """思路:二叉搜索树中序遍历的结果应该是从小到大排好序的 1. 中序遍历获取每个节点root 2. 将节点的值排序 3. 将节点的对象和值一一对应 @param root: @return:""" def inorder(root): if root: inorder(root.left) res.append(root) inorder(root...
the_stack_v2_python_sparse
LeetCode/树(Binary Tree)/99. 恢复二叉搜索树.py
yiming1012/MyLeetCode
train
2
b944d90d4784de8c2f92b8ac1bae26e5718db186
[ "super(SignalEncoder, self).__init__()\nif isinstance(signal_dim, int):\n signal_dim = (signal_dim,)\nif not 0 < len(signal_dim) < 3:\n raise AssertionError('signal dimensionality must be to 1D or 2D')\nndim = 2 if len(signal_dim) == 2 else 1\nself.downsample = kwargs.get('downsampling', 0)\nbn = kwargs.get('...
<|body_start_0|> super(SignalEncoder, self).__init__() if isinstance(signal_dim, int): signal_dim = (signal_dim,) if not 0 < len(signal_dim) < 3: raise AssertionError('signal dimensionality must be to 1D or 2D') ndim = 2 if len(signal_dim) == 2 else 1 self...
Encodes 1D/2D signal into a latent vector Args: signal_dim: Size of input signal. For images, it is (height, width). For spectra, it is (length,) z_dim: Number of fully-connected neurons in a "bottleneck layer" (latent dimensions) nb_layers: Number of convolutional layers nb_filters: Number of convolutional filters (ak...
SignalEncoder
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SignalEncoder: """Encodes 1D/2D signal into a latent vector Args: signal_dim: Size of input signal. For images, it is (height, width). For spectra, it is (length,) z_dim: Number of fully-connected neurons in a "bottleneck layer" (latent dimensions) nb_layers: Number of convolutional layers nb_fil...
stack_v2_sparse_classes_36k_train_002079
28,462
permissive
[ { "docstring": "Initialize module parameters", "name": "__init__", "signature": "def __init__(self, signal_dim: Tuple[int], z_dim: int, nb_layers: int, nb_filters: int, **kwargs: int) -> None" }, { "docstring": "Embeddes the input signal into a latent vector", "name": "forward", "signatu...
2
stack_v2_sparse_classes_30k_train_008411
Implement the Python class `SignalEncoder` described below. Class description: Encodes 1D/2D signal into a latent vector Args: signal_dim: Size of input signal. For images, it is (height, width). For spectra, it is (length,) z_dim: Number of fully-connected neurons in a "bottleneck layer" (latent dimensions) nb_layers...
Implement the Python class `SignalEncoder` described below. Class description: Encodes 1D/2D signal into a latent vector Args: signal_dim: Size of input signal. For images, it is (height, width). For spectra, it is (length,) z_dim: Number of fully-connected neurons in a "bottleneck layer" (latent dimensions) nb_layers...
6d187296074143d017ca8fc60302364cd946b180
<|skeleton|> class SignalEncoder: """Encodes 1D/2D signal into a latent vector Args: signal_dim: Size of input signal. For images, it is (height, width). For spectra, it is (length,) z_dim: Number of fully-connected neurons in a "bottleneck layer" (latent dimensions) nb_layers: Number of convolutional layers nb_fil...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SignalEncoder: """Encodes 1D/2D signal into a latent vector Args: signal_dim: Size of input signal. For images, it is (height, width). For spectra, it is (length,) z_dim: Number of fully-connected neurons in a "bottleneck layer" (latent dimensions) nb_layers: Number of convolutional layers nb_filters: Number ...
the_stack_v2_python_sparse
atomai/nets/ed.py
pycroscopy/atomai
train
157
020f680e8b4899f3efe2c3fecd65f5e23fb48f57
[ "some_categories = create_some_categories()\nsome_tags = create_some_tags()\nfuture_test = create_test(category=some_categories[0], tags=some_tags[2:], name='Тест с будущей датой публикации', publishing_days_offset=30)\nresponse = self.client.get(reverse('test_detail', args=(future_test.id,)))\nself.assertRedirects...
<|body_start_0|> some_categories = create_some_categories() some_tags = create_some_tags() future_test = create_test(category=some_categories[0], tags=some_tags[2:], name='Тест с будущей датой публикации', publishing_days_offset=30) response = self.client.get(reverse('test_detail', args=...
Класс с тестами для представления test_detail
TestDetailViewTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestDetailViewTests: """Класс с тестами для представления test_detail""" def test_detail_view_with_a_future_test(self): """Подробное представление, страничка теста с будущей либо отсутствующей датой публикации должно выдавать перенаправление""" <|body_0|> def test_detail...
stack_v2_sparse_classes_36k_train_002080
43,023
no_license
[ { "docstring": "Подробное представление, страничка теста с будущей либо отсутствующей датой публикации должно выдавать перенаправление", "name": "test_detail_view_with_a_future_test", "signature": "def test_detail_view_with_a_future_test(self)" }, { "docstring": "Подробное представление, странич...
2
null
Implement the Python class `TestDetailViewTests` described below. Class description: Класс с тестами для представления test_detail Method signatures and docstrings: - def test_detail_view_with_a_future_test(self): Подробное представление, страничка теста с будущей либо отсутствующей датой публикации должно выдавать п...
Implement the Python class `TestDetailViewTests` described below. Class description: Класс с тестами для представления test_detail Method signatures and docstrings: - def test_detail_view_with_a_future_test(self): Подробное представление, страничка теста с будущей либо отсутствующей датой публикации должно выдавать п...
b4f7557cadb70a4688ce7e76992917c610f2b3c1
<|skeleton|> class TestDetailViewTests: """Класс с тестами для представления test_detail""" def test_detail_view_with_a_future_test(self): """Подробное представление, страничка теста с будущей либо отсутствующей датой публикации должно выдавать перенаправление""" <|body_0|> def test_detail...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestDetailViewTests: """Класс с тестами для представления test_detail""" def test_detail_view_with_a_future_test(self): """Подробное представление, страничка теста с будущей либо отсутствующей датой публикации должно выдавать перенаправление""" some_categories = create_some_categories() ...
the_stack_v2_python_sparse
octapp/tests.py
Cheltigmashev/oct
train
0
1d1c309cb307e861c7e6728ad8d18039797e7c89
[ "if not head or not head.next:\n return head\nfirstNode = head\nsecondNode = head.next\nfirstNode.next = self.swapPairs(secondNode.next)\nsecondNode.next = firstNode\nreturn secondNode", "dummyNode = ListNode(0)\ndummyNode.next = head\npreNode = dummyNode\nwhile head and head.next:\n firstNode = head\n s...
<|body_start_0|> if not head or not head.next: return head firstNode = head secondNode = head.next firstNode.next = self.swapPairs(secondNode.next) secondNode.next = firstNode return secondNode <|end_body_0|> <|body_start_1|> dummyNode = ListNode(0) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def swapPairs(self, head): """递归处理""" <|body_0|> def fun2(self, head): """迭代处理 1. 维护好待交换两节点的前驱和后继 2. 搞清楚待交换两节点的前驱和后继""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not head or not head.next: return head firstNode = ...
stack_v2_sparse_classes_36k_train_002081
1,289
no_license
[ { "docstring": "递归处理", "name": "swapPairs", "signature": "def swapPairs(self, head)" }, { "docstring": "迭代处理 1. 维护好待交换两节点的前驱和后继 2. 搞清楚待交换两节点的前驱和后继", "name": "fun2", "signature": "def fun2(self, head)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def swapPairs(self, head): 递归处理 - def fun2(self, head): 迭代处理 1. 维护好待交换两节点的前驱和后继 2. 搞清楚待交换两节点的前驱和后继
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def swapPairs(self, head): 递归处理 - def fun2(self, head): 迭代处理 1. 维护好待交换两节点的前驱和后继 2. 搞清楚待交换两节点的前驱和后继 <|skeleton|> class Solution: def swapPairs(self, head): """递归处理""...
0b10f5731690da7998add288e4b0b87d5d71a97e
<|skeleton|> class Solution: def swapPairs(self, head): """递归处理""" <|body_0|> def fun2(self, head): """迭代处理 1. 维护好待交换两节点的前驱和后继 2. 搞清楚待交换两节点的前驱和后继""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def swapPairs(self, head): """递归处理""" if not head or not head.next: return head firstNode = head secondNode = head.next firstNode.next = self.swapPairs(secondNode.next) secondNode.next = firstNode return secondNode def fun2(sel...
the_stack_v2_python_sparse
leetcode/leetcode/24.两两交换链表中的节点.py
GGL12/myStudy
train
0
99c13fed045c7752c3fcade7186736b464552908
[ "self.owner = owner\nself.cardFinder = IndexInZone(index, HAND)\nCommand.__init__(self, [CurrentPlayer(), NoRequest(), self.cardFinder])", "coroutine = self.owner.playCardFromHand(self.cardFinder.card)\nresponse = (yield coroutine.next())\nwhile True:\n response = (yield coroutine.send(response))" ]
<|body_start_0|> self.owner = owner self.cardFinder = IndexInZone(index, HAND) Command.__init__(self, [CurrentPlayer(), NoRequest(), self.cardFinder]) <|end_body_0|> <|body_start_1|> coroutine = self.owner.playCardFromHand(self.cardFinder.card) response = (yield coroutine.next()...
Represents a Command to play a card
PlayCard
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PlayCard: """Represents a Command to play a card""" def __init__(self, index, owner): """Initialize the Play Card Command""" <|body_0|> def perform(self): """Perform the command""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.owner = owner ...
stack_v2_sparse_classes_36k_train_002082
859
no_license
[ { "docstring": "Initialize the Play Card Command", "name": "__init__", "signature": "def __init__(self, index, owner)" }, { "docstring": "Perform the command", "name": "perform", "signature": "def perform(self)" } ]
2
stack_v2_sparse_classes_30k_train_014377
Implement the Python class `PlayCard` described below. Class description: Represents a Command to play a card Method signatures and docstrings: - def __init__(self, index, owner): Initialize the Play Card Command - def perform(self): Perform the command
Implement the Python class `PlayCard` described below. Class description: Represents a Command to play a card Method signatures and docstrings: - def __init__(self, index, owner): Initialize the Play Card Command - def perform(self): Perform the command <|skeleton|> class PlayCard: """Represents a Command to pla...
0b5a7573a3cf33430fe61e4ff8a8a7a0ae20b258
<|skeleton|> class PlayCard: """Represents a Command to play a card""" def __init__(self, index, owner): """Initialize the Play Card Command""" <|body_0|> def perform(self): """Perform the command""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PlayCard: """Represents a Command to play a card""" def __init__(self, index, owner): """Initialize the Play Card Command""" self.owner = owner self.cardFinder = IndexInZone(index, HAND) Command.__init__(self, [CurrentPlayer(), NoRequest(), self.cardFinder]) def perfo...
the_stack_v2_python_sparse
src/Game/Commands/play_card.py
dfwarden/DeckBuilding
train
0
7c5b8448c0b0acdfb57aec2531bc1fa96947ca64
[ "next_index = next_object_key(self)\ndl = DistributedLoad(member, x_mag_A, y_mag_A, z_mag_A, x_mag_B, y_mag_B, z_mag_B, position_A, position_B, load_group, axes)\nsetattr(self, str(next_index), dl)\nreturn next_index", "found_id = None\nfor k, v in vars(self).items():\n if v.member == element_id:\n foun...
<|body_start_0|> next_index = next_object_key(self) dl = DistributedLoad(member, x_mag_A, y_mag_A, z_mag_A, x_mag_B, y_mag_B, z_mag_B, position_A, position_B, load_group, axes) setattr(self, str(next_index), dl) return next_index <|end_body_0|> <|body_start_1|> found_id = None ...
Creates an instance of the SkyCiv DistributedLoads class.
DistributedLoads
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DistributedLoads: """Creates an instance of the SkyCiv DistributedLoads class.""" def add(self, member: int, x_mag_A: float=0, y_mag_A: float=0, z_mag_A: float=0, x_mag_B: float=0, y_mag_B: float=0, z_mag_B: float=0, position_A: float=0, position_B: float=0, load_group: str=None, axes: str='...
stack_v2_sparse_classes_36k_train_002083
3,139
permissive
[ { "docstring": "Create a distributed load with the next available ID. Args: member (int): Member to which the distributed load will be applied. Identified by the member ID. x_mag_A (float, optional): The magnitude of the load in the x-direction at the starting position A. Defaults to 0. y_mag_A (float, optional...
2
stack_v2_sparse_classes_30k_train_003453
Implement the Python class `DistributedLoads` described below. Class description: Creates an instance of the SkyCiv DistributedLoads class. Method signatures and docstrings: - def add(self, member: int, x_mag_A: float=0, y_mag_A: float=0, z_mag_A: float=0, x_mag_B: float=0, y_mag_B: float=0, z_mag_B: float=0, positio...
Implement the Python class `DistributedLoads` described below. Class description: Creates an instance of the SkyCiv DistributedLoads class. Method signatures and docstrings: - def add(self, member: int, x_mag_A: float=0, y_mag_A: float=0, z_mag_A: float=0, x_mag_B: float=0, y_mag_B: float=0, z_mag_B: float=0, positio...
1cf3dad7f8d451760df02886df41684add72a4eb
<|skeleton|> class DistributedLoads: """Creates an instance of the SkyCiv DistributedLoads class.""" def add(self, member: int, x_mag_A: float=0, y_mag_A: float=0, z_mag_A: float=0, x_mag_B: float=0, y_mag_B: float=0, z_mag_B: float=0, position_A: float=0, position_B: float=0, load_group: str=None, axes: str='...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DistributedLoads: """Creates an instance of the SkyCiv DistributedLoads class.""" def add(self, member: int, x_mag_A: float=0, y_mag_A: float=0, z_mag_A: float=0, x_mag_B: float=0, y_mag_B: float=0, z_mag_B: float=0, position_A: float=0, position_B: float=0, load_group: str=None, axes: str='global') -> i...
the_stack_v2_python_sparse
src/skyciv/classes/model/components/distributed_loads/distributed_loads.py
osasanchezme/skyciv-pip
train
0
e04242250f992869973718c1213a648061cc6d43
[ "self.ai_settings = ai_settings\nself.reset_stats()\nself.game_active = False\nself.button_clicked = False\nself.high_score = 0\nself.file_name = 'save/high_score.json'", "self.ships_left = self.ai_settings.ship_limit\nself.score = 0\nself.level = 1" ]
<|body_start_0|> self.ai_settings = ai_settings self.reset_stats() self.game_active = False self.button_clicked = False self.high_score = 0 self.file_name = 'save/high_score.json' <|end_body_0|> <|body_start_1|> self.ships_left = self.ai_settings.ship_limit ...
跟踪游戏的统计信息
GameStates
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GameStates: """跟踪游戏的统计信息""" def __init__(self, ai_settings): """初始化统计信息""" <|body_0|> def reset_stats(self): """初始化在游戏运行期间可能变化的统计信息""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.ai_settings = ai_settings self.reset_stats() ...
stack_v2_sparse_classes_36k_train_002084
938
no_license
[ { "docstring": "初始化统计信息", "name": "__init__", "signature": "def __init__(self, ai_settings)" }, { "docstring": "初始化在游戏运行期间可能变化的统计信息", "name": "reset_stats", "signature": "def reset_stats(self)" } ]
2
stack_v2_sparse_classes_30k_train_010395
Implement the Python class `GameStates` described below. Class description: 跟踪游戏的统计信息 Method signatures and docstrings: - def __init__(self, ai_settings): 初始化统计信息 - def reset_stats(self): 初始化在游戏运行期间可能变化的统计信息
Implement the Python class `GameStates` described below. Class description: 跟踪游戏的统计信息 Method signatures and docstrings: - def __init__(self, ai_settings): 初始化统计信息 - def reset_stats(self): 初始化在游戏运行期间可能变化的统计信息 <|skeleton|> class GameStates: """跟踪游戏的统计信息""" def __init__(self, ai_settings): """初始化统计信息""...
69c9018bb70893f74a44e4df9f3d3e39467de3f6
<|skeleton|> class GameStates: """跟踪游戏的统计信息""" def __init__(self, ai_settings): """初始化统计信息""" <|body_0|> def reset_stats(self): """初始化在游戏运行期间可能变化的统计信息""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GameStates: """跟踪游戏的统计信息""" def __init__(self, ai_settings): """初始化统计信息""" self.ai_settings = ai_settings self.reset_stats() self.game_active = False self.button_clicked = False self.high_score = 0 self.file_name = 'save/high_score.json' def re...
the_stack_v2_python_sparse
1-books/book1_Python编程从入门到实践/ailen_invasion/game_stats.py
TinyHandsome/BookStudy
train
18
679829154b8bc7361480263c4cce0b8603051570
[ "self.data = {}\n\ndef remove(k, selfref=ref(self)):\n self = selfref()\n if self is not None and self.data:\n try:\n v = self.data.get(k)\n del self.data[k]\n except (KeyError, RuntimeError):\n pass\nself._remove = remove\nif dict is not None:\n self.update(d...
<|body_start_0|> self.data = {} def remove(k, selfref=ref(self)): self = selfref() if self is not None and self.data: try: v = self.data.get(k) del self.data[k] except (KeyError, RuntimeError): ...
Sub-class to work around error in WeakKeyDictionary implementation Python 2.2.2 and 2.2.3c1 both have an annoying problem in their __delitem__ for the WeakKeyDictionary class. This class provides a work-around for it.
WeakKeyDictionary
[ "LicenseRef-scancode-warranty-disclaimer", "GPL-1.0-or-later", "LicenseRef-scancode-other-copyleft", "LGPL-2.1-or-later", "GPL-3.0-only", "LGPL-2.0-or-later", "GPL-3.0-or-later", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WeakKeyDictionary: """Sub-class to work around error in WeakKeyDictionary implementation Python 2.2.2 and 2.2.3c1 both have an annoying problem in their __delitem__ for the WeakKeyDictionary class. This class provides a work-around for it.""" def __init__(self, dict=None): """Initial...
stack_v2_sparse_classes_36k_train_002085
1,278
permissive
[ { "docstring": "Initialize the WeakKeyDictionary dict -- previously-existing weak key records or None to create a new dictionary", "name": "__init__", "signature": "def __init__(self, dict=None)" }, { "docstring": "Overridden delitem to avoid scanning", "name": "__delitem__", "signature"...
2
null
Implement the Python class `WeakKeyDictionary` described below. Class description: Sub-class to work around error in WeakKeyDictionary implementation Python 2.2.2 and 2.2.3c1 both have an annoying problem in their __delitem__ for the WeakKeyDictionary class. This class provides a work-around for it. Method signatures...
Implement the Python class `WeakKeyDictionary` described below. Class description: Sub-class to work around error in WeakKeyDictionary implementation Python 2.2.2 and 2.2.3c1 both have an annoying problem in their __delitem__ for the WeakKeyDictionary class. This class provides a work-around for it. Method signatures...
7f600ad153270feff12aa7aa86d7ed0a49ebc71c
<|skeleton|> class WeakKeyDictionary: """Sub-class to work around error in WeakKeyDictionary implementation Python 2.2.2 and 2.2.3c1 both have an annoying problem in their __delitem__ for the WeakKeyDictionary class. This class provides a work-around for it.""" def __init__(self, dict=None): """Initial...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WeakKeyDictionary: """Sub-class to work around error in WeakKeyDictionary implementation Python 2.2.2 and 2.2.3c1 both have an annoying problem in their __delitem__ for the WeakKeyDictionary class. This class provides a work-around for it.""" def __init__(self, dict=None): """Initialize the WeakK...
the_stack_v2_python_sparse
pythonAnimations/pyOpenGLChess/engineDirectory/oglc-env/lib/python2.7/site-packages/vrml/weakkeydictfix.py
alexus37/AugmentedRealityChess
train
1
47262e881dbe8adfd3ead018b6372ccc9ab9cc94
[ "nums_unique = list(set(nums))\nif len(nums_unique) <= 2:\n return max(nums_unique)\nelse:\n thirdmax = None\n for _ in range(3):\n thirdmax = nums_unique.pop(nums_unique.index(max(nums_unique)))\n return thirdmax", "top_maxes = [float('-inf'), float('-inf'), float('-inf')]\nnums_unique = set(n...
<|body_start_0|> nums_unique = list(set(nums)) if len(nums_unique) <= 2: return max(nums_unique) else: thirdmax = None for _ in range(3): thirdmax = nums_unique.pop(nums_unique.index(max(nums_unique))) return thirdmax <|end_body_0|>...
Given a non-empty array of integers, return the third maximum number in the array. If it does not exist, return the max of the list. Must be O(n) https://leetcode.com/problems/third-maximum-number/ Notes ----- thirdmax: faster > 67%, mem < 15% thirdmax_2: faster > 65%, mem < 27%. Memory can be made to be O(1).
ThirdMax
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ThirdMax: """Given a non-empty array of integers, return the third maximum number in the array. If it does not exist, return the max of the list. Must be O(n) https://leetcode.com/problems/third-maximum-number/ Notes ----- thirdmax: faster > 67%, mem < 15% thirdmax_2: faster > 65%, mem < 27%. Mem...
stack_v2_sparse_classes_36k_train_002086
2,116
no_license
[ { "docstring": "Pop off max of unique values 3 times. Parameters ---------- nums List of ints. Returns ------- Third max or if does not exist, the max. Examples -------- >>> ThirdMax.thirdmax([3, 2, 1]) 1 >>> ThirdMax.thirdmax([1, 2]) 2 >>> ThirdMax.thirdmax([2, 2, 3, 1]) 1", "name": "thirdmax", "signat...
2
stack_v2_sparse_classes_30k_train_004420
Implement the Python class `ThirdMax` described below. Class description: Given a non-empty array of integers, return the third maximum number in the array. If it does not exist, return the max of the list. Must be O(n) https://leetcode.com/problems/third-maximum-number/ Notes ----- thirdmax: faster > 67%, mem < 15% t...
Implement the Python class `ThirdMax` described below. Class description: Given a non-empty array of integers, return the third maximum number in the array. If it does not exist, return the max of the list. Must be O(n) https://leetcode.com/problems/third-maximum-number/ Notes ----- thirdmax: faster > 67%, mem < 15% t...
ad27231c2c30a35d55f75e60f745288230abf3de
<|skeleton|> class ThirdMax: """Given a non-empty array of integers, return the third maximum number in the array. If it does not exist, return the max of the list. Must be O(n) https://leetcode.com/problems/third-maximum-number/ Notes ----- thirdmax: faster > 67%, mem < 15% thirdmax_2: faster > 65%, mem < 27%. Mem...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ThirdMax: """Given a non-empty array of integers, return the third maximum number in the array. If it does not exist, return the max of the list. Must be O(n) https://leetcode.com/problems/third-maximum-number/ Notes ----- thirdmax: faster > 67%, mem < 15% thirdmax_2: faster > 65%, mem < 27%. Memory can be ma...
the_stack_v2_python_sparse
thirdmax.py
bliaw/algorithms_python
train
0
91030aed7e72ed35b374a32b3cc64ebfc008789d
[ "self.__doc__ = f.__doc__\nself.__name__ = f.__name__\nself.f = f", "print('Called', self.f.__name__, 'from', type(self))\nb_args = []\nfor a in args:\n b_args.append(a.upper() + \" (a 'decorated' cutie pie)\")\nreturn self.f(*b_args, **kw)" ]
<|body_start_0|> self.__doc__ = f.__doc__ self.__name__ = f.__name__ self.f = f <|end_body_0|> <|body_start_1|> print('Called', self.f.__name__, 'from', type(self)) b_args = [] for a in args: b_args.append(a.upper() + " (a 'decorated' cutie pie)") ret...
one
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class one: def __init__(self, f): """__init__ records the passed function for later use in __call__""" <|body_0|> def __call__(self, *args, **kw): """Prints a trace line before calling the wrapped function.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_002087
2,032
no_license
[ { "docstring": "__init__ records the passed function for later use in __call__", "name": "__init__", "signature": "def __init__(self, f)" }, { "docstring": "Prints a trace line before calling the wrapped function.", "name": "__call__", "signature": "def __call__(self, *args, **kw)" } ]
2
stack_v2_sparse_classes_30k_train_003057
Implement the Python class `one` described below. Class description: Implement the one class. Method signatures and docstrings: - def __init__(self, f): __init__ records the passed function for later use in __call__ - def __call__(self, *args, **kw): Prints a trace line before calling the wrapped function.
Implement the Python class `one` described below. Class description: Implement the one class. Method signatures and docstrings: - def __init__(self, f): __init__ records the passed function for later use in __call__ - def __call__(self, *args, **kw): Prints a trace line before calling the wrapped function. <|skeleto...
b32f83aa1b705a5ad384b73c618f04f7d2622753
<|skeleton|> class one: def __init__(self, f): """__init__ records the passed function for later use in __call__""" <|body_0|> def __call__(self, *args, **kw): """Prints a trace line before calling the wrapped function.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class one: def __init__(self, f): """__init__ records the passed function for later use in __call__""" self.__doc__ = f.__doc__ self.__name__ = f.__name__ self.f = f def __call__(self, *args, **kw): """Prints a trace line before calling the wrapped function.""" p...
the_stack_v2_python_sparse
ostPython4/decorplay.py
deepbsd/OST_Python
train
1
9e503e9889cc4e75de166b55d773efc5dad66f0e
[ "self.center_loc = center_loc\nself.tents_list = list()\nself.tents_list.append(tent_loc)", "flag_toadd = True\nfor i in self.tents_list:\n loc_new = Location(new_tent_loc.x, new_tent_loc.y)\n loc_old = i\n dist = loc_new.dist_from(loc_old)\n if abs(dist) < 0.5:\n flag_toadd = False\nif flag_to...
<|body_start_0|> self.center_loc = center_loc self.tents_list = list() self.tents_list.append(tent_loc) <|end_body_0|> <|body_start_1|> flag_toadd = True for i in self.tents_list: loc_new = Location(new_tent_loc.x, new_tent_loc.y) loc_old = i ...
A MITCampus is a Campus that contains tents
MITCampus
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MITCampus: """A MITCampus is a Campus that contains tents""" def __init__(self, center_loc, tent_loc=Location(0, 0)): """Assumes center_loc and tent_loc are Location objects Initializes a new Campus centered at location center_loc with a tent at location tent_loc""" <|body_0|...
stack_v2_sparse_classes_36k_train_002088
6,605
no_license
[ { "docstring": "Assumes center_loc and tent_loc are Location objects Initializes a new Campus centered at location center_loc with a tent at location tent_loc", "name": "__init__", "signature": "def __init__(self, center_loc, tent_loc=Location(0, 0))" }, { "docstring": "Assumes new_tent_loc is a...
4
null
Implement the Python class `MITCampus` described below. Class description: A MITCampus is a Campus that contains tents Method signatures and docstrings: - def __init__(self, center_loc, tent_loc=Location(0, 0)): Assumes center_loc and tent_loc are Location objects Initializes a new Campus centered at location center_...
Implement the Python class `MITCampus` described below. Class description: A MITCampus is a Campus that contains tents Method signatures and docstrings: - def __init__(self, center_loc, tent_loc=Location(0, 0)): Assumes center_loc and tent_loc are Location objects Initializes a new Campus centered at location center_...
89059d9f3fc1de474a144e5f5235f7150a5208b2
<|skeleton|> class MITCampus: """A MITCampus is a Campus that contains tents""" def __init__(self, center_loc, tent_loc=Location(0, 0)): """Assumes center_loc and tent_loc are Location objects Initializes a new Campus centered at location center_loc with a tent at location tent_loc""" <|body_0|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MITCampus: """A MITCampus is a Campus that contains tents""" def __init__(self, center_loc, tent_loc=Location(0, 0)): """Assumes center_loc and tent_loc are Location objects Initializes a new Campus centered at location center_loc with a tent at location tent_loc""" self.center_loc = cent...
the_stack_v2_python_sparse
MITx 6.00.1x Introduction to Computer Science and Programming Using Python/final exam problem 7 v3.py
tmPolla/python
train
0
c3c6e7ab2388b58853ec08f4401f4c30dee6078f
[ "from collections import defaultdict\nself.prefixes = defaultdict(set)\nself.suffixes = defaultdict(set)\nself.weights = {}\nfor index, word in enumerate(words):\n prefix, suffix = ('', '')\n for char in [''] + list(word):\n prefix += char\n self.prefixes[prefix].add(word)\n for char in [''] ...
<|body_start_0|> from collections import defaultdict self.prefixes = defaultdict(set) self.suffixes = defaultdict(set) self.weights = {} for index, word in enumerate(words): prefix, suffix = ('', '') for char in [''] + list(word): prefix +=...
WordFilter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WordFilter: def __init__(self, words): """:type words: List[str]""" <|body_0|> def f(self, prefix, suffix): """:type prefix: str :type suffix: str :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> from collections import defaultdict ...
stack_v2_sparse_classes_36k_train_002089
1,282
no_license
[ { "docstring": ":type words: List[str]", "name": "__init__", "signature": "def __init__(self, words)" }, { "docstring": ":type prefix: str :type suffix: str :rtype: int", "name": "f", "signature": "def f(self, prefix, suffix)" } ]
2
null
Implement the Python class `WordFilter` described below. Class description: Implement the WordFilter class. Method signatures and docstrings: - def __init__(self, words): :type words: List[str] - def f(self, prefix, suffix): :type prefix: str :type suffix: str :rtype: int
Implement the Python class `WordFilter` described below. Class description: Implement the WordFilter class. Method signatures and docstrings: - def __init__(self, words): :type words: List[str] - def f(self, prefix, suffix): :type prefix: str :type suffix: str :rtype: int <|skeleton|> class WordFilter: def __in...
e4c02084f26384cedbd87c4c60e9bdfbf77228cc
<|skeleton|> class WordFilter: def __init__(self, words): """:type words: List[str]""" <|body_0|> def f(self, prefix, suffix): """:type prefix: str :type suffix: str :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WordFilter: def __init__(self, words): """:type words: List[str]""" from collections import defaultdict self.prefixes = defaultdict(set) self.suffixes = defaultdict(set) self.weights = {} for index, word in enumerate(words): prefix, suffix = ('', '')...
the_stack_v2_python_sparse
Advanced/745. Prefix and Suffix Search Hard.py
dongbo910220/leetcode_
train
0
c4a31fcb2b64d526fe57e54b478a02be5b571847
[ "w = SldPanel(None)\nyield w\nw.close()\nw = None", "assert isinstance(widget, QtWidgets.QWidget)\nassert widget.ui.editMolecularFormula.styleSheet() == ''\nassert widget.model.columnCount() == 1\nassert widget.model.rowCount() == 11\nassert widget.sizePolicy().Policy() == QtWidgets.QSizePolicy.Fixed", "widget....
<|body_start_0|> w = SldPanel(None) yield w w.close() w = None <|end_body_0|> <|body_start_1|> assert isinstance(widget, QtWidgets.QWidget) assert widget.ui.editMolecularFormula.styleSheet() == '' assert widget.model.columnCount() == 1 assert widget.model...
Test the SLDCalculator
SLDCalculatorTest
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SLDCalculatorTest: """Test the SLDCalculator""" def widget(self, qapp): """Create/Destroy the SLDCalculator""" <|body_0|> def testDefaults(self, widget): """Test the GUI in its default state""" <|body_1|> def testSimpleEntry(self, widget): ""...
stack_v2_sparse_classes_36k_train_002090
4,853
permissive
[ { "docstring": "Create/Destroy the SLDCalculator", "name": "widget", "signature": "def widget(self, qapp)" }, { "docstring": "Test the GUI in its default state", "name": "testDefaults", "signature": "def testDefaults(self, widget)" }, { "docstring": "Default compound calculations...
5
stack_v2_sparse_classes_30k_train_000427
Implement the Python class `SLDCalculatorTest` described below. Class description: Test the SLDCalculator Method signatures and docstrings: - def widget(self, qapp): Create/Destroy the SLDCalculator - def testDefaults(self, widget): Test the GUI in its default state - def testSimpleEntry(self, widget): Default compou...
Implement the Python class `SLDCalculatorTest` described below. Class description: Test the SLDCalculator Method signatures and docstrings: - def widget(self, qapp): Create/Destroy the SLDCalculator - def testDefaults(self, widget): Test the GUI in its default state - def testSimpleEntry(self, widget): Default compou...
55b1e9f6db58e33729f2a93b7dd1d8bf255b46f7
<|skeleton|> class SLDCalculatorTest: """Test the SLDCalculator""" def widget(self, qapp): """Create/Destroy the SLDCalculator""" <|body_0|> def testDefaults(self, widget): """Test the GUI in its default state""" <|body_1|> def testSimpleEntry(self, widget): ""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SLDCalculatorTest: """Test the SLDCalculator""" def widget(self, qapp): """Create/Destroy the SLDCalculator""" w = SldPanel(None) yield w w.close() w = None def testDefaults(self, widget): """Test the GUI in its default state""" assert isinstan...
the_stack_v2_python_sparse
src/sas/qtgui/Calculators/UnitTesting/SLDCalculatorTest.py
SasView/sasview
train
48
a6e49435a7bb7fc4b9e730165702362efb175732
[ "if rowIndex == 0:\n return [1]\nprev = self.getRow(rowIndex - 1)\nreturn [1] + [prev[i] + prev[i + 1] for i in range(rowIndex - 1)] + [1]", "row = [1]\nfor row_num in range(1, rowIndex + 1):\n temp = [None for _ in range(row_num + 1)]\n temp[0], temp[-1] = (1, 1)\n for i in range(1, row_num):\n ...
<|body_start_0|> if rowIndex == 0: return [1] prev = self.getRow(rowIndex - 1) return [1] + [prev[i] + prev[i + 1] for i in range(rowIndex - 1)] + [1] <|end_body_0|> <|body_start_1|> row = [1] for row_num in range(1, rowIndex + 1): temp = [None for _ in r...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def getRow(self, rowIndex): """:type rowIndex: int :rtype: List[int]""" <|body_0|> def getRow(self, rowIndex): """:type rowIndex: int :rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|> if rowIndex == 0: return [1...
stack_v2_sparse_classes_36k_train_002091
836
no_license
[ { "docstring": ":type rowIndex: int :rtype: List[int]", "name": "getRow", "signature": "def getRow(self, rowIndex)" }, { "docstring": ":type rowIndex: int :rtype: List[int]", "name": "getRow", "signature": "def getRow(self, rowIndex)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getRow(self, rowIndex): :type rowIndex: int :rtype: List[int] - def getRow(self, rowIndex): :type rowIndex: int :rtype: List[int]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getRow(self, rowIndex): :type rowIndex: int :rtype: List[int] - def getRow(self, rowIndex): :type rowIndex: int :rtype: List[int] <|skeleton|> class Solution: def getRo...
a509b383a42f54313970168d9faa11f088f18708
<|skeleton|> class Solution: def getRow(self, rowIndex): """:type rowIndex: int :rtype: List[int]""" <|body_0|> def getRow(self, rowIndex): """:type rowIndex: int :rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def getRow(self, rowIndex): """:type rowIndex: int :rtype: List[int]""" if rowIndex == 0: return [1] prev = self.getRow(rowIndex - 1) return [1] + [prev[i] + prev[i + 1] for i in range(rowIndex - 1)] + [1] def getRow(self, rowIndex): """:type ...
the_stack_v2_python_sparse
0119_Pascal's_Triangle_II.py
bingli8802/leetcode
train
0
244f8e592bfd5e276aa73954a79542cea9d65a04
[ "self._assignments = None\nself._num_classes = None\nself._assigned_classes = None", "if num_classes is None:\n num_classes = np.unique(y).max() + 1\nself._num_classes = num_classes\nnum_outputs = X.shape[1]\nmax_fr = np.zeros(num_outputs)\nassignments = np.zeros(num_outputs)\nfor i in range(num_classes):\n ...
<|body_start_0|> self._assignments = None self._num_classes = None self._assigned_classes = None <|end_body_0|> <|body_start_1|> if num_classes is None: num_classes = np.unique(y).max() + 1 self._num_classes = num_classes num_outputs = X.shape[1] max_...
A readout classifier that uses the highest response hypothesis to predict class labels from output firing rates. The mechanism is described in: 'Unsupervised learning of digit recognition using spike-timing-dependent plasticity', Diehl Peter, Cook Matthew, 2015 (10.3389/fncom.2015.00099) Attributes:
HighestResponse
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HighestResponse: """A readout classifier that uses the highest response hypothesis to predict class labels from output firing rates. The mechanism is described in: 'Unsupervised learning of digit recognition using spike-timing-dependent plasticity', Diehl Peter, Cook Matthew, 2015 (10.3389/fncom....
stack_v2_sparse_classes_36k_train_002092
4,756
permissive
[ { "docstring": "Init empty classifier. Args: Returns:", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Train the model. Args: X: A numpy array of size num_samples x num_features. I.e., the training input. y: A numpy array of size num_samples. I.e., the ground truth labe...
3
stack_v2_sparse_classes_30k_train_009116
Implement the Python class `HighestResponse` described below. Class description: A readout classifier that uses the highest response hypothesis to predict class labels from output firing rates. The mechanism is described in: 'Unsupervised learning of digit recognition using spike-timing-dependent plasticity', Diehl Pe...
Implement the Python class `HighestResponse` described below. Class description: A readout classifier that uses the highest response hypothesis to predict class labels from output firing rates. The mechanism is described in: 'Unsupervised learning of digit recognition using spike-timing-dependent plasticity', Diehl Pe...
3ee4037a4568c393378eaec74483696d5281f376
<|skeleton|> class HighestResponse: """A readout classifier that uses the highest response hypothesis to predict class labels from output firing rates. The mechanism is described in: 'Unsupervised learning of digit recognition using spike-timing-dependent plasticity', Diehl Peter, Cook Matthew, 2015 (10.3389/fncom....
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HighestResponse: """A readout classifier that uses the highest response hypothesis to predict class labels from output firing rates. The mechanism is described in: 'Unsupervised learning of digit recognition using spike-timing-dependent plasticity', Diehl Peter, Cook Matthew, 2015 (10.3389/fncom.2015.00099) A...
the_stack_v2_python_sparse
src/readout/highest_response.py
xiuxiuzhang1995/snn_global_pattern_induction
train
0
758a84fd0672f8afe1f8b3219aa65bafbbec84ef
[ "length = len(T)\nres = [0] * length\nstack = []\nfor i in range(length):\n while stack and T[stack[-1]] < T[i]:\n prev_idx = stack.pop()\n res[prev_idx] = i - prev_idx\n stack.append(i)\nreturn res", "length = len(T)\nres = [0] * length\nstack = []\nfor i in range(length - 1, -1, -1):\n wh...
<|body_start_0|> length = len(T) res = [0] * length stack = [] for i in range(length): while stack and T[stack[-1]] < T[i]: prev_idx = stack.pop() res[prev_idx] = i - prev_idx stack.append(i) return res <|end_body_0|> <|bod...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def dailyTemperatures(self, T): """Time O(n) Space O(W) W is the number of allowed values for T[i] :type T: List[int] :rtype: List[int]""" <|body_0|> def dailyTemperatures_another(self, T): """:type T: List[int] :rtype: List[int]""" <|body_1|> <|en...
stack_v2_sparse_classes_36k_train_002093
1,059
no_license
[ { "docstring": "Time O(n) Space O(W) W is the number of allowed values for T[i] :type T: List[int] :rtype: List[int]", "name": "dailyTemperatures", "signature": "def dailyTemperatures(self, T)" }, { "docstring": ":type T: List[int] :rtype: List[int]", "name": "dailyTemperatures_another", ...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def dailyTemperatures(self, T): Time O(n) Space O(W) W is the number of allowed values for T[i] :type T: List[int] :rtype: List[int] - def dailyTemperatures_another(self, T): :ty...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def dailyTemperatures(self, T): Time O(n) Space O(W) W is the number of allowed values for T[i] :type T: List[int] :rtype: List[int] - def dailyTemperatures_another(self, T): :ty...
85f71621c54f6b0029f3a2746f022f89dd7419d9
<|skeleton|> class Solution: def dailyTemperatures(self, T): """Time O(n) Space O(W) W is the number of allowed values for T[i] :type T: List[int] :rtype: List[int]""" <|body_0|> def dailyTemperatures_another(self, T): """:type T: List[int] :rtype: List[int]""" <|body_1|> <|en...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def dailyTemperatures(self, T): """Time O(n) Space O(W) W is the number of allowed values for T[i] :type T: List[int] :rtype: List[int]""" length = len(T) res = [0] * length stack = [] for i in range(length): while stack and T[stack[-1]] < T[i]: ...
the_stack_v2_python_sparse
LeetCode/Stack/739_daily_temperatures.py
XyK0907/for_work
train
0
7db146d574f671f6762f066c0ca9ff85878642dd
[ "indices = []\ni = 0\nwhile i < radius * radius:\n indices.append((randrange(0, input_wh[0]), randrange(0, input_wh[1])))\n i = i + 1\nreturn indices", "if input_wh[0] < cols_wh[0] or input_wh[1] < cols_wh[1]:\n raise NameError('Колонок как минимум по одному из измерений больше, чем элементов нижлежащего...
<|body_start_0|> indices = [] i = 0 while i < radius * radius: indices.append((randrange(0, input_wh[0]), randrange(0, input_wh[1]))) i = i + 1 return indices <|end_body_0|> <|body_start_1|> if input_wh[0] < cols_wh[0] or input_wh[1] < cols_wh[1]: ...
Класс случайного маппера
RandomMapper
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RandomMapper: """Класс случайного маппера""" def map_one(self, input_wh, colcoord, radius): """возвращает массив кортежей координат элементов входного поля input_wh, которые отнесены к колонке с координатами colcoord :param input_wh: размеры входного поля :param colcoord: координаты ...
stack_v2_sparse_classes_36k_train_002094
2,747
no_license
[ { "docstring": "возвращает массив кортежей координат элементов входного поля input_wh, которые отнесены к колонке с координатами colcoord :param input_wh: размеры входного поля :param colcoord: координаты колонки в поле колонок (подразумевается, что размерность входного поля и поля колонок одинакова) :param rad...
2
stack_v2_sparse_classes_30k_train_011288
Implement the Python class `RandomMapper` described below. Class description: Класс случайного маппера Method signatures and docstrings: - def map_one(self, input_wh, colcoord, radius): возвращает массив кортежей координат элементов входного поля input_wh, которые отнесены к колонке с координатами colcoord :param inp...
Implement the Python class `RandomMapper` described below. Class description: Класс случайного маппера Method signatures and docstrings: - def map_one(self, input_wh, colcoord, radius): возвращает массив кортежей координат элементов входного поля input_wh, которые отнесены к колонке с координатами colcoord :param inp...
672408433a11947c4e1ee037e97e62a17944e210
<|skeleton|> class RandomMapper: """Класс случайного маппера""" def map_one(self, input_wh, colcoord, radius): """возвращает массив кортежей координат элементов входного поля input_wh, которые отнесены к колонке с координатами colcoord :param input_wh: размеры входного поля :param colcoord: координаты ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RandomMapper: """Класс случайного маппера""" def map_one(self, input_wh, colcoord, radius): """возвращает массив кортежей координат элементов входного поля input_wh, которые отнесены к колонке с координатами colcoord :param input_wh: размеры входного поля :param colcoord: координаты колонки в пол...
the_stack_v2_python_sparse
spatialPooler/mappers/sp_random_mapper.py
cog-isa/htm-core
train
0
e1ab14849e59d793c1ac52f26ef58f851bd4089a
[ "super().__init__()\nif isinstance(hidden_units, int):\n hidden_units = [hidden_units]\nself.fc_x = nn.Linear(x_size, hidden_units[0], bias=False)\nself.fc_y = nn.Linear(y_size, hidden_units[0], bias=False)\nself.xy_bias = nn.Parameter(torch.zeros(hidden_units[0]))\nself.fc_output = MLP(*hidden_units, 1)", "hi...
<|body_start_0|> super().__init__() if isinstance(hidden_units, int): hidden_units = [hidden_units] self.fc_x = nn.Linear(x_size, hidden_units[0], bias=False) self.fc_y = nn.Linear(y_size, hidden_units[0], bias=False) self.xy_bias = nn.Parameter(torch.zeros(hidden_uni...
MINE_Net
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MINE_Net: def __init__(self, x_size: int, y_size: int, hidden_units=(100, 50)): """A network to estimate the mutual information between X and Y, I(X; Y). Parameters ---------- x_size, y_size : int Number of neurons in X and Y. hidden_units : int or tuple of int Hidden layer size(s).""" ...
stack_v2_sparse_classes_36k_train_002095
9,660
permissive
[ { "docstring": "A network to estimate the mutual information between X and Y, I(X; Y). Parameters ---------- x_size, y_size : int Number of neurons in X and Y. hidden_units : int or tuple of int Hidden layer size(s).", "name": "__init__", "signature": "def __init__(self, x_size: int, y_size: int, hidden...
2
stack_v2_sparse_classes_30k_train_008415
Implement the Python class `MINE_Net` described below. Class description: Implement the MINE_Net class. Method signatures and docstrings: - def __init__(self, x_size: int, y_size: int, hidden_units=(100, 50)): A network to estimate the mutual information between X and Y, I(X; Y). Parameters ---------- x_size, y_size ...
Implement the Python class `MINE_Net` described below. Class description: Implement the MINE_Net class. Method signatures and docstrings: - def __init__(self, x_size: int, y_size: int, hidden_units=(100, 50)): A network to estimate the mutual information between X and Y, I(X; Y). Parameters ---------- x_size, y_size ...
e5d7f7337328a2c5b82545de6d0bd27c88e52123
<|skeleton|> class MINE_Net: def __init__(self, x_size: int, y_size: int, hidden_units=(100, 50)): """A network to estimate the mutual information between X and Y, I(X; Y). Parameters ---------- x_size, y_size : int Number of neurons in X and Y. hidden_units : int or tuple of int Hidden layer size(s).""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MINE_Net: def __init__(self, x_size: int, y_size: int, hidden_units=(100, 50)): """A network to estimate the mutual information between X and Y, I(X; Y). Parameters ---------- x_size, y_size : int Number of neurons in X and Y. hidden_units : int or tuple of int Hidden layer size(s).""" super()...
the_stack_v2_python_sparse
mighty/monitor/mutual_info/neural_estimation.py
dizcza/pytorch-mighty
train
4
80e645d717c6819b5ce1d03dc638fa7acb73cf42
[ "result = _parseIso8601(input)\nif not result:\n result = _parseSimple(input)\nif result is not None:\n return result\nelse:\n raise ParameterError('Invalid time delta - could not parse %s' % input)", "weeks = x.days // 7\ndays = x.days % 7\nhours = x.seconds // 3600\nminutes = x.seconds % 3600 // 60\nse...
<|body_start_0|> result = _parseIso8601(input) if not result: result = _parseSimple(input) if result is not None: return result else: raise ParameterError('Invalid time delta - could not parse %s' % input) <|end_body_0|> <|body_start_1|> weeks...
Class that maps to timedelta using strings in any of the following forms: * ``n {w[eek[s]]|d[ay[s]]|h[our[s]]|m[inute[s]|s[second[s]]}`` (e.g. "1 week 2 days" or "1 h") Note: multiple arguments must be supplied in longest to shortest unit order * ISO 8601 duration ``PnDTnHnMnS`` (each field optional, years and months n...
TimeDeltaValueType
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TimeDeltaValueType: """Class that maps to timedelta using strings in any of the following forms: * ``n {w[eek[s]]|d[ay[s]]|h[our[s]]|m[inute[s]|s[second[s]]}`` (e.g. "1 week 2 days" or "1 h") Note: multiple arguments must be supplied in longest to shortest unit order * ISO 8601 duration ``PnDTnHn...
stack_v2_sparse_classes_36k_train_002096
4,446
permissive
[ { "docstring": "Parses a time delta from the input. See :py:class:`TimeDeltaValueType` for details on supported formats.", "name": "parse_from_str", "signature": "def parse_from_str(self, input)" }, { "docstring": "Converts datetime.timedelta to a string :param x: the value to serialize.", "...
2
null
Implement the Python class `TimeDeltaValueType` described below. Class description: Class that maps to timedelta using strings in any of the following forms: * ``n {w[eek[s]]|d[ay[s]]|h[our[s]]|m[inute[s]|s[second[s]]}`` (e.g. "1 week 2 days" or "1 h") Note: multiple arguments must be supplied in longest to shortest u...
Implement the Python class `TimeDeltaValueType` described below. Class description: Class that maps to timedelta using strings in any of the following forms: * ``n {w[eek[s]]|d[ay[s]]|h[our[s]]|m[inute[s]|s[second[s]]}`` (e.g. "1 week 2 days" or "1 h") Note: multiple arguments must be supplied in longest to shortest u...
d59c99dcdcd280d7eec36a693dd80f8c8c831ea2
<|skeleton|> class TimeDeltaValueType: """Class that maps to timedelta using strings in any of the following forms: * ``n {w[eek[s]]|d[ay[s]]|h[our[s]]|m[inute[s]|s[second[s]]}`` (e.g. "1 week 2 days" or "1 h") Note: multiple arguments must be supplied in longest to shortest unit order * ISO 8601 duration ``PnDTnHn...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TimeDeltaValueType: """Class that maps to timedelta using strings in any of the following forms: * ``n {w[eek[s]]|d[ay[s]]|h[our[s]]|m[inute[s]|s[second[s]]}`` (e.g. "1 week 2 days" or "1 h") Note: multiple arguments must be supplied in longest to shortest unit order * ISO 8601 duration ``PnDTnHnMnS`` (each f...
the_stack_v2_python_sparse
modules/dbnd/src/targets/values/timedelta_value.py
databand-ai/dbnd
train
257
33f2887c4568e71985fe51770b0904c51f57e187
[ "try:\n file_id = UUID(req_data['file_id']).hex\nexcept ValueError:\n return Response(status='400 Bad Request')\nstored_files = StoredFile.collection()\nto_delete = stored_files.first(id=file_id)\nlog_activity('%s deleted file %s' % (context.user.link, to_delete.filename))\nstored_files.delete(to_delete)\nget...
<|body_start_0|> try: file_id = UUID(req_data['file_id']).hex except ValueError: return Response(status='400 Bad Request') stored_files = StoredFile.collection() to_delete = stored_files.first(id=file_id) log_activity('%s deleted file %s' % (context.user.l...
The file set controller.
FileSetController
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FileSetController: """The file set controller.""" def delete(self, *route, **req_data): """Handle a file delete.""" <|body_0|> def upload(self, *route, **req_data): """Handle a file upload.""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: ...
stack_v2_sparse_classes_36k_train_002097
8,541
permissive
[ { "docstring": "Handle a file delete.", "name": "delete", "signature": "def delete(self, *route, **req_data)" }, { "docstring": "Handle a file upload.", "name": "upload", "signature": "def upload(self, *route, **req_data)" } ]
2
stack_v2_sparse_classes_30k_train_007410
Implement the Python class `FileSetController` described below. Class description: The file set controller. Method signatures and docstrings: - def delete(self, *route, **req_data): Handle a file delete. - def upload(self, *route, **req_data): Handle a file upload.
Implement the Python class `FileSetController` described below. Class description: The file set controller. Method signatures and docstrings: - def delete(self, *route, **req_data): Handle a file delete. - def upload(self, *route, **req_data): Handle a file upload. <|skeleton|> class FileSetController: """The fi...
b34cb4b2ee7cc40b2c99015f05bfcc12d4b49065
<|skeleton|> class FileSetController: """The file set controller.""" def delete(self, *route, **req_data): """Handle a file delete.""" <|body_0|> def upload(self, *route, **req_data): """Handle a file upload.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FileSetController: """The file set controller.""" def delete(self, *route, **req_data): """Handle a file delete.""" try: file_id = UUID(req_data['file_id']).hex except ValueError: return Response(status='400 Bad Request') stored_files = StoredFile.c...
the_stack_v2_python_sparse
zoom/_assets/standard_apps/content/files.py
dsilabs/zoom
train
9
3c29634bdc27ce94bc9beb1d26a25e12fb7a2cb2
[ "if config['lang'] != 'ja':\n raise Exception('SudachiPy tokenizer is only allowed in Japanese pipelines.')\ncheck_sudachipy()\nfrom sudachipy import tokenizer\nfrom sudachipy import dictionary\nself.tokenizer = dictionary.Dictionary().create()\nself.no_ssplit = config.get('no_ssplit', False)", "if isinstance(...
<|body_start_0|> if config['lang'] != 'ja': raise Exception('SudachiPy tokenizer is only allowed in Japanese pipelines.') check_sudachipy() from sudachipy import tokenizer from sudachipy import dictionary self.tokenizer = dictionary.Dictionary().create() self....
SudachiPyTokenizer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SudachiPyTokenizer: def __init__(self, config): """Construct a SudachiPy-based tokenizer. Note that this tokenizer uses regex for sentence segmentation.""" <|body_0|> def process(self, document): """Tokenize a document with the SudachiPy tokenizer and wrap the result...
stack_v2_sparse_classes_36k_train_002098
2,917
permissive
[ { "docstring": "Construct a SudachiPy-based tokenizer. Note that this tokenizer uses regex for sentence segmentation.", "name": "__init__", "signature": "def __init__(self, config)" }, { "docstring": "Tokenize a document with the SudachiPy tokenizer and wrap the results into a Doc object.", ...
2
stack_v2_sparse_classes_30k_train_002717
Implement the Python class `SudachiPyTokenizer` described below. Class description: Implement the SudachiPyTokenizer class. Method signatures and docstrings: - def __init__(self, config): Construct a SudachiPy-based tokenizer. Note that this tokenizer uses regex for sentence segmentation. - def process(self, document...
Implement the Python class `SudachiPyTokenizer` described below. Class description: Implement the SudachiPyTokenizer class. Method signatures and docstrings: - def __init__(self, config): Construct a SudachiPy-based tokenizer. Note that this tokenizer uses regex for sentence segmentation. - def process(self, document...
c530c9af647d521262b56b717bcc38b0cfc5f1b8
<|skeleton|> class SudachiPyTokenizer: def __init__(self, config): """Construct a SudachiPy-based tokenizer. Note that this tokenizer uses regex for sentence segmentation.""" <|body_0|> def process(self, document): """Tokenize a document with the SudachiPy tokenizer and wrap the result...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SudachiPyTokenizer: def __init__(self, config): """Construct a SudachiPy-based tokenizer. Note that this tokenizer uses regex for sentence segmentation.""" if config['lang'] != 'ja': raise Exception('SudachiPy tokenizer is only allowed in Japanese pipelines.') check_sudachi...
the_stack_v2_python_sparse
stanza/pipeline/external/sudachipy.py
stanfordnlp/stanza
train
4,281
bcfbde64ce11edec887e623888b7b8fb092c26a4
[ "inputs = tf.placeholder(dtype=tf.float32, shape=[None, None, 100])\nencoder = UnidirectionalRNNEncoder()\n_, _ = encoder(inputs)\nself.assertEqual(len(encoder.trainable_variables), 2)\nhparams = {'rnn_cell': {'dropout': {'input_keep_prob': 0.5}}}\nencoder = UnidirectionalRNNEncoder(hparams=hparams)\n_, _ = encoder...
<|body_start_0|> inputs = tf.placeholder(dtype=tf.float32, shape=[None, None, 100]) encoder = UnidirectionalRNNEncoder() _, _ = encoder(inputs) self.assertEqual(len(encoder.trainable_variables), 2) hparams = {'rnn_cell': {'dropout': {'input_keep_prob': 0.5}}} encoder = Un...
Tests :class:`~texar.tf.modules.UnidirectionalRNNEncoder` class.
UnidirectionalRNNEncoderTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UnidirectionalRNNEncoderTest: """Tests :class:`~texar.tf.modules.UnidirectionalRNNEncoder` class.""" def test_trainable_variables(self): """Tests the functionality of automatically collecting trainable variables.""" <|body_0|> def test_encode(self): """Tests enco...
stack_v2_sparse_classes_36k_train_002099
9,397
permissive
[ { "docstring": "Tests the functionality of automatically collecting trainable variables.", "name": "test_trainable_variables", "signature": "def test_trainable_variables(self)" }, { "docstring": "Tests encoding.", "name": "test_encode", "signature": "def test_encode(self)" }, { "...
3
stack_v2_sparse_classes_30k_train_012699
Implement the Python class `UnidirectionalRNNEncoderTest` described below. Class description: Tests :class:`~texar.tf.modules.UnidirectionalRNNEncoder` class. Method signatures and docstrings: - def test_trainable_variables(self): Tests the functionality of automatically collecting trainable variables. - def test_enc...
Implement the Python class `UnidirectionalRNNEncoderTest` described below. Class description: Tests :class:`~texar.tf.modules.UnidirectionalRNNEncoder` class. Method signatures and docstrings: - def test_trainable_variables(self): Tests the functionality of automatically collecting trainable variables. - def test_enc...
0704b3d4c93915b9a6f96b725e49ae20bf5d1e90
<|skeleton|> class UnidirectionalRNNEncoderTest: """Tests :class:`~texar.tf.modules.UnidirectionalRNNEncoder` class.""" def test_trainable_variables(self): """Tests the functionality of automatically collecting trainable variables.""" <|body_0|> def test_encode(self): """Tests enco...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UnidirectionalRNNEncoderTest: """Tests :class:`~texar.tf.modules.UnidirectionalRNNEncoder` class.""" def test_trainable_variables(self): """Tests the functionality of automatically collecting trainable variables.""" inputs = tf.placeholder(dtype=tf.float32, shape=[None, None, 100]) ...
the_stack_v2_python_sparse
texar/tf/modules/encoders/rnn_encoders_test.py
arita37/texar
train
2