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
432409b8247aa78b038f70fa
train
function
def calc_fixup_size(*args): """ calc_fixup_size(type) -> int Calculate size of fixup in bytes (the number of bytes the fixup patches) @param type (C++: fixup_type_t) """ return _ida_fixup.calc_fixup_size(*args)
def calc_fixup_size(*args):
""" calc_fixup_size(type) -> int Calculate size of fixup in bytes (the number of bytes the fixup patches) @param type (C++: fixup_type_t) """ return _ida_fixup.calc_fixup_size(*args)
) -> char const * Get FIXUP description comment. @param source (C++: ea_t) @param fd (C++: const fixup_data_t &) """ return _ida_fixup.get_fixup_desc(*args) def calc_fixup_size(*args):
64
64
69
8
56
dodieboy/Np_class
REM/Tool/IDA 7.3/python/ida_fixup.py
Python
calc_fixup_size
calc_fixup_size
474
484
474
474
891a5fd694be547d97c57847b121b262f815d23b
bigcode/the-stack
train
13f4eb1092b98c7ed558147a
train
function
def is_fixup_custom(*args): """ is_fixup_custom(type) -> bool Is fixup processed by processor module? @param type (C++: fixup_type_t) """ return _ida_fixup.is_fixup_custom(*args)
def is_fixup_custom(*args):
""" is_fixup_custom(type) -> bool Is fixup processed by processor module? @param type (C++: fixup_type_t) """ return _ida_fixup.is_fixup_custom(*args)
ida_fixup.V695_FIXUP_VHIGH V695_FIXUP_VLOW = _ida_fixup.V695_FIXUP_VLOW FIXUP_OFF64 = _ida_fixup.FIXUP_OFF64 FIXUP_CUSTOM = _ida_fixup.FIXUP_CUSTOM def is_fixup_custom(*args):
64
64
58
8
55
dodieboy/Np_class
REM/Tool/IDA 7.3/python/ida_fixup.py
Python
is_fixup_custom
is_fixup_custom
124
134
124
124
d5657caaa3b9e1be50003d1a07c51648b66980c6
bigcode/the-stack
train
7b71170e7b4e1257ef4583c3
train
function
def contains_fixups(*args): """ contains_fixups(ea, size) -> bool Does the specified address range contain any fixup information? @param ea (C++: ea_t) @param size (C++: asize_t) """ return _ida_fixup.contains_fixups(*args)
def contains_fixups(*args):
""" contains_fixups(ea, size) -> bool Does the specified address range contain any fixup information? @param ea (C++: ea_t) @param size (C++: asize_t) """ return _ida_fixup.contains_fixups(*args)
.fixup_info_t_swigregister fixup_info_t_swigregister(fixup_info_t) def get_fixups(*args): """ get_fixups(out, ea, size) -> bool """ return _ida_fixup.get_fixups(*args) def contains_fixups(*args):
64
64
71
7
57
dodieboy/Np_class
REM/Tool/IDA 7.3/python/ida_fixup.py
Python
contains_fixups
contains_fixups
524
535
524
524
d064407e6b19eaf18f8a9bf15148d62739d2f8a9
bigcode/the-stack
train
7d692f6eaae0066806478555
train
function
def exists_fixup(*args): """ exists_fixup(source) -> bool Check that a fixup exists at the given address. @param source (C++: ea_t) """ return _ida_fixup.exists_fixup(*args)
def exists_fixup(*args):
""" exists_fixup(source) -> bool Check that a fixup exists at the given address. @param source (C++: ea_t) """ return _ida_fixup.exists_fixup(*args)
get_fixup(fd, source) -> bool Get fixup information. @param fd (C++: fixup_data_t *) @param source (C++: ea_t) """ return _ida_fixup.get_fixup(*args) def exists_fixup(*args):
64
64
56
7
57
dodieboy/Np_class
REM/Tool/IDA 7.3/python/ida_fixup.py
Python
exists_fixup
exists_fixup
339
349
339
339
83f0900eaf762664becf1f5dade7c256e495ecde
bigcode/the-stack
train
0f472c9f2af14a4fd31819da
train
function
def _swig_getattr(self,class_type,name): if (name == "thisown"): return self.this.own() method = class_type.__swig_getmethods__.get(name,None) if method: return method(self) raise AttributeError(name)
def _swig_getattr(self,class_type,name):
if (name == "thisown"): return self.this.own() method = class_type.__swig_getmethods__.get(name,None) if method: return method(self) raise AttributeError(name)
] = value else: raise AttributeError("You cannot add attributes to %s" % self) def _swig_setattr(self,class_type,name,value): return _swig_setattr_nondynamic(self,class_type,name,value,0) def _swig_getattr(self,class_type,name):
64
64
55
11
53
dodieboy/Np_class
REM/Tool/IDA 7.3/python/ida_fixup.py
Python
_swig_getattr
_swig_getattr
57
61
57
57
be89c1384010ba055c25fd0236cc9b82ea164367
bigcode/the-stack
train
0633c18cb19631bf5ddec55c
train
function
def get_fixup(*args): """ get_fixup(fd, source) -> bool Get fixup information. @param fd (C++: fixup_data_t *) @param source (C++: ea_t) """ return _ida_fixup.get_fixup(*args)
def get_fixup(*args):
""" get_fixup(fd, source) -> bool Get fixup information. @param fd (C++: fixup_data_t *) @param source (C++: ea_t) """ return _ida_fixup.get_fixup(*args)
ig_destroy__ = _ida_fixup.delete_fixup_data_t __del__ = lambda self : None; fixup_data_t_swigregister = _ida_fixup.fixup_data_t_swigregister fixup_data_t_swigregister(fixup_data_t) def get_fixup(*args):
64
64
66
7
57
dodieboy/Np_class
REM/Tool/IDA 7.3/python/ida_fixup.py
Python
get_fixup
get_fixup
326
337
326
326
97d7bc1c7228439ae320f02f952f35275be2ce32
bigcode/the-stack
train
fa9c06345ca1859fdfa0875d
train
function
def find_custom_fixup(*args): """ find_custom_fixup(name) -> fixup_type_t Get id of a custom fixup handler. @param name: name of the custom fixup handler (C++: const char *) @return: id with FIXUP_CUSTOM bit set or 0 """ return _ida_fixup.find_custom_fixup(*args)
def find_custom_fixup(*args):
""" find_custom_fixup(name) -> fixup_type_t Get id of a custom fixup handler. @param name: name of the custom fixup handler (C++: const char *) @return: id with FIXUP_CUSTOM bit set or 0 """ return _ida_fixup.find_custom_fixup(*args)
up_size(type) -> int Calculate size of fixup in bytes (the number of bytes the fixup patches) @param type (C++: fixup_type_t) """ return _ida_fixup.calc_fixup_size(*args) def find_custom_fixup(*args):
64
64
83
8
56
dodieboy/Np_class
REM/Tool/IDA 7.3/python/ida_fixup.py
Python
find_custom_fixup
find_custom_fixup
486
496
486
486
43213b9c49dde932b332af57004f586c4bd755e2
bigcode/the-stack
train
2358c08ae83e47ac13f9ebe2
train
function
def get_fixups(*args): """ get_fixups(out, ea, size) -> bool """ return _ida_fixup.get_fixups(*args)
def get_fixups(*args):
""" get_fixups(out, ea, size) -> bool """ return _ida_fixup.get_fixups(*args)
ig_destroy__ = _ida_fixup.delete_fixup_info_t __del__ = lambda self : None; fixup_info_t_swigregister = _ida_fixup.fixup_info_t_swigregister fixup_info_t_swigregister(fixup_info_t) def get_fixups(*args):
64
64
36
7
57
dodieboy/Np_class
REM/Tool/IDA 7.3/python/ida_fixup.py
Python
get_fixups
get_fixups
518
522
518
518
6f59e87d46c71fff5b57de6e2b9ddc0a2e60a8d7
bigcode/the-stack
train
c7caddc75946ad1c0255c5cd
train
class
class fixup_info_t(object): """ Proxy of C++ fixup_info_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr ea = _swig_property(_ida_fixup.fixup_info_t_ea_get, _ida_fixup.fixup_info_t_ea_set) fd = _swig_pro...
class fixup_info_t(object):
""" Proxy of C++ fixup_info_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr ea = _swig_property(_ida_fixup.fixup_info_t_ea_get, _ida_fixup.fixup_info_t_ea_set) fd = _swig_property(_ida_fixup.fixup_info_...
of a custom fixup handler. @param name: name of the custom fixup handler (C++: const char *) @return: id with FIXUP_CUSTOM bit set or 0 """ return _ida_fixup.find_custom_fixup(*args) class fixup_info_t(object):
64
64
209
7
57
dodieboy/Np_class
REM/Tool/IDA 7.3/python/ida_fixup.py
Python
fixup_info_t
fixup_info_t
497
513
497
497
97e1ecfd5677c7dfe61fcccad0676eb7aade6fab
bigcode/the-stack
train
ea8bfa69b17d91edde468124
train
function
def _swig_repr(self): try: strthis = "proxy of " + self.this.__repr__() except: strthis = "" return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
def _swig_repr(self):
try: strthis = "proxy of " + self.this.__repr__() except: strthis = "" return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
0) def _swig_getattr(self,class_type,name): if (name == "thisown"): return self.this.own() method = class_type.__swig_getmethods__.get(name,None) if method: return method(self) raise AttributeError(name) def _swig_repr(self):
64
64
59
7
57
dodieboy/Np_class
REM/Tool/IDA 7.3/python/ida_fixup.py
Python
_swig_repr
_swig_repr
63
66
63
63
4eddd4ed8741875cdf5c4f1eec34af6dd3075dcc
bigcode/the-stack
train
64b8f1bf80e68d7e008acbca
train
function
def get_fixup_handler(*args): """ get_fixup_handler(type) -> fixup_handler_t const * Get handler of standard or custom fixup. @param type (C++: fixup_type_t) """ return _ida_fixup.get_fixup_handler(*args)
def get_fixup_handler(*args):
""" get_fixup_handler(type) -> fixup_handler_t const * Get handler of standard or custom fixup. @param type (C++: fixup_type_t) """ return _ida_fixup.get_fixup_handler(*args)
Find previous address with fixup information @param ea: current address (C++: ea_t) @return: the previous address with fixup information, or BADADDR """ return _ida_fixup.get_prev_fixup_ea(*args) def get_fixup_handler(*args):
64
64
63
8
56
dodieboy/Np_class
REM/Tool/IDA 7.3/python/ida_fixup.py
Python
get_fixup_handler
get_fixup_handler
412
422
412
412
d30488fe8877ee46d7174f19dae66ca7bc9b3d23
bigcode/the-stack
train
035ff783891b30788f200a68
train
function
def _swig_setattr_nondynamic(self,class_type,name,value,static=1): if (name == "thisown"): return self.this.own(value) if (name == "this"): if type(value).__name__ == 'SwigPyObject': self.__dict__[name] = value return method = class_type.__swig_setmethods__.get(name,None) ...
def _swig_setattr_nondynamic(self,class_type,name,value,static=1):
if (name == "thisown"): return self.this.own(value) if (name == "this"): if type(value).__name__ == 'SwigPyObject': self.__dict__[name] = value return method = class_type.__swig_setmethods__.get(name,None) if method: return method(self,value) if (not static): ...
ig_import_helper else: import _ida_fixup del version_info try: _swig_property = property except NameError: pass # Python < 2.2 doesn't have 'property'. def _swig_setattr_nondynamic(self,class_type,name,value,static=1):
64
64
129
19
45
dodieboy/Np_class
REM/Tool/IDA 7.3/python/ida_fixup.py
Python
_swig_setattr_nondynamic
_swig_setattr_nondynamic
41
52
41
41
a2796cdcb7531ea3c2396b4348b7f4b3a0e76b7e
bigcode/the-stack
train
6fbb263338519f3fed7cbfd4
train
function
def del_fixup(*args): """ del_fixup(source) Delete fixup information. @param source (C++: ea_t) """ return _ida_fixup.del_fixup(*args)
def del_fixup(*args):
""" del_fixup(source) Delete fixup information. @param source (C++: ea_t) """ return _ida_fixup.del_fixup(*args)
source address, i.e. the address modified by the fixup (C++: ea_t) @param fd: fixup data (C++: const fixup_data_t &) """ return _ida_fixup.set_fixup(*args) def del_fixup(*args):
64
64
47
7
57
dodieboy/Np_class
REM/Tool/IDA 7.3/python/ida_fixup.py
Python
del_fixup
del_fixup
365
375
365
365
f3e79b4ec42b0e659291fcf73a0b428342e1b3de
bigcode/the-stack
train
0584f267b96f2dbcda723397
train
function
def set_fixup(*args): """ set_fixup(source, fd) Set fixup information. You should fill 'fixup_data_t' and call this function and the kernel will remember information in the database. @param source: the fixup source address, i.e. the address modified by the fixup (C++: ea_t) @param fd: ...
def set_fixup(*args):
""" set_fixup(source, fd) Set fixup information. You should fill 'fixup_data_t' and call this function and the kernel will remember information in the database. @param source: the fixup source address, i.e. the address modified by the fixup (C++: ea_t) @param fd: fixup data (C++: const...
) def exists_fixup(*args): """ exists_fixup(source) -> bool Check that a fixup exists at the given address. @param source (C++: ea_t) """ return _ida_fixup.exists_fixup(*args) def set_fixup(*args):
64
64
114
7
57
dodieboy/Np_class
REM/Tool/IDA 7.3/python/ida_fixup.py
Python
set_fixup
set_fixup
351
363
351
351
fa88ad3a67061f9a1f1d854adc1448d0cc2876bd
bigcode/the-stack
train
705c245ef51a23b5ab3acc23
train
function
@click.command() @click.option('--path', default='pwd', help='path to profile. Default is the current directory') @click.option('--savepath', default='profile_path', help='path to save profile results. Default is directory being profiled') def main(path,savepath=None,filename='folder_profile'): if path == 'pwd': ...
@click.command() @click.option('--path', default='pwd', help='path to profile. Default is the current directory') @click.option('--savepath', default='profile_path', help='path to save profile results. Default is directory being profiled') def main(path,savepath=None,filename='folder_profile'):
if path == 'pwd': path = os.getcwd() if savepath == 'profile_path': savepath = path assert os.path.exists(path), "profile path doesn't exist" assert os.path.exists(savepath), "savepath doesn't exist" # run profile print('Profiling {}...'.format(path)) profile = DriveProfile...
':int(dirsize/(2.**30))}) return pd.DataFrame(size_dict_list) @click.command() @click.option('--path', default='pwd', help='path to profile. Default is the current directory') @click.option('--savepath', default='profile_path', help='path to save profile results. Default is directory being profiled') def main(p...
83
83
277
63
20
dougollerenshaw/drive_profiler
profile_drive.py
Python
main
main
32
57
32
35
c62c382fecbc4b4a1e65b0f02e82c7403058aced
bigcode/the-stack
train
75572e386bfaaebb93f8d7c8
train
class
class DriveProfiler(object): def __init__(self,path_to_profile): self.top_level_path = path_to_profile t0 = time.time() self.summary = self.run_profile(self.top_level_path) self.time_to_profile = time.time()-t0 def run_profile(self,start_path = '.'): size_dict_list = [] ...
class DriveProfiler(object):
def __init__(self,path_to_profile): self.top_level_path = path_to_profile t0 = time.time() self.summary = self.run_profile(self.top_level_path) self.time_to_profile = time.time()-t0 def run_profile(self,start_path = '.'): size_dict_list = [] for dirpath, dirnames...
import os import pandas as pd import time import datetime import click class DriveProfiler(object):
22
68
227
5
16
dougollerenshaw/drive_profiler
profile_drive.py
Python
DriveProfiler
DriveProfiler
7
29
7
7
ebf40a3df2daee3f4e0c663db5e0249025d55da7
bigcode/the-stack
train
82635fb81645f10533ed453f
train
class
class APFSContainerFileEntry(file_entry.FileEntry): """File system file entry that uses pyfsapfs.""" TYPE_INDICATOR = definitions.TYPE_INDICATOR_APFS_CONTAINER def __init__( self, resolver_context, file_system, path_spec, is_root=False, is_virtual=False): """Initializes a file entry. Args: ...
class APFSContainerFileEntry(file_entry.FileEntry):
"""File system file entry that uses pyfsapfs.""" TYPE_INDICATOR = definitions.TYPE_INDICATOR_APFS_CONTAINER def __init__( self, resolver_context, file_system, path_spec, is_root=False, is_virtual=False): """Initializes a file entry. Args: resolver_context (Context): resolver context. ...
from dfvfs.path import apfs_container_path_spec from dfvfs.vfs import file_entry class APFSContainerDirectory(file_entry.Directory): """File system directory that uses pyfsapfs.""" def _EntriesGenerator(self): """Retrieves directory entries. Since a directory can contain a vast number of entries using ...
256
256
916
11
245
Acidburn0zzz/dfvfs
dfvfs/vfs/apfs_container_file_entry.py
Python
APFSContainerFileEntry
APFSContainerFileEntry
43
170
43
43
854ee91555d97999d795f08d0f988c7e673f277c
bigcode/the-stack
train
6c7d14350e2fa63d90a2dd69
train
class
class APFSContainerDirectory(file_entry.Directory): """File system directory that uses pyfsapfs.""" def _EntriesGenerator(self): """Retrieves directory entries. Since a directory can contain a vast number of entries using a generator is more memory efficient. Yields: APFSContainerPathSpec: ...
class APFSContainerDirectory(file_entry.Directory):
"""File system directory that uses pyfsapfs.""" def _EntriesGenerator(self): """Retrieves directory entries. Since a directory can contain a vast number of entries using a generator is more memory efficient. Yields: APFSContainerPathSpec: a path specification. """ # Only the virtual...
.""" from __future__ import unicode_literals from dfvfs.lib import apfs_helper from dfvfs.lib import definitions from dfvfs.lib import errors from dfvfs.path import apfs_container_path_spec from dfvfs.vfs import file_entry class APFSContainerDirectory(file_entry.Directory):
66
66
223
9
56
Acidburn0zzz/dfvfs
dfvfs/vfs/apfs_container_file_entry.py
Python
APFSContainerDirectory
APFSContainerDirectory
13
40
13
13
118503063f3a4e0fe57b18f20b34c26bf4f693f8
bigcode/the-stack
train
da72ea6d0768a54dd2d86a93
train
class
class AuthUtils: SECRET_KEY = "09d25e094faa6ca2556c818166b7a9563b93f7099f6f0f4caa6cf63b88e8d3e7" ALGORITHM = "HS256" ACCESS_TOKEN_EXPIRE_MINUTES = 30 pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto") oauth2_scheme = OAuth2PasswordBearer(tokenUrl="auth/token") @classmethod de...
class AuthUtils:
SECRET_KEY = "09d25e094faa6ca2556c818166b7a9563b93f7099f6f0f4caa6cf63b88e8d3e7" ALGORITHM = "HS256" ACCESS_TOKEN_EXPIRE_MINUTES = 30 pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto") oauth2_scheme = OAuth2PasswordBearer(tokenUrl="auth/token") @classmethod def _verify_passwor...
from fastapi import Depends, HTTPException, status from fastapi.security import OAuth2PasswordBearer from typing import Optional from jose import JWTError, jwt from passlib.context import CryptContext from datetime import datetime, timedelta from schemas.auth import UserInDB, User, TokenData from schemas.errors import ...
84
162
541
4
79
imgVOID/autograding-api
utilities/auth_scripts.py
Python
AuthUtils
AuthUtils
12
73
12
12
2f5c22c0fece9d53fd887b8ded123ddf8abfbd4b
bigcode/the-stack
train
d5000359413634e1bcab56f1
train
function
async def get_current_active_user(current_user: User = Depends(AuthUtils.get_current_user)): if not current_user.is_active: raise HTTPException(status_code=400, detail=InactiveUser().error) return current_user
async def get_current_active_user(current_user: User = Depends(AuthUtils.get_current_user)):
if not current_user.is_active: raise HTTPException(status_code=400, detail=InactiveUser().error) return current_user
user = await cls._get_user(email) if not user: return False if not cls._verify_password(password, user.hashed_password): return False return user # FastAPI Dependency async def get_current_active_user(current_user: User = Depends(AuthUtils.get_current_user)):
64
64
47
18
45
imgVOID/autograding-api
utilities/auth_scripts.py
Python
get_current_active_user
get_current_active_user
77
80
77
77
07f9524e7b0e6784e4a31a2e03d044a616209cc7
bigcode/the-stack
train
b4e8f5f4ef0ef672973e82c0
train
function
def metric_accessors(): cars = h2o.import_file(path=pyunit_utils.locate("smalldata/junit/cars_20mpg.csv")) r = cars[0].runif() train = cars[r > .2] valid = cars[r <= .2] # regression response_col = "economy" distribution = "gaussian" predictors = ["displacement","power","weight","accel...
def metric_accessors():
cars = h2o.import_file(path=pyunit_utils.locate("smalldata/junit/cars_20mpg.csv")) r = cars[0].runif() train = cars[r > .2] valid = cars[r <= .2] # regression response_col = "economy" distribution = "gaussian" predictors = ["displacement","power","weight","acceleration","year"] gbm...
import sys sys.path.insert(1,"../../") import h2o from tests import pyunit_utils from h2o.estimators.gbm import H2OGradientBoostingEstimator def metric_accessors():
46
256
11,371
5
40
gkirok/h2o-3
h2o-py/tests/testdir_misc/pyunit_metric_accessors.py
Python
metric_accessors
metric_accessors
9
591
9
10
31c1436fba2f70c696f698b0ad8f73b26d78403f
bigcode/the-stack
train
5511150d27acdbb05cd80560
train
class
class UnknownPotcarWarning(UserWarning): """ Warning raised when POTCAR hashes do not pass validation """ pass
class UnknownPotcarWarning(UserWarning):
""" Warning raised when POTCAR hashes do not pass validation """ pass
tuple("Orbital", ["n", "l", "j", "E", "occ"]) OrbitalDescription = namedtuple( "OrbitalDescription", ["l", "E", "Type", "Rcut", "Type2", "Rcut2"] ) class UnknownPotcarWarning(UserWarning):
64
64
27
8
56
stevetorr/pymatgen
pymatgen/io/vasp/inputs.py
Python
UnknownPotcarWarning
UnknownPotcarWarning
1,648
1,653
1,648
1,648
638cc3449c958b665fb3e7d7e829c78a1e794d72
bigcode/the-stack
train
696eaa849ecc02fad7301ea9
train
class
class Kpoints_supported_modes(Enum): """ Enum type of all supported modes for Kpoint generation. """ Automatic = 0 Gamma = 1 Monkhorst = 2 Line_mode = 3 Cartesian = 4 Reciprocal = 5 def __str__(self): return self.name @staticmethod def from_string(s: str) -> "K...
class Kpoints_supported_modes(Enum):
""" Enum type of all supported modes for Kpoint generation. """ Automatic = 0 Gamma = 1 Monkhorst = 2 Line_mode = 3 Cartesian = 4 Reciprocal = 5 def __str__(self): return self.name @staticmethod def from_string(s: str) -> "Kpoints_supported_modes": """ ...
name__ == "list": if self[k] not in incar_params[k]: warnings.warn( "%s: Cannot find %s in the list of parameters" % (k, self[k]), BadIncarWarning, stacklevel=2, ...
64
64
163
7
57
stevetorr/pymatgen
pymatgen/io/vasp/inputs.py
Python
Kpoints_supported_modes
Kpoints_supported_modes
1,028
1,053
1,028
1,028
74f1a0985a37d16e4a2be1702eed64445203c350
bigcode/the-stack
train
8c8ff780df4ef01cf4ce7a5a
train
class
class VaspInput(dict, MSONable): """ Class to contain a set of vasp input objects corresponding to a run. """ def __init__(self, incar, kpoints, poscar, potcar, optional_files=None, **kwargs): """ Args: incar: Incar object. kpoints: Kpoints object. po...
class VaspInput(dict, MSONable):
""" Class to contain a set of vasp input objects corresponding to a run. """ def __init__(self, incar, kpoints, poscar, potcar, optional_files=None, **kwargs): """ Args: incar: Incar object. kpoints: Kpoints object. poscar: Poscar object. ...
()} for p in self] def set_symbols(self, symbols, functional=None, sym_potcar_map=None): """ Initialize the POTCAR from a set of symbols. Currently, the POTCARs can be fetched from a location specified in .pmgrc.yaml. Use pmg config to add this setting. Args: sy...
256
256
1,152
10
246
stevetorr/pymatgen
pymatgen/io/vasp/inputs.py
Python
VaspInput
VaspInput
2,322
2,456
2,322
2,322
90028bb38d8cbfa3303586d49f0031b3ed76b5f6
bigcode/the-stack
train
6c9820f4be627495242e6286
train
class
class PotcarSingle: """ Object for a **single** POTCAR. The builder assumes the POTCAR contains the complete untouched data in "data" as a string and a dict of keywords. .. attribute:: data POTCAR data as a string. .. attribute:: keywords Keywords parsed from the POTCAR as a dict...
class PotcarSingle:
""" Object for a **single** POTCAR. The builder assumes the POTCAR contains the complete untouched data in "data" as a string and a dict of keywords. .. attribute:: data POTCAR data as a string. .. attribute:: keywords Keywords parsed from the POTCAR as a dict. All keywords are a...
): m = re.match(r"^\.?([TFtf])[A-Za-z]*\.?", s) if m: if m.group(1) == "T" or m.group(1) == "t": return True else: return False raise ValueError(s + " should be a boolean type!") def _parse_float(s): return float(re.search(r"^-?\d*\.?\d*[eE]?-?\d*", s).group(0))...
256
256
4,844
5
250
stevetorr/pymatgen
pymatgen/io/vasp/inputs.py
Python
PotcarSingle
PotcarSingle
1,656
2,179
1,656
1,656
6d6772e1d47422b7d87b93f68959f99f0e07e284
bigcode/the-stack
train
f6bceaab00a05135eb2bc249
train
class
class Incar(dict, MSONable): """ INCAR object for reading and writing INCAR files. Essentially consists of a dictionary with some helper functions """ def __init__(self, params=None): """ Creates an Incar object. Args: params (dict): A set of input parameters as...
class Incar(dict, MSONable):
""" INCAR object for reading and writing INCAR files. Essentially consists of a dictionary with some helper functions """ def __init__(self, params=None): """ Creates an Incar object. Args: params (dict): A set of input parameters as a dictionary. """ ...
] * velocities, axis=0 ) / np.average(atomic_masses) # scale velocities to get correct temperature energy = np.sum(1 / 2 * atomic_masses * np.sum(velocities ** 2, axis=1)) scale = (temperature * dof / (2 * energy / const.k)) ** (1 / 2) velocities *= scale * 1e-5 # these are in...
256
256
2,739
9
246
stevetorr/pymatgen
pymatgen/io/vasp/inputs.py
Python
Incar
Incar
659
1,025
659
659
f924784bf7382bc7ee61c7bf40c839ed3605614b
bigcode/the-stack
train
8d6d51b87115300342e0eb6e
train
class
class BadIncarWarning(UserWarning): """ Warning class for bad Incar parameters. """ pass
class BadIncarWarning(UserWarning):
""" Warning class for bad Incar parameters. """ pass
izations self.structure.add_site_property("velocities", velocities.tolist()) cwd = os.path.abspath(os.path.dirname(__file__)) with open(os.path.join(cwd, "incar_parameters.json")) as incar_params: incar_params = json.loads(incar_params.read()) class BadIncarWarning(UserWarning):
64
64
24
8
56
stevetorr/pymatgen
pymatgen/io/vasp/inputs.py
Python
BadIncarWarning
BadIncarWarning
651
656
651
651
ecfe59e660279cadee2efe735d628a3230b72e91
bigcode/the-stack
train
af4f7b44671b994c90ec1f0c
train
class
class Kpoints(MSONable): """ KPOINT reader/writer. """ supported_modes = Kpoints_supported_modes def __init__( self, comment="Default gamma", num_kpts=0, style=supported_modes.Gamma, kpts=((1, 1, 1),), kpts_shift=(0, 0, 0), kpts_weights=None,...
class Kpoints(MSONable):
""" KPOINT reader/writer. """ supported_modes = Kpoints_supported_modes def __init__( self, comment="Default gamma", num_kpts=0, style=supported_modes.Gamma, kpts=((1, 1, 1),), kpts_shift=(0, 0, 0), kpts_weights=None, coord_type=None,...
list of possible parameters, check # if the user given parameter is in this list elif type(incar_params[k]).__name__ == "list": if self[k] not in incar_params[k]: warnings.warn( "%s: Cannot find %s in the list of pa...
256
256
4,499
7
249
stevetorr/pymatgen
pymatgen/io/vasp/inputs.py
Python
Kpoints
Kpoints
1,056
1,613
1,056
1,056
8f2fe483d43056db01252c18a1d66a6368dc220f
bigcode/the-stack
train
dd88349bfef19e45c3928836
train
function
def _parse_string(s): return "{}".format(s.strip())
def _parse_string(s):
return "{}".format(s.strip())
=d.get("kpts_weights"), coord_type=d.get("coord_type"), labels=d.get("labels"), tet_number=d.get("tet_number", 0), tet_weight=d.get("tet_weight", 0), tet_connections=d.get("tet_connections"), ) def _parse_string(s):
64
64
14
6
58
stevetorr/pymatgen
pymatgen/io/vasp/inputs.py
Python
_parse_string
_parse_string
1,616
1,617
1,616
1,616
0c808d352888a0751def93669e6ef52e0eb4b25a
bigcode/the-stack
train
14d0704bbd8a2cd844b8c0dc
train
function
def _parse_bool(s): m = re.match(r"^\.?([TFtf])[A-Za-z]*\.?", s) if m: if m.group(1) == "T" or m.group(1) == "t": return True else: return False raise ValueError(s + " should be a boolean type!")
def _parse_bool(s):
m = re.match(r"^\.?([TFtf])[A-Za-z]*\.?", s) if m: if m.group(1) == "T" or m.group(1) == "t": return True else: return False raise ValueError(s + " should be a boolean type!")
_type"), labels=d.get("labels"), tet_number=d.get("tet_number", 0), tet_weight=d.get("tet_weight", 0), tet_connections=d.get("tet_connections"), ) def _parse_string(s): return "{}".format(s.strip()) def _parse_bool(s):
64
64
77
6
58
stevetorr/pymatgen
pymatgen/io/vasp/inputs.py
Python
_parse_bool
_parse_bool
1,620
1,627
1,620
1,620
52f31200130a86c6d1f2b7a501db823b7b317cc5
bigcode/the-stack
train
af8800693fb2167526edf6a7
train
class
class Potcar(list, MSONable): """ Object for reading and writing POTCAR files for calculations. Consists of a list of PotcarSingle. """ FUNCTIONAL_CHOICES = list(PotcarSingle.functional_dir.keys()) def __init__(self, symbols=None, functional=None, sym_potcar_map=None): """ Args...
class Potcar(list, MSONable):
""" Object for reading and writing POTCAR files for calculations. Consists of a list of PotcarSingle. """ FUNCTIONAL_CHOICES = list(PotcarSingle.functional_dir.keys()) def __init__(self, symbols=None, functional=None, sym_potcar_map=None): """ Args: symbols ([str]):...
(tuple, list)): for item in v: if isinstance(item, float): hash_str += "{:.3f}".format(item) elif isinstance(item, (Orbital, OrbitalDescription)): for item_v in item: if isinstance(item_v...
256
256
1,100
9
247
stevetorr/pymatgen
pymatgen/io/vasp/inputs.py
Python
Potcar
Potcar
2,182
2,319
2,182
2,182
14016a699c92f858856b41074a8cf3389a401064
bigcode/the-stack
train
a8a7a92236540fa0acb6072c
train
function
def _parse_int(s): return int(re.match(r"^-?[0-9]+", s).group(0))
def _parse_int(s):
return int(re.match(r"^-?[0-9]+", s).group(0))
return True else: return False raise ValueError(s + " should be a boolean type!") def _parse_float(s): return float(re.search(r"^-?\d*\.?\d*[eE]?-?\d*", s).group(0)) def _parse_int(s):
64
64
26
6
58
stevetorr/pymatgen
pymatgen/io/vasp/inputs.py
Python
_parse_int
_parse_int
1,634
1,635
1,634
1,634
3b2f174ff131d78851efe60c8df48b966dd2cfcd
bigcode/the-stack
train
b97ba002305ce14f7fe18447
train
class
class Poscar(MSONable): """ Object for representing the data in a POSCAR or CONTCAR file. Please note that this current implementation. Most attributes can be set directly. .. attribute:: structure Associated Structure. .. attribute:: comment Optional comment string. .. ...
class Poscar(MSONable):
""" Object for representing the data in a POSCAR or CONTCAR file. Please note that this current implementation. Most attributes can be set directly. .. attribute:: structure Associated Structure. .. attribute:: comment Optional comment string. .. attribute:: true_names ...
math import json import glob import subprocess import numpy as np from numpy.linalg import det from collections import OrderedDict, namedtuple from hashlib import md5 from monty.io import zopen from monty.os.path import zpath from monty.json import MontyDecoder from monty.os import cd from monty.serialization impor...
256
256
5,116
7
249
stevetorr/pymatgen
pymatgen/io/vasp/inputs.py
Python
Poscar
Poscar
53
643
53
53
3f5c821b08ce382011093cf2c349cd4fb2f1e8a3
bigcode/the-stack
train
0ffabd57b09cbecf76714808
train
function
def _parse_list(s): return [float(y) for y in re.split(r"\s+", s.strip()) if not y.isalpha()]
def _parse_list(s):
return [float(y) for y in re.split(r"\s+", s.strip()) if not y.isalpha()]
parse_float(s): return float(re.search(r"^-?\d*\.?\d*[eE]?-?\d*", s).group(0)) def _parse_int(s): return int(re.match(r"^-?[0-9]+", s).group(0)) def _parse_list(s):
64
64
30
6
58
stevetorr/pymatgen
pymatgen/io/vasp/inputs.py
Python
_parse_list
_parse_list
1,638
1,639
1,638
1,638
da9cb4ce183d2fd0f9341380e464fa43f30f892d
bigcode/the-stack
train
c2a3993b19b7ac197c60bbd7
train
function
def _parse_float(s): return float(re.search(r"^-?\d*\.?\d*[eE]?-?\d*", s).group(0))
def _parse_float(s):
return float(re.search(r"^-?\d*\.?\d*[eE]?-?\d*", s).group(0))
A-Za-z]*\.?", s) if m: if m.group(1) == "T" or m.group(1) == "t": return True else: return False raise ValueError(s + " should be a boolean type!") def _parse_float(s):
63
64
34
6
57
stevetorr/pymatgen
pymatgen/io/vasp/inputs.py
Python
_parse_float
_parse_float
1,630
1,631
1,630
1,630
04c9348054dbcf6c0ac635d8d51fc6986f3e796b
bigcode/the-stack
train
3b2742b7118ebb4f37652a3d
train
class
class MotionDetector(SparseSceneDetector): """Detects motion events in scenes containing a static background. Uses background subtraction followed by noise removal (via morphological opening) to generate a frame score compared against the set threshold. Attributes: threshold: floating point v...
class MotionDetector(SparseSceneDetector):
"""Detects motion events in scenes containing a static background. Uses background subtraction followed by noise removal (via morphological opening) to generate a frame score compared against the set threshold. Attributes: threshold: floating point value compared to each frame's score, which ...
] # [ Docs: http://manual.scenedetect.scenedetect.com/ ] # [ Github: https://github.com/Breakthrough/PySceneDetect/ ] # # Copyright (C) 2014-2022 Brandon Castellano <http://www.bcastell.com>. # PySceneDetect is licensed under the BSD 3-Clause License; see the # included LICENSE file, or visit...
196
196
654
8
187
camjac251/PySceneDetect
scenedetect/detectors/motion_detector.py
Python
MotionDetector
MotionDetector
28
97
28
28
018d37a5c0e781817ddbe53d73354d0499a3a7c5
bigcode/the-stack
train
e9be8533ebb55b9006a81b70
train
function
def create_report(cov_executable): """ Create a report in HTML format into 'coverage/index.html' """ print( subprocess.run( [ "llvm-cov", "show", cov_executable, "--instr-profile=default.profdata", "--format=html...
def create_report(cov_executable):
""" Create a report in HTML format into 'coverage/index.html' """ print( subprocess.run( [ "llvm-cov", "show", cov_executable, "--instr-profile=default.profdata", "--format=html", "-o", ...
, ) ) def show_summary(cov_executable): """ Displays the main report from llvm-cov """ print( subprocess.run( ["llvm-cov", "report", "--instr-profile=default.profdata", cov_executable] ) ) def create_report(cov_executable):
64
64
76
8
56
gitmachtl/ledger-app-cardano-shelley
fuzz/coverage.py
Python
create_report
create_report
45
59
45
45
5898def03a4b490c2981bf7be490b593d32047e3
bigcode/the-stack
train
18f16f12b0d9e6963a29f1ca
train
function
def extract_profiles(corpus_path, cov_executable): """ Run corpus through coverage executable. This function avoids a limitation on filename length on Windows """ # group by packs of N for faster execution # N has to be low enough that Windows does not # complain about too long filenames. 512 seem...
def extract_profiles(corpus_path, cov_executable):
""" Run corpus through coverage executable. This function avoids a limitation on filename length on Windows """ # group by packs of N for faster execution # N has to be low enough that Windows does not # complain about too long filenames. 512 seems fine. file_list = glob(os.path.join(corpus_pa...
import os import platform import subprocess from glob import glob def extract_profiles(corpus_path, cov_executable):
25
64
128
11
13
gitmachtl/ledger-app-cardano-shelley
fuzz/coverage.py
Python
extract_profiles
extract_profiles
7
16
7
7
e4425705ac51f829c4c976735a9648293224bf54
bigcode/the-stack
train
2e266e78ab3efb4e82dd095e
train
function
def show_summary(cov_executable): """ Displays the main report from llvm-cov """ print( subprocess.run( ["llvm-cov", "report", "--instr-profile=default.profdata", cov_executable] ) )
def show_summary(cov_executable):
""" Displays the main report from llvm-cov """ print( subprocess.run( ["llvm-cov", "report", "--instr-profile=default.profdata", cov_executable] ) )
(): """ Merge profiling data """ print( subprocess.run( [ "llvm-profdata", "merge", "-sparse", "*.profraw", "-o", "default.profdata", ], check=True, ) ) def sho...
64
64
51
8
56
gitmachtl/ledger-app-cardano-shelley
fuzz/coverage.py
Python
show_summary
show_summary
36
42
36
36
6ecfa119f5477d8543105b3dcc5357d8ccc1166f
bigcode/the-stack
train
858c4442f4300edd6df03132
train
function
def merge_profile_data(): """ Merge profiling data """ print( subprocess.run( [ "llvm-profdata", "merge", "-sparse", "*.profraw", "-o", "default.profdata", ], check=True, ...
def merge_profile_data():
""" Merge profiling data """ print( subprocess.run( [ "llvm-profdata", "merge", "-sparse", "*.profraw", "-o", "default.profdata", ], check=True, ) )
file_list = glob(os.path.join(corpus_path, "*")) N = 512 for p in range(0, len(file_list), N): subprocess.run([cov_executable, "-close_fd_mask=1", *file_list[p : p + N]]) def merge_profile_data():
63
64
60
5
58
gitmachtl/ledger-app-cardano-shelley
fuzz/coverage.py
Python
merge_profile_data
merge_profile_data
19
33
19
19
cd9e965b6ff99542902c7e8c9071d00620db573f
bigcode/the-stack
train
f925f7075b05a818452eb7de
train
class
class MainPipelineGUI(HasTraits): # Data-preprocessor settings run_data_preprocessor = Bool(default_value=False) run_visual_setup_simultaneously = Bool(default_value=False) data_input_dir = Directory() quiet = Bool(default_value=True) parallel = Bool(default_value=False) batch_size = Int(de...
class MainPipelineGUI(HasTraits): # Data-preprocessor settings
run_data_preprocessor = Bool(default_value=False) run_visual_setup_simultaneously = Bool(default_value=False) data_input_dir = Directory() quiet = Bool(default_value=True) parallel = Bool(default_value=False) batch_size = Int(default_value=300) # Visualization settings run_visual_setup ...
########################################################################### # Imports ########################################################################### # Standard library imports from traits.api import ( HasTraits, Int, Bool, Directory ) from traitsui.api import ( Group, View, Item, OKButton, CancelBu...
80
256
932
15
65
Prajwal-Prathiksh/plasma-dynamics-visualization
gui.py
Python
MainPipelineGUI
MainPipelineGUI
20
132
20
22
3cb2167dc24c49ab1ec91ffde8d9cf0c26e61d25
bigcode/the-stack
train
5aceefe01a663e0cd26a4bbd
train
class
class DrQA(nn.Module): """Network for the Document Reader module of DrQA.""" _RNN_TYPES = {'lstm': nn.LSTM, 'gru': nn.GRU, 'rnn': nn.RNN} def __init__(self, config, w_embedding): """Configuration, word embeddings""" super(DrQA, self).__init__() # Store config self.config = c...
class DrQA(nn.Module):
"""Network for the Document Reader module of DrQA.""" _RNN_TYPES = {'lstm': nn.LSTM, 'gru': nn.GRU, 'rnn': nn.RNN} def __init__(self, config, w_embedding): """Configuration, word embeddings""" super(DrQA, self).__init__() # Store config self.config = config self.w_em...
import torch import torch.nn as nn import torch.nn.functional as F from layers import SeqAttnMatch, StackedBRNN, LinearSeqAttn, BilinearSeqAttn from layers import weighted_avg, uniform_weights, dropout class DrQA(nn.Module):
57
256
1,540
6
50
wang-yuhao/chatbot
notebooks/drqa.py
Python
DrQA
DrQA
8
157
8
8
a7a06e126a36f6711b57d49573b1ad0e6c52f56e
bigcode/the-stack
train
3d63ff6e656ecc1fc0302acd
train
class
class StreamNonTTY(StringIO): def isatty(self): return False
class StreamNonTTY(StringIO):
def isatty(self): return False
Hartley 2013. BSD 3-Clause license, see LICENSE file. from contextlib import contextmanager from io import StringIO import sys import os from mock import Mock class StreamTTY(StringIO): def isatty(self): return True class StreamNonTTY(StringIO):
64
64
18
7
56
uilianries/ezored
ezored/colorama/tests/utils.py
Python
StreamNonTTY
StreamNonTTY
13
15
13
13
c4f2df016109bad14ac0468c161a609df3664134
bigcode/the-stack
train
7f0d6de638a3182b26696a0b
train
function
@contextmanager def pycharm(): os.environ["PYCHARM_HOSTED"] = "1" non_tty = StreamNonTTY() with replace_by(non_tty), replace_original_by(non_tty): yield del os.environ["PYCHARM_HOSTED"]
@contextmanager def pycharm():
os.environ["PYCHARM_HOSTED"] = "1" non_tty = StreamNonTTY() with replace_by(non_tty), replace_original_by(non_tty): yield del os.environ["PYCHARM_HOSTED"]
orig_stdout = sys.__stdout__ orig_stderr = sys.__stderr__ sys.__stdout__ = stream sys.__stderr__ = stream yield sys.__stdout__ = orig_stdout sys.__stderr__ = orig_stderr @contextmanager def pycharm():
64
64
61
9
54
uilianries/ezored
ezored/colorama/tests/utils.py
Python
pycharm
pycharm
52
58
52
53
31938e70aa822280d7eef98daa53fcf58d3df1f0
bigcode/the-stack
train
2a5561d4d39897335b783b43
train
function
@contextmanager def replace_by(stream): orig_stdout = sys.stdout orig_stderr = sys.stderr sys.stdout = stream sys.stderr = stream yield sys.stdout = orig_stdout sys.stderr = orig_stderr
@contextmanager def replace_by(stream):
orig_stdout = sys.stdout orig_stderr = sys.stderr sys.stdout = stream sys.stderr = stream yield sys.stdout = orig_stdout sys.stderr = orig_stderr
os.name = name yield os.name = orig @contextmanager def redirected_output(): orig = sys.stdout sys.stdout = Mock() sys.stdout.isatty = lambda: False yield sys.stdout = orig @contextmanager def replace_by(stream):
64
64
54
9
54
uilianries/ezored
ezored/colorama/tests/utils.py
Python
replace_by
replace_by
32
40
32
33
601102daafdfd952e22be432f686bd350cc4a549
bigcode/the-stack
train
6360498a1fac370b79a3c875
train
function
@contextmanager def replace_original_by(stream): orig_stdout = sys.__stdout__ orig_stderr = sys.__stderr__ sys.__stdout__ = stream sys.__stderr__ = stream yield sys.__stdout__ = orig_stdout sys.__stderr__ = orig_stderr
@contextmanager def replace_original_by(stream):
orig_stdout = sys.__stdout__ orig_stderr = sys.__stderr__ sys.__stdout__ = stream sys.__stderr__ = stream yield sys.__stdout__ = orig_stdout sys.__stderr__ = orig_stderr
@contextmanager def replace_by(stream): orig_stdout = sys.stdout orig_stderr = sys.stderr sys.stdout = stream sys.stderr = stream yield sys.stdout = orig_stdout sys.stderr = orig_stderr @contextmanager def replace_original_by(stream):
64
64
65
10
53
uilianries/ezored
ezored/colorama/tests/utils.py
Python
replace_original_by
replace_original_by
42
50
42
43
56457f3c5b2a267658b4a5f55386632fb69eff9b
bigcode/the-stack
train
0f197f3be2944673b5573cc4
train
function
@contextmanager def redirected_output(): orig = sys.stdout sys.stdout = Mock() sys.stdout.isatty = lambda: False yield sys.stdout = orig
@contextmanager def redirected_output():
orig = sys.stdout sys.stdout = Mock() sys.stdout.isatty = lambda: False yield sys.stdout = orig
atty(self): return True class StreamNonTTY(StringIO): def isatty(self): return False @contextmanager def osname(name): orig = os.name os.name = name yield os.name = orig @contextmanager def redirected_output():
64
64
40
8
55
uilianries/ezored
ezored/colorama/tests/utils.py
Python
redirected_output
redirected_output
24
30
24
25
22ecd15827e75e59dd1b239cb9b374620d15b72a
bigcode/the-stack
train
17e884ff2401f805b92d8645
train
class
class StreamTTY(StringIO): def isatty(self): return True
class StreamTTY(StringIO):
def isatty(self): return True
# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file. from contextlib import contextmanager from io import StringIO import sys import os from mock import Mock class StreamTTY(StringIO):
49
64
17
6
42
uilianries/ezored
ezored/colorama/tests/utils.py
Python
StreamTTY
StreamTTY
9
11
9
9
a2cdf2a6828896a50c8f7ddb67e4f099d972f008
bigcode/the-stack
train
e9c8d4683cf47111155f18d1
train
function
@contextmanager def osname(name): orig = os.name os.name = name yield os.name = orig
@contextmanager def osname(name):
orig = os.name os.name = name yield os.name = orig
contextmanager from io import StringIO import sys import os from mock import Mock class StreamTTY(StringIO): def isatty(self): return True class StreamNonTTY(StringIO): def isatty(self): return False @contextmanager def osname(name):
64
64
30
9
54
uilianries/ezored
ezored/colorama/tests/utils.py
Python
osname
osname
17
22
17
18
a54a3bb9fa5691bb89e1a9220ef5f05d20dea10a
bigcode/the-stack
train
29da797d5fa0219998397264
train
class
class Migration(migrations.Migration): dependencies = [ ('signup', '0003_auto_20180508_1404'), ] operations = [ migrations.AddField( model_name='listexpenditure', name='number', field=models.FloatField(blank=True, default=0), ), ]
class Migration(migrations.Migration):
dependencies = [ ('signup', '0003_auto_20180508_1404'), ] operations = [ migrations.AddField( model_name='listexpenditure', name='number', field=models.FloatField(blank=True, default=0), ), ]
# -*- coding: utf-8 -*- # Generated by Django 1.11.12 on 2018-05-09 11:36 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration):
54
64
67
7
46
tongpa/blueeyes
signup/migrations/0004_listexpenditure_number.py
Python
Migration
Migration
8
20
8
9
5ce71b126c47a9a8fb58c35237fa5a350db1de2d
bigcode/the-stack
train
20c1678d5691eeef1fdde37d
train
class
class BordercolorValidator(_plotly_utils.basevalidators.ColorValidator): def __init__( self, plotly_name="bordercolor", parent_name="scatterpolargl.hoverlabel", **kwargs ): super(BordercolorValidator, self).__init__( plotly_name=plotly_name, parent...
class BordercolorValidator(_plotly_utils.basevalidators.ColorValidator):
def __init__( self, plotly_name="bordercolor", parent_name="scatterpolargl.hoverlabel", **kwargs ): super(BordercolorValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, array_ok=kwargs.pop("array_ok", True), ...
import _plotly_utils.basevalidators class BordercolorValidator(_plotly_utils.basevalidators.ColorValidator):
21
64
103
13
7
andresgreen-byte/Laboratorio-1--Inversion-de-Capital
env/Lib/site-packages/plotly/validators/scatterpolargl/hoverlabel/_bordercolor.py
Python
BordercolorValidator
BordercolorValidator
4
17
4
4
8ddfb64cdb3e95d845f7065b76736197615383cd
bigcode/the-stack
train
917e041b9b4bbcf5ff771bb2
train
class
class Harvester: def __init__(self): self.vd18_file = VD18_IDS_FILE self.wtbs = WAIT_TIME_BETWEEN_SUBMITS if not os.path.exists(self.vd18_file) or not os.path.isfile(self.vd18_file): print(f"{self.vd18_file} file does not exist or is not a readable file!") exit(1) ...
class Harvester:
def __init__(self): self.vd18_file = VD18_IDS_FILE self.wtbs = WAIT_TIME_BETWEEN_SUBMITS if not os.path.exists(self.vd18_file) or not os.path.isfile(self.vd18_file): print(f"{self.vd18_file} file does not exist or is not a readable file!") exit(1) @staticmethod ...
import os import time import requests from constants import ( VD18_IDS_FILE, VD18_URL, VD18_METS_EXT, WAIT_TIME_BETWEEN_SUBMITS, POST_METHOD_TO_OPERANDI, POST_METHOD_ID_PARAMETER, POST_METHOD_URL_PARAMETER, ) class Harvester:
66
229
764
4
62
MehmedGIT/OPERANDI_TestRepo
src/harvester/harvester.py
Python
Harvester
Harvester
16
106
16
16
df27638c9f4f7121177245dd4dfdde28b4a383f3
bigcode/the-stack
train
4ace7dc153177a629672182c
train
function
def main(): harvester = Harvester() harvester.start_harvesting(limit=1)
def main():
harvester = Harvester() harvester.start_harvesting(limit=1)
If the limit is reached stop harvesting if harvested_counter == limit: break self.__print_waiting_message() # TODO: implement proper start and stop mechanisms def stop_harvesting(self): print(f"{self}") print(f"INFO: Stopped harvesting") def ...
64
64
21
3
61
MehmedGIT/OPERANDI_TestRepo
src/harvester/harvester.py
Python
main
main
109
111
109
109
4735101e53c422b4b9c0eb6118a6959c894b14d1
bigcode/the-stack
train
9194b700e3d991f4c7bc6e87
train
class
class FileShare(pulumi.CustomResource): @overload def __init__(__self__, resource_name: str, opts: Optional[pulumi.ResourceOptions] = None, access_tier: Optional[pulumi.Input[Union[str, 'ShareAccessTier']]] = None, account_name: Optional[pulumi...
class FileShare(pulumi.CustomResource): @overload
def __init__(__self__, resource_name: str, opts: Optional[pulumi.ResourceOptions] = None, access_tier: Optional[pulumi.Input[Union[str, 'ShareAccessTier']]] = None, account_name: Optional[pulumi.Input[str]] = None, enabled_protocol...
-> Optional[pulumi.Input[str]]: """ The name of the file share within the specified storage account. File share names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or nu...
256
256
3,156
14
242
sebtelko/pulumi-azure-native
sdk/python/pulumi_azure_native/storage/file_share.py
Python
FileShare
FileShare
164
443
164
165
d09e8842c80e8bb164507c46f4eba361215fa156
bigcode/the-stack
train
f7a702e57b96cfceacc75436
train
class
@pulumi.input_type class FileShareArgs: def __init__(__self__, *, account_name: pulumi.Input[str], resource_group_name: pulumi.Input[str], access_tier: Optional[pulumi.Input[Union[str, 'ShareAccessTier']]] = None, enabled_protocols: Optional[pulumi...
@pulumi.input_type class FileShareArgs:
def __init__(__self__, *, account_name: pulumi.Input[str], resource_group_name: pulumi.Input[str], access_tier: Optional[pulumi.Input[Union[str, 'ShareAccessTier']]] = None, enabled_protocols: Optional[pulumi.Input[Union[str, 'EnabledProtocols']]] ...
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi SDK Generator. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union, overload from .. import _utilities from...
105
256
1,773
11
94
sebtelko/pulumi-azure-native
sdk/python/pulumi_azure_native/storage/file_share.py
Python
FileShareArgs
FileShareArgs
14
161
14
15
65d8d6220978e9e0038aa4bb24aca37dae82b899
bigcode/the-stack
train
f3c451c9570d00142bbd1801
train
function
def read_only_mode(env): env['READ_ONLY'] = True # Replace the default (master) db with a slave connection. if not env.get('REPLICA_DATABASES'): raise Exception('We need at least one slave database.') slave = env['REPLICA_DATABASES'][0] env['DATABASES']['default'] = env['DATABASES'][slave] ...
def read_only_mode(env):
env['READ_ONLY'] = True # Replace the default (master) db with a slave connection. if not env.get('REPLICA_DATABASES'): raise Exception('We need at least one slave database.') slave = env['REPLICA_DATABASES'][0] env['DATABASES']['default'] = env['DATABASES'][slave] # No sessions withou...
=93710 ENGAGE_ROBOTS = True # Read-only mode setup. READ_ONLY = env.bool('READ_ONLY', default=False) # Turn on read-only mode in local_settings.py by putting this line # at the VERY BOTTOM: read_only_mode(globals()) def read_only_mode(env):
64
64
116
6
58
elyse0/addons-server
src/olympia/lib/settings_base.py
Python
read_only_mode
read_only_mode
1,360
1,370
1,360
1,360
5a358540365c4d052515c08c76a5066ae5b5a2e5
bigcode/the-stack
train
98ca67930ae474bb416814b5
train
function
def get_sentry_release(): version_json = os.path.join(ROOT, 'version.json') version = None if os.path.exists(version_json): try: with open(version_json, 'r') as fobj: contents = fobj.read() data = json.loads(contents) version = data.get('v...
def get_sentry_release():
version_json = os.path.join(ROOT, 'version.json') version = None if os.path.exists(version_json): try: with open(version_json, 'r') as fobj: contents = fobj.read() data = json.loads(contents) version = data.get('version') or data.get('comm...
.1.15 # We can't use the default because we don't use django timezone support. 'DATETIME_FORMAT': '%Y-%m-%dT%H:%M:%SZ', # Set our default ordering parameter 'ORDERING_PARAM': 'sort', } def get_sentry_release():
64
64
213
6
58
elyse0/addons-server
src/olympia/lib/settings_base.py
Python
get_sentry_release
get_sentry_release
1,675
1,703
1,675
1,675
146c99b243c5d3362c471acae8d944f7184a8eb2
bigcode/the-stack
train
92f2f2d748af687976e60be1
train
function
def get_db_config(environ_var, atomic_requests=True): values = env.db(var=environ_var, default='mysql://root:@127.0.0.1/olympia') values.update( { # Run all views in a transaction unless they are decorated not to. # `atomic_requests` should be `False` for database replicas where...
def get_db_config(environ_var, atomic_requests=True):
values = env.db(var=environ_var, default='mysql://root:@127.0.0.1/olympia') values.update( { # Run all views in a transaction unless they are decorated not to. # `atomic_requests` should be `False` for database replicas where no # write operations will ever happen. ...
_URLS_REGEX = r'{}(?!accounts/session/)'.format(DRF_API_REGEX) # https://github.com/mozilla/addons-server/issues/17364 CORS_ALLOW_HEADERS = list(default_headers) + [ 'x-country-code', ] def get_db_config(environ_var, atomic_requests=True):
64
64
204
12
52
elyse0/addons-server
src/olympia/lib/settings_base.py
Python
get_db_config
get_db_config
126
147
126
126
c663b2b11ee1a5fe2a66a154dbda1b5e91361646
bigcode/the-stack
train
ba39fc28854a78ddd143571e
train
function
def path(*folders): return os.path.join(ROOT, *folders)
def path(*folders):
return os.path.join(ROOT, *folders)
build_id = '' # jingo-minify: Style sheet media attribute default CSS_MEDIA_DEFAULT = 'all' # Make filepaths relative to the root of olympia. BASE_DIR = os.path.dirname(os.path.dirname(__file__)) ROOT = os.path.join(BASE_DIR, '..', '..') def path(*folders):
64
64
15
5
59
elyse0/addons-server
src/olympia/lib/settings_base.py
Python
path
path
62
63
62
62
75b684904d9f9ae78100ce8edc21eb7011435982
bigcode/the-stack
train
df396aa4f9f81c0b68445f89
train
function
def py_inte(a, b, N): s = 0 dx = (b-a) / N for i in range(N): s += f(a + i * dx) return s * dx
def py_inte(a, b, N):
s = 0 dx = (b-a) / N for i in range(N): s += f(a + i * dx) return s * dx
# test_runtime.py from __future__ import print_function from integ import integrate_f import time f = lambda x: x**2-x def py_inte(a, b, N):
42
64
49
10
31
lostFox/autoRunSomething
cython/test_runtime.py
Python
py_inte
py_inte
9
14
9
9
b3a6c798e5f63bb6b8f1ffd8da906fccab22e689
bigcode/the-stack
train
9b9173f2df92f3c5dcff40ea
train
function
def file_lines_to_list(path): # open txt file lines to a list with open(path) as f: content = f.readlines() # remove whitespace characters like `\n` at the end of each line content = [x.strip() for x in content] return content
def file_lines_to_list(path): # open txt file lines to a list
with open(path) as f: content = f.readlines() # remove whitespace characters like `\n` at the end of each line content = [x.strip() for x in content] return content
image only)") parser.add_argument("--Img_DIR", type=str, default="./results_visulization/BE/", help="predicted mask image (5 channel tif image only)") args = parser.parse_args() return args def file_lines_to_list(path): # open txt file lines to a list
64
64
64
17
46
guochunhe/Vitis-AI
models/AI-Model-Zoo/VAI-1.3-Model-Zoo-Code/caffe/cf_FPN-resnet18_EDD_320_320_45.3G_1.3/code/eval_edd.py
Python
file_lines_to_list
file_lines_to_list
38
44
38
39
55ba7a6a7a43d309f4700591167e2412516483e1
bigcode/the-stack
train
7c2d6e33b9f83fc349baa6b3
train
function
def jaccard(y_true, y_pred): intersection = (y_true * y_pred).sum() union = y_true.sum() + y_pred.sum() - intersection return (intersection + 1e-15) / (union + 1e-15)
def jaccard(y_true, y_pred):
intersection = (y_true * y_pred).sum() union = y_true.sum() + y_pred.sum() - intersection return (intersection + 1e-15) / (union + 1e-15)
_positives + false_positives + false_negatives if denom == 0: dice = 0 else: dice = 2 * float(true_positives) / denom dices.append(dice) return dices def jaccard(y_true, y_pred):
64
64
58
10
53
guochunhe/Vitis-AI
models/AI-Model-Zoo/VAI-1.3-Model-Zoo-Code/caffe/cf_FPN-resnet18_EDD_320_320_45.3G_1.3/code/eval_edd.py
Python
jaccard
jaccard
91
94
91
91
e50159f4a02af4fb43084818d4ab099ef2eaf721
bigcode/the-stack
train
d0f62f40e5b694ae6fbeaf6f
train
function
def dice(y_true, y_pred): return (2 * (y_true * y_pred).sum() + 1e-15) / (y_true.sum() + y_pred.sum() + 1e-15)
def dice(y_true, y_pred):
return (2 * (y_true * y_pred).sum() + 1e-15) / (y_true.sum() + y_pred.sum() + 1e-15)
accard(y_true, y_pred): intersection = (y_true * y_pred).sum() union = y_true.sum() + y_pred.sum() - intersection return (intersection + 1e-15) / (union + 1e-15) def dice(y_true, y_pred):
64
64
47
8
56
guochunhe/Vitis-AI
models/AI-Model-Zoo/VAI-1.3-Model-Zoo-Code/caffe/cf_FPN-resnet18_EDD_320_320_45.3G_1.3/code/eval_edd.py
Python
dice
dice
97
98
97
97
4f44c8884d19de6f37061ce7e559d388651c53b5
bigcode/the-stack
train
b6cfe9260dac37e0335404ca
train
function
def calculate_dice(confusion_matrix): dices = [] for index in range(confusion_matrix.shape[0]): true_positives = confusion_matrix[index, index] false_positives = confusion_matrix[:, index].sum() - true_positives false_negatives = confusion_matrix[index, :].sum() - true_positives ...
def calculate_dice(confusion_matrix):
dices = [] for index in range(confusion_matrix.shape[0]): true_positives = confusion_matrix[index, index] false_positives = confusion_matrix[:, index].sum() - true_positives false_negatives = confusion_matrix[index, :].sum() - true_positives denom = 2 * true_positives + false_pos...
: f2_score = 0 else: f2_score= (5*true_positives) / denom_f2 f2Val.append(f2_score) ious.append(iou) return ious, f2Val def calculate_dice(confusion_matrix):
64
64
135
8
55
guochunhe/Vitis-AI
models/AI-Model-Zoo/VAI-1.3-Model-Zoo-Code/caffe/cf_FPN-resnet18_EDD_320_320_45.3G_1.3/code/eval_edd.py
Python
calculate_dice
calculate_dice
77
89
77
77
cda4097dd2c1c5dc88e9fdafa3b0f20b2dd326e4
bigcode/the-stack
train
3a570bf1bf47772351ceb38d
train
function
def get_args(): import argparse parser = argparse.ArgumentParser(description="For EAD2019 challenge: semantic segmentation", formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument("--GT_maskDIR", type=str, default="./data/EDD/labels/", help="ground truth mask image (5 channel tif image...
def get_args():
import argparse parser = argparse.ArgumentParser(description="For EAD2019 challenge: semantic segmentation", formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument("--GT_maskDIR", type=str, default="./data/EDD/labels/", help="ground truth mask image (5 channel tif image only)") pars...
License. #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Mar 2 16:06:39 2019 @author: shariba FileName: semanticEval_dice_Jaccard_Overall.py """ import numpy as np def get_args():
64
64
145
4
59
guochunhe/Vitis-AI
models/AI-Model-Zoo/VAI-1.3-Model-Zoo-Code/caffe/cf_FPN-resnet18_EDD_320_320_45.3G_1.3/code/eval_edd.py
Python
get_args
get_args
28
36
28
29
bab021a0602ff40b4d90035976530c3278cf95dd
bigcode/the-stack
train
8adffb841d67c0934ec167d6
train
function
def calculate_iou(confusion_matrix): ious = [] f2Val=[] for index in range(confusion_matrix.shape[0]): true_positives = confusion_matrix[index, index] false_positives = confusion_matrix[:, index].sum() - true_positives false_negatives = confusion_matrix[index, :].sum() - true_positiv...
def calculate_iou(confusion_matrix):
ious = [] f2Val=[] for index in range(confusion_matrix.shape[0]): true_positives = confusion_matrix[index, index] false_positives = confusion_matrix[:, index].sum() - true_positives false_negatives = confusion_matrix[index, :].sum() - true_positives denom = true_posi...
ictions.flatten())).T confusion_matrix, _ = np.histogramdd(replace_indices, bins=(nr_labels, nr_labels),range=[(0, nr_labels), (0, nr_labels)]) confusion_matrix = confusion_matrix.astype(np.uint32) return confusion_matrix def calculate_iou(confusion_matrix):
65
65
217
8
56
guochunhe/Vitis-AI
models/AI-Model-Zoo/VAI-1.3-Model-Zoo-Code/caffe/cf_FPN-resnet18_EDD_320_320_45.3G_1.3/code/eval_edd.py
Python
calculate_iou
calculate_iou
52
75
52
52
a32747a6892190fb96571bf4915c7d120314e71d
bigcode/the-stack
train
a776734d2d3fc288310e7b17
train
function
def calculate_confusion_matrix_from_arrays(ground_truth, predictions, nr_labels): replace_indices = np.vstack((ground_truth.flatten(),predictions.flatten())).T confusion_matrix, _ = np.histogramdd(replace_indices, bins=(nr_labels, nr_labels),range=[(0, nr_labels), (0, nr_labels)]) confusion_matrix = confusi...
def calculate_confusion_matrix_from_arrays(ground_truth, predictions, nr_labels):
replace_indices = np.vstack((ground_truth.flatten(),predictions.flatten())).T confusion_matrix, _ = np.histogramdd(replace_indices, bins=(nr_labels, nr_labels),range=[(0, nr_labels), (0, nr_labels)]) confusion_matrix = confusion_matrix.astype(np.uint32) return confusion_matrix
with open(path) as f: content = f.readlines() # remove whitespace characters like `\n` at the end of each line content = [x.strip() for x in content] return content def calculate_confusion_matrix_from_arrays(ground_truth, predictions, nr_labels):
64
64
85
16
47
guochunhe/Vitis-AI
models/AI-Model-Zoo/VAI-1.3-Model-Zoo-Code/caffe/cf_FPN-resnet18_EDD_320_320_45.3G_1.3/code/eval_edd.py
Python
calculate_confusion_matrix_from_arrays
calculate_confusion_matrix_from_arrays
46
50
46
46
7cb29d8b9ef3ce31f774a562d4749efbba02bfc0
bigcode/the-stack
train
cb399d8ad3d7c34d2d6870be
train
function
def cloudinary_delete(flyer_id): #Image validation image = cloudinary.uploader.destroy(flyer_id) return image
def cloudinary_delete(flyer_id): #Image validation
image = cloudinary.uploader.destroy(flyer_id) return image
CLOUDINARY_API_KEY')), api_secret = str(os.getenv('CLOUDINARY_API_SECRET')) ) def cloudinary_url(encoded_img): #Image validation image = cloudinary.uploader.upload(encoded_img) return image def cloudinary_delete(flyer_id): #Image validation
64
64
30
14
49
JumboCode/OCCUR
backend/api/img_upload.py
Python
cloudinary_delete
cloudinary_delete
20
23
20
21
f340fe69c45f7f7a18491dec8aef2b9225ce4b10
bigcode/the-stack
train
90d4ac38c12b5a5ba3a55c03
train
function
def cloudinary_url(encoded_img): #Image validation image = cloudinary.uploader.upload(encoded_img) return image
def cloudinary_url(encoded_img): #Image validation
image = cloudinary.uploader.upload(encoded_img) return image
=True) cloudinary.config( cloud_name = str(os.getenv('CLOUDINARY_CLOUD_NAME')), api_key = str(os.getenv('CLOUDINARY_API_KEY')), api_secret = str(os.getenv('CLOUDINARY_API_SECRET')) ) def cloudinary_url(encoded_img): #Image validation
64
64
27
12
52
JumboCode/OCCUR
backend/api/img_upload.py
Python
cloudinary_url
cloudinary_url
15
18
15
16
fc625950d55a2a91268178a6018f77e37ce21abd
bigcode/the-stack
train
bfca83e0431047ed1100663a
train
class
class TimeoutExpired(Exception): pass
class TimeoutExpired(Exception):
pass
IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. import errno import os import os.path import signal import sys import time class TimeoutExpired(Exception):
64
64
8
5
58
alimony/asterist
Asterist/asterist_wait_pid.py
Python
TimeoutExpired
TimeoutExpired
48
49
48
48
68dbd5460fe7e4258d71e670039c21caf2c75fe1
bigcode/the-stack
train
a9a134b7eb58882800b61b8c
train
function
def pid_exists(pid): """Check whether pid exists in the current process table.""" if pid == 0: # According to "man 2 kill" PID 0 has a special meaning: # it refers to <<every process in the process group of the # calling process>> so we don't want to go any further. # If we get h...
def pid_exists(pid):
"""Check whether pid exists in the current process table.""" if pid == 0: # According to "man 2 kill" PID 0 has a special meaning: # it refers to <<every process in the process group of the # calling process>> so we don't want to go any further. # If we get here it means this UNI...
CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. import errno import os import os.path import signal import sys import time class TimeoutExpired(Exception): pass def pid_exists(pid):...
71
71
237
5
65
alimony/asterist
Asterist/asterist_wait_pid.py
Python
pid_exists
pid_exists
52
77
52
52
826fde647c6de97458745a95eef806aa8e9aa67a
bigcode/the-stack
train
331347e21914834daa486a97
train
function
def wait_pid(pid, timeout=None): """Wait for process with pid 'pid' to terminate and return its exit status code as an integer. If pid is not a children of os.getpid() (current process) just waits until the process disappears and return None. If pid does not exist at all return None immediately. ...
def wait_pid(pid, timeout=None):
"""Wait for process with pid 'pid' to terminate and return its exit status code as an integer. If pid is not a children of os.getpid() (current process) just waits until the process disappears and return None. If pid does not exist at all return None immediately. Raise TimeoutExpired on timeout ...
try: os.kill(pid, 0) except OSError as err: if err.errno == errno.ESRCH: # ESRCH == No such process return False elif err.errno == errno.EPERM: # EPERM clearly means there's a process to deny access to return True else: ...
146
146
487
8
137
alimony/asterist
Asterist/asterist_wait_pid.py
Python
wait_pid
wait_pid
80
139
80
80
9aa99403b9b7d160eb2ca85897f89d4381fce1d9
bigcode/the-stack
train
028cbda9685e2cfe8b13dad3
train
class
class TestNetworkInterfaceList(EntityTestCase, unittest.TestCase): klass = NetworkInterfaceList _full_dict = [ TestNetworkInterface._full_dict, TestNetworkInterface._full_dict, ]
class TestNetworkInterfaceList(EntityTestCase, unittest.TestCase):
klass = NetworkInterfaceList _full_dict = [ TestNetworkInterface._full_dict, TestNetworkInterface._full_dict, ]
full_dict, 'ip_gateway_list': TestIPGatewayList._full_dict, 'ip_list': TestIPInfoList._full_dict, 'mac': u('30:65:EC:6F:C4:58'), } class TestNetworkInterfaceList(EntityTestCase, unittest.TestCase):
64
64
44
13
51
tirkarthi/python-cybox
cybox/test/objects/system_test.py
Python
TestNetworkInterfaceList
TestNetworkInterfaceList
97
103
97
97
af6ad0d1bb6d36292ac1b39aca599ee63b4e76a8
bigcode/the-stack
train
d4e7a52b3c8ab8fba5c6d9a7
train
class
class TestDHCPServerList(EntityTestCase, unittest.TestCase): klass = DHCPServerList _full_dict = [ TestAddress._full_dict, ]
class TestDHCPServerList(EntityTestCase, unittest.TestCase):
klass = DHCPServerList _full_dict = [ TestAddress._full_dict, ]
IPInfo, IPInfoList, NetworkInterface, NetworkInterfaceList, OS, System) from cybox.test import EntityTestCase from cybox.test.objects import ObjectTestCase from cybox.test.objects.address_test import TestAddress class TestDHCPServerList(...
64
64
36
14
49
tirkarthi/python-cybox
cybox/test/objects/system_test.py
Python
TestDHCPServerList
TestDHCPServerList
17
22
17
17
af2c166b8269e505fe2d41675249a969854bb9b1
bigcode/the-stack
train
4b75ba49316819121611ff8d
train
class
class TestOS(EntityTestCase, unittest.TestCase): klass = OS _full_dict = { 'bitness': '64-bit', 'build_number': '14393.693', 'environment_variable_list': [ {'name': 'TEMP', 'value': 'C:/TEMP'}, ], 'install_date': '2001-01-01', 'patch_level': '10', ...
class TestOS(EntityTestCase, unittest.TestCase):
klass = OS _full_dict = { 'bitness': '64-bit', 'build_number': '14393.693', 'environment_variable_list': [ {'name': 'TEMP', 'value': 'C:/TEMP'}, ], 'install_date': '2001-01-01', 'patch_level': '10', 'platform': { 'description': u('...
_dict, 'subnet_mask': TestAddress._full_dict, } class TestIPInfoList(EntityTestCase, unittest.TestCase): klass = IPInfoList _full_dict = [ TestIPInfo._full_dict, ] class TestOS(EntityTestCase, unittest.TestCase):
63
64
118
11
52
tirkarthi/python-cybox
cybox/test/objects/system_test.py
Python
TestOS
TestOS
50
67
50
50
682c3399dba5c4beb6e338a134cde0e90b952c04
bigcode/the-stack
train
6113b337a74ad2bb8a2fccec
train
class
class TestIPInfoList(EntityTestCase, unittest.TestCase): klass = IPInfoList _full_dict = [ TestIPInfo._full_dict, ]
class TestIPInfoList(EntityTestCase, unittest.TestCase):
klass = IPInfoList _full_dict = [ TestIPInfo._full_dict, ]
] class TestIPInfo(EntityTestCase, unittest.TestCase): klass = IPInfo _full_dict = { 'ip_address': TestAddress._full_dict, 'subnet_mask': TestAddress._full_dict, } class TestIPInfoList(EntityTestCase, unittest.TestCase):
64
64
36
13
51
tirkarthi/python-cybox
cybox/test/objects/system_test.py
Python
TestIPInfoList
TestIPInfoList
42
47
42
42
aa0943fd37db8ae4a59232eab8a783d545a230c9
bigcode/the-stack
train
c48bafd24973e2d8cb0c1843
train
class
class TestNetworkInterface(EntityTestCase, unittest.TestCase): klass = NetworkInterface _full_dict = { 'adapter': u('I350-T2V2'), 'description': u('Test Network Interface'), 'dhcp_lease_expires': '2001-01-01T06:56:50+04:00', 'dhcp_lease_obtained': '2001-01-01T06:56:50+04:00', ...
class TestNetworkInterface(EntityTestCase, unittest.TestCase):
klass = NetworkInterface _full_dict = { 'adapter': u('I350-T2V2'), 'description': u('Test Network Interface'), 'dhcp_lease_expires': '2001-01-01T06:56:50+04:00', 'dhcp_lease_obtained': '2001-01-01T06:56:50+04:00', 'dhcp_server_list': TestDHCPServerList._full_dict, ...
', 'bios_version': u('A19'), 'bios_manufacturer': u('Fabrikam'), 'bios_release_date': '2001-01-01', 'bios_serial_number': u('7GHX44'), } class TestNetworkInterface(EntityTestCase, unittest.TestCase):
64
64
166
12
52
tirkarthi/python-cybox
cybox/test/objects/system_test.py
Python
TestNetworkInterface
TestNetworkInterface
82
94
82
82
a2b1951b695d75dbac119f33c2b9372f64730fc5
bigcode/the-stack
train
82c4b225b147a2fcaf01f8c7
train
class
class TestIPInfo(EntityTestCase, unittest.TestCase): klass = IPInfo _full_dict = { 'ip_address': TestAddress._full_dict, 'subnet_mask': TestAddress._full_dict, }
class TestIPInfo(EntityTestCase, unittest.TestCase):
klass = IPInfo _full_dict = { 'ip_address': TestAddress._full_dict, 'subnet_mask': TestAddress._full_dict, }
_full_dict = [ TestAddress._full_dict, ] class TestIPGatewayList(EntityTestCase, unittest.TestCase): klass = IPGatewayList _full_dict = [ TestAddress._full_dict, ] class TestIPInfo(EntityTestCase, unittest.TestCase):
63
64
49
12
51
tirkarthi/python-cybox
cybox/test/objects/system_test.py
Python
TestIPInfo
TestIPInfo
33
39
33
33
b636114fac9750ba64904023a74dce842b91c870
bigcode/the-stack
train
73065cfd16493b3801c5d9c5
train
class
class TestIPGatewayList(EntityTestCase, unittest.TestCase): klass = IPGatewayList _full_dict = [ TestAddress._full_dict, ]
class TestIPGatewayList(EntityTestCase, unittest.TestCase):
klass = IPGatewayList _full_dict = [ TestAddress._full_dict, ]
TestCase from cybox.test.objects.address_test import TestAddress class TestDHCPServerList(EntityTestCase, unittest.TestCase): klass = DHCPServerList _full_dict = [ TestAddress._full_dict, ] class TestIPGatewayList(EntityTestCase, unittest.TestCase):
63
64
35
13
50
tirkarthi/python-cybox
cybox/test/objects/system_test.py
Python
TestIPGatewayList
TestIPGatewayList
25
30
25
25
4df9e9d2cf5df3e35dbcf5735c1270e0557930dc
bigcode/the-stack
train
b50657a8e20e9a667b8d515e
train
class
class TestSystem(ObjectTestCase, unittest.TestCase): object_type = "SystemObjectType" klass = System _full_dict = { 'available_physical_memory': 3814697265600, 'bios_info': TestBIOSInfo._full_dict, 'date': '2001-01-01', 'hostname': u('johndoe.frabikam.org'), 'local_t...
class TestSystem(ObjectTestCase, unittest.TestCase):
object_type = "SystemObjectType" klass = System _full_dict = { 'available_physical_memory': 3814697265600, 'bios_info': TestBIOSInfo._full_dict, 'date': '2001-01-01', 'hostname': u('johndoe.frabikam.org'), 'local_time': '06:56:50+04:00', 'network_interface_li...
:EC:6F:C4:58'), } class TestNetworkInterfaceList(EntityTestCase, unittest.TestCase): klass = NetworkInterfaceList _full_dict = [ TestNetworkInterface._full_dict, TestNetworkInterface._full_dict, ] class TestSystem(ObjectTestCase, unittest.TestCase):
67
68
228
11
56
tirkarthi/python-cybox
cybox/test/objects/system_test.py
Python
TestSystem
TestSystem
106
127
106
106
9ff1b2aecd4c985173203fed0fb8f5a0674760f3
bigcode/the-stack
train
14e5ad61b6b4587d63b9e225
train
class
class TestBIOSInfo(EntityTestCase, unittest.TestCase): klass = BIOSInfo _full_dict = { 'bios_date': '2001-01-01', 'bios_version': u('A19'), 'bios_manufacturer': u('Fabrikam'), 'bios_release_date': '2001-01-01', 'bios_serial_number': u('7GHX44'), }
class TestBIOSInfo(EntityTestCase, unittest.TestCase):
klass = BIOSInfo _full_dict = { 'bios_date': '2001-01-01', 'bios_version': u('A19'), 'bios_manufacturer': u('Fabrikam'), 'bios_release_date': '2001-01-01', 'bios_serial_number': u('7GHX44'), }
'install_date': '2001-01-01', 'patch_level': '10', 'platform': { 'description': u('A Windows platform'), 'identifier': [ u('Windows') ], }, } class TestBIOSInfo(EntityTestCase, unittest.TestCase):
64
64
89
13
51
tirkarthi/python-cybox
cybox/test/objects/system_test.py
Python
TestBIOSInfo
TestBIOSInfo
70
79
70
70
2d54b8d9db64b544c20e597cdda73cf8fce9f1ae
bigcode/the-stack
train
f3f455dd5eaa06ccdc27d834
train
class
@attr.s(auto_attribs=True) class InjectionContext(Generic[InjectedT]): logger = logging.getLogger(__name__) target: Target[InjectedT] injection_state: "InjectionState" parent_context: Optional["InjectionContext"] = attr.ib(default=None, eq=False) allow_jit_provider: bool = True def __attrs_pos...
@attr.s(auto_attribs=True) class InjectionContext(Generic[InjectedT]):
logger = logging.getLogger(__name__) target: Target[InjectedT] injection_state: "InjectionState" parent_context: Optional["InjectionContext"] = attr.ib(default=None, eq=False) allow_jit_provider: bool = True def __attrs_post_init__(self): context = self while context.parent_con...
import logging from typing import Generic, List, Optional, TYPE_CHECKING import attr from .exceptions import CyclicDependencyError from .provider import Provider from .target import Target from .utils import InjectedT if TYPE_CHECKING: from .bindings import RegisteredBinding from .injection_state import Inje...
88
119
398
17
70
illuin-tech/opyoid
opyoid/injection_context.py
Python
InjectionContext
InjectionContext
16
61
16
17
6bebee282351f35f510e4ed5e5ee2af8cf54664d
bigcode/the-stack
train
bea506a327fd462d9391b3d3
train
function
def _fetch_events(q): ''' Collect events and store them ''' def _clean_queue(): print('Cleaning queue!') while not q.empty(): queue_item = q.get() queue_item.task_done() atexit.register(_clean_queue) opts = RUNTIME_VARS.RUNTIME_CONFIGS['minion'] even...
def _fetch_events(q):
''' Collect events and store them ''' def _clean_queue(): print('Cleaning queue!') while not q.empty(): queue_item = q.get() queue_item.task_done() atexit.register(_clean_queue) opts = RUNTIME_VARS.RUNTIME_CONFIGS['minion'] event = salt.utils.event.g...
) def assertSaltStateChangesNotEqual(self, ret, comparison, keys=()): keys = ['changes'] + self.__return_valid_keys(keys) for saltret in self.__getWithinSaltReturn(ret, keys): self.assertNotEqual(saltret, comparison) def _fetch_events(q):
64
64
154
6
58
johnskopis/salt
tests/support/mixins.py
Python
_fetch_events
_fetch_events
657
678
657
657
f4ff8fd78bf171469ed9032d09c79358d23e9c0d
bigcode/the-stack
train
c60b5652648237c1b1619d0e
train
class
class CheckShellBinaryNameAndVersionMixin(object): ''' Simple class mix-in to subclass in companion to :class:`ShellTestCase<tests.support.case.ShellTestCase>` which adds a test case to verify proper version report from Salt's CLI tools. ''' _call_binary_ = None _call_binary_expected_version_ =...
class CheckShellBinaryNameAndVersionMixin(object):
''' Simple class mix-in to subclass in companion to :class:`ShellTestCase<tests.support.case.ShellTestCase>` which adds a test case to verify proper version report from Salt's CLI tools. ''' _call_binary_ = None _call_binary_expected_version_ = None def test_version_includes_binary_name(se...
salt.version import salt.exceptions import salt.utils.process from salt.utils.verify import verify_env from salt.utils.immutabletypes import freeze from salt._compat import ElementTree as etree # Import 3rd-party libs from salt.ext import six from salt.ext.six.moves import zip # pylint: disable=import-error,redefine...
92
92
308
10
82
johnskopis/salt
tests/support/mixins.py
Python
CheckShellBinaryNameAndVersionMixin
CheckShellBinaryNameAndVersionMixin
54
86
54
54
7672c09b90b9c58a8853ed66f94f2d25d5c264b9
bigcode/the-stack
train
85a2316de30f4b72766a7d23
train
class
class SaltReturnAssertsMixin(object): def assertReturnSaltType(self, ret): try: self.assertTrue(isinstance(ret, dict)) except AssertionError: raise AssertionError( '{0} is not dict. Salt returned: {1}'.format( type(ret).__name__, ret ...
class SaltReturnAssertsMixin(object):
def assertReturnSaltType(self, ret): try: self.assertTrue(isinstance(ret, dict)) except AssertionError: raise AssertionError( '{0} is not dict. Salt returned: {1}'.format( type(ret).__name__, ret ) ) def ass...
setup_func(self) return wrapper def setup_loader_modules(self): raise NotImplementedError( '\'{}.setup_loader_modules()\' must be implemented'.format(self.__class__.__name__) ) class XMLEqualityMixin(object): def assertEqualXML(self, e1, e2): if six.PY3 and isins...
256
256
1,286
8
248
johnskopis/salt
tests/support/mixins.py
Python
SaltReturnAssertsMixin
SaltReturnAssertsMixin
503
654
503
504
307d3fd48d9c5003f69a39d985c3d70ec82234ec
bigcode/the-stack
train
b562c8ea9db066863172d45c
train
class
class SaltClientTestCaseMixin(AdaptedConfigurationTestCaseMixin): ''' Mix-in class that provides a ``client`` attribute which returns a Salt :class:`LocalClient<salt:salt.client.LocalClient>`. .. code-block:: python class LocalClientTestCase(TestCase, SaltClientTestCaseMixin): def...
class SaltClientTestCaseMixin(AdaptedConfigurationTestCaseMixin):
''' Mix-in class that provides a ``client`` attribute which returns a Salt :class:`LocalClient<salt:salt.client.LocalClient>`. .. code-block:: python class LocalClientTestCase(TestCase, SaltClientTestCaseMixin): def test_check_pub_data(self): just_minions = {'minio...
''' return self.get_config('master') @property def minion_opts(self): ''' Return the options used for the minion ''' return self.get_config('minion') @property def sub_minion_opts(self): ''' Return the options used for the sub_minion ...
96
96
323
14
82
johnskopis/salt
tests/support/mixins.py
Python
SaltClientTestCaseMixin
SaltClientTestCaseMixin
225
259
225
225
1617a5d4c1c1a5c871556ca2a79a81a1c793f448
bigcode/the-stack
train
a3cebaaa2e6fb299a46c34d1
train
class
class SaltMinionEventAssertsMixin(object): ''' Asserts to verify that a given event was seen ''' @classmethod def setUpClass(cls): cls.q = multiprocessing.Queue() cls.fetch_proc = salt.utils.process.SignalHandlingMultiprocessingProcess( target=_fetch_events, ...
class SaltMinionEventAssertsMixin(object):
''' Asserts to verify that a given event was seen ''' @classmethod def setUpClass(cls): cls.q = multiprocessing.Queue() cls.fetch_proc = salt.utils.process.SignalHandlingMultiprocessingProcess( target=_fetch_events, args=(cls.q,), name='Process-{}...
minion'] event = salt.utils.event.get_event('minion', sock_dir=opts['sock_dir'], opts=opts) while True: try: events = event.get_event(full=False) except Exception: # This is broad but we'll see all kinds of issues right now # if we drop the proc out from under...
96
96
320
10
86
johnskopis/salt
tests/support/mixins.py
Python
SaltMinionEventAssertsMixin
SaltMinionEventAssertsMixin
681
720
681
681
a67bbde20b1bf851ff4da679c830a39f65a4ed22
bigcode/the-stack
train
900501aa9102cef885c384c8
train
class
class AdaptedConfigurationTestCaseMixin(object): __slots__ = () @staticmethod def get_temp_config(config_for, **config_overrides): rootdir = tempfile.mkdtemp(dir=RUNTIME_VARS.TMP) conf_dir = os.path.join(rootdir, 'conf') for key in ('cachedir', 'pki_dir', 'sock_dir'): i...
class AdaptedConfigurationTestCaseMixin(object):
__slots__ = () @staticmethod def get_temp_config(config_for, **config_overrides): rootdir = tempfile.mkdtemp(dir=RUNTIME_VARS.TMP) conf_dir = os.path.join(rootdir, 'conf') for key in ('cachedir', 'pki_dir', 'sock_dir'): if key not in config_overrides: con...
_ = None _call_binary_expected_version_ = None def test_version_includes_binary_name(self): if getattr(self, '_call_binary_', None) is None: self.skipTest('\'_call_binary_\' not defined.') if self._call_binary_expected_version_ is None: # Late import self._c...
256
256
1,204
9
247
johnskopis/salt
tests/support/mixins.py
Python
AdaptedConfigurationTestCaseMixin
AdaptedConfigurationTestCaseMixin
89
222
89
90
889f95a9a92b8b95354212f08fcbd1a7d29fc045
bigcode/the-stack
train
02773619414a4e2e077a16f0
train
class
class LoaderModuleMockMixin(six.with_metaclass(_FixLoaderModuleMockMixinMroOrder, object)): ''' This class will setup salt loader dunders. Please check `set_up_loader_mocks` above ''' # Define our setUp function decorator @staticmethod def __setup_loader_modules_mocks__(setup_func): ...
class LoaderModuleMockMixin(six.with_metaclass(_FixLoaderModuleMockMixinMroOrder, object)):
''' This class will setup salt loader dunders. Please check `set_up_loader_mocks` above ''' # Define our setUp function decorator @staticmethod def __setup_loader_modules_mocks__(setup_func): @functools.wraps(setup_func) def wrapper(self): if NO_MOCK: ...
In(parsed_version.string, out) class _FixLoaderModuleMockMixinMroOrder(type): ''' This metaclass will make sure that LoaderModuleMockMixin will always come as the first base class in order for LoaderModuleMockMixin.setUp to actually run ''' def __new__(mcs, cls_name, cls_bases, cls_dict): ...
256
256
1,030
22
233
johnskopis/salt
tests/support/mixins.py
Python
LoaderModuleMockMixin
LoaderModuleMockMixin
344
476
344
344
d0d066e3101a48a3bab1c169a7db42dd43883cd3
bigcode/the-stack
train
e329e235bfa53f49e109e206
train
class
class ShellCaseCommonTestsMixin(CheckShellBinaryNameAndVersionMixin): _call_binary_expected_version_ = salt.version.__version__ def test_salt_with_git_version(self): if getattr(self, '_call_binary_', None) is None: self.skipTest('\'_call_binary_\' not defined.') from salt.version i...
class ShellCaseCommonTestsMixin(CheckShellBinaryNameAndVersionMixin):
_call_binary_expected_version_ = salt.version.__version__ def test_salt_with_git_version(self): if getattr(self, '_call_binary_', None) is None: self.skipTest('\'_call_binary_\' not defined.') from salt.version import __version_info__, SaltStackVersion git = salt.utils.path....
.assertDictEqual( {}, self.client._check_pub_data({'jid': '0'}), 'Passing JID of zero is not handled gracefully') ''' _salt_client_config_file_name_ = 'master' @property def client(self): # Late import import salt.client ...
150
150
503
14
136
johnskopis/salt
tests/support/mixins.py
Python
ShellCaseCommonTestsMixin
ShellCaseCommonTestsMixin
262
319
262
263
a3f5dae9436ebb5429bb812d900b8eb7a21874b8
bigcode/the-stack
train
a5e886a0a5498c5dff32e045
train
class
class _FixLoaderModuleMockMixinMroOrder(type): ''' This metaclass will make sure that LoaderModuleMockMixin will always come as the first base class in order for LoaderModuleMockMixin.setUp to actually run ''' def __new__(mcs, cls_name, cls_bases, cls_dict): if cls_name == 'LoaderModuleMockM...
class _FixLoaderModuleMockMixinMroOrder(type):
''' This metaclass will make sure that LoaderModuleMockMixin will always come as the first base class in order for LoaderModuleMockMixin.setUp to actually run ''' def __new__(mcs, cls_name, cls_bases, cls_dict): if cls_name == 'LoaderModuleMockMixin': return super(_FixLoaderModul...
\' if you followed ' 'salt\'s contribute documentation. The version ' 'string WILL NOT include the git hash.' ) out = '\n'.join(self.run_script(self._call_binary_, '--version')) self.assertIn(parsed_version.string, out) class _FixLoaderModuleMockMixinMroOrder(...
68
68
227
12
56
johnskopis/salt
tests/support/mixins.py
Python
_FixLoaderModuleMockMixinMroOrder
_FixLoaderModuleMockMixinMroOrder
322
341
322
322
eefc2a68038095ce1e69e1f5f09c173d0630ce83
bigcode/the-stack
train
ab4136edfd0c7035943e9c73
train
class
class XMLEqualityMixin(object): def assertEqualXML(self, e1, e2): if six.PY3 and isinstance(e1, bytes): e1 = e1.decode('utf-8') if six.PY3 and isinstance(e2, bytes): e2 = e2.decode('utf-8') if isinstance(e1, six.string_types): e1 = etree.XML(e1) i...
class XMLEqualityMixin(object):
def assertEqualXML(self, e1, e2): if six.PY3 and isinstance(e1, bytes): e1 = e1.decode('utf-8') if six.PY3 and isinstance(e2, bytes): e2 = e2.decode('utf-8') if isinstance(e1, six.string_types): e1 = etree.XML(e1) if isinstance(e2, six.string_types...
func], module_globals, preserve_context=True ) return setup_func(self) return wrapper def setup_loader_modules(self): raise NotImplementedError( '\'{}.setup_loader_modules()\' must be implemented...
64
64
206
7
57
johnskopis/salt
tests/support/mixins.py
Python
XMLEqualityMixin
XMLEqualityMixin
479
500
479
480
3526c16964fe76d3c9e4c75b6d5dbe136d91c86f
bigcode/the-stack
train
0ed984f904166cb3065e6e36
train
function
def test_device_flow(): _client = Client() cli = DeviceFlowClient(_client) _server = Server() srv = DeviceFlowServer(_server) # init req = AuthorizationRequest(client_id=cli.host.client_id, response_type='device_code') resp = srv.device_endpoint(req) # ...
def test_device_flow():
_client = Client() cli = DeviceFlowClient(_client) _server = Server() srv = DeviceFlowServer(_server) # init req = AuthorizationRequest(client_id=cli.host.client_id, response_type='device_code') resp = srv.device_endpoint(req) # Polling req2 = Toke...
from oic.extension.device_flow import AuthorizationRequest from oic.extension.device_flow import DeviceFlowClient from oic.extension.device_flow import DeviceFlowServer from oic.extension.device_flow import TokenRequest from oic.oauth2 import Client from oic.oauth2 import Server def test_device_flow():
63
64
124
5
57
chhsiao1981/pyoidc
tests/not_yet_test_x_device_flow.py
Python
test_device_flow
test_device_flow
9
28
9
9
ae7158587bf314ce8686d5987fa9f034d92ae067
bigcode/the-stack
train
6bd7d2c9c6f13f564da7285d
train
function
def test_cron_root_configuration(host): """Check cron root configuration""" f = host.file("/var/spool/cron/crontabs/root") assert "SHELL=" in f.content_string assert "PATH=" in f.content_string
def test_cron_root_configuration(host):
"""Check cron root configuration""" f = host.file("/var/spool/cron/crontabs/root") assert "SHELL=" in f.content_string assert "PATH=" in f.content_string
"""Role testing files using testinfra""" def test_cron_default_configuration(host): """Check cron default configuration""" f = host.file("/etc/crontab") assert f.is_file def test_cron_root_configuration(host):
48
64
52
8
39
escalate/ansible-raspberry-cron
molecule/default/tests/test_default.py
Python
test_cron_root_configuration
test_cron_root_configuration
10
14
10
10
1edf03260177c83c57fb553f5cb49d8d30e5637b
bigcode/the-stack
train
2259a39568653c528add70e9
train
function
def test_cron_default_configuration(host): """Check cron default configuration""" f = host.file("/etc/crontab") assert f.is_file
def test_cron_default_configuration(host):
"""Check cron default configuration""" f = host.file("/etc/crontab") assert f.is_file
"""Role testing files using testinfra""" def test_cron_default_configuration(host):
16
64
32
8
8
escalate/ansible-raspberry-cron
molecule/default/tests/test_default.py
Python
test_cron_default_configuration
test_cron_default_configuration
4
7
4
4
18a8adc829d597fa2a4ddc245e2feedb9a1f335d
bigcode/the-stack
train
d9f443cf5d840fef80727591
train
function
def average(array): return sum(set(array)) / len(set(array))
def average(array):
return sum(set(array)) / len(set(array))
# Problem: https://www.hackerrank.com/challenges/py-introduction-to-sets/problem # Score: 10 def average(array):
32
64
15
4
27
Snehakri022/HackerrankPractice
Python/04. Sets/001. Introduction to Sets.py
Python
average
average
5
6
5
5
7eb1ab9a59bb58608c9df0fd5b2e86fb8c680ffe
bigcode/the-stack
train
60ba38367e8cf57e7f88ab1f
train
class
class IperfBenchmarkTestCase(unittest.TestCase): def setUp(self): super(IperfBenchmarkTestCase, self).setUp() self.vm_spec = mock.MagicMock(spec=benchmark_spec.BenchmarkSpec) vm0 = mock.MagicMock( internal_ip='10.128.0.1', machine_type='mock_machine_1', zone='antarctica-1a') ...
class IperfBenchmarkTestCase(unittest.TestCase):
def setUp(self): super(IperfBenchmarkTestCase, self).setUp() self.vm_spec = mock.MagicMock(spec=benchmark_spec.BenchmarkSpec) vm0 = mock.MagicMock( internal_ip='10.128.0.1', machine_type='mock_machine_1', zone='antarctica-1a') vm1 = mock.MagicMock( internal_ip='10.128....
# Copyright 2020 PerfKitBenchmarker Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
204
256
2,495
10
194
Nowasky/PerfKitBenchmarker
tests/linux_benchmarks/iperf_benchmark_test.py
Python
IperfBenchmarkTestCase
IperfBenchmarkTestCase
27
220
27
28
e11af2f1046b80108cb349096a4e6b3fdc2172a6
bigcode/the-stack
train
67973237805be1e8240fce9c
train
class
class Boolean(BaseField): def is_true(self): """ Example: active.is_true() All records in which the Active field is True. """ return self._condition(BooleanOperator.EQUALS, "true") def is_falsy(self): """ Example: active.is_falsy() All records ...
class Boolean(BaseField):
def is_true(self): """ Example: active.is_true() All records in which the Active field is True. """ return self._condition(BooleanOperator.EQUALS, "true") def is_falsy(self): """ Example: active.is_falsy() All records in which the Active field ...
from .base import BaseField from ..query import BooleanOperator class Boolean(BaseField):
19
64
95
5
13
sulbig/snow
snow/resource/fields/boolean.py
Python
Boolean
Boolean
6
23
6
6
a73139f961556baf1ea516036b193e6be16cd8ed
bigcode/the-stack
train
ac5f58386fcb054375076b5c
train
class
class TestRasterPlot(TestBokehPlot): def test_image_colormapping(self): img = Image(np.random.rand(10, 10)).opts(plot=dict(logz=True)) self._test_colormapping(img, 2, True) def test_image_boolean_array(self): img = Image(np.array([[True, False], [False, True]])) plot = bokeh_re...
class TestRasterPlot(TestBokehPlot):
def test_image_colormapping(self): img = Image(np.random.rand(10, 10)).opts(plot=dict(logz=True)) self._test_colormapping(img, 2, True) def test_image_boolean_array(self): img = Image(np.array([[True, False], [False, True]])) plot = bokeh_renderer.get_plot(img) cmapper =...
import numpy as np from holoviews.element import Raster, Image, RGB from .testplot import TestBokehPlot, bokeh_renderer class TestRasterPlot(TestBokehPlot):
41
256
1,313
9
31
ea42gh/holoviews
holoviews/tests/plotting/bokeh/testrasterplot.py
Python
TestRasterPlot
TestRasterPlot
8
116
8
9
b3be94601ca7d20c5d8ceb7e1d703e6da0936e95
bigcode/the-stack
train
0f1efc72e7b02662b2d8610e
train
class
class Solution(object): def canPermutePalindrome(self, s): """ :type s: str :rtype: bool """ return sum(v % 2 for v in collections.Counter(s).values()) < 2
class Solution(object):
def canPermutePalindrome(self, s): """ :type s: str :rtype: bool """ return sum(v % 2 for v in collections.Counter(s).values()) < 2
# Time: O(n) # Space: O(1) import collections class Solution(object):
21
64
51
4
16
Sourav692/FAANG-Interview-Preparation
Algo and DSA/LeetCode-Solutions-master/Python/palindrome-permutation.py
Python
Solution
Solution
7
13
7
7
8565ca3cb2ebf8e4cae96234a234727c44d2fe8e
bigcode/the-stack
train