• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python utils.msg函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中utils.msg函数的典型用法代码示例。如果您正苦于以下问题:Python msg函数的具体用法?Python msg怎么用?Python msg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了msg函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: summary

    def summary(self, unabridged=False):
        props= ("watching_r "
                "u_watching "
                "r_info "
                "r_name "
                "r_langs "
                "forks_of_r "
                "parent_of_r "
                "gparent_of_r "
                "lang_by_r "
                "u_authoring "
                ).split()
        for prop in props:
            print(">> %s" % prop)
            if unabridged:
                pprint(dict(getattr(self, prop)).items())
            else:
                pprint(dict(getattr(self, prop)).items()[:5])
            print("")

        msg(">> test_u")
        if unabridged:
            pprint(self.test_u)
        else:
            pprint(self.test_u[:5])
开发者ID:numb3r3,项目名称:github-contest,代码行数:25,代码来源:database.py


示例2: search

    def search(self, keyword):
        if keyword is None:
            return None
        try:
            msg("Connecting to shell-storm.org...")
            s = http.client.HTTPConnection("shell-storm.org")
            s.request("GET", "/api/?s="+str(keyword))
            res = s.getresponse()
            data_l = res.read().split('\n')
        except:
            error_msg("Cannot connect to shell-storm.org")
            return None

        data_dl = []
        for data in data_l:
            try:
                desc = data.split("::::")
                dico = {
                         'ScAuthor': desc[0],
                         'ScArch': desc[1],
                         'ScTitle': desc[2],
                         'ScId': desc[3],
                         'ScUrl': desc[4]
                       }
                data_dl.append(dico)
            except:
                pass

        return data_dl
开发者ID:BwRy,项目名称:peda,代码行数:29,代码来源:shellcode.py


示例3: console

def console(results):
    """
    Just prints results into your neat terminal window.
    """
    results = sorted(
        results,
        key=lambda res: (res.exception is None, res.location)
    )

    for idx, result in enumerate(results):
        if result.exception:
            title = msg(result.location, TITLE_COLOR, attrs=["bold"])
            title += msg(
                u" ({}) ".format(text_type(result.exception)),
                EXCEPTION_COLOR, attrs=["bold"]
            )
            title += LOCATION_DELIMETER * (STDOUT_WIDTH - len(title))
            print_(title)
            continue

        if len(results) > 1:
            title = msg(result.location + u" ", TITLE_COLOR)
            title += LOCATION_DELIMETER * (STDOUT_WIDTH - len(title))
            print_(title)

        for track_idx, (title, length) in enumerate(result.data, start=1):
            message = str(track_idx)
            message += CSV_DELIMIETER
            message += msg(title.replace("|", r"\|"), attrs=["bold"])
            message += CSV_DELIMIETER
            message += length
            print_(message)

        if idx < len(results) - 1:
            print_("")
开发者ID:9seconds,项目名称:rymtracks,代码行数:35,代码来源:formatters.py


示例4: parse_lang

    def parse_lang(self):
        """Parse the repos langs information from file "lang.txt"
        """
        msg("parsing lang.txt")
        lines = file('/'.join((self.datadir,"lang.txt"))).read().split('\n')

        pairs = [line.split(":") for line in lines if line]
        pairs = [(int(pair[0]),
                  [tuple(x.split(";")) for x in pair[1].split(",")])
                 for pair in pairs]
        pairs = [(x, tuple([(int(z[1]), z[0].lower()) for z in y]))
                 for (x, y) in pairs]


        all_langs = defaultdict(bool)
        for repos, langs in pairs:
            for kloc, lang in langs:
                all_langs[lang]=True
        all_langs = sorted(all_langs.keys())
        
        msg("building lang_by_r and r_langs")
        for repos, langs in pairs:
            for kloc, lang in langs:
                lnloc = int(log(kloc + 1, 10))
                self.lang_by_r[lang].append((lnloc, repos))
                self.r_langs[repos].append((lang,lnloc))
        for lang in self.lang_by_r.keys():
            self.lang_by_r[lang].sort(key=lambda x:x[1])
开发者ID:numb3r3,项目名称:github-contest,代码行数:28,代码来源:database.py


