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
abe36b79affb6c3b72833b3c03d964c92b7fe81a
[ "if not root:\n return []\nqueue = collections.deque([root])\nretval = ''\nwhile queue:\n curr = queue.popleft()\n if curr == 'null':\n retval += curr + ','\n continue\n else:\n retval += str(curr.val) + ','\n if curr.left:\n queue.append(curr.left)\n else:\n que...
<|body_start_0|> if not root: return [] queue = collections.deque([root]) retval = '' while queue: curr = queue.popleft() if curr == 'null': retval += curr + ',' continue else: retval += str(c...
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 0 1 2 3 4 5 6 "[1, 2, 3, null, null, 4, 5]" r r....
stack_v2_sparse_classes_36k_train_006700
2,551
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 0 1 2 3 4 5 6 \"[1, 2, 3, null, null, 4, 5]\" r r.l r.r r.l.l...
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. :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:...
bbfee57ae89d23cd4f4132fbb62d8931ea654a0e
<|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 0 1 2 3 4 5 6 "[1, 2, 3, null, null, 4, 5]" r r....
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 [] queue = collections.deque([root]) retval = '' while queue: curr = queue.popleft() if curr == 'null': ...
the_stack_v2_python_sparse
Algorithms/Leetcode/297 - Serialize and Deserialize Binary Tree.py
timpark0807/self-taught-swe
train
1
8f46a27f7c83bc18231870f1e29ea4b45f935519
[ "db_api = DataBaseAPI(NotificationDB).session\nnote = NotificationDB()\nnote.sender = sender\nnote.receiver = receiver\nnote.msg_type = msg_type\nnote.message = message\nnote.read = 0\ndb_api.add(note)\ndb_api.commit()\ndb_api.close()\nqueue.put({'user_id': receiver, 'msg': message, 'msg_type': msg_type})\nlog.debu...
<|body_start_0|> db_api = DataBaseAPI(NotificationDB).session note = NotificationDB() note.sender = sender note.receiver = receiver note.msg_type = msg_type note.message = message note.read = 0 db_api.add(note) db_api.commit() db_api.close(...
Implemented notification api
NotificationAPI
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NotificationAPI: """Implemented notification api""" def send(sender, receiver, msg_type, message): """Add notification""" <|body_0|> def read(msg_id): """Read message""" <|body_1|> def get(get_by=None): """Get notification: all, by sender, by...
stack_v2_sparse_classes_36k_train_006701
1,653
no_license
[ { "docstring": "Add notification", "name": "send", "signature": "def send(sender, receiver, msg_type, message)" }, { "docstring": "Read message", "name": "read", "signature": "def read(msg_id)" }, { "docstring": "Get notification: all, by sender, by receiver get_by = ('sender/rec...
3
stack_v2_sparse_classes_30k_train_003092
Implement the Python class `NotificationAPI` described below. Class description: Implemented notification api Method signatures and docstrings: - def send(sender, receiver, msg_type, message): Add notification - def read(msg_id): Read message - def get(get_by=None): Get notification: all, by sender, by receiver get_b...
Implement the Python class `NotificationAPI` described below. Class description: Implemented notification api Method signatures and docstrings: - def send(sender, receiver, msg_type, message): Add notification - def read(msg_id): Read message - def get(get_by=None): Get notification: all, by sender, by receiver get_b...
a14a5160e78c3d2ebf86a2eb91b13ae6f38ac32a
<|skeleton|> class NotificationAPI: """Implemented notification api""" def send(sender, receiver, msg_type, message): """Add notification""" <|body_0|> def read(msg_id): """Read message""" <|body_1|> def get(get_by=None): """Get notification: all, by sender, by...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NotificationAPI: """Implemented notification api""" def send(sender, receiver, msg_type, message): """Add notification""" db_api = DataBaseAPI(NotificationDB).session note = NotificationDB() note.sender = sender note.receiver = receiver note.msg_type = msg_...
the_stack_v2_python_sparse
libs/user/notification_api.py
yacneyac/fportal
train
0
ed3e8549fe20bd04c8c2de712e72c1acfd599457
[ "super().__init__(energy=energy, direction=direction, particle_id=particle_id, name=name)\nself.x = x\nself.y = y\nself.prior_propagation_distance = prior_propagation_distance\nself.post_propagation_distance = post_propagation_distance\nself.propagation_step_size = propagation_step_size\nself.constant_de_dx = const...
<|body_start_0|> super().__init__(energy=energy, direction=direction, particle_id=particle_id, name=name) self.x = x self.y = y self.prior_propagation_distance = prior_propagation_distance self.post_propagation_distance = post_propagation_distance self.propagation_step_si...
This class implements a track-like particle. Energy depositions are distributed along the track in equal distances until the particle either has no more energy left or until it has propagated the specified distance. The track of the particle is defined by an anchor-point, the direction, and the propagation distance bef...
TrackParticle
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TrackParticle: """This class implements a track-like particle. Energy depositions are distributed along the track in equal distances until the particle either has no more energy left or until it has propagated the specified distance. The track of the particle is defined by an anchor-point, the di...
stack_v2_sparse_classes_36k_train_006702
6,812
no_license
[ { "docstring": "Initialize the track particle. Parameters ---------- energy : float The energy of the particle in arbitrary units. This must be greater equal zero. direction : float The direction of the particle in radians. The direction must be within [0, 2pi). x : float The x-coordinate of the track anchor-po...
2
stack_v2_sparse_classes_30k_test_001185
Implement the Python class `TrackParticle` described below. Class description: This class implements a track-like particle. Energy depositions are distributed along the track in equal distances until the particle either has no more energy left or until it has propagated the specified distance. The track of the particl...
Implement the Python class `TrackParticle` described below. Class description: This class implements a track-like particle. Energy depositions are distributed along the track in equal distances until the particle either has no more energy left or until it has propagated the specified distance. The track of the particl...
0d7442bd78f9899536a109e87a4c4639ade82a58
<|skeleton|> class TrackParticle: """This class implements a track-like particle. Energy depositions are distributed along the track in equal distances until the particle either has no more energy left or until it has propagated the specified distance. The track of the particle is defined by an anchor-point, the di...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TrackParticle: """This class implements a track-like particle. Energy depositions are distributed along the track in equal distances until the particle either has no more energy left or until it has propagated the specified distance. The track of the particle is defined by an anchor-point, the direction, and ...
the_stack_v2_python_sparse
project_a5/simulation/particle/track.py
yungsalami/linuxtest
train
0
2d6131dc1e935b2c4627483c654b7c7936f980cd
[ "self.cells = np.zeros(cells_shape)\nreal_width = cells_shape[0] - 2\nreal_height = cells_shape[1] - 2\nself.cells[1:-1, 1:-1] = np.random.randint(1, size=(real_width, real_height))\nself.timer = 0\nself.mask = np.ones(4)\nself.mask2 = np.ones(9)\nself.mask2[4] = 0", "buf = np.zeros(self.cells.shape)\ncells = sel...
<|body_start_0|> self.cells = np.zeros(cells_shape) real_width = cells_shape[0] - 2 real_height = cells_shape[1] - 2 self.cells[1:-1, 1:-1] = np.random.randint(1, size=(real_width, real_height)) self.timer = 0 self.mask = np.ones(4) self.mask2 = np.ones(9) ...
GameOfLife
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GameOfLife: def __init__(self, cells_shape): """Parameters ---------- cells_shape : 一个元组,表示画布的大小。 Examples -------- 建立一个高20,宽30的画布 game = GameOfLife((20, 30))""" <|body_0|> def update_state(self): """更新一次状态""" <|body_1|> def plot_state(self): """...
stack_v2_sparse_classes_36k_train_006703
4,173
no_license
[ { "docstring": "Parameters ---------- cells_shape : 一个元组,表示画布的大小。 Examples -------- 建立一个高20,宽30的画布 game = GameOfLife((20, 30))", "name": "__init__", "signature": "def __init__(self, cells_shape)" }, { "docstring": "更新一次状态", "name": "update_state", "signature": "def update_state(self)" ...
4
stack_v2_sparse_classes_30k_train_009254
Implement the Python class `GameOfLife` described below. Class description: Implement the GameOfLife class. Method signatures and docstrings: - def __init__(self, cells_shape): Parameters ---------- cells_shape : 一个元组,表示画布的大小。 Examples -------- 建立一个高20,宽30的画布 game = GameOfLife((20, 30)) - def update_state(self): 更新一次...
Implement the Python class `GameOfLife` described below. Class description: Implement the GameOfLife class. Method signatures and docstrings: - def __init__(self, cells_shape): Parameters ---------- cells_shape : 一个元组,表示画布的大小。 Examples -------- 建立一个高20,宽30的画布 game = GameOfLife((20, 30)) - def update_state(self): 更新一次...
c7b1e4de3afda8eb64c0e48d0ec6a9ddd1eb15a0
<|skeleton|> class GameOfLife: def __init__(self, cells_shape): """Parameters ---------- cells_shape : 一个元组,表示画布的大小。 Examples -------- 建立一个高20,宽30的画布 game = GameOfLife((20, 30))""" <|body_0|> def update_state(self): """更新一次状态""" <|body_1|> def plot_state(self): """...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GameOfLife: def __init__(self, cells_shape): """Parameters ---------- cells_shape : 一个元组,表示画布的大小。 Examples -------- 建立一个高20,宽30的画布 game = GameOfLife((20, 30))""" self.cells = np.zeros(cells_shape) real_width = cells_shape[0] - 2 real_height = cells_shape[1] - 2 self.cel...
the_stack_v2_python_sparse
day11.5/test.py
skyrookies/spider_learn
train
1
5e3c1767da85fc9a11cfda502c01d8108d32e1b2
[ "self.nums = nums\nself.reset = lambda: nums\nprint(self.reset)", "res = ListNode(0)\ntemp = self.head[:]\nwhile temp:\n ran = random.randrange(len(temp))\n res.append(temp[ran])\n temp.remove(temp[ran])\nreturn res" ]
<|body_start_0|> self.nums = nums self.reset = lambda: nums print(self.reset) <|end_body_0|> <|body_start_1|> res = ListNode(0) temp = self.head[:] while temp: ran = random.randrange(len(temp)) res.append(temp[ran]) temp.remove(temp[ra...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def __init__(self, head): """@param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node. :type head: ListNode""" <|body_0|> def getRandom(self): """:rtype: List[int] randomly generate a number corre...
stack_v2_sparse_classes_36k_train_006704
1,098
no_license
[ { "docstring": "@param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node. :type head: ListNode", "name": "__init__", "signature": "def __init__(self, head)" }, { "docstring": ":rtype: List[int] randomly generate a number corresponding ...
2
stack_v2_sparse_classes_30k_train_010429
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, head): @param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node. :type head: ListNode - def getRan...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, head): @param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node. :type head: ListNode - def getRan...
f3fc71f344cd758cfce77f16ab72992c99ab288e
<|skeleton|> class Solution: def __init__(self, head): """@param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node. :type head: ListNode""" <|body_0|> def getRandom(self): """:rtype: List[int] randomly generate a number corre...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def __init__(self, head): """@param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node. :type head: ListNode""" self.nums = nums self.reset = lambda: nums print(self.reset) def getRandom(self): "...
the_stack_v2_python_sparse
382_linkedListShuffle.py
jennyChing/leetCode
train
2
b552b57e885cc03f71d154a606903e93c7d561f0
[ "self.signatures = signature_dict\nself.ssgsea_kwds = ssgsea_kwds\nself.all_ids = reduce(lambda x, y: x.union(y), self.signatures.values(), set())", "series_in = False\nif isinstance(sample_data, pd.Series):\n sample_data = pd.DataFrame(sample_data)\n series_in = True\nif sample_data.index.duplicated().any(...
<|body_start_0|> self.signatures = signature_dict self.ssgsea_kwds = ssgsea_kwds self.all_ids = reduce(lambda x, y: x.union(y), self.signatures.values(), set()) <|end_body_0|> <|body_start_1|> series_in = False if isinstance(sample_data, pd.Series): sample_data = pd....
Basic classifier that uses pre-defined signatures to score samples and assess classification.
ssGSEAClassifier
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ssGSEAClassifier: """Basic classifier that uses pre-defined signatures to score samples and assess classification.""" def __init__(self, signature_dict, **ssgsea_kwds): """:param signature_dict: Dictionary. Keys are the class name, values are iterables of genes / probes or any other ...
stack_v2_sparse_classes_36k_train_006705
3,530
no_license
[ { "docstring": ":param signature_dict: Dictionary. Keys are the class name, values are iterables of genes / probes or any other row index :param ssgsea_kwds: Any additional kwargs are passed directly to the ssgsea algorithm.", "name": "__init__", "signature": "def __init__(self, signature_dict, **ssgsea...
2
stack_v2_sparse_classes_30k_train_015958
Implement the Python class `ssGSEAClassifier` described below. Class description: Basic classifier that uses pre-defined signatures to score samples and assess classification. Method signatures and docstrings: - def __init__(self, signature_dict, **ssgsea_kwds): :param signature_dict: Dictionary. Keys are the class n...
Implement the Python class `ssGSEAClassifier` described below. Class description: Basic classifier that uses pre-defined signatures to score samples and assess classification. Method signatures and docstrings: - def __init__(self, signature_dict, **ssgsea_kwds): :param signature_dict: Dictionary. Keys are the class n...
3cb6fa0e763ddc0a375fcd99a55eab5f9df26fe3
<|skeleton|> class ssGSEAClassifier: """Basic classifier that uses pre-defined signatures to score samples and assess classification.""" def __init__(self, signature_dict, **ssgsea_kwds): """:param signature_dict: Dictionary. Keys are the class name, values are iterables of genes / probes or any other ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ssGSEAClassifier: """Basic classifier that uses pre-defined signatures to score samples and assess classification.""" def __init__(self, signature_dict, **ssgsea_kwds): """:param signature_dict: Dictionary. Keys are the class name, values are iterables of genes / probes or any other row index :pa...
the_stack_v2_python_sparse
classification/signature.py
gaberosser/qmul-bioinf
train
3
a46fd4c1c4ad085c0da0fbb28fbfbd97e7652ad4
[ "found = False\nseedlist = self.get_Value()\nfor iseed in seedlist:\n found = iseed.startswith(name + ' ')\n if found:\n break\nreturn found", "offset = jobproperties.RandomFlags.RandomSeedOffset.get_Value()\nnewseed = name + ' OFFSET ' + str(offset) + ' ' + str(seed1) + ' ' + str(seed2)\nlogRandomFl...
<|body_start_0|> found = False seedlist = self.get_Value() for iseed in seedlist: found = iseed.startswith(name + ' ') if found: break return found <|end_body_0|> <|body_start_1|> offset = jobproperties.RandomFlags.RandomSeedOffset.get_Val...
Random number stream seeds
RandomSeedList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RandomSeedList: """Random number stream seeds""" def checkForExistingSeed(self, name): """Ensure that each stream is only initialized once""" <|body_0|> def addSeed(self, name, seed1, seed2): """Add seeds to internal seedlist. Seeds will be incremented by offset ...
stack_v2_sparse_classes_36k_train_006706
6,803
no_license
[ { "docstring": "Ensure that each stream is only initialized once", "name": "checkForExistingSeed", "signature": "def checkForExistingSeed(self, name)" }, { "docstring": "Add seeds to internal seedlist. Seeds will be incremented by offset values", "name": "addSeed", "signature": "def addS...
5
stack_v2_sparse_classes_30k_train_007144
Implement the Python class `RandomSeedList` described below. Class description: Random number stream seeds Method signatures and docstrings: - def checkForExistingSeed(self, name): Ensure that each stream is only initialized once - def addSeed(self, name, seed1, seed2): Add seeds to internal seedlist. Seeds will be i...
Implement the Python class `RandomSeedList` described below. Class description: Random number stream seeds Method signatures and docstrings: - def checkForExistingSeed(self, name): Ensure that each stream is only initialized once - def addSeed(self, name, seed1, seed2): Add seeds to internal seedlist. Seeds will be i...
22df23187ef85e9c3120122c8375ea0e7d8ea440
<|skeleton|> class RandomSeedList: """Random number stream seeds""" def checkForExistingSeed(self, name): """Ensure that each stream is only initialized once""" <|body_0|> def addSeed(self, name, seed1, seed2): """Add seeds to internal seedlist. Seeds will be incremented by offset ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RandomSeedList: """Random number stream seeds""" def checkForExistingSeed(self, name): """Ensure that each stream is only initialized once""" found = False seedlist = self.get_Value() for iseed in seedlist: found = iseed.startswith(name + ' ') if fo...
the_stack_v2_python_sparse
athena/Control/RngComps/python/RandomFlags.py
rushioda/PIXELVALID_athena
train
1
be9820eff1c4f8469af3a53d473ef9e2672c05bb
[ "if type(data) != np.ndarray or len(data.shape) != 2:\n raise TypeError('data must be a 2D numpy.ndarray')\nd, n = data.shape\nif n < 2:\n raise ValueError('data must contain multiple data points')\nX = data.T\nmean = np.mean(X, axis=0, keepdims=True)\ncov = np.matmul((X - mean).T, X - mean) / (n - 1)\nself.m...
<|body_start_0|> if type(data) != np.ndarray or len(data.shape) != 2: raise TypeError('data must be a 2D numpy.ndarray') d, n = data.shape if n < 2: raise ValueError('data must contain multiple data points') X = data.T mean = np.mean(X, axis=0, keepdims=Tr...
MultiNormal class
MultiNormal
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiNormal: """MultiNormal class""" def __init__(self, data): """Initializer""" <|body_0|> def pdf(self, x): """calculates the PDF at a data point. Args: x: (numpy.ndarray) containing the data point whose PDF should be calculated. Returns: (float) containing the...
stack_v2_sparse_classes_36k_train_006707
1,514
no_license
[ { "docstring": "Initializer", "name": "__init__", "signature": "def __init__(self, data)" }, { "docstring": "calculates the PDF at a data point. Args: x: (numpy.ndarray) containing the data point whose PDF should be calculated. Returns: (float) containing the value of the PDF.", "name": "pdf...
2
null
Implement the Python class `MultiNormal` described below. Class description: MultiNormal class Method signatures and docstrings: - def __init__(self, data): Initializer - def pdf(self, x): calculates the PDF at a data point. Args: x: (numpy.ndarray) containing the data point whose PDF should be calculated. Returns: (...
Implement the Python class `MultiNormal` described below. Class description: MultiNormal class Method signatures and docstrings: - def __init__(self, data): Initializer - def pdf(self, x): calculates the PDF at a data point. Args: x: (numpy.ndarray) containing the data point whose PDF should be calculated. Returns: (...
75274394adb52d740f6cd4000cc00bbde44b9b72
<|skeleton|> class MultiNormal: """MultiNormal class""" def __init__(self, data): """Initializer""" <|body_0|> def pdf(self, x): """calculates the PDF at a data point. Args: x: (numpy.ndarray) containing the data point whose PDF should be calculated. Returns: (float) containing the...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MultiNormal: """MultiNormal class""" def __init__(self, data): """Initializer""" if type(data) != np.ndarray or len(data.shape) != 2: raise TypeError('data must be a 2D numpy.ndarray') d, n = data.shape if n < 2: raise ValueError('data must contain ...
the_stack_v2_python_sparse
math/0x06-multivariate_prob/multinormal.py
jdarangop/holbertonschool-machine_learning
train
2
ec5c16e6b0505e1bbcec41c5e73e609eb7a11d24
[ "self.constructeur = constructeur\nself.internes = internes\nself.l_externes = l_externes\nself.d_externes = d_externes", "l_attributs = []\nfor attr in self.internes:\n if attr:\n l_attributs.append(getattr(objet, attr))\n else:\n l_attributs.append(objet)\nl_attributs.extend(self.l_externes)...
<|body_start_0|> self.constructeur = constructeur self.internes = internes self.l_externes = l_externes self.d_externes = d_externes <|end_body_0|> <|body_start_1|> l_attributs = [] for attr in self.internes: if attr: l_attributs.append(getatt...
Définition d'une classe attribut. Elle prend en paramètre : - un constructeur - une liste de taille inconnue de paramètres à passer au constructeur de l'attribut Elle possède une méthode 'construire' qui retourne l'attribut construit.
Attribut
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Attribut: """Définition d'une classe attribut. Elle prend en paramètre : - un constructeur - une liste de taille inconnue de paramètres à passer au constructeur de l'attribut Elle possède une méthode 'construire' qui retourne l'attribut construit.""" def __init__(self, constructeur=None, int...
stack_v2_sparse_classes_36k_train_006708
3,048
permissive
[ { "docstring": "Constructeur d'un attribut", "name": "__init__", "signature": "def __init__(self, constructeur=None, internes=(), l_externes=(), d_externes={})" }, { "docstring": "On construit et retourne l'attribut. Les paramètres internes sont rattachés à 'objet' passé en paramètre. Par exempl...
2
stack_v2_sparse_classes_30k_val_000353
Implement the Python class `Attribut` described below. Class description: Définition d'une classe attribut. Elle prend en paramètre : - un constructeur - une liste de taille inconnue de paramètres à passer au constructeur de l'attribut Elle possède une méthode 'construire' qui retourne l'attribut construit. Method si...
Implement the Python class `Attribut` described below. Class description: Définition d'une classe attribut. Elle prend en paramètre : - un constructeur - une liste de taille inconnue de paramètres à passer au constructeur de l'attribut Elle possède une méthode 'construire' qui retourne l'attribut construit. Method si...
7e93bff08cdf891352efba587e89c40f3b4a2301
<|skeleton|> class Attribut: """Définition d'une classe attribut. Elle prend en paramètre : - un constructeur - une liste de taille inconnue de paramètres à passer au constructeur de l'attribut Elle possède une méthode 'construire' qui retourne l'attribut construit.""" def __init__(self, constructeur=None, int...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Attribut: """Définition d'une classe attribut. Elle prend en paramètre : - un constructeur - une liste de taille inconnue de paramètres à passer au constructeur de l'attribut Elle possède une méthode 'construire' qui retourne l'attribut construit.""" def __init__(self, constructeur=None, internes=(), l_e...
the_stack_v2_python_sparse
src/bases/objet/attribut.py
vincent-lg/tsunami
train
5
ac833751a21f0b18f0ca50d8e1be0fa4233149ff
[ "self.logger = logging.getLogger(__name__)\nself.logger.addHandler(logging.NullHandler())\nself.root = BeautifulSoup(html, parser)", "self.logger.debug('Shifting link tag values.')\na_tags = self.root.find_all('a')\nfor a_tag in a_tags:\n if a_tag.string is None:\n continue\n if 'href' not in a_tag.a...
<|body_start_0|> self.logger = logging.getLogger(__name__) self.logger.addHandler(logging.NullHandler()) self.root = BeautifulSoup(html, parser) <|end_body_0|> <|body_start_1|> self.logger.debug('Shifting link tag values.') a_tags = self.root.find_all('a') for a_tag in a...
A class with tools to modify the HTML DOM via BeautifulSoup. Example: >>> html = open("sample.html").read() # string. >>> html = ModifyHTML(html, "html5lib") #BeautifulSoup object. >>> html.shift_links() >>> html.remove_images() >>> html.raw() # string version of the HTML with shifted links and no images.
ModifyHTML
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ModifyHTML: """A class with tools to modify the HTML DOM via BeautifulSoup. Example: >>> html = open("sample.html").read() # string. >>> html = ModifyHTML(html, "html5lib") #BeautifulSoup object. >>> html.shift_links() >>> html.remove_images() >>> html.raw() # string version of the HTML with shif...
stack_v2_sparse_classes_36k_train_006709
6,227
no_license
[ { "docstring": "Sets instance attributes.", "name": "__init__", "signature": "def __init__(self, html, parser='html5lib')" }, { "docstring": "Appends each A tag's @href value to the tag's text value if the @href value starts with \"http\" or \"https\", i.e. \"<a href='bar'>foo</a>\" to \"<a href...
4
stack_v2_sparse_classes_30k_train_001545
Implement the Python class `ModifyHTML` described below. Class description: A class with tools to modify the HTML DOM via BeautifulSoup. Example: >>> html = open("sample.html").read() # string. >>> html = ModifyHTML(html, "html5lib") #BeautifulSoup object. >>> html.shift_links() >>> html.remove_images() >>> html.raw()...
Implement the Python class `ModifyHTML` described below. Class description: A class with tools to modify the HTML DOM via BeautifulSoup. Example: >>> html = open("sample.html").read() # string. >>> html = ModifyHTML(html, "html5lib") #BeautifulSoup object. >>> html.shift_links() >>> html.remove_images() >>> html.raw()...
cbfb42e063e6d9436855ef7466c89e0f1c4d1ad3
<|skeleton|> class ModifyHTML: """A class with tools to modify the HTML DOM via BeautifulSoup. Example: >>> html = open("sample.html").read() # string. >>> html = ModifyHTML(html, "html5lib") #BeautifulSoup object. >>> html.shift_links() >>> html.remove_images() >>> html.raw() # string version of the HTML with shif...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ModifyHTML: """A class with tools to modify the HTML DOM via BeautifulSoup. Example: >>> html = open("sample.html").read() # string. >>> html = ModifyHTML(html, "html5lib") #BeautifulSoup object. >>> html.shift_links() >>> html.remove_images() >>> html.raw() # string version of the HTML with shifted links and...
the_stack_v2_python_sparse
c4c/executables/b4 oct17/html_to_textOLD.py
sskenner/spydersPrj
train
1
41770a091f9e1d5dad3af3007a5a0a58e5d07524
[ "if k <= 0:\n return 0\nres = 0\nq = []\nodd_index = [-1]\ncount_odd = 0\nfor num_id, num in enumerate(nums):\n if num % 2:\n if count_odd == k:\n res += self.calc_sub_list(q, odd_index, num_id)\n count_odd -= 1\n q.append(num)\n odd_index.append(num_id)\n cou...
<|body_start_0|> if k <= 0: return 0 res = 0 q = [] odd_index = [-1] count_odd = 0 for num_id, num in enumerate(nums): if num % 2: if count_odd == k: res += self.calc_sub_list(q, odd_index, num_id) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def numberOfSubarrays(self, nums: List[int], k: int) -> int: """思路: 举例 [2,2,2,1,2,2,1] k=1 1的index是3和6。 第一个1(满足k=1的条件)左边有四种可能(0-3个2, 3-(-1), -1相当于第0个奇数的索引,事实上不存在,3是第一个奇数1的索引),右边有3中可能(0-2个2)因此,res=(3-(-1))*(6-3)=12 第二个1(满足k=1的条件)左边有三种可能(0-2个2),右边有1中可能(0个2)因此,res=(6-3*(7-6)=3 所以总...
stack_v2_sparse_classes_36k_train_006710
2,847
no_license
[ { "docstring": "思路: 举例 [2,2,2,1,2,2,1] k=1 1的index是3和6。 第一个1(满足k=1的条件)左边有四种可能(0-3个2, 3-(-1), -1相当于第0个奇数的索引,事实上不存在,3是第一个奇数1的索引),右边有3中可能(0-2个2)因此,res=(3-(-1))*(6-3)=12 第二个1(满足k=1的条件)左边有三种可能(0-2个2),右边有1中可能(0个2)因此,res=(6-3*(7-6)=3 所以总共有12+3=15中可能", "name": "numberOfSubarrays", "signature": "def numberOfSuba...
2
stack_v2_sparse_classes_30k_train_009149
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numberOfSubarrays(self, nums: List[int], k: int) -> int: 思路: 举例 [2,2,2,1,2,2,1] k=1 1的index是3和6。 第一个1(满足k=1的条件)左边有四种可能(0-3个2, 3-(-1), -1相当于第0个奇数的索引,事实上不存在,3是第一个奇数1的索引),右边有3中可...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numberOfSubarrays(self, nums: List[int], k: int) -> int: 思路: 举例 [2,2,2,1,2,2,1] k=1 1的index是3和6。 第一个1(满足k=1的条件)左边有四种可能(0-3个2, 3-(-1), -1相当于第0个奇数的索引,事实上不存在,3是第一个奇数1的索引),右边有3中可...
2f15563a6749ede4f244792314377db4d7c263ec
<|skeleton|> class Solution: def numberOfSubarrays(self, nums: List[int], k: int) -> int: """思路: 举例 [2,2,2,1,2,2,1] k=1 1的index是3和6。 第一个1(满足k=1的条件)左边有四种可能(0-3个2, 3-(-1), -1相当于第0个奇数的索引,事实上不存在,3是第一个奇数1的索引),右边有3中可能(0-2个2)因此,res=(3-(-1))*(6-3)=12 第二个1(满足k=1的条件)左边有三种可能(0-2个2),右边有1中可能(0个2)因此,res=(6-3*(7-6)=3 所以总...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def numberOfSubarrays(self, nums: List[int], k: int) -> int: """思路: 举例 [2,2,2,1,2,2,1] k=1 1的index是3和6。 第一个1(满足k=1的条件)左边有四种可能(0-3个2, 3-(-1), -1相当于第0个奇数的索引,事实上不存在,3是第一个奇数1的索引),右边有3中可能(0-2个2)因此,res=(3-(-1))*(6-3)=12 第二个1(满足k=1的条件)左边有三种可能(0-2个2),右边有1中可能(0个2)因此,res=(6-3*(7-6)=3 所以总共有12+3=15中可能""...
the_stack_v2_python_sparse
array/1248. 统计「优美子数组」.py
Werifun/leetcode
train
0
23345d2ad3bec52df30ef073db3d4e0ebd9fb82b
[ "lab = Label(text=text, font_size=30, padding_x=5)\nlab.texture_update()\nreturn lab.texture_size", "if self.talking:\n tsize = self.get_text_size(text)\n anim = Animation(text_colour=[1.0, 1.0, 1.0, 0.0], duration=0.2)\n anim += Animation(size=tsize, duration=0.5)\n anim.bind(on_complete=lambda x, y:...
<|body_start_0|> lab = Label(text=text, font_size=30, padding_x=5) lab.texture_update() return lab.texture_size <|end_body_0|> <|body_start_1|> if self.talking: tsize = self.get_text_size(text) anim = Animation(text_colour=[1.0, 1.0, 1.0, 0.0], duration=0.2) ...
Class for each individual NPC.
NPC
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NPC: """Class for each individual NPC.""" def get_text_size(self, text): """Helper method, weighs the size of the text.""" <|body_0|> def update_speech(self, text): """Used to change speech in dialogue.""" <|body_1|> def _upd_speech(self, txt): ...
stack_v2_sparse_classes_36k_train_006711
13,499
no_license
[ { "docstring": "Helper method, weighs the size of the text.", "name": "get_text_size", "signature": "def get_text_size(self, text)" }, { "docstring": "Used to change speech in dialogue.", "name": "update_speech", "signature": "def update_speech(self, text)" }, { "docstring": "Pri...
4
null
Implement the Python class `NPC` described below. Class description: Class for each individual NPC. Method signatures and docstrings: - def get_text_size(self, text): Helper method, weighs the size of the text. - def update_speech(self, text): Used to change speech in dialogue. - def _upd_speech(self, txt): Private h...
Implement the Python class `NPC` described below. Class description: Class for each individual NPC. Method signatures and docstrings: - def get_text_size(self, text): Helper method, weighs the size of the text. - def update_speech(self, text): Used to change speech in dialogue. - def _upd_speech(self, txt): Private h...
732853897ae0048909efba7b57ea456e6aaf9e10
<|skeleton|> class NPC: """Class for each individual NPC.""" def get_text_size(self, text): """Helper method, weighs the size of the text.""" <|body_0|> def update_speech(self, text): """Used to change speech in dialogue.""" <|body_1|> def _upd_speech(self, txt): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NPC: """Class for each individual NPC.""" def get_text_size(self, text): """Helper method, weighs the size of the text.""" lab = Label(text=text, font_size=30, padding_x=5) lab.texture_update() return lab.texture_size def update_speech(self, text): """Used to ...
the_stack_v2_python_sparse
Games/Story-RPG/Original/entities.py
Exodus111/Projects
train
1
6926353fdae3345fd9c58cba4e88b821d6076eee
[ "def dfs(root):\n if not root:\n res.append('None')\n return\n res.append(str(root.val))\n dfs(root.left)\n dfs(root.right)\nres = []\ndfs(root)\nreturn ','.join(res)", "def recursiveDeserialize(stringList):\n if stringList[0] == 'None':\n stringList.pop(0)\n return None...
<|body_start_0|> def dfs(root): if not root: res.append('None') return res.append(str(root.val)) dfs(root.left) dfs(root.right) res = [] dfs(root) return ','.join(res) <|end_body_0|> <|body_start_1|> ...
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_006712
2,513
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_018133
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:...
d4d138716db9bfa236c87c25ae582a76a14faa28
<|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""" def dfs(root): if not root: res.append('None') return res.append(str(root.val)) dfs(root.left) dfs(root.ri...
the_stack_v2_python_sparse
SerializeAndDeserializeBinaryTree.py
aaronfox/LeetCode-Work
train
0
ba055b1214ab013bece7d277b8c7ae461caac1e1
[ "Node.__init__(self)\nself.dim = dim\nif init:\n self.value = np.mat(np.random.normal(0, 0.001, (self.dim, 1)))\nself.trainable = trainable", "assert isinstance(value, np.matrix) and value.shape == (self.dim, 1)\nself.reset_value()\nself.value = value" ]
<|body_start_0|> Node.__init__(self) self.dim = dim if init: self.value = np.mat(np.random.normal(0, 0.001, (self.dim, 1))) self.trainable = trainable <|end_body_0|> <|body_start_1|> assert isinstance(value, np.matrix) and value.shape == (self.dim, 1) self.re...
变(向)量节点
Variable
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Variable: """变(向)量节点""" def __init__(self, dim, init=False, trainable=True): """变量节点没有父节点,构造函数接受变量的维数,以及变量是否参与训练的标识""" <|body_0|> def set_value(self, value): """为变量赋值""" <|body_1|> <|end_skeleton|> <|body_start_0|> Node.__init__(self) se...
stack_v2_sparse_classes_36k_train_006713
6,904
permissive
[ { "docstring": "变量节点没有父节点,构造函数接受变量的维数,以及变量是否参与训练的标识", "name": "__init__", "signature": "def __init__(self, dim, init=False, trainable=True)" }, { "docstring": "为变量赋值", "name": "set_value", "signature": "def set_value(self, value)" } ]
2
stack_v2_sparse_classes_30k_train_006925
Implement the Python class `Variable` described below. Class description: 变(向)量节点 Method signatures and docstrings: - def __init__(self, dim, init=False, trainable=True): 变量节点没有父节点,构造函数接受变量的维数,以及变量是否参与训练的标识 - def set_value(self, value): 为变量赋值
Implement the Python class `Variable` described below. Class description: 变(向)量节点 Method signatures and docstrings: - def __init__(self, dim, init=False, trainable=True): 变量节点没有父节点,构造函数接受变量的维数,以及变量是否参与训练的标识 - def set_value(self, value): 为变量赋值 <|skeleton|> class Variable: """变(向)量节点""" def __init__(self, dim...
b4a9ddcc2820fd0e3c9bbd81c26a8fa35f348c23
<|skeleton|> class Variable: """变(向)量节点""" def __init__(self, dim, init=False, trainable=True): """变量节点没有父节点,构造函数接受变量的维数,以及变量是否参与训练的标识""" <|body_0|> def set_value(self, value): """为变量赋值""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Variable: """变(向)量节点""" def __init__(self, dim, init=False, trainable=True): """变量节点没有父节点,构造函数接受变量的维数,以及变量是否参与训练的标识""" Node.__init__(self) self.dim = dim if init: self.value = np.mat(np.random.normal(0, 0.001, (self.dim, 1))) self.trainable = trainable ...
the_stack_v2_python_sparse
lang/programming/python/深入理解神经网络:从逻辑回归到CNN/neural_network-neural_network_code-master/neural_network_code/第 8 章 计算图/node.py
dlxj/doc
train
10
275fa2c7e5d4e146c26456ec9769dc22ac47e764
[ "n = len(arr)\nbest_i = 0\ndist = sum([abs(arr[i] - x) for i in range(k)])\nfor i in range(1, n - k + 1):\n new_dist = dist - abs(arr[i - 1] - x) + abs(arr[i + (k - 1)] - x)\n if new_dist < dist:\n dist = new_dist\n best_i = i\nreturn arr[best_i:best_i + k]", "n = len(arr)\nl, r = (0, n)\nwhil...
<|body_start_0|> n = len(arr) best_i = 0 dist = sum([abs(arr[i] - x) for i in range(k)]) for i in range(1, n - k + 1): new_dist = dist - abs(arr[i - 1] - x) + abs(arr[i + (k - 1)] - x) if new_dist < dist: dist = new_dist best_i = i ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findClosestElements(self, arr: List[int], k: int, x: int) -> List[int]: """Sliding Window, Time: O(n), Space: O(k) for returns""" <|body_0|> def findClosestElements(self, arr: List[int], k: int, x: int) -> List[int]: """Binary Search, Time: O(logn+k), S...
stack_v2_sparse_classes_36k_train_006714
1,595
no_license
[ { "docstring": "Sliding Window, Time: O(n), Space: O(k) for returns", "name": "findClosestElements", "signature": "def findClosestElements(self, arr: List[int], k: int, x: int) -> List[int]" }, { "docstring": "Binary Search, Time: O(logn+k), Space: O(k) for returns", "name": "findClosestElem...
2
stack_v2_sparse_classes_30k_train_005792
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findClosestElements(self, arr: List[int], k: int, x: int) -> List[int]: Sliding Window, Time: O(n), Space: O(k) for returns - def findClosestElements(self, arr: List[int], k:...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findClosestElements(self, arr: List[int], k: int, x: int) -> List[int]: Sliding Window, Time: O(n), Space: O(k) for returns - def findClosestElements(self, arr: List[int], k:...
72136e3487d239f5b37e2d6393e034262a6bf599
<|skeleton|> class Solution: def findClosestElements(self, arr: List[int], k: int, x: int) -> List[int]: """Sliding Window, Time: O(n), Space: O(k) for returns""" <|body_0|> def findClosestElements(self, arr: List[int], k: int, x: int) -> List[int]: """Binary Search, Time: O(logn+k), S...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findClosestElements(self, arr: List[int], k: int, x: int) -> List[int]: """Sliding Window, Time: O(n), Space: O(k) for returns""" n = len(arr) best_i = 0 dist = sum([abs(arr[i] - x) for i in range(k)]) for i in range(1, n - k + 1): new_dist = d...
the_stack_v2_python_sparse
python/658-Find K Closest Elements.py
cwza/leetcode
train
0
884d63824f61ffe9bdb65c8b283659498eb9699b
[ "previous = None\ncurrent = head\nwhile current:\n next = current.next\n current.setNext(previous)\n previous = current\n current = next\nhead = current\nreturn previous", "if head == None or head.getNext() == None:\n return head\nelse:\n new_head = self.reverseListRecursive(head.getNext())\n ...
<|body_start_0|> previous = None current = head while current: next = current.next current.setNext(previous) previous = current current = next head = current return previous <|end_body_0|> <|body_start_1|> if head == None o...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def reverseListIteratively(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def reverseListRecursive(self, head): """:type head: ListNode :rtype: ListNode""" <|body_1|> def reverseListStack(self, head): """:type head:...
stack_v2_sparse_classes_36k_train_006715
1,941
no_license
[ { "docstring": ":type head: ListNode :rtype: ListNode", "name": "reverseListIteratively", "signature": "def reverseListIteratively(self, head)" }, { "docstring": ":type head: ListNode :rtype: ListNode", "name": "reverseListRecursive", "signature": "def reverseListRecursive(self, head)" ...
3
stack_v2_sparse_classes_30k_train_021463
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseListIteratively(self, head): :type head: ListNode :rtype: ListNode - def reverseListRecursive(self, head): :type head: ListNode :rtype: ListNode - def reverseListStack...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseListIteratively(self, head): :type head: ListNode :rtype: ListNode - def reverseListRecursive(self, head): :type head: ListNode :rtype: ListNode - def reverseListStack...
52d71a93de7f002ac887a82c947e1e32a3e7255f
<|skeleton|> class Solution: def reverseListIteratively(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def reverseListRecursive(self, head): """:type head: ListNode :rtype: ListNode""" <|body_1|> def reverseListStack(self, head): """:type head:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def reverseListIteratively(self, head): """:type head: ListNode :rtype: ListNode""" previous = None current = head while current: next = current.next current.setNext(previous) previous = current current = next he...
the_stack_v2_python_sparse
reverse-linked-list/solution.py
code-in-public/leetcode
train
3
90200695d97e7dad68b0b3a641b4fb01cc34eee1
[ "self.E1 = E1\nself.E2 = E2\nself.G12 = G12\nself.nu12 = nu12\nself.rho = rho\nself.name = name", "f = open(fname)\nskipLines(f, 3)\nmaterials = []\nfor line in f:\n array = line.split()\n mat = cls(float(array[1]), float(array[2]), float(array[3]), float(array[4]), float(array[5]), array[6])\n materials...
<|body_start_0|> self.E1 = E1 self.E2 = E2 self.G12 = G12 self.nu12 = nu12 self.rho = rho self.name = name <|end_body_0|> <|body_start_1|> f = open(fname) skipLines(f, 3) materials = [] for line in f: array = line.split() ...
Represents a homogeneous orthotropic material in a plane stress state.
Orthotropic2DMaterial
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Orthotropic2DMaterial: """Represents a homogeneous orthotropic material in a plane stress state.""" def __init__(self, E1, E2, G12, nu12, rho, name=''): """a struct-like object. all inputs are also fields. The object also has an identification number *.mat_idx so unique materials can...
stack_v2_sparse_classes_36k_train_006716
46,713
permissive
[ { "docstring": "a struct-like object. all inputs are also fields. The object also has an identification number *.mat_idx so unique materials can be identified. Parameters ---------- E1 : float (N/m^2) Young's modulus in first principal direction E2 : float (N/m^2) Young's modulus in second principal direction G...
2
null
Implement the Python class `Orthotropic2DMaterial` described below. Class description: Represents a homogeneous orthotropic material in a plane stress state. Method signatures and docstrings: - def __init__(self, E1, E2, G12, nu12, rho, name=''): a struct-like object. all inputs are also fields. The object also has a...
Implement the Python class `Orthotropic2DMaterial` described below. Class description: Represents a homogeneous orthotropic material in a plane stress state. Method signatures and docstrings: - def __init__(self, E1, E2, G12, nu12, rho, name=''): a struct-like object. all inputs are also fields. The object also has a...
d7270ebe1c554293a9d36730d67ab555c071cb17
<|skeleton|> class Orthotropic2DMaterial: """Represents a homogeneous orthotropic material in a plane stress state.""" def __init__(self, E1, E2, G12, nu12, rho, name=''): """a struct-like object. all inputs are also fields. The object also has an identification number *.mat_idx so unique materials can...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Orthotropic2DMaterial: """Represents a homogeneous orthotropic material in a plane stress state.""" def __init__(self, E1, E2, G12, nu12, rho, name=''): """a struct-like object. all inputs are also fields. The object also has an identification number *.mat_idx so unique materials can be identifie...
the_stack_v2_python_sparse
wisdem/rotorse/precomp.py
WISDEM/WISDEM
train
120
28e24b31e0271fe24559f6fdfff255d20ff1d1e8
[ "try:\n if not data['project_id'] or not data['case_id'] or (not data['id']) or (not data['host_id']):\n return JsonResponse(code=code.CODE_PARAMETER_ERROR)\nexcept KeyError:\n return JsonResponse(code=code.CODE_PARAMETER_ERROR)", "data = JSONParser().parse(request)\nproject = get_availability_projec...
<|body_start_0|> try: if not data['project_id'] or not data['case_id'] or (not data['id']) or (not data['host_id']): return JsonResponse(code=code.CODE_PARAMETER_ERROR) except KeyError: return JsonResponse(code=code.CODE_PARAMETER_ERROR) <|end_body_0|> <|body_sta...
Test
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test: def parameter_check(self, data): """校验参数 :param data: :return:""" <|body_0|> def post(self, request): """执行 :param request: :return:0""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: if not data['project_id'] or not data['case_...
stack_v2_sparse_classes_36k_train_006717
11,514
no_license
[ { "docstring": "校验参数 :param data: :return:", "name": "parameter_check", "signature": "def parameter_check(self, data)" }, { "docstring": "执行 :param request: :return:0", "name": "post", "signature": "def post(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_005290
Implement the Python class `Test` described below. Class description: Implement the Test class. Method signatures and docstrings: - def parameter_check(self, data): 校验参数 :param data: :return: - def post(self, request): 执行 :param request: :return:0
Implement the Python class `Test` described below. Class description: Implement the Test class. Method signatures and docstrings: - def parameter_check(self, data): 校验参数 :param data: :return: - def post(self, request): 执行 :param request: :return:0 <|skeleton|> class Test: def parameter_check(self, data): ...
85a3804c10c6966eecf89deb7a6baccd2a03b875
<|skeleton|> class Test: def parameter_check(self, data): """校验参数 :param data: :return:""" <|body_0|> def post(self, request): """执行 :param request: :return:0""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Test: def parameter_check(self, data): """校验参数 :param data: :return:""" try: if not data['project_id'] or not data['case_id'] or (not data['id']) or (not data['host_id']): return JsonResponse(code=code.CODE_PARAMETER_ERROR) except KeyError: retur...
the_stack_v2_python_sparse
api_test/views/test_case.py
AqiComing/Aqi_Automations_API
train
0
fd568b75de80c290f602f228a76c009882ea4e9d
[ "g.sort()\ns.sort()\ncount = 0\ni, j = (0, 0)\nm, n = (len(g), len(s))\nwhile i < m and j < n:\n if s[j] >= g[i]:\n i += 1\n j += 1\n count += 1\n else:\n j += 1\nreturn count", "g.sort()\ns.sort()\nans = 0\nwhile g and s:\n if s[0] >= g[0]:\n ans += 1\n g.pop(0)...
<|body_start_0|> g.sort() s.sort() count = 0 i, j = (0, 0) m, n = (len(g), len(s)) while i < m and j < n: if s[j] >= g[i]: i += 1 j += 1 count += 1 else: j += 1 return count <|...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findContentChildren(self, g, s): """:type g: List[int] :type s: List[int] :rtype: int""" <|body_0|> def findContentChildren2(self, g, s): """:type g: List[int] :type s: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_006718
1,187
no_license
[ { "docstring": ":type g: List[int] :type s: List[int] :rtype: int", "name": "findContentChildren", "signature": "def findContentChildren(self, g, s)" }, { "docstring": ":type g: List[int] :type s: List[int] :rtype: int", "name": "findContentChildren2", "signature": "def findContentChildr...
2
stack_v2_sparse_classes_30k_train_007891
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findContentChildren(self, g, s): :type g: List[int] :type s: List[int] :rtype: int - def findContentChildren2(self, g, s): :type g: List[int] :type s: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findContentChildren(self, g, s): :type g: List[int] :type s: List[int] :rtype: int - def findContentChildren2(self, g, s): :type g: List[int] :type s: List[int] :rtype: int ...
0fc4c7af59246e3064db41989a45d9db413a624b
<|skeleton|> class Solution: def findContentChildren(self, g, s): """:type g: List[int] :type s: List[int] :rtype: int""" <|body_0|> def findContentChildren2(self, g, s): """:type g: List[int] :type s: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findContentChildren(self, g, s): """:type g: List[int] :type s: List[int] :rtype: int""" g.sort() s.sort() count = 0 i, j = (0, 0) m, n = (len(g), len(s)) while i < m and j < n: if s[j] >= g[i]: i += 1 ...
the_stack_v2_python_sparse
455. Assign Cookies/cookie.py
Macielyoung/LeetCode
train
1
075f1e254770ec0a618e4773a9cbf8b3a096061f
[ "dp = [1] * (n + 1)\nfor i in range(2, n + 1):\n for j in range(1, i // 2 + 1):\n dp[i] = max(dp[i], max(i - j, dp[i - j]) * j)\nreturn dp[-1]", "res = 1\n\ndef dfs(remain, count, presum):\n nonlocal res\n if remain == 0:\n if count > 1:\n res = max(res, presum)\n return\n...
<|body_start_0|> dp = [1] * (n + 1) for i in range(2, n + 1): for j in range(1, i // 2 + 1): dp[i] = max(dp[i], max(i - j, dp[i - j]) * j) return dp[-1] <|end_body_0|> <|body_start_1|> res = 1 def dfs(remain, count, presum): nonlocal res ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def integerBreak1(self, n: int) -> int: """思路:动态规划法 1. i:当前n的大小; 2. j:最后一段划分的长度 3. 当划分了最后一段后,前面的有两种情况: 1)i-j:表示没有分段 2)dp[i-j]:表示有分段""" <|body_0|> def integerBreak2(self, n: int) -> int: """思路:dfs超时""" <|body_1|> def integerBreak3(self, n: int) ...
stack_v2_sparse_classes_36k_train_006719
2,843
no_license
[ { "docstring": "思路:动态规划法 1. i:当前n的大小; 2. j:最后一段划分的长度 3. 当划分了最后一段后,前面的有两种情况: 1)i-j:表示没有分段 2)dp[i-j]:表示有分段", "name": "integerBreak1", "signature": "def integerBreak1(self, n: int) -> int" }, { "docstring": "思路:dfs超时", "name": "integerBreak2", "signature": "def integerBreak2(self, n: int) -...
4
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def integerBreak1(self, n: int) -> int: 思路:动态规划法 1. i:当前n的大小; 2. j:最后一段划分的长度 3. 当划分了最后一段后,前面的有两种情况: 1)i-j:表示没有分段 2)dp[i-j]:表示有分段 - def integerBreak2(self, n: int) -> int: 思路:dfs超...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def integerBreak1(self, n: int) -> int: 思路:动态规划法 1. i:当前n的大小; 2. j:最后一段划分的长度 3. 当划分了最后一段后,前面的有两种情况: 1)i-j:表示没有分段 2)dp[i-j]:表示有分段 - def integerBreak2(self, n: int) -> int: 思路:dfs超...
e43ee86c5a8cdb808da09b4b6138e10275abadb5
<|skeleton|> class Solution: def integerBreak1(self, n: int) -> int: """思路:动态规划法 1. i:当前n的大小; 2. j:最后一段划分的长度 3. 当划分了最后一段后,前面的有两种情况: 1)i-j:表示没有分段 2)dp[i-j]:表示有分段""" <|body_0|> def integerBreak2(self, n: int) -> int: """思路:dfs超时""" <|body_1|> def integerBreak3(self, n: int) ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def integerBreak1(self, n: int) -> int: """思路:动态规划法 1. i:当前n的大小; 2. j:最后一段划分的长度 3. 当划分了最后一段后,前面的有两种情况: 1)i-j:表示没有分段 2)dp[i-j]:表示有分段""" dp = [1] * (n + 1) for i in range(2, n + 1): for j in range(1, i // 2 + 1): dp[i] = max(dp[i], max(i - j, dp[i - ...
the_stack_v2_python_sparse
LeetCode/动态规划法(dp)/343. 整数拆分.py
yiming1012/MyLeetCode
train
2
7678c0146afcfe24fad1401d4474d098fa05d29c
[ "super(SourceTraitSearchForm, self).__init__(*args, **kwargs)\nself.helper = FormHelper(self)\nself.helper.form_method = 'get'\nself.helper.form_class = 'form-horizontal'\nself.helper.label_class = 'col-sm-2'\nself.helper.field_class = 'col-sm-10'\nself.helper.layout = Layout(Row(Div(name_checkbox_layout, 'descript...
<|body_start_0|> super(SourceTraitSearchForm, self).__init__(*args, **kwargs) self.helper = FormHelper(self) self.helper.form_method = 'get' self.helper.form_class = 'form-horizontal' self.helper.label_class = 'col-sm-2' self.helper.field_class = 'col-sm-10' self....
Form to handle django-watson searches for SourceTrait objects. This form class is a Subclass of crispy_forms.Form. Crispy forms is a Django app that improves upon the built in Django Form object.
SourceTraitSearchForm
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SourceTraitSearchForm: """Form to handle django-watson searches for SourceTrait objects. This form class is a Subclass of crispy_forms.Form. Crispy forms is a Django app that improves upon the built in Django Form object.""" def __init__(self, *args, **kwargs): """Initialize form wit...
stack_v2_sparse_classes_36k_train_006720
19,577
permissive
[ { "docstring": "Initialize form with formatting and submit button.", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Perform additional multi-field cleaning to make sure that either description or name is entered.", "name": "clean", "signature": ...
2
stack_v2_sparse_classes_30k_train_010750
Implement the Python class `SourceTraitSearchForm` described below. Class description: Form to handle django-watson searches for SourceTrait objects. This form class is a Subclass of crispy_forms.Form. Crispy forms is a Django app that improves upon the built in Django Form object. Method signatures and docstrings: -...
Implement the Python class `SourceTraitSearchForm` described below. Class description: Form to handle django-watson searches for SourceTrait objects. This form class is a Subclass of crispy_forms.Form. Crispy forms is a Django app that improves upon the built in Django Form object. Method signatures and docstrings: -...
89ae277f5ba1357580d78c3527f26200686308a6
<|skeleton|> class SourceTraitSearchForm: """Form to handle django-watson searches for SourceTrait objects. This form class is a Subclass of crispy_forms.Form. Crispy forms is a Django app that improves upon the built in Django Form object.""" def __init__(self, *args, **kwargs): """Initialize form wit...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SourceTraitSearchForm: """Form to handle django-watson searches for SourceTrait objects. This form class is a Subclass of crispy_forms.Form. Crispy forms is a Django app that improves upon the built in Django Form object.""" def __init__(self, *args, **kwargs): """Initialize form with formatting ...
the_stack_v2_python_sparse
trait_browser/forms.py
UW-GAC/pie
train
0
5885f66e6d7e56f733deb43afa3733a8d645136c
[ "k = 2 * np.pi / wave.wavelength\nunwrapped_phase_lbl = f'[{np.min(wave.get_unwrapped_phase(aperture=aperture, z=z)[0]):.2f}, {np.max(wave.get_unwrapped_phase(aperture=aperture, z=z)[0]):.2f}] rad; [{np.min(wave.get_unwrapped_phase(aperture=aperture, z=z)[0]) * 1000000.0 / k:.1f}, {np.max(wave.get_unwrapped_phase(a...
<|body_start_0|> k = 2 * np.pi / wave.wavelength unwrapped_phase_lbl = f'[{np.min(wave.get_unwrapped_phase(aperture=aperture, z=z)[0]):.2f}, {np.max(wave.get_unwrapped_phase(aperture=aperture, z=z)[0]):.2f}] rad; [{np.min(wave.get_unwrapped_phase(aperture=aperture, z=z)[0]) * 1000000.0 / k:.1f}, {np.max...
Построение графиков распространения волны в пространстве
WavePlotter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WavePlotter: """Построение графиков распространения волны в пространстве""" def save_phase(wave: Wave, aperture: Aperture, z: float, saver: Saver, save_npy: bool=False): """Сохраняет график для фазы :return:""" <|body_0|> def save_intensity(wave: Wave, z: float, saver: S...
stack_v2_sparse_classes_36k_train_006721
3,997
no_license
[ { "docstring": "Сохраняет график для фазы :return:", "name": "save_phase", "signature": "def save_phase(wave: Wave, aperture: Aperture, z: float, saver: Saver, save_npy: bool=False)" }, { "docstring": "Сохраняет график для интенсивности :return:", "name": "save_intensity", "signature": "...
4
stack_v2_sparse_classes_30k_train_006136
Implement the Python class `WavePlotter` described below. Class description: Построение графиков распространения волны в пространстве Method signatures and docstrings: - def save_phase(wave: Wave, aperture: Aperture, z: float, saver: Saver, save_npy: bool=False): Сохраняет график для фазы :return: - def save_intensit...
Implement the Python class `WavePlotter` described below. Class description: Построение графиков распространения волны в пространстве Method signatures and docstrings: - def save_phase(wave: Wave, aperture: Aperture, z: float, saver: Saver, save_npy: bool=False): Сохраняет график для фазы :return: - def save_intensit...
102ff08f22d9f82d74884d5c31a6b91b804d26f4
<|skeleton|> class WavePlotter: """Построение графиков распространения волны в пространстве""" def save_phase(wave: Wave, aperture: Aperture, z: float, saver: Saver, save_npy: bool=False): """Сохраняет график для фазы :return:""" <|body_0|> def save_intensity(wave: Wave, z: float, saver: S...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WavePlotter: """Построение графиков распространения волны в пространстве""" def save_phase(wave: Wave, aperture: Aperture, z: float, saver: Saver, save_npy: bool=False): """Сохраняет график для фазы :return:""" k = 2 * np.pi / wave.wavelength unwrapped_phase_lbl = f'[{np.min(wave....
the_stack_v2_python_sparse
src/propagation/presenter/interface/wave_plotter.py
megamott/Phase-problem-modeling
train
2
9827027d6011841b373dcc555e813f9804a058c9
[ "self.dict = dict()\nself.chars = []\nfor i in range(ord('a'), ord('z') + 1):\n self.chars.append(chr(i))", "for word in dict:\n for charIndex in range(0, len(word)):\n for w in self.chars:\n if w != word[charIndex]:\n newStr = word[0:charIndex] + w + word[charIndex + 1:len(...
<|body_start_0|> self.dict = dict() self.chars = [] for i in range(ord('a'), ord('z') + 1): self.chars.append(chr(i)) <|end_body_0|> <|body_start_1|> for word in dict: for charIndex in range(0, len(word)): for w in self.chars: ...
MagicDictionary
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MagicDictionary: def __init__(self): """Initialize your data structure here.""" <|body_0|> def buildDict(self, dict): """Build a dictionary through a list of words :type dict: List[str] :rtype: None""" <|body_1|> def search(self, word): """Return...
stack_v2_sparse_classes_36k_train_006722
1,381
no_license
[ { "docstring": "Initialize your data structure here.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Build a dictionary through a list of words :type dict: List[str] :rtype: None", "name": "buildDict", "signature": "def buildDict(self, dict)" }, { "docs...
3
stack_v2_sparse_classes_30k_train_002849
Implement the Python class `MagicDictionary` described below. Class description: Implement the MagicDictionary class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def buildDict(self, dict): Build a dictionary through a list of words :type dict: List[str] :rtype: None ...
Implement the Python class `MagicDictionary` described below. Class description: Implement the MagicDictionary class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def buildDict(self, dict): Build a dictionary through a list of words :type dict: List[str] :rtype: None ...
56c9bfde870e2d682539e5bf223e0f32e411e610
<|skeleton|> class MagicDictionary: def __init__(self): """Initialize your data structure here.""" <|body_0|> def buildDict(self, dict): """Build a dictionary through a list of words :type dict: List[str] :rtype: None""" <|body_1|> def search(self, word): """Return...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MagicDictionary: def __init__(self): """Initialize your data structure here.""" self.dict = dict() self.chars = [] for i in range(ord('a'), ord('z') + 1): self.chars.append(chr(i)) def buildDict(self, dict): """Build a dictionary through a list of words...
the_stack_v2_python_sparse
Tree/Implement Magic Dictionary.py
lulukdog/leetcode-Python
train
3
60b332c50a941ae0f7c4f6e8da27b7c4e836e455
[ "param = {'account': self.phone, 'address': '办公地址', 'annexList': [{'name': '1', 'url': '1.txt'}, {'name': '2', 'url': '2.png'}], 'businessLicense': random.randint(1000000, 9999999), 'certificateList': [{'name': '1', 'url': '1.txt'}, {'name': '2', 'url': '2.png'}], 'constructorCount': 100, 'email': 'string@163.com',...
<|body_start_0|> param = {'account': self.phone, 'address': '办公地址', 'annexList': [{'name': '1', 'url': '1.txt'}, {'name': '2', 'url': '2.png'}], 'businessLicense': random.randint(1000000, 9999999), 'certificateList': [{'name': '1', 'url': '1.txt'}, {'name': '2', 'url': '2.png'}], 'constructorCount': 100, 'email...
TestGovernConstruction
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestGovernConstruction: def test_001_add_construction_business(self): """【政府端--适老化】:添加施工单位""" <|body_0|> def test_002_get_construction_business_list(self): """【政府端--适老化】:分页查询施工单位列表""" <|body_1|> def test_003_edit_construction_business(self): """【...
stack_v2_sparse_classes_36k_train_006723
5,711
no_license
[ { "docstring": "【政府端--适老化】:添加施工单位", "name": "test_001_add_construction_business", "signature": "def test_001_add_construction_business(self)" }, { "docstring": "【政府端--适老化】:分页查询施工单位列表", "name": "test_002_get_construction_business_list", "signature": "def test_002_get_construction_business...
6
stack_v2_sparse_classes_30k_train_017752
Implement the Python class `TestGovernConstruction` described below. Class description: Implement the TestGovernConstruction class. Method signatures and docstrings: - def test_001_add_construction_business(self): 【政府端--适老化】:添加施工单位 - def test_002_get_construction_business_list(self): 【政府端--适老化】:分页查询施工单位列表 - def test_...
Implement the Python class `TestGovernConstruction` described below. Class description: Implement the TestGovernConstruction class. Method signatures and docstrings: - def test_001_add_construction_business(self): 【政府端--适老化】:添加施工单位 - def test_002_get_construction_business_list(self): 【政府端--适老化】:分页查询施工单位列表 - def test_...
024bb8f0e8be7d19abfb14b405ef79bd85cc6b7b
<|skeleton|> class TestGovernConstruction: def test_001_add_construction_business(self): """【政府端--适老化】:添加施工单位""" <|body_0|> def test_002_get_construction_business_list(self): """【政府端--适老化】:分页查询施工单位列表""" <|body_1|> def test_003_edit_construction_business(self): """【...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestGovernConstruction: def test_001_add_construction_business(self): """【政府端--适老化】:添加施工单位""" param = {'account': self.phone, 'address': '办公地址', 'annexList': [{'name': '1', 'url': '1.txt'}, {'name': '2', 'url': '2.png'}], 'businessLicense': random.randint(1000000, 9999999), 'certificateList': ...
the_stack_v2_python_sparse
test_case/test_house/test_govern_construction.py
cjuan123/auto_api
train
0
749fb019c39d3c8c3c474528a1eb7f585e7109af
[ "self.session = session\nself.tornado_cassandra = TornadoCassandra(self.session)\nself.project = project\nself.txid = txid\nself.op_id = uuid.uuid4()\nself.read_op_id = None\nself.applied = False", "if self.applied:\n raise gen.Return(True)\nget_status = '\\n SELECT applied, op_id FROM batch_status\\n ...
<|body_start_0|> self.session = session self.tornado_cassandra = TornadoCassandra(self.session) self.project = project self.txid = txid self.op_id = uuid.uuid4() self.read_op_id = None self.applied = False <|end_body_0|> <|body_start_1|> if self.applied: ...
LargeBatch
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LargeBatch: def __init__(self, session, project, txid): """Create a new LargeBatch object. Args: session: A cassandra-driver session. project: A string specifying a project ID. txid: An integer specifying a transaction ID.""" <|body_0|> def is_applied(self, retries=5): ...
stack_v2_sparse_classes_36k_train_006724
13,309
permissive
[ { "docstring": "Create a new LargeBatch object. Args: session: A cassandra-driver session. project: A string specifying a project ID. txid: An integer specifying a transaction ID.", "name": "__init__", "signature": "def __init__(self, session, project, txid)" }, { "docstring": "Fetch the status ...
5
null
Implement the Python class `LargeBatch` described below. Class description: Implement the LargeBatch class. Method signatures and docstrings: - def __init__(self, session, project, txid): Create a new LargeBatch object. Args: session: A cassandra-driver session. project: A string specifying a project ID. txid: An int...
Implement the Python class `LargeBatch` described below. Class description: Implement the LargeBatch class. Method signatures and docstrings: - def __init__(self, session, project, txid): Create a new LargeBatch object. Args: session: A cassandra-driver session. project: A string specifying a project ID. txid: An int...
be17e5f658d7b42b5aa7eeb7a5ddd4962f3ea82f
<|skeleton|> class LargeBatch: def __init__(self, session, project, txid): """Create a new LargeBatch object. Args: session: A cassandra-driver session. project: A string specifying a project ID. txid: An integer specifying a transaction ID.""" <|body_0|> def is_applied(self, retries=5): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LargeBatch: def __init__(self, session, project, txid): """Create a new LargeBatch object. Args: session: A cassandra-driver session. project: A string specifying a project ID. txid: An integer specifying a transaction ID.""" self.session = session self.tornado_cassandra = TornadoCassa...
the_stack_v2_python_sparse
AppDB/appscale/datastore/cassandra_env/large_batch.py
obino/appscale
train
1
bb8d606dd6fab92e7a643bd2ffe8a380187e108f
[ "super(AdaptiveSoftmaxEmbedding, self).__init__(name=name)\nself._hidden_size = dim\nself._vocab_size = vocab_size\nself._cutoffs = [0] + list(cutoffs) + [self._vocab_size]\nself._tail_shrink_factor = tail_shrink_factor\nself._hierarchical = hierarchical\nself._dtype = dtype\nself._embeddings = []\nself._projection...
<|body_start_0|> super(AdaptiveSoftmaxEmbedding, self).__init__(name=name) self._hidden_size = dim self._vocab_size = vocab_size self._cutoffs = [0] + list(cutoffs) + [self._vocab_size] self._tail_shrink_factor = tail_shrink_factor self._hierarchical = hierarchical ...
Adaptive inputs and softmax (https://arxiv.org/abs/1809.10853).
AdaptiveSoftmaxEmbedding
[ "Apache-2.0", "CC-BY-SA-4.0", "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdaptiveSoftmaxEmbedding: """Adaptive inputs and softmax (https://arxiv.org/abs/1809.10853).""" def __init__(self, dim: int, vocab_size: int, cutoffs: List[int], tail_shrink_factor: int=4, hierarchical: bool=True, init_std: float=0.02, init_proj_std: float=0.01, dtype: jnp.dtype=jnp.float32,...
stack_v2_sparse_classes_36k_train_006725
14,391
permissive
[ { "docstring": "Initialize a AdaptiveSoftmaxEmbedding. Args: dim: dimensionality of the hidden space. vocab_size: the size of the vocabulary. cutoffs: the cutoff indices of the vocabulary used for the adaptive softmax embedding. tail_shrink_factor: how many times to shrink the hidden dimensionality for low-freq...
5
null
Implement the Python class `AdaptiveSoftmaxEmbedding` described below. Class description: Adaptive inputs and softmax (https://arxiv.org/abs/1809.10853). Method signatures and docstrings: - def __init__(self, dim: int, vocab_size: int, cutoffs: List[int], tail_shrink_factor: int=4, hierarchical: bool=True, init_std: ...
Implement the Python class `AdaptiveSoftmaxEmbedding` described below. Class description: Adaptive inputs and softmax (https://arxiv.org/abs/1809.10853). Method signatures and docstrings: - def __init__(self, dim: int, vocab_size: int, cutoffs: List[int], tail_shrink_factor: int=4, hierarchical: bool=True, init_std: ...
a6ef8053380d6aa19aaae14b93f013ae9762d057
<|skeleton|> class AdaptiveSoftmaxEmbedding: """Adaptive inputs and softmax (https://arxiv.org/abs/1809.10853).""" def __init__(self, dim: int, vocab_size: int, cutoffs: List[int], tail_shrink_factor: int=4, hierarchical: bool=True, init_std: float=0.02, init_proj_std: float=0.01, dtype: jnp.dtype=jnp.float32,...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AdaptiveSoftmaxEmbedding: """Adaptive inputs and softmax (https://arxiv.org/abs/1809.10853).""" def __init__(self, dim: int, vocab_size: int, cutoffs: List[int], tail_shrink_factor: int=4, hierarchical: bool=True, init_std: float=0.02, init_proj_std: float=0.01, dtype: jnp.dtype=jnp.float32, name: Option...
the_stack_v2_python_sparse
wikigraphs/wikigraphs/model/embedding.py
sethuramanio/deepmind-research
train
1
230e85628c62cd1b6f2bbad827fab61227c72304
[ "args = self.get_args.parse_args()\nnum_rows = args.get('rows') or 100\nquery = g.db.query(MachineGroup)\nif args['name']:\n query = query.filter(MachineGroup.name == args['name'])\nquery = query.order_by(-MachineGroup.machinegroup_id)\nquery = query.limit(num_rows)\nrows = query.all()\nret = []\nfor row in rows...
<|body_start_0|> args = self.get_args.parse_args() num_rows = args.get('rows') or 100 query = g.db.query(MachineGroup) if args['name']: query = query.filter(MachineGroup.name == args['name']) query = query.order_by(-MachineGroup.machinegroup_id) query = query....
MachineGroupsAPI
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MachineGroupsAPI: def get(self): """Get a list of machine groups""" <|body_0|> def post(self): """Create machine group""" <|body_1|> <|end_skeleton|> <|body_start_0|> args = self.get_args.parse_args() num_rows = args.get('rows') or 100 ...
stack_v2_sparse_classes_36k_train_006726
4,880
permissive
[ { "docstring": "Get a list of machine groups", "name": "get", "signature": "def get(self)" }, { "docstring": "Create machine group", "name": "post", "signature": "def post(self)" } ]
2
null
Implement the Python class `MachineGroupsAPI` described below. Class description: Implement the MachineGroupsAPI class. Method signatures and docstrings: - def get(self): Get a list of machine groups - def post(self): Create machine group
Implement the Python class `MachineGroupsAPI` described below. Class description: Implement the MachineGroupsAPI class. Method signatures and docstrings: - def get(self): Get a list of machine groups - def post(self): Create machine group <|skeleton|> class MachineGroupsAPI: def get(self): """Get a list...
9825cb22b26b577b715f2ce95453363bf90ecc7e
<|skeleton|> class MachineGroupsAPI: def get(self): """Get a list of machine groups""" <|body_0|> def post(self): """Create machine group""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MachineGroupsAPI: def get(self): """Get a list of machine groups""" args = self.get_args.parse_args() num_rows = args.get('rows') or 100 query = g.db.query(MachineGroup) if args['name']: query = query.filter(MachineGroup.name == args['name']) query =...
the_stack_v2_python_sparse
driftbase/api/machinegroups.py
dgnorth/drift-base
train
1
10ce31fab78c771bafd534c5ccd69276ac026eb1
[ "contribution = self.get_contribution(request.user, project_id, contribution_id)\nfile = self.get_file(contribution, file_id)\nreturn self.get_single_and_respond(request, file)", "contribution = self.get_contribution(request.user, project_id, contribution_id)\nfile = self.get_file(contribution, file_id)\nreturn s...
<|body_start_0|> contribution = self.get_contribution(request.user, project_id, contribution_id) file = self.get_file(contribution, file_id) return self.get_single_and_respond(request, file) <|end_body_0|> <|body_start_1|> contribution = self.get_contribution(request.user, project_id, c...
Public API for a single media.
SingleMediaAPIView
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SingleMediaAPIView: """Public API for a single media.""" def get(self, request, project_id, contribution_id, file_id): """Handle GET request. Return a single media file. Parameters ---------- request : rest_framework.request.Request Object representing the request. project_id : int I...
stack_v2_sparse_classes_36k_train_006727
9,811
permissive
[ { "docstring": "Handle GET request. Return a single media file. Parameters ---------- request : rest_framework.request.Request Object representing the request. project_id : int Identifies the project in the database. contribution_id : int Identifies the contribution in the database. file_id : int Identifies the...
2
null
Implement the Python class `SingleMediaAPIView` described below. Class description: Public API for a single media. Method signatures and docstrings: - def get(self, request, project_id, contribution_id, file_id): Handle GET request. Return a single media file. Parameters ---------- request : rest_framework.request.Re...
Implement the Python class `SingleMediaAPIView` described below. Class description: Public API for a single media. Method signatures and docstrings: - def get(self, request, project_id, contribution_id, file_id): Handle GET request. Return a single media file. Parameters ---------- request : rest_framework.request.Re...
16d31b5207de9f699fc01054baad1fe65ad1c3ca
<|skeleton|> class SingleMediaAPIView: """Public API for a single media.""" def get(self, request, project_id, contribution_id, file_id): """Handle GET request. Return a single media file. Parameters ---------- request : rest_framework.request.Request Object representing the request. project_id : int I...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SingleMediaAPIView: """Public API for a single media.""" def get(self, request, project_id, contribution_id, file_id): """Handle GET request. Return a single media file. Parameters ---------- request : rest_framework.request.Request Object representing the request. project_id : int Identifies the...
the_stack_v2_python_sparse
geokey/contributions/views/media.py
NeolithEra/geokey
train
0
65b9d7822e4a288223cd61732077935de9c06c02
[ "widget = widget\nsummary = get_widget_r(self, 'summary')\nif self.mode == 'svg':\n summary.set_text(_('Image « <b><u>%s</u></b> »\\nstored in <b>%s</b> ') % (self.book.get_page('svg_name').get_imagename(), self.book.get_page('svg_kind').get_target()))\nsummary.set_justify(gtk.JUSTIFY_CENTER)\nsummary.set_use_ma...
<|body_start_0|> widget = widget summary = get_widget_r(self, 'summary') if self.mode == 'svg': summary.set_text(_('Image « <b><u>%s</u></b> »\nstored in <b>%s</b> ') % (self.book.get_page('svg_name').get_imagename(), self.book.get_page('svg_kind').get_target())) summary.set_...
Page used to display a summary of what will be done
PageSummary
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PageSummary: """Page used to display a summary of what will be done""" def _cb_show(self, widget=None, data=None): """refresh summary when shown""" <|body_0|> def launch_backup(self, widget=None, data=None): """called when the user starts a backup""" <|bo...
stack_v2_sparse_classes_36k_train_006728
41,782
no_license
[ { "docstring": "refresh summary when shown", "name": "_cb_show", "signature": "def _cb_show(self, widget=None, data=None)" }, { "docstring": "called when the user starts a backup", "name": "launch_backup", "signature": "def launch_backup(self, widget=None, data=None)" }, { "docst...
4
stack_v2_sparse_classes_30k_train_011797
Implement the Python class `PageSummary` described below. Class description: Page used to display a summary of what will be done Method signatures and docstrings: - def _cb_show(self, widget=None, data=None): refresh summary when shown - def launch_backup(self, widget=None, data=None): called when the user starts a b...
Implement the Python class `PageSummary` described below. Class description: Page used to display a summary of what will be done Method signatures and docstrings: - def _cb_show(self, widget=None, data=None): refresh summary when shown - def launch_backup(self, widget=None, data=None): called when the user starts a b...
53c26e3c03c5054fb9d5730cf98716442a07464a
<|skeleton|> class PageSummary: """Page used to display a summary of what will be done""" def _cb_show(self, widget=None, data=None): """refresh summary when shown""" <|body_0|> def launch_backup(self, widget=None, data=None): """called when the user starts a backup""" <|bo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PageSummary: """Page used to display a summary of what will be done""" def _cb_show(self, widget=None, data=None): """refresh summary when shown""" widget = widget summary = get_widget_r(self, 'summary') if self.mode == 'svg': summary.set_text(_('Image « <b><u>...
the_stack_v2_python_sparse
beam_pages.py
mandriva-management-console/beam
train
0
adbf410bd5c87415c82ffabead0805a0846f1089
[ "d = set()\nfor i in nums:\n if i in d:\n return True\n else:\n d.add(i)\nreturn False", "if len(nums) == 0:\n return False\nnums.sort()\nfor i in range(0, len(nums) - 1):\n if nums[i] == nums[i + 1]:\n return True\nreturn False" ]
<|body_start_0|> d = set() for i in nums: if i in d: return True else: d.add(i) return False <|end_body_0|> <|body_start_1|> if len(nums) == 0: return False nums.sort() for i in range(0, len(nums) - 1): ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def containsDuplicate(self, nums): """:type nums: List[int] :rtype: bool""" <|body_0|> def containsDuplicate2(self, nums): """:type nums: List[int] :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> d = set() for i in num...
stack_v2_sparse_classes_36k_train_006729
1,137
no_license
[ { "docstring": ":type nums: List[int] :rtype: bool", "name": "containsDuplicate", "signature": "def containsDuplicate(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: bool", "name": "containsDuplicate2", "signature": "def containsDuplicate2(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_016970
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def containsDuplicate(self, nums): :type nums: List[int] :rtype: bool - def containsDuplicate2(self, nums): :type nums: List[int] :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def containsDuplicate(self, nums): :type nums: List[int] :rtype: bool - def containsDuplicate2(self, nums): :type nums: List[int] :rtype: bool <|skeleton|> class Solution: ...
813235789ce422a3bab198317aafc46fbc61625e
<|skeleton|> class Solution: def containsDuplicate(self, nums): """:type nums: List[int] :rtype: bool""" <|body_0|> def containsDuplicate2(self, nums): """:type nums: List[int] :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def containsDuplicate(self, nums): """:type nums: List[int] :rtype: bool""" d = set() for i in nums: if i in d: return True else: d.add(i) return False def containsDuplicate2(self, nums): """:type nu...
the_stack_v2_python_sparse
2.SET/e217_contains_duplicate/solution.py
kimmyoo/python_leetcode
train
1
a7671d493884bd184cdb4d8959f22f244fe2d152
[ "bracket_map = {'(': ')', '{': '}', '[': ']'}\nstack = []\nfor c in s:\n if c in bracket_map:\n stack.append(bracket_map[c])\n elif c in bracket_map.values():\n if stack:\n test = stack.pop()\n if test != c:\n return False\n else:\n return F...
<|body_start_0|> bracket_map = {'(': ')', '{': '}', '[': ']'} stack = [] for c in s: if c in bracket_map: stack.append(bracket_map[c]) elif c in bracket_map.values(): if stack: test = stack.pop() if t...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isValid1(self, s): """:type s: str :rtype: bool""" <|body_0|> def isValid(self, s): """:type s: str :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> bracket_map = {'(': ')', '{': '}', '[': ']'} stack = [] fo...
stack_v2_sparse_classes_36k_train_006730
1,061
no_license
[ { "docstring": ":type s: str :rtype: bool", "name": "isValid1", "signature": "def isValid1(self, s)" }, { "docstring": ":type s: str :rtype: bool", "name": "isValid", "signature": "def isValid(self, s)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isValid1(self, s): :type s: str :rtype: bool - def isValid(self, s): :type s: str :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isValid1(self, s): :type s: str :rtype: bool - def isValid(self, s): :type s: str :rtype: bool <|skeleton|> class Solution: def isValid1(self, s): """:type s: s...
4a1747b6497305f3821612d9c358a6795b1690da
<|skeleton|> class Solution: def isValid1(self, s): """:type s: str :rtype: bool""" <|body_0|> def isValid(self, s): """:type s: str :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isValid1(self, s): """:type s: str :rtype: bool""" bracket_map = {'(': ')', '{': '}', '[': ']'} stack = [] for c in s: if c in bracket_map: stack.append(bracket_map[c]) elif c in bracket_map.values(): if stac...
the_stack_v2_python_sparse
Stack/q020_valid_parenthese.py
sevenhe716/LeetCode
train
0
65d1da10ab57a2cac7ac1ca0f94dbdd9c31e3e9b
[ "resource_args.AddCopyBackupResourceArgs(parser)\ngroup_parser = parser.add_argument_group(mutex=True, required=True)\ngroup_parser.add_argument('--expiration-date', help='Expiration time of the backup, must be at least 6 hours and at most 366 days from the time when the source backup is created. See `$ gcloud topi...
<|body_start_0|> resource_args.AddCopyBackupResourceArgs(parser) group_parser = parser.add_argument_group(mutex=True, required=True) group_parser.add_argument('--expiration-date', help='Expiration time of the backup, must be at least 6 hours and at most 366 days from the time when the source bac...
Copies a backup of a Cloud Spanner database.
Copy
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Copy: """Copies a backup of a Cloud Spanner database.""" def Args(parser): """Register flags for this command.""" <|body_0|> def Run(self, args): """This is what gets called when the user runs this command.""" <|body_1|> <|end_skeleton|> <|body_start_0|...
stack_v2_sparse_classes_36k_train_006731
3,919
permissive
[ { "docstring": "Register flags for this command.", "name": "Args", "signature": "def Args(parser)" }, { "docstring": "This is what gets called when the user runs this command.", "name": "Run", "signature": "def Run(self, args)" } ]
2
null
Implement the Python class `Copy` described below. Class description: Copies a backup of a Cloud Spanner database. Method signatures and docstrings: - def Args(parser): Register flags for this command. - def Run(self, args): This is what gets called when the user runs this command.
Implement the Python class `Copy` described below. Class description: Copies a backup of a Cloud Spanner database. Method signatures and docstrings: - def Args(parser): Register flags for this command. - def Run(self, args): This is what gets called when the user runs this command. <|skeleton|> class Copy: """Co...
392abf004b16203030e6efd2f0af24db7c8d669e
<|skeleton|> class Copy: """Copies a backup of a Cloud Spanner database.""" def Args(parser): """Register flags for this command.""" <|body_0|> def Run(self, args): """This is what gets called when the user runs this command.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Copy: """Copies a backup of a Cloud Spanner database.""" def Args(parser): """Register flags for this command.""" resource_args.AddCopyBackupResourceArgs(parser) group_parser = parser.add_argument_group(mutex=True, required=True) group_parser.add_argument('--expiration-dat...
the_stack_v2_python_sparse
lib/surface/spanner/backups/copy.py
google-cloud-sdk-unofficial/google-cloud-sdk
train
9
dfb3cb00901145667477975d43c55445d752eda1
[ "behavior.Behavior.__init__(self, nodename, ctrlrID)\nself._uses_wp_control = True\nself._last_wp_id = 0\nself.wp_msg = LLA()\nself._wpPublisher = rospy.Publisher('autopilot/payload_waypoint', LLA, tcp_nodelay=True, latch=True, queue_size=1)", "if wp.alt >= enums.MIN_REL_ALT and wp.alt <= enums.MAX_REL_ALT and (a...
<|body_start_0|> behavior.Behavior.__init__(self, nodename, ctrlrID) self._uses_wp_control = True self._last_wp_id = 0 self.wp_msg = LLA() self._wpPublisher = rospy.Publisher('autopilot/payload_waypoint', LLA, tcp_nodelay=True, latch=True, queue_size=1) <|end_body_0|> <|body_sta...
Abstract class for wrapping a control-order-issuing ACS ROS object Control is implemented through the generation of waypoint commands. Instantiated objects will provide a waypoint publisher that publishes computed waypoints to the appropriate topic. Class member variables: _wpPublisher: publisher object for publishing ...
WaypointBehavior
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WaypointBehavior: """Abstract class for wrapping a control-order-issuing ACS ROS object Control is implemented through the generation of waypoint commands. Instantiated objects will provide a waypoint publisher that publishes computed waypoints to the appropriate topic. Class member variables: _w...
stack_v2_sparse_classes_36k_train_006732
4,100
no_license
[ { "docstring": "Class initializer sets up the publisher for the waypoint topic @param nodename: name of the node that the object is contained in @param ctrlrID: identifier (int) for this particular behavior", "name": "__init__", "signature": "def __init__(self, nodename, ctrlrID)" }, { "docstrin...
2
stack_v2_sparse_classes_30k_val_000420
Implement the Python class `WaypointBehavior` described below. Class description: Abstract class for wrapping a control-order-issuing ACS ROS object Control is implemented through the generation of waypoint commands. Instantiated objects will provide a waypoint publisher that publishes computed waypoints to the approp...
Implement the Python class `WaypointBehavior` described below. Class description: Abstract class for wrapping a control-order-issuing ACS ROS object Control is implemented through the generation of waypoint commands. Instantiated objects will provide a waypoint publisher that publishes computed waypoints to the approp...
ec2b5c43abed51a37c17bde0c000c2dfbfcbb9b1
<|skeleton|> class WaypointBehavior: """Abstract class for wrapping a control-order-issuing ACS ROS object Control is implemented through the generation of waypoint commands. Instantiated objects will provide a waypoint publisher that publishes computed waypoints to the appropriate topic. Class member variables: _w...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WaypointBehavior: """Abstract class for wrapping a control-order-issuing ACS ROS object Control is implemented through the generation of waypoint commands. Instantiated objects will provide a waypoint publisher that publishes computed waypoints to the appropriate topic. Class member variables: _wpPublisher: p...
the_stack_v2_python_sparse
ap_lib/src/ap_lib/waypoint_behavior.py
jaymonty/autonomy-payload
train
0
b4cc6bcb27a43d153bc09ea98392be10defb41b1
[ "cluster = self.get_object_or_404(objects.Cluster, cluster_id)\nself.check_net_provider(cluster)\nreturn self.serializer.serialize_for_cluster(cluster)", "data = jsonutils.loads(web.data())\nif data.get('networks'):\n data['networks'] = [n for n in data['networks'] if n.get('name') != 'fuelweb_admin']\ncluster...
<|body_start_0|> cluster = self.get_object_or_404(objects.Cluster, cluster_id) self.check_net_provider(cluster) return self.serializer.serialize_for_cluster(cluster) <|end_body_0|> <|body_start_1|> data = jsonutils.loads(web.data()) if data.get('networks'): data['net...
Network configuration handler
NovaNetworkConfigurationHandler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NovaNetworkConfigurationHandler: """Network configuration handler""" def GET(self, cluster_id): """:returns: JSONized network configuration for cluster. :http: * 200 (OK) * 404 (cluster not found in db)""" <|body_0|> def PUT(self, cluster_id): """:returns: JSONiz...
stack_v2_sparse_classes_36k_train_006733
8,763
permissive
[ { "docstring": ":returns: JSONized network configuration for cluster. :http: * 200 (OK) * 404 (cluster not found in db)", "name": "GET", "signature": "def GET(self, cluster_id)" }, { "docstring": ":returns: JSONized Task object. :http: * 200 (task successfully executed) * 202 (network checking t...
2
null
Implement the Python class `NovaNetworkConfigurationHandler` described below. Class description: Network configuration handler Method signatures and docstrings: - def GET(self, cluster_id): :returns: JSONized network configuration for cluster. :http: * 200 (OK) * 404 (cluster not found in db) - def PUT(self, cluster_...
Implement the Python class `NovaNetworkConfigurationHandler` described below. Class description: Network configuration handler Method signatures and docstrings: - def GET(self, cluster_id): :returns: JSONized network configuration for cluster. :http: * 200 (OK) * 404 (cluster not found in db) - def PUT(self, cluster_...
976baf842242a5f97c95bdc3e20328fa0558bf69
<|skeleton|> class NovaNetworkConfigurationHandler: """Network configuration handler""" def GET(self, cluster_id): """:returns: JSONized network configuration for cluster. :http: * 200 (OK) * 404 (cluster not found in db)""" <|body_0|> def PUT(self, cluster_id): """:returns: JSONiz...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NovaNetworkConfigurationHandler: """Network configuration handler""" def GET(self, cluster_id): """:returns: JSONized network configuration for cluster. :http: * 200 (OK) * 404 (cluster not found in db)""" cluster = self.get_object_or_404(objects.Cluster, cluster_id) self.check_ne...
the_stack_v2_python_sparse
nailgun/nailgun/api/v1/handlers/network_configuration.py
nebril/fuel-web
train
1
e2bfccc5e25a7ea591fb31c4019eb4a45a244a94
[ "xff = request.META.get('HTTP_X_FORWARDED_FOR')\nremote_addr = request.META.get('REMOTE_ADDR')\nnum_proxies = api_settings.NUM_PROXIES\nif num_proxies is not None:\n if num_proxies == 0 or xff is None:\n return remote_addr\n addrs = xff.split(',')\n client_addr = addrs[-min(num_proxies, len(addrs))]...
<|body_start_0|> xff = request.META.get('HTTP_X_FORWARDED_FOR') remote_addr = request.META.get('REMOTE_ADDR') num_proxies = api_settings.NUM_PROXIES if num_proxies is not None: if num_proxies == 0 or xff is None: return remote_addr addrs = xff.spli...
TestThrottle
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestThrottle: def get_ident(self, request): """根据用户IP和代理IP,当做请求者的唯一IP Identify the machine making the request by parsing HTTP_X_FORWARDED_FOR if present and number of proxies is > 0. If not use all of HTTP_X_FORWARDED_FOR if it is available, if not use REMOTE_ADDR.""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_006734
3,502
permissive
[ { "docstring": "根据用户IP和代理IP,当做请求者的唯一IP Identify the machine making the request by parsing HTTP_X_FORWARDED_FOR if present and number of proxies is > 0. If not use all of HTTP_X_FORWARDED_FOR if it is available, if not use REMOTE_ADDR.", "name": "get_ident", "signature": "def get_ident(self, request)" ...
3
stack_v2_sparse_classes_30k_train_018407
Implement the Python class `TestThrottle` described below. Class description: Implement the TestThrottle class. Method signatures and docstrings: - def get_ident(self, request): 根据用户IP和代理IP,当做请求者的唯一IP Identify the machine making the request by parsing HTTP_X_FORWARDED_FOR if present and number of proxies is > 0. If n...
Implement the Python class `TestThrottle` described below. Class description: Implement the TestThrottle class. Method signatures and docstrings: - def get_ident(self, request): 根据用户IP和代理IP,当做请求者的唯一IP Identify the machine making the request by parsing HTTP_X_FORWARDED_FOR if present and number of proxies is > 0. If n...
58d7060ce255092c3ec9908dfa1810bd7a665365
<|skeleton|> class TestThrottle: def get_ident(self, request): """根据用户IP和代理IP,当做请求者的唯一IP Identify the machine making the request by parsing HTTP_X_FORWARDED_FOR if present and number of proxies is > 0. If not use all of HTTP_X_FORWARDED_FOR if it is available, if not use REMOTE_ADDR.""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestThrottle: def get_ident(self, request): """根据用户IP和代理IP,当做请求者的唯一IP Identify the machine making the request by parsing HTTP_X_FORWARDED_FOR if present and number of proxies is > 0. If not use all of HTTP_X_FORWARDED_FOR if it is available, if not use REMOTE_ADDR.""" xff = request.META.get('H...
the_stack_v2_python_sparse
day08/views.py
jiawenquan/django_restful_demo
train
0
ac37e5b443e7c473a0176322bc7df017a0c61f54
[ "attr_map = {'node_uuid': 'uuid', 'bfd_admin_down_count': 'admin_down_count', 'bfd_init_count': 'init_count', 'bfd_up_count': 'up_count', 'bfd_down_count': 'down_count'}\nclient_class_obj = listtransportnodestatus.ListTransportNodeStatus(connection_object=client_obj.connection)\nstatus_schema_object = client_class_...
<|body_start_0|> attr_map = {'node_uuid': 'uuid', 'bfd_admin_down_count': 'admin_down_count', 'bfd_init_count': 'init_count', 'bfd_up_count': 'up_count', 'bfd_down_count': 'down_count'} client_class_obj = listtransportnodestatus.ListTransportNodeStatus(connection_object=client_obj.connection) st...
NSX70AggregationImpl
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NSX70AggregationImpl: def get_aggregation_transportnode_status(cls, client_obj, **kwargs): """Get status summary of all transport nodes under MP. @type client_object: ManagerAPIClient @param client_object: Client object @rtype: dict @return: Dict having status details of all TNs. Endpoin...
stack_v2_sparse_classes_36k_train_006735
4,454
no_license
[ { "docstring": "Get status summary of all transport nodes under MP. @type client_object: ManagerAPIClient @param client_object: Client object @rtype: dict @return: Dict having status details of all TNs. Endpoint: /aggregations/transport-node-status", "name": "get_aggregation_transportnode_status", "sign...
3
stack_v2_sparse_classes_30k_train_018908
Implement the Python class `NSX70AggregationImpl` described below. Class description: Implement the NSX70AggregationImpl class. Method signatures and docstrings: - def get_aggregation_transportnode_status(cls, client_obj, **kwargs): Get status summary of all transport nodes under MP. @type client_object: ManagerAPICl...
Implement the Python class `NSX70AggregationImpl` described below. Class description: Implement the NSX70AggregationImpl class. Method signatures and docstrings: - def get_aggregation_transportnode_status(cls, client_obj, **kwargs): Get status summary of all transport nodes under MP. @type client_object: ManagerAPICl...
5b55817c050b637e2747084290f6206d2e622938
<|skeleton|> class NSX70AggregationImpl: def get_aggregation_transportnode_status(cls, client_obj, **kwargs): """Get status summary of all transport nodes under MP. @type client_object: ManagerAPIClient @param client_object: Client object @rtype: dict @return: Dict having status details of all TNs. Endpoin...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NSX70AggregationImpl: def get_aggregation_transportnode_status(cls, client_obj, **kwargs): """Get status summary of all transport nodes under MP. @type client_object: ManagerAPIClient @param client_object: Client object @rtype: dict @return: Dict having status details of all TNs. Endpoint: /aggregatio...
the_stack_v2_python_sparse
SystemTesting/pylib/vmware/nsx/manager/api/nsx70_aggregation_impl.py
Cloudxtreme/MyProject
train
0
96906b7e79f9a7476ce3c1c31d06ae5bf3c7c8df
[ "self.val = None\nself.next = None\nself.prev = None\nself.head = None\nself.tail = None", "walker = self.head\nfor i in range(index):\n if walker == None:\n break\n walker = walker.next\nif walker != None:\n return walker.val\nreturn -1", "newNode = MyLinkedList()\nnewNode.val = val\nif self.he...
<|body_start_0|> self.val = None self.next = None self.prev = None self.head = None self.tail = None <|end_body_0|> <|body_start_1|> walker = self.head for i in range(index): if walker == None: break walker = walker.next ...
MyLinkedList
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyLinkedList: def __init__(self): """Initialize your data structure here.""" <|body_0|> def get(self, index): """Get the value of the index-th node in the linked list. If the index is invalid, return -1. :type index: int :rtype: int""" <|body_1|> def add...
stack_v2_sparse_classes_36k_train_006736
6,076
permissive
[ { "docstring": "Initialize your data structure here.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Get the value of the index-th node in the linked list. If the index is invalid, return -1. :type index: int :rtype: int", "name": "get", "signature": "def get(s...
6
stack_v2_sparse_classes_30k_train_001027
Implement the Python class `MyLinkedList` described below. Class description: Implement the MyLinkedList class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def get(self, index): Get the value of the index-th node in the linked list. If the index is invalid, return -1...
Implement the Python class `MyLinkedList` described below. Class description: Implement the MyLinkedList class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def get(self, index): Get the value of the index-th node in the linked list. If the index is invalid, return -1...
d137df53fa2489821b3c17ac22f24d9a1ae86304
<|skeleton|> class MyLinkedList: def __init__(self): """Initialize your data structure here.""" <|body_0|> def get(self, index): """Get the value of the index-th node in the linked list. If the index is invalid, return -1. :type index: int :rtype: int""" <|body_1|> def add...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MyLinkedList: def __init__(self): """Initialize your data structure here.""" self.val = None self.next = None self.prev = None self.head = None self.tail = None def get(self, index): """Get the value of the index-th node in the linked list. If the i...
the_stack_v2_python_sparse
easy/design-linked-list.py
trilliwon/LeetCode
train
0
7c73a735ebdbb9b2aef63f29ac9a3cf74eb5aec8
[ "X = df[col]\ny = df[target_col]\nestimator = SVR(kernel='linear')\nselector = RFE(estimator, n_features_to_select=len(col), step=1)\nselector = selector.fit(X, y)\ndf = pd.DataFrame(selector.transform(X), columns=col)\ndf[target_col] = y\nreturn df", "X = df[col]\ny = df[target_col]\nestimator = SVR(kernel='line...
<|body_start_0|> X = df[col] y = df[target_col] estimator = SVR(kernel='linear') selector = RFE(estimator, n_features_to_select=len(col), step=1) selector = selector.fit(X, y) df = pd.DataFrame(selector.transform(X), columns=col) df[target_col] = y return ...
SelectFeatures
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SelectFeatures: def rfe(df, col, target_col): """递归特征消除的目标(RFE) 针对那些特征含有权重的预测模型,RFE通过递归的方式, 不断减少特征集的规模来选择需要的特征。""" <|body_0|> def rfecv(df, col, target_col): """带交叉验证带递归特征消除的目标(RFE)""" <|body_1|> def select_fdr(df, target_col): """FDR错误发现率-P值校正学习...
stack_v2_sparse_classes_36k_train_006737
41,790
no_license
[ { "docstring": "递归特征消除的目标(RFE) 针对那些特征含有权重的预测模型,RFE通过递归的方式, 不断减少特征集的规模来选择需要的特征。", "name": "rfe", "signature": "def rfe(df, col, target_col)" }, { "docstring": "带交叉验证带递归特征消除的目标(RFE)", "name": "rfecv", "signature": "def rfecv(df, col, target_col)" }, { "docstring": "FDR错误发现率-P值校正学习 ...
5
stack_v2_sparse_classes_30k_train_014800
Implement the Python class `SelectFeatures` described below. Class description: Implement the SelectFeatures class. Method signatures and docstrings: - def rfe(df, col, target_col): 递归特征消除的目标(RFE) 针对那些特征含有权重的预测模型,RFE通过递归的方式, 不断减少特征集的规模来选择需要的特征。 - def rfecv(df, col, target_col): 带交叉验证带递归特征消除的目标(RFE) - def select_fdr(d...
Implement the Python class `SelectFeatures` described below. Class description: Implement the SelectFeatures class. Method signatures and docstrings: - def rfe(df, col, target_col): 递归特征消除的目标(RFE) 针对那些特征含有权重的预测模型,RFE通过递归的方式, 不断减少特征集的规模来选择需要的特征。 - def rfecv(df, col, target_col): 带交叉验证带递归特征消除的目标(RFE) - def select_fdr(d...
12f7ac9c7d9ba0f32a5feb35777760e929af900a
<|skeleton|> class SelectFeatures: def rfe(df, col, target_col): """递归特征消除的目标(RFE) 针对那些特征含有权重的预测模型,RFE通过递归的方式, 不断减少特征集的规模来选择需要的特征。""" <|body_0|> def rfecv(df, col, target_col): """带交叉验证带递归特征消除的目标(RFE)""" <|body_1|> def select_fdr(df, target_col): """FDR错误发现率-P值校正学习...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SelectFeatures: def rfe(df, col, target_col): """递归特征消除的目标(RFE) 针对那些特征含有权重的预测模型,RFE通过递归的方式, 不断减少特征集的规模来选择需要的特征。""" X = df[col] y = df[target_col] estimator = SVR(kernel='linear') selector = RFE(estimator, n_features_to_select=len(col), step=1) selector = selecto...
the_stack_v2_python_sparse
Tools/FeatureEngineering/FeatureEnginering.py
nexusme/data_process_tools
train
2
3cb877ac1c346cf7ad85b1103d2c75f7af15cbb1
[ "updateConstant('general__discountsEnabled', True)\ntest_combo, test_component = self.create_discount(active=False)\ns = self.create_series(pricingTier=self.defaultPricing)\nresponse = self.register_to_check_discount(s, s.getBasePrice())\ninvoice = response.context_data.get('invoice')\nself.assertEqual(response.red...
<|body_start_0|> updateConstant('general__discountsEnabled', True) test_combo, test_component = self.create_discount(active=False) s = self.create_series(pricingTier=self.defaultPricing) response = self.register_to_check_discount(s, s.getBasePrice()) invoice = response.context_da...
DiscountsConditionsTest
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DiscountsConditionsTest: def test_inactive_discount(self): """Make a discount inactive and make sure that it doesn't work""" <|body_0|> def test_expired_discount(self): """Create an expired discount and make sure that it doesn't work.""" <|body_1|> def t...
stack_v2_sparse_classes_36k_train_006738
20,249
permissive
[ { "docstring": "Make a discount inactive and make sure that it doesn't work", "name": "test_inactive_discount", "signature": "def test_inactive_discount(self)" }, { "docstring": "Create an expired discount and make sure that it doesn't work.", "name": "test_expired_discount", "signature"...
5
null
Implement the Python class `DiscountsConditionsTest` described below. Class description: Implement the DiscountsConditionsTest class. Method signatures and docstrings: - def test_inactive_discount(self): Make a discount inactive and make sure that it doesn't work - def test_expired_discount(self): Create an expired d...
Implement the Python class `DiscountsConditionsTest` described below. Class description: Implement the DiscountsConditionsTest class. Method signatures and docstrings: - def test_inactive_discount(self): Make a discount inactive and make sure that it doesn't work - def test_expired_discount(self): Create an expired d...
19db3e83e76ea2002ee841989410d12d1e601023
<|skeleton|> class DiscountsConditionsTest: def test_inactive_discount(self): """Make a discount inactive and make sure that it doesn't work""" <|body_0|> def test_expired_discount(self): """Create an expired discount and make sure that it doesn't work.""" <|body_1|> def t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DiscountsConditionsTest: def test_inactive_discount(self): """Make a discount inactive and make sure that it doesn't work""" updateConstant('general__discountsEnabled', True) test_combo, test_component = self.create_discount(active=False) s = self.create_series(pricingTier=self...
the_stack_v2_python_sparse
danceschool/discounts/tests.py
django-danceschool/django-danceschool
train
40
b84e3cb91074d6b171e31e95bd1f8dbf7cc7d14a
[ "low, high = (0, len(nums) - 1)\nwhile low <= high:\n mid = low + (high - low) // 2\n if nums[mid] == target:\n return mid\n elif nums[mid] > target:\n high = mid - 1\n else:\n low = mid + 1\nreturn len(nums)", "low, high = (0, len(nums) - 1)\nwhile low <= high:\n mid = low + (...
<|body_start_0|> low, high = (0, len(nums) - 1) while low <= high: mid = low + (high - low) // 2 if nums[mid] == target: return mid elif nums[mid] > target: high = mid - 1 else: low = mid + 1 return l...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def binary_search(self, nums, target): """:param nums: :param target: :return:返回数组中target的下标,如果不存在target ,则返回数组长度""" <|body_0|> def upper_bound(self, nums, target): """:param nums: 升序的数组 :param target: :return: 数组nums中比target大的第一个数字的下标,如果不存在,则返回数组长度""" ...
stack_v2_sparse_classes_36k_train_006739
2,827
no_license
[ { "docstring": ":param nums: :param target: :return:返回数组中target的下标,如果不存在target ,则返回数组长度", "name": "binary_search", "signature": "def binary_search(self, nums, target)" }, { "docstring": ":param nums: 升序的数组 :param target: :return: 数组nums中比target大的第一个数字的下标,如果不存在,则返回数组长度", "name": "upper_bound"...
5
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def binary_search(self, nums, target): :param nums: :param target: :return:返回数组中target的下标,如果不存在target ,则返回数组长度 - def upper_bound(self, nums, target): :param nums: 升序的数组 :param ta...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def binary_search(self, nums, target): :param nums: :param target: :return:返回数组中target的下标,如果不存在target ,则返回数组长度 - def upper_bound(self, nums, target): :param nums: 升序的数组 :param ta...
0e093db4990f56d883f124e4c5a4b7317825049b
<|skeleton|> class Solution: def binary_search(self, nums, target): """:param nums: :param target: :return:返回数组中target的下标,如果不存在target ,则返回数组长度""" <|body_0|> def upper_bound(self, nums, target): """:param nums: 升序的数组 :param target: :return: 数组nums中比target大的第一个数字的下标,如果不存在,则返回数组长度""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def binary_search(self, nums, target): """:param nums: :param target: :return:返回数组中target的下标,如果不存在target ,则返回数组长度""" low, high = (0, len(nums) - 1) while low <= high: mid = low + (high - low) // 2 if nums[mid] == target: return mid ...
the_stack_v2_python_sparse
1分钟写算法/upper_bound.py
pororodl/LeetCode
train
0
dddad10ba1560958f88eaa0f63d30767297d9cf9
[ "s = sessionmanage(self.driver)\ns.open_sessionmanage()\nself.assertEqual(s.verify(), True)\ns.modify_obj()\nself.assertEqual(s.sub_tagname(), '会话管理-修改')\ns.name_clear()\ns.session_modify(Data.roomname, 'Update')\ns.modify_save()\nself.assertEqual(s.success(), True)\nfunction.screenshot(self.driver, 'session_modify...
<|body_start_0|> s = sessionmanage(self.driver) s.open_sessionmanage() self.assertEqual(s.verify(), True) s.modify_obj() self.assertEqual(s.sub_tagname(), '会话管理-修改') s.name_clear() s.session_modify(Data.roomname, 'Update') s.modify_save() self.asse...
Test047_Sission_Modify_P1
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test047_Sission_Modify_P1: def test_session_modify_name(self): """修改会话名称""" <|body_0|> def test_session_modify_keyword(self): """修改关键词""" <|body_1|> def test_back(self): """修改并返回""" <|body_2|> <|end_skeleton|> <|body_start_0|> s...
stack_v2_sparse_classes_36k_train_006740
1,685
no_license
[ { "docstring": "修改会话名称", "name": "test_session_modify_name", "signature": "def test_session_modify_name(self)" }, { "docstring": "修改关键词", "name": "test_session_modify_keyword", "signature": "def test_session_modify_keyword(self)" }, { "docstring": "修改并返回", "name": "test_back"...
3
null
Implement the Python class `Test047_Sission_Modify_P1` described below. Class description: Implement the Test047_Sission_Modify_P1 class. Method signatures and docstrings: - def test_session_modify_name(self): 修改会话名称 - def test_session_modify_keyword(self): 修改关键词 - def test_back(self): 修改并返回
Implement the Python class `Test047_Sission_Modify_P1` described below. Class description: Implement the Test047_Sission_Modify_P1 class. Method signatures and docstrings: - def test_session_modify_name(self): 修改会话名称 - def test_session_modify_keyword(self): 修改关键词 - def test_back(self): 修改并返回 <|skeleton|> class Test0...
6f42c25249fc642cecc270578a180820988d45b5
<|skeleton|> class Test047_Sission_Modify_P1: def test_session_modify_name(self): """修改会话名称""" <|body_0|> def test_session_modify_keyword(self): """修改关键词""" <|body_1|> def test_back(self): """修改并返回""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Test047_Sission_Modify_P1: def test_session_modify_name(self): """修改会话名称""" s = sessionmanage(self.driver) s.open_sessionmanage() self.assertEqual(s.verify(), True) s.modify_obj() self.assertEqual(s.sub_tagname(), '会话管理-修改') s.name_clear() s.sess...
the_stack_v2_python_sparse
GlxssLive_web/TestCase/Manage_Session/Test047_session_modify_P1.py
rrmiracle/GlxssLive
train
0
df5d2e0541397e5c8c6863ced056aa9a5711873f
[ "query = self.session.query(VOpenposition.timecreate, VOpenposition.timeupdate, VOpenposition.position, VOpenposition.login, VOpenposition.symbol, VOpenposition.action, VOpenposition.volume, VOpenposition.priceopen, VOpenposition.pricesl, VOpenposition.pricetp, VOpenposition.pricecurrent, VOpenposition.storage, VOp...
<|body_start_0|> query = self.session.query(VOpenposition.timecreate, VOpenposition.timeupdate, VOpenposition.position, VOpenposition.login, VOpenposition.symbol, VOpenposition.action, VOpenposition.volume, VOpenposition.priceopen, VOpenposition.pricesl, VOpenposition.pricetp, VOpenposition.pricecurrent, VOpenp...
v_openposition视图操作
VOpenpositionDao
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VOpenpositionDao: """v_openposition视图操作""" def search_by_uid(self, uid, start, end, mtlogin, page=None): """已知用户id,根据时间段,查询飘单记录 :param uid: 用户id :param start: 开始时间 :param end: 结束时间 :return: 各项总和""" <|body_0|> def searchsum_by_uid(self, uid, start, end, mtlogin): ...
stack_v2_sparse_classes_36k_train_006741
26,694
permissive
[ { "docstring": "已知用户id,根据时间段,查询飘单记录 :param uid: 用户id :param start: 开始时间 :param end: 结束时间 :return: 各项总和", "name": "search_by_uid", "signature": "def search_by_uid(self, uid, start, end, mtlogin, page=None)" }, { "docstring": "已知用户id,根据时间段,查询总和 :param uid: 用户id :param start: 开始时间 :param end: 结束时间 ...
2
stack_v2_sparse_classes_30k_train_007449
Implement the Python class `VOpenpositionDao` described below. Class description: v_openposition视图操作 Method signatures and docstrings: - def search_by_uid(self, uid, start, end, mtlogin, page=None): 已知用户id,根据时间段,查询飘单记录 :param uid: 用户id :param start: 开始时间 :param end: 结束时间 :return: 各项总和 - def searchsum_by_uid(self, uid...
Implement the Python class `VOpenpositionDao` described below. Class description: v_openposition视图操作 Method signatures and docstrings: - def search_by_uid(self, uid, start, end, mtlogin, page=None): 已知用户id,根据时间段,查询飘单记录 :param uid: 用户id :param start: 开始时间 :param end: 结束时间 :return: 各项总和 - def searchsum_by_uid(self, uid...
1fadeecf31f1d25e258dc5d70c47a785f7b33961
<|skeleton|> class VOpenpositionDao: """v_openposition视图操作""" def search_by_uid(self, uid, start, end, mtlogin, page=None): """已知用户id,根据时间段,查询飘单记录 :param uid: 用户id :param start: 开始时间 :param end: 结束时间 :return: 各项总和""" <|body_0|> def searchsum_by_uid(self, uid, start, end, mtlogin): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VOpenpositionDao: """v_openposition视图操作""" def search_by_uid(self, uid, start, end, mtlogin, page=None): """已知用户id,根据时间段,查询飘单记录 :param uid: 用户id :param start: 开始时间 :param end: 结束时间 :return: 各项总和""" query = self.session.query(VOpenposition.timecreate, VOpenposition.timeupdate, VOpenpositio...
the_stack_v2_python_sparse
xwcrm/model/views.py
MSUNorg/XWCRM
train
0
d3d39ef733a4b03992e0b1fed1edd813ab3e305e
[ "self.cast: Type[T] = cast\nself.delimiter = delimiter\nself.strip = strip\nself.post_process = post_process", "if isinstance(value, (tuple, list)):\n value = ''.join((str(v) + self.delimiter for v in value))[:-1]\n\ndef transform(s):\n return self.cast(s.strip(self.strip))\nsplitter = shlex(value, posix=Tr...
<|body_start_0|> self.cast: Type[T] = cast self.delimiter = delimiter self.strip = strip self.post_process = post_process <|end_body_0|> <|body_start_1|> if isinstance(value, (tuple, list)): value = ''.join((str(v) + self.delimiter for v in value))[:-1] def ...
Produces a csv parser that return a list of transformed elements. From python-decouple.
Csv
[ "MIT", "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Csv: """Produces a csv parser that return a list of transformed elements. From python-decouple.""" def __init__(self, cast: Type[T]=str, delimiter=',', strip=string.whitespace, post_process=list): """Parameters: cast -- callable that transforms the item just before it's added to the ...
stack_v2_sparse_classes_36k_train_006742
7,619
permissive
[ { "docstring": "Parameters: cast -- callable that transforms the item just before it's added to the list. delimiter -- string of delimiters chars passed to shlex. strip -- string of non-relevant characters to be passed to str.strip after the split. post_process -- callable to post process all casted values. Def...
2
stack_v2_sparse_classes_30k_test_000528
Implement the Python class `Csv` described below. Class description: Produces a csv parser that return a list of transformed elements. From python-decouple. Method signatures and docstrings: - def __init__(self, cast: Type[T]=str, delimiter=',', strip=string.whitespace, post_process=list): Parameters: cast -- callabl...
Implement the Python class `Csv` described below. Class description: Produces a csv parser that return a list of transformed elements. From python-decouple. Method signatures and docstrings: - def __init__(self, cast: Type[T]=str, delimiter=',', strip=string.whitespace, post_process=list): Parameters: cast -- callabl...
ab7ac9ceeaf4ea06dfbbd1280be4430d4ac6d684
<|skeleton|> class Csv: """Produces a csv parser that return a list of transformed elements. From python-decouple.""" def __init__(self, cast: Type[T]=str, delimiter=',', strip=string.whitespace, post_process=list): """Parameters: cast -- callable that transforms the item just before it's added to the ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Csv: """Produces a csv parser that return a list of transformed elements. From python-decouple.""" def __init__(self, cast: Type[T]=str, delimiter=',', strip=string.whitespace, post_process=list): """Parameters: cast -- callable that transforms the item just before it's added to the list. delimit...
the_stack_v2_python_sparse
DeepFilterNet/df/config.py
oucxlw/DeepFilterNet
train
1
72f8ba893736985521e157cf42d768137923168e
[ "super(DFTXC, self).__init__()\nself.xcstr = xcstr\nself.nnmodel = nnmodel", "hybridxc = HybridXC(self.xcstr, self.nnmodel, aweight0=0.0)\noutput = []\nfor entry in inputs:\n evl = XCNNSCF(hybridxc, entry)\n qcs = []\n for system in entry.get_systems():\n qcs.append(evl.run(system))\n if entry....
<|body_start_0|> super(DFTXC, self).__init__() self.xcstr = xcstr self.nnmodel = nnmodel <|end_body_0|> <|body_start_1|> hybridxc = HybridXC(self.xcstr, self.nnmodel, aweight0=0.0) output = [] for entry in inputs: evl = XCNNSCF(hybridxc, entry) qc...
This layer initializes the neural network exchange correlation functional and the hybrid functional. It is then used to run the Kohn Sham iterations. Examples -------- >>> import torch >>> from deepchem.feat.dft_data import DFTEntry >>> from deepchem.models.dft.dftxc import DFTXC >>> e_type = 'ie' >>> true_val= '0.5341...
DFTXC
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DFTXC: """This layer initializes the neural network exchange correlation functional and the hybrid functional. It is then used to run the Kohn Sham iterations. Examples -------- >>> import torch >>> from deepchem.feat.dft_data import DFTEntry >>> from deepchem.models.dft.dftxc import DFTXC >>> e_...
stack_v2_sparse_classes_36k_train_006743
9,553
permissive
[ { "docstring": "Parameters ---------- xcstr: str The choice of xc to use. Some of the commonly used ones are: lda_x, lda_c_pw, lda_c_ow, lda_c_pz, lda_xc_lp_a, lda_xc_lp_b. nnmodel: torch.nn.Module the PyTorch model implementing the calculation Notes ----- It is not necessary to use the default method(_construc...
2
null
Implement the Python class `DFTXC` described below. Class description: This layer initializes the neural network exchange correlation functional and the hybrid functional. It is then used to run the Kohn Sham iterations. Examples -------- >>> import torch >>> from deepchem.feat.dft_data import DFTEntry >>> from deepch...
Implement the Python class `DFTXC` described below. Class description: This layer initializes the neural network exchange correlation functional and the hybrid functional. It is then used to run the Kohn Sham iterations. Examples -------- >>> import torch >>> from deepchem.feat.dft_data import DFTEntry >>> from deepch...
ee6e67ebcf7bf04259cf13aff6388e2b791fea3d
<|skeleton|> class DFTXC: """This layer initializes the neural network exchange correlation functional and the hybrid functional. It is then used to run the Kohn Sham iterations. Examples -------- >>> import torch >>> from deepchem.feat.dft_data import DFTEntry >>> from deepchem.models.dft.dftxc import DFTXC >>> e_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DFTXC: """This layer initializes the neural network exchange correlation functional and the hybrid functional. It is then used to run the Kohn Sham iterations. Examples -------- >>> import torch >>> from deepchem.feat.dft_data import DFTEntry >>> from deepchem.models.dft.dftxc import DFTXC >>> e_type = 'ie' >...
the_stack_v2_python_sparse
deepchem/models/dft/dftxc.py
deepchem/deepchem
train
4,876
977363adde53c3c5f9d31f7ae2b9b18a3360c2a3
[ "super().__init__(self.PROBLEM_NAME)\nself.number_vertices = number_vertices\nself.input_graph = input_graph", "print('Solving {} problem ...'.format(self.PROBLEM_NAME))\nvisited_list = [False] * self.number_vertices\nsort_list = []\nfor vertex in range(self.number_vertices):\n if not visited_list[vertex]:\n ...
<|body_start_0|> super().__init__(self.PROBLEM_NAME) self.number_vertices = number_vertices self.input_graph = input_graph <|end_body_0|> <|body_start_1|> print('Solving {} problem ...'.format(self.PROBLEM_NAME)) visited_list = [False] * self.number_vertices sort_list = ...
TopologicalSortingDAG
TopologicalSortingDAG
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TopologicalSortingDAG: """TopologicalSortingDAG""" def __init__(self, number_vertices, input_graph): """Topological Sorting of DAG Args: number_vertices: Number of vertices in the graph input_graph: Graph for which to find the minimum spanning tree Returns: None Raises: None""" ...
stack_v2_sparse_classes_36k_train_006744
2,682
no_license
[ { "docstring": "Topological Sorting of DAG Args: number_vertices: Number of vertices in the graph input_graph: Graph for which to find the minimum spanning tree Returns: None Raises: None", "name": "__init__", "signature": "def __init__(self, number_vertices, input_graph)" }, { "docstring": "Sol...
3
null
Implement the Python class `TopologicalSortingDAG` described below. Class description: TopologicalSortingDAG Method signatures and docstrings: - def __init__(self, number_vertices, input_graph): Topological Sorting of DAG Args: number_vertices: Number of vertices in the graph input_graph: Graph for which to find the ...
Implement the Python class `TopologicalSortingDAG` described below. Class description: TopologicalSortingDAG Method signatures and docstrings: - def __init__(self, number_vertices, input_graph): Topological Sorting of DAG Args: number_vertices: Number of vertices in the graph input_graph: Graph for which to find the ...
11f4d25cb211740514c119a60962d075a0817abd
<|skeleton|> class TopologicalSortingDAG: """TopologicalSortingDAG""" def __init__(self, number_vertices, input_graph): """Topological Sorting of DAG Args: number_vertices: Number of vertices in the graph input_graph: Graph for which to find the minimum spanning tree Returns: None Raises: None""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TopologicalSortingDAG: """TopologicalSortingDAG""" def __init__(self, number_vertices, input_graph): """Topological Sorting of DAG Args: number_vertices: Number of vertices in the graph input_graph: Graph for which to find the minimum spanning tree Returns: None Raises: None""" super().__...
the_stack_v2_python_sparse
python/problems/graphs/topological_sorting_dag.py
santhosh-kumar/AlgorithmsAndDataStructures
train
2
0c1c3a2b7e96d421262dda670c35ec747d20f73a
[ "ctx.save_for_backward(dim, kappa)\nkappa_copy = kappa.clone()\nm = sp.ive(dim, kappa_copy)\nx = torch.tensor(m).to(device)\nreturn x.clone()", "dim, kappa = ctx.saved_tensors\ngrad_input = grad_output.clone()\ngrad = grad_input * (bessel_ive(dim - 1, kappa) - bessel_ive(dim, kappa) * (dim + kappa) / kappa)\nretu...
<|body_start_0|> ctx.save_for_backward(dim, kappa) kappa_copy = kappa.clone() m = sp.ive(dim, kappa_copy) x = torch.tensor(m).to(device) return x.clone() <|end_body_0|> <|body_start_1|> dim, kappa = ctx.saved_tensors grad_input = grad_output.clone() grad ...
We can implement our own custom autograd Functions by subclassing torch.autograd.Function and implementing the forward and backward passes which operate on Tensors.
BesselIve
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BesselIve: """We can implement our own custom autograd Functions by subclassing torch.autograd.Function and implementing the forward and backward passes which operate on Tensors.""" def forward(ctx, dim, kappa): """In the forward pass we receive a Tensor containing the input and retu...
stack_v2_sparse_classes_36k_train_006745
10,798
permissive
[ { "docstring": "In the forward pass we receive a Tensor containing the input and return a Tensor containing the output. ctx is a context object that can be used to stash information for backward computation. You can cache arbitrary objects for use in the backward pass using the ctx.save_for_backward method.", ...
2
stack_v2_sparse_classes_30k_test_000985
Implement the Python class `BesselIve` described below. Class description: We can implement our own custom autograd Functions by subclassing torch.autograd.Function and implementing the forward and backward passes which operate on Tensors. Method signatures and docstrings: - def forward(ctx, dim, kappa): In the forwa...
Implement the Python class `BesselIve` described below. Class description: We can implement our own custom autograd Functions by subclassing torch.autograd.Function and implementing the forward and backward passes which operate on Tensors. Method signatures and docstrings: - def forward(ctx, dim, kappa): In the forwa...
95a39fa9f7a0659e432475e8dfb9a46e305d53b7
<|skeleton|> class BesselIve: """We can implement our own custom autograd Functions by subclassing torch.autograd.Function and implementing the forward and backward passes which operate on Tensors.""" def forward(ctx, dim, kappa): """In the forward pass we receive a Tensor containing the input and retu...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BesselIve: """We can implement our own custom autograd Functions by subclassing torch.autograd.Function and implementing the forward and backward passes which operate on Tensors.""" def forward(ctx, dim, kappa): """In the forward pass we receive a Tensor containing the input and return a Tensor c...
the_stack_v2_python_sparse
NVLL/distribution/vmf_hypvae.py
jennhu/vmf_vae_nlp
train
0
2b240565e8d891fd45f3853f3c87af73248f7457
[ "self.factory = RequestFactory()\nself.temp_dir = tempfile.mkdtemp()\nsuper(ViewTestCase, self).setUp()", "setattr(request, 'session', 'session')\nmessages = FallbackStorage(request)\nsetattr(request, '_messages', messages)", "\"\"\"Annotate a request object with a session\"\"\"\nmiddleware = SessionMiddleware(...
<|body_start_0|> self.factory = RequestFactory() self.temp_dir = tempfile.mkdtemp() super(ViewTestCase, self).setUp() <|end_body_0|> <|body_start_1|> setattr(request, 'session', 'session') messages = FallbackStorage(request) setattr(request, '_messages', messages) <|end_...
Test basic view functionality.
ViewTestCase
[ "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ViewTestCase: """Test basic view functionality.""" def setUp(self): """Create request factory and set temp_dir for testing.""" <|body_0|> def set_request_message_attributes(request): """Set session and _messages attributies on request.""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_006746
40,377
permissive
[ { "docstring": "Create request factory and set temp_dir for testing.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Set session and _messages attributies on request.", "name": "set_request_message_attributes", "signature": "def set_request_message_attributes(request...
3
null
Implement the Python class `ViewTestCase` described below. Class description: Test basic view functionality. Method signatures and docstrings: - def setUp(self): Create request factory and set temp_dir for testing. - def set_request_message_attributes(request): Set session and _messages attributies on request. - def ...
Implement the Python class `ViewTestCase` described below. Class description: Test basic view functionality. Method signatures and docstrings: - def setUp(self): Create request factory and set temp_dir for testing. - def set_request_message_attributes(request): Set session and _messages attributies on request. - def ...
69855813052243c702c9b0108d2eac3f4f1a768f
<|skeleton|> class ViewTestCase: """Test basic view functionality.""" def setUp(self): """Create request factory and set temp_dir for testing.""" <|body_0|> def set_request_message_attributes(request): """Set session and _messages attributies on request.""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ViewTestCase: """Test basic view functionality.""" def setUp(self): """Create request factory and set temp_dir for testing.""" self.factory = RequestFactory() self.temp_dir = tempfile.mkdtemp() super(ViewTestCase, self).setUp() def set_request_message_attributes(reque...
the_stack_v2_python_sparse
hs_core/testing.py
hydroshare/hydroshare
train
207
99f6281c1a3a20480785de966d0f780fea322734
[ "nums.sort()\nmin_dist, max_dist = (nums[-1] - nums[0], nums[-1] - nums[0])\nfor i in xrange(1, len(nums)):\n min_dist = min(min_dist, nums[i] - nums[i - 1])\nleft, right = (min_dist, max_dist)\nwhile left < right:\n mid = left + (right - left >> 1)\n if self.countPairs(nums, mid) < k:\n left = mid ...
<|body_start_0|> nums.sort() min_dist, max_dist = (nums[-1] - nums[0], nums[-1] - nums[0]) for i in xrange(1, len(nums)): min_dist = min(min_dist, nums[i] - nums[i - 1]) left, right = (min_dist, max_dist) while left < right: mid = left + (right - left >> 1...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def smallestDistancePair(self, nums, k): """:type nums: List[int] :type k: int :rtype: int""" <|body_0|> def countPairs(self, nums, dist): """number of pairs whose distance is no more than dist""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_006747
1,663
no_license
[ { "docstring": ":type nums: List[int] :type k: int :rtype: int", "name": "smallestDistancePair", "signature": "def smallestDistancePair(self, nums, k)" }, { "docstring": "number of pairs whose distance is no more than dist", "name": "countPairs", "signature": "def countPairs(self, nums, ...
2
stack_v2_sparse_classes_30k_train_021370
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def smallestDistancePair(self, nums, k): :type nums: List[int] :type k: int :rtype: int - def countPairs(self, nums, dist): number of pairs whose distance is no more than dist
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def smallestDistancePair(self, nums, k): :type nums: List[int] :type k: int :rtype: int - def countPairs(self, nums, dist): number of pairs whose distance is no more than dist <...
ee79d3437cf47b26a4bca0ec798dc54d7b623453
<|skeleton|> class Solution: def smallestDistancePair(self, nums, k): """:type nums: List[int] :type k: int :rtype: int""" <|body_0|> def countPairs(self, nums, dist): """number of pairs whose distance is no more than dist""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def smallestDistancePair(self, nums, k): """:type nums: List[int] :type k: int :rtype: int""" nums.sort() min_dist, max_dist = (nums[-1] - nums[0], nums[-1] - nums[0]) for i in xrange(1, len(nums)): min_dist = min(min_dist, nums[i] - nums[i - 1]) l...
the_stack_v2_python_sparse
Algorithm/Python/719. Find K-th Smallest Pair Distance.py
WuLC/LeetCode
train
29
97a67f51b8049bd5793ae85fd916ac49c770a3ae
[ "super(PGCRAirMarkets, self).__init__()\nself.location = FileUtilities.PathToForwardSlash(os.path.dirname(os.path.abspath(__file__)))\nself.awsParams = ''", "jobParams = dict(self.job)\njobParams['s3Filename'] = 's3://' + self.job['bucketName'] + '/' + self.job['s3SrcDirectory'] + '/' + srcFileParameter['s3Filena...
<|body_start_0|> super(PGCRAirMarkets, self).__init__() self.location = FileUtilities.PathToForwardSlash(os.path.dirname(os.path.abspath(__file__))) self.awsParams = '' <|end_body_0|> <|body_start_1|> jobParams = dict(self.job) jobParams['s3Filename'] = 's3://' + self.job['bucke...
Code to process the PGCR Air Markets data
PGCRAirMarkets
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PGCRAirMarkets: """Code to process the PGCR Air Markets data""" def __init__(self): """Initial settings""" <|body_0|> def ProcessS3File(self, srcFileParameter): """For each file we need to process, provide the data loader the s3 key and destination table name""" ...
stack_v2_sparse_classes_36k_train_006748
2,489
no_license
[ { "docstring": "Initial settings", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "For each file we need to process, provide the data loader the s3 key and destination table name", "name": "ProcessS3File", "signature": "def ProcessS3File(self, srcFileParameter)" ...
3
stack_v2_sparse_classes_30k_train_014065
Implement the Python class `PGCRAirMarkets` described below. Class description: Code to process the PGCR Air Markets data Method signatures and docstrings: - def __init__(self): Initial settings - def ProcessS3File(self, srcFileParameter): For each file we need to process, provide the data loader the s3 key and desti...
Implement the Python class `PGCRAirMarkets` described below. Class description: Code to process the PGCR Air Markets data Method signatures and docstrings: - def __init__(self): Initial settings - def ProcessS3File(self, srcFileParameter): For each file we need to process, provide the data loader the s3 key and desti...
9ff48f61cfd4e0c5994ad3dabab3987255cea953
<|skeleton|> class PGCRAirMarkets: """Code to process the PGCR Air Markets data""" def __init__(self): """Initial settings""" <|body_0|> def ProcessS3File(self, srcFileParameter): """For each file we need to process, provide the data loader the s3 key and destination table name""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PGCRAirMarkets: """Code to process the PGCR Air Markets data""" def __init__(self): """Initial settings""" super(PGCRAirMarkets, self).__init__() self.location = FileUtilities.PathToForwardSlash(os.path.dirname(os.path.abspath(__file__))) self.awsParams = '' def Proce...
the_stack_v2_python_sparse
EAA_Dataloader/src/Applications/PGCRAirMarketsIteration2/PGCRAirMarkets.py
eulertech/backup
train
0
1ec29dface10807c10c46bc6d740497d0eef06aa
[ "airbyte_level = self.level_mapping.get(record.levelno, 'INFO')\nif airbyte_level == 'DEBUG':\n extras = self.extract_extra_args_from_record(record)\n debug_dict = {'type': 'DEBUG', 'message': record.getMessage(), 'data': extras}\n return filter_secrets(json.dumps(debug_dict))\nelse:\n message = super()...
<|body_start_0|> airbyte_level = self.level_mapping.get(record.levelno, 'INFO') if airbyte_level == 'DEBUG': extras = self.extract_extra_args_from_record(record) debug_dict = {'type': 'DEBUG', 'message': record.getMessage(), 'data': extras} return filter_secrets(json....
Output log records using AirbyteMessage
AirbyteLogFormatter
[ "MIT", "Elastic-2.0", "Apache-2.0", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AirbyteLogFormatter: """Output log records using AirbyteMessage""" def format(self, record: logging.LogRecord) -> str: """Return a JSON representation of the log message""" <|body_0|> def extract_extra_args_from_record(record: logging.LogRecord): """The python lo...
stack_v2_sparse_classes_36k_train_006749
3,985
permissive
[ { "docstring": "Return a JSON representation of the log message", "name": "format", "signature": "def format(self, record: logging.LogRecord) -> str" }, { "docstring": "The python logger conflates default args with extra args. We use an empty log record and set operations to isolate fields passe...
2
null
Implement the Python class `AirbyteLogFormatter` described below. Class description: Output log records using AirbyteMessage Method signatures and docstrings: - def format(self, record: logging.LogRecord) -> str: Return a JSON representation of the log message - def extract_extra_args_from_record(record: logging.LogR...
Implement the Python class `AirbyteLogFormatter` described below. Class description: Output log records using AirbyteMessage Method signatures and docstrings: - def format(self, record: logging.LogRecord) -> str: Return a JSON representation of the log message - def extract_extra_args_from_record(record: logging.LogR...
8d5f9a2d49ab8f9e85ccf058cb02c2fda287afc6
<|skeleton|> class AirbyteLogFormatter: """Output log records using AirbyteMessage""" def format(self, record: logging.LogRecord) -> str: """Return a JSON representation of the log message""" <|body_0|> def extract_extra_args_from_record(record: logging.LogRecord): """The python lo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AirbyteLogFormatter: """Output log records using AirbyteMessage""" def format(self, record: logging.LogRecord) -> str: """Return a JSON representation of the log message""" airbyte_level = self.level_mapping.get(record.levelno, 'INFO') if airbyte_level == 'DEBUG': extr...
the_stack_v2_python_sparse
dts/airbyte/airbyte-cdk/python/airbyte_cdk/logger.py
alldatacenter/alldata
train
774
9981baaff44d2c5a4e994bc9866d61eb52f65c6d
[ "ret = 0\nsums = defaultdict(int)\nsums[0] += 1\nacc = 0\nfor n in nums:\n acc += n\n for s in sums:\n if (acc - s) % k == 0:\n ret += sums[s]\n sums[acc] += 1\nreturn ret", "ret = 0\ncnt = [0] * k\ncnt[0] = 1\nacc = 0\nfor n in nums:\n acc += n\n ret += cnt[acc % k]\n cnt[acc ...
<|body_start_0|> ret = 0 sums = defaultdict(int) sums[0] += 1 acc = 0 for n in nums: acc += n for s in sums: if (acc - s) % k == 0: ret += sums[s] sums[acc] += 1 return ret <|end_body_0|> <|body_star...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def subarraysDivByK(self, nums: List[int], k: int) -> int: """Mar 05, 2023 22:16 TLE""" <|body_0|> def subarraysDivByK(self, nums: List[int], k: int) -> int: """Mar 05, 2023 22:20""" <|body_1|> <|end_skeleton|> <|body_start_0|> ret = 0 ...
stack_v2_sparse_classes_36k_train_006750
1,821
no_license
[ { "docstring": "Mar 05, 2023 22:16 TLE", "name": "subarraysDivByK", "signature": "def subarraysDivByK(self, nums: List[int], k: int) -> int" }, { "docstring": "Mar 05, 2023 22:20", "name": "subarraysDivByK", "signature": "def subarraysDivByK(self, nums: List[int], k: int) -> int" } ]
2
stack_v2_sparse_classes_30k_train_010213
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def subarraysDivByK(self, nums: List[int], k: int) -> int: Mar 05, 2023 22:16 TLE - def subarraysDivByK(self, nums: List[int], k: int) -> int: Mar 05, 2023 22:20
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def subarraysDivByK(self, nums: List[int], k: int) -> int: Mar 05, 2023 22:16 TLE - def subarraysDivByK(self, nums: List[int], k: int) -> int: Mar 05, 2023 22:20 <|skeleton|> cl...
1389a009a02e90e8700a7a00e0b7f797c129cdf4
<|skeleton|> class Solution: def subarraysDivByK(self, nums: List[int], k: int) -> int: """Mar 05, 2023 22:16 TLE""" <|body_0|> def subarraysDivByK(self, nums: List[int], k: int) -> int: """Mar 05, 2023 22:20""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def subarraysDivByK(self, nums: List[int], k: int) -> int: """Mar 05, 2023 22:16 TLE""" ret = 0 sums = defaultdict(int) sums[0] += 1 acc = 0 for n in nums: acc += n for s in sums: if (acc - s) % k == 0: ...
the_stack_v2_python_sparse
leetcode/solved/1016_Subarray_Sums_Divisible_by_K/solution.py
sungminoh/algorithms
train
0
fb42951a51294cfff88ca441eb07fc9529dc8ddd
[ "self.msg_id = msg_id\nif failure_info is not None:\n ex_class = failure_info[0]\n ex = failure_info[1]\n tb = traceback.format_exception(*failure_info)\n if issubclass(ex_class, RemoteExceptionMixin):\n failure_data = {'c': ex.clazz, 'm': ex.module, 's': ex.message, 't': tb}\n else:\n ...
<|body_start_0|> self.msg_id = msg_id if failure_info is not None: ex_class = failure_info[0] ex = failure_info[1] tb = traceback.format_exception(*failure_info) if issubclass(ex_class, RemoteExceptionMixin): failure_data = {'c': ex.clazz, ...
PikaOutgoingMessage implementation for RPC reply messages. It sets correlation_id AMQP property to link this reply with response
RpcReplyPikaOutgoingMessage
[ "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RpcReplyPikaOutgoingMessage: """PikaOutgoingMessage implementation for RPC reply messages. It sets correlation_id AMQP property to link this reply with response""" def __init__(self, pika_engine, msg_id, reply=None, failure_info=None, content_type=None): """Initialize with reply info...
stack_v2_sparse_classes_36k_train_006751
24,684
permissive
[ { "docstring": "Initialize with reply information for sending :param pika_engine: PikaEngine, shared object with configuration and shared driver functionality :param msg_id: String, msg_id of RPC request, which waits for reply :param reply: Dictionary, reply. In case of exception should be None :param failure_i...
2
stack_v2_sparse_classes_30k_train_013581
Implement the Python class `RpcReplyPikaOutgoingMessage` described below. Class description: PikaOutgoingMessage implementation for RPC reply messages. It sets correlation_id AMQP property to link this reply with response Method signatures and docstrings: - def __init__(self, pika_engine, msg_id, reply=None, failure_...
Implement the Python class `RpcReplyPikaOutgoingMessage` described below. Class description: PikaOutgoingMessage implementation for RPC reply messages. It sets correlation_id AMQP property to link this reply with response Method signatures and docstrings: - def __init__(self, pika_engine, msg_id, reply=None, failure_...
c01951b33e278de9e769c2d0609c0be61d2cb26b
<|skeleton|> class RpcReplyPikaOutgoingMessage: """PikaOutgoingMessage implementation for RPC reply messages. It sets correlation_id AMQP property to link this reply with response""" def __init__(self, pika_engine, msg_id, reply=None, failure_info=None, content_type=None): """Initialize with reply info...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RpcReplyPikaOutgoingMessage: """PikaOutgoingMessage implementation for RPC reply messages. It sets correlation_id AMQP property to link this reply with response""" def __init__(self, pika_engine, msg_id, reply=None, failure_info=None, content_type=None): """Initialize with reply information for s...
the_stack_v2_python_sparse
filesystems/vnx_rootfs_lxc_ubuntu64-16.04-v025-openstack-compute/rootfs/usr/lib/python2.7/dist-packages/oslo_messaging/_drivers/pika_driver/pika_message.py
juancarlosdiaztorres/Ansible-OpenStack
train
0
fb74be051b57cfe2206202bab3c3312998d7714c
[ "super().__init__()\nself.upsampler = dnnlib.util.construct_class_by_name(**upsampler_kwargs)\nself.z_dim = self.upsampler.z_dim\nself.c_dim = self.upsampler.c_dim\nself.img_channels = self.upsampler.img_channels\nself.img_resolution = self.upsampler.img_resolution\nself.layout_model_path = layout_model_path\nwith ...
<|body_start_0|> super().__init__() self.upsampler = dnnlib.util.construct_class_by_name(**upsampler_kwargs) self.z_dim = self.upsampler.z_dim self.c_dim = self.upsampler.c_dim self.img_channels = self.upsampler.img_channels self.img_resolution = self.upsampler.img_resolu...
Terrain wraps upsampler and layout model.
ModelTerrain
[ "Apache-2.0", "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ModelTerrain: """Terrain wraps upsampler and layout model.""" def __init__(self, layout_model_path, **upsampler_kwargs): """Initialize wrapper for upsampler refinement module. Args: layout_model_path: str containing the path to layout model **upsampler_kwargs: dictionary of inputs to...
stack_v2_sparse_classes_36k_train_006752
7,503
permissive
[ { "docstring": "Initialize wrapper for upsampler refinement module. Args: layout_model_path: str containing the path to layout model **upsampler_kwargs: dictionary of inputs to initialize upsampler", "name": "__init__", "signature": "def __init__(self, layout_model_path, **upsampler_kwargs)" }, { ...
5
stack_v2_sparse_classes_30k_test_000858
Implement the Python class `ModelTerrain` described below. Class description: Terrain wraps upsampler and layout model. Method signatures and docstrings: - def __init__(self, layout_model_path, **upsampler_kwargs): Initialize wrapper for upsampler refinement module. Args: layout_model_path: str containing the path to...
Implement the Python class `ModelTerrain` described below. Class description: Terrain wraps upsampler and layout model. Method signatures and docstrings: - def __init__(self, layout_model_path, **upsampler_kwargs): Initialize wrapper for upsampler refinement module. Args: layout_model_path: str containing the path to...
c1ae273841592fce4c993bf35cdd0a6424e73da4
<|skeleton|> class ModelTerrain: """Terrain wraps upsampler and layout model.""" def __init__(self, layout_model_path, **upsampler_kwargs): """Initialize wrapper for upsampler refinement module. Args: layout_model_path: str containing the path to layout model **upsampler_kwargs: dictionary of inputs to...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ModelTerrain: """Terrain wraps upsampler and layout model.""" def __init__(self, layout_model_path, **upsampler_kwargs): """Initialize wrapper for upsampler refinement module. Args: layout_model_path: str containing the path to layout model **upsampler_kwargs: dictionary of inputs to initialize u...
the_stack_v2_python_sparse
persistent-nature/models/layout/model_terrain.py
ishine/google-research
train
0
21c04defb8f361da7720357494063b243f68f190
[ "super().__init__()\nimport sklearn\nimport sklearn.multiclass\nself.model = sklearn.multiclass.OneVsRestClassifier", "specs = super().getInputSpecification()\nspecs.description = 'The \\\\xmlNode{OneVsRestClassifier} (\\\\textit{One-vs-the-rest (OvR) multiclass strategy})\\n Also known as ...
<|body_start_0|> super().__init__() import sklearn import sklearn.multiclass self.model = sklearn.multiclass.OneVsRestClassifier <|end_body_0|> <|body_start_1|> specs = super().getInputSpecification() specs.description = 'The \\xmlNode{OneVsRestClassifier} (\\textit{One-...
One-vs-the-rest (OvR) multiclass strategy classifer
OneVsRestClassifier
[ "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer", "BSD-2-Clause", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OneVsRestClassifier: """One-vs-the-rest (OvR) multiclass strategy classifer""" def __init__(self): """Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None""" <|body_0|> def getInputSpecification(cls): """Method to get...
stack_v2_sparse_classes_36k_train_006753
5,730
permissive
[ { "docstring": "Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Method to get a reference to a class that specifies the input data for class cls. @ In, cls, the class for...
4
stack_v2_sparse_classes_30k_test_000942
Implement the Python class `OneVsRestClassifier` described below. Class description: One-vs-the-rest (OvR) multiclass strategy classifer Method signatures and docstrings: - def __init__(self): Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None - def getInputSpecificatio...
Implement the Python class `OneVsRestClassifier` described below. Class description: One-vs-the-rest (OvR) multiclass strategy classifer Method signatures and docstrings: - def __init__(self): Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None - def getInputSpecificatio...
2b16e7aa3325fe84cab2477947a951414c635381
<|skeleton|> class OneVsRestClassifier: """One-vs-the-rest (OvR) multiclass strategy classifer""" def __init__(self): """Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None""" <|body_0|> def getInputSpecification(cls): """Method to get...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OneVsRestClassifier: """One-vs-the-rest (OvR) multiclass strategy classifer""" def __init__(self): """Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None""" super().__init__() import sklearn import sklearn.multiclass s...
the_stack_v2_python_sparse
ravenframework/SupervisedLearning/ScikitLearn/MultiClass/OneVsRestClassifier.py
idaholab/raven
train
201
e289205113301f5ec8e762154fa23b908b845812
[ "if serializer_class is None:\n if 'context' in kwargs.keys():\n kwargs.pop('context')\n return self.get_serializer(queryset, *args, **kwargs)\nreturn serializer_class(queryset, *args, context=self.get_serializer_context(), **kwargs)", "if user_pk is None:\n queryset = self.get_queryset().filter(u...
<|body_start_0|> if serializer_class is None: if 'context' in kwargs.keys(): kwargs.pop('context') return self.get_serializer(queryset, *args, **kwargs) return serializer_class(queryset, *args, context=self.get_serializer_context(), **kwargs) <|end_body_0|> <|bod...
/users/<user_pk>/favs/ のようなネストされた要素に対してリストを返す時のmixin
UserNestedListMixin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserNestedListMixin: """/users/<user_pk>/favs/ のようなネストされた要素に対してリストを返す時のmixin""" def _serialize(self, serializer_class, queryset, *args, **kwargs): """Serializerの指定があればそれで返す.無ければself.get_serializerする. :param serializer_class: 使用するSerializerクラスを指定する :param args: Serializerをインスタンス化する際の位...
stack_v2_sparse_classes_36k_train_006754
5,541
no_license
[ { "docstring": "Serializerの指定があればそれで返す.無ければself.get_serializerする. :param serializer_class: 使用するSerializerクラスを指定する :param args: Serializerをインスタンス化する際の位置引数 :param kwargs: Serializerをインスタンス化する際のオプション引数 :return: インスタンス化されたSerializer", "name": "_serialize", "signature": "def _serialize(self, serializer_class...
2
stack_v2_sparse_classes_30k_train_000479
Implement the Python class `UserNestedListMixin` described below. Class description: /users/<user_pk>/favs/ のようなネストされた要素に対してリストを返す時のmixin Method signatures and docstrings: - def _serialize(self, serializer_class, queryset, *args, **kwargs): Serializerの指定があればそれで返す.無ければself.get_serializerする. :param serializer_class: 使用...
Implement the Python class `UserNestedListMixin` described below. Class description: /users/<user_pk>/favs/ のようなネストされた要素に対してリストを返す時のmixin Method signatures and docstrings: - def _serialize(self, serializer_class, queryset, *args, **kwargs): Serializerの指定があればそれで返す.無ければself.get_serializerする. :param serializer_class: 使用...
6f9487dcfc13c706d312be6586159c7d3a25c6aa
<|skeleton|> class UserNestedListMixin: """/users/<user_pk>/favs/ のようなネストされた要素に対してリストを返す時のmixin""" def _serialize(self, serializer_class, queryset, *args, **kwargs): """Serializerの指定があればそれで返す.無ければself.get_serializerする. :param serializer_class: 使用するSerializerクラスを指定する :param args: Serializerをインスタンス化する際の位...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserNestedListMixin: """/users/<user_pk>/favs/ のようなネストされた要素に対してリストを返す時のmixin""" def _serialize(self, serializer_class, queryset, *args, **kwargs): """Serializerの指定があればそれで返す.無ければself.get_serializerする. :param serializer_class: 使用するSerializerクラスを指定する :param args: Serializerをインスタンス化する際の位置引数 :param kw...
the_stack_v2_python_sparse
src/plan/mixins.py
jphacks/KB_1809_2
train
3
777f59068da91a2689ace0b31b53a77b956cd0ca
[ "password1 = self.cleaned_data.get('password1')\npassword2 = self.cleaned_data.get('password2')\nif password1 and password2 and (password1 != password2):\n raise forms.ValidationError('Passwords do not match')\nreturn password2", "user = super(UserCreationForm, self).save(commit=False)\nuser.set_password(self....
<|body_start_0|> password1 = self.cleaned_data.get('password1') password2 = self.cleaned_data.get('password2') if password1 and password2 and (password1 != password2): raise forms.ValidationError('Passwords do not match') return password2 <|end_body_0|> <|body_start_1|> ...
A form for creating new users with a password confirmation field.
UserCreationForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserCreationForm: """A form for creating new users with a password confirmation field.""" def clean_password(self): """Checks that both of the passwords match :return: String - Password or Boolean False otherwise""" <|body_0|> def save(self, commit=True): """Save...
stack_v2_sparse_classes_36k_train_006755
4,010
no_license
[ { "docstring": "Checks that both of the passwords match :return: String - Password or Boolean False otherwise", "name": "clean_password", "signature": "def clean_password(self)" }, { "docstring": "Save data, mostly the password, in a hashed form :param commit: Whether or not to commit the change...
2
stack_v2_sparse_classes_30k_train_007689
Implement the Python class `UserCreationForm` described below. Class description: A form for creating new users with a password confirmation field. Method signatures and docstrings: - def clean_password(self): Checks that both of the passwords match :return: String - Password or Boolean False otherwise - def save(sel...
Implement the Python class `UserCreationForm` described below. Class description: A form for creating new users with a password confirmation field. Method signatures and docstrings: - def clean_password(self): Checks that both of the passwords match :return: String - Password or Boolean False otherwise - def save(sel...
167a39307fe3d978d3eee4b3fcd53c27143f5924
<|skeleton|> class UserCreationForm: """A form for creating new users with a password confirmation field.""" def clean_password(self): """Checks that both of the passwords match :return: String - Password or Boolean False otherwise""" <|body_0|> def save(self, commit=True): """Save...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserCreationForm: """A form for creating new users with a password confirmation field.""" def clean_password(self): """Checks that both of the passwords match :return: String - Password or Boolean False otherwise""" password1 = self.cleaned_data.get('password1') password2 = self.c...
the_stack_v2_python_sparse
summit/libs/auth/admin.py
NAU-CCL/cpcesu-summit
train
0
32f9d59b11d0474392c4eb5ce7ed8fa09a6c5f32
[ "super().__init__(event, arg_string)\nself.bot = SlackHandler()\nself.ka = KarmaAssistant()", "how_many = 5\nif self.arg_string:\n try:\n how_many = int(self.arg_string)\n except ValueError:\n self.bot.make_post(self.event, '{} is not a valid number.'.format(self.arg_string))\n return\n...
<|body_start_0|> super().__init__(event, arg_string) self.bot = SlackHandler() self.ka = KarmaAssistant() <|end_body_0|> <|body_start_1|> how_many = 5 if self.arg_string: try: how_many = int(self.arg_string) except ValueError: ...
Post highest-karma karma entries.
KarmaTopPlugin
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KarmaTopPlugin: """Post highest-karma karma entries.""" def __init__(self, event, arg_string): """Config.""" <|body_0|> def run(self): """Run the plugin.""" <|body_1|> <|end_skeleton|> <|body_start_0|> super().__init__(event, arg_string) ...
stack_v2_sparse_classes_36k_train_006756
11,809
permissive
[ { "docstring": "Config.", "name": "__init__", "signature": "def __init__(self, event, arg_string)" }, { "docstring": "Run the plugin.", "name": "run", "signature": "def run(self)" } ]
2
stack_v2_sparse_classes_30k_train_011902
Implement the Python class `KarmaTopPlugin` described below. Class description: Post highest-karma karma entries. Method signatures and docstrings: - def __init__(self, event, arg_string): Config. - def run(self): Run the plugin.
Implement the Python class `KarmaTopPlugin` described below. Class description: Post highest-karma karma entries. Method signatures and docstrings: - def __init__(self, event, arg_string): Config. - def run(self): Run the plugin. <|skeleton|> class KarmaTopPlugin: """Post highest-karma karma entries.""" def...
715c14d3a06d8a7a8771572371b67cc87c7e17fb
<|skeleton|> class KarmaTopPlugin: """Post highest-karma karma entries.""" def __init__(self, event, arg_string): """Config.""" <|body_0|> def run(self): """Run the plugin.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KarmaTopPlugin: """Post highest-karma karma entries.""" def __init__(self, event, arg_string): """Config.""" super().__init__(event, arg_string) self.bot = SlackHandler() self.ka = KarmaAssistant() def run(self): """Run the plugin.""" how_many = 5 ...
the_stack_v2_python_sparse
src/dungeonbot/plugins/karma.py
DungeonBot/dungeonbot
train
0
298242012aea52f7a1f4a9543ce2ba4fe0c34ea6
[ "logging.info('Select/click the ' + self.name)\ncheckbox = self.x_driver.find_element(self.x_elem_id[0], self.x_elem_id[1])\nif wait:\n time.sleep(wait_time)\ncheckbox.click()", "logging.info('Determine if the ' + self.name + ' is checked.')\ncheckbox = self.x_driver.find_element(self.x_elem_id[0], self.x_elem...
<|body_start_0|> logging.info('Select/click the ' + self.name) checkbox = self.x_driver.find_element(self.x_elem_id[0], self.x_elem_id[1]) if wait: time.sleep(wait_time) checkbox.click() <|end_body_0|> <|body_start_1|> logging.info('Determine if the ' + self.name + '...
Common class for checkbox elements/widgets
CheckBox
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CheckBox: """Common class for checkbox elements/widgets""" def select(self, wait=True, wait_time=config.wait_time): """Select the checkbox :param wait: True - Wait before performing action False - Do not wait before performing action :param wait_time: Time to wait before performing a...
stack_v2_sparse_classes_36k_train_006757
1,509
no_license
[ { "docstring": "Select the checkbox :param wait: True - Wait before performing action False - Do not wait before performing action :param wait_time: Time to wait before performing action. :return: None", "name": "select", "signature": "def select(self, wait=True, wait_time=config.wait_time)" }, { ...
2
stack_v2_sparse_classes_30k_test_000989
Implement the Python class `CheckBox` described below. Class description: Common class for checkbox elements/widgets Method signatures and docstrings: - def select(self, wait=True, wait_time=config.wait_time): Select the checkbox :param wait: True - Wait before performing action False - Do not wait before performing ...
Implement the Python class `CheckBox` described below. Class description: Common class for checkbox elements/widgets Method signatures and docstrings: - def select(self, wait=True, wait_time=config.wait_time): Select the checkbox :param wait: True - Wait before performing action False - Do not wait before performing ...
c7ae5cd1c14defdbff57c2ed5e4a447c7799c495
<|skeleton|> class CheckBox: """Common class for checkbox elements/widgets""" def select(self, wait=True, wait_time=config.wait_time): """Select the checkbox :param wait: True - Wait before performing action False - Do not wait before performing action :param wait_time: Time to wait before performing a...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CheckBox: """Common class for checkbox elements/widgets""" def select(self, wait=True, wait_time=config.wait_time): """Select the checkbox :param wait: True - Wait before performing action False - Do not wait before performing action :param wait_time: Time to wait before performing action. :retur...
the_stack_v2_python_sparse
support/common_controls/__checkbox.py
chrisaroy/proj_selenium_python_dev
train
0
9db7c40c3e23c144188df31219c4201cd1f83fec
[ "form_pk = self.kwargs.get('pk')\nif self.action == 'list' and form_pk is None:\n return OSMSiteMapSerializer\nreturn super().get_serializer_class()", "form_pk = self.kwargs.get('pk')\nif form_pk:\n queryset = queryset.filter(pk=form_pk)\nreturn super().filter_queryset(queryset)", "obj = super().get_objec...
<|body_start_0|> form_pk = self.kwargs.get('pk') if self.action == 'list' and form_pk is None: return OSMSiteMapSerializer return super().get_serializer_class() <|end_body_0|> <|body_start_1|> form_pk = self.kwargs.get('pk') if form_pk: queryset = queryse...
This endpoint provides public access to OSM submitted data in OSM format. No authentication is required. Where: * `pk` - the form unique identifier * `dataid` - submission data unique identifier * `owner` - username of the owner(user/organization) of the data point ## GET JSON List of data end points Lists the data end...
OsmViewSet
[ "BSD-2-Clause", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OsmViewSet: """This endpoint provides public access to OSM submitted data in OSM format. No authentication is required. Where: * `pk` - the form unique identifier * `dataid` - submission data unique identifier * `owner` - username of the owner(user/organization) of the data point ## GET JSON List...
stack_v2_sparse_classes_36k_train_006758
6,952
permissive
[ { "docstring": "Returns the OSMSiteMapSerializer class when list API is invoked.", "name": "get_serializer_class", "signature": "def get_serializer_class(self)" }, { "docstring": "Filters the queryset using the ``pk`` when used.", "name": "filter_queryset", "signature": "def filter_query...
5
stack_v2_sparse_classes_30k_train_005469
Implement the Python class `OsmViewSet` described below. Class description: This endpoint provides public access to OSM submitted data in OSM format. No authentication is required. Where: * `pk` - the form unique identifier * `dataid` - submission data unique identifier * `owner` - username of the owner(user/organizat...
Implement the Python class `OsmViewSet` described below. Class description: This endpoint provides public access to OSM submitted data in OSM format. No authentication is required. Where: * `pk` - the form unique identifier * `dataid` - submission data unique identifier * `owner` - username of the owner(user/organizat...
e5bdec91cb47179172b515bbcb91701262ff3377
<|skeleton|> class OsmViewSet: """This endpoint provides public access to OSM submitted data in OSM format. No authentication is required. Where: * `pk` - the form unique identifier * `dataid` - submission data unique identifier * `owner` - username of the owner(user/organization) of the data point ## GET JSON List...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OsmViewSet: """This endpoint provides public access to OSM submitted data in OSM format. No authentication is required. Where: * `pk` - the form unique identifier * `dataid` - submission data unique identifier * `owner` - username of the owner(user/organization) of the data point ## GET JSON List of data end ...
the_stack_v2_python_sparse
onadata/apps/api/viewsets/osm_viewset.py
onaio/onadata
train
177
48647e0b097b5b723e16913789939961587f3db7
[ "super().__init__(*args, category=CATEGORY_ALARM_SYSTEM)\nstate = self.hass.states.get(self.entity_id)\nself._alarm_code = self.config.get(ATTR_CODE)\nsupported_states = state.attributes.get(ATTR_SUPPORTED_FEATURES, SUPPORT_ALARM_ARM_HOME | SUPPORT_ALARM_ARM_AWAY | SUPPORT_ALARM_ARM_NIGHT | SUPPORT_ALARM_TRIGGER)\n...
<|body_start_0|> super().__init__(*args, category=CATEGORY_ALARM_SYSTEM) state = self.hass.states.get(self.entity_id) self._alarm_code = self.config.get(ATTR_CODE) supported_states = state.attributes.get(ATTR_SUPPORTED_FEATURES, SUPPORT_ALARM_ARM_HOME | SUPPORT_ALARM_ARM_AWAY | SUPPORT_A...
Generate an SecuritySystem accessory for an alarm control panel.
SecuritySystem
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SecuritySystem: """Generate an SecuritySystem accessory for an alarm control panel.""" def __init__(self, *args): """Initialize a SecuritySystem accessory object.""" <|body_0|> def set_security_state(self, value): """Move security state to value if call came from...
stack_v2_sparse_classes_36k_train_006759
6,081
permissive
[ { "docstring": "Initialize a SecuritySystem accessory object.", "name": "__init__", "signature": "def __init__(self, *args)" }, { "docstring": "Move security state to value if call came from HomeKit.", "name": "set_security_state", "signature": "def set_security_state(self, value)" }, ...
3
stack_v2_sparse_classes_30k_train_002240
Implement the Python class `SecuritySystem` described below. Class description: Generate an SecuritySystem accessory for an alarm control panel. Method signatures and docstrings: - def __init__(self, *args): Initialize a SecuritySystem accessory object. - def set_security_state(self, value): Move security state to va...
Implement the Python class `SecuritySystem` described below. Class description: Generate an SecuritySystem accessory for an alarm control panel. Method signatures and docstrings: - def __init__(self, *args): Initialize a SecuritySystem accessory object. - def set_security_state(self, value): Move security state to va...
2fee32fce03bc49e86cf2e7b741a15621a97cce5
<|skeleton|> class SecuritySystem: """Generate an SecuritySystem accessory for an alarm control panel.""" def __init__(self, *args): """Initialize a SecuritySystem accessory object.""" <|body_0|> def set_security_state(self, value): """Move security state to value if call came from...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SecuritySystem: """Generate an SecuritySystem accessory for an alarm control panel.""" def __init__(self, *args): """Initialize a SecuritySystem accessory object.""" super().__init__(*args, category=CATEGORY_ALARM_SYSTEM) state = self.hass.states.get(self.entity_id) self._...
the_stack_v2_python_sparse
homeassistant/components/homekit/type_security_systems.py
BenWoodford/home-assistant
train
11
38628210514547e37e6b3fe73a5a6c75ab68fd98
[ "self.num_failed = num_failed\nself.num_objects = num_objects\nself.size_bytes = size_bytes", "if dictionary is None:\n return None\nnum_failed = dictionary.get('numFailed')\nnum_objects = dictionary.get('numObjects')\nsize_bytes = dictionary.get('sizeBytes')\nreturn cls(num_failed, num_objects, size_bytes)" ]
<|body_start_0|> self.num_failed = num_failed self.num_objects = num_objects self.size_bytes = size_bytes <|end_body_0|> <|body_start_1|> if dictionary is None: return None num_failed = dictionary.get('numFailed') num_objects = dictionary.get('numObjects') ...
Implementation of the 'ProtectionStats' model. Protection Statistics. Attributes: num_failed (int): Number of Failed Objects. num_objects (int): Number of Objects. size_bytes (long|int): Size in Bytes.
ProtectionStats
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProtectionStats: """Implementation of the 'ProtectionStats' model. Protection Statistics. Attributes: num_failed (int): Number of Failed Objects. num_objects (int): Number of Objects. size_bytes (long|int): Size in Bytes.""" def __init__(self, num_failed=None, num_objects=None, size_bytes=No...
stack_v2_sparse_classes_36k_train_006760
1,756
permissive
[ { "docstring": "Constructor for the ProtectionStats class", "name": "__init__", "signature": "def __init__(self, num_failed=None, num_objects=None, size_bytes=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary representation ...
2
stack_v2_sparse_classes_30k_test_000226
Implement the Python class `ProtectionStats` described below. Class description: Implementation of the 'ProtectionStats' model. Protection Statistics. Attributes: num_failed (int): Number of Failed Objects. num_objects (int): Number of Objects. size_bytes (long|int): Size in Bytes. Method signatures and docstrings: -...
Implement the Python class `ProtectionStats` described below. Class description: Implementation of the 'ProtectionStats' model. Protection Statistics. Attributes: num_failed (int): Number of Failed Objects. num_objects (int): Number of Objects. size_bytes (long|int): Size in Bytes. Method signatures and docstrings: -...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class ProtectionStats: """Implementation of the 'ProtectionStats' model. Protection Statistics. Attributes: num_failed (int): Number of Failed Objects. num_objects (int): Number of Objects. size_bytes (long|int): Size in Bytes.""" def __init__(self, num_failed=None, num_objects=None, size_bytes=No...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProtectionStats: """Implementation of the 'ProtectionStats' model. Protection Statistics. Attributes: num_failed (int): Number of Failed Objects. num_objects (int): Number of Objects. size_bytes (long|int): Size in Bytes.""" def __init__(self, num_failed=None, num_objects=None, size_bytes=None): ...
the_stack_v2_python_sparse
cohesity_management_sdk/models/protection_stats.py
cohesity/management-sdk-python
train
24
e7c2346eb99219742a7d46c817bba1194fdc6313
[ "dp = [[0] * len(l) for l in triangle]\ndp[0] = triangle[0]\nfor i in range(1, len(triangle)):\n for j in range(len(triangle[i])):\n l = dp[i - 1][j - 1] if j >= 1 else float('inf')\n m = dp[i - 1][j] if j < len(dp[i - 1]) else float('inf')\n ele = min(l, m)\n dp[i][j] = ele + triangl...
<|body_start_0|> dp = [[0] * len(l) for l in triangle] dp[0] = triangle[0] for i in range(1, len(triangle)): for j in range(len(triangle[i])): l = dp[i - 1][j - 1] if j >= 1 else float('inf') m = dp[i - 1][j] if j < len(dp[i - 1]) else float('inf') ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minimumTotal(self, triangle: List[List[int]]) -> int: """Dynamic Programming""" <|body_0|> def minimum_total(self, triangle): """Linear Space""" <|body_1|> <|end_skeleton|> <|body_start_0|> dp = [[0] * len(l) for l in triangle] ...
stack_v2_sparse_classes_36k_train_006761
1,014
no_license
[ { "docstring": "Dynamic Programming", "name": "minimumTotal", "signature": "def minimumTotal(self, triangle: List[List[int]]) -> int" }, { "docstring": "Linear Space", "name": "minimum_total", "signature": "def minimum_total(self, triangle)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minimumTotal(self, triangle: List[List[int]]) -> int: Dynamic Programming - def minimum_total(self, triangle): Linear Space
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minimumTotal(self, triangle: List[List[int]]) -> int: Dynamic Programming - def minimum_total(self, triangle): Linear Space <|skeleton|> class Solution: def minimumTota...
33252434f8d90b46fd2de07e257842331dcd81a8
<|skeleton|> class Solution: def minimumTotal(self, triangle: List[List[int]]) -> int: """Dynamic Programming""" <|body_0|> def minimum_total(self, triangle): """Linear Space""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def minimumTotal(self, triangle: List[List[int]]) -> int: """Dynamic Programming""" dp = [[0] * len(l) for l in triangle] dp[0] = triangle[0] for i in range(1, len(triangle)): for j in range(len(triangle[i])): l = dp[i - 1][j - 1] if j >= 1...
the_stack_v2_python_sparse
main/leetcode/120.py
dawnonme/Eureka
train
0
a184c10bc5a33f14401a45ca96bc88c0ee033b86
[ "try:\n resp = Node().get_data_by_node_id(node_id)\n return masked_json_template(resp, 200)\nexcept:\n abort(400, 'Input unrecognizable.')", "try:\n resp = Node().delete_data_by_node_id(node_id)\n return masked_json_template(resp, 200)\nexcept:\n abort(400, 'Input unrecognizable.')" ]
<|body_start_0|> try: resp = Node().get_data_by_node_id(node_id) return masked_json_template(resp, 200) except: abort(400, 'Input unrecognizable.') <|end_body_0|> <|body_start_1|> try: resp = Node().delete_data_by_node_id(node_id) retu...
NodeFindRoute
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NodeFindRoute: def get(self, node_id): """Get Node data by Node ID""" <|body_0|> def delete(self, node_id): """Delete Node data by Node ID""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: resp = Node().get_data_by_node_id(node_id) ...
stack_v2_sparse_classes_36k_train_006762
4,218
permissive
[ { "docstring": "Get Node data by Node ID", "name": "get", "signature": "def get(self, node_id)" }, { "docstring": "Delete Node data by Node ID", "name": "delete", "signature": "def delete(self, node_id)" } ]
2
stack_v2_sparse_classes_30k_train_021255
Implement the Python class `NodeFindRoute` described below. Class description: Implement the NodeFindRoute class. Method signatures and docstrings: - def get(self, node_id): Get Node data by Node ID - def delete(self, node_id): Delete Node data by Node ID
Implement the Python class `NodeFindRoute` described below. Class description: Implement the NodeFindRoute class. Method signatures and docstrings: - def get(self, node_id): Get Node data by Node ID - def delete(self, node_id): Delete Node data by Node ID <|skeleton|> class NodeFindRoute: def get(self, node_id)...
100fca0d2dd9b0b2ab2fa5974d8126af35ddcfd1
<|skeleton|> class NodeFindRoute: def get(self, node_id): """Get Node data by Node ID""" <|body_0|> def delete(self, node_id): """Delete Node data by Node ID""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NodeFindRoute: def get(self, node_id): """Get Node data by Node ID""" try: resp = Node().get_data_by_node_id(node_id) return masked_json_template(resp, 200) except: abort(400, 'Input unrecognizable.') def delete(self, node_id): """Delete...
the_stack_v2_python_sparse
app/controllers/api/node/node.py
ardihikaru/api-dashboard-5g-dive
train
0
92d21f23e8f986666ede4e10477e79a34ec5dd81
[ "self.words = words\nself.temp_dict = {}\nfor i in range(len(words)):\n if words[i] not in self.temp_dict:\n self.temp_dict[words[i]] = [i]\n else:\n self.temp_dict[words[i]].append(i)", "maxi = sys.maxint\nlist1 = self.temp_dict[word1]\nlist2 = self.temp_dict[word2]\nfor i in range(len(list1)...
<|body_start_0|> self.words = words self.temp_dict = {} for i in range(len(words)): if words[i] not in self.temp_dict: self.temp_dict[words[i]] = [i] else: self.temp_dict[words[i]].append(i) <|end_body_0|> <|body_start_1|> maxi = s...
WordDistance
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WordDistance: def __init__(self, words): """:type words: List[str]""" <|body_0|> def shortest(self, word1, word2): """:type word1: str :type word2: str :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.words = words self.temp_...
stack_v2_sparse_classes_36k_train_006763
935
no_license
[ { "docstring": ":type words: List[str]", "name": "__init__", "signature": "def __init__(self, words)" }, { "docstring": ":type word1: str :type word2: str :rtype: int", "name": "shortest", "signature": "def shortest(self, word1, word2)" } ]
2
stack_v2_sparse_classes_30k_train_013132
Implement the Python class `WordDistance` described below. Class description: Implement the WordDistance class. Method signatures and docstrings: - def __init__(self, words): :type words: List[str] - def shortest(self, word1, word2): :type word1: str :type word2: str :rtype: int
Implement the Python class `WordDistance` described below. Class description: Implement the WordDistance class. Method signatures and docstrings: - def __init__(self, words): :type words: List[str] - def shortest(self, word1, word2): :type word1: str :type word2: str :rtype: int <|skeleton|> class WordDistance: ...
2f53c4e16d244c83aad9b4d67a249f669b9da92a
<|skeleton|> class WordDistance: def __init__(self, words): """:type words: List[str]""" <|body_0|> def shortest(self, word1, word2): """:type word1: str :type word2: str :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WordDistance: def __init__(self, words): """:type words: List[str]""" self.words = words self.temp_dict = {} for i in range(len(words)): if words[i] not in self.temp_dict: self.temp_dict[words[i]] = [i] else: self.temp_dic...
the_stack_v2_python_sparse
prob244/shortest_word_distance2.py
sharath28/leetcode
train
1
397e735b5a62ed49e22c9d50970bc0f817a9cac2
[ "self.data_feature = data_feature\nself.argmax_feature = argmax_feature\nself.argmin_feature = argmin_feature\nself.mask_data = mask_data", "if self.mask_data:\n valid_data_mask = eopatch.mask['VALID_DATA']\nelse:\n valid_data_mask = eopatch.mask['IS_DATA']\nndvi = np.ma.array(eopatch.data[self.data_feature...
<|body_start_0|> self.data_feature = data_feature self.argmax_feature = argmax_feature self.argmin_feature = argmin_feature self.mask_data = mask_data <|end_body_0|> <|body_start_1|> if self.mask_data: valid_data_mask = eopatch.mask['VALID_DATA'] else: ...
Task to compute the argmax and argmin of the NDVI slope This task computes the slope of the NDVI feature using central differences. The NDVI feature can be masked using the `'VALID_DATA'` mask. Current implementation loops through every location of eopatch, and is therefore slow. The NDVI slope at date t is computed as...
AddMaxMinNDVISlopeIndicesTask
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AddMaxMinNDVISlopeIndicesTask: """Task to compute the argmax and argmin of the NDVI slope This task computes the slope of the NDVI feature using central differences. The NDVI feature can be masked using the `'VALID_DATA'` mask. Current implementation loops through every location of eopatch, and i...
stack_v2_sparse_classes_36k_train_006764
10,624
permissive
[ { "docstring": "Task constructor :param data_feature: Name of data feature with NDVI values. Default is `'NDVI'` :param argmax_feature: Name of feature with computed argmax values of the NDVI slope :param argmin_feature: Name of feature with computed argmin values of the NDVI slope :param mask_data: Flag for ma...
2
stack_v2_sparse_classes_30k_train_019870
Implement the Python class `AddMaxMinNDVISlopeIndicesTask` described below. Class description: Task to compute the argmax and argmin of the NDVI slope This task computes the slope of the NDVI feature using central differences. The NDVI feature can be masked using the `'VALID_DATA'` mask. Current implementation loops t...
Implement the Python class `AddMaxMinNDVISlopeIndicesTask` described below. Class description: Task to compute the argmax and argmin of the NDVI slope This task computes the slope of the NDVI feature using central differences. The NDVI feature can be masked using the `'VALID_DATA'` mask. Current implementation loops t...
a65899e4632b50c9c41a67e1f7698c09b929d840
<|skeleton|> class AddMaxMinNDVISlopeIndicesTask: """Task to compute the argmax and argmin of the NDVI slope This task computes the slope of the NDVI feature using central differences. The NDVI feature can be masked using the `'VALID_DATA'` mask. Current implementation loops through every location of eopatch, and i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AddMaxMinNDVISlopeIndicesTask: """Task to compute the argmax and argmin of the NDVI slope This task computes the slope of the NDVI feature using central differences. The NDVI feature can be masked using the `'VALID_DATA'` mask. Current implementation loops through every location of eopatch, and is therefore s...
the_stack_v2_python_sparse
features/eolearn/features/temporal_features.py
sentinel-hub/eo-learn
train
1,072
83c0a8247bca4eef0fd03dc5c97a2360a9fbdaab
[ "myHead = ListNode(0)\nmyHead.next = head\nfast, slow = (myHead, myHead)\nwhile fast and slow:\n fast = fast.next\n if fast == None:\n break\n fast = fast.next\n slow = slow.next\nreturn slow", "if head == None:\n return head\np = head.next\nwhile p and p.next:\n tmp = p.next\n p.next ...
<|body_start_0|> myHead = ListNode(0) myHead.next = head fast, slow = (myHead, myHead) while fast and slow: fast = fast.next if fast == None: break fast = fast.next slow = slow.next return slow <|end_body_0|> <|body...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findMiddle(self, head): """找到中间节点""" <|body_0|> def myReverse(self, head): """head是头结点""" <|body_1|> def isPalindrome(self, head): """:type head: ListNode :rtype: bool""" <|body_2|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_006765
1,227
no_license
[ { "docstring": "找到中间节点", "name": "findMiddle", "signature": "def findMiddle(self, head)" }, { "docstring": "head是头结点", "name": "myReverse", "signature": "def myReverse(self, head)" }, { "docstring": ":type head: ListNode :rtype: bool", "name": "isPalindrome", "signature":...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMiddle(self, head): 找到中间节点 - def myReverse(self, head): head是头结点 - def isPalindrome(self, head): :type head: ListNode :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMiddle(self, head): 找到中间节点 - def myReverse(self, head): head是头结点 - def isPalindrome(self, head): :type head: ListNode :rtype: bool <|skeleton|> class Solution: def ...
56e33dff3918e371f14d6f7ef03f8951056cc273
<|skeleton|> class Solution: def findMiddle(self, head): """找到中间节点""" <|body_0|> def myReverse(self, head): """head是头结点""" <|body_1|> def isPalindrome(self, head): """:type head: ListNode :rtype: bool""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findMiddle(self, head): """找到中间节点""" myHead = ListNode(0) myHead.next = head fast, slow = (myHead, myHead) while fast and slow: fast = fast.next if fast == None: break fast = fast.next slow = ...
the_stack_v2_python_sparse
accepted/Palindrome Linked List.py
hustlrr/leetcode
train
4
de550336b302414759beed9364981f8d19e27e0b
[ "ArgsUtils.addIfMissing('yLabel', 'Frequency', kwargs)\nsuper(Histogram, self).__init__(**kwargs)\nself.color = kwargs.get('color', 'b')\nself.binCount = kwargs.get('binCount', 100)\nself.data = kwargs.get('data', [])\nself.isLog = kwargs.get('isLog', False)", "if not self.xLimits or not len(self.xLimits) == 2:\n...
<|body_start_0|> ArgsUtils.addIfMissing('yLabel', 'Frequency', kwargs) super(Histogram, self).__init__(**kwargs) self.color = kwargs.get('color', 'b') self.binCount = kwargs.get('binCount', 100) self.data = kwargs.get('data', []) self.isLog = kwargs.get('isLog', False) <|...
A class for...
Histogram
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Histogram: """A class for...""" def __init__(self, **kwargs): """Creates a new instance of Histogram.""" <|body_0|> def shaveDataToXLimits(self): """shaveData doc...""" <|body_1|> def _plot(self): """_plot doc...""" <|body_2|> <|end_...
stack_v2_sparse_classes_36k_train_006766
2,345
no_license
[ { "docstring": "Creates a new instance of Histogram.", "name": "__init__", "signature": "def __init__(self, **kwargs)" }, { "docstring": "shaveData doc...", "name": "shaveDataToXLimits", "signature": "def shaveDataToXLimits(self)" }, { "docstring": "_plot doc...", "name": "_p...
3
stack_v2_sparse_classes_30k_train_021417
Implement the Python class `Histogram` described below. Class description: A class for... Method signatures and docstrings: - def __init__(self, **kwargs): Creates a new instance of Histogram. - def shaveDataToXLimits(self): shaveData doc... - def _plot(self): _plot doc...
Implement the Python class `Histogram` described below. Class description: A class for... Method signatures and docstrings: - def __init__(self, **kwargs): Creates a new instance of Histogram. - def shaveDataToXLimits(self): shaveData doc... - def _plot(self): _plot doc... <|skeleton|> class Histogram: """A clas...
bcd0d80077c68cf4bb515d643e51f62dd6c4caaa
<|skeleton|> class Histogram: """A class for...""" def __init__(self, **kwargs): """Creates a new instance of Histogram.""" <|body_0|> def shaveDataToXLimits(self): """shaveData doc...""" <|body_1|> def _plot(self): """_plot doc...""" <|body_2|> <|end_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Histogram: """A class for...""" def __init__(self, **kwargs): """Creates a new instance of Histogram.""" ArgsUtils.addIfMissing('yLabel', 'Frequency', kwargs) super(Histogram, self).__init__(**kwargs) self.color = kwargs.get('color', 'b') self.binCount = kwargs.get...
the_stack_v2_python_sparse
src/cadence/analysis/shared/plotting/Histogram.py
sernst/Cadence
train
2
98cecb0e98adffa15e5dd566ed8507923ba97aeb
[ "self._encoder = encoder\nself._decoder = decoder\nself._rho = rho", "posterior = self._encoder(input_data)\nsamples = self._encoder.sample(posterior, key)\nkls = jax.vmap(kl.kl_p_with_uniform_normal, [0])(posterior.mean, posterior.variance)\nrecons = self._decoder(samples)\ndata_fidelity = self._decoder.data_fid...
<|body_start_0|> self._encoder = encoder self._decoder = decoder self._rho = rho <|end_body_0|> <|body_start_1|> posterior = self._encoder(input_data) samples = self._encoder.sample(posterior, key) kls = jax.vmap(kl.kl_p_with_uniform_normal, [0])(posterior.mean, posterio...
VAE class. This class defines the ELBO used in training VAE models. It also adds function for forward passing data through VAE.
VAE
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VAE: """VAE class. This class defines the ELBO used in training VAE models. It also adds function for forward passing data through VAE.""" def __init__(self, encoder: encoders.EncoderBase, decoder: decoders.DecoderBase, rho: Optional[float]=None): """Class initializer. Args: encoder:...
stack_v2_sparse_classes_36k_train_006767
4,304
permissive
[ { "docstring": "Class initializer. Args: encoder: Encoder network architecture. decoder: Decoder network architecture. rho: Rho parameter used in AVAE training.", "name": "__init__", "signature": "def __init__(self, encoder: encoders.EncoderBase, decoder: decoders.DecoderBase, rho: Optional[float]=None)...
4
stack_v2_sparse_classes_30k_train_017170
Implement the Python class `VAE` described below. Class description: VAE class. This class defines the ELBO used in training VAE models. It also adds function for forward passing data through VAE. Method signatures and docstrings: - def __init__(self, encoder: encoders.EncoderBase, decoder: decoders.DecoderBase, rho:...
Implement the Python class `VAE` described below. Class description: VAE class. This class defines the ELBO used in training VAE models. It also adds function for forward passing data through VAE. Method signatures and docstrings: - def __init__(self, encoder: encoders.EncoderBase, decoder: decoders.DecoderBase, rho:...
f5de0ede8430809180254ee957abf36ed62579ef
<|skeleton|> class VAE: """VAE class. This class defines the ELBO used in training VAE models. It also adds function for forward passing data through VAE.""" def __init__(self, encoder: encoders.EncoderBase, decoder: decoders.DecoderBase, rho: Optional[float]=None): """Class initializer. Args: encoder:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VAE: """VAE class. This class defines the ELBO used in training VAE models. It also adds function for forward passing data through VAE.""" def __init__(self, encoder: encoders.EncoderBase, decoder: decoders.DecoderBase, rho: Optional[float]=None): """Class initializer. Args: encoder: Encoder netw...
the_stack_v2_python_sparse
avae/vae.py
vishalbelsare/deepmind-research
train
0
0c4639094b8a36755da8e49221d6534073a69560
[ "self.config = config\nself.name = name\nif len(rules_or_filters) == 0:\n raise ValueError('concept has one rule or filter at least', name)\nself.rules_or_filters = rules_or_filters\nself.concept_filters = concept_filters", "results = Results()\nfor rule_or_filter in self.rules_or_filters:\n results.add(rul...
<|body_start_0|> self.config = config self.name = name if len(rules_or_filters) == 0: raise ValueError('concept has one rule or filter at least', name) self.rules_or_filters = rules_or_filters self.concept_filters = concept_filters <|end_body_0|> <|body_start_1|> ...
概念对象是规则的集合, 可以一定程度标定客观物理世界的一些通用规范. 例如, 我们规则中会大量使用到 "手机" 这个概念, 我们可以建立一个 "Phone" 的概念, 对应给它赋予一些规则来表征. concept_name = Phone rules = [ $kw("mobilephone"), $kw("phone"), $seq("mobile", "phone"), $ord(@d5, "my", "phone"), ... ]
Concept
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Concept: """概念对象是规则的集合, 可以一定程度标定客观物理世界的一些通用规范. 例如, 我们规则中会大量使用到 "手机" 这个概念, 我们可以建立一个 "Phone" 的概念, 对应给它赋予一些规则来表征. concept_name = Phone rules = [ $kw("mobilephone"), $kw("phone"), $seq("mobile", "phone"), $ord(@d5, "my", "phone"), ... ]""" def __init__(self, config, name, rules_or_filters, conce...
stack_v2_sparse_classes_36k_train_006768
2,530
no_license
[ { "docstring": "初始化一个 Concept 对象 :param config: 包含配置信息的对象 :param name: 概念名称 :param rules_or_filters: 概念的匹配规则或规则过滤器, 规则与规则之间是 \"逻辑或\" 的操作, 即所有规则命中结果的集合 :param concept_filters: 概念过滤器, 用在所有的结果上进行过滤, 默认不存在", "name": "__init__", "signature": "def __init__(self, config, name, rules_or_filters, concept_filters...
2
stack_v2_sparse_classes_30k_train_013493
Implement the Python class `Concept` described below. Class description: 概念对象是规则的集合, 可以一定程度标定客观物理世界的一些通用规范. 例如, 我们规则中会大量使用到 "手机" 这个概念, 我们可以建立一个 "Phone" 的概念, 对应给它赋予一些规则来表征. concept_name = Phone rules = [ $kw("mobilephone"), $kw("phone"), $seq("mobile", "phone"), $ord(@d5, "my", "phone"), ... ] Method signatures and do...
Implement the Python class `Concept` described below. Class description: 概念对象是规则的集合, 可以一定程度标定客观物理世界的一些通用规范. 例如, 我们规则中会大量使用到 "手机" 这个概念, 我们可以建立一个 "Phone" 的概念, 对应给它赋予一些规则来表征. concept_name = Phone rules = [ $kw("mobilephone"), $kw("phone"), $seq("mobile", "phone"), $ord(@d5, "my", "phone"), ... ] Method signatures and do...
0d587707b0ecae5a321e8a394cc0cf96fcf58235
<|skeleton|> class Concept: """概念对象是规则的集合, 可以一定程度标定客观物理世界的一些通用规范. 例如, 我们规则中会大量使用到 "手机" 这个概念, 我们可以建立一个 "Phone" 的概念, 对应给它赋予一些规则来表征. concept_name = Phone rules = [ $kw("mobilephone"), $kw("phone"), $seq("mobile", "phone"), $ord(@d5, "my", "phone"), ... ]""" def __init__(self, config, name, rules_or_filters, conce...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Concept: """概念对象是规则的集合, 可以一定程度标定客观物理世界的一些通用规范. 例如, 我们规则中会大量使用到 "手机" 这个概念, 我们可以建立一个 "Phone" 的概念, 对应给它赋予一些规则来表征. concept_name = Phone rules = [ $kw("mobilephone"), $kw("phone"), $seq("mobile", "phone"), $ord(@d5, "my", "phone"), ... ]""" def __init__(self, config, name, rules_or_filters, concept_filters=[]...
the_stack_v2_python_sparse
report_code/code/kme/concept/concept.py
Mi524/tools_copy
train
0
e927e755cb0c0f1254686f1eb20a9446517bffe7
[ "Muscle.__init__(self, params_, simulator)\nself.percent_slow_fiber = self.params['percent_slow_fiber'] if 'percent_slow_fiber' in self.params else 3.5\nself.f_05 = 0.36\nself.pcsa = 0.0 if 'pcsa' not in self.params else self.params['pcsa']\nself.l_ce = np.linalg.norm(self.app_point_1 - self.app_point_2)\nself.l_0 ...
<|body_start_0|> Muscle.__init__(self, params_, simulator) self.percent_slow_fiber = self.params['percent_slow_fiber'] if 'percent_slow_fiber' in self.params else 3.5 self.f_05 = 0.36 self.pcsa = 0.0 if 'pcsa' not in self.params else self.params['pcsa'] self.l_ce = np.linalg.norm...
BrownMuscle
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BrownMuscle: def __init__(self, params_, simulator): """Class initialization. Mammalian Muscle Model for predicting force and energetics during physiological behavior Based on BROWN, CHENG and LOEB muscle models :param params_: Dictionary containing parameter for the muscle :param simula...
stack_v2_sparse_classes_36k_train_006769
4,770
no_license
[ { "docstring": "Class initialization. Mammalian Muscle Model for predicting force and energetics during physiological behavior Based on BROWN, CHENG and LOEB muscle models :param params_: Dictionary containing parameter for the muscle :param simulator: SimulatorUtils class to access utility functions", "nam...
5
null
Implement the Python class `BrownMuscle` described below. Class description: Implement the BrownMuscle class. Method signatures and docstrings: - def __init__(self, params_, simulator): Class initialization. Mammalian Muscle Model for predicting force and energetics during physiological behavior Based on BROWN, CHENG...
Implement the Python class `BrownMuscle` described below. Class description: Implement the BrownMuscle class. Method signatures and docstrings: - def __init__(self, params_, simulator): Class initialization. Mammalian Muscle Model for predicting force and energetics during physiological behavior Based on BROWN, CHENG...
f4f212a7533a63d1148068bacf1cc13d3f64db49
<|skeleton|> class BrownMuscle: def __init__(self, params_, simulator): """Class initialization. Mammalian Muscle Model for predicting force and energetics during physiological behavior Based on BROWN, CHENG and LOEB muscle models :param params_: Dictionary containing parameter for the muscle :param simula...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BrownMuscle: def __init__(self, params_, simulator): """Class initialization. Mammalian Muscle Model for predicting force and energetics during physiological behavior Based on BROWN, CHENG and LOEB muscle models :param params_: Dictionary containing parameter for the muscle :param simulator: Simulator...
the_stack_v2_python_sparse
src/musculoskeletals/muscles/brown.py
mahedjaved/mouse_locomotion
train
0
29075a4ee0a7d91237d1ab8e086703445c9d3509
[ "should_exit = False\nwhile not should_exit:\n os.system('clear')\n RecoveryView.display_main_menu()\n user_input = RecoveryView.get_user_input('Choose an option: ')\n if user_input == '1':\n self.new_recovery_password_process()\n should_exit = True\n elif user_input == '2':\n sh...
<|body_start_0|> should_exit = False while not should_exit: os.system('clear') RecoveryView.display_main_menu() user_input = RecoveryView.get_user_input('Choose an option: ') if user_input == '1': self.new_recovery_password_process() ...
RecoveryController
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RecoveryController: def start(self): """Method starts RecoveryController loop :return: None""" <|body_0|> def new_recovery_password_process(self): """Method handles new password recovery process. :return: None""" <|body_1|> <|end_skeleton|> <|body_start_0|>...
stack_v2_sparse_classes_36k_train_006770
2,012
no_license
[ { "docstring": "Method starts RecoveryController loop :return: None", "name": "start", "signature": "def start(self)" }, { "docstring": "Method handles new password recovery process. :return: None", "name": "new_recovery_password_process", "signature": "def new_recovery_password_process(...
2
stack_v2_sparse_classes_30k_train_020509
Implement the Python class `RecoveryController` described below. Class description: Implement the RecoveryController class. Method signatures and docstrings: - def start(self): Method starts RecoveryController loop :return: None - def new_recovery_password_process(self): Method handles new password recovery process. ...
Implement the Python class `RecoveryController` described below. Class description: Implement the RecoveryController class. Method signatures and docstrings: - def start(self): Method starts RecoveryController loop :return: None - def new_recovery_password_process(self): Method handles new password recovery process. ...
fe152dc4a112f62572f2d7ccb74d293ea994ef9f
<|skeleton|> class RecoveryController: def start(self): """Method starts RecoveryController loop :return: None""" <|body_0|> def new_recovery_password_process(self): """Method handles new password recovery process. :return: None""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RecoveryController: def start(self): """Method starts RecoveryController loop :return: None""" should_exit = False while not should_exit: os.system('clear') RecoveryView.display_main_menu() user_input = RecoveryView.get_user_input('Choose an option: ...
the_stack_v2_python_sparse
controllers/recovery_controller.py
KamilPchelka/CcMS-Aktywnosc
train
0
eec269b1d989d34ae5f80122a3d62ee2dd7fe227
[ "v0 = Vertex()\nself.assertIsNot(v0, None)\nself.assertIsInstance(v0, Vertex)", "v1 = Vertex([1, 2, 3])\nself.assertIsNot(v1, None)\nself.assertIsInstance(v1, Vertex)", "t = Triangle()\nv = Vertex(t)\nself.assertIsInstance(v, Vertex)\nv_parents = v.parents()\nself.assertTrue(t in v_parents)" ]
<|body_start_0|> v0 = Vertex() self.assertIsNot(v0, None) self.assertIsInstance(v0, Vertex) <|end_body_0|> <|body_start_1|> v1 = Vertex([1, 2, 3]) self.assertIsNot(v1, None) self.assertIsInstance(v1, Vertex) <|end_body_1|> <|body_start_2|> t = Triangle() ...
Test Vertex class calls
TestConstructor_Vertex
[ "Unlicense" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestConstructor_Vertex: """Test Vertex class calls""" def test_none(self): """Calling Vertex class with no key (key = None)""" <|body_0|> def test_iterable_simple(self): """Calling Vertex class with key containing simple types""" <|body_1|> def test_...
stack_v2_sparse_classes_36k_train_006771
11,224
permissive
[ { "docstring": "Calling Vertex class with no key (key = None)", "name": "test_none", "signature": "def test_none(self)" }, { "docstring": "Calling Vertex class with key containing simple types", "name": "test_iterable_simple", "signature": "def test_iterable_simple(self)" }, { "d...
3
stack_v2_sparse_classes_30k_train_020987
Implement the Python class `TestConstructor_Vertex` described below. Class description: Test Vertex class calls Method signatures and docstrings: - def test_none(self): Calling Vertex class with no key (key = None) - def test_iterable_simple(self): Calling Vertex class with key containing simple types - def test_iter...
Implement the Python class `TestConstructor_Vertex` described below. Class description: Test Vertex class calls Method signatures and docstrings: - def test_none(self): Calling Vertex class with no key (key = None) - def test_iterable_simple(self): Calling Vertex class with key containing simple types - def test_iter...
f9b00a39bc16aea4abac60c0dd0aab2acac5adcf
<|skeleton|> class TestConstructor_Vertex: """Test Vertex class calls""" def test_none(self): """Calling Vertex class with no key (key = None)""" <|body_0|> def test_iterable_simple(self): """Calling Vertex class with key containing simple types""" <|body_1|> def test_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestConstructor_Vertex: """Test Vertex class calls""" def test_none(self): """Calling Vertex class with no key (key = None)""" v0 = Vertex() self.assertIsNot(v0, None) self.assertIsInstance(v0, Vertex) def test_iterable_simple(self): """Calling Vertex class wi...
the_stack_v2_python_sparse
_BACKUPS_V4/v4_5/LightPicture_Test.py
nagame/LightPicture
train
0
920f1e4b5a646ca7afb81ae72530b5918d9d973e
[ "self.__func = func\nself.__args = args\nself.__kwargs = kwargs\nself.__mutex = _thread.allocate_lock()\nself.__mutex.acquire()", "try:\n self.__value = self.__func(*self.__args, **self.__kwargs)\n self.__error = False\nexcept:\n self.__value = sys.exc_info()[1]\n self.__error = True\nself.__mutex.rel...
<|body_start_0|> self.__func = func self.__args = args self.__kwargs = kwargs self.__mutex = _thread.allocate_lock() self.__mutex.acquire() <|end_body_0|> <|body_start_1|> try: self.__value = self.__func(*self.__args, **self.__kwargs) self.__error...
_Delegate(func, args, kwargs) -> _Delegate instance
_Delegate
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _Delegate: """_Delegate(func, args, kwargs) -> _Delegate instance""" def __init__(self, func, args, kwargs): """Initializes instance from arguments and prepares to run.""" <|body_0|> def __call__(self): """Executes code with arguments and allows value retrieval."...
stack_v2_sparse_classes_36k_train_006772
2,633
permissive
[ { "docstring": "Initializes instance from arguments and prepares to run.", "name": "__init__", "signature": "def __init__(self, func, args, kwargs)" }, { "docstring": "Executes code with arguments and allows value retrieval.", "name": "__call__", "signature": "def __call__(self)" }, ...
3
null
Implement the Python class `_Delegate` described below. Class description: _Delegate(func, args, kwargs) -> _Delegate instance Method signatures and docstrings: - def __init__(self, func, args, kwargs): Initializes instance from arguments and prepares to run. - def __call__(self): Executes code with arguments and all...
Implement the Python class `_Delegate` described below. Class description: _Delegate(func, args, kwargs) -> _Delegate instance Method signatures and docstrings: - def __init__(self, func, args, kwargs): Initializes instance from arguments and prepares to run. - def __call__(self): Executes code with arguments and all...
d097ca0ad6a6aee2180d32dce6a3322621f655fd
<|skeleton|> class _Delegate: """_Delegate(func, args, kwargs) -> _Delegate instance""" def __init__(self, func, args, kwargs): """Initializes instance from arguments and prepares to run.""" <|body_0|> def __call__(self): """Executes code with arguments and allows value retrieval."...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class _Delegate: """_Delegate(func, args, kwargs) -> _Delegate instance""" def __init__(self, func, args, kwargs): """Initializes instance from arguments and prepares to run.""" self.__func = func self.__args = args self.__kwargs = kwargs self.__mutex = _thread.allocate_...
the_stack_v2_python_sparse
recipes/Python/578151_affinitypy/recipe-578151.py
betty29/code-1
train
0
dd28f16740bfda2e2604876bc1ecb820a9fe167b
[ "self.config = None\nself._com_ports_list = None\nself._default_com_port = None", "errors = {}\nif self._com_ports_list is None:\n result = await self.hass.async_add_executor_job(scan_comports)\n self._com_ports_list, self._default_com_port = result\n if self._default_com_port is None:\n return se...
<|body_start_0|> self.config = None self._com_ports_list = None self._default_com_port = None <|end_body_0|> <|body_start_1|> errors = {} if self._com_ports_list is None: result = await self.hass.async_add_executor_job(scan_comports) self._com_ports_list,...
Handle a config flow for Aurora ABB PowerOne.
AuroraABBConfigFlow
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AuroraABBConfigFlow: """Handle a config flow for Aurora ABB PowerOne.""" def __init__(self): """Initialise the config flow.""" <|body_0|> async def async_step_user(self, user_input: dict[str, Any] | None=None) -> FlowResult: """Handle a flow initialised by the us...
stack_v2_sparse_classes_36k_train_006773
4,922
permissive
[ { "docstring": "Initialise the config flow.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Handle a flow initialised by the user.", "name": "async_step_user", "signature": "async def async_step_user(self, user_input: dict[str, Any] | None=None) -> FlowResult" ...
2
null
Implement the Python class `AuroraABBConfigFlow` described below. Class description: Handle a config flow for Aurora ABB PowerOne. Method signatures and docstrings: - def __init__(self): Initialise the config flow. - async def async_step_user(self, user_input: dict[str, Any] | None=None) -> FlowResult: Handle a flow ...
Implement the Python class `AuroraABBConfigFlow` described below. Class description: Handle a config flow for Aurora ABB PowerOne. Method signatures and docstrings: - def __init__(self): Initialise the config flow. - async def async_step_user(self, user_input: dict[str, Any] | None=None) -> FlowResult: Handle a flow ...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class AuroraABBConfigFlow: """Handle a config flow for Aurora ABB PowerOne.""" def __init__(self): """Initialise the config flow.""" <|body_0|> async def async_step_user(self, user_input: dict[str, Any] | None=None) -> FlowResult: """Handle a flow initialised by the us...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AuroraABBConfigFlow: """Handle a config flow for Aurora ABB PowerOne.""" def __init__(self): """Initialise the config flow.""" self.config = None self._com_ports_list = None self._default_com_port = None async def async_step_user(self, user_input: dict[str, Any] | Non...
the_stack_v2_python_sparse
homeassistant/components/aurora_abb_powerone/config_flow.py
home-assistant/core
train
35,501
c0e1b08ce0019bd16c1f94cbde79331a1ef3a130
[ "self.p = collections.defaultdict(list)\nfor i, w in enumerate(words):\n self.p[w].append(i)", "l1, l2 = (self.p[word1], self.p[word2])\np1, p2 = (0, 0)\nd = sys.maxsize\nwhile p1 < len(l1) and p2 < len(l2):\n d = min(d, abs(l1[p1] - l2[p2]))\n if l1[p1] < l2[p2]:\n p1 += 1\n else:\n p2 ...
<|body_start_0|> self.p = collections.defaultdict(list) for i, w in enumerate(words): self.p[w].append(i) <|end_body_0|> <|body_start_1|> l1, l2 = (self.p[word1], self.p[word2]) p1, p2 = (0, 0) d = sys.maxsize while p1 < len(l1) and p2 < len(l2): ...
WordDistance
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WordDistance: def __init__(self, words: List[str]): """Running Time: O(n) where n is the length of words.""" <|body_0|> def shortest(self, word1: str, word2: str) -> int: """Running Time: O(m) where m is the sum of appearance of word1 and word2 in the original words ...
stack_v2_sparse_classes_36k_train_006774
738
permissive
[ { "docstring": "Running Time: O(n) where n is the length of words.", "name": "__init__", "signature": "def __init__(self, words: List[str])" }, { "docstring": "Running Time: O(m) where m is the sum of appearance of word1 and word2 in the original words list.", "name": "shortest", "signat...
2
null
Implement the Python class `WordDistance` described below. Class description: Implement the WordDistance class. Method signatures and docstrings: - def __init__(self, words: List[str]): Running Time: O(n) where n is the length of words. - def shortest(self, word1: str, word2: str) -> int: Running Time: O(m) where m i...
Implement the Python class `WordDistance` described below. Class description: Implement the WordDistance class. Method signatures and docstrings: - def __init__(self, words: List[str]): Running Time: O(n) where n is the length of words. - def shortest(self, word1: str, word2: str) -> int: Running Time: O(m) where m i...
4a508a982b125a3a90ea893ae70863df7c99cc70
<|skeleton|> class WordDistance: def __init__(self, words: List[str]): """Running Time: O(n) where n is the length of words.""" <|body_0|> def shortest(self, word1: str, word2: str) -> int: """Running Time: O(m) where m is the sum of appearance of word1 and word2 in the original words ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WordDistance: def __init__(self, words: List[str]): """Running Time: O(n) where n is the length of words.""" self.p = collections.defaultdict(list) for i, w in enumerate(words): self.p[w].append(i) def shortest(self, word1: str, word2: str) -> int: """Running T...
the_stack_v2_python_sparse
solutions/244_shortest_word_distance_ii.py
YiqunPeng/leetcode_pro
train
0
dad213cb4430af087a0f19a090febe04be542649
[ "self.Wh = np.random.randn(i + h, h)\nself.Wy = np.random.randn(h, o)\nself.bh = np.zeros((1, h))\nself.by = np.zeros((1, o))", "concat = np.concatenate((h_prev, x_t), axis=1)\nh_next = np.tanh(concat @ self.Wh + self.bh)\nsoft = h_next @ self.Wy + self.by\ny = np.exp(soft) / np.sum(np.exp(soft), axis=1, keepdims...
<|body_start_0|> self.Wh = np.random.randn(i + h, h) self.Wy = np.random.randn(h, o) self.bh = np.zeros((1, h)) self.by = np.zeros((1, o)) <|end_body_0|> <|body_start_1|> concat = np.concatenate((h_prev, x_t), axis=1) h_next = np.tanh(concat @ self.Wh + self.bh) ...
Represents a cell of a simple RNN
RNNCell
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RNNCell: """Represents a cell of a simple RNN""" def __init__(self, i, h, o): """Class constructor""" <|body_0|> def forward(self, h_prev, x_t): """Performs forward propagation for one time step. Returns: h_next, y""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_006775
1,066
no_license
[ { "docstring": "Class constructor", "name": "__init__", "signature": "def __init__(self, i, h, o)" }, { "docstring": "Performs forward propagation for one time step. Returns: h_next, y", "name": "forward", "signature": "def forward(self, h_prev, x_t)" } ]
2
stack_v2_sparse_classes_30k_train_001356
Implement the Python class `RNNCell` described below. Class description: Represents a cell of a simple RNN Method signatures and docstrings: - def __init__(self, i, h, o): Class constructor - def forward(self, h_prev, x_t): Performs forward propagation for one time step. Returns: h_next, y
Implement the Python class `RNNCell` described below. Class description: Represents a cell of a simple RNN Method signatures and docstrings: - def __init__(self, i, h, o): Class constructor - def forward(self, h_prev, x_t): Performs forward propagation for one time step. Returns: h_next, y <|skeleton|> class RNNCell...
161e33b23d398d7d01ad0d7740b78dda3f27e787
<|skeleton|> class RNNCell: """Represents a cell of a simple RNN""" def __init__(self, i, h, o): """Class constructor""" <|body_0|> def forward(self, h_prev, x_t): """Performs forward propagation for one time step. Returns: h_next, y""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RNNCell: """Represents a cell of a simple RNN""" def __init__(self, i, h, o): """Class constructor""" self.Wh = np.random.randn(i + h, h) self.Wy = np.random.randn(h, o) self.bh = np.zeros((1, h)) self.by = np.zeros((1, o)) def forward(self, h_prev, x_t): ...
the_stack_v2_python_sparse
supervised_learning/0x0D-RNNs/0-rnn_cell.py
felipeserna/holbertonschool-machine_learning
train
0
8ce8a2ca00e9a3a64f0357fea66d4451de94b78a
[ "total, dir_infos = self.job_manager.get_job_list(offset=offset, limit=limit)\njob_infos = [self._dir_2_info(dir_info) for dir_info in dir_infos]\nreturn (total, job_infos)", "job = self.job_manager.get_job(train_id)\nif job is None:\n raise TrainJobNotExistError(train_id)\nreturn self._job_2_meta(job)", "in...
<|body_start_0|> total, dir_infos = self.job_manager.get_job_list(offset=offset, limit=limit) job_infos = [self._dir_2_info(dir_info) for dir_info in dir_infos] return (total, job_infos) <|end_body_0|> <|body_start_1|> job = self.job_manager.get_job(train_id) if job is None: ...
Explain job list encapsulator.
ExplainJobEncap
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "MIT", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExplainJobEncap: """Explain job list encapsulator.""" def query_explain_jobs(self, offset, limit): """Query explain job list. Args: offset (int): Page offset. limit (int): Maximum number of items to be returned. Returns: tuple[int, list[Dict]], total number of jobs and job list.""" ...
stack_v2_sparse_classes_36k_train_006776
3,607
permissive
[ { "docstring": "Query explain job list. Args: offset (int): Page offset. limit (int): Maximum number of items to be returned. Returns: tuple[int, list[Dict]], total number of jobs and job list.", "name": "query_explain_jobs", "signature": "def query_explain_jobs(self, offset, limit)" }, { "docst...
5
stack_v2_sparse_classes_30k_train_007669
Implement the Python class `ExplainJobEncap` described below. Class description: Explain job list encapsulator. Method signatures and docstrings: - def query_explain_jobs(self, offset, limit): Query explain job list. Args: offset (int): Page offset. limit (int): Maximum number of items to be returned. Returns: tuple[...
Implement the Python class `ExplainJobEncap` described below. Class description: Explain job list encapsulator. Method signatures and docstrings: - def query_explain_jobs(self, offset, limit): Query explain job list. Args: offset (int): Page offset. limit (int): Maximum number of items to be returned. Returns: tuple[...
a774d893fb2f21dbc3edb5cd89f9e6eec274ebf1
<|skeleton|> class ExplainJobEncap: """Explain job list encapsulator.""" def query_explain_jobs(self, offset, limit): """Query explain job list. Args: offset (int): Page offset. limit (int): Maximum number of items to be returned. Returns: tuple[int, list[Dict]], total number of jobs and job list.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ExplainJobEncap: """Explain job list encapsulator.""" def query_explain_jobs(self, offset, limit): """Query explain job list. Args: offset (int): Page offset. limit (int): Maximum number of items to be returned. Returns: tuple[int, list[Dict]], total number of jobs and job list.""" total,...
the_stack_v2_python_sparse
mindinsight/explainer/encapsulator/explain_job_encap.py
mindspore-ai/mindinsight
train
224
62c0f0c1b2372e504e976537e9269c7f09445f23
[ "res = []\nif not root:\n return res\n\ndef serialize_dfs(root):\n if not root:\n res.append('null')\n return\n res.append(root.val)\n serialize_dfs(root.left)\n serialize_dfs(root.right)\nserialize_dfs(root)\nreturn res", "if not data:\n return []\nindex = [0]\n\ndef deserialize_d...
<|body_start_0|> res = [] if not root: return res def serialize_dfs(root): if not root: res.append('null') return res.append(root.val) serialize_dfs(root.left) serialize_dfs(root.right) serialize...
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_006777
1,868
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
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. :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:...
a8518964df9dd04d9d06ada1f6814897d6451edb
<|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""" res = [] if not root: return res def serialize_dfs(root): if not root: res.append('null') return res....
the_stack_v2_python_sparse
bianryTree/37_serialize_deserialize_tree_hard.py
nadong/leetcode
train
0
2cfc6c9190fb3f10d5e62af4f94e85e5a5a431b8
[ "from agilo.scrum.workflow import rules\nfor member in dir(rules):\n if type(member) == type and issubclass(member, Component):\n member(self.env)", "debug(self, 'Called validate_rules(%s)' % ticket)\nfor r in self.rules:\n r.validate(ticket)" ]
<|body_start_0|> from agilo.scrum.workflow import rules for member in dir(rules): if type(member) == type and issubclass(member, Component): member(self.env) <|end_body_0|> <|body_start_1|> debug(self, 'Called validate_rules(%s)' % ticket) for r in self.rules...
Used to check that all the business rules are met before completing an operation. The RuleEngine has different domains where the rules applies and can be called from the specific object when is saved
RuleEngine
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RuleEngine: """Used to check that all the business rules are met before completing an operation. The RuleEngine has different domains where the rules applies and can be called from the specific object when is saved""" def __init__(self): """Make sure that all the rules are instantiat...
stack_v2_sparse_classes_36k_train_006778
2,197
no_license
[ { "docstring": "Make sure that all the rules are instantiated and registered", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Validates the give ticket against the registered rules. Every rule will be validated and has to take care of all the checks, return True or Fals...
2
null
Implement the Python class `RuleEngine` described below. Class description: Used to check that all the business rules are met before completing an operation. The RuleEngine has different domains where the rules applies and can be called from the specific object when is saved Method signatures and docstrings: - def __...
Implement the Python class `RuleEngine` described below. Class description: Used to check that all the business rules are met before completing an operation. The RuleEngine has different domains where the rules applies and can be called from the specific object when is saved Method signatures and docstrings: - def __...
1059b76554363004887b2a60953957f413b80bb0
<|skeleton|> class RuleEngine: """Used to check that all the business rules are met before completing an operation. The RuleEngine has different domains where the rules applies and can be called from the specific object when is saved""" def __init__(self): """Make sure that all the rules are instantiat...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RuleEngine: """Used to check that all the business rules are met before completing an operation. The RuleEngine has different domains where the rules applies and can be called from the specific object when is saved""" def __init__(self): """Make sure that all the rules are instantiated and regist...
the_stack_v2_python_sparse
agilo/scrum/workflow/api.py
djangsters/agilo
train
0
93c2a19630fc4ac0443167238cd4246ab2a8b58b
[ "super(CredentialDialog, self).__init__()\nself.askpassword = askpassword\nself.initUI(context)", "self.formlayout = QtWidgets.QFormLayout(self)\nself.username_le = QtWidgets.QLineEdit(self)\nself.username_le.returnPressed.connect(self.accept)\nif self.askpassword:\n self.formlayout.addRow('Användarnamn:', sel...
<|body_start_0|> super(CredentialDialog, self).__init__() self.askpassword = askpassword self.initUI(context) <|end_body_0|> <|body_start_1|> self.formlayout = QtWidgets.QFormLayout(self) self.username_le = QtWidgets.QLineEdit(self) self.username_le.returnPressed.connect...
Asks for credentials.
CredentialDialog
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CredentialDialog: """Asks for credentials.""" def __init__(self, context='', askpassword=True): """Creates a dialog that asks for username and optionally password.""" <|body_0|> def initUI(self, context): """Creates the UI widgets. context -- String to set as win...
stack_v2_sparse_classes_36k_train_006779
15,052
permissive
[ { "docstring": "Creates a dialog that asks for username and optionally password.", "name": "__init__", "signature": "def __init__(self, context='', askpassword=True)" }, { "docstring": "Creates the UI widgets. context -- String to set as windowtitle.", "name": "initUI", "signature": "def...
3
stack_v2_sparse_classes_30k_train_014756
Implement the Python class `CredentialDialog` described below. Class description: Asks for credentials. Method signatures and docstrings: - def __init__(self, context='', askpassword=True): Creates a dialog that asks for username and optionally password. - def initUI(self, context): Creates the UI widgets. context --...
Implement the Python class `CredentialDialog` described below. Class description: Asks for credentials. Method signatures and docstrings: - def __init__(self, context='', askpassword=True): Creates a dialog that asks for username and optionally password. - def initUI(self, context): Creates the UI widgets. context --...
b9aeca845d65d6de07b3dbef4dafccacc6a81cc4
<|skeleton|> class CredentialDialog: """Asks for credentials.""" def __init__(self, context='', askpassword=True): """Creates a dialog that asks for username and optionally password.""" <|body_0|> def initUI(self, context): """Creates the UI widgets. context -- String to set as win...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CredentialDialog: """Asks for credentials.""" def __init__(self, context='', askpassword=True): """Creates a dialog that asks for username and optionally password.""" super(CredentialDialog, self).__init__() self.askpassword = askpassword self.initUI(context) def init...
the_stack_v2_python_sparse
passwordsafe.py
Teknologforeningen/svaksvat
train
0
46850c8332c1f12a8f83b9b691ffedd863f2c29d
[ "try:\n return self.load_cached_obj('native.coordinates')\nexcept:\n pass\nds = self.dataset\nbase_date = ds['time'].attributes['units']\nbase_date = self.date_url_re.search(base_date).group()\ntimes = ds['time'][:].astype('timedelta64[h]') + np.array(base_date, 'datetime64')\nlons = podpac.crange(ds['lon'][0...
<|body_start_0|> try: return self.load_cached_obj('native.coordinates') except: pass ds = self.dataset base_date = ds['time'].attributes['units'] base_date = self.date_url_re.search(base_date).group() times = ds['time'][:].astype('timedelta64[h]') ...
Summary Attributes ---------- datakey : TYPE Description date_url_re : TYPE Description nan_vals : list Description product : TYPE Description
AirMOSS_Source
[ "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AirMOSS_Source: """Summary Attributes ---------- datakey : TYPE Description date_url_re : TYPE Description nan_vals : list Description product : TYPE Description""" def get_native_coordinates(self): """Summary Returns ------- TYPE Description""" <|body_0|> def get_data(s...
stack_v2_sparse_classes_36k_train_006780
5,736
permissive
[ { "docstring": "Summary Returns ------- TYPE Description", "name": "get_native_coordinates", "signature": "def get_native_coordinates(self)" }, { "docstring": "Summary Parameters ---------- coordinates : TYPE Description coordinates_index : TYPE Description Returns ------- TYPE Description", ...
2
stack_v2_sparse_classes_30k_train_003620
Implement the Python class `AirMOSS_Source` described below. Class description: Summary Attributes ---------- datakey : TYPE Description date_url_re : TYPE Description nan_vals : list Description product : TYPE Description Method signatures and docstrings: - def get_native_coordinates(self): Summary Returns ------- T...
Implement the Python class `AirMOSS_Source` described below. Class description: Summary Attributes ---------- datakey : TYPE Description date_url_re : TYPE Description nan_vals : list Description product : TYPE Description Method signatures and docstrings: - def get_native_coordinates(self): Summary Returns ------- T...
0a96a9b3726aee9bb6208244ae96ed685667e16c
<|skeleton|> class AirMOSS_Source: """Summary Attributes ---------- datakey : TYPE Description date_url_re : TYPE Description nan_vals : list Description product : TYPE Description""" def get_native_coordinates(self): """Summary Returns ------- TYPE Description""" <|body_0|> def get_data(s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AirMOSS_Source: """Summary Attributes ---------- datakey : TYPE Description date_url_re : TYPE Description nan_vals : list Description product : TYPE Description""" def get_native_coordinates(self): """Summary Returns ------- TYPE Description""" try: return self.load_cached_ob...
the_stack_v2_python_sparse
podpac/datalib/airmoss.py
ccuadrado/podpac
train
0
38f3a4f431116540174ad959300bfcbb07efd330
[ "self._source = source\nself._time_provider = time_provider\nself._storage_engine = storage_engine", "if slack_task.archived:\n return\nasync with self._storage_engine.get_unit_of_work() as uow:\n slack_task_collection = await uow.slack_task_collection_repository.load_by_id(slack_task.slack_task_collection_...
<|body_start_0|> self._source = source self._time_provider = time_provider self._storage_engine = storage_engine <|end_body_0|> <|body_start_1|> if slack_task.archived: return async with self._storage_engine.get_unit_of_work() as uow: slack_task_collectio...
Shared service for archiving a slack task.
SlackTaskArchiveService
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SlackTaskArchiveService: """Shared service for archiving a slack task.""" def __init__(self, source: EventSource, time_provider: TimeProvider, storage_engine: DomainStorageEngine) -> None: """Constructor.""" <|body_0|> async def do_it(self, progress_reporter: ProgressRep...
stack_v2_sparse_classes_36k_train_006781
2,869
permissive
[ { "docstring": "Constructor.", "name": "__init__", "signature": "def __init__(self, source: EventSource, time_provider: TimeProvider, storage_engine: DomainStorageEngine) -> None" }, { "docstring": "Execute the service's action.", "name": "do_it", "signature": "async def do_it(self, prog...
2
stack_v2_sparse_classes_30k_test_001160
Implement the Python class `SlackTaskArchiveService` described below. Class description: Shared service for archiving a slack task. Method signatures and docstrings: - def __init__(self, source: EventSource, time_provider: TimeProvider, storage_engine: DomainStorageEngine) -> None: Constructor. - async def do_it(self...
Implement the Python class `SlackTaskArchiveService` described below. Class description: Shared service for archiving a slack task. Method signatures and docstrings: - def __init__(self, source: EventSource, time_provider: TimeProvider, storage_engine: DomainStorageEngine) -> None: Constructor. - async def do_it(self...
911ecd560142a9b4e57498f2b090f9469a0718a1
<|skeleton|> class SlackTaskArchiveService: """Shared service for archiving a slack task.""" def __init__(self, source: EventSource, time_provider: TimeProvider, storage_engine: DomainStorageEngine) -> None: """Constructor.""" <|body_0|> async def do_it(self, progress_reporter: ProgressRep...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SlackTaskArchiveService: """Shared service for archiving a slack task.""" def __init__(self, source: EventSource, time_provider: TimeProvider, storage_engine: DomainStorageEngine) -> None: """Constructor.""" self._source = source self._time_provider = time_provider self._s...
the_stack_v2_python_sparse
src/core/jupiter/core/domain/push_integrations/slack/service/archive_service.py
horia141/jupiter
train
16
6f8b53ce430263f3a32bdc8fd6619c31e4562dea
[ "if cls.instance is None:\n cls.instance = super().__new__(cls)\nreturn cls.instance", "self.host = host\nself.username = username\nself.password = password\nself.database = database\nself.port = port\nself.maxconn = maxconn\nself.pool = Queue(maxconn)\ntry:\n for x in range(maxconn):\n conn = pymysq...
<|body_start_0|> if cls.instance is None: cls.instance = super().__new__(cls) return cls.instance <|end_body_0|> <|body_start_1|> self.host = host self.username = username self.password = password self.database = database self.port = port self...
定义MySQL操作类 使用单例模式 构建链接池
MySQL
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MySQL: """定义MySQL操作类 使用单例模式 构建链接池""" def __new__(cls, *args, **kwargs): """对new方法进行重写,实现单例模式 :param args: :param kwargs:""" <|body_0|> def __init__(self, host, username, password, database, port, maxconn=5): """初始化数据库信息并创建数据库链接池""" <|body_1|> def de_...
stack_v2_sparse_classes_36k_train_006782
2,664
no_license
[ { "docstring": "对new方法进行重写,实现单例模式 :param args: :param kwargs:", "name": "__new__", "signature": "def __new__(cls, *args, **kwargs)" }, { "docstring": "初始化数据库信息并创建数据库链接池", "name": "__init__", "signature": "def __init__(self, host, username, password, database, port, maxconn=5)" }, { ...
4
stack_v2_sparse_classes_30k_train_003479
Implement the Python class `MySQL` described below. Class description: 定义MySQL操作类 使用单例模式 构建链接池 Method signatures and docstrings: - def __new__(cls, *args, **kwargs): 对new方法进行重写,实现单例模式 :param args: :param kwargs: - def __init__(self, host, username, password, database, port, maxconn=5): 初始化数据库信息并创建数据库链接池 - def de_dupl...
Implement the Python class `MySQL` described below. Class description: 定义MySQL操作类 使用单例模式 构建链接池 Method signatures and docstrings: - def __new__(cls, *args, **kwargs): 对new方法进行重写,实现单例模式 :param args: :param kwargs: - def __init__(self, host, username, password, database, port, maxconn=5): 初始化数据库信息并创建数据库链接池 - def de_dupl...
6f138a7a4eaaa0892986be07232d68defeafaeb6
<|skeleton|> class MySQL: """定义MySQL操作类 使用单例模式 构建链接池""" def __new__(cls, *args, **kwargs): """对new方法进行重写,实现单例模式 :param args: :param kwargs:""" <|body_0|> def __init__(self, host, username, password, database, port, maxconn=5): """初始化数据库信息并创建数据库链接池""" <|body_1|> def de_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MySQL: """定义MySQL操作类 使用单例模式 构建链接池""" def __new__(cls, *args, **kwargs): """对new方法进行重写,实现单例模式 :param args: :param kwargs:""" if cls.instance is None: cls.instance = super().__new__(cls) return cls.instance def __init__(self, host, username, password, database, port...
the_stack_v2_python_sparse
DataBaseHandler/mysql_handle.py
zeze-ya/12306Train_Info_Spider
train
1
b963a97531d82a23abf230fccbda536070e0f719
[ "self.__class__.__name__ = 'Contingency' + measures.__class__.__name__\nfor k in dir(measures):\n if k.startswith('__'):\n continue\n v = getattr(measures, k)\n if not k.startswith('_'):\n v = self._make_contingency_fn(measures, v)\n setattr(self, k, v)", "def res(*contingency):\n ret...
<|body_start_0|> self.__class__.__name__ = 'Contingency' + measures.__class__.__name__ for k in dir(measures): if k.startswith('__'): continue v = getattr(measures, k) if not k.startswith('_'): v = self._make_contingency_fn(measures, v)...
Wraps NgramAssocMeasures classes such that the arguments of association measures are contingency table values rather than marginals.
ContingencyMeasures
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "CC-BY-NC-ND-3.0", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ContingencyMeasures: """Wraps NgramAssocMeasures classes such that the arguments of association measures are contingency table values rather than marginals.""" def __init__(self, measures): """Constructs a ContingencyMeasures given a NgramAssocMeasures class""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_006783
16,093
permissive
[ { "docstring": "Constructs a ContingencyMeasures given a NgramAssocMeasures class", "name": "__init__", "signature": "def __init__(self, measures)" }, { "docstring": "From an association measure function, produces a new function which accepts contingency table values as its arguments.", "nam...
2
stack_v2_sparse_classes_30k_train_016527
Implement the Python class `ContingencyMeasures` described below. Class description: Wraps NgramAssocMeasures classes such that the arguments of association measures are contingency table values rather than marginals. Method signatures and docstrings: - def __init__(self, measures): Constructs a ContingencyMeasures g...
Implement the Python class `ContingencyMeasures` described below. Class description: Wraps NgramAssocMeasures classes such that the arguments of association measures are contingency table values rather than marginals. Method signatures and docstrings: - def __init__(self, measures): Constructs a ContingencyMeasures g...
582e6e35f0e6c984b44ec49dcb8846d9c011d0a8
<|skeleton|> class ContingencyMeasures: """Wraps NgramAssocMeasures classes such that the arguments of association measures are contingency table values rather than marginals.""" def __init__(self, measures): """Constructs a ContingencyMeasures given a NgramAssocMeasures class""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ContingencyMeasures: """Wraps NgramAssocMeasures classes such that the arguments of association measures are contingency table values rather than marginals.""" def __init__(self, measures): """Constructs a ContingencyMeasures given a NgramAssocMeasures class""" self.__class__.__name__ = '...
the_stack_v2_python_sparse
nltk/metrics/association.py
nltk/nltk
train
11,860
adfd4be4369ecdcf001509ea48feebc1ffc3758d
[ "if data is None:\n if lambtha < 1:\n raise ValueError('lambtha must be a positive value')\n else:\n self.lambtha = float(lambtha)\nelif type(data) is not list:\n raise TypeError('data must be a list')\nelif len(data) < 2:\n raise ValueError('data must contain multiple values')\nelse:\n ...
<|body_start_0|> if data is None: if lambtha < 1: raise ValueError('lambtha must be a positive value') else: self.lambtha = float(lambtha) elif type(data) is not list: raise TypeError('data must be a list') elif len(data) < 2: ...
class that represents exponential distribution class constructor: def __init__(self, data=None, lambtha=1.) instance attributes: lambtha [float]: the expected number of occurances in a given time instance methods: def pdf(self, x): calculates PDF for given time period def cdf(self, x): calculates CDF for given time per...
Exponential
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Exponential: """class that represents exponential distribution class constructor: def __init__(self, data=None, lambtha=1.) instance attributes: lambtha [float]: the expected number of occurances in a given time instance methods: def pdf(self, x): calculates PDF for given time period def cdf(self...
stack_v2_sparse_classes_36k_train_006784
2,503
no_license
[ { "docstring": "class constructor parameters: data [list]: data to be used to estimate the distibution lambtha [float]: the expected number of occurances on a given time Sets the instance attribute lambtha as a float If data is not given: Use the given lambtha or raise ValueError if lambtha is not positive valu...
3
stack_v2_sparse_classes_30k_train_012897
Implement the Python class `Exponential` described below. Class description: class that represents exponential distribution class constructor: def __init__(self, data=None, lambtha=1.) instance attributes: lambtha [float]: the expected number of occurances in a given time instance methods: def pdf(self, x): calculates...
Implement the Python class `Exponential` described below. Class description: class that represents exponential distribution class constructor: def __init__(self, data=None, lambtha=1.) instance attributes: lambtha [float]: the expected number of occurances in a given time instance methods: def pdf(self, x): calculates...
8834b201ca84937365e4dcc0fac978656cdf5293
<|skeleton|> class Exponential: """class that represents exponential distribution class constructor: def __init__(self, data=None, lambtha=1.) instance attributes: lambtha [float]: the expected number of occurances in a given time instance methods: def pdf(self, x): calculates PDF for given time period def cdf(self...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Exponential: """class that represents exponential distribution class constructor: def __init__(self, data=None, lambtha=1.) instance attributes: lambtha [float]: the expected number of occurances in a given time instance methods: def pdf(self, x): calculates PDF for given time period def cdf(self, x): calcula...
the_stack_v2_python_sparse
math/0x03-probability/exponential.py
ejonakodra/holbertonschool-machine_learning-1
train
0
4aded413d52144df720fc507fc8cf8698e2df53b
[ "if value == 1:\n self._update_attribute(self.attributes_by_name['system_mode'].id, Thermostat.SystemMode.Heat)\n self._update_attribute(self.attributes_by_name['running_mode'].id, Thermostat.RunningMode.Heat)\n _LOGGER.debug('reported system_mode: heat')\nelse:\n self._update_attribute(self.attributes_...
<|body_start_0|> if value == 1: self._update_attribute(self.attributes_by_name['system_mode'].id, Thermostat.SystemMode.Heat) self._update_attribute(self.attributes_by_name['running_mode'].id, Thermostat.RunningMode.Heat) _LOGGER.debug('reported system_mode: heat') el...
Thermostat cluster.
ThermostatCluster
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ThermostatCluster: """Thermostat cluster.""" def system_mode_reported(self, value): """Handle reported system mode.""" <|body_0|> def map_attribute(self, attribute, value): """Map standardized attribute value to dict of manufacturer values.""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_006785
11,139
permissive
[ { "docstring": "Handle reported system mode.", "name": "system_mode_reported", "signature": "def system_mode_reported(self, value)" }, { "docstring": "Map standardized attribute value to dict of manufacturer values.", "name": "map_attribute", "signature": "def map_attribute(self, attribu...
2
null
Implement the Python class `ThermostatCluster` described below. Class description: Thermostat cluster. Method signatures and docstrings: - def system_mode_reported(self, value): Handle reported system mode. - def map_attribute(self, attribute, value): Map standardized attribute value to dict of manufacturer values.
Implement the Python class `ThermostatCluster` described below. Class description: Thermostat cluster. Method signatures and docstrings: - def system_mode_reported(self, value): Handle reported system mode. - def map_attribute(self, attribute, value): Map standardized attribute value to dict of manufacturer values. ...
84d02be7abde55a6cee80fa155f0cbbc20347c40
<|skeleton|> class ThermostatCluster: """Thermostat cluster.""" def system_mode_reported(self, value): """Handle reported system mode.""" <|body_0|> def map_attribute(self, attribute, value): """Map standardized attribute value to dict of manufacturer values.""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ThermostatCluster: """Thermostat cluster.""" def system_mode_reported(self, value): """Handle reported system mode.""" if value == 1: self._update_attribute(self.attributes_by_name['system_mode'].id, Thermostat.SystemMode.Heat) self._update_attribute(self.attribute...
the_stack_v2_python_sparse
zhaquirks/tuya/ts0601_trv_sas.py
Shulyaka/zha-device-handlers
train
1
ebd07dd0a6d3076593de2edd4ad9dd9d0dc7d891
[ "section = self.CONF_SECTION if section is None else section\nif section is None:\n raise AttributeError('A SpyderConfigurationAccessor must define a `CONF_SECTION` class attribute!')\nreturn CONF.get(section, option, default)", "section = self.CONF_SECTION if section is None else section\nif section is None:\...
<|body_start_0|> section = self.CONF_SECTION if section is None else section if section is None: raise AttributeError('A SpyderConfigurationAccessor must define a `CONF_SECTION` class attribute!') return CONF.get(section, option, default) <|end_body_0|> <|body_start_1|> sect...
Mixin used to access options stored in the Spyder configuration system.
SpyderConfigurationAccessor
[ "LGPL-2.0-or-later", "BSD-3-Clause", "LGPL-3.0-only", "LicenseRef-scancode-free-unknown", "LGPL-3.0-or-later", "LicenseRef-scancode-proprietary-license", "LGPL-2.1-or-later", "CC-BY-2.5", "CC-BY-4.0", "MIT", "LGPL-2.1-only", "CC-BY-3.0", "LicenseRef-scancode-unknown-license-reference", "OF...
stack_v2_sparse_python_classes_v1
<|skeleton|> class SpyderConfigurationAccessor: """Mixin used to access options stored in the Spyder configuration system.""" def get_conf(self, option: ConfigurationKey, default: Union[NoDefault, BasicTypes]=NoDefault, section: Optional[str]=None): """Get an option from the Spyder configuration system...
stack_v2_sparse_classes_36k_train_006786
9,488
permissive
[ { "docstring": "Get an option from the Spyder configuration system. Parameters ---------- option: ConfigurationKey Name/Tuple path of the option to get its value from. default: Union[NoDefault, BasicTypes] Fallback value to return if the option is not found on the configuration system. section: str Section in t...
4
stack_v2_sparse_classes_30k_train_018762
Implement the Python class `SpyderConfigurationAccessor` described below. Class description: Mixin used to access options stored in the Spyder configuration system. Method signatures and docstrings: - def get_conf(self, option: ConfigurationKey, default: Union[NoDefault, BasicTypes]=NoDefault, section: Optional[str]=...
Implement the Python class `SpyderConfigurationAccessor` described below. Class description: Mixin used to access options stored in the Spyder configuration system. Method signatures and docstrings: - def get_conf(self, option: ConfigurationKey, default: Union[NoDefault, BasicTypes]=NoDefault, section: Optional[str]=...
0b4929cef420ba6c625566e52200e959f3566f33
<|skeleton|> class SpyderConfigurationAccessor: """Mixin used to access options stored in the Spyder configuration system.""" def get_conf(self, option: ConfigurationKey, default: Union[NoDefault, BasicTypes]=NoDefault, section: Optional[str]=None): """Get an option from the Spyder configuration system...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SpyderConfigurationAccessor: """Mixin used to access options stored in the Spyder configuration system.""" def get_conf(self, option: ConfigurationKey, default: Union[NoDefault, BasicTypes]=NoDefault, section: Optional[str]=None): """Get an option from the Spyder configuration system. Parameters ...
the_stack_v2_python_sparse
spyder/api/config/mixins.py
juanis2112/spyder
train
1
2fb0f1d98471f905ee90db70b97835795a8ddce9
[ "cities_subscriptions = request.user.cities_subscriptions.filter(is_active=True)\ncontext = {'cities_subscriptions': cities_subscriptions}\nreturn render(request, self.template_name, context)", "subscription_pk = request.POST.get('subscription_pk', '')\nnext = request.POST.get('next', '')\nif subscription_pk:\n ...
<|body_start_0|> cities_subscriptions = request.user.cities_subscriptions.filter(is_active=True) context = {'cities_subscriptions': cities_subscriptions} return render(request, self.template_name, context) <|end_body_0|> <|body_start_1|> subscription_pk = request.POST.get('subscription_...
Manage cities' subscriptions
CitiesManagementView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CitiesManagementView: """Manage cities' subscriptions""" def get(self, request, *args, **kwargs): """GET request handler.""" <|body_0|> def post(self, request, *args, **kwargs): """POST request handler.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_006787
5,471
no_license
[ { "docstring": "GET request handler.", "name": "get", "signature": "def get(self, request, *args, **kwargs)" }, { "docstring": "POST request handler.", "name": "post", "signature": "def post(self, request, *args, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_011861
Implement the Python class `CitiesManagementView` described below. Class description: Manage cities' subscriptions Method signatures and docstrings: - def get(self, request, *args, **kwargs): GET request handler. - def post(self, request, *args, **kwargs): POST request handler.
Implement the Python class `CitiesManagementView` described below. Class description: Manage cities' subscriptions Method signatures and docstrings: - def get(self, request, *args, **kwargs): GET request handler. - def post(self, request, *args, **kwargs): POST request handler. <|skeleton|> class CitiesManagementVie...
b0702a8f7f60de6db9de7f712108e68d66f07f61
<|skeleton|> class CitiesManagementView: """Manage cities' subscriptions""" def get(self, request, *args, **kwargs): """GET request handler.""" <|body_0|> def post(self, request, *args, **kwargs): """POST request handler.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CitiesManagementView: """Manage cities' subscriptions""" def get(self, request, *args, **kwargs): """GET request handler.""" cities_subscriptions = request.user.cities_subscriptions.filter(is_active=True) context = {'cities_subscriptions': cities_subscriptions} return rend...
the_stack_v2_python_sparse
getdeal/apps/profiles/views.py
PankeshGupta/getdeal
train
0
099d098cfeef4209e750d9db6057d85f5358f72b
[ "parser.add_argument('user', metavar='USERNAME', help='User name for the owner of the sample.')\nparser.add_argument('sample_dir', metavar='SAMPLE_DIRECTORY', help='User name for the owner of the sample.')\nparser.add_argument('name', metavar='SAMPLE_NAME', help='Sample tag associated with sample.')\nparser.add_arg...
<|body_start_0|> parser.add_argument('user', metavar='USERNAME', help='User name for the owner of the sample.') parser.add_argument('sample_dir', metavar='SAMPLE_DIRECTORY', help='User name for the owner of the sample.') parser.add_argument('name', metavar='SAMPLE_NAME', help='Sample tag associa...
Insert the results of sample analysis into the database.
Command
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Command: """Insert the results of sample analysis into the database.""" def add_arguments(self, parser): """Command line arguements.""" <|body_0|> def handle(self, *args, **opts): """Insert the results of sample analysis into the database.""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_006788
4,597
no_license
[ { "docstring": "Command line arguements.", "name": "add_arguments", "signature": "def add_arguments(self, parser)" }, { "docstring": "Insert the results of sample analysis into the database.", "name": "handle", "signature": "def handle(self, *args, **opts)" }, { "docstring": "The...
3
stack_v2_sparse_classes_30k_train_008590
Implement the Python class `Command` described below. Class description: Insert the results of sample analysis into the database. Method signatures and docstrings: - def add_arguments(self, parser): Command line arguements. - def handle(self, *args, **opts): Insert the results of sample analysis into the database. - ...
Implement the Python class `Command` described below. Class description: Insert the results of sample analysis into the database. Method signatures and docstrings: - def add_arguments(self, parser): Command line arguements. - def handle(self, *args, **opts): Insert the results of sample analysis into the database. - ...
2c35ee47e131a74642e60fae6f1cc23561d8b1a6
<|skeleton|> class Command: """Insert the results of sample analysis into the database.""" def add_arguments(self, parser): """Command line arguements.""" <|body_0|> def handle(self, *args, **opts): """Insert the results of sample analysis into the database.""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Command: """Insert the results of sample analysis into the database.""" def add_arguments(self, parser): """Command line arguements.""" parser.add_argument('user', metavar='USERNAME', help='User name for the owner of the sample.') parser.add_argument('sample_dir', metavar='SAMPLE_...
the_stack_v2_python_sparse
sample/management/commands/insert_analysis_results.py
staphopia/staphopia-web
train
5
f63ca8fb02cb83cddd7128e4bba2463cc428e2b1
[ "length = len(matrix)\nif length == 0:\n return []\nres = []\nt = []\ncur = matrix[0]\nfor i in range(length):\n for l in matrix:\n t = [l[i]] + t\n res.append(t)\n t = []\nmatrix = res", "l = len(matrix)\nclcles = l // 2\npp = l - 1\nfor i in range(clcles):\n t = pp - i * 2\n for j in ra...
<|body_start_0|> length = len(matrix) if length == 0: return [] res = [] t = [] cur = matrix[0] for i in range(length): for l in matrix: t = [l[i]] + t res.append(t) t = [] matrix = res <|end_body_0|>...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def rotate1(self, matrix): """:type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead.""" <|body_0|> def rotate2(self, matrix): """:type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-...
stack_v2_sparse_classes_36k_train_006789
2,020
no_license
[ { "docstring": ":type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead.", "name": "rotate1", "signature": "def rotate1(self, matrix)" }, { "docstring": ":type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead.",...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rotate1(self, matrix): :type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead. - def rotate2(self, matrix): :type matrix: List[List...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rotate1(self, matrix): :type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead. - def rotate2(self, matrix): :type matrix: List[List...
e5b018493bbd12edcdcd0434f35d9c358106d391
<|skeleton|> class Solution: def rotate1(self, matrix): """:type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead.""" <|body_0|> def rotate2(self, matrix): """:type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def rotate1(self, matrix): """:type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead.""" length = len(matrix) if length == 0: return [] res = [] t = [] cur = matrix[0] for i in range(length...
the_stack_v2_python_sparse
py/leetcode/48.py
wfeng1991/learnpy
train
0
4e5125d6afee41d7e725caea9db5b258bbb7687e
[ "self.url = url\nself._content = None\nself.last_update = time.time()", "reload_time = 10\nnow = time.time()\nif not self._content or now - self.last_update > reload_time:\n print('Retrieving New Page...')\n self._content = urlopen(self.url).read()\n self.last_update = time.time()\nelse:\n print(\"Has...
<|body_start_0|> self.url = url self._content = None self.last_update = time.time() <|end_body_0|> <|body_start_1|> reload_time = 10 now = time.time() if not self._content or now - self.last_update > reload_time: print('Retrieving New Page...') se...
Cashin webpage
WebPage
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WebPage: """Cashin webpage""" def __init__(self, url): """Initializes web-page by url""" <|body_0|> def content(self): """Return content of web-page""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.url = url self._content = None ...
stack_v2_sparse_classes_36k_train_006790
776
no_license
[ { "docstring": "Initializes web-page by url", "name": "__init__", "signature": "def __init__(self, url)" }, { "docstring": "Return content of web-page", "name": "content", "signature": "def content(self)" } ]
2
null
Implement the Python class `WebPage` described below. Class description: Cashin webpage Method signatures and docstrings: - def __init__(self, url): Initializes web-page by url - def content(self): Return content of web-page
Implement the Python class `WebPage` described below. Class description: Cashin webpage Method signatures and docstrings: - def __init__(self, url): Initializes web-page by url - def content(self): Return content of web-page <|skeleton|> class WebPage: """Cashin webpage""" def __init__(self, url): "...
1837d3234e5b4b5d46cd264bf4a0c4da75bfc3d2
<|skeleton|> class WebPage: """Cashin webpage""" def __init__(self, url): """Initializes web-page by url""" <|body_0|> def content(self): """Return content of web-page""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WebPage: """Cashin webpage""" def __init__(self, url): """Initializes web-page by url""" self.url = url self._content = None self.last_update = time.time() def content(self): """Return content of web-page""" reload_time = 10 now = time.time() ...
the_stack_v2_python_sparse
lab07-cachingWebpage-scalingZipedImage/cache-webpage/cashe_webpage.py
7ss8n/ProgrammingBasics2-Python
train
0
6e486e6f1f0e0da64d4c7fc0d68b64758036dfd2
[ "msg_info = dict()\nmsg_info['raw_message'] = line\nmatch = self._LINE_RE.search(line)\nif match:\n msg_info.update(match.groupdict())\n try:\n stamp = match.group('timestamp')\n msg_info['datetime'] = datetime.strptime(stamp[0:23] + stamp[24:26], self.time_format + ' %z')\n except:\n ...
<|body_start_0|> msg_info = dict() msg_info['raw_message'] = line match = self._LINE_RE.search(line) if match: msg_info.update(match.groupdict()) try: stamp = match.group('timestamp') msg_info['datetime'] = datetime.strptime(stamp[0...
Reads the OSA dispatcher log. Based on the ``LogFileOutput`` class. .. note:: Please refer to its super-class :class:`insights.core.LogFileOutput` Works a bit like the XMLRPC log but the IP address always seems to be ``0.0.0.0`` and the module is always 'osad' - it's more like what produced the log. Sample log data:: 2...
OSADispatcherLog
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OSADispatcherLog: """Reads the OSA dispatcher log. Based on the ``LogFileOutput`` class. .. note:: Please refer to its super-class :class:`insights.core.LogFileOutput` Works a bit like the XMLRPC log but the IP address always seems to be ``0.0.0.0`` and the module is always 'osad' - it's more lik...
stack_v2_sparse_classes_36k_train_006791
4,166
permissive
[ { "docstring": "Parse a log line using the XMLRPC regular expression into a dict. All data will be in fields, and the raw log line is stored in 'raw_message'. This also attempts to convert the timestamp given into a datetime object; if it can't convert it, then you don't get a 'datetime' key in the line's dict....
2
null
Implement the Python class `OSADispatcherLog` described below. Class description: Reads the OSA dispatcher log. Based on the ``LogFileOutput`` class. .. note:: Please refer to its super-class :class:`insights.core.LogFileOutput` Works a bit like the XMLRPC log but the IP address always seems to be ``0.0.0.0`` and the ...
Implement the Python class `OSADispatcherLog` described below. Class description: Reads the OSA dispatcher log. Based on the ``LogFileOutput`` class. .. note:: Please refer to its super-class :class:`insights.core.LogFileOutput` Works a bit like the XMLRPC log but the IP address always seems to be ``0.0.0.0`` and the ...
b0ea07fc3f4dd8801b505fe70e9b36e628152c4a
<|skeleton|> class OSADispatcherLog: """Reads the OSA dispatcher log. Based on the ``LogFileOutput`` class. .. note:: Please refer to its super-class :class:`insights.core.LogFileOutput` Works a bit like the XMLRPC log but the IP address always seems to be ``0.0.0.0`` and the module is always 'osad' - it's more lik...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OSADispatcherLog: """Reads the OSA dispatcher log. Based on the ``LogFileOutput`` class. .. note:: Please refer to its super-class :class:`insights.core.LogFileOutput` Works a bit like the XMLRPC log but the IP address always seems to be ``0.0.0.0`` and the module is always 'osad' - it's more like what produc...
the_stack_v2_python_sparse
insights/parsers/osa_dispatcher_log.py
RedHatInsights/insights-core
train
144
dbfa531f3ea253d4b9fe8cbf7b1da0c9e2bd7f93
[ "known_pulsars = np.recfromcsv(KNOWNPSR_FILENM, delimiter=';', comments='#', usecols=(1, 2, 3, 4, 5))\nself.known_names = known_pulsars['name']\nself.known_ras = known_pulsars['rajd']\nself.known_decs = known_pulsars['decjd']\nself.known_dms = known_pulsars['dm']", "dm = cand.info['dm']\nra = cand.info['raj_deg']...
<|body_start_0|> known_pulsars = np.recfromcsv(KNOWNPSR_FILENM, delimiter=';', comments='#', usecols=(1, 2, 3, 4, 5)) self.known_names = known_pulsars['name'] self.known_ras = known_pulsars['rajd'] self.known_decs = known_pulsars['decjd'] self.known_dms = known_pulsars['dm'] <|en...
KnownPulsarRater
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KnownPulsarRater: def _setup(self): """A setup method to be called when the Rater is initialised Inputs: None Outputs: None""" <|body_0|> def _compute_rating(self, cand): """Return a rating for the candidate. The rating value encodes how close the candidate's positio...
stack_v2_sparse_classes_36k_train_006792
2,809
no_license
[ { "docstring": "A setup method to be called when the Rater is initialised Inputs: None Outputs: None", "name": "_setup", "signature": "def _setup(self)" }, { "docstring": "Return a rating for the candidate. The rating value encodes how close the candidate's position and DM are to that of a known...
2
stack_v2_sparse_classes_30k_train_020080
Implement the Python class `KnownPulsarRater` described below. Class description: Implement the KnownPulsarRater class. Method signatures and docstrings: - def _setup(self): A setup method to be called when the Rater is initialised Inputs: None Outputs: None - def _compute_rating(self, cand): Return a rating for the ...
Implement the Python class `KnownPulsarRater` described below. Class description: Implement the KnownPulsarRater class. Method signatures and docstrings: - def _setup(self): A setup method to be called when the Rater is initialised Inputs: None Outputs: None - def _compute_rating(self, cand): Return a rating for the ...
e81c4926fbe5e4da2e923b10747bf3b844715ced
<|skeleton|> class KnownPulsarRater: def _setup(self): """A setup method to be called when the Rater is initialised Inputs: None Outputs: None""" <|body_0|> def _compute_rating(self, cand): """Return a rating for the candidate. The rating value encodes how close the candidate's positio...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KnownPulsarRater: def _setup(self): """A setup method to be called when the Rater is initialised Inputs: None Outputs: None""" known_pulsars = np.recfromcsv(KNOWNPSR_FILENM, delimiter=';', comments='#', usecols=(1, 2, 3, 4, 5)) self.known_names = known_pulsars['name'] self.know...
the_stack_v2_python_sparse
pipeline/lib/python/sp_raters/known_pulsar.py
ryanslynch/GBNCC-search
train
2
bbab6ed2284f420c0b1e85218b76b3b8863bd97d
[ "NonlinearProblem.__init__(self)\nself.bcs = bcs\nself.state = state\nu = state['u']\nV = u.function_space()\nv = TestFunction(V)\ndu = TrialFunction(V)\nself.residual = derivative(energy, u, v)\nself.jacobian = derivative(self.residual, u, du)", "assemble(self.residual, tensor=b)\nfor bc in self.bcs:\n bc.app...
<|body_start_0|> NonlinearProblem.__init__(self) self.bcs = bcs self.state = state u = state['u'] V = u.function_space() v = TestFunction(V) du = TrialFunction(V) self.residual = derivative(energy, u, v) self.jacobian = derivative(self.residual, u,...
docstring for ElastcitityProblem
ElasticityProblem
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ElasticityProblem: """docstring for ElastcitityProblem""" def __init__(self, energy, state, bcs): """Initialises the elasticity problem. Arguments: * energy * state * boundary conditions""" <|body_0|> def F(self, b, x): """Compute F at current point x. This funct...
stack_v2_sparse_classes_36k_train_006793
13,772
permissive
[ { "docstring": "Initialises the elasticity problem. Arguments: * energy * state * boundary conditions", "name": "__init__", "signature": "def __init__(self, energy, state, bcs)" }, { "docstring": "Compute F at current point x. This function is called at each interation of the solver.", "name...
3
stack_v2_sparse_classes_30k_train_018950
Implement the Python class `ElasticityProblem` described below. Class description: docstring for ElastcitityProblem Method signatures and docstrings: - def __init__(self, energy, state, bcs): Initialises the elasticity problem. Arguments: * energy * state * boundary conditions - def F(self, b, x): Compute F at curren...
Implement the Python class `ElasticityProblem` described below. Class description: docstring for ElastcitityProblem Method signatures and docstrings: - def __init__(self, energy, state, bcs): Initialises the elasticity problem. Arguments: * energy * state * boundary conditions - def F(self, b, x): Compute F at curren...
9a82bf40742a9b16122b7a476ad8aec65fe22539
<|skeleton|> class ElasticityProblem: """docstring for ElastcitityProblem""" def __init__(self, energy, state, bcs): """Initialises the elasticity problem. Arguments: * energy * state * boundary conditions""" <|body_0|> def F(self, b, x): """Compute F at current point x. This funct...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ElasticityProblem: """docstring for ElastcitityProblem""" def __init__(self, energy, state, bcs): """Initialises the elasticity problem. Arguments: * energy * state * boundary conditions""" NonlinearProblem.__init__(self) self.bcs = bcs self.state = state u = state...
the_stack_v2_python_sparse
src/solvers.py
kumiori/stability-bifurcation
train
1
a764b0131e3533b74a24a52798018960a73cb851
[ "RAMSTKDataModel.__init__(self, dao)\nself.dtm_site_options = SiteOptionsDataModel(site_dao)\nself.dtm_program_options = ProgramOptionsDataModel(dao)\nself.site_options = None\nself.program_options = None", "_site = kwargs['site']\n_program = kwargs['program']\nif _site:\n self.site_options = self.dtm_site_opt...
<|body_start_0|> RAMSTKDataModel.__init__(self, dao) self.dtm_site_options = SiteOptionsDataModel(site_dao) self.dtm_program_options = ProgramOptionsDataModel(dao) self.site_options = None self.program_options = None <|end_body_0|> <|body_start_1|> _site = kwargs['site']...
Contains the attributes and methods of an Options data model.
OptionsDataModel
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OptionsDataModel: """Contains the attributes and methods of an Options data model.""" def __init__(self, dao, site_dao): """Initialize an Options data model instance. :param dao: the data access object for communicating with the RAMSTK Program database. :type dao: :class:`ramstk.dao....
stack_v2_sparse_classes_36k_train_006794
6,635
permissive
[ { "docstring": "Initialize an Options data model instance. :param dao: the data access object for communicating with the RAMSTK Program database. :type dao: :class:`ramstk.dao.DAO.DAO`", "name": "__init__", "signature": "def __init__(self, dao, site_dao)" }, { "docstring": "Retrieve Options from...
3
stack_v2_sparse_classes_30k_train_019430
Implement the Python class `OptionsDataModel` described below. Class description: Contains the attributes and methods of an Options data model. Method signatures and docstrings: - def __init__(self, dao, site_dao): Initialize an Options data model instance. :param dao: the data access object for communicating with th...
Implement the Python class `OptionsDataModel` described below. Class description: Contains the attributes and methods of an Options data model. Method signatures and docstrings: - def __init__(self, dao, site_dao): Initialize an Options data model instance. :param dao: the data access object for communicating with th...
488ffed8b842399ddcae93007de6c6f1dda23d05
<|skeleton|> class OptionsDataModel: """Contains the attributes and methods of an Options data model.""" def __init__(self, dao, site_dao): """Initialize an Options data model instance. :param dao: the data access object for communicating with the RAMSTK Program database. :type dao: :class:`ramstk.dao....
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OptionsDataModel: """Contains the attributes and methods of an Options data model.""" def __init__(self, dao, site_dao): """Initialize an Options data model instance. :param dao: the data access object for communicating with the RAMSTK Program database. :type dao: :class:`ramstk.dao.DAO.DAO`""" ...
the_stack_v2_python_sparse
src/ramstk/modules/options/Model.py
JmiXIII/ramstk
train
0
a46c009c543e5be55ab11710f479c242db23127c
[ "def app_fn1(request):\n return str(request.params.get('foo'))\napp = makeapp({'': app_fn1})\nr = simulate_post(app, '/', {'foo': 'some data'})\nself.assertEqual(r.status, u'200 OK')\nself.assertEqual(dict(r.headers)[u'Content-Type'], u'text/plain')\nself.assertEqual(r.body, u\"['some data']\")", "@wsgiwapi.js...
<|body_start_0|> def app_fn1(request): return str(request.params.get('foo')) app = makeapp({'': app_fn1}) r = simulate_post(app, '/', {'foo': 'some data'}) self.assertEqual(r.status, u'200 OK') self.assertEqual(dict(r.headers)[u'Content-Type'], u'text/plain') ...
Test validation support.
PostdataTest
[ "BSD-3-Clause", "MIT", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PostdataTest: """Test validation support.""" def test_default(self): """Test basic use of the default postdata handler.""" <|body_0|> def test_json(self): """Test use of the default postdata handler with JSON body.""" <|body_1|> def test_stream(self)...
stack_v2_sparse_classes_36k_train_006795
2,940
permissive
[ { "docstring": "Test basic use of the default postdata handler.", "name": "test_default", "signature": "def test_default(self)" }, { "docstring": "Test use of the default postdata handler with JSON body.", "name": "test_json", "signature": "def test_json(self)" }, { "docstring": ...
3
stack_v2_sparse_classes_30k_train_006983
Implement the Python class `PostdataTest` described below. Class description: Test validation support. Method signatures and docstrings: - def test_default(self): Test basic use of the default postdata handler. - def test_json(self): Test use of the default postdata handler with JSON body. - def test_stream(self): Te...
Implement the Python class `PostdataTest` described below. Class description: Test validation support. Method signatures and docstrings: - def test_default(self): Test basic use of the default postdata handler. - def test_json(self): Test use of the default postdata handler with JSON body. - def test_stream(self): Te...
040acfcc9fa724707a88e685dcd092e0606d05a3
<|skeleton|> class PostdataTest: """Test validation support.""" def test_default(self): """Test basic use of the default postdata handler.""" <|body_0|> def test_json(self): """Test use of the default postdata handler with JSON body.""" <|body_1|> def test_stream(self)...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PostdataTest: """Test validation support.""" def test_default(self): """Test basic use of the default postdata handler.""" def app_fn1(request): return str(request.params.get('foo')) app = makeapp({'': app_fn1}) r = simulate_post(app, '/', {'foo': 'some data'})...
the_stack_v2_python_sparse
wsgiwapi/unittests/postdata.py
rboulton/wsgiwapi
train
0
3f590307c4e50d1541efba93db3325a8e347bd33
[ "self.instance_keypair = self.os_conn.create_key(key_name='instancekey')\nzone = self.os_conn.nova.availability_zones.find(zoneName='nova')\nvm_hosts = zone.hosts.keys()[:2]\nself.setup_rules_for_default_sec_group()\nrouter = self.os_conn.create_router(name='router01')\nfor i, hostname in enumerate(vm_hosts, 1):\n ...
<|body_start_0|> self.instance_keypair = self.os_conn.create_key(key_name='instancekey') zone = self.os_conn.nova.availability_zones.find(zoneName='nova') vm_hosts = zone.hosts.keys()[:2] self.setup_rules_for_default_sec_group() router = self.os_conn.create_router(name='router01'...
Check restarts of openvswitch-agents.
TestOVSRestartTwoVms
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestOVSRestartTwoVms: """Check restarts of openvswitch-agents.""" def _prepare_openstack(self): """Prepare OpenStack for scenarios run Steps: 1. Update default security group 2. Create router01, create networks net01: net01__subnet, 192.168.1.0/24, net02: net02__subnet, 192.168.2.0/2...
stack_v2_sparse_classes_36k_train_006796
41,546
no_license
[ { "docstring": "Prepare OpenStack for scenarios run Steps: 1. Update default security group 2. Create router01, create networks net01: net01__subnet, 192.168.1.0/24, net02: net02__subnet, 192.168.2.0/24 and attach them to router01. 3. Launch vm1 in net01 network and vm2 in net02 network on different computes 4....
3
stack_v2_sparse_classes_30k_train_020282
Implement the Python class `TestOVSRestartTwoVms` described below. Class description: Check restarts of openvswitch-agents. Method signatures and docstrings: - def _prepare_openstack(self): Prepare OpenStack for scenarios run Steps: 1. Update default security group 2. Create router01, create networks net01: net01__su...
Implement the Python class `TestOVSRestartTwoVms` described below. Class description: Check restarts of openvswitch-agents. Method signatures and docstrings: - def _prepare_openstack(self): Prepare OpenStack for scenarios run Steps: 1. Update default security group 2. Create router01, create networks net01: net01__su...
8aced2855b78b5f123195d188c80e27b43888a2e
<|skeleton|> class TestOVSRestartTwoVms: """Check restarts of openvswitch-agents.""" def _prepare_openstack(self): """Prepare OpenStack for scenarios run Steps: 1. Update default security group 2. Create router01, create networks net01: net01__subnet, 192.168.1.0/24, net02: net02__subnet, 192.168.2.0/2...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestOVSRestartTwoVms: """Check restarts of openvswitch-agents.""" def _prepare_openstack(self): """Prepare OpenStack for scenarios run Steps: 1. Update default security group 2. Create router01, create networks net01: net01__subnet, 192.168.1.0/24, net02: net02__subnet, 192.168.2.0/24 and attach ...
the_stack_v2_python_sparse
mos_tests/neutron/python_tests/test_ovs_restart.py
Mirantis/mos-integration-tests
train
16
b92760b21a9131bf40847b2a8448974340dad85e
[ "tensors = arg\nif args:\n tensors = (arg,) + args\nelse:\n tensors = arg\nflattened_tensors = nest.flatten(tensors)\nflattened_values = []\nfor t in flattened_tensors:\n if isinstance(t, ops.Tensor):\n flattened_values.append(t)\n elif isinstance(t, sparse_tensor.SparseTensor):\n flattene...
<|body_start_0|> tensors = arg if args: tensors = (arg,) + args else: tensors = arg flattened_tensors = nest.flatten(tensors) flattened_values = [] for t in flattened_tensors: if isinstance(t, ops.Tensor): flattened_valu...
Keys for different tensor kinds.
TensorKinds
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TensorKinds: """Keys for different tensor kinds.""" def normalize(cls, arg, *args): """Normalize structure into list of tensors.""" <|body_0|> def denormalize(cls, structure, flatten_structure, tensors): """Denormalize structure from list of tensors.""" <...
stack_v2_sparse_classes_36k_train_006797
7,164
permissive
[ { "docstring": "Normalize structure into list of tensors.", "name": "normalize", "signature": "def normalize(cls, arg, *args)" }, { "docstring": "Denormalize structure from list of tensors.", "name": "denormalize", "signature": "def denormalize(cls, structure, flatten_structure, tensors)...
2
stack_v2_sparse_classes_30k_train_002829
Implement the Python class `TensorKinds` described below. Class description: Keys for different tensor kinds. Method signatures and docstrings: - def normalize(cls, arg, *args): Normalize structure into list of tensors. - def denormalize(cls, structure, flatten_structure, tensors): Denormalize structure from list of ...
Implement the Python class `TensorKinds` described below. Class description: Keys for different tensor kinds. Method signatures and docstrings: - def normalize(cls, arg, *args): Normalize structure into list of tensors. - def denormalize(cls, structure, flatten_structure, tensors): Denormalize structure from list of ...
4486ba138515a1dbdb6f7d542d7ad23a27476524
<|skeleton|> class TensorKinds: """Keys for different tensor kinds.""" def normalize(cls, arg, *args): """Normalize structure into list of tensors.""" <|body_0|> def denormalize(cls, structure, flatten_structure, tensors): """Denormalize structure from list of tensors.""" <...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TensorKinds: """Keys for different tensor kinds.""" def normalize(cls, arg, *args): """Normalize structure into list of tensors.""" tensors = arg if args: tensors = (arg,) + args else: tensors = arg flattened_tensors = nest.flatten(tensors) ...
the_stack_v2_python_sparse
hybridbackend/tensorflow/framework/ops.py
DeepRec-AI/HybridBackend
train
10
52918d175d5bb55d37edbc3a91a9ec1a61768dc1
[ "if toggled and (not callable(toggled)):\n toggled = lambda value: None\nif toggled is not None:\n if section is None and option is not None:\n section = self.CONF_SECTION\ntoolbutton = create_toolbutton(self, text=text, shortcut=None, icon=icon, tip=tip, toggled=toggled, triggered=triggered, autoraise...
<|body_start_0|> if toggled and (not callable(toggled)): toggled = lambda value: None if toggled is not None: if section is None and option is not None: section = self.CONF_SECTION toolbutton = create_toolbutton(self, text=text, shortcut=None, icon=icon, t...
Provide methods to create, add and get toolbuttons.
SpyderToolButtonMixin
[ "LGPL-2.0-or-later", "BSD-3-Clause", "LGPL-3.0-only", "LicenseRef-scancode-free-unknown", "LGPL-3.0-or-later", "LicenseRef-scancode-proprietary-license", "LGPL-2.1-or-later", "CC-BY-2.5", "CC-BY-4.0", "MIT", "LGPL-2.1-only", "CC-BY-3.0", "LicenseRef-scancode-unknown-license-reference", "OF...
stack_v2_sparse_python_classes_v1
<|skeleton|> class SpyderToolButtonMixin: """Provide methods to create, add and get toolbuttons.""" def create_toolbutton(self, name, text=None, icon=None, tip=None, toggled=None, triggered=None, autoraise=True, text_beside_icon=False, section=None, option=None): """Create a Spyder toolbutton.""" ...
stack_v2_sparse_classes_36k_train_006798
20,997
permissive
[ { "docstring": "Create a Spyder toolbutton.", "name": "create_toolbutton", "signature": "def create_toolbutton(self, name, text=None, icon=None, tip=None, toggled=None, triggered=None, autoraise=True, text_beside_icon=False, section=None, option=None)" }, { "docstring": "Return toolbutton by nam...
3
stack_v2_sparse_classes_30k_train_020543
Implement the Python class `SpyderToolButtonMixin` described below. Class description: Provide methods to create, add and get toolbuttons. Method signatures and docstrings: - def create_toolbutton(self, name, text=None, icon=None, tip=None, toggled=None, triggered=None, autoraise=True, text_beside_icon=False, section...
Implement the Python class `SpyderToolButtonMixin` described below. Class description: Provide methods to create, add and get toolbuttons. Method signatures and docstrings: - def create_toolbutton(self, name, text=None, icon=None, tip=None, toggled=None, triggered=None, autoraise=True, text_beside_icon=False, section...
0b4929cef420ba6c625566e52200e959f3566f33
<|skeleton|> class SpyderToolButtonMixin: """Provide methods to create, add and get toolbuttons.""" def create_toolbutton(self, name, text=None, icon=None, tip=None, toggled=None, triggered=None, autoraise=True, text_beside_icon=False, section=None, option=None): """Create a Spyder toolbutton.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SpyderToolButtonMixin: """Provide methods to create, add and get toolbuttons.""" def create_toolbutton(self, name, text=None, icon=None, tip=None, toggled=None, triggered=None, autoraise=True, text_beside_icon=False, section=None, option=None): """Create a Spyder toolbutton.""" if toggled...
the_stack_v2_python_sparse
spyder/api/widgets/mixins.py
juanis2112/spyder
train
1
c4dfe1a8ae4eb825f7659bfcf00fe9cc734c6494
[ "self.ps = PastaSauce()\nself.desired_capabilities['name'] = self.id()\nself.user = None", "if not LOCAL_RUN:\n self.ps.update_job(job_id=str(self.user.driver.session_id), **self.ps.test_updates)\ntry:\n self.user.delete()\nexcept:\n pass", "self.ps.test_updates['name'] = 't1.38.001' + inspect.currentf...
<|body_start_0|> self.ps = PastaSauce() self.desired_capabilities['name'] = self.id() self.user = None <|end_body_0|> <|body_start_1|> if not LOCAL_RUN: self.ps.update_job(job_id=str(self.user.driver.session_id), **self.ps.test_updates) try: self.user.del...
T1.38 - Choose Course.
TestChooseCourse
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestChooseCourse: """T1.38 - Choose Course.""" def setUp(self): """Pretest settings.""" <|body_0|> def tearDown(self): """Test destructor.""" <|body_1|> def test_student_select_a_course_8254(self): """Select a course. Steps: Click on a Tutor ...
stack_v2_sparse_classes_36k_train_006799
6,295
no_license
[ { "docstring": "Pretest settings.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test destructor.", "name": "tearDown", "signature": "def tearDown(self)" }, { "docstring": "Select a course. Steps: Click on a Tutor course name Expected Result: The user select...
5
stack_v2_sparse_classes_30k_train_019227
Implement the Python class `TestChooseCourse` described below. Class description: T1.38 - Choose Course. Method signatures and docstrings: - def setUp(self): Pretest settings. - def tearDown(self): Test destructor. - def test_student_select_a_course_8254(self): Select a course. Steps: Click on a Tutor course name Exp...
Implement the Python class `TestChooseCourse` described below. Class description: T1.38 - Choose Course. Method signatures and docstrings: - def setUp(self): Pretest settings. - def tearDown(self): Test destructor. - def test_student_select_a_course_8254(self): Select a course. Steps: Click on a Tutor course name Exp...
39751799858ac30df90760b8bb753d338e8edc46
<|skeleton|> class TestChooseCourse: """T1.38 - Choose Course.""" def setUp(self): """Pretest settings.""" <|body_0|> def tearDown(self): """Test destructor.""" <|body_1|> def test_student_select_a_course_8254(self): """Select a course. Steps: Click on a Tutor ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestChooseCourse: """T1.38 - Choose Course.""" def setUp(self): """Pretest settings.""" self.ps = PastaSauce() self.desired_capabilities['name'] = self.id() self.user = None def tearDown(self): """Test destructor.""" if not LOCAL_RUN: self....
the_stack_v2_python_sparse
tutor/OldTests/test_t1_38_ChooseCourse.py
openstax/test-automation
train
4