function
stringlengths
11
56k
repo_name
stringlengths
5
60
features
list
def test_delete_versioned_submission_past(self): """Deleting an old versioned ``Submission`` should fail""" submission_b = self.create_submission(title='b') self.parent.update_version(submission_b) self.client.login(username='alex', password='alex') response = self.client.post(se...
mozilla/mozilla-ignite
[ 13, 15, 13, 6, 1319036985 ]
def test_delete_versioned_submission(self): """Deleting a versioned ``Submission`` should take down all the related content""" submission_b = self.create_submission(title='b') self.parent.update_version(submission_b) self.client.login(username='alex', password='alex') res...
mozilla/mozilla-ignite
[ 13, 15, 13, 6, 1319036985 ]
def setUp(self): challenge_setup() profile_list = create_users() self.phase = Phase.objects.all()[0] self.alex = profile_list[0] self.category = Category.objects.all()[0] create_submissions(1, self.phase, self.alex) self.submission_a = Submission.objects.get() ...
mozilla/mozilla-ignite
[ 13, 15, 13, 6, 1319036985 ]
def create_submission_help(self, **kwargs): defaults = {'parent': self.parent, 'status': SubmissionHelp.PUBLISHED} if kwargs: defaults.update(kwargs) instance, created = SubmissionHelp.objects.get_or_create(**defaults) return instance
mozilla/mozilla-ignite
[ 13, 15, 13, 6, 1319036985 ]
def test_submission_help_not_owner(self): self.client.login(username='bob', password='bob') response = self.client.get(self.help_url) eq_(response.status_code, 404) response = self.client.post(self.help_url, self.valid_data) eq_(response.status_code, 404)
mozilla/mozilla-ignite
[ 13, 15, 13, 6, 1319036985 ]
def test_submission_help_listing(self): self.create_submission_help() response = self.client.get(reverse('entry_help_list')) eq_(response.status_code, 200) page = response.context['page'] eq_(page.paginator.count, 1)
mozilla/mozilla-ignite
[ 13, 15, 13, 6, 1319036985 ]
def store_rendered_templates(store, signal, sender, template, context, **kwargs): """ Stores templates and contexts that are rendered. The context is copied so that it is an accurate representation at the time of rendering. Entirely based on the Django Test Client https://github.com/django/djan...
mozilla/mozilla-ignite
[ 13, 15, 13, 6, 1319036985 ]
def __init__(self, *args, **kwargs): super(TestAddSubmissionView, self).__init__(*args, **kwargs) # Add context and template to the response on_template_render = curry(store_rendered_templates, {}) signals.template_rendered.connect(on_template_render, ...
mozilla/mozilla-ignite
[ 13, 15, 13, 6, 1319036985 ]
def test_add_submission_get(self): request = self.factory.get('/') request.user = AnonymousUser() request.development = development_mock response = views.add_submission(request, self.ideation) eq_(response.status_code, 200)
mozilla/mozilla-ignite
[ 13, 15, 13, 6, 1319036985 ]
def __init__(self, check_x_type : Union[PointerType, LLVMType, None]) -> None: super().__init__() self.check_x_type = check_x_type
GaloisInc/saw-script
[ 408, 63, 408, 366, 1429220372 ]
def test_points_to_at_type(self): connect(reset_server=True) if __name__ == "__main__": view(LogResults()) bcname = str(Path('tests','saw','test-files', 'points_to_at_type.bc')) mod = llvm_load_module(bcname) result = llvm_verify(mod, "f", FPointsToContract(None)) self.a...
GaloisInc/saw-script
[ 408, 63, 408, 366, 1429220372 ]
def __init__(self, *args, **kwargs): super(MobileMe, self).__init__(*args, **kwargs) self.devices = set() self._devices = {} self._get_devices()
wrboyce/autolat
[ 2, 2, 2, 1, 1258709282 ]
def _auth(self, passwd): super(MobileMe, self)._auth(passwd) data = { 'anchor': 'findmyiphone', 'lang': 'en', } self._get('https://secure.me.com/wo/WebObjects/Account2.woa', data, headers={'X-Mobileme-Version': '1.0'})
wrboyce/autolat
[ 2, 2, 2, 1, 1258709282 ]
def _add_device(self, id, type, cls, osver): self._devices[id] = { 'id': id, 'type': type, 'class': cls, 'osver': osver, }
wrboyce/autolat
[ 2, 2, 2, 1, 1258709282 ]
def get_device(self, id=None): if id is None: if len(self._devices) == 1: id = self._devices.keys()[0] else: self._logger.error('Multiple devices found and no ID specified, bailing.') raise MobileMe.MultipleDevicesFound('Device ID must be s...
wrboyce/autolat
[ 2, 2, 2, 1, 1258709282 ]
def msg_device(self, msg, alarm=False, device_id=None): device = self.get_device(device_id) self._logger.info('Sending "%s" to device "%s" with%s alarm', msg, device['id'], 'out' if not alarm else '') body = { 'deviceClass': device['class'], 'deviceId': device['id'], ...
wrboyce/autolat
[ 2, 2, 2, 1, 1258709282 ]
def __init__(self, json_data): data = json.loads(json_data) for k, v in data.iteritems(): if k not in ('date', 'time'): setattr(self, self._uncamel(k), v) self.datetime = datetime.strptime('%s %s' % (data['date'], data['time']), '%B %d, %Y %I:%M %p') s...
wrboyce/autolat
[ 2, 2, 2, 1, 1258709282 ]
def _uncamel(self, str): return ''.join('_%s' % c.lower() if c.isupper() else c for c in str)
wrboyce/autolat
[ 2, 2, 2, 1, 1258709282 ]
def __init__(self, *args, **kwargs): super(MobileMeAction, self).__init__(*args, **kwargs) self.parser.add_argument('-m', '--mobileme-user', dest='m_user', help='MobileMe username, will be prompted for if not provided', metavar='MOBILEMEUSER') self.parser.add_argument('-M', '--mobileme-pass', de...
wrboyce/autolat
[ 2, 2, 2, 1, 1258709282 ]
def setup(self): self.parser.add_argument('-D', '--device', dest='device', help='Device ID', metavar='DEVICE') self.parser.add_argument('-a', '--alarm', dest='alarm', action='store_true', help='Play a sound for 2 minutes with this message') self.parser.add_argument('message', nargs='+', help='Me...
wrboyce/autolat
[ 2, 2, 2, 1, 1258709282 ]
def setup(self): self.parser.add_argument('-D', '--device', dest='device', help='Device ID', metavar='DEVICE')
wrboyce/autolat
[ 2, 2, 2, 1, 1258709282 ]
def setup(self): self.parser.add_argument('-D', '--device', dest='device', help='Device ID', metavar='DEVICE') self.parser.add_argument('pin', type=int, help='PIN to lock the device with', metavar='PIN')
wrboyce/autolat
[ 2, 2, 2, 1, 1258709282 ]
def extractThatbadtranslatorWordpressCom(item): ''' Parser for 'thatbadtranslator.wordpress.com' ''' vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title']) if not (chp or vol) or "preview" in item['title'].lower(): return None tagmap = [ ('PRC', 'PRC', 'translat...
fake-name/ReadableWebProxy
[ 191, 16, 191, 3, 1437712243 ]
def extract_alleles( input_file, output_file=None, reference_file=None, alignment_file=None, method=METHOD, sort=SORT, ...
bnbowman/HlaTools
[ 21, 5, 21, 2, 1365456399 ]
def _group_by_barcode( alignments ): """Group reads by their barcode""" groups = {} for alignment in alignments: name = alignment.qname if name.startswith('Barcode'): name = name[7:] if name.startswith('_'): name = name[1:] barcode = name.split('_Clust...
bnbowman/HlaTools
[ 21, 5, 21, 2, 1365456399 ]
def _sort_groups( groups, sorting_data ): """Order each group of records individually""" ordered = {} for locus, group in groups.iteritems(): sorted_records = sorted( group, key=lambda x: sorting_data[x.qname], reverse=True ) ordered[locus] = sorted_records return ordered
bnbowman/HlaTools
[ 21, 5, 21, 2, 1365456399 ]
def _subset_sequences( sequences, selected ): """Subset only the sequences that match""" for record in sequences: name = record.name.split()[0] if name in selected: yield record
bnbowman/HlaTools
[ 21, 5, 21, 2, 1365456399 ]
def _get_output_file( input_file ): basename = '.'.join( input_file.split('.')[:-1] ) file_type = get_file_type( input_file ) return '%s.selected.%s' % (basename, file_type)
bnbowman/HlaTools
[ 21, 5, 21, 2, 1365456399 ]
def __init__(self, autoencoders, preact_cors=None, postact_cors=None, layer_samplers=None): super(GSN, self).__init__(autoencoders) # only for convenience self.aes = self._layers # easy way to turn off corruption (True => corrupt, False => don't) self._corrupt_...
lisa-lab/pylearn2
[ 2738, 1110, 2738, 201, 1290448850 ]
def _make_aes(layer_sizes, activation_funcs, tied=True): """ Creates the Autoencoder objects needed by the GSN. Parameters ---------- layer_sizes : WRITEME activation_funcs : WRITEME tied : WRITEME """ aes = [] assert len(activation_funcs)...
lisa-lab/pylearn2
[ 2738, 1110, 2738, 201, 1290448850 ]
def new(cls, layer_sizes, activation_funcs, pre_corruptors, post_corruptors, layer_samplers, tied=True): """ An easy (and recommended) way to initialize a GSN. Parameters ---------- layer_sizes : list ...
lisa-lab/pylearn2
[ 2738, 1110, 2738, 201, 1290448850 ]
def get_params(self): """ .. todo:: WRITEME """ params = set() for ae in self.aes: params.update(ae.get_params()) return list(params)
lisa-lab/pylearn2
[ 2738, 1110, 2738, 201, 1290448850 ]
def nlayers(self): """ Returns how many layers the GSN has. """ return len(self.aes) + 1
lisa-lab/pylearn2
[ 2738, 1110, 2738, 201, 1290448850 ]
def _make_or_get_compiled(self, indices, clamped=False): """ Compiles, wraps, and caches Theano functions for non-symbolic calls to get_samples. Parameters ---------- indices : WRITEME clamped : WRITEME """ def compile_f_init(): mb = T...
lisa-lab/pylearn2
[ 2738, 1110, 2738, 201, 1290448850 ]
def reconstruct(self, minibatch): """ .. todo:: WRITEME """ # included for compatibility with cost functions for autoencoders, # so assumes model is in unsupervised mode assert len(minibatch) == 1 idx = minibatch[0][0] return self.get_samples...
lisa-lab/pylearn2
[ 2738, 1110, 2738, 201, 1290448850 ]
def _set_activations(self, minibatch, set_val=True, corrupt=False): """ Initializes the GSN as specified by minibatch. Parameters ---------- minibatch : list of (int, tensor_like) The minibatch parameter must be a list of tuples of form (int, tensor_like)...
lisa-lab/pylearn2
[ 2738, 1110, 2738, 201, 1290448850 ]
def _update_evens(self, activations, clamped=None): """ Updates just the even layers of the network. Parameters ---------- See all of the descriptions for _update_evens. """ evens = xrange(0, len(activations), 2) self._update_activations(activations, eve...
lisa-lab/pylearn2
[ 2738, 1110, 2738, 201, 1290448850 ]
def _apply_clamping(activations, clamped, symbolic=True): """ Resets the value of some layers within the network. Parameters ---------- activations : list List of symbolic tensors representing the current activations. clamped : list of (int, matrix, matrix or...
lisa-lab/pylearn2
[ 2738, 1110, 2738, 201, 1290448850 ]
def _apply_corruption(activations, corruptors, idx_iter): """ Applies a list of corruptor functions to all layers. Parameters ---------- activations : list of tensor_likes Generally gsn.activations corruptors : list of callables Generally gsn.post...
lisa-lab/pylearn2
[ 2738, 1110, 2738, 201, 1290448850 ]
def apply_postact_corruption(self, activations, idx_iter, sample=True): """ .. todo:: WRITEME """ if sample: self.apply_sampling(activations, idx_iter) if self._corrupt_switch: self._apply_corruption(activations, self._postact_cors, ...
lisa-lab/pylearn2
[ 2738, 1110, 2738, 201, 1290448850 ]
def _update_activations(self, activations, idx_iter): """ Actually computes the activations for all indices in idx_iters. This method computes the values for a layer by computing a linear combination of the neighboring layers (dictated by the weight matrices), applying the pre-a...
lisa-lab/pylearn2
[ 2738, 1110, 2738, 201, 1290448850 ]
def convert(cls, gsn, input_idx=0, label_idx=None): """ 'convert' essentially serves as the constructor for JointGSN. Parameters ---------- gsn : GSN input_idx : int The index of the layer which serves as the "input" to the network. During classif...
lisa-lab/pylearn2
[ 2738, 1110, 2738, 201, 1290448850 ]
def _get_aggregate_classification(self, minibatch, trials=10, skip=0): """ See classify method. Returns the prediction vector aggregated over all time steps where axis 0 is the minibatch item and axis 1 is the output for the label. """ clamped = np.ones(minibatch.shape, ...
lisa-lab/pylearn2
[ 2738, 1110, 2738, 201, 1290448850 ]
def read_leda(path): """Read graph in GraphML format from path. Returns an XGraph or XDiGraph.""" fh=_get_fh(path,mode='r') G=parse_leda(fh) return G
JaneliaSciComp/Neuroptikon
[ 9, 2, 9, 48, 1409685514 ]
def parse_leda(lines): """Parse LEDA.GRAPH format from string or iterable. Returns an Graph or DiGraph.""" if is_string_like(lines): lines=iter(lines.split('\n')) lines = iter([line.rstrip('\n') for line in lines \ if not (line.startswith('#') or line.startswith('\n') or line=='')]) for ...
JaneliaSciComp/Neuroptikon
[ 9, 2, 9, 48, 1409685514 ]
def createserver(host="127.0.0.1", port=10123, handler_factory=bjsonrpc.handlers.NullHandler, sock=None, http=False): """ Creates a *bjson.server.Server* object linked to a listening socket.
deavid/bjsonrpc
[ 40, 20, 40, 2, 1292884398 ]
def connect(host="127.0.0.1", port=10123, sock=None, handler_factory=bjsonrpc.handlers.NullHandler): """ Creates a *bjson.connection.Connection* object linked to a connected socket.
deavid/bjsonrpc
[ 40, 20, 40, 2, 1292884398 ]
def extractYuzukiteaWordpressCom(item): ''' Parser for 'yuzukitea.wordpress.com' ''' vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title']) if not (chp or vol) or "preview" in item['title'].lower(): return None tagmap = [ ('PRC', 'PRC', 'translated'), ('Loiter...
fake-name/ReadableWebProxy
[ 191, 16, 191, 3, 1437712243 ]
def init(i): """ Input: {} Output: { return - return code = 0, if successful > 0, if error (error) - error text if return > 0 } """ return {'return':0}
ctuning/ck
[ 511, 83, 511, 31, 1415207683 ]
def detect(i): """ See "check" API """ return check(i)
ctuning/ck
[ 511, 83, 511, 31, 1415207683 ]
def internal_detect(i): """ Input: { (host_os) - host OS (detect, if omitted) (target_os) - target OS (detect, if omitted) (target_device_id) - target device ID (detect, if omitted) (data_uoa) or (uoa) - software UOA entry ...
ctuning/ck
[ 511, 83, 511, 31, 1415207683 ]
def setup(i): """ Input: { (host_os) - host OS (detect, if omitted) (target_os) - target OS (detect, if omitted) (target_device_id) - target device ID (detect, if omitted) (data_uoa) or (uoa) - soft configuration UOA or ...
ctuning/ck
[ 511, 83, 511, 31, 1415207683 ]
def search_tool(i): """ Input: { path_list - path list file_name - name of file to find (can be with patterns) (recursion_level_max) - if >0, limit dir recursion (can_be_dir) - if 'yes', return matched directories as well ...
ctuning/ck
[ 511, 83, 511, 31, 1415207683 ]
def _internal_check_encoded_path_is_dir( path ): """ Need this complex structure to support UTF-8 file names in Python 2.7 """ import os import sys try: if os.path.isdir( path ): return path except Exception as e: try: path = path.encode('utf-8'...
ctuning/ck
[ 511, 83, 511, 31, 1415207683 ]
def list_all_files(i): """ Input: { path - top level path (file_name) - search for a specific file name (pattern) - return only files with this pattern (path_ext) - path extension (needed for recursion) ...
ctuning/ck
[ 511, 83, 511, 31, 1415207683 ]
def check(i): """ Input: { (target) - if specified, use info from 'machine' module or (host_os) - host OS (detect, if omitted) (target_os) - target OS (detect, if omitted) (target_device_id) - target device I...
ctuning/ck
[ 511, 83, 511, 31, 1415207683 ]
def get_version(i): """ Input: { full_path bat cmd custom_script_obj host_os_dict (show) - if 'yes', show output file (skip_existing) - if 'yes', force detecting version again ...
ctuning/ck
[ 511, 83, 511, 31, 1415207683 ]
def internal_get_val(lst, index, default_value): v=default_value if index<len(lst): v=lst[index] return v
ctuning/ck
[ 511, 83, 511, 31, 1415207683 ]
def print_help(i): """ Input: { data_uoa - data UOA to get help platform - platform name } Output: { return - return code = 0, if successful > 0, if error (error) - error text if retu...
ctuning/ck
[ 511, 83, 511, 31, 1415207683 ]
def check_target(i): """ Input: { dict - dictionary with info about supported host and target OS host_os_uoa - host OS UOA (already resolved) host_os_dict - host OS dict (already resolved) target_os_uoa - target OS UOA (already resolve...
ctuning/ck
[ 511, 83, 511, 31, 1415207683 ]
def split_version(i): """ Input: { version - string version } Output: { return - return code = 0, if successful > 0, if error (error) - error text if return > 0 version_split - split ...
ctuning/ck
[ 511, 83, 511, 31, 1415207683 ]
def show(i): """ Input: { (the same as list; can use wildcards) (out_file) - output to file (for mediawiki) } Output: { return - return code = 0, if successful > 0, if error (error) ...
ctuning/ck
[ 511, 83, 511, 31, 1415207683 ]
def find_config_file(i): """ Input: { full_path - where to start search } Output: { return - return code = 0, if successful > 0, if error (error) - error text if return > 0 found ...
ctuning/ck
[ 511, 83, 511, 31, 1415207683 ]
def compare_versions(i): """ Input: { version1 - version 1 to compare against version2 (list such as [1,62]) version2 - (list such as [1,63]) } Output: { return - return code = 0, if successful > 0, if e...
ctuning/ck
[ 511, 83, 511, 31, 1415207683 ]
def prepare_target_name(i): """ Input: { host_os_dict - host OS dict target_os_dict - target OS dict cus - custom meta } Output: { return - return code = 0, if successful > 0, ...
ctuning/ck
[ 511, 83, 511, 31, 1415207683 ]
def add(i): """ Input: { (template) - if !='', use this program as template! (tags) - if !='', use these tags } Output: { return - return code = 0, if successful > 0, if error (error) ...
ctuning/ck
[ 511, 83, 511, 31, 1415207683 ]
def setUpClass(cls): super(LinkDomainsTests, cls).setUpClass() cls.upstream_domain = 'upstream' cls.downstream_domain = 'downstream'
dimagi/commcare-hq
[ 465, 201, 465, 202, 1247158807 ]
def mock_handler(domain): return domain != self.downstream_domain
dimagi/commcare-hq
[ 465, 201, 465, 202, 1247158807 ]
def test_exception_raised_if_domain_link_already_exists(self): with patch('corehq.apps.linked_domain.views.domain_exists', return_value=True),\ patch('corehq.apps.linked_domain.views.get_active_domain_link', return_value=Mock()),\ self.assertRaises(DomainLinkAlreadyExists): ...
dimagi/commcare-hq
[ 465, 201, 465, 202, 1247158807 ]
def mock_handler(downstream, upstream): raise DomainLinkError
dimagi/commcare-hq
[ 465, 201, 465, 202, 1247158807 ]
def test_exception_raised_if_user_is_not_admin_in_both_domains(self): with patch('corehq.apps.linked_domain.views.domain_exists', return_value=True),\ patch('corehq.apps.linked_domain.views.get_active_domain_link', return_value=None),\ patch('corehq.apps.linked_domain.views.user_has_ad...
dimagi/commcare-hq
[ 465, 201, 465, 202, 1247158807 ]
def setUp(self): '''Empty''' pass
SasView/sasview
[ 40, 32, 40, 388, 1423429150 ]
def testReplaceShellName(self): """ Test the utility function for string manipulation """ param_name = "test [123]" value = "replaced" result = FittingUtilities.replaceShellName(param_name, value)
SasView/sasview
[ 40, 32, 40, 388, 1423429150 ]
def testGetIterParams(self): """ Assure the right multishell parameters are returned """ # Use a single-shell parameter model_name = "barbell" kernel_module = generate.load_kernel_module(model_name) barbell_parameters = modelinfo.make_parameter_table(getattr(kerne...
SasView/sasview
[ 40, 32, 40, 388, 1423429150 ]
def testAddParametersToModel(self): """ Checks the QModel update from Sasmodel parameters """ # Use a single-shell parameter model_name = "barbell" models = load_standard_models() kernel_module = generate.load_kernel_module(model_name) kernel_module_o = N...
SasView/sasview
[ 40, 32, 40, 388, 1423429150 ]
def testAddCheckedListToModel(self): """ Test for inserting a checkboxed item into a QModel """ model = QtGui.QStandardItemModel() params = ["row1", "row2", "row3"] FittingUtilities.addCheckedListToModel(model, params) # Check the model self.assertEqual(...
SasView/sasview
[ 40, 32, 40, 388, 1423429150 ]
def testCalculate1DChi2(self): """ Test the chi2 calculator for Data1D """ reference_data = Data1D(x=[0.1, 0.2], y=[0.0, 0.0]) # 1. identical data current_data = Data1D(x=[0.1, 0.2], y=[0.0, 0.0]) weights = None chi = FittingUtilities.calculateChi2(refere...
SasView/sasview
[ 40, 32, 40, 388, 1423429150 ]
def notestAddHeadersToModel(self): '''Check to see if headers are correctly applied''' #test model model = QtGui.QStandardItemModel() FittingUtilities.addHeadersToModel(model) # Assure we have properly named columns names = FittingUtilities.model_header_captions ...
SasView/sasview
[ 40, 32, 40, 388, 1423429150 ]
def test_all(): md = 'Some *markdown* **text** ~xyz~' c_md = pf.convert_text(md) b_md = [pf.Para(pf.Str("Some"), pf.Space, pf.Emph(pf.Str("markdown")), pf.Space, pf.Strong(pf.Str("text")), pf.Space, pf.Subscript(pf.Str("xyz")))] print("Benchma...
sergiocorreia/panflute
[ 399, 55, 399, 14, 1459303667 ]
def _measure(d, sources, target, niter=25, bound=None): """ This computes unique information as S(X_0 >-< Y || X_1). Parameters ---------- d : Distribution The distribution to compute I_SKAR for. sources : iterable of iterables The source variable...
dit/dit
[ 430, 78, 430, 33, 1380495831 ]
def _measure(d, sources, target, niter=25, bound=None): """ This computes unique information as S(X_0 >-> Y || X_1). Parameters ---------- d : Distribution The distribution to compute I_SKAR for. sources : iterable of iterables The source variable...
dit/dit
[ 430, 78, 430, 33, 1380495831 ]
def _measure(d, sources, target, niter=25, bound=None): """ This computes unique information as S(X_0 <-< Y || X_1). Parameters ---------- d : Distribution The distribution to compute I_SKAR for. sources : iterable of iterables The source variable...
dit/dit
[ 430, 78, 430, 33, 1380495831 ]
def setUp(self): self.group, _ = Group.objects.get_or_create(name='Hydroshare Author') self.user = hydroshare.create_account( 'scrawley@byu.edu', username='scrawley', first_name='Shawn', last_name='Crawley', superuser=False,...
hydroshare/hydroshare
[ 163, 31, 163, 204, 1412216381 ]
def test_receivers(self): request = HttpRequest() # ScriptSpecificMetadata request.POST = {'scriptLanguage': 'R', 'languageVersion': '3.5'} data = script_metadata_pre_create_handler(sender=ScriptResource, element_name="ScriptSpecificMet...
hydroshare/hydroshare
[ 163, 31, 163, 204, 1412216381 ]
def __init__ (self, filepath, needle): self.filepath = filepath self.needle = needle
pizzapanther/Neutron-IDE
[ 73, 27, 73, 7, 1308021766 ]
def replace (self, rstr, rlines): fh = open(self.filepath, 'r') newlines = ''
pizzapanther/Neutron-IDE
[ 73, 27, 73, 7, 1308021766 ]
def results (self): ret = [] fh = open(self.filepath, 'r') if ide.utils.istext(fh.read(512)): fh.seek(0) linenum = 0 while 1: line = fh.readline() if line: for match in self.needle.finditer(line): ret.append((linenum, match.start(), match.end()))
pizzapanther/Neutron-IDE
[ 73, 27, 73, 7, 1308021766 ]
def del_stat_fields(self,generic): generic.pop("ns",None) generic.pop("numExtents",None) generic.pop("nindexes",None) generic.pop("lastExtentSize",None) generic.pop("paddingFactor",None) generic.pop("flags",None) generic.pop("totalIndexSize",None) generic....
periscope-ps/unis
[ 3, 3, 3, 15, 1359416012 ]
def make_color_table(in_class): """Build a set of color attributes in a class. Helper function for building the *TermColors classes."""
santisiri/popego
[ 5, 2, 5, 1, 1476320366 ]
def __init__(self,__scheme_name_,colordict=None,**colormap): self.name = __scheme_name_ if colordict is None: self.colors = Struct(**colormap) else: self.colors = Struct(colordict)
santisiri/popego
[ 5, 2, 5, 1, 1476320366 ]
def __init__(self,scheme_list=None,default_scheme=''): """Create a table of color schemes. The table can be created empty and manually filled or it can be created with a list of valid color schemes AND the specification for the default active scheme. """
santisiri/popego
[ 5, 2, 5, 1, 1476320366 ]
def copy(self): """Return full copy of object""" return ColorSchemeTable(self.values(),self.active_scheme_name)
santisiri/popego
[ 5, 2, 5, 1, 1476320366 ]
def get(self): """Renders the UI with the form fields.""" self.RenderStaticHtml('create_health_report.html')
endlessm/chromium-browser
[ 21, 16, 21, 3, 1435959644 ]
def _GetTableConfigList(self): query = table_config.TableConfig.query() table_config_list = query.fetch(keys_only=True) return_list = [] for config in table_config_list: return_list.append(config.id()) self.response.out.write(json.dumps({ 'table_config_list': return_list, }))
endlessm/chromium-browser
[ 21, 16, 21, 3, 1435959644 ]
def _CreateTableConfig(self): """Creates a table config. Writes a valid name or an error message.""" self._ValidateToken() name = self.request.get('tableName') master_bot = self.request.get('tableBots').splitlines() tests = self.request.get('tableTests').splitlines() table_layout = self.request....
endlessm/chromium-browser
[ 21, 16, 21, 3, 1435959644 ]
def __init__(self): super(Linkedin, self).__init__()
Impactstory/total-impact-core
[ 55, 7, 55, 20, 1330896831 ]
def provides_members(self): return True
Impactstory/total-impact-core
[ 55, 7, 55, 20, 1330896831 ]
def provides_biblio(self): return True
Impactstory/total-impact-core
[ 55, 7, 55, 20, 1330896831 ]
def member_items(self, linkedin_url, provider_url_template=None, cache_enabled=True): return [("url", linkedin_url)]
Impactstory/total-impact-core
[ 55, 7, 55, 20, 1330896831 ]
def provides_aliases(self): return True
Impactstory/total-impact-core
[ 55, 7, 55, 20, 1330896831 ]