示例5: parse_repos

    def parse_repos(self):
        """Parse repos information from file "repos.txt"
        """
        msg("Parsing repos.txt")
        lines = file('/'.join((self.datadir, "repos.txt"))).read().split('\n')
        pairs = [line.replace(':',',').split(',') for line in lines if line]
        pairs = [tuple([int(pair[0]),
                        int(pair[3]) if pair[3:4] else 0,
                        pair[1],
                        pair[2]
                    ])
                 for pair in pairs]
        for repos, parent, name, creation in pairs:
            if parent > 0:
                self.forks_of_r[parent].append(repos)
                self.parent_of_r[repos] = parent
            author, name = name.split('/')
            words = [int(x) for x in creation.split('-')]
            creation = date(words[0],words[1],words[2]).toordinal()
            self.r_info[repos] = (author, name, creation)
            self.u_authoring[author].append(repos)
            self.r_name[name].append(repos)

        for repos_gen1, repos_gen2 in self.parent_of_r.items():
            if repos_gen2 in self.parent_of_r:
                repos_gen3 = self.parent_of_r[repos_gen2]
                self.gparent_of_r[repos_gen1] = repos_gen3
开发者ID:numb3r3,项目名称:github-contest,代码行数:27,代码来源:database.py


示例6: select_by

def select_by(layer, selection, expression):
    try:
        utils.msg("Performing selection {} with query {}".format(selection, expression))
        arcpy.SelectLayerByAttribute_management(layer, selection, expression)
    except Exception as e:
        utils.msg("Unable to select by attributes", mtype='error', exception=e)
        sys.exit()
开发者ID:genegis,项目名称:genegis,代码行数:7,代码来源:SelectByAttributes.py


示例7: item_model

 def item_model(self):
     """construct item similarities
     """
     msg("building r_matrix")
     repos=set(self.data.watching_r.keys())
     for repo in repos:
         r_similar[repo] = self.related_items(repo)
     r_similar.sort(reverse=True)
开发者ID:numb3r3,项目名称:github-contest,代码行数:8,代码来源:knn.py


示例8: user_model

 def user_model(self):
     """construct user similarities
     """
     msg("building u_matrix")
     users = set(self.data.u_watching.keys())
     for user in users:
         u_similar[user] = self.related_users(user)
     u_similar.sort(reverse=True)
开发者ID:numb3r3,项目名称:github-contest,代码行数:8,代码来源:knn.py


示例9: tag

def tag(force='no', push='no'):
    """
    Tag a new release.

    Normally, if a Git tag exists matching the current version, and no Git
    commits appear after that tag, we abort assuming the user is making a
    mistake or forgot to commit their work.

    To override this -- i.e. to re-tag and re-upload -- specify ``force=yes``.
    We assume you know what you're doing if you use this.

    By default we do not push the tag remotely; specify ``push=yes`` to force a
    ``git push origin <tag>``.
    """
    force = force.lower() in ['y', 'yes']
    with settings(warn_only=True):
        changed = []
        # Does the current in-code version exist as a Git tag already?
        # If so, this means we haven't updated the in-code version specifier
        # yet, and need to do so.
        if current_version_is_tagged():
            # That is, if any work has been done since. Sanity check!
            if not commits_since_last_tag() and not force:
                abort("No work done since last tag!")
            # Open editor, update version
            version_file = "fabric/version.py"
            changed.append(update_code(version_file, force))
        # If the tag doesn't exist, the user has already updated version info
        # and we can just move on.
        else:
            print("Version has already been updated, no need to edit...")
        # Similar process but for the changelog.
        changelog = "docs/changelog.rst"
        if not current_version_is_changelogged(changelog):
            changed.append(update_code(changelog, force))
        else:
            print("Changelog already updated, no need to edit...")
        # Commit any changes
        if changed:
            with msg("Committing updated version and/or changelog"):
                reload(fabric.version)
                local("git add %s" % " ".join(changed))
                local("git commit -m \"Cut %s\"" % _version('verbose'))
                local("git push")

        # At this point, we've incremented the in-code version and just need to
        # tag it in Git.
        f = 'f' if force else ''
        with msg("Tagging"):
            local("git tag -%sam \"Fabric %s\" %s" % (
                f,
                _version('normal'),
                _version('short')
            ))
        # And push to the central server, if we were told to
        if push.lower() in ['y', 'yes']:
            with msg("Pushing"):
                local("git push origin %s" % _version('short'))
开发者ID:4hr1m4n,项目名称:fabric,代码行数:58,代码来源:tag.py


示例10: parse_watching

 def parse_watching(self):
     """Parse watching data from file "data.txt"
     """
     msg("Parsing data.txt")
     lines = file('/'.join((self.datadir,"data.txt"))).read().split('\n')
     pairs = [[int(x) for x in line.split(':')] for line in lines if line]
     for user, repos in pairs:
         self.watching_r[repos].append(user)
         self.u_watching[user].append(repos)
