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
b9ab27fbf51a7cbb7944b6bd
train
function
def get_repo_url(token, github_repository): return "https://x-access-token:%s@github.com/%s" % (token, github_repository)
def get_repo_url(token, github_repository):
return "https://x-access-token:%s@github.com/%s" % (token, github_repository)
= "{head_commit[author][name]}".format(**event_data) else: email = os.environ["GITHUB_ACTOR"] + "@users.noreply.github.com" name = os.environ["GITHUB_ACTOR"] return email, name def get_repo_url(token, github_repository):
64
64
32
9
54
azarakovskiy/create-pull-request
dist/src/create-pull-request.py
Python
get_repo_url
get_repo_url
47
48
47
47
155be77d95c363240280beafdb723aebd8de98dc
bigcode/the-stack
train
bf947ae6e3f62729a9dc2704
train
function
def get_head_short_sha1(repo): return repo.git.rev_parse("--short", "HEAD")
def get_head_short_sha1(repo):
return repo.git.rev_parse("--short", "HEAD")
_event_path) as f: github_event = json.load(f) if bool(os.environ.get("DEBUG_EVENT")): print(os.environ["GITHUB_EVENT_NAME"]) print(json.dumps(github_event, sort_keys=True, indent=2)) return github_event def get_head_short_sha1(repo):
64
64
20
8
55
azarakovskiy/create-pull-request
dist/src/create-pull-request.py
Python
get_head_short_sha1
get_head_short_sha1
22
23
22
22
1841285aa9753bba2486d55c12992040cff583e7
bigcode/the-stack
train
aec8ed00bcee01f89ce1866a
train
function
def _VisitNeonOceanSite (_connection: int = None) -> None: try: Generic.ShowOpenBrowserDialog(Websites.GetNOMainURL()) except: output = commands.CheatOutput(_connection) output("Failed to show the NeonOcean site with the open browser dialog.") Debug.Log("Failed to show the NeonOcean site with the open browse...
def _VisitNeonOceanSite (_connection: int = None) -> None:
try: Generic.ShowOpenBrowserDialog(Websites.GetNOMainURL()) except: output = commands.CheatOutput(_connection) output("Failed to show the NeonOcean site with the open browser dialog.") Debug.Log("Failed to show the NeonOcean site with the open browser dialog.", This.Mod.Namespace, Debug.LogLevels.Exception, ...
to show the support site with the open browser dialog.") Debug.Log("Failed to show the support site with the open browser dialog.", This.Mod.Namespace, Debug.LogLevels.Exception, group = This.Mod.Namespace, owner = __name__) def _VisitNeonOceanSite (_connection: int = None) -> None:
64
64
99
17
47
NeonOcean/Order
Python/NeonOcean.S4.Order/NeonOcean/S4/Order/Console/Interactions/Global.py
Python
_VisitNeonOceanSite
_VisitNeonOceanSite
42
49
42
42
d9ca2a97332cef989f815e1392970c562a25be63
bigcode/the-stack
train
eab9cdc4323666966e5e0c39
train
function
def _Setup () -> None: global SupportNeonOceanCommand, VisitNeonOceanSiteCommand commandPrefix = This.Mod.Namespace.lower() + ".global" # type: str # noinspection SpellCheckingInspection SupportNeonOceanCommand = Command.ConsoleCommand(_SupportNeonOcean, commandPrefix + ".support_neonocean") # noinspection Spel...
def _Setup () -> None:
global SupportNeonOceanCommand, VisitNeonOceanSiteCommand commandPrefix = This.Mod.Namespace.lower() + ".global" # type: str # noinspection SpellCheckingInspection SupportNeonOceanCommand = Command.ConsoleCommand(_SupportNeonOcean, commandPrefix + ".support_neonocean") # noinspection SpellCheckingInspection Vi...
import Debug, LoadingShared, This, Websites from NeonOcean.S4.Order.Console import Command from NeonOcean.S4.Order.UI import Generic from sims4 import commands SupportNeonOceanCommand: Command.ConsoleCommand VisitNeonOceanSiteCommand: Command.ConsoleCommand def _Setup () -> None:
64
64
108
7
56
NeonOcean/Order
Python/NeonOcean.S4.Order/NeonOcean/S4/Order/Console/Interactions/Global.py
Python
_Setup
_Setup
9
17
9
9
385bf7884e4871cb62391e736417009d2089aa07
bigcode/the-stack
train
8fff3d3675c8bac133737682
train
function
def _OnStop (cause: LoadingShared.UnloadingCauses) -> None: if cause: pass SupportNeonOceanCommand.UnregisterCommand() VisitNeonOceanSiteCommand.UnregisterCommand()
def _OnStop (cause: LoadingShared.UnloadingCauses) -> None:
if cause: pass SupportNeonOceanCommand.UnregisterCommand() VisitNeonOceanSiteCommand.UnregisterCommand()
_neonocean_site") def _OnStart (cause: LoadingShared.LoadingCauses) -> None: if cause: pass SupportNeonOceanCommand.RegisterCommand() VisitNeonOceanSiteCommand.RegisterCommand() def _OnStop (cause: LoadingShared.UnloadingCauses) -> None:
64
64
44
17
47
NeonOcean/Order
Python/NeonOcean.S4.Order/NeonOcean/S4/Order/Console/Interactions/Global.py
Python
_OnStop
_OnStop
26
31
26
26
95ed52d5f530d8088a4674229f0377e4c840fbdd
bigcode/the-stack
train
98ffafc76b7aaf8e954fddd9
train
function
def _SupportNeonOcean (_connection: int = None) -> None: try: Generic.ShowOpenBrowserDialog(Websites.GetNOSupportURL()) except: output = commands.CheatOutput(_connection) output("Failed to show the support site with the open browser dialog.") Debug.Log("Failed to show the support site with the open browser d...
def _SupportNeonOcean (_connection: int = None) -> None:
try: Generic.ShowOpenBrowserDialog(Websites.GetNOSupportURL()) except: output = commands.CheatOutput(_connection) output("Failed to show the support site with the open browser dialog.") Debug.Log("Failed to show the support site with the open browser dialog.", This.Mod.Namespace, Debug.LogLevels.Exception, g...
Command.RegisterCommand() def _OnStop (cause: LoadingShared.UnloadingCauses) -> None: if cause: pass SupportNeonOceanCommand.UnregisterCommand() VisitNeonOceanSiteCommand.UnregisterCommand() def _SupportNeonOcean (_connection: int = None) -> None:
64
64
95
16
48
NeonOcean/Order
Python/NeonOcean.S4.Order/NeonOcean/S4/Order/Console/Interactions/Global.py
Python
_SupportNeonOcean
_SupportNeonOcean
33
40
33
33
766ab0ff7ac0690557a5f7577a636bdff7541491
bigcode/the-stack
train
ced351305cac7d93f19d88d6
train
function
def _OnStart (cause: LoadingShared.LoadingCauses) -> None: if cause: pass SupportNeonOceanCommand.RegisterCommand() VisitNeonOceanSiteCommand.RegisterCommand()
def _OnStart (cause: LoadingShared.LoadingCauses) -> None:
if cause: pass SupportNeonOceanCommand.RegisterCommand() VisitNeonOceanSiteCommand.RegisterCommand()
Ocean, commandPrefix + ".support_neonocean") # noinspection SpellCheckingInspection VisitNeonOceanSiteCommand = Command.ConsoleCommand(_VisitNeonOceanSite, commandPrefix + ".visit_neonocean_site") def _OnStart (cause: LoadingShared.LoadingCauses) -> None:
64
64
42
17
47
NeonOcean/Order
Python/NeonOcean.S4.Order/NeonOcean/S4/Order/Console/Interactions/Global.py
Python
_OnStart
_OnStart
19
24
19
19
a7a3a9fbf4e47fbe317ebb695d702b326c9cd12f
bigcode/the-stack
train
f2e2c6fbd0a867da97e27864
train
class
class StackExplorer(QtGui.QMainWindow): def __init__(self, key_list, data_list, parent=None): QtGui.QMainWindow.__init__(self, parent=parent) self.setWindowTitle('StackExplorer') self._main_window = CrossSectionMainWindow(data_list=data_list, ...
class StackExplorer(QtGui.QMainWindow):
def __init__(self, key_list, data_list, parent=None): QtGui.QMainWindow.__init__(self, parent=parent) self.setWindowTitle('StackExplorer') self._main_window = CrossSectionMainWindow(data_list=data_list, key_list=key_list, ...
Gui, QtCore import numpy as np from xray_vision.messenger.mpl.cross_section_2d import CrossSection2DMessenger from xray_vision.qt_widgets import CrossSectionMainWindow import logging logger = logging.getLogger(__name__) class StackExplorer(QtGui.QMainWindow):
64
64
121
9
55
CJ-Wright/xpd_workflow
xpd_workflow/vis2d.py
Python
StackExplorer
StackExplorer
18
31
18
18
ec5810714700fb9f78f2d6d43a63c374e0586bb4
bigcode/the-stack
train
3931eca5b1744b65fda7d116
train
class
class Migration(migrations.Migration): dependencies = [ ('polls', '0002_image'), ] operations = [ migrations.AddField( model_name='image', name='description', field=models.CharField(default='', max_length=200), preserve_default=False, ...
class Migration(migrations.Migration):
dependencies = [ ('polls', '0002_image'), ] operations = [ migrations.AddField( model_name='image', name='description', field=models.CharField(default='', max_length=200), preserve_default=False, ), ]
# Generated by Django 4.0.1 on 2022-02-22 15:36 from django.db import migrations, models class Migration(migrations.Migration):
38
64
64
7
30
harry-kav/ECM-2434-Group-Software-deploy1
polls/migrations/0003_image_description.py
Python
Migration
Migration
6
19
6
7
62661470e9dfcb8a0905f53c6d277f7151cacdb1
bigcode/the-stack
train
a4ca955fc59f4d6f3a9d934f
train
function
def test_can_find_highest_consecutive_list_sum_in_a_list(): result = highest_sum_list([3,5,3,4,6,7,4], 4) assert result == 21
def test_can_find_highest_consecutive_list_sum_in_a_list():
result = highest_sum_list([3,5,3,4,6,7,4], 4) assert result == 21
from sliding_window import highest_sum_list def test_can_find_highest_consecutive_list_sum_in_a_list(): result = highest_sum_list([1,2,3,4], 2) assert result == 7 def test_can_find_highest_consecutive_list_sum_in_a_list():
61
64
45
14
46
mamaz/learn-stuffs-with-python
sliding_window/sliding_window_test.py
Python
test_can_find_highest_consecutive_list_sum_in_a_list
test_can_find_highest_consecutive_list_sum_in_a_list
7
9
7
7
6e06f82afed12ed327a15b9f652722ef1c711884
bigcode/the-stack
train
3e83dddfe5e9a7425927c050
train
function
def test_can_find_highest_consecutive_list_sum_in_a_list(): result = highest_sum_list([1,2,3,4], 2) assert result == 7
def test_can_find_highest_consecutive_list_sum_in_a_list():
result = highest_sum_list([1,2,3,4], 2) assert result == 7
from sliding_window import highest_sum_list def test_can_find_highest_consecutive_list_sum_in_a_list():
22
64
39
14
7
mamaz/learn-stuffs-with-python
sliding_window/sliding_window_test.py
Python
test_can_find_highest_consecutive_list_sum_in_a_list
test_can_find_highest_consecutive_list_sum_in_a_list
3
5
3
3
0165cd10fa5b9802b189d63f2810ce3a79d05067
bigcode/the-stack
train
ab889d99789242588bf079a6
train
function
def test_shuld_return_0_if_lis_is_empty(): result = highest_sum_list([],5) assert result == 0
def test_shuld_return_0_if_lis_is_empty():
result = highest_sum_list([],5) assert result == 0
assert result == 7 def test_can_find_highest_consecutive_list_sum_in_a_list(): result = highest_sum_list([3,5,3,4,6,7,4], 4) assert result == 21 def test_shuld_return_0_if_lis_is_empty():
64
64
28
13
50
mamaz/learn-stuffs-with-python
sliding_window/sliding_window_test.py
Python
test_shuld_return_0_if_lis_is_empty
test_shuld_return_0_if_lis_is_empty
11
13
11
11
d06379faf8e44b8558851435b42bbd8da6938c25
bigcode/the-stack
train
4e841b2b4aede8b7487885f0
train
function
def lnlike_fg(p): m, b, _, M, lnV = p model = m * x + b return -0.5 * (((model - y) / yerr) ** 2 + 2 * np.log(yerr))
def lnlike_fg(p):
m, b, _, M, lnV = p model = m * x + b return -0.5 * (((model - y) / yerr) ** 2 + 2 * np.log(yerr))
# We'll just put reasonable uniform priors on all the parameters. if not all(b[0] < v < b[1] for v, b in zip(p, bounds)): return -np.inf return 0 # The "foreground" linear likelihood: def lnlike_fg(p):
64
64
56
6
58
fschmnn/pymuse
scripts/mcmc_outlier_pruning.py
Python
lnlike_fg
lnlike_fg
52
55
52
52
62a2da31099d9d852b4aa316d5917c5a56f2dd16
bigcode/the-stack
train
7121141e5e67442debdb82f2
train
function
def lnprob(p): m, b, Q, M, lnV = p # First check the prior. lp = lnprior(p) if not np.isfinite(lp): return -np.inf, None # Compute the vector of foreground likelihoods and include the q prior. ll_fg = lnlike_fg(p) arg1 = ll_fg + np.log(Q) # Compute the vector of ba...
def lnprob(p):
m, b, Q, M, lnV = p # First check the prior. lp = lnprior(p) if not np.isfinite(lp): return -np.inf, None # Compute the vector of foreground likelihoods and include the q prior. ll_fg = lnlike_fg(p) arg1 = ll_fg + np.log(Q) # Compute the vector of background likeli...
like_bg(p): _, _, Q, M, lnV = p var = np.exp(lnV) + yerr**2 return -0.5 * ((M - y) ** 2 / var + np.log(var)) # Full probabilistic model. def lnprob(p):
64
64
205
5
59
fschmnn/pymuse
scripts/mcmc_outlier_pruning.py
Python
lnprob
lnprob
64
86
64
64
9e8e7a9c6eeebe4138a7dfb14d22e9508efc5149
bigcode/the-stack
train
8a4226981003971ae407b256
train
function
def lnlike_bg(p): _, _, Q, M, lnV = p var = np.exp(lnV) + yerr**2 return -0.5 * ((M - y) ** 2 / var + np.log(var))
def lnlike_bg(p):
_, _, Q, M, lnV = p var = np.exp(lnV) + yerr**2 return -0.5 * ((M - y) ** 2 / var + np.log(var))
m, b, _, M, lnV = p model = m * x + b return -0.5 * (((model - y) / yerr) ** 2 + 2 * np.log(yerr)) # The "background" outlier likelihood: def lnlike_bg(p):
64
64
55
6
58
fschmnn/pymuse
scripts/mcmc_outlier_pruning.py
Python
lnlike_bg
lnlike_bg
58
61
58
58
8953edf08ad9ec7148fa0ed4879afd5e9b6a6531
bigcode/the-stack
train
5758eda709cb6a9f3c3b59ce
train
function
def lnprior(p): # We'll just put reasonable uniform priors on all the parameters. if not all(b[0] < v < b[1] for v, b in zip(p, bounds)): return -np.inf return 0
def lnprior(p): # We'll just put reasonable uniform priors on all the parameters.
if not all(b[0] < v < b[1] for v, b in zip(p, bounds)): return -np.inf return 0
0.1, 1.9), (-0.9, 0.9), (0, 1), (-2.4, 2.4), (-7.2, 5.2)] def lnprior(p): # We'll just put reasonable uniform priors on all the parameters.
64
64
55
19
45
fschmnn/pymuse
scripts/mcmc_outlier_pruning.py
Python
lnprior
lnprior
45
49
45
46
2481fc99a51848c65539c4d83d5480404d6990c0
bigcode/the-stack
train
ca45352fa8ac4abe6369ca6e
train
function
def test_promtail_service_started_enabled(host): promtail_service = host.service('promtail') assert promtail_service.is_running assert promtail_service.is_enabled
def test_promtail_service_started_enabled(host):
promtail_service = host.service('promtail') assert promtail_service.is_running assert promtail_service.is_enabled
import os import testinfra.utils.ansible_runner testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') def test_promtail_service_started_enabled(host):
54
64
36
9
45
sleighzy/random-project-templates
ansible/roles/molecule/default/tests/test_default.py
Python
test_promtail_service_started_enabled
test_promtail_service_started_enabled
9
12
9
9
221eea21f3414d1d5c31714edd5847b4e0047191
bigcode/the-stack
train
9dbe8ceed975030a2dc63916
train
class
@_doc_params(common_plot_args=doc_common_plot_args) class DotPlot(BasePlot): """\ Allows the visualization of two values that are encoded as dot size and color. The size usually represents the fraction of cells (obs) that have a non-zero value for genes (var). For each var_name and each `groupby` c...
@_doc_params(common_plot_args=doc_common_plot_args) class DotPlot(BasePlot):
"""\ Allows the visualization of two values that are encoded as dot size and color. The size usually represents the fraction of cells (obs) that have a non-zero value for genes (var). For each var_name and each `groupby` category a dot is plotted. Each dot represents two values: mean expression...
from typing import Optional, Union, Mapping # Special from typing import Sequence # ABCs from typing import Tuple # Classes import numpy as np import pandas as pd from anndata import AnnData from matplotlib.axes import Axes from matplotlib import pyplot as pl from matplotlib.colors import Normalize from .. import ...
198
256
7,220
19
178
PauBadiaM/scanpy
scanpy/plotting/_dotplot.py
Python
DotPlot
DotPlot
24
790
24
25
dd657d0436fcdc82d9422587f3eed2ea04a60cc4
bigcode/the-stack
train
21eba2e39167f23966250bf0
train
function
@_doc_params( show_save_ax=doc_show_save_ax, common_plot_args=doc_common_plot_args, groupby_plots_args=doc_common_groupby_plot_args, vminmax=doc_vboundnorm, ) def dotplot( adata: AnnData, var_names: Union[_VarNames, Mapping[str, _VarNames]], groupby: Union[str, Sequence[str]], use_raw: O...
@_doc_params( show_save_ax=doc_show_save_ax, common_plot_args=doc_common_plot_args, groupby_plots_args=doc_common_groupby_plot_args, vminmax=doc_vboundnorm, ) def dotplot( adata: AnnData, var_names: Union[_VarNames, Mapping[str, _VarNames]], groupby: Union[str, Sequence[str]], use_raw: O...
"""\ Makes a *dot plot* of the expression values of `var_names`. For each var_name and each `groupby` category a dot is plotted. Each dot represents two values: mean expression within each category (visualized by color) and fraction of cells expressing the `var_name` in the category (visualized...
@_doc_params( show_save_ax=doc_show_save_ax, common_plot_args=doc_common_plot_args, groupby_plots_args=doc_common_groupby_plot_args, vminmax=doc_vboundnorm, ) def dotplot( adata: AnnData, var_names: Union[_VarNames, Mapping[str, _VarNames]], groupby: Union[str, Sequence[str]], use_raw: O...
472
256
1,753
472
0
PauBadiaM/scanpy
scanpy/plotting/_dotplot.py
Python
dotplot
dotplot
793
988
793
834
c0a05788240a2b7ac6d000c0bdf31c390e08a9eb
bigcode/the-stack
train
5536e8178b7b9b01589340f4
train
function
def cocktailSort(a): n = len(a) swapped = True start = 0 end = n-1 while (swapped == True): swapped = False for i in range (start, end): if (a[i] > a[i + 1]) : a[i], a[i + 1]= a[i + 1], a[i] swapped = True if (swapped == False): break swapped = False end = end-1 for i in ...
def cocktailSort(a):
n = len(a) swapped = True start = 0 end = n-1 while (swapped == True): swapped = False for i in range (start, end): if (a[i] > a[i + 1]) : a[i], a[i + 1]= a[i + 1], a[i] swapped = True if (swapped == False): break swapped = False end = end-1 for i in range(end-1, start-1, ...
# Cocktail Sort def cocktailSort(a):
10
64
184
6
3
JainStuti25/Algorithms-1
Python/CocktailSort/cocktailSort.py
Python
cocktailSort
cocktailSort
3
25
3
3
0b766c6158b7cb822b0cf4f777022a8b73c33cd5
bigcode/the-stack
train
8d09d8827e756e14819347f9
train
class
class TarFile(object): """A class to generates a Docker layer.""" class DebError(Exception): pass PKG_NAME_RE = re.compile(r'Package:\s*(?P<pkg_name>\w+).*') DPKG_STATUS_DIR = '/var/lib/dpkg/status.d' PKG_METADATA_FILE = 'control' @staticmethod def parse_pkg_name(metadata, filename): pkg_name_m...
class TarFile(object):
"""A class to generates a Docker layer.""" class DebError(Exception): pass PKG_NAME_RE = re.compile(r'Package:\s*(?P<pkg_name>\w+).*') DPKG_STATUS_DIR = '/var/lib/dpkg/status.d' PKG_METADATA_FILE = 'control' @staticmethod def parse_pkg_name(metadata, filename): pkg_name_match = TarFile.PKG_NAME...
the layer') gflags.DEFINE_string( 'compression', None, 'Compression (`gz` or `bz2`), default is none.') gflags.DEFINE_multistring( 'modes', None, 'Specific mode to apply to specific file (from the file argument),' ' e.g., path/to/file=0o455.') gflags.DEFINE_multistring('owners', None, ...
256
256
2,238
5
250
wix-playground/rules_docker
container/build_tar.py
Python
TarFile
TarFile
97
355
97
97
1ecbddeabc4fbec2fe4b0c901ebcd6770fb7a9a2
bigcode/the-stack
train
7fd0781cec2dea78392cd6a0
train
function
def main(unused_argv): # Parse modes arguments default_mode = None if FLAGS.mode: # Convert from octal default_mode = int(FLAGS.mode, 8) mode_map = {} if FLAGS.modes: for filemode in FLAGS.modes: (f, mode) = filemode.split('=', 1) if f[0] == '/': f = f[1:] mode_map[f] = ...
def main(unused_argv): # Parse modes arguments
default_mode = None if FLAGS.mode: # Convert from octal default_mode = int(FLAGS.mode, 8) mode_map = {} if FLAGS.modes: for filemode in FLAGS.modes: (f, mode) = filemode.split('=', 1) if f[0] == '/': f = f[1:] mode_map[f] = int(mode, 8) default_ownername = ('', '') if...
+ ' does not contains a control file!') @staticmethod def _xzcat_decompress(data): """Decompresses the xz-encrypted bytes in data by piping to xz.""" if subprocess.call('which xz', shell=True, stdout=subprocess.PIPE): raise RuntimeError('Cannot handle .xz compression: xz not found.') xz_proc = ...
227
227
758
13
214
wix-playground/rules_docker
container/build_tar.py
Python
main
main
358
440
358
359
cfbc6e3514d8eb382065ab7318564487925d6c59
bigcode/the-stack
train
39ac77b657d6a3d2269f9ddf
train
function
def freeze_as_mpy(path, script=None, opt=0): """Freeze the input (see above) by first compiling the .py scripts to .mpy files, then freezing the resulting .mpy files. """ freeze_internal(KIND_AS_MPY, path, script, opt)
def freeze_as_mpy(path, script=None, opt=0):
"""Freeze the input (see above) by first compiling the .py scripts to .mpy files, then freezing the resulting .mpy files. """ freeze_internal(KIND_AS_MPY, path, script, opt)
def freeze_as_str(path): """Freeze the given `path` and all .py scripts within it as a string, which will be compiled upon import. """ freeze_internal(KIND_AS_STR, path, None, 0) def freeze_as_mpy(path, script=None, opt=0):
64
64
64
14
50
ljk53/micropython
tools/makemanifest.py
Python
freeze_as_mpy
freeze_as_mpy
99
104
99
99
4e427302c5f370498537be20d788d8b6afb3c9a0
bigcode/the-stack
train
cc871602fca731e516d09043
train
function
def mkdir(filename): path = os.path.dirname(filename) if not os.path.isdir(path): os.makedirs(path)
def mkdir(filename):
path = os.path.dirname(filename) if not os.path.isdir(path): os.makedirs(path)
(path): ts_newest = 0 for dirpath, dirnames, filenames in os.walk(path, followlinks=True): for f in filenames: ts_newest = max(ts_newest, get_timestamp(os.path.join(dirpath, f))) return ts_newest def mkdir(filename):
64
64
25
4
59
ljk53/micropython
tools/makemanifest.py
Python
mkdir
mkdir
167
170
167
167
5b9761d6d244c388dfc6830d6fc0d212c1459c66
bigcode/the-stack
train
52804faf06b3dc73179a7a99
train
function
def system(cmd): try: output = subprocess.check_output(cmd, stderr=subprocess.STDOUT) return 0, output except subprocess.CalledProcessError as er: return -1, er.output
def system(cmd):
try: output = subprocess.check_output(cmd, stderr=subprocess.STDOUT) return 0, output except subprocess.CalledProcessError as er: return -1, er.output
, script, opt) ########################################################################### # Internal implementation KIND_AUTO = 0 KIND_AS_STR = 1 KIND_AS_MPY = 2 KIND_MPY = 3 VARS = {} manifest_list = [] class FreezeError(Exception): pass def system(cmd):
64
64
46
4
59
ljk53/micropython
tools/makemanifest.py
Python
system
system
132
137
132
132
228f638972ac6196975e609d60b26da0f8ef82b1
bigcode/the-stack
train
e5ccf5d24b2fbeace5d5b3bc
train
function
def convert_path(path): # Perform variable substituion. for name, value in VARS.items(): path = path.replace("$({})".format(name), value) # Convert to absolute path (so that future operations don't rely on # still being chdir'ed). return os.path.abspath(path)
def convert_path(path): # Perform variable substituion.
for name, value in VARS.items(): path = path.replace("$({})".format(name), value) # Convert to absolute path (so that future operations don't rely on # still being chdir'ed). return os.path.abspath(path)
(Exception): pass def system(cmd): try: output = subprocess.check_output(cmd, stderr=subprocess.STDOUT) return 0, output except subprocess.CalledProcessError as er: return -1, er.output def convert_path(path): # Perform variable substituion.
64
64
67
13
50
ljk53/micropython
tools/makemanifest.py
Python
convert_path
convert_path
140
146
140
141
66c4487aacebe56038232dfe8aad2bf1a23cd666
bigcode/the-stack
train
c15eaca2b733ae5cefff9c86
train
class
class FreezeError(Exception): pass
class FreezeError(Exception):
pass
_internal(KIND_MPY, path, script, opt) ########################################################################### # Internal implementation KIND_AUTO = 0 KIND_AS_STR = 1 KIND_AS_MPY = 2 KIND_MPY = 3 VARS = {} manifest_list = [] class FreezeError(Exception):
63
64
8
5
58
ljk53/micropython
tools/makemanifest.py
Python
FreezeError
FreezeError
128
129
128
128
f4e4d41d8276c3272f4e0009740f8a89e0635032
bigcode/the-stack
train
def95016bcf1bacdaa324dfe
train
function
def include(manifest): """Include another manifest. The manifest argument can be a string (filename) or an iterable of strings. Relative paths are resolved with respect to the current manifest file. """ if not isinstance(manifest, str): for m in manifest: include(m) el...
def include(manifest):
"""Include another manifest. The manifest argument can be a string (filename) or an iterable of strings. Relative paths are resolved with respect to the current manifest file. """ if not isinstance(manifest, str): for m in manifest: include(m) else: manifest = ...
CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. from __future__ import print_function import sys import os import subprocess ########################################################################### # Public functions to be use...
64
64
135
5
58
ljk53/micropython
tools/makemanifest.py
Python
include
include
37
57
37
37
50cba4ddc34f4a2f3f43061342853e25da6a22a0
bigcode/the-stack
train
5cca3eb366380228f46f5166
train
function
def freeze_internal(kind, path, script, opt): path = convert_path(path) if not os.path.isdir(path): raise FreezeError("freeze path must be a directory") if script is None and kind == KIND_AS_STR: if any(f[0] == KIND_AS_STR for f in manifest_list): raise FreezeError("can only free...
def freeze_internal(kind, path, script, opt):
path = convert_path(path) if not os.path.isdir(path): raise FreezeError("freeze path must be a directory") if script is None and kind == KIND_AS_STR: if any(f[0] == KIND_AS_STR for f in manifest_list): raise FreezeError("can only freeze one str directory") manifest_list.a...
is None: raise FreezeError("cannot stat {}".format(path)) return default def get_timestamp_newest(path): ts_newest = 0 for dirpath, dirnames, filenames in os.walk(path, followlinks=True): for f in filenames: ts_newest = max(ts_newest, get_timestamp(os.path.join(dirpath...
119
119
397
11
108
ljk53/micropython
tools/makemanifest.py
Python
freeze_internal
freeze_internal
173
209
173
173
8fe2e3f9ceee3beb08ae54d1ac45ff7474b2f309
bigcode/the-stack
train
bbccba9a0d982e34d78b7f54
train
function
def freeze(path, script=None, opt=0): """Freeze the input, automatically determining its type. A .py script will be compiled to a .mpy first then frozen, and a .mpy file will be frozen directly. `path` must be a directory, which is the base directory to search for files from. When importing the r...
def freeze(path, script=None, opt=0):
"""Freeze the input, automatically determining its type. A .py script will be compiled to a .mpy first then frozen, and a .mpy file will be frozen directly. `path` must be a directory, which is the base directory to search for files from. When importing the resulting frozen modules, the name of ...
, str): for m in manifest: include(m) else: manifest = convert_path(manifest) with open(manifest) as f: # Make paths relative to this manifest file while processing it. # Applies to includes and input files. prev_cwd = os.getcwd() o...
95
95
317
11
84
ljk53/micropython
tools/makemanifest.py
Python
freeze
freeze
60
88
60
60
6d2526b28fdbd160e39128ae297fb21532e2d141
bigcode/the-stack
train
eea9250a735bc40b10149de5
train
function
def get_timestamp_newest(path): ts_newest = 0 for dirpath, dirnames, filenames in os.walk(path, followlinks=True): for f in filenames: ts_newest = max(ts_newest, get_timestamp(os.path.join(dirpath, f))) return ts_newest
def get_timestamp_newest(path):
ts_newest = 0 for dirpath, dirnames, filenames in os.walk(path, followlinks=True): for f in filenames: ts_newest = max(ts_newest, get_timestamp(os.path.join(dirpath, f))) return ts_newest
return os.path.abspath(path) def get_timestamp(path, default=None): try: stat = os.stat(path) return stat.st_mtime except OSError: if default is None: raise FreezeError("cannot stat {}".format(path)) return default def get_timestamp_newest(path):
64
64
65
7
56
ljk53/micropython
tools/makemanifest.py
Python
get_timestamp_newest
get_timestamp_newest
159
164
159
159
f94c18924f128b7c4ede4421c8c99ebb162ea76e
bigcode/the-stack
train
f8c2d19c9c1c5c489faddb89
train
function
def main(): # Parse arguments import argparse cmd_parser = argparse.ArgumentParser( description="A tool to generate frozen content in MicroPython firmware images." ) cmd_parser.add_argument("-o", "--output", help="output path") cmd_parser.add_argument("-b", "--build-dir", help="output p...
def main(): # Parse arguments
import argparse cmd_parser = argparse.ArgumentParser( description="A tool to generate frozen content in MicroPython firmware images." ) cmd_parser.add_argument("-o", "--output", help="output path") cmd_parser.add_argument("-b", "--build-dir", help="output path") cmd_parser.add_argument(...
subdir = "" else: subdir = "/" + script for dirpath, dirnames, filenames in os.walk(path + subdir, followlinks=True): for f in filenames: freeze_internal(kind, path, (dirpath + "/" + f)[len(path) + 1 :], opt) elif not isinstance(script, str): # `scrip...
256
256
1,212
8
248
ljk53/micropython
tools/makemanifest.py
Python
main
main
212
342
212
213
cbe2bcf204acc70003d27625017cc8eae64d7433
bigcode/the-stack
train
05c9cd6c3daeecb28c7659cb
train
function
def get_timestamp(path, default=None): try: stat = os.stat(path) return stat.st_mtime except OSError: if default is None: raise FreezeError("cannot stat {}".format(path)) return default
def get_timestamp(path, default=None):
try: stat = os.stat(path) return stat.st_mtime except OSError: if default is None: raise FreezeError("cannot stat {}".format(path)) return default
ion. for name, value in VARS.items(): path = path.replace("$({})".format(name), value) # Convert to absolute path (so that future operations don't rely on # still being chdir'ed). return os.path.abspath(path) def get_timestamp(path, default=None):
64
64
51
8
56
ljk53/micropython
tools/makemanifest.py
Python
get_timestamp
get_timestamp
149
156
149
149
c81c1961a1eb22a45a0849c14e516b1300231170
bigcode/the-stack
train
e8eddfc1108364cbf1b43211
train
function
def freeze_as_str(path): """Freeze the given `path` and all .py scripts within it as a string, which will be compiled upon import. """ freeze_internal(KIND_AS_STR, path, None, 0)
def freeze_as_str(path):
"""Freeze the given `path` and all .py scripts within it as a string, which will be compiled upon import. """ freeze_internal(KIND_AS_STR, path, None, 0)
`script` is a directory then all files in that directory will be frozen. `opt` is the optimisation level to pass to mpy-cross when compiling .py to .mpy. """ freeze_internal(KIND_AUTO, path, script, opt) def freeze_as_str(path):
64
64
50
6
58
ljk53/micropython
tools/makemanifest.py
Python
freeze_as_str
freeze_as_str
91
96
91
91
00923f9b0ca2641a3cc5a8e037c71dc2696e6b42
bigcode/the-stack
train
d5f64fbc161a2c86daf742da
train
function
def freeze_mpy(path, script=None, opt=0): """Freeze the input (see above), which must be .mpy files that are frozen directly. """ freeze_internal(KIND_MPY, path, script, opt)
def freeze_mpy(path, script=None, opt=0):
"""Freeze the input (see above), which must be .mpy files that are frozen directly. """ freeze_internal(KIND_MPY, path, script, opt)
): """Freeze the input (see above) by first compiling the .py scripts to .mpy files, then freezing the resulting .mpy files. """ freeze_internal(KIND_AS_MPY, path, script, opt) def freeze_mpy(path, script=None, opt=0):
64
64
52
13
51
ljk53/micropython
tools/makemanifest.py
Python
freeze_mpy
freeze_mpy
107
112
107
107
050839acc43f85680cb8a22ae590b0f93aaac109
bigcode/the-stack
train
4e9f4648a5c09fd961f5d7c6
train
class
class WeightDrop(torch.nn.Module): def __init__(self, module, weights, dropout=0, variational=False): super(WeightDrop, self).__init__() self.module = module self.weights = weights self.dropout = dropout self.variational = variational self._setup() def widget_dem...
class WeightDrop(torch.nn.Module):
def __init__(self, module, weights, dropout=0, variational=False): super(WeightDrop, self).__init__() self.module = module self.weights = weights self.dropout = dropout self.variational = variational self._setup() def widget_demagnetizer_y2k_edition(*args, **kwar...
import torch from torch.nn import Parameter from functools import wraps class WeightDrop(torch.nn.Module):
21
130
434
7
13
Joyce-yanqiongzhang/proj2_storytelling
storytelling/weight_drop.py
Python
WeightDrop
WeightDrop
5
47
5
5
65e6c0bc571871212d4be84f3e616baa5db81c15
bigcode/the-stack
train
0bcaf463492e0e318d7ccd82
train
class
class _ResourceClassGenerator: """Create an attr.s class definition @attr.s(auto_attribs=True, init=False, repr=False) class Attribute: name: str value: typing.Any def __init__(self, name: str = None, value: typing.Any = None): super().__init__(n...
class _ResourceClassGenerator:
"""Create an attr.s class definition @attr.s(auto_attribs=True, init=False, repr=False) class Attribute: name: str value: typing.Any def __init__(self, name: str = None, value: typing.Any = None): super().__init__(name, value) """ resou...
not in self._typing_imports[source][module]: self._typing_imports[source][module].append(cls) def import_resource(self, source, module, cls): self.add_import_statement(source, f"commercetools.types.{module}", cls) def get_typing_imports(self, source): nodes = [] imported_...
255
256
2,161
6
249
jeroenubbink/commercetools-python-sdk
codegen/generate_types.py
Python
_ResourceClassGenerator
_ResourceClassGenerator
286
606
286
286
a076279938498102bb7747686fe1e379f7031fda
bigcode/the-stack
train
ef15a998b3b5a47aca964b66
train
class
class TypesModuleGenerator(AbstractModuleGenerator): def __init__(self): self._type_nodes: typing.Dict[str, typing.List[ast.AST]] = defaultdict(list) self._typing_imports: typing.Dict[ str, typing.Dict[str, typing.List[str]] ] = defaultdict(lambda: defaultdict(list)) supe...
class TypesModuleGenerator(AbstractModuleGenerator):
def __init__(self): self._type_nodes: typing.Dict[str, typing.List[ast.AST]] = defaultdict(list) self._typing_imports: typing.Dict[ str, typing.Dict[str, typing.List[str]] ] = defaultdict(lambda: defaultdict(list)) super().__init__() def get_module_nodes(self): ...
import ast import operator import textwrap import typing from collections import defaultdict import astunparse from codegen import raml_types from codegen.generate_abstract import AbstractModuleGenerator from codegen.utils import enum_attr, merge_imports, reorder_class_definitions BUILTIN_TYPES = { "string": ast...
199
256
1,695
8
191
jeroenubbink/commercetools-python-sdk
codegen/generate_types.py
Python
TypesModuleGenerator
TypesModuleGenerator
27
283
27
27
6ba8d54b2cfdd5f2c62f9963f2f5d8a8ad08db24
bigcode/the-stack
train
73eb1c072d9668dd4a790b19
train
class
@BUFFER_REGISTRY.register('naive') class NaiveReplayBuffer(IBuffer): r""" Overview: Naive replay buffer, can store and sample data. An naive implementation of replay buffer with no priority or any other advanced features. This buffer refers to multi-thread/multi-process and guarantees th...
@BUFFER_REGISTRY.register('naive') class NaiveReplayBuffer(IBuffer):
r""" Overview: Naive replay buffer, can store and sample data. An naive implementation of replay buffer with no priority or any other advanced features. This buffer refers to multi-thread/multi-process and guarantees thread-safe, which means that methods like ``sample``, ``push``...
import copy from typing import Union, Any, Optional, List import numpy as np from easydict import EasyDict from ding.worker.replay_buffer import IBuffer from ding.utils import LockContext, LockContextType, BUFFER_REGISTRY, build_logger from .utils import UsedDataRemover, PeriodicThruputMonitor @BUFFER_REGISTRY.registe...
89
256
3,187
18
70
lichuminglcm/DI-engine
ding/worker/replay_buffer/naive_buffer.py
Python
NaiveReplayBuffer
NaiveReplayBuffer
11
355
11
12
6920b86bd03546020daebe078d75d8fd3fe9232b
bigcode/the-stack
train
fb8e5f13f358c433f5c5e4d9
train
class
@BUFFER_REGISTRY.register('elastic') class ElasticReplayBuffer(NaiveReplayBuffer): r""" Overview: Naive replay buffer, can store and sample data. An naive implementation of replay buffer with no priority or any other advanced features. This buffer refers to multi-thread/multi-process and...
@BUFFER_REGISTRY.register('elastic') class ElasticReplayBuffer(NaiveReplayBuffer):
r""" Overview: Naive replay buffer, can store and sample data. An naive implementation of replay buffer with no priority or any other advanced features. This buffer refers to multi-thread/multi-process and guarantees thread-safe, which means that methods like ``sample``, ``push``...
the buffer. """ return { 'data': self._data, 'tail': self._tail, 'valid_count': self._valid_count, 'push_count': self._push_count, } def load_state_dict(self, _state_dict: dict) -> None: """ Overview: Load state di...
224
224
749
18
205
lichuminglcm/DI-engine
ding/worker/replay_buffer/naive_buffer.py
Python
ElasticReplayBuffer
ElasticReplayBuffer
357
434
357
358
ca55b4a22e0b341d74034ec24ba16e9c297fb42c
bigcode/the-stack
train
e5db5ad37e281654f67cd0c8
train
function
def test_quickstart(capsys, patch_instance, example_database): quickstart.run_quickstart() out, _ = capsys.readouterr() assert '[1]' in out
def test_quickstart(capsys, patch_instance, example_database):
quickstart.run_quickstart() out, _ = capsys.readouterr() assert '[1]' in out
def example_database(): spanner_client = spanner.Client() instance = spanner_client.instance(SPANNER_INSTANCE) database = instance.database('my-database-id') if not database.exists(): database.create() yield def test_quickstart(capsys, patch_instance, example_database):
64
64
42
15
48
yshalabi/python-docs-samples
spanner/cloud-client/quickstart_test.py
Python
test_quickstart
test_quickstart
54
57
54
54
ffb288cff399e0fa204f593434b7b366d1d36545
bigcode/the-stack
train
1716494b8c239c12e91bc6bb
train
function
@pytest.fixture def example_database(): spanner_client = spanner.Client() instance = spanner_client.instance(SPANNER_INSTANCE) database = instance.database('my-database-id') if not database.exists(): database.create() yield
@pytest.fixture def example_database():
spanner_client = spanner.Client() instance = spanner_client.instance(SPANNER_INSTANCE) database = instance.database('my-database-id') if not database.exists(): database.create() yield
.instance def new_instance(self, unused_instance_name): return original_instance(self, SPANNER_INSTANCE) instance_patch = mock.patch( 'google.cloud.spanner.Client.instance', side_effect=new_instance, autospec=True) with instance_patch: yield @pytest.fixture def exa...
64
64
52
7
56
yshalabi/python-docs-samples
spanner/cloud-client/quickstart_test.py
Python
example_database
example_database
42
51
42
43
a1f581b96ae732c0424008ff9bed4ad893d8e135
bigcode/the-stack
train
ea0b70705564da154ba5428d
train
function
@pytest.fixture def patch_instance(): original_instance = spanner.Client.instance def new_instance(self, unused_instance_name): return original_instance(self, SPANNER_INSTANCE) instance_patch = mock.patch( 'google.cloud.spanner.Client.instance', side_effect=new_instance, au...
@pytest.fixture def patch_instance():
original_instance = spanner.Client.instance def new_instance(self, unused_instance_name): return original_instance(self, SPANNER_INSTANCE) instance_patch = mock.patch( 'google.cloud.spanner.Client.instance', side_effect=new_instance, autospec=True) with instance_patch:...
ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import os from google.cloud import spanner import mock import pytest import quickstart SPANNER_INSTANCE = os.environ['SPANNER_INSTANCE'] @pytest.fixture def patch_instance():
64
64
71
7
57
yshalabi/python-docs-samples
spanner/cloud-client/quickstart_test.py
Python
patch_instance
patch_instance
26
39
26
27
4e4309bf60832a0a1e598a3c706ae3bc16ed757f
bigcode/the-stack
train
fbe2bebb82ce2ced52a0bb3a
train
function
def createSettings(org='Amazon_Lumberyard', app='DCCsi', tool='azpy', type='default'): """Sets up a settings .ini Returns a QSettings instance""" settings_folder = '{org}//{app}'.format(org=org, app=app) settings_name = '{tool}-{type}'.format(tool=tool, type=type) settings = Qt...
def createSettings(org='Amazon_Lumberyard', app='DCCsi', tool='azpy', type='default'):
"""Sets up a settings .ini Returns a QSettings instance""" settings_folder = '{org}//{app}'.format(org=org, app=app) settings_name = '{tool}-{type}'.format(tool=tool, type=type) settings = QtCore.QSettings(QtCore.QSettings.IniFormat, QtCore.QSettings.UserScope, ...
_TAG _LOGGER = _logging.getLogger(_MODULENAME) _LOGGER.debug('Something invoked :: {0}.'.format(_MODULENAME)) # ------------------------------------------------------------------------- # ------------------------------------------------------------------------- def createSettings(org='Amazon_Lumberyard', app='DCCsi',...
64
64
113
26
38
cypherdotXd/o3de
Gems/AtomLyIntegration/TechnicalArt/DccScriptingInterface/azpy/shared/ui/qt_settings.py
Python
createSettings
createSettings
54
67
54
55
d37152f263cb4d798e41f2600c43e908525bc43f
bigcode/the-stack
train
e7a2d639bdf1d3d010859768
train
function
def eliminar_un_caracter(lista,elemento): auxilar=[] for i in lista: a=i.replace(elemento,"") auxilar.append(a) return auxilar
def eliminar_un_caracter(lista,elemento):
auxilar=[] for i in lista: a=i.replace(elemento,"") auxilar.append(a) return auxilar
for i in frutas: lista_frutas.append(i) for i in numeros: lista_numeros.append(i) #Retornar una lista con los numero negativos """ Entradas: lista-list-->lista Salidas lista-list-->lista """ def eliminar_un_caracter(lista,elemento):
64
64
39
10
54
DiegoC386/Taller-de-Funciones
Ejercicio_9.py
Python
eliminar_un_caracter
eliminar_un_caracter
16
21
16
16
627be829600209e66a432ce60202de5ba39f930a
bigcode/the-stack
train
2abd21cdf0bde037493259d3
train
function
def numeros_negativos(lista): aux=[] for i in lista: if(float(i)<=0): aux.append(i) return aux
def numeros_negativos(lista):
aux=[] for i in lista: if(float(i)<=0): aux.append(i) return aux
""" Entradas: lista-list-->lista Salidas lista-list-->lista """ def eliminar_un_caracter(lista,elemento): auxilar=[] for i in lista: a=i.replace(elemento,"") auxilar.append(a) return auxilar def numeros_negativos(lista):
64
64
31
6
57
DiegoC386/Taller-de-Funciones
Ejercicio_9.py
Python
numeros_negativos
numeros_negativos
22
27
22
22
702b759305768402732bfbbd8d7d99a9d74ce17c
bigcode/the-stack
train
68a9d70422b133dbdd89fe67
train
class
class IPForm(FlaskForm): address = StringField( \ label = 'IP Address', \ validators=[DataRequired(message=""), IPAddress(message=lazy_gettext("Please Input Correct IP Address."))], \ render_kw={ "placeholder": "IP Address. eg. 192.168.0.100" ...
class IPForm(FlaskForm):
address = StringField( \ label = 'IP Address', \ validators=[DataRequired(message=""), IPAddress(message=lazy_gettext("Please Input Correct IP Address."))], \ render_kw={ "placeholder": "IP Address. eg. 192.168.0.100" } ) netmask = StringFi...
usr/bin/env python # -*- coding: utf-8 -*- from flask_babel import lazy_gettext from flask_wtf import FlaskForm from wtforms import StringField, BooleanField, SubmitField, IntegerField, validators, RadioField from wtforms.validators import DataRequired, IPAddress, Length, ValidationError from wtforms.fields imp...
83
83
279
8
74
fabiozehnder/meta-myir-st
recipes-app/measy-iot/files/usr/share/measy_iot/app/forms.py
Python
IPForm
IPForm
10
36
10
11
47836faa0f538d3175899f57dc32658f8db22ca5
bigcode/the-stack
train
5b6439a0e5f5a7cd8fc8c722
train
class
class ScheduleDeleteStaffOnlyTests(NailsProjectTestCase, UserTestUtils, ScheduleTestUtils): def test_schedule_delete_withNoSchedule(self): nails_user = self.create_user(email='nails@user.com', password='12345qwe', is_active=True, is_staff=True) self.client.force_login(nails_user) response =...
class ScheduleDeleteStaffOnlyTests(NailsProjectTestCase, UserTestUtils, ScheduleTestUtils):
def test_schedule_delete_withNoSchedule(self): nails_user = self.create_user(email='nails@user.com', password='12345qwe', is_active=True, is_staff=True) self.client.force_login(nails_user) response = self.client.get(reverse('delete schedule', kwargs={'pk': 1})) self.assertEqual(404, ...
from nails_project.schedule.models import Schedule from tests.base.mixins import UserTestUtils, ScheduleTestUtils from tests.base.tests import NailsProjectTestCase from django.urls import reverse class ScheduleDeleteStaffOnlyTests(NailsProjectTestCase, UserTestUtils, ScheduleTestUtils):
58
124
415
20
37
borislavstoychev/nails_project
tests/schedule/views/test_schedule_delete_staff_only_view.py
Python
ScheduleDeleteStaffOnlyTests
ScheduleDeleteStaffOnlyTests
7
44
7
8
5c4bb337cbcd249d1f9093174e302555c1abf9f4
bigcode/the-stack
train
864f609d343fc5fa41b6d16a
train
function
def configuration(parent_package='', top_path=None): from numpy.distutils.misc_util import Configuration global tdir incdirs,libdirs,libs = get_gsl_info() tdir = None # if we need a temporary dir, this will be it if incdirs is None: print("I couldn't run the GNU Scientific Library (GSL) gsl-co...
def configuration(parent_package='', top_path=None):
from numpy.distutils.misc_util import Configuration global tdir incdirs,libdirs,libs = get_gsl_info() tdir = None # if we need a temporary dir, this will be it if incdirs is None: print("I couldn't run the GNU Scientific Library (GSL) gsl-config script.") print("Would you like me to down...
.listdir()[0]) tar.close() u.close() stat = os.system('./configure --prefix=%s --disable-shared' % tdir) if stat != 0: return 0 stat = os.system('make') if stat != 0: return 0 stat = os.system('make install') if stat != 0: return 0 return(os.path.join(tdir,'include'), os.pa...
112
113
378
9
103
emirkmo/snpy
snpy/CSPtemp/setup_old.py
Python
configuration
configuration
55
92
55
55
9a486a724986695e4e2edff2ab62c04428312024
bigcode/the-stack
train
11c663beb223caeceb5a1625
train
function
def get_temp_GSL(): import urllib.request, urllib.parse, urllib.error, tarfile, io,tempfile global tdir u = urllib.request.urlopen('ftp://ftp.gnu.org/gnu/gsl/gsl-1.8.tar.gz') f = io.StringIO(u.read()) tar = tarfile.open(fileobj=f) tdir = tempfile.mkdtemp() cwd = os.pwd() os.chdir(tdir) tar.ex...
def get_temp_GSL():
import urllib.request, urllib.parse, urllib.error, tarfile, io,tempfile global tdir u = urllib.request.urlopen('ftp://ftp.gnu.org/gnu/gsl/gsl-1.8.tar.gz') f = io.StringIO(u.read()) tar = tarfile.open(fileobj=f) tdir = tempfile.mkdtemp() cwd = os.pwd() os.chdir(tdir) tar.extractall() os.chd...
cflags = p.readline(); p.close() cflags = cflags.split() for item in cflags: if item[0:2] == '-I': inc_dirs.append(item[2:]) return(inc_dirs, lib_dirs, libraries) def get_temp_GSL():
64
64
207
6
58
emirkmo/snpy
snpy/CSPtemp/setup_old.py
Python
get_temp_GSL
get_temp_GSL
29
52
29
29
447851445c7f7bcae85b654039895a0b1915cece
bigcode/the-stack
train
6f456705fbaf2f0cf883f6ae
train
function
def get_gsl_info(path=''): '''Look in the standard places for the GSL library.''' inc_dirs = [] lib_dirs = [] libraries = [] p = os.popen('%s --libs' % (os.path.join(path, 'gsl-config'))) libs = p.readline(); p.close() if libs == '': print("Warning. Could not run gsl-config!") return ...
def get_gsl_info(path=''):
'''Look in the standard places for the GSL library.''' inc_dirs = [] lib_dirs = [] libraries = [] p = os.popen('%s --libs' % (os.path.join(path, 'gsl-config'))) libs = p.readline(); p.close() if libs == '': print("Warning. Could not run gsl-config!") return None,None,None libs = li...
from __future__ import print_function import sys import os from glob import glob def get_gsl_info(path=''):
27
67
225
8
18
emirkmo/snpy
snpy/CSPtemp/setup_old.py
Python
get_gsl_info
get_gsl_info
6
27
6
6
ba70f6eb122cbd1a69a6af485e0532854213856e
bigcode/the-stack
train
64d277096ec290b26a568cb4
train
class
@intrinsic class Ocl_get_global_size(ConcreteTemplate): key = dppl.get_global_size cases = [signature(types.intp, types.uint32)]
@intrinsic class Ocl_get_global_size(ConcreteTemplate):
key = dppl.get_global_size cases = [signature(types.intp, types.uint32)]
_num_groups cases = [signature(types.intp, types.uint32)] @intrinsic class Ocl_get_work_dim(ConcreteTemplate): key = dppl.get_work_dim cases = [signature(types.uint32)] @intrinsic class Ocl_get_global_size(ConcreteTemplate):
63
64
36
14
49
DrTodd13/numba
numba/dppl/ocl/ocldecl.py
Python
Ocl_get_global_size
Ocl_get_global_size
46
49
46
47
60bbb30b2801ee6d8f54c44d7d146d00fda5aa6b
bigcode/the-stack
train
8fd7b7b8f37334cd64e16074
train
class
@intrinsic class Ocl_sub_group_barrier(ConcreteTemplate): key = dppl.sub_group_barrier cases = [signature(types.void)]
@intrinsic class Ocl_sub_group_barrier(ConcreteTemplate):
key = dppl.sub_group_barrier cases = [signature(types.void)]
, types.uint32), signature(types.void)] @intrinsic class Ocl_mem_fence(ConcreteTemplate): key = dppl.mem_fence cases = [signature(types.void, types.uint32)] @intrinsic class Ocl_sub_group_barrier(ConcreteTemplate):
63
64
34
15
48
DrTodd13/numba
numba/dppl/ocl/ocldecl.py
Python
Ocl_sub_group_barrier
Ocl_sub_group_barrier
71
75
71
72
8e49e384e0e14d37d4d608964be96aa6f774fa95
bigcode/the-stack
train
285b0bb7475b2eb788254301
train
class
@intrinsic class Ocl_get_global_id(ConcreteTemplate): key = dppl.get_global_id cases = [signature(types.intp, types.uint32)]
@intrinsic class Ocl_get_global_id(ConcreteTemplate):
key = dppl.get_global_id cases = [signature(types.intp, types.uint32)]
Template, signature, Registry) from numba import dppl registry = Registry() intrinsic = registry.register intrinsic_attr = registry.register_attr #intrinsic_global = registry.register_global #register_number_classes(intrinsic_global) @intrinsic class Ocl_get_global_id(ConcreteT...
64
64
36
14
50
DrTodd13/numba
numba/dppl/ocl/ocldecl.py
Python
Ocl_get_global_id
Ocl_get_global_id
16
19
16
17
af4a07c4571214d88c81aafc21702ac046ff9df1
bigcode/the-stack
train
b69be6f2f8f20727bf1b2d65
train
class
@intrinsic class Ocl_get_group_id(ConcreteTemplate): key = dppl.get_group_id cases = [signature(types.intp, types.uint32)]
@intrinsic class Ocl_get_group_id(ConcreteTemplate):
key = dppl.get_group_id cases = [signature(types.intp, types.uint32)]
cases = [signature(types.intp, types.uint32)] @intrinsic class Ocl_get_local_id(ConcreteTemplate): key = dppl.get_local_id cases = [signature(types.intp, types.uint32)] @intrinsic class Ocl_get_group_id(ConcreteTemplate):
63
64
36
14
49
DrTodd13/numba
numba/dppl/ocl/ocldecl.py
Python
Ocl_get_group_id
Ocl_get_group_id
28
31
28
29
76f9e7e5eaeb5c04925148e45ff198c5ea679eca
bigcode/the-stack
train
4952e8f9443b66b660f2e56d
train
class
@intrinsic class Ocl_get_num_groups(ConcreteTemplate): key = dppl.get_num_groups cases = [signature(types.intp, types.uint32)]
@intrinsic class Ocl_get_num_groups(ConcreteTemplate):
key = dppl.get_num_groups cases = [signature(types.intp, types.uint32)]
cases = [signature(types.intp, types.uint32)] @intrinsic class Ocl_get_group_id(ConcreteTemplate): key = dppl.get_group_id cases = [signature(types.intp, types.uint32)] @intrinsic class Ocl_get_num_groups(ConcreteTemplate):
63
64
36
14
49
DrTodd13/numba
numba/dppl/ocl/ocldecl.py
Python
Ocl_get_num_groups
Ocl_get_num_groups
34
37
34
35
3882dbb83b7d2edebf2e64387545756b8aef9792
bigcode/the-stack
train
c4abb89ffaec97e13df9cbb3
train
class
@intrinsic class Ocl_mem_fence(ConcreteTemplate): key = dppl.mem_fence cases = [signature(types.void, types.uint32)]
@intrinsic class Ocl_mem_fence(ConcreteTemplate):
key = dppl.mem_fence cases = [signature(types.void, types.uint32)]
(types.intp, types.uint32)] @intrinsic class Ocl_barrier(ConcreteTemplate): key = dppl.barrier cases = [signature(types.void, types.uint32), signature(types.void)] @intrinsic class Ocl_mem_fence(ConcreteTemplate):
63
64
36
14
49
DrTodd13/numba
numba/dppl/ocl/ocldecl.py
Python
Ocl_mem_fence
Ocl_mem_fence
65
68
65
66
3b6916d34fd717b5789b045937b9830a07ebb166
bigcode/the-stack
train
8d1b4fd1b9f38349eaf5caa2
train
class
class Ocl_local_alloc(MacroTemplate): key = dppl.local.static_alloc
class Ocl_local_alloc(MacroTemplate):
key = dppl.local.static_alloc
Template(AttributeTemplate): key = types.Module(dppl.atomic) def resolve_add(self, mod): return types.Function(Ocl_atomic_add) def resolve_sub(self, mod): return types.Function(Ocl_atomic_sub) # dppl.local submodule ------------------------------------------------------- class Ocl_local_...
64
64
18
9
55
DrTodd13/numba
numba/dppl/ocl/ocldecl.py
Python
Ocl_local_alloc
Ocl_local_alloc
120
121
120
120
2081cb6786f602515ee83322181245649991012f
bigcode/the-stack
train
c9b07768dd8d4efc92978ea3
train
class
@intrinsic_attr class OclAtomicTemplate(AttributeTemplate): key = types.Module(dppl.atomic) def resolve_add(self, mod): return types.Function(Ocl_atomic_add) def resolve_sub(self, mod): return types.Function(Ocl_atomic_sub)
@intrinsic_attr class OclAtomicTemplate(AttributeTemplate):
key = types.Module(dppl.atomic) def resolve_add(self, mod): return types.Function(Ocl_atomic_add) def resolve_sub(self, mod): return types.Function(Ocl_atomic_sub)
= args if ary.ndim == 1: return signature(ary.dtype, ary, types.intp, ary.dtype) elif ary.ndim > 1: return signature(ary.dtype, ary, idx, ary.dtype) @intrinsic_attr class OclAtomicTemplate(AttributeTemplate):
64
64
56
13
51
DrTodd13/numba
numba/dppl/ocl/ocldecl.py
Python
OclAtomicTemplate
OclAtomicTemplate
107
115
107
108
491347521289c171e815e3558c23b06517f489aa
bigcode/the-stack
train
e7fffaf57b7a174921f3f711
train
class
@intrinsic class Ocl_atomic_add(AbstractTemplate): key = dppl.atomic.add def generic(self, args, kws): assert not kws ary, idx, val = args if ary.ndim == 1: return signature(ary.dtype, ary, types.intp, ary.dtype) elif ary.ndim > 1: return signature(ary.d...
@intrinsic class Ocl_atomic_add(AbstractTemplate):
key = dppl.atomic.add def generic(self, args, kws): assert not kws ary, idx, val = args if ary.ndim == 1: return signature(ary.dtype, ary, types.intp, ary.dtype) elif ary.ndim > 1: return signature(ary.dtype, ary, idx, ary.dtype)
(types.void, types.uint32)] @intrinsic class Ocl_sub_group_barrier(ConcreteTemplate): key = dppl.sub_group_barrier cases = [signature(types.void)] # dppl.atomic submodule ------------------------------------------------------- @intrinsic class Ocl_atomic_add(AbstractTemplate):
64
64
91
12
52
DrTodd13/numba
numba/dppl/ocl/ocldecl.py
Python
Ocl_atomic_add
Ocl_atomic_add
80
91
80
81
a5654c1b3129dd645138ab405a1fd68abb7dec30
bigcode/the-stack
train
81210f573f30080c68bc259b
train
class
@intrinsic class Ocl_barrier(ConcreteTemplate): key = dppl.barrier cases = [signature(types.void, types.uint32), signature(types.void)]
@intrinsic class Ocl_barrier(ConcreteTemplate):
key = dppl.barrier cases = [signature(types.void, types.uint32), signature(types.void)]
cases = [signature(types.intp, types.uint32)] @intrinsic class Ocl_get_local_size(ConcreteTemplate): key = dppl.get_local_size cases = [signature(types.intp, types.uint32)] @intrinsic class Ocl_barrier(ConcreteTemplate):
63
64
40
13
50
DrTodd13/numba
numba/dppl/ocl/ocldecl.py
Python
Ocl_barrier
Ocl_barrier
58
62
58
59
ee46f2334fd3b6e06f6469aadaeab691ef44408a
bigcode/the-stack
train
9ae5d890bfe3dea3c698e1b4
train
class
@intrinsic class Ocl_atomic_sub(AbstractTemplate): key = dppl.atomic.sub def generic(self, args, kws): assert not kws ary, idx, val = args if ary.ndim == 1: return signature(ary.dtype, ary, types.intp, ary.dtype) elif ary.ndim > 1: return signature(ary.d...
@intrinsic class Ocl_atomic_sub(AbstractTemplate):
key = dppl.atomic.sub def generic(self, args, kws): assert not kws ary, idx, val = args if ary.ndim == 1: return signature(ary.dtype, ary, types.intp, ary.dtype) elif ary.ndim > 1: return signature(ary.dtype, ary, idx, ary.dtype)
val = args if ary.ndim == 1: return signature(ary.dtype, ary, types.intp, ary.dtype) elif ary.ndim > 1: return signature(ary.dtype, ary, idx, ary.dtype) @intrinsic class Ocl_atomic_sub(AbstractTemplate):
64
64
91
12
52
DrTodd13/numba
numba/dppl/ocl/ocldecl.py
Python
Ocl_atomic_sub
Ocl_atomic_sub
93
104
93
94
bbc3b4dc86be85ccdd977cd8994915ff446d31be
bigcode/the-stack
train
f436f86e7e3ad4cd30f19faa
train
class
@intrinsic class Ocl_get_local_size(ConcreteTemplate): key = dppl.get_local_size cases = [signature(types.intp, types.uint32)]
@intrinsic class Ocl_get_local_size(ConcreteTemplate):
key = dppl.get_local_size cases = [signature(types.intp, types.uint32)]
_work_dim cases = [signature(types.uint32)] @intrinsic class Ocl_get_global_size(ConcreteTemplate): key = dppl.get_global_size cases = [signature(types.intp, types.uint32)] @intrinsic class Ocl_get_local_size(ConcreteTemplate):
63
64
36
14
49
DrTodd13/numba
numba/dppl/ocl/ocldecl.py
Python
Ocl_get_local_size
Ocl_get_local_size
52
55
52
53
4633b2c66e06dcd7ba964fe836189d91de5b243c
bigcode/the-stack
train
f6153dfc8ddc6aa8b758d507
train
class
@intrinsic class Ocl_get_work_dim(ConcreteTemplate): key = dppl.get_work_dim cases = [signature(types.uint32)]
@intrinsic class Ocl_get_work_dim(ConcreteTemplate):
key = dppl.get_work_dim cases = [signature(types.uint32)]
cases = [signature(types.intp, types.uint32)] @intrinsic class Ocl_get_num_groups(ConcreteTemplate): key = dppl.get_num_groups cases = [signature(types.intp, types.uint32)] @intrinsic class Ocl_get_work_dim(ConcreteTemplate):
63
64
32
14
49
DrTodd13/numba
numba/dppl/ocl/ocldecl.py
Python
Ocl_get_work_dim
Ocl_get_work_dim
40
43
40
41
c292494659bf036ffdd4ae4c4fff37ec91406c90
bigcode/the-stack
train
5229eada25d8277bffac9902
train
class
@intrinsic_attr class OclLocalTemplate(AttributeTemplate): key = types.Module(dppl.local) def resolve_static_alloc(self, mod): return types.Macro(Ocl_local_alloc)
@intrinsic_attr class OclLocalTemplate(AttributeTemplate):
key = types.Module(dppl.local) def resolve_static_alloc(self, mod): return types.Macro(Ocl_local_alloc)
return types.Function(Ocl_atomic_add) def resolve_sub(self, mod): return types.Function(Ocl_atomic_sub) # dppl.local submodule ------------------------------------------------------- class Ocl_local_alloc(MacroTemplate): key = dppl.local.static_alloc @intrinsic_attr class OclLocalTemplate(Attribute...
64
64
41
13
50
DrTodd13/numba
numba/dppl/ocl/ocldecl.py
Python
OclLocalTemplate
OclLocalTemplate
124
129
124
125
5b08de7f7ee6a5d8eddfdc0a275540a23efb8b98
bigcode/the-stack
train
2f9faa8d801f968e348e9cc0
train
class
@intrinsic_attr class OclModuleTemplate(AttributeTemplate): key = types.Module(dppl) def resolve_get_global_id(self, mod): return types.Function(Ocl_get_global_id) def resolve_get_local_id(self, mod): return types.Function(Ocl_get_local_id) def resolve_get_global_size(self, mod): ...
@intrinsic_attr class OclModuleTemplate(AttributeTemplate):
key = types.Module(dppl) def resolve_get_global_id(self, mod): return types.Function(Ocl_get_global_id) def resolve_get_local_id(self, mod): return types.Function(Ocl_get_local_id) def resolve_get_global_size(self, mod): return types.Function(Ocl_get_global_size) def reso...
_local_alloc(MacroTemplate): key = dppl.local.static_alloc @intrinsic_attr class OclLocalTemplate(AttributeTemplate): key = types.Module(dppl.local) def resolve_static_alloc(self, mod): return types.Macro(Ocl_local_alloc) # OpenCL module ---------------------------------------------------------...
75
75
253
13
62
DrTodd13/numba
numba/dppl/ocl/ocldecl.py
Python
OclModuleTemplate
OclModuleTemplate
134
172
134
135
5768835360120a3bb532c32a739fa6428795b29c
bigcode/the-stack
train
7554e9ad5b37a4d99ad8609d
train
class
@intrinsic class Ocl_get_local_id(ConcreteTemplate): key = dppl.get_local_id cases = [signature(types.intp, types.uint32)]
@intrinsic class Ocl_get_local_id(ConcreteTemplate):
key = dppl.get_local_id cases = [signature(types.intp, types.uint32)]
registry.register_global #register_number_classes(intrinsic_global) @intrinsic class Ocl_get_global_id(ConcreteTemplate): key = dppl.get_global_id cases = [signature(types.intp, types.uint32)] @intrinsic class Ocl_get_local_id(ConcreteTemplate):
63
64
36
14
49
DrTodd13/numba
numba/dppl/ocl/ocldecl.py
Python
Ocl_get_local_id
Ocl_get_local_id
22
25
22
23
24e3ccdf464e2c1428820f3299188a5691899c21
bigcode/the-stack
train
6df7392b53a15fecc3866d29
train
class
class Table(Range): """ 数据表 """ def __init__(self): Range.__init__(self) def getName(self): return self.impl.DisplayName
class Table(Range):
""" 数据表 """ def __init__(self): Range.__init__(self) def getName(self): return self.impl.DisplayName
""" Table """ from .Range import Range __all__ = ['Table'] class Table(Range):
22
64
41
5
17
qq809326636/pyoffice
src/pyoffice/excel/windows/Table.py
Python
Table
Table
9
18
9
9
b8a369a63f28ac98e2574d70c70315f0da6337b0
bigcode/the-stack
train
3cae10bf22e1fa2cf06924e1
train
class
class Migration(migrations.Migration): dependencies = [ ('controller', '0008_auto_20200521_1018'), ] operations = [ migrations.CreateModel( name='Competitions', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, ve...
class Migration(migrations.Migration):
dependencies = [ ('controller', '0008_auto_20200521_1018'), ] operations = [ migrations.CreateModel( name='Competitions', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('com...
# Generated by Django 3.0.5 on 2020-05-25 02:18 from django.db import migrations, models class Migration(migrations.Migration):
38
64
186
7
30
twilight2017/SportManage
competition/controller/migrations/0009_competitions.py
Python
Migration
Migration
6
25
6
7
0514b431450aa6c8abf989c92aff48701322b098
bigcode/the-stack
train
24b0c1eb6fea6e3327ec3391
train
class
class DobotSuctionCup(SuctionCup): def __init__(self, count: int = 0): super().__init__(count, 'Dobot_suctionCup')
class DobotSuctionCup(SuctionCup):
def __init__(self, count: int = 0): super().__init__(count, 'Dobot_suctionCup')
from PyRep.pyrep.robots.end_effectors.suction_cup import SuctionCup class DobotSuctionCup(SuctionCup):
29
64
38
10
18
liuzhy71/PyRep
pyrep/robots/end_effectors/dobot_suction_cup.py
Python
DobotSuctionCup
DobotSuctionCup
4
7
4
5
db04660ec41b89558fdd953a84d0dee08014bba0
bigcode/the-stack
train
e97dc5bb33bba09325b6af3e
train
class
class SparkDataFrameValueType(DataValueType): type = spark.DataFrame type_str = "Spark.DataFrame" support_merge = False config_name = "spark_dataframe" def to_signature(self, x): id = "rdd-%s-at-%s" % (x.rdd.id(), x.rdd.context.applicationId) return id def to_preview(self, df,...
class SparkDataFrameValueType(DataValueType):
type = spark.DataFrame type_str = "Spark.DataFrame" support_merge = False config_name = "spark_dataframe" def to_signature(self, x): id = "rdd-%s-at-%s" % (x.rdd.id(), x.rdd.context.applicationId) return id def to_preview(self, df, preview_size): # type: (spark.DataFrame, int...
from __future__ import absolute_import import logging import typing import pyspark.sql as spark from dbnd_spark.spark_targets.spark_histograms import SparkHistograms from targets.value_meta import ValueMeta from targets.values.builtins_values import DataValueType if typing.TYPE_CHECKING: from targets.value_met...
90
154
516
10
80
kalebinn/dbnd
plugins/dbnd-spark/src/dbnd_spark/spark_targets/spark_values.py
Python
SparkDataFrameValueType
SparkDataFrameValueType
19
92
19
19
83f674c552b1d4220e4ad2fd54cc430b54ad1024
bigcode/the-stack
train
c7b13c579ed22dccd47e0cb5
train
class
class Config: """ General configuration class """ SECRET_KEY = 'qGkdxkNgQcOy3pAOrTi0YQ' UPLOADED_PHOTOS_DEST ='app/static/photos' SQLALCHEMY_DATABASE_URI = 'postgresql+psycopg2://moringa:access@localhost/blog' QUOTES_API_BASE_URL = 'http://quotes.stormconsultancy.co.uk/random.json' # ema...
class Config:
""" General configuration class """ SECRET_KEY = 'qGkdxkNgQcOy3pAOrTi0YQ' UPLOADED_PHOTOS_DEST ='app/static/photos' SQLALCHEMY_DATABASE_URI = 'postgresql+psycopg2://moringa:access@localhost/blog' QUOTES_API_BASE_URL = 'http://quotes.stormconsultancy.co.uk/random.json' # email configurati...
import os class Config:
6
64
149
3
2
simonkairu/Blogs-
config.py
Python
Config
Config
4
17
4
4
1379c12cf1858c6976b3c7124acbad1acc10c24c
bigcode/the-stack
train
e55ea59916fc54b233348223
train
class
class TestConfig(Config): SQLALCHEMY_DATABASE_URI = 'postgresql+psycopg2://moringa:access@localhost/blog_test'
class TestConfig(Config):
SQLALCHEMY_DATABASE_URI = 'postgresql+psycopg2://moringa:access@localhost/blog_test'
and SQLALCHEMY_DATABASE_URI.startswith("postgres://"): SQLALCHEMY_DATABASE_URI = SQLALCHEMY_DATABASE_URI.replace("postgres://", "postgresql://", 1) class DevConfig(Config): """ Development configuration class """ DEBUG = True class TestConfig(Config):
64
64
33
5
58
simonkairu/Blogs-
config.py
Python
TestConfig
TestConfig
36
37
36
36
7e7fc1cb0ab5f686405d9bda8bc9cf9896e7ed2f
bigcode/the-stack
train
362cff761ae0ec16a2c8d0c3
train
class
class ProdConfig(Config): """ Production configuration class """ SQLALCHEMY_DATABASE_URI = os.environ.get("DATABASE_URL") if SQLALCHEMY_DATABASE_URI and SQLALCHEMY_DATABASE_URI.startswith("postgres://"): SQLALCHEMY_DATABASE_URI = SQLALCHEMY_DATABASE_URI.replace("postgres://", "postgresql://", ...
class ProdConfig(Config):
""" Production configuration class """ SQLALCHEMY_DATABASE_URI = os.environ.get("DATABASE_URL") if SQLALCHEMY_DATABASE_URI and SQLALCHEMY_DATABASE_URI.startswith("postgres://"): SQLALCHEMY_DATABASE_URI = SQLALCHEMY_DATABASE_URI.replace("postgres://", "postgresql://", 1)
.json' # email configurations MAIL_SERVER = 'smtp.googlemail.com' MAIL_PORT = 587 MAIL_USE_TLS = True MAIL_USERNAME = 'simon.mureithi@student.moringaschool.com' MAIL_PASSWORD = 'prince070202' class ProdConfig(Config):
63
64
76
5
58
simonkairu/Blogs-
config.py
Python
ProdConfig
ProdConfig
21
27
21
21
8f090806b735f6561cf40845059568d828757ab7
bigcode/the-stack
train
84dc7c804e5cff519c70f1f7
train
class
class DevConfig(Config): """ Development configuration class """ DEBUG = True
class DevConfig(Config):
""" Development configuration class """ DEBUG = True
MY_DATABASE_URI = os.environ.get("DATABASE_URL") if SQLALCHEMY_DATABASE_URI and SQLALCHEMY_DATABASE_URI.startswith("postgres://"): SQLALCHEMY_DATABASE_URI = SQLALCHEMY_DATABASE_URI.replace("postgres://", "postgresql://", 1) class DevConfig(Config):
63
64
19
5
58
simonkairu/Blogs-
config.py
Python
DevConfig
DevConfig
29
33
29
29
4c869b6f2eb6936763aa68593bed7e9aa989b0c4
bigcode/the-stack
train
dfa747ab8835e08e7888503c
train
class
class UniqueInOrderTestCase(unittest.TestCase): def test_equals(self): self.assertEqual(unique_in_order('AAAABBBCCDAABBB'), ['A', 'B', 'C', 'D', 'A', 'B'])
class UniqueInOrderTestCase(unittest.TestCase):
def test_equals(self): self.assertEqual(unique_in_order('AAAABBBCCDAABBB'), ['A', 'B', 'C', 'D', 'A', 'B'])
import unittest from katas.kyu_6.unique_in_order import unique_in_order class UniqueInOrderTestCase(unittest.TestCase):
29
64
51
10
18
the-zebulan/CodeWars
tests/kyu_6_tests/test_unique_in_order.py
Python
UniqueInOrderTestCase
UniqueInOrderTestCase
6
9
6
6
6b773853b37abcfa9f43fb021b90d4d94c2129af
bigcode/the-stack
train
e5fea7dde38b0227da374def
train
function
def build_image_impl(image_name, no_cache=False, pull=False): """Build image.""" proj_is_base_image = is_base_image(image_name) if proj_is_base_image: image_project = 'oss-fuzz-base' dockerfile_dir = os.path.join('infra', 'base-images', image_name) else: image_project = 'oss-fuzz' if not check_...
def build_image_impl(image_name, no_cache=False, pull=False):
"""Build image.""" proj_is_base_image = is_base_image(image_name) if proj_is_base_image: image_project = 'oss-fuzz-base' dockerfile_dir = os.path.join('infra', 'base-images', image_name) else: image_project = 'oss-fuzz' if not check_project_exists(image_name): return False dockerfile...
"; "dataflow" for "dataflow" engine') def _add_environment_args(parser): """Add common environment args.""" parser.add_argument('-e', action='append', help="set environment variable e.g. VAR=value") def build_image_impl(image_name, no_cache=False, pull=False):
64
64
166
14
50
devtty1er/oss-fuzz
infra/helper.py
Python
build_image_impl
build_image_impl
333
355
333
333
77b4de81416f00a051300d21a2f719a7e4e6108e
bigcode/the-stack
train
4762b9ff80bccec4126f9b23
train
function
def _check_fuzzer_exists(project_name, fuzzer_name): """Checks if a fuzzer exists.""" command = ['docker', 'run', '--rm'] command.extend(['-v', '%s:/out' % _get_output_dir(project_name)]) command.append('ubuntu:16.04') command.extend(['/bin/bash', '-c', 'test -f /out/%s' % fuzzer_name]) try: subproces...
def _check_fuzzer_exists(project_name, fuzzer_name):
"""Checks if a fuzzer exists.""" command = ['docker', 'run', '--rm'] command.extend(['-v', '%s:/out' % _get_output_dir(project_name)]) command.append('ubuntu:16.04') command.extend(['/bin/bash', '-c', 'test -f /out/%s' % fuzzer_name]) try: subprocess.check_call(command) except subprocess.CalledProce...
)) def check_project_exists(project_name): """Checks if a project exists.""" if not os.path.exists(_get_project_dir(project_name)): print(project_name, 'does not exist', file=sys.stderr) return False return True def _check_fuzzer_exists(project_name, fuzzer_name):
64
64
140
13
50
devtty1er/oss-fuzz
infra/helper.py
Python
_check_fuzzer_exists
_check_fuzzer_exists
235
251
235
235
e15dc727e11942bbd5dd383680da38e2002d99a4
bigcode/the-stack
train
3afd9463a1645ceb11f6e1c6
train
function
def reproduce(args): """Reproduce a specific test case from a specific project.""" return reproduce_impl(args.project_name, args.fuzzer_name, args.valgrind, args.e, args.fuzzer_args, args.testcase_path)
def reproduce(args):
"""Reproduce a specific test case from a specific project.""" return reproduce_impl(args.project_name, args.fuzzer_name, args.valgrind, args.e, args.fuzzer_args, args.testcase_path)
'%s:/out' % _get_output_dir(args.project_name), '-t', 'gcr.io/oss-fuzz-base/base-runner', 'run_fuzzer', args.fuzzer_name, ] + args.fuzzer_args return docker_run(run_args) def reproduce(args):
64
64
49
4
60
devtty1er/oss-fuzz
infra/helper.py
Python
reproduce
reproduce
806
809
806
806
dd22c1441cddac9352b408dfee80fd1bd2528856
bigcode/the-stack
train
c95e691a5df21695b3de2e80
train
function
def download_corpora(args): """Download most recent corpora from GCS for the given project.""" if not check_project_exists(args.project_name): return 1 try: with open(os.devnull, 'w') as stdout: subprocess.check_call(['gsutil', '--version'], stdout=stdout) except OSError: print( 'ERRO...
def download_corpora(args):
"""Download most recent corpora from GCS for the given project.""" if not check_project_exists(args.project_name): return 1 try: with open(os.devnull, 'w') as stdout: subprocess.check_call(['gsutil', '--version'], stdout=stdout) except OSError: print( 'ERROR: gsutil not found. Please ...
subprocess.check_call(command) os.remove(archive_path) else: # Sync the working corpus copy if a minimized backup is not available. corpus_url = CORPUS_URL_FORMAT.format(project_name=project_name, fuzz_target=fuzz_target) command = ['gsutil', '-m', '-q', '...
93
93
310
7
86
devtty1er/oss-fuzz
infra/helper.py
Python
download_corpora
download_corpora
675
712
675
675
34ccf4fed2b632727c17164453e8f2f4ddbc9c91
bigcode/the-stack
train
2fdf51e8fa15a86aa4c23209
train
function
def docker_pull(image): """Call `docker pull`.""" command = ['docker', 'pull', image] print('Running:', _get_command_string(command)) try: subprocess.check_call(command) except subprocess.CalledProcessError: print('docker pull failed.', file=sys.stderr) return False return True
def docker_pull(image):
"""Call `docker pull`.""" command = ['docker', 'pull', image] print('Running:', _get_command_string(command)) try: subprocess.check_call(command) except subprocess.CalledProcessError: print('docker pull failed.', file=sys.stderr) return False return True
command.append('--pull') command.extend(build_args) print('Running:', _get_command_string(command)) try: subprocess.check_call(command) except subprocess.CalledProcessError: print('docker build failed.', file=sys.stderr) return False return True def docker_pull(image):
64
64
71
5
58
devtty1er/oss-fuzz
infra/helper.py
Python
docker_pull
docker_pull
433
444
433
433
7418ff9823107123ed4c9b237c2efca37ab49ab7
bigcode/the-stack
train
0f059ccf7d32492e830eeca1
train
function
def docker_run(run_args, print_output=True): """Call `docker run`.""" command = ['docker', 'run', '--rm', '--privileged'] # Support environments with a TTY. if sys.stdin.isatty(): command.append('-i') command.extend(run_args) print('Running:', _get_command_string(command)) stdout = None if not pr...
def docker_run(run_args, print_output=True):
"""Call `docker run`.""" command = ['docker', 'run', '--rm', '--privileged'] # Support environments with a TTY. if sys.stdin.isatty(): command.append('-i') command.extend(run_args) print('Running:', _get_command_string(command)) stdout = None if not print_output: stdout = open(os.devnull, 'w'...
the given project.""" dockerfile_path = get_dockerfile_path(project_name) with open(dockerfile_path) as file_handle: lines = file_handle.readlines() return workdir_from_lines(lines, default=os.path.join('/src', project_name)) def docker_run(run_args, print_output=True):
64
64
136
10
54
devtty1er/oss-fuzz
infra/helper.py
Python
docker_run
docker_run
392
412
392
392
90e215c4615d9d748d0c5b5778e6e00ed4185c5f
bigcode/the-stack
train
5b17bfd7c717f812dc561bdd
train
function
def _get_project_language(project_name): """Returns project language.""" project_yaml_path = os.path.join(OSS_FUZZ_DIR, 'projects', project_name, 'project.yaml') with open(project_yaml_path) as file_handle: content = file_handle.read() for line in content.splitlines(): ...
def _get_project_language(project_name):
"""Returns project language.""" project_yaml_path = os.path.join(OSS_FUZZ_DIR, 'projects', project_name, 'project.yaml') with open(project_yaml_path) as file_handle: content = file_handle.read() for line in content.splitlines(): match = PROJECT_LANGUAGE_REGEX.match...
return os.path.join(BUILD_DIR, 'out', project_name) def _get_work_dir(project_name=''): """Returns path to /work directory for the given project (if specified).""" return os.path.join(BUILD_DIR, 'work', project_name) def _get_project_language(project_name):
64
64
90
8
56
devtty1er/oss-fuzz
infra/helper.py
Python
_get_project_language
_get_project_language
289
300
289
289
2eaadca446772e4d3a2e81da0bb6ac23f637d13b
bigcode/the-stack
train
ad624741c2d08b454d37ff06
train
function
def get_dockerfile_path(project_name): """Returns path to the project Dockerfile.""" return os.path.join(_get_project_dir(project_name), 'Dockerfile')
def get_dockerfile_path(project_name):
"""Returns path to the project Dockerfile.""" return os.path.join(_get_project_dir(project_name), 'Dockerfile')
a shell escaped command string.""" return ' '.join(pipes.quote(part) for part in command) def _get_project_dir(project_name): """Returns path to the project.""" return os.path.join(OSS_FUZZ_DIR, 'projects', project_name) def get_dockerfile_path(project_name):
64
64
35
9
55
devtty1er/oss-fuzz
infra/helper.py
Python
get_dockerfile_path
get_dockerfile_path
269
271
269
269
20f1bf4505c96af8d3e4c88161ffd01486de5555
bigcode/the-stack
train
a73f7b78c8010f46223cb6a7
train
function
def run_fuzzer(args): """Runs a fuzzer in the container.""" if not check_project_exists(args.project_name): return 1 if not _check_fuzzer_exists(args.project_name, args.fuzzer_name): return 1 env = [ 'FUZZING_ENGINE=' + args.engine, 'SANITIZER=' + args.sanitizer, 'RUN_FUZZER_MODE=int...
def run_fuzzer(args):
"""Runs a fuzzer in the container.""" if not check_project_exists(args.project_name): return 1 if not _check_fuzzer_exists(args.project_name, args.fuzzer_name): return 1 env = [ 'FUZZING_ENGINE=' + args.engine, 'SANITIZER=' + args.sanitizer, 'RUN_FUZZER_MODE=interactive', ] if a...
uzz_target: run_args.append(args.fuzz_target) exit_code = docker_run(run_args) if exit_code == 0: print('Successfully generated clang code coverage report.') else: print('Failed to generate clang code coverage report.') return exit_code def run_fuzzer(args):
64
64
182
6
57
devtty1er/oss-fuzz
infra/helper.py
Python
run_fuzzer
run_fuzzer
777
803
777
777
3a77bf7fad21927ce48f5ccfdc00a721509ccaf3
bigcode/the-stack
train
9b1ed29b939fc59b2ef8e707
train
function
def _get_latest_corpus(project_name, fuzz_target, base_corpus_dir): """Download the latest corpus for the given fuzz target.""" corpus_dir = os.path.join(base_corpus_dir, fuzz_target) if not os.path.exists(corpus_dir): os.makedirs(corpus_dir) if not fuzz_target.startswith(project_name): fuzz_target = '...
def _get_latest_corpus(project_name, fuzz_target, base_corpus_dir):
"""Download the latest corpus for the given fuzz target.""" corpus_dir = os.path.join(base_corpus_dir, fuzz_target) if not os.path.exists(corpus_dir): os.makedirs(corpus_dir) if not fuzz_target.startswith(project_name): fuzz_target = '%s_%s' % (project_name, fuzz_target) corpus_backup_url = CORPUS_B...
get_fuzz_targets(project_name): """Return names of fuzz targest build in the project's /out directory.""" fuzz_targets = [] for name in os.listdir(_get_output_dir(project_name)): if name.startswith('afl-'): continue path = os.path.join(_get_output_dir(project_name), name) if os.path.isfile(path...
112
112
376
17
94
devtty1er/oss-fuzz
infra/helper.py
Python
_get_latest_corpus
_get_latest_corpus
634
672
634
634
1e26d4161ea11fca773252a9742ac6490a61f2a0
bigcode/the-stack
train
88b340fa155ce311bf04ea9c
train
function
def build_fuzzers_impl( # pylint: disable=too-many-arguments,too-many-locals,too-many-branches project_name, clean, engine, sanitizer, architecture, env_to_add, source_path, no_cache=False, mount_location=None): """Build fuzzers.""" if not build_image_impl(project_name, no_cache...
def build_fuzzers_impl( # pylint: disable=too-many-arguments,too-many-locals,too-many-branches project_name, clean, engine, sanitizer, architecture, env_to_add, source_path, no_cache=False, mount_location=None):
"""Build fuzzers.""" if not build_image_impl(project_name, no_cache=no_cache): return 1 project_out_dir = _get_output_dir(project_name) project_work_dir = _get_work_dir(project_name) project_language = _get_project_language(project_name) if not project_language: print('WARNING: language not specifi...
return True def build_image(args): """Build docker image.""" if args.pull and args.no_pull: print('Incompatible arguments --pull and --no-pull.') return 1 if args.pull: pull = True elif args.no_pull: pull = False else: y_or_n = raw_input('Pull latest base images (compiler/runtime)? (y/...
228
228
761
64
163
devtty1er/oss-fuzz
infra/helper.py
Python
build_fuzzers_impl
build_fuzzers_impl
473
573
473
482
4af91ae1da95c010f6f5a28149325e92aea14b9c
bigcode/the-stack
train
2185291fb4ca626693ea2594
train
function
def _get_output_dir(project_name=''): """Returns path to /out directory for the given project (if specified).""" return os.path.join(BUILD_DIR, 'out', project_name)
def _get_output_dir(project_name=''):
"""Returns path to /out directory for the given project (if specified).""" return os.path.join(BUILD_DIR, 'out', project_name)
(_get_project_dir(project_name), 'Dockerfile') def _get_corpus_dir(project_name=''): """Returns path to /corpus directory for the given project (if specified).""" return os.path.join(BUILD_DIR, 'corpus', project_name) def _get_output_dir(project_name=''):
64
64
41
9
55
devtty1er/oss-fuzz
infra/helper.py
Python
_get_output_dir
_get_output_dir
279
281
279
279
9881237b15c99bdbfe1351291ee3a5eee7a0ac42
bigcode/the-stack
train
b712dff63587c914a728ef59
train
function
def _workdir_from_dockerfile(project_name): """Parse WORKDIR from the Dockerfile for the given project.""" dockerfile_path = get_dockerfile_path(project_name) with open(dockerfile_path) as file_handle: lines = file_handle.readlines() return workdir_from_lines(lines, default=os.path.join('/src', project_na...
def _workdir_from_dockerfile(project_name):
"""Parse WORKDIR from the Dockerfile for the given project.""" dockerfile_path = get_dockerfile_path(project_name) with open(dockerfile_path) as file_handle: lines = file_handle.readlines() return workdir_from_lines(lines, default=os.path.join('/src', project_name))
.group(1) workdir = workdir.replace('$SRC', '/src') if not os.path.isabs(workdir): workdir = os.path.join('/src', workdir) return os.path.normpath(workdir) return default def _workdir_from_dockerfile(project_name):
64
64
75
11
52
devtty1er/oss-fuzz
infra/helper.py
Python
_workdir_from_dockerfile
_workdir_from_dockerfile
382
389
382
382
516dad23e1ace8fa775b7b52b55f520844c1893c
bigcode/the-stack
train
7ff97daf949531580fa3101d
train
function
def build_fuzzers(args): """Build fuzzers.""" return build_fuzzers_impl(args.project_name, args.clean, args.engine, args.sanitizer, args.architecture, args.e, args.source_path)
def build_fuzzers(args):
"""Build fuzzers.""" return build_fuzzers_impl(args.project_name, args.clean, args.engine, args.sanitizer, args.architecture, args.e, args.source_path)
_out_dir, '-v', '%s:/work' % project_work_dir ] + _env_to_docker_args(env) + ['gcr.io/oss-fuzz-base/base-msan-builder', 'patch_build.py', '/out']) return 0 def build_fuzzers(args):
64
64
48
7
56
devtty1er/oss-fuzz
infra/helper.py
Python
build_fuzzers
build_fuzzers
576
580
576
576
65275d1605e289c8f6db19526c8d1c368e29daa0
bigcode/the-stack
train
6d6fb2ea0c62b98f02d56bfc
train
function
def check_project_exists(project_name): """Checks if a project exists.""" if not os.path.exists(_get_project_dir(project_name)): print(project_name, 'does not exist', file=sys.stderr) return False return True
def check_project_exists(project_name):
"""Checks if a project exists.""" if not os.path.exists(_get_project_dir(project_name)): print(project_name, 'does not exist', file=sys.stderr) return False return True
if args.command == 'pull_images': return pull_images(args) return 0 def is_base_image(image_name): """Checks if the image name is a base image.""" return os.path.exists(os.path.join('infra', 'base-images', image_name)) def check_project_exists(project_name):
64
64
50
7
57
devtty1er/oss-fuzz
infra/helper.py
Python
check_project_exists
check_project_exists
226
232
226
226
102f5fa0e720b0ca33ce10a884f6a1ee86b5d222
bigcode/the-stack
train
da7bdc9f6955595c4b48e735
train
function
def _get_command_string(command): """Returns a shell escaped command string.""" return ' '.join(pipes.quote(part) for part in command)
def _get_command_string(command):
"""Returns a shell escaped command string.""" return ' '.join(pipes.quote(part) for part in command)
, 'does not seem to exist. Please run build_fuzzers first.', file=sys.stderr) return False return True def _get_absolute_path(path): """Returns absolute path with user expansion.""" return os.path.abspath(os.path.expanduser(path)) def _get_command_string(command):
64
64
31
7
57
devtty1er/oss-fuzz
infra/helper.py
Python
_get_command_string
_get_command_string
259
261
259
259
0f9d6c49050ba6e753c2bc8d955ae0704266c843
bigcode/the-stack
train
c600e98b073754220dd83327
train
function
def docker_build(build_args, pull=False): """Call `docker build`.""" command = ['docker', 'build'] if pull: command.append('--pull') command.extend(build_args) print('Running:', _get_command_string(command)) try: subprocess.check_call(command) except subprocess.CalledProcessError: print('doc...
def docker_build(build_args, pull=False):
"""Call `docker build`.""" command = ['docker', 'build'] if pull: command.append('--pull') command.extend(build_args) print('Running:', _get_command_string(command)) try: subprocess.check_call(command) except subprocess.CalledProcessError: print('docker build failed.', file=sys.stderr) r...
not print_output: stdout = open(os.devnull, 'w') try: subprocess.check_call(command, stdout=stdout, stderr=subprocess.STDOUT) except subprocess.CalledProcessError as error: return error.returncode return 0 def docker_build(build_args, pull=False):
64
64
89
9
54
devtty1er/oss-fuzz
infra/helper.py
Python
docker_build
docker_build
415
430
415
415
cea05a091521325e6aa85195febee3be8a105c73
bigcode/the-stack
train
48c8b93a88d362f3b065190d
train
function
def is_base_image(image_name): """Checks if the image name is a base image.""" return os.path.exists(os.path.join('infra', 'base-images', image_name))
def is_base_image(image_name):
"""Checks if the image name is a base image.""" return os.path.exists(os.path.join('infra', 'base-images', image_name))
.command == 'coverage': return coverage(args) if args.command == 'reproduce': return reproduce(args) if args.command == 'shell': return shell(args) if args.command == 'pull_images': return pull_images(args) return 0 def is_base_image(image_name):
64
64
37
7
56
devtty1er/oss-fuzz
infra/helper.py
Python
is_base_image
is_base_image
221
223
221
221
544949c8f0d798d25e386bff78553a5f5c1a8a2c
bigcode/the-stack
train
0e60c5222087f54fc5ac59fe
train
function
def reproduce_impl( # pylint: disable=too-many-arguments project_name, fuzzer_name, valgrind, env_to_add, fuzzer_args, testcase_path, runner=docker_run, err_result=1): """Reproduces a testcase in the container.""" if not check_project_exists(project_name): return err_result i...
def reproduce_impl( # pylint: disable=too-many-arguments project_name, fuzzer_name, valgrind, env_to_add, fuzzer_args, testcase_path, runner=docker_run, err_result=1):
"""Reproduces a testcase in the container.""" if not check_project_exists(project_name): return err_result if not _check_fuzzer_exists(project_name, fuzzer_name): return err_result debugger = '' env = [] image_name = 'base-runner' if valgrind: debugger = 'valgrind --tool=memcheck --track-or...
return reproduce_impl(args.project_name, args.fuzzer_name, args.valgrind, args.e, args.fuzzer_args, args.testcase_path) def reproduce_impl( # pylint: disable=too-many-arguments project_name, fuzzer_name, valgrind, env_to_add, fuzzer_args, testcase_path, runner=docke...
86
86
287
55
31
devtty1er/oss-fuzz
infra/helper.py
Python
reproduce_impl
reproduce_impl
812
854
812
820
d91cd732384af349f53d24ebb57b05f4ced9f3a3
bigcode/the-stack
train
65daa41d51078937b85afc58
train
function
def main(): # pylint: disable=too-many-branches,too-many-return-statements,too-many-statements """Get subcommand from program arguments and do it.""" os.chdir(OSS_FUZZ_DIR) if not os.path.exists(BUILD_DIR): os.mkdir(BUILD_DIR) parser = argparse.ArgumentParser('helper.py', description='oss-fuzz helpers') ...
def main(): # pylint: disable=too-many-branches,too-many-return-statements,too-many-statements
"""Get subcommand from program arguments and do it.""" os.chdir(OSS_FUZZ_DIR) if not os.path.exists(BUILD_DIR): os.mkdir(BUILD_DIR) parser = argparse.ArgumentParser('helper.py', description='oss-fuzz helpers') subparsers = parser.add_subparsers(dest='command') generate_parser = subparsers.add_parser( ...
/oss-fuzz-base/base-clang', 'gcr.io/oss-fuzz-base/base-builder', 'gcr.io/oss-fuzz-base/base-runner', 'gcr.io/oss-fuzz-base/base-runner-debug', 'gcr.io/oss-fuzz-base/base-msan-builder', 'gcr.io/oss-fuzz-base/msan-builder', ] VALID_PROJECT_NAME_REGEX = re.compile(r'^[a-zA-Z0-9_-]+$') MAX_PROJECT_NAME...
255
256
1,470
25
231
devtty1er/oss-fuzz
infra/helper.py
Python
main
main
62
218
62
62
47cdc4a07db1515f515ff08bbbff9aa029f2c6ba
bigcode/the-stack
train
cc96d439dc4b37868e252709
train
function
def generate(args): """Generate empty project files.""" if len(args.project_name) > MAX_PROJECT_NAME_LENGTH: print('Project name needs to be less than or equal to %d characters.' % MAX_PROJECT_NAME_LENGTH, file=sys.stderr) return 1 if not VALID_PROJECT_NAME_REGEX.match(args.project_na...
def generate(args):
"""Generate empty project files.""" if len(args.project_name) > MAX_PROJECT_NAME_LENGTH: print('Project name needs to be less than or equal to %d characters.' % MAX_PROJECT_NAME_LENGTH, file=sys.stderr) return 1 if not VALID_PROJECT_NAME_REGEX.match(args.project_name): print('Inva...
'-v', '%s:/out' % _get_output_dir(project_name), '-v', '%s:/testcase' % _get_absolute_path(testcase_path), '-t', 'gcr.io/oss-fuzz-base/%s' % image_name, 'reproduce', fuzzer_name, '-runs=100', ] + fuzzer_args return runner(run_args) def generate(args):
92
92
307
4
88
devtty1er/oss-fuzz
infra/helper.py
Python
generate
generate
857
896
857
857
78d9b840e77028b534289d906a5923f360a17bfd
bigcode/the-stack
train
29b23d3b60d65e5190a632fb
train
function
def shell(args): """Runs a shell within a docker image.""" if not build_image_impl(args.project_name): return 1 env = [ 'FUZZING_ENGINE=' + args.engine, 'SANITIZER=' + args.sanitizer, 'ARCHITECTURE=' + args.architecture, ] if args.e: env += args.e if is_base_image(args.project_n...
def shell(args):
"""Runs a shell within a docker image.""" if not build_image_impl(args.project_name): return 1 env = [ 'FUZZING_ENGINE=' + args.engine, 'SANITIZER=' + args.sanitizer, 'ARCHITECTURE=' + args.architecture, ] if args.e: env += args.e if is_base_image(args.project_name): image_p...
file_handle.write(templates.DOCKER_TEMPLATE % template_args) build_sh_path = os.path.join(directory, 'build.sh') with open(build_sh_path, 'w') as file_handle: file_handle.write(templates.BUILD_TEMPLATE % template_args) os.chmod(build_sh_path, 0o755) return 0 def shell(args):
76
76
256
4
71
devtty1er/oss-fuzz
infra/helper.py
Python
shell
shell
899
935
899
899
4e1b58e5ee49bb9150c853e85b6472ff37c955b8
bigcode/the-stack
train
ec49abdc6985b47aeb69901c
train
function
def _add_architecture_args(parser, choices=('x86_64', 'i386')): """Add common architecture args.""" parser.add_argument('--architecture', default='x86_64', choices=choices)
def _add_architecture_args(parser, choices=('x86_64', 'i386')):
"""Add common architecture args.""" parser.add_argument('--architecture', default='x86_64', choices=choices)
_path) as file_handle: content = file_handle.read() for line in content.splitlines(): match = PROJECT_LANGUAGE_REGEX.match(line) if match: return match.group(1) return None def _add_architecture_args(parser, choices=('x86_64', 'i386')):
64
64
44
19
44
devtty1er/oss-fuzz
infra/helper.py
Python
_add_architecture_args
_add_architecture_args
303
305
303
303
b15a4d9a811f1e3f5395f1f7834b15253af4dcc5
bigcode/the-stack
train
b670808387685abfd06171c4
train
function
def _get_project_dir(project_name): """Returns path to the project.""" return os.path.join(OSS_FUZZ_DIR, 'projects', project_name)
def _get_project_dir(project_name):
"""Returns path to the project.""" return os.path.join(OSS_FUZZ_DIR, 'projects', project_name)
get_absolute_path(path): """Returns absolute path with user expansion.""" return os.path.abspath(os.path.expanduser(path)) def _get_command_string(command): """Returns a shell escaped command string.""" return ' '.join(pipes.quote(part) for part in command) def _get_project_dir(project_name):
64
64
34
8
56
devtty1er/oss-fuzz
infra/helper.py
Python
_get_project_dir
_get_project_dir
264
266
264
264
bb88be2ee6c71eddb53c6544fff1cfaf93409526
bigcode/the-stack
train