uid
stringlengths
24
24
split
stringclasses
1 value
category
stringclasses
2 values
content
stringlengths
5
482k
signature
stringlengths
1
14k
suffix
stringlengths
1
482k
prefix
stringlengths
9
14k
prefix_token_count
int64
3
5.01k
prefix_token_budget
int64
64
256
element_token_count
int64
1
292k
signature_token_count
int64
1
5.01k
prefix_context_token_count
int64
0
255
repo
stringlengths
7
112
path
stringlengths
4
208
language
stringclasses
1 value
name
stringlengths
1
218
qualname
stringlengths
1
218
start_line
int64
1
26.7k
end_line
int64
1
26.7k
signature_start_line
int64
1
26.7k
signature_end_line
int64
1
26.7k
source_hash
stringlengths
40
40
source_dataset
stringclasses
1 value
source_split
stringclasses
1 value
7eb0aac86920c0af3be41632
train
function
@pytest.mark.parametrize("fs,data_path,endpoint_url", [ (None, lazy_fixture("local_path"), None), (lazy_fixture("local_fs"), lazy_fixture("local_path"), None), (lazy_fixture("s3_fs"), lazy_fixture("s3_path"), lazy_fixture("s3_server")) ]) def test_numpy_write_block_path_provider(ray_start_regular_shared, fs...
@pytest.mark.parametrize("fs,data_path,endpoint_url", [ (None, lazy_fixture("local_path"), None), (lazy_fixture("local_fs"), lazy_fixture("local_path"), None), (lazy_fixture("s3_fs"), lazy_fixture("s3_path"), lazy_fixture("s3_server")) ]) def test_numpy_write_block_path_provider(ray_start_regular_shared, fs...
ds = ray.data.range_tensor(10, parallelism=2) ds._set_uuid("data") ds.write_numpy( data_path, filesystem=fs, block_path_provider=test_block_write_path_provider) file_path1 = os.path.join(data_path, "000000_05_data.test.npy") file_path2 = os.path.join(data_path, "000001_05_dat...
': array([0])}]" @pytest.mark.parametrize("fs,data_path,endpoint_url", [ (None, lazy_fixture("local_path"), None), (lazy_fixture("local_fs"), lazy_fixture("local_path"), None), (lazy_fixture("s3_fs"), lazy_fixture("s3_path"), lazy_fixture("s3_server")) ]) def test_numpy_write_block_path_provider(ray_start_r...
99
99
332
92
7
spillai/ray
python/ray/data/tests/test_dataset.py
Python
test_numpy_write_block_path_provider
test_numpy_write_block_path_provider
939
968
939
946
092f7bb48c4223a49b9df17bdeec6566763bdc34
bigcode/the-stack
train
e7b7cc72375a3635c86da667
train
function
def test_to_modin(ray_start_regular_shared): # create two modin dataframes # one directly from a pandas dataframe, and # another from ray.dataset created from the original pandas dataframe # import modin.pandas as mopd df = pd.DataFrame({"one": list(range(100)), "two": list(range(100))}, ) m...
def test_to_modin(ray_start_regular_shared): # create two modin dataframes # one directly from a pandas dataframe, and # another from ray.dataset created from the original pandas dataframe #
import modin.pandas as mopd df = pd.DataFrame({"one": list(range(100)), "two": list(range(100))}, ) modf1 = mopd.DataFrame(df) ds = ray.data.from_pandas([df]) modf2 = ds.to_modin() assert modf1.equals(modf2)
(modf) dfds = ds.to_pandas() assert df.equals(dfds) def test_to_modin(ray_start_regular_shared): # create two modin dataframes # one directly from a pandas dataframe, and # another from ray.dataset created from the original pandas dataframe #
64
64
121
45
19
spillai/ray
python/ray/data/tests/test_dataset.py
Python
test_to_modin
test_to_modin
2,305
2,315
2,305
2,309
013f1ac93a21e597472eb10945ac173392311212
bigcode/the-stack
train
e0ec3f51d72f234c32bf6a02
train
function
@pytest.mark.parametrize("num_parts", [1, 15, 100]) def test_groupby_arrow_mean(ray_start_regular_shared, num_parts): # Test built-in mean aggregation seed = int(time.time()) print(f"Seeding RNG for test_groupby_arrow_mean with: {seed}") random.seed(seed) xs = list(range(100)) random.shuffle(xs)...
@pytest.mark.parametrize("num_parts", [1, 15, 100]) def test_groupby_arrow_mean(ray_start_regular_shared, num_parts): # Test built-in mean aggregation
seed = int(time.time()) print(f"Seeding RNG for test_groupby_arrow_mean with: {seed}") random.seed(seed) xs = list(range(100)) random.shuffle(xs) agg_ds = ray.data.from_items([{ "A": (x % 3), "B": x } for x in xs]).repartition(num_parts).groupby("A").mean("B") assert agg_...
in xs]).repartition(num_parts).max("A") == 99 with pytest.raises(ValueError): ray.data.range_arrow(10).filter(lambda r: r["value"] > 10).max("value") @pytest.mark.parametrize("num_parts", [1, 15, 100]) def test_groupby_arrow_mean(ray_start_regular_shared, num_parts): # Test built-in mean aggregation
85
85
286
38
47
spillai/ray
python/ray/data/tests/test_dataset.py
Python
test_groupby_arrow_mean
test_groupby_arrow_mean
3,157
3,179
3,157
3,159
8d12a1075caa2d6d3b3787e520ebb553054186da
bigcode/the-stack
train
26c7cf3967637b8ced64029d
train
function
def test_get_internal_block_refs(ray_start_regular_shared): blocks = ray.data.range(10).get_internal_block_refs() assert len(blocks) == 10 out = [] for b in ray.get(blocks): out.extend(list(BlockAccessor.for_block(b).iter_rows())) out = sorted(out) assert out == list(range(10)), out
def test_get_internal_block_refs(ray_start_regular_shared):
blocks = ray.data.range(10).get_internal_block_refs() assert len(blocks) == 10 out = [] for b in ray.get(blocks): out.extend(list(BlockAccessor.for_block(b).iter_rows())) out = sorted(out) assert out == list(range(10)), out
({0: list(range(n))}) ds = ray.data.range(n) dfds = pd.concat( [t.to_pandas() for t in ray.get(ds.to_arrow_refs())], ignore_index=True) assert df.equals(dfds) def test_get_internal_block_refs(ray_start_regular_shared):
64
64
78
11
53
spillai/ray
python/ray/data/tests/test_dataset.py
Python
test_get_internal_block_refs
test_get_internal_block_refs
1,305
1,312
1,305
1,305
09cb05eb629d72b4a300e02ce18da862319ed290
bigcode/the-stack
train
fd7538d0958e4ef6525d9aa2
train
class
class EndToEndTest(unittest.TestCase): def setUp(self): print('\n-------------------------') print('Running: %s\n' % self.id()) # The response library cannot replay requests in a multi-threaded # environment. We have to disable threading for testing... with open(CONFIG_FILE) as f: self._co...
class EndToEndTest(unittest.TestCase):
def setUp(self): print('\n-------------------------') print('Running: %s\n' % self.id()) # The response library cannot replay requests in a multi-threaded # environment. We have to disable threading for testing... with open(CONFIG_FILE) as f: self._config = json.load(f) self._config.upd...
from smugcli import smugcli import io_expectation as expect import base64 import contextlib import glob import json import os import re import responses import shutil import six import sys import unittest CONFIG_FILE = os.path.expanduser('~/.smugcli') TEST_DIR = os.path.dirname(os.path.realpath(__file__)) @contextl...
246
256
8,815
9
236
idc101/smugcli
tests/end_to_end_test.py
Python
EndToEndTest
EndToEndTest
46
909
46
47
2fc20cd921f762adf9f7fcfa1f8a51fd7a4c7a21
bigcode/the-stack
train
faa97940a6be613f235c1d5e
train
function
@contextlib.contextmanager def set_cwd(new_dir): original_dir = os.getcwd() try: os.chdir(new_dir) yield finally: os.chdir(original_dir)
@contextlib.contextmanager def set_cwd(new_dir):
original_dir = os.getcwd() try: os.chdir(new_dir) yield finally: os.chdir(original_dir)
json import os import re import responses import shutil import six import sys import unittest CONFIG_FILE = os.path.expanduser('~/.smugcli') TEST_DIR = os.path.dirname(os.path.realpath(__file__)) @contextlib.contextmanager def set_cwd(new_dir):
63
64
41
13
50
idc101/smugcli
tests/end_to_end_test.py
Python
set_cwd
set_cwd
20
27
20
21
977782015dc902455791863e000f05e4bb782ca2
bigcode/the-stack
train
64a03485be106344226921df
train
function
def format_path(path): try: path = path.format(root=ROOT_DIR, testdata=os.path.join(TEST_DIR, 'testdata')) except ValueError: # Ignore unmatched '{'. pass # On windows, replace '/' for '\\', keeping '\\/' as '/'. fix_slash_re = re.compile(r'([^\\])/') path = fix_slash_re.sub(r...
def format_path(path):
try: path = path.format(root=ROOT_DIR, testdata=os.path.join(TEST_DIR, 'testdata')) except ValueError: # Ignore unmatched '{'. pass # On windows, replace '/' for '\\', keeping '\\/' as '/'. fix_slash_re = re.compile(r'([^\\])/') path = fix_slash_re.sub(r'\1\%s' % os.sep, path)...
(os.path.realpath(__file__)) @contextlib.contextmanager def set_cwd(new_dir): original_dir = os.getcwd() try: os.chdir(new_dir) yield finally: os.chdir(original_dir) ROOT_DIR = '__smugcli_tests__' def format_path(path):
64
64
109
5
59
idc101/smugcli
tests/end_to_end_test.py
Python
format_path
format_path
32
43
32
32
fbe788447ba58d5dcc370641a97181e03bd2cc1c
bigcode/the-stack
train
c541d2543643fc88612cc089
train
function
def load_config(path): param = yaml.safe_load(open(path)) return param
def load_config(path):
param = yaml.safe_load(open(path)) return param
as pd import yaml import argparse import logging logging.basicConfig(filename='logs/log.txt', filemode= 'a', format='%(asctime)s %(levelname)s - %(message)s', datefmt='%Y-%m-%d %H:%M:%S') def load_config(path):
64
64
18
5
59
mugeshk97/mobile-price-classification
src/get_data.py
Python
load_config
load_config
10
12
10
10
d186be56bb9f30bed3cd83e0637f47c4eae6d14f
bigcode/the-stack
train
6410b6c1795e14def4b9678a
train
function
def load_data(config): data_path = config['data_src']['main_data'] feature_config = config['features'] try: data = pd.read_csv(data_path) data = data[feature_config['selected']] data.to_csv(feature_config['path'], index = False) except Exception as e: logging.error(e)
def load_data(config):
data_path = config['data_src']['main_data'] feature_config = config['features'] try: data = pd.read_csv(data_path) data = data[feature_config['selected']] data.to_csv(feature_config['path'], index = False) except Exception as e: logging.error(e)
/log.txt', filemode= 'a', format='%(asctime)s %(levelname)s - %(message)s', datefmt='%Y-%m-%d %H:%M:%S') def load_config(path): param = yaml.safe_load(open(path)) return param def load_data(config):
64
64
71
5
58
mugeshk97/mobile-price-classification
src/get_data.py
Python
load_data
load_data
14
22
14
14
c0e0c44100d481080d28953c8c8c7ef78dcb0b88
bigcode/the-stack
train
b47bb5d04d8f33343bb980a0
train
class
class Test_wrap_in_script_tag: def test_render(self) -> None: assert bew.wrap_in_script_tag("code\nmorecode") == """ <script type="text/javascript"> code morecode </script>\ """
class Test_wrap_in_script_tag:
def test_render(self) -> None: assert bew.wrap_in_script_tag("code\nmorecode") == """ <script type="text/javascript"> code morecode </script>\ """
fn); })();\ """ class Test_wrap_in_safely: def test_render(self) -> None: assert bew.wrap_in_safely("code\nmorecode") == """\ Bokeh.safely(function() { code morecode });\ """ class Test_wrap_in_script_tag:
64
64
48
7
57
IuryPiva/bokeh
tests/unit/bokeh/embed/test_wrappers__embed.py
Python
Test_wrap_in_script_tag
Test_wrap_in_script_tag
58
65
58
58
2030fef9e2882f73a40be54f404916ac2b128b7a
bigcode/the-stack
train
a444ebd8b18cf9894a6dd7c9
train
function
def test__SAFELY() -> None: assert bew._SAFELY == """\ Bokeh.safely(function() { %(code)s });"""\
def test__SAFELY() -> None:
assert bew._SAFELY == """\ Bokeh.safely(function() { %(code)s });"""\
None: assert bew._ONLOAD == """\ (function() { const fn = function() { %(code)s }; if (document.readyState != "loading") fn(); else document.addEventListener("DOMContentLoaded", fn); })();\ """ def test__SAFELY() -> None:
64
64
35
10
54
IuryPiva/bokeh
tests/unit/bokeh/embed/test_wrappers__embed.py
Python
test__SAFELY
test__SAFELY
82
86
82
82
bb642d959cd81b83666ab2090020f263141da545
bigcode/the-stack
train
dd504e5126f0bf56607e1c9a
train
class
class Test_wrap_in_onload: def test_render(self) -> None: assert bew.wrap_in_onload("code\nmorecode") == """\ (function() { const fn = function() { code morecode }; if (document.readyState != "loading") fn(); else document.addEventListener("DOMContentLoaded", fn); })();\ """
class Test_wrap_in_onload:
def test_render(self) -> None: assert bew.wrap_in_onload("code\nmorecode") == """\ (function() { const fn = function() { code morecode }; if (document.readyState != "loading") fn(); else document.addEventListener("DOMContentLoaded", fn); })();\ """
; pytest #----------------------------------------------------------------------------- # Imports #----------------------------------------------------------------------------- # Module under test import bokeh.embed.wrappers as bew # isort:skip #---------------------------------------------------------------------...
63
64
78
7
56
IuryPiva/bokeh
tests/unit/bokeh/embed/test_wrappers__embed.py
Python
Test_wrap_in_onload
Test_wrap_in_onload
34
45
34
34
3790af958a0588961d600b28f09e002dbf4e9033
bigcode/the-stack
train
56de7d4b61019656395acbbc
train
function
def test__ONLOAD() -> None: assert bew._ONLOAD == """\ (function() { const fn = function() { %(code)s }; if (document.readyState != "loading") fn(); else document.addEventListener("DOMContentLoaded", fn); })();\ """
def test__ONLOAD() -> None:
assert bew._ONLOAD == """\ (function() { const fn = function() { %(code)s }; if (document.readyState != "loading") fn(); else document.addEventListener("DOMContentLoaded", fn); })();\ """
_wrap_in_script_tag: def test_render(self) -> None: assert bew.wrap_in_script_tag("code\nmorecode") == """ <script type="text/javascript"> code morecode </script>\ """ #----------------------------------------------------------------------------- # Private API #-----------------------------------------...
63
64
61
9
54
IuryPiva/bokeh
tests/unit/bokeh/embed/test_wrappers__embed.py
Python
test__ONLOAD
test__ONLOAD
71
80
71
71
f6397f1ec654212ac1a2ea10fd05affee397df62
bigcode/the-stack
train
cefcf119a44f21ed30b99482
train
class
class Test_wrap_in_safely: def test_render(self) -> None: assert bew.wrap_in_safely("code\nmorecode") == """\ Bokeh.safely(function() { code morecode });\ """
class Test_wrap_in_safely:
def test_render(self) -> None: assert bew.wrap_in_safely("code\nmorecode") == """\ Bokeh.safely(function() { code morecode });\ """
load("code\nmorecode") == """\ (function() { const fn = function() { code morecode }; if (document.readyState != "loading") fn(); else document.addEventListener("DOMContentLoaded", fn); })();\ """ class Test_wrap_in_safely:
64
64
52
8
56
IuryPiva/bokeh
tests/unit/bokeh/embed/test_wrappers__embed.py
Python
Test_wrap_in_safely
Test_wrap_in_safely
48
55
48
48
e3f126b79cfa0d4d04273bd594cb925d2d1e6adf
bigcode/the-stack
train
d4a26fea0f2a5b7009fd7a56
train
function
def excepthook(exc, value, tb): formatted = format_exception(exc, value, tb) write_stream(formatted, STREAM)
def excepthook(exc, value, tb):
formatted = format_exception(exc, value, tb) write_stream(formatted, STREAM)
user to the global parameters formatter = ExceptionFormatter(colored=SUPPORTS_COLOR, theme=THEME, max_length=MAX_LENGTH, pipe_char=PIPE_CHAR, cap_char=CAP_CHAR) return formatter.format_exception(exc, value, tb) def excepthook(exc, value, tb):
64
64
29
10
54
avim2809/CameraSiteBlocker
venv/Lib/site-packages/better_exceptions/__init__.py
Python
excepthook
excepthook
52
54
52
52
3faee07c0d39f6102ea1e20bcde84f0bc1919c43
bigcode/the-stack
train
f178041edc85ffe41454e568
train
function
def format_exception(exc, value, tb): # Rebuild each time to take into account any changes made by the user to the global parameters formatter = ExceptionFormatter(colored=SUPPORTS_COLOR, theme=THEME, max_length=MAX_LENGTH, pipe_char=PIPE_CHAR, cap_char=CAP_CHAR) return fo...
def format_exception(exc, value, tb): # Rebuild each time to take into account any changes made by the user to the global parameters
formatter = ExceptionFormatter(colored=SUPPORTS_COLOR, theme=THEME, max_length=MAX_LENGTH, pipe_char=PIPE_CHAR, cap_char=CAP_CHAR) return formatter.format_exception(exc, value, tb)
data = to_byte(data) if PY3: stream.buffer.write(data) else: stream.write(data) else: stream.write(data) def format_exception(exc, value, tb): # Rebuild each time to take into account any changes made by the user to the global parameters
64
64
78
30
34
avim2809/CameraSiteBlocker
venv/Lib/site-packages/better_exceptions/__init__.py
Python
format_exception
format_exception
45
49
45
46
51eb30b7b56128fc76d3986b971b415bd4397163
bigcode/the-stack
train
a842566191abbc9e3446de6c
train
function
def write_stream(data, stream=STREAM): if SHOULD_ENCODE: data = to_byte(data) if PY3: stream.buffer.write(data) else: stream.write(data) else: stream.write(data)
def write_stream(data, stream=STREAM):
if SHOULD_ENCODE: data = to_byte(data) if PY3: stream.buffer.write(data) else: stream.write(data) else: stream.write(data)
STREAM from .log import BetExcLogger, patch as patch_logging from .repl import interact, get_repl __version__ = '0.2.2' THEME = THEME.copy() # Users customizing the theme should not impact core def write_stream(data, stream=STREAM):
64
64
49
9
54
avim2809/CameraSiteBlocker
venv/Lib/site-packages/better_exceptions/__init__.py
Python
write_stream
write_stream
33
42
33
33
1ed9337dc463252b5ac2d7898894ae432b05fd13
bigcode/the-stack
train
8dedcb69fd1b6adca3902291
train
function
def hook(): sys.excepthook = excepthook logging.setLoggerClass(BetExcLogger) patch_logging() if hasattr(sys, 'ps1'): print('WARNING: better_exceptions will only inspect code from the command line\n' ' when using: `python -m better_exceptions\'. Otherwise, only code\n' ...
def hook():
sys.excepthook = excepthook logging.setLoggerClass(BetExcLogger) patch_logging() if hasattr(sys, 'ps1'): print('WARNING: better_exceptions will only inspect code from the command line\n' ' when using: `python -m better_exceptions\'. Otherwise, only code\n' '...
ME, max_length=MAX_LENGTH, pipe_char=PIPE_CHAR, cap_char=CAP_CHAR) return formatter.format_exception(exc, value, tb) def excepthook(exc, value, tb): formatted = format_exception(exc, value, tb) write_stream(formatted, STREAM) def hook():
64
64
90
3
61
avim2809/CameraSiteBlocker
venv/Lib/site-packages/better_exceptions/__init__.py
Python
hook
hook
57
66
57
57
f5258c7d545f06defda8d6ccce3ca93f643f22cc
bigcode/the-stack
train
57ed31161afbcf72e321f35d
train
function
def read_unsigned_int(from_bytes: bytes) -> int: """ from_bytes is the binary file contents to read from :param from_bytes: string representation of binary bytes read from a file :return: integer """ return int.from_bytes(from_bytes, byteorder='little', signed=False)
def read_unsigned_int(from_bytes: bytes) -> int:
""" from_bytes is the binary file contents to read from :param from_bytes: string representation of binary bytes read from a file :return: integer """ return int.from_bytes(from_bytes, byteorder='little', signed=False)
0: return 2 if (value >> 31) == 0: return 4 if (value >> 63) == 0: return 8 raise IntegerLargerThan64BitsException def read_unsigned_int(from_bytes: bytes) -> int:
64
64
66
12
51
BrianKopp/pandas-io
pandasio/utils/binary.py
Python
read_unsigned_int
read_unsigned_int
46
52
46
46
51c645067e14cf68a710c5a1784102709d9951a3
bigcode/the-stack
train
af5baadcd4f54962c5f2912f
train
function
def determine_required_bytes_signed_integer(value: int) -> int: """ Determines the number of bytes that are required to store value :param value: a SIGNED integer :return: 1, 2, 4, or 8 """ value = ensure_int(value) if value < 0: value *= -1 value -= 1 if (value >> 7) == ...
def determine_required_bytes_signed_integer(value: int) -> int:
""" Determines the number of bytes that are required to store value :param value: a SIGNED integer :return: 1, 2, 4, or 8 """ value = ensure_int(value) if value < 0: value *= -1 value -= 1 if (value >> 7) == 0: return 1 if (value >> 15) == 0: return 2 ...
0: return 2 if (value >> 32) == 0: return 4 if (value >> 64) == 0: return 8 raise IntegerLargerThan64BitsException def determine_required_bytes_signed_integer(value: int) -> int:
64
64
161
13
50
BrianKopp/pandas-io
pandasio/utils/binary.py
Python
determine_required_bytes_signed_integer
determine_required_bytes_signed_integer
25
43
25
25
b1f13f0ac0379a9ea400f25da92058fd162072a8
bigcode/the-stack
train
22aa9145a13f7402085d08d4
train
function
def determine_required_bytes_unsigned_integer(value: int) -> int: """ Determines the number of bytes that are required to store value :param value: an UNSIGNED integer :return: 1, 2, 4, or 8 """ value = ensure_int(value) if value < 0: raise IntegerNotUnsignedException if (value >...
def determine_required_bytes_unsigned_integer(value: int) -> int:
""" Determines the number of bytes that are required to store value :param value: an UNSIGNED integer :return: 1, 2, 4, or 8 """ value = ensure_int(value) if value < 0: raise IntegerNotUnsignedException if (value >> 8) == 0: return 1 if (value >> 16) == 0: ret...
from pandasio.utils.exceptions import IntegerNotUnsignedException, IntegerLargerThan64BitsException from pandasio.utils.validation import ensure_int def determine_required_bytes_unsigned_integer(value: int) -> int:
41
64
156
13
27
BrianKopp/pandas-io
pandasio/utils/binary.py
Python
determine_required_bytes_unsigned_integer
determine_required_bytes_unsigned_integer
5
22
5
5
25879e5d3a82b6a5edf7b692af89700ddd7eab7d
bigcode/the-stack
train
d943ca63f14e8ed6bf98fd98
train
class
@export class LinkedZoomFactor(make_linked_navigation_type(float, interpolate_zoom)): __slots__ = ()
@export class LinkedZoomFactor(make_linked_navigation_type(float, interpolate_zoom)):
__slots__ = ()
, b, t) return c return c return LinkedType @export class LinkedPosition(make_linked_navigation_type(array_wrapper(np.float32), interpolate_linear_optional_vectors)): __slots__ = () @export class LinkedZoomFactor(make_linked_navigation_type(float, interpolate_zoom)):
63
64
23
17
46
brifly1/neuroglancer
python/neuroglancer/viewer_state.py
Python
LinkedZoomFactor
LinkedZoomFactor
831
833
831
832
4e9e9e50132e18a3fa3698df2799e9ced1f6d72e
bigcode/the-stack
train
b6d3e6a5969561f271c9213f
train
class
@export class CrossSection(JsonObjectWrapper): __slots__ = () supports_validation = True width = wrapped_property('width', optional(int, 1000)) height = wrapped_property('height', optional(int, 1000)) position = wrapped_property('position', LinkedPosition) orientation = wrapped_property('orienta...
@export class CrossSection(JsonObjectWrapper):
__slots__ = () supports_validation = True width = wrapped_property('width', optional(int, 1000)) height = wrapped_property('height', optional(int, 1000)) position = wrapped_property('position', LinkedPosition) orientation = wrapped_property('orientation', LinkedOrientationState) scale = wrap...
class LinkedDepthRange(make_linked_navigation_type(float, interpolate_zoom)): __slots__ = () @export class LinkedOrientationState(make_linked_navigation_type(array_wrapper(np.float32, 4), quaternion_slerp)): __slots__ = () @export class CrossSection(JsonObjectWrapper):
63
64
186
10
53
brifly1/neuroglancer
python/neuroglancer/viewer_state.py
Python
CrossSection
CrossSection
847
865
847
848
2ccc889a259a5a442e20fe0cc15407976b90a90b
bigcode/the-stack
train
b492ca95dbc30cb0f3dfc306
train
class
@export class AxisAlignedBoundingBoxAnnotation(AnnotationBase): __slots__ = () def __init__(self, *args, **kwargs): super(AxisAlignedBoundingBoxAnnotation, self).__init__( *args, type='axis_aligned_bounding_box', **kwargs) point_a = pointA = wrapped_property('pointA', array_wrapper(np....
@export class AxisAlignedBoundingBoxAnnotation(AnnotationBase):
__slots__ = () def __init__(self, *args, **kwargs): super(AxisAlignedBoundingBoxAnnotation, self).__init__( *args, type='axis_aligned_bounding_box', **kwargs) point_a = pointA = wrapped_property('pointA', array_wrapper(np.float32)) point_b = pointB = wrapped_property('pointB', arra...
self).__init__(*args, type='line', **kwargs) point_a = pointA = wrapped_property('pointA', array_wrapper(np.float32)) point_b = pointB = wrapped_property('pointB', array_wrapper(np.float32)) @export class AxisAlignedBoundingBoxAnnotation(AnnotationBase):
64
64
99
13
51
brifly1/neuroglancer
python/neuroglancer/viewer_state.py
Python
AxisAlignedBoundingBoxAnnotation
AxisAlignedBoundingBoxAnnotation
506
515
506
507
8d8ea1c8c5c43b81514e0d61143b06883235312b
bigcode/the-stack
train
e9882efed19c6c92c8e6c8c1
train
function
@export def tool(json_data, _readonly=False): if isinstance(json_data, Tool): return json_data if isinstance(json_data, six.string_types): json_data = {'type': json_data} if not isinstance(json_data, dict): raise TypeError type_name = json_data.get('type') tool_type = tool_t...
@export def tool(json_data, _readonly=False):
if isinstance(json_data, Tool): return json_data if isinstance(json_data, six.string_types): json_data = {'type': json_data} if not isinstance(json_data, dict): raise TypeError type_name = json_data.get('type') tool_type = tool_types.get(type_name) if tool_type is None: ...
', **kwargs) tool_types = { 'annotatePoint': PlacePointTool, 'annotateLine': PlaceLineTool, 'annotateBoundingBox': PlaceBoundingBoxTool, 'annotateSphere': PlaceEllipsoidTool, } @export def tool(json_data, _readonly=False):
64
64
102
12
52
brifly1/neuroglancer
python/neuroglancer/viewer_state.py
Python
tool
tool
250
262
250
251
3604dff4c03716468f856b821d23e07729f1dd65
bigcode/the-stack
train
3b6a2fd150dc264640665206
train
class
@export class PlaceBoundingBoxTool(Tool): __slots__ = () def __init__(self, *args, **kwargs): super(PlaceBoundingBoxTool, self).__init__(*args, type='annotateBoundingBox', **kwargs)
@export class PlaceBoundingBoxTool(Tool):
__slots__ = () def __init__(self, *args, **kwargs): super(PlaceBoundingBoxTool, self).__init__(*args, type='annotateBoundingBox', **kwargs)
kwargs) @export class PlaceLineTool(Tool): __slots__ = () def __init__(self, *args, **kwargs): super(PlaceLineTool, self).__init__(*args, type='annotateLine', **kwargs) @export class PlaceBoundingBoxTool(Tool):
64
64
54
11
53
brifly1/neuroglancer
python/neuroglancer/viewer_state.py
Python
PlaceBoundingBoxTool
PlaceBoundingBoxTool
226
231
226
227
1c9a9f58c42a1b478ee7731b13c1d0b1d604d116
bigcode/the-stack
train
96dffb6b3229da9fce92ed81
train
class
@export class Tool(JsonObjectWrapper): __slots__ = () type = wrapped_property('type', text_type) def __init__(self, json_data, **kwargs): super(Tool, self).__init__(json_data=json_data, **kwargs)
@export class Tool(JsonObjectWrapper):
__slots__ = () type = wrapped_property('type', text_type) def __init__(self, json_data, **kwargs): super(Tool, self).__init__(json_data=json_data, **kwargs)
)' % (self.to_json(),) def to_json(self): d = collections.OrderedDict() for name, scale, unit in zip(self.names, self.scales, self.units): d[name] = [scale, unit] return d @export class Tool(JsonObjectWrapper):
64
64
56
9
54
brifly1/neuroglancer
python/neuroglancer/viewer_state.py
Python
Tool
Tool
200
207
200
201
411521e109788b0a86a96b99d0542b0f3952b201
bigcode/the-stack
train
e315f1620f8823a195eb3b36
train
class
@export class Layers(object): __slots__ = ('_layers', '_readonly') supports_readonly = True def __init__(self, json_data, _readonly=False): if json_data is None: json_data = collections.OrderedDict() self._layers = [] self._readonly = _readonly if isinstance(json...
@export class Layers(object):
__slots__ = ('_layers', '_readonly') supports_readonly = True def __init__(self, json_data, _readonly=False): if json_data is None: json_data = collections.OrderedDict() self._layers = [] self._readonly = _readonly if isinstance(json_data, collections_abc.Mapping...
object.__setattr__(self, 'layer', layer) super(ManagedLayer, self).__init__(json_data, _readonly=_readonly, **kwargs) visible = wrapped_property('visible', optional(bool, True)) def __getattr__(self, key): return getattr(self.layer, key) def __setattr__(self, key, value): if self...
250
250
835
7
243
brifly1/neuroglancer
python/neuroglancer/viewer_state.py
Python
Layers
Layers
676
793
676
677
0696458e49ccf98203c9f97dde002d0da8288f7f
bigcode/the-stack
train
4b28c4923fbe1a78a3b071b0
train
class
@export class LocalAnnotationLayer(AnnotationLayer): __slots__ = () def __init__(self, dimensions, *args, **kwargs): super(LocalAnnotationLayer, self).__init__( *args, source=LayerDataSource( url='local://annotations', transform=CoordinateSpaceTran...
@export class LocalAnnotationLayer(AnnotationLayer):
__slots__ = () def __init__(self, dimensions, *args, **kwargs): super(LocalAnnotationLayer, self).__init__( *args, source=LayerDataSource( url='local://annotations', transform=CoordinateSpaceTransform(outputDimensions=dimensions)), **kw...
)) shader = wrapped_property('shader', text_type) shader_controls = shaderControls = wrapped_property('shaderControls', ShaderControls) @staticmethod def interpolate(a, b, t): del b del t return a @export class LocalAnnotationLayer(AnnotationLayer):
64
64
75
11
52
brifly1/neuroglancer
python/neuroglancer/viewer_state.py
Python
LocalAnnotationLayer
LocalAnnotationLayer
579
588
579
580
f3dfb62402462ca4c63e99593d123f96785389cf
bigcode/the-stack
train
c9702cb764365247338374b8
train
class
class _AnnotationLayerOptions(object): __slots__ = () annotation_color = annotationColor = wrapped_property('annotationColor', optional(text_type))
class _AnnotationLayerOptions(object):
__slots__ = () annotation_color = annotationColor = wrapped_property('annotationColor', optional(text_type))
local_volume.LocalVolume, skeleton.SkeletonSource, dict)): json_data = [json_data] elif isinstance(json_data, LayerDataSources): json_data = json_data.to_json() super(LayerDataSources, self).__init__(json_data, **kwargs) class _AnnotationLayerOp...
64
64
30
7
57
brifly1/neuroglancer
python/neuroglancer/viewer_state.py
Python
_AnnotationLayerOptions
_AnnotationLayerOptions
351
353
351
351
584a410e843a3f91f1b6a14d2d51355e479b9d05
bigcode/the-stack
train
228cabdb3df793be3b186f34
train
class
@export class DimensionScale(collections.namedtuple('DimensionScale', ['scale', 'unit'])): __slots__ = () def __new__(cls, scale=1, unit=''): return super(DimensionScale, cls).__new__(cls, scale, unit)
@export class DimensionScale(collections.namedtuple('DimensionScale', ['scale', 'unit'])):
__slots__ = () def __new__(cls, scale=1, unit=''): return super(DimensionScale, cls).__new__(cls, scale, unit)
_with_prefixes[unit] if exponent >= 0: return (scale * 10**exponent, unit) else: return (scale / 10**(-exponent), unit) @export class DimensionScale(collections.namedtuple('DimensionScale', ['scale', 'unit'])):
64
64
58
21
43
brifly1/neuroglancer
python/neuroglancer/viewer_state.py
Python
DimensionScale
DimensionScale
140
145
140
141
df83da2e6ff372914526ef7deb3032bbe94c1f03
bigcode/the-stack
train
92a851c611d90d5cf66d6f16
train
class
@export class PointAnnotationLayer(Layer): __slots__ = () def __init__(self, *args, **kwargs): super(PointAnnotationLayer, self).__init__(*args, type='pointAnnotation', **kwargs) points = wrapped_property('points', typed_list(array_wrapper(np.float32, 3)))
@export class PointAnnotationLayer(Layer):
__slots__ = () def __init__(self, *args, **kwargs): super(PointAnnotationLayer, self).__init__(*args, type='pointAnnotation', **kwargs) points = wrapped_property('points', typed_list(array_wrapper(np.float32, 3)))
tool = wrapped_property('tool', optional(tool)) @staticmethod def interpolate(a, b, t): c = copy.deepcopy(a) c.layer_position = interpolate_linear_optional_vectors(a.layer_position, b.layer_position, t) return c @export cla...
64
64
68
10
53
brifly1/neuroglancer
python/neuroglancer/viewer_state.py
Python
PointAnnotationLayer
PointAnnotationLayer
287
294
287
288
7ebf614ee9483f00778d7e6254f1a1966976d79c
bigcode/the-stack
train
f450a56c6592f123b61bdace
train
function
def unit_quaternion(): return np.array([0, 0, 0, 1], np.float32)
def unit_quaternion():
return np.array([0, 0, 0, 1], np.float32)
* (1 - t) + b * t def interpolate_linear_optional_vectors(a, b, t): if a is not None and b is not None and len(a) == len(b): return a * (1 - t) + b * t return a def unit_quaternion():
64
64
25
5
58
brifly1/neuroglancer
python/neuroglancer/viewer_state.py
Python
unit_quaternion
unit_quaternion
57
58
57
57
a68c2db17753e634718b871364e2bdd26e76855f
bigcode/the-stack
train
11f83eaf3bf6e69825a5d82c
train
class
@export class PointAnnotation(AnnotationBase): __slots__ = () def __init__(self, *args, **kwargs): super(PointAnnotation, self).__init__(*args, type='point', **kwargs) point = wrapped_property('point', array_wrapper(np.float32))
@export class PointAnnotation(AnnotationBase):
__slots__ = () def __init__(self, *args, **kwargs): super(PointAnnotation, self).__init__(*args, type='point', **kwargs) point = wrapped_property('point', array_wrapper(np.float32))
('type', text_type) description = wrapped_property('description', optional(text_type)) segments = wrapped_property('segments', optional(typed_list(typed_list(np.uint64)))) props = wrapped_property('props', optional(typed_list(number_or_string))) @export class PointAnnotation(AnnotationBase):
63
64
61
10
53
brifly1/neuroglancer
python/neuroglancer/viewer_state.py
Python
PointAnnotation
PointAnnotation
485
492
485
486
907e72ed8396b0952de73c246f93ab068f69c2a0
bigcode/the-stack
train
a45fb1b2a46b39af9e88afc5
train
class
@export class PlaceLineTool(Tool): __slots__ = () def __init__(self, *args, **kwargs): super(PlaceLineTool, self).__init__(*args, type='annotateLine', **kwargs)
@export class PlaceLineTool(Tool):
__slots__ = () def __init__(self, *args, **kwargs): super(PlaceLineTool, self).__init__(*args, type='annotateLine', **kwargs)
**kwargs) @export class PlacePointTool(Tool): __slots__ = () def __init__(self, *args, **kwargs): super(PlacePointTool, self).__init__(*args, type='annotatePoint', **kwargs) @export class PlaceLineTool(Tool):
64
64
51
10
54
brifly1/neuroglancer
python/neuroglancer/viewer_state.py
Python
PlaceLineTool
PlaceLineTool
218
223
218
219
d8766b621fc4bd95e6453ba87bfbd62152378f5b
bigcode/the-stack
train
48a67b87a44b3af31f002895
train
class
@export class LayerDataSubsource(JsonObjectWrapper): __slots__ = () supports_validation = True def __init__(self, json_data=None, *args, **kwargs): if isinstance(json_data, bool): json_data = {'enabled': json_data} super(LayerDataSubsource, self).__init__(json_data, *args, **kwa...
@export class LayerDataSubsource(JsonObjectWrapper):
__slots__ = () supports_validation = True def __init__(self, json_data=None, *args, **kwargs): if isinstance(json_data, bool): json_data = {'enabled': json_data} super(LayerDataSubsource, self).__init__(json_data, *args, **kwargs) enabled = wrapped_property('enabled', optio...
_wrapper(np.float64))) def data_source_url(x): if isinstance(x, (local_volume.LocalVolume, skeleton.SkeletonSource)): return x if not isinstance(x, six.string_types): raise TypeError return text_type(x) @export class LayerDataSubsource(JsonObjectWrapper):
64
64
91
12
52
brifly1/neuroglancer
python/neuroglancer/viewer_state.py
Python
LayerDataSubsource
LayerDataSubsource
312
322
312
313
3e534263161720ce281e113c132d75303209ba85
bigcode/the-stack
train
dce0af3e3f273976d9228562
train
function
def add_data_panel_layout_types(): for k in data_panel_layout_types: layout_types[k] = DataPanelLayout
def add_data_panel_layout_types():
for k in data_panel_layout_types: layout_types[k] = DataPanelLayout
= getattr(b, k) setattr(c, k, type(a_attr).interpolate(a_attr, b_attr, t)) return c layout_types = { 'row': StackLayout, 'column': StackLayout, 'viewer': LayerGroupViewer, } def add_data_panel_layout_types():
64
64
26
7
57
brifly1/neuroglancer
python/neuroglancer/viewer_state.py
Python
add_data_panel_layout_types
add_data_panel_layout_types
1,031
1,033
1,031
1,031
8a76057c09d62fc0d5bfd23f8c5a22ea91df355d
bigcode/the-stack
train
82d02f0bbe44fd3c393297e2
train
class
@export class StatisticsDisplayState(JsonObjectWrapper): visible = wrapped_property('visible', optional(bool, False)) size = wrapped_property('size', optional(int))
@export class StatisticsDisplayState(JsonObjectWrapper):
visible = wrapped_property('visible', optional(bool, False)) size = wrapped_property('size', optional(int))
add_data_panel_layout_types() @export class SelectedLayerState(JsonObjectWrapper): visible = wrapped_property('visible', optional(bool, False)) size = wrapped_property('size', optional(int)) layer = wrapped_property('layer', optional(text_type)) @export class StatisticsDisplayState(JsonObjectWrapper):
64
64
35
11
53
brifly1/neuroglancer
python/neuroglancer/viewer_state.py
Python
StatisticsDisplayState
StatisticsDisplayState
1,044
1,047
1,044
1,045
0e6f73095f79b8786e95f1dae28bd614f37aa4ac
bigcode/the-stack
train
ba254d8eedc004228340c7c9
train
class
@export class CoordinateSpace(object): __slots__ = ('names', 'scales', 'units') def __init__(self, json=None, names=None, scales=None, units=None): if json is None: if names is not None: self.names = tuple(names) scales = np.array(scales, dtype=np.float64) ...
@export class CoordinateSpace(object):
__slots__ = ('names', 'scales', 'units') def __init__(self, json=None, names=None, scales=None, units=None): if json is None: if names is not None: self.names = tuple(names) scales = np.array(scales, dtype=np.float64) if isinstance(units, six....
_units_with_prefixes[''] = ('', 0) def parse_unit(scale, unit): unit, exponent = si_units_with_prefixes[unit] if exponent >= 0: return (scale * 10**exponent, unit) else: return (scale / 10**(-exponent), unit) @export class DimensionScale(collections.namedtuple('DimensionScale', ['scale', ...
135
135
450
8
127
brifly1/neuroglancer
python/neuroglancer/viewer_state.py
Python
CoordinateSpace
CoordinateSpace
148
197
148
149
57ef6a9f1c5b2b1cd5f025517c97f2ba1b42d821
bigcode/the-stack
train
5810d074fc35f75a070960a7
train
function
def make_layer(json_data, _readonly=False): if isinstance(json_data, Layer): return json_data if isinstance(json_data, local_volume.LocalVolume): json_data = dict(type=json_data.volume_type, source=json_data) if not isinstance(json_data, dict): raise TypeError type_name = json...
def make_layer(json_data, _readonly=False):
if isinstance(json_data, Layer): return json_data if isinstance(json_data, local_volume.LocalVolume): json_data = dict(type=json_data.volume_type, source=json_data) if not isinstance(json_data, dict): raise TypeError type_name = json_data.get('type') layer_type = layer_typ...
(outputDimensions=dimensions)), **kwargs) layer_types = { 'image': ImageLayer, 'segmentation': SegmentationLayer, 'pointAnnotation': PointAnnotationLayer, 'annotation': AnnotationLayer, 'mesh': SingleMeshLayer, } def make_layer(json_data, _readonly=False):
64
64
111
10
54
brifly1/neuroglancer
python/neuroglancer/viewer_state.py
Python
make_layer
make_layer
599
614
599
599
bbbf10f356b0edbc516ec3f5336d0805cf2dfb4e
bigcode/the-stack
train
1c037f3db51c790a97395438
train
function
@export def row_layout(children): return StackLayout(type='row', children=children)
@export def row_layout(children):
return StackLayout(type='row', children=children)
(a.children) != len(b.children): return a c = copy.deepcopy(a) c.children = [ interpolate_layout(a_child, b_child, t) for a_child, b_child in zip(a.children, b.children) ] return c @export def row_layout(children):
64
64
20
8
55
brifly1/neuroglancer
python/neuroglancer/viewer_state.py
Python
row_layout
row_layout
973
975
973
974
f91b2d6a5c39998dcd4a92178e3f0fdd3004c0c5
bigcode/the-stack
train
f143b2861586a41a43bf6e91
train
class
@export class ImageLayer(Layer, _AnnotationLayerOptions): __slots__ = () def __init__(self, *args, **kwargs): super(ImageLayer, self).__init__(*args, type='image', **kwargs) source = wrapped_property('source', LayerDataSources) shader = wrapped_property('shader', text_type) shader_controls...
@export class ImageLayer(Layer, _AnnotationLayerOptions):
__slots__ = () def __init__(self, *args, **kwargs): super(ImageLayer, self).__init__(*args, type='image', **kwargs) source = wrapped_property('source', LayerDataSources) shader = wrapped_property('shader', text_type) shader_controls = shaderControls = wrapped_property('shaderControls', Sha...
json_data, **kwargs) class _AnnotationLayerOptions(object): __slots__ = () annotation_color = annotationColor = wrapped_property('annotationColor', optional(text_type)) ShaderControls = typed_string_map((six.text_type, numbers.Number)) @export class ImageLayer(Layer, _AnnotationLayerOptions):
64
64
186
14
50
brifly1/neuroglancer
python/neuroglancer/viewer_state.py
Python
ImageLayer
ImageLayer
359
378
359
360
bb323ad3eed720c688c3697ef2023a84ea3bf925
bigcode/the-stack
train
bd8aef3a2942d688ebdd1170
train
class
@export class EllipsoidAnnotation(AnnotationBase): __slots__ = () def __init__(self, *args, **kwargs): super(EllipsoidAnnotation, self).__init__(*args, type='ellipsoid', **kwargs) center = wrapped_property('center', array_wrapper(np.float32)) radii = wrapped_property('radii', array_wrapper(np....
@export class EllipsoidAnnotation(AnnotationBase):
__slots__ = () def __init__(self, *args, **kwargs): super(EllipsoidAnnotation, self).__init__(*args, type='ellipsoid', **kwargs) center = wrapped_property('center', array_wrapper(np.float32)) radii = wrapped_property('radii', array_wrapper(np.float32))
*args, type='axis_aligned_bounding_box', **kwargs) point_a = pointA = wrapped_property('pointA', array_wrapper(np.float32)) point_b = pointB = wrapped_property('pointB', array_wrapper(np.float32)) @export class EllipsoidAnnotation(AnnotationBase):
64
64
81
11
53
brifly1/neuroglancer
python/neuroglancer/viewer_state.py
Python
EllipsoidAnnotation
EllipsoidAnnotation
518
526
518
519
d91c4cdf332a7edcff82d4f6093e5ffcd54cdff2
bigcode/the-stack
train
3b065ecfaae4553cb28880a5
train
class
@export class AnnotationLayer(Layer, _AnnotationLayerOptions): __slots__ = () def __init__(self, *args, **kwargs): super(AnnotationLayer, self).__init__(*args, type='annotation', **kwargs) source = wrapped_property('source', LayerDataSources) annotations = wrapped_property('annotations', typed...
@export class AnnotationLayer(Layer, _AnnotationLayerOptions):
__slots__ = () def __init__(self, *args, **kwargs): super(AnnotationLayer, self).__init__(*args, type='annotation', **kwargs) source = wrapped_property('source', LayerDataSources) annotations = wrapped_property('annotations', typed_list(annotation)) annotation_properties = annotationProper...
Spec(JsonObjectWrapper): __slots__ = () id = wrapped_property('id', text_type) type = wrapped_property('type', text_type) description = wrapped_property('description', optional(text_type)) default = wrapped_property('default', optional(number_or_string)) @export class AnnotationLayer(Layer, _Annotat...
72
72
240
14
58
brifly1/neuroglancer
python/neuroglancer/viewer_state.py
Python
AnnotationLayer
AnnotationLayer
556
577
556
557
a5cfd8da0bb720ecca04dfb490aeb6fc00b5320c
bigcode/the-stack
train
b82a9650150a3ef14bbb34b0
train
class
@export class CrossSectionMap(typed_string_map(CrossSection)): @staticmethod def interpolate(a, b, t): c = copy.deepcopy(a) for k in a: if k in b: c[k] = CrossSection.interpolate(a[k], b[k], t) return c
@export class CrossSectionMap(typed_string_map(CrossSection)): @staticmethod
def interpolate(a, b, t): c = copy.deepcopy(a) for k in a: if k in b: c[k] = CrossSection.interpolate(a[k], b[k], t) return c
.interpolate(a.position, b.position, t) c.orientation = LinkedOrientationState.interpolate(a.orientation, b.orientation, t) c.scale = LinkedZoomFactor.interpolate(a.scale, b.scale, t) return c @export class CrossSectionMap(typed_string_map(CrossSection)): @staticmethod
64
64
67
19
44
brifly1/neuroglancer
python/neuroglancer/viewer_state.py
Python
CrossSectionMap
CrossSectionMap
868
876
868
870
a268907fe482bedf6712b91162d15455c63fb924
bigcode/the-stack
train
ef030549c9ed188d57b66bdd
train
class
@export class LinkedPosition(make_linked_navigation_type(array_wrapper(np.float32), interpolate_linear_optional_vectors)): __slots__ = ()
@export class LinkedPosition(make_linked_navigation_type(array_wrapper(np.float32), interpolate_linear_optional_vectors)):
__slots__ = ()
a.link if a.link == b.link and a.link != 'linked': c.value = interpolate_function(a, b, t) return c return c return LinkedType @export class LinkedPosition(make_linked_navigation_type(array_wrapper(np.float32), interpolate_linear_optional_vectors)):
64
64
28
22
41
brifly1/neuroglancer
python/neuroglancer/viewer_state.py
Python
LinkedPosition
LinkedPosition
826
828
826
827
a32c4f2d6193b58bcc0d739da4e1dddd58e091e5
bigcode/the-stack
train
fe4d04a487bb4c67f5736338
train
class
@export class LinkedDepthRange(make_linked_navigation_type(float, interpolate_zoom)): __slots__ = ()
@export class LinkedDepthRange(make_linked_navigation_type(float, interpolate_zoom)):
__slots__ = ()
(make_linked_navigation_type(array_wrapper(np.float32), interpolate_linear_optional_vectors)): __slots__ = () @export class LinkedZoomFactor(make_linked_navigation_type(float, interpolate_zoom)): __slots__ = () @export class LinkedDepthRange(make_linked_navigation_type(float, interpolate_zoom)):
63
64
23
17
46
brifly1/neuroglancer
python/neuroglancer/viewer_state.py
Python
LinkedDepthRange
LinkedDepthRange
836
838
836
837
6bb15ceaa8b3cc65346c4570ab23943fb2ec8d2a
bigcode/the-stack
train
e534ec1cc5852f4fb1d4dafe
train
function
def navigation_link_type(x): x = six.text_type(x) x = x.lower() if x not in [u'linked', u'unlinked', u'relative']: raise ValueError('Invalid navigation link type: %r' % x) return x
def navigation_link_type(x):
x = six.text_type(x) x = x.lower() if x not in [u'linked', u'unlinked', u'relative']: raise ValueError('Invalid navigation link type: %r' % x) return x
other_layer = b[index] if type(other_layer.layer) is not type(layer.layer): # pylint: disable=unidiomatic-typecheck continue layer.layer = type(layer.layer).interpolate(layer.layer, other_layer.layer, t) return c def navigation_link_type(x):
64
64
59
6
57
brifly1/neuroglancer
python/neuroglancer/viewer_state.py
Python
navigation_link_type
navigation_link_type
797
802
797
797
02eb1f6c54ad935a40ceb125408bc17e8eab144c
bigcode/the-stack
train
4bba993eae7947500b10bd16
train
function
def data_panel_layout_wrapper(default_value='xy'): def wrapper(x, _readonly=False): if x is None: x = default_value if isinstance(x, six.string_types): x = {'type': six.text_type(x)} return DataPanelLayout(x, _readonly=_readonly) wrapper.supports_readonly = True ...
def data_panel_layout_wrapper(default_value='xy'):
def wrapper(x, _readonly=False): if x is None: x = default_value if isinstance(x, six.string_types): x = {'type': six.text_type(x)} return DataPanelLayout(x, _readonly=_readonly) wrapper.supports_readonly = True return wrapper
, t): if a.type != b.type or len(a.cross_sections) == 0: return a c = copy.deepcopy(a) c.cross_sections = CrossSectionMap.interpolate(a.cross_sections, b.cross_sections, t) return c def data_panel_layout_wrapper(default_value='xy'):
64
64
76
10
53
brifly1/neuroglancer
python/neuroglancer/viewer_state.py
Python
data_panel_layout_wrapper
data_panel_layout_wrapper
907
916
907
907
4ea15256c57c58378f8d5ec1fe634c17ffa6c49e
bigcode/the-stack
train
5b81ee3893f33d74246f4d66
train
class
@export class SingleMeshLayer(Layer): __slots__ = () def __init__(self, *args, **kwargs): super(SingleMeshLayer, self).__init__(*args, type='mesh', **kwargs) source = wrapped_property('source', LayerDataSources) vertex_attribute_sources = vertexAttributeSources = wrapped_property( 'ver...
@export class SingleMeshLayer(Layer):
__slots__ = () def __init__(self, *args, **kwargs): super(SingleMeshLayer, self).__init__(*args, type='mesh', **kwargs) source = wrapped_property('source', LayerDataSources) vertex_attribute_sources = vertexAttributeSources = wrapped_property( 'vertexAttributeSources', optional(typed_l...
): c = Layer.interpolate(a, b, t) for k in ['selected_alpha', 'not_selected_alpha', 'object_alpha']: setattr(c, k, interpolate_linear(getattr(a, k), getattr(b, k), t)) return c @export class SingleMeshLayer(Layer):
64
64
125
10
53
brifly1/neuroglancer
python/neuroglancer/viewer_state.py
Python
SingleMeshLayer
SingleMeshLayer
458
472
458
459
a1f38bf5874140e836bb8812e7b49673dd16decf
bigcode/the-stack
train
983a02d531530de450232eb8
train
class
@export class ViewerState(JsonObjectWrapper): __slots__ = () dimensions = wrapped_property('dimensions', CoordinateSpace) relative_display_scales = relativeDisplayScales = wrapped_property('relativeDisplayScales', optional(typed_string_map(float))) display_dimensions = displayDimensions = wrapped_proper...
@export class ViewerState(JsonObjectWrapper):
__slots__ = () dimensions = wrapped_property('dimensions', CoordinateSpace) relative_display_scales = relativeDisplayScales = wrapped_property('relativeDisplayScales', optional(typed_string_map(float))) display_dimensions = displayDimensions = wrapped_property('displayDimensions', optional(typed_list(te...
pective_orientation', 'perspective_zoom'): a_attr = getattr(a, k) b_attr = getattr(b, k) setattr(c, k, type(a_attr).interpolate(a_attr, b_attr, t)) return c layout_types = { 'row': StackLayout, 'column': StackLayout, 'viewer': LayerGroupViewer, } def add_data_p...
201
201
671
10
191
brifly1/neuroglancer
python/neuroglancer/viewer_state.py
Python
ViewerState
ViewerState
1,050
1,097
1,050
1,051
87f8618c902d1c03106ccb6c4d79b0c41422358f
bigcode/the-stack
train
ac236e75349d64de96924abd
train
class
class AnnotationBase(JsonObjectWrapper): __slots__ = () id = wrapped_property('id', optional(text_type)) # pylint: disable=invalid-name type = wrapped_property('type', text_type) description = wrapped_property('description', optional(text_type)) segments = wrapped_property('segments', optional(typ...
class AnnotationBase(JsonObjectWrapper):
__slots__ = () id = wrapped_property('id', optional(text_type)) # pylint: disable=invalid-name type = wrapped_property('type', text_type) description = wrapped_property('description', optional(text_type)) segments = wrapped_property('segments', optional(typed_list(typed_list(np.uint64)))) prop...
= wrapped_property( 'vertexAttributeSources', optional(typed_list(text_type))) shader = wrapped_property('shader', text_type) vertex_attribute_names = vertexAttributeNames = wrapped_property('vertexAttributeNames', optional( ...
63
64
92
7
56
brifly1/neuroglancer
python/neuroglancer/viewer_state.py
Python
AnnotationBase
AnnotationBase
475
482
475
475
7f1e8cfa081e5c4907d7292db61654075df4ce14
bigcode/the-stack
train
c083014d75ef7b696b11ff6b
train
function
def quaternion_slerp(a, b, t): """Spherical linear interpolation for unit quaternions. This is based on the implementation in the gl-matrix package: https://github.com/toji/gl-matrix """ if a is None: a = unit_quaternion() if b is None: b = unit_quaternion() # calc cosine ...
def quaternion_slerp(a, b, t):
"""Spherical linear interpolation for unit quaternions. This is based on the implementation in the gl-matrix package: https://github.com/toji/gl-matrix """ if a is None: a = unit_quaternion() if b is None: b = unit_quaternion() # calc cosine cosom = np.dot(a, b) # ad...
_vectors(a, b, t): if a is not None and b is not None and len(a) == len(b): return a * (1 - t) + b * t return a def unit_quaternion(): return np.array([0, 0, 0, 1], np.float32) def quaternion_slerp(a, b, t):
80
80
267
11
69
brifly1/neuroglancer
python/neuroglancer/viewer_state.py
Python
quaternion_slerp
quaternion_slerp
61
90
61
61
7721fac694e83fe84dc316d3431dfb0b15e24900
bigcode/the-stack
train
1712ada5af36fa91e3acbfbf
train
function
def layout_specification(x, _readonly=False): if x is None: x = '4panel' if isinstance(x, six.string_types): x = {'type': six.text_type(x)} if isinstance(x, (StackLayout, LayerGroupViewer, DataPanelLayout)): return type(x)(x.to_json(), _readonly=_readonly) if not isinstance(x, di...
def layout_specification(x, _readonly=False):
if x is None: x = '4panel' if isinstance(x, six.string_types): x = {'type': six.text_type(x)} if isinstance(x, (StackLayout, LayerGroupViewer, DataPanelLayout)): return type(x)(x.to_json(), _readonly=_readonly) if not isinstance(x, dict): raise ValueError layout_type ...
s_readonly = True return wrapper data_panel_layout_types = frozenset(['xy', 'yz', 'xz', 'xy-3d', 'yz-3d', 'xz-3d', '4panel', '3d']) def layout_specification(x, _readonly=False):
63
64
122
10
53
brifly1/neuroglancer
python/neuroglancer/viewer_state.py
Python
layout_specification
layout_specification
922
934
922
922
2429b1f7fac9dd8d034670a9174ab6dc97d1f0d4
bigcode/the-stack
train
c930ad55f79ae7348b01f4a6
train
function
def interpolate_layout(a, b, t): if type(a) is not type(b): return a return type(a).interpolate(a, b, t)
def interpolate_layout(a, b, t):
if type(a) is not type(b): return a return type(a).interpolate(a, b, t)
_child in zip(a.children, b.children) ] return c @export def row_layout(children): return StackLayout(type='row', children=children) @export def column_layout(children): return StackLayout(type='column', children=children) def interpolate_layout(a, b, t):
64
64
36
9
55
brifly1/neuroglancer
python/neuroglancer/viewer_state.py
Python
interpolate_layout
interpolate_layout
983
986
983
983
ed23c12494c4f4878596fabcf7d322ca1e21a8b4
bigcode/the-stack
train
2d6640a5d76f1dc8beeb63ad
train
class
@export class LayerDataSources(typed_list(LayerDataSource, validator=LayerDataSource)): __slots__ = () def __init__(self, json_data=None, **kwargs): if isinstance(json_data, (LayerDataSource, six.string_types, local_volume.LocalVolume, skeleton.SkeletonSource, dict)): ...
@export class LayerDataSources(typed_list(LayerDataSource, validator=LayerDataSource)):
__slots__ = () def __init__(self, json_data=None, **kwargs): if isinstance(json_data, (LayerDataSource, six.string_types, local_volume.LocalVolume, skeleton.SkeletonSource, dict)): json_data = [json_data] elif isinstance(json_data, LayerDataSources)...
subsources = wrapped_property('subsources', typed_string_map(LayerDataSubsource)) enable_default_subsources = enableDefaultSubsources = wrapped_property('enableDefaultSubsources', optional(bool, True)) @export class LayerDataSources(typed_list(LayerDataSource, validator=LayerDataSource)):
64
64
113
21
43
brifly1/neuroglancer
python/neuroglancer/viewer_state.py
Python
LayerDataSources
LayerDataSources
339
349
339
340
dda16c89f5ecfb1d8957216a893cfeb65753b96f
bigcode/the-stack
train
ffe681120345b3cb9c9399cd
train
function
@export def column_layout(children): return StackLayout(type='column', children=children)
@export def column_layout(children):
return StackLayout(type='column', children=children)
c.children = [ interpolate_layout(a_child, b_child, t) for a_child, b_child in zip(a.children, b.children) ] return c @export def row_layout(children): return StackLayout(type='row', children=children) @export def column_layout(children):
64
64
20
8
56
brifly1/neuroglancer
python/neuroglancer/viewer_state.py
Python
column_layout
column_layout
978
980
978
979
685a0e1aef861607b88e6ef5f43bf0651b390bda
bigcode/the-stack
train
2c159d6fb6219017e38fd44c
train
function
def export(obj): __all__.append(obj.__name__) return obj
def export(obj):
__all__.append(obj.__name__) return obj
ivalenceMap from .json_utils import encode_json_for_repr from .json_wrappers import (JsonObjectWrapper, array_wrapper, optional, text_type, typed_list, typed_map, typed_set, typed_string_map, wrapped_property, number_or_string) __all__ = [] def export(obj):
63
64
17
4
59
brifly1/neuroglancer
python/neuroglancer/viewer_state.py
Python
export
export
44
46
44
44
d6ab6c26b90aef9b57242f08d6e53b8240b25ee3
bigcode/the-stack
train
52be49777515fa1e0b4935b4
train
class
@export class AnnotationPropertySpec(JsonObjectWrapper): __slots__ = () id = wrapped_property('id', text_type) type = wrapped_property('type', text_type) description = wrapped_property('description', optional(text_type)) default = wrapped_property('default', optional(number_or_string))
@export class AnnotationPropertySpec(JsonObjectWrapper):
__slots__ = () id = wrapped_property('id', text_type) type = wrapped_property('type', text_type) description = wrapped_property('description', optional(text_type)) default = wrapped_property('default', optional(number_or_string))
, AnnotationBase): obj = obj.to_json() elif not isinstance(obj, dict): raise TypeError t = obj.get('type') return annotation_types[t](obj, _readonly=_readonly) annotation.supports_readonly = True @export class AnnotationPropertySpec(JsonObjectWrapper):
64
64
64
11
52
brifly1/neuroglancer
python/neuroglancer/viewer_state.py
Python
AnnotationPropertySpec
AnnotationPropertySpec
548
554
548
549
c232f0df259c8b6c851ce0cbf873b055021f7b85
bigcode/the-stack
train
a1a9d324737ec217ebed211e
train
function
def annotation(obj, _readonly=False): if isinstance(obj, AnnotationBase): obj = obj.to_json() elif not isinstance(obj, dict): raise TypeError t = obj.get('type') return annotation_types[t](obj, _readonly=_readonly)
def annotation(obj, _readonly=False):
if isinstance(obj, AnnotationBase): obj = obj.to_json() elif not isinstance(obj, dict): raise TypeError t = obj.get('type') return annotation_types[t](obj, _readonly=_readonly)
= wrapped_property('radii', array_wrapper(np.float32)) annotation_types = { 'point': PointAnnotation, 'line': LineAnnotation, 'axis_aligned_bounding_box': AxisAlignedBoundingBoxAnnotation, 'ellipsoid': EllipsoidAnnotation, } def annotation(obj, _readonly=False):
64
64
57
8
56
brifly1/neuroglancer
python/neuroglancer/viewer_state.py
Python
annotation
annotation
537
543
537
537
fac77ed0bf511659fa056f9fdd1efd232e92d216
bigcode/the-stack
train
fc8725f8c5989455da8fdf0f
train
class
@export class LayerDataSource(JsonObjectWrapper): __slots__ = () def __init__(self, json_data=None, *args, **kwargs): if (isinstance(json_data, six.string_types) or isinstance(json_data, (local_volume.LocalVolume, skeleton.SkeletonSource))): json_data = {'url': json_data} ...
@export class LayerDataSource(JsonObjectWrapper):
__slots__ = () def __init__(self, json_data=None, *args, **kwargs): if (isinstance(json_data, six.string_types) or isinstance(json_data, (local_volume.LocalVolume, skeleton.SkeletonSource))): json_data = {'url': json_data} super(LayerDataSource, self).__init__(json_data,...
**kwargs): if isinstance(json_data, bool): json_data = {'enabled': json_data} super(LayerDataSubsource, self).__init__(json_data, *args, **kwargs) enabled = wrapped_property('enabled', optional(bool)) @export class LayerDataSource(JsonObjectWrapper):
64
64
164
11
53
brifly1/neuroglancer
python/neuroglancer/viewer_state.py
Python
LayerDataSource
LayerDataSource
324
337
324
325
23156c71025f797f76d4e2b4b5f5518f4e7c3dec
bigcode/the-stack
train
86b7058072daca1d8bb8c1e0
train
class
@export class LayerGroupViewer(JsonObjectWrapper): __slots__ = () type = wrapped_property('type', text_type) layers = wrapped_property('layers', typed_list(text_type)) layout = wrapped_property('layout', data_panel_layout_wrapper('xy')) position = wrapped_property('position', LinkedPosition) cro...
@export class LayerGroupViewer(JsonObjectWrapper):
__slots__ = () type = wrapped_property('type', text_type) layers = wrapped_property('layers', typed_list(text_type)) layout = wrapped_property('layout', data_panel_layout_wrapper('xy')) position = wrapped_property('position', LinkedPosition) cross_section_orientation = crossSectionOrientation = ...
a_child, b_child in zip(a.children, b.children) ] return c @export def row_layout(children): return StackLayout(type='row', children=children) @export def column_layout(children): return StackLayout(type='column', children=children) def interpolate_layout(a, b, t): if type(a) is not t...
106
106
354
11
95
brifly1/neuroglancer
python/neuroglancer/viewer_state.py
Python
LayerGroupViewer
LayerGroupViewer
989
1,022
989
990
6567c7b7cc8db869faf0f65df51c829137abc190
bigcode/the-stack
train
e3cc2b516dc545305fbf7eb4
train
function
def uint64_equivalence_map(obj, _readonly=False): if isinstance(obj, EquivalenceMap): return obj if obj is not None: obj = [[int(v) for v in group] for group in obj] return EquivalenceMap(obj, _readonly=_readonly)
def uint64_equivalence_map(obj, _readonly=False):
if isinstance(obj, EquivalenceMap): return obj if obj is not None: obj = [[int(v) for v in group] for group in obj] return EquivalenceMap(obj, _readonly=_readonly)
SectionRenderScale', optional(float, 1)) @staticmethod def interpolate(a, b, t): c = Layer.interpolate(a, b, t) c.opacity = interpolate_linear(a.opacity, b.opacity, t) return c def uint64_equivalence_map(obj, _readonly=False):
64
64
61
12
51
brifly1/neuroglancer
python/neuroglancer/viewer_state.py
Python
uint64_equivalence_map
uint64_equivalence_map
381
386
381
381
e46e83f8256c4eea98fcdde74b72e628e02c2db6
bigcode/the-stack
train
e2eca7c5c1601338397d2474
train
class
@export class SegmentationLayer(Layer, _AnnotationLayerOptions): __slots__ = () def __init__(self, *args, **kwargs): super(SegmentationLayer, self).__init__(*args, type='segmentation', **kwargs) source = wrapped_property('source', LayerDataSources) segments = wrapped_property('segments', typed...
@export class SegmentationLayer(Layer, _AnnotationLayerOptions):
__slots__ = () def __init__(self, *args, **kwargs): super(SegmentationLayer, self).__init__(*args, type='segmentation', **kwargs) source = wrapped_property('source', LayerDataSources) segments = wrapped_property('segments', typed_set(np.uint64)) equivalences = wrapped_property('equivalence...
if obj is not None: obj = [[int(v) for v in group] for group in obj] return EquivalenceMap(obj, _readonly=_readonly) @export class SkeletonRenderingOptions(JsonObjectWrapper): __slots__ = () shader = wrapped_property('shader', optional(text_type)) shader_controls = shaderControls = wrappe...
178
178
596
15
163
brifly1/neuroglancer
python/neuroglancer/viewer_state.py
Python
SegmentationLayer
SegmentationLayer
401
456
401
402
42d0d7cd158d89f8db0c385811b16bd12ea6dd59
bigcode/the-stack
train
a7b66be2d0f4ec37ec1277bd
train
function
def interpolate_linear(a, b, t): return a * (1 - t) + b * t
def interpolate_linear(a, b, t):
return a * (1 - t) + b * t
Wrapper, array_wrapper, optional, text_type, typed_list, typed_map, typed_set, typed_string_map, wrapped_property, number_or_string) __all__ = [] def export(obj): __all__.append(obj.__name__) return obj def interpolate_linear(a, b, t):
64
64
23
9
54
brifly1/neuroglancer
python/neuroglancer/viewer_state.py
Python
interpolate_linear
interpolate_linear
49
50
49
49
21d94a07c55e147cd3da3a676160c5b55d3d35d4
bigcode/the-stack
train
310613743bdba7dcc5712054
train
function
def make_linked_navigation_type(value_type, interpolate_function=None): if interpolate_function is None: interpolate_function = value_type.interpolate class LinkedType(JsonObjectWrapper): __slots__ = () link = wrapped_property('link', optional(navigation_link_type, u'linked')) v...
def make_linked_navigation_type(value_type, interpolate_function=None):
if interpolate_function is None: interpolate_function = value_type.interpolate class LinkedType(JsonObjectWrapper): __slots__ = () link = wrapped_property('link', optional(navigation_link_type, u'linked')) value = wrapped_property('value', optional(value_type)) @staticm...
= six.text_type(x) x = x.lower() if x not in [u'linked', u'unlinked', u'relative']: raise ValueError('Invalid navigation link type: %r' % x) return x def make_linked_navigation_type(value_type, interpolate_function=None):
64
64
138
13
50
brifly1/neuroglancer
python/neuroglancer/viewer_state.py
Python
make_linked_navigation_type
make_linked_navigation_type
805
823
805
805
13b60da523726228e92fecf7ef8aff3e2add9594
bigcode/the-stack
train
d535902dc2a091e28da5b4ee
train
class
@export class PlaceEllipsoidTool(Tool): __slots__ = () def __init__(self, *args, **kwargs): super(PlaceEllipsoidTool, self).__init__(*args, type='annotateSphere', **kwargs)
@export class PlaceEllipsoidTool(Tool):
__slots__ = () def __init__(self, *args, **kwargs): super(PlaceEllipsoidTool, self).__init__(*args, type='annotateSphere', **kwargs)
export class PlaceBoundingBoxTool(Tool): __slots__ = () def __init__(self, *args, **kwargs): super(PlaceBoundingBoxTool, self).__init__(*args, type='annotateBoundingBox', **kwargs) @export class PlaceEllipsoidTool(Tool):
64
64
53
11
53
brifly1/neuroglancer
python/neuroglancer/viewer_state.py
Python
PlaceEllipsoidTool
PlaceEllipsoidTool
234
239
234
235
cb36e1e9dc650501158ea1dff6bc9e9bc2d0ea29
bigcode/the-stack
train
5c35636f2da18e90b9afa989
train
function
def data_source_url(x): if isinstance(x, (local_volume.LocalVolume, skeleton.SkeletonSource)): return x if not isinstance(x, six.string_types): raise TypeError return text_type(x)
def data_source_url(x):
if isinstance(x, (local_volume.LocalVolume, skeleton.SkeletonSource)): return x if not isinstance(x, six.string_types): raise TypeError return text_type(x)
wrapped_property('outputDimensions', CoordinateSpace) input_dimensions = inputDimensions = wrapped_property('inputDimensions', optional(CoordinateSpace)) source_rank = sourceRank = wrapped_property('sourceRank', optional(int)) matrix = wrapped_property('matrix', optional(array_wrapper(np.float64))) def dat...
64
64
47
6
58
brifly1/neuroglancer
python/neuroglancer/viewer_state.py
Python
data_source_url
data_source_url
305
310
305
305
434e0efab5d5b0d5c65fd9abd1e84e61069aea08
bigcode/the-stack
train
b81c539b1cfd689a5976f8a4
train
class
@export class SelectedLayerState(JsonObjectWrapper): visible = wrapped_property('visible', optional(bool, False)) size = wrapped_property('size', optional(int)) layer = wrapped_property('layer', optional(text_type))
@export class SelectedLayerState(JsonObjectWrapper):
visible = wrapped_property('visible', optional(bool, False)) size = wrapped_property('size', optional(int)) layer = wrapped_property('layer', optional(text_type))
row': StackLayout, 'column': StackLayout, 'viewer': LayerGroupViewer, } def add_data_panel_layout_types(): for k in data_panel_layout_types: layout_types[k] = DataPanelLayout add_data_panel_layout_types() @export class SelectedLayerState(JsonObjectWrapper):
64
64
47
11
53
brifly1/neuroglancer
python/neuroglancer/viewer_state.py
Python
SelectedLayerState
SelectedLayerState
1,037
1,041
1,037
1,038
91bf2ffa3ccea20ad8fe319dd7651796936682c6
bigcode/the-stack
train
cdb37275ce416a0c1635ba39
train
class
@export class StackLayout(JsonObjectWrapper): __slots__ = () type = wrapped_property('type', text_type) children = wrapped_property('children', typed_list(layout_specification)) def __getitem__(self, key): return self.children[key] def __len__(self): return len(self.children) ...
@export class StackLayout(JsonObjectWrapper):
__slots__ = () type = wrapped_property('type', text_type) children = wrapped_property('children', typed_list(layout_specification)) def __getitem__(self, key): return self.children[key] def __len__(self): return len(self.children) def __setitem__(self, key, value): sel...
(x, dict): raise ValueError layout_type = layout_types.get(x.get('type')) if layout_type is None: raise ValueError return layout_type(x, _readonly=_readonly) layout_specification.supports_readonly = True @export class StackLayout(JsonObjectWrapper):
64
64
196
10
53
brifly1/neuroglancer
python/neuroglancer/viewer_state.py
Python
StackLayout
StackLayout
940
970
940
941
4f7e96eec55d83e5e2cf31d168990f8c427b54b2
bigcode/the-stack
train
f37eea8094b345e2e41c51da
train
class
@export class CoordinateSpaceTransform(JsonObjectWrapper): __slots__ = () output_dimensions = outputDimensions = wrapped_property('outputDimensions', CoordinateSpace) input_dimensions = inputDimensions = wrapped_property('inputDimensions', optional(CoordinateSpace)) source_rank = sourceRank = wrapped_p...
@export class CoordinateSpaceTransform(JsonObjectWrapper):
__slots__ = () output_dimensions = outputDimensions = wrapped_property('outputDimensions', CoordinateSpace) input_dimensions = inputDimensions = wrapped_property('inputDimensions', optional(CoordinateSpace)) source_rank = sourceRank = wrapped_property('sourceRank', optional(int)) matrix = wrapped_p...
() def __init__(self, *args, **kwargs): super(PointAnnotationLayer, self).__init__(*args, type='pointAnnotation', **kwargs) points = wrapped_property('points', typed_list(array_wrapper(np.float32, 3))) @export class CoordinateSpaceTransform(JsonObjectWrapper):
64
64
82
11
53
brifly1/neuroglancer
python/neuroglancer/viewer_state.py
Python
CoordinateSpaceTransform
CoordinateSpaceTransform
296
303
296
297
2a0c2a8f5724f774498c5b2875004b34cc075fad
bigcode/the-stack
train
0de25707ea761cde96761692
train
class
@export class LineAnnotation(AnnotationBase): __slots__ = () def __init__(self, *args, **kwargs): super(LineAnnotation, self).__init__(*args, type='line', **kwargs) point_a = pointA = wrapped_property('pointA', array_wrapper(np.float32)) point_b = pointB = wrapped_property('pointB', array_wrap...
@export class LineAnnotation(AnnotationBase):
__slots__ = () def __init__(self, *args, **kwargs): super(LineAnnotation, self).__init__(*args, type='line', **kwargs) point_a = pointA = wrapped_property('pointA', array_wrapper(np.float32)) point_b = pointB = wrapped_property('pointB', array_wrapper(np.float32))
AnnotationBase): __slots__ = () def __init__(self, *args, **kwargs): super(PointAnnotation, self).__init__(*args, type='point', **kwargs) point = wrapped_property('point', array_wrapper(np.float32)) @export class LineAnnotation(AnnotationBase):
64
64
85
10
54
brifly1/neuroglancer
python/neuroglancer/viewer_state.py
Python
LineAnnotation
LineAnnotation
495
503
495
496
8f7a9f9b4ae364f9d21a03988486470bba5ac118
bigcode/the-stack
train
0682e43ac54ceea5a0a866b5
train
class
@export class SkeletonRenderingOptions(JsonObjectWrapper): __slots__ = () shader = wrapped_property('shader', optional(text_type)) shader_controls = shaderControls = wrapped_property('shaderControls', ShaderControls) mode2d = wrapped_property('mode2d', optional(text_type)) line_width2d = lineWidth2...
@export class SkeletonRenderingOptions(JsonObjectWrapper):
__slots__ = () shader = wrapped_property('shader', optional(text_type)) shader_controls = shaderControls = wrapped_property('shaderControls', ShaderControls) mode2d = wrapped_property('mode2d', optional(text_type)) line_width2d = lineWidth2d = wrapped_property('lineWidth2d', optional(float, 2)) ...
_readonly=False): if isinstance(obj, EquivalenceMap): return obj if obj is not None: obj = [[int(v) for v in group] for group in obj] return EquivalenceMap(obj, _readonly=_readonly) @export class SkeletonRenderingOptions(JsonObjectWrapper):
64
64
127
11
53
brifly1/neuroglancer
python/neuroglancer/viewer_state.py
Python
SkeletonRenderingOptions
SkeletonRenderingOptions
389
398
389
390
d7c09517eefcb993c454b9e6e159993b8c3ba908
bigcode/the-stack
train
8150c1e98b4b233c994fb7d0
train
class
@export class DataPanelLayout(JsonObjectWrapper): __slots__ = () type = wrapped_property('type', text_type) cross_sections = crossSections = wrapped_property('crossSections', CrossSectionMap) orthographic_projection = orthographicProjection = wrapped...
@export class DataPanelLayout(JsonObjectWrapper):
__slots__ = () type = wrapped_property('type', text_type) cross_sections = crossSections = wrapped_property('crossSections', CrossSectionMap) orthographic_projection = orthographicProjection = wrapped_property( 'orthographicProjection', optio...
typed_string_map(CrossSection)): @staticmethod def interpolate(a, b, t): c = copy.deepcopy(a) for k in a: if k in b: c[k] = CrossSection.interpolate(a[k], b[k], t) return c @export class DataPanelLayout(JsonObjectWrapper):
70
70
236
11
58
brifly1/neuroglancer
python/neuroglancer/viewer_state.py
Python
DataPanelLayout
DataPanelLayout
879
904
879
880
d313b73cc0bb37cd162fb0e2643f7c00e66c08de
bigcode/the-stack
train
3f98f21ddbdd635cf6fcf9d6
train
function
def interpolate_zoom(a, b, t): if a is None or b is None: return a scale_change = math.log(b / a) return a * math.exp(scale_change * t)
def interpolate_zoom(a, b, t):
if a is None or b is None: return a scale_change = math.log(b / a) return a * math.exp(scale_change * t)
"from" and "to" quaternions are very close # ... so we can do a linear interpolation scale0 = 1.0 - t scale1 = t return scale0 * a + scale1 * b def interpolate_zoom(a, b, t):
64
64
44
9
54
brifly1/neuroglancer
python/neuroglancer/viewer_state.py
Python
interpolate_zoom
interpolate_zoom
93
97
93
93
d68fd72638e28aa672c84b9dcd535d85105d7b62
bigcode/the-stack
train
c1c87e06af2322d512889b12
train
function
def parse_unit(scale, unit): unit, exponent = si_units_with_prefixes[unit] if exponent >= 0: return (scale * 10**exponent, unit) else: return (scale / 10**(-exponent), unit)
def parse_unit(scale, unit):
unit, exponent = si_units_with_prefixes[unit] if exponent >= 0: return (scale * 10**exponent, unit) else: return (scale / 10**(-exponent), unit)
si_units_with_prefixes = { '%s%s' % (prefix, unit): (unit, exponent) for (prefix, exponent) in si_prefixes.items() for unit in si_units } si_units_with_prefixes[''] = ('', 0) def parse_unit(scale, unit):
64
64
57
7
57
brifly1/neuroglancer
python/neuroglancer/viewer_state.py
Python
parse_unit
parse_unit
132
137
132
132
f8bdf967525c283ca1c79874bd6d496a899a3180
bigcode/the-stack
train
c4098d4cbd6ec2e00a617178
train
class
@export class PlacePointTool(Tool): __slots__ = () def __init__(self, *args, **kwargs): super(PlacePointTool, self).__init__(*args, type='annotatePoint', **kwargs)
@export class PlacePointTool(Tool):
__slots__ = () def __init__(self, *args, **kwargs): super(PlacePointTool, self).__init__(*args, type='annotatePoint', **kwargs)
class Tool(JsonObjectWrapper): __slots__ = () type = wrapped_property('type', text_type) def __init__(self, json_data, **kwargs): super(Tool, self).__init__(json_data=json_data, **kwargs) @export class PlacePointTool(Tool):
64
64
51
10
54
brifly1/neuroglancer
python/neuroglancer/viewer_state.py
Python
PlacePointTool
PlacePointTool
210
215
210
211
17ecca9c9d6f8789844795c1cf0f933b18dab625
bigcode/the-stack
train
9adacdc7657c588e3a1ebe1e
train
class
@export class LinkedOrientationState(make_linked_navigation_type(array_wrapper(np.float32, 4), quaternion_slerp)): __slots__ = ()
@export class LinkedOrientationState(make_linked_navigation_type(array_wrapper(np.float32, 4), quaternion_slerp)):
__slots__ = ()
_navigation_type(float, interpolate_zoom)): __slots__ = () @export class LinkedDepthRange(make_linked_navigation_type(float, interpolate_zoom)): __slots__ = () @export class LinkedOrientationState(make_linked_navigation_type(array_wrapper(np.float32, 4), quaternion_slerp)):
63
64
32
26
37
brifly1/neuroglancer
python/neuroglancer/viewer_state.py
Python
LinkedOrientationState
LinkedOrientationState
841
843
841
842
98762aa6c3581ddb925f3a637ea6a1c0259ed8da
bigcode/the-stack
train
52c687ba343e3df8966346ca
train
function
def interpolate_linear_optional_vectors(a, b, t): if a is not None and b is not None and len(a) == len(b): return a * (1 - t) + b * t return a
def interpolate_linear_optional_vectors(a, b, t):
if a is not None and b is not None and len(a) == len(b): return a * (1 - t) + b * t return a
_property, number_or_string) __all__ = [] def export(obj): __all__.append(obj.__name__) return obj def interpolate_linear(a, b, t): return a * (1 - t) + b * t def interpolate_linear_optional_vectors(a, b, t):
64
64
48
11
52
brifly1/neuroglancer
python/neuroglancer/viewer_state.py
Python
interpolate_linear_optional_vectors
interpolate_linear_optional_vectors
52
55
52
52
38c3884cd5f809d5015022eede1be5a2c54e929c
bigcode/the-stack
train
504789695e7537ee9f1685d9
train
class
@export class ManagedLayer(JsonObjectWrapper): __slots__ = ('name', 'layer') def __init__(self, name, layer=None, _readonly=False, **kwargs): if isinstance(name, ManagedLayer): if layer is not None or kwargs: raise ValueError layer = name.to_json() na...
@export class ManagedLayer(JsonObjectWrapper):
__slots__ = ('name', 'layer') def __init__(self, name, layer=None, _readonly=False, **kwargs): if isinstance(name, ManagedLayer): if layer is not None or kwargs: raise ValueError layer = name.to_json() name = name.name object.__setattr__(self...
MeshLayer, } def make_layer(json_data, _readonly=False): if isinstance(json_data, Layer): return json_data if isinstance(json_data, local_volume.LocalVolume): json_data = dict(type=json_data.volume_type, source=json_data) if not isinstance(json_data, dict): raise TypeError t...
125
125
419
10
114
brifly1/neuroglancer
python/neuroglancer/viewer_state.py
Python
ManagedLayer
ManagedLayer
617
673
617
618
b554f54dae049afc3c7e7ebc7a5a6d12aea14726
bigcode/the-stack
train
818100b8df83b2402a23e7bd
train
class
@export class Layer(JsonObjectWrapper): __slots__ = () type = wrapped_property('type', optional(text_type)) layer_dimensions = layerDimensions = wrapped_property('localDimensions', CoordinateSpace) layer_position = layerPosition = wrapped_property('localPosition', ...
@export class Layer(JsonObjectWrapper):
__slots__ = () type = wrapped_property('type', optional(text_type)) layer_dimensions = layerDimensions = wrapped_property('localDimensions', CoordinateSpace) layer_position = layerPosition = wrapped_property('localPosition', optional(array_wrapper(np...
raise TypeError type_name = json_data.get('type') tool_type = tool_types.get(type_name) if tool_type is None: raise ValueError return tool_type(json_data, _readonly=_readonly) tool.supports_readonly = True @export class Layer(JsonObjectWrapper):
64
64
142
9
54
brifly1/neuroglancer
python/neuroglancer/viewer_state.py
Python
Layer
Layer
268
284
268
269
8572d244b1a82449c9167f7d32775d18ff55ce92
bigcode/the-stack
train
6b26c41785ceb866723337f5
train
class
class ClockEnable(ClockEnableBase): __slots__ = () def __new__(cls, clk, state, cpu_id): state = int(state) cpu_id = int(cpu_id) return super(cls, ClockEnable).__new__( cls, clk=clk, state=state, cpu_id=cpu_id, ...
class ClockEnable(ClockEnableBase):
__slots__ = () def __new__(cls, clk, state, cpu_id): state = int(state) cpu_id = int(cpu_id) return super(cls, ClockEnable).__new__( cls, clk=clk, state=state, cpu_id=cpu_id, )
tuple TRACEPOINT = 'clock_enable' __all__ = [TRACEPOINT] ClockEnableBase = namedtuple(TRACEPOINT, [ 'clk', # Clock name 'state', # Frequency 'cpu_id', # Target cpu ] ) class ClockEnable(ClockEnableBase):
64
64
74
8
56
Gracker/SystraceAnalysis
python3/ftrace/parsers/clock_enable.py
Python
ClockEnable
ClockEnable
41
52
41
41
4ea6b894c489c9448106a7ac61ccc90bcc1985ab
bigcode/the-stack
train
2bc6c0c570c7d098f231b005
train
function
@register_parser def clock_enable(payload): """Parser for `clock_enable` tracepoint""" try: match = re.match(clock_enable_pattern, payload) if match: match_group_dict = match.groupdict() return ClockEnable(**match_group_dict) except Exception as e: raise Parse...
@register_parser def clock_enable(payload):
"""Parser for `clock_enable` tracepoint""" try: match = re.match(clock_enable_pattern, payload) if match: match_group_dict = match.groupdict() return ClockEnable(**match_group_dict) except Exception as e: raise ParserError(e.message)
_pattern = re.compile( r""" (?P<clk>.+)\s+ state=(?P<state>\d+)\s+ cpu_id=(?P<cpu_id>\d+) """, re.X|re.M ) @register_parser def clock_enable(payload):
64
64
69
9
55
Gracker/SystraceAnalysis
python3/ftrace/parsers/clock_enable.py
Python
clock_enable
clock_enable
63
72
63
64
621e7bc4c9a792f21ba723e39e5c87bdd8e3f0ad
bigcode/the-stack
train
da4430568852cb41b3f9e520
train
function
def calculateXenonNeNph(E): """ Give E in keV""" k = 0.1735 W = 13.7 eps = 11.5 * (54**(-7/3)) * E g = 3 * (np.sign(eps)*np.abs(eps)**0.15) + 0.7 * (np.sign(eps)*np.abs(eps)**0.6) + eps L = k * g / (1 + k * g) NeNph = (L*E*1000)/W return NeNph
def calculateXenonNeNph(E):
""" Give E in keV""" k = 0.1735 W = 13.7 eps = 11.5 * (54**(-7/3)) * E g = 3 * (np.sign(eps)*np.abs(eps)**0.15) + 0.7 * (np.sign(eps)*np.abs(eps)**0.6) + eps L = k * g / (1 + k * g) NeNph = (L*E*1000)/W return NeNph
3 # -*- coding: utf-8 -*- """ Created on Tue Jul 28 14:15:41 2020 @author: bressler """ import numpy as np import matplotlib.pyplot as plt efficiency = 0.0005 def calculateXenonNeNph(E):
64
64
135
10
53
cericdahl/SBCcode
UserCode/bressler/LindhardModelPHE.py
Python
calculateXenonNeNph
calculateXenonNeNph
14
23
14
14
5550e8e64b1b580a2df4145908c8af5b2096f2e0
bigcode/the-stack
train
d97fa0a37a87972b9264b091
train
function
def main(): Enr = np.arange(0.1, 1e6, 0.1) NeNph = np.zeros([len(Enr),1]) print(EnrXenonChamber(1)) print(EnrXenonChamber(512.5)) print(pheXenonChamber(15000)) for i in range(len(Enr)): E = Enr[i] NeNph[i] = calculateXenonNeNph(E) plt.figure() plt.plot(Enr, [eff...
def main():
Enr = np.arange(0.1, 1e6, 0.1) NeNph = np.zeros([len(Enr),1]) print(EnrXenonChamber(1)) print(EnrXenonChamber(512.5)) print(pheXenonChamber(15000)) for i in range(len(Enr)): E = Enr[i] NeNph[i] = calculateXenonNeNph(E) plt.figure() plt.plot(Enr, [efficiency*N fo...
return efficiency * calculateXenonNeNph(E) def EnrXenonChamber(phe): energyarray = np.arange(0,1e6,0.1) return np.interp(phe, pheXenonChamber(energyarray), energyarray) def main():
64
64
208
3
61
cericdahl/SBCcode
UserCode/bressler/LindhardModelPHE.py
Python
main
main
32
51
32
32
5c3a2e9a60c1e4ca7990b85a5bbe8b152dbfc0c2
bigcode/the-stack
train
b70d0f07bee8afe775c8f6ea
train
function
def EnrXenonChamber(phe): energyarray = np.arange(0,1e6,0.1) return np.interp(phe, pheXenonChamber(energyarray), energyarray)
def EnrXenonChamber(phe):
energyarray = np.arange(0,1e6,0.1) return np.interp(phe, pheXenonChamber(energyarray), energyarray)
g / (1 + k * g) NeNph = (L*E*1000)/W return NeNph def pheXenonChamber(E): return efficiency * calculateXenonNeNph(E) def EnrXenonChamber(phe):
64
64
49
11
53
cericdahl/SBCcode
UserCode/bressler/LindhardModelPHE.py
Python
EnrXenonChamber
EnrXenonChamber
28
30
28
28
f28cc704db0d3ad2018efc2c594e5053a3d6a055
bigcode/the-stack
train
6030a4cdaeb1af12b2e75098
train
function
def pheXenonChamber(E): return efficiency * calculateXenonNeNph(E)
def pheXenonChamber(E):
return efficiency * calculateXenonNeNph(E)
* (np.sign(eps)*np.abs(eps)**0.6) + eps L = k * g / (1 + k * g) NeNph = (L*E*1000)/W return NeNph def pheXenonChamber(E):
64
64
22
9
54
cericdahl/SBCcode
UserCode/bressler/LindhardModelPHE.py
Python
pheXenonChamber
pheXenonChamber
25
26
25
25
b25b220801a1bd164f149c6060b50d5813eea3fd
bigcode/the-stack
train
491289d511141d1ef444a7b7
train
function
def create_app(config_name): app.config.from_object(config_options[config_name]) config_options[config_name].init_app(app) configure_uploads(app, photos) from .auth import auth as authentication_blueprint from .main import main as main_blueprint # app.register_blueprint(authentication_bluepr...
def create_app(config_name):
app.config.from_object(config_options[config_name]) config_options[config_name].init_app(app) configure_uploads(app, photos) from .auth import auth as authentication_blueprint from .main import main as main_blueprint # app.register_blueprint(authentication_blueprint) app.register_bluepri...
Flask(__name__) app.static_folder = 'static' db = SQLAlchemy() bootstrap = Bootstrap() login_manager = LoginManager() login_manager.session_protection = 'strong' login_manager.load_view = 'auth.login' photos = UploadSet('photos', IMAGES) mail = Mail() def create_app(config_name):
64
64
107
6
58
wangechimk/pitch-app
app/__init__.py
Python
create_app
create_app
20
35
20
20
d2396b5559575fd8dccfe52c908d9919f17400d5
bigcode/the-stack
train
132fb25cc2befeab96dc471f
train
function
def FP32toFP16(float32): F16_EXPONENT_BITS = 0x1F F16_EXPONENT_SHIFT = 10 F16_EXPONENT_BIAS = 15 F16_MANTISSA_BITS = 0x3ff F16_MANTISSA_SHIFT = (23 - F16_EXPONENT_SHIFT) F16_MAX_EXPONENT = (F16_EXPONENT_BITS << F16_EXPONENT_SHIFT) a = struct.pack('>f',float32) b = binascii.hexlify(a) ...
def FP32toFP16(float32):
F16_EXPONENT_BITS = 0x1F F16_EXPONENT_SHIFT = 10 F16_EXPONENT_BIAS = 15 F16_MANTISSA_BITS = 0x3ff F16_MANTISSA_SHIFT = (23 - F16_EXPONENT_SHIFT) F16_MAX_EXPONENT = (F16_EXPONENT_BITS << F16_EXPONENT_SHIFT) a = struct.pack('>f',float32) b = binascii.hexlify(a) f32 = int(b,16) ...
####################### # Auxiliary Functions # ####################### import struct, binascii def FP32toFP16(float32):
25
91
304
9
15
tambry/PS3Tests
RSX/TextureFormats/PS3_PPU_Release/Texture_Generate.py
Python
FP32toFP16
FP32toFP16
7
36
7
7
685993a5ae7e3f551bf381abf609b8c7743595ab
bigcode/the-stack
train
cfb2d4b9d3c70f583dba2251
train
class
class NormalResidualTransformer(object): def __init__(self, mu_layers, sigma_layers): self.mu_layers = mu_layers self.sigma_layers = sigma_layers def _compute_x1(self, x0, mu, log_sigma, w1): return x0 + mu + tf.exp(log_sigma) * w1 def _compute_log_p1(self, x0, mu, log_sigma, x1):...
class NormalResidualTransformer(object):
def __init__(self, mu_layers, sigma_layers): self.mu_layers = mu_layers self.sigma_layers = sigma_layers def _compute_x1(self, x0, mu, log_sigma, w1): return x0 + mu + tf.exp(log_sigma) * w1 def _compute_log_p1(self, x0, mu, log_sigma, x1): return -tf.reduce_sum(log_sigma, ...
#log_p1 = -tf.reduce_sum(sigma, axis=0) - 0.5 * tf.reduce_sum((self.x1 - mu)/sigma, axis=0) self.log_p1 = keras.layers.Lambda(lambda args: self._compute_log_p1(args[0], args[1], args[2]))([mu, log_sigma, self.x1]) # return variable and density return self.x1, self.log_p1 class NormalRes...
105
105
350
6
98
yhgon/paper_boltzmann_generators
notebooks/deep_boltzmann/networks/noninvertible.py
Python
NormalResidualTransformer
NormalResidualTransformer
33
56
33
34
c5dde9954e9a937d819c2e666a97b51ac8eb9615
bigcode/the-stack
train
4ce1fd5781d109496f5defae
train
class
class NormalTransformer(object): def __init__(self, mu_layers, sigma_layers): self.mu_layers = mu_layers self.sigma_layers = sigma_layers def _compute_x1(self, mu, log_sigma, w1): return mu + tf.exp(log_sigma) * w1 def _compute_log_p1(self, mu, log_sigma, x1): return -tf.r...
class NormalTransformer(object):
def __init__(self, mu_layers, sigma_layers): self.mu_layers = mu_layers self.sigma_layers = sigma_layers def _compute_x1(self, mu, log_sigma, w1): return mu + tf.exp(log_sigma) * w1 def _compute_log_p1(self, mu, log_sigma, x1): return -tf.reduce_sum(log_sigma, axis=1) - 0.5...
import keras import tensorflow as tf import numpy as np from deep_boltzmann.networks import nonlinear_transform from deep_boltzmann.networks import connect as _connect class NormalTransformer(object):
44
96
323
5
38
yhgon/paper_boltzmann_generators
notebooks/deep_boltzmann/networks/noninvertible.py
Python
NormalTransformer
NormalTransformer
8
31
8
9
bdab1fcca04a34a6a42d2e7480b3c31b15235188
bigcode/the-stack
train
e59668ec4e5ce7fa23decf94
train
class
class NoninvNet(object): def __init__(self, dim, layers): self.dim = dim self.layers = layers self.log_p_total = None def connect(self): # x0 = 0 self.x0 = keras.layers.Input(shape=(self.dim,)) # current noise input x_last = self.x0 self.xs = [] ...
class NoninvNet(object):
def __init__(self, dim, layers): self.dim = dim self.layers = layers self.log_p_total = None def connect(self): # x0 = 0 self.x0 = keras.layers.Input(shape=(self.dim,)) # current noise input x_last = self.x0 self.xs = [] self.ws = [] sel...
)/sigma, axis=0) self.log_p1 = keras.layers.Lambda(lambda args: self._compute_log_p1(args[0], args[1], args[2], args[3]))([x0, mu, log_sigma, self.x1]) # return variable and density return self.x1, self.log_p1 class NoninvNet(object):
79
79
266
6
72
yhgon/paper_boltzmann_generators
notebooks/deep_boltzmann/networks/noninvertible.py
Python
NoninvNet
NoninvNet
58
90
58
58
bd1424d632b48bacc81fb977fe39897a7e33a2ca
bigcode/the-stack
train
aeabd18838bd4285b6e3f84a
train
function
def normal_transnet(dim, nlayers, mu_shape=(100, 100), mu_activation='relu', sigma_shape=(100, 100), sigma_activation='tanh', residual=False, **layer_args): """ dim : int Dimension of variables nlayers : int Number of layers in the transformer mu_s...
def normal_transnet(dim, nlayers, mu_shape=(100, 100), mu_activation='relu', sigma_shape=(100, 100), sigma_activation='tanh', residual=False, **layer_args):
""" dim : int Dimension of variables nlayers : int Number of layers in the transformer mu_shape : int Number of hidden units in each nonlinear layer mu_activation : str Hidden-neuron activation functions used in the nonlinear layers sigma_shape : int Numbe...
axis=0))(self.log_ps) def log_probability(self): """ Computes the total log probability of the current sample""" return tf.reduce_sum(self.log_ps, axis=0) def normal_transnet(dim, nlayers, mu_shape=(100, 100), mu_activation='relu', sigma_shape=(100, 100), sigma_activation='tan...
84
84
282
45
39
yhgon/paper_boltzmann_generators
notebooks/deep_boltzmann/networks/noninvertible.py
Python
normal_transnet
normal_transnet
93
124
93
95
738ded22683a6ad2903a56baa5874c654abf44b4
bigcode/the-stack
train
319ce65c9ac0988223443d15
train
class
class UpdateContact(object): """NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. """ """ Attributes: swagger_types (dict): The key is attribute name and the value is attribute type. attribute_map (dict...
class UpdateContact(object):
"""NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. """ """ Attributes: swagger_types (dict): The key is attribute name and the value is attribute type. attribute_map (dict): The key is attribute name ...
- Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/sendinblue **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request ...
256
256
1,893
5
250
Danilka/APIv3-python-library
sib_api_v3_sdk/models/update_contact.py
Python
UpdateContact
UpdateContact
20
254
20
20
eaa13b6d18e7573a77988d4e0a268883a2abe6bf
bigcode/the-stack
train
6f012820365c77f984485db8
train
function
def _get_data(afile, file_type=None, **keywords): if isstream(afile): keywords.update(dict( file_stream=afile, file_type=file_type or constants.FILE_FORMAT_CSV)) else: if afile is None or file_type is None: keywords.update(dict( file_name=afile...
def _get_data(afile, file_type=None, **keywords):
if isstream(afile): keywords.update(dict( file_stream=afile, file_type=file_type or constants.FILE_FORMAT_CSV)) else: if afile is None or file_type is None: keywords.update(dict( file_name=afile, file_type=file_type)) el...
""" if streaming is not None and streaming is True: warnings.warn('Please use iget_data instead') data, _ = _get_data(afile, file_type=file_type, streaming=False, **keywords) return data def _get_data(afile, file_type=None, **keywords):
64
64
103
14
49
Lwz1966/QQ-Groups-Spider
vendor/pyexcel_io/io.py
Python
_get_data
_get_data
69
83
69
69
9840597041b969ac26fbe681e33e1b42f07f32d2
bigcode/the-stack
train
3741b50d7b28b80f416d5e4a
train
function
def save_data(afile, data, file_type=None, **keywords): """Save data to an excel file source Your data must be a dictionary :param filename: actual file name, a file stream or actual content :param data: a dictionary but an ordered dictionary is preferred :param file_type: used only when filename ...
def save_data(afile, data, file_type=None, **keywords):
"""Save data to an excel file source Your data must be a dictionary :param filename: actual file name, a file stream or actual content :param data: a dictionary but an ordered dictionary is preferred :param file_type: used only when filename is not a physial file name :param library: explicitl...
_stream=afile, file_type=file_type or constants.FILE_FORMAT_CSV)) else: if afile is None or file_type is None: keywords.update(dict( file_name=afile, file_type=file_type)) else: keywords.update(dict( file_content=afi...
90
90
300
15
75
Lwz1966/QQ-Groups-Spider
vendor/pyexcel_io/io.py
Python
save_data
save_data
86
119
86
86
724147212fd7a90fa288259130fdb7c92704c7f8
bigcode/the-stack
train
b4ec83a2ede781311a4bdf14
train
function
def store_data(afile, data, file_type=None, **keywords): """Non public function to store data to afile :param filename: actual file name, a file stream or actual content :param data: the data to be written :param file_type: used only when filename is not a physial file name :param keywords: any oth...
def store_data(afile, data, file_type=None, **keywords):
"""Non public function to store data to afile :param filename: actual file name, a file stream or actual content :param data: the data to be written :param file_type: used only when filename is not a physial file name :param keywords: any other parameters """ if isstream(afile): key...
is None if no_file_type: file_type = constants.FILE_FORMAT_CSV store_data(afile, to_store, file_type=file_type, single_sheet_in_book=single_sheet_in_book, **keywords) def store_data(afile, data, file_type=None, **keywords):
64
64
146
15
49
Lwz1966/QQ-Groups-Spider
vendor/pyexcel_io/io.py
Python
store_data
store_data
122
141
122
122
27b2d2a128bbf137f8f86e4c16f690bb3343e52e
bigcode/the-stack
train
00734b5bdcd9087731e56d97
train
function
def iget_data(afile, file_type=None, **keywords): """Get data from an excel file source :param afile: a file name, a file stream or actual content :param sheet_name: the name of the sheet to be loaded :param sheet_index: the index of the sheet to be loaded :param sheets: a list of sheet to be loade...
def iget_data(afile, file_type=None, **keywords):
"""Get data from an excel file source :param afile: a file name, a file stream or actual content :param sheet_name: the name of the sheet to be loaded :param sheet_index: the index of the sheet to be loaded :param sheets: a list of sheet to be loaded :param file_type: used only when filename is...
Onni Software Ltd. :license: New BSD License, see LICENSE for more details """ from types import GeneratorType import warnings from pyexcel_io._compact import isstream, PY2 from pyexcel_io.plugins import READERS, WRITERS import pyexcel_io.constants as constants def iget_data(afile, file_type=None, **keywords):
77
77
257
14
62
Lwz1966/QQ-Groups-Spider
vendor/pyexcel_io/io.py
Python
iget_data
iget_data
18
40
18
18
dba2497788f86cd0523e0873ee6eaa1870871483
bigcode/the-stack
train
e2db635a5a4437d53e532046
train
function
def load_data(file_name=None, file_content=None, file_stream=None, file_type=None, sheet_name=None, sheet_index=None, sheets=None, library=None, streaming=False, **keywords): """Load data fr...
def load_data(file_name=None, file_content=None, file_stream=None, file_type=None, sheet_name=None, sheet_index=None, sheets=None, library=None, streaming=False, **keywords):
"""Load data from any supported excel formats :param filename: actual file name, a file stream or actual content :param file_type: used only when filename is not a physial file name :param sheet_name: the name of the sheet to be loaded :param sheet_index: the index of the sheet to be loaded :pa...
""" if isstream(afile): keywords.update(dict( file_stream=afile, file_type=file_type )) else: keywords.update(dict( file_name=afile, file_type=file_type )) with get_writer(**keywords) as writer: writer.write(data) d...
114
114
383
48
66
Lwz1966/QQ-Groups-Spider
vendor/pyexcel_io/io.py
Python
load_data
load_data
144
194
144
153
836781b0c2f00a2a3e61ebd80dde917e282fce31
bigcode/the-stack
train
d13645b4c052eca3839cb301
train
function
def get_writer(file_name=None, file_stream=None, file_type=None, library=None, **keywords): """find a suitable writer""" inputs = [file_name, file_stream] number_of_none_inputs = [x for x in inputs if x is not None] if len(number_of_none_inputs) != 1: raise IOError(constants.MESS...
def get_writer(file_name=None, file_stream=None, file_type=None, library=None, **keywords):
"""find a suitable writer""" inputs = [file_name, file_stream] number_of_none_inputs = [x for x in inputs if x is not None] if len(number_of_none_inputs) != 1: raise IOError(constants.MESSAGE_ERROR_02) file_type_given = True if file_type is None and file_name: try: f...
= reader.read_all() if streaming is False: for key in result.keys(): result[key] = list(result[key]) reader.close() reader = None return result, reader def get_writer(file_name=None, file_stream=None, file_type=None, library=None, **keywords):
64
64
211
22
41
Lwz1966/QQ-Groups-Spider
vendor/pyexcel_io/io.py
Python
get_writer
get_writer
197
222
197
198
7bc3c1e3510bec3ae30e3e23cc3d68351d18e6fb
bigcode/the-stack
train