code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class GameStats: <NEW_LINE> <INDENT> def __init__(self, ai_game): <NEW_LINE> <INDENT> self.settings = ai_game.settings <NEW_LINE> self.reset_stats() <NEW_LINE> self.game_active = False <NEW_LINE> self.high_score = 0 <NEW_LINE> <DEDENT> def reset_stats(self): <NEW_LINE> <INDENT> self.ships_left = self.settings.ship_limi... | Monitorowanie danych statystycznych gry. | 6259905fd486a94d0ba2d65b |
class SavGolFilterDetrender(BaseEstimator, TransformerMixin): <NEW_LINE> <INDENT> def __init__(self, window=201, order=3): <NEW_LINE> <INDENT> self.window = window <NEW_LINE> self.order = order <NEW_LINE> <DEDENT> def fit(self, X, y=None): <NEW_LINE> <INDENT> return self <NEW_LINE> <DEDENT> def transform(self,X): <NEW_... | Detrend the calcium signal using a Savitzky-Golay filter
Parameters
----------
window : int, optional (default: 201)
Number of samples to use to build the Savitzky-Golay filter
order : int, optional (default: 3)
Order of the Savitzky-Golay filter | 6259905f3539df3088ecd92f |
class UrlTest(Package): <NEW_LINE> <INDENT> homepage = "http://www.url-fetch-example.com" <NEW_LINE> version('test', url='to-be-filled-in-by-test') <NEW_LINE> def install(self, spec, prefix): <NEW_LINE> <INDENT> pass | Mock package that fetches from a URL. | 6259905fa8370b77170f1a61 |
class TestCleanupChainRemoval(AttrCalcTestCase): <NEW_LINE> <INDENT> def testAttribute(self): <NEW_LINE> <INDENT> attr1 = self.ch.attribute(attributeId=1) <NEW_LINE> attr2 = self.ch.attribute(attributeId=2) <NEW_LINE> attr3 = self.ch.attribute(attributeId=3) <NEW_LINE> modifier1 = Modifier() <NEW_LINE> modifier1.state ... | Check that removed item damages all attributes which were relying on its attributes | 6259905f442bda511e95d8a3 |
class DescribeDomainsResponse(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.Domains = None <NEW_LINE> self.TotalCount = None <NEW_LINE> self.RequestId = None <NEW_LINE> <DEDENT> def _deserialize(self, params): <NEW_LINE> <INDENT> if params.get("Domains") is not None: <NEW_LINE> <INDEN... | DescribeDomains response structure.
| 62599060d7e4931a7ef3d6ce |
class SWAP(ObservableBase): <NEW_LINE> <INDENT> def __init__(self, A): <NEW_LINE> <INDENT> self.name = "SWAP" <NEW_LINE> self.symbol = "S" <NEW_LINE> self.A = A <NEW_LINE> <DEDENT> def apply(self, nn_state, samples): <NEW_LINE> <INDENT> samples = samples.to(device=nn_state.device) <NEW_LINE> samples1 = samples <NEW_LIN... | The :math:`\text{Swap}_A` observable.
Can be used to compute the 2nd Renyi entropy of the region A through:
:math:`S_2 = -\ln\langle \text{SWAP}_A \rangle`
Ref: PhysRevLett.104.157201
:param A: The sites contained in the region A.
:type A: int or list or np.array or torch.Tensor | 625990601f5feb6acb16427e |
class DQNPlayer(Player): <NEW_LINE> <INDENT> def __init__(self, team, config, use_pretrained=True, name='MinMaxPlayer', verbose=True): <NEW_LINE> <INDENT> super(DQNPlayer, self).__init__(team, name, verbose) <NEW_LINE> self.model = TicTacToeDQNModel(config) <NEW_LINE> self.model.load(use_pretrained=use_pretrained) <NEW... | Class for a Deep Q-Network player. | 625990607d847024c075da67 |
class RbacUnderPermissionException(BasePatroleException): <NEW_LINE> <INDENT> message = "Authorized action was not allowed to be performed" | Raised when the expected result is pass but the actual result is
failure. | 625990607d847024c075da68 |
class Estimator(object): <NEW_LINE> <INDENT> dataset = None <NEW_LINE> optimizer = None <NEW_LINE> network = None <NEW_LINE> transformer = None <NEW_LINE> def __init__(self, dataset, optimizer, network, transformer): <NEW_LINE> <INDENT> self.dataset = dataset <NEW_LINE> self.optimizer = optimizer <NEW_LINE> self.networ... | This is losely based on the tensorflow estimator:
We'll first implement the MNIST estimator and bring the common functionality here.
Now that i think about it, data transformation can be a bitch - Need to think through this thoroughly. But regarding the API's that we expose,
I think we can just take that up from tens... | 625990602ae34c7f260ac77a |
class ParamEstimationPSAEM2(Simulator): <NEW_LINE> <INDENT> def maximize(self, param0, num_part, max_iter=1000, tol=0.001, callback=None, callback_sim=None, meas_first=False, filter='cpfas', filter_options=None, smoother='full', smoother_options=None, alpha_gen=alpha_gen, discard_eps=0.0, discard_percentile=0): <NEW_LI... | Extension of the Simulator class to iterative perform particle smoothing
combined with a gradienst search algorithms for maximizing the likelihood
of the parameter estimates | 6259906091af0d3eaad3b4bc |
class GameData: <NEW_LINE> <INDENT> enemies = None <NEW_LINE> obstacles = None <NEW_LINE> towers = None <NEW_LINE> grid = None <NEW_LINE> path = None | Class to hold data in a game without granting unrestricted access to top-level
modelling class directly | 625990604f6381625f199fed |
class Rotacionar90X3(bpy.types.Operator): <NEW_LINE> <INDENT> bl_idname = "object.rotate90x3" <NEW_LINE> bl_label = "+{}º x_3".format(R) <NEW_LINE> @classmethod <NEW_LINE> def poll(cls, context): <NEW_LINE> <INDENT> return context.active_object is not None <NEW_LINE> <DEDENT> def execute(self, context): <NEW_LINE> <IND... | Operator 'rotate'. Rotaciona o grupo x_3 +90 graus. | 6259906063b5f9789fe86807 |
class StoppableThread(threading.Thread): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> super(StoppableThread, self).__init__(*args, **kwargs) <NEW_LINE> self.setDaemon(True) <NEW_LINE> self._stop = threading.Event() <NEW_LINE> <DEDENT> def stop(self): <NEW_LINE> <INDENT> self._stop.set() ... | Thread class with a stop() method. The thread itself has to check
regularly for the stopped() condition. | 6259906024f1403a92686418 |
class elements(object): <NEW_LINE> <INDENT> def __init__(self, cls): <NEW_LINE> <INDENT> self.cls = cls <NEW_LINE> <DEDENT> def __getattr__(self, tag): <NEW_LINE> <INDENT> return self.cls(tag) | This module allows the user to import arbitrary elements by tag name
example:
>>> from untemplate.elements import Html, Head, Body
>>> print(Html)
<html />
>>> print(Html(Body))
<html><body /></html> | 6259906032920d7e50bc76db |
class ArcNodeAbstractTestCase(FictionOutlineAbstractTestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> super().setUp() <NEW_LINE> self.node_to_test = self.arc1.arc_root_node.get_children()[0] <NEW_LINE> self.part1 = self.o1.story_tree_root.add_child( name='Part 1', description='A long time ago in a gal... | Adds additional properties to test. | 6259906045492302aabfdb6e |
class IntentDatabaseHandler(DatabaseMetadataContainerController): <NEW_LINE> <INDENT> def __init__(self) -> None: <NEW_LINE> <INDENT> super().__init__(SQLQueryFactory(table = "intent", fields = { "id": "text", "name": "text", "quality_type": "text", "intent_category": "text", "variant": "text", "definition": "text", "m... | The Database handler for Intent containers | 62599060e76e3b2f99fda094 |
class BaseModel(db1.Model): <NEW_LINE> <INDENT> __abstract__ = True <NEW_LINE> @property <NEW_LINE> def dict(self): <NEW_LINE> <INDENT> return utils.to_dict(self, self.__class__) | Clase modelo base. | 625990605166f23b2e244a67 |
class MVPAVoxelSelector: <NEW_LINE> <INDENT> def __init__(self, data, mask, labels, num_folds, sl ): <NEW_LINE> <INDENT> self.data = data <NEW_LINE> self.mask = mask.astype(np.bool) <NEW_LINE> self.labels = labels <NEW_LINE> self.num_folds = num_folds <NEW_LINE> self.sl = sl <NEW_LINE> num_voxels = np.sum(self.mask) <N... | Activity-based voxel selection component of FCMA
Parameters
----------
data: 4D array in shape [brain 3D + epoch]
contains the averaged and normalized brain data epoch by epoch.
It is generated by .io.prepare_searchlight_mvpa_data
mask: 3D array
labels: 1D array
contains the labels of the epochs.
It... | 62599060dd821e528d6da4cb |
class UserValidate(object): <NEW_LINE> <INDENT> def __init__(self, db): <NEW_LINE> <INDENT> self.db_client = db <NEW_LINE> <DEDENT> def on_get(self, req, resp, token): <NEW_LINE> <INDENT> valid_langs = { 'en_US': 'en_US', 'es_CO': 'es_CO', 'pt_BR': 'pt_BR' } <NEW_LINE> value_lang_cookie = valid_langs.get( req.cookies.g... | Deal with user validation. | 625990600fa83653e46f657c |
class GWS_S35_STD_Class: <NEW_LINE> <INDENT> def __init__(self, Pin, Reversal): <NEW_LINE> <INDENT> self.mPin = Pin <NEW_LINE> self.mReversal = Reversal <NEW_LINE> GPIO.setup(self.mPin, GPIO.OUT) <NEW_LINE> self.mPwm = GPIO.PWM(self.mPin , 500) <NEW_LINE> self.Stop() <NEW_LINE> <DEDENT> """停止""" <NEW_LINE> def Stop(sel... | コンストラクタ | 625990603d592f4c4edbc571 |
class SingleDocumentWriter(BaseWriter): <NEW_LINE> <INDENT> def __init__(self, stream: BinaryIO, headers_included: bool=False): <NEW_LINE> <INDENT> self._stream = stream <NEW_LINE> self._headers_included = headers_included <NEW_LINE> <DEDENT> def session(self) -> SingleDocumentWriterSession: <NEW_LINE> <INDENT> return ... | Writer that writes all the data into a single file. | 62599060d7e4931a7ef3d6cf |
class assemblyReferenceInitialRep: <NEW_LINE> <INDENT> def __init__(self): pass <NEW_LINE> def clear(self, rootAssemblyName): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def getInitialRep(self, targetAssemblyName): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def reader(self, rootAssemblyName): <NEW_LINE> <INDENT> pas... | This utility class is invoked by the sceneAssembly plug-in to manage
the save, restore and query of the initial representation information
for scene assemblies. An assembly's initial representation is the
representation that will be activated when the assembly is first loaded.
Each top level scene assembly node will ... | 625990603539df3088ecd932 |
class Author(models.Model): <NEW_LINE> <INDENT> name = models.CharField(verbose_name=_("Name"), max_length=50) <NEW_LINE> created = models.DateTimeField( verbose_name=_("Created"), editable=False, blank=True, auto_now_add=True ) <NEW_LINE> modified = models.DateTimeField( verbose_name=_("Modified"), editable=False, bla... | Author object | 62599060498bea3a75a59149 |
class AvailabeRooms: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.rooms = {key: [] for key in DAYS} <NEW_LINE> <DEDENT> def __repr__(self): <NEW_LINE> <INDENT> return "%s(%r)" % (self.__class__, self.__dict__) <NEW_LINE> <DEDENT> def add(self, room_resource): <NEW_LINE> <INDENT> self.rooms[room_reso... | List of available room resources | 625990608e7ae83300eea723 |
class Vreddit(Service): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def preprocess(cls, url: str, data: Any) -> str: <NEW_LINE> <INDENT> xpost: Optional[Any] = helpers.get(data, "crosspost_parent_list") <NEW_LINE> fallback_url: str <NEW_LINE> if xpost is not None and len(xpost) > 0: <NEW_LINE> <INDENT> fallback_url = h... | Service for v.redd.it GIFs. | 625990607047854f46340a53 |
class PygameApp(object): <NEW_LINE> <INDENT> def __init__(self, screensize = (400,400), fullscreen = False, title = 'PygameApp Window'): <NEW_LINE> <INDENT> self.screensize = screensize <NEW_LINE> self.fullscreen = fullscreen <NEW_LINE> self.title = title <NEW_LINE> self.elapsedms = 0 <NEW_LINE> pygame.init() <NEW_LINE... | Class that encapsulates a basic pygame application. | 62599060cb5e8a47e493ccd0 |
class Execute(BaseAction): <NEW_LINE> <INDENT> def _Run(self, command, success_codes, reboot_codes, restart_retry): <NEW_LINE> <INDENT> result = 0 <NEW_LINE> c = cache.Cache() <NEW_LINE> logging.debug('Interpreting command %s', command) <NEW_LINE> try: <NEW_LINE> <INDENT> command = c.CacheFromLine(command, self._build_... | Run an executable. | 625990609c8ee82313040cd5 |
class IPCError(Exception): <NEW_LINE> <INDENT> pass | Base exception for all IPC related errors. | 6259906091af0d3eaad3b4be |
class TF: <NEW_LINE> <INDENT> Array = tf.Tensor <NEW_LINE> Tensor = tf.Tensor <NEW_LINE> Tensor1 = Tensor <NEW_LINE> Tensor2 = Tensor <NEW_LINE> Vector = Tensor2 <NEW_LINE> Covector = Tensor2 <NEW_LINE> Matrix = Tensor2 <NEW_LINE> Tensor3 = Tensor <NEW_LINE> Tensor4 = Tensor <NEW_LINE> Tensor5 = Tensor <NEW_LINE> Tenso... | Extended tensorflow types. | 62599060f7d966606f749404 |
class EventRegistration(models.Model): <NEW_LINE> <INDENT> event = models.ForeignKey(Event, null=False) <NEW_LINE> feePayable = models.IntegerField() <NEW_LINE> feePaid = models.BooleanField(default=False, null=False) <NEW_LINE> participants = models.ManyToManyField(Candidate) <NEW_LINE> teamName=models.CharField(max_l... | Stores the imformation of event registration | 625990604a966d76dd5f058a |
class UnaryFunction1DVectorViewShape: <NEW_LINE> <INDENT> integration_type: 'IntegrationType' = None <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def __init__(self, integration_type: 'IntegrationType'): <NEW_LINE> <INDENT> pass | Base class for unary functions (functors) that work on Interface1D and return a list of ViewShape objects. | 62599060a17c0f6771d5d6ef |
class StubTestCase(TestCase): <NEW_LINE> <INDENT> bolt_uri = "bolt://localhost:7687" <NEW_LINE> bolt_routing_uri = "bolt+routing://localhost:7687" <NEW_LINE> user = "test" <NEW_LINE> password = "test" <NEW_LINE> auth_token = (user, password) | Base class for test cases that integrate with a server.
| 62599060dd821e528d6da4cc |
class ContrastiveLoss(torch.nn.Module): <NEW_LINE> <INDENT> def __init__(self, margin=2.0): <NEW_LINE> <INDENT> super(ContrastiveLoss, self).__init__() <NEW_LINE> self.margin = margin <NEW_LINE> <DEDENT> def forward(self, output1, output2, label): <NEW_LINE> <INDENT> return torch.mean(self.forward_vector(output1, outpu... | Contrastive loss function.
Based on: http://yann.lecun.com/exdb/publis/pdf/hadsell-chopra-lecun-06.pdf | 62599060baa26c4b54d50938 |
class SSHServerProcess(SSHProcess, SSHServerStreamSession): <NEW_LINE> <INDENT> def __init__(self, process_factory, sftp_factory, allow_scp): <NEW_LINE> <INDENT> SSHProcess.__init__(self) <NEW_LINE> SSHServerStreamSession.__init__(self, self._start_process, sftp_factory, allow_scp) <NEW_LINE> self._process_factory = pr... | SSH server process handler | 625990603d592f4c4edbc573 |
class UserAgentFilterRule(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.RuleType = None <NEW_LINE> self.RulePaths = None <NEW_LINE> self.UserAgents = None <NEW_LINE> self.FilterType = None <NEW_LINE> <DEDENT> def _deserialize(self, params): <NEW_LINE> <INDENT> self.RuleType = params.g... | UserAgent黑白名单规则配置
| 625990602ae34c7f260ac77d |
class TextCaptchaService: <NEW_LINE> <INDENT> def __init__(self, apikey): <NEW_LINE> <INDENT> self._browser = Browser.Browser() <NEW_LINE> self._apikey = apikey <NEW_LINE> <DEDENT> def captcha(self): <NEW_LINE> <INDENT> response = self._browser.open('http://textcaptcha.com/api/' + self._apikey, set_referer=False).read(... | Methods to request a new textCAPTCHA. | 62599060009cb60464d02bcd |
class EventSubscription: <NEW_LINE> <INDENT> def __init__(self, event_type, filters=None): <NEW_LINE> <INDENT> self.event_type = event_type <NEW_LINE> if filters: <NEW_LINE> <INDENT> self.filters = filters <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.filters = [] <NEW_LINE> <DEDENT> <DEDENT> def __eq__(self, othe... | Represents a subscription to events. An event is part of a subscription
if its type matches the type of the subscription and, if any filters are
included in the subscription, it passes all filters. | 62599060460517430c432b9e |
class QryLinkManField(Base): <NEW_LINE> <INDENT> _fields_ = [ ('BrokerID', ctypes.c_char * 11), ('InvestorID', ctypes.c_char * 13), ] <NEW_LINE> def __init__(self, BrokerID='', InvestorID=''): <NEW_LINE> <INDENT> super(QryLinkManField, self).__init__() <NEW_LINE> self.BrokerID = self._to_bytes(BrokerID) <NEW_LINE> self... | 查询联系人 | 6259906016aa5153ce401b74 |
class SubscribeResponse(Response): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> super(SubscribeResponse, self).__init__(*args, **kwargs) <NEW_LINE> self.original_callback = self.callback <NEW_LINE> self.callback = self.handle_message <NEW_LINE> self.channels = 0 <NEW_LINE> <DEDENT> def h... | Handles the long-running subscription connections | 6259906099cbb53fe6832578 |
class MonitorRecord(object): <NEW_LINE> <INDENT> def __init__(self, domid, timestamp, buf, moniLen, moniType, domClock): <NEW_LINE> <INDENT> self.domid = domid <NEW_LINE> self.timestamp = timestamp <NEW_LINE> self.buf = buf <NEW_LINE> self.moniLen = moniLen <NEW_LINE> self.moniType = moniType <NEW_LINE> self.domClock =... | Generic monitor record type - supports the common base information
contained in all monitor records. | 6259906067a9b606de5475ed |
class Reaction(Node): <NEW_LINE> <INDENT> def __init__(self, formula, uid=None, type=None, reversibility='Unknown'): <NEW_LINE> <INDENT> Node.__init__(self) <NEW_LINE> self.formula = formula <NEW_LINE> self.uid = uid <NEW_LINE> self.type = type <NEW_LINE> self.reversibility = reversibility | An object of class Reaction. It inherits all methods from the Node class. | 625990603617ad0b5ee077e5 |
class Thunk: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.base_url = "http://thunk.us/" <NEW_LINE> self.poke_states = ["good", "bad", "iffy", "unknown"] <NEW_LINE> <DEDENT> def create(self, name=None): <NEW_LINE> <INDENT> values = {} <NEW_LINE> if name is not None: <NEW_LINE> <INDENT> values["name"]... | class for creating an object which can talk to the
thunk.us API | 62599060004d5f362081fb3b |
class ShowFabricMulticastIpSaAdRouteSchema(MetaParser): <NEW_LINE> <INDENT> schema ={ "multicast": { "vrf": { Any(): { "vnid": str, Optional("address_family"): { Any(): { "sa_ad_routes": { "gaddr": { Any(): { "grp_len": int, "saddr": { Any(): { "src_len": int, "uptime": str, Optional("interested_fabric_nodes"): { Any()... | Schema for:
show fabric multicast ipv4 sa-ad-route
show fabric multicast ipv4 sa-ad-route vrf <vrf>
show fabric multicast ipv4 sa-ad-route vrf all | 625990601f5feb6acb164282 |
class Question(models.Model): <NEW_LINE> <INDENT> title = models.CharField(max_length=255, verbose_name=_('Title')) <NEW_LINE> content = models.TextField(verbose_name=_('Content')) <NEW_LINE> questioner = models.ForeignKey(User, verbose_name=_('Questioner')) <NEW_LINE> vote_up = models.IntegerField(verbose_name=_('Vote... | Question model
| 625990607d847024c075da6c |
class ImplementationViewSet(viewsets.ModelViewSet): <NEW_LINE> <INDENT> queryset = Implementation.objects.all() <NEW_LINE> serializer_class = ImplementationSerializer | API endpoint that allows companies to be viewed or edited. | 6259906007f4c71912bb0ad5 |
class HTTPBasicAuthFromNetrc(HTTPBasicAuth): <NEW_LINE> <INDENT> def __init__(self, url): <NEW_LINE> <INDENT> auth = _get_netrc_auth(url) <NEW_LINE> if not auth: <NEW_LINE> <INDENT> raise ValueError("netrc missing or no credentials found in netrc") <NEW_LINE> <DEDENT> username, password = auth <NEW_LINE> super(HTTPBasi... | HTTP Basic Auth with netrc credentials. | 6259906029b78933be26ac10 |
class GetCommentResultSet(ResultSet): <NEW_LINE> <INDENT> def getJSONFromString(self, str): <NEW_LINE> <INDENT> return json.loads(str) <NEW_LINE> <DEDENT> def get_Response(self): <NEW_LINE> <INDENT> return self._output.get('Response', None) <NEW_LINE> <DEDENT> def get_Limit(self): <NEW_LINE> <INDENT> return self._outpu... | A ResultSet with methods tailored to the values returned by the GetComment Choreo.
The ResultSet object is used to retrieve the results of a Choreo execution. | 62599060b7558d5895464a79 |
class ftrl_proximal(object): <NEW_LINE> <INDENT> def __init__(self, alpha, beta, L1, L2, D, interaction=False): <NEW_LINE> <INDENT> self.alpha = alpha <NEW_LINE> self.beta = beta <NEW_LINE> self.L1 = L1 <NEW_LINE> self.L2 = L2 <NEW_LINE> self.D = D <NEW_LINE> self.interaction = interaction <NEW_LINE> self.n = [0.] * D ... | Our main algorithm: Follow the regularized leader - proximal
In short,
this is an adaptive-learning-rate sparse logistic-regression with
efficient L1-L2-regularization | 62599060462c4b4f79dbd09d |
class Number(_Controller): <NEW_LINE> <INDENT> _TEMPLATE = 'number.jsx' <NEW_LINE> _COMPONENT = 'AntNumber' <NEW_LINE> _PACKAGE = None <NEW_LINE> _ATTRS = ('start={{{start}}} ' 'min={{{minimum}}} ' 'max={{{maximum}}} ' 'step={{{step}}} ' "size={{'{size}'}}") <NEW_LINE> def __init__(self, start: int = 0, minimum: float ... | A number input widget with increment and decrement buttons. | 6259906097e22403b383c5a5 |
class Client(object): <NEW_LINE> <INDENT> def __init__(self, host='http://localhost/v1', api_key=None): <NEW_LINE> <INDENT> self._params = {'api_key': api_key} if api_key else {} <NEW_LINE> self._host = host <NEW_LINE> <DEDENT> def start(self, config: WatcherConfig = None): <NEW_LINE> <INDENT> data = config.as_dict() i... | Provides the set of endpoints to manage arbitrage watcher service. | 62599060d6c5a102081e37bc |
class Query(ObjectType): <NEW_LINE> <INDENT> me = Field(UserType, description=_('user information')) <NEW_LINE> check_token = Field( Boolean, uid=String(), token=String() ) <NEW_LINE> @login_required <NEW_LINE> def resolve_me(self, info): <NEW_LINE> <INDENT> return info.context.user <NEW_LINE> <DEDENT> @staticmethod <N... | Graphql Queries | 625990600c0af96317c578ab |
class MaxPooling2D(_Pooling2D): <NEW_LINE> <INDENT> def __init__(self, pool_size=(2, 2), strides=None, border_mode='valid', dim_ordering=K.image_dim_ordering(), **kwargs): <NEW_LINE> <INDENT> super(MaxPooling2D, self).__init__(pool_size, strides, border_mode, dim_ordering, **kwargs) <NEW_LINE> <DEDENT> def _pooling_fun... | Max pooling operation for spatial data.
# Arguments
pool_size: tuple of 2 integers,
factors by which to downscale (vertical, horizontal).
(2, 2) will halve the image in each dimension.
strides: tuple of 2 integers, or None. Strides values.
If None, it will default to `pool_size`.
bo... | 625990604a966d76dd5f058c |
class CI(object): <NEW_LINE> <INDENT> SUCCESS = 'S' <NEW_LINE> FAILURE = 'F' <NEW_LINE> ERROR = 'E' <NEW_LINE> WARNING = 'W' <NEW_LINE> _jenkins = None <NEW_LINE> url = None <NEW_LINE> token = None <NEW_LINE> def __init__(self, url=None, token=None, load=True): <NEW_LINE> <INDENT> self.url = url or C.get('ci.url') <NEW... | Wrapper for Jenkins | 625990603eb6a72ae038bcf8 |
class StateMatchTest(integration.ModuleCase): <NEW_LINE> <INDENT> def test_issue_2167_exsel_no_AttributeError(self): <NEW_LINE> <INDENT> ret = self.run_function('state.top', ['issue-2167-exsel-match.sls']) <NEW_LINE> self.assertNotIn( "AttributeError: 'Matcher' object has no attribute 'functions'", ret ) <NEW_LINE> <DE... | Validate the file state | 62599060a8370b77170f1a67 |
class DirectoryAuthority(Directory): <NEW_LINE> <INDENT> def __init__(self, address = None, or_port = None, dir_port = None, fingerprint = None, nickname = None, v3ident = None, is_bandwidth_authority = False): <NEW_LINE> <INDENT> super(DirectoryAuthority, self).__init__(address, or_port, dir_port, fingerprint) <NEW_LI... | Tor directory authority, a special type of relay `hardcoded into tor
<https://gitweb.torproject.org/tor.git/tree/src/or/config.c#n819>`_
that enumerates the other relays within the network.
At a very high level tor works as follows...
1. A volunteer starts up a new tor relay, during which it sends a `server
descri... | 6259906056ac1b37e6303833 |
class NoImageTestCase(KartonMixin, TrackedTestCase): <NEW_LINE> <INDENT> def _verify_help_message(self): <NEW_LINE> <INDENT> self.assertIn('usage: karton ', self.current_text) <NEW_LINE> self.assertIn('positional arguments:', self.current_text) <NEW_LINE> self.assertIn('optional arguments:', self.current_text) <NEW_LIN... | Test commands which don't require images to exist or Docker to be invoked. | 625990603cc13d1c6d466ddb |
class SAWarning(RuntimeWarning): <NEW_LINE> <INDENT> pass | Issued at runtime. | 625990603617ad0b5ee077e7 |
class EmailAuth: <NEW_LINE> <INDENT> def authenticate(self, username=None, password=None): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> user = User.objects.get(email=username) <NEW_LINE> if user.check_password(password): <NEW_LINE> <INDENT> return user <NEW_LINE> <DEDENT> return None <NEW_LINE> <DEDENT> except User.Doe... | Authenticate a user by an exact match on the email and password | 625990607d847024c075da6e |
class FacebookNotFoundError(Exception): <NEW_LINE> <INDENT> pass | Data expected from Facebook API response not found. | 625990602ae34c7f260ac780 |
class ComplexType(Type): <NEW_LINE> <INDENT> def __init__(self, name, elt): <NEW_LINE> <INDENT> Type.__init__(self, name) <NEW_LINE> self.is_container = True <NEW_LINE> self.elt = elt <NEW_LINE> self.fields = [] <NEW_LINE> self.nmemb = 1 <NEW_LINE> self.size = 0 <NEW_LINE> self.lenfield_parent = [self] <NEW_LINE> self.... | Derived class which represents a structure. Base type for all structure types.
Public fields added:
fields is an array of Field objects describing the structure fields. | 62599060e64d504609df9f1b |
class EnvReader(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self._setting_dict = {} <NEW_LINE> <DEDENT> def _normalize(self, key): <NEW_LINE> <INDENT> return key.strip() <NEW_LINE> <DEDENT> def __getitem__(self, key): <NEW_LINE> <INDENT> value = self._setting_dict.get(key, None) <NEW_LINE> if n... | Get the settings from the Environ.
Usage: r = EnvReader()
r.get('SETTING_VAR_NAME') | 6259906066673b3332c31a96 |
class Word2VecFile(models.Model): <NEW_LINE> <INDENT> model = models.FileField() <NEW_LINE> syn1neg = models.FileField() <NEW_LINE> vectors = models.FileField() <NEW_LINE> def save(self, request): <NEW_LINE> <INDENT> for file in request.FILES.values(): <NEW_LINE> <INDENT> handle_uploaded_file(file) | Модель Word2Veс. 3 файла: модель, syn1neg.npy, vectors.npy | 6259906091f36d47f22319dc |
class EventListener(object): <NEW_LINE> <INDENT> def __init__(self, schedule): <NEW_LINE> <INDENT> self.my_schedule = schedule <NEW_LINE> <DEDENT> def schedule(self, hass): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def execute(self, hass): <NEW_LINE> <INDENT> pass | The base EventListener class that the schedule uses. | 62599060d99f1b3c44d06d3d |
class HelperMethods: <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def decode_array_of_byte_strings(array): <NEW_LINE> <INDENT> output = [] <NEW_LINE> for byte_str in array: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> output.append(byte_str.decode()) <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDE... | Static methods that can be reused for other classes | 62599060462c4b4f79dbd09f |
class ProductType(TimeStampedModel): <NEW_LINE> <INDENT> name = models.CharField(max_length=100) <NEW_LINE> slug = models.SlugField(unique=True) <NEW_LINE> objects = ProductTypeManager() <NEW_LINE> class Meta: <NEW_LINE> <INDENT> ordering = ('name',) <NEW_LINE> verbose_name = 'Product type' <NEW_LINE> verbose_name_plur... | Type of product e.g. course or membership. | 625990600fa83653e46f6582 |
class GefAlias(gdb.Command): <NEW_LINE> <INDENT> def __init__(self, alias: str, command: str, completer_class: int = gdb.COMPLETE_NONE, command_class: int = gdb.COMMAND_NONE) -> None: <NEW_LINE> <INDENT> p = command.split() <NEW_LINE> if not p: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> if any(x for x in gef.sessio... | Simple aliasing wrapper because GDB doesn't do what it should. | 62599060460517430c432ba0 |
class SANM(object): <NEW_LINE> <INDENT> def __init__(self, predicted): <NEW_LINE> <INDENT> if predicted.any() < 0: <NEW_LINE> <INDENT> raise ValueError("Predicted traffic matrix must be non-negative") <NEW_LINE> <DEDENT> self.predicted = np.matrix(predicted) <NEW_LINE> self.row_sums = self.predicted.sum(axis=1) <NEW_LI... | The Spherically Additive Noise Model (SANM) generates a purely spatial traffic matrix
around a predicted traffic matrix. Require Iterative Proportional Fitting (IPF) from
ipf.py. | 625990602c8b7c6e89bd4e8a |
class _TransmitterCache: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.cache = [] <NEW_LINE> <DEDENT> def get_paths_to(self, directory, filename): <NEW_LINE> <INDENT> paths = [] <NEW_LINE> for dirpath, _, filenames in os.walk(directory): <NEW_LINE> <INDENT> for f in filenames: <NEW_LINE> <INDENT> if ... | cache of transmitters from the transmitter package based on
the transmitter_file_name modules inside, which contain the
manufacturer, product, product and vendor ids of each transmitter
within the system | 62599060498bea3a75a5914c |
class IOffer(model.Schema): <NEW_LINE> <INDENT> file = NamedBlobFile( title=_(u'Offer'), description=_(u'Please upload an offer'), required=False, ) | Offer Content Type | 6259906099cbb53fe683257d |
class PeriodCfg(A10BaseClass): <NEW_LINE> <INDENT> def __init__(self, **kwargs): <NEW_LINE> <INDENT> self.ERROR_MSG = "" <NEW_LINE> self.b_key = "period-cfg" <NEW_LINE> self.DeviceProxy = "" <NEW_LINE> self.week = "" <NEW_LINE> self.A10WW_all = "" <NEW_LINE> self.period = "" <NEW_LINE> self.month = "" <NEW_LINE> self.d... | This class does not support CRUD Operations please use parent.
:param week: {"default": 0, "type": "number", "description": "Most recent week", "format": "flag"}
:param all: {"default": 0, "type": "number", "description": "all log", "format": "flag"}
:param period: {"default": 0, "type": "number", "description": "Spec... | 625990602ae34c7f260ac782 |
class KeyView(View): <NEW_LINE> <INDENT> exception = IndexError <NEW_LINE> def __init__(self, view, key): <NEW_LINE> <INDENT> setattribute(self, 'view', view) <NEW_LINE> setattribute(self, 'key', key) <NEW_LINE> setattribute(self, 'fetch', lambda: getitem(view, key)) <NEW_LINE> <DEDENT> def nonex(self): <NEW_LINE> <IND... | Class for views of parameters derived by indexing. | 625990604e4d562566373aa3 |
class HMACAuth(requests.auth.AuthBase): <NEW_LINE> <INDENT> def __init__(self, username, secret, message): <NEW_LINE> <INDENT> self.username = username <NEW_LINE> self.secret = secret <NEW_LINE> self.message = message <NEW_LINE> <DEDENT> def __call__(self, request): <NEW_LINE> <INDENT> hmac_hash = hmac.new(str(self.sec... | Class defining HMAC authentication
This extends the base authentication class from the requests package. | 62599060097d151d1a2c270b |
class ChannelBD(list): <NEW_LINE> <INDENT> def __init__(self, channel_id, server_id): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.serverId = server_id <NEW_LINE> self.channelId = channel_id | A ChannelBD is made of a channel id and a server id. | 6259906029b78933be26ac12 |
class PersistentManager: <NEW_LINE> <INDENT> def save(key, value): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def get(): pass | Persistent a variable.
When a field is assigend a value, the value will be persistented, accrossed from python runs
# Create a pm, given an indentifier(works like a scope for all assigend attributes). Teh same indentifier will return same python object accross python runs.
pm = PersistentManager('name')
# Persistent... | 625990601f037a2d8b9e53b9 |
class ShapedTransport(ShapedConsumer): <NEW_LINE> <INDENT> iAmStreaming = False <NEW_LINE> def __getattr__(self, name): <NEW_LINE> <INDENT> return getattr(self.consumer, name) | Wraps a C{Transport} and shapes the rate at which it receives data.
This is a L{ShapedConsumer} with a little bit of magic to provide for
the case where the consumer it wraps is also a C{Transport} and people
will be attempting to access attributes this does not proxy as a
C{Consumer} (e.g. C{loseConnection}). | 62599060b7558d5895464a7b |
class QCellToolBarMergeCells(QtGui.QAction): <NEW_LINE> <INDENT> def __init__(self, icon, parent=None): <NEW_LINE> <INDENT> QtGui.QAction.__init__(self, icon, "&Merge cells", parent) <NEW_LINE> self.setStatusTip("Merge selected cells to a single cell if " "they are in consecutive poisitions") <NEW_LINE> self.setCheckab... | QCellToolBarMergeCells is the action to merge selected cells to a
single cell if they are in consecutive poisitions | 62599060e76e3b2f99fda09c |
class LiteracyAndLanguageResultSet(ResultSet): <NEW_LINE> <INDENT> def get_Response(self): <NEW_LINE> <INDENT> return self._output.get('Response', None) | Retrieve the value for the "Response" output from this choreography execution. ((xml) The response from Donor's Choose) | 62599060f7d966606f749407 |
@abstract <NEW_LINE> class ConnectableElement( _user_module.ConnectableElementMixin, TypedElement, ParameterableElement): <NEW_LINE> <INDENT> end = EReference(ordered=False, unique=True, containment=False, derived=True, upper=-1, transient=True, derived_class=_user_module.DerivedEnd) <NEW_LINE> def __init__(self, end=N... | ConnectableElement is an abstract metaclass representing a set of instances that play roles of a StructuredClassifier. ConnectableElements may be joined by attached Connectors and specify configurations of linked instances to be created within an instance of the containing StructuredClassifier.
<p>From package UML::Str... | 6259906001c39578d7f14283 |
class TrainingCenterCreateView( LoginRequiredMixin, TrainingCenterMixin, CreateView): <NEW_LINE> <INDENT> context_object_name = 'trainingcenter' <NEW_LINE> template_name = 'training_center/create.html' <NEW_LINE> def get_success_url(self): <NEW_LINE> <INDENT> return reverse('certifyingorganisation-detail', kwargs={ 'pr... | Create view for Training Center. | 625990600fa83653e46f6584 |
class TestFiles(TestCase): <NEW_LINE> <INDENT> def assert_from_file(self, input, expected): <NEW_LINE> <INDENT> z = open("input.txt", "w") <NEW_LINE> for i in input: <NEW_LINE> <INDENT> z.write(str(i)) <NEW_LINE> z.write("\n") <NEW_LINE> <DEDENT> z.close() <NEW_LINE> parse_file("input.txt") <NEW_LINE> o = [] <NEW_LINE>... | Tests from file. | 6259906091af0d3eaad3b4c4 |
class PolarDBAccountModel(BaseModel): <NEW_LINE> <INDENT> model_name = 'POLARDB账号' <NEW_LINE> model_sign = 'polardb_account' <NEW_LINE> PASSWORD_PERMISSION = 'polardb-account-password' <NEW_LINE> polardb = models.ForeignKey(PolarDBModel, on_delete=models.CASCADE) <NEW_LINE> username = models.CharField('用户名', max_length... | 数据库账号 | 625990606e29344779b01ceb |
class VolumeDriverCompatibility(test.TestCase): <NEW_LINE> <INDENT> def fake_update_cluster_status(self): <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> def setUp(self): <NEW_LINE> <INDENT> super(VolumeDriverCompatibility, self).setUp() <NEW_LINE> self.manager = importutils.import_object(CONF.volume_manager) <NEW_LINE>... | Test backwards compatibility for volume drivers. | 625990604e4d562566373aa4 |
class BaseScript(object): <NEW_LINE> <INDENT> __metaclass__ = abc.ABCMeta <NEW_LINE> script_active = True <NEW_LINE> @abc.abstractmethod <NEW_LINE> def run(self): <NEW_LINE> <INDENT> pass | All scripts should inherit this type! | 6259906056ac1b37e6303835 |
class InvalidOrderError(OrderError): <NEW_LINE> <INDENT> pass | Exceptions regarding invalid order amounts | 62599060442bda511e95d8a8 |
class FileManager(models.Manager): <NEW_LINE> <INDENT> def get_or_create_for_object(self, obj, file_path, url=None): <NEW_LINE> <INDENT> ctype = ContentType.objects.get_for_model(obj) <NEW_LINE> file, new = self.get_or_create( path = file_path, defaults = { 'content_type': ctype, 'object_id': obj.id, 'url': url, } ) <N... | Default manager for File model class | 62599060627d3e7fe0e08528 |
class TypeCompiler(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def buildtype(self): <NEW_LINE> <INDENT> baT = (AbstractCut, RestrictionType) <NEW_LINE> cuT = (NoCut, OneCut, TwoCuts) <NEW_LINE> meT = (Meth_Dep, Meth_Undep) <NEW_LINE> paT = (Palindromic, NonPalindromic) ... | Build the different types possible for Restriction Enzymes. | 625990603539df3088ecd93a |
class AccessReason(enum.IntEnum): <NEW_LINE> <INDENT> UNSPECIFIED = 0 <NEW_LINE> UNKNOWN = 1 <NEW_LINE> OWNED = 2 <NEW_LINE> SHARED = 3 <NEW_LINE> LICENSED = 4 <NEW_LINE> SUBSCRIBED = 5 <NEW_LINE> AFFILIATED = 6 | Enum describing possible access reasons.
Attributes:
UNSPECIFIED (int): Not specified.
UNKNOWN (int): Used for return value only. Represents value unknown in this version.
OWNED (int): The resource is owned by the user.
SHARED (int): The resource is shared to the user.
LICENSED (int): The resource is license... | 62599060fff4ab517ebceec4 |
class TemporalInformationStore(object): <NEW_LINE> <INDENT> __metaclass__ = ABCMeta <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> self.queue = Queue.Queue() <NEW_LINE> <DEDENT> def get(self, timeout = None): <NEW_LINE> <INDENT> if timeout is None: <NEW_LINE> <INDENT> real_timeout = 0.05 <NEW_LINE> <DEDENT> else: <... | Temporal synchronized store for initial and finishing information.
The coordinator will be asking the experiment whether it has finished or not.
Given that this process is not synchronized with the UserProcessingManager, not
even with the user session (if an experiment takes a long time and the user
session has finish... | 625990608e7ae83300eea72b |
class RegisterClientForm(Form): <NEW_LINE> <INDENT> title = wtf.TextField('Application title', validators=[wtf.Required()], description="The name of your application") <NEW_LINE> description = wtf.TextAreaField('Description', validators=[wtf.Required()], description="A description to help users recognize your applicati... | Register a new OAuth client application | 625990605166f23b2e244a6f |
class TaskDispatcher: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.sequencer = Sequencer() <NEW_LINE> self.tick = 0.05 <NEW_LINE> self.status = "Stopped" <NEW_LINE> pub.subscribe(self.process_cmd_queue, 'Command') <NEW_LINE> <DEDENT> def run(self): <NEW_LINE> <INDENT> if self.status == "Running": <N... | This class listens on the cmd queue and dispatches the data and commands to the relevant functions.
It is the main running loop in the software as it receives input from the command queue as well as distributing the
results. | 62599060adb09d7d5dc0bc08 |
class CardBlock(blocks.StructBlock): <NEW_LINE> <INDENT> title = blocks.CharBlock(required=False, help_text="Add your title") <NEW_LINE> cards = blocks.ListBlock( blocks.StructBlock( [ ("image", ImageChooserBlock(required=False)), ("title", blocks.CharBlock(required=False,max_length=40)), ("text", blocks.TextBlock(requ... | Cards with image and text and button(s). | 62599060796e427e5384fe14 |
class OnkyoDevice(MediaPlayerDevice): <NEW_LINE> <INDENT> def __init__(self, receiver, sources, name=None): <NEW_LINE> <INDENT> self._receiver = receiver <NEW_LINE> self._muted = False <NEW_LINE> self._volume = 0 <NEW_LINE> self._pwstate = STATE_OFF <NEW_LINE> self._name = name or '{}_{}'.format( receiver.info['model_n... | Representation of an Onkyo device. | 62599060b7558d5895464a7c |
class Resource(object): <NEW_LINE> <INDENT> TIME_FIELDS = { 'public_date', 'modified_date', 'updated', 'issued' } <NEW_LINE> def __init__(self, name, body=None): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self._name = name <NEW_LINE> self.raw = body <NEW_LINE> self._body = body <NEW_LINE> self.load() <NEW_LINE> <D... | Holds processed part of response data.
Args:
name: Name of the resource (e.g. bash-0:4.2.46-20.el7_2.x86_64)
body: Resource data | 625990601f037a2d8b9e53ba |
class DBLoadTable(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.db = db() <NEW_LINE> self.db.create_database(database_id="test_load_table") <NEW_LINE> self.db.create_schema(database_id="test_load_table", schema_id="test") <NEW_LINE> <DEDENT> def tearDown(self): <NEW_LINE> <INDENT> se... | Test | 62599060379a373c97d9a6c2 |
class NoSuchBranch(NameLookupFailed): <NEW_LINE> <INDENT> _message_prefix = "No such branch" | Raised when we try to load a branch that does not exist. | 62599060097d151d1a2c270e |
class Settings(): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.screen_width = 800 <NEW_LINE> self.screen_height = 600 <NEW_LINE> self.bg_color = (230, 230, 230) <NEW_LINE> self.ship_speed_factor = 1.5 <NEW_LINE> self.ship_limit = 3 <NEW_LINE> self.bullet_speed_factor = 1 <NEW_LINE> self.bullet_width... | A class to store all settings for Alien Invasion | 625990600c0af96317c578ae |
class CfgParameterDialog(ParameterDialog): <NEW_LINE> <INDENT> def _create_additional_controls(self): <NEW_LINE> <INDENT> self.add_to_layout(wx.TextCtrl(self, validator=TextValidator(self, "verif"), size=(150, 26)), "Regular expression") <NEW_LINE> self.add_to_layout(wx.TextCtrl(self, validator=TextValidator(self, "def... | Editor for configuration parameters | 625990608e71fb1e983bd169 |
class FastSheet(SheetReader): <NEW_LINE> <INDENT> @property <NEW_LINE> def name(self): <NEW_LINE> <INDENT> return self._native_sheet.title <NEW_LINE> <DEDENT> def row_iterator(self): <NEW_LINE> <INDENT> for row in self._native_sheet.rows: <NEW_LINE> <INDENT> yield row <NEW_LINE> <DEDENT> <DEDENT> def column_iterator(se... | Iterate through rows | 625990608e7ae83300eea72c |
class StatusFrame(tk.Frame): <NEW_LINE> <INDENT> rtdDefaults = { } <NEW_LINE> def __init__(self, parent, **kwargs): <NEW_LINE> <INDENT> kwargs =dict(self.rtdDefaults, **kwargs) <NEW_LINE> tk.Frame.__init__(self, parent, **kwargs) <NEW_LINE> self.dataCom = parent.dataCom <NEW_LINE> self.statusText = tk.Label(self, text... | A small Frame showing the status of the scope | 62599060fff4ab517ebceec6 |
class LinuxConfiguration(Model): <NEW_LINE> <INDENT> _attribute_map = { 'disable_password_authentication': {'key': 'disablePasswordAuthentication', 'type': 'bool'}, 'ssh': {'key': 'ssh', 'type': 'SshConfiguration'}, } <NEW_LINE> def __init__(self, disable_password_authentication=None, ssh=None): <NEW_LINE> <INDENT> sup... | Specifies the Linux operating system settings on the virtual machine.
<br><br>For a list of supported Linux distributions, see [Linux on
Azure-Endorsed
Distributions](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-endorsed-distros?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json)
<br><br> Fo... | 62599060498bea3a75a5914e |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.