开发者ID:numb3r3,项目名称:github-contest,代码行数:9,代码来源:database.py


示例11: main

def main(bathy=None, out_raster=None):
    try:
        arcpy.env.rasterStatistics = "STATISTICS"
        # Calculate the slope of the bathymetric raster
        utils.msg("Calculating the slope...")
        out_slope = Slope(bathy, "DEGREE", 1)
        out_raster = utils.validate_path(out_raster)
        out_slope.save(out_raster)
    except Exception as e:
        utils.msg(e, mtype='error')
开发者ID:chinasio,项目名称:btm,代码行数:10,代码来源:slope.py


示例12: main

def main(out_workspace, input_bathymetry, broad_bpi_inner_radius, 
        broad_bpi_outer_radius, fine_bpi_inner_radius, fine_bpi_outer_radius, 
        classification_dict, output_zones):

    # Load required toolboxes
    local_path = os.path.dirname(__file__)
    btm_toolbox = os.path.abspath(os.path.join(local_path, '..', 'btm.pyt'))
    arcpy.ImportToolbox(btm_toolbox)

    # local variables:
    broad_bpi = os.path.join(out_workspace, "broad_bpi")
    fine_bpi = os.path.join(out_workspace, "fine_bpi")
    slope_rast = os.path.join(out_workspace, "slope")
    broad_std = os.path.join(out_workspace, "broad_std")
    fine_std = os.path.join(out_workspace, "fine_std")

    utils.workspace_exists(out_workspace)
    # set geoprocessing environments
    arcpy.env.scratchWorkspace = out_workspace
    arcpy.env.workspace = out_workspace

    # TODO: currently set to automatically overwrite, expose this as option
    arcpy.env.overwriteOutput = True

    try:
        # Process: Build Broad Scale BPI
        utils.msg("Calculating broad-scale BPI...")
        bpi.main(input_bathymetry, broad_bpi_inner_radius, \
                broad_bpi_outer_radius, broad_bpi, bpi_type='broad')

        # Process: Build Fine Scale BPI
        utils.msg("Calculating fine-scale BPI...")
        bpi.main(input_bathymetry, fine_bpi_inner_radius, \
                fine_bpi_outer_radius, fine_bpi, bpi_type='fine')

        # Process: Standardize BPIs
        utils.msg("Standardizing BPI rasters...")
        arcpy.standardizebpi_btm(broad_bpi, "0", "0", broad_std, fine_bpi, \
                "0", "0", fine_std)

        # Process: Calculate Slope
        slope.main(input_bathymetry, slope_rast)

        # Process: Zone Classification Builder
        outputs_base = arcpy.env.addOutputsToMap
        arcpy.env.addOutputsToMap = True
        utils.msg("Classifying Zones...")
        classify.main(classification_dict, broad_std, fine_std, slope_rast, \
                input_bathymetry, output_zones)
        arcpy.env.addOutputsToMap = outputs_base

    except Exception as e:
        # Print error message if an error occurs
        utils.msg(e, mtype='error')
开发者ID:chinasio,项目名称:btm,代码行数:54,代码来源:btm_model.py


示例13: main

def main(input_raster=None, selected_layer=None, interpolate=None, 
         mode=settings.mode):

        utils.msg("Executing ExtractRasterValuesToPoints.")   
        arcpy.CheckOutExtension("Spatial")

        # was bilinear interpolation asked for? maps to
        # 'bilinear_intepolate_values'.
        if interpolate in ('BILINEAR', True):
            bilinear = 'BILINEAR'
        else:
            bilinear = 'NONE'

        # create a value table, prefix all output rasters with 'R_'
        rasters = input_raster.split(";")
        value_table = []
        for raster in rasters:
            # default name is just the label, prepend 'R_'
            (label, input_ext) = os.path.splitext(os.path.basename(raster))
            label = "R_{0}".format(label)
            value_table.append([raster, label])
        utils.msg("generated value table: %s" % value_table)
        utils.msg("Running ExtractMultiValuesToPoints...")
        ExtractMultiValuesToPoints(selected_layer, value_table, bilinear)
        utils.msg("Values successfully extracted")  
开发者ID:genegis,项目名称:genegis,代码行数:25,代码来源:ExtractRasterValuesToPoints.py


