code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class Core(containers.DeclarativeContainer): <NEW_LINE> <INDENT> config = providers.Configuration('config') <NEW_LINE> inter_domain_events_publisher = providers.Singleton(EventsPublisher, 'InterDomain') <NEW_LINE> command_router = providers.Singleton(CommandRouter) | IoC container of core component providers. | 6259906baad79263cf42ffcb |
class InvalidBodyError(HTTPError): <NEW_LINE> <INDENT> pass | An attempt was made to send a request with a body object that Hip does
not support. | 6259906ba8370b77170f1bdc |
class BaseDependency(object): <NEW_LINE> <INDENT> def __init__(self, class_or_interface=None, required=True, default=None): <NEW_LINE> <INDENT> self.class_or_interface = class_or_interface <NEW_LINE> self.required = required <NEW_LINE> self.default = default <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> def bound_instanc... | Container encapsulating some dependency | 6259906b7d847024c075dbf1 |
class VariableCollectionItem(Model): <NEW_LINE> <INDENT> def __init__(self, key=None): <NEW_LINE> <INDENT> self.openapi_types = { 'key': str } <NEW_LINE> self.attribute_map = { 'key': 'key' } <NEW_LINE> self._key = key <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> def from_dict(cls, dikt) -> 'VariableCollectionItem': <NE... | NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Do not edit the class manually. | 6259906b442bda511e95d963 |
class BackboneNtoAspOD(bb2YHBond): <NEW_LINE> <INDENT> def __init__(self, model, rcutoff=3.2, *args, **kwds): <NEW_LINE> <INDENT> bb2YHBond.__init__(self, model, rats=['ASPOD1', 'ASPOD2'], sameres=False, namekl=get_asp_names, rcutoff=rcutoff, *args, **kwds) | Backbone nitrogen (donor) to Asp oxygen | 6259906b8da39b475be04a02 |
class Bundles(object): <NEW_LINE> <INDENT> phrase_path = 'testprojects/src/java/org/pantsbuild/testproject/phrases' <NEW_LINE> class Bundle(object): <NEW_LINE> <INDENT> def __init__(self, spec, text): <NEW_LINE> <INDENT> self.spec = spec <NEW_LINE> self.text = text <NEW_LINE> <DEDENT> def __hash__(self): <NEW_LINE> <IN... | Container class to hold test bundle specifications. | 6259906b5166f23b2e244be9 |
class AGAHistoricalGamesLoader(Command): <NEW_LINE> <INDENT> option_list = ( Option('--sql_dump', '-d', dest='agagd_dump_filename'), Option('--pin_changes', '-p', dest='pin_change_dump_filename') ) <NEW_LINE> def setup(self, pin_change_dump_filename): <NEW_LINE> <INDENT> name = 'AGA' <NEW_LINE> server = db.session.quer... | Class which holds a little bit of state used while loading the AGAGD data. | 6259906b4e4d562566373c1d |
class UserSerializer(serializers.ModelSerializer): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> model = User <NEW_LINE> fields = ["id", "public_username"] <NEW_LINE> read_only_fields = ["id", "public_username"] | Serializer for User model. | 6259906b7b180e01f3e49c6f |
class UserProfileManager(BaseUserManager): <NEW_LINE> <INDENT> def create_user(self, email, name, password=None): <NEW_LINE> <INDENT> if not email: <NEW_LINE> <INDENT> raise ValueError('User must have an email address.') <NEW_LINE> <DEDENT> email = self.normalize_email(email) <NEW_LINE> user = self.model(email=email, n... | Helps Django work with our custom user model. | 6259906b5fdd1c0f98e5f79c |
class ExplicitTractInfo(TractInfo): <NEW_LINE> <INDENT> def __init__(self, ident, patchInnerDimensions, patchBorder, ctrCoord, radius, tractOverlap, wcs): <NEW_LINE> <INDENT> vertexList = [] <NEW_LINE> self._radius = radius <NEW_LINE> super(ExplicitTractInfo, self).__init__(ident, patchInnerDimensions, patchBorder, ctr... | Information for a tract specified explicitly
A tract is placed at the explicitly defined coordinates, with the nominated
radius. The tracts are square (i.e., the radius is really a half-size). | 6259906b99cbb53fe68326fe |
class Proposal(BlockchainObject, SyncProposal): <NEW_LINE> <INDENT> async def __init__(self, data, *args, **kwargs): <NEW_LINE> <INDENT> self.define_classes() <NEW_LINE> assert self.account_class <NEW_LINE> await BlockchainObject.__init__(self, data, *args, **kwargs) <NEW_LINE> <DEDENT> async def refresh(self): <NEW_LI... | Read data about a Proposal Balance in the chain
:param str id: Id of the proposal
:param instance blockchain_instance: instance to use when accesing a RPC | 6259906bac7a0e7691f73cfe |
class Recording(MBTreeElement): <NEW_LINE> <INDENT> idTagName = 'musicbrainz_trackid' <NEW_LINE> def __init__(self, recordingid, pos, parent, tracknumber): <NEW_LINE> <INDENT> super().__init__(recordingid) <NEW_LINE> parent.insertChild(pos, self) <NEW_LINE> self.tracknumber = tracknumber <NEW_LINE> self.parentWork = se... | A recording is a unique piece of recorded audio.
Every track on a CD is associated to exactly one recording. Since we don't care about tracks,
we immediately insert Recordings as children of media. | 6259906ba8370b77170f1bdd |
class PNGFormatter(BaseFormatter): <NEW_LINE> <INDENT> format_type = Unicode('image/png') <NEW_LINE> print_method = ObjectName('_repr_png_') <NEW_LINE> _return_type = (bytes, unicode_type) | A PNG formatter.
To define the callables that compute the PNG representation of your
objects, define a :meth:`_repr_png_` method or use the :meth:`for_type`
or :meth:`for_type_by_name` methods to register functions that handle
this.
The return value of this formatter should be raw PNG data, *not*
base64 encoded. | 6259906badb09d7d5dc0bd81 |
class DecodingError(MongoException): <NEW_LINE> <INDENT> pass | Exception thrown whenever the decoding of an object fails | 6259906b627d3e7fe0e0869f |
class Survival_Problem_TestCase(unittest.TestCase): <NEW_LINE> <INDENT> def _test_value_calculation_size(self, theta_num_col): <NEW_LINE> <INDENT> np.random.seed(10) <NEW_LINE> motif_len = 3 <NEW_LINE> penalty_param = 0.5 <NEW_LINE> feat_gen = HierarchicalMotifFeatureGenerator(motif_lens=[motif_len]) <NEW_LINE> motif_l... | Show that the values from CVXPY and our own impelmentation is the same | 6259906b167d2b6e312b8199 |
class MatrixTransitionObject: <NEW_LINE> <INDENT> def __init__(self, T): <NEW_LINE> <INDENT> self.T = T <NEW_LINE> self.stationary_distribution = get_stationary_distribution(self.T) <NEW_LINE> <DEDENT> def get_nstates(self): <NEW_LINE> <INDENT> return len(self.stationary_distribution) <NEW_LINE> <DEDENT> def get_transi... | This is like a transition matrix.
Matrix powers could use some caching eventually. | 6259906b71ff763f4b5e8fbe |
class ManagedObject(sql.Base): <NEW_LINE> <INDENT> __tablename__ = 'managed_objects' <NEW_LINE> unique_identifier = Column('uid', Integer, primary_key=True) <NEW_LINE> _object_type = Column('object_type', sql.EnumType(enums.ObjectType)) <NEW_LINE> _class_type = Column('class_type', String(50)) <NEW_LINE> value = Column... | The abstract base class of the simplified KMIP object hierarchy.
A ManagedObject is a core KMIP object that is the subject of key
management operations. It contains various attributes that are common to
all types of ManagedObjects, including keys, certificates, and various
types of secret or sensitive data.
For more ... | 6259906b1b99ca4002290141 |
class Show_Contacts: <NEW_LINE> <INDENT> def __init__(self, app): <NEW_LINE> <INDENT> parent = app.root <NEW_LINE> self.parent = parent <NEW_LINE> self.app = app <NEW_LINE> self.select_dialog = Pmw.Dialog(parent, buttons = ('Ok','Cancel'), title = 'Show Contacts Plugin', command = self.button_pressed ) <NEW_LINE> self.... | Main Pymol Plugin Class | 6259906b97e22403b383c724 |
class Episode: <NEW_LINE> <INDENT> def __init__(self, tvshow: TVShow, title: str, season: int, number: int): <NEW_LINE> <INDENT> self.tvshow = tvshow <NEW_LINE> self.title = title <NEW_LINE> self.season = season <NEW_LINE> self.number = number <NEW_LINE> <DEDENT> def __eq__(self, other): <NEW_LINE> <INDENT> return self... | Data class representing an Episode | 6259906bf7d966606f7494c7 |
class DeviceRegCompleteRequest(object): <NEW_LINE> <INDENT> def __init__(self, nonce=None): <NEW_LINE> <INDENT> self.swagger_types = { 'nonce': 'str' } <NEW_LINE> self.attribute_map = { 'nonce': 'nonce' } <NEW_LINE> self._nonce = nonce <NEW_LINE> <DEDENT> @property <NEW_LINE> def nonce(self): <NEW_LINE> <INDENT> return... | NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually. | 6259906b796e427e5384ff8f |
class GtkReactorDeprecation(TestCase): <NEW_LINE> <INDENT> class StubGTK: <NEW_LINE> <INDENT> class GDK: <NEW_LINE> <INDENT> INPUT_READ = None <NEW_LINE> <DEDENT> def input_add(self, *params): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> <DEDENT> class StubPyGTK: <NEW_LINE> <INDENT> def require(self, something): <NEW_L... | Tests to ensure all attributes of L{twisted.internet.gtkreactor} are
deprecated. | 6259906bcc0a2c111447c6dc |
class MultiVersionGenerateOrchestrator: <NEW_LINE> <INDENT> @inject.autoparams() <NEW_LINE> def __init__(self, evg_api: EvergreenApi, multiversion_util: MultiversionUtilService, gen_task_options: GenTaskOptions) -> None: <NEW_LINE> <INDENT> self.evg_api = evg_api <NEW_LINE> self.multiversion_util = multiversion_util <N... | An orchestrator for generating multiversion tasks. | 6259906b7047854f46340bce |
class Node(object): <NEW_LINE> <INDENT> def __init__(self, val, next_node=None, prev_node=None): <NEW_LINE> <INDENT> self.val = val <NEW_LINE> self.next_node = next_node <NEW_LINE> self.prev_node = prev_node | Set properties and methods of Node class. | 6259906b67a9b606de5476ae |
class PeerRelationEvents(ObjectEvents): <NEW_LINE> <INDENT> pass | Peer Relation Events | 6259906b442bda511e95d964 |
class Config(DotSection): <NEW_LINE> <INDENT> def __init__(self, input, relative_to=None): <NEW_LINE> <INDENT> schema = Schema({ 'DXR': { Optional('temp_folder', default=abspath('dxr-temp-{tree}')): AbsPath, Optional('default_tree', default=None): basestring, Optional('disabled_plugins', default=plugin_list('')): Plugi... | Validation and encapsulation for the DXR config file
Examples::
# Settings from the [DXR] section:
>>> Config(...).default_tree
# Settings from individual trees:
>>> Config(...).trees['some-tree'].build_command
# Settings from plugin-specific sections of trees:
>>> Config(...).trees['some-tr... | 6259906be1aae11d1e7cf419 |
class AliasViewSet(ViewSetWithPermissions): <NEW_LINE> <INDENT> queryset = Alias.objects.prefetch_related('replace') <NEW_LINE> serializer_class = AliasSerializer | API endpoint that allows alias to be viewed or edited. | 6259906b3cc13d1c6d466f5e |
class CategoryModel(db.Model): <NEW_LINE> <INDENT> __tablename__ = 'categories' <NEW_LINE> id = db.Column(db.Integer, primary_key=True) <NEW_LINE> name = db.Column(db.String(80)) <NEW_LINE> posts = db.relationship('PostModel', lazy='dynamic') <NEW_LINE> def __init__(self, id, name): <NEW_LINE> <INDENT> self.id = id <NE... | THIS CLASS CONTAINS ALL THE FUNCTION NEEDED TO CREAT, EDIT DELETE CATEGORY
ARGS:
id: int
name: string | 6259906bdd821e528d6da58d |
class JobTemplate(models.Model): <NEW_LINE> <INDENT> title = models.CharField(max_length=255, db_index=True) <NEW_LINE> description = models.TextField(blank=True) <NEW_LINE> body = models.TextField(help_text=( 'Use {{ content|safe }} at the place where you want to render the ' 'script content of the job' )) <NEW_LINE> ... | Job templates | 6259906bd486a94d0ba2d7d8 |
class AppSettings(BaseSettings): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> if os.getuid() == 0: <NEW_LINE> <INDENT> log_path = '/var/log' <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> log_path = '/tmp' <NEW_LINE> <DEDENT> <DEDENT> except Exception as e: <NEW_LINE> <INDENT> log_path = '/tmp' <NEW_LINE> <DEDENT> if no... | This class represents all settings the server would need. | 6259906b5fdd1c0f98e5f79e |
class ICollection(IMinMaxLen, IIterable, IContainer): <NEW_LINE> <INDENT> value_type = Field( title = _("Value Type"), description = _(u"Field value items must conform to the given type, " u"expressed via a Field.")) <NEW_LINE> unique = Bool( title = _('Unique Members'), description = _('Specifies whether the members o... | Abstract interface containing a collection value.
The Value must be iterable and may have a min_length/max_length. | 6259906b460517430c432c62 |
class MessageQueueTest(TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> address = "127.0.0.1" <NEW_LINE> port = "9999" <NEW_LINE> self.message_queue = MessageQueue( address, port ) <NEW_LINE> self.message_queue.start() <NEW_LINE> class TestClient: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <I... | Test Message Queue.
Testing MessageQueue needs permission to listen port 9999 on 127.0.0.1. | 6259906b55399d3f05627d3a |
class InsertMoleculeMove(GCMove): <NEW_LINE> <INDENT> key = "gcinsertmol" <NEW_LINE> parse_mover = staticmethod(parse_molecule_gcmc) <NEW_LINE> print_mover = staticmethod(print_gcmc) | Concrete class for Grand Canonical molecule moves | 6259906b4c3428357761bacc |
class TranslateError(Exception): <NEW_LINE> <INDENT> def __init__(self, _file, line, msg): <NEW_LINE> <INDENT> super(TranslateError, self).__init__() <NEW_LINE> self._file = _file <NEW_LINE> self.line = line <NEW_LINE> self.msg = msg <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> if self._file != "arg": <NE... | Error caused when key_to_hex() cant translate a key | 6259906b8a43f66fc4bf39ac |
class EnvioModulo(models.Model): <NEW_LINE> <INDENT> MODULO = ( ('151', '290151'), ('152', '290152'), ('153', '290153'), ('154', '290154'), ('251', '290251'), ('252', '290252'), ('253', '290253'), ('254', '290254'), ('291', '290291'), ('351', '290351'), ('352', '290352'), ('353', '290353'), ) <NEW_LINE> lote = models.F... | Modelo para controlar las entregas a los MAC | 6259906ba219f33f346c8021 |
class SSLUseCommand(Command): <NEW_LINE> <INDENT> def __init__(self, app): <NEW_LINE> <INDENT> self.app = app <NEW_LINE> <DEDENT> def execute(self): <NEW_LINE> <INDENT> logging.info("Running SSL USE command") <NEW_LINE> confidence_points = 0 <NEW_LINE> ssl_files = [] <NEW_LINE> for file_name in self.app.source_paths: <... | Command that will check if app is using SSL!
PRECONDITION, must have checked if app uses internet
using the InternetUseCommand | 6259906b8e7ae83300eea8a8 |
class PrepaymentBalanceListResponse(object): <NEW_LINE> <INDENT> def __init__(self, data=None, pagination=None): <NEW_LINE> <INDENT> self.swagger_types = { 'data': 'list[PrepaymentBalance]', 'pagination': 'Pagination' } <NEW_LINE> self.attribute_map = { 'data': 'data', 'pagination': 'pagination' } <NEW_LINE> self._data... | NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually. | 6259906b7047854f46340bcf |
class TestCrc16(TestClass): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> super().__init__(*args, **kwargs) <NEW_LINE> <DEDENT> def test_calc_crc(self): <NEW_LINE> <INDENT> with self.assertRaises(AttributeError): <NEW_LINE> <INDENT> CRC16.calc_crc(None) <NEW_LINE> <DEDENT> with self.asser... | Test class for main file. | 6259906b4a966d76dd5f0704 |
class TitoGitTestFixture(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.repo_dir = tempfile.mkdtemp("-titotest") <NEW_LINE> print <NEW_LINE> print <NEW_LINE> print("Testing in: %s" % self.repo_dir) <NEW_LINE> print <NEW_LINE> self.repo = git.Repo.init(path=self.repo_dir, mkdir=True, b... | Fixture providing setup/teardown and utilities for all tests requiring
an actual git repository. | 6259906b0a50d4780f7069cd |
class MovieReviewDataset(): <NEW_LINE> <INDENT> def __init__(self, dataset_path: str, max_length: int): <NEW_LINE> <INDENT> data_review = os.path.join(dataset_path, 'train', 'train_data') <NEW_LINE> data_label = os.path.join(dataset_path, 'train', 'train_label') <NEW_LINE> with open(data_review, 'rt', encoding='utf-8')... | 영화리뷰 데이터를 읽어서, tuple (데이터, 레이블)의 형태로 리턴하는 파이썬 오브젝트 입니다. | 6259906b7047854f46340bd0 |
class NasConv(nn.Layer): <NEW_LINE> <INDENT> def __init__(self, in_channels, out_channels, kernel_size, strides, padding, groups, data_format="channels_last", **kwargs): <NEW_LINE> <INDENT> super(NasConv, self).__init__(**kwargs) <NEW_LINE> self.activ = nn.ReLU() <NEW_LINE> self.conv = Conv2d( in_channels=in_channels, ... | NASNet specific convolution block.
Parameters:
----------
in_channels : int
Number of input channels.
out_channels : int
Number of output channels.
kernel_size : int or tuple/list of 2 int
Convolution window size.
strides : int or tuple/list of 2 int
Strides of the convolution.
padding : int or tuple/l... | 6259906bd486a94d0ba2d7d9 |
class Mapcycle: <NEW_LINE> <INDENT> def __init__(self, cycle): <NEW_LINE> <INDENT> self.value = str(cycle) <NEW_LINE> <DEDENT> @property <NEW_LINE> def year(self): <NEW_LINE> <INDENT> return int(self.value[:4]) <NEW_LINE> <DEDENT> @property <NEW_LINE> def timestamp(self): <NEW_LINE> <INDENT> return pd.Timestamp(self.va... | Convenience class for map cycles | 6259906b283ffb24f3cf50c3 |
class RequestTimeOut(TimeOut): <NEW_LINE> <INDENT> message = "PrePool Request timeout" | required time out
| 6259906b4e4d562566373c20 |
class TestGuessManifest(TestCase): <NEW_LINE> <INDENT> _multiprocess_can_split_ = True <NEW_LINE> maxDiff = None <NEW_LINE> expect_good = { "name": "BVZ0022-GC05L-CN650D-Cam07~fullres-orig", "start_datetime": "2013_10_30_03_00_00", "end_datetime": "2013_10_30_06_00_00", "version": 1, "image_type": "jpg", "extension": "... | Tests for timestream.parse.ts_guess_manifest | 6259906b3346ee7daa33826b |
class SentimentAdapter(BaseMatchAdapter): <NEW_LINE> <INDENT> def __init__(self, **kwargs): <NEW_LINE> <INDENT> super(SentimentAdapter, self).__init__(**kwargs) <NEW_LINE> from chatterbot.conversation.comparisons import sentiment_comparison <NEW_LINE> self.compare_statements = kwargs.get( 'statement_comparison_function... | This adapter selects a response with the closest
matching sentiment value to the input statement. | 6259906ba8370b77170f1be0 |
class ActionType: <NEW_LINE> <INDENT> PREPARE_FLANKING_LEFT = 1 <NEW_LINE> PREPARE_FLANKING_RIGHT = 2 <NEW_LINE> ATTACK_BASE = 3 | List of possible action types. | 6259906b6e29344779b01e6e |
class ResultsValues(enum.Enum): <NEW_LINE> <INDENT> SOURCE_FILE = "source_filename" <NEW_LINE> SOURCE_HASH = "checksum_hash" <NEW_LINE> CHECKSUM_FILE = "checksum_file" | Values for results for Checksum reports. | 6259906b3cc13d1c6d466f60 |
class LaunchedDroneRegister(SlotAmountRegister): <NEW_LINE> <INDENT> def __init__(self, fit): <NEW_LINE> <INDENT> SlotAmountRegister.__init__(self, fit, 'launched_drones', Restriction.launched_drone) <NEW_LINE> <DEDENT> def register_holder(self, holder): <NEW_LINE> <INDENT> if isinstance(holder, Drone): <NEW_LINE> <IND... | Implements restriction:
Number of launched drones should not exceed number of
drones you're allowed to launch.
Details:
Only holders of Drone class are tracked.
For validation, stats module data is used. | 6259906b2c8b7c6e89bd5000 |
class PhaseGate(OneQubitGate): <NEW_LINE> <INDENT> gate_name = 'S' <NEW_LINE> gate_name_latex = 'S' <NEW_LINE> def get_target_matrix(self, format='sympy'): <NEW_LINE> <INDENT> return matrix_cache.get_matrix('S', format) <NEW_LINE> <DEDENT> def _eval_commutator_ZGate(self, other, **hints): <NEW_LINE> <INDENT> return _S.... | The single qubit phase, or S, gate.
This gate rotates the phase of the state by pi/2 if the state is ``|1>`` and
does nothing if the state is ``|0>``.
Parameters
----------
target : int
The target qubit this gate will apply to.
Examples
======== | 6259906b0c0af96317c5796c |
class ZoneViewsRemoveResourcesRequest(messages.Message): <NEW_LINE> <INDENT> resources = messages.StringField(1, repeated=True) | The request to remove resources from the resource view.
Fields:
resources: The list of resources to be removed. | 6259906ba8370b77170f1be1 |
class TestMeetingInfoGet(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 testMeetingInfoGet(self): <NEW_LINE> <INDENT> pass | MeetingInfoGet unit test stubs | 6259906b3d592f4c4edbc6fa |
class CourseNavigationTestMixin(object): <NEW_LINE> <INDENT> __metaclass__ = ABCMeta <NEW_LINE> def test_depth_zero(self): <NEW_LINE> <INDENT> response = self.http_get_for_course( data={'navigation_depth': '0'} ) <NEW_LINE> root_block = response.data[self.block_navigation_view_type][unicode(self.course.location)] <NEW_... | A Mixin class for testing all views related to Course navigation. | 6259906c2c8b7c6e89bd5001 |
class RemoteEvent(Event): <NEW_LINE> <INDENT> def __init__(self, my_id, message, refs, duration="(since 00h 00m 00s)"): <NEW_LINE> <INDENT> super(RemoteEvent, self).__init__(message, refs, duration) <NEW_LINE> self.id = my_id <NEW_LINE> self._progress = 0.0 <NEW_LINE> self._refresh() <NEW_LINE> <DEDENT> def set_progres... | An event that was published by another module: we know nothing about
this, rely on the other module to continuously update us with
progress information as it emerges. | 6259906c76e4537e8c3f0d9e |
class Random: <NEW_LINE> <INDENT> @commands.command(aliases=["cflip", "coinflip"]) <NEW_LINE> @commands.cooldown(6, 12, commands.BucketType.channel) <NEW_LINE> async def coin(self, ctx): <NEW_LINE> <INDENT> choice = systemrandom.choice(SIDES_COIN) <NEW_LINE> logger.info(f"Flipped a coin; it's {choice}") <NEW_LINE> awai... | Commands that generate things at random. | 6259906ca17c0f6771d5d7b6 |
class RegisterView(View): <NEW_LINE> <INDENT> def get(self, request): <NEW_LINE> <INDENT> return render(request, 'user/reg.html') <NEW_LINE> <DEDENT> def post(self, request): <NEW_LINE> <INDENT> data = request.POST <NEW_LINE> form = RegisterModelForm(data) <NEW_LINE> if form.is_valid(): <NEW_LINE> <INDENT> cleaned_data... | 注册视图 | 6259906c44b2445a339b756d |
class get_a_map_result: <NEW_LINE> <INDENT> thrift_spec = ( (0, TType.MAP, 'success', (TType.STRING,None,TType.DOUBLE,None), None, ), ) <NEW_LINE> def __init__(self, success=None,): <NEW_LINE> <INDENT> self.success = success <NEW_LINE> <DEDENT> def read(self, iprot): <NEW_LINE> <INDENT> if iprot.__class__ == TBinaryPro... | Attributes:
- success | 6259906c097d151d1a2c288b |
class EventManager: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> from weakref import WeakKeyDictionary <NEW_LINE> self.listeners = WeakKeyDictionary() <NEW_LINE> <DEDENT> def register_listener(self, listener): <NEW_LINE> <INDENT> self.listeners[listener] = 1 <NEW_LINE> <DEDENT> def unregister_listener(se... | This class is responsible for coordinating most communication between the game systems.
This class and the idea of event driven architecture was taken from `sjbrown's Writing Games Tutorial <http://ezide.com/games/writing-games.html>`_.
:Attributes:
- *listener* (): registered listeners | 6259906c3317a56b869bf151 |
class AzKVNonRecoverableEventTest(unittest.TestCase): <NEW_LINE> <INDENT> def test_com_bucket_missing(self): <NEW_LINE> <INDENT> record = copy.deepcopy(base_record) <NEW_LINE> record['com'] = None <NEW_LINE> plugin = azkvnonrecoverableevent. AzKVNonRecoverableEvent() <NEW_LINE> events = list(plugin.eval(reco... | Tests for AzKVNonRecoverableEvent plugin. | 6259906cb7558d5895464b3f |
class UserDetailsChanging(UserSettingsFormHandler): <NEW_LINE> <INDENT> form_class = UserDetailsChangingForm <NEW_LINE> form_name = 'user_details_form' <NEW_LINE> redirect_view_name = 'user_settings' <NEW_LINE> success_message = _('changes saved') <NEW_LINE> @method_decorator(login_required) <NEW_LINE> def post(self, r... | A view to handle the form that in charge of changing the
fields of the User model (excluding password). | 6259906cd6c5a102081e3946 |
class Favourites(models.Model): <NEW_LINE> <INDENT> profile = models.ForeignKey(Profile, on_delete=models.CASCADE, null=True) <NEW_LINE> article = models.ForeignKey( Article, related_name="article_id", on_delete=models.CASCADE, null=True) <NEW_LINE> favourite = models.BooleanField(default=False) | field contains id of user who has
favourited an article | 6259906ce76e3b2f99fda21d |
@total_ordering <NEW_LINE> class AgentNode: <NEW_LINE> <INDENT> def __init__(self, agent: Agent, polarity: Polarity) -> None: <NEW_LINE> <INDENT> self.agent = agent <NEW_LINE> self.polarity = polarity <NEW_LINE> <DEDENT> def __str__(self) -> str: <NEW_LINE> <INDENT> return f'{self.agent}({self.polarity.value})' <NEW_LI... | Agent nodes split into positive and negative component nodes. An edge is
drawn between them when the graph is built. | 6259906c4a966d76dd5f0707 |
class AiNameCulturalContext(object): <NEW_LINE> <INDENT> swagger_types = { 'language': 'str', 'location': 'str', 'script': 'str', 'encoding': 'str', 'style': 'str' } <NEW_LINE> attribute_map = { 'language': 'language', 'location': 'location', 'script': 'script', 'encoding': 'encoding', 'style': 'style' } <NEW_LINE> def... | AiName cultural context
| 6259906c01c39578d7f14343 |
class PauseTask(Routine): <NEW_LINE> <INDENT> def handle(self, scheduler, task): <NEW_LINE> <INDENT> log.debug("Pausing task %r.", task) <NEW_LINE> return True | Schedule the task to resume later through explicit resume. | 6259906c4527f215b58eb5ae |
class Metadata(QuantumAPIDictWrapper): <NEW_LINE> <INDENT> _attrs = ['name', 'id', 'value', 'image_map_id'] <NEW_LINE> def __init__(self, apiresource): <NEW_LINE> <INDENT> super(Metadata, self).__init__(apiresource) | Wrapper for quantum metadatas | 6259906c91f36d47f2231a9d |
class Zone(Resource): <NEW_LINE> <INDENT> _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, 'location': {'required': True}, 'max_number_of_record_sets': {'readonly': True}, 'number_of_record_sets': {'readonly': True}, 'name_servers': {'readonly': True}, } <NEW_LINE> _attr... | Describes a DNS zone.
Variables are only populated by the server, and will be ignored when
sending a request.
:ivar id: Resource ID.
:vartype id: str
:ivar name: Resource name.
:vartype name: str
:ivar type: Resource type.
:vartype type: str
:param location: Resource location.
:type location: str
:param tags: Resourc... | 6259906c460517430c432c64 |
class Message(RawMessage): <NEW_LINE> <INDENT> def encode(self, value): <NEW_LINE> <INDENT> return base64.b64encode(value) <NEW_LINE> <DEDENT> def decode(self, value): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> value = base64.b64decode(value) <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> raise SQSDecodeError('Unabl... | The default Message class used for SQS queues. This class automatically
encodes/decodes the message body using Base64 encoding to avoid any
illegal characters in the message body. See:
http://developer.amazonwebservices.com/connect/thread.jspa?messageID=49680%EC%88%90
for details on why this is a good idea. The en... | 6259906ce5267d203ee6cfcc |
class Policy(object): <NEW_LINE> <INDENT> __metaclass__ = abc.ABCMeta <NEW_LINE> @abc.abstractmethod <NEW_LINE> def reset(self): <NEW_LINE> <INDENT> raise NotImplementedError <NEW_LINE> <DEDENT> @abc.abstractmethod <NEW_LINE> def restore(self, checkpoint): <NEW_LINE> <INDENT> raise NotImplementedError <NEW_LINE> <DEDEN... | Base policy abstraction.
Subclasses should implement `reset` and `sample_action` methods to ensure
compatibility with the train_collect_eval function. | 6259906c0c0af96317c5796d |
class Dog(Animal): <NEW_LINE> <INDENT> def __init__(self, name): <NEW_LINE> <INDENT> self.name = name | This is a Dog class | 6259906cac7a0e7691f73d04 |
class ProxyRequest(http.Request): <NEW_LINE> <INDENT> protocols = {'http': ProxyClientFactory} <NEW_LINE> ports = {'http': 80} <NEW_LINE> def process(self): <NEW_LINE> <INDENT> parsed = urlparse.urlparse(self.uri) <NEW_LINE> protocol = parsed[0] <NEW_LINE> host = parsed[1] <NEW_LINE> port = self.ports[protocol] <NEW_LI... | Used by Proxy to implement a simple web proxy. | 6259906c4c3428357761bad0 |
class LifecycleManager: <NEW_LINE> <INDENT> configManager = None <NEW_LINE> toreeManager = None <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> self.configManager = ConfigManager() <NEW_LINE> self.toreeManager = ToreeManager() <NEW_LINE> <DEDENT> def _reserve_profile(self): <NEW_LINE> <INDENT> profilesFolder = self.... | A Orchestrator for Toree Lifecycle which select an available
toree sloot, reserv it and start/stop when notebooks are
started/stopped.
Open slots are identified by a not having a toree.pid. In case
of corruption or a requirement to kill the toree process, one
should also remove the toree.id from the specific Toree slo... | 6259906c71ff763f4b5e8fc4 |
class Voc: <NEW_LINE> <INDENT> def __init__(self, name): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.trimmed = False <NEW_LINE> self.word2index = {} <NEW_LINE> self.word2count = {} <NEW_LINE> self.index2word = { PAD_token: "PAD", SOS_token: "SOS", EOS_token: "EOS"} <NEW_LINE> self.num_words = 3 <NEW_LINE> <DED... | dictionary class
| 6259906cf548e778e596cda9 |
class WidgetContainerListContentsMixin(object): <NEW_LINE> <INDENT> def __iter__(self): <NEW_LINE> <INDENT> return xrange(len(self.contents)) <NEW_LINE> <DEDENT> def __reversed__(self): <NEW_LINE> <INDENT> return xrange(len(self.contents) - 1, -1, -1) | Mixin class for widget containers whose positions are indexes into
a list available as self.contents. | 6259906c8a43f66fc4bf39b0 |
class Duplex(Enum, IComparable, IFormattable, IConvertible): <NEW_LINE> <INDENT> def __eq__(self, *args): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def __format__(self, *args): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def __ge__(self, *args): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def __gt__(self, *args): ... | Specifies the printer's duplex setting.
enum Duplex, values: Default (-1), Horizontal (3), Simplex (1), Vertical (2) | 6259906c63d6d428bbee3e98 |
class Tag(models.Model): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> ordering = ['name'] <NEW_LINE> verbose_name = _('tag') <NEW_LINE> verbose_name_plural = _('tags') <NEW_LINE> <DEDENT> NAME_LENGTH = 64 <NEW_LINE> name = models.CharField(max_length=NAME_LENGTH, db_index=True, unique=True, blank=False) <NEW_LIN... | A single tag consists of a series of letters, without any space between them.
Tags are case insensitive. | 6259906c76e4537e8c3f0da0 |
class ChefClientRunner(ChefRunner): <NEW_LINE> <INDENT> cmdline_options = [ ('-r', '--rewrite_runlist', {}) ] <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> super(ChefClientRunner, self).__init__() <NEW_LINE> self.cmdline_options += ChefRunner.cmdline_options <NEW_LINE> self.chef_binary = 'chef-client' | ChefRunner type implementation.
Invokes chef-client binary with given arguments. | 6259906c99fddb7c1ca639df |
class Page: <NEW_LINE> <INDENT> request = None <NEW_LINE> def __init__(self, name, title, text): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.title = title <NEW_LINE> self.text = text <NEW_LINE> self.context = {} <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> def parse(cls, name, input): <NEW_LINE> <INDENT> if isi... | One page of text that can be displayed. | 6259906c16aa5153ce401cf7 |
class TailCommand(Command): <NEW_LINE> <INDENT> def __init__(self, name='tail', topic='shell', brief='display the last lines of a file', **kwargs): <NEW_LINE> <INDENT> self.parser = PypsiArgParser( prog=name, description=brief, usage=TailCmdUsage ) <NEW_LINE> self.parser.add_argument( 'input_file', help='file to displa... | Displays the last N lines of a file to the screen. | 6259906c3317a56b869bf152 |
class LogisticAT(base.BaseEstimator): <NEW_LINE> <INDENT> def __init__(self, alpha=1., verbose=0, max_iter=1000): <NEW_LINE> <INDENT> self.alpha = alpha <NEW_LINE> self.verbose = verbose <NEW_LINE> self.max_iter = max_iter <NEW_LINE> <DEDENT> def fit(self, X, y): <NEW_LINE> <INDENT> _y = np.array(y).astype(np.int) <NEW... | Classifier that implements the ordinal logistic model (All-Threshold variant)
Parameters
----------
alpha: float
Regularization parameter. Zero is no regularization, higher values
increate the squared l2 regularization.
References
----------
J. D. M. Rennie and N. Srebro, "Loss Functions for Preference Levels :... | 6259906c3346ee7daa33826d |
class GetManager(generics.RetrieveAPIView): <NEW_LINE> <INDENT> queryset = Manager.objects.all() <NEW_LINE> serializer_class = MangerSerializer | Retrive a particular Manager by its id | 6259906ce1aae11d1e7cf41c |
class TankAnt(BodyguardAnt): <NEW_LINE> <INDENT> name = 'Tank' <NEW_LINE> damage = 1 <NEW_LINE> food_cost = 6 <NEW_LINE> implemented = True <NEW_LINE> def action(self, colony): <NEW_LINE> <INDENT> BodyguardAnt.action(self, colony) <NEW_LINE> for bee in self.place.bees[:]: <NEW_LINE> <INDENT> bee.reduce_armor(TankAnt.da... | TankAnt provides both offensive and defensive capabilities. | 6259906c3cc13d1c6d466f64 |
class AbakusTask(celery.Task): <NEW_LINE> <INDENT> def apply_async(self, args=None, kwargs=None, *arguments, **keyword_arguments): <NEW_LINE> <INDENT> logger = log.bind() <NEW_LINE> logger_context = dict(get_context(logger)._dict) <NEW_LINE> kwargs["logger_context"] = logger_context <NEW_LINE> async_result = super().ap... | This base task supplies the logger_context to the underlying worker.
> @celery_app.task(bind=True, base=AbakusTask)
> def task_name(self, logger_context=None):
> self.setup_logger(logger_context)
> other work... | 6259906c5fc7496912d48e77 |
class FPSBox(overlay.TextOverlayElement): <NEW_LINE> <INDENT> def __init__(self, hud, pos): <NEW_LINE> <INDENT> super().__init__(None, "one million pounds", pos, Color(0,255,0,0)) <NEW_LINE> self.__counter = 0 <NEW_LINE> <DEDENT> def update(self): <NEW_LINE> <INDENT> if self.__counter == 0: <NEW_LINE> <INDENT> self.__c... | Shows the current framerate | 6259906c92d797404e38976a |
class LambdaTransition(Transition): <NEW_LINE> <INDENT> def __init__(self, messages): <NEW_LINE> <INDENT> super(LambdaTransition, self).__init__(messages, None) | Transition subclass that does not change the user's state list in any way. Just sends mesages. | 6259906c4428ac0f6e659d51 |
@skipIf(NO_MOCK, NO_MOCK_REASON) <NEW_LINE> class RsyncTestCase(TestCase): <NEW_LINE> <INDENT> def test_rsync(self): <NEW_LINE> <INDENT> with patch.dict(rsync.__salt__, {'config.option': MagicMock(return_value=False)}): <NEW_LINE> <INDENT> self.assertRaises(CommandExecutionError, rsync.rsync, False, False) <NEW_LINE> <... | Test cases for salt.modules.rsync | 6259906c4e4d562566373c25 |
class Documents(RTC_Client): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def get_by_date(cls, date, make_obj=False, sections=''): <NEW_LINE> <INDENT> endpoint = "documents.json" <NEW_LINE> begin_time = '%sT00:00:00' % date <NEW_LINE> end_time = '%sT23:59:59' % date <NEW_LINE> params = {'posted_at__gte':begin_time, 'pos... | Holds links to various kinds of documents produced
by agencies within Congress, or agencies outside of Congress regarding
legislation and related matters.
This collection currently contains only one kind of document:
whip_notice - Daily and weekly digests of chamber schedules published by
House leadership of each par... | 6259906c7d847024c075dbfa |
class RotateCanvasCCW(Operator): <NEW_LINE> <INDENT> bl_idname = "artist_paint.rotate_ccw_90" <NEW_LINE> bl_label = "Canvas Rotate CounterClockwise 90" <NEW_LINE> bl_options = {'REGISTER','UNDO'} <NEW_LINE> @classmethod <NEW_LINE> def poll(self, context): <NEW_LINE> <INDENT> obj = context.active_object <NEW_LINE> if o... | Image Rotate CounterClockwise 90 Macro | 6259906c2c8b7c6e89bd5004 |
class BaseModelMeta(metatools.MetaClass): <NEW_LINE> <INDENT> def __new__(mcs, name, bases, namespace): <NEW_LINE> <INDENT> decl_refs = namespace.get('_refs', []) <NEW_LINE> refs = {} <NEW_LINE> for ref in decl_refs: <NEW_LINE> <INDENT> refs[ref.field] = ref <NEW_LINE> <DEDENT> namespace['_refs'] = refs <NEW_LINE> name... | Metaclass for class BaseModel. Uses the metatools package to
allow for inheritance of field names, and translates lists of
references into the dictionary needed by BaseModel.__getattr__(). | 6259906ca8370b77170f1be5 |
class SplitDateTimeField(forms.SplitDateTimeField): <NEW_LINE> <INDENT> def __init__(self, input_date_formats=None, input_time_formats=None, **kwargs): <NEW_LINE> <INDENT> input_date_formats = input_date_formats or DEFAULT_DATE_INPUT_FORMATS <NEW_LINE> super().__init__(input_date_formats=input_date_formats, input_time_... | Split date and time input fields which use non-US date and time input formats by default. | 6259906c167d2b6e312b819d |
class TradeEnv(object): <NEW_LINE> <INDENT> defaults = { 'debug': 0, 'detail': 0, 'quiet': 0, 'dataDir': './data', } <NEW_LINE> def __init__(self, properties=None, **kwargs): <NEW_LINE> <INDENT> properties = properties or dict() <NEW_LINE> self.__dict__.update(self.defaults) <NEW_LINE> if properties: <NEW_LINE> <INDENT... | Container for a TradeDangerous "environment", which is a
collection of operational parameters.
To print debug lines, use DEBUG<N>, e.g. DEBUG0, which
takes a format() string and parameters, e.g.
DEBUG1("hello, {world}{}", "!", world="world")
is equivalent to:
if tdenv.debug >= 1:
print("#hello, {wor... | 6259906c4c3428357761bad2 |
class Genre(models.Model): <NEW_LINE> <INDENT> name = models.CharField( max_length=200, help_text='Enter a book genre (eg. Classic)') <NEW_LINE> def __str__(self): <NEW_LINE> <INDENT> return self.name | Model representing a book genre here. | 6259906c71ff763f4b5e8fc6 |
class AzureFirewallNetworkRuleCollection(SubResource): <NEW_LINE> <INDENT> _validation = { 'etag': {'readonly': True}, 'priority': {'maximum': 65000, 'minimum': 100}, } <NEW_LINE> _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'prio... | Network rule collection resource.
Variables are only populated by the server, and will be ignored when sending a request.
:param id: Resource ID.
:type id: str
:param name: Gets name of the resource that is unique within a resource group. This name can be
used to access the resource.
:type name: str
:ivar etag: Gets... | 6259906c2c8b7c6e89bd5005 |
class UnknownApiError(SpinRewriterApiError): <NEW_LINE> <INDENT> def __str__(self): <NEW_LINE> <INDENT> return (u'Unrecognized API error message received: {}'.format( self.api_error_msg)) | Raised when API call results in an unrecognized error. | 6259906ca219f33f346c8027 |
class Spellcheck(object): <NEW_LINE> <INDENT> sentence_break_regex = re.compile(r'(^|[.:;!?])\s*$') <NEW_LINE> _enchant_checkers = {} <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def _init_checker(self, lang='en_US'): <NEW_LINE> <INDENT> if lang == 'C': <NEW_LINE> <INDENT> lang = 'en_US' ... | The object containing current state of spellchecking used within rpmlint | 6259906cfff4ab517ebcf03a |
class Fixture(object): <NEW_LINE> <INDENT> __metaclass__ = registry.make_registry_metaclass(_FIXTURES) <NEW_LINE> REGISTERED_NAME = "Fixture" <NEW_LINE> def __init__(self, logger, job_num): <NEW_LINE> <INDENT> if not isinstance(logger, logging.Logger): <NEW_LINE> <INDENT> raise TypeError("logger must be a Logger instan... | Base class for all fixtures. | 6259906c76e4537e8c3f0da2 |
class StatsManagerTest(TestCase): <NEW_LINE> <INDENT> def test_parse_stats(self): <NEW_LINE> <INDENT> pm_file_example = pkg_resources.resource_string(__name__, 'pm_file_example.xml') <NEW_LINE> root = ElementTree.fromstring(pm_file_example) <NEW_LINE> mgr = StatsManager() <NEW_LINE> mgr.parse_pm_xml(root) <NEW_LINE> rr... | Tests for eNodeB statistics manager | 6259906ca17c0f6771d5d7b8 |
@dataclass <NEW_LINE> class FontFamily: <NEW_LINE> <INDENT> provider: str <NEW_LINE> name: str | Font family description for the settings | 6259906c091ae35668706453 |
class TestingConfig(Config): <NEW_LINE> <INDENT> TESTING = True <NEW_LINE> SQLALCHEMY_DATABASE_URI = os.environ.get('TEST_DATABASE_URL') or 'sqlite:///' + os.path.join(basedir, 'data-test.sqlite') | Test config | 6259906c097d151d1a2c288f |
class LookupFormatter: <NEW_LINE> <INDENT> def __init__(self, model): <NEW_LINE> <INDENT> self._model = model <NEW_LINE> self._modelInstance = self._model() <NEW_LINE> <DEDENT> def setDisplay(self, itemid): <NEW_LINE> <INDENT> md = self._modelInstance.queryObject().filter(self._model.id == itemid).first() <NEW_LINE> if... | Formatter for displaying user-friendly information about a checkup model | 6259906c3346ee7daa33826e |
class EnumValueChecker(object): <NEW_LINE> <INDENT> def __init__(self, enum_type): <NEW_LINE> <INDENT> self._enum_type = enum_type <NEW_LINE> <DEDENT> def CheckValue(self, proposed_value): <NEW_LINE> <INDENT> if not isinstance(proposed_value, int): <NEW_LINE> <INDENT> message = ('%.1024r has type %s, but expected one o... | Checker used for enum fields. Performs type-check and range check. | 6259906c4428ac0f6e659d53 |
class DepartureAirport(RequestConstructor): <NEW_LINE> <INDENT> def __init__(self, airport_code: str, city: str, terminal: str, gate: str): <NEW_LINE> <INDENT> self.syntax = { 'airport_code': airport_code, 'city': city, 'terminal': terminal, 'gate': gate } | Departure airport.
Args:
airport_code:
Airport code of the departure airport.
city:
Departure city of the flight.
terminal:
Terminal of the departing flight.
gate:
Gate for the departing flight. | 6259906c460517430c432c66 |
class CreatePhoneTokenView(GenericAPIView): <NEW_LINE> <INDENT> serializer_class = CreatePhoneTokenSerializer <NEW_LINE> permission_classes = (AllowAny,) <NEW_LINE> def post(self, request): <NEW_LINE> <INDENT> data = self.serializer_class(data=request.data) <NEW_LINE> data.is_valid(raise_exception=True) <NEW_LINE> phon... | POST: Create a phone_token for a particular phone number. | 6259906c99cbb53fe6832708 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.