code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class ConfigurationSettings(object): <NEW_LINE> <INDENT> def __init__(self, command): <NEW_LINE> <INDENT> self.command = command <NEW_LINE> <DEDENT> def __repr__(self): <NEW_LINE> <INDENT> definitions = type(self).configuration_setting_definitions <NEW_LINE> settings = imap( lambda setting: repr((setting.name, setting.... | Represents the configuration settings common to all :class:`SearchCommand` classes.
| 62598f9426068e7796d4c616 |
class AddUserAskView(View): <NEW_LINE> <INDENT> def post(self, request): <NEW_LINE> <INDENT> userask_form = UserAskForm(request.POST) <NEW_LINE> if userask_form.is_valid(): <NEW_LINE> <INDENT> user_ask = userask_form.save(commit=True) <NEW_LINE> return HttpResponse('{"status":"success"}', content_type='application/json... | 用户bug反馈 | 62598f94a8ecb03325870ebc |
class BlockMerger(object): <NEW_LINE> <INDENT> def merge(self, sources, keys): <NEW_LINE> <INDENT> raise NotImplementedError | A method for merging sources across blocks | 62598f946aa9bd52df0d4b82 |
class ActionCheck(ActionItem, CheckBox): <NEW_LINE> <INDENT> pass | ActionCheck class, see module documentation for more information. | 62598f94d6c5a102081e1df7 |
class ConfigurationViewlet(ViewletBase): <NEW_LINE> <INDENT> index = ViewPageTemplateFile('configuration.pt') <NEW_LINE> suffix = '' <NEW_LINE> def getATRichTextFieldNames(self): <NEW_LINE> <INDENT> schema = self.context.Schema() <NEW_LINE> return [ field.getName() for field in schema.filterFields(type='text') if field... | A viewlet which includes the TinyMCE configuration JavaScript
This can not be done in the portal_javascript Tool because it needs to be
relative to the context path. | 62598f9473bcbd0ca4bc9f0c |
class TypeTestCase(TestCase): <NEW_LINE> <INDENT> def test_none_parser(self): <NEW_LINE> <INDENT> self.assertEqual(None, types.none_parser("")) <NEW_LINE> self.assertEqual(..., types.none_parser("1")) <NEW_LINE> self.assertEqual(..., types.none_parser("0")) <NEW_LINE> self.assertEqual(..., types.none_parser("string")) ... | Test parsers defined in `dgeg.types`. | 62598f943cc13d1c6d465421 |
class BadDlUseLinter(bad_module_use.BadModuleUseLinter): <NEW_LINE> <INDENT> off_by_default = False <NEW_LINE> _code = 'DUO117' <NEW_LINE> _error_tmpl = 'DUO117 avoid "dl" module use' <NEW_LINE> @property <NEW_LINE> def illegal_modules(self): <NEW_LINE> <INDENT> return [ "dl", ] | This linter looks for use of the "dl" module.
"The dl module bypasses the Python type system and error handling. If
used incorrectly it may cause segmentation faults, crashes or other
incorrect behaviour."
https://docs.python.org/2.7/library/dl.html | 62598f94379a373c97d98cc6 |
@add_objprint(color=False) <NEW_LINE> @dataclass <NEW_LINE> class DataTrainingArguments(BasicDataTrainingArguments): <NEW_LINE> <INDENT> debug_mode: bool = field( default=False, metadata={"help": "whether to load a subset of data for debug"} ) <NEW_LINE> pseudo_label_path: str = field( default="", metadata={"help": "P... | Arguments pertaining to what data we are going to input our model for training and eval. | 62598f943617ad0b5ee05e00 |
class Image(orm.AbstractModel): <NEW_LINE> <INDENT> _name = 'website.qweb.field.image' <NEW_LINE> _inherit = ['website.qweb.field', 'ir.qweb.field.image'] <NEW_LINE> def to_html(self, cr, uid, field_name, record, options, source_element, t_att, g_att, qweb_context, context=None): <NEW_LINE> <INDENT> assert source_eleme... | Widget options:
``class``
set as attribute on the generated <img> tag | 62598f94379a373c97d98cc7 |
class Package(Scope): <NEW_LINE> <INDENT> def __init__(self, name, line, scope=None): <NEW_LINE> <INDENT> Scope.__init__(self, name, line, "package", scope) | Package Method object | 62598f94507cdc57c63a4a48 |
class ClientUpdate(object): <NEW_LINE> <INDENT> buttons = {} <NEW_LINE> keys = { XK_space: lambda self, event: self.cycle_gravity(event.time), XK_Escape: lambda self, event: self.rollback(event.time), None: lambda self, event: self.commit(event.time) } <NEW_LINE> def __init__(self, event, client, pointer, resistance, c... | A transactional client configuration change. | 62598f94be8e80087fbbed12 |
class Problem: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> @property <NEW_LINE> def search_space(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> @property <NEW_LINE> def dimension(self): <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> def eval(self, x): <NEW_LINE> <IND... | Base class of problem for benchmarking | 62598f9429b78933be269f37 |
class Giolfc(Gimpic, OpenBLAS, ScaLAPACK, Fftw): <NEW_LINE> <INDENT> NAME = 'giolfc' <NEW_LINE> SUBTOOLCHAIN = Gimpic.NAME | Compiler toolchain with GCC+CUDA, IntelMPI, OpenBLAS, ScaLAPACK and FFTW. | 62598f94fbf16365ca793d69 |
@tf_export('profiler.experimental.Profile', v1=[]) <NEW_LINE> class Profile(object): <NEW_LINE> <INDENT> def __init__(self, logdir): <NEW_LINE> <INDENT> self._logdir = logdir <NEW_LINE> <DEDENT> def __enter__(self): <NEW_LINE> <INDENT> start(self._logdir) <NEW_LINE> <DEDENT> def __exit__(self, typ, value, tb): <NEW_LIN... | Context-manager profile API.
Profiling will start when entering the scope, and stop and save the results to
the logdir when exits the scope. Open TensorBoard profile tab to view results.
Example usage:
```python
with tf.profiler.experimental.Profile("/path/to/logdir"):
# do some work
``` | 62598f947047854f4633f094 |
class TestLegacyTestMessage(fedmsg.tests.test_meta.Base): <NEW_LINE> <INDENT> expected_title = 'cips' <NEW_LINE> expected_link = None <NEW_LINE> expected_subti = None <NEW_LINE> expected_packages = set([]) <NEW_LINE> expected_icon = 'https://rpm-factory-jenkins.rhev-ci-vms.eng.rdu2.redhat.com/static/0e416130/images/hea... | shanks once sent a test message like this one... | 62598f94460517430c431eb5 |
@adapter(IDXBuyableEvent) <NEW_LINE> @implementer(IBuyableEventData) <NEW_LINE> class BuyableEventDataProvider(object): <NEW_LINE> <INDENT> def __init__(self, context): <NEW_LINE> <INDENT> self.context = context <NEW_LINE> <DEDENT> @property <NEW_LINE> def cart_count_limit(self): <NEW_LINE> <INDENT> return self.context... | Accessor Interface
| 62598f94287bf620b6271874 |
class RockSimEngine(FilelikeLoader): <NEW_LINE> <INDENT> rse_engine_defs = [ {'name': u"Isp", 'key': 'Isp', 'type': float}, {'name': u"Total impulse", 'key': 'Itot', 'type': float}, {'name': u"Average thrust", 'key': 'avgThrust', 'type': float}, {'name': u"Burn time", 'key': 'burn-time', 'type': float}, {'name': u"Name... | File Loader for RockSim engine files (.rse).
RockSim Engine files are XML. | 62598f94b5575c28eb712b26 |
class MultiStat(BaseStat): <NEW_LINE> <INDENT> def __init__(self, *data): <NEW_LINE> <INDENT> stats = {} <NEW_LINE> for label, p in data: <NEW_LINE> <INDENT> stats[label] = Stat(p) <NEW_LINE> <DEDENT> self.stats = stats <NEW_LINE> <DEDENT> def add(self, label, stat): <NEW_LINE> <INDENT> self.stats[label] = stat <NEW_LI... | Keeps track of statistics for multiple classes in a single
category. For example, the 0 and 1 scores of each user agent. | 62598f9401c39578d7f12a3e |
class PrivateUserAPITests(TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> user_info = { "name": "John Doe", "email": "john@email.com", "password": "john1234", } <NEW_LINE> self.user = create_user(**user_info) <NEW_LINE> self.client = APIClient() <NEW_LINE> self.client.force_authenticate(user=self.us... | Test that require user authentication | 62598f9430dc7b766599f508 |
class Point: <NEW_LINE> <INDENT> def __init__(self, x = 0, y = 0): <NEW_LINE> <INDENT> self.x = x <NEW_LINE> self.y = y <NEW_LINE> <DEDENT> def distance(self, other): <NEW_LINE> <INDENT> return math.sqrt((self.x - other.x)**2 + (self.y - other.y)**2) | ordered pair | 62598f9463d6d428bbee2473 |
class GoalStatusArray(metaclass=Metaclass): <NEW_LINE> <INDENT> __slots__ = [ '_header', '_status_list', ] <NEW_LINE> def __init__(self, **kwargs): <NEW_LINE> <INDENT> assert all(['_' + key in self.__slots__ for key in kwargs.keys()]), 'Invalid arguments passed to constructor: %r' % kwargs.keys() <NEW_LINE> ... | Message class 'GoalStatusArray'. | 62598f940a50d4780f70508c |
class TestException(Exception): <NEW_LINE> <INDENT> pass | An unexpected error occured while running or setting up tests. | 62598f94baa26c4b54d4ef65 |
class TuyaLevelControlManufCluster(TuyaMCUCluster): <NEW_LINE> <INDENT> dp_to_attribute: Dict[int, DPToAttributeMapping] = { 1: DPToAttributeMapping( TuyaOnOff.ep_attribute, "on_off", dp_type=TuyaDPType.BOOL, ), 2: DPToAttributeMapping( TuyaLevelControl.ep_attribute, "current_level", dp_type=TuyaDPType.VALUE, converter... | Tuya with Level Control data points. | 62598f9476e4537e8c3ef268 |
class SimpleRegionSerializer(serializers.ModelSerializer): <NEW_LINE> <INDENT> url = serializers.HyperlinkedIdentityField(view_name="api:regions-detail", lookup_field="uid") <NEW_LINE> class Meta: <NEW_LINE> <INDENT> model = Region <NEW_LINE> fields = ("uid", "name", "description", "url") | Serializer for returning Region model data without geometry. | 62598f945f7d997b871f9237 |
class SshController(object): <NEW_LINE> <INDENT> def __init__(self, hostname, username, password): <NEW_LINE> <INDENT> self.username = username <NEW_LINE> self.password = password <NEW_LINE> self.hostname = hostname <NEW_LINE> self.client = paramiko.SSHClient() <NEW_LINE> self.client.set_missing_host_key_policy(Suppres... | Use this to execute commands on a roboRIO in a cross platform manner
::
with SshController(hostname, username, password) as controller:
controller.exec_cmd("cat /etc/lsb-release", print_output=True) | 62598f9423e79379d538c1b7 |
class Login(LowDataAdapter): <NEW_LINE> <INDENT> exposed = True <NEW_LINE> def GET(self): <NEW_LINE> <INDENT> cherrypy.response.status = '401 Unauthorized' <NEW_LINE> cherrypy.response.headers['WWW-Authenticate'] = 'Session' <NEW_LINE> return { 'status': cherrypy.response.status, 'message': "Please log in", } <NEW_LINE... | All interactions with this REST API must be authenticated. Authentication
is performed through Salt's eauth system. You must set the eauth backend
and allowed users by editing the :conf_master:`external_auth` section in
your master config.
Authentication credentials are passed to the REST API via a session id in
one o... | 62598f9473bcbd0ca4bc9f0e |
class TargetLocationLandmarks(TargetLocation): <NEW_LINE> <INDENT> def __init__(self, target, landmarks, radius=0.0, reward_noise=0.01): <NEW_LINE> <INDENT> super(TargetLocationLandmarks, self).__init__(target, radius, reward_noise) <NEW_LINE> self._state_space_dim = len(landmarks) <NEW_LINE> self.landmarks = [] <NEW_L... | A :py:class:`Plant` which gives negative reward proportional to
the distance to point ``target`` in the xy plane. If the robot is
closer than ``radius`` to the target, the reward will be 0.0.
The state is composed of the distance to predefined ``landmarks``,
specified with their coordinates in the xy plane. Gaussian no... | 62598f94e76e3b2f99fd86ef |
class Model(object): <NEW_LINE> <INDENT> _clf = None <NEW_LINE> def __init__(self, config): <NEW_LINE> <INDENT> self.data_path = config['dataset'] <NEW_LINE> self._clf = getattr(onionpop.classifiers, config['classifier'])(**config['params']) <NEW_LINE> <DEDENT> def dump(self, fpath): <NEW_LINE> <INDENT> with open(fpath... | This class implements a model passed to the API. | 62598f94379a373c97d98cc8 |
@ejit <NEW_LINE> class FloatingPointError(ArithmeticError): <NEW_LINE> <INDENT> pass | Floating point operation failed. | 62598f9499cbb53fe6830b85 |
class Block(Stmt): <NEW_LINE> <INDENT> fields = ('name', 'body') | A node that represents a block. | 62598f9491af0d3eaad39abd |
class SupportedNucleotides (pyxb.binding.datatypes.string, pyxb.binding.basis.enumeration_mixin): <NEW_LINE> <INDENT> _ExpandedName = pyxb.namespace.ExpandedName(Namespace, 'SupportedNucleotides') <NEW_LINE> _XSDLocation = pyxb.utils.utility.Location('/tmp/tmpJ5bTzwxsds/PacBioBaseDataModel.xsd', 843, 1) <NEW_LINE> _Doc... | An atomic simple type. | 62598f94a79ad16197769d17 |
class channeledinput(object): <NEW_LINE> <INDENT> maxchunksize = 4 * 1024 <NEW_LINE> def __init__(self, in_: "BinaryIO", out: "BinaryIO", channel: bytes) -> None: <NEW_LINE> <INDENT> self.in_ = in_ <NEW_LINE> self.out = out <NEW_LINE> self.channel = channel <NEW_LINE> <DEDENT> @property <NEW_LINE> def name(self) -> str... | Read data from in_.
Requests for input are written to out in the following format:
channel identifier - 'I' for plain input, 'L' line based (1 byte)
how many bytes to send at most (unsigned int),
The client replies with:
data length (unsigned int), 0 meaning EOF
data | 62598f94a79ad16197769d18 |
class TestAllBagsView: <NEW_LINE> <INDENT> @pytest.fixture(autouse=True) <NEW_LINE> def mock_pe(self, monkeypatch): <NEW_LINE> <INDENT> self.mock_paginate_entries = mock.MagicMock() <NEW_LINE> monkeypatch.setattr( 'coda_mdstore.views.paginate_entries', self.mock_paginate_entries) <NEW_LINE> <DEDENT> def test_renders_co... | Tests for coda_mdstore.views.all_bags. | 62598f947b25080760ed7157 |
class KR_type_A(KirillovReshetikhinCrystalFromPromotion): <NEW_LINE> <INDENT> def classical_decomposition(self): <NEW_LINE> <INDENT> return CrystalOfTableaux(self.cartan_type().classical(), shape=[self.s()]*self.r()) <NEW_LINE> <DEDENT> @cached_method <NEW_LINE> def promotion(self): <NEW_LINE> <INDENT> T = self.classic... | Class of Kirillov-Reshetikhin crystals of type `A_n^{(1)}`.
EXAMPLES::
sage: K = crystals.KirillovReshetikhin(['A',3,1], 2,2)
sage: b = K(rows=[[1,2],[2,4]])
sage: b.f(0)
[[1, 1], [2, 2]] | 62598f9496565a6dacd2cdd5 |
class Photo(core_models.TimeStampedModel): <NEW_LINE> <INDENT> caption = models.CharField(max_length=80) <NEW_LINE> file = models.ImageField(upload_to="board_photos") <NEW_LINE> image = models.ForeignKey("FreeBoard", related_name="photos", on_delete=models.CASCADE) <NEW_LINE> def __str__(self): <NEW_LINE> <INDENT> retu... | Photo Model Definition | 62598f94fbf16365ca793d6b |
class Model( Entity, EntityCreateMixin, EntityDeleteMixin, EntityReadMixin): <NEW_LINE> <INDENT> name = entity_fields.StringField(required=True) <NEW_LINE> info = entity_fields.StringField(null=True) <NEW_LINE> vendor_class = entity_fields.StringField(null=True) <NEW_LINE> hardware_model = entity_fields.StringField(nul... | A representation of a Model entity. | 62598f940a50d4780f70508d |
class MCBuilderException(Exception): <NEW_LINE> <INDENT> pass | Base Exception class for this module. | 62598f9430dc7b766599f509 |
class Model(Supermodel): <NEW_LINE> <INDENT> def __init__(self, uuid, name :str): <NEW_LINE> <INDENT> super(Model, self).__init__(uuid,name) <NEW_LINE> self.inputs['time'] = Input({'name': 'time', 'unit': 'float', 'dimensions': []}) <NEW_LINE> <DEDENT> async def func_peri(self, prep_to_peri=None): <NEW_LINE> <INDENT> t... | prints the given input | 62598f9430dc7b766599f50a |
class TeamJoinFormView(generic.FormView): <NEW_LINE> <INDENT> form_class = TeamJoinForm <NEW_LINE> template_name = "tms/teamjoin.html" <NEW_LINE> success_url = '/tms/landing' <NEW_LINE> def get(self, request, *args, **kwargs): <NEW_LINE> <INDENT> if not request.user.student: <NEW_LINE> <INDENT> return HttpResponseRedir... | C7.8 Team Joining Form View Controller
Displays to the user a form to join one of the teams in a section.
Fulfills Required Components:
- <<Screen>> JoinTeam
- <<Form>> JoinTeamForm (see forms.py) | 62598f94f8510a7c17d7dfd3 |
class MatchResult(object): <NEW_LINE> <INDENT> def __init__(self, L1, L2): <NEW_LINE> <INDENT> self.LO1 = L1 <NEW_LINE> self.LO2 = L2 <NEW_LINE> self.Result = [[[0,0],[0,0]],[[0,0],[0,0]]] <NEW_LINE> <DEDENT> def update(self, bot1, bot2, winside): <NEW_LINE> <INDENT> if winside == 0: <NEW_LINE> <INDENT> self.Result[sel... | classdocs | 62598f948e71fb1e983bb76b |
class TokenException(KiteException): <NEW_LINE> <INDENT> def __init__(self, message, code=403): <NEW_LINE> <INDENT> super(TokenException, self).__init__(message, code) | Represents all token and authentication related errors. Default code is 403. | 62598f9476e4537e8c3ef26a |
class Heading(BlockElement): <NEW_LINE> <INDENT> def __init__(self, tag, token, child_tags): <NEW_LINE> <INDENT> super(Heading,self).__init__(tag,token , child_tags) <NEW_LINE> self.regexp = re.compile(self.re_string(),re.MULTILINE) <NEW_LINE> <DEDENT> def re_string(self): <NEW_LINE> <INDENT> whitespace = r'[ \t]*' <NE... | Finds heading wiki elements.
>>> h1 = Heading('h1','=',[])
>>> mo = h1.regexp.search('before\n = An important thing = \n after')
>>> mo.group(1)
'An important thing'
>>> mo.group(0)
' = An important thing = \n' | 62598f94cb5e8a47e493bfcf |
class RenumberHeadings(Processor): <NEW_LINE> <INDENT> name = "renumberheadings" <NEW_LINE> after = ("sortheadings", "includes") <NEW_LINE> def apply(self, block, context, level=2): <NEW_LINE> <INDENT> body = block.get("body", ()) <NEW_LINE> for subblock in body: <NEW_LINE> <INDENT> if subblock.get("type") == "h": <NEW... | Adds "level" keys to headings indicating their level in the heading
hierarchy. | 62598f941b99ca400228f389 |
class InputFileError(Error): <NEW_LINE> <INDENT> pass | Excpetion raise for errors in input files. | 62598f9499cbb53fe6830b87 |
@mark.django_db <NEW_LINE> @ddt.ddt <NEW_LINE> class ConsentHelpersTest(testcases.TestCase): <NEW_LINE> <INDENT> def test_get_data_sharing_consent_no_enterprise(self): <NEW_LINE> <INDENT> assert helpers.get_data_sharing_consent('bob', TEST_UUID, course_id='fake-course') is None | Test cases for helper functions for the Consent application. | 62598f94f7d966606f747c9d |
class TIME(_DateTimeMixin, sqltypes.Time): <NEW_LINE> <INDENT> _storage_format = "%(hour)02d:%(minute)02d:%(second)02d.%(microsecond)06d" <NEW_LINE> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> truncate_microseconds = kwargs.pop("truncate_microseconds", False) <NEW_LINE> super(TIME, self).__init__(*args, **... | Represent a Python time object in SQLite using a string.
The default string storage format is::
"%(hour)02d:%(minute)02d:%(second)02d.%(microsecond)06d"
e.g.::
12:05:57.10558
The storage format can be customized to some degree using the
``storage_format`` and ``regexp`` parameters, such as::
import re... | 62598f94462c4b4f79dbb6c0 |
class Each(ParseExpression): <NEW_LINE> <INDENT> def __init__(self, exprs): <NEW_LINE> <INDENT> super(Each, self).__init__(exprs) <NEW_LINE> self.parser_config.min_match = [ e.min_match if isinstance(e, Many) else 1 for e in exprs ] <NEW_LINE> self.parser_config.max_match = [ e.max_match if isinstance(e, Many) else 1 f... | Requires all given :class:`ParseExpression` s to be found, but in
any order. Expressions may be separated by whitespace.
May be constructed using the ``'&'`` operator. | 62598f94507cdc57c63a4a4c |
class _Context: <NEW_LINE> <INDENT> def __init__(self, afunc, efunc): <NEW_LINE> <INDENT> self.__afunc = afunc <NEW_LINE> self.__efunc = efunc <NEW_LINE> self.__fake_await_event = asyncio.Event() <NEW_LINE> self.__fake_await_event.set() <NEW_LINE> <DEDENT> async def __aenter__(self): <NEW_LINE> <INDENT> if self.__afunc... | Read lock context
| 62598f94bde94217f37074c5 |
class NetGraph(_Graph): <NEW_LINE> <INDENT> defaults = [ ( "interface", "auto", "Interface to display info for ('auto' for detection)" ), ("bandwidth_type", "down", "down(load)/up(load)"), ] <NEW_LINE> def __init__(self, **config): <NEW_LINE> <INDENT> _Graph.__init__(self, **config) <NEW_LINE> self.add_defaults(NetGrap... | Display a network usage graph. | 62598f9499cbb53fe6830b88 |
class ScreenBlanker: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.widgets = [] <NEW_LINE> <DEDENT> def blank(self): <NEW_LINE> <INDENT> d = QtGui.QApplication.desktop() <NEW_LINE> for i in range(d.screenCount()): <NEW_LINE> <INDENT> w = Black() <NEW_LINE> self.widgets.append(w) <NEW_LINE> sg = d.scr... | Perform the blanking on ALL screens that we can detect.
This is so that extraneous light does not leak into the
detector during acquisition. | 62598f942ae34c7f260aada3 |
class OrderingList(list): <NEW_LINE> <INDENT> def __init__(self, ordering_attr=None, ordering_func=None, reorder_on_append=False): <NEW_LINE> <INDENT> self.ordering_attr = ordering_attr <NEW_LINE> if ordering_func is None: <NEW_LINE> <INDENT> ordering_func = count_from_0 <NEW_LINE> <DEDENT> self.ordering_func = orderin... | A custom list that manages position information for its children.
The :class:`.OrderingList` object is normally set up using the
:func:`.ordering_list` factory function, used in conjunction with
the :func:`.relationship` function. | 62598f947047854f4633f098 |
class detect_anomaly(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.prev = torch.is_anomaly_enabled() <NEW_LINE> <DEDENT> def __enter__(self): <NEW_LINE> <INDENT> torch.set_anomaly_enabled(True) <NEW_LINE> <DEDENT> def __exit__(self, *args): <NEW_LINE> <INDENT> torch.set_anomaly_enabled(self.... | Context-manager that enable anomaly detection for the autograd engine.
This does two things:
- Running the forward pass with detection enabled will allow the backward
pass to print the traceback of the forward operation that created the failing
backward function.
- Any backward computation that generate "nan" value wi... | 62598f9410dbd63aa1c70874 |
class AnsibleStringFormatChecker(BaseChecker): <NEW_LINE> <INDENT> __implements__ = (IAstroidChecker,) <NEW_LINE> name = 'string' <NEW_LINE> msgs = MSGS <NEW_LINE> @check_messages(*(MSGS.keys())) <NEW_LINE> def visit_call(self, node): <NEW_LINE> <INDENT> func = utils.safe_infer(node.func) <NEW_LINE> if (isinstance(func... | Checks string formatting operations to ensure that the format string
is valid and the arguments match the format string. | 62598f94baa26c4b54d4ef68 |
class DesignRegistry(object): <NEW_LINE> <INDENT> grok.implements(IDesignLookup) <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> self._designs = {} <NEW_LINE> self._designs_by_name = {} <NEW_LINE> <DEDENT> def register_design(self, factory): <NEW_LINE> <INDENT> context = grok.context.bind().get(factory) <NEW_LINE> n... | Register designs
| 62598f9401c39578d7f12a42 |
@dataclass <NEW_LINE> class PullResults: <NEW_LINE> <INDENT> pulling_successfull = 0 <NEW_LINE> pulling_failed = 0 <NEW_LINE> repositories_not_found: dict <NEW_LINE> repositories_pulled: dict = {} | Results summerizing the pull command | 62598f94b5575c28eb712b28 |
class smartchars(object): <NEW_LINE> <INDENT> endash = '–' <NEW_LINE> emdash = '—' <NEW_LINE> ellipsis = '…' <NEW_LINE> quotes = {'af': '“”‘’', 'af-x-altquot': '„”‚’', 'ca': '«»“”', 'ca-x-altquot': '“”‘’', 'cs': '„“‚‘', 'cs-x-altquot': '»«›‹', 'de': '„“‚‘', 'de-x-altquot': '»«›‹... | Smart quotes and dashes
| 62598f94e64d504609df9213 |
class LnxhcCheckError(LnxhcError): <NEW_LINE> <INDENT> pass | Lnxhc error within check | 62598f9416aa5153ce4001b5 |
class ClashCalculation(object): <NEW_LINE> <INDENT> def __init__(self, tolerance = 0.5): <NEW_LINE> <INDENT> self.tolerance = tolerance <NEW_LINE> <DEDENT> def __call__(self, asu, descriptor, accumulator): <NEW_LINE> <INDENT> clashing = asu.clashing_with( sphere = descriptor.sphere, tolerance = self.tolerance, ) <NEW_L... | Calculates clashpoints | 62598f948da39b475be02e9c |
class RemoteValueString(RemoteValue[DPTArray, str]): <NEW_LINE> <INDENT> def payload_valid(self, payload: DPTArray | DPTBinary | None) -> DPTArray: <NEW_LINE> <INDENT> if ( isinstance(payload, DPTArray) and len(payload.value) == DPTString.payload_length ): <NEW_LINE> <INDENT> return payload <NEW_LINE> <DEDENT> raise Co... | Abstraction for remote value of KNX 16.000 (DPT_String_ASCII). | 62598f9485dfad0860cbf8d0 |
class PlotPanel (wx.Panel): <NEW_LINE> <INDENT> def __init__( self, parent, color=None, dpi=None, **kwargs ): <NEW_LINE> <INDENT> from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg <NEW_LINE> from matplotlib.figure import Figure <NEW_LINE> if 'id' not in kwargs.keys(): <NEW_LINE> <INDENT> kwargs['id'] = wx... | The PlotPanel has a Figure and a Canvas. OnSize events simply set a
flag, and the actual resizing of the figure is triggered by an Idle event. | 62598f94c432627299fa2c8d |
class CommitBot(BaseBot): <NEW_LINE> <INDENT> def on_webhook(self, environ, url, params): <NEW_LINE> <INDENT> payload = loads(params["payload"]) <NEW_LINE> commit = lambda c: "%s - %s" % (c["message"], self.author(c)) <NEW_LINE> messages = [commit(c) for c in payload["commits"]] <NEW_LINE> if len(messages) == 1: <NEW_L... | Base bot for GitHub/BitBucket post-push webhooks. Accepts the
webhook payload and writes out new commits and URLs to the
channel. | 62598f94596a897236127937 |
class CategoryPostsListView(ListAPIView): <NEW_LINE> <INDENT> serializer_class = PostsListSerializer <NEW_LINE> pagination_class = PaginationPosts <NEW_LINE> lookup_field = 'slug' <NEW_LINE> def get_queryset(self): <NEW_LINE> <INDENT> slug = self.kwargs['slug'] <NEW_LINE> queryset = BlogPost.objects.filter(category__sl... | Show category list | 62598f947d847024c075c08d |
class TreeAdmin(admin.ModelAdmin): <NEW_LINE> <INDENT> change_list_template = 'admin/tree_change_list.html' <NEW_LINE> def get_queryset(self, request): <NEW_LINE> <INDENT> if issubclass(self.model, AL_Node): <NEW_LINE> <INDENT> return super(TreeAdmin, self).get_queryset(request) <NEW_LINE> <DEDENT> else: <NEW_LINE> <IN... | Django Admin class for treebeard. | 62598f94cb5e8a47e493bfd0 |
class TestLookChar(CommandTest): <NEW_LINE> <INDENT> def test_look(self): <NEW_LINE> <INDENT> lookscene = "Char(#6)" <NEW_LINE> self.call(general.CmdLook(), "me", lookscene) | just look first as a character | 62598f94b7558d58954632e8 |
class TopLevel(object): <NEW_LINE> <INDENT> def __init__(self, wrapped): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> functools.update_wrapper(self, wrapped) <NEW_LINE> <DEDENT> except AttributeError: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> self._wrapped = wrapped <NEW_LINE> <DEDENT> def __get__(self, instance, un... | Decorator/middleware for request signals. | 62598f94adb09d7d5dc0a242 |
class ANTemplatesTags(bpy.types.PropertyGroup) : <NEW_LINE> <INDENT> pass | name : StringProperty() | 62598f946fb2d068a7693c90 |
class DataProviderError(DataError): <NEW_LINE> <INDENT> pass | Raised by the :meth:`DataProvider.initialize` method if there is some
problem that prevents the correct behavior of the Data Adapter. If this
exception occurs, Lightstreamer Kernel must give up the
startup. | 62598f94435de62698e9baad |
class StoreCattleViewSet(FilterByUserMixin, viewsets.ModelViewSet): <NEW_LINE> <INDENT> queryset = StoreCattle.objects.all().order_by("id") <NEW_LINE> model = StoreCattle <NEW_LINE> serializer_class = StoreCattleSerializer <NEW_LINE> filter_backends = (filters.DjangoFilterBackend,) <NEW_LINE> filter_class = AnimalNameO... | Lists, retrieves, creates, and deletes store cattle | 62598f94b830903b9686e2d1 |
class Node(): <NEW_LINE> <INDENT> def __init__(self, label, ast_node, *, line_number, path): <NEW_LINE> <INDENT> self.label = label <NEW_LINE> self.ast_node = ast_node <NEW_LINE> self.line_number = line_number <NEW_LINE> self.path = path <NEW_LINE> self.ingoing = list() <NEW_LINE> self.outgoing = list() <NEW_LINE> <DED... | A Control Flow Graph node that contains a list of
ingoing and outgoing nodes and a list of its variables. | 62598f94435de62698e9baae |
class MODF(SCPINode): <NEW_LINE> <INDENT> __slots__ = () <NEW_LINE> _cmd = "MODF" <NEW_LINE> args = [] <NEW_LINE> class VALue(SCPINode, SCPISet): <NEW_LINE> <INDENT> __slots__ = () <NEW_LINE> _cmd = "VALue" <NEW_LINE> args = ["1"] <NEW_LINE> <DEDENT> VALue = VALue() | PULSe:MODF
Arguments: | 62598f94bde94217f37074c6 |
class Rules(dict): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def load_json(cls, data, default_rule=None): <NEW_LINE> <INDENT> rules = dict((k, parse_rule(v)) for k, v in rule_formatter.loads(data).items()) <NEW_LINE> return cls(rules, default_rule) <NEW_LINE> <DEDENT> def __init__(self, rules=None, default_rule=None)... | A store for rules. Handles the default_rule setting directly. | 62598f9499cbb53fe6830b8a |
class ExcludedRule(AWSProperty): <NEW_LINE> <INDENT> props: PropsDictType = { "Name": (str, True), } | `ExcludedRule <http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-webacl-excludedrule.html>`__ | 62598f94a219f33f346c64d5 |
class Balance(models.Model): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> ordering = ('-year', 'member') <NEW_LINE> unique_together = (('year', 'member'), ) <NEW_LINE> <DEDENT> member = models.ForeignKey("Member") <NEW_LINE> balance = models.DecimalField(max_digits=8, decimal_places=2) <NEW_LINE> accumulated_bal... | calculated balance for given user per year
| 62598f9463b5f9789fe84e30 |
class SarasvatiApi(Composite): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> set_api(self) <NEW_LINE> super().__init__() <NEW_LINE> self.brain = None <NEW_LINE> self.storage = None <NEW_LINE> self.add_components([ SarasvatiPluginsApiComponent(), SarasvatiUtilitiesApiComponent(), SarasvatiEventsApiComponen... | Sarasvati application programming interface | 62598f94be383301e02534c1 |
class ActivationLimitType_(SamlBase): <NEW_LINE> <INDENT> c_tag = 'ActivationLimitType' <NEW_LINE> c_namespace = NAMESPACE <NEW_LINE> c_children = SamlBase.c_children.copy() <NEW_LINE> c_attributes = SamlBase.c_attributes.copy() <NEW_LINE> c_child_order = SamlBase.c_child_order[:] <NEW_LINE> c_cardinality = SamlBase.c_... | The urn:oasis:names:tc:SAML:2.0:ac:classes:InternetProtocolPassword:ActivationLimitType element | 62598f9438b623060ffa8d47 |
class User(models.Model): <NEW_LINE> <INDENT> username = models.CharField(max_length=200, db_index=True, unique=True) <NEW_LINE> schema = models.CharField(max_length=200, unique=True) <NEW_LINE> db_username = models.CharField(max_length=250, db_index=True, unique=True) <NEW_LINE> db_password = models.CharField(max_leng... | A cached reference to a database user | 62598f94d7e4931a7ef3bd5e |
class notag(tag): <NEW_LINE> <INDENT> def __init__(self, *children): <NEW_LINE> <INDENT> super(notag, self).__init__(None) <NEW_LINE> self(*children) | Used to represent a set of sibling elements with no enclosing parent tag.
`children` is a sequence of elements.
`notag` is particularly useful with `defer` and any of the template
helpers which are based on `defer`.
.. doctest:: api-notag
>>> from kemmering import notag, tag
>>> str(tag('a')(
... tag('b/... | 62598f94b5575c28eb712b29 |
class TestModulejsonwhoiscom(unittest.TestCase): <NEW_LINE> <INDENT> default_options = { '_debug': False, '__logging': True, '__outputfilter': None, '_useragent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:62.0) Gecko/20100101 Firefox/62.0', '_dnsserver': '', '_fetchtimeout': 5, '_internettlds': 'https://publicsuffi... | Test modules.sfp_jsonwhoiscom | 62598f94baa26c4b54d4ef6b |
class Kalender(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> raise NotImplementedError | Holds information classed as "Kalender" | 62598f940a50d4780f705092 |
class CalendarAclEntry(gdata.GDataEntry, gdata.LinkFinder): <NEW_LINE> <INDENT> _tag = gdata.GDataEntry._tag <NEW_LINE> _namespace = gdata.GDataEntry._namespace <NEW_LINE> _children = gdata.GDataEntry._children.copy() <NEW_LINE> _attributes = gdata.GDataEntry._attributes.copy() <NEW_LINE> _children['{%s}scope' % GACL_N... | A Google Calendar ACL Entry flavor of an Atom Entry | 62598f94596a897236127939 |
@unique <NEW_LINE> class EntitySensorStatus(int, Enum): <NEW_LINE> <INDENT> OK = 1 <NEW_LINE> UNAVAILABLE = 2 <NEW_LINE> NONOPERATIONAL = 3 | Enumeration of sensor operational status according to RFC3433
(https://tools.ietf.org/html/rfc3433) | 62598f94851cf427c66b7f82 |
class Room: <NEW_LINE> <INDENT> def __init__(self, name, desc): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.desc = desc <NEW_LINE> <DEDENT> def describeme(self): <NEW_LINE> <INDENT> print("You are in the " + self.name + " which is known as " + self.desc + ".") <NEW_LINE> <DEDENT> def describeit(self): <NEW_LIN... | constructor for a room - the common link with most items in the game insofar as interactivity.
rooms will later get descriptions added on to them as well. | 62598f940fa83653e46f4ba5 |
class EnsureOriginMiddleware: <NEW_LINE> <INDENT> def __init__(self, get_response=None): <NEW_LINE> <INDENT> self.get_response = get_response <NEW_LINE> <DEDENT> def __call__(self, request): <NEW_LINE> <INDENT> if not request.META.get("HTTP_ORIGIN", None): <NEW_LINE> <INDENT> request.META["HTTP_ORIGIN"] = request.get_h... | Ensures that request META 'HTTP_ORIGIN' is set.
Uses request get_host() to set it if missing. | 62598f948e71fb1e983bb770 |
class TableProperties(Model): <NEW_LINE> <INDENT> _attribute_map = { 'table_name': {'key': 'TableName', 'type': 'str'}, } <NEW_LINE> def __init__(self, **kwargs): <NEW_LINE> <INDENT> super(TableProperties, self).__init__(**kwargs) <NEW_LINE> self.table_name = kwargs.get('table_name', None) | The properties for creating a table.
:param table_name: The name of the table to create.
:type table_name: str | 62598f94a8ecb03325870ec4 |
class SoundMediaExportRequest(MediaExportRequest): <NEW_LINE> <INDENT> def get_type(self): <NEW_LINE> <INDENT> return MediaType.SOUNDS <NEW_LINE> <DEDENT> def save(self, sourcedir, exportdir, *args, **kwargs): <NEW_LINE> <INDENT> source_file = sourcedir[self.get_type().value, self.source_filename] <NEW_LINE> if source_... | Export requests for ingame sounds. | 62598f9455399d3f056261db |
class Degree(models.Model): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> app_label = 'gcd' <NEW_LINE> ordering = ('degree_name',) <NEW_LINE> verbose_name_plural = 'Degrees' <NEW_LINE> <DEDENT> degree_name = models.CharField(max_length=200) <NEW_LINE> def __str__(self): <NEW_LINE> <INDENT> return str(self.degree_... | record of degrees | 62598f94379a373c97d98cce |
class StringListFlag(StringFlag): <NEW_LINE> <INDENT> def __init__(self, name, delimiter=None, **kwargs): <NEW_LINE> <INDENT> super().__init__(name, **kwargs) <NEW_LINE> self._delimiter = delimiter <NEW_LINE> self._reset_value = True <NEW_LINE> <DEDENT> @property <NEW_LINE> def type(self): <NEW_LINE> <INDENT> if self._... | Command-line flag whose value is interpreted as a list.
A string may be interpreted as multiple values by specifying a delimiter.
Multiple occurrences of the flag will be appended. | 62598f9432920d7e50bc5d1c |
class BlastTableRec: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.program = None <NEW_LINE> self.version = None <NEW_LINE> self.date = None <NEW_LINE> self.iteration = None <NEW_LINE> self.query = None <NEW_LINE> self.database = None <NEW_LINE> self.entries = [] <NEW_LINE> <DEDENT> def add_entry(sel... | Container for Blast Table record, list of Blast Table Entries. | 62598f9499cbb53fe6830b8b |
class UserError(Exception): <NEW_LINE> <INDENT> pass | Exception containing an error message for user. | 62598f94b57a9660fecd1737 |
class EnrichmentLoader(ContextContainer, Priority): <NEW_LINE> <INDENT> def __init__(self, can_enrich: Callable[[Cookie, Context], bool], load_enrichment: Callable[[Cookie, Context], Enrichment], id: str, priority: int=Priority.MIN_PRIORITY): <NEW_LINE> <INDENT> super().__init__(priority) <NEW_LINE> self._can_enrich = ... | Data loader that can load specific data that can be used to "enrich" a cookie with more information. | 62598f9491af0d3eaad39ac3 |
class CreateMlDatafeed(Runner): <NEW_LINE> <INDENT> def __call__(self, es, params): <NEW_LINE> <INDENT> datafeed_id = mandatory(params, "datafeed-id", self) <NEW_LINE> body = mandatory(params, "body", self) <NEW_LINE> es.xpack.ml.put_datafeed(datafeed_id=datafeed_id, body=body) <NEW_LINE> <DEDENT> def __repr__(self, *a... | Execute the `create datafeed API <https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-datafeed.html>`_. | 62598f94379a373c97d98ccf |
class Sibling: <NEW_LINE> <INDENT> name = "sibling" <NEW_LINE> def search(self, node): <NEW_LINE> <INDENT> if node.parent: <NEW_LINE> <INDENT> return filter(lambda x: x != node, node.parent.children) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return [] | All siblings (excluding the node itself). | 62598f94a05bb46b3848a53b |
class SelectorDIC(ModelSelector): <NEW_LINE> <INDENT> def select(self): <NEW_LINE> <INDENT> warnings.filterwarnings("ignore", category=DeprecationWarning) <NEW_LINE> best_score = -float("inf") <NEW_LINE> best_model = None <NEW_LINE> for n in range(self.min_n_components, self.max_n_components + 1): <NEW_LINE> <INDENT> s... | select best model based on Discriminative Information Criterion
Biem, Alain. "A model selection criterion for classification: Application to hmm topology optimization."
Document Analysis and Recognition, 2003. Proceedings. Seventh International Conference on. IEEE, 2003.
http://citeseerx.ist.psu.edu/viewdoc/download?d... | 62598f946fb2d068a7693c91 |
class C2600_MB_1FE(Adapter): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super().__init__(interfaces=1, wics=3) <NEW_LINE> self._interfaces = 1 <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return "C2600-MB-1FE" <NEW_LINE> <DEDENT> def removable(self): <NEW_LINE> <INDENT> return False | Integrated 1 port FastEthernet adapter for the c2600 platform. | 62598f94a17c0f6771d5bef7 |
class ChildShare(Borg): <NEW_LINE> <INDENT> def __init__(self, name=None, color=None): <NEW_LINE> <INDENT> super().__init__(name) <NEW_LINE> if color is not None: <NEW_LINE> <INDENT> self.color = color | All instances of ChildShare share state with themselves and with all
instances of Borg. | 62598f94b830903b9686e2d2 |
class OsdManager(base.ManagerWithFind): <NEW_LINE> <INDENT> resource_class = Osd <NEW_LINE> def get(self, osd_id): <NEW_LINE> <INDENT> return self._get("/osds/%s" % osd_id, "osd") <NEW_LINE> <DEDENT> def list(self, detailed=False, search_opts=None, paginate_opts=None): <NEW_LINE> <INDENT> if search_opts is None: <NEW_L... | Manage :class:`OSD` resources. | 62598f94a17c0f6771d5bef8 |
class NatGatewaySkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): <NEW_LINE> <INDENT> STANDARD = "Standard" | Name of Nat Gateway SKU.
| 62598f94e76e3b2f99fd86f6 |
class SqrtGGNConv1d(SqrtGGNBaseModule): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super().__init__(Conv1DDerivatives(), params=["bias", "weight"]) | ``SqrtGGN{Exact, MC}`` extension for ``torch.nn.Conv1d`` module. | 62598f948c0ade5d55dc34ec |
class MediaWiki(APIView): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.__base_url = settings.AUTH_WIKI_BASE_URL <NEW_LINE> self.__admin_username = settings.AUTH_WIKI_ADMIN_USERNAME <NEW_LINE> self.__admin_password = settings.AUTH_WIKI_ADMIN_PASSWORD <NEW_LINE> self.__login_api = self.__base_url + '?... | use media wiki's api | 62598f947cff6e4e811b56da |
class ResetAvatar(Resource): <NEW_LINE> <INDENT> def get(self): <NEW_LINE> <INDENT> username =request.args.get('username') <NEW_LINE> try: <NEW_LINE> <INDENT> r = rocket.users_reset_avatar(username=username) <NEW_LINE> <DEDENT> except Exception as e: <NEW_LINE> <INDENT> r = None <NEW_LINE> <DEDENT> if not r: <NEW_LINE>... | 重置用户的头像. | 62598f94d7e4931a7ef3bd60 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.