code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class ExpenseListAPIView(ListAPIView): <NEW_LINE> <INDENT> serializer_class = ReceiptSerializer <NEW_LINE> def get(self, request, *args, **kwargs): <NEW_LINE> <INDENT> month = datetime.datetime.now().month <NEW_LINE> year = datetime.datetime.now().year <NEW_LINE> data_d = {} <NEW_LINE> for e in Envelope.objects.filter(... | List all receipts for current user. | 62598ee44f6381625f1987ef |
class W33(VOTableChangeWarning): <NEW_LINE> <INDENT> message_template = "Column name '%s' renamed to '%s' to ensure uniqueness" <NEW_LINE> default_args = ('x', 'x_2') | Each field in a table must have a unique name. If two or more
fields have the same name, some will be renamed to ensure that all
names are unique.
**References**: `1.1
<http://www.ivoa.net/Documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:name>`__,
`1.2
<http://www.ivoa.net/Documents/VOTable/20091130/REC-V... | 62598ee423849d37ff84f71b |
class TeamResource(RestResource): <NEW_LINE> <INDENT> include_resources = {'division': DivisionResource} <NEW_LINE> def get_api_name(self): <NEW_LINE> <INDENT> return 'teams' | `/api/teams/` --- Teams | 62598ee4be8e80087fbbd6b3 |
class TestXmlNs0StringAttributeTypeImpl(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def tearDown(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def testXmlNs0StringAttributeTypeImpl(self): <NEW_LINE> <INDENT> pass | XmlNs0StringAttributeTypeImpl unit test stubs | 62598ee491f36d47f22301d6 |
class WideResNet(nn.Module): <NEW_LINE> <INDENT> def __init__(self, cfg): <NEW_LINE> <INDENT> super(WideResNet, self).__init__() <NEW_LINE> self.in_planes = 16 <NEW_LINE> assert ((cfg.num_layers - 4) % 6 == 0), 'Wide-resnet depth should be 6n+4' <NEW_LINE> N = (cfg.num_layers - 4) / 6 <NEW_LINE> k = cfg.widening_factor... | WRN-n-k (n: number of layers; k: widening factor | 62598ee4796e427e5384cdfe |
class ITextPlainMime(IMime): <NEW_LINE> <INDENT> pass | Interface for Plain Text mime type. | 62598ee43d592f4c4edb955b |
class TextToSpeechStub(object): <NEW_LINE> <INDENT> def __init__(self, channel): <NEW_LINE> <INDENT> self.ListVoices = channel.unary_unary( '/tinkoff.cloud.tts.v1.TextToSpeech/ListVoices', request_serializer=tinkoff_dot_cloud_dot_tts_dot_v1_dot_tts__pb2.ListVoicesRequest.SerializeToString, response_deserializer=tinkoff... | Speech synthesis.
| 62598ee4cad5886f8bdc3967 |
class CodeFormattedText (Markup): <NEW_LINE> <INDENT> text_char = "" <NEW_LINE> wiki_delim = ("<nowiki>", "</nowiki>") <NEW_LINE> xml_tag = html_tag = "code" | Text inside <code>...</code> | 62598ee42ae34c7f260a974e |
class StyleMap(_StyleSelector): <NEW_LINE> <INDENT> __name__ = "StyleMap" <NEW_LINE> normal = None <NEW_LINE> highlight = None <NEW_LINE> def __init__(self, ns=None, id=None, normal=None, highlight=None): <NEW_LINE> <INDENT> super(StyleMap, self).__init__(ns, id) <NEW_LINE> pass <NEW_LINE> <DEDENT> def from_element(sel... | A <StyleMap> maps between two different Styles. Typically a
<StyleMap> element is used to provide separate normal and highlighted
styles for a placemark, so that the highlighted version appears when
the user mouses over the icon in Google Earth. | 62598ee47047854f4633da3b |
class DynamicPolicy(DerivedPolicy): <NEW_LINE> <INDENT> def __init__(self,policy=drop): <NEW_LINE> <INDENT> self._policy = policy <NEW_LINE> self.notify = None <NEW_LINE> super(DerivedPolicy,self).__init__() <NEW_LINE> <DEDENT> def set_network(self, network): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def attach(self... | Abstact class for dynamic policies.
The behavior of a dynamic policy changes each time self.policy is reassigned. | 62598ee455399d3f05624b98 |
class Dice: <NEW_LINE> <INDENT> def __init__(self, minvalue, maxvalue): <NEW_LINE> <INDENT> self.min = minvalue <NEW_LINE> self.max = maxvalue <NEW_LINE> <DEDENT> def roll(self): <NEW_LINE> <INDENT> print("rolled " + str(randint(self.min, self.max))) | a simple dice.py class | 62598ee4a219f33f346c4ea0 |
class RateTypeType(Enum): <NEW_LINE> <INDENT> MarginRate = 50 <NEW_LINE> def __int__(self): <NEW_LINE> <INDENT> return self.value <NEW_LINE> <DEDENT> def __char__(self): <NEW_LINE> <INDENT> return chr(self.value) | 费率类型类型 | 62598ee40c0af96317c54a04 |
class Robot: <NEW_LINE> <INDENT> _directions=('nord', 'est', 'sud', 'ouest') <NEW_LINE> _dx = (0, 1, 0, -1) <NEW_LINE> _dy = (1, 0, -1, 0) <NEW_LINE> def _nomDirection(idDirection): <NEW_LINE> <INDENT> return Robot._directions[idDirection] <NEW_LINE> <DEDENT> def _idDirection(nomDirection): <NEW_LINE> <INDENT> return R... | Robot qui sait avancer d'une case et pivoter à droite de 90°.
Il est repéré par son abscisse x, son ordonnée y et sa direction. | 62598ee4f548e778e5969bfc |
class SRTestConfig(SRCommonConfig): <NEW_LINE> <INDENT> pass | Default Dataset config for SR. | 62598ee4baa26c4b54d4d936 |
class NullVectorError(ValueError): <NEW_LINE> <INDENT> pass | Raised when trying to initialize a ``Qubit`` with the null vector. | 62598ee4aad79263cf42ce71 |
class Queue: <NEW_LINE> <INDENT> def __init__(self, contents=[], initial_size=10): <NEW_LINE> <INDENT> self._list = [None]*initial_size <NEW_LINE> self._size = initial_size <NEW_LINE> self.head = -1 <NEW_LINE> self.tail = -1 <NEW_LINE> for e in contents: <NEW_LINE> <INDENT> self.enqueue(e) <NEW_LINE> <DEDENT> <DEDENT... | DATA MEMBERS
- _list : internal list
- _size : keeps track of _list size
- head : tracks beg idx of queue
- tail : tracks end
METHODS
- enqueue : ammortized append
- dequeue : ammortized remove from beg
- __len__ : lengh of queue ((head and tail are -1 if... | 62598ee4e76e3b2f99fd709f |
class th(element): <NEW_LINE> <INDENT> def __init__(self, parent: base_element, idstr: str, attrdct: dict, jsel) -> None: <NEW_LINE> <INDENT> generic_element.__init__(self, 'th', parent, idstr, attrdct, jsel) | A table header element.
Note:
See https://www.w3schools.com/html/html_tables.asp | 62598ee41b99ca400228e840 |
class GsTimeSpan(object): <NEW_LINE> <INDENT> thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') <NEW_LINE> __repr__ = _swig_repr <NEW_LINE> TimeSpan = property(_gskernel.GsTimeSpan_TimeSpan_get, _gskernel.GsTimeSpan_TimeSpan_set, doc=r""" 时间间隔(秒 )""") <NEW_LINE> def __... | 时间间隔 | 62598ee47d847024c075aa36 |
class Rectangle: <NEW_LINE> <INDENT> number_of_instances = 0 <NEW_LINE> print_symbol = "#" <NEW_LINE> def __init__(self, width=0, height=0): <NEW_LINE> <INDENT> self.width = width <NEW_LINE> self.height = height <NEW_LINE> type(self).number_of_instances += 1 <NEW_LINE> <DEDENT> @property <NEW_LINE> def width(self): <NE... | This class defines a rectangle instance. | 62598ee467a9b606de544635 |
class Approval(object): <NEW_LINE> <INDENT> def __init__(self, json_data): <NEW_LINE> <INDENT> self.category = from_json(json_data, "type") <NEW_LINE> self.value = from_json(json_data, "value") <NEW_LINE> self.description = from_json(json_data, "description") <NEW_LINE> self.approver = Account.from_json(json_data, "by"... | Gerrit approval (verified, code review, etc). | 62598ee42c8b7c6e89bd1e27 |
class MarkdownInHtmlProcessor(BlockProcessor): <NEW_LINE> <INDENT> def test(self, parent, block): <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> def parse_element_content(self, element): <NEW_LINE> <INDENT> md_attr = element.attrib.pop('markdown', 'off') <NEW_LINE> if md_attr == 'block': <NEW_LINE> <INDENT> for ch... | Process Markdown Inside HTML Blocks which have been stored in the HtmlStash. | 62598ee43539df3088eca91a |
class PreambleMimeTypeOptionProperty(OptionProperty): <NEW_LINE> <INDENT> option_name = 'mimetype' <NEW_LINE> data_type = six.text_type <NEW_LINE> choices = PreambleMimeType.VALID_VALUES | A property for a preamble section's "mimetypes" option. | 62598ee47d43ff248742672f |
@_e17_reg_tt_00 <NEW_LINE> class E17TokenE00_10(E17TokenE00): <NEW_LINE> <INDENT> type = 0x10 <NEW_LINE> def __init__(self, f): <NEW_LINE> <INDENT> self.data = (f.read_u8(), f.read_av(), f.read_esr()) <NEW_LINE> <DEDENT> def get_edges(self, p): <NEW_LINE> <INDENT> return (CallgraphEdge.fromdst((None, self.data[2])),) <... | 00-10: System/startup returnable jump | 62598ee463b5f9789fe837c5 |
class LoadModuleCommand(BackgroundCommand): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> super(LoadModuleCommand, self).__init__(*args, **kwargs) <NEW_LINE> self.__name__ = kwargs.get('name') <NEW_LINE> <DEDENT> def get_name(self): <NEW_LINE> <INDENT> return self.__name__ <NEW_LINE> <DED... | Load external module
Arguments: sender - The freepy actor sending this command.
name - module name. | 62598ee43cc13d1c6d463dd5 |
class ParallelCNN(object): <NEW_LINE> <INDENT> def __init__(self, vocab_size, nb_labels, emb_dim, maxlen, embedding_weights, filter_hs, nb_filters, dropout_p, trainable_embeddings, pretrained_embeddings): <NEW_LINE> <INDENT> self.nb_labels = nb_labels <NEW_LINE> if pretrained_embeddings is False: <NEW_LINE> <INDENT> em... | A CNN for text classification.
embedding --> conv --> 1-max pool --> softmax | 62598ee48a43f66fc4bf07da |
class LedStrip_WS2801(object): <NEW_LINE> <INDENT> def __init__(self, nLeds, nBuffers=1): <NEW_LINE> <INDENT> self.spi = spidev.SpiDev() <NEW_LINE> self.spi.open(0, 1) <NEW_LINE> self.spi.max_speed_hz = 1000000 <NEW_LINE> self.nLeds = nLeds <NEW_LINE> self.nBuffers = nBuffers <NEW_LINE> self.buffers = [] <NEW_LINE> for... | Access to SPI with python spidev library. | 62598ee4cad5886f8bdc3969 |
class Response(object): <NEW_LINE> <INDENT> status_code = None <NEW_LINE> body = None <NEW_LINE> headers = None <NEW_LINE> def __init__(self, status_code, body, headers): <NEW_LINE> <INDENT> self.status_code = status_code <NEW_LINE> self.body = self._demarshal(body) <NEW_LINE> self.headers = headers <NEW_LINE> <DEDENT>... | Used to process and wrap the responses from Consul.
:param int status_code: HTTP Status code
:param str body: The response body
:param dict headers: Response headers | 62598ee407f4c71912badabd |
class Lerpoi(Gensuha): <NEW_LINE> <INDENT> GENTURTAI = "lerpoi" <NEW_LINE> def __init__(self, lerpoi): <NEW_LINE> <INDENT> self.lerpoi = lerpoi <NEW_LINE> <DEDENT> def as_json(self): <NEW_LINE> <INDENT> return OrderedDict([ ( "genturtai", self.GENTURTAI ), ( "lerpoi", self.lerpoi ) ]) <NEW_LINE> <DEDENT> def as_x... | lerpoi: letteral sequence
A string of characters. | 62598ee47b25080760ed5b02 |
class TestProcessJbossFuseCxfVersion(unittest.TestCase): <NEW_LINE> <INDENT> def test_success(self): <NEW_LINE> <INDENT> self.assertEqual( karaf.ProcessJbossFuseCxfVersion.process(ansible_results( [{'item': '/fake/dir', 'stdout': 'redhat-630187'}])), [{'install_home': '/fake/dir', 'version': ['redhat-630187']}]) <NEW_L... | Test the output of looking for cxf version. | 62598ee4a17c0f6771d5a8bc |
class MSWing(VSPComponent): <NEW_LINE> <INDENT> XMLTYPE = 'Mswing' <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> super(MSWing, self).__init__() <NEW_LINE> self.add('wing_parms', MSWingParms()) <NEW_LINE> self._airfoils = [] <NEW_LINE> self._sections = [] <NEW_LINE> <DEDENT> def read(self, this): <NEW_LINE> <INDENT... | Multi-Section Wing. | 62598ee460cbc95b063629a5 |
class LogHandler_mixin(object): <NEW_LINE> <INDENT> LOG_CAPACITY = 128 <NEW_LINE> @property <NEW_LINE> def log_handler(self): <NEW_LINE> <INDENT> return self.__log_handler <NEW_LINE> <DEDENT> def setUp(self): <NEW_LINE> <INDENT> super(LogHandler_mixin, self).setUp() <NEW_LINE> self.__log_handler = logging.handlers.Buff... | Extension that registers a
:class:`python:logging.handlers.BufferingHandler` for loggers used
in CoAPy modules to capture the log messages for diagnostic
verification.
This implementation currently assumes that only the root logger
has set the log message level. For the duration of the test, this
level is reset to 1 ... | 62598ee43617ad0b5ee04798 |
class TrainFinder(object): <NEW_LINE> <INDENT> def __init__(self, dept, dest): <NEW_LINE> <INDENT> self.dept = dept <NEW_LINE> self.dest = dest <NEW_LINE> self.base_url = 'http://ojp.nationalrail.co.uk' <NEW_LINE> <DEDENT> def create_url(self): <NEW_LINE> <INDENT> return '{base}/service/ldbboard/dep/{dept}/{dest}/To'.f... | Find the earliest train to leave the station | 62598ee4656771135c487cfc |
class LearningAgent(Agent): <NEW_LINE> <INDENT> def __init__(self, env, learning=False, epsilon=1.0, alpha=0.5): <NEW_LINE> <INDENT> super(LearningAgent, self).__init__(env) <NEW_LINE> self.planner = RoutePlanner(self.env, self) <NEW_LINE> self.valid_actions = self.env.valid_actions <NEW_LINE> self.learning = learning ... | An agent that learns to drive in the Smartcab world.
This is the object you will be modifying. | 62598ee421a7993f00c645d5 |
class canBeConfused(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.pkmn = BuildPokemonBattleWrapper() <NEW_LINE> self.ability = Ability(None) <NEW_LINE> <DEDENT> def properReturnValues(self): <NEW_LINE> <INDENT> assert self.ability.canBeConfused(None, []), "Should be able to be Confus... | Test that canBeConfused returns the correct default values | 62598ee4a219f33f346c4ea2 |
class Walker(): <NEW_LINE> <INDENT> def __init__(self, path: str, extensions=[]): <NEW_LINE> <INDENT> self.path = abspath(realpath(path)) <NEW_LINE> if not isdir(self.path): <NEW_LINE> <INDENT> raise IOError( '{} is not a valid directory path'.format(self.path)) <NEW_LINE> <DEDENT> self.count = False <NEW_LINE> self.ex... | Selectively visit files in a tree and act on them.
The following public methods are available:
- __init__(): takes two arguments when constructing an instance:
- path: the path to the root of the subtree that is to be walked
- extensions: a list of strings, each containing a filename extension
(including the ... | 62598ee43eb6a72ae0388cab |
class auto: <NEW_LINE> <INDENT> value = _auto_null | Instances are replaced with an appropriate value in Enum class suites. | 62598ee438b623060ffa7700 |
class ChargerSwitch(TeslaDevice, SwitchEntity): <NEW_LINE> <INDENT> async def async_turn_on(self, **kwargs): <NEW_LINE> <INDENT> _LOGGER.debug("Enable charging: %s", self.name) <NEW_LINE> await self.tesla_device.start_charge() <NEW_LINE> <DEDENT> async def async_turn_off(self, **kwargs): <NEW_LINE> <INDENT> _LOGGER.deb... | Representation of a Tesla charger switch. | 62598ee463d6d428bbee0e35 |
class CreateProjectView(View): <NEW_LINE> <INDENT> def get(self, request, *args, **kwargs): <NEW_LINE> <INDENT> company_id = request.GET.get("company_id") <NEW_LINE> if company_id: <NEW_LINE> <INDENT> form = CreateProjectWithCompanyForm(request.POST or None) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> form = CreatePr... | Добавить новый проект в базу
обработкой гет запроса | 62598ee476e4537e8c3edc21 |
class SubscriptionHandler(object): <NEW_LINE> <INDENT> def __init__(self,url): <NEW_LINE> <INDENT> super(SubscriptionHandler ,self).__init__() <NEW_LINE> self._get_or_create(url) <NEW_LINE> <DEDENT> def _get_or_create(self, url): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def update(self): <NEW_LINE> <INDENT> pass <N... | uses gevent to fetch, parse and handle a feedsource | 62598ee45fdd1c0f98e5c617 |
class SlxosSingleRpConnectionProvider(BaseSingleRpConnectionProvider): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> super().__init__(*args, **kwargs) <NEW_LINE> <DEDENT> def get_connection_dialog(self): <NEW_LINE> <INDENT> con = self.connection <NEW_LINE> custom_auth_stmt = custom_auth_s... | Implements Slxos singleRP Connection Provider,
This class overrides the base class with the
additional dialogs and steps required for
connecting to any device via generic implementation | 62598ee432920d7e50bc4696 |
class RNN: <NEW_LINE> <INDENT> def __init__(self, dataset, train_x, train_y, test_x, test_y, dict_size=5000, example_length=500, embedding_length=32, epoches=15, batch_size=128): <NEW_LINE> <INDENT> self.batch_size = batch_size <NEW_LINE> self.epoches = epoches <NEW_LINE> self.example_len = example_length <NEW_LINE> se... | RNN classifier | 62598ee43539df3088eca91c |
class CheckOut(Base): <NEW_LINE> <INDENT> TYPE = ( ('SC', 'Scan Code'), ('SH', 'Shift'), ) <NEW_LINE> BOOK_STATUS = ( ('ON', 'ON Shelf'), ('OUT', 'Check Out'), ('RE', 'Returned'), ('LO', 'Lost') ) <NEW_LINE> user_profile = models.ForeignKey(UserProfile, null=False, on_delete=models.DO_NOTHING) <NEW_LINE> book = models.... | 借阅 | 62598ee4379a373c97d97664 |
class UserProgress(models.Model): <NEW_LINE> <INDENT> user = models.ForeignKey(User) <NEW_LINE> progress = JSONField(default=dict(correct={}, incorrect={})) <NEW_LINE> def __unicode__(self): <NEW_LINE> <INDENT> return 'Progress for %s %s' % (self.user.first_name, self.user.last_name) <NEW_LINE> <DEDENT> def _infinitive... | The progress of a user. | 62598ee463b5f9789fe837c7 |
class AgentConnectionTests(TestCase): <NEW_LINE> <INDENT> def test_connection_create(self): <NEW_LINE> <INDENT> wallet = IndyWallet.objects.create( wallet_name='test_wallet', wallet_config='{"some":"test", "string":"."}', ) <NEW_LINE> wallet.save() <NEW_LINE> connection = AgentConnection.objects.create( wallet=wallet, ... | Tests for Indy AgentConnection class | 62598ee444b2445a339b5c9c |
class OrderHistoryView(PageTitleMixin, generic.ListView): <NEW_LINE> <INDENT> context_object_name = "orders" <NEW_LINE> template_name = 'customer/order/order_list.html' <NEW_LINE> paginate_by = settings.OSCAR_ORDERS_PER_PAGE <NEW_LINE> model = Order <NEW_LINE> form_class = OrderSearchForm <NEW_LINE> page_title = _('Ord... | Customer order history | 62598ee456b00c62f0fb0f3a |
class MySQLSHA256PasswordAuthPluginTests(tests.MySQLConnectorTests): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.plugin_class = authentication.MySQLSHA256PasswordAuthPlugin <NEW_LINE> <DEDENT> def test_class(self): <NEW_LINE> <INDENT> self.assertEqual('sha256_password', self.plugin_class.plugin_name) ... | Tests authentication.MySQLSHA256PasswordAuthPlugin | 62598ee432920d7e50bc4697 |
class Server(AuthorizationEndpoint, TokenEndpoint, ResourceEndpoint): <NEW_LINE> <INDENT> def __init__(self, request_validator, token_expires_in=None, token_generator=None, *args, **kwargs): <NEW_LINE> <INDENT> auth_grant = AuthorizationCodeGrant(request_validator) <NEW_LINE> implicit_grant = ImplicitGrant(request_vali... | An all-in-one endpoint featuring all four major grant types. | 62598ee43d592f4c4edb955f |
class Department(models.Model): <NEW_LINE> <INDENT> parent = models.ForeignKey( 'self', on_delete=models.CASCADE, null=True, ) <NEW_LINE> name = models.CharField( verbose_name='Наименование подразделения', max_length=256, ) <NEW_LINE> def __str__(self): <NEW_LINE> <INDENT> return self.name | Структура организации. | 62598ee476e4537e8c3edc22 |
class Reconstruct4DCineMRITest(ScriptedLoadableModuleTest): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> slicer.mrmlScene.Clear() <NEW_LINE> <DEDENT> def runTest(self): <NEW_LINE> <INDENT> self.setUp() <NEW_LINE> self.test_Reconstruct4DCineMRI1() <NEW_LINE> <DEDENT> def test_Reconstruct4DCineMRI1(self): <NE... | This is the test case for your scripted module.
Uses ScriptedLoadableModuleTest base class, available at:
https://github.com/Slicer/Slicer/blob/master/Base/Python/slicer/ScriptedLoadableModule.py | 62598ee44f6381625f1987f1 |
class SingleNode(object): <NEW_LINE> <INDENT> def __init__(self, item): <NEW_LINE> <INDENT> self.item = item <NEW_LINE> self.next = None | 单链表的节点的实现 | 62598ee43c8af77a43b67268 |
class ModifyUHostInstanceTagResponseSchema(schema.ResponseSchema): <NEW_LINE> <INDENT> fields = {"UhostId": fields.Str(required=False, load_from="UhostId")} | ModifyUHostInstanceTag - 修改指定UHost实例业务组标识。
| 62598ee410dbd63aa1c6f1dc |
class TestAdd(testLib.RestTestCase): <NEW_LINE> <INDENT> def assertResponse(self, respData, count = 1, errCode = testLib.RestTestCase.SUCCESS): <NEW_LINE> <INDENT> expected = { 'errCode' : errCode } <NEW_LINE> if count is not None: <NEW_LINE> <INDENT> expected['count'] = count <NEW_LINE> <DEDENT> self.assertDictEqual(... | Test adding users | 62598ee44a966d76dd5ed54e |
class BuildTests(test_lib.GRRBaseTest): <NEW_LINE> <INDENT> def testWriteBuildYaml(self): <NEW_LINE> <INDENT> context = [ "Target:LinuxDeb", "Platform:Linux", "Target:Linux", "Arch:amd64" ] <NEW_LINE> expected = { "Client.build_environment": "cp27-cp27mu-linux_x86_64", "Client.build_time": "2016-05-24 20:04:25", "Templ... | Tests for building functionality. | 62598ee47047854f4633da3f |
class ShortWrite(ProtocolError): <NEW_LINE> <INDENT> pass | Raised if unable to write all data. | 62598ee4cc0a2c111447966d |
class NSXCluster(object): <NEW_LINE> <INDENT> def __init__(self, **kwargs): <NEW_LINE> <INDENT> self._required_attributes = REQUIRED_ATTRIBUTES[:] <NEW_LINE> self._important_attributes = IMPORTANT_ATTRIBUTES[:] <NEW_LINE> self._deprecated_attributes = {} <NEW_LINE> self._sanity_check(kwargs) <NEW_LINE> for opt, val in ... | NSX cluster class.
Encapsulates controller connections and the API client for a NSX cluster.
Controller-specific parameters, such as timeouts are stored in the
elements of the controllers attribute, which are dicts. | 62598ee42ae34c7f260a9752 |
class SongQuerySet(models.query.QuerySet): <NEW_LINE> <INDENT> def valid_songs(self): <NEW_LINE> <INDENT> return self.filter(enabled= True).exclude(file__contains= 'no-file') <NEW_LINE> <DEDENT> def by_artist(self, artist): <NEW_LINE> <INDENT> return self.filter(artist = artist) | this queryset returns only active and valid songs | 62598ee40c0af96317c54a07 |
class DeleteSubacoount(object): <NEW_LINE> <INDENT> _names = { "username":'username' } <NEW_LINE> def __init__(self, username=None): <NEW_LINE> <INDENT> self.username = username <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> def from_dictionary(cls, dictionary): <NEW_LINE> <INDENT> if dictionary is None: <NEW_LINE> <INDEN... | Implementation of the 'delete subacoount' model.
Deletesubaccount modal
Attributes:
username (string): The username of the subaccount | 62598ee460cbc95b063629a7 |
class TFMPNetEmbeddings(tf.keras.layers.Layer): <NEW_LINE> <INDENT> def __init__(self, config, **kwargs): <NEW_LINE> <INDENT> super().__init__(**kwargs) <NEW_LINE> self.padding_idx = 1 <NEW_LINE> self.vocab_size = config.vocab_size <NEW_LINE> self.hidden_size = config.hidden_size <NEW_LINE> self.max_position_embeddings... | Construct the embeddings from word, position embeddings. | 62598ee4a8ecb0332586f853 |
class Buttons(): <NEW_LINE> <INDENT> def __init__(self, ): <NEW_LINE> <INDENT> self.old_input = int() <NEW_LINE> self.now_input = int() <NEW_LINE> <DEDENT> def refresh(self, buttons): <NEW_LINE> <INDENT> self.old_input = self.now_input <NEW_LINE> self.now_input = buttons <NEW_LINE> <DEDENT> def isPushed(self, num): <NE... | docstring for JoyInput | 62598ee47047854f4633da40 |
class _MultiWorkerIter(object): <NEW_LINE> <INDENT> def __init__(self, num_workers, dataset, batchify_fn, batch_sampler, pin_memory=False, worker_fn=worker_loop): <NEW_LINE> <INDENT> assert num_workers > 0, "_MultiWorkerIter is not for {} workers".format(num_workers) <NEW_LINE> self._num_workers = num_workers <NEW_LINE... | Interal multi-worker iterator for DataLoader. | 62598ee49c8ee8231303f48d |
class MainWheel(Main): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> db_table = 'xf_wheel' | 首页banner | 62598ee501c39578d7f11414 |
@six.add_metaclass(abc.ABCMeta) <NEW_LINE> class FromServiceAccountMixin(object): <NEW_LINE> <INDENT> @abc.abstractmethod <NEW_LINE> def from_string(cls, key, key_id=None): <NEW_LINE> <INDENT> raise NotImplementedError("from_string must be implemented") <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> def from_service_accou... | Mix-in to enable factory constructors for a Signer. | 62598ee51b99ca400228e842 |
class mesh(object): <NEW_LINE> <INDENT> def __init__(self, init=None, val=None): <NEW_LINE> <INDENT> if isinstance(init, mesh): <NEW_LINE> <INDENT> self.values = cp.deepcopy(init.values) <NEW_LINE> <DEDENT> elif isinstance(init, tuple) or isinstance(init, int): <NEW_LINE> <INDENT> self.values = np.empty(init, dtype=np.... | Mesh data type with arbitrary dimensions and complex datay
This data type can be used whenever structured data with a single unknown per point in space is required
Attributes:
values (np.ndarray): contains the ndarray of the values | 62598ee5e1aae11d1e7cdb74 |
class TagsView(ListView): <NEW_LINE> <INDENT> model = Tag <NEW_LINE> context_object_name = "tags" <NEW_LINE> template_name = "blog/tags.html" <NEW_LINE> paginate_by = 5 | View that shows all the tags
| 62598ee576e4537e8c3edc23 |
class ExplorationEditRightsTest(BaseEditorControllerTest): <NEW_LINE> <INDENT> def test_user_banning(self): <NEW_LINE> <INDENT> exp_id = '0' <NEW_LINE> exp_services.load_demo(exp_id) <NEW_LINE> rights_manager.release_ownership_of_exploration( self.system_user, exp_id) <NEW_LINE> self.signup('joe@example.com', 'joe') <N... | Test the handling of edit rights for explorations. | 62598ee56aa9bd52df0d351a |
class Camera: <NEW_LINE> <INDENT> def __init__(self, pos=np.array([0, 0, 0]), rot=Quaternion.euler_to_quaternion(0, 0, 0), ortho=False): <NEW_LINE> <INDENT> self.pos = pos <NEW_LINE> self.rot = rot <NEW_LINE> self.ortho = ortho | Camera in 3D world | 62598ee5cc0a2c111447966e |
class LazyUnion(Cluster): <NEW_LINE> <INDENT> def __init__(self, first, second): <NEW_LINE> <INDENT> assert isinstance(first, Cluster) <NEW_LINE> assert isinstance(second, Cluster) <NEW_LINE> self.first = first <NEW_LINE> self.second = second <NEW_LINE> LOGGER.debug("Lazy-merging clusters %s + %s -> %s", first, second,... | This class represents a cluster before the aggregate random sample has been aggregated.
The aggregate random sample has not yet been aggregated from the random samples of the random
variables in the cluster.
Note
----
Future additions of individuals to the random samples of the random variables in the cluster
will be... | 62598ee54c3428357761894e |
class Autoencoder: <NEW_LINE> <INDENT> def __init__(self, image_dims=[100, 26], bottleneck_dim=40): <NEW_LINE> <INDENT> self.name = "Base_model" <NEW_LINE> self.image_dims = image_dims <NEW_LINE> self.bottleneck_dim = bottleneck_dim <NEW_LINE> <DEDENT> def build_model(self): <NEW_LINE> <INDENT> self.images = tf.placeho... | Autoencoder class
| 62598ee51f5feb6acb1612bc |
class CliErrorObserver: <NEW_LINE> <INDENT> def error(self, err): <NEW_LINE> <INDENT> sys.stderr.write(os.linesep + err.type + ': ' + err.summary) <NEW_LINE> if err.detail: <NEW_LINE> <INDENT> sys.stderr.write(os.linesep + '\tDetail: ' + err.detail) <NEW_LINE> <DEDENT> sys.stderr.write(os.linesep * 2) | All custom defined errors, using stderr | 62598ee5d7e4931a7ef3a709 |
class ColorEnvironment(Environment, ColorCommandClass): <NEW_LINE> <INDENT> def invoke(self, tex) -> None: <NEW_LINE> <INDENT> Environment.invoke(self, tex) <NEW_LINE> u = self.ownerDocument.userdata <NEW_LINE> self.parser: ColorParser = ColorParser(u.getPath('packages/xcolor/colors'), u.getPath('packages/xcolor/target... | A base class for plastex color environments | 62598ee55fdd1c0f98e5c61a |
class SIPPChargingVectorAction(Action): <NEW_LINE> <INDENT> name = "sip-p-charging-vector" <NEW_LINE> re_p_charging_vector = re.compile( r"^icid-value=[^;]+(?:;icid-generated-at=(?P<ip>[^;]+))?(?:;orig-ioi=(?P<domain>[^;]+))?$", re.IGNORECASE) <NEW_LINE> def __init__(self, app): <NEW_LINE> <INDENT> super(SIPPChargingVe... | Action plugin for the field Charging-Vector of the protocol SIP | 62598ee5435de62698e9a442 |
class LogMixin: <NEW_LINE> <INDENT> def debug(self, *args, **kwargs): <NEW_LINE> <INDENT> return self.log(logging.DEBUG, *args, **kwargs) <NEW_LINE> <DEDENT> def info(self, *args, **kwargs): <NEW_LINE> <INDENT> return self.log(logging.INFO, *args, **kwargs) <NEW_LINE> <DEDENT> def warn(self, *args, **kwargs): <NEW_LINE... | Mixin that adds severity methods to any class. | 62598ee52c8b7c6e89bd1e2b |
class DirectoryModel(FileSystemModel): <NEW_LINE> <INDENT> __abstract__ = True | Abstract base class for model classes, which refer to data
stored in directories on disk. | 62598ee58e7ae83300ee76fb |
class SpannerDatabase(resource_class_factory('spanner_database', 'name', hash_key=True)): <NEW_LINE> <INDENT> pass | The Resource implementation for Spanner Database. | 62598ee599cbb53fe682f51d |
class SpacelessExtension(Extension): <NEW_LINE> <INDENT> tags = {'spaceless'} <NEW_LINE> def parse(self, parser): <NEW_LINE> <INDENT> lineno = parser.stream.next().lineno <NEW_LINE> body = parser.parse_statements(['name:endspaceless'], drop_needle=True) <NEW_LINE> return nodes.CallBlock( self.call_method('_strip_spaces... | Removes whitespace between HTML tags at compile time, including tab and newline characters.
It does not remove whitespace between jinja2 tags or variables.
Neither does it remove whitespace between tags and their text content.
Adapted from coffin:
https://github.com/coffin/coffin/blob/master/coffin/template/default... | 62598ee58c0ade5d55dc29b9 |
class Occlusion(BaseFilter): <NEW_LINE> <INDENT> def __init__(self, numRectangles=4, seed=None, reproducible=False): <NEW_LINE> <INDENT> BaseFilter.__init__(self, seed, reproducible) <NEW_LINE> self.numRectangles = numRectangles <NEW_LINE> <DEDENT> def process(self, image): <NEW_LINE> <INDENT> BaseFilter.process(self, ... | Add randomly-generated rectangles to the image. | 62598ee5dd821e528d6d75b1 |
class ZfsInvalidPropertyError(ValueError): <NEW_LINE> <INDENT> pass | The specified property does not exist | 62598ee5462c4b4f79dba066 |
class EmptyChangeset(BaseChangeset): <NEW_LINE> <INDENT> def __init__(self, cs='0' * 40, repo=None, requested_revision=None, alias=None, revision=-1, message='', author='', date=None): <NEW_LINE> <INDENT> self._empty_cs = cs <NEW_LINE> self.revision = revision <NEW_LINE> self.message = message <NEW_LINE> self.author = ... | An dummy empty changeset. It's possible to pass hash when creating
an EmptyChangeset | 62598ee5796e427e5384ce04 |
class DocumentFormMixin(FormMixin, SingleDocumentMixin): <NEW_LINE> <INDENT> def get_form_class(self): <NEW_LINE> <INDENT> if self.form_class: <NEW_LINE> <INDENT> return self.form_class <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> if self.document is not None: <NEW_LINE> <INDENT> document = self.document <NEW_LINE> <D... | A mixin that provides a way to show and handle a documentform in a request. | 62598ee58a43f66fc4bf07de |
class BadInstructionCode(IntEnum): <NEW_LINE> <INDENT> OFPBIC_UNKNOWN_INST = 0 <NEW_LINE> OFPBIC_UNSUP_INST = 1 <NEW_LINE> OFPBIC_BAD_TABLE_ID = 2 <NEW_LINE> OFPBIC_UNSUP_METADATA = 3 <NEW_LINE> OFPBIC_UNSUP_METADATA_MASK = 4 <NEW_LINE> OFPBIC_BAD_EXPERIMENTER = 5 <NEW_LINE> OFPBIC_BAD_EXP_TYPE = 6 <NEW_LINE> OFPBIC_BA... | Error_msg 'code' values for OFPET_BAD_INSTRUCTION.
'data' contains at least the first 64 bytes of the failed request. | 62598ee5d486a94d0ba2a639 |
class MyHashSet: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.hsize = int(1e6) <NEW_LINE> self.rad = 33 <NEW_LINE> self.buckets = [[] for _ in range(self.hsize)] <NEW_LINE> <DEDENT> def _hash(self, n): <NEW_LINE> <INDENT> d, q = self.rad, self.hsize <NEW_LINE> h = 0 <NEW_LINE> while n: <NEW_LINE> <I... | Runtime: 212 ms, faster than 63.96% of Python3 online submissions for Design HashSet.
AC in 1st. | 62598ee5851cf427c66b693d |
class InTestNode(BinOpNodeBase): <NEW_LINE> <INDENT> def eval(self, context): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> res = self.lOp.eval(context) in self.rOp.eval(context) <NEW_LINE> <DEDENT> except TypeError as e: <NEW_LINE> <INDENT> raise InTestTypeError(self.opToken, e) from e <NEW_LINE> <DEDENT> return res | Node representing an ``in`` test.
Corresponds to the :token:`inTest` grammar production. | 62598ee5656771135c487d00 |
class ReleaseSchema(BaseReleaseSchema): <NEW_LINE> <INDENT> num_elements = SchemaNode(Int(), missing=drop) | Base Class for Release Schemas | 62598ee557b8e32f5250743b |
class TypeInfoObject(with_metaclass(registry.MetaclassRegistry, object)): <NEW_LINE> <INDENT> _type = None <NEW_LINE> def __init__(self, name="", default=None, description="", friendly_name="", hidden=False): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.default = default <NEW_LINE> self.description = descriptio... | Definition of the interface for flow arg typing information. | 62598ee54527f215b58e8573 |
class TestApp(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> if os.path.isfile("./kanban.db"): <NEW_LINE> <INDENT> os.remove("./kanban.db") <NEW_LINE> <DEDENT> self.db = app.db.create_all() <NEW_LINE> <DEDENT> def test_empty_database(self): <NEW_LINE> <INDENT> self.assertEqual(self.db, Non... | test case for app.py.
Mainly just tested to see if database would always start up empty because
testing other methods required an active HTTP request. | 62598ee50c0af96317c54a0a |
class AlphaBetaPlayer(IsolationPlayer): <NEW_LINE> <INDENT> def get_move(self, game, time_left): <NEW_LINE> <INDENT> self.time_left = time_left <NEW_LINE> best_move = self.resignation_move <NEW_LINE> search_depth = 1 <NEW_LINE> try: <NEW_LINE> <INDENT> while True: <NEW_LINE> <INDENT> best_move = self.alphabeta(game, se... | Game-playing agent that chooses a move using iterative deepening minimax
search with alpha-beta pruning. You must finish and combined_4 this player to
make sure it returns a good move before the search time limit expires. | 62598ee57d847024c075aa3b |
class CEDICTWildcardTranslation(SingleEntryTranslation, _SimpleTranslationWildcardBase): <NEW_LINE> <INDENT> def __init__(self, *args, **options): <NEW_LINE> <INDENT> SingleEntryTranslation.__init__(self, *args, **options) <NEW_LINE> _SimpleTranslationWildcardBase.__init__(self, *args, **options) <NEW_LINE> <DEDENT> de... | CEDICT translation based search strategy with support for wildcards. Takes
into account additions put in parentheses and appended information separated
by a comma. | 62598ee576e4537e8c3edc25 |
class SubDomainAdmin(admin.ModelAdmin): <NEW_LINE> <INDENT> fieldsets = ( (None, { 'classes': ('wide', 'extrapretty'), 'fields': ( 'domain', 'label', ) }), ) <NEW_LINE> list_display = ( 'domain', 'label', ) <NEW_LINE> list_display_links = ( 'label', ) | Activates subdomains management from the Admin Interface. | 62598ee5498bea3a75a561a3 |
@attr.s <NEW_LINE> class GlobalFlavorCollection(object): <NEW_LINE> <INDENT> tenant_id = attr.ib() <NEW_LINE> clock = attr.ib() <NEW_LINE> regional_collections = attr.ib(default=attr.Factory(dict)) <NEW_LINE> def collection_for_region(self, region_name): <NEW_LINE> <INDENT> if region_name not in self.regional_collectio... | A :obj:`GlobalFlavorCollection` is a set of all the
:obj:`RegionalFlavorCollection` objects owned by a given tenant. In other
words, all the flavor objects that a single tenant owns globally. | 62598ee530dc7b766599def5 |
class NoDisksError(Exception): <NEW_LINE> <INDENT> pass | Raised when there are no Disks in a Tower, and the player
tries to move a Disk from that Tower to another. | 62598ee52c8b7c6e89bd1e2e |
class TernaryConstraint(BinaryConstraint): <NEW_LINE> <INDENT> OPS = set(['LOOKUP']) <NEW_LINE> def __init__(self, path, op, value, extra_value=None, code="A"): <NEW_LINE> <INDENT> self.extra_value = extra_value <NEW_LINE> super(TernaryConstraint, self).__init__(path, op, value, code) <NEW_LINE> <DEDENT> def to_string(... | Constraints for broad, general searching over all fields
========================================================
These constraints request a wide-ranging search for matching
fields over all aspects of an object, including up to coercion
from related classes.
Valid operators:
- LOOKUP
To aid disambiguation, Ternary... | 62598ee599cbb53fe682f51e |
class Command(BaseCommand): <NEW_LINE> <INDENT> help = "Check if there are tasks to be dispatched" <NEW_LINE> def add_arguments(self, parser): <NEW_LINE> <INDENT> parser.add_argument('collection', type=str) <NEW_LINE> <DEDENT> def handle(self, collection, **options): <NEW_LINE> <INDENT> logging_for_management_command(o... | Check if collection has finished processing. | 62598ee5462c4b4f79dba068 |
class GetAllResults(Resource): <NEW_LINE> <INDENT> def get(self): <NEW_LINE> <INDENT> return get_all_results() | Shows all results. Route: /api/v1/results/ using GET. | 62598ee5dd821e528d6d75b3 |
class GripperState(object): <NEW_LINE> <INDENT> OPEN = "open" <NEW_LINE> CLOSE = "close" | Specifies a State either OPEN or CLOSE | 62598ee5aad79263cf42ce78 |
class CommandColorError(Exception): <NEW_LINE> <INDENT> pass | Exception for a unknown color send by the NXT | 62598ee5cad5886f8bdc396f |
@final <NEW_LINE> class OpenWithoutContextManagerViolation(ASTViolation): <NEW_LINE> <INDENT> code = 515 <NEW_LINE> error_template = 'Found `open()` used without a context manager' | Forbid ``open()`` without a context manager.
Reasoning:
When you ``open()`` something, you need to close it.
When using a context manager - it is automatically done for you.
When not using it - you might find yourself in a situation
when file is not closed and is not accessible anymore.
Solution:
... | 62598ee54a966d76dd5ed552 |
class LinkedList: <NEW_LINE> <INDENT> def __init__(self, tail): <NEW_LINE> <INDENT> self.tail = tail <NEW_LINE> <DEDENT> def to_list(self): <NEW_LINE> <INDENT> linked_list = [] <NEW_LINE> node = self.tail <NEW_LINE> while node is not None: <NEW_LINE> <INDENT> linked_list = [node.value] + linked_list <NEW_LINE> node = n... | A linked list where each node points to the previous node.
Attributes:
tail: A Node object that represents the last node in the linked list | 62598ee50a50d4780f703a19 |
class V1alpha1Condition(object): <NEW_LINE> <INDENT> openapi_types = { 'message': 'str', 'status': 'str', 'type': 'str' } <NEW_LINE> attribute_map = { 'message': 'message', 'status': 'status', 'type': 'type' } <NEW_LINE> def __init__(self, message=None, status=None, type=None, local_vars_configuration=None): <NEW_LINE>... | NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually. | 62598ee54527f215b58e8575 |
class IODescriptorManual(IODescriptorBase): <NEW_LINE> <INDENT> def __init__(self, descriptor_dict, bundle_type): <NEW_LINE> <INDENT> super(IODescriptorManual, self).__init__(descriptor_dict) <NEW_LINE> self._validate_descriptor( descriptor_dict, required=["type", "name", "version"], optional=[] ) <NEW_LINE> self._type... | Represents a manually installed item.
This descriptor type is largely deprecated. Please do not use. | 62598ee59c8ee8231303f48f |
class arch_hppa1_1(generic_hppa): <NEW_LINE> <INDENT> def __init__(self, myspec): <NEW_LINE> <INDENT> generic_hppa.__init__(self, myspec) <NEW_LINE> self.settings["CFLAGS"] += " -march = 1.1" <NEW_LINE> self.settings["CHOST"] = "hppa1.1-unknown-linux-gnu" | Builder class for hppa 1.1 systems | 62598ee5236d856c2adc874b |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.