function stringlengths 11 56k | repo_name stringlengths 5 60 | features list |
|---|---|---|
def __init__(self, base_dir):
self.base_dir = base_dir
self.blobs_dir = os.path.join(base_dir, 'blobs')
self.links_dir = os.path.join(base_dir, 'links')
self.locks_dir = os.path.join(base_dir, 'locks')
self.db_dir = os.path.join(base_dir, 'db')
_makedirs(self.blobs_dir)
... | sio2project/filetracker | [
7,
12,
7,
1,
1346586491
] |
def store(
self,
name,
data,
version,
size=0,
compressed=False,
digest=None,
logical_size=None, | sio2project/filetracker | [
7,
12,
7,
1,
1346586491
] |
def delete(self, name, version, _lock=True):
"""Removes a file from the storage.
Args:
name: name of the file being deleted.
May contain slashes that are treated as path separators.
version: file "version" that is meant to be deleted
If the fi... | sio2project/filetracker | [
7,
12,
7,
1,
1346586491
] |
def logical_size(self, name):
"""Returns the logical size (before compression) of file `name`."""
digest = self._digest_for_link(name)
logical_size = self.db.get('{}:logical_size'.format(digest).encode())
if logical_size:
return int(logical_size.decode())
else:
... | sio2project/filetracker | [
7,
12,
7,
1,
1346586491
] |
def _blob_path(self, digest):
return os.path.join(self.blobs_dir, digest[0:2], digest) | sio2project/filetracker | [
7,
12,
7,
1,
1346586491
] |
def _db_transaction(self):
txn = self.db_env.txn_begin()
try:
yield txn
except:
txn.abort()
raise
else:
txn.commit() | sio2project/filetracker | [
7,
12,
7,
1,
1346586491
] |
def __init__(self, data, size):
self._data = data
self._size = size
self.current_path = None
self.saved_in_temp = False | sio2project/filetracker | [
7,
12,
7,
1,
1346586491
] |
def __exit__(self, _exc_type, _exc_value, _traceback):
"""Removes file if it was last saved as a temporary file."""
if self.saved_in_temp:
os.unlink(self.current_path) | sio2project/filetracker | [
7,
12,
7,
1,
1346586491
] |
def _copy_stream(src, dest, length=0):
"""Similar to shutil.copyfileobj, but supports limiting data size.
As for why this is required, refer to
https://www.python.org/dev/peps/pep-0333/#input-and-error-streams
Yes, there are WSGI implementations which do not support EOFs, and
believe me, you don't... | sio2project/filetracker | [
7,
12,
7,
1,
1346586491
] |
def _create_file_dirs(file_path):
"""Creates directory tree to file if it doesn't exist."""
dir_name = os.path.dirname(file_path)
_makedirs(dir_name) | sio2project/filetracker | [
7,
12,
7,
1,
1346586491
] |
def _file_version(path):
return os.lstat(path).st_mtime | sio2project/filetracker | [
7,
12,
7,
1,
1346586491
] |
def _exclusive_lock(path):
"""A simple wrapper for fcntl exclusive lock."""
_create_file_dirs(path)
fd = os.open(path, os.O_WRONLY | os.O_CREAT, 0o600)
try:
retries_left = _LOCK_RETRIES
success = False
while retries_left > 0:
# try to acquire the lock in a loop
... | sio2project/filetracker | [
7,
12,
7,
1,
1346586491
] |
def _no_lock():
"""Does nothing, just runs the code within the `with` statement.
Used for conditional locking."""
yield | sio2project/filetracker | [
7,
12,
7,
1,
1346586491
] |
def __init__(self, nodeName):
""" Constructor
:param nodeName: short name describing this node. Is used to construct the nodePath.
Currently we don't check for uniqueness in the children but this may change.
The nodeName may not contain slashes (/).
"""
... | titusjan/argos | [
151,
24,
151,
3,
1434200731
] |
def __str__(self):
return "<{}: {}>".format(type(self).__name__, self.nodePath) | titusjan/argos | [
151,
24,
151,
3,
1434200731
] |
def model(self):
""" Returns the ConfigTreeModel this item belongs to.
If the model is None (not set), it will use and cache the parent's model.
Therefore make sure that an ancestor node has a reference to the model! Typically by
setting the model property of the invisible ro... | titusjan/argos | [
151,
24,
151,
3,
1434200731
] |
def model(self, value):
""" Sets ConfigTreeModel this item belongs to.
"""
self._model = value | titusjan/argos | [
151,
24,
151,
3,
1434200731
] |
def decoration(self):
""" An optional decoration (e.g. icon).
The default implementation returns None (no decoration).
"""
return None | titusjan/argos | [
151,
24,
151,
3,
1434200731
] |
def font(self):
""" Returns a font for displaying this item's text in the tree.
The default implementation returns None (i.e. uses default font).
"""
return None | titusjan/argos | [
151,
24,
151,
3,
1434200731
] |
def backgroundBrush(self):
""" Returns a brush for drawing the background role in the tree.
The default implementation returns None (i.e. uses default brush).
"""
return None | titusjan/argos | [
151,
24,
151,
3,
1434200731
] |
def foregroundBrush(self):
""" Returns a brush for drawing the foreground role in the tree.
The default implementation returns None (i.e. uses default brush).
"""
return None | titusjan/argos | [
151,
24,
151,
3,
1434200731
] |
def sizeHint(self):
""" Returns a size hint for displaying the items in the tree
The default implementation returns None (i.e. no hint).
Should return a QSize object or None
"""
return None | titusjan/argos | [
151,
24,
151,
3,
1434200731
] |
def nodeName(self):
""" The node name. Is used to construct the nodePath"""
return self._nodeName | titusjan/argos | [
151,
24,
151,
3,
1434200731
] |
def nodeName(self, nodeName):
""" The node name. Is used to construct the nodePath"""
assert '/' not in nodeName, "nodeName may not contain slashes"
self._nodeName = nodeName
self._recursiveSetNodePath(self._constructNodePath()) | titusjan/argos | [
151,
24,
151,
3,
1434200731
] |
def nodePath(self):
""" The sequence of nodeNames from the root to this node. Separated by slashes."""
return self._nodePath | titusjan/argos | [
151,
24,
151,
3,
1434200731
] |
def parentItem(self):
""" The parent item """
return self._parentItem | titusjan/argos | [
151,
24,
151,
3,
1434200731
] |
def parentItem(self, value):
""" The parent item """
self._parentItem = value
self._recursiveSetNodePath(self._constructNodePath()) | titusjan/argos | [
151,
24,
151,
3,
1434200731
] |
def childItems(self):
""" List of child items """
#logger.debug("childItems {!r}".format(self))
return self._childItems | titusjan/argos | [
151,
24,
151,
3,
1434200731
] |
def nChildren(self): # TODO: numChildren
""" Returns the number of children
"""
return len(self.childItems) | titusjan/argos | [
151,
24,
151,
3,
1434200731
] |
def childByNodeName(self, nodeName):
""" Gets first (direct) child that has the nodeName.
"""
assert '/' not in nodeName, "nodeName can not contain slashes"
for child in self.childItems:
if child.nodeName == nodeName:
return child
raise IndexError("No... | titusjan/argos | [
151,
24,
151,
3,
1434200731
] |
def _auxGetByPath(parts, item):
"Aux function that does the actual recursive search"
#logger.debug("_auxGetByPath item={}, parts={}".format(item, parts))
if len(parts) == 0:
return item
head, tail = parts[0], parts[1:]
if head == '':
... | titusjan/argos | [
151,
24,
151,
3,
1434200731
] |
def childNumber(self):
""" Gets the index (nr) of this node in its parent's list of children.
"""
# This is O(n) in time. # TODO: store row number in the items?
if self.parentItem is not None:
return self.parentItem.childItems.index(self)
return 0 | titusjan/argos | [
151,
24,
151,
3,
1434200731
] |
def removeChild(self, position):
""" Removes the child at the position 'position'
Calls the child item finalize to close its resources before removing it.
"""
assert 0 <= position <= len(self.childItems), \
"position should be 0 < {} <= {}".format(position, len(self.child... | titusjan/argos | [
151,
24,
151,
3,
1434200731
] |
def logBranch(self, indent=0, level=logging.DEBUG):
""" Logs the item and all descendants, one line per child
"""
if 0:
print(indent * " " + str(self))
else:
logger.log(level, indent * " " + str(self))
for childItems in self.childItems:
c... | titusjan/argos | [
151,
24,
151,
3,
1434200731
] |
def __init__(self, nodeName=''):
""" Constructor
"""
super(AbstractLazyLoadTreeItem, self).__init__(nodeName=nodeName)
self._canFetchChildren = True # children not yet fetched (successfully or unsuccessfully) | titusjan/argos | [
151,
24,
151,
3,
1434200731
] |
def canFetchChildren(self):
""" Returns True if children can be fetched, and False if they already have been fetched.
Also returns False if they have been fetched and tried.
"""
return self._canFetchChildren | titusjan/argos | [
151,
24,
151,
3,
1434200731
] |
def _fetchAllChildren(self):
""" The function that actually fetches the children.
The result must be a list of RepoTreeItems. Their parents must be None,
as that attribute will be set by BaseTreeitem.insertItem()
:rtype: list of BaseRti objects
"""
raise Not... | titusjan/argos | [
151,
24,
151,
3,
1434200731
] |
def __init__(self) -> None:
super().__init__()
kick_off_date = tournaments.kick_off_date()
if dtutil.now() > kick_off_date:
self.date_info = 'The Season Kick Off is on the second Saturday of the season'
else:
self.date_info = 'The next Season Kick Off is on ' + dt... | PennyDreadfulMTG/Penny-Dreadful-Discord-Bot | [
33,
26,
33,
354,
1474960935
] |
def setupUi(self, SelectCode):
SelectCode.setObjectName("SelectCode")
SelectCode.resize(1300, 1100)
self.centralwidget = QtWidgets.QWidget(SelectCode)
self.centralwidget.setObjectName("centralwidget")
self.opt_select_code_3 = QtWidgets.QRadioButton(self.centralwidget)
sel... | lunapocket/powerOverWhelming | [
6,
3,
6,
5,
1493794654
] |
def __init__(self):
QtWidgets.QMainWindow.__init__(self)
self.setupUi(self)
self.initUi() | lunapocket/powerOverWhelming | [
6,
3,
6,
5,
1493794654
] |
def return_search(self) :
global window_search_code
self.close()
window_search_code = guiStart.GuiStart()
window_search_code.show() | lunapocket/powerOverWhelming | [
6,
3,
6,
5,
1493794654
] |
def __init__(self, elements=None):
"""Create a new empty union-find structure.
If *elements* is an iterable, this structure will be initialized
with the discrete partition on the given set of elements.
"""
if elements is None:
elements = ()
self.parents = {}... | SpaceGroupUCL/qgisSpaceSyntaxToolkit | [
96,
34,
96,
65,
1403185627
] |
def __iter__(self):
"""Iterate through all items ever found or unioned by this structure.
"""
return iter(self.parents) | SpaceGroupUCL/qgisSpaceSyntaxToolkit | [
96,
34,
96,
65,
1403185627
] |
def javascript_link( *urls, **attrs ):
return _modTag( urls, attrs, tags.javascript_link ) | DIRACGrid/DIRACWeb | [
8,
12,
8,
27,
1304434265
] |
def _modTag( urls, attrs, functor ):
nUrls = urls
sN = request.environ[ 'SCRIPT_NAME' ]
if sN:
if sN[0] == "/":
sN = sN[1:]
nUrls = []
for url in urls:
if url.find( "http" ) == 0:
nUrls.append( url )
else:
if url[0] == "/":
url = "/%s%s" % ( sN, url )
... | DIRACGrid/DIRACWeb | [
8,
12,
8,
27,
1304434265
] |
def wrap( self = None ):
return "<html><body><img src='/images/logos/logo.png'/><br><br><br><br><p class='lrg'>\
The <a href='http://diracgrid.org'>DIRAC</a> project is a complete \
Grid solution for a community of users needing access to \
distributed computing resources.</p><br... | DIRACGrid/DIRACWeb | [
8,
12,
8,
27,
1304434265
] |
def test_signal(T=100, fs=1):
dt = 1/fs
x = np.arange(0, T, dt)
y = np.ones(x.shape)
return np.vstack((x,y)) | BrainTech/openbci | [
12,
9,
12,
3,
1407695699
] |
def plot_graph(ax, title, x, y, xlabel, ylabel):
ax.set_title(title)
ax.plot(x, y)
ax.set_xlabel(xlabel)
ax.set_ylabel(ylabel) | BrainTech/openbci | [
12,
9,
12,
3,
1407695699
] |
def calculate_distance(position_1, position_2):
""" Returns distance between two points or 1-dim and 2-dim vectors
input:
position1 -- int or 1-dim or 2-dim matrix
position2 -- int or 1-dim or 2-dim matrix
position1 and position2 must have the same dimension
"""
distance = position_2 - position_1 | BrainTech/openbci | [
12,
9,
12,
3,
1407695699
] |
def max_sway_AP_ML(signal):
""" Returns maximal sway values for mediolateral (x) and anterioposterior (y) directions
Input:
signal -- 2-dim array with shape (channel, samples)
(on the index 0 - samples from channel x, on index 1 - samples from channel y)
Output:
max_sway -- float
max_AP -- float
m... | BrainTech/openbci | [
12,
9,
12,
3,
1407695699
] |
def COP_path(signal):
""" Returns total length of the COP path
Input:
signal -- 2-dim array with shape (channel, samples)
(on the index 0 - samples from channel x, on index 1 - samples from channel y)
Output:
cop -- float
cop_x -- float
cop_y -- float
"""
cop = sum([calculate_distance(sign... | BrainTech/openbci | [
12,
9,
12,
3,
1407695699
] |
def confidence_ellipse_area(signal):
""" Returns area of the 95 perc. confidence ellipse"""
s_AP = np.std(signal[1])
s_ML = np.std(signal[0])
s_AP_ML = 1./signal.shape[1]*np.sum((signal[0]-np.mean(signal[0]))*(signal[1]-np.mean(signal[1])))
area = 2*np.pi*3.0*np.sqrt(s_AP**2*s_ML**2-s_AP_ML**2)
return area | BrainTech/openbci | [
12,
9,
12,
3,
1407695699
] |
def get_percentages_being(signal, fs, grid=0.1, plot=True):
"""Return how long person was on o field grig x grid (%) | BrainTech/openbci | [
12,
9,
12,
3,
1407695699
] |
def get_percentages_values(signal, fs, plot=True):
"""
Returns percentages of being on each of four parts of board.
Input:
signal -- 2-dim array with shape (channel, samples)
(index 0 - samples from channel x, index 1 - samples from channel y)
fs -- float -- sampling frequency
Output:
top_right --... | BrainTech/openbci | [
12,
9,
12,
3,
1407695699
] |
def plot_percentages_being(grid, percentages_being, xedges, yedges, sig):
fig = plt.figure()
ax = fig.gca()
ax.set_title('histogram with percentagles\nbegining in field {}cm x {}cm [time %].'.format(grid, grid))
im = mpl.image.NonUniformImage(ax, interpolation='nearest')
xcenters = xedges[:-1] + 0.5 * (xedges[1:] ... | BrainTech/openbci | [
12,
9,
12,
3,
1407695699
] |
def apply_filter(input_filename, output_filename):
settings = {
'amount': 25,
'granularity': 5
} | aluminiumgeek/psychedelizer | [
7,
3,
7,
2,
1390165576
] |
def get_test_account_connectivity_tasks(asset):
if asset.is_unixlike():
tasks = const.PING_UNIXLIKE_TASKS
elif asset.is_windows():
tasks = const.PING_WINDOWS_TASKS
else:
msg = _(
"The asset {} system platform {} does not "
"support run Ansible tasks".format(as... | jumpserver/jumpserver | [
19948,
4806,
19948,
134,
1404446099
] |
def test_user_connectivity(task_name, asset, username, password=None, private_key=None):
"""
:param task_name
:param asset
:param username
:param password
:param private_key
"""
from ops.inventory import JMSCustomInventory
tasks = get_test_account_connectivity_tasks(asset)
if no... | jumpserver/jumpserver | [
19948,
4806,
19948,
134,
1404446099
] |
def test_account_connectivity_util(account, task_name):
"""
:param account: <AuthBook>对象
:param task_name:
:return:
"""
if not check_asset_can_run_ansible(account.asset):
return
account.load_auth()
try:
raw, summary = test_user_connectivity(
task_name=task_na... | jumpserver/jumpserver | [
19948,
4806,
19948,
134,
1404446099
] |
def __init__(self):
"""
"""
self.fastaDict = {} | brguez/TEIBA | [
2,
2,
2,
2,
1462206335
] |
def fasta_reader(self, fastaFile):
"""
"""
fastaDict = {}
subHeader("Fasta reader")
fh = open(fastaFile)
# ditch the boolean (x[0]) and just keep the header or sequence since
# we know they alternate.
faiter = (x[1] for x in itertools.groupby(fh, lambda ... | brguez/TEIBA | [
2,
2,
2,
2,
1462206335
] |
def __init__(self, alignmentObj, clippedSide):
"""
"""
self.chrom = alignmentObj.reference_name
self.clippedSide = clippedSide
self.bkpPos = alignmentObj.reference_start if clippedSide == "beg" else alignmentObj.reference_end
self.clippedReadDict = {}
self... | brguez/TEIBA | [
2,
2,
2,
2,
1462206335
] |
def nbReads(self):
"""
"""
return len(self.clippedReadDict) | brguez/TEIBA | [
2,
2,
2,
2,
1462206335
] |
def addReadSeqs(self, fastaObj):
"""
"""
for readId in self.clippedReadDict.keys():
alignmentObj = self.clippedReadDict[readId]["alignmentObj"] | brguez/TEIBA | [
2,
2,
2,
2,
1462206335
] |
def makeConsensusSeq(self, outDir):
"""
multiple sequence alignment based
"""
## A) Single sequence
if len(self.clippedReadDict.keys()) == 1:
consensusSeq = list(self.clippedReadDict.values())[0]["seq"].upper()
## B) Multiple sequence
else:
... | brguez/TEIBA | [
2,
2,
2,
2,
1462206335
] |
def log(label, string):
"""
Display labelled information
"""
print "[" + label + "]", string | brguez/TEIBA | [
2,
2,
2,
2,
1462206335
] |
def info(string):
"""
Display basic information
"""
timeInfo = time.strftime("%Y-%m-%d %H:%M")
print timeInfo, string | brguez/TEIBA | [
2,
2,
2,
2,
1462206335
] |
def overlap(begA, endA, begB, endB):
"""
Check if both ranges overlap. 2 criteria for defining overlap:
## A) Begin of the range A within the range B
# *beg* <---------range_A---------->
# <---------range_B----------> | brguez/TEIBA | [
2,
2,
2,
2,
1462206335
] |
def getClippedPairedClusters(chrPlus, begPlus, endPlus, chrMinus, begMinus, endMinus, rgType, bamFile, windowSize):
"""
"""
## 1. Extract clipped reads for positive cluster
chrom = chrPlus
if (rgType == "DUP"):
beg = int(begPlus) - windowSize
end = int(begPlus) + windowSize
else... | brguez/TEIBA | [
2,
2,
2,
2,
1462206335
] |
def getClippedUnpairedCluster(chrPlus, begPlus, endPlus, bamFile, windowSize):
"""
"""
## 1. Extract clipped reads for cluster beginning
chrom = chrPlus
beg = int(begPlus) - windowSize
end = int(begPlus) + windowSize | brguez/TEIBA | [
2,
2,
2,
2,
1462206335
] |
def getClippedInterval(chrom, beg, end, bamFile):
'''
'''
#print "** pickClipped function **" | brguez/TEIBA | [
2,
2,
2,
2,
1462206335
] |
def clusterCLipped(clippedList, clippedSide, minNbReads, maxNbReads):
'''
'''
#print "** clusterCLipped function **"
### 1. Sort the list of clipped reads in increasing coordinates order
if (clippedSide == "beg"):
clippedSortedList = sorted(clippedList, key=lambda alignmentObj: alignme... | brguez/TEIBA | [
2,
2,
2,
2,
1462206335
] |
def filterNbClusters(clusterBegList, clusterEndList, maxNbClusters):
'''
'''
totalNbClusters = len(clusterBegList) + len(clusterEndList) | brguez/TEIBA | [
2,
2,
2,
2,
1462206335
] |
def filterDiscordantCluster(chrom, beg, end, readPairList, bamFile):
'''
'''
nbDiscordant = len(readPairList)
nbClippedBothSides = 0
readPairFilteredList = []
## Extract alignments in the interval
iterator = bamFile.fetch(chrom, beg, end)
## Iterate over the alignments
for alignmen... | brguez/TEIBA | [
2,
2,
2,
2,
1462206335
] |
def main():
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--pig', default='tk')
parser.add_argument('--wave')
parser.add_argument('--gallery', nargs='*', default=['.', '../gallery'])
parser.add_argument('--images', default=False, action='store_true')
parser.add_... | openbermuda/karmapi | [
4,
3,
4,
3,
1459170159
] |
def setUp(self):
self.hamster = TorecHashCodesHamster(RequestsManager()) | yosi-dediashvili/SubiT | [
16,
2,
16,
22,
1360016987
] |
def test_remove_after_max_time_passed(self):
self.hamster.add_sub_id("23703")
self.hamster.add_sub_id("2638")
self.assertEquals(len(self.hamster._records), 2)
time.sleep(10)
self.assertEquals(len(self.hamster._records), 2)
time.sleep(120)
self.assertEquals(... | yosi-dediashvili/SubiT | [
16,
2,
16,
22,
1360016987
] |
def test_remove_after_after_request(self):
self.hamster.add_sub_id("23703")
self.hamster.add_sub_id("2638")
self.assertEquals(len(self.hamster._records), 2)
self.hamster.remove_sub_id("2638")
self.assertEquals(len(self.hamster._records), 1)
self.assertEquals(self.ha... | yosi-dediashvili/SubiT | [
16,
2,
16,
22,
1360016987
] |
def parse_arguments(args=None):
basic_args = plot_correlation_args()
heatmap_parser = heatmap_options()
scatter_parser = scatterplot_options()
parser = argparse.ArgumentParser(
formatter_class=argparse.RawDescriptionHelpFormatter,
description=""" | fidelram/deepTools | [
561,
191,
561,
107,
1373286628
] |
def plot_correlation_args():
parser = argparse.ArgumentParser(add_help=False)
required = parser.add_argument_group('Required arguments')
# define the arguments
required.add_argument('--corData', '-in',
metavar='FILE',
help='Compressed matrix of values... | fidelram/deepTools | [
561,
191,
561,
107,
1373286628
] |
def heatmap_options():
"""
Options for generating the correlation heatmap
"""
parser = argparse.ArgumentParser(add_help=False)
heatmap = parser.add_argument_group('Heatmap options')
heatmap.add_argument('--plotHeight',
help='Plot height in cm. (Default: %(default)s)',
... | fidelram/deepTools | [
561,
191,
561,
107,
1373286628
] |
def capture_area(area):
"""
Captures area of the screen
Args:
area (Tuple (x,y,width,height)): Area to capture
Returns:
Image : Image of the area captured
"""
img = pyautogui.screenshot(region=area)
return img | DavidBarishev/DDtankFarmingBot | [
2,
3,
2,
1,
1466450080
] |
def get_game_screen():
"""
Get game screen image
Returns:
Image : Image of screen area
"""
return capture_area(area=Globals.GAME_REGION) | DavidBarishev/DDtankFarmingBot | [
2,
3,
2,
1,
1466450080
] |
def glmnetPlot(x, xvar = 'norm', label = False, ptype = 'coef', **options):
import matplotlib.pyplot as plt
# process inputs
xvar = getFromList(xvar, ['norm', 'lambda', 'dev'], 'xvar should be one of ''norm'', ''lambda'', ''dev'' ')
ptype = getFromList(ptype, ['coef', '2norm'], 'ptype should be one... | bbalasub1/glmnet_python | [
185,
91,
185,
25,
1471585049
] |
def getFromList(xvar, xvarbase, errMsg):
indxtf = [x.startswith(xvar.lower()) for x in xvarbase] # find index
xvarind = [i for i in range(len(indxtf)) if indxtf[i] == True]
if len(xvarind) == 0:
raise ValueError(errMsg)
else:
xvar = xvarbase[xvarind[0]]
return xvar | bbalasub1/glmnet_python | [
185,
91,
185,
25,
1471585049
] |
def nonzeroCoef(beta, bystep = False):
result = scipy.absolute(beta) > 0
if len(result.shape) == 1:
result = scipy.reshape(result, [result.shape[0], 1])
if not bystep:
result = scipy.any(result, axis = 1) | bbalasub1/glmnet_python | [
185,
91,
185,
25,
1471585049
] |
def plotCoef(beta, norm, lambdau, df, dev, label, xvar, xlab, ylab, **options):
import matplotlib.pyplot as plt
which = nonzeroCoef(beta)
idwhich = [i for i in range(len(which)) if which[i] == True]
nwhich = len(idwhich)
if nwhich == 0:
raise ValueError('No plot produced since all coefficie... | bbalasub1/glmnet_python | [
185,
91,
185,
25,
1471585049
] |
def __init__(self, proxy_type, proxy_address, proxy_port, proxy_login, proxy_password):
self.proxyType = proxy_type
self.proxyAddress = proxy_address
self.proxyPort = proxy_port
self.proxyLogin = proxy_login
self.proxyPassword = proxy_password | h3llrais3r/Auto-Subliminal | [
43,
7,
43,
6,
1387396745
] |
def add_arguments(self, parser):
parser.add_argument("username", help="account username")
parser.add_argument("password", help="account password")
parser.add_argument("email", help="account email address") | mozilla/socorro | [
556,
233,
556,
19,
1314213709
] |
def onchange_list_price(self, cr, uid, ids, list_price, uos_coeff, context=None):
return {'value': {'list_price_copy': list_price}} | iw3hxn/LibrERP | [
29,
16,
29,
1,
1402418161
] |
def write(self, cr, uid, ids, vals, context=None):
if 'list_price' in vals:
group_obj = self.pool['res.groups']
if not group_obj.user_in_group(cr, uid, uid, 'dt_price_security.can_modify_prices', context=context):
title = _('Violation of permissions')
mes... | iw3hxn/LibrERP | [
29,
16,
29,
1,
1402418161
] |
def test(self, parent, block):
return bool(self.RE.search(block)) | c2corg/v6_ui | [
7,
12,
7,
25,
1443631964
] |
def extendMarkdown(self, md, md_globals): # noqa
md.parser.blockprocessors.add(
'header_emphasis',
C2CHeaderProcessor(md.parser),
"<hashheader") | c2corg/v6_ui | [
7,
12,
7,
25,
1443631964
] |
def __init__(self, maintenance_communicator=INJECTED, ssl_private_key=INJECTED, ssl_certificate=INJECTED):
# type: (MaintenanceCommunicator, str, str) -> None
"""
:type maintenance_communicator: gateway.maintenance_communicator.MaintenanceCommunicator
"""
self._consumers = {} # ... | openmotics/gateway | [
30,
12,
30,
27,
1481877206
] |
def start(self):
# type: () -> None
if self._maintenance_communicator:
self._maintenance_communicator.start() | openmotics/gateway | [
30,
12,
30,
27,
1481877206
] |
def _received_data(self, message):
# type: (str) -> None
try:
if self._connection is not None:
self._connection.sendall(bytearray(message.rstrip().encode()) + bytearray(b'\n'))
except Exception:
logger.exception('Exception forwarding maintenance data to so... | openmotics/gateway | [
30,
12,
30,
27,
1481877206
] |
def _deactivate(self):
# type: () -> None
if self._maintenance_communicator.is_active():
self._maintenance_communicator.deactivate() | openmotics/gateway | [
30,
12,
30,
27,
1481877206
] |
def add_consumer(self, consumer_id, callback):
# type: (int, Callable[[str],Any]) -> None
self._consumers[consumer_id] = callback
self._activate() | openmotics/gateway | [
30,
12,
30,
27,
1481877206
] |
def open_maintenace_socket(self):
# type: () -> int
"""
Opens a TCP/SSL socket, connecting it with the maintenance service
"""
port = random.randint(6000, 7000)
self._server_thread = BaseThread(name='maintenancesock', target=self._run_socket_server, args=[port])
s... | openmotics/gateway | [
30,
12,
30,
27,
1481877206
] |
def _handle_connection(self):
# type: () -> None
"""
Handles one incoming connection.
"""
assert self._connection is not None
try:
self._connection.settimeout(1)
self._connection.sendall(b'Activating maintenance mode, waiting for other actions to c... | openmotics/gateway | [
30,
12,
30,
27,
1481877206
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.