当前位置: 首页>>代码示例>>Python>>正文


Python ra.get_username_provider函数代码示例

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


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

示例1: test_diff

    def test_diff(self):
        r = ra.RemoteAccess(self.repos_url,
                auth=ra.Auth([ra.get_username_provider()]))
        dc = self.get_commit_editor(self.repos_url) 
        f = dc.add_file("foo")
        f.modify("foo1")
        dc.close()

        dc = self.get_commit_editor(self.repos_url) 
        f = dc.open_file("foo")
        f.modify("foo2")
        dc.close()

        if client.api_version() < (1, 5):
            self.assertRaises(NotImplementedError, self.client.diff, 1, 2,
                self.repos_url, self.repos_url)
            return # Skip test

        (outf, errf) = self.client.diff(1, 2, self.repos_url, self.repos_url)
        self.addCleanup(outf.close)
        self.addCleanup(errf.close)
        self.assertEqual("""Index: foo
===================================================================
--- foo\t(revision 1)
+++ foo\t(revision 2)
@@ -1 +1 @@
-foo1
\\ No newline at end of file
+foo2
\\ No newline at end of file
""", outf.read())
        self.assertEqual("", errf.read())
开发者ID:lygstate,项目名称:subvertpy,代码行数:32,代码来源:test_client.py

示例2: __init__

    def __init__(self, config_dir, repopath, username=None, password=None):
        super(Client, self).__init__(config_dir, repopath, username, password)
        self.repopath = B(self.repopath)
        self.config_dir = B(config_dir)

        self._ssl_trust_prompt_cb = None

        auth_providers = [
            ra.get_simple_provider(),
            ra.get_username_provider(),
        ]

        if repopath.startswith('https:'):
            auth_providers += [
                ra.get_ssl_client_cert_file_provider(),
                ra.get_ssl_client_cert_pw_file_provider(),
                ra.get_ssl_server_trust_file_provider(),
                ra.get_ssl_server_trust_prompt_provider(self.ssl_trust_prompt),
            ]

        self.auth = ra.Auth(auth_providers)

        if username:
            self.auth.set_parameter(B('svn:auth:username'), B(username))

        if password:
            self.auth.set_parameter(B('svn:auth:password'), B(password))

        cfg = get_config(self.config_dir)
        self.client = SVNClient(cfg, auth=self.auth)
开发者ID:PingAnTech,项目名称:reviewboard,代码行数:30,代码来源:subvertpy.py

示例3: accept_ssl_certificate

    def accept_ssl_certificate(self, path, on_failure=None):
        """If the repository uses SSL, this method is used to determine whether
        the SSL certificate can be automatically accepted.

        If the cert cannot be accepted, the ``on_failure`` callback
        is executed.

        ``on_failure`` signature::

            void on_failure(e:Exception, path:str, cert:dict)
        """
        self._accept_cert = {}
        self._accept_on_failure = on_failure

        auth = ra.Auth([
            ra.get_simple_provider(),
            ra.get_username_provider(),
            ra.get_ssl_server_trust_prompt_provider(self._accept_trust_prompt),
        ])
        cfg = get_config(self.config_dir)
        client = SVNClient(cfg, auth)
        try:
            info = client.info(path)
            logging.debug('SVN: Got repository information for %s: %s' %
                          (path, info))
        except SubversionException as e:
            if on_failure:
                on_failure(e, path, self._accept_cert)
开发者ID:karthikkn,项目名称:reviewboard,代码行数:28,代码来源:subvertpy.py

示例4: _init_client

 def _init_client(self):
     self.client_ctx = client.Client()
     self.client_ctx.auth = Auth([ra.get_simple_provider(),
                                  ra.get_username_provider(),
                                  ra.get_ssl_client_cert_file_provider(),
                                  ra.get_ssl_client_cert_pw_file_provider(),
                                  ra.get_ssl_server_trust_file_provider()])
     self.client_ctx.log_msg_func = self.log_message_func
开发者ID:KyleJ61782,项目名称:subvertpy,代码行数:8,代码来源:__init__.py

