body_hash
stringlengths
64
64
body
stringlengths
23
109k
docstring
stringlengths
1
57k
path
stringlengths
4
198
name
stringlengths
1
115
repository_name
stringlengths
7
111
repository_stars
float64
0
191k
lang
stringclasses
1 value
body_without_docstring
stringlengths
14
108k
unified
stringlengths
45
133k
0fe60dab3976e9587ed5c89b802523db38bbc451ce116b9f7a4242ab0884bcc7
def tablewrite(self): ' Writing the results to a excel file ' wb = openpyxl.load_workbook(self.master) ws = wb.active row_count = 3 row = 3 p_number = TimeCalc(readfile).pnumber() time = TimeCalc(readfile).results() count_var = 0 while (ws.cell(row=row_count, column=2).value != None)...
Writing the results to a excel file
Tidskalkyle.py
tablewrite
UniQueKakarot/Tidskalkyle
0
python
def tablewrite(self): ' ' wb = openpyxl.load_workbook(self.master) ws = wb.active row_count = 3 row = 3 p_number = TimeCalc(readfile).pnumber() time = TimeCalc(readfile).results() count_var = 0 while (ws.cell(row=row_count, column=2).value != None): if (ws.cell(row=row_count...
def tablewrite(self): ' ' wb = openpyxl.load_workbook(self.master) ws = wb.active row_count = 3 row = 3 p_number = TimeCalc(readfile).pnumber() time = TimeCalc(readfile).results() count_var = 0 while (ws.cell(row=row_count, column=2).value != None): if (ws.cell(row=row_count...
2c3f099578c46d35c34da2dd7a9a89a288347a1bac0b8c0f80ea378123c3bbdf
def _get_font(self, prop): '\n Find the `FT2Font` matching font properties *prop*, with its size set.\n ' fname = font_manager.findfont(prop) font = get_font(fname) font.set_size(self.FONT_SCALE, self.DPI) return font
Find the `FT2Font` matching font properties *prop*, with its size set.
venv/lib/python3.9/site-packages/matplotlib/textpath.py
_get_font
LucaCilibrasi/docker_viruclust
603
python
def _get_font(self, prop): '\n \n ' fname = font_manager.findfont(prop) font = get_font(fname) font.set_size(self.FONT_SCALE, self.DPI) return font
def _get_font(self, prop): '\n \n ' fname = font_manager.findfont(prop) font = get_font(fname) font.set_size(self.FONT_SCALE, self.DPI) return font<|docstring|>Find the `FT2Font` matching font properties *prop*, with its size set.<|endoftext|>
f893c6df0f5b6c7bfa5690f5ca1309a381289fc9e097bf6fc86f74533e52cf49
def _get_char_id(self, font, ccode): '\n Return a unique id for the given font and character-code set.\n ' return urllib.parse.quote(f'{font.postscript_name}-{ccode:x}')
Return a unique id for the given font and character-code set.
venv/lib/python3.9/site-packages/matplotlib/textpath.py
_get_char_id
LucaCilibrasi/docker_viruclust
603
python
def _get_char_id(self, font, ccode): '\n \n ' return urllib.parse.quote(f'{font.postscript_name}-{ccode:x}')
def _get_char_id(self, font, ccode): '\n \n ' return urllib.parse.quote(f'{font.postscript_name}-{ccode:x}')<|docstring|>Return a unique id for the given font and character-code set.<|endoftext|>
38726d7dfb0e3ddd0ee81b8fa6f4303085621440f6a1a4ebe75df302fe2f9ba2
def get_text_path(self, prop, s, ismath=False): '\n Convert text *s* to path (a tuple of vertices and codes for\n matplotlib.path.Path).\n\n Parameters\n ----------\n prop : `~matplotlib.font_manager.FontProperties`\n The font properties for the text.\n\n s : str...
Convert text *s* to path (a tuple of vertices and codes for matplotlib.path.Path). Parameters ---------- prop : `~matplotlib.font_manager.FontProperties` The font properties for the text. s : str The text to be converted. ismath : {False, True, "TeX"} If True, use mathtext parser. If "TeX", use tex for ...
venv/lib/python3.9/site-packages/matplotlib/textpath.py
get_text_path
LucaCilibrasi/docker_viruclust
603
python
def get_text_path(self, prop, s, ismath=False): '\n Convert text *s* to path (a tuple of vertices and codes for\n matplotlib.path.Path).\n\n Parameters\n ----------\n prop : `~matplotlib.font_manager.FontProperties`\n The font properties for the text.\n\n s : str...
def get_text_path(self, prop, s, ismath=False): '\n Convert text *s* to path (a tuple of vertices and codes for\n matplotlib.path.Path).\n\n Parameters\n ----------\n prop : `~matplotlib.font_manager.FontProperties`\n The font properties for the text.\n\n s : str...
c5c531c0411522c9fc973972bcc1152029375189202210b5f2b65f379258e031
def get_glyphs_with_font(self, font, s, glyph_map=None, return_new_glyphs_only=False): '\n Convert string *s* to vertices and codes using the provided ttf font.\n ' if (glyph_map is None): glyph_map = OrderedDict() if return_new_glyphs_only: glyph_map_new = OrderedDict() el...
Convert string *s* to vertices and codes using the provided ttf font.
venv/lib/python3.9/site-packages/matplotlib/textpath.py
get_glyphs_with_font
LucaCilibrasi/docker_viruclust
603
python
def get_glyphs_with_font(self, font, s, glyph_map=None, return_new_glyphs_only=False): '\n \n ' if (glyph_map is None): glyph_map = OrderedDict() if return_new_glyphs_only: glyph_map_new = OrderedDict() else: glyph_map_new = glyph_map xpositions = [] glyph_i...
def get_glyphs_with_font(self, font, s, glyph_map=None, return_new_glyphs_only=False): '\n \n ' if (glyph_map is None): glyph_map = OrderedDict() if return_new_glyphs_only: glyph_map_new = OrderedDict() else: glyph_map_new = glyph_map xpositions = [] glyph_i...
2295d303f70aabc281b061fd59ec233e7d19c803f75b46f7fc3ee11c97def680
def get_glyphs_mathtext(self, prop, s, glyph_map=None, return_new_glyphs_only=False): '\n Parse mathtext string *s* and convert it to a (vertices, codes) pair.\n ' prop = prop.copy() prop.set_size(self.FONT_SCALE) (width, height, descent, glyphs, rects) = self.mathtext_parser.parse(s, self...
Parse mathtext string *s* and convert it to a (vertices, codes) pair.
venv/lib/python3.9/site-packages/matplotlib/textpath.py
get_glyphs_mathtext
LucaCilibrasi/docker_viruclust
603
python
def get_glyphs_mathtext(self, prop, s, glyph_map=None, return_new_glyphs_only=False): '\n \n ' prop = prop.copy() prop.set_size(self.FONT_SCALE) (width, height, descent, glyphs, rects) = self.mathtext_parser.parse(s, self.DPI, prop) if (not glyph_map): glyph_map = OrderedDict()...
def get_glyphs_mathtext(self, prop, s, glyph_map=None, return_new_glyphs_only=False): '\n \n ' prop = prop.copy() prop.set_size(self.FONT_SCALE) (width, height, descent, glyphs, rects) = self.mathtext_parser.parse(s, self.DPI, prop) if (not glyph_map): glyph_map = OrderedDict()...
72c8cda8696be61bd098cf8b652f6bb7ac7a394ebfc0f68b895b20b5dda4a2e1
def get_texmanager(self): 'Return the cached `~.texmanager.TexManager` instance.' if (self._texmanager is None): from matplotlib.texmanager import TexManager self._texmanager = TexManager() return self._texmanager
Return the cached `~.texmanager.TexManager` instance.
venv/lib/python3.9/site-packages/matplotlib/textpath.py
get_texmanager
LucaCilibrasi/docker_viruclust
603
python
def get_texmanager(self): if (self._texmanager is None): from matplotlib.texmanager import TexManager self._texmanager = TexManager() return self._texmanager
def get_texmanager(self): if (self._texmanager is None): from matplotlib.texmanager import TexManager self._texmanager = TexManager() return self._texmanager<|docstring|>Return the cached `~.texmanager.TexManager` instance.<|endoftext|>
c229b3f699de4e4c008f31d95b24a48db72cd5ca4f69466e614472f80459ca05
def get_glyphs_tex(self, prop, s, glyph_map=None, return_new_glyphs_only=False): 'Convert the string *s* to vertices and codes using usetex mode.' dvifile = self.get_texmanager().make_dvi(s, self.FONT_SCALE) with dviread.Dvi(dvifile, self.DPI) as dvi: (page,) = dvi if (glyph_map is None): ...
Convert the string *s* to vertices and codes using usetex mode.
venv/lib/python3.9/site-packages/matplotlib/textpath.py
get_glyphs_tex
LucaCilibrasi/docker_viruclust
603
python
def get_glyphs_tex(self, prop, s, glyph_map=None, return_new_glyphs_only=False): dvifile = self.get_texmanager().make_dvi(s, self.FONT_SCALE) with dviread.Dvi(dvifile, self.DPI) as dvi: (page,) = dvi if (glyph_map is None): glyph_map = OrderedDict() if return_new_glyphs_only: ...
def get_glyphs_tex(self, prop, s, glyph_map=None, return_new_glyphs_only=False): dvifile = self.get_texmanager().make_dvi(s, self.FONT_SCALE) with dviread.Dvi(dvifile, self.DPI) as dvi: (page,) = dvi if (glyph_map is None): glyph_map = OrderedDict() if return_new_glyphs_only: ...
b8f82f6009e6185a9726e2e2d75e53092b03bec77b4cc445cb793915a14f2e25
def __init__(self, xy, s, size=None, prop=None, _interpolation_steps=1, usetex=False): '\n Create a path from the text. Note that it simply is a path,\n not an artist. You need to use the `~.PathPatch` (or other artists)\n to draw this path onto the canvas.\n\n Parameters\n ------...
Create a path from the text. Note that it simply is a path, not an artist. You need to use the `~.PathPatch` (or other artists) to draw this path onto the canvas. Parameters ---------- xy : tuple or array of two float values Position of the text. For no offset, use ``xy=(0, 0)``. s : str The text to convert t...
venv/lib/python3.9/site-packages/matplotlib/textpath.py
__init__
LucaCilibrasi/docker_viruclust
603
python
def __init__(self, xy, s, size=None, prop=None, _interpolation_steps=1, usetex=False): '\n Create a path from the text. Note that it simply is a path,\n not an artist. You need to use the `~.PathPatch` (or other artists)\n to draw this path onto the canvas.\n\n Parameters\n ------...
def __init__(self, xy, s, size=None, prop=None, _interpolation_steps=1, usetex=False): '\n Create a path from the text. Note that it simply is a path,\n not an artist. You need to use the `~.PathPatch` (or other artists)\n to draw this path onto the canvas.\n\n Parameters\n ------...
f2ee19757d1e1bacdc0b8f52979dd781e364f993c0eb40a5cb890f5c740c88da
def set_size(self, size): 'Set the text size.' self._size = size self._invalid = True
Set the text size.
venv/lib/python3.9/site-packages/matplotlib/textpath.py
set_size
LucaCilibrasi/docker_viruclust
603
python
def set_size(self, size): self._size = size self._invalid = True
def set_size(self, size): self._size = size self._invalid = True<|docstring|>Set the text size.<|endoftext|>
7ea810a06dccae9c916cc724be1c192543ae5d4d3a65e6a8faed5dbf4c730c0d
def get_size(self): 'Get the text size.' return self._size
Get the text size.
venv/lib/python3.9/site-packages/matplotlib/textpath.py
get_size
LucaCilibrasi/docker_viruclust
603
python
def get_size(self): return self._size
def get_size(self): return self._size<|docstring|>Get the text size.<|endoftext|>
1e9e6e023c2ffb034aac8f06e1da597efdb6d94fdfd9ad0fc9e45671d32b3de2
@property def vertices(self): '\n Return the cached path after updating it if necessary.\n ' self._revalidate_path() return self._cached_vertices
Return the cached path after updating it if necessary.
venv/lib/python3.9/site-packages/matplotlib/textpath.py
vertices
LucaCilibrasi/docker_viruclust
603
python
@property def vertices(self): '\n \n ' self._revalidate_path() return self._cached_vertices
@property def vertices(self): '\n \n ' self._revalidate_path() return self._cached_vertices<|docstring|>Return the cached path after updating it if necessary.<|endoftext|>
f19c9c2ecf69fde51a4359c921cf0a5b521ad5a82c6c56ce67e73e52b709b375
@property def codes(self): '\n Return the codes\n ' return self._codes
Return the codes
venv/lib/python3.9/site-packages/matplotlib/textpath.py
codes
LucaCilibrasi/docker_viruclust
603
python
@property def codes(self): '\n \n ' return self._codes
@property def codes(self): '\n \n ' return self._codes<|docstring|>Return the codes<|endoftext|>
fffc71f6c3813fc5d87e8761a3526277499a26d539ce2fb6b180e6dbc99314f0
def _revalidate_path(self): '\n Update the path if necessary.\n\n The path for the text is initially create with the font size of\n `~.FONT_SCALE`, and this path is rescaled to other size when necessary.\n ' if (self._invalid or (self._cached_vertices is None)): tr = Affine2D...
Update the path if necessary. The path for the text is initially create with the font size of `~.FONT_SCALE`, and this path is rescaled to other size when necessary.
venv/lib/python3.9/site-packages/matplotlib/textpath.py
_revalidate_path
LucaCilibrasi/docker_viruclust
603
python
def _revalidate_path(self): '\n Update the path if necessary.\n\n The path for the text is initially create with the font size of\n `~.FONT_SCALE`, and this path is rescaled to other size when necessary.\n ' if (self._invalid or (self._cached_vertices is None)): tr = Affine2D...
def _revalidate_path(self): '\n Update the path if necessary.\n\n The path for the text is initially create with the font size of\n `~.FONT_SCALE`, and this path is rescaled to other size when necessary.\n ' if (self._invalid or (self._cached_vertices is None)): tr = Affine2D...
df1587f9f89722254ed4b8ee56b7b73b5e8761f6db7e390d4ce93a701397e1e9
def test_plot_gp_dist(self): 'Test that the plotting helper works with the stated input shapes.' import matplotlib.pyplot as plt X = 100 S = 500 (fig, ax) = plt.subplots() pm.gp.util.plot_gp_dist(ax, x=np.linspace(0, 50, X), samples=np.random.normal(np.arange(X), size=(S, X))) plt.close() ...
Test that the plotting helper works with the stated input shapes.
pymc/tests/test_gp.py
test_plot_gp_dist
xjing76/pymc
5,476
python
def test_plot_gp_dist(self): import matplotlib.pyplot as plt X = 100 S = 500 (fig, ax) = plt.subplots() pm.gp.util.plot_gp_dist(ax, x=np.linspace(0, 50, X), samples=np.random.normal(np.arange(X), size=(S, X))) plt.close() pass
def test_plot_gp_dist(self): import matplotlib.pyplot as plt X = 100 S = 500 (fig, ax) = plt.subplots() pm.gp.util.plot_gp_dist(ax, x=np.linspace(0, 50, X), samples=np.random.normal(np.arange(X), size=(S, X))) plt.close() pass<|docstring|>Test that the plotting helper works with the sta...
1ce0f7fe8b684c93437693b2e852b3e1f6d70e36685d6a2e20520fc4ad5e70db
def test_plot_gp_dist_warn_nan(self): 'Test that the plotting helper works with the stated input shapes.' import matplotlib.pyplot as plt X = 100 S = 500 samples = np.random.normal(np.arange(X), size=(S, X)) samples[(15, 3)] = np.nan (fig, ax) = plt.subplots() with pytest.warns(UserWarni...
Test that the plotting helper works with the stated input shapes.
pymc/tests/test_gp.py
test_plot_gp_dist_warn_nan
xjing76/pymc
5,476
python
def test_plot_gp_dist_warn_nan(self): import matplotlib.pyplot as plt X = 100 S = 500 samples = np.random.normal(np.arange(X), size=(S, X)) samples[(15, 3)] = np.nan (fig, ax) = plt.subplots() with pytest.warns(UserWarning): pm.gp.util.plot_gp_dist(ax, x=np.linspace(0, 50, X), s...
def test_plot_gp_dist_warn_nan(self): import matplotlib.pyplot as plt X = 100 S = 500 samples = np.random.normal(np.arange(X), size=(S, X)) samples[(15, 3)] = np.nan (fig, ax) = plt.subplots() with pytest.warns(UserWarning): pm.gp.util.plot_gp_dist(ax, x=np.linspace(0, 50, X), s...
266262ca5e9011b745ea2523193c677617c6ccbb7eaea5f474083bfe16ba29f3
@task(ignore_result=True) def import_data(import_pk, request_POST): "\n Run contacts import in the background, import_contacts is a dict:\n {'line_number ': {\n 'target: 'new' or 'id' # Create new contact or update 'id'\n 'form': {} # form for contact\n }, }\n of ...
Run contacts import in the background, import_contacts is a dict: {'line_number ': { 'target: 'new' or 'id' # Create new contact or update 'id' 'form': {} # form for contact }, } of contact to import/create or update
djangoplicity/contacts/tasks.py
import_data
djangoplicity/djangoplicity-contacts
0
python
@task(ignore_result=True) def import_data(import_pk, request_POST): "\n Run contacts import in the background, import_contacts is a dict:\n {'line_number ': {\n 'target: 'new' or 'id' # Create new contact or update 'id'\n 'form': {} # form for contact\n }, }\n of ...
@task(ignore_result=True) def import_data(import_pk, request_POST): "\n Run contacts import in the background, import_contacts is a dict:\n {'line_number ': {\n 'target: 'new' or 'id' # Create new contact or update 'id'\n 'form': {} # form for contact\n }, }\n of ...
5c715c5dc8f2ac35eac51142a7a22840ff2912393ba9593ba59342e2d666614f
@task(ignore_result=True) def prepare_import(import_pk, email): '\n Look for potential duplicates in import\n ' logger = prepare_import.get_logger() from djangoplicity.contacts.models import Import obj = Import.objects.get(pk=import_pk) if obj.prepare_import(): obj.status = 'review' ...
Look for potential duplicates in import
djangoplicity/contacts/tasks.py
prepare_import
djangoplicity/djangoplicity-contacts
0
python
@task(ignore_result=True) def prepare_import(import_pk, email): '\n \n ' logger = prepare_import.get_logger() from djangoplicity.contacts.models import Import obj = Import.objects.get(pk=import_pk) if obj.prepare_import(): obj.status = 'review' obj.save() logger.warning...
@task(ignore_result=True) def prepare_import(import_pk, email): '\n \n ' logger = prepare_import.get_logger() from djangoplicity.contacts.models import Import obj = Import.objects.get(pk=import_pk) if obj.prepare_import(): obj.status = 'review' obj.save() logger.warning...
3ba8d54c16a06ecc8d25855a271e2fba54a9ef6a0eec246c83e52117beacc869
@task(ignore_result=True) def run_deduplication(deduplication_pk, email): '\n Look for potential duplicates in groups selected in deduplication\n ' logger = run_deduplication.get_logger() from djangoplicity.contacts.models import Deduplication dedup = Deduplication.objects.get(pk=deduplication_pk)...
Look for potential duplicates in groups selected in deduplication
djangoplicity/contacts/tasks.py
run_deduplication
djangoplicity/djangoplicity-contacts
0
python
@task(ignore_result=True) def run_deduplication(deduplication_pk, email): '\n \n ' logger = run_deduplication.get_logger() from djangoplicity.contacts.models import Deduplication dedup = Deduplication.objects.get(pk=deduplication_pk) if dedup.run(): dedup.status = 'review' dedu...
@task(ignore_result=True) def run_deduplication(deduplication_pk, email): '\n \n ' logger = run_deduplication.get_logger() from djangoplicity.contacts.models import Deduplication dedup = Deduplication.objects.get(pk=deduplication_pk) if dedup.run(): dedup.status = 'review' dedu...
2148b39f9fb91400c3aa89d7dcb42a4c41ed6861c5568ab01c9c6e6c143ffe8f
def _get_group(self, group_name): '\n Get a group by its name\n ' from djangoplicity.contacts.models import ContactGroup return ContactGroup.objects.get(name=group_name)
Get a group by its name
djangoplicity/contacts/tasks.py
_get_group
djangoplicity/djangoplicity-contacts
0
python
def _get_group(self, group_name): '\n \n ' from djangoplicity.contacts.models import ContactGroup return ContactGroup.objects.get(name=group_name)
def _get_group(self, group_name): '\n \n ' from djangoplicity.contacts.models import ContactGroup return ContactGroup.objects.get(name=group_name)<|docstring|>Get a group by its name<|endoftext|>
eab22337c3b5bc55772047d919e400906f9e85faf51676822e87012e4c3d7fc8
def _get_object(self, model_identifier, pk): '\n Helper method to get the object by model_identifier and primiary key ( e.g "contacts.contact" and 2579 )\n ' Model = apps.get_model(*model_identifier.split('.')) return Model.objects.get(pk=pk)
Helper method to get the object by model_identifier and primiary key ( e.g "contacts.contact" and 2579 )
djangoplicity/contacts/tasks.py
_get_object
djangoplicity/djangoplicity-contacts
0
python
def _get_object(self, model_identifier, pk): '\n \n ' Model = apps.get_model(*model_identifier.split('.')) return Model.objects.get(pk=pk)
def _get_object(self, model_identifier, pk): '\n \n ' Model = apps.get_model(*model_identifier.split('.')) return Model.objects.get(pk=pk)<|docstring|>Helper method to get the object by model_identifier and primiary key ( e.g "contacts.contact" and 2579 )<|endoftext|>
1c39aa550c7cbdb92e1f94cac00deb827d6e19ff28ae0412ec8772db9a08a4e8
def run(self, conf, model_identifier=None, pk=None, **kwargs): '\n Update contact based on new field values in kwargs.\n ' from djangoplicity.contacts.models import Contact if ((model_identifier == 'contacts.contact') and pk): contact = self._get_object(model_identifier, pk) de...
Update contact based on new field values in kwargs.
djangoplicity/contacts/tasks.py
run
djangoplicity/djangoplicity-contacts
0
python
def run(self, conf, model_identifier=None, pk=None, **kwargs): '\n \n ' from djangoplicity.contacts.models import Contact if ((model_identifier == 'contacts.contact') and pk): contact = self._get_object(model_identifier, pk) defaults = {} g_names = [] for (k, v)...
def run(self, conf, model_identifier=None, pk=None, **kwargs): '\n \n ' from djangoplicity.contacts.models import Contact if ((model_identifier == 'contacts.contact') and pk): contact = self._get_object(model_identifier, pk) defaults = {} g_names = [] for (k, v)...
14061c5a2c414fda2be3642194ee405a245fe71ba3a7556a2ffc31041c7d6fd4
def run(self, conf, list_id=None, new_email=None, old_email=None, **kwargs): '\n Update contact email based on new field values in kwargs.\n ' from djangoplicity.contacts.models import Contact from djangoplicity.mailinglists.models import MailChimpList if (list_id and new_email and old_ema...
Update contact email based on new field values in kwargs.
djangoplicity/contacts/tasks.py
run
djangoplicity/djangoplicity-contacts
0
python
def run(self, conf, list_id=None, new_email=None, old_email=None, **kwargs): '\n \n ' from djangoplicity.contacts.models import Contact from djangoplicity.mailinglists.models import MailChimpList if (list_id and new_email and old_email): contact = None try: m_li...
def run(self, conf, list_id=None, new_email=None, old_email=None, **kwargs): '\n \n ' from djangoplicity.contacts.models import Contact from djangoplicity.mailinglists.models import MailChimpList if (list_id and new_email and old_email): contact = None try: m_li...
9bc190838ae271a22f771014064921bc2d14a23bf1f5bedb29f175449393f837
def run(self, conf, model_identifier=None, pk=None, **kwargs): '\n Create contact based on new field values in kwargs.\n ' from djangoplicity.contacts.models import Contact if (not model_identifier): model_identifier = 'contacts.contact' if ((model_identifier == 'contacts.contact')...
Create contact based on new field values in kwargs.
djangoplicity/contacts/tasks.py
run
djangoplicity/djangoplicity-contacts
0
python
def run(self, conf, model_identifier=None, pk=None, **kwargs): '\n \n ' from djangoplicity.contacts.models import Contact if (not model_identifier): model_identifier = 'contacts.contact' if ((model_identifier == 'contacts.contact') and (pk is None)): defaults = {} g...
def run(self, conf, model_identifier=None, pk=None, **kwargs): '\n \n ' from djangoplicity.contacts.models import Contact if (not model_identifier): model_identifier = 'contacts.contact' if ((model_identifier == 'contacts.contact') and (pk is None)): defaults = {} g...
15648c36968b2321f66d629edcde01231f2d5b5bc5bf91946de6cdbd298f384c
def run(self, conf, model_identifier=None, pk=None): '\n Add a contact to a group\n ' if ((model_identifier == 'contacts.contact') and pk): contact = self._get_object(model_identifier, pk) group = self._get_group(conf['group']) contact.groups.add(group) self.get_log...
Add a contact to a group
djangoplicity/contacts/tasks.py
run
djangoplicity/djangoplicity-contacts
0
python
def run(self, conf, model_identifier=None, pk=None): '\n \n ' if ((model_identifier == 'contacts.contact') and pk): contact = self._get_object(model_identifier, pk) group = self._get_group(conf['group']) contact.groups.add(group) self.get_logger().info(('Added conta...
def run(self, conf, model_identifier=None, pk=None): '\n \n ' if ((model_identifier == 'contacts.contact') and pk): contact = self._get_object(model_identifier, pk) group = self._get_group(conf['group']) contact.groups.add(group) self.get_logger().info(('Added conta...
609a6db3a99ac39183e5a244dc34007e041fae97e6fa75a0f67126b474de599a
def run(self, conf, model_identifier=None, pk=None): '\n Remove from a group from a contact.\n ' if ((model_identifier == 'contacts.contact') and pk): contact = self._get_object(model_identifier, pk) group = self._get_group(conf['group']) contact.groups.remove(group) ...
Remove from a group from a contact.
djangoplicity/contacts/tasks.py
run
djangoplicity/djangoplicity-contacts
0
python
def run(self, conf, model_identifier=None, pk=None): '\n \n ' if ((model_identifier == 'contacts.contact') and pk): contact = self._get_object(model_identifier, pk) group = self._get_group(conf['group']) contact.groups.remove(group) self.get_logger().info(('Removed ...
def run(self, conf, model_identifier=None, pk=None): '\n \n ' if ((model_identifier == 'contacts.contact') and pk): contact = self._get_object(model_identifier, pk) group = self._get_group(conf['group']) contact.groups.remove(group) self.get_logger().info(('Removed ...
72f73c27a6431f38f469cbd4a780e23cefe1586b14efd6d461937b928902afc0
def run(self, conf, email=None): '\n Remove from a group from a contact.\n ' from djangoplicity.contacts.models import Contact if email: num = 0 if conf['clear']: num = Contact.objects.filter(email__iexact=email).update(email='') elif conf['append']: ...
Remove from a group from a contact.
djangoplicity/contacts/tasks.py
run
djangoplicity/djangoplicity-contacts
0
python
def run(self, conf, email=None): '\n \n ' from djangoplicity.contacts.models import Contact if email: num = 0 if conf['clear']: num = Contact.objects.filter(email__iexact=email).update(email=) elif conf['append']: num = Contact.objects.filter(ema...
def run(self, conf, email=None): '\n \n ' from djangoplicity.contacts.models import Contact if email: num = 0 if conf['clear']: num = Contact.objects.filter(email__iexact=email).update(email=) elif conf['append']: num = Contact.objects.filter(ema...
cfd541e474bd9e04ea6d9ba135238bf8f08349d96cd6aff7a7826ffd36c64a18
def test_abstract_rule_repr_method(): '\n Проверяем, что у экземпляров отнаследованного класса корректно работает строковая репрезентация содержимого.\n ' class KekRule(AbstractRule): def prove_source(self): return False assert (str(KekRule('kek', None)) == 'KekRule("kek")')
Проверяем, что у экземпляров отнаследованного класса корректно работает строковая репрезентация содержимого.
polog/tests/handlers/file/rotation/rules/rules/test_abstract_rule.py
test_abstract_rule_repr_method
pomponchik/polog
30
python
def test_abstract_rule_repr_method(): '\n \n ' class KekRule(AbstractRule): def prove_source(self): return False assert (str(KekRule('kek', None)) == 'KekRule("kek")')
def test_abstract_rule_repr_method(): '\n \n ' class KekRule(AbstractRule): def prove_source(self): return False assert (str(KekRule('kek', None)) == 'KekRule("kek")')<|docstring|>Проверяем, что у экземпляров отнаследованного класса корректно работает строковая репрезентация соде...
15f7161eddc91e9cd6e958a9c331f6912584b1a3ea04b68a359f3e7a9fa1a36d
def test_docs(): 'Just tests for a 200 code' response = client.get('/') assert (response.status_code == 200)
Just tests for a 200 code
app/tests/test_main.py
test_docs
optimal-airbnb/ds
0
python
def test_docs(): response = client.get('/') assert (response.status_code == 200)
def test_docs(): response = client.get('/') assert (response.status_code == 200)<|docstring|>Just tests for a 200 code<|endoftext|>
76332bd01e1ea70d07b099dea3254e9149cc208eab48dc3757ab1dc8f2e55b41
def symbols(names, **args): "\n Transform strings into instances of :class:`Symbol` class.\n\n :func:`symbols` function returns a sequence of symbols with names taken\n from ``names`` argument, which can be a comma or whitespace delimited\n string, or a sequence of strings::\n\n >>> from sympy im...
Transform strings into instances of :class:`Symbol` class. :func:`symbols` function returns a sequence of symbols with names taken from ``names`` argument, which can be a comma or whitespace delimited string, or a sequence of strings:: >>> from sympy import symbols, Function >>> x, y, z = symbols('x,y,z') ...
sympy/core/symbol.py
symbols
cielavenir/sympy
2
python
def symbols(names, **args): "\n Transform strings into instances of :class:`Symbol` class.\n\n :func:`symbols` function returns a sequence of symbols with names taken\n from ``names`` argument, which can be a comma or whitespace delimited\n string, or a sequence of strings::\n\n >>> from sympy im...
def symbols(names, **args): "\n Transform strings into instances of :class:`Symbol` class.\n\n :func:`symbols` function returns a sequence of symbols with names taken\n from ``names`` argument, which can be a comma or whitespace delimited\n string, or a sequence of strings::\n\n >>> from sympy im...
b80c81b3237bbf11317940f189921dd34f6b9fc0e98de3b5a313cf2e32d026fd
def var(names, **args): "\n Create symbols and inject them into the global namespace.\n\n This calls :func:`symbols` with the same arguments and puts the results\n into the *global* namespace. It's recommended not to use :func:`var` in\n library code, where :func:`symbols` has to be used::\n\n >>...
Create symbols and inject them into the global namespace. This calls :func:`symbols` with the same arguments and puts the results into the *global* namespace. It's recommended not to use :func:`var` in library code, where :func:`symbols` has to be used:: >>> from sympy import var >>> var('x') x >>> x...
sympy/core/symbol.py
var
cielavenir/sympy
2
python
def var(names, **args): "\n Create symbols and inject them into the global namespace.\n\n This calls :func:`symbols` with the same arguments and puts the results\n into the *global* namespace. It's recommended not to use :func:`var` in\n library code, where :func:`symbols` has to be used::\n\n >>...
def var(names, **args): "\n Create symbols and inject them into the global namespace.\n\n This calls :func:`symbols` with the same arguments and puts the results\n into the *global* namespace. It's recommended not to use :func:`var` in\n library code, where :func:`symbols` has to be used::\n\n >>...
7de1d5f3e52d1520561b62828d16e23508dc1e9a251a23439a6a1cb06b3084ff
def __new__(cls, name, commutative=True, **assumptions): 'Symbols are identified by name and assumptions::\n\n >>> from sympy import Symbol\n >>> Symbol("x") == Symbol("x")\n True\n >>> Symbol("x", real=True) == Symbol("x", real=False)\n False\n\n ' if ('dummy' in assum...
Symbols are identified by name and assumptions:: >>> from sympy import Symbol >>> Symbol("x") == Symbol("x") True >>> Symbol("x", real=True) == Symbol("x", real=False) False
sympy/core/symbol.py
__new__
cielavenir/sympy
2
python
def __new__(cls, name, commutative=True, **assumptions): 'Symbols are identified by name and assumptions::\n\n >>> from sympy import Symbol\n >>> Symbol("x") == Symbol("x")\n True\n >>> Symbol("x", real=True) == Symbol("x", real=False)\n False\n\n ' if ('dummy' in assum...
def __new__(cls, name, commutative=True, **assumptions): 'Symbols are identified by name and assumptions::\n\n >>> from sympy import Symbol\n >>> Symbol("x") == Symbol("x")\n True\n >>> Symbol("x", real=True) == Symbol("x", real=False)\n False\n\n ' if ('dummy' in assum...
49d0d48acc73644d011e41b89d71f9d808d38d1fe29027577c6a2c9631f033fa
def traverse(symbols, frame): 'Recursively inject symbols to the global namespace. ' for symbol in symbols: if isinstance(symbol, Basic): frame.f_globals[symbol.name] = symbol elif isinstance(symbol, FunctionClass): frame.f_globals[symbol.__name__] = symbol else: ...
Recursively inject symbols to the global namespace.
sympy/core/symbol.py
traverse
cielavenir/sympy
2
python
def traverse(symbols, frame): ' ' for symbol in symbols: if isinstance(symbol, Basic): frame.f_globals[symbol.name] = symbol elif isinstance(symbol, FunctionClass): frame.f_globals[symbol.__name__] = symbol else: traverse(symbol, frame)
def traverse(symbols, frame): ' ' for symbol in symbols: if isinstance(symbol, Basic): frame.f_globals[symbol.name] = symbol elif isinstance(symbol, FunctionClass): frame.f_globals[symbol.__name__] = symbol else: traverse(symbol, frame)<|docstring|>Rec...
14202e4023f315a761fd2aee152809280502ab6f04e742b0b4e21d16a9e9ec16
def build_embedding_matrix(embedding_model: gensim.models.keyedvectors.KeyedVectors, embedding_dim, vocab) -> np.ndarray: '\n Builds the embedding matrix.\n\n Parameters\n ----------\n embedding_model : gensim.models.keyedvectors.KeyedVectors\n Embedding model.\n embedding_dim : int\n E...
Builds the embedding matrix. Parameters ---------- embedding_model : gensim.models.keyedvectors.KeyedVectors Embedding model. embedding_dim : int Embedding dimension. vocab : dict Vocabulary. Returns ------- embedding_matrix : numpy.ndarray Embedding matrix.
rate_severity_of_toxic_comments/embedding.py
build_embedding_matrix
ilSommo/rate-severity-of-toxic-comments
1
python
def build_embedding_matrix(embedding_model: gensim.models.keyedvectors.KeyedVectors, embedding_dim, vocab) -> np.ndarray: '\n Builds the embedding matrix.\n\n Parameters\n ----------\n embedding_model : gensim.models.keyedvectors.KeyedVectors\n Embedding model.\n embedding_dim : int\n E...
def build_embedding_matrix(embedding_model: gensim.models.keyedvectors.KeyedVectors, embedding_dim, vocab) -> np.ndarray: '\n Builds the embedding matrix.\n\n Parameters\n ----------\n embedding_model : gensim.models.keyedvectors.KeyedVectors\n Embedding model.\n embedding_dim : int\n E...
3038c68036aec8c261220c73594c05867074e5dc1beaf211a40b6d75bc4863ea
def check_OOV_terms(embedding_model: gensim.models.keyedvectors.KeyedVectors, vocab): '\n Highlights out-of-vocabulary terms.\n\n Parameters\n ----------\n embedding_model : gensim.models.keyedvectors.KeyedVectors\n Embedding model.\n vocab : dict\n Vocabulary.\n\n Returns\n -----...
Highlights out-of-vocabulary terms. Parameters ---------- embedding_model : gensim.models.keyedvectors.KeyedVectors Embedding model. vocab : dict Vocabulary. Returns ------- oov : list List of out-of-vocabulary terms.
rate_severity_of_toxic_comments/embedding.py
check_OOV_terms
ilSommo/rate-severity-of-toxic-comments
1
python
def check_OOV_terms(embedding_model: gensim.models.keyedvectors.KeyedVectors, vocab): '\n Highlights out-of-vocabulary terms.\n\n Parameters\n ----------\n embedding_model : gensim.models.keyedvectors.KeyedVectors\n Embedding model.\n vocab : dict\n Vocabulary.\n\n Returns\n -----...
def check_OOV_terms(embedding_model: gensim.models.keyedvectors.KeyedVectors, vocab): '\n Highlights out-of-vocabulary terms.\n\n Parameters\n ----------\n embedding_model : gensim.models.keyedvectors.KeyedVectors\n Embedding model.\n vocab : dict\n Vocabulary.\n\n Returns\n -----...
64f064beaa7e84ec485e6bb076791d62fceddb28717a79d7a822240bf47b8e9b
def count_OOV_frequency(df, cols, oov): '\n Counts out-of-vocabulary frequency.\n\n Parameters\n ----------\n df : pandas.core.frame.DataFrame\n Dataset.\n cols : list\n List of column names.\n oov : list\n List of out-of-vocabulary terms.\n\n ' counts = {word: df[col]....
Counts out-of-vocabulary frequency. Parameters ---------- df : pandas.core.frame.DataFrame Dataset. cols : list List of column names. oov : list List of out-of-vocabulary terms.
rate_severity_of_toxic_comments/embedding.py
count_OOV_frequency
ilSommo/rate-severity-of-toxic-comments
1
python
def count_OOV_frequency(df, cols, oov): '\n Counts out-of-vocabulary frequency.\n\n Parameters\n ----------\n df : pandas.core.frame.DataFrame\n Dataset.\n cols : list\n List of column names.\n oov : list\n List of out-of-vocabulary terms.\n\n ' counts = {word: df[col]....
def count_OOV_frequency(df, cols, oov): '\n Counts out-of-vocabulary frequency.\n\n Parameters\n ----------\n df : pandas.core.frame.DataFrame\n Dataset.\n cols : list\n List of column names.\n oov : list\n List of out-of-vocabulary terms.\n\n ' counts = {word: df[col]....
6f8c2cce749f0df7298dc10abd698c1fe945aa909b75b9d7420aecf2851722b3
def load_embedding_model(model_params) -> gensim.models.keyedvectors.KeyedVectors: '\n Loads a pre-trained word embedding model.\n\n Parameters\n ----------\n model_params : dict\n Model parameters.\n\n Returns\n -------\n emb_model : gensim.models.keyedvectors.KeyedVectors\n Embe...
Loads a pre-trained word embedding model. Parameters ---------- model_params : dict Model parameters. Returns ------- emb_model : gensim.models.keyedvectors.KeyedVectors Embedding model.
rate_severity_of_toxic_comments/embedding.py
load_embedding_model
ilSommo/rate-severity-of-toxic-comments
1
python
def load_embedding_model(model_params) -> gensim.models.keyedvectors.KeyedVectors: '\n Loads a pre-trained word embedding model.\n\n Parameters\n ----------\n model_params : dict\n Model parameters.\n\n Returns\n -------\n emb_model : gensim.models.keyedvectors.KeyedVectors\n Embe...
def load_embedding_model(model_params) -> gensim.models.keyedvectors.KeyedVectors: '\n Loads a pre-trained word embedding model.\n\n Parameters\n ----------\n model_params : dict\n Model parameters.\n\n Returns\n -------\n emb_model : gensim.models.keyedvectors.KeyedVectors\n Embe...
df4dc727f47cc634999ea03c4ba286606cba9378970816fc457769c3c255ed04
def t2v_metrics(sims, query_masks=None): 'Compute retrieval metrics from a similarity matrix.\n\n Args:\n sims (th.Tensor): N x M matrix of similarities between embeddings, where\n x_{i,j} = <text_embd[i], vid_embed[j]>\n query_masks (th.Tensor): mask any missing queries from the datase...
Compute retrieval metrics from a similarity matrix. Args: sims (th.Tensor): N x M matrix of similarities between embeddings, where x_{i,j} = <text_embd[i], vid_embed[j]> query_masks (th.Tensor): mask any missing queries from the dataset (two videos in MSRVTT only have 19, rather than 20 capti...
src/metrics.py
t2v_metrics
oxai/debias-vision-lang
5
python
def t2v_metrics(sims, query_masks=None): 'Compute retrieval metrics from a similarity matrix.\n\n Args:\n sims (th.Tensor): N x M matrix of similarities between embeddings, where\n x_{i,j} = <text_embd[i], vid_embed[j]>\n query_masks (th.Tensor): mask any missing queries from the datase...
def t2v_metrics(sims, query_masks=None): 'Compute retrieval metrics from a similarity matrix.\n\n Args:\n sims (th.Tensor): N x M matrix of similarities between embeddings, where\n x_{i,j} = <text_embd[i], vid_embed[j]>\n query_masks (th.Tensor): mask any missing queries from the datase...
f4fb07257af3296320e25c23a3e66986622c06bfba5bf5759115b0b3e470800a
def v2t_metrics(sims, query_masks=None): 'Compute retrieval metrics from a similarity matrix.\n\n Args:\n sims (th.Tensor): N x M matrix of similarities between embeddings, where\n x_{i,j} = <text_embd[i], vid_embed[j]>\n query_masks (th.Tensor): mask any missing captions from the datas...
Compute retrieval metrics from a similarity matrix. Args: sims (th.Tensor): N x M matrix of similarities between embeddings, where x_{i,j} = <text_embd[i], vid_embed[j]> query_masks (th.Tensor): mask any missing captions from the dataset Returns: (dict[str:float]): retrieval metrics NOTES: We fi...
src/metrics.py
v2t_metrics
oxai/debias-vision-lang
5
python
def v2t_metrics(sims, query_masks=None): 'Compute retrieval metrics from a similarity matrix.\n\n Args:\n sims (th.Tensor): N x M matrix of similarities between embeddings, where\n x_{i,j} = <text_embd[i], vid_embed[j]>\n query_masks (th.Tensor): mask any missing captions from the datas...
def v2t_metrics(sims, query_masks=None): 'Compute retrieval metrics from a similarity matrix.\n\n Args:\n sims (th.Tensor): N x M matrix of similarities between embeddings, where\n x_{i,j} = <text_embd[i], vid_embed[j]>\n query_masks (th.Tensor): mask any missing captions from the datas...
84293afc212a706b9c7a2e355bb22622a53740121051ef3745cd122bee73fb37
def main(): '\n TODO: parse args here\n :return:\n ' parser = argparse.ArgumentParser(description='Grice') parser.add_argument('--config', help='The path to the config file', default='./config.ini') args = parser.parse_args() app = App(args.config) app.serve()
TODO: parse args here :return:
main.py
main
cache-rules/coles
0
python
def main(): '\n TODO: parse args here\n :return:\n ' parser = argparse.ArgumentParser(description='Grice') parser.add_argument('--config', help='The path to the config file', default='./config.ini') args = parser.parse_args() app = App(args.config) app.serve()
def main(): '\n TODO: parse args here\n :return:\n ' parser = argparse.ArgumentParser(description='Grice') parser.add_argument('--config', help='The path to the config file', default='./config.ini') args = parser.parse_args() app = App(args.config) app.serve()<|docstring|>TODO: parse ar...
d5beccb9b7d3f6d31089f1d5749f2abb25694cb4185c758ee7723d2698608370
def newton(x_old): 'This function computes x_(n+1) = x_n - f(x_n)/[dy/dx] ' x_new = (x_old - ((math.cos(x_old) - math.pow(x_old, 3)) / (((- 1) * math.sin(x_old)) - (3 * math.pow(x_old, 2))))) return x_new
This function computes x_(n+1) = x_n - f(x_n)/[dy/dx]
Projects/Newtons Method/newtonsMethod.py
newton
franc-ist/physics-projects
1
python
def newton(x_old): ' ' x_new = (x_old - ((math.cos(x_old) - math.pow(x_old, 3)) / (((- 1) * math.sin(x_old)) - (3 * math.pow(x_old, 2))))) return x_new
def newton(x_old): ' ' x_new = (x_old - ((math.cos(x_old) - math.pow(x_old, 3)) / (((- 1) * math.sin(x_old)) - (3 * math.pow(x_old, 2))))) return x_new<|docstring|>This function computes x_(n+1) = x_n - f(x_n)/[dy/dx]<|endoftext|>
1ab5953fa76904f0cf4c9987b1e412e183364901a3976b7da452cc3571d076c0
def create_objs(self, count, factory, **kwargs): 'Create business objects used entities factories and REST API\n (responses from web-server parsed to list of attributes (list of dicts))\n Return list of objects.\n ' objs = [factory.create() for _ in xrange(count)] list_of_attrs = [self.get_list_of_...
Create business objects used entities factories and REST API (responses from web-server parsed to list of attributes (list of dicts)) Return list of objects.
test/selenium/src/lib/service/rest_service.py
create_objs
trevordonnelly/ggrc-core
1
python
def create_objs(self, count, factory, **kwargs): 'Create business objects used entities factories and REST API\n (responses from web-server parsed to list of attributes (list of dicts))\n Return list of objects.\n ' objs = [factory.create() for _ in xrange(count)] list_of_attrs = [self.get_list_of_...
def create_objs(self, count, factory, **kwargs): 'Create business objects used entities factories and REST API\n (responses from web-server parsed to list of attributes (list of dicts))\n Return list of objects.\n ' objs = [factory.create() for _ in xrange(count)] list_of_attrs = [self.get_list_of_...
0e47f6ce19ae90bd61a82324d708677f7bb5b923fdd9af86476f062790186fca
@staticmethod def get_list_of_obj_attributes(response): "Form the list of dicts with business object's attributes (dict's items)\n from server response.\n " def minimize(object_element): 'Minimize response json data to request ready format.' obj = object_element[1].values()[0] ret...
Form the list of dicts with business object's attributes (dict's items) from server response.
test/selenium/src/lib/service/rest_service.py
get_list_of_obj_attributes
trevordonnelly/ggrc-core
1
python
@staticmethod def get_list_of_obj_attributes(response): "Form the list of dicts with business object's attributes (dict's items)\n from server response.\n " def minimize(object_element): 'Minimize response json data to request ready format.' obj = object_element[1].values()[0] ret...
@staticmethod def get_list_of_obj_attributes(response): "Form the list of dicts with business object's attributes (dict's items)\n from server response.\n " def minimize(object_element): 'Minimize response json data to request ready format.' obj = object_element[1].values()[0] ret...
6a2cdf3adf24ddd0582cf5d60424589723ba0fb518305dbf90df81d26023c39d
@staticmethod def set_obj_attrs(attrs, obj, **kwargs): "Update business object's attributes according type of object and\n list of dicts with business object's attributes (dict's items).\n " if attrs.get('id'): obj.id = attrs['id'] if attrs.get('href'): obj.href = attrs['href'] if ...
Update business object's attributes according type of object and list of dicts with business object's attributes (dict's items).
test/selenium/src/lib/service/rest_service.py
set_obj_attrs
trevordonnelly/ggrc-core
1
python
@staticmethod def set_obj_attrs(attrs, obj, **kwargs): "Update business object's attributes according type of object and\n list of dicts with business object's attributes (dict's items).\n " if attrs.get('id'): obj.id = attrs['id'] if attrs.get('href'): obj.href = attrs['href'] if ...
@staticmethod def set_obj_attrs(attrs, obj, **kwargs): "Update business object's attributes according type of object and\n list of dicts with business object's attributes (dict's items).\n " if attrs.get('id'): obj.id = attrs['id'] if attrs.get('href'): obj.href = attrs['href'] if ...
2b09d20c86fcfe2319ce06654f491d5da99eb9a164bb84421de7ec316532b6ab
def minimize(object_element): 'Minimize response json data to request ready format.' obj = object_element[1].values()[0] return {'id': obj['id'], 'href': obj['selfLink'], 'type': obj['type'], 'title': obj['title'], 'url': (environment.APP_URL + obj['viewLink'][1:]), 'name': re.search('\\/([a-z_]*)\\/', obj[...
Minimize response json data to request ready format.
test/selenium/src/lib/service/rest_service.py
minimize
trevordonnelly/ggrc-core
1
python
def minimize(object_element): obj = object_element[1].values()[0] return {'id': obj['id'], 'href': obj['selfLink'], 'type': obj['type'], 'title': obj['title'], 'url': (environment.APP_URL + obj['viewLink'][1:]), 'name': re.search('\\/([a-z_]*)\\/', obj['viewLink']).group(1)}
def minimize(object_element): obj = object_element[1].values()[0] return {'id': obj['id'], 'href': obj['selfLink'], 'type': obj['type'], 'title': obj['title'], 'url': (environment.APP_URL + obj['viewLink'][1:]), 'name': re.search('\\/([a-z_]*)\\/', obj['viewLink']).group(1)}<|docstring|>Minimize response j...
2e501339ea617310e040e5f202dfb2ad3abd3062e46e043658b9ab72708cf511
def create_replica_wrapper(name: str, serialized_deployment_def: bytes): 'Creates a replica class wrapping the provided function or class.\n\n This approach is picked over inheritance to avoid conflict between user\n provided class and the RayServeReplica class.\n ' serialized_deployment_def = serializ...
Creates a replica class wrapping the provided function or class. This approach is picked over inheritance to avoid conflict between user provided class and the RayServeReplica class.
python/ray/serve/replica.py
create_replica_wrapper
mopga/ray
33
python
def create_replica_wrapper(name: str, serialized_deployment_def: bytes): 'Creates a replica class wrapping the provided function or class.\n\n This approach is picked over inheritance to avoid conflict between user\n provided class and the RayServeReplica class.\n ' serialized_deployment_def = serializ...
def create_replica_wrapper(name: str, serialized_deployment_def: bytes): 'Creates a replica class wrapping the provided function or class.\n\n This approach is picked over inheritance to avoid conflict between user\n provided class and the RayServeReplica class.\n ' serialized_deployment_def = serializ...
c1e66ec6796162c0316ca0b91e975042e0701274255bb7697fe81ef8731b2587
def wrap_to_ray_error(function_name: str, exception: Exception) -> RayTaskError: 'Utility method to wrap exceptions in user code.' try: raise exception except Exception as e: traceback_str = ray._private.utils.format_error_message(traceback.format_exc()) return ray.exceptions.RayTask...
Utility method to wrap exceptions in user code.
python/ray/serve/replica.py
wrap_to_ray_error
mopga/ray
33
python
def wrap_to_ray_error(function_name: str, exception: Exception) -> RayTaskError: try: raise exception except Exception as e: traceback_str = ray._private.utils.format_error_message(traceback.format_exc()) return ray.exceptions.RayTaskError(function_name, traceback_str, e)
def wrap_to_ray_error(function_name: str, exception: Exception) -> RayTaskError: try: raise exception except Exception as e: traceback_str = ray._private.utils.format_error_message(traceback.format_exc()) return ray.exceptions.RayTaskError(function_name, traceback_str, e)<|docstring...
eb47877a8cfa263a8cafbd5152e9d53f85de0c09e408868cf9995289061f36a1
async def prepare_for_shutdown(self): 'Perform graceful shutdown.\n\n Trigger a graceful shutdown protocol that will wait for all the queued\n tasks to be completed and return to the controller.\n ' while True: (await asyncio.sleep(self._shutdown_wait_loop_s)) method_stat = ...
Perform graceful shutdown. Trigger a graceful shutdown protocol that will wait for all the queued tasks to be completed and return to the controller.
python/ray/serve/replica.py
prepare_for_shutdown
mopga/ray
33
python
async def prepare_for_shutdown(self): 'Perform graceful shutdown.\n\n Trigger a graceful shutdown protocol that will wait for all the queued\n tasks to be completed and return to the controller.\n ' while True: (await asyncio.sleep(self._shutdown_wait_loop_s)) method_stat = ...
async def prepare_for_shutdown(self): 'Perform graceful shutdown.\n\n Trigger a graceful shutdown protocol that will wait for all the queued\n tasks to be completed and return to the controller.\n ' while True: (await asyncio.sleep(self._shutdown_wait_loop_s)) method_stat = ...
08fd00d948147a4740744ad705753bdc90cf39a7410e2fff62f9fdb8190b221a
async def is_allocated(self): "poke the replica to check whether it's alive.\n\n When calling this method on an ActorHandle, it will complete as\n soon as the actor has started running. We use this mechanism to\n detect when a replica has been allocated a worker slot.\n A...
poke the replica to check whether it's alive. When calling this method on an ActorHandle, it will complete as soon as the actor has started running. We use this mechanism to detect when a replica has been allocated a worker slot. At this time, the replica can transition from PENDING_ALLOCATION to PENDING_INITIALIZATIO...
python/ray/serve/replica.py
is_allocated
mopga/ray
33
python
async def is_allocated(self): "poke the replica to check whether it's alive.\n\n When calling this method on an ActorHandle, it will complete as\n soon as the actor has started running. We use this mechanism to\n detect when a replica has been allocated a worker slot.\n A...
async def is_allocated(self): "poke the replica to check whether it's alive.\n\n When calling this method on an ActorHandle, it will complete as\n soon as the actor has started running. We use this mechanism to\n detect when a replica has been allocated a worker slot.\n A...
0634b5787ca9eb2964153199776dd2166867e23c9812ec53b58ed4ec98d74d7b
def samples_selection_from_request(request, db, from_ped=True): "Parse a GET request to make the samples groups and return a SamplesSelection.\n :param from_ped: read groups info based on 'phenotype' attribute in the Samples table.\n " groups = {} sample_requests = request.GET.getlist('samples', []) ...
Parse a GET request to make the samples groups and return a SamplesSelection. :param from_ped: read groups info based on 'phenotype' attribute in the Samples table.
varappx/samples/samples_service.py
samples_selection_from_request
444thLiao/VarappX-flask
1
python
def samples_selection_from_request(request, db, from_ped=True): "Parse a GET request to make the samples groups and return a SamplesSelection.\n :param from_ped: read groups info based on 'phenotype' attribute in the Samples table.\n " groups = {} sample_requests = request.GET.getlist('samples', []) ...
def samples_selection_from_request(request, db, from_ped=True): "Parse a GET request to make the samples groups and return a SamplesSelection.\n :param from_ped: read groups info based on 'phenotype' attribute in the Samples table.\n " groups = {} sample_requests = request.GET.getlist('samples', []) ...
61fe94f2e703ff8bda98fd8318fc5e401a55d8f1bd24c890f16ac59aad11b65b
def __init__(self, params): '\n OpenPose Constructor: Prepares OpenPose object\n\n Parameters\n ----------\n params : dict of required parameters. refer to openpose example for more details\n\n Returns\n -------\n outs: OpenPose object\n ' self.op = self._...
OpenPose Constructor: Prepares OpenPose object Parameters ---------- params : dict of required parameters. refer to openpose example for more details Returns ------- outs: OpenPose object
python/openpose/openpose.py
__init__
Danivilanova/openpose
43
python
def __init__(self, params): '\n OpenPose Constructor: Prepares OpenPose object\n\n Parameters\n ----------\n params : dict of required parameters. refer to openpose example for more details\n\n Returns\n -------\n outs: OpenPose object\n ' self.op = self._...
def __init__(self, params): '\n OpenPose Constructor: Prepares OpenPose object\n\n Parameters\n ----------\n params : dict of required parameters. refer to openpose example for more details\n\n Returns\n -------\n outs: OpenPose object\n ' self.op = self._...
e0cc0be262e9f6f1fcd0e5142d25907e6aa798b2676cee464ed7d683053a22e1
def __del__(self): '\n OpenPose Destructor: Destroys OpenPose object\n ' self._libop.delOP(self.op)
OpenPose Destructor: Destroys OpenPose object
python/openpose/openpose.py
__del__
Danivilanova/openpose
43
python
def __del__(self): '\n \n ' self._libop.delOP(self.op)
def __del__(self): '\n \n ' self._libop.delOP(self.op)<|docstring|>OpenPose Destructor: Destroys OpenPose object<|endoftext|>
a09c49a2e6a9a7d6bd6ff2c1714e5c9605c6c1b26cf56a0803fea8e45fd63e5b
def forward(self, image, display=False): '\n Forward: Takes in an image and returns the human 2D poses, along with drawn image if required\n\n Parameters\n ----------\n image : color image of type ndarray\n display : If set to true, we return both the pose and an annotated image f...
Forward: Takes in an image and returns the human 2D poses, along with drawn image if required Parameters ---------- image : color image of type ndarray display : If set to true, we return both the pose and an annotated image for visualization Returns ------- array: ndarray of human 2D poses [People * BodyPart * XYCon...
python/openpose/openpose.py
forward
Danivilanova/openpose
43
python
def forward(self, image, display=False): '\n Forward: Takes in an image and returns the human 2D poses, along with drawn image if required\n\n Parameters\n ----------\n image : color image of type ndarray\n display : If set to true, we return both the pose and an annotated image f...
def forward(self, image, display=False): '\n Forward: Takes in an image and returns the human 2D poses, along with drawn image if required\n\n Parameters\n ----------\n image : color image of type ndarray\n display : If set to true, we return both the pose and an annotated image f...
a62f4ce301efef9f9881fccf8341cca098f8173103bf0bc934f004335f1735b7
def poseFromHM(self, image, hm, ratios=[1]): '\n Pose From Heatmap: Takes in an image, computed heatmaps, and require scales and computes pose\n\n Parameters\n ----------\n image : color image of type ndarray\n hm : heatmap of type ndarray with heatmaps and part affinity fields\n ...
Pose From Heatmap: Takes in an image, computed heatmaps, and require scales and computes pose Parameters ---------- image : color image of type ndarray hm : heatmap of type ndarray with heatmaps and part affinity fields ratios : scaling ration if needed to fuse multiple scales Returns ------- array: ndarray of human ...
python/openpose/openpose.py
poseFromHM
Danivilanova/openpose
43
python
def poseFromHM(self, image, hm, ratios=[1]): '\n Pose From Heatmap: Takes in an image, computed heatmaps, and require scales and computes pose\n\n Parameters\n ----------\n image : color image of type ndarray\n hm : heatmap of type ndarray with heatmaps and part affinity fields\n ...
def poseFromHM(self, image, hm, ratios=[1]): '\n Pose From Heatmap: Takes in an image, computed heatmaps, and require scales and computes pose\n\n Parameters\n ----------\n image : color image of type ndarray\n hm : heatmap of type ndarray with heatmaps and part affinity fields\n ...
3125240437d245ef15d7a93f2c0be5072d8c284db087ca1cdb4401fe6fc3c970
def __init__(self, filename, timeout=LOCK_TIMEOUT, delimiter=','): '\n Constructs ResultsAggregator.\n\n Parameters\n ----------\n filename : Path\n Results file.\n timeout : int\n Lock acquistion timeout in seconds.\n delimiter : str\n Deli...
Constructs ResultsAggregator. Parameters ---------- filename : Path Results file. timeout : int Lock acquistion timeout in seconds. delimiter : str Delimiter to use for CSV formatting.
jade/jobs/results_aggregator.py
__init__
jgu2/jade
15
python
def __init__(self, filename, timeout=LOCK_TIMEOUT, delimiter=','): '\n Constructs ResultsAggregator.\n\n Parameters\n ----------\n filename : Path\n Results file.\n timeout : int\n Lock acquistion timeout in seconds.\n delimiter : str\n Deli...
def __init__(self, filename, timeout=LOCK_TIMEOUT, delimiter=','): '\n Constructs ResultsAggregator.\n\n Parameters\n ----------\n filename : Path\n Results file.\n timeout : int\n Lock acquistion timeout in seconds.\n delimiter : str\n Deli...
8eec8b07df33d9e1d0a6cab38b87c657df04a4b7d12c4e9d9ea51be4397ae598
@classmethod def create(cls, output_dir, **kwargs): 'Create a new instance.\n\n Parameters\n ----------\n output_dir : str\n\n Returns\n -------\n ResultsAggregator\n\n ' agg = cls((Path(output_dir) / PROCESSED_RESULTS_FILENAME), **kwargs) agg.create_files() ...
Create a new instance. Parameters ---------- output_dir : str Returns ------- ResultsAggregator
jade/jobs/results_aggregator.py
create
jgu2/jade
15
python
@classmethod def create(cls, output_dir, **kwargs): 'Create a new instance.\n\n Parameters\n ----------\n output_dir : str\n\n Returns\n -------\n ResultsAggregator\n\n ' agg = cls((Path(output_dir) / PROCESSED_RESULTS_FILENAME), **kwargs) agg.create_files() ...
@classmethod def create(cls, output_dir, **kwargs): 'Create a new instance.\n\n Parameters\n ----------\n output_dir : str\n\n Returns\n -------\n ResultsAggregator\n\n ' agg = cls((Path(output_dir) / PROCESSED_RESULTS_FILENAME), **kwargs) agg.create_files() ...
c11b94bc3df6d2d54bae224df48f7991f2ea16919a69d27c6c27ed3d7b44fba4
@classmethod def load(cls, output_dir, **kwargs): 'Load an instance from an output directory.\n\n Parameters\n ----------\n output_dir : str\n\n Returns\n -------\n ResultsAggregator\n\n ' return cls((Path(output_dir) / PROCESSED_RESULTS_FILENAME), **kwargs)
Load an instance from an output directory. Parameters ---------- output_dir : str Returns ------- ResultsAggregator
jade/jobs/results_aggregator.py
load
jgu2/jade
15
python
@classmethod def load(cls, output_dir, **kwargs): 'Load an instance from an output directory.\n\n Parameters\n ----------\n output_dir : str\n\n Returns\n -------\n ResultsAggregator\n\n ' return cls((Path(output_dir) / PROCESSED_RESULTS_FILENAME), **kwargs)
@classmethod def load(cls, output_dir, **kwargs): 'Load an instance from an output directory.\n\n Parameters\n ----------\n output_dir : str\n\n Returns\n -------\n ResultsAggregator\n\n ' return cls((Path(output_dir) / PROCESSED_RESULTS_FILENAME), **kwargs)<|doc...
2c7acf7b5bf09b5b9677cba2ffa5e1037497fe407afdb493b7cc993d355b1745
@classmethod def load_node_results(cls, output_dir, batch_id, **kwargs): 'Load a per-node instance from an output directory.\n\n Parameters\n ----------\n output_dir : str\n batch_id : int\n\n Returns\n -------\n ResultsAggregator\n\n ' return cls(((Path(o...
Load a per-node instance from an output directory. Parameters ---------- output_dir : str batch_id : int Returns ------- ResultsAggregator
jade/jobs/results_aggregator.py
load_node_results
jgu2/jade
15
python
@classmethod def load_node_results(cls, output_dir, batch_id, **kwargs): 'Load a per-node instance from an output directory.\n\n Parameters\n ----------\n output_dir : str\n batch_id : int\n\n Returns\n -------\n ResultsAggregator\n\n ' return cls(((Path(o...
@classmethod def load_node_results(cls, output_dir, batch_id, **kwargs): 'Load a per-node instance from an output directory.\n\n Parameters\n ----------\n output_dir : str\n batch_id : int\n\n Returns\n -------\n ResultsAggregator\n\n ' return cls(((Path(o...
5018da717f333225f9db3d95068fed1c9e7f54b66ed7d7429a45e1f294567415
@classmethod def load_node_results_file(cls, path, **kwargs): 'Load a per-node instance from an output directory.\n\n Parameters\n ----------\n path : Path\n\n Returns\n -------\n ResultsAggregator\n\n ' return cls(path, **kwargs)
Load a per-node instance from an output directory. Parameters ---------- path : Path Returns ------- ResultsAggregator
jade/jobs/results_aggregator.py
load_node_results_file
jgu2/jade
15
python
@classmethod def load_node_results_file(cls, path, **kwargs): 'Load a per-node instance from an output directory.\n\n Parameters\n ----------\n path : Path\n\n Returns\n -------\n ResultsAggregator\n\n ' return cls(path, **kwargs)
@classmethod def load_node_results_file(cls, path, **kwargs): 'Load a per-node instance from an output directory.\n\n Parameters\n ----------\n path : Path\n\n Returns\n -------\n ResultsAggregator\n\n ' return cls(path, **kwargs)<|docstring|>Load a per-node inst...
46fe15fac77dfb1eaf17422bd3b91ce02b06f0aad6257c2a344bd263f20433d8
def create_files(self): 'Initialize the results file. Should only be called by the parent\n process.\n\n ' self._do_action_under_lock(self._create_files)
Initialize the results file. Should only be called by the parent process.
jade/jobs/results_aggregator.py
create_files
jgu2/jade
15
python
def create_files(self): 'Initialize the results file. Should only be called by the parent\n process.\n\n ' self._do_action_under_lock(self._create_files)
def create_files(self): 'Initialize the results file. Should only be called by the parent\n process.\n\n ' self._do_action_under_lock(self._create_files)<|docstring|>Initialize the results file. Should only be called by the parent process.<|endoftext|>
55e3438b204d2ea6f7cd0a6940206bb8bc3807cb1941899bf28329e27668cb0a
@classmethod def append(cls, output_dir, result, batch_id=None): 'Append a result to the file.\n\n output_dir : str\n result : Result\n batch_id : int\n\n ' if (batch_id is None): aggregator = cls.load(output_dir) else: aggregator = cls.load_node_results(output_di...
Append a result to the file. output_dir : str result : Result batch_id : int
jade/jobs/results_aggregator.py
append
jgu2/jade
15
python
@classmethod def append(cls, output_dir, result, batch_id=None): 'Append a result to the file.\n\n output_dir : str\n result : Result\n batch_id : int\n\n ' if (batch_id is None): aggregator = cls.load(output_dir) else: aggregator = cls.load_node_results(output_di...
@classmethod def append(cls, output_dir, result, batch_id=None): 'Append a result to the file.\n\n output_dir : str\n result : Result\n batch_id : int\n\n ' if (batch_id is None): aggregator = cls.load(output_dir) else: aggregator = cls.load_node_results(output_di...
fb9abd76aef969f07d576bc812824053061f5c6d4ae1fb6aec9382328867fc8c
def append_result(self, result): 'Append a result to the file.\n\n result : Result\n\n ' start = time.time() text = self._delimiter.join([str(getattr(result, x)) for x in self._get_fields()]) self._do_action_under_lock(self._append_result, text) duration = (time.time() - start) if ...
Append a result to the file. result : Result
jade/jobs/results_aggregator.py
append_result
jgu2/jade
15
python
def append_result(self, result): 'Append a result to the file.\n\n result : Result\n\n ' start = time.time() text = self._delimiter.join([str(getattr(result, x)) for x in self._get_fields()]) self._do_action_under_lock(self._append_result, text) duration = (time.time() - start) if ...
def append_result(self, result): 'Append a result to the file.\n\n result : Result\n\n ' start = time.time() text = self._delimiter.join([str(getattr(result, x)) for x in self._get_fields()]) self._do_action_under_lock(self._append_result, text) duration = (time.time() - start) if ...
4dc9ce01074bcdc3b8eee8c71902406eb3e5e2897d8d9d29b9a2f94fa9a15fa5
def clear_results_for_resubmission(self, jobs_to_resubmit): 'Remove jobs that will be resubmitted from the results file.\n\n Parameters\n ----------\n jobs_to_resubmit : set\n Job names that will be resubmitted.\n\n ' results = [x for x in self.get_results() if (x.name not...
Remove jobs that will be resubmitted from the results file. Parameters ---------- jobs_to_resubmit : set Job names that will be resubmitted.
jade/jobs/results_aggregator.py
clear_results_for_resubmission
jgu2/jade
15
python
def clear_results_for_resubmission(self, jobs_to_resubmit): 'Remove jobs that will be resubmitted from the results file.\n\n Parameters\n ----------\n jobs_to_resubmit : set\n Job names that will be resubmitted.\n\n ' results = [x for x in self.get_results() if (x.name not...
def clear_results_for_resubmission(self, jobs_to_resubmit): 'Remove jobs that will be resubmitted from the results file.\n\n Parameters\n ----------\n jobs_to_resubmit : set\n Job names that will be resubmitted.\n\n ' results = [x for x in self.get_results() if (x.name not...
a84e6db433d883725a4e8e366d8c11218a39a5242a0d06293d8dd3671cd7019a
def clear_unsuccessful_results(self): 'Remove failed and canceled results from the results file.' results = [x for x in self.get_results() if (x.return_code == 0)] self._write_results(results) logger.info('Cleared failed results from %s', self._filename)
Remove failed and canceled results from the results file.
jade/jobs/results_aggregator.py
clear_unsuccessful_results
jgu2/jade
15
python
def clear_unsuccessful_results(self): results = [x for x in self.get_results() if (x.return_code == 0)] self._write_results(results) logger.info('Cleared failed results from %s', self._filename)
def clear_unsuccessful_results(self): results = [x for x in self.get_results() if (x.return_code == 0)] self._write_results(results) logger.info('Cleared failed results from %s', self._filename)<|docstring|>Remove failed and canceled results from the results file.<|endoftext|>
a22d39bd36c417559bf5b2b2e0a3528e0b1fb880c78eedec263c811186d473b0
def get_results(self): 'Return the current results.\n\n Returns\n -------\n list\n list of Result objects\n\n ' return self._do_action_under_lock(self._get_all_results)
Return the current results. Returns ------- list list of Result objects
jade/jobs/results_aggregator.py
get_results
jgu2/jade
15
python
def get_results(self): 'Return the current results.\n\n Returns\n -------\n list\n list of Result objects\n\n ' return self._do_action_under_lock(self._get_all_results)
def get_results(self): 'Return the current results.\n\n Returns\n -------\n list\n list of Result objects\n\n ' return self._do_action_under_lock(self._get_all_results)<|docstring|>Return the current results. Returns ------- list list of Result objects<|endoftext|>
cfaa0769769888215740106966cd2166353ed9f0e67e10a42e46bf146a2878b3
def get_results_unsafe(self): 'Return the results. It is up to the caller to ensure that\n a lock is not needed.\n\n Returns\n -------\n list\n list of Result objects\n\n ' return self._get_results()
Return the results. It is up to the caller to ensure that a lock is not needed. Returns ------- list list of Result objects
jade/jobs/results_aggregator.py
get_results_unsafe
jgu2/jade
15
python
def get_results_unsafe(self): 'Return the results. It is up to the caller to ensure that\n a lock is not needed.\n\n Returns\n -------\n list\n list of Result objects\n\n ' return self._get_results()
def get_results_unsafe(self): 'Return the results. It is up to the caller to ensure that\n a lock is not needed.\n\n Returns\n -------\n list\n list of Result objects\n\n ' return self._get_results()<|docstring|>Return the results. It is up to the caller to ensure t...
9bbb40be06ea9ad59fe23f4f345d6d9b1a64b14acde5de93bc952f56094aba88
def move_results(self, func): 'Move the results to a new location and delete the file.\n\n Parameters\n ----------\n func : function\n\n Returns\n -------\n list\n list of Result\n\n ' return self._do_action_under_lock(self._move_results, func)
Move the results to a new location and delete the file. Parameters ---------- func : function Returns ------- list list of Result
jade/jobs/results_aggregator.py
move_results
jgu2/jade
15
python
def move_results(self, func): 'Move the results to a new location and delete the file.\n\n Parameters\n ----------\n func : function\n\n Returns\n -------\n list\n list of Result\n\n ' return self._do_action_under_lock(self._move_results, func)
def move_results(self, func): 'Move the results to a new location and delete the file.\n\n Parameters\n ----------\n func : function\n\n Returns\n -------\n list\n list of Result\n\n ' return self._do_action_under_lock(self._move_results, func)<|docstr...
057d75c1b7709e54e7913fb21f9f9630bea7e8b161ea9e597fc51ce0b45a061c
@classmethod def list_results(cls, output_dir, **kwargs): 'Return the current results.\n\n Parameters\n ----------\n output_dir : str\n\n Returns\n -------\n list\n list of Result objects\n\n ' results = cls.load(output_dir, **kwargs) return result...
Return the current results. Parameters ---------- output_dir : str Returns ------- list list of Result objects
jade/jobs/results_aggregator.py
list_results
jgu2/jade
15
python
@classmethod def list_results(cls, output_dir, **kwargs): 'Return the current results.\n\n Parameters\n ----------\n output_dir : str\n\n Returns\n -------\n list\n list of Result objects\n\n ' results = cls.load(output_dir, **kwargs) return result...
@classmethod def list_results(cls, output_dir, **kwargs): 'Return the current results.\n\n Parameters\n ----------\n output_dir : str\n\n Returns\n -------\n list\n list of Result objects\n\n ' results = cls.load(output_dir, **kwargs) return result...
f0d90ae7f77449e21541cefc0a71923002350f9d83b609fa8ac0846e78593cf1
def process_results(self): 'Move all temp results into the consolidated file, then clear the file.\n\n Returns\n -------\n list\n list of Result objects that are newly completed\n\n ' assert (not self._is_node) return self._do_action_under_lock(self._process_results)
Move all temp results into the consolidated file, then clear the file. Returns ------- list list of Result objects that are newly completed
jade/jobs/results_aggregator.py
process_results
jgu2/jade
15
python
def process_results(self): 'Move all temp results into the consolidated file, then clear the file.\n\n Returns\n -------\n list\n list of Result objects that are newly completed\n\n ' assert (not self._is_node) return self._do_action_under_lock(self._process_results)
def process_results(self): 'Move all temp results into the consolidated file, then clear the file.\n\n Returns\n -------\n list\n list of Result objects that are newly completed\n\n ' assert (not self._is_node) return self._do_action_under_lock(self._process_results)<|...
4fd7e18b52026360e94f78041dea66ad75d6cdf0335fc6a1e445b20e62c5ec0f
def _combine_annotations(annotations, last_samps, first_samps, sfreq): 'Helper for combining a tuple of annotations.' if (not any(annotations)): return None elif (annotations[1] is None): return annotations[0] elif (annotations[0] is None): old_onset = list() old_duration...
Helper for combining a tuple of annotations.
mne/annotations.py
_combine_annotations
mvdoc/mne-python
0
python
def _combine_annotations(annotations, last_samps, first_samps, sfreq): if (not any(annotations)): return None elif (annotations[1] is None): return annotations[0] elif (annotations[0] is None): old_onset = list() old_duration = list() old_description = list() ...
def _combine_annotations(annotations, last_samps, first_samps, sfreq): if (not any(annotations)): return None elif (annotations[1] is None): return annotations[0] elif (annotations[0] is None): old_onset = list() old_duration = list() old_description = list() ...
d5d6273af1f130ed4ab3943ad45809ebeae536acba4da2a407f437e0ddb5e9cd
def _onset_to_seconds(raw, onset): 'Helper function for adjusting onsets in relation to raw data.' meas_date = raw.info['meas_date'] if (meas_date is None): meas_date = 0 elif (not np.isscalar(meas_date)): if (len(meas_date) > 1): meas_date = (meas_date[0] + (meas_date[1] / 1...
Helper function for adjusting onsets in relation to raw data.
mne/annotations.py
_onset_to_seconds
mvdoc/mne-python
0
python
def _onset_to_seconds(raw, onset): meas_date = raw.info['meas_date'] if (meas_date is None): meas_date = 0 elif (not np.isscalar(meas_date)): if (len(meas_date) > 1): meas_date = (meas_date[0] + (meas_date[1] / 1000000.0)) else: meas_date = meas_date[0] ...
def _onset_to_seconds(raw, onset): meas_date = raw.info['meas_date'] if (meas_date is None): meas_date = 0 elif (not np.isscalar(meas_date)): if (len(meas_date) > 1): meas_date = (meas_date[0] + (meas_date[1] / 1000000.0)) else: meas_date = meas_date[0] ...
4e62d04c2321947ca65ae63a5a4d345940d0d129a166e97e2b621b25f46bf099
@unittest.skip('hangs') def test_bad_country(self): 'See what happens if the country is likely to be unknown.\n 2017-11-05 This test just hangs, so skipping for now.\n TBD: issue' request = service.get_request('GET', {u'taxon': u'Hylidae', u'country': u'Sovietunion'}) x = self.start_request_te...
See what happens if the country is likely to be unknown. 2017-11-05 This test just hangs, so skipping for now. TBD: issue
tests/test_ts_country_species.py
test_bad_country
jar398/tryphy
0
python
@unittest.skip('hangs') def test_bad_country(self): 'See what happens if the country is likely to be unknown.\n 2017-11-05 This test just hangs, so skipping for now.\n TBD: issue' request = service.get_request('GET', {u'taxon': u'Hylidae', u'country': u'Sovietunion'}) x = self.start_request_te...
@unittest.skip('hangs') def test_bad_country(self): 'See what happens if the country is likely to be unknown.\n 2017-11-05 This test just hangs, so skipping for now.\n TBD: issue' request = service.get_request('GET', {u'taxon': u'Hylidae', u'country': u'Sovietunion'}) x = self.start_request_te...
239df8e3f10cd2936bada078abdefcc270c51cda01ffc09637feaabf4a8b29bc
def test_example_17p(self): "2017-11-05 This test complains about the 'taxon' parameter being \n missing. But it's not missing.\n Error: Missing parameter 'taxon'. TBD: issue" x = self.start_request_tests(example_17p) m = x.json()[u'message'] self.assert_success(x, m)
2017-11-05 This test complains about the 'taxon' parameter being missing. But it's not missing. Error: Missing parameter 'taxon'. TBD: issue
tests/test_ts_country_species.py
test_example_17p
jar398/tryphy
0
python
def test_example_17p(self): "2017-11-05 This test complains about the 'taxon' parameter being \n missing. But it's not missing.\n Error: Missing parameter 'taxon'. TBD: issue" x = self.start_request_tests(example_17p) m = x.json()[u'message'] self.assert_success(x, m)
def test_example_17p(self): "2017-11-05 This test complains about the 'taxon' parameter being \n missing. But it's not missing.\n Error: Missing parameter 'taxon'. TBD: issue" x = self.start_request_tests(example_17p) m = x.json()[u'message'] self.assert_success(x, m)<|docstring|>2017-11...
b7b0b7d5a6ee051a50d1b091c5673bcce4fed83c4928d980c1833b3d1c4b33f2
def create_or_update(self, resource_group_name, local_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): '\n The Put LocalNetworkGateway operation creates/updates a local network\n gateway in the specified resource group through Network resource\n provider.\n...
The Put LocalNetworkGateway operation creates/updates a local network gateway in the specified resource group through Network resource provider. :param resource_group_name: The name of the resource group. :type resource_group_name: str :param local_network_gateway_name: The name of the local network gateway. :type lo...
azure-mgmt-network/azure/mgmt/network/operations/local_network_gateways_operations.py
create_or_update
HydAu/AzureSDKForPython
0
python
def create_or_update(self, resource_group_name, local_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): '\n The Put LocalNetworkGateway operation creates/updates a local network\n gateway in the specified resource group through Network resource\n provider.\n...
def create_or_update(self, resource_group_name, local_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): '\n The Put LocalNetworkGateway operation creates/updates a local network\n gateway in the specified resource group through Network resource\n provider.\n...
5f470a86e020320272c831a513e81ddaf0e75bc557a5fb1bb0be104b6ea373c4
def get(self, resource_group_name, local_network_gateway_name, custom_headers=None, raw=False, **operation_config): '\n The Get LocalNetworkGateway operation retrieves information about the\n specified local network gateway through Network resource provider.\n\n :param resource_group_name: The ...
The Get LocalNetworkGateway operation retrieves information about the specified local network gateway through Network resource provider. :param resource_group_name: The name of the resource group. :type resource_group_name: str :param local_network_gateway_name: The name of the local network gateway. :type local_netw...
azure-mgmt-network/azure/mgmt/network/operations/local_network_gateways_operations.py
get
HydAu/AzureSDKForPython
0
python
def get(self, resource_group_name, local_network_gateway_name, custom_headers=None, raw=False, **operation_config): '\n The Get LocalNetworkGateway operation retrieves information about the\n specified local network gateway through Network resource provider.\n\n :param resource_group_name: The ...
def get(self, resource_group_name, local_network_gateway_name, custom_headers=None, raw=False, **operation_config): '\n The Get LocalNetworkGateway operation retrieves information about the\n specified local network gateway through Network resource provider.\n\n :param resource_group_name: The ...
f2d64cf261e9efa5e034b82bec5a3684edf2f7030ea7abedb88258ed7e9244d8
def delete(self, resource_group_name, local_network_gateway_name, custom_headers=None, raw=False, **operation_config): '\n The Delete LocalNetworkGateway operation deletes the specifed local\n network Gateway through Network resource provider.\n\n :param resource_group_name: The name of the res...
The Delete LocalNetworkGateway operation deletes the specifed local network Gateway through Network resource provider. :param resource_group_name: The name of the resource group. :type resource_group_name: str :param local_network_gateway_name: The name of the local network gateway. :type local_network_gateway_name: ...
azure-mgmt-network/azure/mgmt/network/operations/local_network_gateways_operations.py
delete
HydAu/AzureSDKForPython
0
python
def delete(self, resource_group_name, local_network_gateway_name, custom_headers=None, raw=False, **operation_config): '\n The Delete LocalNetworkGateway operation deletes the specifed local\n network Gateway through Network resource provider.\n\n :param resource_group_name: The name of the res...
def delete(self, resource_group_name, local_network_gateway_name, custom_headers=None, raw=False, **operation_config): '\n The Delete LocalNetworkGateway operation deletes the specifed local\n network Gateway through Network resource provider.\n\n :param resource_group_name: The name of the res...
e7d9063da31e6867c1f94d8f6fea5af781d8fd64a60b5351a501dba367bd72e4
def list(self, resource_group_name, custom_headers=None, raw=False, **operation_config): '\n The List LocalNetworkGateways opertion retrieves all the local network\n gateways stored.\n\n :param resource_group_name: The name of the resource group.\n :type resource_group_name: str\n ...
The List LocalNetworkGateways opertion retrieves all the local network gateways stored. :param resource_group_name: The name of the resource group. :type resource_group_name: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserializ...
azure-mgmt-network/azure/mgmt/network/operations/local_network_gateways_operations.py
list
HydAu/AzureSDKForPython
0
python
def list(self, resource_group_name, custom_headers=None, raw=False, **operation_config): '\n The List LocalNetworkGateways opertion retrieves all the local network\n gateways stored.\n\n :param resource_group_name: The name of the resource group.\n :type resource_group_name: str\n ...
def list(self, resource_group_name, custom_headers=None, raw=False, **operation_config): '\n The List LocalNetworkGateways opertion retrieves all the local network\n gateways stored.\n\n :param resource_group_name: The name of the resource group.\n :type resource_group_name: str\n ...
f61de105c0b46577650658dca5303fb9415c76d58b0a51a8e243cc8a8b0adbfb
def handle(self, *args, **options): 'Publishes Deis platform state from the database to etcd.' print('Publishing DB state to etcd...') for app in App.objects.all(): app.save() app.config_set.latest().save() for model in (Key, Domain, Certificate): for obj in model.objects.all(): ...
Publishes Deis platform state from the database to etcd.
controller/api/management/commands/load_db_state_to_etcd.py
handle
deathtrix/deis
3,375
python
def handle(self, *args, **options): print('Publishing DB state to etcd...') for app in App.objects.all(): app.save() app.config_set.latest().save() for model in (Key, Domain, Certificate): for obj in model.objects.all(): obj.save() print('Done Publishing DB state...
def handle(self, *args, **options): print('Publishing DB state to etcd...') for app in App.objects.all(): app.save() app.config_set.latest().save() for model in (Key, Domain, Certificate): for obj in model.objects.all(): obj.save() print('Done Publishing DB state...
8408faf780169855940b7d8f567bfd91b795c85e5cfb76cedc651de53678d65e
def get_lffd(blocks, use_preresnet, model_name=None, pretrained=False, root=os.path.join('~', '.tensorflow', 'models'), **kwargs): "\n Create LFFD model with specific parameters.\n\n Parameters:\n ----------\n blocks : int\n Number of blocks.\n use_preresnet : bool\n Whether to use PreR...
Create LFFD model with specific parameters. Parameters: ---------- blocks : int Number of blocks. use_preresnet : bool Whether to use PreResnet backbone instead of ResNet. model_name : str or None, default None Model name for loading pretrained model. pretrained : bool, default False Whether to load th...
tensorflow2/tf2cv/models/lffd.py
get_lffd
JacobARose/imgclsmob
2,649
python
def get_lffd(blocks, use_preresnet, model_name=None, pretrained=False, root=os.path.join('~', '.tensorflow', 'models'), **kwargs): "\n Create LFFD model with specific parameters.\n\n Parameters:\n ----------\n blocks : int\n Number of blocks.\n use_preresnet : bool\n Whether to use PreR...
def get_lffd(blocks, use_preresnet, model_name=None, pretrained=False, root=os.path.join('~', '.tensorflow', 'models'), **kwargs): "\n Create LFFD model with specific parameters.\n\n Parameters:\n ----------\n blocks : int\n Number of blocks.\n use_preresnet : bool\n Whether to use PreR...
86e6e9e9a262a300b7018cdf23e31ed06cecbfd338f103fcb857a3d79e25024e
def lffd20x5s320v2_widerface(**kwargs): "\n LFFD-320-20L-5S-V2 model for WIDER FACE from 'LFFD: A Light and Fast Face Detector for Edge Devices,'\n https://arxiv.org/abs/1904.10633.\n\n Parameters:\n ----------\n pretrained : bool, default False\n Whether to load the pretrained weights for mod...
LFFD-320-20L-5S-V2 model for WIDER FACE from 'LFFD: A Light and Fast Face Detector for Edge Devices,' https://arxiv.org/abs/1904.10633. Parameters: ---------- pretrained : bool, default False Whether to load the pretrained weights for model. root : str, default '~/.tensorflow/models' Location for keeping the m...
tensorflow2/tf2cv/models/lffd.py
lffd20x5s320v2_widerface
JacobARose/imgclsmob
2,649
python
def lffd20x5s320v2_widerface(**kwargs): "\n LFFD-320-20L-5S-V2 model for WIDER FACE from 'LFFD: A Light and Fast Face Detector for Edge Devices,'\n https://arxiv.org/abs/1904.10633.\n\n Parameters:\n ----------\n pretrained : bool, default False\n Whether to load the pretrained weights for mod...
def lffd20x5s320v2_widerface(**kwargs): "\n LFFD-320-20L-5S-V2 model for WIDER FACE from 'LFFD: A Light and Fast Face Detector for Edge Devices,'\n https://arxiv.org/abs/1904.10633.\n\n Parameters:\n ----------\n pretrained : bool, default False\n Whether to load the pretrained weights for mod...
6326be1f16ec33f5ae2a1f5e51792d8dab7e5712bf3ffc01925e8db8945e64e1
def lffd25x8s560v1_widerface(**kwargs): "\n LFFD-560-25L-8S-V1 model for WIDER FACE from 'LFFD: A Light and Fast Face Detector for Edge Devices,'\n https://arxiv.org/abs/1904.10633.\n\n Parameters:\n ----------\n pretrained : bool, default False\n Whether to load the pretrained weights for mod...
LFFD-560-25L-8S-V1 model for WIDER FACE from 'LFFD: A Light and Fast Face Detector for Edge Devices,' https://arxiv.org/abs/1904.10633. Parameters: ---------- pretrained : bool, default False Whether to load the pretrained weights for model. root : str, default '~/.tensorflow/models' Location for keeping the m...
tensorflow2/tf2cv/models/lffd.py
lffd25x8s560v1_widerface
JacobARose/imgclsmob
2,649
python
def lffd25x8s560v1_widerface(**kwargs): "\n LFFD-560-25L-8S-V1 model for WIDER FACE from 'LFFD: A Light and Fast Face Detector for Edge Devices,'\n https://arxiv.org/abs/1904.10633.\n\n Parameters:\n ----------\n pretrained : bool, default False\n Whether to load the pretrained weights for mod...
def lffd25x8s560v1_widerface(**kwargs): "\n LFFD-560-25L-8S-V1 model for WIDER FACE from 'LFFD: A Light and Fast Face Detector for Edge Devices,'\n https://arxiv.org/abs/1904.10633.\n\n Parameters:\n ----------\n pretrained : bool, default False\n Whether to load the pretrained weights for mod...
478b85c0da63c2c8d9b48d4ad30d48adc07b55e503bb06a9e8b1575127a31a5c
def densenet(bottleneck=True, growthRate=32, head7x7=True, dropRate=0, increasingRate=1, compressionRate=2, layers=(6, 12, 24, 16), num_classes=1000): '\n Construct DenseNet.\n (2, 2, 2, 2) for densenet21 # growthRate=24\n (3, 4, 6, 3) for densenet37 # growthRate=24\n (4, 6, 8, 4) for densenet49 # growt...
Construct DenseNet. (2, 2, 2, 2) for densenet21 # growthRate=24 (3, 4, 6, 3) for densenet37 # growthRate=24 (4, 6, 8, 4) for densenet49 # growthRate=24 (4, 8, 16, 8) for densenet77 (6, 12, 24, 16) for densenet121 (6, 12, 32, 32) for densenet169 (6, 12, 48, 32) for densenet201 (6, 12, 64, 48) for densenet264 (6, 12, 36,...
models/imagenet/densenet.py
densenet
alex18212010045/pytorch-priv
60
python
def densenet(bottleneck=True, growthRate=32, head7x7=True, dropRate=0, increasingRate=1, compressionRate=2, layers=(6, 12, 24, 16), num_classes=1000): '\n Construct DenseNet.\n (2, 2, 2, 2) for densenet21 # growthRate=24\n (3, 4, 6, 3) for densenet37 # growthRate=24\n (4, 6, 8, 4) for densenet49 # growt...
def densenet(bottleneck=True, growthRate=32, head7x7=True, dropRate=0, increasingRate=1, compressionRate=2, layers=(6, 12, 24, 16), num_classes=1000): '\n Construct DenseNet.\n (2, 2, 2, 2) for densenet21 # growthRate=24\n (3, 4, 6, 3) for densenet37 # growthRate=24\n (4, 6, 8, 4) for densenet49 # growt...
6aa365cc0faae9475facde3d7c1167cf5166ef7c342e629c584113e0b4db9693
def __init__(self, bottleneck=True, growthRate=32, head7x7=True, dropRate=0, increasingRate=1, compressionRate=2, layers=(6, 12, 24, 16), num_classes=1000): ' Constructor\n Args:\n layers: config of layers, e.g., (6, 12, 24, 16)\n num_classes: number of classes\n ' super(Dens...
Constructor Args: layers: config of layers, e.g., (6, 12, 24, 16) num_classes: number of classes
models/imagenet/densenet.py
__init__
alex18212010045/pytorch-priv
60
python
def __init__(self, bottleneck=True, growthRate=32, head7x7=True, dropRate=0, increasingRate=1, compressionRate=2, layers=(6, 12, 24, 16), num_classes=1000): ' Constructor\n Args:\n layers: config of layers, e.g., (6, 12, 24, 16)\n num_classes: number of classes\n ' super(Dens...
def __init__(self, bottleneck=True, growthRate=32, head7x7=True, dropRate=0, increasingRate=1, compressionRate=2, layers=(6, 12, 24, 16), num_classes=1000): ' Constructor\n Args:\n layers: config of layers, e.g., (6, 12, 24, 16)\n num_classes: number of classes\n ' super(Dens...
f5c3e2a90d2838b468fb6028c346a4a33e229502e5e3c01960badcb0fc8ff88d
def _make_layer(self, block, blocks): ' Stack n bottleneck modules where n is inferred from the depth of the network.\n Args:\n block: block type used to construct DenseNet\n blocks: number of blocks to be built\n Returns: a Module consisting of n sequential bottlenecks.\n ...
Stack n bottleneck modules where n is inferred from the depth of the network. Args: block: block type used to construct DenseNet blocks: number of blocks to be built Returns: a Module consisting of n sequential bottlenecks.
models/imagenet/densenet.py
_make_layer
alex18212010045/pytorch-priv
60
python
def _make_layer(self, block, blocks): ' Stack n bottleneck modules where n is inferred from the depth of the network.\n Args:\n block: block type used to construct DenseNet\n blocks: number of blocks to be built\n Returns: a Module consisting of n sequential bottlenecks.\n ...
def _make_layer(self, block, blocks): ' Stack n bottleneck modules where n is inferred from the depth of the network.\n Args:\n block: block type used to construct DenseNet\n blocks: number of blocks to be built\n Returns: a Module consisting of n sequential bottlenecks.\n ...
a53d4958ec13e19bd933539028434d70b4e93f2bd9df0ec9ac832caacd090049
@patch('RiskSense.get_client_detail_from_context') @patch('RiskSense.Client.http_request') @patch('RiskSense.prepare_filter_payload') def test_hosts(self, mocker_request, mocker_res, mocker_client_id): '\n When "risksense-get-hosts" command executes successfully then context output and response should match....
When "risksense-get-hosts" command executes successfully then context output and response should match. :param mocker_request: mocker object of request. :param mocker_res: mocker object of response. :param mocker_client_id: mocker object of client id. :return: None
Integrations/RiskSense/RiskSense_test.py
test_hosts
aescalona-doitt/content
1
python
@patch('RiskSense.get_client_detail_from_context') @patch('RiskSense.Client.http_request') @patch('RiskSense.prepare_filter_payload') def test_hosts(self, mocker_request, mocker_res, mocker_client_id): '\n When "risksense-get-hosts" command executes successfully then context output and response should match....
@patch('RiskSense.get_client_detail_from_context') @patch('RiskSense.Client.http_request') @patch('RiskSense.prepare_filter_payload') def test_hosts(self, mocker_request, mocker_res, mocker_client_id): '\n When "risksense-get-hosts" command executes successfully then context output and response should match....
c93249bf2c1db12d637cff613a61ed3b2fed55cdf9399e4845fdd895c823a4fd
@patch('RiskSense.get_client_detail_from_context') @patch('RiskSense.Client.http_request') @patch('RiskSense.prepare_payload_for_detail_commands') def test_host_detail(self, mocker_request, mocker_res, mocker_client_id): '\n When "risksense-get-host-detail" command executes successfully then context output a...
When "risksense-get-host-detail" command executes successfully then context output and response should match. :param mocker_request: mocker object of request. :param mocker_res: mocker object of response. :param mocker_client_id: mocker object of client id. :return: None
Integrations/RiskSense/RiskSense_test.py
test_host_detail
aescalona-doitt/content
1
python
@patch('RiskSense.get_client_detail_from_context') @patch('RiskSense.Client.http_request') @patch('RiskSense.prepare_payload_for_detail_commands') def test_host_detail(self, mocker_request, mocker_res, mocker_client_id): '\n When "risksense-get-host-detail" command executes successfully then context output a...
@patch('RiskSense.get_client_detail_from_context') @patch('RiskSense.Client.http_request') @patch('RiskSense.prepare_payload_for_detail_commands') def test_host_detail(self, mocker_request, mocker_res, mocker_client_id): '\n When "risksense-get-host-detail" command executes successfully then context output a...
11540aaf66dd78c727f030bf586c8bdb8d4857aa7b385fa9d9251cdf1c8c4bff
@patch('RiskSense.get_client_detail_from_context') @patch('RiskSense.Client.http_request') @patch('RiskSense.prepare_unique_cves_payload') def test_unique_cves(self, mocker_request, mocker_res, mocker_client_id): '\n When "risksense-get-unique-cves" command executes successfully then context output and respo...
When "risksense-get-unique-cves" command executes successfully then context output and response should match. :param mocker_request: mocker object of request. :param mocker_res: mocker object of response. :param mocker_client_id: mocker object of client id. :return: None
Integrations/RiskSense/RiskSense_test.py
test_unique_cves
aescalona-doitt/content
1
python
@patch('RiskSense.get_client_detail_from_context') @patch('RiskSense.Client.http_request') @patch('RiskSense.prepare_unique_cves_payload') def test_unique_cves(self, mocker_request, mocker_res, mocker_client_id): '\n When "risksense-get-unique-cves" command executes successfully then context output and respo...
@patch('RiskSense.get_client_detail_from_context') @patch('RiskSense.Client.http_request') @patch('RiskSense.prepare_unique_cves_payload') def test_unique_cves(self, mocker_request, mocker_res, mocker_client_id): '\n When "risksense-get-unique-cves" command executes successfully then context output and respo...
03def5fda6f0c21c42f8855a09f52938864cda3bca93827472790a14ba03a635
@patch('RiskSense.get_client_detail_from_context') @patch('RiskSense.Client.http_request') @patch('RiskSense.prepare_filter_payload') def test_host_finding(self, mocker_request, mocker_res, mocker_client_id): '\n When "risksense-get-host-findings" command executes successfully\n then context output an...
When "risksense-get-host-findings" command executes successfully then context output and response should match. :param mocker_request: mocker object of request. :param mocker_res: mocker object of response. :param mocker_client_id: mocker object of client id. :return: None
Integrations/RiskSense/RiskSense_test.py
test_host_finding
aescalona-doitt/content
1
python
@patch('RiskSense.get_client_detail_from_context') @patch('RiskSense.Client.http_request') @patch('RiskSense.prepare_filter_payload') def test_host_finding(self, mocker_request, mocker_res, mocker_client_id): '\n When "risksense-get-host-findings" command executes successfully\n then context output an...
@patch('RiskSense.get_client_detail_from_context') @patch('RiskSense.Client.http_request') @patch('RiskSense.prepare_filter_payload') def test_host_finding(self, mocker_request, mocker_res, mocker_client_id): '\n When "risksense-get-host-findings" command executes successfully\n then context output an...
e217d7c4d68bf439f65be05c07fa4c6436df7fef53c4330b4f39181bafc39de4
@patch('RiskSense.get_client_detail_from_context') @patch('RiskSense.Client.http_request') @patch('RiskSense.prepare_filter_payload') def test_unique_open_findings(self, mocker_request, mocker_res, mocker_client_id): '\n When "risksense-get-unique-open-findings" command executes successfully\n then co...
When "risksense-get-unique-open-findings" command executes successfully then context output and response should match. :param mocker_request: mocker object of request. :param mocker_res: mocker object of response. :param mocker_client_id: mocker object of client id. :return: None
Integrations/RiskSense/RiskSense_test.py
test_unique_open_findings
aescalona-doitt/content
1
python
@patch('RiskSense.get_client_detail_from_context') @patch('RiskSense.Client.http_request') @patch('RiskSense.prepare_filter_payload') def test_unique_open_findings(self, mocker_request, mocker_res, mocker_client_id): '\n When "risksense-get-unique-open-findings" command executes successfully\n then co...
@patch('RiskSense.get_client_detail_from_context') @patch('RiskSense.Client.http_request') @patch('RiskSense.prepare_filter_payload') def test_unique_open_findings(self, mocker_request, mocker_res, mocker_client_id): '\n When "risksense-get-unique-open-findings" command executes successfully\n then co...
b9986597415bd0c7d935ea36a99b2831106ce6d0c749ca24364d9bc0af720699
@patch('RiskSense.get_client_detail_from_context') @patch('RiskSense.Client.http_request') @patch('RiskSense.prepare_filter_payload') def test_apps(self, mocker_request, mocker_res, mocker_client_id): '\n When "risksense-get-apps" command executes successfully\n then context output and response should...
When "risksense-get-apps" command executes successfully then context output and response should match. :param mocker_request: mocker object of request. :param mocker_res: mocker object of response. :param mocker_client_id: mocker object of client id. :return: None
Integrations/RiskSense/RiskSense_test.py
test_apps
aescalona-doitt/content
1
python
@patch('RiskSense.get_client_detail_from_context') @patch('RiskSense.Client.http_request') @patch('RiskSense.prepare_filter_payload') def test_apps(self, mocker_request, mocker_res, mocker_client_id): '\n When "risksense-get-apps" command executes successfully\n then context output and response should...
@patch('RiskSense.get_client_detail_from_context') @patch('RiskSense.Client.http_request') @patch('RiskSense.prepare_filter_payload') def test_apps(self, mocker_request, mocker_res, mocker_client_id): '\n When "risksense-get-apps" command executes successfully\n then context output and response should...
167858d34666acc9b62988a7952fd63ab6c8ba1a7d6c348204494ef213784714
@patch('RiskSense.get_client_detail_from_context') @patch('RiskSense.Client.http_request') @patch('RiskSense.prepare_payload_for_detail_commands') def test_host_finding_detail(self, mocker_request, mocker_res, mocker_client_id): '\n When "risksense-get-host-finding-detail" command executes successfully\n ...
When "risksense-get-host-finding-detail" command executes successfully then context output and response should match. :param mocker_request: mocker object of request. :param mocker_res: mocker object of response. :param mocker_client_id: mocker object of client id. :return: None
Integrations/RiskSense/RiskSense_test.py
test_host_finding_detail
aescalona-doitt/content
1
python
@patch('RiskSense.get_client_detail_from_context') @patch('RiskSense.Client.http_request') @patch('RiskSense.prepare_payload_for_detail_commands') def test_host_finding_detail(self, mocker_request, mocker_res, mocker_client_id): '\n When "risksense-get-host-finding-detail" command executes successfully\n ...
@patch('RiskSense.get_client_detail_from_context') @patch('RiskSense.Client.http_request') @patch('RiskSense.prepare_payload_for_detail_commands') def test_host_finding_detail(self, mocker_request, mocker_res, mocker_client_id): '\n When "risksense-get-host-finding-detail" command executes successfully\n ...
5442447a1d3be1f3535dc7c60bb5384c8ef60052e867546df51a3028bcf05577
@patch('RiskSense.get_client_detail_from_context') @patch('RiskSense.Client.http_request') @patch('RiskSense.prepare_payload_for_detail_commands') def test_app_detail(self, mocker_request, mocker_res, mocker_client_id): '\n When "risksense-get-app-detail" command executes successfully\n then context o...
When "risksense-get-app-detail" command executes successfully then context output and response should match. :param mocker_request: mocker object of request. :param mocker_res: mocker object of response. :param mocker_client_id: mocker object of client id. :return: None
Integrations/RiskSense/RiskSense_test.py
test_app_detail
aescalona-doitt/content
1
python
@patch('RiskSense.get_client_detail_from_context') @patch('RiskSense.Client.http_request') @patch('RiskSense.prepare_payload_for_detail_commands') def test_app_detail(self, mocker_request, mocker_res, mocker_client_id): '\n When "risksense-get-app-detail" command executes successfully\n then context o...
@patch('RiskSense.get_client_detail_from_context') @patch('RiskSense.Client.http_request') @patch('RiskSense.prepare_payload_for_detail_commands') def test_app_detail(self, mocker_request, mocker_res, mocker_client_id): '\n When "risksense-get-app-detail" command executes successfully\n then context o...
f6286a66626743cf6196f5fb5fa61e1a133ba663d1bdab88642c51046e132ada
def avg_Q(q_S, q_D): '\n Return total transmission capacity of station, assuming transmission evenly distributed over hexagonal cell\n \n Parameters\n ----------\n q_S : float\n channel capacity in Mbps\n q_D : float\n data demand rate in Mbps\n \n\n ...
Return total transmission capacity of station, assuming transmission evenly distributed over hexagonal cell Parameters ---------- q_S : float channel capacity in Mbps q_D : float data demand rate in Mbps Returns ------- q : float average demand speed, in Mbps, based on Sha...
code/counterfactuals/transmissionequilibrium.py
avg_Q
jonathantelliott/mobile-telecommunications
2
python
def avg_Q(q_S, q_D): '\n Return total transmission capacity of station, assuming transmission evenly distributed over hexagonal cell\n \n Parameters\n ----------\n q_S : float\n channel capacity in Mbps\n q_D : float\n data demand rate in Mbps\n \n\n ...
def avg_Q(q_S, q_D): '\n Return total transmission capacity of station, assuming transmission evenly distributed over hexagonal cell\n \n Parameters\n ----------\n q_S : float\n channel capacity in Mbps\n q_D : float\n data demand rate in Mbps\n \n\n ...
fa26520b9dcb0737ac118bfe80bdef94394ef5e97bd5255f03581aaf9d21cffd
def data_demand(ds, xis, theta, Q, pop): '\n Return the data demanded in a month\n \n Parameters\n ----------\n ds : DemandSystem\n contains all the data about our markets\n xis : ndarray \n (M,J) matrix of vertical demand components\n theta : ndarray\n ...
Return the data demanded in a month Parameters ---------- ds : DemandSystem contains all the data about our markets xis : ndarray (M,J) matrix of vertical demand components theta : ndarray (K,) array of demand parameters Q : ndarray (M,F) array of market-firm-specific d...
code/counterfactuals/transmissionequilibrium.py
data_demand
jonathantelliott/mobile-telecommunications
2
python
def data_demand(ds, xis, theta, Q, pop): '\n Return the data demanded in a month\n \n Parameters\n ----------\n ds : DemandSystem\n contains all the data about our markets\n xis : ndarray \n (M,J) matrix of vertical demand components\n theta : ndarray\n ...
def data_demand(ds, xis, theta, Q, pop): '\n Return the data demanded in a month\n \n Parameters\n ----------\n ds : DemandSystem\n contains all the data about our markets\n xis : ndarray \n (M,J) matrix of vertical demand components\n theta : ndarray\n ...
e39b3748c7c7f2a64d528a4c848fe48742e2c50acbdf58c0b81e46ce08658389
def data_demand_rate(ds, xis, theta, Q, num_stations, pop): '\n Return the data demand rate\n \n Parameters\n ----------\n ds : DemandSystem\n contains all the data about our markets\n xis : ndarray \n (M,J) matrix of vertical demand components\n theta : nd...
Return the data demand rate Parameters ---------- ds : DemandSystem contains all the data about our markets xis : ndarray (M,J) matrix of vertical demand components theta : ndarray (K,) array of demand parameters Q : ndarray (M,F) array of market-firm-specific download ...
code/counterfactuals/transmissionequilibrium.py
data_demand_rate
jonathantelliott/mobile-telecommunications
2
python
def data_demand_rate(ds, xis, theta, Q, num_stations, pop): '\n Return the data demand rate\n \n Parameters\n ----------\n ds : DemandSystem\n contains all the data about our markets\n xis : ndarray \n (M,J) matrix of vertical demand components\n theta : nd...
def data_demand_rate(ds, xis, theta, Q, num_stations, pop): '\n Return the data demand rate\n \n Parameters\n ----------\n ds : DemandSystem\n contains all the data about our markets\n xis : ndarray \n (M,J) matrix of vertical demand components\n theta : nd...
b2cd2a36b837252356bf27d99a3612a4ee4ff810b99bc7bab57bed3e7039e7b8
def q_MVNO(qs, firms_share): '\n Return the MVNO quality as a function of other firms qualities\n \n Parameters\n ----------\n qs : ndarray\n (M,F-1) array of market-firm-specific download speeds in Gbps\n firms_share : ndarray\n (F-1,) array of whether firms shar...
Return the MVNO quality as a function of other firms qualities Parameters ---------- qs : ndarray (M,F-1) array of market-firm-specific download speeds in Gbps firms_share : ndarray (F-1,) array of whether firms share qualities with MVNOs Returns ------- qs_MVNO : ndarray (M,) arra...
code/counterfactuals/transmissionequilibrium.py
q_MVNO
jonathantelliott/mobile-telecommunications
2
python
def q_MVNO(qs, firms_share): '\n Return the MVNO quality as a function of other firms qualities\n \n Parameters\n ----------\n qs : ndarray\n (M,F-1) array of market-firm-specific download speeds in Gbps\n firms_share : ndarray\n (F-1,) array of whether firms shar...
def q_MVNO(qs, firms_share): '\n Return the MVNO quality as a function of other firms qualities\n \n Parameters\n ----------\n qs : ndarray\n (M,F-1) array of market-firm-specific download speeds in Gbps\n firms_share : ndarray\n (F-1,) array of whether firms shar...
be76a7f06c8fc83c9cf736cc93675b24e59bcd2e2e7fb74fa74277ac15c13c6f
def q_res(q, cc, ds, xis, theta, num_stations, pop, impute_MVNO={'impute': False}): "\n Return the residual relative to predicted quality\n \n Parameters\n ----------\n q : ndarray\n (M,F-1) array of market-firm-specific download speeds in Mbps\n cc : ndarray\n (M...
Return the residual relative to predicted quality Parameters ---------- q : ndarray (M,F-1) array of market-firm-specific download speeds in Mbps cc : ndarray (M,F-1) array of channel capacity in Mbps ds : DemandSystem contains all the data about our markets xis : ndarray ...
code/counterfactuals/transmissionequilibrium.py
q_res
jonathantelliott/mobile-telecommunications
2
python
def q_res(q, cc, ds, xis, theta, num_stations, pop, impute_MVNO={'impute': False}): "\n Return the residual relative to predicted quality\n \n Parameters\n ----------\n q : ndarray\n (M,F-1) array of market-firm-specific download speeds in Mbps\n cc : ndarray\n (M...
def q_res(q, cc, ds, xis, theta, num_stations, pop, impute_MVNO={'impute': False}): "\n Return the residual relative to predicted quality\n \n Parameters\n ----------\n q : ndarray\n (M,F-1) array of market-firm-specific download speeds in Mbps\n cc : ndarray\n (M...
5d0aebc08ebe642ff15ab493d9521accbda48a0f7798afcb57dc4a16af73db17
def q(cc, ds, xis, theta, num_stations, pop, impute_MVNO={'impute': False}, q_0=None): "\n Return the equilibrium quality\n \n Parameters\n ----------\n cc : ndarray\n (M,F-1) array of channel capacities in Mb/s\n ds : DemandSystem\n contains all the data about ou...
Return the equilibrium quality Parameters ---------- cc : ndarray (M,F-1) array of channel capacities in Mb/s ds : DemandSystem contains all the data about our markets xis : ndarray (M,J) matrix of vertical demand components theta : ndarray (K,) array of demand paramete...
code/counterfactuals/transmissionequilibrium.py
q
jonathantelliott/mobile-telecommunications
2
python
def q(cc, ds, xis, theta, num_stations, pop, impute_MVNO={'impute': False}, q_0=None): "\n Return the equilibrium quality\n \n Parameters\n ----------\n cc : ndarray\n (M,F-1) array of channel capacities in Mb/s\n ds : DemandSystem\n contains all the data about ou...
def q(cc, ds, xis, theta, num_stations, pop, impute_MVNO={'impute': False}, q_0=None): "\n Return the equilibrium quality\n \n Parameters\n ----------\n cc : ndarray\n (M,F-1) array of channel capacities in Mb/s\n ds : DemandSystem\n contains all the data about ou...
d3de2f9533c972d36f0eba42246c410397c3e2c63ae3867ed6c4af986599f631
def climate_flow_correlation(climate_dir, in_json, out_json, plot_r=None): 'Find linear relationship between climate and flow in an expanding time window' l = sorted([os.path.join(climate_dir, x) for x in os.listdir(climate_dir)]) print(len(l), 'station files') offsets = [x for x in range(1, 61)] wi...
Find linear relationship between climate and flow in an expanding time window
gage_analysis.py
climate_flow_correlation
dgketchum/irr_impacts
0
python
def climate_flow_correlation(climate_dir, in_json, out_json, plot_r=None): l = sorted([os.path.join(climate_dir, x) for x in os.listdir(climate_dir)]) print(len(l), 'station files') offsets = [x for x in range(1, 61)] windows = {} with open(in_json, 'r') as f: metadata = json.load(f) ...
def climate_flow_correlation(climate_dir, in_json, out_json, plot_r=None): l = sorted([os.path.join(climate_dir, x) for x in os.listdir(climate_dir)]) print(len(l), 'station files') offsets = [x for x in range(1, 61)] windows = {} with open(in_json, 'r') as f: metadata = json.load(f) ...
a6a7e26b300af1a5cccbcc8a551a0594d98dee0b87b724d34e2862504fcc5225
def _assert_is_numpy_array(name, array): 'Raises an exception if `array` is not a numpy array.' if (not isinstance(array, np.ndarray)): raise ValueError('The argument {!r} should be a numpy array, not a {}'.format(name, type(array)))
Raises an exception if `array` is not a numpy array.
surface_distance/metrics.py
_assert_is_numpy_array
capitaltg/surface-distance
314
python
def _assert_is_numpy_array(name, array): if (not isinstance(array, np.ndarray)): raise ValueError('The argument {!r} should be a numpy array, not a {}'.format(name, type(array)))
def _assert_is_numpy_array(name, array): if (not isinstance(array, np.ndarray)): raise ValueError('The argument {!r} should be a numpy array, not a {}'.format(name, type(array)))<|docstring|>Raises an exception if `array` is not a numpy array.<|endoftext|>