Skip to content

Instantly share code, notes, and snippets.

@konstin
Created July 20, 2023 09:49
Show Gist options
  • Save konstin/61adab19d5615160750171944653673d to your computer and use it in GitHub Desktop.
Save konstin/61adab19d5615160750171944653673d to your computer and use it in GitHub Desktop.
Minimized versions of all unstable formatting examples from the ecosystem check with the repo and file they came from as of 2023-07-20
# demisto:content/Packs/FeedMitreAttackv2/Integrations/FeedMitreAttackv2/FeedMitreAttackv2.py
def m():
for e in s:
if''in e:nt((lambda attack_pattern_obj:filter_attack_pattern_object_by_attack_id(d)))
# demisto:content/Packs/Base/Scripts/DBotMLFetchData/DBotMLFetchData.py
():()/n(#
)if()>0else 0
# demisto:content/Packs/PolySwarm/Integrations/PolySwarmV2/PolySwarmV2_test.py
E={"":{"":[{"":{},"":{"":{"":{}}},"":{"":{"":{#
}}}}],"":{},"":[]}}
# demisto:content/Packs/AWS_DynamoDB/Integrations/AWS_DynamoDB/AWS_DynamoDB.py
():s={#
}
# thomasWeise:moptipy/tests/examples/vectors/test_vectors.py
def y()->e:e(ake_solution_space_element_valid=lambda r,xx,xmi=(),xma=([]):random_vector(),d=f)
# thomasWeise:moptipy/moptipy/tests/on_vectors.py
def p(n_unique_samples:int|Callable[[int,VectorSpace],int]|None=lambda i,_:max())->e:()
# thomasWeise:moptipy/moptipy/tests/op2.py
def p(p2make_search_space_element_valid:Callable[[GeneratorAny],]|None=lambda _,x:x,s:[]=lambda:())->e:()
# thomasWeise:moptipy/moptipy/tests/op1_with_step_size.py
def p(make_search_space_element_valid:Callable[[Generator,Any],]|None=lambda _,x:x,s:[]=s,e:[]|e=e)->x:e
# thomasWeise:moptipy/moptipy/tests/op0.py
def p(p0make_search_space_element_valid:Callable[[GeneratorAny],]|None=lambda _,x:x,s:[]=lambda:())->e:()
# thomasWeise:moptipy/moptipy/tests/op1.py
def p(p1make_search_space_element_valid:Callable[[GeneratorAny],]|None=lambda _,x:x,s:[]=s)->e:()
# roeap:flight-fusion/python/dagster-fusion/tests/test_mlflow_integration.py
def g():assert()!=r(#
)
# python:mypy/mypy/meet.py
def s()->l:
if()or e(#
):n
# worldr:nhound/nhound/utils.py
def m(t:"")->r:return((tr()for obj in obj_list[:size-1])+f"{[]!s}")
# thomasWeise:moptipy/moptipy/utils/plot_utils.py
def s()\
->()or((#e
())()):t
# realtyem:synapse-unraid/tests/federation/test_federation_client.py
():t=lambda:(json(payload={#Mimic the other server returning our new `pulled_event`
}))
# Argmaster:cssfinder_backend_numpy/cssfinder_backend_numpy/base.py
class e():return(#]
()).e()
# Checkmk:checkmk/agents/plugins/mk_tinkerforge.py
def a():
try:(lambda d,i,n,sion,firmware_version,device_identifier,enumeration_type:())
finally:()
# Checkmk:checkmk/cmk/gui/pdf.py
t:[]=""+r(#
)
# Blue-Yonder-OSS:cyclic-boosting/cyclic_boosting/common_smoothers.py
():s={L:
#
()}
# Chr0nos:motorized/motorized/utils.py
def p(actory:Callable[[BaseModel,Any,bool],Optional[Any]]=lambda model,data,_:data):t={}
# DisnakeDev:disnake/disnake/reaction.py
n:[]=i or a(#
)
# Checkmk:checkmk/cmk/gui/plugins/config/base.py
s:[]=d(y=lambda:[
#
])
# Gobot1234:steam.py/steam/ext/commands/help.py
():await((m)if()else())
# HellConnector:tradematebot/bot/utils.py
def t()->r:return f"{m+1}{t}"+((lambda:f"{1}{[]}"))
# Lightning-AI:lightning/src/lightning/pytorch/callbacks/early_stopping.py
class g():
if n or t(#
):n
# Mojino01:hugging_face/src/transformers/generation/flax_logits_process.py
(lambda:(#
),)
# Checkmk:checkmk/cmk/gui/userdb/ldap_connector.py
def s()->e:({"":f,n:[],"":f,n:(),"unc":lambda self,connection,plugin,params,user_id,ldap_user,user:()})
# Mojino01:hugging_face/src/transformers/generation/tf_logits_process.py
(lambda:(#
),)
# Netflix:dispatch/src/dispatch/cli.py
((()#
.r()).t())
# Netflix:dispatch/src/dispatch/plugins/dispatch_slack/middleware.py
def t()->l:(t is e and(#a
())()is e)
# PaddlePaddle:Paddle/test/legacy_test/test_psroi_pool_op.py
():i=lambda x,s,xes_num,pooled_height,pooled_width,output_channels,spatial_scale:()
# PaddlePaddle:Paddle/test/ipu/distributed/test_dist_pod128_sample.py
({"":
#
()*2,"":{}})
# PaddlePaddle:Paddle/test/legacy_test/test_roi_align_op.py
():i=lambda x,s,m,oled_height,pooled_width,spatial_scale,sampling_ratio,aligned:()
# PaddlePaddle:Paddle/test/legacy_test/test_roi_pool_op.py
():i=lambda x,s,m,pooled_height,pooled_width,spatial_scale:paddlevisionopsroi_pool()
# PaddlePaddle:Paddle/tools/gen_ut_cmakelists.py
def e():assert(),("""""""""string must include at least one char of "0-9", "a-z", "A-Z" or "_".""")
# PlasmaPy:PlasmaPy/plasmapy/diagnostics/tests/test_thomson.py
def t(#
):()
# PlasmaPy:PlasmaPy/plasmapy/utils/decorators/tests/test_converters.py
()(lambda _only,/,arg,args,required_kwarg,optional_kwarg2,to_hzFalse,kwargs:None)
# PyCQA:astroid/astroid/brain/brain_numpy_core_umath.py
():s=("""None, where=True, casting='same_kind', order='K', """"""dtype=None, subok=True""")
# PlasmaPy:PlasmaPy/plasmapy/particles/tests/test_atomic.py
def s():assert()and e(#
)
# QCoDeS:Qcodes/docs/conf.py
s={#
}
# SWAG-MLG-420:Gajim_SWAG_MLG_M.O.D/gajim/common/storage/cache.py
class e():
try:e=[]
except:n
else:
#
n
# RasaHQ:rasa/rasa/core/policies/ted_policy.py
(lambda:(),lambda:(#
))
# Seeyou2000:SE_UNO_Project/engine/layout.py
def t(ffset_retriever:[[GameObject,float],pygameVector2]=lambda _,__:pygameVector2())->e:h=[].h
# Scille:parsec-cloud/server/tests/backend/common.py
ek(s=lambda d,lob_id,blob,timestampNone,encryption_revision1,sequester_blobNone:{})
# TheAlgorithms:Python/ciphers/affine_cipher.py
S=("""89:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`"""r"""abcdefghijklmnopqrstuvwxyz{|}~""")
# Stinky-c:DatBot/src/main.py
async def a():
try:()
except n as e:()
else:
#
()
# a0x8o:airflow/airflow/providers/microsoft/azure/operators/data_factory.py
():e or d(#
)
# ajslater:codex/codex/librarian/watchdog/emitter.py
class r():
def _(#
):()
# akhanf:snakedwi/snakedwi/workflow/scripts/anatomical/map_channels_to_tissue.py
def u()->e:i=()/m(#
)
# WeblateOrg:weblate/weblate/trans/views/edit.py
({"":(),"":().r,"":(),"":(),"":lambda:(#
)})@d
# alcides:GeneticEngine/examples/synthetic_grammar_example.py
()([k(s={"":lambda on,population,time,gp,ind:fixed_non_terminals_per_production})])
# alorence:django-modern-rpc/modernrpc/handlers/jsonhandler.py
class r():
try:()
except n as c:()
else:
#
n
# angr:angr/angr/analyses/cfg/indirect_jump_resolvers/jumptable.py
():s=""%_(#
)
# angr:angr/angr/analyses/propagator/outdated_definition_walker.py
class r():
if d is(#n
d or d):e
# apache:airflow/airflow/providers/microsoft/azure/operators/data_factory.py
():e or d(#
)
# artigraph:artigraph/src/arti/versions/__init__.py
class t():d((lambda:ubprocesscheck_output(["git""rev-parse"])#noqa: S603 S607
.strip()))
# algorandfoundation:algokit-utils-py/src/algokit_utils/deploy.py
def n()->e:
if()and(#t
()or()):n
# astropy:astropy/astropy/io/fits/convenience.py
def u():
try:g(t="")
except:()
else:
#
t(t="",c="")
# atlasacademy:fgo-game-data-api/app/db/helpers/fetch.py
t[#
[]]={(),}
# atlas-bi:atlas-automation-hub/web/web/executors.py
def k()->e:()is e and(()#
.t()).d()()
# bigcode-project:transformers/src/transformers/generation/flax_logits_process.py
(lambda:(#
),)
# bigcode-project:transformers/src/transformers/generation/tf_logits_process.py
(lambda:(#
),)
# bokeh:bokeh/tests/unit/bokeh/util/test_strings.py
class s:assert s("",)==f"{()}"
# bolucat:Firefox/third_party/python/Jinja2/jinja2/debug.py
if():n
elif Y:
try:l
except:n
else:
#
n
# bolucat:Firefox/third_party/python/gyp/test/defines-escaping/gyptest-defines-escaping.py
try:[]=(""""""#
"""""")
finally:[]
# SMAT-Lab:Scalpel/tests/test-cases/cfg-tests/pytorch-test-test_nn.py
(lambda:
#
())
# bolucat:Firefox/third_party/python/gyp/test/defines/gyptest-define-override.py
t=='':r=("""UE="a#1"\n""""""Consider defining the macro in a (configured) header file.\n\n""")
# bolucat:Firefox/third_party/python/gyp/test/defines/gyptest-defines.py
t=='':r=("""UE="a#1"\n""""""Consider defining the macro in a (configured) header file.\n\n""")
# bolucat:Firefox/third_party/python/pip/pip/_vendor/rich/control.py
[]={ControlTypeCURSOR_MOVE_TO_COLUMN:lambda param:f"{1}",}
# bomzheg:Shvatka/shvatka/tgbot/views/results/scenario.py
class r:e==0:t=(f"{f+1}"+"n🔑 ".join(selflevelscenariokeys))
# charmoniumQ:charmonium.freeze/charmonium/freeze/config.py
s:[]=d(y=lambda:{
#
})
# canonical:cos-configuration-k8s-operator/tests/unit/charm/test_status_vs_config.py
class s():
try:([lambda _idrel_id,rel_namerel_name,num_unitsnum_units:(#type: ignore
)])
finally:()
# dbca-wa:it-assets/itassets/widgets.py
(lambda e:'d style="border: 1px solid gray"><pre>{}</pre></td></tr></table>'.format()if e else'')
# debian-calibre:calibre/src/calibre/utils/copy_files.py
def e(sform_destination_filename:[[str,str],str]=lambda src_path,dest_path:dest_path)->e:t
# django-cms:django-cms/cms/tests/test_templatetags.py
():e=("""with_version "cms/css/cms.base.css" %}" """"""type="text/javascript"></script>""")
# earthobservations:wetterdienst/wetterdienst/provider/dwd/mosmix/access.py
class r:()==n(#
),
# fuzzylite:pyfuzzylite/fuzzylite/term.py
class l():return t*(#e
0/())
# gpajot:local-tuya/tests/protocol/conftest.py
def d():
if()is e(#
):t=[]
# colour-science:colour/colour/utilities/tests/test_verbose.py
([{"":lambda:(#
),"":e}])
# great-expectations:great_expectations/great_expectations/data_context/store/tuple_store_backend.py
(lambda r=(#
):())
# great-expectations:great_expectations/great_expectations/rule_based_profiler/domain_builder/column_domain_builder.py
()((lambda e:ntic_type_filtertable_column_name_to_inferred_semantic_domain_type_map[e]))
# great-expectations:great_expectations/tests/datasource/batch_kwarg_generator/test_subdir_reader_generator.py
def g():assert[]==o(#
)
# great-expectations:great_expectations/great_expectations/datasource/data_connector/file_path_data_connector.py
class S:[]={():lambda:(),():lambda:(),():lambda:(),():lambda:(),():lambda:(),():lambda late_arguments:AzureUrlAZURE_BLOB_STORAGE_WASBS_URL_TEMPLATEformat(),():lambda:(),():lambda:()}
# hasgeek:funnel/funnel/forms/helpers.py
def t()->l:l(s=lambda:(#
),)
# hasgeek:funnel/tests/unit/models/project_crew_membership_test.py
def p()->e:(''in(#s
r).s())
# home-assistant:core/homeassistant/bootstrap.py
def g()->e:k=lambda*s:(#
)
# home-assistant:core/homeassistant/components/assist_pipeline/select.py
(lambda:(
#
))
# home-assistant:core/homeassistant/components/bmw_connected_drive/switch.py
S[n(mote_service_off=lambda v:vremote_servicestrigger_remote_air_conditioning_stop())()]
# home-assistant:core/homeassistant/components/bmw_connected_drive/button.py
((),n(te_function=lambda vehicle:vehicleremote_servicestrigger_remote_vehicle_finder())())
# home-assistant:core/homeassistant/components/mqtt/binary_sensor.py
class s():return()and(#]
r is e or d)
# home-assistant:core/homeassistant/components/homekit/type_fans.py
class n():
for e in s:[]=r(setter_callback=lambda value,preset_modepreset_mode:self.set_preset_mode(),)
# home-assistant:core/homeassistant/components/mqtt/sensor.py
class s():return()and(#]
r is e or d)
# home-assistant:core/homeassistant/components/roborock/switch.py
[n(m=lambda:()if e else(),get_value=lambda data:datacoordinatorroborock_device_infopropsdnd_timer.enabled)]
# home-assistant:core/homeassistant/components/recorder/statistics.py
def t()->t:(lambda:((ecent_statistic_row((#pylint: disable-next=not-callable
)).subquery())))
# home-assistant:core/homeassistant/components/shelly/button.py
[(),[](press_action=lambda coordinator:coordinatordevicetrigger_shelly_gas_self_test(),)()()]
# home-assistant:core/homeassistant/helpers/dispatcher.py
def b()->[]:((lambda*s:(#
)))
# home-assistant:core/homeassistant/util/dt.py
def f()->a:return(#]
a).t()
# home-assistant:core/tests/components/hddtemp/test_sensor.py
async def s()->e:
for s in[]:assert(tateattributesget("friendly_name")==f"{[]}")
# home-assistant:core/homeassistant/components/vicare/sensor.py
((),n(e_getter=lambda api:apigetPowerSummaryConsumptionDomesticHotWaterLastSevenDays())()()()()()()()()()()()()()()()()())
# hongquan:CurliPie/tests/test_curlipie.py
():l=("""""""""oarding_floor=1 \\\n-F destination_floor=9 \\\n-F elevator_bank_number=3""")
# huggingface:transformers/src/transformers/generation/flax_logits_process.py
(lambda:(#
),)
# huggingface:transformers/src/transformers/generation/tf_logits_process.py
(lambda:(#
),)
# hwchase17:langchain/tests/unit_tests/retrievers/test_zep.py
def s()->e:assert t==[].t(#
)
# janosh:thermo/thermo/bnn/torch_dropout.py
sl():t=f"{h+1}{s}"+(f"{l}"())
# home-assistant:core/tests/components/logbook/test_init.py
async def t()->e:(ck(async_describe_events=lambda hass,async_describe_event:async_describe_event()))
# jaymegordo:jambot/jambot/signals.py
class p():
def m()->t:
for s in():p={f'{x}{c}':lambda x,c,n_periodsn_periods:()for c in s if c in e}
# klen:muffin-rest/muffin_rest/handler.py
e():s=await(()if e else(t,n,))
# jupyterlab:jupyterlab/jupyterlab/extensions/pypi.py
class r():
try:()
except t as r:
if 0and s(#
):1
# libratbag:libratbag/tools/ratbagd.py
class o():N={RatbagdButtonMacro.KEY_RELEASE:lambda key:f"{()}",}
# libratbag:piper/piper/ratbagd.py
class o():N={RatbagdButtonMacro.KEY_RELEASE:lambda key:f"{()}",}
# litestar-org:litestar/litestar/contrib/sqlalchemy/repository/_async.py
class y():return(#r
()).e()==1
# litestar-org:litestar/litestar/contrib/sqlalchemy/repository/_sync.py
class y():return(#r
()).e()==1
# lqhuang:mode-ng/src/mode/utils/objects.py
try:from g import r
except:from g import a
else:
#
n
# marcosschroh:dataclasses-avroschema/dataclasses_avroschema/model_generator/generator.py
r:[]=d(y=lambda:{
#
})
# kornia:kornia/kornia/enhance/equalization.py
def s()->[]:s=(()#
.e()).s()
# matplotlib:matplotlib/lib/matplotlib/tests/test_backend_template.py
def i():(lambda num,args,FigureClass=mpl.figure.Figure,**kwargs:FigureManagerTemplate(()))
# matrix-org:synapse/tests/federation/test_federation_client.py
():t=lambda:(json(payload={#Mimic the other server returning our new `pulled_event`
}))
# microsoft:FLAML/test/autogen/oai/test_completion.py
()[lambda a:"plify your answer as much as possible. Put the final answer in \\boxed{}."]
# matplotlib:matplotlib/lib/matplotlib/colors.py
_=""@e(it=lambda linthresh,linscale=1.,vmin=None,vmax=None,clip=False*base10:None)@()
# microsoft:onnx-script/tools/diagnostics/gen_diagnostics.py
def p()->e:(lambda:{"nt":textwrapindent(predicate=lambda:True#Don't ignore empty line
)})
# microsoft:onnxscript/tools/diagnostics/gen_diagnostics.py
def p()->e:(lambda:{"nt":textwrapindent(predicate=lambda:True#Don't ignore empty line
)})
# mitmproxy:pdoc/test/test_doc_types.py
()(lambda _:"mport typing\nif typing.TYPE_CHECKING:\n\tFooFn = typing.Callable[[],int]")
# mne-tools:mne-python/mne/io/edf/tests/test_gdf.py
()-e(#
)
# mitodl:ol-infrastructure/src/ol_infrastructure/applications/airbyte/__main__.py
g(lambda b:"dbc:postgresql://{address}:{port}/{name}?ssl=true&sslmode=require".format())
# modal-labs:modal-client/modal/_blob_utils.py
async def d():ed_multipart_etag=hashlibmd5(()).hexdigest()+f"{()}"
# mozilla-services:socorro/socorro/signature/siglists_utils.py
S={[(lambda x:", unsigned long, nsAString_internal*, nsILocalFile**, nsILocalFile**)")]}
# mne-tools:mne-python/mne/source_estimate.py
def c():(n and(#)
())!=0):e
# mozilla:gecko-dev/third_party/python/gyp/test/defines-escaping/gyptest-defines-escaping.py
try:[]=(""""""#
"""""")
finally:[]
# mozilla:gecko-dev/third_party/python/Jinja2/jinja2/debug.py
if():n
elif Y:
try:l
except:n
else:
#
n
# mozilla:gecko-dev/third_party/python/gyp/test/defines/gyptest-define-override.py
t=='':r=("""UE="a#1"\n""""""Consider defining the macro in a (configured) header file.\n\n""")
# mozilla:gecko-dev/third_party/python/gyp/test/defines/gyptest-defines.py
t=='':r=("""UE="a#1"\n""""""Consider defining the macro in a (configured) header file.\n\n""")
# nocproject:noc/core/timepattern.py
S[(lambda ur,from_minute,to_hour,to_minute:"(%d <= (T.hour * 60 + T.minute) <= %d)")]
# mozilla:gecko-dev/third_party/python/pip/pip/_vendor/rich/control.py
[]={ControlTypeCURSOR_MOVE_TO_COLUMN:lambda param:f"{1}",}
# nrbnlulu:qtgql/tests/scripts/tests_server.py
():d(y=lambda:(#
),)
# oluchigoodness2000:zulip/scripts/lib/zulip_tools.py
def s()->[]:()-a(#
)
# onnx:onnx/onnx/helper.py
def s()->o:t={T:lambda*s:(#
)}[e]
# onnx:onnx/onnx/reference/op_run.py
class n():
def s()->e:
for t in e:
if H:(lambda context,valuevalue,attributesNone:OpRun._evaluate_subgraph(),)
# opsi-org:opsipxeconfd/opsipxeconfd/opsipxeconfd.py
class d():return""%e(#
)
# opsi-org:python-opsi-common/opsicommon/package/legacy_control_file.py
s=(#
["",])
# opsi-org:python-opsi-common/tests/test_system.py
def k()->(lambda:[#
],):""in[]@x
# pandabuilder:pandachaika/viewer/management/commands/remotesite.py
class r():
def e():
with()as e:
for t in():
try:ry(callback=lambda data,argsselfprint_method:self.print_progress())
except:d
# pandas-dev:pandas/pandas/core/groupby/generic.py
class y():
try:()
except r as r:()
else:
#
()
# pandas-dev:pandas/pandas/core/window/rolling.py
():8=s/(#]
s/n)
# pandas-dev:pandas/pandas/tests/io/parser/test_c_parser_only.py
():_=(""",-99.99,,,,,,9.99,ZZZ-ZZZZ,-9.99,-9.99,9.99,9"""""".99,,ZZZ,,,,,,,ZZZ,ZZZ,,,,,""")
# peterbacil:home-assistant-core/homeassistant/bootstrap.py
def g()->e:k=lambda*s:(#
)
# peterbacil:home-assistant-core/homeassistant/components/bmw_connected_drive/button.py
((),n(te_function=lambda vehicle:vehicleremote_servicestrigger_remote_vehicle_finder())())
# peterbacil:home-assistant-core/homeassistant/components/homekit/type_fans.py
class n():
for e in s:[]=r(setter_callback=lambda value,preset_modepreset_mode:self.set_preset_mode(),)
# peterbacil:home-assistant-core/homeassistant/components/mqtt/binary_sensor.py
class s():return()and(#]
r is e or d)
# peterbacil:home-assistant-core/homeassistant/components/mqtt/sensor.py
class s():return()and(#]
r is e or d)
# peterbacil:home-assistant-core/homeassistant/components/shelly/button.py
[(),[](press_action=lambda coordinator:coordinatordevicetrigger_shelly_gas_self_test(),)()()]
# peterbacil:home-assistant-core/homeassistant/components/vicare/sensor.py
((),n(e_getter=lambda api:apigetPowerSummaryConsumptionDomesticHotWaterLastSevenDays())()()()()()()()()()()()()()()()()())
# peterbacil:home-assistant-core/homeassistant/helpers/dispatcher.py
def b()->[]:((lambda*s:(#
)))
# peterbacil:home-assistant-core/homeassistant/util/dt.py
def f()->a:return(#]
a).t()
# peterbacil:home-assistant-core/tests/components/hddtemp/test_sensor.py
async def s()->e:
for s in[]:assert(tateattributesget("friendly_name")==f"{[]}")
# peterbacil:home-assistant-core/tests/components/logbook/test_init.py
async def t()->e:(ck(async_describe_events=lambda hass,async_describe_event:async_describe_event()))
# pikepdf:pikepdf/docs/conf.py
s={#
}
# pylint-dev:astroid/astroid/brain/brain_numpy_core_umath.py
():s=("""None, where=True, casting='same_kind', order='K', """"""dtype=None, subok=True""")
# pylint-dev:pylint/tests/functional/c/cellvar_escaping_loop.py
[lambda:(#
)#
]
# pypa:cibuildwheel/test/test_before_build.py
():d=(""""""'''ys; open('{output_dir}pythonexecutable.txt', 'w').write(sys.executable)"''')
# python-discord:bot/bot/exts/info/subscribe.py
classe:ble_months_str=", ".join(month_names[:])+f"{[]}"
# opsi-org:python-opsi-common/tests/test_client_opsiservice.py
def s()->e:assert().e==h(#
)
# rnd-rivertech:core/homeassistant/bootstrap.py
def g()->e:k=lambda*s:(#
)
# rnd-rivertech:core/homeassistant/components/bmw_connected_drive/button.py
((),n(te_function=lambda vehicle:vehicleremote_servicestrigger_remote_vehicle_finder())())
# rnd-rivertech:core/homeassistant/components/homekit/type_fans.py
class n():
for e in s:[]=r(setter_callback=lambda value,preset_modepreset_mode:self.set_preset_mode(),)
# rnd-rivertech:core/homeassistant/components/mqtt/binary_sensor.py
class s():return()and(#]
r is e or d)
# rnd-rivertech:core/homeassistant/components/mqtt/sensor.py
class s():return()and(#]
r is e or d)
# rnd-rivertech:core/homeassistant/components/recorder/statistics.py
def t()->t:(lambda:((ecent_statistic_row((#pylint: disable-next=not-callable
)).subquery())))
# rnd-rivertech:core/homeassistant/components/shelly/button.py
[(),[](press_action=lambda coordinator:coordinatordevicetrigger_shelly_gas_self_test(),)()()]
# rnd-rivertech:core/homeassistant/components/vicare/sensor.py
((),n(e_getter=lambda api:apigetPowerSummaryConsumptionDomesticHotWaterLastSevenDays())()()()()()()()()()()()()()()()()())
# rnd-rivertech:core/homeassistant/helpers/dispatcher.py
def b()->[]:((lambda*s:(#
)))
# rnd-rivertech:core/homeassistant/util/dt.py
def f()->a:return(#]
a).t()
# rnd-rivertech:core/tests/components/hddtemp/test_sensor.py
async def s()->e:
for s in[]:assert(tateattributesget("friendly_name")==f"{[]}")
# rnd-rivertech:core/tests/components/logbook/test_init.py
async def t()->e:(ck(async_describe_events=lambda hass,async_describe_event:async_describe_event()))
# rotki:rotki/rotkehlchen/accounting/history_base_entries.py
classtvent_settings=(#
selfevm_accounting_aggregatorsget_accounting_settings(selfpot)|())
# sailfishos-mirror:sphinx/sphinx/config.py
def s()->e:f()>2:d=(", ".join(wrapped_annotations[:])+f"{[]}")
# sailfishos-mirror:sphinx/tests/test_intl.py
():r=("""<span class="cp">#include</span>""""""<span class="cpf">&lt;STDIO.H&gt;</span>""")
# sarthhh:anya/plugins/members.py
async def l()->e:l:()or l(#
)
# savannahghi:idr-client/app/lib/retry/retry.py
classy:al_delay=(#
self_initial_delay or("default_initial_delay",DEFAULT_INITIAL_DELAY))
# sphinx-doc:sphinx/sphinx/config.py
def s()->e:f()>2:d=(", ".join(wrapped_annotations[:])+f"{[]}")
# sphinx-doc:sphinx/tests/test_intl.py
():r=("""<span class="cp">#include</span>""""""<span class="cpf">&lt;STDIO.H&gt;</span>""")
# squaresmile:fgo-game-data-api/app/db/helpers/fetch.py
t[#
[]]={(),}
# sympy:sympy/sympy/stats/joint_rv.py
p={'ivariateNormalDistribution':lambda dist,size:scipy_statsmultivariate_normalrvs(),'':t,e:(),'':t,e:()}
# sympy:sympy/sympy/stats/matrix_distributions.py
p={'':t,e:(),'ixNormalDistribution':lambda dist,size,rand_state:scipy_statsmatrix_normalrvs()}
# syusuke9999:langchain-jp/tests/unit_tests/retrievers/test_zep.py
def s()->e:assert t==[].t(#
)
# theRealProHacker:Positron/src/positron/utils/aio.py
async def l():await((s)if()else())
# tribe29:checkmk/agents/plugins/mk_tinkerforge.py
def a():
try:(lambda d,i,n,sion,firmware_version,device_identifier,enumeration_type:())
finally:()
# tribe29:checkmk/cmk/gui/pdf.py
t:[]=""+r(#
)
# tribe29:checkmk/cmk/gui/plugins/config/base.py
s:[]=d(y=lambda:[
#
])
# tribe29:checkmk/cmk/gui/userdb/ldap_connector.py
def s()->e:({"":f,n:[],"":f,n:(),"unc":lambda self,connection,plugin,params,user_id,ldap_user,user:()})
# tvv-lippu-ja-maksujarjestelma-oy:waltti-apc-pilot-analysis/src/waltti_apc_pilot_analysis/analysis.py
(().t(
#
).s().s().e(["",]))
# vkottler:rcmpy/rcmpy/config/file.py
class e:return m and l(#
)
# wandb:wandb/wandb/sdk/artifacts/artifact_saver.py
class r:(lambda:(),lambda entry,progress_callback:self_manifest.storage_policy.store_file_async())
# willkg:socorro-siggen/siggen/siglists_utils.py
S={[(lambda x:", unsigned long, nsAString_internal*, nsILocalFile**, nsILocalFile**)")]}
# worldr:setupr/setupr/utils.py
def m(t:"")->r:return((tr()for obj in obj_list[:size-1])+f"{()}")
# zulip:zulip/scripts/lib/zulip_tools.py
def s()->[]:()-a(#
)
# python:mypy/mypy/checkexpr.py
class r():
if()and e(#
):e
# PaddlePaddle:Paddle/python/paddle/nn/layer/rnn.py
# cloud-custodian:cloud-custodian/tests/test_rds.py
from __future__ import annotations
import json
from concurrent.futures import ThreadPoolExecutor, as_completed
from pathlib import Path
from subprocess import check_output
from tempfile import TemporaryDirectory
from tqdm import tqdm
error_report = Path("target/errors-2023-07-19.txt")
def get_filenames() -> list[str]:
prefix = "Unstable formatting "
files = []
for line in error_report.read_text().splitlines():
if not line.startswith(prefix):
continue
files.append(line.removeprefix(prefix))
return files
def shrink_file(file: str) -> tuple[str, str]:
"""Returns filename and minimization"""
with TemporaryDirectory() as temp_dir:
temp_dir = Path(temp_dir)
print(f"Starting {file}")
check_output(
[
"target/release/ruff_shrinking",
file,
temp_dir.joinpath("code.py"),
"Unstable formatting",
f"target/release/ruff_dev format-dev --stability-check {temp_dir}",
],
)
print(f"Finished {file}")
return file, temp_dir.joinpath("code.py").read_text()
# %%
storage = Path("target/minimizations.json")
outputs = json.loads(storage.read_text())
files = sorted(set(get_filenames()) - set(outputs))
with ThreadPoolExecutor(4) as executor:
tasks = [executor.submit(shrink_file, file) for file in files]
for future in tqdm(as_completed(tasks), total=len(files)):
file, output = future.result()
outputs[file] = output
storage.write_text(json.dumps(outputs, indent=4))
# %%
storage = Path("target/minimizations.json")
with Path("target/minimizations.py").open("w") as formatted:
for file, code in json.loads(storage.read_text()).items():
file = file.split("/target/checkouts/")[1]
formatted.write(f"# {file}\n{code}\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment