function stringlengths 11 56k | repo_name stringlengths 5 60 | features list |
|---|---|---|
def __init__(self, *failures):
self.failures = failures | bartosh/zipline | [
12,
5,
12,
2,
1474228866
] |
def subtest(iterator, *_names):
"""
Construct a subtest in a unittest.
Consider using ``zipline.testing.parameter_space`` when subtests
are constructed over a single input or over the cross-product of multiple
inputs.
``subtest`` works by decorating a function as a subtest. The decorated
f... | bartosh/zipline | [
12,
5,
12,
2,
1474228866
] |
def get_value(self, col, sid, dt):
return 100 | bartosh/zipline | [
12,
5,
12,
2,
1474228866
] |
def create_mock_adjustments(tempdir, days, splits=None, dividends=None,
mergers=None):
path = tempdir.getpath("test_adjustments.db")
SQLiteAdjustmentWriter(path, MockDailyBarReader(), days).write(
*create_mock_adjustment_data(splits, dividends, mergers)
)
return path | bartosh/zipline | [
12,
5,
12,
2,
1474228866
] |
def powerset(values):
"""
Return the power set (i.e., the set of all subsets) of entries in `values`.
"""
return concat(combinations(values, i) for i in range(len(values) + 1)) | bartosh/zipline | [
12,
5,
12,
2,
1474228866
] |
def gen_calendars(start, stop, critical_dates):
"""
Generate calendars to use as inputs.
"""
all_dates = pd.date_range(start, stop, tz='utc')
for to_drop in map(list, powerset(critical_dates)):
# Have to yield tuples.
yield (all_dates.drop(to_drop),)
# Also test with the trading... | bartosh/zipline | [
12,
5,
12,
2,
1474228866
] |
def temp_pipeline_engine(calendar, sids, random_seed, symbols=None):
"""
A contextManager that yields a SimplePipelineEngine holding a reference to
an AssetFinder generated via tmp_asset_finder.
Parameters
----------
calendar : pd.DatetimeIndex
Calendar to pass to the constructed Pipeli... | bartosh/zipline | [
12,
5,
12,
2,
1474228866
] |
def decorator(f):
argspec = getargspec(f)
if argspec.varargs:
raise AssertionError("parameter_space() doesn't support *args")
if argspec.keywords:
raise AssertionError("parameter_space() doesn't support **kwargs")
if argspec.defaults:
raise AssertionE... | bartosh/zipline | [
12,
5,
12,
2,
1474228866
] |
def create_empty_dividends_frame():
return pd.DataFrame(
np.array(
[],
dtype=[
('ex_date', 'datetime64[ns]'),
('pay_date', 'datetime64[ns]'),
('record_date', 'datetime64[ns]'),
('declared_date', 'datetime64[ns]'),
... | bartosh/zipline | [
12,
5,
12,
2,
1474228866
] |
def make_alternating_boolean_array(shape, first_value=True):
"""
Create a 2D numpy array with the given shape containing alternating values
of False, True, False, True,... along each row and each column.
Examples
--------
>>> make_alternating_boolean_array((4,4))
array([[ True, False, True... | bartosh/zipline | [
12,
5,
12,
2,
1474228866
] |
def permute_rows(seed, array):
"""
Shuffle each row in ``array`` based on permutations generated by ``seed``.
Parameters
----------
seed : int
Seed for numpy.RandomState
array : np.ndarray[ndim=2]
Array over which to apply permutations.
"""
rand = np.random.RandomState(s... | bartosh/zipline | [
12,
5,
12,
2,
1474228866
] |
def make_test_handler(testcase, *args, **kwargs):
"""
Returns a TestHandler which will be used by the given testcase. This
handler can be used to test log messages.
Parameters
----------
testcase: unittest.TestCase
The test class in which the log handler will be used.
*args, **kwarg... | bartosh/zipline | [
12,
5,
12,
2,
1474228866
] |
def read_compressed(path):
"""
Write a compressed (gzipped) file from `path`.
"""
with gzip.open(path, 'rb') as f:
return f.read() | bartosh/zipline | [
12,
5,
12,
2,
1474228866
] |
def test_resource_path(*path_parts):
return os.path.join(zipline_git_root, 'tests', 'resources', *path_parts) | bartosh/zipline | [
12,
5,
12,
2,
1474228866
] |
def patch_os_environment(remove=None, **values):
"""
Context manager for patching the operating system environment.
"""
old_values = {}
remove = remove or []
for key in remove:
old_values[key] = os.environ.pop(key)
for key, value in values.iteritems():
old_values[key] = os.ge... | bartosh/zipline | [
12,
5,
12,
2,
1474228866
] |
def _reader_cls(self):
raise NotImplementedError('_reader') | bartosh/zipline | [
12,
5,
12,
2,
1474228866
] |
def _write(self, env, days, path, data):
raise NotImplementedError('_write') | bartosh/zipline | [
12,
5,
12,
2,
1474228866
] |
def __enter__(self):
tmpdir = super(_TmpBarReader, self).__enter__()
env = self._env
try:
self._write(
env,
self._days,
tmpdir.path,
self._data,
)
return self._reader_cls(tmpdir.path)
exce... | bartosh/zipline | [
12,
5,
12,
2,
1474228866
] |
def _write(env, days, path, data):
BcolzDailyBarWriter(path, days).write(data) | bartosh/zipline | [
12,
5,
12,
2,
1474228866
] |
def patch_read_csv(url_map, module=pd, strict=False):
"""Patch pandas.read_csv to map lookups from url to another.
Parameters
----------
url_map : mapping[str or file-like object -> str or file-like object]
The mapping to use to redirect read_csv calls.
module : module, optional
The... | bartosh/zipline | [
12,
5,
12,
2,
1474228866
] |
def ensure_doctest(f, name=None):
"""Ensure that an object gets doctested. This is useful for instances
of objects like curry or partial which are not discovered by default.
Parameters
----------
f : any
The thing to doctest.
name : str, optional
The name to use in the doctest f... | bartosh/zipline | [
12,
5,
12,
2,
1474228866
] |
def __init__(self, data_frequency):
super(RecordBatchBlotter, self).__init__(data_frequency)
self.order_batch_called = [] | bartosh/zipline | [
12,
5,
12,
2,
1474228866
] |
def compute(self, today, assets, out):
out[:] = assets | bartosh/zipline | [
12,
5,
12,
2,
1474228866
] |
def compute(self, today, assets, out):
out[:] = assets + today.day | bartosh/zipline | [
12,
5,
12,
2,
1474228866
] |
def send(message, subject, to, to_name=None, sender=None, sender_name=None):
"""Send an email."""
sender = sender or app.config.get('MAIL_FROM')
sender_name = sender_name or app.config.get('MAIL_FROM_NAME') or ''
mail_provider = app.config.get('MAIL_PROVIDER')
if mail_provider is None:
app.l... | google/ctfscoreboard | [
159,
69,
159,
69,
1464885862
] |
def test_excluded_keys_results_preprocessor():
results = [{"a": 1, "b": 2}, {"a": 3, "b": 4}]
expected = [{"b": 2}, {"b": 4}]
preprocessor = ExcludedKeysResultsPreprocessor("a")
preprocessed_results = preprocessor.preprocess(results)
assert preprocessed_results == expected | ray-project/ray | [
24488,
4264,
24488,
2914,
1477424310
] |
def test_sequential_results_preprocessor():
results = [{"a": 1, "b": 2}, {"a": 3, "b": 4}, {"a": 5, "b": 6}, {"a": 7, "b": 8}]
expected = [{"b": 2}, {"b": 6}]
preprocessor_1 = ExcludedKeysResultsPreprocessor("a")
# [{"b": 2}, {"b": 4}, {"b": 6}, {"b": 8}]
preprocessor_2 = IndexedResultsPreprocessor... | ray-project/ray | [
24488,
4264,
24488,
2914,
1477424310
] |
def test_max_results_preprocessor():
from copy import deepcopy
import numpy as np
results = [{"a": 1, "b": 2}, {"a": 3, "b": 4}, {"a": 5, "b": 6}, {"a": 7, "b": 8}]
expected = deepcopy(results)
for res in expected:
res.update(
{
"max(a)": np.max([result["a"] for ... | ray-project/ray | [
24488,
4264,
24488,
2914,
1477424310
] |
def test_warning_in_aggregate_results_preprocessors(
caplog, results_preprocessor, expected_value | ray-project/ray | [
24488,
4264,
24488,
2914,
1477424310
] |
def test_warning_in_weighted_average_results_preprocessors(caplog):
import logging
from copy import deepcopy
caplog.at_level(logging.WARNING)
results1 = [{"a": 1}, {"a": 2}, {"a": 3}, {"a": 4}]
results2 = [{"b": 1}, {"b": 2}, {"b": 3}, {"b": 4}]
results3 = [
{"a": 1, "c": 3},
{... | ray-project/ray | [
24488,
4264,
24488,
2914,
1477424310
] |
def get_number_of_unique_samples(track):
sample_ids = set()
for mutation in track['mutations']:
sample_ids.add(mutation[SAMPLE_ID_FIELD_NAME])
return len(sample_ids) | isb-cgc/ISB-CGC-Webapp | [
12,
9,
12,
7,
1443114166
] |
def clean_track_mutations(mutations_array):
retval = []
for mutation in mutations_array:
cleaned = deepcopy(mutation)
cleaned[COORDINATE_FIELD_NAME] = int(mutation[COORDINATE_FIELD_NAME])
retval.append(cleaned)
return retval | isb-cgc/ISB-CGC-Webapp | [
12,
9,
12,
7,
1443114166
] |
def get_track_statistics_by_track_type(track, cohort_info_map):
track_id = track[TRACK_ID_FIELD]
result = {
'samples': {
'numberOf': get_number_of_unique_samples(track),
'mutated_positions': get_number_of_mutated_positions(track)
}
}
if track['type'] == 'tumor':... | isb-cgc/ISB-CGC-Webapp | [
12,
9,
12,
7,
1443114166
] |
def get_table_row_id(tumor_type):
return "seqpeek_row_{0}".format(tumor_type) | isb-cgc/ISB-CGC-Webapp | [
12,
9,
12,
7,
1443114166
] |
def build_summary_track(tracks):
all = []
for track in tracks:
all.extend(track["mutations"])
return {
'mutations': all,
'label': 'COMBINED',
'tumor': 'none-combined',
'type': 'summary'
} | isb-cgc/ISB-CGC-Webapp | [
12,
9,
12,
7,
1443114166
] |
def get_track_label(track, cohort_info_array):
# The IDs in cohort_info_array are integers, whereas the track IDs are strings.
cohort_map = {str(item['id']): item['name'] for item in cohort_info_array}
return cohort_map[track[TRACK_ID_FIELD]] | isb-cgc/ISB-CGC-Webapp | [
12,
9,
12,
7,
1443114166
] |
def __init__(self, cohort_info, data):
self.cohort_info = cohort_info
self.data = data | isb-cgc/ISB-CGC-Webapp | [
12,
9,
12,
7,
1443114166
] |
def from_dict(cls, param):
return cls(param['cohort_set'], param['items']) | isb-cgc/ISB-CGC-Webapp | [
12,
9,
12,
7,
1443114166
] |
def find_uniprot_id(mutations):
uniprot_id = None
for m in mutations:
if PROTEIN_ID_FIELD in m:
uniprot_id = m[PROTEIN_ID_FIELD]
break
return uniprot_id | isb-cgc/ISB-CGC-Webapp | [
12,
9,
12,
7,
1443114166
] |
def get_genes_tumors_lists_remote():
context = {
'symbol_list': [],
'track_id_list': []
}
return context | isb-cgc/ISB-CGC-Webapp | [
12,
9,
12,
7,
1443114166
] |
def get_track_id_list(param):
return list(map(str, param)) | isb-cgc/ISB-CGC-Webapp | [
12,
9,
12,
7,
1443114166
] |
def sample_delete_study():
# Create a client
client = aiplatform_v1.VizierServiceClient()
# Initialize request argument(s)
request = aiplatform_v1.DeleteStudyRequest(
name="name_value",
)
# Make the request
client.delete_study(request=request) | googleapis/python-aiplatform | [
306,
205,
306,
52,
1600875819
] |
def get(self, *args, **kwargs):
"""Lists all the alerts.
Args:
[0], the alert id (optional)
Example URLs:
GET /api/v1/alerts
GET /api/v1/alerts/52313ecb-9d00-4b7d-b873-b55d3d9ada26
"""
return self.service.alerts \
if not args e... | 5g-empower/empower-runtime | [
46,
47,
46,
3,
1441462064
] |
def post(self, *args, **kwargs):
"""Create a new alert.
Args:
[0], the alert id (optional)
Request:
version: protocol version (1.0)
alert: the alert
"""
alert_id = uuid.UUID(args[0]) if args else uuid.uuid4()
if 'alert' in kwargs:... | 5g-empower/empower-runtime | [
46,
47,
46,
3,
1441462064
] |
def fn(self):
n_shots = _abbrev_n_shots(n_shots=self.n_shots)
qubit = _abbrev_grid_qubit(self.qubit)
return (f'{self.dataset_id}/'
f'{self.device_name}/'
f'q-{qubit}/'
f'ry_scan_{self.resolution_factor}_{n_shots}') | quantumlib/ReCirq | [
232,
110,
232,
34,
1584057093
] |
def _abbrev_n_shots(n_shots: int) -> str:
"""Shorter n_shots component of a filename"""
if n_shots % 1000 == 0:
return f'{n_shots // 1000}k'
return str(n_shots) | quantumlib/ReCirq | [
232,
110,
232,
34,
1584057093
] |
def run_readout_scan(task: ReadoutScanTask,
base_dir=None):
"""Execute a :py:class:`ReadoutScanTask` task."""
if base_dir is None:
base_dir = DEFAULT_BASE_DIR | quantumlib/ReCirq | [
232,
110,
232,
34,
1584057093
] |
def __init__(self, db):
self.db = db
self.cache = {} | sassoftware/conary | [
47,
9,
47,
4,
1396904066
] |
def __init__(self, *args, **keywords):
self.extraFilters = []
policy.Policy.__init__(self, *args, **keywords) | sassoftware/conary | [
47,
9,
47,
4,
1396904066
] |
def updateArgs(self, *args, **keywords):
"""
Call as::
C{I{ClassName}(I{info}, I{filterexp})}
or::
C{I{ClassName}(I{info}, exceptions=I{filterexp})}
where C{I{filterexp}} is either a regular expression or a
tuple of C{(regexp[, setmodes[, unsetmodes]])}
... | sassoftware/conary | [
47,
9,
47,
4,
1396904066
] |
def doFile(self, path):
fullpath = self.recipe.macros.destdir+path
if not util.isregular(fullpath) and not os.path.islink(fullpath):
return
self.runInfo(path) | sassoftware/conary | [
47,
9,
47,
4,
1396904066
] |
def doFile(self, filename):
m = self.recipe.magic[filename]
if m and m.name == "ELF":
# an ELF file cannot be a config file, some programs put
# ELF files under /etc (X, for example), and tag handlers
# can be ELF or shell scripts; we just want tag handlers
... | sassoftware/conary | [
47,
9,
47,
4,
1396904066
] |
def _addTrailingNewline(self, filename, fullpath):
# FIXME: This exists only for stability; there is no longer
# any need to add trailing newlines to config files. This
# also violates the rule that no files are modified after
# destdir modification has been completed.
self.warn... | sassoftware/conary | [
47,
9,
47,
4,
1396904066
] |
def __init__(self, *args, **keywords):
"""
@keyword catchall: The component name which gets all otherwise
unassigned files. Default: C{runtime}
"""
_filterSpec.__init__(self, *args, **keywords)
self.configFilters = []
self.derivedFilters = [] | sassoftware/conary | [
47,
9,
47,
4,
1396904066
] |
def doProcess(self, recipe):
compFilters = []
self.macros = recipe.macros
self.rootdir = self.rootdir % recipe.macros
self.loadFilterDirs()
# The extras need to come before base in order to override decisions
# in the base subfilters; invariants come first for those ver... | sassoftware/conary | [
47,
9,
47,
4,
1396904066
] |
def warnMissing(missing):
self.error('%s depends on missing %s', filterName, missing) | sassoftware/conary | [
47,
9,
47,
4,
1396904066
] |
def loadFilter(self, filterType, map, filename, fullpath):
# do not load shared libraries
desc = [x for x in imp.get_suffixes() if x[0] == '.py'][0]
f = file(fullpath)
modname = filename[:-3]
m = imp.load_module(modname, f, fullpath, desc)
f.close()
if not 'filte... | sassoftware/conary | [
47,
9,
47,
4,
1396904066
] |
def __init__(self, *args, **keywords):
"""
@keyword compFilters: reserved for C{ComponentSpec} to pass information
needed by C{PackageSpec}.
"""
_filterSpec.__init__(self, *args, **keywords)
self.configFiles = []
self.derivedFilters = [] | sassoftware/conary | [
47,
9,
47,
4,
1396904066
] |
def preProcess(self):
self.pkgFilters = []
recipe = self.recipe
self.destdir = recipe.macros.destdir
if self.exceptions:
self.warn('PackageSpec does not honor exceptions')
self.exceptions = None
if self.inclusions:
# would have an effect only w... | sassoftware/conary | [
47,
9,
47,
4,
1396904066
] |
def doFile(self, path):
# all policy classes after this require that the initial tree is built
if not self.recipe._getCapsulePathsForFile(path):
realPath = self.destdir + path
self.autopkg.addFile(path, realPath) | sassoftware/conary | [
47,
9,
47,
4,
1396904066
] |
def postInit(self, *args, **kwargs):
self.recipe.Config(exceptions = self.invariantinclusions,
allowUnusedFilters = True) | sassoftware/conary | [
47,
9,
47,
4,
1396904066
] |
def doFile(self, filename):
fullpath = self.macros.destdir + filename
recipe = self.recipe
if os.path.isfile(fullpath) and util.isregular(fullpath):
self.info(filename)
f = recipe.autopkg.pathMap[filename]
f.flags.isInitialContents(True)
if f.flags... | sassoftware/conary | [
47,
9,
47,
4,
1396904066
] |
def doFile(self, filename):
fullpath = self.macros.destdir + filename
if os.path.isfile(fullpath) and util.isregular(fullpath):
recipe = self.recipe
f = recipe.autopkg.pathMap[filename]
f.flags.isTransient(True)
if f.flags.isConfig() or f.flags.isInitialCo... | sassoftware/conary | [
47,
9,
47,
4,
1396904066
] |
def doFile(self, path):
if self.recipe._getCapsulePathsForFile(path):
return
fullpath = self.macros.destdir + path
if os.path.isfile(fullpath) and util.isregular(fullpath):
self.info('conary tag file: %s', path)
self.recipe.autopkg.pathMap[path].tags.set("tagd... | sassoftware/conary | [
47,
9,
47,
4,
1396904066
] |
def doFile(self, path):
if self.recipe._getCapsulePathsForFile(path):
return
fullpath = self.macros.destdir + path
if os.path.isfile(fullpath) and util.isregular(fullpath):
self.info('conary tag handler: %s', path)
self.recipe.autopkg.pathMap[path].tags.set("t... | sassoftware/conary | [
47,
9,
47,
4,
1396904066
] |
def doProcess(self, recipe):
self.tagList = []
self.buildReqsComputedForTags = set()
self.suggestBuildRequires = set()
# read the system and %(destdir)s tag databases
for directory in (recipe.macros.destdir+'/etc/conary/tags/',
'/etc/conary/tags/'):
... | sassoftware/conary | [
47,
9,
47,
4,
1396904066
] |
def runInfo(self, path):
if self.recipe._getCapsulePathsForFile(path):
# capsules do not participate in the tag protocol
return
excludedTags = {}
for tag in self.included:
for filt in self.included[tag]:
if filt.match(path):
... | sassoftware/conary | [
47,
9,
47,
4,
1396904066
] |
def __init__(self, *args, **kwargs):
policy.Policy.__init__(self, *args, **kwargs)
self.ipropFilters = []
self.ipropPaths = [ r'%(prefix)s/lib/iconfig/properties/.*\.iprop' ]
self.contents = []
self.paths = []
self.fileFilters = []
self.propMap = {} | sassoftware/conary | [
47,
9,
47,
4,
1396904066
] |
def doProcess(self, recipe):
for filterSpec, iprop in self.paths:
self.fileFilters.append((
filter.Filter(filterSpec, recipe.macros),
iprop,
))
for ipropPath in self.ipropPaths:
self.ipropFilters.append(
filter.Filter(ip... | sassoftware/conary | [
47,
9,
47,
4,
1396904066
] |
def doFile(self, path):
if path not in self.recipe.autopkg.pathMap:
return
for fltr, iprop in self.fileFilters:
if fltr.match(path):
main, comp = self._getComponent(path)
self._parsePropertyData(iprop, main, comp)
# Make sure any remainin... | sassoftware/conary | [
47,
9,
47,
4,
1396904066
] |
def _parsePropertyData(self, xml, pkgName, compName):
pkgSet = self.propMap.setdefault(xml, set())
if (pkgName, compName) in pkgSet:
return
pkgSet.add((pkgName, compName))
self.recipe._addProperty(trove._PROPERTY_TYPE_SMARTFORM, pkgName,
compName, xml) | sassoftware/conary | [
47,
9,
47,
4,
1396904066
] |
def __init__(self, *args, **keywords):
self.devices = []
policy.Policy.__init__(self, *args, **keywords) | sassoftware/conary | [
47,
9,
47,
4,
1396904066
] |
def do(self):
for device, kwargs in self.devices:
r = self.recipe
filename = device[0]
owner = device[4]
group = device[5]
r.Ownership(owner, group, filename)
device[0] = device[0] % r.macros
r.autopkg.addDevice(*device, **kwarg... | sassoftware/conary | [
47,
9,
47,
4,
1396904066
] |
def __init__(self, *args, **keywords):
self.sidbits = {}
self.userbits = {}
policy.Policy.__init__(self, *args, **keywords) | sassoftware/conary | [
47,
9,
47,
4,
1396904066
] |
def doFile(self, path):
# Don't set modes on capsule files
if self.recipe._getCapsulePathsForFile(path):
return
# Skip files that aren't part of the package
if path not in self.recipe.autopkg.pathMap:
return
newmode = oldmode = self.recipe.autopkg.pathMap[... | sassoftware/conary | [
47,
9,
47,
4,
1396904066
] |
def do(self):
for component in self.recipe.autopkg.getComponents():
for path in sorted(component.hardlinkMap.keys()):
if self.recipe.autopkg.pathMap[path].flags.isConfig():
self.error("Config file %s has illegal hard links", path)
for path in component... | sassoftware/conary | [
47,
9,
47,
4,
1396904066
] |
def __init__(self, *args, **keywords):
policy.Policy.__init__(self, *args, **keywords)
self.excepts = set() | sassoftware/conary | [
47,
9,
47,
4,
1396904066
] |
def do(self):
if self.recipe.getType() == recipe.RECIPE_TYPE_CAPSULE:
return
filters = [(x, filter.Filter(x, self.macros)) for x in self.excepts]
for component in self.recipe.autopkg.getComponents():
for inode in component.linkGroups:
# ensure all in same ... | sassoftware/conary | [
47,
9,
47,
4,
1396904066
] |
def doFile(self, path):
# temporarily do nothing for capsules, we might do something later
if self.recipe._getCapsulePathsForFile(path):
return
fullpath = self.recipe.macros.destdir + os.sep + path
s = os.lstat(fullpath)
mode = s[stat.ST_MODE]
if mode & 0777 ... | sassoftware/conary | [
47,
9,
47,
4,
1396904066
] |
def doProcess(self, recipe):
if not self.inclusions:
self.inclusions = []
if not self.exceptions:
self.exceptions = []
recipe.setByDefaultOn(frozenset(self.inclusions))
recipe.setByDefaultOff(frozenset(self.exceptions +
sel... | sassoftware/conary | [
47,
9,
47,
4,
1396904066
] |
def setUserGroupDep(self, path, info, depClass):
componentMap = self.recipe.autopkg.componentMap
if path not in componentMap:
return
pkg = componentMap[path]
f = pkg.getFile(path)
if path not in pkg.requiresMap:
pkg.requiresMap[path] = deps.DependencySet()... | sassoftware/conary | [
47,
9,
47,
4,
1396904066
] |
def __init__(self, *args, **keywords):
self.filespecs = []
self.systemusers = ('root',)
self.systemgroups = ('root',)
policy.Policy.__init__(self, *args, **keywords) | sassoftware/conary | [
47,
9,
47,
4,
1396904066
] |
def doProcess(self, recipe):
# we must NEVER take ownership from the filesystem
assert(not self.exceptions)
self.rootdir = self.rootdir % recipe.macros
self.fileFilters = []
for (filespec, user, group) in self.filespecs:
self.fileFilters.append(
(filte... | sassoftware/conary | [
47,
9,
47,
4,
1396904066
] |
def __init__(self, *args, **keywords):
self.filespecs = []
policy.Policy.__init__(self, *args, **keywords) | sassoftware/conary | [
47,
9,
47,
4,
1396904066
] |
def doProcess(self, recipe):
self.rootdir = self.rootdir % recipe.macros
self.fileFilters = []
for (filespec, item) in self.filespecs:
self.fileFilters.append(
(filter.Filter(filespec, recipe.macros), item))
del self.filespecs
policy.Policy.doProcess(s... | sassoftware/conary | [
47,
9,
47,
4,
1396904066
] |
def _markItem(self, path, item):
# pure virtual
assert(False) | sassoftware/conary | [
47,
9,
47,
4,
1396904066
] |
def _markItem(self, path, user):
if not self.recipe._getCapsulePathsForFile(path):
self.info('user %s: %s' % (user, path))
self.setUserGroupDep(path, user, deps.UserInfoDependencies) | sassoftware/conary | [
47,
9,
47,
4,
1396904066
] |
def _markItem(self, path, group):
if not self.recipe._getCapsulePathsForFile(path):
self.info('group %s: %s' % (group, path))
self.setUserGroupDep(path, group, deps.GroupInfoDependencies) | sassoftware/conary | [
47,
9,
47,
4,
1396904066
] |
def __init__(self, *args, **keywords):
self.depMap = {
# component: components that require it if they both exist
'data': frozenset(('lib', 'runtime', 'devellib', 'cil', 'java',
'perl', 'python', 'ruby')),
'devellib': frozenset(('devel',)),
'lib': ... | sassoftware/conary | [
47,
9,
47,
4,
1396904066
] |
def do(self):
flags = []
if self.recipe.isCrossCompileTool():
flags.append((_getTargetDepFlag(self.macros), deps.FLAG_SENSE_REQUIRED))
components = self.recipe.autopkg.components
for packageName in [x.name for x in self.recipe.autopkg.packageMap]:
if packageName i... | sassoftware/conary | [
47,
9,
47,
4,
1396904066
] |
def __init__(self, *args, **keywords):
self.flags = set()
self.excepts = set()
policy.Policy.__init__(self, *args, **keywords) | sassoftware/conary | [
47,
9,
47,
4,
1396904066
] |
def do(self):
self.excepts = set(re.compile(x) for x in self.excepts)
self.flags = set(x for x in self.flags
if not [y.match(x) for y in self.excepts])
if self.flags:
flags = [ (x % self.macros, deps.FLAG_SENSE_REQUIRED)
for x in self.f... | sassoftware/conary | [
47,
9,
47,
4,
1396904066
] |
def __init__(self, *args, **kwargs):
# bootstrap keeping only one copy of these around
self.bootstrapPythonFlags = None
self.bootstrapSysPath = []
self.bootstrapPerlIncPath = []
self.bootstrapRubyLibs = []
self.cachedProviders = {}
self.pythonFlagNamespace = None
... | sassoftware/conary | [
47,
9,
47,
4,
1396904066
] |
def preProcess(self):
self.CILPolicyRE = re.compile(r'.*mono/.*/policy.*/policy.*\.config$')
self.legalCharsRE = re.compile('[.0-9A-Za-z_+-/]')
self.pythonInterpRE = re.compile(r'\.[a-z]+-\d\dm?')
# interpolate macros, using canonical path form with no trailing /
self.sonameSubt... | sassoftware/conary | [
47,
9,
47,
4,
1396904066
] |
def _isELF(self, m, contents=None):
"Test whether is ELF file and optionally has certain contents"
# Note: for provides, check for 'abi' not 'provides' because we
# can provide the filename even if there is no provides list
# as long as a DT_NEEDED entry has been present to set the abi
... | sassoftware/conary | [
47,
9,
47,
4,
1396904066
] |
def _isPythonModuleCandidate(self, path):
return path.endswith('.so') or self._isPython(path) | sassoftware/conary | [
47,
9,
47,
4,
1396904066
] |
def _getPythonVersion(self, pythonPath, destdir, libdir):
if pythonPath not in self.pythonVersionCache:
try:
stdout = self._runPythonScript(pythonPath, destdir, libdir,
["import sys", "print('%d.%d' % sys.version_info[:2])"])
self.pythonVersion... | sassoftware/conary | [
47,
9,
47,
4,
1396904066
] |
def _warnPythonPathNotInDB(self, pathName):
self.warn('%s found on system but not provided by'
' system database; python requirements'
' may be generated incorrectly as a result', pathName)
return set([]) | sassoftware/conary | [
47,
9,
47,
4,
1396904066
] |
def _getPythonFlags(self, pathName, bootstrapPythonFlags=None):
if pathName in self.pythonFlagCache:
return self.pythonFlagCache[pathName]
if bootstrapPythonFlags:
self.pythonFlagCache[pathName] = bootstrapPythonFlags
return self.pythonFlagCache[pathName]
db... | sassoftware/conary | [
47,
9,
47,
4,
1396904066
] |
def _stringIsPythonVersion(self, s):
return not set(s).difference(set('.0123456789')) | sassoftware/conary | [
47,
9,
47,
4,
1396904066
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.