Generates update dictionary entries for the version string
480818
def get_final_version_string(release_mode, semver, commit_count=0):
    """"""
    version_string = ".".join(semver)
    maybe_dev_version_string = version_string
    updates = {}
    if release_mode:
        # in production, we have something like `1.2.3`, as well as a flag e.g. PRODUCTION=True
        updates[Constants.RELEASE_FIELD] = config.RELEASED_VALUE
    else:
        # in dev mode, we have a dev marker e.g. `1.2.3.dev678`
        maybe_dev_version_string = config.DEVMODE_TEMPLATE.format(
            version=version_string, count=commit_count
        )

    # make available all components of the semantic version including the full string
    updates[Constants.VERSION_FIELD] = maybe_dev_version_string
    updates[Constants.VERSION_STRICT_FIELD] = version_string
    return updates
929319
def available_updates(self, obj):
        """"""
        from package_monitor import pypi
        package = pypi.Package(obj.package_name)
        versions = package.all_versions()
        return html_list([v for v in versions if v > obj.current_version])
63556
def version_str(version):
    
    if isinstance(version, str):
        return version
    elif isinstance(version, tuple):
        return '.'.join([str(int(x)) for x in version])
    else:
        raise ValueError("Invalid version: %s" % version)
330681
def update_docstrings():
    
    modules_dict = parse_readme()
    files = {}
    # update modules
    for mod in modules_dict:
        mod_file = os.path.join(modules_directory(), mod + ".py")
        with open(mod_file) as f:
            files[mod] = f.readlines()

    for mod in files:
        replaced = False
        done = False
        lines = False
        out = []
        quotes = None
        for row in files[mod]:
            # deal with single or double quoted docstring
            if not quotes:
                if row.strip().startswith('"""'):
                    quotes = '"""'
                if row.strip().startswith("'''"):
                    quotes = "'''"
            if quotes and row.strip().startswith(quotes) and not done:
                out.append(row)
                if not replaced:
                    out = out + [
                        "".join(_to_docstring(modules_dict[mod])).strip() + "\n"
                    ]
                    replaced = True
                if lines:
                    done = True
                if not done and not lines:
                    lines = True
                continue
            if not lines or done:
                out.append(row)
        mod_file = os.path.join(modules_directory(), mod + ".py")
        with open(mod_file, "w") as f:
            f.writelines(out)
    print_stderr("Modules updated from README.md")
505753
def _update(self, **kwargs):
        """"""

        requests_params, update_uri, session, read_only = \
            self._prepare_put_or_patch(kwargs)

        read_only_mutations = []
        for attr in read_only:
            if attr in kwargs:
                read_only_mutations.append(attr)
        if read_only_mutations:
            msg = 'Attempted to mutate read-only attribute(s): %s' \
                  % read_only_mutations
            raise AttemptedMutationOfReadOnly(msg)

        # Get the current state of the object on BIG-IP® and check the
        # generation Use pop here because we don't want force in the data_dict
        force = self._check_force_arg(kwargs.pop('force', True))
        if not force:
            # generation has a known server-side error
            self._check_generation()

        kwargs = self._check_for_boolean_pair_reduction(kwargs)

        # Save the meta data so we can add it back into self after we
        # load the new object.
        temp_meta = self.__dict__.pop('_meta_data')

        # Need to remove any of the Collection objects from self.__dict__
        # because these are subCollections and _meta_data and
        # other non-BIG-IP® attrs are not removed from the subCollections
        # See issue #146 for details
        tmp = dict()
        for key, value in iteritems(self.__dict__):
            # In Python2 versions we were changing a dictionary in place,
            # but this cannot be done with an iterator as an error is raised.
            # So instead we create a temporary holder for the modified dict
            # and then re-assign it afterwards.
            if isinstance(value, Collection):
                pass
            else:
                tmp[key] = value
        self.__dict__ = tmp
        data_dict = self.to_dict()

        # Remove any read-only attributes from our data_dict before we update
        # the data dict with the attributes.  If they pass in read-only attrs
        # in the method call we are going to let BIG-IP® let them know about it
        # when it fails
        for attr in read_only:
            data_dict.pop(attr, '')

        data_dict.update(kwargs)
        data_dict = self._prepare_request_json(data_dict)

        # Handles ConnectionAborted errors
        #
        # @see https://github.com/F5Networks/f5-ansible/issues/317
        # @see https://github.com/requests/requests/issues/2364
        for _ in range(0, 30):
            try:
                response = session.put(update_uri, json=data_dict, **requests_params)
                self._meta_data = temp_meta
                self._local_update(response.json())
                break
            except iControlUnexpectedHTTPError:
                response = session.get(update_uri, **requests_params)
                self._meta_data = temp_meta
                self._local_update(response.json())
                raise
            except ConnectionError as ex:
                if 'Connection aborted' in str(ex):
                    time.sleep(1)
                    continue
                else:
                    raise
