function
stringlengths
11
56k
repo_name
stringlengths
5
60
features
list
def sample_request(request): marker = GMarker('POINT(101 26)') event = GEvent('click', 'function() { location.href = "http://www.google.com"}') marker.add_event(event) return render_to_response('mytemplate.html', {'google' : GoogleMap(mar...
Vvucinic/Wander
[ 1, 1, 1, 11, 1449375044 ]
def __init__(self, geom, title=None, draggable=False, icon=None): """ The GMarker object may initialize on GEOS Points or a parameter that may be instantiated into a GEOS point. Keyword options map to GMarkerOptions -- so far only the title option is supported. Keyword Options:...
Vvucinic/Wander
[ 1, 1, 1, 11, 1449375044 ]
def options(self): result = [] if self.title: result.append('title: "%s"' % self.title) if self.icon: result.append('icon: %s' % self.icon.varname) if self.draggable: result.append('draggable: true') return '{%s}' % ','.join(result)
Vvucinic/Wander
[ 1, 1, 1, 11, 1449375044 ]
def gen_sites(): db = Database(util.get_db_root(), util.get_part()) grid = db.grid() for tile_name in sorted(grid.tiles()): loc = grid.loc_of_tilename(tile_name) gridinfo = grid.gridinfo_at_loc(loc) for site, site_type in gridinfo.sites.items(): if site_type in ['SLICEM'...
SymbiFlow/prjuray
[ 48, 12, 48, 18, 1594844148 ]
def loc_cell(name, c, leaf, lut): bel = '{c}{lut}LUT'.format(c=c.upper(), lut=lut) print( 'set {name} [get_cells {root_cell}/{c}lut_i/{leaf}]'.format( root_cell=root_cell, name=name, c=c, leaf=leaf), file=f) print( 'set_property BEL {bel} ${nam...
SymbiFlow/prjuray
[ 48, 12, 48, 18, 1594844148 ]
def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer self._config = config
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def begin_delete( self, resource_group_name, # type: str virtual_network_name, # type: str virtual_network_peering_name, # type: str **kwargs # type: Any
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {})
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def get( self, resource_group_name, # type: str virtual_network_name, # type: str virtual_network_peering_name, # type: str **kwargs # type: Any
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def _create_or_update_initial( self, resource_group_name, # type: str virtual_network_name, # type: str virtual_network_peering_name, # type: str virtual_network_peering_parameters, # type: "_models.VirtualNetworkPeering" **kwargs # type: Any
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def begin_create_or_update( self, resource_group_name, # type: str virtual_network_name, # type: str virtual_network_peering_name, # type: str virtual_network_peering_parameters, # type: "_models.VirtualNetworkPeering" **kwargs # type: Any
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def get_long_running_output(pipeline_response): deserialized = self._deserialize('VirtualNetworkPeering', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def list( self, resource_group_name, # type: str virtual_network_name, # type: str **kwargs # type: Any
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL url = self.list.metadat...
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=resp...
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def outline(elements, **kwargs) -> Component: """ Returns Component containing the outlined polygon(s). wraps phidl.geometry.outline Creates an outline around all the polygons passed in the `elements` argument. `elements` may be a Device, Polygon, or list of Devices. Args: elements: D...
gdsfactory/gdsfactory
[ 177, 72, 177, 80, 1585200379 ]
def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def __init__(self): r""" :param Data: 设备端SDK填入测试TID参数后生成的加密数据串 :type Data: str """ self.Data = None
tzpBingo/github-trending
[ 42, 20, 42, 1, 1504755582 ]
def __init__(self): r""" :param Pass: 认证结果 :type Pass: bool :param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 :type RequestId: str """ self.Pass = None self.RequestId = None
tzpBingo/github-trending
[ 42, 20, 42, 1, 1504755582 ]
def __init__(self): r""" :param OrderId: 订单编号 :type OrderId: str :param Tid: TID编号 :type Tid: str """ self.OrderId = None self.Tid = None
tzpBingo/github-trending
[ 42, 20, 42, 1, 1504755582 ]
def __init__(self): r""" :param Tid: 接收回执成功的TID :type Tid: str :param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 :type RequestId: str """ self.Tid = None self.RequestId = None
tzpBingo/github-trending
[ 42, 20, 42, 1, 1504755582 ]
def __init__(self): r""" :param OrderId: 订单编号 :type OrderId: str :param Tid: TID编号 :type Tid: str """ self.OrderId = None self.Tid = None
tzpBingo/github-trending
[ 42, 20, 42, 1, 1504755582 ]
def __init__(self): r""" :param RemaindCount: 剩余空发数量 :type RemaindCount: int :param Tid: 已回执的TID编码 :type Tid: str :param ProductKey: 产品公钥 :type ProductKey: str :param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 :type RequestId: str ...
tzpBingo/github-trending
[ 42, 20, 42, 1, 1504755582 ]
def __init__(self): r""" :param OrderId: 订单ID :type OrderId: str :param Quantity: 数量,1~100 :type Quantity: int """ self.OrderId = None self.Quantity = None
tzpBingo/github-trending
[ 42, 20, 42, 1, 1504755582 ]
def __init__(self): r""" :param TidSet: 空发的TID信息
tzpBingo/github-trending
[ 42, 20, 42, 1, 1504755582 ]
def _deserialize(self, params): if params.get("TidSet") is not None: self.TidSet = [] for item in params.get("TidSet"): obj = TidKeysInfo() obj._deserialize(item) self.TidSet.append(obj) self.ProductKey = params.get("ProductKey") ...
tzpBingo/github-trending
[ 42, 20, 42, 1, 1504755582 ]
def __init__(self): r""" :param OrderId: 订单编号 :type OrderId: str """ self.OrderId = None
tzpBingo/github-trending
[ 42, 20, 42, 1, 1504755582 ]
def __init__(self): r""" :param Quantity: 可空发的白盒密钥数量 :type Quantity: int :param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 :type RequestId: str """ self.Quantity = None self.RequestId = None
tzpBingo/github-trending
[ 42, 20, 42, 1, 1504755582 ]
def __init__(self): r""" :param EnterpriseUser: 企业用户 :type EnterpriseUser: bool :param DownloadPermission: 下载控制台权限 :type DownloadPermission: str :param UsePermission: 使用控制台权限 :type UsePermission: str :param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 Reques...
tzpBingo/github-trending
[ 42, 20, 42, 1, 1504755582 ]
def __init__(self): r""" :param OrderId: 订单编号 :type OrderId: str :param Quantity: 下载数量:1~10 :type Quantity: int """ self.OrderId = None self.Quantity = None
tzpBingo/github-trending
[ 42, 20, 42, 1, 1504755582 ]
def __init__(self): r""" :param TidSet: 下载的TID信息列表
tzpBingo/github-trending
[ 42, 20, 42, 1, 1504755582 ]
def _deserialize(self, params): if params.get("TidSet") is not None: self.TidSet = [] for item in params.get("TidSet"): obj = TidKeysInfo() obj._deserialize(item) self.TidSet.append(obj) self.RequestId = params.get("RequestId")
tzpBingo/github-trending
[ 42, 20, 42, 1, 1504755582 ]
def __init__(self): r""" :param Tid: TID号码 :type Tid: str :param PublicKey: 公钥 :type PublicKey: str :param PrivateKey: 私钥 :type PrivateKey: str :param Psk: 共享密钥 :type Psk: str :param DownloadUrl: 软加固白盒密钥下载地址 :type DownloadUrl: str ...
tzpBingo/github-trending
[ 42, 20, 42, 1, 1504755582 ]
def __init__(self): r""" :param CodeSet: 硬件唯一标识码 :type CodeSet: list of str :param OrderId: 硬件标识码绑定的申请编号 :type OrderId: str """ self.CodeSet = None self.OrderId = None
tzpBingo/github-trending
[ 42, 20, 42, 1, 1504755582 ]
def __init__(self): r""" :param Count: 本次已上传数量 :type Count: int :param ExistedCodeSet: 重复的硬件唯一标识码
tzpBingo/github-trending
[ 42, 20, 42, 1, 1504755582 ]
def _deserialize(self, params): self.Count = params.get("Count") self.ExistedCodeSet = params.get("ExistedCodeSet") self.LeftQuantity = params.get("LeftQuantity") self.IllegalCodeSet = params.get("IllegalCodeSet") self.RequestId = params.get("RequestId")
tzpBingo/github-trending
[ 42, 20, 42, 1, 1504755582 ]
def __init__(self): r""" :param Data: 验证数据 :type Data: str """ self.Data = None
tzpBingo/github-trending
[ 42, 20, 42, 1, 1504755582 ]
def __init__(self): r""" :param Pass: 验证结果 :type Pass: bool :param VerifiedTimes: 已验证次数 :type VerifiedTimes: int :param LeftTimes: 剩余验证次数 :type LeftTimes: int :param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 :type RequestId: str ...
tzpBingo/github-trending
[ 42, 20, 42, 1, 1504755582 ]
def __init__(self, opt: Opt, shared: PT.TShared = None): self.blank_image_id = '0000' super().__init__(opt, shared) if shared is not None: self.valid_image_ids = shared['valid_image_ids'] if self.image_features_dict is not None: self.image_features_dict[self.blank...
facebookresearch/ParlAI
[ 9846, 2003, 9846, 72, 1493053844 ]
def add_cmdline_args( cls, parser: ParlaiParser, partial_opt: Optional[Opt] = None
facebookresearch/ParlAI
[ 9846, 2003, 9846, 72, 1493053844 ]
def image_id_to_image_path(self, image_id: str) -> str: """ Return image path given image id. As this function is used in building the image features, and some of the :param image_id: image_id key, for IGC this is a str :return: the image path associate...
facebookresearch/ParlAI
[ 9846, 2003, 9846, 72, 1493053844 ]
def get_image_features_path(self, task, image_model_name, dt): """ Override so that subclasses can see same image features. """ # In default implementation, self.data_path already has task name added image_features_path = os.path.join(self.data_path, 'image_features') if...
facebookresearch/ParlAI
[ 9846, 2003, 9846, 72, 1493053844 ]
def num_examples(self) -> int: """ Number of examples. There are three turns of dialogue in the IGC task - Context, Question, Response. Thus, return 3 * number of data examples. """ return 3 * len(self.data)
facebookresearch/ParlAI
[ 9846, 2003, 9846, 72, 1493053844 ]
def load_data(self, data_path: str, opt: Opt) -> List[Dict[str, Any]]: """ Override to load CSV files. """ dt = opt['datatype'].split(':')[0] dt_str = 'test' if dt == 'test' else 'val' dp = os.path.join(self.get_data_path(opt), f'IGC_crowd_{dt_str}.csv') if not o...
facebookresearch/ParlAI
[ 9846, 2003, 9846, 72, 1493053844 ]
def share(self) -> PT.TShared: shared = super().share() shared['valid_image_ids'] = self.valid_image_ids return shared
facebookresearch/ParlAI
[ 9846, 2003, 9846, 72, 1493053844 ]
def add_cmdline_args( cls, parser: ParlaiParser, partial_opt: Optional[Opt] = None
facebookresearch/ParlAI
[ 9846, 2003, 9846, 72, 1493053844 ]
def num_episodes(self) -> int: return len(self.data)
facebookresearch/ParlAI
[ 9846, 2003, 9846, 72, 1493053844 ]
def get_label_key(self) -> str: """ Return key into data dictionary for the label. """ pass
facebookresearch/ParlAI
[ 9846, 2003, 9846, 72, 1493053844 ]
def get_text(self, data) -> str: """ Return text for an example. """ pass
facebookresearch/ParlAI
[ 9846, 2003, 9846, 72, 1493053844 ]
def get_label_key(self) -> str: return 'response'
facebookresearch/ParlAI
[ 9846, 2003, 9846, 72, 1493053844 ]
def get_label_key(self) -> str: return 'question'
facebookresearch/ParlAI
[ 9846, 2003, 9846, 72, 1493053844 ]
def get_context(self): context = super(BasicPage, self).get_context() manifest = Manifest() manifest_filepath = os.path.join(settings.SOURCES_DIR, 'css', 'styleguide_manifest.css') with io.open(manifest_filepath, 'r') as fp: manifest.load(fp) context.update({ ...
sveetch/Sveetoy
[ 1, 1, 1, 7, 1483118147 ]
def get_context(self): context = super(PageWithSitemap, self).get_context() context.update({ 'site_sitemap': self.sitemap, }) return context
sveetch/Sveetoy
[ 1, 1, 1, 7, 1483118147 ]
def __init__(self, plotly_name="hoverlabel", parent_name="scattercarpet", **kwargs): super(HoverlabelValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, data_class_str=kwargs.pop("data_class_str", "Hoverlabel"), data_docs=kwargs.pop( ...
plotly/plotly.py
[ 13052, 2308, 13052, 1319, 1385013188 ]
def __init__(self, *args, **kwargs): event = kwargs.pop('event') super().__init__(*args, **kwargs) self.default_session.query = Session.query.with_parent(event) self.track_group.query = TrackGroup.query.with_parent(event)
indico/indico
[ 1446, 358, 1446, 649, 1311774990 ]
def program_render_mode(self): return RenderMode.markdown
indico/indico
[ 1446, 358, 1446, 649, 1311774990 ]
def _round_if_needed(arr, dtype): """Rounds arr inplace if the destination dtype is an integer. """ if cupy.issubdtype(dtype, cupy.integer): arr.round(out=arr) # bug in round so use rint (cupy/cupy#2330)
cupy/cupy
[ 6731, 672, 6731, 478, 1477994085 ]
def _view_roi(array, original_area_slice, axis): """Gets a view of the current region of interest during iterative padding. When padding multiple dimensions iteratively corner values are unnecessarily overwritten multiple times. This function reduces the working area for the first dimensions so that co...
cupy/cupy
[ 6731, 672, 6731, 478, 1477994085 ]
def _set_pad_area(padded, axis, width_pair, value_pair): """Set an empty-padded area in given dimension. """ left_slice = _slice_at_axis(slice(None, width_pair[0]), axis) padded[left_slice] = value_pair[0] right_slice = _slice_at_axis( slice(padded.shape[axis] - width_pair[1], None), axis ...
cupy/cupy
[ 6731, 672, 6731, 478, 1477994085 ]
def _get_linear_ramps(padded, axis, width_pair, end_value_pair): """Constructs linear ramps for an empty-padded array along a given axis. Args: padded(cupy.ndarray): Empty-padded array. axis(int): Dimension in which the ramps are constructed. width_pair((int, int)): Pair of widths that mark t...
cupy/cupy
[ 6731, 672, 6731, 478, 1477994085 ]
def _set_reflect_both(padded, axis, width_pair, method, include_edge=False): """Pads an `axis` of `arr` using reflection. Args: padded(cupy.ndarray): Input array of arbitrary shape. axis(int): Axis along which to pad `arr`. width_pair((int, int)): Pair of widths that mark the pad area on both...
cupy/cupy
[ 6731, 672, 6731, 478, 1477994085 ]
def _as_pairs(x, ndim, as_index=False): """Broadcasts `x` to an array with shape (`ndim`, 2). A helper function for `pad` that prepares and validates arguments like `pad_width` for iteration in pairs. Args: x(scalar or array-like, optional): The object to broadcast to the shape (`ndim`...
cupy/cupy
[ 6731, 672, 6731, 478, 1477994085 ]
def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, provider_name: str, resource_type: str, resource_name: str, **kwargs: Any
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def _configure( self, **kwargs: Any
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def __init__( self, credential: "AsyncTokenCredential", endpoint: str, **kwargs: Any
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def convert_cli( # fmt: off input_path: str = Arg(..., help="Input file or directory", exists=True), output_dir: Path = Arg("-", help="Output directory. '-' for stdout.", allow_dash=True, exists=True), file_type: FileTypes = Opt("spacy", "--file-type", "-t", help="Type of data to produce"), n_sents:...
spacy-io/spaCy
[ 25459, 4045, 25459, 98, 1404400540 ]
def convert( input_path: Union[str, Path], output_dir: Union[str, Path], *, file_type: str = "json", n_sents: int = 1, seg_sents: bool = False, model: Optional[str] = None, morphology: bool = False, merge_subtokens: bool = False, converter: str = "auto", ner_map: Optional[Pat...
spacy-io/spaCy
[ 25459, 4045, 25459, 98, 1404400540 ]
def _print_docs_to_stdout(data: Any, output_type: str) -> None: if output_type == "json": srsly.write_json("-", data) else: sys.stdout.buffer.write(data)
spacy-io/spaCy
[ 25459, 4045, 25459, 98, 1404400540 ]
def autodetect_ner_format(input_data: str) -> Optional[str]: # guess format from the first 20 lines lines = input_data.split("\n")[:20] format_guesses = {"ner": 0, "iob": 0} iob_re = re.compile(r"\S+\|(O|[IB]-\S+)") ner_re = re.compile(r"\S+\s+(O|[IB]-\S+)$") for line in lines: line = li...
spacy-io/spaCy
[ 25459, 4045, 25459, 98, 1404400540 ]
def verify_cli_args( msg: Printer, input_path: Union[str, Path], output_dir: Union[str, Path], file_type: FileTypes, converter: str, ner_map: Optional[Path],
spacy-io/spaCy
[ 25459, 4045, 25459, 98, 1404400540 ]
def __init__( self, credential: "AsyncTokenCredential", endpoint: str, **kwargs: Any
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def _configure( self, **kwargs: Any
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def __init__( self, plotly_name="namelengthsrc", parent_name="bar.hoverlabel", **kwargs
plotly/plotly.py
[ 13052, 2308, 13052, 1319, 1385013188 ]
def __init__(self, data=None): self.data = data self.next = None
TheAlgorithms/Python
[ 154959, 39275, 154959, 147, 1468662241 ]
def make_linked_list(elements_list: list): """Creates a Linked List from the elements of the given sequence (list/tuple) and returns the head of the Linked List. >>> make_linked_list([]) Traceback (most recent call last): ... Exception: The Elements List is empty >>> make_linked_list([7]...
TheAlgorithms/Python
[ 154959, 39275, 154959, 147, 1468662241 ]
def main(): from doctest import testmod testmod() linked_list = make_linked_list([14, 52, 14, 12, 43]) print("Linked List:") print(linked_list) print("Elements in Reverse:") print_reverse(linked_list)
TheAlgorithms/Python
[ 154959, 39275, 154959, 147, 1468662241 ]
def __init__(self, text: str, pattern: str): self.text, self.pattern = text, pattern self.textLen, self.patLen = len(text), len(pattern)
TheAlgorithms/Python
[ 154959, 39275, 154959, 147, 1468662241 ]
def mismatch_in_text(self, currentPos: int) -> int: """ find the index of mis-matched character in text when compared with pattern from last Parameters : currentPos (int): current index position of text Returns : i (int): index of mismatched char from la...
TheAlgorithms/Python
[ 154959, 39275, 154959, 147, 1468662241 ]
def __init__( self, plotly_name="sizesrc", parent_name="surface.hoverlabel.font", **kwargs
plotly/plotly.py
[ 13052, 2308, 13052, 1319, 1385013188 ]
def paste_proxy_patched_call(self, environ, start_response): if (self.allowed_request_methods and environ['REQUEST_METHOD'].lower() not in self.allowed_request_methods): return httpexceptions.HTTPBadRequest("Disallowed")(environ, start_response) if self.scheme == 'http': ConnClass = htt...
Open-Transport/synthese
[ 25, 5, 25, 1, 1386004630 ]
def __init__(self, env, project): self.env = env self.proxy_app = Proxy('http://localhost:%s/' % env.c.port) # import here to avoid circular dependencies. from synthesepy import web self.web_app = web.get_application(project=project) self.static_apps = [] for ba...
Open-Transport/synthese
[ 25, 5, 25, 1, 1386004630 ]
def add_utf8_header(self, start_response): def start_response_wrapper(status, headers): headers_dict = dict(headers) if headers_dict['Content-Type'] == 'text/html': headers_dict['Content-Type'] = 'text/html; charset=UTF-8' return start_response(status, headers...
Open-Transport/synthese
[ 25, 5, 25, 1, 1386004630 ]
def __call__(self, environ, start_response): path_info = environ['PATH_INFO'] # Web app WEB_APP_PREFIX = '/w/' if path_info.startswith(WEB_APP_PREFIX): werkzeug.wsgi.pop_path_info(environ) return self.web_app(environ, start_response) # Admin redirect hel...
Open-Transport/synthese
[ 25, 5, 25, 1, 1386004630 ]
def start(env, project): global wsgi_httpd if USE_PASTE_HTTPD: import paste.httpserver paste_log = logging.getLogger('paste.httpserver.ThreadPool') paste_log.setLevel(logging.WARNING) wsgi_httpd = paste.httpserver.serve( WSGIProxy(env, project), '0.0.0.0', env.c.wsgi...
Open-Transport/synthese
[ 25, 5, 25, 1, 1386004630 ]
def locked(): return mark_safe('<img src="%s" alt="locked" style="border:0px; margin: 0px; padding: 0px"/>' % ( static('manager/padlock_close.png') ))
efce/voltPy
[ 1, 1, 1, 14, 1500044176 ]
def get_field_queryset(self, db, db_field, request): if db_field.name == "discipline": # Filter the discipline field's queryset based on the parent journal's type. if request._obj: return db_field.remote_field.model._default_manager.using(db).filter( t...
erudit/eruditorg
[ 15, 6, 15, 15, 1445630709 ]
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) # Limit `year_of_addition` field values to the current year and the next two years. now = tz.now() min_year = now.year max_year = min_year + 2 self.fields["year_of_addition"].validators = [ ...
erudit/eruditorg
[ 15, 6, 15, 15, 1445630709 ]
def get_form(self, request, obj=None, change=False, **kwargs): # Save the journal object on the request to have access to it in `JournalDisciplineInline`. request._obj = obj return super().get_form(request, obj, change, **kwargs)
erudit/eruditorg
[ 15, 6, 15, 15, 1445630709 ]
def force_free_access_to_true(self, request, queryset): """Mark a set of issues as open access""" queryset.update(force_free_access=True)
erudit/eruditorg
[ 15, 6, 15, 15, 1445630709 ]
def force_free_access_to_false(self, request, queryset): """Mark a set of issues as not open access""" queryset.update(force_free_access=False)
erudit/eruditorg
[ 15, 6, 15, 15, 1445630709 ]
def view_issue_on_site(self, obj): """ Display the link leading to the issue on website """ url = reverse( "public:journal:issue_detail", kwargs={ "journal_code": obj.journal.code, "issue_slug": obj.volume_slug, "localidentifier": o...
erudit/eruditorg
[ 15, 6, 15, 15, 1445630709 ]
def get_readonly_fields(self, request, obj=None): return self.readonly_fields + ("is_published",)
erudit/eruditorg
[ 15, 6, 15, 15, 1445630709 ]
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) # Exclude French & English from other_languages field. These languages are set in the # main_languages field. self.fields["other_languages"].queryset = Language.objects.exclude(id__in=[1, 2])
erudit/eruditorg
[ 15, 6, 15, 15, 1445630709 ]
def get_types(self, obj): return ", ".join([t.name for t in obj.type.all()])
erudit/eruditorg
[ 15, 6, 15, 15, 1445630709 ]
def setUp(self): self.fh = StringIO() self.vml = Vml() self.vml._set_filehandle(self.fh)
ivmech/iviny-scope
[ 19, 2, 19, 1, 1398667377 ]
def __init__(self, parent, sourceslist, datadir, distro): """ Initialize the dialog that allows to add a new source entering the raw apt line """ self.sourceslist = sourceslist self.parent = parent self.datadir = datadir # gtk stuff setup_ui(self, os.path.join(datadir, "gtkbuilder", ...
ruibarreira/linuxtrail
[ 2, 2, 2, 1, 1434186057 ]
def run(self): res = self.dialog.run() self.dialog.hide() if res == Gtk.ResponseType.OK: line = self.entry.get_text() + "\n" else: line = None return line
ruibarreira/linuxtrail
[ 2, 2, 2, 1, 1434186057 ]
def attrs_to_dict(attrs): """ Converts a minidom NamedNodeMap that represents the attributes of a node into a dictionary. The keys are attribute names. The values are the attributes' string values. """ return dict([(str(attr.name),attr.value) for attr in attrs.values()])
markgw/jazzparser
[ 5, 1, 5, 1, 1368367354 ]
def get_single_element_by_tag_name(node, tag_name, optional=False): """ Returns an element that is a child of the given node and that has the tag name given. This method is used where it is assumed that one such tag exists. If there is none, an exception is raised. If there is more than one, t...
markgw/jazzparser
[ 5, 1, 5, 1, 1368367354 ]
def require_attrs(node, attrs): """ Checks for the existence of the named attributes on the given node and raises an exception if they're not there.
markgw/jazzparser
[ 5, 1, 5, 1, 1368367354 ]