code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class LayoutParser(): <NEW_LINE> <INDENT> layout_parser = None <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> decimal = Word(nums) <NEW_LINE> comma = Suppress(Literal(',')) <NEW_LINE> start_token = Literal('{') | Literal('[') <NEW_LINE> end_token = Suppress(Literal('}') | Literal(']')) <NEW_LINE> layout_name = Su... | BNF representation for a Tmux Layout
<layout> :: <layout_name> <comma> <element>+ ;
<element> :: ( <container> | <pane> ) <comma>? ;
<layout_name> :: <hexadecimal>{4} ;
<container> :: <preamble> <start_token> <element>+ <end_token> ;
<pane> :: <preamble> <comma> <decimal> ;
<preamble> :... | 62598efbad47b63b2c5a615d |
class SourceContext(object): <NEW_LINE> <INDENT> def __init__(self, cloud_repo=None, cloud_workspace=None, gerrit=None, git=None): <NEW_LINE> <INDENT> self.swagger_types = { 'cloud_repo': 'CloudRepoSourceContext', 'cloud_workspace': 'CloudWorkspaceSourceContext', 'gerrit': 'GerritSourceContext', 'git': 'GitSourceContex... | NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually. | 62598efb5fcc89381b2655cb |
class AdminAddController(BaseController): <NEW_LINE> <INDENT> def encrypt(self, pwd): <NEW_LINE> <INDENT> h1 = hashlib.md5() <NEW_LINE> h1.update(pwd.encode(encoding='utf8')) <NEW_LINE> return h1.hexdigest() <NEW_LINE> <DEDENT> def post(self): <NEW_LINE> <INDENT> data = tornado.escape.json_decode(self.request.body) <NE... | /v1/admin/add | 62598efbbe383301e0252125 |
class DataBuffer(object): <NEW_LINE> <INDENT> def __init__(self, max_size=1048576): <NEW_LINE> <INDENT> self._data = collections.deque() <NEW_LINE> self._num_bytes = 0 <NEW_LINE> self._max_size = max_size <NEW_LINE> <DEDENT> @property <NEW_LINE> def num_bytes(self): <NEW_LINE> <INDENT> return self._num_bytes <NEW_LINE>... | A growing data buffer.
Args:
max_size (int): The maximum number of bytes to store.
This buffer uses algorithms similar to :mod:`tornado.iostream`. | 62598efb7b180e01f3e484e9 |
class Date(int): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def get_api_name(): <NEW_LINE> <INDENT> return "date" | Date (in seconds since Jan. 1, 1970 12:00:00)
Range : [0..2^31-1]. | 62598efb377c676e912f6206 |
class HashMap: <NEW_LINE> <INDENT> __slots__ = 'size', 'storage', 'capacity', 'collisions' <NEW_LINE> def __init__(self: "HashMap", capacity: int = 100): <NEW_LINE> <INDENT> self.size = 0 <NEW_LINE> self.storage = capacity * [None] <NEW_LINE> self.capacity = 2 if capacity < 2 else capacity <NEW_LINE> self.collisions = ... | This open-addressing HashMap data structure contains a list of values
where each value is in an array 'storage' and located by a hashable key.
When the storage fills up, a larger storage is allocated and all of the
current entries are transferred to it. This is called 'rehashing'. | 62598efb66673b3332c2ecf5 |
class Car: <NEW_LINE> <INDENT> def __init__(self, name="", fuel=0): <NEW_LINE> <INDENT> self.name = str(name) <NEW_LINE> self.fuel = fuel <NEW_LINE> self.odometer = 0 <NEW_LINE> <DEDENT> def add_fuel(self, amount): <NEW_LINE> <INDENT> self.fuel += amount <NEW_LINE> <DEDENT> def drive(self, distance): <NEW_LINE> <INDENT... | Represent a Car object. | 62598efb26068e7796d4b29f |
class BacktestReport(RestResponse): <NEW_LINE> <INDENT> Report = property(lambda self: object(), lambda self, v: None, lambda self: None) | Backtest Report Response wrapper
BacktestReport() | 62598efbd486a94d0ba2a90e |
class ModifyDirectConnectTunnelAttributeResponse(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") | ModifyDirectConnectTunnelAttribute response structure.
| 62598efb63b5f9789fe83aa5 |
class StarcheatMainWindow(QMainWindow): <NEW_LINE> <INDENT> def __init__(self, parent): <NEW_LINE> <INDENT> super(QMainWindow, self).__init__() <NEW_LINE> self.parent = parent <NEW_LINE> <DEDENT> def closeEvent(self, event): <NEW_LINE> <INDENT> if not self.isWindowModified(): <NEW_LINE> <INDENT> event.accept() <NEW_LIN... | Overrides closeEvent on the main window to allow "want to save changes?" dialog | 62598efb9c8ee8231303f5ff |
class AntColony(object): <NEW_LINE> <INDENT> def __init__(self, strategy, hive, ant_types, create_places, food=2): <NEW_LINE> <INDENT> self.time = 0 <NEW_LINE> self.food = food <NEW_LINE> self.strategy = strategy <NEW_LINE> self.hive = hive <NEW_LINE> self.ant_types = OrderedDict((a.name, a) for a in ant_types) <NEW_LI... | An ant collective that manages global game state and simulates time.
Attributes:
time -- elapsed time
food -- the colony's available food total
queen -- the place where the queen resides
places -- A list of all places in the colony (including a Hive)
bee_entrances -- A list of places that bees can enter | 62598efb4a966d76dd5ed819 |
class RulesController(Controller, KlassLoader): <NEW_LINE> <INDENT> def __init__(self, request): <NEW_LINE> <INDENT> Controller.__init__(self, request) <NEW_LINE> <DEDENT> def rules_check(self): <NEW_LINE> <INDENT> if self.request.method=='GET' and 'start' in self.request.GET: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDEN... | web ui controller | 62598efb60cbc95b06362c76 |
class ProductModelTest(TestCase): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def setUpTestData(cls): <NEW_LINE> <INDENT> Product.objects.create( name='Saumon', brand='Labeyrie', description='Saumon fumé savoureux de Norvege', score='C', barcode='12345678910', url_img_small='https://www.off.com/poisson/saumon/img_small... | Product Model test case | 62598efb4f6381625f19895f |
class WxTail(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.__tailed_file = "" <NEW_LINE> self.__callback = sys.stdout.write <NEW_LINE> self.__is_stop = False <NEW_LINE> <DEDENT> def start(self,tailed_file,wait_time=1): <NEW_LINE> <INDENT> self.__is_stop = False <NEW_LINE> self.check_file_val... | '' Represents a tail command. | 62598efb3d592f4c4edb9834 |
class Solution: <NEW_LINE> <INDENT> def reverseStore(self, head): <NEW_LINE> <INDENT> results = [] <NEW_LINE> while head: <NEW_LINE> <INDENT> results.append(head.val) <NEW_LINE> head = head.next <NEW_LINE> <DEDENT> return results[::-1] | @param head: the given linked list
@return: the array that store the values in reverse order | 62598efb851cf427c66b6c0f |
class UpdateUserRequest(ModelNormal): <NEW_LINE> <INDENT> allowed_values = { } <NEW_LINE> validations = { } <NEW_LINE> additional_properties_type = None <NEW_LINE> _nullable = False <NEW_LINE> @cached_property <NEW_LINE> def openapi_types(): <NEW_LINE> <INDENT> return { 'user_id': (int,), 'email_address': (str,), 'firs... | 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... | 62598efb99cbb53fe682f7f7 |
class LSTM_attention(nn.Module): <NEW_LINE> <INDENT> def __init__(self,lstm_hidden,bilstm_flag,data): <NEW_LINE> <INDENT> super(LSTM_attention, self).__init__() <NEW_LINE> self.lstm = nn.LSTM(lstm_hidden * 4, lstm_hidden, num_layers=1, batch_first=True, bidirectional=bilstm_flag) <NEW_LINE> self.label_attn = multihead_... | Compose with two layers | 62598efbf548e778e5969ecd |
class InsertNodeCommand(QUndoCommand): <NEW_LINE> <INDENT> def __init__(self, context, *args, **kwargs): <NEW_LINE> <INDENT> super(InsertNodeCommand, self).__init__(*args, **kwargs) <NEW_LINE> self.context = context <NEW_LINE> self.node = self.context.m_scene.nodeFactory() <NEW_LINE> self.node.x, self.node.y = self.con... | insert node | 62598efb5166f23b2e241d24 |
class Validator: <NEW_LINE> <INDENT> def __init__(self, required, nullable): <NEW_LINE> <INDENT> self.required = required <NEW_LINE> self.nullable = nullable <NEW_LINE> self.data = WeakKeyDictionary() <NEW_LINE> <DEDENT> def __set_name__(self, owner, name): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> <DEDENT> def _... | Базовый класс для проверки данных | 62598efbd486a94d0ba2a910 |
class DailyResultSet(ResultSet): <NEW_LINE> <INDENT> def get_Response(self): <NEW_LINE> <INDENT> return self._output.get('Response', None) | Retrieve the value for the "Response" output from this choreography execution. (The response from Twitter.) | 62598efb956e5f7376df4b1e |
class ReplyList(models.Model): <NEW_LINE> <INDENT> object_id = models.CharField(max_length=999) <NEW_LINE> content_type = models.ForeignKey(ContentType) <NEW_LINE> content_object = generic.GenericForeignKey('content_type', 'object_id') <NEW_LINE> created_at = models.DateTimeField(auto_now_add=True) <NEW_LINE> modified_... | A group of replies for an event. | 62598efba8370b77170eed2c |
class IOptCheckboxList(ICheckboxList): <NEW_LINE> <INDENT> pass | List with checkbox widget and optional field | 62598efba219f33f346c5175 |
class Base64Encoding(object): <NEW_LINE> <INDENT> def encode(self, number, length): <NEW_LINE> <INDENT> res = bytearray(b'') <NEW_LINE> for i in range(length): <NEW_LINE> <INDENT> k = (length - (i + 1)) * 6 <NEW_LINE> res.append(0x40 + ((number >> k) & 0x3f)) <NEW_LINE> <DEDENT> return res <NEW_LINE> <DEDENT> def decod... | Class for FUSE B64 encoding | 62598efb63b5f9789fe83aa7 |
class Bcell(object): <NEW_LINE> <INDENT> uID = 0 <NEW_LINE> ufamID = 0 <NEW_LINE> def __init__(self, sequence, sequence0, affinity, affinity0, origin, birthtime, mutations=0, family=None, GCentrytime=None, AIDstart=None, block=False): <NEW_LINE> <INDENT> self.ID = self.uID <NEW_LINE> Bcell.uID += 1 <NEW_LINE> if family... | B cell objects are the main unit of this simulation. They consist of
the following information:
- their key sequence (nkey codons given as number code)
- their germline ancestors key sequence
- their current affinity to the antigen sequence
- their ancestors affinity to the antigen sequence
- their ... | 62598efb9c8ee8231303f600 |
class UserResetPassword(TestCase): <NEW_LINE> <INDENT> def test_reset(self): <NEW_LINE> <INDENT> admin_client = APIClient() <NEW_LINE> admin_client.login(username='admin', password='admin') <NEW_LINE> user = User.objects.create(username='Test name ooMoa4ou4mohn2eo1ree') <NEW_LINE> user.default_password = 'new_password_... | Tests resetting users password via REST API by a manager. | 62598efb8a349b6b43684b8a |
class ImplError(AnaGondaError): <NEW_LINE> <INDENT> pass | Fired on Impl errors
| 62598efb4f6381625f198960 |
class TRACk(SCPINode, SCPIBool): <NEW_LINE> <INDENT> __slots__ = () <NEW_LINE> _cmd = "TRACk" <NEW_LINE> args = ["1", "ON", "OFF"] | SOURce:AM:DEPTh:LINear:TRACk
Arguments: 1, ON, OFF | 62598efb5fcc89381b2655cd |
class PersonVotesListView(SelectRelatedMixin, DetailView): <NEW_LINE> <INDENT> model = Person <NEW_LINE> context_object_name = "person" <NEW_LINE> select_related = ['bills'] <NEW_LINE> template_name = 'general/person_votes_list.html' <NEW_LINE> def get_object(self): <NEW_LINE> <INDENT> if self.kwargs['id']: <NEW_LINE> ... | Individual person profile view. | 62598efb442bda511e95ada9 |
class ClassicLoginForm(forms.Form): <NEW_LINE> <INDENT> next = NextUrlField() <NEW_LINE> username = UserNameField(required=False, skip_clean=True) <NEW_LINE> password = forms.CharField(max_length=128, widget=forms.widgets.PasswordInput(attrs={'class':'required login'}), required=False) <NEW_LINE> def __init__(self, dat... | legacy account signin form | 62598efb56ac1b37e6300b36 |
class Generator(object): <NEW_LINE> <INDENT> def __new__(cls, prefix='sequence_', **kwargs): <NEW_LINE> <INDENT> if not hasattr(cls, '_instance'): <NEW_LINE> <INDENT> cls._instance = object.__new__(cls) <NEW_LINE> cls._instance.redis = Redis.ConnectionPool(**kwargs).getConnection() <NEW_LINE> cls._instance.prefix = pre... | Generator for unique sequence numbers | 62598efb1f5feb6acb16159e |
class _SpanishInquisition(Exception): <NEW_LINE> <INDENT> pass | You weren't expecting THIS, were you? | 62598efb377c676e912f6208 |
class CouldntOccupyLockfileError(PbError): <NEW_LINE> <INDENT> def __init__(self, lockfile, duration, tries): <NEW_LINE> <INDENT> self.lockfile = str(lockfile) <NEW_LINE> self.duration = float(duration) <NEW_LINE> self.tries = int(tries) <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return _( "Couldn't occ... | Special error class indicating, that a lockfile couldn't coccupied
after a defined time. | 62598efb9f2886367281713d |
class DisplayImage: <NEW_LINE> <INDENT> def __init__(self, pil_image): <NEW_LINE> <INDENT> self.pil_image = pil_image <NEW_LINE> <DEDENT> def paste(self, img, coords): <NEW_LINE> <INDENT> self.pil_image.paste(img, coords, img) <NEW_LINE> <DEDENT> def paste_pixel(self, pixel, coords): <NEW_LINE> <INDENT> self.pil_image.... | Image objects are passed into these parts as the first arg,
and they call .paste to paste images into this 'image'. | 62598efb099cdd3c6367487b |
class OperationListResult(Model): <NEW_LINE> <INDENT> _attribute_map = { 'value': {'key': 'value', 'type': '[Operation]'}, } <NEW_LINE> def __init__(self, value=None): <NEW_LINE> <INDENT> self.value = value | A list of resource provider operations.
:param value: The list of resource provider operations.
:type value: list of :class:`Operation
<azure.mgmt.rdbms.postgresql.models.Operation>` | 62598efbfff4ab517ebcc11c |
class Logging(object): <NEW_LINE> <INDENT> def __init__(self, log_level, log_file=None): <NEW_LINE> <INDENT> self.log_level = log_level <NEW_LINE> self.log_file = log_file <NEW_LINE> <DEDENT> def logger_setup(self): <NEW_LINE> <INDENT> logger = logging.getLogger(str(info.__appname__.upper())) <NEW_LINE> avail_level = {... | Setup Application Logging. | 62598efb10dbd63aa1c6f4c7 |
class ShareClip(APIView): <NEW_LINE> <INDENT> renderer_classes = [TemplateHTMLRenderer] <NEW_LINE> throttle_classes = (AnonRateThrottle, UserRateThrottle) <NEW_LINE> def get(self, request): <NEW_LINE> <INDENT> if request.user.is_authenticated: <NEW_LINE> <INDENT> form = ShareClipForm() <NEW_LINE> return Response( data=... | Let user share Clip if authenticated | 62598efb9c8ee8231303f601 |
class User(AbstractBaseUser, PermissionsMixin): <NEW_LINE> <INDENT> email = models.EmailField( _('email address'), max_length=254, blank=False, null=False, unique=True ) <NEW_LINE> first_name = models.CharField(_('first name'), max_length=30, blank=True) <NEW_LINE> last_name = models.CharField(_('last name'), max_lengt... | A fully featured User model with admin-compliant permissions that uses
a full-length email field as the username.
Email and password are required. Other fields are optional. | 62598efb656771135c487fd3 |
class DoubleConversion(CMakePackage): <NEW_LINE> <INDENT> homepage = "https://github.com/google/double-conversion" <NEW_LINE> url = "https://github.com/google/double-conversion/archive/v2.0.1.zip" <NEW_LINE> version('3.1.5', sha256='72c0e3925a1214095afc6f1c214faecbec20e8526cf6b8a541cf72195a11887f') <NEW_LINE> vers... | This project (double-conversion) provides binary-decimal and decimal-binary
routines for IEEE doubles.
The library consists of efficient conversion routines that have been
extracted from the V8 JavaScript engine. The code has been refactored
and improved so that it can be used more easily in other projects.
There is ... | 62598efb32920d7e50bc4973 |
class TaskLogging(logging.LoggerAdapter): <NEW_LINE> <INDENT> def process(self, msg: str, kwargs: Any) -> Tuple[str, Dict[str, Any]]: <NEW_LINE> <INDENT> task = self.extra.get('task') <NEW_LINE> if task is None: <NEW_LINE> <INDENT> task_info = '' <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> task_info = f'[{task}] ' <N... | This example adapter expects the passed in dict-like object to have a
'connid' key, whose value in brackets is prepended to the log message. | 62598efb66656f66f7d58d30 |
class GridWorld(World): <NEW_LINE> <INDENT> def __init__(self, grid_size, occupancy_grid=None, max_density=3, km_per_cell=1.): <NEW_LINE> <INDENT> super(GridWorld, self).__init__() <NEW_LINE> self.grid_size = grid_size <NEW_LINE> if occupancy_grid is None: <NEW_LINE> <INDENT> self.occupancy_grid = np.zeros(grid_size, d... | Attributes:
grid_size (tuple): The size of the simulated grid.
sites (list): The list of sites in the simulated world.
occupancy_grid (np.array): A grid indicating whether a fixed field is
already occupied by any site. | 62598efc99fddb7c1ca622a7 |
class TestStaticViewsLoggedOut(TestCase): <NEW_LINE> <INDENT> def test_dashboard_view(self): <NEW_LINE> <INDENT> response = self.client.get(reverse("dashboard:index")) <NEW_LINE> self.assertEqual(response.status_code, 302) <NEW_LINE> <DEDENT> def test_thanks_view(self): <NEW_LINE> <INDENT> response = self.client.get(re... | Assert that when no user is logged in then 302 (redirect to
the login page) status code is passed. | 62598efc7c178a314d78bde4 |
class Summoner: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.id = None <NEW_LINE> self.name = None <NEW_LINE> self.profile_icon_id = None <NEW_LINE> self.revision_date = None <NEW_LINE> self.level = None | For creating a summoner object containing all the information about a summoner | 62598efc5fcc89381b2655ce |
class CameraGStreamer(CameraBase): <NEW_LINE> <INDENT> def __init__(self, **kwargs): <NEW_LINE> <INDENT> self._pipeline = None <NEW_LINE> self._camerasink = None <NEW_LINE> self._decodebin = None <NEW_LINE> self._texturesize = None <NEW_LINE> self._video_src = kwargs.get('video_src', 'v4l2src') <NEW_LINE> super(CameraG... | Implementation of CameraBase using GStreamer
:Parameters:
`video_src` : str, default is 'v4l2src'
Other tested options are: 'dc1394src' for firewire
dc camera (e.g. firefly MV). Any gstreamer video source
should potentially work.
Theoretically a longer string using "!" can be used
... | 62598efc9f2886367281713e |
class AddressWidget(widgets.TextInput): <NEW_LINE> <INDENT> template_name = 'django_sputnik_maps/widgets/mapwidget.html' <NEW_LINE> class Media: <NEW_LINE> <INDENT> css = { 'all': ('https://unpkg.com/leaflet@1.0.1/dist/leaflet.css', settings.STATIC_URL + 'django_sputnik_maps/css/jquery-ui.min.css', settings.STATIC_URL ... | a map will be drawn after the address field | 62598efc4428ac0f6e656e98 |
class NetworkProfile(Model): <NEW_LINE> <INDENT> _attribute_map = { 'network_interfaces': {'key': 'networkInterfaces', 'type': '[NetworkInterfaceReference]'}, } <NEW_LINE> def __init__(self, *, network_interfaces=None, **kwargs) -> None: <NEW_LINE> <INDENT> super(NetworkProfile, self).__init__(**kwargs) <NEW_LINE> self... | Specifies the network interfaces of the virtual machine.
:param network_interfaces: Specifies the list of resource Ids for the
network interfaces associated with the virtual machine.
:type network_interfaces:
list[~azure.mgmt.compute.v2015_06_15.models.NetworkInterfaceReference] | 62598efc4527f215b58e8848 |
class _ClassContainer(object): <NEW_LINE> <INDENT> def __init__(self, childClass): <NEW_LINE> <INDENT> self._childClass = childClass <NEW_LINE> self._childObjects = {} <NEW_LINE> <DEDENT> def __getitem__(self, key): <NEW_LINE> <INDENT> return self._childObjects[key] <NEW_LINE> <DEDENT> def __contains__(self, key): <NEW... | An internal container objects for child classes. | 62598efc63d6d428bbee111b |
class ProductManager(Manager): <NEW_LINE> <INDENT> def save(self, products): <NEW_LINE> <INDENT> saved_products = [] <NEW_LINE> for product_info in products: <NEW_LINE> <INDENT> product = self.get_or_create( id=int(product_info.get("code")), defaults={ "product_name": product_info.get("product_name"), "nutriscore_grade... | Store the products data from the api in a MySQL database. | 62598efc97e22403b3839837 |
class PGconnection(): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> global connections, options <NEW_LINE> connections.append(self) <NEW_LINE> setattr(self, "host", options['PGHOST']) <NEW_LINE> setattr(self, "user", options['PGUSER']) <NEW_LINE> setattr(self, "pswd", options['PGPASS']) <NEW_LINE> setattr... | Open a persistant postgreSQL database connection.
This uses the standard postgreSQL enviroment variables for the username, password,
host, port, and database name. The password is retrieved through the .pgpass file
if it is not set as an enviroment variable. | 62598efc7b180e01f3e484ec |
class ThreeEqualPartsImplNaive(ThreeEqualParts): <NEW_LINE> <INDENT> def threeEqualParts(self, A): <NEW_LINE> <INDENT> n = len(A) <NEW_LINE> left = [0 for _ in xrange(n)] <NEW_LINE> right = [0 for _ in xrange(n)] <NEW_LINE> left[0], right[-1] = A[0], A[-1] <NEW_LINE> for i in xrange(1, n - 2): <NEW_LINE> <INDENT> j = n... | TLE
Time: O(N ^ 2) | 62598efcff9c53063f518fad |
class CalculateHeightDialogTest(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.dialog = CalculateHeightDialog(None) <NEW_LINE> <DEDENT> def tearDown(self): <NEW_LINE> <INDENT> self.dialog = None <NEW_LINE> <DEDENT> def test_dialog_ok(self): <NEW_LINE> <INDENT> button = self.dialog.but... | Test dialog works. | 62598efc167d2b6e312b58e7 |
class ExcavatorApiError(ExcavatorError): <NEW_LINE> <INDENT> def __init__(self, response): <NEW_LINE> <INDENT> self.response = response <NEW_LINE> self.error = response['error'] | Exception returned by excavator. | 62598efca8370b77170eed30 |
class RowColSizeT(_object): <NEW_LINE> <INDENT> __swig_setmethods__ = {} <NEW_LINE> __setattr__ = lambda self, name, value: _swig_setattr(self, RowColSizeT, name, value) <NEW_LINE> __swig_getmethods__ = {} <NEW_LINE> __getattr__ = lambda self, name: _swig_getattr(self, RowColSizeT, name) <NEW_LINE> __repr__ = _swig_rep... | Proxy of C++ types::RowCol<(size_t)> class | 62598efc4a966d76dd5ed81f |
class Mass(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.value = float <NEW_LINE> <DEDENT> def read(self, input, index): <NEW_LINE> <INDENT> index = self._read_value(input, index) <NEW_LINE> if (index != len(input)): <NEW_LINE> <INDENT> raise IOError("input is too long to be a mass") <NEW_LI... | stores, reads and writes a LAMMPS mass | 62598efc5fcc89381b2655cf |
class CacheItem(object): <NEW_LINE> <INDENT> def __init__(self, metadata=None, children=None, timestamp=None, parents=None): <NEW_LINE> <INDENT> self.metadata = metadata <NEW_LINE> self.children = children <NEW_LINE> self.parents = parents <NEW_LINE> if timestamp is None: <NEW_LINE> <INDENT> timestamp = time.time() <NE... | Represents a path in the cache.
There are two components to a path. It's individual metadata,
and the children contained within it. | 62598efcf9cc0f698b1c4775 |
class Paginator(object): <NEW_LINE> <INDENT> def __init__(self, request, qs, max_res): <NEW_LINE> <INDENT> self.query_dict = dict(request.GET.items()) <NEW_LINE> self.paginator = DjangoPaginator(qs, int(self.query_dict.get('max') or max_res)) <NEW_LINE> self.path = request.path <NEW_LINE> self.name = qs.model._meta.mo... | Paginate querysets.
| 62598efc009cb60464cffe9d |
class NetworkCaptureTopo(IPTopo): <NEW_LINE> <INDENT> def build(self, *args, **kw): <NEW_LINE> <INDENT> r1, r2 = self.addRouters('r1', 'r2') <NEW_LINE> s1 = self.addSwitch('s1') <NEW_LINE> s2 = self.addSwitch('s2') <NEW_LINE> lr1r2, _, ls1s2, _ = self.addLinks((r1, r2), (r1, s1), (s1, s2), (s2, r2)) <NEW_LINE> self.add... | This topology captures traffic from the network booting.
This capture the initial messages of the OSPF/OSPFv3 daemons and save the capture
on /tmp next to the logs. | 62598efc67a9b606de54491c |
class UnitTesterJobCreateResp(object): <NEW_LINE> <INDENT> swagger_types = { 'job_id': 'str', 'created_at': 'str' } <NEW_LINE> attribute_map = { 'job_id': 'job_id', 'created_at': 'created_at' } <NEW_LINE> def __init__(self, job_id=None, created_at=None): <NEW_LINE> <INDENT> self._job_id = None <NEW_LINE> self._created_... | NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually. | 62598efc44b2445a339b5e15 |
class ReturnConnection(MaintenanceTask): <NEW_LINE> <INDENT> def __init__( self, pool: "AsyncConnectionPool", conn: "AsyncConnection[Any]" ): <NEW_LINE> <INDENT> super().__init__(pool) <NEW_LINE> self.conn = conn <NEW_LINE> <DEDENT> async def _run(self, pool: "AsyncConnectionPool") -> None: <NEW_LINE> <INDENT> await po... | Clean up and return a connection to the pool. | 62598efc56ac1b37e6300b3a |
class Coercion(object): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def to_decimal(value): <NEW_LINE> <INDENT> return Decimal(str(value)) <NEW_LINE> <DEDENT> @staticmethod <NEW_LINE> def to_string(value): <NEW_LINE> <INDENT> return str(value) | Class used to make coertion between data returned from Base and data usable for developer | 62598efcf548e778e5969ed3 |
class TestMonzoPot: <NEW_LINE> <INDENT> klass = api_objects.MonzoPot <NEW_LINE> @pytest.fixture(scope='session') <NEW_LINE> def data(self, pots_api_response): <NEW_LINE> <INDENT> return pots_api_response['pots'][0] <NEW_LINE> <DEDENT> @pytest.fixture(scope='session') <NEW_LINE> def instance(self, data): <NEW_LINE> <IND... | Test `api_objects.MonzoPot` class | 62598efce1aae11d1e7cdce9 |
class Transformer(Interpreter): <NEW_LINE> <INDENT> def __init__(self, module): <NEW_LINE> <INDENT> super().__init__(module) <NEW_LINE> self.new_graph = Graph() <NEW_LINE> class TransformerTracer(Tracer): <NEW_LINE> <INDENT> def __init__(self, graph: Graph): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.graph ... | ``Transformer`` is a special type of interpreter that produces a
new ``Module``. It exposes a ``transform()`` method that returns
the transformed ``Module``. ``Transformer`` does not require
arguments to run, as ``Interpreter`` does. ``Transformer`` works
entirely symbolically.
Example:
Suppose we want to swap al... | 62598efc7b180e01f3e484ed |
class ContextMixin(object): <NEW_LINE> <INDENT> def get_context_data(self, **kwargs): <NEW_LINE> <INDENT> context = super(ContextMixin, self).get_context_data(**kwargs) <NEW_LINE> context['plugin_selected'] = BlogPlugin.name <NEW_LINE> return context | Adds
* the currently active plugin | 62598efcaad79263cf42d15c |
class USPS(data.Dataset): <NEW_LINE> <INDENT> url = "https://raw.githubusercontent.com/mingyuliutw/CoGAN/master/cogan_pytorch/data/uspssample/usps_28x28.pkl" <NEW_LINE> def __init__(self, root, train=True, transform=None, download=False): <NEW_LINE> <INDENT> self.root = os.path.expanduser(root) <NEW_LINE> self.filename... | USPS Dataset.
Args:
root (string): Root directory of dataset where dataset file exist.
train (bool, optional): If True, resample from dataset randomly.
download (bool, optional): If true, downloads the dataset
from the internet and puts it in root directory.
If dataset is already downloaded,... | 62598efc92d797404e388021 |
class OutOfBounds(Exception): <NEW_LINE> <INDENT> pass | Exception that occurs when trying to print off of the screen. | 62598efca8370b77170eed32 |
class DeletePoolInDB(BaseDatabaseTask): <NEW_LINE> <INDENT> def execute(self, pool): <NEW_LINE> <INDENT> LOG.debug("Delete in DB for pool id: %s ", pool.id) <NEW_LINE> self.pool_repo.delete(db_apis.get_session(), id=pool.id) <NEW_LINE> <DEDENT> def revert(self, pool, *args, **kwargs): <NEW_LINE> <INDENT> LOG.warning("R... | Delete the pool in the DB.
Since sqlalchemy will likely retry by itself always revert if it fails | 62598efc5fdd1c0f98e5c8f3 |
class UserModelProxy(object): <NEW_LINE> <INDENT> def __init__(self, *a, **kw): <NEW_LINE> <INDENT> super(UserModelProxy, self).__init__(*a, **kw) <NEW_LINE> self._CACHE_TTL = 120 <NEW_LINE> <DEDENT> def authenticate(self, **kwargs): <NEW_LINE> <INDENT> _, json = post(self._operations['authenticate'], kwargs) <NEW_LINE... | Contains the model methods that need to be exposed within the client.
| 62598efca219f33f346c517b |
class TestPieChartDataPoint(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 testPieChartDataPoint(self): <NEW_LINE> <INDENT> pass | PieChartDataPoint unit test stubs | 62598efca05bb46b384891c3 |
@skipUnless(ENABLE_COURSE_API, 'Course API must be enabled to test the course assignment type detail page.') <NEW_LINE> class CoursePerformanceGradedContentByTypeTests(CoursePerformanceAveragedTableMixin, WebAppTest): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> super(CoursePerformanceGradedContentByTypeTes... | Tests for the course assignment type detail page. | 62598efc63b5f9789fe83aad |
class TestV1VsphereVirtualDiskVolumeSource(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 testV1VsphereVirtualDiskVolumeSource(self): <NEW_LINE> <INDENT> pass | V1VsphereVirtualDiskVolumeSource unit test stubs | 62598efc4f88993c371ef992 |
class ListVpnSitesResult(msrest.serialization.Model): <NEW_LINE> <INDENT> _attribute_map = { 'value': {'key': 'value', 'type': '[VpnSite]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } <NEW_LINE> def __init__( self, *, value: Optional[List["VpnSite"]] = None, next_link: Optional[str] = None, **kwargs ): <NEW_LIN... | Result of the request to list VpnSites. It contains a list of VpnSites and a URL nextLink to get the next set of results.
:param value: List of VpnSites.
:type value: list[~azure.mgmt.network.v2019_11_01.models.VpnSite]
:param next_link: URL to get the next set of operation list results if there are any.
:type next_li... | 62598efc0fa83653e46f3830 |
class Queue(Container): <NEW_LINE> <INDENT> def get_element(self): <NEW_LINE> <INDENT> return self.popleft() | Queue data structure implemented by deque | 62598efc4428ac0f6e656e9c |
class DeezerApi(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self._base_url = 'http://api.deezer.com' <NEW_LINE> self._limit_results_per_request = 500 <NEW_LINE> <DEDENT> def get_request(self, uri: str, response_type: str = 'single', params: Dict = {}): <NEW_LINE> <INDENT> params = self._add_req... | Send requests to Deezer api and get answers as dicts
before use, set valid auth token into self.token | 62598efc283ffb24f3cf21f9 |
class FacultyMemberPublicationsView(BrowserView): <NEW_LINE> <INDENT> def __call__(self): <NEW_LINE> <INDENT> return self.render() <NEW_LINE> <DEDENT> @property <NEW_LINE> def has_publications(self): <NEW_LINE> <INDENT> if self.associated_publications(): <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> return False ... | List associated publications for faculty member | 62598efcdc8b845886d51f16 |
class DatabaseSlaveContextTest(ContextRunner, unittest.TestCase): <NEW_LINE> <INDENT> __database = 'sqlite:///pymodbus-test.db' <NEW_LINE> def setUp(self): <NEW_LINE> <INDENT> path = './' + self.__database.split('///')[1] <NEW_LINE> if os.path.exists(path): os.remove(path) <NEW_LINE> self.context = DatabaseSlaveContext... | These are the integration tests for using the redis
slave context. | 62598efc44b2445a339b5e16 |
class Sorter(object): <NEW_LINE> <INDENT> def __init__(self, field=None, table=None, desc=False): <NEW_LINE> <INDENT> self.desc = desc <NEW_LINE> self.field = FieldFactory(field) <NEW_LINE> self.table = TableFactory(table) <NEW_LINE> if self.table and self.field.table is None: <NEW_LINE> <INDENT> self.field.set_table(s... | Used internally by the Query class to set ORDER BY clauses on the query. | 62598efc7047854f4633dd16 |
class MixtureExpertsMLP2(MeanFunction): <NEW_LINE> <INDENT> def __init__(self, W1_1=None, W1_2=None, b1_1=None, b1_2=None, W2_1=None, W2_2=None, b2_1=None, b2_2=None, input_dim=1, hidden_dim=10, output_dim=1, is_class=False): <NEW_LINE> <INDENT> W1_1 = 1e-1*np.random.randn(input_dim, hidden_dim) if W1_1 is None else W1... | (Custom) Mixture of experts with MLP as basis function.
Number of experts are 2. | 62598efc56ac1b37e6300b3b |
class ValidatorResult: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.errnum = 0 <NEW_LINE> self.errmsgs = [] <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> result = dict(errnum=self.errnum) <NEW_LINE> if self.errmsgs: <NEW_LINE> <INDENT> result["errstr"] = self.errmsg <NEW_LINE> <DEDENT> ... | Container for result or results from the JobValidator validate method | 62598efc4c34283577618c36 |
class InterstageMassBase(ExplicitComponent): <NEW_LINE> <INDENT> def __init__(self, **kwargs): <NEW_LINE> <INDENT> super(InterstageMassBase, self).__init__(**kwargs) <NEW_LINE> self._impl = None <NEW_LINE> dockconf = path.join(path.dirname(__file__), ".whatsopt_dock.yml") <NEW_LINE> if path.exists(dockconf): <NEW_LINE>... | An OpenMDAO base component to encapsulate InterstageMass discipline | 62598efc4527f215b58e884c |
class CustomerCardValidations: <NEW_LINE> <INDENT> def credit_card(value): <NEW_LINE> <INDENT> if len(value) != 16: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> elif not value.isdigit(): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> elif value.isdigit(): <NEW_LINE> <INDENT> sum_of_digit = sum([int(i) for... | Add your all custom validation here | 62598efc63d6d428bbee111f |
@dataclass <NEW_LINE> class PowerupAcceptMessage: <NEW_LINE> <INDENT> pass | A message informing a ba.Powerup that it was accepted.
Category: Message Classes
This is generally sent in response to a ba.PowerupMessage
to inform the box (or whoever granted it) that it can go away. | 62598efcaad79263cf42d15e |
class TestFraction(unittest.TestCase): <NEW_LINE> <INDENT> def test_count_vowels(self) -> None: <NEW_LINE> <INDENT> self.assertEqual(count_vowels("Hello World"), 3) <NEW_LINE> self.assertNotEqual(count_vowels("Hello World"), 6) <NEW_LINE> self.assertNotEqual(count_vowels(""), 3) <NEW_LINE> self.assertEqual(count_vowels... | Class for testing count_vowels, last_occurrence functions and my_enumerate generator | 62598efc956e5f7376df4b22 |
class FL_FONT(cty.Structure): <NEW_LINE> <INDENT> pass | Font class
Attributes
----------
fs : array of pointer to XFontStruct
cached fontstruct
size : array of short
cached sizes
nsize : short
cached so far
fname : str
filename without size info | 62598efc283ffb24f3cf21fa |
class Sentence(object): <NEW_LINE> <INDENT> def __init__(self, sentence_id: int, tokens: {str: str}): <NEW_LINE> <INDENT> self.sentence_id = sentence_id <NEW_LINE> self.tokens = tokens | Object representation of POS tagged sentences.
Has a dictionary of token -> POS-tag pairs. | 62598efcfff4ab517ebcc122 |
class Unpacker(AbstractUnpacker): <NEW_LINE> <INDENT> def unpack_menu_data(self): <NEW_LINE> <INDENT> return self._unpack_data(MENU_DATA) <NEW_LINE> <DEDENT> def unpack_categories_data(self): <NEW_LINE> <INDENT> return self._unpack_data(CATEGORIES_DISPLAY_DATA) <NEW_LINE> <DEDENT> def unpack_options_data(self): <NEW_LI... | Retrieves stored data that
is used by the builder object. | 62598efc7d847024c075ad18 |
class OutboundNatRule(SubResource): <NEW_LINE> <INDENT> _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'allocated_outbound_ports': {'key': 'properties.allocatedOutboundPorts', 'type': 'int'}, 'frontend_ip_configurations': {'key': 'p... | Outbound NAT pool of the load balancer.
:param id: Resource ID.
:type id: str
:param name: The name of the resource that is unique within a resource group. This name can be
used to access the resource.
:type name: str
:param etag: A unique read-only string that changes whenever the resource is updated.
:type etag: st... | 62598efc66656f66f7d58d36 |
class Spaceport(test.Test): <NEW_LINE> <INDENT> test = SpaceportMeasurement <NEW_LINE> def CreatePageSet(self, options): <NEW_LINE> <INDENT> spaceport_dir = os.path.join(util.GetChromiumSrcDir(), 'chrome', 'test', 'data', 'third_party', 'spaceport') <NEW_LINE> return page_set.PageSet.FromDict( {'pages': [{'url': 'file:... | spaceport.io's PerfMarks benchmark. | 62598efc99fddb7c1ca622aa |
class OrientSocket(object): <NEW_LINE> <INDENT> def __init__(self, host, port): <NEW_LINE> <INDENT> self.connected = False <NEW_LINE> self.host = host <NEW_LINE> self.port = port <NEW_LINE> self._socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) <NEW_LINE> self.protocol = -1 <NEW_LINE> self.session_id = -1 <NE... | docstring for OrientSocket | 62598efc2c8b7c6e89bd2112 |
class Bad_Command_Arguments_Error(Exception): <NEW_LINE> <INDENT> pass | Raise this in your custom command function when the arguments are bad.
e.g. 'if len(arguments) == 0: raise command_system.Bad_Command_Arguments_Error' | 62598efcad47b63b2c5a6169 |
class MsLinker(Linker): <NEW_LINE> <INDENT> _abstact_to_impl_flags = { Tool.FLAG_OUTPUT_PATH_FORMAT : '/OUT:{path}', Linker.LDFLAG_ADD_LIB_DIR_FORMAT: '/LIBPATH:{dir}', Linker.LDFLAG_ADD_LIB_FORMAT : '{lib}.lib', Linker.LDFLAG_DYNLIB : '/DLL', } <NEW_LINE> def _create_job_add_flags(self, core, args): <... | Microsoft linker (Link).
For a list of recognized command-line arguments, see <http://msdn.microsoft.com/en-us/library/
y0zzbyt4%28v=vs.100%29.aspx>. | 62598efc21bff66bcd7215a7 |
class SaleOpportunityEmployee(SaleOpportunityReportMixin, ModelSQL, ModelView): <NEW_LINE> <INDENT> __name__ = 'sale.opportunity_employee' <NEW_LINE> employee = fields.Many2One('company.employee', 'Employee') <NEW_LINE> @classmethod <NEW_LINE> def table_query(cls): <NEW_LINE> <INDENT> query = super(SaleOpportunityEmplo... | Sale Opportunity per Employee | 62598efc0fa83653e46f3832 |
class intSet(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.vals = [] <NEW_LINE> <DEDENT> def insert(self, e): <NEW_LINE> <INDENT> if not e in self.vals: <NEW_LINE> <INDENT> self.vals.append(e) <NEW_LINE> <DEDENT> <DEDENT> def member(self, e): <NEW_LINE> <INDENT> return e in self.vals <NEW_LI... | An intSet is a set of integers
The value is represented by a list of ints, self.vals.
Each int in the set occurs in self.vals exactly once. | 62598efca8370b77170eed35 |
class Command(BaseCommand): <NEW_LINE> <INDENT> help = "Check the database and send notifications based on expiries" <NEW_LINE> def add_arguments(self, parser): <NEW_LINE> <INDENT> parser.add_argument('-d', '--duein', type=int, help="All items which are due in 0 to x days") <NEW_LINE> parser.add_argument('-l', '--limit... | Command for sending notifications | 62598efc7cff6e4e811b4335 |
class SubprocessManager: <NEW_LINE> <INDENT> def __init__(self, logger: logging.Logger = logging.getLogger(__name__)): <NEW_LINE> <INDENT> self.logger = logger <NEW_LINE> self.ps = [] <NEW_LINE> <DEDENT> def append_worker(self, f: Callable[[], None]) -> None: <NEW_LINE> <INDENT> p = mp.Process(target=f, daemon=True) <N... | Helper class to run workers on child processes | 62598efc627d3e7fe0e057df |
class SimulationPopulations(Resource): <NEW_LINE> <INDENT> @swagger.operation( notes='Gets the neurons of the given simulation.', responseClass=Populations.__name__, parameters=[ { "name": "sim_id", "description": "The simulation ID", "required": True, "paramType": "path", "dataType": int.__name__ } ], responseMessages... | This resource handles getting the populations of a brain in a simulation by retrieving the
neurons of the respective CLE instance. | 62598efc377c676e912f620c |
class QNetwork(nn.Module): <NEW_LINE> <INDENT> def __init__(self, state_size, action_size, fc1_units=64, fc2_units=64, seed=42, init_he=False): <NEW_LINE> <INDENT> super(QNetwork, self).__init__() <NEW_LINE> self.seed = torch.manual_seed(seed) <NEW_LINE> self.fc1 = nn.Linear(state_size, fc1_units) <NEW_LINE> self.fc2 =... | Actor (Policy) Model. | 62598efcf548e778e5969ed7 |
class LoginRequired(Error): <NEW_LINE> <INDENT> cid = "login-required" <NEW_LINE> def _func(self, conv=None): <NEW_LINE> <INDENT> resp = conv.events.last_item(EV_PROTOCOL_RESPONSE) <NEW_LINE> try: <NEW_LINE> <INDENT> assert resp.type() == "AuthorizationErrorResponse" <NEW_LINE> <DEDENT> except AssertionError: <NEW_LINE... | Verifies an Authorization error response. The error should be
login_required. | 62598efc9f28863672817145 |
class IsFacilityOwner(permissions.BasePermission): <NEW_LINE> <INDENT> def _check_permission(self, user, company): <NEW_LINE> <INDENT> if company and user.company == company: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> raise UserIsNotFacilityOwner <NEW_LINE> <DEDENT> def has_permission(self, request, view): <NE... | Ensure that current user is facility owner
For this it compares request.user.company and | 62598efc7b180e01f3e484ef |
class MenuTests(BaseTests): <NEW_LINE> <INDENT> def test_get_one(self): <NEW_LINE> <INDENT> response = self.app.get('/api/v3/menu/2', headers=self.user_header) <NEW_LINE> self.assertEqual(response.status_code, 200) <NEW_LINE> <DEDENT> def test_get_not_in_menu(self): <NEW_LINE> <INDENT> response = self.app.get('/api/v3/... | Tests functionality of the menu endpoint | 62598efcadb09d7d5dc08f08 |
class IngredientViewSet(viewsets.GenericViewSet, mixins.ListModelMixin, mixins.CreateModelMixin): <NEW_LINE> <INDENT> authentication_classes = (TokenAuthentication,) <NEW_LINE> permission_classes = (IsAuthenticated,) <NEW_LINE> queryset = Ingredient.objects.all() <NEW_LINE> serializer_class = serializers.IngredientSeri... | Manage ingredients in the database | 62598efc099cdd3c6367487f |
class Profile(object): <NEW_LINE> <INDENT> TIME, SP = 0, 1 <NEW_LINE> def __init__(self, profile): <NEW_LINE> <INDENT> profile.sort() <NEW_LINE> profile.insert(0, (-0.001, 0.0)) <NEW_LINE> self.profile = profile <NEW_LINE> self.start_time = 0.0 <NEW_LINE> <DEDENT> def __repr__(self): <NEW_LINE> <INDENT> return "%s(prof... | Make a profile ramp.
Parameters:
profile (iterable): A list of (time, setpoint) tuples, time in s.
Note:
A :math:`t_0` point is created by default. Overwrite by adding
a value at :math:`t_0 = 0` in the profile. | 62598efc7d847024c075ad1b |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.