code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
class LandingPageTest(test_utils.DjangoTestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.user = profile_utils.seedNDBUser() <NEW_LINE> profile_utils.loginNDB(self.user) <NEW_LINE> site_properties = { 'key_name': 'site', 'maintenance_mode': False } <NEW_LINE> self.site = seeder_logic.seed(site_mod...
Unit tests for LandingPage class.
62598f92009cb60464d01197
class MockScene(Scene): <NEW_LINE> <INDENT> def __init__(self, geometry, properties): <NEW_LINE> <INDENT> self.geometry = DotDict(geometry) <NEW_LINE> self.properties = DotDict(properties)
Circumvent __init__ method to create a Scene with arbitrary geometry and properties objects
62598f9291af0d3eaad39a6e
class SimplePendulum(SimulationActor): <NEW_LINE> <INDENT> def __init__(self, pos, size, color = colors.WHITE, imagePath = '', alpha = 255, layer = 1, rc = None): <NEW_LINE> <INDENT> SimulationActor.__init__(self, pos, size, color, imagePath, alpha, layer, rc) <NEW_LINE> self.m_l = 1 <NEW_LINE> self.m_g = 9.8 <NEW_LINE...
Pendulum simple actor class
62598f92b5575c28eb712b01
class BasicHTMLField(HTMLField): <NEW_LINE> <INDENT> pass
HTML field which only allow tags: <img>, <a>, <strong>, <i>, <u>, <p>, <br/>
62598f92462c4b4f79dbb66f
class Deliverable(IsDeletedModel, Ownership, NameSlugTimeStampedUUIDModel, metaclass=AldjemyMeta): <NEW_LINE> <INDENT> def history(self): <NEW_LINE> <INDENT> formats = self.formats.all() <NEW_LINE> facets = self.facets.all() <NEW_LINE> content_types = self.content_types.all() <NEW_LINE> responsibilities = Responsibilit...
The thing a group of employees are producing together.
62598f9221a7993f00c65be5
class CredentialSearchServiceStub(object): <NEW_LINE> <INDENT> def __init__(self, channel): <NEW_LINE> <INDENT> self.ListCredentials = channel.unary_stream( '/blueintel.badapi.badapicreds.CredentialSearchService/ListCredentials', request_serializer=badapicreds__pb2.SearchTerm.SerializeToString, response_deserializer=ba...
Missing associated documentation comment in .proto file.
62598f923617ad0b5ee05db3
class DeactivableModel(models.Model): <NEW_LINE> <INDENT> deleted = models.BooleanField(default=False) <NEW_LINE> objects = SoftDeleteManager() <NEW_LINE> class Meta: <NEW_LINE> <INDENT> abstract = True <NEW_LINE> <DEDENT> def delete(self, using=None): <NEW_LINE> <INDENT> self.deleted = True <NEW_LINE> self.save()
Model that supports "soft-delete" of rows, meaning they will not show up in `Model.objects.all()` but /will/ show up in `Models.all_objects.all()`. See: http://codespatter.com/2009/07/01/django-model-manager-soft-delete-how-to-customize-admin/
62598f92e76e3b2f99fd869f
class Wheat(Crop): <NEW_LINE> <INDENT> def __init__(self) : <NEW_LINE> <INDENT> super().__init__(1,3,6) <NEW_LINE> self._type = "Wheat" <NEW_LINE> <DEDENT> def grow(self,light,water): <NEW_LINE> <INDENT> if light >= self._light_need and water >= self._water_need: <NEW_LINE> <INDENT> if self._status == "Seedling" and wa...
en vete planta
62598f928da39b475be02e49
class Team(models.Model): <NEW_LINE> <INDENT> handle = models.CharField(max_length=3) <NEW_LINE> name = models.CharField(max_length=100) <NEW_LINE> def __unicode__(self): <NEW_LINE> <INDENT> return self.handle
A team in the Bundesliga
62598f92fff4ab517ebcd455
class UniformRewardPrior(RewardPriorBase): <NEW_LINE> <INDENT> def __init__(self, dim=1, rmin=0.0, rmax=1.0): <NEW_LINE> <INDENT> super(UniformRewardPrior, self).__init__(dim) <NEW_LINE> if rmax < rmin: <NEW_LINE> <INDENT> raise ValueError('Dist rmax cannot be less than rmin') <NEW_LINE> <DEDENT> self._dist = scipy.sta...
Uniform reward prior distribution Suitable to task in which there is no clear insight into the nature of the reward function. .. math:: p(r(s, a) = x) = \text{Uni}(a, b)
62598f9282261d6c5272fd0a
class ColorField(StringField): <NEW_LINE> <INDENT> widget = ColorInput() <NEW_LINE> error_msg = u'Not a valid color.' <NEW_LINE> def _value(self): <NEW_LINE> <INDENT> if self.raw_data: <NEW_LINE> <INDENT> return self.raw_data[0] <NEW_LINE> <DEDENT> if self.data: <NEW_LINE> <INDENT> return str(self.data) <NEW_LINE> <DED...
A string field representing a Color object from python colour package. .. _colours: https://github.com/vaab/colour Represents an ``<input type="color">``.
62598f9210dbd63aa1c70827
class ServiceLayer(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(ServiceLayer, self).__init__() <NEW_LINE> self._application = _Application() <NEW_LINE> self._server = httpserver.HTTPServer(self._application) <NEW_LINE> self._services = {} <NEW_LINE> <DEDENT> def get_service(self, service):...
Represents any number of HTTP services. Create an instance of this class to represent any number of HTTP services that your application depends on. It attaches to the :class:`~tornado.ioloop.IOLoop` instance that the standard :class:`~tornado.testing.AsyncTestCase` supplies and manages the Tornado machinery necessary...
62598f92dd821e528d6d8b9c
class PyngrokConfig: <NEW_LINE> <INDENT> def __init__(self, ngrok_path=None, config_path=None, auth_token=None, region=None, monitor_thread=True, log_event_callback=None, startup_timeout=15, max_logs=100, request_timeout=4, start_new_session=False): <NEW_LINE> <INDENT> self.ngrok_path = DEFAULT_NGROK_PATH if ngrok_path...
An object containing ``pyngrok``'s configuration for interacting with the ``ngrok`` binary. All values are optional when it is instantiated, and default values will be used for parameters not passed. Use :func:`~pyngrok.conf.get_default` and :func:`~pyngrok.conf.set_default` to interact with the default ``pyngrok_conf...
62598f928e7ae83300ee8d0e
class UsersProjectsService(base_api.BaseApiService): <NEW_LINE> <INDENT> _NAME = u'users_projects' <NEW_LINE> def __init__(self, client): <NEW_LINE> <INDENT> super(OsloginV1beta.UsersProjectsService, self).__init__(client) <NEW_LINE> self._upload_configs = { } <NEW_LINE> <DEDENT> def Delete(self, request, global_params...
Service class for the users_projects resource.
62598f92dc8b845886d53227
class FeedsMixin: <NEW_LINE> <INDENT> feed_types = ( AnnouncementsFeedLink, BranchFeedLink, BugFeedLink, BugTargetLatestBugsFeedLink, PersonBranchesFeedLink, PersonRevisionsFeedLink, ProductBranchesFeedLink, ProductRevisionsFeedLink, ProjectBranchesFeedLink, ProjectRevisionsFeedLink, RootAnnouncementsFeedLink, ) <NEW_L...
Mixin which adds the feed_links attribute to a view object. feed_types: This class attribute can be overridden to reduce the feed links that are added to the page. feed_links: Returns a list of objects subclassed from FeedLinkBase.
62598f92f8510a7c17d7dfac
class _UserBoundForm(forms.Form): <NEW_LINE> <INDENT> def __init__(self, user, initial=None): <NEW_LINE> <INDENT> forms.Form.__init__(self, initial) <NEW_LINE> self.app = get_application() <NEW_LINE> self.user = user <NEW_LINE> <DEDENT> def as_widget(self): <NEW_LINE> <INDENT> widget = forms.Form.as_widget(self) <NEW_L...
Internal baseclass for user bound forms.
62598f9285dfad0860cbf8a7
class xmlComplexExport(base.baseplugin): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def run(self): <NEW_LINE> <INDENT> return ("xml_complex", __doc__) <NEW_LINE> <DEDENT> def write(self, data_to_save, outfile="out1.xml"): <NEW_LINE> <INDENT> root = ET.Element('root') <NEW_LINE>...
Write more complex XML
62598f9296565a6dacd2cdae
class ExecuteRecipe(Operation): <NEW_LINE> <INDENT> def __init__(self, context): <NEW_LINE> <INDENT> self.recipe_name = None <NEW_LINE> super(ExecuteRecipe, self).__init__(context) <NEW_LINE> <DEDENT> @property <NEW_LINE> def command(self): <NEW_LINE> <INDENT> return 'execute_recipes' <NEW_LINE> <DEDENT> def _create_de...
Used to issue a Deployment operation within OpsWorks
62598f9224f1403a926856e5
class PlayerSchema(Schema): <NEW_LINE> <INDENT> time_stats_fields = ['min_match_time', 'max_match_time'] <NEW_LINE> nickname = fields.Str(required=True) <NEW_LINE> player_nickname = fields.Str(dump_only=True) <NEW_LINE> kills = fields.Int() <NEW_LINE> deaths = fields.Int() <NEW_LINE> assists = fields.Int() <NEW_LINE> k...
Serializer schema for player JSON representation.
62598f92a79ad16197769cc9
class Reliproc(RelayProcessor): <NEW_LINE> <INDENT> def __init__(self, uri): <NEW_LINE> <INDENT> super(Reliproc, self).__init__(uri, CAPA_RESOURCELIST) <NEW_LINE> <DEDENT> def __get_level_processor__(self, uri): <NEW_LINE> <INDENT> return Reliproc(uri) <NEW_LINE> <DEDENT> def __process_lower__(self): <NEW_LINE> <INDENT...
Reliproc eats the uri of a resource list and processes the contents.
62598f920c0af96317c55fee
class ExcerptsByOwner(Excerpts): <NEW_LINE> <INDENT> master_key = 'owner' <NEW_LINE> help_text = _("History of excerpts based on this data record.") <NEW_LINE> label = _("Existing excerpts") <NEW_LINE> column_names = "build_time excerpt_type user project *" <NEW_LINE> order_by = ['-build_time', 'id'] <NEW_LINE> display...
Shows all excerpts whose :attr:`owner <Excerpt.owner>` field is this.
62598f923cc13d1c6d4653d5
class _SzFmt(object): <NEW_LINE> <INDENT> _don_touch = {"0000": 0.69, "000": 0.79, "00": 0.89, "0": 0.99} <NEW_LINE> def format(self, sz, shortform=False): <NEW_LINE> <INDENT> if not sz: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> if isinstance(sz, Number): <NEW_LINE> <INDENT> sz = str(sz) <NEW_LINE> <DEDENT> i...
helper class for stsizefmt function
62598f92a17c0f6771d5bea5
class BehanceBackend(OAuthBackend): <NEW_LINE> <INDENT> name = 'behance' <NEW_LINE> EXTRA_DATA = [ ('username', 'username'), ] <NEW_LINE> def get_user_id(self, details, response): <NEW_LINE> <INDENT> return response['user']['id'] <NEW_LINE> <DEDENT> def get_user_details(self, response): <NEW_LINE> <INDENT> user = respo...
Behance OAuth authentication backend
62598f9263b5f9789fe84ddf
class ZapPreferences(Preferences): <NEW_LINE> <INDENT> qtd_imoveis_para_exportacao = models.PositiveIntegerField( 'Quantidade de imóveis para exportar', blank=True, default=100) <NEW_LINE> def __unicode__(self): <NEW_LINE> <INDENT> return "ZapPreferences" <NEW_LINE> <DEDENT> class Meta: <NEW_LINE> <INDENT> verbose_name...
@see behaviours.Preferences
62598f924e696a045264dc3d
class SubTask(Model): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(SubTask, self).__init__() <NEW_LINE> self.Name = "SubTask" <NEW_LINE> <DEDENT> def add(self,datas): <NEW_LINE> <INDENT> self.addModels(self.Name,datas,'SubTaskId')
子任务 结构: SubTaskId - 子任务id PTaskId - 父任务id bizType - 业务类型 status - 状态 tryCount - 重试次数 bizInfo - 业务信息 process - 进度 errInfo - 异常信息
62598f9223e79379d538c16e
class WindowsRootFileInformation(common.FileInformation): <NEW_LINE> <INDENT> def __init__(self, **kwargs): <NEW_LINE> <INDENT> super(WindowsRootFileInformation, self).__init__(**kwargs) <NEW_LINE> self.st_mode = common.Permissions(0o40755) <NEW_LINE> <DEDENT> def open(self): <NEW_LINE> <INDENT> return obj.NoneObject("...
A special FileInformation class to handle windows drives. In windows the root directory (/) is not real, it contains a listing of drive letters. So listing the "/" directory should return a list of FileInformation("/c:"), FileInformation("/d:") etc.
62598f92925a0f43d25e7ca4
class State(ABC): <NEW_LINE> <INDENT> @property <NEW_LINE> def context(self) -> Context: <NEW_LINE> <INDENT> return self._context <NEW_LINE> <DEDENT> @context.setter <NEW_LINE> def context(self, context: Context) -> None: <NEW_LINE> <INDENT> self._context = context <NEW_LINE> <DEDENT> @abstractmethod <NEW_LINE> def han...
EN: The base State class declares methods that all Concrete State should implement and also provides a backreference to the Context object, associated with the State. This backreference can be used by States to transition the Context to another State. RU: Базовый класс Состояния объявляет методы, которые должны реализ...
62598f92bde94217f370749d
class ToolStripItemOverflow(Enum,IComparable,IFormattable,IConvertible): <NEW_LINE> <INDENT> def __eq__(self,*args): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def __format__(self,*args): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def __ge__(self,*args): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def __gt__(self,...
Determines whether a System.Windows.Forms.ToolStripItem is placed in the overflow System.Windows.Forms.ToolStrip. enum ToolStripItemOverflow,values: Always (1),AsNeeded (2),Never (0)
62598f927cff6e4e811b5684
class Crawler(): <NEW_LINE> <INDENT> def __init__(self, logger, proxy = None, timeout = 5): <NEW_LINE> <INDENT> self.logger = logger <NEW_LINE> self.proxy = proxy <NEW_LINE> self.timeout = timeout <NEW_LINE> <DEDENT> def get_random_user_agent(self): <NEW_LINE> <INDENT> with open('useragents.txt') as file: <NEW_LINE> <I...
Crawler Class
62598f9229b78933be269f11
class DBFullLogger(DBLogger): <NEW_LINE> <INDENT> def save_result(self, monitor_name, monitor_type, monitor_params, monitor_result, monitor_info, hostname=""): <NEW_LINE> <INDENT> if not self.connected: <NEW_LINE> <INDENT> self.logger_logger.warning("cannot send results, a dependency failed") <NEW_LINE> return <NEW_LIN...
Logs results to a sqlite3 db.
62598f92ac7a0e7691f72176
class EnvironmentVariableException(BaseException): <NEW_LINE> <INDENT> def __init__(self, variable_name, target): <NEW_LINE> <INDENT> desc = ENVIRONMENT_VARIABLE_FAIL.format(variable_name, target) <NEW_LINE> super().__init__(ENVIRONMENT_VARIABLE, desc)
An Exception thrown when there are missing environment variables.
62598f9230dc7b766599f4c1
class Container(object): <NEW_LINE> <INDENT> def __init__(self, callback, options=None, name=None): <NEW_LINE> <INDENT> self.callback = callback <NEW_LINE> self.options = options or {} <NEW_LINE> self.ident = name or id(self) <NEW_LINE> self.app = None <NEW_LINE> <DEDENT> def __getattr__(self, name): <NEW_LINE> <INDENT...
Creates an extension container for app-bound execution of an object. >>> redis = Container( >>> lambda app, kwargs: redis.StrictClient(**kwargs), >>> {'host': 'localhost'})
62598f9216aa5153ce40016a
class TransportError(Error): <NEW_LINE> <INDENT> pass
Transport exception.
62598f923617ad0b5ee05db5
class mutateRows_result(object): <NEW_LINE> <INDENT> def __init__(self, io=None, ia=None,): <NEW_LINE> <INDENT> self.io = io <NEW_LINE> self.ia = ia <NEW_LINE> <DEDENT> def read(self, iprot): <NEW_LINE> <INDENT> if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift...
Attributes: - io - ia
62598f92f7d966606f747c4d
class CacheThrottle(BaseThrottle): <NEW_LINE> <INDENT> def should_be_throttled(self, identifier, **kwargs): <NEW_LINE> <INDENT> key = self.convert_identifier_to_key(identifier) <NEW_LINE> minimum_time = int(time.time()) - int(self.timeframe) <NEW_LINE> times_accessed = [access for access in cache.get(key, []) if access...
A throttling mechanism that uses just the cache.
62598f922ae34c7f260aad54
class ResetSignal(Value): <NEW_LINE> <INDENT> def __init__(self, cd="sys", allow_reset_less=False): <NEW_LINE> <INDENT> Value.__init__(self) <NEW_LINE> self.cd = cd <NEW_LINE> self.allow_reset_less = allow_reset_less
Reset signal for a given clock domain `ResetSignal` s for a given clock domain can be retrieved multiple times. They all ultimately refer to the same signal. Parameters ---------- cd : str Clock domain to obtain a reset signal for. Defaults to `"sys"`. allow_reset_less : bool If the clock domain is resetless,...
62598f9282261d6c5272fd0b
class ExtractFolder(): <NEW_LINE> <INDENT> def __init__(self,corename,path='',collection='',collectionID='',job=None,ocr=False,docstore=DOCSTORE): <NEW_LINE> <INDENT> self.job=job <NEW_LINE> self.ocr=ocr <NEW_LINE> self.docstore=docstore <NEW_LINE> try: <NEW_LINE> <INDENT> self._index=Index.objects.get(corename=corenam...
extract entire collection folder to index with ICIJ extract and correct meta
62598f92fff4ab517ebcd457
class quillsCanonicalPathAdapter(object): <NEW_LINE> <INDENT> implements(ICanonicalPath) <NEW_LINE> def __init__(self, context): <NEW_LINE> <INDENT> self.context = context <NEW_LINE> <DEDENT> def canonical_path(self): <NEW_LINE> <INDENT> purl = getToolByName(self.context,'portal_url') <NEW_LINE> entry = IWeblogEntry(se...
Adapts quills entry content to canonical path.
62598f928c0ade5d55dc34c2
class NetUtil(object): <NEW_LINE> <INDENT> def getIP(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> res=urllib2.urlopen('http://whois.pconline.com.cn/ipJson.jsp',timeout=2000) <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> if res.getcode()!=200: <NEW_LINE> <INDENT> return None <NEW...
负责网络连通性检测
62598f92f7d966606f747c4e
class Heap(): <NEW_LINE> <INDENT> def __init__(self, array): <NEW_LINE> <INDENT> self.data = array <NEW_LINE> self.heapify() <NEW_LINE> <DEDENT> def top(self): <NEW_LINE> <INDENT> return self.data[0] <NEW_LINE> <DEDENT> def empty(self): <NEW_LINE> <INDENT> return self.fence == 0 <NEW_LINE> <DEDENT> def heapify(self): <...
Implements Binary Heap over list
62598f9255399d3f05626188
class Resource(object): <NEW_LINE> <INDENT> config = config
Resource Base Class. Inherits config by default.
62598f926aa9bd52df0d4b38
class DUIK_UL_dopesheet_filters( bpy.types.UIList ): <NEW_LINE> <INDENT> bl_idname = "DUIK_UL_dopesheet_filters" <NEW_LINE> def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index): <NEW_LINE> <INDENT> layout.prop(item, "name", text="", emboss=False)
The list of dopesheet filters
62598f92851cf427c66b7f2f
class LogSetupMock(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.log_level = None <NEW_LINE> self.log_file = None <NEW_LINE> self.log_level_logfile = None <NEW_LINE> self.config = {} <NEW_LINE> self.temp_log_level = None <NEW_LINE> <DEDENT> def setup_console_logger(self, log_level='error', *...
Logger setup
62598f9271ff763f4b5e73e1
class Adadelta(Optimizer): <NEW_LINE> <INDENT> def __init__(self, lr=1.0, rho=0.95, epsilon=1e-6, *args, **kwargs): <NEW_LINE> <INDENT> super(Adadelta, self).__init__(**kwargs) <NEW_LINE> self.__dict__.update(locals()) <NEW_LINE> self.lr = shared_scalar(lr) <NEW_LINE> <DEDENT> def get_updates(self, params, constraints,...
Reference: http://arxiv.org/abs/1212.5701
62598f92a8ecb03325870e72
class TokenListResult(msrest.serialization.Model): <NEW_LINE> <INDENT> _attribute_map = { 'value': {'key': 'value', 'type': '[Token]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } <NEW_LINE> def __init__( self, *, value: Optional[List["Token"]] = None, next_link: Optional[str] = None, **kwargs ): <NEW_LINE> <IND...
The result of a request to list tokens for a container registry. :ivar value: The list of tokens. Since this list may be incomplete, the nextLink field should be used to request the next list of tokens. :vartype value: list[~azure.mgmt.containerregistry.v2021_08_01_preview.models.Token] :ivar next_link: The URI that ...
62598f92dd821e528d6d8b9f
class NumMisplacedHeuristic: <NEW_LINE> <INDENT> def __init__(self, problem): <NEW_LINE> <INDENT> self.problem = problem <NEW_LINE> <DEDENT> def eval(self, state): <NEW_LINE> <INDENT> curState = self.problem.getState() <NEW_LINE> self.problem.setState(state) <NEW_LINE> bound = 0 <NEW_LINE> board = self.problem.getBoard...
Gives the number of misplaced tiles.
62598f92d53ae8145f9180f7
class Recipe(models.Model): <NEW_LINE> <INDENT> name = models.CharField(max_length=100, unique=True) <NEW_LINE> description_list = models.CharField(max_length=1000, null=False) <NEW_LINE> def __str__(self): <NEW_LINE> <INDENT> return self.name
Recipe class
62598f9238b623060ffa8cf5
class points_config(osv.osv): <NEW_LINE> <INDENT> _name = "ktv.points_config" <NEW_LINE> _description = "积分规则" <NEW_LINE> _columns = { "config_prior": fields.integer("config_prior",required = True,help="设置优先级,优先级高的放到前边" ), "drinks_fee": fields.float("drinks_fee",digits =(10,2),required = True,help="酒水消费金额" ), "drinks_p...
积分规则
62598f92fbf16365ca793d1e
class OpHandler(Controller): <NEW_LINE> <INDENT> context = Instance(WorkflowItem) <NEW_LINE> @observe('context.op_error_trait', dispatch = 'ui', post_init = True) <NEW_LINE> def _op_trait_error(self, event): <NEW_LINE> <INDENT> for ed in self.info.ui._editors: <NEW_LINE> <INDENT> if ed.name == self.context.op_error_tra...
Base class for operation handlers.
62598f9207f4c71912baf0b5
class LogicNetwork(BASE, DaisyBase): <NEW_LINE> <INDENT> __tablename__ = 'logic_networks' <NEW_LINE> __table_args__ = (Index('ix_logic_networks_deleted', 'deleted'),) <NEW_LINE> name = Column(String(255), nullable=False) <NEW_LINE> type = Column(String(36)) <NEW_LINE> physnet_name = Column(String(255)) <NEW_LINE> clust...
Represents an logic_networks in the datastore.
62598f92a219f33f346c6486
class KMeans(): <NEW_LINE> <INDENT> def __init__(self, n_clusters=8, n_init=10, max_iter=10, verbose=0, random_state=None): <NEW_LINE> <INDENT> self.n_clusters = n_clusters <NEW_LINE> self.max_iter = max_iter <NEW_LINE> self.n_init = n_init <NEW_LINE> self.verbose = verbose <NEW_LINE> self.random_state = random_state <...
K-Means clustering Parameters ---------- n_clusters : int, optional, default: 8 The number of clusters to form as well as the number of centroids to generate. max_iter : int Maximum number of iterations of the k-means algorithm for a single run. n_init : int, optional, default: 10 Number of time...
62598f92adb09d7d5dc0a1f2
class FredkinGate(Gate): <NEW_LINE> <INDENT> def __init__(self, ctl, tgt1, tgt2, circ=None): <NEW_LINE> <INDENT> super().__init__("ccx", [], [ctl, tgt1, tgt2], circ) <NEW_LINE> <DEDENT> def qasm(self): <NEW_LINE> <INDENT> ctl = self.arg[0] <NEW_LINE> tgt1 = self.arg[1] <NEW_LINE> tgt2 = self.arg[2] <NEW_LINE> return se...
Fredkin gate.
62598f928e71fb1e983bb71f
class MultiRcTaskHelper(TaskHelper): <NEW_LINE> <INDENT> def add_special_input_features(self, input_example: InputExample, input_features: InputFeatures) -> None: <NEW_LINE> <INDENT> input_features.meta['question_idx'] = input_example.meta['question_idx'] <NEW_LINE> <DEDENT> def add_features_to_dict(self, features: Lis...
A custom task helper for the MultiRC dataset.
62598f9223e79379d538c170
class Task(component.Task): <NEW_LINE> <INDENT> Invoke = Mock(return_value='value')
docstring
62598f9245492302aabfc143
class Registry: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.pool = {} <NEW_LINE> <DEDENT> def register(self, name, obj): <NEW_LINE> <INDENT> self.pool[name] = obj <NEW_LINE> <DEDENT> def unregister(self, name): <NEW_LINE> <INDENT> del self.pool[name] <NEW_LINE> <DEDENT> def exists(self, name): <NEW...
Generic registry for objects Together with appropriate metaclasses this allows to keep a list of all created classes. The user-defined class should inherit after a class exposed by the API - since its metaclass is associated with a registry, it will be registered and kept for later use.
62598f929b70327d1c57ea0d
class Options(): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> for option in optionsNames: <NEW_LINE> <INDENT> setattr(self, option, None)
Class to emulate options needed by CntlrCmdLine.run
62598f9232920d7e50bc5ccb
class DebugProxy(proxy.ProxyBackend): <NEW_LINE> <INDENT> def get(self, key): <NEW_LINE> <INDENT> value = self.proxied.get(key) <NEW_LINE> msg = _('CACHE_GET: Key: "%(key)s" Value: "%(value)s"') <NEW_LINE> LOG.debug(msg % {'key': repr(key), 'value': repr(value)}) <NEW_LINE> return value <NEW_LINE> <DEDENT> def get_mult...
Extra Logging ProxyBackend.
62598f9221a7993f00c65be9
class Command(BaseCommand): <NEW_LINE> <INDENT> help = 'Populates the members to the database' <NEW_LINE> def add_arguments(self, parser): <NEW_LINE> <INDENT> parser.add_argument('user_id', type=str, help='User id of the user') <NEW_LINE> parser.add_argument('real_name', type=str, help='Real name of the user') <NEW_LIN...
Commands for members app
62598f92462c4b4f79dbb673
class TP_Material_Remove(bpy.types.Operator): <NEW_LINE> <INDENT> bl_idname = "tp_display.material_remove" <NEW_LINE> bl_label = "Remove All Material Slots" <NEW_LINE> bl_options = {'REGISTER', 'UNDO'} <NEW_LINE> @classmethod <NEW_LINE> def poll(cls, context): <NEW_LINE> <INDENT> return context.active_object is not Non...
Remove material slots from active objects
62598f92097d151d1a2c0c98
class Folder(object): <NEW_LINE> <INDENT> def __init__(self, name): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.basename = path.basename(name) <NEW_LINE> self.total_lines = 0 <NEW_LINE> self.covered_lines = 0 <NEW_LINE> self.files = [] <NEW_LINE> <DEDENT> def add_file(self, file_object): <NEW_LINE> <INDENT> se...
Dir Class Collect statistics regarding a folder
62598f927047854f4633f04b
class genJsonHandler(tornado.web.RequestHandler): <NEW_LINE> <INDENT> def get(self): <NEW_LINE> <INDENT> iteration_num = 0 <NEW_LINE> topics_num = 0 <NEW_LINE> words_num = 0 <NEW_LINE> for root, dirs, files, in os.walk('./data/'): <NEW_LINE> <INDENT> for f in files: <NEW_LINE> <INDENT> if str(f).find('lambda') >= 0: <N...
create or refresh Json file for LDA data.
62598f92d4950a0f3b110c6e
class GenomeResources(BaseModel): <NEW_LINE> <INDENT> reference_sequences: Optional[str] = None <NEW_LINE> annotations: Optional[str] = None
Genome resources to be used for mapping reads and annotating alignments. Args: reference_sequences: Path to FASTA file containing reference sequences to align reads against, typically chromosome sequences. annotations: Path to GTF file containing gene annotations for the `reference_sequences`. ...
62598f92e64d504609df91ec
class WParametersEditor(QWidget): <NEW_LINE> <INDENT> ParametersChanged = pyqtSignal(tuple) <NEW_LINE> def __init__(self, parent=None, specs=None, parameters=None): <NEW_LINE> <INDENT> QWidget.__init__(self, parent) <NEW_LINE> if parameters is not None: <NEW_LINE> <INDENT> assert isinstance(parameters, Parameters) <NEW...
Parameters editor widget. Arguments: parent=None specs=None -- list as [(name, {...}), ...], which will be passed to Parameters constructor. Parameter.FromSpec() for full documentation. parameters=None -- Parameters instance. If passed, ignores specs and sets internal parameters attribute directly
62598f9223849d37ff850d31
class AEReverseLayer(AbstractLayer): <NEW_LINE> <INDENT> def __init__(self, rng, sibling): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.sibling = sibling <NEW_LINE> in_size = sibling.in_size <NEW_LINE> dp_shape = self.sibling.layers['out'].output_shape <NEW_LINE> self.layers['in'] = ll.InputLayer( shape=sibli...
Une couche d'autoencodeur, côté décodeur Se construit à partir d'une couche d'encodeur
62598f92f7d966606f747c50
@test(depends_on_classes=[TestMultiNic], groups=[GROUP_TEST, "dbaas.guest.mysql"]) <NEW_LINE> class TestMysqlAccess(object): <NEW_LINE> <INDENT> def _mysql_error_handler(self, err): <NEW_LINE> <INDENT> pos_error = re.compile("ERROR 1130 \(HY000\): Host '[\w\.]*' is not allowed to connect to this MySQL server") <NEW_LIN...
Test Access to the mysql server as os_admin and root
62598f92b7558d589546329a
class NNEnsembleValueFunction(NNValueFunction): <NEW_LINE> <INDENT> def __init__(self, num_heads=2, *args, **kwargs): <NEW_LINE> <INDENT> assert num_heads > 0 <NEW_LINE> self.num_heads = num_heads <NEW_LINE> super().__init__(*args, **kwargs) <NEW_LINE> self.nn = nn.ModuleList( [NNValueFunction(*args, **kwargs) for _ in...
Implementation of a Value Function implemented with a Neural Network. Parameters ---------- dim_state: Tuple dimension of state. num_states: Tuple, optional number of discrete states (None if state is continuous). layers: list, optional width of layers, each layer is connected with a non-linearity. tau: fl...
62598f926aa9bd52df0d4b3a
class ptb_rum_single_tanh_config(object): <NEW_LINE> <INDENT> cell = "rum" <NEW_LINE> num_steps = 150 <NEW_LINE> learning_rate = 0.002 <NEW_LINE> T_norm = None <NEW_LINE> num_layers = 1 <NEW_LINE> init_scale = 0.01 <NEW_LINE> max_grad_norm = 1.0 <NEW_LINE> cell_size = 1000 <NEW_LINE> embed_size = 128 <NEW_LINE> max_epo...
PTB config.
62598f92a4f1c619b294e258
class ApplicationReferTable(LoginRequiredMixin, DetailView): <NEW_LINE> <INDENT> model = Application <NEW_LINE> template_name = 'applications/application_referrals_table.html' <NEW_LINE> def get(self, request, *args, **kwargs): <NEW_LINE> <INDENT> app = self.get_object() <NEW_LINE> context = {} <NEW_LINE> if app.routei...
A view for updating a draft (non-lodged) application.
62598f9226068e7796d4c5ce
class User(models.Model): <NEW_LINE> <INDENT> user = models.OneToOneField(authUser) <NEW_LINE> name = models.CharField(max_length=200) <NEW_LINE> points = models.PositiveSmallIntegerField(default=0) <NEW_LINE> def __str__(self): <NEW_LINE> <INDENT> return self.name
Class to model each user Each user has: name password current points scored collection of guess objects method to make a guess
62598f9271ff763f4b5e73e3
class Data(UserDict): <NEW_LINE> <INDENT> __roles__ = None <NEW_LINE> __allow_access_to_unprotected_subobjects__ = 1
We use this as to escape some vagaries with the zope security policy when using the __getitem__ interface of the binding
62598f92e76e3b2f99fd86a4
class Definition(object): <NEW_LINE> <INDENT> _field1 = 18 <NEW_LINE> _field2 = 25 <NEW_LINE> _field3 = 78 - _field1 - _field2 <NEW_LINE> _fmt_str_ = "Name:'%%%ds', Description:'%%%ds', File:'%%%ds'" % ( _field1, _field2, _field3 ) <NEW_LINE> _cmp_attributes = ["name", "description", "filename"] <NEW_LINE> def __init__...
Class to represent a target element definition. A target element definition could be the definition of the architecture, the microarchitecture or the environment. In all three cases a definition is composed by the definition name, the filename (where in the file system the definition is located) and the description.
62598f92596a8972361278e9
class Solution: <NEW_LINE> <INDENT> def shortestPath(self, grid, source, destination): <NEW_LINE> <INDENT> if not grid or not source or not destination: <NEW_LINE> <INDENT> return -1 <NEW_LINE> <DEDENT> if grid[source.x][source.y] == 1 or grid[destination.x][destination.y] == 1: <NEW_LINE> <INDENT> return -1 <NEW_LINE>...
@param grid: a chessboard included 0 (false) and 1 (true) @param source: a point @param destination: a point @return: the shortest path
62598f92adb09d7d5dc0a1f4
class ScalingCommand(CommandBase): <NEW_LINE> <INDENT> def __init__(self, ix, iy, ox, oy, dir_x, dir_y, mat): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.op = 'SCALING' <NEW_LINE> self.__ix = ix <NEW_LINE> self.__iy = iy <NEW_LINE> self.__x = ix <NEW_LINE> self.__y = iy <NEW_LINE> self.__ox = ox <NEW_LINE> s...
Custom class: Scaling operation
62598f92a79ad16197769ccd
class Action(models.Model): <NEW_LINE> <INDENT> title = models.CharField(max_length = 150, unique = True,) <NEW_LINE> slug = models.SlugField(unique=True) <NEW_LINE> start_date = models.DateTimeField(default=datetime.datetime.now()) <NEW_LINE> expire_date = models.DateTimeField() <NEW_LINE> description = models.TextF...
klasa dla akcji. Na dzien 26 kwietnia 2013, nowe akcje moze uruchamiac tylko admin
62598f927d847024c075c03f
class AftHalfTriangularPressureElement(PressureElement): <NEW_LINE> <INDENT> plot_color = "g" <NEW_LINE> def __init__(self, is_on_body: bool = True, **kwargs: Any) -> None: <NEW_LINE> <INDENT> super().__init__(is_on_body=is_on_body, **kwargs) <NEW_LINE> <DEDENT> @property <NEW_LINE> def width(self) -> float: <NEW_LINE>...
Pressure element that is triangular in profile but towards aft direction.
62598f92a17c0f6771d5bea9
class Command(object): <NEW_LINE> <INDENT> command = None <NEW_LINE> process = None <NEW_LINE> status = None <NEW_LINE> output, error = '', '' <NEW_LINE> def __init__(self, command): <NEW_LINE> <INDENT> if isinstance(command, basestring): <NEW_LINE> <INDENT> command = shlex.split(command) <NEW_LINE> <DEDENT> self.comma...
Enables to run subprocess commands in a different thread with TIMEOUT option.
62598f929b70327d1c57ea0f
class Type(models.Model): <NEW_LINE> <INDENT> title = models.CharField(max_length=255) <NEW_LINE> slug = models.SlugField() <NEW_LINE> still = models.FileField(upload_to='document_type_stills', blank=True, help_text='An image that will be used as a thumbnail.') <NEW_LINE> description = models.TextField(blank=True) <NEW...
Document model
62598f92ac7a0e7691f7217a
class List_of_upgrades(db.Entity): <NEW_LINE> <INDENT> scope = Required(str) <NEW_LINE> handle = Required(str) <NEW_LINE> mag = Required(int) <NEW_LINE> type_of_mag = Required(str) <NEW_LINE> type_of_bulets = Required(str) <NEW_LINE> cur_wepons = Set("Cur_wepon")
Class List_of_upgrages is responsible for the list of modifications for each weapon He takes data on possible modifications from the database, which will be connected to the project :param scope: This parameter is responsible for the scope that can be installed. :type scope: str :param handle: This parameter i...
62598f920383005118f6d369
class ApproveFriendRequestResultSet(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. (The response from Foursquare. Corresponds to the ResponseFormat input. Defaults to JSON.)
62598f92b5575c28eb712b04
class CanvasWidgetDelegate(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def _repaint(self, drawing_context, canvas_size): <NEW_LINE> <INDENT> canvas_width = canvas_size.width <NEW_LINE> canvas_height = canvas_size.height <NEW_LINE> drawing_context.save() <NEW_LINE> drawi...
Draws our example canvas; roughly based no HTML5 canvas API.
62598f92462c4b4f79dbb675
class AddProblem(HelperView): <NEW_LINE> <INDENT> @method_decorator(login_required) <NEW_LINE> @method_decorator(user_passes_test(is_activated, login_url="/problems/accounts/activate/")) <NEW_LINE> def get(self, request): <NEW_LINE> <INDENT> problem_form = ProblemForm() <NEW_LINE> content_form = ContentForm() <NEW_LINE...
A class for managing requests made to the Add Problem page
62598f92b830903b9686e2ab
class Event: <NEW_LINE> <INDENT> def __init__(self, payload): <NEW_LINE> <INDENT> self.payload = payload
A response from whisper notifying the user some event occurred.
62598f928c0ade5d55dc34c4
class HelpTextParser(object): <NEW_LINE> <INDENT> def __init__(self, path): <NEW_LINE> <INDENT> self._path = path <NEW_LINE> self._help_text = None <NEW_LINE> <DEDENT> def read(self, lines): <NEW_LINE> <INDENT> if not lines: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> expect_option = True <NEW_LINE> option = None <N...
Class to parse help text from file and make it available to option parser.
62598f920a50d4780f705043
class TransactionList(generics.ListCreateAPIView): <NEW_LINE> <INDENT> model = Transaction <NEW_LINE> serializer_class = TransactionSerializer
API endpoint that represents a list of transaction.
62598f92e5267d203ee6b58a
class App(): <NEW_LINE> <INDENT> nlp = nlp.NLP() <NEW_LINE> slackClient: slack.SlackClient = None <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> self.slackClient = slack.SlackClient( token=os.environ[constant.BOT_ACCESS_TOKEN], onMessageFn=self.onMessage, ) <NEW_LINE> <DEDENT> def start(self): <NEW_LINE> <INDENT> s...
Primary instance for refined-bot, glues together the components.
62598f92dd821e528d6d8ba2
class TransferModel(nn.Module): <NEW_LINE> <INDENT> def __init__(self, modelchoice, num_out_classes=2, dropout=0.0): <NEW_LINE> <INDENT> super(TransferModel, self).__init__() <NEW_LINE> self.modelchoice = modelchoice <NEW_LINE> if modelchoice == 'xception': <NEW_LINE> <INDENT> self.model = return_pytorch04_xception() <...
Simple transfer learning model that takes an imagenet pretrained model with a fc layer as base model and retrains a new fc layer for num_out_classes
62598f92442bda511e95c0d2
class ThreeForTwo(quicktill.modifiers.SimpleModifier): <NEW_LINE> <INDENT> def mod_stockline(self, stockline, sale): <NEW_LINE> <INDENT> if not sale.price: <NEW_LINE> <INDENT> raise quicktill.modifiers.Incompatible("No price is set") <NEW_LINE> <DEDENT> sale.price = sale.price * Decimal(2) <NEW_LINE> sale.qty = sale.qt...
Three for the price of two
62598f92596a8972361278eb
class CreateLiveCallbackTemplateRequest(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.TemplateName = None <NEW_LINE> self.Description = None <NEW_LINE> self.StreamBeginNotifyUrl = None <NEW_LINE> self.StreamEndNotifyUrl = None <NEW_LINE> self.RecordNotifyUrl = None <NEW_LINE> self.Sna...
CreateLiveCallbackTemplate请求参数结构体
62598f920c0af96317c55ff4
class State(BaseModel): <NEW_LINE> <INDENT> name = ""
temp
62598f92d7e4931a7ef3bd11
class Project(Redmine_Item): <NEW_LINE> <INDENT> id = None <NEW_LINE> name = None <NEW_LINE> identifier = None <NEW_LINE> parent = None <NEW_LINE> homepage = None <NEW_LINE> created_on = None <NEW_LINE> updated_on = None <NEW_LINE> _protected_attr = ['id', 'created_on', 'updated_on', 'identifier', ] <NEW_LINE> _field_t...
Object representing a Redmine project.
62598f92c432627299fa2c41
class CiholasSerialNumber(): <NEW_LINE> <INDENT> def __init__(self, value=0): <NEW_LINE> <INDENT> if isinstance(value, CiholasSerialNumber): <NEW_LINE> <INDENT> self.as_int = value.as_int <NEW_LINE> <DEDENT> elif isinstance(value, str): <NEW_LINE> <INDENT> self.as_int = (int)(value.replace(":", ""), 16) <NEW_LINE> <DED...
Ciholas Serial Number Class Definition
62598f92d486a94d0ba2bc42
class UserState(PersistState): <NEW_LINE> <INDENT> def __init__(self, username): <NEW_LINE> <INDENT> self.datadir = datadir + os.sep + 'users' + os.sep + username <NEW_LINE> PersistState.__init__(self, self.datadir + os.sep + 'state')
state for users.
62598f921f037a2d8b9e3d50
class BaseWebServer(object): <NEW_LINE> <INDENT> __metaclass__ = ABCMeta <NEW_LINE> @abstractmethod <NEW_LINE> def get_directories(self, site_name, virt_path): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> @abstractmethod <NEW_LINE> def get_server_node(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> @staticmethod <N...
Abstract base class for web server api
62598f92be8e80087fbbeccc
class EisensteinExtensionRingCappedAbsolute(EisensteinExtensionGeneric, pAdicCappedAbsoluteRingGeneric): <NEW_LINE> <INDENT> def __init__(self, exact_modulus, poly, prec, print_mode, shift_seed, names, implementation): <NEW_LINE> <INDENT> unram_prec = (prec + poly.degree() - 1) // poly.degree() <NEW_LINE> ntl_poly = nt...
TESTS:: sage: R = ZpCA(3, 10000, print_pos=False); S.<x> = ZZ[]; f = x^3 + 9*x - 3 sage: W.<w> = R.ext(f) sage: TestSuite(R).run(skip='_test_log',max_runs=4)
62598f9207f4c71912baf0ba
class Net3(nn.Module): <NEW_LINE> <INDENT> def __init__(self, nChannels, args, cnn_kwargs): <NEW_LINE> <INDENT> super(Net3, self).__init__() <NEW_LINE> self.args = args <NEW_LINE> self.main = nn.Sequential( nn.Linear(self.args.x_fdim2, self.args.x_fdim1), nn.LeakyReLU(negative_slope=0.2), nn.Linear(self.args.x_fdim1, s...
Decoder - network architecture
62598f9291af0d3eaad39a76
class IP: <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def is_ip(cls, ip: str) -> bool: <NEW_LINE> <INDENT> return cls.is_ipv4(ip) or cls.is_ipv6(ip) <NEW_LINE> <DEDENT> @staticmethod <NEW_LINE> def is_ipv4(ip: str) -> bool: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> ipaddress.IPv4Address(ip) <NEW_LINE> <DEDENT> excep...
Basics checks of an ip adress.
62598f9216aa5153ce400170
class WriterSerializerAdd(serializers.Serializer): <NEW_LINE> <INDENT> name = serializers.CharField(max_length=100) <NEW_LINE> surname = serializers.CharField(max_length=100) <NEW_LINE> city = serializers.CharField(max_length=255) <NEW_LINE> birth_date = serializers.DateField(validators=[birth_date_validator])
валидатор функции добавления писателя
62598f92d58c6744b42dc106
class L_Width(aloha_lib.LorentzObject): <NEW_LINE> <INDENT> def __init__(self, name, particle): <NEW_LINE> <INDENT> self.particle = particle <NEW_LINE> aloha_lib.LorentzObject.__init__(self, name, [], []) <NEW_LINE> <DEDENT> def create_representation(self): <NEW_LINE> <INDENT> width = aloha_lib.DVariable('W%s' % self.p...
Helas Object for an Impulsion
62598f9223e79379d538c175
class LEAF_F(CPUID): <NEW_LINE> <INDENT> leaf = 0xF <NEW_LINE> def __getitem__(self, subleaf): <NEW_LINE> <INDENT> if subleaf == 0: <NEW_LINE> <INDENT> return self.read(self.apicid, subleaf) <NEW_LINE> <DEDENT> elif subleaf == 1: <NEW_LINE> <INDENT> return LEAF_F_1.read(self.apicid, subleaf) <NEW_LINE> <DEDENT> return ...
Quality of Service Resource Type Enumeration Sub-Leaf and L3 Cache QoS Capability Enumeration Sub-leaf. Depends on value of ECX Returns Quality of Service (QoS) Enumeration Information.
62598f923617ad0b5ee05dbb
class TestData45(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 testData45(self): <NEW_LINE> <INDENT> pass
Data45 unit test stubs
62598f92097d151d1a2c0c9c