code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class LRUCachedFunction(object): <NEW_LINE> <INDENT> def __init__(self, function, cache=None): <NEW_LINE> <INDENT> if cache: <NEW_LINE> <INDENT> self.cache = cache <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.cache = LRUCacheDict() <NEW_LINE> <DEDENT> self.function = function <NEW_LINE> self.__name__ = self.funct... | >>> def f(x):
... print "Calling f(" + str(x) + ")"
... return x
>>> f = LRUCachedFunction(f, LRUCacheDict(max_size=3, expiration=3) ) | 62599046b830903b9686ee25 |
class WAVEDecoder(Decoder): <NEW_LINE> <INDENT> suffix = '.wav' <NEW_LINE> def __init__(self, extract_metadata=False, extract_image=False): <NEW_LINE> <INDENT> if extract_metadata or extract_image: <NEW_LINE> <INDENT> raise Exception('WAVE files have no native support for metadata or embedded images.') <NEW_LINE> <DEDE... | Decoder for WAVE files | 62599046dc8b845886d54910 |
class _ReadUntil(_Awaitable): <NEW_LINE> <INDENT> __slots__ = ['sep', 'max_bytes'] <NEW_LINE> def __init__(self, sep, max_bytes=None): <NEW_LINE> <INDENT> self.sep = sep <NEW_LINE> self.max_bytes = max_bytes <NEW_LINE> <DEDENT> def check_length(self, pos): <NEW_LINE> <INDENT> if self.max_bytes is not None and pos > sel... | Read until a separator. | 625990468a43f66fc4bf34ea |
class SessionQueryForms(messages.Message): <NEW_LINE> <INDENT> filters = messages.MessageField(SessionQueryForm, 1, repeated=True) | ConferenceQueryForms -- multiple ConferenceQueryForm inbound form message | 6259904630dc7b76659a0b88 |
class SlackAdapterOptions: <NEW_LINE> <INDENT> def __init__( self, slack_verification_token: str, slack_bot_token: str, slack_client_signing_secret: str, ): <NEW_LINE> <INDENT> self.slack_verification_token = slack_verification_token <NEW_LINE> self.slack_bot_token = slack_bot_token <NEW_LINE> self.slack_client_signing... | Class for defining implementation of the SlackAdapter Options. | 6259904615baa723494632e8 |
class ExportDeliveryInfo(msrest.serialization.Model): <NEW_LINE> <INDENT> _validation = { 'destination': {'required': True}, } <NEW_LINE> _attribute_map = { 'destination': {'key': 'destination', 'type': 'ExportDeliveryDestination'}, } <NEW_LINE> def __init__( self, *, destination: "ExportDeliveryDestination", **kwargs ... | The delivery information associated with a export.
All required parameters must be populated in order to send to Azure.
:param destination: Required. Has destination for the export being delivered.
:type destination: ~azure.mgmt.costmanagement.models.ExportDeliveryDestination | 62599046b57a9660fecd2dd3 |
class Processor(AwardProcessor): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> AwardProcessor.__init__(self, 'Rasputin', 'Most Weapon Type Deaths', [PLAYER_COL, Column('Types', Column.NUMBER, Column.DESC)]) <NEW_LINE> self.types = dict() <NEW_LINE> <DEDENT> def on_kill(self, e): <NEW_LINE> <INDENT> if not... | Overview
This processor keeps track of the most weapon type deaths
Implementation
Cache kill events involving a sniper.
Notes
None. | 62599046b5575c28eb713674 |
class section(EmbeddedDocument): <NEW_LINE> <INDENT> secTitle = StringField(min_length=1, max_length=100, required=True, regex='^([A-ZÁÉÍÓÚÑÜ]+)([A-Z a-z 0-9 À-ÿ : \-]*)([A-Za-z0-9À-ÿ]$)') <NEW_LINE> content = StringField(min_length=1, required=True) | EmbeddedDocument Class for Section.
These are going to be the body of the Document Case.
An EmbeddedDocument is a Document Class that is defined inside another document.
This one is going to be defined, and stored inside the DocumentCase Class.
The reason for this technique is that the Section Class has its own schema.... | 62599046435de62698e9d15b |
class ClipCreator(object): <NEW_LINE> <INDENT> def __init__(self, *a, **k): <NEW_LINE> <INDENT> super(ClipCreator, self).__init__(*a, **k) <NEW_LINE> self._grid_quantization = None <NEW_LINE> self._grid_triplet = False <NEW_LINE> <DEDENT> def _get_grid_quantization(self): <NEW_LINE> <INDENT> return self._grid_quantizat... | Manages clip creation over all components | 6259904691af0d3eaad3b17b |
class Model(metaclass=ModelBase): <NEW_LINE> <INDENT> __abstract__ = True <NEW_LINE> __init__ = base._declarative_constructor <NEW_LINE> @declared_attr <NEW_LINE> def __tablename__(cls): <NEW_LINE> <INDENT> package = _package_of(cls.__module__).lower() <NEW_LINE> name = '%s.%s' % (package, cls.__name__.lower()) <NEW_LI... | Declares the base model.
This provides various helpers, defaults, and utilities for
sqlalchemy-derived models. | 62599046ec188e330fdf9bf3 |
class GraphiteTextServer(ServerProcessor): <NEW_LINE> <INDENT> def __init__( self, only_accept_local, port, run_state, buffer_size, max_request_size, max_connection_idle_time, logger, ): <NEW_LINE> <INDENT> self.__logger = logger <NEW_LINE> self.__parser = LineRequestParser(max_request_size) <NEW_LINE> ServerProcessor.... | Accepts connections on a server socket and handles them using Graphite's plaintext protocol format, emitting
the received metrics to the log. | 6259904696565a6dacd2d935 |
class EventInSpatial(models.Model): <NEW_LINE> <INDENT> spatial = models.IntegerField() <NEW_LINE> event = models.ForeignKey(Event, related_name='event_spatials') <NEW_LINE> class Meta: <NEW_LINE> <INDENT> verbose_name = "Event in Spatial" <NEW_LINE> verbose_name_plural = "Event in Spatials" <NEW_LINE> <DEDENT> def __s... | Represents the 1:m relation between a Event and Spatials | 62599046a4f1c619b294f833 |
class TestSentenceBreak(unittest.TestCase): <NEW_LINE> <INDENT> def test_table_integrity(self): <NEW_LINE> <INDENT> re_key = re.compile(r'^\^?[a-z0-9./]+$') <NEW_LINE> keys1 = set(uniprops.unidata.unicode_sentence_break.keys()) <NEW_LINE> keys2 = set(uniprops.unidata.ascii_sentence_break.keys()) <NEW_LINE> for k in key... | Test `Sentence Break` access. | 625990463eb6a72ae038b9b2 |
class TestSetFlagEnabledRequest(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 testSetFlagEnabledRequest(self): <NEW_LINE> <INDENT> pass | SetFlagEnabledRequest unit test stubs | 62599046596a897236128f5b |
class PrioretizedReplayBuffer: <NEW_LINE> <INDENT> def __init__(self, buffer_size, batch_size, seed, device, e=1e-4): <NEW_LINE> <INDENT> self.e = e <NEW_LINE> self.device = device <NEW_LINE> self.memory = deque(maxlen=buffer_size) <NEW_LINE> self.batch_size = batch_size <NEW_LINE> self.experience = namedtuple("Experie... | Fixed-size Prioretized Replay buffer to store experience tuples. | 625990460fa83653e46f6234 |
class MultipartContainer(Form): <NEW_LINE> <INDENT> MULTIPART_HEADER = 'multipart/form-data; boundary=%s' <NEW_LINE> def __init__(self, form_params=None): <NEW_LINE> <INDENT> super(MultipartContainer, self).__init__(form_params) <NEW_LINE> self.boundary = get_boundary() <NEW_LINE> <DEDENT> def get_type(self): <NEW_LINE... | This class represents a data container for multipart/post
:author: Andres Riancho (andres.riancho@gmail.com) | 62599046cad5886f8bdc5a2a |
class Root(object): <NEW_LINE> <INDENT> @cherrypy.expose <NEW_LINE> def index(self): <NEW_LINE> <INDENT> return "Warning!<br/> Core Meltdown Imminent!" | This implements our application class
| 625990468e71fb1e983bce27 |
class Rectangle: <NEW_LINE> <INDENT> def __init__(self, width=0, height=0): <NEW_LINE> <INDENT> self.width = width <NEW_LINE> self.height = height <NEW_LINE> <DEDENT> @property <NEW_LINE> def width(self): <NEW_LINE> <INDENT> return(self.__width) <NEW_LINE> <DEDENT> @property <NEW_LINE> def height(self): <NEW_LINE> <IND... | Rectangle class definition | 6259904645492302aabfd82a |
class SqlException(Exception): <NEW_LINE> <INDENT> def __init__(self, arg): <NEW_LINE> <INDENT> self.message = arg | SQL Custom Exception class | 6259904623849d37ff852414 |
class TestArithmeticMixin(unittest.TestCase): <NEW_LINE> <INDENT> def testAdd(self): <NEW_LINE> <INDENT> self.assertEqual(ip.IPv4('192.168.1.1') + 1, ip.IPv4('192.168.1.2')) <NEW_LINE> <DEDENT> def testSub(self): <NEW_LINE> <INDENT> self.assertEqual(ip.IPv4('192.168.1.2') - 1, ip.IPv4('192.168.1.1')) | Test the debmarshal.ip.ArithmeticMixin class. | 6259904626068e7796d4dc9f |
class ReadLayerError(InaSAFEError): <NEW_LINE> <INDENT> suggestion = ( 'Check that the file exists and you have permissions to read it') | When a layer can't be read | 6259904616aa5153ce401846 |
class HTTSOAPAuditReplacePatternsXPath(Base): <NEW_LINE> <INDENT> __tablename__ = 'http_soap_au_rpl_p_xp' <NEW_LINE> __table_args__ = (UniqueConstraint('conn_id', 'pattern_id'), {}) <NEW_LINE> id = Column(Integer, Sequence('htp_sp_ad_rpl_p_xp_seq'), primary_key=True) <NEW_LINE> conn_id = Column(Integer, ForeignKey('htt... | XPath replace patterns for HTTP/SOAP connections.
| 6259904607f4c71912bb078b |
class IllegalValue(PanError, ValueError): <NEW_LINE> <INDENT> pass | Errors from trying to hardware parameters to values not supported by a particular model | 6259904623e79379d538d857 |
class TransformEventProcess(TransformBase): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(TransformEventProcess,self).__init__() <NEW_LINE> <DEDENT> def on_start(self): <NEW_LINE> <INDENT> super(TransformEventProcess,self).on_start() | Transforms which interact with Ion Events. | 62599046b57a9660fecd2dd6 |
class InspectionTool(QgsMapTool): <NEW_LINE> <INDENT> finished = pyqtSignal(QgsVectorLayer, QgsFeature) <NEW_LINE> def __init__(self, canvas, layerfrom, layerto, mapping): <NEW_LINE> <INDENT> QgsMapTool.__init__(self, canvas) <NEW_LINE> self.layerfrom = layerfrom <NEW_LINE> self.layerto = layerto <NEW_LINE> self.fields... | Inspection tool which copies the feature to a new layer
and copies selected data from the underlying feature. | 62599046004d5f362081f993 |
class IndexView(View): <NEW_LINE> <INDENT> def get(self, request, *args, **kwargs): <NEW_LINE> <INDENT> return render(request, 'index.html') | 首页广告 | 6259904650485f2cf55dc2e1 |
class Q(tree.Node): <NEW_LINE> <INDENT> AND = 'AND' <NEW_LINE> OR = 'OR' <NEW_LINE> default = AND <NEW_LINE> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> super(Q, self).__init__(children=list(args) + list(kwargs.items())) <NEW_LINE> <DEDENT> def _combine(self, other, conn): <NEW_LINE> <INDENT> if not isinst... | Encapsulates filters as objects that can then be combined logically (using
`&` and `|`). | 625990461f5feb6acb163f4f |
class ProjectLeadEdit(LoginRequiredMixin, UpdateView): <NEW_LINE> <INDENT> model = QappLead <NEW_LINE> form_class = QappLeadForm <NEW_LINE> template_name = 'SectionA/project_lead_create.html' <NEW_LINE> def get(self, request, *args, **kwargs): <NEW_LINE> <INDENT> pkey = kwargs.get('pk') <NEW_LINE> obj = self.model.obje... | Class view for editing project leads. | 6259904630dc7b76659a0b8c |
class LocalCrystal(LocalRunner): <NEW_LINE> <INDENT> def _submit_job(self,inpfn,outfn="stdout",jobname="",loc=""): <NEW_LINE> <INDENT> exe = self.BIN+"crystal < %s"%inpfn <NEW_LINE> prep_commands=["cp %s INPUT"%inpfn] <NEW_LINE> final_commands = ["rm *.pe[0-9]","rm *.pe[0-9][0-9]"] <NEW_LINE> if jobname == "": <NEW_LIN... | Fully defined submission class. Defines interaction with specific
program to be run. | 62599046a8ecb0332587256b |
class BigIntegerField(IntegerField): <NEW_LINE> <INDENT> def to_python(self, value): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return Int64(value) <NEW_LINE> <DEDENT> except ValueError: <NEW_LINE> <INDENT> return value | A field that always stores and retrieves numbers as bson.int64.Int64. | 6259904623e79379d538d858 |
class MinList(object): <NEW_LINE> <INDENT> def __init__(self, length): <NEW_LINE> <INDENT> self.__length = length <NEW_LINE> self.__minimums = [] <NEW_LINE> <DEDENT> def append(self, value): <NEW_LINE> <INDENT> mins_length = len(self.__minimums) <NEW_LINE> if mins_length < self.__length: <NEW_LINE> <INDENT> self.__mini... | classdocs | 62599046be383301e0254b73 |
@keras_export('keras.constraints.MinMaxNorm', 'keras.constraints.min_max_norm') <NEW_LINE> class MinMaxNorm(Constraint): <NEW_LINE> <INDENT> def __init__(self, min_value=0.0, max_value=1.0, rate=1.0, axis=0): <NEW_LINE> <INDENT> self.min_value = min_value <NEW_LINE> self.max_value = max_value <NEW_LINE> self.rate = rat... | MinMaxNorm weight constraint.
Constrains the weights incident to each hidden unit
to have the norm between a lower bound and an upper bound.
Also available via the shortcut function `tf.keras.constraints.min_max_norm`.
Args:
min_value: the minimum norm for the incoming weights.
max_value: the maximum norm for th... | 625990463617ad0b5ee07496 |
class BrickletPiezoSpeaker(Device): <NEW_LINE> <INDENT> DEVICE_IDENTIFIER = 242 <NEW_LINE> DEVICE_DISPLAY_NAME = 'Piezo Speaker Bricklet' <NEW_LINE> DEVICE_URL_PART = 'piezo_speaker' <NEW_LINE> CALLBACK_BEEP_FINISHED = 4 <NEW_LINE> CALLBACK_MORSE_CODE_FINISHED = 5 <NEW_LINE> FUNCTION_BEEP = 1 <NEW_LINE> FUNCTION_MORSE_... | Creates beep with configurable frequency | 62599046435de62698e9d15f |
class map_keyword(parser.keyword): <NEW_LINE> <INDENT> def __init__(self, sString): <NEW_LINE> <INDENT> parser.keyword.__init__(self, sString) | unique_id = port_map_aspect : map_keyword | 62599046d99f1b3c44d069fa |
class ReTweet(Tweet): <NEW_LINE> <INDENT> def as_html(self, template=None): <NEW_LINE> <INDENT> return self._render('ReTweet', template) | ReTweet object based from twitter-api json
| 6259904607f4c71912bb078d |
class ResourceGenerator(object): <NEW_LINE> <INDENT> def __init__(self, organization, package): <NEW_LINE> <INDENT> self.organization = organization <NEW_LINE> self.package = package <NEW_LINE> self.metadata = importlib.import_module('%s.metadata' % package) <NEW_LINE> self.env = Environment( keep_trailing_newline=True... | Class to generate Sphinx resources.
Args:
organization (str): name of the profile of the organization on GitHub.
package (str): package to be documented.
metadata (Python module): module containing the package metadata.
env (:py:class:`jinja2.Environment`): the Jinja2 environment. | 62599046e76e3b2f99fd9d67 |
class IC_4000(Base_14pin): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.pins = [None, None, None, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1] <NEW_LINE> self.pins = pinlist_quick(self.pins) <NEW_LINE> self.uses_pincls = True <NEW_LINE> self.setIC({1: {'desc': 'NC'}, 2: {'desc': 'NC'}, 3: {'desc': 'A1: Input... | Dual 3 Input NOR gate + one NOT gate IC.
Pin_6 = NOR(Pin_3, Pin_4, Pin_5)
Pin_10 = NOR(Pin_11, Pin_12, Pin_13)
Pin_9 = NOT(Pin_8) | 6259904663b5f9789fe864c7 |
class Proxy(YmvcBase): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self._signaled_attrs = set() <NEW_LINE> <DEDENT> def add_obs_attrs(self, *attributes): <NEW_LINE> <INDENT> self._signaled_attrs.update(set(attributes)) <NEW_LINE> <DEDENT> def remove_obs_attrs(self, *attribu... | Contains the data of your application | 62599046d4950a0f3b1117ef |
class SolrTestCase(Sandboxed, ptc.PloneTestCase): <NEW_LINE> <INDENT> layer = layer | base class for integration tests | 62599046711fe17d825e164b |
class DescribeSmpnFnrResponse(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.ResponseData = None <NEW_LINE> self.RequestId = None <NEW_LINE> <DEDENT> def _deserialize(self, params): <NEW_LINE> <INDENT> if params.get("ResponseData") is not None: <NEW_LINE> <INDENT> self.ResponseData = F... | DescribeSmpnFnr返回参数结构体
| 6259904676d4e153a661dc23 |
class ItemEdit(MethodView): <NEW_LINE> <INDENT> def put(self, _id): <NEW_LINE> <INDENT> if not session.get('check'): <NEW_LINE> <INDENT> return 401 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> req = request.get_json(silent=True) <NEW_LINE> name, price, desc = (req[i] for i in req) <NEW_LINE> item = ItemModel.query.get... | @desc: handles 'PUT', 'DELETE' requests with id as url parameter.
@route: /api/items/<id> | 62599046097d151d1a2c23c7 |
class Consumer(object): <NEW_LINE> <INDENT> def __init__(self, func=None): <NEW_LINE> <INDENT> super(Consumer, self).__init__() <NEW_LINE> if func is None: <NEW_LINE> <INDENT> func = (lambda s: s.value) <NEW_LINE> <DEDENT> self.func = func <NEW_LINE> self.initial_state = list() <NEW_LINE> self.state = list() <NEW_LINE>... | base class for simulation consumers | 625990463eb6a72ae038b9b6 |
class JSONResponseMixin(object): <NEW_LINE> <INDENT> def render_to_response(self, context): <NEW_LINE> <INDENT> return self.get_json_response(self.convert_context_to_json(context)) <NEW_LINE> <DEDENT> def get_json_response(self, content, **httpresponse_kwargs): <NEW_LINE> <INDENT> return http.HttpResponse(content, cont... | Classe `mixin` baseada no exemplo em:
https://docs.djangoproject.com/en/dev/topics/class-based-views/ | 625990461f5feb6acb163f51 |
class TabGroup(object): <NEW_LINE> <INDENT> implements(IAthenaTransportable) <NEW_LINE> jsClass = u'Methanal.Widgets.TabGroup' <NEW_LINE> def __init__(self, id, title, tabs): <NEW_LINE> <INDENT> self.id = id <NEW_LINE> self.title = title <NEW_LINE> self.tabs = [] <NEW_LINE> for tab in tabs: <NEW_LINE> <INDENT> self._ma... | Visually group labels of L{methanal.widgets.Tab}s together.
@type id: C{unicode}
@ivar id: Unique identifier.
@type title: C{unicode}
@ivar title: Title of the group, used by L{methanal.widgets.TabView} when
constructing the tab list.
@type tabs: C{list} of L{methanal.widgets.Tab}
@ivar tabs: Tabs to group toget... | 625990460fa83653e46f6238 |
class ProjectFormSimplified(wtf.Form): <NEW_LINE> <INDENT> description = wtforms.TextField( 'Description <span class="error">*</span>', [wtforms.validators.Required()] ) <NEW_LINE> url = wtforms.TextField( 'URL', [wtforms.validators.optional()] ) <NEW_LINE> avatar_email = wtforms.TextField( 'Avatar email', [wtforms.val... | Form to edit the description of a project. | 62599046d10714528d69f03b |
class ConsistentHashRing(object): <NEW_LINE> <INDENT> def __init__(self, replicas=100): <NEW_LINE> <INDENT> self.replicas = replicas <NEW_LINE> self._keys = [] <NEW_LINE> self._nodes = {} <NEW_LINE> <DEDENT> def _hash(self, key): <NEW_LINE> <INDENT> return int(hashlib.md5(key.encode('utf-8')).hexdigest(), 16) <NEW_LINE... | Implement a consistent hashing ring. | 625990468e71fb1e983bce2b |
class Location(Parameter): <NEW_LINE> <INDENT> def __init__(self, name: str): <NEW_LINE> <INDENT> super(Location, self).__init__(tf.identity, name) | Location parameters live in the real line. | 6259904615baa723494632ee |
class CallUnits(unittest.TestCase): <NEW_LINE> <INDENT> def testCase010(self): <NEW_LINE> <INDENT> arg = tdata + '/b/*/c.p"""[!:]*"""' <NEW_LINE> if RTE & RTE_WIN32: <NEW_LINE> <INDENT> resX = [tdata + '\\b\\*\\c.p[!:]*'] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> resX = [tdata + '/b/*/c.p[!:]*'] <NEW_LINE> <DEDENT>... | Sets the specific data array and required parameters for test case.
| 6259904626238365f5fadeb8 |
class Spheres(DataSet): <NEW_LINE> <INDENT> fancy_name = "Spheres dataset" <NEW_LINE> __slots__ = ['d', 'n_spheres', 'r'] <NEW_LINE> def __init__(self, d=DEFAULT['spheres']['d'], n_spheres=DEFAULT['spheres']['n_spheres'], r=DEFAULT['spheres']['r']): <NEW_LINE> <INDENT> self.d = d <NEW_LINE> self.n_spheres = n_spheres <... | Spheres dataset from TopAE paper
#todo: make proper reference | 62599046be383301e0254b75 |
@pytest.mark.components <NEW_LINE> @pytest.allure.story('Clients') <NEW_LINE> @pytest.allure.feature('POST') <NEW_LINE> class Test_PFE_Components(object): <NEW_LINE> <INDENT> @pytest.allure.link('https://jira.qumu.com/browse/TC-43114') <NEW_LINE> @pytest.mark.Clients <NEW_LINE> @pytest.mark.POST <NEW_LINE> def test_TC_... | PFE Clients test cases. | 6259904607f4c71912bb078f |
class CheckOperator(BaseOperator): <NEW_LINE> <INDENT> template_fields = ('sql',) <NEW_LINE> template_ext = ('.hql', '.sql',) <NEW_LINE> ui_color = '#fff7e6' <NEW_LINE> @apply_defaults <NEW_LINE> def __init__( self, sql, conn_id=None, *args, **kwargs): <NEW_LINE> <INDENT> super(CheckOperator, self).__init__(*args, **kw... | Performs checks against a db. The ``CheckOperator`` expects
a sql query that will return a single row. Each value on that
first row is evaluated using python ``bool`` casting. If any of the
values return ``False`` the check is failed and errors out.
Note that Python bool casting evals the following as ``False``:
* Fal... | 6259904630c21e258be99b63 |
class Solution: <NEW_LINE> <INDENT> def longestCommonSubsequence(self, A, B): <NEW_LINE> <INDENT> x = len(A) <NEW_LINE> y = len(B) <NEW_LINE> dp = [[0 for j in range(y+1)] for i in range(x+1)] <NEW_LINE> for i in range(1, x+1): <NEW_LINE> <INDENT> for j in range(1, y+1): <NEW_LINE> <INDENT> if A[i-1] == B[j-1]: <NEW_LI... | @param A, B: Two strings.
@return: The length of longest common subsequence of A and B. | 625990464e696a045264e7cf |
class VisitorNodeDispatch(): <NEW_LINE> <INDENT> def __init__(self, tree): <NEW_LINE> <INDENT> self._dispatch(tree) <NEW_LINE> <DEDENT> def node(self, t): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def _dispatch(self, t): <NEW_LINE> <INDENT> self.node(t) <NEW_LINE> if (isinstance(t, Expression)): <NEW_LINE> <INDENT> ... | A visitor which traverses the entire tree.
The nodes are only dispatched t one method. This can be useful for
visiting where only a small number of nodes need to be looked at.
The downside is that most code that uses this visitor must test for
tree type manually.
Params are visited first, then bodies. | 62599046ec188e330fdf9bf9 |
class end(TexCommand): <NEW_LINE> <INDENT> def __init__(self, environment): <NEW_LINE> <INDENT> super().__init__('end', environment) | 'end' tex command wrapper. | 62599046d4950a0f3b1117f0 |
class TLNOutputModuleTest(test_lib.OutputModuleTestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self._output_writer = cli_test_lib.TestOutputWriter() <NEW_LINE> output_mediator = self._CreateOutputMediator() <NEW_LINE> self._output_module = tln.TLNOutputModule( output_mediator, output_writer=self._ou... | Tests for the TLN output module. | 6259904645492302aabfd82f |
class Config(NamedTuple): <NEW_LINE> <INDENT> localities: Localities <NEW_LINE> events: Events <NEW_LINE> whitelist: Whitelist <NEW_LINE> factors: Factors | The top-level configuration type.
| 625990460a366e3fb87ddd43 |
class RankAllInOrderOfPreference(RankInOrderOfPreference): <NEW_LINE> <INDENT> def validate(self, responses, field): <NEW_LINE> <INDENT> if len(responses) != len(field): <NEW_LINE> <INDENT> raise rfx.WrongNumberOfChoices('all choices in field must be ranked') <NEW_LINE> <DEDENT> super().validate(responses, field) | A response format that requires the user to rank their choices in
order of preference, without weighting. All of the choices must
in the field must be ranked.
The response is expected to be a list of choices, with the more
preferred choices towards the front of the list. | 625990461f5feb6acb163f53 |
class SafeDict(dict): <NEW_LINE> <INDENT> def __missing__(self, key): <NEW_LINE> <INDENT> return '{' + key + '}' | A safe dictionary implementation that does not break down on missing keys | 62599046462c4b4f79dbcd5c |
class PublicUserApiTests(TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.client = APIClient() <NEW_LINE> <DEDENT> def test_create_valid_user_success (self): <NEW_LINE> <INDENT> payload = { 'email' : 'oscar@lgs.com', 'password' : 'testpass', 'name' : 'Oscar', } <NEW_LINE> res = self.client.post(... | Test the user API (public) | 62599046596a897236128f5e |
class RecloseSequence(IdentifiedObject): <NEW_LINE> <INDENT> def __init__(self, recloseStep=0, recloseDelay=0.0, ProtectedSwitch=None, *args, **kw_args): <NEW_LINE> <INDENT> self.recloseStep = recloseStep <NEW_LINE> self.recloseDelay = recloseDelay <NEW_LINE> self._ProtectedSwitch = None <NEW_LINE> self.ProtectedSwitch... | A reclose sequence (open and close) is defined for each possible reclosure of a breaker.A reclose sequence (open and close) is defined for each possible reclosure of a breaker.
| 6259904615baa723494632f0 |
class BarbicanAdapters(charms_openstack.adapters.OpenStackAPIRelationAdapters): <NEW_LINE> <INDENT> relation_adapters = { 'hsm': HSMAdapter, } <NEW_LINE> def __init__(self, relations): <NEW_LINE> <INDENT> super(BarbicanAdapters, self).__init__( relations, options_instance=BarbicanConfigurationAdapter( port_map=Barbican... | Adapters class for the Barbican charm.
This plumbs in the BarbicanConfigurationAdapter as the ConfigurationAdapter
to provide additional properties. | 62599046b57a9660fecd2ddb |
class ItemListView(generics.ListAPIView): <NEW_LINE> <INDENT> queryset = Item.objects.all() <NEW_LINE> permission_classes = (PERM_ALLOW_ANY,) <NEW_LINE> serializer_class = ItemSerializer <NEW_LINE> @staticmethod <NEW_LINE> def format_queryset(queryset): <NEW_LINE> <INDENT> new_queryset = [] <NEW_LINE> for bonus in quer... | Widok przedmiotow dostepnych do zakupu | 625990463617ad0b5ee0749a |
class Problem: <NEW_LINE> <INDENT> def __init__(self, directory: str, category: str, name: str, **config): <NEW_LINE> <INDENT> self.directory = directory <NEW_LINE> self.category = category <NEW_LINE> self.name = name <NEW_LINE> self.title = config["title"] <NEW_LINE> self.value = int(config["value"]) <NEW_LINE> self.t... | Default problem with an empty deployment method. | 62599046d99f1b3c44d069fe |
class Aaaas(Collection): <NEW_LINE> <INDENT> def __init__(self, wideip): <NEW_LINE> <INDENT> super(Aaaas, self).__init__(wideip) <NEW_LINE> self._meta_data['allowed_lazy_attributes'] = [Aaaa] <NEW_LINE> self._meta_data['attribute_registry'] = {'tm:gtm:wideip:aaaa:aaaastate': Aaaa} | v12.x BIG-IP® AAAA wideip collection | 6259904623849d37ff85241a |
class BonusPositionEstimator(PositionEstimator): <NEW_LINE> <INDENT> NAME = 'Bonus' <NEW_LINE> def __init__(self, medikit_min=250, medikit_max=1500, repair_min=100, repair_max=800, ammo_crate=500, factor=1): <NEW_LINE> <INDENT> self.medikit_min = medikit_min <NEW_LINE> self.medikit_max = medikit_max <NEW_LINE> self.rep... | Bonus priority:
+ Need this bonus
(*) - Close to enemy going for it | 6259904607f4c71912bb0791 |
class Canvas(app.Canvas): <NEW_LINE> <INDENT> def __init__(self, data, theta=30.0, phi=90.0, z=6.0): <NEW_LINE> <INDENT> app.Canvas.__init__(self, size=(800, 400), title="plot3d", keys="interactive") <NEW_LINE> program = gloo.Program(vert=vertex, frag=fragment) <NEW_LINE> view = np.eye(4, dtype=np.float32) <NEW_LINE> m... | build canvas | 62599046c432627299fa42b2 |
class ChemActivityByFacilityInputSet(InputSet): <NEW_LINE> <INDENT> def set_FacilityID(self, value): <NEW_LINE> <INDENT> InputSet._set_input(self, 'FacilityID', value) <NEW_LINE> <DEDENT> def set_ResponseFormat(self, value): <NEW_LINE> <INDENT> InputSet._set_input(self, 'ResponseFormat', value) <NEW_LINE> <DEDENT> def ... | An InputSet with methods appropriate for specifying the inputs to the ChemActivityByFacility
Choreo. The InputSet object is used to specify input parameters when executing this Choreo. | 62599046e76e3b2f99fd9d6b |
class CoordSystState(soya.CoordSyst, tofu.State): <NEW_LINE> <INDENT> def __init__(self, mobile): <NEW_LINE> <INDENT> self.added_into(mobile.parent) <NEW_LINE> self.matrix = mobile.matrix | CoordSystState
A State that take care of CoordSyst position, rotation and scaling.
CoordSystState extend CoordSyst, and thus have similar method (e.g. set_xyz, rotate_*,
scale, ...) | 6259904694891a1f408ba0a5 |
class PluggableBackend(object): <NEW_LINE> <INDENT> def __init__(self, pivot, **backends): <NEW_LINE> <INDENT> self.__backends = backends <NEW_LINE> self.__pivot = pivot <NEW_LINE> self.__backend = None <NEW_LINE> <DEDENT> def __get_backend(self): <NEW_LINE> <INDENT> if not self.__backend: <NEW_LINE> <INDENT> backend_n... | A pluggable backend loaded lazily based on some value. | 6259904645492302aabfd830 |
class FamilyTypeSetIterator(APIObject,IDisposable,IEnumerator): <NEW_LINE> <INDENT> def Dispose(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def MoveNext(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def next(self,*args): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def ReleaseManagedResources(self,*args):... | An iterator to a FamilyType set.
FamilyTypeSetIterator() | 62599046711fe17d825e164d |
class ExternalContent(SpiderEventListener): <NEW_LINE> <INDENT> def __init__(self, driver, domain, path_depth=-1): <NEW_LINE> <INDENT> self.domain = urlparse(domain).netloc <NEW_LINE> self.external = [] <NEW_LINE> self.fingerprinted = [] <NEW_LINE> self.driver = driver <NEW_LINE> self.path_depth = path_depth <NEW_LINE>... | Look for external calls to other domains | 6259904696565a6dacd2d939 |
class BareTrace(object): <NEW_LINE> <INDENT> def __init__(self, name=""): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.normalized_time = False <NEW_LINE> self.class_definitions = {} <NEW_LINE> self.trace_classes = [] <NEW_LINE> self.basetime = 0 <NEW_LINE> <DEDENT> def get_duration(self): <NEW_LINE> <INDENT> du... | A wrapper class that holds dataframes for all the events in a trace.
BareTrace doesn't parse any file so it's a class that should
either be (a) subclassed to parse a particular trace (like FTrace)
or (b) be instantiated and the events added with add_parsed_event()
:param name: is a string describing the trace.
:type ... | 625990466fece00bbacccd15 |
class TestLongestMountainInArray(unittest.TestCase): <NEW_LINE> <INDENT> def test_longest_mountain_in_array(self): <NEW_LINE> <INDENT> s = Solution() <NEW_LINE> self.assertEqual(5, s.longestMountain([2, 1, 4, 7, 3, 2, 5])) <NEW_LINE> self.assertEqual(0, s.longestMountain([2, 2, 2])) <NEW_LINE> self.assertEqual(0, s.lon... | Test q845_longest_mountain_in_array.py | 6259904682261d6c52730875 |
@method_decorator(login_required, name='dispatch') <NEW_LINE> class SongUpdateView(SuccessMessageMixin, UpdateView): <NEW_LINE> <INDENT> form_class = SongForm <NEW_LINE> model = Song <NEW_LINE> template_name = 'songs/add.html' <NEW_LINE> success_url = reverse_lazy("backend:index") <NEW_LINE> success_message = _("Song %... | Updates existing song | 62599046d7e4931a7ef3d3d5 |
class CpuState(Base): <NEW_LINE> <INDENT> __tablename__ = 'cpuState' <NEW_LINE> id = Column(Integer, primary_key=True) <NEW_LINE> savename = Column(String) <NEW_LINE> gbregisters = Column(PickleType) <NEW_LINE> stack_ptr = Column(Integer) <NEW_LINE> program_ctr = Column(Integer) <NEW_LINE> def __repr__(self): <NEW_LINE... | SQLAlchemy base class to save cpustate.
...
Attributes
----------
id : int
primary key for database
savename : string
game save name
gbregisters : pickle
pickled list of the cpu registers A-F
stack_ptr : int
the stack pointer
program_ctr : int
the program counter | 6259904607f4c71912bb0792 |
class Yasb(): <NEW_LINE> <INDENT> def __init__(self, arg): <NEW_LINE> <INDENT> pass | docstring for Yasb | 62599046596a897236128f5f |
class TestActionInteger(JNTTFactory, JNTTFactoryCommon): <NEW_LINE> <INDENT> entry_name='action_integer' | Test the value factory
| 625990463c8af77a43b688ed |
class SurrogatePK(object): <NEW_LINE> <INDENT> __table_args__ = {"extend_existing": True} <NEW_LINE> id = db.Column(UUIDType(binary=False), primary_key=True) | A mixin that adds a surrogate UUID 'primary key' column named ``id`` to
any declarative-mapped class. | 62599046cad5886f8bdc5a2e |
class RetrieveReportInputSet(InputSet): <NEW_LINE> <INDENT> def set_AWSAccessKeyId(self, value): <NEW_LINE> <INDENT> super(RetrieveReportInputSet, self)._set_input('AWSAccessKeyId', value) <NEW_LINE> <DEDENT> def set_AWSMarketplaceId(self, value): <NEW_LINE> <INDENT> super(RetrieveReportInputSet, self)._set_input('AWSM... | An InputSet with methods appropriate for specifying the inputs to the RetrieveReport
Choreo. The InputSet object is used to specify input parameters when executing this Choreo. | 6259904621a7993f00c672c9 |
class ReceiveVerb(VerbExtension): <NEW_LINE> <INDENT> def main(self, *, args): <NEW_LINE> <INDENT> print('Waiting for UDP multicast datagram...') <NEW_LINE> try: <NEW_LINE> <INDENT> data, (host, port) = receive() <NEW_LINE> <DEDENT> except KeyboardInterrupt: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> else: <NEW_LINE>... | Receive a single UDP multicast packet. | 62599046287bf620b6272f49 |
class ZWaveNumericSensor(ZwaveSensorBase): <NEW_LINE> <INDENT> @property <NEW_LINE> def native_value(self): <NEW_LINE> <INDENT> return round(self.values.primary.value, 2) <NEW_LINE> <DEDENT> @property <NEW_LINE> def native_unit_of_measurement(self): <NEW_LINE> <INDENT> if self.values.primary.units == "C": <NEW_LINE> <I... | Representation of a Z-Wave sensor. | 6259904623849d37ff85241c |
class Fragment(pygame.sprite.Sprite): <NEW_LINE> <INDENT> number = 0 <NEW_LINE> def __init__(self, pos, layer = 9): <NEW_LINE> <INDENT> self._layer = layer <NEW_LINE> pygame.sprite.Sprite.__init__(self, self.groups) <NEW_LINE> self.pos = [0.0,0.0] <NEW_LINE> self.fragmentmaxspeed = 200 <NEW_LINE> self.number = Fragment... | generic Fragment class. | 6259904691af0d3eaad3b185 |
class TestCompareXLSXFiles(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.maxDiff = None <NEW_LINE> filename = 'fit_to_pages03.xlsx' <NEW_LINE> test_dir = 'xlsxwriter/test/comparison/' <NEW_LINE> self.got_filename = test_dir + '_test_' + filename <NEW_LINE> self.exp_filename = test_di... | Test file created by XlsxWriter against a file created by Excel. | 62599046e76e3b2f99fd9d6d |
class jboolean_t(java_fundamental_t): <NEW_LINE> <INDENT> JNAME = 'jboolean' <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> java_fundamental_t.__init__(self, jboolean_t.JNAME) | represents jboolean type | 62599046711fe17d825e164e |
class IProjectContainer(Interface): <NEW_LINE> <INDENT> pass | This is really just a marker interface.
mark the folder as project container. | 62599046d6c5a102081e347d |
class Test__Astropy_Table__(): <NEW_LINE> <INDENT> class SimpleTable: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.columns = [[1, 2, 3], [4, 5, 6], [7, 8, 9] * u.m] <NEW_LINE> self.names = ['a', 'b', 'c'] <NEW_LINE> self.meta = OrderedDict([('a', 1), ('b', 2)]) <NEW_LINE> <DEDENT> def __astropy_tabl... | Test initializing a Table subclass from a table-like object that
implements the __astropy_table__ interface method. | 62599046b830903b9686ee2b |
class Node: <NEW_LINE> <INDENT> def __init__(self, value, coord, H): <NEW_LINE> <INDENT> self.value = value <NEW_LINE> self.coord = coord <NEW_LINE> self.parent = None <NEW_LINE> self.H = H <NEW_LINE> self.G = float('inf') | To create nodes of a graph
Attributes:
coord (tuple): The (row, col) coordinate
G (int): The cost to reach this node
H (int): The cost to goal node
parent (Node): The parent of this node
value (int): The value at this location in exploration map | 625990460a366e3fb87ddd47 |
class StartConds: <NEW_LINE> <INDENT> def __init__(self, time: float, coords: Coordinates, velo: float, mu: float, theta: float): <NEW_LINE> <INDENT> self.t = time <NEW_LINE> self.coords = copy(coords) <NEW_LINE> self.V = velo <NEW_LINE> self.mu = mu <NEW_LINE> self.Theta = theta <NEW_LINE> <DEDENT> def __copy__(self):... | Starting conditions of the rocket's ballistics task. | 62599046dc8b845886d5491c |
class MockJob(progress.Progress): <NEW_LINE> <INDENT> def __init__(self, *args, sleep_time: float = 0.1, **kwargs): <NEW_LINE> <INDENT> self._sleep_time = sleep_time <NEW_LINE> super(MockJob, self).__init__(*args, **kwargs) <NEW_LINE> <DEDENT> def Run(self): <NEW_LINE> <INDENT> n = self.ctx.n or 0 <NEW_LINE> for self.c... | A mock job. | 6259904650485f2cf55dc2e9 |
class BalancingModeValueValuesEnum(_messages.Enum): <NEW_LINE> <INDENT> RATE = 0 <NEW_LINE> UTILIZATION = 1 | Specifies the balancing mode for this backend. For global HTTP(S) load
balancing, the default is UTILIZATION. Valid values are UTILIZATION and
RATE.
Values:
RATE: <no description>
UTILIZATION: <no description> | 625990461f5feb6acb163f57 |
class Player: <NEW_LINE> <INDENT> def __init__(self, name): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.uid = getUid(name) <NEW_LINE> self.last_online = time.mktime(time.gmtime()) <NEW_LINE> self.game_id = None | Player class | 62599046d53ae8145f9197c1 |
class DBManger: <NEW_LINE> <INDENT> host = None <NEW_LINE> port = None <NEW_LINE> client = None <NEW_LINE> db = None <NEW_LINE> def __init__(self, host: str, port: int, db: str): <NEW_LINE> <INDENT> self.host = host <NEW_LINE> self.port = port <NEW_LINE> self.client = MongoClient(host=host, port=port) <NEW_LINE> self.d... | manager the mongodb | 6259904671ff763f4b5e8b05 |
class AccountIdentityInfo(models.Model): <NEW_LINE> <INDENT> account = models.OneToOneField(Client, verbose_name=_('Account'), primary_key=True) <NEW_LINE> passport = models.ForeignKey(Passport, verbose_name=_('Passport')) <NEW_LINE> national_id_card = models.ForeignKey(NationalIDCard, verbose_name=_('National ID Card'... | Identification info of account | 6259904673bcbd0ca4bcb5ee |
class dependency_node: <NEW_LINE> <INDENT> def depends_on(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def is_fulfilled(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> class _AbortApply(Exception): <NEW_LINE> <INDENT> def __init__(self,value): <NEW_LINE> <INDENT> super(dependency_node._AbortApply, self).__in... | A node of an dependency graph that only supports downward traversal
i.e. traversal towards the nodes it depends upon. | 6259904626238365f5fadebe |
class HelpAction(argparse.Action): <NEW_LINE> <INDENT> def __call__(self, parser, namespace, values, option_string=None): <NEW_LINE> <INDENT> log = logging.getLogger(__name__) <NEW_LINE> app = self.default <NEW_LINE> parser.print_help(app.stdout) <NEW_LINE> app.stdout.write('\nCommands:\n') <NEW_LINE> command_manager =... | Provide a custom action so the -h and --help options
to the main app will print a list of the commands.
The commands are determined by checking the CommandManager
instance, passed in as the "default" value for the action. | 62599046d4950a0f3b1117f3 |
class Dict(ModelType): <NEW_LINE> <INDENT> @property <NEW_LINE> def default(self): <NEW_LINE> <INDENT> if self._default is None: <NEW_LINE> <INDENT> return {} <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return self._default <NEW_LINE> <DEDENT> <DEDENT> def from_json(self, value): <NEW_LINE> <INDENT> if value is None ... | A field class for representing a Python dict.
The stored value must be either be None or a dict. | 6259904645492302aabfd834 |
class AlphaBetaAgent(MultiAgentSearchAgent): <NEW_LINE> <INDENT> def getAction(self, gameState): <NEW_LINE> <INDENT> Depth = self.depth <NEW_LINE> Alpha = -99999 <NEW_LINE> Beta = 99999 <NEW_LINE> return self.AlphaBetaSearch(Depth, gameState, 0, Alpha, Beta) <NEW_LINE> <DEDENT> def AlphaBetaSearch(self, currentdepth, s... | Your minimax agent with alpha-beta pruning (question 3) | 62599046711fe17d825e164f |
class arch_mips4(generic_mips): <NEW_LINE> <INDENT> def __init__(self, myspec): <NEW_LINE> <INDENT> generic_mips.__init__(self, myspec) <NEW_LINE> self.settings["CFLAGS"] = "-O2 -march = mips4 -mabi = 32 -mplt -pipe" | Builder class for MIPS IV [Big-endian] | 625990464e696a045264e7d2 |
class Label(Tkinter.Label, CtxMenu.CtxMenuMixin, IsCurrentMixin, SeverityMixin): <NEW_LINE> <INDENT> def __init__ (self, master, formatStr = None, formatFunc = unicode, helpText = None, helpURL = None, isCurrent = True, severity = RO.Constants.sevNormal, **kargs): <NEW_LINE> <INDENT> kargs.setdefault("anchor", "e") <NE... | Base class for labels (display ROWdgs); do not use directly.
Inputs:
- formatStr: formatting string; if omitted, formatFunc is used.
Displayed value is formatStr % value.
- formatFunc: formatting function; ignored if formatStr specified.
Displayed value is formatFunc(value).
- helpText short text for hot help... | 62599046b830903b9686ee2c |
class CircleConstraint(Constraint2D): <NEW_LINE> <INDENT> def __init__(self, radius, edges=16): <NEW_LINE> <INDENT> self._radius = radius <NEW_LINE> self._edges = edges <NEW_LINE> super().__init__() <NEW_LINE> <DEDENT> def _boundary_points(self): <NEW_LINE> <INDENT> n = self._edges <NEW_LINE> radius = self._radius <NEW... | Constraint describing a circle | 6259904629b78933be26aa74 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.