function stringlengths 11 56k | repo_name stringlengths 5 60 | features list |
|---|---|---|
def testCredentials(self):
self.assertTrue(self.cred_instance.Authenticate(u'sharrell', 'test'))
cred_string = self.cred_instance.GetCredentials(u'sharrell', 'test',
self.core_instance)
self.assertEqual(self.cred_instance.CheckCredential(cred_string,
... | stephenlienharrell/roster-dns-management | [
1,
1,
1,
4,
1426209952
] |
def new_tool_type(request):
if request.method == 'POST':
tform = ToolTypeForm(request.POST, instance=Tool_Type())
if tform.is_valid():
tform.save()
messages.add_message(request,
messages.SUCCESS,
'Tool Type Con... | rackerlabs/django-DefectDojo | [
2681,
1254,
2681,
272,
1424368427
] |
def edit_tool_type(request, ttid):
tool_type = Tool_Type.objects.get(pk=ttid)
if request.method == 'POST':
tform = ToolTypeForm(request.POST, instance=tool_type)
if tform.is_valid():
tform.save()
messages.add_message(request,
messages.SUCC... | rackerlabs/django-DefectDojo | [
2681,
1254,
2681,
272,
1424368427
] |
def algorithm(self):
return 'Simultaneous-FA' | jabooth/menpo-archive | [
5,
2,
5,
5,
1352724935
] |
def algorithm(self):
return 'Simultaneous-FC' | jabooth/menpo-archive | [
5,
2,
5,
5,
1352724935
] |
def _fit(self, lk_fitting, max_iters=20, project=True):
# Initial error > eps
error = self.eps + 1
image = lk_fitting.image
lk_fitting.weights = []
n_iters = 0
# Number of shape weights
n_params = self.transform.n_parameters
# Initial appearance weights
... | jabooth/menpo-archive | [
5,
2,
5,
5,
1352724935
] |
def algorithm(self):
return 'Simultaneous-IA' | jabooth/menpo-archive | [
5,
2,
5,
5,
1352724935
] |
def fuzzylogic(features, cfg, require="all"):
"""
FIXME: Think about, should I return 0, or have an assert, and at qc.py
all qc tests are applied with a try, and in case it fails it flag
0s.
"""
require = cfg.get("require", require)
if (require == "all") and not np.all([f ... | castelao/CoTeDe | [
36,
15,
36,
9,
1369489700
] |
def set_features(self):
self.features = {}
for v in [f for f in self.cfg["features"] if f not in self.features]:
if v == "woa_bias":
woa_comparison = woa_normbias(self.data, self.varname, self.attrs)
self.features[v] = woa_comparison["woa_bias"]
el... | castelao/CoTeDe | [
36,
15,
36,
9,
1369489700
] |
def loaded(cls):
return 'cudf' in sys.modules | ioam/holoviews | [
2392,
373,
2392,
992,
1399481962
] |
def applies(cls, obj):
if not cls.loaded():
return False
import cudf
return isinstance(obj, (cudf.DataFrame, cudf.Series)) | ioam/holoviews | [
2392,
373,
2392,
992,
1399481962
] |
def init(cls, eltype, data, kdims, vdims):
import cudf
import pandas as pd
element_params = eltype.param.objects()
kdim_param = element_params['kdims']
vdim_param = element_params['vdims']
if isinstance(data, (cudf.Series, pd.Series)):
data = data.to_frame()... | ioam/holoviews | [
2392,
373,
2392,
992,
1399481962
] |
def range(cls, dataset, dimension):
dimension = dataset.get_dimension(dimension, strict=True)
column = dataset.data[dimension.name]
if dimension.nodata is not None:
column = cls.replace_value(column, dimension.nodata)
if column.dtype.kind == 'O':
return np.NaN, np... | ioam/holoviews | [
2392,
373,
2392,
992,
1399481962
] |
def values(cls, dataset, dim, expanded=True, flat=True, compute=True,
keep_index=False):
dim = dataset.get_dimension(dim, strict=True)
data = dataset.data[dim.name]
if not expanded:
data = data.unique()
return data.values_host if compute else data.values
... | ioam/holoviews | [
2392,
373,
2392,
992,
1399481962
] |
def groupby(cls, dataset, dimensions, container_type, group_type, **kwargs):
# Get dimensions information
dimensions = [dataset.get_dimension(d).name for d in dimensions]
kdims = [kdim for kdim in dataset.kdims if kdim not in dimensions]
# Update the kwargs appropriately for Element gro... | ioam/holoviews | [
2392,
373,
2392,
992,
1399481962
] |
def select_mask(cls, dataset, selection):
"""
Given a Dataset object and a dictionary with dimension keys and
selection keys (i.e. tuple ranges, slices, sets, lists, or literals)
return a boolean mask over the rows in the Dataset object that
have been selected.
"""
... | ioam/holoviews | [
2392,
373,
2392,
992,
1399481962
] |
def select(cls, dataset, selection_mask=None, **selection):
df = dataset.data
if selection_mask is None:
selection_mask = cls.select_mask(dataset, selection)
indexed = cls.indexed(dataset, selection)
if selection_mask is not None:
df = df.loc[selection_mask]
... | ioam/holoviews | [
2392,
373,
2392,
992,
1399481962
] |
def concat_fn(cls, dataframes, **kwargs):
import cudf
return cudf.concat(dataframes, **kwargs) | ioam/holoviews | [
2392,
373,
2392,
992,
1399481962
] |
def add_dimension(cls, dataset, dimension, dim_pos, values, vdim):
data = dataset.data.copy()
if dimension.name not in data:
data[dimension.name] = values
return data | ioam/holoviews | [
2392,
373,
2392,
992,
1399481962
] |
def aggregate(cls, dataset, dimensions, function, **kwargs):
data = dataset.data
cols = [d.name for d in dataset.kdims if d in dimensions]
vdims = dataset.dimensions('value', label='name')
reindexed = data[cols+vdims]
agg = function.__name__
if len(dimensions):
... | ioam/holoviews | [
2392,
373,
2392,
992,
1399481962
] |
def iloc(cls, dataset, index):
import cudf
rows, cols = index
scalar = False
columns = list(dataset.data.columns)
if isinstance(cols, slice):
cols = [d.name for d in dataset.dimensions()][cols]
elif np.isscalar(cols):
scalar = np.isscalar(rows)
... | ioam/holoviews | [
2392,
373,
2392,
992,
1399481962
] |
def sort(cls, dataset, by=[], reverse=False):
cols = [dataset.get_dimension(d, strict=True).name for d in by]
return dataset.data.sort_values(by=cols, ascending=not reverse) | ioam/holoviews | [
2392,
373,
2392,
992,
1399481962
] |
def dframe(cls, dataset, dimensions):
if dimensions:
return dataset.data[dimensions].to_pandas()
else:
return dataset.data.to_pandas() | ioam/holoviews | [
2392,
373,
2392,
992,
1399481962
] |
def __init__(self, **kwargs):
""" Initializes a VMResync instance
Notes:
You can specify all parameters while calling this methods.
A special argument named `data` will enable you to load the
object from a Python dictionary
Examples:
... | nuagenetworks/vspk-python | [
19,
18,
19,
7,
1457133058
] |
def last_request_timestamp(self):
""" Get last_request_timestamp value.
Notes:
Time of the last timestamp received | nuagenetworks/vspk-python | [
19,
18,
19,
7,
1457133058
] |
def last_request_timestamp(self, value):
""" Set last_request_timestamp value.
Notes:
Time of the last timestamp received | nuagenetworks/vspk-python | [
19,
18,
19,
7,
1457133058
] |
def last_time_resync_initiated(self):
""" Get last_time_resync_initiated value.
Notes:
Time that the resync was initiated | nuagenetworks/vspk-python | [
19,
18,
19,
7,
1457133058
] |
def last_time_resync_initiated(self, value):
""" Set last_time_resync_initiated value.
Notes:
Time that the resync was initiated | nuagenetworks/vspk-python | [
19,
18,
19,
7,
1457133058
] |
def last_updated_by(self):
""" Get last_updated_by value.
Notes:
ID of the user who last updated the object. | nuagenetworks/vspk-python | [
19,
18,
19,
7,
1457133058
] |
def last_updated_by(self, value):
""" Set last_updated_by value.
Notes:
ID of the user who last updated the object. | nuagenetworks/vspk-python | [
19,
18,
19,
7,
1457133058
] |
def last_updated_date(self):
""" Get last_updated_date value.
Notes:
Time stamp when this object was last updated. | nuagenetworks/vspk-python | [
19,
18,
19,
7,
1457133058
] |
def last_updated_date(self, value):
""" Set last_updated_date value.
Notes:
Time stamp when this object was last updated. | nuagenetworks/vspk-python | [
19,
18,
19,
7,
1457133058
] |
def embedded_metadata(self):
""" Get embedded_metadata value.
Notes:
Metadata objects associated with this entity. This will contain a list of Metadata objects if the API request is made using the special flag to enable the embedded Metadata feature. Only a maximum of Metadata objec... | nuagenetworks/vspk-python | [
19,
18,
19,
7,
1457133058
] |
def embedded_metadata(self, value):
""" Set embedded_metadata value.
Notes:
Metadata objects associated with this entity. This will contain a list of Metadata objects if the API request is made using the special flag to enable the embedded Metadata feature. Only a maximum of Metadat... | nuagenetworks/vspk-python | [
19,
18,
19,
7,
1457133058
] |
def entity_scope(self):
""" Get entity_scope value.
Notes:
Specify if scope of entity is Data center or Enterprise level | nuagenetworks/vspk-python | [
19,
18,
19,
7,
1457133058
] |
def entity_scope(self, value):
""" Set entity_scope value.
Notes:
Specify if scope of entity is Data center or Enterprise level | nuagenetworks/vspk-python | [
19,
18,
19,
7,
1457133058
] |
def creation_date(self):
""" Get creation_date value.
Notes:
Time stamp when this object was created. | nuagenetworks/vspk-python | [
19,
18,
19,
7,
1457133058
] |
def creation_date(self, value):
""" Set creation_date value.
Notes:
Time stamp when this object was created. | nuagenetworks/vspk-python | [
19,
18,
19,
7,
1457133058
] |
def status(self):
""" Get status value.
Notes:
Status of the resync | nuagenetworks/vspk-python | [
19,
18,
19,
7,
1457133058
] |
def status(self, value):
""" Set status value.
Notes:
Status of the resync | nuagenetworks/vspk-python | [
19,
18,
19,
7,
1457133058
] |
def owner(self):
""" Get owner value.
Notes:
Identifies the user that has created this object. | nuagenetworks/vspk-python | [
19,
18,
19,
7,
1457133058
] |
def owner(self, value):
""" Set owner value.
Notes:
Identifies the user that has created this object. | nuagenetworks/vspk-python | [
19,
18,
19,
7,
1457133058
] |
def external_id(self):
""" Get external_id value.
Notes:
External object ID. Used for integration with third party systems | nuagenetworks/vspk-python | [
19,
18,
19,
7,
1457133058
] |
def external_id(self, value):
""" Set external_id value.
Notes:
External object ID. Used for integration with third party systems | nuagenetworks/vspk-python | [
19,
18,
19,
7,
1457133058
] |
def __init__(self):
super(MockTestResultsFetcher, self).__init__()
self._canned_results = {}
self._canned_retry_summary_json = {}
self._webdriver_results = {}
self.fetched_builds = []
self.fetched_webdriver_builds = []
self._layout_test_step_name = 'blink_web_test... | ric2b/Vivaldi-browser | [
131,
27,
131,
3,
1490828945
] |
def fetch_results(self, build, full=False, step_name=None):
step_name = step_name or self.get_layout_test_step_name(build)
step = BuilderStep(build=build, step_name=step_name)
self.fetched_builds.append(step)
return self._canned_results.get(step) | ric2b/Vivaldi-browser | [
131,
27,
131,
3,
1490828945
] |
def fetch_results_from_resultdb(self, host, builds, predicate):
rv = []
for build in builds:
results = self._canned_results.get(build.build_id)
if results:
rv.extend(results)
return rv | ric2b/Vivaldi-browser | [
131,
27,
131,
3,
1490828945
] |
def fetch_webdriver_test_results(self, build, m):
self.fetched_webdriver_builds.append((build, m))
return self._webdriver_results.get((build, m)) | ric2b/Vivaldi-browser | [
131,
27,
131,
3,
1490828945
] |
def fetch_retry_summary_json(self, build):
return self._canned_retry_summary_json.get(build) | ric2b/Vivaldi-browser | [
131,
27,
131,
3,
1490828945
] |
def index():
"""Produces a list of the feedback obtained for a given venue,
or for all venues."""
venue_id = request.args(0)
if venue_id == 'all':
q = (db.submission.user == get_user_email())
else:
q = ((db.submission.user == get_user_email())
& (db.submission.venue_id =... | lucadealfaro/crowdranker | [
5,
5,
5,
1,
1360596564
] |
def view_feedback():
"""Shows detailed feedback for a user in a venue.
This controller accepts various types of arguments:
* 's', submission_id
* 'u', venue_id, username
* 'v', venue_id (in which case, shows own submission to that venue)
"""
if len(request.args) == 0:
redirect(URL(... | lucadealfaro/crowdranker | [
5,
5,
5,
1,
1360596564
] |
def reply_to_review():
t = db.task(request.args(0)) or redirect(URL('default', 'index'))
db.task.submission_name.readable = False
db.task.assigned_date.readable = False
db.task.completed_date.readable = False
db.task.comments.readable = False
db.task.helpfulness.readable = db.task.helpfulness.wr... | lucadealfaro/crowdranker | [
5,
5,
5,
1,
1360596564
] |
def validate_review_feedback(t):
def f(form):
if not form.errors:
feedback_id = keystore_update(t.feedback, form.vars.feedback)
form.vars.feedback = feedback_id
return f | lucadealfaro/crowdranker | [
5,
5,
5,
1,
1360596564
] |
def __init__(self, message, response=None):
super(RequestError, self).__init__(message)
self.response = response | opennode/nodeconductor-assembly-waldur | [
39,
35,
39,
3,
1484854426
] |
def __init__(self, content):
etree = lxml.etree.fromstring(content) # noqa: S320
self.init_response_attributes(etree) | opennode/nodeconductor-assembly-waldur | [
39,
35,
39,
3,
1484854426
] |
def execute(cls, **kwargs):
url = cls._get_url()
headers = {
'content-type': 'text/xml',
'SOAPAction': url,
}
data = cls.template.strip().format(
AP_ID=cls.settings['AP_ID'],
AP_PWD=cls.settings['AP_PWD'],
Instant=cls._format_da... | opennode/nodeconductor-assembly-waldur | [
39,
35,
39,
3,
1484854426
] |
def _format_datetime(cls, d):
return d.strftime('%Y-%m-%dT%H:%M:%S.000Z') | opennode/nodeconductor-assembly-waldur | [
39,
35,
39,
3,
1484854426
] |
def _format_transaction_id(cls, transaction_id):
return ('_' + transaction_id)[:32] # such formation is required by server. | opennode/nodeconductor-assembly-waldur | [
39,
35,
39,
3,
1484854426
] |
def _get_url(cls):
return urljoin(cls.settings['URL'], cls.url) | opennode/nodeconductor-assembly-waldur | [
39,
35,
39,
3,
1484854426
] |
def init_response_attributes(self, etree):
try:
self.backend_transaction_id = etree.xpath('//MSS_SignatureResp')[0].attrib[
'MSSP_TransID'
]
self.status = etree.xpath(
'//ns6:StatusCode', namespaces={'ns6': self.ns_namespace}
)[0].a... | opennode/nodeconductor-assembly-waldur | [
39,
35,
39,
3,
1484854426
] |
def execute(cls, transaction_id, phone, message):
kwargs = {
'MessagingMode': 'asynchClientServer',
'AP_TransID': cls._format_transaction_id(transaction_id),
'MSISDN': phone,
'DataToBeSigned': '%s %s' % (cls.settings['message_prefix'], message),
'Signa... | opennode/nodeconductor-assembly-waldur | [
39,
35,
39,
3,
1484854426
] |
def map(cls, status_code):
if status_code == '502':
return cls.OK
elif status_code == '504':
return cls.PROCESSING
else:
raise UnknownStatusError(
'Received unsupported status in response: %s' % status_code
) | opennode/nodeconductor-assembly-waldur | [
39,
35,
39,
3,
1484854426
] |
def init_response_attributes(self, etree):
try:
status_code = etree.xpath(
'//ns5:StatusCode', namespaces={'ns5': self.ns_namespace}
)[0].attrib['Value']
except (IndexError, KeyError, lxml.etree.XMLSchemaError) as e:
raise ResponseParseError(
... | opennode/nodeconductor-assembly-waldur | [
39,
35,
39,
3,
1484854426
] |
def init_response_attributes(self, etree):
self.status = Statuses.ERRED
try:
self.details = etree.xpath(
'//soapenv:Text', namespaces={'soapenv': self.soapenv_namespace}
)[0].text
except (IndexError, lxml.etree.XMLSchemaError) as e:
raise Respo... | opennode/nodeconductor-assembly-waldur | [
39,
35,
39,
3,
1484854426
] |
def create(kernel):
result = Static()
result.template = "object/static/item/shared_armor_composite_helmet.iff"
result.attribute_template_id = -1
result.stfName("obj_n","unknown_object") | anhstudios/swganh | [
62,
37,
62,
37,
1297996365
] |
def csrf_exempt(func):
return func | colinsullivan/bingo-board | [
5,
1,
5,
6,
1293081853
] |
def __new__(cls, meta=None):
overrides = {} | colinsullivan/bingo-board | [
5,
1,
5,
6,
1293081853
] |
def __new__(cls, name, bases, attrs):
attrs['base_fields'] = {}
declared_fields = {} | colinsullivan/bingo-board | [
5,
1,
5,
6,
1293081853
] |
def __init__(self, api_name=None):
self.fields = deepcopy(self.base_fields) | colinsullivan/bingo-board | [
5,
1,
5,
6,
1293081853
] |
def __getattr__(self, name):
if name in self.fields:
return self.fields[name] | colinsullivan/bingo-board | [
5,
1,
5,
6,
1293081853
] |
def wrap_view(self, view):
"""
Wraps methods so they can be called in a more functional way as well
as handling exceptions better. | colinsullivan/bingo-board | [
5,
1,
5,
6,
1293081853
] |
def wrapper(request, *args, **kwargs):
try:
callback = getattr(self, view)
response = callback(request, *args, **kwargs) | colinsullivan/bingo-board | [
5,
1,
5,
6,
1293081853
] |
def _handle_500(self, request, exception):
import traceback
import sys
the_trace = '\n'.join(traceback.format_exception(*(sys.exc_info()))) | colinsullivan/bingo-board | [
5,
1,
5,
6,
1293081853
] |
def _build_reverse_url(self, name, args=None, kwargs=None):
"""
A convenience hook for overriding how URLs are built. | colinsullivan/bingo-board | [
5,
1,
5,
6,
1293081853
] |
def base_urls(self):
"""
The standard URLs this ``Resource`` should respond to.
"""
# Due to the way Django parses URLs, ``get_multiple`` won't work without
# a trailing slash.
return [
url(r"^(?P<resource_name>%s)%s$" % (self._meta.resource_name, trailing_sla... | colinsullivan/bingo-board | [
5,
1,
5,
6,
1293081853
] |
def override_urls(self):
"""
A hook for adding your own URLs or overriding the default URLs.
"""
return [] | colinsullivan/bingo-board | [
5,
1,
5,
6,
1293081853
] |
def urls(self):
"""
The endpoints this ``Resource`` responds to. | colinsullivan/bingo-board | [
5,
1,
5,
6,
1293081853
] |
def determine_format(self, request):
"""
Used to determine the desired format. | colinsullivan/bingo-board | [
5,
1,
5,
6,
1293081853
] |
def serialize(self, request, data, format, options=None):
"""
Given a request, data and a desired format, produces a serialized
version suitable for transfer over the wire. | colinsullivan/bingo-board | [
5,
1,
5,
6,
1293081853
] |
def deserialize(self, request, data, format='application/json'):
"""
Given a request, data and a format, deserializes the given data. | colinsullivan/bingo-board | [
5,
1,
5,
6,
1293081853
] |
def dispatch_list(self, request, **kwargs):
"""
A view for handling the various HTTP methods (GET/POST/PUT/DELETE) over
the entire list of resources. | colinsullivan/bingo-board | [
5,
1,
5,
6,
1293081853
] |
def dispatch_detail(self, request, **kwargs):
"""
A view for handling the various HTTP methods (GET/POST/PUT/DELETE) on
a single resource. | colinsullivan/bingo-board | [
5,
1,
5,
6,
1293081853
] |
def dispatch(self, request_type, request, **kwargs):
"""
Handles the common operations (allowed HTTP method, authentication,
throttling, method lookup) surrounding most CRUD interactions.
"""
allowed_methods = getattr(self._meta, "%s_allowed_methods" % request_type, None)
... | colinsullivan/bingo-board | [
5,
1,
5,
6,
1293081853
] |
def remove_api_resource_names(self, url_dict):
"""
Given a dictionary of regex matches from a URLconf, removes
``api_name`` and/or ``resource_name`` if found. | colinsullivan/bingo-board | [
5,
1,
5,
6,
1293081853
] |
def method_check(self, request, allowed=None):
"""
Ensures that the HTTP method used on the request is allowed to be
handled by the resource. | colinsullivan/bingo-board | [
5,
1,
5,
6,
1293081853
] |
def is_authorized(self, request, object=None):
"""
Handles checking of permissions to see if the user has authorization
to GET, POST, PUT, or DELETE this resource. If ``object`` is provided,
the authorization backend can apply additional row-level permissions
checking.
"... | colinsullivan/bingo-board | [
5,
1,
5,
6,
1293081853
] |
def is_authenticated(self, request):
"""
Handles checking if the user is authenticated and dealing with
unauthenticated users. | colinsullivan/bingo-board | [
5,
1,
5,
6,
1293081853
] |
def throttle_check(self, request):
"""
Handles checking if the user should be throttled. | colinsullivan/bingo-board | [
5,
1,
5,
6,
1293081853
] |
def log_throttled_access(self, request):
"""
Handles the recording of the user's access for throttling purposes. | colinsullivan/bingo-board | [
5,
1,
5,
6,
1293081853
] |
def build_bundle(self, obj=None, data=None):
"""
Given either an object, a data dictionary or both, builds a ``Bundle``
for use throughout the ``dehydrate/hydrate`` cycle. | colinsullivan/bingo-board | [
5,
1,
5,
6,
1293081853
] |
def build_filters(self, filters=None):
"""
Allows for the filtering of applicable objects. | colinsullivan/bingo-board | [
5,
1,
5,
6,
1293081853
] |
def apply_sorting(self, obj_list, options=None):
"""
Allows for the sorting of objects being returned. | colinsullivan/bingo-board | [
5,
1,
5,
6,
1293081853
] |
def get_resource_uri(self, bundle_or_obj):
"""
This needs to be implemented at the user level. | colinsullivan/bingo-board | [
5,
1,
5,
6,
1293081853
] |
def get_resource_list_uri(self):
"""
Returns a URL specific to this resource's list endpoint.
"""
kwargs = {
'resource_name': self._meta.resource_name,
} | colinsullivan/bingo-board | [
5,
1,
5,
6,
1293081853
] |
def get_via_uri(self, uri):
"""
This pulls apart the salient bits of the URI and populates the
resource via a ``obj_get``. | colinsullivan/bingo-board | [
5,
1,
5,
6,
1293081853
] |
def full_dehydrate(self, obj):
"""
Given an object instance, extract the information from it to populate
the resource.
"""
bundle = Bundle(obj=obj) | colinsullivan/bingo-board | [
5,
1,
5,
6,
1293081853
] |
def dehydrate(self, bundle):
"""
A hook to allow a final manipulation of data once all fields/methods
have built out the dehydrated data. | colinsullivan/bingo-board | [
5,
1,
5,
6,
1293081853
] |
def full_hydrate(self, bundle):
"""
Given a populated bundle, distill it and turn it back into
a full-fledged object instance.
"""
if bundle.obj is None:
bundle.obj = self._meta.object_class() | colinsullivan/bingo-board | [
5,
1,
5,
6,
1293081853
] |
def hydrate(self, bundle):
"""
A hook to allow a final manipulation of data once all fields/methods
have built out the hydrated data. | colinsullivan/bingo-board | [
5,
1,
5,
6,
1293081853
] |
def hydrate_m2m(self, bundle):
"""
Populate the ManyToMany data on the instance.
"""
if bundle.obj is None:
raise HydrationError("You must call 'full_hydrate' before attempting to run 'hydrate_m2m' on %r." % self) | colinsullivan/bingo-board | [
5,
1,
5,
6,
1293081853
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.