code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class FtwPublisherConstraintChecker(object): <NEW_LINE> <INDENT> modify_status_view = 'publisher-modify-status' <NEW_LINE> def is_transition_allowed(self, obj, transition): <NEW_LINE> <INDENT> constraint_checker = queryMultiAdapter( (obj, obj.REQUEST), name=self.modify_status_view) <NEW_LINE> if not constraint_checker:... | Check ftw.publisher.sender constraints.
| 62598f4f56b00c62f0fb1caa |
class LightManager(object): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def debugger(msg, level): <NEW_LINE> <INDENT> levels = {0: "DEBUG", 1: "ERROR", 2: "FATAL"} <NEW_LINE> debugtext = "({}) - [{}] {}".format(datetime.datetime.now().time(), levels[level], msg) <NEW_LINE> print(debugtext) <NEW_LINE> with open("./serv... | Methods for instanciating and managing BLE lightbulbs | 62598f4f507cdc57c63a4191 |
class Part(object): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def _cast(cls, obj): <NEW_LINE> <INDENT> if obj is None: <NEW_LINE> <INDENT> return cls(None) <NEW_LINE> <DEDENT> elif isinstance(obj, cls): <NEW_LINE> <INDENT> return obj <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return cls(ustr(obj)) <NEW_LINE> <DEDE... | Internal base class for all URI component parts.
| 62598f4fff9c53063f519a40 |
class TidalInterpolator(with_metaclass(abc.ABCMeta)): <NEW_LINE> <INDENT> def set_initial_time(self, datetime0): <NEW_LINE> <INDENT> if datetime0.tzinfo: <NEW_LINE> <INDENT> import pytz <NEW_LINE> self.datetime0 = pytz.utc.localize(datetime0) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.datetime0 = datetime0 <NEW... | Abstract base class for tidal interpolators. | 62598f4f925a0f43d25e7425 |
class ConsumedMesh(Mesh): <NEW_LINE> <INDENT> def __init__(self, consuming_instruction, index_in_consuming_instruction): <NEW_LINE> <INDENT> self.__consuming_instruction_and_index = ( consuming_instruction, index_in_consuming_instruction ) <NEW_LINE> self._produced_part = None <NEW_LINE> <DEDENT> def _producing_instruc... | A mesh that is only consumed by an instruction | 62598f4f56b00c62f0fb1cac |
class CommandWorkerForSignature(object): <NEW_LINE> <INDENT> DEVID_LENGTH = 24 <NEW_LINE> def __init__(self, uhost): <NEW_LINE> <INDENT> methods = [ 'encrypt' ] <NEW_LINE> for method in methods: <NEW_LINE> <INDENT> if not (hasattr(uhost, method) and callable(getattr(uhost, method))): <NEW_LINE> <INDENT> raise CommandWo... | for_Signature command worker class | 62598f4fd164cc6175820374 |
class Guesser(object): <NEW_LINE> <INDENT> def __init__(self, grammarlist): <NEW_LINE> <INDENT> self.grammarlist = grammarlist <NEW_LINE> <DEDENT> def __call__(self, data): <NEW_LINE> <INDENT> return [x for x in self.grammarlist if check(x,data)] | Returns every grammar and alphabet definition that matches the input | 62598f4f462c4b4f79dbadf5 |
class SettingsFileHandler(FileSystemEventHandler): <NEW_LINE> <INDENT> def __init__(self, settings_file_path, reload_settings): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.settings_file_path = settings_file_path <NEW_LINE> self.reload_settings = reload_settings <NEW_LINE> <DEDENT> def on_modified(self, event... | Handler for the settings file watchdog. | 62598f4fbf627c535bcb0871 |
class FilterBase(Mapping): <NEW_LINE> <INDENT> def set(self, value): <NEW_LINE> <INDENT> self.value = value | Base Filter Class | 62598f4f711fe17d825dfaf0 |
class UndefinedFields(RelationalError): <NEW_LINE> <INDENT> pass | An undefined field was used in an operation on one or more relations. | 62598f4fff9c53063f519a46 |
class UserCreateForm(UserCreationForm): <NEW_LINE> <INDENT> first_name = forms.CharField(required=True) <NEW_LINE> last_name = forms.CharField(required=True) <NEW_LINE> email = forms.EmailField(required=True) <NEW_LINE> perms_list = [(perm.codename, perm.name) for perm in __general_perms_list__()] <NEW_LINE> perms_list... | Formulario para la creacion de usuarios del sistema. | 62598f4fd164cc6175820378 |
class CommentTone(models.Model): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> unique_together = (('comment_id', 'tone_type'),) <NEW_LINE> <DEDENT> TONE_CHOICES = ( (0, 'anger'), (1, 'disgust'), (2, 'fear'), (3, 'joy'), (4, 'sadness'), ) <NEW_LINE> comment_id = models.ForeignKey(Comment, on_delete=models.CASCADE,... | The score for a particular tone type (joy, anger, etc) on a comment | 62598f4f0a366e3fb87dbdc8 |
class Deck(Base): <NEW_LINE> <INDENT> __tablename__ = "deck" <NEW_LINE> id = Column(String(36), primary_key=True) <NEW_LINE> name = Column(String(256)) <NEW_LINE> expansion = Column(Integer) <NEW_LINE> power_level = Column(Integer) <NEW_LINE> chains = Column(Integer) <NEW_LINE> wins = Column(Integer) <NEW_LINE> losses ... | This represents a deck, including various stats about it from the Master
Vault. This object does not inherently contain a list of cards, however, and
instead builds that list from the DeckCard assoc table. | 62598f4f15fb5d323ce7e125 |
class OrderTestCase(unittest.TestCase): <NEW_LINE> <INDENT> def test_subclass(self): <NEW_LINE> <INDENT> from collective.cart.core.content import Order as BaseOrder <NEW_LINE> from collective.cart.core.interfaces import IOrder as IBaseOrder <NEW_LINE> from collective.cart.core.schema import OrderSchema as BaseOrderSche... | TestCase for content type: collective.cart.core.Order | 62598f4f462c4b4f79dbadfb |
class FunctionalGenerator(torch.nn.Module): <NEW_LINE> <INDENT> def __init__(self, base_net: torch.nn.Module) -> None: <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> sd = base_net.state_dict() <NEW_LINE> num_base_net_params = 0 <NEW_LINE> self.param_shapes = [] <NEW_LINE> for param in sd.values(): <NEW_LINE> <INDENT... | a class for the generator | 62598f4f167d2b6e312b637d |
class CompositeObject(Object): <NEW_LINE> <INDENT> _dtype_cache = {} <NEW_LINE> @classmethod <NEW_LINE> def _generate_unique_dtype(cls, pname, ptype, pfields): <NEW_LINE> <INDENT> dtype = POINTER(type(pname, (ptype,), {'_fields_': pfields})) <NEW_LINE> key = (pname, ptype, tuple(pfields)) <NEW_LINE> return cls._dtype_c... | Represent a pointer object to a composite type (e.g., struct, union),
provided by the outside world. | 62598f4f56b00c62f0fb1cb4 |
class InOutPort(object): <NEW_LINE> <INDENT> def __init__(self, parent, index_x, index_y, get_input_angle=lambda:0., get_output_angle=lambda:0., get_coupling_sqrthz=lambda:0., get_input_cov=None, get_output_losses=lambda:0.): <NEW_LINE> <INDENT> self.input = Field(get_cov=get_input_cov, get_mean_field_angle=get_input_a... | Object encapsulating two fields. | 62598f4fbf627c535bcb0879 |
class Meteors(turtle.Turtle): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> turtle.Turtle.__init__(self) <NEW_LINE> self.vx=0 <NEW_LINE> self.vy=0 <NEW_LINE> self.right(90) <NEW_LINE> self.color('red') <NEW_LINE> self.penup() <NEW_LINE> self.speed(0) <NEW_LINE> self.x=random.uniform(100,900) <NEW_LINE> se... | Purpose: The object that represents meteor in the game
Instance variables: self.vx represents the x velocity
self.vy represents the y velocity
self.x represents the x position
see turtle.Turtle
Methods: self.move() runs the process of meteor move | 62598f4fd164cc617582037e |
class PurePairKL(PureKLBase): <NEW_LINE> <INDENT> def make_loss(self, mean1, var1, mean2, var2): <NEW_LINE> <INDENT> return self._kl_coeff * pairwise_gaussian_kl(mean1, var1, mean2, var2) | Passes tensors of means and variances through unchanged, but adds loss
term based on their KL divergence from one another.
Like PureUnitKL, can set coefficient as needed. | 62598f4f925a0f43d25e7431 |
class Paginator: <NEW_LINE> <INDENT> def __init__(self, embed_colour): <NEW_LINE> <INDENT> self.max_size = 2048 <NEW_LINE> self.embed_colour = embed_colour <NEW_LINE> self._current_page = discord.Embed(colour=self.embed_colour, description='') <NEW_LINE> self._pages = [] <NEW_LINE> <DEDENT> @property <NEW_LINE> def cur... | Paginates help messages
Each page is an individual message embed
Attributes
-----------
max_size: int
The maximum amount of characters allowed in a page | 62598f4feab8aa0e5d30b179 |
class BufferingCommand(Command): <NEW_LINE> <INDENT> pass | Unit test case class for buffering command.
| 62598f4f5166f23b2e2427df |
class BaseRealtimeDatastoreClassForContinuousComputations( base_models.BaseModel): <NEW_LINE> <INDENT> realtime_layer = ndb.IntegerProperty(required=True, choices=[0, 1]) <NEW_LINE> @classmethod <NEW_LINE> def get_realtime_id(cls, layer_index, raw_entity_id): <NEW_LINE> <INDENT> return '%s:%s' % (layer_index, raw_entit... | Storage class for entities in the realtime layer.
Instances of this class represent individual entities that are stored in
the realtime datastore. Note that the realtime datastore may be formatted
differently from the datastores that are iterated over by the MapReduce
job.
The IDs for instances of this class are of t... | 62598f4f925a0f43d25e7433 |
class GameData: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.__settings = {"mode": ["beginner", "normal", "advanced"], "time": ["yes", "no"], "flags": ["yes", "no"]} <NEW_LINE> self.__mode = {"beginner": {"mines": 10, "grid": [9, 9]}, "normal": {"mines": 40, "grid": [16, 16]}, "advanced": {"mines": ... | Handling all the settings in the game | 62598f4f21a7993f00c65378 |
class HistoryViewer(EventHandler): <NEW_LINE> <INDENT> def __init__(self, engine): <NEW_LINE> <INDENT> super().__init__(engine) <NEW_LINE> self.log_length = len(engine.message_log.messages) <NEW_LINE> self.cursor = self.log_length - 1 <NEW_LINE> <DEDENT> def on_render(self, console): <NEW_LINE> <INDENT> super().on_rend... | Print message history in a larger window which can be navigated | 62598f4f507cdc57c63a41a1 |
class KrakenClient(ExchangeWebsocket): <NEW_LINE> <INDENT> def __init__(self, endpoint): <NEW_LINE> <INDENT> super().__init__(WSS, 'kraken', endpoint) <NEW_LINE> <DEDENT> def subscribe(self): <NEW_LINE> <INDENT> subscription = ws.Message.create( event='subscribe', subscription = {'name': self.endpoint}, pair = [format_... | Kraken Client Websocket | 62598f4f15fb5d323ce7e12d |
class AgentTaxPayment(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.AnchorId = None <NEW_LINE> self.AnchorName = None <NEW_LINE> self.AnchorIDCard = None <NEW_LINE> self.StartTime = None <NEW_LINE> self.EndTime = None <NEW_LINE> self.Amount = None <NEW_LINE> self.Tax = None <NEW_LINE>... | 代理商完税证明
| 62598f4f462c4b4f79dbae03 |
class IntegerField(Field): <NEW_LINE> <INDENT> def __init__(self, name): <NEW_LINE> <INDENT> super(IntegerField, self).__init__(name, 'bigint') | docstring for Inter | 62598f5015fb5d323ce7e12f |
class TestInventorySnapshot(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 testInventorySnapshot(self): <NEW_LINE> <INDENT> pass | InventorySnapshot unit test stubs | 62598f5056b00c62f0fb1cbe |
class FAQTagsSyntaxTests(unittest.TestCase): <NEW_LINE> <INDENT> def compile(self, tagfunc, token_contents): <NEW_LINE> <INDENT> t = template.Token(template.TOKEN_BLOCK, token_contents) <NEW_LINE> return tagfunc(None, t) <NEW_LINE> <DEDENT> def test_faqs_for_topic_compile(self): <NEW_LINE> <INDENT> t = self.compile(faq... | Tests for the syntax/compliation functions.
These are broken out here so that they don't have to be
django.test.TestCases, which are slower. | 62598f50507cdc57c63a41a5 |
class Function(PackResource): <NEW_LINE> <INDENT> def __init__( self, path: str, link: Union[Callable, str], is_init: bool, is_loop: bool, parent_pack: DataPack, ): <NEW_LINE> <INDENT> self.path = path <NEW_LINE> self.link = link <NEW_LINE> self.is_init = is_init <NEW_LINE> self.is_loop = is_loop <NEW_LINE> self.parent... | Function - A data pack function. Do not create manually. Instead, use the ``DataPack.function`` method.
Args:
path (str): The path of the function. Given as ``namespace:path/to/file``, or ``path/to/file``. If no namespace is specified, then the snake case format of the data pack name will be used.
link (Union[... | 62598f50925a0f43d25e7439 |
class oTree(object): <NEW_LINE> <INDENT> def __init__(self, path, middleware="auto", **kwargs): <NEW_LINE> <INDENT> if middleware is "auto": <NEW_LINE> <INDENT> middleware = "remote" if is_url(path) else "local" <NEW_LINE> <DEDENT> self._path = os.path.abspath(path) if middleware == "local" else path <NEW_LINE> self._m... | Connection to an oTree deployment.
This class are in charge to retrieve the data from some oTree database
without change the local environment
Parameters
----------
path : string
The path where the settings.py of the deployment are located
or the URL where oTree are running.
middleware : string
can be: ... | 62598f50796e427e5384db9b |
class PPGetConversationInfoHandler(BaseHandler): <NEW_LINE> <INDENT> def _get(self): <NEW_LINE> <INDENT> _redis = self.application.redis <NEW_LINE> _conv = redis_hash_to_dict(_redis, ConversationInfo, self._conv_uuid) <NEW_LINE> if _conv == None: <NEW_LINE> <INDENT> logging.error("no such conversation: %s" % self._conv... | every user has own conversation data related the conversation
the conversation_name conversation_icon is different for every user
even the user name (alias in conversation) | 62598f5021a7993f00c6537e |
class IceCreamStand(New_r): <NEW_LINE> <INDENT> def __init__(self, restaurant_name, cuisine_type): <NEW_LINE> <INDENT> super().__init__(restaurant_name, cuisine_type) <NEW_LINE> self.ice_flavors = 'qwerty flavored ice cream' <NEW_LINE> <DEDENT> def describe_flavors(self): <NEW_LINE> <INDENT> print("We have " + self.ice... | Выводин информацию о стенде с мороженным | 62598f5015fb5d323ce7e133 |
class ProcessorJob(Base): <NEW_LINE> <INDENT> def __init__( self, id=None, pipeline_applied=None, num_retries=None, retried=None, worker_id=None, ram_amount=None, volume_index=None, worker_version=None, failure_reason=None, batch_job_id=None, batch_job_queue=None, success=None, original_files=[], datasets=None, start_t... | Processor Job.
Retrieve a ProcessorJob by id
>>> import pyrefinebio
>>> id = 1
>>> job = pyrefinebio.ProcessorJob.get(id)
Retrieve a list of ProcessorJobs based on filters
>>> import pyrefinebio
>>> jobs = pyrefinebio.ProcessorJob.search(num_retries=1) | 62598f50eab8aa0e5d30b180 |
class LinkToObjectMixin(object): <NEW_LINE> <INDENT> def link_to_object(self,obj): <NEW_LINE> <INDENT> item = obj.object <NEW_LINE> return u'<a href="../../%s/%s/%s/" title="Access in admin">%s</a>' % ( item.__class__._meta.app_label, item.__class__._meta.module_name, item.id, item) <N... | This Mixin add a column with a link to the object associated with the geom
(point, line, polygon) | 62598f50167d2b6e312b638b |
class MyMplCanvas(FigureCanvas): <NEW_LINE> <INDENT> def __init__(self, parent=None, step=None): <NEW_LINE> <INDENT> self.fig = Figure() <NEW_LINE> self.ax1 = self.fig.add_subplot(1,3,1) <NEW_LINE> self.ax2 = self.fig.add_subplot(1,3,2) <NEW_LINE> self.ax3 = self.fig.add_subplot(1,3,3) <NEW_LINE> if step is not None: <... | Ultimately, this is a QWidget (as well as a FigureCanvasAgg, etc.). | 62598f5015fb5d323ce7e135 |
class LayersList(GListCtrl, listmix.TextEditMixin): <NEW_LINE> <INDENT> def __init__(self, parent, columns, log=None): <NEW_LINE> <INDENT> GListCtrl.__init__(self, parent) <NEW_LINE> self.log = log <NEW_LINE> listmix.TextEditMixin.__init__(self) <NEW_LINE> for i in range(len(columns)): <NEW_LINE> <INDENT> self.InsertCo... | List of layers to be imported (dxf, shp...) | 62598f505166f23b2e2427e9 |
class IsSuperUserOrReadOnly(BasePermission): <NEW_LINE> <INDENT> def has_permission(self, request, view): <NEW_LINE> <INDENT> SAFE_METHODS = ['GET', 'HEAD', 'OPTIONS'] <NEW_LINE> if (request.method in SAFE_METHODS or (request.user and request.user.is_superuser)): <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> retu... | The request is authenticated as admin, or is a read-only request. | 62598f5021a7993f00c65382 |
class PlaceSet(UniqueRepresentation, Parent): <NEW_LINE> <INDENT> Element = FunctionFieldPlace <NEW_LINE> def __init__(self, field): <NEW_LINE> <INDENT> self.Element = field._place_class <NEW_LINE> Parent.__init__(self, category = Sets().Infinite()) <NEW_LINE> self._field = field <NEW_LINE> <DEDENT> def _repr_(self): <... | Sets of Places of function fields.
INPUT:
- ``field`` -- function field
EXAMPLES::
sage: K.<x> = FunctionField(GF(2)); _.<Y> = K[]
sage: L.<y> = K.extension(Y^3 + x^3*Y + x)
sage: L.place_set()
Set of places of Function field in y defined by y^3 + x^3*y + x | 62598f50ff9c53063f519a5a |
class EvalPlanLoopJoin(EvalPlan): <NEW_LINE> <INDENT> def __init__(self, outer, inner, using): <NEW_LINE> <INDENT> self.outer = outer <NEW_LINE> self.inner = inner <NEW_LINE> self.using = using <NEW_LINE> <DEDENT> def pipeline(self): <NEW_LINE> <INDENT> def helper(): <NEW_LINE> <INDENT> ot, ohs = self.outer.pipeline() ... | Evaluation plan to do a loop join. | 62598f50eab8aa0e5d30b185 |
class AuthGroup(Base): <NEW_LINE> <INDENT> __tablename__ = 'auth_groups' <NEW_LINE> group_id = Column(Integer, autoincrement=True, primary_key=True) <NEW_LINE> group_name = Column(Unicode(16), unique=True) <NEW_LINE> users = relation('AuthUser', secondary=user_group_table, backref='groups') | An ultra-simple group definition. | 62598f50462c4b4f79dbae0d |
class ServerStartupFuseMount(hook.Hook): <NEW_LINE> <INDENT> __regid__ = "rqldownload.startup_fuse_mount_hook" <NEW_LINE> events = ("server_startup",) <NEW_LINE> def __call__(self): <NEW_LINE> <INDENT> use_fuse = self.repo.vreg.config["start_user_fuse"] <NEW_LINE> if use_fuse: <NEW_LINE> <INDENT> with self.repo.interna... | On startup, generate all the fuse mount point associated with CWSearch
owners. | 62598f50bf627c535bcb0889 |
class SomeGraph: <NEW_LINE> <INDENT> def __init__( self, array_of_datetimes: typing.List[datetime.datetime]) -> None: <NEW_LINE> <INDENT> self.array_of_datetimes = array_of_datetimes | defines some object graph. | 62598f50796e427e5384dba1 |
class RandomTreeGraphs(object): <NEW_LINE> <INDENT> def __init__(self, variables, params, tree_num): <NEW_LINE> <INDENT> self.variables = variables <NEW_LINE> self.params = params <NEW_LINE> self.tree_num = tree_num <NEW_LINE> <DEDENT> def training_graph(self, input_data, input_labels, random_seed, data_spec, sparse_fe... | Builds TF graphs for random tree training and inference. | 62598f50167d2b6e312b638f |
class PointSkyRegion(SkyRegion): <NEW_LINE> <INDENT> def __init__(self, center, meta=None, visual=None): <NEW_LINE> <INDENT> self.center = center <NEW_LINE> self.meta = meta or {} <NEW_LINE> self.visual = visual or {} <NEW_LINE> <DEDENT> def __repr__(self): <NEW_LINE> <INDENT> data = dict( name=self.__class__.__name__,... | A pixel region in sky coordinates.
Parameters
----------
center : `~astropy.coordinates.SkyCoord`
The position of the point | 62598f50507cdc57c63a41ad |
class NumpyNDArrayHandlerBinary(NumpyNDArrayHandler): <NEW_LINE> <INDENT> def __init__(self, size_treshold=16, compression=zlib): <NEW_LINE> <INDENT> self.size_treshold = size_treshold <NEW_LINE> self.compression = compression <NEW_LINE> <DEDENT> def flatten_byteorder(self, obj, data): <NEW_LINE> <INDENT> byteorder = o... | stores arrays with size greater than 'size_treshold' as (optionally) compressed base64
Notes
-----
This would be easier to implement using np.save/np.load, but that would be less language-agnostic | 62598f50925a0f43d25e7441 |
class NoSuchUser(Fault): <NEW_LINE> <INDENT> pass | raised if no such user exists | 62598f5021a7993f00c65386 |
class get_remittance_approval_list_result: <NEW_LINE> <INDENT> thrift_spec = ( (0, TType.STRUCT, 'success', (RemittanceApprovalRet, RemittanceApprovalRet.thrift_spec), None, ), (1, TType.STRUCT, 'e', (ServerException, ServerException.thrift_spec), None, ), ) <NEW_LINE> def __init__(self, success=None, e=None,): <NEW_LI... | Attributes:
- success
- e | 62598f50d164cc617582038f |
@ddt.ddt <NEW_LINE> class APIWithIDsTestCase: <NEW_LINE> <INDENT> endpoint = 'endpoint' <NEW_LINE> id_field = 'id' <NEW_LINE> other_params = frozenset() <NEW_LINE> def setUp(self): <NEW_LINE> <INDENT> super().setUp() <NEW_LINE> self.base_uri = self.get_api_url(f'{self.endpoint}/') <NEW_LINE> self.client_class = getattr... | Base class for tests for API endpoints that take lists of IDs. | 62598f50796e427e5384dba5 |
class CustomScript(models.Model): <NEW_LINE> <INDENT> name = models.CharField('名称', max_length=50) <NEW_LINE> description = models.CharField('描述', max_length=100, null=True, blank=True) <NEW_LINE> script = models.FileField('自定义脚本', upload_to=upload_notice_script, null=True, blank=True) <NEW_LINE> type = models.IntegerF... | 自定义循环脚本 | 62598f50d164cc6175820391 |
class SideBarMixin: <NEW_LINE> <INDENT> def get_context_data(self, *args, **kwargs): <NEW_LINE> <INDENT> context = super().get_context_data(*args, **kwargs) <NEW_LINE> attributes = ['_price', '_day_change', '_percent_change'] <NEW_LINE> ticker = self.kwargs.get('ticker') <NEW_LINE> for attribute in attributes: <NEW_LIN... | Class is responsible for adding data to sidebar. Subclass needs
to have self.kwargs['ticker']. Cache is used to get prices. | 62598f50462c4b4f79dbae13 |
class MappedTraitListObject(TraitListObject): <NEW_LINE> <INDENT> __emulates__ = list <NEW_LINE> def __init__(self, *args, **kwds): <NEW_LINE> <INDENT> if not args and not kwds: <NEW_LINE> <INDENT> args = (DBList(), HAS_TRAITS_SENTINEL, '__fake', []) <NEW_LINE> <DEDENT> TraitListObject.__init__(self, *args, **kwds) | TraitListObject decorated for SQLAlchemy relations.
| 62598f50462c4b4f79dbae17 |
class CreditCard: <NEW_LINE> <INDENT> def __init__(self, customer, bank, acnt, limit): <NEW_LINE> <INDENT> self._customer = customer <NEW_LINE> self._bank = bank <NEW_LINE> self._account = acnt <NEW_LINE> self._limit = limit <NEW_LINE> self._balance = 0 <NEW_LINE> <DEDENT> def get_customer(self): <NEW_LINE> <INDENT> re... | A consumer credit card. | 62598f50eab8aa0e5d30b18f |
class DebugPanel(object): <NEW_LINE> <INDENT> has_content = False <NEW_LINE> context = {} <NEW_LINE> def __init__(self, toolbar, context={}): <NEW_LINE> <INDENT> self.toolbar = toolbar <NEW_LINE> self.context.update(context) <NEW_LINE> self.slug = slugify(self.name) <NEW_LINE> <DEDENT> def content(self): <NEW_LINE> <IN... | Base class for debug panels. | 62598f5056b00c62f0fb1cd0 |
class RubyCheckBase(CheckBase): <NEW_LINE> <INDENT> def __init__(self, base): <NEW_LINE> <INDENT> CheckBase.__init__(self, base, __file__) | Base class for all general Ruby checks. | 62598f50bf627c535bcb0896 |
class LogfileListView(QtWidgets.QTreeView): <NEW_LINE> <INDENT> def __init__(self, parent = None): <NEW_LINE> <INDENT> super(LogfileListView, self).__init__(parent) <NEW_LINE> self.setAcceptDrops(True) <NEW_LINE> self.setDragEnabled(True) <NEW_LINE> self.setDragDropMode(QtWidgets.QAbstractItemView.InternalMove) <NEW_LI... | List view for LogfileListView | 62598f505166f23b2e2427f7 |
class DorefaDenseLayer(Layer): <NEW_LINE> <INDENT> @deprecated_alias(layer='prev_layer', end_support_version=1.9) <NEW_LINE> def __init__( self, prev_layer, bitW=1, bitA=3, n_units=100, act=None, use_gemm=False, W_init=tf.truncated_normal_initializer(stddev=0.1), b_init=tf.constant_initializer(value=0.0), W_init_args=N... | The :class:`DorefaDenseLayer` class is a binary fully connected layer, which weights are 'bitW' bits and the output of the previous layer
are 'bitA' bits while inferencing.
Note that, the bias vector would not be binarized.
Parameters
----------
prev_layer : :class:`Layer`
Previous layer.
bitW : int
The bits ... | 62598f50796e427e5384dbad |
class SubredditTopBar(Templated): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> Templated.__init__(self) <NEW_LINE> self.my_reddits = Subreddit.user_subreddits(c.user, ids = False) <NEW_LINE> p_srs = Subreddit.default_subreddits(ids = False, limit = Subreddit.sr_limit) <NEW_LINE> self.pop_reddits = [ sr f... | The horizontal strip at the top of most pages for navigating
user-created reddits. | 62598f5021a7993f00c65390 |
class Chromecast(object): <NEW_LINE> <INDENT> def __init__(self, host): <NEW_LINE> <INDENT> self.logger = logging.getLogger(__name__) <NEW_LINE> self.host = host <NEW_LINE> self.logger.info("Querying device status") <NEW_LINE> self.device = get_device_status(self.host) <NEW_LINE> if not self.device: <NEW_LINE> <INDENT>... | Class to interface with a ChromeCast. | 62598f5015fb5d323ce7e145 |
class ValueTableItem(QTableWidgetItem, ValueColorItem): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> QTableWidgetItem.__init__(self, self.UserType) <NEW_LINE> self.setFlags(self.flags() & ~Qt.ItemIsEditable) <NEW_LINE> self.value = None <NEW_LINE> <DEDENT> def setValue(self, value): <NEW_LINE> <INDENT> t... | Table item that changes colors based on value changes.
| 62598f50507cdc57c63a41b9 |
class SchemaValidationError(QiskitError): <NEW_LINE> <INDENT> pass | Represents an error during JSON Schema validation. | 62598f505166f23b2e2427f9 |
class Settings(): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.screen_width = 1200 <NEW_LINE> self.screen_height = 800 <NEW_LINE> self.bg_color = (230,230,230) <NEW_LINE> self.ship_speed_factor = 1 <NEW_LINE> self.ship_limit = 3 <NEW_LINE> self.bullet_speed_factor = 3 <NEW_LINE> self.bullet_width = ... | 存储所有设置的类 | 62598f50711fe17d825dfb14 |
class MEGNetReadout(chainer.Chain): <NEW_LINE> <INDENT> def __init__(self, out_dim=32, in_channels=32, n_layers=1, processing_steps=3, dropout_ratio=-1, activation=megnet_softplus): <NEW_LINE> <INDENT> super(MEGNetReadout, self).__init__() <NEW_LINE> if processing_steps <= 0: <NEW_LINE> <INDENT> raise ValueError("[ERRO... | MEGNet submodule for readout part.
Args:
out_dim (int): dimension of output feature vector
in_channels (int): dimension of feature vector associated to
each node. Must not be `None`.
n_layers (int): number of LSTM layers for set2set
processing_steps (int): number of processing for set2set
d... | 62598f5056b00c62f0fb1cd4 |
class ResourceFilterViewMixin(NamespaceResourceViewMixin, SmartFilterViewMixin): <NEW_LINE> <INDENT> pass | Smart filter mixin that Restrict the objects worked upon to the set belonging
to all the domains (namespaces) the currently logged in owner is subscribed to. | 62598f50462c4b4f79dbae1d |
class RecognizeTableOCRRequest(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.ImageBase64 = None <NEW_LINE> self.ImageUrl = None <NEW_LINE> self.IsPdf = None <NEW_LINE> self.PdfPageNumber = None <NEW_LINE> self.TableLanguage = None <NEW_LINE> <DEDENT> def _deserialize(self, params): <N... | RecognizeTableOCR请求参数结构体
| 62598f505166f23b2e2427fb |
class ArgumentAndOptionPrinter(cmd2.Cmd): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> shortcuts = dict(cmd2.DEFAULT_SHORTCUTS) <NEW_LINE> shortcuts.update({'$': 'aprint', '%': 'oprint'}) <NEW_LINE> super().__init__(shortcuts=shortcuts) <NEW_LINE> <DEDENT> def do_aprint(self, statement): <NEW_LINE> <INDE... | Example cmd2 application where we create commands that just print the arguments they are called with. | 62598f50bf627c535bcb089a |
class Input(object): <NEW_LINE> <INDENT> def __init__(self, trial_obj, n_units, value, start_ms, duration_ms): <NEW_LINE> <INDENT> self.n_units = n_units <NEW_LINE> self.value = value <NEW_LINE> self.start_ms = start_ms <NEW_LINE> self.duration_ms = duration_ms <NEW_LINE> startpulse_idx = int(np.round(start_ms / trial_... | an input to a network | 62598f50507cdc57c63a41bd |
class PrivateIngredientsApiTests(TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.client = APIClient() <NEW_LINE> self.user = sample_user() <NEW_LINE> self.client.force_authenticate(self.user) <NEW_LINE> <DEDENT> def test_retrieve_ingredients_list(self): <NEW_LINE> <INDENT> Ingredient.objects.cr... | Testing the privately avaialable end points that require a login | 62598f5021a7993f00c65396 |
class KalmanBoxTracker(object): <NEW_LINE> <INDENT> classesCounters={"person":1,"car":1,"motorbike":1,"bus":1,"traffic light":1,"stop sign":1} <NEW_LINE> def __init__(self,bbox,classlabel): <NEW_LINE> <INDENT> self.kf = KalmanFilter(dim_x=7, dim_z=4) <NEW_LINE> self.kf.F = np.array([[1,0,0,0,1,0,0],[0,1,0,0,0,1,0],[0,0... | This class represents the internel state of individual tracked objects observed as bbox. | 62598f5015fb5d323ce7e14d |
class Category: <NEW_LINE> <INDENT> def __init__(self, name, user_id=None, id=None): <NEW_LINE> <INDENT> self.id = id <NEW_LINE> self.name = name <NEW_LINE> self.user_id = user_id | Task's category | 62598f500a366e3fb87dbdf0 |
class SignUp(Handler): <NEW_LINE> <INDENT> def get(self): <NEW_LINE> <INDENT> self.render("sign_up.html") <NEW_LINE> <DEDENT> def post(self): <NEW_LINE> <INDENT> have_error = False <NEW_LINE> username = self.request.get("username") <NEW_LINE> password = self.request.get("password") <NEW_LINE> m_password = self.request.... | class that handle for user registration
function :
get()
post() | 62598f50167d2b6e312b63a5 |
class Actor(Entity): <NEW_LINE> <INDENT> obstructs = True <NEW_LINE> def __init__(self, pos, team): <NEW_LINE> <INDENT> self.team = team <NEW_LINE> self.tasks = [] <NEW_LINE> self.bias_flip = team_bias_flips[team] <NEW_LINE> self.bias_angle = team_bias_angles[team] <NEW_LINE> self.ai = None <NEW_LINE> self.dead = False... | An Actor is an Entity that has a team and maybe an ai, can receive hits, and might submit Tasks. | 62598f51925a0f43d25e7458 |
class SketchListResource(ResourceMixin, Resource): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(SketchListResource, self).__init__() <NEW_LINE> self.parser = reqparse.RequestParser() <NEW_LINE> self.parser.add_argument(u'name', type=unicode, required=True) <NEW_LINE> self.parser.add_argument(u'desc... | Resource for listing sketches. | 62598f5115fb5d323ce7e151 |
class PushSerializer(ModelSerializer): <NEW_LINE> <INDENT> app = serializers.SlugRelatedField(slug_field='id', queryset=models.App.objects.all()) <NEW_LINE> owner = serializers.ReadOnlyField(source='owner.username') <NEW_LINE> created = serializers.DateTimeField(format=settings.DEIS_DATETIME_FORMAT, read_only=True) <NE... | Serialize a :class:`~api.models.Push` model. | 62598f510a366e3fb87dbdf4 |
@dataclass(frozen=True) <NEW_LINE> class ManifestEntry(object): <NEW_LINE> <INDENT> fileId: str <NEW_LINE> fileName: str <NEW_LINE> md5sum: str <NEW_LINE> @classmethod <NEW_LINE> def create_manifest_entry(cls, input_dir, data): <NEW_LINE> <INDENT> d = data.__dict__ <NEW_LINE> file_id = get_required_field(d, 'objectId')... | Represents a line in the manifest file pertaining to a file.
The string representation of this object is the TSV of the 3 field values
:param str fileId: ObjectId of the file
:param str fileName: name of the file. Should not include directories
:param str md5sum: MD5 checksum of the file | 62598f51eab8aa0e5d30b19f |
class SpecPosttransParser(SpecSectionParser): <NEW_LINE> <INDENT> obj = SpecStPosttrans | Parse %posttrans section | 62598f5156b00c62f0fb1ce0 |
class IFBKMembraneUser(IPersonMembraneUser): <NEW_LINE> <INDENT> pass | Marker/Form interface for FBK Membrane User | 62598f5121a7993f00c6539e |
class AccountInfo: <NEW_LINE> <INDENT> valid: bool = True <NEW_LINE> username: str = "" <NEW_LINE> password_set: bool = True <NEW_LINE> password: str = "" <NEW_LINE> user_lvl: int = 0 <NEW_LINE> rescue_set: bool = False <NEW_LINE> rescue_id: int = 0 <NEW_LINE> pound_set: bool = False <NEW_LINE> pound_id: int = 0 | Describes the information that makes up an account.
Used for creating new accounts, as well as validating
edits to existing accounts. | 62598f515166f23b2e242805 |
class ResetDeviceRequest(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.ProductId = None <NEW_LINE> self.DeviceName = None <NEW_LINE> <DEDENT> def _deserialize(self, params): <NEW_LINE> <INDENT> self.ProductId = params.get("ProductId") <NEW_LINE> self.DeviceName = params.get("DeviceNam... | ResetDevice请求参数结构体
| 62598f51925a0f43d25e745c |
class Command(BaseCommand): <NEW_LINE> <INDENT> def add_arguments(self, parser): <NEW_LINE> <INDENT> parser.add_argument( '--dry_run', action='store_true', help='Print proposed changes, but take no action.' ) <NEW_LINE> <DEDENT> def handle(self, *args, **options): <NEW_LINE> <INDENT> dry_run = options['dry_run'] <NEW_L... | Implementation of the bulk_rehash_retired_usernames command. | 62598f51711fe17d825dfb22 |
class TableInfo: <NEW_LINE> <INDENT> def __init__(self, table_name=None, schema_name=None, database_name=None): <NEW_LINE> <INDENT> self._table_name = table_name <NEW_LINE> self._schema_name = schema_name <NEW_LINE> self._database_name = database_name <NEW_LINE> <DEDENT> @property <NEW_LINE> def table_name(self): <NEW_... | stores all the table info, inspired from postgres | 62598f5156b00c62f0fb1ce4 |
class Puzzle05(Puzzle): <NEW_LINE> <INDENT> def algorithm(self, func): <NEW_LINE> <INDENT> jump_table = [int(line) for line in self.data.splitlines()] <NEW_LINE> index = 0 <NEW_LINE> for n in count(): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> jump_table[index], index = func(jump_table[index]), index + jump_table[ind... | Day 5: A Maze of Twisty Trampolines, All Alike | 62598f51711fe17d825dfb24 |
class SendSignal(AbstractSCPRequest): <NEW_LINE> <INDENT> __slots__ = [] <NEW_LINE> def __init__(self, app_id, signal): <NEW_LINE> <INDENT> if app_id < 0 or app_id > 255: <NEW_LINE> <INDENT> raise SpinnmanInvalidParameterException( "app_id", str(app_id), "Must be between 0 and 255") <NEW_LINE> <DEDENT> super().__init__... | An SCP Request to send a signal to cores
| 62598f51167d2b6e312b63ad |
class PhraseMaker(object): <NEW_LINE> <INDENT> def __init__(self, container=None): <NEW_LINE> <INDENT> self.container = container <NEW_LINE> <DEDENT> def __format__(self, format_specification="") -> str: <NEW_LINE> <INDENT> return abjad.StorageFormatManager(self).get_storage_format() <NEW_LINE> <DEDENT> def make_phrase... | Makes a musical phrase by combining
pitches from a harmony and durations | 62598f5115fb5d323ce7e157 |
class EventsCd(BaseRMPModel): <NEW_LINE> <INDENT> events = CopyFromCharField( source_column='LookupCode', primary_key=True, max_length=1, help_text='Unique identifier of the event type.' ) <NEW_LINE> events_tr = CopyFromCharField( source_column='Description', max_length=40, help_text='Full description of the event type... | Type of event. | 62598f515166f23b2e242809 |
class EmptyExifHeaderError(GeoSpiderError): <NEW_LINE> <INDENT> pass | Empty exif header error. | 62598f51ff9c53063f519a7a |
class Diamond(Marker): <NEW_LINE> <INDENT> __example__ = "examples/reference/models/Diamond.py" | Render diamond markers. | 62598f51711fe17d825dfb26 |
class HueLightSensor(object): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def is_applicable(cls, data): <NEW_LINE> <INDENT> return (data['manufacturername'] == 'Philips') and (data['type'] == 'ZLLLightLevel') <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> def values(cls): <NEW_LINE> <INDENT> return [ 'lightlevel... | Light level sensor, e.g. in the Hue motion sensor.
Also provides `dark` and `daylight` properties,
which are defined as follows:
* `dark`: `lightlevel` < `tholddark`
* `daylight`: `lightlevel` > `tholddark` + `tholdoffset`
The values for `tholddark` and `tholdoffset` can be changed. | 62598f51796e427e5384dbc1 |
@unittest.skipIf(ImageProcessing.check_cam() is None, "There is no camera detected.") <NEW_LINE> class TestCamera(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.c = ImageProcessing(saved=here) <NEW_LINE> <DEDENT> def test_capture(self): <NEW_LINE> <INDENT> self.c.image_capture(period=... | Camera Test class.
| 62598f51ff9c53063f519a7c |
class VaultSecretGroup(Model): <NEW_LINE> <INDENT> _attribute_map = { 'source_vault': {'key': 'sourceVault', 'type': 'SubResource'}, 'vault_certificates': {'key': 'vaultCertificates', 'type': '[VaultCertificate]'}, } <NEW_LINE> def __init__(self, source_vault=None, vault_certificates=None): <NEW_LINE> <INDENT> self.sou... | Describes a set of certificates which are all in the same Key Vault.
:param source_vault: The Relative URL of the Key Vault containing all of
the certificates in VaultCertificates.
:type source_vault: :class:`SubResource
<azure.mgmt.compute.v2015_06_15.models.SubResource>`
:param vault_certificates: The list of key ... | 62598f51925a0f43d25e7462 |
class UpdateDevice: <NEW_LINE> <INDENT> sensitive_list = [] <NEW_LINE> openapi_types = { 'device_name': 'str', 'description': 'str', 'extension_info': 'object', 'auth_info': 'AuthInfoWithoutSecret' } <NEW_LINE> attribute_map = { 'device_name': 'device_name', 'description': 'description', 'extension_info': 'extension_in... | Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition. | 62598f51711fe17d825dfb28 |
class TunedModel(Model): <NEW_LINE> <INDENT> def __init__(self, param_grid, **kwargs): <NEW_LINE> <INDENT> Model.__init__(self, **kwargs) <NEW_LINE> self.param_grid = param_grid <NEW_LINE> <DEDENT> def train(self, X, y, scorer, cv_folds=5): <NEW_LINE> <INDENT> if not self.pipeline: <NEW_LINE> <INDENT> grid_search = Gri... | A class used to optimize the hyperparameters for a machine learning algorithm
Parameters
----------
name : string
The name of a model
param_grid : dict
A dict of (parameter, values) pairs to optimize
pipeline : object
A pipeline to apply to the data before fitting the model | 62598f51711fe17d825dfb2a |
class SignatureApi(Resource): <NEW_LINE> <INDENT> def get(self, solar_system_id): <NEW_LINE> <INDENT> args = parser.parse_args() <NEW_LINE> filters = {'solar_system_id': solar_system_id, 'code': args.code, 'type': args.type, 'name': args.name} <NEW_LINE> try: <NEW_LINE> <INDENT> signatures_as_list = Signature.query.fil... | api for list of signatures in solar system
| 62598f5121a7993f00c653a8 |
class guid(TypeDecorator): <NEW_LINE> <INDENT> impl = CHAR <NEW_LINE> def load_dialect_impl(self, dialect): <NEW_LINE> <INDENT> if dialect.name == 'postgresql': <NEW_LINE> <INDENT> return dialect.type_descriptor(UUID()) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return dialect.type_descriptor(CHAR(32)) <NEW_LINE> <D... | Platform-independent GUID type.
Uses Postgresql's UUID type, otherwise uses
CHAR(32), storing as stringified hex values. | 62598f51eab8aa0e5d30b1ab |
@pydantic.dataclasses.dataclass( frozen=True, config=type( 'Config', (), dict( arbitrary_types_allowed=True, ), ), ) <NEW_LINE> class RcNoIncluirDetalleEntry(RcRegistroDetalleEntry): <NEW_LINE> <INDENT> RCV_KIND = RcvKind.COMPRAS <NEW_LINE> RC_ESTADO_CONTABLE = RcEstadoContable.NO_INCLUIR | Entry of the "detalle" of an RC ("Registro de Compras") / "no incluir". | 62598f51bf627c535bcb08b0 |
class CustomBuildExt(build_ext, object): <NEW_LINE> <INDENT> def run(self): <NEW_LINE> <INDENT> compile_software() <NEW_LINE> super(CustomBuildExt, self).run() | Custom handler for the 'install' command | 62598f515166f23b2e242811 |
class Settings(): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.screen_width = 1200 <NEW_LINE> self.screen_height = 800 <NEW_LINE> self.bg_color = (230,230,230) <NEW_LINE> self.ship_speed_factor = 1.5 <NEW_LINE> self.bullet_speed_factor = 1 <NEW_LINE> self.bullet_width = 3 <NEW_LINE> self.bullet_heig... | A class to store all settings for Alien invasion. | 62598f51167d2b6e312b63b7 |
class WorkerMqRequest(BaseModel): <NEW_LINE> <INDENT> def __init__(self, document=None): <NEW_LINE> <INDENT> super(WorkerMqRequest, self).__init__(document) <NEW_LINE> <DEDENT> @property <NEW_LINE> def key(self): <NEW_LINE> <INDENT> return self.process_name, self.entry_name <NEW_LINE> <DEDENT> @key.setter <NEW_LINE> de... | Non-persistent model. Instance of this class presents single request from Synergy Scheduler to any worker | 62598f51d18da76e235b6b53 |
class Source(object): <NEW_LINE> <INDENT> def __init__(self, text, delimiters, white_space = (' ', '\n', '\r', '\t')): <NEW_LINE> <INDENT> self.text = text <NEW_LINE> self.delimiters = delimiters <NEW_LINE> self.white_space = white_space <NEW_LINE> self.tokens = [] <NEW_LINE> <DEDENT> def tokenize(self): <NEW_LINE> <IN... | Represents abstract source code | 62598f51925a0f43d25e746a |
class GetPresformsList(Resource): <NEW_LINE> <INDENT> def get(self, arkid, premisid): <NEW_LINE> <INDENT> from flask import current_app <NEW_LINE> try: <NEW_LINE> <INDENT> data = get_data_half_of_object(arkid, premisid, current_app.config["LIVEPREMIS_PATH"]) <NEW_LINE> related_objects = data[1].related_objects <NEW_LIN... | fill_in_please | 62598f51507cdc57c63a41d7 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.