function
stringlengths
11
56k
repo_name
stringlengths
5
60
features
list
def _namedtuple(cls): return namedtuple( ''.join((str.capitalize(cls.label), "Rev")), (f[0] for f in cls.fields))
westurner/pkgsetcomp
[ 1, 1, 1, 1, 1400665453 ]
def status(self): """ :returns: str """ pass
westurner/pkgsetcomp
[ 1, 1, 1, 1, 1400665453 ]
def diff(self): """ :returns: str """ pass
westurner/pkgsetcomp
[ 1, 1, 1, 1, 1400665453 ]
def branch(self): """ :returns: str """ pass
westurner/pkgsetcomp
[ 1, 1, 1, 1, 1400665453 ]
def last_commit(self): return self.log_iter(maxentries=1).next()
westurner/pkgsetcomp
[ 1, 1, 1, 1, 1400665453 ]
def itersplit_to_fields(self, _str): if self.preparse: _str = self.preparse(_str) _fields = itersplit(_str, self.fsep) try: values = ( t[1] for t in izip_longest(self._tuple._fields, _fields)) return self._tuple(*values) except: ...
westurner/pkgsetcomp
[ 1, 1, 1, 1, 1400665453 ]
def log_iter(self, maxentries=None, template=None, **kwargs): # op = self.sh(( # "hg log %s --template" # % (maxentries and ('-l%d' % maxentries) or '')), # ignore_error=True # ) template = repr(template or self.template) op = self.log(n=maxentries, template...
westurner/pkgsetcomp
[ 1, 1, 1, 1, 1400665453 ]
def full_report(self): yield '' yield "# %s" % self.origin_report().next() yield "%s [%s]" % (self.last_commit, self) if self.status: for l in self.status.split('\n'): yield l yield '' if hasattr(self, 'log_iter'): for r in sel...
westurner/pkgsetcomp
[ 1, 1, 1, 1, 1400665453 ]
def eggname(self): return os.path.basename(self.fpath)
westurner/pkgsetcomp
[ 1, 1, 1, 1, 1400665453 ]
def to_normal_url(cls, url): return url
westurner/pkgsetcomp
[ 1, 1, 1, 1, 1400665453 ]
def sh_report(self): output = [] if not self.remote_url: output.append('#') output.extend([ self.label, self.clone_cmd, repr(self.remote_url), # TODO: shell quote? repr(self.relpath) ]) yield ' '.join(output)
westurner/pkgsetcomp
[ 1, 1, 1, 1, 1400665453 ]
def origin_report(self): yield "%s://%s = %s" % ( self.label, self.fpath, self.remote_url, # revid ) return
westurner/pkgsetcomp
[ 1, 1, 1, 1, 1400665453 ]
def hgsub_report(self): if self.relpath == '.': return yield "%s = [%s]%s" % ( self.fpath.lstrip('./'), self.label, self.remote_url)
westurner/pkgsetcomp
[ 1, 1, 1, 1, 1400665453 ]
def __unicode__(self): return '%s://%s' % (self.label, self.fpath)
westurner/pkgsetcomp
[ 1, 1, 1, 1, 1400665453 ]
def mtime(self, fpath=None): return dtformat( datetime.datetime.utcfromtimestamp( os.path.getmtime(fpath or self.fpath)))
westurner/pkgsetcomp
[ 1, 1, 1, 1, 1400665453 ]
def ctime(self, fpath=None): return dtformat( datetime.datetime.utcfromtimestamp( os.path.getctime(fpath or self.fpath)))
westurner/pkgsetcomp
[ 1, 1, 1, 1, 1400665453 ]
def find_symlinks(self): cmd = ("find . -type l -printf '%p -> %l\n'") return self.sh(cmd)
westurner/pkgsetcomp
[ 1, 1, 1, 1, 1400665453 ]
def sh(self, cmd, ignore_error=False, cwd=None, *args, **kwargs): kwargs.update({ 'shell': True, 'cwd': cwd or self.fpath, 'stderr': subprocess.STDOUT, 'stdout': subprocess.PIPE}) log.debug('cmd: %s %s' % (cmd, kwargs)) return sh(cmd, ignore_error=...
westurner/pkgsetcomp
[ 1, 1, 1, 1, 1400665453 ]
def unique_id(self): return self.fpath # self.sh('hg id -r 0').rstrip()
westurner/pkgsetcomp
[ 1, 1, 1, 1, 1400665453 ]
def status(self): return self.sh('hg status').rstrip()
westurner/pkgsetcomp
[ 1, 1, 1, 1, 1400665453 ]
def remote_url(self): return self.sh('hg showconfig paths.default', ignore_error=True).strip()
westurner/pkgsetcomp
[ 1, 1, 1, 1, 1400665453 ]
def remote_urls(self): return self.sh('hg showconfig paths')
westurner/pkgsetcomp
[ 1, 1, 1, 1, 1400665453 ]
def diff(self): return self.sh('hg diff -g')
westurner/pkgsetcomp
[ 1, 1, 1, 1, 1400665453 ]
def current_id(self): return self.sh('hg id -i').rstrip().rstrip('+') # TODO
westurner/pkgsetcomp
[ 1, 1, 1, 1, 1400665453 ]
def branch(self): return self.sh('hg branch')
westurner/pkgsetcomp
[ 1, 1, 1, 1, 1400665453 ]
def loggraph(self): return self.sh('hg log --graph')
westurner/pkgsetcomp
[ 1, 1, 1, 1, 1400665453 ]
def serve(self): return self.sh('hg serve')
westurner/pkgsetcomp
[ 1, 1, 1, 1, 1400665453 ]
def _get_url_scheme_regexes(): output = sh("hg showconfig | grep '^schemes.'").split('\n') log.debug(output) schemes = ( l.split('.', 1)[1].split('=') for l in output if '=' in l) regexes = sorted( ((k, v, re.compile(v.replace('{1}', '(.*)')+'(.*)')) ...
westurner/pkgsetcomp
[ 1, 1, 1, 1, 1400665453 ]
def to_hg_scheme_url(cls, url): """ convert a URL to local mercurial URL schemes example:: # schemes.gh = git://github.com/ >> remote_url = git://github.com/westurner/dotfiles' >> to_hg_scheme_url(remote_url) << gh://westurner/dotfiles "...
westurner/pkgsetcomp
[ 1, 1, 1, 1, 1400665453 ]
def to_normal_url(cls, url): """ convert a URL from local mercurial URL schemes to "normal" URLS example:: # schemes.gh = git://github.com/ # remote_url = "gh://westurner/dotfiles" >> to_normal_url(remote_url) << 'git://github.com/westurner/dotfi...
westurner/pkgsetcomp
[ 1, 1, 1, 1, 1400665453 ]
def unique_id(self): return self.fpath
westurner/pkgsetcomp
[ 1, 1, 1, 1, 1400665453 ]
def status(self): return self.sh('git status -s')
westurner/pkgsetcomp
[ 1, 1, 1, 1, 1400665453 ]
def remote_url(self): return self.sh('git config remote.origin.url', ignore_error=True).strip() # .split('=',1)[1]# *
westurner/pkgsetcomp
[ 1, 1, 1, 1, 1400665453 ]
def remote_urls(self): return self.sh('git config -l | grep "url"', ignore_error=True).strip() # .split('=',1)[1]# *
westurner/pkgsetcomp
[ 1, 1, 1, 1, 1400665453 ]
def current_id(self): return self.sh('git rev-parse --short HEAD').rstrip()
westurner/pkgsetcomp
[ 1, 1, 1, 1, 1400665453 ]
def branch(self): return self.sh('git branch')
westurner/pkgsetcomp
[ 1, 1, 1, 1, 1400665453 ]
def loggraph(self): return self.sh('git log --graph')
westurner/pkgsetcomp
[ 1, 1, 1, 1, 1400665453 ]
def last_commit(self): return self.log_iter(maxentries=1).next()
westurner/pkgsetcomp
[ 1, 1, 1, 1, 1400665453 ]
def unpushed(self): return self.sh("git log master --not --remotes='*/master'")
westurner/pkgsetcomp
[ 1, 1, 1, 1, 1400665453 ]
def unique_id(self): return self.fpath
westurner/pkgsetcomp
[ 1, 1, 1, 1, 1400665453 ]
def status(self): return self.sh('bzr status')
westurner/pkgsetcomp
[ 1, 1, 1, 1, 1400665453 ]
def remote_url(self): return self.sh( """bzr info | egrep '^ parent branch:' | awk '{ print $3 }'""", ignore_error=True)
westurner/pkgsetcomp
[ 1, 1, 1, 1, 1400665453 ]
def current_id(self): return self.sh("bzr version-info --custom --template='{revision_id}'")
westurner/pkgsetcomp
[ 1, 1, 1, 1, 1400665453 ]
def branch(self): return self.sh('bzr nick')
westurner/pkgsetcomp
[ 1, 1, 1, 1, 1400665453 ]
def _logmessage_transform(cls, s, by=2): if len(s) >= by: return s[by:].strip('\n') return s.strip('\n')
westurner/pkgsetcomp
[ 1, 1, 1, 1, 1400665453 ]
def _parselog(self, r): """ Parse bazaar log file format :: $ bzr log -l1 ------------------------------------------------------------ revno: 1 committer: ubuntu <ubuntu@ubuntu-desktop> branch nick: ubuntu-desktop /etc repository ...
westurner/pkgsetcomp
[ 1, 1, 1, 1, 1400665453 ]
def unique_id(self): cmdo = self.sh('svn info | grep "^Repository UUID"', ignore_error=True) if cmdo: return cmdo.split(': ', 1)[1].rstrip() return None
westurner/pkgsetcomp
[ 1, 1, 1, 1, 1400665453 ]
def status(self): return self.sh('svn status')
westurner/pkgsetcomp
[ 1, 1, 1, 1, 1400665453 ]
def remote_url(self): return ( self.sh('svn info | grep "^Repository Root:"') .split(': ', 1)[1]).strip()
westurner/pkgsetcomp
[ 1, 1, 1, 1, 1400665453 ]
def current_id(self): # from xml.etree import ElementTree as ET # info = ET.fromstringlist(self.sh('svn info --xml')) # return info.find('entry').get('revision') return ( self.sh('svn info | grep "^Revision: "') .split(': ', 1)[1].strip())
westurner/pkgsetcomp
[ 1, 1, 1, 1, 1400665453 ]
def _last_commit(self): """ ::
westurner/pkgsetcomp
[ 1, 1, 1, 1, 1400665453 ]
def __last_commit(self): """ $ svn info Path: . URL: http://python-dlp.googlecode.com/svn/trunk/layercake-python Repository Root: http://python-dlp.googlecode.com/svn Repository UUID: d0ad5f6e-b329-0410-b51c-492c9c4f233d Revision: 378 Node Kind: directory...
westurner/pkgsetcomp
[ 1, 1, 1, 1, 1400665453 ]
def last_commit(self): return self.log_iter().next()
westurner/pkgsetcomp
[ 1, 1, 1, 1, 1400665453 ]
def search_upwards(self, fpath=None, repodirname='.svn', upwards={}): """ Traverse filesystem upwards, searching for .svn directories with matching UUIDs repo/.svn repo/dir1/.svn repo/dir1/dir2/.svn >> search_upwards('repo/') << 'repo/' >> search...
westurner/pkgsetcomp
[ 1, 1, 1, 1, 1400665453 ]
def listdir_find_repos(where): stack = deque([(convert_path(where), '')]) while stack: where, prefix = stack.pop() try: for name in sorted(os.listdir(where), reverse=True): fn = os.path.join(where, name) if os.path.isdir(fn): if nam...
westurner/pkgsetcomp
[ 1, 1, 1, 1, 1400665453 ]
def find_unique_repos(where): repos = Dict() path_uuids = Dict() log.debug("find_unique_repos(%r)" % where) for repo in find_find_repos(where): # log.debug(repo) repo2 = (hasattr(repo, 'search_upwards') and repo.search_upwards(upwards=path_uuids)) if repo2: ...
westurner/pkgsetcomp
[ 1, 1, 1, 1, 1400665453 ]
def do_repo_report(repos, report='full', output=sys.stdout, *args, **kwargs): for i, repo in enumerate(repos): log.debug(str((i, repo.origin_report().next()))) try: if repo is not None: reportfunc = REPORT_TYPES.get(report) if reportfunc is None: ...
westurner/pkgsetcomp
[ 1, 1, 1, 1, 1400665453 ]
def fullname_to_shortname(fullname): shortname = fullname.replace(os.environ['HOME'], '~') shortname = shortname.lstrip('./') return shortname
westurner/pkgsetcomp
[ 1, 1, 1, 1, 1400665453 ]
def main(): """ mainfunc """ import optparse import logging prs = optparse.OptionParser(usage="./") prs.add_option('-s', '--scan', dest='scan', action='append', default=[], help='Path(s) to scan for repositories')...
westurner/pkgsetcomp
[ 1, 1, 1, 1, 1400665453 ]
def __init__( self, resource_type: str, resource_names: List[str], producer: Callable, dependencies: List[str],
ihmeuw/vivarium
[ 40, 10, 40, 6, 1499718083 ]
def type(self) -> str: """The type of resource produced by this resource group's producer. Must be one of `RESOURCE_TYPES`. """ return self._resource_type
ihmeuw/vivarium
[ 40, 10, 40, 6, 1499718083 ]
def names(self) -> List[str]: """The long names (including type) of all resources in this group.""" return [f"{self._resource_type}.{name}" for name in self._resource_names]
ihmeuw/vivarium
[ 40, 10, 40, 6, 1499718083 ]
def producer(self) -> Any: """The method or object that produces this group of resources.""" return self._producer
ihmeuw/vivarium
[ 40, 10, 40, 6, 1499718083 ]
def dependencies(self) -> List[str]: """The long names (including type) of dependencies for this group.""" return self._dependencies
ihmeuw/vivarium
[ 40, 10, 40, 6, 1499718083 ]
def __repr__(self) -> str: resources = ", ".join(self) return f"ResourceProducer({resources})"
ihmeuw/vivarium
[ 40, 10, 40, 6, 1499718083 ]
def __init__(self): # This will be a dict with string keys representing the the resource # and the resource group they belong to. This is a one to many mapping # as some resource groups contain many resources. self._resource_group_map = {} # null producers are those that don't pr...
ihmeuw/vivarium
[ 40, 10, 40, 6, 1499718083 ]
def name(self) -> str: """The name of this manager.""" return "resource_manager"
ihmeuw/vivarium
[ 40, 10, 40, 6, 1499718083 ]
def graph(self) -> nx.DiGraph: """The networkx graph representation of the resource pool.""" if self._graph is None: self._graph = self._to_graph() return self._graph
ihmeuw/vivarium
[ 40, 10, 40, 6, 1499718083 ]
def sorted_nodes(self): """Returns a topological sort of the resource graph. Notes ----- Topological sorts are not stable. Be wary of depending on order where you shouldn't. """ if self._sorted_nodes is None: try: self._sorted_nodes =...
ihmeuw/vivarium
[ 40, 10, 40, 6, 1499718083 ]
def _get_resource_group( self, resource_type: str, resource_names: List[str], producer: MethodType, dependencies: List[str],
ihmeuw/vivarium
[ 40, 10, 40, 6, 1499718083 ]
def _to_graph(self) -> nx.DiGraph: """Constructs the full resource graph from information in the groups. Components specify local dependency information during setup time. When the resources are required at population creation time, the graph is generated as all resources must be regist...
ihmeuw/vivarium
[ 40, 10, 40, 6, 1499718083 ]
def __repr__(self): out = {} for resource_group in set(self._resource_group_map.values()): produced = ", ".join(resource_group) out[produced] = ", ".join(resource_group.dependencies) return "\n".join([f"{produced} : {depends}" for produced, depends in out.items()])
ihmeuw/vivarium
[ 40, 10, 40, 6, 1499718083 ]
def __init__(self, manager: ResourceManager): self._manager = manager
ihmeuw/vivarium
[ 40, 10, 40, 6, 1499718083 ]
def to_caffe(tfW, name=None, shape=None, color_layer='', conv_fc_transitionals=None, info=DummyDict()): assert conv_fc_transitionals is None or name is not None if tfW.ndim == 4: if (name == 'conv1_1' or name == 'conv1' or name == color_layer) and tfW.shape[2] == 3: tfW = tfW[:, :, ::-1] ...
gustavla/self-supervision
[ 29, 5, 29, 7, 1492017767 ]
def load_caffemodel(path, session, prefix='', ignore=set(), conv_fc_transitionals=None, renamed_layers=DummyDict(), color_layer='', verbose=False, pre_adjust_batch_norm=False): import tensorflow as tf def find_weights(name, which='weights'): for tw in tf.trainable...
gustavla/self-supervision
[ 29, 5, 29, 7, 1492017767 ]
def find_weights(name, which='weights'): for tw in tf.trainable_variables(): if lax_naming: ok = tw.name.split(':')[0].endswith(name + '/' + which) else: ok = tw.name.split(':')[0] == name + '/' + which if ok: return tw ...
gustavla/self-supervision
[ 29, 5, 29, 7, 1492017767 ]
def setUp(self): self.report = frappe.get_doc({ "doctype": "Report", "name": "Permitted Documents For User" }) self.filters = { "user": "Administrator", "doctype": "Role" } self.prepared_report_doc = frappe.get_doc({ "doctype": "Prepared Report", "report_name": self.report.name, "filters"...
frappe/frappe
[ 4495, 2418, 4495, 1493, 1307520856 ]
def data_path(*args): """ Returns a path to dev data """ return os.path.join(DEV_DATA_PATH, *args)
kmike/DAWG-Python
[ 49, 12, 49, 4, 1348177105 ]
def __init__(self): super().__init__() self.setup_clean_chain = True self.num_nodes = 1 self.extra_args = [bitcoind_electrum_args()]
BitcoinUnlimited/BitcoinUnlimited
[ 451, 230, 451, 63, 1397077380 ]
def setup_network(self, dummy = None): self.nodes = self.setup_nodes()
BitcoinUnlimited/BitcoinUnlimited
[ 451, 230, 451, 63, 1397077380 ]
def Wait(): x64dbg.Wait()
x64dbg/x64dbgpy
[ 1423, 71, 1423, 28, 1436823637 ]
def Stop(): x64dbg.Stop()
x64dbg/x64dbgpy
[ 1423, 71, 1423, 28, 1436823637 ]
def StepOver(): x64dbg.StepOver()
x64dbg/x64dbgpy
[ 1423, 71, 1423, 28, 1436823637 ]
def SetBreakpoint(address): return x64dbg.SetBreakpoint(address)
x64dbg/x64dbgpy
[ 1423, 71, 1423, 28, 1436823637 ]
def SetHardwareBreakpoint(address, type = HardwareType.HardwareExecute): return x64dbg.SetHardwareBreakpoint(address, type)
x64dbg/x64dbgpy
[ 1423, 71, 1423, 28, 1436823637 ]
def test_effects_layer_empty_wr(kls): check_write_read(kls())
kmike/psd-tools
[ 888, 176, 888, 46, 1350188801 ]
def __init__(self): super().__init__() self.block_receive_map = defaultdict(int)
nlgcoin/guldencoin-official
[ 136, 50, 136, 34, 1439462804 ]
def on_block(self, message): message.block.calc_sha256() self.block_receive_map[message.block.sha256] += 1
nlgcoin/guldencoin-official
[ 136, 50, 136, 34, 1439462804 ]
def set_test_params(self): self.setup_clean_chain = True self.num_nodes = 1 self.extra_args = [["-maxuploadtarget=800"]] # Cache for utxos, as the listunspent may take a long time later in the test self.utxo_cache = []
nlgcoin/guldencoin-official
[ 136, 50, 136, 34, 1439462804 ]
def run_test(self): # Before we connect anything, we first set the time on the node # to be in the past, otherwise things break because the CNode # time counters can't be reset backward after initialization old_time = int(time.time() - 2*60*60*24*7) self.nodes[0].setmocktime(old_...
nlgcoin/guldencoin-official
[ 136, 50, 136, 34, 1439462804 ]
def make_client(self, name, num_blocks, num_bits): return Client('riak', name, num_blocks, num_bits)
seomoz/simhash-db-py
[ 62, 22, 62, 4, 1350068054 ]
def create(kernel): result = Tangible() result.template = "object/tangible/ship/crafted/weapon/shared_quick_shot_upgrade_mk4.iff" result.attribute_template_id = 8 result.stfName("space_crafting_n","quick_shot_upgrade_mk4")
anhstudios/swganh
[ 62, 37, 62, 37, 1297996365 ]
def _pool_for_credentials(user, password, repo_base, create_if_missing=True): pool_key = PoolKey(user, password, repo_base) # Create a new pool if one doesn't exist or if the existing one has been # closed. Normally a pool should only be closed during testing, to force # all hanging connections to a dat...
datahuborg/datahub
[ 210, 60, 210, 43, 1380229308 ]
def _convert_pg_exception(e): # Convert some psycopg2 errors into exceptions meaningful to # Django. if (e.pgcode == errorcodes.INSUFFICIENT_PRIVILEGE): raise PermissionDenied() if (e.pgcode == errorcodes.INVALID_PARAMETER_VALUE or e.pgcode == errorcodes.UNDEFINED_OBJECT): ra...
datahuborg/datahub
[ 210, 60, 210, 43, 1380229308 ]
def __init__(self, user, password, host=HOST, port=PORT, repo_base=None): self.user = user self.password = password self.host = host self.port = port self.repo_base = repo_base self.connection = None # row level security is enabled unless the user is a superuser ...
datahuborg/datahub
[ 210, 60, 210, 43, 1380229308 ]
def __open_connection__(self): pool = _pool_for_credentials(self.user, self.password, self.repo_base) self.connection = pool.getconn() self.connection.set_isolation_level( psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT)
datahuborg/datahub
[ 210, 60, 210, 43, 1380229308 ]
def close_connection(self): pool = _pool_for_credentials(self.user, self.password, self.repo_base, create_if_missing=False) if self.connection and pool and not pool.closed: pool.putconn(self.connection, close=True) self.connection = None
datahuborg/datahub
[ 210, 60, 210, 43, 1380229308 ]
def _validate_table_name(self, noun): """ Raises ValueError if the proposed table name is invalid. Valid table names contain only alphanumeric characters and underscores. """ invalid_noun_msg = ( "Table names may only contain " "alphanumeric characters an...
datahuborg/datahub
[ 210, 60, 210, 43, 1380229308 ]
def list_repos(self): query = ('SELECT schema_name AS repo_name ' 'FROM information_schema.schemata ' 'WHERE schema_owner != %s') params = (settings.DATABASES['default']['USER'],) res = self.execute_sql(query, params) return [t[0] for t in res['tuples']]
datahuborg/datahub
[ 210, 60, 210, 43, 1380229308 ]
def delete_repo(self, repo, force=False): """Deletes a repo and the folder the user's repo files are in.""" self._check_for_injections(repo) # drop the schema query = 'DROP SCHEMA %s %s' params = (AsIs(repo), AsIs('CASCADE') if force is True else AsIs('')) res = self.exe...
datahuborg/datahub
[ 210, 60, 210, 43, 1380229308 ]