示例5: accept_ssl_certificate

    def accept_ssl_certificate(self, path, on_failure=None):
        """If the repository uses SSL, this method is used to determine whether
        the SSL certificate can be automatically accepted.

        If the cert cannot be accepted, the ``on_failure`` callback
        is executed.

        ``on_failure`` signature::

            void on_failure(e:Exception, path:str, cert:dict)
        """
        cert = {}

        def _accept_trust_prompt(realm, failures, certinfo, may_save):
            cert.update({
                'realm': realm,
                'failures': failures,
                'hostname': certinfo[0],
                'finger_print': certinfo[1],
                'valid_from': certinfo[2],
                'valid_until': certinfo[3],
                'issuer_dname': certinfo[4],
            })

            if on_failure:
                return 0, False
            else:
                del cert['failures']
                return failures, True

        auth = ra.Auth([
            ra.get_simple_provider(),
            ra.get_username_provider(),
            ra.get_ssl_client_cert_file_provider(),
            ra.get_ssl_client_cert_pw_file_provider(),
            ra.get_ssl_server_trust_file_provider(),
            ra.get_ssl_server_trust_prompt_provider(_accept_trust_prompt),
        ])

        if self.username:
            auth.set_parameter(AUTH_PARAM_DEFAULT_USERNAME, B(self.username))

        if self.password:
            auth.set_parameter(AUTH_PARAM_DEFAULT_PASSWORD, B(self.password))

        cfg = get_config(self.config_dir)
        client = SVNClient(cfg, auth)

        try:
            info = client.info(path)
            logging.debug('SVN: Got repository information for %s: %s' %
                          (path, info))
        except SubversionException as e:
            if on_failure:
                on_failure(e, path, cert)

        return cert
开发者ID:chipx86,项目名称:reviewboard,代码行数:57,代码来源:subvertpy.py

示例6: test_commit_start

 def test_commit_start(self):
     self.build_tree({"dc/foo": None})
     self.client = client.Client(auth=ra.Auth([ra.get_username_provider()]),
             log_msg_func=lambda c: "Bmessage")
     self.client.add("dc/foo")
     self.client.commit(["dc"])
     r = ra.RemoteAccess(self.repos_url)
     revprops = r.rev_proplist(1)
     self.assertEqual("Bmessage", revprops["svn:log"])
开发者ID:lygstate,项目名称:subvertpy,代码行数:9,代码来源:test_client.py

示例7: get_commit_editor

    def get_commit_editor(self, url, message="Test commit"):
        """Obtain a commit editor.

        :param url: URL to connect to
        :param message: Commit message
        :return: Commit editor object
        """
        ra_ctx = RemoteAccess(url.encode("utf-8"), auth=Auth([ra.get_username_provider()]))
        revnum = ra_ctx.get_latest_revnum()
        return TestCommitEditor(ra_ctx.get_commit_editor({"svn:log": message}), ra_ctx.url, revnum)
开发者ID:vadmium,项目名称:subvertpy,代码行数:10,代码来源:__init__.py

示例8: client_set_revprop

    def client_set_revprop(self, url, revnum, name, value):
        """Set a revision property on a repository.

        :param url: URL of the repository
        :param revnum: Revision number of the revision
        :param name: Name of the property
        :param value: Value of the property, None to remove
        """
        r = ra.RemoteAccess(url, auth=Auth([ra.get_username_provider()]))
        r.change_rev_prop(revnum, name, value)
开发者ID:KyleJ61782,项目名称:subvertpy,代码行数:10,代码来源:__init__.py

示例9: accept_ssl_certificate

    def accept_ssl_certificate(self, path, on_failure=None):
        """If the repository uses SSL, this method is used to determine whether
        the SSL certificate can be automatically accepted.

        If the cert cannot be accepted, the ``on_failure`` callback
        is executed.

        ``on_failure`` signature::

            void on_failure(e:Exception, path:str, cert:dict)
        """
        cert = {}

        def _accept_trust_prompt(realm, failures, certinfo, may_save):
            cert.update(
                {
                    "realm": realm,
                    "failures": failures,
                    "hostname": certinfo[0],
                    "finger_print": certinfo[1],
                    "valid_from": certinfo[2],
                    "valid_until": certinfo[3],
                    "issuer_dname": certinfo[4],
                }
            )

            if on_failure:
                return 0, False
            else:
                del cert["failures"]
                return failures, True

        auth = ra.Auth(
            [
                ra.get_simple_provider(),
                ra.get_username_provider(),
                ra.get_ssl_client_cert_file_provider(),
                ra.get_ssl_client_cert_pw_file_provider(),
                ra.get_ssl_server_trust_file_provider(),
                ra.get_ssl_server_trust_prompt_provider(_accept_trust_prompt),
            ]
        )
        cfg = get_config(self.config_dir)
        client = SVNClient(cfg, auth)

        try:
            info = client.info(path)
            logging.debug("SVN: Got repository information for %s: %s" % (path, info))
        except SubversionException as e:
            if on_failure:
                on_failure(e, path, cert)

        return cert