示例14: zsc

 def zsc(self,os,job,encode):
     try:
         msg('Connection to OWASP ZSC API api.z3r0d4y.com')
         params = urlencode({
                 'api_name': 'zsc', 
                 'os': os,
                 'job': job,
                 'encode': encode})
         shellcode = urlopen("http://api.z3r0d4y.com/index.py?%s\n"%(str(params))).read()
         if pyversion is 3:
             shellcode = str(shellcode,encoding='ascii')
         return '\n"'+shellcode.replace('\n','')+'"\n'
     except:
         error_msg("Error while connecting to api.z3r0d4y.com ...")
         return None
开发者ID:453483289,项目名称:peda,代码行数:15,代码来源:shellcode.py


示例15: fill_pickle_jar

    def fill_pickle_jar(self):
        """Fill the data to pickle
        """
        jar = '/'.join((self.datadir,"pickle.jar"))
        d = {}
        
        msg("Filling pickle jar '%s'" % jar)

        for field in self.fields:
            d[field] = getattr(self, field)
        d['fields'] = self.fields
        
        jarf = open(jar, 'w')
        pickle.dump(d, jarf)
        jarf.close()
开发者ID:numb3r3,项目名称:github-contest,代码行数:15,代码来源:database.py


示例16: load_geodesic_dll

def load_geodesic_dll():
    fn = None
    # load the DEBUG build of the DLL.
    dll_path = os.path.abspath( \
        os.path.join(os.path.abspath(os.path.dirname(__file__)), \
        '..', 'arcobjects', 'geodesic', 'Debug', 'geodesic.dll'))

    if os.path.exists(dll_path):
        try:
            loaded_dll = ctypes.cdll.LoadLibrary(dll_path)
        except Exception as e:
            msg = "Failed to load high-speed geodesic library."
            utils.msg(msg, mtype='error', exception=e)
            return None
        fn = loaded_dll.CalculatePairwiseGeodesicDistances
        fn.argtypes = [ctypes.c_wchar_p, ctypes.c_wchar_p, ctypes.c_double]
        fn.restype = ctypes.c_int
    return fn
开发者ID:genegis,项目名称:genegis,代码行数:18,代码来源:distance_comparison.py


示例17: Add_service

def Add_service(request):
    if request.method == 'POST':
        form = ServiceForm(request.POST)
        if form.is_valid():
            form.save()
            return msg(request,"Serviço adicionado com Sucesso")
    else:
        form = ServiceForm
    return render(request, 'add_service.html', {'user':request.user,'form': form})
开发者ID:FelipeLimaM,项目名称:anybike-web,代码行数:9,代码来源:views.py


示例18: Add_employee

def Add_employee(request):
    if request.method == 'POST':
        form = EmployeeForm(request.POST)
        if form.is_valid():
            form.save()
            return msg(request,"Funcionario adicionado com Sucesso")
    else:
        form = EmployeeForm
    return render(request, 'add_employee.html', {'user':request.user,'form': form})
开发者ID:FelipeLimaM,项目名称:anybike-web,代码行数:9,代码来源:views.py


示例19: load_geodesic_dll

def load_geodesic_dll():
    fn = None
    # load the DLL path from the config settings.
    dll_path = settings.geodesic_dll_path
    if os.path.exists(dll_path):
        try:
            loaded_dll = ctypes.cdll.LoadLibrary(dll_path)
        except Exception as e:
            msg = "Failed to load high-speed geodesic library."
            utils.msg(msg, mtype='error', exception=e)
            return None
        fn = loaded_dll.CalculatePairwiseGeodesicDistances
        fn.argtypes = [ctypes.c_wchar_p, ctypes.c_wchar_p, ctypes.c_double, ctypes.c_bool]
        fn.restype = ctypes.c_int
    else:
        msg = "Unable to locate high-speed geodesic DLL at: {}".format(dll_path)
        utils.msg(msg, mtype='error')
    return fn                
开发者ID:genegis,项目名称:genegis,代码行数:18,代码来源:DistanceMatrix.py


示例20: Add_client

def Add_client(request):
    if request.method == 'POST':
        form = ClientForm(request.POST)
        if form.is_valid():
            form.save()
            return msg(request,"Cliente adicionado com Sucesso")
    else:
        form = ClientForm
    return render(request, 'add_client.html', {'user':request.user,'form': form})
开发者ID:FelipeLimaM,项目名称:anybike-web,代码行数:9,代码来源:views.py



注:本文中的utils.msg函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python utils.mult_matrix函数代码示例发布时间:2022-05-26
下一篇:
Python utils.mostrar_calendario函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap