uid stringlengths 24 24 | split stringclasses 1
value | category stringclasses 2
values | content stringlengths 5 482k | signature stringlengths 1 14k | suffix stringlengths 1 482k | prefix stringlengths 9 14k | prefix_token_count int64 3 5.01k | prefix_token_budget int64 64 256 | element_token_count int64 1 292k | signature_token_count int64 1 5.01k | prefix_context_token_count int64 0 255 | repo stringlengths 7 112 | path stringlengths 4 208 | language stringclasses 1
value | name stringlengths 1 218 | qualname stringlengths 1 218 | start_line int64 1 26.7k | end_line int64 1 26.7k | signature_start_line int64 1 26.7k | signature_end_line int64 1 26.7k | source_hash stringlengths 40 40 | source_dataset stringclasses 1
value | source_split stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2a2a02f99a9840bfa279eb27 | train | function | def create(kernel):
result = Static()
result.template = "object/static/particle/shared_particle_newbie_bomb_debris.iff"
result.attribute_template_id = -1
result.stfName("obj_n","unknown_object")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return result | def create(kernel):
| result = Static()
result.template = "object/static/particle/shared_particle_newbie_bomb_debris.iff"
result.attribute_template_id = -1
result.stfName("obj_n","unknown_object")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return result | #### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
| 46 | 64 | 67 | 4 | 42 | obi-two/GameServer | data/scripts/templates/object/static/particle/shared_particle_newbie_bomb_debris.py | Python | create | create | 7 | 17 | 7 | 7 | 11e966b542369bcde2e8c29096d535de2760c6ea | bigcode/the-stack | train |
fc9646b9ddb6046e6f2f033e | train | function | def login(request):
""" login(request)
No return value
Function called from route_url('apex_login', request)
"""
title = _('You need to login')
came_from = get_came_from(request)
if apex_settings('login_form_class'):
LoginForm = get_module(apex_settings('login_form_class'))
els... | def login(request):
| """ login(request)
No return value
Function called from route_url('apex_login', request)
"""
title = _('You need to login')
came_from = get_came_from(request)
if apex_settings('login_form_class'):
LoginForm = get_module(apex_settings('login_form_class'))
else:
from apex... | _email_forgot,
apex_id_from_token,
apex_id_providers,
apex_remember,
apex_settings,
generate_velruse_forms,
get_came_from,
... | 99 | 99 | 333 | 4 | 95 | timgates42/apex | apex/views.py | Python | login | login | 40 | 81 | 40 | 40 | 29f360fa7643c856552a1c049db6f14a898ed84c | bigcode/the-stack | train |
9fff7983cf1ec7229ef85318 | train | function | def forbidden(request):
""" forbidden(request)
No return value
Called when user hits a resource that requires a permission and the
user doesn't have the required permission. Will prompt for login.
request.environ['repoze.bfg.message'] contains our forbidden error in case
of a csrf problem. Pro... | def forbidden(request):
| """ forbidden(request)
No return value
Called when user hits a resource that requires a permission and the
user doesn't have the required permission. Will prompt for login.
request.environ['repoze.bfg.message'] contains our forbidden error in case
of a csrf problem. Proper solution is probably... | , required, form.data[required])
DBSession.merge(user)
DBSession.flush()
headers = apex_remember(request, user)
return HTTPFound(location=came_from, headers=headers)
return {'title': title, 'form': form, 'action': 'openid_required'}
def forbidden(request):
| 64 | 64 | 208 | 4 | 60 | timgates42/apex | apex/views.py | Python | forbidden | forbidden | 405 | 429 | 405 | 405 | 4d41a6b24de7c026788dad5293de55743fed6c2c | bigcode/the-stack | train |
8fe950a5d7c7c187ef02e02f | train | function | def forgot_password(request):
""" forgot_password(request):
no return value, called with route_url('apex_forgot_password', request)
"""
title = _('Forgot my password')
if asbool(apex_settings('use_recaptcha_on_forgot')):
if apex_settings('recaptcha_public_key') and \
apex_settin... | def forgot_password(request):
| """ forgot_password(request):
no return value, called with route_url('apex_forgot_password', request)
"""
title = _('Forgot my password')
if asbool(apex_settings('use_recaptcha_on_forgot')):
if apex_settings('recaptcha_public_key') and \
apex_settings('recaptcha_private_key'):
... | (request)
user = DBSession.query(AuthUser). \
filter(AuthUser.auth_id==authenticated_userid(request)). \
filter(AuthUser.provider=='local').first()
form = ChangePasswordForm(request.POST, user_id=user.id)
if request.method == 'POST' and form.validate():
#user = AuthID.... | 130 | 130 | 434 | 5 | 125 | timgates42/apex | apex/views.py | Python | forgot_password | forgot_password | 116 | 158 | 116 | 116 | 17d736ce2fa1ea93485bbd615f6c98f205f35ac2 | bigcode/the-stack | train |
a7a994ae31a054082ed18f61 | train | function | def edit(request):
""" edit(request)
no return value, called with route_url('apex_edit', request)
This function will only work if you have set apex.auth_profile.
This is a very simple edit function it works off your auth_profile
class, all columns inside your auth_profile class wil... | def edit(request):
| """ edit(request)
no return value, called with route_url('apex_edit', request)
This function will only work if you have set apex.auth_profile.
This is a very simple edit function it works off your auth_profile
class, all columns inside your auth_profile class will be rendered.
... | .matched_route:
flash(_('Not logged in, please log in'), 'error')
return HTTPFound(location='%s?came_from=%s' %
(route_url('apex_login', request),
current_route_url(request)))
else:
return Response('Unknown error message')
def edit(request):
| 64 | 64 | 198 | 4 | 60 | timgates42/apex | apex/views.py | Python | edit | edit | 431 | 457 | 431 | 431 | 0c6e315ec8343a0a0c77ba0bd67a3f5f5db1e837 | bigcode/the-stack | train |
182a1f3f2730f3d8b8f3f195 | train | function | def logout(request):
""" logout(request):
no return value, called with route_url('apex_logout', request)
"""
headers = forget(request)
came_from = get_came_from(request)
request.session.invalidate()
return HTTPFound(location=came_from, headers=headers)
| def logout(request):
| """ logout(request):
no return value, called with route_url('apex_logout', request)
"""
headers = forget(request)
came_from = get_came_from(request)
request.session.invalidate()
return HTTPFound(location=came_from, headers=headers)
| _age', None))
return HTTPFound(location=came_from, headers=headers)
return {'title': title, 'form': form, 'velruse_forms': velruse_forms, \
'form_url': request.route_url('apex_login'),
'action': 'login'}
def logout(request):
| 64 | 64 | 60 | 4 | 60 | timgates42/apex | apex/views.py | Python | logout | logout | 83 | 90 | 83 | 83 | 4938bb3c6a51d800e2319a49aed37c9824c42d56 | bigcode/the-stack | train |
cc396dde791a7a4a44ad8097 | train | function | def add_auth(request):
title = _('Add another Authentication method')
came_from = request.params.get('came_from', \
route_url(apex_settings('came_from_route'), request))
auth_id = authenticated_userid(request)
request.session['id'] = auth_id
auth_providers = apex_id_providers(aut... | def add_auth(request):
| title = _('Add another Authentication method')
came_from = request.params.get('came_from', \
route_url(apex_settings('came_from_route'), request))
auth_id = authenticated_userid(request)
request.session['id'] = auth_id
auth_providers = apex_id_providers(auth_id)
exclude = set... | form = RegisterForm(request.POST, captcha={'ip_address': \
request.environ['REMOTE_ADDR']})
else:
form = None
if request.method == 'POST' and form.validate():
user = form.save()
headers = apex_remember(request, user)
return HTTPFound(location=came_from, headers=hea... | 105 | 105 | 352 | 5 | 100 | timgates42/apex | apex/views.py | Python | add_auth | add_auth | 260 | 298 | 260 | 260 | 76bc4b73b2a6070ed00c52fee07035bd3bcef23c | bigcode/the-stack | train |
3437abbafc17550105ac6ac5 | train | function | def register(request):
""" register(request):
no return value, called with route_url('apex_register', request)
"""
title = _('Register')
came_from = request.params.get('came_from', \
route_url(apex_settings('came_from_route'), request))
velruse_forms = generate_velruse_forms(... | def register(request):
| """ register(request):
no return value, called with route_url('apex_register', request)
"""
title = _('Register')
came_from = request.params.get('came_from', \
route_url(apex_settings('came_from_route'), request))
velruse_forms = generate_velruse_forms(request, came_from)
... | hmac_key == submitted_hmac[0:10]:
user.active = 'Y'
DBSession.merge(user)
DBSession.flush()
flash(_('Account activated. Please log in.'))
return HTTPFound(location=route_url('apex_login', \
request))
flash(_... | 92 | 92 | 307 | 4 | 88 | timgates42/apex | apex/views.py | Python | register | register | 222 | 258 | 222 | 222 | 662a2e19b9a278efb7d02ac2f036d388406be842 | bigcode/the-stack | train |
4f15a7f40d379024bdc1d37b | train | function | def openid_required(request):
""" openid_required(request)
no return value
If apex_settings.openid_required is set, and the ax/sx from the OpenID
auth doesn't return the required fields, this is called which builds
a dynamic form to ask for the missing inforation.
Called on Registration or Log... | def openid_required(request):
| """ openid_required(request)
no return value
If apex_settings.openid_required is set, and the ax/sx from the OpenID
auth doesn't return the required fields, this is called which builds
a dynamic form to ask for the missing inforation.
Called on Registration or Login with OpenID Authentication.... | % \
(route_url('apex_openid_required', request), \
request.GET.get('came_from', \
route_url(apex_settings('came_from_route'), request))))
headers = apex_remember(request, user)
redir = request.GET.get('came_from', \
... | 103 | 103 | 346 | 6 | 97 | timgates42/apex | apex/views.py | Python | openid_required | openid_required | 363 | 403 | 363 | 363 | baf7ed8f6ec48fdafb51ad997e9cef3d6f6705a6 | bigcode/the-stack | train |
419eb8c6ef0dd19efc5aa3b2 | train | function | def reset_password(request):
""" reset_password(request):
no return value, called with route_url('apex_reset_password', request)
"""
title = _('Reset My Password')
if asbool(apex_settings('use_recaptcha_on_reset')):
if apex_settings('recaptcha_public_key') and \
apex_settings('r... | def reset_password(request):
| """ reset_password(request):
no return value, called with route_url('apex_reset_password', request)
"""
title = _('Reset My Password')
if asbool(apex_settings('use_recaptcha_on_reset')):
if apex_settings('recaptcha_public_key') and \
apex_settings('recaptcha_private_key'):
... | ]
time_key = base64.urlsafe_b64encode('%d' % timestamp)
email_hash = '%s%s' % (hmac_key, time_key)
apex_email_forgot(request, user.id, user.email, email_hash)
flash(_('Password Reset email sent.'))
return HTTPFound(location=route_url('apex_login', \
... | 114 | 114 | 383 | 5 | 109 | timgates42/apex | apex/views.py | Python | reset_password | reset_password | 160 | 197 | 160 | 160 | a0b9ca30fb486ce00e94cef00114bb5214504f35 | bigcode/the-stack | train |
4e4394aa96fc46c86db9d8e8 | train | function | def activate(request):
"""
"""
user_id = request.matchdict.get('user_id')
user = AuthID.get_by_id(user_id)
submitted_hmac = request.matchdict.get('hmac')
current_time = time.time()
time_key = int(base64.b64decode(submitted_hmac[10:]))
if current_time < time_key:
hmac_key = hmac.n... | def activate(request):
| """
"""
user_id = request.matchdict.get('user_id')
user = AuthID.get_by_id(user_id)
submitted_hmac = request.matchdict.get('hmac')
current_time = time.time()
time_key = int(base64.b64decode(submitted_hmac[10:]))
if current_time < time_key:
hmac_key = hmac.new('%s:%s:%d' % (str(us... | route_url('apex_login', \
request))
else:
flash(_('Invalid request, please try again'))
return HTTPFound(location=route_url('apex_forgot', \
request))
return {'title': ... | 64 | 64 | 211 | 4 | 60 | timgates42/apex | apex/views.py | Python | activate | activate | 199 | 220 | 199 | 199 | aa2ccc8eea7f3ce48f4f0c53e883ddf1b15f030d | bigcode/the-stack | train |
227c763ff9d4424140acd667 | train | function | def apex_callback(request):
""" apex_callback(request):
no return value, called with route_url('apex_callback', request)
This is the URL that Velruse returns an OpenID request to
"""
redir = request.GET.get('came_from', \
route_url(apex_settings('came_from_route'), request))
hea... | def apex_callback(request):
| """ apex_callback(request):
no return value, called with route_url('apex_callback', request)
This is the URL that Velruse returns an OpenID request to
"""
redir = request.GET.get('came_from', \
route_url(apex_settings('came_from_route'), request))
headers = []
if 'token' in ... | asbool(apex_settings('use_recaptcha_on_auth')):
if apex_settings('recaptcha_public_key') and \
apex_settings('recaptcha_private_key'):
AddAuthForm.captcha = RecaptchaField(
public_key=apex_settings('recaptcha_public_key'),
private_key=... | 159 | 159 | 530 | 5 | 154 | timgates42/apex | apex/views.py | Python | apex_callback | apex_callback | 300 | 361 | 300 | 300 | 6d21967e3c2e742c81ca1cde363eb93c341f4b28 | bigcode/the-stack | train |
01feb612fcb02a3b86f4eeab | train | function | def change_password(request):
""" change_password(request):
no return value, called with route_url('apex_change_password', request)
FIXME doesn't adjust auth_user based on local ID, how do we handle
multiple IDs that are local? Do we tell person that they don't have
local permissions... | def change_password(request):
| """ change_password(request):
no return value, called with route_url('apex_change_password', request)
FIXME doesn't adjust auth_user based on local ID, how do we handle
multiple IDs that are local? Do we tell person that they don't have
local permissions?
"""
title = _('Chang... | logout(request):
""" logout(request):
no return value, called with route_url('apex_logout', request)
"""
headers = forget(request)
came_from = get_came_from(request)
request.session.invalidate()
return HTTPFound(location=came_from, headers=headers)
def change_password(request):
| 64 | 64 | 207 | 5 | 59 | timgates42/apex | apex/views.py | Python | change_password | change_password | 92 | 114 | 92 | 92 | 19cb3c7b4cc4feca36c5828b51944c70f39cf110 | bigcode/the-stack | train |
9499c35a7ea9d4f6b2cd1db0 | train | class | class Endpoint(pulumi.CustomResource):
def __init__(__self__,
resource_name: str,
opts: Optional[pulumi.ResourceOptions] = None,
endpoint_location: Optional[pulumi.Input[str]] = None,
endpoint_monitor_status: Optional[pulumi.Input[str]] = None,
... | class Endpoint(pulumi.CustomResource):
| def __init__(__self__,
resource_name: str,
opts: Optional[pulumi.ResourceOptions] = None,
endpoint_location: Optional[pulumi.Input[str]] = None,
endpoint_monitor_status: Optional[pulumi.Input[str]] = None,
endpoint_name: Optional[p... | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from ... import _utilities, _tables
__a... | 90 | 256 | 2,773 | 8 | 82 | pulumi-bot/pulumi-azure-native | sdk/python/pulumi_azure_native/network/v20170301/endpoint.py | Python | Endpoint | Endpoint | 14 | 227 | 14 | 14 | 5c55e2374361ebe76e6e618c34df9d462a5d57c9 | bigcode/the-stack | train |
cf22b82a7bb1b49dae3a95af | train | function | def main():
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "my_new_app_31789.settings")
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"availab... | def main():
| os.environ.setdefault("DJANGO_SETTINGS_MODULE", "my_new_app_31789.settings")
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your P... | #!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
| 26 | 64 | 97 | 3 | 22 | crowdbotics-apps/my-new-app-31789 | backend/manage.py | Python | main | main | 7 | 17 | 7 | 7 | ebf1236d8d678ac30f6043b27602591080dedde5 | bigcode/the-stack | train |
ef0dd6226beff84b15658383 | train | function | def test_kill_actor_immediately_after_creation(ray_start_regular):
with ray_start_client_server() as ray:
@ray.remote
class A:
pass
a = A.remote()
b = A.remote()
ray.kill(a)
ray.kill(b)
wait_for_condition(_all_actors_dead(ray), timeout=10)
| def test_kill_actor_immediately_after_creation(ray_start_regular):
| with ray_start_client_server() as ray:
@ray.remote
class A:
pass
a = A.remote()
b = A.remote()
ray.kill(a)
ray.kill(b)
wait_for_condition(_all_actors_dead(ray), timeout=10)
| _ray
def _all_actors_dead_internal():
return all(actor["State"] == real_ray.gcs_utils.ActorTableData.DEAD
for actor in list(real_ray.actors().values()))
return _all_actors_dead_internal
def test_kill_actor_immediately_after_creation(ray_start_regular):
| 64 | 64 | 72 | 13 | 50 | jacobowitz/ray | python/ray/tests/test_client_terminate.py | Python | test_kill_actor_immediately_after_creation | test_kill_actor_immediately_after_creation | 32 | 44 | 32 | 32 | 78087c0c71f6b4e62694c4ad8a3e71199d4eb79e | bigcode/the-stack | train |
2be63faa95a6104ea2e9eddc | train | function | def valid_exceptions(use_force):
if use_force:
return (RayTaskError, TaskCancelledError, WorkerCrashedError,
ObjectLostError)
else:
return (RayTaskError, TaskCancelledError)
| def valid_exceptions(use_force):
| if use_force:
return (RayTaskError, TaskCancelledError, WorkerCrashedError,
ObjectLostError)
else:
return (RayTaskError, TaskCancelledError)
| import create_remote_signal_actor
from ray.test_utils import wait_for_condition
from ray.exceptions import TaskCancelledError
from ray.exceptions import RayTaskError
from ray.exceptions import WorkerCrashedError
from ray.exceptions import ObjectLostError
from ray.exceptions import GetTimeoutError
def valid_exceptions(... | 64 | 64 | 48 | 7 | 56 | jacobowitz/ray | python/ray/tests/test_client_terminate.py | Python | valid_exceptions | valid_exceptions | 14 | 19 | 14 | 14 | 4f727741c526e637e88cb26de41902d2eba596fb | bigcode/the-stack | train |
43357680a74afe143b90e673 | train | function | def _all_actors_dead(ray):
import ray as real_ray
def _all_actors_dead_internal():
return all(actor["State"] == real_ray.gcs_utils.ActorTableData.DEAD
for actor in list(real_ray.actors().values()))
return _all_actors_dead_internal
| def _all_actors_dead(ray):
| import ray as real_ray
def _all_actors_dead_internal():
return all(actor["State"] == real_ray.gcs_utils.ActorTableData.DEAD
for actor in list(real_ray.actors().values()))
return _all_actors_dead_internal
| from ray.exceptions import GetTimeoutError
def valid_exceptions(use_force):
if use_force:
return (RayTaskError, TaskCancelledError, WorkerCrashedError,
ObjectLostError)
else:
return (RayTaskError, TaskCancelledError)
def _all_actors_dead(ray):
| 64 | 64 | 64 | 8 | 56 | jacobowitz/ray | python/ray/tests/test_client_terminate.py | Python | _all_actors_dead | _all_actors_dead | 22 | 29 | 22 | 22 | 3b368012c5b6277fdab2775a99f369d679c10464 | bigcode/the-stack | train |
64840fecf2bb701e584d0386 | train | function | @pytest.mark.skipif(sys.platform == "win32", reason="Flaky on Windows.")
@pytest.mark.parametrize("use_force", [True, False])
def test_cancel_chain(ray_start_regular, use_force):
with ray_start_client_server() as ray:
SignalActor = create_remote_signal_actor(ray)
signaler = SignalActor.remote()
... | @pytest.mark.skipif(sys.platform == "win32", reason="Flaky on Windows.")
@pytest.mark.parametrize("use_force", [True, False])
def test_cancel_chain(ray_start_regular, use_force):
| with ray_start_client_server() as ray:
SignalActor = create_remote_signal_actor(ray)
signaler = SignalActor.remote()
@ray.remote
def wait_for(t):
return ray.get(t[0])
obj1 = wait_for.remote([signaler.wait.remote()])
obj2 = wait_for.remote([obj1])
... | mediately_after_creation(ray_start_regular):
with ray_start_client_server() as ray:
@ray.remote
class A:
pass
a = A.remote()
b = A.remote()
ray.kill(a)
ray.kill(b)
wait_for_condition(_all_actors_dead(ray), timeout=10)
@pytest.mark.skipif(sys.pla... | 107 | 107 | 357 | 41 | 66 | jacobowitz/ray | python/ray/tests/test_client_terminate.py | Python | test_cancel_chain | test_cancel_chain | 47 | 88 | 47 | 49 | f89025bea3940a5902fbc0dbc12e50aa26ae37ae | bigcode/the-stack | train |
2d14c61d00a16771406dc6db | train | function | def _is_coverage_enabled(base_path):
"""
Return whether to build C/C++ code with coverage enabled.
Args:
base_path: The package to check
"""
# Only use coverage if the global build mode coverage flag is set.
if not _get_coverage():
return False
# Make sure the `cxx.coverag... | def _is_coverage_enabled(base_path):
| """
Return whether to build C/C++ code with coverage enabled.
Args:
base_path: The package to check
"""
# Only use coverage if the global build mode coverage flag is set.
if not _get_coverage():
return False
# Make sure the `cxx.coverage_only` option allows this rule.
... | if prefixes == None:
return True
# Otherwise, the base path has to match one of the prefixes to enable
# coverage.
for prefix in shell.split(prefixes):
if base_path.startswith(prefix):
return True
return False
def _is_coverage_enabled(base_path):
| 64 | 64 | 175 | 9 | 54 | philipjameson/buckit | infra_macros/fbcode_macros/build_defs/coverage.bzl | Python | _is_coverage_enabled | _is_coverage_enabled | 86 | 110 | 86 | 86 | 64d0f2b6356ebacf6333b18f0fad9df890c95450 | bigcode/the-stack | train |
aa553ceec31c6cef3269978c | train | function | def _get_coverage_binary_deps():
""" Returns RuleTarget objects for all dependencies required for coverage to work """
if not _get_coverage():
fail("Tried to get coverage dependencies, but config fbcode.coverage is false")
compiler.require_global_compiler(
"can only use coverage with build ... | def _get_coverage_binary_deps():
| """ Returns RuleTarget objects for all dependencies required for coverage to work """
if not _get_coverage():
fail("Tried to get coverage dependencies, but config fbcode.coverage is false")
compiler.require_global_compiler(
"can only use coverage with build modes that use clang globally",
... | _DEPS = [
target_utils.ThirdPartyRuleTarget("llvm-fb", "clang_rt.profile"),
]
def _get_coverage():
"""
Whether to gather coverage information or not
"""
return read_boolean("fbcode", "coverage", False)
def _get_coverage_binary_deps():
| 64 | 64 | 120 | 9 | 55 | philipjameson/buckit | infra_macros/fbcode_macros/build_defs/coverage.bzl | Python | _get_coverage_binary_deps | _get_coverage_binary_deps | 32 | 46 | 32 | 32 | 7b26ec17accea71ff7fc9caf4a479a8ef4e5174f | bigcode/the-stack | train |
124b1bd2913f9e7a6c407f46 | train | function | def _allowed_by_coverage_only(base_path):
"""
Returns whether the `cxx.coverage_only` whitelists the given rule for
coverage. `cxx.coverage_only` should be a list of path prefixes if set.
Args:
base_path: The package to check
"""
prefixes = native.read_config("cxx", "coverage_only", No... | def _allowed_by_coverage_only(base_path):
| """
Returns whether the `cxx.coverage_only` whitelists the given rule for
coverage. `cxx.coverage_only` should be a list of path prefixes if set.
Args:
base_path: The package to check
"""
prefixes = native.read_config("cxx", "coverage_only", None)
# If not option was set, then alw... | check
"""
if _is_coverage_enabled(base_path):
if sanitizers.get_sanitizer() != None:
return _SANITIZER_COVERAGE_FLAGS
else:
return _SOURCE_BASED_COVERAGE_FLAGS
return []
def _allowed_by_coverage_only(base_path):
| 64 | 64 | 149 | 10 | 54 | philipjameson/buckit | infra_macros/fbcode_macros/build_defs/coverage.bzl | Python | _allowed_by_coverage_only | _allowed_by_coverage_only | 63 | 84 | 63 | 63 | ea43290c6a6812165be49678140e810be04180dd | bigcode/the-stack | train |
fa2cb1fdda490a741c119af9 | train | function | def _get_coverage_ldflags(base_path):
"""
Return compiler flags needed to support coverage builds.
Args:
base_path: The package to check
"""
if _is_coverage_enabled(base_path) and sanitizers.get_sanitizer() == None:
return _COVERAGE_MAPPING_LDFLAGS
return []
| def _get_coverage_ldflags(base_path):
| """
Return compiler flags needed to support coverage builds.
Args:
base_path: The package to check
"""
if _is_coverage_enabled(base_path) and sanitizers.get_sanitizer() == None:
return _COVERAGE_MAPPING_LDFLAGS
return []
| so work seamlessly with Buck's caching
# (http://llvm.org/docs/CoverageMappingFormat.html).
compiler.require_global_compiler(
"can only use coverage with build modes that use clang globally",
"clang",
)
return True
def _get_coverage_ldflags(base_path):
| 64 | 64 | 72 | 10 | 53 | philipjameson/buckit | infra_macros/fbcode_macros/build_defs/coverage.bzl | Python | _get_coverage_ldflags | _get_coverage_ldflags | 112 | 122 | 112 | 112 | ab58a3f55264452b4f33dbf6ea92c53affc48a62 | bigcode/the-stack | train |
da346b793273c98e25156498 | train | function | def _get_coverage():
"""
Whether to gather coverage information or not
"""
return read_boolean("fbcode", "coverage", False)
| def _get_coverage():
| """
Whether to gather coverage information or not
"""
return read_boolean("fbcode", "coverage", False)
| "-fprofile-instr-generate",
"-fcoverage-mapping",
]
# Deps to add if no sanitizer is specified
_NO_SANITIZER_COVERAGE_BINARY_DEPS = [
target_utils.ThirdPartyRuleTarget("llvm-fb", "clang_rt.profile"),
]
def _get_coverage():
| 64 | 64 | 32 | 6 | 58 | philipjameson/buckit | infra_macros/fbcode_macros/build_defs/coverage.bzl | Python | _get_coverage | _get_coverage | 26 | 30 | 26 | 26 | 61c7ecccf7025943589c1a536f930a71a17b0a36 | bigcode/the-stack | train |
71c1151edcf4082f8467387f | train | function | def _get_coverage_flags(base_path):
"""
Return compiler flags needed to support coverage builds.
Args:
base_path: The package to check
"""
if _is_coverage_enabled(base_path):
if sanitizers.get_sanitizer() != None:
return _SANITIZER_COVERAGE_FLAGS
else:
... | def _get_coverage_flags(base_path):
| """
Return compiler flags needed to support coverage builds.
Args:
base_path: The package to check
"""
if _is_coverage_enabled(base_path):
if sanitizers.get_sanitizer() != None:
return _SANITIZER_COVERAGE_FLAGS
else:
return _SOURCE_BASED_COVERAGE_FLA... | build modes that use clang globally",
"clang",
)
if sanitizers.get_sanitizer() == None:
return _NO_SANITIZER_COVERAGE_BINARY_DEPS
# all coverage deps are included in the santizer deps
return []
def _get_coverage_flags(base_path):
| 64 | 64 | 85 | 9 | 55 | philipjameson/buckit | infra_macros/fbcode_macros/build_defs/coverage.bzl | Python | _get_coverage_flags | _get_coverage_flags | 48 | 61 | 48 | 48 | 31fbf4837fc27c9a26961d05a87cbc5fbd470215 | bigcode/the-stack | train |
8c8b750eda2dfa514a5e3ac3 | train | class | class DistInfoTestCase(unittest.TestCase):
def test_dist_info(self):
""" тест функций """
self.assertEqual(123, 123, '')
| class DistInfoTestCase(unittest.TestCase):
| def test_dist_info(self):
""" тест функций """
self.assertEqual(123, 123, '')
| import sys
import unittest
sys.path.append(".")
from dist_info import files, modules
class DistInfoTestCase(unittest.TestCase):
| 28 | 64 | 32 | 9 | 18 | darviarush/python-dist-info | tests/test_dist_info.py | Python | DistInfoTestCase | DistInfoTestCase | 8 | 13 | 8 | 9 | 6b0b1dbf1b65554323aef5a3dc095745d6c94a31 | bigcode/the-stack | train |
ac4d7d4be283b12bf0b8f4f4 | train | function | def expandVars(path):
for k, v in list(os.environ.items()):
path = path.replace("%" + k + "%", v).replace("%" + k.lower() + "%", v)
return path
| def expandVars(path):
| for k, v in list(os.environ.items()):
path = path.replace("%" + k + "%", v).replace("%" + k.lower() + "%", v)
return path
| s = sublime.load_settings("Side Bar.sublime-settings")
Pref = Pref()
Pref.load()
s.clear_on_change("reload")
s.add_on_change("reload", lambda: Pref.load())
def Window(window=None):
return window if window else sublime.active_window()
def expandVars(path):
| 64 | 64 | 46 | 5 | 59 | 52fisher/SideBarEnhancements | SideBar.py | Python | expandVars | expandVars | 76 | 79 | 76 | 76 | f3e5e0447f520f3d7c6ee973218868eee208b27d | bigcode/the-stack | train |
8b5f6951d2a3d48b03271707 | train | class | class SideBarPasteCommand2(sublime_plugin.WindowCommand):
def run(self, paths=[], in_parent="False", test="True", replace="False", key=""):
window_set_status(key, "Pasting…")
s = sublime.load_settings("SideBarEnhancements/Clipboard.sublime-settings")
cut = s.get("cut", "")
copy = s... | class SideBarPasteCommand2(sublime_plugin.WindowCommand):
| def run(self, paths=[], in_parent="False", test="True", replace="False", key=""):
window_set_status(key, "Pasting…")
s = sublime.load_settings("SideBarEnhancements/Clipboard.sublime-settings")
cut = s.get("cut", "")
copy = s.get("copy", "")
already_exists_paths = []
... | ())
SideBarPasteThread(paths, in_parent, test, replace, key).start()
def is_enabled(self, paths=[], in_parent=False):
s = sublime.load_settings("SideBarEnhancements/Clipboard.sublime-settings")
return (s.get("cut", "") + s.get("copy", "")) != "" and len(
CACHED_SELECTION(paths).... | 256 | 256 | 886 | 13 | 243 | 52fisher/SideBarEnhancements | SideBar.py | Python | SideBarPasteCommand2 | SideBarPasteCommand2 | 934 | 1,056 | 934 | 934 | c78c1b754313fee022a16db8271b5d588c86cc30 | bigcode/the-stack | train |
3eec1e117dc2b5759353593b | train | class | class SideBarMoveCommand(sublime_plugin.WindowCommand):
def run(self, paths=[], new=False):
import functools
Window().run_command("hide_panel")
view = Window().show_input_panel(
"New Location:",
new or SideBarSelection(paths).getSelectedItems()[0].path(),
... | class SideBarMoveCommand(sublime_plugin.WindowCommand):
| def run(self, paths=[], new=False):
import functools
Window().run_command("hide_panel")
view = Window().show_input_panel(
"New Location:",
new or SideBarSelection(paths).getSelectedItems()[0].path(),
functools.partial(
self.on_done, SideBa... | )
else:
for content in os.listdir(path):
file = os.path.join(path, content)
if os.path.isfile(file) or os.path.islink(file):
paths.append(file)
else:
self.recurse(file, paths)
paths.append(path)
class... | 69 | 69 | 232 | 12 | 57 | 52fisher/SideBarEnhancements | SideBar.py | Python | SideBarMoveCommand | SideBarMoveCommand | 1,831 | 1,862 | 1,831 | 1,831 | f3c260ccf6f5ba8fe26631b9c06294f2c34b32fe | bigcode/the-stack | train |
ed7802f746f610cd86a8a167 | train | class | class SideBarCopyPathAbsoluteFromProjectCommand(sublime_plugin.WindowCommand):
def run(self, paths=[]):
items = []
for item in SideBarSelection(paths).getSelectedItems():
if (
s.get("copy_path_absolute_from_project_includes_line_number", False)
and item.vi... | class SideBarCopyPathAbsoluteFromProjectCommand(sublime_plugin.WindowCommand):
| def run(self, paths=[]):
items = []
for item in SideBarSelection(paths).getSelectedItems():
if (
s.get("copy_path_absolute_from_project_includes_line_number", False)
and item.views()
):
view = item.views()[0]
if ... | copied")
else:
sublime.status_message("Item copied")
except:
pass
def is_enabled(self, paths=[]):
return CACHED_SELECTION(paths).len() > 0 and len(view_locations_stack) > 1
class SideBarCopyPathAbsoluteFromProjectCommand(sublime_plugin.WindowCommand)... | 66 | 66 | 223 | 16 | 49 | 52fisher/SideBarEnhancements | SideBar.py | Python | SideBarCopyPathAbsoluteFromProjectCommand | SideBarCopyPathAbsoluteFromProjectCommand | 1,290 | 1,318 | 1,290 | 1,290 | 8975c155146d1ff741e74ecf208df241334fde5b | bigcode/the-stack | train |
39ab6531dcb868891d4ea133 | train | class | class SideBarCopyNameEncodedCommand(sublime_plugin.WindowCommand):
def run(self, paths=[]):
items = []
for item in SideBarSelection(paths).getSelectedItems():
items.append(item.nameEncoded())
if len(items) > 0:
sublime.set_clipboard("\n".join(items))
if l... | class SideBarCopyNameEncodedCommand(sublime_plugin.WindowCommand):
| def run(self, paths=[]):
items = []
for item in SideBarSelection(paths).getSelectedItems():
items.append(item.nameEncoded())
if len(items) > 0:
sublime.set_clipboard("\n".join(items))
if len(items) > 1:
sublime.status_message("Items copied... | _message("Item copied")
def is_enabled(self, paths=[]):
return CACHED_SELECTION(paths).len() > 0
def is_visible(self, paths=[]):
return not s.get("disabled_menuitem_copy_name", False)
class SideBarCopyNameEncodedCommand(sublime_plugin.WindowCommand):
| 64 | 64 | 116 | 14 | 50 | 52fisher/SideBarEnhancements | SideBar.py | Python | SideBarCopyNameEncodedCommand | SideBarCopyNameEncodedCommand | 1,079 | 1,093 | 1,079 | 1,079 | 913ab4d3b11885fec5feaf399d03368e1edaefad | bigcode/the-stack | train |
62623305dc03a8f6fe274bd5 | train | class | class SideBarCopyPathCommand(sublime_plugin.WindowCommand):
def run(self, paths=[]):
items = []
for item in SideBarSelection(paths).getSelectedItems():
items.append(item.path())
if len(items) > 0:
sublime.set_clipboard("\n".join(items))
if len(items) > 1:... | class SideBarCopyPathCommand(sublime_plugin.WindowCommand):
| def run(self, paths=[]):
items = []
for item in SideBarSelection(paths).getSelectedItems():
items.append(item.path())
if len(items) > 0:
sublime.set_clipboard("\n".join(items))
if len(items) > 1:
sublime.status_message("Items copied")
... | ))
if len(items) > 1:
sublime.status_message("Items copied")
else:
sublime.status_message("Item copied")
def is_enabled(self, paths=[]):
return CACHED_SELECTION(paths).len() > 0
class SideBarCopyPathCommand(sublime_plugin.WindowCommand):
| 64 | 64 | 114 | 13 | 50 | 52fisher/SideBarEnhancements | SideBar.py | Python | SideBarCopyPathCommand | SideBarCopyPathCommand | 1,096 | 1,110 | 1,096 | 1,096 | 7b8dcf12605ee1dfd3de1fa7ac7541396c75a8a1 | bigcode/the-stack | train |
9cc70fb32367b8d0b3aa031e | train | class | class Object:
pass
| class Object:
| pass
| ("%" + k + "%", v).replace("%" + k.lower() + "%", v)
return path
def window_set_status(key, name=""):
for window in sublime.windows():
for view in window.views():
view.set_status("SideBar-" + key, name)
class Object:
| 64 | 64 | 6 | 3 | 61 | 52fisher/SideBarEnhancements | SideBar.py | Python | Object | Object | 88 | 89 | 88 | 88 | ae4d843ad0dee8618626cbd36ec2b0c94e1545a4 | bigcode/the-stack | train |
2d15e6547f289ce7aa25f2b8 | train | class | class DefaultDirectory:
pass
| class DefaultDirectory:
| pass
| %Y"),
time.localtime(mtime),
)
if s.get("statusbar_modified_time_locale", "") != "":
modified_time = modified_time.decode(
s.get("statusbar_modified_time_locale", "")
)
v.set_status("statusbar_modified_time", modified_time)
class DefaultDirect... | 64 | 64 | 7 | 4 | 60 | 52fisher/SideBarEnhancements | SideBar.py | Python | DefaultDirectory | DefaultDirectory | 2,730 | 2,731 | 2,730 | 2,730 | 2fb1de400cf2cda6ae147409a21c79fedfdddc88 | bigcode/the-stack | train |
6f4c60470aa44088e974a6f4 | train | class | class SideBarFindInProjectCommand(sublime_plugin.WindowCommand):
def run(self, paths=[]):
Window().run_command("hide_panel")
Window().run_command(
"show_panel", {"panel": "find_in_files", "where": "<project>"}
)
def is_visible(self, paths=[]):
return not s.get("disab... | class SideBarFindInProjectCommand(sublime_plugin.WindowCommand):
| def run(self, paths=[]):
Window().run_command("hide_panel")
Window().run_command(
"show_panel", {"panel": "find_in_files", "where": "<project>"}
)
def is_visible(self, paths=[]):
return not s.get("disabled_menuitem_find_in_project", False)
| Command(sublime_plugin.WindowCommand):
def run(self):
Window().run_command("hide_panel")
Window().run_command(
"show_panel", {"panel": "find_in_files", "where": "<project>"}
)
class SideBarFindInProjectCommand(sublime_plugin.WindowCommand):
| 64 | 64 | 83 | 14 | 50 | 52fisher/SideBarEnhancements | SideBar.py | Python | SideBarFindInProjectCommand | SideBarFindInProjectCommand | 619 | 627 | 619 | 619 | 9b9fea86f79726f7cc325c6365997aa5aaaf9a84 | bigcode/the-stack | train |
483283c6f1708fb265ba1d48 | train | class | class SideBarCopyPathRelativeFromViewCommand(sublime_plugin.WindowCommand):
def run(self, paths=[]):
items = []
for item in SideBarSelection(paths).getSelectedItems():
items.append(item.pathRelativeFromView())
if len(items) > 0:
sublime.set_clipboard("\n".join(items)... | class SideBarCopyPathRelativeFromViewCommand(sublime_plugin.WindowCommand):
| def run(self, paths=[]):
items = []
for item in SideBarSelection(paths).getSelectedItems():
items.append(item.pathRelativeFromView())
if len(items) > 0:
sublime.set_clipboard("\n".join(items))
if len(items) > 1:
sublime.status_message("Ite... | else:
sublime.status_message("Item copied")
def is_enabled(self, paths=[]):
return (
CACHED_SELECTION(paths).len() > 0
and CACHED_SELECTION(paths).hasItemsUnderProject()
)
class SideBarCopyPathRelativeFromViewCommand(sublime_plugin.WindowCommand):
| 64 | 64 | 120 | 16 | 48 | 52fisher/SideBarEnhancements | SideBar.py | Python | SideBarCopyPathRelativeFromViewCommand | SideBarCopyPathRelativeFromViewCommand | 1,207 | 1,221 | 1,207 | 1,207 | 99c1b79bada3547d299095217e5ee596310da7f0 | bigcode/the-stack | train |
42a97b7271d0de740c70fc6f | train | class | class SideBarCopyContentUtf8Command(sublime_plugin.WindowCommand):
def run(self, paths=[]):
items = []
for item in SideBarSelection(paths).getSelectedFiles():
items.append(item.contentUTF8())
if len(items) > 0:
sublime.set_clipboard("\n".join(items))
if l... | class SideBarCopyContentUtf8Command(sublime_plugin.WindowCommand):
| def run(self, paths=[]):
items = []
for item in SideBarSelection(paths).getSelectedFiles():
items.append(item.contentUTF8())
if len(items) > 0:
sublime.set_clipboard("\n".join(items))
if len(items) > 1:
sublime.status_message("Items conten... | _clipboard("\n".join(items))
if len(items) > 1:
sublime.status_message("Items copied")
else:
sublime.status_message("Item copied")
def is_enabled(self, paths=[]):
return True
class SideBarCopyContentUtf8Command(sublime_plugin.WindowCommand):
| 64 | 64 | 117 | 15 | 48 | 52fisher/SideBarEnhancements | SideBar.py | Python | SideBarCopyContentUtf8Command | SideBarCopyContentUtf8Command | 1,533 | 1,547 | 1,533 | 1,533 | 45b49be04a58b1add251a612009ce0d294e06318 | bigcode/the-stack | train |
baca4e3e482692d1a6bb2604 | train | class | class SideBarMassRenameThread(threading.Thread):
def __init__(self, paths, find, replace, key):
self.paths = paths
self.find = find
self.replace = replace
self.key = key
threading.Thread.__init__(self)
def run(self):
paths = self.paths
find = self.find
... | class SideBarMassRenameThread(threading.Thread):
| def __init__(self, paths, find, replace, key):
self.paths = paths
self.find = find
self.replace = replace
self.key = key
threading.Thread.__init__(self)
def run(self):
paths = self.paths
find = self.find
replace = self.replace
key = self.k... | ().show_input_panel(
"Replace:", "", functools.partial(self.on_replace, paths, find), None, None
)
def on_replace(self, paths, find, replace):
key = "mass-renaming-" + str(time.time())
SideBarMassRenameThread(paths, find, replace, key).start()
def is_enabled(self, paths=[])... | 99 | 99 | 333 | 10 | 88 | 52fisher/SideBarEnhancements | SideBar.py | Python | SideBarMassRenameThread | SideBarMassRenameThread | 1,780 | 1,828 | 1,780 | 1,780 | 1e63f7c76d294008343d29c320f1adf0c7f60e28 | bigcode/the-stack | train |
0409f0fccf4f27e4944c000d | train | class | class SideBarProjectOpenFileCommand(sublime_plugin.WindowCommand):
def run(self, paths=[]):
project = SideBarProject()
if project.hasOpenedProject():
SideBarItem(project.getProjectFile(), False).edit()
def is_enabled(self, paths=[]):
return SideBarProject().hasOpenedProject(... | class SideBarProjectOpenFileCommand(sublime_plugin.WindowCommand):
| def run(self, paths=[]):
project = SideBarProject()
if project.hasOpenedProject():
SideBarItem(project.getProjectFile(), False).edit()
def is_enabled(self, paths=[]):
return SideBarProject().hasOpenedProject()
| names()
else:
paths = SideBarSelection(paths).getSelectedItems()
for item in paths:
item.reveal()
def is_enabled(self, paths=[]):
return CACHED_SELECTION(paths).len() > 0
class SideBarProjectOpenFileCommand(sublime_plugin.WindowCommand):
| 64 | 64 | 68 | 14 | 49 | 52fisher/SideBarEnhancements | SideBar.py | Python | SideBarProjectOpenFileCommand | SideBarProjectOpenFileCommand | 2,171 | 2,178 | 2,171 | 2,171 | a1f5700cb647c1a46e02fdcfd2ea274d1907ddbd | bigcode/the-stack | train |
a072f1ab24c5d48d48f25014 | train | class | class aaaaaSideBarCommand(sublime_plugin.WindowCommand):
def run(self, paths=[]):
pass
def is_visible(self, paths=[]): # <- WORKS AS AN ONPOPUPSHOWN
Cache.cached = SideBarSelection(paths)
return False
| class aaaaaSideBarCommand(sublime_plugin.WindowCommand):
| def run(self, paths=[]):
pass
def is_visible(self, paths=[]): # <- WORKS AS AN ONPOPUPSHOWN
Cache.cached = SideBarSelection(paths)
return False
| name=""):
for window in sublime.windows():
for view in window.views():
view.set_status("SideBar-" + key, name)
class Object:
pass
class Cache:
pass
Cache = Cache()
Cache.cached = False
class aaaaaSideBarCommand(sublime_plugin.WindowCommand):
| 64 | 64 | 59 | 13 | 50 | 52fisher/SideBarEnhancements | SideBar.py | Python | aaaaaSideBarCommand | aaaaaSideBarCommand | 100 | 106 | 100 | 100 | e679ef55f9e49a3ade90306cada945812fe2fb26 | bigcode/the-stack | train |
88c7a48e323f42f67cce4d2e | train | class | class Pref:
def load(self):
pass
| class Pref:
| def load(self):
pass
| stderr, "stdout": stdout, "returncode": p.returncode}
return p
def CACHED_SELECTION(paths=[]):
if Cache.cached:
return Cache.cached
else:
return SideBarSelection(paths)
def escapeCMDWindows(string):
return string.replace("^", "^^")
class Pref:
| 64 | 64 | 11 | 3 | 61 | 52fisher/SideBarEnhancements | SideBar.py | Python | Pref | Pref | 58 | 60 | 58 | 58 | 7f62b3a8797a9e16efa6cb7eb8b70f014921eca4 | bigcode/the-stack | train |
cf233b3c3f8039240510e87a | train | class | class SideBarDeleteThread(threading.Thread):
def __init__(self, paths):
self.paths = paths
threading.Thread.__init__(self)
def run(self):
SideBarDeleteCommand(Window())._delete_threaded(self.paths)
| class SideBarDeleteThread(threading.Thread):
| def __init__(self, paths):
self.paths = paths
threading.Thread.__init__(self)
def run(self):
SideBarDeleteCommand(Window())._delete_threaded(self.paths)
| Unable to move:\n\n" + old + "\n\nto\n\n" + new)
SideBarMoveCommand(Window()).run([old], new)
raise
return
SideBarProject().refresh()
window_set_status(key, "")
class SideBarDeleteThread(threading.Thread):
| 63 | 64 | 51 | 9 | 54 | 52fisher/SideBarEnhancements | SideBar.py | Python | SideBarDeleteThread | SideBarDeleteThread | 1,897 | 1,903 | 1,897 | 1,897 | ff681532f1b8cfac67e87642cd0b10593cd8148e | bigcode/the-stack | train |
b7a7cf1c61263525a9abc12a | train | class | class SideBarFindInProjectFoldersCommand(sublime_plugin.WindowCommand):
def run(self):
Window().run_command("hide_panel")
Window().run_command(
"show_panel", {"panel": "find_in_files", "where": "<project>"}
)
| class SideBarFindInProjectFoldersCommand(sublime_plugin.WindowCommand):
| def run(self):
Window().run_command("hide_panel")
Window().run_command(
"show_panel", {"panel": "find_in_files", "where": "<project>"}
)
| ().run_command(
"show_panel", {"panel": "find_in_files", "where": ",".join(items)}
)
def is_enabled(self, paths=[]):
return CACHED_SELECTION(paths).len() > 0
class SideBarFindInProjectFoldersCommand(sublime_plugin.WindowCommand):
| 64 | 64 | 57 | 15 | 48 | 52fisher/SideBarEnhancements | SideBar.py | Python | SideBarFindInProjectFoldersCommand | SideBarFindInProjectFoldersCommand | 611 | 616 | 611 | 611 | 1d2feab63d5d204673692923d72efbc49d835e2c | bigcode/the-stack | train |
6e4bff3fbccd4ed518d1c54e | train | class | class SideBarCutCommand(sublime_plugin.WindowCommand):
def run(self, paths=[]):
s = sublime.load_settings("SideBarEnhancements/Clipboard.sublime-settings")
items = []
for item in SideBarSelection(paths).getSelectedItemsWithoutChildItems():
items.append(item.path())
if le... | class SideBarCutCommand(sublime_plugin.WindowCommand):
| def run(self, paths=[]):
s = sublime.load_settings("SideBarEnhancements/Clipboard.sublime-settings")
items = []
for item in SideBarSelection(paths).getSelectedItemsWithoutChildItems():
items.append(item.path())
if len(items) > 0:
s.set("cut", "\n".join(items)... | _search_id == searchTerm:
view = self.view
view.replace(edit, sublime.Region(0, view.size()), content)
view.sel().clear()
view.sel().add(sublime.Region(position, position))
view.end_edit(edit)
class SideBarCutCommand(sublime_plugin.WindowCommand):
| 64 | 64 | 160 | 12 | 52 | 52fisher/SideBarEnhancements | SideBar.py | Python | SideBarCutCommand | SideBarCutCommand | 858 | 877 | 858 | 858 | d1e18d626541ed530c6780fd3005fd8c9e882b9a | bigcode/the-stack | train |
c0a1534fe9f982a74c872656 | train | class | class SideBarCopyNameCommand(sublime_plugin.WindowCommand):
def run(self, paths=[]):
items = []
for item in SideBarSelection(paths).getSelectedItems():
items.append(item.name())
if len(items) > 0:
sublime.set_clipboard("\n".join(items))
if len(items) > 1:... | class SideBarCopyNameCommand(sublime_plugin.WindowCommand):
| def run(self, paths=[]):
items = []
for item in SideBarSelection(paths).getSelectedItems():
items.append(item.name())
if len(items) > 0:
sublime.set_clipboard("\n".join(items))
if len(items) > 1:
sublime.status_message("Items copied")
... | :
if result == 0:
SideBarPasteThread(paths, in_parent, "False", "True", key).start()
else:
SideBarPasteThread(paths, in_parent, "False", "False", key).start()
class SideBarCopyNameCommand(sublime_plugin.WindowCommand):
| 64 | 64 | 137 | 13 | 51 | 52fisher/SideBarEnhancements | SideBar.py | Python | SideBarCopyNameCommand | SideBarCopyNameCommand | 1,059 | 1,076 | 1,059 | 1,059 | 7eb82d36a157faa8ead8c5f3ab34e9a902a63e30 | bigcode/the-stack | train |
9b6307d56b14bf290c44a82a | train | class | class SideBarProjectItemExcludeFromIndexCommand(sublime_plugin.WindowCommand):
def run(self, paths=[], type="item"):
Preferences = sublime.load_settings("Preferences.sublime-settings")
excluded = Preferences.get("binary_file_patterns", [])
for item in self.items(paths, type, SideBarSelection... | class SideBarProjectItemExcludeFromIndexCommand(sublime_plugin.WindowCommand):
| def run(self, paths=[], type="item"):
Preferences = sublime.load_settings("Preferences.sublime-settings")
excluded = Preferences.get("binary_file_patterns", [])
for item in self.items(paths, type, SideBarSelection(paths)):
excluded.append(item)
for k, v in enumerate(exclu... | item.path() in project.getDirectories() or not item.exists()
for item in selection.getSelectedItems()
]
)
class SideBarProjectItemExcludeCommand(sublime_plugin.WindowCommand):
def run(self, paths=[]):
project = SideBarProject()
for item in SideBarSelection(path... | 159 | 159 | 533 | 16 | 143 | 52fisher/SideBarEnhancements | SideBar.py | Python | SideBarProjectItemExcludeFromIndexCommand | SideBarProjectItemExcludeFromIndexCommand | 2,236 | 2,300 | 2,236 | 2,236 | daec35ed4bfab10f77a2ed7f11b2a8f7db712cbc | bigcode/the-stack | train |
f58aee1547b5eb280cb5101a | train | class | class SideBarCopyPathRelativeToLastSelectedViewCommand(sublime_plugin.WindowCommand):
def run(self, paths=[]):
try:
origin = view_locations_stack[-2]
items = []
for item in SideBarSelection(paths).getSelectedItems():
items.append(item.path())
... | class SideBarCopyPathRelativeToLastSelectedViewCommand(sublime_plugin.WindowCommand):
| def run(self, paths=[]):
try:
origin = view_locations_stack[-2]
items = []
for item in SideBarSelection(paths).getSelectedItems():
items.append(item.path())
temp = []
for index in range(len(items)):
if not os.path.... | v.file_name()
and (not view_locations_stack or view_locations_stack[-1] != v.file_name())
):
view_locations_stack.append(v.file_name())
view_locations_stack = view_locations_stack[-5:]
class SideBarCopyPathRelativeToLastSelectedViewCommand(sublime_plugin.WindowCommand):
| 63 | 64 | 202 | 18 | 45 | 52fisher/SideBarEnhancements | SideBar.py | Python | SideBarCopyPathRelativeToLastSelectedViewCommand | SideBarCopyPathRelativeToLastSelectedViewCommand | 1,258 | 1,287 | 1,258 | 1,258 | e19ada7d8f6923274b642f1e94f37cdd06b2d376 | bigcode/the-stack | train |
19ea92b9dec4e4321b06faf4 | train | class | class SideBarMassRenameCommand(sublime_plugin.WindowCommand):
def run(self, paths=[]):
import functools
Window().run_command("hide_panel")
Window().show_input_panel(
"Find:", "", functools.partial(self.on_find, paths), None, None
)
def on_find(self, paths, find):
... | class SideBarMassRenameCommand(sublime_plugin.WindowCommand):
| def run(self, paths=[]):
import functools
Window().run_command("hide_panel")
Window().show_input_panel(
"Find:", "", functools.partial(self.on_find, paths), None, None
)
def on_find(self, paths, find):
if not find:
return
import functools... | n\n" + old + "\n\nto\n\n" + new)
SideBarRenameCommand(Window()).run([old], leaf)
raise
return
SideBarProject().refresh()
window_set_status(key, "")
class SideBarMassRenameCommand(sublime_plugin.WindowCommand):
| 63 | 64 | 182 | 13 | 50 | 52fisher/SideBarEnhancements | SideBar.py | Python | SideBarMassRenameCommand | SideBarMassRenameCommand | 1,753 | 1,777 | 1,753 | 1,753 | d46607b7666020438122ec9fd1530fce4e29ea32 | bigcode/the-stack | train |
9e039dacb1d867c4e4843aca | train | class | class SideBarFolderCloseViewsCommand(sublime_plugin.WindowCommand):
def run(self, paths=[]):
collapsed = False
for item in SideBarSelection(paths).getSelectedDirectories():
for view in item.views():
if not collapsed:
Window().focus_view(view)
... | class SideBarFolderCloseViewsCommand(sublime_plugin.WindowCommand):
| def run(self, paths=[]):
collapsed = False
for item in SideBarSelection(paths).getSelectedDirectories():
for view in item.views():
if not collapsed:
Window().focus_view(view)
self.collapse_sidebar_folder()
colla... | CACHED_SELECTION(paths).hasDirectories()
and len(views) > 0
and has_dirty_view
)
def is_visible(self, paths=[]):
return not s.get("disabled_menuitem_folder_save", False)
class SideBarFolderCloseViewsCommand(sublime_plugin.WindowCommand):
| 64 | 64 | 207 | 14 | 50 | 52fisher/SideBarEnhancements | SideBar.py | Python | SideBarFolderCloseViewsCommand | SideBarFolderCloseViewsCommand | 259 | 283 | 259 | 259 | 8069f6fad56ff3524a215f350c1f08db30def3b1 | bigcode/the-stack | train |
15d08ccedc21587c2beba6a8 | train | class | class SideBarPreviewEditUrlsCommand(sublime_plugin.WindowCommand):
def run(self, paths=[]):
item = SideBarItem(
os.path.dirname(sublime.packages_path())
+ "/Settings/SideBarEnhancements.json",
False,
)
item.dirnameCreate()
item.edit()
| class SideBarPreviewEditUrlsCommand(sublime_plugin.WindowCommand):
| def run(self, paths=[]):
item = SideBarItem(
os.path.dirname(sublime.packages_path())
+ "/Settings/SideBarEnhancements.json",
False,
)
item.dirnameCreate()
item.edit()
| , paths=[]):
project = SideBarProject()
if project.hasOpenedProject():
SideBarItem(project.getProjectFile(), False).edit()
def is_enabled(self, paths=[]):
return SideBarProject().hasOpenedProject()
class SideBarPreviewEditUrlsCommand(sublime_plugin.WindowCommand):
| 64 | 64 | 65 | 14 | 50 | 52fisher/SideBarEnhancements | SideBar.py | Python | SideBarPreviewEditUrlsCommand | SideBarPreviewEditUrlsCommand | 2,181 | 2,189 | 2,181 | 2,181 | 28e03aabec6e0b66edd5b267ffcc7ed9294842f6 | bigcode/the-stack | train |
11a28a991d787e70e8866745 | train | class | class SideBarMoveThread(threading.Thread):
def __init__(self, old, new, key):
self.old = old
self.new = new
self.key = key
threading.Thread.__init__(self)
def run(self):
old = self.old
new = self.new
key = self.key
window_set_status(key, "Moving…"... | class SideBarMoveThread(threading.Thread):
| def __init__(self, old, new, key):
self.old = old
self.new = new
self.key = key
threading.Thread.__init__(self)
def run(self):
old = self.old
new = self.new
key = self.key
window_set_status(key, "Moving…")
item = SideBarItem(old, os.path.... | (time.time())
SideBarMoveThread(old, new, key).start()
def is_enabled(self, paths=[]):
return (
CACHED_SELECTION(paths).len() == 1
and CACHED_SELECTION(paths).hasProjectDirectories() is False
)
class SideBarMoveThread(threading.Thread):
| 65 | 65 | 217 | 9 | 56 | 52fisher/SideBarEnhancements | SideBar.py | Python | SideBarMoveThread | SideBarMoveThread | 1,865 | 1,894 | 1,865 | 1,865 | 1accc2988a68f97e0bd6da7c601e57b4cff2322d | bigcode/the-stack | train |
6fd222a81acb6b3a40c58af9 | train | class | class SideBarCopyUrlDecodedCommand(sublime_plugin.WindowCommand):
def run(self, paths=[]):
items = []
for item in SideBarSelection(paths).getSelectedItems():
if item.isUnderCurrentProject():
txt = item.url("url_production")
try:
txt = ... | class SideBarCopyUrlDecodedCommand(sublime_plugin.WindowCommand):
| def run(self, paths=[]):
items = []
for item in SideBarSelection(paths).getSelectedItems():
if item.isUnderCurrentProject():
txt = item.url("url_production")
try:
txt = urlunquote(txt.encode("utf8")).decode("utf8")
exce... | if len(items) > 1:
sublime.status_message("Items URL copied")
else:
sublime.status_message("Item URL copied")
def is_enabled(self, paths=[]):
return CACHED_SELECTION(paths).hasItemsUnderProject()
class SideBarCopyUrlDecodedCommand(sublime_plugin.WindowCommand):
| 64 | 64 | 166 | 14 | 50 | 52fisher/SideBarEnhancements | SideBar.py | Python | SideBarCopyUrlDecodedCommand | SideBarCopyUrlDecodedCommand | 1,586 | 1,607 | 1,586 | 1,586 | 77ade2af10d29ddc5aeabfe7e0e213191ccfa5c8 | bigcode/the-stack | train |
2334fa61b5e14e20d87ff295 | train | class | class SideBarProjectItemRemoveFolderCommand(sublime_plugin.WindowCommand):
def run(self, paths=[]):
Window().run_command("remove_folder", {"dirs": paths})
def is_enabled(self, paths=[]):
selection = CACHED_SELECTION(paths)
project = SideBarProject()
return project.hasDirectories... | class SideBarProjectItemRemoveFolderCommand(sublime_plugin.WindowCommand):
| def run(self, paths=[]):
Window().run_command("remove_folder", {"dirs": paths})
def is_enabled(self, paths=[]):
selection = CACHED_SELECTION(paths)
project = SideBarProject()
return project.hasDirectories() and all(
[
item.path() in project.getDirecto... | (paths).getSelectedDirectories():
project.add(item.path())
def is_enabled(self, paths=[]):
return (
CACHED_SELECTION(paths).hasDirectories()
and CACHED_SELECTION(paths).hasProjectDirectories() is False
)
class SideBarProjectItemRemoveFolderCommand(sublime_plugin.... | 64 | 64 | 99 | 15 | 49 | 52fisher/SideBarEnhancements | SideBar.py | Python | SideBarProjectItemRemoveFolderCommand | SideBarProjectItemRemoveFolderCommand | 2,205 | 2,217 | 2,205 | 2,205 | 7799d2423b008a71921f08829daa75c7ccdbf00d | bigcode/the-stack | train |
716cc7fb075eb09e35e6d713 | train | class | class SideBarStatusBarModifiedTime(sublime_plugin.EventListener):
def on_activated(self, v):
if v.file_name() and s.get("statusbar_modified_time", False):
try:
self.show(v, os.path.getmtime(v.file_name()))
except:
pass
def on_post_save(self, v):
... | class SideBarStatusBarModifiedTime(sublime_plugin.EventListener):
| def on_activated(self, v):
if v.file_name() and s.get("statusbar_modified_time", False):
try:
self.show(v, os.path.getmtime(v.file_name()))
except:
pass
def on_post_save(self, v):
if v.file_name() and s.get("statusbar_modified_time", False... | Windows(f.name),
escapeCMDWindows(view.file_name()),
]
)
f.close()
view.run_command("revert")
def is_visible(self):
return platform.system() == "Windows" or os.name == "nt"
class SideBarStatusBarModifiedTime(sublime_plugin.EventListener):
| 64 | 64 | 209 | 14 | 50 | 52fisher/SideBarEnhancements | SideBar.py | Python | SideBarStatusBarModifiedTime | SideBarStatusBarModifiedTime | 2,703 | 2,727 | 2,703 | 2,703 | 2ada01f1ff4482b23877fc80e4eb3322597a45fd | bigcode/the-stack | train |
eacdb8f53b734b450fbaa0e2 | train | class | class SideBarDefaultNewFolder(sublime_plugin.EventListener):
def on_new(self, view):
path = None
if not DefaultDirectory.path:
paths = SideBarProject().getDirectories()
if paths:
path = paths[0]
else:
path = DefaultDirectory.path
i... | class SideBarDefaultNewFolder(sublime_plugin.EventListener):
| def on_new(self, view):
path = None
if not DefaultDirectory.path:
paths = SideBarProject().getDirectories()
if paths:
path = paths[0]
else:
path = DefaultDirectory.path
if path:
view.settings().set("default_dir", path)
... | _time = modified_time.decode(
s.get("statusbar_modified_time_locale", "")
)
v.set_status("statusbar_modified_time", modified_time)
class DefaultDirectory:
pass
DefaultDirectory = DefaultDirectory()
DefaultDirectory.path = False
class SideBarDefaultNewFolder(sublime_plugin.Eve... | 64 | 64 | 121 | 13 | 50 | 52fisher/SideBarEnhancements | SideBar.py | Python | SideBarDefaultNewFolder | SideBarDefaultNewFolder | 2,738 | 2,755 | 2,738 | 2,738 | 15ba50efe07359350808e2edeaaa0e41c3f3e8e5 | bigcode/the-stack | train |
ed0f018fd09b0f8de16a0fbf | train | class | class SideBarFindInParentCommand(sublime_plugin.WindowCommand):
def run(self, paths=[]):
items = []
for item in SideBarSelection(paths).getSelectedItems():
items.append(item.dirname())
items = list(set(items))
Window().run_command("hide_panel")
Window().run_comman... | class SideBarFindInParentCommand(sublime_plugin.WindowCommand):
| def run(self, paths=[]):
items = []
for item in SideBarSelection(paths).getSelectedItems():
items.append(item.dirname())
items = list(set(items))
Window().run_command("hide_panel")
Window().run_command(
"show_panel", {"panel": "find_in_files", "where":... | Window().run_command(
"show_panel", {"panel": "find_in_files", "where": ",".join(items)}
)
def is_enabled(self, paths=[]):
return CACHED_SELECTION(paths).len() > 0
class SideBarFindInParentCommand(sublime_plugin.WindowCommand):
| 64 | 64 | 112 | 14 | 49 | 52fisher/SideBarEnhancements | SideBar.py | Python | SideBarFindInParentCommand | SideBarFindInParentCommand | 596 | 608 | 596 | 596 | a12d799845475b70e1fa28bdaef853b5a05a41d5 | bigcode/the-stack | train |
d457614c78650d61146913f9 | train | class | class SideBarCopyUrlCommand(sublime_plugin.WindowCommand):
def run(self, paths=[]):
items = []
for item in SideBarSelection(paths).getSelectedItems():
if item.isUnderCurrentProject():
items.append(item.url("url_production"))
if len(items) > 0:
sublim... | class SideBarCopyUrlCommand(sublime_plugin.WindowCommand):
| def run(self, paths=[]):
items = []
for item in SideBarSelection(paths).getSelectedItems():
if item.isUnderCurrentProject():
items.append(item.url("url_production"))
if len(items) > 0:
sublime.set_clipboard("\n".join(items))
if len(items)... | (items))
if len(items) > 1:
sublime.status_message("Items content copied")
else:
sublime.status_message("Item content copied")
def is_enabled(self, paths=[]):
return CACHED_SELECTION(paths).hasFiles()
class SideBarCopyUrlCommand(sublime_plugin.WindowC... | 64 | 64 | 127 | 13 | 51 | 52fisher/SideBarEnhancements | SideBar.py | Python | SideBarCopyUrlCommand | SideBarCopyUrlCommand | 1,567 | 1,583 | 1,567 | 1,567 | 47cd31e94753ad042e1cb2ca2d8bd7a9ce58b42c | bigcode/the-stack | train |
4213f60d6c7e2a15a74afcdd | train | class | class SideBarOpenInNewWindowCommand(sublime_plugin.WindowCommand):
def run(self, paths=[]):
import subprocess
items = []
executable_path = sublime.executable_path()
if sublime.platform() == "osx":
app_path = executable_path[: executable_path.rfind(".app/") + 5]
... | class SideBarOpenInNewWindowCommand(sublime_plugin.WindowCommand):
| def run(self, paths=[]):
import subprocess
items = []
executable_path = sublime.executable_path()
if sublime.platform() == "osx":
app_path = executable_path[: executable_path.rfind(".app/") + 5]
executable_path = app_path + "Contents/SharedSupport/bin/subl"... | :
commands = ["open", url]
subprocess.Popen(commands)
return
except:
pass
sublime.error_message(
'Browser "' + browser + '" not found!\nIs installed? Which location...?'
)
class SideBarOpenInNewWindowCommand(sublime_plugin.Wind... | 64 | 64 | 163 | 15 | 49 | 52fisher/SideBarEnhancements | SideBar.py | Python | SideBarOpenInNewWindowCommand | SideBarOpenInNewWindowCommand | 2,626 | 2,647 | 2,626 | 2,626 | 9353d3bd9b90b6fb6ea9008ef5c589d3a4da6f5f | bigcode/the-stack | train |
d2bfbdfcc08f5ba278ee4f65 | train | class | class SideBarDeleteCommand(sublime_plugin.WindowCommand):
def run(self, paths=[], confirmed="False"):
if confirmed == "False" and s.get("confirm_before_deleting", True):
if sublime.platform() == "osx":
if sublime.ok_cancel_dialog("Delete the selected items?"):
... | class SideBarDeleteCommand(sublime_plugin.WindowCommand):
| def run(self, paths=[], confirmed="False"):
if confirmed == "False" and s.get("confirm_before_deleting", True):
if sublime.platform() == "osx":
if sublime.ok_cancel_dialog("Delete the selected items?"):
self.run(paths, "True")
else:
... | = old
self.new = new
self.key = key
threading.Thread.__init__(self)
def run(self):
old = self.old
new = self.new
key = self.key
window_set_status(key, "Moving…")
item = SideBarItem(old, os.path.isdir(old))
try:
if not item.move(n... | 256 | 256 | 1,058 | 12 | 244 | 52fisher/SideBarEnhancements | SideBar.py | Python | SideBarDeleteCommand | SideBarDeleteCommand | 1,906 | 2,060 | 1,906 | 1,906 | e102dac6348e015387ab1d99a5e05c06b4a958df | bigcode/the-stack | train |
cfbf466e2ef435d52325fdf0 | train | class | class SideBarCopyProjectDirectoriesCommand(sublime_plugin.WindowCommand):
def run(self, paths=[]):
items = []
for directory in SideBarProject().getDirectories():
items.append(directory)
if len(items) > 0:
sublime.set_clipboard("\n".join(items))
if len(ite... | class SideBarCopyProjectDirectoriesCommand(sublime_plugin.WindowCommand):
| def run(self, paths=[]):
items = []
for directory in SideBarProject().getDirectories():
items.append(directory)
if len(items) > 0:
sublime.set_clipboard("\n".join(items))
if len(items) > 1:
sublime.status_message("Items copied")
... | else:
sublime.status_message("Item copied")
def is_enabled(self, paths=[]):
return (
CACHED_SELECTION(paths).hasFilesWithExtension("js")
and CACHED_SELECTION(paths).hasItemsUnderProject()
)
class SideBarCopyProjectDirectoriesCommand(sublime_plugin... | 64 | 64 | 103 | 14 | 50 | 52fisher/SideBarEnhancements | SideBar.py | Python | SideBarCopyProjectDirectoriesCommand | SideBarCopyProjectDirectoriesCommand | 1,516 | 1,530 | 1,516 | 1,516 | 7045ba158093c7d1446be4897bf12ddd0e04a62e | bigcode/the-stack | train |
c37844ba3d3e4f2e81d3be22 | train | class | class SideBarCopyTagStyleCommand(sublime_plugin.WindowCommand):
def run(self, paths=[]):
items = []
for item in SideBarSelection(paths).getSelectedFilesWithExtension("css"):
items.append(
'<link rel="stylesheet" type="text/css" href="'
+ item.pathAbsoluteF... | class SideBarCopyTagStyleCommand(sublime_plugin.WindowCommand):
| def run(self, paths=[]):
items = []
for item in SideBarSelection(paths).getSelectedFilesWithExtension("css"):
items.append(
'<link rel="stylesheet" type="text/css" href="'
+ item.pathAbsoluteFromProjectEncoded()
+ '"/>'
)
... |
else:
return
return None, width, height
def is_enabled(self, paths=[]):
return (
CACHED_SELECTION(paths).hasImages()
and CACHED_SELECTION(paths).hasItemsUnderProject()
)
class SideBarCopyTagStyleCommand(sublime_plugin.WindowCommand):
| 64 | 64 | 165 | 14 | 50 | 52fisher/SideBarEnhancements | SideBar.py | Python | SideBarCopyTagStyleCommand | SideBarCopyTagStyleCommand | 1,468 | 1,489 | 1,468 | 1,468 | 7dfd94cad14bac5838fe6db55f46be60b9a78ed5 | bigcode/the-stack | train |
ea8c295b0eac4dcdd6bac58a | train | class | class SideBarOpenWithFinderCommand(sublime_plugin.WindowCommand):
def run(self, paths=[]):
import subprocess
for item in SideBarSelection(paths).getSelectedDirectoriesOrDirnames():
subprocess.Popen(["open", item.name()], cwd=item.dirname())
def is_visible(self, paths=[]):
r... | class SideBarOpenWithFinderCommand(sublime_plugin.WindowCommand):
| def run(self, paths=[]):
import subprocess
for item in SideBarSelection(paths).getSelectedDirectoriesOrDirnames():
subprocess.Popen(["open", item.name()], cwd=item.dirname())
def is_visible(self, paths=[]):
return sublime.platform() == "osx"
| .append(item.forCwdSystemPath())
items.append(item.path())
subprocess.Popen(items, cwd=items[2])
def is_visible(self, paths=[]):
return not s.get("disabled_menuitem_open_in_new_window", False)
class SideBarOpenWithFinderCommand(sublime_plugin.WindowCommand):
| 64 | 64 | 74 | 14 | 50 | 52fisher/SideBarEnhancements | SideBar.py | Python | SideBarOpenWithFinderCommand | SideBarOpenWithFinderCommand | 2,650 | 2,658 | 2,650 | 2,650 | c14dd167f985e25d81e75c015a6663534cc966c2 | bigcode/the-stack | train |
6bbcd7c33f0b263d6b7ccc18 | train | class | class SideBarCopyContentBase64Command(sublime_plugin.WindowCommand):
def run(self, paths=[]):
items = []
for item in SideBarSelection(paths).getSelectedFiles():
items.append(item.contentBase64())
if len(items) > 0:
sublime.set_clipboard("\n".join(items))
... | class SideBarCopyContentBase64Command(sublime_plugin.WindowCommand):
| def run(self, paths=[]):
items = []
for item in SideBarSelection(paths).getSelectedFiles():
items.append(item.contentBase64())
if len(items) > 0:
sublime.set_clipboard("\n".join(items))
if len(items) > 1:
sublime.status_message("Items cont... | if len(items) > 1:
sublime.status_message("Items content copied")
else:
sublime.status_message("Item content copied")
def is_enabled(self, paths=[]):
return CACHED_SELECTION(paths).hasFiles()
class SideBarCopyContentBase64Command(sublime_plugin.Window... | 64 | 64 | 117 | 15 | 49 | 52fisher/SideBarEnhancements | SideBar.py | Python | SideBarCopyContentBase64Command | SideBarCopyContentBase64Command | 1,550 | 1,564 | 1,550 | 1,550 | f8e93ed6ecc0f39e21b01b3de3419fe43ae6dfcf | bigcode/the-stack | train |
615143e15f49ceed9289ce63 | train | class | class Cache:
pass
| class Cache:
| pass
| ", v).replace("%" + k.lower() + "%", v)
return path
def window_set_status(key, name=""):
for window in sublime.windows():
for view in window.views():
view.set_status("SideBar-" + key, name)
class Object:
pass
class Cache:
| 64 | 64 | 6 | 3 | 60 | 52fisher/SideBarEnhancements | SideBar.py | Python | Cache | Cache | 92 | 93 | 92 | 92 | 3a3484511539b55cf95c4bac39df38f4de81def4 | bigcode/the-stack | train |
112a923a1dbdce02d183e027 | train | class | class SideBarCopyPathRelativeFromViewEncodedCommand(sublime_plugin.WindowCommand):
def run(self, paths=[]):
items = []
for item in SideBarSelection(paths).getSelectedItems():
path = item.pathRelativeFromViewEncoded()
if path:
items.append(path)
if len... | class SideBarCopyPathRelativeFromViewEncodedCommand(sublime_plugin.WindowCommand):
| def run(self, paths=[]):
items = []
for item in SideBarSelection(paths).getSelectedItems():
path = item.pathRelativeFromViewEncoded()
if path:
items.append(path)
if len(items) > 0:
sublime.set_clipboard("\n".join(items))
if len... | (items) > 1:
sublime.status_message("Items copied")
else:
sublime.status_message("Item copied")
def is_enabled(self, paths=[]):
return CACHED_SELECTION(paths).len() > 0
class SideBarCopyPathRelativeFromViewEncodedCommand(sublime_plugin.WindowCommand):
| 64 | 64 | 131 | 17 | 46 | 52fisher/SideBarEnhancements | SideBar.py | Python | SideBarCopyPathRelativeFromViewEncodedCommand | SideBarCopyPathRelativeFromViewEncodedCommand | 1,224 | 1,240 | 1,224 | 1,224 | 6ddff23b6c6b9af5d921e1fad89e8cfac89332f6 | bigcode/the-stack | train |
1ae3f99c2d0e0a303cee6f1d | train | class | class SideBarCopyTagImgCommand(sublime_plugin.WindowCommand):
def run(self, paths=[]):
items = []
for item in SideBarSelection(paths).getSelectedImages():
try:
image_type, width, height = self.getImageInfo(item.path())
items.append(
'<i... | class SideBarCopyTagImgCommand(sublime_plugin.WindowCommand):
| def run(self, paths=[]):
items = []
for item in SideBarSelection(paths).getSelectedImages():
try:
image_type, width, height = self.getImageInfo(item.path())
items.append(
'<img src="'
+ item.pathAbsoluteFromProjectEn... | ", True)
class SideBarCopyTagAhrefCommand(sublime_plugin.WindowCommand):
def run(self, paths=[]):
items = []
for item in SideBarSelection(paths).getSelectedItems():
items.append(
'<a href="'
+ item.pathAbsoluteFromProjectEncoded()
+ '">'
... | 179 | 179 | 598 | 14 | 165 | 52fisher/SideBarEnhancements | SideBar.py | Python | SideBarCopyTagImgCommand | SideBarCopyTagImgCommand | 1,395 | 1,465 | 1,395 | 1,395 | 83568d7ac9ef1db218a3d3cceeb9932e4508c2d7 | bigcode/the-stack | train |
1b181ad817ad9f2e0d38da9a | train | class | class SideBarEmptyThread(threading.Thread):
def __init__(self, paths, key):
self.paths = paths
self.key = key
threading.Thread.__init__(self)
def run(self):
paths = self.paths
key = self.key
window_set_status(key, "Emptying…")
try:
from .send2... | class SideBarEmptyThread(threading.Thread):
| def __init__(self, paths, key):
self.paths = paths
self.key = key
threading.Thread.__init__(self)
def run(self):
paths = self.paths
key = self.key
window_set_status(key, "Emptying…")
try:
from .send2trash import send2trash
for ite... | 0:
self.run(paths, "True")
def is_enabled(self, paths=[]):
return CACHED_SELECTION(paths).len() > 0
def is_visible(self, paths=[]):
return not s.get("disabled_menuitem_empty", True)
class SideBarEmptyThread(threading.Thread):
| 64 | 64 | 178 | 9 | 55 | 52fisher/SideBarEnhancements | SideBar.py | Python | SideBarEmptyThread | SideBarEmptyThread | 2,132 | 2,155 | 2,132 | 2,132 | a571b456e2018c50994c8a0d6247cc3418ab3076 | bigcode/the-stack | train |
813e651e73b179c63c4c328f | train | class | class SideBarEditCommand(sublime_plugin.WindowCommand):
def run(self, paths=[]):
for item in SideBarSelection(paths).getSelectedFiles():
item.edit()
def is_enabled(self, paths=[]):
return CACHED_SELECTION(paths).hasFiles()
def is_visible(self, paths=[]):
return not s.ge... | class SideBarEditCommand(sublime_plugin.WindowCommand):
| def run(self, paths=[]):
for item in SideBarSelection(paths).getSelectedFiles():
item.edit()
def is_enabled(self, paths=[]):
return CACHED_SELECTION(paths).hasFiles()
def is_visible(self, paths=[]):
return not s.get("disabled_menuitem_edit", False)
| ):
views = self.others_views(paths)
return CACHED_SELECTION(paths).hasDirectories() and len(views) > 0
def is_visible(self, paths=[]):
return not s.get("disabled_menuitem_folder_close", False)
class SideBarEditCommand(sublime_plugin.WindowCommand):
| 64 | 64 | 78 | 12 | 52 | 52fisher/SideBarEnhancements | SideBar.py | Python | SideBarEditCommand | SideBarEditCommand | 313 | 322 | 313 | 313 | bfd574b2d5b320a28e7428042217373e2398f4ea | bigcode/the-stack | train |
7a332243b96dba05e62fc199 | train | class | class SideBarFindFilesPathContainingSearchThread(threading.Thread):
def __init__(self, view, searchTerm):
self.view = view
self.searchTerm = searchTerm
threading.Thread.__init__(self)
def run(self):
if Object.sidebar_instant_search_id == self.searchTerm:
return
... | class SideBarFindFilesPathContainingSearchThread(threading.Thread):
| def __init__(self, view, searchTerm):
self.view = view
self.searchTerm = searchTerm
threading.Thread.__init__(self)
def run(self):
if Object.sidebar_instant_search_id == self.searchTerm:
return
searchTerm = self.searchTerm
Object.sidebar_instant_searc... | view.set_syntax_file(
"Packages/SideBarEnhancements/SideBar Results.hidden-tmLanguage"
)
view.set_scratch(True)
view.run_command("insert", {"characters": "Type to search: "})
view.sel().clear()
view.sel().add(sublime.Region(16, 16))
view.settings().set... | 256 | 256 | 936 | 13 | 243 | 52fisher/SideBarEnhancements | SideBar.py | Python | SideBarFindFilesPathContainingSearchThread | SideBarFindFilesPathContainingSearchThread | 716 | 845 | 716 | 716 | 52d68a7eb11cdda3047a3091ad2c4a3686918e72 | bigcode/the-stack | train |
51c6fe198496d9721b7d1e90 | train | function | def window_set_status(key, name=""):
for window in sublime.windows():
for view in window.views():
view.set_status("SideBar-" + key, name)
| def window_set_status(key, name=""):
| for window in sublime.windows():
for view in window.views():
view.set_status("SideBar-" + key, name)
| return window if window else sublime.active_window()
def expandVars(path):
for k, v in list(os.environ.items()):
path = path.replace("%" + k + "%", v).replace("%" + k.lower() + "%", v)
return path
def window_set_status(key, name=""):
| 64 | 64 | 36 | 9 | 54 | 52fisher/SideBarEnhancements | SideBar.py | Python | window_set_status | window_set_status | 82 | 85 | 82 | 82 | 7c1716a87410c31206884e07f444029c32ebaa73 | bigcode/the-stack | train |
08942c33678db637023c0e68 | train | class | class SideBarFindInProjectFolderCommand(sublime_plugin.WindowCommand):
def run(self, paths=[]):
items = []
for item in SideBarSelection(paths).getSelectedItemsWithoutChildItems():
items.append(SideBarProject().getDirectoryFromPath(item.path()))
items = list(set(items))
if... | class SideBarFindInProjectFolderCommand(sublime_plugin.WindowCommand):
| def run(self, paths=[]):
items = []
for item in SideBarSelection(paths).getSelectedItemsWithoutChildItems():
items.append(SideBarProject().getDirectoryFromPath(item.path()))
items = list(set(items))
if items:
Window().run_command("hide_panel")
Wind... | run_command(
"show_panel", {"panel": "find_in_files", "where": "<project>"}
)
def is_visible(self, paths=[]):
return not s.get("disabled_menuitem_find_in_project", False)
class SideBarFindInProjectFolderCommand(sublime_plugin.WindowCommand):
| 64 | 64 | 107 | 15 | 49 | 52fisher/SideBarEnhancements | SideBar.py | Python | SideBarFindInProjectFolderCommand | SideBarFindInProjectFolderCommand | 630 | 640 | 630 | 630 | 89264e142ccd9d62058f8b59381e930ee8818439 | bigcode/the-stack | train |
7a62edf9a0de3c148a32fd33 | train | class | class SideBarRenameCommand(sublime_plugin.WindowCommand):
def run(self, paths=[], newLeaf=False):
import functools
branch, leaf = os.path.split(
SideBarSelection(paths).getSelectedItems()[0].path()
)
Window().run_command("hide_panel")
view = Window().show_input_p... | class SideBarRenameCommand(sublime_plugin.WindowCommand):
| def run(self, paths=[], newLeaf=False):
import functools
branch, leaf = os.path.split(
SideBarSelection(paths).getSelectedItems()[0].path()
)
Window().run_command("hide_panel")
view = Window().show_input_panel(
"New Name:",
newLeaf or leaf... | n\nto\n\n" + new)
SideBarDuplicateCommand(Window()).run([old], new)
return
item = SideBarItem(new, os.path.isdir(new))
if item.isFile():
item.edit()
SideBarProject().refresh()
window_set_status(key, "")
class SideBarRenameCommand(sublime_plugin.WindowC... | 75 | 76 | 256 | 12 | 63 | 52fisher/SideBarEnhancements | SideBar.py | Python | SideBarRenameCommand | SideBarRenameCommand | 1,678 | 1,714 | 1,678 | 1,678 | d2d89bd6f6d256b298abb1ae189a4ae03628b057 | bigcode/the-stack | train |
a4c4c2346e9fbedbdf630e24 | train | class | class SideBarFilesOpenWithCommand(sublime_plugin.WindowCommand):
def run(self, paths=[], application="", extensions=""):
self.run(self, paths, application, extensions, args=[])
def run(self, paths=[], application="", extensions="", args=[]):
application_dir, application_name = os.path.split(app... | class SideBarFilesOpenWithCommand(sublime_plugin.WindowCommand):
| def run(self, paths=[], application="", extensions=""):
self.run(self, paths, application, extensions, args=[])
def run(self, paths=[], application="", extensions="", args=[]):
application_dir, application_name = os.path.split(application)
if extensions == "*":
extensions =... | amonkey",
"command": "side_bar_files_open_with",
"args": {
"paths": [],
"application": "C:\\\\Archivos de programa\\\\SeaMonkey\\\\seamonkey.exe", // WINNT
"extensions":"", //open... | 213 | 213 | 710 | 14 | 198 | 52fisher/SideBarEnhancements | SideBar.py | Python | SideBarFilesOpenWithCommand | SideBarFilesOpenWithCommand | 458 | 543 | 458 | 458 | 20b52cb000fd99e56197f4f6030232fd467bcaa4 | bigcode/the-stack | train |
6777785dacdef0dd298072e2 | train | class | class SideBarOpenBrowsersCommand(sublime_plugin.WindowCommand):
def run(self, paths=[]):
browsers = s.get("open_all_browsers", [])
if browsers:
window = Window()
for browser in browsers:
window.run_command(
"side_bar_open_in_browser",
... | class SideBarOpenBrowsersCommand(sublime_plugin.WindowCommand):
| def run(self, paths=[]):
browsers = s.get("open_all_browsers", [])
if browsers:
window = Window()
for browser in browsers:
window.run_command(
"side_bar_open_in_browser",
{"paths": paths, "type": "testing", "browser": br... | item in object.getSelectedFiles():
items.append(item.name())
elif type == "directory":
for item in object.getSelectedDirectories():
items.append(item.name() + "/**")
items = list(set(items))
return items
class SideBarOpenBrowsersCommand(sublime_plugin... | 64 | 64 | 82 | 14 | 49 | 52fisher/SideBarEnhancements | SideBar.py | Python | SideBarOpenBrowsersCommand | SideBarOpenBrowsersCommand | 2,303 | 2,312 | 2,303 | 2,303 | 5790285a2833fedf305230d434135431378402a4 | bigcode/the-stack | train |
c9e97f31992b9206d05711c2 | train | function | def CACHED_SELECTION(paths=[]):
if Cache.cached:
return Cache.cached
else:
return SideBarSelection(paths)
| def CACHED_SELECTION(paths=[]):
| if Cache.cached:
return Cache.cached
else:
return SideBarSelection(paths)
| " or os.name == "nt",
)
stdout, stderr = p.communicate()
try:
p.kill()
except:
pass
p = {"stderr": stderr, "stdout": stdout, "returncode": p.returncode}
return p
def CACHED_SELECTION(paths=[]):
| 64 | 64 | 27 | 7 | 56 | 52fisher/SideBarEnhancements | SideBar.py | Python | CACHED_SELECTION | CACHED_SELECTION | 47 | 51 | 47 | 47 | 3908d0b2e4856983242d6db2645fcba68b09702a | bigcode/the-stack | train |
74a8fcc17493853a3a078a89 | train | function | def escapeCMDWindows(string):
return string.replace("^", "^^")
| def escapeCMDWindows(string):
| return string.replace("^", "^^")
| except:
pass
p = {"stderr": stderr, "stdout": stdout, "returncode": p.returncode}
return p
def CACHED_SELECTION(paths=[]):
if Cache.cached:
return Cache.cached
else:
return SideBarSelection(paths)
def escapeCMDWindows(string):
| 64 | 64 | 15 | 6 | 58 | 52fisher/SideBarEnhancements | SideBar.py | Python | escapeCMDWindows | escapeCMDWindows | 54 | 55 | 54 | 54 | 2f200479d0faefa8623f52b10120f8679ff57493 | bigcode/the-stack | train |
8f7ecd0e3160386ecf038fa6 | train | class | class SideBarOpenInBrowserCommand(sublime_plugin.WindowCommand):
def run(self, paths=[], type=False, browser=""):
if not browser:
browser = s.get("default_browser", "")
if type == False or type == "testing":
type = "url_testing"
elif type == "production":
... | class SideBarOpenInBrowserCommand(sublime_plugin.WindowCommand):
| def run(self, paths=[], type=False, browser=""):
if not browser:
browser = s.get("default_browser", "")
if type == False or type == "testing":
type = "url_testing"
elif type == "production":
type = "url_production"
else:
type = "url_t... | ers", [])
if browsers:
window = Window()
for browser in browsers:
window.run_command(
"side_bar_open_in_browser",
{"paths": paths, "type": "testing", "browser": browser},
)
class SideBarOpenInBrowserCommand(sublime_p... | 64 | 64 | 148 | 14 | 50 | 52fisher/SideBarEnhancements | SideBar.py | Python | SideBarOpenInBrowserCommand | SideBarOpenInBrowserCommand | 2,315 | 2,334 | 2,315 | 2,315 | afd5e44018fa866f0df1587f6439f38dc60facad | bigcode/the-stack | train |
0c8ef16fd8ec1f74601ad4c5 | train | function | def plugin_loaded():
global Pref, s
s = sublime.load_settings("Side Bar.sublime-settings")
Pref = Pref()
Pref.load()
s.clear_on_change("reload")
s.add_on_change("reload", lambda: Pref.load())
| def plugin_loaded():
| global Pref, s
s = sublime.load_settings("Side Bar.sublime-settings")
Pref = Pref()
Pref.load()
s.clear_on_change("reload")
s.add_on_change("reload", lambda: Pref.load())
| .returncode}
return p
def CACHED_SELECTION(paths=[]):
if Cache.cached:
return Cache.cached
else:
return SideBarSelection(paths)
def escapeCMDWindows(string):
return string.replace("^", "^^")
class Pref:
def load(self):
pass
def plugin_loaded():
| 64 | 64 | 54 | 4 | 59 | 52fisher/SideBarEnhancements | SideBar.py | Python | plugin_loaded | plugin_loaded | 63 | 69 | 63 | 63 | 2b0c4679f461299046821890d81c41e00c22bec4 | bigcode/the-stack | train |
cc444361027b1a39f7b35fa9 | train | class | class SideBarFindFilesPathContainingViewListener(sublime_plugin.EventListener):
def on_modified(self, view):
view.settings().has(
"sidebar_instant_search_paths"
) # for some reason the first call in some conditions returns true, but not the next one WTH
if view.settings().has("s... | class SideBarFindFilesPathContainingViewListener(sublime_plugin.EventListener):
| def on_modified(self, view):
view.settings().has(
"sidebar_instant_search_paths"
) # for some reason the first call in some conditions returns true, but not the next one WTH
if view.settings().has("sidebar_instant_search_paths"):
searchTerm = (
view.s... | view.sel().clear()
view.sel().add(sublime.Region(16, 16))
view.settings().set("sidebar_instant_search_paths", paths)
def is_enabled(self, paths=[]):
return True
class SideBarFindFilesPathContainingViewListener(sublime_plugin.EventListener):
| 64 | 64 | 145 | 16 | 47 | 52fisher/SideBarEnhancements | SideBar.py | Python | SideBarFindFilesPathContainingViewListener | SideBarFindFilesPathContainingViewListener | 701 | 713 | 701 | 701 | ec55e5c746bbc2d28eafdd955262103a4f71a6cf | bigcode/the-stack | train |
212e58ed3cb05fc2740f8815 | train | class | class SideBarProjectItemExcludeCommand(sublime_plugin.WindowCommand):
def run(self, paths=[]):
project = SideBarProject()
for item in SideBarSelection(paths).getSelectedItems():
if item.isDirectory():
project.excludeDirectory(item.path(), item.pathRelativeFromProject())
... | class SideBarProjectItemExcludeCommand(sublime_plugin.WindowCommand):
| def run(self, paths=[]):
project = SideBarProject()
for item in SideBarSelection(paths).getSelectedItems():
if item.isDirectory():
project.excludeDirectory(item.path(), item.pathRelativeFromProject())
else:
project.excludeFile(item.path(), item... | CACHED_SELECTION(paths)
project = SideBarProject()
return project.hasDirectories() and all(
[
item.path() in project.getDirectories() or not item.exists()
for item in selection.getSelectedItems()
]
)
class SideBarProjectItemExcludeCommand(... | 64 | 64 | 117 | 14 | 50 | 52fisher/SideBarEnhancements | SideBar.py | Python | SideBarProjectItemExcludeCommand | SideBarProjectItemExcludeCommand | 2,220 | 2,233 | 2,220 | 2,220 | 2820266db0d867e9fd0fc84a74dd236db121dc4c | bigcode/the-stack | train |
7e9c11dd1c1ba465bca63c7f | train | class | class SideBarFindInSelectedCommand(sublime_plugin.WindowCommand):
def run(self, paths=[]):
if s.get("find_and_replace_discards_previous_search", False):
window = Window()
views = []
for view in window.views():
if view.name() == "Find Results":
... | class SideBarFindInSelectedCommand(sublime_plugin.WindowCommand):
| def run(self, paths=[]):
if s.get("find_and_replace_discards_previous_search", False):
window = Window()
views = []
for view in window.views():
if view.name() == "Find Results":
views.append(view)
for view in views:
... | =[])
def is_visible(self, paths=[], application="", extensions="", args=[]):
if extensions == "*":
extensions = ".*"
if extensions == "":
return CACHED_SELECTION(paths).len() > 0
else:
has = CACHED_SELECTION(paths).hasFilesWithExtension(extensions)
... | 114 | 114 | 381 | 14 | 100 | 52fisher/SideBarEnhancements | SideBar.py | Python | SideBarFindInSelectedCommand | SideBarFindInSelectedCommand | 546 | 593 | 546 | 546 | e1ba60b6a88f11ba588b775c3bea251f82c64b63 | bigcode/the-stack | train |
78b7245079ba4679dcb5223d | train | class | class SideBarFindInFilesWithExtensionCommand(sublime_plugin.WindowCommand):
def run(self, paths=[]):
items = []
for item in SideBarSelection(paths).getSelectedItems():
items.append("*" + item.extension())
items = list(set(items))
Window().run_command("hide_panel")
... | class SideBarFindInFilesWithExtensionCommand(sublime_plugin.WindowCommand):
| def run(self, paths=[]):
items = []
for item in SideBarSelection(paths).getSelectedItems():
items.append("*" + item.extension())
items = list(set(items))
Window().run_command("hide_panel")
Window().run_command(
"show_panel", {"panel": "find_in_files", ... | Path(item.path()))
items = list(set(items))
if items:
Window().run_command("hide_panel")
Window().run_command(
"show_panel", {"panel": "find_in_files", "where": ",".join(items)}
)
class SideBarFindInFilesWithExtensionCommand(sublime_plugin.WindowComman... | 69 | 69 | 231 | 16 | 53 | 52fisher/SideBarEnhancements | SideBar.py | Python | SideBarFindInFilesWithExtensionCommand | SideBarFindInFilesWithExtensionCommand | 643 | 667 | 643 | 643 | 10ded2c331db4860aa72e76c86493dd978528af5 | bigcode/the-stack | train |
727f6bf94353106b67ca2637 | train | class | class SideBarCopyPathAbsoluteFromProjectEncodedWindowsCommand(
sublime_plugin.WindowCommand
):
def run(self, paths=[]):
items = []
for item in SideBarSelection(paths).getSelectedItems():
items.append(item.pathAbsoluteFromProjectEncoded())
if len(items) > 0:
subli... | class SideBarCopyPathAbsoluteFromProjectEncodedWindowsCommand(
sublime_plugin.WindowCommand
):
| def run(self, paths=[]):
items = []
for item in SideBarSelection(paths).getSelectedItems():
items.append(item.pathAbsoluteFromProjectEncoded())
if len(items) > 0:
sublime.set_clipboard(("\n".join(items)).replace("/", "\\"))
if len(items) > 1:
... | (paths).len() > 0
and CACHED_SELECTION(paths).hasItemsUnderProject()
)
def is_visible(self, paths=[]):
return not s.get("disabled_menuitem_copy_path", False)
class SideBarCopyPathAbsoluteFromProjectEncodedWindowsCommand(
sublime_plugin.WindowCommand
):
| 64 | 64 | 169 | 19 | 45 | 52fisher/SideBarEnhancements | SideBar.py | Python | SideBarCopyPathAbsoluteFromProjectEncodedWindowsCommand | SideBarCopyPathAbsoluteFromProjectEncodedWindowsCommand | 1,344 | 1,366 | 1,344 | 1,346 | 26ea77196dcd5eedba779950ae2450f385aecfa2 | bigcode/the-stack | train |
3892de69d2280113e9aa9f53 | train | class | class SideBarCopyPathRelativeFromProjectEncodedCommand(sublime_plugin.WindowCommand):
def run(self, paths=[]):
items = []
for item in SideBarSelection(paths).getSelectedItems():
items.append(item.pathRelativeFromProjectEncoded())
if len(items) > 0:
sublime.set_clipbo... | class SideBarCopyPathRelativeFromProjectEncodedCommand(sublime_plugin.WindowCommand):
| def run(self, paths=[]):
items = []
for item in SideBarSelection(paths).getSelectedItems():
items.append(item.pathRelativeFromProjectEncoded())
if len(items) > 0:
sublime.set_clipboard("\n".join(items))
if len(items) > 1:
sublime.status_me... | :
sublime.status_message("Item copied")
def is_enabled(self, paths=[]):
return (
CACHED_SELECTION(paths).len() > 0
and CACHED_SELECTION(paths).hasItemsUnderProject()
)
class SideBarCopyPathRelativeFromProjectEncodedCommand(sublime_plugin.WindowCommand):
| 64 | 64 | 138 | 17 | 47 | 52fisher/SideBarEnhancements | SideBar.py | Python | SideBarCopyPathRelativeFromProjectEncodedCommand | SideBarCopyPathRelativeFromProjectEncodedCommand | 1,187 | 1,204 | 1,187 | 1,187 | 654b62e6763b4ca3ee94fb52b8a7337fdc22c031 | bigcode/the-stack | train |
6853e739d0ef0da05894a8e8 | train | class | class SideBarRenameThread(threading.Thread):
def __init__(self, old, branch, leaf, key):
self.old = old
self.branch = branch
self.leaf = leaf
self.key = key
threading.Thread.__init__(self)
def run(self):
old = self.old
branch = self.branch
leaf = ... | class SideBarRenameThread(threading.Thread):
| def __init__(self, old, branch, leaf, key):
self.old = old
self.branch = branch
self.leaf = leaf
self.key = key
threading.Thread.__init__(self)
def run(self):
old = self.old
branch = self.branch
leaf = self.leaf
key = self.key
wind... | ):
key = "rename-" + str(time.time())
SideBarRenameThread(old, branch, leaf, key).start()
def is_enabled(self, paths=[]):
return (
CACHED_SELECTION(paths).len() == 1
and CACHED_SELECTION(paths).hasProjectDirectories() is False
)
class SideBarRenameThread(thre... | 76 | 76 | 256 | 9 | 67 | 52fisher/SideBarEnhancements | SideBar.py | Python | SideBarRenameThread | SideBarRenameThread | 1,717 | 1,750 | 1,717 | 1,717 | 85b40bf2f99ee1c60af84102032606f929a47f81 | bigcode/the-stack | train |
83c03553d4f263a3fbdfe3a7 | train | class | class SideBarNewDirectory2Command(sublime_plugin.WindowCommand):
def run(self, paths=[], name=""):
import functools
Window().run_command("hide_panel")
Window().show_input_panel(
"Folder Name:",
name,
functools.partial(
SideBarNewDirectoryC... | class SideBarNewDirectory2Command(sublime_plugin.WindowCommand):
| def run(self, paths=[], name=""):
import functools
Window().run_command("hide_panel")
Window().show_input_panel(
"Folder Name:",
name,
functools.partial(
SideBarNewDirectoryCommand(Window()).on_done, paths, True
),
... | Window().run_command("hide_panel")
Window().show_input_panel(
"File Name:",
name,
functools.partial(SideBarNewFileCommand(Window()).on_done, paths, True),
None,
None,
)
class SideBarNewDirectory2Command(sublime_plugin.WindowCommand):
| 64 | 64 | 81 | 14 | 50 | 52fisher/SideBarEnhancements | SideBar.py | Python | SideBarNewDirectory2Command | SideBarNewDirectory2Command | 174 | 187 | 174 | 174 | eddd222d640b38b290f76a2eb2fc6ae767b7b62b | bigcode/the-stack | train |
3950bdd349ea2e02ebf21a26 | train | class | class SideBarPasteThread(threading.Thread):
def __init__(
self, paths=[], in_parent="False", test="True", replace="False", key=""
):
self.paths = paths
self.in_parent = in_parent
self.test = test
self.replace = replace
self.key = key
threading.Thread.__ini... | class SideBarPasteThread(threading.Thread):
| def __init__(
self, paths=[], in_parent="False", test="True", replace="False", key=""
):
self.paths = paths
self.in_parent = in_parent
self.test = test
self.replace = replace
self.key = key
threading.Thread.__init__(self)
def run(self):
SideBa... | SelectedDirectoriesOrDirnames()
) == 1
def is_visible(self, paths=[], in_parent=False):
if in_parent == "True":
return not s.get("disabled_menuitem_paste_in_parent", False)
else:
return True
class SideBarPasteThread(threading.Thread):
| 64 | 64 | 110 | 9 | 54 | 52fisher/SideBarEnhancements | SideBar.py | Python | SideBarPasteThread | SideBarPasteThread | 917 | 931 | 917 | 917 | c33786d7a76764a870e62793c04aec2841876399 | bigcode/the-stack | train |
e8f40e3c9587fb74ca3b4d3d | train | class | class SideBarSaveAsAdminCommand(sublime_plugin.WindowCommand):
def run(self):
import tempfile
view = sublime.active_window().active_view()
path = os.path.dirname(__file__) + "/"
with (tempfile.NamedTemporaryFile(delete=False)) as f:
f.write(bytes(view.substr(sublime.Regi... | class SideBarSaveAsAdminCommand(sublime_plugin.WindowCommand):
| def run(self):
import tempfile
view = sublime.active_window().active_view()
path = os.path.dirname(__file__) + "/"
with (tempfile.NamedTemporaryFile(delete=False)) as f:
f.write(bytes(view.substr(sublime.Region(0, view.size())), "UTF-8"))
cli(
... | _file_size", False):
try:
self.show(v, hurry_size(os.path.getsize(v.file_name())))
except:
pass
def show(self, v, size):
v.set_status("statusbar_file_size", size)
class SideBarSaveAsAdminCommand(sublime_plugin.WindowCommand):
| 64 | 64 | 166 | 14 | 50 | 52fisher/SideBarEnhancements | SideBar.py | Python | SideBarSaveAsAdminCommand | SideBarSaveAsAdminCommand | 2,680 | 2,700 | 2,680 | 2,680 | 30ecbb99ba7eae3769e54a5a6ec28d67857fd358 | bigcode/the-stack | train |
921834ded2c1bfbf0a18c2d4 | train | class | class SideBarCopyPathQuotedCommand(sublime_plugin.WindowCommand):
def run(self, paths=[]):
items = []
for item in SideBarSelection(paths).getSelectedItems():
items.append('"' + item.path() + '"')
if len(items) > 0:
sublime.set_clipboard("\n".join(items))
... | class SideBarCopyPathQuotedCommand(sublime_plugin.WindowCommand):
| def run(self, paths=[]):
items = []
for item in SideBarSelection(paths).getSelectedItems():
items.append('"' + item.path() + '"')
if len(items) > 0:
sublime.set_clipboard("\n".join(items))
if len(items) > 1:
sublime.status_message("Items c... | if len(items) > 1:
sublime.status_message("Items copied")
else:
sublime.status_message("Item copied")
def is_enabled(self, paths=[]):
return CACHED_SELECTION(paths).len() > 0
class SideBarCopyPathQuotedCommand(sublime_plugin.WindowCommand):
| 64 | 64 | 121 | 14 | 49 | 52fisher/SideBarEnhancements | SideBar.py | Python | SideBarCopyPathQuotedCommand | SideBarCopyPathQuotedCommand | 1,113 | 1,127 | 1,113 | 1,113 | 94d8c9065af9355a0e67e128e18cc75677dd7899 | bigcode/the-stack | train |
201364d6b3759c296ffb882f | train | class | class SideBarDuplicateThread(threading.Thread):
def __init__(self, old, new, key):
self.old = old
self.new = new
self.key = key
threading.Thread.__init__(self)
def run(self):
old = self.old
new = self.new
key = self.key
window_set_status(key, "Dup... | class SideBarDuplicateThread(threading.Thread):
| def __init__(self, old, new, key):
self.old = old
self.new = new
self.key = key
threading.Thread.__init__(self)
def run(self):
old = self.old
new = self.new
key = self.key
window_set_status(key, "Duplicating…")
item = SideBarItem(old, os.... | = "duplicate-" + str(time.time())
SideBarDuplicateThread(old, new, key).start()
def is_enabled(self, paths=[]):
return (
CACHED_SELECTION(paths).len() == 1
and CACHED_SELECTION(paths).hasProjectDirectories() is False
)
class SideBarDuplicateThread(threading.Thread):... | 71 | 71 | 238 | 9 | 62 | 52fisher/SideBarEnhancements | SideBar.py | Python | SideBarDuplicateThread | SideBarDuplicateThread | 1,644 | 1,675 | 1,644 | 1,644 | 91aa6b22f767857e60d4be510b0c4f9ae1664427 | bigcode/the-stack | train |
c7391252e026088c736b0458 | train | class | class SideBarOpenCommand(sublime_plugin.WindowCommand):
def run(self, paths=[]):
for item in SideBarSelection(paths).getSelectedItems():
item.open(s.get("use_powershell", True), s.get("use_command", ""))
def is_enabled(self, paths=[]):
return CACHED_SELECTION(paths).len() > 0
d... | class SideBarOpenCommand(sublime_plugin.WindowCommand):
| def run(self, paths=[]):
for item in SideBarSelection(paths).getSelectedItems():
item.open(s.get("use_powershell", True), s.get("use_command", ""))
def is_enabled(self, paths=[]):
return CACHED_SELECTION(paths).len() > 0
def is_visible(self, paths=[]):
return not s.get(... | =[]):
return CACHED_SELECTION(paths).hasFiles()
def is_visible(self, paths=[]):
return not s.get("disabled_menuitem_edit", False) and not s.get(
"disabled_menuitem_edit_to_right", False
)
class SideBarOpenCommand(sublime_plugin.WindowCommand):
| 64 | 64 | 99 | 12 | 52 | 52fisher/SideBarEnhancements | SideBar.py | Python | SideBarOpenCommand | SideBarOpenCommand | 351 | 360 | 351 | 351 | cf59f9b5a031e543c48e540f944043b50149386b | bigcode/the-stack | train |
f6a409816e3a4a76503a8df1 | train | class | class SideBarEditToRightCommand(sublime_plugin.WindowCommand):
def run(self, paths=[]):
window = Window()
window.run_command(
"set_layout",
{
"cols": [0.0, 0.5, 1.0],
"rows": [0.0, 1.0],
"cells": [[0, 0, 1, 1], [1, 0, 2, 1]],
... | class SideBarEditToRightCommand(sublime_plugin.WindowCommand):
| def run(self, paths=[]):
window = Window()
window.run_command(
"set_layout",
{
"cols": [0.0, 0.5, 1.0],
"rows": [0.0, 1.0],
"cells": [[0, 0, 1, 1], [1, 0, 2, 1]],
},
)
window.focus_group(1)
f... | ).getSelectedFiles():
item.edit()
def is_enabled(self, paths=[]):
return CACHED_SELECTION(paths).hasFiles()
def is_visible(self, paths=[]):
return not s.get("disabled_menuitem_edit", False)
class SideBarEditToRightCommand(sublime_plugin.WindowCommand):
| 64 | 64 | 202 | 14 | 50 | 52fisher/SideBarEnhancements | SideBar.py | Python | SideBarEditToRightCommand | SideBarEditToRightCommand | 325 | 348 | 325 | 325 | a586e0ec5fdcacafa896ea3cbbb2ff88940d5857 | bigcode/the-stack | train |
6aab94054cd3377df68a2f0d | train | class | class SideBarCopyPathEncodedCommand(sublime_plugin.WindowCommand):
def run(self, paths=[]):
items = []
for item in SideBarSelection(paths).getSelectedItems():
items.append(item.uri())
if len(items) > 0:
sublime.set_clipboard("\n".join(items))
if len(items... | class SideBarCopyPathEncodedCommand(sublime_plugin.WindowCommand):
| def run(self, paths=[]):
items = []
for item in SideBarSelection(paths).getSelectedItems():
items.append(item.uri())
if len(items) > 0:
sublime.set_clipboard("\n".join(items))
if len(items) > 1:
sublime.status_message("Items copied")
... | ("Item copied")
def is_enabled(self, paths=[]):
return CACHED_SELECTION(paths).len() > 0
def is_visible(self, paths=[]):
return not s.get("disabled_menuitem_copy_dir_path", False)
class SideBarCopyPathEncodedCommand(sublime_plugin.WindowCommand):
| 64 | 64 | 115 | 14 | 50 | 52fisher/SideBarEnhancements | SideBar.py | Python | SideBarCopyPathEncodedCommand | SideBarCopyPathEncodedCommand | 1,150 | 1,164 | 1,150 | 1,150 | f1ef74dc2bae15cf8f79dea1dc1db1b20a89c92f | bigcode/the-stack | train |
fc67386d2e4a5c5b8b3e5e79 | train | class | class SideBarCopyPathAbsoluteFromProjectEncodedCommand(sublime_plugin.WindowCommand):
def run(self, paths=[]):
items = []
for item in SideBarSelection(paths).getSelectedItems():
items.append(item.pathAbsoluteFromProjectEncoded())
if len(items) > 0:
sublime.set_clipbo... | class SideBarCopyPathAbsoluteFromProjectEncodedCommand(sublime_plugin.WindowCommand):
| def run(self, paths=[]):
items = []
for item in SideBarSelection(paths).getSelectedItems():
items.append(item.pathAbsoluteFromProjectEncoded())
if len(items) > 0:
sublime.set_clipboard("\n".join(items))
if len(items) > 1:
sublime.status_me... | :
sublime.status_message("Item copied")
def is_enabled(self, paths=[]):
return (
CACHED_SELECTION(paths).len() > 0
and CACHED_SELECTION(paths).hasItemsUnderProject()
)
class SideBarCopyPathAbsoluteFromProjectEncodedCommand(sublime_plugin.WindowCommand):
| 64 | 64 | 161 | 17 | 47 | 52fisher/SideBarEnhancements | SideBar.py | Python | SideBarCopyPathAbsoluteFromProjectEncodedCommand | SideBarCopyPathAbsoluteFromProjectEncodedCommand | 1,321 | 1,341 | 1,321 | 1,321 | 3283c267eb324436dd2f9916262f3478a4f62dbe | bigcode/the-stack | train |
af46bf9e34079f4077ce51c9 | train | class | class SideBarFolderSaveViewsCommand(sublime_plugin.WindowCommand):
def run(self, paths=[]):
views = []
for item in SideBarSelection(paths).getSelectedDirectories():
views = views + item.views()
for view in views:
view.run_command("save")
def is_enabled(self, path... | class SideBarFolderSaveViewsCommand(sublime_plugin.WindowCommand):
| def run(self, paths=[]):
views = []
for item in SideBarSelection(paths).getSelectedDirectories():
views = views + item.views()
for view in views:
view.run_command("save")
def is_enabled(self, paths=[]):
_views = []
has_dirty_view = False
f... | to create folder:\n\n" + item.path())
self.run(paths, name)
return
SideBarProject().refresh()
def is_enabled(self, paths=[]):
return CACHED_SELECTION(paths).len() > 0
class SideBarFolderSaveViewsCommand(sublime_plugin.WindowCommand):
| 64 | 64 | 181 | 14 | 49 | 52fisher/SideBarEnhancements | SideBar.py | Python | SideBarFolderSaveViewsCommand | SideBarFolderSaveViewsCommand | 232 | 256 | 232 | 232 | 4bb3aa5d8ecb423796dcc260dedf6cfff6585a75 | bigcode/the-stack | train |
4741bf23941ae9c2b69b02e0 | train | class | class SideBarOpenInBrowserThread(threading.Thread):
def __init__(self, paths, type, browser):
self.paths = paths
self.type = type
self.browser = browser
threading.Thread.__init__(self)
def run(self):
paths = self.paths
type = self.type
browser = self.brow... | class SideBarOpenInBrowserThread(threading.Thread):
| def __init__(self, paths, type, browser):
self.paths = paths
self.type = type
self.browser = browser
threading.Thread.__init__(self)
def run(self):
paths = self.paths
type = self.type
browser = self.browser
for item in SideBarSelection(paths).get... | + "/**")
items = list(set(items))
return items
class SideBarOpenBrowsersCommand(sublime_plugin.WindowCommand):
def run(self, paths=[]):
browsers = s.get("open_all_browsers", [])
if browsers:
window = Window()
for browser in browsers:
window.... | 256 | 256 | 2,603 | 11 | 245 | 52fisher/SideBarEnhancements | SideBar.py | Python | SideBarOpenInBrowserThread | SideBarOpenInBrowserThread | 2,337 | 2,623 | 2,337 | 2,337 | e5b399c5f3bb434ef2aef05321ebdc242d529195 | bigcode/the-stack | train |
6c8fbff40e4a66c43282c996 | train | class | class zzzzzcacheSideBarCommand(sublime_plugin.EventListener):
def on_activated(self, view):
if view and view.file_name():
Cache.cached = SideBarSelection([view.file_name()])
| class zzzzzcacheSideBarCommand(sublime_plugin.EventListener):
| def on_activated(self, view):
if view and view.file_name():
Cache.cached = SideBarSelection([view.file_name()])
| ublime_plugin.WindowCommand):
def run(self, paths=[]):
pass
def is_visible(self, paths=[]): # <- WORKS AS AN ONPOPUPSHOWN
Cache.cached = False
return False
class zzzzzcacheSideBarCommand(sublime_plugin.EventListener):
| 64 | 64 | 44 | 15 | 48 | 52fisher/SideBarEnhancements | SideBar.py | Python | zzzzzcacheSideBarCommand | zzzzzcacheSideBarCommand | 2,783 | 2,786 | 2,783 | 2,783 | fee55b0feef1d76358473fff3e0d63ed5085ef02 | bigcode/the-stack | train |
0f3bc01431a0d935c0e86e2e | train | class | class SideBarEmptyCommand(sublime_plugin.WindowCommand):
def run(self, paths=[], confirmed="False"):
if confirmed == "False" and s.get("confirm_before_deleting", True):
if sublime.platform() == "osx":
if sublime.ok_cancel_dialog("empty the content of the folder?"):
... | class SideBarEmptyCommand(sublime_plugin.WindowCommand):
| def run(self, paths=[], confirmed="False"):
if confirmed == "False" and s.get("confirm_before_deleting", True):
if sublime.platform() == "osx":
if sublime.ok_cancel_dialog("empty the content of the folder?"):
self.run(paths, "True")
else:
... | not os.access(path, os.W_OK):
import stat
os.chmod(path, stat.S_IWUSR)
shutil.rmtree(path)
except:
# raise error in case we were unable to delete.
if os.path.exists(path):
... | 124 | 124 | 416 | 12 | 112 | 52fisher/SideBarEnhancements | SideBar.py | Python | SideBarEmptyCommand | SideBarEmptyCommand | 2,063 | 2,129 | 2,063 | 2,063 | 2cd80f749fe6aaad4949c550f0d4895e89ee18d0 | bigcode/the-stack | train |
f23484d26cd5d1ab29c2e7cf | train | class | class SideBarCopyTagAhrefCommand(sublime_plugin.WindowCommand):
def run(self, paths=[]):
items = []
for item in SideBarSelection(paths).getSelectedItems():
items.append(
'<a href="'
+ item.pathAbsoluteFromProjectEncoded()
+ '">'
... | class SideBarCopyTagAhrefCommand(sublime_plugin.WindowCommand):
| def run(self, paths=[]):
items = []
for item in SideBarSelection(paths).getSelectedItems():
items.append(
'<a href="'
+ item.pathAbsoluteFromProjectEncoded()
+ '">'
+ item.namePretty()
+ "</a>"
)
... | CACHED_SELECTION(paths).len() > 0
and CACHED_SELECTION(paths).hasItemsUnderProject()
)
def is_visible(self, paths=[]):
return not s.get("disabled_menuitem_copy_path_windows", True)
class SideBarCopyTagAhrefCommand(sublime_plugin.WindowCommand):
| 64 | 64 | 162 | 15 | 49 | 52fisher/SideBarEnhancements | SideBar.py | Python | SideBarCopyTagAhrefCommand | SideBarCopyTagAhrefCommand | 1,369 | 1,392 | 1,369 | 1,369 | 48a0fdb1821ffe045031f1843fb77e80ef1e9c4a | bigcode/the-stack | train |
5cd9b8eeefc20929059811ad | train | class | class SideBarDonateCommand(sublime_plugin.WindowCommand):
def run(self, paths=[]):
sublime.message_dialog("Sidebar Enhancements: Thanks for your support ^.^")
browser = s.get("default_browser", "")
SideBarOpenInBrowserThread("", "", "").try_open(
"https://www.paypal.com/cgi-bin/w... | class SideBarDonateCommand(sublime_plugin.WindowCommand):
| def run(self, paths=[]):
sublime.message_dialog("Sidebar Enhancements: Thanks for your support ^.^")
browser = s.get("default_browser", "")
SideBarOpenInBrowserThread("", "", "").try_open(
"https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=DD4SL2AHYJGBW",
... | view.settings().set("default_dir", path)
def on_activated(self, view):
if view and view.file_name():
path = SideBarItem(view.file_name(), False).dirname()
if path:
DefaultDirectory.path = path
class SideBarDonateCommand(sublime_plugin.WindowCommand):
| 64 | 64 | 166 | 12 | 51 | 52fisher/SideBarEnhancements | SideBar.py | Python | SideBarDonateCommand | SideBarDonateCommand | 2,758 | 2,771 | 2,758 | 2,758 | 4ece3ea7f9583d94b4e5e982200fbb180202de81 | bigcode/the-stack | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.