code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class CannotDisseminateFormat(OAI_PMH_Exception): <NEW_LINE> <INDENT> def __init__(self, msg=None): <NEW_LINE> <INDENT> self.code = "cannotDisseminateFormat" <NEW_LINE> self.msg = "The metadata format identified by the value given for the metadataPrefix argument is not supported by the item or by the repository." <NEW_... | cannotDisseminateFormat error. | 625990418e05c05ec3f6f7b4 |
class MyTopo( Topo ): <NEW_LINE> <INDENT> def __init__( self ): <NEW_LINE> <INDENT> Topo.__init__( self ) <NEW_LINE> h1 = self.addHost( 'h1' ) <NEW_LINE> h2 = self.addHost( 'h2' ) <NEW_LINE> h3 = self.addHost( 'h3' ) <NEW_LINE> h4 = self.addHost( 'h4' ) <NEW_LINE> h5 = self.addHost( 'h5' ) <NEW_LINE> h6 = self.addHost(... | Topology used in SOFTmon article | 6259904130dc7b76659a0ae4 |
class CreateDirectConnectTunnelResponse(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.DirectConnectTunnelIdSet = None <NEW_LINE> self.RequestId = None <NEW_LINE> <DEDENT> def _deserialize(self, params): <NEW_LINE> <INDENT> self.DirectConnectTunnelIdSet = params.get("DirectConnectTunne... | CreateDirectConnectTunnel返回参数结构体
| 6259904107f4c71912bb06e4 |
class Node: <NEW_LINE> <INDENT> def __init__(self, state, parent=None, action=None, path_cost=0): <NEW_LINE> <INDENT> self.state = state <NEW_LINE> self.parent = parent <NEW_LINE> self.action = action <NEW_LINE> self.path_cost = path_cost <NEW_LINE> self.depth = 0 <NEW_LINE> if parent: <NEW_LINE> <INDENT> self.depth = ... | A node in a search tree. Contains a pointer to the parent (the node
that this is a successor of) and to the actual state for this node. Note
that if a state is arrived at by two paths, then there are two nodes with
the same state. Also includes the action that got us to this state, and
the total path_cost (also known ... | 625990411f5feb6acb163ea6 |
class IS_DEVICE_INFO_HEARTBEAT(ctypes.Structure): <NEW_LINE> <INDENT> _fields_ = [("reserved_1", wt.BYTE * 24), ("dwRuntimeFirmwareVersion", wt.DWORD), ("reserved_2", wt.BYTE * 8), ("wTemperature", wt.WORD), ("wLinkSpeed_Mb", wt.WORD), ("reserved_3", wt.BYTE * 6), ("wComportOffset", wt.WORD), ("reserved", wt.BYTE * 200... | :var BYTE[24] reserved_1:
:var DWORD dwRuntimeFirmwareVersion:
:var BYTE[8] reserved_2:
:var WORD wTemperature:
:var WORD wLinkSpeed_Mb:
:var BYTE[6] reserved_3:
:var WORD wComportOffset:
:var BYTE[200] reserved: | 625990418da39b475be044a1 |
class OrderableStackedInline(StackedInline): <NEW_LINE> <INDENT> class Media: <NEW_LINE> <INDENT> js = (INLINE_ORDERING_JS,) | Adds necessary media files to regular Django StackedInline | 6259904194891a1f408ba050 |
class TAState: <NEW_LINE> <INDENT> _state: Dict[str, Dict[str, List[ComparableTensor]]] <NEW_LINE> def __init__(self, topology: Topology): <NEW_LINE> <INDENT> self._record_state(topology) <NEW_LINE> <DEDENT> def _record_state(self, topology: Topology): <NEW_LINE> <INDENT> self._state = {} <NEW_LINE> for node in self.ge... | Records the state of the toy architecture nodes.
The state is defined by the tensors pointed to by the memory_blocks attribute.
Currently, the state is recorded as a dictionary of nodes, attributes, and cloned tensors.
If this is inefficient, cloned tensors could be replaced with checksums. | 6259904130c21e258be99ac0 |
class LinkedList: <NEW_LINE> <INDENT> def __init__(self, max_length): <NEW_LINE> <INDENT> self.head = None <NEW_LINE> self.length = 0 <NEW_LINE> self.max_length = max_length <NEW_LINE> <DEDENT> def sorted_insert_data(self, new_data): <NEW_LINE> <INDENT> new_node = Node(new_data) <NEW_LINE> self.sorted_insert_node(new_n... | LinkedList: a ascending ordered linked list with a maximum length. | 6259904107f4c71912bb06e5 |
class LTESlice(Slice): <NEW_LINE> <INDENT> default_properties = { 'rbgs': 5, 'ue_scheduler': UE_SLICE_SCHEDULER_RR } <NEW_LINE> def to_str(self): <NEW_LINE> <INDENT> msg = "[LTE] id %s rbgs %s ue_scheduler %s" <NEW_LINE> return msg % (self.slice_id, self.properties['rbgs'], UE_SLICE_SCHEDULERS[self.properties['ue_sched... | EmPOWER LTE Slice Class. | 6259904150485f2cf55dc238 |
class Database(object): <NEW_LINE> <INDENT> fields = ('time', 'latitude_from', 'longitude_from', 'latitude_to', 'longitude_to', 'transit_response', 'driving_response') <NEW_LINE> dtypes = ('real', 'real', 'real', 'real', 'real', 'text', 'text') <NEW_LINE> def __init__(self, path, buffer_size=100): <NEW_LINE> <INDENT> t... | Take the information from Google Maps and stuff it into a database | 62599041097d151d1a2c231b |
class htmlparser(HTMLParser): <NEW_LINE> <INDENT> def __init__(self, n=50): <NEW_LINE> <INDENT> HTMLParser.__init__(self) <NEW_LINE> self.start = None <NEW_LINE> self.links = [] <NEW_LINE> self.count = 0 <NEW_LINE> self.n = n <NEW_LINE> <DEDENT> def handle_starttag(self, tag, attribs): <NEW_LINE> <INDENT> if (tag == 'a... | HTML Parser to parse scraped data from website | 62599041d99f1b3c44d06950 |
@export <NEW_LINE> class Algorithm(Enum): <NEW_LINE> <INDENT> Unknown = 0 <NEW_LINE> MD5 = 1 <NEW_LINE> SHA1 = 2 <NEW_LINE> SHA256 = 3 <NEW_LINE> SHA256AC = 4 | FileHash Algorithm Enumeration. | 625990418e71fb1e983bcd82 |
class Consumer(models.Model): <NEW_LINE> <INDENT> name = models.CharField(max_length=100, unique=True) <NEW_LINE> key = models.CharField(max_length=255, unique=True) <NEW_LINE> secret = models.CharField(max_length=64) <NEW_LINE> @staticmethod <NEW_LINE> def get_consumer(consumer_key): <NEW_LINE> <INDENT> return Consume... | Each LMS which connects is considered a consumer and must have an
entry in this table. Two LMSes may not share the same consumer key
unless they can be certain that no two users will share the same ID. | 62599041b57a9660fecd2d30 |
class Solution: <NEW_LINE> <INDENT> def maxDepth(self, root): <NEW_LINE> <INDENT> dept = 0 <NEW_LINE> if root is None: <NEW_LINE> <INDENT> return dept <NEW_LINE> <DEDENT> q = [] <NEW_LINE> q.append(root) <NEW_LINE> while len(q) != 0: <NEW_LINE> <INDENT> length = len(q) <NEW_LINE> for i in range(length): <NEW_LINE> <IND... | @param root: The root of binary tree.
@return: An integer | 625990418a43f66fc4bf3446 |
class FeatureWriter(object): <NEW_LINE> <INDENT> def __init__(self, filename, mode): <NEW_LINE> <INDENT> self.filename = filename <NEW_LINE> self.mode = mode <NEW_LINE> self.num_features = 0 <NEW_LINE> self._writer = tf.python_io.TFRecordWriter(filename) <NEW_LINE> <DEDENT> def process_feature(self, feature): <NEW_LINE... | Writes InputFeature to TF example file. | 6259904123e79379d538d7b4 |
class MinEffortTask(JointVelocityTask): <NEW_LINE> <INDENT> def __init__(self, model, weight=1., constraints=[]): <NEW_LINE> <INDENT> super(MinEffortTask, self).__init__(model=model, weight=weight, constraints=constraints) <NEW_LINE> raise NotImplementedError("This class has not been implemented yet.") | Minimum Effort Task
"This class implements a task that tries to bring the robot in a minimum-effort posture." [1]
References:
- [1] "OpenSoT: A whole-body control library for the compliant humanoid robot COMAN", Rocchi et al., 2015 | 6259904166673b3332c316ae |
class MixedProtocol(StructProtocol): <NEW_LINE> <INDENT> def __init__(self, dataRootPath, cMapPath, prevStepPaths=None, verbose=False): <NEW_LINE> <INDENT> StructProtocol.__init__(self, dataRootPath, cMapPath, prevStepPaths, singleChainfeatsToInclude=FEATURES_TO_INCLUDE_CHAIN, pairfeatsToInclude= FEATURES_TO_INCLUDE_PA... | This class implements structural voronoi environment codification | 6259904107d97122c4217f54 |
class TestingConfig(BaseConfig): <NEW_LINE> <INDENT> TESTING = True | Testing settings | 625990418a349b6b436874fd |
class build_ext(_build_ext): <NEW_LINE> <INDENT> def finalize_options(self): <NEW_LINE> <INDENT> _build_ext.finalize_options(self) <NEW_LINE> __builtins__.__NUMPY_SETUP__ = False <NEW_LINE> import numpy <NEW_LINE> self.include_dirs.append(numpy.get_include()) | to install numpy | 6259904116aa5153ce4017a2 |
class ClearbitCompanyDomainAlias(models.Model): <NEW_LINE> <INDENT> clearbit_company = models.ForeignKey(ClearbitCompany) <NEW_LINE> domain = models.URLField() <NEW_LINE> clearbit_dl_datetime = models.DateTimeField() | Company domain aliases. | 6259904130c21e258be99ac2 |
class AboutFrame(LabelFrame): <NEW_LINE> <INDENT> def __init__(self, parent): <NEW_LINE> <INDENT> LabelFrame.__init__(self, parent, text='About instamatic') <NEW_LINE> self.parent = parent <NEW_LINE> frame = Frame(self) <NEW_LINE> Label(frame, text='').grid(row=0, column=0, sticky='W') <NEW_LINE> Label(frame, text='Con... | `About` panel for the GUI. | 62599041ec188e330fdf9b4f |
class OpenVPNError(RuntimeError): <NEW_LINE> <INDENT> pass | Errors from the OpenVPN subprocess | 625990416fece00bbacccc67 |
class StatusType(enum.Enum): <NEW_LINE> <INDENT> UP = 'UP' <NEW_LINE> DOWN = 'DOWN' <NEW_LINE> STARTING = 'STARTING' <NEW_LINE> OUT_OF_SERVICE = 'OUT_OF_SERVICE' <NEW_LINE> UNKNOWN = 'UNKNOWN' | Available status types with eureka, these can be used
for any `EurekaClient.register` call to pl | 6259904115baa72349463247 |
class UserSource(base.MarxTest): <NEW_LINE> <INDENT> title = 'Compiling a USER source' <NEW_LINE> figures = OrderedDict([('ds9', {'alternative': 'A point source', 'caption': '`ds9`_ shows that the distribution of source is indeed a point source.'}) ]) <NEW_LINE> @base.Python <NEW_LINE> def step_1(self): <NEW_LINE> <IND... | Run an example for a USER source.
|marx| comes with several examples for user written source in C.
These can be compiled as shared objects and dynamically linked into |marx|
at run time.
To test this, we copy one of the source files from the installed |marx|
version and compile it with gcc. This particular case is not... | 6259904163b5f9789fe86421 |
class Property(_BasicMixin): <NEW_LINE> <INDENT> values = models.ForeignKey('ValueSet', default=ValueSet.BOOLEAN) <NEW_LINE> class Meta: <NEW_LINE> <INDENT> app_label = 'brubeck' <NEW_LINE> verbose_name_plural = 'properties' <NEW_LINE> <DEDENT> def allowed_values(self): <NEW_LINE> <INDENT> return Value.objects.filter(v... | Represents a property like "compact" or "Hausdorff" | 6259904107d97122c4217f55 |
class MdbExp(list): <NEW_LINE> <INDENT> @property <NEW_LINE> def name(self): <NEW_LINE> <INDENT> return self._id <NEW_LINE> <DEDENT> @property <NEW_LINE> def title(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return self._title <NEW_LINE> <DEDENT> except AttributeError: <NEW_LINE> <INDENT> self._title = None <NE... | Describes a single experiment ID, which has a collection of its stanzas as
well as some additional data that should typically be consistent across all
the stanzas, as well as verifying that the data is in fact consistent. | 6259904145492302aabfd791 |
class Server(socketserver.ThreadingTCPServer): <NEW_LINE> <INDENT> clients = {} <NEW_LINE> allow_reuse_address = True <NEW_LINE> def __init__(self, server_address, RequestHandlerClass, base, bind_and_activate=True): <NEW_LINE> <INDENT> socketserver.ThreadingTCPServer.__init__( self, server_address, RequestHandlerClass,... | class Server | 6259904107f4c71912bb06e8 |
class Passthrough(Component): <NEW_LINE> <INDENT> text_in = File(iotype='in', local_path='tout', legal_types=['xyzzy', 'txt']) <NEW_LINE> binary_in = File(iotype='in', local_path='bout') <NEW_LINE> text_out = File(path='tout', iotype='out') <NEW_LINE> binary_out = File(path='bout', iotype='out', binary=True) <NEW_LINE>... | Copies input files (implicitly via local_path) to output. | 62599041004d5f362081f940 |
class InvalidType(Exception): <NEW_LINE> <INDENT> def __init__(self, expect, actual): <NEW_LINE> <INDENT> msg = 'Expect: {0}\nActual: {1}'.format(expect, actual) <NEW_LINE> super(InvalidType, self).__init__(msg) <NEW_LINE> self.expect = expect <NEW_LINE> self.actual = actual | Raised when types of data for forward/backward are invalid.
| 625990411f5feb6acb163eaa |
class Appointment(object): <NEW_LINE> <INDENT> def __init__(self, patient_first_name, patient_last_name, date, time, kind): <NEW_LINE> <INDENT> self.patient_first_name = patient_first_name <NEW_LINE> self.patient_last_name = patient_last_name <NEW_LINE> self.date = date <NEW_LINE> self.time = time <NEW_LINE> self.kind ... | Class holds all the data of an appointment. | 6259904124f1403a92686228 |
class MockConnection(): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.mock_cursor = MagicMock() <NEW_LINE> <DEDENT> def cursor(self): <NEW_LINE> <INDENT> return self.mock_cursor <NEW_LINE> <DEDENT> def close(self): <NEW_LINE> <INDENT> print("mock connect close.") <NEW_LINE> <DEDENT> def commit(self):... | Mocked Connection class, will mocking class of psycopg2.connection. | 62599041596a897236128f0a |
class Page(models.Model): <NEW_LINE> <INDENT> category = models.ForeignKey(Category) <NEW_LINE> title = models.CharField(max_length=128) <NEW_LINE> url = models.URLField() <NEW_LINE> views = models.IntegerField(default=0) <NEW_LINE> def __unicode__(self): <NEW_LINE> <INDENT> return self.title | 页面属于那一类 题目 链接 浏览量 | 6259904107d97122c4217f56 |
class NormalizeContrast(BaseFilter): <NEW_LINE> <INDENT> def __init__(self, region='all', mode=None, cutoff=0): <NEW_LINE> <INDENT> BaseFilter.__init__(self) <NEW_LINE> if mode is not None: <NEW_LINE> <INDENT> region = mode <NEW_LINE> <DEDENT> if region not in ('all', 'bbox', 'mask'): <NEW_LINE> <INDENT> raise RuntimeE... | Perform contrast normalization on the image. | 6259904107f4c71912bb06e9 |
class BinaryRule(Rule): <NEW_LINE> <INDENT> def __init__(self, subjects, predicate): <NEW_LINE> <INDENT> super(BinaryRule, self).__init__(subjects, predicate) <NEW_LINE> if len(self.subjects) != 2: <NEW_LINE> <INDENT> raise ValueError('This is not a binary rule.') <NEW_LINE> <DEDENT> self.reference = 1 if self.subjects... | Binary rule on operators.
An operator rule is a relation that can be expressed by the sentence
"'subjects' are 'predicate'". An instance of this class, when called with
two input arguments checks if the inputs are subjects to the rule, and
returns the predicate if it is the case. Otherwise, it returns None.
Parameter... | 6259904116aa5153ce4017a4 |
class CMFGENHydLParser(BaseParser): <NEW_LINE> <INDENT> nu_ratio_key = 'L_DEL_U' <NEW_LINE> def load(self, fname): <NEW_LINE> <INDENT> header = parse_header(fname) <NEW_LINE> self.header = header <NEW_LINE> self.max_l = self.get_max_l() <NEW_LINE> self.num_xsect_nus = int(header['Number of values per cross-section']) <... | Parser for the CMFGEN hydrogen photoionization cross sections.
Attributes
----------
base : pandas.DataFrame, dtype float
Photoionization cross section table for hydrogen. Values are the
common logarithm (i.e. base 10) of the cross section in units cm^2.
Indexed by the principal quantum number n and orbita... | 62599041d6c5a102081e33dd |
class CredentialError(ClientError): <NEW_LINE> <INDENT> pass | Could not connect client using given credentials | 625990416fece00bbacccc69 |
class LyAssignment(LyObject): <NEW_LINE> <INDENT> def __init__(self, assignmentId = None, identifierInit = None, propertyPath = None, embeddedScm = None): <NEW_LINE> <INDENT> LyObject.__init__(self) <NEW_LINE> self.assignmentId = assignmentId <NEW_LINE> self.identifierInit = identifierInit <NEW_LINE> self.propertyPath ... | one of three forms of assignment:
assignment_id '=' identifier_init
assignment_id property_path '=' identifier_init
embedded_scm
if self.embeddedScm is not None, uses type 3
if self.propertyPath is not None, uses type 2
else uses type 1 or raises an exception.
>>> lyii = lily.lilyObjects.LyIdentifierInit(str... | 6259904115baa72349463249 |
class ListModeratorRequiredTest(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> from django.test.client import RequestFactory <NEW_LINE> from postorius.tests.utils import create_mock_list <NEW_LINE> self.request_factory = RequestFactory() <NEW_LINE> list_name = 'foolist.example.org' <NEW_LI... | Tests the list_owner_required auth decorator. | 62599041d10714528d69efe8 |
class Player(object): <NEW_LINE> <INDENT> def __init__(self, name, state): <NEW_LINE> <INDENT> self._name = name <NEW_LINE> self._state = state <NEW_LINE> <DEDENT> def change_state(self, state): <NEW_LINE> <INDENT> self._state = state <NEW_LINE> <DEDENT> def play(self): <NEW_LINE> <INDENT> print(self._name + self._stat... | Context | 625990414e696a045264e77d |
class PrivateTagsApiTests(TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.user = get_user_model().objects.create_user( 'test@gmail.com', 'password123' ) <NEW_LINE> self.client = APIClient() <NEW_LINE> self.client.force_authenticate(self.user) <NEW_LINE> <DEDENT> def test_retrieve_tags(self): <N... | Test the authorized user tags API | 6259904196565a6dacd2d8e6 |
class PurgePathCacheRequest(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.Paths = None <NEW_LINE> self.FlushType = None <NEW_LINE> <DEDENT> def _deserialize(self, params): <NEW_LINE> <INDENT> self.Paths = params.get("Paths") <NEW_LINE> self.FlushType = params.get("FlushType") | PurgePathCache request structure.
| 6259904163b5f9789fe86423 |
class InvokerHandler(AbstractMessageDriver): <NEW_LINE> <INDENT> DEFAULT_TIMEOUT = None <NEW_LINE> def __init__(self, channel): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.channel = channel <NEW_LINE> self.invoking_thread = MessageThread(target=self.__dealing_invoker, name='invoking') <NEW_LINE> self.retriev... | \ 支持异步的RPC消息处理者。 一方面负责自动将消息从这端发送出去,另一方面负责自动从对端接收RPC消息
\ 内部通过引入两个线程以及对应的消息队列,实现消息的发送和接收并行。 | 62599041287bf620b6272e9e |
class AnnotationAdapter(object): <NEW_LINE> <INDENT> ANNOTATION_KEY = None <NEW_LINE> def __init__(self, context): <NEW_LINE> <INDENT> self.context = context <NEW_LINE> annotations = IAnnotations(context) <NEW_LINE> self._data = annotations.get(self.ANNOTATION_KEY, None) <NEW_LINE> <DEDENT> def __setattr__(self, name, ... | Abstract Base Class for an annotation storage.
If the annotation wasn't set, it won't be created until the first attempt
to set a property on this adapter.
So, the context doesn't get polluted with annotations by accident. | 62599041379a373c97d9a2e1 |
class BaseAPIView(APIView): <NEW_LINE> <INDENT> def get_serializer_context(self): <NEW_LINE> <INDENT> return { 'request': self.request, 'view': self, } <NEW_LINE> <DEDENT> def get_serializer_class(self): <NEW_LINE> <INDENT> assert self.serializer_class is not None, ( "'%s' should either include a `serializer_class` att... | Base API View | 62599041b57a9660fecd2d33 |
class Z(Group): <NEW_LINE> <INDENT> def __init__(self, order): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.order = order <NEW_LINE> <DEDENT> def __iter__(self): <NEW_LINE> <INDENT> return product(range(self.order), [1]) | Cyclic group on {0, 1, ..., n-1}. | 625990410fa83653e46f6192 |
class NonBlockingStreamReader: <NEW_LINE> <INDENT> def __init__(self, stream): <NEW_LINE> <INDENT> self._s = stream <NEW_LINE> self._q = Queue() <NEW_LINE> def _populateQueue(stream, queue): <NEW_LINE> <INDENT> while True: <NEW_LINE> <INDENT> line = stream.readline() <NEW_LINE> if line: <NEW_LINE> <INDENT> queue.put(li... | A non-blocking stream reader
Open a separate thread which reads lines from the stream whenever data
becomes available and stores the data in a queue.
Based on: http://eyalarubas.com/python-subproc-nonblock.html
Keyword arguments:
- stream -- The stream to read from | 625990418a43f66fc4bf344a |
class MemoryError(StandardError): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> @staticmethod <NEW_LINE> def __new__(S, *more): <NEW_LINE> <INDENT> pass | Out of memory. | 6259904123e79379d538d7b8 |
class AiReviewPoliticalAsrTaskOutput(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.Confidence = None <NEW_LINE> self.Suggestion = None <NEW_LINE> self.SegmentSet = None <NEW_LINE> <DEDENT> def _deserialize(self, params): <NEW_LINE> <INDENT> self.Confidence = params.get("Confidence") <... | Asr 文字涉政信息
| 6259904121bff66bcd723f24 |
class FadeOutDownTiles(FadeOutUpTiles): <NEW_LINE> <INDENT> def test_func(self, i, j, t): <NEW_LINE> <INDENT> x, y = self.grid * (1 - t) <NEW_LINE> if j == 0: <NEW_LINE> <INDENT> return 1 <NEW_LINE> <DEDENT> return pow(y / j, 6) | Fades out each tile following an downwards path until all the tiles are faded out.
Example::
scene.do(FadeOutDownTiles(grid=(16,12), duration=5)) | 62599041d6c5a102081e33df |
class TestMedSig(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def test_medsig(self): <NEW_LINE> <INDENT> arr = normal(14, 5, 50000) <NEW_LINE> m,s = medsig(arr) <NEW_LINE> npt.assert_almost_equal(m, 14, decimal=1) <NEW_LINE> npt.assert_almost_equal(s, 5, decimal... | Test the median and sigma calculation
| 62599041d4950a0f3b11179d |
@LOSSES.register_module() <NEW_LINE> class GaussianFocalLoss(nn.Module): <NEW_LINE> <INDENT> def __init__(self, alpha=2.0, gamma=4.0, reduction='mean', loss_weight=1.0): <NEW_LINE> <INDENT> super(GaussianFocalLoss, self).__init__() <NEW_LINE> self.alpha = alpha <NEW_LINE> self.gamma = gamma <NEW_LINE> self.reduction = ... | GaussianFocalLoss is a variant of focal loss.
More details can be found in the `paper
<https://arxiv.org/abs/1808.01244>`_
Code is modified from `kp_utils.py
<https://github.com/princeton-vl/CornerNet/blob/master/models/py_utils/kp_utils.py#L152>`_ # noqa: E501
Please notice that the target in GaussianFocalLoss is a ... | 62599041c432627299fa425e |
class GraphicalButton(Button): <NEW_LINE> <INDENT> def __init__(self, master, filename, command): <NEW_LINE> <INDENT> img = PhotoImage(file=filename) <NEW_LINE> Button.__init__(self, master, image=img, command=command, borderwidth=.001) <NEW_LINE> self.image = img | Creates a graphical button using the filename for the image, and the
command as the bound function/method. Filename must include extension. | 62599041507cdc57c63a6056 |
class RegEx(): <NEW_LINE> <INDENT> def __init__(self, needle): <NEW_LINE> <INDENT> self.needle = "%s" % needle <NEW_LINE> <DEDENT> def seekIn(self, haystack): <NEW_LINE> <INDENT> m = re.match(re.compile(self.needle, flags=re.S), "%s" % haystack) <NEW_LINE> if m: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> retur... | reg expresion operator | 6259904176d4e153a661dbd1 |
class V8: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self._v8 = _V8() <NEW_LINE> <DEDENT> def eval(self, src): <NEW_LINE> <INDENT> if not isinstance(src, basestring): <NEW_LINE> <INDENT> raise TypeError('source code not string') <NEW_LINE> <DEDENT> res = self._v8.eval(src) <NEW_LINE> if res == 'undefin... | Represents a V8 instance. | 625990413c8af77a43b68899 |
@runtime_checkable <NEW_LINE> class CompleterFuncWithTokens(Protocol): <NEW_LINE> <INDENT> def __call__( self, text: str, line: str, begidx: int, endidx: int, *, arg_tokens: Dict[str, List[str]] = {}, ) -> List[str]: <NEW_LINE> <INDENT> ... | Function to support tab completion with the provided state of the user prompt and accepts a dictionary of prior
arguments. | 625990418c3a8732951f7813 |
class ArticleIteratorArgumentParser(object): <NEW_LINE> <INDENT> def __init__(self, article_iterator, category_fetcher): <NEW_LINE> <INDENT> self.article_iterator = article_iterator <NEW_LINE> self.category_fetcher = category_fetcher <NEW_LINE> <DEDENT> def check_argument(self, argument): <NEW_LINE> <INDENT> if argumen... | Parse command line arguments -limit: and -category: and set to ArticleIterator | 6259904115baa7234946324c |
class RubyClasslike(RubyObject): <NEW_LINE> <INDENT> def get_signature_prefix(self, sig): <NEW_LINE> <INDENT> return self.objtype + ' ' <NEW_LINE> <DEDENT> def get_index_text(self, modname, name_cls): <NEW_LINE> <INDENT> if self.objtype == 'class': <NEW_LINE> <INDENT> if not modname: <NEW_LINE> <INDENT> return _('%s (c... | Description of a class-like object (classes, exceptions). | 625990418a43f66fc4bf344c |
class StateManager(object): <NEW_LINE> <INDENT> GAME = 0 <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> self.__states = Stack() <NEW_LINE> self.current_state = StateManager.GAME <NEW_LINE> <DEDENT> @property <NEW_LINE> def state(self): <NEW_LINE> <INDENT> return self.__states.peek() <NEW_LINE> <DEDENT> def set_stat... | This controller manage all game states. | 62599041e64d504609df9d2e |
class BlobLinguaFixture(PloneTestCaseFixture): <NEW_LINE> <INDENT> defaultBases = (PTC_FIXTURE, ) <NEW_LINE> def setUpZope(self, app, configurationContext): <NEW_LINE> <INDENT> from plone.app import imaging <NEW_LINE> self.loadZCML(package=imaging) <NEW_LINE> from plone.app.blob import tests <NEW_LINE> self.loadZCML(na... | layer for integration tests with LinguaPlone | 6259904123e79379d538d7ba |
class PFJet(object): <NEW_LINE> <INDENT> def __init__(self, jets, index): <NEW_LINE> <INDENT> read_attributes = [ 'etCorr', 'muMult', 'eta', 'phi', 'nhef', 'pef', 'mef', 'chMult', 'elMult', 'nhMult', 'phMult', 'chef', 'eef', 'nemef', 'cMult', 'nMult', 'cemef' ] <NEW_LINE> for attr in read_attributes: <NEW_LINE> <INDENT... | Create a simple python wrapper for
L1Analysis::L1AnalysisRecoJetDataFormat | 625990418a349b6b43687503 |
class ModelMultiValueField(BaseModelMulti): <NEW_LINE> <INDENT> widget_class = ModelMultiValueWidget | A field class which provides a sub-form for a model.
| 6259904110dbd63aa1c71e93 |
class Peek(Subconstruct): <NEW_LINE> <INDENT> __slots__ = ["perform_build"] <NEW_LINE> def __init__(self, subcon, perform_build = False): <NEW_LINE> <INDENT> Subconstruct.__init__(self, subcon) <NEW_LINE> self.perform_build = perform_build <NEW_LINE> <DEDENT> def _parse(self, stream, context): <NEW_LINE> <INDENT> pos =... | Peeks at the stream: parses without changing the stream position.
See also Union. If the end of the stream is reached when peeking,
returns None.
.. note:: Requires a seekable stream.
:param subcon: the subcon to peek at
:param perform_build: whether or not to perform building. by default this
p... | 62599041b5575c28eb713627 |
class RandomNoiseTile(FetchedTile): <NEW_LINE> <INDENT> @property <NEW_LINE> def shape(self) -> Mapping[Axes, int]: <NEW_LINE> <INDENT> return {Axes.Y: 1536, Axes.X: 1024} <NEW_LINE> <DEDENT> @property <NEW_LINE> def coordinates(self) -> Mapping[Union[str, Coordinates], CoordinateValue]: <NEW_LINE> <INDENT> return { Co... | This is a simple implementation of :class:`.FetchedImage` that simply regenerates random data
for the image. | 6259904176d4e153a661dbd2 |
class ToolEnableAllNavigation(ToolBase): <NEW_LINE> <INDENT> description = 'Enable all axes toolmanager' <NEW_LINE> default_keymap = rcParams['keymap.all_axes'] <NEW_LINE> def trigger(self, sender, event, data=None): <NEW_LINE> <INDENT> if event.inaxes is None: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> for a in se... | Tool to enable all axes for toolmanager interaction | 6259904123849d37ff852376 |
class AsyncRequestError(Exception): <NEW_LINE> <INDENT> def __init__(self, raised='', message='', status_code=0, request=None): <NEW_LINE> <INDENT> self.raised = raised <NEW_LINE> self.message = message <NEW_LINE> self.status_code = status_code <NEW_LINE> self.request = request <NEW_LINE> super().__init__(f"raised={sel... | A wrapper of all possible exception during a HTTP request | 62599041b57a9660fecd2d37 |
class TestIosXrPluginPrompts(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self._conn = Connection( hostname='Router', start=['mock_device_cli --os iosxr --state enable'], os='iosxr', ) <NEW_LINE> self._conn.connect() <NEW_LINE> <DEDENT> def test_confirm(self): <NEW_LINE> <INDENT> self._c... | Tests for prompt handling. | 625990418e71fb1e983bcd8a |
class LongIronButterfly(_Butterfly): <NEW_LINE> <INDENT> def __init__( self, St=None, K1=None, K2=None, K3=None, price1=None, price2=None, price3=None, ): <NEW_LINE> <INDENT> super().__init__( St=St, K1=K1, K2=K2, K3=K3, price1=price1, price2=price2, price3=price3, ) <NEW_LINE> self.add_option(K=K1, price=price1, St=St... | Combination of 2 puts and 2 calls. Long volatility exposure.
- Short K1 (put)
- Long 2x K2 (1 put, 1 call)
- Short K3 (call) | 62599041e76e3b2f99fd9cc7 |
class One: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super().__init__() | One. | 6259904130dc7b76659a0aee |
class Config(object): <NEW_LINE> <INDENT> __config_dict = {} <NEW_LINE> __config_file = '' <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> file_path = Args() <NEW_LINE> self.__config_file = file_path.get_file_path['-c'] <NEW_LINE> <DEDENT> def __get_config(self): <NEW_LINE> <INDENT> with open(self.__config_file) as ... | 获取配置文件信息类
1.读取配置文件信息
2.判断配置文件格式
3.返回配置信息字典 | 62599041b830903b9686edd8 |
class MAVLink_attitude_quaternion_cov_message(MAVLink_message): <NEW_LINE> <INDENT> id = MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV <NEW_LINE> name = 'ATTITUDE_QUATERNION_COV' <NEW_LINE> fieldnames = ['time_boot_ms', 'q', 'rollspeed', 'pitchspeed', 'yawspeed', 'covariance'] <NEW_LINE> ordered_fieldnames = [ 'time_boot_ms',... | The attitude in the aeronautical frame (right-handed, Z-down,
X-front, Y-right), expressed as quaternion. Quaternion order
is w, x, y, z and a zero rotation would be expressed as (1 0 0
0). | 62599041596a897236128f0d |
class SerpNGRedirectionMiddleware(object): <NEW_LINE> <INDENT> def process_exception(self, request, exception): <NEW_LINE> <INDENT> if isinstance(exception, serpng.lib.exceptions.HttpRedirect): <NEW_LINE> <INDENT> is_permanent = isinstance(exception, serpng.lib.exceptions.Http301) <NEW_LINE> response = redirect(excepti... | Middleware class to handle exceptions that signal that a redirection should take place. | 62599041be383301e0254ad5 |
class Decrypter(object): <NEW_LINE> <INDENT> def __init__(self, privkeyFile): <NEW_LINE> <INDENT> self._privkeyFile = privkeyFile <NEW_LINE> self._backend = default_backend() <NEW_LINE> <DEDENT> def decrypt(self, data): <NEW_LINE> <INDENT> if not isinstance(data, bytes): <NEW_LINE> <INDENT> raise TypeError("encoded dat... | Decrypter decrypts | 6259904121bff66bcd723f28 |
class FloatingIP(model_base.HasStandardAttributes, model_base.BASEV2, model_base.HasId, model_base.HasTenant): <NEW_LINE> <INDENT> floating_ip_address = sa.Column(sa.String(64), nullable=False) <NEW_LINE> floating_network_id = sa.Column(sa.String(36), nullable=False) <NEW_LINE> floating_port_id = sa.Column(sa.String(36... | Represents a floating IP address.
This IP address may or may not be allocated to a tenant, and may or
may not be associated with an internal port/ip address/router. | 6259904130c21e258be99ac7 |
class BackupError(IOError): <NEW_LINE> <INDENT> pass | Base backup exception. | 62599041d99f1b3c44d0695a |
class ExtensionElement(externals.atom.core.XmlElement): <NEW_LINE> <INDENT> def __init__(self, tag=None, namespace=None, attributes=None, children=None, text=None, *args, **kwargs): <NEW_LINE> <INDENT> if namespace: <NEW_LINE> <INDENT> self._qname = '{%s}%s' % (namespace, tag) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDE... | Provided for backwards compatibility to the v1 atom.ExtensionElement. | 62599041dc8b845886d54875 |
class Sentry(Sentry): <NEW_LINE> <INDENT> def __init__(self, application): <NEW_LINE> <INDENT> self.application = application <NEW_LINE> <DEDENT> @property <NEW_LINE> def client(self): <NEW_LINE> <INDENT> from raven_django.models import client <NEW_LINE> return client | Identical to the default WSGI middleware except that
the client comes dynamically via ``get_client
>>> from raven_django.middleware.wsgi import Sentry
>>> application = Sentry(application) | 62599041d10714528d69efeb |
class EtlPipeline(luigi.WrapperTask): <NEW_LINE> <INDENT> year_month = luigi.Parameter() <NEW_LINE> def requires(self): <NEW_LINE> <INDENT> yield IngestPipeline(self.year_month) <NEW_LINE> <DEDENT> def run(self): <NEW_LINE> <INDENT> yield ETL(year_month=self.year_month) | Este wrapper ejecuta el ETL de cada pipeline-task
Input - lista con los pipeline-tasks especificados a correr. | 6259904115baa72349463250 |
class TestAddConnectionConfiguration(base.NectarTests): <NEW_LINE> <INDENT> def test_defaults(self): <NEW_LINE> <INDENT> config = DownloaderConfig('https') <NEW_LINE> curl_downloader = HTTPSCurlDownloader(config) <NEW_LINE> easy_handle = mock.MagicMock() <NEW_LINE> curl_downloader._add_connection_configuration(easy_han... | This test module tests the HTTPSCurlDownloadBackend._add_connection_configuration method. It asserts that
all the appropriate default values are passed to pycurl, no more and no less. It uses Mocks to make these
assertions, and we will trust that the features in pycurl are tested by that project. | 6259904145492302aabfd799 |
class ObjectFilterList(filter_interface.FilterObject): <NEW_LINE> <INDENT> def CompileFilter(self, filter_string): <NEW_LINE> <INDENT> if not os.path.isfile(filter_string): <NEW_LINE> <INDENT> raise errors.WrongPlugin(( 'ObjectFilterList requires an YAML file to be passed on, this filter ' 'string is not a file.')) <NE... | A series of Pfilter filters along with metadata. | 625990410fa83653e46f6198 |
class Stc(X86InstructionBase): <NEW_LINE> <INDENT> def __init__(self, prefix, mnemonic, operands, architecture_mode): <NEW_LINE> <INDENT> super(Stc, self).__init__(prefix, mnemonic, operands, architecture_mode) <NEW_LINE> <DEDENT> @property <NEW_LINE> def source_operands(self): <NEW_LINE> <INDENT> return [ ] <NEW_LINE>... | Representation of Stc x86 instruction. | 62599041004d5f362081f944 |
class GetHotspotTests(TestCase, HeaderTestsMixin): <NEW_LINE> <INDENT> def get_callable(self): <NEW_LINE> <INDENT> return get_hotspot <NEW_LINE> <DEDENT> def get_params(self, **kwargs): <NEW_LINE> <INDENT> params = { "token": "12345", "loc_id": "L123456", } <NEW_LINE> params.update(kwargs) <NEW_LINE> return params <NEW... | Tests for the get_hotspot() API call. | 625990413eb6a72ae038b920 |
class NflListView(ListView): <NEW_LINE> <INDENT> paginate_by = 100 <NEW_LINE> model = nfl_player | Renders a list of all players in database | 62599041596a897236128f0e |
class time: <NEW_LINE> <INDENT> def _assign_pointintime(self, day): <NEW_LINE> <INDENT> self.day = day <NEW_LINE> self.bdate = self.quote.date[0] + dt.timedelta(days=self.day) <NEW_LINE> self.quote = self.quote[self.quote.date < self.bdate] <NEW_LINE> if self.bdate.month<4: <NEW_LINE> <INDENT> _max_keyratio_... | Make the analysis for today a special case of backtesting | 6259904176d4e153a661dbd4 |
class NonDjangoLanguageTests(SimpleTestCase): <NEW_LINE> <INDENT> @override_settings( USE_I18N=True, LANGUAGES=[ ('en-us', 'English'), ('xxx', 'Somelanguage'), ], LANGUAGE_CODE='xxx', LOCALE_PATHS=[os.path.join(here, 'commands', 'locale')], ) <NEW_LINE> def test_non_django_language(self): <NEW_LINE> <INDENT> self.asser... | A language non present in default Django languages can still be
installed/used by a Django project. | 625990413c8af77a43b6889c |
class DuplicatePluginError(QwcoreError): <NEW_LINE> <INDENT> pass | Raised when a specific name has multiple plugins | 625990414e696a045264e781 |
class NoSuchField(Exception): <NEW_LINE> <INDENT> def __init__(self, uuid): <NEW_LINE> <INDENT> super(NoSuchField, self).__init__( "No such field: %s" % uuid) <NEW_LINE> self.uuid = uuid | Raised when the field doesn't exist for the service. | 625990411d351010ab8f4dde |
@dataclass <NEW_LINE> class Property: <NEW_LINE> <INDENT> name: str <NEW_LINE> values: list | Property struct with name and values
| 6259904123e79379d538d7be |
class SubscriptionDetailGet(TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.obj = Subscription.objects.create(name='Henrique Bastos', cpf='12345678901', email='henrique@bastos.net', phone='21-996186180') <NEW_LINE> self.resp = self.client.get(r('subscriptions:detail', self.obj.pk)) <NEW_LINE> <... | docstring for SubscriptionDetailGet. | 62599041287bf620b6272ea6 |
class Client(Grid5000): <NEW_LINE> <INDENT> def __init__(self, excluded_sites=None, **kwargs): <NEW_LINE> <INDENT> super().__init__(**kwargs) <NEW_LINE> self.excluded_site = excluded_sites <NEW_LINE> if excluded_sites is None: <NEW_LINE> <INDENT> self.excluded_site = [] | Wrapper of the python-grid5000 client.
It accepts extra parameters to be set in the configuration file. | 6259904126068e7796d4dc07 |
class PdLambdaPipe(pemi.Pipe): <NEW_LINE> <INDENT> def __init__(self, fun): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.fun = fun <NEW_LINE> self.source( pemi.PdDataSubject, name='main' ) <NEW_LINE> self.target( pemi.PdDataSubject, name='main' ) <NEW_LINE> <DEDENT> def flow(self): <NEW_LINE> <INDENT> self.ta... | This pipe is used to build quick Pandas transformations where building a full pipe class
may feel like overkill. You would use this pipe if you don't need to test it in isolation
(e.g., it only makes sense in a larger context), or you don't need control over the schemas.
Args:
fun (function): A function that accept... | 62599041004d5f362081f945 |
class EnvironmentTool(Tool): <NEW_LINE> <INDENT> def __init__(self, configuration): <NEW_LINE> <INDENT> Tool.__init__(self, configuration) <NEW_LINE> self.vars = {} <NEW_LINE> <DEDENT> def __getitem__(self, key): <NEW_LINE> <INDENT> return self.vars[key] <NEW_LINE> <DEDENT> def __setitem__(self, key, value): <NEW_LINE>... | Tool that provides a dictionary of key/value pairs
used for path substitution. | 6259904173bcbd0ca4bcb54b |
class Data68: <NEW_LINE> <INDENT> hdr_dtype = np.dtype([('PingCounter','H'),('SystemSerial#','H'), ('VesselHeading',"f"),('SoundSpeed',"f"),('TransducerDepth',"f"), ('MaximumBeams','B'),('ValidBeams','B'),('Zresolution',"f"), ('XYresolution',"f"),('SampleRate','f')]) <NEW_LINE> xyz_dtype = np.dtype([('Depth',"f"),('Acr... | XYZ datagram 044h / 68d / 'D'. All values are converted to meters, degrees,
or whole units. The header sample rate may not be correct, but is
multiplied by 4 to make the one way travel time per beam appear correct. The
detection window length per beam is in its raw form... | 625990413eb6a72ae038b922 |
class User_Validator(object): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def validate(user): <NEW_LINE> <INDENT> error_msg = "" <NEW_LINE> if(len(user.get_nr_telefon())!=10): <NEW_LINE> <INDENT> error_msg += "Nr. tel. invalid.\n" <NEW_LINE> <DEDENT> if (user.get_tip()!="client" and user.get_tip()!="admin"): <NEW_LINE... | Validator pentru clasa user
Trebuie sa verific:
- lungime nr tel sa fie 10
- tipul sa fie admin sau client | 62599041a79ad1619776b340 |
class CreatePostForm(ModelFormWithUser): <NEW_LINE> <INDENT> def clean_blog(self): <NEW_LINE> <INDENT> blog = self.cleaned_data.get('blog', None) <NEW_LINE> if not blog.check_user(self.user): <NEW_LINE> <INDENT> raise forms.ValidationError(_('You not in this blog!')) <NEW_LINE> <DEDENT> return blog <NEW_LINE> <DEDENT> ... | Create new post form | 6259904123e79379d538d7bf |
class IncompatibleFormatException(Exception): <NEW_LINE> <INDENT> def __init__(self, format_name, reason): <NEW_LINE> <INDENT> self.format_name = format_name <NEW_LINE> message = "Format {} is incompatible with the given settings, {}" .format(format_name, reason) <NEW_LINE> super(IncompatibleAlgorithmExcepti... | Raised when the selected format and settings are incompatible
:param str algorithm_name:
:param str reason: why the algorithm is incompatible, optional | 62599041c432627299fa4262 |
class CatPropDialog(wx.Dialog): <NEW_LINE> <INDENT> __category = None <NEW_LINE> def __init__(self, parent, hdd, category = None): <NEW_LINE> <INDENT> if category: <NEW_LINE> <INDENT> self.__category = category <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.__category = Category("", "", hdd) <NEW_LINE> <DEDENT> wx.... | The Cat Prop Dialog class | 62599041d53ae8145f91971f |
class QubeProcessor(Processor): <NEW_LINE> <INDENT> def process(self, command, args=None, kw=None): <NEW_LINE> <INDENT> if args is None: <NEW_LINE> <INDENT> args = () <NEW_LINE> <DEDENT> if kw is None: <NEW_LINE> <INDENT> kw = {} <NEW_LINE> <DEDENT> serialised = base64.b64encode( pickle.dumps( {'command': command, 'arg... | Foreground processor. | 62599041d10714528d69efed |
class EmailWasher(HTMLWasher): <NEW_LINE> <INDENT> def handle_starttag(self, tag, attrs): <NEW_LINE> <INDENT> if tag.lower() in self.allowed_tag_whitelist: <NEW_LINE> <INDENT> if tag.lower() == 'ol': <NEW_LINE> <INDENT> self.previous_nbs.append(self.nb) <NEW_LINE> self.nb = 0 <NEW_LINE> self.previous_type_lists.append(... | Wash comments before being send by email | 6259904123e79379d538d7c0 |
class ProgressTestCase(TabTestCase): <NEW_LINE> <INDENT> def check_progress_tab(self): <NEW_LINE> <INDENT> return self.check_tab( tab_class=ProgressTab, dict_tab={'type': ProgressTab.type, 'name': 'same'}, expected_link=self.reverse('progress', args=[text_type(self.course.id)]), expected_tab_id=ProgressTab.type, invali... | Test cases for Progress Tab. | 62599041287bf620b6272ea8 |
class BlobTags(msrest.serialization.Model): <NEW_LINE> <INDENT> _validation = { 'blob_tag_set': {'required': True}, } <NEW_LINE> _attribute_map = { 'blob_tag_set': {'key': 'BlobTagSet', 'type': '[BlobTag]', 'xml': {'name': 'TagSet', 'wrapped': True, 'itemsName': 'Tag'}}, } <NEW_LINE> _xml_map = { 'name': 'Tags' } <NEW_... | Blob tags.
All required parameters must be populated in order to send to Azure.
:param blob_tag_set: Required.
:type blob_tag_set: list[~azure.storage.blob.models.BlobTag] | 625990418e71fb1e983bcd90 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.