code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
class Piecewise(SympyFunction): <NEW_LINE> <INDENT> sympy_name = 'Piecewise' <NEW_LINE> def prepare_sympy(self, leaves): <NEW_LINE> <INDENT> if len(leaves) == 1: <NEW_LINE> <INDENT> return leaves[0] <NEW_LINE> <DEDENT> if len(leaves) == 2: <NEW_LINE> <INDENT> return leaves[0].leaves + [ Expression('List', leaves[1], Sy...
<dl> <dt>'Piecewise[{{expr1, cond1}, ...}]' <dd>represents a piecewise function. <dt>'Piecewise[{{expr1, cond1}, ...}, expr]' <dd>represents a piecewise function with default 'expr'. </dl> Heaviside function >> Piecewise[{{0, x <= 0}}, 1] = Piecewise[{{0, x <= 0}}, 1]
62599030cad5886f8bdc58c3
@skipIf(not HAS_CERTS, 'Cannot find CA cert bundle') <NEW_LINE> @skipIf(NO_MOCK, NO_MOCK_REASON) <NEW_LINE> @patch('salt.cloud.clouds.gce.__virtual__', MagicMock(return_value='gce')) <NEW_LINE> @patch('libcloud.common.google.GoogleInstalledAppAuthConnection.get_new_token', MagicMock(return_value=DUMMY_TOKEN)) <NEW_LINE...
Unit TestCase for salt.cloud.clouds.gce module.
625990303eb6a72ae038b6f6
class BaseControllerTest(test_base.ArmadaTestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> super(BaseControllerTest, self).setUp() <NEW_LINE> current_dir = os.path.dirname(os.path.realpath(__file__)) <NEW_LINE> sample_conf_dir = os.path.join(current_dir, os.pardir, os.pardir, os.pardir, os.pardir, 'et...
Base class for unit testing falcon controllers.
625990301d351010ab8f4ba8
class AddPostTests(TestCase): <NEW_LINE> <INDENT> def test_true_forms(self): <NEW_LINE> <INDENT> ad_user = User.objects.create(username="Bob") <NEW_LINE> day = datetime.datetime.now() <NEW_LINE> my_data = copy.deepcopy(form_data) <NEW_LINE> my_data.update({'ad_user': ad_user, 'day': day}) <NEW_LINE> print(my_data) <NEW...
Тест формы PostForm.
62599030be8e80087fbc010d
class InterfaceDuplexModeEvent_registerIDL_args(object): <NEW_LINE> <INDENT> thrift_spec = (None, (1, TType.I32, 'sessionHandle', None, None), (2, TType.I64, 'xosHandle', None, None), (3, TType.I32, 'interfaceType', None, None)) <NEW_LINE> def __init__(self, sessionHandle = None, xosHandle = None, interfaceType = None)...
Attributes: - sessionHandle - xosHandle - interfaceType
62599030ec188e330fdf9924
class Seller(scrapy.Item): <NEW_LINE> <INDENT> platform_code = scrapy.Field(primary_key=True, foreign_key=True) <NEW_LINE> seller_id = scrapy.Field(primary_key=True) <NEW_LINE> market_id = scrapy.Field() <NEW_LINE> seller_name = scrapy.Field() <NEW_LINE> seller_contact_wangwang = scrapy.Field() <NEW_LINE> seller_contac...
货源网站卖家信息
62599030ac7a0e7691f73579
class CompareFaceRequest(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.ImageA = None <NEW_LINE> self.ImageB = None <NEW_LINE> self.UrlA = None <NEW_LINE> self.UrlB = None <NEW_LINE> <DEDENT> def _deserialize(self, params): <NEW_LINE> <INDENT> self.ImageA = params.get("ImageA") <NEW_LI...
CompareFace请求参数结构体
6259903015baa7234946302a
class RubiksAction(object): <NEW_LINE> <INDENT> RIGHTC = 0 <NEW_LINE> RIGHTAC = 1 <NEW_LINE> LEFTC = 2 <NEW_LINE> LEFTAC = 3 <NEW_LINE> UPC = 4 <NEW_LINE> UPAC = 5 <NEW_LINE> DOWNC = 6 <NEW_LINE> DOWNAC = 7 <NEW_LINE> FRONTC = 8 <NEW_LINE> FRONTAC = 9 <NEW_LINE> BACKC = 10 <NEW_LINE> BACKAC = 11
Defines all possible actions the agent can take in the environment.
62599030a8ecb033258722af
class CDataModel: <NEW_LINE> <INDENT> __swig_setmethods__ = {} <NEW_LINE> __setattr__ = lambda self, name, value: _swig_setattr(self, CDataModel, name, value) <NEW_LINE> __swig_getmethods__ = {} <NEW_LINE> __getattr__ = lambda self, name: _swig_getattr(self, CDataModel, name) <NEW_LINE> def __init__(self, *args, **kwar...
Proxy of C++ CDataModel class
625990305166f23b2e244468
class DerivedParameters(parametertools.SubParameters): <NEW_LINE> <INDENT> _PARCLASSES = (arma_derived.Nmb, arma_derived.MaxQ, arma_derived.DiffQ, arma_derived.AR_Order, arma_derived.MA_Order, arma_derived.AR_Coefs, arma_derived.MA_Coefs)
Derived parameters of arma_v1, indirectly defined by the user.
62599030d99f1b3c44d06735
class caMeta(object): <NEW_LINE> <INDENT> def __init__(self, dbf, units='', stamp=0.0, status=0, severity=0, precision=0, **kwargs): <NEW_LINE> <INDENT> self.dbf, self.units, self.stamp=dbf, units, stamp <NEW_LINE> self.status, self.severity = status, severity <NEW_LINE> self.precision=precision <NEW_LINE> l=dbf_defaul...
Represents the meta-information associated with a DBR value. This includes alarm status/severity, as well as other types. The parameters given to the constructor can also be accessed as data members. :param same_as_value dbf: The field type :param str units: engineering units :param float stamp: Time in seconds since ...
6259903050485f2cf55dc00f
class RegisteredUsers(ndb.Model): <NEW_LINE> <INDENT> userName = ndb.StringProperty() <NEW_LINE> mainEmail = ndb.StringProperty() <NEW_LINE> userAddress = ndb.StringProperty() <NEW_LINE> orgKey = ndb.KeyProperty(kind=Organization) <NEW_LINE> isOwner = ndb.KeyProperty() <NEW_LINE> isPrincipal = ndb.KeyProperty() <NEW_LI...
RegisteredUsers -- User profile object
6259903026238365f5fadbe5
class scatterChart(NVD3Chart): <NEW_LINE> <INDENT> def __init__(self, height=450, width=None, **kwargs): <NEW_LINE> <INDENT> NVD3Chart.__init__(self, **kwargs) <NEW_LINE> self.create_x_axis('xAxis', format=".02f") <NEW_LINE> self.create_y_axis('yAxis', format=".02f") <NEW_LINE> if height: <NEW_LINE> <INDENT> self.set_g...
A scatter plot or scattergraph is a type of mathematical diagram using Cartesian coordinates to display values for two variables for a set of data. The data is displayed as a collection of points, each having the value of one variable determining the position on the horizontal axis and the value of the other variable d...
625990303eb6a72ae038b6f8
class CentosClientBuilder(LinuxClientBuilder): <NEW_LINE> <INDENT> def CopyFiles(self): <NEW_LINE> <INDENT> shutil.move( os.path.join(self.package_dir, "debian"), os.path.join(self.package_dir, "rpmbuild")) <NEW_LINE> if self.fleetspeak_enabled: <NEW_LINE> <INDENT> rpm_spec_filename = "fleetspeak.grr.spec.in" <NEW_LINE...
A builder class that produces a client for RPM based distros.
625990308c3a8732951f75eb
class TokenForm(object): <NEW_LINE> <INDENT> def __init__(self, **kwargs): <NEW_LINE> <INDENT> self.token = None <NEW_LINE> replace_names = { "token": "token", } <NEW_LINE> if kwargs is not None: <NEW_LINE> <INDENT> for key in kwargs: <NEW_LINE> <INDENT> if key in replace_names: <NEW_LINE> <INDENT> setattr(self, replac...
Implementation of the 'Token Form' model. TODO: type model description here. Attributes: token (Token): TODO: type description here.
625990304e696a045264e66b
class CompressImage(ProcessBase): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> ProcessBase.__init__(self) <NEW_LINE> self.extensions = ['jpg', 'jpeg', 'png'] <NEW_LINE> <DEDENT> def processfile(self, filename): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> with open(filename, 'rb') as file: <NEW_LINE> <IN...
Processor which attempts to reduce image file size.
62599030d6c5a102081e31b8
class State(Base): <NEW_LINE> <INDENT> __tablename__ = 'states' <NEW_LINE> id = Column(Integer, nullable=False, primary_key=True, autoincrement=True) <NEW_LINE> name = Column(String(128), nullable=False) <NEW_LINE> cities = relationship("City", backref="cities")
Class representing the `states` table. Columns: id (int): /NOT NULL/AUTO_INCREMENT/PRIMARY_KEY/ name (string): /VARCHAR(128)/NOT NULL/
625990308e05c05ec3f6f6a5
class TimeInWeek(msrest.serialization.Model): <NEW_LINE> <INDENT> _attribute_map = { 'day': {'key': 'day', 'type': 'str'}, 'hour_slots': {'key': 'hourSlots', 'type': '[int]'}, } <NEW_LINE> def __init__( self, *, day: Optional[Union[str, "WeekDay"]] = None, hour_slots: Optional[List[int]] = None, **kwargs ): <NEW_LINE> ...
Time in a week. :ivar day: The day of the week. Possible values include: "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday". :vartype day: str or ~azure.mgmt.containerservice.v2021_07_01.models.WeekDay :ivar hour_slots: Each integer hour represents a time range beginning at 0m after the hour...
62599030c432627299fa4089
class UserProfileManager(models.Manager, Searchable): <NEW_LINE> <INDENT> def get_query_set(self): <NEW_LINE> <INDENT> return super(UserProfileManager, self).get_query_set().filter( user__is_active=True )
A custom manager to add functionallity related to table level of :model:`user_profile.UserProfile`.
62599030d10714528d69eed5
class PlansViewSet(viewsets.ModelViewSet): <NEW_LINE> <INDENT> queryset = Plans.objects.all() <NEW_LINE> serializer_class = PlanSerializer <NEW_LINE> permission_classes = (permissions.IsAuthenticatedOrReadOnly,) <NEW_LINE> def list(self, request, *args, **kwargs): <NEW_LINE> <INDENT> orgid = self.kwargs['orgid'] <NEW_L...
API 套餐处理函数
625990305e10d32532ce414d
class OpenSSLStreamCrypto(OpenSSLCryptoBase): <NEW_LINE> <INDENT> def __init__(self, cipher_name, key, iv, op): <NEW_LINE> <INDENT> super(OpenSSLStreamCrypto, self).__init__(cipher_name) <NEW_LINE> key_ptr = c_char_p(key) <NEW_LINE> iv_ptr = c_char_p(iv) <NEW_LINE> r = libcrypto.EVP_CipherInit_ex(self._ctx, self._ciphe...
Crypto for stream modes: cfb, ofb, ctr
62599030cad5886f8bdc58c5
class ModelInput(BaseModel): <NEW_LINE> <INDENT> inputs: Union[List, Dict]
Pydantic Model to receive parameters for the /predict endpoint
6259903026238365f5fadbe7
class EventRuleBase(Base): <NEW_LINE> <INDENT> event_rule: EventRule
CloudWatchEvents基底class
6259903023e79379d538d59f
class CommandError(Exception): <NEW_LINE> <INDENT> pass
Raised when a command encouters an error that can be resolved by the user. This is also the base class for exceptions in this package.
625990309b70327d1c57fe19
class AlbuDataGenerator(keras.utils.Sequence): <NEW_LINE> <INDENT> def __init__(self, images, masks, batch_size, nn_image_size, shuffle, mode, params, mean, use_ceil=False): <NEW_LINE> <INDENT> self.images = images <NEW_LINE> self.masks = masks <NEW_LINE> self.batch_size = batch_size <NEW_LINE> self.nn_image_size = nn_...
Generates data for Keras
6259903030c21e258be998a1
class BaseAgent(metaclass=ABCMeta): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.solution = [] <NEW_LINE> self.fitness = np.inf <NEW_LINE> <DEDENT> def __eq__(self, value): <NEW_LINE> <INDENT> if isinstance(value, BaseAgent): <NEW_LINE> <INDENT> return self.fitness == value.fitness <NEW_LINE> <DEDEN...
Abstract base class for all swarm agents.
62599030d4950a0f3b111688
class StringLabel(StringType): <NEW_LINE> <INDENT> pass
Type representing an label being a string with class name (e.g. the "hamster" class in CIFAR100).
62599030a8ecb033258722b3
class AddStar(): <NEW_LINE> <INDENT> def __init__(self, selected_classes=None, prob=0.5, L_range=[0,100], var_range=[1,3], verbose=0): <NEW_LINE> <INDENT> self.selected_classes = selected_classes <NEW_LINE> self.prob = prob <NEW_LINE> self.mean_range = L_range <NEW_LINE> self.var_range = var_range <NEW_LINE> self.verbo...
With a given probability, add a foreground star to the input image. Parameters ---------- selected_classes : list or None, default None Labels of classes to which this augmentation should be applied. Should be None for regression. prob : float, default 0.5 Probability that a foreground star is added....
62599030d10714528d69eed6
class alter_table_args: <NEW_LINE> <INDENT> thrift_spec = ( None, (1, TType.STRING, 'dbname', None, None, ), (2, TType.STRING, 'tbl_name', None, None, ), (3, TType.STRUCT, 'new_tbl', (Table, Table.thrift_spec), None, ), ) <NEW_LINE> def __init__(self, dbname=None, tbl_name=None, new_tbl=None,): <NEW_LINE> <INDENT> self...
Attributes: - dbname - tbl_name - new_tbl
625990305e10d32532ce414e
class Solution2: <NEW_LINE> <INDENT> def majority_element(self, nums): <NEW_LINE> <INDENT> return sorted(nums)[len(nums) // 2]
解法2:对数组进行排序,取索引为⌊n/2⌋的数字 时间复杂度:O(n * logn) 空间复杂度:O(n) or O(1), 取决于是否可以直接对数组进行排序
62599030cad5886f8bdc58c6
class Cache(fixtures.Fixture): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> super(Cache, self).setUp() <NEW_LINE> if cache.CACHE_REGION.is_configured: <NEW_LINE> <INDENT> del cache.CACHE_REGION.backend <NEW_LINE> <DEDENT> cache.configure_cache()
A fixture for setting up and tearing down the cache between test cases.
62599030287bf620b6272c7e
class ImageHandler(BaseHandler): <NEW_LINE> <INDENT> def get(self): <NEW_LINE> <INDENT> image_id = self.request.query <NEW_LINE> image = getImage(image_id) <NEW_LINE> self.set_header("Content-Type", 'image/jpeg') <NEW_LINE> self.write(image)
Render the Image
625990306fece00bbaccca46
class Blog(models.Model): <NEW_LINE> <INDENT> title = models.CharField(max_length=64) <NEW_LINE> theme = models.CharField(max_length=32) <NEW_LINE> def __str__(self): <NEW_LINE> <INDENT> return self.title <NEW_LINE> <DEDENT> class Meta: <NEW_LINE> <INDENT> verbose_name = '博客' <NEW_LINE> verbose_name_plural = verbose_na...
博客信息表
625990304e696a045264e66d
class DotDict(dict): <NEW_LINE> <INDENT> def __init__(self, value=None): <NEW_LINE> <INDENT> if value is None: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> elif isinstance(value, dict): <NEW_LINE> <INDENT> for key in value: <NEW_LINE> <INDENT> self.__setitem__(key, value[key]) <NEW_LINE> <DEDENT> <DEDENT> else: <NEW_LI...
Dictionary class supporting keys like "a.b.c" for nested dictionaries From http://stackoverflow.com/questions/3797957 - RM added get() - MVM added __deepcopy__() Supports get() with a dotted key and a default, e.g. config.get('fruit.apple.type', 'delicious') as well as creating dotted keys when no keys in the pa...
62599030d6c5a102081e31bc
class Square: <NEW_LINE> <INDENT> pass
Empty square class defining square
625990301f5feb6acb163c88
class UnresolvableName(InferenceError): <NEW_LINE> <INDENT> pass
raised when we are unable to resolve a name
62599030cad5886f8bdc58c7
class dwiextract(BaseMtrixCLI): <NEW_LINE> <INDENT> exe = 'dwiextract' <NEW_LINE> class Flags(BaseMtrixCLI.Flags): <NEW_LINE> <INDENT> bzero = '-bzero'
The dwiextract command from the mtrix package.
6259903026238365f5fadbeb
class FoodConfig(Config): <NEW_LINE> <INDENT> NAME = "Foods" <NEW_LINE> GPU_COUNT = 1 <NEW_LINE> IMAGES_PER_GPU = 8 <NEW_LINE> NUM_CLASSES = 1 + 40 <NEW_LINE> STEPS_PER_EPOCH = 50 <NEW_LINE> BACKBONE = 'resnet50' <NEW_LINE> RPN_ANCHOR_SCALES = (16, 32, 64, 128, 256)
Configuration for training on the cigarette butts dataset. Derives from the base Config class and overrides values specific to the cigarette butts dataset.
6259903066673b3332c31489
class SQLAlchemyHandler(logging.Handler): <NEW_LINE> <INDENT> def emit(self, record): <NEW_LINE> <INDENT> trace = None <NEW_LINE> exc = record.__dict__['exc_info'] <NEW_LINE> if exc: <NEW_LINE> <INDENT> trace = traceback.format_exc() <NEW_LINE> <DEDENT> log = Log( logger=record.__dict__['name'], level=record.__dict__['...
Logging handler for SQLAlchemy
625990301d351010ab8f4bb0
class Stemmer: <NEW_LINE> <INDENT> def __init__(self, stemmer_type='snowball'): <NEW_LINE> <INDENT> self.stemmer_type = stemmer_type <NEW_LINE> if self.stemmer_type == 'porter': <NEW_LINE> <INDENT> self.stemmer = nltk.stem.PorterStemmer() <NEW_LINE> <DEDENT> elif self.stemmer_type == 'snowball': <NEW_LINE> <INDENT> sel...
Convert uppercase to lowercase Delete common endings of words Can't delete white space and (new line character) Can't deal with Lemmatization. Ex. working => work In generally, snowball is better than porter. So snowball method will be default.
6259903021bff66bcd723cfe
class Log(object): <NEW_LINE> <INDENT> ON=True <NEW_LINE> FLUSH=True <NEW_LINE> def __init__(self,dir=None,name=None): <NEW_LINE> <INDENT> self.dir=dir <NEW_LINE> self.name=name <NEW_LINE> self.fout=None <NEW_LINE> <DEDENT> def reset(self,name): <NEW_LINE> <INDENT> self.close() <NEW_LINE> self.name=name <NEW_LINE> <DED...
The log for code executing. Attributes ---------- dir : str The directory where to store the log file. name : str The name of the log file. fout : file The log file. Notes ----- When the log file is the stdout, the attribute `name` is set to be None.
62599030a4f1c619b294f68f
class check_command(special_both): <NEW_LINE> <INDENT> def __init__(self, special_base): <NEW_LINE> <INDENT> super(check_command, self).__init__(special_base, 'check_command') <NEW_LINE> <DEDENT> def lookup(self, bindings, pat_context, patterns): <NEW_LINE> <INDENT> if len(patterns) < 1: return knowledge_base.Gen_empty...
>>> from pyke import pattern, contexts >>> class stub(object): ... def add_fn(self, fn): pass >>> cc = check_command(stub()) >>> ctxt = contexts.simple_context() >>> mgr = cc.lookup(ctxt, ctxt, (pattern.pattern_literal(('true',)),)) >>> gen = iter(mgr.__enter__()) >>> next(gen) >>> ctxt.dump() >>> next(gen) Traceba...
62599030ac7a0e7691f73581
class ResourceIdInfo(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.ClusterId = None <NEW_LINE> self.InstanceIdSet = None <NEW_LINE> <DEDENT> def _deserialize(self, params): <NEW_LINE> <INDENT> self.ClusterId = params.get("ClusterId") <NEW_LINE> self.InstanceIdSet = params.get("Instanc...
资源ID信息,包括ClusterID和InstanceID
6259903015baa72349463032
class PostAdmin(admin.ModelAdmin): <NEW_LINE> <INDENT> list_display = ('title','created','publish') <NEW_LINE> list_filter = ('created',) <NEW_LINE> search_fields = ('title',) <NEW_LINE> prepopulated_fields = {'slug': ('title',)}
Admin View for Post
625990306e29344779b016e9
class TextSessionStateExporter(SessionStateExporterBase): <NEW_LINE> <INDENT> def __init__(self, option_list=None, color=None, exporter_unit=None): <NEW_LINE> <INDENT> super().__init__(option_list, exporter_unit=exporter_unit) <NEW_LINE> self.C = Colorizer(color) <NEW_LINE> <DEDENT> def get_session_data_subset(self, se...
Human-readable session state exporter.
6259903091af0d3eaad3aec6
class Softmax(function_node.FunctionNode): <NEW_LINE> <INDENT> def __init__(self, axis=1): <NEW_LINE> <INDENT> self.axis = axis <NEW_LINE> <DEDENT> def check_type_forward(self, in_types): <NEW_LINE> <INDENT> type_check._argname(in_types, ('x',)) <NEW_LINE> x_type, = in_types <NEW_LINE> type_check.expect( x_type.dtype.k...
Softmax activation function.
6259903073bcbd0ca4bcb32b
class EDTestCasePluginExecuteExecAimlessLog2Csvv1_0(EDTestCasePluginExecute): <NEW_LINE> <INDENT> def __init__(self, _strTestName=None): <NEW_LINE> <INDENT> EDTestCasePluginExecute.__init__(self, "EDPluginExecAimlessLog2Csvv1_0") <NEW_LINE> self.setDataInputFile(os.path.join(self.getPluginTestsDataHome(), ...
Those are all execution tests for the EDNA Exec plugin dimple
625990306fece00bbaccca49
class TestNodeStateSmartfail(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 testNodeStateSmartfail(self): <NEW_LINE> <INDENT> pass
NodeStateSmartfail unit test stubs
6259903030c21e258be998a7
class Unit: <NEW_LINE> <INDENT> def __init__(self, unit_name, unit): <NEW_LINE> <INDENT> self.unit_name = unit_name <NEW_LINE> self.unit = unit <NEW_LINE> <DEDENT> @property <NEW_LINE> def agent_state(self): <NEW_LINE> <INDENT> return self.unit.get('AgentState', 'unknown') <NEW_LINE> <DEDENT> @property <NEW_LINE> def w...
Unit class
62599030d4950a0f3b11168b
class WebSocket(object): <NEW_LINE> <INDENT> def __init__(self, handler): <NEW_LINE> <INDENT> self.handler = handler <NEW_LINE> self.tornado_handler = None <NEW_LINE> <DEDENT> async def __call__(self, environ): <NEW_LINE> <INDENT> self.tornado_handler = environ['tornado.handler'] <NEW_LINE> self.environ = environ <NEW_...
This wrapper class provides a tornado WebSocket interface that is somewhat compatible with eventlet's implementation.
625990304e696a045264e66f
class PneumoniaClassify(Dataset): <NEW_LINE> <INDENT> def __init__(self, csv_file, root_dir, transform=None): <NEW_LINE> <INDENT> self.label = pd.read_csv(csv_file) <NEW_LINE> self.root_dir = root_dir <NEW_LINE> self.transform = transform <NEW_LINE> <DEDENT> def __len__(self): <NEW_LINE> <INDENT> return len(self.label)...
Pneumonia Detection & Localization dataset.
62599030ec188e330fdf992f
class CustomScheduler(object): <NEW_LINE> <INDENT> def __init__(self, max_computes=1): <NEW_LINE> <INDENT> self.max_computes = max_computes <NEW_LINE> self.total_computes = 0 <NEW_LINE> <DEDENT> def __call__(self, dsk, keys, **kwargs): <NEW_LINE> <INDENT> import dask <NEW_LINE> self.total_computes += 1 <NEW_LINE> if se...
Custom dask scheduler that raises an exception if dask is computed too many times.
6259903015baa72349463034
class LLR_slow(ParametrizedTransformation): <NEW_LINE> <INDENT> def _get_par(self, datao): <NEW_LINE> <INDENT> gaussiane = [ estimate_gaussian_per_class(datao, at, common_if_extreme=True) for at in range(len(datao.domain.attributes)) ] <NEW_LINE> normalizec = [] <NEW_LINE> for i,g in zip(range(len(datao.domain.attribut...
Slow and rough implementation of LLR (testing correctness).
62599030d164cc617582200e
class SomeModel(model.Model): <NEW_LINE> <INDENT> string = basestring, {'repeated': True} <NEW_LINE> integer = int
Some sample model
62599030d99f1b3c44d0673f
class KadetTestObjExtendedNewKwargs(KadetTestObj): <NEW_LINE> <INDENT> def new(self): <NEW_LINE> <INDENT> super().new_with(name="test-with-new", size=12)
KadetTestObjExtendedNewKwargs.
6259903050485f2cf55dc019
class Config: <NEW_LINE> <INDENT> config_file = None <NEW_LINE> pattern = {} <NEW_LINE> class Container: <NEW_LINE> <INDENT> def __getitem__(self, key): <NEW_LINE> <INDENT> if self.__dict__.has_key(key): <NEW_LINE> <INDENT> return self.__dict__[key] <NEW_LINE> <DEDENT> return None <NEW_LINE> <DEDENT> <DEDENT> def __ini...
Config class for EleTools CLI Utilities This class essentially parses the passed configuration file into section and option values. For every section within the config file, all options in that section are turned into object attributes. So for example, a file with this content: [Local] db_host db_port Would be turne...
6259903026238365f5fadbef
class UCCLogin(BasePage): <NEW_LINE> <INDENT> def match_page_tilte(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return self.driver.title == "Aviatrix Cloud Controller" <NEW_LINE> <DEDENT> except NoSuchElementException: <NEW_LINE> <INDENT> self.logger.exception("Could not connect to UCC Web Console") <NEW_LINE> <...
Class method provided by Sam
6259903023e79379d538d5a6
class TextFile(models.Model): <NEW_LINE> <INDENT> base_file = models.ForeignKey(basefile_model.BaseFile, null=True, on_delete=models.CASCADE, blank=True) <NEW_LINE> date_created = models.DateTimeField(auto_now_add=True, null=True) <NEW_LINE> tesseract_text = models.TextField(blank=True, null=True) <NEW_LINE> google_vis...
The Text File class is a model that defines which data is available in the Text File table so a database can be created from it. Method List: -none Argument List: -models.Model: This argument allows the class to access field types. Author: Zoe LeBlanc
625990308a43f66fc4bf3223
class ArchiveUrlFetchHandler(BaseFetchHandler): <NEW_LINE> <INDENT> def can_handle(self, source): <NEW_LINE> <INDENT> url_parts = self.parse_url(source) <NEW_LINE> if url_parts.scheme not in ('http', 'https', 'ftp', 'file'): <NEW_LINE> <INDENT> return "Wrong source type" <NEW_LINE> <DEDENT> if get_archive_handler(self....
Handler to download archive files from arbitrary URLs. Can fetch from http, https, ftp, and file URLs. Can install either tarballs (.tar, .tgz, .tbz2, etc) or zip files. Installs the contents of the archive in $CHARM_DIR/fetched/.
625990300a366e3fb87dda84
class TestCaseBase(TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> super(TestCaseBase, self).setUp() <NEW_LINE> self.client = LocalizingClient() <NEW_LINE> ke_flag, created = Flag.objects.get_or_create(name='kumaediting') <NEW_LINE> ke_flag.everyone = True <NEW_LINE> ke_flag.save() <NEW_LINE> self.k...
Base TestCase for the wiki app test cases.
62599030d4950a0f3b11168c
class SidewalkAccountInfo(AWSProperty): <NEW_LINE> <INDENT> props: PropsDictType = { "AppServerPrivateKey": (str, True), }
`SidewalkAccountInfo <http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotwireless-partneraccount-sidewalkaccountinfo.html>`__
6259903073bcbd0ca4bcb330
class SiteScanData(models.Model): <NEW_LINE> <INDENT> sitescan = models.OneToOneField(SiteScan, null=True) <NEW_LINE> num_rules = models.IntegerField() <NEW_LINE> num_properties = models.IntegerField() <NEW_LINE> scanned_pages = models.IntegerField() <NEW_LINE> css_issues = models.IntegerField() <NEW_LINE> ua_issues = ...
Aggregate data model for site scans
6259903096565a6dacd2d7dd
class Star: <NEW_LINE> <INDENT> def __init__(self, x=0.0, y=0.0, name="untitled", flux=-1.0, props={}, fwhm=-1.0, elon=-1.0): <NEW_LINE> <INDENT> self.x = float(x) <NEW_LINE> self.y = float(y) <NEW_LINE> self.name = str(name) <NEW_LINE> self.flux = float(flux) <NEW_LINE> self.props = props <NEW_LINE> self.fwhm = float(...
Simple class to represent a single source (usually stars, but not necessarily). In this module we often manipulate lists of such Star objects.
625990308e05c05ec3f6f6aa
class RegularizedRegression(LinearRegression): <NEW_LINE> <INDENT> def __init__(self, learning_rate=1e-3, n_epoch=2000, alpha=0.05, r=0.5): <NEW_LINE> <INDENT> self.alpha = alpha <NEW_LINE> self.r = r <NEW_LINE> super(RegularizedRegression, self).__init__(learning_rate, n_epoch) <NEW_LINE> <DEDENT> def _training_method...
Ridge(l2-norm) Lasso(l1-norm) Regularization
6259903026238365f5fadbf1
class RecordCache(MutableMapping): <NEW_LINE> <INDENT> def __init__(self, record): <NEW_LINE> <INDENT> assert len(record) == 1, "Unexpected RecordCache(%s)" % record <NEW_LINE> self._record = record <NEW_LINE> <DEDENT> def __contains__(self, name): <NEW_LINE> <INDENT> field = self._record._fields[name] <NEW_LINE> retur...
A mapping from field names to values, to read and update the cache of a record.
625990306fece00bbaccca4e
class AmcrestSensor(Entity): <NEW_LINE> <INDENT> def __init__(self, name, camera, sensor_type): <NEW_LINE> <INDENT> self._attrs = {} <NEW_LINE> self._camera = camera <NEW_LINE> self._sensor_type = sensor_type <NEW_LINE> self._name = '{0}_{1}'.format(name, SENSORS.get(self._sensor_type)[0]) <NEW_LINE> self._icon = 'mdi:...
A sensor implementation for Amcrest IP camera.
625990301d351010ab8f4bb6
class Toy_Extension(ExtensionEasyBlock): <NEW_LINE> <INDENT> def run(self): <NEW_LINE> <INDENT> super(Toy_Extension, self).run(unpack_src=True) <NEW_LINE> EB_toy.configure_step(self.master, name=self.name) <NEW_LINE> EB_toy.build_step(self.master, name=self.name) <NEW_LINE> EB_toy.install_step(self.master, name=self.na...
Support for building/installing toy.
625990300a366e3fb87dda86
class BatchPredict(Resource): <NEW_LINE> <INDENT> def get(self, username, model_name): <NEW_LINE> <INDENT> parser = reqparse.RequestParser() <NEW_LINE> parser.add_argument('file', type=str, help='Filepath to data') <NEW_LINE> parser.add_argument('skipheader', type=bool, help='Should header be skipped?') <NEW_LINE> pars...
Resource for batch prediction
6259903021bff66bcd723d04
class TargetDetailIs(ClientSideCriterion): <NEW_LINE> <INDENT> def __init__(self, dataFlavor, value): <NEW_LINE> <INDENT> self._propertyName = dataFlavor <NEW_LINE> self._value = value <NEW_LINE> <DEDENT> def paintContent(self, target): <NEW_LINE> <INDENT> super(TargetDetailIs, self).paintContent(target) <NEW_LINE> tar...
Criterion for checking if drop target details contains the specific property with the specific value. Currently only String values are supported. TODO: add support for other basic data types that we support in UIDL.
6259903056b00c62f0fb3960
class AverageSentenceLengthExtractor(BaseEstimator, TransformerMixin): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def average_sentence_length(self, text): <NEW_LINE> <INDENT> return len(text.split(' '))/len(text.split('.')) <NEW_LINE> <DEDENT> def transform(self, X, y=None): <N...
Takes in dataframe, extracts road name column, outputs average word length
62599030e76e3b2f99fd9aab
class IConstraint(EvaluatedElement): <NEW_LINE> <INDENT> def __init__(self, name, expr=None, scale=1.0, func=None, **kwargs): <NEW_LINE> <INDENT> super().__init__(name, expr=expr, scale=scale, func=func) <NEW_LINE> self._value = None <NEW_LINE> self.value = math.inf <NEW_LINE> self._lb = -math.inf <NEW_LINE> self.lb = ...
Inequality constraint class. Inherited from EvaluatedElement.
62599030ac7a0e7691f73587
class OperationDisplay(Model): <NEW_LINE> <INDENT> _validation = { 'provider': {'readonly': True}, 'resource': {'readonly': True}, 'operation': {'readonly': True}, } <NEW_LINE> _attribute_map = { 'provider': {'key': 'provider', 'type': 'str'}, 'resource': {'key': 'resource', 'type': 'str'}, 'operation': {'key': 'operat...
The object that represents the operation. Variables are only populated by the server, and will be ignored when sending a request. :ivar provider: Service provider: Relay. :vartype provider: str :ivar resource: Resource on which the operation is performed: Invoice, etc. :vartype resource: str :ivar operation: Operati...
6259903071ff763f4b5e8837
class NullType(object): <NEW_LINE> <INDENT> def __init__(self, name=None): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> <DEDENT> def __repr__(self): <NEW_LINE> <INDENT> if self.name is not None: <NEW_LINE> <INDENT> return self.name <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return repr(self) <NEW_LINE> <DEDENT> <...
A 'null' type different from, but parallel to, None. Core function is representing emptyness in a way that doesn't overload None. Instantiate to create desired Null values.
62599030d99f1b3c44d06743
class Selector(Evaluator): <NEW_LINE> <INDENT> @abc.abstractmethod <NEW_LINE> def evaluate(self, votes, n_seats, *args, **kwargs) -> List[Candidate]: <NEW_LINE> <INDENT> raise NotImplementedError
Elect a given number of candidates. Requires a number of seats to determine the number of candidates to elect.
6259903030c21e258be998ac
class Solution: <NEW_LINE> <INDENT> def preorderTraversal(self, root): <NEW_LINE> <INDENT> result, node = [], root <NEW_LINE> while node: <NEW_LINE> <INDENT> if node.left: <NEW_LINE> <INDENT> pre = node.left <NEW_LINE> while pre.right and pre.right != node: <NEW_LINE> <INDENT> pre = pre.right <NEW_LINE> <DEDENT> if pre...
@param root: The root of binary tree. @return: Preorder in ArrayList which contains node values.
62599030cad5886f8bdc58cb
class ShowFramerate29970Action(gaupol.RadioAction): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> gaupol.RadioAction.__init__(self, "show_framerate_29_970") <NEW_LINE> framerate = gaupol.conf.editor.framerate <NEW_LINE> self.props.active = (framerate == aeidon.framerates.FPS_29_970) <NEW_LINE> self.props....
Calculate nonnative units with a framerate of 29.970 fps.
62599030287bf620b6272c87
class UserProfile(models.Model): <NEW_LINE> <INDENT> user = models.OneToOneField(User, on_delete=models.CASCADE) <NEW_LINE> default_phone_number = models.CharField(max_length=20, null=True, blank=True) <NEW_LINE> default_street_address1 = models.CharField(max_length=80, null=True, blank=True) <NEW_LINE> default_street_...
A user profile model for maintaining default delivery information and order history
625990306fece00bbaccca50
class UserMentionSerializer(serializers.ModelSerializer): <NEW_LINE> <INDENT> username = serializers.ReadOnlyField(source='slug') <NEW_LINE> image = serializers.ReadOnlyField(source='get_avatar_url') <NEW_LINE> url = serializers.ReadOnlyField(source='get_absolute_url') <NEW_LINE> class Meta: <NEW_LINE> <INDENT> model =...
Lightweight serializer to meet user's schema of mention.js
62599030711fe17d825e14eb
class Counters: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.c = { 'RDF': 0, 'BNB': 0, 'Dewey': 0, 'VIAFPers': 0, 'VIAFOrg': 0, 'ISNIPers': 0, 'ISNIOrg': 0, 'WikiDataPers': 0, 'WikiDataOrg': 0, 'LCSHTopic': 0, 'LCSHPlace': 0, }
Class for counting the number of lines within a file having particular properties.
6259903056b00c62f0fb3962
class UnbanChatMemberRequest(KickChatMemberRequest): <NEW_LINE> <INDENT> pass
Unban chat member request model. .. seealso:: https://core.telegram.org/bots/api#unbanchatmember
625990306fece00bbaccca51
class _Select(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.read_fds = set() <NEW_LINE> self.write_fds = set() <NEW_LINE> self.error_fds = set() <NEW_LINE> self.fd_sets = (self.read_fds, self.write_fds, self.error_fds) <NEW_LINE> <DEDENT> def close(self): <NEW_LINE> <INDENT> pass <NEW_LINE> ...
A simple, select()-based IOLoop implementation for non-Linux systems
62599030287bf620b6272c89
class Devlink(object): <NEW_LINE> <INDENT> def __init__(self, path): <NEW_LINE> <INDENT> self._path = path <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return self._path <NEW_LINE> <DEDENT> @property <NEW_LINE> def path(self): <NEW_LINE> <INDENT> return self._path <NEW_LINE> <DEDENT> @property <NEW_LINE> ...
Represents a device link. These are a bit anomalous, since they are recognized by their structure as paths.
62599031796e427e5384f81f
class QDataDepPreview(QtWidgets.QFrame): <NEW_LINE> <INDENT> _SRC_JUMP_TEXT = "Jump to source node?" <NEW_LINE> _DST_JUMP_TEXT = "Jump to destination node?" <NEW_LINE> def __init__(self, parent: QtWidgets.QWidget): <NEW_LINE> <INDENT> super().__init__(parent) <NEW_LINE> self.preview_graph = QDataDepPreviewGraph(self) <...
Frame for holding a preview scene
625990313eb6a72ae038b709
class ExposeInternals(Transform): <NEW_LINE> <INDENT> default_priority = 840 <NEW_LINE> def apply(self): <NEW_LINE> <INDENT> if self.document.settings.expose_internals: <NEW_LINE> <INDENT> for node in self.document.traverse(): <NEW_LINE> <INDENT> for att in self.document.settings.expose_internals: <NEW_LINE> <INDENT> v...
Expose internal attributes if ``expose_internals`` setting is set.
625990318e05c05ec3f6f6ad
class EndpointMaterialsUnitTest(EntityEndpointsUnitTest): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> super(EndpointMaterialsUnitTest, self).__init__(*args, **kwargs) <NEW_LINE> self.endpoint_name = "materials" <NEW_LINE> self.endpoints = MaterialEndpoints(self.host, self.port, self.acc...
Class for testing materials endpoint.
6259903150485f2cf55dc021
class NextURLMixin(object): <NEW_LINE> <INDENT> next_param = 'next' <NEW_LINE> default_redirect_param = '/' <NEW_LINE> allow_logged_in = False <NEW_LINE> def dispatch(self, request, *args, **kwargs): <NEW_LINE> <INDENT> if request.user.is_authenticated() and not self.allow_logged_in: <NEW_LINE> <INDENT> return HttpResp...
Mixin for Django FormView, with a wrapper to get the 'next' url param after, for expample, logging in
625990318c3a8732951f75fc
class Platform(db.Model): <NEW_LINE> <INDENT> __tablename__ = "platforms" <NEW_LINE> platform_id = db.Column(db.Integer, primary_key=True) <NEW_LINE> name = db.Column(db.String(64), nullable=False) <NEW_LINE> games = db.relationship("Game", secondary="game_platforms", backref="platforms") <NEW_LINE> def __repr__(self):...
Game platform table
6259903126238365f5fadbf7
class MockVerifyToken: <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def verify_token_valid(mock_obj, token=None): <NEW_LINE> <INDENT> return 'foo' <NEW_LINE> <DEDENT> @staticmethod <NEW_LINE> def verify_token_expired(mock_obj, token=None): <NEW_LINE> <INDENT> raise SignatureExpired('bar') <NEW_LINE> <DEDENT> @staticmet...
This class just provides necessary mock methods.
625990318c3a8732951f75fd
class GeometryApiField(ApiField): <NEW_LINE> <INDENT> dehydrated_type = 'geometry' <NEW_LINE> help_text = 'Geometry data.' <NEW_LINE> def hydrate(self, bundle): <NEW_LINE> <INDENT> value = super(GeometryApiField, self).hydrate(bundle) <NEW_LINE> if value is None: <NEW_LINE> <INDENT> return value <NEW_LINE> <DEDENT> eli...
Custom ApiField for dealing with data from GeometryFields (by serializing them as GeoJSON).
62599031a4f1c619b294f69b
class DeleteImportedKeyMaterialResponse(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.RequestId = None <NEW_LINE> <DEDENT> def _deserialize(self, params): <NEW_LINE> <INDENT> self.RequestId = params.get("RequestId")
DeleteImportedKeyMaterial response structure.
6259903121bff66bcd723d0a
class Actor(nn.Module): <NEW_LINE> <INDENT> def __init__(self, state_size, action_size, seed, hidden_size=256, init_w=3e-3, log_std_min=-20, log_std_max=2): <NEW_LINE> <INDENT> super(Actor, self).__init__() <NEW_LINE> self.seed = torch.manual_seed(seed) <NEW_LINE> self.log_std_min = log_std_min <NEW_LINE> self.log_std_...
Actor (Policy) Model.
6259903171ff763f4b5e883d
class ProxyConnection(object): <NEW_LINE> <INDENT> __slots__ = ('server', 'is_closed', 'streams', 'loop', 'authority', 'connection_num') <NEW_LINE> def __init__(self, server: 'proxy.ProxyServer.ProxyServer', stream_operators: Tuple[Tuple[asyncio.StreamReader, asyncio.StreamReader], Tuple[asyncio.StreamWriter, asyncio.S...
Class to describe a connections between the client and the server. Exposes the `asyncio.StreamReader`s and `asyncio.StreamWriter`s of both the client and the server.
6259903130c21e258be998b2
class UserBasedExceptionMiddleware(MiddlewareMixin): <NEW_LINE> <INDENT> def process_exception(self, request, exception): <NEW_LINE> <INDENT> if request.user.is_superuser or request.META.get('REMOTE_ADDR') in settings.INTERNAL_IPS: <NEW_LINE> <INDENT> return technical_500_response(request, *sys.exc_info())
Let superuser see debug page when exception happens
625990318a43f66fc4bf322d
class PyungoError(Exception): <NEW_LINE> <INDENT> pass
pyungo custom exception
625990311d351010ab8f4bbe
class InvalidParameterValue(OWSException): <NEW_LINE> <INDENT> pass
Operation request contains an invalid parameter value
62599031711fe17d825e14ee
class CartItem(models.Model): <NEW_LINE> <INDENT> cart = models.ForeignKey(Cart, related_name="items") <NEW_LINE> quantity = models.IntegerField() <NEW_LINE> product = models.ForeignKey(Product) <NEW_LINE> class Meta(object): <NEW_LINE> <INDENT> app_label = 'shop' <NEW_LINE> verbose_name = _('Cart item') <NEW_LINE> ver...
This is a holder for the quantity of items in the cart and, obviously, a pointer to the actual Product being purchased :)
6259903150485f2cf55dc024
class EnergyMeter: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def compute_energy(self, cpu, network, disk): <NEW_LINE> <INDENT> raise NotImplementedError <NEW_LINE> <DEDENT> def get_data(self, readings): <NEW_LINE> <INDENT> cpu = readings["cpu"] <NEW_LINE> disk = readings["disk...
Base class for defining energy meter.
6259903121bff66bcd723d0c
class Service(object): <NEW_LINE> <INDENT> def __init__(self, executable_path, port=0, service_args=None, log_path=None): <NEW_LINE> <INDENT> self.port = port <NEW_LINE> self.path = executable_path <NEW_LINE> self.service_args= service_args <NEW_LINE> if self.port == 0: <NEW_LINE> <INDENT> self.port = utils.free_port()...
Object that manages the starting and stopping of PhantomJS / Ghostdriver
6259903171ff763f4b5e883f
class InspiralCoherentJob(InspiralAnalysisJob): <NEW_LINE> <INDENT> def __init__(self,cp): <NEW_LINE> <INDENT> exec_name = 'inspiral' <NEW_LINE> sections = ['data'] <NEW_LINE> extension = 'xml' <NEW_LINE> InspiralAnalysisJob.__init__(self,cp,sections,exec_name,extension) <NEW_LINE> self.add_condor_cmd('environment',"KM...
A lalapps_inspiral job used by the inspiral pipeline. The static options are read from the sections [data] and [inspiral] in the ini file. The stdout and stderr from the job are directed to the logs directory. The job runs in the universe specfied in the ini file. The path to the executable is determined from the ini f...
625990310a366e3fb87dda8f
class File(object): <NEW_LINE> <INDENT> def __init__(self, transfer_id, filename): <NEW_LINE> <INDENT> self.transfer_id = transfer_id <NEW_LINE> self.filename = filename <NEW_LINE> self.index = 0 <NEW_LINE> self.error = False <NEW_LINE> self.finished = False <NEW_LINE> self._part_filepath = os.path.join(FULL_EXTRACT_DI...
File data
62599031287bf620b6272c8f