code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
class TestObjStorageInitialization(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.path = tempfile.mkdtemp() <NEW_LINE> self.path2 = tempfile.mkdtemp() <NEW_LINE> self.config = {"storage_base": self.path2, "storage_slicing": "0:1/0:5"} <NEW_LINE> super().setUp() <NEW_LINE> <DEDENT> def...
Test that the methods for ObjStorage initializations with `get_objstorage` works properly.
62598f731d351010ab8f33c3
class NewspaperDataset(Dataset): <NEW_LINE> <INDENT> def __init__(self, data_dir = 'data/FCN_dataset', mode = 'train'): <NEW_LINE> <INDENT> assert mode in ['train', 'test', 'val'] <NEW_LINE> self.mode = mode <NEW_LINE> self.data_dir = data_dir <NEW_LINE> self.image_path = os.path.join(data_dir, 'image') <NEW_LINE> self...
A customized Dataset with function __len__ and __getitem__.
62598f7338b623060ffa8920
class Solution2: <NEW_LINE> <INDENT> def numSubarraysWithSum(self, nums: List[int], goal: int) -> int: <NEW_LINE> <INDENT> count, sum, hashmap = 0, 0, dict() <NEW_LINE> for num in nums: <NEW_LINE> <INDENT> hashmap[sum] = hashmap.get(sum, 0) + 1 <NEW_LINE> sum += num <NEW_LINE> count += hashmap.get(sum - goal, 0) <NEW_L...
哈希表
62598f7363f4b57ef00859b1
class HelloViewSet(viewsets.ViewSet): <NEW_LINE> <INDENT> serializer_class = serializers.HelloSerializer <NEW_LINE> def list(self, request): <NEW_LINE> <INDENT> a_viewset = [ 'Uses actions (list, create, retrieve, update, partial_update)', 'Automatically maps to URLs using Routers', 'Provides more functionality with le...
Test API ViewSet.
62598f73287bf620b627143c
class BiasCorrector(Corrector): <NEW_LINE> <INDENT> def __init__(self, biasmap, biasvar=None, datamodel=None, calibid='calibid-unknown', dtype='float32'): <NEW_LINE> <INDENT> self.update_variance = True if biasvar else False <NEW_LINE> super(BiasCorrector, self).__init__(datamodel=datamodel, calibid=calibid, dtype=dtyp...
A Node that corrects a frame from bias.
62598f738e05c05ec3f6ea88
class EntryFormTestCase(TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.owner = mixer.blend('auth.User') <NEW_LINE> <DEDENT> def test_form(self): <NEW_LINE> <INDENT> data = { 'question': ('This is a very long question to test the slug' ' generator and the truncation results. Sometimes' ' questi...
Tests for the ``EntryForm`` form class.
62598f7307d97122c4216526
class MyQueue(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self._stacks = [[], []] <NEW_LINE> <DEDENT> def enqueue(self, item): <NEW_LINE> <INDENT> while self._stacks[0]: <NEW_LINE> <INDENT> self._stacks[1].append(self._stacks[0].pop()) <NEW_LINE> <DEDENT> self._stacks[0].append(item) <NEW_LINE>...
Implement a MyQueue class which implements a queue using two stacks
62598f73711fe17d825dff6a
class TestAccountReconcile(TransactionCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> super(TestAccountReconcile, self).setUp() <NEW_LINE> self.asustek = self.env.ref('base.res_partner_1') <NEW_LINE> self.camptocamp = self.env.ref('base.res_partner_12') <NEW_LINE> self.statement = self.env['account.bank...
This will test the assignation of res.partner.bank when a bank statement line contains a bank acccount information and we assign it to a partner.
62598f738a43f66fc4bf1a04
class SSDResnet152V1FeatureExtractorTest( ssd_resnet_v1_fpn_feature_extractor_testbase. SSDResnetFPNFeatureExtractorTestBase): <NEW_LINE> <INDENT> def _create_feature_extractor(self, depth_multiplier, pad_to_multiple, use_explicit_padding=False): <NEW_LINE> <INDENT> min_depth = 32 <NEW_LINE> conv_hyperparams = {} <NEW_...
SSDResnet152v1Fpn feature extractor test.
62598f7316aa5153ce3ffd83
class SampleMatrixNumpy: <NEW_LINE> <INDENT> def __new__(cls, dist, size, seed=None): <NEW_LINE> <INDENT> return cls._sample_numpy(dist, size, seed) <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> def _sample_numpy(cls, dist, size, seed): <NEW_LINE> <INDENT> numpy_rv_map = { } <NEW_LINE> sample_shape = { } <NEW_LINE> dist_...
Returns the sample from numpy of the given distribution
62598f7315fb5d323ce7e5ad
class PlotData: <NEW_LINE> <INDENT> def __init__(self, identifiers=[], values=[], path=[], label=()): <NEW_LINE> <INDENT> self.identifiers = identifiers <NEW_LINE> self.values = values <NEW_LINE> self.path = path <NEW_LINE> self.label = label <NEW_LINE> self.has_ci = False <NEW_LINE> if len(self.values[0]) == 3: <NEW_L...
Class encapsulating data to be plotted. It is used to join data from different simulation data items together, if they export data at the same position in the variable tree, and with the same *identifiers* . :param identifiers: Used to decide, if a list of values should be associated with a certain plot data objec...
62598f73167d2b6e312b6802
class TVShowNotFound(Exception): <NEW_LINE> <INDENT> def __init__(self, message, errors): <NEW_LINE> <INDENT> Exception.__init__(self, message) <NEW_LINE> self.errors = errors
TV Show Not Found Exception
62598f731d351010ab8f33c5
class CastValidationError(ValidationError): <NEW_LINE> <INDENT> def __init__(self, target, name, error): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> typename = '<{}>'.format(target.__name__) <NEW_LINE> <DEDENT> except AttributeError: <NEW_LINE> <INDENT> typename = repr(target) <NEW_LINE> <DEDENT> msg = "{} could not b...
CastValidationError are thrown when a value could not be cast to the target type
62598f73e76e3b2f99fd82b7
class BaseVectorEnv(ABC, gym.Wrapper): <NEW_LINE> <INDENT> def __init__(self, env_fns): <NEW_LINE> <INDENT> self._env_fns = env_fns <NEW_LINE> self.env_num = len(env_fns) <NEW_LINE> <DEDENT> def __len__(self): <NEW_LINE> <INDENT> return self.env_num <NEW_LINE> <DEDENT> @abstractmethod <NEW_LINE> def reset(self, id=None...
Base class for vectorized environments wrapper. Usage: :: env_num = 8 envs = VectorEnv([lambda: gym.make(task) for _ in range(env_num)]) assert len(envs) == env_num It accepts a list of environment generators. In other words, an environment generator ``efn`` of a specific task means that ``efn()`` returns...
62598f7307d97122c4216527
class WorldIntegrityError(ValueError): <NEW_LINE> <INDENT> pass
Error condition for when something breaks the world model, even if it might be allowed by the database schema.
62598f73d10714528d69d753
class R_s(Variable): <NEW_LINE> <INDENT> name = 'R_s' <NEW_LINE> unit = joule / (meter**2 * second) <NEW_LINE> domain = 'real' <NEW_LINE> latex_name = 'R_s'
Solar shortwave flux per area.
62598f730383005118f6cf89
class CaseChange(Action): <NEW_LINE> <INDENT> LOWER = 1 <NEW_LINE> FIRST_MAJ = 2 <NEW_LINE> TITLE = 4 <NEW_LINE> UPPER = 8 <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> Action.__init__(self) <NEW_LINE> self.range = PathModification.FILENAME <NEW_LINE> self.modification = CaseChange.FIRST_MAJ <NEW_LINE> <DEDENT> @s...
Modifier le nom du fichier : mettre en majuscule, minuscules, ... @author: Julien
62598f733eb6a72ae0389ec9
class BookInstance(models.Model): <NEW_LINE> <INDENT> id = models.UUIDField( primary_key=True, default=uuid.uuid4, help_text='Unique ID for this particular book across whole library' ) <NEW_LINE> book = models.ForeignKey('Book', on_delete=models.SET_NULL, null=True) <NEW_LINE> imprint = models.CharField(max_length=200)...
Model representing a specific copy of a book (i.e. that can be borrowed from the library).
62598f735e10d32532ce3530
class KeychainKeyNotFound(CumulusCIUsageError): <NEW_LINE> <INDENT> pass
Raised when the keychain key couldn't be found
62598f731d351010ab8f33c6
class ProjectDefinition(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(ProjectDefinition, self).__init__() <NEW_LINE> self.description_long = None <NEW_LINE> self.description_short = None <NEW_LINE> self.git_url = None <NEW_LINE> self.homepage_url = None <NEW_LINE> self.maintainer = None <NE...
Project definition. Attributes: description_long (str): long description. description_short (str): short description. git_url (str): URL of the git repository. homepage_url (str): URL of the homepage. maintainer (str): maintainer. name (str): name of the project. name_description (str): name of the proje...
62598f7366673b3332c2fc47
class LemmaTokenizer(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.lemmatizer = WordNetLemmatizer() <NEW_LINE> <DEDENT> def __call__(self, doc): <NEW_LINE> <INDENT> return [self.lemmatizer.lemmatize(t, pos="v") for t in SimpleTokenizer(doc)]
Lemmatize tokens in a document Parameters: ---------- docs (list): list of documents Returns: -------- list of lemmatized tokens
62598f736e29344779affee6
class ParallelPreprocessing(): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def calculate_segment_size(text, processors): <NEW_LINE> <INDENT> t_lenght = len(text) <NEW_LINE> seg_size = int(t_lenght/processors) <NEW_LINE> add = 0 <NEW_LINE> if t_lenght % processors != 0: <NEW_LINE> <INDENT> add = (t_lenght % processors)...
Preprocessing steps, preparing input to parallel workflow.
62598f73d99f1b3c44d04f3d
class DeviceDataCollectorNetconf(object): <NEW_LINE> <INDENT> def __init__(self, deviceId, conf = {}, daoClass = Dao): <NEW_LINE> <INDENT> if any(conf) == False: <NEW_LINE> <INDENT> self._conf = OpenClosProperty(appName = moduleName).getProperties() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self._conf = conf <NEW_L...
Base class for any device data collector based on NetConf Uses junos-eznc to connect to device
62598f736fece00bbaccb212
class Hidden(Input): <NEW_LINE> <INDENT> def is_hidden(self): <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> def get_type(self): <NEW_LINE> <INDENT> return "hidden"
Hidden Input. >>> Hidden(name='foo', value='bar').render() u'<input id="foo" name="foo" type="hidden" value="bar"/>'
62598f73167d2b6e312b6804
class TypescriptQuickInfo(TypeScriptBaseTextCommand): <NEW_LINE> <INDENT> def handle_quick_info(self, quick_info_resp_dict): <NEW_LINE> <INDENT> if quick_info_resp_dict["success"]: <NEW_LINE> <INDENT> info_str = quick_info_resp_dict["body"]["displayString"] <NEW_LINE> doc_str = quick_info_resp_dict["body"]["documentati...
Command currently called only from event handlers
62598f731f037a2d8b9e3976
class URLPath: <NEW_LINE> <INDENT> CREATE_PASSWORD = 'create-password' <NEW_LINE> UPDATE_PASSWORD = 'update-password' <NEW_LINE> FORGOT_PASSWORD = 'forgot-password' <NEW_LINE> RESET_FORGOT_PASSWORD = 'reset-forgot-password' <NEW_LINE> VERIFY_PASSWORD = 'verify-password' <NEW_LINE> VERIFY_NUMBER = 'verify-number' <NEW_L...
class to hold url path segments
62598f738c3a8732951f5dd6
class ZPoolIostatCounters(dict): <NEW_LINE> <INDENT> def __init__(self, parent, name, alloc, free, read_ops, write_ops, read_bw, write_bw): <NEW_LINE> <INDENT> self['name'] = name.strip() <NEW_LINE> self['allocated'] = alloc != '-' and self.__parse_counter_value__(alloc) or None <NEW_LINE> self['free'] = free != '-' an...
Zpool device iostat counters
62598f7321bff66bcd7224ea
class MGEModel(BaseModel) : <NEW_LINE> <INDENT> def __init__(self, **kwargs) : <NEW_LINE> <INDENT> self.verbose = kwargs.get("verbose", False) <NEW_LINE> self.truncation_method = kwargs.get("truncation_method", "Ellipsoid") <NEW_LINE> self.mcut = kwargs.get("mcut", 50000.) <NEW_LINE> self.GGRAV = constants.G.to(units.k...
MGE model This class defines the basic MGE model, which should include both a reference 2D Base model made of n_gaussians Gaussians, and the associated 3D Gaussians, using the viewing Euler Angles
62598f730383005118f6cf8a
class LogWindow(CursesTable): <NEW_LINE> <INDENT> def __init__(self, height, width, y, x): <NEW_LINE> <INDENT> CursesTable.__init__(self, height, width, y, x, ("log", ), title="Log", autoScroll = True)
A window that displays log messages.
62598f7307d97122c4216529
class JSONField(models.Field): <NEW_LINE> <INDENT> __metaclass__ = models.SubfieldBase <NEW_LINE> def to_python(self, value): <NEW_LINE> <INDENT> if isinstance(value, dict): <NEW_LINE> <INDENT> return value <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> if not value: <NEW_LINE> <INDENT> return value <NEW_LINE> <DEDENT> ...
Simple field that stores in JSON format.
62598f736fece00bbaccb213
class Network(ThreadModule): <NEW_LINE> <INDENT> MAX_LENGTH_INTERFACE = 16 <NEW_LINE> MAX_LENGTH_ESSID = 32 <NEW_LINE> SIOCGIWESSID = 0x8B1B <NEW_LINE> defaults = { "icon": Tools.sym(""), "icon_wifi": Tools.sym("") } <NEW_LINE> def __init__(self, interface=None, interval=5, template=None, **kwargs): <NEW_LINE> <INDEN...
Network Module Shows the current IP address and status of the given interface For WiFi interfaces, shows the assigned access point's ESSID
62598f739b70327d1c57e636
class ICookiePrefix(Interface): <NEW_LINE> <INDENT> prefix = Attribute(u'A unique prefix')
A prefix provider for cookie keys. If some application state data is stored in cookies, a user logs off and another logs in, the new logged in user works initially with the same application state as the previous. To avoid this, all cookie referring functions of IRequestMixin use this provider to get a prefix, normally...
62598f7391af0d3eaad39694
class InstagramUser(TimeStampedModel): <NEW_LINE> <INDENT> username = models.CharField(max_length=256) <NEW_LINE> instagramID = models.CharField(max_length=300) <NEW_LINE> def __unicode__(self): <NEW_LINE> <INDENT> return "<InstagramUser: %s>" % self.username
Instagram users account information
62598f73b57a9660fecd1308
class PreparedStatement(object): <NEW_LINE> <INDENT> column_metadata = None <NEW_LINE> query_id = None <NEW_LINE> query_string = None <NEW_LINE> keyspace = None <NEW_LINE> routing_key_indexes = None <NEW_LINE> consistency_level = ConsistencyLevel.ONE <NEW_LINE> def __init__(self, column_metadata, query_id, routing_key_...
A statement that has been prepared against at least one Cassandra node. Instances of this class should not be created directly, but through :meth:`.Session.prepare()`. A :class:`.PreparedStatement` should be prepared only once. Re-preparing a statement may affect performance (as the operation requires a network roundt...
62598f733eb6a72ae0389ecb
class SlideJoint(Joint): <NEW_LINE> <INDENT> def __init__(self, a, b, anchr1, anchr2, min, max): <NEW_LINE> <INDENT> self._a = a <NEW_LINE> self._b = b <NEW_LINE> self._joint = cp.cpSlideJointNew(a._body, b._body, anchr1, anchr2, min, max)
Like pin joints, but have a minimum and maximum distance. A chain could be modeled using this joint. It keeps the anchor points from getting to far apart, but will allow them to get closer together.
62598f73be8e80087fbbe8e8
class AmortizationPayment(types.Type): <NEW_LINE> <INDENT> period = validators.Integer() <NEW_LINE> amount = validators.Number() <NEW_LINE> interest = validators.Number() <NEW_LINE> principal = validators.Number() <NEW_LINE> principal_balance = validators.Number()
Annotation for AmortizationPayment
62598f7315baa72349461814
class ErrorCode(Enum): <NEW_LINE> <INDENT> IM_TIMER_POPPED = 0x01 <NEW_LINE> IM_NOT_FIRST_MESSAGE = 0x02 <NEW_LINE> IM_WRONG_ENDIAN = 0x03 <NEW_LINE> IM_WRONG_MAGIC_NUMBER = 0x04 <NEW_LINE> VERSION_INCOMPATIBILITY = 0x05 <NEW_LINE> MORE_THAN_1_IM_SENT = 0x06 <NEW_LINE> IM_SENT_BY_SERVER = 0x07 <NEW_LINE> UNKNOWN_MESSAG...
Enumeration of error codes for error messages
62598f7376d4e153a661c49c
class SignalEvaluateResponse(ModelNormal): <NEW_LINE> <INDENT> allowed_values = { } <NEW_LINE> validations = { } <NEW_LINE> @cached_property <NEW_LINE> def additional_properties_type(): <NEW_LINE> <INDENT> lazy_import() <NEW_LINE> return (bool, date, datetime, dict, float, int, list, str, none_type,) <NEW_LINE> <DEDENT...
NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually. Attributes: allowed_values (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict with a capitalized key describing the a...
62598f73b830903b9686e0b7
class ModelsAllStats(graphene.ObjectType): <NEW_LINE> <INDENT> symbol = graphene.String(description='代码') <NEW_LINE> annual_return = graphene.Float(description='年化', name='annual_return') <NEW_LINE> cumulative_returns = graphene.Float(description='累计年化', name='cumulative_returns') <NEW_LINE> annual_volatility = graphen...
模型统计信息-返回数据类型
62598f7315fb5d323ce7e5b1
class DeleteL7DomainsRequest(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.LoadBalancerId = None <NEW_LINE> self.ListenerId = None <NEW_LINE> self.DomainIds = None <NEW_LINE> <DEDENT> def _deserialize(self, params): <NEW_LINE> <INDENT> self.LoadBalancerId = params.get("LoadBalancerId"...
DeleteL7Domains请求参数结构体
62598f73be383301e0253081
class AnimatedGraphicsTemplate(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.Definition = None <NEW_LINE> self.Type = None <NEW_LINE> self.Name = None <NEW_LINE> self.Comment = None <NEW_LINE> self.Width = None <NEW_LINE> self.Height = None <NEW_LINE> self.ResolutionAdaptive = None <N...
转动图模板详情。
62598f7330c21e258be9808e
class RosettaLangPackExporter(LaunchpadCronScript): <NEW_LINE> <INDENT> usage = '%prog [options] distribution series' <NEW_LINE> def add_my_options(self): <NEW_LINE> <INDENT> self.parser.add_option( '--output', dest='output', default=None, action='store', help='A file to send the generated tarball to, rather than the' ...
Export language packs for a distribution series.
62598f73fb3f5b602db47df5
class CmdInventory(default_cmds.MuxCommand): <NEW_LINE> <INDENT> key = "inventory" <NEW_LINE> aliases = ["inv", "i"] <NEW_LINE> locks = "cmd:all()" <NEW_LINE> arg_regex = r"$" <NEW_LINE> def func(self): <NEW_LINE> <INDENT> items = self.caller.contents <NEW_LINE> if not items: <NEW_LINE> <INDENT> string = "You are not c...
view inventory Usage: inventory inv Shows your inventory.
62598f7376d4e153a661c49d
class DijalogUmjeravanje(BASE_DIJALOG_UMJERAVANJE, FORM_DIJALOG_UMJERAVANJE): <NEW_LINE> <INDENT> def __init__(self, dokument=None, parent=None): <NEW_LINE> <INDENT> super(BASE_DIJALOG_UMJERAVANJE, self).__init__(parent) <NEW_LINE> self.setupUi(self) <NEW_LINE> self.doc = dokument <NEW_LINE> self.setup_connections() <N...
Dijalog za izbor postavki umjeravanja
62598f731d351010ab8f33c9
class Room(models.Model): <NEW_LINE> <INDENT> name = models.CharField(max_length=100) <NEW_LINE> description = models.CharField(max_length=1000) <NEW_LINE> price = models.DecimalField(max_digits=6, decimal_places=2) <NEW_LINE> capacity = models.IntegerField(default=2)
Rooms available for booking.
62598f731f5feb6acb1624c1
class Time(BaseDataType): <NEW_LINE> <INDENT> __dbtype__ = 'Time' <NEW_LINE> __pytype__ = (PYSTR, datetime.time) <NEW_LINE> @staticmethod <NEW_LINE> def cast_str(value): <NEW_LINE> <INDENT> return value <NEW_LINE> <DEDENT> def validate(self, value): <NEW_LINE> <INDENT> if value == '': <NEW_LINE> <INDENT> self.__obj__ =...
Represents a Time Field
62598f736aa9bd52df0d475f
class GrabFlickrByUsername(forms.Form): <NEW_LINE> <INDENT> flickr_username = forms.CharField(label=_("Flickr Username"), max_length=60)
A form for grabbing user photos by flickr Username.
62598f738c3a8732951f5dd8
class TestGetBzrBranch(TestCaseWithFactory): <NEW_LINE> <INDENT> layer = DatabaseFunctionalLayer <NEW_LINE> def setUp(self): <NEW_LINE> <INDENT> TestCaseWithFactory.setUp(self) <NEW_LINE> self.useBzrBranches(direct_database=True) <NEW_LINE> <DEDENT> def test_simple(self): <NEW_LINE> <INDENT> db_branch, tree = self.crea...
Tests for `IBranch.getBzrBranch`.
62598f730383005118f6cf8c
class Solution: <NEW_LINE> <INDENT> def numSubseq(self, nums: List[int], target: int) -> int: <NEW_LINE> <INDENT> left, right = 0, len(nums) - 1 <NEW_LINE> nums.sort() <NEW_LINE> mod = 10 ** 9 + 7 <NEW_LINE> result = 0 <NEW_LINE> while left <= right: <NEW_LINE> <INDENT> if nums[left] + nums[right] <= target: <NEW_LINE>...
- sliding window with sorting - caveat: subsequence is different from substring, subsequence doesn't need to have consecutive elements - O(nlogn), O(n)
62598f738c3a8732951f5dd9
class SurfaceCollisionLoader: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.params = {'debug': get_param('~debug'), 'world': get_param('~world_frame'), 'package': get_param('~package')} <NEW_LINE> self.tbr = TransformBroadcaster() <NEW_LINE> self.tfl = TransformListener() <NEW_LINE> self.strs = ['fil...
Class for adding collision models for detected surfaces based on detected AR tag number.
62598f7373bcbd0ca4bc9ad8
class Direction(Base, NameMixin, CoordinatesMixin): <NEW_LINE> <INDENT> __tablename__ = 'directions' <NEW_LINE> short_name = Column(String(2), nullable=False) <NEW_LINE> opposite_id = Column( Integer, ForeignKey(f'{__tablename__}.id'), nullable=True, default=None ) <NEW_LINE> opposite = relationship( 'Direction', backr...
A direction a player or vehicle can move in.
62598f738e05c05ec3f6ea8b
class UserCreate(APIView): <NEW_LINE> <INDENT> permission_classes = [AllowAny] <NEW_LINE> def post(self, request, format='json'): <NEW_LINE> <INDENT> serializer = UserSerializer(data=request.data) <NEW_LINE> if serializer.is_valid(): <NEW_LINE> <INDENT> user = serializer.save() <NEW_LINE> if user: <NEW_LINE> <INDENT> t...
Creates the user.
62598f73b57a9660fecd130b
class RTCPeerConnection(): <NEW_LINE> <INDENT> class StateException(Exception): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def __init__(self, config): <NEW_LINE> <INDENT> self.SDPHelper = SDPHelper() <NEW_LINE> assert 'ice' in config.keys() <NEW_LINE> self.ICEAgent = ICEAgent(config['iceServers']) <NEW_LINE> self.sdp...
WebRTC connection encapsulation; provides Connection interface and lifecycle management according to http://www.w3.org/TR/webrtc/
62598f73b830903b9686e0b8
class TestCheckConsistency: <NEW_LINE> <INDENT> def test_empty_set_of_states_raises_error(self): <NEW_LINE> <INDENT> with pytest.raises(ValueError, match="The set of states cannot be empty."): <NEW_LINE> <INDENT> SimpleDFA(set(), MapAlphabet({"a"}), "q0", set(), {}) <NEW_LINE> <DEDENT> <DEDENT> def test_initial_state_n...
Test suite to check the input is validated as expected.
62598f73d6c5a102081e19d1
class NumSolver: <NEW_LINE> <INDENT> def __init__(self, equation): <NEW_LINE> <INDENT> self.eq = equation <NEW_LINE> <DEDENT> def solve(self, accuracy = 1000000, start = 0, randRange = 1, randRangeExp = 1.1, attemptsMultiplier = 0.01, debug = False, defined_vars = [], cap_time = False): <NEW_LINE> <INDENT> defined_vars...
classdocs
62598f738c3a8732951f5dda
class TestRankAdvance(Base): <NEW_LINE> <INDENT> expected_title = "fedbadges.person.rank.advance" <NEW_LINE> expected_subti = "ralph moved to position 1500 on the badges leaderboard" <NEW_LINE> expected_link = "https://badges.fedoraproject.org/user/ralph" <NEW_LINE> expected_icon = "https://apps.fedoraproject.org/img/i...
When a user's rank on the leaderboard of the `Fedora Badges <https://badges.fedoraproject.org>`_ system increases, this message gets published.
62598f730383005118f6cf8e
class SetStatusRequest(JDCloudRequest): <NEW_LINE> <INDENT> def __init__(self, parameters, header=None, version="v1"): <NEW_LINE> <INDENT> super(SetStatusRequest, self).__init__( '/regions/{regionId}/task:setStatus', 'POST', header, version) <NEW_LINE> self.parameters = parameters
设置任务状态
62598f734e696a045264da44
class BackgroundTask(threading.Thread): <NEW_LINE> <INDENT> def __init__(self, interval, function, args=[], kwargs={}, bus=None): <NEW_LINE> <INDENT> threading.Thread.__init__(self) <NEW_LINE> self.interval = interval <NEW_LINE> self.function = function <NEW_LINE> self.args = args <NEW_LINE> self.kwargs = kwargs <NEW_L...
A subclass of threading.Thread whose run() method repeats. Use this class for most repeating tasks. It uses time.sleep() to wait for each interval, which isn't very responsive; that is, even if you call self.cancel(), you'll have to wait until the sleep() call finishes before the thread stops. To compensate, it defaul...
62598f7350485f2cf55da7fc
class Optimizer: <NEW_LINE> <INDENT> def __init__(self, loss: IOperation): <NEW_LINE> <INDENT> self.loss = loss <NEW_LINE> <DEDENT> @abstractmethod <NEW_LINE> def optimize(self, n_rounds: int): <NEW_LINE> <INDENT> raise NotImplementedError
Class for optimizers
62598f7373bcbd0ca4bc9ada
class DIISHistory(object): <NEW_LINE> <INDENT> name = None <NEW_LINE> need_energy = None <NEW_LINE> def __init__(self, lf, nvector, overlap, dots_matrices): <NEW_LINE> <INDENT> self.work = lf.create_one_body() <NEW_LINE> self.stack = [DIISState(lf, self.work, overlap) for i in xrange(nvector)] <NEW_LINE> self.overlap =...
A base class of DIIS histories
62598f73a4f1c619b294de79
class Song: <NEW_LINE> <INDENT> def __init__(self, title, author, lyricpath, tags: Optional[List[str]] = None): <NEW_LINE> <INDENT> self.title = title <NEW_LINE> self.author = author <NEW_LINE> self.lyricpath = lyricpath <NEW_LINE> self.tags = [readable_tag(tag) for tag in tags] if tags else [] <NEW_LINE> <DEDENT> def ...
Contains relevant information about a single song.
62598f73d10714528d69d75a
class UserCourse(models.Model): <NEW_LINE> <INDENT> user = models.ForeignKey(UserProfile, verbose_name=u"用户") <NEW_LINE> course = models.ForeignKey(Course, verbose_name=u"课程") <NEW_LINE> add_time = models.DateTimeField(default=datetime.now, verbose_name=u"添加时间") <NEW_LINE> class Meta: <NEW_LINE> <INDENT> verbose_name =...
用户课程
62598f7366673b3332c2fc4d
class RegexService(HttpService): <NEW_LINE> <INDENT> def get_html(self): <NEW_LINE> <INDENT> for request in self.make_requests(): <NEW_LINE> <INDENT> yield html_unescape(request.text) <NEW_LINE> <DEDENT> <DEDENT> @property <NEW_LINE> def regexes(self): <NEW_LINE> <INDENT> return [re.compile(regex) for regex in self.con...
An HTTP-based service that is scraped using regular expressions. Keyword arguments: parse (list): Regular expressions used to parse data from the service
62598f736fece00bbaccb218
class ConfigData(object): <NEW_LINE> <INDENT> def __init__(self, concurrent_workers): <NEW_LINE> <INDENT> self._concurrent_workers = int(concurrent_workers) <NEW_LINE> if self._concurrent_workers <= 0: <NEW_LINE> <INDENT> raise ValueError('Concurrent workers must be greater than 0') <NEW_LINE> <DEDENT> self._server_dat...
ConfigData
62598f7366656f66f7d59c7e
class Message(RLPHashable): <NEW_LINE> <INDENT> cmdid = 0 <NEW_LINE> sender = '' <NEW_LINE> fields = [('cmdid', t_int), ('sender', t_address)] <NEW_LINE> def __repr__(self): <NEW_LINE> <INDENT> return '<{} {}>'.format(self.__class__.__name__, pex(self.hash))
Message also has a sender property, so that Acks can be sent
62598f73dc8b845886d52e41
class DefinedNamespaceMeta(type): <NEW_LINE> <INDENT> _NS: Namespace <NEW_LINE> _warn: bool = True <NEW_LINE> _fail: bool = False <NEW_LINE> _extras: List[str] = [] <NEW_LINE> _underscore_num: bool = False <NEW_LINE> def __getitem__(cls, name: str, default=None) -> URIRef: <NEW_LINE> <INDENT> name = str(name) <NEW_LINE...
Utility metaclass for generating URIRefs with a common prefix
62598f736aa9bd52df0d4763
class Agent(object): <NEW_LINE> <INDENT> name = "ZI-U" <NEW_LINE> def __init__(self, id, type, valuation, quantity, max): <NEW_LINE> <INDENT> self.id = id <NEW_LINE> self.type = type <NEW_LINE> self.valuation = valuation <NEW_LINE> self.quantity = quantity <NEW_LINE> self.bid = max <NEW_LINE> self.profits = [] <NEW_LIN...
This is a representation of a financial agent (buyer/seller).
62598f7391af0d3eaad3969a
class TrackData(): <NEW_LINE> <INDENT> def __init__(self, selectionNames, analysisTypes, channel, track): <NEW_LINE> <INDENT> self.channel = channel <NEW_LINE> self.track = track <NEW_LINE> self.analysisTypes = analysisTypes <NEW_LINE> self.smp = 0 <NEW_LINE> self.selections = dict() <NEW_LINE> self.playbackState = Fal...
All data collected trough the Track User Interface will be stored here. This allows for easier communication with other backend objects. The TrackManager stores all invisible data in here (e.g. selections that are currently not active) and loads it back from here when needed (e.g. going back to a previously edited sele...
62598f73287bf620b6271446
class NSNitroNserrNegPolViol2(NSNitroPolErrors): <NEW_LINE> <INDENT> pass
Nitro error code 2105 Negotiate policy in primary can be bound only along with ldap policy (with authentication turned off) in secondary
62598f730383005118f6cf91
class ErrorExit(Exit): <NEW_LINE> <INDENT> __slots__ = ()
Exit with error.
62598f736e29344779affeee
class SubscriptionItemData(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.node = None <NEW_LINE> self.client_handle = None <NEW_LINE> self.server_handle = None <NEW_LINE> self.attribute = None <NEW_LINE> self.mfilter = None
To store useful data from a monitored item
62598f73c432627299fa2866
class Map(BaseField): <NEW_LINE> <INDENT> def __init__(self, key_type, value_type, **kwargs): <NEW_LINE> <INDENT> super(Map, self).__init__(**kwargs) <NEW_LINE> if not isinstance(key_type, BaseField): <NEW_LINE> <INDENT> raise ValueError( "Invalid type of 'key_type': expected to be instance of subclass of BaseField but...
Class represent JSON object type >>> some_field = Map(String, List(String)) >>> some_field.to_python({"f1": ["val"]}) == {"f1": ["val"]} >>> some_field.to_python({2: ["val"]}) Traceback (most recent call last): ... ValueError: '2' expected to be string
62598f734d74a7450cd58b21
@implementer(IAgent) <NEW_LINE> class CookieAgent: <NEW_LINE> <INDENT> def __init__(self, agent, cookieJar): <NEW_LINE> <INDENT> self._agent = agent <NEW_LINE> self.cookieJar = cookieJar <NEW_LINE> <DEDENT> def request(self, method, uri, headers=None, bodyProducer=None): <NEW_LINE> <INDENT> if headers is None: <NEW_LIN...
L{CookieAgent} extends the basic L{Agent} to add RFC-compliant handling of HTTP cookies. Cookies are written to and extracted from a C{cookielib.CookieJar} instance. The same cookie jar instance will be used for any requests through this agent, mutating it whenever a I{Set-Cookie} header appears in a response. @type...
62598f7366656f66f7d59c80
class Contact(object): <NEW_LINE> <INDENT> def __init__(self, contact_result): <NEW_LINE> <INDENT> self._contact_result = contact_result <NEW_LINE> self._N = None <NEW_LINE> self._points = None <NEW_LINE> self._normal = None <NEW_LINE> self._below = None <NEW_LINE> <DEDENT> @property <NEW_LINE> def N(self): <NEW_LINE> ...
Defines `Contact` objects, which provide a nicer interface to Bullet's ContactResults.
62598f73d4950a0f3b110a7e
class DueDateOverrideAdmin(admin.ModelAdmin): <NEW_LINE> <INDENT> list_display = ['enrollment', 'assignment', 'weeks_after', 'days_after', 'allow_late'] <NEW_LINE> list_select_related = True <NEW_LINE> search_fields = ['enrollment__course__name', 'enrollment__student__username', 'enrollment__student__email', 'assignmen...
Admin customizations for DueDateOverride Models.
62598f73fb3f5b602db47df8
class SaltCloudSystemExit(SaltCloudException): <NEW_LINE> <INDENT> def __init__(self, message, exit_code=salt.defaults.exitcodes.EX_GENERIC): <NEW_LINE> <INDENT> SaltCloudException.__init__(self, message) <NEW_LINE> self.message = message <NEW_LINE> self.exit_code = exit_code
This exception is raised when the execution should be stopped.
62598f731d351010ab8f33cf
class LoadAndParse: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.data = None <NEW_LINE> self.title = None <NEW_LINE> <DEDENT> def load_file(self, path): <NEW_LINE> <INDENT> with open(path, "r") as json_file: <NEW_LINE> <INDENT> self.data = json.load(json_file) <NEW_LINE> <DEDENT> <DEDENT> def return...
Class for the LoadAndParse functionalities.
62598f731f5feb6acb1624c7
class CommonNeutronBase(ipd.ImplicitPolicyBase, rmd.OwnedResourcesOperations, rmd.ImplicitResourceOperations): <NEW_LINE> <INDENT> @log.log_method_call <NEW_LINE> def initialize(self): <NEW_LINE> <INDENT> self._cached_agent_notifier = None <NEW_LINE> self._gbp_plugin = None <NEW_LINE> super(CommonNeutronBase, self).ini...
Neutron Resources' Orchestration driver. This driver realizes GBP's network semantics by orchestrating the necessary Neutron resources.
62598f730a366e3fb87dc257
class User(Base): <NEW_LINE> <INDENT> __tablename__ = 'users' <NEW_LINE> name = Column(String(250)) <NEW_LINE> id = Column(Integer, primary_key=True) <NEW_LINE> email = Column(String(250)) <NEW_LINE> picture = Column(String(250))
schema for the table user
62598f738c3a8732951f5ddf
class RegressionPlotHandler(HasTraits): <NEW_LINE> <INDENT> data = Array <NEW_LINE> Y = Array <NEW_LINE> selection_olsfit = Array <NEW_LINE> index = Array <NEW_LINE> container = Instance(OverlayPlotContainer) <NEW_LINE> selection_handler = Instance(SelectionHandler) <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> se...
Class for handling regression plots
62598f734e696a045264da46
class UserAPI(MethodView): <NEW_LINE> <INDENT> def post(self): <NEW_LINE> <INDENT> parser = reqparse.RequestParser() <NEW_LINE> parser.add_argument('username', type=str, required=True, location='json', help="Username Required") <NEW_LINE> parser.add_argument('password', type=str, required=True, location='json', help="P...
User Registration Resource
62598f7350485f2cf55da800
class Fr24FlightList(Fr24Base): <NEW_LINE> <INDENT> BASE_URI = ('http://api.flightradar24.com/common/v1/flight/list.json' '?query={}&fetchBy=flight') <NEW_LINE> def __init__(self, flight_nb, verbose=False): <NEW_LINE> <INDENT> uri = self.BASE_URI.format(flight_nb) <NEW_LINE> super().__init__(uri=uri, verbose=verbose)
fr24.com flight list for a given flight number (ex. 'NH216') interactive object: the flight number must be specified
62598f736e29344779affef0
class JSONObjects(JSONDict): <NEW_LINE> <INDENT> def __init__(self, name, uuid=None, enabled=True): <NEW_LINE> <INDENT> JSONDict.__init__(self, name, uuid=uuid, enabled=enabled) <NEW_LINE> <DEDENT> def get_entries(self, isa): <NEW_LINE> <INDENT> item_list = [] <NEW_LINE> for item in self.value: <NEW_LINE> <INDENT> if i...
XCode JSON dictionary Each JSON entry for XCode consists of the name followed by an optional comment, and an optional value and then a mandatory suffix.
62598f73a4f1c619b294de7d
class BEP3PieceSelectionStrategy(PieceSelectionStrategy): <NEW_LINE> <INDENT> def __init__(self, service) -> None: <NEW_LINE> <INDENT> super(BEP3PieceSelectionStrategy, self).__init__(service) <NEW_LINE> self.early = RandomPieceSelectionStrategy(service) <NEW_LINE> self.mid = RarestFirstPieceSelectionStrategy(service) ...
The piece selection strategy described in BEP3 and BitTorrent whitepaper, combining RandomPieceSelectionStrategy, RarestFirstPieceSelectionStrategy and EndGamePieceSelectionStrategy and choosing between them depending on the stage of download.
62598f7366673b3332c2fc51
class SettingCodes(enum.IntEnum): <NEW_LINE> <INDENT> HEADER_TABLE_SIZE = SettingsFrame.HEADER_TABLE_SIZE <NEW_LINE> ENABLE_PUSH = SettingsFrame.ENABLE_PUSH <NEW_LINE> MAX_CONCURRENT_STREAMS = SettingsFrame.MAX_CONCURRENT_STREAMS <NEW_LINE> INITIAL_WINDOW_SIZE = SettingsFrame.INITIAL_WINDOW_SIZE <NEW_LINE> MAX_FRAME_SI...
All known HTTP/2 setting codes. .. versionadded:: 2.6.0
62598f731d351010ab8f33d0
@registries.ZIGBEE_CHANNEL_REGISTRY.register(smartenergy.Metering.cluster_id) <NEW_LINE> class Metering(AttributeListeningChannel): <NEW_LINE> <INDENT> REPORT_CONFIG = [{"attr": "instantaneous_demand", "config": REPORT_CONFIG_DEFAULT}] <NEW_LINE> unit_of_measure_map = { 0x00: "kW", 0x01: "m³/h", 0x02: "ft³/h", 0x03: "c...
Metering channel.
62598f7376d4e153a661c4a4
class MyJsonWebTokenAuthentication(BaseAuthentication): <NEW_LINE> <INDENT> User = get_user_model() <NEW_LINE> def authenticate(self, request): <NEW_LINE> <INDENT> jwt_value = self.get_jwt_value(request) <NEW_LINE> if jwt_value is None: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> payloa...
重写JWT认证类 1.用于有效获取Token 2.校验Token 3.生成User对象
62598f73d99f1b3c44d04f47
class FloatConverter(NumberConverter): <NEW_LINE> <INDENT> regex = r'\d+\.\d+' <NEW_LINE> num_convert = float <NEW_LINE> def __init__(self, map, min=None, max=None): <NEW_LINE> <INDENT> NumberConverter.__init__(self, map, 0, min, max)
This converter only accepts floating point values:: Rule('/probability/<float:probability>') This converter does not support negative values. :param map: the :class:`Map`. :param min: the minimal value. :param max: the maximal value.
62598f7315baa7234946181c
class Singleton: <NEW_LINE> <INDENT> _instance: Optional = None <NEW_LINE> def __init__(self) -> None: <NEW_LINE> <INDENT> if Singleton._instance is not None: <NEW_LINE> <INDENT> raise ReferenceError("Cannot instantiate a singleton class.") <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> Singleton._instance = self <NEW_L...
The Singleton class defines the `getInstance` method that lets clients access the unique singleton instance.
62598f737b25080760ed6d30
class State: <NEW_LINE> <INDENT> out_acc = 3 <NEW_LINE> def __init__(self, time: float, coords: Coordinates, velo: float, mu: float, theta: float): <NEW_LINE> <INDENT> self.t = time <NEW_LINE> self.coords = copy(coords) <NEW_LINE> self.V = velo <NEW_LINE> self.mu = mu <NEW_LINE> self.Theta = theta <NEW_LINE> <DEDENT> d...
Current state of the rocket.
62598f738c3a8732951f5de0
class EditProductFormTest(case.DBTestCase): <NEW_LINE> <INDENT> @property <NEW_LINE> def form(self): <NEW_LINE> <INDENT> from moztrap.view.manage.products.forms import EditProductForm <NEW_LINE> return EditProductForm <NEW_LINE> <DEDENT> def test_edit_product(self): <NEW_LINE> <INDENT> p = self.F.ProductFactory(name="T...
Tests for EditProductForm.
62598f731d351010ab8f33d1
class Dialog(Toplevel): <NEW_LINE> <INDENT> def __init__(self, parent, title = None): <NEW_LINE> <INDENT> master = parent <NEW_LINE> if not master: <NEW_LINE> <INDENT> master = _get_default_root('create dialog window') <NEW_LINE> <DEDENT> Toplevel.__init__(self, master) <NEW_LINE> self.withdraw() <NEW_LINE> if parent i...
Class to open dialogs. This class is intended as a base class for custom dialogs
62598f7307d97122c4216532
class ProblemResponseAnswerDistribution(models.Model): <NEW_LINE> <INDENT> class Meta(object): <NEW_LINE> <INDENT> db_table = 'answer_distribution' <NEW_LINE> <DEDENT> course_id = models.CharField(db_index=True, max_length=255) <NEW_LINE> module_id = models.CharField(db_index=True, max_length=255) <NEW_LINE> part_id = ...
Each row stores the count of a particular answer to a response in a problem in a course (usage).
62598f7326068e7796d4c1ef
class User(object): <NEW_LINE> <INDENT> name = 'user'
Test identity.
62598f73be383301e025308a
class GetWorkerPids(Service): <NEW_LINE> <INDENT> class SimpleIO(object): <NEW_LINE> <INDENT> output_required = (List('pids'),) <NEW_LINE> <DEDENT> def handle(self): <NEW_LINE> <INDENT> self.response.payload.pids = get_worker_pids(self.server.base_dir)
Returns PIDs of all workers of current server.
62598f739b70327d1c57e640
class VariableCollection(AttributeCollection): <NEW_LINE> <INDENT> _expected_type = Variable
Collection of type :class:`sympy.core.symbol.Symbol`
62598f73d18da76e235b6d80
class DistributedStrategy(fluid.BuildStrategy): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(DistributedStrategy, self).__init__() <NEW_LINE> self.use_local_sgd = False <NEW_LINE> self.use_dist_fc = False <NEW_LINE> self.dist_fc_config = None <NEW_LINE> self.mode = "nccl2" <NEW_LINE> self.collectiv...
Init function of DistributedStrategy
62598f73ac7a0e7691f71daa
class Computer(Player): <NEW_LINE> <INDENT> def __init__(self, name, color): <NEW_LINE> <INDENT> super().__init__(name, color) <NEW_LINE> <DEDENT> def play(self, grid): <NEW_LINE> <INDENT> print("Computing...") <NEW_LINE> best_move = self.min_max_computation(grid, TRIALS) <NEW_LINE> print("I play:", best_move) <NEW_LIN...
class representating a computer wich can play the VirusGame
62598f736e29344779affef2
class BudgetLineItem(BudgetItem): <NEW_LINE> <INDENT> def __init__(self, budget_items: List[BudgetItem] = None, **kwargs): <NEW_LINE> <INDENT> super().__init__(**kwargs) <NEW_LINE> self.budget_items = budget_items or [] <NEW_LINE> <DEDENT> def _step(self, budget: MonthlyBudget) -> MonthlyExpense: <NEW_LINE> <INDENT> ex...
BudgetItem composite class
62598f733eb6a72ae0389ed5
class Welford(object): <NEW_LINE> <INDENT> def __init__(self, lst=None): <NEW_LINE> <INDENT> self.k = 0 <NEW_LINE> self.M = 0 <NEW_LINE> self.S = 0 <NEW_LINE> self.__call__(lst) <NEW_LINE> <DEDENT> def update(self, x): <NEW_LINE> <INDENT> if x is None: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> self.k += 1 <NEW_LIN...
Implements Welford's algorithm for computing a running mean and standard deviation as described at: http://www.johndcook.com/standard_deviation.html can take single values or iterables Properties: mean - returns the mean std - returns the std meanfull- returns the mean and std of the mean Usage: ...
62598f734d74a7450cd58b23