complexity
int64 1
139
| fun_name
stringlengths 1
80
| code
stringlengths 101
62.2k
| commit_id
stringlengths 40
40
| ast_errors
stringlengths 0
3.11k
| ast_levels
int64 6
36
| file_name
stringlengths 5
79
| n_ast_nodes
int64 17
19.2k
| commit_message
stringlengths 3
15.3k
| d_id
int64 12
121k
| n_ast_errors
int64 0
9
| n_whitespaces
int64 4
10.8k
| token_counts
int64 5
3.06k
| vocab_size
int64 4
1.11k
| id
int64 20
338k
| n_words
int64 4
4.82k
| repo
stringlengths 3
22
| n_identifiers
int64 2
176
| path
stringlengths 7
134
| language
stringclasses 1
value | nloc
int64 1
413
| documentation
dict | url
stringlengths 31
59
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2 | call_bc | def call_bc(self, other_args):
parser = argparse.ArgumentParser(
add_help=False,
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
prog="bc",
description=,
)
ns_parser = parse_known_args_and_warn(
parser, other_args, EXPORT_ONLY_RAW_DATA_ALLOWED
)
if ns_parser:
pycoingecko_view.display_bc(self.coin_map_df["CoinGecko"], ns_parser.export)
| ea964109d654394cc0a5237e6ec5510ba6404097 | 11 | dd_controller.py | 97 | Crypto menu refactor (#1119)
* enabled some crypto commands in dd to be called independent of source loaded
* support for coin_map_df in all dd functions + load ta and plot chart refactor
* updated tests and removed coingecko scrapping where possible
* removed ref of command from hugo
* updated pycoingecko version
* refactoring load
* refactored load to fetch prices; pred can run independent of source now
* load by default usd on cp/cg and usdt on cb/bin
* updated to rich for formatting and updated dependencies
* fixed changes requested
* update docs
* revert discord requirements
* removed absolute from calculate change for price
* fixing pr issues
* fix loading issue when similar coins exist, move coins to home, fill n/a
* update docs for coins
* adds load to ta and pred menu | 83,548 | 0 | 130 | 61 | 20 | 281,136 | 22 | OpenBBTerminal | 18 | gamestonk_terminal/cryptocurrency/due_diligence/dd_controller.py | Python | 15 | {
"docstring": "Process bc command\n Blockchain explorers URLs for loaded coin. Those are sites like etherescan.io or polkascan.io\n in which you can see all blockchain data e.g. all txs, all tokens, all contracts...\n ",
"language": "en",
"n_whitespaces": 84,
"n_words": 31,
"vocab_size": 28
} | https://github.com/OpenBB-finance/OpenBBTerminal.git |
|
1 | communicate | async def communicate(self):
assert self._input.is_file()
self._output.open("w").close()
return (None, None)
| fa2ad657482aca9dc628e6d7062b8badf2706bb6 | 10 | conftest.py | 57 | v4 init | 5,330 | 0 | 37 | 32 | 9 | 30,126 | 9 | spotify-downloader | 7 | tests/conftest.py | Python | 4 | {
"docstring": "\n Ensure that the file has been download, and create empty output file,\n to avoid infinite loop.\n ",
"language": "en",
"n_whitespaces": 38,
"n_words": 16,
"vocab_size": 16
} | https://github.com/spotDL/spotify-downloader.git |
|
1 | test_multi_trial_reuse_with_failing | def test_multi_trial_reuse_with_failing(ray_start_4_cpus_extra):
os.environ["TUNE_MAX_PENDING_TRIALS_PG"] = "2"
register_trainable("foo2", MyResettableClass)
[trial1, trial2, trial3, trial4] = tune.run(
"foo2",
config={
"fail": tune.grid_search([False, True, False, False]),
"id": -1,
"sleep": 2,
},
reuse_actors=True,
resources_per_trial={"cpu": 2},
raise_on_failed_trial=False,
).trials
assert trial1.last_result["num_resets"] == 0
assert trial3.last_result["num_resets"] == 0
assert trial4.last_result["num_resets"] == 1
| 1510fb2cd631b2776092fb45ee4082e5e65f16f8 | 15 | test_actor_reuse.py | 183 | [air/tune] Internal resource management 2 - Ray Tune to use new Ray AIR resource manager (#30016)
Includes/depends on #30777
TLDR: This PR refactors Ray Tune's resource management to use a central AIR resource management package instead of the tightly coupled PlacementGroupManager.
Ray Tune's resource management currently uses a tightly coupled placement group manager. This leads to a number of shortcomings:
- The tight coupling on the manager side (e.g. PG manager keeps track of trials) prevents re-usability
- The tight coupling on the trial executor side prevents using different resource management strategies (e.g. shared or budget-based)
- It's hard to test independently. Tests for the resource management require a simulated tune setup.
To improve stability, extensibility, and maintainability, this PR moves the resource management logic into a central `ray.air.execution.resources` subpackage. The resource management has a simple API that works with `ResourceRequest`s and `AllocatedResources` to manage requested and assigned resources, respectively. The actual resource management can then be anything - per default it is a placement group based manager, but this PR also introduces a PoC budget-based manager that can be plugged in.
The PR does not substantially change existing tests, so we can be certain that the new resource model is a fully compatible replacement for the old placement group manager.
Signed-off-by: Kai Fricke <[email protected]> | 31,314 | 0 | 141 | 113 | 36 | 138,092 | 42 | ray | 19 | python/ray/tune/tests/test_actor_reuse.py | Python | 17 | {
"docstring": "Test that failing trial's actors are not reused.\n\n - 2 trials can run at the same time\n - Trial 1 succeeds, trial 2 fails\n - Trial 3 will be scheduled after trial 2 failed, so won't reuse actor\n - Trial 4 will be scheduled after trial 1 succeeded, so will reuse actor\n ",
"language": "en",
"n_whitespaces": 67,
"n_words": 52,
"vocab_size": 34
} | https://github.com/ray-project/ray.git |
|
4 | size_bytes | def size_bytes(self) -> int:
size = 0
has_size = False
for m in self.get_metadata():
if m.size_bytes is not None:
has_size = True
size += m.size_bytes
if not has_size:
return -1
else:
return size
| b5b4460932505912d88d65134931e0da170fb467 | 11 | block_list.py | 84 | Support creating a DatasetPipeline windowed by bytes (#22577) | 33,465 | 0 | 138 | 50 | 24 | 145,482 | 33 | ray | 7 | python/ray/data/impl/block_list.py | Python | 12 | {
"docstring": "Returns the total size in bytes of the blocks, or -1 if not known.",
"language": "en",
"n_whitespaces": 13,
"n_words": 14,
"vocab_size": 13
} | https://github.com/ray-project/ray.git |
|
2 | unregister | def unregister(self, name):
if name in self._BUILTIN_COLOR_SEQUENCES:
raise ValueError(
f"Cannot unregister builtin color sequence {name!r}")
self._color_sequences.pop(name, None)
_color_sequences = ColorSequenceRegistry()
| 0abe0ce2f2748d1d0383154d045da3609a4b871b | 11 | colors.py | 65 | Add a registry for color sequences
Color sequences are simply lists of colors, that we store by name in
a registry. The registry is modelled similar to the ColormapRegistry
to 1) support immutable builtin color sequences and 2) to return copies
so that one cannot mess with the global definition of the color sequence
through an obtained instance.
For now, I've made the sequences used for `ListedColormap`s available
as builtin sequences, but that's open for discussion.
More usage documentation should be added in the color examples and/or
tutorials, but I'll wait with that till after the general approval of
the structure and API. One common use case will be
```
plt.rc_params['axes.prop_cycle'] = plt.cycler(color=plt.color_sequences['Pastel1')
```
Co-authored-by: Elliott Sales de Andrade <[email protected]> | 23,145 | 0 | 66 | 31 | 20 | 108,335 | 20 | matplotlib | 8 | lib/matplotlib/colors.py | Python | 5 | {
"docstring": "\n Remove a sequence from the registry.\n\n You cannot remove built-in color sequences.\n\n If the name is not registered, returns with no error.\n ",
"language": "en",
"n_whitespaces": 51,
"n_words": 22,
"vocab_size": 21
} | https://github.com/matplotlib/matplotlib.git |
|
10 | source_from_cache | def source_from_cache(path):
if sys.implementation.cache_tag is None:
raise NotImplementedError('sys.implementation.cache_tag is None')
path = _os.fspath(path)
head, pycache_filename = _path_split(path)
found_in_pycache_prefix = False
if sys.pycache_prefix is not None:
stripped_path = sys.pycache_prefix.rstrip(path_separators)
if head.startswith(stripped_path + path_sep):
head = head[len(stripped_path):]
found_in_pycache_prefix = True
if not found_in_pycache_prefix:
head, pycache = _path_split(head)
if pycache != _PYCACHE:
raise ValueError(f'{_PYCACHE} not bottom-level directory in '
f'{path!r}')
dot_count = pycache_filename.count('.')
if dot_count not in {2, 3}:
raise ValueError(f'expected only 2 or 3 dots in {pycache_filename!r}')
elif dot_count == 3:
optimization = pycache_filename.rsplit('.', 2)[-2]
if not optimization.startswith(_OPT):
raise ValueError("optimization portion of filename does not start "
f"with {_OPT!r}")
opt_level = optimization[len(_OPT):]
if not opt_level.isalnum():
raise ValueError(f"optimization level {optimization!r} is not an "
"alphanumeric value")
base_filename = pycache_filename.partition('.')[0]
return _path_join(head, base_filename + SOURCE_SUFFIXES[0])
| 8198943edd73a363c266633e1aa5b2a9e9c9f526 | 15 | _bootstrap_external.py | 378 | add python 3.10.4 for windows | 55,140 | 0 | 366 | 212 | 79 | 218,114 | 121 | XX-Net | 33 | python3.10.4/Lib/importlib/_bootstrap_external.py | Python | 30 | {
"docstring": "Given the path to a .pyc. file, return the path to its .py file.\n\n The .pyc file does not need to exist; this simply returns the path to\n the .py file calculated to correspond to the .pyc file. If path does\n not conform to PEP 3147/488 format, ValueError will be raised. If\n sys.implementation.cache_tag is None then NotImplementedError is raised.\n\n ",
"language": "en",
"n_whitespaces": 75,
"n_words": 59,
"vocab_size": 37
} | https://github.com/XX-net/XX-Net.git |
|
1 | test_deps_sorted | def test_deps_sorted(self):
from airflow.operators.empty import EmptyOperator
from airflow.sensors.external_task import ExternalTaskSensor
execution_date = datetime(2020, 1, 1)
with DAG(dag_id="test_deps_sorted", start_date=execution_date) as dag:
task1 = ExternalTaskSensor(
task_id="task1",
external_dag_id="external_dag_id",
mode="reschedule",
)
task2 = EmptyOperator(task_id="task2")
task1 >> task2
serialize_op = SerializedBaseOperator.serialize_operator(dag.task_dict["task1"])
deps = serialize_op["deps"]
assert deps == [
'airflow.ti_deps.deps.not_in_retry_period_dep.NotInRetryPeriodDep',
'airflow.ti_deps.deps.not_previously_skipped_dep.NotPreviouslySkippedDep',
'airflow.ti_deps.deps.prev_dagrun_dep.PrevDagrunDep',
'airflow.ti_deps.deps.ready_to_reschedule.ReadyToRescheduleDep',
'airflow.ti_deps.deps.trigger_rule_dep.TriggerRuleDep',
]
| 49e336ae0302b386a2f47269a6d13988382d975f | 12 | test_dag_serialization.py | 186 | Replace usage of `DummyOperator` with `EmptyOperator` (#22974)
* Replace usage of `DummyOperator` with `EmptyOperator` | 9,201 | 0 | 256 | 109 | 40 | 47,665 | 49 | airflow | 25 | tests/serialization/test_dag_serialization.py | Python | 21 | {
"docstring": "\n Tests serialize_operator, make sure the deps is in order\n ",
"language": "en",
"n_whitespaces": 24,
"n_words": 9,
"vocab_size": 9
} | https://github.com/apache/airflow.git |
|
1 | load_workflow_status | def load_workflow_status(self):
return self._status_storage.load_workflow_status(self._workflow_id)
| f67871c1f7e79adc727b2a15311d9332832d2e8a | 8 | workflow_storage.py | 30 | [workflow] Fast workflow indexing (#24767)
* workflow indexing
* simplify workflow storage API
* Only fix workflow status when updating the status.
* support status filter | 31,892 | 0 | 18 | 17 | 4 | 140,203 | 4 | ray | 4 | python/ray/workflow/workflow_storage.py | Python | 2 | {
"docstring": "Load workflow status. If we find the previous status updating failed,\n fix it with redo-log transaction recovery.",
"language": "en",
"n_whitespaces": 23,
"n_words": 17,
"vocab_size": 17
} | https://github.com/ray-project/ray.git |
|
3 | isCPythonOfficialPackage | def isCPythonOfficialPackage():
# For macOS however, it's very knowable.
if isMacOS() and sys.executable.startswith(
"/Library/Frameworks/Python.framework/Versions/"
):
return True
return False
| c723f658e8c11ec92d6ef90c2f42527c67d3f318 | 9 | PythonFlavors.py | 44 | Added CPython Official flavor, so far only detected on macOS | 42,789 | 0 | 48 | 23 | 18 | 178,678 | 19 | Nuitka | 5 | nuitka/PythonFlavors.py | Python | 6 | {
"docstring": "Official CPython download, kind of hard to detect since self-compiled doesn't change much.",
"language": "en",
"n_whitespaces": 12,
"n_words": 13,
"vocab_size": 13
} | https://github.com/Nuitka/Nuitka.git |
|
2 | update_existing_attachments | def update_existing_attachments(job):
# Patch attachments that were ingested on the standalone path.
with sentry_sdk.start_span(op="tasks.post_process_group.update_existing_attachments"):
try:
from sentry.models import EventAttachment
event = job["event"]
EventAttachment.objects.filter(
project_id=event.project_id, event_id=event.event_id
).update(group_id=event.group_id)
except Exception:
logger.exception("Failed to update existing attachments")
| bc59434031930199dcdc056943c2ba4a17bbd5c8 | 15 | post_process.py | 116 | ref(perf-issues): Modularize post_process_group (ISP-11) (#39594)
Fully modularizes `post_process_group` as final step before adding
multiple event types to it. | 18,118 | 0 | 126 | 66 | 33 | 86,527 | 33 | sentry | 18 | src/sentry/tasks/post_process.py | Python | 10 | {
"docstring": "\n Attaches the group_id to all event attachments that were either:\n\n 1) ingested prior to the event via the standalone attachment endpoint.\n 2) part of a different group before reprocessing started.\n ",
"language": "en",
"n_whitespaces": 43,
"n_words": 30,
"vocab_size": 26
} | https://github.com/getsentry/sentry.git |
|
1 | list | def list(self, ignore_patterns):
raise NotImplementedError(
"subclasses of BaseFinder must provide a list() method"
)
| 9c19aff7c7561e3a82978a272ecdaad40dda5c00 | 8 | finders.py | 25 | Refs #33476 -- Reformatted code with Black. | 50,701 | 0 | 46 | 13 | 14 | 204,338 | 14 | django | 4 | django/contrib/staticfiles/finders.py | Python | 4 | {
"docstring": "\n Given an optional list of paths to ignore, return a two item iterable\n consisting of the relative path and storage instance.\n ",
"language": "en",
"n_whitespaces": 43,
"n_words": 21,
"vocab_size": 20
} | https://github.com/django/django.git |
|
2 | test_less_jobs | def test_less_jobs(self, api, started_job, batch):
jobs = [started_job for _ in range(49)]
update_in_batch(api=api, jobs=jobs)
assert started_job.update_job.call_count == 49
assert len(api.new_batch.return_value) == 49
batch.execute.assert_called_once()
| a3aae8017a0a40ff2006e2567f71dccb04c997a5 | 10 | test_async_job.py | 93 | ๐ ๐ Source FB Marketing: performance and reliability fixes (#9805)
* Facebook Marketing performance improvement
* add comments and little refactoring
* fix integration tests with the new config
* improve job status handling, limit concurrency to 10
* fix campaign jobs, refactor manager
* big refactoring of async jobs, support random order of slices
* update source _read_incremental to hook new state logic
* fix issues with timeout
* remove debugging and clean up, improve retry logic
* merge changes from #8234
* fix call super _read_increment
* generalize batch execution, add use_batch flag
* improve coverage, do some refactoring of spec
* update test, remove overrides of source
* add split by AdSet
* add smaller insights
* fix end_date < start_date case
* add account_id to PK
* add notes
* fix new streams
* fix reversed incremental stream
* update spec.json for SAT
* upgrade CDK and bump version
Co-authored-by: Dmytro Rezchykov <[email protected]>
Co-authored-by: Eugene Kulak <[email protected]> | 563 | 0 | 65 | 60 | 20 | 3,800 | 23 | airbyte | 16 | airbyte-integrations/connectors/source-facebook-marketing/unit_tests/test_async_job.py | Python | 6 | {
"docstring": "Should update all jobs when number of jobs less than max size of batch",
"language": "en",
"n_whitespaces": 13,
"n_words": 14,
"vocab_size": 12
} | https://github.com/airbytehq/airbyte.git |
|
1 | test_load_global_local_flag_config | def test_load_global_local_flag_config(self):
global_config =
local_config =
global_config_path = "/mock/home/folder/.streamlit/config.toml"
local_config_path = os.path.join(os.getcwd(), ".streamlit/config.toml")
global_open = mock_open(read_data=global_config)
local_open = mock_open(read_data=local_config)
open = mock_open()
open.side_effect = [global_open.return_value, local_open.return_value]
open_patch = patch("streamlit.config.open", open)
# patch streamlit.*.os.* instead of os.* for py35 compat
makedirs_patch = patch("streamlit.config.os.makedirs")
makedirs_patch.return_value = True
pathexists_patch = patch("streamlit.config.os.path.exists")
pathexists_patch.side_effect = lambda path: path in [
global_config_path,
local_config_path,
]
with open_patch, makedirs_patch, pathexists_patch:
config.get_config_options(options_from_flags={"theme.font": "monospace"})
self.assertEqual("light", config.get_option("theme.base"))
self.assertEqual("#FFFFFF", config.get_option("theme.textColor"))
self.assertEqual("monospace", config.get_option("theme.font"))
| dd9084523e365e637443ea351eaaaa25f52d8412 | 13 | config_test.py | 292 | Report sharing removal (#4260)
The report sharing feature is a substantial but completely unused portion of the code in Streamlit's underlying machinery. The feature was created early on, used by just a few groups, and has not been used by anyone for a while, as indicated by no activity in the associated S3 buckets. This commit removes that code to make the remaining code easier to navigate and understand. | 26,359 | 0 | 257 | 163 | 58 | 118,684 | 70 | streamlit | 26 | lib/tests/streamlit/config_test.py | Python | 31 | {
"docstring": "Test that CLI flags have higher priority than both\n ~/.streamlit/config.toml and $CWD/.streamlit/config.toml at parse time.\n \n [theme]\n base = \"dark\"\n font = \"sans serif\"\n textColor = \"#FFFFFF\"\n \n [theme]\n base = \"light\"\n font = \"serif\"\n ",
"language": "en",
"n_whitespaces": 112,
"n_words": 33,
"vocab_size": 26
} | https://github.com/streamlit/streamlit.git |
|
2 | test_pickle_binary_object_compression | def test_pickle_binary_object_compression(compression):
df = tm.makeDataFrame()
# reference for compression
with tm.ensure_clean() as path:
df.to_pickle(path, compression=compression)
reference = Path(path).read_bytes()
# write
buffer = io.BytesIO()
df.to_pickle(buffer, compression=compression)
buffer.seek(0)
# gzip and zip safe the filename: cannot compare the compressed content
assert buffer.getvalue() == reference or compression in ("gzip", "zip", "tar")
# read
read_df = pd.read_pickle(buffer, compression=compression)
buffer.seek(0)
tm.assert_frame_equal(df, read_df)
| 864729813a0203af8bb0d30b6c883588ae2c96f8 | 12 | test_pickle.py | 188 | ENH: add support for reading .tar archives (#44787)
* Add reproduction test for .tar.gz archives
co-authored-by: Margarete Dippel <[email protected]>
* add support for .tar archives
python's `tarfile` supports gzip, xz and bz2 encoding,
so we don't need to make any special cases for that.
co-authored-by: Margarete Dippel <[email protected]>
* update doc comments
* fix: pep8 errors
* refactor: flip _compression_to_extension around to support multiple extensions on same compression
co-authored-by: Margarete Dippel <[email protected]
y.github.com>
* refactor: detect tar files using existing extension mapping
co-authored-by: Margarete Dippel <[email protected]>
* feat: add support for writing tar files
co-authored-by: Margarete Dippel <[email protected]>
* feat: assure it respects .gz endings
* feat: add "tar" entry to compressionoptions
* chore: add whatsnew entry
* fix: test_compression_size_fh
* add tarfile to shared compression docs
* fix formatting
* pass through "mode" via compression args
* fix pickle test
* add class comment
* sort imports
* add _compression_to_extension back for backwards compatibility
* fix some type warnings
* fix: formatting
* fix: mypy complaints
* fix: more tests
* fix: some error with xml
* fix: interpreted text role
* move to v1.5 whatsnw
* add versionadded note
* don't leave blank lines
* add tests for zero files / multiple files
* move _compression_to_extension to tests
* revert added "mode" argument
* add test to ensure that `compression.mode` works
* compare strings, not bytes
* replace carriage returns
Co-authored-by: Margarete Dippel <[email protected]> | 39,808 | 0 | 114 | 109 | 44 | 166,376 | 57 | pandas | 20 | pandas/tests/io/test_pickle.py | Python | 12 | {
"docstring": "\n Read/write from binary file-objects w/wo compression.\n\n GH 26237, GH 29054, and GH 29570\n ",
"language": "en",
"n_whitespaces": 23,
"n_words": 13,
"vocab_size": 11
} | https://github.com/pandas-dev/pandas.git |
|
5 | get_filtering | def get_filtering(self):
self.select_date_form = SelectDateForm(self.request.GET)
result = {}
if self.select_date_form.is_valid():
date_from = self.select_date_form.cleaned_data.get('date_from')
date_to = self.select_date_form.cleaned_data.get('date_to')
if date_to:
# careful: date_to must be increased by 1 day
# as submit_time is a time so will always be greater
date_to += datetime.timedelta(days=1)
if date_from:
result['submit_time__range'] = [date_from, date_to]
else:
result['submit_time__lte'] = date_to
elif date_from:
result['submit_time__gte'] = date_from
return result
| de3fcba9e95818e9634ab7de6bfcb1f4221f2775 | 15 | views.py | 174 | Fix warnings from flake8-comprehensions. | 15,592 | 0 | 265 | 100 | 42 | 70,980 | 58 | wagtail | 15 | wagtail/contrib/forms/views.py | Python | 15 | {
"docstring": " Return filering as a dict for submissions queryset ",
"language": "en",
"n_whitespaces": 9,
"n_words": 8,
"vocab_size": 8
} | https://github.com/wagtail/wagtail.git |
|
9 | get_so_reservation_for_item | def get_so_reservation_for_item(args):
reserved_so = None
if args.get("against_sales_order"):
if get_reserved_qty_for_so(args.get("against_sales_order"), args.get("item_code")):
reserved_so = args.get("against_sales_order")
elif args.get("against_sales_invoice"):
sales_order = frappe.db.sql(
,
(args.get("against_sales_invoice"), args.get("item_code")),
)
if sales_order and sales_order[0]:
if get_reserved_qty_for_so(sales_order[0][0], args.get("item_code")):
reserved_so = sales_order[0]
elif args.get("sales_order"):
if get_reserved_qty_for_so(args.get("sales_order"), args.get("item_code")):
reserved_so = args.get("sales_order")
return reserved_so
| 494bd9ef78313436f0424b918f200dab8fc7c20b | 15 | get_item_details.py | 253 | style: format code with black | 14,622 | 0 | 25 | 146 | 26 | 67,799 | 42 | erpnext | 9 | erpnext/stock/get_item_details.py | Python | 18 | {
"docstring": "select sales_order from `tabSales Invoice Item` where\n\t\tparent=%s and item_code=%s",
"language": "en",
"n_whitespaces": 8,
"n_words": 10,
"vocab_size": 10
} | https://github.com/frappe/erpnext.git |
|
1 | test_short_term_login_token | def test_short_term_login_token(self):
token = self.macaroon_generator.generate_short_term_login_token(
user_id="@user:tesths",
auth_provider_id="oidc",
auth_provider_session_id="sid",
duration_in_ms=2 * 60 * 1000,
)
info = self.macaroon_generator.verify_short_term_login_token(token)
self.assertEqual(info.user_id, "@user:tesths")
self.assertEqual(info.auth_provider_id, "oidc")
self.assertEqual(info.auth_provider_session_id, "sid")
# Raises with another secret key
with self.assertRaises(MacaroonVerificationFailedException):
self.other_macaroon_generator.verify_short_term_login_token(token)
# Wait a minute
self.reactor.pump([60])
# Shouldn't raise
self.macaroon_generator.verify_short_term_login_token(token)
# Wait another minute
self.reactor.pump([60])
# Should raise since it expired
with self.assertRaises(MacaroonVerificationFailedException):
self.macaroon_generator.verify_short_term_login_token(token)
| fe1daad67237c2154a3d8d8cdf6c603f0d33682e | 11 | test_macaroons.py | 233 | Move the "email unsubscribe" resource, refactor the macaroon generator & simplify the access token verification logic. (#12986)
This simplifies the access token verification logic by removing the `rights`
parameter which was only ever used for the unsubscribe link in email
notifications. The latter has been moved under the `/_synapse` namespace,
since it is not a standard API.
This also makes the email verification link more secure, by embedding the
app_id and pushkey in the macaroon and verifying it. This prevents the user
from tampering the query parameters of that unsubscribe link.
Macaroon generation is refactored:
- Centralised all macaroon generation and verification logic to the
`MacaroonGenerator`
- Moved to `synapse.utils`
- Changed the constructor to require only a `Clock`, hostname, and a secret key
(instead of a full `Homeserver`).
- Added tests for all methods. | 72,365 | 0 | 240 | 135 | 39 | 248,585 | 55 | synapse | 17 | tests/util/test_macaroons.py | Python | 18 | {
"docstring": "Test the generation and verification of short-term login tokens",
"language": "en",
"n_whitespaces": 8,
"n_words": 9,
"vocab_size": 9
} | https://github.com/matrix-org/synapse.git |
|
6 | polarity_scores | def polarity_scores(self, text):
# text, words_and_emoticons, is_cap_diff = self.preprocess(text)
sentitext = SentiText(
text, self.constants.PUNC_LIST, self.constants.REGEX_REMOVE_PUNCTUATION
)
sentiments = []
words_and_emoticons = sentitext.words_and_emoticons
for item in words_and_emoticons:
valence = 0
i = words_and_emoticons.index(item)
if (
i < len(words_and_emoticons) - 1
and item.lower() == "kind"
and words_and_emoticons[i + 1].lower() == "of"
) or item.lower() in self.constants.BOOSTER_DICT:
sentiments.append(valence)
continue
sentiments = self.sentiment_valence(valence, sentitext, item, i, sentiments)
sentiments = self._but_check(words_and_emoticons, sentiments)
return self.score_valence(sentiments, text)
| 74bb3c28ce9f2cd2be4cd9176747d59a0d67285d | 15 | vader.py | 218 | Add a note stating that a hashtag is unsupported in VADER | 7,656 | 0 | 274 | 138 | 53 | 42,601 | 70 | nltk | 21 | nltk/sentiment/vader.py | Python | 19 | {
"docstring": "\n Return a float for sentiment strength based on the input text.\n Positive values are positive valence, negative value are negative\n valence.\n\n :note: Hashtags are not taken into consideration (e.g. #BAD is neutral). If you\n are interested in processing the text in the hashtags too, then we recommend\n preprocessing your data to remove the #, after which the hashtag text may be\n matched as if it was a normal word in the sentence.\n ",
"language": "en",
"n_whitespaces": 141,
"n_words": 72,
"vocab_size": 59
} | https://github.com/nltk/nltk.git |
|
1 | test_mutating_input_arrays_y_and_z | def test_mutating_input_arrays_y_and_z(fig_test, fig_ref):
ax1 = fig_test.add_subplot(111, projection='3d')
x = [1, 2, 3]
y = [0.0, 0.0, 0.0]
z = [0.0, 0.0, 0.0]
ax1.plot(x, y, z, 'o-')
ax1.set_ylim([0, 4])
ax1.set_zlim([0, 4])
fig_test.draw_without_rendering()
# mutate y,z to get a nontrivial line
y[:] = [1, 2, 3]
z[:] = [1, 2, 3]
# draw the same plot without mutating x and y
ax2 = fig_ref.add_subplot(111, projection='3d')
x = [1, 2, 3]
y = [0.0, 0.0, 0.0]
z = [0.0, 0.0, 0.0]
ax2.plot(x, y, z, 'o-')
ax2.set_ylim([0, 4])
ax2.set_zlim([0, 4])
fig_test.draw_without_rendering()
| 7a1df7830f7685a99291d90c5e79bfc5e7876f31 | 10 | test_axes3d.py | 277 | Test that plot results aren't affected by mutating input arrays | 24,166 | 0 | 150 | 208 | 46 | 110,450 | 87 | matplotlib | 14 | lib/mpl_toolkits/mplot3d/tests/test_axes3d.py | Python | 19 | {
"docstring": "\n Test to see if the `z` axis does not get mutated\n after a call to `Axes3D.plot`\n\n test cases came from GH#8990\n ",
"language": "en",
"n_whitespaces": 34,
"n_words": 21,
"vocab_size": 20
} | https://github.com/matplotlib/matplotlib.git |
|
4 | dag_edges | def dag_edges(dag):
# Edges to add between TaskGroup
edges_to_add = set()
# Edges to remove between individual tasks that are replaced by edges_to_add.
edges_to_skip = set()
task_group_map = dag.task_group.get_task_group_dict()
| bb26f96665567325a7fbb810249820e7dac0322a | 9 | views.py | 48 | Make Grid and and Graph view work with task mapping (#21740)
* Expand mapped tasks in the Scheduler
Technically this is done inside
DagRun.task_instance_scheduling_decisions, but the only place that is
currently called is the Scheduler
The way we are getting `upstream_ti` to pass to expand_mapped_task is
all sorts of wrong and will need fixing, I think the interface for that
method is wrong and the mapped task should be responsible for finding
the right upstream TI itself.
* make UI and tree work with mapped tasks
* add graph tooltip and map count
* simplify node label redraw logic
* add utils.js and map_index to /taskInstances
* use TaskInstanceState instead of strings
* move map_index on /taskinstance to separate PR
* check to use Task or Tasks
* remove `no_status` and use TaskInstanceState
Co-authored-by: Ash Berlin-Taylor <[email protected]> | 8,568 | 0 | 47 | 115 | 22 | 45,441 | 29 | airflow | 8 | airflow/www/views.py | Python | 18 | {
"docstring": "\n Create the list of edges needed to construct the Graph view.\n\n A special case is made if a TaskGroup is immediately upstream/downstream of another\n TaskGroup or task. Two dummy nodes named upstream_join_id and downstream_join_id are\n created for the TaskGroup. Instead of drawing an edge onto every task in the TaskGroup,\n all edges are directed onto the dummy nodes. This is to cut down the number of edges on\n the graph.\n\n For example: A DAG with TaskGroups group1 and group2:\n group1: task1, task2, task3\n group2: task4, task5, task6\n\n group2 is downstream of group1:\n group1 >> group2\n\n Edges to add (This avoids having to create edges between every task in group1 and group2):\n task1 >> downstream_join_id\n task2 >> downstream_join_id\n task3 >> downstream_join_id\n downstream_join_id >> upstream_join_id\n upstream_join_id >> task4\n upstream_join_id >> task5\n upstream_join_id >> task6\n ",
"language": "en",
"n_whitespaces": 233,
"n_words": 132,
"vocab_size": 81
} | https://github.com/apache/airflow.git |
|
1 | require_tokenizers | def require_tokenizers(test_case):
return unittest.skipUnless(is_tokenizers_available(), "test requires tokenizers")(test_case)
| 57e6464ac9a31156f1c93e59107323e6ec01309e | 10 | testing_utils.py | 37 | Update all require decorators to use skipUnless when possible (#16999) | 6,797 | 0 | 13 | 20 | 7 | 37,492 | 7 | transformers | 5 | src/transformers/testing_utils.py | Python | 2 | {
"docstring": "\n Decorator marking a test that requires ๐ค Tokenizers. These tests are skipped when ๐ค Tokenizers isn't installed.\n ",
"language": "en",
"n_whitespaces": 24,
"n_words": 17,
"vocab_size": 16
} | https://github.com/huggingface/transformers.git |
|
5 | current_operation | def current_operation(self) -> str | None:
modbus_control = self.device.states[OverkizState.MODBUS_CONTROL_DHW]
if modbus_control and modbus_control.value_as_str == OverkizCommandParam.STOP:
return STATE_OFF
current_mode = self.device.states[OverkizState.MODBUS_DHW_MODE]
if current_mode and current_mode.value_as_str in OVERKIZ_TO_OPERATION_MODE:
return OVERKIZ_TO_OPERATION_MODE[current_mode.value_as_str]
return None
| 1c0f9cf941f77d6e3d299f98d5174f0a2953f236 | 9 | hitachi_dhw.py | 102 | Add Overkiz Hitachi DHW (#81536)
* Port ha-tahome hitachi dhw
* Use int for setting temperature
* Use value as float when possible
* Use device state for current operation
* Update homeassistant/components/overkiz/water_heater_entities/hitachi_dhw.py
Co-authored-by: Quentame <[email protected]>
* Update homeassistant/components/overkiz/water_heater_entities/hitachi_dhw.py
Co-authored-by: Quentame <[email protected]>
* Use ON instead of ECO for standard operation mode
Co-authored-by: Quentame <[email protected]> | 90,732 | 0 | 94 | 65 | 23 | 291,628 | 30 | core | 15 | homeassistant/components/overkiz/water_heater_entities/hitachi_dhw.py | Python | 9 | {
"docstring": "Return current operation ie. eco, electric, performance, ...",
"language": "en",
"n_whitespaces": 7,
"n_words": 8,
"vocab_size": 8
} | https://github.com/home-assistant/core.git |
|
4 | add_provs | def add_provs(self, reader):
fileids = reader.fileids()
for fileid in fileids:
prov, langfile = os.path.split(fileid)
file_name, file_extension = os.path.splitext(langfile)
if file_extension == ".tab":
lang = file_name.split("-")[-1]
if lang in self.provenances.keys():
# We already have another resource for this lang,
# so we need to further specify the lang id:
lang = f"{lang}_{prov}"
self.provenances[lang] = prov
| 8ffd0d8190552d45f8b92e18da3fc41639e5185d | 14 | wordnet.py | 150 | Initialize empty provenance for default English | 7,546 | 0 | 210 | 84 | 41 | 42,453 | 54 | nltk | 16 | nltk/corpus/reader/wordnet.py | Python | 10 | {
"docstring": "Add languages from Multilingual Wordnet to the provenance dictionary",
"language": "en",
"n_whitespaces": 8,
"n_words": 9,
"vocab_size": 9
} | https://github.com/nltk/nltk.git |
|
2 | site_data_dir | def site_data_dir(self) -> str:
# XDG default for $XDG_DATA_DIRS; only first, if multipath is False
path = os.environ.get("XDG_DATA_DIRS", "")
if not path.strip():
path = f"/usr/local/share{os.pathsep}/usr/share"
return self._with_multi_path(path)
| f3166e673fe8d40277b804d35d77dcdb760fc3b3 | 11 | unix.py | 78 | check point progress on only bringing in pip==22.0.4 (#4966)
* vendor in pip==22.0.4
* updating vendor packaging version
* update pipdeptree to fix pipenv graph with new version of pip.
* Vendoring of pip-shims 0.7.0
* Vendoring of requirementslib 1.6.3
* Update pip index safety restrictions patch for pip==22.0.4
* Update patches
* exclude pyptoject.toml from black to see if that helps.
* Move this part of the hash collection back to the top (like prior implementation) because it affects the outcome of this test now in pip 22.0.4 | 3,281 | 0 | 73 | 39 | 24 | 20,229 | 27 | pipenv | 10 | pipenv/patched/notpip/_vendor/platformdirs/unix.py | Python | 10 | {
"docstring": "\n :return: data directories shared by users (if `multipath <platformdirs.api.PlatformDirsABC.multipath>` is\n enabled and ``XDG_DATA_DIR`` is set and a multi path the response is also a multi path separated by the OS\n path separator), e.g. ``/usr/local/share/$appname/$version`` or ``/usr/share/$appname/$version``\n ",
"language": "en",
"n_whitespaces": 67,
"n_words": 36,
"vocab_size": 27
} | https://github.com/pypa/pipenv.git |
|
3 | absorbing_probabilities | def absorbing_probabilities(self):
_, _, R, _ = self.decompose()
N = self.fundamental_matrix()
if R is None or N is None:
return None
return N*R
| 7fe8e027ae1d7f683243c0229b961671a6cbb4c5 | 8 | stochastic_process_types.py | 67 | Improved some documentation in the stats module | 48,618 | 0 | 69 | 41 | 17 | 197,540 | 23 | sympy | 7 | sympy/stats/stochastic_process_types.py | Python | 6 | {
"docstring": "\n Computes the absorbing probabilities, i.e.\n the ij-th entry of the matrix denotes the\n probability of Markov chain being absorbed\n in state j starting from state i.\n ",
"language": "en",
"n_whitespaces": 62,
"n_words": 26,
"vocab_size": 21
} | https://github.com/sympy/sympy.git |
|
2 | doctype_matches | def doctype_matches(text, regex):
m = doctype_lookup_re.search(text)
if m is None:
return False
doctype = m.group(1)
return re.compile(regex, re.I).match(doctype.strip()) is not None
| f3166e673fe8d40277b804d35d77dcdb760fc3b3 | 11 | util.py | 87 | check point progress on only bringing in pip==22.0.4 (#4966)
* vendor in pip==22.0.4
* updating vendor packaging version
* update pipdeptree to fix pipenv graph with new version of pip.
* Vendoring of pip-shims 0.7.0
* Vendoring of requirementslib 1.6.3
* Update pip index safety restrictions patch for pip==22.0.4
* Update patches
* exclude pyptoject.toml from black to see if that helps.
* Move this part of the hash collection back to the top (like prior implementation) because it affects the outcome of this test now in pip 22.0.4 | 3,407 | 0 | 43 | 54 | 17 | 20,520 | 21 | pipenv | 13 | pipenv/patched/notpip/_vendor/pygments/util.py | Python | 6 | {
"docstring": "Check if the doctype matches a regular expression (if present).\n\n Note that this method only checks the first part of a DOCTYPE.\n eg: 'html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"'\n ",
"language": "en",
"n_whitespaces": 38,
"n_words": 29,
"vocab_size": 27
} | https://github.com/pypa/pipenv.git |
|
1 | test_converts_stats_period_start_end | def test_converts_stats_period_start_end(self):
payload = self.make_payload("discover", {"statsPeriodStart": "1w", "statsPeriodEnd": "5d"})
with self.feature("organizations:discover-query"):
response = self.get_success_response(self.org.slug, status_code=201, **payload)
data_export = ExportedData.objects.get(id=response.data["id"])
query_info = data_export.query_info
assert parse_datetime_string(query_info["start"]) == parse_datetime_string(
"2020-05-12T14:00:00"
)
assert parse_datetime_string(query_info["end"]) == parse_datetime_string(
"2020-05-14T14:00:00"
)
assert "statsPeriod" not in query_info
assert "statsPeriodStart" not in query_info
assert "statsPeriodSEnd" not in query_info
| 096b5511e244eecd8799b2a0324655207ce8985e | 12 | test_data_export.py | 205 | ref(tests): Remove `get_valid_response()` (#34822) | 19,764 | 0 | 166 | 114 | 32 | 100,170 | 49 | sentry | 18 | tests/sentry/data_export/endpoints/test_data_export.py | Python | 15 | {
"docstring": "\n Ensures that statsPeriodStart and statsPeriodEnd is converted to start/end.\n ",
"language": "en",
"n_whitespaces": 24,
"n_words": 9,
"vocab_size": 9
} | https://github.com/getsentry/sentry.git |
|
3 | response_add | def response_add(self, request, obj, post_url_continue=None):
# We should allow further modification of the user just added i.e. the
# 'Save' button should behave like the 'Save and continue editing'
# button except in two scenarios:
# * The user has pressed the 'Save and add another' button
# * We are adding a user in a popup
if "_addanother" not in request.POST and IS_POPUP_VAR not in request.POST:
request.POST = request.POST.copy()
request.POST["_continue"] = 1
return super().response_add(request, obj, post_url_continue)
| 9c19aff7c7561e3a82978a272ecdaad40dda5c00 | 11 | admin.py | 102 | Refs #33476 -- Reformatted code with Black. | 50,467 | 0 | 155 | 61 | 52 | 203,593 | 77 | django | 9 | django/contrib/auth/admin.py | Python | 5 | {
"docstring": "\n Determine the HttpResponse for the add_view stage. It mostly defers to\n its superclass implementation but is customized because the User model\n has a slightly different workflow.\n ",
"language": "en",
"n_whitespaces": 55,
"n_words": 26,
"vocab_size": 24
} | https://github.com/django/django.git |
|
1 | test_decimal_conversion_more_digits | def test_decimal_conversion_more_digits():
formatted = format_target_temperature("16.09")
assert formatted == "16.1"
| b0ed42a5a58976ebe82b5bbbb60c499648a1718b | 9 | test_temperature_format.py | 32 | Fix #69952: Daikin AC Temperature jumps after being set (#70326) | 95,665 | 0 | 18 | 15 | 8 | 296,690 | 9 | core | 3 | tests/components/daikin/test_temperature_format.py | Python | 3 | {
"docstring": "Check at most 1 decimal is kept when target temp is a decimal with more than 1 decimal.",
"language": "en",
"n_whitespaces": 17,
"n_words": 18,
"vocab_size": 15
} | https://github.com/home-assistant/core.git |
|
1 | get_task_chosen_response | def get_task_chosen_response(request, task):
result_data = {
'id': task.id,
'name': task.name,
'edit_url': reverse('wagtailadmin_workflows:edit_task', args=[task.id]),
}
return render_modal_workflow(
request, None, None,
None, json_data={'step': 'task_chosen', 'result': result_data}
)
| 60ba39ffb5ec6d760efa6e2ecbff7ede53b12464 | 13 | workflows.py | 103 | replace get_task_result_data helper with more useful one get_task_chosen_response | 15,531 | 0 | 75 | 62 | 23 | 70,608 | 25 | wagtail | 10 | wagtail/admin/views/workflows.py | Python | 10 | {
"docstring": "\n helper function: given a task, return the response indicating that it has been chosen\n ",
"language": "en",
"n_whitespaces": 21,
"n_words": 14,
"vocab_size": 14
} | https://github.com/wagtail/wagtail.git |
|
5 | min_weight_matching | def min_weight_matching(G, maxcardinality=None, weight="weight"):
if maxcardinality not in (True, None):
raise nx.NetworkXError(
"The argument maxcardinality does not make sense "
"in the context of minimum weight matchings."
"It is deprecated and will be removed in v3.0."
)
if len(G.edges) == 0:
return max_weight_matching(G, maxcardinality=True, weight=weight)
G_edges = G.edges(data=weight, default=1)
max_weight = 1 + max(w for _, _, w in G_edges)
InvG = nx.Graph()
edges = ((u, v, max_weight - w) for u, v, w in G_edges)
InvG.add_weighted_edges_from(edges, weight=weight)
return max_weight_matching(InvG, maxcardinality=True, weight=weight)
@not_implemented_for("multigraph")
@not_implemented_for("directed") | c3e1e7f4c6a4edb968494cd4775574ad26f2a96b | @not_implemented_for("multigraph")
@not_implemented_for("directed") | 11 | matching.py | 231 | Fix min_weight_matching to convert edge weights without reciprocal (#5394)
* Add test and then fix code and docs
* Correct and improve docs. Change 1e-6 to 1 to maintain integers.
Include argument in docstring for why adding the 1 doesn't impact the min | 41,940 | 1 | 163 | 137 | 65 | 176,513 | 84 | networkx | 22 | networkx/algorithms/matching.py | Python | 15 | {
"docstring": "Computing a minimum-weight maximal matching of G.\n\n Use the maximum-weight algorithm with edge weights subtracted\n from the maximum weight of all edges.\n\n A matching is a subset of edges in which no node occurs more than once.\n The weight of a matching is the sum of the weights of its edges.\n A maximal matching cannot add more edges and still be a matching.\n The cardinality of a matching is the number of matched edges.\n\n This method replaces the edge weights with 1 plus the maximum edge weight\n minus the original edge weight.\n\n new_weight = (max_weight + 1) - edge_weight\n\n then runs :func:`max_weight_matching` with the new weights.\n The max weight matching with these new weights corresponds\n to the min weight matching using the original weights.\n Adding 1 to the max edge weight keeps all edge weights positive\n and as integers if they started as integers.\n\n You might worry that adding 1 to each weight would make the algorithm\n favor matchings with more edges. But we use the parameter\n `maxcardinality=True` in `max_weight_matching` to ensure that the\n number of edges in the competing matchings are the same and thus\n the optimum does not change due to changes in the number of edges.\n\n Read the documentation of `max_weight_matching` for more information.\n\n Parameters\n ----------\n G : NetworkX graph\n Undirected graph\n\n maxcardinality: bool\n .. deprecated:: 2.8\n The `maxcardinality` parameter will be removed in v3.0.\n It doesn't make sense to set it to False when looking for\n a min weight matching because then we just return no edges.\n\n If maxcardinality is True, compute the maximum-cardinality matching\n with minimum weight among all maximum-cardinality matchings.\n\n weight: string, optional (default='weight')\n Edge data key corresponding to the edge weight.\n If key not found, uses 1 as weight.\n\n Returns\n -------\n matching : set\n A minimal weight matching of the graph.\n\n See Also\n --------\n max_weight_matching\n ",
"language": "en",
"n_whitespaces": 476,
"n_words": 302,
"vocab_size": 163
} | https://github.com/networkx/networkx.git |
8 | _find_agent_ip | def _find_agent_ip(vm_, vmid):
# This functionality is only available on qemu
if not vm_.get("technology") == "qemu":
log.warning("Find agent IP is only available under `qemu`")
return
# Create an empty list of IP-addresses:
ips = []
endpoint = "nodes/{}/qemu/{}/agent/network-get-interfaces".format(vm_["host"], vmid)
interfaces = query("get", endpoint)
# If we get a result from the agent, parse it
for interface in interfaces["result"]:
# Skip interface if hardware-address is 00:00:00:00:00:00 (loopback interface)
if str(interface.get("hardware-address")) == "00:00:00:00:00:00":
continue
# Skip entries without ip-addresses information
if "ip-addresses" not in interface:
continue
for if_addr in interface["ip-addresses"]:
ip_addr = if_addr.get("ip-address")
if ip_addr is not None:
ips.append(str(ip_addr))
if len(ips) > 0:
return preferred_ip(vm_, ips)
raise SaltCloudExecutionFailure
| a5679caf65c7c79cd72841b6e5793b9b693744c9 | 15 | proxmox.py | 231 | Add support for get IP-address from agent | 54,362 | 0 | 254 | 128 | 78 | 216,056 | 106 | salt | 19 | salt/cloud/clouds/proxmox.py | Python | 19 | {
"docstring": "\n If VM is started we would return the IP-addresses that are returned by the qemu agent on the VM.\n ",
"language": "en",
"n_whitespaces": 26,
"n_words": 19,
"vocab_size": 17
} | https://github.com/saltstack/salt.git |
|
1 | test_get_name_error | def test_get_name_error():
test_sid = "S-1-2-3-4"
sid_obj = win32security.ConvertStringSidToSid(test_sid)
with pytest.raises(salt.exceptions.CommandExecutionError) as exc:
salt.utils.win_dacl.get_name(sid_obj)
assert "No mapping between account names" in exc.value.message
| 3bb43882e727b1d36abe2e501759c9c5e9048ecf | 12 | test_get_name.py | 87 | Add tests, migrate some tests to pytest | 54,131 | 0 | 43 | 48 | 20 | 215,737 | 21 | salt | 16 | tests/pytests/unit/utils/win_dacl/test_get_name.py | Python | 6 | {
"docstring": "\n Test get_name with an un mapped SID, should throw a CommandExecutionError\n ",
"language": "en",
"n_whitespaces": 18,
"n_words": 11,
"vocab_size": 11
} | https://github.com/saltstack/salt.git |
|
2 | get_relations | def get_relations(self, cursor, table_name):
cursor.execute(
"PRAGMA foreign_key_list(%s)" % self.connection.ops.quote_name(table_name)
)
return {
column_name: (ref_column_name, ref_table_name)
for _, _, ref_table_name, column_name, ref_column_name, *_ in cursor.fetchall()
}
| 9c19aff7c7561e3a82978a272ecdaad40dda5c00 | 12 | introspection.py | 85 | Refs #33476 -- Reformatted code with Black. | 51,029 | 0 | 93 | 56 | 24 | 205,195 | 25 | django | 13 | django/db/backends/sqlite3/introspection.py | Python | 8 | {
"docstring": "\n Return a dictionary of {column_name: (ref_column_name, ref_table_name)}\n representing all foreign keys in the given table.\n ",
"language": "en",
"n_whitespaces": 37,
"n_words": 15,
"vocab_size": 15
} | https://github.com/django/django.git |
|
3 | average_items_per_ms | def average_items_per_ms(self) -> Optional[float]:
# We want to return None if this is the first background update item
if self.total_item_count == 0:
return None
# Avoid dividing by zero
elif self.avg_duration_ms == 0:
return 0
else:
# Use the exponential moving average so that we can adapt to
# changes in how long the update process takes.
return float(self.avg_item_count) / float(self.avg_duration_ms)
| 26211fec24d8d0a967de33147e148166359ec8cb | 12 | background_updates.py | 78 | Fix a bug in background updates wherein background updates are never run using the default batch size (#12157) | 71,674 | 0 | 158 | 45 | 47 | 247,442 | 61 | synapse | 7 | synapse/storage/background_updates.py | Python | 11 | {
"docstring": "An estimate of how long it takes to do a single update.\n Returns:\n A duration in ms as a float\n ",
"language": "en",
"n_whitespaces": 45,
"n_words": 20,
"vocab_size": 19
} | https://github.com/matrix-org/synapse.git |
|
2 | _pause_and_wait_for_callback | async def _pause_and_wait_for_callback(self):
self._pause_requested = True
await self.async_media_pause()
try: | 26251895295d74fcd2c73e37804c23675c433247 | async def _pause_and_wait_for_callback(self):
"""Send pause and wait for the pause callback to be received."""
self._pause_requested = True
await self.async_media_pause()
try: | 7 | media_player.py | 34 | Use async_timeout in forked_daapd (#78451) | 106,437 | 1 | 37 | 53 | 9 | 307,669 | 9 | core | 4 | homeassistant/components/forked_daapd/media_player.py | Python | 9 | {
"docstring": "Send pause and wait for the pause callback to be received.",
"language": "en",
"n_whitespaces": 10,
"n_words": 11,
"vocab_size": 10
} | https://github.com/home-assistant/core.git |
1 | set_options | def set_options(icon=None, button_color=None, element_size=(None, None), button_element_size=(None, None),
margins=(None, None),
element_padding=(None, None), auto_size_text=None, auto_size_buttons=None, font=None, border_width=None,
slider_border_width=None, slider_relief=None, slider_orientation=None,
autoclose_time=None, message_box_line_width=None,
progress_meter_border_depth=None, progress_meter_style=None,
progress_meter_relief=None, progress_meter_color=None, progress_meter_size=None,
text_justification=None, background_color=None, element_background_color=None,
text_element_background_color=None, input_elements_background_color=None, input_text_color=None,
scrollbar_color=None, text_color=None, element_text_color=None, debug_win_size=(None, None),
window_location=(None, None), error_button_color=(None, None), tooltip_time=None, tooltip_font=None, use_ttk_buttons=None, ttk_theme=None,
suppress_error_popups=None, suppress_raise_key_errors=None, suppress_key_guessing=None,warn_button_key_duplicates=False, enable_treeview_869_patch=None,
enable_mac_notitlebar_patch=None, use_custom_titlebar=None, titlebar_background_color=None, titlebar_text_color=None, titlebar_font=None,
titlebar_icon=None, user_settings_path=None, pysimplegui_settings_path=None, pysimplegui_settings_filename=None, keep_on_top=None, dpi_awareness=None, scaling=None, disable_modal_windows=None, tooltip_offset=(None, None)):
global DEFAULT_ELEMENT_SIZE
global DEFAULT_BUTTON_ELEMENT_SIZE
global DEFAULT_MARGINS # Margins for each LEFT/RIGHT margin is first term
global DEFAULT_ELEMENT_PADDING # Padding between elements (row, col) in pixels
global DEFAULT_AUTOSIZE_TEXT
global DEFAULT_AUTOSIZE_BUTTONS
global DEFAULT_FONT
global DEFAULT_BORDER_WIDTH
global DEFAULT_AUTOCLOSE_TIME
global DEFAULT_BUTTON_COLOR
global MESSAGE_BOX_LINE_WIDTH
global DEFAULT_PROGRESS_BAR_BORDER_WIDTH
global DEFAULT_PROGRESS_BAR_STYLE
global DEFAULT_PROGRESS_BAR_RELIEF
global DEFAULT_PROGRESS_BAR_COLOR
global DEFAULT_PROGRESS_BAR_SIZE
global DEFAULT_TEXT_JUSTIFICATION
global DEFAULT_DEBUG_WINDOW_SIZE
global DEFAULT_SLIDER_BORDER_WIDTH
global DEFAULT_SLIDER_RELIEF
global DEFAULT_SLIDER_ORIENTATION
global DEFAULT_BACKGROUND_COLOR
global DEFAULT_INPUT_ELEMENTS_COLOR
global DEFAULT_ELEMENT_BACKGROUND_COLOR
global DEFAULT_TEXT_ELEMENT_BACKGROUND_COLOR
global DEFAULT_SCROLLBAR_COLOR
global DEFAULT_TEXT_COLOR
global DEFAULT_WINDOW_LOCATION
global DEFAULT_ELEMENT_TEXT_COLOR
global DEFAULT_INPUT_TEXT_COLOR
global DEFAULT_TOOLTIP_TIME
global DEFAULT_ERROR_BUTTON_COLOR
global DEFAULT_TTK_THEME
global USE_TTK_BUTTONS
global TOOLTIP_FONT
global SUPPRESS_ERROR_POPUPS
global SUPPRESS_RAISE_KEY_ERRORS
global SUPPRESS_KEY_GUESSING
global WARN_DUPLICATE_BUTTON_KEY_ERRORS
global ENABLE_TREEVIEW_869_PATCH
global ENABLE_MAC_NOTITLEBAR_PATCH
global USE_CUSTOM_TITLEBAR
global CUSTOM_TITLEBAR_BACKGROUND_COLOR
global CUSTOM_TITLEBAR_TEXT_COLOR
global CUSTOM_TITLEBAR_ICON
global CUSTOM_TITLEBAR_FONT
global DEFAULT_USER_SETTINGS_PATH
global DEFAULT_USER_SETTINGS_PYSIMPLEGUI_PATH
global DEFAULT_USER_SETTINGS_PYSIMPLEGUI_FILENAME
global DEFAULT_KEEP_ON_TOP
global DEFAULT_SCALING
global DEFAULT_MODAL_WINDOWS_ENABLED
global DEFAULT_TOOLTIP_OFFSET
global _pysimplegui_user_settings
# global _my_windows
if icon:
Window._user_defined_icon = icon
# _my_windows._user_defined_icon = icon
if button_color != None:
if button_color == COLOR_SYSTEM_DEFAULT:
DEFAULT_BUTTON_COLOR = (COLOR_SYSTEM_DEFAULT, COLOR_SYSTEM_DEFAULT)
else:
DEFAULT_BUTTON_COLOR = button_color
if element_size != (None, None):
DEFAULT_ELEMENT_SIZE = element_size
if button_element_size != (None, None):
DEFAULT_BUTTON_ELEMENT_SIZE = button_element_size
if margins != (None, None):
DEFAULT_MARGINS = margins
if element_padding != (None, None):
DEFAULT_ELEMENT_PADDING = element_padding
if auto_size_text != None:
DEFAULT_AUTOSIZE_TEXT = auto_size_text
if auto_size_buttons != None:
DEFAULT_AUTOSIZE_BUTTONS = auto_size_buttons
if font != None:
DEFAULT_FONT = font
if border_width != None:
DEFAULT_BORDER_WIDTH = border_width
if autoclose_time != None:
DEFAULT_AUTOCLOSE_TIME = autoclose_time
if message_box_line_width != None:
MESSAGE_BOX_LINE_WIDTH = message_box_line_width
if progress_meter_border_depth != None:
DEFAULT_PROGRESS_BAR_BORDER_WIDTH = progress_meter_border_depth
if progress_meter_style != None:
warnings.warn('You can no longer set a progress bar style. All ttk styles must be the same for the window', UserWarning)
# DEFAULT_PROGRESS_BAR_STYLE = progress_meter_style
if progress_meter_relief != None:
DEFAULT_PROGRESS_BAR_RELIEF = progress_meter_relief
if progress_meter_color != None:
DEFAULT_PROGRESS_BAR_COLOR = progress_meter_color
if progress_meter_size != None:
DEFAULT_PROGRESS_BAR_SIZE = progress_meter_size
if slider_border_width != None:
DEFAULT_SLIDER_BORDER_WIDTH = slider_border_width
if slider_orientation != None:
DEFAULT_SLIDER_ORIENTATION = slider_orientation
if slider_relief != None:
DEFAULT_SLIDER_RELIEF = slider_relief
if text_justification != None:
DEFAULT_TEXT_JUSTIFICATION = text_justification
if background_color != None:
DEFAULT_BACKGROUND_COLOR = background_color
if text_element_background_color != None:
DEFAULT_TEXT_ELEMENT_BACKGROUND_COLOR = text_element_background_color
if input_elements_background_color != None:
DEFAULT_INPUT_ELEMENTS_COLOR = input_elements_background_color
if element_background_color != None:
DEFAULT_ELEMENT_BACKGROUND_COLOR = element_background_color
if window_location != (None, None):
DEFAULT_WINDOW_LOCATION = window_location
if debug_win_size != (None, None):
DEFAULT_DEBUG_WINDOW_SIZE = debug_win_size
if text_color != None:
DEFAULT_TEXT_COLOR = text_color
if scrollbar_color != None:
DEFAULT_SCROLLBAR_COLOR = scrollbar_color
if element_text_color != None:
DEFAULT_ELEMENT_TEXT_COLOR = element_text_color
if input_text_color is not None:
DEFAULT_INPUT_TEXT_COLOR = input_text_color
if tooltip_time is not None:
DEFAULT_TOOLTIP_TIME = tooltip_time
if error_button_color != (None, None):
DEFAULT_ERROR_BUTTON_COLOR = error_button_color
if ttk_theme is not None:
DEFAULT_TTK_THEME = ttk_theme
if use_ttk_buttons is not None:
USE_TTK_BUTTONS = use_ttk_buttons
if tooltip_font is not None:
TOOLTIP_FONT = tooltip_font
if suppress_error_popups is not None:
SUPPRESS_ERROR_POPUPS = suppress_error_popups
if suppress_raise_key_errors is not None:
SUPPRESS_RAISE_KEY_ERRORS = suppress_raise_key_errors
if suppress_key_guessing is not None:
SUPPRESS_KEY_GUESSING = suppress_key_guessing
if warn_button_key_duplicates is not None:
WARN_DUPLICATE_BUTTON_KEY_ERRORS = warn_button_key_duplicates
if enable_treeview_869_patch is not None:
ENABLE_TREEVIEW_869_PATCH = enable_treeview_869_patch
if enable_mac_notitlebar_patch is not None:
ENABLE_MAC_NOTITLEBAR_PATCH = enable_mac_notitlebar_patch
if use_custom_titlebar is not None:
USE_CUSTOM_TITLEBAR = use_custom_titlebar
if titlebar_background_color is not None:
CUSTOM_TITLEBAR_BACKGROUND_COLOR = titlebar_background_color
if titlebar_text_color is not None:
CUSTOM_TITLEBAR_TEXT_COLOR = titlebar_text_color
if titlebar_font is not None:
CUSTOM_TITLEBAR_FONT = titlebar_font
if titlebar_icon is not None:
CUSTOM_TITLEBAR_ICON = titlebar_icon
if user_settings_path is not None:
DEFAULT_USER_SETTINGS_PATH = user_settings_path
if pysimplegui_settings_path is not None:
DEFAULT_USER_SETTINGS_PYSIMPLEGUI_PATH = pysimplegui_settings_path
if pysimplegui_settings_filename is not None:
DEFAULT_USER_SETTINGS_PYSIMPLEGUI_FILENAME = pysimplegui_settings_filename
if pysimplegui_settings_filename is not None or pysimplegui_settings_filename is not None:
_pysimplegui_user_settings = UserSettings(filename=DEFAULT_USER_SETTINGS_PYSIMPLEGUI_FILENAME,
path=DEFAULT_USER_SETTINGS_PYSIMPLEGUI_PATH)
if keep_on_top is not None:
DEFAULT_KEEP_ON_TOP = keep_on_top
if dpi_awareness is True:
if running_windows():
if platform.release() == "7":
ctypes.windll.user32.SetProcessDPIAware()
elif platform.release() == "8" or platform.release() == "10":
ctypes.windll.shcore.SetProcessDpiAwareness(1)
if scaling is not None:
DEFAULT_SCALING = scaling
if disable_modal_windows is not None:
DEFAULT_MODAL_WINDOWS_ENABLED = not disable_modal_windows
if tooltip_offset != (None, None):
DEFAULT_TOOLTIP_OFFSET = tooltip_offset
return True
# ----------------------------------------------------------------- #
# .########.##.....##.########.##.....##.########..######.
# ....##....##.....##.##.......###...###.##.......##....##
# ....##....##.....##.##.......####.####.##.......##......
# ....##....#########.######...##.###.##.######....######.
# ....##....##.....##.##.......##.....##.##.............##
# ....##....##.....##.##.......##.....##.##.......##....##
# ....##....##.....##.########.##.....##.########..######.
# ----------------------------------------------------------------- #
# The official Theme code
#################### ChangeLookAndFeel #######################
# Predefined settings that will change the colors and styles #
# of the elements. #
##############################################################
LOOK_AND_FEEL_TABLE = {
"SystemDefault": {"BACKGROUND": COLOR_SYSTEM_DEFAULT, "TEXT": COLOR_SYSTEM_DEFAULT, "INPUT": COLOR_SYSTEM_DEFAULT, "TEXT_INPUT": COLOR_SYSTEM_DEFAULT,
"SCROLL": COLOR_SYSTEM_DEFAULT, "BUTTON": OFFICIAL_PYSIMPLEGUI_BUTTON_COLOR, "PROGRESS": COLOR_SYSTEM_DEFAULT, "BORDER": 1,
"SLIDER_DEPTH": 1, "PROGRESS_DEPTH": 0, },
"SystemDefaultForReal": {"BACKGROUND": COLOR_SYSTEM_DEFAULT, "TEXT": COLOR_SYSTEM_DEFAULT, "INPUT": COLOR_SYSTEM_DEFAULT,
"TEXT_INPUT": COLOR_SYSTEM_DEFAULT, "SCROLL": COLOR_SYSTEM_DEFAULT, "BUTTON": COLOR_SYSTEM_DEFAULT,
"PROGRESS": COLOR_SYSTEM_DEFAULT, "BORDER": 1, "SLIDER_DEPTH": 1, "PROGRESS_DEPTH": 0, },
"SystemDefault1": {"BACKGROUND": COLOR_SYSTEM_DEFAULT, "TEXT": COLOR_SYSTEM_DEFAULT, "INPUT": COLOR_SYSTEM_DEFAULT, "TEXT_INPUT": COLOR_SYSTEM_DEFAULT,
"SCROLL": COLOR_SYSTEM_DEFAULT, "BUTTON": COLOR_SYSTEM_DEFAULT, "PROGRESS": COLOR_SYSTEM_DEFAULT, "BORDER": 1, "SLIDER_DEPTH": 1,
"PROGRESS_DEPTH": 0, },
"Material1": {"BACKGROUND": "#E3F2FD", "TEXT": "#000000", "INPUT": "#86A8FF", "TEXT_INPUT": "#000000", "SCROLL": "#86A8FF",
"BUTTON": ("#FFFFFF", "#5079D3"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 0, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"ACCENT1": "#FF0266", "ACCENT2": "#FF5C93", "ACCENT3": "#C5003C", },
"Material2": {"BACKGROUND": "#FAFAFA", "TEXT": "#000000", "INPUT": "#004EA1", "TEXT_INPUT": "#FFFFFF", "SCROLL": "#5EA7FF",
"BUTTON": ("#FFFFFF", "#0079D3"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 0, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"ACCENT1": "#FF0266", "ACCENT2": "#FF5C93", "ACCENT3": "#C5003C", },
"Reddit": {"BACKGROUND": "#ffffff", "TEXT": "#1a1a1b", "INPUT": "#dae0e6", "TEXT_INPUT": "#222222", "SCROLL": "#a5a4a4", "BUTTON": ("#FFFFFF", "#0079d3"),
"PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, "ACCENT1": "#ff5414", "ACCENT2": "#33a8ff",
"ACCENT3": "#dbf0ff", },
"Topanga": {"BACKGROUND": "#282923", "TEXT": "#E7DB74", "INPUT": "#393a32", "TEXT_INPUT": "#E7C855", "SCROLL": "#E7C855", "BUTTON": ("#E7C855", "#284B5A"),
"PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, "ACCENT1": "#c15226", "ACCENT2": "#7a4d5f",
"ACCENT3": "#889743", },
"GreenTan": {"BACKGROUND": "#9FB8AD", "TEXT": '#000000', "INPUT": "#F7F3EC", "TEXT_INPUT": "#000000", "SCROLL": "#F7F3EC", "BUTTON": ("#FFFFFF", "#475841"),
"PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, },
"Dark": {"BACKGROUND": "#404040", "TEXT": "#FFFFFF", "INPUT": "#4D4D4D", "TEXT_INPUT": "#FFFFFF", "SCROLL": "#707070", "BUTTON": ("#FFFFFF", "#004F00"),
"PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, },
"LightGreen": {"BACKGROUND": "#B7CECE", "TEXT": "#000000", "INPUT": "#FDFFF7", "TEXT_INPUT": "#000000", "SCROLL": "#FDFFF7",
"BUTTON": ("#FFFFFF", "#658268"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "ACCENT1": "#76506d",
"ACCENT2": "#5148f1", "ACCENT3": "#0a1c84", "PROGRESS_DEPTH": 0, },
"Dark2": {"BACKGROUND": "#404040", "TEXT": "#FFFFFF", "INPUT": "#FFFFFF", "TEXT_INPUT": "#000000", "SCROLL": "#707070", "BUTTON": ("#FFFFFF", "#004F00"),
"PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, },
"Black": {"BACKGROUND": "#000000", "TEXT": "#FFFFFF", "INPUT": "#4D4D4D", "TEXT_INPUT": "#FFFFFF", "SCROLL": "#707070", "BUTTON": ("#000000", "#FFFFFF"),
"PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, },
"Tan": {"BACKGROUND": "#fdf6e3", "TEXT": "#268bd1", "INPUT": "#eee8d5", "TEXT_INPUT": "#6c71c3", "SCROLL": "#eee8d5", "BUTTON": ("#FFFFFF", "#063542"),
"PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, },
"TanBlue": {"BACKGROUND": "#e5dece", "TEXT": "#063289", "INPUT": "#f9f8f4", "TEXT_INPUT": "#242834", "SCROLL": "#eee8d5", "BUTTON": ("#FFFFFF", "#063289"),
"PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, },
"DarkTanBlue": {"BACKGROUND": "#242834", "TEXT": "#dfe6f8", "INPUT": "#97755c", "TEXT_INPUT": "#FFFFFF", "SCROLL": "#a9afbb",
"BUTTON": ("#FFFFFF", "#063289"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, },
"DarkAmber": {"BACKGROUND": "#2c2825", "TEXT": "#fdcb52", "INPUT": "#705e52", "TEXT_INPUT": "#fdcb52", "SCROLL": "#705e52",
"BUTTON": ("#000000", "#fdcb52"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, },
"DarkBlue": {"BACKGROUND": "#1a2835", "TEXT": "#d1ecff", "INPUT": "#335267", "TEXT_INPUT": "#acc2d0", "SCROLL": "#1b6497", "BUTTON": ("#000000", "#fafaf8"),
"PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, },
"Reds": {"BACKGROUND": "#280001", "TEXT": "#FFFFFF", "INPUT": "#d8d584", "TEXT_INPUT": "#000000", "SCROLL": "#763e00", "BUTTON": ("#000000", "#daad28"),
"PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, },
"Green": {"BACKGROUND": "#82a459", "TEXT": "#000000", "INPUT": "#d8d584", "TEXT_INPUT": "#000000", "SCROLL": "#e3ecf3", "BUTTON": ("#FFFFFF", "#517239"),
"PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, },
"BluePurple": {"BACKGROUND": "#A5CADD", "TEXT": "#6E266E", "INPUT": "#E0F5FF", "TEXT_INPUT": "#000000", "SCROLL": "#E0F5FF",
"BUTTON": ("#FFFFFF", "#303952"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, },
"Purple": {"BACKGROUND": "#B0AAC2", "TEXT": "#000000", "INPUT": "#F2EFE8", "SCROLL": "#F2EFE8", "TEXT_INPUT": "#000000", "BUTTON": ("#000000", "#C2D4D8"),
"PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, },
"BlueMono": {"BACKGROUND": "#AAB6D3", "TEXT": "#000000", "INPUT": "#F1F4FC", "SCROLL": "#F1F4FC", "TEXT_INPUT": "#000000", "BUTTON": ("#FFFFFF", "#7186C7"),
"PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, },
"GreenMono": {"BACKGROUND": "#A8C1B4", "TEXT": "#000000", "INPUT": "#DDE0DE", "SCROLL": "#E3E3E3", "TEXT_INPUT": "#000000",
"BUTTON": ("#FFFFFF", "#6D9F85"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, },
"BrownBlue": {"BACKGROUND": "#64778d", "TEXT": "#FFFFFF", "INPUT": "#f0f3f7", "SCROLL": "#A6B2BE", "TEXT_INPUT": "#000000",
"BUTTON": ("#FFFFFF", "#283b5b"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, },
"BrightColors": {"BACKGROUND": "#b4ffb4", "TEXT": "#000000", "INPUT": "#ffff64", "SCROLL": "#ffb482", "TEXT_INPUT": "#000000",
"BUTTON": ("#000000", "#ffa0dc"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, },
"NeutralBlue": {"BACKGROUND": "#92aa9d", "TEXT": "#000000", "INPUT": "#fcfff6", "SCROLL": "#fcfff6", "TEXT_INPUT": "#000000",
"BUTTON": ("#000000", "#d0dbbd"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, },
"Kayak": {"BACKGROUND": "#a7ad7f", "TEXT": "#000000", "INPUT": "#e6d3a8", "SCROLL": "#e6d3a8", "TEXT_INPUT": "#000000", "BUTTON": ("#FFFFFF", "#5d907d"),
"PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, },
"SandyBeach": {"BACKGROUND": "#efeccb", "TEXT": "#012f2f", "INPUT": "#e6d3a8", "SCROLL": "#e6d3a8", "TEXT_INPUT": "#012f2f",
"BUTTON": ("#FFFFFF", "#046380"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, },
"TealMono": {"BACKGROUND": "#a8cfdd", "TEXT": "#000000", "INPUT": "#dfedf2", "SCROLL": "#dfedf2", "TEXT_INPUT": "#000000", "BUTTON": ("#FFFFFF", "#183440"),
"PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, },
"Default": {"BACKGROUND": COLOR_SYSTEM_DEFAULT, "TEXT": COLOR_SYSTEM_DEFAULT, "INPUT": COLOR_SYSTEM_DEFAULT, "TEXT_INPUT": COLOR_SYSTEM_DEFAULT,
"SCROLL": COLOR_SYSTEM_DEFAULT, "BUTTON": OFFICIAL_PYSIMPLEGUI_BUTTON_COLOR, "PROGRESS": COLOR_SYSTEM_DEFAULT, "BORDER": 1, "SLIDER_DEPTH": 1,
"PROGRESS_DEPTH": 0, },
"Default1": {"BACKGROUND": COLOR_SYSTEM_DEFAULT, "TEXT": COLOR_SYSTEM_DEFAULT, "INPUT": COLOR_SYSTEM_DEFAULT, "TEXT_INPUT": COLOR_SYSTEM_DEFAULT,
"SCROLL": COLOR_SYSTEM_DEFAULT, "BUTTON": COLOR_SYSTEM_DEFAULT, "PROGRESS": COLOR_SYSTEM_DEFAULT, "BORDER": 1, "SLIDER_DEPTH": 1,
"PROGRESS_DEPTH": 0, },
"DefaultNoMoreNagging": {"BACKGROUND": COLOR_SYSTEM_DEFAULT, "TEXT": COLOR_SYSTEM_DEFAULT, "INPUT": COLOR_SYSTEM_DEFAULT,
"TEXT_INPUT": COLOR_SYSTEM_DEFAULT, "SCROLL": COLOR_SYSTEM_DEFAULT, "BUTTON": OFFICIAL_PYSIMPLEGUI_BUTTON_COLOR,
"PROGRESS": COLOR_SYSTEM_DEFAULT, "BORDER": 1, "SLIDER_DEPTH": 1, "PROGRESS_DEPTH": 0, },
"GrayGrayGray": {"BACKGROUND": COLOR_SYSTEM_DEFAULT, "TEXT": COLOR_SYSTEM_DEFAULT, "INPUT": COLOR_SYSTEM_DEFAULT, "TEXT_INPUT": COLOR_SYSTEM_DEFAULT,
"SCROLL": COLOR_SYSTEM_DEFAULT, "BUTTON": COLOR_SYSTEM_DEFAULT, "PROGRESS": COLOR_SYSTEM_DEFAULT, "BORDER": 1, "SLIDER_DEPTH": 1,
"PROGRESS_DEPTH": 0, },
"LightBlue": {"BACKGROUND": "#E3F2FD", "TEXT": "#000000", "INPUT": "#86A8FF", "TEXT_INPUT": "#000000", "SCROLL": "#86A8FF",
"BUTTON": ("#FFFFFF", "#5079D3"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 0, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"ACCENT1": "#FF0266", "ACCENT2": "#FF5C93", "ACCENT3": "#C5003C", },
"LightGrey": {"BACKGROUND": "#FAFAFA", "TEXT": "#000000", "INPUT": "#004EA1", "TEXT_INPUT": "#FFFFFF", "SCROLL": "#5EA7FF",
"BUTTON": ("#FFFFFF", "#0079D3"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 0, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"ACCENT1": "#FF0266", "ACCENT2": "#FF5C93", "ACCENT3": "#C5003C", },
"LightGrey1": {"BACKGROUND": "#ffffff", "TEXT": "#1a1a1b", "INPUT": "#dae0e6", "TEXT_INPUT": "#222222", "SCROLL": "#a5a4a4",
"BUTTON": ("#FFFFFF", "#0079d3"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"ACCENT1": "#ff5414", "ACCENT2": "#33a8ff", "ACCENT3": "#dbf0ff", },
"DarkBrown": {"BACKGROUND": "#282923", "TEXT": "#E7DB74", "INPUT": "#393a32", "TEXT_INPUT": "#E7C855", "SCROLL": "#E7C855",
"BUTTON": ("#E7C855", "#284B5A"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"ACCENT1": "#c15226", "ACCENT2": "#7a4d5f", "ACCENT3": "#889743", },
"LightGreen1": {"BACKGROUND": "#9FB8AD", "TEXT": "#000000", "INPUT": "#F7F3EC", "TEXT_INPUT": "#000000", "SCROLL": "#F7F3EC",
"BUTTON": ("#FFFFFF", "#475841"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, },
"DarkGrey": {"BACKGROUND": "#404040", "TEXT": "#FFFFFF", "INPUT": "#4D4D4D", "TEXT_INPUT": "#FFFFFF", "SCROLL": "#707070", "BUTTON": ("#FFFFFF", "#004F00"),
"PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, },
"LightGreen2": {"BACKGROUND": "#B7CECE", "TEXT": "#000000", "INPUT": "#FDFFF7", "TEXT_INPUT": "#000000", "SCROLL": "#FDFFF7",
"BUTTON": ("#FFFFFF", "#658268"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "ACCENT1": "#76506d",
"ACCENT2": "#5148f1", "ACCENT3": "#0a1c84", "PROGRESS_DEPTH": 0, },
"DarkGrey1": {"BACKGROUND": "#404040", "TEXT": "#FFFFFF", "INPUT": "#FFFFFF", "TEXT_INPUT": "#000000", "SCROLL": "#707070",
"BUTTON": ("#FFFFFF", "#004F00"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, },
"DarkBlack": {"BACKGROUND": "#000000", "TEXT": "#FFFFFF", "INPUT": "#4D4D4D", "TEXT_INPUT": "#FFFFFF", "SCROLL": "#707070",
"BUTTON": ("#000000", "#FFFFFF"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, },
"LightBrown": {"BACKGROUND": "#fdf6e3", "TEXT": "#268bd1", "INPUT": "#eee8d5", "TEXT_INPUT": "#6c71c3", "SCROLL": "#eee8d5",
"BUTTON": ("#FFFFFF", "#063542"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, },
"LightBrown1": {"BACKGROUND": "#e5dece", "TEXT": "#063289", "INPUT": "#f9f8f4", "TEXT_INPUT": "#242834", "SCROLL": "#eee8d5",
"BUTTON": ("#FFFFFF", "#063289"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, },
"DarkBlue1": {"BACKGROUND": "#242834", "TEXT": "#dfe6f8", "INPUT": "#97755c", "TEXT_INPUT": "#FFFFFF", "SCROLL": "#a9afbb",
"BUTTON": ("#FFFFFF", "#063289"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, },
"DarkBrown1": {"BACKGROUND": "#2c2825", "TEXT": "#fdcb52", "INPUT": "#705e52", "TEXT_INPUT": "#fdcb52", "SCROLL": "#705e52",
"BUTTON": ("#000000", "#fdcb52"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, },
"DarkBlue2": {"BACKGROUND": "#1a2835", "TEXT": "#d1ecff", "INPUT": "#335267", "TEXT_INPUT": "#acc2d0", "SCROLL": "#1b6497",
"BUTTON": ("#000000", "#fafaf8"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, },
"DarkBrown2": {"BACKGROUND": "#280001", "TEXT": "#FFFFFF", "INPUT": "#d8d584", "TEXT_INPUT": "#000000", "SCROLL": "#763e00",
"BUTTON": ("#000000", "#daad28"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, },
"DarkGreen": {"BACKGROUND": "#82a459", "TEXT": "#000000", "INPUT": "#d8d584", "TEXT_INPUT": "#000000", "SCROLL": "#e3ecf3",
"BUTTON": ("#FFFFFF", "#517239"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, },
"LightBlue1": {"BACKGROUND": "#A5CADD", "TEXT": "#6E266E", "INPUT": "#E0F5FF", "TEXT_INPUT": "#000000", "SCROLL": "#E0F5FF",
"BUTTON": ("#FFFFFF", "#303952"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, },
"LightPurple": {"BACKGROUND": "#B0AAC2", "TEXT": "#000000", "INPUT": "#F2EFE8", "SCROLL": "#F2EFE8", "TEXT_INPUT": "#000000",
"BUTTON": ("#000000", "#C2D4D8"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, },
"LightBlue2": {"BACKGROUND": "#AAB6D3", "TEXT": "#000000", "INPUT": "#F1F4FC", "SCROLL": "#F1F4FC", "TEXT_INPUT": "#000000",
"BUTTON": ("#FFFFFF", "#7186C7"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, },
"LightGreen3": {"BACKGROUND": "#A8C1B4", "TEXT": "#000000", "INPUT": "#DDE0DE", "SCROLL": "#E3E3E3", "TEXT_INPUT": "#000000",
"BUTTON": ("#FFFFFF", "#6D9F85"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, },
"DarkBlue3": {"BACKGROUND": "#64778d", "TEXT": "#FFFFFF", "INPUT": "#f0f3f7", "SCROLL": "#A6B2BE", "TEXT_INPUT": "#000000",
"BUTTON": ("#FFFFFF", "#283b5b"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, },
"LightGreen4": {"BACKGROUND": "#b4ffb4", "TEXT": "#000000", "INPUT": "#ffff64", "SCROLL": "#ffb482", "TEXT_INPUT": "#000000",
"BUTTON": ("#000000", "#ffa0dc"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, },
"LightGreen5": {"BACKGROUND": "#92aa9d", "TEXT": "#000000", "INPUT": "#fcfff6", "SCROLL": "#fcfff6", "TEXT_INPUT": "#000000",
"BUTTON": ("#000000", "#d0dbbd"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, },
"LightBrown2": {"BACKGROUND": "#a7ad7f", "TEXT": "#000000", "INPUT": "#e6d3a8", "SCROLL": "#e6d3a8", "TEXT_INPUT": "#000000",
"BUTTON": ("#FFFFFF", "#5d907d"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, },
"LightBrown3": {"BACKGROUND": "#efeccb", "TEXT": "#012f2f", "INPUT": "#e6d3a8", "SCROLL": "#e6d3a8", "TEXT_INPUT": "#012f2f",
"BUTTON": ("#FFFFFF", "#046380"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, },
"LightBlue3": {"BACKGROUND": "#a8cfdd", "TEXT": "#000000", "INPUT": "#dfedf2", "SCROLL": "#dfedf2", "TEXT_INPUT": "#000000",
"BUTTON": ("#FFFFFF", "#183440"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, },
"LightBrown4": {"BACKGROUND": "#d7c79e", "TEXT": "#a35638", "INPUT": "#9dab86", "TEXT_INPUT": "#000000", "SCROLL": "#a35638",
"BUTTON": ("#FFFFFF", "#a35638"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#a35638", "#9dab86", "#e08f62", "#d7c79e"], },
"DarkTeal": {"BACKGROUND": "#003f5c", "TEXT": "#fb5b5a", "INPUT": "#bc4873", "TEXT_INPUT": "#FFFFFF", "SCROLL": "#bc4873", "BUTTON": ("#FFFFFF", "#fb5b5a"),
"PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#003f5c", "#472b62", "#bc4873", "#fb5b5a"], },
"DarkPurple": {"BACKGROUND": "#472b62", "TEXT": "#fb5b5a", "INPUT": "#bc4873", "TEXT_INPUT": "#FFFFFF", "SCROLL": "#bc4873",
"BUTTON": ("#FFFFFF", "#472b62"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#003f5c", "#472b62", "#bc4873", "#fb5b5a"], },
"LightGreen6": {"BACKGROUND": "#eafbea", "TEXT": "#1f6650", "INPUT": "#6f9a8d", "TEXT_INPUT": "#FFFFFF", "SCROLL": "#1f6650",
"BUTTON": ("#FFFFFF", "#1f6650"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#1f6650", "#6f9a8d", "#ea5e5e", "#eafbea"], },
"DarkGrey2": {"BACKGROUND": "#2b2b28", "TEXT": "#f8f8f8", "INPUT": "#f1d6ab", "TEXT_INPUT": "#000000", "SCROLL": "#f1d6ab",
"BUTTON": ("#2b2b28", "#e3b04b"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#2b2b28", "#e3b04b", "#f1d6ab", "#f8f8f8"], },
"LightBrown6": {"BACKGROUND": "#f9b282", "TEXT": "#8f4426", "INPUT": "#de6b35", "TEXT_INPUT": "#FFFFFF", "SCROLL": "#8f4426",
"BUTTON": ("#FFFFFF", "#8f4426"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#8f4426", "#de6b35", "#64ccda", "#f9b282"], },
"DarkTeal1": {"BACKGROUND": "#396362", "TEXT": "#ffe7d1", "INPUT": "#f6c89f", "TEXT_INPUT": "#000000", "SCROLL": "#f6c89f",
"BUTTON": ("#ffe7d1", "#4b8e8d"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#396362", "#4b8e8d", "#f6c89f", "#ffe7d1"], },
"LightBrown7": {"BACKGROUND": "#f6c89f", "TEXT": "#396362", "INPUT": "#4b8e8d", "TEXT_INPUT": "#FFFFFF", "SCROLL": "#396362",
"BUTTON": ("#FFFFFF", "#396362"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#396362", "#4b8e8d", "#f6c89f", "#ffe7d1"], },
"DarkPurple1": {"BACKGROUND": "#0c093c", "TEXT": "#fad6d6", "INPUT": "#eea5f6", "TEXT_INPUT": "#000000", "SCROLL": "#eea5f6",
"BUTTON": ("#FFFFFF", "#df42d1"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#0c093c", "#df42d1", "#eea5f6", "#fad6d6"], },
"DarkGrey3": {"BACKGROUND": "#211717", "TEXT": "#dfddc7", "INPUT": "#f58b54", "TEXT_INPUT": "#000000", "SCROLL": "#f58b54",
"BUTTON": ("#dfddc7", "#a34a28"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#211717", "#a34a28", "#f58b54", "#dfddc7"], },
"LightBrown8": {"BACKGROUND": "#dfddc7", "TEXT": "#211717", "INPUT": "#a34a28", "TEXT_INPUT": "#dfddc7", "SCROLL": "#211717",
"BUTTON": ("#dfddc7", "#a34a28"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#211717", "#a34a28", "#f58b54", "#dfddc7"], },
"DarkBlue4": {"BACKGROUND": "#494ca2", "TEXT": "#e3e7f1", "INPUT": "#c6cbef", "TEXT_INPUT": "#000000", "SCROLL": "#c6cbef",
"BUTTON": ("#FFFFFF", "#8186d5"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#494ca2", "#8186d5", "#c6cbef", "#e3e7f1"], },
"LightBlue4": {"BACKGROUND": "#5c94bd", "TEXT": "#470938", "INPUT": "#1a3e59", "TEXT_INPUT": "#FFFFFF", "SCROLL": "#470938",
"BUTTON": ("#FFFFFF", "#470938"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#470938", "#1a3e59", "#5c94bd", "#f2d6eb"], },
"DarkTeal2": {"BACKGROUND": "#394a6d", "TEXT": "#c0ffb3", "INPUT": "#52de97", "TEXT_INPUT": "#000000", "SCROLL": "#52de97",
"BUTTON": ("#c0ffb3", "#394a6d"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#394a6d", "#3c9d9b", "#52de97", "#c0ffb3"], },
"DarkTeal3": {"BACKGROUND": "#3c9d9b", "TEXT": "#c0ffb3", "INPUT": "#52de97", "TEXT_INPUT": "#000000", "SCROLL": "#52de97",
"BUTTON": ("#c0ffb3", "#394a6d"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#394a6d", "#3c9d9b", "#52de97", "#c0ffb3"], },
"DarkPurple5": {"BACKGROUND": "#730068", "TEXT": "#f6f078", "INPUT": "#01d28e", "TEXT_INPUT": "#000000", "SCROLL": "#01d28e",
"BUTTON": ("#f6f078", "#730068"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#730068", "#434982", "#01d28e", "#f6f078"], },
"DarkPurple2": {"BACKGROUND": "#202060", "TEXT": "#b030b0", "INPUT": "#602080", "TEXT_INPUT": "#FFFFFF", "SCROLL": "#602080",
"BUTTON": ("#FFFFFF", "#202040"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#202040", "#202060", "#602080", "#b030b0"], },
"DarkBlue5": {"BACKGROUND": "#000272", "TEXT": "#ff6363", "INPUT": "#a32f80", "TEXT_INPUT": "#FFFFFF", "SCROLL": "#a32f80",
"BUTTON": ("#FFFFFF", "#341677"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#000272", "#341677", "#a32f80", "#ff6363"], },
"LightGrey2": {"BACKGROUND": "#f6f6f6", "TEXT": "#420000", "INPUT": "#d4d7dd", "TEXT_INPUT": "#420000", "SCROLL": "#420000",
"BUTTON": ("#420000", "#d4d7dd"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#420000", "#d4d7dd", "#eae9e9", "#f6f6f6"], },
"LightGrey3": {"BACKGROUND": "#eae9e9", "TEXT": "#420000", "INPUT": "#d4d7dd", "TEXT_INPUT": "#420000", "SCROLL": "#420000",
"BUTTON": ("#420000", "#d4d7dd"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#420000", "#d4d7dd", "#eae9e9", "#f6f6f6"], },
"DarkBlue6": {"BACKGROUND": "#01024e", "TEXT": "#ff6464", "INPUT": "#8b4367", "TEXT_INPUT": "#FFFFFF", "SCROLL": "#8b4367",
"BUTTON": ("#FFFFFF", "#543864"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#01024e", "#543864", "#8b4367", "#ff6464"], },
"DarkBlue7": {"BACKGROUND": "#241663", "TEXT": "#eae7af", "INPUT": "#a72693", "TEXT_INPUT": "#eae7af", "SCROLL": "#a72693",
"BUTTON": ("#eae7af", "#160f30"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#160f30", "#241663", "#a72693", "#eae7af"], },
"LightBrown9": {"BACKGROUND": "#f6d365", "TEXT": "#3a1f5d", "INPUT": "#c83660", "TEXT_INPUT": "#f6d365", "SCROLL": "#3a1f5d",
"BUTTON": ("#f6d365", "#c83660"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#3a1f5d", "#c83660", "#e15249", "#f6d365"], },
"DarkPurple3": {"BACKGROUND": "#6e2142", "TEXT": "#ffd692", "INPUT": "#e16363", "TEXT_INPUT": "#ffd692", "SCROLL": "#e16363",
"BUTTON": ("#ffd692", "#943855"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#6e2142", "#943855", "#e16363", "#ffd692"], },
"LightBrown10": {"BACKGROUND": "#ffd692", "TEXT": "#6e2142", "INPUT": "#943855", "TEXT_INPUT": "#FFFFFF", "SCROLL": "#6e2142",
"BUTTON": ("#FFFFFF", "#6e2142"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#6e2142", "#943855", "#e16363", "#ffd692"], },
"DarkPurple4": {"BACKGROUND": "#200f21", "TEXT": "#f638dc", "INPUT": "#5a3d5c", "TEXT_INPUT": "#FFFFFF", "SCROLL": "#5a3d5c",
"BUTTON": ("#FFFFFF", "#382039"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#200f21", "#382039", "#5a3d5c", "#f638dc"], },
"LightBlue5": {"BACKGROUND": "#b2fcff", "TEXT": "#3e64ff", "INPUT": "#5edfff", "TEXT_INPUT": "#000000", "SCROLL": "#3e64ff",
"BUTTON": ("#FFFFFF", "#3e64ff"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#3e64ff", "#5edfff", "#b2fcff", "#ecfcff"], },
"DarkTeal4": {"BACKGROUND": "#464159", "TEXT": "#c7f0db", "INPUT": "#8bbabb", "TEXT_INPUT": "#000000", "SCROLL": "#8bbabb",
"BUTTON": ("#FFFFFF", "#6c7b95"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#464159", "#6c7b95", "#8bbabb", "#c7f0db"], },
"LightTeal": {"BACKGROUND": "#c7f0db", "TEXT": "#464159", "INPUT": "#6c7b95", "TEXT_INPUT": "#FFFFFF", "SCROLL": "#464159",
"BUTTON": ("#FFFFFF", "#464159"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#464159", "#6c7b95", "#8bbabb", "#c7f0db"], },
"DarkTeal5": {"BACKGROUND": "#8bbabb", "TEXT": "#464159", "INPUT": "#6c7b95", "TEXT_INPUT": "#FFFFFF", "SCROLL": "#464159",
"BUTTON": ("#c7f0db", "#6c7b95"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#464159", "#6c7b95", "#8bbabb", "#c7f0db"], },
"LightGrey4": {"BACKGROUND": "#faf5ef", "TEXT": "#672f2f", "INPUT": "#99b19c", "TEXT_INPUT": "#672f2f", "SCROLL": "#672f2f",
"BUTTON": ("#672f2f", "#99b19c"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#672f2f", "#99b19c", "#d7d1c9", "#faf5ef"], },
"LightGreen7": {"BACKGROUND": "#99b19c", "TEXT": "#faf5ef", "INPUT": "#d7d1c9", "TEXT_INPUT": "#000000", "SCROLL": "#d7d1c9",
"BUTTON": ("#FFFFFF", "#99b19c"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#672f2f", "#99b19c", "#d7d1c9", "#faf5ef"], },
"LightGrey5": {"BACKGROUND": "#d7d1c9", "TEXT": "#672f2f", "INPUT": "#99b19c", "TEXT_INPUT": "#672f2f", "SCROLL": "#672f2f",
"BUTTON": ("#FFFFFF", "#672f2f"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#672f2f", "#99b19c", "#d7d1c9", "#faf5ef"], },
"DarkBrown3": {"BACKGROUND": "#a0855b", "TEXT": "#f9f6f2", "INPUT": "#f1d6ab", "TEXT_INPUT": "#000000", "SCROLL": "#f1d6ab",
"BUTTON": ("#FFFFFF", "#38470b"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#38470b", "#a0855b", "#f1d6ab", "#f9f6f2"], },
"LightBrown11": {"BACKGROUND": "#f1d6ab", "TEXT": "#38470b", "INPUT": "#a0855b", "TEXT_INPUT": "#FFFFFF", "SCROLL": "#38470b",
"BUTTON": ("#f9f6f2", "#a0855b"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#38470b", "#a0855b", "#f1d6ab", "#f9f6f2"], },
"DarkRed": {"BACKGROUND": "#83142c", "TEXT": "#f9d276", "INPUT": "#ad1d45", "TEXT_INPUT": "#FFFFFF", "SCROLL": "#ad1d45", "BUTTON": ("#f9d276", "#ad1d45"),
"PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#44000d", "#83142c", "#ad1d45", "#f9d276"], },
"DarkTeal6": {"BACKGROUND": "#204969", "TEXT": "#fff7f7", "INPUT": "#dadada", "TEXT_INPUT": "#000000", "SCROLL": "#dadada",
"BUTTON": ("#000000", "#fff7f7"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#204969", "#08ffc8", "#dadada", "#fff7f7"], },
"DarkBrown4": {"BACKGROUND": "#252525", "TEXT": "#ff0000", "INPUT": "#af0404", "TEXT_INPUT": "#FFFFFF", "SCROLL": "#af0404",
"BUTTON": ("#FFFFFF", "#252525"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#252525", "#414141", "#af0404", "#ff0000"], },
"LightYellow": {"BACKGROUND": "#f4ff61", "TEXT": "#27aa80", "INPUT": "#32ff6a", "TEXT_INPUT": "#000000", "SCROLL": "#27aa80",
"BUTTON": ("#f4ff61", "#27aa80"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#27aa80", "#32ff6a", "#a8ff3e", "#f4ff61"], },
"DarkGreen1": {"BACKGROUND": "#2b580c", "TEXT": "#fdef96", "INPUT": "#f7b71d", "TEXT_INPUT": "#000000", "SCROLL": "#f7b71d",
"BUTTON": ("#fdef96", "#2b580c"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#2b580c", "#afa939", "#f7b71d", "#fdef96"], },
"LightGreen8": {"BACKGROUND": "#c8dad3", "TEXT": "#63707e", "INPUT": "#93b5b3", "TEXT_INPUT": "#000000", "SCROLL": "#63707e",
"BUTTON": ("#FFFFFF", "#63707e"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#63707e", "#93b5b3", "#c8dad3", "#f2f6f5"], },
"DarkTeal7": {"BACKGROUND": "#248ea9", "TEXT": "#fafdcb", "INPUT": "#aee7e8", "TEXT_INPUT": "#000000", "SCROLL": "#aee7e8",
"BUTTON": ("#000000", "#fafdcb"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#248ea9", "#28c3d4", "#aee7e8", "#fafdcb"], },
"DarkBlue8": {"BACKGROUND": "#454d66", "TEXT": "#d9d872", "INPUT": "#58b368", "TEXT_INPUT": "#000000", "SCROLL": "#58b368",
"BUTTON": ("#000000", "#009975"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#009975", "#454d66", "#58b368", "#d9d872"], },
"DarkBlue9": {"BACKGROUND": "#263859", "TEXT": "#ff6768", "INPUT": "#6b778d", "TEXT_INPUT": "#FFFFFF", "SCROLL": "#6b778d",
"BUTTON": ("#ff6768", "#263859"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#17223b", "#263859", "#6b778d", "#ff6768"], },
"DarkBlue10": {"BACKGROUND": "#0028ff", "TEXT": "#f1f4df", "INPUT": "#10eaf0", "TEXT_INPUT": "#000000", "SCROLL": "#10eaf0",
"BUTTON": ("#f1f4df", "#24009c"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#24009c", "#0028ff", "#10eaf0", "#f1f4df"], },
"DarkBlue11": {"BACKGROUND": "#6384b3", "TEXT": "#e6f0b6", "INPUT": "#b8e9c0", "TEXT_INPUT": "#000000", "SCROLL": "#b8e9c0",
"BUTTON": ("#e6f0b6", "#684949"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#684949", "#6384b3", "#b8e9c0", "#e6f0b6"], },
"DarkTeal8": {"BACKGROUND": "#71a0a5", "TEXT": "#212121", "INPUT": "#665c84", "TEXT_INPUT": "#FFFFFF", "SCROLL": "#212121",
"BUTTON": ("#fab95b", "#665c84"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#212121", "#665c84", "#71a0a5", "#fab95b"], },
"DarkRed1": {"BACKGROUND": "#c10000", "TEXT": "#eeeeee", "INPUT": "#dedede", "TEXT_INPUT": "#000000", "SCROLL": "#dedede", "BUTTON": ("#c10000", "#eeeeee"),
"PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#c10000", "#ff4949", "#dedede", "#eeeeee"], },
"LightBrown5": {"BACKGROUND": "#fff591", "TEXT": "#e41749", "INPUT": "#f5587b", "TEXT_INPUT": "#000000", "SCROLL": "#e41749",
"BUTTON": ("#fff591", "#e41749"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#e41749", "#f5587b", "#ff8a5c", "#fff591"], },
"LightGreen9": {"BACKGROUND": "#f1edb3", "TEXT": "#3b503d", "INPUT": "#4a746e", "TEXT_INPUT": "#f1edb3", "SCROLL": "#3b503d",
"BUTTON": ("#f1edb3", "#3b503d"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#3b503d", "#4a746e", "#c8cf94", "#f1edb3"], "DESCRIPTION": ["Green", "Turquoise", "Yellow"], },
"DarkGreen2": {"BACKGROUND": "#3b503d", "TEXT": "#f1edb3", "INPUT": "#c8cf94", "TEXT_INPUT": "#000000", "SCROLL": "#c8cf94",
"BUTTON": ("#f1edb3", "#3b503d"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#3b503d", "#4a746e", "#c8cf94", "#f1edb3"], "DESCRIPTION": ["Green", "Turquoise", "Yellow"], },
"LightGray1": {"BACKGROUND": "#f2f2f2", "TEXT": "#222831", "INPUT": "#393e46", "TEXT_INPUT": "#FFFFFF", "SCROLL": "#222831",
"BUTTON": ("#f2f2f2", "#222831"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#222831", "#393e46", "#f96d00", "#f2f2f2"], "DESCRIPTION": ["#000000", "Grey", "Orange", "Grey", "Autumn"], },
"DarkGrey4": {"BACKGROUND": "#52524e", "TEXT": "#e9e9e5", "INPUT": "#d4d6c8", "TEXT_INPUT": "#000000", "SCROLL": "#d4d6c8",
"BUTTON": ("#FFFFFF", "#9a9b94"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#52524e", "#9a9b94", "#d4d6c8", "#e9e9e5"], "DESCRIPTION": ["Grey", "Pastel", "Winter"], },
"DarkBlue12": {"BACKGROUND": "#324e7b", "TEXT": "#f8f8f8", "INPUT": "#86a6df", "TEXT_INPUT": "#000000", "SCROLL": "#86a6df",
"BUTTON": ("#FFFFFF", "#5068a9"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#324e7b", "#5068a9", "#86a6df", "#f8f8f8"], "DESCRIPTION": ["Blue", "Grey", "Cold", "Winter"], },
"DarkPurple6": {"BACKGROUND": "#070739", "TEXT": "#e1e099", "INPUT": "#c327ab", "TEXT_INPUT": "#e1e099", "SCROLL": "#c327ab",
"BUTTON": ("#e1e099", "#521477"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#070739", "#521477", "#c327ab", "#e1e099"], "DESCRIPTION": ["#000000", "Purple", "Yellow", "Dark"], },
"DarkPurple7": {"BACKGROUND": "#191930", "TEXT": "#B1B7C5", "INPUT": "#232B5C", "TEXT_INPUT": "#D0E3E7", "SCROLL": "#B1B7C5",
"BUTTON": ("#272D38", "#B1B7C5"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, },
"DarkBlue13": {"BACKGROUND": "#203562", "TEXT": "#e3e8f8", "INPUT": "#c0c5cd", "TEXT_INPUT": "#000000", "SCROLL": "#c0c5cd",
"BUTTON": ("#FFFFFF", "#3e588f"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#203562", "#3e588f", "#c0c5cd", "#e3e8f8"], "DESCRIPTION": ["Blue", "Grey", "Wedding", "Cold"], },
"DarkBrown5": {"BACKGROUND": "#3c1b1f", "TEXT": "#f6e1b5", "INPUT": "#e2bf81", "TEXT_INPUT": "#000000", "SCROLL": "#e2bf81",
"BUTTON": ("#3c1b1f", "#f6e1b5"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#3c1b1f", "#b21e4b", "#e2bf81", "#f6e1b5"], "DESCRIPTION": ["Brown", "Red", "Yellow", "Warm"], },
"DarkGreen3": {"BACKGROUND": "#062121", "TEXT": "#eeeeee", "INPUT": "#e4dcad", "TEXT_INPUT": "#000000", "SCROLL": "#e4dcad",
"BUTTON": ("#eeeeee", "#181810"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#062121", "#181810", "#e4dcad", "#eeeeee"], "DESCRIPTION": ["#000000", "#000000", "Brown", "Grey"], },
"DarkBlack1": {"BACKGROUND": "#181810", "TEXT": "#eeeeee", "INPUT": "#e4dcad", "TEXT_INPUT": "#000000", "SCROLL": "#e4dcad",
"BUTTON": ("#FFFFFF", "#062121"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#062121", "#181810", "#e4dcad", "#eeeeee"], "DESCRIPTION": ["#000000", "#000000", "Brown", "Grey"], },
"DarkGrey5": {"BACKGROUND": "#343434", "TEXT": "#f3f3f3", "INPUT": "#e9dcbe", "TEXT_INPUT": "#000000", "SCROLL": "#e9dcbe",
"BUTTON": ("#FFFFFF", "#8e8b82"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#343434", "#8e8b82", "#e9dcbe", "#f3f3f3"], "DESCRIPTION": ["Grey", "Brown"], },
"LightBrown12": {"BACKGROUND": "#8e8b82", "TEXT": "#f3f3f3", "INPUT": "#e9dcbe", "TEXT_INPUT": "#000000", "SCROLL": "#e9dcbe",
"BUTTON": ("#f3f3f3", "#8e8b82"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#343434", "#8e8b82", "#e9dcbe", "#f3f3f3"], "DESCRIPTION": ["Grey", "Brown"], },
"DarkTeal9": {"BACKGROUND": "#13445a", "TEXT": "#fef4e8", "INPUT": "#446878", "TEXT_INPUT": "#FFFFFF", "SCROLL": "#446878",
"BUTTON": ("#fef4e8", "#446878"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#13445a", "#970747", "#446878", "#fef4e8"], "DESCRIPTION": ["Red", "Grey", "Blue", "Wedding", "Retro"], },
"DarkBlue14": {"BACKGROUND": "#21273d", "TEXT": "#f1f6f8", "INPUT": "#b9d4f1", "TEXT_INPUT": "#000000", "SCROLL": "#b9d4f1",
"BUTTON": ("#FFFFFF", "#6a759b"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#21273d", "#6a759b", "#b9d4f1", "#f1f6f8"], "DESCRIPTION": ["Blue", "#000000", "Grey", "Cold", "Winter"], },
"LightBlue6": {"BACKGROUND": "#f1f6f8", "TEXT": "#21273d", "INPUT": "#6a759b", "TEXT_INPUT": "#FFFFFF", "SCROLL": "#21273d",
"BUTTON": ("#f1f6f8", "#6a759b"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#21273d", "#6a759b", "#b9d4f1", "#f1f6f8"], "DESCRIPTION": ["Blue", "#000000", "Grey", "Cold", "Winter"], },
"DarkGreen4": {"BACKGROUND": "#044343", "TEXT": "#e4e4e4", "INPUT": "#045757", "TEXT_INPUT": "#e4e4e4", "SCROLL": "#045757",
"BUTTON": ("#e4e4e4", "#045757"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#222222", "#044343", "#045757", "#e4e4e4"], "DESCRIPTION": ["#000000", "Turquoise", "Grey", "Dark"], },
"DarkGreen5": {"BACKGROUND": "#1b4b36", "TEXT": "#e0e7f1", "INPUT": "#aebd77", "TEXT_INPUT": "#000000", "SCROLL": "#aebd77",
"BUTTON": ("#FFFFFF", "#538f6a"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#1b4b36", "#538f6a", "#aebd77", "#e0e7f1"], "DESCRIPTION": ["Green", "Grey"], },
"DarkTeal10": {"BACKGROUND": "#0d3446", "TEXT": "#d8dfe2", "INPUT": "#71adb5", "TEXT_INPUT": "#000000", "SCROLL": "#71adb5",
"BUTTON": ("#FFFFFF", "#176d81"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#0d3446", "#176d81", "#71adb5", "#d8dfe2"], "DESCRIPTION": ["Grey", "Turquoise", "Winter", "Cold"], },
"DarkGrey6": {"BACKGROUND": "#3e3e3e", "TEXT": "#ededed", "INPUT": "#68868c", "TEXT_INPUT": "#ededed", "SCROLL": "#68868c",
"BUTTON": ("#FFFFFF", "#405559"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#3e3e3e", "#405559", "#68868c", "#ededed"], "DESCRIPTION": ["Grey", "Turquoise", "Winter"], },
"DarkTeal11": {"BACKGROUND": "#405559", "TEXT": "#ededed", "INPUT": "#68868c", "TEXT_INPUT": "#ededed", "SCROLL": "#68868c",
"BUTTON": ("#ededed", "#68868c"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#3e3e3e", "#405559", "#68868c", "#ededed"], "DESCRIPTION": ["Grey", "Turquoise", "Winter"], },
"LightBlue7": {"BACKGROUND": "#9ed0e0", "TEXT": "#19483f", "INPUT": "#5c868e", "TEXT_INPUT": "#FFFFFF", "SCROLL": "#19483f",
"BUTTON": ("#FFFFFF", "#19483f"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#19483f", "#5c868e", "#ff6a38", "#9ed0e0"], "DESCRIPTION": ["Orange", "Blue", "Turquoise"], },
"LightGreen10": {"BACKGROUND": "#d8ebb5", "TEXT": "#205d67", "INPUT": "#639a67", "TEXT_INPUT": "#FFFFFF", "SCROLL": "#205d67",
"BUTTON": ("#d8ebb5", "#205d67"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#205d67", "#639a67", "#d9bf77", "#d8ebb5"], "DESCRIPTION": ["Blue", "Green", "Brown", "Vintage"], },
"DarkBlue15": {"BACKGROUND": "#151680", "TEXT": "#f1fea4", "INPUT": "#375fc0", "TEXT_INPUT": "#f1fea4", "SCROLL": "#375fc0",
"BUTTON": ("#f1fea4", "#1c44ac"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#151680", "#1c44ac", "#375fc0", "#f1fea4"], "DESCRIPTION": ["Blue", "Yellow", "Cold"], },
"DarkBlue16": {"BACKGROUND": "#1c44ac", "TEXT": "#f1fea4", "INPUT": "#375fc0", "TEXT_INPUT": "#f1fea4", "SCROLL": "#375fc0",
"BUTTON": ("#f1fea4", "#151680"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#151680", "#1c44ac", "#375fc0", "#f1fea4"], "DESCRIPTION": ["Blue", "Yellow", "Cold"], },
"DarkTeal12": {"BACKGROUND": "#004a7c", "TEXT": "#fafafa", "INPUT": "#e8f1f5", "TEXT_INPUT": "#000000", "SCROLL": "#e8f1f5",
"BUTTON": ("#fafafa", "#005691"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#004a7c", "#005691", "#e8f1f5", "#fafafa"], "DESCRIPTION": ["Grey", "Blue", "Cold", "Winter"], },
"LightBrown13": {"BACKGROUND": "#ebf5ee", "TEXT": "#921224", "INPUT": "#bdc6b8", "TEXT_INPUT": "#921224", "SCROLL": "#921224",
"BUTTON": ("#FFFFFF", "#921224"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#921224", "#bdc6b8", "#bce0da", "#ebf5ee"], "DESCRIPTION": ["Red", "Blue", "Grey", "Vintage", "Wedding"], },
"DarkBlue17": {"BACKGROUND": "#21294c", "TEXT": "#f9f2d7", "INPUT": "#f2dea8", "TEXT_INPUT": "#000000", "SCROLL": "#f2dea8",
"BUTTON": ("#f9f2d7", "#141829"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#141829", "#21294c", "#f2dea8", "#f9f2d7"], "DESCRIPTION": ["#000000", "Blue", "Yellow"], },
"DarkBrown6": {"BACKGROUND": "#785e4d", "TEXT": "#f2eee3", "INPUT": "#baaf92", "TEXT_INPUT": "#000000", "SCROLL": "#baaf92",
"BUTTON": ("#FFFFFF", "#785e4d"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#785e4d", "#ff8426", "#baaf92", "#f2eee3"], "DESCRIPTION": ["Grey", "Brown", "Orange", "Autumn"], },
"DarkGreen6": {"BACKGROUND": "#5c715e", "TEXT": "#f2f9f1", "INPUT": "#ddeedf", "TEXT_INPUT": "#000000", "SCROLL": "#ddeedf",
"BUTTON": ("#f2f9f1", "#5c715e"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#5c715e", "#b6cdbd", "#ddeedf", "#f2f9f1"], "DESCRIPTION": ["Grey", "Green", "Vintage"], },
"DarkGreen7": {"BACKGROUND": "#0C231E", "TEXT": "#efbe1c", "INPUT": "#153C33", "TEXT_INPUT": "#efbe1c", "SCROLL": "#153C33",
"BUTTON": ("#efbe1c", "#153C33"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, },
"DarkGrey7": {"BACKGROUND": "#4b586e", "TEXT": "#dddddd", "INPUT": "#574e6d", "TEXT_INPUT": "#dddddd", "SCROLL": "#574e6d",
"BUTTON": ("#dddddd", "#43405d"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#43405d", "#4b586e", "#574e6d", "#dddddd"], "DESCRIPTION": ["Grey", "Winter", "Cold"], },
"DarkRed2": {"BACKGROUND": "#ab1212", "TEXT": "#f6e4b5", "INPUT": "#cd3131", "TEXT_INPUT": "#f6e4b5", "SCROLL": "#cd3131", "BUTTON": ("#f6e4b5", "#ab1212"),
"PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#ab1212", "#1fad9f", "#cd3131", "#f6e4b5"], "DESCRIPTION": ["Turquoise", "Red", "Yellow"], },
"LightGrey6": {"BACKGROUND": "#e3e3e3", "TEXT": "#233142", "INPUT": "#455d7a", "TEXT_INPUT": "#e3e3e3", "SCROLL": "#233142",
"BUTTON": ("#e3e3e3", "#455d7a"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0,
"COLOR_LIST": ["#233142", "#455d7a", "#f95959", "#e3e3e3"], "DESCRIPTION": ["#000000", "Blue", "Red", "Grey"], },
"HotDogStand": {"BACKGROUND": "red", "TEXT": "yellow", "INPUT": "yellow", "TEXT_INPUT": "#000000", "SCROLL": "yellow", "BUTTON": ("red", "yellow"),
"PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, },
"DarkGrey8": {"BACKGROUND": "#19232D", "TEXT": "#ffffff", "INPUT": "#32414B", "TEXT_INPUT": "#ffffff", "SCROLL": "#505F69",
"BUTTON": ("#ffffff", "#32414B"), "PROGRESS": ("#505F69", "#32414B"), "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, },
"DarkGrey9": {"BACKGROUND": "#36393F", "TEXT": "#DCDDDE", "INPUT": "#40444B", "TEXT_INPUT": "#ffffff", "SCROLL": "#202225",
"BUTTON": ("#202225", "#B9BBBE"), "PROGRESS": ("#202225", "#40444B"), "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, },
"DarkGrey10": {"BACKGROUND": "#1c1e23", "TEXT": "#cccdcf", "INPUT": "#272a31", "TEXT_INPUT": "#8b9fde", "SCROLL": "#313641",
"BUTTON": ("#f5f5f6", "#2e3d5a"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, },
"DarkGrey11": {"BACKGROUND": "#1c1e23", "TEXT": "#cccdcf", "INPUT": "#313641", "TEXT_INPUT": "#cccdcf", "SCROLL": "#313641",
"BUTTON": ("#f5f5f6", "#313641"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, },
"DarkGrey12": {"BACKGROUND": "#1c1e23", "TEXT": "#8b9fde", "INPUT": "#313641", "TEXT_INPUT": "#8b9fde", "SCROLL": "#313641",
"BUTTON": ("#cccdcf", "#2e3d5a"), "PROGRESS": DEFAULT_PROGRESS_BAR_COMPUTE, "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, },
"DarkGrey13": {"BACKGROUND": "#1c1e23", "TEXT": "#cccdcf", "INPUT": "#272a31", "TEXT_INPUT": "#cccdcf", "SCROLL": "#313641",
"BUTTON": ("#8b9fde", "#313641"), "PROGRESS": ("#cccdcf", "#272a31"), "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, },
"DarkGrey14": {"BACKGROUND": "#24292e", "TEXT": "#fafbfc", "INPUT": "#1d2125", "TEXT_INPUT": "#fafbfc", "SCROLL": "#1d2125",
"BUTTON": ("#fafbfc", "#155398"), "PROGRESS": ("#155398", "#1d2125"), "BORDER": 1, "SLIDER_DEPTH": 0, "PROGRESS_DEPTH": 0, },
"DarkBrown7": {"BACKGROUND": "#2c2417", "TEXT": "#baa379", "INPUT": "#baa379", "TEXT_INPUT": "#000000", "SCROLL": "#392e1c",
"BUTTON": ("#000000", "#baa379"), "PROGRESS": ("#baa379", "#453923"), "BORDER": 1, "SLIDER_DEPTH": 1, "PROGRESS_DEPTH": 0, },
"Python": {"BACKGROUND": "#3d7aab", "TEXT": "#ffde56", "INPUT": "#295273", "TEXT_INPUT": "#ffde56", "SCROLL": "#295273", "BUTTON": ("#ffde56", "#295273"),
"PROGRESS": ("#ffde56", "#295273"), "BORDER": 1, "SLIDER_DEPTH": 1, "PROGRESS_DEPTH": 0, },
}
| 07bb93d47f01468660a01f42150e87e5cb08d546 | 16 | PySimpleGUI.py | 19,192 | Addition of tooltip_offset parm to set_options call (major hack to get around 8.6.12 problem). Backed out the experiments to try and fix new problem with Ubuntu | 53,473 | 0 | 10,839 | 255 | 1,112 | 212,865 | 4,824 | PySimpleGUI | 131 | PySimpleGUI.py | Python | 14 | {
"docstring": "\n :param icon: Can be either a filename or Base64 value. For Windows if filename, it MUST be ICO format. For Linux, must NOT be ICO. Most portable is to use a Base64 of a PNG file. This works universally across all OS's\n :type icon: bytes | str\n :param button_color: Color of the button (text, background)\n :type button_color: (str, str) or str\n :param element_size: element size (width, height) in characters\n :type element_size: (int, int)\n :param button_element_size: Size of button\n :type button_element_size: (int, int)\n :param margins: (left/right, top/bottom) tkinter margins around outsize. Amount of pixels to leave inside the window's frame around the edges before your elements are shown.\n :type margins: (int, int)\n :param element_padding: Default amount of padding to put around elements in window (left/right, top/bottom) or ((left, right), (top, bottom))\n :type element_padding: (int, int) or ((int, int),(int,int))\n :param auto_size_text: True if the Widget should be shrunk to exactly fit the number of chars to show\n :type auto_size_text: bool\n :param auto_size_buttons: True if Buttons in this Window should be sized to exactly fit the text on this.\n :type auto_size_buttons: (bool)\n :param font: specifies the font family, size, etc. Tuple or Single string format 'name size styles'. Styles: italic * roman bold normal underline overstrike\n :type font: (str or (str, int[, str]) or None)\n :param border_width: width of border around element\n :type border_width: (int)\n :param slider_border_width: Width of the border around sliders\n :type slider_border_width: (int)\n :param slider_relief: Type of relief to use for sliders\n :type slider_relief: (str)\n :param slider_orientation: ???\n :type slider_orientation: ???\n :param autoclose_time: ???\n :type autoclose_time: ???\n :param message_box_line_width: ???\n :type message_box_line_width: ???\n :param progress_meter_border_depth: ???\n :type progress_meter_border_depth: ???\n :param progress_meter_style: You can no longer set a progress bar style. All ttk styles must be the same for the window\n :type progress_meter_style: ???\n :param progress_meter_relief:\n :type progress_meter_relief: ???\n :param progress_meter_color: ???\n :type progress_meter_color: ???\n :param progress_meter_size: ???\n :type progress_meter_size: ???\n :param text_justification: Default text justification for all Text Elements in window\n :type text_justification: 'left' | 'right' | 'center'\n :param background_color: color of background\n :type background_color: (str)\n :param element_background_color: element background color\n :type element_background_color: (str)\n :param text_element_background_color: text element background color\n :type text_element_background_color: (str)\n :param input_elements_background_color: Default color to use for the background of input elements\n :type input_elements_background_color: (str)\n :param input_text_color: Default color to use for the text for Input elements\n :type input_text_color: (str)\n :param scrollbar_color: Default color to use for the slider trough\n :type scrollbar_color: (str)\n :param text_color: color of the text\n :type text_color: (str)\n :param element_text_color: Default color to use for Text elements\n :type element_text_color: (str)\n :param debug_win_size: window size\n :type debug_win_size: (int, int)\n :param window_location: Default location to place windows. Not setting will center windows on the display\n :type window_location: (int, int) | None\n :param error_button_color: (Default = (None))\n :type error_button_color: ???\n :param tooltip_time: time in milliseconds to wait before showing a tooltip. Default is 400ms\n :type tooltip_time: (int)\n :param tooltip_font: font to use for all tooltips\n :type tooltip_font: str or Tuple[str, int] or Tuple[str, int, str]\n :param use_ttk_buttons: if True will cause all buttons to be ttk buttons\n :type use_ttk_buttons: (bool)\n :param ttk_theme: Theme to use with ttk widgets. Choices (on Windows) include - 'default', 'winnative', 'clam', 'alt', 'classic', 'vista', 'xpnative'\n :type ttk_theme: (str)\n :param suppress_error_popups: If True then error popups will not be shown if generated internally to PySimpleGUI\n :type suppress_error_popups: (bool)\n :param suppress_raise_key_errors: If True then key errors won't be raised (you'll still get popup error)\n :type suppress_raise_key_errors: (bool)\n :param suppress_key_guessing: If True then key errors won't try and find closest matches for you\n :type suppress_key_guessing: (bool)\n :param warn_button_key_duplicates: If True then duplicate Button Keys generate warnings (not recommended as they're expected)\n :type warn_button_key_duplicates: (bool) \n :param enable_treeview_869_patch: If True, then will use the treeview color patch for tk 8.6.9\n :type enable_treeview_869_patch: (bool)\n :param enable_mac_notitlebar_patch: If True then Windows with no titlebar use an alternative technique when tkinter version < 8.6.10\n :type enable_mac_notitlebar_patch: (bool)\n :param use_custom_titlebar: If True then a custom titlebar is used instead of the normal system titlebar\n :type use_custom_titlebar: (bool)\n :param titlebar_background_color: If custom titlebar indicated by use_custom_titlebar, then use this as background color\n :type titlebar_background_color: str | None\n :param titlebar_text_color: If custom titlebar indicated by use_custom_titlebar, then use this as text color\n :type titlebar_text_color: str | None\n :param titlebar_font: If custom titlebar indicated by use_custom_titlebar, then use this as title font\n :type titlebar_font: (str or (str, int[, str]) or None) | None\n :param titlebar_icon: If custom titlebar indicated by use_custom_titlebar, then use this as the icon (file or base64 bytes)\n :type titlebar_icon: bytes | str\n :param user_settings_path: default path for user_settings API calls. Expanded with os.path.expanduser so can contain ~ to represent user\n :type user_settings_path: (str)\n :param pysimplegui_settings_path: default path for the global PySimpleGUI user_settings\n :type pysimplegui_settings_path: (str)\n :param pysimplegui_settings_filename: default filename for the global PySimpleGUI user_settings\n :type pysimplegui_settings_filename: (str)\n :param keep_on_top: If True then all windows will automatically be set to keep_on_top=True\n :type keep_on_top: (bool)\n :param dpi_awareness: If True then will turn on DPI awareness (Windows only at the moment)\n :type dpi_awareness: (bool)\n :param scaling: Sets the default scaling for all windows including popups, etc.\n :type scaling: (float)\n :param disable_modal_windows: If True then all windows, including popups, will not be modal windows\n :type disable_modal_windows: (bool)\n :param tooltip_offset: Offset to use for tooltips as a tuple. These values will be added to the mouse location when the widget was entered.\n :type tooltip_offset: ((None, None) | (int, int))\n :return: None\n :rtype: None\n ",
"language": "en",
"n_whitespaces": 2847,
"n_words": 889,
"vocab_size": 356
} | https://github.com/PySimpleGUI/PySimpleGUI.git |
|
1 | test_load_with_supervisor_without_diagnostics | async def test_load_with_supervisor_without_diagnostics(hass):
analytics = Analytics(hass)
analytics._data.preferences[ATTR_DIAGNOSTICS] = True
assert analytics.preferences[ATTR_DIAGNOSTICS]
with patch(
"homeassistant.components.hassio.get_supervisor_info",
side_effect=Mock(return_value={"diagnostics": False}),
), patch(
"homeassistant.components.hassio.is_hassio",
side_effect=Mock(return_value=True),
):
await analytics.load()
assert not analytics.preferences[ATTR_DIAGNOSTICS]
| 46500beefcccd8106718a8172a5078bbe5579765 | 16 | test_analytics.py | 132 | Enable strict typing of analytics (#83119) | 95,933 | 0 | 85 | 78 | 22 | 296,961 | 26 | core | 12 | tests/components/analytics/test_analytics.py | Python | 13 | {
"docstring": "Test loading with a supervisor that has not diagnostics enabled.",
"language": "en",
"n_whitespaces": 9,
"n_words": 10,
"vocab_size": 10
} | https://github.com/home-assistant/core.git |
|
3 | test_issue_message_builder | def test_issue_message_builder(self):
self.event1.data["metadata"].update({"value": "some error"})
self.group1.data["metadata"].update({"value": "some error"})
self.event1.data["type"] = self.group1.data["type"] = "error"
issue_card = build_group_card(
group=self.group1, event=self.event1, rules=self.rules, integration=self.integration
)
body = issue_card["body"]
assert 4 == len(body)
title = body[0]
assert "oh no" in title["text"]
assert TextSize.LARGE == title["size"]
assert TextWeight.BOLDER == title["weight"]
description = body[1]
assert "some error" == description["text"]
assert TextWeight.BOLDER == description["weight"]
footer = body[2]
assert "ColumnSet" == footer["type"]
assert 3 == len(footer["columns"])
logo = footer["columns"][0]["items"][0]
assert "20px" == logo["height"]
issue_id_and_rule = footer["columns"][1]["items"][0]
assert self.group1.qualified_short_id in issue_id_and_rule["text"]
assert "rule1" in issue_id_and_rule["text"]
assert "+1 other" in issue_id_and_rule["text"]
date = footer["columns"][2]["items"][0]
assert (
re.match(
r,
date["text"],
re.VERBOSE,
)
is not None
)
actions_container = body[3]
assert "Container" == actions_container["type"]
action_set = actions_container["items"][0]
assert "ActionSet" == action_set["type"]
actions = action_set["actions"]
for action in actions:
assert ActionType.SHOW_CARD == action["type"]
card_body = action["card"]["body"]
assert 1 <= len(card_body)
assert "Input.ChoiceSet" == card_body[-1]["type"]
resolve_action, ignore_action, assign_action = actions
assert "Resolve" == resolve_action["title"]
assert "Ignore" == ignore_action["title"]
assert "Assign" == assign_action["title"]
# Check if card is serializable to json
card_json = json.dumps(issue_card)
assert card_json[0] == "{" and card_json[-1] == "}"
| db35e231ceababe8c9f5ca7b5d2ca685f07c7d5b | 11 | test_message_builder.py | 694 | test(msteams): Add tests for building group card (#36834)
Add tests for build_group_card which builds issues cards. Does NOT test all visual aspects of the card. Only ensures that certain important elements are present and the basic structure of the card is correct. | 18,974 | 0 | 581 | 402 | 110 | 93,204 | 176 | sentry | 41 | tests/sentry/integrations/msteams/test_message_builder.py | Python | 60 | {
"docstring": "\\{\\{ # {{\n DATE\\( # DATE(\n [0-9T+:\\-]+,\\ SHORT # 2022-07-14T19:30:34, SHORT\n \\) # )\n \\}\\} # }}\n \\ # whitespace\n at # at\n \\ # whitespace\n \\{\\{ # {{\n TIME\\([0-9T+:\\-]+\\) # TIME(2022-07-14T19:30:34)\n \\}\\} # }}",
"language": "en",
"n_whitespaces": 369,
"n_words": 35,
"vocab_size": 17
} | https://github.com/getsentry/sentry.git |
|
7 | cache_key | def cache_key(self, template_name, skip=None):
skip_prefix = ""
if skip:
matching = [
origin.name for origin in skip if origin.template_name == template_name
]
if matching:
skip_prefix = self.generate_hash(matching)
return "-".join(s for s in (str(template_name), skip_prefix) if s)
| 9c19aff7c7561e3a82978a272ecdaad40dda5c00 | 12 | cached.py | 106 | Refs #33476 -- Reformatted code with Black. | 51,474 | 0 | 127 | 66 | 28 | 206,296 | 36 | django | 12 | django/template/loaders/cached.py | Python | 9 | {
"docstring": "\n Generate a cache key for the template name and skip.\n\n If skip is provided, only origins that match template_name are included\n in the cache key. This ensures each template is only parsed and cached\n once if contained in different extend chains like:\n\n x -> a -> a\n y -> a -> a\n z -> a -> a\n ",
"language": "en",
"n_whitespaces": 126,
"n_words": 57,
"vocab_size": 39
} | https://github.com/django/django.git |
|
2 | isNuitkaPython | def isNuitkaPython():
# spell-checker: ignore nuitkapython
if python_version >= 0x300:
return sys.implementation.name == "nuitkapython"
else:
return sys.subversion[0] == "nuitkapython"
_is_anaconda = None
| 77e7c06c0f9c5c0735b5a65c72abcd243d8e3640 | 11 | PythonFlavors.py | 59 | Minor cleanups | 42,801 | 0 | 47 | 29 | 19 | 178,712 | 22 | Nuitka | 7 | nuitka/PythonFlavors.py | Python | 5 | {
"docstring": "Is this our own fork of CPython named Nuitka-Python.",
"language": "en",
"n_whitespaces": 8,
"n_words": 9,
"vocab_size": 9
} | https://github.com/Nuitka/Nuitka.git |
|
3 | handle_pip_version_check | def handle_pip_version_check(self, options):
# type: (Values) -> None
# Make sure the index_group options are present.
assert hasattr(options, "no_index")
if options.disable_pip_version_check or options.no_index:
return
# Otherwise, check if we're using the latest version of pip available.
session = self._build_session(
options, retries=0, timeout=min(5, options.timeout)
)
with session:
pip_self_version_check(session, options)
KEEPABLE_TEMPDIR_TYPES = [
tempdir_kinds.BUILD_ENV,
tempdir_kinds.EPHEM_WHEEL_CACHE,
tempdir_kinds.REQ_BUILD,
]
| f638f5d0e6c8ebed0e69a6584bc7f003ec646580 | 12 | req_command.py | 117 | upd; format | 12,206 | 0 | 158 | 57 | 50 | 60,555 | 55 | transferlearning | 17 | .venv/lib/python3.8/site-packages/pip/_internal/cli/req_command.py | Python | 9 | {
"docstring": "\n Do the pip version check if not disabled.\n\n This overrides the default behavior of not doing the check.\n ",
"language": "en",
"n_whitespaces": 40,
"n_words": 18,
"vocab_size": 15
} | https://github.com/jindongwang/transferlearning.git |
|
22 | submit_row | def submit_row(context):
add = context["add"]
change = context["change"]
is_popup = context["is_popup"]
save_as = context["save_as"]
show_save = context.get("show_save", True)
show_save_and_add_another = context.get("show_save_and_add_another", True)
show_save_and_continue = context.get("show_save_and_continue", True)
has_add_permission = context["has_add_permission"]
has_change_permission = context["has_change_permission"]
has_view_permission = context["has_view_permission"]
has_editable_inline_admin_formsets = context["has_editable_inline_admin_formsets"]
can_save = (
(has_change_permission and change)
or (has_add_permission and add)
or has_editable_inline_admin_formsets
)
can_save_and_add_another = (
has_add_permission
and not is_popup
and (not save_as or add)
and can_save
and show_save_and_add_another
)
can_save_and_continue = (
not is_popup and can_save and has_view_permission and show_save_and_continue
)
can_change = has_change_permission or has_editable_inline_admin_formsets
ctx = Context(context)
ctx.update(
{
"can_change": can_change,
"show_delete_link": (
not is_popup
and context["has_delete_permission"]
and change
and context.get("show_delete", True)
),
"show_save_as_new": not is_popup
and has_change_permission
and change
and save_as,
"show_save_and_add_another": can_save_and_add_another,
"show_save_and_continue": can_save_and_continue,
"show_save": show_save and can_save,
"show_close": not (show_save and can_save),
}
)
return ctx
@register.tag(name="submit_row") | 9c19aff7c7561e3a82978a272ecdaad40dda5c00 | @register.tag(name="submit_row") | 15 | admin_modify.py | 380 | Refs #33476 -- Reformatted code with Black. | 50,412 | 1 | 457 | 213 | 64 | 203,500 | 131 | django | 24 | django/contrib/admin/templatetags/admin_modify.py | Python | 49 | {
"docstring": "\n Display the row of buttons for delete and save.\n ",
"language": "en",
"n_whitespaces": 16,
"n_words": 9,
"vocab_size": 9
} | https://github.com/django/django.git |
1 | test_ridgecv_normalize_deprecated | def test_ridgecv_normalize_deprecated(Estimator):
X = np.array([[1, -1], [1, 1]])
y = np.array([0, 1])
estimator = Estimator(normalize=True)
with pytest.warns(
FutureWarning, match=r"Set parameter alphas to: original_alphas \* n_samples"
):
estimator.fit(X, y)
| f14af688b7e77ecb6df9dfee93ec39b6c0334b86 | 11 | test_ridge.py | 108 | FIX Make Ridge*CV warn about rescaling alphas with scaling (#22585) | 75,551 | 0 | 60 | 68 | 26 | 259,066 | 28 | scikit-learn | 13 | sklearn/linear_model/tests/test_ridge.py | Python | 8 | {
"docstring": "Check that the normalize deprecation warning mentions the rescaling of alphas\n\n Non-regression test for issue #22540\n ",
"language": "en",
"n_whitespaces": 22,
"n_words": 16,
"vocab_size": 15
} | https://github.com/scikit-learn/scikit-learn.git |
|
1 | async_start_charging | async def async_start_charging(self) -> None:
await self.hass.async_add_executor_job(self.leaf.start_charging)
self.schedule_update()
| 10027b20904b678d8baecbc6e72c5bcc3f4f24b2 | 10 | __init__.py | 47 | Add button to start leaf charge (#62948)
Co-authored-by: Bruce Duncan <[email protected]> | 107,548 | 0 | 29 | 26 | 8 | 308,815 | 8 | core | 7 | homeassistant/components/nissan_leaf/__init__.py | Python | 4 | {
"docstring": "Request to start charging the car. Used by the button platform.",
"language": "en",
"n_whitespaces": 10,
"n_words": 11,
"vocab_size": 10
} | https://github.com/home-assistant/core.git |
|
1 | async_update | async def async_update(self) -> None:
await self._smappee_base.async_update()
self._state = self._service_location.is_present
| 0c767bd0d37a41af37728b1d8b4eae8dceb7e188 | 9 | binary_sensor.py | 45 | Improve entity type hints [s] (part 1/2) (#77881) | 105,270 | 0 | 31 | 25 | 10 | 306,486 | 10 | core | 6 | homeassistant/components/smappee/binary_sensor.py | Python | 4 | {
"docstring": "Get the latest data from Smappee and update the state.",
"language": "en",
"n_whitespaces": 9,
"n_words": 10,
"vocab_size": 9
} | https://github.com/home-assistant/core.git |
|
1 | test_mount_half_u_devices | def test_mount_half_u_devices(self):
rack = Rack.objects.first()
attrs = {
'device_type': DeviceType.objects.get(u_height=0.5),
'device_role': DeviceRole.objects.first(),
'site': Site.objects.first(),
'rack': rack,
'face': DeviceFaceChoices.FACE_FRONT,
}
Device(name='Device 1', position=1, **attrs).save()
Device(name='Device 2', position=1.5, **attrs).save()
self.assertEqual(len(rack.get_available_units()), rack.u_height * 2 - 3)
| 103729c0855aad2f45fcaa2cf680799236f3e201 | 11 | test_models.py | 196 | Add test for 0.5U devices | 77,999 | 0 | 137 | 121 | 30 | 265,126 | 33 | netbox | 21 | netbox/dcim/tests/test_models.py | Python | 12 | {
"docstring": "\n Check that two 0.5U devices can be mounted in the same rack unit.\n ",
"language": "en",
"n_whitespaces": 28,
"n_words": 13,
"vocab_size": 13
} | https://github.com/netbox-community/netbox.git |
|
1 | make_homeserver | def make_homeserver(self, reactor, clock):
hs = self.setup_test_homeserver()
return hs
| 922b771337f6d14a556fa761c783748f698e924b | 8 | unittest.py | 32 | Add missing type hints for tests.unittest. (#13397) | 72,530 | 0 | 30 | 19 | 8 | 248,955 | 9 | synapse | 6 | tests/unittest.py | Python | 3 | {
"docstring": "\n Make and return a homeserver.\n\n Args:\n reactor: A Twisted Reactor, or something that pretends to be one.\n clock (synapse.util.Clock): The Clock, associated with the reactor.\n\n Returns:\n A homeserver suitable for testing.\n\n Function to be overridden in subclasses.\n ",
"language": "en",
"n_whitespaces": 106,
"n_words": 37,
"vocab_size": 34
} | https://github.com/matrix-org/synapse.git |
|
7 | ordered | def ordered(self):
if isinstance(self, EmptyQuerySet):
return True
if self.query.extra_order_by or self.query.order_by:
return True
elif (
self.query.default_ordering
and self.query.get_meta().ordering
and
# A default ordering doesn't affect GROUP BY queries.
not self.query.group_by
):
return True
else:
return False
| 9c19aff7c7561e3a82978a272ecdaad40dda5c00 | 13 | query.py | 103 | Refs #33476 -- Reformatted code with Black. | 51,188 | 0 | 177 | 63 | 29 | 205,746 | 36 | django | 11 | django/db/models/query.py | Python | 14 | {
"docstring": "\n Return True if the QuerySet is ordered -- i.e. has an order_by()\n clause or a default ordering on the model (or is empty).\n ",
"language": "en",
"n_whitespaces": 45,
"n_words": 23,
"vocab_size": 21
} | https://github.com/django/django.git |
|
1 | get_invalid_response_data | def get_invalid_response_data(self, form):
return {
"success": False,
"error_message": "\n".join(form.errors["file"]),
}
| d10f15e55806c6944827d801cd9c2d53f5da4186 | 11 | multiple_upload.py | 54 | Reformat with black | 15,887 | 0 | 53 | 29 | 10 | 72,414 | 10 | wagtail | 5 | wagtail/admin/views/generic/multiple_upload.py | Python | 5 | {
"docstring": "\n Return the JSON response data for an invalid form submission\n ",
"language": "en",
"n_whitespaces": 25,
"n_words": 10,
"vocab_size": 10
} | https://github.com/wagtail/wagtail.git |
|
2 | path_objects | def path_objects(self):
if not hasattr(self, '_path_objects'):
self._path_objects = self._get_path()
return self._path_objects
| 6ff2e55ce408f0f7f2fe99129048421c25ecafe6 | 10 | cables.py | 50 | Add origins, destinations properties on CablePath | 77,911 | 0 | 43 | 28 | 10 | 264,915 | 11 | netbox | 5 | netbox/dcim/models/cables.py | Python | 4 | {
"docstring": "\n Cache and return the complete path as lists of objects, derived from their annotation within the path.\n ",
"language": "en",
"n_whitespaces": 32,
"n_words": 17,
"vocab_size": 16
} | https://github.com/netbox-community/netbox.git |
|
7 | gui_repaint | def gui_repaint(self, drawDC=None):
_log.debug("%s - gui_repaint()", type(self))
# The "if self" check avoids a "wrapped C/C++ object has been deleted"
# RuntimeError if doing things after window is closed.
if not (self and self.IsShownOnScreen()):
return
if not drawDC: # not called from OnPaint use a ClientDC
drawDC = wx.ClientDC(self)
# For 'WX' backend on Windows, the bitmap can not be in use by another
# DC (see GraphicsContextWx._cache).
bmp = (self.bitmap.ConvertToImage().ConvertToBitmap()
if wx.Platform == '__WXMSW__'
and isinstance(self.figure._cachedRenderer, RendererWx)
else self.bitmap)
drawDC.DrawBitmap(bmp, 0, 0)
if self._rubberband_rect is not None:
# Some versions of wx+python don't support numpy.float64 here.
x0, y0, x1, y1 = map(int, self._rubberband_rect)
drawDC.DrawLineList(
[(x0, y0, x1, y0), (x1, y0, x1, y1),
(x0, y0, x0, y1), (x0, y1, x1, y1)],
wx.Pen('BLACK', 1, wx.PENSTYLE_SHORT_DASH))
filetypes = {
**FigureCanvasBase.filetypes,
'bmp': 'Windows bitmap',
'jpeg': 'JPEG',
'jpg': 'JPEG',
'pcx': 'PCX',
'png': 'Portable Network Graphics',
'tif': 'Tagged Image Format File',
'tiff': 'Tagged Image Format File',
'xpm': 'X pixmap',
}
| e1eca0aa8bf0b51009e012cd37d3e95f364d0ee9 | 13 | backend_wx.py | 350 | Expire deprecations in backends | 22,898 | 0 | 448 | 175 | 121 | 107,757 | 155 | matplotlib | 31 | lib/matplotlib/backends/backend_wx.py | Python | 17 | {
"docstring": "\n Update the displayed image on the GUI canvas, using the supplied\n wx.PaintDC device context.\n\n The 'WXAgg' backend sets origin accordingly.\n ",
"language": "en",
"n_whitespaces": 49,
"n_words": 20,
"vocab_size": 18
} | https://github.com/matplotlib/matplotlib.git |
|
4 | copy_safe_request | def copy_safe_request(request):
meta = {
k: request.META[k]
for k in HTTP_REQUEST_META_SAFE_COPY
if k in request.META and isinstance(request.META[k], str)
}
return NetBoxFakeRequest({
'META': meta,
'COOKIES': request.COOKIES,
'POST': request.POST,
'GET': request.GET,
'FILES': request.FILES,
'user': request.user,
'path': request.path,
'id': getattr(request, 'id', None), # UUID assigned by middleware
})
| 540bba4544d9f31c126571cc1a45a6783b3b6a89 | 13 | utils.py | 158 | Closes #10920: Include request cookies when queuing a custom script | 78,322 | 0 | 138 | 97 | 43 | 266,161 | 45 | netbox | 16 | netbox/utilities/utils.py | Python | 16 | {
"docstring": "\n Copy selected attributes from a request object into a new fake request object. This is needed in places where\n thread safe pickling of the useful request data is needed.\n ",
"language": "en",
"n_whitespaces": 39,
"n_words": 29,
"vocab_size": 25
} | https://github.com/netbox-community/netbox.git |
|
1 | products_for_sorting_with_channels | def products_for_sorting_with_channels(category, channel_USD, channel_PLN):
product_type = ProductType.objects.create(name="Apple", kind=ProductTypeKind.NORMAL)
products = Product.objects.bulk_create(
[
Product(
name="Product1",
slug="prod1",
category=category,
product_type=product_type,
description=dummy_editorjs("Test description 1."),
),
Product(
name="ProductProduct1",
slug="prod_prod1",
category=category,
product_type=product_type,
),
Product(
name="ProductProduct2",
slug="prod_prod2",
category=category,
product_type=product_type,
),
Product(
name="Product2",
slug="prod2",
category=category,
product_type=product_type,
description=dummy_editorjs("Test description 2."),
),
Product(
name="Product3",
slug="prod3",
category=category,
product_type=product_type,
description=dummy_editorjs("Test description 3."),
),
]
)
ProductChannelListing.objects.bulk_create(
[
ProductChannelListing(
product=products[0],
channel=channel_USD,
is_published=True,
discounted_price_amount=Decimal(5),
publication_date=datetime.date(2002, 1, 1),
),
ProductChannelListing(
product=products[1],
channel=channel_USD,
is_published=True,
discounted_price_amount=Decimal(15),
publication_date=datetime.date(2000, 1, 1),
),
ProductChannelListing(
product=products[2],
channel=channel_USD,
is_published=False,
discounted_price_amount=Decimal(4),
publication_date=datetime.date(1999, 1, 1),
),
ProductChannelListing(
product=products[3],
channel=channel_USD,
is_published=True,
discounted_price_amount=Decimal(7),
publication_date=datetime.date(2001, 1, 1),
),
# Second channel
ProductChannelListing(
product=products[0],
channel=channel_PLN,
is_published=False,
discounted_price_amount=Decimal(15),
publication_date=datetime.date(2003, 1, 1),
),
ProductChannelListing(
product=products[1],
channel=channel_PLN,
is_published=True,
discounted_price_amount=Decimal(4),
publication_date=datetime.date(1999, 1, 1),
),
ProductChannelListing(
product=products[2],
channel=channel_PLN,
is_published=True,
discounted_price_amount=Decimal(5),
publication_date=datetime.date(2000, 1, 1),
),
ProductChannelListing(
product=products[4],
channel=channel_PLN,
is_published=True,
discounted_price_amount=Decimal(7),
publication_date=datetime.date(1998, 1, 1),
),
]
)
variants = ProductVariant.objects.bulk_create(
[
ProductVariant(
product=products[0],
sku=str(uuid.uuid4()).replace("-", ""),
track_inventory=True,
name="XS",
),
ProductVariant(
product=products[1],
sku=str(uuid.uuid4()).replace("-", ""),
track_inventory=True,
name="S",
),
ProductVariant(
product=products[2],
sku=str(uuid.uuid4()).replace("-", ""),
track_inventory=True,
name="M",
),
ProductVariant(
product=products[3],
sku=str(uuid.uuid4()).replace("-", ""),
track_inventory=True,
name="L",
),
ProductVariant(
product=products[4],
sku=str(uuid.uuid4()).replace("-", ""),
track_inventory=True,
name="XL",
),
]
)
ProductVariantChannelListing.objects.bulk_create(
[
ProductVariantChannelListing(
variant=variants[0],
channel=channel_USD,
price_amount=Decimal(10),
currency=channel_USD.currency_code,
),
ProductVariantChannelListing(
variant=variants[1],
channel=channel_USD,
price_amount=Decimal(15),
currency=channel_USD.currency_code,
),
ProductVariantChannelListing(
variant=variants[2],
channel=channel_USD,
price_amount=Decimal(8),
currency=channel_USD.currency_code,
),
ProductVariantChannelListing(
variant=variants[3],
channel=channel_USD,
price_amount=Decimal(7),
currency=channel_USD.currency_code,
),
# Second channel
ProductVariantChannelListing(
variant=variants[0],
channel=channel_PLN,
price_amount=Decimal(15),
currency=channel_PLN.currency_code,
),
ProductVariantChannelListing(
variant=variants[1],
channel=channel_PLN,
price_amount=Decimal(8),
currency=channel_PLN.currency_code,
),
ProductVariantChannelListing(
variant=variants[2],
channel=channel_PLN,
price_amount=Decimal(10),
currency=channel_PLN.currency_code,
),
ProductVariantChannelListing(
variant=variants[4],
channel=channel_PLN,
price_amount=Decimal(7),
currency=channel_PLN.currency_code,
),
]
)
products[3].save()
products[4].save()
products[0].save()
products[2].save()
products[1].save()
variants[2].save()
variants[0].save()
variants[4].save()
variants[1].save()
variants[3].save()
return products
QUERY_PRODUCTS_WITH_SORTING_AND_FILTERING =
@pytest.mark.parametrize(
"sort_by",
[
{"field": "PUBLISHED", "direction": "ASC"},
{"field": "PRICE", "direction": "DESC"},
{"field": "MINIMAL_PRICE", "direction": "DESC"},
{"field": "PUBLICATION_DATE", "direction": "DESC"},
],
) | 3f773c3890aead936949bd6923d2d7f669e1c68f | @pytest.mark.parametrize(
"sort_by",
[
{"field": "PUBLISHED", "direction": "ASC"},
{"field": "PRICE", "direction": "DESC"},
{"field": "MINIMAL_PRICE", "direction": "DESC"},
{"field": "PUBLICATION_DATE", "direction": "DESC"},
],
) | 18 | test_product_filtering_and_sorting_with_channels.py | 1,552 | Add sorting by LAST_MODIFIED_AT field to GraphQL schema (#9245)
* Add sorting by LAST_MODIFIED_AT to new types
* Add LAST_MODIFIED_AT to sorting exported files
* Update schema, fix variant sorter
* Update changelog
* Rebase and update changelog
Co-authored-by: Marcin Gฤbala <[email protected]> | 4,954 | 1 | 2,732 | 991 | 105 | 26,250 | 263 | saleor | 45 | saleor/graphql/product/tests/test_product_filtering_and_sorting_with_channels.py | Python | 196 | {
"docstring": "\n query ($sortBy: ProductOrder, $filter: ProductFilterInput, $channel: String){\n products (\n first: 10, sortBy: $sortBy, filter: $filter, channel: $channel\n ) {\n edges {\n node {\n name\n slug\n }\n }\n }\n }\n",
"language": "en",
"n_whitespaces": 157,
"n_words": 29,
"vocab_size": 24
} | https://github.com/saleor/saleor.git |
8 | _try_compile_deployment_target | def _try_compile_deployment_target(self, operator, target):
orig_environ = os.environ
os.environ = orig_environ.copy()
self.addCleanup(setattr, os, 'environ', orig_environ)
if target is None:
if os.environ.get('MACOSX_DEPLOYMENT_TARGET'):
del os.environ['MACOSX_DEPLOYMENT_TARGET']
else:
os.environ['MACOSX_DEPLOYMENT_TARGET'] = target
deptarget_c = os.path.join(self.tmp_dir, 'deptargetmodule.c')
with open(deptarget_c, 'w') as fp:
fp.write(textwrap.dedent( % operator))
# get the deployment target that the interpreter was built with
target = sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET')
target = tuple(map(int, target.split('.')[0:2]))
# format the target value as defined in the Apple
# Availability Macros. We can't use the macro names since
# at least one value we test with will not exist yet.
if target[:2] < (10, 10):
# for 10.1 through 10.9.x -> "10n0"
target = '%02d%01d0' % target
else:
# for 10.10 and beyond -> "10nn00"
if len(target) >= 2:
target = '%02d%02d00' % target
else:
# 11 and later can have no minor version (11 instead of 11.0)
target = '%02d0000' % target
deptarget_ext = Extension(
'deptarget',
[deptarget_c],
extra_compile_args=['-DTARGET=%s'%(target,)],
)
dist = Distribution({
'name': 'deptarget',
'ext_modules': [deptarget_ext]
})
dist.package_dir = self.tmp_dir
cmd = self.build_ext(dist)
cmd.build_lib = self.tmp_dir
cmd.build_temp = self.tmp_dir
try:
old_stdout = sys.stdout
if not support.verbose:
# silence compiler output
sys.stdout = StringIO()
try:
cmd.ensure_finalized()
cmd.run()
finally:
sys.stdout = old_stdout
except CompileError:
self.fail("Wrong deployment target during compilation")
| 8198943edd73a363c266633e1aa5b2a9e9c9f526 | 14 | test_build_ext.py | 500 | add python 3.10.4 for windows | 56,858 | 0 | 704 | 288 | 129 | 223,085 | 196 | XX-Net | 47 | python3.10.4/Lib/distutils/tests/test_build_ext.py | Python | 55 | {
"docstring": "\\\n #include <AvailabilityMacros.h>\n\n int dummy;\n\n #if TARGET %s MAC_OS_X_VERSION_MIN_REQUIRED\n #else\n #error \"Unexpected target\"\n #endif\n\n ",
"language": "en",
"n_whitespaces": 115,
"n_words": 14,
"vocab_size": 14
} | https://github.com/XX-net/XX-Net.git |
|
1 | test_edit_post_locked_by_self | def test_edit_post_locked_by_self(self):
# Lock the snippet
self.lock_snippet(self.user)
# Try to edit the snippet
response = self.client.post(
self.get_url("edit"),
{"text": "Edited while locked"},
follow=True,
)
self.refresh_snippet()
# Should not show error message
self.assertNotContains(
response,
f"The {self.model_name} could not be saved as it is locked",
)
# Check that the snippet is still locked
self.assertTrue(self.snippet.locked)
# Check that the snippet is edited
self.assertEqual(self.snippet.text, "Edited while locked")
| 10dbbddaf35607e4257f50dd960520a1268dd225 | 11 | test_locking.py | 142 | Add tests for locking snippets | 17,037 | 0 | 216 | 77 | 45 | 80,233 | 63 | wagtail | 17 | wagtail/snippets/tests/test_locking.py | Python | 14 | {
"docstring": "A user can edit a snippet that is locked by themselves.",
"language": "en",
"n_whitespaces": 10,
"n_words": 11,
"vocab_size": 11
} | https://github.com/wagtail/wagtail.git |
|
1 | test_jemalloc_env_var_propagate | def test_jemalloc_env_var_propagate():
gcs_ptype = ray.ray_constants.PROCESS_TYPE_GCS_SERVER
expected = {}
actual = ray._private.services.propagate_jemalloc_env_var(
jemalloc_path="", jemalloc_conf="", jemalloc_comps=[], process_type=gcs_ptype
)
assert actual == expected
actual = ray._private.services.propagate_jemalloc_env_var(
jemalloc_path=None,
jemalloc_conf="a,b,c",
jemalloc_comps=[ray.ray_constants.PROCESS_TYPE_GCS_SERVER],
process_type=gcs_ptype,
)
assert actual == expected
library_path = "/abc"
expected = {"LD_PRELOAD": library_path}
actual = ray._private.services.propagate_jemalloc_env_var(
jemalloc_path=library_path,
jemalloc_conf="",
jemalloc_comps=[ray.ray_constants.PROCESS_TYPE_GCS_SERVER],
process_type=gcs_ptype,
)
assert actual == expected
# comps should be a list type.
with pytest.raises(AssertionError):
ray._private.services.propagate_jemalloc_env_var(
jemalloc_path=library_path,
jemalloc_conf="",
jemalloc_comps="ray.ray_constants.PROCESS_TYPE_GCS_SERVER,",
process_type=gcs_ptype,
)
# When comps don't match the process_type, it should return an empty dict.
expected = {}
actual = ray._private.services.propagate_jemalloc_env_var(
jemalloc_path=library_path,
jemalloc_conf="",
jemalloc_comps=[ray.ray_constants.PROCESS_TYPE_RAYLET],
process_type=gcs_ptype,
)
library_path = "/abc"
malloc_conf = "a,b,c"
expected = {"LD_PRELOAD": library_path, "MALLOC_CONF": malloc_conf}
actual = ray._private.services.propagate_jemalloc_env_var(
jemalloc_path=library_path,
jemalloc_conf=malloc_conf,
jemalloc_comps=[ray.ray_constants.PROCESS_TYPE_GCS_SERVER],
process_type=gcs_ptype,
)
assert actual == expected
| 7f1bacc7dc9caf6d0ec042e39499bbf1d9a7d065 | 12 | test_advanced_4.py | 420 | [CI] Format Python code with Black (#21975)
See #21316 and #21311 for the motivation behind these changes. | 29,488 | 0 | 381 | 258 | 52 | 131,233 | 114 | ray | 20 | python/ray/tests/test_advanced_4.py | Python | 57 | {
"docstring": "Test `propagate_jemalloc_env_var`\n If the shared library path is not specified,\n it should return an empty dict.\n \n When the shared library is specified\n \n When the malloc config is specified\n ",
"language": "en",
"n_whitespaces": 51,
"n_words": 28,
"vocab_size": 20
} | https://github.com/ray-project/ray.git |
|
3 | create_userconfig | def create_userconfig(instance, created, raw=False, **kwargs):
if created and not raw:
config = get_config()
UserConfig(user=instance, data=config.DEFAULT_USER_PREFERENCES).save()
#
# REST API
#
| 1636508a6ac8df6b93d0ea5c621c174f605fd47a | 13 | models.py | 71 | Fixes #9156: Fix loading UserConfig data from fixtures | 77,785 | 0 | 37 | 42 | 18 | 264,682 | 20 | netbox | 12 | netbox/users/models.py | Python | 4 | {
"docstring": "\n Automatically create a new UserConfig when a new User is created. Skip this if importing a user from a fixture.\n ",
"language": "en",
"n_whitespaces": 27,
"n_words": 20,
"vocab_size": 16
} | https://github.com/netbox-community/netbox.git |
|
6 | validate_attr | def validate_attr(self, append) -> None:
if append:
existing_fields = getattr(self.attrs, self.kind_attr, None)
if existing_fields is not None and existing_fields != list(self.values):
raise ValueError("appended items do not match existing items in table!")
existing_dtype = getattr(self.attrs, self.dtype_attr, None)
if existing_dtype is not None and existing_dtype != self.dtype:
raise ValueError(
"appended items dtype do not match existing items dtype in table!"
)
| 7d2f9b8d59908fbf57c6453bc41891efbfe981a6 | 12 | pytables.py | 124 | TYP: some return annotations in pytables.py (#47512) | 39,982 | 0 | 181 | 78 | 34 | 167,375 | 59 | pandas | 13 | pandas/io/pytables.py | Python | 11 | {
"docstring": "validate that we have the same order as the existing & same dtype",
"language": "en",
"n_whitespaces": 12,
"n_words": 13,
"vocab_size": 11
} | https://github.com/pandas-dev/pandas.git |
|
2 | load_blocks_from_repo | def load_blocks_from_repo(name, src=None, api_key=None, alias=None, **kwargs):
if src is None:
tokens = name.split(
"/"
) # Separate the source (e.g. "huggingface") from the repo name (e.g. "google/vit-base-patch16-224")
assert (
len(tokens) > 1
), "Either `src` parameter must be provided, or `name` must be formatted as {src}/{repo name}"
src = tokens[0]
name = "/".join(tokens[1:])
assert src.lower() in factory_methods, "parameter: src must be one of {}".format(
factory_methods.keys()
)
blocks: gradio.Blocks = factory_methods[src](name, api_key, alias, **kwargs)
return blocks
| cb2713e7050f2783493736e43a6b704865ce61c5 | 12 | external.py | 167 | Getting Interface.load() working for 2.x and 3.x models and Spaces (#1361)
* version
* refactor for model and 2.x spaces
* fixing tests
* fixed tests
* getting there...
* formatting
* formatting
* fixes
* formatting
* external dependencies working
* formatting
* loading from 3.x
* changes
* wow finally it's working
* fixed formatting
* better error for spaces
* better error for spaces
* fixed 3.x bug
* formatting | 43,144 | 0 | 165 | 104 | 61 | 180,326 | 75 | gradio | 17 | gradio/external.py | Python | 15 | {
"docstring": "Creates and returns a Blocks instance from several kinds of Hugging Face repos:\n 1) A model repo\n 2) A Spaces repo running Gradio 2.x\n 3) A Spaces repo running Gradio 3.x\n ",
"language": "en",
"n_whitespaces": 43,
"n_words": 31,
"vocab_size": 24
} | https://github.com/gradio-app/gradio.git |
|
4 | get_backend_for_dir | def get_backend_for_dir(self, location):
# type: (str) -> Optional[VersionControl]
vcs_backends = {}
for vcs_backend in self._registry.values():
repo_path = vcs_backend.get_repository_root(location)
if not repo_path:
continue
logger.debug('Determine that %s uses VCS: %s',
location, vcs_backend.name)
vcs_backends[repo_path] = vcs_backend
if not vcs_backends:
return None
# Choose the VCS in the inner-most directory. Since all repository
# roots found here would be either `location` or one of its
# parents, the longest path should have the most path components,
# i.e. the backend representing the inner-most repository.
inner_most_repo_path = max(vcs_backends, key=len)
return vcs_backends[inner_most_repo_path]
| f638f5d0e6c8ebed0e69a6584bc7f003ec646580 | 10 | versioncontrol.py | 126 | upd; format | 12,562 | 0 | 257 | 75 | 67 | 61,419 | 86 | transferlearning | 16 | .venv/lib/python3.8/site-packages/pip/_internal/vcs/versioncontrol.py | Python | 13 | {
"docstring": "\n Return a VersionControl object if a repository of that type is found\n at the given directory.\n ",
"language": "en",
"n_whitespaces": 38,
"n_words": 16,
"vocab_size": 15
} | https://github.com/jindongwang/transferlearning.git |
|
1 | _stamp_regen_task | def _stamp_regen_task(task, visitor, **headers):
task.stamp(visitor=visitor, **headers)
return task
| 3a7a82af9588629dad5807e0862bacbbd5d7a7f2 | 8 | canvas.py | 39 | Canvas.py doc enhancement (#7889)
* Enhanced doc for canvas.maybe_unroll_group()
* Enhanced doc for canvas._stamp_regen_task()
* Enhanced doc for canvas._merge_dictionaries() | 52,267 | 0 | 17 | 24 | 8 | 208,258 | 8 | celery | 5 | celery/canvas.py | Python | 3 | {
"docstring": "When stamping a sequence of tasks created by a generator,\n we use this function to stamp each task in the generator\n without exhausting it.",
"language": "en",
"n_whitespaces": 29,
"n_words": 24,
"vocab_size": 23
} | https://github.com/celery/celery.git |
|
2 | manage_matplotlib_context | def manage_matplotlib_context() -> Any:
originalRcParams = matplotlib.rcParams.copy()
# Credits for this style go to the ggplot and seaborn packages.
# We copied the style file to remove dependencies on the Seaborn package.
# Check it out, it's an awesome library for plotting
customRcParams = {
"patch.facecolor": "#348ABD", # blue
"patch.antialiased": True,
"font.size": 10.0,
"figure.edgecolor": "0.50",
# Seaborn common parameters
"figure.facecolor": "white",
"text.color": ".15",
"axes.labelcolor": ".15",
"legend.numpoints": 1,
"legend.scatterpoints": 1,
"xtick.direction": "out",
"ytick.direction": "out",
"xtick.color": ".15",
"ytick.color": ".15",
"axes.axisbelow": True,
"image.cmap": "Greys",
"font.family": ["sans-serif"],
"font.sans-serif": [
"Arial",
"Liberation Sans",
"Bitstream Vera Sans",
"sans-serif",
],
"grid.linestyle": "-",
"lines.solid_capstyle": "round",
# Seaborn darkgrid parameters
# .15 = dark_gray
# .8 = light_gray
"axes.grid": True,
"axes.facecolor": "#EAEAF2",
"axes.edgecolor": "white",
"axes.linewidth": 0,
"grid.color": "white",
# Seaborn notebook context
"figure.figsize": [8.0, 5.5],
"axes.labelsize": 11,
"axes.titlesize": 12,
"xtick.labelsize": 10,
"ytick.labelsize": 10,
"legend.fontsize": 10,
"grid.linewidth": 1,
"lines.linewidth": 1.75,
"patch.linewidth": 0.3,
"lines.markersize": 7,
"lines.markeredgewidth": 0,
"xtick.major.width": 1,
"ytick.major.width": 1,
"xtick.minor.width": 0.5,
"ytick.minor.width": 0.5,
"xtick.major.pad": 7,
"ytick.major.pad": 7,
"backend": "agg",
}
try:
register_matplotlib_converters()
matplotlib.rcParams.update(customRcParams)
sns.set_style(style="white")
yield
finally:
deregister_matplotlib_converters() # revert to original unit registries
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=matplotlib.cbook.mplDeprecation)
matplotlib.rcParams.update(originalRcParams) # revert to original rcParams
| 11e1a8a3fa8d13513fe926b731fb907a066af2a1 | 15 | context.py | 503 | fix: change context managed backend (#1149) | 46,847 | 0 | 662 | 273 | 139 | 191,835 | 184 | ydata-profiling | 19 | src/pandas_profiling/visualisation/context.py | Python | 62 | {
"docstring": "Return a context manager for temporarily changing matplotlib unit registries and rcParams.",
"language": "en",
"n_whitespaces": 11,
"n_words": 12,
"vocab_size": 12
} | https://github.com/ydataai/ydata-profiling.git |
|
1 | test_empty_backend | def test_empty_backend(self) -> None:
yaml_str =
output_error = self.get_errors_from_gen_backend_stubs(yaml_str)
self.assertExpectedInline(output_error, )
| bb5b4cceb6f737448eaaa6817cd773b6f4b0e77d | 8 | test_gen_backend_stubs.py | 47 | Revert "Revert D32498569: allow external backend codegen to toggle whether to generate out= and inplace kernels" (#69950)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/69950
This reverts commit f6cad53443704dfe5a20cc62bee14d91e3bffcaa.
Test Plan: Imported from OSS
Reviewed By: albanD
Differential Revision: D33113545
Pulled By: bdhirsh
fbshipit-source-id: d6590294662588d36c09662dea65919ad4e1e288 | 21,490 | 0 | 32 | 26 | 10 | 102,175 | 11 | pytorch | 6 | tools/test/test_gen_backend_stubs.py | Python | 8 | {
"docstring": "\\\nbackend:\ncpp_namespace: torch_xla\nsupported:\n- absYou must provide a value for \"backend\"",
"language": "en",
"n_whitespaces": 8,
"n_words": 13,
"vocab_size": 13
} | https://github.com/pytorch/pytorch.git |
|
3 | _run_offline_evaluation | def _run_offline_evaluation(self):
assert len(self.workers.local_worker().policy_map) == 1
parallelism = self.evaluation_config.evaluation_num_workers or 1
offline_eval_results = {"off_policy_estimator": {}}
for evaluator_name, offline_evaluator in self.reward_estimators.items():
offline_eval_results["off_policy_estimator"][
evaluator_name
] = offline_evaluator.estimate_on_dataset(
self.evaluation_dataset,
n_parallelism=parallelism,
)
return offline_eval_results
| e368dd9b4e10026767df66d1811a92bd8ca2d8f9 | 12 | algorithm.py | 121 | [RLlib] By-pass Evaluation workers when doing OPE (#30135)
Signed-off-by: Kourosh Hakhamaneshi <[email protected]> | 30,913 | 0 | 150 | 74 | 26 | 136,419 | 30 | ray | 17 | rllib/algorithms/algorithm.py | Python | 12 | {
"docstring": "Runs offline evaluation via `OfflineEvaluator.estimate_on_dataset()` API.\n\n This method will be used when `evaluation_dataset` is provided.\n Note: This will only work if the policy is a single agent policy.\n\n Returns:\n The results dict from the offline evaluation call.\n ",
"language": "en",
"n_whitespaces": 76,
"n_words": 37,
"vocab_size": 31
} | https://github.com/ray-project/ray.git |
|
5 | configure_optimizers | def configure_optimizers(self):
# pylint: disable=assignment-from-none
arc_optimizers = self.configure_architecture_optimizers()
if arc_optimizers is None:
return self.model.configure_optimizers()
if isinstance(arc_optimizers, optim.Optimizer):
arc_optimizers = [arc_optimizers]
self.arc_optim_count = len(arc_optimizers)
# The return values ``frequency`` and ``monitor`` are ignored because lightning requires
# ``len(optimizers) == len(frequency)``, and gradient backword is handled manually.
# For data structure of variables below, please see pytorch lightning docs of ``configure_optimizers``.
w_optimizers, lr_schedulers, self.frequencies, monitor = \
self.trainer._configure_optimizers(self.model.configure_optimizers())
lr_schedulers = self.trainer._configure_schedulers(lr_schedulers, monitor, not self.automatic_optimization)
if any(sch["scheduler"].optimizer not in w_optimizers for sch in lr_schedulers):
raise Exception(
"Some schedulers are attached with an optimizer that wasn't returned from `configure_optimizers`."
)
# variables used to handle optimizer frequency
self.cur_optimizer_step = 0
self.cur_optimizer_index = 0
return arc_optimizers + w_optimizers, lr_schedulers
| 14d2966b9e91ae16dcc39de8f41017a75cec8ff9 | 11 | base_lightning.py | 211 | Valuechoice oneshot lightning (#4602) | 24,584 | 0 | 296 | 130 | 85 | 112,126 | 114 | nni | 24 | nni/retiarii/oneshot/pytorch/base_lightning.py | Python | 17 | {
"docstring": "\n Combine architecture optimizers and user's model optimizers.\n You can overwrite configure_architecture_optimizers if architecture optimizers are needed in your NAS algorithm.\n For now ``self.model`` is tested against :class:`nni.retiarii.evaluator.pytorch.lightning._SupervisedLearningModule`\n and it only returns 1 optimizer.\n But for extendibility, codes for other return value types are also implemented.\n ",
"language": "en",
"n_whitespaces": 88,
"n_words": 45,
"vocab_size": 40
} | https://github.com/microsoft/nni.git |
|
2 | crop | def crop(clip, i, j, h, w):
if len(clip.size()) != 4:
raise ValueError("clip should be a 4D tensor")
return clip[..., i : i + h, j : j + w]
| 289fce29b3e2392114aadbe7a419df0f2e3ac1be | 10 | _functional_video.py | 74 | Replace asserts with exceptions (#5587)
* replace most asserts with exceptions
* fix formating issues
* fix linting and remove more asserts
* fix regresion
* fix regresion
* fix bug
* apply ufmt
* apply ufmt
* fix tests
* fix format
* fix None check
* fix detection models tests
* non scriptable any
* add more checks for None values
* fix retinanet test
* fix retinanet test
* Update references/classification/transforms.py
Co-authored-by: Nicolas Hug <[email protected]>
* Update references/classification/transforms.py
Co-authored-by: Nicolas Hug <[email protected]>
* Update references/optical_flow/transforms.py
Co-authored-by: Nicolas Hug <[email protected]>
* Update references/optical_flow/transforms.py
Co-authored-by: Nicolas Hug <[email protected]>
* Update references/optical_flow/transforms.py
Co-authored-by: Nicolas Hug <[email protected]>
* make value checks more pythonic:
* Update references/optical_flow/transforms.py
Co-authored-by: Nicolas Hug <[email protected]>
* make value checks more pythonic
* make more checks pythonic
* fix bug
* appy ufmt
* fix tracing issues
* fib typos
* fix lint
* remove unecessary f-strings
* fix bug
* Update torchvision/datasets/mnist.py
Co-authored-by: Nicolas Hug <[email protected]>
* Update torchvision/datasets/mnist.py
Co-authored-by: Nicolas Hug <[email protected]>
* Update torchvision/ops/boxes.py
Co-authored-by: Nicolas Hug <[email protected]>
* Update torchvision/ops/poolers.py
Co-authored-by: Nicolas Hug <[email protected]>
* Update torchvision/utils.py
Co-authored-by: Nicolas Hug <[email protected]>
* address PR comments
* Update torchvision/io/_video_opt.py
Co-authored-by: Nicolas Hug <[email protected]>
* Update torchvision/models/detection/generalized_rcnn.py
Co-authored-by: Nicolas Hug <[email protected]>
* Update torchvision/models/feature_extraction.py
Co-authored-by: Nicolas Hug <[email protected]>
* Update torchvision/models/optical_flow/raft.py
Co-authored-by: Nicolas Hug <[email protected]>
* address PR comments
* addressing further pr comments
* fix bug
* remove unecessary else
* apply ufmt
* last pr comment
* replace RuntimeErrors
Co-authored-by: Nicolas Hug <[email protected]> | 46,893 | 0 | 45 | 48 | 24 | 192,419 | 29 | vision | 9 | torchvision/transforms/_functional_video.py | Python | 4 | {
"docstring": "\n Args:\n clip (torch.tensor): Video clip to be cropped. Size is (C, T, H, W)\n ",
"language": "en",
"n_whitespaces": 28,
"n_words": 14,
"vocab_size": 13
} | https://github.com/pytorch/vision.git |
|
7 | binary_crossentropy | def binary_crossentropy(target, output, from_logits=False):
target = tf.convert_to_tensor(target)
output = tf.convert_to_tensor(output)
# Use logits whenever they are available. `softmax` and `sigmoid`
# activations cache logits on the `output` Tensor.
if hasattr(output, "_keras_logits"):
output = output._keras_logits # pylint: disable=protected-access
if from_logits:
warnings.warn(
'"`binary_crossentropy` received `from_logits=True`, but the `output`'
" argument was produced by a sigmoid or softmax activation and thus "
'does not represent logits. Was this intended?"',
stacklevel=2,
)
from_logits = True
if from_logits:
return tf.nn.sigmoid_cross_entropy_with_logits(
labels=target, logits=output
)
if (
not isinstance(output, (tf.__internal__.EagerTensor, tf.Variable))
and output.op.type == "Sigmoid"
) and not hasattr(output, "_keras_history"):
# When sigmoid activation function is used for output operation, we
# use logits from the sigmoid function directly to compute loss in order
# to prevent collapsing zero when training.
assert len(output.op.inputs) == 1
output = output.op.inputs[0]
return tf.nn.sigmoid_cross_entropy_with_logits(
labels=target, logits=output
)
epsilon_ = _constant_to_tensor(epsilon(), output.dtype.base_dtype)
output = tf.clip_by_value(output, epsilon_, 1.0 - epsilon_)
# Compute cross entropy from probabilities.
bce = target * tf.math.log(output + epsilon())
bce += (1 - target) * tf.math.log(1 - output + epsilon())
return -bce
@keras_export("keras.backend.binary_focal_crossentropy")
@tf.__internal__.dispatch.add_dispatch_support
@doc_controls.do_not_generate_docs | 84afc5193d38057e2e2badf9c889ea87d80d8fbf | @keras_export("keras.backend.binary_focal_crossentropy")
@tf.__internal__.dispatch.add_dispatch_support
@doc_controls.do_not_generate_docs | 14 | backend.py | 387 | Reformatting the codebase with black.
PiperOrigin-RevId: 450093126 | 80,219 | 1 | 421 | 222 | 121 | 269,598 | 176 | keras | 37 | keras/backend.py | Python | 31 | {
"docstring": "Binary crossentropy between an output tensor and a target tensor.\n\n Args:\n target: A tensor with the same shape as `output`.\n output: A tensor.\n from_logits: Whether `output` is expected to be a logits tensor.\n By default, we consider that `output`\n encodes a probability distribution.\n\n Returns:\n A tensor.\n ",
"language": "en",
"n_whitespaces": 105,
"n_words": 46,
"vocab_size": 37
} | https://github.com/keras-team/keras.git |
1 | print_help | def print_help(self):
help_text = f
console.print(text=help_text, menu="Custom - Quantitative Analysis")
| 6a66f3f3ed934e0615ff4ba283ee67fcc43d3656 | 9 | qa_controller.py | 54 | Custom data context (#1193)
* Add first iteration of custom context
* Add sample data + improve plot
* Change `head` to `show` with sorting and limit. Add "-x" to plot and dynamic update of completer
* generate random time series for test csv
* Make columns lower case. Check if date is in columns and convert to timestamp. Improve plotting for dates
* Add qa to custom
* Add pred to custom
* Hugooooo
* Testing
* dang whitespace
Co-authored-by: Colin Delahunty <[email protected]>
Co-authored-by: didierlopes.eth <[email protected]> | 83,981 | 0 | 31 | 22 | 10 | 281,704 | 10 | OpenBBTerminal | 9 | gamestonk_terminal/custom/quantitative_analysis/qa_controller.py | Python | 31 | {
"docstring": "Print help[cmds]\n load load new data file\n pick pick target column for analysis[/cmds]\n\n[param]File: [/param]{self.file}\n[param]Target Column: [/param]{self.target}\n[cmds]\n[info]Statistics:[/info]\n summary brief summary statistics of loaded stock.\n normality normality statistics and tests\n unitroot unit root test for stationarity (ADF, KPSS)\n[info]Plots:[/info]\n line line plot of selected target\n hist histogram with density plot\n cdf cumulative distribution function\n bw box and whisker plot\n acf (partial) auto-correlation function differentials of prices\n qqplot residuals against standard normal curve\n[info]Rolling Metrics:[/info]\n rolling rolling mean and std deviation of prices\n spread rolling variance and std deviation of prices\n quantile rolling median and quantile of prices\n skew rolling skewness of distribution of prices\n kurtosis rolling kurtosis of distribution of prices\n[info]Other:[/info]\n raw print raw data\n decompose decomposition in cyclic-trend, season, and residuals of prices\n cusum detects abrupt changes using cumulative sum algorithm of prices[/cmds]\n ",
"language": "en",
"n_whitespaces": 297,
"n_words": 137,
"vocab_size": 89
} | https://github.com/OpenBB-finance/OpenBBTerminal.git |
|
2 | unescape | def unescape(s):
if '&' not in s:
return s
return _charref.sub(_replace_charref, s)
| 8198943edd73a363c266633e1aa5b2a9e9c9f526 | 7 | __init__.py | 40 | add python 3.10.4 for windows | 54,879 | 0 | 28 | 23 | 11 | 217,668 | 12 | XX-Net | 5 | python3.10.4/Lib/html/__init__.py | Python | 4 | {
"docstring": "\n Convert all named and numeric character references (e.g. >, >,\n &x3e;) in the string s to the corresponding unicode characters.\n This function uses the rules defined by the HTML 5 standard\n for both valid and invalid character references, and the list of\n HTML 5 named character references defined in html.entities.html5.\n ",
"language": "en",
"n_whitespaces": 69,
"n_words": 50,
"vocab_size": 36
} | https://github.com/XX-net/XX-Net.git |
|
4 | upsample_conv_2d | def upsample_conv_2d(x, w, k=None, factor=2, gain=1, data_format='NCHW', impl='cuda'):
r
assert isinstance(factor, int) and factor >= 1
# Check weight shape.
w = tf.convert_to_tensor(w)
assert w.shape.rank == 4
convH = w.shape[0].value
convW = w.shape[1].value
inC = _shape(w, 2)
outC = _shape(w, 3)
assert convW == convH
# Setup filter kernel.
if k is None:
k = [1] * factor
k = _setup_kernel(k) * (gain * (factor ** 2))
p = (k.shape[0] - factor) - (convW - 1)
# Determine data dimensions.
if data_format == 'NCHW':
stride = [1, 1, factor, factor]
output_shape = [_shape(x, 0), outC, (_shape(x, 2) - 1) * factor + convH, (_shape(x, 3) - 1) * factor + convW]
num_groups = _shape(x, 1) // inC
else:
stride = [1, factor, factor, 1]
output_shape = [_shape(x, 0), (_shape(x, 1) - 1) * factor + convH, (_shape(x, 2) - 1) * factor + convW, outC]
num_groups = _shape(x, 3) // inC
# Transpose weights.
w = tf.reshape(w, [convH, convW, inC, num_groups, -1])
w = tf.transpose(w[::-1, ::-1], [0, 1, 4, 3, 2])
w = tf.reshape(w, [convH, convW, -1, num_groups * inC])
# Execute.
x = tf.nn.conv2d_transpose(x, w, output_shape=output_shape, strides=stride, padding='VALID', data_format=data_format)
return _simple_upfirdn_2d(x, k, pad0=(p+1)//2+factor-1, pad1=p//2+1, data_format=data_format, impl=impl)
#----------------------------------------------------------------------------
| 7375ee364e0df2a417f92593e09557f1b2a3575a | 16 | upfirdn_2d.py | 602 | initialize ostec | 1,607 | 0 | 317 | 387 | 110 | 9,407 | 198 | insightface | 34 | reconstruction/ostec/external/stylegan2/dnnlib/tflib/ops/upfirdn_2d.py | Python | 48 | {
"docstring": "Fused `upsample_2d()` followed by `tf.nn.conv2d()`.\n\n Padding is performed only once at the beginning, not between the operations.\n The fused op is considerably more efficient than performing the same calculation\n using standard TensorFlow ops. It supports gradients of arbitrary order.\n\n Args:\n x: Input tensor of the shape `[N, C, H, W]` or `[N, H, W, C]`.\n w: Weight tensor of the shape `[filterH, filterW, inChannels, outChannels]`.\n Grouped convolution can be performed by `inChannels = x.shape[0] // numGroups`.\n k: FIR filter of the shape `[firH, firW]` or `[firN]` (separable).\n The default is `[1] * factor`, which corresponds to nearest-neighbor\n upsampling.\n factor: Integer upsampling factor (default: 2).\n gain: Scaling factor for signal magnitude (default: 1.0).\n data_format: `'NCHW'` or `'NHWC'` (default: `'NCHW'`).\n impl: Name of the implementation to use. Can be `\"ref\"` or `\"cuda\"` (default).\n\n Returns:\n Tensor of the shape `[N, C, H * factor, W * factor]` or\n `[N, H * factor, W * factor, C]`, and same datatype as `x`.\n ",
"language": "en",
"n_whitespaces": 358,
"n_words": 158,
"vocab_size": 114
} | https://github.com/deepinsight/insightface.git |
|
1 | get_assets | def get_assets(filters):
return frappe.db.sql(
,
{"to_date": filters.to_date, "from_date": filters.from_date, "company": filters.company},
as_dict=1,
)
| 494bd9ef78313436f0424b918f200dab8fc7c20b | 10 | asset_depreciations_and_balances.py | 64 | style: format code with black | 13,808 | 0 | 7 | 39 | 13 | 65,150 | 13 | erpnext | 9 | erpnext/accounts/report/asset_depreciations_and_balances/asset_depreciations_and_balances.py | Python | 49 | {
"docstring": "\n\t\tSELECT results.asset_category,\n\t\t\t sum(results.accumulated_depreciation_as_on_from_date) as accumulated_depreciation_as_on_from_date,\n\t\t\t sum(results.depreciation_eliminated_during_the_period) as depreciation_eliminated_during_the_period,\n\t\t\t sum(results.depreciation_amount_during_the_period) as depreciation_amount_during_the_period\n\t\tfrom (SELECT a.asset_category,\n\t\t\t\t ifnull(sum(case when ds.schedule_date < %(from_date)s and (ifnull(a.disposal_date, 0) = 0 or a.disposal_date >= %(from_date)s) then\n\t\t\t\t\t\t\t\t ds.depreciation_amount\n\t\t\t\t\t\t\t else\n\t\t\t\t\t\t\t\t 0\n\t\t\t\t\t\t\t end), 0) as accumulated_depreciation_as_on_from_date,\n\t\t\t\t ifnull(sum(case when ifnull(a.disposal_date, 0) != 0 and a.disposal_date >= %(from_date)s\n\t\t\t\t\t\t\t\t\t\tand a.disposal_date <= %(to_date)s and ds.schedule_date <= a.disposal_date then\n\t\t\t\t\t\t\t\t ds.depreciation_amount\n\t\t\t\t\t\t\t else\n\t\t\t\t\t\t\t\t 0\n\t\t\t\t\t\t\t end), 0) as depreciation_eliminated_during_the_period,\n\t\t\t\t ifnull(sum(case when ds.schedule_date >= %(from_date)s and ds.schedule_date <= %(to_date)s\n\t\t\t\t\t\t\t\t\t\tand (ifnull(a.disposal_date, 0) = 0 or ds.schedule_date <= a.disposal_date) then\n\t\t\t\t\t\t\t\t ds.depreciation_amount\n\t\t\t\t\t\t\t else\n\t\t\t\t\t\t\t\t 0\n\t\t\t\t\t\t\t end), 0) as depreciation_amount_during_the_period\n\t\t\tfrom `tabAsset` a, `tabDepreciation Schedule` ds\n\t\t\twhere a.docstatus=1 and a.company=%(company)s and a.purchase_date <= %(to_date)s and a.name = ds.parent and ifnull(ds.journal_entry, '') != ''\n\t\t\tgroup by a.asset_category\n\t\t\tunion\n\t\t\tSELECT a.asset_category,\n\t\t\t\t ifnull(sum(case when ifnull(a.disposal_date, 0) != 0 and (a.disposal_date < %(from_date)s or a.disposal_date > %(to_date)s) then\n\t\t\t\t\t\t\t\t\t0\n\t\t\t\t\t\t\t else\n\t\t\t\t\t\t\t\t\ta.opening_accumulated_depreciation\n\t\t\t\t\t\t\t end), 0) as accumulated_depreciation_as_on_from_date,\n\t\t\t\t ifnull(sum(case when a.disposal_date >= %(from_date)s and a.disposal_date <= %(to_date)s then\n\t\t\t\t\t\t\t\t a.opening_accumulated_depreciation\n\t\t\t\t\t\t\t else\n\t\t\t\t\t\t\t\t 0\n\t\t\t\t\t\t\t end), 0) as depreciation_eliminated_during_the_period,\n\t\t\t\t 0 as depreciation_amount_during_the_period\n\t\t\tfrom `tabAsset` a\n\t\t\twhere a.docstatus=1 and a.company=%(company)s and a.purchase_date <= %(to_date)s\n\t\t\tgroup by a.asset_category) as results\n\t\tgroup by results.asset_category\n\t\t",
"language": "en",
"n_whitespaces": 209,
"n_words": 178,
"vocab_size": 61
} | https://github.com/frappe/erpnext.git |
|
5 | _get_or_create | def _get_or_create(self, s, name=None, dtype=None, broadcastable=None):
# Defaults
if name is None:
name = s.name
if dtype is None:
dtype = 'floatX'
if broadcastable is None:
broadcastable = ()
key = self._get_key(s, name, dtype=dtype, broadcastable=broadcastable)
if key in self.cache:
return self.cache[key]
value = aet.tensor(name=name, dtype=dtype, shape=broadcastable)
self.cache[key] = value
return value
| 68bd82de645a61f4bbc0b6246e70959373c9cba2 | 9 | aesaracode.py | 164 | fix(printing): change Aesara argument broadcastable to shape | 49,056 | 0 | 165 | 107 | 30 | 198,878 | 51 | sympy | 13 | sympy/printing/aesaracode.py | Python | 13 | {
"docstring": "\n Get the Aesara variable for a SymPy symbol from the cache, or create it\n if it does not exist.\n ",
"language": "en",
"n_whitespaces": 41,
"n_words": 19,
"vocab_size": 17
} | https://github.com/sympy/sympy.git |
|
4 | get_downstream_powerports | def get_downstream_powerports(self, leg=None):
poweroutlets = self.poweroutlets.filter(cable__isnull=False)
if leg:
poweroutlets = poweroutlets.filter(feed_leg=leg)
if not poweroutlets:
return PowerPort.objects.none()
q = Q()
for poweroutlet in poweroutlets:
q |= Q(
cable=poweroutlet.cable,
cable_end=poweroutlet.opposite_cable_end
)
return PowerPort.objects.filter(q)
| fcd1daaf798d62023f999c3e09e035f7b3f47c8f | 12 | device_components.py | 132 | Update power utilization calculations for new cabling model | 78,026 | 0 | 154 | 82 | 24 | 265,204 | 31 | netbox | 16 | netbox/dcim/models/device_components.py | Python | 13 | {
"docstring": "\n Return a queryset of all PowerPorts connected via cable to a child PowerOutlet.\n ",
"language": "en",
"n_whitespaces": 28,
"n_words": 13,
"vocab_size": 12
} | https://github.com/netbox-community/netbox.git |
|
2 | call_news | def call_news(self, other_args):
parser = argparse.ArgumentParser(
prog="news",
add_help=False,
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
description=,
)
parser.add_argument(
"-l",
"--limit",
dest="limit",
type=check_positive,
help="display N number records",
default=10,
)
parser.add_argument(
"-k",
"--kind",
dest="kind",
type=str,
help="Filter by category of news. Available values: news or media.",
default="news",
choices=cryptopanic_model.CATEGORIES,
)
parser.add_argument(
"-f",
"--filter",
dest="filter",
type=str,
help="Filter by kind of news. One from list: rising|hot|bullish|bearish|important|saved|lol",
default=None,
required=False,
choices=cryptopanic_model.FILTERS,
)
parser.add_argument(
"-r",
"--region",
dest="region",
type=str,
help="Filter news by regions. Available regions are: en (English), de (Deutsch), nl (Dutch), es (Espaรฑol), "
"fr (Franรงais), it (Italiano), pt (Portuguรชs), ru (ะ ัััะบะธะน)",
default="en",
choices=cryptopanic_model.REGIONS,
)
parser.add_argument(
"-s",
"--sort",
dest="sortby",
type=str,
help="Sort by given column. Default: published_at",
default="published_at",
choices=cryptopanic_model.SORT_FILTERS,
)
parser.add_argument(
"--descend",
action="store_false",
help="Flag to sort in descending order (lowest first)",
dest="descend",
default=True,
)
parser.add_argument(
"-u",
"--urls",
dest="urls",
action="store_false",
help="Flag to disable urls. If you will use the flag you will hide the column with urls",
default=True,
)
ns_parser = parse_known_args_and_warn(
parser, other_args, EXPORT_ONLY_RAW_DATA_ALLOWED
)
if ns_parser:
cryptopanic_view.display_news(
top=ns_parser.limit,
source=self.source,
currency=self.coin,
export=ns_parser.export,
descend=ns_parser.descend,
post_kind=ns_parser.kind,
filter_=ns_parser.filter,
region=ns_parser.region,
)
| e59a30b18873f7449bc59a88c3da21894e0dbe0a | 11 | dd_controller.py | 480 | Add crypto DD commands (#1710)
* Add github activity over time
* Create tests
* Update default days in chart command
* Add san package to poetry
* Fix tests failed
* Generate fixtures
* Fix tests failed
* Remove sanpy package and use requests instead
* Adjust index
* Add hugo server
* Fix datetime
* Update tests
* Revert "Update tests"
This reverts commit ffe03a7224cd830a14d2f425d7d59f00a10f27ac.
* Fix tests
* Regenerate cassettes & filter api tokens
* Fix windows issues
* Fix PR comments
* Pass tests & fix comments | 84,695 | 0 | 1,015 | 301 | 126 | 284,320 | 161 | OpenBBTerminal | 43 | openbb_terminal/cryptocurrency/due_diligence/dd_controller.py | Python | 83 | {
"docstring": "Process news commandDisplay most recent news on the given coin from CryptoPanic aggregator platform.\n [Source: https://cryptopanic.com/]",
"language": "en",
"n_whitespaces": 26,
"n_words": 16,
"vocab_size": 15
} | https://github.com/OpenBB-finance/OpenBBTerminal.git |
|
6 | make_layoutgrids_gs | def make_layoutgrids_gs(layoutgrids, gs):
if gs in layoutgrids or gs.figure is None:
return layoutgrids
# in order to do constrained_layout there has to be at least *one*
# gridspec in the tree:
layoutgrids['hasgrids'] = True
if not hasattr(gs, '_subplot_spec'):
# normal gridspec
parent = layoutgrids[gs.figure]
layoutgrids[gs] = mlayoutgrid.LayoutGrid(
parent=parent,
parent_inner=True,
name='gridspec',
ncols=gs._ncols, nrows=gs._nrows,
width_ratios=gs.get_width_ratios(),
height_ratios=gs.get_height_ratios())
else:
# this is a gridspecfromsubplotspec:
subplot_spec = gs._subplot_spec
parentgs = subplot_spec.get_gridspec()
# if a nested gridspec it is possible the parent is not in there yet:
if parentgs not in layoutgrids:
layoutgrids = make_layoutgrids_gs(layoutgrids, parentgs)
subspeclb = layoutgrids[parentgs]
# get a unique representation:
rep = object.__repr__(gs) + 'top'
# gridspecfromsubplotspec need an outer container:
if rep not in layoutgrids:
layoutgrids[rep] = mlayoutgrid.LayoutGrid(
parent=subspeclb,
name='top',
nrows=1, ncols=1,
parent_pos=(subplot_spec.rowspan, subplot_spec.colspan))
layoutgrids[gs] = mlayoutgrid.LayoutGrid(
parent=layoutgrids[rep],
name='gridspec',
nrows=gs._nrows, ncols=gs._ncols,
width_ratios=gs.get_width_ratios(),
height_ratios=gs.get_height_ratios())
return layoutgrids
| c682ca40c647770a967b6b8a7615eb91c7cb3fc9 | 16 | _constrained_layout.py | 361 | FIX: better repr for subgridspecs | 22,565 | 0 | 510 | 230 | 80 | 107,046 | 134 | matplotlib | 29 | lib/matplotlib/_constrained_layout.py | Python | 33 | {
"docstring": "\n Make the layoutgrid for a gridspec (and anything nested in the gridspec)\n ",
"language": "en",
"n_whitespaces": 19,
"n_words": 12,
"vocab_size": 11
} | https://github.com/matplotlib/matplotlib.git |
|
10 | data_received | def data_received(self, data):
if self._sslpipe is None:
# transport closing, sslpipe is destroyed
return
try:
ssldata, appdata = self._sslpipe.feed_ssldata(data)
except (SystemExit, KeyboardInterrupt):
raise
except BaseException as e:
self._fatal_error(e, 'SSL error in data received')
return
for chunk in ssldata:
self._transport.write(chunk)
for chunk in appdata:
if chunk:
try:
if self._app_protocol_is_buffer:
protocols._feed_data_to_buffered_proto(
self._app_protocol, chunk)
else:
self._app_protocol.data_received(chunk)
except (SystemExit, KeyboardInterrupt):
raise
except BaseException as ex:
self._fatal_error(
ex, 'application protocol failed to receive SSL data')
return
else:
self._start_shutdown()
break
| 8198943edd73a363c266633e1aa5b2a9e9c9f526 | 17 | sslproto.py | 217 | add python 3.10.4 for windows | 56,109 | 0 | 488 | 130 | 55 | 220,737 | 74 | XX-Net | 21 | python3.10.4/Lib/asyncio/sslproto.py | Python | 29 | {
"docstring": "Called when some SSL data is received.\n\n The argument is a bytes object.\n ",
"language": "en",
"n_whitespaces": 27,
"n_words": 13,
"vocab_size": 12
} | https://github.com/XX-net/XX-Net.git |
|
3 | make_increasing_candle | def make_increasing_candle(open, high, low, close, dates, **kwargs):
increase_x, increase_y = _Candlestick(
open, high, low, close, dates, **kwargs
).get_candle_increase()
if "line" in kwargs:
kwargs.setdefault("fillcolor", kwargs["line"]["color"])
else:
kwargs.setdefault("fillcolor", _DEFAULT_INCREASING_COLOR)
if "name" in kwargs:
kwargs.setdefault("showlegend", True)
else:
kwargs.setdefault("showlegend", False)
kwargs.setdefault("name", "Increasing")
kwargs.setdefault("line", dict(color=_DEFAULT_INCREASING_COLOR))
candle_incr_data = dict(
type="box",
x=increase_x,
y=increase_y,
whiskerwidth=0,
boxpoints=False,
**kwargs,
)
return [candle_incr_data]
| 43e3a4011080911901176aab919c0ecf5046ddd3 | 12 | _candlestick.py | 237 | switch to black .22 | 57,816 | 0 | 165 | 145 | 41 | 226,141 | 52 | plotly.py | 21 | packages/python/plotly/plotly/figure_factory/_candlestick.py | Python | 23 | {
"docstring": "\n Makes boxplot trace for increasing candlesticks\n\n _make_increasing_candle() and _make_decreasing_candle separate the\n increasing traces from the decreasing traces so kwargs (such as\n color) can be passed separately to increasing or decreasing traces\n when direction is set to 'increasing' or 'decreasing' in\n FigureFactory.create_candlestick()\n\n :param (list) open: opening values\n :param (list) high: high values\n :param (list) low: low values\n :param (list) close: closing values\n :param (list) dates: list of datetime objects. Default: None\n :param kwargs: kwargs to be passed to increasing trace via\n plotly.graph_objs.Scatter.\n\n :rtype (list) candle_incr_data: list of the box trace for\n increasing candlesticks.\n ",
"language": "en",
"n_whitespaces": 149,
"n_words": 92,
"vocab_size": 58
} | https://github.com/plotly/plotly.py.git |
|
4 | normalize_span_histogram_resutls | def normalize_span_histogram_resutls(span, histogram_params, results):
histogram_column = get_span_histogram_column(span, histogram_params)
bin_name = get_function_alias(histogram_column)
# zerofill and rename the columns while making sure to adjust for precision
bucket_map = {}
for row in results["data"]:
# we expect the bin the be an integer, this is because all floating
# point values are rounded during the calculation
bucket = int(row[bin_name])
bucket_map[bucket] = row["count"]
new_data = []
for i in range(histogram_params.num_buckets):
bucket = histogram_params.start_offset + histogram_params.bucket_size * i
row = {"bin": bucket, "count": bucket_map.get(bucket, 0)}
if histogram_params.multiplier > 1:
row["bin"] /= float(histogram_params.multiplier)
new_data.append(row)
return new_data
| 6c49c2ff46496809d6620ac3746262c66f02142e | 13 | discover.py | 203 | ref(spans): Normalize exclusive time histogram results (#32762)
* ref(spans): Normalize exclusive time histogram results
* test normalized data | 19,394 | 0 | 184 | 124 | 71 | 97,246 | 90 | sentry | 22 | src/sentry/snuba/discover.py | Python | 15 | {
"docstring": "\n Normalizes the span histogram results by renaming the columns to key and bin\n and make sure to zerofill any missing values.\n\n :param [Span] span: The span for which you want to generate the\n histograms for.\n :param HistogramParams histogram_params: The histogram parameters used.\n :param any results: The results from the histogram query that may be missing\n bins and needs to be normalized.\n ",
"language": "en",
"n_whitespaces": 94,
"n_words": 61,
"vocab_size": 42
} | https://github.com/getsentry/sentry.git |
|
1 | round | def round(self, decimals=0):
from dask.array.routines import round
return round(self, decimals=decimals)
| 2820bae493a49cb1d0a6e376985c5473b8f04fa8 | 8 | core.py | 42 | Don't include docs in ``Array`` methods, just refer to module docs (#9244)
Co-authored-by: James Bourbeau <[email protected]> | 36,752 | 0 | 31 | 27 | 9 | 156,742 | 10 | dask | 6 | dask/array/core.py | Python | 3 | {
"docstring": "Return array with each element rounded to the given number of decimals.\n\n Refer to :func:`dask.array.round` for full documentation.\n\n See Also\n --------\n dask.array.round : equivalent function\n ",
"language": "en",
"n_whitespaces": 60,
"n_words": 25,
"vocab_size": 24
} | https://github.com/dask/dask.git |
|
1 | test_encoding_latin1_118 | def test_encoding_latin1_118(self, datapath):
# GH 25960
msg =
with tm.assert_produces_warning(UnicodeWarning) as w:
encoded = read_stata(
datapath("io", "data", "stata", "stata1_encoding_118.dta")
)
assert len(w) == 151
assert w[0].message.args[0] == msg
expected = DataFrame([["Dรผsseldorf"]] * 151, columns=["kreis1849"])
tm.assert_frame_equal(encoded, expected)
| c055dc4e6be9fc1b68d873a1ace286322dadd5e1 | 13 | test_stata.py | 141 | TST: Don't use autouse fixture in test_stata (#45831) | 39,577 | 0 | 130 | 82 | 31 | 164,632 | 36 | pandas | 17 | pandas/tests/io/test_stata.py | Python | 14 | {
"docstring": "\nOne or more strings in the dta file could not be decoded using utf-8, and\nso the fallback encoding of latin-1 is being used. This can happen when a file\nhas been incorrectly encoded by Stata or some other software. You should verify\nthe string values returned are correct.",
"language": "en",
"n_whitespaces": 46,
"n_words": 49,
"vocab_size": 45
} | https://github.com/pandas-dev/pandas.git |
|
1 | locator | def locator(self, loc):
self._long_axis().set_major_locator(loc)
self._locator = loc
| 6010bb43ed01c48c7c403569dd210490b236a853 | 9 | colorbar.py | 40 | MNT: make colorbars locators and formatters properties | 22,709 | 0 | 28 | 23 | 7 | 107,364 | 7 | matplotlib | 6 | lib/matplotlib/colorbar.py | Python | 3 | {
"docstring": "\n Set the major locator being used for colorbar\n ",
"language": "en",
"n_whitespaces": 23,
"n_words": 8,
"vocab_size": 8
} | https://github.com/matplotlib/matplotlib.git |
|
1 | test_removing_entity_unavailable | async def test_removing_entity_unavailable(hass):
entry = er.RegistryEntry(
entity_id="hello.world",
unique_id="test-unique-id",
platform="test-platform",
disabled_by=None,
)
ent = entity.Entity()
ent.hass = hass
ent.entity_id = "hello.world"
ent.registry_entry = entry
ent.async_write_ha_state()
state = hass.states.get("hello.world")
assert state is not None
assert state.state == STATE_UNKNOWN
await ent.async_remove()
state = hass.states.get("hello.world")
assert state is not None
assert state.state == STATE_UNAVAILABLE
| 26a85c6644991f626ccce62c05665095c2577234 | 10 | test_entity.py | 178 | Add Entity.has_entity_name attribute (#73217) | 113,341 | 0 | 123 | 104 | 31 | 314,737 | 50 | core | 20 | tests/helpers/test_entity.py | Python | 19 | {
"docstring": "Test removing an entity that is still registered creates an unavailable state.",
"language": "en",
"n_whitespaces": 11,
"n_words": 12,
"vocab_size": 11
} | https://github.com/home-assistant/core.git |
|
30 | capacity_values | def capacity_values(self, qs=None, tasks=None, breakdown=False, graph=None):
if qs is None: # Optionally BYOQS - bring your own queryset
qs = self.all().prefetch_related('instances')
instance_ig_mapping, ig_ig_mapping = self.capacity_mapping(qs=qs)
if tasks is None:
tasks = self.model.unifiedjob_set.related.related_model.objects.filter(status__in=('running', 'waiting'))
if graph is None:
graph = {group.name: {} for group in qs}
for group_name in graph:
self.zero_out_group(graph, group_name, breakdown)
for t in tasks:
# TODO: dock capacity for isolated job management tasks running in queue
impact = t.task_impact
control_groups = []
if t.controller_node:
control_groups = instance_ig_mapping.get(t.controller_node, [])
if not control_groups:
logger.warn(f"No instance group found for {t.controller_node}, capacity consumed may be innaccurate.")
if t.status == 'waiting' or (not t.execution_node and not t.is_container_group_task):
# Subtract capacity from any peer groups that share instances
if not t.instance_group:
impacted_groups = []
elif t.instance_group.name not in ig_ig_mapping:
# Waiting job in group with 0 capacity has no collateral impact
impacted_groups = [t.instance_group.name]
else:
impacted_groups = ig_ig_mapping[t.instance_group.name]
for group_name in impacted_groups:
if group_name not in graph:
self.zero_out_group(graph, group_name, breakdown)
graph[group_name]['consumed_capacity'] += impact
capacity_type = get_capacity_type(t)
graph[group_name][f'consumed_{capacity_type}_capacity'] += impact
if breakdown:
graph[group_name]['committed_capacity'] += impact
for group_name in control_groups:
if group_name not in graph:
self.zero_out_group(graph, group_name, breakdown)
graph[group_name][f'consumed_control_capacity'] += settings.AWX_CONTROL_NODE_TASK_IMPACT
if breakdown:
graph[group_name]['committed_capacity'] += settings.AWX_CONTROL_NODE_TASK_IMPACT
elif t.status == 'running':
# Subtract capacity from all groups that contain the instance
if t.execution_node not in instance_ig_mapping:
if not t.is_container_group_task:
logger.warning('Detected %s running inside lost instance, ' 'may still be waiting for reaper.', t.log_format)
if t.instance_group:
impacted_groups = [t.instance_group.name]
else:
impacted_groups = []
else:
impacted_groups = instance_ig_mapping[t.execution_node]
for group_name in impacted_groups:
if group_name not in graph:
self.zero_out_group(graph, group_name, breakdown)
graph[group_name]['consumed_capacity'] += impact
capacity_type = get_capacity_type(t)
graph[group_name][f'consumed_{capacity_type}_capacity'] += impact
if breakdown:
graph[group_name]['running_capacity'] += impact
for group_name in control_groups:
if group_name not in graph:
self.zero_out_group(graph, group_name, breakdown)
graph[group_name][f'consumed_control_capacity'] += settings.AWX_CONTROL_NODE_TASK_IMPACT
if breakdown:
graph[group_name]['running_capacity'] += settings.AWX_CONTROL_NODE_TASK_IMPACT
else:
logger.error('Programming error, %s not in ["running", "waiting"]', t.log_format)
return graph
| 604cbc17376620dc67df35386421835d43732a4e | 18 | managers.py | 817 | Consume control capacity (#11665)
* Select control node before start task
Consume capacity on control nodes for controlling tasks and consider
remainging capacity on control nodes before selecting them.
This depends on the requirement that control and hybrid nodes should all
be in the instance group named 'controlplane'. Many tests do not satisfy that
requirement. I'll update the tests in another commit.
* update tests to use controlplane
We don't start any tasks if we don't have a controlplane instance group
Due to updates to fixtures, update tests to set node type and capacity
explicitly so they get expected result.
* Fixes for accounting of control capacity consumed
Update method is used to account for currently consumed capacity for
instance groups in the in-memory capacity tracking data structure we initialize in
after_lock_init and then update via calculate_capacity_consumed (both in
task_manager.py)
Also update fit_task_to_instance to consider control impact on instances
Trust that these functions do the right thing looking for a
node with capacity, and cut out redundant check for the whole group's
capacity per Alan's reccomendation.
* Refactor now redundant code
Deal with control type tasks before we loop over the preferred instance
groups, which cuts out the need for some redundant logic.
Also, fix a bug where I was missing assigning the execution node in one case!
* set job explanation on tasks that need capacity
move the job explanation for jobs that need capacity to a function
so we can re-use it in the three places we need it.
* project updates always run on the controlplane
Instance group ordering makes no sense on project updates because they
always need to run on the control plane.
Also, since hybrid nodes should always run the control processes for the
jobs running on them as execution nodes, account for this when looking for a
execution node.
* fix misleading message
the variables and wording were both misleading, fix to be more accurate
description in the two different cases where this log may be emitted.
* use settings correctly
use settings.DEFAULT_CONTROL_PLANE_QUEUE_NAME instead of a hardcoded
name
cache the controlplane_ig object during the after lock init to avoid
an uneccesary query
eliminate mistakenly duplicated AWX_CONTROL_PLANE_TASK_IMPACT and use
only AWX_CONTROL_NODE_TASK_IMPACT
* add test for control capacity consumption
add test to verify that when there are 2 jobs and only capacity for one
that one will move into waiting and the other stays in pending
* add test for hybrid node capacity consumption
assert that the hybrid node is used for both control and execution and
capacity is deducted correctly
* add test for task.capacity_type = control
Test that control type tasks have the right capacity consumed and
get assigned to the right instance group
Also fix lint in the tests
* jobs_running not accurate for control nodes
We can either NOT use "idle instances" for control nodes, or we need
to update the jobs_running property on the Instance model to count
jobs where the node is the controller_node.
I didn't do that because it may be an expensive query, and it would be
hard to make it match with jobs_running on the InstanceGroup which
filters on tasks assigned to the instance group.
This change chooses to stop considering "idle" control nodes an option,
since we can't acurrately identify them.
The way things are without any change, is we are continuing to over consume capacity on control nodes
because this method sees all control nodes as "idle" at the beginning
of the task manager run, and then only counts jobs started in that run
in the in-memory tracking. So jobs which last over a number of task
manager runs build up consuming capacity, which is accurately reported
via Instance.consumed_capacity
* Reduce default task impact for control nodes
This is something we can experiment with as far as what users
want at install time, but start with just 1 for now.
* update capacity docs
Describe usage of the new setting and the concept of control impact.
Co-authored-by: Alan Rominger <[email protected]>
Co-authored-by: Rebeccah <[email protected]> | 17,078 | 0 | 1,412 | 503 | 129 | 80,597 | 296 | awx | 42 | awx/main/managers.py | Python | 65 | {
"docstring": "\n Returns a dictionary of capacity values for all IGs\n ",
"language": "en",
"n_whitespaces": 24,
"n_words": 9,
"vocab_size": 9
} | https://github.com/ansible/awx.git |
|
1 | test_all_no_duplicate_names | def test_all_no_duplicate_names(self, gp_mock, glob_mock):
fixture_path = os.path.join(os.path.dirname(__file__), 'loader_fixtures')
gp_mock.return_value = [
fixture_path,
'/path/to'
]
glob_mock.glob.side_effect = [
[os.path.join(fixture_path, 'import_fixture.py')],
['/path/to/import_fixture.py']
]
pl = PluginLoader('test', '', 'test', 'test_plugins')
# Aside from needing ``list()`` so we can do a len, ``PluginLoader.all`` returns a generator
# so ``list()`` actually causes ``PluginLoader.all`` to run.
plugins = list(pl.all())
self.assertEqual(len(plugins), 1)
self.assertIn(os.path.join(fixture_path, 'import_fixture.py'), pl._module_cache)
self.assertNotIn('/path/to/import_fixture.py', pl._module_cache)
| 4260b71cc77b7a44e061668d0d408d847f550156 | 11 | test_plugins.py | 209 | refactor and fixes for doc parsing (#77719)
* refactor and remove redundant code in documentation
allow location and building api to be more accessible
fix issues with displaying ansible.legacy and ansible.builtin
ensure we don't x2 process tokens (some modules reference them also) fixes #77764
move to constants vs hardcoded
more informative errors and comments
now have actual filter/test plugins, which expose the filter/test functions
moved filter/test loading/finding logic into jinja2pluginloader, removed dupe implementations
added tests for case in which we unique by basename when listing
Update lib/ansible/utils/plugin_docs.py
Co-authored-by: Sloane Hertel <[email protected]> | 79,491 | 0 | 195 | 124 | 48 | 268,361 | 60 | ansible | 23 | test/units/plugins/test_plugins.py | Python | 15 | {
"docstring": "\n This test goes along with ``test__load_module_source_no_duplicate_names``\n and ensures that we ignore duplicate imports on multiple paths\n ",
"language": "en",
"n_whitespaces": 38,
"n_words": 16,
"vocab_size": 16
} | https://github.com/ansible/ansible.git |
|
1 | binary_matches | def binary_matches(y_true, y_pred, threshold=0.5):
y_pred = tf.convert_to_tensor(y_pred)
threshold = tf.cast(threshold, y_pred.dtype)
y_pred = tf.cast(y_pred > threshold, y_pred.dtype)
return tf.cast(tf.equal(y_true, y_pred), tf.int8) | 119cd4655d01570a70c70879dff4461ea46161bf | 9 | metrics_utils.py | 98 | Added util metric method for binary_matches. Decoupled from public metric binarry_acc | 79,806 | 0 | 26 | 66 | 17 | 268,987 | 21 | keras | 10 | keras/utils/metrics_utils.py | Python | 5 | {
"docstring": "Creates int Tensor, 1 for label-prediction match, 0 for mismatch.\n\n Args:\n y_true: Ground truth values. shape = `[batch_size, d0, .. dN]`.\n y_pred: The predicted values. shape = `[batch_size, d0, .. dN]`.\n threshold: (Optional) Float representing the threshold for deciding whether\n prediction values are 1 or 0.\n\n Returns:\n Binary matches. shape = `[batch_size, d0, .. dN]`\n ",
"language": "en",
"n_whitespaces": 75,
"n_words": 55,
"vocab_size": 40
} | https://github.com/keras-team/keras.git |
|
7 | get_matrix | def get_matrix(self):
from sympy.matrices.dense import Matrix
deprecate_data()
with ignore_warnings(SymPyDeprecationWarning):
if 0 < self.rank <= 2:
rows = self.data.shape[0]
columns = self.data.shape[1] if self.rank == 2 else 1
if self.rank == 2:
mat_list = [] * rows
for i in range(rows):
mat_list.append([])
for j in range(columns):
mat_list[i].append(self[i, j])
else:
mat_list = [None] * rows
for i in range(rows):
mat_list[i] = self[i]
return Matrix(mat_list)
else:
raise NotImplementedError(
"missing multidimensional reduction to matrix.")
| cba899d4137b0b65f6850120ee42cd4fcd4f9dbf | 18 | tensor.py | 235 | Update the various tensor deprecations | 48,346 | 0 | 401 | 148 | 49 | 197,113 | 70 | sympy | 20 | sympy/tensor/tensor.py | Python | 21 | {
"docstring": "\n DEPRECATED: do not use.\n\n Returns ndarray components data as a matrix, if components data are\n available and ndarray dimension does not exceed 2.\n ",
"language": "en",
"n_whitespaces": 52,
"n_words": 23,
"vocab_size": 19
} | https://github.com/sympy/sympy.git |
|
1 | test_device_stats_gpu_from_torch | def test_device_stats_gpu_from_torch(tmpdir):
model = BoringModel()
device_stats = DeviceStatsMonitor()
| b56d8677ad0ff8513e566334f4a78a24b88480c3 | 8 | test_device_stats_monitor.py | 31 | Update test_pruning.py to use `devices` instead of `gpus` or `ipus` (#11339) | 69,665 | 0 | 17 | 82 | 7 | 241,712 | 8 | lightning | 6 | tests/callbacks/test_device_stats_monitor.py | Python | 19 | {
"docstring": "Test GPU stats are logged using a logger with Pytorch >= 1.8.0.",
"language": "en",
"n_whitespaces": 11,
"n_words": 12,
"vocab_size": 12
} | https://github.com/Lightning-AI/lightning.git |
|
8 | expand_egg_links | def expand_egg_links(self) -> None:
prefixes = [
Path(prefix)
for prefix in self.base_paths["libdirs"].split(os.pathsep)
if vistir.path.is_in_path(prefix, self.prefix.as_posix())
]
for loc in prefixes:
if not loc.exists():
continue
for pth in loc.iterdir():
if not pth.suffix == ".egg-link":
continue
contents = [
vistir.path.normalize_path(line.strip())
for line in pth.read_text().splitlines()
]
pth.write_text("\n".join(contents))
| 4b996c0fa85824b323ad9eff3364dbe2213ebb4c | 16 | environment.py | 200 | Convert type comments to type annotations | 3,716 | 0 | 259 | 120 | 31 | 21,185 | 44 | pipenv | 26 | pipenv/environment.py | Python | 21 | {
"docstring": "\n Expand paths specified in egg-link files to prevent pip errors during\n reinstall\n ",
"language": "en",
"n_whitespaces": 34,
"n_words": 12,
"vocab_size": 12
} | https://github.com/pypa/pipenv.git |
|
3 | deconstruct | def deconstruct(self):
qs_class = self._queryset_class
if getattr(self, "_built_with_as_manager", False):
# using MyQuerySet.as_manager()
return (
True, # as_manager
None, # manager_class
"%s.%s" % (qs_class.__module__, qs_class.__name__), # qs_class
None, # args
None, # kwargs
)
else:
module_name = self.__module__
name = self.__class__.__name__
# Make sure it's actually there and not an inner class
module = import_module(module_name)
if not hasattr(module, name):
raise ValueError(
"Could not find manager %s in %s.\n"
"Please note that you need to inherit from managers you "
"dynamically generated with 'from_queryset()'."
% (name, module_name)
)
return (
False, # as_manager
"%s.%s" % (module_name, name), # manager_class
None, # qs_class
self._constructor_args[0], # args
self._constructor_args[1], # kwargs
)
| 9c19aff7c7561e3a82978a272ecdaad40dda5c00 | 15 | manager.py | 192 | Refs #33476 -- Reformatted code with Black. | 51,170 | 0 | 511 | 115 | 73 | 205,712 | 107 | django | 15 | django/db/models/manager.py | Python | 28 | {
"docstring": "\n Return a 5-tuple of the form (as_manager (True), manager_class,\n queryset_class, args, kwargs).\n\n Raise a ValueError if the manager is dynamically generated.\n ",
"language": "en",
"n_whitespaces": 50,
"n_words": 21,
"vocab_size": 19
} | https://github.com/django/django.git |
|
1 | right | def right(self):
from pandas import Index
return Index(self._right, copy=False)
| 62a69beddbedde349891378992c902c0b9341a9f | 8 | interval.py | 36 | DOC: Add numpydoc SS06 validation (#47885) | 40,192 | 0 | 30 | 21 | 9 | 168,085 | 9 | pandas | 6 | pandas/core/arrays/interval.py | Python | 3 | {
"docstring": "\n Return the right endpoints of each Interval in the IntervalArray as an Index.\n ",
"language": "en",
"n_whitespaces": 28,
"n_words": 13,
"vocab_size": 12
} | https://github.com/pandas-dev/pandas.git |
|
1 | get_requires_for_build_sdist | def get_requires_for_build_sdist(self, config_settings=None):
return self._call_hook('get_requires_for_build_sdist', {
'config_settings': config_settings
})
| f638f5d0e6c8ebed0e69a6584bc7f003ec646580 | 10 | wrappers.py | 41 | upd; format | 13,098 | 0 | 41 | 23 | 9 | 63,010 | 9 | transferlearning | 4 | .venv/lib/python3.8/site-packages/pip/_vendor/pep517/wrappers.py | Python | 4 | {
"docstring": "Identify packages required for building a wheel\n\n Returns a list of dependency specifications, e.g.::\n\n [\"setuptools >= 26\"]\n\n This does not include requirements specified in pyproject.toml.\n It returns the result of calling the equivalently named hook in a\n subprocess.\n ",
"language": "en",
"n_whitespaces": 84,
"n_words": 38,
"vocab_size": 33
} | https://github.com/jindongwang/transferlearning.git |
|
2 | as_directory | def as_directory(self) -> Iterator[str]:
if self._local_path:
yield self._local_path
else:
temp_dir = self.to_directory()
yield temp_dir
shutil.rmtree(temp_dir, ignore_errors=True)
| d96ac251d7c9d12fadedfdfd903dc393f5bae217 | 11 | checkpoint.py | 70 | [air] Add `Checkpoint.as_directory()` for efficient checkpoint fs processing (#23908)
This PR adds a `Checkpoint_as_directory()` context manager that either returns the local path (if checkpoint is already a directory) or a temporary directory path containing the checkpoint data, which is cleaned up after use. The path should be considered as a read-only source for loading data from the checkpoint.
A common use case for processing checkpoint data is to convert it into a directory with `Checkpoint.to_directory()` and then do some read-only processing (e.g. restoring a ML model).
This process has two flaws: First, `to_directory()` creates a temporary directory that has to be explicitly cleaned up by the user after use. Secondly, if the checkpoint is already a directory checkpoint, it is copied over, which is inefficient for large checkpoints (e.g. huggingface models) and then even more prone to unwanted side effects if not cleaned up properly.
With this context manager that effectively returns a directory that is to be used as a read-only data source, we can avoid manual cleaning up and unnecessary data copies (or avoid internal inspection as e.g. in https://github.com/ray-project/ray/pull/23876/files#diff-47db2f054ca359879f77306e7b054dd8b780aab994961e3b4911330ae15eeae3R57-R60)
See also discussion in https://github.com/ray-project/ray/pull/23850/files#r850036905 | 34,158 | 0 | 81 | 41 | 14 | 148,044 | 16 | ray | 10 | python/ray/ml/checkpoint.py | Python | 29 | {
"docstring": "Return checkpoint directory path in a context.\n\n This function makes checkpoint data available as a directory while avoiding\n unnecessary copies and left-over temporary data.\n\n If the checkpoint is already a directory checkpoint, it will return\n the existing path. If it is not, it will create a temporary directory,\n which will be deleted after the context is exited.\n\n Users should treat the returned checkpoint directory as read-only and avoid\n changing any data within it, as it might get deleted when exiting the context.\n\n Example:\n\n with checkpoint.as_directory() as checkpoint_dir:\n # Do some read-only processing of files within checkpoint_dir\n pass\n\n # At this point, if a temporary directory was created, it will have\n # been deleted.\n\n ",
"language": "en",
"n_whitespaces": 239,
"n_words": 113,
"vocab_size": 75
} | https://github.com/ray-project/ray.git |
|
11 | update_billed_amount_based_on_so | def update_billed_amount_based_on_so(so_detail, update_modified=True):
from frappe.query_builder.functions import Sum
# Billed against Sales Order directly
si = frappe.qb.DocType("Sales Invoice").as_("si")
si_item = frappe.qb.DocType("Sales Invoice Item").as_("si_item")
sum_amount = Sum(si_item.amount).as_("amount")
billed_against_so = frappe.qb.from_(si).from_(si_item).select(sum_amount).where(
(si_item.parent == si.name) &
(si_item.so_detail == so_detail) &
((si_item.dn_detail.isnull()) | (si_item.dn_detail == '')) &
(si_item.docstatus == 1) &
(si.update_stock == 0)
).run()
billed_against_so = billed_against_so and billed_against_so[0][0] or 0
# Get all Delivery Note Item rows against the Sales Order Item row
dn = frappe.qb.DocType("Delivery Note").as_("dn")
dn_item = frappe.qb.DocType("Delivery Note Item").as_("dn_item")
dn_details = frappe.qb.from_(dn).from_(dn_item).select(dn_item.name, dn_item.amount, dn_item.si_detail, dn_item.parent, dn_item.stock_qty, dn_item.returned_qty).where(
(dn.name == dn_item.parent) &
(dn_item.so_detail == so_detail) &
(dn.docstatus == 1) &
(dn.is_return == 0)
).orderby(
dn.posting_date, dn.posting_time, dn.name
).run(as_dict=True)
updated_dn = []
for dnd in dn_details:
billed_amt_agianst_dn = 0
# If delivered against Sales Invoice
if dnd.si_detail:
billed_amt_agianst_dn = flt(dnd.amount)
billed_against_so -= billed_amt_agianst_dn
else:
# Get billed amount directly against Delivery Note
billed_amt_agianst_dn = frappe.db.sql(, dnd.name)
billed_amt_agianst_dn = billed_amt_agianst_dn and billed_amt_agianst_dn[0][0] or 0
# Distribute billed amount directly against SO between DNs based on FIFO
if billed_against_so and billed_amt_agianst_dn < dnd.amount:
if dnd.returned_qty:
pending_to_bill = flt(dnd.amount) * (dnd.stock_qty - dnd.returned_qty) / dnd.stock_qty
else:
pending_to_bill = flt(dnd.amount)
pending_to_bill -= billed_amt_agianst_dn
if pending_to_bill <= billed_against_so:
billed_amt_agianst_dn += pending_to_bill
billed_against_so -= pending_to_bill
else:
billed_amt_agianst_dn += billed_against_so
billed_against_so = 0
frappe.db.set_value("Delivery Note Item", dnd.name, "billed_amt", billed_amt_agianst_dn, update_modified=update_modified)
updated_dn.append(dnd.parent)
return updated_dn
| ce0b84f54d495fc78a6792a9b05d0eb1dc799ed2 | 19 | delivery_note.py | 708 | refactor: use frappe.qb instead of sql
(cherry picked from commit 0a9ec9f591f8b4d0e630a3c902b69c9996f080dd) | 13,585 | 0 | 162 | 440 | 120 | 64,242 | 214 | erpnext | 45 | erpnext/stock/doctype/delivery_note/delivery_note.py | Python | 48 | {
"docstring": "select sum(amount) from `tabSales Invoice Item`\n\t\t\t\twhere dn_detail=%s and docstatus=1",
"language": "en",
"n_whitespaces": 8,
"n_words": 10,
"vocab_size": 10
} | https://github.com/frappe/erpnext.git |
|
2 | send | async def send(self, data) -> bool:
try:
await asyncio.wait_for(
self.queue.put(data),
timeout=self.drain_timeout
)
return True
except asyncio.TimeoutError:
return False
| 2b6d00dde449934db8789c860d5e0e9dc9c528ab | 13 | channel.py | 68 | initial channel api change | 35,044 | 0 | 113 | 41 | 17 | 151,551 | 18 | freqtrade | 11 | freqtrade/rpc/api_server/ws/channel.py | Python | 13 | {
"docstring": "\n Add the data to the queue to be sent.\n :returns: True if data added to queue, False otherwise\n ",
"language": "en",
"n_whitespaces": 40,
"n_words": 18,
"vocab_size": 14
} | https://github.com/freqtrade/freqtrade.git |
|
1 | test_second_get_event_cancelled | def test_second_get_event_cancelled(self):
with self.blocking_get_event_calls() as (unblock, get_event1, get_event2):
# Cancel the second `get_event` call.
get_event2.cancel()
# The first `get_event` call must not be cancelled.
self.assertNoResult(get_event1)
# The second `get_event` call gets cancelled immediately.
exc = self.get_failure(get_event2, CancelledError).value
self.assertIsInstance(exc, CancelledError)
# Unblock the database fetch.
unblock.callback(None)
# The first `get_event` call should complete successfully.
self.get_success(get_event1)
| 8a87b4435a736cd42454cad7e57b65ec911f01fa | 11 | test_events_worker.py | 112 | Handle cancellation in `EventsWorkerStore._get_events_from_cache_or_db` (#12529)
Multiple calls to `EventsWorkerStore._get_events_from_cache_or_db` can
reuse the same database fetch, which is initiated by the first call.
Ensure that cancelling the first call doesn't cancel the other calls
sharing the same database fetch.
Signed-off-by: Sean Quah <[email protected]> | 72,077 | 0 | 189 | 64 | 40 | 248,060 | 54 | synapse | 15 | tests/storage/databases/main/test_events_worker.py | Python | 8 | {
"docstring": "Test cancellation of the second `get_event` call sharing a database fetch.",
"language": "en",
"n_whitespaces": 10,
"n_words": 11,
"vocab_size": 11
} | https://github.com/matrix-org/synapse.git |
|
4 | remove_column | def remove_column(self, i, *args, **kwargs):
table = self.table.remove_column(i, *args, **kwargs)
name = self.table.column_names[i]
blocks = []
for tables in self.blocks:
blocks.append(
[
t.remove_column(t.column_names.index(name), *args, **kwargs) if name in t.column_names else t
for t in tables
]
)
return ConcatenationTable(table, blocks)
| e35be138148333078284b942ccc9ed7b1d826f97 | 16 | table.py | 145 | Update docs to new frontend/UI (#3690)
* WIP: update docs to new UI
* make style
* Rm unused
* inject_arrow_table_documentation __annotations__
* hasattr(arrow_table_method, "__annotations__")
* Update task_template.rst
* Codeblock PT-TF-SPLIT
* Convert loading scripts
* Convert docs to mdx
* Fix mdx
* Add <Tip>
* Convert mdx tables
* Fix codeblock
* Rm unneded hashlinks
* Update index.mdx
* Redo dev change
* Rm circle ci `build_doc` & `deploy_doc`
* Rm unneeded files
* Update docs reamde
* Standardize to `Example::`
* mdx logging levels doc
* Table properties inject_arrow_table_documentation
* ``` to ```py mdx
* Add Tips mdx
* important,None -> <Tip warning={true}>
* More misc
* Center imgs
* Update instllation page
* `setup.py` docs section
* Rm imgs since they are in hf.co
* Update docs/source/access.mdx
Co-authored-by: Steven Liu <[email protected]>
* Update index mdx
* Update docs/source/access.mdx
Co-authored-by: Steven Liu <[email protected]>
* just `Dataset` obj
* Addedversion just italics
* Update ReadInstruction doc example syntax
* Change docstring for `prepare_for_task`
* Chore
* Remove `code` syntax from headings
* Rm `code` syntax from headings
* Hashlink backward compatability
* S3FileSystem doc
* S3FileSystem doc updates
* index.mdx updates
* Add darkmode gifs
* Index logo img css classes
* Index mdx dataset logo img size
* Docs for DownloadMode class
* Doc DownloadMode table
* format docstrings
* style
* Add doc builder scripts (#3790)
* add doc builder scripts
* fix docker image
* Docs new UI actions no self hosted (#3793)
* No self hosted
* replace doc injection by actual docstrings
* Docstring formatted
Co-authored-by: Quentin Lhoest <[email protected]>
Co-authored-by: Mishig Davaadorj <[email protected]>
Co-authored-by: Lysandre Debut <[email protected]>
Co-authored-by: Mishig Davaadorj <[email protected]>
* Rm notebooks from docs actions since they dont exi
* Update tsting branch
* More docstring
* Chore
* bump up node version
* bump up node
* ``` -> ```py for audio_process.mdx
* Update .github/workflows/build_documentation.yml
Co-authored-by: Quentin Lhoest <[email protected]>
* Uodate dev doc build
* remove run on PR
* fix action
* Fix gh doc workflow
* forgot this change when merging master
* Update build doc
Co-authored-by: Steven Liu <[email protected]>
Co-authored-by: Quentin Lhoest <[email protected]>
Co-authored-by: Quentin Lhoest <[email protected]>
Co-authored-by: Lysandre Debut <[email protected]> | 21,852 | 0 | 172 | 96 | 29 | 104,416 | 40 | datasets | 14 | src/datasets/table.py | Python | 12 | {
"docstring": "\n Create new Table with the indicated column removed.\n\n Args:\n i (:obj:`int`):\n Index of column to remove.\n\n Returns:\n :class:`datasets.table.Table`:\n New table without the column.\n ",
"language": "en",
"n_whitespaces": 104,
"n_words": 23,
"vocab_size": 21
} | https://github.com/huggingface/datasets.git |
|
1 | test_upload_room_keys_bogus_version | def test_upload_room_keys_bogus_version(self) -> None:
version = self.get_success(
self.handler.create_version(
self.local_user,
{
"algorithm": "m.megolm_backup.v1",
"auth_data": "first_version_auth_data",
},
)
)
self.assertEqual(version, "1")
e = self.get_failure(
self.handler.upload_room_keys(self.local_user, "bogus_version", room_keys),
SynapseError,
)
res = e.value.code
self.assertEqual(res, 404)
| 652d1669c5a103b1c20478770c4aaf18849c09a3 | 13 | test_e2e_room_keys.py | 139 | Add missing type hints to tests.handlers. (#14680)
And do not allow untyped defs in tests.handlers. | 73,360 | 0 | 215 | 84 | 28 | 250,282 | 32 | synapse | 16 | tests/handlers/test_e2e_room_keys.py | Python | 20 | {
"docstring": "Check that we get a 404 on uploading keys when an nonexistent version\n is specified\n ",
"language": "en",
"n_whitespaces": 29,
"n_words": 15,
"vocab_size": 15
} | https://github.com/matrix-org/synapse.git |
|
1 | test_white_levels_to_color_temperature | def test_white_levels_to_color_temperature():
# Only cold channel enabled -> coldest color temperature
assert color_util._white_levels_to_color_temperature(255, 0, 2000, 6535) == (
6535,
255,
)
assert color_util._white_levels_to_color_temperature(128, 0, 2000, 6535) == (
6535,
128,
)
# Only warm channel enabled -> warmest color temperature
assert color_util._white_levels_to_color_temperature(0, 255, 2000, 6535) == (
2000,
255,
)
assert color_util._white_levels_to_color_temperature(0, 128, 2000, 6535) == (
2000,
128,
)
assert color_util._white_levels_to_color_temperature(112, 143, 2000, 6535) == (
2876,
255,
)
assert color_util._white_levels_to_color_temperature(56, 72, 2000, 6535) == (
2872,
128,
)
# Both channels turned off -> warmest color temperature
assert color_util._white_levels_to_color_temperature(0, 0, 2000, 6535) == (
2000,
0,
)
| 47d0598e75487f63901931875f69f802a477df13 | 8 | test_color.py | 197 | Use Kelvin as the preferred color temperature unit (#79591)
* Use Kelvin as the preferred white temperature unit
* Update homekit
* Adjust tests | 87,759 | 0 | 251 | 145 | 36 | 288,603 | 99 | core | 3 | tests/util/test_color.py | Python | 29 | {
"docstring": "Test warm, cold conversion to color temp.\n\n Temperature values must be in mireds\n Home Assistant uses rgbcw for rgbww\n ",
"language": "en",
"n_whitespaces": 28,
"n_words": 19,
"vocab_size": 19
} | https://github.com/home-assistant/core.git |
|
1 | _write_str_avoiding_backslashes | def _write_str_avoiding_backslashes(self, string, *, quote_types=_ALL_QUOTES):
string, quote_types = self._str_literal_helper(string, quote_types=quote_types)
quote_type = quote_types[0]
self.write(f"{quote_type}{string}{quote_type}")
| 8198943edd73a363c266633e1aa5b2a9e9c9f526 | 9 | ast.py | 77 | add python 3.10.4 for windows | 55,932 | 0 | 42 | 41 | 12 | 220,194 | 14 | XX-Net | 8 | python3.10.4/Lib/ast.py | Python | 4 | {
"docstring": "Write string literal value with a best effort attempt to avoid backslashes.",
"language": "en",
"n_whitespaces": 11,
"n_words": 12,
"vocab_size": 12
} | https://github.com/XX-net/XX-Net.git |