PackageMixin   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 13
rs 10
c 1
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A copy() 0 11 2
1
'''
2
Created on May 23, 2014
3
4
@author: sean
5
'''
6
from binstar_client.utils import jencode
7
8
class PackageMixin(object):
9
10
    def copy(self, owner, package, version, basename=None,
11
                     to_owner=None, from_label='main', to_label='main'):
12
        url = '%s/copy/package/%s/%s/%s' % (self.domain, owner, package, version)
13
        if basename:
14
            url += '/%s' % basename
15
16
        payload = dict(to_owner=to_owner, from_channel=from_label, to_channel=to_label)
17
        data, headers = jencode(payload)
18
        res = self.session.post(url, data=data, headers=headers)
19
        self._check_response(res)
20
        return res.json()
21
22