code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class InvalidTargetResource(Exception): <NEW_LINE> <INDENT> pass | This exception ca be raised, when a known resource target is invalid.
This exception will prevent a retry of a failed action. | 62599073be8e80087fbc0996 |
class EventLoop(object): <NEW_LINE> <INDENT> def alarm(self, seconds, callback): <NEW_LINE> <INDENT> raise NotImplementedError() <NEW_LINE> <DEDENT> def enter_idle(self, callback): <NEW_LINE> <INDENT> raise NotImplementedError() <NEW_LINE> <DEDENT> def remove_alarm(self, handle): <NEW_LINE> <INDENT> raise NotImplemente... | Abstract class representing an event loop to be used by :class:`MainLoop`. | 625990734f6381625f19a12c |
@register('salles') <NEW_LINE> class SalleLookup(LookupChannel): <NEW_LINE> <INDENT> model = Salle <NEW_LINE> def get_query(self, q, request): <NEW_LINE> <INDENT> return self.model.objects.filter(nom__icontains=q).order_by('nom')[:50] <NEW_LINE> <DEDENT> def format_item_display(self, item): <NEW_LINE> <INDENT> return u... | It customize classroom research in a field form | 6259907397e22403b383c809 |
class COPY_QUEUE: <NEW_LINE> <INDENT> def __init__(self, src_dir, dst_dir, num_copy_thread=3): <NEW_LINE> <INDENT> self.src_dir = src_dir <NEW_LINE> self.dst_dir = dst_dir <NEW_LINE> self.file_Q = Queue.Queue() <NEW_LINE> self.copied_file_list = list() <NEW_LINE> self.num_copy_thread = num_copy_thread <NEW_LINE> self._... | This is the class for handling the file copying. | 625990738e7ae83300eea997 |
class UpdateReplacePolicy(CloudFormationLintRule): <NEW_LINE> <INDENT> id = 'E3036' <NEW_LINE> shortdesc = 'Check UpdateReplacePolicy values for Resources' <NEW_LINE> description = 'Check that the UpdateReplacePolicy values are valid' <NEW_LINE> source_url = 'https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGui... | Check Base Resource Configuration | 625990734428ac0f6e659e3a |
class FlaskTestCase(TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> app = Flask(__name__) <NEW_LINE> app.config['DEBUG'] = True <NEW_LINE> app.config['TESTING'] = True <NEW_LINE> app.logger.disabled = True <NEW_LINE> self.app = app <NEW_LINE> <DEDENT> def tearDown(self): <NEW_LINE> <INDENT> self.app... | Mix-in class for creating the Flask application | 625990735fc7496912d48eec |
class create: <NEW_LINE> <INDENT> def cube(objName): <NEW_LINE> <INDENT> bpy.ops.mesh.primitive_cube_add(radius=0.5, location=(0, 0, 0)) <NEW_LINE> act.rename(objName) <NEW_LINE> <DEDENT> def sphere(objName): <NEW_LINE> <INDENT> bpy.ops.mesh.primitive_uv_sphere_add(size=0.5, location=(0, 0, 0)) <NEW_LINE> act.rename(ob... | Function Class for CREATING Objects | 62599073a17c0f6771d5d82e |
class ubuntu(Blueprint): <NEW_LINE> <INDENT> services = [Ubuntu] <NEW_LINE> packages = [PackageUbuntu, ubuntu_20_04_cloud] <NEW_LINE> substrates = [UbuntuVM] <NEW_LINE> profiles = [Default] <NEW_LINE> credentials = [BP_CRED_LINUX, BP_CRED_INFOBLOX] | Ubuntu server 20.04 basic installation | 625990737d847024c075dce0 |
class ImplementationError(PackageBaseException): <NEW_LINE> <INDENT> pass | A class to raise when is not properly implemented. | 625990731f5feb6acb1644f9 |
class CLIContext: <NEW_LINE> <INDENT> def __init__(self, app, no_color, workdir, quiet=False): <NEW_LINE> <INDENT> self.app = app or get_current_app() <NEW_LINE> self.no_color = no_color <NEW_LINE> self.quiet = quiet <NEW_LINE> self.workdir = workdir <NEW_LINE> <DEDENT> @cached_property <NEW_LINE> def OK(self): <NEW_LI... | Context Object for the CLI. | 6259907321bff66bcd72456e |
class StandardConditionsReportingPeriodAggregateModeledEnergyUse(BSElement): <NEW_LINE> <INDENT> element_type = "xs:decimal" | Applicable when the NormalizationMethod is Standard Conditions. As documented in Annex B4.5 of ASRHAE Guideline 14-2018: "In many cases, it is necessary to normalize the savings to a typical or average period (usually a year) at the site. It was shown in Section B4.3 that when measurement errors are negligible, the un... | 625990732c8b7c6e89bd50ee |
class EmptyText(base.BaseRule): <NEW_LINE> <INDENT> def elements(self): <NEW_LINE> <INDENT> return ["Text"] <NEW_LINE> <DEDENT> def check(self, element): <NEW_LINE> <INDENT> if element.text is not None and not element.text.strip(): <NEW_LINE> <INDENT> raise loggers.ElectionWarning.from_message("Text is empty", element) | Check that Text elements are not strictly whitespace. | 62599073a219f33f346c8111 |
class vardcentraler_csv(object): <NEW_LINE> <INDENT> def __init__(self, fname): <NEW_LINE> <INDENT> self.fname = fname <NEW_LINE> self.csvfh = open(fname, "rb") <NEW_LINE> self.heading = ['PARENT_WORKPLACE_NAME','PARENT_WORKPLACE_ADDRESS','PARENT_WORKPLACE_ZIP','PARENT_WORKPLACE_CITY','PARENT_WORKPLACE_PHONE'] <NEW_LIN... | class: vardcentraler_csv | 6259907367a9b606de547727 |
class DevSettings(BaseConfig): <NEW_LINE> <INDENT> config = Config() <NEW_LINE> DEBUG = config("DEBUG", cast=bool, default=True) <NEW_LINE> DB_USER = config("DB_USER", cast=str, default="postgres") <NEW_LINE> DB_PASSWORD = config("DB_PASSWORD", cast=Secret, default="postgres") <NEW_LINE> DB_HOST = config("DB_HOST", cas... | Configuration class for site development environment | 625990737d43ff2487428096 |
class MirrorChecker: <NEW_LINE> <INDENT> def __init__(self, path, base, mirror): <NEW_LINE> <INDENT> self.mirror = mirror <NEW_LINE> self.url = posixpath.join(mirror.url, str(path.relative_to(base / mirror.subdir))) <NEW_LINE> self.sha256 = None <NEW_LINE> self.status = None <NEW_LINE> self.error = None <NEW_LINE> self... | Checker for single mirror | 62599073ad47b63b2c5a9155 |
class SkuSignupOption(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): <NEW_LINE> <INDENT> NONE = "None" <NEW_LINE> AVAILABLE = "Available" | Sku can be signed up by customer or not.
| 62599073a8370b77170f1cd2 |
class Coordinator(): <NEW_LINE> <INDENT> def __init__(self, csv_file = None): <NEW_LINE> <INDENT> self.players = self._read_file_return_players(csv_file) <NEW_LINE> self.playersort = self._player_sort() <NEW_LINE> self.teams = self._create_team() <NEW_LINE> self.write_file = self._write_to_file() <NEW_LINE> <DEDENT> de... | docstring for Coordinator | 62599073e1aae11d1e7cf491 |
@unittest.skip("test not implemented yet") <NEW_LINE> class MessageValuesRetypeTests(SenderReceiverTestCase): <NEW_LINE> <INDENT> pass | retype message fields test group | 6259907332920d7e50bc794e |
class sublime_linter_lint(sublime_plugin.TextCommand): <NEW_LINE> <INDENT> def want_event(self): <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> def is_visible(self, event=None, **kwargs): <NEW_LINE> <INDENT> return ( util.is_lintable(self.view) and any( info["settings"].get("lint_mode") != "background" for info in... | A command that lints the current view if it has a linter. | 6259907301c39578d7f143b8 |
class ListAllEventsResultSet(ResultSet): <NEW_LINE> <INDENT> def getJSONFromString(self, str): <NEW_LINE> <INDENT> return json.loads(str) <NEW_LINE> <DEDENT> def get_Response(self): <NEW_LINE> <INDENT> return self._output.get('Response', None) | A ResultSet with methods tailored to the values returned by the ListAllEvents Choreo.
The ResultSet object is used to retrieve the results of a Choreo execution. | 62599073460517430c432cdb |
class Die(models.Model): <NEW_LINE> <INDENT> name = models.CharField(max_length=256) <NEW_LINE> instructions = models.TextField('Instructions', blank=True) <NEW_LINE> def __str__(self): <NEW_LINE> <INDENT> return ("%s" % (self.name)) | A model storing information for a die that has been imaged. | 625990732ae34c7f260ac9eb |
class StatusSummary(object): <NEW_LINE> <INDENT> def __init__(self, jobs): <NEW_LINE> <INDENT> assert type(jobs) == list <NEW_LINE> self._successful = 0 <NEW_LINE> self._pending = 0 <NEW_LINE> self._running = 0 <NEW_LINE> self._coalesced = 0 <NEW_LINE> self._failed = 0 <NEW_LINE> for job in jobs: <NEW_LINE> <INDENT> st... | class which represent the summary of status | 62599073283ffb24f3cf51b1 |
class IPrincipalExported(IPersonalProfile): <NEW_LINE> <INDENT> title = TextLine(title=_(u'Principal full name')) <NEW_LINE> firstname = TextLine(title=_(u'Principal first name')) <NEW_LINE> lastname = TextLine(title=_(u'Principal last name')) <NEW_LINE> email = TextLine(title=_(u'Principal email')) <NEW_LINE> location... | member exported | 625990738e7ae83300eea998 |
class MonitoringClient(object): <NEW_LINE> <INDENT> def __init__(self, meter_id, url='https://smart-comp.honda-ri.de/app.php', database='monitoring'): <NEW_LINE> <INDENT> self.logger = configure_logging(meter_id) <NEW_LINE> self.API_ENDPOINT = 'api' <NEW_LINE> self.METER_FORMATSTRING = '("{}")' <NEW_LINE> self.meter_id... | Monitoring server module:
https://smart-comp.honda-ri.de/app.php/monitor/monitoring/help/rest | 6259907371ff763f4b5e90b1 |
class MainView(generic.TemplateView): <NEW_LINE> <INDENT> template_name = 'ListJobs/main.html' | Loads the main page | 625990737b180e01f3e49ce8 |
class NetIpsecIkesa(NetIpsecIkesaSchema): <NEW_LINE> <INDENT> cli_command = "/mgmt/tm/net/ipsec/ike-sa" <NEW_LINE> def rest(self): <NEW_LINE> <INDENT> response = self.device.get(self.cli_command) <NEW_LINE> response_json = response.json() <NEW_LINE> if not response_json: <NEW_LINE> <INDENT> return {} <NEW_LINE> <DEDENT... | To F5 resource for /mgmt/tm/net/ipsec/ike-sa
| 625990737c178a314d78e86f |
class Game(ndb.Model): <NEW_LINE> <INDENT> game_over = ndb.BooleanProperty(required=True, default=False) <NEW_LINE> marks = ndb.StringProperty(required=True, default='000000000') <NEW_LINE> user = ndb.KeyProperty(required=True, kind='User') <NEW_LINE> cancelled = ndb.BooleanProperty(required=False) <NEW_LINE> history =... | Game object | 62599073b7558d5895464bb7 |
class Rank(object): <NEW_LINE> <INDENT> ace, two, three, four, five, six, seven, eight, nine, ten, jack, queen, king = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 <NEW_LINE> ranks = [ace, two, three, four, five, six, seven, eight, nine, ten, jack, queen, king] <NEW_LINE> def __init__(self, rank): <NEW_LINE> <INDEN... | A class representing the rank of a playing card | 625990734a966d76dd5f07f2 |
class TimberMachiningCut: <NEW_LINE> <INDENT> def __init__(self,obj): <NEW_LINE> <INDENT> obj.addProperty("App::PropertyLinkSub","Face","Timber","The face's plane to make the cut") <NEW_LINE> obj.addProperty("App::PropertyLink","Structure","Timber","The Timber Structure to cut") <NEW_LINE> obj.Proxy = self <NEW_LINE> <... | The Cut Timber Machning object | 6259907355399d3f05627e21 |
class ModifyAlarmPolicyTasksResponse(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.RequestId = None <NEW_LINE> <DEDENT> def _deserialize(self, params): <NEW_LINE> <INDENT> self.RequestId = params.get("RequestId") | ModifyAlarmPolicyTasks返回参数结构体
| 625990735fcc89381b266ddc |
@registerElement <NEW_LINE> class Timezones (WebDAVEmptyElement): <NEW_LINE> <INDENT> namespace = calendarserver_namespace <NEW_LINE> name = "timezones" | Denotes a timezone service resource.
(Apple Extension to CalDAV) | 62599073aad79263cf4300bf |
class TestDefaultApi(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.api = swagger_client.apis.default_api.DefaultApi() <NEW_LINE> <DEDENT> def tearDown(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def test_calls_get(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def test_f... | DefaultApi unit test stubs | 625990734c3428357761bbbe |
class EventCreateForm(forms.ModelForm): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> super().__init__(*args, **kwargs) <NEW_LINE> <DEDENT> class Meta: <NEW_LINE> <INDENT> model = Event <NEW_LINE> fields = ( 'name', 'description', ) | Форма для создания мероприятия | 62599073ec188e330fdfa1ad |
class CleanCommand(SubCommand): <NEW_LINE> <INDENT> name = "clean" <NEW_LINE> def run(self, args, argv): <NEW_LINE> <INDENT> Docker().clean() <NEW_LINE> return 0 | Clean up docker instances | 62599073796e427e53850082 |
class DatasetIterator(DistributedIteratorV1): <NEW_LINE> <INDENT> def __init__(self, dataset, input_workers, strategy, num_replicas_in_sync=None, input_context=None): <NEW_LINE> <INDENT> dist_dataset = DistributedDatasetV1( dataset, input_workers, strategy, num_replicas_in_sync=num_replicas_in_sync, input_context=input... | Iterator created from input dataset. | 62599073cc0a2c111447c755 |
class MyMNIST(MNIST): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> super(MyMNIST, self).__init__(*args, **kwargs) <NEW_LINE> self.semi_targets = torch.zeros_like(self.targets) <NEW_LINE> <DEDENT> def __getitem__(self, index): <NEW_LINE> <INDENT> img, target, semi_target = self.data[index... | Torchvision MNIST class with additional targets for the semi-supervised setting and patch of __getitem__ method
to also return the semi-supervised target as well as the index of a data sample. | 6259907332920d7e50bc7950 |
class AdminTestCase(TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.superuser = create_superuser() <NEW_LINE> self.client.login(username='admin', password='secret') <NEW_LINE> <DEDENT> def tearDown(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def test_inline_model_detail_view(self): <NEW... | check some basic admin views
TODO: check with custom User Model! | 625990738a43f66fc4bf3a9e |
class Apply(Expr): <NEW_LINE> <INDENT> _arguments = '_child', 'func', '_asdshape', '_splittable' <NEW_LINE> def _schema(self): <NEW_LINE> <INDENT> if iscollection(self.dshape): <NEW_LINE> <INDENT> return self.dshape.subshape[0] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> raise TypeError("Non-tabular datashape, %s" % ... | Apply an arbitrary Python function onto an expression
Examples
--------
>>> t = symbol('t', 'var * {name: string, amount: int}')
>>> h = t.apply(hash, dshape='int64') # Hash value of resultant dataset
You must provide the datashape of the result with the ``dshape=`` keyword.
For datashape examples see
http://datash... | 6259907363b5f9789fe86a6d |
class ManagerTest: <NEW_LINE> <INDENT> def setup(self): <NEW_LINE> <INDENT> self._client_mock = ClientMock(self.RESOURCE) <NEW_LINE> self.manager = self.MANAGER(self._client_mock, 141) <NEW_LINE> <DEDENT> @property <NEW_LINE> def last_mock(self): <NEW_LINE> <INDENT> return self._client_mock._last_mock | Base class for ResourceManager subclasses tests; main purpose
is request automoking. | 62599073091ae35668706542 |
class JobException(WavesException): <NEW_LINE> <INDENT> def __init__(self, message, job=None): <NEW_LINE> <INDENT> if job: <NEW_LINE> <INDENT> message = '[job:%s][%s] - %s' % (job.slug, job.remote_job_id, message) <NEW_LINE> <DEDENT> super(JobException, self).__init__(message) | Base Exception class for all job related errors | 62599073b7558d5895464bb8 |
class And(BinaryOperator): <NEW_LINE> <INDENT> def __init__(self, left_expr: Expr, right_expr: Expr): <NEW_LINE> <INDENT> super(And, self).__init__("AND", left_expr, right_expr) <NEW_LINE> <DEDENT> def eval(self): <NEW_LINE> <INDENT> left_expr_eval = self.left_expr.eval() <NEW_LINE> if not left_expr_eval: <NEW_LINE> <I... | Defines an "AND" operator in propositional logic | 62599073a17c0f6771d5d830 |
class AstavomsRESTError(Exception): <NEW_LINE> <INDENT> status_code = None <NEW_LINE> def __init__(self, message=None, status_code=None, payload=None): <NEW_LINE> <INDENT> Exception.__init__(self) <NEW_LINE> self.message = message or self.__doc__ <NEW_LINE> if status_code is not None: <NEW_LINE> <INDENT> self.status_co... | Template class for Astavoms errors | 625990731f5feb6acb1644fd |
class DeleteAttachmentView(DeleteView): <NEW_LINE> <INDENT> model = Attachment <NEW_LINE> def post(self, request, **kwargs): <NEW_LINE> <INDENT> self.object = self.get_object() <NEW_LINE> if not check_access(self.object.project, self.request.user): <NEW_LINE> <INDENT> raise PermissionDenied <NEW_LINE> <DEDENT> return s... | Delete attachment if user has permissions.
| 625990737b25080760ed8969 |
class classproperty(property): <NEW_LINE> <INDENT> def __get__(self, cls, owner): <NEW_LINE> <INDENT> return classmethod(self.fget).__get__(None, owner)() | Class property decorator. | 625990737047854f46340cc2 |
class Detail(LoginRequiredMixin, base_views.BaseDetailView): <NEW_LINE> <INDENT> model = models.MachineInput <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> super(Detail, self).__init__() | Detail of a MachineInput | 625990733317a56b869bf1ca |
class GitHub(BaseModel): <NEW_LINE> <INDENT> resume = models.ForeignKey(Resume, on_delete=models.CASCADE) <NEW_LINE> user_id = models.IntegerField(help_text="User's Github id") <NEW_LINE> user_name = models.CharField(max_length=50, help_text="User's Github Username") <NEW_LINE> profile_name = models.CharField(max_lengt... | Model to store the github user details | 62599073ad47b63b2c5a9159 |
class U2Gate(Gate): <NEW_LINE> <INDENT> def __init__(self, phi, lam, qubit, circ=None): <NEW_LINE> <INDENT> super().__init__("u2", [phi, lam], [qubit], circ) <NEW_LINE> <DEDENT> def qasm(self): <NEW_LINE> <INDENT> qubit = self.arg[0] <NEW_LINE> phi = self.param[0] <NEW_LINE> lam = self.param[1] <NEW_LINE> return self._... | One-pulse single-qubit gate. | 6259907399cbb53fe68327f5 |
class ClassReport(Metric): <NEW_LINE> <INDENT> def __init__(self,target_names = None): <NEW_LINE> <INDENT> super(ClassReport).__init__() <NEW_LINE> self.target_names = target_names <NEW_LINE> <DEDENT> def reset(self): <NEW_LINE> <INDENT> self.y_pred = 0 <NEW_LINE> self.y_true = 0 <NEW_LINE> <DEDENT> def value(self): <N... | class report | 62599073a8370b77170f1cd6 |
class Oclint(Package): <NEW_LINE> <INDENT> homepage = "http://oclint.org/" <NEW_LINE> url = "https://github.com/oclint/oclint/archive/v0.13.tar.gz" <NEW_LINE> version('0.13', '1d0e605eb7815ac15e6a2a82327d2dd8') <NEW_LINE> depends_on('python', type=('build')) <NEW_LINE> depends_on('py-argparse', type=('build')) <NE... | OClint: a static analysis tool for C, C++, and Objective-C code
OCLint is a static code analysis tool for improving quality and
reducing defects by inspecting C, C++ and Objective-C code and
looking for potential problems | 62599073097d151d1a2c297d |
class UdsRestServer(RestServer): <NEW_LINE> <INDENT> def __init__(self, socket): <NEW_LINE> <INDENT> self.socket = socket <NEW_LINE> <DEDENT> def _setup_auth(self): <NEW_LINE> <INDENT> _LOGGER.info('Starting REST (noauth) server on %s', self.socket) <NEW_LINE> <DEDENT> def _setup_endpoint(self, http_server): <NEW_LINE>... | UNIX domain socket based REST Server. | 6259907399fddb7c1ca63a59 |
class _SlideDataset(dataset_ops.Dataset): <NEW_LINE> <INDENT> def __init__(self, input_dataset, window_size, stride=1): <NEW_LINE> <INDENT> super(_SlideDataset, self).__init__() <NEW_LINE> self._input_dataset = input_dataset <NEW_LINE> self._window_size = ops.convert_to_tensor( window_size, dtype=dtypes.int64, name="wi... | A `Dataset` that passes a sliding window over its input. | 6259907316aa5153ce401de4 |
class ZoAuth2IntrospectionEndpoint(IntrospectionEndpoint): <NEW_LINE> <INDENT> def query_token(self, token, token_type_hint, client): <NEW_LINE> <INDENT> if token_type_hint == 'access_token': <NEW_LINE> <INDENT> tok = OAuth2Token.objects.filter(access_token=token).first() <NEW_LINE> <DEDENT> elif token_type_hint == 're... | ZoAuthIntrospectionEndpoint. | 62599073dd821e528d6da607 |
class MarkdownCheatsheetCommand(sublime_plugin.TextCommand): <NEW_LINE> <INDENT> def run(self, edit): <NEW_LINE> <INDENT> lines = '\n'.join(load_resource('sample.md').splitlines()) <NEW_LINE> view = new_scratch_view(self.view.window(), lines) <NEW_LINE> view.set_name("Markdown Cheatsheet") <NEW_LINE> extended_syntax = ... | open our markdown cheat sheet in ST2 | 62599073fff4ab517ebcf126 |
class MapGetter(object): <NEW_LINE> <INDENT> def __init__(self, mapping=None, default=_sentinel): <NEW_LINE> <INDENT> if mapping is None and default is _sentinel: <NEW_LINE> <INDENT> raise TypeError("MapGetter must be called with at least one of mapping or default (value/factory function)") <NEW_LINE> <DEDENT> self.bui... | A context manager to allow one to "import" variables from a mapping or
factory function. This helps preserve DRY principle:
# Example:
>>> a = dict(b=1, c=2)
>>> with MapGetter(a) as blah:
... from blah import b, c
>>> print((b, c))
(1, 2)
It is intesresting to note that it will work for ordinary attributes
from Pyt... | 625990734f6381625f19a12f |
class Meta: <NEW_LINE> <INDENT> model = Patient <NEW_LINE> fields = "__all__" <NEW_LINE> exclude = ("campaign",) <NEW_LINE> labels = { "phone_number": "Phone number", "email_address": "Email address", "social_security_number": "National I.D. Number", } <NEW_LINE> widgets = { "date_of_birth": DateInputOverride( attrs={ ... | Metaclass controlling model references. | 6259907376e4537e8c3f0e8a |
class Uniform(Initializer): <NEW_LINE> <INDENT> def __init__(self, low=0.0, high=1.0, name="uniformInit"): <NEW_LINE> <INDENT> super(Uniform, self).__init__(name=name) <NEW_LINE> self.low, self.high = (low, high) <NEW_LINE> <DEDENT> def fill(self, param): <NEW_LINE> <INDENT> param[:] = self.be.rng.uniform(self.low, sel... | A class for initializing parameter tensors with values drawn from
a uniform distribution.
Args:
low (Optional[float]): Lower bound of range from which we draw values.
high (Optional[float]): Upper bound of range from which we draw values. | 6259907392d797404e3897e1 |
class ChoicesMeta(enum.EnumMeta): <NEW_LINE> <INDENT> def __new__(metacls, classname, bases, classdict, **kwds): <NEW_LINE> <INDENT> labels = [] <NEW_LINE> for key in classdict._member_names: <NEW_LINE> <INDENT> value = classdict[key] <NEW_LINE> if ( isinstance(value, (list, tuple)) and len(value) > 1 and isinstance(va... | A metaclass for creating a enum choices. | 6259907391f36d47f2231b14 |
class DarwinDay(Resource): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.args = parser.parse_args() <NEW_LINE> <DEDENT> def get(self): <NEW_LINE> <INDENT> ndays = age_to_darwin( self.args['year'], self.args['month'], self.args['day']) <NEW_LINE> jdata = { 'name': self.args['name'], 'ndays': ndays, 'd... | get function calls GET to | 625990733539df3088ecdba2 |
class helpSpagediManual(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.enabled = True <NEW_LINE> self.checked = False <NEW_LINE> <DEDENT> def onClick(self): <NEW_LINE> <INDENT> target_file = os.path.join(os.path.dirname(settings.spagedi_executable_path), 'Manual-SPAGeDi_1-4.pdf') <NEW_LINE> o... | Implementation for genegis_spagedi_manual.button (Button) | 625990737b180e01f3e49cea |
class MessageStatus: <NEW_LINE> <INDENT> PENDING = 0 <NEW_LINE> SUCCESS = 1 <NEW_LINE> FAIL = 2 | Message status used by client to keep track of their request.
PENDING: the client has not received an ACK message yet.
SUCCESS: the client receives an ACK message and the request completes.
FAIL: the request has failed. | 62599073379a373c97d9a92c |
class BasicTestQtController: <NEW_LINE> <INDENT> def __init__(self, model: ITestQtModel, view: BasicTestQtView): <NEW_LINE> <INDENT> self._model = model <NEW_LINE> self._view = view <NEW_LINE> self._view.show() <NEW_LINE> self._connectSignals() <NEW_LINE> <DEDENT> def _updateMessage(self): <NEW_LINE> <INDENT> self._vie... | Controller for the MvcQt application. | 62599073091ae35668706544 |
class RobotsTxtPool(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self._parsers = {} <NEW_LINE> <DEDENT> def has_parser(self, url_info): <NEW_LINE> <INDENT> key = self.url_info_key(url_info) <NEW_LINE> return key in self._parsers <NEW_LINE> <DEDENT> def can_fetch(self, url_info, user_agent): <NEW... | Pool of robots.txt parsers. | 625990735fc7496912d48eef |
class HTTPUnavailableForLegalReasons(HTTPClientError): <NEW_LINE> <INDENT> status_code = 451 | HTTP/451 - Unavailable For Legal Reasons | 6259907323849d37ff8529c3 |
class Container(object): <NEW_LINE> <INDENT> def __init__(self, tree, title, filename): <NEW_LINE> <INDENT> self.tree = tree <NEW_LINE> self.title = title <NEW_LINE> self.filename = filename <NEW_LINE> self.dirname = os.path.dirname(os.path.abspath(filename)) <NEW_LINE> self.basename = os.path.basename(os.path.abspath(... | Generic xhtml container | 625990739c8ee82313040e0d |
class PromiseProxy(Proxy): <NEW_LINE> <INDENT> __slots__ = ('__pending__', ) <NEW_LINE> def _get_current_object(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return object.__getattribute__(self, '__thing') <NEW_LINE> <DEDENT> except AttributeError: <NEW_LINE> <INDENT> return self.__evaluate__() <NEW_LINE> <DEDENT... | This is a proxy to an object that has not yet been evaulated.
:class:`Proxy` will evaluate the object each time, while the
promise will only evaluate it once. | 625990734e4d562566373d13 |
class GpuUsageTimeseries(Plugin): <NEW_LINE> <INDENT> name = property(lambda x: "gpu_usage") <NEW_LINE> mode = property(lambda x: "timeseries") <NEW_LINE> requiredMetrics = property(lambda x: ["nvidia.gpuactive"]) <NEW_LINE> optionalMetrics = property(lambda x: []) <NEW_LINE> derivedMetrics = property(lambda x: []) <NE... | Generate the CPU usage as a timeseries data | 62599073fff4ab517ebcf127 |
class ResCompany(models.Model): <NEW_LINE> <INDENT> _inherit = "res.company" <NEW_LINE> default_resource_calendar_id = fields.Many2one( string=u'Calendário Padrão', comodel_name=u'resource.calendar', help=u'Calendário que indica os feriados padrões da empresa.', ) | Override company to activate validate phones | 625990734f88993c371f11a7 |
class HKNBoard(backend.controller.Controller): <NEW_LINE> <INDENT> def each(self, lights): <NEW_LINE> <INDENT> self.set(lights); <NEW_LINE> <DEDENT> def all(self, color): <NEW_LINE> <INDENT> _ = [ color for i in range(5) ]; <NEW_LINE> self.set(_); | these are the LED boards I created to demo ACRIS at the HKN expo | 62599073ec188e330fdfa1b1 |
@swagger.model <NEW_LINE> class NeuronParameter(object): <NEW_LINE> <INDENT> resource_fields = { 'parameterName': fields.String, 'value': fields.Float, } <NEW_LINE> required = ['parameterName', 'value'] | NeuronParameter
Only used for swagger documentation | 6259907301c39578d7f143bb |
class ComputeInstanceTemplatesDeleteRequest(_messages.Message): <NEW_LINE> <INDENT> instanceTemplate = _messages.StringField(1, required=True) <NEW_LINE> project = _messages.StringField(2, required=True) | A ComputeInstanceTemplatesDeleteRequest object.
Fields:
instanceTemplate: The name of the instance template to delete.
project: Project ID for this request. | 625990732ae34c7f260ac9f1 |
class Normal2D(tf.keras.layers.Layer): <NEW_LINE> <INDENT> def __init__(self, stddev_x1=1.0, stddev_x2=1.0, correlation=0.99, noise_sigma=0.0, uniform_noise=True): <NEW_LINE> <INDENT> super(Normal2D, self).__init__() <NEW_LINE> cov = [[stddev_x1**2.0, correlation*stddev_x1*stddev_x2], [correlation*stddev_x1*stddev_x2, ... | 2D Normal model suitable for testing SG-MCMC procedures. | 6259907376e4537e8c3f0e8c |
class LongListFilterMixin(object): <NEW_LINE> <INDENT> @property <NEW_LINE> def media(self): <NEW_LINE> <INDENT> cdn_base = 'https://ajax.googleapis.com/ajax/libs/' <NEW_LINE> show = getattr(self, 'long_list_filter_show', 'active') <NEW_LINE> threshold = getattr(self, 'long_list_filter_threshold', '300') <NEW_LINE> hei... | Automatically reduce the amount of space taken up by very long filters.
It hides the list of options and replaces it with an input field that autocompletes.
Unlike a true autocomplete this won't save queries or speed up page load
but it's a quick and dirty improvement to the UI | 62599073e5267d203ee6d044 |
class User(AbstractUser): <NEW_LINE> <INDENT> avatar = models.ImageField(null=True, blank=True) <NEW_LINE> gender = models.CharField( choices=GENDER_CHOICES, max_length=10, null=True, blank=True ) <NEW_LINE> bio = models.TextField(default="", blank=True) <NEW_LINE> birthdate = models.DateField(null=True) <NEW_LINE> lan... | Custom User mode | 62599073d268445f2663a7e4 |
class Lemmatizer(IModifier): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> IModifier.__init__(self) <NEW_LINE> self.lemmatizer = nltk.stem.WordNetLemmatizer() <NEW_LINE> <DEDENT> def process(self, word, **kwargs): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> assert(type(word) is str) <NEW_LINE> return sel... | Wrapper on nltk.stem.WordNetLemmatizer for lemmatizing words | 62599073283ffb24f3cf51b7 |
class JuneFifth: <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def threeSum(nums: List[int]) -> List[List[int]]: <NEW_LINE> <INDENT> res = [] <NEW_LINE> if not nums or len(nums) < 3: <NEW_LINE> <INDENT> return res <NEW_LINE> <DEDENT> nums.sort() <NEW_LINE> for i in range(len(nums)): <NEW_LINE> <INDENT> if nums[i] > 0: <... | 2020/06/12 15. 三数之和
给你一个包含 n 个整数的数组 nums,判断 nums 中是否存在三个元素 a,b,c ,使得 a + b + c = 0 ?
请你找出所有满足条件且不重复的三元组。
示例:
给定数组 nums = [-1, 0, 1, 2, -1, -4],
满足要求的三元组集合为:
[[-1, 0, 1],[-1, -1, 2]]
来源:力扣(LeetCode)
链接:https://leetcode-cn.com/problems/3sum
著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。 | 62599073442bda511e95d9de |
class AdminHandler(BaseHandler): <NEW_LINE> <INDENT> def get(self): <NEW_LINE> <INDENT> self.render("admin.html") | 管理后台 | 625990731f5feb6acb164501 |
class OrderedSet(collections.MutableSet): <NEW_LINE> <INDENT> def __init__(self, iterable=None): <NEW_LINE> <INDENT> self.end = end = [] <NEW_LINE> end += [None, end, end] <NEW_LINE> self.map = {} <NEW_LINE> if iterable is not None: <NEW_LINE> <INDENT> self |= iterable <NEW_LINE> <DEDENT> <DEDENT> def __len__(self): <N... | Ordered set taken from http://code.activestate.com/recipes/576694/ | 62599073e76e3b2f99fda311 |
class Tree(GitObject): <NEW_LINE> <INDENT> typename = 'tree' <NEW_LINE> default_perm = '040000' <NEW_LINE> def __init__(self, repository, sha1): <NEW_LINE> <INDENT> self.sha1 = sha1 <NEW_LINE> self._repository = repository <NEW_LINE> self._data = None <NEW_LINE> <DEDENT> @property <NEW_LINE> def data(self): <NEW_LINE> ... | Represents a Git tree object.
The actual data content of the tree object is stored in :attr:`data` member, which
is a :class:`TreeData` instance. | 6259907356b00c62f0fb41de |
class CallContext(Context): <NEW_LINE> <INDENT> def __init__(self, parent: Context, session_details: SessionDetails, call_details: CallDetails, **kwargs) -> None: <NEW_LINE> <INDENT> super().__init__(parent, **kwargs) <NEW_LINE> self.session_id = session_details.session <NEW_LINE> self.progress = call_details.progress ... | Context class for procedure calls.
Procedure call handlers are passed an instance of this class as the first argument.
:ivar int session_id: our own WAMP session ID
:ivar Optional[Callable] progress: a callable through which the handler can send
progress information to the caller
:ivar Optional[int] caller_sessio... | 625990734e4d562566373d15 |
class GetRulesResponse(object): <NEW_LINE> <INDENT> openapi_types = { 'rules': 'list[Rule]' } <NEW_LINE> attribute_map = { 'rules': 'rules' } <NEW_LINE> def __init__(self, rules=None): <NEW_LINE> <INDENT> self._rules = None <NEW_LINE> self.discriminator = None <NEW_LINE> if rules is not None: <NEW_LINE> <INDENT> self.r... | NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually. | 6259907344b2445a339b75e5 |
class LinkFinder(externals.atom.data.LinkFinder): <NEW_LINE> <INDENT> def find_html_link(self): <NEW_LINE> <INDENT> for link in self.link: <NEW_LINE> <INDENT> if link.rel == 'alternate' and link.type == 'text/html': <NEW_LINE> <INDENT> return link.href <NEW_LINE> <DEDENT> <DEDENT> return None <NEW_LINE> <DEDENT> FindHt... | Mixin used in Feed and Entry classes to simplify link lookups by type.
Provides lookup methods for edit, edit-media, post, ACL and other special
links which are common across Google Data APIs. | 62599073fff4ab517ebcf129 |
class McAuthInfoException(Exception): <NEW_LINE> <INDENT> pass | Profile information exception. | 6259907367a9b606de54772b |
class ScannerThread(threading.Thread): <NEW_LINE> <INDENT> output_lock = threading.Lock() <NEW_LINE> def __init__(self, squeue, ports, scan_ports): <NEW_LINE> <INDENT> threading.Thread.__init__(self) <NEW_LINE> self.squeue = squeue <NEW_LINE> self.ports = ports <NEW_LINE> self.scan_ports = scan_ports <NEW_LINE> <DEDENT... | Multithreading class | 625990733317a56b869bf1cc |
class HTMLReporter(Reporter): <NEW_LINE> <INDENT> def __init__(self, stats, report_file=None, report_dir=".", template_file="html.mako", template_dir=None, **kwargs): <NEW_LINE> <INDENT> super(HTMLReporter, self).__init__( stats, report_file=report_file, report_dir=report_dir, template_file=template_file, template_dir=... | A SQLTap Reporter that generates HTML format reports | 62599073097d151d1a2c2981 |
class DataPackageUpdatedSensor(BaseSensorOperator): <NEW_LINE> <INDENT> ui_color = '#33ccff' <NEW_LINE> @apply_defaults <NEW_LINE> def __init__(self, path, dependencies, *args, **kwargs): <NEW_LINE> <INDENT> if not osp.exists(path): <NEW_LINE> <INDENT> raise FileNotFoundError('dataset not found: {}'.format(path)) <NEW_... | Sensor Operation to detect dataset changes. | 625990738a43f66fc4bf3aa4 |
class Router: <NEW_LINE> <INDENT> def __init__(self, app=None): <NEW_LINE> <INDENT> if app is not None: <NEW_LINE> <INDENT> self.register_blueprint(app) <NEW_LINE> <DEDENT> <DEDENT> def register_blueprint(self, app): <NEW_LINE> <INDENT> from app.api import account <NEW_LINE> app.register_blueprint(account.api.blueprint... | 기능 별 blueprint 들을 모아서 register 해주는 class 구현.
:param app: A flask application | 625990731b99ca40022901bd |
class Usuário(TimeStampedModel, AbstractUser): <NEW_LINE> <INDENT> histórico = AuditlogHistoryField() <NEW_LINE> class Meta: <NEW_LINE> <INDENT> ordering = ['-id'] | Usuário base do projeto. | 625990732ae34c7f260ac9f3 |
class LabelSmoothing(nn.Module): <NEW_LINE> <INDENT> def __init__(self, size: int, padding_idx: int, smoothing=0.0): <NEW_LINE> <INDENT> super(LabelSmoothing, self).__init__() <NEW_LINE> self.loss_fn = nn.KLDivLoss(reduction='sum') <NEW_LINE> self.padding_idx = padding_idx <NEW_LINE> self.confidence = 1.0 - smoothing <... | Implement label smoothing on KLDivLoss. | 625990731f037a2d8b9e54f2 |
class Images(object): <NEW_LINE> <INDENT> swagger_types = { 'links': 'list[Link]', 'list': 'list[Image]' } <NEW_LINE> attribute_map = { 'links': 'Links', 'list': 'List' } <NEW_LINE> def __init__(self, links=None, list=None): <NEW_LINE> <INDENT> self._links = None <NEW_LINE> self._list = None <NEW_LINE> if links is not ... | NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually. | 6259907376e4537e8c3f0e8e |
class SSHDefaultScanPlugin(core.PluginBase): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> core.PluginBase.__init__(self) <NEW_LINE> self.id = "sshdefaultscan" <NEW_LINE> self.name = "sshdefaultscan" <NEW_LINE> self.plugin_version = "0.0.1" <NEW_LINE> self.version = "1.0.0" <NEW_LINE> self._command_regex ... | Handle sshdefaultscan (https://github.com/atarantini/sshdefaultscan) output
using --batch and --batch-template; supports --username and --password | 6259907366673b3332c31d0e |
class _ControlCodes(dict): <NEW_LINE> <INDENT> def key_for(self, obj): <NEW_LINE> <INDENT> for key, val in self.iteritems(): <NEW_LINE> <INDENT> if val is obj: <NEW_LINE> <INDENT> return key <NEW_LINE> <DEDENT> <DEDENT> raise ValueError("The given object could not be found: %r" % obj) | Control codes used to "signal" a service via ControlService.
User-defined control codes are in the range 128-255. We generally use
the standard Python value for the Linux signal and add 128. Example:
>>> signal.SIGUSR1
10
control_codes['graceful'] = 128 + 10 | 625990734428ac0f6e659e44 |
@admin.register(models.Room) <NEW_LINE> class RoomAdmin(admin.ModelAdmin): <NEW_LINE> <INDENT> inlines = (PhotoInline,) <NEW_LINE> fieldsets = ( ( "Basic Info", {"fields": ("name", "description", "country", "city", "address", "price")}, ), ("Times", {"fields": ("check_in", "check_out", "instant_book")}), ("Spaces", {"f... | Room Model Definition | 625990737b25080760ed896c |
class AbstractFetcher(object): <NEW_LINE> <INDENT> def __init__(self, data=None): <NEW_LINE> <INDENT> self.id = str(uuid.uuid4()) <NEW_LINE> self.context = f'/tmp/rf-runner/{self.id}/' <NEW_LINE> if data: <NEW_LINE> <INDENT> self._load_meta(data) <NEW_LINE> <DEDENT> <DEDENT> def _load_meta(self, data): <NEW_LINE> <INDE... | Fetcher should get testcases from sources for execution | 625990734428ac0f6e659e45 |
class CheckoutPage(Report): <NEW_LINE> <INDENT> __name__ = 'account.payment.stripe.checkout' | Stripe Checkout | 6259907326068e7796d4e24d |
class Config(object): <NEW_LINE> <INDENT> SQLALCHEMY_DATABASE_URI = os.getenv("SQLALCHEMY_DATABASE_URI") <NEW_LINE> SQLALCHEMY_TRACK_MODIFICATIONS = False <NEW_LINE> SECRET_KEY = os.getenv("SECRET_KEY") | Set environment variables. | 62599073cc0a2c111447c759 |
class hr_employee(osv.osv): <NEW_LINE> <INDENT> _name = 'hr.employee' <NEW_LINE> _inherit = 'hr.employee' <NEW_LINE> _columns = { 'employee_no': fields.char('Employee ID', size=IDLEN, readonly=True), 'f_employee_no': fields.char('Employee ID', size=IDLEN+2, readonly=True), 'tin_no': fields.char('TIN No', size=10), } <N... | Implement company wide unique identification number. | 62599073d268445f2663a7e6 |
class chebyshevu_root(Function): <NEW_LINE> <INDENT> nargs = 2 <NEW_LINE> @classmethod <NEW_LINE> @deprecated <NEW_LINE> def canonize(cls, n, k): <NEW_LINE> <INDENT> return cls.eval(m, k) <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> def eval(cls, n, k): <NEW_LINE> <INDENT> if not 0 <= k < n: <NEW_LINE> <INDENT> raise Va... | chebyshevu_root(n, k) returns the kth root (indexed from zero) of the
nth Chebyshev polynomial of the second kind; that is, if 0 <= k < n,
chebyshevu(n, chebyshevu_root(n, k)) == 0.
Examples
========
>>> chebyshevu_root(3, 2)
-2**(1/2)/2
>>> chebyshevu(3, chebyshevu_root(3, 2))
0 | 625990737c178a314d78e874 |
class StoreStreamerPart(multipart_streamer.MultiPartStreamer): <NEW_LINE> <INDENT> def __init__(self, store, *args, **kwargs): <NEW_LINE> <INDENT> super().__init__(*args, **kwargs) <NEW_LINE> self.store = store <NEW_LINE> <DEDENT> def create_part(self, headers): <NEW_LINE> <INDENT> return multipart_streamer.TemporaryFi... | Create a Part streamer with a custom temp directory. Using the default
tmp directory and trying to move the file to $RIFT_ARTIFACTS occasionally
causes link errors. So create a temp directory within the staging area. | 6259907397e22403b383c815 |
class SubscriptionInstance(InstanceResource): <NEW_LINE> <INDENT> def __init__(self, version, payload, sid=None): <NEW_LINE> <INDENT> super(SubscriptionInstance, self).__init__(version) <NEW_LINE> self._properties = { 'account_sid': payload.get('account_sid'), 'sid': payload.get('sid'), 'date_created': deserialize.iso8... | PLEASE NOTE that this class contains preview products that are subject
to change. Use them with caution. If you currently do not have developer
preview access, please contact [email protected]. | 62599073bf627c535bcb2ddf |
class Execution(): <NEW_LINE> <INDENT> def __init__(self, execution, api=None): <NEW_LINE> <INDENT> self.resource_id = None <NEW_LINE> self.outputs = None <NEW_LINE> self.output_types = None <NEW_LINE> self.output_resources = None <NEW_LINE> self.result = None <NEW_LINE> self.status = None <NEW_LINE> self.source_locati... | A class to deal with the information in an execution result
| 62599073e76e3b2f99fda315 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.