开发者ID:hcchen,项目名称:reviewboard,代码行数:53,代码来源:subvertpy.py

示例10: __init__

 def __init__(self, config_dir, repopath, username=None, password=None):
     super(Client, self).__init__(config_dir, repopath, username, password)
     self.repopath = B(self.repopath)
     self.config_dir = B(config_dir)
     auth_providers = [ra.get_simple_provider(), ra.get_username_provider()]
     if repopath.startswith("https:"):
         auth_providers.append(ra.get_ssl_server_trust_prompt_provider(self.ssl_trust_prompt))
     self.auth = ra.Auth(auth_providers)
     if username:
         self.auth.set_parameter(B("svn:auth:username"), B(username))
     if password:
         self.auth.set_parameter(B("svn:auth:password"), B(password))
     cfg = get_config(self.config_dir)
     self.client = SVNClient(cfg, auth=self.auth)
开发者ID:javins,项目名称:reviewboard,代码行数:14,代码来源:subvertpy.py

示例11: svn_remote

def svn_remote(url):
    # note: client only works for local path

    # create an auth with stock svn providers
    auth = ra.Auth([
        ra.get_simple_provider(),
        ra.get_username_provider(),
        ra.get_ssl_client_cert_file_provider(),
        ra.get_ssl_client_cert_pw_file_provider(),
        ra.get_ssl_server_trust_file_provider(),
    ])
    auth.set_parameter(subvertpy.AUTH_PARAM_DEFAULT_USERNAME,
        settings.SVN_USERNAME)
    auth.set_parameter(subvertpy.AUTH_PARAM_DEFAULT_PASSWORD,
        settings.SVN_PASSWORD)

    return ra.RemoteAccess(url, auth=auth)
开发者ID:emory-libraries,项目名称:findingaids,代码行数:17,代码来源:svn.py

示例12: init_ra_and_client

    def init_ra_and_client(self):
        """
        Initializes the RA and client layers.

        With the SWIG bindings, getting unified diffs runs the remote server
        sometimes runs out of open files. It is not known whether the Subvertpy
        is affected by this.
        """
        def getclientstring():
            return 'hgsubversion'
        # TODO: handle certificate authentication, Mercurial style
        def getpass(realm, username, may_save):
            return self.username or username, self.password or '', False
        def getuser(realm, may_save):
            return self.username or '', False

        providers = ra.get_platform_specific_client_providers()
        providers += [
            ra.get_simple_provider(),
            ra.get_username_provider(),
            ra.get_ssl_client_cert_file_provider(),
            ra.get_ssl_client_cert_pw_file_provider(),
            ra.get_ssl_server_trust_file_provider(),
            ra.get_username_prompt_provider(getuser, 0),
            ra.get_simple_prompt_provider(getpass, 0),
        ]

        auth = ra.Auth(providers)
        if self.username:
            auth.set_parameter(subvertpy.AUTH_PARAM_DEFAULT_USERNAME, self.username)
        if self.password:
            auth.set_parameter(subvertpy.AUTH_PARAM_DEFAULT_PASSWORD, self.password)

        self.remote = ra.RemoteAccess(url=self.svn_url,
                                      client_string_func=getclientstring,
                                      auth=auth)

        self.client = client.Client()
        self.client.auth = auth
开发者ID:avuori,项目名称:dotfiles,代码行数:39,代码来源:subvertpy_wrapper.py

示例13: __init__

    def __init__(self, config_dir, repopath, username=None, password=None):
        super(Client, self).__init__(config_dir, repopath, username, password)
        self.repopath = B(self.repopath)
        self.config_dir = B(config_dir)

        self._ssl_trust_prompt_cb = None

        auth_providers = [
            ra.get_simple_provider(),
            ra.get_username_provider(),
        ]

        if repopath.startswith('https:'):
            auth_providers += [
                ra.get_ssl_client_cert_file_provider(),
                ra.get_ssl_client_cert_pw_file_provider(),
                ra.get_ssl_server_trust_file_provider(),
                ra.get_ssl_server_trust_prompt_provider(self.ssl_trust_prompt),
            ]

        self.auth = ra.Auth(auth_providers)
        self.username = None
        self.password = None

        if username:
            self.username = username
            self.auth.set_parameter(AUTH_PARAM_DEFAULT_USERNAME,
                                    B(self.username))

        if password:
            self.password = password
            self.auth.set_parameter(AUTH_PARAM_DEFAULT_PASSWORD,
                                    B(self.password))

        cfg = get_config(self.config_dir)
        self.client = SVNClient(cfg, auth=self.auth)
