function stringlengths 11 56k | repo_name stringlengths 5 60 | features list |
|---|---|---|
def __truediv__(self, other):
if isinstance(other, NUMERIC_TYPES):
return self.__class__(default_unit=self._default_unit,
**{self.STANDARD_UNIT: (self.standard / other)})
else:
raise TypeError('%(class)s must be divided by a number' % {"class": pretty_name(self)}) | Vvucinic/Wander | [
1,
1,
1,
11,
1449375044
] |
def main():
plot1 = xrtp.XYCPlot('star.03')
plot1.caxis.offset = 6000
plot2 = xrtp.XYCPlot('star.04')
plot2.caxis.offset = 6000
plot1.xaxis.limits = [-15, 15]
plot1.yaxis.limits = [-15, 15]
plot1.yaxis.factor *= -1
plot2.xaxis.limits = [-1, 1]
plot2.yaxis.limits = [-1, 1]
plot2.y... | kklmn/xrt | [
63,
24,
63,
54,
1459267067
] |
def after(): | kklmn/xrt | [
63,
24,
63,
54,
1459267067
] |
def get_social_link(self):
'''
Returns the social_link if present. Otherwise, sends javascript:void(0)
'''
if self.social_link == '':
return 'javascript:void(0)'
else:
return self.social_link | compsoc-ssc/compsocssc | [
5,
3,
5,
3,
1423901148
] |
def __str__(self):
warnings.warn('''You are using a "General Variable".
Stop doing that.
This is bad design on Arjoonn's part so don't fall into the same trap.
If you are using this for Orfik, that has already been fixed. If you are using this for logos, same thing.
Over a few c... | compsoc-ssc/compsocssc | [
5,
3,
5,
3,
1423901148
] |
def __init__(self, title):
self._ax = None
self.cax = None
self.title = title | vaquerizaslab/tadtool | [
36,
12,
36,
7,
1459337414
] |
def _plot(self, region=None, **kwargs):
raise NotImplementedError("Subclasses need to override _plot function") | vaquerizaslab/tadtool | [
36,
12,
36,
7,
1459337414
] |
def plot(self, region=None, **kwargs):
raise NotImplementedError("Subclasses need to override plot function") | vaquerizaslab/tadtool | [
36,
12,
36,
7,
1459337414
] |
def fig(self):
return self._ax.figure | vaquerizaslab/tadtool | [
36,
12,
36,
7,
1459337414
] |
def ax(self):
if not self._ax:
_, self._ax = plt.subplots()
return self._ax | vaquerizaslab/tadtool | [
36,
12,
36,
7,
1459337414
] |
def ax(self, value):
self._ax = value | vaquerizaslab/tadtool | [
36,
12,
36,
7,
1459337414
] |
def __init__(self, chromosome, display_scale=True):
"""
:param chromosome: :class:`~kaic.data.genomic.GenomicRegion` or string
:param display_scale: Boolean
Display distance scale at bottom right
"""
if isinstance(chromosome, GenomicRegion):
... | vaquerizaslab/tadtool | [
36,
12,
36,
7,
1459337414
] |
def __call__(self, x, pos=None):
"""
Return label for tick at coordinate x. Relative position of
ticks can be specified with pos. First tick gets chromosome name.
"""
s = self._format_val(x, prec_offset=1)
if pos == 0 or x == 0:
return "{}:{}".format(self.chro... | vaquerizaslab/tadtool | [
36,
12,
36,
7,
1459337414
] |
def __call__(self):
vmin, vmax = self.axis.get_view_interval()
ticks = self.tick_values(vmin, vmax)
# Make sure that first and last tick are the start
# and the end of the genomic range plotted. If next
# ticks are too close, remove them.
ticks[0] = vmin
ticks[-1]... | vaquerizaslab/tadtool | [
36,
12,
36,
7,
1459337414
] |
def __init__(self, n):
self.ndivs = n | vaquerizaslab/tadtool | [
36,
12,
36,
7,
1459337414
] |
def __init__(self, title):
BasePlotter.__init__(self, title=title) | vaquerizaslab/tadtool | [
36,
12,
36,
7,
1459337414
] |
def prepare_normalization(norm="lin", vmin=None, vmax=None):
if isinstance(norm, mpl.colors.Normalize):
norm.vmin = vmin
norm.vmax = vmax
return norm
if norm == "log":
return mpl.colors.LogNorm(vmin=vmin, vmax=vmax)
elif norm == "lin":
return mpl.colors.Normalize(vmin... | vaquerizaslab/tadtool | [
36,
12,
36,
7,
1459337414
] |
def __init__(self, hic_matrix, regions=None, colormap='RdBu', norm="log",
vmin=None, vmax=None, show_colorbar=True, blend_masked=False):
if regions is None:
for i in range(hic_matrix.shape[0]):
regions.append(GenomicRegion(chromosome='', start=i, end=i))
self... | vaquerizaslab/tadtool | [
36,
12,
36,
7,
1459337414
] |
def vmin(self):
return self._vmin if self._vmin else np.nanmin(self.hic_matrix) | vaquerizaslab/tadtool | [
36,
12,
36,
7,
1459337414
] |
def vmax(self):
return self._vmax if self._vmax else np.nanmax(self.hic_matrix) | vaquerizaslab/tadtool | [
36,
12,
36,
7,
1459337414
] |
def __init__(self, hic_matrix, regions=None, title='', colormap='viridis', max_dist=None, norm="log",
vmin=None, vmax=None, show_colorbar=True, blend_masked=False):
BasePlotter1D.__init__(self, title=title)
BasePlotterHic.__init__(self, hic_matrix, regions=regions, colormap=colormap, vm... | vaquerizaslab/tadtool | [
36,
12,
36,
7,
1459337414
] |
def set_clim(self, vmin, vmax):
self.hicmesh.set_clim(vmin=vmin, vmax=vmax)
if self.colorbar is not None:
self.colorbar.vmin = vmin
self.colorbar.vmax = vmax
self.colorbar.draw_all() | vaquerizaslab/tadtool | [
36,
12,
36,
7,
1459337414
] |
def __init__(self, data, window_sizes=None, regions=None, title='', midpoint=None,
colormap='coolwarm_r', vmax=None, current_window_size=0, log_y=True):
if regions is None:
regions = []
for i in range(data.shape[1]):
regions.append(GenomicRegion(chromosom... | vaquerizaslab/tadtool | [
36,
12,
36,
7,
1459337414
] |
def set_clim(self, vmin, vmax):
self.mesh.set_clim(vmin=vmin, vmax=vmax)
if self.colorbar is not None:
self.colorbar.vmin = vmin
self.colorbar.vmax = vmax
self.colorbar.draw_all() | vaquerizaslab/tadtool | [
36,
12,
36,
7,
1459337414
] |
def __init__(self, regions, title='', color='black'):
BasePlotter1D.__init__(self, title=title)
self.regions = regions
self.color = color
self.current_region = None | vaquerizaslab/tadtool | [
36,
12,
36,
7,
1459337414
] |
def update(self, regions):
self.regions = regions
self.ax.cla()
self.plot(region=self.current_region, ax=self.ax) | vaquerizaslab/tadtool | [
36,
12,
36,
7,
1459337414
] |
def __init__(self, data, regions=None, title='', init_row=0, is_symmetric=False):
BasePlotter1D.__init__(self, title=title)
if regions is None:
regions = []
for i in range(len(data)):
regions.append(GenomicRegion(chromosome='', start=i, end=i))
self.init_... | vaquerizaslab/tadtool | [
36,
12,
36,
7,
1459337414
] |
def _plot(self, region=None, cax=None):
self._new_region(region)
bin_coords = [(x.start - 1) for x in self.sr]
ds = self.da_sub[self.init_row]
self.line, = self.ax.plot(bin_coords, ds)
if not self.is_symmetric:
self.current_cutoff = (self.ax.get_ylim()[1] - self.ax.ge... | vaquerizaslab/tadtool | [
36,
12,
36,
7,
1459337414
] |
def __init__(self, hic_matrix, regions=None, data=None, window_sizes=None, norm='lin', max_dist=3000000,
max_percentile=99.99, algorithm='insulation', matrix_colormap=None,
data_colormap=None, log_data=True):
self.hic_matrix = hic_matrix
if regions is None:
... | vaquerizaslab/tadtool | [
36,
12,
36,
7,
1459337414
] |
def data_slider_update(self, val):
if self.is_symmetric:
self.data_plot.set_clim(-1*val, val)
else:
self.data_plot.set_clim(self.min_value_data, val) | vaquerizaslab/tadtool | [
36,
12,
36,
7,
1459337414
] |
def on_click_save_vector(self, event):
tk.Tk().withdraw() # Close the root window
save_path = filedialog.asksaveasfilename()
if save_path is not None:
da_sub = self.da[self.current_da_ix]
with open(save_path, 'w') as o:
for i, region in enumerate(self.reg... | vaquerizaslab/tadtool | [
36,
12,
36,
7,
1459337414
] |
def plot(self, region=None):
# set up plotting grid
self.fig = plt.figure(figsize=(10, 10))
# main plots
grid_size = (32, 15)
hic_vmax_slider_ax = plt.subplot2grid(grid_size, (0, 0), colspan=13)
hic_ax = plt.subplot2grid(grid_size, (1, 0), rowspan=9, colspan=13)
... | vaquerizaslab/tadtool | [
36,
12,
36,
7,
1459337414
] |
def _get_override_format(self):
return 'JAVA_HOME="%s"' | louisq/staticguru | [
2,
3,
2,
28,
1475196616
] |
def gauss2(fwhm, length): | sevenian3/ChromaStarPy | [
9,
2,
9,
2,
1494513781
] |
def __init__(self):
self.var = 0 | github/codeql | [
5783,
1304,
5783,
842,
1533054951
] |
def __init__(self):
self.var = 1 # self.var will be overwritten
C.__init__(self) | github/codeql | [
5783,
1304,
5783,
842,
1533054951
] |
def __init__(self):
self.var = 0 # self.var will be overwritten | github/codeql | [
5783,
1304,
5783,
842,
1533054951
] |
def connect ():
'''
Create the connection to the MongoDB and create 3 collections needed
'''
try:
# Create the connection to the local host
conn = pymongo.MongoClient()
print 'MongoDB Connection Successful'
except pymongo.errors.ConnectionFailure, err:
print 'MongoDB... | Macemann/Georgetown-Capstone | [
3,
4,
3,
1,
1418008428
] |
def dist(a, b):
return sum((i-j)**2 for i, j in zip(a, b)) | Ginfung/FSSE | [
3,
1,
3,
1,
1485895757
] |
def setUp(self):
itau_data = get_itau_data_from_file()
self.header_arquivo = itau_data['header_arquivo']
self.seg_p = itau_data['seg_p1']
self.seg_p_str = itau_data['seg_p1_str']
self.seg_q = itau_data['seg_q1']
self.seg_q_str = itau_data['seg_q1_str'] | Trust-Code/python-cnab | [
30,
48,
30,
9,
1474976091
] |
def test_escrita_campo_num_decimal(self):
# aceitar somente tipo Decimal
with self.assertRaises(errors.TipoError):
self.seg_p.valor_titulo = 10.0
with self.assertRaises(errors.TipoError):
self.seg_p.valor_titulo = ''
# Testa se as casas decimais estao sendo verif... | Trust-Code/python-cnab | [
30,
48,
30,
9,
1474976091
] |
def test_escrita_campo_num_int(self):
# aceitar somente inteiros (int e long)
with self.assertRaises(errors.TipoError):
self.header_arquivo.controle_banco = 10.0
with self.assertRaises(errors.TipoError):
self.header_arquivo.controle_banco = ''
# verifica se o num... | Trust-Code/python-cnab | [
30,
48,
30,
9,
1474976091
] |
def test_escrita_campo_alfa(self):
# Testa que serao aceitos apenas unicode objects
with self.assertRaises(errors.TipoError):
self.header_arquivo.cedente_nome = 'tracy'
# Testa que strings mais longas que obj.digitos nao serao aceitas
with self.assertRaises(errors.NumDigitos... | Trust-Code/python-cnab | [
30,
48,
30,
9,
1474976091
] |
def test_necessario(self):
self.assertTrue(self.seg_p)
seg_p2 = itau.registros.SegmentoP()
self.assertFalse(seg_p2.necessario())
seg_p2.controle_banco = 33
self.assertFalse(seg_p2.necessario())
seg_p2.vencimento_titulo = 10102012
self.assertTrue(seg_p2.necessar... | Trust-Code/python-cnab | [
30,
48,
30,
9,
1474976091
] |
def unicode_test(seg_instance, seg_str):
seg_gen_str = str(seg_instance)
self.assertEqual(len(seg_gen_str), 240)
self.assertEqual(len(seg_str), 240)
self.assertEqual(seg_gen_str, seg_str) | Trust-Code/python-cnab | [
30,
48,
30,
9,
1474976091
] |
def __enter__(self):
"""
Syntax sugar which helps in celery tasks, cron jobs, and other scripts
Usage:
with Tenant.objects.get(schema_name='test') as tenant:
# run some code in tenant test
# run some code in previous tenant (public probably)
"""
... | tomturner/django-tenants | [
1060,
273,
1060,
178,
1433879339
] |
def activate(self):
"""
Syntax sugar that helps at django shell with fast tenant changing
Usage:
Tenant.objects.get(schema_name='test').activate()
"""
connection = connections[get_tenant_database_alias()]
connection.set_tenant(self) | tomturner/django-tenants | [
1060,
273,
1060,
178,
1433879339
] |
def deactivate(cls):
"""
Syntax sugar, return to public schema
Usage:
test_tenant.deactivate()
# or simpler
Tenant.deactivate()
"""
connection = connections[get_tenant_database_alias()]
connection.set_schema_to_public() | tomturner/django-tenants | [
1060,
273,
1060,
178,
1433879339
] |
def serializable_fields(self):
""" in certain cases the user model isn't serializable so you may want to only send the id """
return self | tomturner/django-tenants | [
1060,
273,
1060,
178,
1433879339
] |
def pre_drop(self):
"""
This is a routine which you could override to backup the tenant schema before dropping.
:return:
""" | tomturner/django-tenants | [
1060,
273,
1060,
178,
1433879339
] |
def create_schema(self, check_if_exists=False, sync_schema=True,
verbosity=1):
"""
Creates the schema 'schema_name' for this tenant. Optionally checks if
the schema already exists before creating it. Returns true if the
schema was created, false otherwise.
"... | tomturner/django-tenants | [
1060,
273,
1060,
178,
1433879339
] |
def reverse(self, request, view_name):
"""
Returns the URL of this tenant.
"""
http_type = 'https://' if request.is_secure() else 'http://'
domain = get_current_site(request).domain
url = ''.join((http_type, self.schema_name, '.', domain, reverse(view_name)))
r... | tomturner/django-tenants | [
1060,
273,
1060,
178,
1433879339
] |
def save(self, *args, **kwargs):
# Get all other primary domains with the same tenant
domain_list = self.__class__.objects.filter(tenant=self.tenant, is_primary=True).exclude(pk=self.pk)
# If we have no primary domain yet, set as primary domain by default
self.is_primary = self.is_primar... | tomturner/django-tenants | [
1060,
273,
1060,
178,
1433879339
] |
def admin_users_page():
return render_template(
'admin_users.html',
initial_date=datetime.now().isoformat(), # now, in server's time zone
initial_period_start=current_period_start().isoformat(),
period_duration=config['period_duration'],
lock_date=config['lock_date'],
) | justinbot/timecard | [
2,
1,
2,
20,
1482543058
] |
def make_new_rsa_key_weak(bits):
return RSA.generate(bits) # NOT OK | github/codeql | [
5783,
1304,
5783,
842,
1533054951
] |
def make_new_rsa_key_strong(bits):
return RSA.generate(bits) # OK | github/codeql | [
5783,
1304,
5783,
842,
1533054951
] |
def test_openapi_schema():
response = client.get("/openapi.json")
assert response.status_code == 200, response.text
assert response.json() == openapi_schema | tiangolo/fastapi | [
55302,
4581,
55302,
474,
1544257307
] |
def test_post_form_no_body():
response = client.post("/files/")
assert response.status_code == 422, response.text
assert response.json() == file_required | tiangolo/fastapi | [
55302,
4581,
55302,
474,
1544257307
] |
def test_post_file(tmp_path):
path = tmp_path / "test.txt"
path.write_bytes(b"<file content>")
client = TestClient(app)
with path.open("rb") as file:
response = client.post("/files/", files={"file": file})
assert response.status_code == 200, response.text
assert response.json() == {"fil... | tiangolo/fastapi | [
55302,
4581,
55302,
474,
1544257307
] |
def stream():
csv = b'''"a\xc2\x96b\\"c'd\\re\\nf,g\\\\",1,NULL,""\n'''.decode('utf-8')
return six.StringIO(csv) | katakumpo/nicedjango | [
2,
1,
2,
1,
1414873038
] |
def test_reader_none(stream):
r = CsvReader(stream, replacements=(), preserve_quotes=True,
replace_digits=False)
assert list(r) == [['''"a\x96b\\"c'd\\re\\nf,g\\\\"''', '1', None, '""']] | katakumpo/nicedjango | [
2,
1,
2,
1,
1414873038
] |
def test_reader_replace(stream):
r = CsvReader(stream, replace_digits=False)
assert list(r) == [['''a\x96b"c'd\re\nf,g\\''', '1', None, '']] | katakumpo/nicedjango | [
2,
1,
2,
1,
1414873038
] |
def cube_func(cube):
return (cube.standard_name in name_list) and (not any(m.method == 'maximum' for m in cube.cell_methods)) | ioos/comt | [
1,
7,
1,
16,
1401373926
] |
def get_mesh(cube, url):
ug = pyugrid.UGrid.from_ncfile(url)
cube.mesh = ug
cube.mesh_dimension = 1
return cube | ioos/comt | [
1,
7,
1,
16,
1401373926
] |
def get_triang(cube):
lon = cube.mesh.nodes[:, 0]
lat = cube.mesh.nodes[:, 1]
nv = cube.mesh.faces
return tri.Triangulation(lon, lat, triangles=nv) | ioos/comt | [
1,
7,
1,
16,
1401373926
] |
def plot_model(model):
cube = cubes[model]
lon = cube.mesh.nodes[:, 0]
lat = cube.mesh.nodes[:, 1]
ind = -1 # just take the last time index for now
zcube = cube[ind]
triang = tris[model]
fig, ax = plt.subplots(figsize=(7, 7),
subplot_kw=dict(projection=ccrs.PlateC... | ioos/comt | [
1,
7,
1,
16,
1401373926
] |
def acquire_single_linear_frequency_span(file_name, start_freq=None,
stop_freq=None, center_freq=None,
span=None, nr_avg=1, sweep_mode='auto',
nbr_points=101, power=-20,
... | DiCarloLab-Delft/PycQED_py3 | [
51,
39,
51,
31,
1451987534
] |
def acquire_linear_frequency_span_vs_power(file_name, start_freq=None,
stop_freq=None, center_freq=None,
start_power=None, stop_power=None,
step_power=2,
span=None, nbr_poi... | DiCarloLab-Delft/PycQED_py3 | [
51,
39,
51,
31,
1451987534
] |
def acquire_2D_linear_frequency_span_vs_param(file_name, start_freq=None,
stop_freq=None, center_freq=None,
parameter=None, sweep_vector=None,
span=None, nbr_points=101, power=-20,
... | DiCarloLab-Delft/PycQED_py3 | [
51,
39,
51,
31,
1451987534
] |
def acquire_disjoint_frequency_traces(file_name, list_freq_ranges,
power=-20,
bandwidth=100, measure='S21'):
"""
list_freq_ranges is a list that contains the arays defining all the ranges of interest.
"""
for idx, range_array in... | DiCarloLab-Delft/PycQED_py3 | [
51,
39,
51,
31,
1451987534
] |
def __init__(self):
self.counter=0 | DiCarloLab-Delft/PycQED_py3 | [
51,
39,
51,
31,
1451987534
] |
def wrapped_data_importing(counter):
counter.counter += 1
return data_vector[:,counter.counter-1] | DiCarloLab-Delft/PycQED_py3 | [
51,
39,
51,
31,
1451987534
] |
def look_in_file(file_name, kws):
"""reads a file and returns only the lines that contain one of the keywords"""
with open(file_name) as f:
return "".join(filter(lambda line: any(kw in line for kw in kws), f)) | AlManja/logs.py | [
5,
2,
5,
1,
1485538333
] |
def __init__(self, parent=None):
super(Window, self).__init__(parent)
self.checks = [False]*len(checkbuttons) # initialize all buttons to False
# creates a vertical box layout for the window
vlayout = QtGui.QVBoxLayout()
# creates the checkboxes
for idx, text in enumer... | AlManja/logs.py | [
5,
2,
5,
1,
1485538333
] |
def to_computer(self, text):
f = open(TMP_FILE, 'w') # write mode clears any previous content from the file if it exists
if self.checks[0]:
print("Saving: inxi to file")
f.write(HEADER.format("Inxi -Fxzc0", "Listing computer information"))
try:
f.wri... | AlManja/logs.py | [
5,
2,
5,
1,
1485538333
] |
def __init__(self, typ=None, intensity=0, size=0, gen=0, cho=0):
self._type = typ #"n1", "n2", "bg", "ch", "ge"
if intensity<0 or gen<0 or cho<0 or size<0 or intensity>1 or size>1 or gen>1 or cho>1:
raise ValueError ("Invalid Values for Structure Part")
self._intensity = intensity # ... | joaoperfig/mikezart | [
31,
3,
31,
1,
1499422629
] |
def fromString(cls, string): # [n1-0.123-1-0.321-0.2] type, intensity, size, genoverlay, chooverlay
while string[0] == " ":
string = string[1:]
while string[0] == "\n":
string = string[1:]
while string[-1] == " ":
string = string[:-1]
while string[-1] ... | joaoperfig/mikezart | [
31,
3,
31,
1,
1499422629
] |
def getTheme(self, pal):
if self._type == "n1":
return pal._n1
if self._type == "n2":
return pal._n2
if self._type == "bg":
return pal._bg
if self._type == "ch":
return pal._ch
if self._type == "ge":
return pal._ge | joaoperfig/mikezart | [
31,
3,
31,
1,
1499422629
] |
def getAudio(self, pal, bpm):
base = self.baseDur(pal, bpm)
total = base + 3000 #extra time for last note to play
nvoic = math.ceil(self._intensity * self.getTheme(pal).countVoices())
try:
ngeno = math.ceil(self._genover * pal._ge.countVoices())
except:
ng... | joaoperfig/mikezart | [
31,
3,
31,
1,
1499422629
] |
def baseDur(self, pal, bpm): #get the base duration of this part of the song
return self.getTheme(pal).baseDurForStruct(self._size, bpm) | joaoperfig/mikezart | [
31,
3,
31,
1,
1499422629
] |
def __init__(self):
self._parts = () | joaoperfig/mikezart | [
31,
3,
31,
1,
1499422629
] |
def __repr__(self):
return "@STRUCTURE:" + str(self._parts) | joaoperfig/mikezart | [
31,
3,
31,
1,
1499422629
] |
def baseDur(self, pal, bpm=None):
if bpm == None:
bpm = pal._bpm
curTime = 0
for p in self._parts:
curTime = curTime + p.baseDur(pal, bpm)
return curTime | joaoperfig/mikezart | [
31,
3,
31,
1,
1499422629
] |
def songAudio(self, pal, bpm=None):
if bpm == None:
bpm = pal._bpm
total = self.baseDur(pal, bpm) + 3000 # 3 seconds for last note to play
sound = AudioSegment.silent(total)
curTime = 0
for p in self._parts:
paudio = p.getAudio(pal, bpm)
sound ... | joaoperfig/mikezart | [
31,
3,
31,
1,
1499422629
] |
def wselect(dicti):
total=0
for i in list(dicti):
total = total + dicti[i]
indice = total*random.random()
for i in list(dicti):
if dicti[i]>=indice:
return i
indice = indice - dicti[i]
raise ValueError ("something went wrong") | joaoperfig/mikezart | [
31,
3,
31,
1,
1499422629
] |
def rselect(lista):
return random.choice(lista) | joaoperfig/mikezart | [
31,
3,
31,
1,
1499422629
] |
def stweights():
return {"n1":5, "n2":4, "ch":2, "bg":1} | joaoperfig/mikezart | [
31,
3,
31,
1,
1499422629
] |
def n2weights():
return {"n1":2, "n2":3, "ch":4, "bg":2} | joaoperfig/mikezart | [
31,
3,
31,
1,
1499422629
] |
def bgweights():
return {"n1":1, "n2":1, "ch":20, "bg":8} | joaoperfig/mikezart | [
31,
3,
31,
1,
1499422629
] |
def siweights():
return {0.1:1, 0.2:2, 0.3:4, 0.4:5, 0.5:5, 0.6:4, 0.7:3, 0.8:2, 0.9:1} | joaoperfig/mikezart | [
31,
3,
31,
1,
1499422629
] |
def intensitySequence(size):
val = wselect(siweights())
sequence = (val,)
while len(sequence)<size:
val = val + wselect(deltaweights())
if val<0.1:
val = 0.1
if val>1:
val = 1
sequence = sequence + (val,)
return sequence | joaoperfig/mikezart | [
31,
3,
31,
1,
1499422629
] |
def deltoweights():
return {-0.2:1, -0.1:1, 0:8, 0.1:2, 0.2:2} | joaoperfig/mikezart | [
31,
3,
31,
1,
1499422629
] |
def ssweights():
return {0.2:1, 0.4:1, 0.6:1, 0.8:1, 1:16} | joaoperfig/mikezart | [
31,
3,
31,
1,
1499422629
] |
def makeStruct(size = None):
if size == None:
size = wselect(lenweights())
types = typeSequence(size)
inten = intensitySequence(size)
sizes = sizeSequence(size)
overl = overlaySequence(size)
return joinSeqs(types, inten, sizes, overl) | joaoperfig/mikezart | [
31,
3,
31,
1,
1499422629
] |
def pooptest():
for i in range(30):
print(makeStruct()) | joaoperfig/mikezart | [
31,
3,
31,
1,
1499422629
] |
def _get_tmp_filename(suffix=".pdf"):
with tempfile.NamedTemporaryFile(suffix=".pdf") as fh:
return fh.name | yourcelf/signpdf | [
54,
31,
54,
7,
1429985356
] |
def main():
sign_pdf(parser.parse_args()) | yourcelf/signpdf | [
54,
31,
54,
7,
1429985356
] |
def atexit():
print("atexit") | nicfit/nicfit.py | [
3,
2,
3,
42,
1480807314
] |
def find_package_data(
where='.', package='',
exclude=standard_exclude,
exclude_directories=standard_exclude_directories,
only_in_packages=True,
show_ignored=False):
"""
Return a dictionary suitable for use in ``package_data``
in a distutils ``setup.py`` file.
Th... | tylerbutler/engineer | [
23,
3,
23,
1,
1331695786
] |
def get_install_requirements(requirements_file='requirements.txt'):
requirements = []
with open(requirements_file) as file:
temp = file.readlines()
temp = [i[:-1] for i in temp]
for line in temp:
if line is None or line == '' or line.startswith(('#', '-e', '-r')):
... | tylerbutler/engineer | [
23,
3,
23,
1,
1331695786
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.