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
3e47a09f95a85aaac0aba050
train
function
def main(): # Simple example of accessing the Riot Games API, # just replace the api_key=XXXXXXXXXXXXXXXXXXXXX with your API key # response = requests.get('https://REGION_HERE.api.riotgames.com/lol/summoner/v4/summoners/by-name/SUMMONER_NAME_HERE?api_key=YOUR_API_KEY_HERE') # Gets player(aka ...
def main(): # Simple example of accessing the Riot Games API, # just replace the api_key=XXXXXXXXXXXXXXXXXXXXX with your API key # response = requests.get('https://REGION_HERE.api.riotgames.com/lol/summoner/v4/summoners/by-name/SUMMONER_NAME_HERE?api_key=YOUR_API_KEY_HERE') # Gets player(aka ...
api = RiotAPI('your api key here') infinite = 0 while infinite == 0: print('STARTING') # Get 4 game IDs for 10 puuids from the same game to use for the episode # This will increase diversity of in game roles. # 4 QUERIES firstPlayerName = api.get_x_master...
from RiotAPI import RiotAPI from random import randrange import json import time def main(): # Simple example of accessing the Riot Games API, # just replace the api_key=XXXXXXXXXXXXXXXXXXXXX with your API key # response = requests.get('https://REGION_HERE.api.riotgames.com/lol/summoner/v4/summon...
111
256
1,236
92
18
BrydenTrakalo/Capstone-repo
ML-using-Riot-API/Main.py
Python
main
main
6
130
6
11
3ad0b305fc34f97d6500c1f9d0c8a37dffb36098
bigcode/the-stack
train
3529b007b17899f7ebcc42a3
train
function
def parallel_test(): url_num = len(urls) threads = [] for i in range(url_num): threads.append(MyThread(i, f"Thread-{i}", urls[i])) # Start new Threads for thread in threads: thread.start() for thread in threads: thread.join() for i in range(len(latencies)): p...
def parallel_test():
url_num = len(urls) threads = [] for i in range(url_num): threads.append(MyThread(i, f"Thread-{i}", urls[i])) # Start new Threads for thread in threads: thread.start() for thread in threads: thread.join() for i in range(len(latencies)): print(f"{latencies[i]}...
url): threading.Thread.__init__(self) self.thread_id = thread_id self.name = name self.url = url def run(self): print("Starting " + self.name) record_time(self.url) print("Exiting " + self.name) def parallel_test():
64
64
145
4
60
raaahulss/project_viralnews
webapp/tests/test_latency.py
Python
parallel_test
parallel_test
21
37
21
21
e55690e6cce65092883ac177cde938b908555153
bigcode/the-stack
train
c8aebb658bc8b6e74d7379f0
train
class
class MyThread (threading.Thread): def __init__(self, thread_id, name, url): threading.Thread.__init__(self) self.thread_id = thread_id self.name = name self.url = url def run(self): print("Starting " + self.name) record_time(self.url) print("Exiting " + ...
class MyThread (threading.Thread):
def __init__(self, thread_id, name, url): threading.Thread.__init__(self) self.thread_id = thread_id self.name = name self.url = url def run(self): print("Starting " + self.name) record_time(self.url) print("Exiting " + self.name)
import requests import threading import datetime import numpy as np import json class MyThread (threading.Thread):
25
64
80
8
16
raaahulss/project_viralnews
webapp/tests/test_latency.py
Python
MyThread
MyThread
8
18
8
8
7c7c8b95844fd105c503c8af61ef8a16fcd12efd
bigcode/the-stack
train
3f9b4663268d20538da2822b
train
function
def record_time(url): start_time = datetime.datetime.now() response = requests.post(f'http://localhost:5000/api/url?url={url}') end_time = datetime.datetime.now() delta_time = end_time - start_time latencies.append(delta_time.total_seconds()) responses.append(response.content)
def record_time(url):
start_time = datetime.datetime.now() response = requests.post(f'http://localhost:5000/api/url?url={url}') end_time = datetime.datetime.now() delta_time = end_time - start_time latencies.append(delta_time.total_seconds()) responses.append(response.content)
responses[i]}") print( f"Maximum {np.max(latencies)} s\nMinimum {np.min(latencies)} s\nMean {np.mean(latencies)} s\nMedian {np.median(latencies)} s\nStandard deviation {np.std(latencies)} s" ) def record_time(url):
64
64
66
5
59
raaahulss/project_viralnews
webapp/tests/test_latency.py
Python
record_time
record_time
40
46
40
40
5c8814db780c0c511549339620e9a0bfe82d3b56
bigcode/the-stack
train
34b445ff063daa1b1dd01526
train
function
def sequential_test(): for url in urls: record_time(url) for i in range(len(latencies)): print(f"{latencies[i]} s: {responses[i]}") print( f"Maximum {np.max(latencies)} s\nMinimum {np.min(latencies)} s\nMean {np.mean(latencies)} s\nMedian {np.median(latencies)} s\nStandard deviatio...
def sequential_test():
for url in urls: record_time(url) for i in range(len(latencies)): print(f"{latencies[i]} s: {responses[i]}") print( f"Maximum {np.max(latencies)} s\nMinimum {np.min(latencies)} s\nMean {np.mean(latencies)} s\nMedian {np.median(latencies)} s\nStandard deviation {np.std(latencies)} s...
start_time = datetime.datetime.now() response = requests.post(f'http://localhost:5000/api/url?url={url}') end_time = datetime.datetime.now() delta_time = end_time - start_time latencies.append(delta_time.total_seconds()) responses.append(response.content) def sequential_test():
64
64
94
4
60
raaahulss/project_viralnews
webapp/tests/test_latency.py
Python
sequential_test
sequential_test
49
58
49
49
16502f423ed80944004070254b78a51cf97f9e56
bigcode/the-stack
train
77bce2dce1cd18333af39574
train
function
def main(): jrpc_urls = [ '/pm/config/adom/{adom}/obj/wireless-controller/vap', '/pm/config/global/obj/wireless-controller/vap' ] perobject_jrpc_urls = [ '/pm/config/adom/{adom}/obj/wireless-controller/vap/{vap}', '/pm/config/global/obj/wireless-controller/vap/{vap}' ] ...
def main():
jrpc_urls = [ '/pm/config/adom/{adom}/obj/wireless-controller/vap', '/pm/config/global/obj/wireless-controller/vap' ] perobject_jrpc_urls = [ '/pm/config/adom/{adom}/obj/wireless-controller/vap/{vap}', '/pm/config/global/obj/wireless-controller/vap/{vap}' ] url_para...
phen, colon, ...]> mbo: <value in [disable, enable]> mbo-cell-data-conn-pref: <value in [excluded, prefer-not, prefer-use]> nac: <value in [disable, enable]> nac-profile: <value of string> neighbor-report-dual-band: <value in [disable, enable]> ''' RETURN = ...
256
256
39,065
3
252
usegalaxy-no/usegalaxy
venv/lib/python3.6/site-packages/ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_vap.py
Python
main
main
2,885
8,406
2,885
2,885
c555f31a99cfdaddfd32ca94a86c06e42732e122
bigcode/the-stack
train
f212bcf1f2e717c7117f8885
train
function
def import_dm_annotations(dm_dataset, task_data): shapes = { datumaro.AnnotationType.bbox: ShapeType.RECTANGLE, datumaro.AnnotationType.polygon: ShapeType.POLYGON, datumaro.AnnotationType.polyline: ShapeType.POLYLINE, datumaro.AnnotationType.points: ShapeType.POINTS, } label...
def import_dm_annotations(dm_dataset, task_data):
shapes = { datumaro.AnnotationType.bbox: ShapeType.RECTANGLE, datumaro.AnnotationType.polygon: ShapeType.POLYGON, datumaro.AnnotationType.polyline: ShapeType.POLYLINE, datumaro.AnnotationType.points: ShapeType.POINTS, } label_cat = dm_dataset.categories()[datumaro.Annotation...
frame_number is None and item.has_image: try: frame_number = task_data.match_frame(item.image.filename) except Exception: pass if frame_number is None: try: frame_number = int(item.id) except Exception: pass if frame_number is None...
135
135
451
10
124
AzaelCicero/cvat
cvat/apps/dataset_manager/bindings.py
Python
import_dm_annotations
import_dm_annotations
559
608
559
559
643e272b33ae74527fd75538f8437e9968a3ea4e
bigcode/the-stack
train
93d490164c0c8043660e8454
train
function
def match_frame(item, task_data): is_video = task_data.meta['task']['mode'] == 'interpolation' frame_number = None if frame_number is None: try: frame_number = task_data.match_frame(item.id) except Exception: pass if frame_number is None and item.has_image: ...
def match_frame(item, task_data):
is_video = task_data.meta['task']['mode'] == 'interpolation' frame_number = None if frame_number is None: try: frame_number = task_data.match_frame(item.id) except Exception: pass if frame_number is None and item.has_image: try: frame_number =...
) elif shape_obj.type == ShapeType.CUBOID: continue # Datumaro does not support cuboids else: raise Exception("Unknown shape type '%s'" % shape_obj.type) item_anno.append(anno) return item_anno def match_frame(item, task_data):
64
64
186
8
55
AzaelCicero/cvat
cvat/apps/dataset_manager/bindings.py
Python
match_frame
match_frame
533
557
533
533
87d0a70d4e8b694f3fe0669ab67f3f5a900489d8
bigcode/the-stack
train
e6211ee2c14dadb1c449c360
train
class
class CvatTaskDataExtractor(datumaro.SourceExtractor): def __init__(self, task_data, include_images=False): super().__init__() self._categories = self._load_categories(task_data) dm_items = [] if include_images: frame_provider = FrameProvider(task_data.db_task.data) ...
class CvatTaskDataExtractor(datumaro.SourceExtractor):
def __init__(self, task_data, include_images=False): super().__init__() self._categories = self._load_categories(task_data) dm_items = [] if include_images: frame_provider = FrameProvider(task_data.db_task.data) for frame_data in task_data.group_by_frame(includ...
imported_track = self._import_track(track) if imported_track['label_id']: self._annotation_ir.add_track(imported_track) self._call_callback() @property def data(self): return self._annotation_ir def _len(self): track_len = 0 for track in self._annot...
256
256
1,074
12
244
AzaelCicero/cvat
cvat/apps/dataset_manager/bindings.py
Python
CvatTaskDataExtractor
CvatTaskDataExtractor
406
531
406
406
5f0c5fc90f95868947db01e64db33ffd67c019d4
bigcode/the-stack
train
5c1608f39a01f2ac32d5060e
train
class
class TaskData: Attribute = namedtuple('Attribute', 'name, value') LabeledShape = namedtuple( 'LabeledShape', 'type, frame, label, points, occluded, attributes, group, z_order') LabeledShape.__new__.__defaults__ = (0, 0) TrackedShape = namedtuple( 'TrackedShape', 'type, frame, points, oc...
class TaskData:
Attribute = namedtuple('Attribute', 'name, value') LabeledShape = namedtuple( 'LabeledShape', 'type, frame, label, points, occluded, attributes, group, z_order') LabeledShape.__new__.__defaults__ = (0, 0) TrackedShape = namedtuple( 'TrackedShape', 'type, frame, points, occluded, outside,...
# Copyright (C) 2019-2020 Intel Corporation # # SPDX-License-Identifier: MIT import os.path as osp from collections import OrderedDict, namedtuple from django.utils import timezone import datumaro.components.extractor as datumaro from cvat.apps.engine.frame_provider import FrameProvider from cvat.apps.engine.models...
100
256
3,274
4
95
AzaelCicero/cvat
cvat/apps/dataset_manager/bindings.py
Python
TaskData
TaskData
19
404
19
19
5e21be3f024e093eb34c6d5f387c5fd87c8ded67
bigcode/the-stack
train
42bfb39592966a9183880e43
train
function
def update(cursor, filename): loadCentroids = imp.load_source('loadCentroids', filename + os.sep + 'loadCentroids.py') fields_file = "/data/resources/0.0.1" + os.sep + 'pointing_centers.radec' loadCentroids.execute(cursor, fields_file=fields_file) loadGuides = imp.load_source('loadGuides', filename + ...
def update(cursor, filename):
loadCentroids = imp.load_source('loadCentroids', filename + os.sep + 'loadCentroids.py') fields_file = "/data/resources/0.0.1" + os.sep + 'pointing_centers.radec' loadCentroids.execute(cursor, fields_file=fields_file) loadGuides = imp.load_source('loadGuides', filename + os.sep + 'loadGuides.py') g...
import imp import os def update(cursor, filename):
12
64
184
6
5
Samreay/TaipanDB
resources/0.0.1/ingest/execute.py
Python
update
update
5
18
5
6
1cb68c62901b1abdf65d895015ea1dc8a44349b5
bigcode/the-stack
train
3eda1ed7876c604ef63b56aa
train
class
class StateJudicialDistrictChooserMixin(ModelChooserMixin): preserve_url_parameters = ['state_ref',] # preserve this URL parameter on pagination / search def get_unfiltered_object_list(self): objects = super().get_unfiltered_object_list() state_ref = self.request.GET.get('state_ref') i...
class StateJudicialDistrictChooserMixin(ModelChooserMixin):
preserve_url_parameters = ['state_ref',] # preserve this URL parameter on pagination / search def get_unfiltered_object_list(self): objects = super().get_unfiltered_object_list() state_ref = self.request.GET.get('state_ref') if state_ref: objects = objects.filter(state_ref=...
from django.utils.translation import gettext_lazy as _ from generic_chooser.views import ModelChooserMixin, ModelChooserCreateTabMixin, ModelChooserViewSet from areas.models import StateJudicialDistrict class StateJudicialDistrictChooserMixin(ModelChooserMixin):
51
64
84
11
39
polrev-github/polrev-django
polrev/areas/views/state_judicial_district_views.py
Python
StateJudicialDistrictChooserMixin
StateJudicialDistrictChooserMixin
7
15
7
7
1d168852d685750830ceda88b0907a8778ac53d2
bigcode/the-stack
train
c4e2f73daea734d85995b5b2
train
class
class StateJudicialDistrictChooserViewSet(ModelChooserViewSet): chooser_mixin_class = StateJudicialDistrictChooserMixin create_tab_mixin_class = StateJudicialDistrictChooserCreateTabMixin #icon = 'user' model = StateJudicialDistrict page_title = _("Choose a district") per_page = 10 #order_by...
class StateJudicialDistrictChooserViewSet(ModelChooserViewSet):
chooser_mixin_class = StateJudicialDistrictChooserMixin create_tab_mixin_class = StateJudicialDistrictChooserCreateTabMixin #icon = 'user' model = StateJudicialDistrict page_title = _("Choose a district") per_page = 10 #order_by = 'title' fields = ['state_ref', 'district_num']
icialDistrictChooserCreateTabMixin(ModelChooserCreateTabMixin): def get_initial(self): data = self.initial.copy() state_ref = self.request.GET.get('state_ref') data['state_ref'] = state_ref return data class StateJudicialDistrictChooserViewSet(ModelChooserViewSet):
64
64
92
13
50
polrev-github/polrev-django
polrev/areas/views/state_judicial_district_views.py
Python
StateJudicialDistrictChooserViewSet
StateJudicialDistrictChooserViewSet
26
34
26
26
79172bcc7e95983f7ac4d502a7b7d0393306f6c2
bigcode/the-stack
train
7a3ae62ead2b556fb73a6999
train
class
class StateJudicialDistrictChooserCreateTabMixin(ModelChooserCreateTabMixin): def get_initial(self): data = self.initial.copy() state_ref = self.request.GET.get('state_ref') data['state_ref'] = state_ref return data
class StateJudicialDistrictChooserCreateTabMixin(ModelChooserCreateTabMixin):
def get_initial(self): data = self.initial.copy() state_ref = self.request.GET.get('state_ref') data['state_ref'] = state_ref return data
_unfiltered_object_list(self): objects = super().get_unfiltered_object_list() state_ref = self.request.GET.get('state_ref') if state_ref: objects = objects.filter(state_ref=state_ref) return objects class StateJudicialDistrictChooserCreateTabMixin(ModelChooserCreateTabMixin):...
64
64
54
15
48
polrev-github/polrev-django
polrev/areas/views/state_judicial_district_views.py
Python
StateJudicialDistrictChooserCreateTabMixin
StateJudicialDistrictChooserCreateTabMixin
18
23
18
18
f64ab0bcac1b0d75c092c896be54ba762e24e09f
bigcode/the-stack
train
96b2f843d4f179f3730ec973
train
function
@pytest.mark.parametrize("lang", LANGUAGES) def test_lang_initialize(lang, capfd): """Test that languages can be initialized.""" nlp = get_lang_class(lang)() # Check for stray print statements (see #3342) doc = nlp("test") # noqa: F841 captured = capfd.readouterr() assert not captured.out
@pytest.mark.parametrize("lang", LANGUAGES) def test_lang_initialize(lang, capfd):
"""Test that languages can be initialized.""" nlp = get_lang_class(lang)() # Check for stray print statements (see #3342) doc = nlp("test") # noqa: F841 captured = capfd.readouterr() assert not captured.out
"si", "sk", "sl", "sq", "sr", "sv", "ta", "te", "tl", "tr", "tt", "ur", 'yo'] # fmt: on @pytest.mark.parametrize("lang", LANGUAGES) def test_lang_initialize(lang, capfd):
64
64
81
19
44
srao79/spaCy
spacy/tests/lang/test_initialize.py
Python
test_lang_initialize
test_lang_initialize
15
22
15
16
67716f600e0eded6cce17b715259a5e7f26eed05
bigcode/the-stack
train
140f310de59c665ed8ebeb95
train
class
class Graphmap(MakefilePackage): """A highly sensitive and accurate mapper for long, error-prone reads""" homepage = "https://github.com/isovic/graphmap" git = "https://github.com/isovic/graphmap.git" version('0.3.0', commit='eb8c75d68b03be95464318afa69b645a59f8f6b7') depends_on('zlib', type...
class Graphmap(MakefilePackage):
"""A highly sensitive and accurate mapper for long, error-prone reads""" homepage = "https://github.com/isovic/graphmap" git = "https://github.com/isovic/graphmap.git" version('0.3.0', commit='eb8c75d68b03be95464318afa69b645a59f8f6b7') depends_on('zlib', type='link') def edit(self, spec...
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class Graphmap(MakefilePackage):
62
64
181
8
54
kkauder/spack
var/spack/repos/builtin/packages/graphmap/package.py
Python
Graphmap
Graphmap
9
28
9
9
ee6802dc13151a05b86aaa7a51e88b73711aaf32
bigcode/the-stack
train
e8710eaa91cf7984320a3211
train
function
def create_roles():#创建角色 '''创建三个角色,分别是用户, 普通管理员,超级管理员''' roles={'User':Permisson.DELETE|Permisson.EDIT|Permisson.ADD, 'Oneadmin':Permisson.DELETE|Permisson.EDIT|Permisson.ADD|Permisson.ONEADMIN, 'Administrator':Permisson.DELETE|Permisson.EDIT|Permisson.ADD|Permisson.ONEADM...
def create_roles():#创建角色
'''创建三个角色,分别是用户, 普通管理员,超级管理员''' roles={'User':Permisson.DELETE|Permisson.EDIT|Permisson.ADD, 'Oneadmin':Permisson.DELETE|Permisson.EDIT|Permisson.ADD|Permisson.ONEADMIN, 'Administrator':Permisson.DELETE|Permisson.EDIT|Permisson.ADD|Permisson.ONEADMIN|Permisson.ADMIN ...
-*- # @Time : 2017/7/13 20:53 # @Author : lileilei # @File : db_create.py '''创建数据库''' from app import db from app.models import Permisson,Role def create_roles():#创建角色
64
64
144
8
55
maxyeung2021/FXTest
db_create.py
Python
create_roles
create_roles
8
21
8
8
c41a47cca4a35f3f31f56a0bcda70f2e76d27bf2
bigcode/the-stack
train
6bb3510160670fa5f1ebb1b4
train
class
class Solution: """ @param nums: a list of integers @return: return a list of integers """ def findDuplicates(self, nums): index = 0 while index<len(nums) : if nums[index] == index+1 : index += 1 continue m = nums[i...
class Solution:
""" @param nums: a list of integers @return: return a list of integers """ def findDuplicates(self, nums): index = 0 while index<len(nums) : if nums[index] == index+1 : index += 1 continue m = nums[index] ...
class Solution:
3
64
155
3
0
Ubastic/lintcode
python/1238.find-all-duplicates-in-an-array.py
Python
Solution
Solution
1
29
1
1
80f1230f56906332a1510a743305d2da5988a20e
bigcode/the-stack
train
cc48a7102c54be250201a88e
train
class
class StringSpec(DataSpec): """ A |DataSpec| property that accepts string fixed values. Because acceptable fixed values and field names are both strings, it can be necessary explicitly to disambiguate these possibilities. By default, string values are interpreted as fields, but the |value| function can...
class StringSpec(DataSpec):
""" A |DataSpec| property that accepts string fixed values. Because acceptable fixed values and field names are both strings, it can be necessary explicitly to disambiguate these possibilities. By default, string values are interpreted as fields, but the |value| function can be used to specify that...
init__(default=default, help=help, accept_datetime=False, accept_timedelta=False) class NullStringSpec(DataSpec): def __init__(self, default=None, help=None) -> None: super().__init__(Nullable(String), default=default, help=help) class StringSpec(DataSpec):
64
64
140
6
58
teresafds/bokeh
bokeh/core/property/dataspec.py
Python
StringSpec
StringSpec
289
305
289
289
53443b7391f976659524bea2aa123241b1f8e33d
bigcode/the-stack
train
2dd9cbe59cc7b2de62fddeea
train
class
class MarkerSpec(DataSpec): """ A |DataSpec| property that accepts marker types as fixed values. The ``MarkerSpec`` property attempts to first interpret string values as marker types. Otherwise string values are interpreted as field names. For example: .. code-block:: python m.font_size =...
class MarkerSpec(DataSpec):
""" A |DataSpec| property that accepts marker types as fixed values. The ``MarkerSpec`` property attempts to first interpret string values as marker types. Otherwise string values are interpreted as field names. For example: .. code-block:: python m.font_size = "circle" # value m...
m.font_size = "ring" # value m.font_size = "foo" # field """ def __init__(self, default, help=None) -> None: super().__init__(Nullable(HatchPatternType), default=default, help=help) class MarkerSpec(DataSpec):
64
64
128
6
58
teresafds/bokeh
bokeh/core/property/dataspec.py
Python
MarkerSpec
MarkerSpec
385
403
385
385
f7c6445d04d578082454e8148ea7dba7bad81366
bigcode/the-stack
train
53bc5dc632bacceeb61b8d8c
train
class
class FontStyleSpec(DataSpec): def __init__(self, default, help=None) -> None: super().__init__(Enum(enums.FontStyle), default=default, help=help)
class FontStyleSpec(DataSpec):
def __init__(self, default, help=None) -> None: super().__init__(Enum(enums.FontStyle), default=default, help=help)
, str): if len(value) == 0 or value[0].isdigit() and not FontSize._font_size_re.match(value): msg = "" if not detail else f"{value!r} is not a valid font size value" raise ValueError(msg) class FontStyleSpec(DataSpec):
64
64
41
7
57
teresafds/bokeh
bokeh/core/property/dataspec.py
Python
FontStyleSpec
FontStyleSpec
341
343
341
341
6bc38630c4a4f41ec4da7999f154fc62e2143a90
bigcode/the-stack
train
1601ca16fb022050cc74905b
train
class
class HatchPatternSpec(DataSpec): """ A |DataSpec| property that accepts hatch pattern types as fixed values. The ``HatchPatternSpec`` property attempts to first interpret string values as hatch pattern types. Otherwise string values are interpreted as field names. For example: .. code-block:: pyt...
class HatchPatternSpec(DataSpec):
""" A |DataSpec| property that accepts hatch pattern types as fixed values. The ``HatchPatternSpec`` property attempts to first interpret string values as hatch pattern types. Otherwise string values are interpreted as field names. For example: .. code-block:: python m.font_size = "." ...
super().__init__(Enum(enums.LineCap), default=default, help=help) class DashPatternSpec(DataSpec): def __init__(self, default, help=None) -> None: super().__init__(DashPattern, default=default, help=help) class HatchPatternSpec(DataSpec):
64
64
136
7
57
teresafds/bokeh
bokeh/core/property/dataspec.py
Python
HatchPatternSpec
HatchPatternSpec
365
383
365
365
9ff3511842713a4fd5729e5fd1f2a8e46a7ded33
bigcode/the-stack
train
5fbfbe7712fdd6fd56f1afa1
train
class
class DashPatternSpec(DataSpec): def __init__(self, default, help=None) -> None: super().__init__(DashPattern, default=default, help=help)
class DashPatternSpec(DataSpec):
def __init__(self, default, help=None) -> None: super().__init__(DashPattern, default=default, help=help)
init__(Enum(enums.LineJoin), default=default, help=help) class LineCapSpec(DataSpec): def __init__(self, default, help=None) -> None: super().__init__(Enum(enums.LineCap), default=default, help=help) class DashPatternSpec(DataSpec):
64
64
38
7
57
teresafds/bokeh
bokeh/core/property/dataspec.py
Python
DashPatternSpec
DashPatternSpec
361
363
361
361
c01726a742cbf2f95fa080f6182a361a06c0fca0
bigcode/the-stack
train
927eab60251787e093da9a31
train
class
class ColorSpec(DataSpec): """ A |DataSpec| property that accepts |Color| fixed values. The ``ColorSpec`` property attempts to first interpret string values as colors. Otherwise, string values are interpreted as field names. For example: .. code-block:: python m.color = "#a4225f" # valu...
class ColorSpec(DataSpec):
""" A |DataSpec| property that accepts |Color| fixed values. The ``ColorSpec`` property attempts to first interpret string values as colors. Otherwise, string values are interpreted as field names. For example: .. code-block:: python m.color = "#a4225f" # value (hex color string) ...
(cls, name, value) class NullDistanceSpec(DistanceSpec): def __init__(self, default=None, units_default="data", help=None) -> None: super().__init__(default=default, units_default=units_default, help=help) self.value_type = Nullable(Float) self._type_params = [Null()] + self._type_params ...
245
245
818
6
239
teresafds/bokeh
bokeh/core/property/dataspec.py
Python
ColorSpec
ColorSpec
530
614
530
530
66fd0a329729d7be96b9a7dd22a394bc91afc109
bigcode/the-stack
train
9a39eee249b6bc3e7e74468c
train
class
class FontSizeSpec(DataSpec): """ A |DataSpec| property that accepts font-size fixed values. The ``FontSizeSpec`` property attempts to first interpret string values as font sizes (i.e. valid CSS length values). Otherwise string values are interpreted as field names. For example: .. code-block:: py...
class FontSizeSpec(DataSpec):
""" A |DataSpec| property that accepts font-size fixed values. The ``FontSizeSpec`` property attempts to first interpret string values as font sizes (i.e. valid CSS length values). Otherwise string values are interpreted as field names. For example: .. code-block:: python m.font_size = "1...
| function can be used to specify that a string should interpreted as a value: .. code-block:: python m.title = value("foo") # value m.title = "foo" # field """ def __init__(self, default, help=None) -> None: super().__init__(String, default=default, help=help) class F...
86
86
288
7
79
teresafds/bokeh
bokeh/core/property/dataspec.py
Python
FontSizeSpec
FontSizeSpec
307
339
307
307
16dc59c5af03b8f9b6d28371e54af1ae79415930
bigcode/the-stack
train
e660ba11c05c8a52c1c384fc
train
class
class NullStringSpec(DataSpec): def __init__(self, default=None, help=None) -> None: super().__init__(Nullable(String), default=default, help=help)
class NullStringSpec(DataSpec):
def __init__(self, default=None, help=None) -> None: super().__init__(Nullable(String), default=default, help=help)
def __init__(self, default=1.0, help=None) -> None: help = f"{help or ''}\n{self._default_help}" super().__init__(default=default, help=help, accept_datetime=False, accept_timedelta=False) class NullStringSpec(DataSpec):
64
64
39
7
57
teresafds/bokeh
bokeh/core/property/dataspec.py
Python
NullStringSpec
NullStringSpec
285
287
285
285
83e9a385a41ce82da3cbf06757c538bad8842b11
bigcode/the-stack
train
2b5d86e4a3249dd2f9575ea3
train
class
class DataSpec(Either): """ Base class for properties that accept either a fixed value, or a string name that references a column in a :class:`~bokeh.models.sources.ColumnDataSource`. Many Bokeh models have properties that a user might want to set either to a single fixed value, or to have the prop...
class DataSpec(Either):
""" Base class for properties that accept either a fixed value, or a string name that references a column in a :class:`~bokeh.models.sources.ColumnDataSource`. Many Bokeh models have properties that a user might want to set either to a single fixed value, or to have the property take values from so...
UnitsSpecPropertyDescriptor from .either import Either from .enum import Enum from .instance import Instance from .nothing import Nothing from .nullable import Nullable from .primitive import ( Float, Int, Null, String, ) from .singletons import Undefined from .struct import Optional, Struct from .vect...
255
256
1,241
6
249
teresafds/bokeh
bokeh/core/property/dataspec.py
Python
DataSpec
DataSpec
92
241
92
92
d3509c52a1d4548be6e65a6ef500c94055d4c080
bigcode/the-stack
train
5a1e3465258b560e6884db0d
train
class
class NullDistanceSpec(DistanceSpec): def __init__(self, default=None, units_default="data", help=None) -> None: super().__init__(default=default, units_default=units_default, help=help) self.value_type = Nullable(Float) self._type_params = [Null()] + self._type_params def prepare_valu...
class NullDistanceSpec(DistanceSpec):
def __init__(self, default=None, units_default="data", help=None) -> None: super().__init__(default=default, units_default=units_default, help=help) self.value_type = Nullable(Float) self._type_params = [Null()] + self._type_params def prepare_value(self, cls, name, value): try:...
help=help) def prepare_value(self, cls, name, value): try: if value < 0: raise ValueError("Distances must be positive!") except TypeError: pass return super().prepare_value(cls, name, value) class NullDistanceSpec(DistanceSpec):
64
64
130
8
56
teresafds/bokeh
bokeh/core/property/dataspec.py
Python
NullDistanceSpec
NullDistanceSpec
501
514
501
502
f8c251d5ae2e9d88a278e2eb816b3f3d93ae06c8
bigcode/the-stack
train
e6186877f78a293ea8f23430
train
class
class UnitsSpec(NumberSpec): """ A |DataSpec| property that accepts numeric fixed values, and also provides an associated units property to store units information. """ def __init__(self, default, units_enum, units_default, help=None) -> None: super().__init__(default=default, help=help) ...
class UnitsSpec(NumberSpec):
""" A |DataSpec| property that accepts numeric fixed values, and also provides an associated units property to store units information. """ def __init__(self, default, units_enum, units_default, help=None) -> None: super().__init__(default=default, help=help) units_type = Enum(units_e...
field """ def __init__(self, default, help=None) -> None: super().__init__(Nullable(HatchPatternType), default=default, help=help) class MarkerSpec(DataSpec): """ A |DataSpec| property that accepts marker types as fixed values. The ``MarkerSpec`` property attempts to first interpret string ...
172
172
574
6
166
teresafds/bokeh
bokeh/core/property/dataspec.py
Python
UnitsSpec
UnitsSpec
405
471
405
405
1d829952f55624167cc0ffabe40c9ac885cc0d99
bigcode/the-stack
train
66dfe373b9d8580435398d55
train
class
class TextAlignSpec(DataSpec): def __init__(self, default, help=None) -> None: super().__init__(Enum(enums.TextAlign), default=default, help=help)
class TextAlignSpec(DataSpec):
def __init__(self, default, help=None) -> None: super().__init__(Enum(enums.TextAlign), default=default, help=help)
r} is not a valid font size value" raise ValueError(msg) class FontStyleSpec(DataSpec): def __init__(self, default, help=None) -> None: super().__init__(Enum(enums.FontStyle), default=default, help=help) class TextAlignSpec(DataSpec):
64
64
41
7
57
teresafds/bokeh
bokeh/core/property/dataspec.py
Python
TextAlignSpec
TextAlignSpec
345
347
345
345
18ab59cd9b294a2d088f57eb5d484cc69fdac673
bigcode/the-stack
train
fedfd527fe0dc9f250fb2cc7
train
class
class TextBaselineSpec(DataSpec): def __init__(self, default, help=None) -> None: super().__init__(Enum(enums.TextBaseline), default=default, help=help)
class TextBaselineSpec(DataSpec):
def __init__(self, default, help=None) -> None: super().__init__(Enum(enums.TextBaseline), default=default, help=help)
init__(Enum(enums.FontStyle), default=default, help=help) class TextAlignSpec(DataSpec): def __init__(self, default, help=None) -> None: super().__init__(Enum(enums.TextAlign), default=default, help=help) class TextBaselineSpec(DataSpec):
64
64
41
7
57
teresafds/bokeh
bokeh/core/property/dataspec.py
Python
TextBaselineSpec
TextBaselineSpec
349
351
349
349
4972a0fac5240dab053baa783d8f4e5086946607
bigcode/the-stack
train
1f3befc69b1a448d47753d41
train
class
class LineCapSpec(DataSpec): def __init__(self, default, help=None) -> None: super().__init__(Enum(enums.LineCap), default=default, help=help)
class LineCapSpec(DataSpec):
def __init__(self, default, help=None) -> None: super().__init__(Enum(enums.LineCap), default=default, help=help)
init__(Enum(enums.TextBaseline), default=default, help=help) class LineJoinSpec(DataSpec): def __init__(self, default, help=None) -> None: super().__init__(Enum(enums.LineJoin), default=default, help=help) class LineCapSpec(DataSpec):
64
64
41
7
57
teresafds/bokeh
bokeh/core/property/dataspec.py
Python
LineCapSpec
LineCapSpec
357
359
357
357
033d3aa9f2fc2ae38f03fb7d8193c324ba38b8ac
bigcode/the-stack
train
c1defd9d3b13f9c0326aa647
train
class
class AngleSpec(UnitsSpec): """ A |DataSpec| property that accepts numeric fixed values, and also provides an associated units property to store angle units. Acceptable values for units are ``"deg"``, ``"rad"``, ``"grad"`` and ``"turn"``. """ def __init__(self, default=Undefined, units_default="ra...
class AngleSpec(UnitsSpec):
""" A |DataSpec| property that accepts numeric fixed values, and also provides an associated units property to store angle units. Acceptable values for units are ``"deg"``, ``"rad"``, ``"grad"`` and ``"turn"``. """ def __init__(self, default=Undefined, units_default="rad", help=None) -> None: ...
= super().to_serializable(obj, name, val) if val.units is Unspecified: units = self.get_units(obj, name) if units != self._units_type._default: val.units = units # XXX: clone and update? return val class AngleSpec(UnitsSpec):
64
64
114
7
56
teresafds/bokeh
bokeh/core/property/dataspec.py
Python
AngleSpec
AngleSpec
473
481
473
473
790c6a8dd9977ae9aae55e7d9405f24e2b715492
bigcode/the-stack
train
7f410d0b7f408799a0d5b4fe
train
class
class IntSpec(DataSpec): def __init__(self, default, help=None) -> None: super().__init__(Int, default=default, help=help)
class IntSpec(DataSpec):
def __init__(self, default, help=None) -> None: super().__init__(Int, default=default, help=help)
type value try: self.value_type.replace(String, Nothing()).validate(val, False) return Value(val) except ValueError: pass # Check for data source field name if isinstance(val, str): return Field(val) return val class IntSpec(Data...
64
64
36
6
57
teresafds/bokeh
bokeh/core/property/dataspec.py
Python
IntSpec
IntSpec
243
245
243
243
4b3382de2e60ec2c3020a323c85f9c0ef9bbbaaa
bigcode/the-stack
train
3ab8585e0ab32f1ca3c69dbd
train
class
class AlphaSpec(NumberSpec): _default_help = """\ Acceptable values are numbers in 0..1 range (transparent..opaque). """ def __init__(self, default=1.0, help=None) -> None: help = f"{help or ''}\n{self._default_help}" super().__init__(default=default, help=help, accept_datetime=False, ...
class AlphaSpec(NumberSpec):
_default_help = """\ Acceptable values are numbers in 0..1 range (transparent..opaque). """ def __init__(self, default=1.0, help=None) -> None: help = f"{help or ''}\n{self._default_help}" super().__init__(default=default, help=help, accept_datetime=False, accept_timedelta=False)
, accept_timedelta=True) -> None: super().__init__(Float, default=default, help=help) if accept_timedelta: self.accepts(TimeDelta, convert_timedelta_type) if accept_datetime: self.accepts(Datetime, convert_datetime_type) class AlphaSpec(NumberSpec):
64
64
89
6
58
teresafds/bokeh
bokeh/core/property/dataspec.py
Python
AlphaSpec
AlphaSpec
275
283
275
276
5d089cbfb79be864a5b06295c4e1876e0d793f66
bigcode/the-stack
train
dcfafdab3369df0b9d9d235b
train
class
class SizeSpec(NumberSpec): """ A |DataSpec| property that accepts non-negative numeric fixed values for size values or strings that refer to columns in a :class:`~bokeh.models.sources.ColumnDataSource`. """ def prepare_value(self, cls, name, value): try: if value < 0: ...
class SizeSpec(NumberSpec):
""" A |DataSpec| property that accepts non-negative numeric fixed values for size values or strings that refer to columns in a :class:`~bokeh.models.sources.ColumnDataSource`. """ def prepare_value(self, cls, name, value): try: if value < 0: raise ValueError("Scr...
def prepare_value(self, cls, name, value): try: if value is not None and value < 0: raise ValueError("Distances must be positive or None!") except TypeError: pass return super().prepare_value(cls, name, value) class SizeSpec(NumberSpec):
64
64
103
6
58
teresafds/bokeh
bokeh/core/property/dataspec.py
Python
SizeSpec
SizeSpec
516
528
516
516
a5c2249c87376963270ff914ee3d4c490f207dab
bigcode/the-stack
train
6d95281425d16204aac4ee74
train
class
class LineJoinSpec(DataSpec): def __init__(self, default, help=None) -> None: super().__init__(Enum(enums.LineJoin), default=default, help=help)
class LineJoinSpec(DataSpec):
def __init__(self, default, help=None) -> None: super().__init__(Enum(enums.LineJoin), default=default, help=help)
init__(Enum(enums.TextAlign), default=default, help=help) class TextBaselineSpec(DataSpec): def __init__(self, default, help=None) -> None: super().__init__(Enum(enums.TextBaseline), default=default, help=help) class LineJoinSpec(DataSpec):
64
64
41
7
57
teresafds/bokeh
bokeh/core/property/dataspec.py
Python
LineJoinSpec
LineJoinSpec
353
355
353
353
327f3f6b1ad62e4e7fadc5eb45a2b6b85e48e8b1
bigcode/the-stack
train
b1164d67e6c79705a1e3ce0a
train
class
class DistanceSpec(UnitsSpec): """ A |DataSpec| property that accepts numeric fixed values or strings that refer to columns in a :class:`~bokeh.models.sources.ColumnDataSource`, and also provides an associated units property to store units information. Acceptable values for units are ``"screen"`` and ``...
class DistanceSpec(UnitsSpec):
""" A |DataSpec| property that accepts numeric fixed values or strings that refer to columns in a :class:`~bokeh.models.sources.ColumnDataSource`, and also provides an associated units property to store units information. Acceptable values for units are ``"screen"`` and ``"data"``. """ def __in...
and ``"turn"``. """ def __init__(self, default=Undefined, units_default="rad", help=None) -> None: super().__init__(default=default, units_enum=enums.AngleUnits, units_default=units_default, help=help) class DistanceSpec(UnitsSpec):
64
64
176
7
57
teresafds/bokeh
bokeh/core/property/dataspec.py
Python
DistanceSpec
DistanceSpec
483
499
483
483
022800c388f61ad88db21cfc2c9bf4c1c58940f9
bigcode/the-stack
train
b4049d2f41eff54512e3419b
train
class
class NumberSpec(DataSpec): """ A |DataSpec| property that accepts numeric and datetime fixed values. By default, date and datetime values are immediately converted to milliseconds since epoch. It is possible to disable processing of datetime values by passing ``accept_datetime=False``. By default...
class NumberSpec(DataSpec):
""" A |DataSpec| property that accepts numeric and datetime fixed values. By default, date and datetime values are immediately converted to milliseconds since epoch. It is possible to disable processing of datetime values by passing ``accept_datetime=False``. By default, timedelta values are immed...
for data source field name if isinstance(val, str): return Field(val) return val class IntSpec(DataSpec): def __init__(self, default, help=None) -> None: super().__init__(Int, default=default, help=help) class NumberSpec(DataSpec):
64
64
211
6
58
teresafds/bokeh
bokeh/core/property/dataspec.py
Python
NumberSpec
NumberSpec
247
273
247
247
b0bcd500878cf3b646d7c6a9cd05b079bca76306
bigcode/the-stack
train
7057c128ae0cacc0be0b4774
train
function
def create_user_role(keyword, role_name): role = RoleFactory.create(name=role_name) user_id = BaseTestCase.user_id() PermissionFactory.create(keyword=keyword, role=role) return UserRoleFactory.create(user_id=user_id, role=role), user_id
def create_user_role(keyword, role_name):
role = RoleFactory.create(name=role_name) user_id = BaseTestCase.user_id() PermissionFactory.create(keyword=keyword, role=role) return UserRoleFactory.create(user_id=user_id, role=role), user_id
from tests.base_test_case import BaseTestCase import factory from factories.role_factory import RoleFactory from factories.user_role_factory import UserRoleFactory from factories.permission_factory import PermissionFactory def create_user_role(keyword, role_name):
48
64
60
9
38
Maxcutex/pm_api
tests/integration/endpoints/user_role.py
Python
create_user_role
create_user_role
8
12
8
8
577a30f454beb82bc0e73d5ec8e30e998f11220c
bigcode/the-stack
train
31290722ed35c8d858cc8862
train
class
class TruncatedNormalKernelDensity(BaseEstimator): """Kernel Density Estimation on Bounded Support Using Truncated Normal Kernels Parameters ---------- bandwidth : float The bandwidth of the kernel. lowerbound : float The lower-bound of the support. upperbound : float ...
class TruncatedNormalKernelDensity(BaseEstimator):
"""Kernel Density Estimation on Bounded Support Using Truncated Normal Kernels Parameters ---------- bandwidth : float The bandwidth of the kernel. lowerbound : float The lower-bound of the support. upperbound : float The upper-bound of the support. """ def __i...
# Truncated Normal KDE # # Licensed under the BSD 3-Clause License # Copyright (c) 2019, Yuriy Sverchkov from scipy.stats import truncnorm, multinomial from sklearn.base import BaseEstimator from sklearn.utils import check_random_state from scipy.special import logsumexp import numpy as np class TruncatedNormalKernelD...
79
189
630
9
69
sverchkov/misc-stat-tools
tnkde.py
Python
TruncatedNormalKernelDensity
TruncatedNormalKernelDensity
13
101
13
13
f0deba79548b74d7e6b975788c398b3080cd2701
bigcode/the-stack
train
265607dad7684e34f6a8f8c5
train
class
class FilialListView(ListAPIView): queryset = Filial.objects.all() serializer_class = FilialListSerializer pagination_class = TablePagination permission_classes = [ IsAuthenticated, IsAdmin ] def get(self, request, *args, **kwargs): name = self.request.query_params.get('...
class FilialListView(ListAPIView):
queryset = Filial.objects.all() serializer_class = FilialListSerializer pagination_class = TablePagination permission_classes = [ IsAuthenticated, IsAdmin ] def get(self, request, *args, **kwargs): name = self.request.query_params.get('name', '') city = self.requ...
from django.db.models import Q from rest_framework.generics import ListAPIView from rest_framework.response import Response from rest_framework.permissions import IsAuthenticated from .serializers import FilialListSerializer from .models import Filial from project.paginations import TablePagination from accounts.pe...
79
79
264
8
70
CODE-Easyy/dash-back
project/filials/views.py
Python
FilialListView
FilialListView
15
58
15
15
8d5ec4adc4b542ebde9973a8e0b9f4e7886f25bb
bigcode/the-stack
train
201ff212e430e03fde41b264
train
class
class Barra2(pygame.sprite.Sprite): """Clase que representa la barra del nivel 2 (plataforma mediana)""" def __init__(self): """ Inicializador de la clase 'Barra2'. :param barra: Imagen barra nivel 2 :param rect: Obtiene el rectangulo de la imagen de la barra del nivel 2 ...
class Barra2(pygame.sprite.Sprite):
"""Clase que representa la barra del nivel 2 (plataforma mediana)""" def __init__(self): """ Inicializador de la clase 'Barra2'. :param barra: Imagen barra nivel 2 :param rect: Obtiene el rectangulo de la imagen de la barra del nivel 2 :param rect.centerx: Posicion...
.rect) def movimiento(self): """Movimiento de la barra. Este metodo de la clase Barra limita el movimiento de la barra en los margenes izquierdo y derecho de la pantalla perteneciente al nivel 1 """ if self.injuego == True: ...
106
107
357
9
96
diegoalvarezeoo/Proyecto2-pygame
arkanoidP2.py
Python
Barra2
Barra2
273
315
273
273
974b2fe8c478ffb5a38f2ec1e2ffa4a17111be02
bigcode/the-stack
train
aea125f35a1f5e1d04926959
train
class
class Bola(pygame.sprite.Sprite): """Clase que representa la bola""" def __init__(self, posx, posy): """ Inicializador de la clase 'Bola'. :param barra: Imagen bola :param rect: Obtiene el rectangulo de la imagen de la bola :param rect.centerx: Posicion inicial de...
class Bola(pygame.sprite.Sprite):
"""Clase que representa la bola""" def __init__(self, posx, posy): """ Inicializador de la clase 'Bola'. :param barra: Imagen bola :param rect: Obtiene el rectangulo de la imagen de la bola :param rect.centerx: Posicion inicial de la barra en x :param re...
import pygame,sys from pygame.locals import * """Algunos colores y variables que se usaran en el codigo""" verde = (0,0,238) blanco = (255,255,255) ancho = 900 alto = 574 anchoL = 80 largoL = 20 colorL = (150,200,0) colorl1 = (30,30,30) colorl3 = (127,255,0) class Bola(pygame.sprite.Sprite):
109
256
1,772
8
101
diegoalvarezeoo/Proyecto2-pygame
arkanoidP2.py
Python
Bola
Bola
19
225
19
19
4d0b163f0048479aa200f57b8a571a4cefcdd346
bigcode/the-stack
train
07dfed16525f3c316d5b4b28
train
function
def NIVEL3(): pygame.init() """Ejecucion nivel 3. En esta funcion se da inicio al nivel 3, se instancian los objetos de las clases creadas """ vent = pygame.display.set_mode((ancho,alto)) pygame.display.set_caption("Arkanoid") imagenfondo = pygame.image.load("imagenes/nivel...
def NIVEL3():
pygame.init() """Ejecucion nivel 3. En esta funcion se da inicio al nivel 3, se instancian los objetos de las clases creadas """ vent = pygame.display.set_mode((ancho,alto)) pygame.display.set_caption("Arkanoid") imagenfondo = pygame.image.load("imagenes/nivel3.jpg").conver...
) pressed = pygame.key.get_pressed() if pressed[pygame.K_LEFT]: jugador.rect.left -= jugador.veloc if pressed[pygame.K_RIGHT]: jugador.rect.right+= jugador.veloc vent.blit(text4,(0,10)) eobola.dibujarL2(vent) eobola.agregar2(vent) ...
101
102
343
5
96
diegoalvarezeoo/Proyecto2-pygame
arkanoidP2.py
Python
NIVEL3
NIVEL3
457
501
457
457
470aa685515d5c95c23390dfbf3040dc80d4c3b4
bigcode/the-stack
train
23d6655b6e537f0f30f43044
train
function
def NIVEL1(): """Ejecucion nivel 1. En esta funcion se da inicio al nivel 1, se instancian los objetos de las clases creadas """ pygame.init() vent = pygame.display.set_mode((ancho,alto)) pygame.display.set_caption("Arkanoid") imagenfondo=pygame.image.load("imagenes/fondobo...
def NIVEL1():
"""Ejecucion nivel 1. En esta funcion se da inicio al nivel 1, se instancian los objetos de las clases creadas """ pygame.init() vent = pygame.display.set_mode((ancho,alto)) pygame.display.set_caption("Arkanoid") imagenfondo=pygame.image.load("imagenes/fondobosque2.jpg").co...
.rect) def movimiento(self): """Movimiento de la barra. Este metodo de la clase Barra3 limita el movimiento de la barra en los margenes izquierdo y derecho de la pantalla perteneciente al nivel 3 """ if self.injuego == True: ...
103
104
347
5
97
diegoalvarezeoo/Proyecto2-pygame
arkanoidP2.py
Python
NIVEL1
NIVEL1
362
407
362
362
ff70ffbd3bbfae46db6f2d7534612f22d5c40998
bigcode/the-stack
train
2b44e4a0fa68aa179cf0e731
train
function
def NIVEL2(): """Ejecucion nivel 2. En esta funcion se da inicio al nivel 2, se instancian los objetos de las clases creadas """ pygame.init() vent = pygame.display.set_mode((ancho,alto)) pygame.display.set_caption("Arkanoid") imagenfondo = pygame.image.load("imagenes/nivel...
def NIVEL2():
"""Ejecucion nivel 2. En esta funcion se da inicio al nivel 2, se instancian los objetos de las clases creadas """ pygame.init() vent = pygame.display.set_mode((ancho,alto)) pygame.display.set_caption("Arkanoid") imagenfondo = pygame.image.load("imagenes/nivel2n.jpg").conve...
(vent) pressed = pygame.key.get_pressed() if pressed[pygame.K_LEFT]: jugador.rect.left -= jugador.veloc if pressed[pygame.K_RIGHT]: jugador.rect.right+= jugador.veloc eobola.dibujarL(vent) eobola.agregar2(vent) jugador.agregar(vent) vent.blit(t...
102
103
344
5
97
diegoalvarezeoo/Proyecto2-pygame
arkanoidP2.py
Python
NIVEL2
NIVEL2
410
454
410
410
c563bf338f0262084844a928c17ac3aceecb2d01
bigcode/the-stack
train
416f524f8581d940170c258c
train
class
class Barra(pygame.sprite.Sprite): """Clase que representa la barra del nivel 1 (plataforma grande)""" def __init__(self): """ Inicializador de la clase 'Barra'. :param barra: Imagen barra nivel 1 :param rect: Obtiene el rectangulo de la imagen de la barra del nivel 1 ...
class Barra(pygame.sprite.Sprite):
"""Clase que representa la barra del nivel 1 (plataforma grande)""" def __init__(self): """ Inicializador de la clase 'Barra'. :param barra: Imagen barra nivel 1 :param rect: Obtiene el rectangulo de la imagen de la barra del nivel 1 :param rect.centerx: Posicion i...
self.sonido1.play() def puntaje(self, vent): """Puntos en pantalla. Este metodo muestra en la ventana los puntos ganados al momento de destruir los ladrillos con la bola """ if self.font: ...
103
105
352
8
95
diegoalvarezeoo/Proyecto2-pygame
arkanoidP2.py
Python
Barra
Barra
228
270
228
228
c832381efa5a76b455fbd46457f84c6853cf2ed0
bigcode/the-stack
train
cfe256a4a2f1b8b051d3cc5e
train
class
class Barra3(pygame.sprite.Sprite): """Clase que representa la barra del nivel 3 (plataforma pequenia)""" def __init__(self): """ Inicializador de la clase 'Barra3'. :param barra: Imagen barra nivel 3 :param rect: Obtiene el rectangulo de la imagen de la barra del nivel 3 ...
class Barra3(pygame.sprite.Sprite):
"""Clase que representa la barra del nivel 3 (plataforma pequenia)""" def __init__(self): """ Inicializador de la clase 'Barra3'. :param barra: Imagen barra nivel 3 :param rect: Obtiene el rectangulo de la imagen de la barra del nivel 3 :param rect.centerx: Posicio...
.rect) def movimiento(self): """Movimiento de la barra. Este metodo de la clase Barra2 limita el movimiento de la barra en los margenes izquierdo y derecho de la pantalla perteneciente al nivel 2 """ if self.injuego == True: ...
107
107
357
9
97
diegoalvarezeoo/Proyecto2-pygame
arkanoidP2.py
Python
Barra3
Barra3
317
359
317
317
029ec5541333e4b0d95b4fb9e42609a88b186f10
bigcode/the-stack
train
45f80bb18f4b0f685ff35628
train
function
def Introduccion(): """Menu de inicio. En esta funcion se crea el menu del juego con su respectiva tipologia de texto """ pygame.init() vent = pygame.display.set_mode((ancho,alto)) imagenin=pygame.image.load("imagenes/introd.jpg").convert_alpha() pygame.display.set_caption...
def Introduccion():
"""Menu de inicio. En esta funcion se crea el menu del juego con su respectiva tipologia de texto """ pygame.init() vent = pygame.display.set_mode((ancho,alto)) imagenin=pygame.image.load("imagenes/introd.jpg").convert_alpha() pygame.display.set_caption("Arkanoid") fue...
if pressed[pygame.K_LEFT]: jugador.rect.left -= jugador.veloc if pressed[pygame.K_RIGHT]: jugador.rect.right+= jugador.veloc vent.blit(text4,(0,10)) eobola.dibujarL3(vent) eobola.agregar2(vent) jugador.agregar(vent) pygame.display.flip() pyga...
89
89
299
4
85
diegoalvarezeoo/Proyecto2-pygame
arkanoidP2.py
Python
Introduccion
Introduccion
503
539
503
503
63bc0972f283c535de55c147301c1707185c408d
bigcode/the-stack
train
a313affe804a5a8e14747dcc
train
class
class CpsIpResource(object): def __init__(self, ip=None, resourceType=None): """ :param ip: (Optional) 云物理服务器公网 IP 地址 :param resourceType: (Optional) 公网 IP 类型或绑定资源类型. <br>- 0: 未知类型<br>- 1: 弹性公网 IP(IP 为弹性公网 IP, 绑定资源类型未知)<br>- 10: 弹性公网 IP(IP 为弹性公网 IP, 但未绑定资源)<br>- 11: 弹性公网 IP, 绑定了云主机<br>- 12:...
class CpsIpResource(object):
def __init__(self, ip=None, resourceType=None): """ :param ip: (Optional) 云物理服务器公网 IP 地址 :param resourceType: (Optional) 公网 IP 类型或绑定资源类型. <br>- 0: 未知类型<br>- 1: 弹性公网 IP(IP 为弹性公网 IP, 绑定资源类型未知)<br>- 10: 弹性公网 IP(IP 为弹性公网 IP, 但未绑定资源)<br>- 11: 弹性公网 IP, 绑定了云主机<br>- 12: 弹性公网 IP, 绑定了负载均衡<br>- 13: 弹性公...
on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # NOTE: This class is auto generated by the jdcloud code generator program. class CpsIpResource(object):
64
64
213
7
57
Ureimu/weather-robot
python_code/vnev/Lib/site-packages/jdcloud_sdk/services/ipanti/models/CpsIpResource.py
Python
CpsIpResource
CpsIpResource
20
29
20
21
16eb003bc72c4e3617126a37cf1d59fadf51ddf9
bigcode/the-stack
train
97a6033ba2de8dac92cd99b8
train
class
class Migration(migrations.Migration): dependencies = [ ('notifications', '0001_initial'), ] operations = [ migrations.AddField( model_name='notification', name='created_at', field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now...
class Migration(migrations.Migration):
dependencies = [ ('notifications', '0001_initial'), ] operations = [ migrations.AddField( model_name='notification', name='created_at', field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now), preserve_default=False, ...
# Generated by Django 2.0.13 on 2019-04-07 14:24 from django.db import migrations, models import django.utils.timezone class Migration(migrations.Migration):
44
64
100
7
36
haneulee/gramgram
gramgram/notifications/migrations/0002_auto_20190407_2324.py
Python
Migration
Migration
7
25
7
8
6f1b5a73b48d5826be614668e53b5fef1819135d
bigcode/the-stack
train
e426a964c37a495432cb88bf
train
function
def Tsous_sol(z,i): """ La température du sous-sol est une fonction sinusoidale : - de période = une année - de pulsation w ,obtenue à partir de l'équation de la propagation de la chaleur dans le sous-sol. z : profondeur en mètres i : indice temporel dans la discrétisation ...
def Tsous_sol(z,i):
""" La température du sous-sol est une fonction sinusoidale : - de période = une année - de pulsation w ,obtenue à partir de l'équation de la propagation de la chaleur dans le sous-sol. z : profondeur en mètres i : indice temporel dans la discrétisation """ factor...
titre="diffusivité : {} m2/s - pulsation : {} s-1".format("%.2E" % a,"%.2E" % w) # profondeur équivalente liée à a ?? za = math.sqrt( 2 * a / w ) def Tsous_sol(z,i):
64
64
118
8
56
seviprince/Mes_codes
examples/Tsous_sol.py
Python
Tsous_sol
Tsous_sol
34
49
34
35
5325e491b5241be30c50f72df880371db0537b39
bigcode/the-stack
train
4879bb8142accff96695a4fc
train
class
class DiceLoss(Function): def __init__(self, *args, **kwargs): pass def forward(self, input, target, save=True): if save: self.save_for_backward(input, target) eps = 0.000001 _, result_ = input.max(1) result_ = torch.squeeze(result_) if input.is_cuda: result = torch.cuda.FloatTensor(result_.size()...
class DiceLoss(Function):
def __init__(self, *args, **kwargs): pass def forward(self, input, target, save=True): if save: self.save_for_backward(input, target) eps = 0.000001 _, result_ = input.max(1) result_ = torch.squeeze(result_) if input.is_cuda: result = torch.cuda.FloatTensor(result_.size()) self.target_ = torch.c...
: # loss = loss.mean() # else: # loss = loss.sum() return loss class FocalCrossEntropyLoss3d(FocalCrossEntropyLoss2d): # All the same pass import torch from torch.autograd import Function from itertools import repeat import numpy as np # Intersection = dot(A, B) # Union = dot(A, A) + dot(B, B) # The D...
144
144
480
5
139
donghaozhang/fast_segmentation
ptsemseg/loss.py
Python
DiceLoss
DiceLoss
160
206
160
161
69a16dcdf50c32d90ea0a178623e216cd9463038
bigcode/the-stack
train
e3647cf067d650031c961ca2
train
function
def dice_error(input, target): eps = 0.000001 _, result_ = input.max(1) result_ = torch.squeeze(result_) if input.is_cuda: result = torch.cuda.FloatTensor(result_.size()) target_ = torch.cuda.FloatTensor(target.size()) else: result = torch.FloatTensor(result_.size()) target_ = torch.FloatTensor(target.size...
def dice_error(input, target):
eps = 0.000001 _, result_ = input.max(1) result_ = torch.squeeze(result_) if input.is_cuda: result = torch.cuda.FloatTensor(result_.size()) target_ = torch.cuda.FloatTensor(target.size()) else: result = torch.FloatTensor(result_.size()) target_ = torch.FloatTensor(target.size()) result.copy_(result_.data)...
.add(torch.mul(gt, 2), torch.mul(pred, -4)) grad_input = torch.cat((torch.mul(dDice, -grad_output[0]), torch.mul(dDice, grad_output[0])), 0) return grad_input, None def dice_loss(input, target): return DiceLoss()(input, target) def dice_error(input, target):
78
78
260
7
71
donghaozhang/fast_segmentation
ptsemseg/loss.py
Python
dice_error
dice_error
213
237
213
213
745473c8156b0dcde49f03fe9eb40b31126a0e92
bigcode/the-stack
train
17025665803b22d692b394ed
train
function
def cross_entropy3d_new(input, target, weight=None, size_average=True): log('The input size is {}'.format(input.size())) log('The output size is {}'.format(target.size())) # input: (n, c, h, w, z), target: (n, h, w, z) n, c, h, w, z = input.size() # log_p: (n, c, h, w, z) log_p = F.log_softmax(input, dim=1) # lo...
def cross_entropy3d_new(input, target, weight=None, size_average=True):
log('The input size is {}'.format(input.size())) log('The output size is {}'.format(target.size())) # input: (n, c, h, w, z), target: (n, h, w, z) n, c, h, w, z = input.size() # log_p: (n, c, h, w, z) log_p = F.log_softmax(input, dim=1) # log_p: (n*h*w*z, c) log_p = log_p.permute(0, 4, 3, 2, 1).contiguous().vie...
(-1, 1) # logpt = log_p.gather(1, target_test) # print('loss sum logpt', logpt.sum()) # print('loss original', loss) # if size_average: # loss /= mask.data.sum() return loss def cross_entropy3d_new(input, target, weight=None, size_average=True):
78
78
260
17
60
donghaozhang/fast_segmentation
ptsemseg/loss.py
Python
cross_entropy3d_new
cross_entropy3d_new
37
53
37
37
96ade1f182651083020b65f35db2763ff6d42771
bigcode/the-stack
train
163f239d6e9462c53512c798
train
function
def cross_entropy3d(input, target, weight=None, size_average=True): log('The size of input is {}'.format(input.size())) input = F.log_softmax(input, dim=1) log('LOSS=>CrossEntropy3D=>input.size():{} target.size():{}'.format(input.size(), target.size())) # weight = torch.tensor([0.006858064671784196, 5, 1.44, 3.54],...
def cross_entropy3d(input, target, weight=None, size_average=True):
log('The size of input is {}'.format(input.size())) input = F.log_softmax(input, dim=1) log('LOSS=>CrossEntropy3D=>input.size():{} target.size():{}'.format(input.size(), target.size())) # weight = torch.tensor([0.006858064671784196, 5, 1.44, 3.54], dtype=torch.float) # weight = weight.cuda() loss = nn.CrossEntrop...
c) # target: (n*h*w*z,) mask = target >= 0 target = target[mask] loss = F.nll_loss(log_p, target, weight=weight, size_average=False) return loss def cross_entropy3d(input, target, weight=None, size_average=True):
64
64
126
16
47
donghaozhang/fast_segmentation
ptsemseg/loss.py
Python
cross_entropy3d
cross_entropy3d
56
63
56
56
54d3e5f82760d5ace65ec54b6110bd64f52bf221
bigcode/the-stack
train
000f0ff46b21e92b2e194565
train
class
class CrossEntropyLoss2d(nn.Module): def __init__(self, weight=None, size_average=True, nclass=2): super(CrossEntropyLoss2d, self).__init__() self.nll_loss = nn.NLLLoss2d(weight, size_average) self.nclass = nclass def forward(self, inputs, targets): x = inputs.permute(0, 2, 3, 1) y = targets.permute(0, 2, ...
class CrossEntropyLoss2d(nn.Module):
def __init__(self, weight=None, size_average=True, nclass=2): super(CrossEntropyLoss2d, self).__init__() self.nll_loss = nn.NLLLoss2d(weight, size_average) self.nclass = nclass def forward(self, inputs, targets): x = inputs.permute(0, 2, 3, 1) y = targets.permute(0, 2, 3, 1) x = x.resize(x.size(0) * x.si...
=torch.float) # weight = weight.cuda() loss = nn.CrossEntropyLoss(weight=weight, size_average=size_average) return loss(input, target) import torch import torch.nn.functional as F import torch.nn as nn from torch.autograd import Variable class CrossEntropyLoss2d(nn.Module):
64
64
171
9
54
donghaozhang/fast_segmentation
ptsemseg/loss.py
Python
CrossEntropyLoss2d
CrossEntropyLoss2d
72
83
72
72
593e2c2749d87b0a08ece063fe7892ea5efa7cde
bigcode/the-stack
train
6bec53721d7896b5e8b56e21
train
function
def log(s): if DEBUG: print(s)
def log(s):
if DEBUG: print(s)
import torch import numpy as np import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable DEBUG = False def log(s):
36
64
11
4
31
donghaozhang/fast_segmentation
ptsemseg/loss.py
Python
log
log
10
12
10
10
80faa0506fa5d9c4156dbedd243c2832615e60eb
bigcode/the-stack
train
17883e2a25b6875ba6eabb5e
train
class
class CrossEntropyLoss3d(nn.Module): def __init__(self, weight=None, size_average=True, nclass=2): super(CrossEntropyLoss3d, self).__init__() self.nll_loss = nn.NLLLoss(weight, size_average) self.nclass = nclass def forward(self, inputs, targets): x = inputs.permute(0, 2, 3, 4, 1) y = targets.permute(0, 2,...
class CrossEntropyLoss3d(nn.Module):
def __init__(self, weight=None, size_average=True, nclass=2): super(CrossEntropyLoss3d, self).__init__() self.nll_loss = nn.NLLLoss(weight, size_average) self.nclass = nclass def forward(self, inputs, targets): x = inputs.permute(0, 2, 3, 4, 1) y = targets.permute(0, 2, 3, 4, 1) x = x.resize(x.size(0) * ...
(0) * x.size(1) * x.size(2), self.nclass) y = y.resize(y.size(0) * y.size(1) * y.size(2)) return self.nll_loss(F.log_softmax(x), y) class CrossEntropyLoss3d(nn.Module):
64
64
187
9
55
donghaozhang/fast_segmentation
ptsemseg/loss.py
Python
CrossEntropyLoss3d
CrossEntropyLoss3d
86
97
86
86
5b8b275439405790b7634cbb6bf1789589e90417
bigcode/the-stack
train
c3d8e74ffd3ccd8b0078980a
train
class
class FocalCrossEntropyLoss3d(FocalCrossEntropyLoss2d): # All the same pass
class FocalCrossEntropyLoss3d(FocalCrossEntropyLoss2d): # All the same
pass
oss = loss.sum() # if self.size_average: # loss = loss.mean() # else: # loss = loss.sum() return loss class FocalCrossEntropyLoss3d(FocalCrossEntropyLoss2d): # All the same
64
64
24
22
41
donghaozhang/fast_segmentation
ptsemseg/loss.py
Python
FocalCrossEntropyLoss3d
FocalCrossEntropyLoss3d
142
144
142
143
aa6c69c33509abc588fdc8778e3accc604cb1b86
bigcode/the-stack
train
6767fed9a1a529eca84a3317
train
class
class FocalCrossEntropyLoss2d(nn.Module): ''' Ported from https://github.com/clcarwin/focal_loss_pytorch/blob/master/focalloss.py ''' def __init__(self, gamma=2, alpha=0.25, size_average=True): super(FocalCrossEntropyLoss2d, self).__init__() self.gamma = gamma self.alpha = alpha if isinstance(alpha, (float...
class FocalCrossEntropyLoss2d(nn.Module):
''' Ported from https://github.com/clcarwin/focal_loss_pytorch/blob/master/focalloss.py ''' def __init__(self, gamma=2, alpha=0.25, size_average=True): super(FocalCrossEntropyLoss2d, self).__init__() self.gamma = gamma self.alpha = alpha if isinstance(alpha, (float, int)): self.alpha = torch.Tensor([alpha,...
): x = inputs.permute(0, 2, 3, 4, 1) y = targets.permute(0, 2, 3, 4, 1) x = x.resize(x.size(0) * x.size(1) * x.size(2) * x.size(3), self.nclass) y = y.resize(y.size(0) * y.size(1) * y.size(2) * y.size(3)) return self.nll_loss(F.log_softmax(x), y) class FocalCrossEntropyLoss2d(nn.Module):
128
128
428
11
117
donghaozhang/fast_segmentation
ptsemseg/loss.py
Python
FocalCrossEntropyLoss2d
FocalCrossEntropyLoss2d
100
139
100
100
a2e1d903d53759daa64c8606af8240cdab9481d0
bigcode/the-stack
train
10ccb3ebb0dfcadc8fc416bb
train
function
def dice_loss(input, target): return DiceLoss()(input, target)
def dice_loss(input, target):
return DiceLoss()(input, target)
torch.add(torch.mul(gt, 2), torch.mul(pred, -4)) grad_input = torch.cat((torch.mul(dDice, -grad_output[0]), torch.mul(dDice, grad_output[0])), 0) return grad_input, None def dice_loss(input, target):
64
64
15
7
56
donghaozhang/fast_segmentation
ptsemseg/loss.py
Python
dice_loss
dice_loss
209
210
209
209
4844dcf7da3f763a0fe46ab30148be44ecb7362f
bigcode/the-stack
train
ab69fe22908e8ae7401679e5
train
function
def cross_entropy2d(input, target, weight=None, size_average=True): n, c, h, w = input.size() log_p = F.log_softmax(input) log_p = log_p.transpose(1, 2).transpose(2, 3).contiguous().view(-1, c) log_p = log_p[target.view(n * h * w, 1).repeat(1, c) >= 0] log_p = log_p.view(-1, c) mask = target >= 0 target = targe...
def cross_entropy2d(input, target, weight=None, size_average=True):
n, c, h, w = input.size() log_p = F.log_softmax(input) log_p = log_p.transpose(1, 2).transpose(2, 3).contiguous().view(-1, c) log_p = log_p[target.view(n * h * w, 1).repeat(1, c) >= 0] log_p = log_p.view(-1, c) mask = target >= 0 target = target[mask] # print('log_p ', log_p.size()) # print('target ', target....
import torch import numpy as np import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable DEBUG = False def log(s): if DEBUG: print(s) def cross_entropy2d(input, target, weight=None, size_average=True):
59
66
222
16
43
donghaozhang/fast_segmentation
ptsemseg/loss.py
Python
cross_entropy2d
cross_entropy2d
15
34
15
15
5851d7ff4961a5838bd00fa0e9a06a0d751ed19a
bigcode/the-stack
train
d0e362c1b566234a74100d52
train
function
def test_cookie_not_secure(): kaka = make_cookie("test", "data", b"1234567890abcdefg", secure=False) assert "Secure" not in kaka[1] assert "HttpOnly" in kaka[1]
def test_cookie_not_secure():
kaka = make_cookie("test", "data", b"1234567890abcdefg", secure=False) assert "Secure" not in kaka[1] assert "HttpOnly" in kaka[1]
in kaka[1] def test_cookie_http_only_false(): kaka = make_cookie("test", "data", b"1234567890abcdefg", http_only=False) assert "Secure" in kaka[1] assert "HttpOnly" not in kaka[1] def test_cookie_not_secure():
64
64
51
6
58
IdentityPython/idpy-oidc
tests/test_client_15_cookie.py
Python
test_cookie_not_secure
test_cookie_not_secure
157
160
157
157
4e20d9c77405fa3f05b42d746bc2bc214d66d8cb
bigcode/the-stack
train
7d507fe2feee63619c6371ac
train
class
class TestCookieDealer(object): def test_create_cookie_value(self, cookie_dealer): cookie_value = "Something to pass along" cookie_typ = "sso" cookie_name = "Foobar" kaka = cookie_dealer.create_cookie(cookie_value, cookie_typ, cookie_name) value, timestamp, typ = cookie_deal...
class TestCookieDealer(object):
def test_create_cookie_value(self, cookie_dealer): cookie_value = "Something to pass along" cookie_typ = "sso" cookie_name = "Foobar" kaka = cookie_dealer.create_cookie(cookie_value, cookie_typ, cookie_name) value, timestamp, typ = cookie_dealer.get_cookie_value(kaka[1], "Fo...
.cookie import CookieDealer from idpyoidc.client.cookie import InvalidCookieSign from idpyoidc.client.cookie import cookie_parts from idpyoidc.client.cookie import cookie_signature from idpyoidc.client.cookie import make_cookie from idpyoidc.client.cookie import parse_cookie from idpyoidc.client.cookie import verify_co...
149
149
499
6
143
IdentityPython/idpy-oidc
tests/test_client_15_cookie.py
Python
TestCookieDealer
TestCookieDealer
27
91
27
27
f1be008fb48d440552523caaf7c850084b4a8379
bigcode/the-stack
train
af574faaec66ad1f47273b87
train
function
def test_cookie_signature(): key = b"1234567890abcdef" parts = ["abc", "def"] sig = cookie_signature(key, *parts) assert verify_cookie_signature(sig, key, *parts)
def test_cookie_signature():
key = b"1234567890abcdef" parts = ["abc", "def"] sig = cookie_signature(key, *parts) assert verify_cookie_signature(sig, key, *parts)
_typ = "sso" cookie_name = "Foobar" kaka = cookie_dealer.create_cookie(cookie_value, cookie_typ, cookie_name) C = SimpleCookie() C.load(kaka[1]) assert C[cookie_name]["path"] == "/oidc" def test_cookie_signature():
64
64
47
5
59
IdentityPython/idpy-oidc
tests/test_client_15_cookie.py
Python
test_cookie_signature
test_cookie_signature
94
98
94
94
182dfed35a6de937acbee3232956a9e2ae83aa73
bigcode/the-stack
train
2ea56504469694a8b0e49d0d
train
function
def test_parse_manipulated_cookie_timestamp(): kaka = "pyoidc=bjmc::1463043535::upm|" "1463043537|18a201305fa15a96ce4048e1fbb03f7715f86499" seed = b"" name = "pyoidc" with pytest.raises(InvalidCookieSign): parse_cookie(name, seed, kaka)
def test_parse_manipulated_cookie_timestamp():
kaka = "pyoidc=bjmc::1463043535::upm|" "1463043537|18a201305fa15a96ce4048e1fbb03f7715f86499" seed = b"" name = "pyoidc" with pytest.raises(InvalidCookieSign): parse_cookie(name, seed, kaka)
a201305fa15a96ce4048e1fbb03f7715f86499" seed = b"" name = "pyoidc" with pytest.raises(InvalidCookieSign): parse_cookie(name, seed, kaka) def test_parse_manipulated_cookie_timestamp():
64
64
91
9
55
IdentityPython/idpy-oidc
tests/test_client_15_cookie.py
Python
test_parse_manipulated_cookie_timestamp
test_parse_manipulated_cookie_timestamp
125
130
125
125
c95d156f2c7b59d4b5facbf369d3d10914cfad9b
bigcode/the-stack
train
0a3a425e665c4fea218badd3
train
function
def test_parse_cookie(): kaka = "pyoidc=bjmc::1463043535::upm|" "1463043535|18a201305fa15a96ce4048e1fbb03f7715f86499" seed = b"" name = "pyoidc" result = parse_cookie(name, seed, kaka) assert result == ("bjmc::1463043535::upm", "1463043535")
def test_parse_cookie():
kaka = "pyoidc=bjmc::1463043535::upm|" "1463043535|18a201305fa15a96ce4048e1fbb03f7715f86499" seed = b"" name = "pyoidc" result = parse_cookie(name, seed, kaka) assert result == ("bjmc::1463043535::upm", "1463043535")
key, *parts) def test_broken_cookie_signature(): key = b"1234567890abcdef" parts = ["abc", "def"] sig = cookie_signature(key, *parts) parts.reverse() assert not verify_cookie_signature(sig, key, *parts) def test_parse_cookie():
64
64
102
5
59
IdentityPython/idpy-oidc
tests/test_client_15_cookie.py
Python
test_parse_cookie
test_parse_cookie
109
114
109
109
6e39aef437e4806657507ebfaf0a500c2e7ca30c
bigcode/the-stack
train
58779810dafd4f0580cd05dd
train
function
def test_cookie_same_site_none(): kaka = make_cookie("test", "data", b"1234567890abcdefg", same_site="None") assert "SameSite=None" in kaka[1]
def test_cookie_same_site_none():
kaka = make_cookie("test", "data", b"1234567890abcdefg", same_site="None") assert "SameSite=None" in kaka[1]
not in kaka[1] def test_cookie_not_secure(): kaka = make_cookie("test", "data", b"1234567890abcdefg", secure=False) assert "Secure" not in kaka[1] assert "HttpOnly" in kaka[1] def test_cookie_same_site_none():
64
64
44
7
57
IdentityPython/idpy-oidc
tests/test_client_15_cookie.py
Python
test_cookie_same_site_none
test_cookie_same_site_none
163
165
163
163
47c2de577e092693d3bf2a7063765959d9507464
bigcode/the-stack
train
9b075dc67690c6a17c15fbae
train
function
def test_cookie_parts(): name = "pyoidc" kaka = "pyoidc=bjmc::1463043535::upm|" "1463043535|18a201305fa15a96ce4048e1fbb03f7715f86499" result = cookie_parts(name, kaka) assert result == [ "bjmc::1463043535::upm", "1463043535", "18a201305fa15a96ce4048e1fbb03f7715f86499", ]
def test_cookie_parts():
name = "pyoidc" kaka = "pyoidc=bjmc::1463043535::upm|" "1463043535|18a201305fa15a96ce4048e1fbb03f7715f86499" result = cookie_parts(name, kaka) assert result == [ "bjmc::1463043535::upm", "1463043535", "18a201305fa15a96ce4048e1fbb03f7715f86499", ]
3537|18a201305fa15a96ce4048e1fbb03f7715f86499" seed = b"" name = "pyoidc" with pytest.raises(InvalidCookieSign): parse_cookie(name, seed, kaka) def test_cookie_parts():
64
64
124
5
59
IdentityPython/idpy-oidc
tests/test_client_15_cookie.py
Python
test_cookie_parts
test_cookie_parts
133
141
133
133
7bf360431be89406424187698c620d85231bc209
bigcode/the-stack
train
5bb45e76c55d4125ea6d493a
train
function
def test_cookie_default(): kaka = make_cookie("test", "data", b"1234567890abcdefg") assert "Secure" in kaka[1] assert "HttpOnly" in kaka[1] assert "SameSite" not in kaka[1]
def test_cookie_default():
kaka = make_cookie("test", "data", b"1234567890abcdefg") assert "Secure" in kaka[1] assert "HttpOnly" in kaka[1] assert "SameSite" not in kaka[1]
cookie_parts(name, kaka) assert result == [ "bjmc::1463043535::upm", "1463043535", "18a201305fa15a96ce4048e1fbb03f7715f86499", ] def test_cookie_default():
63
64
58
5
58
IdentityPython/idpy-oidc
tests/test_client_15_cookie.py
Python
test_cookie_default
test_cookie_default
144
148
144
144
658f60627ec71ab49638721009ad04c1ba8e40f4
bigcode/the-stack
train
124ec657add5da6ef259bc63
train
function
def test_broken_cookie_signature(): key = b"1234567890abcdef" parts = ["abc", "def"] sig = cookie_signature(key, *parts) parts.reverse() assert not verify_cookie_signature(sig, key, *parts)
def test_broken_cookie_signature():
key = b"1234567890abcdef" parts = ["abc", "def"] sig = cookie_signature(key, *parts) parts.reverse() assert not verify_cookie_signature(sig, key, *parts)
ookie_name]["path"] == "/oidc" def test_cookie_signature(): key = b"1234567890abcdef" parts = ["abc", "def"] sig = cookie_signature(key, *parts) assert verify_cookie_signature(sig, key, *parts) def test_broken_cookie_signature():
64
64
54
7
57
IdentityPython/idpy-oidc
tests/test_client_15_cookie.py
Python
test_broken_cookie_signature
test_broken_cookie_signature
101
106
101
101
6624b8f2c89150ea1c83ee9f9454770bb99b33c6
bigcode/the-stack
train
c67e1e8ff7aa49f344952085
train
function
def test_cookie_http_only_false(): kaka = make_cookie("test", "data", b"1234567890abcdefg", http_only=False) assert "Secure" in kaka[1] assert "HttpOnly" not in kaka[1]
def test_cookie_http_only_false():
kaka = make_cookie("test", "data", b"1234567890abcdefg", http_only=False) assert "Secure" in kaka[1] assert "HttpOnly" not in kaka[1]
test_cookie_default(): kaka = make_cookie("test", "data", b"1234567890abcdefg") assert "Secure" in kaka[1] assert "HttpOnly" in kaka[1] assert "SameSite" not in kaka[1] def test_cookie_http_only_false():
64
64
53
7
57
IdentityPython/idpy-oidc
tests/test_client_15_cookie.py
Python
test_cookie_http_only_false
test_cookie_http_only_false
151
154
151
151
642dc8920afd2dc50d2f1a737fc50c40a450e75c
bigcode/the-stack
train
fa024dbadfc86795fc1e140c
train
function
@pytest.fixture def cookie_dealer(): class DummyServer: def __init__(self): self.symkey = b"0123456789012345" return CookieDealer(DummyServer())
@pytest.fixture def cookie_dealer():
class DummyServer: def __init__(self): self.symkey = b"0123456789012345" return CookieDealer(DummyServer())
yoidc.client.cookie import make_cookie from idpyoidc.client.cookie import parse_cookie from idpyoidc.client.cookie import verify_cookie_signature from idpyoidc.client.exception import ImproperlyConfigured __author__ = "roland" @pytest.fixture def cookie_dealer():
64
64
42
8
56
IdentityPython/idpy-oidc
tests/test_client_15_cookie.py
Python
cookie_dealer
cookie_dealer
18
24
18
19
36dd77ec74701ec821512b242dbf3a9c34b0101c
bigcode/the-stack
train
4c5e505e7855eabea5acf67a
train
function
def test_parse_manipulated_cookie_payload(): kaka = "pyoidc=bjmc::1463043536::upm|" "1463043535|18a201305fa15a96ce4048e1fbb03f7715f86499" seed = b"" name = "pyoidc" with pytest.raises(InvalidCookieSign): parse_cookie(name, seed, kaka)
def test_parse_manipulated_cookie_payload():
kaka = "pyoidc=bjmc::1463043536::upm|" "1463043535|18a201305fa15a96ce4048e1fbb03f7715f86499" seed = b"" name = "pyoidc" with pytest.raises(InvalidCookieSign): parse_cookie(name, seed, kaka)
f7715f86499" seed = b"" name = "pyoidc" result = parse_cookie(name, seed, kaka) assert result == ("bjmc::1463043535::upm", "1463043535") def test_parse_manipulated_cookie_payload():
64
64
91
9
55
IdentityPython/idpy-oidc
tests/test_client_15_cookie.py
Python
test_parse_manipulated_cookie_payload
test_parse_manipulated_cookie_payload
117
122
117
117
fe1e912bfaaf2394946ed14d5866e7113d26a8e7
bigcode/the-stack
train
707a8cd4ebd64fb1230924ac
train
function
def modelarts_pre_process(): '''modelarts pre process function.''' config.file_name = os.path.join(config.output_path, config.file_name)
def modelarts_pre_process():
'''modelarts pre process function.''' config.file_name = os.path.join(config.output_path, config.file_name)
mindspore import Tensor from mindspore.train.serialization import export, load_checkpoint, load_param_into_net from src.FaceAttribute.resnet18_softmax import get_resnet18 from model_utils.config import config from model_utils.moxing_adapter import moxing_wrapper def modelarts_pre_process():
64
64
31
6
57
LottieWang/mindspore
model_zoo/research/cv/FaceAttribute/export.py
Python
modelarts_pre_process
modelarts_pre_process
28
30
28
28
b2ed639b2e1ec12f673d81ebf880a3798a209695
bigcode/the-stack
train
521081cc0fe61f8d8c95d7b8
train
function
@moxing_wrapper(pre_process=modelarts_pre_process) def run_export(): '''run export.''' devid = 0 context.set_context(mode=context.GRAPH_MODE, device_target=config.device_target, save_graphs=False, device_id=devid) network = get_resnet18(config) ckpt_path = config.ckpt_file if os.path.is...
@moxing_wrapper(pre_process=modelarts_pre_process) def run_export():
'''run export.''' devid = 0 context.set_context(mode=context.GRAPH_MODE, device_target=config.device_target, save_graphs=False, device_id=devid) network = get_resnet18(config) ckpt_path = config.ckpt_file if os.path.isfile(ckpt_path): param_dict = load_checkpoint(ckpt_path) ...
.FaceAttribute.resnet18_softmax import get_resnet18 from model_utils.config import config from model_utils.moxing_adapter import moxing_wrapper def modelarts_pre_process(): '''modelarts pre process function.''' config.file_name = os.path.join(config.output_path, config.file_name) @moxing_wrapper(pre_pr...
79
79
266
15
64
LottieWang/mindspore
model_zoo/research/cv/FaceAttribute/export.py
Python
run_export
run_export
32
60
32
33
e1d4b2af06dafcf7ad900a085307ba73018c4de1
bigcode/the-stack
train
dd1ea53961cdd1e5b90e0aab
train
class
class Solution: # Heap-Based Simulation def lastStoneWeight(self, stones: list[int]) -> int: for i in range(len(stones)): stones[i] *= -1 heapq.heapify(stones) while len(stones) > 1: stone1, stone2 = heapq.heappop(stones), heapq.heappop(stones) if st...
class Solution: # Heap-Based Simulation
def lastStoneWeight(self, stones: list[int]) -> int: for i in range(len(stones)): stones[i] *= -1 heapq.heapify(stones) while len(stones) > 1: stone1, stone2 = heapq.heappop(stones), heapq.heappop(stones) if stone1 != stone2: heapq.heappu...
# Runtime: 32 ms, faster than 70.58% of Python3 online submissions for Last Stone Weight. # Memory Usage: 14.4 MB, less than 21.02% of Python3 online submissions for Last Stone Weight. import heapq class Solution: # Heap-Based Simulation
64
64
121
9
54
czs108/LeetCode-Solutions
Easy/1046. Last Stone Weight/solution (3).py
Python
Solution
Solution
10
22
10
11
fc687145d4d731149067c4a861cc4cf5d60c229c
bigcode/the-stack
train
3b3dbb3a650b177d3c3ccb83
train
function
def Main(): """SQC Main Function.""" global cp if QCSafety: something_bad_happened = Forward() QCBroken = EUDLightVariable() DoActions([QCBroken.SetNumber(0), cp.SetNumber(min(human))]) _EUDHumanLoop()() for i in EUDLoopRange(QCCount): _restore_nextptr, _s...
def Main():
"""SQC Main Function.""" global cp if QCSafety: something_bad_happened = Forward() QCBroken = EUDLightVariable() DoActions([QCBroken.SetNumber(0), cp.SetNumber(min(human))]) _EUDHumanLoop()() for i in EUDLoopRange(QCCount): _restore_nextptr, _skip = Forwar...
0, SetTo, EPD(buf) + 1)]) cw.writebyte(n) for _ in EUDLoopRange(n): unitepd = f_epdcunitread_epd(ptrListepd) unitIndex = _epd2alphaid(unitepd) uniquenessIdentifier = f_bread_epd(unitepd + 0xA5 // 4, 0xA5 % 4) targetID = unitIndex + f_bitlshift(uniquenessIdentifier, 11) b0...
256
256
1,604
3
253
Chromowolf/euddraft
lib/sqc.py
Python
Main
Main
597
751
597
597
f4a0fbf7db87f9f2cb4f956da3504aa9d29b400b
bigcode/the-stack
train
cc539dc84c783619efef500f
train
function
def KeyUp(k): """Occurs when a key is released.""" try: offset = KeyCodeDict[k.upper()] except (KeyError): raise EPError("%s doesn't exist in VirtualKeyCode." % (k)) else: KeyOffset.add(offset) m = 256 ** (offset % 4) n = 2 ** (offset % 32) return [ # Key...
def KeyUp(k):
"""Occurs when a key is released.""" try: offset = KeyCodeDict[k.upper()] except (KeyError): raise EPError("%s doesn't exist in VirtualKeyCode." % (k)) else: KeyOffset.add(offset) m = 256 ** (offset % 4) n = 2 ** (offset % 32) return [ # KeyUp ...
n = 2 ** (offset % 32) return [ # KeyDown MemoryX(0x596A18 + offset, Exactly, m, m), MemoryX(KeyArray + offset // 8, Exactly, 0, n), ] def KeyUp(k):
63
64
128
5
58
Chromowolf/euddraft
lib/sqc.py
Python
KeyUp
KeyUp
140
153
140
140
a63cc68546f501323989dc41ba3cbbfc399dc788
bigcode/the-stack
train
d5744ab96a36210dab715b5f
train
function
def _bitXY(): for x in range(mapX): yield 2 ** x for y in range(mapY): yield 2 ** (16 + y)
def _bitXY():
for x in range(mapX): yield 2 ** x for y in range(mapY): yield 2 ** (16 + y)
GameCommand(buf + 3, f_bitlshift(n + 1, 1)) def _chunks(l, n): """Yield successive n-sized _chunks from l.""" for i in range(0, len(l), n): yield l[i : i + n] def _bitXY():
64
64
38
5
59
Chromowolf/euddraft
lib/sqc.py
Python
_bitXY
_bitXY
590
594
590
590
16017fea4033ac54652da09b31dde64265b20f2e
bigcode/the-stack
train
22a8eec01af8f56e45711c7f
train
function
def Start(): """Call this function in onPluginStart.""" global localcp localcp = f_dwread_epd(EPD(0x57F1B0)) DoActions([SetMemory(act + 20, SetTo, localcp) for act in setlocalcp]) _Respawn()
def Start():
"""Call this function in onPluginStart.""" global localcp localcp = f_dwread_epd(EPD(0x57F1B0)) DoActions([SetMemory(act + 20, SetTo, localcp) for act in setlocalcp]) _Respawn()
[3]), SetMemoryEPD(LocEPD + 4, SetTo, LOC_TEMP[4]), # Editor Ability Flags SetMemoryX(0x661518 + q2, SetTo, 0, 0xFFFF * p2), ] ) def Start():
64
64
68
3
61
Chromowolf/euddraft
lib/sqc.py
Python
Start
Start
548
553
548
548
f90261ecc29d26c6adc0d2f35b3ce6921dda716c
bigcode/the-stack
train
f5b87fd1c652c36cb84f1717
train
function
def _EUDHumanLoop(): def _footer(): block = {"origcp": f_getcurpl(), "playerv": cp} playerv = block["playerv"] minp, maxp = min(human), max(human) EUDWhile()(cp.AtMost(maxp)) for p in range(minp, maxp): if p not in human: EUDContinueIf(cp.Exactly(...
def _EUDHumanLoop():
def _footer(): block = {"origcp": f_getcurpl(), "playerv": cp} playerv = block["playerv"] minp, maxp = min(human), max(human) EUDWhile()(cp.AtMost(maxp)) for p in range(minp, maxp): if p not in human: EUDContinueIf(cp.Exactly(p)) EUDContin...
append(action_or_function) def AddAfter(action_or_function): """Register initialization action or function. Run at the end of Main function.""" if callable(action_or_function): AfterList.append(action_or_function) else: AfterList[0].append(action_or_function) def _EUDHumanLoop():
64
64
140
7
57
Chromowolf/euddraft
lib/sqc.py
Python
_EUDHumanLoop
_EUDHumanLoop
381
397
381
381
5385b970c33091f4026804e7cf76e3bc81d08d77
bigcode/the-stack
train
95531629cb43e095dc9749f3
train
function
def _MouseUpdate(k): RawTrigger( conditions=[ # MouseDown MemoryX(0x6CDDC0, Exactly, k, k), MemoryX(MouseArray, Exactly, 0, k), ], actions=SetMemoryX(MouseArray, SetTo, k, k), ) RawTrigger( conditions=[ # MouseUp MemoryX(0x6CDDC0, Exactly...
def _MouseUpdate(k):
RawTrigger( conditions=[ # MouseDown MemoryX(0x6CDDC0, Exactly, k, k), MemoryX(MouseArray, Exactly, 0, k), ], actions=SetMemoryX(MouseArray, SetTo, k, k), ) RawTrigger( conditions=[ # MouseUp MemoryX(0x6CDDC0, Exactly, 0, k), ...
0) MouseButtonDict = {"L": 2, "LEFT": 2, "R": 8, "RIGHT": 8, "M": 32, "MIDDLE": 32} MouseArray = EUDArray(1) MouseOffset = set() def _MouseUpdate(k):
64
64
131
6
58
Chromowolf/euddraft
lib/sqc.py
Python
_MouseUpdate
_MouseUpdate
177
191
177
177
dffa44e976265e5b34ba2218c5d28a3b44996e85
bigcode/the-stack
train
bfb0e9236377a4085bcc009a
train
function
def KeyPress(k): """Occurs while a key is pressed.""" try: offset = KeyCodeDict[k.upper()] except (KeyError): raise EPError("%s doesn't exist in VirtualKeyCode." % (k)) else: m = 256 ** (offset % 4) return MemoryX(0x596A18 + offset, Exactly, m, m)
def KeyPress(k):
"""Occurs while a key is pressed.""" try: offset = KeyCodeDict[k.upper()] except (KeyError): raise EPError("%s doesn't exist in VirtualKeyCode." % (k)) else: m = 256 ** (offset % 4) return MemoryX(0x596A18 + offset, Exactly, m, m)
n = 2 ** (offset % 32) return [ # KeyUp MemoryX(0x596A18 + offset, Exactly, 0, m), MemoryX(KeyArray + offset // 8, Exactly, n, n), ] def KeyPress(k):
63
64
83
5
58
Chromowolf/euddraft
lib/sqc.py
Python
KeyPress
KeyPress
156
164
156
156
72c130b2dff7860efbbfe61fbe69c089abc2772b
bigcode/the-stack
train
9d8a873c3a30b5fd8d30d54a
train
function
def AddAfter(action_or_function): """Register initialization action or function. Run at the end of Main function.""" if callable(action_or_function): AfterList.append(action_or_function) else: AfterList[0].append(action_or_function)
def AddAfter(action_or_function):
"""Register initialization action or function. Run at the end of Main function.""" if callable(action_or_function): AfterList.append(action_or_function) else: AfterList[0].append(action_or_function)
, action_or_function)) def AddBefore(action_or_function): """Register initialization action or function. Run at the start of Main function.""" if callable(action_or_function): InitList.append(action_or_function) else: InitList[0].append(action_or_function) def AddAfter(action_or_function):...
64
64
52
7
57
Chromowolf/euddraft
lib/sqc.py
Python
AddAfter
AddAfter
373
378
373
373
b00c27d68577ac92a288f2d88681a35d45ec02f1
bigcode/the-stack
train
256d0479fcbae60884822d7d
train
function
def _onInit(): chkt = GetChkTokenized() dim, ownr = chkt.getsection("DIM"), chkt.getsection("OWNR") dim_x, dim_y = b2i2(dim[0:2]), b2i2(dim[2:4]) global mapX, mapY, mapXY, human, MapXY mapX, mapY = dim_x.bit_length() + 3, dim_y.bit_length() + 3 mapXY = mapX + mapY Map_X, Map_Y = (dim_x - 1)....
def _onInit():
chkt = GetChkTokenized() dim, ownr = chkt.getsection("DIM"), chkt.getsection("OWNR") dim_x, dim_y = b2i2(dim[0:2]), b2i2(dim[2:4]) global mapX, mapY, mapXY, human, MapXY mapX, mapY = dim_x.bit_length() + 3, dim_y.bit_length() + 3 mapXY = mapX + mapY Map_X, Map_Y = (dim_x - 1).bit_length() + ...
Dict[k.upper()] except (KeyError): raise EPError("%s is NOT a MouseButton. Use 'L', 'R' or 'M'." % (k)) else: return MemoryX(0x6CDDC0, Exactly, v, v) def _onInit():
64
64
196
5
59
Chromowolf/euddraft
lib/sqc.py
Python
_onInit
_onInit
232
241
232
232
aa9d0a8086a38f228bb810378db7e5c38c04d3e9
bigcode/the-stack
train
db234964af8c3afad3a766fb
train
function
def _IsMouseMoved(): global _counter, mouseX, mouseY b = next(XYPool) v = mouseY if _counter > mapX else mouseX c = MemoryX(v.getValueAddr(), Exactly, b, b) _counter += 1 return [ismousemoved.AtLeast(1), c]
def _IsMouseMoved():
global _counter, mouseX, mouseY b = next(XYPool) v = mouseY if _counter > mapX else mouseX c = MemoryX(v.getValueAddr(), Exactly, b, b) _counter += 1 return [ismousemoved.AtLeast(1), c]
UDVariable() pv5 = EUDVariable() XYPool = cycle(MapXY) _counter = 0 InitList[0].append([pv5.SetNumber(min(human) * 5 + EPD(0x58DC60)), _once.SetNumber(-1)]) def _IsMouseMoved():
63
64
77
6
57
Chromowolf/euddraft
lib/sqc.py
Python
_IsMouseMoved
_IsMouseMoved
301
307
301
301
fdce4a69613cc66a899ce2fab5ea265c53f5c524
bigcode/the-stack
train
71b87511a095d0f15be4f7ed
train
function
def _chunks(l, n): """Yield successive n-sized _chunks from l.""" for i in range(0, len(l), n): yield l[i : i + n]
def _chunks(l, n):
"""Yield successive n-sized _chunks from l.""" for i in range(0, len(l), n): yield l[i : i + n]
break(targetID)[2:4] cw.writebyte(b0) cw.writebyte(b1) ptrListepd += 1 cw.flushdword() QueueGameCommand(buf + 3, f_bitlshift(n + 1, 1)) def _chunks(l, n):
64
64
40
7
57
Chromowolf/euddraft
lib/sqc.py
Python
_chunks
_chunks
584
587
584
584
62d54d2aaa7bafd1f8bd94bb59641fe4d3d6b9a9
bigcode/the-stack
train
aa0bb06f080631e572897c09
train
function
def AddNot(condition, action_or_function): """Register local (desync) event, execute sync action or function when False.""" QCList.append((EUDIfNot, condition, action_or_function))
def AddNot(condition, action_or_function):
"""Register local (desync) event, execute sync action or function when False.""" QCList.append((EUDIfNot, condition, action_or_function))
AddQC(_IsMouseMoved(), _AddLoc(loc)) def AddQC(condition, action_or_function): """Register local (desync) event, execute sync action or function when True.""" QCList.append((EUDIf, condition, action_or_function)) def AddNot(condition, action_or_function):
64
64
43
9
55
Chromowolf/euddraft
lib/sqc.py
Python
AddNot
AddNot
360
362
360
360
c07b0076d9782cea087ae68aafb02861ffe5a44b
bigcode/the-stack
train
7382a12a0be86f6a5de36378
train
function
def NotTyping(): """Occurs when messaging is closed.""" return Memory(0x68C144, Exactly, 0)
def NotTyping():
"""Occurs when messaging is closed.""" return Memory(0x68C144, Exactly, 0)
[k.upper()] except (KeyError): raise EPError("%s doesn't exist in VirtualKeyCode." % (k)) else: m = 256 ** (offset % 4) return MemoryX(0x596A18 + offset, Exactly, m, m) def NotTyping():
64
64
27
4
60
Chromowolf/euddraft
lib/sqc.py
Python
NotTyping
NotTyping
167
169
167
167
4425431d399283b26d5d3e915e055c87e9b67b03
bigcode/the-stack
train
be2ef8347c1acd163078085d
train
function
def _AddLoc(loc, _fdict={}): if loc in _fdict: return _fdict[loc] else: def _f(_firstcall=[]): global _counter, _once if loc not in _firstcall: _firstcall.append(loc) _counter = 0 lc = 5 * loc if EUDIfNot()(_once ==...
def _AddLoc(loc, _fdict={}):
if loc in _fdict: return _fdict[loc] else: def _f(_firstcall=[]): global _counter, _once if loc not in _firstcall: _firstcall.append(loc) _counter = 0 lc = 5 * loc if EUDIfNot()(_once == cp): _once <...
1)]) def _IsMouseMoved(): global _counter, mouseX, mouseY b = next(XYPool) v = mouseY if _counter > mapX else mouseX c = MemoryX(v.getValueAddr(), Exactly, b, b) _counter += 1 return [ismousemoved.AtLeast(1), c] def _AddLoc(loc, _fdict={}):
91
91
304
11
80
Chromowolf/euddraft
lib/sqc.py
Python
_AddLoc
_AddLoc
310
344
310
310
03fe90edc3f92eaa5ad99b535603ae46be2e4ea5
bigcode/the-stack
train
059569ab226d0899594fe792
train
function
def MouseMoveLocation(loc): """Move Locations to players' mouse position. Input first location index.""" loc = GetLocationIndex(loc) AddBefore(_UpdateMouseInfo) for _ in MapXY: AddQC(_IsMouseMoved(), _AddLoc(loc))
def MouseMoveLocation(loc):
"""Move Locations to players' mouse position. Input first location index.""" loc = GetLocationIndex(loc) AddBefore(_UpdateMouseInfo) for _ in MapXY: AddQC(_IsMouseMoved(), _AddLoc(loc))
EPD(pv5 + lc, Add, b), SetMemoryEPD(pv5 + (lc + 2), Add, b), ] ) _counter += 1 _fdict[loc] = _f return _f def MouseMoveLocation(loc):
64
64
57
6
57
Chromowolf/euddraft
lib/sqc.py
Python
MouseMoveLocation
MouseMoveLocation
347
352
347
347
ccc30ba22f63e81e6af91d73160a5bed91a9f6f8
bigcode/the-stack
train
58b9bc5d52a71e01685779e4
train
function
def AddQC(condition, action_or_function): """Register local (desync) event, execute sync action or function when True.""" QCList.append((EUDIf, condition, action_or_function))
def AddQC(condition, action_or_function):
"""Register local (desync) event, execute sync action or function when True.""" QCList.append((EUDIf, condition, action_or_function))
MoveLocation(loc): """Move Locations to players' mouse position. Input first location index.""" loc = GetLocationIndex(loc) AddBefore(_UpdateMouseInfo) for _ in MapXY: AddQC(_IsMouseMoved(), _AddLoc(loc)) def AddQC(condition, action_or_function):
64
64
42
9
55
Chromowolf/euddraft
lib/sqc.py
Python
AddQC
AddQC
355
357
355
355
378c60a83920f050cb4e9169fedf931fa10914cd
bigcode/the-stack
train
43a7bb65aa65cf47daa94882
train
function
def MousePress(k): """Occurs while a mouse button is pressed.""" try: v = MouseButtonDict[k.upper()] except (KeyError): raise EPError("%s is NOT a MouseButton. Use 'L', 'R' or 'M'." % (k)) else: return MemoryX(0x6CDDC0, Exactly, v, v)
def MousePress(k):
"""Occurs while a mouse button is pressed.""" try: v = MouseButtonDict[k.upper()] except (KeyError): raise EPError("%s is NOT a MouseButton. Use 'L', 'R' or 'M'." % (k)) else: return MemoryX(0x6CDDC0, Exactly, v, v)
or 'M'." % (k)) else: MouseOffset.add(v) return [ # MouseUp MemoryX(0x6CDDC0, Exactly, 0, v), MemoryX(MouseArray, Exactly, v, v), ] def MousePress(k):
63
64
82
5
58
Chromowolf/euddraft
lib/sqc.py
Python
MousePress
MousePress
222
229
222
222
05484805ff926669dce38b37efea1ef3147ae2f7
bigcode/the-stack
train
4a3b13fc23ce4a91415ed043
train
function
def _EUDEndHumanLoop(): block = EUDPopBlock("hloopblock")[1] playerv = block["playerv"] origcp = block["origcp"] if not EUDIsContinuePointSet(): EUDSetContinuePoint() EUDEndWhile() f_setcurpl(origcp)
def _EUDEndHumanLoop():
block = EUDPopBlock("hloopblock")[1] playerv = block["playerv"] origcp = block["origcp"] if not EUDIsContinuePointSet(): EUDSetContinuePoint() EUDEndWhile() f_setcurpl(origcp)
EUDContinueIf(cp.Exactly(p)) EUDContinueIfNot(f_playerexist(playerv)) f_setcurpl(playerv) EUDCreateBlock("hloopblock", block) return True return CtrlStruOpener(_footer) def _EUDEndHumanLoop():
64
64
71
8
56
Chromowolf/euddraft
lib/sqc.py
Python
_EUDEndHumanLoop
_EUDEndHumanLoop
400
409
400
400
19622991550cdc2cc683bf99f376c006053c6f53
bigcode/the-stack
train
bbe9b16ea0bdff1ebbded34b
train
function
@EUDFunc def _epd2alphaid(epd): # return (ptr - 0x59CCA8) // 336 + 1 # return (ptr - 56) // 336 - 17514 # (epd * 4 + 0x58A364 - 56) // 336 - 17514 # (epd * 4 + 1452235 * 4) // 336 - 17514 EUDReturn((epd + 43) // 84 - 226)
@EUDFunc def _epd2alphaid(epd): # return (ptr - 0x59CCA8) // 336 + 1 # return (ptr - 56) // 336 - 17514 # (epd * 4 + 0x58A364 - 56) // 336 - 17514 # (epd * 4 + 1452235 * 4) // 336 - 17514
EUDReturn((epd + 43) // 84 - 226)
@EUDFunc def _epd2alphaid(epd): # return (ptr - 0x59CCA8) // 336 + 1 # return (ptr - 56) // 336 - 17514 # (epd * 4 + 0x58A364 - 56) // 336 - 17514 # (epd * 4 + 1452235 * 4) // 336 - 17514
104
64
122
104
0
Chromowolf/euddraft
lib/sqc.py
Python
_epd2alphaid
_epd2alphaid
412
418
412
417
29f1da97c01a41defb95342a75589ea6a31acc08
bigcode/the-stack
train
6aa1b84154a260be6b77614c
train
function
@EUDFunc def _QueueGameCommand_Select(): buf = Db(b"..\x09\x0112..") DoActions([SelectIndex << SetMemory(buf + 4, SetTo, 0xEDAC)]) QueueGameCommand(buf + 2, 4)
@EUDFunc def _QueueGameCommand_Select():
buf = Db(b"..\x09\x0112..") DoActions([SelectIndex << SetMemory(buf + 4, SetTo, 0xEDAC)]) QueueGameCommand(buf + 2, 4)
= f_dwread_epd(EPD(0x57F1B0)) DoActions([SetMemory(act + 20, SetTo, localcp) for act in setlocalcp]) _Respawn() SelectIndex = Forward() @EUDFunc def _QueueGameCommand_Select():
64
64
61
12
52
Chromowolf/euddraft
lib/sqc.py
Python
_QueueGameCommand_Select
_QueueGameCommand_Select
559
563
559
560
2bb5f76f97b0497b8a7f66493d13f77d8077c114
bigcode/the-stack
train
b4dc89be0d9422abaff646a1
train
function
@EUDFunc def _Respawn(): q4, m4 = divmod(QCUnit, 4) q2, m2 = divmod(QCUnit, 2) p4, p2 = 256 ** m4, 65536 ** m2 q4, q2 = 4 * q4, 4 * q2 LOC_TEMP, LocEPD = EUDArray(5), EPD(0x58DC60) + QCLoc * 5 global cp DoActions( [ # Units.dat # Unit Dimensions, Building Dimensions ...
@EUDFunc def _Respawn():
q4, m4 = divmod(QCUnit, 4) q2, m2 = divmod(QCUnit, 2) p4, p2 = 256 ** m4, 65536 ** m2 q4, q2 = 4 * q4, 4 * q2 LOC_TEMP, LocEPD = EUDArray(5), EPD(0x58DC60) + QCLoc * 5 global cp DoActions( [ # Units.dat # Unit Dimensions, Building Dimensions SetMemory(0x6617C...
If(cp.Exactly(p)) EUDContinueIfNot(f_playerexist(playerv)) f_setcurpl(playerv) EUDCreateBlock("hloopblock", block) return True return CtrlStruOpener(_footer) def _EUDEndHumanLoop(): block = EUDPopBlock("hloopblock")[1] playerv = block["playerv"] origcp = block["origcp...
256
256
1,782
10
246
Chromowolf/euddraft
lib/sqc.py
Python
_Respawn
_Respawn
421
545
421
422
719d03d2f1c6c6f44a7384d829eaf284e67e41b1
bigcode/the-stack
train