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
86d618a71ec15b612ac01cd0
train
function
def _set_config(config): """Set gl configuration""" pyglet_config = pyglet.gl.Config() pyglet_config.red_size = config['red_size'] pyglet_config.green_size = config['green_size'] pyglet_config.blue_size = config['blue_size'] pyglet_config.alpha_size = config['alpha_size'] pyglet_config.acc...
def _set_config(config):
"""Set gl configuration""" pyglet_config = pyglet.gl.Config() pyglet_config.red_size = config['red_size'] pyglet_config.green_size = config['green_size'] pyglet_config.blue_size = config['blue_size'] pyglet_config.alpha_size = config['alpha_size'] pyglet_config.accum_red_size = 0 pygle...
title=True, size=True, position=True, show=True, vsync=True, resizable=True, decorate=True, fullscreen=True, context=True, multi_window=True, scroll=True, parent=False, ) # ------------------------------------------------------- set_configuration --- def _set_config(config...
63
64
184
6
57
shjoshi/vispy
vispy/app/backends/_pyglet.py
Python
_set_config
_set_config
111
130
111
111
ec10f9072d5facfb1b14afc3d78f49f8cd80cccd
bigcode/the-stack
train
4df852bb340666207b837e47
train
class
class TimerBackend(BaseTimerBackend): def _vispy_start(self, interval): interval = self._vispy_timer._interval if self._vispy_timer.max_iterations == 1: pyglet.clock.schedule_once(self._vispy_timer._timeout, interval) else: # seems pyglet does not give the expected b...
class TimerBackend(BaseTimerBackend):
def _vispy_start(self, interval): interval = self._vispy_timer._interval if self._vispy_timer.max_iterations == 1: pyglet.clock.schedule_once(self._vispy_timer._timeout, interval) else: # seems pyglet does not give the expected behavior when interval==0 if...
mod += keys.SHIFT, if pygletmod & pyglet.window.key.MOD_CTRL: mod += keys.CONTROL, if pygletmod & pyglet.window.key.MOD_ALT: mod += keys.ALT, return mod # ------------------------------------------------------------------- timer --- class...
63
64
149
7
56
shjoshi/vispy
vispy/app/backends/_pyglet.py
Python
TimerBackend
TimerBackend
426
444
426
427
38b3a473eb544263a9c975243b8b43f922cc1af1
bigcode/the-stack
train
51a0b917758b2986374ca9d1
train
class
class Simulation: """ A class describing a simulation to be analysed. """ def __init__(self, x, y, yerr, bounds, path_to_input): self.x = x self.y = y self.yerr = yerr self.bounds = bounds self.path_to_input = path_to_input
class Simulation:
""" A class describing a simulation to be analysed. """ def __init__(self, x, y, yerr, bounds, path_to_input): self.x = x self.y = y self.yerr = yerr self.bounds = bounds self.path_to_input = path_to_input
105 charges. import json import os import numpy as np import matplotlib.pyplot as plt from uravu.distribution import Distribution from uravu import plotting from uravu.relationship import Relationship from uravu.utils import bayes_factor import sys np.random.seed(seed = 4) class Simulation:
64
64
73
3
61
j-m-dean/Overscreening_and_Underscreening
kmc_paper_data/uravu_analysis_scripts/analysis_105_4.py
Python
Simulation
Simulation
15
25
15
16
04181bc51bce0023a42eaff8cd0457a06982db69
bigcode/the-stack
train
e9d9716075c36ae9038bdc17
train
function
def purely_exponential(x, alpha, A, n_infty): """ Description: A purely exponential decay of charged species away from a grain boundary. This distribution is of the form: n(x) = n_infty - A * exp(- alpha * x) Args: x (numpy.array): distance from the grain boundary ...
def purely_exponential(x, alpha, A, n_infty):
""" Description: A purely exponential decay of charged species away from a grain boundary. This distribution is of the form: n(x) = n_infty - A * exp(- alpha * x) Args: x (numpy.array): distance from the grain boundary alpha (float): the recipricol of the dec...
, x, y, yerr, bounds, path_to_input): self.x = x self.y = y self.yerr = yerr self.bounds = bounds self.path_to_input = path_to_input def purely_exponential(x, alpha, A, n_infty):
64
64
163
14
49
j-m-dean/Overscreening_and_Underscreening
kmc_paper_data/uravu_analysis_scripts/analysis_105_4.py
Python
purely_exponential
purely_exponential
27
47
27
27
e30d07d69280afa61b71267863a2720e7aaff897
bigcode/the-stack
train
28b003b2f34fd2474ab59b42
train
function
def oscillatory_exponential(x, alpha, A, n_infty, xi,theta): """ Description: A oscillatory exponential decay of charged species away from a grain boundary. This distribution is of the form: n(x) = n_infty - A * exp(- alpha * x) * cos( xi * x + theta) Args: x (numpy....
def oscillatory_exponential(x, alpha, A, n_infty, xi,theta):
""" Description: A oscillatory exponential decay of charged species away from a grain boundary. This distribution is of the form: n(x) = n_infty - A * exp(- alpha * x) * cos( xi * x + theta) Args: x (numpy.array): distance from the grain boundary alpha (float...
Return: n_x (numpy.array): the charged species distribution moving away from a grain boundary. """ n_x = n_infty - A * np.exp( - alpha * x) return n_x def oscillatory_exponential(x, alpha, A, n_infty, xi,theta):
66
66
220
19
46
j-m-dean/Overscreening_and_Underscreening
kmc_paper_data/uravu_analysis_scripts/analysis_105_4.py
Python
oscillatory_exponential
oscillatory_exponential
50
73
50
50
4fce78e1fa8ae5050fdb5dd77639c6d4d19c96bd
bigcode/the-stack
train
2e7ad70cd75e644ab484f822
train
function
def worker(simulation): """thread worker function""" x = np.array(simulation.x) y = np.array(simulation.y) yerr = np.array(simulation.yerr) bounds = simulation.bounds path_to_input = simulation.path_to_input r = Relationship(oscillatory_exponential, x, y, ordinate_error=yerr, bounds=bounds)...
def worker(simulation):
"""thread worker function""" x = np.array(simulation.x) y = np.array(simulation.y) yerr = np.array(simulation.yerr) bounds = simulation.bounds path_to_input = simulation.path_to_input r = Relationship(oscillatory_exponential, x, y, ordinate_error=yerr, bounds=bounds) r2 = Relationship(p...
away from a grain boundary. """ n_x = n_infty - A * np.exp( - alpha * x) return n_x def oscillatory_exponential(x, alpha, A, n_infty, xi,theta): """ Description: A oscillatory exponential decay of charged species away from a grain boundary. This distribution is of the fo...
256
256
3,790
5
250
j-m-dean/Overscreening_and_Underscreening
kmc_paper_data/uravu_analysis_scripts/analysis_105_4.py
Python
worker
worker
75
349
75
75
eb4c26a89c94545ae757c89c34dae17e9091b698
bigcode/the-stack
train
4daf38186ad4a1cc4213e1a8
train
class
class TestPostInstallationState(ManageTest): """ Post-installation tests for ROSA and OSD clusters """ @tier1 @pytest.mark.polarion_id("OCS-2694") @managed_service_required def test_deployer_logs_not_empty(self): """ Test that the logs of manager container of ocs-osd-control...
class TestPostInstallationState(ManageTest):
""" Post-installation tests for ROSA and OSD clusters """ @tier1 @pytest.mark.polarion_id("OCS-2694") @managed_service_required def test_deployer_logs_not_empty(self): """ Test that the logs of manager container of ocs-osd-controller-manager pod are not empty """ ...
import logging import pytest from ocs_ci.ocs import constants from ocs_ci.ocs.resources import pod from ocs_ci.framework.testlib import ( managed_service_required, ManageTest, tier1, ) from ocs_ci.ocs.exceptions import CommandFailed log = logging.getLogger(__name__) class TestPostInstallationState(ManageT...
76
93
311
9
67
annagitel/ocs-ci
tests/managed-service/test_post_installation_state.py
Python
TestPostInstallationState
TestPostInstallationState
16
51
16
16
ab4bea00a832802e863e52603b0e54f072cf0112
bigcode/the-stack
train
28741fd6b09a75f6223e005b
train
class
class TestsDistributer(object): def __init__(self, num_tests): self._unstarted_tests_indices = [i for i in range(num_tests)] self._current_tests_index = 0 workers_config = ctx.session.parallel_manager.workers.values() self._workers_excluded_tests = {config.get_worker_id(): config.get...
class TestsDistributer(object):
def __init__(self, num_tests): self._unstarted_tests_indices = [i for i in range(num_tests)] self._current_tests_index = 0 workers_config = ctx.session.parallel_manager.workers.values() self._workers_excluded_tests = {config.get_worker_id(): config.get_excluded_tests() \ ...
from slash import ctx from logbook import Logger _logger = Logger(__name__) class TestsDistributer(object):
24
113
377
7
17
kbh2o/slash
slash/parallel/tests_distributer.py
Python
TestsDistributer
TestsDistributer
7
46
7
7
edd622f5d8ac26d5064c15efa6c2b5cf64272bf2
bigcode/the-stack
train
b852df483736ed3962d24e99
train
class
@admin.register(User) class UserAdmin(ImprovedModelAdmin): def show_groups(self, obj): groups = [] for group in obj.groups.all(): groups.append(group.name) return ",".join(groups) search_fields = ("id", "email", "first_name", "last_name") list_display = ( "id", ...
@admin.register(User) class UserAdmin(ImprovedModelAdmin):
def show_groups(self, obj): groups = [] for group in obj.groups.all(): groups.append(group.name) return ",".join(groups) search_fields = ("id", "email", "first_name", "last_name") list_display = ( "id", "is_active", "email", "first_name", ...
from django.contrib import admin from internal.models import ImprovedModelAdmin from .models import User @admin.register(User) class UserAdmin(ImprovedModelAdmin):
34
64
100
14
19
makecodes/genshin-card-backend
core/admin.py
Python
UserAdmin
UserAdmin
8
24
8
9
ab0d56dd04439ba373432e219c9d82d142d339bb
bigcode/the-stack
train
6bb9594784560d98fa0fb652
train
class
class GeneratedDatasetException(Exception): """ Raised when unable to retrieve generated datasets and related properties """ pass
class GeneratedDatasetException(Exception):
""" Raised when unable to retrieve generated datasets and related properties """ pass
class GeneratedDatasetException(Exception):
6
64
25
6
0
randomaccess3/pyattck
pyattck/utils/exceptions.py
Python
GeneratedDatasetException
GeneratedDatasetException
1
7
1
2
9479eb05fb73506953cf088262479642eb41f7d9
bigcode/the-stack
train
9c6e2b29379d57467e6364e0
train
class
class VoteAdmin(admin.ModelAdmin): # filter_horizontal = ('voted_for','voted_against','voted_abstain','didnt_vote') list_display = ('__unicode__','short_summary','full_text_link','for_votes_count','against_votes_count')
class VoteAdmin(admin.ModelAdmin): # filter_horizontal = ('voted_for','voted_against','voted_abstain','didnt_vote')
list_display = ('__unicode__','short_summary','full_text_link','for_votes_count','against_votes_count')
from models import Vote,Law,PrivateProposal,KnessetProposal,GovProposal,Bill,GovLegislationCommitteeDecision from django.contrib import admin class VoteAdmin(admin.ModelAdmin): # filter_horizontal = ('voted_for','voted_against','voted_abstain','didnt_vote')
63
64
57
32
30
navotsil/Open-Knesset
laws/admin.py
Python
VoteAdmin
VoteAdmin
5
7
5
6
97d259e390ce0ca1a12fd28e505f85acfa3cdd5d
bigcode/the-stack
train
6c426b0d06c62542d2917a39
train
class
class KnessetProposalAdmin(admin.ModelAdmin): pass
class KnessetProposalAdmin(admin.ModelAdmin):
pass
against_votes_count') admin.site.register(Vote, VoteAdmin) class LawAdmin(admin.ModelAdmin): pass admin.site.register(Law, LawAdmin) class PrivateProposalAdmin(admin.ModelAdmin): pass admin.site.register(PrivateProposal, PrivateProposalAdmin) class KnessetProposalAdmin(admin.ModelAdmin):
64
64
13
10
54
navotsil/Open-Knesset
laws/admin.py
Python
KnessetProposalAdmin
KnessetProposalAdmin
18
19
18
18
d282db5d56ab768efb291acfc6e7f86af7acb454
bigcode/the-stack
train
7cbd1b7b4626b39a8d822ed5
train
class
class GovLegislationCommitteeDecisionAdmin(admin.ModelAdmin): pass
class GovLegislationCommitteeDecisionAdmin(admin.ModelAdmin):
pass
.register(KnessetProposal, KnessetProposalAdmin) class GovProposalAdmin(admin.ModelAdmin): pass admin.site.register(GovProposal, GovProposalAdmin) class BillAdmin(admin.ModelAdmin): pass admin.site.register(Bill, BillAdmin) class GovLegislationCommitteeDecisionAdmin(admin.ModelAdmin):
64
64
14
11
53
navotsil/Open-Knesset
laws/admin.py
Python
GovLegislationCommitteeDecisionAdmin
GovLegislationCommitteeDecisionAdmin
30
31
30
30
336852a5a308986f8f8fb6f4f12a5617a867487c
bigcode/the-stack
train
cdeecdf9708c9011f85f5d9e
train
class
class PrivateProposalAdmin(admin.ModelAdmin): pass
class PrivateProposalAdmin(admin.ModelAdmin):
pass
nt_vote') list_display = ('__unicode__','short_summary','full_text_link','for_votes_count','against_votes_count') admin.site.register(Vote, VoteAdmin) class LawAdmin(admin.ModelAdmin): pass admin.site.register(Law, LawAdmin) class PrivateProposalAdmin(admin.ModelAdmin):
64
64
11
8
56
navotsil/Open-Knesset
laws/admin.py
Python
PrivateProposalAdmin
PrivateProposalAdmin
14
15
14
14
0f5998a597fe8c7b96560d8f45722091e63c965e
bigcode/the-stack
train
e47a353c322535564bc94ada
train
class
class BillAdmin(admin.ModelAdmin): pass
class BillAdmin(admin.ModelAdmin):
pass
(PrivateProposal, PrivateProposalAdmin) class KnessetProposalAdmin(admin.ModelAdmin): pass admin.site.register(KnessetProposal, KnessetProposalAdmin) class GovProposalAdmin(admin.ModelAdmin): pass admin.site.register(GovProposal, GovProposalAdmin) class BillAdmin(admin.ModelAdmin):
64
64
10
7
57
navotsil/Open-Knesset
laws/admin.py
Python
BillAdmin
BillAdmin
26
27
26
26
31fd71b6a6e24305b162eed700a6d38b2e58c97e
bigcode/the-stack
train
50228efdf397c5b56918e677
train
class
class GovProposalAdmin(admin.ModelAdmin): pass
class GovProposalAdmin(admin.ModelAdmin):
pass
.register(Law, LawAdmin) class PrivateProposalAdmin(admin.ModelAdmin): pass admin.site.register(PrivateProposal, PrivateProposalAdmin) class KnessetProposalAdmin(admin.ModelAdmin): pass admin.site.register(KnessetProposal, KnessetProposalAdmin) class GovProposalAdmin(admin.ModelAdmin):
64
64
11
8
56
navotsil/Open-Knesset
laws/admin.py
Python
GovProposalAdmin
GovProposalAdmin
22
23
22
22
34746310a97e04292a95c0692bef3b035b4ebc60
bigcode/the-stack
train
99762ac976495ea1bbd55c9c
train
class
class LawAdmin(admin.ModelAdmin): pass
class LawAdmin(admin.ModelAdmin):
pass
filter_horizontal = ('voted_for','voted_against','voted_abstain','didnt_vote') list_display = ('__unicode__','short_summary','full_text_link','for_votes_count','against_votes_count') admin.site.register(Vote, VoteAdmin) class LawAdmin(admin.ModelAdmin):
64
64
10
7
57
navotsil/Open-Knesset
laws/admin.py
Python
LawAdmin
LawAdmin
10
11
10
10
97b14d24ebb2b95019e1c06c3295d5d4e5948a96
bigcode/the-stack
train
7e54f48c628845c959173c2e
train
function
def handle(signum,frame): print("Stopping...") print("Now start to cancel huawei dialout in this python process...") for ids in ids_set: if ids.type == GlobalArgs.RECORD_TYPE: create_client_cancel(ids.dialin_server, ids.subscription_id, ids.request_id) sys.exit(1)
def handle(signum,frame):
print("Stopping...") print("Now start to cancel huawei dialout in this python process...") for ids in ids_set: if ids.type == GlobalArgs.RECORD_TYPE: create_client_cancel(ids.dialin_server, ids.subscription_id, ids.request_id) sys.exit(1)
import RecordToLog, SendToSock from global_args import GlobalArgs from huawei_dialin_cancel import create_client_cancel from producer_thread import Subscribe, DataPublish sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "proto_py"))) def handle(signum,frame):
63
64
70
7
56
caowei49/elk-plugin
HuaweiDialGrpc/huawei_dialout_server.py
Python
handle
handle
17
23
17
17
e1def7904f83f73f6fb2e1adf01047b56142cc20
bigcode/the-stack
train
ba99163c1a09bd1e4851147c
train
function
def lambda_handler(event, context): return ssm.put_parameter(Name='eks-canary-%s-version' % event.get('microservice_name'), Value=event.get('container_image'), Type="SecureString", Overwrite=True)
def lambda_handler(event, context):
return ssm.put_parameter(Name='eks-canary-%s-version' % event.get('microservice_name'), Value=event.get('container_image'), Type="SecureString", Overwrite=True)
import boto3 ssm = boto3.client('ssm') def lambda_handler(event, context):
21
64
50
7
14
saaish/aws-app-mesh-examples
blogs/eks-canary-deployments-pipeline/shared_stack/lambda_functions/update_deployment_version/main.py
Python
lambda_handler
lambda_handler
5
9
5
5
e4936cb3bfca2dac1286df98bb959a306c2da3c7
bigcode/the-stack
train
f6fb127a8746c4d3ad64d410
train
class
class K8sIoApiCoreV1ExecAction(object): """ NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. """ """ Attributes: swagger_types (dict): The key is attribute name and the value is attribute type. att...
class K8sIoApiCoreV1ExecAction(object):
""" NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. """ """ Attributes: swagger_types (dict): The key is attribute name and the value is attribute type. attribute_map (dict): The key is attribute ...
# coding: utf-8 """ KubeVirt API This is KubeVirt API an add-on for Kubernetes. OpenAPI spec version: 1.0.0 Contact: kubevirt-dev@googlegroups.com Generated by: https://github.com/swagger-api/swagger-codegen.git """ from pprint import pformat from six import iteritems import re class K8sIoApiCo...
96
233
779
13
82
ansijain/client-python
kubevirt/models/k8s_io_api_core_v1_exec_action.py
Python
K8sIoApiCoreV1ExecAction
K8sIoApiCoreV1ExecAction
19
125
19
19
f3f94ca2245d7e60be881190bc59c5f4254165f9
bigcode/the-stack
train
226e21e87ff77ee33a9583c5
train
function
def _register_resolver() -> None: """Registers the cirq_google's public classes for JSON serialization.""" from cirq.protocols.json_serialization import _internal_register_resolver from cirq_google.json_resolver_cache import _class_resolver_dictionary _internal_register_resolver(_class_resolver_diction...
def _register_resolver() -> None:
"""Registers the cirq_google's public classes for JSON serialization.""" from cirq.protocols.json_serialization import _internal_register_resolver from cirq_google.json_resolver_cache import _class_resolver_dictionary _internal_register_resolver(_class_resolver_dictionary)
( DeserializingArg, GateOpDeserializer, ) from cirq_google.op_serializer import ( GateOpSerializer, SerializingArg, ) from cirq_google.serializable_gate_set import ( SerializableGateSet, ) from cirq_google import experimental def _register_resolver() -> None:
64
64
67
9
54
balopat/Cirq
cirq-google/cirq_google/__init__.py
Python
_register_resolver
_register_resolver
122
127
122
122
04b7bcdff8dcc8214d58b7ac9f00c68d7e1f9ca2
bigcode/the-stack
train
1a9908f50a551495581f54c3
train
class
class ApplianceImageNotFound(ImageNotFound): """ Compose an ApplianceImageNotFound error complaining that the given name and tag for TOIL_APPLIANCE_SELF specify an image manifest which could not be retrieved from the given URL, because it produced the given HTTP error code. :param str origAppli...
class ApplianceImageNotFound(ImageNotFound):
""" Compose an ApplianceImageNotFound error complaining that the given name and tag for TOIL_APPLIANCE_SELF specify an image manifest which could not be retrieved from the given URL, because it produced the given HTTP error code. :param str origAppliance: The full url of the docker image origin...
def checkDockerSchema(appliance): if not appliance: raise ImageNotFound("No docker image specified.") elif '://' in appliance: raise ImageNotFound("Docker images cannot contain a schema (such as '://'): %s" "" % appliance) elif len(appliance) > 256: raise ...
99
99
331
9
90
ddeka2910/toil
src/toil/__init__.py
Python
ApplianceImageNotFound
ApplianceImageNotFound
334
358
334
334
f3989ad1bcd13e7214991a9d961184b806e851d9
bigcode/the-stack
train
6ef69f12925c58382f36e470
train
function
def logProcessContext(config): # toil.version.version (string) cannot be imported at top level because it conflicts with # toil.version (module) and Sphinx doesn't like that. from toil.version import version log.info("Running Toil version %s on host %s.", version, socket.gethostname()) log.debug("Co...
def logProcessContext(config): # toil.version.version (string) cannot be imported at top level because it conflicts with # toil.version (module) and Sphinx doesn't like that.
from toil.version import version log.info("Running Toil version %s on host %s.", version, socket.gethostname()) log.debug("Configuration: %s", config.__dict__)
raise ApplianceImageNotFound(origAppliance, requests_url, response.status_code) else: return origAppliance def logProcessContext(config): # toil.version.version (string) cannot be imported at top level because it conflicts with # toil.version (module) and Sphinx doesn't like that.
64
64
80
39
24
ddeka2910/toil
src/toil/__init__.py
Python
logProcessContext
logProcessContext
421
426
421
423
579f9df507da83df4dc2c3dac1cc132b90515f56
bigcode/the-stack
train
bbef8dcfd752be9d68166953
train
function
def customDockerInitCmd(): """ Returns the custom command (if any) provided through the ``TOIL_CUSTOM_DOCKER_INIT_COMMAND`` environment variable to run prior to running the workers and/or the primary node's services. This can be useful for doing any custom initialization on instances (e.g. authenticatin...
def customDockerInitCmd():
""" Returns the custom command (if any) provided through the ``TOIL_CUSTOM_DOCKER_INIT_COMMAND`` environment variable to run prior to running the workers and/or the primary node's services. This can be useful for doing any custom initialization on instances (e.g. authenticating to private docker reg...
TOIL_APPLIANCE_SELF', defaultValue=registry + '/' + name + ':' + toil.version.dockerTag) checkDockerSchema(appliance) if forceDockerAppliance: return appliance else: return checkDockerImageExists(appliance=appliance) def customDockerInitCmd():
64
64
181
6
58
ddeka2910/toil
src/toil/__init__.py
Python
customDockerInitCmd
customDockerInitCmd
199
214
199
199
f1b7230c86390ab5fd7a218eb1ae84aef481f650
bigcode/the-stack
train
69198013f66fb4effdbb0dee
train
function
def inVirtualEnv(): """ Returns whether we are inside a virtualenv or Conda virtual environment. """ return ('VIRTUAL_ENV' in os.environ or 'CONDA_DEFAULT_ENV' in os.environ or hasattr(sys, 'real_prefix') or (hasattr(sys, 'base_prefix') and sys.base_prefix != sys.pref...
def inVirtualEnv():
""" Returns whether we are inside a virtualenv or Conda virtual environment. """ return ('VIRTUAL_ENV' in os.environ or 'CONDA_DEFAULT_ENV' in os.environ or hasattr(sys, 'real_prefix') or (hasattr(sys, 'base_prefix') and sys.base_prefix != sys.prefix))
""" Returns the absolute path of the directory that corresponds to the top-level toil package. The return value is guaranteed to end in '/toil'. """ result = os.path.dirname(os.path.realpath(__file__)) assert result.endswith('/toil') return result def inVirtualEnv():
64
64
76
5
58
ddeka2910/toil
src/toil/__init__.py
Python
inVirtualEnv
inVirtualEnv
112
119
112
112
0eaf0f038ed6f02b328e449f666a629db09e9738
bigcode/the-stack
train
ae664a29426c96ed91aefff6
train
function
def physicalDisk(directory: str) -> int: diskStats = os.statvfs(directory) return diskStats.f_frsize * diskStats.f_bavail
def physicalDisk(directory: str) -> int:
diskStats = os.statvfs(directory) return diskStats.f_frsize * diskStats.f_bavail
: return os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES') except ValueError: return int(subprocess.check_output(['sysctl', '-n', 'hw.memsize']).decode('utf-8').strip()) def physicalDisk(directory: str) -> int:
64
64
34
10
54
ddeka2910/toil
src/toil/__init__.py
Python
physicalDisk
physicalDisk
159
161
159
159
ea61f3e019690f4565e68d15f441c8f7fba14625
bigcode/the-stack
train
4963a924e17c540da6c032c6
train
function
def requestCheckDockerIo(origAppliance, imageName, tag): """ Checks docker.io to see if an image exists using the requests library. URL is based on the docker v2 schema. Requires that an access token be fetched first. :param str origAppliance: The full url of the docker image originally ...
def requestCheckDockerIo(origAppliance, imageName, tag):
""" Checks docker.io to see if an image exists using the requests library. URL is based on the docker v2 schema. Requires that an access token be fetched first. :param str origAppliance: The full url of the docker image originally specified by the user (or the default). ...
""" ioURL = 'https://{webhost}/v2/{pathName}/manifests/{tag}' \ ''.format(webhost=registryName, pathName=imageName, tag=tag) response = requests.head(ioURL) if not response.ok: raise ApplianceImageNotFound(origAppliance, ioURL, response.status_code) else: return origAppli...
98
98
327
14
83
ddeka2910/toil
src/toil/__init__.py
Python
requestCheckDockerIo
requestCheckDockerIo
391
418
391
391
3683480f1b7b0e00a69479f2ef9b6e91ef5c9018
bigcode/the-stack
train
b5638731c4d2bbb12ac597e0
train
function
@memoize def physicalMemory() -> int: """ >>> n = physicalMemory() >>> n > 0 True >>> n == physicalMemory() True """ try: return os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES') except ValueError: return int(subprocess.check_output(['sysctl', '-n', 'hw.memsize...
@memoize def physicalMemory() -> int:
""" >>> n = physicalMemory() >>> n > 0 True >>> n == physicalMemory() True """ try: return os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES') except ValueError: return int(subprocess.check_output(['sysctl', '-n', 'hw.memsize']).decode('utf-8').strip())
# Otherwise, we aren't in a virtualenv, or we're in a virtualenv but Toil # came in via --system-site-packages, or we think the virtualenv might not # exist on the workers. return entryPoint @memoize def physicalMemory() -> int:
64
64
98
11
52
ddeka2910/toil
src/toil/__init__.py
Python
physicalMemory
physicalMemory
144
156
144
145
14870d930aa69bc29564dee62dc59d16dd3fb4a1
bigcode/the-stack
train
1a6cda24e31b7aeeba2080a8
train
function
def parseDockerAppliance(appliance): """ Takes string describing a docker image and returns the parsed registry, image reference, and tag for that image. Example: "quay.io/ucsc_cgl/toil:latest" Should return: "quay.io", "ucsc_cgl/toil", "latest" If a registry is not defined, the default is: "d...
def parseDockerAppliance(appliance):
""" Takes string describing a docker image and returns the parsed registry, image reference, and tag for that image. Example: "quay.io/ucsc_cgl/toil:latest" Should return: "quay.io", "ucsc_cgl/toil", "latest" If a registry is not defined, the default is: "docker.io" If a tag is not defined...
if currentCommit in appliance: return appliance registryName, imageName, tag = parseDockerAppliance(appliance) if registryName == 'docker.io': return requestCheckDockerIo(origAppliance=appliance, imageName=imageName, tag=tag) else: return requestCheckRegularDocker(origAppliance=...
98
98
327
8
90
ddeka2910/toil
src/toil/__init__.py
Python
parseDockerAppliance
parseDockerAppliance
285
320
285
285
e1bc295f1792e75e781646f91f81f497bf9eb2b4
bigcode/the-stack
train
78ad7f6525598f7663a8f2e8
train
function
def checkDockerSchema(appliance): if not appliance: raise ImageNotFound("No docker image specified.") elif '://' in appliance: raise ImageNotFound("Docker images cannot contain a schema (such as '://'): %s" "" % appliance) elif len(appliance) > 256: raise ...
def checkDockerSchema(appliance):
if not appliance: raise ImageNotFound("No docker image specified.") elif '://' in appliance: raise ImageNotFound("Docker images cannot contain a schema (such as '://'): %s" "" % appliance) elif len(appliance) > 256: raise ImageNotFound("Docker image must b...
and '.' in appliance.split('/')[0]: registryName = appliance.split('/')[0] imageName = appliance[len(registryName):] registryName = registryName.strip('/') imageName = imageName.strip('/') return registryName, imageName, tag def checkDockerSchema(appliance):
64
64
90
7
56
ddeka2910/toil
src/toil/__init__.py
Python
checkDockerSchema
checkDockerSchema
323
331
323
323
8f27c725c19a823a2440424cda2c81d062327ed1
bigcode/the-stack
train
f2b44a213787639959cd00ba
train
function
def which(cmd, mode=os.F_OK | os.X_OK, path=None): """ Copy-pasted in from python3.6's shutil.which(). Given a command, mode, and a PATH string, return the path which conforms to the given mode on the PATH, or None if there is no such file. `mode` defaults to os.F_OK | os.X_OK. `path` defaults...
def which(cmd, mode=os.F_OK | os.X_OK, path=None):
""" Copy-pasted in from python3.6's shutil.which(). Given a command, mode, and a PATH string, return the path which conforms to the given mode on the PATH, or None if there is no such file. `mode` defaults to os.F_OK | os.X_OK. `path` defaults to the result of os.environ.get("PATH"), or ca...
# # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing ...
170
170
568
16
154
ddeka2910/toil
src/toil/__init__.py
Python
which
which
35
99
35
35
f870b617b82161677410ec09cf20dd72604f5444
bigcode/the-stack
train
6bc25c28e3446a209bc78b69
train
function
def customInitCmd(): """ Returns the custom command (if any) provided through the ``TOIL_CUSTOM_INIT_COMMAND`` environment variable to run prior to running Toil appliance itself in workers and/or the primary node (i.e. this is run one stage before ``TOIL_CUSTOM_DOCKER_INIT_COMMAND``). This can be us...
def customInitCmd():
""" Returns the custom command (if any) provided through the ``TOIL_CUSTOM_INIT_COMMAND`` environment variable to run prior to running Toil appliance itself in workers and/or the primary node (i.e. this is run one stage before ``TOIL_CUSTOM_DOCKER_INIT_COMMAND``). This can be useful for doing any cu...
command = lookupEnvVar(name='user-defined custom docker init command', envName='TOIL_CUSTOM_DOCKER_INIT_COMMAND', defaultValue='') _check_custom_bash_cmd(command) return command.replace("'", "'\\''") # Ensure any single quotes are escaped. def customInitCm...
64
64
197
5
59
ddeka2910/toil
src/toil/__init__.py
Python
customInitCmd
customInitCmd
217
233
217
217
1ff7c307ae3d96393dc50f7d5171183ed5d47a8e
bigcode/the-stack
train
fdfe9d6a4ebaf0564002b6bb
train
function
def requestCheckRegularDocker(origAppliance, registryName, imageName, tag): """ Checks to see if an image exists using the requests library. URL is based on the docker v2 schema described here: https://docs.docker.com/registry/spec/manifest-v2-2/ This has the following format: https://{website...
def requestCheckRegularDocker(origAppliance, registryName, imageName, tag):
""" Checks to see if an image exists using the requests library. URL is based on the docker v2 schema described here: https://docs.docker.com/registry/spec/manifest-v2-2/ This has the following format: https://{websitehostname}.io/v2/{repo}/manifests/{tag} Does not work with the official ...
tag>' " "(for official docker.io images). Examples: " "'quay.io/ucsc_cgl/toil:latest', 'ubuntu:latest', or " "'broadinstitute/genomes-in-the-cloud:2.0.0'." "" % (origAppliance, url, str(statusCode))) super(ApplianceImageNotFound, self).__init__(msg) d...
102
102
340
17
85
ddeka2910/toil
src/toil/__init__.py
Python
requestCheckRegularDocker
requestCheckRegularDocker
361
388
361
361
d8604f6ad5dd8198d792a74dcb25e4c92385ecb5
bigcode/the-stack
train
93377ba24bb8144d9baac5a1
train
function
def applianceSelf(forceDockerAppliance=False): """ Returns the fully qualified name of the Docker image to start Toil appliance containers from. The result is determined by the current version of Toil and three environment variables: ``TOIL_DOCKER_REGISTRY``, ``TOIL_DOCKER_NAME`` and ``TOIL_APPLIANCE_SE...
def applianceSelf(forceDockerAppliance=False):
""" Returns the fully qualified name of the Docker image to start Toil appliance containers from. The result is determined by the current version of Toil and three environment variables: ``TOIL_DOCKER_REGISTRY``, ``TOIL_DOCKER_NAME`` and ``TOIL_APPLIANCE_SELF``. ``TOIL_DOCKER_REGISTRY`` specifies a...
0 True >>> n == physicalMemory() True """ try: return os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES') except ValueError: return int(subprocess.check_output(['sysctl', '-n', 'hw.memsize']).decode('utf-8').strip()) def physicalDisk(directory: str) -> int: diskStats =...
116
116
387
9
106
ddeka2910/toil
src/toil/__init__.py
Python
applianceSelf
applianceSelf
164
196
164
164
cfa778f75f1711a27dfc279f1b2312b51c449407
bigcode/the-stack
train
6d3678312f06b2e1204926c3
train
function
def lookupEnvVar(name, envName, defaultValue): """ Use this for looking up environment variables that control Toil and are important enough to log the result of that lookup. :param str name: the human readable name of the variable :param str envName: the name of the environment variable to lookup ...
def lookupEnvVar(name, envName, defaultValue):
""" Use this for looking up environment variables that control Toil and are important enough to log the result of that lookup. :param str name: the human readable name of the variable :param str envName: the name of the environment variable to lookup :param str defaultValue: the fall-back value...
_custom_bash_cmd(cmd_str): """Ensures that the bash command doesn't contain blacklisted characters.""" assert not re.search(r'[\n\r\t]', cmd_str), f'"{cmd_str}" contains invalid characters (newline and/or tab).' def lookupEnvVar(name, envName, defaultValue):
64
64
194
12
51
ddeka2910/toil
src/toil/__init__.py
Python
lookupEnvVar
lookupEnvVar
241
259
241
241
d9f1677444713e3e8365bd11c7437652f37e37fb
bigcode/the-stack
train
f3c84993aee5882401d9ff59
train
function
def resolveEntryPoint(entryPoint): """ Returns the path to the given entry point (see setup.py) that *should* work on a worker. The return value may be an absolute or a relative path. """ if os.environ.get("TOIL_CHECK_ENV", None) == 'True' and inVirtualEnv(): path = os.path.join(os.path.dir...
def resolveEntryPoint(entryPoint):
""" Returns the path to the given entry point (see setup.py) that *should* work on a worker. The return value may be an absolute or a relative path. """ if os.environ.get("TOIL_CHECK_ENV", None) == 'True' and inVirtualEnv(): path = os.path.join(os.path.dirname(sys.executable), entryPoint) ...
Returns whether we are inside a virtualenv or Conda virtual environment. """ return ('VIRTUAL_ENV' in os.environ or 'CONDA_DEFAULT_ENV' in os.environ or hasattr(sys, 'real_prefix') or (hasattr(sys, 'base_prefix') and sys.base_prefix != sys.prefix)) def resolveEntryPoint(e...
76
76
255
7
69
ddeka2910/toil
src/toil/__init__.py
Python
resolveEntryPoint
resolveEntryPoint
122
141
122
122
bfa0aaaee1772f84b4bac9bec7abe295bf636f11
bigcode/the-stack
train
bd520f528cd80be8b49fa07a
train
function
def toilPackageDirPath(): """ Returns the absolute path of the directory that corresponds to the top-level toil package. The return value is guaranteed to end in '/toil'. """ result = os.path.dirname(os.path.realpath(__file__)) assert result.endswith('/toil') return result
def toilPackageDirPath():
""" Returns the absolute path of the directory that corresponds to the top-level toil package. The return value is guaranteed to end in '/toil'. """ result = os.path.dirname(os.path.realpath(__file__)) assert result.endswith('/toil') return result
normdir = os.path.normcase(dir) if not normdir in seen: seen.add(normdir) for thefile in files: name = os.path.join(dir, thefile) if _access_check(name, mode): return name return None def toilPackageDirPath():
64
64
65
6
57
ddeka2910/toil
src/toil/__init__.py
Python
toilPackageDirPath
toilPackageDirPath
102
109
102
102
8d1a865a9155774a427cc8128baa216539757ca5
bigcode/the-stack
train
0e16a937fa2d80d5f5b0491c
train
function
def _check_custom_bash_cmd(cmd_str): """Ensures that the bash command doesn't contain blacklisted characters.""" assert not re.search(r'[\n\r\t]', cmd_str), f'"{cmd_str}" contains invalid characters (newline and/or tab).'
def _check_custom_bash_cmd(cmd_str):
"""Ensures that the bash command doesn't contain blacklisted characters.""" assert not re.search(r'[\n\r\t]', cmd_str), f'"{cmd_str}" contains invalid characters (newline and/or tab).'
= lookupEnvVar(name='user-defined custom init command', envName='TOIL_CUSTOM_INIT_COMMAND', defaultValue='') _check_custom_bash_cmd(command) return command.replace("'", "'\\''") # Ensure any single quotes are escaped. def _check_custom_bash_cmd(cmd_str):
64
64
55
10
54
ddeka2910/toil
src/toil/__init__.py
Python
_check_custom_bash_cmd
_check_custom_bash_cmd
236
238
236
236
d5eab89df80615b431817acd2733a82c2c673fef
bigcode/the-stack
train
eddd6e68c5972545b1fe61f0
train
function
def checkDockerImageExists(appliance): """ Attempts to check a url registryName for the existence of a docker image with a given tag. :param str appliance: The url of a docker image's registry (with a tag) of the form: 'quay.io/<repo_path>:<tag>' or '<repo_path>:<tag>'. ...
def checkDockerImageExists(appliance):
""" Attempts to check a url registryName for the existence of a docker image with a given tag. :param str appliance: The url of a docker image's registry (with a tag) of the form: 'quay.io/<repo_path>:<tag>' or '<repo_path>:<tag>'. Examples: 'quay.io/ucsc...
('Using default %s of %s as %s is not set.', name, defaultValue, envName) return defaultValue else: log.info('Overriding %s of %s with %s from %s.', name, defaultValue, value, envName) return value def checkDockerImageExists(appliance):
72
72
243
8
63
ddeka2910/toil
src/toil/__init__.py
Python
checkDockerImageExists
checkDockerImageExists
262
282
262
262
4950aefdd4b6452d4b1149d07380561c5b12ea14
bigcode/the-stack
train
d8d21e0748f8fe1d7858cff5
train
class
class Solution: def buildTree(self, preorder: List[int], inorder: List[int]) -> TreeNode: if not preorder : return root = TreeNode(preorder[0]) rootpos = inorder.index(preorder[0]) root.left = self.buildTree(preorder[1 : rootpos + 1], inorder[: rootpos]) root.righ...
class Solution:
def buildTree(self, preorder: List[int], inorder: List[int]) -> TreeNode: if not preorder : return root = TreeNode(preorder[0]) rootpos = inorder.index(preorder[0]) root.left = self.buildTree(preorder[1 : rootpos + 1], inorder[: rootpos]) root.right = self.buildTr...
class Solution:
3
64
102
3
0
yuqingchen/Leetcode
105_Construct_Binary_Tree_from_Preorder_and_Inorder_Traversal.py
Python
Solution
Solution
1
9
1
1
a6c4bad05db7e8760c780eedcd2b37b17964def2
bigcode/the-stack
train
01573ce0f174f54d5aa820ff
train
class
@dataclass(frozen=True) class Event: """Base class for an event that could be extracted from the key exports.""" # The tek associated with the event key: TEK # When the event occured dt: datetime
@dataclass(frozen=True) class Event:
"""Base class for an event that could be extracted from the key exports.""" # The tek associated with the event key: TEK # When the event occured dt: datetime
in data.keys] @property def dt(self) -> datetime: # Dirty hack to display in local timezone instead of UTC return datetime.strptime(self.path.name, "%Y-%m-%d_%H-%M.zip") + timedelta(hours=2) @dataclass(frozen=True) class Event:
64
64
52
9
55
OttoWinter/corona-de-at-data
at_stop_corona_dump.py
Python
Event
Event
72
78
72
73
473bff315f18d7ef86901300f989c7870ca11312
bigcode/the-stack
train
b39034fedbf1ebd0b03a13e0
train
class
@dataclass(frozen=True) class TEK: """A temporary exposure key.""" data: bytes interval: int level: int period: int @property def dt(self) -> datetime: return datetime.utcfromtimestamp(self.interval*600) @property def dt_end(self) -> datetime: return self.dt + timed...
@dataclass(frozen=True) class TEK:
"""A temporary exposure key.""" data: bytes interval: int level: int period: int @property def dt(self) -> datetime: return datetime.utcfromtimestamp(self.interval*600) @property def dt_end(self) -> datetime: return self.dt + timedelta(minutes=self.period*10) @...
#!/usr/bin/env python3 from datetime import datetime, timedelta import format_pb2 as pb import zipfile from pprint import pprint import collections from pathlib import Path from pprint import pprint import hashlib from dataclasses import dataclass from typing import Optional, List, Set, Dict @dataclass(frozen=True) cla...
74
96
323
10
63
OttoWinter/corona-de-at-data
at_stop_corona_dump.py
Python
TEK
TEK
13
46
13
14
cf28b880bb1a244d7db8c52f9b5a33f17520cbc3
bigcode/the-stack
train
cf7b7f7fc8f3d755e4e4ed8e
train
class
@dataclass(frozen=True) class AutoRemovedEvent(Event): """A key was automatically removed.""" # When the key was first added. added_dt: datetime
@dataclass(frozen=True) class AutoRemovedEvent(Event):
"""A key was automatically removed.""" # When the key was first added. added_dt: datetime
revoked.""" # When the key was first added added_dt: datetime @dataclass(frozen=True) class AddedEvent(Event): """A key was added.""" # Was key metadata (risk level) changed later? changed: bool @dataclass(frozen=True) class AutoRemovedEvent(Event):
64
64
35
12
51
OttoWinter/corona-de-at-data
at_stop_corona_dump.py
Python
AutoRemovedEvent
AutoRemovedEvent
92
96
92
93
551bf1c88a9c614263559bf4524ef47a9e12023d
bigcode/the-stack
train
629fcf83960392bdd8a6e417
train
class
@dataclass(frozen=True) class AddedEvent(Event): """A key was added.""" # Was key metadata (risk level) changed later? changed: bool
@dataclass(frozen=True) class AddedEvent(Event):
"""A key was added.""" # Was key metadata (risk level) changed later? changed: bool
key: TEK # When the event occured dt: datetime @dataclass(frozen=True) class RevokedEvent(Event): """A key was revoked.""" # When the key was first added added_dt: datetime @dataclass(frozen=True) class AddedEvent(Event):
64
64
35
11
52
OttoWinter/corona-de-at-data
at_stop_corona_dump.py
Python
AddedEvent
AddedEvent
86
90
86
87
9cefc83a32e088d1a5fea76965c6bcd27d40e07d
bigcode/the-stack
train
b034d864970e1a5ba1057d1d
train
class
@dataclass(frozen=True) class RevokedEvent(Event): """A key was revoked.""" # When the key was first added added_dt: datetime
@dataclass(frozen=True) class RevokedEvent(Event):
"""A key was revoked.""" # When the key was first added added_dt: datetime
@dataclass(frozen=True) class Event: """Base class for an event that could be extracted from the key exports.""" # The tek associated with the event key: TEK # When the event occured dt: datetime @dataclass(frozen=True) class RevokedEvent(Event):
64
64
34
12
51
OttoWinter/corona-de-at-data
at_stop_corona_dump.py
Python
RevokedEvent
RevokedEvent
80
84
80
81
3a3d8ca522d7b3dbbe40e4af3a0f7d3c550a6afe
bigcode/the-stack
train
8def660a1237db16620038e6
train
class
@dataclass(frozen=True) class Archive: path: Path def load_keys(self) -> List[TEK]: with self.path.open('rb') as fh: with zipfile.ZipFile(fh) as archive: with archive.open('export.bin') as export: export_bin = export.read() proto_bin = export_bin[...
@dataclass(frozen=True) class Archive:
path: Path def load_keys(self) -> List[TEK]: with self.path.open('rb') as fh: with zipfile.ZipFile(fh) as archive: with archive.open('export.bin') as export: export_bin = export.read() proto_bin = export_bin[16:] data = pb.TemporaryExposur...
.dt.minute != 0: dt_s = self.dt.strftime("%a\033[0m %Y.%m.%d %H:%M") extra_s = ', '.join(extra) return f"{sha} {dt_s} ({extra_s})" @dataclass(frozen=True) class Archive:
64
64
191
9
55
OttoWinter/corona-de-at-data
at_stop_corona_dump.py
Python
Archive
Archive
48
69
48
49
eef1c7310c5dfa1b86a51dfb0547b829989befdd
bigcode/the-stack
train
929f99f0dd3a92ab304228fd
train
class
class BibleFilesetRecord: def __init__(self, hashId, numFiles): self.hashId = hashId self.numFiles = numFiles if numFiles > 1 else 0 self.numVerses = 0 def toString(self): return "%s, %d, %d" % (self.hashId, self.numFiles, self.numVerses)
class BibleFilesetRecord:
def __init__(self, hashId, numFiles): self.hashId = hashId self.numFiles = numFiles if numFiles > 1 else 0 self.numVerses = 0 def toString(self): return "%s, %d, %d" % (self.hashId, self.numFiles, self.numVerses)
# OneTimeUpdateDBSWEB.py import io import os import sys import hashlib from datetime import datetime from Config import * from LPTSExtractReader import * from SQLUtility import * class BibleFilesetRecord:
48
64
83
6
42
faithcomesbyhearing/dbp-etl
obsolete/analysis/py/OneTimeUpdateDBSWEB.py
Python
BibleFilesetRecord
BibleFilesetRecord
13
21
13
14
8e432d8f708ad4abcfc3ce4af1328a700b3c653d
bigcode/the-stack
train
44fba1e562a8ad9b521c7267
train
class
class OneTimeUpdateDBSWEB: def __init__(self): self.config = Config() self.db = SQLUtility(self.config) self.lptsReader = LPTSExtractReader(self.config) def close(self): self.db.close() def process(self): count = 0 dbpProdMap = self.getDBPProdFiles() for (bibleId, filesetId) in self.getBibleFilese...
class OneTimeUpdateDBSWEB:
def __init__(self): self.config = Config() self.db = SQLUtility(self.config) self.lptsReader = LPTSExtractReader(self.config) def close(self): self.db.close() def process(self): count = 0 dbpProdMap = self.getDBPProdFiles() for (bibleId, filesetId) in self.getBibleFilesetList(): filesetList = se...
s-web" and row[1] == "text_format": self.dbsFormat = record elif row[0] == "dbs-web" and row[1] == "text_plain": self.dbsPlain = record self.stockNo = None def hasDBSWEBContent(self): return self.dbsFormat != None or self.dbsPlain != None def toString(self): result = [] if self.fcbhFormat != None...
256
256
2,767
8
248
faithcomesbyhearing/dbp-etl
obsolete/analysis/py/OneTimeUpdateDBSWEB.py
Python
OneTimeUpdateDBSWEB
OneTimeUpdateDBSWEB
64
270
64
65
819b5b90dff82a6d40be50613819b7f65db73e44
bigcode/the-stack
train
7a33cf06dcffd9912d45f7ca
train
class
class BibleFileset: def __init__(self, resultSet): self.fcbhFormat = None self.fcbhPlain = None self.dbsFormat = None self.dbsPlain = None self.prodFiles = 0 self.dbpFormatDelete = False self.dbpPlainDelete = False self.dbsFormat2fcbhFormat = False self.dbsPlain2fcbhPlain = False for row in result...
class BibleFileset:
def __init__(self, resultSet): self.fcbhFormat = None self.fcbhPlain = None self.dbsFormat = None self.dbsPlain = None self.prodFiles = 0 self.dbpFormatDelete = False self.dbpPlainDelete = False self.dbsFormat2fcbhFormat = False self.dbsPlain2fcbhPlain = False for row in resultSet: record = Bibl...
# OneTimeUpdateDBSWEB.py import io import os import sys import hashlib from datetime import datetime from Config import * from LPTSExtractReader import * from SQLUtility import * class BibleFilesetRecord: def __init__(self, hashId, numFiles): self.hashId = hashId self.numFiles = numFiles if numFiles > 1 else 0...
130
132
441
5
125
faithcomesbyhearing/dbp-etl
obsolete/analysis/py/OneTimeUpdateDBSWEB.py
Python
BibleFileset
BibleFileset
23
61
23
24
dac2081223132be70edfd00fdd44aa2eea0f7fa1
bigcode/the-stack
train
22b2a17e02727b8592398bd7
train
function
def start(): print('Enter starting number: ') return int(input())
def start():
print('Enter starting number: ') return int(input())
i += 4 else: arithmetic_ops = {1: lambda x, y: x + y, 2: lambda x, y: x * y,} data[res] = arithmetic_ops.get(op)(first_num, second_num) i += 4 def start():
64
64
16
3
60
marinmuso/adventofcode
day5/diagnostic.py
Python
start
start
87
89
87
87
107d5dc666a599d606a5429577adc4dd8b85203e
bigcode/the-stack
train
3d3436b8513f5d94490cbde8
train
function
def process(data, start_num): i = 0 while i < len(data): instruction = data[i] decoded = decode_instruction(instruction) op = decoded['op'] if op == 99: break elif op == 3: position = data[i+1] data[position] = start_num ...
def process(data, start_num):
i = 0 while i < len(data): instruction = data[i] decoded = decode_instruction(instruction) op = decoded['op'] if op == 99: break elif op == 3: position = data[i+1] data[position] = start_num i += 2 elif op == 4:...
=FILE_NAME): with open(filename) as file: return [int(val) for val in file.read().split(',')] def decode_instruction(instruction): instruction = str(instruction).zfill(5) decoded = {} decoded.update([ ('op', int(instruction[-2:])), ('param_one', int(instruction[2])), ('...
114
114
380
7
106
marinmuso/adventofcode
day5/diagnostic.py
Python
process
process
23
84
23
23
39f35a8f981efd1126b8fcbad4ed54dd2587aab6
bigcode/the-stack
train
501b068096df32740f0d6564
train
function
def decode_instruction(instruction): instruction = str(instruction).zfill(5) decoded = {} decoded.update([ ('op', int(instruction[-2:])), ('param_one', int(instruction[2])), ('param_two', int(instruction[1])), ('param_three', int(instruction[0])), ]) return decode...
def decode_instruction(instruction):
instruction = str(instruction).zfill(5) decoded = {} decoded.update([ ('op', int(instruction[-2:])), ('param_one', int(instruction[2])), ('param_two', int(instruction[1])), ('param_three', int(instruction[0])), ]) return decoded
#!/usr/bin/env python3 FILE_NAME = 'input.txt' def load_data(filename=FILE_NAME): with open(filename) as file: return [int(val) for val in file.read().split(',')] def decode_instruction(instruction):
51
64
79
6
45
marinmuso/adventofcode
day5/diagnostic.py
Python
decode_instruction
decode_instruction
11
20
11
11
b446cbc756b09d530e3f7957d4f5d385dcc7d59f
bigcode/the-stack
train
721d421ef0a0d8d9b35d2eed
train
function
def load_data(filename=FILE_NAME): with open(filename) as file: return [int(val) for val in file.read().split(',')]
def load_data(filename=FILE_NAME):
with open(filename) as file: return [int(val) for val in file.read().split(',')]
#!/usr/bin/env python3 FILE_NAME = 'input.txt' def load_data(filename=FILE_NAME):
22
64
31
8
14
marinmuso/adventofcode
day5/diagnostic.py
Python
load_data
load_data
6
8
6
6
889d686713aee7054982a3512172cfb87b53a4c9
bigcode/the-stack
train
63b7ff0ec70e5b27dff73dca
train
class
class L1ZeroInflatedPoissonResults(L1CountResults, ZeroInflatedPoissonResults): pass
class L1ZeroInflatedPoissonResults(L1CountResults, ZeroInflatedPoissonResults):
pass
, dummy=False, count=False): """Get marginal effects of the fitted model. Not yet implemented for Zero Inflated Models """ raise NotImplementedError("not yet implemented for zero inflation") class L1ZeroInflatedPoissonResults(L1CountResults, ZeroInflatedPoissonResult...
64
64
24
21
43
AustinJAdams/statsmodels
statsmodels/discrete/count_model.py
Python
L1ZeroInflatedPoissonResults
L1ZeroInflatedPoissonResults
720
721
720
720
08542ed68522289a57c64a99dd377c6005d1ffed
bigcode/the-stack
train
7e273039a984e44ae9a274d3
train
class
class ZeroInflatedPoissonResultsWrapper(lm.RegressionResultsWrapper): pass
class ZeroInflatedPoissonResultsWrapper(lm.RegressionResultsWrapper):
pass
Not yet implemented for Zero Inflated Models """ raise NotImplementedError("not yet implemented for zero inflation") class L1ZeroInflatedPoissonResults(L1CountResults, ZeroInflatedPoissonResults): pass class ZeroInflatedPoissonResultsWrapper(lm.RegressionResultsWrapper):
64
64
18
15
48
AustinJAdams/statsmodels
statsmodels/discrete/count_model.py
Python
ZeroInflatedPoissonResultsWrapper
ZeroInflatedPoissonResultsWrapper
724
725
724
724
f09f1de3f3ad0846e2a3e2362ce4726dc373f302
bigcode/the-stack
train
7f42da86be782d624636ff51
train
class
class L1ZeroInflatedNegativeBinomialResults(L1CountResults, ZeroInflatedNegativeBinomialResults): pass
class L1ZeroInflatedNegativeBinomialResults(L1CountResults, ZeroInflatedNegativeBinomialResults):
pass
=False, count=False): """Get marginal effects of the fitted model. Not yet implemented for Zero Inflated Models """ raise NotImplementedError("not yet implemented for zero inflation") class L1ZeroInflatedNegativeBinomialResults(L1CountResults, ZeroInflatedNegativeBinomialResults...
64
64
27
24
40
AustinJAdams/statsmodels
statsmodels/discrete/count_model.py
Python
L1ZeroInflatedNegativeBinomialResults
L1ZeroInflatedNegativeBinomialResults
799
801
799
800
4fbe0691e1eeacd110a3b5757b0bf1acec3d9592
bigcode/the-stack
train
64055b6ff6e21ca6708733fd
train
class
class L1ZeroInflatedPoissonResultsWrapper(lm.RegressionResultsWrapper): pass
class L1ZeroInflatedPoissonResultsWrapper(lm.RegressionResultsWrapper):
pass
InflatedPoissonResults): pass class ZeroInflatedPoissonResultsWrapper(lm.RegressionResultsWrapper): pass wrap.populate_wrapper(ZeroInflatedPoissonResultsWrapper, ZeroInflatedPoissonResults) class L1ZeroInflatedPoissonResultsWrapper(lm.RegressionResultsWrapper):
64
64
20
17
47
AustinJAdams/statsmodels
statsmodels/discrete/count_model.py
Python
L1ZeroInflatedPoissonResultsWrapper
L1ZeroInflatedPoissonResultsWrapper
730
731
730
730
72baf8c09edb5efefb476208a337139ca142e718
bigcode/the-stack
train
a66a5bcb42709f4b26e45b7e
train
class
class ZeroInflatedGeneralizedPoisson(GenericZeroInflated): __doc__ = """ Zero Inflated Generalized Poisson model for count data %(params)s %(extra_params)s Attributes ---------- endog : array A reference to the endogenous response variable exog : array A reference to th...
class ZeroInflatedGeneralizedPoisson(GenericZeroInflated):
__doc__ = """ Zero Inflated Generalized Poisson model for count data %(params)s %(extra_params)s Attributes ---------- endog : array A reference to the endogenous response variable exog : array A reference to the exogenous design. exog_infl: array A referenc...
:] counts = np.atleast_2d(np.arange(0, np.max(self.endog)+1)) if len(exog_infl.shape) < 2: transform = True w = np.atleast_2d( self.model_infl.predict(params_infl, exog_infl))[:, None] else: transform = False w = self.model_infl.p...
235
235
785
13
221
AustinJAdams/statsmodels
statsmodels/discrete/count_model.py
Python
ZeroInflatedGeneralizedPoisson
ZeroInflatedGeneralizedPoisson
544
619
544
544
968bdf058c2c28d2eef9fedc2990a09cc2d1f4c7
bigcode/the-stack
train
f2b38042dd966bdabb163073
train
class
class L1ZeroInflatedGeneralizedPoissonResultsWrapper( lm.RegressionResultsWrapper): pass
class L1ZeroInflatedGeneralizedPoissonResultsWrapper( lm.RegressionResultsWrapper):
pass
ZeroInflatedGeneralizedPoissonResultsWrapper( lm.RegressionResultsWrapper): pass wrap.populate_wrapper(ZeroInflatedGeneralizedPoissonResultsWrapper, ZeroInflatedGeneralizedPoissonResults) class L1ZeroInflatedGeneralizedPoissonResultsWrapper( lm.RegressionResultsWrapper):
64
64
23
20
44
AustinJAdams/statsmodels
statsmodels/discrete/count_model.py
Python
L1ZeroInflatedGeneralizedPoissonResultsWrapper
L1ZeroInflatedGeneralizedPoissonResultsWrapper
770
772
770
771
fab9a0d127fbe4d471c761765e99ce1ba2f955ee
bigcode/the-stack
train
a26c199b7ae465b4751b5889
train
class
class L1ZeroInflatedGeneralizedPoissonResults(L1CountResults, ZeroInflatedGeneralizedPoissonResults): pass
class L1ZeroInflatedGeneralizedPoissonResults(L1CountResults, ZeroInflatedGeneralizedPoissonResults):
pass
count=False): """Get marginal effects of the fitted model. Not yet implemented for Zero Inflated Models """ raise NotImplementedError("not yet implemented for zero inflation") class L1ZeroInflatedGeneralizedPoissonResults(L1CountResults, ZeroInflatedGeneralizedPoissonResults):
64
64
29
26
38
AustinJAdams/statsmodels
statsmodels/discrete/count_model.py
Python
L1ZeroInflatedGeneralizedPoissonResults
L1ZeroInflatedGeneralizedPoissonResults
758
760
758
759
3f7a6ae8d0ac57155bb80612afd3f11c74e8d057
bigcode/the-stack
train
25e6ed985ba31e791db74eaf
train
class
class GenericZeroInflated(CountModel): __doc__ = """ Generiz Zero Inflated model for count data %(params)s %(extra_params)s Attributes ---------- endog : array A reference to the endogenous response variable exog : array A reference to the exogenous design. exog_inf...
class GenericZeroInflated(CountModel):
__doc__ = """ Generiz Zero Inflated model for count data %(params)s %(extra_params)s Attributes ---------- endog : array A reference to the endogenous response variable exog : array A reference to the exogenous design. exog_infl: array A reference to the zer...
_model import (DiscreteModel, CountModel, Poisson, Logit, CountResults, L1CountResults, Probit, _discrete_results_docs, _val...
255
256
3,884
9
246
AustinJAdams/statsmodels
statsmodels/discrete/count_model.py
Python
GenericZeroInflated
GenericZeroInflated
37
453
37
37
d846a57c58472598777dab040cb77656f6ab9f39
bigcode/the-stack
train
73b22a3af090344d26a73e38
train
class
class ZeroInflatedGeneralizedPoissonResultsWrapper( lm.RegressionResultsWrapper): pass
class ZeroInflatedGeneralizedPoissonResultsWrapper( lm.RegressionResultsWrapper):
pass
Models """ raise NotImplementedError("not yet implemented for zero inflation") class L1ZeroInflatedGeneralizedPoissonResults(L1CountResults, ZeroInflatedGeneralizedPoissonResults): pass class ZeroInflatedGeneralizedPoissonResultsWrapper( lm.RegressionResultsWrapper):
64
64
21
18
45
AustinJAdams/statsmodels
statsmodels/discrete/count_model.py
Python
ZeroInflatedGeneralizedPoissonResultsWrapper
ZeroInflatedGeneralizedPoissonResultsWrapper
763
765
763
764
e573ad0561baacdc6e7d87b02ed6194220f06d19
bigcode/the-stack
train
c10a921850da203b7cb9a38e
train
class
class ZeroInflatedPoisson(GenericZeroInflated): __doc__ = """ Poisson Zero Inflated model for count data %(params)s %(extra_params)s Attributes ---------- endog : array A reference to the endogenous response variable exog : array A reference to the exogenous design. ...
class ZeroInflatedPoisson(GenericZeroInflated):
__doc__ = """ Poisson Zero Inflated model for count data %(params)s %(extra_params)s Attributes ---------- endog : array A reference to the endogenous response variable exog : array A reference to the exogenous design. exog_infl: array A reference to the zer...
== 1 and tmp_offset[0] == 'no': del self.model_main.offset else: self.model_main.offset = tmp_offset if len(tmp_exposure) == 1 and tmp_exposure[0] == 'no': del self.model_main.exposure else: self.model_main.exposure = tmp_exposure # end ha...
256
256
888
11
245
AustinJAdams/statsmodels
statsmodels/discrete/count_model.py
Python
ZeroInflatedPoisson
ZeroInflatedPoisson
456
541
456
456
d97c3962db4ac078744d7687eee4d4024a204460
bigcode/the-stack
train
e573e61e245342cca823fd3c
train
class
class L1ZeroInflatedNegativeBinomialResultsWrapper( lm.RegressionResultsWrapper): pass
class L1ZeroInflatedNegativeBinomialResultsWrapper( lm.RegressionResultsWrapper):
pass
pass class ZeroInflatedNegativeBinomialResultsWrapper( lm.RegressionResultsWrapper): pass wrap.populate_wrapper(ZeroInflatedNegativeBinomialResultsWrapper, ZeroInflatedNegativeBinomialResults) class L1ZeroInflatedNegativeBinomialResultsWrapper( lm.RegressionResultsWrapper...
64
64
22
19
45
AustinJAdams/statsmodels
statsmodels/discrete/count_model.py
Python
L1ZeroInflatedNegativeBinomialResultsWrapper
L1ZeroInflatedNegativeBinomialResultsWrapper
811
813
811
812
d0bb08dc007159d56d4b3baf25a3d51a04bfbbd5
bigcode/the-stack
train
2e4a842aa565661775430fa7
train
class
class ZeroInflatedNegativeBinomialResults(CountResults): __doc__ = _discrete_results_docs % { "one_line_description": "A results class for Zero Inflated Generalized Negative Binomial", "extra_attr": ""} @cache_readonly def _dispersion_factor(self): p = self.model.model_main.paramete...
class ZeroInflatedNegativeBinomialResults(CountResults):
__doc__ = _discrete_results_docs % { "one_line_description": "A results class for Zero Inflated Generalized Negative Binomial", "extra_attr": ""} @cache_readonly def _dispersion_factor(self): p = self.model.model_main.parameterization alpha = self.params[self.model.k_inflate...
Results) class L1ZeroInflatedGeneralizedPoissonResultsWrapper( lm.RegressionResultsWrapper): pass wrap.populate_wrapper(L1ZeroInflatedGeneralizedPoissonResultsWrapper, L1ZeroInflatedGeneralizedPoissonResults) class ZeroInflatedNegativeBinomialResults(CountResults):
64
64
196
12
52
AustinJAdams/statsmodels
statsmodels/discrete/count_model.py
Python
ZeroInflatedNegativeBinomialResults
ZeroInflatedNegativeBinomialResults
777
796
777
777
bd0bf28ab7d7c5a316eb312101f82c62d8b1bbb7
bigcode/the-stack
train
95a690bae30db35e6bf07092
train
class
class ZeroInflatedNegativeBinomialResultsWrapper( lm.RegressionResultsWrapper): pass
class ZeroInflatedNegativeBinomialResultsWrapper( lm.RegressionResultsWrapper):
pass
Zero Inflated Models """ raise NotImplementedError("not yet implemented for zero inflation") class L1ZeroInflatedNegativeBinomialResults(L1CountResults, ZeroInflatedNegativeBinomialResults): pass class ZeroInflatedNegativeBinomialResultsWrapper( lm.RegressionResultsWrapper):
64
64
20
17
46
AustinJAdams/statsmodels
statsmodels/discrete/count_model.py
Python
ZeroInflatedNegativeBinomialResultsWrapper
ZeroInflatedNegativeBinomialResultsWrapper
804
806
804
805
b0c65655efcbfcdcdb8a54d795d25de07bfe8d23
bigcode/the-stack
train
26d16fec91ef5058c13c9689
train
class
class ZeroInflatedPoissonResults(CountResults): __doc__ = _discrete_results_docs % { "one_line_description": "A results class for Zero Inflated Poisson", "extra_attr": ""} @cache_readonly def _dispersion_factor(self): mu = self.predict(which='linear') w = 1 - self.predict() / np.exp...
class ZeroInflatedPoissonResults(CountResults):
__doc__ = _discrete_results_docs % { "one_line_description": "A results class for Zero Inflated Poisson", "extra_attr": ""} @cache_readonly def _dispersion_factor(self): mu = self.predict(which='linear') w = 1 - self.predict() / np.exp(self.predict(which='linear')) return (1...
warnings.simplefilter("ignore", category=ConvergenceWarning) start_params = self.model_main.fit(disp=0, method='nm').params start_params = np.append(np.zeros(self.k_inflate), start_params) return start_params class ZeroInflatedPoissonResults(CountResults):
64
64
164
11
52
AustinJAdams/statsmodels
statsmodels/discrete/count_model.py
Python
ZeroInflatedPoissonResults
ZeroInflatedPoissonResults
700
717
700
700
dd637e558388be9dbd1cfbb6cb68f61a6af5361c
bigcode/the-stack
train
9197490cceef8231e1307e18
train
class
class ZeroInflatedGeneralizedPoissonResults(CountResults): __doc__ = _discrete_results_docs % { "one_line_description": "A results class for Zero Inflated Generalized Poisson", "extra_attr": ""} @cache_readonly def _dispersion_factor(self): p = self.model.model_main.parameterization...
class ZeroInflatedGeneralizedPoissonResults(CountResults):
__doc__ = _discrete_results_docs % { "one_line_description": "A results class for Zero Inflated Generalized Poisson", "extra_attr": ""} @cache_readonly def _dispersion_factor(self): p = self.model.model_main.parameterization alpha = self.params[self.model.k_inflate:][-1] ...
ZeroInflatedPoissonResults) class L1ZeroInflatedPoissonResultsWrapper(lm.RegressionResultsWrapper): pass wrap.populate_wrapper(L1ZeroInflatedPoissonResultsWrapper, L1ZeroInflatedPoissonResults) class ZeroInflatedGeneralizedPoissonResults(CountResults):
64
64
194
13
51
AustinJAdams/statsmodels
statsmodels/discrete/count_model.py
Python
ZeroInflatedGeneralizedPoissonResults
ZeroInflatedGeneralizedPoissonResults
736
755
736
736
6128100b0932965df9866f8f646d3db28cf5b573
bigcode/the-stack
train
73fce4753b3465c5fb935712
train
class
class ZeroInflatedNegativeBinomialP(GenericZeroInflated): __doc__ = """ Zero Inflated Generalized Negative Binomial model for count data %(params)s %(extra_params)s Attributes ---------- endog : array A reference to the endogenous response variable exog : array A refere...
class ZeroInflatedNegativeBinomialP(GenericZeroInflated):
__doc__ = """ Zero Inflated Generalized Negative Binomial model for count data %(params)s %(extra_params)s Attributes ---------- endog : array A reference to the endogenous response variable exog : array A reference to the exogenous design. exog_infl: array ...
< 2: transform = True w = np.atleast_2d( self.model_infl.predict(params_infl, exog_infl))[:, None] else: transform = False w = self.model_infl.predict(params_infl, exog_infl)[:, None] w[w == 1.] = np.nextafter(1, 0) mu = self.mode...
237
237
793
13
223
AustinJAdams/statsmodels
statsmodels/discrete/count_model.py
Python
ZeroInflatedNegativeBinomialP
ZeroInflatedNegativeBinomialP
622
697
622
622
c19373c37ccabdf3212671d96c5001ab447b8389
bigcode/the-stack
train
34e321ddf7be41539a505540
train
function
def create_optimization_results(objective, dim_full=2): # create optimizer, pypesto problem and options options = { 'maxiter': 200 } optimizer = optimize.ScipyOptimizer(method='l-bfgs-b', options=options) lb = -2 * np.ones(dim_full) ub = 2 * np.ones(dim_full) problem = pypesto.Probl...
def create_optimization_results(objective, dim_full=2): # create optimizer, pypesto problem and options
options = { 'maxiter': 200 } optimizer = optimize.ScipyOptimizer(method='l-bfgs-b', options=options) lb = -2 * np.ones(dim_full) ub = 2 * np.ones(dim_full) problem = pypesto.Problem(objective, lb, ub) optimize_options = optimize.OptimizeOptions(allow_failed_starts=True) # run ...
.optimize_result.list[0]['x'][2:5]) profile.parameter_profile( problem=problem, result=result, optimizer=optimizer, next_guess_method='adaptive_step_regression') def create_optimization_results(objective, dim_full=2): # create optimizer, pypesto problem and options
64
64
168
25
39
beimbusch/pyPESTO
test/test_profile.py
Python
create_optimization_results
create_optimization_results
240
262
240
241
4a8aaa7700797e418dc01080d1a8ea49700d5931
bigcode/the-stack
train
ba3f3d3e0483d86b29542b81
train
function
def test_chi2_quantile_to_ratio(): """Tests the chi2 quantile to ratio convenience function.""" ratio = profile.chi2_quantile_to_ratio() assert np.isclose(ratio, 0.1465)
def test_chi2_quantile_to_ratio():
"""Tests the chi2 quantile to ratio convenience function.""" ratio = profile.chi2_quantile_to_ratio() assert np.isclose(ratio, 0.1465)
optimization result = optimize.minimize( problem=problem, optimizer=optimizer, n_starts=5, startpoint_method=pypesto.startpoint.uniform, options=optimize_options ) return problem, result, optimizer def test_chi2_quantile_to_ratio():
64
64
49
10
53
beimbusch/pyPESTO
test/test_profile.py
Python
test_chi2_quantile_to_ratio
test_chi2_quantile_to_ratio
265
268
265
265
9f1e5c927bf776c044defea18cd3db2ffbbdf708
bigcode/the-stack
train
bbe79d4b2a0d3221e13761b3
train
function
def test_approximate_ci(): xs = np.array([-3, -1, 1, 3, 5, 7, 9]) ratios = np.array([0.2, 0.3, 1, 0.27, 0.15, 0.15, 0.1]) lb, ub = profile.calculate_approximate_ci( xs=xs, ratios=ratios, confidence_ratio=0.27) # correct interpolation assert np.isclose(lb, -3 + (-1 - (-3)) * 0.7) # ex...
def test_approximate_ci():
xs = np.array([-3, -1, 1, 3, 5, 7, 9]) ratios = np.array([0.2, 0.3, 1, 0.27, 0.15, 0.15, 0.1]) lb, ub = profile.calculate_approximate_ci( xs=xs, ratios=ratios, confidence_ratio=0.27) # correct interpolation assert np.isclose(lb, -3 + (-1 - (-3)) * 0.7) # exact pick assert np.iscl...
options=optimize_options ) return problem, result, optimizer def test_chi2_quantile_to_ratio(): """Tests the chi2 quantile to ratio convenience function.""" ratio = profile.chi2_quantile_to_ratio() assert np.isclose(ratio, 0.1465) def test_approximate_ci():
72
72
243
7
65
beimbusch/pyPESTO
test/test_profile.py
Python
test_approximate_ci
test_approximate_ci
271
296
271
271
4d2030014c52975f6f5df0349d6d37fce5c0f8aa
bigcode/the-stack
train
33e07f4d596d51e43233afba
train
class
class ProfilerTest(unittest.TestCase): @classmethod def setUp(cls): cls.objective: ObjectiveBase = test_objective.rosen_for_sensi( max_sensi_order=2, integrated=True )['obj'] with warnings.catch_warnings(): warnings.simplefilter("ignore") (cls.proble...
class ProfilerTest(unittest.TestCase): @classmethod
def setUp(cls): cls.objective: ObjectiveBase = test_objective.rosen_for_sensi( max_sensi_order=2, integrated=True )['obj'] with warnings.catch_warnings(): warnings.simplefilter("ignore") (cls.problem, cls.result, cls.optimizer) = \ create_...
""" This is for testing profiling of the pypesto.Objective. """ import numpy as np import unittest import test.test_objective as test_objective from copy import deepcopy import warnings import pypesto import pypesto.optimize as optimize import pypesto.profile as profile import pypesto.visualize as visualize from pype...
99
256
1,290
12
86
beimbusch/pyPESTO
test/test_profile.py
Python
ProfilerTest
ProfilerTest
19
173
19
21
d22ecf2c79ebe2654fde9df07e61664ee7c20a57
bigcode/the-stack
train
d8ec6aa7683f4c3653bc6b0c
train
function
@close_fig def test_profile_with_fixed_parameters(): """Test using profiles with fixed parameters.""" obj = test_objective.rosen_for_sensi(max_sensi_order=1)['obj'] lb = -2 * np.ones(5) ub = 2 * np.ones(5) problem = pypesto.Problem( objective=obj, lb=lb, ub=ub, x_fixed_vals=[0.5, -1...
@close_fig def test_profile_with_fixed_parameters():
"""Test using profiles with fixed parameters.""" obj = test_objective.rosen_for_sensi(max_sensi_order=1)['obj'] lb = -2 * np.ones(5) ub = 2 * np.ones(5) problem = pypesto.Problem( objective=obj, lb=lb, ub=ub, x_fixed_vals=[0.5, -1.8], x_fixed_indices=[0, 3]) optimizer = optimiz...
.list[0].x[0], result.optimize_result.list[0].x[3]]) problem.objective.history = pypesto.MemoryHistory({'trace_record': True}) profile.parameter_profile( problem=problem, result=result, optimizer=optimizer, profile_index=np.array([0, 2, 4]), ...
96
96
320
11
85
beimbusch/pyPESTO
test/test_profile.py
Python
test_profile_with_fixed_parameters
test_profile_with_fixed_parameters
204
237
204
205
71f00e7a4a731d2aa68decc4835545f952c0a994
bigcode/the-stack
train
0660d3a164e1164b85f58178
train
function
def test_profile_with_history(): objective = test_objective.rosen_for_sensi(max_sensi_order=2, integrated=False)['obj'] with warnings.catch_warnings(): warnings.simplefilter("ignore") (problem, result, optimizer) = \ create_optimization...
def test_profile_with_history():
objective = test_objective.rosen_for_sensi(max_sensi_order=2, integrated=False)['obj'] with warnings.catch_warnings(): warnings.simplefilter("ignore") (problem, result, optimizer) = \ create_optimization_results(objective, dim_full=5) ...
hess = np.array([[2, 0], [0, 1]]) profile.approximate_parameter_profile( problem=self.problem, result=result, profile_index=[1], n_steps=n_steps) # dont make this a class method such that we dont optimize twice def test_profile_with_history():
64
64
209
6
57
beimbusch/pyPESTO
test/test_profile.py
Python
test_profile_with_history
test_profile_with_history
177
201
177
177
caf2a8293d12543eb7aa2558f4fefdd6b04a0229
bigcode/the-stack
train
0a85a56d0124ac374c5da3ea
train
class
class UpdateUserBlocked(Object): """Attributes: ID: ``0x80ece81a`` Args: user_id: ``int`` ``32-bit`` blocked: ``bool`` """ ID = 0x80ece81a def __init__(self, user_id: int, blocked: bool): self.user_id = user_id # int self.blocked = blocked # Bool @st...
class UpdateUserBlocked(Object):
"""Attributes: ID: ``0x80ece81a`` Args: user_id: ``int`` ``32-bit`` blocked: ``bool`` """ ID = 0x80ece81a def __init__(self, user_id: int, blocked: bool): self.user_id = user_id # int self.blocked = blocked # Bool @staticmethod def read(b: BytesI...
# GNU Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with Pyrogram. If not, see <http://www.gnu.org/licenses/>. from io import BytesIO from pyrogram.api.core import * class UpdateUserBlocked(Object):
64
64
200
6
58
block1o1/CryptoPredicted
ENV/lib/python3.5/site-packages/pyrogram/api/types/update_user_blocked.py
Python
UpdateUserBlocked
UpdateUserBlocked
24
59
24
24
a0f532340055577d76db3532b356c8bde4c9be0c
bigcode/the-stack
train
26ddc963a821f2dc88577a9f
train
class
class SyntaxModeHandler(EditraXml): """Main Xml interface to extending filetype handling support""" def __init__(self, path=None): EditraXml.__init__(self, path) # Attributes self._start = False self._version = 0 self.syntax = Syntax() # Setup self.SetNa...
class SyntaxModeHandler(EditraXml):
"""Main Xml interface to extending filetype handling support""" def __init__(self, path=None): EditraXml.__init__(self, path) # Attributes self._start = False self._version = 0 self.syntax = Syntax() # Setup self.SetName(EXML_START) self.SetInden...
the registered handler until its end tag is encountered. @param handler: EditraXml instance """ tag = handler.GetName() assert tag not in self._reg_handler, "%s already registered!" % tag handler.SetLevel(self.Level + 1) self._reg_handler[tag] = handler def...
219
219
731
8
211
ekkipermana/robotframework-test
Lib/site-packages/wx-2.8-msw-unicode/wx/tools/Editra/src/syntax/synxml.py
Python
SyntaxModeHandler
SyntaxModeHandler
333
466
333
333
0e41d67d356db3ebb3657f4e5da43d6de1bc13eb
bigcode/the-stack
train
8169fedc27fd0f39d6b22253
train
class
class FeatureList(EditraXml): """Container for all other misc syntax features. Currently Available Features: - AutoIndent - StyleText """ def __init__(self): EditraXml.__init__(self) # Attributes self._features = dict() # Setup self.SetName(EXML_FEA...
class FeatureList(EditraXml):
"""Container for all other misc syntax features. Currently Available Features: - AutoIndent - StyleText """ def __init__(self): EditraXml.__init__(self) # Attributes self._features = dict() # Setup self.SetName(EXML_FEATURELIST) def startElemen...
") ident = self.GetIndentationStr() + (self.Indentation * u" ") for prop in self.properties: xml += os.linesep + ident xml += (tag % prop) return xml #---- External Api ----# def GetProperties(self): """Get the list of properties @return: list of...
101
101
337
7
94
ekkipermana/robotframework-test
Lib/site-packages/wx-2.8-msw-unicode/wx/tools/Editra/src/syntax/synxml.py
Python
FeatureList
FeatureList
762
810
762
762
db919431ffe67d8dd36b1ef8bd369935a70605ef
bigcode/the-stack
train
e775c7afb18a089f2b4b5439
train
class
class SyntaxSpecList(EditraXml): """Container element for holding the syntax specification elements""" def __init__(self): EditraXml.__init__(self) # Attributes self._specs = list() # Setup self.SetName(EXML_SYNSPECLIST) def startElement(self, name, attrs): ...
class SyntaxSpecList(EditraXml):
"""Container element for holding the syntax specification elements""" def __init__(self): EditraXml.__init__(self) # Attributes self._specs = list() # Setup self.SetName(EXML_SYNSPECLIST) def startElement(self, name, attrs): """Parse all syntaxspec elements...
list of tuples [(kw_idx, [word1, word2,])] """ keys = sorted(self._keywords.keys()) keywords = [ (idx, self._keywords[idx]) for idx in keys ] keywords.sort(key=lambda x: x[0]) return keywords def GetKeywordList(self, idx): """Get the list of keywords associated wit...
112
112
374
8
104
ekkipermana/robotframework-test
Lib/site-packages/wx-2.8-msw-unicode/wx/tools/Editra/src/syntax/synxml.py
Python
SyntaxSpecList
SyntaxSpecList
670
717
670
670
56d800c1dc97e01536da0dd608249544b8f0d26b
bigcode/the-stack
train
2037c2bece1a6a8ae6ffaca0
train
class
class PropertyList(EditraXml): """Container class for the syntax properties""" def __init__(self): EditraXml.__init__(self) # Attributes self.properties = list() # Setup self.SetName(EXML_PROPERTYLIST) def startElement(self, name, attrs): if name == EXML_PR...
class PropertyList(EditraXml):
"""Container class for the syntax properties""" def __init__(self): EditraXml.__init__(self) # Attributes self.properties = list() # Setup self.SetName(EXML_PROPERTYLIST) def startElement(self, name, attrs): if name == EXML_PROPERTY: prop = attr...
+= os.linesep + ident xml += (tag % spec) return xml #---- External Api ----# def GetStyleSpecs(self): """Get the list of keyword strings @return: list of tuples [(style_id, "style_tag"),] """ return self._specs #----------------------------------...
77
77
258
7
70
ekkipermana/robotframework-test
Lib/site-packages/wx-2.8-msw-unicode/wx/tools/Editra/src/syntax/synxml.py
Python
PropertyList
PropertyList
721
758
721
721
6ae09249b7994f7576b553b494cc039ac5d66138
bigcode/the-stack
train
615274354ba7671648dd99ca
train
class
class EditraXml(sax.ContentHandler): """Base class for all Editra syntax xml objects""" def __init__(self, path=None): sax.ContentHandler.__init__(self) # Attributes self.name = u'' # Tag name self.level = 0 # Set the level of the element self....
class EditraXml(sax.ContentHandler):
"""Base class for all Editra syntax xml objects""" def __init__(self, path=None): sax.ContentHandler.__init__(self) # Attributes self.name = u'' # Tag name self.level = 0 # Set the level of the element self.indent = 3 # Indentation...
.stc as stc except ImportError: pass #----------------------------------------------------------------------------# # Tag Definitions EXML_START = u"editra" EXML_SYNTAX = u"syntax" EXML_KEYWORDLIST = u"keywordlist" EXML_KEYWORDS = u"keywords" EXML_SYNSPECLIST = u"syntaxspeclist" EXML_SYNTAXSPEC ...
256
256
1,297
9
247
ekkipermana/robotframework-test
Lib/site-packages/wx-2.8-msw-unicode/wx/tools/Editra/src/syntax/synxml.py
Python
EditraXml
EditraXml
98
329
98
98
d823cc37323fb072e7adcc2ae6cf4e43996c8133
bigcode/the-stack
train
256cea293a119ee9d921cf17
train
class
class Syntax(EditraXml): """Syntax definition for initializing a Scintilla Lexer""" def __init__(self): EditraXml.__init__(self) # Attributes self.language = u"Plain Text" self.langid = u"ID_LANG_TXT" self.lexstr = u"STC_LEX_NULL" self.lexer = stc.STC_LEX_NULL ...
class Syntax(EditraXml):
"""Syntax definition for initializing a Scintilla Lexer""" def __init__(self): EditraXml.__init__(self) # Attributes self.language = u"Plain Text" self.langid = u"ID_LANG_TXT" self.lexstr = u"STC_LEX_NULL" self.lexer = stc.STC_LEX_NULL self.file_ext = lis...
(self, fet): """Get the callable associated with the given feature @param fet: string @return: string """ fetxml = self.syntax.GetFeatureXml() return fetxml.GetFeature(fet) def GetSyntaxSpec(self): """Get the syntax spec @return: list of tuples [(sty...
256
256
929
6
250
ekkipermana/robotframework-test
Lib/site-packages/wx-2.8-msw-unicode/wx/tools/Editra/src/syntax/synxml.py
Python
Syntax
Syntax
470
595
470
470
25c6bc53b98a03fef69d8b8eee4ca0a0ef100df4
bigcode/the-stack
train
5ed84e9f5b6e87d73c9988d5
train
function
def LoadHandler(path): """Load and initialize a SyntaxModeHandler from an on disk xml config file @param path: path to an EditraXml file to load a handler from @return: SyntaxModeHandler instance """ synmode = SyntaxModeHandler(path) synmode.LoadFromDisk() return synmode
def LoadHandler(path):
"""Load and initialize a SyntaxModeHandler from an on disk xml config file @param path: path to an EditraXml file to load a handler from @return: SyntaxModeHandler instance """ synmode = SyntaxModeHandler(path) synmode.LoadFromDisk() return synmode
fet): """Get the callable feature by name @param fet: string (module name) """ feature = None src = self._features.get(fet, None) if src is not None: feature = src return feature #---------------------------------------------------------------------...
64
64
72
5
59
ekkipermana/robotframework-test
Lib/site-packages/wx-2.8-msw-unicode/wx/tools/Editra/src/syntax/synxml.py
Python
LoadHandler
LoadHandler
814
822
814
814
f77bd93bfb1ccff0b308b229d808844a95f52ebe
bigcode/the-stack
train
3f373b78bbe2ca83fb0d7daf
train
class
class KeywordList(EditraXml): """Container object for all keyword sets""" def __init__(self): EditraXml.__init__(self) # Attributes self._current = None self._keywords = dict() # { index : word_list } # Setup self.SetName(EXML_KEYWORDLIST) def startElement(...
class KeywordList(EditraXml):
"""Container object for all keyword sets""" def __init__(self): EditraXml.__init__(self) # Attributes self._current = None self._keywords = dict() # { index : word_list } # Setup self.SetName(EXML_KEYWORDLIST) def startElement(self, name, attrs): if...
object""" return self.keywords def GetLanguage(self): """Get the language description/name @return: string """ return self.language def GetLangId(self): """Get the language id @return: string """ return self.langid def GetLexer(se...
154
154
516
7
147
ekkipermana/robotframework-test
Lib/site-packages/wx-2.8-msw-unicode/wx/tools/Editra/src/syntax/synxml.py
Python
KeywordList
KeywordList
599
666
599
599
a8fa5f020b6a6ac9a8a355be0f7ea4982327c680
bigcode/the-stack
train
a33d83806c9049648bd31b75
train
function
def download(src, id): """下载图片""" dir = './' + str(id) + '.jpg' save = False try: pic = requests.get(src, timeout=10) save = True except requests.exceptions.ConnectionError: print('图片无法下载') if save: fp = open(dir, 'wb') fp.write(pic.content) fp.clo...
def download(src, id):
"""下载图片""" dir = './' + str(id) + '.jpg' save = False try: pic = requests.get(src, timeout=10) save = True except requests.exceptions.ConnectionError: print('图片无法下载') if save: fp = open(dir, 'wb') fp.write(pic.content) fp.close()
= { 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36'} def download(src, id):
63
64
85
6
57
justdoitgk/Data-analysis-in-action
10-Python爬虫:如何自动化下载豆瓣明星海报/douban_pic_download.py
Python
download
download
10
22
10
10
56c8fd67a063d684b0229ed25613b875fa642412
bigcode/the-stack
train
70384a3e93b0514bc97cf6f4
train
function
@Client.on_message(filters.command(["start", "start@GroupMusicPlayBot"]) & ~filters.private & ~filters.channel) async def gstart(_, message: Message): await message.reply_text( text="**Music Bot Is Online ✅**", reply_markup=InlineKeyboardMarkup( [[ InlineKeybo...
@Client.on_message(filters.command(["start", "start@GroupMusicPlayBot"]) & ~filters.private & ~filters.channel) async def gstart(_, message: Message):
await message.reply_text( text="**Music Bot Is Online ✅**", reply_markup=InlineKeyboardMarkup( [[ InlineKeyboardButton(text="🎙️ Support Group 🎙️", url="https://t.me/MusicBotSupports") ]] ) )
data == "close": await query.message.delete() try: await query.message.reply_to_message.delete() except: pass @Client.on_message(filters.command(["start", "start@GroupMusicPlayBot"]) & ~filters.private & ~filters.channel) async def gstart(_, message: Message):
64
64
96
35
28
ajmalyaseen/torrentDL
plugins/commands/start.py
Python
gstart
gstart
48
57
48
49
3943efec88a0cccc9dc3a625edfdd626f39713d1
bigcode/the-stack
train
71854046b89473e1df292fed
train
function
@Client.on_message(filters.command(["help", "start@GroupMusicPlayBot"]) & filters.private & ~filters.channel) async def help(_, message: Message): await message.reply_text( text="""<b><u>help</u></b> 💡 𝘚𝘦𝘯𝘥 𝘮𝘦 𝘢𝘯𝘺 𝘮𝘰𝘷𝘪𝘦 𝘯𝘢𝘮𝘦 𝘰𝘳 𝘴𝘦𝘳𝘪𝘦𝘴 (𝘱𝘭𝘦𝘢𝘴𝘦 𝘵𝘺𝘱𝘦 𝘤𝘰𝘳𝘳𝘦𝘤𝘵 𝘴�...
@Client.on_message(filters.command(["help", "start@GroupMusicPlayBot"]) & filters.private & ~filters.channel) async def help(_, message: Message):
await message.reply_text( text="""<b><u>help</u></b> 💡 𝘚𝘦𝘯𝘥 𝘮𝘦 𝘢𝘯𝘺 𝘮𝘰𝘷𝘪𝘦 𝘯𝘢𝘮𝘦 𝘰𝘳 𝘴𝘦𝘳𝘪𝘦𝘴 (𝘱𝘭𝘦𝘢𝘴𝘦 𝘵𝘺𝘱𝘦 𝘤𝘰𝘳𝘳𝘦𝘤𝘵 𝘴𝘱𝘦𝘭𝘭𝘪𝘯𝘨) <b>@CoderzHex</b> """, reply_markup=InlineKeyboardMarkup( [[ InlineKeyboardButton(text="📫...
**Music Bot Is Online ✅**", reply_markup=InlineKeyboardMarkup( [[ InlineKeyboardButton(text="🎙️ Support Group 🎙️", url="https://t.me/MusicBotSupports") ]] ) ) @Client.on_message(filters.command(["help", "start@GroupMusicPlayBot"]) & filters.pri...
85
86
287
33
52
ajmalyaseen/torrentDL
plugins/commands/start.py
Python
help
help
60
75
60
61
cdec21edf9fd86685edab91d900b0d6374f8f2f9
bigcode/the-stack
train
60bccb9a4fad4ec4b6f75cd8
train
function
@Client.on_message(filters.command(["start", "start@GroupMusicPlayBot"]) & filters.private & ~filters.channel) async def start(_, message: Message): await message.reply_text( text="Hello 👋🏻 {}!\n\n𝐈 𝐚𝐦 𝐬𝐢𝐦𝐩𝐥𝐞 𝐲𝐞𝐭 𝐩𝐨𝐰𝐞𝐫𝐟𝐮𝐥 𝐛𝐨𝐭 𝐓𝐨 𝐅𝐢𝐧𝐝 𝐦𝐚𝐠𝐧𝐞𝐭 𝐥𝐢𝐧𝐤𝐬 𝐅𝐫𝐨𝐦 𝐌𝐮𝐥�...
@Client.on_message(filters.command(["start", "start@GroupMusicPlayBot"]) & filters.private & ~filters.channel) async def start(_, message: Message):
await message.reply_text( text="Hello 👋🏻 {}!\n\n𝐈 𝐚𝐦 𝐬𝐢𝐦𝐩𝐥𝐞 𝐲𝐞𝐭 𝐩𝐨𝐰𝐞𝐫𝐟𝐮𝐥 𝐛𝐨𝐭 𝐓𝐨 𝐅𝐢𝐧𝐝 𝐦𝐚𝐠𝐧𝐞𝐭 𝐥𝐢𝐧𝐤𝐬 𝐅𝐫𝐨𝐦 𝐌𝐮𝐥𝐭𝐢𝐩𝐥𝐞 𝐓𝐨𝐫𝐫𝐞𝐧𝐭 𝐒𝐢𝐭𝐞𝐬.\n\n𝘊𝘭𝘪𝘤𝘬 /help 𝘍𝘰𝘳 𝘔𝘰𝘳𝘦 𝘏𝘦𝘭𝘱 𝘖𝘯 𝘔𝘺 𝘜𝘴𝘢𝘨𝘦 ❤".format(message.from_user.mention), r...
from pyrogram import Client, filters from pyrogram.types import Message, InlineKeyboardMarkup, InlineKeyboardButton, CallbackQuery @Client.on_message(filters.command(["start", "start@GroupMusicPlayBot"]) & filters.private & ~filters.channel) async def start(_, message: Message):
59
117
390
33
25
ajmalyaseen/torrentDL
plugins/commands/start.py
Python
start
start
7
21
7
8
925429de5d92c8e5355e7c76d011f4799dd6eff8
bigcode/the-stack
train
c01c7f27842abe293b470fcd
train
function
@Client.on_callback_query() async def cb_handler(client, query): data = query.data if data == "about": await query.message.edit_text( text = f"<b><u>About Me</u></b>\n\n• 𝐍𝐚𝐦𝐞 : ᴛᴏʀʀᴇɴᴛ ꜱᴇᴀʀᴄʜᴇʀ \n\n• 𝐋𝐚𝐧𝐠𝐮𝐚𝐠𝐞 : ᴘᴀʏᴛᴏɴ \n\n• 𝐋𝐢𝐛𝐫𝐚𝐫𝐲 : ᴘʏʀᴏɢʀᴀᴍ \n\n• 𝐒𝐞𝐫𝐯𝐞𝐫 : ʜᴇ...
@Client.on_callback_query() async def cb_handler(client, query):
data = query.data if data == "about": await query.message.edit_text( text = f"<b><u>About Me</u></b>\n\n• 𝐍𝐚𝐦𝐞 : ᴛᴏʀʀᴇɴᴛ ꜱᴇᴀʀᴄʜᴇʀ \n\n• 𝐋𝐚𝐧𝐠𝐮𝐚𝐠𝐞 : ᴘᴀʏᴛᴏɴ \n\n• 𝐋𝐢𝐛𝐫𝐚𝐫𝐲 : ᴘʏʀᴏɢʀᴀᴍ \n\n• 𝐒𝐞𝐫𝐯𝐞𝐫 : ʜᴇʀᴏᴋᴜ \n\n• 𝐒𝐭𝐚𝐭𝐮𝐬 : V 1.0 \n\n• 𝐂𝐫𝐞𝐚𝐭𝐨𝐫 : <b><a href=...
�𝘨𝘦 ❤".format(message.from_user.mention), reply_markup=InlineKeyboardMarkup( [[ InlineKeyboardButton("📫UPDATES", url="https://t.me/CoderzHEX"), InlineKeyboardButton("🕵‍♂CREATOR", url="https://t.me/DIAGO_X") ],[ InlineKeyboardButton("📕ABOUT",...
134
135
451
14
120
ajmalyaseen/torrentDL
plugins/commands/start.py
Python
cb_handler
cb_handler
25
45
25
26
b47bcd44f324d09bf5e4c099eee61ac4561358d3
bigcode/the-stack
train
2d5a88302062ecd2ec491dd5
train
class
class clock_foreign_masters(PybindBase): """ This class was auto-generated by the PythonClass plugin for PYANG from YANG module brocade-ptp-operational - based on the path /ptp-state/clock-foreign-masters. Each member element of the container is represented as a class variable - with a specific YANG type. ...
class clock_foreign_masters(PybindBase):
""" This class was auto-generated by the PythonClass plugin for PYANG from YANG module brocade-ptp-operational - based on the path /ptp-state/clock-foreign-masters. Each member element of the container is represented as a class variable - with a specific YANG type. YANG Description: """ __slots__ = ('...
from operator import attrgetter import pyangbind.lib.xpathhelper as xpathhelper from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType, RestrictedClassType, TypedListType from pyangbind.lib.yangtypes import YANGBool, YANGListType, YANGDynClass, ReferenceType from pyangbind.lib.base import PybindBase from d...
107
256
1,845
10
96
extremenetworks/pybind
pybind/slxos/v17s_1_02/ptp_state/clock_foreign_masters/__init__.py
Python
clock_foreign_masters
clock_foreign_masters
11
123
11
11
09445f12f02860dc9feda0a6c2df6fd664da98ba
bigcode/the-stack
train
e8da225427c1b7958a487255
train
function
def read_corpus(filename): delchars = [chr(c) for c in range(256)] delchars = [x for x in delchars if not x.isalnum()] delchars.remove(' ') delchars = ''.join(delchars) with open(filename, 'r') as datafile: for line in datafile: yield line.lower().translate(None, delchars).spli...
def read_corpus(filename):
delchars = [chr(c) for c in range(256)] delchars = [x for x in delchars if not x.isalnum()] delchars.remove(' ') delchars = ''.join(delchars) with open(filename, 'r') as datafile: for line in datafile: yield line.lower().translate(None, delchars).split(' ')
from __future__ import print_function import argparse import pprint import gensim from glove import Glove from glove import Corpus def read_corpus(filename):
35
64
87
6
28
gaborod16/glove-python
examples/example.py
Python
read_corpus
read_corpus
10
19
10
11
59ea802fe788a8477ee337ac316fc32ba47ea4d4
bigcode/the-stack
train
7226205ba3865df0eb2465b6
train
function
def read_wikipedia_corpus(filename): # We don't want to do a dictionary construction pass. corpus = gensim.corpora.WikiCorpus(filename, dictionary={}) for text in corpus.get_texts(): yield text
def read_wikipedia_corpus(filename): # We don't want to do a dictionary construction pass.
corpus = gensim.corpora.WikiCorpus(filename, dictionary={}) for text in corpus.get_texts(): yield text
') delchars = ''.join(delchars) with open(filename, 'r') as datafile: for line in datafile: yield line.lower().translate(None, delchars).split(' ') def read_wikipedia_corpus(filename): # We don't want to do a dictionary construction pass.
63
64
49
20
43
gaborod16/glove-python
examples/example.py
Python
read_wikipedia_corpus
read_wikipedia_corpus
22
28
22
24
cf6b2100f1243d8adf3a782cf24feebe8d3504e2
bigcode/the-stack
train
e96c373890b81cb821fdf0ee
train
function
def format_join_string(user, compact=False): uname = user.uname if compact: output = f"/join {user.steam_id} ({uname})" else: body, uname = f"/join {user.steam_id}", f" {uname} " output = f"{uname:-^{len(body)}}\n{body}" return output
def format_join_string(user, compact=False):
uname = user.uname if compact: output = f"/join {user.steam_id} ({uname})" else: body, uname = f"/join {user.steam_id}", f" {uname} " output = f"{uname:-^{len(body)}}\n{body}" return output
(__name__) async def log_and_send(channel, message): try: await channel.send(message) except Exception as e: logger.error(f'unable to send message {message!r}', exc_info=e) else: logger.info(repr(message)) def format_join_string(user, compact=False):
64
64
79
9
55
jim-hart/steam-id-discord-bot
steam_id_discord_bot/join_code.py
Python
format_join_string
format_join_string
18
25
18
18
059c37599b4a8b44daccc3b0edb7ecf161ffd714
bigcode/the-stack
train
1111a89c084f0e455b50aa63
train
class
class JoinCode(commands.Cog): def __init__(self, bot): self.bot = bot @commands.Cog.listener() async def on_ready(self): logger.info(f'logged in as {self.bot.user!r}') @commands.Cog.listener() async def on_message(self, message): if message.author == self.bot.user: ...
class JoinCode(commands.Cog):
def __init__(self, bot): self.bot = bot @commands.Cog.listener() async def on_ready(self): logger.info(f'logged in as {self.bot.user!r}') @commands.Cog.listener() async def on_message(self, message): if message.author == self.bot.user: return if message...
__) async def log_and_send(channel, message): try: await channel.send(message) except Exception as e: logger.error(f'unable to send message {message!r}', exc_info=e) else: logger.info(repr(message)) def format_join_string(user, compact=False): uname = user.uname if compac...
139
139
466
7
131
jim-hart/steam-id-discord-bot
steam_id_discord_bot/join_code.py
Python
JoinCode
JoinCode
28
84
28
29
9aee780a6958fb551e192241b49e8aebb5c7e3d6
bigcode/the-stack
train
e7383069da58c17b23e6a7bb
train
function
async def log_and_send(channel, message): try: await channel.send(message) except Exception as e: logger.error(f'unable to send message {message!r}', exc_info=e) else: logger.info(repr(message))
async def log_and_send(channel, message):
try: await channel.send(message) except Exception as e: logger.error(f'unable to send message {message!r}', exc_info=e) else: logger.info(repr(message))
from discord.ext import commands import log_conf from persistance import User logger = log_conf.get_logger(__name__) async def log_and_send(channel, message):
34
64
52
9
25
jim-hart/steam-id-discord-bot
steam_id_discord_bot/join_code.py
Python
log_and_send
log_and_send
9
15
9
9
8f098870a46f4bef511b6f64922b3f3ffe1cb2fb
bigcode/the-stack
train
cc3c853df84d6c1e4b88957b
train
function
def execute_controller(command_queues, result_queues, parameters): for queue in command_queues: queue.put('run') result = [] for queue in result_queues: result.append(queue.get()) return result
def execute_controller(command_queues, result_queues, parameters):
for queue in command_queues: queue.put('run') result = [] for queue in result_queues: result.append(queue.get()) return result
def execute_controller(command_queues, result_queues, parameters):
13
64
49
13
0
hidekazu-higashi/asobann_app
tests/performance/say_hello.py
Python
execute_controller
execute_controller
1
8
1
1
96f3b2a950e34e3a3230907077e82ed402286355
bigcode/the-stack
train
58cbc186ff3dcbcec3c5102e
train
function
def execute_worker(name, command_queue, result_queue, parameters): command_queue.get() result_queue.put(f'Hello, container! from {name}')
def execute_worker(name, command_queue, result_queue, parameters):
command_queue.get() result_queue.put(f'Hello, container! from {name}')
def execute_controller(command_queues, result_queues, parameters): for queue in command_queues: queue.put('run') result = [] for queue in result_queues: result.append(queue.get()) return result def execute_worker(name, command_queue, result_queue, parameters):
62
64
32
13
48
hidekazu-higashi/asobann_app
tests/performance/say_hello.py
Python
execute_worker
execute_worker
11
13
11
11
857e88c68d5c2f2b38e3f01fc0f421d96e084839
bigcode/the-stack
train
795fbdc9d39e973bf40fd554
train
function
def part1(): data = open("data.in", "r") data_in = [] increased = 0 for line in data: data_in.append(int(line)) for i in range(len(data_in) - 1): if data_in[i] < data_in[i+1]: increased += 1 return increased
def part1():
data = open("data.in", "r") data_in = [] increased = 0 for line in data: data_in.append(int(line)) for i in range(len(data_in) - 1): if data_in[i] < data_in[i+1]: increased += 1 return increased
def part1():
4
64
76
4
0
theleteron/advent-of-code
2021/Day 1/solution.py
Python
part1
part1
1
14
1
1
a37a264007bdffb80168c729ff29590edeeb9c4d
bigcode/the-stack
train
ea86fa8bb711fdd6f75488f3
train
function
def part2(): data = open("data.in", "r") data_in = [] windows = [] increased = 0 for line in data: data_in.append(int(line)) for i in range(len(data_in)-3 + 1): windows.append(sum(data_in[i:i+3])) for i in range(len(windows)-1): if windows[i] < windows[i...
def part2():
data = open("data.in", "r") data_in = [] windows = [] increased = 0 for line in data: data_in.append(int(line)) for i in range(len(data_in)-3 + 1): windows.append(sum(data_in[i:i+3])) for i in range(len(windows)-1): if windows[i] < windows[i+1]: ...
data_in = [] increased = 0 for line in data: data_in.append(int(line)) for i in range(len(data_in) - 1): if data_in[i] < data_in[i+1]: increased += 1 return increased def part2():
64
64
102
4
59
theleteron/advent-of-code
2021/Day 1/solution.py
Python
part2
part2
16
33
16
16
3f3e0cba7d3a69e26292667b6492c924031fc580
bigcode/the-stack
train
f185e4584f1fcacf102bfd2b
train
class
class Targeting( AbstractObject, ): def __init__(self, api=None): super(Targeting, self).__init__() self._isTargeting = True self._api = api class Field(AbstractObject.Field): adgroup_id = 'adgroup_id' age_max = 'age_max' age_min = 'age_min' alternat...
class Targeting( AbstractObject, ):
def __init__(self, api=None): super(Targeting, self).__init__() self._isTargeting = True self._api = api class Field(AbstractObject.Field): adgroup_id = 'adgroup_id' age_max = 'age_max' age_min = 'age_min' alternate_auto_targeting_option = 'alternate_auto...
modify, and distribute this software in source code or binary # form for use in connection with the web services and APIs provided by # Facebook. # As with any software that integrates with the Facebook platform, your use # of this software is subject to the Facebook Developer Principles and # Policies [http://develo...
256
256
2,019
9
247
GDGSNF/facebook-python-business-sdk
facebook_business/adobjects/targeting.py
Python
Targeting
Targeting
31
235
31
34
b1ff1ac71c37df3dbfd86efe90b4d69830f1334b
bigcode/the-stack
train