code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class ActivityStreamCompanyViewSet(BaseActivityStreamViewSet): <NEW_LINE> <INDENT> @decorator_from_middleware(ActivityStreamHawkResponseMiddleware) <NEW_LINE> def list(self, request): <NEW_LINE> <INDENT> after_ts, after_id = self._parse_after(request) <NEW_LINE> companies = list( Company.objects.filter( Q(modified=afte... | View set to list companies for the activity stream | 6259903966673b3332c315a1 |
class ConstraintViolation(WebException): <NEW_LINE> <INDENT> pass | The request violated some constraint or integrity within the data model. | 625990391d351010ab8f4cc7 |
class VatsimClient(LineReceiver): <NEW_LINE> <INDENT> cid = "" <NEW_LINE> password = "" <NEW_LINE> realname = "" <NEW_LINE> callsign = "ZAU_OBS" <NEW_LINE> lat ="41.786111" <NEW_LINE> lon = "-87.7525" <NEW_LINE> def sendRawResponse(self,rawResponse): <NEW_LINE> <INDENT> log.msg(">> %s" % rawResponse) <NEW_LINE> self.s... | Vatsim Client protocol | 62599039dc8b845886d54761 |
class MineTest(ModuleCase): <NEW_LINE> <INDENT> def test_get(self): <NEW_LINE> <INDENT> self.assertTrue(self.run_function('mine.update', minion_tgt='minion')) <NEW_LINE> self.assertIsNone( self.run_function( 'mine.update', minion_tgt='sub_minion' ) ) <NEW_LINE> self.assertTrue( self.run_function( 'mine.get', ['minion',... | Test the mine system | 625990390a366e3fb87ddb92 |
class LinodeBinarySensor(BinarySensorEntity): <NEW_LINE> <INDENT> def __init__(self, li, node_id): <NEW_LINE> <INDENT> self._linode = li <NEW_LINE> self._node_id = node_id <NEW_LINE> self._state = None <NEW_LINE> self.data = None <NEW_LINE> self._attrs = {} <NEW_LINE> self._name = None <NEW_LINE> <DEDENT> @property <NE... | Representation of a Linode droplet sensor. | 6259903930c21e258be999ba |
class PairwiseSoftplusNeuralNetwork(AbstractNeuralNetworkClassifier): <NEW_LINE> <INDENT> def prepare(self): <NEW_LINE> <INDENT> n1, n2, n3 = self.layers_ <NEW_LINE> A1 = self._create_matrix_parameter('A1', n1, n2) <NEW_LINE> A2 = self._create_matrix_parameter('A2', n1, n2) <NEW_LINE> B = self._create_matrix_parameter(... | The result is computed as :math:`h1 = softplus(A_1 x)`, :math:`h2 = sigmoid(A_2 x)`,
:math:`output = \sum_{ij} B_{ij} h1_i h2_j)` | 625990398a349b6b436873f0 |
class TestIsValidPrefix(unittest.TestCase): <NEW_LINE> <INDENT> def test_invalid_prefix(self): <NEW_LINE> <INDENT> self.assertFalse(export_utils.is_valid_prefix('prefix#with*special@chars')) <NEW_LINE> <DEDENT> def test_valid_prefix(self): <NEW_LINE> <INDENT> self.assertTrue(export_utils.is_valid_prefix('No-special_cha... | Tests that is_valid_prefix only returns true for strings containing alphanumeric characters,
dashes, and underscores. | 6259903950485f2cf55dc12d |
class BlockStructureCache(object): <NEW_LINE> <INDENT> def __init__(self, cache): <NEW_LINE> <INDENT> self._cache = cache <NEW_LINE> <DEDENT> def add(self, block_structure): <NEW_LINE> <INDENT> data_to_cache = ( block_structure._block_relations, block_structure.transformer_data, block_structure._block_data_map, ) <NEW_... | Cache for BlockStructure objects. | 62599039a8ecb033258723cc |
class FacebookAppOAuth2(FacebookOAuth2): <NEW_LINE> <INDENT> name = 'facebook-app' <NEW_LINE> def uses_redirect(self): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> def auth_complete(self, *args, **kwargs): <NEW_LINE> <INDENT> access_token = None <NEW_LINE> response = {} <NEW_LINE> if 'signed_request' in self.da... | Facebook Application Authentication support | 625990398da39b475be0439d |
class TouchSensor(rb.TouchSensor): <NEW_LINE> <INDENT> def __init__(self, port=ev3.INPUT_1): <NEW_LINE> <INDENT> super().__init__(port) <NEW_LINE> <DEDENT> def wait_until_pressed(self): <NEW_LINE> <INDENT> while True: <NEW_LINE> <INDENT> if self.get_value()>0: <NEW_LINE> <INDENT> break <NEW_LINE> <DEDENT> <DEDENT> <DED... | Primary author of this class: Yuanning Zuo. | 6259903971ff763f4b5e8948 |
@dataclass() <NEW_LINE> class GeneratedTX: <NEW_LINE> <INDENT> tx_context: TXContext <NEW_LINE> proposal: Proposal <NEW_LINE> signed_proposal: SignedProposal <NEW_LINE> header: Header <NEW_LINE> @property <NEW_LINE> def tx_id(self): <NEW_LINE> <INDENT> return self.tx_context.tx_id | A model to represent a transaction that has been generated but not
yet sent for endorsement | 6259903923e79379d538d6af |
class make_preconditioner(LinearOperator): <NEW_LINE> <INDENT> def __init__(self, A, prm={}): <NEW_LINE> <INDENT> Acsr = A.tocsr() <NEW_LINE> self.P = pyamgcl_ext.make_preconditioner( Acsr.indptr, Acsr.indices, Acsr.data, prm) <NEW_LINE> if [int(v) for v in scipy.__version__.split('.')] < [0, 16, 0]: <NEW_LINE> <INDENT... | Algebraic multigrid hierarchy that may be used as a preconditioner with
scipy iterative solvers. | 62599039507cdc57c63a5f48 |
class TestClassificationPolicy(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 testClassificationPolicy(self): <NEW_LINE> <INDENT> model = swagger_client.models.classification_policy.Classification... | ClassificationPolicy unit test stubs | 625990398e05c05ec3f6f732 |
class ValidateUserSchema(UserSchema): <NEW_LINE> <INDENT> age = fields.Number(validate=lambda n: 18 <= n <= 40) | This is a contrived example
You could use marshmallow.validate.Tange instead of an anonymous function here | 62599039cad5886f8bdc5953 |
class NumpyConcatenateOnCustomAxis(NonFittableMixin, BaseStep): <NEW_LINE> <INDENT> def __init__(self, axis): <NEW_LINE> <INDENT> self.axis = axis <NEW_LINE> BaseStep.__init__(self) <NEW_LINE> NonFittableMixin.__init__(self) <NEW_LINE> <DEDENT> def _transform_data_container(self, data_container, context): <NEW_LINE> <I... | Numpy concetenation step where the concatenation is performed along the specified custom axis. | 62599039a4f1c619b294f75e |
class _Layer(object): <NEW_LINE> <INDENT> def __init__( self, num_nodes, input_layer=None, activation=None, aux_der=None ): <NEW_LINE> <INDENT> self.nodes = [] <NEW_LINE> if input_layer is None: <NEW_LINE> <INDENT> for _ in range(num_nodes): <NEW_LINE> <INDENT> self.nodes.append(_Node()) <NEW_LINE> <DEDENT> <DEDENT> el... | A layer in an instance of the Net class.
Args:
num_nodes (int): The number of nodes to create in this layer.
input_layer (:obj:`_Layer`, optional): None or a layer whose nodes will
feed into this layer's nodes.
activation (str, optional): A string determining this layer's activation
function.
Attributes... | 625990390a366e3fb87ddb94 |
class PhysicsEngine(object): <NEW_LINE> <INDENT> ROBOT_WIDTH = 5 <NEW_LINE> ROBOT_HEIGHT = 4 <NEW_LINE> ROBOT_STARTING_X = 18.5 <NEW_LINE> ROBOT_STARTING_Y = 12 <NEW_LINE> STARTING_ANGLE = 180 <NEW_LINE> JOYSTICKS = [1, 2] <NEW_LINE> def __init__(self, physics_controller): <NEW_LINE> <INDENT> self.physics_controller = ... | Simulates a 2-wheel robot using Tank Drive joystick control | 625990390fa83653e46f6089 |
class InitCombatCmdSet(CmdSet): <NEW_LINE> <INDENT> key = 'combat_init_cmdset' <NEW_LINE> priority = 1 <NEW_LINE> mergetype = 'Union' <NEW_LINE> def at_cmdset_creation(self): <NEW_LINE> <INDENT> self.add(CmdInitiateAttack()) | Command set containing combat starting commands | 625990398a43f66fc4bf333c |
class LolStatusApiV3(NamedEndpoint): <NEW_LINE> <INDENT> def __init__(self, base_api: BaseApi): <NEW_LINE> <INDENT> super().__init__(base_api, LolStatusApiV3.__name__) <NEW_LINE> <DEDENT> def shard_data(self, region: str): <NEW_LINE> <INDENT> return self._request_endpoint( self.shard_data.__name__, region, LolStatusApi... | This class wraps the LoL-Status-v3 Api calls provided by the Riot API.
See https://developer.riotgames.com/api-methods/#lol-status-v3 for more detailed information | 6259903982261d6c5273079c |
class CumulativePresence(Graph): <NEW_LINE> <INDENT> short_name = 'cumulative_presence' <NEW_LINE> def plot(self, **kwargs): <NEW_LINE> <INDENT> num_of_otus = self.parent.otu_table.shape[1] <NEW_LINE> num_of_samples = self.parent.otu_table.shape[0] <NEW_LINE> samples_index = list(reversed(range(1, num_of_samples+1)... | Cumulative graph of cluster presence in samples. This means something such as:
- 0% of OTUs appear in 100% of the samples,
- 10% of OTUs appear in 90% of the samples,
- 90% of OTUs appear in 1% of the samples. | 62599039507cdc57c63a5f4a |
class RobustGlobalPool2dFn(torch.autograd.Function): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def runOptimisation(x, y, method, alpha_scalar): <NEW_LINE> <INDENT> with torch.enable_grad(): <NEW_LINE> <INDENT> opt = torch.optim.LBFGS([y], lr=1, max_iter=100, max_eval=None, tolerance_grad=1e-05, tolerance_change=1e-0... | A function to globally pool a 2D response matrix using a robust penalty function | 6259903926238365f5fadd06 |
class TestSuiteResult(object): <NEW_LINE> <INDENT> def __init__(self, testsuite_name, args_obj): <NEW_LINE> <INDENT> self._testsuite = testsuite_name <NEW_LINE> self._args_obj = args_obj <NEW_LINE> self._testcase_results = [] <NEW_LINE> self._blocked_testcases = {} <NEW_LINE> self._unknown_testcases = [] <NEW_LINE> <DE... | Container of test results of a test suite.
Attributes:
_testsuite: Full name of the test suite.
_args_obj: The argument object passed to test cases.
_testcase_results: A list of TestCaseResult objects. This list only has
results for test cases that are run - either successfully completed
or... | 6259903930c21e258be999be |
class Choice(models.Model): <NEW_LINE> <INDENT> poll = models.ForeignKey(Poll) <NEW_LINE> choice_text = models.CharField(max_length=200) <NEW_LINE> votes = models.IntegerField(default=0) <NEW_LINE> def __unicode__(self): <NEW_LINE> <INDENT> return self.choice_text | Model class of Choice | 62599039d99f1b3c44d06856 |
class Solution: <NEW_LINE> <INDENT> def isIsomorphic(self, s: str, t: str) -> bool: <NEW_LINE> <INDENT> return len(set(s))==len(set(t))==len(set(zip(s,t))) | one liner solution | 6259903950485f2cf55dc131 |
class PacketListField(PacketField): <NEW_LINE> <INDENT> __slots__ = ["count_from", "length_from", "next_cls_cb"] <NEW_LINE> islist = 1 <NEW_LINE> def __init__(self, name, default, cls=None, count_from=None, length_from=None, next_cls_cb=None): <NEW_LINE> <INDENT> if default is None: <NEW_LINE> <INDENT> default = [] <NE... | PacketListField represents a series of Packet instances that might occur right in the middle of another Packet
field list.
This field type may also be used to indicate that a series of Packet instances have a sibling semantic instead of
a parent/child relationship (i.e. a stack of layers). | 62599039b57a9660fecd2c2c |
class Meta: <NEW_LINE> <INDENT> app_label = 'demo' | Meta settings for MaterialWidgetsDemoModel | 62599039b5575c28eb7135a2 |
class _ExtendedEnum(Enum): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def by_name(cls, name: str) -> "Enum": <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return cls.__members__[name.upper()] <NEW_LINE> <DEDENT> except KeyError as exc: <NEW_LINE> <INDENT> raise ValueError( "Unknown value for type {}, available: {}", cl... | A custom enum with extended functionality. | 625990391f5feb6acb163da4 |
class MoreData(Singleton): <NEW_LINE> <INDENT> Nothing = 0x00 <NEW_LINE> KeepReading = 0xFF | Represents the more follows condition
.. attribute:: Nothing
This indiates that no more objects are going to be returned.
.. attribute:: KeepReading
This indicates that there are more objects to be returned. | 6259903923e79379d538d6b2 |
class ICMS00(Entidade): <NEW_LINE> <INDENT> def __init__(self, **kwargs): <NEW_LINE> <INDENT> super(ICMS00, self).__init__(schema={ 'Orig': { 'type': 'string', 'required': True, 'allowed': [v for v,s in constantes.N06_ORIG]}, 'CST': { 'type': 'string', 'required': True, 'allowed': [v for v,s in constantes.N07_CST_ICMS0... | Grupo de tributação do ICMS 00, 20 e 90 (``ICMS00``, grupo ``N02``).
:param str Orig:
:param str CST:
:param Decimal pICMS:
.. sourcecode:: python
>>> icms = ICMS00(Orig='0', CST='00', pICMS=Decimal('18.00'))
>>> ET.tostring(icms._xml())
'<ICMS00><Orig>0</Orig><CST>00</CST><pICMS>18.00</pICMS></ICMS00>' | 62599039e76e3b2f99fd9bbe |
class ReadonlyEditor(TextReadonlyEditor): <NEW_LINE> <INDENT> def _get_str_value(self): <NEW_LINE> <INDENT> if not self.value: <NEW_LINE> <INDENT> return self.factory.message <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return self.value.strftime(self.factory.strftime) | Use a TextEditor for the view. | 62599039cad5886f8bdc5955 |
class MarkovTransitionMatrix: <NEW_LINE> <INDENT> def __init__( self, transition_matrix_df ): <NEW_LINE> <INDENT> self.transition_matrix_df = transition_matrix_df <NEW_LINE> self.column_names = self.transition_matrix_df.columns.values <NEW_LINE> self.total_column = 'row_total' <NEW_LINE> <DEDENT> def __repr__(self): <N... | DON'T FORGET YOUR DOCSTRING!
You forgot your docstring, didn't you... | 62599039b57a9660fecd2c2d |
class Users(AbstractUser): <NEW_LINE> <INDENT> display = models.CharField('显示的中文名', max_length=50, default='') <NEW_LINE> ding_user_id = models.CharField('钉钉UserID', max_length=64, blank=True) <NEW_LINE> wx_user_id = models.CharField('企业微信UserID', max_length=64, blank=True) <NEW_LINE> feishu_open_id = models.CharField(... | 用户信息扩展 | 62599039ec188e330fdf9a4a |
class Request(object): <NEW_LINE> <INDENT> def __init__(self, username=None, pin=None, amount=None, new_pin=None,): <NEW_LINE> <INDENT> self.username = username <NEW_LINE> self.pin = pin <NEW_LINE> self.amount = amount <NEW_LINE> self.new_pin = new_pin <NEW_LINE> <DEDENT> def read(self, iprot): <NEW_LINE> <INDENT> if i... | Attributes:
- username
- pin
- amount
- new_pin | 625990391d351010ab8f4ccd |
class CompositeRequest(WebServiceRequest): <NEW_LINE> <INDENT> __metaclass__ = abc.ABCMeta <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> super(CompositeRequest, self).__init__() <NEW_LINE> self.operations = [] <NEW_LINE> <DEDENT> def web_service_request_model(self): <NEW_LINE> <INDENT> return idempierewsc.enums.We... | CompositeRequest. Web Service Request | 6259903973bcbd0ca4bcb43c |
class BrotherPrinterSensor(Entity): <NEW_LINE> <INDENT> def __init__(self, coordinator, kind, device_info): <NEW_LINE> <INDENT> self._name = f"{coordinator.data[ATTR_MODEL]} {SENSOR_TYPES[kind][ATTR_LABEL]}" <NEW_LINE> self._unique_id = f"{coordinator.data[ATTR_SERIAL].lower()}_{kind}" <NEW_LINE> self._device_info = de... | Define an Brother Printer sensor. | 6259903926068e7796d4dafb |
class CameraDriver(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> @staticmethod <NEW_LINE> def get_cameras(camera_controller): <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> @staticmethod <NEW_LINE> def get_camera(camera_controller, camera_name): <NEW_LINE> <INDENT> r... | Spoke driver object. | 6259903923e79379d538d6b3 |
class UserChangeForm(forms.ModelForm): <NEW_LINE> <INDENT> password = ReadOnlyPasswordHashField() <NEW_LINE> class Meta: <NEW_LINE> <INDENT> model = Account <NEW_LINE> fields = ( 'email', 'password', 'username', 'is_active', 'is_admin', 'is_superuser', ) <NEW_LINE> <DEDENT> def clean_password(self): <NEW_LINE> <INDENT>... | A form for updating users. Includes all the fields on
the user, but replaces the password field with admin's
password hash display field. | 6259903950485f2cf55dc133 |
class Argparser(object): <NEW_LINE> <INDENT> def __init__(self, argv=None, *args, **kwargs): <NEW_LINE> <INDENT> self._argv = argv or sys.argv[1:] <NEW_LINE> self._parser = argparse.ArgumentParser(*args, **kwargs) <NEW_LINE> <DEDENT> def add_config_arg(self, *args, **kwargs): <NEW_LINE> <INDENT> config = kwargs.pop('co... | Argument parser class. Holds the keys to argparse | 625990396fece00bbacccb5f |
class MikrotikControllerMangleSwitch(MikrotikControllerSwitch): <NEW_LINE> <INDENT> def __init__(self, inst, uid, mikrotik_controller, sid_data): <NEW_LINE> <INDENT> super().__init__(inst, uid, mikrotik_controller, sid_data) <NEW_LINE> <DEDENT> @property <NEW_LINE> def name(self) -> str: <NEW_LINE> <INDENT> if self._da... | Representation of a Mangle switch. | 6259903982261d6c5273079e |
class LeadingPersonAddForm(forms.Form): <NEW_LINE> <INDENT> name = forms.CharField(label="Imię i nazwisko") <NEW_LINE> client = forms.ModelMultipleChoiceField(queryset=Client.objects.all(), label="Klient", widget=forms.CheckboxSelectMultiple) | Formualrz nowych opiekunów Klienta | 62599039d164cc6175822127 |
class AutoRecoverableError( six.with_metaclass(_ErrorsMeta, RecoverableError)): <NEW_LINE> <INDENT> pass | If this exception was rised,
the task should be retried automatically | 62599039d4950a0f3b111719 |
class ExperimentInstance(): <NEW_LINE> <INDENT> def __init__(self, instanceIdx, mlFramework, artifactDir, slurmConfig, model, hyperparameters, dataset, optimizer, modelLabel, hyperparametersLabel, datasetLabel, optimizerLabel): <NEW_LINE> <INDENT> self.instanceIdx = instanceIdx <NEW_LINE> self.mlFramework = mlFramework... | instanceIdx - Unique index assigned to the experiment instance. Experiment label + instanceIdx provide a unique identifier for instance
mlFramework - Name of machine learning framework to use, name must match plugin name exactly
slurmConfig - Dictionary containing the arguments to pass to SLURM when executing this inst... | 6259903915baa7234946314e |
class CreateDestroyViewSet(DestroyModelMixin, CreateViewSet): <NEW_LINE> <INDENT> pass | Base view set which permit only create and destroy instances | 62599039596a897236128e52 |
class TupleLike(object): <NEW_LINE> <INDENT> def __getitem__(self, key): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def keys(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def items(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def __contains__(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def __iter... | Interface for tuple-like objects. | 62599039287bf620b6272d9e |
class ImageLabel: <NEW_LINE> <INDENT> def __init__(self, image, data, format, target_size): <NEW_LINE> <INDENT> self.format = format <NEW_LINE> self.image = cv2.resize(image, target_size) <NEW_LINE> self.target_size = target_size <NEW_LINE> self.orignal_size = (image.shape[1], image.shape[0]) <NEW_LINE> self.labels = s... | Wrap the image and label data
there are 2 types:
- labelme format: like https://github.com/wkentaro/labelme/blob/master/examples/tutorial/apc2016_obj3.json
- plaintext: like
>>>
你好,世界
11,12,21,22,31,32,41,42,你
...
<<<
more, ImageLabel is in charge of resizing to standard size (64... | 625990391f5feb6acb163da6 |
class Account: <NEW_LINE> <INDENT> interest = 0.02 <NEW_LINE> def __init__(self, account_holder): <NEW_LINE> <INDENT> self.holder = account_holder <NEW_LINE> self.balance = 0 <NEW_LINE> <DEDENT> def deposit(self, amount): <NEW_LINE> <INDENT> self.balance = self.balance + amount <NEW_LINE> return self.balance <NEW_LINE>... | An account has a balance and a holder.
>>> a = Account('John')
>>> a.deposit(10)
10
>>> a.balance
10
>>> a.interest
0.02
>>> a.time_to_retire(10.25) # 10 -> 10.2 -> 10.404
2
>>> a.balance # balance should not change
10
>>> a.time_to_retire(11) # 10 -> 10.2 -> ... -> 11.040808032
5
>>> a.time_to_retir... | 6259903921bff66bcd723e1c |
class MessagesPerTSTracker(): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.req_last_hr_q=deque() <NEW_LINE> self.max_requests_last_hr=[] <NEW_LINE> self.tscounter = Counter() <NEW_LINE> self.hour= timedelta(hours=1) <NEW_LINE> self.fmt = "%d/%b/%Y:%H:%M:%S %z" <NEW_LINE> <DEDENT> def addtoTracker(se... | #Class that tracks the maximum requests in any given hour | 62599039ac7a0e7691f7369c |
class IAttributes(INamed, IMapping): <NEW_LINE> <INDENT> taggedValue('contains', 'mixed') | Dictionary of Attributes
| 6259903994891a1f408b9fd1 |
class SearchViewlet(ViewletBase): <NEW_LINE> <INDENT> viewletNamespace ="viewletNamespace result" <NEW_LINE> def update(self): <NEW_LINE> <INDENT> query = self.request.form.get('query') <NEW_LINE> if query: <NEW_LINE> <INDENT> self.results ="""you're query is "%s" """ % query <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDEN... | SearchViewlet | 6259903910dbd63aa1c71d89 |
class Solution: <NEW_LINE> <INDENT> def mergekSortedArrays(self, arrays): <NEW_LINE> <INDENT> heap = [] <NEW_LINE> for index, array in enumerate(arrays): <NEW_LINE> <INDENT> if array != []: <NEW_LINE> <INDENT> heapq.heappush(heap, (array[0], index, 0)) <NEW_LINE> <DEDENT> <DEDENT> new = [] <NEW_LINE> while heap: <NEW_L... | @param arrays: k sorted integer arrays
@return: a sorted array | 625990398c3a8732951f770a |
class APIAccessor(APIClient): <NEW_LINE> <INDENT> def get_track_archive(self, race_id): <NEW_LINE> <INDENT> url = '/'.join((self.url, 'race', race_id, 'track_archive')) <NEW_LINE> return self._return_page(url) <NEW_LINE> <DEDENT> def get_race_task(self, race_id): <NEW_LINE> <INDENT> url = '/'.join((self.url, 'race', ra... | Implement asynchronous methods for convinient access to JSON api. | 62599039b830903b9686ed53 |
class channelConfiguration(object): <NEW_LINE> <INDENT> def __init__(self, dacChannelNumber, trapElectrodeNumber = None, smaOutNumber = None, name = None, boardVoltageRange = (-10, 10), allowedVoltageRange = (0.0, 10.0)): <NEW_LINE> <INDENT> self.dacChannelNumber = dacChannelNumber <NEW_LINE> self.trapElectrodeNumber =... | Stores complete information for each DAC channel | 625990398da39b475be043a4 |
class TestVerveResponseFlowFinder(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 testVerveResponseFlowFinder(self): <NEW_LINE> <INDENT> model = iengage_client.models.verve_response_flow_finder.Ver... | VerveResponseFlowFinder unit test stubs | 62599039004d5f362081f8bf |
class BinUtils(Package): <NEW_LINE> <INDENT> def __init__(self, version: str, gold=True): <NEW_LINE> <INDENT> self.version = version <NEW_LINE> self.gold = gold <NEW_LINE> <DEDENT> def ident(self): <NEW_LINE> <INDENT> s = 'binutils-' + self.version <NEW_LINE> if self.gold: <NEW_LINE> <INDENT> s += '-gold' <NEW_LINE> <D... | :identifier: binutils-<version>[-gold]
:param version: version to download
:param gold: whether to use the gold linker | 6259903982261d6c5273079f |
class CmdDisengage(MuxCommand): <NEW_LINE> <INDENT> key = "disengage" <NEW_LINE> aliases = ["spare"] <NEW_LINE> help_category = "battle" <NEW_LINE> def func(self): <NEW_LINE> <INDENT> cmd_check = rules.cmd_check(self.caller, self.args, "disengage", ['InCombat', 'IsTurn', 'AttacksResolved']) <NEW_LINE> if cmd_check: <NE... | Like 'pass', but can end combat. | 62599039baa26c4b54d5045d |
class TestUnversionedListMeta(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 testUnversionedListMeta(self): <NEW_LINE> <INDENT> model = k8sclient.models.unversioned_list_meta.UnversionedListMeta() | UnversionedListMeta unit test stubs | 6259903907d97122c4217e52 |
class Pool: <NEW_LINE> <INDENT> def __init__(self, periods_length, initial_balance, spread=0, amortizations=None, recovery_step=None, recovery_rate=None, repayment_rates=None, timing_vector=None): <NEW_LINE> <INDENT> self.balances = np.zeros(periods_length) <NEW_LINE> self.balances[0] = initial_balance <NEW_LINE> self.... | The `Pool` model represents the pool of assets, it allows to initialize the assets,
to calculate the delinquencies, the recoveries, the available interest rate.
.Delinquencies: to calculate delinquent assets
.Recoveries: to recover delinquent assets
Asset definition:
* id: id the of the asset
* issuer... | 62599039b57a9660fecd2c30 |
class Rectangle(): <NEW_LINE> <INDENT> def __init__(self, left, top, width, height): <NEW_LINE> <INDENT> self.top = top <NEW_LINE> self.left = left <NEW_LINE> self.width = width <NEW_LINE> self.height = height <NEW_LINE> self.right = left+width <NEW_LINE> self.bottom = top + height <NEW_LINE> <DEDENT> def contains(self... | Represents a sprite's location in the game | 62599039be383301e02549cc |
class ConcreteDiscoverRunner(DiscoverRunner): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def get_results_summary(results): <NEW_LINE> <INDENT> covered_user_stories = [] <NEW_LINE> uncovered_user_stories = [] <NEW_LINE> for user_story_id, user_story in USER_STORIES.iteritems(): <NEW_LINE> <INDENT> for category in resu... | Django test runner that exports the results to JSON format | 6259903963f4b57ef008664e |
class NumberParam(Parameter): <NEW_LINE> <INDENT> __slots__ = tuple() <NEW_LINE> def __int__(self): <NEW_LINE> <INDENT> return int(super(NumberParam, self).value()) <NEW_LINE> <DEDENT> def __float__(self): <NEW_LINE> <INDENT> return float(super(NumberParam, self).value()) <NEW_LINE> <DEDENT> def _validate(self, val, co... | A template parameter of type "Number". | 62599039b5575c28eb7135a4 |
class PrettyDict: <NEW_LINE> <INDENT> pretty_name = None <NEW_LINE> def __repr__(self): <NEW_LINE> <INDENT> attributes = ', '.join('{}={!r}'.format(k, _fmt_value(v)) for k, v in self.items()) <NEW_LINE> return '{}({})'.format(self.__class__.__name__, attributes) <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT... | Mixin for pretty user-defined dictionary printing | 625990391f5feb6acb163da8 |
class TestV1beta1Event(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 testV1beta1Event(self): <NEW_LINE> <INDENT> pass | V1beta1Event unit test stubs | 625990390fa83653e46f6090 |
class VertexError(Error): <NEW_LINE> <INDENT> def __init__(self, vertexNumber, message): <NEW_LINE> <INDENT> self.vertexNumber = vertexNumber <NEW_LINE> self.message = "VertexError: Vertex number = %s, Message = %s" % (vertexNumber,message) | Represents a VertexError exception. It handles different types of graph vertex related exceptions
\ingroup Exceptions | 6259903921bff66bcd723e1e |
class IOEngine: <NEW_LINE> <INDENT> def read(self, info, time_ranges, fields=None): <NEW_LINE> <INDENT> raise NotImplementedError <NEW_LINE> <DEDENT> def write(self, info, measurements): <NEW_LINE> <INDENT> raise NotImplementedError | This is the base class for reading and writing time-ordered data.
In the read and write functions below, "info" is a dict that
addresses some chunk of data somehow. It might simply contain a
filename, or it might contain filename and group name within an
HDF archive. | 62599039ac7a0e7691f7369e |
class ExportMonitor(EveryN): <NEW_LINE> <INDENT> @deprecated_arg_values( "2016-09-23", "The signature of the input_fn accepted by export is changing to be " "consistent with what's used by tf.Learn Estimator's train/evaluate. " "input_fn and input_feature_key will both become required args.", input_fn=None, input_featu... | Monitor that exports Estimator every N steps. | 625990398c3a8732951f770c |
class IssuesClosed(Stats): <NEW_LINE> <INDENT> def fetch(self): <NEW_LINE> <INDENT> log.info("Searching for issues closed by {0}".format(self.user)) <NEW_LINE> query = "search/issues?q=assignee:{0}+closed:{1}..{2}".format( self.user.login, self.options.since, self.options.until) <NEW_LINE> query += "+type:issue" <NEW_L... | Issues closed | 6259903966673b3332c315ab |
class UserRoleAssociation(Resource): <NEW_LINE> <INDENT> hints = { 'contract_attributes': ['id', 'role_id', 'user_id', 'tenant_id'], 'types': [('user_id', basestring), ('tenant_id', basestring)], 'maps': {'userId': 'user_id', 'roleId': 'role_id', 'tenantId': 'tenant_id'} } <NEW_LINE> def __init__(self, user_id=None, ro... | Role Grant model | 62599039e76e3b2f99fd9bc2 |
class EventDay(models.Model): <NEW_LINE> <INDENT> _name='event.day' <NEW_LINE> _order="event_date" <NEW_LINE> event_date = fields.Date('Date', required=True) <NEW_LINE> event_period = fields.Selection([('precamp', 'Pre Camp'), ('maincamp', 'Main Camp'), ('postcamp', 'Post Camp')], default='maincamp', string='Period') <... | An Event day | 62599039b830903b9686ed54 |
class Location(object): <NEW_LINE> <INDENT> def __init__(self, location_data): <NEW_LINE> <INDENT> self.location_data = location_data <NEW_LINE> <DEDENT> def __repr__(self): <NEW_LINE> <INDENT> return "%s.%s(%s, %s)" % ( self.__module__, self.__class__.__name__, self.latitude, self.longitude) <NEW_LINE> <DEDENT> def __... | Location data in an entry. | 6259903930c21e258be999c4 |
class DynamicAddressException(Exception): <NEW_LINE> <INDENT> def __init__(self, msg=""): <NEW_LINE> <INDENT> super(DynamicAddressException, self).__init__(msg) <NEW_LINE> self.msg = msg | Throw this if you try to get an address object from a dhcp interface | 6259903973bcbd0ca4bcb43f |
class WorkItemDeleteUpdate(Model): <NEW_LINE> <INDENT> _attribute_map = { 'is_deleted': {'key': 'isDeleted', 'type': 'bool'} } <NEW_LINE> def __init__(self, is_deleted=None): <NEW_LINE> <INDENT> super(WorkItemDeleteUpdate, self).__init__() <NEW_LINE> self.is_deleted = is_deleted | WorkItemDeleteUpdate.
:param is_deleted:
:type is_deleted: bool | 6259903976d4e153a661db4e |
class CompletedServerScan(object): <NEW_LINE> <INDENT> def __init__(self, server_info, plugin_result_list): <NEW_LINE> <INDENT> self.server_info = server_info <NEW_LINE> self.plugin_result_list = plugin_result_list | The results of a successful SSLyze scan on a single server.
| 62599039d53ae8145f91961c |
class Expense(db.Model): <NEW_LINE> <INDENT> id = db.Column(db.Integer, primary_key=True) <NEW_LINE> name = db.Column(db.Text) <NEW_LINE> budget = db.Column(db.Float) <NEW_LINE> spent = db.Column(db.Float, default=0) <NEW_LINE> fund_id = db.Column(db.Integer, db.ForeignKey('fund.id'), nullable=False) <NEW_LINE> fund = ... | A single Expense to be deducted from the UC budget | 6259903950485f2cf55dc138 |
class SyntaxData(syndata.SyntaxDataBase): <NEW_LINE> <INDENT> def __init__(self, langid): <NEW_LINE> <INDENT> syndata.SyntaxDataBase.__init__(self, langid) <NEW_LINE> self.SetLexer(stc.STC_LEX_PYTHON) <NEW_LINE> <DEDENT> def GetKeywords(self): <NEW_LINE> <INDENT> return [BOO_KW] <NEW_LINE> <DEDENT> def GetSyntaxSpec(se... | SyntaxData object for Boo
@todo: needs custom highlighting handler | 62599039711fe17d825e1577 |
class TestMakeIdUrl(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self._compiler = cece.compiler.Compiler(None, None) <NEW_LINE> <DEDENT> def testNoBackslash(self): <NEW_LINE> <INDENT> result = self._compiler._make_id_url("test/one") <NEW_LINE> self.assertEqual(result, "/test/one/") <NEW_... | Test ``cece.compiler.Compiler._make_id_url`` | 62599039baa26c4b54d5045f |
class Pooling: <NEW_LINE> <INDENT> def __init__(self, pool_h, pool_w, stride=1, pad=0): <NEW_LINE> <INDENT> self.pool_h = pool_h <NEW_LINE> self.pool_w = pool_w <NEW_LINE> self.stride = stride <NEW_LINE> self.pad = pad <NEW_LINE> self.x = None <NEW_LINE> self.arg_max = None <NEW_LINE> <DEDENT> def forward(self, x): <NE... | 最大池化层 | 625990393eb6a72ae038b820 |
class Vector(object): <NEW_LINE> <INDENT> def __init__(self, x=None, y=None, z=None): <NEW_LINE> <INDENT> self.x, self.y, self.z = x, y, z | 3-space vector of *x*, *y*, *z* | 62599039b5575c28eb7135a5 |
class JsonPipeline(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.f = open('detail.json','wb') <NEW_LINE> self.exporter = JsonItemExporter(self.f,encoding='utf-8') <NEW_LINE> self.exporter.start_exporting() <NEW_LINE> <DEDENT> def process_item(self, item, spider): <NEW_LINE> <INDENT> self.exp... | 使用自带方法 | 62599039d10714528d69ef67 |
class AddFileForm(forms.Form): <NEW_LINE> <INDENT> file = forms.FileField() <NEW_LINE> tags = forms.CharField(label="Теги", widget=forms.Textarea, required=False) | Add file form | 625990391f5feb6acb163daa |
class TestMath: <NEW_LINE> <INDENT> def test_calc_degrees_north_from_coords_due_north(cls): <NEW_LINE> <INDENT> assert calc_degrees_north_from_coords((0, 0), (-1, 0)) == 0 <NEW_LINE> <DEDENT> def test_calc_degrees_north_from_coords_due_east(cls): <NEW_LINE> <INDENT> assert calc_degrees_north_from_coords((0, 0), (0, -1)... | Reminder: coords are (lat, lon), which correspond to (y, x) | 6259903923e79379d538d6b8 |
class MessageSerializerTests(TestCase): <NEW_LINE> <INDENT> def test_noMultipleFields(self): <NEW_LINE> <INDENT> self.assertRaises(ValueError, _MessageSerializer, [Field("akey", identity, ""), Field("akey", identity, ""), Field("message_type", identity, "")]) <NEW_LINE> <DEDENT> def test_noBothTypeFields(self): <NEW_LI... | Tests for L{_MessageSerializer}. | 62599039b830903b9686ed55 |
class TestMessageTrailer(unittest.TestCase): <NEW_LINE> <INDENT> def test_message_trailer_to_edifact(self): <NEW_LINE> <INDENT> msg_trl = MessageTrailer(number_of_segments=5, sequence_number="00001").to_edifact() <NEW_LINE> self.assertEqual(msg_trl, "UNT+5+00001'") | Test the generating of a message trailer | 6259903950485f2cf55dc139 |
class QualityRecordAdd(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.qr = QualityRecord() <NEW_LINE> self.qwo = QualityWorkOrder() <NEW_LINE> self.qualityWorkOrder_data = { "smBusiUnitGid": "7e2c4ba1d1f64ad7b214a233c7ebb0fb", "code": pm.create_code(), "mdMaterialGid": params.Materiel... | 报检单 | 62599039d99f1b3c44d0685e |
class RunnableGenericConfig(RunnableConfig): <NEW_LINE> <INDENT> def __init__(self, suite, parent, arch): <NEW_LINE> <INDENT> super(RunnableGenericConfig, self).__init__(suite, parent, arch) <NEW_LINE> <DEDENT> def Run(self, runner, trybot): <NEW_LINE> <INDENT> stdout, stdout_secondary = Unzip(runner()) <NEW_LINE> retu... | Represents a runnable suite definition with generic traces. | 62599039dc8b845886d5476d |
class PrimaryCapsules(nn.Module): <NEW_LINE> <INDENT> def __init__(self,num_capsules=10,in_channels=32,out_channels=32): <NEW_LINE> <INDENT> super(PrimaryCapsules, self).__init__() <NEW_LINE> self.num_capsules = num_capsules <NEW_LINE> self.out_channels = out_channels <NEW_LINE> self.capsules = nn.Sequential( P4ConvP4(... | Use 2d convolution to extract capsules | 625990398a349b6b436873fc |
class RemoveOldWorkspaceInvitations(UpgradeStep): <NEW_LINE> <INDENT> def __call__(self): <NEW_LINE> <INDENT> annotations = IAnnotations(api.portal.get()) <NEW_LINE> if ANNOTATIONS_DATA_KEY in annotations: <NEW_LINE> <INDENT> del annotations[ANNOTATIONS_DATA_KEY] | Remove old workspace invitations.
| 625990398da39b475be043a8 |
class Food(models.Model): <NEW_LINE> <INDENT> name = models.CharField(max_length=50) <NEW_LINE> slug = models.SlugField() <NEW_LINE> category = models.ForeignKey('Category') <NEW_LINE> restaurant = models.ForeignKey('Restaurant') <NEW_LINE> price = models.DecimalField(max_digits=5, decimal_places=2, blank=True, null=Tr... | Defines the state and behavior of a Food object. | 6259903930c21e258be999c7 |
class Child(models.Model): <NEW_LINE> <INDENT> first_name = models.CharField(max_length=50) <NEW_LINE> middle_name = models.CharField(max_length=50, blank=True, null=True) <NEW_LINE> last_name = models.CharField(max_length=50, blank=True, null=True) <NEW_LINE> uid = models.CharField(max_length=100, blank=True, null=Tru... | This class stores the personnel information of the childrens | 625990390a366e3fb87ddb9e |
class UnBindEIPRequestSchema(schema.RequestSchema): <NEW_LINE> <INDENT> fields = { "EIPID": fields.Str(required=True, dump_to="EIPID"), "Region": fields.Str(required=True, dump_to="Region"), "ResourceID": fields.Str(required=True, dump_to="ResourceID"), "ResourceType": fields.Str(required=True, dump_to="ResourceType"),... | UnBindEIP - 解绑外网IP | 62599039d164cc617582212d |
class Red(Indicator): <NEW_LINE> <INDENT> def __call__(self, target: abjad.LogicalTie): <NEW_LINE> <INDENT> for leaf in abjad.iterate.leaves(target, pitched=True): <NEW_LINE> <INDENT> if isinstance(leaf, abjad.Chord): <NEW_LINE> <INDENT> for note_head in leaf.note_heads: <NEW_LINE> <INDENT> abjad.tweak(note_head).color... | Encoding and attaching the color red.
.. container:: example
>>> template = pang.make_single_staff_score_template()
>>> maker = pang.SegmentMaker(
... score_template=template,
... )
>>> instances = [0, 1, 2, 3]
>>> durations = [1, 1, 0.5, 0.5]
>>> pitches = [0, 0, (0, 12), 0]
>>> ... | 625990393c8af77a43b68818 |
class UserViewSet(viewsets.ModelViewSet): <NEW_LINE> <INDENT> queryset = User.objects.all() <NEW_LINE> serializer_class = UserSerializers <NEW_LINE> permission_classes = (UserViewSetPermission,) <NEW_LINE> @list_route(methods=['post'], permission_classes=(), ) <NEW_LINE> def login(self, request): <NEW_LINE> <INDENT> em... | User view set to create, login, retrieve, update and delete the question
object. | 62599039d4950a0f3b11171c |
class EmployeeContactListSerializer(AbstractBaseSerializer): <NEW_LINE> <INDENT> contact_type_name = serializers.StringRelatedField(source=CONTACT_TYPE, read_only=True) <NEW_LINE> class Meta: <NEW_LINE> <INDENT> list_serializer_class = FilteredListSerializer <NEW_LINE> model = EmployeeContact <NEW_LINE> fields = [ 'id'... | Serializer for listing Employee Contact only | 6259903991af0d3eaad3afec |
class RunAlreadyActive(ErrorDetails): <NEW_LINE> <INDENT> id: Literal["RunAlreadyActive"] = "RunAlreadyActive" <NEW_LINE> title: str = "Run Already Active" | An error if one tries to create a new run while one is already active. | 625990391d351010ab8f4cd4 |
class User(db.Model): <NEW_LINE> <INDENT> id = db.Column(db.Integer, primary_key=True) <NEW_LINE> login = db.Column(db.String(80), unique=True) <NEW_LINE> password = db.Column(db.String(64)) <NEW_LINE> country = db.Column(db.String(32)) <NEW_LINE> location = db.Column(db.String(32)) <NEW_LINE> coordinates = db.Column(d... | Create user model. For simplicity, it will store passwords
in plain text. | 62599039287bf620b6272da4 |
class TestSecondaryArchComposeBranchedImageStart(Base): <NEW_LINE> <INDENT> nodoc = True <NEW_LINE> expected_title = "compose.branched.image.start" <NEW_LINE> expected_subti = "Started building other images for Fedora 18 (arm) compose" <NEW_LINE> expected_objects = set(['branched/arm']) <NEW_LINE> msg = { "i": 1, "time... | The `release engineering
<https://fedoraproject.org/wiki/ReleaseEngineering>`_ "compose" scripts
used to produce these messages when they had
**started building live, cloud and disk images for**
a secondary arch compose for a Branched release. Since the Pungi 4
migration, all arches are included in the same compose pro... | 625990396e29344779b0180b |
class HasXCoordinateSelector(HasCoordinateSelector): <NEW_LINE> <INDENT> def __init__(self, coords=None, min_points=1, tolerance=0.1): <NEW_LINE> <INDENT> super().__init__(coords=coords, min_points=min_points, tolerance=tolerance) <NEW_LINE> <DEDENT> def filter(self, objectList): <NEW_LINE> <INDENT> r = [] <NEW_LINE> f... | A CQ Selector class which filters edges which have specified values
for their X coordinate | 6259903994891a1f408b9fd4 |
class Bleasdale(Component): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> Component.__init__(self, ('a', 'b', 'c')) <NEW_LINE> self.c.value = 1.0 <NEW_LINE> <DEDENT> def function(self, x): <NEW_LINE> <INDENT> a = self.a.value <NEW_LINE> b = self.b.value <NEW_LINE> c = self.c.value <NEW_LINE> abx = (a + b ... | Bleasdale function component.
f(x) = (a+b*x)^(-1/c)
Attributes
----------
a : Float
b : Float
c : Float | 625990398e05c05ec3f6f738 |
class TestQueryEvent(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 testQueryEvent(self): <NEW_LINE> <INDENT> pass | QueryEvent unit test stubs | 6259903930dc7b76659a09ed |
class CalculatedFieldValidator(BaseValidator): <NEW_LINE> <INDENT> def __init__(self, prop): <NEW_LINE> <INDENT> super(CalculatedFieldValidator, self).__init__(prop) <NEW_LINE> <DEDENT> @property <NEW_LINE> def allowed_arguments(self): <NEW_LINE> <INDENT> self._allowed_args.clear() <NEW_LINE> self._allowed_args["max_di... | Validator for the calculated field | 62599039287bf620b6272da5 |
class SocketClosedRemote (NetworkError): <NEW_LINE> <INDENT> pass | This indicates that the socket was closed on the remote end. | 6259903976d4e153a661db50 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.