开发者ID:chipx86,项目名称:reviewboard,代码行数:36,代码来源:subvertpy.py

示例14: calculate_hot_spots

def calculate_hot_spots(jiraKey,repoUrl,end_time = time.time(),cache_update_time = time.time()):
    providers = ra.get_platform_specific_client_providers()
    providers += [
            ra.get_simple_provider(),
            ra.get_username_provider(),
            ra.get_ssl_client_cert_file_provider(),
            ra.get_ssl_client_cert_pw_file_provider(),
            ra.get_ssl_server_trust_file_provider(),
            ra.get_username_prompt_provider(getuser, 0),
            ra.get_simple_prompt_provider(getpass, 0),
        ]
    
    auth=ra.Auth(providers)
    auth.set_parameter(subvertpy.AUTH_PARAM_DEFAULT_USERNAME, settings.username) 
    auth.set_parameter(subvertpy.AUTH_PARAM_DEFAULT_PASSWORD, settings.password)

    conn = ra.RemoteAccess(repoUrl,auth=auth)

    global bugCache
    global svnCache
    
    if jiraKey in bugCache:
        bugs = bugCache[jiraKey]
    else:
        bugs = []
    if jiraKey in svnCache:
        svn_entries = svnCache[jiraKey]
    else:
        svn_entries = []
    
    
    
    start_time = end_time
    scores = {}
    authors = {}
    modified_files = []
    
    if (len(bugs) == 0 and len(svn_entries) == 0) or time.time() > cache_update_time:
        #retrieve the SVN log entries
        for (changed_paths, rev, revprops, has_children) in conn.iter_log(paths=None,start=0, end=conn.get_latest_revnum(), discover_changed_paths=True):
            svn_entries.append((changed_paths, rev, revprops, has_children))
        #query jira for all the closed bugs
        bugs = get_bugs(jiraKey)
        #add to the cache dictionary
        bugCache[jiraKey] = bugs
        svnCache[jiraKey] = svn_entries
    
    for (changed_paths, rev, revprops, has_children) in svn_entries:
        commit_time = time.mktime(dateutil.parser.parse(revprops["svn:date"]).timetuple())
        if commit_time <= end_time:
            #this svn commit contains code that fixed a bug
            if fixed_bug(revprops["svn:log"].decode('utf8') ,bugs):
	            #only consider *.java and *.js files for now
                modified_files.extend([(commit_time,filename,revprops["svn:author"]) for filename in changed_paths.keys() if is_source_file(filename)])
            if commit_time < start_time:
                start_time = commit_time
    
    for modified_file in modified_files:
        filename = modified_file[1]
        author = modified_file[2]
        #as per Google's description, normalize t between 0 and 1
        t = (modified_file[0]-start_time)/(end_time-start_time)
        #google's magic sauce
        score = 1/(1+(math.e**(-12*t+12)))
        #map the score to the file
        if filename not in scores:
            scores[filename] = score
        else:
            scores[filename] = scores[filename] + score
        #map the author(s) to the file
        if filename not in authors:
           authors[filename] = [author]
        else:
           authors[filename].append(author)

    #convert the list of authors to a map containing the counts 
    for filename,authorsList in authors.items():
        authors[filename]=Counter(authorsList)
    
    
    sorted_scores = sorted(scores.iteritems(), key=operator.itemgetter(1))
    sorted_scores.reverse()
    
    #add the author count to the scores tuple
    scoresWithAuthors =[]
    for score in sorted_scores:
        scoresWithAuthors.append((score[0],score[1],authors[score[0]]))
    
    #return the top 10 hotspots
    return scoresWithAuthors[:10]
开发者ID:nstehr,项目名称:Hotspot-Dashboard,代码行数:90,代码来源:bug_predictor.py

示例15: setUp

 def setUp(self):
     super(TestRemoteAccess, self).setUp()
     self.repos_url = self.make_repository("d")
     self.ra = ra.RemoteAccess(self.repos_url,
             auth=ra.Auth([ra.get_username_provider()]))
开发者ID:scm-tools,项目名称:subvertpy,代码行数:5,代码来源:test_ra.py


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