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
8249ea60ae621fd14f49a609
train
class
class KRGWAC(lib.StreamObject): linearized = getattr(__config__, 'gw_gw_GW_linearized', False) # Analytic continuation: pade or twopole ac = getattr(__config__, 'gw_gw_GW_ac', 'pade') # Whether applying finite size corrections fc = getattr(__config__, 'gw_gw_GW_fc', True) def __init__(self, mf...
class KRGWAC(lib.StreamObject):
linearized = getattr(__config__, 'gw_gw_GW_linearized', False) # Analytic continuation: pade or twopole ac = getattr(__config__, 'gw_gw_GW_ac', 'pade') # Whether applying finite size corrections fc = getattr(__config__, 'gw_gw_GW_fc', True) def __init__(self, mf, frozen=0): self.mol = m...
ytic continuation to real axis using a Pade approximation from Thiele's reciprocal difference method Reference: J. Low Temp. Phys. 29, 179 (1977) Returns: coeff: 2D array (ncoeff, norbs) omega: 2D array (norbs, npade) """ idx = range(1,40,6) sigma1 = sigma[:,idx].copy() sigma...
256
256
967
9
247
QuESt-Calculator/pyscf
pyscf/pbc/gw/krgw_ac.py
Python
KRGWAC
KRGWAC
533
640
533
534
ddd59fdbbb5b0b3e5cc71ea6f20db30a8b93d0ce
bigcode/the-stack
train
93d56ec577f8908845de949d
train
function
def AC_twopole_diag(sigma, omega, orbs, nocc): """ Analytic continuation to real axis using a two-pole model Returns: coeff: 2D array (ncoeff, norbs) """ norbs, nw = sigma.shape coeff = np.zeros((10,norbs)) for p in range(norbs): if orbs[p] < nocc: x0 = np.array([...
def AC_twopole_diag(sigma, omega, orbs, nocc):
""" Analytic continuation to real axis using a two-pole model Returns: coeff: 2D array (ncoeff, norbs) """ norbs, nw = sigma.shape coeff = np.zeros((10,norbs)) for p in range(norbs): if orbs[p] < nocc: x0 = np.array([0, 1, 1, 1, -1, 0, 0, 0, -1.0, -0.5]) e...
return np.array([f.real,f.imag]).reshape(-1) def two_pole(freqs, coeff): cf = coeff[:5] + 1j*coeff[5:] return cf[0] + cf[1]/(freqs+cf[3]) + cf[2]/(freqs+cf[4]) def AC_twopole_diag(sigma, omega, orbs, nocc):
88
88
294
17
71
QuESt-Calculator/pyscf
pyscf/pbc/gw/krgw_ac.py
Python
AC_twopole_diag
AC_twopole_diag
470
489
470
470
76641dcd25c3abd3a0c57f5817319d5400366388
bigcode/the-stack
train
84e0a19c75294cdfafdf8f6c
train
class
class SessionEnums(Enum): TOKEN_REVOKE_DELTA_IN_MINUTES = 15
class SessionEnums(Enum):
TOKEN_REVOKE_DELTA_IN_MINUTES = 15
from enum import Enum class SessionEnums(Enum):
10
64
19
5
4
vishu221b/bookme-flask-REST-API-Collection
enums/sessionEnums.py
Python
SessionEnums
SessionEnums
4
5
4
4
6de708d6fd20871df8adb029adcd5f156b951669
bigcode/the-stack
train
eeb884ec29cf5e66493692f6
train
function
def test_uniform(): rng = numpy.random.RandomState(1) def check_uniform(rng, mean, width, std, shape): weights = Uniform(mean=mean, width=width, std=std).generate(rng, shape) assert weights.shape == shape assert weights.dtype == theano.config.floatX ass...
def test_uniform():
rng = numpy.random.RandomState(1) def check_uniform(rng, mean, width, std, shape): weights = Uniform(mean=mean, width=width, std=std).generate(rng, shape) assert weights.shape == shape assert weights.dtype == theano.config.floatX assert_allclose(weights...
_gaussian, rng, 0, 1, (500, 600) yield check_gaussian, rng, 5, 3, (600, 500) assert str(IsotropicGaussian(1.0, 2.0)).endswith(' mean=2.0, std=1.0>') def test_uniform():
72
73
246
4
69
KIKOcaoyue/blocks
tests/test_initialization.py
Python
test_uniform
test_uniform
51
71
51
51
8de362cfa9e05b32bbeff2c522c460385d98e2c3
bigcode/the-stack
train
06a29343666b7ee694dbf1cd
train
function
def test_identity(): assert str(Identity(2.0)).endswith(' mult=2.0>')
def test_identity():
assert str(Identity(2.0)).endswith(' mult=2.0>')
2], [3]]), (3, 2), numpy.array([[1, 1], [2, 2], [3, 3]], dtype=theano.config.floatX)) assert str(Constant(1.0)).endswith(' constant=1.0>') def test_identity():
63
64
23
4
60
KIKOcaoyue/blocks
tests/test_initialization.py
Python
test_identity
test_identity
32
33
32
32
1b1504b395ed42bae286baad44d181facabe69b2
bigcode/the-stack
train
1f2c758d5d56c1d16759e7b4
train
function
def test_sparse(): rng = numpy.random.RandomState(1) def check_sparse(rng, num_init, weights_init, sparse_init, shape, total): weights = Sparse(num_init=num_init, weights_init=weights_init, sparse_init=sparse_init).generate(rng, shape) assert weights.shape == shape ...
def test_sparse():
rng = numpy.random.RandomState(1) def check_sparse(rng, num_init, weights_init, sparse_init, shape, total): weights = Sparse(num_init=num_init, weights_init=weights_init, sparse_init=sparse_init).generate(rng, shape) assert weights.shape == shape assert weights....
500, 600) yield check_uniform, rng, 0, None, 0.001, (600, 500) yield check_uniform, rng, 5, None, 0.004, (700, 300) assert_raises(ValueError, Uniform, 0, 1, 1) assert str(Uniform(1.0, 2.0)).endswith(' mean=1.0, width=2.0>') def test_sparse():
103
104
349
4
100
KIKOcaoyue/blocks
tests/test_initialization.py
Python
test_sparse
test_sparse
74
98
74
74
ff4fb9d2955188fce249736226afe25e92a26198
bigcode/the-stack
train
4d33faff1eab0e3fac02eff0
train
function
def test_sparse_nd(): rng = numpy.random.RandomState(1) def check_sparse(rng, axis, num_init, shape, weights_init=Constant(1.)): weights = SparseND(axis=axis, num_init=num_init, weights_init=weights_init).generate(rng, shape) assert weights.shape == shape asse...
def test_sparse_nd():
rng = numpy.random.RandomState(1) def check_sparse(rng, axis, num_init, shape, weights_init=Constant(1.)): weights = SparseND(axis=axis, num_init=num_init, weights_init=weights_init).generate(rng, shape) assert weights.shape == shape assert weights.dtype == th...
3, Constant(1.), None, (10, 10), 30 yield check_sparse, rng, 3, Constant(0.), Constant(1.), (10, 10), 70 yield check_sparse, rng, 0.3, Constant(1.), None, (10, 10), 30 yield check_sparse, rng, 0.3, Constant(0.), Constant(1.), (10, 10), 70 def test_sparse_nd():
105
105
351
5
99
KIKOcaoyue/blocks
tests/test_initialization.py
Python
test_sparse_nd
test_sparse_nd
101
126
101
101
c7e803afbd367edd9c5d9cb4998f348a72e280dd
bigcode/the-stack
train
6a296f6b7804882fd835e2ce
train
function
def test_orthogonal(): rng = numpy.random.RandomState(1) def check_orthogonal(rng, shape, scale=1.0): W = Orthogonal(scale).generate(rng, shape) assert W.shape == shape # For square matrices the following to should # be diagonal. For non-square matrices, we relax # a b...
def test_orthogonal():
rng = numpy.random.RandomState(1) def check_orthogonal(rng, shape, scale=1.0): W = Orthogonal(scale).generate(rng, shape) assert W.shape == shape # For square matrices the following to should # be diagonal. For non-square matrices, we relax # a bit. WWT = numpy...
11) yield check_sparse, rng, 2, 3, (7, 8, 9) yield check_sparse, rng, (2, 3), 5. / 6., (2, 3, 5, 7) yield check_sparse, rng, (0, 1), 3, (3, 5, 7, 11) yield check_sparse, rng, (0, 2, 3), 0.5, (2, 3, 2, 6) def test_orthogonal():
124
124
415
6
118
KIKOcaoyue/blocks
tests/test_initialization.py
Python
test_orthogonal
test_orthogonal
129
167
129
129
43feb122eb65e2fd56f13886a15cc35d810b1ab4
bigcode/the-stack
train
7df366367c093407b92adc2e
train
function
def test_gaussian(): rng = numpy.random.RandomState(1) def check_gaussian(rng, mean, std, shape): weights = IsotropicGaussian(std, mean).generate(rng, shape) assert weights.shape == shape assert weights.dtype == theano.config.floatX assert_allclose(weights.mean(), mean, atol=1e-...
def test_gaussian():
rng = numpy.random.RandomState(1) def check_gaussian(rng, mean, std, shape): weights = IsotropicGaussian(std, mean).generate(rng, shape) assert weights.shape == shape assert weights.dtype == theano.config.floatX assert_allclose(weights.mean(), mean, atol=1e-2) assert_all...
2], [3, 3]], dtype=theano.config.floatX)) assert str(Constant(1.0)).endswith(' constant=1.0>') def test_identity(): assert str(Identity(2.0)).endswith(' mult=2.0>') def test_gaussian():
63
64
166
5
59
KIKOcaoyue/blocks
tests/test_initialization.py
Python
test_gaussian
test_gaussian
36
48
36
36
3b03e629e181da4894ec916d67650551f1a236cc
bigcode/the-stack
train
aafb04a7eb8f1ec4eeab8cbb
train
function
def test_constant(): def check_constant(const, shape, ground_truth): # rng unused, so pass None. init = Constant(const).generate(None, ground_truth.shape) assert ground_truth.dtype == theano.config.floatX assert ground_truth.shape == init.shape assert_equal(ground_truth, init...
def test_constant():
def check_constant(const, shape, ground_truth): # rng unused, so pass None. init = Constant(const).generate(None, ground_truth.shape) assert ground_truth.dtype == theano.config.floatX assert ground_truth.shape == init.shape assert_equal(ground_truth, init) # Test scalar ...
import numbers import numpy import theano from numpy.testing import assert_equal, assert_allclose, assert_raises from blocks.initialization import Constant, IsotropicGaussian, Sparse, SparseND from blocks.initialization import Uniform, Orthogonal, Identity from blocks.utils import pack def test_constant():
63
68
229
4
58
KIKOcaoyue/blocks
tests/test_initialization.py
Python
test_constant
test_constant
12
29
12
12
59ac44df49cc2130556f1fba890b0f4d8d3509bc
bigcode/the-stack
train
e233a9161c42cc9a8ef748f6
train
function
@pytest.mark.parametrize("path,py2_arg", get_test_cases(PASS_DIR)) def test_success(path, py2_arg): stdout, stderr, exitcode = api.run([path] + py2_arg) assert stdout == '' assert exitcode == 0
@pytest.mark.parametrize("path,py2_arg", get_test_cases(PASS_DIR)) def test_success(path, py2_arg):
stdout, stderr, exitcode = api.run([path] + py2_arg) assert stdout == '' assert exitcode == 0
( fullpath, py2_arg, # Manually specify a name for the test id="{} - python{}".format(relpath, py_version_number), ) @pytest.mark.parametrize("path,py2_arg", get_test_cases(PASS_DIR)) def test_success(pat...
64
64
57
26
38
Prowler-io/numpy-stubs
tests/test_stubs.py
Python
test_success
test_success
38
42
38
39
c9b06111d2b293de711ee43b894d67d3289e0d1f
bigcode/the-stack
train
1bb674ac8e1bdbf1883f855d
train
function
def get_test_cases(directory): for root, __, files in os.walk(directory): for fname in files: if os.path.splitext(fname)[-1] == ".py": fullpath = os.path.join(root, fname) # Use relative path for nice py.test name relpath = os.path.relpath(fullpath...
def get_test_cases(directory):
for root, __, files in os.walk(directory): for fname in files: if os.path.splitext(fname)[-1] == ".py": fullpath = os.path.join(root, fname) # Use relative path for nice py.test name relpath = os.path.relpath(fullpath, start=directory) ...
from mypy import api TESTS_DIR = os.path.dirname(__file__) PASS_DIR = os.path.join(TESTS_DIR, "pass") FAIL_DIR = os.path.join(TESTS_DIR, "fail") REVEAL_DIR = os.path.join(TESTS_DIR, "reveal") def get_test_cases(directory):
64
64
204
6
58
Prowler-io/numpy-stubs
tests/test_stubs.py
Python
get_test_cases
get_test_cases
13
35
13
13
efd7ad6dda1a362d08d18403d3bdc3fb7c96341e
bigcode/the-stack
train
04cc5489b5b4bbea0720295a
train
function
@pytest.mark.parametrize("path,py2_arg", get_test_cases(REVEAL_DIR)) def test_reveal(path, py2_arg): stdout, stderr, exitcode = api.run([path] + py2_arg) with open(path) as fin: lines = fin.readlines() for error_line in stdout.split("\n"): error_line = error_line.strip() if not err...
@pytest.mark.parametrize("path,py2_arg", get_test_cases(REVEAL_DIR)) def test_reveal(path, py2_arg):
stdout, stderr, exitcode = api.run([path] + py2_arg) with open(path) as fin: lines = fin.readlines() for error_line in stdout.split("\n"): error_line = error_line.strip() if not error_line: continue lineno = int(error_line.split(":")[1]) assert "Reveale...
'Extra error "{marker}"' assert marker in errors[lineno] else: pytest.fail(f'Error {repr(errors[lineno])} not found') @pytest.mark.parametrize("path,py2_arg", get_test_cases(REVEAL_DIR)) def test_reveal(path, py2_arg):
64
64
140
28
36
Prowler-io/numpy-stubs
tests/test_stubs.py
Python
test_reveal
test_reveal
77
92
77
78
1e23af91f30aa1dead6a08d47e97e3e256925fb0
bigcode/the-stack
train
d56429fa2fea369a944d516c
train
function
@pytest.mark.parametrize("path,py2_arg", get_test_cases(FAIL_DIR)) def test_fail(path, py2_arg): stdout, stderr, exitcode = api.run([path] + py2_arg) assert exitcode != 0 with open(path) as fin: lines = fin.readlines() errors = defaultdict(lambda: "") for error_line in stdout.split("\n"):...
@pytest.mark.parametrize("path,py2_arg", get_test_cases(FAIL_DIR)) def test_fail(path, py2_arg):
stdout, stderr, exitcode = api.run([path] + py2_arg) assert exitcode != 0 with open(path) as fin: lines = fin.readlines() errors = defaultdict(lambda: "") for error_line in stdout.split("\n"): error_line = error_line.strip() if not error_line: continue ...
_cases(PASS_DIR)) def test_success(path, py2_arg): stdout, stderr, exitcode = api.run([path] + py2_arg) assert stdout == '' assert exitcode == 0 @pytest.mark.parametrize("path,py2_arg", get_test_cases(FAIL_DIR)) def test_fail(path, py2_arg):
71
71
238
26
44
Prowler-io/numpy-stubs
tests/test_stubs.py
Python
test_fail
test_fail
45
74
45
46
71ccbdc449351d385f81d1d673b8a83c9f3e86cd
bigcode/the-stack
train
05464765aed923c018d67ffc
train
class
class SohuBase(VideoExtractor): supported_stream_types = [ #'h2654kVid', #'h2654mVid', #'h265oriVid', #'h265superVid', #'h265highVid', #'h265norVid', 'h2644kVid', 'oriVid', 'superVid', 'highVid', 'norVid' ] types_2_id =...
class SohuBase(VideoExtractor):
supported_stream_types = [ #'h2654kVid', #'h2654mVid', #'h265oriVid', #'h265superVid', #'h265highVid', #'h265norVid', 'h2644kVid', 'oriVid', 'superVid', 'highVid', 'norVid' ] types_2_id = { 'h2654kVid': '4k', ...
#!/usr/bin/env python # -*- coding: utf-8 -*- from ykdl.util.html import get_content from ykdl.util.match import match1 from ykdl.extractor import VideoExtractor from ykdl.videoinfo import VideoInfo from ykdl.compact import urlparse, urlencode import json import time from random import random ''' Changelog: 1. h...
116
256
1,111
7
109
Shawn-Ji/ykdl
ykdl/extractors/sohu/sohubase.py
Python
SohuBase
SohuBase
21
147
21
22
cd81660a043720b90bf29d1a4b49e457976fa314
bigcode/the-stack
train
7f88488ce3f60359480c95d0
train
class
class UAHarvestr: def __init__(self,args): self.api = "http://api.userstack.com/detect" self.params = {"access_key": "756fc7012c632887c7d7e2e5f4660d22", "ua": args.ua} self.headers = {"User-Agent": f"{random.choice(user_agents)}"} self.resp = requests.get(self.api, params = self.params, headers = self.headers)...
class UAHarvestr:
def __init__(self,args): self.api = "http://api.userstack.com/detect" self.params = {"access_key": "756fc7012c632887c7d7e2e5f4660d22", "ua": args.ua} self.headers = {"User-Agent": f"{random.choice(user_agents)}"} self.resp = requests.get(self.api, params = self.params, headers = self.headers).json() def on...
import random import requests import argparse from uaharvester import * from resources.headers import user_agents from assets.colors import green, white, reset class UAHarvestr:
39
153
511
7
31
rlyonheart/uaharvester
assets/__main__.py
Python
UAHarvestr
UAHarvestr
8
47
8
8
faf2a0edb5f327a509c8460353539577e6365fef
bigcode/the-stack
train
5c5ec88be376ca991089a005
train
function
def change_country_name(doc): doc['country_namecode'] = "Federal Democratic Republic of Ethiopia" return doc
def change_country_name(doc):
doc['country_namecode'] = "Federal Democratic Republic of Ethiopia" return doc
ET", "countrycode": "ET", "countryname": "Federal Democratic Republic of Ethiopia", "countryshortname": "Ethiopia", "docty": "Project Information Document,Indigenous Peoples Plan,Project Information Document", }) # update def change_country_name(doc):
64
64
25
6
57
machira/SimpleDB
main.py
Python
change_country_name
change_country_name
34
36
34
34
143a6b754da4c1dea2384a8f3ac174f70201529b
bigcode/the-stack
train
44f3b5061f413efa1d86beb0
train
class
@mock.patch.object(common, 'get_oneview_client', spec_set=True, autospec=True) class OneViewPowerDriverTestCase(db_base.DbTestCase): def setUp(self): super(OneViewPowerDriverTestCase, self).setUp() self.config(manager_url='https://1.2.3.4', group='oneview') self.config(username='user', grou...
@mock.patch.object(common, 'get_oneview_client', spec_set=True, autospec=True) class OneViewPowerDriverTestCase(db_base.DbTestCase):
def setUp(self): super(OneViewPowerDriverTestCase, self).setUp() self.config(manager_url='https://1.2.3.4', group='oneview') self.config(username='user', group='oneview') self.config(password='password', group='oneview') mgr_utils.mock_the_extension_manager(driver='fake_onev...
# a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # ...
256
256
1,334
33
223
pyrrrat/moved-ironic
ironic/tests/unit/drivers/modules/oneview/test_power.py
Python
OneViewPowerDriverTestCase
OneViewPowerDriverTestCase
40
180
40
42
ddeb6ed33c2fba50f493bf87893eed2a1685b641
bigcode/the-stack
train
46e4f6f368f1e6e652293ec5
train
class
class Application(QtWidgets.QApplication): def __init__(self, sys_argv): super().__init__(sys_argv) self.main_view = MainView() self.echo_view = EchoView(self.main_view) self.echo_presenter = EchoPresenter(self.echo_view) self.counter = Counter() self.counter_view ...
class Application(QtWidgets.QApplication):
def __init__(self, sys_argv): super().__init__(sys_argv) self.main_view = MainView() self.echo_view = EchoView(self.main_view) self.echo_presenter = EchoPresenter(self.echo_view) self.counter = Counter() self.counter_view = CounterView(self.main_view) self....
_presenter import MainPresenter from presenters.echo_presenter import EchoPresenter from presenters.counter_presenter import CounterPresenter from model.counter import Counter from PyQt5 import QtWidgets __version__ = '1.0' __author__ = 'Marvin Elsen' class Application(QtWidgets.QApplication):
64
64
118
7
57
elsenm/pyqt5-mvp
src/main.py
Python
Application
Application
40
54
40
40
25f12156968e043f9ab17aa2aff9ea40b50115e2
bigcode/the-stack
train
66687a798cf9304c2415dec9
train
function
def main(): app = Application(sys.argv) sys.exit(app.exec_())
def main():
app = Application(sys.argv) sys.exit(app.exec_())
) self.counter = Counter() self.counter_view = CounterView(self.main_view) self.counter_presenter = CounterPresenter(self.counter_view, self.counter) self.main_presenter = MainPresenter(self.main_view, self.echo_presenter, self.counter_presenter) self.main_view.show() def main(...
64
64
17
3
61
elsenm/pyqt5-mvp
src/main.py
Python
main
main
57
59
57
57
ace9e121388bcb7497df303633ac5beb7cfe98c4
bigcode/the-stack
train
1e2349ed20b9bf783b3b63ae
train
function
@op_info_register(div_op_info) def _div_tbe(): """Div TBE register""" return
@op_info_register(div_op_info) def _div_tbe():
"""Div TBE register""" return
dtype_format(DataType.F16_None, DataType.F16_None, DataType.F16_None) \ .dtype_format(DataType.F32_None, DataType.F32_None, DataType.F32_None) \ .get_op_info() @op_info_register(div_op_info) def _div_tbe():
64
64
24
14
50
GuoSuiming/mindspore
mindspore/ops/_op_impl/tbe/div.py
Python
_div_tbe
_div_tbe
38
41
38
39
7ec9269d67850baec689c050d67c32eca64ee032
bigcode/the-stack
train
af753c36be74a681429d769c
train
class
class CreditBankCredit(object): def __init__(self): self._course_name = None self._course_property = None self._course_result_code = None self._course_score = None self._course_season = None self._course_subject = None self._course_year = None self._c...
class CreditBankCredit(object):
def __init__(self): self._course_name = None self._course_property = None self._course_result_code = None self._course_score = None self._course_season = None self._course_subject = None self._course_year = None self._credit = None self._credit...
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * class CreditBankCredit(object):
34
256
1,579
6
28
antopen/alipay-sdk-python-all
alipay/aop/api/domain/CreditBankCredit.py
Python
CreditBankCredit
CreditBankCredit
8
218
8
9
3ebd3e99452f13de05b88cbb6729362723a189ee
bigcode/the-stack
train
8d81ab9d3cc70d7321b802ec
train
function
def reverse_qs(view, urlconf=None, args=None, kwargs=None, current_app=None, query_kwargs=None): base_url = reverse(view, urlconf=urlconf, args=args, kwargs=kwargs, current_app=current_app) if query_kwargs: return '{}?{}'.format(base_url, urlencode(query_kwargs))
def reverse_qs(view, urlconf=None, args=None, kwargs=None, current_app=None, query_kwargs=None):
base_url = reverse(view, urlconf=urlconf, args=args, kwargs=kwargs, current_app=current_app) if query_kwargs: return '{}?{}'.format(base_url, urlencode(query_kwargs))
""" Utility functions and classes """ from django.core.urlresolvers import reverse from django.utils.http import urlencode def reverse_qs(view, urlconf=None, args=None, kwargs=None, current_app=None, query_kwargs=None):
47
64
66
24
22
hmoco/osf.io
admin/base/utils.py
Python
reverse_qs
reverse_qs
8
11
8
8
11c8c0781bb05eb9fe5e4f6e1d7464f0a554eac9
bigcode/the-stack
train
a5b5fbfd311bac982575328a
train
function
def osf_staff_check(user): return user.is_authenticated and user.is_staff
def osf_staff_check(user):
return user.is_authenticated and user.is_staff
, args=None, kwargs=None, current_app=None, query_kwargs=None): base_url = reverse(view, urlconf=urlconf, args=args, kwargs=kwargs, current_app=current_app) if query_kwargs: return '{}?{}'.format(base_url, urlencode(query_kwargs)) def osf_staff_check(user):
64
64
17
7
57
hmoco/osf.io
admin/base/utils.py
Python
osf_staff_check
osf_staff_check
14
15
14
14
9b4e7dccc3eb8c55f2a3dd6702132be6d6a6efdd
bigcode/the-stack
train
a5c34e55f0ed6e174f8755e8
train
function
def check_email(email): with sql.connect("database.db") as con: # cur = con.cursor() cursor = con.execute("select email from user where email = '{}'".format(email)) if cursor.row_factory is not None: return True else: return False
def check_email(email):
with sql.connect("database.db") as con: # cur = con.cursor() cursor = con.execute("select email from user where email = '{}'".format(email)) if cursor.row_factory is not None: return True else: return False
is wrong please check your email' try: if verify_password(user_data['password'], data['password']): return True, user_data['id'] else: return False, 'please enter valid password' except: return False, 'please enter valid password' def check_email(email):
64
64
61
5
59
semo4/todo_flask
process_db.py
Python
check_email
check_email
67
75
67
67
1b6fee8236563791ba72e598a1b674dc78487224
bigcode/the-stack
train
2df2a794144389e9ad427433
train
function
def get_users(): with sql.connect("database.db") as con: # cur = con.cursor() cursor = con.execute("select * from user") user = [] for row in cursor : data={} data['id'] = row[0] data['username'] = row[1] data['email'] = row[2] ...
def get_users():
with sql.connect("database.db") as con: # cur = con.cursor() cursor = con.execute("select * from user") user = [] for row in cursor : data={} data['id'] = row[0] data['username'] = row[1] data['email'] = row[2] data['passwor...
:] pwdhash = hashlib.pbkdf2_hmac('sha512', entered_password.encode('utf-8'), salt.encode('ascii'), 100000) pwdhash = binascii.hexlify(pwdhash).decode('ascii') return pwdhash == stored_password def get_users...
64
64
95
4
59
semo4/todo_flask
process_db.py
Python
get_users
get_users
108
120
108
108
93dca755854abf528e6ad65f6889ae7b49c64601
bigcode/the-stack
train
199a244f37db64cb02362c78
train
function
def check_username(username): with sql.connect("database.db") as con: # cur = con.cursor() cursor = con.execute("select username from user where username = '{}'".format(username)) if cursor.row_factory is not None: return True else: return False
def check_username(username):
with sql.connect("database.db") as con: # cur = con.cursor() cursor = con.execute("select username from user where username = '{}'".format(username)) if cursor.row_factory is not None: return True else: return False
_email(email): with sql.connect("database.db") as con: # cur = con.cursor() cursor = con.execute("select email from user where email = '{}'".format(email)) if cursor.row_factory is not None: return True else: return False def check_username(username):
64
64
62
5
58
semo4/todo_flask
process_db.py
Python
check_username
check_username
78
85
78
78
be2fc53fbaf124e4343183bdf8ee53a74cdc3c9a
bigcode/the-stack
train
8fac5877ec74c1bbb1a6e10e
train
function
def get_todo_incomplete(user_id): with sql.connect("database.db") as con: # cur = con.cursor() cursor = con.execute("select id, body, type, created from todo where type = 0 and author_id = {}".format(user_id)) todo_list = list() for row in cursor: data = dict() ...
def get_todo_incomplete(user_id):
with sql.connect("database.db") as con: # cur = con.cursor() cursor = con.execute("select id, body, type, created from todo where type = 0 and author_id = {}".format(user_id)) todo_list = list() for row in cursor: data = dict() data['id'] = row[0] ...
in cursor : data={} data['id'] = row[0] data['username'] = row[1] data['email'] = row[2] data['password'] = row[3] user.append(data) print(user) def get_todo_incomplete(user_id):
64
64
125
9
55
semo4/todo_flask
process_db.py
Python
get_todo_incomplete
get_todo_incomplete
123
136
123
123
a6cf949ca841c82def442356c617b7f92ea727c1
bigcode/the-stack
train
17320bc687d36032687874e8
train
function
def login_user(**data): con = sql.connect("database.db") user_data = {} try: cursor = con.execute("select id , email, password from user where email = '{}' ".format(data['email'])) for row in cursor : user_data['id'] = row[0] user_data['email'] = row[1] us...
def login_user(**data):
con = sql.connect("database.db") user_data = {} try: cursor = con.execute("select id , email, password from user where email = '{}' ".format(data['email'])) for row in cursor : user_data['id'] = row[0] user_data['email'] = row[1] user_data['password'] = ro...
.values())) print(name) con.execute("INSERT INTO user {} VALUES {}".format(name, tuple(data.values()))) print('data added') con.commit() return True, 'account successfully created' except: con.close() return False, 'account created Failed' def login_user(**dat...
64
64
159
6
58
semo4/todo_flask
process_db.py
Python
login_user
login_user
45
64
45
45
50afde488fa6865e93b4aa1c517062e162b4fd23
bigcode/the-stack
train
b9ffd0f570f196f7c540bc6c
train
function
def delete(todo_id): con = sql.connect("database.db") try: con.execute("delete from todo where id = {}".format(todo_id)) con.commit() return True, 'Todo Item deleted Successfully' except: return False, 'Todo Item deleted Failed'
def delete(todo_id):
con = sql.connect("database.db") try: con.execute("delete from todo where id = {}".format(todo_id)) con.commit() return True, 'Todo Item deleted Successfully' except: return False, 'Todo Item deleted Failed'
in cursor: data = dict() data['id'] = row[0] data['body'] = row[1] data['type'] = row[2] data['created'] = row[3] todo_list.append(data) return todo_list def delete(todo_id):
64
64
59
5
58
semo4/todo_flask
process_db.py
Python
delete
delete
155
162
155
155
8c55be394134b27f2698ac54208ce6042a88b8ad
bigcode/the-stack
train
9b7c86245aeff42e427a28ef
train
function
def update(todo_id): con = sql.connect("database.db") try: todo_type = get_todo_by_id(todo_id)[2] if todo_type == '1': con.execute("update todo set type = {} where id = {}".format('0', todo_id)) con.commit() return True, 'Todo Item updated Successfully' ...
def update(todo_id):
con = sql.connect("database.db") try: todo_type = get_todo_by_id(todo_id)[2] if todo_type == '1': con.execute("update todo set type = {} where id = {}".format('0', todo_id)) con.commit() return True, 'Todo Item updated Successfully' elif todo_type == '...
def delete(todo_id): con = sql.connect("database.db") try: con.execute("delete from todo where id = {}".format(todo_id)) con.commit() return True, 'Todo Item deleted Successfully' except: return False, 'Todo Item deleted Failed' def update(todo_id):
64
64
130
5
59
semo4/todo_flask
process_db.py
Python
update
update
165
178
165
165
7ccb8b8802efb784a4d1165edf01bebb15a7c749
bigcode/the-stack
train
ea8cdcf0a58e95384684af34
train
function
def insert_user(**data): con = sql.connect("database.db") try: if check_email(data['email']): return False, 'An email already exists Please enter a new email' if check_username(data['username']): return False, 'username already exists Please enter a new username' ...
def insert_user(**data):
con = sql.connect("database.db") try: if check_email(data['email']): return False, 'An email already exists Please enter a new email' if check_username(data['username']): return False, 'username already exists Please enter a new username' # cur = con.cursor() ...
.replace('\'', '') # cur = con.cursor() con.execute("INSERT INTO todo {} VALUES {}".format(name, tuple(data.values()))) con.commit() return True, 'data successfully added' except: con.rollback() return False, 'data Failed added' def insert_user(**data):
64
64
167
6
58
semo4/todo_flask
process_db.py
Python
insert_user
insert_user
21
42
21
21
671f01131c4fa143a80ed8b517c7dee888121477
bigcode/the-stack
train
8a1f0f9a0dafd74b0befe5eb
train
function
def verify_password(stored_password, entered_password): """Verify a stored password against one provided by user""" salt = stored_password[:64] stored_password = stored_password[64:] pwdhash = hashlib.pbkdf2_hmac('sha512', entered_password.encode('utf-8'), ...
def verify_password(stored_password, entered_password):
"""Verify a stored password against one provided by user""" salt = stored_password[:64] stored_password = stored_password[64:] pwdhash = hashlib.pbkdf2_hmac('sha512', entered_password.encode('utf-8'), salt.encode('ascii'), ...
ascii') pwdhash = hashlib.pbkdf2_hmac('sha512', password.encode('utf-8'), salt, 100000) pwdhash = binascii.hexlify(pwdhash) return (salt + pwdhash).decode('ascii') def verify_password(stored_password, entered_password):
64
64
98
10
54
semo4/todo_flask
process_db.py
Python
verify_password
verify_password
96
105
96
96
5762f79a19730c52b6ae83ca1226df17a5cfe112
bigcode/the-stack
train
8e37606516f082d2dd189bd9
train
function
def hash_password(password): """Hash a password for storing.""" salt = hashlib.sha256(os.urandom(60)).hexdigest().encode('ascii') pwdhash = hashlib.pbkdf2_hmac('sha512', password.encode('utf-8'), salt, 100000) pwdhash = binascii.hexlify(pwdhash) return (salt + pwdhash).decode('ascii')
def hash_password(password):
"""Hash a password for storing.""" salt = hashlib.sha256(os.urandom(60)).hexdigest().encode('ascii') pwdhash = hashlib.pbkdf2_hmac('sha512', password.encode('utf-8'), salt, 100000) pwdhash = binascii.hexlify(pwdhash) return (salt + pwdhash).decode('ascii')
(username): with sql.connect("database.db") as con: # cur = con.cursor() cursor = con.execute("select username from user where username = '{}'".format(username)) if cursor.row_factory is not None: return True else: return False def hash_password(password):
64
64
85
5
58
semo4/todo_flask
process_db.py
Python
hash_password
hash_password
88
93
88
88
4fba13f9c7629cbd0442a47058305cdcb9c1d4c0
bigcode/the-stack
train
9c922738df688d12b3366813
train
function
def insert_todo(**data): con = sql.connect("database.db") try: name = str(tuple(data.keys())) name = name.replace('\'', '') # cur = con.cursor() con.execute("INSERT INTO todo {} VALUES {}".format(name, tuple(data.values()))) con.commit() return True, 'data success...
def insert_todo(**data):
con = sql.connect("database.db") try: name = str(tuple(data.keys())) name = name.replace('\'', '') # cur = con.cursor() con.execute("INSERT INTO todo {} VALUES {}".format(name, tuple(data.values()))) con.commit() return True, 'data successfully added' except: ...
import binascii import os import sqlite3 as sql import hashlib def insert_todo(**data):
23
64
89
7
15
semo4/todo_flask
process_db.py
Python
insert_todo
insert_todo
7
18
7
7
83fd18a3ab3e88e9077d1f6f6270ad68b30c2e46
bigcode/the-stack
train
0dbddc2213f08a38d66bde23
train
function
def get_todo_by_id(todo_id): with sql.connect("database.db") as con: # cur = con.cursor() cursor = con.execute("select id, body, type, created from todo where id = {}".format(todo_id)) # todo_list = list() # data = dict() # for row in cursor: # data['id'] = row[0]...
def get_todo_by_id(todo_id):
with sql.connect("database.db") as con: # cur = con.cursor() cursor = con.execute("select id, body, type, created from todo where id = {}".format(todo_id)) # todo_list = list() # data = dict() # for row in cursor: # data['id'] = row[0] # data['body'] =...
elif todo_type == '0': con.execute("update todo set type = {} where id = {}".format('1', todo_id)) con.commit() return True, 'Todo Item updated Successfully' except: return False, 'Todo Item updated Failed' def get_todo_by_id(todo_id):
64
64
124
9
55
semo4/todo_flask
process_db.py
Python
get_todo_by_id
get_todo_by_id
181
192
181
181
798323fa7bf10ee90fd37cf7cef24aac7343395e
bigcode/the-stack
train
b883acfc79e40b5730ece98b
train
function
def get_todo_complete(user_id): with sql.connect("database.db") as con: # cur = con.cursor() cursor = con.execute("select id, body, type, created from todo where type = 1 and author_id = {}".format(user_id)) todo_list = list() for row in cursor: data = dict() ...
def get_todo_complete(user_id):
with sql.connect("database.db") as con: # cur = con.cursor() cursor = con.execute("select id, body, type, created from todo where type = 1 and author_id = {}".format(user_id)) todo_list = list() for row in cursor: data = dict() data['id'] = row[0] ...
data = dict() data['id'] = row[0] data['body'] = row[1] data['type'] = row[2] data['created'] = row[3] todo_list.append(data) return todo_list def get_todo_complete(user_id):
64
64
124
8
55
semo4/todo_flask
process_db.py
Python
get_todo_complete
get_todo_complete
139
152
139
139
412025e63191187358e1e67bd61de839e795189b
bigcode/the-stack
train
cd93332859534ee54cfcc177
train
class
class HashEncoder(nn.Module): def __init__(self, input_dim=3, num_levels=16, level_dim=2, per_level_scale=2, base_resolution=16, log2_hashmap_size=19, desired_resolution=None): super().__init__() # the finest resolution desired at the last level, if provided, overridee per_level_scale if de...
class HashEncoder(nn.Module):
def __init__(self, input_dim=3, num_levels=16, level_dim=2, per_level_scale=2, base_resolution=16, log2_hashmap_size=19, desired_resolution=None): super().__init__() # the finest resolution desired at the last level, if provided, overridee per_level_scale if desired_resolution is not None: ...
D, C, L, S, H = ctx.dims calc_grad_inputs = ctx.calc_grad_inputs # grad: [B, L * C] --> [L, B, C] grad = grad.view(B, L, C).permute(1, 0, 2).contiguous() grad_embeddings = torch.zeros_like(embeddings) if calc_grad_inputs: grad_inputs = torch.zeros_like(inputs) ...
210
210
701
6
203
wx-b/torch-ngp
hashencoder/hashgrid.py
Python
HashEncoder
HashEncoder
79
142
79
79
a879ef3d03f9e2fde73946f7c4f15d75e484e09e
bigcode/the-stack
train
52f1c509e472f55163313b41
train
class
class _hash_encode(Function): @staticmethod @custom_fwd(cast_inputs=torch.half) def forward(ctx, inputs, embeddings, offsets, per_level_scale, base_resolution, calc_grad_inputs=False): # inputs: [B, D], float in [0, 1] # embeddings: [sO, C], float # offsets: [L + 1], int # RE...
class _hash_encode(Function): @staticmethod @custom_fwd(cast_inputs=torch.half)
def forward(ctx, inputs, embeddings, offsets, per_level_scale, base_resolution, calc_grad_inputs=False): # inputs: [B, D], float in [0, 1] # embeddings: [sO, C], float # offsets: [L + 1], int # RETURN: [B, F], float inputs = inputs.contiguous() embeddings = embedding...
import numpy as np import torch import torch.nn as nn from torch.autograd import Function from torch.autograd.function import once_differentiable from torch.cuda.amp import custom_bwd, custom_fwd from .backend import _backend class _hash_encode(Function): @staticmethod @custom_fwd(cast_inputs=torch.half)
76
192
643
22
53
wx-b/torch-ngp
hashencoder/hashgrid.py
Python
_hash_encode
_hash_encode
11
73
11
13
5b6895249677bd3ac662481757cb794fca899ed2
bigcode/the-stack
train
3e0a19a1cb27d5bf5e82f28a
train
class
class ShortcutsModel(models.Model): name = models.CharField(max_length=100) datetime = models.DateTimeField() number = models.IntegerField()
class ShortcutsModel(models.Model):
name = models.CharField(max_length=100) datetime = models.DateTimeField() number = models.IntegerField()
dispatcher_post_save from chamber.utils.datastructures import ChoicesNumEnum, SequenceChoicesNumEnum, SubstatesChoicesNumEnum from .handlers import (create_test_dispatchers_model_handler, create_test_fields_model_handler, create_test_smart_model_handler, create_csv_record_handler) class Shortcu...
64
64
33
7
57
zzuzzy/django-chamber
example/dj/apps/test_chamber/models.py
Python
ShortcutsModel
ShortcutsModel
15
18
15
15
e9a0548c422008bddf60189770b271a2cb4e82ae
bigcode/the-stack
train
3f9ca0ecbefd840ebcb8ad94
train
class
class TestDispatchersModel(chamber_models.SmartModel): STATE = ChoicesNumEnum( ('FIRST', _('first'), 1), ('SECOND', _('second'), 2), ) state = models.IntegerField(null=True, blank=False, choices=STATE.choices, default=STATE.FIRST) dispatchers = ( CreatedDispatcher(create_csv_re...
class TestDispatchersModel(chamber_models.SmartModel):
STATE = ChoicesNumEnum( ('FIRST', _('first'), 1), ('SECOND', _('second'), 2), ) state = models.IntegerField(null=True, blank=False, choices=STATE.choices, default=STATE.FIRST) dispatchers = ( CreatedDispatcher(create_csv_record_handler, signal=dispatcher_pre_save), State...
max_upload_size=1) price = chamber_models.PriceField(verbose_name=_('price'), null=True, blank=True, currency=_('EUR')) total_price = chamber_models.PositivePriceField(verbose_name=_('total price'), null=True, blank=True) class TestDispatchersModel(chamber_models.SmartModel):
64
64
177
12
52
zzuzzy/django-chamber
example/dj/apps/test_chamber/models.py
Python
TestDispatchersModel
TestDispatchersModel
93
114
93
94
bfd46ea1eee71678f0777e0b353da94a5be39d4f
bigcode/the-stack
train
675739f5898e6882dcfea2c2
train
class
class TestFieldsModel(chamber_models.SmartModel): STATE = ChoicesNumEnum( ('OK', _('ok'), 1), ('NOT_OK', _('not ok'), 2), ) STATE_REASON = SubstatesChoicesNumEnum({ STATE.OK: ( ('SUB_OK_1', _('1st substate'), 1), ('SUB_OK_2', _('2nd substate'), 2), )...
class TestFieldsModel(chamber_models.SmartModel):
STATE = ChoicesNumEnum( ('OK', _('ok'), 1), ('NOT_OK', _('not ok'), 2), ) STATE_REASON = SubstatesChoicesNumEnum({ STATE.OK: ( ('SUB_OK_1', _('1st substate'), 1), ('SUB_OK_2', _('2nd substate'), 2), ), STATE.NOT_OK: ( ('SUB_NOT_OK_...
name = models.CharField(max_length=100) class TestSmartModel(chamber_models.SmartModel): name = models.CharField(max_length=100) class RelatedSmartModel(chamber_models.SmartModel): test_smart_model = models.ForeignKey(TestSmartModel, related_name='test_smart_models', on_delete=models.CASCADE) class Ba...
141
141
472
11
130
zzuzzy/django-chamber
example/dj/apps/test_chamber/models.py
Python
TestFieldsModel
TestFieldsModel
52
90
52
53
6328701e8271e81697836aa0c87978543652e819
bigcode/the-stack
train
7dfc17ee55f71197599a41dc
train
class
class ComparableModel(chamber_models.ComparableModelMixin, models.Model): name = models.CharField(max_length=100)
class ComparableModel(chamber_models.ComparableModelMixin, models.Model):
name = models.CharField(max_length=100)
datetime = models.DateTimeField() number = models.IntegerField() class DiffModel(chamber_models.SmartModel): name = models.CharField(max_length=100) datetime = models.DateTimeField() number = models.IntegerField() class ComparableModel(chamber_models.ComparableModelMixin, models.Model):
64
64
25
14
50
zzuzzy/django-chamber
example/dj/apps/test_chamber/models.py
Python
ComparableModel
ComparableModel
27
28
27
27
d85d35f0051a32e2619b626c5b25b1165f160b93
bigcode/the-stack
train
34cfaaf7a567f0d4e973365a
train
class
class CSVRecord(chamber_models.SmartModel): name = models.CharField(max_length=100, null=True, blank=True) number = models.IntegerField(null=True, blank=True)
class CSVRecord(chamber_models.SmartModel):
name = models.CharField(max_length=100, null=True, blank=True) number = models.IntegerField(null=True, blank=True)
(chamber_models.SmartModel): test_smart_model = models.ForeignKey(TestSmartModel, related_name='test_smart_models', on_delete=models.CASCADE) class BackendUser(AbstractBaseUser): pass class FrontendUser(AbstractBaseUser): pass class CSVRecord(chamber_models.SmartModel):
64
64
39
10
53
zzuzzy/django-chamber
example/dj/apps/test_chamber/models.py
Python
CSVRecord
CSVRecord
47
49
47
47
f07cea8088be5267346d69d31f1f6c0de2e95d5a
bigcode/the-stack
train
eb95d86b6a4cdcf53f4044b5
train
class
class TestSmartModel(chamber_models.SmartModel): name = models.CharField(max_length=100)
class TestSmartModel(chamber_models.SmartModel):
name = models.CharField(max_length=100)
Model): name = models.CharField(max_length=100) datetime = models.DateTimeField() number = models.IntegerField() class ComparableModel(chamber_models.ComparableModelMixin, models.Model): name = models.CharField(max_length=100) class TestSmartModel(chamber_models.SmartModel):
64
64
22
11
53
zzuzzy/django-chamber
example/dj/apps/test_chamber/models.py
Python
TestSmartModel
TestSmartModel
31
32
31
31
aca5859f8c7e43ec323aae57cb203524b022d6b9
bigcode/the-stack
train
b4ecba8f4bc7fc9ba90502ee
train
class
class DiffModel(chamber_models.SmartModel): name = models.CharField(max_length=100) datetime = models.DateTimeField() number = models.IntegerField()
class DiffModel(chamber_models.SmartModel):
name = models.CharField(max_length=100) datetime = models.DateTimeField() number = models.IntegerField()
_handler, create_test_fields_model_handler, create_test_smart_model_handler, create_csv_record_handler) class ShortcutsModel(models.Model): name = models.CharField(max_length=100) datetime = models.DateTimeField() number = models.IntegerField() class DiffModel(chamber_models.SmartMo...
64
64
36
10
54
zzuzzy/django-chamber
example/dj/apps/test_chamber/models.py
Python
DiffModel
DiffModel
21
24
21
21
60a2ccb66b97e8bc8afa57e47880a75b42377667
bigcode/the-stack
train
c8cf3b524f65280b58ee8f0c
train
class
class FrontendUser(AbstractBaseUser): pass
class FrontendUser(AbstractBaseUser):
pass
= models.CharField(max_length=100) class RelatedSmartModel(chamber_models.SmartModel): test_smart_model = models.ForeignKey(TestSmartModel, related_name='test_smart_models', on_delete=models.CASCADE) class BackendUser(AbstractBaseUser): pass class FrontendUser(AbstractBaseUser):
64
64
11
8
55
zzuzzy/django-chamber
example/dj/apps/test_chamber/models.py
Python
FrontendUser
FrontendUser
43
44
43
43
d2d0183a750d34d4dd707cc5c4d5afac01b35f44
bigcode/the-stack
train
7486d298b03b903eea9f5b0b
train
class
class RelatedSmartModel(chamber_models.SmartModel): test_smart_model = models.ForeignKey(TestSmartModel, related_name='test_smart_models', on_delete=models.CASCADE)
class RelatedSmartModel(chamber_models.SmartModel):
test_smart_model = models.ForeignKey(TestSmartModel, related_name='test_smart_models', on_delete=models.CASCADE)
number = models.IntegerField() class ComparableModel(chamber_models.ComparableModelMixin, models.Model): name = models.CharField(max_length=100) class TestSmartModel(chamber_models.SmartModel): name = models.CharField(max_length=100) class RelatedSmartModel(chamber_models.SmartModel):
64
64
37
11
53
zzuzzy/django-chamber
example/dj/apps/test_chamber/models.py
Python
RelatedSmartModel
RelatedSmartModel
35
36
35
35
80dea50818ac01a4915178811e7a1cf7a1ea6bad
bigcode/the-stack
train
2287bec60836fa34bb93b01e
train
class
class BackendUser(AbstractBaseUser): pass
class BackendUser(AbstractBaseUser):
pass
SmartModel(chamber_models.SmartModel): name = models.CharField(max_length=100) class RelatedSmartModel(chamber_models.SmartModel): test_smart_model = models.ForeignKey(TestSmartModel, related_name='test_smart_models', on_delete=models.CASCADE) class BackendUser(AbstractBaseUser):
64
64
10
7
57
zzuzzy/django-chamber
example/dj/apps/test_chamber/models.py
Python
BackendUser
BackendUser
39
40
39
39
7844783f85203e0b5e485e4a3e39cd296ac97c90
bigcode/the-stack
train
c88040b0def1b795218dad9d
train
class
class Migration(migrations.Migration): dependencies = [ ('courses', '0003_courses_completion'), ('student', '0003_post_courses'), ] operations = [ migrations.AlterField( model_name='post', name='courses', field=models.ForeignKey(on_delete=django....
class Migration(migrations.Migration):
dependencies = [ ('courses', '0003_courses_completion'), ('student', '0003_post_courses'), ] operations = [ migrations.AlterField( model_name='post', name='courses', field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='courses....
# Generated by Django 3.0.5 on 2020-05-22 22:05 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration):
45
64
78
7
37
iamTanTan/E-Learning_Lab_Spring_2021
Components/student/migrations/0004_auto_20200522_1505.py
Python
Migration
Migration
7
20
7
8
47550323492e0285005e950dd06cdb0adddba68f
bigcode/the-stack
train
b809cc8b545ccdf685e06356
train
function
def main(): users = psutil.get_users() for user in users: print_("%-15s %-15s %s (%s)" % \ (user.name, user.terminal or '-', datetime.fromtimestamp(user.started).strftime("%Y-%m-%d %H:%M"), user.host) )
def main():
users = psutil.get_users() for user in users: print_("%-15s %-15s %s (%s)" % \ (user.name, user.terminal or '-', datetime.fromtimestamp(user.started).strftime("%Y-%m-%d %H:%M"), user.host) )
code is governed by a BSD-style license that can be # found in the LICENSE file. """ A clone of 'who' command; print information about users who are currently logged in. """ import sys from datetime import datetime import psutil from psutil._compat import print_ def main():
63
64
72
3
60
simbapeer/BakeBit
Script/psutil-0.5.0/examples/who.py
Python
main
main
21
29
21
21
e23f4bcc36c60fc0014c8302aa9570465bcbdc5a
bigcode/the-stack
train
9137d664bc39d5b2498d48bd
train
function
def handle(body, endLine = ''): if body != None: if type(body) is core.Command: body() elif callable(body): body() elif type(body) is str: if type(endLine) is str: core.sh("{}{}".format(body, endLine)) elif type(endLine) is bool...
def handle(body, endLine = ''):
if body != None: if type(body) is core.Command: body() elif callable(body): body() elif type(body) is str: if type(endLine) is str: core.sh("{}{}".format(body, endLine)) elif type(endLine) is bool: if endLine: ...
from pysh import core def handle(body, endLine = ''):
15
64
91
9
5
Mamatu/pysh
bash/scope.py
Python
handle
handle
3
16
3
3
6a006ca08eac88fec68c759095438118d9865004
bigcode/the-stack
train
cda9388eb341c8fdb5cbc844
train
function
@event_listener("new_role") def on_new_role(evt, var, user, old_role): if old_role == "investigator" and evt.data["role"] != "investigator": INVESTIGATED.discard(user)
@event_listener("new_role") def on_new_role(evt, var, user, old_role):
if old_role == "investigator" and evt.data["role"] != "investigator": INVESTIGATED.discard(user)
same" if evt.data["same"] else "different")) @event_listener("del_player") def on_del_player(evt, var, player, all_roles, death_triggers): INVESTIGATED.discard(player) @event_listener("new_role") def on_new_role(evt, var, user, old_role):
64
64
48
20
44
rdococ/lykos
src/roles/investigator.py
Python
on_new_role
on_new_role
90
93
90
91
00ef07fb8516f70f3dfb8d206c73a4fd84b23924
bigcode/the-stack
train
4b65631be0a99506680354c5
train
function
@event_listener("get_role_metadata") def on_get_role_metadata(evt, var, kind): if kind == "role_categories": evt.data["investigator"] = {"Village", "Spy", "Safe"}
@event_listener("get_role_metadata") def on_get_role_metadata(evt, var, kind):
if kind == "role_categories": evt.data["investigator"] = {"Village", "Spy", "Safe"}
") @event_listener("transition_night_begin") def on_transition_night_begin(evt, var): INVESTIGATED.clear() @event_listener("reset") def on_reset(evt, var): INVESTIGATED.clear() @event_listener("get_role_metadata") def on_get_role_metadata(evt, var, kind):
64
64
44
19
45
rdococ/lykos
src/roles/investigator.py
Python
on_get_role_metadata
on_get_role_metadata
112
115
112
113
f23e7096e626e3f0fe85d8df5a8934ca00d29e08
bigcode/the-stack
train
f90b8d2c4b2bafafce58a968
train
function
@event_listener("transition_night_end", priority=2) def on_transition_night_end(evt, var): ps = get_players() for inv in var.ROLES["investigator"]: pl = ps[:] random.shuffle(pl) pl.remove(inv) inv.send(messages["investigator_notify"], messages["players_list"].format(pl), sep="\n"...
@event_listener("transition_night_end", priority=2) def on_transition_night_end(evt, var):
ps = get_players() for inv in var.ROLES["investigator"]: pl = ps[:] random.shuffle(pl) pl.remove(inv) inv.send(messages["investigator_notify"], messages["players_list"].format(pl), sep="\n")
def on_new_role(evt, var, user, old_role): if old_role == "investigator" and evt.data["role"] != "investigator": INVESTIGATED.discard(user) @event_listener("transition_night_end", priority=2) def on_transition_night_end(evt, var):
64
64
77
23
41
rdococ/lykos
src/roles/investigator.py
Python
on_transition_night_end
on_transition_night_end
95
102
95
96
386bc54e3a1e7a79b6d1c1412565c9fa6a18a574
bigcode/the-stack
train
c5b19d5c98edbd632d4aa9d6
train
function
@event_listener("transition_night_begin") def on_transition_night_begin(evt, var): INVESTIGATED.clear()
@event_listener("transition_night_begin") def on_transition_night_begin(evt, var):
INVESTIGATED.clear()
in var.ROLES["investigator"]: pl = ps[:] random.shuffle(pl) pl.remove(inv) inv.send(messages["investigator_notify"], messages["players_list"].format(pl), sep="\n") @event_listener("transition_night_begin") def on_transition_night_begin(evt, var):
64
64
25
19
45
rdococ/lykos
src/roles/investigator.py
Python
on_transition_night_begin
on_transition_night_begin
104
106
104
105
2cfd560eca3a572126e0df66521a47616d0951da
bigcode/the-stack
train
2114a0b55219d95cb4afc86c
train
function
@command("id", chan=False, pm=True, playing=True, silenced=True, phases=("day",), roles=("investigator",)) def investigate(var, wrapper, message): """Investigate two players to determine their relationship to each other.""" if wrapper.source in INVESTIGATED: wrapper.pm(messages["already_investigated"]) ...
@command("id", chan=False, pm=True, playing=True, silenced=True, phases=("day",), roles=("investigator",)) def investigate(var, wrapper, message):
"""Investigate two players to determine their relationship to each other.""" if wrapper.source in INVESTIGATED: wrapper.pm(messages["already_investigated"]) return pieces = re.split(" +", message) if len(pieces) == 1: wrapper.pm(messages["investigator_help"]) return t...
import re import random import itertools import math from collections import defaultdict from src.utilities import * from src import channels, users, debuglog, errlog, plog from src.functions import get_players, get_all_players, get_main_role, get_reveal_role, get_target from src.decorators import command, event_liste...
167
191
637
37
130
rdococ/lykos
src/roles/investigator.py
Python
investigate
investigate
19
84
19
20
68f977410eb244e3848fc0ac3d4cbed471091e9e
bigcode/the-stack
train
1f2975f78d9a914ff403946b
train
function
@event_listener("del_player") def on_del_player(evt, var, player, all_roles, death_triggers): INVESTIGATED.discard(player)
@event_listener("del_player") def on_del_player(evt, var, player, all_roles, death_triggers):
INVESTIGATED.discard(player)
5}".format( wrapper.source, target1, get_main_role(target1), target2, get_main_role(target2), "same" if evt.data["same"] else "different")) @event_listener("del_player") def on_del_player(evt, var, player, all_roles, death_triggers):
64
64
32
24
40
rdococ/lykos
src/roles/investigator.py
Python
on_del_player
on_del_player
86
88
86
87
18e51e8ea8a8764d9a0c9d838793327d7c01a06a
bigcode/the-stack
train
4febb17bacf76856ff5879e2
train
function
@event_listener("reset") def on_reset(evt, var): INVESTIGATED.clear()
@event_listener("reset") def on_reset(evt, var):
INVESTIGATED.clear()
pl.remove(inv) inv.send(messages["investigator_notify"], messages["players_list"].format(pl), sep="\n") @event_listener("transition_night_begin") def on_transition_night_begin(evt, var): INVESTIGATED.clear() @event_listener("reset") def on_reset(evt, var):
64
64
19
13
51
rdococ/lykos
src/roles/investigator.py
Python
on_reset
on_reset
108
110
108
109
4c49190ae4ee1d03ad91658f584b797acc998b28
bigcode/the-stack
train
ff03d4f7f11268ffea9ce0be
train
class
class Solution: def largestSumAfterKNegations(self, A: List[int], K: int) -> int: s = sneg = neg = 0 absmin = math.inf negpq = [] for a in A: absmin = min(absmin, abs(a)) if a >= 0: s += a else: heapq.heappush(negpq,...
class Solution:
def largestSumAfterKNegations(self, A: List[int], K: int) -> int: s = sneg = neg = 0 absmin = math.inf negpq = [] for a in A: absmin = min(absmin, abs(a)) if a >= 0: s += a else: heapq.heappush(negpq, a) ...
import heapq import math class Solution:
10
64
182
3
6
jiadaizhao/LeetCode
1001-1100/1005-Maximize Sum Of Array After K Negations/1005-Maximize Sum Of Array After K Negations.py
Python
Solution
Solution
3
28
3
3
339ab902f3f1e48450deca0cd451126e16828e8b
bigcode/the-stack
train
b382b5f603a1a53f74b2e171
train
class
class CloudKMSApi(recipe_api.RecipeApi): """API for interacting with CloudKMS using the LUCI cloudkms tool.""" def __init__(self, **kwargs): super(CloudKMSApi, self).__init__(**kwargs) self._cloudkms_bin = None @property def cloudkms_path(self): """Returns the path to LUCI cloudkms binary. Wh...
class CloudKMSApi(recipe_api.RecipeApi):
"""API for interacting with CloudKMS using the LUCI cloudkms tool.""" def __init__(self, **kwargs): super(CloudKMSApi, self).__init__(**kwargs) self._cloudkms_bin = None @property def cloudkms_path(self): """Returns the path to LUCI cloudkms binary. When the property is accessed the first tim...
# Copyright 2019 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from recipe_engine import recipe_api class CloudKMSApi(recipe_api.RecipeApi):
55
108
362
11
43
xinghun61/infra
recipes/recipe_modules/cloudkms/api.py
Python
CloudKMSApi
CloudKMSApi
8
45
8
8
2bef0d29818572ee0dfad087f9728eaf53b2ba8e
bigcode/the-stack
train
1dee39e1acadea34f0933c0e
train
class
class RedisCmdsItem(scrapy.Item): # define the fields for your item here like: # name = scrapy.Field() pass
class RedisCmdsItem(scrapy.Item): # define the fields for your item here like: # name = scrapy.Field()
pass
: utf-8 -*- # Define here the models for your scraped items # # See documentation in: # https://doc.scrapy.org/en/latest/topics/items.html import scrapy class RedisCmdsItem(scrapy.Item): # define the fields for your item here like: # name = scrapy.Field()
64
64
30
27
36
ZhenningLang/rds-cmds-t-complexity-cheatsheet
how-i-get-data/redis_cmds/items.py
Python
RedisCmdsItem
RedisCmdsItem
11
14
11
13
930079383f6346c3c8bcba2d747d54188f221dfa
bigcode/the-stack
train
130152368145dd12f7c3aa69
train
function
def evaluate_prefix(expression): stack = [] for i in expression[::-1]: if i.isdigit(): stack.append(int(i)) else: val1 = stack.pop() val2 = stack.pop() if i == '+': stack.append(val1 + val2) elif i == '-': stack.append(val1 - val2) elif i == '*': s...
def evaluate_prefix(expression):
stack = [] for i in expression[::-1]: if i.isdigit(): stack.append(int(i)) else: val1 = stack.pop() val2 = stack.pop() if i == '+': stack.append(val1 + val2) elif i == '-': stack.append(val1 - val2) elif i == '*': stack.append(val1 * val2) el...
]: if i == '(': reverse_expr += ')' elif i == ')': reverse_expr += '(' else: reverse_expr += i return infix_to_postfix(reverse_expr)[::-1] print(infix_to_prefix('A+B*C+D')) def evaluate_prefix(expression):
63
64
112
5
58
OSAMAMOHAMED1234/python_projects
algorithmes/infix_prefix.py
Python
evaluate_prefix
evaluate_prefix
16
32
16
16
2eb8dc07e5adad563967c9605c98ca4f965a1e22
bigcode/the-stack
train
ef27cd11f9aca479a2031f82
train
function
def infix_to_prefix(expression): reverse_expr = '' for i in expression[::-1]: if i == '(': reverse_expr += ')' elif i == ')': reverse_expr += '(' else: reverse_expr += i return infix_to_postfix(reverse_expr)[::-1]
def infix_to_prefix(expression):
reverse_expr = '' for i in expression[::-1]: if i == '(': reverse_expr += ')' elif i == ')': reverse_expr += '(' else: reverse_expr += i return infix_to_postfix(reverse_expr)[::-1]
from infix_postfix import infix_to_postfix def infix_to_prefix(expression):
19
64
66
7
11
OSAMAMOHAMED1234/python_projects
algorithmes/infix_prefix.py
Python
infix_to_prefix
infix_to_prefix
3
12
3
3
1429ffdc2226370e9c8f85396f09d902b63f23d4
bigcode/the-stack
train
babe612984d4f9610fe6c3df
train
function
def prefix_to_infix(prefix): operators, stack, i = set(['+', '-', '*', '/', '(', ')', '^', '%']), [], len(prefix) - 1 while i >= 0: if prefix[i] not in operators: stack.append(prefix[i]) else: val1 = stack.pop() val2 = stack.pop() stack.append('(' + val1 + prefix[i] + val2 + ')') ...
def prefix_to_infix(prefix):
operators, stack, i = set(['+', '-', '*', '/', '(', ')', '^', '%']), [], len(prefix) - 1 while i >= 0: if prefix[i] not in operators: stack.append(prefix[i]) else: val1 = stack.pop() val2 = stack.pop() stack.append('(' + val1 + prefix[i] + val2 + ')') i -= 1 return stack.pop()
# 5 print(evaluate_prefix('-+5*+1243')) # 14 print(evaluate_prefix('*+35-72')) # 40 print(evaluate_prefix('+34')) # 7 print(evaluate_prefix('*-567')) # -7 def prefix_to_infix(prefix):
64
64
105
7
56
OSAMAMOHAMED1234/python_projects
algorithmes/infix_prefix.py
Python
prefix_to_infix
prefix_to_infix
44
54
44
44
d4fd39d01a0571d6ba6e45504624adef2828eeb6
bigcode/the-stack
train
9793d46f577d5a3311187cee
train
function
def on_release(key): if key == Key.esc: return False
def on_release(key):
if key == Key.esc: return False
('log.txt', 'a') as f: for key in keys: k = str(key).replace("'", "") if k.find('space') > 0: f.write('\n') elif k.find("Key") == -1: f.write(k) def on_release(key):
64
64
17
5
59
pashamakhilkumarreddy/python-iaac-demo
src/main.py
Python
on_release
on_release
25
27
25
25
b969c098fc4e176fabfe381f731794990d1430f9
bigcode/the-stack
train
90ea1f967d0d57e2e2299171
train
function
def write_to_file(keys): with open('log.txt', 'a') as f: for key in keys: k = str(key).replace("'", "") if k.find('space') > 0: f.write('\n') elif k.find("Key") == -1: f.write(k)
def write_to_file(keys):
with open('log.txt', 'a') as f: for key in keys: k = str(key).replace("'", "") if k.find('space') > 0: f.write('\n') elif k.find("Key") == -1: f.write(k)
pynput.keyboard import Key, Listener count, keys = 0, [] def on_press(key): global keys, count keys.append(str(key)) count += 1 if count >= 12: write_to_file(keys) keys = [] def write_to_file(keys):
63
64
68
6
57
pashamakhilkumarreddy/python-iaac-demo
src/main.py
Python
write_to_file
write_to_file
15
22
15
15
1de87dc5d7e14f8261bb474c0292c7bc848aa1e4
bigcode/the-stack
train
dd77f61d5cbfd09e538d01b0
train
function
def on_press(key): global keys, count keys.append(str(key)) count += 1 if count >= 12: write_to_file(keys) keys = []
def on_press(key):
global keys, count keys.append(str(key)) count += 1 if count >= 12: write_to_file(keys) keys = []
from pynput.keyboard import Key, Listener count, keys = 0, [] def on_press(key):
22
64
40
5
17
pashamakhilkumarreddy/python-iaac-demo
src/main.py
Python
on_press
on_press
6
12
6
6
f6bcc78b447b3e4cee7a18c71f3b560700b53a21
bigcode/the-stack
train
77d7bd596cbc574acdc4a540
train
class
class ActiveDirectoryPost(object): """ Attributes: swagger_types (dict): The key is attribute name and the value is attribute type. attribute_map (dict): The key is attribute name and the value is json key in definition. """ swagger_typ...
class ActiveDirectoryPost(object):
""" Attributes: swagger_types (dict): The key is attribute name and the value is attribute type. attribute_map (dict): The key is attribute name and the value is json key in definition. """ swagger_types = { 'computer_name': 'st...
# coding: utf-8 """ FlashArray REST API No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) OpenAPI spec version: 2.6 Generated by: https://github.com/swagger-api/swagger-codegen.git """ import pprint import re import six import typing from ....
108
256
1,000
6
101
Flav-STOR-WL/py-pure-client
pypureclient/flasharray/FA_2_6/models/active_directory_post.py
Python
ActiveDirectoryPost
ActiveDirectoryPost
24
141
24
24
983b9b01aff6e22320e37e2b48d6ac46a03e3667
bigcode/the-stack
train
3a60e3124a6f5ec441bb243b
train
function
def _s3_download(path, key): session = boto3_session(region_name=REGION_NAME) s3 = session.client("s3") url_info = urlparse(path.strip()) s3_bucket = url_info.netloc s3_key = url_info.path.strip("/") s3.download_file(s3_bucket, s3_key, key) return True
def _s3_download(path, key):
session = boto3_session(region_name=REGION_NAME) s3 = session.client("s3") url_info = urlparse(path.strip()) s3_bucket = url_info.netloc s3_key = url_info.path.strip("/") s3.download_file(s3_bucket, s3_key, key) return True
from boto3.session import Session as boto3_session from rio_cogeo.cogeo import cog_translate, cog_validate from rio_cogeo.profiles import cog_profiles REGION_NAME = os.environ.get("AWS_REGION", "us-east-1") def _s3_download(path, key):
64
64
80
9
55
developmentseed/cogeo-watchbot
app/translator.py
Python
_s3_download
_s3_download
17
24
17
17
88089d5ea0dd3d73a2165bed30930ead061cb6a0
bigcode/the-stack
train
8de3b0666e075c4e4f285c14
train
function
def _translate(src_path, dst_path, profile="webp", profile_options={}, **options): """Convert image to COG.""" output_profile = cog_profiles.get(profile) output_profile.update(dict(BIGTIFF="IF_SAFER")) output_profile.update(profile_options) config = dict( GDAL_NUM_THREADS="ALL_CPUS", ...
def _translate(src_path, dst_path, profile="webp", profile_options={}, **options):
"""Convert image to COG.""" output_profile = cog_profiles.get(profile) output_profile.update(dict(BIGTIFF="IF_SAFER")) output_profile.update(profile_options) config = dict( GDAL_NUM_THREADS="ALL_CPUS", GDAL_TIFF_INTERNAL_MASK=True, GDAL_TIFF_OVR_BLOCKSIZE="128", ) c...
(region_name=REGION_NAME) s3 = session.client("s3") with open(path, "rb") as data: s3.upload_fileobj(data, bucket, key) return True def _translate(src_path, dst_path, profile="webp", profile_options={}, **options):
64
64
144
20
43
developmentseed/cogeo-watchbot
app/translator.py
Python
_translate
_translate
35
57
35
35
783ce175f77f32191199ac1a97c9548f70ab8a38
bigcode/the-stack
train
61c94169a6f612dbc3f687b9
train
function
def process( url, out_bucket, out_key, profile="webp", profile_options={}, copy_valid_cog=False, **options, ): """Download, convert and upload.""" url_info = urlparse(url.strip()) src_path = "/tmp/" + os.path.basename(url_info.path) if url_info.scheme not in ["http", "https"...
def process( url, out_bucket, out_key, profile="webp", profile_options={}, copy_valid_cog=False, **options, ):
"""Download, convert and upload.""" url_info = urlparse(url.strip()) src_path = "/tmp/" + os.path.basename(url_info.path) if url_info.scheme not in ["http", "https", "s3"]: raise Exception(f"Unsuported scheme {url_info.scheme}") if url_info.scheme.startswith("http"): wget.download(...
config=config, in_memory=False, quiet=True, allow_intermediate_compression=True, **options, ) return True def process( url, out_bucket, out_key, profile="webp", profile_options={}, copy_valid_cog=False, **options, ):
67
67
226
37
29
developmentseed/cogeo-watchbot
app/translator.py
Python
process
process
60
97
60
68
e24ba8f288ee335899df2597fe9de8ab186fc042
bigcode/the-stack
train
d95efb4449c0734e2407d7a8
train
function
def _upload(path, bucket, key): session = boto3_session(region_name=REGION_NAME) s3 = session.client("s3") with open(path, "rb") as data: s3.upload_fileobj(data, bucket, key) return True
def _upload(path, bucket, key):
session = boto3_session(region_name=REGION_NAME) s3 = session.client("s3") with open(path, "rb") as data: s3.upload_fileobj(data, bucket, key) return True
= session.client("s3") url_info = urlparse(path.strip()) s3_bucket = url_info.netloc s3_key = url_info.path.strip("/") s3.download_file(s3_bucket, s3_key, key) return True def _upload(path, bucket, key):
64
64
59
9
54
developmentseed/cogeo-watchbot
app/translator.py
Python
_upload
_upload
27
32
27
27
8266ce8dad4ecce3acdbcdf84c2c7e0fd8113f61
bigcode/the-stack
train
eee71739f6efd616943e6a0f
train
function
@render_to('highlights.html') def highlights(request): return {}
@render_to('highlights.html') def highlights(request):
return {}
UnitChoiceForm(data=request.POST) if form.is_valid(): unit_choice = form.cleaned_data['unit_choice'] request.session['user_units'] = unit_choice return HttpResponseRedirect(request.META.get('HTTP_REFERER', '/')) @render_to('highlights.html') def highlights(request):
63
64
15
12
51
Jordzman/explorer
homepage/views.py
Python
highlights
highlights
193
195
193
194
6a990c065ba54a7bee0c57658a591ae6d7e2f66d
bigcode/the-stack
train
a99666ecf8368c445bcb67bd
train
function
def fail500(request): raise Exception('IntentionalFail: This Was On Purpose')
def fail500(request):
raise Exception('IntentionalFail: This Was On Purpose')
form.is_valid(): unit_choice = form.cleaned_data['unit_choice'] request.session['user_units'] = unit_choice return HttpResponseRedirect(request.META.get('HTTP_REFERER', '/')) @render_to('highlights.html') def highlights(request): return {} def fail500(request):
63
64
18
5
58
Jordzman/explorer
homepage/views.py
Python
fail500
fail500
198
199
198
198
6bd9d3caf94968f40e04f3ef5015019f430766ed
bigcode/the-stack
train
1192c55f5257270ffe22c2a2
train
function
def set_units(request): if request.method == 'POST': form = UnitChoiceForm(data=request.POST) if form.is_valid(): unit_choice = form.cleaned_data['unit_choice'] request.session['user_units'] = unit_choice return HttpResponseRedirect(request.META.get('HTTP_REFERER'...
def set_units(request):
if request.method == 'POST': form = UnitChoiceForm(data=request.POST) if form.is_valid(): unit_choice = form.cleaned_data['unit_choice'] request.session['user_units'] = unit_choice return HttpResponseRedirect(request.META.get('HTTP_REFERER', '/'))
'form': form, 'recent_blocks': recent_blocks, 'recent_txs': recent_txs_filtered, 'fees': fees, 'fee_api_url': fee_api_url, 'BLOCKCYPHER_PUBLIC_KEY': BLOCKCYPHER_PUBLIC_KEY, } def set_units(request):
64
64
67
5
59
Jordzman/explorer
homepage/views.py
Python
set_units
set_units
184
190
184
184
585984389475598266a564be4c93f73bbfb5e787
bigcode/the-stack
train
a850bd0dac59347bef620522
train
function
@assert_valid_coin_symbol @render_to('coin_overview.html') def coin_overview(request, coin_symbol): initial = { 'coin_symbol': coin_symbol, 'search_string': COIN_SYMBOL_MAPPINGS[coin_symbol]['example_address'] } form = SearchForm(initial=initial) latest_bh = get_latest_...
@assert_valid_coin_symbol @render_to('coin_overview.html') def coin_overview(request, coin_symbol):
initial = { 'coin_symbol': coin_symbol, 'search_string': COIN_SYMBOL_MAPPINGS[coin_symbol]['example_address'] } form = SearchForm(initial=initial) latest_bh = get_latest_block_height(coin_symbol=coin_symbol, api_key=BLOCKCYPHER_API_KEY) recent_blocks = get_blocks_ov...
Sorry, that's not a valid wallet name") messages.error(request, msg) if redirect_url: return HttpResponseRedirect(redirect_url) else: currency = COIN_SYMBOL_MAPPINGS[request.POST['coin_symbol']]['display_shortname'] msg = _("Sorry, '%(sea...
159
159
533
24
135
Jordzman/explorer
homepage/views.py
Python
coin_overview
coin_overview
127
181
127
130
a1ef35adbac2fb41a178c728fb3499dc02237bb3
bigcode/the-stack
train
a1b5a408f49a96be7933e522
train
function
@render_to('home.html') def home(request): form = SearchForm(initial={ 'search_string': '16Fg2yjwrbtC6fZp61EV9mNVKmwCzGasw5', 'coin_symbol': 'btc', }) if request.method == 'POST': form = SearchForm(data=request.POST) if form.is_valid(): redirect_url = None ...
@render_to('home.html') def home(request):
form = SearchForm(initial={ 'search_string': '16Fg2yjwrbtC6fZp61EV9mNVKmwCzGasw5', 'coin_symbol': 'btc', }) if request.method == 'POST': form = SearchForm(data=request.POST) if form.is_valid(): redirect_url = None search_string = form.cleaned_data[...
from django.http import HttpResponseRedirect from django.core.urlresolvers import reverse from django.contrib import messages from django.utils.translation import ugettext_lazy as _ from annoying.decorators import render_to from blockexplorer.decorators import assert_valid_coin_symbol from blockexplorer.settings impo...
200
256
966
11
188
Jordzman/explorer
homepage/views.py
Python
home
home
21
124
21
22
3190b19d7a9c632ff196fef9176a73778d504a46
bigcode/the-stack
train
f0b4d7ab404991c787ae4527
train
class
class KantGenerator(object): """ generates mock philosophy based on a context-free grammar""" def __init__(self, grammar, source=None): self.loadGrammar(grammar) self.loadSource(source and source or self.getDefaultSource()) self.refresh() def _load(self, source): """load XM...
class KantGenerator(object):
""" generates mock philosophy based on a context-free grammar""" def __init__(self, grammar, source=None): self.loadGrammar(grammar) self.loadSource(source and source or self.getDefaultSource()) self.refresh() def _load(self, source): """load XML input source, return parsed...
"""Kant Generator for Python Generates mock philosophy based on a context-free grammar Usage: python kgp.py [options] [source] Options: -g ..., --grammar=... use specified grammar file or URL -h, --help show this help -d show debugging information while parsing Examples: k...
179
256
1,056
5
173
abos5/pythontutor
dive/kgp.py
Python
KantGenerator
KantGenerator
31
170
31
31
367a768ac87e11111dc53e87f766b7dbc97c8730
bigcode/the-stack
train
3679b890a21794eafbbe3b1b
train
function
def usage(): print(__doc__)
def usage():
print(__doc__)
int(node.attributes['chance'].value) doit = (chance > random.randrange(100)) else: doit = 1 if doit: for child in node.childNodes: self.parse(child) def do_choice(self, node): self.parse(self.randomChildElement) def usage():
64
64
8
3
61
abos5/pythontutor
dive/kgp.py
Python
usage
usage
173
174
173
173
906cbaf2897083cdfedb62ed2731d3d05bb2d6e0
bigcode/the-stack
train
5ad1fcc12cf7cea9845b911a
train
class
class NoSourceError(Exception): pass
class NoSourceError(Exception):
pass
"<xref id='paragraph'/>" generates a paragraph of Kant kgp.py template.xml reads from template.xml to decide what to generate """ from xml.dom import minidom import random import toolbox import sys import getopt _debug = 0 class NoSourceError(Exception):
64
64
9
6
57
abos5/pythontutor
dive/kgp.py
Python
NoSourceError
NoSourceError
27
28
27
27
650c052a187c49f72c01aff0cc403af013b6b31a
bigcode/the-stack
train
ab2d8ba0cf0976b0cfb8e9d7
train
function
def main(argv): grammar = "kant.xml" try: opts, args = getopt.getopt(argv, "hg:d", ["help", "grammar="]) except getopt.GetoptError: usage() sys.exit(2) for opt, arg in opts: if opt in ("-h", "-help"): usage() sys.exit() elif opt == '-d': ...
def main(argv):
grammar = "kant.xml" try: opts, args = getopt.getopt(argv, "hg:d", ["help", "grammar="]) except getopt.GetoptError: usage() sys.exit(2) for opt, arg in opts: if opt in ("-h", "-help"): usage() sys.exit() elif opt == '-d': globa...
doit = (chance > random.randrange(100)) else: doit = 1 if doit: for child in node.childNodes: self.parse(child) def do_choice(self, node): self.parse(self.randomChildElement) def usage(): print(__doc__) def main(argv):
64
64
133
4
60
abos5/pythontutor
dive/kgp.py
Python
main
main
177
197
177
177
cfc2fc2332215bda815df96b968597692af9cc35
bigcode/the-stack
train
0adf8ed11f6a3ca84d17bd14
train
function
def lookup(context, portal_type, **kwargs): at = getToolByName(context, 'archetype_tool') catalog = at.catalog_map.get(portal_type, [None])[0] or 'portal_catalog' catalog = getToolByName(context, catalog) kwargs['portal_type'] = portal_type return catalog(**kwargs)[0].getObject()
def lookup(context, portal_type, **kwargs):
at = getToolByName(context, 'archetype_tool') catalog = at.catalog_map.get(portal_type, [None])[0] or 'portal_catalog' catalog = getToolByName(context, catalog) kwargs['portal_type'] = portal_type return catalog(**kwargs)[0].getObject()
bika.lims.utils import t from Products.CMFCore.utils import getToolByName from bika.lims import logger from zope.interface import implements from pkg_resources import resource_filename import datetime, os.path import re import transaction def lookup(context, portal_type, **kwargs):
64
64
78
10
53
hocinebendou/bika.gsoc
bika/lims/exportimport/setupdata/__init__.py
Python
lookup
lookup
19
24
19
19
b80528e61f5d8cc46ff24458550167bdd33bf156
bigcode/the-stack
train
572119bfab77c462db139142
train
class
class AR_Priorities(WorksheetImporter): def Import(self): folder = self.context.bika_setup.bika_arpriorities for row in self.get_rows(3): if row['title']: obj = _createObjectByType("ARPriority", folder, tmpID()) obj.edit(title=row['title'], ...
class AR_Priorities(WorksheetImporter):
def Import(self): folder = self.context.bika_setup.bika_arpriorities for row in self.get_rows(3): if row['title']: obj = _createObjectByType("ARPriority", folder, tmpID()) obj.edit(title=row['title'], description=row.get('descripti...
if not row['end']: message = _("InvoiceBatch has no End Date") raise Exception(t(message)) obj.edit( title=row['title'], BatchStartDate=row['start'], BatchEndDate=row['end'], ) renameAfterCreation(obj) c...
66
66
222
9
57
hocinebendou/bika.gsoc
bika/lims/exportimport/setupdata/__init__.py
Python
AR_Priorities
AR_Priorities
2,203
2,227
2,203
2,204
0156ac2dca6cacf4caef654b4bb49c30ff6e69d0
bigcode/the-stack
train
bad5a39aa43292cd9229acfd
train
class
class Product_Categories(WorksheetImporter): def Import(self): folder = self.context.bika_setup.bika_productcategories for row in self.get_rows(3): obj = _createObjectByType("ProductCategory", folder, tmpID()) obj.edit( title=row['title'], ...
class Product_Categories(WorksheetImporter):
def Import(self): folder = self.context.bika_setup.bika_productcategories for row in self.get_rows(3): obj = _createObjectByType("ProductCategory", folder, tmpID()) obj.edit( title=row['title'], description=row.get('description'...
big_icon_name = row.get('bigIcon', None) if big_icon_name: big_icon = self.get_file_data(big_icon_name) if big_icon: obj.setBigIcon(big_icon) obj.unmarkCreationFlag() renameAfterCreation(obj) class Product_C...
64
64
98
8
56
hocinebendou/bika.gsoc
bika/lims/exportimport/setupdata/__init__.py
Python
Product_Categories
Product_Categories
2,229
2,241
2,229
2,230
c38daf19fa78100d33bbf7a5574cb812eca25216
bigcode/the-stack
train
1558c9ed07ea44f5bd47bfaf
train
class
class Container_Types(WorksheetImporter): def Import(self): folder = self.context.bika_setup.bika_containertypes for row in self.get_rows(3): if not row['title']: continue obj = _createObjectByType("ContainerType", folder, tmpID()) obj.edit(title=...
class Container_Types(WorksheetImporter):
def Import(self): folder = self.context.bika_setup.bika_containertypes for row in self.get_rows(3): if not row['title']: continue obj = _createObjectByType("ContainerType", folder, tmpID()) obj.edit(title=row['title'], descript...
user (%s): %s" % (msg, username)) contact.aq_parent.manage_setLocalRoles(row['Username'], ['Owner', ]) # add user to Clients group group = portal_groups.getGroupById('Clients') group.addMember(username) class Container_Types(WorksheetImporter):
64
64
95
8
56
hocinebendou/bika.gsoc
bika/lims/exportimport/setupdata/__init__.py
Python
Container_Types
Container_Types
543
554
543
544
a52e96a54756ece1b740e3be163336e7ddeffec0
bigcode/the-stack
train
13d096bce6c01e1962fa4228
train
class
class Attachment_Types(WorksheetImporter): def Import(self): folder = self.context.bika_setup.bika_attachmenttypes for row in self.get_rows(3): obj = _createObjectByType("AttachmentType", folder, tmpID()) obj.edit( title=row['title'], descript...
class Attachment_Types(WorksheetImporter):
def Import(self): folder = self.context.bika_setup.bika_attachmenttypes for row in self.get_rows(3): obj = _createObjectByType("AttachmentType", folder, tmpID()) obj.edit( title=row['title'], description=row.get('description', '')) ...
else separator # add new prefix to list prefixes.append({'portal_type': row['portal_type'], 'padding': row['padding'], 'prefix': row['prefix'], 'separator': separator}) self.context.bika_setup.setPre...
64
64
85
8
56
hocinebendou/bika.gsoc
bika/lims/exportimport/setupdata/__init__.py
Python
Attachment_Types
Attachment_Types
1,912
1,922
1,912
1,913
1fd8cba6c81840a7e8434537d026ec04bd0c7224
bigcode/the-stack
train
b0631c1ee16c309e033d3323
train
class
class Invoice_Batches(WorksheetImporter): def Import(self): folder = self.context.invoices for row in self.get_rows(3): obj = _createObjectByType("InvoiceBatch", folder, tmpID()) if not row['title']: message = _("InvoiceBatch has no Title") ra...
class Invoice_Batches(WorksheetImporter):
def Import(self): folder = self.context.invoices for row in self.get_rows(3): obj = _createObjectByType("InvoiceBatch", folder, tmpID()) if not row['title']: message = _("InvoiceBatch has no Title") raise Exception(t(message)) if no...
Profile(profile) if row['ARTemplate_title']: template = pc(portal_type="ARTemplate", title=row['ARTemplate_title'])[0].getObject() obj.setProfile(template) obj.unmarkCreationFlag() self.load_analyses(obj) class Invoice_Ba...
64
64
153
8
56
hocinebendou/bika.gsoc
bika/lims/exportimport/setupdata/__init__.py
Python
Invoice_Batches
Invoice_Batches
2,180
2,200
2,180
2,181
398f0f333d7f0dee8c9ba994ba7280ff696b3968
bigcode/the-stack
train
6c0d29345d51b1550032affe
train
function
def addDocument(self, row_dict, folder): """ This function adds a multifile object to the instrument folder :param row_dict: the dictionary which contains the document information :param folder: the instrument object """ if folder: # This content type need a file if row_dict.get(...
def addDocument(self, row_dict, folder):
""" This function adds a multifile object to the instrument folder :param row_dict: the dictionary which contains the document information :param folder: the instrument object """ if folder: # This content type need a file if row_dict.get('File', None): path = resourc...
Fullname() == row.get('approvedby', ''): obj.setValidator(contact.UID()) obj.unmarkCreationFlag() renameAfterCreation(obj) class Instrument_Documents(WorksheetImporter): def Import(self): bsc = getToolByName(self.context, 'bika_setup_catalog') ...
125
125
417
10
115
hocinebendou/bika.gsoc
bika/lims/exportimport/setupdata/__init__.py
Python
addDocument
addDocument
892
933
892
892
f82ff1b383e4ac2b6943ebb1fd88e3218c0d138f
bigcode/the-stack
train
abf9b08c78b48f37705723e0
train
class
class Supplier_Contacts(WorksheetImporter): def Import(self): bsc = getToolByName(self.context, 'bika_setup_catalog') for row in self.get_rows(3): if not row['Supplier_Name']: continue if not row['Firstname']: continue folder = bsc...
class Supplier_Contacts(WorksheetImporter):
def Import(self): bsc = getToolByName(self.context, 'bika_setup_catalog') for row in self.get_rows(3): if not row['Supplier_Name']: continue if not row['Firstname']: continue folder = bsc(portal_type="Supplier", ...
('Website', ''), VAT="%02f" % Float(row.get('VAT', '')), #Hocine ) self.fill_contactfields(row, obj) self.fill_addressfields(row, obj) obj.unmarkCreationFlag() renameAfterCreation(obj) class Supplier_Contacts(WorksheetIm...
64
64
174
8
56
hocinebendou/bika.gsoc
bika/lims/exportimport/setupdata/__init__.py
Python
Supplier_Contacts
Supplier_Contacts
632
655
632
633
d5d3ea3280477422b394514c62489619e783e35d
bigcode/the-stack
train
3ba61074a47224b1660c5847
train
class
class Instrument_Documents(WorksheetImporter): def Import(self): bsc = getToolByName(self.context, 'bika_setup_catalog') for row in self.get_rows(3): if not row.get('instrument', ''): continue folder = self.get_object(bsc, 'Instrument', row.get('instrument', ...
class Instrument_Documents(WorksheetImporter):
def Import(self): bsc = getToolByName(self.context, 'bika_setup_catalog') for row in self.get_rows(3): if not row.get('instrument', ''): continue folder = self.get_object(bsc, 'Instrument', row.get('instrument', '')) addDocument(self, row, folder)
== row.get('preparedby', ''): obj.setPreparator(contact.UID()) if contact.getFullname() == row.get('approvedby', ''): obj.setValidator(contact.UID()) obj.unmarkCreationFlag() renameAfterCreation(obj) class Instrument_Do...
64
64
82
9
55
hocinebendou/bika.gsoc
bika/lims/exportimport/setupdata/__init__.py
Python
Instrument_Documents
Instrument_Documents
882
890
882
883
475166c57bd55619527db0a0679cae54d7645e63
bigcode/the-stack
train
7668c05fa91f37b0ba07174f
train
class
class Manufacturers(WorksheetImporter): def Import(self): folder = self.context.bika_setup.bika_manufacturers for row in self.get_rows(3): obj = _createObjectByType("Manufacturer", folder, tmpID()) if row['title']: obj.edit( title=row['tit...
class Manufacturers(WorksheetImporter):
def Import(self): folder = self.context.bika_setup.bika_manufacturers for row in self.get_rows(3): obj = _createObjectByType("Manufacturer", folder, tmpID()) if row['title']: obj.edit( title=row['title'], description=row...
.edit( Firstname=row['Firstname'], Surname=row.get('Surname', ''), Username=row.get('Username') ) self.fill_contactfields(row, obj) self.fill_addressfields(row, obj) obj.unmarkCreationFlag() renameAfterCreation(o...
64
64
111
6
58
hocinebendou/bika.gsoc
bika/lims/exportimport/setupdata/__init__.py
Python
Manufacturers
Manufacturers
658
672
658
659
4451458c92d30d1a6947d967d2d232d7817d1d15
bigcode/the-stack
train
a8a6927fa5030da102c6b5c2
train
class
class AR_Templates(WorksheetImporter): def load_artemplate_analyses(self): sheetname = 'AR Template Analyses' worksheet = self.workbook.get_sheet_by_name(sheetname) self.artemplate_analyses = {} if not worksheet: return bsc = getToolByName(self.context, 'bika_set...
class AR_Templates(WorksheetImporter):
def load_artemplate_analyses(self): sheetname = 'AR Template Analyses' worksheet = self.workbook.get_sheet_by_name(sheetname) self.artemplate_analyses = {} if not worksheet: return bsc = getToolByName(self.context, 'bika_setup_catalog') for row in self.get...
: service = bsc(portal_type='AnalysisService', getKeyword=row['Service'])[0].getObject() self.profile_services[row['Profile']].append(service) def Import(self): self.load_analysis_profile_services() folder = self.context.bika_setup.bika_anal...
223
223
746
8
215
hocinebendou/bika.gsoc
bika/lims/exportimport/setupdata/__init__.py
Python
AR_Templates
AR_Templates
1,662
1,744
1,662
1,663
1337f3920332d89dd8d8a5004c733dbef3ed26c3
bigcode/the-stack
train
4957d9c077d2dcc9672225a4
train
class
class Analysis_Requests(WorksheetImporter): def load_analyses(self, sample): sheetname = 'Analyses' if not hasattr(self, 'analyses_worksheet'): worksheet = self.workbook.get_sheet_by_name(sheetname) if not worksheet: return self.analyses_worksheet...
class Analysis_Requests(WorksheetImporter):
def load_analyses(self, sample): sheetname = 'Analyses' if not hasattr(self, 'analyses_worksheet'): worksheet = self.workbook.get_sheet_by_name(sheetname) if not worksheet: return self.analyses_worksheet = worksheet bsc = getToolByName(self...
']) obj.setSamplingWorkflowEnabled(False) obj.setDateSampled(row['DateSampled']) obj.setDateReceived(row['DateReceived']) obj.setRemarks(row['Remarks']) obj.setComposite(self.to_bool(row['Composite'])) obj.setDateExpired(row['DateExpired']) ...
256
256
984
8
248
hocinebendou/bika.gsoc
bika/lims/exportimport/setupdata/__init__.py
Python
Analysis_Requests
Analysis_Requests
2,070
2,177
2,070
2,071
9b7b5738f3c397a799ddf67def13a428e79994bf
bigcode/the-stack
train
976a657c6f0ea134dfac1cd9
train
class
class Reference_Samples(WorksheetImporter): def load_reference_sample_results(self, sample): sheetname = 'Reference Sample Results' if not hasattr(self, 'results_worksheet'): worksheet = self.workbook.get_sheet_by_name(sheetname) if not worksheet: return ...
class Reference_Samples(WorksheetImporter):
def load_reference_sample_results(self, sample): sheetname = 'Reference Sample Results' if not hasattr(self, 'results_worksheet'): worksheet = self.workbook.get_sheet_by_name(sheetname) if not worksheet: return self.results_worksheet = worksheet ...
class ID_Prefixes(WorksheetImporter): def Import(self): prefixes = self.context.bika_setup.getPrefixes() for row in self.get_rows(3): # remove existing prefix from list prefixes = [p for p in prefixes if p['portal_type'] != row['portal_type']] ...
256
256
913
8
248
hocinebendou/bika.gsoc
bika/lims/exportimport/setupdata/__init__.py
Python
Reference_Samples
Reference_Samples
1,925
2,030
1,925
1,926
8e463ad4a012b99dc8014cf761b398248b932492
bigcode/the-stack
train
24079d0721508cc6cfc8289c
train
class
class Analysis_Specifications(WorksheetImporter): def resolve_service(self, row): bsc = getToolByName(self.context, "bika_setup_catalog") service = bsc( portal_type="AnalysisService", title=safe_unicode(row["service"]) ) if not service: service = ...
class Analysis_Specifications(WorksheetImporter):
def resolve_service(self, row): bsc = getToolByName(self.context, "bika_setup_catalog") service = bsc( portal_type="AnalysisService", title=safe_unicode(row["service"]) ) if not service: service = bsc( portal_type="AnalysisService",...
, UseDefaultCalculation=usedefaultcalculation, DeferredCalculation=deferredcalculation, DuplicateVariation="%02f" % Float(row['DuplicateVariation']), Accredited=self.to_bool(row['Accredited']), InterimFields=hasattr(self, 'service_interims'...
160
160
535
9
151
hocinebendou/bika.gsoc
bika/lims/exportimport/setupdata/__init__.py
Python
Analysis_Specifications
Analysis_Specifications
1,560
1,620
1,560
1,561
0c490ee570510f97546559027f64549f78592e4f
bigcode/the-stack
train
5311a14808f860e2c35d0748
train
class
class Calculations(WorksheetImporter): def get_interim_fields(self): # preload Calculation Interim Fields sheet sheetname = 'Calculation Interim Fields' worksheet = self.workbook.get_sheet_by_name(sheetname) if not worksheet: return self.interim_fields = {} ...
class Calculations(WorksheetImporter):
def get_interim_fields(self): # preload Calculation Interim Fields sheet sheetname = 'Calculation Interim Fields' worksheet = self.workbook.get_sheet_by_name(sheetname) if not worksheet: return self.interim_fields = {} rows = self.get_rows(3, worksheet=wor...
logger.warning(msg[0] + " Error on sheet: " + self.sheetname) obj.unmarkCreationFlag() renameAfterCreation(obj) class Sampling_Deviations(WorksheetImporter): def Import(self): folder = self.context.bika_setup.bika_samplingdeviations for row...
134
134
449
7
127
hocinebendou/bika.gsoc
bika/lims/exportimport/setupdata/__init__.py
Python
Calculations
Calculations
1,254
1,306
1,254
1,255
2a89c169666099b9172b7055cf3defe5a24d3e4c
bigcode/the-stack
train
341d036882bbbc3c43e1a763
train
class
class Samples(WorksheetImporter): def Import(self): folder = self.context.bika_setup.bika_attachmenttypes pc = getToolByName(self.context, 'portal_catalog') bsc = getToolByName(self.context, 'bika_setup_catalog') for row in self.get_rows(3): if not row['id']: ...
class Samples(WorksheetImporter):
def Import(self): folder = self.context.bika_setup.bika_attachmenttypes pc = getToolByName(self.context, 'portal_catalog') bsc = getToolByName(self.context, 'bika_setup_catalog') for row in self.get_rows(3): if not row['id']: continue client = ...
'], LotNumber=row['LotNumber'], Remarks=row['Remarks'], ExpiryDate=row['ExpiryDate'], DateSampled=row['DateSampled'], DateReceived=row['DateReceived'], DateOpened=row['DateOpened'], ...
114
114
383
6
108
hocinebendou/bika.gsoc
bika/lims/exportimport/setupdata/__init__.py
Python
Samples
Samples
2,032
2,068
2,032
2,033
6df0d20f0466aa86a54a4cca0c98d4907824379a
bigcode/the-stack
train
fc05c079dd5e3242bfd85918
train
function
def check_for_required_columns(name, data, required): for column in required: if not data.get(column, None): message = _("%s has no '%s' column." % (name, column)) raise Exception(t(message))
def check_for_required_columns(name, data, required):
for column in required: if not data.get(column, None): message = _("%s has no '%s' column." % (name, column)) raise Exception(t(message))
catalog = at.catalog_map.get(portal_type, [None])[0] or 'portal_catalog' catalog = getToolByName(context, catalog) kwargs['portal_type'] = portal_type return catalog(**kwargs)[0].getObject() def check_for_required_columns(name, data, required):
64
64
51
11
53
hocinebendou/bika.gsoc
bika/lims/exportimport/setupdata/__init__.py
Python
check_for_required_columns
check_for_required_columns
27
31
27
27
88aed52a45bd50cc03415bd543bb4328026ddd3c
bigcode/the-stack
train
00be3d1b87f886b4445b9dee
train
class
class Instrument_Types(WorksheetImporter): def Import(self): folder = self.context.bika_setup.bika_instrumenttypes for row in self.get_rows(3): obj = _createObjectByType("InstrumentType", folder, tmpID()) obj.edit( title=row['title'], ...
class Instrument_Types(WorksheetImporter):
def Import(self): folder = self.context.bika_setup.bika_instrumenttypes for row in self.get_rows(3): obj = _createObjectByType("InstrumentType", folder, tmpID()) obj.edit( title=row['title'], description=row.get('description', '...
title']: obj.edit( title=row['title'], description=row.get('description', ''), website=row.get('website', '') #Hocine ) self.fill_addressfields(row, obj) obj.unmarkCreationFlag() r...
64
64
86
8
56
hocinebendou/bika.gsoc
bika/lims/exportimport/setupdata/__init__.py
Python
Instrument_Types
Instrument_Types
675
685
675
676
3538077e193c182c40005a22815db014da5f3d12
bigcode/the-stack
train