code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class ISO8601Interval(IntervalBase): <NEW_LINE> <INDENT> NULL_INTERVAL_STRING = "P0Y" <NEW_LINE> TYPE = CYCLER_TYPE_ISO8601 <NEW_LINE> TYPE_SORT_KEY = CYCLER_TYPE_SORT_KEY_ISO8601 <NEW_LINE> __slots__ = ('value') <NEW_LINE> @classmethod <NEW_LINE> def get_null(cls): <NEW_LINE> <INDENT> return ISO8601Interval("P0Y") <NE... | The interval between points in an ISO8601 date time sequence. | 62598fd8c4546d3d9def7529 |
class YAMLParser(BaseParser): <NEW_LINE> <INDENT> media_type = "application/yaml" <NEW_LINE> def parse(self, stream, media_type=None, parser_context=None): <NEW_LINE> <INDENT> assert yaml, "YAMLParser requires pyyaml to be installed" <NEW_LINE> parser_context = parser_context or {} <NEW_LINE> encoding = parser_context.... | Parses YAML-serialized data. | 62598fd89f28863672818b24 |
class SCD30Conf(AbstractSCD30Conf): <NEW_LINE> <INDENT> def __init__(self, sample_interval, temperature_offset): <NEW_LINE> <INDENT> super().__init__(sample_interval, temperature_offset) <NEW_LINE> <DEDENT> @staticmethod <NEW_LINE> def scd30(): <NEW_LINE> <INDENT> baseline = SCD30Baseline.load(Host, skeleton=True) <NEW... | classdocs | 62598fd826238365f5fad0b1 |
class Vulns(QWidget): <NEW_LINE> <INDENT> def __init__(self, args, parent): <NEW_LINE> <INDENT> super().__init__(parent) <NEW_LINE> self.lst = args[0] <NEW_LINE> self.database = args[1] <NEW_LINE> self.add_fct = args[2] <NEW_LINE> self.tabs = {} <NEW_LINE> self.init_tab() <NEW_LINE> self.grid = QGridLayout() <NEW_LINE>... | Class for the features of the "Vulns" tab. | 62598fd8a219f33f346c6d56 |
class TestCollector(BasicTestCollector): <NEW_LINE> <INDENT> handled_getters = [FunctionalDocTestGetter, UnitDocTestGetter, PythonTestGetter, SimpleDocTestGetter] | A TestCollector that wraps doctests and PythonTests.
| 62598fd88a349b6b43686790 |
class PycbcDarkVsBrightInjectionsExecutable(Executable): <NEW_LINE> <INDENT> current_retention_level = Executable.FINAL_RESULT <NEW_LINE> def __init__(self, cp, exe_name, universe=None, ifos=None, out_dir=None, tags=None): <NEW_LINE> <INDENT> if tags is None: <NEW_LINE> <INDENT> tags = [] <NEW_LINE> <DEDENT> Executable... | The clase used to create jobs for the pycbc_dark_vs_bright_injections Executable. | 62598fd8656771135c489bc2 |
@dataclass(frozen=True) <NEW_LINE> class ParseErrorJsonFile(ReportItemMessage): <NEW_LINE> <INDENT> file_type_code: file_type_codes.FileTypeCode <NEW_LINE> line_number: int <NEW_LINE> column_number: int <NEW_LINE> position: int <NEW_LINE> reason: str <NEW_LINE> full_msg: str <NEW_LINE> file_path: Optional[str] <NEW_LIN... | Unable to parse a file with JSON data
file_type_code -- item from pcs.common.file_type_codes
line_number -- the line where parsing failed
column_number -- the column where parsing failed
position -- the start index of the file where parsing failed
reason -- the unformatted error message
full_msg -- full error message ... | 62598fd8283ffb24f3cf3dd1 |
class MockClientWorker(object): <NEW_LINE> <INDENT> def __init__(self, client=None): <NEW_LINE> <INDENT> self.stats_collector = MockStatsCollector() <NEW_LINE> self.client = client <NEW_LINE> <DEDENT> def start(self): <NEW_LINE> <INDENT> pass | Mock client worker for GetClientStatsActionTest. | 62598fd8ad47b63b2c5a7da3 |
class PiJukeboxScreens(Screens): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> Screens.__init__(self) <NEW_LINE> self.screen_list.append(ScreenPlaying(SCREEN)) <NEW_LINE> self.screen_list.append(ScreenPlaylist(SCREEN)) <NEW_LINE> self.screen_list.append(ScreenLibrary(SCREEN)) <NEW_LINE> self.screen_list.a... | Manages Pi Jukebox's main screens.
- Player screen
- Library screen
Handles screen switching, clicking and swiping and displaying mpd status
updates on screen(s) | 62598fd80fa83653e46f5439 |
class PictureDownloadHandler(PictureObjectHandler): <NEW_LINE> <INDENT> @asynchronous <NEW_LINE> def on_picture_found(self, picture, id): <NEW_LINE> <INDENT> self.picture = picture <NEW_LINE> data = dict() <NEW_LINE> data["picture"] = picture.toDict(localized=False) <NEW_LINE> data["contact"] = UserManager.getUser().as... | Handler that allows newebe owner to download original file of the picture
inside its newebe to make it available through UI. | 62598fd8099cdd3c63675687 |
class TestLexer(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.parser = Parser() <NEW_LINE> <DEDENT> def test_keyValue(self): <NEW_LINE> <INDENT> archieml = 'key: This is a value' <NEW_LINE> expected = "[LexToken(IDENTIFIER,'key',1,0), LexToken(COLON,':',1,3), LexToken(TEXT,'This is a... | Test lexing. This is an intermediate step to actually converting an
ArchieML string to json. | 62598fd8a219f33f346c6d58 |
class SecurityGroupServerRpcApiMixin(object): <NEW_LINE> <INDENT> def security_group_rules_for_devices(self, context, devices): <NEW_LINE> <INDENT> LOG.debug(_("Get security group rules " "for devices via rpc %r"), devices) <NEW_LINE> return self.call(context, self.make_msg('security_group_rules_for_devices', devices=d... | A mix-in that enable SecurityGroup support in plugin rpc
| 62598fd8adb09d7d5dc0aacc |
class SockServer(ThreadingTCPServer): <NEW_LINE> <INDENT> def __init__(self, server_address, RequestHandlerClass = SocksHandler, version = V_SOCKS5, rmt_addr = [], user = None, pwd = None, verbose = False, log = None, log_fmt = None, time_fmt = None): <NEW_LINE> <INDENT> if not issubclass(RequestHandlerClass, SocksHand... | SOCKS server that handle all SOCKS clients' requests. | 62598fd8ab23a570cc2d5017 |
class lazy_array_loader(object): <NEW_LINE> <INDENT> def __init__(self, path, data_type='data', mem_map=False, map_fn=None): <NEW_LINE> <INDENT> lazypath = get_lazy_path(path) <NEW_LINE> datapath = os.path.join(lazypath, data_type) <NEW_LINE> self._file = open(datapath, 'rb') <NEW_LINE> self.file = self._file <NEW_LINE... | Arguments:
path: path to directory where array entries are concatenated into one big string file
and the .len file are located
data_type (str): Some datsets have multiple fields that are stored in different paths.
`data_type` specifies which of these fields to load in this class
mem_map (bo... | 62598fd8c4546d3d9def752c |
class EmploymentDetailsListSerializer(AbstractBaseSerializer): <NEW_LINE> <INDENT> department_name = serializers.StringRelatedField(source=DEPARTMENT, read_only=True) <NEW_LINE> designation_name = serializers.StringRelatedField(source=DESIGNATION, read_only=True) <NEW_LINE> class Meta: <NEW_LINE> <INDENT> list_serializ... | Serializer for listing Employment Details only | 62598fd8377c676e912f7024 |
class CommentFilter(django_filters.rest_framework.FilterSet): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> model = Comments <NEW_LINE> fields = ['article'] | 文章的过滤类 | 62598fd8dc8b845886d53b12 |
class V2vKeystoneContext(base_wsgi.Middleware): <NEW_LINE> <INDENT> @webob.dec.wsgify(RequestClass=base_wsgi.Request) <NEW_LINE> def __call__(self, req): <NEW_LINE> <INDENT> user_id = req.headers.get('X_USER') <NEW_LINE> user_id = req.headers.get('X_USER_ID', user_id) <NEW_LINE> if user_id is None: <NEW_LINE> <INDENT> ... | Make a request context from keystone headers. | 62598fd87cff6e4e811b5f7e |
class CollectorThread(threading.Thread): <NEW_LINE> <INDENT> def __init__(self, client): <NEW_LINE> <INDENT> threading.Thread.__init__(self) <NEW_LINE> self.client = client <NEW_LINE> self.name = 'gw1000-collector' <NEW_LINE> <DEDENT> def run(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self.client.collect_senso... | Class used to collect data via the GW1000 API in a thread. | 62598fd88a349b6b43686796 |
class IAddEditViewTitle(Interface): <NEW_LINE> <INDENT> pass | Demographics field add/edit view title. | 62598fd8956e5f7376df5928 |
class HashTable: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.size = 11 <NEW_LINE> self.slots = [None] * self.size <NEW_LINE> self.data = [None] * self.size <NEW_LINE> <DEDENT> def __getitem__(self, key): <NEW_LINE> <INDENT> return self.get(key) <NEW_LINE> <DEDENT> def __setitem__(self, key, value):... | Hastable w/chaining | 62598fd8dc8b845886d53b14 |
class IsServiceOwner(permissions.BasePermission): <NEW_LINE> <INDENT> def has_permission(self, request, view): <NEW_LINE> <INDENT> service_uid = request.data.get('service_uid') <NEW_LINE> if service_uid is None: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> return has_permission_to_service( request.user, service_... | Checks if given user is an owner of the service given by service_uid
that is coming in request's payload. Can easily be extended to get
service_uid from URL. | 62598fd8656771135c489bc8 |
class SC2GymEnv(gym.Env): <NEW_LINE> <INDENT> def __init__(self, map_name='MoveToBeacon', realtime=False, visualize=True, replay_dir='replays'): <NEW_LINE> <INDENT> super(SC2GymEnv, self).__init__() <NEW_LINE> self._env = sc2_env.SC2Env( map_name=map_name, players=[sc2_env.Agent(sc2_env.Race.terran, "Tergot"), sc2_env.... | Custom Environment that follows gym interface | 62598fd8283ffb24f3cf3dd8 |
class Volunteer(models.Model): <NEW_LINE> <INDENT> name = models.CharField(max_length=255) <NEW_LINE> email = models.EmailField() <NEW_LINE> phone = models.CharField(max_length=15) <NEW_LINE> def __str__(self): <NEW_LINE> <INDENT> return self.name | Model for each volunteer
| 62598fd8ab23a570cc2d5019 |
class CNN(NeuralNetwork): <NEW_LINE> <INDENT> def __init__(self, state_shape, num_actions, hidden=20, lr=1e-4): <NEW_LINE> <INDENT> self._build_model(state_shape, num_actions, hidden, lr) <NEW_LINE> <DEDENT> def _build_model(self, state_shape, num_actions, hidden, lr): <NEW_LINE> <INDENT> self.states_ = tf.placeholder(... | Convolutional Network class based on TensorFlow. | 62598fd8adb09d7d5dc0aad0 |
class CaptureTarget(Enum): <NEW_LINE> <INDENT> STRING = -1 <NEW_LINE> STDOUT = -2 | Constants used for contextmanager captured.
Used similarly like the constants PIPE, STDOUT for stdlib's subprocess.Popen. | 62598fd8d8ef3951e32c8107 |
class MediaMiddleware(StaticMiddlewareBase, IMiddleware, SharedDataMiddleware): <NEW_LINE> <INDENT> name = 'media' <NEW_LINE> exports = {ctx.cfg['routing.urls.media'].split(':', 1)[1]: MEDIA_PATH} <NEW_LINE> url_rules = [ Rule('/', defaults={'file': '/'}, endpoint='media'), Rule('/<path:file>', endpoint='media') ] | Concrete media file serving middleware implementation | 62598fd8dc8b845886d53b16 |
class RestoreLibraryData(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.blend_file = 'T:\\Projects\\0043_Ozzy\\Shots\\140\\0010\\layout\\publish\\140.0010_publish.v0002.blend' <NEW_LINE> self.source_list = [] <NEW_LINE> self.taget_list = [] <NEW_LINE> self.base_path = 'C:\\Temp\\RenderData' <... | Remap libraries to new paths, move libraries to those paths, and save all to new, mobile, directory. | 62598fd8283ffb24f3cf3dda |
class TestNgt: <NEW_LINE> <INDENT> def test_int_float(self): <NEW_LINE> <INDENT> assert ngt(1, 1.000000001) == 0 <NEW_LINE> <DEDENT> def test_eq(self): <NEW_LINE> <INDENT> assert ngt(23, 22) == 1 <NEW_LINE> <DEDENT> def test_typeerror(self): <NEW_LINE> <INDENT> with pytest.raises(TypeError): <NEW_LINE> <INDENT> ngt("he... | Числовая операция БОЛЬШЕ (1 - больше, 0 - меньше)
!!! Необходимо уточнить (что возвращает) | 62598fd8ad47b63b2c5a7dab |
class Calendar(BoundedDate): <NEW_LINE> <INDENT> pass | A bounded date control which edits a Python datetime.date using
a widget which resembles a calendar. | 62598fd8091ae35668705174 |
class AffinityPropagationClustering(Pipeline): <NEW_LINE> <INDENT> def __init__(self, metric: Optional[str] = "cosine"): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.metric = metric <NEW_LINE> self.damping = Uniform(0.5, 1.0) <NEW_LINE> self.preference = Uniform(-10.0, 0.0) <NEW_LINE> <DEDENT> def initialize(... | Clustering based on affinity propagation
Parameters
----------
metric : `str`, optional
Distance metric. Defaults to 'cosine'
Hyper-parameters
----------------
damping : `float`
preference : `float`
See `sklearn.cluster.AffinityPropagation` | 62598fd8956e5f7376df592a |
class EntryTestCase(TestCase): <NEW_LINE> <INDENT> def test_model(self): <NEW_LINE> <INDENT> obj = mixer.blend('frequently.Entry') <NEW_LINE> self.assertTrue(str(obj)) | Tests for the ``Entry`` model class. | 62598fd89f28863672818b2b |
class Pool(A10BaseClass): <NEW_LINE> <INDENT> def __init__(self, **kwargs): <NEW_LINE> <INDENT> self.ERROR_MSG = "" <NEW_LINE> self.required = [ "pool_name"] <NEW_LINE> self.b_key = "pool" <NEW_LINE> self.a10_url="/axapi/v3/ip/nat/pool/{pool_name}" <NEW_LINE> self.DeviceProxy = "" <NEW_LINE> self.use_if_ip = "" <NEW_LI... | Class Description::
Configure IP pool name.
Class pool supports CRUD Operations and inherits from `common/A10BaseClass`.
This class is the `"PARENT"` class for this module.`
:param use_if_ip: {"description": "Use Interface IP", "format": "flag", "default": 0, "optional": true, "plat-pos-list": ["soft-ax"], "not": "st... | 62598fd8656771135c489bce |
class ShowRessort(object): <NEW_LINE> <INDENT> def __call__(self, ressort): <NEW_LINE> <INDENT> last_view = zeit.calendar.browser.interfaces.ILastView( self.request.principal) <NEW_LINE> last_view.hidden_ressorts = last_view.hidden_ressorts.difference( [ressort]) | Show a ressort. | 62598fd8377c676e912f7029 |
@simple_serialization <NEW_LINE> class PoliticalParty(ElectionParty): <NEW_LINE> <INDENT> is_coalition = False <NEW_LINE> def __init__(self, name: str, number: Optional[int] = None, affiliations: Optional[List[PoliticalParty]] = None, lead: Optional[Person] = None, properties: Dict[str, Any] = None, withdrawn: bool = F... | A political party or movement that is eligible to stand in elections.
:param name: Name of the party, in any customary text format.
:param number: Candidacy number assigned to the party for the purpose
of the election; usually drawn by lot.
:param affiliation: Other (e.g. national or supranational) parties this
... | 62598fd8c4546d3d9def7531 |
@customer_api.route('/reservation') <NEW_LINE> class CreateReservation(Resource): <NEW_LINE> <INDENT> @customer_token_required <NEW_LINE> @customer_api.doc('book_a_reservation') <NEW_LINE> @customer_api.response(201, 'Reservation created.') <NEW_LINE> @customer_api.expect(_reservation, validate=True) <NEW_LINE> def pos... | Customer Reservation | 62598fd897e22403b383b467 |
class ReminderSchedule(object): <NEW_LINE> <INDENT> def __init__(self, days_before_starting = None, frequency_days = None, max_reminders = None): <NEW_LINE> <INDENT> self.wait_period = datetime.timedelta(days_before_starting) <NEW_LINE> self.end_cutoff_date = datetime.datetime.now() - self.wait_period <NEW_LINE> self.r... | class that given the three settings:
* days to wait before sending the reminders
* frequency of reminders
* maximum number of reminders
return dates when to start sending the reminders,
when to stop, and give friendly names to other
variables
These objects can be reused to all methods that
intend to remind of certain... | 62598fd8dc8b845886d53b1c |
class ShopTestCase(unittest.TestCase): <NEW_LINE> <INDENT> def test_subclass(self): <NEW_LINE> <INDENT> from collective.cart.core.interfaces import IShoppingSiteRoot <NEW_LINE> from collective.cart.shopping.schema import ShopSchema <NEW_LINE> self.assertTrue(issubclass(Shop, Container)) <NEW_LINE> self.assertTrue(issub... | TestCase for content type: collective.cart.shopping.Shop | 62598fd8adb09d7d5dc0aad8 |
class Encoder(nn.Module): <NEW_LINE> <INDENT> def __init__(self, num_nodes, num_rels, embed_dim, device): <NEW_LINE> <INDENT> super(Encoder, self).__init__() <NEW_LINE> self.num_nodes = num_nodes <NEW_LINE> self.num_rels = num_rels <NEW_LINE> self.embed_dim = embed_dim <NEW_LINE> self.device = device <NEW_LINE> self.en... | docstring for Encoder | 62598fd83617ad0b5ee066a6 |
class EmployeeEditView(LoginRequiredMixin, UpdateView): <NEW_LINE> <INDENT> login_url = '/login' <NEW_LINE> model = Employees <NEW_LINE> fields = '__all__' <NEW_LINE> template_name_suffix = '_update_form' <NEW_LINE> def get_success_url(self): <NEW_LINE> <INDENT> return reverse('employee-site') | Edit employee's data | 62598fd8656771135c489bd2 |
class Edit(OpenShiftCLI): <NEW_LINE> <INDENT> def __init__(self, kind, namespace, resource_name=None, kubeconfig='/etc/origin/master/admin.kubeconfig', separator='.', verbose=False): <NEW_LINE> <INDENT> super(Edit, self).__init__(namespace, kubeconfig=kubeconfig, verbose=verbose) <NEW_LINE> self.kind = kind <NEW_LINE> ... | Class to wrap the oc command line tools
| 62598fd8dc8b845886d53b1e |
class Parents (weakref.WeakValueDictionary): <NEW_LINE> <INDENT> def __copy__ (self): <NEW_LINE> <INDENT> return self.__class__(self); <NEW_LINE> <DEDENT> def __deepcopy__ (self,memo): <NEW_LINE> <INDENT> return self.__class__(self); | The Parents class is used to manage a weakly-reffed dictionary of the
node's parents. We only redefine it as a class to implement __copy__
and __depcopy__ (which otherwise crashes and burns on weakrefs) | 62598fd87cff6e4e811b5f8a |
class NoticeLogging(logging.Handler): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> logging.Handler.__init__(self) <NEW_LINE> self.seen_message = False <NEW_LINE> <DEDENT> def emit(self, record): <NEW_LINE> <INDENT> self.seen_message = True | A log handler that, if asked to emit, will set
``self.seen_message`` to True. | 62598fd8ad47b63b2c5a7db3 |
class MacDocumentVersionsEventData(events.EventData): <NEW_LINE> <INDENT> DATA_TYPE = 'mac:document_versions:file' <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> super(MacDocumentVersionsEventData, self).__init__(data_type=self.DATA_TYPE) <NEW_LINE> self.last_time = None <NEW_LINE> self.name = None <NEW_LINE> self.... | MacOS document revision event data.
Attributes:
last_time (str): the system user ID of the user that opened the file.
name (str): name of the original file.
path (str): path from the original file.
query (str): SQL query that was used to obtain the event data.
user_sid (str): identification user ID that open... | 62598fd8c4546d3d9def7533 |
class Spritesheet: <NEW_LINE> <INDENT> def __init__(self, filename): <NEW_LINE> <INDENT> self.sheet = pygame.image.load(filename).convert() <NEW_LINE> <DEDENT> def imgat(self, rect, colorkey = None): <NEW_LINE> <INDENT> rect = pygame.Rect(rect) <NEW_LINE> image = pygame.Surface(rect.size).convert() <NEW_LINE> image.bli... | Class from http://www.scriptedfun.com/transcript-2-using-sprite-sheets-and-drawing-the-background/
This class can be used to seporate images from the sprite sheet | 62598fd9dc8b845886d53b20 |
class DT2NIfTI(CommandLine): <NEW_LINE> <INDENT> _cmd = 'dt2nii' <NEW_LINE> input_spec = DT2NIfTIInputSpec <NEW_LINE> output_spec = DT2NIfTIOutputSpec <NEW_LINE> def _list_outputs(self): <NEW_LINE> <INDENT> outputs = self.output_spec().get() <NEW_LINE> output_root = self._gen_outputroot() <NEW_LINE> outputs["dt"] = os.... | Converts camino tensor data to NIfTI format
Reads Camino diffusion tensors, and converts them to NIFTI format as three .nii files. | 62598fd926238365f5fad0c6 |
class GotoRedirect(BrowserView): <NEW_LINE> <INDENT> def __call__(self, *args, **kwargs): <NEW_LINE> <INDENT> manager = IGUIDManager(self.context) <NEW_LINE> request = self.request <NEW_LINE> response = self.request.response <NEW_LINE> obj = None <NEW_LINE> guid = request.get('guid', None) <NEW_LINE> if not guid: <NEW_... | Given a guid in the url request redirect to the correct page | 62598fd9ab23a570cc2d501f |
class ByteWriteable(Protocol): <NEW_LINE> <INDENT> def write(self, data: bytes) -> int: <NEW_LINE> <INDENT> pass | The type of object which must be passed into read_body_with_max_size.
Typically this is a file object. | 62598fd997e22403b383b46d |
class Breakpoints(BreakpointWidget, SpyderPluginMixin): <NEW_LINE> <INDENT> CONF_SECTION = 'breakpoints' <NEW_LINE> def __init__(self, parent=None): <NEW_LINE> <INDENT> BreakpointWidget.__init__(self, parent=parent) <NEW_LINE> SpyderPluginMixin.__init__(self, parent) <NEW_LINE> self.initialize_plugin() <NEW_LINE> self.... | Breakpoint list | 62598fd9d8ef3951e32c810d |
class BorderChoiceView(ListAPIView, CreateAPIView): <NEW_LINE> <INDENT> serializer_class = ChoiceItemSeralizer <NEW_LINE> permissions = [permissions.IsAuthenticated] <NEW_LINE> queryset = BorderChoice.objects.all() | Список возможных вариантов границы | 62598fd98a349b6b436867a4 |
class QFUImage(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def make(self, header, infile): <NEW_LINE> <INDENT> infile.seek(0, os.SEEK_END) <NEW_LINE> size = infile.tell() <NEW_LINE> header.num_blocks = ((size-1) // header.block_size) + 2 <NEW_LINE> content = header.pack... | Creates a QFU compatible file from a binary file. | 62598fd926238365f5fad0c8 |
class PyPascalTriangleIterators(PyPascalTriangleBase): <NEW_LINE> <INDENT> max_height = 900 <NEW_LINE> def build(self, height): <NEW_LINE> <INDENT> if height == 0: <NEW_LINE> <INDENT> self._print(self.ONE_LIST) <NEW_LINE> return self.ONE_LIST <NEW_LINE> <DEDENT> elif height < 0: <NEW_LINE> <INDENT> return self.EMPTY_LI... | Based on :py:class::`PascalTriangleConstantLists`.
Difference:
- Iterators are used instead of lists where it is possible | 62598fd9ad47b63b2c5a7db7 |
class IssueListCreateView(generics.ListCreateAPIView): <NEW_LINE> <INDENT> serializer_class = IssueSerializer <NEW_LINE> permission_classes = [IsAuthenticated, IsIssue] <NEW_LINE> def get_queryset(self, *args, **kwargs): <NEW_LINE> <INDENT> user = self.request.user <NEW_LINE> id_project = self.kwargs.get('id_project') ... | get, create les issues du projet. Il y a que les contributeurs du projet qui y on accés | 62598fd9377c676e912f702d |
class ConfigFile(_messages.Message): <NEW_LINE> <INDENT> class FileTypeValueValuesEnum(_messages.Enum): <NEW_LINE> <INDENT> FILE_TYPE_UNSPECIFIED = 0 <NEW_LINE> SERVICE_CONFIG_YAML = 1 <NEW_LINE> OPEN_API_JSON = 2 <NEW_LINE> OPEN_API_YAML = 3 <NEW_LINE> FILE_DESCRIPTOR_SET_PROTO = 4 <NEW_LINE> <DEDENT> contents = _mess... | Generic specification of a source configuration file
Enums:
FileTypeValueValuesEnum: The kind of configuration file represented. This
is used to determine the method for generating `google.api.Service`
using this file.
Fields:
contents: DEPRECATED. The contents of the configuration file. Use
file_cont... | 62598fd9ab23a570cc2d5020 |
class RefreshToken(models.Model): <NEW_LINE> <INDENT> access_token = models.OneToOneField(AccessToken, related_name='refresh_token', on_delete=models.CASCADE) <NEW_LINE> user = models.ForeignKey(oauth_pen_settings.AUTH_USER_MODEL, on_delete=models.CASCADE) <NEW_LINE> token = models.CharField(max_length=255, unique=True... | 刷新token | 62598fd9adb09d7d5dc0aade |
class ClientCommand(object): <NEW_LINE> <INDENT> CONNECT, SEND, RECEIVE, CLOSE = range(4) <NEW_LINE> def __init__(self, type_, data=None): <NEW_LINE> <INDENT> self.type_of_data = type_ <NEW_LINE> self.data = data <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return f'Type: {self.type_of_data}\nData: {self.... | A command to the client thread.
Each command type has its associated data:
CONNECT: (host, port) tuple
SEND: Data string
RECEIVE: None
CLOSE: None | 62598fd9fbf16365ca794624 |
class MzXML(xml.ArrayConversionMixin, xml.IndexedXML): <NEW_LINE> <INDENT> _root_element = 'mzXML' <NEW_LINE> _default_iter_tag = 'scan' <NEW_LINE> _indexed_tags = {'scan'} <NEW_LINE> _indexed_tag_keys = {'scan': 'num'} <NEW_LINE> _default_version = None <NEW_LINE> _default_schema = xml._mzxml_schema_defaults <NEW_LINE... | Parser class for mzXML files. | 62598fd950812a4eaa620e95 |
class DebPlugin(Plugin): <NEW_LINE> <INDENT> def get_cruft(self): <NEW_LINE> <INDENT> return [] <NEW_LINE> <DEDENT> def post_cleanup(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self.app.apt_cache.commit(apt.progress.text.AcquireProgress(), apt.progress.base.InstallProgress()) <NEW_LINE> <DEDENT> finally: <NEW_L... | Plugin for post-cleanup processing with apt.
This plugin does not find any cruft of its own. Instead it centralizes
the post-cleanup handling for all packages that remove .deb packages. | 62598fd97cff6e4e811b5f90 |
class ConstantDefinitionTest(test_lib.BaseTestCase): <NEW_LINE> <INDENT> def testInitialize(self): <NEW_LINE> <INDENT> data_type_definition = data_types.ConstantDefinition( 'const', description='contant') <NEW_LINE> self.assertIsNotNone(data_type_definition) | Constant data type definition tests. | 62598fd9377c676e912f702e |
class _LoggingProjectsSinksRepository( repository_mixins.ListQueryMixin, _base_repository.GCPRepository): <NEW_LINE> <INDENT> def __init__(self, **kwargs): <NEW_LINE> <INDENT> super(_LoggingProjectsSinksRepository, self).__init__( key_field='parent', max_results_field='pageSize', component='projects.sinks', **kwargs) <... | Implementation of Logging Projects Sinks repository. | 62598fd997e22403b383b471 |
class Embeddings(nn.Module): <NEW_LINE> <INDENT> def __init__(self, config): <NEW_LINE> <INDENT> super(Embeddings, self).__init__() <NEW_LINE> self.word_embeddings = Embedding(config.vocab_size, config.hidden_size, padding_idx=0) <NEW_LINE> self.position_embeddings = Embedding(config.max_position_embeddings, config.hid... | Construct the embeddings from word, position and token_type embeddings.
| 62598fd98a349b6b436867a8 |
class CreateGoodsView(CreateView): <NEW_LINE> <INDENT> model = Product <NEW_LINE> template_name = 'my_shop/create.html' <NEW_LINE> form_class = ProdForm <NEW_LINE> def form_valid(self, form): <NEW_LINE> <INDENT> self.object = form.save(commit = False) <NEW_LINE> self.object.author = self.request.user <NEW_LINE> self.ob... | создание товара | 62598fd9956e5f7376df5931 |
class Env: <NEW_LINE> <INDENT> metadata = {'render.modes': ['rgb_array', 'human']} <NEW_LINE> def __init__(self, seed=None, itype=numpy.int64): <NEW_LINE> <INDENT> self.rng = numpy.random.RandomState(seed) <NEW_LINE> self.start = numpy.array([0, 3], dtype=itype) <NEW_LINE> self.wind = numpy.array([0, 0, 0, 1, 1, 1, 2, ... | Example 6.5: Windy Gridworld Env | 62598fd9091ae35668705184 |
class SensorsTest(Tester): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> Tester.__init__(self, "Sensors") <NEW_LINE> self.sensors = Sensors() <NEW_LINE> <DEDENT> def main(self): <NEW_LINE> <INDENT> self.rate.sleep() | Behavioral tests for ObstacleDectection. | 62598fd9ab23a570cc2d5022 |
class WFDB_CError(WFDB_Error): <NEW_LINE> <INDENT> def __init__(self, message, return_code=None): <NEW_LINE> <INDENT> super(WFDB_CError, self).__init__(message) <NEW_LINE> self.return_code = return_code | Exceptions that are raised as a result of catching error return codes
from the C WFDB Library
Notes:
The return code of this error should match that of the error code
returned by the underlying C function | 62598fd997e22403b383b473 |
class MultiChoiceQuestion(models.Model): <NEW_LINE> <INDENT> questionnaire = models.ForeignKey(Questionnaire, blank=False) <NEW_LINE> question_order = models.PositiveIntegerField(blank=False) <NEW_LINE> question_text = models.CharField(max_length=255, blank=False) <NEW_LINE> def __unicode__(self): <NEW_LINE> <INDENT> r... | Defines a multiple choice type question on the questionnaire
| 62598fd9656771135c489bdc |
class Collection(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(Collection, self).__init__() <NEW_LINE> self.__values = [] <NEW_LINE> <DEDENT> @property <NEW_LINE> def _values(self): <NEW_LINE> <INDENT> return self.__values <NEW_LINE> <DEDENT> def __contains__(self, item): <NEW_LINE> <INDENT... | Base class for collection classes. May also be used for part collections
that don't yet have any custom methods.
Has the following characteristics.:
* Container (implements __contains__)
* Iterable (delegates __iter__ to |list|)
* Sized (implements __len__)
* Sequence (delegates __getitem__ to |list|) | 62598fd9091ae35668705186 |
class DDPG4KeyWords(DDPG): <NEW_LINE> <INDENT> def __init__(self, **kwargs): <NEW_LINE> <INDENT> super(DDPG4KeyWords, self).__init__(**kwargs) <NEW_LINE> <DEDENT> def _build_a_net(self,s,scope,trainable): <NEW_LINE> <INDENT> w_initializer, b_initializer = None,None <NEW_LINE> with tf.variable_scope(scope): <NEW_LINE> <... | docstring for ClassName | 62598fd9adb09d7d5dc0aae4 |
class ObjectParser: <NEW_LINE> <INDENT> def __init__(self, data): <NEW_LINE> <INDENT> self.objects = {} <NEW_LINE> for key,value in data.items(): <NEW_LINE> <INDENT> self.objects[key] = Object(value) <NEW_LINE> <DEDENT> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return "objectParser:\n{0}".format( "\n%%\n".join([n... | A object parser | 62598fd9dc8b845886d53b2a |
class VMs(i3pystatus.IntervalModule): <NEW_LINE> <INDENT> color_up = "#00F000" <NEW_LINE> color_down = "#333333" <NEW_LINE> interval = 120 <NEW_LINE> settings = ( ("color_up", "Color when VMs are running"), ("color_down", "Color when VMs are stopped") ) <NEW_LINE> def run(self): <NEW_LINE> <INDENT> response = {'full_te... | Virtualbox VMs count. | 62598fd90fa83653e46f5455 |
class ZenpyCache(object): <NEW_LINE> <INDENT> AVAILABLE_CACHES = [ c for c in dir(cachetools) if c.endswith('Cache') and c != 'Cache' ] <NEW_LINE> def __init__(self, cache_impl, maxsize, **kwargs): <NEW_LINE> <INDENT> self.cache = self._get_cache_impl(cache_impl, maxsize, **kwargs) <NEW_LINE> self.purge_lock = RLock() ... | Wrapper class for the various cachetools caches. Adds ability to change cache implementations
on the fly and change the maxsize setting. | 62598fd997e22403b383b477 |
class OnlyIfParser(DecoratorBeforeEvalBaseExtensionParser): <NEW_LINE> <INDENT> __parsername__ = 'only_if' <NEW_LINE> @classmethod <NEW_LINE> def parse_element(cls, indent_stack): <NEW_LINE> <INDENT> return (Keyword("@only_if").suppress() + originalTextFor(nestedExpr()) ).setResultsName("only_if") .setPar... | Handles the @only_if decorator::
number_of_copies:
creator:
@only_if('BOOK' in self.get('collection.primary', []))
get_number_of_copies(self.get('recid')) | 62598fd93617ad0b5ee066b4 |
class Annotations(msrest.serialization.Model): <NEW_LINE> <INDENT> _attribute_map = { 'additional_properties': {'key': '', 'type': '{object}'}, 'created': {'key': 'org\\.opencontainers\\.image\\.created', 'type': 'iso-8601'}, 'authors': {'key': 'org\\.opencontainers\\.image\\.authors', 'type': 'str'}, 'url': {'key': 'o... | Additional information provided through arbitrary metadata.
:ivar additional_properties: Unmatched properties from the message are deserialized to this
collection.
:vartype additional_properties: dict[str, any]
:ivar created: Date and time on which the image was built (string, date-time as defined by
https://tools.i... | 62598fd950812a4eaa620e99 |
class Department(models.Model): <NEW_LINE> <INDENT> title = models.CharField(verbose_name='部门名称', max_length=16) <NEW_LINE> def __str__(self): <NEW_LINE> <INDENT> return self.title | 部门表 | 62598fd9377c676e912f7032 |
class SoupProcessorBase(abc.ABC): <NEW_LINE> <INDENT> @abc.abstractclassmethod <NEW_LINE> def process(self, soup: bs4.BeautifulSoup) -> str: <NEW_LINE> <INDENT> raise NotImplementedError | Class for processing a parsed HTML page | 62598fd9ab23a570cc2d5025 |
@autohelp <NEW_LINE> class bytesIterator(Object): <NEW_LINE> <INDENT> _immutable_fields_ = "s", <NEW_LINE> _index = 0 <NEW_LINE> def __init__(self, s): <NEW_LINE> <INDENT> self.s = s <NEW_LINE> <DEDENT> @method("List", "Any") <NEW_LINE> def next(self, ej): <NEW_LINE> <INDENT> if self._index < len(self.s): <NEW_LINE> <I... | An iterator on a bytestring, producing integers. | 62598fd99f28863672818b35 |
class MyGlanceStubClient(glance_stubs.StubGlanceClient): <NEW_LINE> <INDENT> def get(self, image_id): <NEW_LINE> <INDENT> if tries[0] == 0: <NEW_LINE> <INDENT> tries[0] = 1 <NEW_LINE> raise glanceclient.exc.ServiceUnavailable('') <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return {} | A client that fails the first time, then succeeds. | 62598fd9283ffb24f3cf3df2 |
class CNN(nn.Module): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(CNN, self).__init__() <NEW_LINE> self.num_classes = NUM_CLASSES <NEW_LINE> self.features = nn.Sequential( nn.Conv2d(1, 10, kernel_size=5), nn.MaxPool2d(kernel_size=2, stride=2), nn.ReLU(inplace=True), nn.Conv2d(10, 20, kernel_size=5... | CNN model | 62598fd97cff6e4e811b5f9a |
class InvoicingRequest(Request): <NEW_LINE> <INDENT> def __init__(self, op): <NEW_LINE> <INDENT> Request.__init__(self,op) | A class representing AGMS Invoicing Request objects. | 62598fd950812a4eaa620e9b |
class KALiteTestCase(SecuresyncTestCase): <NEW_LINE> <INDENT> def reverse(self, url_name, args=None, kwargs=None): <NEW_LINE> <INDENT> return self.live_server_url + reverse(url_name, args=args, kwargs=kwargs) | The base class for KA Lite test cases. | 62598fd99f28863672818b36 |
class UserException(Exception): <NEW_LINE> <INDENT> def __init__(self, err_message): <NEW_LINE> <INDENT> self.message = err_message | User defined exception to raise specific error scenarios. | 62598fd9283ffb24f3cf3df4 |
class ParallelNodeTerminated(Record): <NEW_LINE> <INDENT> def __init__(self, year, lines): <NEW_LINE> <INDENT> Record.__init__(self, year, lines) | Parallel node terminated
A parallel universe program has completed on a node.
Parameters
----------
year: `str`
the year to tag the job with
lines: list
the strings making up this record | 62598fd90fa83653e46f545b |
class RegisterMixIn(IdChangeKeyMixIn): <NEW_LINE> <INDENT> __slots__ = ('__dict__',) <NEW_LINE> INSERT_AFTER_FIELD = None <NEW_LINE> @classmethod <NEW_LINE> def register(cls, attr_name, attr_cls): <NEW_LINE> <INDENT> if not cls.INSERT_AFTER_FIELD: <NEW_LINE> <INDENT> raise ValueError('Class %s is missing INSERT_AFTER_F... | Base class for classes that can change their list of supported fields dynamically | 62598fd9ad47b63b2c5a7dc5 |
class Player : <NEW_LINE> <INDENT> def __init__(self,name='',MAX_ITEMS=0,items=[]): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.MAX_ITEMS = MAX_ITEMS <NEW_LINE> self.items = items <NEW_LINE> <DEDENT> def inventry(self): <NEW_LINE> <INDENT> if len(self.items) > 0 : <NEW_LINE> <INDENT> for item in self.items : <... | Player class | 62598fd99f28863672818b37 |
class Poisson1D(ProblemBase): <NEW_LINE> <INDENT> def __init__(self, ndofs, *args, **kwargs): <NEW_LINE> <INDENT> self.dx = 1.0 / (ndofs + 1) <NEW_LINE> A = 1.0 / (self.dx ** 2) * self.__get_system_matrix(ndofs) <NEW_LINE> rhs = self.__get_rhs(ndofs) <NEW_LINE> super(Poisson1D, self).__init__(ndofs, A, rhs, *args, **kw... | Implementation of the 1D Poission problem.
Here we define the 1D Poisson problem :math:`-\Delta u = 0` with
Dirichlet-Zero boundary conditions. This is the homogeneous problem,
derive from this class if you want to play around with different RHS.
Attributes:
dx (float): mesh size | 62598fd9a219f33f346c6d7a |
class Dice(): <NEW_LINE> <INDENT> def __init__(self,side=6): <NEW_LINE> <INDENT> self.side = side <NEW_LINE> <DEDENT> def roll_dice(self,roll_times): <NEW_LINE> <INDENT> for roll_time in range(roll_times): <NEW_LINE> <INDENT> print(randint(1,self.side)) | 定义一个几面的骰子 | 62598fd93617ad0b5ee066bc |
@OFPMultipartReply.register_stats_type() <NEW_LINE> @_set_stats_type(ofproto.OFPMP_QUEUE, OFPQueueStats) <NEW_LINE> @_set_msg_type(ofproto.OFPT_MULTIPART_REPLY) <NEW_LINE> class OFPQueueStatsReply(OFPMultipartReply): <NEW_LINE> <INDENT> def __init__(self, datapath, type_=None, **kwargs): <NEW_LINE> <INDENT> super(OFPQu... | Queue statistics reply message
The switch responds with this message to an aggregate flow statistics
request.
================ ======================================================
Attribute Description
================ ======================================================
body List of ``OFPQueue... | 62598fd9c4546d3d9def753d |
class DaemonPanel(Panel, threading.Thread): <NEW_LINE> <INDENT> def __init__(self, update_rate): <NEW_LINE> <INDENT> Panel.__init__(self) <NEW_LINE> threading.Thread.__init__(self) <NEW_LINE> self.setDaemon(True) <NEW_LINE> self._halt = False <NEW_LINE> self._update_rate = update_rate <NEW_LINE> <DEDENT> def _update(se... | Panel that triggers its _update() method at a set rate. | 62598fd98a349b6b436867b6 |
class BankRegisterViewSet(viewsets.ModelViewSet): <NEW_LINE> <INDENT> queryset = BankRegister.objects.all() <NEW_LINE> serializer_class = BankRegisterSerializer | API endpoint that allows BankRegisters to be viewed and edited | 62598fd9283ffb24f3cf3df8 |
class MonoLayerCrI3: <NEW_LINE> <INDENT> symbols = ('Cr', 'I') <NEW_LINE> numbers = (2, 6) <NEW_LINE> def __init__(self, a, disp=0.23, vac=20.0): <NEW_LINE> <INDENT> self.a = a <NEW_LINE> self.disp = disp <NEW_LINE> self.vac = vac <NEW_LINE> self.cell = np.array([ [ a, 0, 0], [-a/2, a/2*np.sqrt(3), 0], [ 0, 0, ... | a monolayer CrI3 structure,
INPUTS:
a: float, lattice constant a, in angstrum
disp: float, iodine displacement along z-axis, scaled by a,
vac: float, vacuum along z-axis, in angstrum
ATTRIBUTES:
a: the same as input
disp: the same as input
vac: the same as input... | 62598fd9956e5f7376df5938 |
class Rfc2307Config(LdapConfig): <NEW_LINE> <INDENT> pass | An RFC2307 user database configuration | 62598fd9099cdd3c6367569a |
class OsfAuthHandler(auth.BaseAuthHandler): <NEW_LINE> <INDENT> @asyncio.coroutine <NEW_LINE> def fetch(self, request, bundle): <NEW_LINE> <INDENT> headers = { 'Content-Type': 'application/json', } <NEW_LINE> authorization = request.headers.get('Authorization') <NEW_LINE> if authorization and authorization.startswith('... | Identity lookup via the Open Science Framework | 62598fd9a219f33f346c6d7e |
@dataclasses.dataclass <NEW_LINE> class DistrInfo: <NEW_LINE> <INDENT> xs: 'observation values' <NEW_LINE> J_dblocks: 'prior precision diagonal blocks' <NEW_LINE> J_offblocks: 'prior precision offdiagonal blocks' <NEW_LINE> JT_dblocks: 'posterior precision diagonal blocks' <NEW_LINE> JT_offblocks: 'post... | Collates some useful information about a model of the form
Z ~ PEG(G)
X[i] ~ N(B[i] Z[ts[idxs[i]],Sig[i])
after observing X | 62598fd926238365f5fad0dc |
class UserExperience(db.Model): <NEW_LINE> <INDENT> __tablename__ = 'user_experience' <NEW_LINE> id = Column(Integer, primary_key=True) <NEW_LINE> content = Column(Text, nullable=False) <NEW_LINE> user_id = db.Column(db.Integer, db.ForeignKey("users.id")) <NEW_LINE> user = db.relation("User", backref=backref( 'experien... | 用户的经历 | 62598fd98a349b6b436867ba |
class Task(_messages.Message): <NEW_LINE> <INDENT> kind = _messages.StringField(1, default=u'fusiontables#task') <NEW_LINE> progress = _messages.StringField(2) <NEW_LINE> started = _messages.BooleanField(3) <NEW_LINE> taskId = _messages.IntegerField(4) <NEW_LINE> type = _messages.StringField(5) | Specifies the identifier, name, and type of a task in a table.
Fields:
kind: Type of the resource. This is always "fusiontables#task".
progress: An indication of task progress.
started: false while the table is busy with some other task. true if this
background task is currently running.
taskId: Identifier... | 62598fd9ad47b63b2c5a7dcc |
class TabRenderer(object): <NEW_LINE> <INDENT> def __init__(self, contents): <NEW_LINE> <INDENT> self._contents = contents <NEW_LINE> <DEDENT> def __call__(self, handler): <NEW_LINE> <INDENT> return generate_display_html( handler, crypto.XsrfTokenManager, self._contents) | Convenience class for creating tabs for rendering in dashboard. | 62598fd9dc8b845886d53b38 |
class Number(RangeValidator): <NEW_LINE> <INDENT> messages = { 'number': _("Please enter a number") } <NEW_LINE> def _to_python(self, value, state): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> value = float(value) <NEW_LINE> try: <NEW_LINE> <INDENT> int_value = int(value) <NEW_LINE> <DEDENT> except OverflowError: <NEW... | Convert a value to a float or integer.
Tries to convert it to an integer if no information is lost.
Example::
>>> Number.to_python('10')
10
>>> Number.to_python('10.5')
10.5
>>> Number.to_python('ten')
Traceback (most recent call last):
...
Invalid: Please enter a number
>>> N... | 62598fd9ad47b63b2c5a7dcd |
class BaseGeometry: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def area(self): <NEW_LINE> <INDENT> raise Exception("area() is not implemented") | instance of geometry class | 62598fd9091ae35668705196 |
class QuitGanetiException(Exception): <NEW_LINE> <INDENT> pass | Signal Ganeti that it must quit.
This is not necessarily an error (and thus not a subclass of
GenericError), but it's an exceptional circumstance and it is thus
treated. This exception should be instantiated with two values. The
first one will specify the return code to the caller, and the second
one will be the retur... | 62598fd997e22403b383b485 |
class XinputParser(object): <NEW_LINE> <INDENT> _key_map = { "Buttons supported": "buttons_supported", "Button labels": "button_labels", "Button state": "button_state", "Class originated from": "device_class", "Keycodes supported": "keycodes_supported", "Touch mode": "touch_mode", "Max number of touches": "max_touch", ... | Parser for the xinput command. | 62598fd9ad47b63b2c5a7dce |
class InvalidAuthorizationHeader(DaedalusError): <NEW_LINE> <INDENT> pass | Thrown when the authorization is invalid. | 62598fd9283ffb24f3cf3dfe |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.