1063130
function(str){
        var versionArray = str.split(",");//replace with regex
        return {
            "raw":str,
            "major":parseInt(versionArray[0].split(" ")[1], 10),
            "minor":parseInt(versionArray[1], 10),
            "revision":parseInt(versionArray[2], 10),
            "revisionStr":versionArray[2]
        };
    }
1010292
def versionstring():
    # type: () -> Text
    '''
    
    '''
    pkg = pkg_resources.require("cwltool")
    if pkg:
        return u"%s %s" % (sys.argv[0], pkg[0].version)
    return u"%s %s" % (sys.argv[0], "unknown version")
71813
private static String generateCrudReplicatedUpdate(Table table, Constraint pkey)
    {
        StringBuilder sb = new StringBuilder();
        sb.append("UPDATE " + table.getTypeName() + " SET ");

        generateCrudExpressionColumns(table, sb);
        generateCrudPKeyWhereClause(null, pkey, sb);
        sb.append(';');

        return sb.toString();
    }
1088388
function generate_module_version_map (modules, host) {
  modules.forEach(function(mod) {
    var name = mod.split('@')[0];
    host[name] = mod;
  });
}
1300308
def dev_version():
  

  md5_hash = hashlib.md5()
  py_files = sorted(list_files(suffix=".py"))
  if not py_files:
    return ''
  for filename in py_files:
    with open(filename, 'rb') as fobj:
      content = fobj.read()
    md5_hash.update(content)
  return md5_hash.hexdigest()
1079662
function saveNewVersion(version, versionFile) {
    fs.writeFileSync(versionFile, JSON.stringify({
        version
    }, null, 2), 'UTF-8');
}
836870
def copy_and_update(dictionary, update):
    """"""
    newdict = dictionary.copy()
    newdict.update(update)
    return newdict
939357
def __list_updates(update_type, update_list):
    
    if len(update_list):
        print("  %s:" % update_type)
        for update_item in update_list:
            print("  -- %(version)s on %(upload_time)s" % update_item)
7198
function toDrupalMajorVersion(version) {
    var regex = /^(\d+)\.\d+\.[x\d+]/;
    var match = version.match(regex)
    if (match) {
      return match[1] + '.x';
    }

    return version;
  }
666569
def update_version_number(update_level='patch'):
    """Find current version"""
    temp_file = version_file().parent / ("~" + version_file().name)
    with open(str(temp_file), 'w') as g:
        with open(str(version_file()), 'r') as f:
            for line in f:
                version_matches = bare_version_re.match(line)
                if version_matches:
                    bare_version_str = version_matches.groups(0)[0]
                    if semantic_version.validate(bare_version_str):
                        current_version = Version(bare_version_str)
                        print("{}Current version is {}".format(" "*4, current_version))
                    else:
                        current_version = Version.coerce(bare_version_str)
                        if not text.query_yes_quit("{}I think the version is {}. Use it?".format(" "*4, current_version), default="yes"):
                            exit(Fore.RED + 'Please set an initial version number to continue')

                    """Determine new version number"""
                    if update_level is 'major':
                        current_version = current_version.next_major()
                    elif update_level is 'minor':
                        current_version = current_version.next_minor()
                    elif update_level is 'patch':
                        current_version = current_version.next_patch()
                    elif update_level is 'prerelease':
                        if not current_version.prerelease:
                            current_version = current_version.next_patch()
                            current_version.prerelease = ('dev', )
                    else:
                        exit(Fore.RED + 'Cannot update version in {} mode'.format(update_level))

                    print("{}New version is     {}".format(" "*4, current_version))

                    """Update version number"""
                    line = '__version__ = "{}"'.format(current_version)
                print(line, file=g, end="")
        print('', file=g)  # add a blank line at the end of the file
    shutil.copyfile(str(temp_file), str(version_file()))
    os.remove(str(temp_file))
    return(current_version)
1019741
def tokenize_version(version_string: str) -> Tuple[int, int, int]:
    
    before_dash = version_string.split('-')[0]
    major, minor, patch = before_dash.split('.')[:3]  # take only the first 3 in case there's an extension like -dev.0
    return int(major), int(minor), int(patch)
1197411
def generate_version(max_major: int = 1, max_minor: int = 7,
                     max_patch: int = 15) -> str:
    
    major = randint(0, max_major)
    minor = randint(0, max_minor)
    patch = randint(0, max_patch)
    return '{:d}.{:d}.{:d}'.format(major, minor, patch)