Partially translated from: https://pyfound.blogspot.com/2020/03/new-pip-resolver-to-roll-out-this-year.html
去年的 PSF 發文中提到,pip 的開發團隊正在為 pip 實作一個新的解析器(resolver)。我們計畫在今年把它釋出。
解析器的最重要改變會包括:
Partially translated from: https://pyfound.blogspot.com/2020/03/new-pip-resolver-to-roll-out-this-year.html
去年的 PSF 發文中提到,pip 的開發團隊正在為 pip 實作一個新的解析器(resolver)。我們計畫在今年把它釋出。
解析器的最重要改變會包括:
| Copyright (c) Django Software Foundation and individual contributors. | |
| All rights reserved. | |
| Redistribution and use in source and binary forms, with or without modification, | |
| are permitted provided that the following conditions are met: | |
| 1. Redistributions of source code must retain the above copyright notice, | |
| this list of conditions and the following disclaimer. | |
| 2. Redistributions in binary form must reproduce the above copyright |
| # based on: http://stackoverflow.com/questions/1015307/python-bind-an-unbound-method#comment8431145_1015405 | |
| def bind(instance, func, as_name): | |
| """ Turn a function to a bound method on an instance | |
| .. doctest:: | |
| >>> class Foo(object): | |
| ... def __init__(self, x, y): | |
| ... self.x = x | |
| ... self.y = y |
| from fabric.api import local, run, env, put | |
| import os, time | |
| # remote ssh credentials | |
| env.hosts = ['10.1.1.25'] | |
| env.user = 'deploy' | |
| env.password = 'XXXXXXXX' #ssh password for user | |
| # or, specify path to server public key here: | |
| # env.key_filename = '' |
| #!/usr/bin/env python2.7 | |
| import random | |
| import subprocess | |
| class Node(object): | |
| def __init__(self, key, value): | |
| self.key = key | |
| self.value = value |
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| # Example of Singleton design pattern | |
| # Copyright (C) 2011 Radek Pazdera | |
| # This program is free software: you can redistribute it and/or modify | |
| # it under the terms of the GNU General Public License as published by | |
| # the Free Software Foundation, either version 3 of the License, or | |
| # (at your option) any later version. |
| # "Understanding Python's closures". | |
| # | |
| # Tested in Python 3.1.2 | |
| # | |
| # General points: | |
| # | |
| # 1. Closured lexical environments are stored | |
| # in the property __closure__ of a function | |
| # | |
| # 2. If a function does not use free variables |