code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class UnigramData(luigi.Task): <NEW_LINE> <INDENT> D = luigi.Parameter() <NEW_LINE> N = luigi.Parameter() <NEW_LINE> V = luigi.Parameter() <NEW_LINE> sigma0 = luigi.Parameter() <NEW_LINE> conf = configuration.get_config() <NEW_LINE> def requires(self): <NEW_LINE> <INDENT> return UnigramParams(self.D, self.V, self.sigma... | Simulate data according to a Unigram model
Arguments:
D (int): How many samples are there in this experiment?
N (int): How many words are there in each sample?
V (int): How many terms are there across samples?
sigma0 (float): What is the true sigma random walk size parameter used in
generating the data? | 62598f02be7bc26dc9251374 |
class HomeType(models.Model): <NEW_LINE> <INDENT> name = models.CharField(u'Наименование', max_length=100) <NEW_LINE> def __unicode__(self): <NEW_LINE> <INDENT> return u'%s' % (self.name, ) <NEW_LINE> <DEDENT> class Meta: <NEW_LINE> <INDENT> verbose_name = u'Тип дома' <NEW_LINE> verbose_name_plural = u'Типы домов' <NEW... | Тип дома
Поля:
name - наименование | 62598f02ad47b63b2c5a6239 |
class NLayerDiscriminator(BaseModel): <NEW_LINE> <INDENT> def __init__(self, input_nc, ndf=64, n_layers=3, norm_type='instance', use_sigmoid=False, use_minibatch_discrimination=False): <NEW_LINE> <INDENT> super(NLayerDiscriminator, self).__init__() <NEW_LINE> self.use_minibatch_discrimination = use_minibatch_discrimina... | Define a PatchGAN discriminator | 62598f025fcc89381b26563b |
class ComboLock: <NEW_LINE> <INDENT> def __init__(self, combo, xplist): <NEW_LINE> <INDENT> self.combo = str(combo) <NEW_LINE> self.setxp = {str(x) for x in xplist} <NEW_LINE> self.setxp.add('000') <NEW_LINE> self.queue = deque([['000']]) <NEW_LINE> self.combolist = [] <NEW_LINE> <DEDENT> def check_xp(self, com_check):... | Class used to represent a three wheel combo lock | 62598f02956e5f7376df4b8c |
class Controller: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> rospy.init_node('control_x80sv') <NEW_LINE> self.left_speed = rospy.Publisher('/x80sv/left_controller/command', Float64) <NEW_LINE> self.right_speed = rospy.Publisher('/x80sv/right_controller/command', Float64) <NEW_LINE> rospy.Subscriber('/c... | Converts linear velocity and angular velocity into wheel velocities | 62598f02a05bb46b38489298 |
class TitleType(Enum): <NEW_LINE> <INDENT> TYPICAL = 'typical' <NEW_LINE> ACADEMIC = 'academic' | Represents title types.
An argument for :meth:`~mimesis.Person.title()`. | 62598f0250812a4eaa6200fc |
class Application(Material): <NEW_LINE> <INDENT> version = models.CharField(_('Application Version'), max_length=64) <NEW_LINE> objects = MaterialManager() <NEW_LINE> class Meta: <NEW_LINE> <INDENT> app_label = 'materials' <NEW_LINE> verbose_name = _('Application') <NEW_LINE> verbose_name_plural = _('A... | Model for Application material. | 62598f0263b5f9789fe83b83 |
class MHSMPrivateEndpointConnection(ManagedHsmResource): <NEW_LINE> <INDENT> _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, 'system_data': {'readonly': True}, } <NEW_LINE> _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 't... | Private endpoint connection resource.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: The Azure Resource Manager resource ID for the managed HSM Pool.
:vartype id: str
:ivar name: The name of the managed HSM Pool.
:vartype name: str
:ivar type: The resource type of th... | 62598f0260cbc95b06362d54 |
class AbstractInvoice(models.Model): <NEW_LINE> <INDENT> legal_entity = models.ForeignKey( 'izi_invoices.LegalEntity', on_delete=models.CASCADE, related_name='invoices', verbose_name=_('Legal Entity')) <NEW_LINE> number = models.CharField( _('Invoice number'), max_length=128) <NEW_LINE> order = models.OneToOneField( 'o... | An Invoice. | 62598f0297e22403b3839908 |
class ToggleButton(wx.ToggleButton): <NEW_LINE> <INDENT> def __init__(self, parent, labelOn, labelOff, bgColorOn = wx.Colour(0, 255, 0)): <NEW_LINE> <INDENT> wx.ToggleButton.__init__(self, parent = parent, label = labelOn, id = wx.ID_ANY) <NEW_LINE> self.labelOn = labelOn <NEW_LINE> self.labelOff = labelOff <NEW_LINE> ... | Extends wx.ToggleButton with active/inactive labels.
| 62598f02a219f33f346c5250 |
class Banner(SmartObject): <NEW_LINE> <INDENT> UPLOAD_TO = 'commarketing/banners' <NEW_LINE> image = MultiImageField(upload_to=UPLOAD_TO, blank=True, null=True, max_size=1920) <NEW_LINE> display = models.CharField(max_length=30, choices=DISPLAY_CHOICES, help_text="How the image is shown on the site. Can be one of " "<s... | Any of banners owner of the site may use as Slide, Popup, etc
to market some products on the site. | 62598f025166f23b2e241e02 |
class TokenHandler: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.get_access_token() <NEW_LINE> <DEDENT> def get_access_token(self): <NEW_LINE> <INDENT> httpServer = HTTPServer(('localhost', 8090), lambda request, address, server: HTTPServerHandler(request, address, server)) <NEW_LINE> httpServer.han... | Class used to handle Facebook oAuth | 62598f02099cdd3c636748e8 |
class Serializer(JSONSerializer): <NEW_LINE> <INDENT> def _init_options(self): <NEW_LINE> <INDENT> super(Serializer, self)._init_options() <NEW_LINE> self.geometry_field = self.json_kwargs.pop('geometry_field', None) <NEW_LINE> self.srid = self.json_kwargs.pop('srid', 4326) <NEW_LINE> if (self.selected_fields is not No... | Convert a queryset to GeoJSON, http://geojson.org/ | 62598f025fcc89381b26563c |
class MetricCounter(msrest.serialization.Model): <NEW_LINE> <INDENT> _validation = { 'name': {'required': True}, } <NEW_LINE> _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'instance': {'key': 'instance', 'type': 'str'}, 'dimension_filter': {'key': 'dimensionFilter', 'type': '[MetricDimension]'}, 'additiona... | The metric counter.
All required parameters must be populated in order to send to Azure.
:param name: Required. The counter name.
:type name: str
:param instance: The instance from which counter should be collected.
:type instance: str
:param dimension_filter: The dimension filter.
:type dimension_filter: list[~azure... | 62598f0226068e7796d4b37e |
class Solution: <NEW_LINE> <INDENT> def uniquePathsWithObstacles(self, obstacleGrid): <NEW_LINE> <INDENT> oc = obstacleGrid <NEW_LINE> for i in range(len(oc)): <NEW_LINE> <INDENT> for j in range(len(oc[0])): <NEW_LINE> <INDENT> if i ==0 and j ==0: <NEW_LINE> <INDENT> oc[i][j] = 1 - oc[i][j] <NEW_LINE> <DEDENT> elif i==... | @param: obstacleGrid: A list of lists of integers
@return: An integer | 62598f0271ff763f4b5e6187 |
class Curse(Cast): <NEW_LINE> <INDENT> def __call__(self, unit_stack: 'BattleUnitsStack', *args, **kwargs) -> None: <NEW_LINE> <INDENT> unit_stack.unit.attack = max( 0, unit_stack.unit.attack - CastsFactors.Curse ) | Decreases attack by 12. | 62598f0250812a4eaa6200fd |
class LogisticRegressionTuner(KFoldTuner): <NEW_LINE> <INDENT> def __init__( self, X: Iterable, y: Iterable, pipeline: Optional[Pipeline], param_space: Optional[dict] = None, opt_algo: Optional[Callable] = None, n_splits: int = 5, scorer: Union[str, Callable] = "roc_auc", seed: int = 42, n_jobs: int = 1): <NEW_LINE> <I... | Special case of KFoldTuner with LogisticRegression and a
default parameter space option.
See KFoldTuner for more information. | 62598f02cc40096d616196eb |
class TagView(View): <NEW_LINE> <INDENT> def get(self, request, tag_id, page_id): <NEW_LINE> <INDENT> t = TagModel.objects.get(id=tag_id) <NEW_LINE> entries = EntryModel.objects.filter(tags=t) <NEW_LINE> paginator = Paginator(entries, 1) <NEW_LINE> try: <NEW_LINE> <INDENT> page_entry = paginator.page(page_id) <NEW_LINE... | 标签 | 62598f02283ffb24f3cf22cf |
class PatchedDatetime(datetime): <NEW_LINE> <INDENT> now = mock.create_autospec(datetime, "now") | A datetime object with a mocked now() function. | 62598f02167d2b6e312b59c0 |
class TransactionsCommandsMixin: <NEW_LINE> <INDENT> def unwatch(self): <NEW_LINE> <INDENT> fut = self._pool_or_conn.execute(b'UNWATCH') <NEW_LINE> return wait_ok(fut) <NEW_LINE> <DEDENT> def watch(self, key, *keys): <NEW_LINE> <INDENT> fut = self._pool_or_conn.execute(b'WATCH', key, *keys) <NEW_LINE> return wait_ok(fu... | Transaction commands mixin.
For commands details see: http://redis.io/commands/#transactions
Transactions HOWTO:
>>> tr = redis.multi_exec()
>>> result_future1 = tr.incr('foo')
>>> result_future2 = tr.incr('bar')
>>> try:
... result = await tr.execute()
... except MultiExecError:
... pass # check what hap... | 62598f024c34283577618d0e |
class JsonBareObjectLexer(JsonLexer): <NEW_LINE> <INDENT> name = 'JSONBareObject' <NEW_LINE> aliases = ['json-object'] <NEW_LINE> filenames = [] <NEW_LINE> mimetypes = ['application/json-object'] <NEW_LINE> tokens = { 'root': [ (r'\}', Error), include('objectvalue'), ], 'objectattribute': [ (r'\}', Error), inherit, ], ... | For JSON data structures (with missing object curly braces).
.. versionadded:: 2.2 | 62598f02ab23a570cc2d427f |
class TNonblockingServer: <NEW_LINE> <INDENT> def __init__(self, processor, lsocket, protocol=None, threads=10): <NEW_LINE> <INDENT> self.processor = processor <NEW_LINE> self.socket = lsocket <NEW_LINE> self.protocol = protocol or TBinaryProtocol.TBinaryProtocolFactory() <NEW_LINE> self.threads = threads <NEW_LINE> se... | Non-blocking server. | 62598f02099cdd3c636748e9 |
class PodmanTestCase(unittest.TestCase): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def setUpClass(cls): <NEW_LINE> <INDENT> if hasattr(PodmanTestCase, 'alpine_process'): <NEW_LINE> <INDENT> PodmanTestCase.tearDownClass() <NEW_LINE> <DEDENT> def run_cmd(*args): <NEW_LINE> <INDENT> cmd = list(itertools.chain(*args)) <N... | Hide the sausage making of initializing storage. | 62598f027c178a314d78bec2 |
class Integer(Numeric): <NEW_LINE> <INDENT> pass | (https://ww2.mathworks.cn/help/matlab/matlab_prog/integers.html) | 62598f02aad79263cf42d235 |
class SeriousFilterFailure(FilterFailure): <NEW_LINE> <INDENT> pass | This exception signals that a Filter didn't pass, and the bad
translation might break an application (so the string will be marked
fuzzy) | 62598f027cff6e4e811b440b |
class _Shim(object): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> super(_Shim, self).__init__(*args, **kwargs) <NEW_LINE> self.gen_rcode = None <NEW_LINE> self.gen_out = None <NEW_LINE> self.get_err = None <NEW_LINE> <DEDENT> def _run_command(self, *args, **kwargs): <NEW_LINE> <INDENT> s... | This shim goes between the Mixin and the Test class and
provides a way to set the output of the test. | 62598f02bf627c535bcafe9b |
class tmp_mount(object): <NEW_LINE> <INDENT> def __init__(self, device, encrypted=False): <NEW_LINE> <INDENT> self.device = device <NEW_LINE> self.path = None <NEW_LINE> self.encrypted = encrypted <NEW_LINE> <DEDENT> def __enter__(self): <NEW_LINE> <INDENT> self.path = tempfile.mkdtemp() <NEW_LINE> process.run([ 'mount... | Temporarily mount a device on a temporary directory,
and unmount it upon exit
When ``encrypted`` is set to ``True``, the exit method will call out to
close the device so that it doesn't remain open after mounting. It is
assumed that it will be open because otherwise it wouldn't be possible to
mount in the first place | 62598f0297e22403b383990c |
class LehuUploader(LehuBase): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(LehuUploader, self).__init__() <NEW_LINE> self.upload_url = urljoin(self.index_url, 'uploadfile.aspx') <NEW_LINE> <DEDENT> def upload_file(self, code, file_path, file_name): <NEW_LINE> <INDENT> tree = self.get_and_post(self.... | Uploader | 62598f0297e22403b383990d |
@log.class_logger <NEW_LINE> @relationships.RelationshipProperty.strategy_for(lazy="noload") <NEW_LINE> @relationships.RelationshipProperty.strategy_for(lazy=None) <NEW_LINE> class NoLoader(AbstractRelationshipLoader): <NEW_LINE> <INDENT> __slots__ = () <NEW_LINE> def init_class_attribute(self, mapper): <NEW_LINE> <IND... | Provide loading behavior for a :class:`.RelationshipProperty`
with "lazy=None". | 62598f02283ffb24f3cf22d2 |
class _CustomCollector(object): <NEW_LINE> <INDENT> def __init__(self, scheme="http", host="localhost", port=8082, path="/api/v1/servers/localhost/statistics", api_key=""): <NEW_LINE> <INDENT> self.scheme = scheme <NEW_LINE> self.host = host <NEW_LINE> self.port = port <NEW_LINE> self.path = path <NEW_LINE> self.api_ke... | A custom collector that fetches PowerDNS metrics | 62598f022c8b7c6e89bd21ea |
class Extended_virtual_interfaces_net(extensions.ExtensionDescriptor): <NEW_LINE> <INDENT> name = "ExtendedVIFNet" <NEW_LINE> alias = "OS-EXT-VIF-NET" <NEW_LINE> namespace = ("http://docs.openstack.org/compute/ext/" "extended-virtual-interfaces-net/api/v1.1") <NEW_LINE> updated = "2013-03-07T00:00:00+00:00" <NEW_LINE> ... | Adds network id parameter to the virtual interface list. | 62598f0231939e2706ed0f75 |
class APITagListView(generics.ListCreateAPIView): <NEW_LINE> <INDENT> mayan_object_permissions = {'GET': (permission_tag_view,)} <NEW_LINE> mayan_view_permissions = {'POST': (permission_tag_create,)} <NEW_LINE> queryset = Tag.objects.all() <NEW_LINE> def get_serializer(self, *args, **kwargs): <NEW_LINE> <INDENT> if not... | get: Returns a list of all the tags.
post: Create a new tag. | 62598f0271ff763f4b5e618b |
class GroupListView(LoginRequiredMixin, ListView): <NEW_LINE> <INDENT> template_name = "accounts/grouplist.html" <NEW_LINE> model = Group <NEW_LINE> paginate_by = 10 <NEW_LINE> ordering = 'id' | 展示用户组列表 | 62598f0263b5f9789fe83b89 |
class ActivatedPassive(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.unused = True <NEW_LINE> <DEDENT> def use(self): <NEW_LINE> <INDENT> if self.unused: <NEW_LINE> <INDENT> self.unused = False <NEW_LINE> <DEDENT> <DEDENT> def reset(self): <NEW_LINE> <INDENT> self.unused = True | Can only be used on the player's turn and only once per turn.
Resets at the beginning of the player's turn | 62598f023317a56b869bda78 |
class SingleBanana(object): <NEW_LINE> <INDENT> def __init__(self, dim, twistdim): <NEW_LINE> <INDENT> assert dim >= 2 <NEW_LINE> assert twistdim < dim - 1 <NEW_LINE> self.dim = dim <NEW_LINE> self.twistdim = twistdim <NEW_LINE> self.sigma1_squared = 100. <NEW_LINE> self.p = 10. <NEW_LINE> self.b = .03 <NEW_LINE> self.... | Creates the log_target as in [WKB09]
:param dim:
integer; the dimension | 62598f0223849d37ff84fae9 |
class Strategy: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> delta_base = 0.0 <NEW_LINE> delta_period = 0.05 <NEW_LINE> @staticmethod <NEW_LINE> def cautious(): <NEW_LINE> <INDENT> Strategy.delta_base += 0.05 <NEW_LINE> <DEDENT> @staticmethod <NEW_LINE> def risky(): <NEW_LINE> <I... | Additional methods adding in choosing the right strategy | 62598f02bf627c535bcafe9d |
class DateRange(object): <NEW_LINE> <INDENT> def __init__(self, **params): <NEW_LINE> <INDENT> self.params = params <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> def hourly(cls, start_hour: int, start_day: int, start_month: int, start_year: int, end_hour: int, end_day: int, end_month: int, end_year: int): <NEW_LINE> <IND... | Builder for date range parameters
See http://statcounter.com/api/docs/v3#date-range | 62598f023346ee7daa336b7a |
class GameMoveHistory(messages.Message): <NEW_LINE> <INDENT> player_name = messages.StringField(1, required=True) <NEW_LINE> x = messages.IntegerField(2, required=True) <NEW_LINE> y = messages.IntegerField(3, required=True) <NEW_LINE> state = messages.StringField(4) | A players move in a game | 62598f024428ac0f6e656f76 |
class MyOrgsListBeforeOrgProfile(MyOrgsList): <NEW_LINE> <INDENT> def _setIdx(self): <NEW_LINE> <INDENT> self.idx = 7 <NEW_LINE> <DEDENT> def _getContext(self): <NEW_LINE> <INDENT> org_list = lists.ListConfigurationResponse( self.data, self._list_config, idx=self.idx, preload_list=False) <NEW_LINE> return { 'name': 'ed... | Component for listing the orgs of the current user, just before
create/edit org's profile. | 62598f022c8b7c6e89bd21ed |
class Controller: <NEW_LINE> <INDENT> exposed = True <NEW_LINE> show_on_homepage = False <NEW_LINE> @staticmethod <NEW_LINE> def GET(**_kwargs: str) -> bytes: <NEW_LINE> <INDENT> modified_timestamp = cherrypy.engine.publish( "ip:db:modified" ).pop() <NEW_LINE> modified_date = cherrypy.engine.publish( "clock:from_timest... | Dispatch application requests based on HTTP verb. | 62598f02f9cc0f698b1c47e3 |
class Passwd(object): <NEW_LINE> <INDENT> def __init__(self, cfg): <NEW_LINE> <INDENT> self.passwd_file = '%s/etc/passwd' % (cfg.get('honeypot', 'contents_path'),) <NEW_LINE> self.load() <NEW_LINE> <DEDENT> def load(self): <NEW_LINE> <INDENT> self.passwd = [] <NEW_LINE> with open(self.passwd_file, 'r') as f: <NEW_LINE>... | This class contains code to handle the users and their properties in
/etc/passwd. Note that contrary to the name, it does not handle any
passwords. | 62598f02be7bc26dc9251378 |
class Latte_count(Executable): <NEW_LINE> <INDENT> r <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> Executable.__init__(self, "count", executable="count", spkg="latte_int", url="https://www.math.ucdavis.edu/~latte/software.php") | Feature for the executable ``count`` from the LattE suite. | 62598f02851cf427c66b6cf3 |
class Solution: <NEW_LINE> <INDENT> def clone(self, p_head): <NEW_LINE> <INDENT> if p_head is None: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> dummy = p_head <NEW_LINE> while dummy: <NEW_LINE> <INDENT> dummy_next = dummy.next <NEW_LINE> copy_node = ComplexListNode(dummy.val) <NEW_LINE> dummy.next = copy_node <NEW_L... | step1: 把复制的节点链接在原始链表的每个对应节点的后面
step2: 把复制节点的random指针指向原节点的random指针指向的节点
step3: 拆分链表,奇数位置为原链表,偶数位置为复制链表,且需注意复制链表中最后一个
节点的指针不能和原链表指向同一个None节点,而需要重新赋值。 | 62598f025fc7496912d47788 |
class ConferenceLocation(models.Model): <NEW_LINE> <INDENT> name = models.CharField(max_length=120) <NEW_LINE> address = models.CharField(max_length=120) <NEW_LINE> city = models.CharField(max_length=120) <NEW_LINE> state = models.CharField(max_length=2, default='AR') <NEW_LINE> zip_code = models... | locations are places where events are held.
| 62598f024527f215b58e8925 |
class GfmtaskCommit(sublime_plugin.TextCommand): <NEW_LINE> <INDENT> def is_enabled(self): <NEW_LINE> <INDENT> return is_markdown(self.view) <NEW_LINE> <DEDENT> def run(self, edit): <NEW_LINE> <INDENT> invoke_committer(self.view) | Commit changes to task list file.
If `gfmtask_committer` is set, invoke it,
otherwise call `git` directly. | 62598f028a349b6b43684c6d |
class Block(object): <NEW_LINE> <INDENT> def __init__(self, scope, loc): <NEW_LINE> <INDENT> assert isinstance(scope, Scope) <NEW_LINE> assert isinstance(loc, Loc) <NEW_LINE> self.scope = scope <NEW_LINE> self.body = [] <NEW_LINE> self.loc = loc <NEW_LINE> <DEDENT> def copy(self): <NEW_LINE> <INDENT> block = Block(self... | A code block
| 62598f024f88993c371ef9ff |
class pluginLogMuc(urusai_plugin.MucMessage): <NEW_LINE> <INDENT> triggers = { "": "Log" } <NEW_LINE> @staticmethod <NEW_LINE> def triggerLog(fromName, fromJid, message): <NEW_LINE> <INDENT> msg_fmt = "<{0}> {1}" <NEW_LINE> try: <NEW_LINE> <INDENT> [muc, author] = fromName.split("/", 1) <NEW_LINE> <DEDENT> except Value... | MUC logging plugin. | 62598f02167d2b6e312b59c6 |
class IMopageGeolocationObjectLookup(IMopageObjectLookup): <NEW_LINE> <INDENT> pass | Specific adapter to lookup objects providing geolocation
data for xml export | 62598f027047854f4633ddf1 |
class RestStatisticEntry(BaseRestView): <NEW_LINE> <INDENT> @property <NEW_LINE> def schema(self): <NEW_LINE> <INDENT> return SQLAlchemySchemaNode( StatisticEntry, includes=('title', 'description',), ) <NEW_LINE> <DEDENT> def collection_get(self): <NEW_LINE> <INDENT> return self.context.entries <NEW_LINE> <DEDENT> def ... | Json rest api for statistic entries handling | 62598f02fbf16365ca792ac4 |
class Euro(thinkbayes.Suite): <NEW_LINE> <INDENT> def Likelihood(self, data, hypo): <NEW_LINE> <INDENT> x = hypo / 100.0 <NEW_LINE> heads, tails = data <NEW_LINE> like = x**heads * (1-x)**tails <NEW_LINE> return like | Represents hypotheses about the probability of heads. | 62598f025fcc89381b265640 |
class AbstractDataHandler(object): <NEW_LINE> <INDENT> __metaclass__ = ABCMeta <NEW_LINE> def __init__(self,account,events_queue,instruments_list,granularity,data_store=None): <NEW_LINE> <INDENT> self.account = account <NEW_LINE> self.events = events_queue <NEW_LINE> self.instruments_list = instruments_list <NEW_LINE> ... | DataHandler is an abstract base class providing an interface for
all subsequent (inherited) data handlers (both live and historic).
The goal of a (derived) DataHandler object is to output a generated
set of bars (OLHCVI) for each symbol requested.
This will replicate how a live strategy would function as current
mark... | 62598f02956e5f7376df4b91 |
class Job(models.Model): <NEW_LINE> <INDENT> TYPES = ( ('hello', 'hello'), ('mytask', 'mytask'), ) <NEW_LINE> STATUSES = ( ('pending', 'pending'), ('started', 'started'), ('finished', 'finished'), ('failed', 'failed'), ) <NEW_LINE> name = models.CharField(max_length=255) <NEW_LINE> type = models.CharField(choices=TYPES... | Class describing a job | 62598f02099cdd3c636748ec |
class BuiltinException(CompositeObject): <NEW_LINE> <INDENT> def __init__(self, obj, serialize): <NEW_LINE> <INDENT> CompositeObject.__init__(self, obj) <NEW_LINE> self.args = map(serialize, obj.args) <NEW_LINE> self.constructor_format = "%s(%%s)" % class_name(obj) <NEW_LINE> self.imports = set() <NEW_LINE> if class_of... | A built-in exception instance, which may hold any kind of objects in its
`args` attribute.
It doesn't matter if an exception was generated by the interpreter or by
the user code, it will be serialized as BuiltinException nevertheless. This
means we can't assume anything about the contents of `args`.
User-defined exce... | 62598f0276e4537e8c3edfe8 |
class KomojuApi(): <NEW_LINE> <INDENT> def __init__(self, api_key): <NEW_LINE> <INDENT> self.api_endpoint = API_ENDPOINT <NEW_LINE> self.basic_auth = HTTPBasicAuth(api_key, '') <NEW_LINE> <DEDENT> def get_request(self, api_endpoint): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> res = requests.get(api_endpoint, auth=sel... | Komoju API Base class | 62598f0250812a4eaa620101 |
class ApplicationsView(View): <NEW_LINE> <INDENT> def get(self, request, **kwargs): <NEW_LINE> <INDENT> context = { } <NEW_LINE> return render(request, 'hooks/applications.html', context) | Home Controller class. | 62598f024f88993c371efa00 |
class MovedIntoSubFolder(Exception): <NEW_LINE> <INDENT> pass | Raised when a folder is moved into its sub-folder. | 62598f02ff9c53063f51908d |
class LatestRepoReleaseEnvironment(Model): <NEW_LINE> <INDENT> __core__ = False <NEW_LINE> repository_id = BoundedBigIntegerField() <NEW_LINE> environment_id = BoundedBigIntegerField() <NEW_LINE> release_id = BoundedBigIntegerField() <NEW_LINE> deploy_id = BoundedBigIntegerField(null=True) <NEW_LINE> commit_id = Bounde... | For each environment, tracks the latest release which is associated with
commits in the given repo. | 62598f0260cbc95b06362d5e |
class CopySource(msrest.serialization.Model): <NEW_LINE> <INDENT> _validation = { 'type': {'required': True}, } <NEW_LINE> _attribute_map = { 'additional_properties': {'key': '', 'type': '{object}'}, 'type': {'key': 'type', 'type': 'str'}, 'source_retry_count': {'key': 'sourceRetryCount', 'type': 'object'}, 'source_ret... | A copy activity source.
You probably want to use the sub-classes and not this class directly. Known
sub-classes are: .
All required parameters must be populated in order to send to Azure.
:param additional_properties: Unmatched properties from the message are deserialized to this
collection.
:type additional_proper... | 62598f029f28863672817223 |
class GoString(): <NEW_LINE> <INDENT> def __init__(self, color, stones, liberties): <NEW_LINE> <INDENT> self.color = color <NEW_LINE> self.stones = stones <NEW_LINE> self.liberties = set(liberties) <NEW_LINE> <DEDENT> def remove_liberty(self, point): <NEW_LINE> <INDENT> self.liberties.remove(point) <NEW_LINE> <DEDENT> ... | This class is used to explicitly track all directly connected stones as a single unit | 62598f0297e22403b3839912 |
class UserProfile(models.Model): <NEW_LINE> <INDENT> user = models.ForeignKey(User, unique=True, related_name='profiles') <NEW_LINE> public_profile = models.BooleanField(default=True) <NEW_LINE> gender = models.CharField(max_length=1, choices=GENDER_CHOICES, blank=True, null=True) <NEW_LINE> description = models.TextFi... | This model is extending the builtin user model.
The extension includes a list of followed objects,
such as parties, members and agendas.
>>> daonb = User.objects.create(username='daonb')
>>> profile = daonb.get_profile()
>>> legalize = Party.objects.create(name='legalize')
>>> follow(daonb, legalize)
<Follow: daonb ... | 62598f02956e5f7376df4b92 |
class Everything(object): <NEW_LINE> <INDENT> def __contains__(self, other): <NEW_LINE> <INDENT> return True | A collection "containing" every possible thing.
>>> 'foo' in Everything()
True
>>> import random
>>> random.randint(1, 999) in Everything()
True
>>> random.choice([None, 'foo', 42, ('a', 'b', 'c')]) in Everything()
True | 62598f025166f23b2e241e0c |
class EcobeeData(object): <NEW_LINE> <INDENT> def __init__(self, config_file): <NEW_LINE> <INDENT> from pyecobee import Ecobee <NEW_LINE> self.ecobee = Ecobee(config_file) <NEW_LINE> <DEDENT> @Throttle(MIN_TIME_BETWEEN_UPDATES) <NEW_LINE> def update(self): <NEW_LINE> <INDENT> self.ecobee.update() <NEW_LINE> _LOGGER.inf... | Gets the latest data and update the states. | 62598f02f9cc0f698b1c47e5 |
class Assigner(object): <NEW_LINE> <INDENT> def __init__(self, groups_object, mab_object): <NEW_LINE> <INDENT> self.all_nodes = {} <NEW_LINE> self.all_nodes_set = set() <NEW_LINE> self.mab_object = mab_object <NEW_LINE> self.groups_object = groups_object <NEW_LINE> <DEDENT> def assign(self, key, covariates): <NEW_LINE>... | Assigner create nodes. It takes Groups object as parameter so it can assign
the object to the created nodes. | 62598f02283ffb24f3cf22d9 |
class IsAuthenticatedOrReadOnlyOrCreate(BasePermission): <NEW_LINE> <INDENT> def has_permission(self, request, view): <NEW_LINE> <INDENT> return ( request.method in SAFE_METHODS + ('POST',) or request.user and request.user.is_authenticated ) | The request is authenticated as a user, or is a read-only request. | 62598f028a349b6b43684c71 |
@register_request('setExceptionBreakpoints') <NEW_LINE> @register <NEW_LINE> class SetExceptionBreakpointsRequest(BaseSchema): <NEW_LINE> <INDENT> __props__ = { "seq": { "type": "integer", "description": "Sequence number (also known as message ID). For protocol messages of type 'request' this ID can be used to cancel t... | The request configures the debuggers response to thrown exceptions. If an exception is configured to
break, a 'stopped' event is fired (with reason 'exception').
Note: automatically generated code. Do not edit manually. | 62598f027b180e01f3e4855e |
class FixedReferenceFqdn(object): <NEW_LINE> <INDENT> swagger_types = { 'id': 'str', 'name': 'str', 'resource_type': 'str', 'fqdn': 'str' } <NEW_LINE> attribute_map = { 'id': 'id', 'name': 'name', 'resource_type': 'resource_type', 'fqdn': 'fqdn' } <NEW_LINE> required_args = { } <NEW_LINE> def __init__( self, id=None, n... | Attributes:
swagger_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. | 62598f025fc7496912d4778a |
class TestMLen(TestCase): <NEW_LINE> <INDENT> def test_non_mxp_string(self): <NEW_LINE> <INDENT> self.assertEqual(utils.m_len('Test_string'), 11) <NEW_LINE> <DEDENT> def test_mxp_string(self): <NEW_LINE> <INDENT> self.assertEqual(utils.m_len('{lclook{ltat{le'), 2) <NEW_LINE> <DEDENT> def test_mxp_ansi_string(self): <NE... | Verifies that m_len behaves like len in all situations except those
where MXP may be involved. | 62598f02ff9c53063f51908f |
class PathFigureCollectionValueSerializer(ValueSerializer): <NEW_LINE> <INDENT> def CanConvertFromString(self,value,context): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def CanConvertToString(self,value,context): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def ConvertFromString(self,value,context): <NEW_LINE> <INDEN... | Converts instances of System.String to and from instances of System.Windows.Media.PathFigureCollection.
PathFigureCollectionValueSerializer() | 62598f02d486a94d0ba2a9f6 |
class CurrentStackPointer(Unresolved): <NEW_LINE> <INDENT> pass | Unresolved argument which will be replaced with the address of itself. | 62598f02adb09d7d5dc08fe0 |
class SearcherMixin(object): <NEW_LINE> <INDENT> _searcher = None <NEW_LINE> @property <NEW_LINE> def searcher(self): <NEW_LINE> <INDENT> if self._searcher is None: <NEW_LINE> <INDENT> self._searcher = SearchEngine.get_search_engine(TEST_INDEX_NAME) <NEW_LINE> <DEDENT> return self._searcher | Mixin to provide searcher for the tests | 62598f02fbf16365ca792ac8 |
class Document(dict): <NEW_LINE> <INDENT> def __init__(self,content,uri="",task='default'): <NEW_LINE> <INDENT> self["URI"]=uri <NEW_LINE> self["url"]=uri <NEW_LINE> self["task"]=task <NEW_LINE> self["html"]=content <NEW_LINE> self["links"]=[] <NEW_LINE> self["base"]="" <NEW_LINE> self["keywords"]="" <NEW_LINE> self["d... | parents of all document classes | 62598f03ad47b63b2c5a6247 |
class BNWLabelScratch(QLabel): <NEW_LINE> <INDENT> def __init__(self, parent=None): <NEW_LINE> <INDENT> super(BNWLabelScratch, self).__init__(parent) <NEW_LINE> self.__pixmap=None <NEW_LINE> self.__ratio=1 <NEW_LINE> self.setMinimumSize(1,1) <NEW_LINE> self.setScaledContents(False) <NEW_LINE> self.setStyleSheet("backgr... | A label to display a streched pixmap that keep pixmap ratio | 62598f034428ac0f6e656f7c |
class Get_dydt: <NEW_LINE> <INDENT> def __init__(self, beta, gamma, power): <NEW_LINE> <INDENT> self.beta = beta <NEW_LINE> self.gamma = gamma <NEW_LINE> self.power = power <NEW_LINE> <DEDENT> def __call__(self, t, y): <NEW_LINE> <INDENT> I, R = y <NEW_LINE> S = 1. - I - R <NEW_LINE> dI_dt = (self.beta * I * S**self.po... | Creates the callable function needed by scipy's integrator.
This exists as a class to make it easier to set parameters. | 62598f034a966d76dd5ed903 |
class Ability(TableBase, ExistsByGeneration, ByLanguage): <NEW_LINE> <INDENT> __tablename__ = 'abilities' <NEW_LINE> _by_generation_class_name = 'GenerationAbility' <NEW_LINE> _by_language_class_name = 'AbilityName' <NEW_LINE> id = sa.Column(sa.Integer, primary_key=True) <NEW_LINE> identifier = sa.Column(sa.Unicode, un... | An ability (e.g. Overgrow, Blaze, Torrent). | 62598f03be7bc26dc925137b |
class Power(pygame.sprite.Sprite): <NEW_LINE> <INDENT> size = (200, 20) <NEW_LINE> full_size = 200 <NEW_LINE> position = (10, 520) <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.image = pygame.Surface(self.size) <NEW_LINE> self.rect = self.image.get_rect() <NEW_LINE> self.image.fi... | power values for the player | 62598f0331939e2706ed0f79 |
class BEINCNotifyServer(HTTPServer): <NEW_LINE> <INDENT> def __init__(self, *arg, **kwargs): <NEW_LINE> <INDENT> super().__init__(*arg, **kwargs) <NEW_LINE> self._config = None <NEW_LINE> self._instances = {} <NEW_LINE> <DEDENT> def set_config(self, config): <NEW_LINE> <INDENT> self._config = config <NEW_LINE> if pynot... | BEINCNotifyServer class | 62598f03d8ef3951e32c736a |
class ExpressRouteCrossConnectionListResult(msrest.serialization.Model): <NEW_LINE> <INDENT> _validation = { 'next_link': {'readonly': True}, } <NEW_LINE> _attribute_map = { 'value': {'key': 'value', 'type': '[ExpressRouteCrossConnection]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } <NEW_LINE> def __init__( se... | Response for ListExpressRouteCrossConnection API service call.
Variables are only populated by the server, and will be ignored when sending a request.
:param value: A list of ExpressRouteCrossConnection resources.
:type value: list[~azure.mgmt.network.v2019_09_01.models.ExpressRouteCrossConnection]
:ivar next_link: T... | 62598f0371ff763f4b5e6193 |
class customOvs(OVSSwitch): <NEW_LINE> <INDENT> def __init__( self, name, failMode='secure', datapath='kernel', **params ): <NEW_LINE> <INDENT> OVSSwitch.__init__( self, name, failMode=failMode, datapath=datapath,**params ) <NEW_LINE> self.switchIP = None <NEW_LINE> <DEDENT> def getSwitchIP(self): <NEW_LINE> <INDENT> r... | Customized OVS switch | 62598f03f548e778e5969fb7 |
class PrivateUserApiTests(TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.user = create_user( email='test@londonappdev.com', password='testpass', name='fname', ) <NEW_LINE> self.client = APIClient() <NEW_LINE> self.client.force_authenticate(user=self.user) <NEW_LINE> <DEDENT> def test_retrieve_... | Test API requests that require authentication | 62598f037b180e01f3e4855f |
class PollSerializer(serializers.ModelSerializer): <NEW_LINE> <INDENT> question = QuestionSerializer(many=True, source='poll') <NEW_LINE> class Meta: <NEW_LINE> <INDENT> model = Poll <NEW_LINE> fields = ('id','title','plot','start_at','end_at','is_published', 'question') | Серилизатор опросов, общий, question-вопросы к опросу
"title": навзание,
"plot": описание,
"start_at": начала,
"end_at": конец,
"is_published": опубликован,
"question": вопросы | 62598f03656771135c4880bb |
class User(AbstractUser): <NEW_LINE> <INDENT> bio = models.TextField(default='', validators=[MaxLengthValidator(1000)]) <NEW_LINE> @property <NEW_LINE> def displayname(self): <NEW_LINE> <INDENT> if self.get_full_name(): <NEW_LINE> <INDENT> return self.get_full_name() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return... | Model for SatNOGS users. | 62598f03a05bb46b384892a6 |
class CopyCommand(CreateCommand): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> kwargs.setdefault('summary_fmt', "Copy and modify %(model_name)s configurations.") <NEW_LINE> super().__init__(*args, **kwargs) <NEW_LINE> <DEDENT> def _construct_parser(self): <NEW_LINE> <INDENT> key_attr = s... | Base class for the `copy` subcommand of command line views. | 62598f0360cbc95b06362d62 |
class IProdamPortal(Interface): <NEW_LINE> <INDENT> pass | Browser Layer para o pacote prodam.portal | 62598f033d592f4c4edb9920 |
class Results(object): <NEW_LINE> <INDENT> def __init__(self, results): <NEW_LINE> <INDENT> self.results = results <NEW_LINE> self.names = Names(self) <NEW_LINE> self.counts = Counts(self) <NEW_LINE> <DEDENT> def get_result(self, name): <NEW_LINE> <INDENT> results = [] <NEW_LINE> for res in self.results: <NEW_LINE> <IN... | Container object for results.
Has the results, the names of status, and the counts of statuses. | 62598f035166f23b2e241e10 |
class AfficheLineString(): <NEW_LINE> <INDENT> def plot_poly(self, poly, xrange=[-10, 10], yrange=[-10, 10]): <NEW_LINE> <INDENT> x, y = poly.exterior.xy <NEW_LINE> fig = plt.figure(1, figsize=(5, 5), dpi=90) <NEW_LINE> ax = fig.add_subplot(111) <NEW_LINE> ax.plot(x, y) <NEW_LINE> ax.set_title('Polygon Edges') <NEW_LIN... | Plot a LineString | 62598f03cc40096d616196f2 |
class ProdIndex(Index[str]): <NEW_LINE> <INDENT> def __init__(self, index): <NEW_LINE> <INDENT> Index.__init__(self, column="name", index=index) | Index implementation to filter productions | 62598f0371ff763f4b5e6195 |
class BaseResources(Generic[T]): <NEW_LINE> <INDENT> _levels_type: Type[ResourceLevels[T]] <NEW_LINE> _available: Tracked[ResourceLevels[T]] <NEW_LINE> _zero: ResourceLevels[T] <NEW_LINE> @property <NEW_LINE> def levels(self) -> ResourceLevels[T]: <NEW_LINE> <INDENT> return self._available.value <NEW_LINE> <DEDENT> @pr... | Internal base class for resource types | 62598f0323849d37ff84faf3 |
class KubeConfigMerger: <NEW_LINE> <INDENT> def __init__(self, paths): <NEW_LINE> <INDENT> self.paths = [] <NEW_LINE> self.config_files = {} <NEW_LINE> self.config_merged = None <NEW_LINE> if hasattr(paths, 'read'): <NEW_LINE> <INDENT> self._load_config_from_file_like_object(paths) <NEW_LINE> <DEDENT> else: <NEW_LINE> ... | Reads and merges configuration from one or more kube-config's.
The propery `config` can be passed to the KubeConfigLoader as config_dict.
It uses a path attribute from ConfigNode to store the path to kubeconfig.
This path is required to load certs from relative paths.
A method `save_changes` updates changed kubeconfi... | 62598f03091ae3566870364d |
class IronicNodeState(host_manager.HostState): <NEW_LINE> <INDENT> def _update_from_compute_node(self, compute): <NEW_LINE> <INDENT> if 'free_disk_gb' not in compute or compute.free_disk_gb is None: <NEW_LINE> <INDENT> LOG.debug('Ignoring compute node %s as its usage has not been ' 'updated yet.', compute.uuid) <NEW_LI... | Mutable and immutable information tracked for a host.
This is an attempt to remove the ad-hoc data structures
previously used and lock down access. | 62598f03167d2b6e312b59ce |
class ParametricRectifierLayer(Layer): <NEW_LINE> <INDENT> def __init__(self, incoming, alpha=init.Constant(0.25), shared_axes='auto', **kwargs): <NEW_LINE> <INDENT> super(ParametricRectifierLayer, self).__init__(incoming, **kwargs) <NEW_LINE> if shared_axes == 'auto': <NEW_LINE> <INDENT> self.shared_axes = (0,) + tupl... | lasagne.layers.ParametricRectifierLayer(incoming,
alpha=init.Constant(0.25), shared_axes='auto', **kwargs)
A layer that applies parametric rectify nonlinearity to its input
following [1]_.
Equation for the parametric rectifier linear unit:
:math:`\varphi(x) = \max(x,0) + \alpha \min(x,0)`
Parameters
----------
incom... | 62598f03aad79263cf42d242 |
class CharacterConstant(Token): <NEW_LINE> <INDENT> def __repr__(self): <NEW_LINE> <INDENT> return "CharacterConstant(line={!r},col={!r},prev_white={!r},token={!r})".format( self.line, self.col, self.prev_white, self.token) | Represents a character constant. | 62598f034a966d76dd5ed907 |
class Model(object): <NEW_LINE> <INDENT> def __init__(self, inputs, hidden_size, act_funcs, batch_size, learning_rate, test_samples=None, dropout=False, batch_norm=False, col_num=0): <NEW_LINE> <INDENT> assert len(hidden_size) == len(act_funcs) <NEW_LINE> self.inputs = inputs <NEW_LINE> self.size = hidden_size <NEW_LIN... | Abstract model class.
This class contains generic methods needed by each subsequent model for
training and testing. | 62598f03cc40096d616196f3 |
class CondExpr(Expr): <NEW_LINE> <INDENT> fields = ('test', 'expr1', 'expr2') <NEW_LINE> def as_const(self): <NEW_LINE> <INDENT> if self.test.as_const(): <NEW_LINE> <INDENT> return self.expr1.as_const() <NEW_LINE> <DEDENT> return self.expr2.as_const() | A conditional expression (inline if expression). (``{{
foo if bar else baz }}``) | 62598f03a05bb46b384892aa |
class TagUpdate(PermissionRequiredMixin, UpdateView): <NEW_LINE> <INDENT> form_class = TagForm <NEW_LINE> model = Tag <NEW_LINE> permission_required = "organizer.change_tag" <NEW_LINE> template_name = "tag/form.html" <NEW_LINE> extra_context = {"update": True} | Update a Tag via HTML form | 62598f037cff6e4e811b4419 |
class BitNotSet(Exception): <NEW_LINE> <INDENT> def __init__(self, value): <NEW_LINE> <INDENT> self.str = value <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return repr(self.str) | Exception that indicate that you try to access a bit not present in the bitmap.
| 62598f0326068e7796d4b38e |
class Recipe(db.Model): <NEW_LINE> <INDENT> author = db.UserProperty() <NEW_LINE> title = db.StringProperty() <NEW_LINE> avatar = db.BlobProperty() <NEW_LINE> description = db.StringProperty(multiline=True) <NEW_LINE> date = db.DateTimeProperty(auto_now_add=True) | Models a Recipe with an author, title, avatar, and date. | 62598f0397e22403b383991a |
class CompositeFunction(with_metaclass(abc.ABCMeta, Function)): <NEW_LINE> <INDENT> pass | This is a function that is the combination (e.g. sum) of other
composite or atomic functions. It may also be a constrained function. | 62598f03adb09d7d5dc08fe6 |
class TestDataInputTinyResponse(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 make_instance(self, include_optional): <NEW_LINE> <INDENT> if include_optional : <NEW_LINE> <INDENT> return DataInput... | DataInputTinyResponse unit test stubs | 62598f032c8b7c6e89bd21f8 |
class CollectionBuilder: <NEW_LINE> <INDENT> def __init__(self, collection_type_description): <NEW_LINE> <INDENT> self._collection_type_description = collection_type_description <NEW_LINE> self._current_elements = {} <NEW_LINE> self.collection = None <NEW_LINE> self.associated_identifiers = set() <NEW_LINE> <DEDENT> de... | Purely functional builder pattern for building a dataset collection. | 62598f035fcc89381b265645 |
class Command: <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def run(command, custom_env=None, raise_on_error=True): <NEW_LINE> <INDENT> from .path import Path <NEW_LINE> command_type = namedtuple( 'command', ['output', 'error', 'returncode'] ) <NEW_LINE> environment = os.environ <NEW_LINE> if custom_env: <NEW_LINE> <IN... | **Implements command invocation**
An instance of Command provides methods to invoke external
commands in blocking and non blocking mode. Control of
stdout and stderr is given to the caller | 62598f03fff4ab517ebcc208 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.