This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.regex.*; | |
public class LookbehindSplit { | |
public static void main(String[] args) { | |
String split_regex = "((?<=\\])(?=\\[))"; | |
String[] test = "[1][2][3\\]3][4\\[4]".split(split_regex); | |
for (String s : test) { | |
System.out.println(s); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import json | |
import pkg_resources | |
def get_pkg_license(pkgname): | |
""" | |
Given a package reference (as from requirements.txt), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def deepen(shallow_obj): | |
"""Recursively deepens a dictionary based on keys""" | |
shallow_copy = copy.copy(shallow_obj) | |
deep_obj = {} | |
for key in shallow_copy: | |
if isinstance(shallow_copy[key], dict): | |
shallow_copy[key] = deepen(shallow_copy[key]) | |
t = deep_obj | |
parts = key.split('.') |