function
stringlengths
11
56k
repo_name
stringlengths
5
60
features
list
def go(self): if "package" in self.attributes: self.packagefiles = self.attributes["package"] if "needsRestart" in self.attributes: self.restartRequired = True self.cmdList = [] if self.pluginstate in ('installed', 'remove'): if self.packagefiles: for package in self.packagefiles[:]: self.cmdL...
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def runUpgradeFinished(self): self.reloadPluginlist() if plugins.restartRequired or self.restartRequired: self.session.openWithCallback(self.UpgradeReboot, MessageBox, _("Installation has completed.") + "\n" + _("Do you want to reboot your receiver?"), MessageBox.TYPE_YESNO) else: self.close(True)
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def runRemove(self, result): if result: self.session.openWithCallback(self.runRemoveFinished, Ipkg, cmdList = self.cmdList)
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def reloadPluginlist(self): plugins.readPluginList(resolveFilename(SCOPE_PLUGINS))
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def __init__(self, session, plugin_path): Screen.__init__(self, session) self.skin_path = plugin_path self["key_red"] = StaticText(_("Close")) self["key_green"] = StaticText(_("Edit")) self.sel = [] self.val = [] self.entry = False self.exe = False self.path = "" self["actions"] = NumberActionMa...
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def setWindowTitle(self): self.setTitle(_("Select upgrade source to edit."))
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def KeyOk(self): if (self.exe == False) and (self.entry == True): self.sel = self["filelist"].getCurrent() self.val = self.path + self.sel self.session.open(IPKGSource, self.val)
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def Exit(self): self.close()
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def __init__(self, session, configfile = None): Screen.__init__(self, session) self.session = session self.configfile = configfile text = "" if self.configfile: try: fp = file(configfile, 'r') sources = fp.readlines() if sources: text = sources[0] fp.close() except IOError: pass...
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def setWindowTitle(self): self.setTitle(_("Edit upgrade source url."))
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def keyLeft(self): self["text"].left()
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def keyHome(self): self["text"].home()
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def keyDeleteForward(self): self["text"].delete()
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def keyNumberGlobal(self, number): self["text"].number(number)
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def __init__(self, session, plugin_path, args = None): Screen.__init__(self, session) NumericalTextInput.__init__(self) self.session = session self.skin_path = plugin_path self.setUseableChars(u'1234567890abcdefghijklmnopqrstuvwxyz') self["shortcuts"] = NumberActionMap(["ShortcutActions", "WizardActions",...
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def keyGotAscii(self): keyvalue = unichr(getPrevAsciiCode()).encode("utf-8") if len(keyvalue) == 1: self.setNextIdx(keyvalue[0])
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def getNextIdx(self,char): for idx, i in enumerate(self["list"].list): if i[0] and (i[0][0] == char): return idx
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def reload(self): if (os.path.exists(self.cache_file) == True): os.unlink(self.cache_file) self.list_updating = True self.rebuildList()
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def setStatus(self,status = None): if status: self.statuslist = [] divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/div-h.png")) if status == 'update': statuspng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/upgr...
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def go(self, returnValue = None): cur = self["list"].getCurrent() if cur: status = cur[3] package = cur[0] self.cmdList = [] if status == 'installed': self.cmdList.append((IpkgComponent.CMD_REMOVE, { "package": package })) if len(self.cmdList): self.session.openWithCallback(self.runRemove, ...
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def runRemoveFinished(self): self.session.openWithCallback(self.RemoveReboot, MessageBox, _("Removal has completed.") + "\n" + _("Do you want to reboot your receiver?"), MessageBox.TYPE_YESNO)
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def runUpgrade(self, result): if result: self.session.openWithCallback(self.runUpgradeFinished, Ipkg, cmdList = self.cmdList)
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def UpgradeReboot(self, result): if result is None: return if result is False: cur = self["list"].getCurrent() if cur: item = self['list'].getIndex() self.list[item] = self.buildEntryComponent(cur[0], cur[1], cur[2], 'installed') self.cachelist[item] = [cur[0], cur[1], cur[2], 'installed'] ...
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def IpkgList_Finished(self, result, retval, extra_args = None): if result: self.packetlist = [] last_name = "" for x in result.splitlines(): if ' - ' in x: tokens = x.split(' - ') name = tokens[0].strip() if name and not any(name.endswith(x) for x in self.unwanted_extensions): l = le...
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def OpkgListUpgradeable_Finished(self, result, retval, extra_args = None): if result: self.upgradeable_packages = {} for x in result.splitlines(): tokens = x.split(' - ') name = tokens[0].strip() if not any(name.endswith(x) for x in self.unwanted_extensions): l = len(tokens) version = l > ...
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def buildPacketList(self): self.list = [] self.cachelist = [] if self.cache_ttl > 0 and self.vc != 0: print 'Loading packagelist cache from ',self.cache_file try: self.cachelist = load_cache(self.cache_file) if len(self.cachelist) > 0: for x in self.cachelist: self.list.append(self.buildE...
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def __init__(self, session, list): Screen.__init__(self, session) self.list = SelectionList() self["list"] = self.list p = 0 if len(list): p = list[0].rfind("/") title = list[0][:p] self.title = ("%s %s %s") % (_("Install extensions"), _("from"), title) for listindex in range(len(list)): self...
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def filescan_open(list, session, **kwargs): filelist = [x.path for x in list] session.open(IpkgInstaller, filelist) # list
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def UpgradeMain(session, **kwargs): session.open(UpdatePluginMenu)
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def test_ef_connect(): data, specs = three_faces_sheet() sheet = Sheet("test", data, specs) ef_connect = connectivity.edge_in_face_connectivity(sheet) idx = sheet.edge_df.query(f"face == {sheet.Nf-1}").index assert ef_connect[idx[0], idx[1]]
CellModels/tyssue
[ 50, 17, 50, 22, 1426782444 ]
def test_cell_cell_connectivity(): data, _ = three_faces_sheet() mono = Monolayer("test", extrude(data), bulk_spec()) ccc = connectivity.cell_cell_connectivity(mono) expected = np.array([[0, 36, 36], [36, 0, 36], [36, 36, 0]]) np.testing.assert_array_equal(ccc, expected)
CellModels/tyssue
[ 50, 17, 50, 22, 1426782444 ]
def test_verts_in_face_connectivity(): data, specs = three_faces_sheet() sheet = Sheet("test", data, specs) vfc = connectivity.verts_in_face_connectivity(sheet) assert vfc[0][vfc[0] == 2].shape == (3,)
CellModels/tyssue
[ 50, 17, 50, 22, 1426782444 ]
def __init__(self, server=None): self.server = server server_selection = ServerSelectionWindow(self.server) server_selection.connect('server-selected', self.on_server_selected) self.app = GDanmakuApp(self) self.thread_sub = None self.enabled = True self.options = ...
tuna/gdanmaku
[ 36, 4, 36, 1, 1413132169 ]
def new_danmaku(self, dm_opts): if not self.enabled: return for opt in dm_opts: try: dm = Danmaku(**opt) dm.connect('delete-event', self.on_danmaku_delete) except Exception as e: print(e) continue ...
tuna/gdanmaku
[ 36, 4, 36, 1, 1413132169 ]
def toggle_danmaku(self): self.enabled = not self.enabled if not self.enabled: for _, dm in self.live_danmakus.iteritems(): dm.hide() dm._clean_exit()
tuna/gdanmaku
[ 36, 4, 36, 1, 1413132169 ]
def run(self): GObject.threads_init() Gtk.main()
tuna/gdanmaku
[ 36, 4, 36, 1, 1413132169 ]
def main(): options = load_config() parser = argparse.ArgumentParser(prog="gdanmaku") parser.add_argument( "--server", type=str, default=options["http_stream_server"], help="danmaku stream server" ) parser.add_argument( '--config', action="store_true...
tuna/gdanmaku
[ 36, 4, 36, 1, 1413132169 ]
def __init__(self, backend): self.config = backend.config self.backend = backend
openwisp/netjsonconfig
[ 358, 71, 358, 37, 1438272990 ]
def env_path(self): return self.__module__
openwisp/netjsonconfig
[ 358, 71, 358, 37, 1438272990 ]
def template_env(self): return Environment( loader=PackageLoader(self.env_path, 'templates'), trim_blocks=True )
openwisp/netjsonconfig
[ 358, 71, 358, 37, 1438272990 ]
def get_name(cls): """ Returns the name of the render class without its prefix """ return str(cls.__name__).replace('Renderer', '').lower()
openwisp/netjsonconfig
[ 358, 71, 358, 37, 1438272990 ]
def __init__(self, attrs=None, options={}, *args, **kwargs): super(TagAutocompleteWidget, self).__init__(attrs) print(self.__dict__) self.options = options
hzlf/openbroadcast.org
[ 9, 2, 9, 44, 1413831364 ]
def __init__(self, kt=None, vt=None, data=None): """This is a typed dict implementation that optionally enforces given types on contained values on assignment.""" self._kt = kt self._vt = vt if kt is None and vt is None: self.check = self._check_noop elif kt...
arskom/spyne
[ 1084, 311, 1084, 72, 1279866388 ]
def _check_k(self, key, _): if not isinstance(key, self._kt): raise TypeError(repr(key))
arskom/spyne
[ 1084, 311, 1084, 72, 1279866388 ]
def _check_kv(self, key, value): if not isinstance(key, self._kt): raise TypeError(repr(key)) if not isinstance(value, self._vt): raise TypeError(repr(value))
arskom/spyne
[ 1084, 311, 1084, 72, 1279866388 ]
def update(self, E=None, **F): try: it = chain(E.items(), F.items()) except AttributeError: it = chain(E, F) for k, v in it: self[k] = v
arskom/spyne
[ 1084, 311, 1084, 72, 1279866388 ]
def fromkeys(cls, S, v=None): kt = vt = None if len(S) > 0: kt, = set((type(s) for s in S)) if v is not None: vt = type(v) retval = tdict(kt, vt) for s in S: retval[s] = v return retval
arskom/spyne
[ 1084, 311, 1084, 72, 1279866388 ]
def setup(): # All of the paths used are relative, if we run the tests # from another directory we need to chdir() os.chdir(execution_path('.'))
mapnik/python-mapnik
[ 148, 85, 148, 135, 1429727065 ]
def test_topojson_init(): # topojson tests/data/json/escaped.geojson -o tests/data/topojson/escaped.topojson --properties # topojson version 1.4.2 ds = mapnik.Datasource( type='topojson', file='../data/topojson/escaped.topojson') e = ds.envelope() assert_a...
mapnik/python-mapnik
[ 148, 85, 148, 135, 1429727065 ]
def test_geojson_from_in_memory_string(): ds = mapnik.Datasource( type='topojson', inline=open( '../data/topojson/escaped.topojson', 'r').read()) f = list(ds.all_features())[0] eq_(len(ds.fields()), 11) desc = ds.describe() ...
mapnik/python-mapnik
[ 148, 85, 148, 135, 1429727065 ]
def test_that_nonexistant_query_field_throws(**kwargs): ds = mapnik.Datasource( type='topojson', file='../data/topojson/escaped.topojson') eq_(len(ds.fields()), 11) # TODO - this sorting is messed up eq_(ds.fields(), ['name', 'int', 'description', ...
mapnik/python-mapnik
[ 148, 85, 148, 135, 1429727065 ]
def GetDataClient(mocked=False): """Returns a BigQueryClient with default credentials in the testing env.""" if mocked: return mock_big_query_client.MockBigQueryClient( credential_file=credentials_lib.DEFAULT_CREDENTIALS, env=data_source_config.Environments.TESTING) else: return big_query_...
GoogleCloudPlatform/PerfKitExplorer
[ 267, 64, 267, 24, 1405617733 ]
def setUp(self): self.author = Author.objects.create( name="Super powerful superhero", email="i.am@lost.com" ) self.blog = Blog.objects.create(name="Some Blog", tagline="It's a blog") self.other_blog = Blog.objects.create( name="Other blog", tagline="It's another ...
django-json-api/rest_framework_ember
[ 1059, 290, 1059, 30, 1405701974 ]
def test_query_count_include_author(self): """We expect a list view with an include have five queries: 1. Primary resource COUNT query 2. Primary resource SELECT 3. Authors prefetched 4. Author types prefetched 5. Entries prefetched """ with self.assertNu...
django-json-api/rest_framework_ember
[ 1059, 290, 1059, 30, 1405701974 ]
def test_query_prefetch_uses_included_resources(self): """We expect a list view with `included_resources` to have three queries: 1. Primary resource COUNT query 2. Primary resource SELECT 3. Comments prefetched """ with self.assertNumQueries(3): response = se...
django-json-api/rest_framework_ember
[ 1059, 290, 1059, 30, 1405701974 ]
def test_parse_result(self): x = webuntis.utils.remote._parse_result a = {'id': 2} b = {'id': 3} self.assertRaisesRegex(webuntis.errors.RemoteError, 'Request ID', x, a, b) a = b = {'id': 2} self.assertRaisesRegex(webuntis.errors.RemoteErro...
maphy-psd/python-webuntis
[ 41, 14, 41, 9, 1347193504 ]
def RunCommand_Mock(self, result, *args, **kwargs): output = self.mox.CreateMockAnything() output.output = result return output
coreos/chromite
[ 6, 25, 6, 1, 1362087777 ]
def testInternalRepoCheckout(self): """Test we detect internal checkouts properly.""" self.mox.StubOutWithMock(cros_build_lib, 'RunCommand') tests = [ 'ssh://gerrit-int.chromium.org:29419/chromeos/manifest-internal.git', 'ssh://gerrit-int.chromium.org:29419/chromeos/manifest-internal', ...
coreos/chromite
[ 6, 25, 6, 1, 1362087777 ]
def _Initialize(self, branch='master'): repo = repository.RepoRepository(constants.MANIFEST_URL, self.tempdir, branch=branch) repo.Initialize()
coreos/chromite
[ 6, 25, 6, 1, 1362087777 ]
def setUp(self): os.putenv('GIT_COMMITTER_EMAIL', 'chrome-bot@chromium.org') os.putenv('GIT_AUTHOR_EMAIL', 'chrome-bot@chromium.org')
coreos/chromite
[ 6, 25, 6, 1, 1362087777 ]
def find_nuget_unix(): import os if 'NUGET_PATH' in os.environ: hint_path = os.environ['NUGET_PATH'] if os.path.isfile(hint_path) and os.access(hint_path, os.X_OK): return hint_path hint_path = os.path.join(hint_path, 'nuget') if os.path.isfile(hint_path) and os.acce...
okamstudio/godot
[ 59119, 10213, 59119, 8863, 1388851536 ]
def find_msbuild_unix(filename): import os.path import sys hint_dirs = ['/opt/novell/mono/bin'] if sys.platform == 'darwin': hint_dirs = ['/Library/Frameworks/Mono.framework/Versions/Current/bin', '/usr/local/var/homebrew/linked/mono/bin'] + hint_dirs for hint_dir in hint_dirs: hin...
okamstudio/godot
[ 59119, 10213, 59119, 8863, 1388851536 ]
def mono_build_solution(source, target, env): import subprocess from shutil import copyfile sln_path = os.path.abspath(str(source[0])) target_path = os.path.abspath(str(target[0])) framework_path = '' msbuild_env = os.environ.copy() # Needed when running from Developer Command Prompt for ...
okamstudio/godot
[ 59119, 10213, 59119, 8863, 1388851536 ]
def checkrefval(mod, errs): for fp_text in (node for node in mod if node[0] == "fp_text"): if fp_text[1] not in ("reference", "value"): continue layer = [n for n in fp_text if n[0] == "layer"][0] if layer[1] != "F.Fab": errs.append("Value and Reference fields must be ...
adamgreig/agg-kicad
[ 151, 45, 151, 23, 1446946977 ]
def checklines(mod, errs, check_layers, check_width): line_types = ("fp_line", "fp_circle", "fp_arc", "fp_poly", "fp_curve") for line in (node for node in mod if node[0] in line_types): layer = [n for n in line if n[0] == "layer"][0] width = [n for n in line if n[0] == "width"][0] if lay...
adamgreig/agg-kicad
[ 151, 45, 151, 23, 1446946977 ]
def checkmod(path, verbose=False): errs = [] with open(path) as f: mod = sexp_parse(f.read()) checkrefval(mod, errs) checkfont(mod, errs) checklines(mod, errs, ("F.SilkS", "B.SilkS"), "0.15") checklines(mod, errs, ("F.Fab", "B.Fab"), "0.01") checkctyd(mod, errs) if len(errs) =...
adamgreig/agg-kicad
[ 151, 45, 151, 23, 1446946977 ]
def scanRF(LowestAmp, HighestAmp, step, numScans): # setup AmpList = [] fileSystem = Environs.FileSystem file = \ fileSystem.GetDataDirectory(\ fileSystem.Paths["scanMasterDataPath"])\ + fileSystem.GenerateNextDataFileName() print("Saving as " + file + "_" + "MeasuredRF1Amp" + "*.zip") print("") # start...
ColdMatter/EDMSuite
[ 8, 16, 8, 2, 1350917084 ]
def __init__(self, x): dict.__init__(self, x) self.x = x
GlobalBoost/GlobalBoost-Y
[ 13, 18, 13, 1, 1410204403 ]
def set_test_params(self): self.setup_clean_chain = True self.num_nodes = 3 self.extra_args = [["-addresstype=legacy"], ["-addresstype=legacy"], ["-addresstype=legacy"]]
GlobalBoost/GlobalBoost-Y
[ 13, 18, 13, 1, 1410204403 ]
def setup_network(self, split=False): super().setup_network() connect_nodes_bi(self.nodes, 0, 2)
GlobalBoost/GlobalBoost-Y
[ 13, 18, 13, 1, 1410204403 ]
def execute(f, iterable, stop_flag=None, workers=10, timeout=30): with Executor(max_workers=workers) as executor: threading.Timer(timeout, stop_flag.set) for future in _batched_pool_runner(executor, workers, f, iterable, timeout): if xbmc.abort...
repotvsupertuga/tvsupertuga.repository
[ 1, 8, 1, 4, 1493763534 ]
def format_selection(format_line): "Apply a formatting function to all of the selected lines." @wraps(format_line) def apply(self, event=None): head, tail, chars, lines = self.formatter.get_region() for pos in range(len(lines) - 1): line = lines[pos] lines[pos] = for...
bruderstein/PythonScript
[ 310, 62, 310, 74, 1280013973 ]
def __init__(self, editwin): "Initialize the settings for this extension." self.editwin = editwin self.text = editwin.text self.formatter = editwin.fregion
bruderstein/PythonScript
[ 310, 62, 310, 74, 1280013973 ]
def reload(cls): "Load class variables from config." cls.ztext = idleConf.GetOption('extensions', 'ZzDummy', 'z-text')
bruderstein/PythonScript
[ 310, 62, 310, 74, 1280013973 ]
def z_in_event(self, line): """Insert text at the beginning of each selected line. This is bound to the <<z-in>> virtual event when the extensions are loaded. """ return f'{self.ztext}{line}'
bruderstein/PythonScript
[ 310, 62, 310, 74, 1280013973 ]
def z_out_event(self, line): """Remove specific text from the beginning of each selected line. This is bound to the <<z-out>> virtual event when the extensions are loaded. """ zlength = 0 if not line.startswith(self.ztext) else len(self.ztext) return line[zlength:]
bruderstein/PythonScript
[ 310, 62, 310, 74, 1280013973 ]
def get_testfile_path(name): return os.path.join(os.path.dirname(__file__), 'PySafety_test_files', name)
coala/coala-bears
[ 291, 584, 291, 703, 1455441911 ]
def setUp(self): self.section = Section('name') self.uut = PySafetyBear(self.section, Queue())
coala/coala-bears
[ 291, 584, 291, 703, 1455441911 ]
def test_with_vulnerability(self): self.check_invalidity(self.uut, ['bottle==0.10.1'])
coala/coala-bears
[ 291, 584, 291, 703, 1455441911 ]
def test_without_cve_vulnerability(self): file_name = 'requirement.txt' file_contents = load_testfile(file_name) file_contents = [file_contents[1]] self.check_results( self.uut, file_contents, [Result.from_values('PySafetyBear', ...
coala/coala-bears
[ 291, 584, 291, 703, 1455441911 ]
def test_with_no_requirements(self): self.check_validity(self.uut, [])
coala/coala-bears
[ 291, 584, 291, 703, 1455441911 ]
def import_modules(self): modules = ['yaml'] if '+libyaml' in self.spec: modules.append('yaml.cyaml') return modules
LLNL/spack
[ 3244, 1839, 3244, 2847, 1389172932 ]
def build_ext_args(self, spec, prefix): args = [] if spec.satisfies('@:5 +libyaml'): args.extend([ spec['libyaml'].libs.search_flags, spec['libyaml'].headers.include_flags, ]) return args
LLNL/spack
[ 3244, 1839, 3244, 2847, 1389172932 ]
def main(config_file): log.startLogging(sys.stdout) application = web.Application(config_file) port = os.environ.get("PORT", 8888) reactor.listenTCP(int(port), application) reactor.run()
fiorix/cyclone
[ 699, 99, 699, 8, 1253582104 ]
def say(self, chan, words): send = 'PRIVMSG %s :%s\r\n' % (chan, words) sock.send(send)
sparkslabs/kamaelia_
[ 13, 3, 13, 2, 1348148442 ]
def run(self): global done while not done: msg = raw_input('IRC > ') if msg == 'QUIT': sock.send('QUIT') done = True self.say(channel, msg)
sparkslabs/kamaelia_
[ 13, 3, 13, 2, 1348148442 ]
def checkForMessages(self): read_list, write_list, error_list = \ select.select([sock], [], [sock], 0) if sock in read_list: raw = sock.recv(8000) self.printOutput(raw)
sparkslabs/kamaelia_
[ 13, 3, 13, 2, 1348148442 ]
def printOutput(self, text): if '\r' in text: text = text.replace('\r', '\n') lines = text.split('\n') for one_line in lines: if len(one_line) > 0: print self.formatLine(one_line)
sparkslabs/kamaelia_
[ 13, 3, 13, 2, 1348148442 ]
def __init__(self, request_validator): self.bearer = BearerToken(request_validator, None, None, None) self.request_validator = request_validator BaseEndpoint.__init__(self)
idan/oauthlib
[ 2555, 477, 2555, 82, 1321744131 ]
def create_userinfo_response(self, uri, http_method='GET', body=None, headers=None): """Validate BearerToken and return userinfo from RequestValidator The UserInfo Endpoint MUST return a content-type header to indicate which format is being returned. The content-type of the HTTP respons...
idan/oauthlib
[ 2555, 477, 2555, 82, 1321744131 ]
def encode(self,input,errors='strict'): return codecs.charmap_encode(input,errors,encoding_map)
atmark-techno/atmark-dist
[ 3, 2, 3, 4, 1476164728 ]
def decode(self,input,errors='strict'): return codecs.charmap_decode(input,errors,decoding_map)
atmark-techno/atmark-dist
[ 3, 2, 3, 4, 1476164728 ]
def getregentry(): return (Codec().encode,Codec().decode,StreamReader,StreamWriter)
atmark-techno/atmark-dist
[ 3, 2, 3, 4, 1476164728 ]
def seperate_warnings_by_location(warnings_data): """ Warnings originate from multiple locations, this function takes in list of warning objects and separates them based on their filename location """ # first create regex for each n file location warnings_locations = { ".*/python\d\.\d/...
edx-solutions/edx-platform
[ 12, 19, 12, 9, 1391522577 ]
def read_warning_data(dir_path): """ During test runs in jenkins, multiple warning json files are output. This function finds all files and aggregates the warnings in to one large list """ # pdb.set_trace() dir_path = os.path.expanduser(dir_path) # find all files that exist in given director...
edx-solutions/edx-platform
[ 12, 19, 12, 9, 1391522577 ]
def process_warnings_json(dir_path): """ Master function to process through all warnings and output a dict dict structure: { location: [{warning text: {file_name: warning object}}] } flow: - Aggregate data from all warning files - Separate warnings by deprecated vs non ...
edx-solutions/edx-platform
[ 12, 19, 12, 9, 1391522577 ]
def write_html_report(warnings_dataframe, html_path): """ converts from panda dataframe to our html """ html_path = os.path.expanduser(html_path) if "/" in html_path: location_of_last_dir = html_path.rfind("/") dir_path = html_path[:location_of_last_dir] os.makedirs(dir_path,...
edx-solutions/edx-platform
[ 12, 19, 12, 9, 1391522577 ]
def _recursive_apply(tensors, apply_fn): """Helper method to recursively apply a function to structure of tensors. The structure of the tensors should take the form similar to fetches in `tf.compat.v1.Session` and includes single `Tensor`, `list`, nested `list`, `tuple`, `namedtuple`, or `dict`. Args: ...
tensorflow/tensorflow
[ 171949, 87931, 171949, 2300, 1446859160 ]
def __init__(self): self.cache = {}
tensorflow/tensorflow
[ 171949, 87931, 171949, 2300, 1446859160 ]
def get_control_outputs(self, op): """Return the control outputs for a given op. Args: op: The op to fetch control outputs for. Returns: Iterable of control output ops. """ if op.graph not in self.cache: control_outputs = self.calc_control_outputs(op.graph) self.cache[op.gr...
tensorflow/tensorflow
[ 171949, 87931, 171949, 2300, 1446859160 ]